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

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

Pull ARM SoC driver changes from Olof Johansson:
"This is a rather large set of patches for device drivers that for one
reason or another the subsystem maintainer preferred to get merged
through the arm-soc tree. There are both new drivers as well as
existing drivers that are getting converted from platform-specific
code into standalone drivers using the appropriate subsystem specific
interfaces.

In particular, we can now have pinctrl, clk, clksource and irqchip
drivers in one file per driver, without the need to call into platform
specific interface, or to get called from platform specific code, as
long as all information about the hardware is provided through a
device tree.

Most of the drivers we touch this time are for clocksource. Since now
most of them are part of drivers/clocksource, I expect that we won't
have to touch these again from arm-soc and can let the clocksource
maintainers take care of these in the future.

Another larger part of this series is specific to the exynos platform,
which is seeing some significant effort in upstreaming and
modernization of its device drivers this time around, which
unfortunately is also the cause for the churn and a lot of the merge
conflicts.

There is one new subsystem that gets merged as part of this series:
the reset controller interface, which is a very simple interface for
taking devices on the SoC out of reset or back into reset. Patches to
use this interface on i.MX follow later in this merge window, and we
are going to have other platforms (at least tegra and sirf) get
converted in 3.11. This will let us get rid of platform specific
callbacks in a number of platform independent device drivers."

* tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (256 commits)
irqchip: s3c24xx: add missing __init annotations
ARM: dts: Disable the RTC by default on exynos5
clk: exynos5250: Fix parent clock for sclk_mmc{0,1,2,3}
ARM: exynos: restore mach/regs-clock.h for exynos5
clocksource: exynos_mct: fix build error on non-DT
pinctrl: vt8500: wmt: Fix checking return value of pinctrl_register()
irqchip: vt8500: Convert arch-vt8500 to new irqchip infrastructure
reset: NULL deref on allocation failure
reset: Add reset controller API
dt: describe base reset signal binding
ARM: EXYNOS: Add arm-pmu DT binding for exynos421x
ARM: EXYNOS: Add arm-pmu DT binding for exynos5250
ARM: EXYNOS: Enable PMUs for exynos4
irqchip: exynos-combiner: Correct combined IRQs for exynos4
irqchip: exynos-combiner: Add set_irq_affinity function for combiner_irq
ARM: EXYNOS: fix compilation error introduced due to common clock migration
clk: exynos5250: Fix divider values for sclk_mmc{0,1,2,3}
clk: exynos4: export clocks required for fimc-is
clk: samsung: Fix compilation error
clk: tegra: fix enum tegra114_clk to match binding
...

+16898 -7299
+69 -22
Documentation/devicetree/bindings/bus/ti-gpmc.txt
··· 35 35 36 36 Timing properties for child nodes. All are optional and default to 0. 37 37 38 - - gpmc,sync-clk: Minimum clock period for synchronous mode, in picoseconds 38 + - gpmc,sync-clk-ps: Minimum clock period for synchronous mode, in picoseconds 39 39 40 - Chip-select signal timings corresponding to GPMC_CONFIG2: 41 - - gpmc,cs-on: Assertion time 42 - - gpmc,cs-rd-off: Read deassertion time 43 - - gpmc,cs-wr-off: Write deassertion time 40 + Chip-select signal timings (in nanoseconds) corresponding to GPMC_CONFIG2: 41 + - gpmc,cs-on-ns: Assertion time 42 + - gpmc,cs-rd-off-ns: Read deassertion time 43 + - gpmc,cs-wr-off-ns: Write deassertion time 44 44 45 - ADV signal timings corresponding to GPMC_CONFIG3: 46 - - gpmc,adv-on: Assertion time 47 - - gpmc,adv-rd-off: Read deassertion time 48 - - gpmc,adv-wr-off: Write deassertion time 45 + ADV signal timings (in nanoseconds) corresponding to GPMC_CONFIG3: 46 + - gpmc,adv-on-ns: Assertion time 47 + - gpmc,adv-rd-off-ns: Read deassertion time 48 + - gpmc,adv-wr-off-ns: Write deassertion time 49 49 50 - WE signals timings corresponding to GPMC_CONFIG4: 51 - - gpmc,we-on: Assertion time 52 - - gpmc,we-off: Deassertion time 50 + WE signals timings (in nanoseconds) corresponding to GPMC_CONFIG4: 51 + - gpmc,we-on-ns Assertion time 52 + - gpmc,we-off-ns: Deassertion time 53 53 54 - OE signals timings corresponding to GPMC_CONFIG4: 55 - - gpmc,oe-on: Assertion time 56 - - gpmc,oe-off: Deassertion time 54 + OE signals timings (in nanoseconds) corresponding to GPMC_CONFIG4: 55 + - gpmc,oe-on-ns: Assertion time 56 + - gpmc,oe-off-ns: Deassertion time 57 57 58 - Access time and cycle time timings corresponding to GPMC_CONFIG5: 59 - - gpmc,page-burst-access: Multiple access word delay 60 - - gpmc,access: Start-cycle to first data valid delay 61 - - gpmc,rd-cycle: Total read cycle time 62 - - gpmc,wr-cycle: Total write cycle time 58 + Access time and cycle time timings (in nanoseconds) corresponding to 59 + GPMC_CONFIG5: 60 + - gpmc,page-burst-access-ns: Multiple access word delay 61 + - gpmc,access-ns: Start-cycle to first data valid delay 62 + - gpmc,rd-cycle-ns: Total read cycle time 63 + - gpmc,wr-cycle-ns: Total write cycle time 64 + - gpmc,bus-turnaround-ns: Turn-around time between successive accesses 65 + - gpmc,cycle2cycle-delay-ns: Delay between chip-select pulses 66 + - gpmc,clk-activation-ns: GPMC clock activation time 67 + - gpmc,wait-monitoring-ns: Start of wait monitoring with regard to valid 68 + data 69 + 70 + Boolean timing parameters. If property is present parameter enabled and 71 + disabled if omitted: 72 + - gpmc,adv-extra-delay: ADV signal is delayed by half GPMC clock 73 + - gpmc,cs-extra-delay: CS signal is delayed by half GPMC clock 74 + - gpmc,cycle2cycle-diffcsen: Add "cycle2cycle-delay" between successive 75 + accesses to a different CS 76 + - gpmc,cycle2cycle-samecsen: Add "cycle2cycle-delay" between successive 77 + accesses to the same CS 78 + - gpmc,oe-extra-delay: OE signal is delayed by half GPMC clock 79 + - gpmc,we-extra-delay: WE signal is delayed by half GPMC clock 80 + - gpmc,time-para-granularity: Multiply all access times by 2 63 81 64 82 The following are only applicable to OMAP3+ and AM335x: 65 - - gpmc,wr-access 66 - - gpmc,wr-data-mux-bus 83 + - gpmc,wr-access-ns: In synchronous write mode, for single or 84 + burst accesses, defines the number of 85 + GPMC_FCLK cycles from start access time 86 + to the GPMC_CLK rising edge used by the 87 + memory device for the first data capture. 88 + - gpmc,wr-data-mux-bus-ns: In address-data multiplex mode, specifies 89 + the time when the first data is driven on 90 + the address-data bus. 67 91 92 + GPMC chip-select settings properties for child nodes. All are optional. 93 + 94 + - gpmc,burst-length Page/burst length. Must be 4, 8 or 16. 95 + - gpmc,burst-wrap Enables wrap bursting 96 + - gpmc,burst-read Enables read page/burst mode 97 + - gpmc,burst-write Enables write page/burst mode 98 + - gpmc,device-nand Device is NAND 99 + - gpmc,device-width Total width of device(s) connected to a GPMC 100 + chip-select in bytes. The GPMC supports 8-bit 101 + and 16-bit devices and so this property must be 102 + 1 or 2. 103 + - gpmc,mux-add-data Address and data multiplexing configuration. 104 + Valid values are 1 for address-address-data 105 + multiplexing mode and 2 for address-data 106 + multiplexing mode. 107 + - gpmc,sync-read Enables synchronous read. Defaults to asynchronous 108 + is this is not set. 109 + - gpmc,sync-write Enables synchronous writes. Defaults to asynchronous 110 + is this is not set. 111 + - gpmc,wait-pin Wait-pin used by client. Must be less than 112 + "gpmc,num-waitpins". 113 + - gpmc,wait-on-read Enables wait monitoring on reads. 114 + - gpmc,wait-on-write Enables wait monitoring on writes. 68 115 69 116 Example for an AM33xx board: 70 117
+288
Documentation/devicetree/bindings/clock/exynos4-clock.txt
··· 1 + * Samsung Exynos4 Clock Controller 2 + 3 + The Exynos4 clock controller generates and supplies clock to various controllers 4 + within the Exynos4 SoC. The clock binding described here is applicable to all 5 + SoC's in the Exynos4 family. 6 + 7 + Required Properties: 8 + 9 + - comptible: should be one of the following. 10 + - "samsung,exynos4210-clock" - controller compatible with Exynos4210 SoC. 11 + - "samsung,exynos4412-clock" - controller compatible with Exynos4412 SoC. 12 + 13 + - reg: physical base address of the controller and length of memory mapped 14 + region. 15 + 16 + - #clock-cells: should be 1. 17 + 18 + The following is the list of clocks generated by the controller. Each clock is 19 + assigned an identifier and client nodes use this identifier to specify the 20 + clock which they consume. Some of the clocks are available only on a particular 21 + Exynos4 SoC and this is specified where applicable. 22 + 23 + 24 + [Core Clocks] 25 + 26 + Clock ID SoC (if specific) 27 + ----------------------------------------------- 28 + 29 + xxti 1 30 + xusbxti 2 31 + fin_pll 3 32 + fout_apll 4 33 + fout_mpll 5 34 + fout_epll 6 35 + fout_vpll 7 36 + sclk_apll 8 37 + sclk_mpll 9 38 + sclk_epll 10 39 + sclk_vpll 11 40 + arm_clk 12 41 + aclk200 13 42 + aclk100 14 43 + aclk160 15 44 + aclk133 16 45 + mout_mpll_user_t 17 Exynos4x12 46 + mout_mpll_user_c 18 Exynos4x12 47 + mout_core 19 48 + mout_apll 20 49 + 50 + 51 + [Clock Gate for Special Clocks] 52 + 53 + Clock ID SoC (if specific) 54 + ----------------------------------------------- 55 + 56 + sclk_fimc0 128 57 + sclk_fimc1 129 58 + sclk_fimc2 130 59 + sclk_fimc3 131 60 + sclk_cam0 132 61 + sclk_cam1 133 62 + sclk_csis0 134 63 + sclk_csis1 135 64 + sclk_hdmi 136 65 + sclk_mixer 137 66 + sclk_dac 138 67 + sclk_pixel 139 68 + sclk_fimd0 140 69 + sclk_mdnie0 141 Exynos4412 70 + sclk_mdnie_pwm0 12 142 Exynos4412 71 + sclk_mipi0 143 72 + sclk_audio0 144 73 + sclk_mmc0 145 74 + sclk_mmc1 146 75 + sclk_mmc2 147 76 + sclk_mmc3 148 77 + sclk_mmc4 149 78 + sclk_sata 150 Exynos4210 79 + sclk_uart0 151 80 + sclk_uart1 152 81 + sclk_uart2 153 82 + sclk_uart3 154 83 + sclk_uart4 155 84 + sclk_audio1 156 85 + sclk_audio2 157 86 + sclk_spdif 158 87 + sclk_spi0 159 88 + sclk_spi1 160 89 + sclk_spi2 161 90 + sclk_slimbus 162 91 + sclk_fimd1 163 Exynos4210 92 + sclk_mipi1 164 Exynos4210 93 + sclk_pcm1 165 94 + sclk_pcm2 166 95 + sclk_i2s1 167 96 + sclk_i2s2 168 97 + sclk_mipihsi 169 Exynos4412 98 + sclk_mfc 170 99 + sclk_pcm0 171 100 + sclk_g3d 172 101 + sclk_pwm_isp 173 Exynos4x12 102 + sclk_spi0_isp 174 Exynos4x12 103 + sclk_spi1_isp 175 Exynos4x12 104 + sclk_uart_isp 176 Exynos4x12 105 + 106 + [Peripheral Clock Gates] 107 + 108 + Clock ID SoC (if specific) 109 + ----------------------------------------------- 110 + 111 + fimc0 256 112 + fimc1 257 113 + fimc2 258 114 + fimc3 259 115 + csis0 260 116 + csis1 261 117 + jpeg 262 118 + smmu_fimc0 263 119 + smmu_fimc1 264 120 + smmu_fimc2 265 121 + smmu_fimc3 266 122 + smmu_jpeg 267 123 + vp 268 124 + mixer 269 125 + tvenc 270 Exynos4210 126 + hdmi 271 127 + smmu_tv 272 128 + mfc 273 129 + smmu_mfcl 274 130 + smmu_mfcr 275 131 + g3d 276 132 + g2d 277 Exynos4210 133 + rotator 278 Exynos4210 134 + mdma 279 Exynos4210 135 + smmu_g2d 280 Exynos4210 136 + smmu_rotator 281 Exynos4210 137 + smmu_mdma 282 Exynos4210 138 + fimd0 283 139 + mie0 284 140 + mdnie0 285 Exynos4412 141 + dsim0 286 142 + smmu_fimd0 287 143 + fimd1 288 Exynos4210 144 + mie1 289 Exynos4210 145 + dsim1 290 Exynos4210 146 + smmu_fimd1 291 Exynos4210 147 + pdma0 292 148 + pdma1 293 149 + pcie_phy 294 150 + sata_phy 295 Exynos4210 151 + tsi 296 152 + sdmmc0 297 153 + sdmmc1 298 154 + sdmmc2 299 155 + sdmmc3 300 156 + sdmmc4 301 157 + sata 302 Exynos4210 158 + sromc 303 159 + usb_host 304 160 + usb_device 305 161 + pcie 306 162 + onenand 307 163 + nfcon 308 164 + smmu_pcie 309 165 + gps 310 166 + smmu_gps 311 167 + uart0 312 168 + uart1 313 169 + uart2 314 170 + uart3 315 171 + uart4 316 172 + i2c0 317 173 + i2c1 318 174 + i2c2 319 175 + i2c3 320 176 + i2c4 321 177 + i2c5 322 178 + i2c6 323 179 + i2c7 324 180 + i2c_hdmi 325 181 + tsadc 326 182 + spi0 327 183 + spi1 328 184 + spi2 329 185 + i2s1 330 186 + i2s2 331 187 + pcm0 332 188 + i2s0 333 189 + pcm1 334 190 + pcm2 335 191 + pwm 336 192 + slimbus 337 193 + spdif 338 194 + ac97 339 195 + modemif 340 196 + chipid 341 197 + sysreg 342 198 + hdmi_cec 343 199 + mct 344 200 + wdt 345 201 + rtc 346 202 + keyif 347 203 + audss 348 204 + mipi_hsi 349 Exynos4210 205 + mdma2 350 Exynos4210 206 + pixelasyncm0 351 207 + pixelasyncm1 352 208 + fimc_lite0 353 Exynos4x12 209 + fimc_lite1 354 Exynos4x12 210 + ppmuispx 355 Exynos4x12 211 + ppmuispmx 356 Exynos4x12 212 + fimc_isp 357 Exynos4x12 213 + fimc_drc 358 Exynos4x12 214 + fimc_fd 359 Exynos4x12 215 + mcuisp 360 Exynos4x12 216 + gicisp 361 Exynos4x12 217 + smmu_isp 362 Exynos4x12 218 + smmu_drc 363 Exynos4x12 219 + smmu_fd 364 Exynos4x12 220 + smmu_lite0 365 Exynos4x12 221 + smmu_lite1 366 Exynos4x12 222 + mcuctl_isp 367 Exynos4x12 223 + mpwm_isp 368 Exynos4x12 224 + i2c0_isp 369 Exynos4x12 225 + i2c1_isp 370 Exynos4x12 226 + mtcadc_isp 371 Exynos4x12 227 + pwm_isp 372 Exynos4x12 228 + wdt_isp 373 Exynos4x12 229 + uart_isp 374 Exynos4x12 230 + asyncaxim 375 Exynos4x12 231 + smmu_ispcx 376 Exynos4x12 232 + spi0_isp 377 Exynos4x12 233 + spi1_isp 378 Exynos4x12 234 + pwm_isp_sclk 379 Exynos4x12 235 + spi0_isp_sclk 380 Exynos4x12 236 + spi1_isp_sclk 381 Exynos4x12 237 + uart_isp_sclk 382 Exynos4x12 238 + 239 + [Mux Clocks] 240 + 241 + Clock ID SoC (if specific) 242 + ----------------------------------------------- 243 + 244 + mout_fimc0 384 245 + mout_fimc1 385 246 + mout_fimc2 386 247 + mout_fimc3 387 248 + mout_cam0 388 249 + mout_cam1 389 250 + mout_csis0 390 251 + mout_csis1 391 252 + mout_g3d0 392 253 + mout_g3d1 393 254 + mout_g3d 394 255 + aclk400_mcuisp 395 Exynos4x12 256 + 257 + [Div Clocks] 258 + 259 + Clock ID SoC (if specific) 260 + ----------------------------------------------- 261 + 262 + div_isp0 450 Exynos4x12 263 + div_isp1 451 Exynos4x12 264 + div_mcuisp0 452 Exynos4x12 265 + div_mcuisp1 453 Exynos4x12 266 + div_aclk200 454 Exynos4x12 267 + div_aclk400_mcuisp 455 Exynos4x12 268 + 269 + 270 + Example 1: An example of a clock controller node is listed below. 271 + 272 + clock: clock-controller@0x10030000 { 273 + compatible = "samsung,exynos4210-clock"; 274 + reg = <0x10030000 0x20000>; 275 + #clock-cells = <1>; 276 + }; 277 + 278 + Example 2: UART controller node that consumes the clock generated by the clock 279 + controller. Refer to the standard clock bindings for information 280 + about 'clocks' and 'clock-names' property. 281 + 282 + serial@13820000 { 283 + compatible = "samsung,exynos4210-uart"; 284 + reg = <0x13820000 0x100>; 285 + interrupts = <0 54 0>; 286 + clocks = <&clock 314>, <&clock 153>; 287 + clock-names = "uart", "clk_uart_baud0"; 288 + };
+177
Documentation/devicetree/bindings/clock/exynos5250-clock.txt
··· 1 + * Samsung Exynos5250 Clock Controller 2 + 3 + The Exynos5250 clock controller generates and supplies clock to various 4 + controllers within the Exynos5250 SoC. 5 + 6 + Required Properties: 7 + 8 + - comptible: should be one of the following. 9 + - "samsung,exynos5250-clock" - controller compatible with Exynos5250 SoC. 10 + 11 + - reg: physical base address of the controller and length of memory mapped 12 + region. 13 + 14 + - #clock-cells: should be 1. 15 + 16 + The following is the list of clocks generated by the controller. Each clock is 17 + assigned an identifier and client nodes use this identifier to specify the 18 + clock which they consume. 19 + 20 + 21 + [Core Clocks] 22 + 23 + Clock ID 24 + ---------------------------- 25 + 26 + fin_pll 1 27 + 28 + [Clock Gate for Special Clocks] 29 + 30 + Clock ID 31 + ---------------------------- 32 + 33 + sclk_cam_bayer 128 34 + sclk_cam0 129 35 + sclk_cam1 130 36 + sclk_gscl_wa 131 37 + sclk_gscl_wb 132 38 + sclk_fimd1 133 39 + sclk_mipi1 134 40 + sclk_dp 135 41 + sclk_hdmi 136 42 + sclk_pixel 137 43 + sclk_audio0 138 44 + sclk_mmc0 139 45 + sclk_mmc1 140 46 + sclk_mmc2 141 47 + sclk_mmc3 142 48 + sclk_sata 143 49 + sclk_usb3 144 50 + sclk_jpeg 145 51 + sclk_uart0 146 52 + sclk_uart1 147 53 + sclk_uart2 148 54 + sclk_uart3 149 55 + sclk_pwm 150 56 + sclk_audio1 151 57 + sclk_audio2 152 58 + sclk_spdif 153 59 + sclk_spi0 154 60 + sclk_spi1 155 61 + sclk_spi2 156 62 + 63 + 64 + [Peripheral Clock Gates] 65 + 66 + Clock ID 67 + ---------------------------- 68 + 69 + gscl0 256 70 + gscl1 257 71 + gscl2 258 72 + gscl3 259 73 + gscl_wa 260 74 + gscl_wb 261 75 + smmu_gscl0 262 76 + smmu_gscl1 263 77 + smmu_gscl2 264 78 + smmu_gscl3 265 79 + mfc 266 80 + smmu_mfcl 267 81 + smmu_mfcr 268 82 + rotator 269 83 + jpeg 270 84 + mdma1 271 85 + smmu_rotator 272 86 + smmu_jpeg 273 87 + smmu_mdma1 274 88 + pdma0 275 89 + pdma1 276 90 + sata 277 91 + usbotg 278 92 + mipi_hsi 279 93 + sdmmc0 280 94 + sdmmc1 281 95 + sdmmc2 282 96 + sdmmc3 283 97 + sromc 284 98 + usb2 285 99 + usb3 286 100 + sata_phyctrl 287 101 + sata_phyi2c 288 102 + uart0 289 103 + uart1 290 104 + uart2 291 105 + uart3 292 106 + uart4 293 107 + i2c0 294 108 + i2c1 295 109 + i2c2 296 110 + i2c3 297 111 + i2c4 298 112 + i2c5 299 113 + i2c6 300 114 + i2c7 301 115 + i2c_hdmi 302 116 + adc 303 117 + spi0 304 118 + spi1 305 119 + spi2 306 120 + i2s1 307 121 + i2s2 308 122 + pcm1 309 123 + pcm2 310 124 + pwm 311 125 + spdif 312 126 + ac97 313 127 + hsi2c0 314 128 + hsi2c1 315 129 + hs12c2 316 130 + hs12c3 317 131 + chipid 318 132 + sysreg 319 133 + pmu 320 134 + cmu_top 321 135 + cmu_core 322 136 + cmu_mem 323 137 + tzpc0 324 138 + tzpc1 325 139 + tzpc2 326 140 + tzpc3 327 141 + tzpc4 328 142 + tzpc5 329 143 + tzpc6 330 144 + tzpc7 331 145 + tzpc8 332 146 + tzpc9 333 147 + hdmi_cec 334 148 + mct 335 149 + wdt 336 150 + rtc 337 151 + tmu 338 152 + fimd1 339 153 + mie1 340 154 + dsim0 341 155 + dp 342 156 + mixer 343 157 + hdmi 345 158 + 159 + Example 1: An example of a clock controller node is listed below. 160 + 161 + clock: clock-controller@0x10010000 { 162 + compatible = "samsung,exynos5250-clock"; 163 + reg = <0x10010000 0x30000>; 164 + #clock-cells = <1>; 165 + }; 166 + 167 + Example 2: UART controller node that consumes the clock generated by the clock 168 + controller. Refer to the standard clock bindings for information 169 + about 'clocks' and 'clock-names' property. 170 + 171 + serial@13820000 { 172 + compatible = "samsung,exynos4210-uart"; 173 + reg = <0x13820000 0x100>; 174 + interrupts = <0 54 0>; 175 + clocks = <&clock 314>, <&clock 153>; 176 + clock-names = "uart", "clk_uart_baud0"; 177 + };
+61
Documentation/devicetree/bindings/clock/exynos5440-clock.txt
··· 1 + * Samsung Exynos5440 Clock Controller 2 + 3 + The Exynos5440 clock controller generates and supplies clock to various 4 + controllers within the Exynos5440 SoC. 5 + 6 + Required Properties: 7 + 8 + - comptible: should be "samsung,exynos5440-clock". 9 + 10 + - reg: physical base address of the controller and length of memory mapped 11 + region. 12 + 13 + - #clock-cells: should be 1. 14 + 15 + The following is the list of clocks generated by the controller. Each clock is 16 + assigned an identifier and client nodes use this identifier to specify the 17 + clock which they consume. 18 + 19 + 20 + [Core Clocks] 21 + 22 + Clock ID 23 + ---------------------------- 24 + 25 + xtal 1 26 + arm_clk 2 27 + 28 + [Peripheral Clock Gates] 29 + 30 + Clock ID 31 + ---------------------------- 32 + 33 + spi_baud 16 34 + pb0_250 17 35 + pr0_250 18 36 + pr1_250 19 37 + b_250 20 38 + b_125 21 39 + b_200 22 40 + sata 23 41 + usb 24 42 + gmac0 25 43 + cs250 26 44 + pb0_250_o 27 45 + pr0_250_o 28 46 + pr1_250_o 29 47 + b_250_o 30 48 + b_125_o 31 49 + b_200_o 32 50 + sata_o 33 51 + usb_o 34 52 + gmac0_o 35 53 + cs250_o 36 54 + 55 + Example: An example of a clock controller node is listed below. 56 + 57 + clock: clock-controller@0x10010000 { 58 + compatible = "samsung,exynos5440-clock"; 59 + reg = <0x160000 0x10000>; 60 + #clock-cells = <1>; 61 + };
+303
Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt
··· 1 + NVIDIA Tegra114 Clock And Reset Controller 2 + 3 + This binding uses the common clock binding: 4 + Documentation/devicetree/bindings/clock/clock-bindings.txt 5 + 6 + The CAR (Clock And Reset) Controller on Tegra is the HW module responsible 7 + for muxing and gating Tegra's clocks, and setting their rates. 8 + 9 + Required properties : 10 + - compatible : Should be "nvidia,tegra114-car" 11 + - reg : Should contain CAR registers location and length 12 + - clocks : Should contain phandle and clock specifiers for two clocks: 13 + the 32 KHz "32k_in", and the board-specific oscillator "osc". 14 + - #clock-cells : Should be 1. 15 + In clock consumers, this cell represents the clock ID exposed by the CAR. 16 + 17 + The first 160 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB 18 + registers. These IDs often match those in the CAR's RST_DEVICES registers, 19 + but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In 20 + this case, those clocks are assigned IDs above 160 in order to highlight 21 + this issue. Implementations that interpret these clock IDs as bit values 22 + within the CLK_OUT_ENB or RST_DEVICES registers should be careful to 23 + explicitly handle these special cases. 24 + 25 + The balance of the clocks controlled by the CAR are assigned IDs of 160 and 26 + above. 27 + 28 + 0 unassigned 29 + 1 unassigned 30 + 2 unassigned 31 + 3 unassigned 32 + 4 rtc 33 + 5 timer 34 + 6 uarta 35 + 7 unassigned (register bit affects uartb and vfir) 36 + 8 unassigned 37 + 9 sdmmc2 38 + 10 unassigned (register bit affects spdif_in and spdif_out) 39 + 11 i2s1 40 + 12 i2c1 41 + 13 ndflash 42 + 14 sdmmc1 43 + 15 sdmmc4 44 + 16 unassigned 45 + 17 pwm 46 + 18 i2s2 47 + 19 epp 48 + 20 unassigned (register bit affects vi and vi_sensor) 49 + 21 2d 50 + 22 usbd 51 + 23 isp 52 + 24 3d 53 + 25 unassigned 54 + 26 disp2 55 + 27 disp1 56 + 28 host1x 57 + 29 vcp 58 + 30 i2s0 59 + 31 unassigned 60 + 61 + 32 unassigned 62 + 33 unassigned 63 + 34 apbdma 64 + 35 unassigned 65 + 36 kbc 66 + 37 unassigned 67 + 38 unassigned 68 + 39 unassigned (register bit affects fuse and fuse_burn) 69 + 40 kfuse 70 + 41 sbc1 71 + 42 nor 72 + 43 unassigned 73 + 44 sbc2 74 + 45 unassigned 75 + 46 sbc3 76 + 47 i2c5 77 + 48 dsia 78 + 49 unassigned 79 + 50 mipi 80 + 51 hdmi 81 + 52 csi 82 + 53 unassigned 83 + 54 i2c2 84 + 55 uartc 85 + 56 mipi-cal 86 + 57 emc 87 + 58 usb2 88 + 59 usb3 89 + 60 msenc 90 + 61 vde 91 + 62 bsea 92 + 63 bsev 93 + 94 + 64 unassigned 95 + 65 uartd 96 + 66 unassigned 97 + 67 i2c3 98 + 68 sbc4 99 + 69 sdmmc3 100 + 70 unassigned 101 + 71 owr 102 + 72 afi 103 + 73 csite 104 + 74 unassigned 105 + 75 unassigned 106 + 76 la 107 + 77 trace 108 + 78 soc_therm 109 + 79 dtv 110 + 80 ndspeed 111 + 81 i2cslow 112 + 82 dsib 113 + 83 tsec 114 + 84 unassigned 115 + 85 unassigned 116 + 86 unassigned 117 + 87 unassigned 118 + 88 unassigned 119 + 89 xusb_host 120 + 90 unassigned 121 + 91 msenc 122 + 92 csus 123 + 93 unassigned 124 + 94 unassigned 125 + 95 unassigned (bit affects xusb_dev and xusb_dev_src) 126 + 127 + 96 unassigned 128 + 97 unassigned 129 + 98 unassigned 130 + 99 mselect 131 + 100 tsensor 132 + 101 i2s3 133 + 102 i2s4 134 + 103 i2c4 135 + 104 sbc5 136 + 105 sbc6 137 + 106 d_audio 138 + 107 apbif 139 + 108 dam0 140 + 109 dam1 141 + 110 dam2 142 + 111 hda2codec_2x 143 + 112 unassigned 144 + 113 audio0_2x 145 + 114 audio1_2x 146 + 115 audio2_2x 147 + 116 audio3_2x 148 + 117 audio4_2x 149 + 118 spdif_2x 150 + 119 actmon 151 + 120 extern1 152 + 121 extern2 153 + 122 extern3 154 + 123 unassigned 155 + 124 unassigned 156 + 125 hda 157 + 126 unassigned 158 + 127 se 159 + 160 + 128 hda2hdmi 161 + 129 unassigned 162 + 130 unassigned 163 + 131 unassigned 164 + 132 unassigned 165 + 133 unassigned 166 + 134 unassigned 167 + 135 unassigned 168 + 136 unassigned 169 + 137 unassigned 170 + 138 unassigned 171 + 139 unassigned 172 + 140 unassigned 173 + 141 unassigned 174 + 142 unassigned 175 + 143 unassigned (bit affects xusb_falcon_src, xusb_fs_src, 176 + xusb_host_src and xusb_ss_src) 177 + 144 cilab 178 + 145 cilcd 179 + 146 cile 180 + 147 dsialp 181 + 148 dsiblp 182 + 149 unassigned 183 + 150 dds 184 + 151 unassigned 185 + 152 dp2 186 + 153 amx 187 + 154 adx 188 + 155 unassigned (bit affects dfll_ref and dfll_soc) 189 + 156 xusb_ss 190 + 191 + 192 uartb 192 + 193 vfir 193 + 194 spdif_in 194 + 195 spdif_out 195 + 196 vi 196 + 197 vi_sensor 197 + 198 fuse 198 + 199 fuse_burn 199 + 200 clk_32k 200 + 201 clk_m 201 + 202 clk_m_div2 202 + 203 clk_m_div4 203 + 204 pll_ref 204 + 205 pll_c 205 + 206 pll_c_out1 206 + 207 pll_c2 207 + 208 pll_c3 208 + 209 pll_m 209 + 210 pll_m_out1 210 + 211 pll_p 211 + 212 pll_p_out1 212 + 213 pll_p_out2 213 + 214 pll_p_out3 214 + 215 pll_p_out4 215 + 216 pll_a 216 + 217 pll_a_out0 217 + 218 pll_d 218 + 219 pll_d_out0 219 + 220 pll_d2 220 + 221 pll_d2_out0 221 + 222 pll_u 222 + 223 pll_u_480M 223 + 224 pll_u_60M 224 + 225 pll_u_48M 225 + 226 pll_u_12M 226 + 227 pll_x 227 + 228 pll_x_out0 228 + 229 pll_re_vco 229 + 230 pll_re_out 230 + 231 pll_e_out0 231 + 232 spdif_in_sync 232 + 233 i2s0_sync 233 + 234 i2s1_sync 234 + 235 i2s2_sync 235 + 236 i2s3_sync 236 + 237 i2s4_sync 237 + 238 vimclk_sync 238 + 239 audio0 239 + 240 audio1 240 + 241 audio2 241 + 242 audio3 242 + 243 audio4 243 + 244 spdif 244 + 245 clk_out_1 245 + 246 clk_out_2 246 + 247 clk_out_3 247 + 248 blink 248 + 252 xusb_host_src 249 + 253 xusb_falcon_src 250 + 254 xusb_fs_src 251 + 255 xusb_ss_src 252 + 256 xusb_dev_src 253 + 257 xusb_dev 254 + 258 xusb_hs_src 255 + 259 sclk 256 + 260 hclk 257 + 261 pclk 258 + 262 cclk_g 259 + 263 cclk_lp 260 + 264 dfll_ref 261 + 265 dfll_soc 262 + 263 + Example SoC include file: 264 + 265 + / { 266 + tegra_car: clock { 267 + compatible = "nvidia,tegra114-car"; 268 + reg = <0x60006000 0x1000>; 269 + #clock-cells = <1>; 270 + }; 271 + 272 + usb@c5004000 { 273 + clocks = <&tegra_car 58>; /* usb2 */ 274 + }; 275 + }; 276 + 277 + Example board file: 278 + 279 + / { 280 + clocks { 281 + compatible = "simple-bus"; 282 + #address-cells = <1>; 283 + #size-cells = <0>; 284 + 285 + osc: clock@0 { 286 + compatible = "fixed-clock"; 287 + reg = <0>; 288 + #clock-cells = <0>; 289 + clock-frequency = <12000000>; 290 + }; 291 + 292 + clk_32k: clock@1 { 293 + compatible = "fixed-clock"; 294 + reg = <1>; 295 + #clock-cells = <0>; 296 + clock-frequency = <32768>; 297 + }; 298 + }; 299 + 300 + &tegra_car { 301 + clocks = <&clk_32k> <&osc>; 302 + }; 303 + };
+2 -2
Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt
··· 120 120 90 clk_d 121 121 91 unassigned 122 122 92 sus 123 - 93 cdev1 124 - 94 cdev2 123 + 93 cdev2 124 + 94 cdev1 125 125 95 unassigned 126 126 127 127 96 uart2
-24
Documentation/devicetree/bindings/gpio/gpio-vt8500.txt
··· 1 - VIA/Wondermedia VT8500 GPIO Controller 2 - ----------------------------------------------------- 3 - 4 - Required properties: 5 - - compatible : "via,vt8500-gpio", "wm,wm8505-gpio" 6 - or "wm,wm8650-gpio" depending on your SoC 7 - - reg : Should contain 1 register range (address and length) 8 - - #gpio-cells : should be <3>. 9 - 1) bank 10 - 2) pin number 11 - 3) flags - should be 0 12 - 13 - Example: 14 - 15 - gpio: gpio-controller@d8110000 { 16 - compatible = "via,vt8500-gpio"; 17 - gpio-controller; 18 - reg = <0xd8110000 0x10000>; 19 - #gpio-cells = <3>; 20 - }; 21 - 22 - vibrate { 23 - gpios = <&gpio 0 1 0>; /* Bank 0, Pin 1, No flags */ 24 - };
+53
Documentation/devicetree/bindings/interrupt-controller/samsung,s3c24xx-irq.txt
··· 1 + Samsung S3C24XX Interrupt Controllers 2 + 3 + The S3C24XX SoCs contain a custom set of interrupt controllers providing a 4 + varying number of interrupt sources. The set consists of a main- and sub- 5 + controller and on newer SoCs even a second main controller. 6 + 7 + Required properties: 8 + - compatible: Compatible property value should be "samsung,s3c2410-irq" 9 + for machines before s3c2416 and "samsung,s3c2416-irq" for s3c2416 and later. 10 + 11 + - reg: Physical base address of the controller and length of memory mapped 12 + region. 13 + 14 + - interrupt-controller : Identifies the node as an interrupt controller 15 + 16 + - #interrupt-cells : Specifies the number of cells needed to encode an 17 + interrupt source. The value shall be 4 and interrupt descriptor shall 18 + have the following format: 19 + <ctrl_num parent_irq ctrl_irq type> 20 + 21 + ctrl_num contains the controller to use: 22 + - 0 ... main controller 23 + - 1 ... sub controller 24 + - 2 ... second main controller on s3c2416 and s3c2450 25 + parent_irq contains the parent bit in the main controller and will be 26 + ignored in main controllers 27 + ctrl_irq contains the interrupt bit of the controller 28 + type contains the trigger type to use 29 + 30 + Example: 31 + 32 + interrupt-controller@4a000000 { 33 + compatible = "samsung,s3c2410-irq"; 34 + reg = <0x4a000000 0x100>; 35 + interrupt-controller; 36 + #interrupt-cells=<4>; 37 + }; 38 + 39 + [...] 40 + 41 + serial@50000000 { 42 + compatible = "samsung,s3c2410-uart"; 43 + reg = <0x50000000 0x4000>; 44 + interrupt-parent = <&subintc>; 45 + interrupts = <1 28 0 4>, <1 28 1 4>; 46 + }; 47 + 48 + rtc@57000000 { 49 + compatible = "samsung,s3c2410-rtc"; 50 + reg = <0x57000000 0x100>; 51 + interrupt-parent = <&intc>; 52 + interrupts = <0 30 0 3>, <0 8 0 3>; 53 + };
+21
Documentation/devicetree/bindings/media/s5p-mfc.txt
··· 21 21 22 22 - samsung,mfc-l : Base address of the second memory bank used by MFC 23 23 for DMA contiguous memory allocation and its size. 24 + 25 + Optional properties: 26 + - samsung,power-domain : power-domain property defined with a phandle 27 + to respective power domain. 28 + 29 + Example: 30 + SoC specific DT entry: 31 + 32 + mfc: codec@13400000 { 33 + compatible = "samsung,mfc-v5"; 34 + reg = <0x13400000 0x10000>; 35 + interrupts = <0 94 0>; 36 + samsung,power-domain = <&pd_mfc>; 37 + }; 38 + 39 + Board specific DT entry: 40 + 41 + codec@13400000 { 42 + samsung,mfc-r = <0x43000000 0x800000>; 43 + samsung,mfc-l = <0x51000000 0x800000>; 44 + };
+98
Documentation/devicetree/bindings/mtd/gpmc-nor.txt
··· 1 + Device tree bindings for NOR flash connect to TI GPMC 2 + 3 + NOR flash connected to the TI GPMC (found on OMAP boards) are represented as 4 + child nodes of the GPMC controller with a name of "nor". 5 + 6 + All timing relevant properties as well as generic GPMC child properties are 7 + explained in a separate documents. Please refer to 8 + Documentation/devicetree/bindings/bus/ti-gpmc.txt 9 + 10 + Required properties: 11 + - bank-width: Width of NOR flash in bytes. GPMC supports 8-bit and 12 + 16-bit devices and so must be either 1 or 2 bytes. 13 + - compatible: Documentation/devicetree/bindings/mtd/mtd-physmap.txt 14 + - gpmc,cs-on-ns: Chip-select assertion time 15 + - gpmc,cs-rd-off-ns: Chip-select de-assertion time for reads 16 + - gpmc,cs-wr-off-ns: Chip-select de-assertion time for writes 17 + - gpmc,oe-on-ns: Output-enable assertion time 18 + - gpmc,oe-off-ns: Output-enable de-assertion time 19 + - gpmc,we-on-ns Write-enable assertion time 20 + - gpmc,we-off-ns: Write-enable de-assertion time 21 + - gpmc,access-ns: Start cycle to first data capture (read access) 22 + - gpmc,rd-cycle-ns: Total read cycle time 23 + - gpmc,wr-cycle-ns: Total write cycle time 24 + - linux,mtd-name: Documentation/devicetree/bindings/mtd/mtd-physmap.txt 25 + - reg: Chip-select, base address (relative to chip-select) 26 + and size of NOR flash. Note that base address will be 27 + typically 0 as this is the start of the chip-select. 28 + 29 + Optional properties: 30 + - gpmc,XXX Additional GPMC timings and settings parameters. See 31 + Documentation/devicetree/bindings/bus/ti-gpmc.txt 32 + 33 + Optional properties for partiton table parsing: 34 + - #address-cells: should be set to 1 35 + - #size-cells: should be set to 1 36 + 37 + Example: 38 + 39 + gpmc: gpmc@6e000000 { 40 + compatible = "ti,omap3430-gpmc", "simple-bus"; 41 + ti,hwmods = "gpmc"; 42 + reg = <0x6e000000 0x1000>; 43 + interrupts = <20>; 44 + gpmc,num-cs = <8>; 45 + gpmc,num-waitpins = <4>; 46 + #address-cells = <2>; 47 + #size-cells = <1>; 48 + 49 + ranges = <0 0 0x10000000 0x08000000>; 50 + 51 + nor@0,0 { 52 + compatible = "cfi-flash"; 53 + linux,mtd-name= "intel,pf48f6000m0y1be"; 54 + #address-cells = <1>; 55 + #size-cells = <1>; 56 + reg = <0 0 0x08000000>; 57 + bank-width = <2>; 58 + 59 + gpmc,mux-add-data; 60 + gpmc,cs-on-ns = <0>; 61 + gpmc,cs-rd-off-ns = <186>; 62 + gpmc,cs-wr-off-ns = <186>; 63 + gpmc,adv-on-ns = <12>; 64 + gpmc,adv-rd-off-ns = <48>; 65 + gpmc,adv-wr-off-ns = <48>; 66 + gpmc,oe-on-ns = <54>; 67 + gpmc,oe-off-ns = <168>; 68 + gpmc,we-on-ns = <54>; 69 + gpmc,we-off-ns = <168>; 70 + gpmc,rd-cycle-ns = <186>; 71 + gpmc,wr-cycle-ns = <186>; 72 + gpmc,access-ns = <114>; 73 + gpmc,page-burst-access-ns = <6>; 74 + gpmc,bus-turnaround-ns = <12>; 75 + gpmc,cycle2cycle-delay-ns = <18>; 76 + gpmc,wr-data-mux-bus-ns = <90>; 77 + gpmc,wr-access-ns = <186>; 78 + gpmc,cycle2cycle-samecsen; 79 + gpmc,cycle2cycle-diffcsen; 80 + 81 + partition@0 { 82 + label = "bootloader-nor"; 83 + reg = <0 0x40000>; 84 + }; 85 + partition@0x40000 { 86 + label = "params-nor"; 87 + reg = <0x40000 0x40000>; 88 + }; 89 + partition@0x80000 { 90 + label = "kernel-nor"; 91 + reg = <0x80000 0x200000>; 92 + }; 93 + partition@0x280000 { 94 + label = "filesystem-nor"; 95 + reg = <0x240000 0x7d80000>; 96 + }; 97 + }; 98 + };
+3
Documentation/devicetree/bindings/mtd/gpmc-onenand.txt
··· 10 10 Required properties: 11 11 12 12 - reg: The CS line the peripheral is connected to 13 + - gpmc,device-width Width of the ONENAND device connected to the GPMC 14 + in bytes. Must be 1 or 2. 13 15 14 16 Optional properties: 15 17 ··· 36 34 37 35 onenand@0 { 38 36 reg = <0 0 0>; /* CS0, offset 0 */ 37 + gpmc,device-width = <2>; 39 38 40 39 #address-cells = <1>; 41 40 #size-cells = <1>;
+97
Documentation/devicetree/bindings/net/gpmc-eth.txt
··· 1 + Device tree bindings for Ethernet chip connected to TI GPMC 2 + 3 + Besides being used to interface with external memory devices, the 4 + General-Purpose Memory Controller can be used to connect Pseudo-SRAM devices 5 + such as ethernet controllers to processors using the TI GPMC as a data bus. 6 + 7 + Ethernet controllers connected to TI GPMC are represented as child nodes of 8 + the GPMC controller with an "ethernet" name. 9 + 10 + All timing relevant properties as well as generic GPMC child properties are 11 + explained in a separate documents. Please refer to 12 + Documentation/devicetree/bindings/bus/ti-gpmc.txt 13 + 14 + For the properties relevant to the ethernet controller connected to the GPMC 15 + refer to the binding documentation of the device. For example, the documentation 16 + for the SMSC 911x is Documentation/devicetree/bindings/net/smsc911x.txt 17 + 18 + Child nodes need to specify the GPMC bus address width using the "bank-width" 19 + property but is possible that an ethernet controller also has a property to 20 + specify the I/O registers address width. Even when the GPMC has a maximum 16-bit 21 + address width, it supports devices with 32-bit word registers. 22 + For example with an SMSC LAN911x/912x controller connected to the TI GPMC on an 23 + OMAP2+ board, "bank-width = <2>;" and "reg-io-width = <4>;". 24 + 25 + Required properties: 26 + - bank-width: Address width of the device in bytes. GPMC supports 8-bit 27 + and 16-bit devices and so must be either 1 or 2 bytes. 28 + - compatible: Compatible string property for the ethernet child device. 29 + - gpmc,cs-on: Chip-select assertion time 30 + - gpmc,cs-rd-off: Chip-select de-assertion time for reads 31 + - gpmc,cs-wr-off: Chip-select de-assertion time for writes 32 + - gpmc,oe-on: Output-enable assertion time 33 + - gpmc,oe-off Output-enable de-assertion time 34 + - gpmc,we-on: Write-enable assertion time 35 + - gpmc,we-off: Write-enable de-assertion time 36 + - gpmc,access: Start cycle to first data capture (read access) 37 + - gpmc,rd-cycle: Total read cycle time 38 + - gpmc,wr-cycle: Total write cycle time 39 + - reg: Chip-select, base address (relative to chip-select) 40 + and size of the memory mapped for the device. 41 + Note that base address will be typically 0 as this 42 + is the start of the chip-select. 43 + 44 + Optional properties: 45 + - gpmc,XXX Additional GPMC timings and settings parameters. See 46 + Documentation/devicetree/bindings/bus/ti-gpmc.txt 47 + 48 + Example: 49 + 50 + gpmc: gpmc@6e000000 { 51 + compatible = "ti,omap3430-gpmc"; 52 + ti,hwmods = "gpmc"; 53 + reg = <0x6e000000 0x1000>; 54 + interrupts = <20>; 55 + gpmc,num-cs = <8>; 56 + gpmc,num-waitpins = <4>; 57 + #address-cells = <2>; 58 + #size-cells = <1>; 59 + 60 + ranges = <5 0 0x2c000000 0x1000000>; 61 + 62 + ethernet@5,0 { 63 + compatible = "smsc,lan9221", "smsc,lan9115"; 64 + reg = <5 0 0xff>; 65 + bank-width = <2>; 66 + 67 + gpmc,mux-add-data; 68 + gpmc,cs-on = <0>; 69 + gpmc,cs-rd-off = <186>; 70 + gpmc,cs-wr-off = <186>; 71 + gpmc,adv-on = <12>; 72 + gpmc,adv-rd-off = <48>; 73 + gpmc,adv-wr-off = <48>; 74 + gpmc,oe-on = <54>; 75 + gpmc,oe-off = <168>; 76 + gpmc,we-on = <54>; 77 + gpmc,we-off = <168>; 78 + gpmc,rd-cycle = <186>; 79 + gpmc,wr-cycle = <186>; 80 + gpmc,access = <114>; 81 + gpmc,page-burst-access = <6>; 82 + gpmc,bus-turnaround = <12>; 83 + gpmc,cycle2cycle-delay = <18>; 84 + gpmc,wr-data-mux-bus = <90>; 85 + gpmc,wr-access = <186>; 86 + gpmc,cycle2cycle-samecsen; 87 + gpmc,cycle2cycle-diffcsen; 88 + 89 + interrupt-parent = <&gpio6>; 90 + interrupts = <16>; 91 + vmmc-supply = <&vddvario>; 92 + vmmc_aux-supply = <&vdd33a>; 93 + reg-io-width = <4>; 94 + 95 + smsc,save-mac-address; 96 + }; 97 + };
+57
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt
··· 1 + VIA VT8500 and Wondermedia WM8xxx-series pinmux/gpio controller 2 + 3 + These SoCs contain a combined Pinmux/GPIO module. Each pin may operate as 4 + either a GPIO in, GPIO out or as an alternate function (I2C, SPI etc). 5 + 6 + Required properties: 7 + - compatible: "via,vt8500-pinctrl", "wm,wm8505-pinctrl", "wm,wm8650-pinctrl", 8 + "wm8750-pinctrl" or "wm,wm8850-pinctrl" 9 + - reg: Should contain the physical address of the module's registers. 10 + - interrupt-controller: Marks the device node as an interrupt controller. 11 + - #interrupt-cells: Should be two. 12 + - gpio-controller: Marks the device node as a GPIO controller. 13 + - #gpio-cells : Should be two. The first cell is the pin number and the 14 + second cell is used to specify optional parameters. 15 + bit 0 - active low 16 + 17 + Please refer to ../gpio/gpio.txt for a general description of GPIO bindings. 18 + 19 + Please refer to pinctrl-bindings.txt in this directory for details of the 20 + common pinctrl bindings used by client devices, including the meaning of the 21 + phrase "pin configuration node". 22 + 23 + Each pin configuration node lists the pin(s) to which it applies, and one or 24 + more of the mux functions to select on those pin(s), and pull-up/down 25 + configuration. Each subnode only affects those parameters that are explicitly 26 + listed. In other words, a subnode that lists only a mux function implies no 27 + information about any pull configuration. Similarly, a subnode that lists only 28 + a pull parameter implies no information about the mux function. 29 + 30 + Required subnode-properties: 31 + - wm,pins: An array of cells. Each cell contains the ID of a pin. 32 + 33 + Optional subnode-properties: 34 + - wm,function: Integer, containing the function to mux to the pin(s): 35 + 0: GPIO in 36 + 1: GPIO out 37 + 2: alternate 38 + 39 + - wm,pull: Integer, representing the pull-down/up to apply to the pin(s): 40 + 0: none 41 + 1: down 42 + 2: up 43 + 44 + Each of wm,function and wm,pull may contain either a single value which 45 + will be applied to all pins in wm,pins, or one value for each entry in 46 + wm,pins. 47 + 48 + Example: 49 + 50 + pinctrl: pinctrl { 51 + compatible = "wm,wm8505-pinctrl"; 52 + reg = <0xD8110000 0x10000>; 53 + interrupt-controller; 54 + #interrupt-cells = <2>; 55 + gpio-controller; 56 + #gpio-cells = <2>; 57 + };
+75
Documentation/devicetree/bindings/reset/reset.txt
··· 1 + = Reset Signal Device Tree Bindings = 2 + 3 + This binding is intended to represent the hardware reset signals present 4 + internally in most IC (SoC, FPGA, ...) designs. Reset signals for whole 5 + standalone chips are most likely better represented as GPIOs, although there 6 + are likely to be exceptions to this rule. 7 + 8 + Hardware blocks typically receive a reset signal. This signal is generated by 9 + a reset provider (e.g. power management or clock module) and received by a 10 + reset consumer (the module being reset, or a module managing when a sub- 11 + ordinate module is reset). This binding exists to represent the provider and 12 + consumer, and provide a way to couple the two together. 13 + 14 + A reset signal is represented by the phandle of the provider, plus a reset 15 + specifier - a list of DT cells that represents the reset signal within the 16 + provider. The length (number of cells) and semantics of the reset specifier 17 + are dictated by the binding of the reset provider, although common schemes 18 + are described below. 19 + 20 + A word on where to place reset signal consumers in device tree: It is possible 21 + in hardware for a reset signal to affect multiple logically separate HW blocks 22 + at once. In this case, it would be unwise to represent this reset signal in 23 + the DT node of each affected HW block, since if activated, an unrelated block 24 + may be reset. Instead, reset signals should be represented in the DT node 25 + where it makes most sense to control it; this may be a bus node if all 26 + children of the bus are affected by the reset signal, or an individual HW 27 + block node for dedicated reset signals. The intent of this binding is to give 28 + appropriate software access to the reset signals in order to manage the HW, 29 + rather than to slavishly enumerate the reset signal that affects each HW 30 + block. 31 + 32 + = Reset providers = 33 + 34 + Required properties: 35 + #reset-cells: Number of cells in a reset specifier; Typically 0 for nodes 36 + with a single reset output and 1 for nodes with multiple 37 + reset outputs. 38 + 39 + For example: 40 + 41 + rst: reset-controller { 42 + #reset-cells = <1>; 43 + }; 44 + 45 + = Reset consumers = 46 + 47 + Required properties: 48 + resets: List of phandle and reset specifier pairs, one pair 49 + for each reset signal that affects the device, or that the 50 + device manages. Note: if the reset provider specifies '0' for 51 + #reset-cells, then only the phandle portion of the pair will 52 + appear. 53 + 54 + Optional properties: 55 + reset-names: List of reset signal name strings sorted in the same order as 56 + the resets property. Consumers drivers will use reset-names to 57 + match reset signal names with reset specifiers. 58 + 59 + For example: 60 + 61 + device { 62 + resets = <&rst 20>; 63 + reset-names = "reset"; 64 + }; 65 + 66 + This represents a device with a single reset signal named "reset". 67 + 68 + bus { 69 + resets = <&rst 10> <&rst 11> <&rst 12> <&rst 11>; 70 + reset-names = "i2s1", "i2s2", "dma", "mixer"; 71 + }; 72 + 73 + This represents a bus that controls the reset signal of each of four sub- 74 + ordinate devices. Consider for example a bus that fails to operate unless no 75 + child device has reset asserted.
+17
Documentation/devicetree/bindings/timer/cadence,ttc-timer.txt
··· 1 + Cadence TTC - Triple Timer Counter 2 + 3 + Required properties: 4 + - compatible : Should be "cdns,ttc". 5 + - reg : Specifies base physical address and size of the registers. 6 + - interrupts : A list of 3 interrupts; one per timer channel. 7 + - clocks: phandle to the source clock 8 + 9 + Example: 10 + 11 + ttc0: ttc0@f8001000 { 12 + interrupt-parent = <&intc>; 13 + interrupts = < 0 10 4 0 11 4 0 12 4 >; 14 + compatible = "cdns,ttc"; 15 + reg = <0xF8001000 0x1000>; 16 + clocks = <&cpu_clk 3>; 17 + };
+68
Documentation/devicetree/bindings/timer/samsung,exynos4210-mct.txt
··· 1 + Samsung's Multi Core Timer (MCT) 2 + 3 + The Samsung's Multi Core Timer (MCT) module includes two main blocks, the 4 + global timer and CPU local timers. The global timer is a 64-bit free running 5 + up-counter and can generate 4 interrupts when the counter reaches one of the 6 + four preset counter values. The CPU local timers are 32-bit free running 7 + down-counters and generate an interrupt when the counter expires. There is 8 + one CPU local timer instantiated in MCT for every CPU in the system. 9 + 10 + Required properties: 11 + 12 + - compatible: should be "samsung,exynos4210-mct". 13 + (a) "samsung,exynos4210-mct", for mct compatible with Exynos4210 mct. 14 + (b) "samsung,exynos4412-mct", for mct compatible with Exynos4412 mct. 15 + 16 + - reg: base address of the mct controller and length of the address space 17 + it occupies. 18 + 19 + - interrupts: the list of interrupts generated by the controller. The following 20 + should be the order of the interrupts specified. The local timer interrupts 21 + should be specified after the four global timer interrupts have been 22 + specified. 23 + 24 + 0: Global Timer Interrupt 0 25 + 1: Global Timer Interrupt 1 26 + 2: Global Timer Interrupt 2 27 + 3: Global Timer Interrupt 3 28 + 4: Local Timer Interrupt 0 29 + 5: Local Timer Interrupt 1 30 + 6: .. 31 + 7: .. 32 + i: Local Timer Interrupt n 33 + 34 + Example 1: In this example, the system uses only the first global timer 35 + interrupt generated by MCT and the remaining three global timer 36 + interrupts are unused. Two local timer interrupts have been 37 + specified. 38 + 39 + mct@10050000 { 40 + compatible = "samsung,exynos4210-mct"; 41 + reg = <0x10050000 0x800>; 42 + interrupts = <0 57 0>, <0 0 0>, <0 0 0>, <0 0 0>, 43 + <0 42 0>, <0 48 0>; 44 + }; 45 + 46 + Example 2: In this example, the MCT global and local timer interrupts are 47 + connected to two seperate interrupt controllers. Hence, an 48 + interrupt-map is created to map the interrupts to the respective 49 + interrupt controllers. 50 + 51 + mct@101C0000 { 52 + compatible = "samsung,exynos4210-mct"; 53 + reg = <0x101C0000 0x800>; 54 + interrupt-controller; 55 + #interrups-cells = <2>; 56 + interrupt-parent = <&mct_map>; 57 + interrupts = <0 0>, <1 0>, <2 0>, <3 0>, 58 + <4 0>, <5 0>; 59 + 60 + mct_map: mct-map { 61 + #interrupt-cells = <2>; 62 + #address-cells = <0>; 63 + #size-cells = <0>; 64 + interrupt-map = <0x0 0 &combiner 23 3>, 65 + <0x4 0 &gic 0 120 0>, 66 + <0x5 0 &gic 0 121 0>; 67 + }; 68 + };
+40
Documentation/devicetree/bindings/usb/exynos-usb.txt
··· 1 + Samsung Exynos SoC USB controller 2 + 3 + The USB devices interface with USB controllers on Exynos SOCs. 4 + The device node has following properties. 5 + 6 + EHCI 7 + Required properties: 8 + - compatible: should be "samsung,exynos4210-ehci" for USB 2.0 9 + EHCI controller in host mode. 10 + - reg: physical base address of the controller and length of memory mapped 11 + region. 12 + - interrupts: interrupt number to the cpu. 13 + 14 + Optional properties: 15 + - samsung,vbus-gpio: if present, specifies the GPIO that 16 + needs to be pulled up for the bus to be powered. 17 + 18 + Example: 19 + 20 + usb@12110000 { 21 + compatible = "samsung,exynos4210-ehci"; 22 + reg = <0x12110000 0x100>; 23 + interrupts = <0 71 0>; 24 + samsung,vbus-gpio = <&gpx2 6 1 3 3>; 25 + }; 26 + 27 + OHCI 28 + Required properties: 29 + - compatible: should be "samsung,exynos4210-ohci" for USB 2.0 30 + OHCI companion controller in host mode. 31 + - reg: physical base address of the controller and length of memory mapped 32 + region. 33 + - interrupts: interrupt number to the cpu. 34 + 35 + Example: 36 + usb@12120000 { 37 + compatible = "samsung,exynos4210-ohci"; 38 + reg = <0x12120000 0x100>; 39 + interrupts = <0 71 0>; 40 + };
+12 -4
arch/arm/Kconfig
··· 689 689 config ARCH_S3C24XX 690 690 bool "Samsung S3C24XX SoCs" 691 691 select ARCH_HAS_CPUFREQ 692 - select ARCH_USES_GETTIMEOFFSET 692 + select ARCH_REQUIRE_GPIOLIB 693 693 select CLKDEV_LOOKUP 694 + select CLKSRC_MMIO 695 + select GENERIC_CLOCKEVENTS 694 696 select HAVE_CLK 695 697 select HAVE_S3C2410_I2C if I2C 696 698 select HAVE_S3C2410_WATCHDOG if WATCHDOG 697 699 select HAVE_S3C_RTC if RTC_CLASS 700 + select MULTI_IRQ_HANDLER 698 701 select NEED_MACH_GPIO_H 699 702 select NEED_MACH_IO_H 700 703 help ··· 710 707 bool "Samsung S3C64XX" 711 708 select ARCH_HAS_CPUFREQ 712 709 select ARCH_REQUIRE_GPIOLIB 713 - select ARCH_USES_GETTIMEOFFSET 714 710 select ARM_VIC 715 711 select CLKDEV_LOOKUP 712 + select CLKSRC_MMIO 716 713 select CPU_V6 714 + select GENERIC_CLOCKEVENTS 717 715 select HAVE_CLK 718 716 select HAVE_S3C2410_I2C if I2C 719 717 select HAVE_S3C2410_WATCHDOG if WATCHDOG ··· 748 744 749 745 config ARCH_S5PC100 750 746 bool "Samsung S5PC100" 751 - select ARCH_USES_GETTIMEOFFSET 747 + select ARCH_REQUIRE_GPIOLIB 752 748 select CLKDEV_LOOKUP 749 + select CLKSRC_MMIO 753 750 select CPU_V7 751 + select GENERIC_CLOCKEVENTS 754 752 select HAVE_CLK 755 753 select HAVE_S3C2410_I2C if I2C 756 754 select HAVE_S3C2410_WATCHDOG if WATCHDOG ··· 785 779 select ARCH_HAS_HOLES_MEMORYMODEL 786 780 select ARCH_SPARSEMEM_ENABLE 787 781 select CLKDEV_LOOKUP 782 + select COMMON_CLK 788 783 select CPU_V7 789 784 select GENERIC_CLOCKEVENTS 790 785 select HAVE_CLK ··· 1559 1552 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA 1560 1553 default 512 if SOC_OMAP5 1561 1554 default 392 if ARCH_U8500 1562 - default 288 if ARCH_VT8500 || ARCH_SUNXI 1555 + default 352 if ARCH_VT8500 1556 + default 288 if ARCH_SUNXI 1563 1557 default 264 if MACH_H4700 1564 1558 default 0 1565 1559 help
+3
arch/arm/boot/dts/Makefile
··· 49 49 dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ 50 50 exynos4210-smdkv310.dtb \ 51 51 exynos4210-trats.dtb \ 52 + exynos4412-odroidx.dtb \ 52 53 exynos4412-smdk4412.dtb \ 54 + exynos4412-origen.dtb \ 55 + exynos5250-arndale.dtb \ 53 56 exynos5250-smdk5250.dtb \ 54 57 exynos5250-snow.dtb \ 55 58 exynos5440-ssdk5440.dtb
+138
arch/arm/boot/dts/cros5250-common.dtsi
··· 24 24 samsung,i2c-max-bus-freq = <378000>; 25 25 gpios = <&gpb3 0 2 3 0>, 26 26 <&gpb3 1 2 3 0>; 27 + 28 + max77686@09 { 29 + compatible = "maxim,max77686"; 30 + reg = <0x09>; 31 + 32 + voltage-regulators { 33 + ldo1_reg: LDO1 { 34 + regulator-name = "P1.0V_LDO_OUT1"; 35 + regulator-min-microvolt = <1000000>; 36 + regulator-max-microvolt = <1000000>; 37 + regulator-always-on; 38 + }; 39 + 40 + ldo2_reg: LDO2 { 41 + regulator-name = "P1.8V_LDO_OUT2"; 42 + regulator-min-microvolt = <1800000>; 43 + regulator-max-microvolt = <1800000>; 44 + regulator-always-on; 45 + }; 46 + 47 + ldo3_reg: LDO3 { 48 + regulator-name = "P1.8V_LDO_OUT3"; 49 + regulator-min-microvolt = <1800000>; 50 + regulator-max-microvolt = <1800000>; 51 + regulator-always-on; 52 + }; 53 + 54 + ldo7_reg: LDO7 { 55 + regulator-name = "P1.1V_LDO_OUT7"; 56 + regulator-min-microvolt = <1100000>; 57 + regulator-max-microvolt = <1100000>; 58 + regulator-always-on; 59 + }; 60 + 61 + ldo8_reg: LDO8 { 62 + regulator-name = "P1.0V_LDO_OUT8"; 63 + regulator-min-microvolt = <1000000>; 64 + regulator-max-microvolt = <1000000>; 65 + regulator-always-on; 66 + }; 67 + 68 + ldo10_reg: LDO10 { 69 + regulator-name = "P1.8V_LDO_OUT10"; 70 + regulator-min-microvolt = <1800000>; 71 + regulator-max-microvolt = <1800000>; 72 + regulator-always-on; 73 + }; 74 + 75 + ldo12_reg: LDO12 { 76 + regulator-name = "P3.0V_LDO_OUT12"; 77 + regulator-min-microvolt = <3000000>; 78 + regulator-max-microvolt = <3000000>; 79 + regulator-always-on; 80 + }; 81 + 82 + ldo14_reg: LDO14 { 83 + regulator-name = "P1.8V_LDO_OUT14"; 84 + regulator-min-microvolt = <1800000>; 85 + regulator-max-microvolt = <1800000>; 86 + regulator-always-on; 87 + }; 88 + 89 + ldo15_reg: LDO15 { 90 + regulator-name = "P1.0V_LDO_OUT15"; 91 + regulator-min-microvolt = <1000000>; 92 + regulator-max-microvolt = <1000000>; 93 + regulator-always-on; 94 + }; 95 + 96 + ldo16_reg: LDO16 { 97 + regulator-name = "P1.8V_LDO_OUT16"; 98 + regulator-min-microvolt = <1800000>; 99 + regulator-max-microvolt = <1800000>; 100 + regulator-always-on; 101 + }; 102 + 103 + buck1_reg: BUCK1 { 104 + regulator-name = "vdd_mif"; 105 + regulator-min-microvolt = <950000>; 106 + regulator-max-microvolt = <1300000>; 107 + regulator-always-on; 108 + regulator-boot-on; 109 + }; 110 + 111 + buck2_reg: BUCK2 { 112 + regulator-name = "vdd_arm"; 113 + regulator-min-microvolt = <850000>; 114 + regulator-max-microvolt = <1350000>; 115 + regulator-always-on; 116 + regulator-boot-on; 117 + }; 118 + 119 + buck3_reg: BUCK3 { 120 + regulator-name = "vdd_int"; 121 + regulator-min-microvolt = <900000>; 122 + regulator-max-microvolt = <1200000>; 123 + regulator-always-on; 124 + regulator-boot-on; 125 + }; 126 + 127 + buck4_reg: BUCK4 { 128 + regulator-name = "vdd_g3d"; 129 + regulator-min-microvolt = <850000>; 130 + regulator-max-microvolt = <1300000>; 131 + regulator-always-on; 132 + regulator-boot-on; 133 + }; 134 + 135 + buck5_reg: BUCK5 { 136 + regulator-name = "P1.8V_BUCK_OUT5"; 137 + regulator-min-microvolt = <1800000>; 138 + regulator-max-microvolt = <1800000>; 139 + regulator-always-on; 140 + regulator-boot-on; 141 + }; 142 + 143 + buck6_reg: BUCK6 { 144 + regulator-name = "P1.35V_BUCK_OUT6"; 145 + regulator-min-microvolt = <1350000>; 146 + regulator-max-microvolt = <1350000>; 147 + regulator-always-on; 148 + }; 149 + 150 + buck7_reg: BUCK7 { 151 + regulator-name = "P2.0V_BUCK_OUT7"; 152 + regulator-min-microvolt = <2000000>; 153 + regulator-max-microvolt = <2000000>; 154 + regulator-always-on; 155 + }; 156 + 157 + buck8_reg: BUCK8 { 158 + regulator-name = "P2.85V_BUCK_OUT8"; 159 + regulator-min-microvolt = <2850000>; 160 + regulator-max-microvolt = <2850000>; 161 + regulator-always-on; 162 + }; 163 + }; 164 + }; 27 165 }; 28 166 29 167 i2c@12C70000 {
+58
arch/arm/boot/dts/exynos4.dtsi
··· 86 86 compatible = "samsung,s3c2410-wdt"; 87 87 reg = <0x10060000 0x100>; 88 88 interrupts = <0 43 0>; 89 + clocks = <&clock 345>; 90 + clock-names = "watchdog"; 89 91 status = "disabled"; 90 92 }; 91 93 ··· 95 93 compatible = "samsung,s3c6410-rtc"; 96 94 reg = <0x10070000 0x100>; 97 95 interrupts = <0 44 0>, <0 45 0>; 96 + clocks = <&clock 346>; 97 + clock-names = "rtc"; 98 98 status = "disabled"; 99 99 }; 100 100 ··· 104 100 compatible = "samsung,s5pv210-keypad"; 105 101 reg = <0x100A0000 0x100>; 106 102 interrupts = <0 109 0>; 103 + clocks = <&clock 347>; 104 + clock-names = "keypad"; 107 105 status = "disabled"; 108 106 }; 109 107 ··· 113 107 compatible = "samsung,exynos4210-sdhci"; 114 108 reg = <0x12510000 0x100>; 115 109 interrupts = <0 73 0>; 110 + clocks = <&clock 297>, <&clock 145>; 111 + clock-names = "hsmmc", "mmc_busclk.2"; 116 112 status = "disabled"; 117 113 }; 118 114 ··· 122 114 compatible = "samsung,exynos4210-sdhci"; 123 115 reg = <0x12520000 0x100>; 124 116 interrupts = <0 74 0>; 117 + clocks = <&clock 298>, <&clock 146>; 118 + clock-names = "hsmmc", "mmc_busclk.2"; 125 119 status = "disabled"; 126 120 }; 127 121 ··· 131 121 compatible = "samsung,exynos4210-sdhci"; 132 122 reg = <0x12530000 0x100>; 133 123 interrupts = <0 75 0>; 124 + clocks = <&clock 299>, <&clock 147>; 125 + clock-names = "hsmmc", "mmc_busclk.2"; 134 126 status = "disabled"; 135 127 }; 136 128 ··· 140 128 compatible = "samsung,exynos4210-sdhci"; 141 129 reg = <0x12540000 0x100>; 142 130 interrupts = <0 76 0>; 131 + clocks = <&clock 300>, <&clock 148>; 132 + clock-names = "hsmmc", "mmc_busclk.2"; 133 + status = "disabled"; 134 + }; 135 + 136 + mfc: codec@13400000 { 137 + compatible = "samsung,mfc-v5"; 138 + reg = <0x13400000 0x10000>; 139 + interrupts = <0 94 0>; 140 + samsung,power-domain = <&pd_mfc>; 143 141 status = "disabled"; 144 142 }; 145 143 ··· 157 135 compatible = "samsung,exynos4210-uart"; 158 136 reg = <0x13800000 0x100>; 159 137 interrupts = <0 52 0>; 138 + clocks = <&clock 312>, <&clock 151>; 139 + clock-names = "uart", "clk_uart_baud0"; 160 140 status = "disabled"; 161 141 }; 162 142 ··· 166 142 compatible = "samsung,exynos4210-uart"; 167 143 reg = <0x13810000 0x100>; 168 144 interrupts = <0 53 0>; 145 + clocks = <&clock 313>, <&clock 152>; 146 + clock-names = "uart", "clk_uart_baud0"; 169 147 status = "disabled"; 170 148 }; 171 149 ··· 175 149 compatible = "samsung,exynos4210-uart"; 176 150 reg = <0x13820000 0x100>; 177 151 interrupts = <0 54 0>; 152 + clocks = <&clock 314>, <&clock 153>; 153 + clock-names = "uart", "clk_uart_baud0"; 178 154 status = "disabled"; 179 155 }; 180 156 ··· 184 156 compatible = "samsung,exynos4210-uart"; 185 157 reg = <0x13830000 0x100>; 186 158 interrupts = <0 55 0>; 159 + clocks = <&clock 315>, <&clock 154>; 160 + clock-names = "uart", "clk_uart_baud0"; 187 161 status = "disabled"; 188 162 }; 189 163 ··· 195 165 compatible = "samsung,s3c2440-i2c"; 196 166 reg = <0x13860000 0x100>; 197 167 interrupts = <0 58 0>; 168 + clocks = <&clock 317>; 169 + clock-names = "i2c"; 198 170 status = "disabled"; 199 171 }; 200 172 ··· 206 174 compatible = "samsung,s3c2440-i2c"; 207 175 reg = <0x13870000 0x100>; 208 176 interrupts = <0 59 0>; 177 + clocks = <&clock 318>; 178 + clock-names = "i2c"; 209 179 status = "disabled"; 210 180 }; 211 181 ··· 217 183 compatible = "samsung,s3c2440-i2c"; 218 184 reg = <0x13880000 0x100>; 219 185 interrupts = <0 60 0>; 186 + clocks = <&clock 319>; 187 + clock-names = "i2c"; 220 188 status = "disabled"; 221 189 }; 222 190 ··· 228 192 compatible = "samsung,s3c2440-i2c"; 229 193 reg = <0x13890000 0x100>; 230 194 interrupts = <0 61 0>; 195 + clocks = <&clock 320>; 196 + clock-names = "i2c"; 231 197 status = "disabled"; 232 198 }; 233 199 ··· 239 201 compatible = "samsung,s3c2440-i2c"; 240 202 reg = <0x138A0000 0x100>; 241 203 interrupts = <0 62 0>; 204 + clocks = <&clock 321>; 205 + clock-names = "i2c"; 242 206 status = "disabled"; 243 207 }; 244 208 ··· 250 210 compatible = "samsung,s3c2440-i2c"; 251 211 reg = <0x138B0000 0x100>; 252 212 interrupts = <0 63 0>; 213 + clocks = <&clock 322>; 214 + clock-names = "i2c"; 253 215 status = "disabled"; 254 216 }; 255 217 ··· 261 219 compatible = "samsung,s3c2440-i2c"; 262 220 reg = <0x138C0000 0x100>; 263 221 interrupts = <0 64 0>; 222 + clocks = <&clock 323>; 223 + clock-names = "i2c"; 264 224 status = "disabled"; 265 225 }; 266 226 ··· 272 228 compatible = "samsung,s3c2440-i2c"; 273 229 reg = <0x138D0000 0x100>; 274 230 interrupts = <0 65 0>; 231 + clocks = <&clock 324>; 232 + clock-names = "i2c"; 275 233 status = "disabled"; 276 234 }; 277 235 ··· 285 239 rx-dma-channel = <&pdma0 6>; /* preliminary */ 286 240 #address-cells = <1>; 287 241 #size-cells = <0>; 242 + clocks = <&clock 327>, <&clock 159>; 243 + clock-names = "spi", "spi_busclk0"; 288 244 status = "disabled"; 289 245 }; 290 246 ··· 298 250 rx-dma-channel = <&pdma1 6>; /* preliminary */ 299 251 #address-cells = <1>; 300 252 #size-cells = <0>; 253 + clocks = <&clock 328>, <&clock 160>; 254 + clock-names = "spi", "spi_busclk0"; 301 255 status = "disabled"; 302 256 }; 303 257 ··· 311 261 rx-dma-channel = <&pdma0 8>; /* preliminary */ 312 262 #address-cells = <1>; 313 263 #size-cells = <0>; 264 + clocks = <&clock 329>, <&clock 161>; 265 + clock-names = "spi", "spi_busclk0"; 314 266 status = "disabled"; 315 267 }; 316 268 ··· 327 275 compatible = "arm,pl330", "arm,primecell"; 328 276 reg = <0x12680000 0x1000>; 329 277 interrupts = <0 35 0>; 278 + clocks = <&clock 292>; 279 + clock-names = "apb_pclk"; 330 280 #dma-cells = <1>; 331 281 #dma-channels = <8>; 332 282 #dma-requests = <32>; ··· 338 284 compatible = "arm,pl330", "arm,primecell"; 339 285 reg = <0x12690000 0x1000>; 340 286 interrupts = <0 36 0>; 287 + clocks = <&clock 293>; 288 + clock-names = "apb_pclk"; 341 289 #dma-cells = <1>; 342 290 #dma-channels = <8>; 343 291 #dma-requests = <32>; ··· 349 293 compatible = "arm,pl330", "arm,primecell"; 350 294 reg = <0x12850000 0x1000>; 351 295 interrupts = <0 34 0>; 296 + clocks = <&clock 279>; 297 + clock-names = "apb_pclk"; 352 298 #dma-cells = <1>; 353 299 #dma-channels = <8>; 354 300 #dma-requests = <1>;
+18
arch/arm/boot/dts/exynos4210-origen.dts
··· 57 57 status = "okay"; 58 58 }; 59 59 60 + codec@13400000 { 61 + samsung,mfc-r = <0x43000000 0x800000>; 62 + samsung,mfc-l = <0x51000000 0x800000>; 63 + status = "okay"; 64 + }; 65 + 60 66 serial@13800000 { 61 67 status = "okay"; 62 68 }; ··· 125 119 status { 126 120 gpios = <&gpx1 3 1>; 127 121 linux,default-trigger = "heartbeat"; 122 + }; 123 + }; 124 + 125 + fixed-rate-clocks { 126 + xxti { 127 + compatible = "samsung,clock-xxti"; 128 + clock-frequency = <0>; 129 + }; 130 + 131 + xusbxti { 132 + compatible = "samsung,clock-xusbxti"; 133 + clock-frequency = <24000000>; 128 134 }; 129 135 }; 130 136 };
+18
arch/arm/boot/dts/exynos4210-smdkv310.dts
··· 43 43 status = "okay"; 44 44 }; 45 45 46 + codec@13400000 { 47 + samsung,mfc-r = <0x43000000 0x800000>; 48 + samsung,mfc-l = <0x51000000 0x800000>; 49 + status = "okay"; 50 + }; 51 + 46 52 serial@13800000 { 47 53 status = "okay"; 48 54 }; ··· 193 187 label = "Kernel"; 194 188 reg = <0x40000 0xc0000>; 195 189 }; 190 + }; 191 + }; 192 + 193 + fixed-rate-clocks { 194 + xxti { 195 + compatible = "samsung,clock-xxti"; 196 + clock-frequency = <12000000>; 197 + }; 198 + 199 + xusbxti { 200 + compatible = "samsung,clock-xusbxti"; 201 + clock-frequency = <24000000>; 196 202 }; 197 203 }; 198 204 };
+12
arch/arm/boot/dts/exynos4210-trats.dts
··· 289 289 }; 290 290 }; 291 291 }; 292 + 293 + fixed-rate-clocks { 294 + xxti { 295 + compatible = "samsung,clock-xxti"; 296 + clock-frequency = <0>; 297 + }; 298 + 299 + xusbxti { 300 + compatible = "samsung,clock-xusbxti"; 301 + clock-frequency = <24000000>; 302 + }; 303 + }; 292 304 };
+36
arch/arm/boot/dts/exynos4210.dtsi
··· 47 47 <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>; 48 48 }; 49 49 50 + mct@10050000 { 51 + compatible = "samsung,exynos4210-mct"; 52 + reg = <0x10050000 0x800>; 53 + interrupt-controller; 54 + #interrups-cells = <2>; 55 + interrupt-parent = <&mct_map>; 56 + interrupts = <0 0>, <1 0>, <2 0>, <3 0>, 57 + <4 0>, <5 0>; 58 + clocks = <&clock 3>, <&clock 344>; 59 + clock-names = "fin_pll", "mct"; 60 + 61 + mct_map: mct-map { 62 + #interrupt-cells = <2>; 63 + #address-cells = <0>; 64 + #size-cells = <0>; 65 + interrupt-map = <0x0 0 &gic 0 57 0>, 66 + <0x1 0 &gic 0 69 0>, 67 + <0x2 0 &combiner 12 6>, 68 + <0x3 0 &combiner 12 7>, 69 + <0x4 0 &gic 0 42 0>, 70 + <0x5 0 &gic 0 48 0>; 71 + }; 72 + }; 73 + 74 + clock: clock-controller@0x10030000 { 75 + compatible = "samsung,exynos4210-clock"; 76 + reg = <0x10030000 0x20000>; 77 + #clock-cells = <1>; 78 + }; 79 + 80 + pmu { 81 + compatible = "arm,cortex-a9-pmu"; 82 + interrupt-parent = <&combiner>; 83 + interrupts = <2 2>, <3 2>; 84 + }; 85 + 50 86 pinctrl_0: pinctrl@11400000 { 51 87 compatible = "samsung,exynos4210-pinctrl"; 52 88 reg = <0x11400000 0x1000>;
+22
arch/arm/boot/dts/exynos4212.dtsi
··· 25 25 gic:interrupt-controller@10490000 { 26 26 cpu-offset = <0x8000>; 27 27 }; 28 + 29 + mct@10050000 { 30 + compatible = "samsung,exynos4412-mct"; 31 + reg = <0x10050000 0x800>; 32 + interrupt-controller; 33 + #interrups-cells = <2>; 34 + interrupt-parent = <&mct_map>; 35 + interrupts = <0 0>, <1 0>, <2 0>, <3 0>, 36 + <4 0>, <5 0>; 37 + 38 + mct_map: mct-map { 39 + #interrupt-cells = <2>; 40 + #address-cells = <0>; 41 + #size-cells = <0>; 42 + interrupt-map = <0x0 0 &gic 0 57 0>, 43 + <0x1 0 &combiner 12 5>, 44 + <0x2 0 &combiner 12 6>, 45 + <0x3 0 &combiner 12 7>, 46 + <0x4 0 &gic 1 12 0>, 47 + <0x5 0 &gic 1 12 0>; 48 + }; 49 + }; 28 50 };
+111
arch/arm/boot/dts/exynos4412-odroidx.dts
··· 1 + /* 2 + * Hardkernel's Exynos4412 based ODROID-X board device tree source 3 + * 4 + * Copyright (c) 2012 Dongjin Kim <tobetter@gmail.com> 5 + * 6 + * Device tree source file for Hardkernel's ODROID-X board which is based on 7 + * Samsung's Exynos4412 SoC. 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License version 2 as 11 + * published by the Free Software Foundation. 12 + */ 13 + 14 + /dts-v1/; 15 + /include/ "exynos4412.dtsi" 16 + 17 + / { 18 + model = "Hardkernel ODROID-X board based on Exynos4412"; 19 + compatible = "hardkernel,odroid-x", "samsung,exynos4412"; 20 + 21 + memory { 22 + reg = <0x40000000 0x40000000>; 23 + }; 24 + 25 + leds { 26 + compatible = "gpio-leds"; 27 + led1 { 28 + label = "led1:heart"; 29 + gpios = <&gpc1 0 1>; 30 + default-state = "on"; 31 + linux,default-trigger = "heartbeat"; 32 + }; 33 + led2 { 34 + label = "led2:mmc0"; 35 + gpios = <&gpc1 2 1>; 36 + default-state = "on"; 37 + linux,default-trigger = "mmc0"; 38 + }; 39 + }; 40 + 41 + mshc@12550000 { 42 + #address-cells = <1>; 43 + #size-cells = <0>; 44 + pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>; 45 + pinctrl-names = "default"; 46 + status = "okay"; 47 + 48 + num-slots = <1>; 49 + supports-highspeed; 50 + broken-cd; 51 + fifo-depth = <0x80>; 52 + card-detect-delay = <200>; 53 + samsung,dw-mshc-ciu-div = <3>; 54 + samsung,dw-mshc-sdr-timing = <2 3>; 55 + samsung,dw-mshc-ddr-timing = <1 2>; 56 + 57 + slot@0 { 58 + reg = <0>; 59 + bus-width = <8>; 60 + }; 61 + }; 62 + 63 + regulator_p3v3 { 64 + compatible = "regulator-fixed"; 65 + regulator-name = "p3v3_en"; 66 + regulator-min-microvolt = <3300000>; 67 + regulator-max-microvolt = <3300000>; 68 + gpio = <&gpa1 1 1>; 69 + enable-active-high; 70 + regulator-boot-on; 71 + }; 72 + 73 + rtc@10070000 { 74 + status = "okay"; 75 + }; 76 + 77 + sdhci@12530000 { 78 + bus-width = <4>; 79 + pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; 80 + pinctrl-names = "default"; 81 + status = "okay"; 82 + }; 83 + 84 + serial@13800000 { 85 + status = "okay"; 86 + }; 87 + 88 + serial@13810000 { 89 + status = "okay"; 90 + }; 91 + 92 + serial@13820000 { 93 + status = "okay"; 94 + }; 95 + 96 + serial@13830000 { 97 + status = "okay"; 98 + }; 99 + 100 + fixed-rate-clocks { 101 + xxti { 102 + compatible = "samsung,clock-xxti"; 103 + clock-frequency = <0>; 104 + }; 105 + 106 + xusbxti { 107 + compatible = "samsung,clock-xusbxti"; 108 + clock-frequency = <24000000>; 109 + }; 110 + }; 111 + };
+432
arch/arm/boot/dts/exynos4412-origen.dts
··· 1 + /* 2 + * Insignal's Exynos4412 based Origen board device tree source 3 + * 4 + * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. 5 + * http://www.samsung.com 6 + * 7 + * Device tree source file for Insignal's Origen board which is based on 8 + * Samsung's Exynos4412 SoC. 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License version 2 as 12 + * published by the Free Software Foundation. 13 + */ 14 + 15 + /dts-v1/; 16 + /include/ "exynos4412.dtsi" 17 + 18 + / { 19 + model = "Insignal Origen evaluation board based on Exynos4412"; 20 + compatible = "insignal,origen4412", "samsung,exynos4412"; 21 + 22 + memory { 23 + reg = <0x40000000 0x40000000>; 24 + }; 25 + 26 + chosen { 27 + bootargs ="console=ttySAC2,115200"; 28 + }; 29 + 30 + mmc_reg: voltage-regulator { 31 + compatible = "regulator-fixed"; 32 + regulator-name = "VMEM_VDD_2.8V"; 33 + regulator-min-microvolt = <2800000>; 34 + regulator-max-microvolt = <2800000>; 35 + gpio = <&gpx1 1 0>; 36 + enable-active-high; 37 + }; 38 + 39 + sdhci@12530000 { 40 + bus-width = <4>; 41 + pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>; 42 + pinctrl-names = "default"; 43 + vmmc-supply = <&mmc_reg>; 44 + status = "okay"; 45 + }; 46 + 47 + mshc@12550000 { 48 + #address-cells = <1>; 49 + #size-cells = <0>; 50 + pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>; 51 + pinctrl-names = "default"; 52 + status = "okay"; 53 + 54 + num-slots = <1>; 55 + supports-highspeed; 56 + broken-cd; 57 + fifo-depth = <0x80>; 58 + card-detect-delay = <200>; 59 + samsung,dw-mshc-ciu-div = <3>; 60 + samsung,dw-mshc-sdr-timing = <2 3>; 61 + samsung,dw-mshc-ddr-timing = <1 2>; 62 + 63 + slot@0 { 64 + reg = <0>; 65 + bus-width = <8>; 66 + }; 67 + }; 68 + 69 + codec@13400000 { 70 + samsung,mfc-r = <0x43000000 0x800000>; 71 + samsung,mfc-l = <0x51000000 0x800000>; 72 + status = "okay"; 73 + }; 74 + 75 + serial@13800000 { 76 + status = "okay"; 77 + }; 78 + 79 + serial@13810000 { 80 + status = "okay"; 81 + }; 82 + 83 + serial@13820000 { 84 + status = "okay"; 85 + }; 86 + 87 + serial@13830000 { 88 + status = "okay"; 89 + }; 90 + 91 + i2c@13860000 { 92 + #address-cells = <1>; 93 + #size-cells = <0>; 94 + samsung,i2c-sda-delay = <100>; 95 + samsung,i2c-max-bus-freq = <20000>; 96 + pinctrl-0 = <&i2c0_bus>; 97 + pinctrl-names = "default"; 98 + status = "okay"; 99 + 100 + s5m8767_pmic@66 { 101 + compatible = "samsung,s5m8767-pmic"; 102 + reg = <0x66>; 103 + 104 + s5m8767,pmic-buck-default-dvs-idx = <3>; 105 + 106 + s5m8767,pmic-buck-dvs-gpios = <&gpx2 3 0>, 107 + <&gpx2 4 0>, 108 + <&gpx2 5 0>; 109 + 110 + s5m8767,pmic-buck-ds-gpios = <&gpm3 5 0>, 111 + <&gpm3 6 0>, 112 + <&gpm3 7 0>; 113 + 114 + s5m8767,pmic-buck2-dvs-voltage = <1250000>, <1200000>, 115 + <1200000>, <1200000>, 116 + <1200000>, <1200000>, 117 + <1200000>, <1200000>; 118 + 119 + s5m8767,pmic-buck3-dvs-voltage = <1100000>, <1100000>, 120 + <1100000>, <1100000>, 121 + <1100000>, <1100000>, 122 + <1100000>, <1100000>; 123 + 124 + s5m8767,pmic-buck4-dvs-voltage = <1200000>, <1200000>, 125 + <1200000>, <1200000>, 126 + <1200000>, <1200000>, 127 + <1200000>, <1200000>; 128 + 129 + regulators { 130 + ldo1_reg: LDO1 { 131 + regulator-name = "VDD_ALIVE"; 132 + regulator-min-microvolt = <1100000>; 133 + regulator-max-microvolt = <1100000>; 134 + regulator-always-on; 135 + regulator-boot-on; 136 + op_mode = <1>; /* Normal Mode */ 137 + }; 138 + 139 + ldo2_reg: LDO2 { 140 + regulator-name = "VDDQ_M12"; 141 + regulator-min-microvolt = <1200000>; 142 + regulator-max-microvolt = <1200000>; 143 + regulator-always-on; 144 + op_mode = <1>; /* Normal Mode */ 145 + }; 146 + 147 + ldo3_reg: LDO3 { 148 + regulator-name = "VDDIOAP_18"; 149 + regulator-min-microvolt = <1800000>; 150 + regulator-max-microvolt = <1800000>; 151 + regulator-always-on; 152 + op_mode = <1>; /* Normal Mode */ 153 + }; 154 + 155 + ldo4_reg: LDO4 { 156 + regulator-name = "VDDQ_PRE"; 157 + regulator-min-microvolt = <1800000>; 158 + regulator-max-microvolt = <1800000>; 159 + regulator-always-on; 160 + op_mode = <1>; /* Normal Mode */ 161 + }; 162 + 163 + ldo5_reg: LDO5 { 164 + regulator-name = "VDD18_2M"; 165 + regulator-min-microvolt = <1800000>; 166 + regulator-max-microvolt = <1800000>; 167 + regulator-always-on; 168 + op_mode = <1>; /* Normal Mode */ 169 + }; 170 + 171 + ldo6_reg: LDO6 { 172 + regulator-name = "VDD10_MPLL"; 173 + regulator-min-microvolt = <1000000>; 174 + regulator-max-microvolt = <1000000>; 175 + regulator-always-on; 176 + op_mode = <1>; /* Normal Mode */ 177 + }; 178 + 179 + ldo7_reg: LDO7 { 180 + regulator-name = "VDD10_XPLL"; 181 + regulator-min-microvolt = <1000000>; 182 + regulator-max-microvolt = <1000000>; 183 + regulator-always-on; 184 + op_mode = <1>; /* Normal Mode */ 185 + }; 186 + 187 + ldo8_reg: LDO8 { 188 + regulator-name = "VDD10_MIPI"; 189 + regulator-min-microvolt = <1000000>; 190 + regulator-max-microvolt = <1000000>; 191 + regulator-always-on; 192 + op_mode = <1>; /* Normal Mode */ 193 + }; 194 + 195 + ldo9_reg: LDO9 { 196 + regulator-name = "VDD33_LCD"; 197 + regulator-min-microvolt = <3300000>; 198 + regulator-max-microvolt = <3300000>; 199 + regulator-always-on; 200 + op_mode = <1>; /* Normal Mode */ 201 + }; 202 + 203 + ldo10_reg: LDO10 { 204 + regulator-name = "VDD18_MIPI"; 205 + regulator-min-microvolt = <1800000>; 206 + regulator-max-microvolt = <1800000>; 207 + regulator-always-on; 208 + op_mode = <1>; /* Normal Mode */ 209 + }; 210 + 211 + ldo11_reg: LDO11 { 212 + regulator-name = "VDD18_ABB1"; 213 + regulator-min-microvolt = <1800000>; 214 + regulator-max-microvolt = <1800000>; 215 + regulator-always-on; 216 + op_mode = <1>; /* Normal Mode */ 217 + }; 218 + 219 + ldo12_reg: LDO12 { 220 + regulator-name = "VDD33_UOTG"; 221 + regulator-min-microvolt = <3300000>; 222 + regulator-max-microvolt = <3300000>; 223 + regulator-always-on; 224 + op_mode = <1>; /* Normal Mode */ 225 + }; 226 + 227 + ldo13_reg: LDO13 { 228 + regulator-name = "VDDIOPERI_18"; 229 + regulator-min-microvolt = <1800000>; 230 + regulator-max-microvolt = <1800000>; 231 + regulator-always-on; 232 + op_mode = <1>; /* Normal Mode */ 233 + }; 234 + 235 + ldo14_reg: LDO14 { 236 + regulator-name = "VDD18_ABB02"; 237 + regulator-min-microvolt = <1800000>; 238 + regulator-max-microvolt = <1800000>; 239 + regulator-always-on; 240 + op_mode = <1>; /* Normal Mode */ 241 + }; 242 + 243 + ldo15_reg: LDO15 { 244 + regulator-name = "VDD10_USH"; 245 + regulator-min-microvolt = <1000000>; 246 + regulator-max-microvolt = <1000000>; 247 + regulator-always-on; 248 + op_mode = <1>; /* Normal Mode */ 249 + }; 250 + 251 + ldo16_reg: LDO16 { 252 + regulator-name = "VDD18_HSIC"; 253 + regulator-min-microvolt = <1800000>; 254 + regulator-max-microvolt = <1800000>; 255 + regulator-always-on; 256 + op_mode = <1>; /* Normal Mode */ 257 + }; 258 + 259 + ldo17_reg: LDO17 { 260 + regulator-name = "VDDIOAP_MMC012_28"; 261 + regulator-min-microvolt = <2800000>; 262 + regulator-max-microvolt = <2800000>; 263 + regulator-always-on; 264 + op_mode = <1>; /* Normal Mode */ 265 + }; 266 + 267 + ldo18_reg: LDO18 { 268 + regulator-name = "VDDIOPERI_28"; 269 + regulator-min-microvolt = <2800000>; 270 + regulator-max-microvolt = <2800000>; 271 + regulator-always-on; 272 + op_mode = <1>; /* Normal Mode */ 273 + }; 274 + 275 + ldo19_reg: LDO19 { 276 + regulator-name = "DVDD25"; 277 + regulator-min-microvolt = <2500000>; 278 + regulator-max-microvolt = <2500000>; 279 + regulator-always-on; 280 + op_mode = <1>; /* Normal Mode */ 281 + }; 282 + 283 + ldo20_reg: LDO20 { 284 + regulator-name = "VDD28_CAM"; 285 + regulator-min-microvolt = <2800000>; 286 + regulator-max-microvolt = <2800000>; 287 + regulator-always-on; 288 + op_mode = <1>; /* Normal Mode */ 289 + }; 290 + 291 + ldo21_reg: LDO21 { 292 + regulator-name = "VDD28_AF"; 293 + regulator-min-microvolt = <2800000>; 294 + regulator-max-microvolt = <2800000>; 295 + regulator-always-on; 296 + op_mode = <1>; /* Normal Mode */ 297 + }; 298 + 299 + ldo22_reg: LDO22 { 300 + regulator-name = "VDDA28_2M"; 301 + regulator-min-microvolt = <2800000>; 302 + regulator-max-microvolt = <2800000>; 303 + regulator-always-on; 304 + op_mode = <1>; /* Normal Mode */ 305 + }; 306 + 307 + ldo23_reg: LDO23 { 308 + regulator-name = "VDD28_TF"; 309 + regulator-min-microvolt = <2800000>; 310 + regulator-max-microvolt = <2800000>; 311 + regulator-always-on; 312 + op_mode = <1>; /* Normal Mode */ 313 + }; 314 + 315 + ldo24_reg: LDO24 { 316 + regulator-name = "VDD33_A31"; 317 + regulator-min-microvolt = <3300000>; 318 + regulator-max-microvolt = <3300000>; 319 + regulator-always-on; 320 + op_mode = <1>; /* Normal Mode */ 321 + }; 322 + 323 + ldo25_reg: LDO25 { 324 + regulator-name = "VDD18_CAM"; 325 + regulator-min-microvolt = <1800000>; 326 + regulator-max-microvolt = <1800000>; 327 + regulator-always-on; 328 + op_mode = <1>; /* Normal Mode */ 329 + }; 330 + 331 + ldo26_reg: LDO26 { 332 + regulator-name = "VDD18_A31"; 333 + regulator-min-microvolt = <1800000>; 334 + regulator-max-microvolt = <1800000>; 335 + regulator-always-on; 336 + op_mode = <1>; /* Normal Mode */ 337 + }; 338 + 339 + ldo27_reg: LDO27 { 340 + regulator-name = "GPS_1V8"; 341 + regulator-min-microvolt = <1800000>; 342 + regulator-max-microvolt = <1800000>; 343 + regulator-always-on; 344 + op_mode = <1>; /* Normal Mode */ 345 + }; 346 + 347 + ldo28_reg: LDO28 { 348 + regulator-name = "DVDD12"; 349 + regulator-min-microvolt = <1200000>; 350 + regulator-max-microvolt = <1200000>; 351 + regulator-always-on; 352 + op_mode = <1>; /* Normal Mode */ 353 + }; 354 + 355 + buck1_reg: BUCK1 { 356 + regulator-name = "vdd_mif"; 357 + regulator-min-microvolt = <950000>; 358 + regulator-max-microvolt = <1100000>; 359 + regulator-always-on; 360 + regulator-boot-on; 361 + op_mode = <1>; /* Normal Mode */ 362 + }; 363 + 364 + buck2_reg: BUCK2 { 365 + regulator-name = "vdd_arm"; 366 + regulator-min-microvolt = <925000>; 367 + regulator-max-microvolt = <1300000>; 368 + regulator-always-on; 369 + regulator-boot-on; 370 + op_mode = <1>; /* Normal Mode */ 371 + }; 372 + 373 + buck3_reg: BUCK3 { 374 + regulator-name = "vdd_int"; 375 + regulator-min-microvolt = <900000>; 376 + regulator-max-microvolt = <1200000>; 377 + regulator-always-on; 378 + regulator-boot-on; 379 + op_mode = <1>; /* Normal Mode */ 380 + }; 381 + 382 + buck4_reg: BUCK4 { 383 + regulator-name = "vdd_g3d"; 384 + regulator-min-microvolt = <750000>; 385 + regulator-max-microvolt = <1500000>; 386 + regulator-always-on; 387 + regulator-boot-on; 388 + op_mode = <1>; /* Normal Mode */ 389 + }; 390 + 391 + buck5_reg: BUCK5 { 392 + regulator-name = "vdd_m12"; 393 + regulator-min-microvolt = <750000>; 394 + regulator-max-microvolt = <1500000>; 395 + regulator-always-on; 396 + regulator-boot-on; 397 + op_mode = <1>; /* Normal Mode */ 398 + }; 399 + 400 + buck6_reg: BUCK6 { 401 + regulator-name = "vdd12_5m"; 402 + regulator-min-microvolt = <750000>; 403 + regulator-max-microvolt = <1500000>; 404 + regulator-always-on; 405 + regulator-boot-on; 406 + op_mode = <1>; /* Normal Mode */ 407 + }; 408 + 409 + buck9_reg: BUCK9 { 410 + regulator-name = "vddf28_emmc"; 411 + regulator-min-microvolt = <750000>; 412 + regulator-max-microvolt = <3000000>; 413 + regulator-always-on; 414 + regulator-boot-on; 415 + op_mode = <1>; /* Normal Mode */ 416 + }; 417 + }; 418 + }; 419 + }; 420 + 421 + fixed-rate-clocks { 422 + xxti { 423 + compatible = "samsung,clock-xxti"; 424 + clock-frequency = <0>; 425 + }; 426 + 427 + xusbxti { 428 + compatible = "samsung,clock-xusbxti"; 429 + clock-frequency = <24000000>; 430 + }; 431 + }; 432 + };
+25
arch/arm/boot/dts/exynos4412-smdk4412.dts
··· 27 27 bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc"; 28 28 }; 29 29 30 + sdhci@12530000 { 31 + bus-width = <4>; 32 + pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>; 33 + pinctrl-names = "default"; 34 + status = "okay"; 35 + }; 36 + 37 + codec@13400000 { 38 + samsung,mfc-r = <0x43000000 0x800000>; 39 + samsung,mfc-l = <0x51000000 0x800000>; 40 + status = "okay"; 41 + }; 42 + 30 43 serial@13800000 { 31 44 status = "okay"; 32 45 }; ··· 54 41 55 42 serial@13830000 { 56 43 status = "okay"; 44 + }; 45 + 46 + fixed-rate-clocks { 47 + xxti { 48 + compatible = "samsung,clock-xxti"; 49 + clock-frequency = <0>; 50 + }; 51 + 52 + xusbxti { 53 + compatible = "samsung,clock-xusbxti"; 54 + clock-frequency = <24000000>; 55 + }; 57 56 }; 58 57 };
+26
arch/arm/boot/dts/exynos4412.dtsi
··· 25 25 gic:interrupt-controller@10490000 { 26 26 cpu-offset = <0x4000>; 27 27 }; 28 + 29 + mct@10050000 { 30 + compatible = "samsung,exynos4412-mct"; 31 + reg = <0x10050000 0x800>; 32 + interrupt-controller; 33 + #interrups-cells = <2>; 34 + interrupt-parent = <&mct_map>; 35 + interrupts = <0 0>, <1 0>, <2 0>, <3 0>, 36 + <4 0>, <5 0>, <6 0>, <7 0>; 37 + clocks = <&clock 3>, <&clock 344>; 38 + clock-names = "fin_pll", "mct"; 39 + 40 + mct_map: mct-map { 41 + #interrupt-cells = <2>; 42 + #address-cells = <0>; 43 + #size-cells = <0>; 44 + interrupt-map = <0x0 0 &gic 0 57 0>, 45 + <0x1 0 &combiner 12 5>, 46 + <0x2 0 &combiner 12 6>, 47 + <0x3 0 &combiner 12 7>, 48 + <0x4 0 &gic 1 12 0>, 49 + <0x5 0 &gic 1 12 0>, 50 + <0x6 0 &gic 1 12 0>, 51 + <0x7 0 &gic 1 12 0>; 52 + }; 53 + }; 28 54 };
+6
arch/arm/boot/dts/exynos4x12.dtsi
··· 36 36 <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>; 37 37 }; 38 38 39 + clock: clock-controller@0x10030000 { 40 + compatible = "samsung,exynos4412-clock"; 41 + reg = <0x10030000 0x20000>; 42 + #clock-cells = <1>; 43 + }; 44 + 39 45 pinctrl_0: pinctrl@11400000 { 40 46 compatible = "samsung,exynos4x12-pinctrl"; 41 47 reg = <0x11400000 0x1000>;
+129
arch/arm/boot/dts/exynos5250-arndale.dts
··· 1 + /* 2 + * Samsung's Exynos5250 based Arndale board device tree source 3 + * 4 + * Copyright (c) 2013 Samsung Electronics Co., Ltd. 5 + * http://www.samsung.com 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published by the Free Software Foundation. 10 + */ 11 + 12 + /dts-v1/; 13 + /include/ "exynos5250.dtsi" 14 + 15 + / { 16 + model = "Insignal Arndale evaluation board based on EXYNOS5250"; 17 + compatible = "insignal,arndale", "samsung,exynos5250"; 18 + 19 + memory { 20 + reg = <0x40000000 0x80000000>; 21 + }; 22 + 23 + chosen { 24 + bootargs = "console=ttySAC2,115200"; 25 + }; 26 + 27 + i2c@12C60000 { 28 + status = "disabled"; 29 + }; 30 + 31 + i2c@12C70000 { 32 + status = "disabled"; 33 + }; 34 + 35 + i2c@12C80000 { 36 + status = "disabled"; 37 + }; 38 + 39 + i2c@12C90000 { 40 + status = "disabled"; 41 + }; 42 + 43 + i2c@12CA0000 { 44 + status = "disabled"; 45 + }; 46 + 47 + i2c@12CB0000 { 48 + status = "disabled"; 49 + }; 50 + 51 + i2c@12CC0000 { 52 + status = "disabled"; 53 + }; 54 + 55 + i2c@12CD0000 { 56 + status = "disabled"; 57 + }; 58 + 59 + i2c@121D0000 { 60 + status = "disabled"; 61 + }; 62 + 63 + dwmmc_0: dwmmc0@12200000 { 64 + num-slots = <1>; 65 + supports-highspeed; 66 + broken-cd; 67 + fifo-depth = <0x80>; 68 + card-detect-delay = <200>; 69 + samsung,dw-mshc-ciu-div = <3>; 70 + samsung,dw-mshc-sdr-timing = <2 3>; 71 + samsung,dw-mshc-ddr-timing = <1 2>; 72 + 73 + slot@0 { 74 + reg = <0>; 75 + bus-width = <8>; 76 + gpios = <&gpc0 0 2 0 3>, <&gpc0 1 2 0 3>, 77 + <&gpc0 3 2 3 3>, <&gpc0 4 2 3 3>, 78 + <&gpc0 5 2 3 3>, <&gpc0 6 2 3 3>, 79 + <&gpc1 0 2 3 3>, <&gpc1 1 2 3 3>, 80 + <&gpc1 2 2 3 3>, <&gpc1 3 2 3 3>; 81 + }; 82 + }; 83 + 84 + dwmmc_1: dwmmc1@12210000 { 85 + status = "disabled"; 86 + }; 87 + 88 + dwmmc_2: dwmmc2@12220000 { 89 + num-slots = <1>; 90 + supports-highspeed; 91 + fifo-depth = <0x80>; 92 + card-detect-delay = <200>; 93 + samsung,dw-mshc-ciu-div = <3>; 94 + samsung,dw-mshc-sdr-timing = <2 3>; 95 + samsung,dw-mshc-ddr-timing = <1 2>; 96 + 97 + slot@0 { 98 + reg = <0>; 99 + bus-width = <4>; 100 + samsung,cd-pinmux-gpio = <&gpc3 2 2 3 3>; 101 + gpios = <&gpc3 0 2 0 3>, <&gpc3 1 2 0 3>, 102 + <&gpc3 3 2 3 3>, <&gpc3 4 2 3 3>, 103 + <&gpc3 5 2 3 3>, <&gpc3 6 2 3 3>; 104 + }; 105 + }; 106 + 107 + dwmmc_3: dwmmc3@12230000 { 108 + status = "disabled"; 109 + }; 110 + 111 + spi_0: spi@12d20000 { 112 + status = "disabled"; 113 + }; 114 + 115 + spi_1: spi@12d30000 { 116 + status = "disabled"; 117 + }; 118 + 119 + spi_2: spi@12d40000 { 120 + status = "disabled"; 121 + }; 122 + 123 + fixed-rate-clocks { 124 + xxti { 125 + compatible = "samsung,clock-xxti"; 126 + clock-frequency = <24000000>; 127 + }; 128 + }; 129 + };
+20
arch/arm/boot/dts/exynos5250-smdk5250.dts
··· 231 231 samsung,i2s-controller = <&i2s0>; 232 232 samsung,audio-codec = <&wm8994>; 233 233 }; 234 + 235 + usb@12110000 { 236 + samsung,vbus-gpio = <&gpx2 6 1 3 3>; 237 + }; 238 + 239 + dp-controller { 240 + samsung,color-space = <0>; 241 + samsung,dynamic-range = <0>; 242 + samsung,ycbcr-coeff = <0>; 243 + samsung,color-depth = <1>; 244 + samsung,link-rate = <0x0a>; 245 + samsung,lane-count = <4>; 246 + }; 247 + 248 + fixed-rate-clocks { 249 + xxti { 250 + compatible = "samsung,clock-xxti"; 251 + clock-frequency = <24000000>; 252 + }; 253 + }; 234 254 };
+11
arch/arm/boot/dts/exynos5250-snow.dts
··· 40 40 <&gpc4 5 2 3 0>, <&gpc4 6 2 3 0>; 41 41 }; 42 42 }; 43 + 44 + usb@12110000 { 45 + samsung,vbus-gpio = <&gpx1 1 1 3 3>; 46 + }; 47 + 48 + fixed-rate-clocks { 49 + xxti { 50 + compatible = "samsung,clock-xxti"; 51 + clock-frequency = <24000000>; 52 + }; 53 + }; 43 54 };
+149
arch/arm/boot/dts/exynos5250.dtsi
··· 46 46 i2c8 = &i2c_8; 47 47 }; 48 48 49 + pd_gsc: gsc-power-domain@0x10044000 { 50 + compatible = "samsung,exynos4210-pd"; 51 + reg = <0x10044000 0x20>; 52 + }; 53 + 54 + pd_mfc: mfc-power-domain@0x10044040 { 55 + compatible = "samsung,exynos4210-pd"; 56 + reg = <0x10044040 0x20>; 57 + }; 58 + 59 + clock: clock-controller@0x10010000 { 60 + compatible = "samsung,exynos5250-clock"; 61 + reg = <0x10010000 0x30000>; 62 + #clock-cells = <1>; 63 + }; 64 + 49 65 gic:interrupt-controller@10481000 { 50 66 compatible = "arm,cortex-a9-gic"; 51 67 #interrupt-cells = <3>; ··· 85 69 <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>; 86 70 }; 87 71 72 + mct@101C0000 { 73 + compatible = "samsung,exynos4210-mct"; 74 + reg = <0x101C0000 0x800>; 75 + interrupt-controller; 76 + #interrups-cells = <2>; 77 + interrupt-parent = <&mct_map>; 78 + interrupts = <0 0>, <1 0>, <2 0>, <3 0>, 79 + <4 0>, <5 0>; 80 + clocks = <&clock 1>, <&clock 335>; 81 + clock-names = "fin_pll", "mct"; 82 + 83 + mct_map: mct-map { 84 + #interrupt-cells = <2>; 85 + #address-cells = <0>; 86 + #size-cells = <0>; 87 + interrupt-map = <0x0 0 &combiner 23 3>, 88 + <0x1 0 &combiner 23 4>, 89 + <0x2 0 &combiner 25 2>, 90 + <0x3 0 &combiner 25 3>, 91 + <0x4 0 &gic 0 120 0>, 92 + <0x5 0 &gic 0 121 0>; 93 + }; 94 + }; 95 + 96 + pmu { 97 + compatible = "arm,cortex-a15-pmu"; 98 + interrupt-parent = <&combiner>; 99 + interrupts = <1 2>, <22 4>; 100 + }; 101 + 88 102 watchdog { 89 103 compatible = "samsung,s3c2410-wdt"; 90 104 reg = <0x101D0000 0x100>; 91 105 interrupts = <0 42 0>; 106 + clocks = <&clock 336>; 107 + clock-names = "watchdog"; 92 108 }; 93 109 94 110 codec@11000000 { 95 111 compatible = "samsung,mfc-v6"; 96 112 reg = <0x11000000 0x10000>; 97 113 interrupts = <0 96 0>; 114 + samsung,power-domain = <&pd_mfc>; 98 115 }; 99 116 100 117 rtc { 101 118 compatible = "samsung,s3c6410-rtc"; 102 119 reg = <0x101E0000 0x100>; 103 120 interrupts = <0 43 0>, <0 44 0>; 121 + clocks = <&clock 337>; 122 + clock-names = "rtc"; 123 + status = "disabled"; 104 124 }; 105 125 106 126 tmu@10060000 { 107 127 compatible = "samsung,exynos5250-tmu"; 108 128 reg = <0x10060000 0x100>; 109 129 interrupts = <0 65 0>; 130 + clocks = <&clock 338>; 131 + clock-names = "tmu_apbif"; 110 132 }; 111 133 112 134 serial@12C00000 { 113 135 compatible = "samsung,exynos4210-uart"; 114 136 reg = <0x12C00000 0x100>; 115 137 interrupts = <0 51 0>; 138 + clocks = <&clock 289>, <&clock 146>; 139 + clock-names = "uart", "clk_uart_baud0"; 116 140 }; 117 141 118 142 serial@12C10000 { 119 143 compatible = "samsung,exynos4210-uart"; 120 144 reg = <0x12C10000 0x100>; 121 145 interrupts = <0 52 0>; 146 + clocks = <&clock 290>, <&clock 147>; 147 + clock-names = "uart", "clk_uart_baud0"; 122 148 }; 123 149 124 150 serial@12C20000 { 125 151 compatible = "samsung,exynos4210-uart"; 126 152 reg = <0x12C20000 0x100>; 127 153 interrupts = <0 53 0>; 154 + clocks = <&clock 291>, <&clock 148>; 155 + clock-names = "uart", "clk_uart_baud0"; 128 156 }; 129 157 130 158 serial@12C30000 { 131 159 compatible = "samsung,exynos4210-uart"; 132 160 reg = <0x12C30000 0x100>; 133 161 interrupts = <0 54 0>; 162 + clocks = <&clock 292>, <&clock 149>; 163 + clock-names = "uart", "clk_uart_baud0"; 134 164 }; 135 165 136 166 sata@122F0000 { 137 167 compatible = "samsung,exynos5-sata-ahci"; 138 168 reg = <0x122F0000 0x1ff>; 139 169 interrupts = <0 115 0>; 170 + clocks = <&clock 277>, <&clock 143>; 171 + clock-names = "sata", "sclk_sata"; 140 172 }; 141 173 142 174 sata-phy@12170000 { ··· 198 134 interrupts = <0 56 0>; 199 135 #address-cells = <1>; 200 136 #size-cells = <0>; 137 + clocks = <&clock 294>; 138 + clock-names = "i2c"; 201 139 }; 202 140 203 141 i2c_1: i2c@12C70000 { ··· 208 142 interrupts = <0 57 0>; 209 143 #address-cells = <1>; 210 144 #size-cells = <0>; 145 + clocks = <&clock 295>; 146 + clock-names = "i2c"; 211 147 }; 212 148 213 149 i2c_2: i2c@12C80000 { ··· 218 150 interrupts = <0 58 0>; 219 151 #address-cells = <1>; 220 152 #size-cells = <0>; 153 + clocks = <&clock 296>; 154 + clock-names = "i2c"; 221 155 }; 222 156 223 157 i2c_3: i2c@12C90000 { ··· 228 158 interrupts = <0 59 0>; 229 159 #address-cells = <1>; 230 160 #size-cells = <0>; 161 + clocks = <&clock 297>; 162 + clock-names = "i2c"; 231 163 }; 232 164 233 165 i2c_4: i2c@12CA0000 { ··· 238 166 interrupts = <0 60 0>; 239 167 #address-cells = <1>; 240 168 #size-cells = <0>; 169 + clocks = <&clock 298>; 170 + clock-names = "i2c"; 241 171 }; 242 172 243 173 i2c_5: i2c@12CB0000 { ··· 248 174 interrupts = <0 61 0>; 249 175 #address-cells = <1>; 250 176 #size-cells = <0>; 177 + clocks = <&clock 299>; 178 + clock-names = "i2c"; 251 179 }; 252 180 253 181 i2c_6: i2c@12CC0000 { ··· 258 182 interrupts = <0 62 0>; 259 183 #address-cells = <1>; 260 184 #size-cells = <0>; 185 + clocks = <&clock 300>; 186 + clock-names = "i2c"; 261 187 }; 262 188 263 189 i2c_7: i2c@12CD0000 { ··· 268 190 interrupts = <0 63 0>; 269 191 #address-cells = <1>; 270 192 #size-cells = <0>; 193 + clocks = <&clock 301>; 194 + clock-names = "i2c"; 271 195 }; 272 196 273 197 i2c_8: i2c@12CE0000 { ··· 278 198 interrupts = <0 64 0>; 279 199 #address-cells = <1>; 280 200 #size-cells = <0>; 201 + clocks = <&clock 302>; 202 + clock-names = "i2c"; 281 203 }; 282 204 283 205 i2c@121D0000 { ··· 287 205 reg = <0x121D0000 0x100>; 288 206 #address-cells = <1>; 289 207 #size-cells = <0>; 208 + clocks = <&clock 288>; 209 + clock-names = "i2c"; 290 210 }; 291 211 292 212 spi_0: spi@12d20000 { ··· 300 216 dma-names = "tx", "rx"; 301 217 #address-cells = <1>; 302 218 #size-cells = <0>; 219 + clocks = <&clock 304>, <&clock 154>; 220 + clock-names = "spi", "spi_busclk0"; 303 221 }; 304 222 305 223 spi_1: spi@12d30000 { ··· 313 227 dma-names = "tx", "rx"; 314 228 #address-cells = <1>; 315 229 #size-cells = <0>; 230 + clocks = <&clock 305>, <&clock 155>; 231 + clock-names = "spi", "spi_busclk0"; 316 232 }; 317 233 318 234 spi_2: spi@12d40000 { ··· 326 238 dma-names = "tx", "rx"; 327 239 #address-cells = <1>; 328 240 #size-cells = <0>; 241 + clocks = <&clock 306>, <&clock 156>; 242 + clock-names = "spi", "spi_busclk0"; 329 243 }; 330 244 331 245 dwmmc_0: dwmmc0@12200000 { ··· 336 246 interrupts = <0 75 0>; 337 247 #address-cells = <1>; 338 248 #size-cells = <0>; 249 + clocks = <&clock 280>, <&clock 139>; 250 + clock-names = "biu", "ciu"; 339 251 }; 340 252 341 253 dwmmc_1: dwmmc1@12210000 { ··· 346 254 interrupts = <0 76 0>; 347 255 #address-cells = <1>; 348 256 #size-cells = <0>; 257 + clocks = <&clock 281>, <&clock 140>; 258 + clock-names = "biu", "ciu"; 349 259 }; 350 260 351 261 dwmmc_2: dwmmc2@12220000 { ··· 356 262 interrupts = <0 77 0>; 357 263 #address-cells = <1>; 358 264 #size-cells = <0>; 265 + clocks = <&clock 282>, <&clock 141>; 266 + clock-names = "biu", "ciu"; 359 267 }; 360 268 361 269 dwmmc_3: dwmmc3@12230000 { ··· 366 270 interrupts = <0 78 0>; 367 271 #address-cells = <1>; 368 272 #size-cells = <0>; 273 + clocks = <&clock 283>, <&clock 142>; 274 + clock-names = "biu", "ciu"; 369 275 }; 370 276 371 277 i2s0: i2s@03830000 { ··· 399 301 dma-names = "tx", "rx"; 400 302 }; 401 303 304 + usb@12110000 { 305 + compatible = "samsung,exynos4210-ehci"; 306 + reg = <0x12110000 0x100>; 307 + interrupts = <0 71 0>; 308 + }; 309 + 310 + usb@12120000 { 311 + compatible = "samsung,exynos4210-ohci"; 312 + reg = <0x12120000 0x100>; 313 + interrupts = <0 71 0>; 314 + }; 315 + 402 316 amba { 403 317 #address-cells = <1>; 404 318 #size-cells = <1>; ··· 422 312 compatible = "arm,pl330", "arm,primecell"; 423 313 reg = <0x121A0000 0x1000>; 424 314 interrupts = <0 34 0>; 315 + clocks = <&clock 275>; 316 + clock-names = "apb_pclk"; 425 317 #dma-cells = <1>; 426 318 #dma-channels = <8>; 427 319 #dma-requests = <32>; ··· 433 321 compatible = "arm,pl330", "arm,primecell"; 434 322 reg = <0x121B0000 0x1000>; 435 323 interrupts = <0 35 0>; 324 + clocks = <&clock 276>; 325 + clock-names = "apb_pclk"; 436 326 #dma-cells = <1>; 437 327 #dma-channels = <8>; 438 328 #dma-requests = <32>; ··· 444 330 compatible = "arm,pl330", "arm,primecell"; 445 331 reg = <0x10800000 0x1000>; 446 332 interrupts = <0 33 0>; 333 + clocks = <&clock 271>; 334 + clock-names = "apb_pclk"; 447 335 #dma-cells = <1>; 448 336 #dma-channels = <8>; 449 337 #dma-requests = <1>; ··· 455 339 compatible = "arm,pl330", "arm,primecell"; 456 340 reg = <0x11C10000 0x1000>; 457 341 interrupts = <0 124 0>; 342 + clocks = <&clock 271>; 343 + clock-names = "apb_pclk"; 458 344 #dma-cells = <1>; 459 345 #dma-channels = <8>; 460 346 #dma-requests = <1>; ··· 710 592 }; 711 593 }; 712 594 595 + 713 596 gsc_0: gsc@0x13e00000 { 714 597 compatible = "samsung,exynos5-gsc"; 715 598 reg = <0x13e00000 0x1000>; 716 599 interrupts = <0 85 0>; 600 + samsung,power-domain = <&pd_gsc>; 601 + clocks = <&clock 256>; 602 + clock-names = "gscl"; 717 603 }; 718 604 719 605 gsc_1: gsc@0x13e10000 { 720 606 compatible = "samsung,exynos5-gsc"; 721 607 reg = <0x13e10000 0x1000>; 722 608 interrupts = <0 86 0>; 609 + samsung,power-domain = <&pd_gsc>; 610 + clocks = <&clock 257>; 611 + clock-names = "gscl"; 723 612 }; 724 613 725 614 gsc_2: gsc@0x13e20000 { 726 615 compatible = "samsung,exynos5-gsc"; 727 616 reg = <0x13e20000 0x1000>; 728 617 interrupts = <0 87 0>; 618 + samsung,power-domain = <&pd_gsc>; 619 + clocks = <&clock 258>; 620 + clock-names = "gscl"; 729 621 }; 730 622 731 623 gsc_3: gsc@0x13e30000 { 732 624 compatible = "samsung,exynos5-gsc"; 733 625 reg = <0x13e30000 0x1000>; 734 626 interrupts = <0 88 0>; 627 + samsung,power-domain = <&pd_gsc>; 628 + clocks = <&clock 259>; 629 + clock-names = "gscl"; 735 630 }; 736 631 737 632 hdmi { 738 633 compatible = "samsung,exynos5-hdmi"; 739 634 reg = <0x14530000 0x70000>; 740 635 interrupts = <0 95 0>; 636 + clocks = <&clock 333>, <&clock 136>, <&clock 137>, 637 + <&clock 333>, <&clock 333>; 638 + clock-names = "hdmi", "sclk_hdmi", "sclk_pixel", 639 + "sclk_hdmiphy", "hdmiphy"; 741 640 }; 742 641 743 642 mixer { 744 643 compatible = "samsung,exynos5-mixer"; 745 644 reg = <0x14450000 0x10000>; 746 645 interrupts = <0 94 0>; 646 + }; 647 + 648 + dp-controller { 649 + compatible = "samsung,exynos5-dp"; 650 + reg = <0x145b0000 0x1000>; 651 + interrupts = <10 3>; 652 + interrupt-parent = <&combiner>; 653 + #address-cells = <1>; 654 + #size-cells = <0>; 655 + 656 + dptx-phy { 657 + reg = <0x10040720>; 658 + samsung,enable-mask = <1>; 659 + }; 747 660 }; 748 661 };
+5 -14
arch/arm/boot/dts/exynos5440-ssdk5440.dts
··· 28 28 status = "disabled"; 29 29 }; 30 30 31 - i2c@F0000 { 32 - status = "disabled"; 33 - }; 34 - 35 - i2c@100000 { 36 - status = "disabled"; 37 - }; 38 - 39 - watchdog { 40 - status = "disabled"; 41 - }; 42 - 43 - rtc { 44 - status = "disabled"; 31 + fixed-rate-clocks { 32 + xtal { 33 + compatible = "samsung,clock-xtal"; 34 + clock-frequency = <50000000>; 35 + }; 45 36 }; 46 37 };
+42 -25
arch/arm/boot/dts/exynos5440.dtsi
··· 16 16 17 17 interrupt-parent = <&gic>; 18 18 19 + clock: clock-controller@0x160000 { 20 + compatible = "samsung,exynos5440-clock"; 21 + reg = <0x160000 0x1000>; 22 + #clock-cells = <1>; 23 + }; 24 + 19 25 gic:interrupt-controller@2E0000 { 20 26 compatible = "arm,cortex-a15-gic"; 21 27 #interrupt-cells = <3>; ··· 30 24 }; 31 25 32 26 cpus { 27 + #address-cells = <1>; 28 + #size-cells = <0>; 29 + 33 30 cpu@0 { 34 31 compatible = "arm,cortex-a15"; 35 - timer { 36 - compatible = "arm,armv7-timer"; 37 - interrupts = <1 13 0xf08>; 38 - clock-frequency = <1000000>; 39 - }; 32 + reg = <0>; 40 33 }; 41 34 cpu@1 { 42 35 compatible = "arm,cortex-a15"; 43 - timer { 44 - compatible = "arm,armv7-timer"; 45 - interrupts = <1 14 0xf08>; 46 - clock-frequency = <1000000>; 47 - }; 36 + reg = <1>; 48 37 }; 49 38 cpu@2 { 50 39 compatible = "arm,cortex-a15"; 51 - timer { 52 - compatible = "arm,armv7-timer"; 53 - interrupts = <1 14 0xf08>; 54 - clock-frequency = <1000000>; 55 - }; 40 + reg = <2>; 56 41 }; 57 42 cpu@3 { 58 43 compatible = "arm,cortex-a15"; 59 - timer { 60 - compatible = "arm,armv7-timer"; 61 - interrupts = <1 14 0xf08>; 62 - clock-frequency = <1000000>; 63 - }; 44 + reg = <3>; 64 45 }; 65 46 }; 66 47 67 - common { 68 - compatible = "samsung,exynos5440"; 69 - 48 + timer { 49 + compatible = "arm,cortex-a15-timer", 50 + "arm,armv7-timer"; 51 + interrupts = <1 13 0xf08>, 52 + <1 14 0xf08>, 53 + <1 11 0xf08>, 54 + <1 10 0xf08>; 55 + clock-frequency = <50000000>; 70 56 }; 71 57 72 58 serial@B0000 { 73 59 compatible = "samsung,exynos4210-uart"; 74 60 reg = <0xB0000 0x1000>; 75 61 interrupts = <0 2 0>; 62 + clocks = <&clock 21>, <&clock 21>; 63 + clock-names = "uart", "clk_uart_baud0"; 76 64 }; 77 65 78 66 serial@C0000 { 79 67 compatible = "samsung,exynos4210-uart"; 80 68 reg = <0xC0000 0x1000>; 81 69 interrupts = <0 3 0>; 70 + clocks = <&clock 21>, <&clock 21>; 71 + clock-names = "uart", "clk_uart_baud0"; 82 72 }; 83 73 84 74 spi { ··· 85 83 rx-dma-channel = <&pdma0 4>; /* preliminary */ 86 84 #address-cells = <1>; 87 85 #size-cells = <0>; 86 + clocks = <&clock 21>, <&clock 16>; 87 + clock-names = "spi", "spi_busclk0"; 88 88 }; 89 89 90 90 pinctrl { ··· 114 110 }; 115 111 116 112 i2c@F0000 { 117 - compatible = "samsung,s3c2440-i2c"; 113 + compatible = "samsung,exynos5440-i2c"; 118 114 reg = <0xF0000 0x1000>; 119 115 interrupts = <0 5 0>; 120 116 #address-cells = <1>; 121 117 #size-cells = <0>; 118 + clocks = <&clock 21>; 119 + clock-names = "i2c"; 122 120 }; 123 121 124 122 i2c@100000 { 125 - compatible = "samsung,s3c2440-i2c"; 123 + compatible = "samsung,exynos5440-i2c"; 126 124 reg = <0x100000 0x1000>; 127 125 interrupts = <0 6 0>; 128 126 #address-cells = <1>; 129 127 #size-cells = <0>; 128 + clocks = <&clock 21>; 129 + clock-names = "i2c"; 130 130 }; 131 131 132 132 watchdog { 133 133 compatible = "samsung,s3c2410-wdt"; 134 134 reg = <0x110000 0x1000>; 135 135 interrupts = <0 1 0>; 136 + clocks = <&clock 21>; 137 + clock-names = "watchdog"; 136 138 }; 137 139 138 140 amba { ··· 152 142 compatible = "arm,pl330", "arm,primecell"; 153 143 reg = <0x120000 0x1000>; 154 144 interrupts = <0 34 0>; 145 + clocks = <&clock 21>; 146 + clock-names = "apb_pclk"; 155 147 #dma-cells = <1>; 156 148 #dma-channels = <8>; 157 149 #dma-requests = <32>; ··· 163 151 compatible = "arm,pl330", "arm,primecell"; 164 152 reg = <0x121000 0x1000>; 165 153 interrupts = <0 35 0>; 154 + clocks = <&clock 21>; 155 + clock-names = "apb_pclk"; 166 156 #dma-cells = <1>; 167 157 #dma-channels = <8>; 168 158 #dma-requests = <32>; ··· 175 161 compatible = "samsung,s3c6410-rtc"; 176 162 reg = <0x130000 0x1000>; 177 163 interrupts = <0 17 0>, <0 16 0>; 164 + clocks = <&clock 21>; 165 + clock-names = "rtc"; 166 + status = "disabled"; 178 167 }; 179 168 };
+71
arch/arm/boot/dts/omap3-beagle.dts
··· 38 38 }; 39 39 }; 40 40 41 + /* HS USB Port 2 RESET */ 42 + hsusb2_reset: hsusb2_reset_reg { 43 + compatible = "regulator-fixed"; 44 + regulator-name = "hsusb2_reset"; 45 + regulator-min-microvolt = <3300000>; 46 + regulator-max-microvolt = <3300000>; 47 + gpio = <&gpio5 19 0>; /* gpio_147 */ 48 + startup-delay-us = <70000>; 49 + enable-active-high; 50 + }; 51 + 52 + /* HS USB Port 2 Power */ 53 + hsusb2_power: hsusb2_power_reg { 54 + compatible = "regulator-fixed"; 55 + regulator-name = "hsusb2_vbus"; 56 + regulator-min-microvolt = <3300000>; 57 + regulator-max-microvolt = <3300000>; 58 + gpio = <&twl_gpio 18 0>; /* GPIO LEDA */ 59 + startup-delay-us = <70000>; 60 + }; 61 + 62 + /* HS USB Host PHY on PORT 2 */ 63 + hsusb2_phy: hsusb2_phy { 64 + compatible = "usb-nop-xceiv"; 65 + reset-supply = <&hsusb2_reset>; 66 + vcc-supply = <&hsusb2_power>; 67 + }; 68 + }; 69 + 70 + &omap3_pmx_core { 71 + pinctrl-names = "default"; 72 + pinctrl-0 = < 73 + &hsusbb2_pins 74 + >; 75 + 76 + hsusbb2_pins: pinmux_hsusbb2_pins { 77 + pinctrl-single,pins = < 78 + 0x5c0 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */ 79 + 0x5c2 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */ 80 + 0x5c4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */ 81 + 0x5c6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */ 82 + 0x5c8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */ 83 + 0x5cA 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */ 84 + 0x1a4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */ 85 + 0x1a6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */ 86 + 0x1a8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */ 87 + 0x1aa 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat5 INPUT | PULLDOWN */ 88 + 0x1ac 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat6 INPUT | PULLDOWN */ 89 + 0x1ae 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat7 INPUT | PULLDOWN */ 90 + >; 91 + }; 41 92 }; 42 93 43 94 &i2c1 { ··· 115 64 116 65 &mmc3 { 117 66 status = "disabled"; 67 + }; 68 + 69 + &usbhshost { 70 + port2-mode = "ehci-phy"; 71 + }; 72 + 73 + &usbhsehci { 74 + phys = <0 &hsusb2_phy>; 75 + }; 76 + 77 + &twl_gpio { 78 + ti,use-leds; 79 + /* pullups: BIT(1) */ 80 + ti,pullups = <0x000002>; 81 + /* 82 + * pulldowns: 83 + * BIT(2), BIT(6), BIT(7), BIT(8), BIT(13) 84 + * BIT(15), BIT(16), BIT(17) 85 + */ 86 + ti,pulldowns = <0x03a1c4>; 118 87 };
+31
arch/arm/boot/dts/omap3.dtsi
··· 397 397 ti,timer-alwon; 398 398 ti,timer-secure; 399 399 }; 400 + 401 + usbhstll: usbhstll@48062000 { 402 + compatible = "ti,usbhs-tll"; 403 + reg = <0x48062000 0x1000>; 404 + interrupts = <78>; 405 + ti,hwmods = "usb_tll_hs"; 406 + }; 407 + 408 + usbhshost: usbhshost@48064000 { 409 + compatible = "ti,usbhs-host"; 410 + reg = <0x48064000 0x400>; 411 + ti,hwmods = "usb_host_hs"; 412 + #address-cells = <1>; 413 + #size-cells = <1>; 414 + ranges; 415 + 416 + usbhsohci: ohci@48064400 { 417 + compatible = "ti,ohci-omap3", "usb-ohci"; 418 + reg = <0x48064400 0x400>; 419 + interrupt-parent = <&intc>; 420 + interrupts = <76>; 421 + }; 422 + 423 + usbhsehci: ehci@48064800 { 424 + compatible = "ti,ehci-omap", "usb-ehci"; 425 + reg = <0x48064800 0x400>; 426 + interrupt-parent = <&intc>; 427 + interrupts = <77>; 428 + }; 429 + }; 430 + 400 431 }; 401 432 };
+30
arch/arm/boot/dts/omap4.dtsi
··· 529 529 ti,hwmods = "timer11"; 530 530 ti,timer-pwm; 531 531 }; 532 + 533 + usbhstll: usbhstll@4a062000 { 534 + compatible = "ti,usbhs-tll"; 535 + reg = <0x4a062000 0x1000>; 536 + interrupts = <0 78 0x4>; 537 + ti,hwmods = "usb_tll_hs"; 538 + }; 539 + 540 + usbhshost: usbhshost@4a064000 { 541 + compatible = "ti,usbhs-host"; 542 + reg = <0x4a064000 0x800>; 543 + ti,hwmods = "usb_host_hs"; 544 + #address-cells = <1>; 545 + #size-cells = <1>; 546 + ranges; 547 + 548 + usbhsohci: ohci@4a064800 { 549 + compatible = "ti,ohci-omap3", "usb-ohci"; 550 + reg = <0x4a064800 0x400>; 551 + interrupt-parent = <&gic>; 552 + interrupts = <0 76 0x4>; 553 + }; 554 + 555 + usbhsehci: ehci@4a064c00 { 556 + compatible = "ti,ehci-omap", "usb-ehci"; 557 + reg = <0x4a064c00 0x400>; 558 + interrupt-parent = <&gic>; 559 + interrupts = <0 77 0x4>; 560 + }; 561 + }; 532 562 }; 533 563 };
-1
arch/arm/boot/dts/tegra114-dalmore.dts
··· 12 12 13 13 serial@70006300 { 14 14 status = "okay"; 15 - clock-frequency = <408000000>; 16 15 }; 17 16 18 17 pmc {
-1
arch/arm/boot/dts/tegra114-pluto.dts
··· 12 12 13 13 serial@70006300 { 14 14 status = "okay"; 15 - clock-frequency = <408000000>; 16 15 }; 17 16 18 17 pmc {
+7 -1
arch/arm/boot/dts/tegra114.dtsi
··· 24 24 0 42 0x04 25 25 0 121 0x04 26 26 0 122 0x04>; 27 + clocks = <&tegra_car 5>; 27 28 }; 28 29 29 30 tegra_car: clock { 30 - compatible = "nvidia,tegra114-car, nvidia,tegra30-car"; 31 + compatible = "nvidia,tegra114-car"; 31 32 reg = <0x60006000 0x1000>; 32 33 #clock-cells = <1>; 33 34 }; ··· 67 66 reg-shift = <2>; 68 67 interrupts = <0 36 0x04>; 69 68 status = "disabled"; 69 + clocks = <&tegra_car 6>; 70 70 }; 71 71 72 72 serial@70006040 { ··· 76 74 reg-shift = <2>; 77 75 interrupts = <0 37 0x04>; 78 76 status = "disabled"; 77 + clocks = <&tegra_car 192>; 79 78 }; 80 79 81 80 serial@70006200 { ··· 85 82 reg-shift = <2>; 86 83 interrupts = <0 46 0x04>; 87 84 status = "disabled"; 85 + clocks = <&tegra_car 55>; 88 86 }; 89 87 90 88 serial@70006300 { ··· 94 90 reg-shift = <2>; 95 91 interrupts = <0 90 0x04>; 96 92 status = "disabled"; 93 + clocks = <&tegra_car 65>; 97 94 }; 98 95 99 96 rtc { 100 97 compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc"; 101 98 reg = <0x7000e000 0x100>; 102 99 interrupts = <0 2 0x04>; 100 + clocks = <&tegra_car 4>; 103 101 }; 104 102 105 103 pmc {
+6 -4
arch/arm/boot/dts/vt8500.dtsi
··· 25 25 #interrupt-cells = <1>; 26 26 }; 27 27 28 - gpio: gpio-controller@d8110000 { 29 - compatible = "via,vt8500-gpio"; 30 - gpio-controller; 28 + pinctrl: pinctrl@d8110000 { 29 + compatible = "via,vt8500-pinctrl"; 31 30 reg = <0xd8110000 0x10000>; 32 - #gpio-cells = <3>; 31 + interrupt-controller; 32 + #interrupt-cells = <2>; 33 + gpio-controller; 34 + #gpio-cells = <2>; 33 35 }; 34 36 35 37 pmc@d8130000 {
+6 -4
arch/arm/boot/dts/wm8505.dtsi
··· 40 40 interrupts = <56 57 58 59 60 61 62 63>; 41 41 }; 42 42 43 - gpio: gpio-controller@d8110000 { 44 - compatible = "wm,wm8505-gpio"; 45 - gpio-controller; 43 + pinctrl: pinctrl@d8110000 { 44 + compatible = "wm,wm8505-pinctrl"; 46 45 reg = <0xd8110000 0x10000>; 47 - #gpio-cells = <3>; 46 + interrupt-controller; 47 + #interrupt-cells = <2>; 48 + gpio-controller; 49 + #gpio-cells = <2>; 48 50 }; 49 51 50 52 pmc@d8130000 {
+6 -4
arch/arm/boot/dts/wm8650.dtsi
··· 34 34 interrupts = <56 57 58 59 60 61 62 63>; 35 35 }; 36 36 37 - gpio: gpio-controller@d8110000 { 38 - compatible = "wm,wm8650-gpio"; 39 - gpio-controller; 37 + pinctrl: pinctrl@d8110000 { 38 + compatible = "wm,wm8650-pinctrl"; 40 39 reg = <0xd8110000 0x10000>; 41 - #gpio-cells = <3>; 40 + interrupt-controller; 41 + #interrupt-cells = <2>; 42 + gpio-controller; 43 + #gpio-cells = <2>; 42 44 }; 43 45 44 46 pmc@d8130000 {
+6 -4
arch/arm/boot/dts/wm8850.dtsi
··· 41 41 interrupts = <56 57 58 59 60 61 62 63>; 42 42 }; 43 43 44 - gpio: gpio-controller@d8110000 { 45 - compatible = "wm,wm8650-gpio"; 46 - gpio-controller; 44 + pinctrl: pinctrl@d8110000 { 45 + compatible = "wm,wm8850-pinctrl"; 47 46 reg = <0xd8110000 0x10000>; 48 - #gpio-cells = <3>; 47 + interrupt-controller; 48 + #interrupt-cells = <2>; 49 + gpio-controller; 50 + #gpio-cells = <2>; 49 51 }; 50 52 51 53 pmc@d8130000 {
+6 -39
arch/arm/boot/dts/zynq-7000.dtsi
··· 118 118 }; 119 119 120 120 ttc0: ttc0@f8001000 { 121 - #address-cells = <1>; 122 - #size-cells = <0>; 123 - compatible = "xlnx,ttc"; 121 + interrupt-parent = <&intc>; 122 + interrupts = < 0 10 4 0 11 4 0 12 4 >; 123 + compatible = "cdns,ttc"; 124 124 reg = <0xF8001000 0x1000>; 125 125 clocks = <&cpu_clk 3>; 126 126 clock-names = "cpu_1x"; 127 127 clock-ranges; 128 - 129 - ttc0_0: ttc0.0 { 130 - status = "disabled"; 131 - reg = <0>; 132 - interrupts = <0 10 4>; 133 - }; 134 - ttc0_1: ttc0.1 { 135 - status = "disabled"; 136 - reg = <1>; 137 - interrupts = <0 11 4>; 138 - }; 139 - ttc0_2: ttc0.2 { 140 - status = "disabled"; 141 - reg = <2>; 142 - interrupts = <0 12 4>; 143 - }; 144 128 }; 145 129 146 130 ttc1: ttc1@f8002000 { 147 - #interrupt-parent = <&intc>; 148 - #address-cells = <1>; 149 - #size-cells = <0>; 150 - compatible = "xlnx,ttc"; 131 + interrupt-parent = <&intc>; 132 + interrupts = < 0 37 4 0 38 4 0 39 4 >; 133 + compatible = "cdns,ttc"; 151 134 reg = <0xF8002000 0x1000>; 152 135 clocks = <&cpu_clk 3>; 153 136 clock-names = "cpu_1x"; 154 137 clock-ranges; 155 - 156 - ttc1_0: ttc1.0 { 157 - status = "disabled"; 158 - reg = <0>; 159 - interrupts = <0 37 4>; 160 - }; 161 - ttc1_1: ttc1.1 { 162 - status = "disabled"; 163 - reg = <1>; 164 - interrupts = <0 38 4>; 165 - }; 166 - ttc1_2: ttc1.2 { 167 - status = "disabled"; 168 - reg = <2>; 169 - interrupts = <0 39 4>; 170 - }; 171 138 }; 172 139 }; 173 140 };
-10
arch/arm/boot/dts/zynq-zc702.dts
··· 32 32 &ps_clk { 33 33 clock-frequency = <33333330>; 34 34 }; 35 - 36 - &ttc0_0 { 37 - status = "ok"; 38 - compatible = "xlnx,ttc-counter-clocksource"; 39 - }; 40 - 41 - &ttc0_1 { 42 - status = "ok"; 43 - compatible = "xlnx,ttc-counter-clockevent"; 44 - };
+2
arch/arm/mach-at91/at91sam9261.c
··· 169 169 }; 170 170 171 171 static struct clk_lookup periph_clocks_lookups[] = { 172 + CLKDEV_CON_DEV_ID("hclk", "at91sam9261-lcdfb.0", &hck1), 173 + CLKDEV_CON_DEV_ID("hclk", "at91sam9g10-lcdfb.0", &hck1), 172 174 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), 173 175 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), 174 176 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
+5 -1
arch/arm/mach-at91/at91sam9261_devices.c
··· 488 488 }; 489 489 490 490 static struct platform_device at91_lcdc_device = { 491 - .name = "atmel_lcdfb", 492 491 .id = 0, 493 492 .dev = { 494 493 .dma_mask = &lcdc_dmamask, ··· 503 504 if (!data) { 504 505 return; 505 506 } 507 + 508 + if (cpu_is_at91sam9g10()) 509 + at91_lcdc_device.name = "at91sam9g10-lcdfb"; 510 + else 511 + at91_lcdc_device.name = "at91sam9261-lcdfb"; 506 512 507 513 #if defined(CONFIG_FB_ATMEL_STN) 508 514 at91_set_A_periph(AT91_PIN_PB0, 0); /* LCDVSYNC */
+1
arch/arm/mach-at91/at91sam9263.c
··· 190 190 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk), 191 191 CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk), 192 192 CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk), 193 + CLKDEV_CON_DEV_ID("hclk", "at91sam9263-lcdfb.0", &lcdc_clk), 193 194 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk), 194 195 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk), 195 196 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
+1 -1
arch/arm/mach-at91/at91sam9263_devices.c
··· 848 848 }; 849 849 850 850 static struct platform_device at91_lcdc_device = { 851 - .name = "atmel_lcdfb", 851 + .name = "at91sam9263-lcdfb", 852 852 .id = 0, 853 853 .dev = { 854 854 .dma_mask = &lcdc_dmamask,
+2
arch/arm/mach-at91/at91sam9g45.c
··· 228 228 CLKDEV_CON_ID("hclk", &macb_clk), 229 229 /* One additional fake clock for ohci */ 230 230 CLKDEV_CON_ID("ohci_clk", &uhphs_clk), 231 + CLKDEV_CON_DEV_ID("hclk", "at91sam9g45-lcdfb.0", &lcdc_clk), 232 + CLKDEV_CON_DEV_ID("hclk", "at91sam9g45es-lcdfb.0", &lcdc_clk), 231 233 CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk), 232 234 CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), 233 235 CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk),
+5 -1
arch/arm/mach-at91/at91sam9g45_devices.c
··· 981 981 }; 982 982 983 983 static struct platform_device at91_lcdc_device = { 984 - .name = "atmel_lcdfb", 985 984 .id = 0, 986 985 .dev = { 987 986 .dma_mask = &lcdc_dmamask, ··· 995 996 { 996 997 if (!data) 997 998 return; 999 + 1000 + if (cpu_is_at91sam9g45es()) 1001 + at91_lcdc_device.name = "at91sam9g45es-lcdfb"; 1002 + else 1003 + at91_lcdc_device.name = "at91sam9g45-lcdfb"; 998 1004 999 1005 at91_set_A_periph(AT91_PIN_PE0, 0); /* LCDDPWR */ 1000 1006
+1
arch/arm/mach-at91/at91sam9rl.c
··· 179 179 }; 180 180 181 181 static struct clk_lookup periph_clocks_lookups[] = { 182 + CLKDEV_CON_DEV_ID("hclk", "at91sam9rl-lcdfb.0", &lcdc_clk), 182 183 CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), 183 184 CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), 184 185 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
+1 -1
arch/arm/mach-at91/at91sam9rl_devices.c
··· 514 514 }; 515 515 516 516 static struct platform_device at91_lcdc_device = { 517 - .name = "atmel_lcdfb", 517 + .name = "at91sam9rl-lcdfb", 518 518 .id = 0, 519 519 .dev = { 520 520 .dma_mask = &lcdc_dmamask,
+5 -7
arch/arm/mach-exynos/Kconfig
··· 63 63 bool "SAMSUNG EXYNOS5250" 64 64 default y 65 65 depends on ARCH_EXYNOS5 66 + select PM_GENERIC_DOMAINS if PM 66 67 select S5P_PM if PM 67 68 select S5P_SLEEP if PM 68 69 select S5P_DEV_MFC ··· 83 82 select PM_OPP 84 83 help 85 84 Enable EXYNOS5440 SoC support 86 - 87 - config EXYNOS4_MCT 88 - bool 89 - default y 90 - help 91 - Use MCT (Multi Core Timer) as kernel timers 92 85 93 86 config EXYNOS_ATAGS 94 87 bool "ATAGS based boot for EXYNOS (deprecated)" ··· 280 285 select S5P_DEV_ONENAND 281 286 select S5P_DEV_TV 282 287 select S5P_GPIO_INT 283 - select S5P_HRT 284 288 select S5P_SETUP_MIPIPHY 289 + select SAMSUNG_HRT 285 290 help 286 291 Machine support for Samsung Mobile Universal S5PC210 Reference 287 292 Board. ··· 409 414 bool "Samsung Exynos4 Machine using device tree" 410 415 depends on ARCH_EXYNOS4 411 416 select ARM_AMBA 417 + select CLKSRC_OF 412 418 select CPU_EXYNOS4210 413 419 select KEYBOARD_SAMSUNG if INPUT_KEYBOARD 414 420 select PINCTRL 415 421 select PINCTRL_EXYNOS 422 + select S5P_DEV_MFC 416 423 select USE_OF 417 424 help 418 425 Machine support for Samsung Exynos4 machine with device tree enabled. ··· 427 430 default y 428 431 depends on ARCH_EXYNOS5 429 432 select ARM_AMBA 433 + select CLKSRC_OF 430 434 select USE_OF 431 435 help 432 436 Machine support for Samsung EXYNOS5 machine with device tree enabled.
-6
arch/arm/mach-exynos/Makefile
··· 13 13 # Core 14 14 15 15 obj-$(CONFIG_ARCH_EXYNOS) += common.o 16 - obj-$(CONFIG_ARCH_EXYNOS4) += clock-exynos4.o 17 - obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o 18 - obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o 19 - obj-$(CONFIG_SOC_EXYNOS5250) += clock-exynos5.o 20 16 21 17 obj-$(CONFIG_PM) += pm.o 22 18 obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o ··· 21 25 obj-$(CONFIG_ARCH_EXYNOS) += pmu.o 22 26 23 27 obj-$(CONFIG_SMP) += platsmp.o headsmp.o 24 - 25 - obj-$(CONFIG_EXYNOS4_MCT) += mct.o 26 28 27 29 obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 28 30
-1601
arch/arm/mach-exynos/clock-exynos4.c
··· 1 - /* 2 - * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd. 3 - * http://www.samsung.com 4 - * 5 - * EXYNOS4 - Clock support 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 - */ 11 - 12 - #include <linux/kernel.h> 13 - #include <linux/err.h> 14 - #include <linux/io.h> 15 - #include <linux/syscore_ops.h> 16 - 17 - #include <plat/cpu-freq.h> 18 - #include <plat/clock.h> 19 - #include <plat/cpu.h> 20 - #include <plat/pll.h> 21 - #include <plat/s5p-clock.h> 22 - #include <plat/clock-clksrc.h> 23 - #include <plat/pm.h> 24 - 25 - #include <mach/map.h> 26 - #include <mach/regs-clock.h> 27 - 28 - #include "common.h" 29 - #include "clock-exynos4.h" 30 - 31 - #ifdef CONFIG_PM_SLEEP 32 - static struct sleep_save exynos4_clock_save[] = { 33 - SAVE_ITEM(EXYNOS4_CLKDIV_LEFTBUS), 34 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_LEFTBUS), 35 - SAVE_ITEM(EXYNOS4_CLKDIV_RIGHTBUS), 36 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_RIGHTBUS), 37 - SAVE_ITEM(EXYNOS4_CLKSRC_TOP0), 38 - SAVE_ITEM(EXYNOS4_CLKSRC_TOP1), 39 - SAVE_ITEM(EXYNOS4_CLKSRC_CAM), 40 - SAVE_ITEM(EXYNOS4_CLKSRC_TV), 41 - SAVE_ITEM(EXYNOS4_CLKSRC_MFC), 42 - SAVE_ITEM(EXYNOS4_CLKSRC_G3D), 43 - SAVE_ITEM(EXYNOS4_CLKSRC_LCD0), 44 - SAVE_ITEM(EXYNOS4_CLKSRC_MAUDIO), 45 - SAVE_ITEM(EXYNOS4_CLKSRC_FSYS), 46 - SAVE_ITEM(EXYNOS4_CLKSRC_PERIL0), 47 - SAVE_ITEM(EXYNOS4_CLKSRC_PERIL1), 48 - SAVE_ITEM(EXYNOS4_CLKDIV_CAM), 49 - SAVE_ITEM(EXYNOS4_CLKDIV_TV), 50 - SAVE_ITEM(EXYNOS4_CLKDIV_MFC), 51 - SAVE_ITEM(EXYNOS4_CLKDIV_G3D), 52 - SAVE_ITEM(EXYNOS4_CLKDIV_LCD0), 53 - SAVE_ITEM(EXYNOS4_CLKDIV_MAUDIO), 54 - SAVE_ITEM(EXYNOS4_CLKDIV_FSYS0), 55 - SAVE_ITEM(EXYNOS4_CLKDIV_FSYS1), 56 - SAVE_ITEM(EXYNOS4_CLKDIV_FSYS2), 57 - SAVE_ITEM(EXYNOS4_CLKDIV_FSYS3), 58 - SAVE_ITEM(EXYNOS4_CLKDIV_PERIL0), 59 - SAVE_ITEM(EXYNOS4_CLKDIV_PERIL1), 60 - SAVE_ITEM(EXYNOS4_CLKDIV_PERIL2), 61 - SAVE_ITEM(EXYNOS4_CLKDIV_PERIL3), 62 - SAVE_ITEM(EXYNOS4_CLKDIV_PERIL4), 63 - SAVE_ITEM(EXYNOS4_CLKDIV_PERIL5), 64 - SAVE_ITEM(EXYNOS4_CLKDIV_TOP), 65 - SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TOP), 66 - SAVE_ITEM(EXYNOS4_CLKSRC_MASK_CAM), 67 - SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TV), 68 - SAVE_ITEM(EXYNOS4_CLKSRC_MASK_LCD0), 69 - SAVE_ITEM(EXYNOS4_CLKSRC_MASK_MAUDIO), 70 - SAVE_ITEM(EXYNOS4_CLKSRC_MASK_FSYS), 71 - SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL0), 72 - SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL1), 73 - SAVE_ITEM(EXYNOS4_CLKDIV2_RATIO), 74 - SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCAM), 75 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_CAM), 76 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_TV), 77 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_MFC), 78 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_G3D), 79 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_LCD0), 80 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_FSYS), 81 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_GPS), 82 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_PERIL), 83 - SAVE_ITEM(EXYNOS4_CLKGATE_BLOCK), 84 - SAVE_ITEM(EXYNOS4_CLKSRC_MASK_DMC), 85 - SAVE_ITEM(EXYNOS4_CLKSRC_DMC), 86 - SAVE_ITEM(EXYNOS4_CLKDIV_DMC0), 87 - SAVE_ITEM(EXYNOS4_CLKDIV_DMC1), 88 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_DMC), 89 - SAVE_ITEM(EXYNOS4_CLKSRC_CPU), 90 - SAVE_ITEM(EXYNOS4_CLKDIV_CPU), 91 - SAVE_ITEM(EXYNOS4_CLKDIV_CPU + 0x4), 92 - SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCPU), 93 - SAVE_ITEM(EXYNOS4_CLKGATE_IP_CPU), 94 - }; 95 - #endif 96 - 97 - static struct clk exynos4_clk_sclk_hdmi27m = { 98 - .name = "sclk_hdmi27m", 99 - .rate = 27000000, 100 - }; 101 - 102 - static struct clk exynos4_clk_sclk_hdmiphy = { 103 - .name = "sclk_hdmiphy", 104 - }; 105 - 106 - static struct clk exynos4_clk_sclk_usbphy0 = { 107 - .name = "sclk_usbphy0", 108 - .rate = 27000000, 109 - }; 110 - 111 - static struct clk exynos4_clk_sclk_usbphy1 = { 112 - .name = "sclk_usbphy1", 113 - }; 114 - 115 - static struct clk dummy_apb_pclk = { 116 - .name = "apb_pclk", 117 - .id = -1, 118 - }; 119 - 120 - static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable) 121 - { 122 - return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TOP, clk, enable); 123 - } 124 - 125 - static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable) 126 - { 127 - return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_CAM, clk, enable); 128 - } 129 - 130 - static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable) 131 - { 132 - return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_LCD0, clk, enable); 133 - } 134 - 135 - int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable) 136 - { 137 - return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_FSYS, clk, enable); 138 - } 139 - 140 - static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable) 141 - { 142 - return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL0, clk, enable); 143 - } 144 - 145 - static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable) 146 - { 147 - return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL1, clk, enable); 148 - } 149 - 150 - static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable) 151 - { 152 - return s5p_gatectrl(EXYNOS4_CLKGATE_IP_MFC, clk, enable); 153 - } 154 - 155 - static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable) 156 - { 157 - return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TV, clk, enable); 158 - } 159 - 160 - static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable) 161 - { 162 - return s5p_gatectrl(EXYNOS4_CLKGATE_IP_CAM, clk, enable); 163 - } 164 - 165 - static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable) 166 - { 167 - return s5p_gatectrl(EXYNOS4_CLKGATE_IP_TV, clk, enable); 168 - } 169 - 170 - int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable) 171 - { 172 - return s5p_gatectrl(EXYNOS4_CLKGATE_IP_IMAGE, clk, enable); 173 - } 174 - 175 - static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable) 176 - { 177 - return s5p_gatectrl(EXYNOS4_CLKGATE_IP_LCD0, clk, enable); 178 - } 179 - 180 - int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable) 181 - { 182 - return s5p_gatectrl(EXYNOS4210_CLKGATE_IP_LCD1, clk, enable); 183 - } 184 - 185 - int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable) 186 - { 187 - return s5p_gatectrl(EXYNOS4_CLKGATE_IP_FSYS, clk, enable); 188 - } 189 - 190 - static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable) 191 - { 192 - return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIL, clk, enable); 193 - } 194 - 195 - static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable) 196 - { 197 - return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIR, clk, enable); 198 - } 199 - 200 - int exynos4_clk_ip_dmc_ctrl(struct clk *clk, int enable) 201 - { 202 - return s5p_gatectrl(EXYNOS4_CLKGATE_IP_DMC, clk, enable); 203 - } 204 - 205 - static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable) 206 - { 207 - return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable); 208 - } 209 - 210 - static int exynos4_clk_dac_ctrl(struct clk *clk, int enable) 211 - { 212 - return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable); 213 - } 214 - 215 - /* Core list of CMU_CPU side */ 216 - 217 - static struct clksrc_clk exynos4_clk_mout_apll = { 218 - .clk = { 219 - .name = "mout_apll", 220 - }, 221 - .sources = &clk_src_apll, 222 - .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 0, .size = 1 }, 223 - }; 224 - 225 - static struct clksrc_clk exynos4_clk_sclk_apll = { 226 - .clk = { 227 - .name = "sclk_apll", 228 - .parent = &exynos4_clk_mout_apll.clk, 229 - }, 230 - .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 24, .size = 3 }, 231 - }; 232 - 233 - static struct clksrc_clk exynos4_clk_mout_epll = { 234 - .clk = { 235 - .name = "mout_epll", 236 - }, 237 - .sources = &clk_src_epll, 238 - .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 4, .size = 1 }, 239 - }; 240 - 241 - struct clksrc_clk exynos4_clk_mout_mpll = { 242 - .clk = { 243 - .name = "mout_mpll", 244 - }, 245 - .sources = &clk_src_mpll, 246 - 247 - /* reg_src will be added in each SoCs' clock */ 248 - }; 249 - 250 - static struct clk *exynos4_clkset_moutcore_list[] = { 251 - [0] = &exynos4_clk_mout_apll.clk, 252 - [1] = &exynos4_clk_mout_mpll.clk, 253 - }; 254 - 255 - static struct clksrc_sources exynos4_clkset_moutcore = { 256 - .sources = exynos4_clkset_moutcore_list, 257 - .nr_sources = ARRAY_SIZE(exynos4_clkset_moutcore_list), 258 - }; 259 - 260 - static struct clksrc_clk exynos4_clk_moutcore = { 261 - .clk = { 262 - .name = "moutcore", 263 - }, 264 - .sources = &exynos4_clkset_moutcore, 265 - .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 16, .size = 1 }, 266 - }; 267 - 268 - static struct clksrc_clk exynos4_clk_coreclk = { 269 - .clk = { 270 - .name = "core_clk", 271 - .parent = &exynos4_clk_moutcore.clk, 272 - }, 273 - .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 0, .size = 3 }, 274 - }; 275 - 276 - static struct clksrc_clk exynos4_clk_armclk = { 277 - .clk = { 278 - .name = "armclk", 279 - .parent = &exynos4_clk_coreclk.clk, 280 - }, 281 - }; 282 - 283 - static struct clksrc_clk exynos4_clk_aclk_corem0 = { 284 - .clk = { 285 - .name = "aclk_corem0", 286 - .parent = &exynos4_clk_coreclk.clk, 287 - }, 288 - .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 }, 289 - }; 290 - 291 - static struct clksrc_clk exynos4_clk_aclk_cores = { 292 - .clk = { 293 - .name = "aclk_cores", 294 - .parent = &exynos4_clk_coreclk.clk, 295 - }, 296 - .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 }, 297 - }; 298 - 299 - static struct clksrc_clk exynos4_clk_aclk_corem1 = { 300 - .clk = { 301 - .name = "aclk_corem1", 302 - .parent = &exynos4_clk_coreclk.clk, 303 - }, 304 - .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 8, .size = 3 }, 305 - }; 306 - 307 - static struct clksrc_clk exynos4_clk_periphclk = { 308 - .clk = { 309 - .name = "periphclk", 310 - .parent = &exynos4_clk_coreclk.clk, 311 - }, 312 - .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 12, .size = 3 }, 313 - }; 314 - 315 - /* Core list of CMU_CORE side */ 316 - 317 - static struct clk *exynos4_clkset_corebus_list[] = { 318 - [0] = &exynos4_clk_mout_mpll.clk, 319 - [1] = &exynos4_clk_sclk_apll.clk, 320 - }; 321 - 322 - struct clksrc_sources exynos4_clkset_mout_corebus = { 323 - .sources = exynos4_clkset_corebus_list, 324 - .nr_sources = ARRAY_SIZE(exynos4_clkset_corebus_list), 325 - }; 326 - 327 - static struct clksrc_clk exynos4_clk_mout_corebus = { 328 - .clk = { 329 - .name = "mout_corebus", 330 - }, 331 - .sources = &exynos4_clkset_mout_corebus, 332 - .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 4, .size = 1 }, 333 - }; 334 - 335 - static struct clksrc_clk exynos4_clk_sclk_dmc = { 336 - .clk = { 337 - .name = "sclk_dmc", 338 - .parent = &exynos4_clk_mout_corebus.clk, 339 - }, 340 - .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 12, .size = 3 }, 341 - }; 342 - 343 - static struct clksrc_clk exynos4_clk_aclk_cored = { 344 - .clk = { 345 - .name = "aclk_cored", 346 - .parent = &exynos4_clk_sclk_dmc.clk, 347 - }, 348 - .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 16, .size = 3 }, 349 - }; 350 - 351 - static struct clksrc_clk exynos4_clk_aclk_corep = { 352 - .clk = { 353 - .name = "aclk_corep", 354 - .parent = &exynos4_clk_aclk_cored.clk, 355 - }, 356 - .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 20, .size = 3 }, 357 - }; 358 - 359 - static struct clksrc_clk exynos4_clk_aclk_acp = { 360 - .clk = { 361 - .name = "aclk_acp", 362 - .parent = &exynos4_clk_mout_corebus.clk, 363 - }, 364 - .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 0, .size = 3 }, 365 - }; 366 - 367 - static struct clksrc_clk exynos4_clk_pclk_acp = { 368 - .clk = { 369 - .name = "pclk_acp", 370 - .parent = &exynos4_clk_aclk_acp.clk, 371 - }, 372 - .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 4, .size = 3 }, 373 - }; 374 - 375 - /* Core list of CMU_TOP side */ 376 - 377 - struct clk *exynos4_clkset_aclk_top_list[] = { 378 - [0] = &exynos4_clk_mout_mpll.clk, 379 - [1] = &exynos4_clk_sclk_apll.clk, 380 - }; 381 - 382 - static struct clksrc_sources exynos4_clkset_aclk = { 383 - .sources = exynos4_clkset_aclk_top_list, 384 - .nr_sources = ARRAY_SIZE(exynos4_clkset_aclk_top_list), 385 - }; 386 - 387 - static struct clksrc_clk exynos4_clk_aclk_200 = { 388 - .clk = { 389 - .name = "aclk_200", 390 - }, 391 - .sources = &exynos4_clkset_aclk, 392 - .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 12, .size = 1 }, 393 - .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 0, .size = 3 }, 394 - }; 395 - 396 - static struct clksrc_clk exynos4_clk_aclk_100 = { 397 - .clk = { 398 - .name = "aclk_100", 399 - }, 400 - .sources = &exynos4_clkset_aclk, 401 - .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 16, .size = 1 }, 402 - .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 4, .size = 4 }, 403 - }; 404 - 405 - static struct clksrc_clk exynos4_clk_aclk_160 = { 406 - .clk = { 407 - .name = "aclk_160", 408 - }, 409 - .sources = &exynos4_clkset_aclk, 410 - .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 20, .size = 1 }, 411 - .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 8, .size = 3 }, 412 - }; 413 - 414 - struct clksrc_clk exynos4_clk_aclk_133 = { 415 - .clk = { 416 - .name = "aclk_133", 417 - }, 418 - .sources = &exynos4_clkset_aclk, 419 - .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 24, .size = 1 }, 420 - .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 12, .size = 3 }, 421 - }; 422 - 423 - static struct clk *exynos4_clkset_vpllsrc_list[] = { 424 - [0] = &clk_fin_vpll, 425 - [1] = &exynos4_clk_sclk_hdmi27m, 426 - }; 427 - 428 - static struct clksrc_sources exynos4_clkset_vpllsrc = { 429 - .sources = exynos4_clkset_vpllsrc_list, 430 - .nr_sources = ARRAY_SIZE(exynos4_clkset_vpllsrc_list), 431 - }; 432 - 433 - static struct clksrc_clk exynos4_clk_vpllsrc = { 434 - .clk = { 435 - .name = "vpll_src", 436 - .enable = exynos4_clksrc_mask_top_ctrl, 437 - .ctrlbit = (1 << 0), 438 - }, 439 - .sources = &exynos4_clkset_vpllsrc, 440 - .reg_src = { .reg = EXYNOS4_CLKSRC_TOP1, .shift = 0, .size = 1 }, 441 - }; 442 - 443 - static struct clk *exynos4_clkset_sclk_vpll_list[] = { 444 - [0] = &exynos4_clk_vpllsrc.clk, 445 - [1] = &clk_fout_vpll, 446 - }; 447 - 448 - static struct clksrc_sources exynos4_clkset_sclk_vpll = { 449 - .sources = exynos4_clkset_sclk_vpll_list, 450 - .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_vpll_list), 451 - }; 452 - 453 - static struct clksrc_clk exynos4_clk_sclk_vpll = { 454 - .clk = { 455 - .name = "sclk_vpll", 456 - }, 457 - .sources = &exynos4_clkset_sclk_vpll, 458 - .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 8, .size = 1 }, 459 - }; 460 - 461 - static struct clk exynos4_init_clocks_off[] = { 462 - { 463 - .name = "timers", 464 - .parent = &exynos4_clk_aclk_100.clk, 465 - .enable = exynos4_clk_ip_peril_ctrl, 466 - .ctrlbit = (1<<24), 467 - }, { 468 - .name = "csis", 469 - .devname = "s5p-mipi-csis.0", 470 - .enable = exynos4_clk_ip_cam_ctrl, 471 - .ctrlbit = (1 << 4), 472 - }, { 473 - .name = "csis", 474 - .devname = "s5p-mipi-csis.1", 475 - .enable = exynos4_clk_ip_cam_ctrl, 476 - .ctrlbit = (1 << 5), 477 - }, { 478 - .name = "jpeg", 479 - .id = 0, 480 - .enable = exynos4_clk_ip_cam_ctrl, 481 - .ctrlbit = (1 << 6), 482 - }, { 483 - .name = "fimc", 484 - .devname = "exynos4-fimc.0", 485 - .enable = exynos4_clk_ip_cam_ctrl, 486 - .ctrlbit = (1 << 0), 487 - }, { 488 - .name = "fimc", 489 - .devname = "exynos4-fimc.1", 490 - .enable = exynos4_clk_ip_cam_ctrl, 491 - .ctrlbit = (1 << 1), 492 - }, { 493 - .name = "fimc", 494 - .devname = "exynos4-fimc.2", 495 - .enable = exynos4_clk_ip_cam_ctrl, 496 - .ctrlbit = (1 << 2), 497 - }, { 498 - .name = "fimc", 499 - .devname = "exynos4-fimc.3", 500 - .enable = exynos4_clk_ip_cam_ctrl, 501 - .ctrlbit = (1 << 3), 502 - }, { 503 - .name = "tsi", 504 - .enable = exynos4_clk_ip_fsys_ctrl, 505 - .ctrlbit = (1 << 4), 506 - }, { 507 - .name = "hsmmc", 508 - .devname = "exynos4-sdhci.0", 509 - .parent = &exynos4_clk_aclk_133.clk, 510 - .enable = exynos4_clk_ip_fsys_ctrl, 511 - .ctrlbit = (1 << 5), 512 - }, { 513 - .name = "hsmmc", 514 - .devname = "exynos4-sdhci.1", 515 - .parent = &exynos4_clk_aclk_133.clk, 516 - .enable = exynos4_clk_ip_fsys_ctrl, 517 - .ctrlbit = (1 << 6), 518 - }, { 519 - .name = "hsmmc", 520 - .devname = "exynos4-sdhci.2", 521 - .parent = &exynos4_clk_aclk_133.clk, 522 - .enable = exynos4_clk_ip_fsys_ctrl, 523 - .ctrlbit = (1 << 7), 524 - }, { 525 - .name = "hsmmc", 526 - .devname = "exynos4-sdhci.3", 527 - .parent = &exynos4_clk_aclk_133.clk, 528 - .enable = exynos4_clk_ip_fsys_ctrl, 529 - .ctrlbit = (1 << 8), 530 - }, { 531 - .name = "biu", 532 - .parent = &exynos4_clk_aclk_133.clk, 533 - .enable = exynos4_clk_ip_fsys_ctrl, 534 - .ctrlbit = (1 << 9), 535 - }, { 536 - .name = "onenand", 537 - .enable = exynos4_clk_ip_fsys_ctrl, 538 - .ctrlbit = (1 << 15), 539 - }, { 540 - .name = "nfcon", 541 - .enable = exynos4_clk_ip_fsys_ctrl, 542 - .ctrlbit = (1 << 16), 543 - }, { 544 - .name = "dac", 545 - .devname = "s5p-sdo", 546 - .enable = exynos4_clk_ip_tv_ctrl, 547 - .ctrlbit = (1 << 2), 548 - }, { 549 - .name = "mixer", 550 - .devname = "s5p-mixer", 551 - .enable = exynos4_clk_ip_tv_ctrl, 552 - .ctrlbit = (1 << 1), 553 - }, { 554 - .name = "vp", 555 - .devname = "s5p-mixer", 556 - .enable = exynos4_clk_ip_tv_ctrl, 557 - .ctrlbit = (1 << 0), 558 - }, { 559 - .name = "hdmi", 560 - .devname = "exynos4-hdmi", 561 - .enable = exynos4_clk_ip_tv_ctrl, 562 - .ctrlbit = (1 << 3), 563 - }, { 564 - .name = "hdmiphy", 565 - .devname = "exynos4-hdmi", 566 - .enable = exynos4_clk_hdmiphy_ctrl, 567 - .ctrlbit = (1 << 0), 568 - }, { 569 - .name = "dacphy", 570 - .devname = "s5p-sdo", 571 - .enable = exynos4_clk_dac_ctrl, 572 - .ctrlbit = (1 << 0), 573 - }, { 574 - .name = "adc", 575 - .enable = exynos4_clk_ip_peril_ctrl, 576 - .ctrlbit = (1 << 15), 577 - }, { 578 - .name = "tmu_apbif", 579 - .enable = exynos4_clk_ip_perir_ctrl, 580 - .ctrlbit = (1 << 17), 581 - }, { 582 - .name = "keypad", 583 - .enable = exynos4_clk_ip_perir_ctrl, 584 - .ctrlbit = (1 << 16), 585 - }, { 586 - .name = "rtc", 587 - .enable = exynos4_clk_ip_perir_ctrl, 588 - .ctrlbit = (1 << 15), 589 - }, { 590 - .name = "watchdog", 591 - .parent = &exynos4_clk_aclk_100.clk, 592 - .enable = exynos4_clk_ip_perir_ctrl, 593 - .ctrlbit = (1 << 14), 594 - }, { 595 - .name = "usbhost", 596 - .enable = exynos4_clk_ip_fsys_ctrl , 597 - .ctrlbit = (1 << 12), 598 - }, { 599 - .name = "otg", 600 - .enable = exynos4_clk_ip_fsys_ctrl, 601 - .ctrlbit = (1 << 13), 602 - }, { 603 - .name = "spi", 604 - .devname = "exynos4210-spi.0", 605 - .enable = exynos4_clk_ip_peril_ctrl, 606 - .ctrlbit = (1 << 16), 607 - }, { 608 - .name = "spi", 609 - .devname = "exynos4210-spi.1", 610 - .enable = exynos4_clk_ip_peril_ctrl, 611 - .ctrlbit = (1 << 17), 612 - }, { 613 - .name = "spi", 614 - .devname = "exynos4210-spi.2", 615 - .enable = exynos4_clk_ip_peril_ctrl, 616 - .ctrlbit = (1 << 18), 617 - }, { 618 - .name = "iis", 619 - .devname = "samsung-i2s.1", 620 - .enable = exynos4_clk_ip_peril_ctrl, 621 - .ctrlbit = (1 << 20), 622 - }, { 623 - .name = "iis", 624 - .devname = "samsung-i2s.2", 625 - .enable = exynos4_clk_ip_peril_ctrl, 626 - .ctrlbit = (1 << 21), 627 - }, { 628 - .name = "pcm", 629 - .devname = "samsung-pcm.1", 630 - .enable = exynos4_clk_ip_peril_ctrl, 631 - .ctrlbit = (1 << 22), 632 - }, { 633 - .name = "pcm", 634 - .devname = "samsung-pcm.2", 635 - .enable = exynos4_clk_ip_peril_ctrl, 636 - .ctrlbit = (1 << 23), 637 - }, { 638 - .name = "slimbus", 639 - .enable = exynos4_clk_ip_peril_ctrl, 640 - .ctrlbit = (1 << 25), 641 - }, { 642 - .name = "spdif", 643 - .devname = "samsung-spdif", 644 - .enable = exynos4_clk_ip_peril_ctrl, 645 - .ctrlbit = (1 << 26), 646 - }, { 647 - .name = "ac97", 648 - .devname = "samsung-ac97", 649 - .enable = exynos4_clk_ip_peril_ctrl, 650 - .ctrlbit = (1 << 27), 651 - }, { 652 - .name = "mfc", 653 - .devname = "s5p-mfc", 654 - .enable = exynos4_clk_ip_mfc_ctrl, 655 - .ctrlbit = (1 << 0), 656 - }, { 657 - .name = "i2c", 658 - .devname = "s3c2440-i2c.0", 659 - .parent = &exynos4_clk_aclk_100.clk, 660 - .enable = exynos4_clk_ip_peril_ctrl, 661 - .ctrlbit = (1 << 6), 662 - }, { 663 - .name = "i2c", 664 - .devname = "s3c2440-i2c.1", 665 - .parent = &exynos4_clk_aclk_100.clk, 666 - .enable = exynos4_clk_ip_peril_ctrl, 667 - .ctrlbit = (1 << 7), 668 - }, { 669 - .name = "i2c", 670 - .devname = "s3c2440-i2c.2", 671 - .parent = &exynos4_clk_aclk_100.clk, 672 - .enable = exynos4_clk_ip_peril_ctrl, 673 - .ctrlbit = (1 << 8), 674 - }, { 675 - .name = "i2c", 676 - .devname = "s3c2440-i2c.3", 677 - .parent = &exynos4_clk_aclk_100.clk, 678 - .enable = exynos4_clk_ip_peril_ctrl, 679 - .ctrlbit = (1 << 9), 680 - }, { 681 - .name = "i2c", 682 - .devname = "s3c2440-i2c.4", 683 - .parent = &exynos4_clk_aclk_100.clk, 684 - .enable = exynos4_clk_ip_peril_ctrl, 685 - .ctrlbit = (1 << 10), 686 - }, { 687 - .name = "i2c", 688 - .devname = "s3c2440-i2c.5", 689 - .parent = &exynos4_clk_aclk_100.clk, 690 - .enable = exynos4_clk_ip_peril_ctrl, 691 - .ctrlbit = (1 << 11), 692 - }, { 693 - .name = "i2c", 694 - .devname = "s3c2440-i2c.6", 695 - .parent = &exynos4_clk_aclk_100.clk, 696 - .enable = exynos4_clk_ip_peril_ctrl, 697 - .ctrlbit = (1 << 12), 698 - }, { 699 - .name = "i2c", 700 - .devname = "s3c2440-i2c.7", 701 - .parent = &exynos4_clk_aclk_100.clk, 702 - .enable = exynos4_clk_ip_peril_ctrl, 703 - .ctrlbit = (1 << 13), 704 - }, { 705 - .name = "i2c", 706 - .devname = "s3c2440-hdmiphy-i2c", 707 - .parent = &exynos4_clk_aclk_100.clk, 708 - .enable = exynos4_clk_ip_peril_ctrl, 709 - .ctrlbit = (1 << 14), 710 - }, { 711 - .name = "sysmmu", 712 - .devname = "exynos-sysmmu.0", 713 - .enable = exynos4_clk_ip_mfc_ctrl, 714 - .ctrlbit = (1 << 1), 715 - }, { 716 - .name = "sysmmu", 717 - .devname = "exynos-sysmmu.1", 718 - .enable = exynos4_clk_ip_mfc_ctrl, 719 - .ctrlbit = (1 << 2), 720 - }, { 721 - .name = "sysmmu", 722 - .devname = "exynos-sysmmu.2", 723 - .enable = exynos4_clk_ip_tv_ctrl, 724 - .ctrlbit = (1 << 4), 725 - }, { 726 - .name = "sysmmu", 727 - .devname = "exynos-sysmmu.3", 728 - .enable = exynos4_clk_ip_cam_ctrl, 729 - .ctrlbit = (1 << 11), 730 - }, { 731 - .name = "sysmmu", 732 - .devname = "exynos-sysmmu.4", 733 - .enable = exynos4_clk_ip_image_ctrl, 734 - .ctrlbit = (1 << 4), 735 - }, { 736 - .name = "sysmmu", 737 - .devname = "exynos-sysmmu.5", 738 - .enable = exynos4_clk_ip_cam_ctrl, 739 - .ctrlbit = (1 << 7), 740 - }, { 741 - .name = "sysmmu", 742 - .devname = "exynos-sysmmu.6", 743 - .enable = exynos4_clk_ip_cam_ctrl, 744 - .ctrlbit = (1 << 8), 745 - }, { 746 - .name = "sysmmu", 747 - .devname = "exynos-sysmmu.7", 748 - .enable = exynos4_clk_ip_cam_ctrl, 749 - .ctrlbit = (1 << 9), 750 - }, { 751 - .name = "sysmmu", 752 - .devname = "exynos-sysmmu.8", 753 - .enable = exynos4_clk_ip_cam_ctrl, 754 - .ctrlbit = (1 << 10), 755 - }, { 756 - .name = "sysmmu", 757 - .devname = "exynos-sysmmu.10", 758 - .enable = exynos4_clk_ip_lcd0_ctrl, 759 - .ctrlbit = (1 << 4), 760 - } 761 - }; 762 - 763 - static struct clk exynos4_init_clocks_on[] = { 764 - { 765 - .name = "uart", 766 - .devname = "s5pv210-uart.0", 767 - .enable = exynos4_clk_ip_peril_ctrl, 768 - .ctrlbit = (1 << 0), 769 - }, { 770 - .name = "uart", 771 - .devname = "s5pv210-uart.1", 772 - .enable = exynos4_clk_ip_peril_ctrl, 773 - .ctrlbit = (1 << 1), 774 - }, { 775 - .name = "uart", 776 - .devname = "s5pv210-uart.2", 777 - .enable = exynos4_clk_ip_peril_ctrl, 778 - .ctrlbit = (1 << 2), 779 - }, { 780 - .name = "uart", 781 - .devname = "s5pv210-uart.3", 782 - .enable = exynos4_clk_ip_peril_ctrl, 783 - .ctrlbit = (1 << 3), 784 - }, { 785 - .name = "uart", 786 - .devname = "s5pv210-uart.4", 787 - .enable = exynos4_clk_ip_peril_ctrl, 788 - .ctrlbit = (1 << 4), 789 - }, { 790 - .name = "uart", 791 - .devname = "s5pv210-uart.5", 792 - .enable = exynos4_clk_ip_peril_ctrl, 793 - .ctrlbit = (1 << 5), 794 - } 795 - }; 796 - 797 - static struct clk exynos4_clk_pdma0 = { 798 - .name = "dma", 799 - .devname = "dma-pl330.0", 800 - .enable = exynos4_clk_ip_fsys_ctrl, 801 - .ctrlbit = (1 << 0), 802 - }; 803 - 804 - static struct clk exynos4_clk_pdma1 = { 805 - .name = "dma", 806 - .devname = "dma-pl330.1", 807 - .enable = exynos4_clk_ip_fsys_ctrl, 808 - .ctrlbit = (1 << 1), 809 - }; 810 - 811 - static struct clk exynos4_clk_mdma1 = { 812 - .name = "dma", 813 - .devname = "dma-pl330.2", 814 - .enable = exynos4_clk_ip_image_ctrl, 815 - .ctrlbit = ((1 << 8) | (1 << 5) | (1 << 2)), 816 - }; 817 - 818 - static struct clk exynos4_clk_fimd0 = { 819 - .name = "fimd", 820 - .devname = "exynos4-fb.0", 821 - .enable = exynos4_clk_ip_lcd0_ctrl, 822 - .ctrlbit = (1 << 0), 823 - }; 824 - 825 - struct clk *exynos4_clkset_group_list[] = { 826 - [0] = &clk_ext_xtal_mux, 827 - [1] = &clk_xusbxti, 828 - [2] = &exynos4_clk_sclk_hdmi27m, 829 - [3] = &exynos4_clk_sclk_usbphy0, 830 - [4] = &exynos4_clk_sclk_usbphy1, 831 - [5] = &exynos4_clk_sclk_hdmiphy, 832 - [6] = &exynos4_clk_mout_mpll.clk, 833 - [7] = &exynos4_clk_mout_epll.clk, 834 - [8] = &exynos4_clk_sclk_vpll.clk, 835 - }; 836 - 837 - struct clksrc_sources exynos4_clkset_group = { 838 - .sources = exynos4_clkset_group_list, 839 - .nr_sources = ARRAY_SIZE(exynos4_clkset_group_list), 840 - }; 841 - 842 - static struct clk *exynos4_clkset_mout_g2d0_list[] = { 843 - [0] = &exynos4_clk_mout_mpll.clk, 844 - [1] = &exynos4_clk_sclk_apll.clk, 845 - }; 846 - 847 - struct clksrc_sources exynos4_clkset_mout_g2d0 = { 848 - .sources = exynos4_clkset_mout_g2d0_list, 849 - .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d0_list), 850 - }; 851 - 852 - static struct clk *exynos4_clkset_mout_g2d1_list[] = { 853 - [0] = &exynos4_clk_mout_epll.clk, 854 - [1] = &exynos4_clk_sclk_vpll.clk, 855 - }; 856 - 857 - struct clksrc_sources exynos4_clkset_mout_g2d1 = { 858 - .sources = exynos4_clkset_mout_g2d1_list, 859 - .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d1_list), 860 - }; 861 - 862 - static struct clk *exynos4_clkset_mout_mfc0_list[] = { 863 - [0] = &exynos4_clk_mout_mpll.clk, 864 - [1] = &exynos4_clk_sclk_apll.clk, 865 - }; 866 - 867 - static struct clksrc_sources exynos4_clkset_mout_mfc0 = { 868 - .sources = exynos4_clkset_mout_mfc0_list, 869 - .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc0_list), 870 - }; 871 - 872 - static struct clksrc_clk exynos4_clk_mout_mfc0 = { 873 - .clk = { 874 - .name = "mout_mfc0", 875 - }, 876 - .sources = &exynos4_clkset_mout_mfc0, 877 - .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 0, .size = 1 }, 878 - }; 879 - 880 - static struct clk *exynos4_clkset_mout_mfc1_list[] = { 881 - [0] = &exynos4_clk_mout_epll.clk, 882 - [1] = &exynos4_clk_sclk_vpll.clk, 883 - }; 884 - 885 - static struct clksrc_sources exynos4_clkset_mout_mfc1 = { 886 - .sources = exynos4_clkset_mout_mfc1_list, 887 - .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc1_list), 888 - }; 889 - 890 - static struct clksrc_clk exynos4_clk_mout_mfc1 = { 891 - .clk = { 892 - .name = "mout_mfc1", 893 - }, 894 - .sources = &exynos4_clkset_mout_mfc1, 895 - .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 4, .size = 1 }, 896 - }; 897 - 898 - static struct clk *exynos4_clkset_mout_mfc_list[] = { 899 - [0] = &exynos4_clk_mout_mfc0.clk, 900 - [1] = &exynos4_clk_mout_mfc1.clk, 901 - }; 902 - 903 - static struct clksrc_sources exynos4_clkset_mout_mfc = { 904 - .sources = exynos4_clkset_mout_mfc_list, 905 - .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc_list), 906 - }; 907 - 908 - static struct clk *exynos4_clkset_sclk_dac_list[] = { 909 - [0] = &exynos4_clk_sclk_vpll.clk, 910 - [1] = &exynos4_clk_sclk_hdmiphy, 911 - }; 912 - 913 - static struct clksrc_sources exynos4_clkset_sclk_dac = { 914 - .sources = exynos4_clkset_sclk_dac_list, 915 - .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_dac_list), 916 - }; 917 - 918 - static struct clksrc_clk exynos4_clk_sclk_dac = { 919 - .clk = { 920 - .name = "sclk_dac", 921 - .enable = exynos4_clksrc_mask_tv_ctrl, 922 - .ctrlbit = (1 << 8), 923 - }, 924 - .sources = &exynos4_clkset_sclk_dac, 925 - .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 8, .size = 1 }, 926 - }; 927 - 928 - static struct clksrc_clk exynos4_clk_sclk_pixel = { 929 - .clk = { 930 - .name = "sclk_pixel", 931 - .parent = &exynos4_clk_sclk_vpll.clk, 932 - }, 933 - .reg_div = { .reg = EXYNOS4_CLKDIV_TV, .shift = 0, .size = 4 }, 934 - }; 935 - 936 - static struct clk *exynos4_clkset_sclk_hdmi_list[] = { 937 - [0] = &exynos4_clk_sclk_pixel.clk, 938 - [1] = &exynos4_clk_sclk_hdmiphy, 939 - }; 940 - 941 - static struct clksrc_sources exynos4_clkset_sclk_hdmi = { 942 - .sources = exynos4_clkset_sclk_hdmi_list, 943 - .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_hdmi_list), 944 - }; 945 - 946 - static struct clksrc_clk exynos4_clk_sclk_hdmi = { 947 - .clk = { 948 - .name = "sclk_hdmi", 949 - .enable = exynos4_clksrc_mask_tv_ctrl, 950 - .ctrlbit = (1 << 0), 951 - }, 952 - .sources = &exynos4_clkset_sclk_hdmi, 953 - .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 0, .size = 1 }, 954 - }; 955 - 956 - static struct clk *exynos4_clkset_sclk_mixer_list[] = { 957 - [0] = &exynos4_clk_sclk_dac.clk, 958 - [1] = &exynos4_clk_sclk_hdmi.clk, 959 - }; 960 - 961 - static struct clksrc_sources exynos4_clkset_sclk_mixer = { 962 - .sources = exynos4_clkset_sclk_mixer_list, 963 - .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_mixer_list), 964 - }; 965 - 966 - static struct clksrc_clk exynos4_clk_sclk_mixer = { 967 - .clk = { 968 - .name = "sclk_mixer", 969 - .enable = exynos4_clksrc_mask_tv_ctrl, 970 - .ctrlbit = (1 << 4), 971 - }, 972 - .sources = &exynos4_clkset_sclk_mixer, 973 - .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 4, .size = 1 }, 974 - }; 975 - 976 - static struct clksrc_clk *exynos4_sclk_tv[] = { 977 - &exynos4_clk_sclk_dac, 978 - &exynos4_clk_sclk_pixel, 979 - &exynos4_clk_sclk_hdmi, 980 - &exynos4_clk_sclk_mixer, 981 - }; 982 - 983 - static struct clksrc_clk exynos4_clk_dout_mmc0 = { 984 - .clk = { 985 - .name = "dout_mmc0", 986 - }, 987 - .sources = &exynos4_clkset_group, 988 - .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 0, .size = 4 }, 989 - .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 0, .size = 4 }, 990 - }; 991 - 992 - static struct clksrc_clk exynos4_clk_dout_mmc1 = { 993 - .clk = { 994 - .name = "dout_mmc1", 995 - }, 996 - .sources = &exynos4_clkset_group, 997 - .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 4, .size = 4 }, 998 - .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 16, .size = 4 }, 999 - }; 1000 - 1001 - static struct clksrc_clk exynos4_clk_dout_mmc2 = { 1002 - .clk = { 1003 - .name = "dout_mmc2", 1004 - }, 1005 - .sources = &exynos4_clkset_group, 1006 - .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 8, .size = 4 }, 1007 - .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 0, .size = 4 }, 1008 - }; 1009 - 1010 - static struct clksrc_clk exynos4_clk_dout_mmc3 = { 1011 - .clk = { 1012 - .name = "dout_mmc3", 1013 - }, 1014 - .sources = &exynos4_clkset_group, 1015 - .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 12, .size = 4 }, 1016 - .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 16, .size = 4 }, 1017 - }; 1018 - 1019 - static struct clksrc_clk exynos4_clk_dout_mmc4 = { 1020 - .clk = { 1021 - .name = "dout_mmc4", 1022 - }, 1023 - .sources = &exynos4_clkset_group, 1024 - .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 16, .size = 4 }, 1025 - .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 0, .size = 4 }, 1026 - }; 1027 - 1028 - static struct clksrc_clk exynos4_clksrcs[] = { 1029 - { 1030 - .clk = { 1031 - .name = "sclk_pwm", 1032 - .enable = exynos4_clksrc_mask_peril0_ctrl, 1033 - .ctrlbit = (1 << 24), 1034 - }, 1035 - .sources = &exynos4_clkset_group, 1036 - .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 24, .size = 4 }, 1037 - .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL3, .shift = 0, .size = 4 }, 1038 - }, { 1039 - .clk = { 1040 - .name = "sclk_csis", 1041 - .devname = "s5p-mipi-csis.0", 1042 - .enable = exynos4_clksrc_mask_cam_ctrl, 1043 - .ctrlbit = (1 << 24), 1044 - }, 1045 - .sources = &exynos4_clkset_group, 1046 - .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 24, .size = 4 }, 1047 - .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 24, .size = 4 }, 1048 - }, { 1049 - .clk = { 1050 - .name = "sclk_csis", 1051 - .devname = "s5p-mipi-csis.1", 1052 - .enable = exynos4_clksrc_mask_cam_ctrl, 1053 - .ctrlbit = (1 << 28), 1054 - }, 1055 - .sources = &exynos4_clkset_group, 1056 - .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 28, .size = 4 }, 1057 - .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 28, .size = 4 }, 1058 - }, { 1059 - .clk = { 1060 - .name = "sclk_cam0", 1061 - .enable = exynos4_clksrc_mask_cam_ctrl, 1062 - .ctrlbit = (1 << 16), 1063 - }, 1064 - .sources = &exynos4_clkset_group, 1065 - .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 16, .size = 4 }, 1066 - .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 16, .size = 4 }, 1067 - }, { 1068 - .clk = { 1069 - .name = "sclk_cam1", 1070 - .enable = exynos4_clksrc_mask_cam_ctrl, 1071 - .ctrlbit = (1 << 20), 1072 - }, 1073 - .sources = &exynos4_clkset_group, 1074 - .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 20, .size = 4 }, 1075 - .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 20, .size = 4 }, 1076 - }, { 1077 - .clk = { 1078 - .name = "sclk_fimc", 1079 - .devname = "exynos4-fimc.0", 1080 - .enable = exynos4_clksrc_mask_cam_ctrl, 1081 - .ctrlbit = (1 << 0), 1082 - }, 1083 - .sources = &exynos4_clkset_group, 1084 - .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 0, .size = 4 }, 1085 - .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 0, .size = 4 }, 1086 - }, { 1087 - .clk = { 1088 - .name = "sclk_fimc", 1089 - .devname = "exynos4-fimc.1", 1090 - .enable = exynos4_clksrc_mask_cam_ctrl, 1091 - .ctrlbit = (1 << 4), 1092 - }, 1093 - .sources = &exynos4_clkset_group, 1094 - .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 4, .size = 4 }, 1095 - .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 4, .size = 4 }, 1096 - }, { 1097 - .clk = { 1098 - .name = "sclk_fimc", 1099 - .devname = "exynos4-fimc.2", 1100 - .enable = exynos4_clksrc_mask_cam_ctrl, 1101 - .ctrlbit = (1 << 8), 1102 - }, 1103 - .sources = &exynos4_clkset_group, 1104 - .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 8, .size = 4 }, 1105 - .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 8, .size = 4 }, 1106 - }, { 1107 - .clk = { 1108 - .name = "sclk_fimc", 1109 - .devname = "exynos4-fimc.3", 1110 - .enable = exynos4_clksrc_mask_cam_ctrl, 1111 - .ctrlbit = (1 << 12), 1112 - }, 1113 - .sources = &exynos4_clkset_group, 1114 - .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 12, .size = 4 }, 1115 - .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 12, .size = 4 }, 1116 - }, { 1117 - .clk = { 1118 - .name = "sclk_fimd", 1119 - .devname = "exynos4-fb.0", 1120 - .enable = exynos4_clksrc_mask_lcd0_ctrl, 1121 - .ctrlbit = (1 << 0), 1122 - }, 1123 - .sources = &exynos4_clkset_group, 1124 - .reg_src = { .reg = EXYNOS4_CLKSRC_LCD0, .shift = 0, .size = 4 }, 1125 - .reg_div = { .reg = EXYNOS4_CLKDIV_LCD0, .shift = 0, .size = 4 }, 1126 - }, { 1127 - .clk = { 1128 - .name = "sclk_mfc", 1129 - .devname = "s5p-mfc", 1130 - }, 1131 - .sources = &exynos4_clkset_mout_mfc, 1132 - .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 8, .size = 1 }, 1133 - .reg_div = { .reg = EXYNOS4_CLKDIV_MFC, .shift = 0, .size = 4 }, 1134 - }, { 1135 - .clk = { 1136 - .name = "ciu", 1137 - .parent = &exynos4_clk_dout_mmc4.clk, 1138 - .enable = exynos4_clksrc_mask_fsys_ctrl, 1139 - .ctrlbit = (1 << 16), 1140 - }, 1141 - .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 8, .size = 8 }, 1142 - } 1143 - }; 1144 - 1145 - static struct clksrc_clk exynos4_clk_sclk_uart0 = { 1146 - .clk = { 1147 - .name = "uclk1", 1148 - .devname = "exynos4210-uart.0", 1149 - .enable = exynos4_clksrc_mask_peril0_ctrl, 1150 - .ctrlbit = (1 << 0), 1151 - }, 1152 - .sources = &exynos4_clkset_group, 1153 - .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 0, .size = 4 }, 1154 - .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 0, .size = 4 }, 1155 - }; 1156 - 1157 - static struct clksrc_clk exynos4_clk_sclk_uart1 = { 1158 - .clk = { 1159 - .name = "uclk1", 1160 - .devname = "exynos4210-uart.1", 1161 - .enable = exynos4_clksrc_mask_peril0_ctrl, 1162 - .ctrlbit = (1 << 4), 1163 - }, 1164 - .sources = &exynos4_clkset_group, 1165 - .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 4, .size = 4 }, 1166 - .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 4, .size = 4 }, 1167 - }; 1168 - 1169 - static struct clksrc_clk exynos4_clk_sclk_uart2 = { 1170 - .clk = { 1171 - .name = "uclk1", 1172 - .devname = "exynos4210-uart.2", 1173 - .enable = exynos4_clksrc_mask_peril0_ctrl, 1174 - .ctrlbit = (1 << 8), 1175 - }, 1176 - .sources = &exynos4_clkset_group, 1177 - .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 8, .size = 4 }, 1178 - .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 8, .size = 4 }, 1179 - }; 1180 - 1181 - static struct clksrc_clk exynos4_clk_sclk_uart3 = { 1182 - .clk = { 1183 - .name = "uclk1", 1184 - .devname = "exynos4210-uart.3", 1185 - .enable = exynos4_clksrc_mask_peril0_ctrl, 1186 - .ctrlbit = (1 << 12), 1187 - }, 1188 - .sources = &exynos4_clkset_group, 1189 - .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 12, .size = 4 }, 1190 - .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 12, .size = 4 }, 1191 - }; 1192 - 1193 - static struct clksrc_clk exynos4_clk_sclk_mmc0 = { 1194 - .clk = { 1195 - .name = "sclk_mmc", 1196 - .devname = "exynos4-sdhci.0", 1197 - .parent = &exynos4_clk_dout_mmc0.clk, 1198 - .enable = exynos4_clksrc_mask_fsys_ctrl, 1199 - .ctrlbit = (1 << 0), 1200 - }, 1201 - .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 8, .size = 8 }, 1202 - }; 1203 - 1204 - static struct clksrc_clk exynos4_clk_sclk_mmc1 = { 1205 - .clk = { 1206 - .name = "sclk_mmc", 1207 - .devname = "exynos4-sdhci.1", 1208 - .parent = &exynos4_clk_dout_mmc1.clk, 1209 - .enable = exynos4_clksrc_mask_fsys_ctrl, 1210 - .ctrlbit = (1 << 4), 1211 - }, 1212 - .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 24, .size = 8 }, 1213 - }; 1214 - 1215 - static struct clksrc_clk exynos4_clk_sclk_mmc2 = { 1216 - .clk = { 1217 - .name = "sclk_mmc", 1218 - .devname = "exynos4-sdhci.2", 1219 - .parent = &exynos4_clk_dout_mmc2.clk, 1220 - .enable = exynos4_clksrc_mask_fsys_ctrl, 1221 - .ctrlbit = (1 << 8), 1222 - }, 1223 - .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 8, .size = 8 }, 1224 - }; 1225 - 1226 - static struct clksrc_clk exynos4_clk_sclk_mmc3 = { 1227 - .clk = { 1228 - .name = "sclk_mmc", 1229 - .devname = "exynos4-sdhci.3", 1230 - .parent = &exynos4_clk_dout_mmc3.clk, 1231 - .enable = exynos4_clksrc_mask_fsys_ctrl, 1232 - .ctrlbit = (1 << 12), 1233 - }, 1234 - .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 24, .size = 8 }, 1235 - }; 1236 - 1237 - static struct clksrc_clk exynos4_clk_mdout_spi0 = { 1238 - .clk = { 1239 - .name = "mdout_spi", 1240 - .devname = "exynos4210-spi.0", 1241 - }, 1242 - .sources = &exynos4_clkset_group, 1243 - .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 16, .size = 4 }, 1244 - .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 0, .size = 4 }, 1245 - }; 1246 - 1247 - static struct clksrc_clk exynos4_clk_mdout_spi1 = { 1248 - .clk = { 1249 - .name = "mdout_spi", 1250 - .devname = "exynos4210-spi.1", 1251 - }, 1252 - .sources = &exynos4_clkset_group, 1253 - .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 20, .size = 4 }, 1254 - .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 16, .size = 4 }, 1255 - }; 1256 - 1257 - static struct clksrc_clk exynos4_clk_mdout_spi2 = { 1258 - .clk = { 1259 - .name = "mdout_spi", 1260 - .devname = "exynos4210-spi.2", 1261 - }, 1262 - .sources = &exynos4_clkset_group, 1263 - .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 24, .size = 4 }, 1264 - .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 0, .size = 4 }, 1265 - }; 1266 - 1267 - static struct clksrc_clk exynos4_clk_sclk_spi0 = { 1268 - .clk = { 1269 - .name = "sclk_spi", 1270 - .devname = "exynos4210-spi.0", 1271 - .parent = &exynos4_clk_mdout_spi0.clk, 1272 - .enable = exynos4_clksrc_mask_peril1_ctrl, 1273 - .ctrlbit = (1 << 16), 1274 - }, 1275 - .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 8, .size = 8 }, 1276 - }; 1277 - 1278 - static struct clksrc_clk exynos4_clk_sclk_spi1 = { 1279 - .clk = { 1280 - .name = "sclk_spi", 1281 - .devname = "exynos4210-spi.1", 1282 - .parent = &exynos4_clk_mdout_spi1.clk, 1283 - .enable = exynos4_clksrc_mask_peril1_ctrl, 1284 - .ctrlbit = (1 << 20), 1285 - }, 1286 - .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 24, .size = 8 }, 1287 - }; 1288 - 1289 - static struct clksrc_clk exynos4_clk_sclk_spi2 = { 1290 - .clk = { 1291 - .name = "sclk_spi", 1292 - .devname = "exynos4210-spi.2", 1293 - .parent = &exynos4_clk_mdout_spi2.clk, 1294 - .enable = exynos4_clksrc_mask_peril1_ctrl, 1295 - .ctrlbit = (1 << 24), 1296 - }, 1297 - .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 8, .size = 8 }, 1298 - }; 1299 - 1300 - /* Clock initialization code */ 1301 - static struct clksrc_clk *exynos4_sysclks[] = { 1302 - &exynos4_clk_mout_apll, 1303 - &exynos4_clk_sclk_apll, 1304 - &exynos4_clk_mout_epll, 1305 - &exynos4_clk_mout_mpll, 1306 - &exynos4_clk_moutcore, 1307 - &exynos4_clk_coreclk, 1308 - &exynos4_clk_armclk, 1309 - &exynos4_clk_aclk_corem0, 1310 - &exynos4_clk_aclk_cores, 1311 - &exynos4_clk_aclk_corem1, 1312 - &exynos4_clk_periphclk, 1313 - &exynos4_clk_mout_corebus, 1314 - &exynos4_clk_sclk_dmc, 1315 - &exynos4_clk_aclk_cored, 1316 - &exynos4_clk_aclk_corep, 1317 - &exynos4_clk_aclk_acp, 1318 - &exynos4_clk_pclk_acp, 1319 - &exynos4_clk_vpllsrc, 1320 - &exynos4_clk_sclk_vpll, 1321 - &exynos4_clk_aclk_200, 1322 - &exynos4_clk_aclk_100, 1323 - &exynos4_clk_aclk_160, 1324 - &exynos4_clk_aclk_133, 1325 - &exynos4_clk_dout_mmc0, 1326 - &exynos4_clk_dout_mmc1, 1327 - &exynos4_clk_dout_mmc2, 1328 - &exynos4_clk_dout_mmc3, 1329 - &exynos4_clk_dout_mmc4, 1330 - &exynos4_clk_mout_mfc0, 1331 - &exynos4_clk_mout_mfc1, 1332 - }; 1333 - 1334 - static struct clk *exynos4_clk_cdev[] = { 1335 - &exynos4_clk_pdma0, 1336 - &exynos4_clk_pdma1, 1337 - &exynos4_clk_mdma1, 1338 - &exynos4_clk_fimd0, 1339 - }; 1340 - 1341 - static struct clksrc_clk *exynos4_clksrc_cdev[] = { 1342 - &exynos4_clk_sclk_uart0, 1343 - &exynos4_clk_sclk_uart1, 1344 - &exynos4_clk_sclk_uart2, 1345 - &exynos4_clk_sclk_uart3, 1346 - &exynos4_clk_sclk_mmc0, 1347 - &exynos4_clk_sclk_mmc1, 1348 - &exynos4_clk_sclk_mmc2, 1349 - &exynos4_clk_sclk_mmc3, 1350 - &exynos4_clk_sclk_spi0, 1351 - &exynos4_clk_sclk_spi1, 1352 - &exynos4_clk_sclk_spi2, 1353 - &exynos4_clk_mdout_spi0, 1354 - &exynos4_clk_mdout_spi1, 1355 - &exynos4_clk_mdout_spi2, 1356 - }; 1357 - 1358 - static struct clk_lookup exynos4_clk_lookup[] = { 1359 - CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos4_clk_sclk_uart0.clk), 1360 - CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1.clk), 1361 - CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2.clk), 1362 - CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3.clk), 1363 - CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0.clk), 1364 - CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk), 1365 - CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk), 1366 - CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk), 1367 - CLKDEV_INIT("exynos4-fb.0", "lcd", &exynos4_clk_fimd0), 1368 - CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0), 1369 - CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1), 1370 - CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1), 1371 - CLKDEV_INIT("exynos4210-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk), 1372 - CLKDEV_INIT("exynos4210-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk), 1373 - CLKDEV_INIT("exynos4210-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk), 1374 - }; 1375 - 1376 - static int xtal_rate; 1377 - 1378 - static unsigned long exynos4_fout_apll_get_rate(struct clk *clk) 1379 - { 1380 - if (soc_is_exynos4210()) 1381 - return s5p_get_pll45xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0), 1382 - pll_4508); 1383 - else if (soc_is_exynos4212() || soc_is_exynos4412()) 1384 - return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0)); 1385 - else 1386 - return 0; 1387 - } 1388 - 1389 - static struct clk_ops exynos4_fout_apll_ops = { 1390 - .get_rate = exynos4_fout_apll_get_rate, 1391 - }; 1392 - 1393 - static u32 exynos4_vpll_div[][8] = { 1394 - { 54000000, 3, 53, 3, 1024, 0, 17, 0 }, 1395 - { 108000000, 3, 53, 2, 1024, 0, 17, 0 }, 1396 - }; 1397 - 1398 - static unsigned long exynos4_vpll_get_rate(struct clk *clk) 1399 - { 1400 - return clk->rate; 1401 - } 1402 - 1403 - static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate) 1404 - { 1405 - unsigned int vpll_con0, vpll_con1 = 0; 1406 - unsigned int i; 1407 - 1408 - /* Return if nothing changed */ 1409 - if (clk->rate == rate) 1410 - return 0; 1411 - 1412 - vpll_con0 = __raw_readl(EXYNOS4_VPLL_CON0); 1413 - vpll_con0 &= ~(0x1 << 27 | \ 1414 - PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \ 1415 - PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \ 1416 - PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT); 1417 - 1418 - vpll_con1 = __raw_readl(EXYNOS4_VPLL_CON1); 1419 - vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \ 1420 - PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \ 1421 - PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT); 1422 - 1423 - for (i = 0; i < ARRAY_SIZE(exynos4_vpll_div); i++) { 1424 - if (exynos4_vpll_div[i][0] == rate) { 1425 - vpll_con0 |= exynos4_vpll_div[i][1] << PLL46XX_PDIV_SHIFT; 1426 - vpll_con0 |= exynos4_vpll_div[i][2] << PLL46XX_MDIV_SHIFT; 1427 - vpll_con0 |= exynos4_vpll_div[i][3] << PLL46XX_SDIV_SHIFT; 1428 - vpll_con1 |= exynos4_vpll_div[i][4] << PLL46XX_KDIV_SHIFT; 1429 - vpll_con1 |= exynos4_vpll_div[i][5] << PLL46XX_MFR_SHIFT; 1430 - vpll_con1 |= exynos4_vpll_div[i][6] << PLL46XX_MRR_SHIFT; 1431 - vpll_con0 |= exynos4_vpll_div[i][7] << 27; 1432 - break; 1433 - } 1434 - } 1435 - 1436 - if (i == ARRAY_SIZE(exynos4_vpll_div)) { 1437 - printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n", 1438 - __func__); 1439 - return -EINVAL; 1440 - } 1441 - 1442 - __raw_writel(vpll_con0, EXYNOS4_VPLL_CON0); 1443 - __raw_writel(vpll_con1, EXYNOS4_VPLL_CON1); 1444 - 1445 - /* Wait for VPLL lock */ 1446 - while (!(__raw_readl(EXYNOS4_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT))) 1447 - continue; 1448 - 1449 - clk->rate = rate; 1450 - return 0; 1451 - } 1452 - 1453 - static struct clk_ops exynos4_vpll_ops = { 1454 - .get_rate = exynos4_vpll_get_rate, 1455 - .set_rate = exynos4_vpll_set_rate, 1456 - }; 1457 - 1458 - void __init_or_cpufreq exynos4_setup_clocks(void) 1459 - { 1460 - struct clk *xtal_clk; 1461 - unsigned long apll = 0; 1462 - unsigned long mpll = 0; 1463 - unsigned long epll = 0; 1464 - unsigned long vpll = 0; 1465 - unsigned long vpllsrc; 1466 - unsigned long xtal; 1467 - unsigned long armclk; 1468 - unsigned long sclk_dmc; 1469 - unsigned long aclk_200; 1470 - unsigned long aclk_100; 1471 - unsigned long aclk_160; 1472 - unsigned long aclk_133; 1473 - unsigned int ptr; 1474 - 1475 - printk(KERN_DEBUG "%s: registering clocks\n", __func__); 1476 - 1477 - xtal_clk = clk_get(NULL, "xtal"); 1478 - BUG_ON(IS_ERR(xtal_clk)); 1479 - 1480 - xtal = clk_get_rate(xtal_clk); 1481 - 1482 - xtal_rate = xtal; 1483 - 1484 - clk_put(xtal_clk); 1485 - 1486 - printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); 1487 - 1488 - if (soc_is_exynos4210()) { 1489 - apll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_APLL_CON0), 1490 - pll_4508); 1491 - mpll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0), 1492 - pll_4508); 1493 - epll = s5p_get_pll46xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0), 1494 - __raw_readl(EXYNOS4_EPLL_CON1), pll_4600); 1495 - 1496 - vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk); 1497 - vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0), 1498 - __raw_readl(EXYNOS4_VPLL_CON1), pll_4650c); 1499 - } else if (soc_is_exynos4212() || soc_is_exynos4412()) { 1500 - apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_APLL_CON0)); 1501 - mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0)); 1502 - epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0), 1503 - __raw_readl(EXYNOS4_EPLL_CON1)); 1504 - 1505 - vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk); 1506 - vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0), 1507 - __raw_readl(EXYNOS4_VPLL_CON1)); 1508 - } else { 1509 - /* nothing */ 1510 - } 1511 - 1512 - clk_fout_apll.ops = &exynos4_fout_apll_ops; 1513 - clk_fout_mpll.rate = mpll; 1514 - clk_fout_epll.rate = epll; 1515 - clk_fout_vpll.ops = &exynos4_vpll_ops; 1516 - clk_fout_vpll.rate = vpll; 1517 - 1518 - printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld", 1519 - apll, mpll, epll, vpll); 1520 - 1521 - armclk = clk_get_rate(&exynos4_clk_armclk.clk); 1522 - sclk_dmc = clk_get_rate(&exynos4_clk_sclk_dmc.clk); 1523 - 1524 - aclk_200 = clk_get_rate(&exynos4_clk_aclk_200.clk); 1525 - aclk_100 = clk_get_rate(&exynos4_clk_aclk_100.clk); 1526 - aclk_160 = clk_get_rate(&exynos4_clk_aclk_160.clk); 1527 - aclk_133 = clk_get_rate(&exynos4_clk_aclk_133.clk); 1528 - 1529 - printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n" 1530 - "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n", 1531 - armclk, sclk_dmc, aclk_200, 1532 - aclk_100, aclk_160, aclk_133); 1533 - 1534 - clk_f.rate = armclk; 1535 - clk_h.rate = sclk_dmc; 1536 - clk_p.rate = aclk_100; 1537 - 1538 - for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrcs); ptr++) 1539 - s3c_set_clksrc(&exynos4_clksrcs[ptr], true); 1540 - } 1541 - 1542 - static struct clk *exynos4_clks[] __initdata = { 1543 - &exynos4_clk_sclk_hdmi27m, 1544 - &exynos4_clk_sclk_hdmiphy, 1545 - &exynos4_clk_sclk_usbphy0, 1546 - &exynos4_clk_sclk_usbphy1, 1547 - }; 1548 - 1549 - #ifdef CONFIG_PM_SLEEP 1550 - static int exynos4_clock_suspend(void) 1551 - { 1552 - s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save)); 1553 - return 0; 1554 - } 1555 - 1556 - static void exynos4_clock_resume(void) 1557 - { 1558 - s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save)); 1559 - } 1560 - 1561 - #else 1562 - #define exynos4_clock_suspend NULL 1563 - #define exynos4_clock_resume NULL 1564 - #endif 1565 - 1566 - static struct syscore_ops exynos4_clock_syscore_ops = { 1567 - .suspend = exynos4_clock_suspend, 1568 - .resume = exynos4_clock_resume, 1569 - }; 1570 - 1571 - void __init exynos4_register_clocks(void) 1572 - { 1573 - int ptr; 1574 - 1575 - s3c24xx_register_clocks(exynos4_clks, ARRAY_SIZE(exynos4_clks)); 1576 - 1577 - for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sysclks); ptr++) 1578 - s3c_register_clksrc(exynos4_sysclks[ptr], 1); 1579 - 1580 - for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sclk_tv); ptr++) 1581 - s3c_register_clksrc(exynos4_sclk_tv[ptr], 1); 1582 - 1583 - for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrc_cdev); ptr++) 1584 - s3c_register_clksrc(exynos4_clksrc_cdev[ptr], 1); 1585 - 1586 - s3c_register_clksrc(exynos4_clksrcs, ARRAY_SIZE(exynos4_clksrcs)); 1587 - s3c_register_clocks(exynos4_init_clocks_on, ARRAY_SIZE(exynos4_init_clocks_on)); 1588 - 1589 - s3c24xx_register_clocks(exynos4_clk_cdev, ARRAY_SIZE(exynos4_clk_cdev)); 1590 - for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clk_cdev); ptr++) 1591 - s3c_disable_clocks(exynos4_clk_cdev[ptr], 1); 1592 - 1593 - s3c_register_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off)); 1594 - s3c_disable_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off)); 1595 - clkdev_add_table(exynos4_clk_lookup, ARRAY_SIZE(exynos4_clk_lookup)); 1596 - 1597 - register_syscore_ops(&exynos4_clock_syscore_ops); 1598 - s3c24xx_register_clock(&dummy_apb_pclk); 1599 - 1600 - s3c_pwmclk_init(); 1601 - }
-35
arch/arm/mach-exynos/clock-exynos4.h
··· 1 - /* 2 - * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd. 3 - * http://www.samsung.com 4 - * 5 - * Header file for exynos4 clock support 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 - */ 11 - 12 - #ifndef __ASM_ARCH_CLOCK_H 13 - #define __ASM_ARCH_CLOCK_H __FILE__ 14 - 15 - #include <linux/clk.h> 16 - 17 - extern struct clksrc_clk exynos4_clk_aclk_133; 18 - extern struct clksrc_clk exynos4_clk_mout_mpll; 19 - 20 - extern struct clksrc_sources exynos4_clkset_mout_corebus; 21 - extern struct clksrc_sources exynos4_clkset_group; 22 - 23 - extern struct clk *exynos4_clkset_aclk_top_list[]; 24 - extern struct clk *exynos4_clkset_group_list[]; 25 - 26 - extern struct clksrc_sources exynos4_clkset_mout_g2d0; 27 - extern struct clksrc_sources exynos4_clkset_mout_g2d1; 28 - 29 - extern int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable); 30 - extern int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable); 31 - extern int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable); 32 - extern int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable); 33 - extern int exynos4_clk_ip_dmc_ctrl(struct clk *clk, int enable); 34 - 35 - #endif /* __ASM_ARCH_CLOCK_H */
-187
arch/arm/mach-exynos/clock-exynos4210.c
··· 1 - /* 2 - * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd. 3 - * http://www.samsung.com 4 - * 5 - * EXYNOS4210 - Clock support 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 - */ 11 - 12 - #include <linux/kernel.h> 13 - #include <linux/err.h> 14 - #include <linux/clk.h> 15 - #include <linux/io.h> 16 - #include <linux/syscore_ops.h> 17 - 18 - #include <plat/cpu-freq.h> 19 - #include <plat/clock.h> 20 - #include <plat/cpu.h> 21 - #include <plat/pll.h> 22 - #include <plat/s5p-clock.h> 23 - #include <plat/clock-clksrc.h> 24 - #include <plat/pm.h> 25 - 26 - #include <mach/hardware.h> 27 - #include <mach/map.h> 28 - #include <mach/regs-clock.h> 29 - 30 - #include "common.h" 31 - #include "clock-exynos4.h" 32 - 33 - #ifdef CONFIG_PM_SLEEP 34 - static struct sleep_save exynos4210_clock_save[] = { 35 - SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE), 36 - SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE), 37 - SAVE_ITEM(EXYNOS4210_CLKSRC_LCD1), 38 - SAVE_ITEM(EXYNOS4210_CLKDIV_LCD1), 39 - SAVE_ITEM(EXYNOS4210_CLKSRC_MASK_LCD1), 40 - SAVE_ITEM(EXYNOS4210_CLKGATE_IP_IMAGE), 41 - SAVE_ITEM(EXYNOS4210_CLKGATE_IP_LCD1), 42 - SAVE_ITEM(EXYNOS4210_CLKGATE_IP_PERIR), 43 - }; 44 - #endif 45 - 46 - static struct clksrc_clk *sysclks[] = { 47 - /* nothing here yet */ 48 - }; 49 - 50 - static struct clksrc_clk exynos4210_clk_mout_g2d0 = { 51 - .clk = { 52 - .name = "mout_g2d0", 53 - }, 54 - .sources = &exynos4_clkset_mout_g2d0, 55 - .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 0, .size = 1 }, 56 - }; 57 - 58 - static struct clksrc_clk exynos4210_clk_mout_g2d1 = { 59 - .clk = { 60 - .name = "mout_g2d1", 61 - }, 62 - .sources = &exynos4_clkset_mout_g2d1, 63 - .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 4, .size = 1 }, 64 - }; 65 - 66 - static struct clk *exynos4210_clkset_mout_g2d_list[] = { 67 - [0] = &exynos4210_clk_mout_g2d0.clk, 68 - [1] = &exynos4210_clk_mout_g2d1.clk, 69 - }; 70 - 71 - static struct clksrc_sources exynos4210_clkset_mout_g2d = { 72 - .sources = exynos4210_clkset_mout_g2d_list, 73 - .nr_sources = ARRAY_SIZE(exynos4210_clkset_mout_g2d_list), 74 - }; 75 - 76 - static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable) 77 - { 78 - return s5p_gatectrl(EXYNOS4210_CLKSRC_MASK_LCD1, clk, enable); 79 - } 80 - 81 - static struct clksrc_clk clksrcs[] = { 82 - { 83 - .clk = { 84 - .name = "sclk_sata", 85 - .id = -1, 86 - .enable = exynos4_clksrc_mask_fsys_ctrl, 87 - .ctrlbit = (1 << 24), 88 - }, 89 - .sources = &exynos4_clkset_mout_corebus, 90 - .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 24, .size = 1 }, 91 - .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS0, .shift = 20, .size = 4 }, 92 - }, { 93 - .clk = { 94 - .name = "sclk_fimd", 95 - .devname = "exynos4-fb.1", 96 - .enable = exynos4_clksrc_mask_lcd1_ctrl, 97 - .ctrlbit = (1 << 0), 98 - }, 99 - .sources = &exynos4_clkset_group, 100 - .reg_src = { .reg = EXYNOS4210_CLKSRC_LCD1, .shift = 0, .size = 4 }, 101 - .reg_div = { .reg = EXYNOS4210_CLKDIV_LCD1, .shift = 0, .size = 4 }, 102 - }, { 103 - .clk = { 104 - .name = "sclk_fimg2d", 105 - }, 106 - .sources = &exynos4210_clkset_mout_g2d, 107 - .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 8, .size = 1 }, 108 - .reg_div = { .reg = EXYNOS4_CLKDIV_IMAGE, .shift = 0, .size = 4 }, 109 - }, 110 - }; 111 - 112 - static struct clk init_clocks_off[] = { 113 - { 114 - .name = "sataphy", 115 - .id = -1, 116 - .parent = &exynos4_clk_aclk_133.clk, 117 - .enable = exynos4_clk_ip_fsys_ctrl, 118 - .ctrlbit = (1 << 3), 119 - }, { 120 - .name = "sata", 121 - .id = -1, 122 - .parent = &exynos4_clk_aclk_133.clk, 123 - .enable = exynos4_clk_ip_fsys_ctrl, 124 - .ctrlbit = (1 << 10), 125 - }, { 126 - .name = "fimd", 127 - .devname = "exynos4-fb.1", 128 - .enable = exynos4_clk_ip_lcd1_ctrl, 129 - .ctrlbit = (1 << 0), 130 - }, { 131 - .name = "sysmmu", 132 - .devname = "exynos-sysmmu.9", 133 - .enable = exynos4_clk_ip_image_ctrl, 134 - .ctrlbit = (1 << 3), 135 - }, { 136 - .name = "sysmmu", 137 - .devname = "exynos-sysmmu.11", 138 - .enable = exynos4_clk_ip_lcd1_ctrl, 139 - .ctrlbit = (1 << 4), 140 - }, { 141 - .name = "fimg2d", 142 - .enable = exynos4_clk_ip_image_ctrl, 143 - .ctrlbit = (1 << 0), 144 - }, 145 - }; 146 - 147 - #ifdef CONFIG_PM_SLEEP 148 - static int exynos4210_clock_suspend(void) 149 - { 150 - s3c_pm_do_save(exynos4210_clock_save, ARRAY_SIZE(exynos4210_clock_save)); 151 - 152 - return 0; 153 - } 154 - 155 - static void exynos4210_clock_resume(void) 156 - { 157 - s3c_pm_do_restore_core(exynos4210_clock_save, ARRAY_SIZE(exynos4210_clock_save)); 158 - } 159 - 160 - #else 161 - #define exynos4210_clock_suspend NULL 162 - #define exynos4210_clock_resume NULL 163 - #endif 164 - 165 - static struct syscore_ops exynos4210_clock_syscore_ops = { 166 - .suspend = exynos4210_clock_suspend, 167 - .resume = exynos4210_clock_resume, 168 - }; 169 - 170 - void __init exynos4210_register_clocks(void) 171 - { 172 - int ptr; 173 - 174 - exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_CPU; 175 - exynos4_clk_mout_mpll.reg_src.shift = 8; 176 - exynos4_clk_mout_mpll.reg_src.size = 1; 177 - 178 - for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) 179 - s3c_register_clksrc(sysclks[ptr], 1); 180 - 181 - s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); 182 - 183 - s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); 184 - s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); 185 - 186 - register_syscore_ops(&exynos4210_clock_syscore_ops); 187 - }
-201
arch/arm/mach-exynos/clock-exynos4212.c
··· 1 - /* 2 - * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd. 3 - * http://www.samsung.com 4 - * 5 - * EXYNOS4212 - Clock support 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 - */ 11 - 12 - #include <linux/kernel.h> 13 - #include <linux/err.h> 14 - #include <linux/clk.h> 15 - #include <linux/io.h> 16 - #include <linux/syscore_ops.h> 17 - 18 - #include <plat/cpu-freq.h> 19 - #include <plat/clock.h> 20 - #include <plat/cpu.h> 21 - #include <plat/pll.h> 22 - #include <plat/s5p-clock.h> 23 - #include <plat/clock-clksrc.h> 24 - #include <plat/pm.h> 25 - 26 - #include <mach/hardware.h> 27 - #include <mach/map.h> 28 - #include <mach/regs-clock.h> 29 - 30 - #include "common.h" 31 - #include "clock-exynos4.h" 32 - 33 - #ifdef CONFIG_PM_SLEEP 34 - static struct sleep_save exynos4212_clock_save[] = { 35 - SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE), 36 - SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE), 37 - SAVE_ITEM(EXYNOS4212_CLKGATE_IP_IMAGE), 38 - SAVE_ITEM(EXYNOS4212_CLKGATE_IP_PERIR), 39 - }; 40 - #endif 41 - 42 - static int exynos4212_clk_ip_isp0_ctrl(struct clk *clk, int enable) 43 - { 44 - return s5p_gatectrl(EXYNOS4_CLKGATE_IP_ISP0, clk, enable); 45 - } 46 - 47 - static int exynos4212_clk_ip_isp1_ctrl(struct clk *clk, int enable) 48 - { 49 - return s5p_gatectrl(EXYNOS4_CLKGATE_IP_ISP1, clk, enable); 50 - } 51 - 52 - static struct clk *clk_src_mpll_user_list[] = { 53 - [0] = &clk_fin_mpll, 54 - [1] = &exynos4_clk_mout_mpll.clk, 55 - }; 56 - 57 - static struct clksrc_sources clk_src_mpll_user = { 58 - .sources = clk_src_mpll_user_list, 59 - .nr_sources = ARRAY_SIZE(clk_src_mpll_user_list), 60 - }; 61 - 62 - static struct clksrc_clk clk_mout_mpll_user = { 63 - .clk = { 64 - .name = "mout_mpll_user", 65 - }, 66 - .sources = &clk_src_mpll_user, 67 - .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 24, .size = 1 }, 68 - }; 69 - 70 - static struct clksrc_clk exynos4x12_clk_mout_g2d0 = { 71 - .clk = { 72 - .name = "mout_g2d0", 73 - }, 74 - .sources = &exynos4_clkset_mout_g2d0, 75 - .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 20, .size = 1 }, 76 - }; 77 - 78 - static struct clksrc_clk exynos4x12_clk_mout_g2d1 = { 79 - .clk = { 80 - .name = "mout_g2d1", 81 - }, 82 - .sources = &exynos4_clkset_mout_g2d1, 83 - .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 24, .size = 1 }, 84 - }; 85 - 86 - static struct clk *exynos4x12_clkset_mout_g2d_list[] = { 87 - [0] = &exynos4x12_clk_mout_g2d0.clk, 88 - [1] = &exynos4x12_clk_mout_g2d1.clk, 89 - }; 90 - 91 - static struct clksrc_sources exynos4x12_clkset_mout_g2d = { 92 - .sources = exynos4x12_clkset_mout_g2d_list, 93 - .nr_sources = ARRAY_SIZE(exynos4x12_clkset_mout_g2d_list), 94 - }; 95 - 96 - static struct clksrc_clk *sysclks[] = { 97 - &clk_mout_mpll_user, 98 - }; 99 - 100 - static struct clksrc_clk clksrcs[] = { 101 - { 102 - .clk = { 103 - .name = "sclk_fimg2d", 104 - }, 105 - .sources = &exynos4x12_clkset_mout_g2d, 106 - .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 28, .size = 1 }, 107 - .reg_div = { .reg = EXYNOS4_CLKDIV_DMC1, .shift = 0, .size = 4 }, 108 - }, 109 - }; 110 - 111 - static struct clk init_clocks_off[] = { 112 - { 113 - .name = "sysmmu", 114 - .devname = "exynos-sysmmu.9", 115 - .enable = exynos4_clk_ip_dmc_ctrl, 116 - .ctrlbit = (1 << 24), 117 - }, { 118 - .name = "sysmmu", 119 - .devname = "exynos-sysmmu.12", 120 - .enable = exynos4212_clk_ip_isp0_ctrl, 121 - .ctrlbit = (7 << 8), 122 - }, { 123 - .name = "sysmmu", 124 - .devname = "exynos-sysmmu.13", 125 - .enable = exynos4212_clk_ip_isp1_ctrl, 126 - .ctrlbit = (1 << 4), 127 - }, { 128 - .name = "sysmmu", 129 - .devname = "exynos-sysmmu.14", 130 - .enable = exynos4212_clk_ip_isp0_ctrl, 131 - .ctrlbit = (1 << 11), 132 - }, { 133 - .name = "sysmmu", 134 - .devname = "exynos-sysmmu.15", 135 - .enable = exynos4212_clk_ip_isp0_ctrl, 136 - .ctrlbit = (1 << 12), 137 - }, { 138 - .name = "flite", 139 - .devname = "exynos-fimc-lite.0", 140 - .enable = exynos4212_clk_ip_isp0_ctrl, 141 - .ctrlbit = (1 << 4), 142 - }, { 143 - .name = "flite", 144 - .devname = "exynos-fimc-lite.1", 145 - .enable = exynos4212_clk_ip_isp0_ctrl, 146 - .ctrlbit = (1 << 3), 147 - }, { 148 - .name = "fimg2d", 149 - .enable = exynos4_clk_ip_dmc_ctrl, 150 - .ctrlbit = (1 << 23), 151 - }, 152 - }; 153 - 154 - #ifdef CONFIG_PM_SLEEP 155 - static int exynos4212_clock_suspend(void) 156 - { 157 - s3c_pm_do_save(exynos4212_clock_save, ARRAY_SIZE(exynos4212_clock_save)); 158 - 159 - return 0; 160 - } 161 - 162 - static void exynos4212_clock_resume(void) 163 - { 164 - s3c_pm_do_restore_core(exynos4212_clock_save, ARRAY_SIZE(exynos4212_clock_save)); 165 - } 166 - 167 - #else 168 - #define exynos4212_clock_suspend NULL 169 - #define exynos4212_clock_resume NULL 170 - #endif 171 - 172 - static struct syscore_ops exynos4212_clock_syscore_ops = { 173 - .suspend = exynos4212_clock_suspend, 174 - .resume = exynos4212_clock_resume, 175 - }; 176 - 177 - void __init exynos4212_register_clocks(void) 178 - { 179 - int ptr; 180 - 181 - /* usbphy1 is removed */ 182 - exynos4_clkset_group_list[4] = NULL; 183 - 184 - /* mout_mpll_user is used */ 185 - exynos4_clkset_group_list[6] = &clk_mout_mpll_user.clk; 186 - exynos4_clkset_aclk_top_list[0] = &clk_mout_mpll_user.clk; 187 - 188 - exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_DMC; 189 - exynos4_clk_mout_mpll.reg_src.shift = 12; 190 - exynos4_clk_mout_mpll.reg_src.size = 1; 191 - 192 - for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) 193 - s3c_register_clksrc(sysclks[ptr], 1); 194 - 195 - s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); 196 - 197 - s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); 198 - s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); 199 - 200 - register_syscore_ops(&exynos4212_clock_syscore_ops); 201 - }
-1645
arch/arm/mach-exynos/clock-exynos5.c
··· 1 - /* 2 - * Copyright (c) 2012 Samsung Electronics Co., Ltd. 3 - * http://www.samsung.com 4 - * 5 - * Clock support for EXYNOS5 SoCs 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 - */ 11 - 12 - #include <linux/kernel.h> 13 - #include <linux/err.h> 14 - #include <linux/io.h> 15 - #include <linux/syscore_ops.h> 16 - 17 - #include <plat/cpu-freq.h> 18 - #include <plat/clock.h> 19 - #include <plat/cpu.h> 20 - #include <plat/pll.h> 21 - #include <plat/s5p-clock.h> 22 - #include <plat/clock-clksrc.h> 23 - #include <plat/pm.h> 24 - 25 - #include <mach/map.h> 26 - #include <mach/regs-clock.h> 27 - 28 - #include "common.h" 29 - 30 - #ifdef CONFIG_PM_SLEEP 31 - static struct sleep_save exynos5_clock_save[] = { 32 - SAVE_ITEM(EXYNOS5_CLKSRC_MASK_TOP), 33 - SAVE_ITEM(EXYNOS5_CLKSRC_MASK_GSCL), 34 - SAVE_ITEM(EXYNOS5_CLKSRC_MASK_DISP1_0), 35 - SAVE_ITEM(EXYNOS5_CLKSRC_MASK_FSYS), 36 - SAVE_ITEM(EXYNOS5_CLKSRC_MASK_MAUDIO), 37 - SAVE_ITEM(EXYNOS5_CLKSRC_MASK_PERIC0), 38 - SAVE_ITEM(EXYNOS5_CLKSRC_MASK_PERIC1), 39 - SAVE_ITEM(EXYNOS5_CLKGATE_IP_GSCL), 40 - SAVE_ITEM(EXYNOS5_CLKGATE_IP_DISP1), 41 - SAVE_ITEM(EXYNOS5_CLKGATE_IP_MFC), 42 - SAVE_ITEM(EXYNOS5_CLKGATE_IP_G3D), 43 - SAVE_ITEM(EXYNOS5_CLKGATE_IP_GEN), 44 - SAVE_ITEM(EXYNOS5_CLKGATE_IP_FSYS), 45 - SAVE_ITEM(EXYNOS5_CLKGATE_IP_PERIC), 46 - SAVE_ITEM(EXYNOS5_CLKGATE_IP_PERIS), 47 - SAVE_ITEM(EXYNOS5_CLKGATE_BLOCK), 48 - SAVE_ITEM(EXYNOS5_CLKDIV_TOP0), 49 - SAVE_ITEM(EXYNOS5_CLKDIV_TOP1), 50 - SAVE_ITEM(EXYNOS5_CLKDIV_GSCL), 51 - SAVE_ITEM(EXYNOS5_CLKDIV_DISP1_0), 52 - SAVE_ITEM(EXYNOS5_CLKDIV_GEN), 53 - SAVE_ITEM(EXYNOS5_CLKDIV_MAUDIO), 54 - SAVE_ITEM(EXYNOS5_CLKDIV_FSYS0), 55 - SAVE_ITEM(EXYNOS5_CLKDIV_FSYS1), 56 - SAVE_ITEM(EXYNOS5_CLKDIV_FSYS2), 57 - SAVE_ITEM(EXYNOS5_CLKDIV_FSYS3), 58 - SAVE_ITEM(EXYNOS5_CLKDIV_PERIC0), 59 - SAVE_ITEM(EXYNOS5_CLKDIV_PERIC1), 60 - SAVE_ITEM(EXYNOS5_CLKDIV_PERIC2), 61 - SAVE_ITEM(EXYNOS5_CLKDIV_PERIC3), 62 - SAVE_ITEM(EXYNOS5_CLKDIV_PERIC4), 63 - SAVE_ITEM(EXYNOS5_CLKDIV_PERIC5), 64 - SAVE_ITEM(EXYNOS5_SCLK_DIV_ISP), 65 - SAVE_ITEM(EXYNOS5_CLKSRC_TOP0), 66 - SAVE_ITEM(EXYNOS5_CLKSRC_TOP1), 67 - SAVE_ITEM(EXYNOS5_CLKSRC_TOP2), 68 - SAVE_ITEM(EXYNOS5_CLKSRC_TOP3), 69 - SAVE_ITEM(EXYNOS5_CLKSRC_GSCL), 70 - SAVE_ITEM(EXYNOS5_CLKSRC_DISP1_0), 71 - SAVE_ITEM(EXYNOS5_CLKSRC_MAUDIO), 72 - SAVE_ITEM(EXYNOS5_CLKSRC_FSYS), 73 - SAVE_ITEM(EXYNOS5_CLKSRC_PERIC0), 74 - SAVE_ITEM(EXYNOS5_CLKSRC_PERIC1), 75 - SAVE_ITEM(EXYNOS5_SCLK_SRC_ISP), 76 - SAVE_ITEM(EXYNOS5_EPLL_CON0), 77 - SAVE_ITEM(EXYNOS5_EPLL_CON1), 78 - SAVE_ITEM(EXYNOS5_EPLL_CON2), 79 - SAVE_ITEM(EXYNOS5_VPLL_CON0), 80 - SAVE_ITEM(EXYNOS5_VPLL_CON1), 81 - SAVE_ITEM(EXYNOS5_VPLL_CON2), 82 - SAVE_ITEM(EXYNOS5_PWR_CTRL1), 83 - SAVE_ITEM(EXYNOS5_PWR_CTRL2), 84 - }; 85 - #endif 86 - 87 - static struct clk exynos5_clk_sclk_dptxphy = { 88 - .name = "sclk_dptx", 89 - }; 90 - 91 - static struct clk exynos5_clk_sclk_hdmi24m = { 92 - .name = "sclk_hdmi24m", 93 - .rate = 24000000, 94 - }; 95 - 96 - static struct clk exynos5_clk_sclk_hdmi27m = { 97 - .name = "sclk_hdmi27m", 98 - .rate = 27000000, 99 - }; 100 - 101 - static struct clk exynos5_clk_sclk_hdmiphy = { 102 - .name = "sclk_hdmiphy", 103 - }; 104 - 105 - static struct clk exynos5_clk_sclk_usbphy = { 106 - .name = "sclk_usbphy", 107 - .rate = 48000000, 108 - }; 109 - 110 - static int exynos5_clksrc_mask_top_ctrl(struct clk *clk, int enable) 111 - { 112 - return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_TOP, clk, enable); 113 - } 114 - 115 - static int exynos5_clksrc_mask_disp1_0_ctrl(struct clk *clk, int enable) 116 - { 117 - return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_DISP1_0, clk, enable); 118 - } 119 - 120 - static int exynos5_clksrc_mask_fsys_ctrl(struct clk *clk, int enable) 121 - { 122 - return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_FSYS, clk, enable); 123 - } 124 - 125 - static int exynos5_clksrc_mask_gscl_ctrl(struct clk *clk, int enable) 126 - { 127 - return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_GSCL, clk, enable); 128 - } 129 - 130 - static int exynos5_clksrc_mask_peric0_ctrl(struct clk *clk, int enable) 131 - { 132 - return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC0, clk, enable); 133 - } 134 - 135 - static int exynos5_clksrc_mask_peric1_ctrl(struct clk *clk, int enable) 136 - { 137 - return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC1, clk, enable); 138 - } 139 - 140 - static int exynos5_clk_ip_acp_ctrl(struct clk *clk, int enable) 141 - { 142 - return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ACP, clk, enable); 143 - } 144 - 145 - static int exynos5_clk_ip_core_ctrl(struct clk *clk, int enable) 146 - { 147 - return s5p_gatectrl(EXYNOS5_CLKGATE_IP_CORE, clk, enable); 148 - } 149 - 150 - static int exynos5_clk_ip_disp1_ctrl(struct clk *clk, int enable) 151 - { 152 - return s5p_gatectrl(EXYNOS5_CLKGATE_IP_DISP1, clk, enable); 153 - } 154 - 155 - static int exynos5_clk_ip_fsys_ctrl(struct clk *clk, int enable) 156 - { 157 - return s5p_gatectrl(EXYNOS5_CLKGATE_IP_FSYS, clk, enable); 158 - } 159 - 160 - static int exynos5_clk_block_ctrl(struct clk *clk, int enable) 161 - { 162 - return s5p_gatectrl(EXYNOS5_CLKGATE_BLOCK, clk, enable); 163 - } 164 - 165 - static int exynos5_clk_ip_gen_ctrl(struct clk *clk, int enable) 166 - { 167 - return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GEN, clk, enable); 168 - } 169 - 170 - static int exynos5_clk_ip_mfc_ctrl(struct clk *clk, int enable) 171 - { 172 - return s5p_gatectrl(EXYNOS5_CLKGATE_IP_MFC, clk, enable); 173 - } 174 - 175 - static int exynos5_clk_ip_peric_ctrl(struct clk *clk, int enable) 176 - { 177 - return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIC, clk, enable); 178 - } 179 - 180 - static int exynos5_clk_ip_peris_ctrl(struct clk *clk, int enable) 181 - { 182 - return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIS, clk, enable); 183 - } 184 - 185 - static int exynos5_clk_ip_gscl_ctrl(struct clk *clk, int enable) 186 - { 187 - return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GSCL, clk, enable); 188 - } 189 - 190 - static int exynos5_clk_ip_isp0_ctrl(struct clk *clk, int enable) 191 - { 192 - return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ISP0, clk, enable); 193 - } 194 - 195 - static int exynos5_clk_ip_isp1_ctrl(struct clk *clk, int enable) 196 - { 197 - return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ISP1, clk, enable); 198 - } 199 - 200 - static int exynos5_clk_hdmiphy_ctrl(struct clk *clk, int enable) 201 - { 202 - return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable); 203 - } 204 - 205 - /* Core list of CMU_CPU side */ 206 - 207 - static struct clksrc_clk exynos5_clk_mout_apll = { 208 - .clk = { 209 - .name = "mout_apll", 210 - }, 211 - .sources = &clk_src_apll, 212 - .reg_src = { .reg = EXYNOS5_CLKSRC_CPU, .shift = 0, .size = 1 }, 213 - }; 214 - 215 - static struct clksrc_clk exynos5_clk_sclk_apll = { 216 - .clk = { 217 - .name = "sclk_apll", 218 - .parent = &exynos5_clk_mout_apll.clk, 219 - }, 220 - .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 24, .size = 3 }, 221 - }; 222 - 223 - static struct clksrc_clk exynos5_clk_mout_bpll_fout = { 224 - .clk = { 225 - .name = "mout_bpll_fout", 226 - }, 227 - .sources = &clk_src_bpll_fout, 228 - .reg_src = { .reg = EXYNOS5_PLL_DIV2_SEL, .shift = 0, .size = 1 }, 229 - }; 230 - 231 - static struct clk *exynos5_clk_src_bpll_list[] = { 232 - [0] = &clk_fin_bpll, 233 - [1] = &exynos5_clk_mout_bpll_fout.clk, 234 - }; 235 - 236 - static struct clksrc_sources exynos5_clk_src_bpll = { 237 - .sources = exynos5_clk_src_bpll_list, 238 - .nr_sources = ARRAY_SIZE(exynos5_clk_src_bpll_list), 239 - }; 240 - 241 - static struct clksrc_clk exynos5_clk_mout_bpll = { 242 - .clk = { 243 - .name = "mout_bpll", 244 - }, 245 - .sources = &exynos5_clk_src_bpll, 246 - .reg_src = { .reg = EXYNOS5_CLKSRC_CDREX, .shift = 0, .size = 1 }, 247 - }; 248 - 249 - static struct clk *exynos5_clk_src_bpll_user_list[] = { 250 - [0] = &clk_fin_mpll, 251 - [1] = &exynos5_clk_mout_bpll.clk, 252 - }; 253 - 254 - static struct clksrc_sources exynos5_clk_src_bpll_user = { 255 - .sources = exynos5_clk_src_bpll_user_list, 256 - .nr_sources = ARRAY_SIZE(exynos5_clk_src_bpll_user_list), 257 - }; 258 - 259 - static struct clksrc_clk exynos5_clk_mout_bpll_user = { 260 - .clk = { 261 - .name = "mout_bpll_user", 262 - }, 263 - .sources = &exynos5_clk_src_bpll_user, 264 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 24, .size = 1 }, 265 - }; 266 - 267 - static struct clksrc_clk exynos5_clk_mout_cpll = { 268 - .clk = { 269 - .name = "mout_cpll", 270 - }, 271 - .sources = &clk_src_cpll, 272 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 8, .size = 1 }, 273 - }; 274 - 275 - static struct clksrc_clk exynos5_clk_mout_epll = { 276 - .clk = { 277 - .name = "mout_epll", 278 - }, 279 - .sources = &clk_src_epll, 280 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 12, .size = 1 }, 281 - }; 282 - 283 - static struct clksrc_clk exynos5_clk_mout_mpll_fout = { 284 - .clk = { 285 - .name = "mout_mpll_fout", 286 - }, 287 - .sources = &clk_src_mpll_fout, 288 - .reg_src = { .reg = EXYNOS5_PLL_DIV2_SEL, .shift = 4, .size = 1 }, 289 - }; 290 - 291 - static struct clk *exynos5_clk_src_mpll_list[] = { 292 - [0] = &clk_fin_mpll, 293 - [1] = &exynos5_clk_mout_mpll_fout.clk, 294 - }; 295 - 296 - static struct clksrc_sources exynos5_clk_src_mpll = { 297 - .sources = exynos5_clk_src_mpll_list, 298 - .nr_sources = ARRAY_SIZE(exynos5_clk_src_mpll_list), 299 - }; 300 - 301 - static struct clksrc_clk exynos5_clk_mout_mpll = { 302 - .clk = { 303 - .name = "mout_mpll", 304 - }, 305 - .sources = &exynos5_clk_src_mpll, 306 - .reg_src = { .reg = EXYNOS5_CLKSRC_CORE1, .shift = 8, .size = 1 }, 307 - }; 308 - 309 - static struct clk *exynos_clkset_vpllsrc_list[] = { 310 - [0] = &clk_fin_vpll, 311 - [1] = &exynos5_clk_sclk_hdmi27m, 312 - }; 313 - 314 - static struct clksrc_sources exynos5_clkset_vpllsrc = { 315 - .sources = exynos_clkset_vpllsrc_list, 316 - .nr_sources = ARRAY_SIZE(exynos_clkset_vpllsrc_list), 317 - }; 318 - 319 - static struct clksrc_clk exynos5_clk_vpllsrc = { 320 - .clk = { 321 - .name = "vpll_src", 322 - .enable = exynos5_clksrc_mask_top_ctrl, 323 - .ctrlbit = (1 << 0), 324 - }, 325 - .sources = &exynos5_clkset_vpllsrc, 326 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 0, .size = 1 }, 327 - }; 328 - 329 - static struct clk *exynos5_clkset_sclk_vpll_list[] = { 330 - [0] = &exynos5_clk_vpllsrc.clk, 331 - [1] = &clk_fout_vpll, 332 - }; 333 - 334 - static struct clksrc_sources exynos5_clkset_sclk_vpll = { 335 - .sources = exynos5_clkset_sclk_vpll_list, 336 - .nr_sources = ARRAY_SIZE(exynos5_clkset_sclk_vpll_list), 337 - }; 338 - 339 - static struct clksrc_clk exynos5_clk_sclk_vpll = { 340 - .clk = { 341 - .name = "sclk_vpll", 342 - }, 343 - .sources = &exynos5_clkset_sclk_vpll, 344 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 16, .size = 1 }, 345 - }; 346 - 347 - static struct clksrc_clk exynos5_clk_sclk_pixel = { 348 - .clk = { 349 - .name = "sclk_pixel", 350 - .parent = &exynos5_clk_sclk_vpll.clk, 351 - }, 352 - .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 28, .size = 4 }, 353 - }; 354 - 355 - static struct clk *exynos5_clkset_sclk_hdmi_list[] = { 356 - [0] = &exynos5_clk_sclk_pixel.clk, 357 - [1] = &exynos5_clk_sclk_hdmiphy, 358 - }; 359 - 360 - static struct clksrc_sources exynos5_clkset_sclk_hdmi = { 361 - .sources = exynos5_clkset_sclk_hdmi_list, 362 - .nr_sources = ARRAY_SIZE(exynos5_clkset_sclk_hdmi_list), 363 - }; 364 - 365 - static struct clksrc_clk exynos5_clk_sclk_hdmi = { 366 - .clk = { 367 - .name = "sclk_hdmi", 368 - .enable = exynos5_clksrc_mask_disp1_0_ctrl, 369 - .ctrlbit = (1 << 20), 370 - }, 371 - .sources = &exynos5_clkset_sclk_hdmi, 372 - .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 20, .size = 1 }, 373 - }; 374 - 375 - static struct clksrc_clk *exynos5_sclk_tv[] = { 376 - &exynos5_clk_sclk_pixel, 377 - &exynos5_clk_sclk_hdmi, 378 - }; 379 - 380 - static struct clk *exynos5_clk_src_mpll_user_list[] = { 381 - [0] = &clk_fin_mpll, 382 - [1] = &exynos5_clk_mout_mpll.clk, 383 - }; 384 - 385 - static struct clksrc_sources exynos5_clk_src_mpll_user = { 386 - .sources = exynos5_clk_src_mpll_user_list, 387 - .nr_sources = ARRAY_SIZE(exynos5_clk_src_mpll_user_list), 388 - }; 389 - 390 - static struct clksrc_clk exynos5_clk_mout_mpll_user = { 391 - .clk = { 392 - .name = "mout_mpll_user", 393 - }, 394 - .sources = &exynos5_clk_src_mpll_user, 395 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 20, .size = 1 }, 396 - }; 397 - 398 - static struct clk *exynos5_clkset_mout_cpu_list[] = { 399 - [0] = &exynos5_clk_mout_apll.clk, 400 - [1] = &exynos5_clk_mout_mpll.clk, 401 - }; 402 - 403 - static struct clksrc_sources exynos5_clkset_mout_cpu = { 404 - .sources = exynos5_clkset_mout_cpu_list, 405 - .nr_sources = ARRAY_SIZE(exynos5_clkset_mout_cpu_list), 406 - }; 407 - 408 - static struct clksrc_clk exynos5_clk_mout_cpu = { 409 - .clk = { 410 - .name = "mout_cpu", 411 - }, 412 - .sources = &exynos5_clkset_mout_cpu, 413 - .reg_src = { .reg = EXYNOS5_CLKSRC_CPU, .shift = 16, .size = 1 }, 414 - }; 415 - 416 - static struct clksrc_clk exynos5_clk_dout_armclk = { 417 - .clk = { 418 - .name = "dout_armclk", 419 - .parent = &exynos5_clk_mout_cpu.clk, 420 - }, 421 - .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 0, .size = 3 }, 422 - }; 423 - 424 - static struct clksrc_clk exynos5_clk_dout_arm2clk = { 425 - .clk = { 426 - .name = "dout_arm2clk", 427 - .parent = &exynos5_clk_dout_armclk.clk, 428 - }, 429 - .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 28, .size = 3 }, 430 - }; 431 - 432 - static struct clk exynos5_clk_armclk = { 433 - .name = "armclk", 434 - .parent = &exynos5_clk_dout_arm2clk.clk, 435 - }; 436 - 437 - /* Core list of CMU_CDREX side */ 438 - 439 - static struct clk *exynos5_clkset_cdrex_list[] = { 440 - [0] = &exynos5_clk_mout_mpll.clk, 441 - [1] = &exynos5_clk_mout_bpll.clk, 442 - }; 443 - 444 - static struct clksrc_sources exynos5_clkset_cdrex = { 445 - .sources = exynos5_clkset_cdrex_list, 446 - .nr_sources = ARRAY_SIZE(exynos5_clkset_cdrex_list), 447 - }; 448 - 449 - static struct clksrc_clk exynos5_clk_cdrex = { 450 - .clk = { 451 - .name = "clk_cdrex", 452 - }, 453 - .sources = &exynos5_clkset_cdrex, 454 - .reg_src = { .reg = EXYNOS5_CLKSRC_CDREX, .shift = 4, .size = 1 }, 455 - .reg_div = { .reg = EXYNOS5_CLKDIV_CDREX, .shift = 16, .size = 3 }, 456 - }; 457 - 458 - static struct clksrc_clk exynos5_clk_aclk_acp = { 459 - .clk = { 460 - .name = "aclk_acp", 461 - .parent = &exynos5_clk_mout_mpll.clk, 462 - }, 463 - .reg_div = { .reg = EXYNOS5_CLKDIV_ACP, .shift = 0, .size = 3 }, 464 - }; 465 - 466 - static struct clksrc_clk exynos5_clk_pclk_acp = { 467 - .clk = { 468 - .name = "pclk_acp", 469 - .parent = &exynos5_clk_aclk_acp.clk, 470 - }, 471 - .reg_div = { .reg = EXYNOS5_CLKDIV_ACP, .shift = 4, .size = 3 }, 472 - }; 473 - 474 - /* Core list of CMU_TOP side */ 475 - 476 - static struct clk *exynos5_clkset_aclk_top_list[] = { 477 - [0] = &exynos5_clk_mout_mpll_user.clk, 478 - [1] = &exynos5_clk_mout_bpll_user.clk, 479 - }; 480 - 481 - static struct clksrc_sources exynos5_clkset_aclk = { 482 - .sources = exynos5_clkset_aclk_top_list, 483 - .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_top_list), 484 - }; 485 - 486 - static struct clksrc_clk exynos5_clk_aclk_400 = { 487 - .clk = { 488 - .name = "aclk_400", 489 - }, 490 - .sources = &exynos5_clkset_aclk, 491 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 20, .size = 1 }, 492 - .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 }, 493 - }; 494 - 495 - static struct clk *exynos5_clkset_aclk_333_166_list[] = { 496 - [0] = &exynos5_clk_mout_cpll.clk, 497 - [1] = &exynos5_clk_mout_mpll_user.clk, 498 - }; 499 - 500 - static struct clksrc_sources exynos5_clkset_aclk_333_166 = { 501 - .sources = exynos5_clkset_aclk_333_166_list, 502 - .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_333_166_list), 503 - }; 504 - 505 - static struct clksrc_clk exynos5_clk_aclk_333 = { 506 - .clk = { 507 - .name = "aclk_333", 508 - }, 509 - .sources = &exynos5_clkset_aclk_333_166, 510 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 16, .size = 1 }, 511 - .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 20, .size = 3 }, 512 - }; 513 - 514 - static struct clksrc_clk exynos5_clk_aclk_166 = { 515 - .clk = { 516 - .name = "aclk_166", 517 - }, 518 - .sources = &exynos5_clkset_aclk_333_166, 519 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 8, .size = 1 }, 520 - .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 8, .size = 3 }, 521 - }; 522 - 523 - static struct clksrc_clk exynos5_clk_aclk_266 = { 524 - .clk = { 525 - .name = "aclk_266", 526 - .parent = &exynos5_clk_mout_mpll_user.clk, 527 - }, 528 - .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 16, .size = 3 }, 529 - }; 530 - 531 - static struct clksrc_clk exynos5_clk_aclk_200 = { 532 - .clk = { 533 - .name = "aclk_200", 534 - }, 535 - .sources = &exynos5_clkset_aclk, 536 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 12, .size = 1 }, 537 - .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 12, .size = 3 }, 538 - }; 539 - 540 - static struct clksrc_clk exynos5_clk_aclk_66_pre = { 541 - .clk = { 542 - .name = "aclk_66_pre", 543 - .parent = &exynos5_clk_mout_mpll_user.clk, 544 - }, 545 - .reg_div = { .reg = EXYNOS5_CLKDIV_TOP1, .shift = 24, .size = 3 }, 546 - }; 547 - 548 - static struct clksrc_clk exynos5_clk_aclk_66 = { 549 - .clk = { 550 - .name = "aclk_66", 551 - .parent = &exynos5_clk_aclk_66_pre.clk, 552 - }, 553 - .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 0, .size = 3 }, 554 - }; 555 - 556 - static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl_mid = { 557 - .clk = { 558 - .name = "mout_aclk_300_gscl_mid", 559 - }, 560 - .sources = &exynos5_clkset_aclk, 561 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 24, .size = 1 }, 562 - }; 563 - 564 - static struct clk *exynos5_clkset_aclk_300_mid1_list[] = { 565 - [0] = &exynos5_clk_sclk_vpll.clk, 566 - [1] = &exynos5_clk_mout_cpll.clk, 567 - }; 568 - 569 - static struct clksrc_sources exynos5_clkset_aclk_300_gscl_mid1 = { 570 - .sources = exynos5_clkset_aclk_300_mid1_list, 571 - .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_300_mid1_list), 572 - }; 573 - 574 - static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl_mid1 = { 575 - .clk = { 576 - .name = "mout_aclk_300_gscl_mid1", 577 - }, 578 - .sources = &exynos5_clkset_aclk_300_gscl_mid1, 579 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP1, .shift = 12, .size = 1 }, 580 - }; 581 - 582 - static struct clk *exynos5_clkset_aclk_300_gscl_list[] = { 583 - [0] = &exynos5_clk_mout_aclk_300_gscl_mid.clk, 584 - [1] = &exynos5_clk_mout_aclk_300_gscl_mid1.clk, 585 - }; 586 - 587 - static struct clksrc_sources exynos5_clkset_aclk_300_gscl = { 588 - .sources = exynos5_clkset_aclk_300_gscl_list, 589 - .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_300_gscl_list), 590 - }; 591 - 592 - static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl = { 593 - .clk = { 594 - .name = "mout_aclk_300_gscl", 595 - }, 596 - .sources = &exynos5_clkset_aclk_300_gscl, 597 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 25, .size = 1 }, 598 - }; 599 - 600 - static struct clk *exynos5_clk_src_gscl_300_list[] = { 601 - [0] = &clk_ext_xtal_mux, 602 - [1] = &exynos5_clk_mout_aclk_300_gscl.clk, 603 - }; 604 - 605 - static struct clksrc_sources exynos5_clk_src_gscl_300 = { 606 - .sources = exynos5_clk_src_gscl_300_list, 607 - .nr_sources = ARRAY_SIZE(exynos5_clk_src_gscl_300_list), 608 - }; 609 - 610 - static struct clksrc_clk exynos5_clk_aclk_300_gscl = { 611 - .clk = { 612 - .name = "aclk_300_gscl", 613 - }, 614 - .sources = &exynos5_clk_src_gscl_300, 615 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP3, .shift = 10, .size = 1 }, 616 - }; 617 - 618 - static struct clk exynos5_init_clocks_off[] = { 619 - { 620 - .name = "timers", 621 - .parent = &exynos5_clk_aclk_66.clk, 622 - .enable = exynos5_clk_ip_peric_ctrl, 623 - .ctrlbit = (1 << 24), 624 - }, { 625 - .name = "tmu_apbif", 626 - .parent = &exynos5_clk_aclk_66.clk, 627 - .enable = exynos5_clk_ip_peris_ctrl, 628 - .ctrlbit = (1 << 21), 629 - }, { 630 - .name = "rtc", 631 - .parent = &exynos5_clk_aclk_66.clk, 632 - .enable = exynos5_clk_ip_peris_ctrl, 633 - .ctrlbit = (1 << 20), 634 - }, { 635 - .name = "watchdog", 636 - .parent = &exynos5_clk_aclk_66.clk, 637 - .enable = exynos5_clk_ip_peris_ctrl, 638 - .ctrlbit = (1 << 19), 639 - }, { 640 - .name = "biu", /* bus interface unit clock */ 641 - .devname = "dw_mmc.0", 642 - .parent = &exynos5_clk_aclk_200.clk, 643 - .enable = exynos5_clk_ip_fsys_ctrl, 644 - .ctrlbit = (1 << 12), 645 - }, { 646 - .name = "biu", 647 - .devname = "dw_mmc.1", 648 - .parent = &exynos5_clk_aclk_200.clk, 649 - .enable = exynos5_clk_ip_fsys_ctrl, 650 - .ctrlbit = (1 << 13), 651 - }, { 652 - .name = "biu", 653 - .devname = "dw_mmc.2", 654 - .parent = &exynos5_clk_aclk_200.clk, 655 - .enable = exynos5_clk_ip_fsys_ctrl, 656 - .ctrlbit = (1 << 14), 657 - }, { 658 - .name = "biu", 659 - .devname = "dw_mmc.3", 660 - .parent = &exynos5_clk_aclk_200.clk, 661 - .enable = exynos5_clk_ip_fsys_ctrl, 662 - .ctrlbit = (1 << 15), 663 - }, { 664 - .name = "sata", 665 - .devname = "exynos5-sata", 666 - .parent = &exynos5_clk_aclk_200.clk, 667 - .enable = exynos5_clk_ip_fsys_ctrl, 668 - .ctrlbit = (1 << 6), 669 - }, { 670 - .name = "sata-phy", 671 - .devname = "exynos5-sata-phy", 672 - .parent = &exynos5_clk_aclk_200.clk, 673 - .enable = exynos5_clk_ip_fsys_ctrl, 674 - .ctrlbit = (1 << 24), 675 - }, { 676 - .name = "i2c", 677 - .devname = "exynos5-sata-phy-i2c", 678 - .parent = &exynos5_clk_aclk_200.clk, 679 - .enable = exynos5_clk_ip_fsys_ctrl, 680 - .ctrlbit = (1 << 25), 681 - }, { 682 - .name = "mfc", 683 - .devname = "s5p-mfc-v6", 684 - .enable = exynos5_clk_ip_mfc_ctrl, 685 - .ctrlbit = (1 << 0), 686 - }, { 687 - .name = "hdmi", 688 - .devname = "exynos5-hdmi", 689 - .enable = exynos5_clk_ip_disp1_ctrl, 690 - .ctrlbit = (1 << 6), 691 - }, { 692 - .name = "hdmiphy", 693 - .devname = "exynos5-hdmi", 694 - .enable = exynos5_clk_hdmiphy_ctrl, 695 - .ctrlbit = (1 << 0), 696 - }, { 697 - .name = "mixer", 698 - .devname = "exynos5-mixer", 699 - .enable = exynos5_clk_ip_disp1_ctrl, 700 - .ctrlbit = (1 << 5), 701 - }, { 702 - .name = "dp", 703 - .devname = "exynos-dp", 704 - .enable = exynos5_clk_ip_disp1_ctrl, 705 - .ctrlbit = (1 << 4), 706 - }, { 707 - .name = "jpeg", 708 - .enable = exynos5_clk_ip_gen_ctrl, 709 - .ctrlbit = (1 << 2), 710 - }, { 711 - .name = "dsim0", 712 - .enable = exynos5_clk_ip_disp1_ctrl, 713 - .ctrlbit = (1 << 3), 714 - }, { 715 - .name = "iis", 716 - .devname = "samsung-i2s.1", 717 - .enable = exynos5_clk_ip_peric_ctrl, 718 - .ctrlbit = (1 << 20), 719 - }, { 720 - .name = "iis", 721 - .devname = "samsung-i2s.2", 722 - .enable = exynos5_clk_ip_peric_ctrl, 723 - .ctrlbit = (1 << 21), 724 - }, { 725 - .name = "pcm", 726 - .devname = "samsung-pcm.1", 727 - .enable = exynos5_clk_ip_peric_ctrl, 728 - .ctrlbit = (1 << 22), 729 - }, { 730 - .name = "pcm", 731 - .devname = "samsung-pcm.2", 732 - .enable = exynos5_clk_ip_peric_ctrl, 733 - .ctrlbit = (1 << 23), 734 - }, { 735 - .name = "spdif", 736 - .devname = "samsung-spdif", 737 - .enable = exynos5_clk_ip_peric_ctrl, 738 - .ctrlbit = (1 << 26), 739 - }, { 740 - .name = "ac97", 741 - .devname = "samsung-ac97", 742 - .enable = exynos5_clk_ip_peric_ctrl, 743 - .ctrlbit = (1 << 27), 744 - }, { 745 - .name = "usbhost", 746 - .enable = exynos5_clk_ip_fsys_ctrl , 747 - .ctrlbit = (1 << 18), 748 - }, { 749 - .name = "usbotg", 750 - .enable = exynos5_clk_ip_fsys_ctrl, 751 - .ctrlbit = (1 << 7), 752 - }, { 753 - .name = "nfcon", 754 - .enable = exynos5_clk_ip_fsys_ctrl, 755 - .ctrlbit = (1 << 22), 756 - }, { 757 - .name = "iop", 758 - .enable = exynos5_clk_ip_fsys_ctrl, 759 - .ctrlbit = ((1 << 30) | (1 << 26) | (1 << 23)), 760 - }, { 761 - .name = "core_iop", 762 - .enable = exynos5_clk_ip_core_ctrl, 763 - .ctrlbit = ((1 << 21) | (1 << 3)), 764 - }, { 765 - .name = "mcu_iop", 766 - .enable = exynos5_clk_ip_fsys_ctrl, 767 - .ctrlbit = (1 << 0), 768 - }, { 769 - .name = "i2c", 770 - .devname = "s3c2440-i2c.0", 771 - .parent = &exynos5_clk_aclk_66.clk, 772 - .enable = exynos5_clk_ip_peric_ctrl, 773 - .ctrlbit = (1 << 6), 774 - }, { 775 - .name = "i2c", 776 - .devname = "s3c2440-i2c.1", 777 - .parent = &exynos5_clk_aclk_66.clk, 778 - .enable = exynos5_clk_ip_peric_ctrl, 779 - .ctrlbit = (1 << 7), 780 - }, { 781 - .name = "i2c", 782 - .devname = "s3c2440-i2c.2", 783 - .parent = &exynos5_clk_aclk_66.clk, 784 - .enable = exynos5_clk_ip_peric_ctrl, 785 - .ctrlbit = (1 << 8), 786 - }, { 787 - .name = "i2c", 788 - .devname = "s3c2440-i2c.3", 789 - .parent = &exynos5_clk_aclk_66.clk, 790 - .enable = exynos5_clk_ip_peric_ctrl, 791 - .ctrlbit = (1 << 9), 792 - }, { 793 - .name = "i2c", 794 - .devname = "s3c2440-i2c.4", 795 - .parent = &exynos5_clk_aclk_66.clk, 796 - .enable = exynos5_clk_ip_peric_ctrl, 797 - .ctrlbit = (1 << 10), 798 - }, { 799 - .name = "i2c", 800 - .devname = "s3c2440-i2c.5", 801 - .parent = &exynos5_clk_aclk_66.clk, 802 - .enable = exynos5_clk_ip_peric_ctrl, 803 - .ctrlbit = (1 << 11), 804 - }, { 805 - .name = "i2c", 806 - .devname = "s3c2440-i2c.6", 807 - .parent = &exynos5_clk_aclk_66.clk, 808 - .enable = exynos5_clk_ip_peric_ctrl, 809 - .ctrlbit = (1 << 12), 810 - }, { 811 - .name = "i2c", 812 - .devname = "s3c2440-i2c.7", 813 - .parent = &exynos5_clk_aclk_66.clk, 814 - .enable = exynos5_clk_ip_peric_ctrl, 815 - .ctrlbit = (1 << 13), 816 - }, { 817 - .name = "i2c", 818 - .devname = "s3c2440-hdmiphy-i2c", 819 - .parent = &exynos5_clk_aclk_66.clk, 820 - .enable = exynos5_clk_ip_peric_ctrl, 821 - .ctrlbit = (1 << 14), 822 - }, { 823 - .name = "spi", 824 - .devname = "exynos4210-spi.0", 825 - .parent = &exynos5_clk_aclk_66.clk, 826 - .enable = exynos5_clk_ip_peric_ctrl, 827 - .ctrlbit = (1 << 16), 828 - }, { 829 - .name = "spi", 830 - .devname = "exynos4210-spi.1", 831 - .parent = &exynos5_clk_aclk_66.clk, 832 - .enable = exynos5_clk_ip_peric_ctrl, 833 - .ctrlbit = (1 << 17), 834 - }, { 835 - .name = "spi", 836 - .devname = "exynos4210-spi.2", 837 - .parent = &exynos5_clk_aclk_66.clk, 838 - .enable = exynos5_clk_ip_peric_ctrl, 839 - .ctrlbit = (1 << 18), 840 - }, { 841 - .name = "gscl", 842 - .devname = "exynos-gsc.0", 843 - .enable = exynos5_clk_ip_gscl_ctrl, 844 - .ctrlbit = (1 << 0), 845 - }, { 846 - .name = "gscl", 847 - .devname = "exynos-gsc.1", 848 - .enable = exynos5_clk_ip_gscl_ctrl, 849 - .ctrlbit = (1 << 1), 850 - }, { 851 - .name = "gscl", 852 - .devname = "exynos-gsc.2", 853 - .enable = exynos5_clk_ip_gscl_ctrl, 854 - .ctrlbit = (1 << 2), 855 - }, { 856 - .name = "gscl", 857 - .devname = "exynos-gsc.3", 858 - .enable = exynos5_clk_ip_gscl_ctrl, 859 - .ctrlbit = (1 << 3), 860 - }, { 861 - .name = "sysmmu", 862 - .devname = "exynos-sysmmu.1", 863 - .enable = &exynos5_clk_ip_mfc_ctrl, 864 - .ctrlbit = (1 << 1), 865 - }, { 866 - .name = "sysmmu", 867 - .devname = "exynos-sysmmu.0", 868 - .enable = &exynos5_clk_ip_mfc_ctrl, 869 - .ctrlbit = (1 << 2), 870 - }, { 871 - .name = "sysmmu", 872 - .devname = "exynos-sysmmu.2", 873 - .enable = &exynos5_clk_ip_disp1_ctrl, 874 - .ctrlbit = (1 << 9) 875 - }, { 876 - .name = "sysmmu", 877 - .devname = "exynos-sysmmu.3", 878 - .enable = &exynos5_clk_ip_gen_ctrl, 879 - .ctrlbit = (1 << 7), 880 - }, { 881 - .name = "sysmmu", 882 - .devname = "exynos-sysmmu.4", 883 - .enable = &exynos5_clk_ip_gen_ctrl, 884 - .ctrlbit = (1 << 6) 885 - }, { 886 - .name = "sysmmu", 887 - .devname = "exynos-sysmmu.5", 888 - .enable = &exynos5_clk_ip_gscl_ctrl, 889 - .ctrlbit = (1 << 7), 890 - }, { 891 - .name = "sysmmu", 892 - .devname = "exynos-sysmmu.6", 893 - .enable = &exynos5_clk_ip_gscl_ctrl, 894 - .ctrlbit = (1 << 8), 895 - }, { 896 - .name = "sysmmu", 897 - .devname = "exynos-sysmmu.7", 898 - .enable = &exynos5_clk_ip_gscl_ctrl, 899 - .ctrlbit = (1 << 9), 900 - }, { 901 - .name = "sysmmu", 902 - .devname = "exynos-sysmmu.8", 903 - .enable = &exynos5_clk_ip_gscl_ctrl, 904 - .ctrlbit = (1 << 10), 905 - }, { 906 - .name = "sysmmu", 907 - .devname = "exynos-sysmmu.9", 908 - .enable = &exynos5_clk_ip_isp0_ctrl, 909 - .ctrlbit = (0x3F << 8), 910 - }, { 911 - .name = "sysmmu", 912 - .devname = "exynos-sysmmu.10", 913 - .enable = &exynos5_clk_ip_isp1_ctrl, 914 - .ctrlbit = (0xF << 4), 915 - }, { 916 - .name = "sysmmu", 917 - .devname = "exynos-sysmmu.11", 918 - .enable = &exynos5_clk_ip_disp1_ctrl, 919 - .ctrlbit = (1 << 8) 920 - }, { 921 - .name = "sysmmu", 922 - .devname = "exynos-sysmmu.12", 923 - .enable = &exynos5_clk_ip_gscl_ctrl, 924 - .ctrlbit = (1 << 11), 925 - }, { 926 - .name = "sysmmu", 927 - .devname = "exynos-sysmmu.13", 928 - .enable = &exynos5_clk_ip_gscl_ctrl, 929 - .ctrlbit = (1 << 12), 930 - }, { 931 - .name = "sysmmu", 932 - .devname = "exynos-sysmmu.14", 933 - .enable = &exynos5_clk_ip_acp_ctrl, 934 - .ctrlbit = (1 << 7) 935 - } 936 - }; 937 - 938 - static struct clk exynos5_init_clocks_on[] = { 939 - { 940 - .name = "uart", 941 - .devname = "s5pv210-uart.0", 942 - .enable = exynos5_clk_ip_peric_ctrl, 943 - .ctrlbit = (1 << 0), 944 - }, { 945 - .name = "uart", 946 - .devname = "s5pv210-uart.1", 947 - .enable = exynos5_clk_ip_peric_ctrl, 948 - .ctrlbit = (1 << 1), 949 - }, { 950 - .name = "uart", 951 - .devname = "s5pv210-uart.2", 952 - .enable = exynos5_clk_ip_peric_ctrl, 953 - .ctrlbit = (1 << 2), 954 - }, { 955 - .name = "uart", 956 - .devname = "s5pv210-uart.3", 957 - .enable = exynos5_clk_ip_peric_ctrl, 958 - .ctrlbit = (1 << 3), 959 - }, { 960 - .name = "uart", 961 - .devname = "s5pv210-uart.4", 962 - .enable = exynos5_clk_ip_peric_ctrl, 963 - .ctrlbit = (1 << 4), 964 - }, { 965 - .name = "uart", 966 - .devname = "s5pv210-uart.5", 967 - .enable = exynos5_clk_ip_peric_ctrl, 968 - .ctrlbit = (1 << 5), 969 - } 970 - }; 971 - 972 - static struct clk exynos5_clk_pdma0 = { 973 - .name = "dma", 974 - .devname = "dma-pl330.0", 975 - .enable = exynos5_clk_ip_fsys_ctrl, 976 - .ctrlbit = (1 << 1), 977 - }; 978 - 979 - static struct clk exynos5_clk_pdma1 = { 980 - .name = "dma", 981 - .devname = "dma-pl330.1", 982 - .enable = exynos5_clk_ip_fsys_ctrl, 983 - .ctrlbit = (1 << 2), 984 - }; 985 - 986 - static struct clk exynos5_clk_mdma1 = { 987 - .name = "dma", 988 - .devname = "dma-pl330.2", 989 - .enable = exynos5_clk_ip_gen_ctrl, 990 - .ctrlbit = (1 << 4), 991 - }; 992 - 993 - static struct clk exynos5_clk_fimd1 = { 994 - .name = "fimd", 995 - .devname = "exynos5-fb.1", 996 - .enable = exynos5_clk_ip_disp1_ctrl, 997 - .ctrlbit = (1 << 0), 998 - }; 999 - 1000 - static struct clk *exynos5_clkset_group_list[] = { 1001 - [0] = &clk_ext_xtal_mux, 1002 - [1] = NULL, 1003 - [2] = &exynos5_clk_sclk_hdmi24m, 1004 - [3] = &exynos5_clk_sclk_dptxphy, 1005 - [4] = &exynos5_clk_sclk_usbphy, 1006 - [5] = &exynos5_clk_sclk_hdmiphy, 1007 - [6] = &exynos5_clk_mout_mpll_user.clk, 1008 - [7] = &exynos5_clk_mout_epll.clk, 1009 - [8] = &exynos5_clk_sclk_vpll.clk, 1010 - [9] = &exynos5_clk_mout_cpll.clk, 1011 - }; 1012 - 1013 - static struct clksrc_sources exynos5_clkset_group = { 1014 - .sources = exynos5_clkset_group_list, 1015 - .nr_sources = ARRAY_SIZE(exynos5_clkset_group_list), 1016 - }; 1017 - 1018 - /* Possible clock sources for aclk_266_gscl_sub Mux */ 1019 - static struct clk *clk_src_gscl_266_list[] = { 1020 - [0] = &clk_ext_xtal_mux, 1021 - [1] = &exynos5_clk_aclk_266.clk, 1022 - }; 1023 - 1024 - static struct clksrc_sources clk_src_gscl_266 = { 1025 - .sources = clk_src_gscl_266_list, 1026 - .nr_sources = ARRAY_SIZE(clk_src_gscl_266_list), 1027 - }; 1028 - 1029 - static struct clksrc_clk exynos5_clk_dout_mmc0 = { 1030 - .clk = { 1031 - .name = "dout_mmc0", 1032 - }, 1033 - .sources = &exynos5_clkset_group, 1034 - .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 0, .size = 4 }, 1035 - .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 0, .size = 4 }, 1036 - }; 1037 - 1038 - static struct clksrc_clk exynos5_clk_dout_mmc1 = { 1039 - .clk = { 1040 - .name = "dout_mmc1", 1041 - }, 1042 - .sources = &exynos5_clkset_group, 1043 - .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 4, .size = 4 }, 1044 - .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 16, .size = 4 }, 1045 - }; 1046 - 1047 - static struct clksrc_clk exynos5_clk_dout_mmc2 = { 1048 - .clk = { 1049 - .name = "dout_mmc2", 1050 - }, 1051 - .sources = &exynos5_clkset_group, 1052 - .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 8, .size = 4 }, 1053 - .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 0, .size = 4 }, 1054 - }; 1055 - 1056 - static struct clksrc_clk exynos5_clk_dout_mmc3 = { 1057 - .clk = { 1058 - .name = "dout_mmc3", 1059 - }, 1060 - .sources = &exynos5_clkset_group, 1061 - .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 12, .size = 4 }, 1062 - .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 16, .size = 4 }, 1063 - }; 1064 - 1065 - static struct clksrc_clk exynos5_clk_dout_mmc4 = { 1066 - .clk = { 1067 - .name = "dout_mmc4", 1068 - }, 1069 - .sources = &exynos5_clkset_group, 1070 - .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 16, .size = 4 }, 1071 - .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS3, .shift = 0, .size = 4 }, 1072 - }; 1073 - 1074 - static struct clksrc_clk exynos5_clk_sclk_uart0 = { 1075 - .clk = { 1076 - .name = "uclk1", 1077 - .devname = "exynos4210-uart.0", 1078 - .enable = exynos5_clksrc_mask_peric0_ctrl, 1079 - .ctrlbit = (1 << 0), 1080 - }, 1081 - .sources = &exynos5_clkset_group, 1082 - .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 0, .size = 4 }, 1083 - .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 0, .size = 4 }, 1084 - }; 1085 - 1086 - static struct clksrc_clk exynos5_clk_sclk_uart1 = { 1087 - .clk = { 1088 - .name = "uclk1", 1089 - .devname = "exynos4210-uart.1", 1090 - .enable = exynos5_clksrc_mask_peric0_ctrl, 1091 - .ctrlbit = (1 << 4), 1092 - }, 1093 - .sources = &exynos5_clkset_group, 1094 - .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 4, .size = 4 }, 1095 - .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 4, .size = 4 }, 1096 - }; 1097 - 1098 - static struct clksrc_clk exynos5_clk_sclk_uart2 = { 1099 - .clk = { 1100 - .name = "uclk1", 1101 - .devname = "exynos4210-uart.2", 1102 - .enable = exynos5_clksrc_mask_peric0_ctrl, 1103 - .ctrlbit = (1 << 8), 1104 - }, 1105 - .sources = &exynos5_clkset_group, 1106 - .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 8, .size = 4 }, 1107 - .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 8, .size = 4 }, 1108 - }; 1109 - 1110 - static struct clksrc_clk exynos5_clk_sclk_uart3 = { 1111 - .clk = { 1112 - .name = "uclk1", 1113 - .devname = "exynos4210-uart.3", 1114 - .enable = exynos5_clksrc_mask_peric0_ctrl, 1115 - .ctrlbit = (1 << 12), 1116 - }, 1117 - .sources = &exynos5_clkset_group, 1118 - .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 12, .size = 4 }, 1119 - .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 12, .size = 4 }, 1120 - }; 1121 - 1122 - static struct clksrc_clk exynos5_clk_sclk_mmc0 = { 1123 - .clk = { 1124 - .name = "ciu", /* card interface unit clock */ 1125 - .devname = "dw_mmc.0", 1126 - .parent = &exynos5_clk_dout_mmc0.clk, 1127 - .enable = exynos5_clksrc_mask_fsys_ctrl, 1128 - .ctrlbit = (1 << 0), 1129 - }, 1130 - .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 8, .size = 8 }, 1131 - }; 1132 - 1133 - static struct clksrc_clk exynos5_clk_sclk_mmc1 = { 1134 - .clk = { 1135 - .name = "ciu", 1136 - .devname = "dw_mmc.1", 1137 - .parent = &exynos5_clk_dout_mmc1.clk, 1138 - .enable = exynos5_clksrc_mask_fsys_ctrl, 1139 - .ctrlbit = (1 << 4), 1140 - }, 1141 - .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 24, .size = 8 }, 1142 - }; 1143 - 1144 - static struct clksrc_clk exynos5_clk_sclk_mmc2 = { 1145 - .clk = { 1146 - .name = "ciu", 1147 - .devname = "dw_mmc.2", 1148 - .parent = &exynos5_clk_dout_mmc2.clk, 1149 - .enable = exynos5_clksrc_mask_fsys_ctrl, 1150 - .ctrlbit = (1 << 8), 1151 - }, 1152 - .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 8, .size = 8 }, 1153 - }; 1154 - 1155 - static struct clksrc_clk exynos5_clk_sclk_mmc3 = { 1156 - .clk = { 1157 - .name = "ciu", 1158 - .devname = "dw_mmc.3", 1159 - .parent = &exynos5_clk_dout_mmc3.clk, 1160 - .enable = exynos5_clksrc_mask_fsys_ctrl, 1161 - .ctrlbit = (1 << 12), 1162 - }, 1163 - .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 24, .size = 8 }, 1164 - }; 1165 - 1166 - static struct clksrc_clk exynos5_clk_mdout_spi0 = { 1167 - .clk = { 1168 - .name = "mdout_spi", 1169 - .devname = "exynos4210-spi.0", 1170 - }, 1171 - .sources = &exynos5_clkset_group, 1172 - .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 16, .size = 4 }, 1173 - .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 0, .size = 4 }, 1174 - }; 1175 - 1176 - static struct clksrc_clk exynos5_clk_mdout_spi1 = { 1177 - .clk = { 1178 - .name = "mdout_spi", 1179 - .devname = "exynos4210-spi.1", 1180 - }, 1181 - .sources = &exynos5_clkset_group, 1182 - .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 20, .size = 4 }, 1183 - .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 16, .size = 4 }, 1184 - }; 1185 - 1186 - static struct clksrc_clk exynos5_clk_mdout_spi2 = { 1187 - .clk = { 1188 - .name = "mdout_spi", 1189 - .devname = "exynos4210-spi.2", 1190 - }, 1191 - .sources = &exynos5_clkset_group, 1192 - .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 24, .size = 4 }, 1193 - .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 0, .size = 4 }, 1194 - }; 1195 - 1196 - static struct clksrc_clk exynos5_clk_sclk_spi0 = { 1197 - .clk = { 1198 - .name = "sclk_spi", 1199 - .devname = "exynos4210-spi.0", 1200 - .parent = &exynos5_clk_mdout_spi0.clk, 1201 - .enable = exynos5_clksrc_mask_peric1_ctrl, 1202 - .ctrlbit = (1 << 16), 1203 - }, 1204 - .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 8, .size = 8 }, 1205 - }; 1206 - 1207 - static struct clksrc_clk exynos5_clk_sclk_spi1 = { 1208 - .clk = { 1209 - .name = "sclk_spi", 1210 - .devname = "exynos4210-spi.1", 1211 - .parent = &exynos5_clk_mdout_spi1.clk, 1212 - .enable = exynos5_clksrc_mask_peric1_ctrl, 1213 - .ctrlbit = (1 << 20), 1214 - }, 1215 - .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 24, .size = 8 }, 1216 - }; 1217 - 1218 - static struct clksrc_clk exynos5_clk_sclk_spi2 = { 1219 - .clk = { 1220 - .name = "sclk_spi", 1221 - .devname = "exynos4210-spi.2", 1222 - .parent = &exynos5_clk_mdout_spi2.clk, 1223 - .enable = exynos5_clksrc_mask_peric1_ctrl, 1224 - .ctrlbit = (1 << 24), 1225 - }, 1226 - .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 8, .size = 8 }, 1227 - }; 1228 - 1229 - static struct clksrc_clk exynos5_clk_sclk_fimd1 = { 1230 - .clk = { 1231 - .name = "sclk_fimd", 1232 - .devname = "exynos5-fb.1", 1233 - .enable = exynos5_clksrc_mask_disp1_0_ctrl, 1234 - .ctrlbit = (1 << 0), 1235 - }, 1236 - .sources = &exynos5_clkset_group, 1237 - .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 0, .size = 4 }, 1238 - .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 0, .size = 4 }, 1239 - }; 1240 - 1241 - static struct clksrc_clk exynos5_clksrcs[] = { 1242 - { 1243 - .clk = { 1244 - .name = "aclk_266_gscl", 1245 - }, 1246 - .sources = &clk_src_gscl_266, 1247 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP3, .shift = 8, .size = 1 }, 1248 - }, { 1249 - .clk = { 1250 - .name = "sclk_g3d", 1251 - .devname = "mali-t604.0", 1252 - .enable = exynos5_clk_block_ctrl, 1253 - .ctrlbit = (1 << 1), 1254 - }, 1255 - .sources = &exynos5_clkset_aclk, 1256 - .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 20, .size = 1 }, 1257 - .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 }, 1258 - }, { 1259 - .clk = { 1260 - .name = "sclk_sata", 1261 - .devname = "exynos5-sata", 1262 - .enable = exynos5_clksrc_mask_fsys_ctrl, 1263 - .ctrlbit = (1 << 24), 1264 - }, 1265 - .sources = &exynos5_clkset_aclk, 1266 - .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 24, .size = 1 }, 1267 - .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS0, .shift = 20, .size = 4 }, 1268 - }, { 1269 - .clk = { 1270 - .name = "sclk_gscl_wrap", 1271 - .devname = "s5p-mipi-csis.0", 1272 - .enable = exynos5_clksrc_mask_gscl_ctrl, 1273 - .ctrlbit = (1 << 24), 1274 - }, 1275 - .sources = &exynos5_clkset_group, 1276 - .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 24, .size = 4 }, 1277 - .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 24, .size = 4 }, 1278 - }, { 1279 - .clk = { 1280 - .name = "sclk_gscl_wrap", 1281 - .devname = "s5p-mipi-csis.1", 1282 - .enable = exynos5_clksrc_mask_gscl_ctrl, 1283 - .ctrlbit = (1 << 28), 1284 - }, 1285 - .sources = &exynos5_clkset_group, 1286 - .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 28, .size = 4 }, 1287 - .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 28, .size = 4 }, 1288 - }, { 1289 - .clk = { 1290 - .name = "sclk_cam0", 1291 - .enable = exynos5_clksrc_mask_gscl_ctrl, 1292 - .ctrlbit = (1 << 16), 1293 - }, 1294 - .sources = &exynos5_clkset_group, 1295 - .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 16, .size = 4 }, 1296 - .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 16, .size = 4 }, 1297 - }, { 1298 - .clk = { 1299 - .name = "sclk_cam1", 1300 - .enable = exynos5_clksrc_mask_gscl_ctrl, 1301 - .ctrlbit = (1 << 20), 1302 - }, 1303 - .sources = &exynos5_clkset_group, 1304 - .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 20, .size = 4 }, 1305 - .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 20, .size = 4 }, 1306 - }, { 1307 - .clk = { 1308 - .name = "sclk_jpeg", 1309 - .parent = &exynos5_clk_mout_cpll.clk, 1310 - }, 1311 - .reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 }, 1312 - }, 1313 - }; 1314 - 1315 - /* Clock initialization code */ 1316 - static struct clksrc_clk *exynos5_sysclks[] = { 1317 - &exynos5_clk_mout_apll, 1318 - &exynos5_clk_sclk_apll, 1319 - &exynos5_clk_mout_bpll, 1320 - &exynos5_clk_mout_bpll_fout, 1321 - &exynos5_clk_mout_bpll_user, 1322 - &exynos5_clk_mout_cpll, 1323 - &exynos5_clk_mout_epll, 1324 - &exynos5_clk_mout_mpll, 1325 - &exynos5_clk_mout_mpll_fout, 1326 - &exynos5_clk_mout_mpll_user, 1327 - &exynos5_clk_vpllsrc, 1328 - &exynos5_clk_sclk_vpll, 1329 - &exynos5_clk_mout_cpu, 1330 - &exynos5_clk_dout_armclk, 1331 - &exynos5_clk_dout_arm2clk, 1332 - &exynos5_clk_cdrex, 1333 - &exynos5_clk_aclk_400, 1334 - &exynos5_clk_aclk_333, 1335 - &exynos5_clk_aclk_266, 1336 - &exynos5_clk_aclk_200, 1337 - &exynos5_clk_aclk_166, 1338 - &exynos5_clk_aclk_300_gscl, 1339 - &exynos5_clk_mout_aclk_300_gscl, 1340 - &exynos5_clk_mout_aclk_300_gscl_mid, 1341 - &exynos5_clk_mout_aclk_300_gscl_mid1, 1342 - &exynos5_clk_aclk_66_pre, 1343 - &exynos5_clk_aclk_66, 1344 - &exynos5_clk_dout_mmc0, 1345 - &exynos5_clk_dout_mmc1, 1346 - &exynos5_clk_dout_mmc2, 1347 - &exynos5_clk_dout_mmc3, 1348 - &exynos5_clk_dout_mmc4, 1349 - &exynos5_clk_aclk_acp, 1350 - &exynos5_clk_pclk_acp, 1351 - &exynos5_clk_sclk_spi0, 1352 - &exynos5_clk_sclk_spi1, 1353 - &exynos5_clk_sclk_spi2, 1354 - &exynos5_clk_mdout_spi0, 1355 - &exynos5_clk_mdout_spi1, 1356 - &exynos5_clk_mdout_spi2, 1357 - &exynos5_clk_sclk_fimd1, 1358 - }; 1359 - 1360 - static struct clk *exynos5_clk_cdev[] = { 1361 - &exynos5_clk_pdma0, 1362 - &exynos5_clk_pdma1, 1363 - &exynos5_clk_mdma1, 1364 - &exynos5_clk_fimd1, 1365 - }; 1366 - 1367 - static struct clksrc_clk *exynos5_clksrc_cdev[] = { 1368 - &exynos5_clk_sclk_uart0, 1369 - &exynos5_clk_sclk_uart1, 1370 - &exynos5_clk_sclk_uart2, 1371 - &exynos5_clk_sclk_uart3, 1372 - &exynos5_clk_sclk_mmc0, 1373 - &exynos5_clk_sclk_mmc1, 1374 - &exynos5_clk_sclk_mmc2, 1375 - &exynos5_clk_sclk_mmc3, 1376 - }; 1377 - 1378 - static struct clk_lookup exynos5_clk_lookup[] = { 1379 - CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos5_clk_sclk_uart0.clk), 1380 - CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos5_clk_sclk_uart1.clk), 1381 - CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos5_clk_sclk_uart2.clk), 1382 - CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos5_clk_sclk_uart3.clk), 1383 - CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos5_clk_sclk_mmc0.clk), 1384 - CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1.clk), 1385 - CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2.clk), 1386 - CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3.clk), 1387 - CLKDEV_INIT("exynos4210-spi.0", "spi_busclk0", &exynos5_clk_sclk_spi0.clk), 1388 - CLKDEV_INIT("exynos4210-spi.1", "spi_busclk0", &exynos5_clk_sclk_spi1.clk), 1389 - CLKDEV_INIT("exynos4210-spi.2", "spi_busclk0", &exynos5_clk_sclk_spi2.clk), 1390 - CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0), 1391 - CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1), 1392 - CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1), 1393 - CLKDEV_INIT("exynos5-fb.1", "lcd", &exynos5_clk_fimd1), 1394 - }; 1395 - 1396 - static unsigned long exynos5_epll_get_rate(struct clk *clk) 1397 - { 1398 - return clk->rate; 1399 - } 1400 - 1401 - static struct clk *exynos5_clks[] __initdata = { 1402 - &exynos5_clk_sclk_hdmi27m, 1403 - &exynos5_clk_sclk_hdmiphy, 1404 - &clk_fout_bpll, 1405 - &clk_fout_bpll_div2, 1406 - &clk_fout_cpll, 1407 - &clk_fout_mpll_div2, 1408 - &exynos5_clk_armclk, 1409 - }; 1410 - 1411 - static u32 epll_div[][6] = { 1412 - { 192000000, 0, 48, 3, 1, 0 }, 1413 - { 180000000, 0, 45, 3, 1, 0 }, 1414 - { 73728000, 1, 73, 3, 3, 47710 }, 1415 - { 67737600, 1, 90, 4, 3, 20762 }, 1416 - { 49152000, 0, 49, 3, 3, 9961 }, 1417 - { 45158400, 0, 45, 3, 3, 10381 }, 1418 - { 180633600, 0, 45, 3, 1, 10381 }, 1419 - }; 1420 - 1421 - static int exynos5_epll_set_rate(struct clk *clk, unsigned long rate) 1422 - { 1423 - unsigned int epll_con, epll_con_k; 1424 - unsigned int i; 1425 - unsigned int tmp; 1426 - unsigned int epll_rate; 1427 - unsigned int locktime; 1428 - unsigned int lockcnt; 1429 - 1430 - /* Return if nothing changed */ 1431 - if (clk->rate == rate) 1432 - return 0; 1433 - 1434 - if (clk->parent) 1435 - epll_rate = clk_get_rate(clk->parent); 1436 - else 1437 - epll_rate = clk_ext_xtal_mux.rate; 1438 - 1439 - if (epll_rate != 24000000) { 1440 - pr_err("Invalid Clock : recommended clock is 24MHz.\n"); 1441 - return -EINVAL; 1442 - } 1443 - 1444 - epll_con = __raw_readl(EXYNOS5_EPLL_CON0); 1445 - epll_con &= ~(0x1 << 27 | \ 1446 - PLL46XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \ 1447 - PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \ 1448 - PLL46XX_SDIV_MASK << PLL46XX_SDIV_SHIFT); 1449 - 1450 - for (i = 0; i < ARRAY_SIZE(epll_div); i++) { 1451 - if (epll_div[i][0] == rate) { 1452 - epll_con_k = epll_div[i][5] << 0; 1453 - epll_con |= epll_div[i][1] << 27; 1454 - epll_con |= epll_div[i][2] << PLL46XX_MDIV_SHIFT; 1455 - epll_con |= epll_div[i][3] << PLL46XX_PDIV_SHIFT; 1456 - epll_con |= epll_div[i][4] << PLL46XX_SDIV_SHIFT; 1457 - break; 1458 - } 1459 - } 1460 - 1461 - if (i == ARRAY_SIZE(epll_div)) { 1462 - printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", 1463 - __func__); 1464 - return -EINVAL; 1465 - } 1466 - 1467 - epll_rate /= 1000000; 1468 - 1469 - /* 3000 max_cycls : specification data */ 1470 - locktime = 3000 / epll_rate * epll_div[i][3]; 1471 - lockcnt = locktime * 10000 / (10000 / epll_rate); 1472 - 1473 - __raw_writel(lockcnt, EXYNOS5_EPLL_LOCK); 1474 - 1475 - __raw_writel(epll_con, EXYNOS5_EPLL_CON0); 1476 - __raw_writel(epll_con_k, EXYNOS5_EPLL_CON1); 1477 - 1478 - do { 1479 - tmp = __raw_readl(EXYNOS5_EPLL_CON0); 1480 - } while (!(tmp & 0x1 << EXYNOS5_EPLLCON0_LOCKED_SHIFT)); 1481 - 1482 - clk->rate = rate; 1483 - 1484 - return 0; 1485 - } 1486 - 1487 - static struct clk_ops exynos5_epll_ops = { 1488 - .get_rate = exynos5_epll_get_rate, 1489 - .set_rate = exynos5_epll_set_rate, 1490 - }; 1491 - 1492 - static int xtal_rate; 1493 - 1494 - static unsigned long exynos5_fout_apll_get_rate(struct clk *clk) 1495 - { 1496 - return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS5_APLL_CON0)); 1497 - } 1498 - 1499 - static struct clk_ops exynos5_fout_apll_ops = { 1500 - .get_rate = exynos5_fout_apll_get_rate, 1501 - }; 1502 - 1503 - #ifdef CONFIG_PM 1504 - static int exynos5_clock_suspend(void) 1505 - { 1506 - s3c_pm_do_save(exynos5_clock_save, ARRAY_SIZE(exynos5_clock_save)); 1507 - 1508 - return 0; 1509 - } 1510 - 1511 - static void exynos5_clock_resume(void) 1512 - { 1513 - s3c_pm_do_restore_core(exynos5_clock_save, ARRAY_SIZE(exynos5_clock_save)); 1514 - } 1515 - #else 1516 - #define exynos5_clock_suspend NULL 1517 - #define exynos5_clock_resume NULL 1518 - #endif 1519 - 1520 - static struct syscore_ops exynos5_clock_syscore_ops = { 1521 - .suspend = exynos5_clock_suspend, 1522 - .resume = exynos5_clock_resume, 1523 - }; 1524 - 1525 - void __init_or_cpufreq exynos5_setup_clocks(void) 1526 - { 1527 - struct clk *xtal_clk; 1528 - unsigned long apll; 1529 - unsigned long bpll; 1530 - unsigned long cpll; 1531 - unsigned long mpll; 1532 - unsigned long epll; 1533 - unsigned long vpll; 1534 - unsigned long vpllsrc; 1535 - unsigned long xtal; 1536 - unsigned long armclk; 1537 - unsigned long mout_cdrex; 1538 - unsigned long aclk_400; 1539 - unsigned long aclk_333; 1540 - unsigned long aclk_266; 1541 - unsigned long aclk_200; 1542 - unsigned long aclk_166; 1543 - unsigned long aclk_66; 1544 - unsigned int ptr; 1545 - 1546 - printk(KERN_DEBUG "%s: registering clocks\n", __func__); 1547 - 1548 - xtal_clk = clk_get(NULL, "xtal"); 1549 - BUG_ON(IS_ERR(xtal_clk)); 1550 - 1551 - xtal = clk_get_rate(xtal_clk); 1552 - 1553 - xtal_rate = xtal; 1554 - 1555 - clk_put(xtal_clk); 1556 - 1557 - printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); 1558 - 1559 - apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_APLL_CON0)); 1560 - bpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_BPLL_CON0)); 1561 - cpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_CPLL_CON0)); 1562 - mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_MPLL_CON0)); 1563 - epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS5_EPLL_CON0), 1564 - __raw_readl(EXYNOS5_EPLL_CON1)); 1565 - 1566 - vpllsrc = clk_get_rate(&exynos5_clk_vpllsrc.clk); 1567 - vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS5_VPLL_CON0), 1568 - __raw_readl(EXYNOS5_VPLL_CON1)); 1569 - 1570 - clk_fout_apll.ops = &exynos5_fout_apll_ops; 1571 - clk_fout_bpll.rate = bpll; 1572 - clk_fout_bpll_div2.rate = bpll >> 1; 1573 - clk_fout_cpll.rate = cpll; 1574 - clk_fout_mpll.rate = mpll; 1575 - clk_fout_mpll_div2.rate = mpll >> 1; 1576 - clk_fout_epll.rate = epll; 1577 - clk_fout_vpll.rate = vpll; 1578 - 1579 - printk(KERN_INFO "EXYNOS5: PLL settings, A=%ld, B=%ld, C=%ld\n" 1580 - "M=%ld, E=%ld V=%ld", 1581 - apll, bpll, cpll, mpll, epll, vpll); 1582 - 1583 - armclk = clk_get_rate(&exynos5_clk_armclk); 1584 - mout_cdrex = clk_get_rate(&exynos5_clk_cdrex.clk); 1585 - 1586 - aclk_400 = clk_get_rate(&exynos5_clk_aclk_400.clk); 1587 - aclk_333 = clk_get_rate(&exynos5_clk_aclk_333.clk); 1588 - aclk_266 = clk_get_rate(&exynos5_clk_aclk_266.clk); 1589 - aclk_200 = clk_get_rate(&exynos5_clk_aclk_200.clk); 1590 - aclk_166 = clk_get_rate(&exynos5_clk_aclk_166.clk); 1591 - aclk_66 = clk_get_rate(&exynos5_clk_aclk_66.clk); 1592 - 1593 - printk(KERN_INFO "EXYNOS5: ARMCLK=%ld, CDREX=%ld, ACLK400=%ld\n" 1594 - "ACLK333=%ld, ACLK266=%ld, ACLK200=%ld\n" 1595 - "ACLK166=%ld, ACLK66=%ld\n", 1596 - armclk, mout_cdrex, aclk_400, 1597 - aclk_333, aclk_266, aclk_200, 1598 - aclk_166, aclk_66); 1599 - 1600 - 1601 - clk_fout_epll.ops = &exynos5_epll_ops; 1602 - 1603 - if (clk_set_parent(&exynos5_clk_mout_epll.clk, &clk_fout_epll)) 1604 - printk(KERN_ERR "Unable to set parent %s of clock %s.\n", 1605 - clk_fout_epll.name, exynos5_clk_mout_epll.clk.name); 1606 - 1607 - clk_set_rate(&exynos5_clk_sclk_apll.clk, 100000000); 1608 - clk_set_rate(&exynos5_clk_aclk_266.clk, 300000000); 1609 - 1610 - clk_set_rate(&exynos5_clk_aclk_acp.clk, 267000000); 1611 - clk_set_rate(&exynos5_clk_pclk_acp.clk, 134000000); 1612 - 1613 - for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clksrcs); ptr++) 1614 - s3c_set_clksrc(&exynos5_clksrcs[ptr], true); 1615 - } 1616 - 1617 - void __init exynos5_register_clocks(void) 1618 - { 1619 - int ptr; 1620 - 1621 - s3c24xx_register_clocks(exynos5_clks, ARRAY_SIZE(exynos5_clks)); 1622 - 1623 - for (ptr = 0; ptr < ARRAY_SIZE(exynos5_sysclks); ptr++) 1624 - s3c_register_clksrc(exynos5_sysclks[ptr], 1); 1625 - 1626 - for (ptr = 0; ptr < ARRAY_SIZE(exynos5_sclk_tv); ptr++) 1627 - s3c_register_clksrc(exynos5_sclk_tv[ptr], 1); 1628 - 1629 - for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clksrc_cdev); ptr++) 1630 - s3c_register_clksrc(exynos5_clksrc_cdev[ptr], 1); 1631 - 1632 - s3c_register_clksrc(exynos5_clksrcs, ARRAY_SIZE(exynos5_clksrcs)); 1633 - s3c_register_clocks(exynos5_init_clocks_on, ARRAY_SIZE(exynos5_init_clocks_on)); 1634 - 1635 - s3c24xx_register_clocks(exynos5_clk_cdev, ARRAY_SIZE(exynos5_clk_cdev)); 1636 - for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clk_cdev); ptr++) 1637 - s3c_disable_clocks(exynos5_clk_cdev[ptr], 1); 1638 - 1639 - s3c_register_clocks(exynos5_init_clocks_off, ARRAY_SIZE(exynos5_init_clocks_off)); 1640 - s3c_disable_clocks(exynos5_init_clocks_off, ARRAY_SIZE(exynos5_init_clocks_off)); 1641 - clkdev_add_table(exynos5_clk_lookup, ARRAY_SIZE(exynos5_clk_lookup)); 1642 - 1643 - register_syscore_ops(&exynos5_clock_syscore_ops); 1644 - s3c_pwmclk_init(); 1645 - }
+46 -42
arch/arm/mach-exynos/common.c
··· 24 24 #include <linux/export.h> 25 25 #include <linux/irqdomain.h> 26 26 #include <linux/of_address.h> 27 + #include <linux/clocksource.h> 28 + #include <linux/clk-provider.h> 27 29 #include <linux/irqchip/arm-gic.h> 28 30 #include <linux/irqchip/chained_irq.h> 29 31 ··· 39 37 #include <mach/regs-irq.h> 40 38 #include <mach/regs-pmu.h> 41 39 #include <mach/regs-gpio.h> 40 + #include <mach/irqs.h> 42 41 43 42 #include <plat/cpu.h> 44 - #include <plat/clock.h> 45 43 #include <plat/devs.h> 46 44 #include <plat/pm.h> 47 45 #include <plat/sdhci.h> ··· 67 65 static void exynos4_map_io(void); 68 66 static void exynos5_map_io(void); 69 67 static void exynos5440_map_io(void); 70 - static void exynos4_init_clocks(int xtal); 71 - static void exynos5_init_clocks(int xtal); 72 68 static void exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no); 73 69 static int exynos_init(void); 70 + 71 + unsigned long xxti_f = 0, xusbxti_f = 0; 74 72 75 73 static struct cpu_table cpu_ids[] __initdata = { 76 74 { 77 75 .idcode = EXYNOS4210_CPU_ID, 78 76 .idmask = EXYNOS4_CPU_MASK, 79 77 .map_io = exynos4_map_io, 80 - .init_clocks = exynos4_init_clocks, 81 78 .init_uarts = exynos4_init_uarts, 82 79 .init = exynos_init, 83 80 .name = name_exynos4210, ··· 84 83 .idcode = EXYNOS4212_CPU_ID, 85 84 .idmask = EXYNOS4_CPU_MASK, 86 85 .map_io = exynos4_map_io, 87 - .init_clocks = exynos4_init_clocks, 88 86 .init_uarts = exynos4_init_uarts, 89 87 .init = exynos_init, 90 88 .name = name_exynos4212, ··· 91 91 .idcode = EXYNOS4412_CPU_ID, 92 92 .idmask = EXYNOS4_CPU_MASK, 93 93 .map_io = exynos4_map_io, 94 - .init_clocks = exynos4_init_clocks, 95 94 .init_uarts = exynos4_init_uarts, 96 95 .init = exynos_init, 97 96 .name = name_exynos4412, ··· 98 99 .idcode = EXYNOS5250_SOC_ID, 99 100 .idmask = EXYNOS5_SOC_MASK, 100 101 .map_io = exynos5_map_io, 101 - .init_clocks = exynos5_init_clocks, 102 102 .init = exynos_init, 103 103 .name = name_exynos5250, 104 104 }, { ··· 255 257 .length = SZ_4K, 256 258 .type = MT_DEVICE, 257 259 }, { 258 - .virtual = (unsigned long)S5P_VA_SYSTIMER, 259 - .pfn = __phys_to_pfn(EXYNOS5_PA_SYSTIMER), 260 - .length = SZ_4K, 261 - .type = MT_DEVICE, 262 - }, { 263 260 .virtual = (unsigned long)S5P_VA_SYSRAM, 264 261 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSRAM), 265 262 .length = SZ_4K, ··· 395 402 iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc)); 396 403 } 397 404 398 - static void __init exynos4_init_clocks(int xtal) 399 - { 400 - printk(KERN_DEBUG "%s: initializing clocks\n", __func__); 401 - 402 - s3c24xx_register_baseclocks(xtal); 403 - s5p_register_clocks(xtal); 404 - 405 - if (soc_is_exynos4210()) 406 - exynos4210_register_clocks(); 407 - else if (soc_is_exynos4212() || soc_is_exynos4412()) 408 - exynos4212_register_clocks(); 409 - 410 - exynos4_register_clocks(); 411 - exynos4_setup_clocks(); 412 - } 413 - 414 405 static void __init exynos5440_map_io(void) 415 406 { 416 407 iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0)); 417 408 } 418 409 419 - static void __init exynos5_init_clocks(int xtal) 410 + void __init exynos_init_time(void) 420 411 { 421 - printk(KERN_DEBUG "%s: initializing clocks\n", __func__); 422 - 423 - /* EXYNOS5440 can support only common clock framework */ 424 - 425 - if (soc_is_exynos5440()) 426 - return; 427 - 428 - #ifdef CONFIG_SOC_EXYNOS5250 429 - s3c24xx_register_baseclocks(xtal); 430 - s5p_register_clocks(xtal); 431 - 432 - exynos5_register_clocks(); 433 - exynos5_setup_clocks(); 412 + if (of_have_populated_dt()) { 413 + #ifdef CONFIG_OF 414 + of_clk_init(NULL); 415 + clocksource_of_init(); 434 416 #endif 417 + } else { 418 + /* todo: remove after migrating legacy E4 platforms to dt */ 419 + #ifdef CONFIG_ARCH_EXYNOS4 420 + exynos4_clk_init(NULL); 421 + exynos4_clk_register_fixed_ext(xxti_f, xusbxti_f); 422 + #endif 423 + mct_init(); 424 + } 435 425 } 436 426 437 427 void __init exynos4_init_irq(void) ··· 800 824 static const struct of_device_id exynos_pinctrl_ids[] = { 801 825 { .compatible = "samsung,exynos4210-pinctrl", }, 802 826 { .compatible = "samsung,exynos4x12-pinctrl", }, 827 + { .compatible = "samsung,exynos5250-pinctrl", }, 803 828 }; 804 829 struct device_node *pctrl_np, *wkup_np; 805 830 const char *wkup_compat = "samsung,exynos4210-wakeup-eint"; ··· 854 877 return 0; 855 878 } 856 879 arch_initcall(exynos_init_irq_eint); 880 + 881 + static struct resource exynos4_pmu_resource[] = { 882 + DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU), 883 + DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU1), 884 + #if defined(CONFIG_SOC_EXYNOS4412) 885 + DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU2), 886 + DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU3), 887 + #endif 888 + }; 889 + 890 + static struct platform_device exynos4_device_pmu = { 891 + .name = "arm-pmu", 892 + .num_resources = ARRAY_SIZE(exynos4_pmu_resource), 893 + .resource = exynos4_pmu_resource, 894 + }; 895 + 896 + static int __init exynos_armpmu_init(void) 897 + { 898 + if (!of_have_populated_dt()) { 899 + if (soc_is_exynos4210() || soc_is_exynos4212()) 900 + exynos4_device_pmu.num_resources = 2; 901 + platform_device_register(&exynos4_device_pmu); 902 + } 903 + 904 + return 0; 905 + } 906 + arch_initcall(exynos_armpmu_init);
+9 -1
arch/arm/mach-exynos/common.h
··· 12 12 #ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H 13 13 #define __ARCH_ARM_MACH_EXYNOS_COMMON_H 14 14 15 - extern void exynos4_timer_init(void); 15 + #include <linux/of.h> 16 + 17 + extern void mct_init(void); 18 + void exynos_init_time(void); 19 + extern unsigned long xxti_f, xusbxti_f; 16 20 17 21 struct map_desc; 18 22 void exynos_init_io(struct map_desc *mach_desc, int size); ··· 25 21 void exynos4_restart(char mode, const char *cmd); 26 22 void exynos5_restart(char mode, const char *cmd); 27 23 void exynos_init_late(void); 24 + 25 + /* ToDo: remove these after migrating legacy exynos4 platforms to dt */ 26 + void exynos4_clk_init(struct device_node *np); 27 + void exynos4_clk_register_fixed_ext(unsigned long, unsigned long); 28 28 29 29 #ifdef CONFIG_PM_GENERIC_DOMAINS 30 30 int exynos_pm_late_initcall(void);
+10 -9
arch/arm/mach-exynos/include/mach/irqs.h
··· 30 30 31 31 /* For EXYNOS4 and EXYNOS5 */ 32 32 33 - #define EXYNOS_IRQ_MCT_LOCALTIMER IRQ_PPI(12) 34 - 35 33 #define EXYNOS_IRQ_EINT16_31 IRQ_SPI(32) 36 34 37 35 /* For EXYNOS4 SoCs */ ··· 126 128 #define EXYNOS4_IRQ_ADC1 IRQ_SPI(107) 127 129 #define EXYNOS4_IRQ_PEN1 IRQ_SPI(108) 128 130 #define EXYNOS4_IRQ_KEYPAD IRQ_SPI(109) 129 - #define EXYNOS4_IRQ_PMU IRQ_SPI(110) 131 + #define EXYNOS4_IRQ_POWER_PMU IRQ_SPI(110) 130 132 #define EXYNOS4_IRQ_GPS IRQ_SPI(111) 131 133 #define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112) 132 134 #define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113) 133 135 134 136 #define EXYNOS4_IRQ_TSI IRQ_SPI(115) 135 137 #define EXYNOS4_IRQ_SATA IRQ_SPI(116) 138 + 139 + #define EXYNOS4_IRQ_PMU COMBINER_IRQ(2, 2) 140 + #define EXYNOS4_IRQ_PMU_CPU1 COMBINER_IRQ(3, 2) 141 + #define EXYNOS4_IRQ_PMU_CPU2 COMBINER_IRQ(18, 2) 142 + #define EXYNOS4_IRQ_PMU_CPU3 COMBINER_IRQ(19, 2) 136 143 137 144 #define EXYNOS4_IRQ_TMU_TRIG0 COMBINER_IRQ(2, 4) 138 145 #define EXYNOS4_IRQ_TMU_TRIG1 COMBINER_IRQ(3, 4) ··· 171 168 #define EXYNOS4_IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1) 172 169 #define EXYNOS4_IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2) 173 170 174 - #define EXYNOS4_MAX_COMBINER_NR 16 171 + #define EXYNOS4210_MAX_COMBINER_NR 16 172 + #define EXYNOS4212_MAX_COMBINER_NR 18 173 + #define EXYNOS4412_MAX_COMBINER_NR 20 174 + #define EXYNOS4_MAX_COMBINER_NR EXYNOS4412_MAX_COMBINER_NR 175 175 176 176 #define EXYNOS4_IRQ_GPIO1_NR_GROUPS 16 177 177 #define EXYNOS4_IRQ_GPIO2_NR_GROUPS 9 ··· 239 233 #define IRQ_TC EXYNOS4_IRQ_PEN0 240 234 241 235 #define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD 242 - #define IRQ_PMU EXYNOS4_IRQ_PMU 243 236 244 237 #define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO 245 238 #define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNC ··· 328 323 #define EXYNOS5_IRQ_CEC IRQ_SPI(114) 329 324 #define EXYNOS5_IRQ_SATA IRQ_SPI(115) 330 325 331 - #define EXYNOS5_IRQ_MCT_L0 IRQ_SPI(120) 332 - #define EXYNOS5_IRQ_MCT_L1 IRQ_SPI(121) 333 326 #define EXYNOS5_IRQ_MMC44 IRQ_SPI(123) 334 327 #define EXYNOS5_IRQ_MDMA1 IRQ_SPI(124) 335 328 #define EXYNOS5_IRQ_FIMC_LITE0 IRQ_SPI(125) ··· 422 419 #define EXYNOS5_IRQ_PMU_CPU1 COMBINER_IRQ(22, 4) 423 420 424 421 #define EXYNOS5_IRQ_EINT0 COMBINER_IRQ(23, 0) 425 - #define EXYNOS5_IRQ_MCT_G0 COMBINER_IRQ(23, 3) 426 - #define EXYNOS5_IRQ_MCT_G1 COMBINER_IRQ(23, 4) 427 422 428 423 #define EXYNOS5_IRQ_EINT1 COMBINER_IRQ(24, 0) 429 424 #define EXYNOS5_IRQ_SYSMMU_LITE1_0 COMBINER_IRQ(24, 1)
-1
arch/arm/mach-exynos/include/mach/map.h
··· 65 65 #define EXYNOS5_PA_CMU 0x10010000 66 66 67 67 #define EXYNOS4_PA_SYSTIMER 0x10050000 68 - #define EXYNOS5_PA_SYSTIMER 0x101C0000 69 68 70 69 #define EXYNOS4_PA_WATCHDOG 0x10060000 71 70 #define EXYNOS5_PA_WATCHDOG 0x101D0000
-53
arch/arm/mach-exynos/include/mach/regs-mct.h
··· 1 - /* arch/arm/mach-exynos4/include/mach/regs-mct.h 2 - * 3 - * Copyright (c) 2011 Samsung Electronics Co., Ltd. 4 - * http://www.samsung.com 5 - * 6 - * EXYNOS4 MCT configutation 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - */ 12 - 13 - #ifndef __ASM_ARCH_REGS_MCT_H 14 - #define __ASM_ARCH_REGS_MCT_H __FILE__ 15 - 16 - #include <mach/map.h> 17 - 18 - #define EXYNOS4_MCTREG(x) (S5P_VA_SYSTIMER + (x)) 19 - 20 - #define EXYNOS4_MCT_G_CNT_L EXYNOS4_MCTREG(0x100) 21 - #define EXYNOS4_MCT_G_CNT_U EXYNOS4_MCTREG(0x104) 22 - #define EXYNOS4_MCT_G_CNT_WSTAT EXYNOS4_MCTREG(0x110) 23 - 24 - #define EXYNOS4_MCT_G_COMP0_L EXYNOS4_MCTREG(0x200) 25 - #define EXYNOS4_MCT_G_COMP0_U EXYNOS4_MCTREG(0x204) 26 - #define EXYNOS4_MCT_G_COMP0_ADD_INCR EXYNOS4_MCTREG(0x208) 27 - 28 - #define EXYNOS4_MCT_G_TCON EXYNOS4_MCTREG(0x240) 29 - 30 - #define EXYNOS4_MCT_G_INT_CSTAT EXYNOS4_MCTREG(0x244) 31 - #define EXYNOS4_MCT_G_INT_ENB EXYNOS4_MCTREG(0x248) 32 - #define EXYNOS4_MCT_G_WSTAT EXYNOS4_MCTREG(0x24C) 33 - 34 - #define _EXYNOS4_MCT_L_BASE EXYNOS4_MCTREG(0x300) 35 - #define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * x)) 36 - #define EXYNOS4_MCT_L_MASK (0xffffff00) 37 - 38 - #define MCT_L_TCNTB_OFFSET (0x00) 39 - #define MCT_L_ICNTB_OFFSET (0x08) 40 - #define MCT_L_TCON_OFFSET (0x20) 41 - #define MCT_L_INT_CSTAT_OFFSET (0x30) 42 - #define MCT_L_INT_ENB_OFFSET (0x34) 43 - #define MCT_L_WSTAT_OFFSET (0x40) 44 - 45 - #define MCT_G_TCON_START (1 << 8) 46 - #define MCT_G_TCON_COMP0_AUTO_INC (1 << 1) 47 - #define MCT_G_TCON_COMP0_ENABLE (1 << 0) 48 - 49 - #define MCT_L_TCON_INTERVAL_MODE (1 << 2) 50 - #define MCT_L_TCON_INT_START (1 << 1) 51 - #define MCT_L_TCON_TIMER_START (1 << 0) 52 - 53 - #endif /* __ASM_ARCH_REGS_MCT_H */
+1 -2
arch/arm/mach-exynos/mach-armlex4210.c
··· 178 178 static void __init armlex4210_map_io(void) 179 179 { 180 180 exynos_init_io(NULL, 0); 181 - s3c24xx_init_clocks(24000000); 182 181 s3c24xx_init_uarts(armlex4210_uartcfgs, 183 182 ARRAY_SIZE(armlex4210_uartcfgs)); 184 183 } ··· 202 203 .map_io = armlex4210_map_io, 203 204 .init_machine = armlex4210_machine_init, 204 205 .init_late = exynos_init_late, 205 - .init_time = exynos4_timer_init, 206 + .init_time = exynos_init_time, 206 207 .restart = exynos4_restart, 207 208 MACHINE_END
+20 -102
arch/arm/mach-exynos/mach-exynos4-dt.c
··· 11 11 * published by the Free Software Foundation. 12 12 */ 13 13 14 + #include <linux/kernel.h> 14 15 #include <linux/of_platform.h> 16 + #include <linux/of_fdt.h> 15 17 #include <linux/serial_core.h> 18 + #include <linux/memblock.h> 19 + #include <linux/clocksource.h> 16 20 17 21 #include <asm/mach/arch.h> 18 - #include <mach/map.h> 19 - 20 - #include <plat/cpu.h> 21 - #include <plat/regs-serial.h> 22 + #include <plat/mfc.h> 22 23 23 24 #include "common.h" 24 - 25 - /* 26 - * The following lookup table is used to override device names when devices 27 - * are registered from device tree. This is temporarily added to enable 28 - * device tree support addition for the Exynos4 architecture. 29 - * 30 - * For drivers that require platform data to be provided from the machine 31 - * file, a platform data pointer can also be supplied along with the 32 - * devices names. Usually, the platform data elements that cannot be parsed 33 - * from the device tree by the drivers (example: function pointers) are 34 - * supplied. But it should be noted that this is a temporary mechanism and 35 - * at some point, the drivers should be capable of parsing all the platform 36 - * data from the device tree. 37 - */ 38 - static const struct of_dev_auxdata exynos4_auxdata_lookup[] __initconst = { 39 - OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART0, 40 - "exynos4210-uart.0", NULL), 41 - OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART1, 42 - "exynos4210-uart.1", NULL), 43 - OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART2, 44 - "exynos4210-uart.2", NULL), 45 - OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART3, 46 - "exynos4210-uart.3", NULL), 47 - OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(0), 48 - "exynos4-sdhci.0", NULL), 49 - OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(1), 50 - "exynos4-sdhci.1", NULL), 51 - OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(2), 52 - "exynos4-sdhci.2", NULL), 53 - OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(3), 54 - "exynos4-sdhci.3", NULL), 55 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(0), 56 - "s3c2440-i2c.0", NULL), 57 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(1), 58 - "s3c2440-i2c.1", NULL), 59 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(2), 60 - "s3c2440-i2c.2", NULL), 61 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(3), 62 - "s3c2440-i2c.3", NULL), 63 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(4), 64 - "s3c2440-i2c.4", NULL), 65 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(5), 66 - "s3c2440-i2c.5", NULL), 67 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(6), 68 - "s3c2440-i2c.6", NULL), 69 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(7), 70 - "s3c2440-i2c.7", NULL), 71 - OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI0, 72 - "exynos4210-spi.0", NULL), 73 - OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI1, 74 - "exynos4210-spi.1", NULL), 75 - OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI2, 76 - "exynos4210-spi.2", NULL), 77 - OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA0, "dma-pl330.0", NULL), 78 - OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA1, "dma-pl330.1", NULL), 79 - OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_MDMA1, "dma-pl330.2", NULL), 80 - OF_DEV_AUXDATA("samsung,exynos4210-tmu", EXYNOS4_PA_TMU, 81 - "exynos-tmu", NULL), 82 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13620000, 83 - "exynos-sysmmu.0", NULL), /* MFC_L */ 84 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13630000, 85 - "exynos-sysmmu.1", NULL), /* MFC_R */ 86 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E20000, 87 - "exynos-sysmmu.2", NULL), /* TV */ 88 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A60000, 89 - "exynos-sysmmu.3", NULL), /* JPEG */ 90 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12A30000, 91 - "exynos-sysmmu.4", NULL), /* ROTATOR */ 92 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A20000, 93 - "exynos-sysmmu.5", NULL), /* FIMC0 */ 94 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A30000, 95 - "exynos-sysmmu.6", NULL), /* FIMC1 */ 96 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A40000, 97 - "exynos-sysmmu.7", NULL), /* FIMC2 */ 98 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A50000, 99 - "exynos-sysmmu.8", NULL), /* FIMC3 */ 100 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12A20000, 101 - "exynos-sysmmu.9", NULL), /* G2D(4210) */ 102 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x10A40000, 103 - "exynos-sysmmu.9", NULL), /* G2D(4x12) */ 104 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11E20000, 105 - "exynos-sysmmu.10", NULL), /* FIMD0 */ 106 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12220000, 107 - "exynos-sysmmu.11", NULL), /* FIMD1(4210) */ 108 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12260000, 109 - "exynos-sysmmu.12", NULL), /* IS0(4x12) */ 110 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x122B0000, 111 - "exynos-sysmmu.13", NULL), /* IS1(4x12) */ 112 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x123B0000, 113 - "exynos-sysmmu.14", NULL), /* FIMC-LITE0(4x12) */ 114 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x123C0000, 115 - "exynos-sysmmu.15", NULL), /* FIMC-LITE1(4x12) */ 116 - {}, 117 - }; 118 25 119 26 static void __init exynos4_dt_map_io(void) 120 27 { 121 28 exynos_init_io(NULL, 0); 122 - s3c24xx_init_clocks(24000000); 123 29 } 124 30 125 31 static void __init exynos4_dt_machine_init(void) 126 32 { 127 - of_platform_populate(NULL, of_default_bus_match_table, 128 - exynos4_auxdata_lookup, NULL); 33 + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 129 34 } 130 35 131 36 static char const *exynos4_dt_compat[] __initdata = { ··· 40 135 NULL 41 136 }; 42 137 138 + static void __init exynos4_reserve(void) 139 + { 140 + #ifdef CONFIG_S5P_DEV_MFC 141 + struct s5p_mfc_dt_meminfo mfc_mem; 142 + 143 + /* Reserve memory for MFC only if it's available */ 144 + mfc_mem.compatible = "samsung,mfc-v5"; 145 + if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem)) 146 + s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff, 147 + mfc_mem.lsize); 148 + #endif 149 + } 43 150 DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") 44 151 /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ 45 152 .smp = smp_ops(exynos_smp_ops), ··· 59 142 .map_io = exynos4_dt_map_io, 60 143 .init_machine = exynos4_dt_machine_init, 61 144 .init_late = exynos_init_late, 62 - .init_time = exynos4_timer_init, 145 + .init_time = exynos_init_time, 63 146 .dt_compat = exynos4_dt_compat, 64 147 .restart = exynos4_restart, 148 + .reserve = exynos4_reserve, 65 149 MACHINE_END
+3 -138
arch/arm/mach-exynos/mach-exynos5-dt.c
··· 11 11 12 12 #include <linux/of_platform.h> 13 13 #include <linux/of_fdt.h> 14 - #include <linux/serial_core.h> 15 14 #include <linux/memblock.h> 16 15 #include <linux/io.h> 16 + #include <linux/clocksource.h> 17 17 18 18 #include <asm/mach/arch.h> 19 - #include <mach/map.h> 20 19 #include <mach/regs-pmu.h> 21 20 22 21 #include <plat/cpu.h> 23 - #include <plat/regs-serial.h> 24 22 #include <plat/mfc.h> 25 23 26 24 #include "common.h" 27 25 28 - /* 29 - * The following lookup table is used to override device names when devices 30 - * are registered from device tree. This is temporarily added to enable 31 - * device tree support addition for the EXYNOS5 architecture. 32 - * 33 - * For drivers that require platform data to be provided from the machine 34 - * file, a platform data pointer can also be supplied along with the 35 - * devices names. Usually, the platform data elements that cannot be parsed 36 - * from the device tree by the drivers (example: function pointers) are 37 - * supplied. But it should be noted that this is a temporary mechanism and 38 - * at some point, the drivers should be capable of parsing all the platform 39 - * data from the device tree. 40 - */ 41 - static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { 42 - OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0, 43 - "exynos4210-uart.0", NULL), 44 - OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1, 45 - "exynos4210-uart.1", NULL), 46 - OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2, 47 - "exynos4210-uart.2", NULL), 48 - OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3, 49 - "exynos4210-uart.3", NULL), 50 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0), 51 - "s3c2440-i2c.0", NULL), 52 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1), 53 - "s3c2440-i2c.1", NULL), 54 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2), 55 - "s3c2440-i2c.2", NULL), 56 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(3), 57 - "s3c2440-i2c.3", NULL), 58 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(4), 59 - "s3c2440-i2c.4", NULL), 60 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(5), 61 - "s3c2440-i2c.5", NULL), 62 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(6), 63 - "s3c2440-i2c.6", NULL), 64 - OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(7), 65 - "s3c2440-i2c.7", NULL), 66 - OF_DEV_AUXDATA("samsung,s3c2440-hdmiphy-i2c", EXYNOS5_PA_IIC(8), 67 - "s3c2440-hdmiphy-i2c", NULL), 68 - OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0, 69 - "dw_mmc.0", NULL), 70 - OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1, 71 - "dw_mmc.1", NULL), 72 - OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI2, 73 - "dw_mmc.2", NULL), 74 - OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI3, 75 - "dw_mmc.3", NULL), 76 - OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0, 77 - "exynos4210-spi.0", NULL), 78 - OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1, 79 - "exynos4210-spi.1", NULL), 80 - OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2, 81 - "exynos4210-spi.2", NULL), 82 - OF_DEV_AUXDATA("samsung,exynos5-sata-ahci", 0x122F0000, 83 - "exynos5-sata", NULL), 84 - OF_DEV_AUXDATA("samsung,exynos5-sata-phy", 0x12170000, 85 - "exynos5-sata-phy", NULL), 86 - OF_DEV_AUXDATA("samsung,exynos5-sata-phy-i2c", 0x121D0000, 87 - "exynos5-sata-phy-i2c", NULL), 88 - OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), 89 - OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL), 90 - OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL), 91 - OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0, 92 - "exynos-gsc.0", NULL), 93 - OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1, 94 - "exynos-gsc.1", NULL), 95 - OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2, 96 - "exynos-gsc.2", NULL), 97 - OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3, 98 - "exynos-gsc.3", NULL), 99 - OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000, 100 - "exynos5-hdmi", NULL), 101 - OF_DEV_AUXDATA("samsung,exynos5-mixer", 0x14450000, 102 - "exynos5-mixer", NULL), 103 - OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL), 104 - OF_DEV_AUXDATA("samsung,exynos5250-tmu", 0x10060000, 105 - "exynos-tmu", NULL), 106 - OF_DEV_AUXDATA("samsung,i2s-v5", 0x03830000, 107 - "samsung-i2s.0", NULL), 108 - OF_DEV_AUXDATA("samsung,i2s-v5", 0x12D60000, 109 - "samsung-i2s.1", NULL), 110 - OF_DEV_AUXDATA("samsung,i2s-v5", 0x12D70000, 111 - "samsung-i2s.2", NULL), 112 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11210000, 113 - "exynos-sysmmu.0", "mfc"), /* MFC_L */ 114 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11200000, 115 - "exynos-sysmmu.1", "mfc"), /* MFC_R */ 116 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x14650000, 117 - "exynos-sysmmu.2", NULL), /* TV */ 118 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11F20000, 119 - "exynos-sysmmu.3", "jpeg"), /* JPEG */ 120 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11D40000, 121 - "exynos-sysmmu.4", NULL), /* ROTATOR */ 122 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E80000, 123 - "exynos-sysmmu.5", "gscl"), /* GSCL0 */ 124 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E90000, 125 - "exynos-sysmmu.6", "gscl"), /* GSCL1 */ 126 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13EA0000, 127 - "exynos-sysmmu.7", "gscl"), /* GSCL2 */ 128 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13EB0000, 129 - "exynos-sysmmu.8", "gscl"), /* GSCL3 */ 130 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13260000, 131 - "exynos-sysmmu.9", NULL), /* FIMC-IS0 */ 132 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x132C0000, 133 - "exynos-sysmmu.10", NULL), /* FIMC-IS1 */ 134 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x14640000, 135 - "exynos-sysmmu.11", NULL), /* FIMD1 */ 136 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13C40000, 137 - "exynos-sysmmu.12", NULL), /* FIMC-LITE0 */ 138 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13C50000, 139 - "exynos-sysmmu.13", NULL), /* FIMC-LITE1 */ 140 - OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x10A60000, 141 - "exynos-sysmmu.14", NULL), /* G2D */ 142 - {}, 143 - }; 144 - 145 - static const struct of_dev_auxdata exynos5440_auxdata_lookup[] __initconst = { 146 - OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5440_PA_UART0, 147 - "exynos4210-uart.0", NULL), 148 - {}, 149 - }; 150 - 151 26 static void __init exynos5_dt_map_io(void) 152 27 { 153 - unsigned long root = of_get_flat_dt_root(); 154 - 155 28 exynos_init_io(NULL, 0); 156 - 157 - if (of_flat_dt_is_compatible(root, "samsung,exynos5250")) 158 - s3c24xx_init_clocks(24000000); 159 29 } 160 30 161 31 static void __init exynos5_dt_machine_init(void) ··· 52 182 } 53 183 } 54 184 55 - if (of_machine_is_compatible("samsung,exynos5250")) 56 - of_platform_populate(NULL, of_default_bus_match_table, 57 - exynos5250_auxdata_lookup, NULL); 58 - else if (of_machine_is_compatible("samsung,exynos5440")) 59 - of_platform_populate(NULL, of_default_bus_match_table, 60 - exynos5440_auxdata_lookup, NULL); 185 + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 61 186 } 62 187 63 188 static char const *exynos5_dt_compat[] __initdata = { ··· 81 216 .map_io = exynos5_dt_map_io, 82 217 .init_machine = exynos5_dt_machine_init, 83 218 .init_late = exynos_init_late, 84 - .init_time = exynos4_timer_init, 219 + .init_time = exynos_init_time, 85 220 .dt_compat = exynos5_dt_compat, 86 221 .restart = exynos5_restart, 87 222 .reserve = exynos5_reserve,
+3 -2
arch/arm/mach-exynos/mach-nuri.c
··· 1331 1331 static void __init nuri_map_io(void) 1332 1332 { 1333 1333 exynos_init_io(NULL, 0); 1334 - s3c24xx_init_clocks(clk_xusbxti.rate); 1335 1334 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs)); 1335 + xxti_f = 0; 1336 + xusbxti_f = 24000000; 1336 1337 } 1337 1338 1338 1339 static void __init nuri_reserve(void) ··· 1382 1381 .map_io = nuri_map_io, 1383 1382 .init_machine = nuri_machine_init, 1384 1383 .init_late = exynos_init_late, 1385 - .init_time = exynos4_timer_init, 1384 + .init_time = exynos_init_time, 1386 1385 .reserve = &nuri_reserve, 1387 1386 .restart = exynos4_restart, 1388 1387 MACHINE_END
+3 -2
arch/arm/mach-exynos/mach-origen.c
··· 755 755 static void __init origen_map_io(void) 756 756 { 757 757 exynos_init_io(NULL, 0); 758 - s3c24xx_init_clocks(clk_xusbxti.rate); 759 758 s3c24xx_init_uarts(origen_uartcfgs, ARRAY_SIZE(origen_uartcfgs)); 759 + xxti_f = 0; 760 + xusbxti_f = 24000000; 760 761 } 761 762 762 763 static void __init origen_power_init(void) ··· 817 816 .map_io = origen_map_io, 818 817 .init_machine = origen_machine_init, 819 818 .init_late = exynos_init_late, 820 - .init_time = exynos4_timer_init, 819 + .init_time = exynos_init_time, 821 820 .reserve = &origen_reserve, 822 821 .restart = exynos4_restart, 823 822 MACHINE_END
+2 -3
arch/arm/mach-exynos/mach-smdk4x12.c
··· 323 323 static void __init smdk4x12_map_io(void) 324 324 { 325 325 exynos_init_io(NULL, 0); 326 - s3c24xx_init_clocks(clk_xusbxti.rate); 327 326 s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs)); 328 327 } 329 328 ··· 376 377 .init_irq = exynos4_init_irq, 377 378 .map_io = smdk4x12_map_io, 378 379 .init_machine = smdk4x12_machine_init, 379 - .init_time = exynos4_timer_init, 380 + .init_time = exynos_init_time, 380 381 .restart = exynos4_restart, 381 382 .reserve = &smdk4x12_reserve, 382 383 MACHINE_END ··· 390 391 .map_io = smdk4x12_map_io, 391 392 .init_machine = smdk4x12_machine_init, 392 393 .init_late = exynos_init_late, 393 - .init_time = exynos4_timer_init, 394 + .init_time = exynos_init_time, 394 395 .restart = exynos4_restart, 395 396 .reserve = &smdk4x12_reserve, 396 397 MACHINE_END
+4 -3
arch/arm/mach-exynos/mach-smdkv310.c
··· 372 372 static void __init smdkv310_map_io(void) 373 373 { 374 374 exynos_init_io(NULL, 0); 375 - s3c24xx_init_clocks(clk_xusbxti.rate); 376 375 s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs)); 376 + xxti_f = 12000000; 377 + xusbxti_f = 24000000; 377 378 } 378 379 379 380 static void __init smdkv310_reserve(void) ··· 425 424 .init_irq = exynos4_init_irq, 426 425 .map_io = smdkv310_map_io, 427 426 .init_machine = smdkv310_machine_init, 428 - .init_time = exynos4_timer_init, 427 + .init_time = exynos_init_time, 429 428 .reserve = &smdkv310_reserve, 430 429 .restart = exynos4_restart, 431 430 MACHINE_END ··· 438 437 .map_io = smdkv310_map_io, 439 438 .init_machine = smdkv310_machine_init, 440 439 .init_late = exynos_init_late, 441 - .init_time = exynos4_timer_init, 440 + .init_time = exynos_init_time, 442 441 .reserve = &smdkv310_reserve, 443 442 .restart = exynos4_restart, 444 443 MACHINE_END
+5 -4
arch/arm/mach-exynos/mach-universal_c210.c
··· 41 41 #include <plat/mfc.h> 42 42 #include <plat/sdhci.h> 43 43 #include <plat/fimc-core.h> 44 - #include <plat/s5p-time.h> 44 + #include <plat/samsung-time.h> 45 45 #include <plat/camport.h> 46 46 47 47 #include <mach/map.h> ··· 1093 1093 static void __init universal_map_io(void) 1094 1094 { 1095 1095 exynos_init_io(NULL, 0); 1096 - s3c24xx_init_clocks(clk_xusbxti.rate); 1097 1096 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); 1098 - s5p_set_timer_source(S5P_PWM2, S5P_PWM4); 1097 + samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4); 1098 + xxti_f = 0; 1099 + xusbxti_f = 24000000; 1099 1100 } 1100 1101 1101 1102 static void s5p_tv_setup(void) ··· 1154 1153 .map_io = universal_map_io, 1155 1154 .init_machine = universal_machine_init, 1156 1155 .init_late = exynos_init_late, 1157 - .init_time = s5p_timer_init, 1156 + .init_time = samsung_timer_init, 1158 1157 .reserve = &universal_reserve, 1159 1158 .restart = exynos4_restart, 1160 1159 MACHINE_END
+151 -68
arch/arm/mach-exynos/mct.c drivers/clocksource/exynos_mct.c
··· 20 20 #include <linux/delay.h> 21 21 #include <linux/percpu.h> 22 22 #include <linux/of.h> 23 + #include <linux/of_irq.h> 24 + #include <linux/of_address.h> 25 + #include <linux/clocksource.h> 23 26 24 27 #include <asm/arch_timer.h> 25 28 #include <asm/localtimer.h> ··· 31 28 32 29 #include <mach/map.h> 33 30 #include <mach/irqs.h> 34 - #include <mach/regs-mct.h> 35 31 #include <asm/mach/time.h> 32 + 33 + #define EXYNOS4_MCTREG(x) (x) 34 + #define EXYNOS4_MCT_G_CNT_L EXYNOS4_MCTREG(0x100) 35 + #define EXYNOS4_MCT_G_CNT_U EXYNOS4_MCTREG(0x104) 36 + #define EXYNOS4_MCT_G_CNT_WSTAT EXYNOS4_MCTREG(0x110) 37 + #define EXYNOS4_MCT_G_COMP0_L EXYNOS4_MCTREG(0x200) 38 + #define EXYNOS4_MCT_G_COMP0_U EXYNOS4_MCTREG(0x204) 39 + #define EXYNOS4_MCT_G_COMP0_ADD_INCR EXYNOS4_MCTREG(0x208) 40 + #define EXYNOS4_MCT_G_TCON EXYNOS4_MCTREG(0x240) 41 + #define EXYNOS4_MCT_G_INT_CSTAT EXYNOS4_MCTREG(0x244) 42 + #define EXYNOS4_MCT_G_INT_ENB EXYNOS4_MCTREG(0x248) 43 + #define EXYNOS4_MCT_G_WSTAT EXYNOS4_MCTREG(0x24C) 44 + #define _EXYNOS4_MCT_L_BASE EXYNOS4_MCTREG(0x300) 45 + #define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * x)) 46 + #define EXYNOS4_MCT_L_MASK (0xffffff00) 47 + 48 + #define MCT_L_TCNTB_OFFSET (0x00) 49 + #define MCT_L_ICNTB_OFFSET (0x08) 50 + #define MCT_L_TCON_OFFSET (0x20) 51 + #define MCT_L_INT_CSTAT_OFFSET (0x30) 52 + #define MCT_L_INT_ENB_OFFSET (0x34) 53 + #define MCT_L_WSTAT_OFFSET (0x40) 54 + #define MCT_G_TCON_START (1 << 8) 55 + #define MCT_G_TCON_COMP0_AUTO_INC (1 << 1) 56 + #define MCT_G_TCON_COMP0_ENABLE (1 << 0) 57 + #define MCT_L_TCON_INTERVAL_MODE (1 << 2) 58 + #define MCT_L_TCON_INT_START (1 << 1) 59 + #define MCT_L_TCON_TIMER_START (1 << 0) 36 60 37 61 #define TICK_BASE_CNT 1 38 62 ··· 68 38 MCT_INT_PPI 69 39 }; 70 40 41 + enum { 42 + MCT_G0_IRQ, 43 + MCT_G1_IRQ, 44 + MCT_G2_IRQ, 45 + MCT_G3_IRQ, 46 + MCT_L0_IRQ, 47 + MCT_L1_IRQ, 48 + MCT_L2_IRQ, 49 + MCT_L3_IRQ, 50 + MCT_NR_IRQS, 51 + }; 52 + 53 + static void __iomem *reg_base; 71 54 static unsigned long clk_rate; 72 55 static unsigned int mct_int_type; 56 + static int mct_irqs[MCT_NR_IRQS]; 73 57 74 58 struct mct_clock_event_device { 75 59 struct clock_event_device *evt; 76 - void __iomem *base; 60 + unsigned long base; 77 61 char name[10]; 78 62 }; 79 63 80 - static void exynos4_mct_write(unsigned int value, void *addr) 64 + static void exynos4_mct_write(unsigned int value, unsigned long offset) 81 65 { 82 - void __iomem *stat_addr; 66 + unsigned long stat_addr; 83 67 u32 mask; 84 68 u32 i; 85 69 86 - __raw_writel(value, addr); 70 + __raw_writel(value, reg_base + offset); 87 71 88 - if (likely(addr >= EXYNOS4_MCT_L_BASE(0))) { 89 - u32 base = (u32) addr & EXYNOS4_MCT_L_MASK; 90 - switch ((u32) addr & ~EXYNOS4_MCT_L_MASK) { 91 - case (u32) MCT_L_TCON_OFFSET: 92 - stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; 72 + if (likely(offset >= EXYNOS4_MCT_L_BASE(0))) { 73 + stat_addr = (offset & ~EXYNOS4_MCT_L_MASK) + MCT_L_WSTAT_OFFSET; 74 + switch (offset & EXYNOS4_MCT_L_MASK) { 75 + case MCT_L_TCON_OFFSET: 93 76 mask = 1 << 3; /* L_TCON write status */ 94 77 break; 95 - case (u32) MCT_L_ICNTB_OFFSET: 96 - stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; 78 + case MCT_L_ICNTB_OFFSET: 97 79 mask = 1 << 1; /* L_ICNTB write status */ 98 80 break; 99 - case (u32) MCT_L_TCNTB_OFFSET: 100 - stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; 81 + case MCT_L_TCNTB_OFFSET: 101 82 mask = 1 << 0; /* L_TCNTB write status */ 102 83 break; 103 84 default: 104 85 return; 105 86 } 106 87 } else { 107 - switch ((u32) addr) { 108 - case (u32) EXYNOS4_MCT_G_TCON: 88 + switch (offset) { 89 + case EXYNOS4_MCT_G_TCON: 109 90 stat_addr = EXYNOS4_MCT_G_WSTAT; 110 91 mask = 1 << 16; /* G_TCON write status */ 111 92 break; 112 - case (u32) EXYNOS4_MCT_G_COMP0_L: 93 + case EXYNOS4_MCT_G_COMP0_L: 113 94 stat_addr = EXYNOS4_MCT_G_WSTAT; 114 95 mask = 1 << 0; /* G_COMP0_L write status */ 115 96 break; 116 - case (u32) EXYNOS4_MCT_G_COMP0_U: 97 + case EXYNOS4_MCT_G_COMP0_U: 117 98 stat_addr = EXYNOS4_MCT_G_WSTAT; 118 99 mask = 1 << 1; /* G_COMP0_U write status */ 119 100 break; 120 - case (u32) EXYNOS4_MCT_G_COMP0_ADD_INCR: 101 + case EXYNOS4_MCT_G_COMP0_ADD_INCR: 121 102 stat_addr = EXYNOS4_MCT_G_WSTAT; 122 103 mask = 1 << 2; /* G_COMP0_ADD_INCR w status */ 123 104 break; 124 - case (u32) EXYNOS4_MCT_G_CNT_L: 105 + case EXYNOS4_MCT_G_CNT_L: 125 106 stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; 126 107 mask = 1 << 0; /* G_CNT_L write status */ 127 108 break; 128 - case (u32) EXYNOS4_MCT_G_CNT_U: 109 + case EXYNOS4_MCT_G_CNT_U: 129 110 stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; 130 111 mask = 1 << 1; /* G_CNT_U write status */ 131 112 break; ··· 147 106 148 107 /* Wait maximum 1 ms until written values are applied */ 149 108 for (i = 0; i < loops_per_jiffy / 1000 * HZ; i++) 150 - if (__raw_readl(stat_addr) & mask) { 151 - __raw_writel(mask, stat_addr); 109 + if (__raw_readl(reg_base + stat_addr) & mask) { 110 + __raw_writel(mask, reg_base + stat_addr); 152 111 return; 153 112 } 154 113 155 - panic("MCT hangs after writing %d (addr:0x%08x)\n", value, (u32)addr); 114 + panic("MCT hangs after writing %d (offset:0x%lx)\n", value, offset); 156 115 } 157 116 158 117 /* Clocksource handling */ ··· 163 122 exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L); 164 123 exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U); 165 124 166 - reg = __raw_readl(EXYNOS4_MCT_G_TCON); 125 + reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); 167 126 reg |= MCT_G_TCON_START; 168 127 exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); 169 128 } ··· 171 130 static cycle_t exynos4_frc_read(struct clocksource *cs) 172 131 { 173 132 unsigned int lo, hi; 174 - u32 hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U); 133 + u32 hi2 = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_U); 175 134 176 135 do { 177 136 hi = hi2; 178 - lo = __raw_readl(EXYNOS4_MCT_G_CNT_L); 179 - hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U); 137 + lo = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_L); 138 + hi2 = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_U); 180 139 } while (hi != hi2); 181 140 182 141 return ((cycle_t)hi << 32) | lo; ··· 208 167 { 209 168 unsigned int tcon; 210 169 211 - tcon = __raw_readl(EXYNOS4_MCT_G_TCON); 170 + tcon = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); 212 171 tcon &= ~(MCT_G_TCON_COMP0_ENABLE | MCT_G_TCON_COMP0_AUTO_INC); 213 172 214 173 exynos4_mct_write(tcon, EXYNOS4_MCT_G_TCON); ··· 221 180 unsigned int tcon; 222 181 cycle_t comp_cycle; 223 182 224 - tcon = __raw_readl(EXYNOS4_MCT_G_TCON); 183 + tcon = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); 225 184 226 185 if (mode == CLOCK_EVT_MODE_PERIODIC) { 227 186 tcon |= MCT_G_TCON_COMP0_AUTO_INC; ··· 298 257 mct_comp_device.cpumask = cpumask_of(0); 299 258 clockevents_config_and_register(&mct_comp_device, clk_rate, 300 259 0xf, 0xffffffff); 301 - 302 - if (soc_is_exynos5250()) 303 - setup_irq(EXYNOS5_IRQ_MCT_G0, &mct_comp_event_irq); 304 - else 305 - setup_irq(EXYNOS4_IRQ_MCT_G0, &mct_comp_event_irq); 260 + setup_irq(mct_irqs[MCT_G0_IRQ], &mct_comp_event_irq); 306 261 } 307 262 308 263 #ifdef CONFIG_LOCAL_TIMERS ··· 310 273 { 311 274 unsigned long tmp; 312 275 unsigned long mask = MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START; 313 - void __iomem *addr = mevt->base + MCT_L_TCON_OFFSET; 276 + unsigned long offset = mevt->base + MCT_L_TCON_OFFSET; 314 277 315 - tmp = __raw_readl(addr); 278 + tmp = __raw_readl(reg_base + offset); 316 279 if (tmp & mask) { 317 280 tmp &= ~mask; 318 - exynos4_mct_write(tmp, addr); 281 + exynos4_mct_write(tmp, offset); 319 282 } 320 283 } 321 284 ··· 334 297 /* enable MCT tick interrupt */ 335 298 exynos4_mct_write(0x1, mevt->base + MCT_L_INT_ENB_OFFSET); 336 299 337 - tmp = __raw_readl(mevt->base + MCT_L_TCON_OFFSET); 300 + tmp = __raw_readl(reg_base + mevt->base + MCT_L_TCON_OFFSET); 338 301 tmp |= MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START | 339 302 MCT_L_TCON_INTERVAL_MODE; 340 303 exynos4_mct_write(tmp, mevt->base + MCT_L_TCON_OFFSET); ··· 386 349 exynos4_mct_tick_stop(mevt); 387 350 388 351 /* Clear the MCT tick interrupt */ 389 - if (__raw_readl(mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1) { 352 + if (__raw_readl(reg_base + mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1) { 390 353 exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET); 391 354 return 1; 392 355 } else { ··· 422 385 { 423 386 struct mct_clock_event_device *mevt; 424 387 unsigned int cpu = smp_processor_id(); 425 - int mct_lx_irq; 426 388 427 389 mevt = this_cpu_ptr(&percpu_mct_tick); 428 390 mevt->evt = evt; ··· 442 406 443 407 if (mct_int_type == MCT_INT_SPI) { 444 408 if (cpu == 0) { 445 - mct_lx_irq = soc_is_exynos4210() ? EXYNOS4_IRQ_MCT_L0 : 446 - EXYNOS5_IRQ_MCT_L0; 447 409 mct_tick0_event_irq.dev_id = mevt; 448 - evt->irq = mct_lx_irq; 449 - setup_irq(mct_lx_irq, &mct_tick0_event_irq); 410 + evt->irq = mct_irqs[MCT_L0_IRQ]; 411 + setup_irq(evt->irq, &mct_tick0_event_irq); 450 412 } else { 451 - mct_lx_irq = soc_is_exynos4210() ? EXYNOS4_IRQ_MCT_L1 : 452 - EXYNOS5_IRQ_MCT_L1; 453 413 mct_tick1_event_irq.dev_id = mevt; 454 - evt->irq = mct_lx_irq; 455 - setup_irq(mct_lx_irq, &mct_tick1_event_irq); 456 - irq_set_affinity(mct_lx_irq, cpumask_of(1)); 414 + evt->irq = mct_irqs[MCT_L1_IRQ]; 415 + setup_irq(evt->irq, &mct_tick1_event_irq); 416 + irq_set_affinity(evt->irq, cpumask_of(1)); 457 417 } 458 418 } else { 459 - enable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER, 0); 419 + enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0); 460 420 } 461 421 462 422 return 0; ··· 468 436 else 469 437 remove_irq(evt->irq, &mct_tick1_event_irq); 470 438 else 471 - disable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER); 439 + disable_percpu_irq(mct_irqs[MCT_L0_IRQ]); 472 440 } 473 441 474 442 static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = { ··· 477 445 }; 478 446 #endif /* CONFIG_LOCAL_TIMERS */ 479 447 480 - static void __init exynos4_timer_resources(void) 448 + static void __init exynos4_timer_resources(struct device_node *np, void __iomem *base) 481 449 { 482 - struct clk *mct_clk; 483 - mct_clk = clk_get(NULL, "xtal"); 450 + struct clk *mct_clk, *tick_clk; 484 451 485 - clk_rate = clk_get_rate(mct_clk); 452 + tick_clk = np ? of_clk_get_by_name(np, "fin_pll") : 453 + clk_get(NULL, "fin_pll"); 454 + if (IS_ERR(tick_clk)) 455 + panic("%s: unable to determine tick clock rate\n", __func__); 456 + clk_rate = clk_get_rate(tick_clk); 457 + 458 + mct_clk = np ? of_clk_get_by_name(np, "mct") : clk_get(NULL, "mct"); 459 + if (IS_ERR(mct_clk)) 460 + panic("%s: unable to retrieve mct clock instance\n", __func__); 461 + clk_prepare_enable(mct_clk); 462 + 463 + reg_base = base; 464 + if (!reg_base) 465 + panic("%s: unable to ioremap mct address space\n", __func__); 486 466 487 467 #ifdef CONFIG_LOCAL_TIMERS 488 468 if (mct_int_type == MCT_INT_PPI) { 489 469 int err; 490 470 491 - err = request_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER, 471 + err = request_percpu_irq(mct_irqs[MCT_L0_IRQ], 492 472 exynos4_mct_tick_isr, "MCT", 493 473 &percpu_mct_tick); 494 474 WARN(err, "MCT: can't request IRQ %d (%d)\n", 495 - EXYNOS_IRQ_MCT_LOCALTIMER, err); 475 + mct_irqs[MCT_L0_IRQ], err); 496 476 } 497 477 498 478 local_timer_register(&exynos4_mct_tick_ops); 499 479 #endif /* CONFIG_LOCAL_TIMERS */ 500 480 } 501 481 502 - void __init exynos4_timer_init(void) 482 + void __init mct_init(void) 503 483 { 504 - if (soc_is_exynos5440()) { 505 - arch_timer_of_register(); 506 - return; 484 + if (soc_is_exynos4210()) { 485 + mct_irqs[MCT_G0_IRQ] = EXYNOS4_IRQ_MCT_G0; 486 + mct_irqs[MCT_L0_IRQ] = EXYNOS4_IRQ_MCT_L0; 487 + mct_irqs[MCT_L1_IRQ] = EXYNOS4_IRQ_MCT_L1; 488 + mct_int_type = MCT_INT_SPI; 489 + } else { 490 + panic("unable to determine mct controller type\n"); 507 491 } 508 492 509 - if ((soc_is_exynos4210()) || (soc_is_exynos5250())) 510 - mct_int_type = MCT_INT_SPI; 511 - else 512 - mct_int_type = MCT_INT_PPI; 513 - 514 - exynos4_timer_resources(); 493 + exynos4_timer_resources(NULL, S5P_VA_SYSTIMER); 515 494 exynos4_clocksource_init(); 516 495 exynos4_clockevent_init(); 517 496 } 497 + 498 + static void __init mct_init_dt(struct device_node *np, unsigned int int_type) 499 + { 500 + u32 nr_irqs, i; 501 + 502 + mct_int_type = int_type; 503 + 504 + /* This driver uses only one global timer interrupt */ 505 + mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ); 506 + 507 + /* 508 + * Find out the number of local irqs specified. The local 509 + * timer irqs are specified after the four global timer 510 + * irqs are specified. 511 + */ 512 + #ifdef CONFIG_OF 513 + nr_irqs = of_irq_count(np); 514 + #else 515 + nr_irqs = 0; 516 + #endif 517 + for (i = MCT_L0_IRQ; i < nr_irqs; i++) 518 + mct_irqs[i] = irq_of_parse_and_map(np, i); 519 + 520 + exynos4_timer_resources(np, of_iomap(np, 0)); 521 + exynos4_clocksource_init(); 522 + exynos4_clockevent_init(); 523 + } 524 + 525 + 526 + static void __init mct_init_spi(struct device_node *np) 527 + { 528 + return mct_init_dt(np, MCT_INT_SPI); 529 + } 530 + 531 + static void __init mct_init_ppi(struct device_node *np) 532 + { 533 + return mct_init_dt(np, MCT_INT_PPI); 534 + } 535 + CLOCKSOURCE_OF_DECLARE(exynos4210, "samsung,exynos4210-mct", mct_init_spi); 536 + CLOCKSOURCE_OF_DECLARE(exynos4412, "samsung,exynos4412-mct", mct_init_ppi);
+15 -6
arch/arm/mach-omap2/board-3430sdp.c
··· 445 445 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); 446 446 } 447 447 448 + static struct usbhs_phy_data phy_data[] __initdata = { 449 + { 450 + .port = 1, 451 + .reset_gpio = 57, 452 + .vcc_gpio = -EINVAL, 453 + }, 454 + { 455 + .port = 2, 456 + .reset_gpio = 61, 457 + .vcc_gpio = -EINVAL, 458 + }, 459 + }; 460 + 448 461 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 449 462 450 463 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 451 464 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 452 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 453 - 454 - .phy_reset = true, 455 - .reset_gpio_port[0] = 57, 456 - .reset_gpio_port[1] = 61, 457 - .reset_gpio_port[2] = -EINVAL 458 465 }; 459 466 460 467 #ifdef CONFIG_OMAP_MUX ··· 613 606 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); 614 607 sdp3430_display_init(); 615 608 enable_board_wakeup_source(); 609 + 610 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 616 611 usbhs_init(&usbhs_bdata); 617 612 } 618 613
+15 -6
arch/arm/mach-omap2/board-3630sdp.c
··· 53 53 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); 54 54 } 55 55 56 + static struct usbhs_phy_data phy_data[] __initdata = { 57 + { 58 + .port = 1, 59 + .reset_gpio = 126, 60 + .vcc_gpio = -EINVAL, 61 + }, 62 + { 63 + .port = 2, 64 + .reset_gpio = 61, 65 + .vcc_gpio = -EINVAL, 66 + }, 67 + }; 68 + 56 69 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 57 70 58 71 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 59 72 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 60 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 61 - 62 - .phy_reset = true, 63 - .reset_gpio_port[0] = 126, 64 - .reset_gpio_port[1] = 61, 65 - .reset_gpio_port[2] = -EINVAL 66 73 }; 67 74 68 75 #ifdef CONFIG_OMAP_MUX ··· 206 199 board_smc91x_init(); 207 200 board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16); 208 201 enable_board_wakeup_source(); 202 + 203 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 209 204 usbhs_init(&usbhs_bdata); 210 205 } 211 206
+10 -14
arch/arm/mach-omap2/board-am3517crane.c
··· 47 47 }; 48 48 #endif 49 49 50 + static struct usbhs_phy_data phy_data[] __initdata = { 51 + { 52 + .port = 1, 53 + .reset_gpio = GPIO_USB_NRESET, 54 + .vcc_gpio = GPIO_USB_POWER, 55 + .vcc_polarity = 1, 56 + }, 57 + }; 58 + 50 59 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 51 60 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 52 - .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, 53 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 54 - 55 - .phy_reset = true, 56 - .reset_gpio_port[0] = GPIO_USB_NRESET, 57 - .reset_gpio_port[1] = -EINVAL, 58 - .reset_gpio_port[2] = -EINVAL 59 61 }; 60 62 61 63 static struct mtd_partition crane_nand_partitions[] = { ··· 133 131 return; 134 132 } 135 133 136 - ret = gpio_request_one(GPIO_USB_POWER, GPIOF_OUT_INIT_HIGH, 137 - "usb_ehci_enable"); 138 - if (ret < 0) { 139 - pr_err("Can not request GPIO %d\n", GPIO_USB_POWER); 140 - return; 141 - } 142 - 134 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 143 135 usbhs_init(&usbhs_bdata); 144 136 am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1); 145 137 }
+10 -7
arch/arm/mach-omap2/board-am3517evm.c
··· 273 273 omap_ctrl_writel(devconf0, OMAP2_CONTROL_DEVCONF0); 274 274 } 275 275 276 + static struct usbhs_phy_data phy_data[] __initdata = { 277 + { 278 + .port = 1, 279 + .reset_gpio = 57, 280 + .vcc_gpio = -EINVAL, 281 + }, 282 + }; 283 + 276 284 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 277 285 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 278 286 #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ ··· 289 281 #else 290 282 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 291 283 #endif 292 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 293 - 294 - .phy_reset = true, 295 - .reset_gpio_port[0] = 57, 296 - .reset_gpio_port[1] = -EINVAL, 297 - .reset_gpio_port[2] = -EINVAL 298 284 }; 299 285 300 286 #ifdef CONFIG_OMAP_MUX ··· 350 348 {} /* Terminator */ 351 349 }; 352 350 353 - 354 351 static void __init am3517_evm_init(void) 355 352 { 356 353 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); ··· 361 360 362 361 /* Configure GPIO for EHCI port */ 363 362 omap_mux_init_gpio(57, OMAP_PIN_OUTPUT); 363 + 364 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 364 365 usbhs_init(&usbhs_bdata); 365 366 am3517_evm_hecc_init(&am3517_evm_hecc_pdata); 366 367 /* DSS */
+14 -6
arch/arm/mach-omap2/board-cm-t35.c
··· 418 418 {} /* Terminator */ 419 419 }; 420 420 421 + static struct usbhs_phy_data phy_data[] __initdata = { 422 + { 423 + .port = 1, 424 + .reset_gpio = OMAP_MAX_GPIO_LINES + 6, 425 + .vcc_gpio = -EINVAL, 426 + }, 427 + { 428 + .port = 2, 429 + .reset_gpio = OMAP_MAX_GPIO_LINES + 7, 430 + .vcc_gpio = -EINVAL, 431 + }, 432 + }; 433 + 421 434 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 422 435 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 423 436 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 424 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 425 - 426 - .phy_reset = true, 427 - .reset_gpio_port[0] = OMAP_MAX_GPIO_LINES + 6, 428 - .reset_gpio_port[1] = OMAP_MAX_GPIO_LINES + 7, 429 - .reset_gpio_port[2] = -EINVAL 430 437 }; 431 438 432 439 static void __init cm_t35_init_usbh(void) ··· 450 443 msleep(1); 451 444 } 452 445 446 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 453 447 usbhs_init(&usbhs_bdata); 454 448 } 455 449
+15 -7
arch/arm/mach-omap2/board-cm-t3517.c
··· 188 188 #define HSUSB2_RESET_GPIO (147) 189 189 #define USB_HUB_RESET_GPIO (152) 190 190 191 + static struct usbhs_phy_data phy_data[] __initdata = { 192 + { 193 + .port = 1, 194 + .reset_gpio = HSUSB1_RESET_GPIO, 195 + .vcc_gpio = -EINVAL, 196 + }, 197 + { 198 + .port = 2, 199 + .reset_gpio = HSUSB2_RESET_GPIO, 200 + .vcc_gpio = -EINVAL, 201 + }, 202 + }; 203 + 191 204 static struct usbhs_omap_platform_data cm_t3517_ehci_pdata __initdata = { 192 205 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 193 206 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 194 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 195 - 196 - .phy_reset = true, 197 - .reset_gpio_port[0] = HSUSB1_RESET_GPIO, 198 - .reset_gpio_port[1] = HSUSB2_RESET_GPIO, 199 - .reset_gpio_port[2] = -EINVAL, 200 207 }; 201 208 202 209 static int __init cm_t3517_init_usbh(void) ··· 220 213 msleep(1); 221 214 } 222 215 216 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 223 217 usbhs_init(&cm_t3517_ehci_pdata); 224 218 225 219 return 0; ··· 332 324 .handle_irq = omap3_intc_handle_irq, 333 325 .init_machine = cm_t3517_init, 334 326 .init_late = am35xx_init_late, 335 - .init_time = omap3_gp_gptimer_timer_init, 327 + .init_time = omap3_gptimer_timer_init, 336 328 .restart = omap3xxx_restart, 337 329 MACHINE_END
-8
arch/arm/mach-omap2/board-devkit8000.c
··· 436 436 }; 437 437 438 438 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 439 - 440 439 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 441 - .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, 442 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 443 - 444 - .phy_reset = true, 445 - .reset_gpio_port[0] = -EINVAL, 446 - .reset_gpio_port[1] = -EINVAL, 447 - .reset_gpio_port[2] = -EINVAL 448 440 }; 449 441 450 442 #ifdef CONFIG_OMAP_MUX
+1 -1
arch/arm/mach-omap2/board-generic.c
··· 140 140 .init_irq = omap_intc_of_init, 141 141 .handle_irq = omap3_intc_handle_irq, 142 142 .init_machine = omap_generic_init, 143 - .init_time = omap3_am33xx_gptimer_timer_init, 143 + .init_time = omap3_gptimer_timer_init, 144 144 .dt_compat = am33xx_boards_compat, 145 145 .restart = am33xx_restart, 146 146 MACHINE_END
+18 -14
arch/arm/mach-omap2/board-igep0020.c
··· 527 527 omap3_pmic_init("twl4030", &igep_twldata); 528 528 } 529 529 530 + static struct usbhs_phy_data igep2_phy_data[] __initdata = { 531 + { 532 + .port = 1, 533 + .reset_gpio = IGEP2_GPIO_USBH_NRESET, 534 + .vcc_gpio = -EINVAL, 535 + }, 536 + }; 537 + 538 + static struct usbhs_phy_data igep3_phy_data[] __initdata = { 539 + { 540 + .port = 2, 541 + .reset_gpio = IGEP3_GPIO_USBH_NRESET, 542 + .vcc_gpio = -EINVAL, 543 + }, 544 + }; 545 + 530 546 static struct usbhs_omap_platform_data igep2_usbhs_bdata __initdata = { 531 547 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 532 - .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, 533 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 534 - 535 - .phy_reset = true, 536 - .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET, 537 - .reset_gpio_port[1] = -EINVAL, 538 - .reset_gpio_port[2] = -EINVAL, 539 548 }; 540 549 541 550 static struct usbhs_omap_platform_data igep3_usbhs_bdata __initdata = { 542 - .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 543 551 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 544 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 545 - 546 - .phy_reset = true, 547 - .reset_gpio_port[0] = -EINVAL, 548 - .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET, 549 - .reset_gpio_port[2] = -EINVAL, 550 552 }; 551 553 552 554 #ifdef CONFIG_OMAP_MUX ··· 644 642 if (machine_is_igep0020()) { 645 643 omap_display_init(&igep2_dss_data); 646 644 igep2_init_smsc911x(); 645 + usbhs_init_phys(igep2_phy_data, ARRAY_SIZE(igep2_phy_data)); 647 646 usbhs_init(&igep2_usbhs_bdata); 648 647 } else { 648 + usbhs_init_phys(igep3_phy_data, ARRAY_SIZE(igep3_phy_data)); 649 649 usbhs_init(&igep3_usbhs_bdata); 650 650 } 651 651 }
+22 -10
arch/arm/mach-omap2/board-omap3beagle.c
··· 33 33 #include <linux/mtd/nand.h> 34 34 #include <linux/mmc/host.h> 35 35 #include <linux/usb/phy.h> 36 + #include <linux/usb/nop-usb-xceiv.h> 36 37 37 38 #include <linux/regulator/machine.h> 38 39 #include <linux/i2c/twl.h> ··· 278 277 279 278 static struct gpio_led gpio_leds[]; 280 279 280 + /* PHY's VCC regulator might be added later, so flag that we need it */ 281 + static struct nop_usb_xceiv_platform_data hsusb2_phy_data = { 282 + .needs_vcc = true, 283 + }; 284 + 285 + static struct usbhs_phy_data phy_data[] = { 286 + { 287 + .port = 2, 288 + .reset_gpio = 147, 289 + .vcc_gpio = -1, /* updated in beagle_twl_gpio_setup */ 290 + .vcc_polarity = 1, /* updated in beagle_twl_gpio_setup */ 291 + .platform_data = &hsusb2_phy_data, 292 + }, 293 + }; 294 + 281 295 static int beagle_twl_gpio_setup(struct device *dev, 282 296 unsigned gpio, unsigned ngpio) 283 297 { ··· 334 318 } 335 319 dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio; 336 320 337 - gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level, 338 - "nEN_USB_PWR"); 321 + /* TWL4030_GPIO_MAX i.e. LED_GPO controls HS USB Port 2 power */ 322 + phy_data[0].vcc_gpio = gpio + TWL4030_GPIO_MAX; 323 + phy_data[0].vcc_polarity = beagle_config.usb_pwr_level; 339 324 325 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 340 326 return 0; 341 327 } 342 328 ··· 471 453 }; 472 454 473 455 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 474 - 475 - .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 476 456 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 477 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 478 - 479 - .phy_reset = true, 480 - .reset_gpio_port[0] = -EINVAL, 481 - .reset_gpio_port[1] = 147, 482 - .reset_gpio_port[2] = -EINVAL 483 457 }; 484 458 485 459 #ifdef CONFIG_OMAP_MUX ··· 553 543 554 544 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 555 545 usb_musb_init(NULL); 546 + 556 547 usbhs_init(&usbhs_bdata); 548 + 557 549 board_nand_init(omap3beagle_nand_partitions, 558 550 ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS, 559 551 NAND_BUSWIDTH_16, NULL);
+13 -12
arch/arm/mach-omap2/board-omap3evm.c
··· 496 496 static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = { 497 497 REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"), /* OMAP ISP */ 498 498 REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"), /* OMAP ISP */ 499 - REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"), 499 + REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.2"), /* hsusb port 2 */ 500 500 REGULATOR_SUPPLY("vaux2", NULL), 501 501 }; 502 502 ··· 539 539 return 0; 540 540 } 541 541 542 + static struct usbhs_phy_data phy_data[] __initdata = { 543 + { 544 + .port = 2, 545 + .reset_gpio = -1, /* set at runtime */ 546 + .vcc_gpio = -EINVAL, 547 + }, 548 + }; 549 + 542 550 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 543 - 544 - .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 545 551 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 546 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 547 - 548 - .phy_reset = true, 549 - /* PHY reset GPIO will be runtime programmed based on EVM version */ 550 - .reset_gpio_port[0] = -EINVAL, 551 - .reset_gpio_port[1] = -EINVAL, 552 - .reset_gpio_port[2] = -EINVAL 553 552 }; 554 553 555 554 #ifdef CONFIG_OMAP_MUX ··· 724 725 725 726 /* setup EHCI phy reset config */ 726 727 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); 727 - usbhs_bdata.reset_gpio_port[1] = 21; 728 + phy_data[0].reset_gpio = 21; 728 729 729 730 /* EVM REV >= E can supply 500mA with EXTVBUS programming */ 730 731 musb_board_data.power = 500; ··· 732 733 } else { 733 734 /* setup EHCI phy reset on MDC */ 734 735 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT); 735 - usbhs_bdata.reset_gpio_port[1] = 135; 736 + phy_data[0].reset_gpio = 135; 736 737 } 737 738 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 738 739 usb_musb_init(&musb_board_data); 740 + 741 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 739 742 usbhs_init(&usbhs_bdata); 740 743 board_nand_init(omap3evm_nand_partitions, 741 744 ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS,
+12 -9
arch/arm/mach-omap2/board-omap3pandora.c
··· 346 346 }; 347 347 348 348 static struct regulator_consumer_supply pandora_usb_phy_supply[] = { 349 - REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"), 349 + REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.2"), /* hsusb port 2 */ 350 350 }; 351 351 352 352 /* ads7846 on SPI and 2 nub controllers on I2C */ ··· 561 561 printk(KERN_ERR "wl1251 board initialisation failed\n"); 562 562 } 563 563 564 + static struct usbhs_phy_data phy_data[] __initdata = { 565 + { 566 + .port = 2, 567 + .reset_gpio = 16, 568 + .vcc_gpio = -EINVAL, 569 + }, 570 + }; 571 + 564 572 static struct platform_device *omap3pandora_devices[] __initdata = { 565 573 &pandora_leds_gpio, 566 574 &pandora_keys_gpio, ··· 577 569 }; 578 570 579 571 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 580 - 581 - .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 582 572 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 583 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 584 - 585 - .phy_reset = true, 586 - .reset_gpio_port[0] = -EINVAL, 587 - .reset_gpio_port[1] = 16, 588 - .reset_gpio_port[2] = -EINVAL 589 573 }; 590 574 591 575 #ifdef CONFIG_OMAP_MUX ··· 601 601 spi_register_board_info(omap3pandora_spi_board_info, 602 602 ARRAY_SIZE(omap3pandora_spi_board_info)); 603 603 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); 604 + 605 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 604 606 usbhs_init(&usbhs_bdata); 607 + 605 608 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 606 609 usb_musb_init(NULL); 607 610 gpmc_nand_init(&pandora_nand_data, NULL);
+10 -7
arch/arm/mach-omap2/board-omap3stalker.c
··· 357 357 358 358 #define OMAP3_STALKER_TS_GPIO 175 359 359 360 + static struct usbhs_phy_data phy_data[] __initdata = { 361 + { 362 + .port = 2, 363 + .reset_gpio = 21, 364 + .vcc_gpio = -EINVAL, 365 + }, 366 + }; 367 + 360 368 static struct platform_device *omap3_stalker_devices[] __initdata = { 361 369 &keys_gpio, 362 370 }; 363 371 364 372 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 365 - .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 366 373 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 367 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 368 - 369 - .phy_reset = true, 370 - .reset_gpio_port[0] = -EINVAL, 371 - .reset_gpio_port[1] = 21, 372 - .reset_gpio_port[2] = -EINVAL, 373 374 }; 374 375 375 376 #ifdef CONFIG_OMAP_MUX ··· 407 406 omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL); 408 407 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 409 408 usb_musb_init(NULL); 409 + 410 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 410 411 usbhs_init(&usbhs_bdata); 411 412 omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL); 412 413
+10 -7
arch/arm/mach-omap2/board-omap3touchbook.c
··· 305 305 }; 306 306 #endif 307 307 308 + static struct usbhs_phy_data phy_data[] __initdata = { 309 + { 310 + .port = 2, 311 + .reset_gpio = 147, 312 + .vcc_gpio = -EINVAL, 313 + }, 314 + }; 315 + 308 316 static struct platform_device *omap3_touchbook_devices[] __initdata = { 309 317 &leds_gpio, 310 318 &keys_gpio, 311 319 }; 312 320 313 321 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 314 - 315 322 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 316 323 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 317 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 318 - 319 - .phy_reset = true, 320 - .reset_gpio_port[0] = -EINVAL, 321 - .reset_gpio_port[1] = 147, 322 - .reset_gpio_port[2] = -EINVAL 323 324 }; 324 325 325 326 static void omap3_touchbook_poweroff(void) ··· 369 368 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); 370 369 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 371 370 usb_musb_init(NULL); 371 + 372 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 372 373 usbhs_init(&usbhs_bdata); 373 374 board_nand_init(omap3touchbook_nand_partitions, 374 375 ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS,
+21 -34
arch/arm/mach-omap2/board-omap4panda.c
··· 31 31 #include <linux/ti_wilink_st.h> 32 32 #include <linux/usb/musb.h> 33 33 #include <linux/usb/phy.h> 34 + #include <linux/usb/nop-usb-xceiv.h> 34 35 #include <linux/wl12xx.h> 35 36 #include <linux/irqchip/arm-gic.h> 36 37 #include <linux/platform_data/omap-abe-twl6040.h> ··· 133 132 .id = -1, 134 133 }; 135 134 135 + /* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */ 136 + static struct nop_usb_xceiv_platform_data hsusb1_phy_data = { 137 + /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ 138 + .clk_rate = 19200000, 139 + }; 140 + 141 + static struct usbhs_phy_data phy_data[] __initdata = { 142 + { 143 + .port = 1, 144 + .reset_gpio = GPIO_HUB_NRESET, 145 + .vcc_gpio = GPIO_HUB_POWER, 146 + .vcc_polarity = 1, 147 + .platform_data = &hsusb1_phy_data, 148 + }, 149 + }; 150 + 136 151 static struct platform_device *panda_devices[] __initdata = { 137 152 &leds_gpio, 138 153 &wl1271_device, ··· 159 142 160 143 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 161 144 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 162 - .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, 163 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 164 - .phy_reset = false, 165 - .reset_gpio_port[0] = -EINVAL, 166 - .reset_gpio_port[1] = -EINVAL, 167 - .reset_gpio_port[2] = -EINVAL 168 - }; 169 - 170 - static struct gpio panda_ehci_gpios[] __initdata = { 171 - { GPIO_HUB_POWER, GPIOF_OUT_INIT_LOW, "hub_power" }, 172 - { GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" }, 173 145 }; 174 146 175 147 static void __init omap4_ehci_init(void) 176 148 { 177 149 int ret; 178 - struct clk *phy_ref_clk; 179 150 180 151 /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ 181 - phy_ref_clk = clk_get(NULL, "auxclk3_ck"); 182 - if (IS_ERR(phy_ref_clk)) { 183 - pr_err("Cannot request auxclk3\n"); 184 - return; 185 - } 186 - clk_set_rate(phy_ref_clk, 19200000); 187 - clk_prepare_enable(phy_ref_clk); 152 + ret = clk_add_alias("main_clk", "nop_usb_xceiv.1", "auxclk3_ck", NULL); 153 + if (ret) 154 + pr_err("Failed to add main_clk alias to auxclk3_ck\n"); 188 155 189 - /* disable the power to the usb hub prior to init and reset phy+hub */ 190 - ret = gpio_request_array(panda_ehci_gpios, 191 - ARRAY_SIZE(panda_ehci_gpios)); 192 - if (ret) { 193 - pr_err("Unable to initialize EHCI power/reset\n"); 194 - return; 195 - } 196 - 197 - gpio_export(GPIO_HUB_POWER, 0); 198 - gpio_export(GPIO_HUB_NRESET, 0); 199 - gpio_set_value(GPIO_HUB_NRESET, 1); 200 - 156 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 201 157 usbhs_init(&usbhs_bdata); 202 - 203 - /* enable power to hub */ 204 - gpio_set_value(GPIO_HUB_POWER, 1); 205 158 } 206 159 207 160 static struct omap_musb_board_data musb_board_data = {
+10 -6
arch/arm/mach-omap2/board-overo.c
··· 457 457 return 0; 458 458 } 459 459 460 + static struct usbhs_phy_data phy_data[] __initdata = { 461 + { 462 + .port = 2, 463 + .reset_gpio = OVERO_GPIO_USBH_NRESET, 464 + .vcc_gpio = -EINVAL, 465 + }, 466 + }; 467 + 460 468 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 461 - .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 462 469 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 463 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 464 - .phy_reset = true, 465 - .reset_gpio_port[0] = -EINVAL, 466 - .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET, 467 - .reset_gpio_port[2] = -EINVAL 468 470 }; 469 471 470 472 #ifdef CONFIG_OMAP_MUX ··· 503 501 ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL); 504 502 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 505 503 usb_musb_init(NULL); 504 + 505 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 506 506 usbhs_init(&usbhs_bdata); 507 507 overo_spi_init(); 508 508 overo_init_smsc911x();
+10 -6
arch/arm/mach-omap2/board-zoom.c
··· 92 92 }, 93 93 }; 94 94 95 + static struct usbhs_phy_data phy_data[] __initdata = { 96 + { 97 + .port = 2, 98 + .reset_gpio = ZOOM3_EHCI_RESET_GPIO, 99 + .vcc_gpio = -EINVAL, 100 + }, 101 + }; 102 + 95 103 static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 96 - .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 97 104 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 98 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 99 - .phy_reset = true, 100 - .reset_gpio_port[0] = -EINVAL, 101 - .reset_gpio_port[1] = ZOOM3_EHCI_RESET_GPIO, 102 - .reset_gpio_port[2] = -EINVAL, 103 105 }; 104 106 105 107 static void __init omap_zoom_init(void) ··· 111 109 } else if (machine_is_omap_zoom3()) { 112 110 omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); 113 111 omap_mux_init_gpio(ZOOM3_EHCI_RESET_GPIO, OMAP_PIN_OUTPUT); 112 + 113 + usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); 114 114 usbhs_init(&usbhs_bdata); 115 115 } 116 116
+1 -2
arch/arm/mach-omap2/common.h
··· 82 82 extern void omap2_sync32k_timer_init(void); 83 83 extern void omap3_sync32k_timer_init(void); 84 84 extern void omap3_secure_sync32k_timer_init(void); 85 - extern void omap3_gp_gptimer_timer_init(void); 86 - extern void omap3_am33xx_gptimer_timer_init(void); 85 + extern void omap3_gptimer_timer_init(void); 87 86 extern void omap4_local_timer_init(void); 88 87 extern void omap5_realtime_timer_init(void); 89 88
+29 -13
arch/arm/mach-omap2/gpmc-nand.c
··· 74 74 t.cs_wr_off = gpmc_t->cs_wr_off; 75 75 t.wr_cycle = gpmc_t->wr_cycle; 76 76 77 - /* Configure GPMC */ 78 - if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) 79 - gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_DEV_SIZE, 1); 80 - else 81 - gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_DEV_SIZE, 0); 82 - gpmc_cs_configure(gpmc_nand_data->cs, 83 - GPMC_CONFIG_DEV_TYPE, GPMC_DEVICETYPE_NAND); 84 - gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_WP, 0); 85 77 err = gpmc_cs_set_timings(gpmc_nand_data->cs, &t); 86 78 if (err) 87 79 return err; ··· 107 115 struct gpmc_timings *gpmc_t) 108 116 { 109 117 int err = 0; 118 + struct gpmc_settings s; 110 119 struct device *dev = &gpmc_nand_device.dev; 120 + 121 + memset(&s, 0, sizeof(struct gpmc_settings)); 111 122 112 123 gpmc_nand_device.dev.platform_data = gpmc_nand_data; 113 124 114 125 err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE, 115 126 (unsigned long *)&gpmc_nand_resource[0].start); 116 127 if (err < 0) { 117 - dev_err(dev, "Cannot request GPMC CS\n"); 128 + dev_err(dev, "Cannot request GPMC CS %d, error %d\n", 129 + gpmc_nand_data->cs, err); 118 130 return err; 119 131 } 120 132 ··· 136 140 dev_err(dev, "Unable to set gpmc timings: %d\n", err); 137 141 return err; 138 142 } 139 - } 140 143 141 - /* Enable RD PIN Monitoring Reg */ 142 - if (gpmc_nand_data->dev_ready) { 143 - gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_RDY_BSY, 1); 144 + if (gpmc_nand_data->of_node) { 145 + gpmc_read_settings_dt(gpmc_nand_data->of_node, &s); 146 + } else { 147 + s.device_nand = true; 148 + 149 + /* Enable RD PIN Monitoring Reg */ 150 + if (gpmc_nand_data->dev_ready) { 151 + s.wait_on_read = true; 152 + s.wait_on_write = true; 153 + } 154 + } 155 + 156 + if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) 157 + s.device_width = GPMC_DEVWIDTH_16BIT; 158 + else 159 + s.device_width = GPMC_DEVWIDTH_8BIT; 160 + 161 + err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s); 162 + if (err < 0) 163 + goto out_free_cs; 164 + 165 + err = gpmc_configure(GPMC_CONFIG_WP, 0); 166 + if (err < 0) 167 + goto out_free_cs; 144 168 } 145 169 146 170 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
+59 -59
arch/arm/mach-omap2/gpmc-onenand.c
··· 47 47 .resource = &gpmc_onenand_resource, 48 48 }; 49 49 50 - static struct gpmc_timings omap2_onenand_calc_async_timings(void) 50 + static struct gpmc_settings onenand_async = { 51 + .device_width = GPMC_DEVWIDTH_16BIT, 52 + .mux_add_data = GPMC_MUX_AD, 53 + }; 54 + 55 + static struct gpmc_settings onenand_sync = { 56 + .burst_read = true, 57 + .burst_wrap = true, 58 + .burst_len = GPMC_BURST_16, 59 + .device_width = GPMC_DEVWIDTH_16BIT, 60 + .mux_add_data = GPMC_MUX_AD, 61 + .wait_pin = 0, 62 + }; 63 + 64 + static void omap2_onenand_calc_async_timings(struct gpmc_timings *t) 51 65 { 52 66 struct gpmc_device_timings dev_t; 53 - struct gpmc_timings t; 54 - 55 67 const int t_cer = 15; 56 68 const int t_avdp = 12; 57 69 const int t_aavdh = 7; ··· 76 64 77 65 memset(&dev_t, 0, sizeof(dev_t)); 78 66 79 - dev_t.mux = true; 80 67 dev_t.t_avdp_r = max_t(int, t_avdp, t_cer) * 1000; 81 68 dev_t.t_avdp_w = dev_t.t_avdp_r; 82 69 dev_t.t_aavdh = t_aavdh * 1000; ··· 87 76 dev_t.t_wpl = t_wpl * 1000; 88 77 dev_t.t_wph = t_wph * 1000; 89 78 90 - gpmc_calc_timings(&t, &dev_t); 91 - 92 - return t; 93 - } 94 - 95 - static int gpmc_set_async_mode(int cs, struct gpmc_timings *t) 96 - { 97 - /* Configure GPMC for asynchronous read */ 98 - gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, 99 - GPMC_CONFIG1_DEVICESIZE_16 | 100 - GPMC_CONFIG1_MUXADDDATA); 101 - 102 - return gpmc_cs_set_timings(cs, t); 79 + gpmc_calc_timings(t, &onenand_async, &dev_t); 103 80 } 104 81 105 82 static void omap2_onenand_set_async_mode(void __iomem *onenand_base) ··· 157 158 return freq; 158 159 } 159 160 160 - static struct gpmc_timings 161 - omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg, 162 - int freq) 161 + static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t, 162 + unsigned int flags, 163 + int freq) 163 164 { 164 165 struct gpmc_device_timings dev_t; 165 - struct gpmc_timings t; 166 166 const int t_cer = 15; 167 167 const int t_avdp = 12; 168 168 const int t_cez = 20; /* max of t_cez, t_oez */ ··· 170 172 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; 171 173 int div, gpmc_clk_ns; 172 174 173 - if (cfg->flags & ONENAND_SYNC_READ) 175 + if (flags & ONENAND_SYNC_READ) 174 176 onenand_flags = ONENAND_FLAG_SYNCREAD; 175 - else if (cfg->flags & ONENAND_SYNC_READWRITE) 177 + else if (flags & ONENAND_SYNC_READWRITE) 176 178 onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE; 177 179 178 180 switch (freq) { ··· 237 239 /* Set synchronous read timings */ 238 240 memset(&dev_t, 0, sizeof(dev_t)); 239 241 240 - dev_t.mux = true; 241 - dev_t.sync_read = true; 242 + if (onenand_flags & ONENAND_FLAG_SYNCREAD) 243 + onenand_sync.sync_read = true; 242 244 if (onenand_flags & ONENAND_FLAG_SYNCWRITE) { 243 - dev_t.sync_write = true; 245 + onenand_sync.sync_write = true; 246 + onenand_sync.burst_write = true; 244 247 } else { 245 248 dev_t.t_avdp_w = max(t_avdp, t_cer) * 1000; 246 249 dev_t.t_wpl = t_wpl * 1000; ··· 264 265 dev_t.cyc_aavdh_oe = 1; 265 266 dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period; 266 267 267 - gpmc_calc_timings(&t, &dev_t); 268 - 269 - return t; 270 - } 271 - 272 - static int gpmc_set_sync_mode(int cs, struct gpmc_timings *t) 273 - { 274 - unsigned sync_read = onenand_flags & ONENAND_FLAG_SYNCREAD; 275 - unsigned sync_write = onenand_flags & ONENAND_FLAG_SYNCWRITE; 276 - 277 - /* Configure GPMC for synchronous read */ 278 - gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, 279 - GPMC_CONFIG1_WRAPBURST_SUPP | 280 - GPMC_CONFIG1_READMULTIPLE_SUPP | 281 - (sync_read ? GPMC_CONFIG1_READTYPE_SYNC : 0) | 282 - (sync_write ? GPMC_CONFIG1_WRITEMULTIPLE_SUPP : 0) | 283 - (sync_write ? GPMC_CONFIG1_WRITETYPE_SYNC : 0) | 284 - GPMC_CONFIG1_PAGE_LEN(2) | 285 - (cpu_is_omap34xx() ? 0 : 286 - (GPMC_CONFIG1_WAIT_READ_MON | 287 - GPMC_CONFIG1_WAIT_PIN_SEL(0))) | 288 - GPMC_CONFIG1_DEVICESIZE_16 | 289 - GPMC_CONFIG1_DEVICETYPE_NOR | 290 - GPMC_CONFIG1_MUXADDDATA); 291 - 292 - return gpmc_cs_set_timings(cs, t); 268 + gpmc_calc_timings(t, &onenand_sync, &dev_t); 293 269 } 294 270 295 271 static int omap2_onenand_setup_async(void __iomem *onenand_base) ··· 272 298 struct gpmc_timings t; 273 299 int ret; 274 300 301 + if (gpmc_onenand_data->of_node) 302 + gpmc_read_settings_dt(gpmc_onenand_data->of_node, 303 + &onenand_async); 304 + 275 305 omap2_onenand_set_async_mode(onenand_base); 276 306 277 - t = omap2_onenand_calc_async_timings(); 307 + omap2_onenand_calc_async_timings(&t); 278 308 279 - ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t); 309 + ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_async); 310 + if (ret < 0) 311 + return ret; 312 + 313 + ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t); 280 314 if (ret < 0) 281 315 return ret; 282 316 ··· 304 322 set_onenand_cfg(onenand_base); 305 323 } 306 324 307 - t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq); 325 + if (gpmc_onenand_data->of_node) { 326 + gpmc_read_settings_dt(gpmc_onenand_data->of_node, 327 + &onenand_sync); 328 + } else { 329 + /* 330 + * FIXME: Appears to be legacy code from initial ONENAND commit. 331 + * Unclear what boards this is for and if this can be removed. 332 + */ 333 + if (!cpu_is_omap34xx()) 334 + onenand_sync.wait_on_read = true; 335 + } 308 336 309 - ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t); 337 + omap2_onenand_calc_sync_timings(&t, gpmc_onenand_data->flags, freq); 338 + 339 + ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_sync); 340 + if (ret < 0) 341 + return ret; 342 + 343 + ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t); 310 344 if (ret < 0) 311 345 return ret; 312 346 ··· 357 359 void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) 358 360 { 359 361 int err; 362 + struct device *dev = &gpmc_onenand_device.dev; 360 363 361 364 gpmc_onenand_data = _onenand_data; 362 365 gpmc_onenand_data->onenand_setup = gpmc_onenand_setup; ··· 365 366 366 367 if (cpu_is_omap24xx() && 367 368 (gpmc_onenand_data->flags & ONENAND_SYNC_READWRITE)) { 368 - printk(KERN_ERR "Onenand using only SYNC_READ on 24xx\n"); 369 + dev_warn(dev, "OneNAND using only SYNC_READ on 24xx\n"); 369 370 gpmc_onenand_data->flags &= ~ONENAND_SYNC_READWRITE; 370 371 gpmc_onenand_data->flags |= ONENAND_SYNC_READ; 371 372 } ··· 378 379 err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE, 379 380 (unsigned long *)&gpmc_onenand_resource.start); 380 381 if (err < 0) { 381 - pr_err("%s: Cannot request GPMC CS\n", __func__); 382 + dev_err(dev, "Cannot request GPMC CS %d, error %d\n", 383 + gpmc_onenand_data->cs, err); 382 384 return; 383 385 } 384 386 ··· 387 387 ONENAND_IO_SIZE - 1; 388 388 389 389 if (platform_device_register(&gpmc_onenand_device) < 0) { 390 - pr_err("%s: Unable to register OneNAND device\n", __func__); 390 + dev_err(dev, "Unable to register OneNAND device\n"); 391 391 gpmc_cs_free(gpmc_onenand_data->cs); 392 392 return; 393 393 }
+17 -13
arch/arm/mach-omap2/gpmc-smc91x.c
··· 49 49 .resource = gpmc_smc91x_resources, 50 50 }; 51 51 52 + static struct gpmc_settings smc91x_settings = { 53 + .device_width = GPMC_DEVWIDTH_16BIT, 54 + }; 55 + 52 56 /* 53 57 * Set the gpmc timings for smc91c96. The timings are taken 54 58 * from the data sheet available at: ··· 71 67 const int t7 = 5; /* Figure 12.4 write */ 72 68 const int t8 = 5; /* Figure 12.4 write */ 73 69 const int t20 = 185; /* Figure 12.2 read and 12.4 write */ 74 - u32 l; 75 - 76 - l = GPMC_CONFIG1_DEVICESIZE_16; 77 - if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA) 78 - l |= GPMC_CONFIG1_MUXADDDATA; 79 - if (gpmc_cfg->flags & GPMC_READ_MON) 80 - l |= GPMC_CONFIG1_WAIT_READ_MON; 81 - if (gpmc_cfg->flags & GPMC_WRITE_MON) 82 - l |= GPMC_CONFIG1_WAIT_WRITE_MON; 83 - if (gpmc_cfg->wait_pin) 84 - l |= GPMC_CONFIG1_WAIT_PIN_SEL(gpmc_cfg->wait_pin); 85 - gpmc_cs_write_reg(gpmc_cfg->cs, GPMC_CS_CONFIG1, l); 86 70 87 71 /* 88 72 * FIXME: Calculate the address and data bus muxed timings. ··· 96 104 dev_t.t_cez_w = t4_w * 1000; 97 105 dev_t.t_wr_cycle = (t20 - t3) * 1000; 98 106 99 - gpmc_calc_timings(&t, &dev_t); 107 + gpmc_calc_timings(&t, &smc91x_settings, &dev_t); 100 108 101 109 return gpmc_cs_set_timings(gpmc_cfg->cs, &t); 102 110 } ··· 124 132 gpmc_smc91x_resources[0].start = cs_mem_base + 0x300; 125 133 gpmc_smc91x_resources[0].end = cs_mem_base + 0x30f; 126 134 gpmc_smc91x_resources[1].flags |= (gpmc_cfg->flags & IRQF_TRIGGER_MASK); 135 + 136 + if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA) 137 + smc91x_settings.mux_add_data = GPMC_MUX_AD; 138 + if (gpmc_cfg->flags & GPMC_READ_MON) 139 + smc91x_settings.wait_on_read = true; 140 + if (gpmc_cfg->flags & GPMC_WRITE_MON) 141 + smc91x_settings.wait_on_write = true; 142 + if (gpmc_cfg->wait_pin) 143 + smc91x_settings.wait_pin = gpmc_cfg->wait_pin; 144 + ret = gpmc_cs_program_settings(gpmc_cfg->cs, &smc91x_settings); 145 + if (ret < 0) 146 + goto free1; 127 147 128 148 if (gpmc_cfg->retime) { 129 149 ret = gpmc_cfg->retime();
+391 -147
arch/arm/mach-omap2/gpmc.c
··· 26 26 #include <linux/interrupt.h> 27 27 #include <linux/platform_device.h> 28 28 #include <linux/of.h> 29 + #include <linux/of_address.h> 29 30 #include <linux/of_mtd.h> 30 31 #include <linux/of_device.h> 31 32 #include <linux/mtd/nand.h> ··· 92 91 #define GPMC_CS_SIZE 0x30 93 92 #define GPMC_BCH_SIZE 0x10 94 93 95 - #define GPMC_MEM_START 0x00000000 96 94 #define GPMC_MEM_END 0x3FFFFFFF 97 - #define BOOT_ROM_SPACE 0x100000 /* 1MB */ 98 95 99 96 #define GPMC_CHUNK_SHIFT 24 /* 16 MB */ 100 97 #define GPMC_SECTION_SHIFT 28 /* 128 MB */ ··· 106 107 107 108 #define GPMC_HAS_WR_ACCESS 0x1 108 109 #define GPMC_HAS_WR_DATA_MUX_BUS 0x2 110 + #define GPMC_HAS_MUX_AAD 0x4 111 + 112 + #define GPMC_NR_WAITPINS 4 109 113 110 114 /* XXX: Only NAND irq has been considered,currently these are the only ones used 111 115 */ ··· 155 153 static DEFINE_SPINLOCK(gpmc_mem_lock); 156 154 /* Define chip-selects as reserved by default until probe completes */ 157 155 static unsigned int gpmc_cs_map = ((1 << GPMC_CS_NUM) - 1); 156 + static unsigned int gpmc_nr_waitpins; 158 157 static struct device *gpmc_dev; 159 158 static int gpmc_irq; 160 159 static resource_size_t phys_base, mem_size; ··· 184 181 __raw_writel(val, reg_addr); 185 182 } 186 183 187 - u32 gpmc_cs_read_reg(int cs, int idx) 184 + static u32 gpmc_cs_read_reg(int cs, int idx) 188 185 { 189 186 void __iomem *reg_addr; 190 187 ··· 193 190 } 194 191 195 192 /* TODO: Add support for gpmc_fck to clock framework and use it */ 196 - unsigned long gpmc_get_fclk_period(void) 193 + static unsigned long gpmc_get_fclk_period(void) 197 194 { 198 195 unsigned long rate = clk_get_rate(gpmc_l3_clk); 199 196 ··· 208 205 return rate; 209 206 } 210 207 211 - unsigned int gpmc_ns_to_ticks(unsigned int time_ns) 208 + static unsigned int gpmc_ns_to_ticks(unsigned int time_ns) 212 209 { 213 210 unsigned long tick_ps; 214 211 ··· 218 215 return (time_ns * 1000 + tick_ps - 1) / tick_ps; 219 216 } 220 217 221 - unsigned int gpmc_ps_to_ticks(unsigned int time_ps) 218 + static unsigned int gpmc_ps_to_ticks(unsigned int time_ps) 222 219 { 223 220 unsigned long tick_ps; 224 221 ··· 230 227 231 228 unsigned int gpmc_ticks_to_ns(unsigned int ticks) 232 229 { 233 - return ticks * gpmc_get_fclk_period() / 1000; 234 - } 235 - 236 - unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns) 237 - { 238 - unsigned long ticks = gpmc_ns_to_ticks(time_ns); 239 - 240 230 return ticks * gpmc_get_fclk_period() / 1000; 241 231 } 242 232 ··· 401 405 return 0; 402 406 } 403 407 404 - static void gpmc_cs_enable_mem(int cs, u32 base, u32 size) 408 + static int gpmc_cs_enable_mem(int cs, u32 base, u32 size) 405 409 { 406 410 u32 l; 407 411 u32 mask; 412 + 413 + /* 414 + * Ensure that base address is aligned on a 415 + * boundary equal to or greater than size. 416 + */ 417 + if (base & (size - 1)) 418 + return -EINVAL; 408 419 409 420 mask = (1 << GPMC_SECTION_SHIFT) - size; 410 421 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); ··· 421 418 l |= ((mask >> GPMC_CHUNK_SHIFT) & 0x0f) << 8; 422 419 l |= GPMC_CONFIG7_CSVALID; 423 420 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l); 421 + 422 + return 0; 424 423 } 425 424 426 425 static void gpmc_cs_disable_mem(int cs) ··· 453 448 return l & GPMC_CONFIG7_CSVALID; 454 449 } 455 450 456 - int gpmc_cs_set_reserved(int cs, int reserved) 451 + static void gpmc_cs_set_reserved(int cs, int reserved) 457 452 { 458 - if (cs > GPMC_CS_NUM) 459 - return -ENODEV; 460 - 461 453 gpmc_cs_map &= ~(1 << cs); 462 454 gpmc_cs_map |= (reserved ? 1 : 0) << cs; 463 - 464 - return 0; 465 455 } 466 456 467 - int gpmc_cs_reserved(int cs) 457 + static bool gpmc_cs_reserved(int cs) 468 458 { 469 - if (cs > GPMC_CS_NUM) 470 - return -ENODEV; 471 - 472 459 return gpmc_cs_map & (1 << cs); 473 460 } 474 461 ··· 507 510 return r; 508 511 } 509 512 513 + /** 514 + * gpmc_cs_remap - remaps a chip-select physical base address 515 + * @cs: chip-select to remap 516 + * @base: physical base address to re-map chip-select to 517 + * 518 + * Re-maps a chip-select to a new physical base address specified by 519 + * "base". Returns 0 on success and appropriate negative error code 520 + * on failure. 521 + */ 522 + static int gpmc_cs_remap(int cs, u32 base) 523 + { 524 + int ret; 525 + u32 old_base, size; 526 + 527 + if (cs > GPMC_CS_NUM) 528 + return -ENODEV; 529 + gpmc_cs_get_memconf(cs, &old_base, &size); 530 + if (base == old_base) 531 + return 0; 532 + gpmc_cs_disable_mem(cs); 533 + ret = gpmc_cs_delete_mem(cs); 534 + if (ret < 0) 535 + return ret; 536 + ret = gpmc_cs_insert_mem(cs, base, size); 537 + if (ret < 0) 538 + return ret; 539 + ret = gpmc_cs_enable_mem(cs, base, size); 540 + if (ret < 0) 541 + return ret; 542 + 543 + return 0; 544 + } 545 + 510 546 int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) 511 547 { 512 548 struct resource *res = &gpmc_cs_mem[cs]; ··· 565 535 if (r < 0) 566 536 goto out; 567 537 568 - gpmc_cs_enable_mem(cs, res->start, resource_size(res)); 538 + r = gpmc_cs_enable_mem(cs, res->start, resource_size(res)); 539 + if (r < 0) { 540 + release_resource(res); 541 + goto out; 542 + } 543 + 569 544 *base = res->start; 570 545 gpmc_cs_set_reserved(cs, 1); 571 546 out: ··· 596 561 EXPORT_SYMBOL(gpmc_cs_free); 597 562 598 563 /** 599 - * gpmc_cs_configure - write request to configure gpmc 600 - * @cs: chip select number 564 + * gpmc_configure - write request to configure gpmc 601 565 * @cmd: command type 602 566 * @wval: value to write 603 567 * @return status of the operation 604 568 */ 605 - int gpmc_cs_configure(int cs, int cmd, int wval) 569 + int gpmc_configure(int cmd, int wval) 606 570 { 607 - int err = 0; 608 - u32 regval = 0; 571 + u32 regval; 609 572 610 573 switch (cmd) { 611 574 case GPMC_ENABLE_IRQ: ··· 623 590 gpmc_write_reg(GPMC_CONFIG, regval); 624 591 break; 625 592 626 - case GPMC_CONFIG_RDY_BSY: 627 - regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 628 - if (wval) 629 - regval |= WR_RD_PIN_MONITORING; 630 - else 631 - regval &= ~WR_RD_PIN_MONITORING; 632 - gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval); 633 - break; 634 - 635 - case GPMC_CONFIG_DEV_SIZE: 636 - regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 637 - 638 - /* clear 2 target bits */ 639 - regval &= ~GPMC_CONFIG1_DEVICESIZE(3); 640 - 641 - /* set the proper value */ 642 - regval |= GPMC_CONFIG1_DEVICESIZE(wval); 643 - 644 - gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval); 645 - break; 646 - 647 - case GPMC_CONFIG_DEV_TYPE: 648 - regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 649 - regval |= GPMC_CONFIG1_DEVICETYPE(wval); 650 - if (wval == GPMC_DEVICETYPE_NOR) 651 - regval |= GPMC_CONFIG1_MUXADDDATA; 652 - gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval); 653 - break; 654 - 655 593 default: 656 - printk(KERN_ERR "gpmc_configure_cs: Not supported\n"); 657 - err = -EINVAL; 594 + pr_err("%s: command not supported\n", __func__); 595 + return -EINVAL; 658 596 } 659 597 660 - return err; 598 + return 0; 661 599 } 662 - EXPORT_SYMBOL(gpmc_cs_configure); 600 + EXPORT_SYMBOL(gpmc_configure); 663 601 664 602 void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs) 665 603 { ··· 785 781 786 782 } 787 783 788 - static int gpmc_mem_init(void) 784 + static void gpmc_mem_init(void) 789 785 { 790 - int cs, rc; 791 - unsigned long boot_rom_space = 0; 786 + int cs; 792 787 793 - /* never allocate the first page, to facilitate bug detection; 794 - * even if we didn't boot from ROM. 788 + /* 789 + * The first 1MB of GPMC address space is typically mapped to 790 + * the internal ROM. Never allocate the first page, to 791 + * facilitate bug detection; even if we didn't boot from ROM. 795 792 */ 796 - boot_rom_space = BOOT_ROM_SPACE; 797 - gpmc_mem_root.start = GPMC_MEM_START + boot_rom_space; 793 + gpmc_mem_root.start = SZ_1M; 798 794 gpmc_mem_root.end = GPMC_MEM_END; 799 795 800 796 /* Reserve all regions that has been set up by bootloader */ ··· 804 800 if (!gpmc_cs_mem_enabled(cs)) 805 801 continue; 806 802 gpmc_cs_get_memconf(cs, &base, &size); 807 - rc = gpmc_cs_insert_mem(cs, base, size); 808 - if (rc < 0) { 809 - while (--cs >= 0) 810 - if (gpmc_cs_mem_enabled(cs)) 811 - gpmc_cs_delete_mem(cs); 812 - return rc; 803 + if (gpmc_cs_insert_mem(cs, base, size)) { 804 + pr_warn("%s: disabling cs %d mapped at 0x%x-0x%x\n", 805 + __func__, cs, base, base + size); 806 + gpmc_cs_disable_mem(cs); 813 807 } 814 808 } 815 - 816 - return 0; 817 809 } 818 810 819 811 static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk) ··· 825 825 826 826 /* XXX: can the cycles be avoided ? */ 827 827 static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t, 828 - struct gpmc_device_timings *dev_t) 828 + struct gpmc_device_timings *dev_t, 829 + bool mux) 829 830 { 830 - bool mux = dev_t->mux; 831 831 u32 temp; 832 832 833 833 /* adv_rd_off */ ··· 880 880 } 881 881 882 882 static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t, 883 - struct gpmc_device_timings *dev_t) 883 + struct gpmc_device_timings *dev_t, 884 + bool mux) 884 885 { 885 - bool mux = dev_t->mux; 886 886 u32 temp; 887 887 888 888 /* adv_wr_off */ ··· 942 942 } 943 943 944 944 static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t, 945 - struct gpmc_device_timings *dev_t) 945 + struct gpmc_device_timings *dev_t, 946 + bool mux) 946 947 { 947 - bool mux = dev_t->mux; 948 948 u32 temp; 949 949 950 950 /* adv_rd_off */ ··· 982 982 } 983 983 984 984 static int gpmc_calc_async_write_timings(struct gpmc_timings *gpmc_t, 985 - struct gpmc_device_timings *dev_t) 985 + struct gpmc_device_timings *dev_t, 986 + bool mux) 986 987 { 987 - bool mux = dev_t->mux; 988 988 u32 temp; 989 989 990 990 /* adv_wr_off */ ··· 1054 1054 } 1055 1055 1056 1056 static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t, 1057 - struct gpmc_device_timings *dev_t) 1057 + struct gpmc_device_timings *dev_t, 1058 + bool sync) 1058 1059 { 1059 1060 u32 temp; 1060 1061 ··· 1069 1068 gpmc_t->cs_on + dev_t->t_ce_avd); 1070 1069 gpmc_t->adv_on = gpmc_round_ps_to_ticks(temp); 1071 1070 1072 - if (dev_t->sync_write || dev_t->sync_read) 1071 + if (sync) 1073 1072 gpmc_calc_sync_common_timings(gpmc_t, dev_t); 1074 1073 1075 1074 return 0; ··· 1104 1103 } 1105 1104 1106 1105 int gpmc_calc_timings(struct gpmc_timings *gpmc_t, 1107 - struct gpmc_device_timings *dev_t) 1106 + struct gpmc_settings *gpmc_s, 1107 + struct gpmc_device_timings *dev_t) 1108 1108 { 1109 + bool mux = false, sync = false; 1110 + 1111 + if (gpmc_s) { 1112 + mux = gpmc_s->mux_add_data ? true : false; 1113 + sync = (gpmc_s->sync_read || gpmc_s->sync_write); 1114 + } 1115 + 1109 1116 memset(gpmc_t, 0, sizeof(*gpmc_t)); 1110 1117 1111 - gpmc_calc_common_timings(gpmc_t, dev_t); 1118 + gpmc_calc_common_timings(gpmc_t, dev_t, sync); 1112 1119 1113 - if (dev_t->sync_read) 1114 - gpmc_calc_sync_read_timings(gpmc_t, dev_t); 1120 + if (gpmc_s && gpmc_s->sync_read) 1121 + gpmc_calc_sync_read_timings(gpmc_t, dev_t, mux); 1115 1122 else 1116 - gpmc_calc_async_read_timings(gpmc_t, dev_t); 1123 + gpmc_calc_async_read_timings(gpmc_t, dev_t, mux); 1117 1124 1118 - if (dev_t->sync_write) 1119 - gpmc_calc_sync_write_timings(gpmc_t, dev_t); 1125 + if (gpmc_s && gpmc_s->sync_write) 1126 + gpmc_calc_sync_write_timings(gpmc_t, dev_t, mux); 1120 1127 else 1121 - gpmc_calc_async_write_timings(gpmc_t, dev_t); 1128 + gpmc_calc_async_write_timings(gpmc_t, dev_t, mux); 1122 1129 1123 1130 /* TODO: remove, see function definition */ 1124 1131 gpmc_convert_ps_to_ns(gpmc_t); 1132 + 1133 + return 0; 1134 + } 1135 + 1136 + /** 1137 + * gpmc_cs_program_settings - programs non-timing related settings 1138 + * @cs: GPMC chip-select to program 1139 + * @p: pointer to GPMC settings structure 1140 + * 1141 + * Programs non-timing related settings for a GPMC chip-select, such as 1142 + * bus-width, burst configuration, etc. Function should be called once 1143 + * for each chip-select that is being used and must be called before 1144 + * calling gpmc_cs_set_timings() as timing parameters in the CONFIG1 1145 + * register will be initialised to zero by this function. Returns 0 on 1146 + * success and appropriate negative error code on failure. 1147 + */ 1148 + int gpmc_cs_program_settings(int cs, struct gpmc_settings *p) 1149 + { 1150 + u32 config1; 1151 + 1152 + if ((!p->device_width) || (p->device_width > GPMC_DEVWIDTH_16BIT)) { 1153 + pr_err("%s: invalid width %d!", __func__, p->device_width); 1154 + return -EINVAL; 1155 + } 1156 + 1157 + /* Address-data multiplexing not supported for NAND devices */ 1158 + if (p->device_nand && p->mux_add_data) { 1159 + pr_err("%s: invalid configuration!\n", __func__); 1160 + return -EINVAL; 1161 + } 1162 + 1163 + if ((p->mux_add_data > GPMC_MUX_AD) || 1164 + ((p->mux_add_data == GPMC_MUX_AAD) && 1165 + !(gpmc_capability & GPMC_HAS_MUX_AAD))) { 1166 + pr_err("%s: invalid multiplex configuration!\n", __func__); 1167 + return -EINVAL; 1168 + } 1169 + 1170 + /* Page/burst mode supports lengths of 4, 8 and 16 bytes */ 1171 + if (p->burst_read || p->burst_write) { 1172 + switch (p->burst_len) { 1173 + case GPMC_BURST_4: 1174 + case GPMC_BURST_8: 1175 + case GPMC_BURST_16: 1176 + break; 1177 + default: 1178 + pr_err("%s: invalid page/burst-length (%d)\n", 1179 + __func__, p->burst_len); 1180 + return -EINVAL; 1181 + } 1182 + } 1183 + 1184 + if ((p->wait_on_read || p->wait_on_write) && 1185 + (p->wait_pin > gpmc_nr_waitpins)) { 1186 + pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin); 1187 + return -EINVAL; 1188 + } 1189 + 1190 + config1 = GPMC_CONFIG1_DEVICESIZE((p->device_width - 1)); 1191 + 1192 + if (p->sync_read) 1193 + config1 |= GPMC_CONFIG1_READTYPE_SYNC; 1194 + if (p->sync_write) 1195 + config1 |= GPMC_CONFIG1_WRITETYPE_SYNC; 1196 + if (p->wait_on_read) 1197 + config1 |= GPMC_CONFIG1_WAIT_READ_MON; 1198 + if (p->wait_on_write) 1199 + config1 |= GPMC_CONFIG1_WAIT_WRITE_MON; 1200 + if (p->wait_on_read || p->wait_on_write) 1201 + config1 |= GPMC_CONFIG1_WAIT_PIN_SEL(p->wait_pin); 1202 + if (p->device_nand) 1203 + config1 |= GPMC_CONFIG1_DEVICETYPE(GPMC_DEVICETYPE_NAND); 1204 + if (p->mux_add_data) 1205 + config1 |= GPMC_CONFIG1_MUXTYPE(p->mux_add_data); 1206 + if (p->burst_read) 1207 + config1 |= GPMC_CONFIG1_READMULTIPLE_SUPP; 1208 + if (p->burst_write) 1209 + config1 |= GPMC_CONFIG1_WRITEMULTIPLE_SUPP; 1210 + if (p->burst_read || p->burst_write) { 1211 + config1 |= GPMC_CONFIG1_PAGE_LEN(p->burst_len >> 3); 1212 + config1 |= p->burst_wrap ? GPMC_CONFIG1_WRAPBURST_SUPP : 0; 1213 + } 1214 + 1215 + gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, config1); 1125 1216 1126 1217 return 0; 1127 1218 } ··· 1229 1136 }; 1230 1137 MODULE_DEVICE_TABLE(of, gpmc_dt_ids); 1231 1138 1139 + /** 1140 + * gpmc_read_settings_dt - read gpmc settings from device-tree 1141 + * @np: pointer to device-tree node for a gpmc child device 1142 + * @p: pointer to gpmc settings structure 1143 + * 1144 + * Reads the GPMC settings for a GPMC child device from device-tree and 1145 + * stores them in the GPMC settings structure passed. The GPMC settings 1146 + * structure is initialised to zero by this function and so any 1147 + * previously stored settings will be cleared. 1148 + */ 1149 + void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p) 1150 + { 1151 + memset(p, 0, sizeof(struct gpmc_settings)); 1152 + 1153 + p->sync_read = of_property_read_bool(np, "gpmc,sync-read"); 1154 + p->sync_write = of_property_read_bool(np, "gpmc,sync-write"); 1155 + p->device_nand = of_property_read_bool(np, "gpmc,device-nand"); 1156 + of_property_read_u32(np, "gpmc,device-width", &p->device_width); 1157 + of_property_read_u32(np, "gpmc,mux-add-data", &p->mux_add_data); 1158 + 1159 + if (!of_property_read_u32(np, "gpmc,burst-length", &p->burst_len)) { 1160 + p->burst_wrap = of_property_read_bool(np, "gpmc,burst-wrap"); 1161 + p->burst_read = of_property_read_bool(np, "gpmc,burst-read"); 1162 + p->burst_write = of_property_read_bool(np, "gpmc,burst-write"); 1163 + if (!p->burst_read && !p->burst_write) 1164 + pr_warn("%s: page/burst-length set but not used!\n", 1165 + __func__); 1166 + } 1167 + 1168 + if (!of_property_read_u32(np, "gpmc,wait-pin", &p->wait_pin)) { 1169 + p->wait_on_read = of_property_read_bool(np, 1170 + "gpmc,wait-on-read"); 1171 + p->wait_on_write = of_property_read_bool(np, 1172 + "gpmc,wait-on-write"); 1173 + if (!p->wait_on_read && !p->wait_on_write) 1174 + pr_warn("%s: read/write wait monitoring not enabled!\n", 1175 + __func__); 1176 + } 1177 + } 1178 + 1232 1179 static void __maybe_unused gpmc_read_timings_dt(struct device_node *np, 1233 1180 struct gpmc_timings *gpmc_t) 1234 1181 { 1235 - u32 val; 1182 + struct gpmc_bool_timings *p; 1183 + 1184 + if (!np || !gpmc_t) 1185 + return; 1236 1186 1237 1187 memset(gpmc_t, 0, sizeof(*gpmc_t)); 1238 1188 1239 1189 /* minimum clock period for syncronous mode */ 1240 - if (!of_property_read_u32(np, "gpmc,sync-clk", &val)) 1241 - gpmc_t->sync_clk = val; 1190 + of_property_read_u32(np, "gpmc,sync-clk-ps", &gpmc_t->sync_clk); 1242 1191 1243 1192 /* chip select timtings */ 1244 - if (!of_property_read_u32(np, "gpmc,cs-on", &val)) 1245 - gpmc_t->cs_on = val; 1246 - 1247 - if (!of_property_read_u32(np, "gpmc,cs-rd-off", &val)) 1248 - gpmc_t->cs_rd_off = val; 1249 - 1250 - if (!of_property_read_u32(np, "gpmc,cs-wr-off", &val)) 1251 - gpmc_t->cs_wr_off = val; 1193 + of_property_read_u32(np, "gpmc,cs-on-ns", &gpmc_t->cs_on); 1194 + of_property_read_u32(np, "gpmc,cs-rd-off-ns", &gpmc_t->cs_rd_off); 1195 + of_property_read_u32(np, "gpmc,cs-wr-off-ns", &gpmc_t->cs_wr_off); 1252 1196 1253 1197 /* ADV signal timings */ 1254 - if (!of_property_read_u32(np, "gpmc,adv-on", &val)) 1255 - gpmc_t->adv_on = val; 1256 - 1257 - if (!of_property_read_u32(np, "gpmc,adv-rd-off", &val)) 1258 - gpmc_t->adv_rd_off = val; 1259 - 1260 - if (!of_property_read_u32(np, "gpmc,adv-wr-off", &val)) 1261 - gpmc_t->adv_wr_off = val; 1198 + of_property_read_u32(np, "gpmc,adv-on-ns", &gpmc_t->adv_on); 1199 + of_property_read_u32(np, "gpmc,adv-rd-off-ns", &gpmc_t->adv_rd_off); 1200 + of_property_read_u32(np, "gpmc,adv-wr-off-ns", &gpmc_t->adv_wr_off); 1262 1201 1263 1202 /* WE signal timings */ 1264 - if (!of_property_read_u32(np, "gpmc,we-on", &val)) 1265 - gpmc_t->we_on = val; 1266 - 1267 - if (!of_property_read_u32(np, "gpmc,we-off", &val)) 1268 - gpmc_t->we_off = val; 1203 + of_property_read_u32(np, "gpmc,we-on-ns", &gpmc_t->we_on); 1204 + of_property_read_u32(np, "gpmc,we-off-ns", &gpmc_t->we_off); 1269 1205 1270 1206 /* OE signal timings */ 1271 - if (!of_property_read_u32(np, "gpmc,oe-on", &val)) 1272 - gpmc_t->oe_on = val; 1273 - 1274 - if (!of_property_read_u32(np, "gpmc,oe-off", &val)) 1275 - gpmc_t->oe_off = val; 1207 + of_property_read_u32(np, "gpmc,oe-on-ns", &gpmc_t->oe_on); 1208 + of_property_read_u32(np, "gpmc,oe-off-ns", &gpmc_t->oe_off); 1276 1209 1277 1210 /* access and cycle timings */ 1278 - if (!of_property_read_u32(np, "gpmc,page-burst-access", &val)) 1279 - gpmc_t->page_burst_access = val; 1211 + of_property_read_u32(np, "gpmc,page-burst-access-ns", 1212 + &gpmc_t->page_burst_access); 1213 + of_property_read_u32(np, "gpmc,access-ns", &gpmc_t->access); 1214 + of_property_read_u32(np, "gpmc,rd-cycle-ns", &gpmc_t->rd_cycle); 1215 + of_property_read_u32(np, "gpmc,wr-cycle-ns", &gpmc_t->wr_cycle); 1216 + of_property_read_u32(np, "gpmc,bus-turnaround-ns", 1217 + &gpmc_t->bus_turnaround); 1218 + of_property_read_u32(np, "gpmc,cycle2cycle-delay-ns", 1219 + &gpmc_t->cycle2cycle_delay); 1220 + of_property_read_u32(np, "gpmc,wait-monitoring-ns", 1221 + &gpmc_t->wait_monitoring); 1222 + of_property_read_u32(np, "gpmc,clk-activation-ns", 1223 + &gpmc_t->clk_activation); 1280 1224 1281 - if (!of_property_read_u32(np, "gpmc,access", &val)) 1282 - gpmc_t->access = val; 1225 + /* only applicable to OMAP3+ */ 1226 + of_property_read_u32(np, "gpmc,wr-access-ns", &gpmc_t->wr_access); 1227 + of_property_read_u32(np, "gpmc,wr-data-mux-bus-ns", 1228 + &gpmc_t->wr_data_mux_bus); 1283 1229 1284 - if (!of_property_read_u32(np, "gpmc,rd-cycle", &val)) 1285 - gpmc_t->rd_cycle = val; 1230 + /* bool timing parameters */ 1231 + p = &gpmc_t->bool_timings; 1286 1232 1287 - if (!of_property_read_u32(np, "gpmc,wr-cycle", &val)) 1288 - gpmc_t->wr_cycle = val; 1289 - 1290 - /* only for OMAP3430 */ 1291 - if (!of_property_read_u32(np, "gpmc,wr-access", &val)) 1292 - gpmc_t->wr_access = val; 1293 - 1294 - if (!of_property_read_u32(np, "gpmc,wr-data-mux-bus", &val)) 1295 - gpmc_t->wr_data_mux_bus = val; 1233 + p->cycle2cyclediffcsen = 1234 + of_property_read_bool(np, "gpmc,cycle2cycle-diffcsen"); 1235 + p->cycle2cyclesamecsen = 1236 + of_property_read_bool(np, "gpmc,cycle2cycle-samecsen"); 1237 + p->we_extra_delay = of_property_read_bool(np, "gpmc,we-extra-delay"); 1238 + p->oe_extra_delay = of_property_read_bool(np, "gpmc,oe-extra-delay"); 1239 + p->adv_extra_delay = of_property_read_bool(np, "gpmc,adv-extra-delay"); 1240 + p->cs_extra_delay = of_property_read_bool(np, "gpmc,cs-extra-delay"); 1241 + p->time_para_granularity = 1242 + of_property_read_bool(np, "gpmc,time-para-granularity"); 1296 1243 } 1297 1244 1298 1245 #ifdef CONFIG_MTD_NAND ··· 1428 1295 } 1429 1296 #endif 1430 1297 1298 + /** 1299 + * gpmc_probe_generic_child - configures the gpmc for a child device 1300 + * @pdev: pointer to gpmc platform device 1301 + * @child: pointer to device-tree node for child device 1302 + * 1303 + * Allocates and configures a GPMC chip-select for a child device. 1304 + * Returns 0 on success and appropriate negative error code on failure. 1305 + */ 1306 + static int gpmc_probe_generic_child(struct platform_device *pdev, 1307 + struct device_node *child) 1308 + { 1309 + struct gpmc_settings gpmc_s; 1310 + struct gpmc_timings gpmc_t; 1311 + struct resource res; 1312 + unsigned long base; 1313 + int ret, cs; 1314 + 1315 + if (of_property_read_u32(child, "reg", &cs) < 0) { 1316 + dev_err(&pdev->dev, "%s has no 'reg' property\n", 1317 + child->full_name); 1318 + return -ENODEV; 1319 + } 1320 + 1321 + if (of_address_to_resource(child, 0, &res) < 0) { 1322 + dev_err(&pdev->dev, "%s has malformed 'reg' property\n", 1323 + child->full_name); 1324 + return -ENODEV; 1325 + } 1326 + 1327 + ret = gpmc_cs_request(cs, resource_size(&res), &base); 1328 + if (ret < 0) { 1329 + dev_err(&pdev->dev, "cannot request GPMC CS %d\n", cs); 1330 + return ret; 1331 + } 1332 + 1333 + /* 1334 + * FIXME: gpmc_cs_request() will map the CS to an arbitary 1335 + * location in the gpmc address space. When booting with 1336 + * device-tree we want the NOR flash to be mapped to the 1337 + * location specified in the device-tree blob. So remap the 1338 + * CS to this location. Once DT migration is complete should 1339 + * just make gpmc_cs_request() map a specific address. 1340 + */ 1341 + ret = gpmc_cs_remap(cs, res.start); 1342 + if (ret < 0) { 1343 + dev_err(&pdev->dev, "cannot remap GPMC CS %d to 0x%x\n", 1344 + cs, res.start); 1345 + goto err; 1346 + } 1347 + 1348 + gpmc_read_settings_dt(child, &gpmc_s); 1349 + 1350 + ret = of_property_read_u32(child, "bank-width", &gpmc_s.device_width); 1351 + if (ret < 0) 1352 + goto err; 1353 + 1354 + ret = gpmc_cs_program_settings(cs, &gpmc_s); 1355 + if (ret < 0) 1356 + goto err; 1357 + 1358 + gpmc_read_timings_dt(child, &gpmc_t); 1359 + gpmc_cs_set_timings(cs, &gpmc_t); 1360 + 1361 + if (of_platform_device_create(child, NULL, &pdev->dev)) 1362 + return 0; 1363 + 1364 + dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name); 1365 + ret = -ENODEV; 1366 + 1367 + err: 1368 + gpmc_cs_free(cs); 1369 + 1370 + return ret; 1371 + } 1372 + 1431 1373 static int gpmc_probe_dt(struct platform_device *pdev) 1432 1374 { 1433 1375 int ret; ··· 1512 1304 1513 1305 if (!of_id) 1514 1306 return 0; 1307 + 1308 + ret = of_property_read_u32(pdev->dev.of_node, "gpmc,num-waitpins", 1309 + &gpmc_nr_waitpins); 1310 + if (ret < 0) { 1311 + pr_err("%s: number of wait pins not found!\n", __func__); 1312 + return ret; 1313 + } 1515 1314 1516 1315 for_each_node_by_name(child, "nand") { 1517 1316 ret = gpmc_probe_nand_child(pdev, child); ··· 1535 1320 return ret; 1536 1321 } 1537 1322 } 1323 + 1324 + for_each_node_by_name(child, "nor") { 1325 + ret = gpmc_probe_generic_child(pdev, child); 1326 + if (ret < 0) { 1327 + of_node_put(child); 1328 + return ret; 1329 + } 1330 + } 1331 + 1332 + for_each_node_by_name(child, "ethernet") { 1333 + ret = gpmc_probe_generic_child(pdev, child); 1334 + if (ret < 0) { 1335 + of_node_put(child); 1336 + return ret; 1337 + } 1338 + } 1339 + 1538 1340 return 0; 1539 1341 } 1540 1342 #else ··· 1596 1364 gpmc_dev = &pdev->dev; 1597 1365 1598 1366 l = gpmc_read_reg(GPMC_REVISION); 1367 + 1368 + /* 1369 + * FIXME: Once device-tree migration is complete the below flags 1370 + * should be populated based upon the device-tree compatible 1371 + * string. For now just use the IP revision. OMAP3+ devices have 1372 + * the wr_access and wr_data_mux_bus register fields. OMAP4+ 1373 + * devices support the addr-addr-data multiplex protocol. 1374 + * 1375 + * GPMC IP revisions: 1376 + * - OMAP24xx = 2.0 1377 + * - OMAP3xxx = 5.0 1378 + * - OMAP44xx/54xx/AM335x = 6.0 1379 + */ 1599 1380 if (GPMC_REVISION_MAJOR(l) > 0x4) 1600 1381 gpmc_capability = GPMC_HAS_WR_ACCESS | GPMC_HAS_WR_DATA_MUX_BUS; 1382 + if (GPMC_REVISION_MAJOR(l) > 0x5) 1383 + gpmc_capability |= GPMC_HAS_MUX_AAD; 1601 1384 dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), 1602 1385 GPMC_REVISION_MINOR(l)); 1603 1386 1604 - rc = gpmc_mem_init(); 1605 - if (rc < 0) { 1606 - clk_disable_unprepare(gpmc_l3_clk); 1607 - clk_put(gpmc_l3_clk); 1608 - dev_err(gpmc_dev, "failed to reserve memory\n"); 1609 - return rc; 1610 - } 1387 + gpmc_mem_init(); 1611 1388 1612 1389 if (gpmc_setup_irq() < 0) 1613 1390 dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); 1614 1391 1615 1392 /* Now the GPMC is initialised, unreserve the chip-selects */ 1616 1393 gpmc_cs_map = 0; 1394 + 1395 + if (!pdev->dev.of_node) 1396 + gpmc_nr_waitpins = GPMC_NR_WAITPINS; 1617 1397 1618 1398 rc = gpmc_probe_dt(pdev); 1619 1399 if (rc < 0) {
+29 -14
arch/arm/mach-omap2/gpmc.h
··· 58 58 #define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1) 59 59 #define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10) 60 60 #define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0) 61 - #define GPMC_CONFIG1_MUXADDDATA (1 << 9) 61 + #define GPMC_CONFIG1_MUXTYPE(val) ((val & 3) << 8) 62 62 #define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4) 63 63 #define GPMC_CONFIG1_FCLK_DIV(val) (val & 3) 64 64 #define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1)) ··· 73 73 #define GPMC_IRQ_FIFOEVENTENABLE 0x01 74 74 #define GPMC_IRQ_COUNT_EVENT 0x02 75 75 76 + #define GPMC_BURST_4 4 /* 4 word burst */ 77 + #define GPMC_BURST_8 8 /* 8 word burst */ 78 + #define GPMC_BURST_16 16 /* 16 word burst */ 79 + #define GPMC_DEVWIDTH_8BIT 1 /* 8-bit device width */ 80 + #define GPMC_DEVWIDTH_16BIT 2 /* 16-bit device width */ 81 + #define GPMC_MUX_AAD 1 /* Addr-Addr-Data multiplex */ 82 + #define GPMC_MUX_AD 2 /* Addr-Data multiplex */ 76 83 77 84 /* bool type time settings */ 78 85 struct gpmc_bool_timings { ··· 185 178 u8 cyc_wpl; /* write deassertion time in cycles */ 186 179 u32 cyc_iaa; /* initial access time in cycles */ 187 180 188 - bool mux; /* address & data muxed */ 189 - bool sync_write;/* synchronous write */ 190 - bool sync_read; /* synchronous read */ 191 - 192 181 /* extra delays */ 193 182 bool ce_xdelay; 194 183 bool avd_xdelay; ··· 192 189 bool we_xdelay; 193 190 }; 194 191 192 + struct gpmc_settings { 193 + bool burst_wrap; /* enables wrap bursting */ 194 + bool burst_read; /* enables read page/burst mode */ 195 + bool burst_write; /* enables write page/burst mode */ 196 + bool device_nand; /* device is NAND */ 197 + bool sync_read; /* enables synchronous reads */ 198 + bool sync_write; /* enables synchronous writes */ 199 + bool wait_on_read; /* monitor wait on reads */ 200 + bool wait_on_write; /* monitor wait on writes */ 201 + u32 burst_len; /* page/burst length */ 202 + u32 device_width; /* device bus width (8 or 16 bit) */ 203 + u32 mux_add_data; /* multiplex address & data */ 204 + u32 wait_pin; /* wait-pin to be used */ 205 + }; 206 + 195 207 extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t, 196 - struct gpmc_device_timings *dev_t); 208 + struct gpmc_settings *gpmc_s, 209 + struct gpmc_device_timings *dev_t); 197 210 198 211 extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs); 199 212 extern int gpmc_get_client_irq(unsigned irq_config); 200 213 201 - extern unsigned int gpmc_ns_to_ticks(unsigned int time_ns); 202 - extern unsigned int gpmc_ps_to_ticks(unsigned int time_ps); 203 214 extern unsigned int gpmc_ticks_to_ns(unsigned int ticks); 204 - extern unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns); 205 - extern unsigned long gpmc_get_fclk_period(void); 206 215 207 216 extern void gpmc_cs_write_reg(int cs, int idx, u32 val); 208 - extern u32 gpmc_cs_read_reg(int cs, int idx); 209 217 extern int gpmc_calc_divider(unsigned int sync_clk); 210 218 extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); 219 + extern int gpmc_cs_program_settings(int cs, struct gpmc_settings *p); 211 220 extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base); 212 221 extern void gpmc_cs_free(int cs); 213 - extern int gpmc_cs_set_reserved(int cs, int reserved); 214 - extern int gpmc_cs_reserved(int cs); 215 222 extern void omap3_gpmc_save_context(void); 216 223 extern void omap3_gpmc_restore_context(void); 217 - extern int gpmc_cs_configure(int cs, int cmd, int wval); 224 + extern int gpmc_configure(int cmd, int wval); 225 + extern void gpmc_read_settings_dt(struct device_node *np, 226 + struct gpmc_settings *p); 218 227 219 228 #endif
+62 -64
arch/arm/mach-omap2/timer.c
··· 57 57 #include "common.h" 58 58 #include "powerdomain.h" 59 59 60 - /* Parent clocks, eventually these will come from the clock framework */ 61 - 62 - #define OMAP2_MPU_SOURCE "sys_ck" 63 - #define OMAP3_MPU_SOURCE OMAP2_MPU_SOURCE 64 - #define OMAP4_MPU_SOURCE "sys_clkin_ck" 65 - #define OMAP5_MPU_SOURCE "sys_clkin" 66 - #define OMAP2_32K_SOURCE "func_32k_ck" 67 - #define OMAP3_32K_SOURCE "omap_32k_fck" 68 - #define OMAP4_32K_SOURCE "sys_32k_ck" 69 - 70 60 #define REALTIME_COUNTER_BASE 0x48243200 71 61 #define INCREMENTER_NUMERATOR_OFFSET 0x10 72 62 #define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14 ··· 120 130 } 121 131 122 132 static struct clock_event_device clockevent_gpt = { 123 - .name = "gp_timer", 124 133 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 125 134 .rating = 300, 126 135 .set_next_event = omap2_gp_timer_set_next_event, ··· 158 169 continue; 159 170 160 171 if (property && !of_get_property(np, property, NULL)) 172 + continue; 173 + 174 + if (!property && (of_get_property(np, "ti,timer-alwon", NULL) || 175 + of_get_property(np, "ti,timer-dsp", NULL) || 176 + of_get_property(np, "ti,timer-pwm", NULL) || 177 + of_get_property(np, "ti,timer-secure", NULL))) 161 178 continue; 162 179 163 180 of_add_property(np, &device_disabled); ··· 210 215 } 211 216 212 217 static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, 213 - int gptimer_id, 214 - const char *fck_source, 215 - const char *property, 216 - int posted) 218 + const char *fck_source, 219 + const char *property, 220 + const char **timer_name, 221 + int posted) 217 222 { 218 223 char name[10]; /* 10 = sizeof("gptXX_Xck0") */ 219 224 const char *oh_name; 220 225 struct device_node *np; 221 226 struct omap_hwmod *oh; 222 227 struct resource irq, mem; 228 + struct clk *src; 223 229 int r = 0; 224 230 225 231 if (of_have_populated_dt()) { ··· 240 244 241 245 of_node_put(np); 242 246 } else { 243 - if (omap_dm_timer_reserve_systimer(gptimer_id)) 247 + if (omap_dm_timer_reserve_systimer(timer->id)) 244 248 return -ENODEV; 245 249 246 - sprintf(name, "timer%d", gptimer_id); 250 + sprintf(name, "timer%d", timer->id); 247 251 oh_name = name; 248 252 } 249 253 250 254 oh = omap_hwmod_lookup(oh_name); 251 255 if (!oh) 252 256 return -ENODEV; 257 + 258 + *timer_name = oh->name; 253 259 254 260 if (!of_have_populated_dt()) { 255 261 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL, ··· 275 277 /* After the dmtimer is using hwmod these clocks won't be needed */ 276 278 timer->fclk = clk_get(NULL, omap_hwmod_get_main_clk(oh)); 277 279 if (IS_ERR(timer->fclk)) 278 - return -ENODEV; 280 + return PTR_ERR(timer->fclk); 279 281 280 - /* FIXME: Need to remove hard-coded test on timer ID */ 281 - if (gptimer_id != 12) { 282 - struct clk *src; 282 + src = clk_get(NULL, fck_source); 283 + if (IS_ERR(src)) 284 + return PTR_ERR(src); 283 285 284 - src = clk_get(NULL, fck_source); 285 - if (IS_ERR(src)) { 286 - r = -EINVAL; 287 - } else { 288 - r = clk_set_parent(timer->fclk, src); 289 - if (r < 0) 290 - pr_warn("%s: %s cannot set source\n", 291 - __func__, oh->name); 286 + if (clk_get_parent(timer->fclk) != src) { 287 + r = clk_set_parent(timer->fclk, src); 288 + if (r < 0) { 289 + pr_warn("%s: %s cannot set source\n", __func__, 290 + oh->name); 292 291 clk_put(src); 292 + return r; 293 293 } 294 294 } 295 + 296 + clk_put(src); 295 297 296 298 omap_hwmod_setup_one(oh_name); 297 299 omap_hwmod_enable(oh); ··· 316 318 { 317 319 int res; 318 320 321 + clkev.id = gptimer_id; 319 322 clkev.errata = omap_dm_timer_get_errata(); 320 323 321 324 /* ··· 326 327 */ 327 328 __omap_dm_timer_override_errata(&clkev, OMAP_TIMER_ERRATA_I103_I767); 328 329 329 - res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source, property, 330 - OMAP_TIMER_POSTED); 330 + res = omap_dm_timer_init_one(&clkev, fck_source, property, 331 + &clockevent_gpt.name, OMAP_TIMER_POSTED); 331 332 BUG_ON(res); 332 333 333 334 omap2_gp_timer_irq.dev_id = &clkev; ··· 341 342 3, /* Timer internal resynch latency */ 342 343 0xffffffff); 343 344 344 - pr_info("OMAP clockevent source: GPTIMER%d at %lu Hz\n", 345 - gptimer_id, clkev.rate); 345 + pr_info("OMAP clockevent source: %s at %lu Hz\n", clockevent_gpt.name, 346 + clkev.rate); 346 347 } 347 348 348 349 /* Clocksource code */ ··· 359 360 } 360 361 361 362 static struct clocksource clocksource_gpt = { 362 - .name = "gp_timer", 363 363 .rating = 300, 364 364 .read = clocksource_read_cycles, 365 365 .mask = CLOCKSOURCE_MASK(32), ··· 441 443 } 442 444 443 445 static void __init omap2_gptimer_clocksource_init(int gptimer_id, 444 - const char *fck_source) 446 + const char *fck_source, 447 + const char *property) 445 448 { 446 449 int res; 447 450 451 + clksrc.id = gptimer_id; 448 452 clksrc.errata = omap_dm_timer_get_errata(); 449 453 450 - res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source, NULL, 454 + res = omap_dm_timer_init_one(&clksrc, fck_source, property, 455 + &clocksource_gpt.name, 451 456 OMAP_TIMER_NONPOSTED); 452 457 BUG_ON(res); 453 458 ··· 463 462 pr_err("Could not register clocksource %s\n", 464 463 clocksource_gpt.name); 465 464 else 466 - pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n", 467 - gptimer_id, clksrc.rate); 465 + pr_info("OMAP clocksource: %s at %lu Hz\n", 466 + clocksource_gpt.name, clksrc.rate); 468 467 } 469 468 470 469 #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER ··· 489 488 pr_err("%s: ioremap failed\n", __func__); 490 489 return; 491 490 } 492 - sys_clk = clk_get(NULL, OMAP5_MPU_SOURCE); 491 + sys_clk = clk_get(NULL, "sys_clkin"); 493 492 if (IS_ERR(sys_clk)) { 494 493 pr_err("%s: failed to get system clock handle\n", __func__); 495 494 iounmap(base); ··· 546 545 #endif 547 546 548 547 #define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ 549 - clksrc_nr, clksrc_src) \ 548 + clksrc_nr, clksrc_src, clksrc_prop) \ 550 549 void __init omap##name##_gptimer_timer_init(void) \ 551 550 { \ 552 - if (omap_clk_init) \ 553 - omap_clk_init(); \ 554 551 omap_dmtimer_init(); \ 555 552 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ 556 - omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src); \ 553 + omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src, \ 554 + clksrc_prop); \ 557 555 } 558 556 559 557 #define OMAP_SYS_32K_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ 560 - clksrc_nr, clksrc_src) \ 558 + clksrc_nr, clksrc_src, clksrc_prop) \ 561 559 void __init omap##name##_sync32k_timer_init(void) \ 562 560 { \ 563 - if (omap_clk_init) \ 564 - omap_clk_init(); \ 565 561 omap_dmtimer_init(); \ 566 562 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ 567 563 /* Enable the use of clocksource="gp_timer" kernel parameter */ \ 568 564 if (use_gptimer_clksrc) \ 569 - omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src);\ 565 + omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src, \ 566 + clksrc_prop); \ 570 567 else \ 571 568 omap2_sync32k_clocksource_init(); \ 572 569 } 573 570 574 571 #ifdef CONFIG_ARCH_OMAP2 575 - OMAP_SYS_32K_TIMER_INIT(2, 1, OMAP2_32K_SOURCE, "ti,timer-alwon", 576 - 2, OMAP2_MPU_SOURCE); 572 + OMAP_SYS_32K_TIMER_INIT(2, 1, "timer_32k_ck", "ti,timer-alwon", 573 + 2, "timer_sys_ck", NULL); 577 574 #endif /* CONFIG_ARCH_OMAP2 */ 578 575 579 576 #ifdef CONFIG_ARCH_OMAP3 580 - OMAP_SYS_32K_TIMER_INIT(3, 1, OMAP3_32K_SOURCE, "ti,timer-alwon", 581 - 2, OMAP3_MPU_SOURCE); 582 - OMAP_SYS_32K_TIMER_INIT(3_secure, 12, OMAP3_32K_SOURCE, "ti,timer-secure", 583 - 2, OMAP3_MPU_SOURCE); 584 - OMAP_SYS_GP_TIMER_INIT(3_gp, 1, OMAP3_MPU_SOURCE, "ti,timer-alwon", 585 - 2, OMAP3_MPU_SOURCE); 577 + OMAP_SYS_32K_TIMER_INIT(3, 1, "timer_32k_ck", "ti,timer-alwon", 578 + 2, "timer_sys_ck", NULL); 579 + OMAP_SYS_32K_TIMER_INIT(3_secure, 12, "secure_32k_fck", "ti,timer-secure", 580 + 2, "timer_sys_ck", NULL); 586 581 #endif /* CONFIG_ARCH_OMAP3 */ 587 582 588 - #ifdef CONFIG_SOC_AM33XX 589 - OMAP_SYS_GP_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon", 590 - 2, OMAP4_MPU_SOURCE); 591 - #endif /* CONFIG_SOC_AM33XX */ 583 + #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) 584 + OMAP_SYS_GP_TIMER_INIT(3, 2, "timer_sys_ck", NULL, 585 + 1, "timer_sys_ck", "ti,timer-alwon"); 586 + #endif 587 + 588 + #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) 589 + static OMAP_SYS_32K_TIMER_INIT(4, 1, "timer_32k_ck", "ti,timer-alwon", 590 + 2, "sys_clkin_ck", NULL); 591 + #endif 592 592 593 593 #ifdef CONFIG_ARCH_OMAP4 594 - OMAP_SYS_32K_TIMER_INIT(4, 1, OMAP4_32K_SOURCE, "ti,timer-alwon", 595 - 2, OMAP4_MPU_SOURCE); 596 594 #ifdef CONFIG_LOCAL_TIMERS 597 595 static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29); 598 596 void __init omap4_local_timer_init(void) ··· 620 620 #endif /* CONFIG_ARCH_OMAP4 */ 621 621 622 622 #ifdef CONFIG_SOC_OMAP5 623 - OMAP_SYS_32K_TIMER_INIT(5, 1, OMAP4_32K_SOURCE, "ti,timer-alwon", 624 - 2, OMAP5_MPU_SOURCE); 625 623 void __init omap5_realtime_timer_init(void) 626 624 { 627 625 int err; 628 626 629 - omap5_sync32k_timer_init(); 627 + omap4_sync32k_timer_init(); 630 628 realtime_counter_init(); 631 629 632 630 err = arch_timer_of_register();
+158 -2
arch/arm/mach-omap2/usb-host.c
··· 22 22 #include <linux/platform_device.h> 23 23 #include <linux/slab.h> 24 24 #include <linux/dma-mapping.h> 25 - 26 - #include <asm/io.h> 25 + #include <linux/regulator/machine.h> 26 + #include <linux/regulator/fixed.h> 27 + #include <linux/string.h> 28 + #include <linux/io.h> 29 + #include <linux/gpio.h> 30 + #include <linux/usb/phy.h> 27 31 28 32 #include "soc.h" 29 33 #include "omap_device.h" ··· 530 526 } 531 527 532 528 #endif 529 + 530 + /* Template for PHY regulators */ 531 + static struct fixed_voltage_config hsusb_reg_config = { 532 + /* .supply_name filled later */ 533 + .microvolts = 3300000, 534 + .gpio = -1, /* updated later */ 535 + .startup_delay = 70000, /* 70msec */ 536 + .enable_high = 1, /* updated later */ 537 + .enabled_at_boot = 0, /* keep in RESET */ 538 + /* .init_data filled later */ 539 + }; 540 + 541 + static const char *nop_name = "nop_usb_xceiv"; /* NOP PHY driver */ 542 + static const char *reg_name = "reg-fixed-voltage"; /* Regulator driver */ 543 + 544 + /** 545 + * usbhs_add_regulator - Add a gpio based fixed voltage regulator device 546 + * @name: name for the regulator 547 + * @dev_id: device id of the device this regulator supplies power to 548 + * @dev_supply: supply name that the device expects 549 + * @gpio: GPIO number 550 + * @polarity: 1 - Active high, 0 - Active low 551 + */ 552 + static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply, 553 + int gpio, int polarity) 554 + { 555 + struct regulator_consumer_supply *supplies; 556 + struct regulator_init_data *reg_data; 557 + struct fixed_voltage_config *config; 558 + struct platform_device *pdev; 559 + int ret; 560 + 561 + supplies = kzalloc(sizeof(*supplies), GFP_KERNEL); 562 + if (!supplies) 563 + return -ENOMEM; 564 + 565 + supplies->supply = dev_supply; 566 + supplies->dev_name = dev_id; 567 + 568 + reg_data = kzalloc(sizeof(*reg_data), GFP_KERNEL); 569 + if (!reg_data) 570 + return -ENOMEM; 571 + 572 + reg_data->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS; 573 + reg_data->consumer_supplies = supplies; 574 + reg_data->num_consumer_supplies = 1; 575 + 576 + config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config), 577 + GFP_KERNEL); 578 + if (!config) 579 + return -ENOMEM; 580 + 581 + config->supply_name = name; 582 + config->gpio = gpio; 583 + config->enable_high = polarity; 584 + config->init_data = reg_data; 585 + 586 + /* create a regulator device */ 587 + pdev = kzalloc(sizeof(*pdev), GFP_KERNEL); 588 + if (!pdev) 589 + return -ENOMEM; 590 + 591 + pdev->id = PLATFORM_DEVID_AUTO; 592 + pdev->name = reg_name; 593 + pdev->dev.platform_data = config; 594 + 595 + ret = platform_device_register(pdev); 596 + if (ret) 597 + pr_err("%s: Failed registering regulator %s for %s\n", 598 + __func__, name, dev_id); 599 + 600 + return ret; 601 + } 602 + 603 + int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys) 604 + { 605 + char *rail_name; 606 + int i, len; 607 + struct platform_device *pdev; 608 + char *phy_id; 609 + 610 + /* the phy_id will be something like "nop_usb_xceiv.1" */ 611 + len = strlen(nop_name) + 3; /* 3 -> ".1" and NULL terminator */ 612 + 613 + for (i = 0; i < num_phys; i++) { 614 + 615 + if (!phy->port) { 616 + pr_err("%s: Invalid port 0. Must start from 1\n", 617 + __func__); 618 + continue; 619 + } 620 + 621 + /* do we need a NOP PHY device ? */ 622 + if (!gpio_is_valid(phy->reset_gpio) && 623 + !gpio_is_valid(phy->vcc_gpio)) 624 + continue; 625 + 626 + /* create a NOP PHY device */ 627 + pdev = kzalloc(sizeof(*pdev), GFP_KERNEL); 628 + if (!pdev) 629 + return -ENOMEM; 630 + 631 + pdev->id = phy->port; 632 + pdev->name = nop_name; 633 + pdev->dev.platform_data = phy->platform_data; 634 + 635 + phy_id = kmalloc(len, GFP_KERNEL); 636 + if (!phy_id) 637 + return -ENOMEM; 638 + 639 + scnprintf(phy_id, len, "nop_usb_xceiv.%d\n", 640 + pdev->id); 641 + 642 + if (platform_device_register(pdev)) { 643 + pr_err("%s: Failed to register device %s\n", 644 + __func__, phy_id); 645 + continue; 646 + } 647 + 648 + usb_bind_phy("ehci-omap.0", phy->port - 1, phy_id); 649 + 650 + /* Do we need RESET regulator ? */ 651 + if (gpio_is_valid(phy->reset_gpio)) { 652 + 653 + rail_name = kmalloc(13, GFP_KERNEL); 654 + if (!rail_name) 655 + return -ENOMEM; 656 + 657 + scnprintf(rail_name, 13, "hsusb%d_reset", phy->port); 658 + 659 + usbhs_add_regulator(rail_name, phy_id, "reset", 660 + phy->reset_gpio, 1); 661 + } 662 + 663 + /* Do we need VCC regulator ? */ 664 + if (gpio_is_valid(phy->vcc_gpio)) { 665 + 666 + rail_name = kmalloc(13, GFP_KERNEL); 667 + if (!rail_name) 668 + return -ENOMEM; 669 + 670 + scnprintf(rail_name, 13, "hsusb%d_vcc", phy->port); 671 + 672 + usbhs_add_regulator(rail_name, phy_id, "vcc", 673 + phy->vcc_gpio, phy->vcc_polarity); 674 + } 675 + 676 + phy++; 677 + } 678 + 679 + return 0; 680 + }
+30 -32
arch/arm/mach-omap2/usb-tusb6010.c
··· 8 8 * published by the Free Software Foundation. 9 9 */ 10 10 11 + #include <linux/err.h> 11 12 #include <linux/string.h> 12 13 #include <linux/types.h> 13 14 #include <linux/errno.h> ··· 27 26 static u8 async_cs, sync_cs; 28 27 static unsigned refclk_psec; 29 28 29 + static struct gpmc_settings tusb_async = { 30 + .wait_on_read = true, 31 + .wait_on_write = true, 32 + .device_width = GPMC_DEVWIDTH_16BIT, 33 + .mux_add_data = GPMC_MUX_AD, 34 + }; 35 + 36 + static struct gpmc_settings tusb_sync = { 37 + .burst_read = true, 38 + .burst_write = true, 39 + .sync_read = true, 40 + .sync_write = true, 41 + .wait_on_read = true, 42 + .wait_on_write = true, 43 + .burst_len = GPMC_BURST_16, 44 + .device_width = GPMC_DEVWIDTH_16BIT, 45 + .mux_add_data = GPMC_MUX_AD, 46 + }; 30 47 31 48 /* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */ 32 49 ··· 55 36 unsigned t_acsnh_advnh = sysclk_ps + 3000; 56 37 57 38 memset(&dev_t, 0, sizeof(dev_t)); 58 - 59 - dev_t.mux = true; 60 39 61 40 dev_t.t_ceasu = 8 * 1000; 62 41 dev_t.t_avdasu = t_acsnh_advnh - 7000; ··· 69 52 dev_t.t_wpl = 300; 70 53 dev_t.cyc_aavdh_we = 1; 71 54 72 - gpmc_calc_timings(&t, &dev_t); 55 + gpmc_calc_timings(&t, &tusb_async, &dev_t); 73 56 74 57 return gpmc_cs_set_timings(async_cs, &t); 75 58 } ··· 81 64 unsigned t_scsnh_advnh = sysclk_ps + 3000; 82 65 83 66 memset(&dev_t, 0, sizeof(dev_t)); 84 - 85 - dev_t.mux = true; 86 - dev_t.sync_read = true; 87 - dev_t.sync_write = true; 88 67 89 68 dev_t.clk = 11100; 90 69 dev_t.t_bacc = 1000; ··· 97 84 dev_t.cyc_wpl = 6; 98 85 dev_t.t_ce_rdyz = 7000; 99 86 100 - gpmc_calc_timings(&t, &dev_t); 87 + gpmc_calc_timings(&t, &tusb_sync, &dev_t); 101 88 102 89 return gpmc_cs_set_timings(sync_cs, &t); 103 90 } ··· 178 165 return status; 179 166 } 180 167 tusb_resources[0].end = tusb_resources[0].start + 0x9ff; 168 + tusb_async.wait_pin = waitpin; 181 169 async_cs = async; 182 - gpmc_cs_write_reg(async, GPMC_CS_CONFIG1, 183 - GPMC_CONFIG1_PAGE_LEN(2) 184 - | GPMC_CONFIG1_WAIT_READ_MON 185 - | GPMC_CONFIG1_WAIT_WRITE_MON 186 - | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin) 187 - | GPMC_CONFIG1_READTYPE_ASYNC 188 - | GPMC_CONFIG1_WRITETYPE_ASYNC 189 - | GPMC_CONFIG1_DEVICESIZE_16 190 - | GPMC_CONFIG1_DEVICETYPE_NOR 191 - | GPMC_CONFIG1_MUXADDDATA); 192 170 171 + status = gpmc_cs_program_settings(async_cs, &tusb_async); 172 + if (status < 0) 173 + return status; 193 174 194 175 /* SYNC region, primarily for DMA */ 195 176 status = gpmc_cs_request(sync, SZ_16M, (unsigned long *) ··· 193 186 return status; 194 187 } 195 188 tusb_resources[1].end = tusb_resources[1].start + 0x9ff; 189 + tusb_sync.wait_pin = waitpin; 196 190 sync_cs = sync; 197 - gpmc_cs_write_reg(sync, GPMC_CS_CONFIG1, 198 - GPMC_CONFIG1_READMULTIPLE_SUPP 199 - | GPMC_CONFIG1_READTYPE_SYNC 200 - | GPMC_CONFIG1_WRITEMULTIPLE_SUPP 201 - | GPMC_CONFIG1_WRITETYPE_SYNC 202 - | GPMC_CONFIG1_PAGE_LEN(2) 203 - | GPMC_CONFIG1_WAIT_READ_MON 204 - | GPMC_CONFIG1_WAIT_WRITE_MON 205 - | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin) 206 - | GPMC_CONFIG1_DEVICESIZE_16 207 - | GPMC_CONFIG1_DEVICETYPE_NOR 208 - | GPMC_CONFIG1_MUXADDDATA 209 - /* fclk divider gets set later */ 210 - ); 191 + 192 + status = gpmc_cs_program_settings(sync_cs, &tusb_sync); 193 + if (status < 0) 194 + return status; 211 195 212 196 /* IRQ */ 213 197 status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq");
+9
arch/arm/mach-omap2/usb.h
··· 53 53 #define USBPHY_OTGSESSEND_EN (1 << 20) 54 54 #define USBPHY_DATA_POLARITY (1 << 23) 55 55 56 + struct usbhs_phy_data { 57 + int port; /* 1 indexed port number */ 58 + int reset_gpio; 59 + int vcc_gpio; 60 + bool vcc_polarity; /* 1 active high, 0 active low */ 61 + void *platform_data; 62 + }; 63 + 56 64 extern void usb_musb_init(struct omap_musb_board_data *board_data); 57 65 extern void usbhs_init(struct usbhs_omap_platform_data *pdata); 66 + extern int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys); 58 67 59 68 extern void am35x_musb_reset(void); 60 69 extern void am35x_musb_phy_power(u8 on);
+7
arch/arm/mach-s3c24xx/Kconfig
··· 30 30 select S3C2410_CLOCK 31 31 select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX 32 32 select S3C2410_PM if PM 33 + select SAMSUNG_HRT 33 34 help 34 35 Support for S3C2410 and S3C2410A family from the S3C24XX line 35 36 of Samsung Mobile CPUs. ··· 41 40 select CPU_LLSERIAL_S3C2440 42 41 select S3C2412_DMA if S3C24XX_DMA 43 42 select S3C2412_PM if PM 43 + select SAMSUNG_HRT 44 44 help 45 45 Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line 46 46 ··· 53 51 select S3C2443_COMMON 54 52 select S3C2443_DMA if S3C24XX_DMA 55 53 select SAMSUNG_CLKSRC 54 + select SAMSUNG_HRT 56 55 help 57 56 Support for the S3C2416 SoC from the S3C24XX line 58 57 ··· 64 61 select S3C2410_CLOCK 65 62 select S3C2410_PM if PM 66 63 select S3C2440_DMA if S3C24XX_DMA 64 + select SAMSUNG_HRT 67 65 help 68 66 Support for S3C2440 Samsung Mobile CPU based systems. 69 67 ··· 74 70 select CPU_LLSERIAL_S3C2440 75 71 select S3C2410_CLOCK 76 72 select S3C2410_PM if PM 73 + select SAMSUNG_HRT 77 74 help 78 75 Support for S3C2442 Samsung Mobile CPU based systems. 79 76 ··· 89 84 select S3C2443_COMMON 90 85 select S3C2443_DMA if S3C24XX_DMA 91 86 select SAMSUNG_CLKSRC 87 + select SAMSUNG_HRT 92 88 help 93 89 Support for the S3C2443 SoC from the S3C24XX line 94 90 ··· 401 395 config S3C2412_PM 402 396 bool 403 397 select S3C2412_PM_SLEEP 398 + select SAMSUNG_WAKEMASK 404 399 help 405 400 Internal config node to apply S3C2412 power management 406 401
+4 -4
arch/arm/mach-s3c24xx/Makefile
··· 14 14 15 15 # core 16 16 17 - obj-y += common.o irq.o 17 + obj-y += common.o 18 18 19 19 obj-$(CONFIG_CPU_S3C2410) += s3c2410.o 20 20 obj-$(CONFIG_S3C2410_CPUFREQ) += cpufreq-s3c2410.o ··· 22 22 obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o 23 23 obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o 24 24 25 - obj-$(CONFIG_CPU_S3C2412) += s3c2412.o irq-s3c2412.o clock-s3c2412.o 25 + obj-$(CONFIG_CPU_S3C2412) += s3c2412.o clock-s3c2412.o 26 26 obj-$(CONFIG_S3C2412_CPUFREQ) += cpufreq-s3c2412.o 27 27 obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o 28 28 obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o ··· 31 31 obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o 32 32 obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o 33 33 34 - obj-$(CONFIG_CPU_S3C2440) += s3c2440.o irq-s3c2440.o clock-s3c2440.o 34 + obj-$(CONFIG_CPU_S3C2440) += s3c2440.o clock-s3c2440.o 35 35 obj-$(CONFIG_CPU_S3C2442) += s3c2442.o 36 - obj-$(CONFIG_CPU_S3C244X) += s3c244x.o irq-s3c244x.o clock-s3c244x.o 36 + obj-$(CONFIG_CPU_S3C244X) += s3c244x.o clock-s3c244x.o 37 37 obj-$(CONFIG_S3C2440_CPUFREQ) += cpufreq-s3c2440.o 38 38 obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o 39 39 obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o
+4
arch/arm/mach-s3c24xx/common.h
··· 21 21 extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); 22 22 extern void s3c2410_init_clocks(int xtal); 23 23 extern void s3c2410_restart(char mode, const char *cmd); 24 + extern void s3c2410_init_irq(void); 24 25 #else 25 26 #define s3c2410_init_clocks NULL 26 27 #define s3c2410_init_uarts NULL ··· 37 36 extern void s3c2412_init_clocks(int xtal); 38 37 extern int s3c2412_baseclk_add(void); 39 38 extern void s3c2412_restart(char mode, const char *cmd); 39 + extern void s3c2412_init_irq(void); 40 40 #else 41 41 #define s3c2412_init_clocks NULL 42 42 #define s3c2412_init_uarts NULL ··· 75 73 #ifdef CONFIG_CPU_S3C2440 76 74 extern int s3c2440_init(void); 77 75 extern void s3c2440_map_io(void); 76 + extern void s3c2440_init_irq(void); 78 77 #else 79 78 #define s3c2440_init NULL 80 79 #define s3c2440_map_io NULL ··· 84 81 #ifdef CONFIG_CPU_S3C2442 85 82 extern int s3c2442_init(void); 86 83 extern void s3c2442_map_io(void); 84 + extern void s3c2442_init_irq(void); 87 85 #else 88 86 #define s3c2442_init NULL 89 87 #define s3c2442_map_io NULL
-70
arch/arm/mach-s3c24xx/include/mach/entry-macro.S
··· 1 - /* 2 - * arch/arm/mach-s3c2410/include/mach/entry-macro.S 3 - * 4 - * Low-level IRQ helper macros for S3C2410-based platforms 5 - * 6 - * This file is licensed under the terms of the GNU General Public 7 - * License version 2. This program is licensed "as is" without any 8 - * warranty of any kind, whether express or implied. 9 - */ 10 - 11 - /* We have a problem that the INTOFFSET register does not always 12 - * show one interrupt. Occasionally we get two interrupts through 13 - * the prioritiser, and this causes the INTOFFSET register to show 14 - * what looks like the logical-or of the two interrupt numbers. 15 - * 16 - * Thanks to Klaus, Shannon, et al for helping to debug this problem 17 - */ 18 - 19 - #define INTPND (0x10) 20 - #define INTOFFSET (0x14) 21 - 22 - #include <mach/hardware.h> 23 - #include <asm/irq.h> 24 - 25 - .macro get_irqnr_preamble, base, tmp 26 - .endm 27 - 28 - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 29 - 30 - mov \base, #S3C24XX_VA_IRQ 31 - 32 - @@ try the interrupt offset register, since it is there 33 - 34 - ldr \irqstat, [\base, #INTPND ] 35 - teq \irqstat, #0 36 - beq 1002f 37 - ldr \irqnr, [\base, #INTOFFSET ] 38 - mov \tmp, #1 39 - tst \irqstat, \tmp, lsl \irqnr 40 - bne 1001f 41 - 42 - @@ the number specified is not a valid irq, so try 43 - @@ and work it out for ourselves 44 - 45 - mov \irqnr, #0 @@ start here 46 - 47 - @@ work out which irq (if any) we got 48 - 49 - movs \tmp, \irqstat, lsl#16 50 - addeq \irqnr, \irqnr, #16 51 - moveq \irqstat, \irqstat, lsr#16 52 - tst \irqstat, #0xff 53 - addeq \irqnr, \irqnr, #8 54 - moveq \irqstat, \irqstat, lsr#8 55 - tst \irqstat, #0xf 56 - addeq \irqnr, \irqnr, #4 57 - moveq \irqstat, \irqstat, lsr#4 58 - tst \irqstat, #0x3 59 - addeq \irqnr, \irqnr, #2 60 - moveq \irqstat, \irqstat, lsr#2 61 - tst \irqstat, #0x1 62 - addeq \irqnr, \irqnr, #1 63 - 64 - @@ we have the value 65 - 1001: 66 - adds \irqnr, \irqnr, #IRQ_EINT0 67 - 1002: 68 - @@ exit here, Z flag unset if IRQ 69 - 70 - .endm
+31 -27
arch/arm/mach-s3c24xx/include/mach/irqs.h
··· 59 59 #define IRQ_ADCPARENT S3C2410_IRQ(31) 60 60 61 61 /* interrupts generated from the external interrupts sources */ 62 - #define IRQ_EINT4 S3C2410_IRQ(32) /* 48 */ 63 - #define IRQ_EINT5 S3C2410_IRQ(33) 64 - #define IRQ_EINT6 S3C2410_IRQ(34) 65 - #define IRQ_EINT7 S3C2410_IRQ(35) 66 - #define IRQ_EINT8 S3C2410_IRQ(36) 67 - #define IRQ_EINT9 S3C2410_IRQ(37) 68 - #define IRQ_EINT10 S3C2410_IRQ(38) 69 - #define IRQ_EINT11 S3C2410_IRQ(39) 70 - #define IRQ_EINT12 S3C2410_IRQ(40) 71 - #define IRQ_EINT13 S3C2410_IRQ(41) 72 - #define IRQ_EINT14 S3C2410_IRQ(42) 73 - #define IRQ_EINT15 S3C2410_IRQ(43) 74 - #define IRQ_EINT16 S3C2410_IRQ(44) 75 - #define IRQ_EINT17 S3C2410_IRQ(45) 76 - #define IRQ_EINT18 S3C2410_IRQ(46) 77 - #define IRQ_EINT19 S3C2410_IRQ(47) 78 - #define IRQ_EINT20 S3C2410_IRQ(48) /* 64 */ 79 - #define IRQ_EINT21 S3C2410_IRQ(49) 80 - #define IRQ_EINT22 S3C2410_IRQ(50) 81 - #define IRQ_EINT23 S3C2410_IRQ(51) 62 + #define IRQ_EINT0_2412 S3C2410_IRQ(32) 63 + #define IRQ_EINT1_2412 S3C2410_IRQ(33) 64 + #define IRQ_EINT2_2412 S3C2410_IRQ(34) 65 + #define IRQ_EINT3_2412 S3C2410_IRQ(35) 66 + #define IRQ_EINT4 S3C2410_IRQ(36) /* 52 */ 67 + #define IRQ_EINT5 S3C2410_IRQ(37) 68 + #define IRQ_EINT6 S3C2410_IRQ(38) 69 + #define IRQ_EINT7 S3C2410_IRQ(39) 70 + #define IRQ_EINT8 S3C2410_IRQ(40) 71 + #define IRQ_EINT9 S3C2410_IRQ(41) 72 + #define IRQ_EINT10 S3C2410_IRQ(42) 73 + #define IRQ_EINT11 S3C2410_IRQ(43) 74 + #define IRQ_EINT12 S3C2410_IRQ(44) 75 + #define IRQ_EINT13 S3C2410_IRQ(45) 76 + #define IRQ_EINT14 S3C2410_IRQ(46) 77 + #define IRQ_EINT15 S3C2410_IRQ(47) 78 + #define IRQ_EINT16 S3C2410_IRQ(48) 79 + #define IRQ_EINT17 S3C2410_IRQ(49) 80 + #define IRQ_EINT18 S3C2410_IRQ(50) 81 + #define IRQ_EINT19 S3C2410_IRQ(51) 82 + #define IRQ_EINT20 S3C2410_IRQ(52) /* 68 */ 83 + #define IRQ_EINT21 S3C2410_IRQ(53) 84 + #define IRQ_EINT22 S3C2410_IRQ(54) 85 + #define IRQ_EINT23 S3C2410_IRQ(55) 82 86 83 87 #define IRQ_EINT_BIT(x) ((x) - IRQ_EINT4 + 4) 84 88 #define IRQ_EINT(x) (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x))) 85 89 86 - #define IRQ_LCD_FIFO S3C2410_IRQ(52) 87 - #define IRQ_LCD_FRAME S3C2410_IRQ(53) 90 + #define IRQ_LCD_FIFO S3C2410_IRQ(56) 91 + #define IRQ_LCD_FRAME S3C2410_IRQ(57) 88 92 89 93 /* IRQs for the interal UARTs, and ADC 90 94 * these need to be ordered in number of appearance in the 91 95 * SUBSRC mask register 92 96 */ 93 97 94 - #define S3C2410_IRQSUB(x) S3C2410_IRQ((x)+54) 98 + #define S3C2410_IRQSUB(x) S3C2410_IRQ((x)+58) 95 99 96 - #define IRQ_S3CUART_RX0 S3C2410_IRQSUB(0) /* 70 */ 100 + #define IRQ_S3CUART_RX0 S3C2410_IRQSUB(0) /* 74 */ 97 101 #define IRQ_S3CUART_TX0 S3C2410_IRQSUB(1) 98 102 #define IRQ_S3CUART_ERR0 S3C2410_IRQSUB(2) 99 103 100 - #define IRQ_S3CUART_RX1 S3C2410_IRQSUB(3) /* 73 */ 104 + #define IRQ_S3CUART_RX1 S3C2410_IRQSUB(3) /* 77 */ 101 105 #define IRQ_S3CUART_TX1 S3C2410_IRQSUB(4) 102 106 #define IRQ_S3CUART_ERR1 S3C2410_IRQSUB(5) 103 107 104 - #define IRQ_S3CUART_RX2 S3C2410_IRQSUB(6) /* 76 */ 108 + #define IRQ_S3CUART_RX2 S3C2410_IRQSUB(6) /* 80 */ 105 109 #define IRQ_S3CUART_TX2 S3C2410_IRQSUB(7) 106 110 #define IRQ_S3CUART_ERR2 S3C2410_IRQSUB(8) 107 111 ··· 140 136 141 137 /* second interrupt-register of s3c2416/s3c2450 */ 142 138 143 - #define S3C2416_IRQ(x) S3C2410_IRQ((x) + 54 + 29) 139 + #define S3C2416_IRQ(x) S3C2410_IRQ((x) + 58 + 29) 144 140 #define IRQ_S3C2416_2D S3C2416_IRQ(0) 145 141 #define IRQ_S3C2416_IIC1 S3C2416_IRQ(1) 146 142 #define IRQ_S3C2416_RESERVED2 S3C2416_IRQ(2)
-215
arch/arm/mach-s3c24xx/irq-s3c2412.c
··· 1 - /* linux/arch/arm/mach-s3c2412/irq.c 2 - * 3 - * Copyright (c) 2006 Simtec Electronics 4 - * Ben Dooks <ben@simtec.co.uk> 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 - * 20 - */ 21 - 22 - #include <linux/init.h> 23 - #include <linux/module.h> 24 - #include <linux/interrupt.h> 25 - #include <linux/ioport.h> 26 - #include <linux/device.h> 27 - #include <linux/io.h> 28 - 29 - #include <mach/hardware.h> 30 - #include <asm/irq.h> 31 - 32 - #include <asm/mach/irq.h> 33 - 34 - #include <mach/regs-irq.h> 35 - #include <mach/regs-gpio.h> 36 - 37 - #include <plat/cpu.h> 38 - #include <plat/irq.h> 39 - #include <plat/pm.h> 40 - 41 - #include "s3c2412-power.h" 42 - 43 - #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) 44 - #define INTMSK_SUB(start, end) (INTMSK(start, end) << ((start - S3C2410_IRQSUB(0)))) 45 - 46 - /* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by 47 - * having them turn up in both the INT* and the EINT* registers. Whilst 48 - * both show the status, they both now need to be acked when the IRQs 49 - * go off. 50 - */ 51 - 52 - static void 53 - s3c2412_irq_mask(struct irq_data *data) 54 - { 55 - unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); 56 - unsigned long mask; 57 - 58 - mask = __raw_readl(S3C2410_INTMSK); 59 - __raw_writel(mask | bitval, S3C2410_INTMSK); 60 - 61 - mask = __raw_readl(S3C2412_EINTMASK); 62 - __raw_writel(mask | bitval, S3C2412_EINTMASK); 63 - } 64 - 65 - static inline void 66 - s3c2412_irq_ack(struct irq_data *data) 67 - { 68 - unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); 69 - 70 - __raw_writel(bitval, S3C2412_EINTPEND); 71 - __raw_writel(bitval, S3C2410_SRCPND); 72 - __raw_writel(bitval, S3C2410_INTPND); 73 - } 74 - 75 - static inline void 76 - s3c2412_irq_maskack(struct irq_data *data) 77 - { 78 - unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); 79 - unsigned long mask; 80 - 81 - mask = __raw_readl(S3C2410_INTMSK); 82 - __raw_writel(mask|bitval, S3C2410_INTMSK); 83 - 84 - mask = __raw_readl(S3C2412_EINTMASK); 85 - __raw_writel(mask | bitval, S3C2412_EINTMASK); 86 - 87 - __raw_writel(bitval, S3C2412_EINTPEND); 88 - __raw_writel(bitval, S3C2410_SRCPND); 89 - __raw_writel(bitval, S3C2410_INTPND); 90 - } 91 - 92 - static void 93 - s3c2412_irq_unmask(struct irq_data *data) 94 - { 95 - unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); 96 - unsigned long mask; 97 - 98 - mask = __raw_readl(S3C2412_EINTMASK); 99 - __raw_writel(mask & ~bitval, S3C2412_EINTMASK); 100 - 101 - mask = __raw_readl(S3C2410_INTMSK); 102 - __raw_writel(mask & ~bitval, S3C2410_INTMSK); 103 - } 104 - 105 - static struct irq_chip s3c2412_irq_eint0t4 = { 106 - .irq_ack = s3c2412_irq_ack, 107 - .irq_mask = s3c2412_irq_mask, 108 - .irq_unmask = s3c2412_irq_unmask, 109 - .irq_set_wake = s3c_irq_wake, 110 - .irq_set_type = s3c_irqext_type, 111 - }; 112 - 113 - #define INTBIT(x) (1 << ((x) - S3C2410_IRQSUB(0))) 114 - 115 - /* CF and SDI sub interrupts */ 116 - 117 - static void s3c2412_irq_demux_cfsdi(unsigned int irq, struct irq_desc *desc) 118 - { 119 - unsigned int subsrc, submsk; 120 - 121 - subsrc = __raw_readl(S3C2410_SUBSRCPND); 122 - submsk = __raw_readl(S3C2410_INTSUBMSK); 123 - 124 - subsrc &= ~submsk; 125 - 126 - if (subsrc & INTBIT(IRQ_S3C2412_SDI)) 127 - generic_handle_irq(IRQ_S3C2412_SDI); 128 - 129 - if (subsrc & INTBIT(IRQ_S3C2412_CF)) 130 - generic_handle_irq(IRQ_S3C2412_CF); 131 - } 132 - 133 - #define INTMSK_CFSDI (1UL << (IRQ_S3C2412_CFSDI - IRQ_EINT0)) 134 - #define SUBMSK_CFSDI INTMSK_SUB(IRQ_S3C2412_SDI, IRQ_S3C2412_CF) 135 - 136 - static void s3c2412_irq_cfsdi_mask(struct irq_data *data) 137 - { 138 - s3c_irqsub_mask(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); 139 - } 140 - 141 - static void s3c2412_irq_cfsdi_unmask(struct irq_data *data) 142 - { 143 - s3c_irqsub_unmask(data->irq, INTMSK_CFSDI); 144 - } 145 - 146 - static void s3c2412_irq_cfsdi_ack(struct irq_data *data) 147 - { 148 - s3c_irqsub_maskack(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); 149 - } 150 - 151 - static struct irq_chip s3c2412_irq_cfsdi = { 152 - .name = "s3c2412-cfsdi", 153 - .irq_ack = s3c2412_irq_cfsdi_ack, 154 - .irq_mask = s3c2412_irq_cfsdi_mask, 155 - .irq_unmask = s3c2412_irq_cfsdi_unmask, 156 - }; 157 - 158 - static int s3c2412_irq_rtc_wake(struct irq_data *data, unsigned int state) 159 - { 160 - unsigned long pwrcfg; 161 - 162 - pwrcfg = __raw_readl(S3C2412_PWRCFG); 163 - if (state) 164 - pwrcfg &= ~S3C2412_PWRCFG_RTC_MASKIRQ; 165 - else 166 - pwrcfg |= S3C2412_PWRCFG_RTC_MASKIRQ; 167 - __raw_writel(pwrcfg, S3C2412_PWRCFG); 168 - 169 - return s3c_irq_chip.irq_set_wake(data, state); 170 - } 171 - 172 - static struct irq_chip s3c2412_irq_rtc_chip; 173 - 174 - static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif) 175 - { 176 - unsigned int irqno; 177 - 178 - for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) { 179 - irq_set_chip_and_handler(irqno, &s3c2412_irq_eint0t4, 180 - handle_edge_irq); 181 - set_irq_flags(irqno, IRQF_VALID); 182 - } 183 - 184 - /* add demux support for CF/SDI */ 185 - 186 - irq_set_chained_handler(IRQ_S3C2412_CFSDI, s3c2412_irq_demux_cfsdi); 187 - 188 - for (irqno = IRQ_S3C2412_SDI; irqno <= IRQ_S3C2412_CF; irqno++) { 189 - irq_set_chip_and_handler(irqno, &s3c2412_irq_cfsdi, 190 - handle_level_irq); 191 - set_irq_flags(irqno, IRQF_VALID); 192 - } 193 - 194 - /* change RTC IRQ's set wake method */ 195 - 196 - s3c2412_irq_rtc_chip = s3c_irq_chip; 197 - s3c2412_irq_rtc_chip.irq_set_wake = s3c2412_irq_rtc_wake; 198 - 199 - irq_set_chip(IRQ_RTC, &s3c2412_irq_rtc_chip); 200 - 201 - return 0; 202 - } 203 - 204 - static struct subsys_interface s3c2412_irq_interface = { 205 - .name = "s3c2412_irq", 206 - .subsys = &s3c2412_subsys, 207 - .add_dev = s3c2412_irq_add, 208 - }; 209 - 210 - static int s3c2412_irq_init(void) 211 - { 212 - return subsys_interface_register(&s3c2412_irq_interface); 213 - } 214 - 215 - arch_initcall(s3c2412_irq_init);
-128
arch/arm/mach-s3c24xx/irq-s3c2440.c
··· 1 - /* linux/arch/arm/mach-s3c2440/irq.c 2 - * 3 - * Copyright (c) 2003-2004 Simtec Electronics 4 - * Ben Dooks <ben@simtec.co.uk> 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 - * 20 - */ 21 - 22 - #include <linux/init.h> 23 - #include <linux/module.h> 24 - #include <linux/interrupt.h> 25 - #include <linux/ioport.h> 26 - #include <linux/device.h> 27 - #include <linux/io.h> 28 - 29 - #include <mach/hardware.h> 30 - #include <asm/irq.h> 31 - 32 - #include <asm/mach/irq.h> 33 - 34 - #include <mach/regs-irq.h> 35 - #include <mach/regs-gpio.h> 36 - 37 - #include <plat/cpu.h> 38 - #include <plat/pm.h> 39 - #include <plat/irq.h> 40 - 41 - /* WDT/AC97 */ 42 - 43 - static void s3c_irq_demux_wdtac97(unsigned int irq, 44 - struct irq_desc *desc) 45 - { 46 - unsigned int subsrc, submsk; 47 - 48 - /* read the current pending interrupts, and the mask 49 - * for what it is available */ 50 - 51 - subsrc = __raw_readl(S3C2410_SUBSRCPND); 52 - submsk = __raw_readl(S3C2410_INTSUBMSK); 53 - 54 - subsrc &= ~submsk; 55 - subsrc >>= 13; 56 - subsrc &= 3; 57 - 58 - if (subsrc != 0) { 59 - if (subsrc & 1) { 60 - generic_handle_irq(IRQ_S3C2440_WDT); 61 - } 62 - if (subsrc & 2) { 63 - generic_handle_irq(IRQ_S3C2440_AC97); 64 - } 65 - } 66 - } 67 - 68 - 69 - #define INTMSK_WDT (1UL << (IRQ_WDT - IRQ_EINT0)) 70 - 71 - static void 72 - s3c_irq_wdtac97_mask(struct irq_data *data) 73 - { 74 - s3c_irqsub_mask(data->irq, INTMSK_WDT, 3 << 13); 75 - } 76 - 77 - static void 78 - s3c_irq_wdtac97_unmask(struct irq_data *data) 79 - { 80 - s3c_irqsub_unmask(data->irq, INTMSK_WDT); 81 - } 82 - 83 - static void 84 - s3c_irq_wdtac97_ack(struct irq_data *data) 85 - { 86 - s3c_irqsub_maskack(data->irq, INTMSK_WDT, 3 << 13); 87 - } 88 - 89 - static struct irq_chip s3c_irq_wdtac97 = { 90 - .irq_mask = s3c_irq_wdtac97_mask, 91 - .irq_unmask = s3c_irq_wdtac97_unmask, 92 - .irq_ack = s3c_irq_wdtac97_ack, 93 - }; 94 - 95 - static int s3c2440_irq_add(struct device *dev, struct subsys_interface *sif) 96 - { 97 - unsigned int irqno; 98 - 99 - printk("S3C2440: IRQ Support\n"); 100 - 101 - /* add new chained handler for wdt, ac7 */ 102 - 103 - irq_set_chip_and_handler(IRQ_WDT, &s3c_irq_level_chip, 104 - handle_level_irq); 105 - irq_set_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97); 106 - 107 - for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) { 108 - irq_set_chip_and_handler(irqno, &s3c_irq_wdtac97, 109 - handle_level_irq); 110 - set_irq_flags(irqno, IRQF_VALID); 111 - } 112 - 113 - return 0; 114 - } 115 - 116 - static struct subsys_interface s3c2440_irq_interface = { 117 - .name = "s3c2440_irq", 118 - .subsys = &s3c2440_subsys, 119 - .add_dev = s3c2440_irq_add, 120 - }; 121 - 122 - static int s3c2440_irq_init(void) 123 - { 124 - return subsys_interface_register(&s3c2440_irq_interface); 125 - } 126 - 127 - arch_initcall(s3c2440_irq_init); 128 -
-142
arch/arm/mach-s3c24xx/irq-s3c244x.c
··· 1 - /* linux/arch/arm/plat-s3c24xx/s3c244x-irq.c 2 - * 3 - * Copyright (c) 2003-2004 Simtec Electronics 4 - * Ben Dooks <ben@simtec.co.uk> 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 - * 20 - */ 21 - 22 - #include <linux/init.h> 23 - #include <linux/module.h> 24 - #include <linux/interrupt.h> 25 - #include <linux/ioport.h> 26 - #include <linux/device.h> 27 - #include <linux/io.h> 28 - 29 - #include <mach/hardware.h> 30 - #include <asm/irq.h> 31 - 32 - #include <asm/mach/irq.h> 33 - 34 - #include <mach/regs-irq.h> 35 - #include <mach/regs-gpio.h> 36 - 37 - #include <plat/cpu.h> 38 - #include <plat/pm.h> 39 - #include <plat/irq.h> 40 - 41 - /* camera irq */ 42 - 43 - static void s3c_irq_demux_cam(unsigned int irq, 44 - struct irq_desc *desc) 45 - { 46 - unsigned int subsrc, submsk; 47 - 48 - /* read the current pending interrupts, and the mask 49 - * for what it is available */ 50 - 51 - subsrc = __raw_readl(S3C2410_SUBSRCPND); 52 - submsk = __raw_readl(S3C2410_INTSUBMSK); 53 - 54 - subsrc &= ~submsk; 55 - subsrc >>= 11; 56 - subsrc &= 3; 57 - 58 - if (subsrc != 0) { 59 - if (subsrc & 1) { 60 - generic_handle_irq(IRQ_S3C2440_CAM_C); 61 - } 62 - if (subsrc & 2) { 63 - generic_handle_irq(IRQ_S3C2440_CAM_P); 64 - } 65 - } 66 - } 67 - 68 - #define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0)) 69 - 70 - static void 71 - s3c_irq_cam_mask(struct irq_data *data) 72 - { 73 - s3c_irqsub_mask(data->irq, INTMSK_CAM, 3 << 11); 74 - } 75 - 76 - static void 77 - s3c_irq_cam_unmask(struct irq_data *data) 78 - { 79 - s3c_irqsub_unmask(data->irq, INTMSK_CAM); 80 - } 81 - 82 - static void 83 - s3c_irq_cam_ack(struct irq_data *data) 84 - { 85 - s3c_irqsub_maskack(data->irq, INTMSK_CAM, 3 << 11); 86 - } 87 - 88 - static struct irq_chip s3c_irq_cam = { 89 - .irq_mask = s3c_irq_cam_mask, 90 - .irq_unmask = s3c_irq_cam_unmask, 91 - .irq_ack = s3c_irq_cam_ack, 92 - }; 93 - 94 - static int s3c244x_irq_add(struct device *dev, struct subsys_interface *sif) 95 - { 96 - unsigned int irqno; 97 - 98 - irq_set_chip_and_handler(IRQ_NFCON, &s3c_irq_level_chip, 99 - handle_level_irq); 100 - set_irq_flags(IRQ_NFCON, IRQF_VALID); 101 - 102 - /* add chained handler for camera */ 103 - 104 - irq_set_chip_and_handler(IRQ_CAM, &s3c_irq_level_chip, 105 - handle_level_irq); 106 - irq_set_chained_handler(IRQ_CAM, s3c_irq_demux_cam); 107 - 108 - for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) { 109 - irq_set_chip_and_handler(irqno, &s3c_irq_cam, 110 - handle_level_irq); 111 - set_irq_flags(irqno, IRQF_VALID); 112 - } 113 - 114 - return 0; 115 - } 116 - 117 - static struct subsys_interface s3c2440_irq_interface = { 118 - .name = "s3c2440_irq", 119 - .subsys = &s3c2440_subsys, 120 - .add_dev = s3c244x_irq_add, 121 - }; 122 - 123 - static int s3c2440_irq_init(void) 124 - { 125 - return subsys_interface_register(&s3c2440_irq_interface); 126 - } 127 - 128 - arch_initcall(s3c2440_irq_init); 129 - 130 - static struct subsys_interface s3c2442_irq_interface = { 131 - .name = "s3c2442_irq", 132 - .subsys = &s3c2442_subsys, 133 - .add_dev = s3c244x_irq_add, 134 - }; 135 - 136 - 137 - static int s3c2442_irq_init(void) 138 - { 139 - return subsys_interface_register(&s3c2442_irq_interface); 140 - } 141 - 142 - arch_initcall(s3c2442_irq_init);
+613 -78
arch/arm/mach-s3c24xx/irq.c drivers/irqchip/irq-s3c24xx.c
··· 26 26 #include <linux/device.h> 27 27 #include <linux/irqdomain.h> 28 28 #include <linux/irqchip/chained_irq.h> 29 + #include <linux/of.h> 30 + #include <linux/of_irq.h> 31 + #include <linux/of_address.h> 29 32 33 + #include <asm/exception.h> 30 34 #include <asm/mach/irq.h> 31 35 32 36 #include <mach/regs-irq.h> ··· 40 36 #include <plat/regs-irqtype.h> 41 37 #include <plat/pm.h> 42 38 39 + #include "irqchip.h" 40 + 43 41 #define S3C_IRQTYPE_NONE 0 44 42 #define S3C_IRQTYPE_EINT 1 45 43 #define S3C_IRQTYPE_EDGE 2 ··· 49 43 50 44 struct s3c_irq_data { 51 45 unsigned int type; 46 + unsigned long offset; 52 47 unsigned long parent_irq; 53 48 54 49 /* data gets filled during init */ ··· 76 69 struct s3c_irq_data *irqs; 77 70 }; 78 71 72 + /* 73 + * Array holding pointers to the global controller structs 74 + * [0] ... main_intc 75 + * [1] ... sub_intc 76 + * [2] ... main_intc2 on s3c2416 77 + */ 78 + static struct s3c_irq_intc *s3c_intc[3]; 79 + 79 80 static void s3c_irq_mask(struct irq_data *data) 80 81 { 81 - struct s3c_irq_intc *intc = data->domain->host_data; 82 + struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); 83 + struct s3c_irq_intc *intc = irq_data->intc; 82 84 struct s3c_irq_intc *parent_intc = intc->parent; 83 - struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; 84 85 struct s3c_irq_data *parent_data; 85 86 unsigned long mask; 86 87 unsigned int irqno; 87 88 88 89 mask = __raw_readl(intc->reg_mask); 89 - mask |= (1UL << data->hwirq); 90 + mask |= (1UL << irq_data->offset); 90 91 __raw_writel(mask, intc->reg_mask); 91 92 92 - if (parent_intc && irq_data->parent_irq) { 93 + if (parent_intc) { 93 94 parent_data = &parent_intc->irqs[irq_data->parent_irq]; 94 95 95 - /* check to see if we need to mask the parent IRQ */ 96 + /* check to see if we need to mask the parent IRQ 97 + * The parent_irq is always in main_intc, so the hwirq 98 + * for find_mapping does not need an offset in any case. 99 + */ 96 100 if ((mask & parent_data->sub_bits) == parent_data->sub_bits) { 97 101 irqno = irq_find_mapping(parent_intc->domain, 98 102 irq_data->parent_irq); ··· 114 96 115 97 static void s3c_irq_unmask(struct irq_data *data) 116 98 { 117 - struct s3c_irq_intc *intc = data->domain->host_data; 99 + struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); 100 + struct s3c_irq_intc *intc = irq_data->intc; 118 101 struct s3c_irq_intc *parent_intc = intc->parent; 119 - struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; 120 102 unsigned long mask; 121 103 unsigned int irqno; 122 104 123 105 mask = __raw_readl(intc->reg_mask); 124 - mask &= ~(1UL << data->hwirq); 106 + mask &= ~(1UL << irq_data->offset); 125 107 __raw_writel(mask, intc->reg_mask); 126 108 127 - if (parent_intc && irq_data->parent_irq) { 109 + if (parent_intc) { 128 110 irqno = irq_find_mapping(parent_intc->domain, 129 111 irq_data->parent_irq); 130 112 s3c_irq_unmask(irq_get_irq_data(irqno)); ··· 133 115 134 116 static inline void s3c_irq_ack(struct irq_data *data) 135 117 { 136 - struct s3c_irq_intc *intc = data->domain->host_data; 137 - unsigned long bitval = 1UL << data->hwirq; 118 + struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); 119 + struct s3c_irq_intc *intc = irq_data->intc; 120 + unsigned long bitval = 1UL << irq_data->offset; 138 121 139 122 __raw_writel(bitval, intc->reg_pending); 140 123 if (intc->reg_intpnd) 141 124 __raw_writel(bitval, intc->reg_intpnd); 125 + } 126 + 127 + static int s3c_irq_type(struct irq_data *data, unsigned int type) 128 + { 129 + switch (type) { 130 + case IRQ_TYPE_NONE: 131 + break; 132 + case IRQ_TYPE_EDGE_RISING: 133 + case IRQ_TYPE_EDGE_FALLING: 134 + case IRQ_TYPE_EDGE_BOTH: 135 + irq_set_handler(data->irq, handle_edge_irq); 136 + break; 137 + case IRQ_TYPE_LEVEL_LOW: 138 + case IRQ_TYPE_LEVEL_HIGH: 139 + irq_set_handler(data->irq, handle_level_irq); 140 + break; 141 + default: 142 + pr_err("No such irq type %d", type); 143 + return -EINVAL; 144 + } 145 + 146 + return 0; 142 147 } 143 148 144 149 static int s3c_irqext_type_set(void __iomem *gpcon_reg, ··· 269 228 .irq_ack = s3c_irq_ack, 270 229 .irq_mask = s3c_irq_mask, 271 230 .irq_unmask = s3c_irq_unmask, 231 + .irq_set_type = s3c_irq_type, 272 232 .irq_set_wake = s3c_irq_wake 273 233 }; 274 234 ··· 278 236 .irq_mask = s3c_irq_mask, 279 237 .irq_unmask = s3c_irq_unmask, 280 238 .irq_ack = s3c_irq_ack, 239 + .irq_set_type = s3c_irq_type, 281 240 }; 282 241 283 242 static struct irq_chip s3c_irqext_chip = { ··· 302 259 static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) 303 260 { 304 261 struct irq_chip *chip = irq_desc_get_chip(desc); 305 - struct s3c_irq_intc *intc = desc->irq_data.domain->host_data; 306 - struct s3c_irq_data *irq_data = &intc->irqs[desc->irq_data.hwirq]; 262 + struct s3c_irq_data *irq_data = irq_desc_get_chip_data(desc); 263 + struct s3c_irq_intc *intc = irq_data->intc; 307 264 struct s3c_irq_intc *sub_intc = irq_data->sub_intc; 308 265 unsigned long src; 309 266 unsigned long msk; 310 267 unsigned int n; 268 + unsigned int offset; 269 + 270 + /* we're using individual domains for the non-dt case 271 + * and one big domain for the dt case where the subintc 272 + * starts at hwirq number 32. 273 + */ 274 + offset = (intc->domain->of_node) ? 32 : 0; 311 275 312 276 chained_irq_enter(chip, desc); 313 277 ··· 327 277 while (src) { 328 278 n = __ffs(src); 329 279 src &= ~(1 << n); 330 - generic_handle_irq(irq_find_mapping(sub_intc->domain, n)); 280 + irq = irq_find_mapping(sub_intc->domain, offset + n); 281 + generic_handle_irq(irq); 331 282 } 332 283 333 284 chained_irq_exit(chip, desc); 285 + } 286 + 287 + static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc, 288 + struct pt_regs *regs, int intc_offset) 289 + { 290 + int pnd; 291 + int offset; 292 + int irq; 293 + 294 + pnd = __raw_readl(intc->reg_intpnd); 295 + if (!pnd) 296 + return false; 297 + 298 + /* non-dt machines use individual domains */ 299 + if (!intc->domain->of_node) 300 + intc_offset = 0; 301 + 302 + /* We have a problem that the INTOFFSET register does not always 303 + * show one interrupt. Occasionally we get two interrupts through 304 + * the prioritiser, and this causes the INTOFFSET register to show 305 + * what looks like the logical-or of the two interrupt numbers. 306 + * 307 + * Thanks to Klaus, Shannon, et al for helping to debug this problem 308 + */ 309 + offset = __raw_readl(intc->reg_intpnd + 4); 310 + 311 + /* Find the bit manually, when the offset is wrong. 312 + * The pending register only ever contains the one bit of the next 313 + * interrupt to handle. 314 + */ 315 + if (!(pnd & (1 << offset))) 316 + offset = __ffs(pnd); 317 + 318 + irq = irq_find_mapping(intc->domain, intc_offset + offset); 319 + handle_IRQ(irq, regs); 320 + return true; 321 + } 322 + 323 + asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs) 324 + { 325 + do { 326 + if (likely(s3c_intc[0])) 327 + if (s3c24xx_handle_intc(s3c_intc[0], regs, 0)) 328 + continue; 329 + 330 + if (s3c_intc[2]) 331 + if (s3c24xx_handle_intc(s3c_intc[2], regs, 64)) 332 + continue; 333 + 334 + break; 335 + } while (1); 334 336 } 335 337 336 338 #ifdef CONFIG_FIQ ··· 427 325 struct s3c_irq_data *parent_irq_data; 428 326 unsigned int irqno; 429 327 430 - if (!intc) { 431 - pr_err("irq-s3c24xx: no controller found for hwirq %lu\n", hw); 432 - return -EINVAL; 433 - } 434 - 435 - if (!irq_data) { 436 - pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", hw); 437 - return -EINVAL; 438 - } 439 - 440 328 /* attach controller pointer to irq_data */ 441 329 irq_data->intc = intc; 330 + irq_data->offset = hw; 331 + 332 + parent_intc = intc->parent; 442 333 443 334 /* set handler and flags */ 444 335 switch (irq_data->type) { 445 336 case S3C_IRQTYPE_NONE: 446 337 return 0; 447 338 case S3C_IRQTYPE_EINT: 448 - if (irq_data->parent_irq) 339 + /* On the S3C2412, the EINT0to3 have a parent irq 340 + * but need the s3c_irq_eint0t4 chip 341 + */ 342 + if (parent_intc && (!soc_is_s3c2412() || hw >= 4)) 449 343 irq_set_chip_and_handler(virq, &s3c_irqext_chip, 450 344 handle_edge_irq); 451 345 else ··· 449 351 handle_edge_irq); 450 352 break; 451 353 case S3C_IRQTYPE_EDGE: 452 - if (irq_data->parent_irq || 453 - intc->reg_pending == S3C2416_SRCPND2) 354 + if (parent_intc || intc->reg_pending == S3C2416_SRCPND2) 454 355 irq_set_chip_and_handler(virq, &s3c_irq_level_chip, 455 356 handle_edge_irq); 456 357 else ··· 457 360 handle_edge_irq); 458 361 break; 459 362 case S3C_IRQTYPE_LEVEL: 460 - if (irq_data->parent_irq) 363 + if (parent_intc) 461 364 irq_set_chip_and_handler(virq, &s3c_irq_level_chip, 462 365 handle_level_irq); 463 366 else ··· 468 371 pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type); 469 372 return -EINVAL; 470 373 } 374 + 375 + irq_set_chip_data(virq, irq_data); 376 + 471 377 set_irq_flags(virq, IRQF_VALID); 472 378 473 - if (irq_data->parent_irq) { 474 - parent_intc = intc->parent; 475 - if (!parent_intc) { 476 - pr_err("irq-s3c24xx: no parent controller found for hwirq %lu\n", 477 - hw); 379 + if (parent_intc && irq_data->type != S3C_IRQTYPE_NONE) { 380 + if (irq_data->parent_irq > 31) { 381 + pr_err("irq-s3c24xx: parent irq %lu is out of range\n", 382 + irq_data->parent_irq); 478 383 goto err; 479 384 } 480 385 481 386 parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; 482 - if (!irq_data) { 483 - pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", 484 - hw); 485 - goto err; 486 - } 487 - 488 387 parent_irq_data->sub_intc = intc; 489 388 parent_irq_data->sub_bits |= (1UL << hw); 490 389 ··· 535 442 } 536 443 } 537 444 538 - struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, 445 + static struct s3c_irq_intc * __init s3c24xx_init_intc(struct device_node *np, 539 446 struct s3c_irq_data *irq_data, 540 447 struct s3c_irq_intc *parent, 541 448 unsigned long address) ··· 544 451 void __iomem *base = (void *)0xf6000000; /* static mapping */ 545 452 int irq_num; 546 453 int irq_start; 547 - int irq_offset; 548 454 int ret; 549 455 550 456 intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL); ··· 567 475 intc->reg_intpnd = base + 0x10; 568 476 irq_num = 32; 569 477 irq_start = S3C2410_IRQ(0); 570 - irq_offset = 0; 571 478 break; 572 479 case 0x4a000018: 573 480 pr_debug("irq: found subintc\n"); ··· 574 483 intc->reg_mask = base + 0x1c; 575 484 irq_num = 29; 576 485 irq_start = S3C2410_IRQSUB(0); 577 - irq_offset = 0; 578 486 break; 579 487 case 0x4a000040: 580 488 pr_debug("irq: found intc2\n"); ··· 582 492 intc->reg_intpnd = base + 0x50; 583 493 irq_num = 8; 584 494 irq_start = S3C2416_IRQ(0); 585 - irq_offset = 0; 586 495 break; 587 496 case 0x560000a4: 588 497 pr_debug("irq: found eintc\n"); ··· 589 500 590 501 intc->reg_mask = base + 0xa4; 591 502 intc->reg_pending = base + 0xa8; 592 - irq_num = 20; 503 + irq_num = 24; 593 504 irq_start = S3C2410_IRQ(32); 594 - irq_offset = 4; 595 505 break; 596 506 default: 597 507 pr_err("irq: unsupported controller address\n"); ··· 601 513 /* now that all the data is complete, init the irq-domain */ 602 514 s3c24xx_clear_intc(intc); 603 515 intc->domain = irq_domain_add_legacy(np, irq_num, irq_start, 604 - irq_offset, &s3c24xx_irq_ops, 516 + 0, &s3c24xx_irq_ops, 605 517 intc); 606 518 if (!intc->domain) { 607 519 pr_err("irq: could not create irq-domain\n"); 608 520 ret = -EINVAL; 609 521 goto err; 610 522 } 523 + 524 + set_handle_irq(s3c24xx_handle_irq); 611 525 612 526 return intc; 613 527 ··· 618 528 return ERR_PTR(ret); 619 529 } 620 530 621 - /* s3c24xx_init_irq 622 - * 623 - * Initialise S3C2410 IRQ system 624 - */ 531 + static struct s3c_irq_data init_eint[32] = { 532 + { .type = S3C_IRQTYPE_NONE, }, /* reserved */ 533 + { .type = S3C_IRQTYPE_NONE, }, /* reserved */ 534 + { .type = S3C_IRQTYPE_NONE, }, /* reserved */ 535 + { .type = S3C_IRQTYPE_NONE, }, /* reserved */ 536 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ 537 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ 538 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ 539 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */ 540 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */ 541 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */ 542 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */ 543 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */ 544 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */ 545 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */ 546 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */ 547 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */ 548 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */ 549 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */ 550 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */ 551 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */ 552 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */ 553 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */ 554 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */ 555 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ 556 + }; 625 557 626 - static struct s3c_irq_data init_base[32] = { 558 + #ifdef CONFIG_CPU_S3C2410 559 + static struct s3c_irq_data init_s3c2410base[32] = { 627 560 { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ 628 561 { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ 629 562 { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ ··· 681 568 { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ 682 569 }; 683 570 684 - static struct s3c_irq_data init_eint[32] = { 571 + static struct s3c_irq_data init_s3c2410subint[32] = { 572 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ 573 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ 574 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ 575 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ 576 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ 577 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ 578 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ 579 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ 580 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ 581 + { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ 582 + { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ 583 + }; 584 + 585 + void __init s3c2410_init_irq(void) 586 + { 587 + #ifdef CONFIG_FIQ 588 + init_FIQ(FIQ_START); 589 + #endif 590 + 591 + s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2410base[0], NULL, 592 + 0x4a000000); 593 + if (IS_ERR(s3c_intc[0])) { 594 + pr_err("irq: could not create main interrupt controller\n"); 595 + return; 596 + } 597 + 598 + s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2410subint[0], 599 + s3c_intc[0], 0x4a000018); 600 + s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); 601 + } 602 + #endif 603 + 604 + #ifdef CONFIG_CPU_S3C2412 605 + static struct s3c_irq_data init_s3c2412base[32] = { 606 + { .type = S3C_IRQTYPE_LEVEL, }, /* EINT0 */ 607 + { .type = S3C_IRQTYPE_LEVEL, }, /* EINT1 */ 608 + { .type = S3C_IRQTYPE_LEVEL, }, /* EINT2 */ 609 + { .type = S3C_IRQTYPE_LEVEL, }, /* EINT3 */ 610 + { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ 611 + { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ 685 612 { .type = S3C_IRQTYPE_NONE, }, /* reserved */ 613 + { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ 614 + { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ 615 + { .type = S3C_IRQTYPE_EDGE, }, /* WDT */ 616 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ 617 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ 618 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ 619 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ 620 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ 621 + { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ 622 + { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ 623 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ 624 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ 625 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ 626 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ 627 + { .type = S3C_IRQTYPE_LEVEL, }, /* SDI/CF */ 628 + { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ 629 + { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ 686 630 { .type = S3C_IRQTYPE_NONE, }, /* reserved */ 687 - { .type = S3C_IRQTYPE_NONE, }, /* reserved */ 688 - { .type = S3C_IRQTYPE_NONE, }, /* reserved */ 631 + { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ 632 + { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ 633 + { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ 634 + { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ 635 + { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ 636 + { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ 637 + { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ 638 + }; 639 + 640 + static struct s3c_irq_data init_s3c2412eint[32] = { 641 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 0 }, /* EINT0 */ 642 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 1 }, /* EINT1 */ 643 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 2 }, /* EINT2 */ 644 + { .type = S3C_IRQTYPE_EINT, .parent_irq = 3 }, /* EINT3 */ 689 645 { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ 690 646 { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ 691 647 { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ ··· 777 595 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ 778 596 }; 779 597 780 - static struct s3c_irq_data init_subint[32] = { 598 + static struct s3c_irq_data init_s3c2412subint[32] = { 781 599 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ 782 600 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ 783 601 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ ··· 789 607 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ 790 608 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ 791 609 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ 610 + { .type = S3C_IRQTYPE_NONE, }, 611 + { .type = S3C_IRQTYPE_NONE, }, 612 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* SDI */ 613 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* CF */ 792 614 }; 793 615 794 - void __init s3c24xx_init_irq(void) 616 + void __init s3c2412_init_irq(void) 795 617 { 796 - struct s3c_irq_intc *main_intc; 618 + pr_info("S3C2412: IRQ Support\n"); 797 619 798 620 #ifdef CONFIG_FIQ 799 621 init_FIQ(FIQ_START); 800 622 #endif 801 623 802 - main_intc = s3c24xx_init_intc(NULL, &init_base[0], NULL, 0x4a000000); 803 - if (IS_ERR(main_intc)) { 624 + s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2412base[0], NULL, 625 + 0x4a000000); 626 + if (IS_ERR(s3c_intc[0])) { 804 627 pr_err("irq: could not create main interrupt controller\n"); 805 628 return; 806 629 } 807 630 808 - s3c24xx_init_intc(NULL, &init_subint[0], main_intc, 0x4a000018); 809 - s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); 631 + s3c24xx_init_intc(NULL, &init_s3c2412eint[0], s3c_intc[0], 0x560000a4); 632 + s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2412subint[0], 633 + s3c_intc[0], 0x4a000018); 810 634 } 635 + #endif 811 636 812 637 #ifdef CONFIG_CPU_S3C2416 813 638 static struct s3c_irq_data init_s3c2416base[32] = { ··· 886 697 887 698 static struct s3c_irq_data init_s3c2416_second[32] = { 888 699 { .type = S3C_IRQTYPE_EDGE }, /* 2D */ 889 - { .type = S3C_IRQTYPE_EDGE }, /* IIC1 */ 700 + { .type = S3C_IRQTYPE_NONE }, /* reserved */ 890 701 { .type = S3C_IRQTYPE_NONE }, /* reserved */ 891 702 { .type = S3C_IRQTYPE_NONE }, /* reserved */ 892 703 { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */ 893 - { .type = S3C_IRQTYPE_EDGE }, /* PCM1 */ 704 + { .type = S3C_IRQTYPE_NONE }, /* reserved */ 894 705 { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */ 895 - { .type = S3C_IRQTYPE_EDGE }, /* I2S1 */ 896 706 }; 897 707 898 708 void __init s3c2416_init_irq(void) 899 709 { 900 - struct s3c_irq_intc *main_intc; 901 - 902 710 pr_info("S3C2416: IRQ Support\n"); 903 711 904 712 #ifdef CONFIG_FIQ 905 713 init_FIQ(FIQ_START); 906 714 #endif 907 715 908 - main_intc = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, 0x4a000000); 909 - if (IS_ERR(main_intc)) { 716 + s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, 717 + 0x4a000000); 718 + if (IS_ERR(s3c_intc[0])) { 910 719 pr_err("irq: could not create main interrupt controller\n"); 911 720 return; 912 721 } 913 722 914 - s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); 915 - s3c24xx_init_intc(NULL, &init_s3c2416subint[0], main_intc, 0x4a000018); 723 + s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); 724 + s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2416subint[0], 725 + s3c_intc[0], 0x4a000018); 916 726 917 - s3c24xx_init_intc(NULL, &init_s3c2416_second[0], NULL, 0x4a000040); 727 + s3c_intc[2] = s3c24xx_init_intc(NULL, &init_s3c2416_second[0], 728 + NULL, 0x4a000040); 918 729 } 919 730 731 + #endif 732 + 733 + #ifdef CONFIG_CPU_S3C2440 734 + static struct s3c_irq_data init_s3c2440base[32] = { 735 + { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ 736 + { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ 737 + { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ 738 + { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ 739 + { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ 740 + { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ 741 + { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */ 742 + { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ 743 + { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ 744 + { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */ 745 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ 746 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ 747 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ 748 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ 749 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ 750 + { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ 751 + { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ 752 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ 753 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ 754 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ 755 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ 756 + { .type = S3C_IRQTYPE_EDGE, }, /* SDI */ 757 + { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ 758 + { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ 759 + { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */ 760 + { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ 761 + { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ 762 + { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ 763 + { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ 764 + { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ 765 + { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ 766 + { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ 767 + }; 768 + 769 + static struct s3c_irq_data init_s3c2440subint[32] = { 770 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ 771 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ 772 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ 773 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ 774 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ 775 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ 776 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ 777 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ 778 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ 779 + { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ 780 + { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ 781 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */ 782 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */ 783 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */ 784 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */ 785 + }; 786 + 787 + void __init s3c2440_init_irq(void) 788 + { 789 + pr_info("S3C2440: IRQ Support\n"); 790 + 791 + #ifdef CONFIG_FIQ 792 + init_FIQ(FIQ_START); 793 + #endif 794 + 795 + s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2440base[0], NULL, 796 + 0x4a000000); 797 + if (IS_ERR(s3c_intc[0])) { 798 + pr_err("irq: could not create main interrupt controller\n"); 799 + return; 800 + } 801 + 802 + s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); 803 + s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2440subint[0], 804 + s3c_intc[0], 0x4a000018); 805 + } 806 + #endif 807 + 808 + #ifdef CONFIG_CPU_S3C2442 809 + static struct s3c_irq_data init_s3c2442base[32] = { 810 + { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ 811 + { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ 812 + { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ 813 + { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ 814 + { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ 815 + { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ 816 + { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */ 817 + { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ 818 + { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ 819 + { .type = S3C_IRQTYPE_EDGE, }, /* WDT */ 820 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ 821 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ 822 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ 823 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ 824 + { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ 825 + { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ 826 + { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ 827 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ 828 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ 829 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ 830 + { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ 831 + { .type = S3C_IRQTYPE_EDGE, }, /* SDI */ 832 + { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ 833 + { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ 834 + { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */ 835 + { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ 836 + { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ 837 + { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ 838 + { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ 839 + { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ 840 + { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ 841 + { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ 842 + }; 843 + 844 + static struct s3c_irq_data init_s3c2442subint[32] = { 845 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ 846 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ 847 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ 848 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ 849 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ 850 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ 851 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ 852 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ 853 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ 854 + { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ 855 + { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ 856 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */ 857 + { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */ 858 + }; 859 + 860 + void __init s3c2442_init_irq(void) 861 + { 862 + pr_info("S3C2442: IRQ Support\n"); 863 + 864 + #ifdef CONFIG_FIQ 865 + init_FIQ(FIQ_START); 866 + #endif 867 + 868 + s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2442base[0], NULL, 869 + 0x4a000000); 870 + if (IS_ERR(s3c_intc[0])) { 871 + pr_err("irq: could not create main interrupt controller\n"); 872 + return; 873 + } 874 + 875 + s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); 876 + s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2442subint[0], 877 + s3c_intc[0], 0x4a000018); 878 + } 920 879 #endif 921 880 922 881 #ifdef CONFIG_CPU_S3C2443 ··· 1138 801 1139 802 void __init s3c2443_init_irq(void) 1140 803 { 1141 - struct s3c_irq_intc *main_intc; 1142 - 1143 804 pr_info("S3C2443: IRQ Support\n"); 1144 805 1145 806 #ifdef CONFIG_FIQ 1146 807 init_FIQ(FIQ_START); 1147 808 #endif 1148 809 1149 - main_intc = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, 0x4a000000); 1150 - if (IS_ERR(main_intc)) { 810 + s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, 811 + 0x4a000000); 812 + if (IS_ERR(s3c_intc[0])) { 1151 813 pr_err("irq: could not create main interrupt controller\n"); 1152 814 return; 1153 815 } 1154 816 1155 - s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); 1156 - s3c24xx_init_intc(NULL, &init_s3c2443subint[0], main_intc, 0x4a000018); 817 + s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); 818 + s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2443subint[0], 819 + s3c_intc[0], 0x4a000018); 1157 820 } 821 + #endif 822 + 823 + #ifdef CONFIG_OF 824 + static int s3c24xx_irq_map_of(struct irq_domain *h, unsigned int virq, 825 + irq_hw_number_t hw) 826 + { 827 + unsigned int ctrl_num = hw / 32; 828 + unsigned int intc_hw = hw % 32; 829 + struct s3c_irq_intc *intc = s3c_intc[ctrl_num]; 830 + struct s3c_irq_intc *parent_intc = intc->parent; 831 + struct s3c_irq_data *irq_data = &intc->irqs[intc_hw]; 832 + 833 + /* attach controller pointer to irq_data */ 834 + irq_data->intc = intc; 835 + irq_data->offset = intc_hw; 836 + 837 + if (!parent_intc) 838 + irq_set_chip_and_handler(virq, &s3c_irq_chip, handle_edge_irq); 839 + else 840 + irq_set_chip_and_handler(virq, &s3c_irq_level_chip, 841 + handle_edge_irq); 842 + 843 + irq_set_chip_data(virq, irq_data); 844 + 845 + set_irq_flags(virq, IRQF_VALID); 846 + 847 + return 0; 848 + } 849 + 850 + /* Translate our of irq notation 851 + * format: <ctrl_num ctrl_irq parent_irq type> 852 + */ 853 + static int s3c24xx_irq_xlate_of(struct irq_domain *d, struct device_node *n, 854 + const u32 *intspec, unsigned int intsize, 855 + irq_hw_number_t *out_hwirq, unsigned int *out_type) 856 + { 857 + struct s3c_irq_intc *intc; 858 + struct s3c_irq_intc *parent_intc; 859 + struct s3c_irq_data *irq_data; 860 + struct s3c_irq_data *parent_irq_data; 861 + int irqno; 862 + 863 + if (WARN_ON(intsize < 4)) 864 + return -EINVAL; 865 + 866 + if (intspec[0] > 2 || !s3c_intc[intspec[0]]) { 867 + pr_err("controller number %d invalid\n", intspec[0]); 868 + return -EINVAL; 869 + } 870 + intc = s3c_intc[intspec[0]]; 871 + 872 + *out_hwirq = intspec[0] * 32 + intspec[2]; 873 + *out_type = intspec[3] & IRQ_TYPE_SENSE_MASK; 874 + 875 + parent_intc = intc->parent; 876 + if (parent_intc) { 877 + irq_data = &intc->irqs[intspec[2]]; 878 + irq_data->parent_irq = intspec[1]; 879 + parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; 880 + parent_irq_data->sub_intc = intc; 881 + parent_irq_data->sub_bits |= (1UL << intspec[2]); 882 + 883 + /* parent_intc is always s3c_intc[0], so no offset */ 884 + irqno = irq_create_mapping(parent_intc->domain, intspec[1]); 885 + if (irqno < 0) { 886 + pr_err("irq: could not map parent interrupt\n"); 887 + return irqno; 888 + } 889 + 890 + irq_set_chained_handler(irqno, s3c_irq_demux); 891 + } 892 + 893 + return 0; 894 + } 895 + 896 + static struct irq_domain_ops s3c24xx_irq_ops_of = { 897 + .map = s3c24xx_irq_map_of, 898 + .xlate = s3c24xx_irq_xlate_of, 899 + }; 900 + 901 + struct s3c24xx_irq_of_ctrl { 902 + char *name; 903 + unsigned long offset; 904 + struct s3c_irq_intc **handle; 905 + struct s3c_irq_intc **parent; 906 + struct irq_domain_ops *ops; 907 + }; 908 + 909 + static int __init s3c_init_intc_of(struct device_node *np, 910 + struct device_node *interrupt_parent, 911 + struct s3c24xx_irq_of_ctrl *s3c_ctrl, int num_ctrl) 912 + { 913 + struct s3c_irq_intc *intc; 914 + struct s3c24xx_irq_of_ctrl *ctrl; 915 + struct irq_domain *domain; 916 + void __iomem *reg_base; 917 + int i; 918 + 919 + reg_base = of_iomap(np, 0); 920 + if (!reg_base) { 921 + pr_err("irq-s3c24xx: could not map irq registers\n"); 922 + return -EINVAL; 923 + } 924 + 925 + domain = irq_domain_add_linear(np, num_ctrl * 32, 926 + &s3c24xx_irq_ops_of, NULL); 927 + if (!domain) { 928 + pr_err("irq: could not create irq-domain\n"); 929 + return -EINVAL; 930 + } 931 + 932 + for (i = 0; i < num_ctrl; i++) { 933 + ctrl = &s3c_ctrl[i]; 934 + 935 + pr_debug("irq: found controller %s\n", ctrl->name); 936 + 937 + intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL); 938 + if (!intc) 939 + return -ENOMEM; 940 + 941 + intc->domain = domain; 942 + intc->irqs = kzalloc(sizeof(struct s3c_irq_data) * 32, 943 + GFP_KERNEL); 944 + if (!intc->irqs) { 945 + kfree(intc); 946 + return -ENOMEM; 947 + } 948 + 949 + if (ctrl->parent) { 950 + intc->reg_pending = reg_base + ctrl->offset; 951 + intc->reg_mask = reg_base + ctrl->offset + 0x4; 952 + 953 + if (*(ctrl->parent)) { 954 + intc->parent = *(ctrl->parent); 955 + } else { 956 + pr_warn("irq: parent of %s missing\n", 957 + ctrl->name); 958 + kfree(intc->irqs); 959 + kfree(intc); 960 + continue; 961 + } 962 + } else { 963 + intc->reg_pending = reg_base + ctrl->offset; 964 + intc->reg_mask = reg_base + ctrl->offset + 0x08; 965 + intc->reg_intpnd = reg_base + ctrl->offset + 0x10; 966 + } 967 + 968 + s3c24xx_clear_intc(intc); 969 + s3c_intc[i] = intc; 970 + } 971 + 972 + set_handle_irq(s3c24xx_handle_irq); 973 + 974 + return 0; 975 + } 976 + 977 + static struct s3c24xx_irq_of_ctrl s3c2410_ctrl[] = { 978 + { 979 + .name = "intc", 980 + .offset = 0, 981 + }, { 982 + .name = "subintc", 983 + .offset = 0x18, 984 + .parent = &s3c_intc[0], 985 + } 986 + }; 987 + 988 + int __init s3c2410_init_intc_of(struct device_node *np, 989 + struct device_node *interrupt_parent, 990 + struct s3c24xx_irq_of_ctrl *ctrl, int num_ctrl) 991 + { 992 + return s3c_init_intc_of(np, interrupt_parent, 993 + s3c2410_ctrl, ARRAY_SIZE(s3c2410_ctrl)); 994 + } 995 + IRQCHIP_DECLARE(s3c2410_irq, "samsung,s3c2410-irq", s3c2410_init_intc_of); 996 + 997 + static struct s3c24xx_irq_of_ctrl s3c2416_ctrl[] = { 998 + { 999 + .name = "intc", 1000 + .offset = 0, 1001 + }, { 1002 + .name = "subintc", 1003 + .offset = 0x18, 1004 + .parent = &s3c_intc[0], 1005 + }, { 1006 + .name = "intc2", 1007 + .offset = 0x40, 1008 + } 1009 + }; 1010 + 1011 + int __init s3c2416_init_intc_of(struct device_node *np, 1012 + struct device_node *interrupt_parent, 1013 + struct s3c24xx_irq_of_ctrl *ctrl, int num_ctrl) 1014 + { 1015 + return s3c_init_intc_of(np, interrupt_parent, 1016 + s3c2416_ctrl, ARRAY_SIZE(s3c2416_ctrl)); 1017 + } 1018 + IRQCHIP_DECLARE(s3c2416_irq, "samsung,s3c2416-irq", s3c2416_init_intc_of); 1158 1019 #endif
+5 -2
arch/arm/mach-s3c24xx/mach-amlm5900.c
··· 63 63 #include <linux/mtd/map.h> 64 64 #include <linux/mtd/physmap.h> 65 65 66 + #include <plat/samsung-time.h> 67 + 66 68 #include "common.h" 67 69 68 70 static struct resource amlm5900_nor_resource = ··· 162 160 s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc)); 163 161 s3c24xx_init_clocks(0); 164 162 s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs)); 163 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 165 164 } 166 165 167 166 #ifdef CONFIG_FB_S3C2410 ··· 238 235 MACHINE_START(AML_M5900, "AML_M5900") 239 236 .atag_offset = 0x100, 240 237 .map_io = amlm5900_map_io, 241 - .init_irq = s3c24xx_init_irq, 238 + .init_irq = s3c2410_init_irq, 242 239 .init_machine = amlm5900_init, 243 - .init_time = s3c24xx_timer_init, 240 + .init_time = samsung_timer_init, 244 241 .restart = s3c2410_restart, 245 242 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-anubis.c
··· 49 49 #include <plat/devs.h> 50 50 #include <plat/cpu.h> 51 51 #include <linux/platform_data/asoc-s3c24xx_simtec.h> 52 + #include <plat/samsung-time.h> 52 53 53 54 #include "anubis.h" 54 55 #include "common.h" ··· 411 410 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); 412 411 s3c24xx_init_clocks(0); 413 412 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); 413 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 414 414 415 415 /* check for the newer revision boards with large page nand */ 416 416 ··· 445 443 .atag_offset = 0x100, 446 444 .map_io = anubis_map_io, 447 445 .init_machine = anubis_init, 448 - .init_irq = s3c24xx_init_irq, 449 - .init_time = s3c24xx_timer_init, 446 + .init_irq = s3c2440_init_irq, 447 + .init_time = samsung_timer_init, 450 448 .restart = s3c244x_restart, 451 449 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-at2440evb.c
··· 48 48 #include <plat/devs.h> 49 49 #include <plat/cpu.h> 50 50 #include <linux/platform_data/mmc-s3cmci.h> 51 + #include <plat/samsung-time.h> 51 52 52 53 #include "common.h" 53 54 ··· 193 192 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc)); 194 193 s3c24xx_init_clocks(16934400); 195 194 s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs)); 195 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 196 196 } 197 197 198 198 static void __init at2440evb_init(void) ··· 211 209 .atag_offset = 0x100, 212 210 .map_io = at2440evb_map_io, 213 211 .init_machine = at2440evb_init, 214 - .init_irq = s3c24xx_init_irq, 215 - .init_time = s3c24xx_timer_init, 212 + .init_irq = s3c2440_init_irq, 213 + .init_time = samsung_timer_init, 216 214 .restart = s3c244x_restart, 217 215 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-bast.c
··· 55 55 #include <plat/devs.h> 56 56 #include <plat/gpio-cfg.h> 57 57 #include <plat/regs-serial.h> 58 + #include <plat/samsung-time.h> 58 59 59 60 #include "bast.h" 60 61 #include "common.h" ··· 577 576 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); 578 577 s3c24xx_init_clocks(0); 579 578 s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); 579 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 580 580 } 581 581 582 582 static void __init bast_init(void) ··· 605 603 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ 606 604 .atag_offset = 0x100, 607 605 .map_io = bast_map_io, 608 - .init_irq = s3c24xx_init_irq, 606 + .init_irq = s3c2410_init_irq, 609 607 .init_machine = bast_init, 610 - .init_time = s3c24xx_timer_init, 608 + .init_time = samsung_timer_init, 611 609 .restart = s3c2410_restart, 612 610 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-gta02.c
··· 81 81 #include <plat/gpio-cfg.h> 82 82 #include <plat/pm.h> 83 83 #include <plat/regs-serial.h> 84 + #include <plat/samsung-time.h> 84 85 85 86 #include "common.h" 86 87 #include "gta02.h" ··· 502 501 s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc)); 503 502 s3c24xx_init_clocks(12000000); 504 503 s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs)); 504 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 505 505 } 506 506 507 507 ··· 589 587 /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */ 590 588 .atag_offset = 0x100, 591 589 .map_io = gta02_map_io, 592 - .init_irq = s3c24xx_init_irq, 590 + .init_irq = s3c2442_init_irq, 593 591 .init_machine = gta02_machine_init, 594 - .init_time = s3c24xx_timer_init, 592 + .init_time = samsung_timer_init, 595 593 .restart = s3c244x_restart, 596 594 MACHINE_END
+4 -8
arch/arm/mach-s3c24xx/mach-h1940.c
··· 62 62 #include <plat/pll.h> 63 63 #include <plat/pm.h> 64 64 #include <plat/regs-serial.h> 65 - 65 + #include <plat/samsung-time.h> 66 66 67 67 #include "common.h" 68 68 #include "h1940.h" ··· 646 646 s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc)); 647 647 s3c24xx_init_clocks(0); 648 648 s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs)); 649 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 649 650 650 651 /* setup PM */ 651 652 ··· 665 664 { 666 665 memblock_reserve(0x30003000, 0x1000); 667 666 memblock_reserve(0x30081000, 0x1000); 668 - } 669 - 670 - static void __init h1940_init_irq(void) 671 - { 672 - s3c24xx_init_irq(); 673 667 } 674 668 675 669 static void __init h1940_init(void) ··· 735 739 .atag_offset = 0x100, 736 740 .map_io = h1940_map_io, 737 741 .reserve = h1940_reserve, 738 - .init_irq = h1940_init_irq, 742 + .init_irq = s3c2410_init_irq, 739 743 .init_machine = h1940_init, 740 - .init_time = s3c24xx_timer_init, 744 + .init_time = samsung_timer_init, 741 745 .restart = s3c2410_restart, 742 746 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-jive.c
··· 52 52 #include <plat/cpu.h> 53 53 #include <plat/pm.h> 54 54 #include <linux/platform_data/usb-s3c2410_udc.h> 55 + #include <plat/samsung-time.h> 55 56 56 57 #include "common.h" 57 58 #include "s3c2412-power.h" ··· 507 506 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc)); 508 507 s3c24xx_init_clocks(12000000); 509 508 s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs)); 509 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 510 510 } 511 511 512 512 static void jive_power_off(void) ··· 660 658 /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ 661 659 .atag_offset = 0x100, 662 660 663 - .init_irq = s3c24xx_init_irq, 661 + .init_irq = s3c2412_init_irq, 664 662 .map_io = jive_map_io, 665 663 .init_machine = jive_machine_init, 666 - .init_time = s3c24xx_timer_init, 664 + .init_time = samsung_timer_init, 667 665 .restart = s3c2412_restart, 668 666 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-mini2440.c
··· 56 56 #include <plat/clock.h> 57 57 #include <plat/devs.h> 58 58 #include <plat/cpu.h> 59 + #include <plat/samsung-time.h> 59 60 60 61 #include <sound/s3c24xx_uda134x.h> 61 62 ··· 526 525 s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc)); 527 526 s3c24xx_init_clocks(12000000); 528 527 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs)); 528 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 529 529 } 530 530 531 531 /* ··· 688 686 .atag_offset = 0x100, 689 687 .map_io = mini2440_map_io, 690 688 .init_machine = mini2440_init, 691 - .init_irq = s3c24xx_init_irq, 692 - .init_time = s3c24xx_timer_init, 689 + .init_irq = s3c2440_init_irq, 690 + .init_time = samsung_timer_init, 693 691 .restart = s3c244x_restart, 694 692 MACHINE_END
+6 -4
arch/arm/mach-s3c24xx/mach-n30.c
··· 49 49 #include <plat/devs.h> 50 50 #include <linux/platform_data/mmc-s3cmci.h> 51 51 #include <linux/platform_data/usb-s3c2410_udc.h> 52 + #include <plat/samsung-time.h> 52 53 53 54 #include "common.h" 54 55 ··· 536 535 n30_hwinit(); 537 536 s3c24xx_init_clocks(0); 538 537 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); 538 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 539 539 } 540 540 541 541 /* GPB3 is the line that controls the pull-up for the USB D+ line */ ··· 590 588 Ben Dooks <ben-linux@fluff.org> 591 589 */ 592 590 .atag_offset = 0x100, 593 - .init_time = s3c24xx_timer_init, 591 + .init_time = samsung_timer_init, 594 592 .init_machine = n30_init, 595 - .init_irq = s3c24xx_init_irq, 593 + .init_irq = s3c2410_init_irq, 596 594 .map_io = n30_map_io, 597 595 .restart = s3c2410_restart, 598 596 MACHINE_END ··· 601 599 /* Maintainer: Christer Weinigel <christer@weinigel.se> 602 600 */ 603 601 .atag_offset = 0x100, 604 - .init_time = s3c24xx_timer_init, 602 + .init_time = samsung_timer_init, 605 603 .init_machine = n30_init, 606 - .init_irq = s3c24xx_init_irq, 604 + .init_irq = s3c2410_init_irq, 607 605 .map_io = n30_map_io, 608 606 .restart = s3c2410_restart, 609 607 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-nexcoder.c
··· 44 44 #include <plat/clock.h> 45 45 #include <plat/devs.h> 46 46 #include <plat/cpu.h> 47 + #include <plat/samsung-time.h> 47 48 48 49 #include "common.h" 49 50 ··· 136 135 s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc)); 137 136 s3c24xx_init_clocks(0); 138 137 s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs)); 138 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 139 139 140 140 nexcoder_sensorboard_init(); 141 141 } ··· 152 150 .atag_offset = 0x100, 153 151 .map_io = nexcoder_map_io, 154 152 .init_machine = nexcoder_init, 155 - .init_irq = s3c24xx_init_irq, 156 - .init_time = s3c24xx_timer_init, 153 + .init_irq = s3c2440_init_irq, 154 + .init_time = samsung_timer_init, 157 155 .restart = s3c244x_restart, 158 156 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-osiris.c
··· 45 45 #include <plat/devs.h> 46 46 #include <plat/gpio-cfg.h> 47 47 #include <plat/regs-serial.h> 48 + #include <plat/samsung-time.h> 48 49 49 50 #include <mach/hardware.h> 50 51 #include <mach/regs-gpio.h> ··· 385 384 s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); 386 385 s3c24xx_init_clocks(0); 387 386 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); 387 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 388 388 389 389 /* check for the newer revision boards with large page nand */ 390 390 ··· 426 424 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ 427 425 .atag_offset = 0x100, 428 426 .map_io = osiris_map_io, 429 - .init_irq = s3c24xx_init_irq, 427 + .init_irq = s3c2440_init_irq, 430 428 .init_machine = osiris_init, 431 - .init_time = s3c24xx_timer_init, 429 + .init_time = samsung_timer_init, 432 430 .restart = s3c244x_restart, 433 431 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-otom.c
··· 33 33 #include <plat/cpu.h> 34 34 #include <plat/devs.h> 35 35 #include <plat/regs-serial.h> 36 + #include <plat/samsung-time.h> 36 37 37 38 #include "common.h" 38 39 #include "otom.h" ··· 102 101 s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc)); 103 102 s3c24xx_init_clocks(0); 104 103 s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs)); 104 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 105 105 } 106 106 107 107 static void __init otom11_init(void) ··· 116 114 .atag_offset = 0x100, 117 115 .map_io = otom11_map_io, 118 116 .init_machine = otom11_init, 119 - .init_irq = s3c24xx_init_irq, 120 - .init_time = s3c24xx_timer_init, 117 + .init_irq = s3c2410_init_irq, 118 + .init_time = samsung_timer_init, 121 119 .restart = s3c2410_restart, 122 120 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-qt2410.c
··· 59 59 #include <plat/devs.h> 60 60 #include <plat/cpu.h> 61 61 #include <plat/pm.h> 62 + #include <plat/samsung-time.h> 62 63 63 64 #include "common.h" 64 65 #include "common-smdk.h" ··· 305 304 s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc)); 306 305 s3c24xx_init_clocks(12*1000*1000); 307 306 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); 307 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 308 308 } 309 309 310 310 static void __init qt2410_machine_init(void) ··· 343 341 MACHINE_START(QT2410, "QT2410") 344 342 .atag_offset = 0x100, 345 343 .map_io = qt2410_map_io, 346 - .init_irq = s3c24xx_init_irq, 344 + .init_irq = s3c2410_init_irq, 347 345 .init_machine = qt2410_machine_init, 348 - .init_time = s3c24xx_timer_init, 346 + .init_time = samsung_timer_init, 349 347 .restart = s3c2410_restart, 350 348 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-rx1950.c
··· 57 57 #include <plat/devs.h> 58 58 #include <plat/pm.h> 59 59 #include <plat/regs-serial.h> 60 + #include <plat/samsung-time.h> 60 61 61 62 #include "common.h" 62 63 #include "h1940.h" ··· 741 740 s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc)); 742 741 s3c24xx_init_clocks(16934000); 743 742 s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs)); 743 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 744 744 745 745 /* setup PM */ 746 746 ··· 812 810 .atag_offset = 0x100, 813 811 .map_io = rx1950_map_io, 814 812 .reserve = rx1950_reserve, 815 - .init_irq = s3c24xx_init_irq, 813 + .init_irq = s3c2442_init_irq, 816 814 .init_machine = rx1950_init_machine, 817 - .init_time = s3c24xx_timer_init, 815 + .init_time = samsung_timer_init, 818 816 .restart = s3c244x_restart, 819 817 MACHINE_END
+4 -7
arch/arm/mach-s3c24xx/mach-rx3715.c
··· 49 49 #include <plat/devs.h> 50 50 #include <plat/pm.h> 51 51 #include <plat/regs-serial.h> 52 + #include <plat/samsung-time.h> 52 53 53 54 #include "common.h" 54 55 #include "h1940.h" ··· 180 179 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc)); 181 180 s3c24xx_init_clocks(16934000); 182 181 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); 182 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 183 183 } 184 184 185 185 /* H1940 and RX3715 need to reserve this for suspend */ ··· 188 186 { 189 187 memblock_reserve(0x30003000, 0x1000); 190 188 memblock_reserve(0x30081000, 0x1000); 191 - } 192 - 193 - static void __init rx3715_init_irq(void) 194 - { 195 - s3c24xx_init_irq(); 196 189 } 197 190 198 191 static void __init rx3715_init_machine(void) ··· 207 210 .atag_offset = 0x100, 208 211 .map_io = rx3715_map_io, 209 212 .reserve = rx3715_reserve, 210 - .init_irq = rx3715_init_irq, 213 + .init_irq = s3c2440_init_irq, 211 214 .init_machine = rx3715_init_machine, 212 - .init_time = s3c24xx_timer_init, 215 + .init_time = samsung_timer_init, 213 216 .restart = s3c244x_restart, 214 217 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-smdk2410.c
··· 51 51 52 52 #include <plat/devs.h> 53 53 #include <plat/cpu.h> 54 + #include <plat/samsung-time.h> 54 55 55 56 #include "common.h" 56 57 #include "common-smdk.h" ··· 101 100 s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc)); 102 101 s3c24xx_init_clocks(0); 103 102 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); 103 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 104 104 } 105 105 106 106 static void __init smdk2410_init(void) ··· 116 114 /* Maintainer: Jonas Dietsche */ 117 115 .atag_offset = 0x100, 118 116 .map_io = smdk2410_map_io, 119 - .init_irq = s3c24xx_init_irq, 117 + .init_irq = s3c2410_init_irq, 120 118 .init_machine = smdk2410_init, 121 - .init_time = s3c24xx_timer_init, 119 + .init_time = samsung_timer_init, 122 120 .restart = s3c2410_restart, 123 121 MACHINE_END
+8 -6
arch/arm/mach-s3c24xx/mach-smdk2413.c
··· 44 44 #include <plat/clock.h> 45 45 #include <plat/devs.h> 46 46 #include <plat/cpu.h> 47 + #include <plat/samsung-time.h> 47 48 48 49 #include "common.h" 49 50 #include "common-smdk.h" ··· 106 105 s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc)); 107 106 s3c24xx_init_clocks(12000000); 108 107 s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs)); 108 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 109 109 } 110 110 111 111 static void __init smdk2413_machine_init(void) ··· 130 128 .atag_offset = 0x100, 131 129 132 130 .fixup = smdk2413_fixup, 133 - .init_irq = s3c24xx_init_irq, 131 + .init_irq = s3c2412_init_irq, 134 132 .map_io = smdk2413_map_io, 135 133 .init_machine = smdk2413_machine_init, 136 - .init_time = s3c24xx_timer_init, 134 + .init_time = samsung_timer_init, 137 135 .restart = s3c2412_restart, 138 136 MACHINE_END 139 137 ··· 142 140 .atag_offset = 0x100, 143 141 144 142 .fixup = smdk2413_fixup, 145 - .init_irq = s3c24xx_init_irq, 143 + .init_irq = s3c2412_init_irq, 146 144 .map_io = smdk2413_map_io, 147 145 .init_machine = smdk2413_machine_init, 148 - .init_time = s3c24xx_timer_init, 146 + .init_time = samsung_timer_init, 149 147 .restart = s3c2412_restart, 150 148 MACHINE_END 151 149 ··· 154 152 .atag_offset = 0x100, 155 153 156 154 .fixup = smdk2413_fixup, 157 - .init_irq = s3c24xx_init_irq, 155 + .init_irq = s3c2412_init_irq, 158 156 .map_io = smdk2413_map_io, 159 157 .init_machine = smdk2413_machine_init, 160 - .init_time = s3c24xx_timer_init, 158 + .init_time = samsung_timer_init, 161 159 .restart = s3c2412_restart, 162 160 MACHINE_END
+3 -1
arch/arm/mach-s3c24xx/mach-smdk2416.c
··· 50 50 #include <plat/sdhci.h> 51 51 #include <linux/platform_data/usb-s3c2410_udc.h> 52 52 #include <linux/platform_data/s3c-hsudc.h> 53 + #include <plat/samsung-time.h> 53 54 54 55 #include <plat/fb.h> 55 56 ··· 222 221 s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc)); 223 222 s3c24xx_init_clocks(12000000); 224 223 s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs)); 224 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 225 225 } 226 226 227 227 static void __init smdk2416_machine_init(void) ··· 255 253 .init_irq = s3c2416_init_irq, 256 254 .map_io = smdk2416_map_io, 257 255 .init_machine = smdk2416_machine_init, 258 - .init_time = s3c24xx_timer_init, 256 + .init_time = samsung_timer_init, 259 257 .restart = s3c2416_restart, 260 258 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-smdk2440.c
··· 41 41 #include <plat/clock.h> 42 42 #include <plat/devs.h> 43 43 #include <plat/cpu.h> 44 + #include <plat/samsung-time.h> 44 45 45 46 #include "common.h" 46 47 #include "common-smdk.h" ··· 161 160 s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc)); 162 161 s3c24xx_init_clocks(16934400); 163 162 s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs)); 163 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 164 164 } 165 165 166 166 static void __init smdk2440_machine_init(void) ··· 177 175 /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ 178 176 .atag_offset = 0x100, 179 177 180 - .init_irq = s3c24xx_init_irq, 178 + .init_irq = s3c2440_init_irq, 181 179 .map_io = smdk2440_map_io, 182 180 .init_machine = smdk2440_machine_init, 183 - .init_time = s3c24xx_timer_init, 181 + .init_time = samsung_timer_init, 184 182 .restart = s3c244x_restart, 185 183 MACHINE_END
+3 -1
arch/arm/mach-s3c24xx/mach-smdk2443.c
··· 41 41 #include <plat/clock.h> 42 42 #include <plat/devs.h> 43 43 #include <plat/cpu.h> 44 + #include <plat/samsung-time.h> 44 45 45 46 #include "common.h" 46 47 #include "common-smdk.h" ··· 122 121 s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc)); 123 122 s3c24xx_init_clocks(12000000); 124 123 s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs)); 124 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 125 125 } 126 126 127 127 static void __init smdk2443_machine_init(void) ··· 144 142 .init_irq = s3c2443_init_irq, 145 143 .map_io = smdk2443_map_io, 146 144 .init_machine = smdk2443_machine_init, 147 - .init_time = s3c24xx_timer_init, 145 + .init_time = samsung_timer_init, 148 146 .restart = s3c2443_restart, 149 147 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-tct_hammer.c
··· 53 53 #include <linux/mtd/partitions.h> 54 54 #include <linux/mtd/map.h> 55 55 #include <linux/mtd/physmap.h> 56 + #include <plat/samsung-time.h> 56 57 57 58 #include "common.h" 58 59 ··· 137 136 s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc)); 138 137 s3c24xx_init_clocks(0); 139 138 s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs)); 139 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 140 140 } 141 141 142 142 static void __init tct_hammer_init(void) ··· 149 147 MACHINE_START(TCT_HAMMER, "TCT_HAMMER") 150 148 .atag_offset = 0x100, 151 149 .map_io = tct_hammer_map_io, 152 - .init_irq = s3c24xx_init_irq, 150 + .init_irq = s3c2410_init_irq, 153 151 .init_machine = tct_hammer_init, 154 - .init_time = s3c24xx_timer_init, 152 + .init_time = samsung_timer_init, 155 153 .restart = s3c2410_restart, 156 154 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-vr1000.c
··· 45 45 #include <plat/cpu.h> 46 46 #include <plat/devs.h> 47 47 #include <plat/regs-serial.h> 48 + #include <plat/samsung-time.h> 48 49 49 50 #include "bast.h" 50 51 #include "common.h" ··· 333 332 s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc)); 334 333 s3c24xx_init_clocks(0); 335 334 s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs)); 335 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 336 336 } 337 337 338 338 static void __init vr1000_init(void) ··· 355 353 .atag_offset = 0x100, 356 354 .map_io = vr1000_map_io, 357 355 .init_machine = vr1000_init, 358 - .init_irq = s3c24xx_init_irq, 359 - .init_time = s3c24xx_timer_init, 356 + .init_irq = s3c2410_init_irq, 357 + .init_time = samsung_timer_init, 360 358 .restart = s3c2410_restart, 361 359 MACHINE_END
+4 -2
arch/arm/mach-s3c24xx/mach-vstms.c
··· 44 44 #include <plat/clock.h> 45 45 #include <plat/devs.h> 46 46 #include <plat/cpu.h> 47 + #include <plat/samsung-time.h> 47 48 48 49 #include "common.h" 49 50 ··· 143 142 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); 144 143 s3c24xx_init_clocks(12000000); 145 144 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); 145 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 146 146 } 147 147 148 148 static void __init vstms_init(void) ··· 158 156 .atag_offset = 0x100, 159 157 160 158 .fixup = vstms_fixup, 161 - .init_irq = s3c24xx_init_irq, 159 + .init_irq = s3c2412_init_irq, 162 160 .init_machine = vstms_init, 163 161 .map_io = vstms_map_io, 164 - .init_time = s3c24xx_timer_init, 162 + .init_time = samsung_timer_init, 165 163 .restart = s3c2412_restart, 166 164 MACHINE_END
+8
arch/arm/mach-s3c24xx/pm-s3c2412.c
··· 29 29 30 30 #include <plat/cpu.h> 31 31 #include <plat/pm.h> 32 + #include <plat/wakeup-mask.h> 32 33 33 34 #include "regs-dsc.h" 34 35 #include "s3c2412-power.h" ··· 52 51 return 1; /* Aborting suspend */ 53 52 } 54 53 54 + /* mapping of interrupts to parts of the wakeup mask */ 55 + static struct samsung_wakeup_mask wake_irqs[] = { 56 + { .irq = IRQ_RTC, .bit = S3C2412_PWRCFG_RTC_MASKIRQ, }, 57 + }; 58 + 55 59 static void s3c2412_pm_prepare(void) 56 60 { 61 + samsung_sync_wakemask(S3C2412_PWRCFG, 62 + wake_irqs, ARRAY_SIZE(wake_irqs)); 57 63 } 58 64 59 65 static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif)
+2
arch/arm/mach-s3c64xx/Kconfig
··· 17 17 # Configuration options for the S3C6410 CPU 18 18 19 19 config CPU_S3C6400 20 + select SAMSUNG_HRT 20 21 bool 21 22 help 22 23 Enable S3C6400 CPU support 23 24 24 25 config CPU_S3C6410 26 + select SAMSUNG_HRT 25 27 bool 26 28 help 27 29 Enable S3C6410 CPU support
+3 -1
arch/arm/mach-s3c64xx/mach-anw6410.c
··· 49 49 #include <plat/devs.h> 50 50 #include <plat/cpu.h> 51 51 #include <mach/regs-gpio.h> 52 + #include <plat/samsung-time.h> 52 53 53 54 #include "common.h" 54 55 #include "regs-modem.h" ··· 209 208 s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc)); 210 209 s3c24xx_init_clocks(12000000); 211 210 s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs)); 211 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 212 212 213 213 anw6410_lcd_mode_set(); 214 214 } ··· 234 232 .map_io = anw6410_map_io, 235 233 .init_machine = anw6410_machine_init, 236 234 .init_late = s3c64xx_init_late, 237 - .init_time = s3c24xx_timer_init, 235 + .init_time = samsung_timer_init, 238 236 .restart = s3c64xx_restart, 239 237 MACHINE_END
+3 -1
arch/arm/mach-s3c64xx/mach-crag6410.c
··· 64 64 #include <plat/adc.h> 65 65 #include <linux/platform_data/i2c-s3c2410.h> 66 66 #include <plat/pm.h> 67 + #include <plat/samsung-time.h> 67 68 68 69 #include "common.h" 69 70 #include "crag6410.h" ··· 745 744 s3c64xx_init_io(NULL, 0); 746 745 s3c24xx_init_clocks(12000000); 747 746 s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs)); 747 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 748 748 749 749 /* LCD type and Bypass set by bootloader */ 750 750 } ··· 870 868 .map_io = crag6410_map_io, 871 869 .init_machine = crag6410_machine_init, 872 870 .init_late = s3c64xx_init_late, 873 - .init_time = s3c24xx_timer_init, 871 + .init_time = samsung_timer_init, 874 872 .restart = s3c64xx_restart, 875 873 MACHINE_END
+3 -1
arch/arm/mach-s3c64xx/mach-hmt.c
··· 41 41 #include <plat/clock.h> 42 42 #include <plat/devs.h> 43 43 #include <plat/cpu.h> 44 + #include <plat/samsung-time.h> 44 45 45 46 #include "common.h" 46 47 ··· 249 248 s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc)); 250 249 s3c24xx_init_clocks(12000000); 251 250 s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs)); 251 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 252 252 } 253 253 254 254 static void __init hmt_machine_init(void) ··· 277 275 .map_io = hmt_map_io, 278 276 .init_machine = hmt_machine_init, 279 277 .init_late = s3c64xx_init_late, 280 - .init_time = s3c24xx_timer_init, 278 + .init_time = samsung_timer_init, 281 279 .restart = s3c64xx_restart, 282 280 MACHINE_END
+3 -1
arch/arm/mach-s3c64xx/mach-mini6410.c
··· 41 41 42 42 #include <video/platform_lcd.h> 43 43 #include <video/samsung_fimd.h> 44 + #include <plat/samsung-time.h> 44 45 45 46 #include "common.h" 46 47 #include "regs-modem.h" ··· 233 232 s3c64xx_init_io(NULL, 0); 234 233 s3c24xx_init_clocks(12000000); 235 234 s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); 235 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 236 236 237 237 /* set the LCD type */ 238 238 tmp = __raw_readl(S3C64XX_SPCON); ··· 356 354 .map_io = mini6410_map_io, 357 355 .init_machine = mini6410_machine_init, 358 356 .init_late = s3c64xx_init_late, 359 - .init_time = s3c24xx_timer_init, 357 + .init_time = samsung_timer_init, 360 358 .restart = s3c64xx_restart, 361 359 MACHINE_END
+3 -1
arch/arm/mach-s3c64xx/mach-ncp.c
··· 43 43 #include <plat/clock.h> 44 44 #include <plat/devs.h> 45 45 #include <plat/cpu.h> 46 + #include <plat/samsung-time.h> 46 47 47 48 #include "common.h" 48 49 ··· 88 87 s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc)); 89 88 s3c24xx_init_clocks(12000000); 90 89 s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs)); 90 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 91 91 } 92 92 93 93 static void __init ncp_machine_init(void) ··· 105 103 .map_io = ncp_map_io, 106 104 .init_machine = ncp_machine_init, 107 105 .init_late = s3c64xx_init_late, 108 - .init_time = s3c24xx_timer_init, 106 + .init_time = samsung_timer_init, 109 107 .restart = s3c64xx_restart, 110 108 MACHINE_END
+3 -1
arch/arm/mach-s3c64xx/mach-real6410.c
··· 42 42 43 43 #include <video/platform_lcd.h> 44 44 #include <video/samsung_fimd.h> 45 + #include <plat/samsung-time.h> 45 46 46 47 #include "common.h" 47 48 #include "regs-modem.h" ··· 212 211 s3c64xx_init_io(NULL, 0); 213 212 s3c24xx_init_clocks(12000000); 214 213 s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs)); 214 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 215 215 216 216 /* set the LCD type */ 217 217 tmp = __raw_readl(S3C64XX_SPCON); ··· 335 333 .map_io = real6410_map_io, 336 334 .init_machine = real6410_machine_init, 337 335 .init_late = s3c64xx_init_late, 338 - .init_time = s3c24xx_timer_init, 336 + .init_time = samsung_timer_init, 339 337 .restart = s3c64xx_restart, 340 338 MACHINE_END
+2
arch/arm/mach-s3c64xx/mach-smartq.c
··· 38 38 #include <linux/platform_data/touchscreen-s3c2410.h> 39 39 40 40 #include <video/platform_lcd.h> 41 + #include <plat/samsung-time.h> 41 42 42 43 #include "common.h" 43 44 #include "regs-modem.h" ··· 379 378 s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc)); 380 379 s3c24xx_init_clocks(12000000); 381 380 s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs)); 381 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 382 382 383 383 smartq_lcd_mode_set(); 384 384 }
+2 -1
arch/arm/mach-s3c64xx/mach-smartq5.c
··· 28 28 #include <plat/devs.h> 29 29 #include <plat/fb.h> 30 30 #include <plat/gpio-cfg.h> 31 + #include <plat/samsung-time.h> 31 32 32 33 #include "common.h" 33 34 #include "mach-smartq.h" ··· 156 155 .map_io = smartq_map_io, 157 156 .init_machine = smartq5_machine_init, 158 157 .init_late = s3c64xx_init_late, 159 - .init_time = s3c24xx_timer_init, 158 + .init_time = samsung_timer_init, 160 159 .restart = s3c64xx_restart, 161 160 MACHINE_END
+2 -1
arch/arm/mach-s3c64xx/mach-smartq7.c
··· 28 28 #include <plat/devs.h> 29 29 #include <plat/fb.h> 30 30 #include <plat/gpio-cfg.h> 31 + #include <plat/samsung-time.h> 31 32 32 33 #include "common.h" 33 34 #include "mach-smartq.h" ··· 172 171 .map_io = smartq_map_io, 173 172 .init_machine = smartq7_machine_init, 174 173 .init_late = s3c64xx_init_late, 175 - .init_time = s3c24xx_timer_init, 174 + .init_time = samsung_timer_init, 176 175 .restart = s3c64xx_restart, 177 176 MACHINE_END
+3 -1
arch/arm/mach-s3c64xx/mach-smdk6400.c
··· 35 35 #include <plat/devs.h> 36 36 #include <plat/cpu.h> 37 37 #include <linux/platform_data/i2c-s3c2410.h> 38 + #include <plat/samsung-time.h> 38 39 39 40 #include "common.h" 40 41 ··· 67 66 s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc)); 68 67 s3c24xx_init_clocks(12000000); 69 68 s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs)); 69 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 70 70 } 71 71 72 72 static struct platform_device *smdk6400_devices[] __initdata = { ··· 94 92 .map_io = smdk6400_map_io, 95 93 .init_machine = smdk6400_machine_init, 96 94 .init_late = s3c64xx_init_late, 97 - .init_time = s3c24xx_timer_init, 95 + .init_time = samsung_timer_init, 98 96 .restart = s3c64xx_restart, 99 97 MACHINE_END
+3 -1
arch/arm/mach-s3c64xx/mach-smdk6410.c
··· 69 69 #include <linux/platform_data/touchscreen-s3c2410.h> 70 70 #include <plat/keypad.h> 71 71 #include <plat/backlight.h> 72 + #include <plat/samsung-time.h> 72 73 73 74 #include "common.h" 74 75 #include "regs-modem.h" ··· 635 634 s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc)); 636 635 s3c24xx_init_clocks(12000000); 637 636 s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs)); 637 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 638 638 639 639 /* set the LCD type */ 640 640 ··· 704 702 .map_io = smdk6410_map_io, 705 703 .init_machine = smdk6410_machine_init, 706 704 .init_late = s3c64xx_init_late, 707 - .init_time = s3c24xx_timer_init, 705 + .init_time = samsung_timer_init, 708 706 .restart = s3c64xx_restart, 709 707 MACHINE_END
+2 -2
arch/arm/mach-s5p64x0/Kconfig
··· 9 9 10 10 config CPU_S5P6440 11 11 bool 12 - select S5P_HRT 13 12 select S5P_SLEEP if PM 14 13 select SAMSUNG_DMADEV 14 + select SAMSUNG_HRT 15 15 select SAMSUNG_WAKEMASK if PM 16 16 help 17 17 Enable S5P6440 CPU support 18 18 19 19 config CPU_S5P6450 20 20 bool 21 - select S5P_HRT 21 + select SAMSUNG_HRT 22 22 select S5P_SLEEP if PM 23 23 select SAMSUNG_DMADEV 24 24 select SAMSUNG_WAKEMASK if PM
+3 -3
arch/arm/mach-s5p64x0/mach-smdk6440.c
··· 48 48 #include <plat/pll.h> 49 49 #include <plat/adc.h> 50 50 #include <linux/platform_data/touchscreen-s3c2410.h> 51 - #include <plat/s5p-time.h> 51 + #include <plat/samsung-time.h> 52 52 #include <plat/backlight.h> 53 53 #include <plat/fb.h> 54 54 #include <plat/sdhci.h> ··· 229 229 s5p64x0_init_io(NULL, 0); 230 230 s3c24xx_init_clocks(12000000); 231 231 s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); 232 - s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 232 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 233 233 } 234 234 235 235 static void s5p6440_set_lcd_interface(void) ··· 273 273 .init_irq = s5p6440_init_irq, 274 274 .map_io = smdk6440_map_io, 275 275 .init_machine = smdk6440_machine_init, 276 - .init_time = s5p_timer_init, 276 + .init_time = samsung_timer_init, 277 277 .restart = s5p64x0_restart, 278 278 MACHINE_END
+3 -3
arch/arm/mach-s5p64x0/mach-smdk6450.c
··· 48 48 #include <plat/pll.h> 49 49 #include <plat/adc.h> 50 50 #include <linux/platform_data/touchscreen-s3c2410.h> 51 - #include <plat/s5p-time.h> 51 + #include <plat/samsung-time.h> 52 52 #include <plat/backlight.h> 53 53 #include <plat/fb.h> 54 54 #include <plat/sdhci.h> ··· 248 248 s5p64x0_init_io(NULL, 0); 249 249 s3c24xx_init_clocks(19200000); 250 250 s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs)); 251 - s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 251 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 252 252 } 253 253 254 254 static void s5p6450_set_lcd_interface(void) ··· 292 292 .init_irq = s5p6450_init_irq, 293 293 .map_io = smdk6450_map_io, 294 294 .init_machine = smdk6450_machine_init, 295 - .init_time = s5p_timer_init, 295 + .init_time = samsung_timer_init, 296 296 .restart = s5p64x0_restart, 297 297 MACHINE_END
+1
arch/arm/mach-s5pc100/Kconfig
··· 11 11 bool 12 12 select S5P_EXT_INT 13 13 select SAMSUNG_DMADEV 14 + select SAMSUNG_HRT 14 15 help 15 16 Enable S5PC100 CPU support 16 17
+3 -1
arch/arm/mach-s5pc100/mach-smdkc100.c
··· 51 51 #include <linux/platform_data/touchscreen-s3c2410.h> 52 52 #include <linux/platform_data/asoc-s3c.h> 53 53 #include <plat/backlight.h> 54 + #include <plat/samsung-time.h> 54 55 55 56 #include "common.h" 56 57 ··· 222 221 s5pc100_init_io(NULL, 0); 223 222 s3c24xx_init_clocks(12000000); 224 223 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs)); 224 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 225 225 } 226 226 227 227 static void __init smdkc100_machine_init(void) ··· 257 255 .init_irq = s5pc100_init_irq, 258 256 .map_io = smdkc100_map_io, 259 257 .init_machine = smdkc100_machine_init, 260 - .init_time = s3c24xx_timer_init, 258 + .init_time = samsung_timer_init, 261 259 .restart = s5pc100_restart, 262 260 MACHINE_END
+1 -1
arch/arm/mach-s5pv210/Kconfig
··· 12 12 config CPU_S5PV210 13 13 bool 14 14 select S5P_EXT_INT 15 - select S5P_HRT 16 15 select S5P_PM if PM 17 16 select S5P_SLEEP if PM 18 17 select SAMSUNG_DMADEV 18 + select SAMSUNG_HRT 19 19 help 20 20 Enable S5PV210 CPU support 21 21
+3 -3
arch/arm/mach-s5pv210/mach-aquila.c
··· 38 38 #include <plat/fb.h> 39 39 #include <plat/fimc-core.h> 40 40 #include <plat/sdhci.h> 41 - #include <plat/s5p-time.h> 41 + #include <plat/samsung-time.h> 42 42 43 43 #include "common.h" 44 44 ··· 651 651 s5pv210_init_io(NULL, 0); 652 652 s3c24xx_init_clocks(24000000); 653 653 s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs)); 654 - s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 654 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 655 655 } 656 656 657 657 static void __init aquila_machine_init(void) ··· 686 686 .init_irq = s5pv210_init_irq, 687 687 .map_io = aquila_map_io, 688 688 .init_machine = aquila_machine_init, 689 - .init_time = s5p_timer_init, 689 + .init_time = samsung_timer_init, 690 690 .restart = s5pv210_restart, 691 691 MACHINE_END
+3 -3
arch/arm/mach-s5pv210/mach-goni.c
··· 47 47 #include <plat/keypad.h> 48 48 #include <plat/sdhci.h> 49 49 #include <plat/clock.h> 50 - #include <plat/s5p-time.h> 50 + #include <plat/samsung-time.h> 51 51 #include <plat/mfc.h> 52 52 #include <plat/camport.h> 53 53 ··· 908 908 s5pv210_init_io(NULL, 0); 909 909 s3c24xx_init_clocks(clk_xusbxti.rate); 910 910 s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs)); 911 - s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 911 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 912 912 } 913 913 914 914 static void __init goni_reserve(void) ··· 973 973 .init_irq = s5pv210_init_irq, 974 974 .map_io = goni_map_io, 975 975 .init_machine = goni_machine_init, 976 - .init_time = s5p_timer_init, 976 + .init_time = samsung_timer_init, 977 977 .reserve = &goni_reserve, 978 978 .restart = s5pv210_restart, 979 979 MACHINE_END
+3 -3
arch/arm/mach-s5pv210/mach-smdkc110.c
··· 29 29 #include <linux/platform_data/ata-samsung_cf.h> 30 30 #include <linux/platform_data/i2c-s3c2410.h> 31 31 #include <plat/pm.h> 32 - #include <plat/s5p-time.h> 32 + #include <plat/samsung-time.h> 33 33 #include <plat/mfc.h> 34 34 35 35 #include "common.h" ··· 120 120 s5pv210_init_io(NULL, 0); 121 121 s3c24xx_init_clocks(24000000); 122 122 s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); 123 - s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 123 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 124 124 } 125 125 126 126 static void __init smdkc110_reserve(void) ··· 153 153 .init_irq = s5pv210_init_irq, 154 154 .map_io = smdkc110_map_io, 155 155 .init_machine = smdkc110_machine_init, 156 - .init_time = s5p_timer_init, 156 + .init_time = samsung_timer_init, 157 157 .restart = s5pv210_restart, 158 158 .reserve = &smdkc110_reserve, 159 159 MACHINE_END
+3 -3
arch/arm/mach-s5pv210/mach-smdkv210.c
··· 44 44 #include <plat/keypad.h> 45 45 #include <plat/pm.h> 46 46 #include <plat/fb.h> 47 - #include <plat/s5p-time.h> 47 + #include <plat/samsung-time.h> 48 48 #include <plat/backlight.h> 49 49 #include <plat/mfc.h> 50 50 #include <plat/clock.h> ··· 285 285 s5pv210_init_io(NULL, 0); 286 286 s3c24xx_init_clocks(clk_xusbxti.rate); 287 287 s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); 288 - s5p_set_timer_source(S5P_PWM2, S5P_PWM4); 288 + samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4); 289 289 } 290 290 291 291 static void __init smdkv210_reserve(void) ··· 329 329 .init_irq = s5pv210_init_irq, 330 330 .map_io = smdkv210_map_io, 331 331 .init_machine = smdkv210_machine_init, 332 - .init_time = s5p_timer_init, 332 + .init_time = samsung_timer_init, 333 333 .restart = s5pv210_restart, 334 334 .reserve = &smdkv210_reserve, 335 335 MACHINE_END
+3 -3
arch/arm/mach-s5pv210/mach-torbreck.c
··· 26 26 #include <plat/devs.h> 27 27 #include <plat/cpu.h> 28 28 #include <linux/platform_data/i2c-s3c2410.h> 29 - #include <plat/s5p-time.h> 29 + #include <plat/samsung-time.h> 30 30 31 31 #include "common.h" 32 32 ··· 106 106 s5pv210_init_io(NULL, 0); 107 107 s3c24xx_init_clocks(24000000); 108 108 s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs)); 109 - s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 109 + samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 110 110 } 111 111 112 112 static void __init torbreck_machine_init(void) ··· 130 130 .init_irq = s5pv210_init_irq, 131 131 .map_io = torbreck_map_io, 132 132 .init_machine = torbreck_machine_init, 133 - .init_time = s5p_timer_init, 133 + .init_time = samsung_timer_init, 134 134 .restart = s5pv210_restart, 135 135 MACHINE_END
+2
arch/arm/mach-shmobile/Kconfig
··· 16 16 select CPU_V7 17 17 select I2C 18 18 select SH_CLK_CPG 19 + select RENESAS_INTC_IRQPIN 19 20 20 21 config ARCH_R8A7740 21 22 bool "R-Mobile A1 (R8A77400)" ··· 32 31 select SH_CLK_CPG 33 32 select USB_ARCH_HAS_EHCI 34 33 select USB_ARCH_HAS_OHCI 34 + select RENESAS_INTC_IRQPIN 35 35 36 36 config ARCH_EMEV2 37 37 bool "Emma Mobile EV2"
+7 -7
arch/arm/mach-shmobile/board-kzm9g.c
··· 81 81 .flags = IORESOURCE_MEM, 82 82 }, 83 83 [1] = { 84 - .start = intcs_evt2irq(0x260), /* IRQ3 */ 84 + .start = irq_pin(3), /* IRQ3 */ 85 85 .flags = IORESOURCE_IRQ, 86 86 }, 87 87 }; ··· 115 115 .flags = IORESOURCE_MEM, 116 116 }, 117 117 [1] = { 118 - .start = intcs_evt2irq(0x220), /* IRQ1 */ 118 + .start = irq_pin(1), /* IRQ1 */ 119 119 .flags = IORESOURCE_IRQ, 120 120 }, 121 121 }; ··· 138 138 struct renesas_usbhs_platform_info info; 139 139 }; 140 140 141 - #define IRQ15 intcs_evt2irq(0x03e0) 141 + #define IRQ15 irq_pin(15) 142 142 #define USB_PHY_MODE (1 << 4) 143 143 #define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) 144 144 #define USB_PHY_ON (1 << 1) ··· 567 567 }, 568 568 { 569 569 I2C_BOARD_INFO("ak8975", 0x0c), 570 - .irq = intcs_evt2irq(0x3380), /* IRQ28 */ 570 + .irq = irq_pin(28), /* IRQ28 */ 571 571 }, 572 572 { 573 573 I2C_BOARD_INFO("adxl34x", 0x1d), 574 - .irq = intcs_evt2irq(0x3340), /* IRQ26 */ 574 + .irq = irq_pin(26), /* IRQ26 */ 575 575 }, 576 576 }; 577 577 578 578 static struct i2c_board_info i2c1_devices[] = { 579 579 { 580 580 I2C_BOARD_INFO("st1232-ts", 0x55), 581 - .irq = intcs_evt2irq(0x300), /* IRQ8 */ 581 + .irq = irq_pin(8), /* IRQ8 */ 582 582 }, 583 583 }; 584 584 585 585 static struct i2c_board_info i2c3_devices[] = { 586 586 { 587 587 I2C_BOARD_INFO("pcf8575", 0x20), 588 - .irq = intcs_evt2irq(0x3260), /* IRQ19 */ 588 + .irq = irq_pin(19), /* IRQ19 */ 589 589 .platform_data = &pcf8575_pdata, 590 590 }, 591 591 };
+1
arch/arm/mach-shmobile/include/mach/common.h
··· 58 58 59 59 extern void r8a7779_init_delay(void); 60 60 extern void r8a7779_init_irq(void); 61 + extern void r8a7779_init_irq_extpin(int irlm); 61 62 extern void r8a7779_init_irq_dt(void); 62 63 extern void r8a7779_map_io(void); 63 64 extern void r8a7779_earlytimer_init(void);
+4
arch/arm/mach-shmobile/include/mach/irqs.h
··· 12 12 #define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) 13 13 #define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt)) 14 14 15 + /* External IRQ pins */ 16 + #define IRQPIN_BASE 2000 17 + #define irq_pin(nr) ((nr) + IRQPIN_BASE) 18 + 15 19 #endif /* __ASM_MACH_IRQS_H */
+52 -1
arch/arm/mach-shmobile/intc-r8a7779.c
··· 19 19 */ 20 20 #include <linux/kernel.h> 21 21 #include <linux/init.h> 22 + #include <linux/platform_device.h> 22 23 #include <linux/interrupt.h> 23 24 #include <linux/irq.h> 24 25 #include <linux/io.h> 25 26 #include <linux/irqchip/arm-gic.h> 26 - #include <mach/common.h> 27 + #include <linux/platform_data/irq-renesas-intc-irqpin.h> 27 28 #include <linux/irqchip.h> 29 + #include <mach/common.h> 28 30 #include <mach/intc.h> 31 + #include <mach/irqs.h> 29 32 #include <mach/r8a7779.h> 30 33 #include <asm/mach-types.h> 31 34 #include <asm/mach/arch.h> ··· 41 38 42 39 #define INT2NTSR0 IOMEM(0xfe700060) 43 40 #define INT2NTSR1 IOMEM(0xfe700064) 41 + 42 + static struct renesas_intc_irqpin_config irqpin0_platform_data = { 43 + .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */ 44 + .sense_bitfield_width = 2, 45 + }; 46 + 47 + static struct resource irqpin0_resources[] = { 48 + DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */ 49 + DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */ 50 + DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */ 51 + DEFINE_RES_MEM(0xfe780044, 4), /* INTMSK0 */ 52 + DEFINE_RES_MEM(0xfe780064, 4), /* INTMSKCLR0 */ 53 + DEFINE_RES_IRQ(gic_spi(27)), /* IRQ0 */ 54 + DEFINE_RES_IRQ(gic_spi(28)), /* IRQ1 */ 55 + DEFINE_RES_IRQ(gic_spi(29)), /* IRQ2 */ 56 + DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */ 57 + }; 58 + 59 + static struct platform_device irqpin0_device = { 60 + .name = "renesas_intc_irqpin", 61 + .id = 0, 62 + .resource = irqpin0_resources, 63 + .num_resources = ARRAY_SIZE(irqpin0_resources), 64 + .dev = { 65 + .platform_data = &irqpin0_platform_data, 66 + }, 67 + }; 68 + 69 + void __init r8a7779_init_irq_extpin(int irlm) 70 + { 71 + void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE); 72 + unsigned long tmp; 73 + 74 + if (icr0) { 75 + tmp = ioread32(icr0); 76 + if (irlm) 77 + tmp |= 1 << 23; /* IRQ0 -> IRQ3 as individual pins */ 78 + else 79 + tmp &= ~(1 << 23); /* IRL mode - not supported */ 80 + tmp |= (1 << 21); /* LVLMODE = 1 */ 81 + iowrite32(tmp, icr0); 82 + iounmap(icr0); 83 + 84 + if (irlm) 85 + platform_device_register(&irqpin0_device); 86 + } else 87 + pr_warn("r8a7779: unable to setup external irq pin mode\n"); 88 + } 44 89 45 90 static int r8a7779_set_wake(struct irq_data *data, unsigned int on) 46 91 {
-117
arch/arm/mach-shmobile/intc-sh73a0.c
··· 260 260 return 0; /* always allow wakeup */ 261 261 } 262 262 263 - #define RELOC_BASE 0x1200 264 - 265 - /* INTCA IRQ pins at INTCS + RELOC_BASE to make space for GIC+INTC handling */ 266 - #define INTCS_VECT_RELOC(n, vect) INTCS_VECT((n), (vect) + RELOC_BASE) 267 - 268 - INTC_IRQ_PINS_32(intca_irq_pins, 0xe6900000, 269 - INTCS_VECT_RELOC, "sh73a0-intca-irq-pins"); 270 - 271 - static int to_gic_irq(struct irq_data *data) 272 - { 273 - unsigned int vect = irq2evt(data->irq) - INTCS_VECT_BASE; 274 - 275 - if (vect >= 0x3200) 276 - vect -= 0x3000; 277 - else 278 - vect -= 0x0200; 279 - 280 - return gic_spi((vect >> 5) + 1); 281 - } 282 - 283 - static int to_intca_reloc_irq(struct irq_data *data) 284 - { 285 - return data->irq + (RELOC_BASE >> 5); 286 - } 287 - 288 - #define irq_cb(cb, irq) irq_get_chip(irq)->cb(irq_get_irq_data(irq)) 289 - #define irq_cbp(cb, irq, p...) irq_get_chip(irq)->cb(irq_get_irq_data(irq), p) 290 - 291 - static void intca_gic_enable(struct irq_data *data) 292 - { 293 - irq_cb(irq_unmask, to_intca_reloc_irq(data)); 294 - irq_cb(irq_unmask, to_gic_irq(data)); 295 - } 296 - 297 - static void intca_gic_disable(struct irq_data *data) 298 - { 299 - irq_cb(irq_mask, to_gic_irq(data)); 300 - irq_cb(irq_mask, to_intca_reloc_irq(data)); 301 - } 302 - 303 - static void intca_gic_mask_ack(struct irq_data *data) 304 - { 305 - irq_cb(irq_mask, to_gic_irq(data)); 306 - irq_cb(irq_mask_ack, to_intca_reloc_irq(data)); 307 - } 308 - 309 - static void intca_gic_eoi(struct irq_data *data) 310 - { 311 - irq_cb(irq_eoi, to_gic_irq(data)); 312 - } 313 - 314 - static int intca_gic_set_type(struct irq_data *data, unsigned int type) 315 - { 316 - return irq_cbp(irq_set_type, to_intca_reloc_irq(data), type); 317 - } 318 - 319 - #ifdef CONFIG_SMP 320 - static int intca_gic_set_affinity(struct irq_data *data, 321 - const struct cpumask *cpumask, 322 - bool force) 323 - { 324 - return irq_cbp(irq_set_affinity, to_gic_irq(data), cpumask, force); 325 - } 326 - #endif 327 - 328 - struct irq_chip intca_gic_irq_chip = { 329 - .name = "INTCA-GIC", 330 - .irq_mask = intca_gic_disable, 331 - .irq_unmask = intca_gic_enable, 332 - .irq_mask_ack = intca_gic_mask_ack, 333 - .irq_eoi = intca_gic_eoi, 334 - .irq_enable = intca_gic_enable, 335 - .irq_disable = intca_gic_disable, 336 - .irq_shutdown = intca_gic_disable, 337 - .irq_set_type = intca_gic_set_type, 338 - .irq_set_wake = sh73a0_set_wake, 339 - #ifdef CONFIG_SMP 340 - .irq_set_affinity = intca_gic_set_affinity, 341 - #endif 342 - }; 343 - 344 - static int to_intc_vect(int irq) 345 - { 346 - unsigned int irq_pin = irq - gic_spi(1); 347 - unsigned int offs; 348 - 349 - if (irq_pin < 16) 350 - offs = 0x0200; 351 - else 352 - offs = 0x3000; 353 - 354 - return offs + (irq_pin << 5); 355 - } 356 - 357 - static irqreturn_t sh73a0_irq_pin_demux(int irq, void *dev_id) 358 - { 359 - generic_handle_irq(intcs_evt2irq(to_intc_vect(irq))); 360 - return IRQ_HANDLED; 361 - } 362 - 363 - static struct irqaction sh73a0_irq_pin_cascade[32]; 364 - 365 263 #define PINTER0_PHYS 0xe69000a0 366 264 #define PINTER1_PHYS 0xe69000a4 367 265 #define PINTER0_VIRT IOMEM(0xe69000a0) ··· 320 422 void __iomem *gic_dist_base = IOMEM(0xf0001000); 321 423 void __iomem *gic_cpu_base = IOMEM(0xf0000100); 322 424 void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); 323 - int k, n; 324 425 325 426 gic_init(0, 29, gic_dist_base, gic_cpu_base); 326 427 gic_arch_extn.irq_set_wake = sh73a0_set_wake; 327 428 328 429 register_intc_controller(&intcs_desc); 329 - register_intc_controller(&intca_irq_pins_desc); 330 430 register_intc_controller(&intc_pint0_desc); 331 431 register_intc_controller(&intc_pint1_desc); 332 432 ··· 333 437 sh73a0_intcs_cascade.handler = sh73a0_intcs_demux; 334 438 sh73a0_intcs_cascade.dev_id = intevtsa; 335 439 setup_irq(gic_spi(50), &sh73a0_intcs_cascade); 336 - 337 - /* IRQ pins require special handling through INTCA and GIC */ 338 - for (k = 0; k < 32; k++) { 339 - sh73a0_irq_pin_cascade[k].name = "INTCA-GIC cascade"; 340 - sh73a0_irq_pin_cascade[k].handler = sh73a0_irq_pin_demux; 341 - setup_irq(gic_spi(1 + k), &sh73a0_irq_pin_cascade[k]); 342 - 343 - n = intcs_evt2irq(to_intc_vect(gic_spi(1 + k))); 344 - WARN_ON(irq_alloc_desc_at(n, numa_node_id()) != n); 345 - irq_set_chip_and_handler_name(n, &intca_gic_irq_chip, 346 - handle_level_irq, "level"); 347 - set_irq_flags(n, IRQF_VALID); /* yuck */ 348 - } 349 440 350 441 /* PINT pins are sanely tied to the GIC as SPI */ 351 442 sh73a0_pint0_cascade.name = "PINT0 cascade";
+126
arch/arm/mach-shmobile/setup-sh73a0.c
··· 33 33 #include <linux/sh_intc.h> 34 34 #include <linux/sh_timer.h> 35 35 #include <linux/platform_data/sh_ipmmu.h> 36 + #include <linux/platform_data/irq-renesas-intc-irqpin.h> 36 37 #include <mach/dma-register.h> 37 38 #include <mach/hardware.h> 38 39 #include <mach/irqs.h> ··· 812 811 .num_resources = ARRAY_SIZE(ipmmu_resources), 813 812 }; 814 813 814 + static struct renesas_intc_irqpin_config irqpin0_platform_data = { 815 + .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */ 816 + }; 817 + 818 + static struct resource irqpin0_resources[] = { 819 + DEFINE_RES_MEM(0xe6900000, 4), /* ICR1A */ 820 + DEFINE_RES_MEM(0xe6900010, 4), /* INTPRI00A */ 821 + DEFINE_RES_MEM(0xe6900020, 1), /* INTREQ00A */ 822 + DEFINE_RES_MEM(0xe6900040, 1), /* INTMSK00A */ 823 + DEFINE_RES_MEM(0xe6900060, 1), /* INTMSKCLR00A */ 824 + DEFINE_RES_IRQ(gic_spi(1)), /* IRQ0 */ 825 + DEFINE_RES_IRQ(gic_spi(2)), /* IRQ1 */ 826 + DEFINE_RES_IRQ(gic_spi(3)), /* IRQ2 */ 827 + DEFINE_RES_IRQ(gic_spi(4)), /* IRQ3 */ 828 + DEFINE_RES_IRQ(gic_spi(5)), /* IRQ4 */ 829 + DEFINE_RES_IRQ(gic_spi(6)), /* IRQ5 */ 830 + DEFINE_RES_IRQ(gic_spi(7)), /* IRQ6 */ 831 + DEFINE_RES_IRQ(gic_spi(8)), /* IRQ7 */ 832 + }; 833 + 834 + static struct platform_device irqpin0_device = { 835 + .name = "renesas_intc_irqpin", 836 + .id = 0, 837 + .resource = irqpin0_resources, 838 + .num_resources = ARRAY_SIZE(irqpin0_resources), 839 + .dev = { 840 + .platform_data = &irqpin0_platform_data, 841 + }, 842 + }; 843 + 844 + static struct renesas_intc_irqpin_config irqpin1_platform_data = { 845 + .irq_base = irq_pin(8), /* IRQ8 -> IRQ15 */ 846 + .control_parent = true, /* Disable spurious IRQ10 */ 847 + }; 848 + 849 + static struct resource irqpin1_resources[] = { 850 + DEFINE_RES_MEM(0xe6900004, 4), /* ICR2A */ 851 + DEFINE_RES_MEM(0xe6900014, 4), /* INTPRI10A */ 852 + DEFINE_RES_MEM(0xe6900024, 1), /* INTREQ10A */ 853 + DEFINE_RES_MEM(0xe6900044, 1), /* INTMSK10A */ 854 + DEFINE_RES_MEM(0xe6900064, 1), /* INTMSKCLR10A */ 855 + DEFINE_RES_IRQ(gic_spi(9)), /* IRQ8 */ 856 + DEFINE_RES_IRQ(gic_spi(10)), /* IRQ9 */ 857 + DEFINE_RES_IRQ(gic_spi(11)), /* IRQ10 */ 858 + DEFINE_RES_IRQ(gic_spi(12)), /* IRQ11 */ 859 + DEFINE_RES_IRQ(gic_spi(13)), /* IRQ12 */ 860 + DEFINE_RES_IRQ(gic_spi(14)), /* IRQ13 */ 861 + DEFINE_RES_IRQ(gic_spi(15)), /* IRQ14 */ 862 + DEFINE_RES_IRQ(gic_spi(16)), /* IRQ15 */ 863 + }; 864 + 865 + static struct platform_device irqpin1_device = { 866 + .name = "renesas_intc_irqpin", 867 + .id = 1, 868 + .resource = irqpin1_resources, 869 + .num_resources = ARRAY_SIZE(irqpin1_resources), 870 + .dev = { 871 + .platform_data = &irqpin1_platform_data, 872 + }, 873 + }; 874 + 875 + static struct renesas_intc_irqpin_config irqpin2_platform_data = { 876 + .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */ 877 + }; 878 + 879 + static struct resource irqpin2_resources[] = { 880 + DEFINE_RES_MEM(0xe6900008, 4), /* ICR3A */ 881 + DEFINE_RES_MEM(0xe6900018, 4), /* INTPRI20A */ 882 + DEFINE_RES_MEM(0xe6900028, 1), /* INTREQ20A */ 883 + DEFINE_RES_MEM(0xe6900048, 1), /* INTMSK20A */ 884 + DEFINE_RES_MEM(0xe6900068, 1), /* INTMSKCLR20A */ 885 + DEFINE_RES_IRQ(gic_spi(17)), /* IRQ16 */ 886 + DEFINE_RES_IRQ(gic_spi(18)), /* IRQ17 */ 887 + DEFINE_RES_IRQ(gic_spi(19)), /* IRQ18 */ 888 + DEFINE_RES_IRQ(gic_spi(20)), /* IRQ19 */ 889 + DEFINE_RES_IRQ(gic_spi(21)), /* IRQ20 */ 890 + DEFINE_RES_IRQ(gic_spi(22)), /* IRQ21 */ 891 + DEFINE_RES_IRQ(gic_spi(23)), /* IRQ22 */ 892 + DEFINE_RES_IRQ(gic_spi(24)), /* IRQ23 */ 893 + }; 894 + 895 + static struct platform_device irqpin2_device = { 896 + .name = "renesas_intc_irqpin", 897 + .id = 2, 898 + .resource = irqpin2_resources, 899 + .num_resources = ARRAY_SIZE(irqpin2_resources), 900 + .dev = { 901 + .platform_data = &irqpin2_platform_data, 902 + }, 903 + }; 904 + 905 + static struct renesas_intc_irqpin_config irqpin3_platform_data = { 906 + .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */ 907 + }; 908 + 909 + static struct resource irqpin3_resources[] = { 910 + DEFINE_RES_MEM(0xe690000c, 4), /* ICR4A */ 911 + DEFINE_RES_MEM(0xe690001c, 4), /* INTPRI30A */ 912 + DEFINE_RES_MEM(0xe690002c, 1), /* INTREQ30A */ 913 + DEFINE_RES_MEM(0xe690004c, 1), /* INTMSK30A */ 914 + DEFINE_RES_MEM(0xe690006c, 1), /* INTMSKCLR30A */ 915 + DEFINE_RES_IRQ(gic_spi(25)), /* IRQ24 */ 916 + DEFINE_RES_IRQ(gic_spi(26)), /* IRQ25 */ 917 + DEFINE_RES_IRQ(gic_spi(27)), /* IRQ26 */ 918 + DEFINE_RES_IRQ(gic_spi(28)), /* IRQ27 */ 919 + DEFINE_RES_IRQ(gic_spi(29)), /* IRQ28 */ 920 + DEFINE_RES_IRQ(gic_spi(30)), /* IRQ29 */ 921 + DEFINE_RES_IRQ(gic_spi(31)), /* IRQ30 */ 922 + DEFINE_RES_IRQ(gic_spi(32)), /* IRQ31 */ 923 + }; 924 + 925 + static struct platform_device irqpin3_device = { 926 + .name = "renesas_intc_irqpin", 927 + .id = 3, 928 + .resource = irqpin3_resources, 929 + .num_resources = ARRAY_SIZE(irqpin3_resources), 930 + .dev = { 931 + .platform_data = &irqpin3_platform_data, 932 + }, 933 + }; 934 + 815 935 static struct platform_device *sh73a0_devices_dt[] __initdata = { 816 936 &scif0_device, 817 937 &scif1_device, ··· 961 839 &dma0_device, 962 840 &mpdma0_device, 963 841 &pmu_device, 842 + &irqpin0_device, 843 + &irqpin1_device, 844 + &irqpin2_device, 845 + &irqpin3_device, 964 846 }; 965 847 966 848 #define SRCR2 IOMEM(0xe61580b0)
+3
arch/arm/mach-tegra/tegra.c
··· 34 34 #include <linux/slab.h> 35 35 #include <linux/sys_soc.h> 36 36 #include <linux/usb/tegra_usb_phy.h> 37 + #include <linux/clk/tegra.h> 37 38 38 39 #include <asm/mach-types.h> 39 40 #include <asm/mach/arch.h> ··· 85 84 struct soc_device_attribute *soc_dev_attr; 86 85 struct soc_device *soc_dev; 87 86 struct device *parent = NULL; 87 + 88 + tegra_clocks_apply_init_table(); 88 89 89 90 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 90 91 if (!soc_dev_attr)
+26 -8
arch/arm/mach-ux500/board-mop500-pins.c
··· 46 46 PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE); 47 47 BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED| 48 48 PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 49 + BIAS(slpm_in_wkup_pdis_en, PIN_SLEEPMODE_ENABLED| 50 + PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED); 49 51 BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED| 50 52 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 53 + BIAS(slpm_wkup_pdis_en, PIN_SLEEPMODE_ENABLED| 54 + PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED); 51 55 BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED| 52 56 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED); 53 57 BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED| ··· 80 76 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func) 81 77 #define DB8500_PIN_HOG(pin,conf) \ 82 78 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf) 83 - #define DB8500_PIN_SLEEP(pin, conf, dev) \ 84 - PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \ 85 - pin, conf) 86 79 87 80 /* These are default states associated with device and changed runtime */ 88 81 #define DB8500_MUX(group,func,dev) \ ··· 308 307 DB8500_PIN_SLEEP("GPIO207_AJ23", slpm_in_wkup_pdis, "sdi4"), /* DAT4 */ 309 308 310 309 /* Mux in USB pins, drive STP high */ 311 - DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"), 312 - DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */ 310 + /* USB default state */ 311 + DB8500_MUX("usb_a_1", "usb", "ab8500-usb.0"), 312 + DB8500_PIN("GPIO257_AE29", out_hi, "ab8500-usb.0"), /* STP */ 313 + /* USB sleep state */ 314 + DB8500_PIN_SLEEP("GPIO256_AF28", slpm_wkup_pdis_en, "ab8500-usb.0"), /* NXT */ 315 + DB8500_PIN_SLEEP("GPIO257_AE29", slpm_out_hi_wkup_pdis, "ab8500-usb.0"), /* STP */ 316 + DB8500_PIN_SLEEP("GPIO258_AD29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* XCLK */ 317 + DB8500_PIN_SLEEP("GPIO259_AC29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* DIR */ 318 + DB8500_PIN_SLEEP("GPIO260_AD28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT7 */ 319 + DB8500_PIN_SLEEP("GPIO261_AD26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT6 */ 320 + DB8500_PIN_SLEEP("GPIO262_AE26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT5 */ 321 + DB8500_PIN_SLEEP("GPIO263_AG29", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT4 */ 322 + DB8500_PIN_SLEEP("GPIO264_AE27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT3 */ 323 + DB8500_PIN_SLEEP("GPIO265_AD27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT2 */ 324 + DB8500_PIN_SLEEP("GPIO266_AC28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT1 */ 325 + DB8500_PIN_SLEEP("GPIO267_AC27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT0 */ 326 + 313 327 /* Mux in SPI2 pins on the "other C1" altfunction */ 314 328 DB8500_MUX("spi2_oc1_2", "spi2", "spi2"), 315 329 DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */ ··· 332 316 DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */ 333 317 DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */ 334 318 /* SPI2 idle state */ 335 - DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ 336 - DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */ 337 - DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */ 319 + DB8500_PIN_IDLE("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ 320 + DB8500_PIN_IDLE("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */ 321 + DB8500_PIN_IDLE("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */ 338 322 /* SPI2 sleep state */ 339 323 DB8500_PIN_SLEEP("GPIO216_AG12", slpm_in_wkup_pdis, "spi2"), /* FRM */ 340 324 DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ ··· 761 745 DB8500_PIN_HOG("GPIO21_AB3", out_hi), 762 746 /* Mux in "SM" which is used for the SMSC911x Ethernet adapter */ 763 747 DB8500_MUX_HOG("sm_b_1", "sm"), 748 + /* User LED */ 749 + DB8500_PIN_HOG("GPIO142_C11", gpio_out_hi), 764 750 /* Drive RSTn_LAN high */ 765 751 DB8500_PIN_HOG("GPIO141_C12", gpio_out_hi), 766 752 /* Accelerometer/Magnetometer */
+1
arch/arm/mach-vt8500/Kconfig
··· 7 7 select GENERIC_CLOCKEVENTS 8 8 select HAVE_CLK 9 9 select VT8500_TIMER 10 + select PINCTRL 10 11 help 11 12 Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. 12 13
+1 -1
arch/arm/mach-vt8500/Makefile
··· 1 - obj-$(CONFIG_ARCH_VT8500) += irq.o vt8500.o 1 + obj-$(CONFIG_ARCH_VT8500) += vt8500.o
-6
arch/arm/mach-vt8500/common.h
··· 18 18 19 19 #include <linux/of.h> 20 20 21 - int __init vt8500_irq_init(struct device_node *node, 22 - struct device_node *parent); 23 - 24 21 /* defined in drivers/clk/clk-vt8500.c */ 25 22 void __init vtwm_clk_init(void __iomem *pmc_base); 26 - 27 - /* defined in irq.c */ 28 - asmlinkage void vt8500_handle_irq(struct pt_regs *regs); 29 23 30 24 #endif
+6
arch/arm/mach-vt8500/irq.c drivers/irqchip/irq-vt8500.c
··· 37 37 38 38 #include <asm/irq.h> 39 39 #include <asm/exception.h> 40 + #include <asm/mach/irq.h> 41 + 42 + #include "irqchip.h" 40 43 41 44 #define VT8500_ICPC_IRQ 0x20 42 45 #define VT8500_ICPC_FIQ 0x24 ··· 228 225 goto out; 229 226 } 230 227 228 + set_handle_irq(vt8500_handle_irq); 229 + 231 230 vt8500_init_irq_hw(intc[active_cnt].base); 232 231 233 232 pr_info("vt8500-irq: Added interrupt controller\n"); ··· 256 251 return 0; 257 252 } 258 253 254 + IRQCHIP_DECLARE(vt8500_irq, "via,vt8500-intc", vt8500_irq_init);
+2 -12
arch/arm/mach-vt8500/vt8500.c
··· 20 20 21 21 #include <linux/clocksource.h> 22 22 #include <linux/io.h> 23 + #include <linux/irqchip.h> 23 24 #include <linux/pm.h> 24 25 25 26 #include <asm/mach-types.h> ··· 167 166 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 168 167 } 169 168 170 - static const struct of_device_id vt8500_irq_match[] __initconst = { 171 - { .compatible = "via,vt8500-intc", .data = vt8500_irq_init, }, 172 - { /* sentinel */ }, 173 - }; 174 - 175 - static void __init vt8500_init_irq(void) 176 - { 177 - of_irq_init(vt8500_irq_match); 178 - }; 179 - 180 169 static const char * const vt8500_dt_compat[] = { 181 170 "via,vt8500", 182 171 "wm,wm8650", ··· 178 187 DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)") 179 188 .dt_compat = vt8500_dt_compat, 180 189 .map_io = vt8500_map_io, 181 - .init_irq = vt8500_init_irq, 190 + .init_irq = irqchip_init, 182 191 .init_machine = vt8500_init, 183 192 .init_time = clocksource_of_init, 184 193 .restart = vt8500_restart, 185 - .handle_irq = vt8500_handle_irq, 186 194 MACHINE_END 187 195
+1
arch/arm/mach-zynq/Kconfig
··· 11 11 select MIGHT_HAVE_CACHE_L2X0 12 12 select USE_OF 13 13 select SPARSE_IRQ 14 + select CADENCE_TTC_TIMER 14 15 help 15 16 Support for Xilinx Zynq ARM Cortex A9 Platform
+1 -1
arch/arm/mach-zynq/Makefile
··· 3 3 # 4 4 5 5 # Common support 6 - obj-y := common.o timer.o 6 + obj-y := common.o
+2 -1
arch/arm/mach-zynq/common.c
··· 20 20 #include <linux/platform_device.h> 21 21 #include <linux/clk.h> 22 22 #include <linux/clk/zynq.h> 23 + #include <linux/clocksource.h> 23 24 #include <linux/of_address.h> 24 25 #include <linux/of_irq.h> 25 26 #include <linux/of_platform.h> ··· 78 77 79 78 xilinx_zynq_clocks_init(slcr); 80 79 81 - xttcps_timer_init(); 80 + clocksource_of_init(); 82 81 } 83 82 84 83 /**
-2
arch/arm/mach-zynq/common.h
··· 17 17 #ifndef __MACH_ZYNQ_COMMON_H__ 18 18 #define __MACH_ZYNQ_COMMON_H__ 19 19 20 - void __init xttcps_timer_init(void); 21 - 22 20 #endif
-324
arch/arm/mach-zynq/timer.c
··· 1 - /* 2 - * This file contains driver for the Xilinx PS Timer Counter IP. 3 - * 4 - * Copyright (C) 2011 Xilinx 5 - * 6 - * based on arch/mips/kernel/time.c timer driver 7 - * 8 - * This software is licensed under the terms of the GNU General Public 9 - * License version 2, as published by the Free Software Foundation, and 10 - * may be copied, distributed, and modified under those terms. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 - */ 17 - 18 - #include <linux/interrupt.h> 19 - #include <linux/clockchips.h> 20 - #include <linux/of_address.h> 21 - #include <linux/of_irq.h> 22 - #include <linux/slab.h> 23 - #include <linux/clk-provider.h> 24 - #include "common.h" 25 - 26 - /* 27 - * Timer Register Offset Definitions of Timer 1, Increment base address by 4 28 - * and use same offsets for Timer 2 29 - */ 30 - #define XTTCPS_CLK_CNTRL_OFFSET 0x00 /* Clock Control Reg, RW */ 31 - #define XTTCPS_CNT_CNTRL_OFFSET 0x0C /* Counter Control Reg, RW */ 32 - #define XTTCPS_COUNT_VAL_OFFSET 0x18 /* Counter Value Reg, RO */ 33 - #define XTTCPS_INTR_VAL_OFFSET 0x24 /* Interval Count Reg, RW */ 34 - #define XTTCPS_ISR_OFFSET 0x54 /* Interrupt Status Reg, RO */ 35 - #define XTTCPS_IER_OFFSET 0x60 /* Interrupt Enable Reg, RW */ 36 - 37 - #define XTTCPS_CNT_CNTRL_DISABLE_MASK 0x1 38 - 39 - /* 40 - * Setup the timers to use pre-scaling, using a fixed value for now that will 41 - * work across most input frequency, but it may need to be more dynamic 42 - */ 43 - #define PRESCALE_EXPONENT 11 /* 2 ^ PRESCALE_EXPONENT = PRESCALE */ 44 - #define PRESCALE 2048 /* The exponent must match this */ 45 - #define CLK_CNTRL_PRESCALE ((PRESCALE_EXPONENT - 1) << 1) 46 - #define CLK_CNTRL_PRESCALE_EN 1 47 - #define CNT_CNTRL_RESET (1<<4) 48 - 49 - /** 50 - * struct xttcps_timer - This definition defines local timer structure 51 - * 52 - * @base_addr: Base address of timer 53 - **/ 54 - struct xttcps_timer { 55 - void __iomem *base_addr; 56 - }; 57 - 58 - struct xttcps_timer_clocksource { 59 - struct xttcps_timer xttc; 60 - struct clocksource cs; 61 - }; 62 - 63 - #define to_xttcps_timer_clksrc(x) \ 64 - container_of(x, struct xttcps_timer_clocksource, cs) 65 - 66 - struct xttcps_timer_clockevent { 67 - struct xttcps_timer xttc; 68 - struct clock_event_device ce; 69 - struct clk *clk; 70 - }; 71 - 72 - #define to_xttcps_timer_clkevent(x) \ 73 - container_of(x, struct xttcps_timer_clockevent, ce) 74 - 75 - /** 76 - * xttcps_set_interval - Set the timer interval value 77 - * 78 - * @timer: Pointer to the timer instance 79 - * @cycles: Timer interval ticks 80 - **/ 81 - static void xttcps_set_interval(struct xttcps_timer *timer, 82 - unsigned long cycles) 83 - { 84 - u32 ctrl_reg; 85 - 86 - /* Disable the counter, set the counter value and re-enable counter */ 87 - ctrl_reg = __raw_readl(timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); 88 - ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK; 89 - __raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); 90 - 91 - __raw_writel(cycles, timer->base_addr + XTTCPS_INTR_VAL_OFFSET); 92 - 93 - /* 94 - * Reset the counter (0x10) so that it starts from 0, one-shot 95 - * mode makes this needed for timing to be right. 96 - */ 97 - ctrl_reg |= CNT_CNTRL_RESET; 98 - ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK; 99 - __raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); 100 - } 101 - 102 - /** 103 - * xttcps_clock_event_interrupt - Clock event timer interrupt handler 104 - * 105 - * @irq: IRQ number of the Timer 106 - * @dev_id: void pointer to the xttcps_timer instance 107 - * 108 - * returns: Always IRQ_HANDLED - success 109 - **/ 110 - static irqreturn_t xttcps_clock_event_interrupt(int irq, void *dev_id) 111 - { 112 - struct xttcps_timer_clockevent *xttce = dev_id; 113 - struct xttcps_timer *timer = &xttce->xttc; 114 - 115 - /* Acknowledge the interrupt and call event handler */ 116 - __raw_readl(timer->base_addr + XTTCPS_ISR_OFFSET); 117 - 118 - xttce->ce.event_handler(&xttce->ce); 119 - 120 - return IRQ_HANDLED; 121 - } 122 - 123 - /** 124 - * __xttc_clocksource_read - Reads the timer counter register 125 - * 126 - * returns: Current timer counter register value 127 - **/ 128 - static cycle_t __xttc_clocksource_read(struct clocksource *cs) 129 - { 130 - struct xttcps_timer *timer = &to_xttcps_timer_clksrc(cs)->xttc; 131 - 132 - return (cycle_t)__raw_readl(timer->base_addr + 133 - XTTCPS_COUNT_VAL_OFFSET); 134 - } 135 - 136 - /** 137 - * xttcps_set_next_event - Sets the time interval for next event 138 - * 139 - * @cycles: Timer interval ticks 140 - * @evt: Address of clock event instance 141 - * 142 - * returns: Always 0 - success 143 - **/ 144 - static int xttcps_set_next_event(unsigned long cycles, 145 - struct clock_event_device *evt) 146 - { 147 - struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt); 148 - struct xttcps_timer *timer = &xttce->xttc; 149 - 150 - xttcps_set_interval(timer, cycles); 151 - return 0; 152 - } 153 - 154 - /** 155 - * xttcps_set_mode - Sets the mode of timer 156 - * 157 - * @mode: Mode to be set 158 - * @evt: Address of clock event instance 159 - **/ 160 - static void xttcps_set_mode(enum clock_event_mode mode, 161 - struct clock_event_device *evt) 162 - { 163 - struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt); 164 - struct xttcps_timer *timer = &xttce->xttc; 165 - u32 ctrl_reg; 166 - 167 - switch (mode) { 168 - case CLOCK_EVT_MODE_PERIODIC: 169 - xttcps_set_interval(timer, 170 - DIV_ROUND_CLOSEST(clk_get_rate(xttce->clk), 171 - PRESCALE * HZ)); 172 - break; 173 - case CLOCK_EVT_MODE_ONESHOT: 174 - case CLOCK_EVT_MODE_UNUSED: 175 - case CLOCK_EVT_MODE_SHUTDOWN: 176 - ctrl_reg = __raw_readl(timer->base_addr + 177 - XTTCPS_CNT_CNTRL_OFFSET); 178 - ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK; 179 - __raw_writel(ctrl_reg, 180 - timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); 181 - break; 182 - case CLOCK_EVT_MODE_RESUME: 183 - ctrl_reg = __raw_readl(timer->base_addr + 184 - XTTCPS_CNT_CNTRL_OFFSET); 185 - ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK; 186 - __raw_writel(ctrl_reg, 187 - timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); 188 - break; 189 - } 190 - } 191 - 192 - static void __init zynq_ttc_setup_clocksource(struct device_node *np, 193 - void __iomem *base) 194 - { 195 - struct xttcps_timer_clocksource *ttccs; 196 - struct clk *clk; 197 - int err; 198 - u32 reg; 199 - 200 - ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL); 201 - if (WARN_ON(!ttccs)) 202 - return; 203 - 204 - err = of_property_read_u32(np, "reg", &reg); 205 - if (WARN_ON(err)) 206 - return; 207 - 208 - clk = of_clk_get_by_name(np, "cpu_1x"); 209 - if (WARN_ON(IS_ERR(clk))) 210 - return; 211 - 212 - err = clk_prepare_enable(clk); 213 - if (WARN_ON(err)) 214 - return; 215 - 216 - ttccs->xttc.base_addr = base + reg * 4; 217 - 218 - ttccs->cs.name = np->name; 219 - ttccs->cs.rating = 200; 220 - ttccs->cs.read = __xttc_clocksource_read; 221 - ttccs->cs.mask = CLOCKSOURCE_MASK(16); 222 - ttccs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS; 223 - 224 - __raw_writel(0x0, ttccs->xttc.base_addr + XTTCPS_IER_OFFSET); 225 - __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, 226 - ttccs->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET); 227 - __raw_writel(CNT_CNTRL_RESET, 228 - ttccs->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET); 229 - 230 - err = clocksource_register_hz(&ttccs->cs, clk_get_rate(clk) / PRESCALE); 231 - if (WARN_ON(err)) 232 - return; 233 - } 234 - 235 - static void __init zynq_ttc_setup_clockevent(struct device_node *np, 236 - void __iomem *base) 237 - { 238 - struct xttcps_timer_clockevent *ttcce; 239 - int err, irq; 240 - u32 reg; 241 - 242 - ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL); 243 - if (WARN_ON(!ttcce)) 244 - return; 245 - 246 - err = of_property_read_u32(np, "reg", &reg); 247 - if (WARN_ON(err)) 248 - return; 249 - 250 - ttcce->xttc.base_addr = base + reg * 4; 251 - 252 - ttcce->clk = of_clk_get_by_name(np, "cpu_1x"); 253 - if (WARN_ON(IS_ERR(ttcce->clk))) 254 - return; 255 - 256 - err = clk_prepare_enable(ttcce->clk); 257 - if (WARN_ON(err)) 258 - return; 259 - 260 - irq = irq_of_parse_and_map(np, 0); 261 - if (WARN_ON(!irq)) 262 - return; 263 - 264 - ttcce->ce.name = np->name; 265 - ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; 266 - ttcce->ce.set_next_event = xttcps_set_next_event; 267 - ttcce->ce.set_mode = xttcps_set_mode; 268 - ttcce->ce.rating = 200; 269 - ttcce->ce.irq = irq; 270 - ttcce->ce.cpumask = cpu_possible_mask; 271 - 272 - __raw_writel(0x23, ttcce->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET); 273 - __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, 274 - ttcce->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET); 275 - __raw_writel(0x1, ttcce->xttc.base_addr + XTTCPS_IER_OFFSET); 276 - 277 - err = request_irq(irq, xttcps_clock_event_interrupt, IRQF_TIMER, 278 - np->name, ttcce); 279 - if (WARN_ON(err)) 280 - return; 281 - 282 - clockevents_config_and_register(&ttcce->ce, 283 - clk_get_rate(ttcce->clk) / PRESCALE, 284 - 1, 0xfffe); 285 - } 286 - 287 - static const __initconst struct of_device_id zynq_ttc_match[] = { 288 - { .compatible = "xlnx,ttc-counter-clocksource", 289 - .data = zynq_ttc_setup_clocksource, }, 290 - { .compatible = "xlnx,ttc-counter-clockevent", 291 - .data = zynq_ttc_setup_clockevent, }, 292 - {} 293 - }; 294 - 295 - /** 296 - * xttcps_timer_init - Initialize the timer 297 - * 298 - * Initializes the timer hardware and register the clock source and clock event 299 - * timers with Linux kernal timer framework 300 - **/ 301 - void __init xttcps_timer_init(void) 302 - { 303 - struct device_node *np; 304 - 305 - for_each_compatible_node(np, NULL, "xlnx,ttc") { 306 - struct device_node *np_chld; 307 - void __iomem *base; 308 - 309 - base = of_iomap(np, 0); 310 - if (WARN_ON(!base)) 311 - return; 312 - 313 - for_each_available_child_of_node(np, np_chld) { 314 - int (*cb)(struct device_node *np, void __iomem *base); 315 - const struct of_device_id *match; 316 - 317 - match = of_match_node(zynq_ttc_match, np_chld); 318 - if (match) { 319 - cb = match->data; 320 - cb(np_chld, base); 321 - } 322 - } 323 - } 324 - }
+3 -3
arch/arm/plat-samsung/Kconfig
··· 25 25 select PLAT_SAMSUNG 26 26 select S3C_GPIO_TRACK 27 27 select S5P_GPIO_DRVSTR 28 - select SAMSUNG_CLKSRC 28 + select SAMSUNG_CLKSRC if !COMMON_CLK 29 29 select SAMSUNG_GPIOLIB_4BIT 30 30 select SAMSUNG_IRQ_VIC_TIMER 31 31 help ··· 62 62 63 63 # timer options 64 64 65 - config S5P_HRT 65 + config SAMSUNG_HRT 66 66 bool 67 67 select SAMSUNG_DEV_PWM 68 68 help ··· 81 81 used by newer systems such as the S3C64XX. 82 82 83 83 config S5P_CLOCK 84 - def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS) 84 + def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210) 85 85 help 86 86 Support common clock part for ARCH_S5P and ARCH_EXYNOS SoCs 87 87
+1 -2
arch/arm/plat-samsung/Makefile
··· 12 12 # Objects we always build independent of SoC choice 13 13 14 14 obj-y += init.o cpu.o 15 - obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET) += time.o 16 - obj-$(CONFIG_S5P_HRT) += s5p-time.o 15 + obj-$(CONFIG_SAMSUNG_HRT) += samsung-time.o 17 16 18 17 obj-$(CONFIG_SAMSUNG_CLOCK) += clock.o 19 18 obj-$(CONFIG_SAMSUNG_CLOCK) += pwm-clock.o
+1 -1
arch/arm/plat-samsung/devs.c
··· 1074 1074 1075 1075 /* PMU */ 1076 1076 1077 - #ifdef CONFIG_PLAT_S5P 1077 + #if defined(CONFIG_PLAT_S5P) && !defined(CONFIG_ARCH_EXYNOS) 1078 1078 static struct resource s5p_pmu_resource[] = { 1079 1079 DEFINE_RES_IRQ(IRQ_PMU) 1080 1080 };
+10 -5
arch/arm/plat-samsung/include/plat/cpu.h
··· 23 23 #define S3C24XX_CPU_ID 0x32400000 24 24 #define S3C24XX_CPU_MASK 0xFFF00000 25 25 26 + #define S3C2412_CPU_ID 0x32412000 27 + #define S3C2412_CPU_MASK 0xFFFFF000 28 + 26 29 #define S3C6400_CPU_ID 0x36400000 27 30 #define S3C6410_CPU_ID 0x36410000 28 31 #define S3C64XX_CPU_MASK 0xFFFFF000 ··· 56 53 } 57 54 58 55 IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) 56 + IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK) 59 57 IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) 60 58 IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) 61 59 IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) ··· 76 72 # define soc_is_s3c24xx() is_samsung_s3c24xx() 77 73 #else 78 74 # define soc_is_s3c24xx() 0 75 + #endif 76 + 77 + #if defined(CONFIG_CPU_S3C2412) 78 + # define soc_is_s3c2412() is_samsung_s3c2412() 79 + #else 80 + # define soc_is_s3c2412() 0 79 81 #endif 80 82 81 83 #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) ··· 183 173 184 174 /* core initialisation functions */ 185 175 186 - extern void s3c24xx_init_irq(void); 187 176 extern void s5p_init_irq(u32 *vic, u32 num_vic); 188 177 189 178 extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); ··· 200 191 extern void s3c24xx_init_uartdevs(char *name, 201 192 struct s3c24xx_uart_resources *res, 202 193 struct s3c2410_uartcfg *cfg, int no); 203 - 204 - /* timer for 2410/2440 */ 205 - 206 - extern void s3c24xx_timer_init(void); 207 194 208 195 extern struct syscore_ops s3c2410_pm_syscore_ops; 209 196 extern struct syscore_ops s3c2412_pm_syscore_ops;
-40
arch/arm/plat-samsung/include/plat/s5p-time.h
··· 1 - /* linux/arch/arm/plat-samsung/include/plat/s5p-time.h 2 - * 3 - * Copyright 2011 Samsung Electronics Co., Ltd. 4 - * http://www.samsung.com/ 5 - * 6 - * Header file for s5p time support 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - */ 12 - 13 - #ifndef __ASM_PLAT_S5P_TIME_H 14 - #define __ASM_PLAT_S5P_TIME_H __FILE__ 15 - 16 - /* S5P HR-Timer Clock mode */ 17 - enum s5p_timer_mode { 18 - S5P_PWM0, 19 - S5P_PWM1, 20 - S5P_PWM2, 21 - S5P_PWM3, 22 - S5P_PWM4, 23 - }; 24 - 25 - struct s5p_timer_source { 26 - unsigned int event_id; 27 - unsigned int source_id; 28 - }; 29 - 30 - /* Be able to sleep for atleast 4 seconds (usually more) */ 31 - #define S5PTIMER_MIN_RANGE 4 32 - 33 - #define TCNT_MAX 0xffffffff 34 - #define NON_PERIODIC 0 35 - #define PERIODIC 1 36 - 37 - extern void __init s5p_set_timer_source(enum s5p_timer_mode event, 38 - enum s5p_timer_mode source); 39 - extern void s5p_timer_init(void); 40 - #endif /* __ASM_PLAT_S5P_TIME_H */
+53
arch/arm/plat-samsung/include/plat/samsung-time.h
··· 1 + /* linux/arch/arm/plat-samsung/include/plat/samsung-time.h 2 + * 3 + * Copyright 2011 Samsung Electronics Co., Ltd. 4 + * http://www.samsung.com/ 5 + * 6 + * Header file for samsung s3c and s5p time support 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License version 2 as 10 + * published by the Free Software Foundation. 11 + */ 12 + 13 + #ifndef __ASM_PLAT_SAMSUNG_TIME_H 14 + #define __ASM_PLAT_SAMSUNG_TIME_H __FILE__ 15 + 16 + /* SAMSUNG HR-Timer Clock mode */ 17 + enum samsung_timer_mode { 18 + SAMSUNG_PWM0, 19 + SAMSUNG_PWM1, 20 + SAMSUNG_PWM2, 21 + SAMSUNG_PWM3, 22 + SAMSUNG_PWM4, 23 + }; 24 + 25 + struct samsung_timer_source { 26 + unsigned int event_id; 27 + unsigned int source_id; 28 + }; 29 + 30 + /* Be able to sleep for atleast 4 seconds (usually more) */ 31 + #define SAMSUNG_TIMER_MIN_RANGE 4 32 + 33 + #if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S5PC100) 34 + #define TCNT_MAX 0xffff 35 + #define TSCALER_DIV 25 36 + #define TDIV 50 37 + #define TSIZE 16 38 + #else 39 + #define TCNT_MAX 0xffffffff 40 + #define TSCALER_DIV 2 41 + #define TDIV 2 42 + #define TSIZE 32 43 + #endif 44 + 45 + #define NON_PERIODIC 0 46 + #define PERIODIC 1 47 + 48 + extern void __init samsung_set_timer_source(enum samsung_timer_mode event, 49 + enum samsung_timer_mode source); 50 + 51 + extern void __init samsung_timer_init(void); 52 + 53 + #endif /* __ASM_PLAT_SAMSUNG_TIME_H */
+69 -69
arch/arm/plat-samsung/s5p-time.c arch/arm/plat-samsung/samsung-time.c
··· 2 2 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 3 3 * http://www.samsung.com/ 4 4 * 5 - * S5P - Common hr-timer support 5 + * samsung - Common hr-timer support (s3c and s5p) 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License version 2 as ··· 25 25 #include <mach/map.h> 26 26 #include <plat/devs.h> 27 27 #include <plat/regs-timer.h> 28 - #include <plat/s5p-time.h> 28 + #include <plat/samsung-time.h> 29 29 30 30 static struct clk *tin_event; 31 31 static struct clk *tin_source; 32 32 static struct clk *tdiv_event; 33 33 static struct clk *tdiv_source; 34 34 static struct clk *timerclk; 35 - static struct s5p_timer_source timer_source; 35 + static struct samsung_timer_source timer_source; 36 36 static unsigned long clock_count_per_tick; 37 - static void s5p_timer_resume(void); 37 + static void samsung_timer_resume(void); 38 38 39 - static void s5p_time_stop(enum s5p_timer_mode mode) 39 + static void samsung_time_stop(enum samsung_timer_mode mode) 40 40 { 41 41 unsigned long tcon; 42 42 43 43 tcon = __raw_readl(S3C2410_TCON); 44 44 45 45 switch (mode) { 46 - case S5P_PWM0: 46 + case SAMSUNG_PWM0: 47 47 tcon &= ~S3C2410_TCON_T0START; 48 48 break; 49 49 50 - case S5P_PWM1: 50 + case SAMSUNG_PWM1: 51 51 tcon &= ~S3C2410_TCON_T1START; 52 52 break; 53 53 54 - case S5P_PWM2: 54 + case SAMSUNG_PWM2: 55 55 tcon &= ~S3C2410_TCON_T2START; 56 56 break; 57 57 58 - case S5P_PWM3: 58 + case SAMSUNG_PWM3: 59 59 tcon &= ~S3C2410_TCON_T3START; 60 60 break; 61 61 62 - case S5P_PWM4: 62 + case SAMSUNG_PWM4: 63 63 tcon &= ~S3C2410_TCON_T4START; 64 64 break; 65 65 ··· 70 70 __raw_writel(tcon, S3C2410_TCON); 71 71 } 72 72 73 - static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt) 73 + static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long tcnt) 74 74 { 75 75 unsigned long tcon; 76 76 ··· 79 79 tcnt--; 80 80 81 81 switch (mode) { 82 - case S5P_PWM0: 82 + case SAMSUNG_PWM0: 83 83 tcon &= ~(0x0f << 0); 84 84 tcon |= S3C2410_TCON_T0MANUALUPD; 85 85 break; 86 86 87 - case S5P_PWM1: 87 + case SAMSUNG_PWM1: 88 88 tcon &= ~(0x0f << 8); 89 89 tcon |= S3C2410_TCON_T1MANUALUPD; 90 90 break; 91 91 92 - case S5P_PWM2: 92 + case SAMSUNG_PWM2: 93 93 tcon &= ~(0x0f << 12); 94 94 tcon |= S3C2410_TCON_T2MANUALUPD; 95 95 break; 96 96 97 - case S5P_PWM3: 97 + case SAMSUNG_PWM3: 98 98 tcon &= ~(0x0f << 16); 99 99 tcon |= S3C2410_TCON_T3MANUALUPD; 100 100 break; 101 101 102 - case S5P_PWM4: 102 + case SAMSUNG_PWM4: 103 103 tcon &= ~(0x07 << 20); 104 104 tcon |= S3C2410_TCON_T4MANUALUPD; 105 105 break; ··· 114 114 __raw_writel(tcon, S3C2410_TCON); 115 115 } 116 116 117 - static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) 117 + static void samsung_time_start(enum samsung_timer_mode mode, bool periodic) 118 118 { 119 119 unsigned long tcon; 120 120 121 121 tcon = __raw_readl(S3C2410_TCON); 122 122 123 123 switch (mode) { 124 - case S5P_PWM0: 124 + case SAMSUNG_PWM0: 125 125 tcon |= S3C2410_TCON_T0START; 126 126 tcon &= ~S3C2410_TCON_T0MANUALUPD; 127 127 ··· 131 131 tcon &= ~S3C2410_TCON_T0RELOAD; 132 132 break; 133 133 134 - case S5P_PWM1: 134 + case SAMSUNG_PWM1: 135 135 tcon |= S3C2410_TCON_T1START; 136 136 tcon &= ~S3C2410_TCON_T1MANUALUPD; 137 137 ··· 141 141 tcon &= ~S3C2410_TCON_T1RELOAD; 142 142 break; 143 143 144 - case S5P_PWM2: 144 + case SAMSUNG_PWM2: 145 145 tcon |= S3C2410_TCON_T2START; 146 146 tcon &= ~S3C2410_TCON_T2MANUALUPD; 147 147 ··· 151 151 tcon &= ~S3C2410_TCON_T2RELOAD; 152 152 break; 153 153 154 - case S5P_PWM3: 154 + case SAMSUNG_PWM3: 155 155 tcon |= S3C2410_TCON_T3START; 156 156 tcon &= ~S3C2410_TCON_T3MANUALUPD; 157 157 ··· 161 161 tcon &= ~S3C2410_TCON_T3RELOAD; 162 162 break; 163 163 164 - case S5P_PWM4: 164 + case SAMSUNG_PWM4: 165 165 tcon |= S3C2410_TCON_T4START; 166 166 tcon &= ~S3C2410_TCON_T4MANUALUPD; 167 167 ··· 178 178 __raw_writel(tcon, S3C2410_TCON); 179 179 } 180 180 181 - static int s5p_set_next_event(unsigned long cycles, 181 + static int samsung_set_next_event(unsigned long cycles, 182 182 struct clock_event_device *evt) 183 183 { 184 - s5p_time_setup(timer_source.event_id, cycles); 185 - s5p_time_start(timer_source.event_id, NON_PERIODIC); 184 + samsung_time_setup(timer_source.event_id, cycles); 185 + samsung_time_start(timer_source.event_id, NON_PERIODIC); 186 186 187 187 return 0; 188 188 } 189 189 190 - static void s5p_set_mode(enum clock_event_mode mode, 190 + static void samsung_set_mode(enum clock_event_mode mode, 191 191 struct clock_event_device *evt) 192 192 { 193 - s5p_time_stop(timer_source.event_id); 193 + samsung_time_stop(timer_source.event_id); 194 194 195 195 switch (mode) { 196 196 case CLOCK_EVT_MODE_PERIODIC: 197 - s5p_time_setup(timer_source.event_id, clock_count_per_tick); 198 - s5p_time_start(timer_source.event_id, PERIODIC); 197 + samsung_time_setup(timer_source.event_id, clock_count_per_tick); 198 + samsung_time_start(timer_source.event_id, PERIODIC); 199 199 break; 200 200 201 201 case CLOCK_EVT_MODE_ONESHOT: ··· 206 206 break; 207 207 208 208 case CLOCK_EVT_MODE_RESUME: 209 - s5p_timer_resume(); 209 + samsung_timer_resume(); 210 210 break; 211 211 } 212 212 } 213 213 214 - static void s5p_timer_resume(void) 214 + static void samsung_timer_resume(void) 215 215 { 216 216 /* event timer restart */ 217 - s5p_time_setup(timer_source.event_id, clock_count_per_tick); 218 - s5p_time_start(timer_source.event_id, PERIODIC); 217 + samsung_time_setup(timer_source.event_id, clock_count_per_tick); 218 + samsung_time_start(timer_source.event_id, PERIODIC); 219 219 220 220 /* source timer restart */ 221 - s5p_time_setup(timer_source.source_id, TCNT_MAX); 222 - s5p_time_start(timer_source.source_id, PERIODIC); 221 + samsung_time_setup(timer_source.source_id, TCNT_MAX); 222 + samsung_time_start(timer_source.source_id, PERIODIC); 223 223 } 224 224 225 - void __init s5p_set_timer_source(enum s5p_timer_mode event, 226 - enum s5p_timer_mode source) 225 + void __init samsung_set_timer_source(enum samsung_timer_mode event, 226 + enum samsung_timer_mode source) 227 227 { 228 228 s3c_device_timer[event].dev.bus = &platform_bus_type; 229 229 s3c_device_timer[source].dev.bus = &platform_bus_type; ··· 233 233 } 234 234 235 235 static struct clock_event_device time_event_device = { 236 - .name = "s5p_event_timer", 236 + .name = "samsung_event_timer", 237 237 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 238 238 .rating = 200, 239 - .set_next_event = s5p_set_next_event, 240 - .set_mode = s5p_set_mode, 239 + .set_next_event = samsung_set_next_event, 240 + .set_mode = samsung_set_mode, 241 241 }; 242 242 243 - static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id) 243 + static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id) 244 244 { 245 245 struct clock_event_device *evt = dev_id; 246 246 ··· 249 249 return IRQ_HANDLED; 250 250 } 251 251 252 - static struct irqaction s5p_clock_event_irq = { 253 - .name = "s5p_time_irq", 252 + static struct irqaction samsung_clock_event_irq = { 253 + .name = "samsung_time_irq", 254 254 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 255 - .handler = s5p_clock_event_isr, 255 + .handler = samsung_clock_event_isr, 256 256 .dev_id = &time_event_device, 257 257 }; 258 258 259 - static void __init s5p_clockevent_init(void) 259 + static void __init samsung_clockevent_init(void) 260 260 { 261 261 unsigned long pclk; 262 262 unsigned long clock_rate; ··· 267 267 268 268 tscaler = clk_get_parent(tdiv_event); 269 269 270 - clk_set_rate(tscaler, pclk / 2); 271 - clk_set_rate(tdiv_event, pclk / 2); 270 + clk_set_rate(tscaler, pclk / TSCALER_DIV); 271 + clk_set_rate(tdiv_event, pclk / TDIV); 272 272 clk_set_parent(tin_event, tdiv_event); 273 273 274 274 clock_rate = clk_get_rate(tin_event); ··· 278 278 clockevents_config_and_register(&time_event_device, clock_rate, 1, -1); 279 279 280 280 irq_number = timer_source.event_id + IRQ_TIMER0; 281 - setup_irq(irq_number, &s5p_clock_event_irq); 281 + setup_irq(irq_number, &samsung_clock_event_irq); 282 282 } 283 283 284 - static void __iomem *s5p_timer_reg(void) 284 + static void __iomem *samsung_timer_reg(void) 285 285 { 286 286 unsigned long offset = 0; 287 287 288 288 switch (timer_source.source_id) { 289 - case S5P_PWM0: 290 - case S5P_PWM1: 291 - case S5P_PWM2: 292 - case S5P_PWM3: 289 + case SAMSUNG_PWM0: 290 + case SAMSUNG_PWM1: 291 + case SAMSUNG_PWM2: 292 + case SAMSUNG_PWM3: 293 293 offset = (timer_source.source_id * 0x0c) + 0x14; 294 294 break; 295 295 296 - case S5P_PWM4: 296 + case SAMSUNG_PWM4: 297 297 offset = 0x40; 298 298 break; 299 299 ··· 312 312 * this wraps around for now, since it is just a relative time 313 313 * stamp. (Inspired by U300 implementation.) 314 314 */ 315 - static u32 notrace s5p_read_sched_clock(void) 315 + static u32 notrace samsung_read_sched_clock(void) 316 316 { 317 - void __iomem *reg = s5p_timer_reg(); 317 + void __iomem *reg = samsung_timer_reg(); 318 318 319 319 if (!reg) 320 320 return 0; ··· 322 322 return ~__raw_readl(reg); 323 323 } 324 324 325 - static void __init s5p_clocksource_init(void) 325 + static void __init samsung_clocksource_init(void) 326 326 { 327 327 unsigned long pclk; 328 328 unsigned long clock_rate; 329 329 330 330 pclk = clk_get_rate(timerclk); 331 331 332 - clk_set_rate(tdiv_source, pclk / 2); 332 + clk_set_rate(tdiv_source, pclk / TDIV); 333 333 clk_set_parent(tin_source, tdiv_source); 334 334 335 335 clock_rate = clk_get_rate(tin_source); 336 336 337 - s5p_time_setup(timer_source.source_id, TCNT_MAX); 338 - s5p_time_start(timer_source.source_id, PERIODIC); 337 + samsung_time_setup(timer_source.source_id, TCNT_MAX); 338 + samsung_time_start(timer_source.source_id, PERIODIC); 339 339 340 - setup_sched_clock(s5p_read_sched_clock, 32, clock_rate); 340 + setup_sched_clock(samsung_read_sched_clock, TSIZE, clock_rate); 341 341 342 - if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer", 343 - clock_rate, 250, 32, clocksource_mmio_readl_down)) 344 - panic("s5p_clocksource_timer: can't register clocksource\n"); 342 + if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer", 343 + clock_rate, 250, TSIZE, clocksource_mmio_readl_down)) 344 + panic("samsung_clocksource_timer: can't register clocksource\n"); 345 345 } 346 346 347 - static void __init s5p_timer_resources(void) 347 + static void __init samsung_timer_resources(void) 348 348 { 349 349 350 350 unsigned long event_id = timer_source.event_id; ··· 386 386 clk_enable(tin_source); 387 387 } 388 388 389 - void __init s5p_timer_init(void) 389 + void __init samsung_timer_init(void) 390 390 { 391 - s5p_timer_resources(); 392 - s5p_clockevent_init(); 393 - s5p_clocksource_init(); 391 + samsung_timer_resources(); 392 + samsung_clockevent_init(); 393 + samsung_clocksource_init(); 394 394 }
-287
arch/arm/plat-samsung/time.c
··· 1 - /* linux/arch/arm/plat-samsung/time.c 2 - * 3 - * Copyright (C) 2003-2005 Simtec Electronics 4 - * Ben Dooks, <ben@simtec.co.uk> 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 - */ 20 - 21 - #include <linux/kernel.h> 22 - #include <linux/sched.h> 23 - #include <linux/init.h> 24 - #include <linux/interrupt.h> 25 - #include <linux/irq.h> 26 - #include <linux/err.h> 27 - #include <linux/clk.h> 28 - #include <linux/io.h> 29 - #include <linux/platform_device.h> 30 - #include <linux/syscore_ops.h> 31 - 32 - #include <asm/mach-types.h> 33 - 34 - #include <asm/irq.h> 35 - #include <mach/map.h> 36 - #include <plat/regs-timer.h> 37 - #include <mach/regs-irq.h> 38 - #include <asm/mach/time.h> 39 - #include <mach/tick.h> 40 - 41 - #include <plat/clock.h> 42 - #include <plat/cpu.h> 43 - 44 - static unsigned long timer_startval; 45 - static unsigned long timer_usec_ticks; 46 - 47 - #ifndef TICK_MAX 48 - #define TICK_MAX (0xffff) 49 - #endif 50 - 51 - #define TIMER_USEC_SHIFT 16 52 - 53 - /* we use the shifted arithmetic to work out the ratio of timer ticks 54 - * to usecs, as often the peripheral clock is not a nice even multiple 55 - * of 1MHz. 56 - * 57 - * shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok 58 - * for the current HZ value of 200 without producing overflows. 59 - * 60 - * Original patch by Dimitry Andric, updated by Ben Dooks 61 - */ 62 - 63 - 64 - /* timer_mask_usec_ticks 65 - * 66 - * given a clock and divisor, make the value to pass into timer_ticks_to_usec 67 - * to scale the ticks into usecs 68 - */ 69 - 70 - static inline unsigned long 71 - timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk) 72 - { 73 - unsigned long den = pclk / 1000; 74 - 75 - return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den; 76 - } 77 - 78 - /* timer_ticks_to_usec 79 - * 80 - * convert timer ticks to usec. 81 - */ 82 - 83 - static inline unsigned long timer_ticks_to_usec(unsigned long ticks) 84 - { 85 - unsigned long res; 86 - 87 - res = ticks * timer_usec_ticks; 88 - res += 1 << (TIMER_USEC_SHIFT - 4); /* round up slightly */ 89 - 90 - return res >> TIMER_USEC_SHIFT; 91 - } 92 - 93 - /*** 94 - * Returns microsecond since last clock interrupt. Note that interrupts 95 - * will have been disabled by do_gettimeoffset() 96 - * IRQs are disabled before entering here from do_gettimeofday() 97 - */ 98 - 99 - static u32 s3c2410_gettimeoffset(void) 100 - { 101 - unsigned long tdone; 102 - unsigned long tval; 103 - 104 - /* work out how many ticks have gone since last timer interrupt */ 105 - 106 - tval = __raw_readl(S3C2410_TCNTO(4)); 107 - tdone = timer_startval - tval; 108 - 109 - /* check to see if there is an interrupt pending */ 110 - 111 - if (s3c24xx_ostimer_pending()) { 112 - /* re-read the timer, and try and fix up for the missed 113 - * interrupt. Note, the interrupt may go off before the 114 - * timer has re-loaded from wrapping. 115 - */ 116 - 117 - tval = __raw_readl(S3C2410_TCNTO(4)); 118 - tdone = timer_startval - tval; 119 - 120 - if (tval != 0) 121 - tdone += timer_startval; 122 - } 123 - 124 - return timer_ticks_to_usec(tdone) * 1000; 125 - } 126 - 127 - 128 - /* 129 - * IRQ handler for the timer 130 - */ 131 - static irqreturn_t 132 - s3c2410_timer_interrupt(int irq, void *dev_id) 133 - { 134 - timer_tick(); 135 - return IRQ_HANDLED; 136 - } 137 - 138 - static struct irqaction s3c2410_timer_irq = { 139 - .name = "S3C2410 Timer Tick", 140 - .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 141 - .handler = s3c2410_timer_interrupt, 142 - }; 143 - 144 - #define use_tclk1_12() ( \ 145 - machine_is_bast() || \ 146 - machine_is_vr1000() || \ 147 - machine_is_anubis() || \ 148 - machine_is_osiris()) 149 - 150 - static struct clk *tin; 151 - static struct clk *tdiv; 152 - static struct clk *timerclk; 153 - 154 - /* 155 - * Set up timer interrupt, and return the current time in seconds. 156 - * 157 - * Currently we only use timer4, as it is the only timer which has no 158 - * other function that can be exploited externally 159 - */ 160 - static void s3c2410_timer_setup (void) 161 - { 162 - unsigned long tcon; 163 - unsigned long tcnt; 164 - unsigned long tcfg1; 165 - unsigned long tcfg0; 166 - 167 - tcnt = TICK_MAX; /* default value for tcnt */ 168 - 169 - /* configure the system for whichever machine is in use */ 170 - 171 - if (use_tclk1_12()) { 172 - /* timer is at 12MHz, scaler is 1 */ 173 - timer_usec_ticks = timer_mask_usec_ticks(1, 12000000); 174 - tcnt = 12000000 / HZ; 175 - 176 - tcfg1 = __raw_readl(S3C2410_TCFG1); 177 - tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK; 178 - tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1; 179 - __raw_writel(tcfg1, S3C2410_TCFG1); 180 - } else { 181 - unsigned long pclk; 182 - struct clk *tscaler; 183 - 184 - /* for the h1940 (and others), we use the pclk from the core 185 - * to generate the timer values. since values around 50 to 186 - * 70MHz are not values we can directly generate the timer 187 - * value from, we need to pre-scale and divide before using it. 188 - * 189 - * for instance, using 50.7MHz and dividing by 6 gives 8.45MHz 190 - * (8.45 ticks per usec) 191 - */ 192 - 193 - pclk = clk_get_rate(timerclk); 194 - 195 - /* configure clock tick */ 196 - 197 - timer_usec_ticks = timer_mask_usec_ticks(6, pclk); 198 - 199 - tscaler = clk_get_parent(tdiv); 200 - 201 - clk_set_rate(tscaler, pclk / 3); 202 - clk_set_rate(tdiv, pclk / 6); 203 - clk_set_parent(tin, tdiv); 204 - 205 - tcnt = clk_get_rate(tin) / HZ; 206 - } 207 - 208 - tcon = __raw_readl(S3C2410_TCON); 209 - tcfg0 = __raw_readl(S3C2410_TCFG0); 210 - tcfg1 = __raw_readl(S3C2410_TCFG1); 211 - 212 - /* timers reload after counting zero, so reduce the count by 1 */ 213 - 214 - tcnt--; 215 - 216 - printk(KERN_DEBUG "timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx, usec %08lx\n", 217 - tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks); 218 - 219 - /* check to see if timer is within 16bit range... */ 220 - if (tcnt > TICK_MAX) { 221 - panic("setup_timer: HZ is too small, cannot configure timer!"); 222 - return; 223 - } 224 - 225 - __raw_writel(tcfg1, S3C2410_TCFG1); 226 - __raw_writel(tcfg0, S3C2410_TCFG0); 227 - 228 - timer_startval = tcnt; 229 - __raw_writel(tcnt, S3C2410_TCNTB(4)); 230 - 231 - /* ensure timer is stopped... */ 232 - 233 - tcon &= ~(7<<20); 234 - tcon |= S3C2410_TCON_T4RELOAD; 235 - tcon |= S3C2410_TCON_T4MANUALUPD; 236 - 237 - __raw_writel(tcon, S3C2410_TCON); 238 - __raw_writel(tcnt, S3C2410_TCNTB(4)); 239 - __raw_writel(tcnt, S3C2410_TCMPB(4)); 240 - 241 - /* start the timer running */ 242 - tcon |= S3C2410_TCON_T4START; 243 - tcon &= ~S3C2410_TCON_T4MANUALUPD; 244 - __raw_writel(tcon, S3C2410_TCON); 245 - } 246 - 247 - static void __init s3c2410_timer_resources(void) 248 - { 249 - struct platform_device tmpdev; 250 - 251 - tmpdev.dev.bus = &platform_bus_type; 252 - tmpdev.id = 4; 253 - 254 - timerclk = clk_get(NULL, "timers"); 255 - if (IS_ERR(timerclk)) 256 - panic("failed to get clock for system timer"); 257 - 258 - clk_enable(timerclk); 259 - 260 - if (!use_tclk1_12()) { 261 - tmpdev.id = 4; 262 - tmpdev.dev.init_name = "s3c24xx-pwm.4"; 263 - tin = clk_get(&tmpdev.dev, "pwm-tin"); 264 - if (IS_ERR(tin)) 265 - panic("failed to get pwm-tin clock for system timer"); 266 - 267 - tdiv = clk_get(&tmpdev.dev, "pwm-tdiv"); 268 - if (IS_ERR(tdiv)) 269 - panic("failed to get pwm-tdiv clock for system timer"); 270 - } 271 - 272 - clk_enable(tin); 273 - } 274 - 275 - static struct syscore_ops s3c24xx_syscore_ops = { 276 - .resume = s3c2410_timer_setup, 277 - }; 278 - 279 - void __init s3c24xx_timer_init(void) 280 - { 281 - arch_gettimeoffset = s3c2410_gettimeoffset; 282 - 283 - s3c2410_timer_resources(); 284 - s3c2410_timer_setup(); 285 - setup_irq(IRQ_TIMER4, &s3c2410_timer_irq); 286 - register_syscore_ops(&s3c24xx_syscore_ops); 287 - }
+4 -2
arch/avr32/mach-at32ap/at32ap700x.c
··· 1453 1453 }, 1454 1454 }; 1455 1455 DEFINE_DEV_DATA(atmel_lcdfb, 0); 1456 - DEV_CLK(hck1, atmel_lcdfb0, hsb, 7); 1456 + DEV_CLK(hclk, atmel_lcdfb0, hsb, 7); 1457 1457 static struct clk atmel_lcdfb0_pixclk = { 1458 1458 .name = "lcdc_clk", 1459 1459 .dev = &atmel_lcdfb0_device.dev, ··· 1529 1529 info = pdev->dev.platform_data; 1530 1530 memcpy(info, data, sizeof(struct atmel_lcdfb_info)); 1531 1531 info->default_monspecs = monspecs; 1532 + 1533 + pdev->name = "at32ap-lcdfb"; 1532 1534 1533 1535 platform_device_register(pdev); 1534 1536 return pdev; ··· 2248 2246 &atmel_twi0_pclk, 2249 2247 &atmel_mci0_pclk, 2250 2248 #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) 2251 - &atmel_lcdfb0_hck1, 2249 + &atmel_lcdfb0_hclk, 2252 2250 &atmel_lcdfb0_pixclk, 2253 2251 #endif 2254 2252 &ssc0_pclk,
+2
drivers/Kconfig
··· 164 164 165 165 source "drivers/ipack/Kconfig" 166 166 167 + source "drivers/reset/Kconfig" 168 + 167 169 endmenu
+3
drivers/Makefile
··· 37 37 # regulators early, since some subsystems rely on them to initialize 38 38 obj-$(CONFIG_REGULATOR) += regulator/ 39 39 40 + # reset controllers early, since gpu drivers might rely on them to initialize 41 + obj-$(CONFIG_RESET_CONTROLLER) += reset/ 42 + 40 43 # tty/ comes before char/ so that the VT console is the boot-time 41 44 # default. 42 45 obj-y += tty/
+1
drivers/clk/Makefile
··· 29 29 obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o 30 30 obj-$(CONFIG_ARCH_ZYNQ) += clk-zynq.o 31 31 obj-$(CONFIG_ARCH_TEGRA) += tegra/ 32 + obj-$(CONFIG_PLAT_SAMSUNG) += samsung/ 32 33 33 34 obj-$(CONFIG_X86) += x86/ 34 35
+8
drivers/clk/samsung/Makefile
··· 1 + # 2 + # Samsung Clock specific Makefile 3 + # 4 + 5 + obj-$(CONFIG_COMMON_CLK) += clk.o clk-pll.o 6 + obj-$(CONFIG_ARCH_EXYNOS4) += clk-exynos4.o 7 + obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o 8 + obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o
+1091
drivers/clk/samsung/clk-exynos4.c
··· 1 + /* 2 + * Copyright (c) 2013 Samsung Electronics Co., Ltd. 3 + * Copyright (c) 2013 Linaro Ltd. 4 + * Author: Thomas Abraham <thomas.ab@samsung.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 version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + * Common Clock Framework support for all Exynos4 SoCs. 11 + */ 12 + 13 + #include <linux/clk.h> 14 + #include <linux/clkdev.h> 15 + #include <linux/clk-provider.h> 16 + #include <linux/of.h> 17 + #include <linux/of_address.h> 18 + 19 + #include <plat/cpu.h> 20 + #include "clk.h" 21 + #include "clk-pll.h" 22 + 23 + /* Exynos4 clock controller register offsets */ 24 + #define SRC_LEFTBUS 0x4200 25 + #define DIV_LEFTBUS 0x4500 26 + #define GATE_IP_LEFTBUS 0x4800 27 + #define E4X12_GATE_IP_IMAGE 0x4930 28 + #define SRC_RIGHTBUS 0x8200 29 + #define DIV_RIGHTBUS 0x8500 30 + #define GATE_IP_RIGHTBUS 0x8800 31 + #define E4X12_GATE_IP_PERIR 0x8960 32 + #define EPLL_LOCK 0xc010 33 + #define VPLL_LOCK 0xc020 34 + #define EPLL_CON0 0xc110 35 + #define EPLL_CON1 0xc114 36 + #define EPLL_CON2 0xc118 37 + #define VPLL_CON0 0xc120 38 + #define VPLL_CON1 0xc124 39 + #define VPLL_CON2 0xc128 40 + #define SRC_TOP0 0xc210 41 + #define SRC_TOP1 0xc214 42 + #define SRC_CAM 0xc220 43 + #define SRC_TV 0xc224 44 + #define SRC_MFC 0xcc28 45 + #define SRC_G3D 0xc22c 46 + #define E4210_SRC_IMAGE 0xc230 47 + #define SRC_LCD0 0xc234 48 + #define E4210_SRC_LCD1 0xc238 49 + #define E4X12_SRC_ISP 0xc238 50 + #define SRC_MAUDIO 0xc23c 51 + #define SRC_FSYS 0xc240 52 + #define SRC_PERIL0 0xc250 53 + #define SRC_PERIL1 0xc254 54 + #define E4X12_SRC_CAM1 0xc258 55 + #define SRC_MASK_TOP 0xc310 56 + #define SRC_MASK_CAM 0xc320 57 + #define SRC_MASK_TV 0xc324 58 + #define SRC_MASK_LCD0 0xc334 59 + #define E4210_SRC_MASK_LCD1 0xc338 60 + #define E4X12_SRC_MASK_ISP 0xc338 61 + #define SRC_MASK_MAUDIO 0xc33c 62 + #define SRC_MASK_FSYS 0xc340 63 + #define SRC_MASK_PERIL0 0xc350 64 + #define SRC_MASK_PERIL1 0xc354 65 + #define DIV_TOP 0xc510 66 + #define DIV_CAM 0xc520 67 + #define DIV_TV 0xc524 68 + #define DIV_MFC 0xc528 69 + #define DIV_G3D 0xc52c 70 + #define DIV_IMAGE 0xc530 71 + #define DIV_LCD0 0xc534 72 + #define E4210_DIV_LCD1 0xc538 73 + #define E4X12_DIV_ISP 0xc538 74 + #define DIV_MAUDIO 0xc53c 75 + #define DIV_FSYS0 0xc540 76 + #define DIV_FSYS1 0xc544 77 + #define DIV_FSYS2 0xc548 78 + #define DIV_FSYS3 0xc54c 79 + #define DIV_PERIL0 0xc550 80 + #define DIV_PERIL1 0xc554 81 + #define DIV_PERIL2 0xc558 82 + #define DIV_PERIL3 0xc55c 83 + #define DIV_PERIL4 0xc560 84 + #define DIV_PERIL5 0xc564 85 + #define E4X12_DIV_CAM1 0xc568 86 + #define GATE_SCLK_CAM 0xc820 87 + #define GATE_IP_CAM 0xc920 88 + #define GATE_IP_TV 0xc924 89 + #define GATE_IP_MFC 0xc928 90 + #define GATE_IP_G3D 0xc92c 91 + #define E4210_GATE_IP_IMAGE 0xc930 92 + #define GATE_IP_LCD0 0xc934 93 + #define E4210_GATE_IP_LCD1 0xc938 94 + #define E4X12_GATE_IP_ISP 0xc938 95 + #define E4X12_GATE_IP_MAUDIO 0xc93c 96 + #define GATE_IP_FSYS 0xc940 97 + #define GATE_IP_GPS 0xc94c 98 + #define GATE_IP_PERIL 0xc950 99 + #define E4210_GATE_IP_PERIR 0xc960 100 + #define GATE_BLOCK 0xc970 101 + #define E4X12_MPLL_CON0 0x10108 102 + #define SRC_DMC 0x10200 103 + #define SRC_MASK_DMC 0x10300 104 + #define DIV_DMC0 0x10500 105 + #define DIV_DMC1 0x10504 106 + #define GATE_IP_DMC 0x10900 107 + #define APLL_CON0 0x14100 108 + #define E4210_MPLL_CON0 0x14108 109 + #define SRC_CPU 0x14200 110 + #define DIV_CPU0 0x14500 111 + #define DIV_CPU1 0x14504 112 + #define GATE_SCLK_CPU 0x14800 113 + #define GATE_IP_CPU 0x14900 114 + #define E4X12_DIV_ISP0 0x18300 115 + #define E4X12_DIV_ISP1 0x18304 116 + #define E4X12_GATE_ISP0 0x18800 117 + #define E4X12_GATE_ISP1 0x18804 118 + 119 + /* the exynos4 soc type */ 120 + enum exynos4_soc { 121 + EXYNOS4210, 122 + EXYNOS4X12, 123 + }; 124 + 125 + /* 126 + * Let each supported clock get a unique id. This id is used to lookup the clock 127 + * for device tree based platforms. The clocks are categorized into three 128 + * sections: core, sclk gate and bus interface gate clocks. 129 + * 130 + * When adding a new clock to this list, it is advised to choose a clock 131 + * category and add it to the end of that category. That is because the the 132 + * device tree source file is referring to these ids and any change in the 133 + * sequence number of existing clocks will require corresponding change in the 134 + * device tree files. This limitation would go away when pre-processor support 135 + * for dtc would be available. 136 + */ 137 + enum exynos4_clks { 138 + none, 139 + 140 + /* core clocks */ 141 + xxti, xusbxti, fin_pll, fout_apll, fout_mpll, fout_epll, fout_vpll, 142 + sclk_apll, sclk_mpll, sclk_epll, sclk_vpll, arm_clk, aclk200, aclk100, 143 + aclk160, aclk133, mout_mpll_user_t, mout_mpll_user_c, mout_core, 144 + mout_apll, /* 20 */ 145 + 146 + /* gate for special clocks (sclk) */ 147 + sclk_fimc0 = 128, sclk_fimc1, sclk_fimc2, sclk_fimc3, sclk_cam0, 148 + sclk_cam1, sclk_csis0, sclk_csis1, sclk_hdmi, sclk_mixer, sclk_dac, 149 + sclk_pixel, sclk_fimd0, sclk_mdnie0, sclk_mdnie_pwm0, sclk_mipi0, 150 + sclk_audio0, sclk_mmc0, sclk_mmc1, sclk_mmc2, sclk_mmc3, sclk_mmc4, 151 + sclk_sata, sclk_uart0, sclk_uart1, sclk_uart2, sclk_uart3, sclk_uart4, 152 + sclk_audio1, sclk_audio2, sclk_spdif, sclk_spi0, sclk_spi1, sclk_spi2, 153 + sclk_slimbus, sclk_fimd1, sclk_mipi1, sclk_pcm1, sclk_pcm2, sclk_i2s1, 154 + sclk_i2s2, sclk_mipihsi, sclk_mfc, sclk_pcm0, sclk_g3d, sclk_pwm_isp, 155 + sclk_spi0_isp, sclk_spi1_isp, sclk_uart_isp, 156 + 157 + /* gate clocks */ 158 + fimc0 = 256, fimc1, fimc2, fimc3, csis0, csis1, jpeg, smmu_fimc0, 159 + smmu_fimc1, smmu_fimc2, smmu_fimc3, smmu_jpeg, vp, mixer, tvenc, hdmi, 160 + smmu_tv, mfc, smmu_mfcl, smmu_mfcr, g3d, g2d, rotator, mdma, smmu_g2d, 161 + smmu_rotator, smmu_mdma, fimd0, mie0, mdnie0, dsim0, smmu_fimd0, fimd1, 162 + mie1, dsim1, smmu_fimd1, pdma0, pdma1, pcie_phy, sata_phy, tsi, sdmmc0, 163 + sdmmc1, sdmmc2, sdmmc3, sdmmc4, sata, sromc, usb_host, usb_device, pcie, 164 + onenand, nfcon, smmu_pcie, gps, smmu_gps, uart0, uart1, uart2, uart3, 165 + uart4, i2c0, i2c1, i2c2, i2c3, i2c4, i2c5, i2c6, i2c7, i2c_hdmi, tsadc, 166 + spi0, spi1, spi2, i2s1, i2s2, pcm0, i2s0, pcm1, pcm2, pwm, slimbus, 167 + spdif, ac97, modemif, chipid, sysreg, hdmi_cec, mct, wdt, rtc, keyif, 168 + audss, mipi_hsi, mdma2, pixelasyncm0, pixelasyncm1, fimc_lite0, 169 + fimc_lite1, ppmuispx, ppmuispmx, fimc_isp, fimc_drc, fimc_fd, mcuisp, 170 + gicisp, smmu_isp, smmu_drc, smmu_fd, smmu_lite0, smmu_lite1, mcuctl_isp, 171 + mpwm_isp, i2c0_isp, i2c1_isp, mtcadc_isp, pwm_isp, wdt_isp, uart_isp, 172 + asyncaxim, smmu_ispcx, spi0_isp, spi1_isp, pwm_isp_sclk, spi0_isp_sclk, 173 + spi1_isp_sclk, uart_isp_sclk, 174 + 175 + /* mux clocks */ 176 + mout_fimc0 = 384, mout_fimc1, mout_fimc2, mout_fimc3, mout_cam0, 177 + mout_cam1, mout_csis0, mout_csis1, mout_g3d0, mout_g3d1, mout_g3d, 178 + aclk400_mcuisp, 179 + 180 + /* div clocks */ 181 + div_isp0 = 450, div_isp1, div_mcuisp0, div_mcuisp1, div_aclk200, 182 + div_aclk400_mcuisp, 183 + 184 + nr_clks, 185 + }; 186 + 187 + /* 188 + * list of controller registers to be saved and restored during a 189 + * suspend/resume cycle. 190 + */ 191 + static __initdata unsigned long exynos4210_clk_save[] = { 192 + E4210_SRC_IMAGE, 193 + E4210_SRC_LCD1, 194 + E4210_SRC_MASK_LCD1, 195 + E4210_DIV_LCD1, 196 + E4210_GATE_IP_IMAGE, 197 + E4210_GATE_IP_LCD1, 198 + E4210_GATE_IP_PERIR, 199 + E4210_MPLL_CON0, 200 + }; 201 + 202 + static __initdata unsigned long exynos4x12_clk_save[] = { 203 + E4X12_GATE_IP_IMAGE, 204 + E4X12_GATE_IP_PERIR, 205 + E4X12_SRC_CAM1, 206 + E4X12_DIV_ISP, 207 + E4X12_DIV_CAM1, 208 + E4X12_MPLL_CON0, 209 + }; 210 + 211 + static __initdata unsigned long exynos4_clk_regs[] = { 212 + SRC_LEFTBUS, 213 + DIV_LEFTBUS, 214 + GATE_IP_LEFTBUS, 215 + SRC_RIGHTBUS, 216 + DIV_RIGHTBUS, 217 + GATE_IP_RIGHTBUS, 218 + EPLL_CON0, 219 + EPLL_CON1, 220 + EPLL_CON2, 221 + VPLL_CON0, 222 + VPLL_CON1, 223 + VPLL_CON2, 224 + SRC_TOP0, 225 + SRC_TOP1, 226 + SRC_CAM, 227 + SRC_TV, 228 + SRC_MFC, 229 + SRC_G3D, 230 + SRC_LCD0, 231 + SRC_MAUDIO, 232 + SRC_FSYS, 233 + SRC_PERIL0, 234 + SRC_PERIL1, 235 + SRC_MASK_TOP, 236 + SRC_MASK_CAM, 237 + SRC_MASK_TV, 238 + SRC_MASK_LCD0, 239 + SRC_MASK_MAUDIO, 240 + SRC_MASK_FSYS, 241 + SRC_MASK_PERIL0, 242 + SRC_MASK_PERIL1, 243 + DIV_TOP, 244 + DIV_CAM, 245 + DIV_TV, 246 + DIV_MFC, 247 + DIV_G3D, 248 + DIV_IMAGE, 249 + DIV_LCD0, 250 + DIV_MAUDIO, 251 + DIV_FSYS0, 252 + DIV_FSYS1, 253 + DIV_FSYS2, 254 + DIV_FSYS3, 255 + DIV_PERIL0, 256 + DIV_PERIL1, 257 + DIV_PERIL2, 258 + DIV_PERIL3, 259 + DIV_PERIL4, 260 + DIV_PERIL5, 261 + GATE_SCLK_CAM, 262 + GATE_IP_CAM, 263 + GATE_IP_TV, 264 + GATE_IP_MFC, 265 + GATE_IP_G3D, 266 + GATE_IP_LCD0, 267 + GATE_IP_FSYS, 268 + GATE_IP_GPS, 269 + GATE_IP_PERIL, 270 + GATE_BLOCK, 271 + SRC_MASK_DMC, 272 + SRC_DMC, 273 + DIV_DMC0, 274 + DIV_DMC1, 275 + GATE_IP_DMC, 276 + APLL_CON0, 277 + SRC_CPU, 278 + DIV_CPU0, 279 + DIV_CPU1, 280 + GATE_SCLK_CPU, 281 + GATE_IP_CPU, 282 + }; 283 + 284 + /* list of all parent clock list */ 285 + PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; 286 + PNAME(mout_mpll_p) = { "fin_pll", "fout_mpll", }; 287 + PNAME(mout_epll_p) = { "fin_pll", "fout_epll", }; 288 + PNAME(mout_vpllsrc_p) = { "fin_pll", "sclk_hdmi24m", }; 289 + PNAME(mout_vpll_p) = { "fin_pll", "fout_vpll", }; 290 + PNAME(sclk_evpll_p) = { "sclk_epll", "sclk_vpll", }; 291 + PNAME(mout_mfc_p) = { "mout_mfc0", "mout_mfc1", }; 292 + PNAME(mout_g3d_p) = { "mout_g3d0", "mout_g3d1", }; 293 + PNAME(mout_g2d_p) = { "mout_g2d0", "mout_g2d1", }; 294 + PNAME(mout_hdmi_p) = { "sclk_pixel", "sclk_hdmiphy", }; 295 + PNAME(mout_jpeg_p) = { "mout_jpeg0", "mout_jpeg1", }; 296 + PNAME(mout_spdif_p) = { "sclk_audio0", "sclk_audio1", "sclk_audio2", 297 + "spdif_extclk", }; 298 + PNAME(mout_onenand_p) = {"aclk133", "aclk160", }; 299 + PNAME(mout_onenand1_p) = {"mout_onenand", "sclk_vpll", }; 300 + 301 + /* Exynos 4210-specific parent groups */ 302 + PNAME(sclk_vpll_p4210) = { "mout_vpllsrc", "fout_vpll", }; 303 + PNAME(mout_core_p4210) = { "mout_apll", "sclk_mpll", }; 304 + PNAME(sclk_ampll_p4210) = { "sclk_mpll", "sclk_apll", }; 305 + PNAME(group1_p4210) = { "xxti", "xusbxti", "sclk_hdmi24m", 306 + "sclk_usbphy0", "none", "sclk_hdmiphy", 307 + "sclk_mpll", "sclk_epll", "sclk_vpll", }; 308 + PNAME(mout_audio0_p4210) = { "cdclk0", "none", "sclk_hdmi24m", 309 + "sclk_usbphy0", "xxti", "xusbxti", "sclk_mpll", 310 + "sclk_epll", "sclk_vpll" }; 311 + PNAME(mout_audio1_p4210) = { "cdclk1", "none", "sclk_hdmi24m", 312 + "sclk_usbphy0", "xxti", "xusbxti", "sclk_mpll", 313 + "sclk_epll", "sclk_vpll", }; 314 + PNAME(mout_audio2_p4210) = { "cdclk2", "none", "sclk_hdmi24m", 315 + "sclk_usbphy0", "xxti", "xusbxti", "sclk_mpll", 316 + "sclk_epll", "sclk_vpll", }; 317 + PNAME(mout_mixer_p4210) = { "sclk_dac", "sclk_hdmi", }; 318 + PNAME(mout_dac_p4210) = { "sclk_vpll", "sclk_hdmiphy", }; 319 + 320 + /* Exynos 4x12-specific parent groups */ 321 + PNAME(mout_mpll_user_p4x12) = { "fin_pll", "sclk_mpll", }; 322 + PNAME(mout_core_p4x12) = { "mout_apll", "mout_mpll_user_c", }; 323 + PNAME(sclk_ampll_p4x12) = { "mout_mpll_user_t", "sclk_apll", }; 324 + PNAME(group1_p4x12) = { "xxti", "xusbxti", "sclk_hdmi24m", "sclk_usbphy0", 325 + "none", "sclk_hdmiphy", "mout_mpll_user_t", 326 + "sclk_epll", "sclk_vpll", }; 327 + PNAME(mout_audio0_p4x12) = { "cdclk0", "none", "sclk_hdmi24m", 328 + "sclk_usbphy0", "xxti", "xusbxti", 329 + "mout_mpll_user_t", "sclk_epll", "sclk_vpll" }; 330 + PNAME(mout_audio1_p4x12) = { "cdclk1", "none", "sclk_hdmi24m", 331 + "sclk_usbphy0", "xxti", "xusbxti", 332 + "mout_mpll_user_t", "sclk_epll", "sclk_vpll", }; 333 + PNAME(mout_audio2_p4x12) = { "cdclk2", "none", "sclk_hdmi24m", 334 + "sclk_usbphy0", "xxti", "xusbxti", 335 + "mout_mpll_user_t", "sclk_epll", "sclk_vpll", }; 336 + PNAME(aclk_p4412) = { "mout_mpll_user_t", "sclk_apll", }; 337 + PNAME(mout_user_aclk400_mcuisp_p4x12) = {"fin_pll", "div_aclk400_mcuisp", }; 338 + PNAME(mout_user_aclk200_p4x12) = {"fin_pll", "div_aclk200", }; 339 + PNAME(mout_user_aclk266_gps_p4x12) = {"fin_pll", "div_aclk266_gps", }; 340 + 341 + /* fixed rate clocks generated outside the soc */ 342 + struct samsung_fixed_rate_clock exynos4_fixed_rate_ext_clks[] __initdata = { 343 + FRATE(xxti, "xxti", NULL, CLK_IS_ROOT, 0), 344 + FRATE(xusbxti, "xusbxti", NULL, CLK_IS_ROOT, 0), 345 + }; 346 + 347 + /* fixed rate clocks generated inside the soc */ 348 + struct samsung_fixed_rate_clock exynos4_fixed_rate_clks[] __initdata = { 349 + FRATE(none, "sclk_hdmi24m", NULL, CLK_IS_ROOT, 24000000), 350 + FRATE(none, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 27000000), 351 + FRATE(none, "sclk_usbphy0", NULL, CLK_IS_ROOT, 48000000), 352 + }; 353 + 354 + struct samsung_fixed_rate_clock exynos4210_fixed_rate_clks[] __initdata = { 355 + FRATE(none, "sclk_usbphy1", NULL, CLK_IS_ROOT, 48000000), 356 + }; 357 + 358 + /* list of mux clocks supported in all exynos4 soc's */ 359 + struct samsung_mux_clock exynos4_mux_clks[] __initdata = { 360 + MUX_F(mout_apll, "mout_apll", mout_apll_p, SRC_CPU, 0, 1, 361 + CLK_SET_RATE_PARENT, 0), 362 + MUX(none, "mout_hdmi", mout_hdmi_p, SRC_TV, 0, 1), 363 + MUX(none, "mout_mfc1", sclk_evpll_p, SRC_MFC, 4, 1), 364 + MUX(none, "mout_mfc", mout_mfc_p, SRC_MFC, 8, 1), 365 + MUX_F(mout_g3d1, "mout_g3d1", sclk_evpll_p, SRC_G3D, 4, 1, 366 + CLK_SET_RATE_PARENT, 0), 367 + MUX_F(mout_g3d, "mout_g3d", mout_g3d_p, SRC_G3D, 8, 1, 368 + CLK_SET_RATE_PARENT, 0), 369 + MUX(none, "mout_spdif", mout_spdif_p, SRC_PERIL1, 8, 2), 370 + MUX(none, "mout_onenand1", mout_onenand1_p, SRC_TOP0, 0, 1), 371 + MUX_A(sclk_epll, "sclk_epll", mout_epll_p, SRC_TOP0, 4, 1, "sclk_epll"), 372 + MUX(none, "mout_onenand", mout_onenand_p, SRC_TOP0, 28, 1), 373 + }; 374 + 375 + /* list of mux clocks supported in exynos4210 soc */ 376 + struct samsung_mux_clock exynos4210_mux_clks[] __initdata = { 377 + MUX(none, "mout_aclk200", sclk_ampll_p4210, SRC_TOP0, 12, 1), 378 + MUX(none, "mout_aclk100", sclk_ampll_p4210, SRC_TOP0, 16, 1), 379 + MUX(none, "mout_aclk160", sclk_ampll_p4210, SRC_TOP0, 20, 1), 380 + MUX(none, "mout_aclk133", sclk_ampll_p4210, SRC_TOP0, 24, 1), 381 + MUX(none, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP1, 0, 1), 382 + MUX(none, "mout_mixer", mout_mixer_p4210, SRC_TV, 4, 1), 383 + MUX(none, "mout_dac", mout_dac_p4210, SRC_TV, 8, 1), 384 + MUX(none, "mout_g2d0", sclk_ampll_p4210, E4210_SRC_IMAGE, 0, 1), 385 + MUX(none, "mout_g2d1", sclk_evpll_p, E4210_SRC_IMAGE, 4, 1), 386 + MUX(none, "mout_g2d", mout_g2d_p, E4210_SRC_IMAGE, 8, 1), 387 + MUX(none, "mout_fimd1", group1_p4210, E4210_SRC_LCD1, 0, 4), 388 + MUX(none, "mout_mipi1", group1_p4210, E4210_SRC_LCD1, 12, 4), 389 + MUX_A(sclk_mpll, "sclk_mpll", mout_mpll_p, SRC_CPU, 8, 1, "sclk_mpll"), 390 + MUX_A(mout_core, "mout_core", mout_core_p4210, 391 + SRC_CPU, 16, 1, "mout_core"), 392 + MUX_A(sclk_vpll, "sclk_vpll", sclk_vpll_p4210, 393 + SRC_TOP0, 8, 1, "sclk_vpll"), 394 + MUX(mout_fimc0, "mout_fimc0", group1_p4210, SRC_CAM, 0, 4), 395 + MUX(mout_fimc1, "mout_fimc1", group1_p4210, SRC_CAM, 4, 4), 396 + MUX(mout_fimc2, "mout_fimc2", group1_p4210, SRC_CAM, 8, 4), 397 + MUX(mout_fimc3, "mout_fimc3", group1_p4210, SRC_CAM, 12, 4), 398 + MUX(mout_cam0, "mout_cam0", group1_p4210, SRC_CAM, 16, 4), 399 + MUX(mout_cam1, "mout_cam1", group1_p4210, SRC_CAM, 20, 4), 400 + MUX(mout_csis0, "mout_csis0", group1_p4210, SRC_CAM, 24, 4), 401 + MUX(mout_csis1, "mout_csis1", group1_p4210, SRC_CAM, 28, 4), 402 + MUX(none, "mout_mfc0", sclk_ampll_p4210, SRC_MFC, 0, 1), 403 + MUX_F(mout_g3d0, "mout_g3d0", sclk_ampll_p4210, SRC_G3D, 0, 1, 404 + CLK_SET_RATE_PARENT, 0), 405 + MUX(none, "mout_fimd0", group1_p4210, SRC_LCD0, 0, 4), 406 + MUX(none, "mout_mipi0", group1_p4210, SRC_LCD0, 12, 4), 407 + MUX(none, "mout_audio0", mout_audio0_p4210, SRC_MAUDIO, 0, 4), 408 + MUX(none, "mout_mmc0", group1_p4210, SRC_FSYS, 0, 4), 409 + MUX(none, "mout_mmc1", group1_p4210, SRC_FSYS, 4, 4), 410 + MUX(none, "mout_mmc2", group1_p4210, SRC_FSYS, 8, 4), 411 + MUX(none, "mout_mmc3", group1_p4210, SRC_FSYS, 12, 4), 412 + MUX(none, "mout_mmc4", group1_p4210, SRC_FSYS, 16, 4), 413 + MUX(none, "mout_sata", sclk_ampll_p4210, SRC_FSYS, 24, 1), 414 + MUX(none, "mout_uart0", group1_p4210, SRC_PERIL0, 0, 4), 415 + MUX(none, "mout_uart1", group1_p4210, SRC_PERIL0, 4, 4), 416 + MUX(none, "mout_uart2", group1_p4210, SRC_PERIL0, 8, 4), 417 + MUX(none, "mout_uart3", group1_p4210, SRC_PERIL0, 12, 4), 418 + MUX(none, "mout_uart4", group1_p4210, SRC_PERIL0, 16, 4), 419 + MUX(none, "mout_audio1", mout_audio1_p4210, SRC_PERIL1, 0, 4), 420 + MUX(none, "mout_audio2", mout_audio2_p4210, SRC_PERIL1, 4, 4), 421 + MUX(none, "mout_spi0", group1_p4210, SRC_PERIL1, 16, 4), 422 + MUX(none, "mout_spi1", group1_p4210, SRC_PERIL1, 20, 4), 423 + MUX(none, "mout_spi2", group1_p4210, SRC_PERIL1, 24, 4), 424 + }; 425 + 426 + /* list of mux clocks supported in exynos4x12 soc */ 427 + struct samsung_mux_clock exynos4x12_mux_clks[] __initdata = { 428 + MUX(mout_mpll_user_c, "mout_mpll_user_c", mout_mpll_user_p4x12, 429 + SRC_CPU, 24, 1), 430 + MUX(none, "mout_aclk266_gps", aclk_p4412, SRC_TOP1, 4, 1), 431 + MUX(none, "mout_aclk400_mcuisp", aclk_p4412, SRC_TOP1, 8, 1), 432 + MUX(mout_mpll_user_t, "mout_mpll_user_t", mout_mpll_user_p4x12, 433 + SRC_TOP1, 12, 1), 434 + MUX(none, "mout_user_aclk266_gps", mout_user_aclk266_gps_p4x12, 435 + SRC_TOP1, 16, 1), 436 + MUX(aclk200, "aclk200", mout_user_aclk200_p4x12, SRC_TOP1, 20, 1), 437 + MUX(aclk400_mcuisp, "aclk400_mcuisp", mout_user_aclk400_mcuisp_p4x12, 438 + SRC_TOP1, 24, 1), 439 + MUX(none, "mout_aclk200", aclk_p4412, SRC_TOP0, 12, 1), 440 + MUX(none, "mout_aclk100", aclk_p4412, SRC_TOP0, 16, 1), 441 + MUX(none, "mout_aclk160", aclk_p4412, SRC_TOP0, 20, 1), 442 + MUX(none, "mout_aclk133", aclk_p4412, SRC_TOP0, 24, 1), 443 + MUX(none, "mout_mdnie0", group1_p4x12, SRC_LCD0, 4, 4), 444 + MUX(none, "mout_mdnie_pwm0", group1_p4x12, SRC_LCD0, 8, 4), 445 + MUX(none, "mout_sata", sclk_ampll_p4x12, SRC_FSYS, 24, 1), 446 + MUX(none, "mout_jpeg0", sclk_ampll_p4x12, E4X12_SRC_CAM1, 0, 1), 447 + MUX(none, "mout_jpeg1", sclk_evpll_p, E4X12_SRC_CAM1, 4, 1), 448 + MUX(none, "mout_jpeg", mout_jpeg_p, E4X12_SRC_CAM1, 8, 1), 449 + MUX_A(sclk_mpll, "sclk_mpll", mout_mpll_p, 450 + SRC_DMC, 12, 1, "sclk_mpll"), 451 + MUX_A(sclk_vpll, "sclk_vpll", mout_vpll_p, 452 + SRC_TOP0, 8, 1, "sclk_vpll"), 453 + MUX(mout_core, "mout_core", mout_core_p4x12, SRC_CPU, 16, 1), 454 + MUX(mout_fimc0, "mout_fimc0", group1_p4x12, SRC_CAM, 0, 4), 455 + MUX(mout_fimc1, "mout_fimc1", group1_p4x12, SRC_CAM, 4, 4), 456 + MUX(mout_fimc2, "mout_fimc2", group1_p4x12, SRC_CAM, 8, 4), 457 + MUX(mout_fimc3, "mout_fimc3", group1_p4x12, SRC_CAM, 12, 4), 458 + MUX(mout_cam0, "mout_cam0", group1_p4x12, SRC_CAM, 16, 4), 459 + MUX(mout_cam1, "mout_cam1", group1_p4x12, SRC_CAM, 20, 4), 460 + MUX(mout_csis0, "mout_csis0", group1_p4x12, SRC_CAM, 24, 4), 461 + MUX(mout_csis1, "mout_csis1", group1_p4x12, SRC_CAM, 28, 4), 462 + MUX(none, "mout_mfc0", sclk_ampll_p4x12, SRC_MFC, 0, 1), 463 + MUX_F(mout_g3d0, "mout_g3d0", sclk_ampll_p4x12, SRC_G3D, 0, 1, 464 + CLK_SET_RATE_PARENT, 0), 465 + MUX(none, "mout_fimd0", group1_p4x12, SRC_LCD0, 0, 4), 466 + MUX(none, "mout_mipi0", group1_p4x12, SRC_LCD0, 12, 4), 467 + MUX(none, "mout_audio0", mout_audio0_p4x12, SRC_MAUDIO, 0, 4), 468 + MUX(none, "mout_mmc0", group1_p4x12, SRC_FSYS, 0, 4), 469 + MUX(none, "mout_mmc1", group1_p4x12, SRC_FSYS, 4, 4), 470 + MUX(none, "mout_mmc2", group1_p4x12, SRC_FSYS, 8, 4), 471 + MUX(none, "mout_mmc3", group1_p4x12, SRC_FSYS, 12, 4), 472 + MUX(none, "mout_mmc4", group1_p4x12, SRC_FSYS, 16, 4), 473 + MUX(none, "mout_mipihsi", aclk_p4412, SRC_FSYS, 24, 1), 474 + MUX(none, "mout_uart0", group1_p4x12, SRC_PERIL0, 0, 4), 475 + MUX(none, "mout_uart1", group1_p4x12, SRC_PERIL0, 4, 4), 476 + MUX(none, "mout_uart2", group1_p4x12, SRC_PERIL0, 8, 4), 477 + MUX(none, "mout_uart3", group1_p4x12, SRC_PERIL0, 12, 4), 478 + MUX(none, "mout_uart4", group1_p4x12, SRC_PERIL0, 16, 4), 479 + MUX(none, "mout_audio1", mout_audio1_p4x12, SRC_PERIL1, 0, 4), 480 + MUX(none, "mout_audio2", mout_audio2_p4x12, SRC_PERIL1, 4, 4), 481 + MUX(none, "mout_spi0", group1_p4x12, SRC_PERIL1, 16, 4), 482 + MUX(none, "mout_spi1", group1_p4x12, SRC_PERIL1, 20, 4), 483 + MUX(none, "mout_spi2", group1_p4x12, SRC_PERIL1, 24, 4), 484 + MUX(none, "mout_pwm_isp", group1_p4x12, E4X12_SRC_ISP, 0, 4), 485 + MUX(none, "mout_spi0_isp", group1_p4x12, E4X12_SRC_ISP, 4, 4), 486 + MUX(none, "mout_spi1_isp", group1_p4x12, E4X12_SRC_ISP, 8, 4), 487 + MUX(none, "mout_uart_isp", group1_p4x12, E4X12_SRC_ISP, 12, 4), 488 + }; 489 + 490 + /* list of divider clocks supported in all exynos4 soc's */ 491 + struct samsung_div_clock exynos4_div_clks[] __initdata = { 492 + DIV(none, "div_core", "mout_core", DIV_CPU0, 0, 3), 493 + DIV(none, "div_core2", "div_core", DIV_CPU0, 28, 3), 494 + DIV(none, "div_fimc0", "mout_fimc0", DIV_CAM, 0, 4), 495 + DIV(none, "div_fimc1", "mout_fimc1", DIV_CAM, 4, 4), 496 + DIV(none, "div_fimc2", "mout_fimc2", DIV_CAM, 8, 4), 497 + DIV(none, "div_fimc3", "mout_fimc3", DIV_CAM, 12, 4), 498 + DIV(none, "div_cam0", "mout_cam0", DIV_CAM, 16, 4), 499 + DIV(none, "div_cam1", "mout_cam1", DIV_CAM, 20, 4), 500 + DIV(none, "div_csis0", "mout_csis0", DIV_CAM, 24, 4), 501 + DIV(none, "div_csis1", "mout_csis1", DIV_CAM, 28, 4), 502 + DIV(sclk_mfc, "sclk_mfc", "mout_mfc", DIV_MFC, 0, 4), 503 + DIV_F(none, "div_g3d", "mout_g3d", DIV_G3D, 0, 4, 504 + CLK_SET_RATE_PARENT, 0), 505 + DIV(none, "div_fimd0", "mout_fimd0", DIV_LCD0, 0, 4), 506 + DIV(none, "div_mipi0", "mout_mipi0", DIV_LCD0, 16, 4), 507 + DIV(none, "div_audio0", "mout_audio0", DIV_MAUDIO, 0, 4), 508 + DIV(sclk_pcm0, "sclk_pcm0", "sclk_audio0", DIV_MAUDIO, 4, 8), 509 + DIV(none, "div_mmc0", "mout_mmc0", DIV_FSYS1, 0, 4), 510 + DIV(none, "div_mmc1", "mout_mmc1", DIV_FSYS1, 16, 4), 511 + DIV(none, "div_mmc2", "mout_mmc2", DIV_FSYS2, 0, 4), 512 + DIV(none, "div_mmc3", "mout_mmc3", DIV_FSYS2, 16, 4), 513 + DIV(sclk_pixel, "sclk_pixel", "sclk_vpll", DIV_TV, 0, 4), 514 + DIV(aclk100, "aclk100", "mout_aclk100", DIV_TOP, 4, 4), 515 + DIV(aclk160, "aclk160", "mout_aclk160", DIV_TOP, 8, 3), 516 + DIV(aclk133, "aclk133", "mout_aclk133", DIV_TOP, 12, 3), 517 + DIV(none, "div_onenand", "mout_onenand1", DIV_TOP, 16, 3), 518 + DIV(sclk_slimbus, "sclk_slimbus", "sclk_epll", DIV_PERIL3, 4, 4), 519 + DIV(sclk_pcm1, "sclk_pcm1", "sclk_audio1", DIV_PERIL4, 4, 8), 520 + DIV(sclk_pcm2, "sclk_pcm2", "sclk_audio2", DIV_PERIL4, 20, 8), 521 + DIV(sclk_i2s1, "sclk_i2s1", "sclk_audio1", DIV_PERIL5, 0, 6), 522 + DIV(sclk_i2s2, "sclk_i2s2", "sclk_audio2", DIV_PERIL5, 8, 6), 523 + DIV(none, "div_mmc4", "mout_mmc4", DIV_FSYS3, 0, 4), 524 + DIV(none, "div_mmc_pre4", "div_mmc4", DIV_FSYS3, 8, 8), 525 + DIV(none, "div_uart0", "mout_uart0", DIV_PERIL0, 0, 4), 526 + DIV(none, "div_uart1", "mout_uart1", DIV_PERIL0, 4, 4), 527 + DIV(none, "div_uart2", "mout_uart2", DIV_PERIL0, 8, 4), 528 + DIV(none, "div_uart3", "mout_uart3", DIV_PERIL0, 12, 4), 529 + DIV(none, "div_uart4", "mout_uart4", DIV_PERIL0, 16, 4), 530 + DIV(none, "div_spi0", "mout_spi0", DIV_PERIL1, 0, 4), 531 + DIV(none, "div_spi_pre0", "div_spi0", DIV_PERIL1, 8, 8), 532 + DIV(none, "div_spi1", "mout_spi1", DIV_PERIL1, 16, 4), 533 + DIV(none, "div_spi_pre1", "div_spi1", DIV_PERIL1, 24, 8), 534 + DIV(none, "div_spi2", "mout_spi2", DIV_PERIL2, 0, 4), 535 + DIV(none, "div_spi_pre2", "div_spi2", DIV_PERIL2, 8, 8), 536 + DIV(none, "div_audio1", "mout_audio1", DIV_PERIL4, 0, 4), 537 + DIV(none, "div_audio2", "mout_audio2", DIV_PERIL4, 16, 4), 538 + DIV_A(arm_clk, "arm_clk", "div_core2", DIV_CPU0, 28, 3, "arm_clk"), 539 + DIV_A(sclk_apll, "sclk_apll", "mout_apll", 540 + DIV_CPU0, 24, 3, "sclk_apll"), 541 + DIV_F(none, "div_mipi_pre0", "div_mipi0", DIV_LCD0, 20, 4, 542 + CLK_SET_RATE_PARENT, 0), 543 + DIV_F(none, "div_mmc_pre0", "div_mmc0", DIV_FSYS1, 8, 8, 544 + CLK_SET_RATE_PARENT, 0), 545 + DIV_F(none, "div_mmc_pre1", "div_mmc1", DIV_FSYS1, 24, 8, 546 + CLK_SET_RATE_PARENT, 0), 547 + DIV_F(none, "div_mmc_pre2", "div_mmc2", DIV_FSYS2, 8, 8, 548 + CLK_SET_RATE_PARENT, 0), 549 + DIV_F(none, "div_mmc_pre3", "div_mmc3", DIV_FSYS2, 24, 8, 550 + CLK_SET_RATE_PARENT, 0), 551 + }; 552 + 553 + /* list of divider clocks supported in exynos4210 soc */ 554 + struct samsung_div_clock exynos4210_div_clks[] __initdata = { 555 + DIV(aclk200, "aclk200", "mout_aclk200", DIV_TOP, 0, 3), 556 + DIV(none, "div_g2d", "mout_g2d", DIV_IMAGE, 0, 4), 557 + DIV(none, "div_fimd1", "mout_fimd1", E4210_DIV_LCD1, 0, 4), 558 + DIV(none, "div_mipi1", "mout_mipi1", E4210_DIV_LCD1, 16, 4), 559 + DIV(none, "div_sata", "mout_sata", DIV_FSYS0, 20, 4), 560 + DIV_F(none, "div_mipi_pre1", "div_mipi1", E4210_DIV_LCD1, 20, 4, 561 + CLK_SET_RATE_PARENT, 0), 562 + }; 563 + 564 + /* list of divider clocks supported in exynos4x12 soc */ 565 + struct samsung_div_clock exynos4x12_div_clks[] __initdata = { 566 + DIV(none, "div_mdnie0", "mout_mdnie0", DIV_LCD0, 4, 4), 567 + DIV(none, "div_mdnie_pwm0", "mout_mdnie_pwm0", DIV_LCD0, 8, 4), 568 + DIV(none, "div_mdnie_pwm_pre0", "div_mdnie_pwm0", DIV_LCD0, 12, 4), 569 + DIV(none, "div_mipihsi", "mout_mipihsi", DIV_FSYS0, 20, 4), 570 + DIV(none, "div_jpeg", "mout_jpeg", E4X12_DIV_CAM1, 0, 4), 571 + DIV(div_aclk200, "div_aclk200", "mout_aclk200", DIV_TOP, 0, 3), 572 + DIV(none, "div_aclk266_gps", "mout_aclk266_gps", DIV_TOP, 20, 3), 573 + DIV(div_aclk400_mcuisp, "div_aclk400_mcuisp", "mout_aclk400_mcuisp", 574 + DIV_TOP, 24, 3), 575 + DIV(none, "div_pwm_isp", "mout_pwm_isp", E4X12_DIV_ISP, 0, 4), 576 + DIV(none, "div_spi0_isp", "mout_spi0_isp", E4X12_DIV_ISP, 4, 4), 577 + DIV(none, "div_spi0_isp_pre", "div_spi0_isp", E4X12_DIV_ISP, 8, 8), 578 + DIV(none, "div_spi1_isp", "mout_spi1_isp", E4X12_DIV_ISP, 16, 4), 579 + DIV(none, "div_spi1_isp_pre", "div_spi1_isp", E4X12_DIV_ISP, 20, 8), 580 + DIV(none, "div_uart_isp", "mout_uart_isp", E4X12_DIV_ISP, 28, 4), 581 + DIV(div_isp0, "div_isp0", "aclk200", E4X12_DIV_ISP0, 0, 3), 582 + DIV(div_isp1, "div_isp1", "aclk200", E4X12_DIV_ISP0, 4, 3), 583 + DIV(none, "div_mpwm", "div_isp1", E4X12_DIV_ISP1, 0, 3), 584 + DIV(div_mcuisp0, "div_mcuisp0", "aclk400_mcuisp", E4X12_DIV_ISP1, 4, 3), 585 + DIV(div_mcuisp1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1, 8, 3), 586 + }; 587 + 588 + /* list of gate clocks supported in all exynos4 soc's */ 589 + struct samsung_gate_clock exynos4_gate_clks[] __initdata = { 590 + /* 591 + * After all Exynos4 based platforms are migrated to use device tree, 592 + * the device name and clock alias names specified below for some 593 + * of the clocks can be removed. 594 + */ 595 + GATE(sclk_hdmi, "sclk_hdmi", "mout_hdmi", SRC_MASK_TV, 0, 0, 0), 596 + GATE(sclk_spdif, "sclk_spdif", "mout_spdif", SRC_MASK_PERIL1, 8, 0, 0), 597 + GATE(jpeg, "jpeg", "aclk160", GATE_IP_CAM, 6, 0, 0), 598 + GATE(mie0, "mie0", "aclk160", GATE_IP_LCD0, 1, 0, 0), 599 + GATE(dsim0, "dsim0", "aclk160", GATE_IP_LCD0, 3, 0, 0), 600 + GATE(fimd1, "fimd1", "aclk160", E4210_GATE_IP_LCD1, 0, 0, 0), 601 + GATE(mie1, "mie1", "aclk160", E4210_GATE_IP_LCD1, 1, 0, 0), 602 + GATE(dsim1, "dsim1", "aclk160", E4210_GATE_IP_LCD1, 3, 0, 0), 603 + GATE(smmu_fimd1, "smmu_fimd1", "aclk160", E4210_GATE_IP_LCD1, 4, 0, 0), 604 + GATE(tsi, "tsi", "aclk133", GATE_IP_FSYS, 4, 0, 0), 605 + GATE(sromc, "sromc", "aclk133", GATE_IP_FSYS, 11, 0, 0), 606 + GATE(sclk_g3d, "sclk_g3d", "div_g3d", GATE_IP_G3D, 0, 607 + CLK_SET_RATE_PARENT, 0), 608 + GATE(usb_device, "usb_device", "aclk133", GATE_IP_FSYS, 13, 0, 0), 609 + GATE(onenand, "onenand", "aclk133", GATE_IP_FSYS, 15, 0, 0), 610 + GATE(nfcon, "nfcon", "aclk133", GATE_IP_FSYS, 16, 0, 0), 611 + GATE(gps, "gps", "aclk133", GATE_IP_GPS, 0, 0, 0), 612 + GATE(smmu_gps, "smmu_gps", "aclk133", GATE_IP_GPS, 1, 0, 0), 613 + GATE(slimbus, "slimbus", "aclk100", GATE_IP_PERIL, 25, 0, 0), 614 + GATE(sclk_cam0, "sclk_cam0", "div_cam0", GATE_SCLK_CAM, 4, 615 + CLK_SET_RATE_PARENT, 0), 616 + GATE(sclk_cam1, "sclk_cam1", "div_cam1", GATE_SCLK_CAM, 5, 617 + CLK_SET_RATE_PARENT, 0), 618 + GATE(sclk_mipi0, "sclk_mipi0", "div_mipi_pre0", 619 + SRC_MASK_LCD0, 12, CLK_SET_RATE_PARENT, 0), 620 + GATE(sclk_audio0, "sclk_audio0", "div_audio0", SRC_MASK_MAUDIO, 0, 621 + CLK_SET_RATE_PARENT, 0), 622 + GATE(sclk_audio1, "sclk_audio1", "div_audio1", SRC_MASK_PERIL1, 0, 623 + CLK_SET_RATE_PARENT, 0), 624 + GATE_D(vp, "s5p-mixer", "vp", "aclk160", GATE_IP_TV, 0, 0, 0), 625 + GATE_D(mixer, "s5p-mixer", "mixer", "aclk160", GATE_IP_TV, 1, 0, 0), 626 + GATE_D(hdmi, "exynos4-hdmi", "hdmi", "aclk160", GATE_IP_TV, 3, 0, 0), 627 + GATE_A(pwm, "pwm", "aclk100", GATE_IP_PERIL, 24, 0, 0, "timers"), 628 + GATE_A(sdmmc4, "sdmmc4", "aclk133", GATE_IP_FSYS, 9, 0, 0, "biu"), 629 + GATE_A(usb_host, "usb_host", "aclk133", 630 + GATE_IP_FSYS, 12, 0, 0, "usbhost"), 631 + GATE_DA(sclk_fimc0, "exynos4-fimc.0", "sclk_fimc0", "div_fimc0", 632 + SRC_MASK_CAM, 0, CLK_SET_RATE_PARENT, 0, "sclk_fimc"), 633 + GATE_DA(sclk_fimc1, "exynos4-fimc.1", "sclk_fimc1", "div_fimc1", 634 + SRC_MASK_CAM, 4, CLK_SET_RATE_PARENT, 0, "sclk_fimc"), 635 + GATE_DA(sclk_fimc2, "exynos4-fimc.2", "sclk_fimc2", "div_fimc2", 636 + SRC_MASK_CAM, 8, CLK_SET_RATE_PARENT, 0, "sclk_fimc"), 637 + GATE_DA(sclk_fimc3, "exynos4-fimc.3", "sclk_fimc3", "div_fimc3", 638 + SRC_MASK_CAM, 12, CLK_SET_RATE_PARENT, 0, "sclk_fimc"), 639 + GATE_DA(sclk_csis0, "s5p-mipi-csis.0", "sclk_csis0", "div_csis0", 640 + SRC_MASK_CAM, 24, CLK_SET_RATE_PARENT, 0, "sclk_csis"), 641 + GATE_DA(sclk_csis1, "s5p-mipi-csis.1", "sclk_csis1", "div_csis1", 642 + SRC_MASK_CAM, 28, CLK_SET_RATE_PARENT, 0, "sclk_csis"), 643 + GATE_DA(sclk_fimd0, "exynos4-fb.0", "sclk_fimd0", "div_fimd0", 644 + SRC_MASK_LCD0, 0, CLK_SET_RATE_PARENT, 0, "sclk_fimd"), 645 + GATE_DA(sclk_mmc0, "exynos4-sdhci.0", "sclk_mmc0", "div_mmc_pre0", 646 + SRC_MASK_FSYS, 0, CLK_SET_RATE_PARENT, 0, 647 + "mmc_busclk.2"), 648 + GATE_DA(sclk_mmc1, "exynos4-sdhci.1", "sclk_mmc1", "div_mmc_pre1", 649 + SRC_MASK_FSYS, 4, CLK_SET_RATE_PARENT, 0, 650 + "mmc_busclk.2"), 651 + GATE_DA(sclk_mmc2, "exynos4-sdhci.2", "sclk_mmc2", "div_mmc_pre2", 652 + SRC_MASK_FSYS, 8, CLK_SET_RATE_PARENT, 0, 653 + "mmc_busclk.2"), 654 + GATE_DA(sclk_mmc3, "exynos4-sdhci.3", "sclk_mmc3", "div_mmc_pre3", 655 + SRC_MASK_FSYS, 12, CLK_SET_RATE_PARENT, 0, 656 + "mmc_busclk.2"), 657 + GATE_DA(sclk_mmc4, NULL, "sclk_mmc4", "div_mmc_pre4", 658 + SRC_MASK_FSYS, 16, CLK_SET_RATE_PARENT, 0, "ciu"), 659 + GATE_DA(sclk_uart0, "exynos4210-uart.0", "uclk0", "div_uart0", 660 + SRC_MASK_PERIL0, 0, CLK_SET_RATE_PARENT, 661 + 0, "clk_uart_baud0"), 662 + GATE_DA(sclk_uart1, "exynos4210-uart.1", "uclk1", "div_uart1", 663 + SRC_MASK_PERIL0, 4, CLK_SET_RATE_PARENT, 664 + 0, "clk_uart_baud0"), 665 + GATE_DA(sclk_uart2, "exynos4210-uart.2", "uclk2", "div_uart2", 666 + SRC_MASK_PERIL0, 8, CLK_SET_RATE_PARENT, 667 + 0, "clk_uart_baud0"), 668 + GATE_DA(sclk_uart3, "exynos4210-uart.3", "uclk3", "div_uart3", 669 + SRC_MASK_PERIL0, 12, CLK_SET_RATE_PARENT, 670 + 0, "clk_uart_baud0"), 671 + GATE_DA(sclk_uart4, "exynos4210-uart.4", "uclk4", "div_uart4", 672 + SRC_MASK_PERIL0, 16, CLK_SET_RATE_PARENT, 673 + 0, "clk_uart_baud0"), 674 + GATE(sclk_audio2, "sclk_audio2", "div_audio2", SRC_MASK_PERIL1, 4, 675 + CLK_SET_RATE_PARENT, 0), 676 + GATE_DA(sclk_spi0, "exynos4210-spi.0", "sclk_spi0", "div_spi_pre0", 677 + SRC_MASK_PERIL1, 16, CLK_SET_RATE_PARENT, 678 + 0, "spi_busclk0"), 679 + GATE_DA(sclk_spi1, "exynos4210-spi.1", "sclk_spi1", "div_spi_pre1", 680 + SRC_MASK_PERIL1, 20, CLK_SET_RATE_PARENT, 681 + 0, "spi_busclk0"), 682 + GATE_DA(sclk_spi2, "exynos4210-spi.2", "sclk_spi2", "div_spi_pre2", 683 + SRC_MASK_PERIL1, 24, CLK_SET_RATE_PARENT, 684 + 0, "spi_busclk0"), 685 + GATE_DA(fimc0, "exynos4-fimc.0", "fimc0", "aclk160", 686 + GATE_IP_CAM, 0, 0, 0, "fimc"), 687 + GATE_DA(fimc1, "exynos4-fimc.1", "fimc1", "aclk160", 688 + GATE_IP_CAM, 1, 0, 0, "fimc"), 689 + GATE_DA(fimc2, "exynos4-fimc.2", "fimc2", "aclk160", 690 + GATE_IP_CAM, 2, 0, 0, "fimc"), 691 + GATE_DA(fimc3, "exynos4-fimc.3", "fimc3", "aclk160", 692 + GATE_IP_CAM, 3, 0, 0, "fimc"), 693 + GATE_DA(csis0, "s5p-mipi-csis.0", "csis0", "aclk160", 694 + GATE_IP_CAM, 4, 0, 0, "fimc"), 695 + GATE_DA(csis1, "s5p-mipi-csis.1", "csis1", "aclk160", 696 + GATE_IP_CAM, 5, 0, 0, "fimc"), 697 + GATE_DA(smmu_fimc0, "exynos-sysmmu.5", "smmu_fimc0", "aclk160", 698 + GATE_IP_CAM, 7, 0, 0, "sysmmu"), 699 + GATE_DA(smmu_fimc1, "exynos-sysmmu.6", "smmu_fimc1", "aclk160", 700 + GATE_IP_CAM, 8, 0, 0, "sysmmu"), 701 + GATE_DA(smmu_fimc2, "exynos-sysmmu.7", "smmu_fimc2", "aclk160", 702 + GATE_IP_CAM, 9, 0, 0, "sysmmu"), 703 + GATE_DA(smmu_fimc3, "exynos-sysmmu.8", "smmu_fimc3", "aclk160", 704 + GATE_IP_CAM, 10, 0, 0, "sysmmu"), 705 + GATE_DA(smmu_jpeg, "exynos-sysmmu.3", "smmu_jpeg", "aclk160", 706 + GATE_IP_CAM, 11, 0, 0, "sysmmu"), 707 + GATE(pixelasyncm0, "pxl_async0", "aclk160", GATE_IP_CAM, 17, 0, 0), 708 + GATE(pixelasyncm1, "pxl_async1", "aclk160", GATE_IP_CAM, 18, 0, 0), 709 + GATE_DA(smmu_tv, "exynos-sysmmu.2", "smmu_tv", "aclk160", 710 + GATE_IP_TV, 4, 0, 0, "sysmmu"), 711 + GATE_DA(mfc, "s5p-mfc", "mfc", "aclk100", GATE_IP_MFC, 0, 0, 0, "mfc"), 712 + GATE_DA(smmu_mfcl, "exynos-sysmmu.0", "smmu_mfcl", "aclk100", 713 + GATE_IP_MFC, 1, 0, 0, "sysmmu"), 714 + GATE_DA(smmu_mfcr, "exynos-sysmmu.1", "smmu_mfcr", "aclk100", 715 + GATE_IP_MFC, 2, 0, 0, "sysmmu"), 716 + GATE_DA(fimd0, "exynos4-fb.0", "fimd0", "aclk160", 717 + GATE_IP_LCD0, 0, 0, 0, "fimd"), 718 + GATE_DA(smmu_fimd0, "exynos-sysmmu.10", "smmu_fimd0", "aclk160", 719 + GATE_IP_LCD0, 4, 0, 0, "sysmmu"), 720 + GATE_DA(pdma0, "dma-pl330.0", "pdma0", "aclk133", 721 + GATE_IP_FSYS, 0, 0, 0, "dma"), 722 + GATE_DA(pdma1, "dma-pl330.1", "pdma1", "aclk133", 723 + GATE_IP_FSYS, 1, 0, 0, "dma"), 724 + GATE_DA(sdmmc0, "exynos4-sdhci.0", "sdmmc0", "aclk133", 725 + GATE_IP_FSYS, 5, 0, 0, "hsmmc"), 726 + GATE_DA(sdmmc1, "exynos4-sdhci.1", "sdmmc1", "aclk133", 727 + GATE_IP_FSYS, 6, 0, 0, "hsmmc"), 728 + GATE_DA(sdmmc2, "exynos4-sdhci.2", "sdmmc2", "aclk133", 729 + GATE_IP_FSYS, 7, 0, 0, "hsmmc"), 730 + GATE_DA(sdmmc3, "exynos4-sdhci.3", "sdmmc3", "aclk133", 731 + GATE_IP_FSYS, 8, 0, 0, "hsmmc"), 732 + GATE_DA(uart0, "exynos4210-uart.0", "uart0", "aclk100", 733 + GATE_IP_PERIL, 0, 0, 0, "uart"), 734 + GATE_DA(uart1, "exynos4210-uart.1", "uart1", "aclk100", 735 + GATE_IP_PERIL, 1, 0, 0, "uart"), 736 + GATE_DA(uart2, "exynos4210-uart.2", "uart2", "aclk100", 737 + GATE_IP_PERIL, 2, 0, 0, "uart"), 738 + GATE_DA(uart3, "exynos4210-uart.3", "uart3", "aclk100", 739 + GATE_IP_PERIL, 3, 0, 0, "uart"), 740 + GATE_DA(uart4, "exynos4210-uart.4", "uart4", "aclk100", 741 + GATE_IP_PERIL, 4, 0, 0, "uart"), 742 + GATE_DA(i2c0, "s3c2440-i2c.0", "i2c0", "aclk100", 743 + GATE_IP_PERIL, 6, 0, 0, "i2c"), 744 + GATE_DA(i2c1, "s3c2440-i2c.1", "i2c1", "aclk100", 745 + GATE_IP_PERIL, 7, 0, 0, "i2c"), 746 + GATE_DA(i2c2, "s3c2440-i2c.2", "i2c2", "aclk100", 747 + GATE_IP_PERIL, 8, 0, 0, "i2c"), 748 + GATE_DA(i2c3, "s3c2440-i2c.3", "i2c3", "aclk100", 749 + GATE_IP_PERIL, 9, 0, 0, "i2c"), 750 + GATE_DA(i2c4, "s3c2440-i2c.4", "i2c4", "aclk100", 751 + GATE_IP_PERIL, 10, 0, 0, "i2c"), 752 + GATE_DA(i2c5, "s3c2440-i2c.5", "i2c5", "aclk100", 753 + GATE_IP_PERIL, 11, 0, 0, "i2c"), 754 + GATE_DA(i2c6, "s3c2440-i2c.6", "i2c6", "aclk100", 755 + GATE_IP_PERIL, 12, 0, 0, "i2c"), 756 + GATE_DA(i2c7, "s3c2440-i2c.7", "i2c7", "aclk100", 757 + GATE_IP_PERIL, 13, 0, 0, "i2c"), 758 + GATE_DA(i2c_hdmi, "s3c2440-hdmiphy-i2c", "i2c-hdmi", "aclk100", 759 + GATE_IP_PERIL, 14, 0, 0, "i2c"), 760 + GATE_DA(spi0, "exynos4210-spi.0", "spi0", "aclk100", 761 + GATE_IP_PERIL, 16, 0, 0, "spi"), 762 + GATE_DA(spi1, "exynos4210-spi.1", "spi1", "aclk100", 763 + GATE_IP_PERIL, 17, 0, 0, "spi"), 764 + GATE_DA(spi2, "exynos4210-spi.2", "spi2", "aclk100", 765 + GATE_IP_PERIL, 18, 0, 0, "spi"), 766 + GATE_DA(i2s1, "samsung-i2s.1", "i2s1", "aclk100", 767 + GATE_IP_PERIL, 20, 0, 0, "iis"), 768 + GATE_DA(i2s2, "samsung-i2s.2", "i2s2", "aclk100", 769 + GATE_IP_PERIL, 21, 0, 0, "iis"), 770 + GATE_DA(pcm1, "samsung-pcm.1", "pcm1", "aclk100", 771 + GATE_IP_PERIL, 22, 0, 0, "pcm"), 772 + GATE_DA(pcm2, "samsung-pcm.2", "pcm2", "aclk100", 773 + GATE_IP_PERIL, 23, 0, 0, "pcm"), 774 + GATE_DA(spdif, "samsung-spdif", "spdif", "aclk100", 775 + GATE_IP_PERIL, 26, 0, 0, "spdif"), 776 + GATE_DA(ac97, "samsung-ac97", "ac97", "aclk100", 777 + GATE_IP_PERIL, 27, 0, 0, "ac97"), 778 + }; 779 + 780 + /* list of gate clocks supported in exynos4210 soc */ 781 + struct samsung_gate_clock exynos4210_gate_clks[] __initdata = { 782 + GATE(tvenc, "tvenc", "aclk160", GATE_IP_TV, 2, 0, 0), 783 + GATE(g2d, "g2d", "aclk200", E4210_GATE_IP_IMAGE, 0, 0, 0), 784 + GATE(rotator, "rotator", "aclk200", E4210_GATE_IP_IMAGE, 1, 0, 0), 785 + GATE(mdma, "mdma", "aclk200", E4210_GATE_IP_IMAGE, 2, 0, 0), 786 + GATE(smmu_g2d, "smmu_g2d", "aclk200", E4210_GATE_IP_IMAGE, 3, 0, 0), 787 + GATE(smmu_mdma, "smmu_mdma", "aclk200", E4210_GATE_IP_IMAGE, 5, 0, 0), 788 + GATE(pcie_phy, "pcie_phy", "aclk133", GATE_IP_FSYS, 2, 0, 0), 789 + GATE(sata_phy, "sata_phy", "aclk133", GATE_IP_FSYS, 3, 0, 0), 790 + GATE(sata, "sata", "aclk133", GATE_IP_FSYS, 10, 0, 0), 791 + GATE(pcie, "pcie", "aclk133", GATE_IP_FSYS, 14, 0, 0), 792 + GATE(smmu_pcie, "smmu_pcie", "aclk133", GATE_IP_FSYS, 18, 0, 0), 793 + GATE(modemif, "modemif", "aclk100", GATE_IP_PERIL, 28, 0, 0), 794 + GATE(chipid, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0), 795 + GATE(sysreg, "sysreg", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0), 796 + GATE(hdmi_cec, "hdmi_cec", "aclk100", E4210_GATE_IP_PERIR, 11, 0, 0), 797 + GATE(smmu_rotator, "smmu_rotator", "aclk200", 798 + E4210_GATE_IP_IMAGE, 4, 0, 0), 799 + GATE(sclk_mipi1, "sclk_mipi1", "div_mipi_pre1", 800 + E4210_SRC_MASK_LCD1, 12, CLK_SET_RATE_PARENT, 0), 801 + GATE(sclk_sata, "sclk_sata", "div_sata", 802 + SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0), 803 + GATE(sclk_mixer, "sclk_mixer", "mout_mixer", SRC_MASK_TV, 4, 0, 0), 804 + GATE(sclk_dac, "sclk_dac", "mout_dac", SRC_MASK_TV, 8, 0, 0), 805 + GATE_A(tsadc, "tsadc", "aclk100", GATE_IP_PERIL, 15, 0, 0, "adc"), 806 + GATE_A(mct, "mct", "aclk100", E4210_GATE_IP_PERIR, 13, 0, 0, "mct"), 807 + GATE_A(wdt, "watchdog", "aclk100", E4210_GATE_IP_PERIR, 14, 0, 0, "watchdog"), 808 + GATE_A(rtc, "rtc", "aclk100", E4210_GATE_IP_PERIR, 15, 0, 0, "rtc"), 809 + GATE_A(keyif, "keyif", "aclk100", E4210_GATE_IP_PERIR, 16, 0, 0, "keypad"), 810 + GATE_DA(sclk_fimd1, "exynos4-fb.1", "sclk_fimd1", "div_fimd1", 811 + E4210_SRC_MASK_LCD1, 0, CLK_SET_RATE_PARENT, 0, "sclk_fimd"), 812 + }; 813 + 814 + /* list of gate clocks supported in exynos4x12 soc */ 815 + struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = { 816 + GATE(audss, "audss", "sclk_epll", E4X12_GATE_IP_MAUDIO, 0, 0, 0), 817 + GATE(mdnie0, "mdnie0", "aclk160", GATE_IP_LCD0, 2, 0, 0), 818 + GATE(rotator, "rotator", "aclk200", E4X12_GATE_IP_IMAGE, 1, 0, 0), 819 + GATE(mdma2, "mdma2", "aclk200", E4X12_GATE_IP_IMAGE, 2, 0, 0), 820 + GATE(smmu_mdma, "smmu_mdma", "aclk200", E4X12_GATE_IP_IMAGE, 5, 0, 0), 821 + GATE(mipi_hsi, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0), 822 + GATE(chipid, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, 0, 0), 823 + GATE(sysreg, "sysreg", "aclk100", E4X12_GATE_IP_PERIR, 1, 0, 0), 824 + GATE(hdmi_cec, "hdmi_cec", "aclk100", E4X12_GATE_IP_PERIR, 11, 0, 0), 825 + GATE(sclk_mdnie0, "sclk_mdnie0", "div_mdnie0", 826 + SRC_MASK_LCD0, 4, CLK_SET_RATE_PARENT, 0), 827 + GATE(sclk_mdnie_pwm0, "sclk_mdnie_pwm0", "div_mdnie_pwm_pre0", 828 + SRC_MASK_LCD0, 8, CLK_SET_RATE_PARENT, 0), 829 + GATE(sclk_mipihsi, "sclk_mipihsi", "div_mipihsi", 830 + SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0), 831 + GATE(smmu_rotator, "smmu_rotator", "aclk200", 832 + E4X12_GATE_IP_IMAGE, 4, 0, 0), 833 + GATE_A(mct, "mct", "aclk100", E4X12_GATE_IP_PERIR, 13, 0, 0, "mct"), 834 + GATE_A(rtc, "rtc", "aclk100", E4X12_GATE_IP_PERIR, 15, 0, 0, "rtc"), 835 + GATE_A(keyif, "keyif", "aclk100", 836 + E4X12_GATE_IP_PERIR, 16, 0, 0, "keypad"), 837 + GATE(sclk_pwm_isp, "sclk_pwm_isp", "div_pwm_isp", 838 + E4X12_SRC_MASK_ISP, 0, CLK_SET_RATE_PARENT, 0), 839 + GATE(sclk_spi0_isp, "sclk_spi0_isp", "div_spi0_isp_pre", 840 + E4X12_SRC_MASK_ISP, 4, CLK_SET_RATE_PARENT, 0), 841 + GATE(sclk_spi1_isp, "sclk_spi1_isp", "div_spi1_isp_pre", 842 + E4X12_SRC_MASK_ISP, 8, CLK_SET_RATE_PARENT, 0), 843 + GATE(sclk_uart_isp, "sclk_uart_isp", "div_uart_isp", 844 + E4X12_SRC_MASK_ISP, 12, CLK_SET_RATE_PARENT, 0), 845 + GATE(pwm_isp_sclk, "pwm_isp_sclk", "sclk_pwm_isp", 846 + E4X12_GATE_IP_ISP, 0, 0, 0), 847 + GATE(spi0_isp_sclk, "spi0_isp_sclk", "sclk_spi0_isp", 848 + E4X12_GATE_IP_ISP, 1, 0, 0), 849 + GATE(spi1_isp_sclk, "spi1_isp_sclk", "sclk_spi1_isp", 850 + E4X12_GATE_IP_ISP, 2, 0, 0), 851 + GATE(uart_isp_sclk, "uart_isp_sclk", "sclk_uart_isp", 852 + E4X12_GATE_IP_ISP, 3, 0, 0), 853 + GATE_A(wdt, "watchdog", "aclk100", 854 + E4X12_GATE_IP_PERIR, 14, 0, 0, "watchdog"), 855 + GATE_DA(pcm0, "samsung-pcm.0", "pcm0", "aclk100", 856 + E4X12_GATE_IP_MAUDIO, 2, 0, 0, "pcm"), 857 + GATE_DA(i2s0, "samsung-i2s.0", "i2s0", "aclk100", 858 + E4X12_GATE_IP_MAUDIO, 3, 0, 0, "iis"), 859 + GATE(fimc_isp, "isp", "aclk200", E4X12_GATE_ISP0, 0, 860 + CLK_IGNORE_UNUSED, 0), 861 + GATE(fimc_drc, "drc", "aclk200", E4X12_GATE_ISP0, 1, 862 + CLK_IGNORE_UNUSED, 0), 863 + GATE(fimc_fd, "fd", "aclk200", E4X12_GATE_ISP0, 2, 864 + CLK_IGNORE_UNUSED, 0), 865 + GATE(fimc_lite0, "lite0", "aclk200", E4X12_GATE_ISP0, 3, 866 + CLK_IGNORE_UNUSED, 0), 867 + GATE(fimc_lite1, "lite1", "aclk200", E4X12_GATE_ISP0, 4, 868 + CLK_IGNORE_UNUSED, 0), 869 + GATE(mcuisp, "mcuisp", "aclk200", E4X12_GATE_ISP0, 5, 870 + CLK_IGNORE_UNUSED, 0), 871 + GATE(gicisp, "gicisp", "aclk200", E4X12_GATE_ISP0, 7, 872 + CLK_IGNORE_UNUSED, 0), 873 + GATE(smmu_isp, "smmu_isp", "aclk200", E4X12_GATE_ISP0, 8, 874 + CLK_IGNORE_UNUSED, 0), 875 + GATE(smmu_drc, "smmu_drc", "aclk200", E4X12_GATE_ISP0, 9, 876 + CLK_IGNORE_UNUSED, 0), 877 + GATE(smmu_fd, "smmu_fd", "aclk200", E4X12_GATE_ISP0, 10, 878 + CLK_IGNORE_UNUSED, 0), 879 + GATE(smmu_lite0, "smmu_lite0", "aclk200", E4X12_GATE_ISP0, 11, 880 + CLK_IGNORE_UNUSED, 0), 881 + GATE(smmu_lite1, "smmu_lite1", "aclk200", E4X12_GATE_ISP0, 12, 882 + CLK_IGNORE_UNUSED, 0), 883 + GATE(ppmuispmx, "ppmuispmx", "aclk200", E4X12_GATE_ISP0, 20, 884 + CLK_IGNORE_UNUSED, 0), 885 + GATE(ppmuispx, "ppmuispx", "aclk200", E4X12_GATE_ISP0, 21, 886 + CLK_IGNORE_UNUSED, 0), 887 + GATE(mcuctl_isp, "mcuctl_isp", "aclk200", E4X12_GATE_ISP0, 23, 888 + CLK_IGNORE_UNUSED, 0), 889 + GATE(mpwm_isp, "mpwm_isp", "aclk200", E4X12_GATE_ISP0, 24, 890 + CLK_IGNORE_UNUSED, 0), 891 + GATE(i2c0_isp, "i2c0_isp", "aclk200", E4X12_GATE_ISP0, 25, 892 + CLK_IGNORE_UNUSED, 0), 893 + GATE(i2c1_isp, "i2c1_isp", "aclk200", E4X12_GATE_ISP0, 26, 894 + CLK_IGNORE_UNUSED, 0), 895 + GATE(mtcadc_isp, "mtcadc_isp", "aclk200", E4X12_GATE_ISP0, 27, 896 + CLK_IGNORE_UNUSED, 0), 897 + GATE(pwm_isp, "pwm_isp", "aclk200", E4X12_GATE_ISP0, 28, 898 + CLK_IGNORE_UNUSED, 0), 899 + GATE(wdt_isp, "wdt_isp", "aclk200", E4X12_GATE_ISP0, 30, 900 + CLK_IGNORE_UNUSED, 0), 901 + GATE(uart_isp, "uart_isp", "aclk200", E4X12_GATE_ISP0, 31, 902 + CLK_IGNORE_UNUSED, 0), 903 + GATE(asyncaxim, "asyncaxim", "aclk200", E4X12_GATE_ISP1, 0, 904 + CLK_IGNORE_UNUSED, 0), 905 + GATE(smmu_ispcx, "smmu_ispcx", "aclk200", E4X12_GATE_ISP1, 4, 906 + CLK_IGNORE_UNUSED, 0), 907 + GATE(spi0_isp, "spi0_isp", "aclk200", E4X12_GATE_ISP1, 12, 908 + CLK_IGNORE_UNUSED, 0), 909 + GATE(spi1_isp, "spi1_isp", "aclk200", E4X12_GATE_ISP1, 13, 910 + CLK_IGNORE_UNUSED, 0), 911 + }; 912 + 913 + #ifdef CONFIG_OF 914 + static struct of_device_id exynos4_clk_ids[] __initdata = { 915 + { .compatible = "samsung,exynos4210-clock", 916 + .data = (void *)EXYNOS4210, }, 917 + { .compatible = "samsung,exynos4412-clock", 918 + .data = (void *)EXYNOS4X12, }, 919 + { }, 920 + }; 921 + #endif 922 + 923 + /* 924 + * The parent of the fin_pll clock is selected by the XOM[0] bit. This bit 925 + * resides in chipid register space, outside of the clock controller memory 926 + * mapped space. So to determine the parent of fin_pll clock, the chipid 927 + * controller is first remapped and the value of XOM[0] bit is read to 928 + * determine the parent clock. 929 + */ 930 + static void __init exynos4_clk_register_finpll(void) 931 + { 932 + struct samsung_fixed_rate_clock fclk; 933 + struct device_node *np; 934 + struct clk *clk; 935 + void __iomem *chipid_base = S5P_VA_CHIPID; 936 + unsigned long xom, finpll_f = 24000000; 937 + char *parent_name; 938 + 939 + np = of_find_compatible_node(NULL, NULL, "samsung,exynos4210-chipid"); 940 + if (np) 941 + chipid_base = of_iomap(np, 0); 942 + 943 + if (chipid_base) { 944 + xom = readl(chipid_base + 8); 945 + parent_name = xom & 1 ? "xusbxti" : "xxti"; 946 + clk = clk_get(NULL, parent_name); 947 + if (IS_ERR(clk)) { 948 + pr_err("%s: failed to lookup parent clock %s, assuming " 949 + "fin_pll clock frequency is 24MHz\n", __func__, 950 + parent_name); 951 + } else { 952 + finpll_f = clk_get_rate(clk); 953 + } 954 + } else { 955 + pr_err("%s: failed to map chipid registers, assuming " 956 + "fin_pll clock frequency is 24MHz\n", __func__); 957 + } 958 + 959 + fclk.id = fin_pll; 960 + fclk.name = "fin_pll"; 961 + fclk.parent_name = NULL; 962 + fclk.flags = CLK_IS_ROOT; 963 + fclk.fixed_rate = finpll_f; 964 + samsung_clk_register_fixed_rate(&fclk, 1); 965 + 966 + if (np) 967 + iounmap(chipid_base); 968 + } 969 + 970 + /* 971 + * This function allows non-dt platforms to specify the clock speed of the 972 + * xxti and xusbxti clocks. These clocks are then registered with the specified 973 + * clock speed. 974 + */ 975 + void __init exynos4_clk_register_fixed_ext(unsigned long xxti_f, 976 + unsigned long xusbxti_f) 977 + { 978 + exynos4_fixed_rate_ext_clks[0].fixed_rate = xxti_f; 979 + exynos4_fixed_rate_ext_clks[1].fixed_rate = xusbxti_f; 980 + samsung_clk_register_fixed_rate(exynos4_fixed_rate_ext_clks, 981 + ARRAY_SIZE(exynos4_fixed_rate_ext_clks)); 982 + } 983 + 984 + static __initdata struct of_device_id ext_clk_match[] = { 985 + { .compatible = "samsung,clock-xxti", .data = (void *)0, }, 986 + { .compatible = "samsung,clock-xusbxti", .data = (void *)1, }, 987 + {}, 988 + }; 989 + 990 + /* register exynos4 clocks */ 991 + void __init exynos4_clk_init(struct device_node *np) 992 + { 993 + void __iomem *reg_base; 994 + struct clk *apll, *mpll, *epll, *vpll; 995 + u32 exynos4_soc; 996 + 997 + if (np) { 998 + const struct of_device_id *match; 999 + match = of_match_node(exynos4_clk_ids, np); 1000 + exynos4_soc = (u32)match->data; 1001 + 1002 + reg_base = of_iomap(np, 0); 1003 + if (!reg_base) 1004 + panic("%s: failed to map registers\n", __func__); 1005 + } else { 1006 + reg_base = S5P_VA_CMU; 1007 + if (soc_is_exynos4210()) 1008 + exynos4_soc = EXYNOS4210; 1009 + else if (soc_is_exynos4212() || soc_is_exynos4412()) 1010 + exynos4_soc = EXYNOS4X12; 1011 + else 1012 + panic("%s: unable to determine soc\n", __func__); 1013 + } 1014 + 1015 + if (exynos4_soc == EXYNOS4210) 1016 + samsung_clk_init(np, reg_base, nr_clks, 1017 + exynos4_clk_regs, ARRAY_SIZE(exynos4_clk_regs), 1018 + exynos4210_clk_save, ARRAY_SIZE(exynos4210_clk_save)); 1019 + else 1020 + samsung_clk_init(np, reg_base, nr_clks, 1021 + exynos4_clk_regs, ARRAY_SIZE(exynos4_clk_regs), 1022 + exynos4x12_clk_save, ARRAY_SIZE(exynos4x12_clk_save)); 1023 + 1024 + if (np) 1025 + samsung_clk_of_register_fixed_ext(exynos4_fixed_rate_ext_clks, 1026 + ARRAY_SIZE(exynos4_fixed_rate_ext_clks), 1027 + ext_clk_match); 1028 + 1029 + exynos4_clk_register_finpll(); 1030 + 1031 + if (exynos4_soc == EXYNOS4210) { 1032 + apll = samsung_clk_register_pll45xx("fout_apll", "fin_pll", 1033 + reg_base + APLL_CON0, pll_4508); 1034 + mpll = samsung_clk_register_pll45xx("fout_mpll", "fin_pll", 1035 + reg_base + E4210_MPLL_CON0, pll_4508); 1036 + epll = samsung_clk_register_pll46xx("fout_epll", "fin_pll", 1037 + reg_base + EPLL_CON0, pll_4600); 1038 + vpll = samsung_clk_register_pll46xx("fout_vpll", "mout_vpllsrc", 1039 + reg_base + VPLL_CON0, pll_4650c); 1040 + } else { 1041 + apll = samsung_clk_register_pll35xx("fout_apll", "fin_pll", 1042 + reg_base + APLL_CON0); 1043 + mpll = samsung_clk_register_pll35xx("fout_mpll", "fin_pll", 1044 + reg_base + E4X12_MPLL_CON0); 1045 + epll = samsung_clk_register_pll36xx("fout_epll", "fin_pll", 1046 + reg_base + EPLL_CON0); 1047 + vpll = samsung_clk_register_pll36xx("fout_vpll", "fin_pll", 1048 + reg_base + VPLL_CON0); 1049 + } 1050 + 1051 + samsung_clk_add_lookup(apll, fout_apll); 1052 + samsung_clk_add_lookup(mpll, fout_mpll); 1053 + samsung_clk_add_lookup(epll, fout_epll); 1054 + samsung_clk_add_lookup(vpll, fout_vpll); 1055 + 1056 + samsung_clk_register_fixed_rate(exynos4_fixed_rate_clks, 1057 + ARRAY_SIZE(exynos4_fixed_rate_clks)); 1058 + samsung_clk_register_mux(exynos4_mux_clks, 1059 + ARRAY_SIZE(exynos4_mux_clks)); 1060 + samsung_clk_register_div(exynos4_div_clks, 1061 + ARRAY_SIZE(exynos4_div_clks)); 1062 + samsung_clk_register_gate(exynos4_gate_clks, 1063 + ARRAY_SIZE(exynos4_gate_clks)); 1064 + 1065 + if (exynos4_soc == EXYNOS4210) { 1066 + samsung_clk_register_fixed_rate(exynos4210_fixed_rate_clks, 1067 + ARRAY_SIZE(exynos4210_fixed_rate_clks)); 1068 + samsung_clk_register_mux(exynos4210_mux_clks, 1069 + ARRAY_SIZE(exynos4210_mux_clks)); 1070 + samsung_clk_register_div(exynos4210_div_clks, 1071 + ARRAY_SIZE(exynos4210_div_clks)); 1072 + samsung_clk_register_gate(exynos4210_gate_clks, 1073 + ARRAY_SIZE(exynos4210_gate_clks)); 1074 + } else { 1075 + samsung_clk_register_mux(exynos4x12_mux_clks, 1076 + ARRAY_SIZE(exynos4x12_mux_clks)); 1077 + samsung_clk_register_div(exynos4x12_div_clks, 1078 + ARRAY_SIZE(exynos4x12_div_clks)); 1079 + samsung_clk_register_gate(exynos4x12_gate_clks, 1080 + ARRAY_SIZE(exynos4x12_gate_clks)); 1081 + } 1082 + 1083 + pr_info("%s clocks: sclk_apll = %ld, sclk_mpll = %ld\n" 1084 + "\tsclk_epll = %ld, sclk_vpll = %ld, arm_clk = %ld\n", 1085 + exynos4_soc == EXYNOS4210 ? "Exynos4210" : "Exynos4x12", 1086 + _get_rate("sclk_apll"), _get_rate("sclk_mpll"), 1087 + _get_rate("sclk_epll"), _get_rate("sclk_vpll"), 1088 + _get_rate("arm_clk")); 1089 + } 1090 + CLK_OF_DECLARE(exynos4210_clk, "samsung,exynos4210-clock", exynos4_clk_init); 1091 + CLK_OF_DECLARE(exynos4412_clk, "samsung,exynos4412-clock", exynos4_clk_init);
+523
drivers/clk/samsung/clk-exynos5250.c
··· 1 + /* 2 + * Copyright (c) 2013 Samsung Electronics Co., Ltd. 3 + * Copyright (c) 2013 Linaro Ltd. 4 + * Author: Thomas Abraham <thomas.ab@samsung.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 version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + * Common Clock Framework support for Exynos5250 SoC. 11 + */ 12 + 13 + #include <linux/clk.h> 14 + #include <linux/clkdev.h> 15 + #include <linux/clk-provider.h> 16 + #include <linux/of.h> 17 + #include <linux/of_address.h> 18 + 19 + #include <plat/cpu.h> 20 + #include "clk.h" 21 + #include "clk-pll.h" 22 + 23 + #define SRC_CPU 0x200 24 + #define DIV_CPU0 0x500 25 + #define SRC_CORE1 0x4204 26 + #define SRC_TOP0 0x10210 27 + #define SRC_TOP2 0x10218 28 + #define SRC_GSCL 0x10220 29 + #define SRC_DISP1_0 0x1022c 30 + #define SRC_MAU 0x10240 31 + #define SRC_FSYS 0x10244 32 + #define SRC_GEN 0x10248 33 + #define SRC_PERIC0 0x10250 34 + #define SRC_PERIC1 0x10254 35 + #define SRC_MASK_GSCL 0x10320 36 + #define SRC_MASK_DISP1_0 0x1032c 37 + #define SRC_MASK_MAU 0x10334 38 + #define SRC_MASK_FSYS 0x10340 39 + #define SRC_MASK_GEN 0x10344 40 + #define SRC_MASK_PERIC0 0x10350 41 + #define SRC_MASK_PERIC1 0x10354 42 + #define DIV_TOP0 0x10510 43 + #define DIV_TOP1 0x10514 44 + #define DIV_GSCL 0x10520 45 + #define DIV_DISP1_0 0x1052c 46 + #define DIV_GEN 0x1053c 47 + #define DIV_MAU 0x10544 48 + #define DIV_FSYS0 0x10548 49 + #define DIV_FSYS1 0x1054c 50 + #define DIV_FSYS2 0x10550 51 + #define DIV_PERIC0 0x10558 52 + #define DIV_PERIC1 0x1055c 53 + #define DIV_PERIC2 0x10560 54 + #define DIV_PERIC3 0x10564 55 + #define DIV_PERIC4 0x10568 56 + #define DIV_PERIC5 0x1056c 57 + #define GATE_IP_GSCL 0x10920 58 + #define GATE_IP_MFC 0x1092c 59 + #define GATE_IP_GEN 0x10934 60 + #define GATE_IP_FSYS 0x10944 61 + #define GATE_IP_PERIC 0x10950 62 + #define GATE_IP_PERIS 0x10960 63 + #define SRC_CDREX 0x20200 64 + #define PLL_DIV2_SEL 0x20a24 65 + #define GATE_IP_DISP1 0x10928 66 + 67 + /* 68 + * Let each supported clock get a unique id. This id is used to lookup the clock 69 + * for device tree based platforms. The clocks are categorized into three 70 + * sections: core, sclk gate and bus interface gate clocks. 71 + * 72 + * When adding a new clock to this list, it is advised to choose a clock 73 + * category and add it to the end of that category. That is because the the 74 + * device tree source file is referring to these ids and any change in the 75 + * sequence number of existing clocks will require corresponding change in the 76 + * device tree files. This limitation would go away when pre-processor support 77 + * for dtc would be available. 78 + */ 79 + enum exynos5250_clks { 80 + none, 81 + 82 + /* core clocks */ 83 + fin_pll, 84 + 85 + /* gate for special clocks (sclk) */ 86 + sclk_cam_bayer = 128, sclk_cam0, sclk_cam1, sclk_gscl_wa, sclk_gscl_wb, 87 + sclk_fimd1, sclk_mipi1, sclk_dp, sclk_hdmi, sclk_pixel, sclk_audio0, 88 + sclk_mmc0, sclk_mmc1, sclk_mmc2, sclk_mmc3, sclk_sata, sclk_usb3, 89 + sclk_jpeg, sclk_uart0, sclk_uart1, sclk_uart2, sclk_uart3, sclk_pwm, 90 + sclk_audio1, sclk_audio2, sclk_spdif, sclk_spi0, sclk_spi1, sclk_spi2, 91 + 92 + /* gate clocks */ 93 + gscl0 = 256, gscl1, gscl2, gscl3, gscl_wa, gscl_wb, smmu_gscl0, 94 + smmu_gscl1, smmu_gscl2, smmu_gscl3, mfc, smmu_mfcl, smmu_mfcr, rotator, 95 + jpeg, mdma1, smmu_rotator, smmu_jpeg, smmu_mdma1, pdma0, pdma1, sata, 96 + usbotg, mipi_hsi, sdmmc0, sdmmc1, sdmmc2, sdmmc3, sromc, usb2, usb3, 97 + sata_phyctrl, sata_phyi2c, uart0, uart1, uart2, uart3, uart4, i2c0, 98 + i2c1, i2c2, i2c3, i2c4, i2c5, i2c6, i2c7, i2c_hdmi, adc, spi0, spi1, 99 + spi2, i2s1, i2s2, pcm1, pcm2, pwm, spdif, ac97, hsi2c0, hsi2c1, hsi2c2, 100 + hsi2c3, chipid, sysreg, pmu, cmu_top, cmu_core, cmu_mem, tzpc0, tzpc1, 101 + tzpc2, tzpc3, tzpc4, tzpc5, tzpc6, tzpc7, tzpc8, tzpc9, hdmi_cec, mct, 102 + wdt, rtc, tmu, fimd1, mie1, dsim0, dp, mixer, hdmi, 103 + 104 + nr_clks, 105 + }; 106 + 107 + /* 108 + * list of controller registers to be saved and restored during a 109 + * suspend/resume cycle. 110 + */ 111 + static __initdata unsigned long exynos5250_clk_regs[] = { 112 + SRC_CPU, 113 + DIV_CPU0, 114 + SRC_CORE1, 115 + SRC_TOP0, 116 + SRC_TOP2, 117 + SRC_GSCL, 118 + SRC_DISP1_0, 119 + SRC_MAU, 120 + SRC_FSYS, 121 + SRC_GEN, 122 + SRC_PERIC0, 123 + SRC_PERIC1, 124 + SRC_MASK_GSCL, 125 + SRC_MASK_DISP1_0, 126 + SRC_MASK_MAU, 127 + SRC_MASK_FSYS, 128 + SRC_MASK_GEN, 129 + SRC_MASK_PERIC0, 130 + SRC_MASK_PERIC1, 131 + DIV_TOP0, 132 + DIV_TOP1, 133 + DIV_GSCL, 134 + DIV_DISP1_0, 135 + DIV_GEN, 136 + DIV_MAU, 137 + DIV_FSYS0, 138 + DIV_FSYS1, 139 + DIV_FSYS2, 140 + DIV_PERIC0, 141 + DIV_PERIC1, 142 + DIV_PERIC2, 143 + DIV_PERIC3, 144 + DIV_PERIC4, 145 + DIV_PERIC5, 146 + GATE_IP_GSCL, 147 + GATE_IP_MFC, 148 + GATE_IP_GEN, 149 + GATE_IP_FSYS, 150 + GATE_IP_PERIC, 151 + GATE_IP_PERIS, 152 + SRC_CDREX, 153 + PLL_DIV2_SEL, 154 + GATE_IP_DISP1, 155 + }; 156 + 157 + /* list of all parent clock list */ 158 + PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; 159 + PNAME(mout_cpu_p) = { "mout_apll", "mout_mpll", }; 160 + PNAME(mout_mpll_fout_p) = { "fout_mplldiv2", "fout_mpll" }; 161 + PNAME(mout_mpll_p) = { "fin_pll", "mout_mpll_fout" }; 162 + PNAME(mout_bpll_fout_p) = { "fout_bplldiv2", "fout_bpll" }; 163 + PNAME(mout_bpll_p) = { "fin_pll", "mout_bpll_fout" }; 164 + PNAME(mout_vpllsrc_p) = { "fin_pll", "sclk_hdmi27m" }; 165 + PNAME(mout_vpll_p) = { "mout_vpllsrc", "fout_vpll" }; 166 + PNAME(mout_cpll_p) = { "fin_pll", "fout_cpll" }; 167 + PNAME(mout_epll_p) = { "fin_pll", "fout_epll" }; 168 + PNAME(mout_mpll_user_p) = { "fin_pll", "sclk_mpll" }; 169 + PNAME(mout_bpll_user_p) = { "fin_pll", "sclk_bpll" }; 170 + PNAME(mout_aclk166_p) = { "sclk_cpll", "sclk_mpll_user" }; 171 + PNAME(mout_aclk200_p) = { "sclk_mpll_user", "sclk_bpll_user" }; 172 + PNAME(mout_hdmi_p) = { "div_hdmi_pixel", "sclk_hdmiphy" }; 173 + PNAME(mout_usb3_p) = { "sclk_mpll_user", "sclk_cpll" }; 174 + PNAME(mout_group1_p) = { "fin_pll", "fin_pll", "sclk_hdmi27m", 175 + "sclk_dptxphy", "sclk_uhostphy", "sclk_hdmiphy", 176 + "sclk_mpll_user", "sclk_epll", "sclk_vpll", 177 + "sclk_cpll" }; 178 + PNAME(mout_audio0_p) = { "cdclk0", "fin_pll", "sclk_hdmi27m", "sclk_dptxphy", 179 + "sclk_uhostphy", "sclk_hdmiphy", 180 + "sclk_mpll_user", "sclk_epll", "sclk_vpll", 181 + "sclk_cpll" }; 182 + PNAME(mout_audio1_p) = { "cdclk1", "fin_pll", "sclk_hdmi27m", "sclk_dptxphy", 183 + "sclk_uhostphy", "sclk_hdmiphy", 184 + "sclk_mpll_user", "sclk_epll", "sclk_vpll", 185 + "sclk_cpll" }; 186 + PNAME(mout_audio2_p) = { "cdclk2", "fin_pll", "sclk_hdmi27m", "sclk_dptxphy", 187 + "sclk_uhostphy", "sclk_hdmiphy", 188 + "sclk_mpll_user", "sclk_epll", "sclk_vpll", 189 + "sclk_cpll" }; 190 + PNAME(mout_spdif_p) = { "sclk_audio0", "sclk_audio1", "sclk_audio2", 191 + "spdif_extclk" }; 192 + 193 + /* fixed rate clocks generated outside the soc */ 194 + struct samsung_fixed_rate_clock exynos5250_fixed_rate_ext_clks[] __initdata = { 195 + FRATE(fin_pll, "fin_pll", NULL, CLK_IS_ROOT, 0), 196 + }; 197 + 198 + /* fixed rate clocks generated inside the soc */ 199 + struct samsung_fixed_rate_clock exynos5250_fixed_rate_clks[] __initdata = { 200 + FRATE(none, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 24000000), 201 + FRATE(none, "sclk_hdmi27m", NULL, CLK_IS_ROOT, 27000000), 202 + FRATE(none, "sclk_dptxphy", NULL, CLK_IS_ROOT, 24000000), 203 + FRATE(none, "sclk_uhostphy", NULL, CLK_IS_ROOT, 48000000), 204 + }; 205 + 206 + struct samsung_fixed_factor_clock exynos5250_fixed_factor_clks[] __initdata = { 207 + FFACTOR(none, "fout_mplldiv2", "fout_mpll", 1, 2, 0), 208 + FFACTOR(none, "fout_bplldiv2", "fout_bpll", 1, 2, 0), 209 + }; 210 + 211 + struct samsung_mux_clock exynos5250_mux_clks[] __initdata = { 212 + MUX(none, "mout_apll", mout_apll_p, SRC_CPU, 0, 1), 213 + MUX(none, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1), 214 + MUX(none, "mout_mpll_fout", mout_mpll_fout_p, PLL_DIV2_SEL, 4, 1), 215 + MUX(none, "sclk_mpll", mout_mpll_p, SRC_CORE1, 8, 1), 216 + MUX(none, "mout_bpll_fout", mout_bpll_fout_p, PLL_DIV2_SEL, 0, 1), 217 + MUX(none, "sclk_bpll", mout_bpll_p, SRC_CDREX, 0, 1), 218 + MUX(none, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP2, 0, 1), 219 + MUX(none, "sclk_vpll", mout_vpll_p, SRC_TOP2, 16, 1), 220 + MUX(none, "sclk_epll", mout_epll_p, SRC_TOP2, 12, 1), 221 + MUX(none, "sclk_cpll", mout_cpll_p, SRC_TOP2, 8, 1), 222 + MUX(none, "sclk_mpll_user", mout_mpll_user_p, SRC_TOP2, 20, 1), 223 + MUX(none, "sclk_bpll_user", mout_bpll_user_p, SRC_TOP2, 24, 1), 224 + MUX(none, "mout_aclk166", mout_aclk166_p, SRC_TOP0, 8, 1), 225 + MUX(none, "mout_aclk333", mout_aclk166_p, SRC_TOP0, 16, 1), 226 + MUX(none, "mout_aclk200", mout_aclk200_p, SRC_TOP0, 12, 1), 227 + MUX(none, "mout_cam_bayer", mout_group1_p, SRC_GSCL, 12, 4), 228 + MUX(none, "mout_cam0", mout_group1_p, SRC_GSCL, 16, 4), 229 + MUX(none, "mout_cam1", mout_group1_p, SRC_GSCL, 20, 4), 230 + MUX(none, "mout_gscl_wa", mout_group1_p, SRC_GSCL, 24, 4), 231 + MUX(none, "mout_gscl_wb", mout_group1_p, SRC_GSCL, 28, 4), 232 + MUX(none, "mout_fimd1", mout_group1_p, SRC_DISP1_0, 0, 4), 233 + MUX(none, "mout_mipi1", mout_group1_p, SRC_DISP1_0, 12, 4), 234 + MUX(none, "mout_dp", mout_group1_p, SRC_DISP1_0, 16, 4), 235 + MUX(none, "mout_hdmi", mout_hdmi_p, SRC_DISP1_0, 20, 1), 236 + MUX(none, "mout_audio0", mout_audio0_p, SRC_MAU, 0, 4), 237 + MUX(none, "mout_mmc0", mout_group1_p, SRC_FSYS, 0, 4), 238 + MUX(none, "mout_mmc1", mout_group1_p, SRC_FSYS, 4, 4), 239 + MUX(none, "mout_mmc2", mout_group1_p, SRC_FSYS, 8, 4), 240 + MUX(none, "mout_mmc3", mout_group1_p, SRC_FSYS, 12, 4), 241 + MUX(none, "mout_sata", mout_aclk200_p, SRC_FSYS, 24, 1), 242 + MUX(none, "mout_usb3", mout_usb3_p, SRC_FSYS, 28, 1), 243 + MUX(none, "mout_jpeg", mout_group1_p, SRC_GEN, 0, 4), 244 + MUX(none, "mout_uart0", mout_group1_p, SRC_PERIC0, 0, 4), 245 + MUX(none, "mout_uart1", mout_group1_p, SRC_PERIC0, 4, 4), 246 + MUX(none, "mout_uart2", mout_group1_p, SRC_PERIC0, 8, 4), 247 + MUX(none, "mout_uart3", mout_group1_p, SRC_PERIC0, 12, 4), 248 + MUX(none, "mout_pwm", mout_group1_p, SRC_PERIC0, 24, 4), 249 + MUX(none, "mout_audio1", mout_audio1_p, SRC_PERIC1, 0, 4), 250 + MUX(none, "mout_audio2", mout_audio2_p, SRC_PERIC1, 4, 4), 251 + MUX(none, "mout_spdif", mout_spdif_p, SRC_PERIC1, 8, 2), 252 + MUX(none, "mout_spi0", mout_group1_p, SRC_PERIC1, 16, 4), 253 + MUX(none, "mout_spi1", mout_group1_p, SRC_PERIC1, 20, 4), 254 + MUX(none, "mout_spi2", mout_group1_p, SRC_PERIC1, 24, 4), 255 + }; 256 + 257 + struct samsung_div_clock exynos5250_div_clks[] __initdata = { 258 + DIV(none, "div_arm", "mout_cpu", DIV_CPU0, 0, 3), 259 + DIV(none, "sclk_apll", "mout_apll", DIV_CPU0, 24, 3), 260 + DIV(none, "aclk66_pre", "sclk_mpll_user", DIV_TOP1, 24, 3), 261 + DIV(none, "aclk66", "aclk66_pre", DIV_TOP0, 0, 3), 262 + DIV(none, "aclk266", "sclk_mpll_user", DIV_TOP0, 16, 3), 263 + DIV(none, "aclk166", "mout_aclk166", DIV_TOP0, 8, 3), 264 + DIV(none, "aclk333", "mout_aclk333", DIV_TOP0, 20, 3), 265 + DIV(none, "aclk200", "mout_aclk200", DIV_TOP0, 12, 3), 266 + DIV(none, "div_cam_bayer", "mout_cam_bayer", DIV_GSCL, 12, 4), 267 + DIV(none, "div_cam0", "mout_cam0", DIV_GSCL, 16, 4), 268 + DIV(none, "div_cam1", "mout_cam1", DIV_GSCL, 20, 4), 269 + DIV(none, "div_gscl_wa", "mout_gscl_wa", DIV_GSCL, 24, 4), 270 + DIV(none, "div_gscl_wb", "mout_gscl_wb", DIV_GSCL, 28, 4), 271 + DIV(none, "div_fimd1", "mout_fimd1", DIV_DISP1_0, 0, 4), 272 + DIV(none, "div_mipi1", "mout_mipi1", DIV_DISP1_0, 16, 4), 273 + DIV(none, "div_dp", "mout_dp", DIV_DISP1_0, 24, 4), 274 + DIV(none, "div_jpeg", "mout_jpeg", DIV_GEN, 4, 4), 275 + DIV(none, "div_audio0", "mout_audio0", DIV_MAU, 0, 4), 276 + DIV(none, "div_pcm0", "sclk_audio0", DIV_MAU, 4, 8), 277 + DIV(none, "div_sata", "mout_sata", DIV_FSYS0, 20, 4), 278 + DIV(none, "div_usb3", "mout_usb3", DIV_FSYS0, 24, 4), 279 + DIV(none, "div_mmc0", "mout_mmc0", DIV_FSYS1, 0, 4), 280 + DIV(none, "div_mmc1", "mout_mmc1", DIV_FSYS1, 16, 4), 281 + DIV(none, "div_mmc2", "mout_mmc2", DIV_FSYS2, 0, 4), 282 + DIV(none, "div_mmc3", "mout_mmc3", DIV_FSYS2, 16, 4), 283 + DIV(none, "div_uart0", "mout_uart0", DIV_PERIC0, 0, 4), 284 + DIV(none, "div_uart1", "mout_uart1", DIV_PERIC0, 4, 4), 285 + DIV(none, "div_uart2", "mout_uart2", DIV_PERIC0, 8, 4), 286 + DIV(none, "div_uart3", "mout_uart3", DIV_PERIC0, 12, 4), 287 + DIV(none, "div_spi0", "mout_spi0", DIV_PERIC1, 0, 4), 288 + DIV(none, "div_spi1", "mout_spi1", DIV_PERIC1, 16, 4), 289 + DIV(none, "div_spi2", "mout_spi2", DIV_PERIC2, 0, 4), 290 + DIV(none, "div_pwm", "mout_pwm", DIV_PERIC3, 0, 4), 291 + DIV(none, "div_audio1", "mout_audio1", DIV_PERIC4, 0, 4), 292 + DIV(none, "div_pcm1", "sclk_audio1", DIV_PERIC4, 4, 8), 293 + DIV(none, "div_audio2", "mout_audio2", DIV_PERIC4, 16, 4), 294 + DIV(none, "div_pcm2", "sclk_audio2", DIV_PERIC4, 20, 8), 295 + DIV(none, "div_i2s1", "sclk_audio1", DIV_PERIC5, 0, 6), 296 + DIV(none, "div_i2s2", "sclk_audio2", DIV_PERIC5, 8, 6), 297 + DIV(sclk_pixel, "div_hdmi_pixel", "sclk_vpll", DIV_DISP1_0, 28, 4), 298 + DIV_A(none, "armclk", "div_arm", DIV_CPU0, 28, 3, "armclk"), 299 + DIV_F(none, "div_mipi1_pre", "div_mipi1", 300 + DIV_DISP1_0, 20, 4, CLK_SET_RATE_PARENT, 0), 301 + DIV_F(none, "div_mmc_pre0", "div_mmc0", 302 + DIV_FSYS1, 8, 8, CLK_SET_RATE_PARENT, 0), 303 + DIV_F(none, "div_mmc_pre1", "div_mmc1", 304 + DIV_FSYS1, 24, 8, CLK_SET_RATE_PARENT, 0), 305 + DIV_F(none, "div_mmc_pre2", "div_mmc2", 306 + DIV_FSYS2, 8, 8, CLK_SET_RATE_PARENT, 0), 307 + DIV_F(none, "div_mmc_pre3", "div_mmc3", 308 + DIV_FSYS2, 24, 8, CLK_SET_RATE_PARENT, 0), 309 + DIV_F(none, "div_spi_pre0", "div_spi0", 310 + DIV_PERIC1, 8, 8, CLK_SET_RATE_PARENT, 0), 311 + DIV_F(none, "div_spi_pre1", "div_spi1", 312 + DIV_PERIC1, 24, 8, CLK_SET_RATE_PARENT, 0), 313 + DIV_F(none, "div_spi_pre2", "div_spi2", 314 + DIV_PERIC2, 8, 8, CLK_SET_RATE_PARENT, 0), 315 + }; 316 + 317 + struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { 318 + GATE(gscl0, "gscl0", "none", GATE_IP_GSCL, 0, 0, 0), 319 + GATE(gscl1, "gscl1", "none", GATE_IP_GSCL, 1, 0, 0), 320 + GATE(gscl2, "gscl2", "aclk266", GATE_IP_GSCL, 2, 0, 0), 321 + GATE(gscl3, "gscl3", "aclk266", GATE_IP_GSCL, 3, 0, 0), 322 + GATE(gscl_wa, "gscl_wa", "div_gscl_wa", GATE_IP_GSCL, 5, 0, 0), 323 + GATE(gscl_wb, "gscl_wb", "div_gscl_wb", GATE_IP_GSCL, 6, 0, 0), 324 + GATE(smmu_gscl0, "smmu_gscl0", "aclk266", GATE_IP_GSCL, 7, 0, 0), 325 + GATE(smmu_gscl1, "smmu_gscl1", "aclk266", GATE_IP_GSCL, 8, 0, 0), 326 + GATE(smmu_gscl2, "smmu_gscl2", "aclk266", GATE_IP_GSCL, 9, 0, 0), 327 + GATE(smmu_gscl3, "smmu_gscl3", "aclk266", GATE_IP_GSCL, 10, 0, 0), 328 + GATE(mfc, "mfc", "aclk333", GATE_IP_MFC, 0, 0, 0), 329 + GATE(smmu_mfcl, "smmu_mfcl", "aclk333", GATE_IP_MFC, 1, 0, 0), 330 + GATE(smmu_mfcr, "smmu_mfcr", "aclk333", GATE_IP_MFC, 2, 0, 0), 331 + GATE(rotator, "rotator", "aclk266", GATE_IP_GEN, 1, 0, 0), 332 + GATE(jpeg, "jpeg", "aclk166", GATE_IP_GEN, 2, 0, 0), 333 + GATE(mdma1, "mdma1", "aclk266", GATE_IP_GEN, 4, 0, 0), 334 + GATE(smmu_rotator, "smmu_rotator", "aclk266", GATE_IP_GEN, 6, 0, 0), 335 + GATE(smmu_jpeg, "smmu_jpeg", "aclk166", GATE_IP_GEN, 7, 0, 0), 336 + GATE(smmu_mdma1, "smmu_mdma1", "aclk266", GATE_IP_GEN, 9, 0, 0), 337 + GATE(pdma0, "pdma0", "aclk200", GATE_IP_FSYS, 1, 0, 0), 338 + GATE(pdma1, "pdma1", "aclk200", GATE_IP_FSYS, 2, 0, 0), 339 + GATE(sata, "sata", "aclk200", GATE_IP_FSYS, 6, 0, 0), 340 + GATE(usbotg, "usbotg", "aclk200", GATE_IP_FSYS, 7, 0, 0), 341 + GATE(mipi_hsi, "mipi_hsi", "aclk200", GATE_IP_FSYS, 8, 0, 0), 342 + GATE(sdmmc0, "sdmmc0", "aclk200", GATE_IP_FSYS, 12, 0, 0), 343 + GATE(sdmmc1, "sdmmc1", "aclk200", GATE_IP_FSYS, 13, 0, 0), 344 + GATE(sdmmc2, "sdmmc2", "aclk200", GATE_IP_FSYS, 14, 0, 0), 345 + GATE(sdmmc3, "sdmmc3", "aclk200", GATE_IP_FSYS, 15, 0, 0), 346 + GATE(sromc, "sromc", "aclk200", GATE_IP_FSYS, 17, 0, 0), 347 + GATE(usb2, "usb2", "aclk200", GATE_IP_FSYS, 18, 0, 0), 348 + GATE(usb3, "usb3", "aclk200", GATE_IP_FSYS, 19, 0, 0), 349 + GATE(sata_phyctrl, "sata_phyctrl", "aclk200", GATE_IP_FSYS, 24, 0, 0), 350 + GATE(sata_phyi2c, "sata_phyi2c", "aclk200", GATE_IP_FSYS, 25, 0, 0), 351 + GATE(uart0, "uart0", "aclk66", GATE_IP_PERIC, 0, 0, 0), 352 + GATE(uart1, "uart1", "aclk66", GATE_IP_PERIC, 1, 0, 0), 353 + GATE(uart2, "uart2", "aclk66", GATE_IP_PERIC, 2, 0, 0), 354 + GATE(uart3, "uart3", "aclk66", GATE_IP_PERIC, 3, 0, 0), 355 + GATE(uart4, "uart4", "aclk66", GATE_IP_PERIC, 4, 0, 0), 356 + GATE(i2c0, "i2c0", "aclk66", GATE_IP_PERIC, 6, 0, 0), 357 + GATE(i2c1, "i2c1", "aclk66", GATE_IP_PERIC, 7, 0, 0), 358 + GATE(i2c2, "i2c2", "aclk66", GATE_IP_PERIC, 8, 0, 0), 359 + GATE(i2c3, "i2c3", "aclk66", GATE_IP_PERIC, 9, 0, 0), 360 + GATE(i2c4, "i2c4", "aclk66", GATE_IP_PERIC, 10, 0, 0), 361 + GATE(i2c5, "i2c5", "aclk66", GATE_IP_PERIC, 11, 0, 0), 362 + GATE(i2c6, "i2c6", "aclk66", GATE_IP_PERIC, 12, 0, 0), 363 + GATE(i2c7, "i2c7", "aclk66", GATE_IP_PERIC, 13, 0, 0), 364 + GATE(i2c_hdmi, "i2c_hdmi", "aclk66", GATE_IP_PERIC, 14, 0, 0), 365 + GATE(adc, "adc", "aclk66", GATE_IP_PERIC, 15, 0, 0), 366 + GATE(spi0, "spi0", "aclk66", GATE_IP_PERIC, 16, 0, 0), 367 + GATE(spi1, "spi1", "aclk66", GATE_IP_PERIC, 17, 0, 0), 368 + GATE(spi2, "spi2", "aclk66", GATE_IP_PERIC, 18, 0, 0), 369 + GATE(i2s1, "i2s1", "aclk66", GATE_IP_PERIC, 20, 0, 0), 370 + GATE(i2s2, "i2s2", "aclk66", GATE_IP_PERIC, 21, 0, 0), 371 + GATE(pcm1, "pcm1", "aclk66", GATE_IP_PERIC, 22, 0, 0), 372 + GATE(pcm2, "pcm2", "aclk66", GATE_IP_PERIC, 23, 0, 0), 373 + GATE(pwm, "pwm", "aclk66", GATE_IP_PERIC, 24, 0, 0), 374 + GATE(spdif, "spdif", "aclk66", GATE_IP_PERIC, 26, 0, 0), 375 + GATE(ac97, "ac97", "aclk66", GATE_IP_PERIC, 27, 0, 0), 376 + GATE(hsi2c0, "hsi2c0", "aclk66", GATE_IP_PERIC, 28, 0, 0), 377 + GATE(hsi2c1, "hsi2c1", "aclk66", GATE_IP_PERIC, 29, 0, 0), 378 + GATE(hsi2c2, "hsi2c2", "aclk66", GATE_IP_PERIC, 30, 0, 0), 379 + GATE(hsi2c3, "hsi2c3", "aclk66", GATE_IP_PERIC, 31, 0, 0), 380 + GATE(chipid, "chipid", "aclk66", GATE_IP_PERIS, 0, 0, 0), 381 + GATE(sysreg, "sysreg", "aclk66", GATE_IP_PERIS, 1, 0, 0), 382 + GATE(pmu, "pmu", "aclk66", GATE_IP_PERIS, 2, 0, 0), 383 + GATE(tzpc0, "tzpc0", "aclk66", GATE_IP_PERIS, 6, 0, 0), 384 + GATE(tzpc1, "tzpc1", "aclk66", GATE_IP_PERIS, 7, 0, 0), 385 + GATE(tzpc2, "tzpc2", "aclk66", GATE_IP_PERIS, 8, 0, 0), 386 + GATE(tzpc3, "tzpc3", "aclk66", GATE_IP_PERIS, 9, 0, 0), 387 + GATE(tzpc4, "tzpc4", "aclk66", GATE_IP_PERIS, 10, 0, 0), 388 + GATE(tzpc5, "tzpc5", "aclk66", GATE_IP_PERIS, 11, 0, 0), 389 + GATE(tzpc6, "tzpc6", "aclk66", GATE_IP_PERIS, 12, 0, 0), 390 + GATE(tzpc7, "tzpc7", "aclk66", GATE_IP_PERIS, 13, 0, 0), 391 + GATE(tzpc8, "tzpc8", "aclk66", GATE_IP_PERIS, 14, 0, 0), 392 + GATE(tzpc9, "tzpc9", "aclk66", GATE_IP_PERIS, 15, 0, 0), 393 + GATE(hdmi_cec, "hdmi_cec", "aclk66", GATE_IP_PERIS, 16, 0, 0), 394 + GATE(mct, "mct", "aclk66", GATE_IP_PERIS, 18, 0, 0), 395 + GATE(wdt, "wdt", "aclk66", GATE_IP_PERIS, 19, 0, 0), 396 + GATE(rtc, "rtc", "aclk66", GATE_IP_PERIS, 20, 0, 0), 397 + GATE(tmu, "tmu", "aclk66", GATE_IP_PERIS, 21, 0, 0), 398 + GATE(cmu_top, "cmu_top", "aclk66", 399 + GATE_IP_PERIS, 3, CLK_IGNORE_UNUSED, 0), 400 + GATE(cmu_core, "cmu_core", "aclk66", 401 + GATE_IP_PERIS, 4, CLK_IGNORE_UNUSED, 0), 402 + GATE(cmu_mem, "cmu_mem", "aclk66", 403 + GATE_IP_PERIS, 5, CLK_IGNORE_UNUSED, 0), 404 + GATE(sclk_cam_bayer, "sclk_cam_bayer", "div_cam_bayer", 405 + SRC_MASK_GSCL, 12, CLK_SET_RATE_PARENT, 0), 406 + GATE(sclk_cam0, "sclk_cam0", "div_cam0", 407 + SRC_MASK_GSCL, 16, CLK_SET_RATE_PARENT, 0), 408 + GATE(sclk_cam1, "sclk_cam1", "div_cam1", 409 + SRC_MASK_GSCL, 20, CLK_SET_RATE_PARENT, 0), 410 + GATE(sclk_gscl_wa, "sclk_gscl_wa", "div_gscl_wa", 411 + SRC_MASK_GSCL, 24, CLK_SET_RATE_PARENT, 0), 412 + GATE(sclk_gscl_wb, "sclk_gscl_wb", "div_gscl_wb", 413 + SRC_MASK_GSCL, 28, CLK_SET_RATE_PARENT, 0), 414 + GATE(sclk_fimd1, "sclk_fimd1", "div_fimd1", 415 + SRC_MASK_DISP1_0, 0, CLK_SET_RATE_PARENT, 0), 416 + GATE(sclk_mipi1, "sclk_mipi1", "div_mipi1", 417 + SRC_MASK_DISP1_0, 12, CLK_SET_RATE_PARENT, 0), 418 + GATE(sclk_dp, "sclk_dp", "div_dp", 419 + SRC_MASK_DISP1_0, 16, CLK_SET_RATE_PARENT, 0), 420 + GATE(sclk_hdmi, "sclk_hdmi", "mout_hdmi", 421 + SRC_MASK_DISP1_0, 20, 0, 0), 422 + GATE(sclk_audio0, "sclk_audio0", "div_audio0", 423 + SRC_MASK_MAU, 0, CLK_SET_RATE_PARENT, 0), 424 + GATE(sclk_mmc0, "sclk_mmc0", "div_mmc_pre0", 425 + SRC_MASK_FSYS, 0, CLK_SET_RATE_PARENT, 0), 426 + GATE(sclk_mmc1, "sclk_mmc1", "div_mmc_pre1", 427 + SRC_MASK_FSYS, 4, CLK_SET_RATE_PARENT, 0), 428 + GATE(sclk_mmc2, "sclk_mmc2", "div_mmc_pre2", 429 + SRC_MASK_FSYS, 8, CLK_SET_RATE_PARENT, 0), 430 + GATE(sclk_mmc3, "sclk_mmc3", "div_mmc_pre3", 431 + SRC_MASK_FSYS, 12, CLK_SET_RATE_PARENT, 0), 432 + GATE(sclk_sata, "sclk_sata", "div_sata", 433 + SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0), 434 + GATE(sclk_usb3, "sclk_usb3", "div_usb3", 435 + SRC_MASK_FSYS, 28, CLK_SET_RATE_PARENT, 0), 436 + GATE(sclk_jpeg, "sclk_jpeg", "div_jpeg", 437 + SRC_MASK_GEN, 0, CLK_SET_RATE_PARENT, 0), 438 + GATE(sclk_uart0, "sclk_uart0", "div_uart0", 439 + SRC_MASK_PERIC0, 0, CLK_SET_RATE_PARENT, 0), 440 + GATE(sclk_uart1, "sclk_uart1", "div_uart1", 441 + SRC_MASK_PERIC0, 4, CLK_SET_RATE_PARENT, 0), 442 + GATE(sclk_uart2, "sclk_uart2", "div_uart2", 443 + SRC_MASK_PERIC0, 8, CLK_SET_RATE_PARENT, 0), 444 + GATE(sclk_uart3, "sclk_uart3", "div_uart3", 445 + SRC_MASK_PERIC0, 12, CLK_SET_RATE_PARENT, 0), 446 + GATE(sclk_pwm, "sclk_pwm", "div_pwm", 447 + SRC_MASK_PERIC0, 24, CLK_SET_RATE_PARENT, 0), 448 + GATE(sclk_audio1, "sclk_audio1", "div_audio1", 449 + SRC_MASK_PERIC1, 0, CLK_SET_RATE_PARENT, 0), 450 + GATE(sclk_audio2, "sclk_audio2", "div_audio2", 451 + SRC_MASK_PERIC1, 4, CLK_SET_RATE_PARENT, 0), 452 + GATE(sclk_spdif, "sclk_spdif", "mout_spdif", 453 + SRC_MASK_PERIC1, 4, 0, 0), 454 + GATE(sclk_spi0, "sclk_spi0", "div_spi_pre0", 455 + SRC_MASK_PERIC1, 16, CLK_SET_RATE_PARENT, 0), 456 + GATE(sclk_spi1, "sclk_spi1", "div_spi_pre1", 457 + SRC_MASK_PERIC1, 20, CLK_SET_RATE_PARENT, 0), 458 + GATE(sclk_spi2, "sclk_spi2", "div_spi_pre2", 459 + SRC_MASK_PERIC1, 24, CLK_SET_RATE_PARENT, 0), 460 + GATE(fimd1, "fimd1", "aclk200", GATE_IP_DISP1, 0, 0, 0), 461 + GATE(mie1, "mie1", "aclk200", GATE_IP_DISP1, 1, 0, 0), 462 + GATE(dsim0, "dsim0", "aclk200", GATE_IP_DISP1, 3, 0, 0), 463 + GATE(dp, "dp", "aclk200", GATE_IP_DISP1, 4, 0, 0), 464 + GATE(mixer, "mixer", "aclk200", GATE_IP_DISP1, 5, 0, 0), 465 + GATE(hdmi, "hdmi", "aclk200", GATE_IP_DISP1, 6, 0, 0), 466 + }; 467 + 468 + static __initdata struct of_device_id ext_clk_match[] = { 469 + { .compatible = "samsung,clock-xxti", .data = (void *)0, }, 470 + { }, 471 + }; 472 + 473 + /* register exynox5250 clocks */ 474 + void __init exynos5250_clk_init(struct device_node *np) 475 + { 476 + void __iomem *reg_base; 477 + struct clk *apll, *mpll, *epll, *vpll, *bpll, *gpll, *cpll; 478 + 479 + if (np) { 480 + reg_base = of_iomap(np, 0); 481 + if (!reg_base) 482 + panic("%s: failed to map registers\n", __func__); 483 + } else { 484 + panic("%s: unable to determine soc\n", __func__); 485 + } 486 + 487 + samsung_clk_init(np, reg_base, nr_clks, 488 + exynos5250_clk_regs, ARRAY_SIZE(exynos5250_clk_regs), 489 + NULL, 0); 490 + samsung_clk_of_register_fixed_ext(exynos5250_fixed_rate_ext_clks, 491 + ARRAY_SIZE(exynos5250_fixed_rate_ext_clks), 492 + ext_clk_match); 493 + 494 + apll = samsung_clk_register_pll35xx("fout_apll", "fin_pll", 495 + reg_base + 0x100); 496 + mpll = samsung_clk_register_pll35xx("fout_mpll", "fin_pll", 497 + reg_base + 0x4100); 498 + bpll = samsung_clk_register_pll35xx("fout_bpll", "fin_pll", 499 + reg_base + 0x20110); 500 + gpll = samsung_clk_register_pll35xx("fout_gpll", "fin_pll", 501 + reg_base + 0x10150); 502 + cpll = samsung_clk_register_pll35xx("fout_cpll", "fin_pll", 503 + reg_base + 0x10120); 504 + epll = samsung_clk_register_pll36xx("fout_epll", "fin_pll", 505 + reg_base + 0x10130); 506 + vpll = samsung_clk_register_pll36xx("fout_vpll", "mout_vpllsrc", 507 + reg_base + 0x10140); 508 + 509 + samsung_clk_register_fixed_rate(exynos5250_fixed_rate_clks, 510 + ARRAY_SIZE(exynos5250_fixed_rate_clks)); 511 + samsung_clk_register_fixed_factor(exynos5250_fixed_factor_clks, 512 + ARRAY_SIZE(exynos5250_fixed_factor_clks)); 513 + samsung_clk_register_mux(exynos5250_mux_clks, 514 + ARRAY_SIZE(exynos5250_mux_clks)); 515 + samsung_clk_register_div(exynos5250_div_clks, 516 + ARRAY_SIZE(exynos5250_div_clks)); 517 + samsung_clk_register_gate(exynos5250_gate_clks, 518 + ARRAY_SIZE(exynos5250_gate_clks)); 519 + 520 + pr_info("Exynos5250: clock setup completed, armclk=%ld\n", 521 + _get_rate("armclk")); 522 + } 523 + CLK_OF_DECLARE(exynos5250_clk, "samsung,exynos5250-clock", exynos5250_clk_init);
+139
drivers/clk/samsung/clk-exynos5440.c
··· 1 + /* 2 + * Copyright (c) 2013 Samsung Electronics Co., Ltd. 3 + * Author: Thomas Abraham <thomas.ab@samsung.com> 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License version 2 as 7 + * published by the Free Software Foundation. 8 + * 9 + * Common Clock Framework support for Exynos5440 SoC. 10 + */ 11 + 12 + #include <linux/clk.h> 13 + #include <linux/clkdev.h> 14 + #include <linux/clk-provider.h> 15 + #include <linux/of.h> 16 + #include <linux/of_address.h> 17 + 18 + #include <plat/cpu.h> 19 + #include "clk.h" 20 + #include "clk-pll.h" 21 + 22 + #define CLKEN_OV_VAL 0xf8 23 + #define CPU_CLK_STATUS 0xfc 24 + #define MISC_DOUT1 0x558 25 + 26 + /* 27 + * Let each supported clock get a unique id. This id is used to lookup the clock 28 + * for device tree based platforms. 29 + */ 30 + enum exynos5440_clks { 31 + none, xtal, arm_clk, 32 + 33 + spi_baud = 16, pb0_250, pr0_250, pr1_250, b_250, b_125, b_200, sata, 34 + usb, gmac0, cs250, pb0_250_o, pr0_250_o, pr1_250_o, b_250_o, b_125_o, 35 + b_200_o, sata_o, usb_o, gmac0_o, cs250_o, 36 + 37 + nr_clks, 38 + }; 39 + 40 + /* parent clock name list */ 41 + PNAME(mout_armclk_p) = { "cplla", "cpllb" }; 42 + PNAME(mout_spi_p) = { "div125", "div200" }; 43 + 44 + /* fixed rate clocks generated outside the soc */ 45 + struct samsung_fixed_rate_clock exynos5440_fixed_rate_ext_clks[] __initdata = { 46 + FRATE(none, "xtal", NULL, CLK_IS_ROOT, 0), 47 + }; 48 + 49 + /* fixed rate clocks */ 50 + struct samsung_fixed_rate_clock exynos5440_fixed_rate_clks[] __initdata = { 51 + FRATE(none, "ppll", NULL, CLK_IS_ROOT, 1000000000), 52 + FRATE(none, "usb_phy0", NULL, CLK_IS_ROOT, 60000000), 53 + FRATE(none, "usb_phy1", NULL, CLK_IS_ROOT, 60000000), 54 + FRATE(none, "usb_ohci12", NULL, CLK_IS_ROOT, 12000000), 55 + FRATE(none, "usb_ohci48", NULL, CLK_IS_ROOT, 48000000), 56 + }; 57 + 58 + /* fixed factor clocks */ 59 + struct samsung_fixed_factor_clock exynos5440_fixed_factor_clks[] __initdata = { 60 + FFACTOR(none, "div250", "ppll", 1, 4, 0), 61 + FFACTOR(none, "div200", "ppll", 1, 5, 0), 62 + FFACTOR(none, "div125", "div250", 1, 2, 0), 63 + }; 64 + 65 + /* mux clocks */ 66 + struct samsung_mux_clock exynos5440_mux_clks[] __initdata = { 67 + MUX(none, "mout_spi", mout_spi_p, MISC_DOUT1, 5, 1), 68 + MUX_A(arm_clk, "arm_clk", mout_armclk_p, 69 + CPU_CLK_STATUS, 0, 1, "armclk"), 70 + }; 71 + 72 + /* divider clocks */ 73 + struct samsung_div_clock exynos5440_div_clks[] __initdata = { 74 + DIV(spi_baud, "div_spi", "mout_spi", MISC_DOUT1, 3, 2), 75 + }; 76 + 77 + /* gate clocks */ 78 + struct samsung_gate_clock exynos5440_gate_clks[] __initdata = { 79 + GATE(pb0_250, "pb0_250", "div250", CLKEN_OV_VAL, 3, 0, 0), 80 + GATE(pr0_250, "pr0_250", "div250", CLKEN_OV_VAL, 4, 0, 0), 81 + GATE(pr1_250, "pr1_250", "div250", CLKEN_OV_VAL, 5, 0, 0), 82 + GATE(b_250, "b_250", "div250", CLKEN_OV_VAL, 9, 0, 0), 83 + GATE(b_125, "b_125", "div125", CLKEN_OV_VAL, 10, 0, 0), 84 + GATE(b_200, "b_200", "div200", CLKEN_OV_VAL, 11, 0, 0), 85 + GATE(sata, "sata", "div200", CLKEN_OV_VAL, 12, 0, 0), 86 + GATE(usb, "usb", "div200", CLKEN_OV_VAL, 13, 0, 0), 87 + GATE(gmac0, "gmac0", "div200", CLKEN_OV_VAL, 14, 0, 0), 88 + GATE(cs250, "cs250", "div250", CLKEN_OV_VAL, 19, 0, 0), 89 + GATE(pb0_250_o, "pb0_250_o", "pb0_250", CLKEN_OV_VAL, 3, 0, 0), 90 + GATE(pr0_250_o, "pr0_250_o", "pr0_250", CLKEN_OV_VAL, 4, 0, 0), 91 + GATE(pr1_250_o, "pr1_250_o", "pr1_250", CLKEN_OV_VAL, 5, 0, 0), 92 + GATE(b_250_o, "b_250_o", "b_250", CLKEN_OV_VAL, 9, 0, 0), 93 + GATE(b_125_o, "b_125_o", "b_125", CLKEN_OV_VAL, 10, 0, 0), 94 + GATE(b_200_o, "b_200_o", "b_200", CLKEN_OV_VAL, 11, 0, 0), 95 + GATE(sata_o, "sata_o", "sata", CLKEN_OV_VAL, 12, 0, 0), 96 + GATE(usb_o, "usb_o", "usb", CLKEN_OV_VAL, 13, 0, 0), 97 + GATE(gmac0_o, "gmac0_o", "gmac", CLKEN_OV_VAL, 14, 0, 0), 98 + GATE(cs250_o, "cs250_o", "cs250", CLKEN_OV_VAL, 19, 0, 0), 99 + }; 100 + 101 + static __initdata struct of_device_id ext_clk_match[] = { 102 + { .compatible = "samsung,clock-xtal", .data = (void *)0, }, 103 + {}, 104 + }; 105 + 106 + /* register exynos5440 clocks */ 107 + void __init exynos5440_clk_init(struct device_node *np) 108 + { 109 + void __iomem *reg_base; 110 + 111 + reg_base = of_iomap(np, 0); 112 + if (!reg_base) { 113 + pr_err("%s: failed to map clock controller registers," 114 + " aborting clock initialization\n", __func__); 115 + return; 116 + } 117 + 118 + samsung_clk_init(np, reg_base, nr_clks, NULL, 0, NULL, 0); 119 + samsung_clk_of_register_fixed_ext(exynos5440_fixed_rate_ext_clks, 120 + ARRAY_SIZE(exynos5440_fixed_rate_ext_clks), ext_clk_match); 121 + 122 + samsung_clk_register_pll2550x("cplla", "xtal", reg_base + 0x1c, 0x10); 123 + samsung_clk_register_pll2550x("cpllb", "xtal", reg_base + 0x20, 0x10); 124 + 125 + samsung_clk_register_fixed_rate(exynos5440_fixed_rate_clks, 126 + ARRAY_SIZE(exynos5440_fixed_rate_clks)); 127 + samsung_clk_register_fixed_factor(exynos5440_fixed_factor_clks, 128 + ARRAY_SIZE(exynos5440_fixed_factor_clks)); 129 + samsung_clk_register_mux(exynos5440_mux_clks, 130 + ARRAY_SIZE(exynos5440_mux_clks)); 131 + samsung_clk_register_div(exynos5440_div_clks, 132 + ARRAY_SIZE(exynos5440_div_clks)); 133 + samsung_clk_register_gate(exynos5440_gate_clks, 134 + ARRAY_SIZE(exynos5440_gate_clks)); 135 + 136 + pr_info("Exynos5440: arm_clk = %ldHz\n", _get_rate("armclk")); 137 + pr_info("exynos5440 clock initialization complete\n"); 138 + } 139 + CLK_OF_DECLARE(exynos5440_clk, "samsung,exynos5440-clock", exynos5440_clk_init);
+419
drivers/clk/samsung/clk-pll.c
··· 1 + /* 2 + * Copyright (c) 2013 Samsung Electronics Co., Ltd. 3 + * Copyright (c) 2013 Linaro Ltd. 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License version 2 as 7 + * published by the Free Software Foundation. 8 + * 9 + * This file contains the utility functions to register the pll clocks. 10 + */ 11 + 12 + #include <linux/errno.h> 13 + #include "clk.h" 14 + #include "clk-pll.h" 15 + 16 + /* 17 + * PLL35xx Clock Type 18 + */ 19 + 20 + #define PLL35XX_MDIV_MASK (0x3FF) 21 + #define PLL35XX_PDIV_MASK (0x3F) 22 + #define PLL35XX_SDIV_MASK (0x7) 23 + #define PLL35XX_MDIV_SHIFT (16) 24 + #define PLL35XX_PDIV_SHIFT (8) 25 + #define PLL35XX_SDIV_SHIFT (0) 26 + 27 + struct samsung_clk_pll35xx { 28 + struct clk_hw hw; 29 + const void __iomem *con_reg; 30 + }; 31 + 32 + #define to_clk_pll35xx(_hw) container_of(_hw, struct samsung_clk_pll35xx, hw) 33 + 34 + static unsigned long samsung_pll35xx_recalc_rate(struct clk_hw *hw, 35 + unsigned long parent_rate) 36 + { 37 + struct samsung_clk_pll35xx *pll = to_clk_pll35xx(hw); 38 + u32 mdiv, pdiv, sdiv, pll_con; 39 + u64 fvco = parent_rate; 40 + 41 + pll_con = __raw_readl(pll->con_reg); 42 + mdiv = (pll_con >> PLL35XX_MDIV_SHIFT) & PLL35XX_MDIV_MASK; 43 + pdiv = (pll_con >> PLL35XX_PDIV_SHIFT) & PLL35XX_PDIV_MASK; 44 + sdiv = (pll_con >> PLL35XX_SDIV_SHIFT) & PLL35XX_SDIV_MASK; 45 + 46 + fvco *= mdiv; 47 + do_div(fvco, (pdiv << sdiv)); 48 + 49 + return (unsigned long)fvco; 50 + } 51 + 52 + static const struct clk_ops samsung_pll35xx_clk_ops = { 53 + .recalc_rate = samsung_pll35xx_recalc_rate, 54 + }; 55 + 56 + struct clk * __init samsung_clk_register_pll35xx(const char *name, 57 + const char *pname, const void __iomem *con_reg) 58 + { 59 + struct samsung_clk_pll35xx *pll; 60 + struct clk *clk; 61 + struct clk_init_data init; 62 + 63 + pll = kzalloc(sizeof(*pll), GFP_KERNEL); 64 + if (!pll) { 65 + pr_err("%s: could not allocate pll clk %s\n", __func__, name); 66 + return NULL; 67 + } 68 + 69 + init.name = name; 70 + init.ops = &samsung_pll35xx_clk_ops; 71 + init.flags = CLK_GET_RATE_NOCACHE; 72 + init.parent_names = &pname; 73 + init.num_parents = 1; 74 + 75 + pll->hw.init = &init; 76 + pll->con_reg = con_reg; 77 + 78 + clk = clk_register(NULL, &pll->hw); 79 + if (IS_ERR(clk)) { 80 + pr_err("%s: failed to register pll clock %s\n", __func__, 81 + name); 82 + kfree(pll); 83 + } 84 + 85 + if (clk_register_clkdev(clk, name, NULL)) 86 + pr_err("%s: failed to register lookup for %s", __func__, name); 87 + 88 + return clk; 89 + } 90 + 91 + /* 92 + * PLL36xx Clock Type 93 + */ 94 + 95 + #define PLL36XX_KDIV_MASK (0xFFFF) 96 + #define PLL36XX_MDIV_MASK (0x1FF) 97 + #define PLL36XX_PDIV_MASK (0x3F) 98 + #define PLL36XX_SDIV_MASK (0x7) 99 + #define PLL36XX_MDIV_SHIFT (16) 100 + #define PLL36XX_PDIV_SHIFT (8) 101 + #define PLL36XX_SDIV_SHIFT (0) 102 + 103 + struct samsung_clk_pll36xx { 104 + struct clk_hw hw; 105 + const void __iomem *con_reg; 106 + }; 107 + 108 + #define to_clk_pll36xx(_hw) container_of(_hw, struct samsung_clk_pll36xx, hw) 109 + 110 + static unsigned long samsung_pll36xx_recalc_rate(struct clk_hw *hw, 111 + unsigned long parent_rate) 112 + { 113 + struct samsung_clk_pll36xx *pll = to_clk_pll36xx(hw); 114 + u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1; 115 + u64 fvco = parent_rate; 116 + 117 + pll_con0 = __raw_readl(pll->con_reg); 118 + pll_con1 = __raw_readl(pll->con_reg + 4); 119 + mdiv = (pll_con0 >> PLL36XX_MDIV_SHIFT) & PLL36XX_MDIV_MASK; 120 + pdiv = (pll_con0 >> PLL36XX_PDIV_SHIFT) & PLL36XX_PDIV_MASK; 121 + sdiv = (pll_con0 >> PLL36XX_SDIV_SHIFT) & PLL36XX_SDIV_MASK; 122 + kdiv = pll_con1 & PLL36XX_KDIV_MASK; 123 + 124 + fvco *= (mdiv << 16) + kdiv; 125 + do_div(fvco, (pdiv << sdiv)); 126 + fvco >>= 16; 127 + 128 + return (unsigned long)fvco; 129 + } 130 + 131 + static const struct clk_ops samsung_pll36xx_clk_ops = { 132 + .recalc_rate = samsung_pll36xx_recalc_rate, 133 + }; 134 + 135 + struct clk * __init samsung_clk_register_pll36xx(const char *name, 136 + const char *pname, const void __iomem *con_reg) 137 + { 138 + struct samsung_clk_pll36xx *pll; 139 + struct clk *clk; 140 + struct clk_init_data init; 141 + 142 + pll = kzalloc(sizeof(*pll), GFP_KERNEL); 143 + if (!pll) { 144 + pr_err("%s: could not allocate pll clk %s\n", __func__, name); 145 + return NULL; 146 + } 147 + 148 + init.name = name; 149 + init.ops = &samsung_pll36xx_clk_ops; 150 + init.flags = CLK_GET_RATE_NOCACHE; 151 + init.parent_names = &pname; 152 + init.num_parents = 1; 153 + 154 + pll->hw.init = &init; 155 + pll->con_reg = con_reg; 156 + 157 + clk = clk_register(NULL, &pll->hw); 158 + if (IS_ERR(clk)) { 159 + pr_err("%s: failed to register pll clock %s\n", __func__, 160 + name); 161 + kfree(pll); 162 + } 163 + 164 + if (clk_register_clkdev(clk, name, NULL)) 165 + pr_err("%s: failed to register lookup for %s", __func__, name); 166 + 167 + return clk; 168 + } 169 + 170 + /* 171 + * PLL45xx Clock Type 172 + */ 173 + 174 + #define PLL45XX_MDIV_MASK (0x3FF) 175 + #define PLL45XX_PDIV_MASK (0x3F) 176 + #define PLL45XX_SDIV_MASK (0x7) 177 + #define PLL45XX_MDIV_SHIFT (16) 178 + #define PLL45XX_PDIV_SHIFT (8) 179 + #define PLL45XX_SDIV_SHIFT (0) 180 + 181 + struct samsung_clk_pll45xx { 182 + struct clk_hw hw; 183 + enum pll45xx_type type; 184 + const void __iomem *con_reg; 185 + }; 186 + 187 + #define to_clk_pll45xx(_hw) container_of(_hw, struct samsung_clk_pll45xx, hw) 188 + 189 + static unsigned long samsung_pll45xx_recalc_rate(struct clk_hw *hw, 190 + unsigned long parent_rate) 191 + { 192 + struct samsung_clk_pll45xx *pll = to_clk_pll45xx(hw); 193 + u32 mdiv, pdiv, sdiv, pll_con; 194 + u64 fvco = parent_rate; 195 + 196 + pll_con = __raw_readl(pll->con_reg); 197 + mdiv = (pll_con >> PLL45XX_MDIV_SHIFT) & PLL45XX_MDIV_MASK; 198 + pdiv = (pll_con >> PLL45XX_PDIV_SHIFT) & PLL45XX_PDIV_MASK; 199 + sdiv = (pll_con >> PLL45XX_SDIV_SHIFT) & PLL45XX_SDIV_MASK; 200 + 201 + if (pll->type == pll_4508) 202 + sdiv = sdiv - 1; 203 + 204 + fvco *= mdiv; 205 + do_div(fvco, (pdiv << sdiv)); 206 + 207 + return (unsigned long)fvco; 208 + } 209 + 210 + static const struct clk_ops samsung_pll45xx_clk_ops = { 211 + .recalc_rate = samsung_pll45xx_recalc_rate, 212 + }; 213 + 214 + struct clk * __init samsung_clk_register_pll45xx(const char *name, 215 + const char *pname, const void __iomem *con_reg, 216 + enum pll45xx_type type) 217 + { 218 + struct samsung_clk_pll45xx *pll; 219 + struct clk *clk; 220 + struct clk_init_data init; 221 + 222 + pll = kzalloc(sizeof(*pll), GFP_KERNEL); 223 + if (!pll) { 224 + pr_err("%s: could not allocate pll clk %s\n", __func__, name); 225 + return NULL; 226 + } 227 + 228 + init.name = name; 229 + init.ops = &samsung_pll45xx_clk_ops; 230 + init.flags = CLK_GET_RATE_NOCACHE; 231 + init.parent_names = &pname; 232 + init.num_parents = 1; 233 + 234 + pll->hw.init = &init; 235 + pll->con_reg = con_reg; 236 + pll->type = type; 237 + 238 + clk = clk_register(NULL, &pll->hw); 239 + if (IS_ERR(clk)) { 240 + pr_err("%s: failed to register pll clock %s\n", __func__, 241 + name); 242 + kfree(pll); 243 + } 244 + 245 + if (clk_register_clkdev(clk, name, NULL)) 246 + pr_err("%s: failed to register lookup for %s", __func__, name); 247 + 248 + return clk; 249 + } 250 + 251 + /* 252 + * PLL46xx Clock Type 253 + */ 254 + 255 + #define PLL46XX_MDIV_MASK (0x1FF) 256 + #define PLL46XX_PDIV_MASK (0x3F) 257 + #define PLL46XX_SDIV_MASK (0x7) 258 + #define PLL46XX_MDIV_SHIFT (16) 259 + #define PLL46XX_PDIV_SHIFT (8) 260 + #define PLL46XX_SDIV_SHIFT (0) 261 + 262 + #define PLL46XX_KDIV_MASK (0xFFFF) 263 + #define PLL4650C_KDIV_MASK (0xFFF) 264 + #define PLL46XX_KDIV_SHIFT (0) 265 + 266 + struct samsung_clk_pll46xx { 267 + struct clk_hw hw; 268 + enum pll46xx_type type; 269 + const void __iomem *con_reg; 270 + }; 271 + 272 + #define to_clk_pll46xx(_hw) container_of(_hw, struct samsung_clk_pll46xx, hw) 273 + 274 + static unsigned long samsung_pll46xx_recalc_rate(struct clk_hw *hw, 275 + unsigned long parent_rate) 276 + { 277 + struct samsung_clk_pll46xx *pll = to_clk_pll46xx(hw); 278 + u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1, shift; 279 + u64 fvco = parent_rate; 280 + 281 + pll_con0 = __raw_readl(pll->con_reg); 282 + pll_con1 = __raw_readl(pll->con_reg + 4); 283 + mdiv = (pll_con0 >> PLL46XX_MDIV_SHIFT) & PLL46XX_MDIV_MASK; 284 + pdiv = (pll_con0 >> PLL46XX_PDIV_SHIFT) & PLL46XX_PDIV_MASK; 285 + sdiv = (pll_con0 >> PLL46XX_SDIV_SHIFT) & PLL46XX_SDIV_MASK; 286 + kdiv = pll->type == pll_4650c ? pll_con1 & PLL4650C_KDIV_MASK : 287 + pll_con1 & PLL46XX_KDIV_MASK; 288 + 289 + shift = pll->type == pll_4600 ? 16 : 10; 290 + fvco *= (mdiv << shift) + kdiv; 291 + do_div(fvco, (pdiv << sdiv)); 292 + fvco >>= shift; 293 + 294 + return (unsigned long)fvco; 295 + } 296 + 297 + static const struct clk_ops samsung_pll46xx_clk_ops = { 298 + .recalc_rate = samsung_pll46xx_recalc_rate, 299 + }; 300 + 301 + struct clk * __init samsung_clk_register_pll46xx(const char *name, 302 + const char *pname, const void __iomem *con_reg, 303 + enum pll46xx_type type) 304 + { 305 + struct samsung_clk_pll46xx *pll; 306 + struct clk *clk; 307 + struct clk_init_data init; 308 + 309 + pll = kzalloc(sizeof(*pll), GFP_KERNEL); 310 + if (!pll) { 311 + pr_err("%s: could not allocate pll clk %s\n", __func__, name); 312 + return NULL; 313 + } 314 + 315 + init.name = name; 316 + init.ops = &samsung_pll46xx_clk_ops; 317 + init.flags = CLK_GET_RATE_NOCACHE; 318 + init.parent_names = &pname; 319 + init.num_parents = 1; 320 + 321 + pll->hw.init = &init; 322 + pll->con_reg = con_reg; 323 + pll->type = type; 324 + 325 + clk = clk_register(NULL, &pll->hw); 326 + if (IS_ERR(clk)) { 327 + pr_err("%s: failed to register pll clock %s\n", __func__, 328 + name); 329 + kfree(pll); 330 + } 331 + 332 + if (clk_register_clkdev(clk, name, NULL)) 333 + pr_err("%s: failed to register lookup for %s", __func__, name); 334 + 335 + return clk; 336 + } 337 + 338 + /* 339 + * PLL2550x Clock Type 340 + */ 341 + 342 + #define PLL2550X_R_MASK (0x1) 343 + #define PLL2550X_P_MASK (0x3F) 344 + #define PLL2550X_M_MASK (0x3FF) 345 + #define PLL2550X_S_MASK (0x7) 346 + #define PLL2550X_R_SHIFT (20) 347 + #define PLL2550X_P_SHIFT (14) 348 + #define PLL2550X_M_SHIFT (4) 349 + #define PLL2550X_S_SHIFT (0) 350 + 351 + struct samsung_clk_pll2550x { 352 + struct clk_hw hw; 353 + const void __iomem *reg_base; 354 + unsigned long offset; 355 + }; 356 + 357 + #define to_clk_pll2550x(_hw) container_of(_hw, struct samsung_clk_pll2550x, hw) 358 + 359 + static unsigned long samsung_pll2550x_recalc_rate(struct clk_hw *hw, 360 + unsigned long parent_rate) 361 + { 362 + struct samsung_clk_pll2550x *pll = to_clk_pll2550x(hw); 363 + u32 r, p, m, s, pll_stat; 364 + u64 fvco = parent_rate; 365 + 366 + pll_stat = __raw_readl(pll->reg_base + pll->offset * 3); 367 + r = (pll_stat >> PLL2550X_R_SHIFT) & PLL2550X_R_MASK; 368 + if (!r) 369 + return 0; 370 + p = (pll_stat >> PLL2550X_P_SHIFT) & PLL2550X_P_MASK; 371 + m = (pll_stat >> PLL2550X_M_SHIFT) & PLL2550X_M_MASK; 372 + s = (pll_stat >> PLL2550X_S_SHIFT) & PLL2550X_S_MASK; 373 + 374 + fvco *= m; 375 + do_div(fvco, (p << s)); 376 + 377 + return (unsigned long)fvco; 378 + } 379 + 380 + static const struct clk_ops samsung_pll2550x_clk_ops = { 381 + .recalc_rate = samsung_pll2550x_recalc_rate, 382 + }; 383 + 384 + struct clk * __init samsung_clk_register_pll2550x(const char *name, 385 + const char *pname, const void __iomem *reg_base, 386 + const unsigned long offset) 387 + { 388 + struct samsung_clk_pll2550x *pll; 389 + struct clk *clk; 390 + struct clk_init_data init; 391 + 392 + pll = kzalloc(sizeof(*pll), GFP_KERNEL); 393 + if (!pll) { 394 + pr_err("%s: could not allocate pll clk %s\n", __func__, name); 395 + return NULL; 396 + } 397 + 398 + init.name = name; 399 + init.ops = &samsung_pll2550x_clk_ops; 400 + init.flags = CLK_GET_RATE_NOCACHE; 401 + init.parent_names = &pname; 402 + init.num_parents = 1; 403 + 404 + pll->hw.init = &init; 405 + pll->reg_base = reg_base; 406 + pll->offset = offset; 407 + 408 + clk = clk_register(NULL, &pll->hw); 409 + if (IS_ERR(clk)) { 410 + pr_err("%s: failed to register pll clock %s\n", __func__, 411 + name); 412 + kfree(pll); 413 + } 414 + 415 + if (clk_register_clkdev(clk, name, NULL)) 416 + pr_err("%s: failed to register lookup for %s", __func__, name); 417 + 418 + return clk; 419 + }
+41
drivers/clk/samsung/clk-pll.h
··· 1 + /* 2 + * Copyright (c) 2013 Samsung Electronics Co., Ltd. 3 + * Copyright (c) 2013 Linaro Ltd. 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License version 2 as 7 + * published by the Free Software Foundation. 8 + * 9 + * Common Clock Framework support for all PLL's in Samsung platforms 10 + */ 11 + 12 + #ifndef __SAMSUNG_CLK_PLL_H 13 + #define __SAMSUNG_CLK_PLL_H 14 + 15 + enum pll45xx_type { 16 + pll_4500, 17 + pll_4502, 18 + pll_4508 19 + }; 20 + 21 + enum pll46xx_type { 22 + pll_4600, 23 + pll_4650, 24 + pll_4650c, 25 + }; 26 + 27 + extern struct clk * __init samsung_clk_register_pll35xx(const char *name, 28 + const char *pname, const void __iomem *con_reg); 29 + extern struct clk * __init samsung_clk_register_pll36xx(const char *name, 30 + const char *pname, const void __iomem *con_reg); 31 + extern struct clk * __init samsung_clk_register_pll45xx(const char *name, 32 + const char *pname, const void __iomem *con_reg, 33 + enum pll45xx_type type); 34 + extern struct clk * __init samsung_clk_register_pll46xx(const char *name, 35 + const char *pname, const void __iomem *con_reg, 36 + enum pll46xx_type type); 37 + extern struct clk * __init samsung_clk_register_pll2550x(const char *name, 38 + const char *pname, const void __iomem *reg_base, 39 + const unsigned long offset); 40 + 41 + #endif /* __SAMSUNG_CLK_PLL_H */
+320
drivers/clk/samsung/clk.c
··· 1 + /* 2 + * Copyright (c) 2013 Samsung Electronics Co., Ltd. 3 + * Copyright (c) 2013 Linaro Ltd. 4 + * Author: Thomas Abraham <thomas.ab@samsung.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 version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + * This file includes utility functions to register clocks to common 11 + * clock framework for Samsung platforms. 12 + */ 13 + 14 + #include <linux/syscore_ops.h> 15 + #include "clk.h" 16 + 17 + static DEFINE_SPINLOCK(lock); 18 + static struct clk **clk_table; 19 + static void __iomem *reg_base; 20 + #ifdef CONFIG_OF 21 + static struct clk_onecell_data clk_data; 22 + #endif 23 + 24 + #ifdef CONFIG_PM_SLEEP 25 + static struct samsung_clk_reg_dump *reg_dump; 26 + static unsigned long nr_reg_dump; 27 + 28 + static int samsung_clk_suspend(void) 29 + { 30 + struct samsung_clk_reg_dump *rd = reg_dump; 31 + unsigned long i; 32 + 33 + for (i = 0; i < nr_reg_dump; i++, rd++) 34 + rd->value = __raw_readl(reg_base + rd->offset); 35 + 36 + return 0; 37 + } 38 + 39 + static void samsung_clk_resume(void) 40 + { 41 + struct samsung_clk_reg_dump *rd = reg_dump; 42 + unsigned long i; 43 + 44 + for (i = 0; i < nr_reg_dump; i++, rd++) 45 + __raw_writel(rd->value, reg_base + rd->offset); 46 + } 47 + 48 + static struct syscore_ops samsung_clk_syscore_ops = { 49 + .suspend = samsung_clk_suspend, 50 + .resume = samsung_clk_resume, 51 + }; 52 + #endif /* CONFIG_PM_SLEEP */ 53 + 54 + /* setup the essentials required to support clock lookup using ccf */ 55 + void __init samsung_clk_init(struct device_node *np, void __iomem *base, 56 + unsigned long nr_clks, unsigned long *rdump, 57 + unsigned long nr_rdump, unsigned long *soc_rdump, 58 + unsigned long nr_soc_rdump) 59 + { 60 + reg_base = base; 61 + 62 + #ifdef CONFIG_PM_SLEEP 63 + if (rdump && nr_rdump) { 64 + unsigned int idx; 65 + reg_dump = kzalloc(sizeof(struct samsung_clk_reg_dump) 66 + * (nr_rdump + nr_soc_rdump), GFP_KERNEL); 67 + if (!reg_dump) { 68 + pr_err("%s: memory alloc for register dump failed\n", 69 + __func__); 70 + return; 71 + } 72 + 73 + for (idx = 0; idx < nr_rdump; idx++) 74 + reg_dump[idx].offset = rdump[idx]; 75 + for (idx = 0; idx < nr_soc_rdump; idx++) 76 + reg_dump[nr_rdump + idx].offset = soc_rdump[idx]; 77 + nr_reg_dump = nr_rdump + nr_soc_rdump; 78 + register_syscore_ops(&samsung_clk_syscore_ops); 79 + } 80 + #endif 81 + 82 + clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL); 83 + if (!clk_table) 84 + panic("could not allocate clock lookup table\n"); 85 + 86 + if (!np) 87 + return; 88 + 89 + #ifdef CONFIG_OF 90 + clk_data.clks = clk_table; 91 + clk_data.clk_num = nr_clks; 92 + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 93 + #endif 94 + } 95 + 96 + /* add a clock instance to the clock lookup table used for dt based lookup */ 97 + void samsung_clk_add_lookup(struct clk *clk, unsigned int id) 98 + { 99 + if (clk_table && id) 100 + clk_table[id] = clk; 101 + } 102 + 103 + /* register a list of aliases */ 104 + void __init samsung_clk_register_alias(struct samsung_clock_alias *list, 105 + unsigned int nr_clk) 106 + { 107 + struct clk *clk; 108 + unsigned int idx, ret; 109 + 110 + if (!clk_table) { 111 + pr_err("%s: clock table missing\n", __func__); 112 + return; 113 + } 114 + 115 + for (idx = 0; idx < nr_clk; idx++, list++) { 116 + if (!list->id) { 117 + pr_err("%s: clock id missing for index %d\n", __func__, 118 + idx); 119 + continue; 120 + } 121 + 122 + clk = clk_table[list->id]; 123 + if (!clk) { 124 + pr_err("%s: failed to find clock %d\n", __func__, 125 + list->id); 126 + continue; 127 + } 128 + 129 + ret = clk_register_clkdev(clk, list->alias, list->dev_name); 130 + if (ret) 131 + pr_err("%s: failed to register lookup %s\n", 132 + __func__, list->alias); 133 + } 134 + } 135 + 136 + /* register a list of fixed clocks */ 137 + void __init samsung_clk_register_fixed_rate( 138 + struct samsung_fixed_rate_clock *list, unsigned int nr_clk) 139 + { 140 + struct clk *clk; 141 + unsigned int idx, ret; 142 + 143 + for (idx = 0; idx < nr_clk; idx++, list++) { 144 + clk = clk_register_fixed_rate(NULL, list->name, 145 + list->parent_name, list->flags, list->fixed_rate); 146 + if (IS_ERR(clk)) { 147 + pr_err("%s: failed to register clock %s\n", __func__, 148 + list->name); 149 + continue; 150 + } 151 + 152 + samsung_clk_add_lookup(clk, list->id); 153 + 154 + /* 155 + * Unconditionally add a clock lookup for the fixed rate clocks. 156 + * There are not many of these on any of Samsung platforms. 157 + */ 158 + ret = clk_register_clkdev(clk, list->name, NULL); 159 + if (ret) 160 + pr_err("%s: failed to register clock lookup for %s", 161 + __func__, list->name); 162 + } 163 + } 164 + 165 + /* register a list of fixed factor clocks */ 166 + void __init samsung_clk_register_fixed_factor( 167 + struct samsung_fixed_factor_clock *list, unsigned int nr_clk) 168 + { 169 + struct clk *clk; 170 + unsigned int idx; 171 + 172 + for (idx = 0; idx < nr_clk; idx++, list++) { 173 + clk = clk_register_fixed_factor(NULL, list->name, 174 + list->parent_name, list->flags, list->mult, list->div); 175 + if (IS_ERR(clk)) { 176 + pr_err("%s: failed to register clock %s\n", __func__, 177 + list->name); 178 + continue; 179 + } 180 + 181 + samsung_clk_add_lookup(clk, list->id); 182 + } 183 + } 184 + 185 + /* register a list of mux clocks */ 186 + void __init samsung_clk_register_mux(struct samsung_mux_clock *list, 187 + unsigned int nr_clk) 188 + { 189 + struct clk *clk; 190 + unsigned int idx, ret; 191 + 192 + for (idx = 0; idx < nr_clk; idx++, list++) { 193 + clk = clk_register_mux(NULL, list->name, list->parent_names, 194 + list->num_parents, list->flags, reg_base + list->offset, 195 + list->shift, list->width, list->mux_flags, &lock); 196 + if (IS_ERR(clk)) { 197 + pr_err("%s: failed to register clock %s\n", __func__, 198 + list->name); 199 + continue; 200 + } 201 + 202 + samsung_clk_add_lookup(clk, list->id); 203 + 204 + /* register a clock lookup only if a clock alias is specified */ 205 + if (list->alias) { 206 + ret = clk_register_clkdev(clk, list->alias, 207 + list->dev_name); 208 + if (ret) 209 + pr_err("%s: failed to register lookup %s\n", 210 + __func__, list->alias); 211 + } 212 + } 213 + } 214 + 215 + /* register a list of div clocks */ 216 + void __init samsung_clk_register_div(struct samsung_div_clock *list, 217 + unsigned int nr_clk) 218 + { 219 + struct clk *clk; 220 + unsigned int idx, ret; 221 + 222 + for (idx = 0; idx < nr_clk; idx++, list++) { 223 + if (list->table) 224 + clk = clk_register_divider_table(NULL, list->name, 225 + list->parent_name, list->flags, 226 + reg_base + list->offset, list->shift, 227 + list->width, list->div_flags, 228 + list->table, &lock); 229 + else 230 + clk = clk_register_divider(NULL, list->name, 231 + list->parent_name, list->flags, 232 + reg_base + list->offset, list->shift, 233 + list->width, list->div_flags, &lock); 234 + if (IS_ERR(clk)) { 235 + pr_err("%s: failed to register clock %s\n", __func__, 236 + list->name); 237 + continue; 238 + } 239 + 240 + samsung_clk_add_lookup(clk, list->id); 241 + 242 + /* register a clock lookup only if a clock alias is specified */ 243 + if (list->alias) { 244 + ret = clk_register_clkdev(clk, list->alias, 245 + list->dev_name); 246 + if (ret) 247 + pr_err("%s: failed to register lookup %s\n", 248 + __func__, list->alias); 249 + } 250 + } 251 + } 252 + 253 + /* register a list of gate clocks */ 254 + void __init samsung_clk_register_gate(struct samsung_gate_clock *list, 255 + unsigned int nr_clk) 256 + { 257 + struct clk *clk; 258 + unsigned int idx, ret; 259 + 260 + for (idx = 0; idx < nr_clk; idx++, list++) { 261 + clk = clk_register_gate(NULL, list->name, list->parent_name, 262 + list->flags, reg_base + list->offset, 263 + list->bit_idx, list->gate_flags, &lock); 264 + if (IS_ERR(clk)) { 265 + pr_err("%s: failed to register clock %s\n", __func__, 266 + list->name); 267 + continue; 268 + } 269 + 270 + /* register a clock lookup only if a clock alias is specified */ 271 + if (list->alias) { 272 + ret = clk_register_clkdev(clk, list->alias, 273 + list->dev_name); 274 + if (ret) 275 + pr_err("%s: failed to register lookup %s\n", 276 + __func__, list->alias); 277 + } 278 + 279 + samsung_clk_add_lookup(clk, list->id); 280 + } 281 + } 282 + 283 + /* 284 + * obtain the clock speed of all external fixed clock sources from device 285 + * tree and register it 286 + */ 287 + #ifdef CONFIG_OF 288 + void __init samsung_clk_of_register_fixed_ext( 289 + struct samsung_fixed_rate_clock *fixed_rate_clk, 290 + unsigned int nr_fixed_rate_clk, 291 + struct of_device_id *clk_matches) 292 + { 293 + const struct of_device_id *match; 294 + struct device_node *np; 295 + u32 freq; 296 + 297 + for_each_matching_node_and_match(np, clk_matches, &match) { 298 + if (of_property_read_u32(np, "clock-frequency", &freq)) 299 + continue; 300 + fixed_rate_clk[(u32)match->data].fixed_rate = freq; 301 + } 302 + samsung_clk_register_fixed_rate(fixed_rate_clk, nr_fixed_rate_clk); 303 + } 304 + #endif 305 + 306 + /* utility function to get the rate of a specified clock */ 307 + unsigned long _get_rate(const char *clk_name) 308 + { 309 + struct clk *clk; 310 + unsigned long rate; 311 + 312 + clk = clk_get(NULL, clk_name); 313 + if (IS_ERR(clk)) { 314 + pr_err("%s: could not find clock %s\n", __func__, clk_name); 315 + return 0; 316 + } 317 + rate = clk_get_rate(clk); 318 + clk_put(clk); 319 + return rate; 320 + }
+289
drivers/clk/samsung/clk.h
··· 1 + /* 2 + * Copyright (c) 2013 Samsung Electronics Co., Ltd. 3 + * Copyright (c) 2013 Linaro Ltd. 4 + * Author: Thomas Abraham <thomas.ab@samsung.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 version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + * Common Clock Framework support for all Samsung platforms 11 + */ 12 + 13 + #ifndef __SAMSUNG_CLK_H 14 + #define __SAMSUNG_CLK_H 15 + 16 + #include <linux/clk.h> 17 + #include <linux/clkdev.h> 18 + #include <linux/io.h> 19 + #include <linux/clk-provider.h> 20 + #include <linux/of.h> 21 + #include <linux/of_address.h> 22 + 23 + #include <mach/map.h> 24 + 25 + /** 26 + * struct samsung_clock_alias: information about mux clock 27 + * @id: platform specific id of the clock. 28 + * @dev_name: name of the device to which this clock belongs. 29 + * @alias: optional clock alias name to be assigned to this clock. 30 + */ 31 + struct samsung_clock_alias { 32 + unsigned int id; 33 + const char *dev_name; 34 + const char *alias; 35 + }; 36 + 37 + #define ALIAS(_id, dname, a) \ 38 + { \ 39 + .id = _id, \ 40 + .dev_name = dname, \ 41 + .alias = a, \ 42 + } 43 + 44 + /** 45 + * struct samsung_fixed_rate_clock: information about fixed-rate clock 46 + * @id: platform specific id of the clock. 47 + * @name: name of this fixed-rate clock. 48 + * @parent_name: optional parent clock name. 49 + * @flags: optional fixed-rate clock flags. 50 + * @fixed-rate: fixed clock rate of this clock. 51 + */ 52 + struct samsung_fixed_rate_clock { 53 + unsigned int id; 54 + char *name; 55 + const char *parent_name; 56 + unsigned long flags; 57 + unsigned long fixed_rate; 58 + }; 59 + 60 + #define FRATE(_id, cname, pname, f, frate) \ 61 + { \ 62 + .id = _id, \ 63 + .name = cname, \ 64 + .parent_name = pname, \ 65 + .flags = f, \ 66 + .fixed_rate = frate, \ 67 + } 68 + 69 + /* 70 + * struct samsung_fixed_factor_clock: information about fixed-factor clock 71 + * @id: platform specific id of the clock. 72 + * @name: name of this fixed-factor clock. 73 + * @parent_name: parent clock name. 74 + * @mult: fixed multiplication factor. 75 + * @div: fixed division factor. 76 + * @flags: optional fixed-factor clock flags. 77 + */ 78 + struct samsung_fixed_factor_clock { 79 + unsigned int id; 80 + char *name; 81 + const char *parent_name; 82 + unsigned long mult; 83 + unsigned long div; 84 + unsigned long flags; 85 + }; 86 + 87 + #define FFACTOR(_id, cname, pname, m, d, f) \ 88 + { \ 89 + .id = _id, \ 90 + .name = cname, \ 91 + .parent_name = pname, \ 92 + .mult = m, \ 93 + .div = d, \ 94 + .flags = f, \ 95 + } 96 + 97 + /** 98 + * struct samsung_mux_clock: information about mux clock 99 + * @id: platform specific id of the clock. 100 + * @dev_name: name of the device to which this clock belongs. 101 + * @name: name of this mux clock. 102 + * @parent_names: array of pointer to parent clock names. 103 + * @num_parents: number of parents listed in @parent_names. 104 + * @flags: optional flags for basic clock. 105 + * @offset: offset of the register for configuring the mux. 106 + * @shift: starting bit location of the mux control bit-field in @reg. 107 + * @width: width of the mux control bit-field in @reg. 108 + * @mux_flags: flags for mux-type clock. 109 + * @alias: optional clock alias name to be assigned to this clock. 110 + */ 111 + struct samsung_mux_clock { 112 + unsigned int id; 113 + const char *dev_name; 114 + const char *name; 115 + const char **parent_names; 116 + u8 num_parents; 117 + unsigned long flags; 118 + unsigned long offset; 119 + u8 shift; 120 + u8 width; 121 + u8 mux_flags; 122 + const char *alias; 123 + }; 124 + 125 + #define __MUX(_id, dname, cname, pnames, o, s, w, f, mf, a) \ 126 + { \ 127 + .id = _id, \ 128 + .dev_name = dname, \ 129 + .name = cname, \ 130 + .parent_names = pnames, \ 131 + .num_parents = ARRAY_SIZE(pnames), \ 132 + .flags = f, \ 133 + .offset = o, \ 134 + .shift = s, \ 135 + .width = w, \ 136 + .mux_flags = mf, \ 137 + .alias = a, \ 138 + } 139 + 140 + #define MUX(_id, cname, pnames, o, s, w) \ 141 + __MUX(_id, NULL, cname, pnames, o, s, w, 0, 0, NULL) 142 + 143 + #define MUX_A(_id, cname, pnames, o, s, w, a) \ 144 + __MUX(_id, NULL, cname, pnames, o, s, w, 0, 0, a) 145 + 146 + #define MUX_F(_id, cname, pnames, o, s, w, f, mf) \ 147 + __MUX(_id, NULL, cname, pnames, o, s, w, f, mf, NULL) 148 + 149 + /** 150 + * @id: platform specific id of the clock. 151 + * struct samsung_div_clock: information about div clock 152 + * @dev_name: name of the device to which this clock belongs. 153 + * @name: name of this div clock. 154 + * @parent_name: name of the parent clock. 155 + * @flags: optional flags for basic clock. 156 + * @offset: offset of the register for configuring the div. 157 + * @shift: starting bit location of the div control bit-field in @reg. 158 + * @div_flags: flags for div-type clock. 159 + * @alias: optional clock alias name to be assigned to this clock. 160 + */ 161 + struct samsung_div_clock { 162 + unsigned int id; 163 + const char *dev_name; 164 + const char *name; 165 + const char *parent_name; 166 + unsigned long flags; 167 + unsigned long offset; 168 + u8 shift; 169 + u8 width; 170 + u8 div_flags; 171 + const char *alias; 172 + struct clk_div_table *table; 173 + }; 174 + 175 + #define __DIV(_id, dname, cname, pname, o, s, w, f, df, a, t) \ 176 + { \ 177 + .id = _id, \ 178 + .dev_name = dname, \ 179 + .name = cname, \ 180 + .parent_name = pname, \ 181 + .flags = f, \ 182 + .offset = o, \ 183 + .shift = s, \ 184 + .width = w, \ 185 + .div_flags = df, \ 186 + .alias = a, \ 187 + .table = t, \ 188 + } 189 + 190 + #define DIV(_id, cname, pname, o, s, w) \ 191 + __DIV(_id, NULL, cname, pname, o, s, w, 0, 0, NULL, NULL) 192 + 193 + #define DIV_A(_id, cname, pname, o, s, w, a) \ 194 + __DIV(_id, NULL, cname, pname, o, s, w, 0, 0, a, NULL) 195 + 196 + #define DIV_F(_id, cname, pname, o, s, w, f, df) \ 197 + __DIV(_id, NULL, cname, pname, o, s, w, f, df, NULL, NULL) 198 + 199 + #define DIV_T(_id, cname, pname, o, s, w, t) \ 200 + __DIV(_id, NULL, cname, pname, o, s, w, 0, 0, NULL, t) 201 + 202 + /** 203 + * struct samsung_gate_clock: information about gate clock 204 + * @id: platform specific id of the clock. 205 + * @dev_name: name of the device to which this clock belongs. 206 + * @name: name of this gate clock. 207 + * @parent_name: name of the parent clock. 208 + * @flags: optional flags for basic clock. 209 + * @offset: offset of the register for configuring the gate. 210 + * @bit_idx: bit index of the gate control bit-field in @reg. 211 + * @gate_flags: flags for gate-type clock. 212 + * @alias: optional clock alias name to be assigned to this clock. 213 + */ 214 + struct samsung_gate_clock { 215 + unsigned int id; 216 + const char *dev_name; 217 + const char *name; 218 + const char *parent_name; 219 + unsigned long flags; 220 + unsigned long offset; 221 + u8 bit_idx; 222 + u8 gate_flags; 223 + const char *alias; 224 + }; 225 + 226 + #define __GATE(_id, dname, cname, pname, o, b, f, gf, a) \ 227 + { \ 228 + .id = _id, \ 229 + .dev_name = dname, \ 230 + .name = cname, \ 231 + .parent_name = pname, \ 232 + .flags = f, \ 233 + .offset = o, \ 234 + .bit_idx = b, \ 235 + .gate_flags = gf, \ 236 + .alias = a, \ 237 + } 238 + 239 + #define GATE(_id, cname, pname, o, b, f, gf) \ 240 + __GATE(_id, NULL, cname, pname, o, b, f, gf, NULL) 241 + 242 + #define GATE_A(_id, cname, pname, o, b, f, gf, a) \ 243 + __GATE(_id, NULL, cname, pname, o, b, f, gf, a) 244 + 245 + #define GATE_D(_id, dname, cname, pname, o, b, f, gf) \ 246 + __GATE(_id, dname, cname, pname, o, b, f, gf, NULL) 247 + 248 + #define GATE_DA(_id, dname, cname, pname, o, b, f, gf, a) \ 249 + __GATE(_id, dname, cname, pname, o, b, f, gf, a) 250 + 251 + #define PNAME(x) static const char *x[] __initdata 252 + 253 + /** 254 + * struct samsung_clk_reg_dump: register dump of clock controller registers. 255 + * @offset: clock register offset from the controller base address. 256 + * @value: the value to be register at offset. 257 + */ 258 + struct samsung_clk_reg_dump { 259 + u32 offset; 260 + u32 value; 261 + }; 262 + 263 + extern void __init samsung_clk_init(struct device_node *np, void __iomem *base, 264 + unsigned long nr_clks, unsigned long *rdump, 265 + unsigned long nr_rdump, unsigned long *soc_rdump, 266 + unsigned long nr_soc_rdump); 267 + extern void __init samsung_clk_of_register_fixed_ext( 268 + struct samsung_fixed_rate_clock *fixed_rate_clk, 269 + unsigned int nr_fixed_rate_clk, 270 + struct of_device_id *clk_matches); 271 + 272 + extern void samsung_clk_add_lookup(struct clk *clk, unsigned int id); 273 + 274 + extern void samsung_clk_register_alias(struct samsung_clock_alias *list, 275 + unsigned int nr_clk); 276 + extern void __init samsung_clk_register_fixed_rate( 277 + struct samsung_fixed_rate_clock *clk_list, unsigned int nr_clk); 278 + extern void __init samsung_clk_register_fixed_factor( 279 + struct samsung_fixed_factor_clock *list, unsigned int nr_clk); 280 + extern void __init samsung_clk_register_mux(struct samsung_mux_clock *clk_list, 281 + unsigned int nr_clk); 282 + extern void __init samsung_clk_register_div(struct samsung_div_clock *clk_list, 283 + unsigned int nr_clk); 284 + extern void __init samsung_clk_register_gate( 285 + struct samsung_gate_clock *clk_list, unsigned int nr_clk); 286 + 287 + extern unsigned long _get_rate(const char *clk_name); 288 + 289 + #endif /* __SAMSUNG_CLK_H */
+1
drivers/clk/tegra/Makefile
··· 9 9 10 10 obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clk-tegra20.o 11 11 obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += clk-tegra30.o 12 + obj-$(CONFIG_ARCH_TEGRA_114_SOC) += clk-tegra114.o
+10 -1
drivers/clk/tegra/clk-periph-gate.c
··· 41 41 #define write_rst_clr(val, gate) \ 42 42 writel_relaxed(val, gate->clk_base + (gate->regs->rst_clr_reg)) 43 43 44 - #define periph_clk_to_bit(periph) (1 << (gate->clk_num % 32)) 44 + #define periph_clk_to_bit(gate) (1 << (gate->clk_num % 32)) 45 + 46 + #define LVL2_CLK_GATE_OVRE 0x554 45 47 46 48 /* Peripheral gate clock ops */ 47 49 static int clk_periph_is_enabled(struct clk_hw *hw) ··· 83 81 udelay(5); /* reset propogation delay */ 84 82 write_rst_clr(periph_clk_to_bit(gate), gate); 85 83 } 84 + } 85 + 86 + if (gate->flags & TEGRA_PERIPH_WAR_1005168) { 87 + writel_relaxed(0, gate->clk_base + LVL2_CLK_GATE_OVRE); 88 + writel_relaxed(BIT(22), gate->clk_base + LVL2_CLK_GATE_OVRE); 89 + udelay(1); 90 + writel_relaxed(0, gate->clk_base + LVL2_CLK_GATE_OVRE); 86 91 } 87 92 88 93 spin_unlock_irqrestore(&periph_ref_lock, flags);
+9 -5
drivers/clk/tegra/clk-periph.c
··· 16 16 17 17 #include <linux/clk.h> 18 18 #include <linux/clk-provider.h> 19 + #include <linux/export.h> 19 20 #include <linux/slab.h> 20 21 #include <linux/err.h> 21 22 ··· 129 128 130 129 tegra_periph_reset(gate, 0); 131 130 } 131 + EXPORT_SYMBOL(tegra_periph_reset_deassert); 132 132 133 133 void tegra_periph_reset_assert(struct clk *c) 134 134 { ··· 149 147 150 148 tegra_periph_reset(gate, 1); 151 149 } 150 + EXPORT_SYMBOL(tegra_periph_reset_assert); 152 151 153 152 const struct clk_ops tegra_clk_periph_ops = { 154 153 .get_parent = clk_periph_get_parent, ··· 173 170 static struct clk *_tegra_clk_register_periph(const char *name, 174 171 const char **parent_names, int num_parents, 175 172 struct tegra_clk_periph *periph, 176 - void __iomem *clk_base, u32 offset, bool div) 173 + void __iomem *clk_base, u32 offset, bool div, 174 + unsigned long flags) 177 175 { 178 176 struct clk *clk; 179 177 struct clk_init_data init; 180 178 181 179 init.name = name; 182 180 init.ops = div ? &tegra_clk_periph_ops : &tegra_clk_periph_nodiv_ops; 183 - init.flags = div ? 0 : CLK_SET_RATE_PARENT; 181 + init.flags = flags; 184 182 init.parent_names = parent_names; 185 183 init.num_parents = num_parents; 186 184 ··· 206 202 struct clk *tegra_clk_register_periph(const char *name, 207 203 const char **parent_names, int num_parents, 208 204 struct tegra_clk_periph *periph, void __iomem *clk_base, 209 - u32 offset) 205 + u32 offset, unsigned long flags) 210 206 { 211 207 return _tegra_clk_register_periph(name, parent_names, num_parents, 212 - periph, clk_base, offset, true); 208 + periph, clk_base, offset, true, flags); 213 209 } 214 210 215 211 struct clk *tegra_clk_register_periph_nodiv(const char *name, ··· 218 214 u32 offset) 219 215 { 220 216 return _tegra_clk_register_periph(name, parent_names, num_parents, 221 - periph, clk_base, offset, false); 217 + periph, clk_base, offset, false, CLK_SET_RATE_PARENT); 222 218 }
+1050 -116
drivers/clk/tegra/clk-pll.c
··· 1 1 /* 2 - * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. 2 + * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. 3 3 * 4 4 * This program is free software; you can redistribute it and/or modify it 5 5 * under the terms and conditions of the GNU General Public License, ··· 79 79 #define PLLE_SS_CTRL 0x68 80 80 #define PLLE_SS_DISABLE (7 << 10) 81 81 82 + #define PLLE_AUX_PLLP_SEL BIT(2) 83 + #define PLLE_AUX_ENABLE_SWCTL BIT(4) 84 + #define PLLE_AUX_SEQ_ENABLE BIT(24) 85 + #define PLLE_AUX_PLLRE_SEL BIT(28) 86 + 87 + #define PLLE_MISC_PLLE_PTS BIT(8) 88 + #define PLLE_MISC_IDDQ_SW_VALUE BIT(13) 89 + #define PLLE_MISC_IDDQ_SW_CTRL BIT(14) 90 + #define PLLE_MISC_VREG_BG_CTRL_SHIFT 4 91 + #define PLLE_MISC_VREG_BG_CTRL_MASK (3 << PLLE_MISC_VREG_BG_CTRL_SHIFT) 92 + #define PLLE_MISC_VREG_CTRL_SHIFT 2 93 + #define PLLE_MISC_VREG_CTRL_MASK (2 << PLLE_MISC_VREG_CTRL_SHIFT) 94 + 95 + #define PLLCX_MISC_STROBE BIT(31) 96 + #define PLLCX_MISC_RESET BIT(30) 97 + #define PLLCX_MISC_SDM_DIV_SHIFT 28 98 + #define PLLCX_MISC_SDM_DIV_MASK (0x3 << PLLCX_MISC_SDM_DIV_SHIFT) 99 + #define PLLCX_MISC_FILT_DIV_SHIFT 26 100 + #define PLLCX_MISC_FILT_DIV_MASK (0x3 << PLLCX_MISC_FILT_DIV_SHIFT) 101 + #define PLLCX_MISC_ALPHA_SHIFT 18 102 + #define PLLCX_MISC_DIV_LOW_RANGE \ 103 + ((0x1 << PLLCX_MISC_SDM_DIV_SHIFT) | \ 104 + (0x1 << PLLCX_MISC_FILT_DIV_SHIFT)) 105 + #define PLLCX_MISC_DIV_HIGH_RANGE \ 106 + ((0x2 << PLLCX_MISC_SDM_DIV_SHIFT) | \ 107 + (0x2 << PLLCX_MISC_FILT_DIV_SHIFT)) 108 + #define PLLCX_MISC_COEF_LOW_RANGE \ 109 + ((0x14 << PLLCX_MISC_KA_SHIFT) | (0x38 << PLLCX_MISC_KB_SHIFT)) 110 + #define PLLCX_MISC_KA_SHIFT 2 111 + #define PLLCX_MISC_KB_SHIFT 9 112 + #define PLLCX_MISC_DEFAULT (PLLCX_MISC_COEF_LOW_RANGE | \ 113 + (0x19 << PLLCX_MISC_ALPHA_SHIFT) | \ 114 + PLLCX_MISC_DIV_LOW_RANGE | \ 115 + PLLCX_MISC_RESET) 116 + #define PLLCX_MISC1_DEFAULT 0x000d2308 117 + #define PLLCX_MISC2_DEFAULT 0x30211200 118 + #define PLLCX_MISC3_DEFAULT 0x200 119 + 120 + #define PMC_PLLM_WB0_OVERRIDE 0x1dc 121 + #define PMC_PLLM_WB0_OVERRIDE_2 0x2b0 122 + #define PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK BIT(27) 123 + 82 124 #define PMC_SATA_PWRGT 0x1ac 83 125 #define PMC_SATA_PWRGT_PLLE_IDDQ_VALUE BIT(5) 84 126 #define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL BIT(4) ··· 143 101 #define divn_max(p) (divn_mask(p)) 144 102 #define divp_max(p) (1 << (divp_mask(p))) 145 103 104 + 105 + #ifdef CONFIG_ARCH_TEGRA_114_SOC 106 + /* PLLXC has 4-bit PDIV, but entry 15 is not allowed in h/w */ 107 + #define PLLXC_PDIV_MAX 14 108 + 109 + /* non-monotonic mapping below is not a typo */ 110 + static u8 pllxc_p[PLLXC_PDIV_MAX + 1] = { 111 + /* PDIV: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 */ 112 + /* p: */ 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 12, 16, 20, 24, 32 113 + }; 114 + 115 + #define PLLCX_PDIV_MAX 7 116 + static u8 pllcx_p[PLLCX_PDIV_MAX + 1] = { 117 + /* PDIV: 0, 1, 2, 3, 4, 5, 6, 7 */ 118 + /* p: */ 1, 2, 3, 4, 6, 8, 12, 16 119 + }; 120 + #endif 121 + 146 122 static void clk_pll_enable_lock(struct tegra_clk_pll *pll) 147 123 { 148 124 u32 val; ··· 168 108 if (!(pll->flags & TEGRA_PLL_USE_LOCK)) 169 109 return; 170 110 111 + if (!(pll->flags & TEGRA_PLL_HAS_LOCK_ENABLE)) 112 + return; 113 + 171 114 val = pll_readl_misc(pll); 172 115 val |= BIT(pll->params->lock_enable_bit_idx); 173 116 pll_writel_misc(val, pll); 174 117 } 175 118 176 - static int clk_pll_wait_for_lock(struct tegra_clk_pll *pll, 177 - void __iomem *lock_addr, u32 lock_bit_idx) 119 + static int clk_pll_wait_for_lock(struct tegra_clk_pll *pll) 178 120 { 179 121 int i; 180 - u32 val; 122 + u32 val, lock_mask; 123 + void __iomem *lock_addr; 181 124 182 125 if (!(pll->flags & TEGRA_PLL_USE_LOCK)) { 183 126 udelay(pll->params->lock_delay); 184 127 return 0; 185 128 } 186 129 130 + lock_addr = pll->clk_base; 131 + if (pll->flags & TEGRA_PLL_LOCK_MISC) 132 + lock_addr += pll->params->misc_reg; 133 + else 134 + lock_addr += pll->params->base_reg; 135 + 136 + lock_mask = pll->params->lock_mask; 137 + 187 138 for (i = 0; i < pll->params->lock_delay; i++) { 188 139 val = readl_relaxed(lock_addr); 189 - if (val & BIT(lock_bit_idx)) { 140 + if ((val & lock_mask) == lock_mask) { 190 141 udelay(PLL_POST_LOCK_DELAY); 191 142 return 0; 192 143 } ··· 226 155 return val & PLL_BASE_ENABLE ? 1 : 0; 227 156 } 228 157 229 - static int _clk_pll_enable(struct clk_hw *hw) 158 + static void _clk_pll_enable(struct clk_hw *hw) 230 159 { 231 160 struct tegra_clk_pll *pll = to_clk_pll(hw); 232 161 u32 val; ··· 234 163 clk_pll_enable_lock(pll); 235 164 236 165 val = pll_readl_base(pll); 237 - val &= ~PLL_BASE_BYPASS; 166 + if (pll->flags & TEGRA_PLL_BYPASS) 167 + val &= ~PLL_BASE_BYPASS; 238 168 val |= PLL_BASE_ENABLE; 239 169 pll_writel_base(val, pll); 240 170 ··· 244 172 val |= PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE; 245 173 writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE); 246 174 } 247 - 248 - clk_pll_wait_for_lock(pll, pll->clk_base + pll->params->base_reg, 249 - pll->params->lock_bit_idx); 250 - 251 - return 0; 252 175 } 253 176 254 177 static void _clk_pll_disable(struct clk_hw *hw) ··· 252 185 u32 val; 253 186 254 187 val = pll_readl_base(pll); 255 - val &= ~(PLL_BASE_BYPASS | PLL_BASE_ENABLE); 188 + if (pll->flags & TEGRA_PLL_BYPASS) 189 + val &= ~PLL_BASE_BYPASS; 190 + val &= ~PLL_BASE_ENABLE; 256 191 pll_writel_base(val, pll); 257 192 258 193 if (pll->flags & TEGRA_PLLM) { ··· 273 204 if (pll->lock) 274 205 spin_lock_irqsave(pll->lock, flags); 275 206 276 - ret = _clk_pll_enable(hw); 207 + _clk_pll_enable(hw); 208 + 209 + ret = clk_pll_wait_for_lock(pll); 277 210 278 211 if (pll->lock) 279 212 spin_unlock_irqrestore(pll->lock, flags); ··· 312 241 if (sel->input_rate == 0) 313 242 return -EINVAL; 314 243 315 - BUG_ON(sel->p < 1); 316 - 317 244 cfg->input_rate = sel->input_rate; 318 245 cfg->output_rate = sel->output_rate; 319 246 cfg->m = sel->m; ··· 326 257 unsigned long rate, unsigned long parent_rate) 327 258 { 328 259 struct tegra_clk_pll *pll = to_clk_pll(hw); 260 + struct pdiv_map *p_tohw = pll->params->pdiv_tohw; 329 261 unsigned long cfreq; 330 262 u32 p_div = 0; 331 263 ··· 360 290 cfg->output_rate <<= 1) 361 291 p_div++; 362 292 363 - cfg->p = 1 << p_div; 364 293 cfg->m = parent_rate / cfreq; 365 294 cfg->n = cfg->output_rate / cfreq; 366 295 cfg->cpcon = OUT_OF_TABLE_CPCON; 367 296 368 297 if (cfg->m > divm_max(pll) || cfg->n > divn_max(pll) || 369 - cfg->p > divp_max(pll) || cfg->output_rate > pll->params->vco_max) { 298 + (1 << p_div) > divp_max(pll) 299 + || cfg->output_rate > pll->params->vco_max) { 370 300 pr_err("%s: Failed to set %s rate %lu\n", 371 301 __func__, __clk_get_name(hw->clk), rate); 372 302 return -EINVAL; 373 303 } 374 304 305 + if (p_tohw) { 306 + p_div = 1 << p_div; 307 + while (p_tohw->pdiv) { 308 + if (p_div <= p_tohw->pdiv) { 309 + cfg->p = p_tohw->hw_val; 310 + break; 311 + } 312 + p_tohw++; 313 + } 314 + if (!p_tohw->pdiv) 315 + return -EINVAL; 316 + } else 317 + cfg->p = p_div; 318 + 375 319 return 0; 320 + } 321 + 322 + static void _update_pll_mnp(struct tegra_clk_pll *pll, 323 + struct tegra_clk_pll_freq_table *cfg) 324 + { 325 + u32 val; 326 + 327 + val = pll_readl_base(pll); 328 + 329 + val &= ~((divm_mask(pll) << pll->divm_shift) | 330 + (divn_mask(pll) << pll->divn_shift) | 331 + (divp_mask(pll) << pll->divp_shift)); 332 + val |= ((cfg->m << pll->divm_shift) | 333 + (cfg->n << pll->divn_shift) | 334 + (cfg->p << pll->divp_shift)); 335 + 336 + pll_writel_base(val, pll); 337 + } 338 + 339 + static void _get_pll_mnp(struct tegra_clk_pll *pll, 340 + struct tegra_clk_pll_freq_table *cfg) 341 + { 342 + u32 val; 343 + 344 + val = pll_readl_base(pll); 345 + 346 + cfg->m = (val >> pll->divm_shift) & (divm_mask(pll)); 347 + cfg->n = (val >> pll->divn_shift) & (divn_mask(pll)); 348 + cfg->p = (val >> pll->divp_shift) & (divp_mask(pll)); 349 + } 350 + 351 + static void _update_pll_cpcon(struct tegra_clk_pll *pll, 352 + struct tegra_clk_pll_freq_table *cfg, 353 + unsigned long rate) 354 + { 355 + u32 val; 356 + 357 + val = pll_readl_misc(pll); 358 + 359 + val &= ~(PLL_MISC_CPCON_MASK << PLL_MISC_CPCON_SHIFT); 360 + val |= cfg->cpcon << PLL_MISC_CPCON_SHIFT; 361 + 362 + if (pll->flags & TEGRA_PLL_SET_LFCON) { 363 + val &= ~(PLL_MISC_LFCON_MASK << PLL_MISC_LFCON_SHIFT); 364 + if (cfg->n >= PLLDU_LFCON_SET_DIVN) 365 + val |= 1 << PLL_MISC_LFCON_SHIFT; 366 + } else if (pll->flags & TEGRA_PLL_SET_DCCON) { 367 + val &= ~(1 << PLL_MISC_DCCON_SHIFT); 368 + if (rate >= (pll->params->vco_max >> 1)) 369 + val |= 1 << PLL_MISC_DCCON_SHIFT; 370 + } 371 + 372 + pll_writel_misc(val, pll); 376 373 } 377 374 378 375 static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, 379 376 unsigned long rate) 380 377 { 381 378 struct tegra_clk_pll *pll = to_clk_pll(hw); 382 - unsigned long flags = 0; 383 - u32 divp, val, old_base; 384 - int state; 385 - 386 - divp = __ffs(cfg->p); 387 - 388 - if (pll->flags & TEGRA_PLLU) 389 - divp ^= 1; 390 - 391 - if (pll->lock) 392 - spin_lock_irqsave(pll->lock, flags); 393 - 394 - old_base = val = pll_readl_base(pll); 395 - val &= ~((divm_mask(pll) << pll->divm_shift) | 396 - (divn_mask(pll) << pll->divn_shift) | 397 - (divp_mask(pll) << pll->divp_shift)); 398 - val |= ((cfg->m << pll->divm_shift) | 399 - (cfg->n << pll->divn_shift) | 400 - (divp << pll->divp_shift)); 401 - if (val == old_base) { 402 - if (pll->lock) 403 - spin_unlock_irqrestore(pll->lock, flags); 404 - return 0; 405 - } 379 + int state, ret = 0; 406 380 407 381 state = clk_pll_is_enabled(hw); 408 382 409 - if (state) { 410 - _clk_pll_disable(hw); 411 - val &= ~(PLL_BASE_BYPASS | PLL_BASE_ENABLE); 412 - } 413 - pll_writel_base(val, pll); 414 - 415 - if (pll->flags & TEGRA_PLL_HAS_CPCON) { 416 - val = pll_readl_misc(pll); 417 - val &= ~(PLL_MISC_CPCON_MASK << PLL_MISC_CPCON_SHIFT); 418 - val |= cfg->cpcon << PLL_MISC_CPCON_SHIFT; 419 - if (pll->flags & TEGRA_PLL_SET_LFCON) { 420 - val &= ~(PLL_MISC_LFCON_MASK << PLL_MISC_LFCON_SHIFT); 421 - if (cfg->n >= PLLDU_LFCON_SET_DIVN) 422 - val |= 0x1 << PLL_MISC_LFCON_SHIFT; 423 - } else if (pll->flags & TEGRA_PLL_SET_DCCON) { 424 - val &= ~(0x1 << PLL_MISC_DCCON_SHIFT); 425 - if (rate >= (pll->params->vco_max >> 1)) 426 - val |= 0x1 << PLL_MISC_DCCON_SHIFT; 427 - } 428 - pll_writel_misc(val, pll); 429 - } 430 - 431 - if (pll->lock) 432 - spin_unlock_irqrestore(pll->lock, flags); 433 - 434 383 if (state) 435 - clk_pll_enable(hw); 384 + _clk_pll_disable(hw); 436 385 437 - return 0; 386 + _update_pll_mnp(pll, cfg); 387 + 388 + if (pll->flags & TEGRA_PLL_HAS_CPCON) 389 + _update_pll_cpcon(pll, cfg, rate); 390 + 391 + if (state) { 392 + _clk_pll_enable(hw); 393 + ret = clk_pll_wait_for_lock(pll); 394 + } 395 + 396 + return ret; 438 397 } 439 398 440 399 static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, 441 400 unsigned long parent_rate) 442 401 { 443 402 struct tegra_clk_pll *pll = to_clk_pll(hw); 444 - struct tegra_clk_pll_freq_table cfg; 403 + struct tegra_clk_pll_freq_table cfg, old_cfg; 404 + unsigned long flags = 0; 405 + int ret = 0; 445 406 446 407 if (pll->flags & TEGRA_PLL_FIXED) { 447 408 if (rate != pll->fixed_rate) { ··· 488 387 _calc_rate(hw, &cfg, rate, parent_rate)) 489 388 return -EINVAL; 490 389 491 - return _program_pll(hw, &cfg, rate); 390 + if (pll->lock) 391 + spin_lock_irqsave(pll->lock, flags); 392 + 393 + _get_pll_mnp(pll, &old_cfg); 394 + 395 + if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_cfg.p != cfg.p) 396 + ret = _program_pll(hw, &cfg, rate); 397 + 398 + if (pll->lock) 399 + spin_unlock_irqrestore(pll->lock, flags); 400 + 401 + return ret; 492 402 } 493 403 494 404 static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, ··· 521 409 return -EINVAL; 522 410 523 411 output_rate *= cfg.n; 524 - do_div(output_rate, cfg.m * cfg.p); 412 + do_div(output_rate, cfg.m * (1 << cfg.p)); 525 413 526 414 return output_rate; 527 415 } ··· 530 418 unsigned long parent_rate) 531 419 { 532 420 struct tegra_clk_pll *pll = to_clk_pll(hw); 533 - u32 val = pll_readl_base(pll); 534 - u32 divn = 0, divm = 0, divp = 0; 421 + struct tegra_clk_pll_freq_table cfg; 422 + struct pdiv_map *p_tohw = pll->params->pdiv_tohw; 423 + u32 val; 535 424 u64 rate = parent_rate; 425 + int pdiv; 536 426 537 - if (val & PLL_BASE_BYPASS) 427 + val = pll_readl_base(pll); 428 + 429 + if ((pll->flags & TEGRA_PLL_BYPASS) && (val & PLL_BASE_BYPASS)) 538 430 return parent_rate; 539 431 540 432 if ((pll->flags & TEGRA_PLL_FIXED) && !(val & PLL_BASE_OVERRIDE)) { ··· 551 435 return pll->fixed_rate; 552 436 } 553 437 554 - divp = (val >> pll->divp_shift) & (divp_mask(pll)); 555 - if (pll->flags & TEGRA_PLLU) 556 - divp ^= 1; 438 + _get_pll_mnp(pll, &cfg); 557 439 558 - divn = (val >> pll->divn_shift) & (divn_mask(pll)); 559 - divm = (val >> pll->divm_shift) & (divm_mask(pll)); 560 - divm *= (1 << divp); 440 + if (p_tohw) { 441 + while (p_tohw->pdiv) { 442 + if (cfg.p == p_tohw->hw_val) { 443 + pdiv = p_tohw->pdiv; 444 + break; 445 + } 446 + p_tohw++; 447 + } 561 448 562 - rate *= divn; 563 - do_div(rate, divm); 449 + if (!p_tohw->pdiv) { 450 + WARN_ON(1); 451 + pdiv = 1; 452 + } 453 + } else 454 + pdiv = 1 << cfg.p; 455 + 456 + cfg.m *= pdiv; 457 + 458 + rate *= cfg.n; 459 + do_div(rate, cfg.m); 460 + 564 461 return rate; 565 462 } 566 463 ··· 667 538 val |= (PLL_BASE_BYPASS | PLL_BASE_ENABLE); 668 539 pll_writel_base(val, pll); 669 540 670 - clk_pll_wait_for_lock(pll, pll->clk_base + pll->params->misc_reg, 671 - pll->params->lock_bit_idx); 541 + clk_pll_wait_for_lock(pll); 542 + 672 543 return 0; 673 544 } 674 545 ··· 706 577 .enable = clk_plle_enable, 707 578 }; 708 579 709 - static struct clk *_tegra_clk_register_pll(const char *name, 710 - const char *parent_name, void __iomem *clk_base, 711 - void __iomem *pmc, unsigned long flags, 712 - unsigned long fixed_rate, 713 - struct tegra_clk_pll_params *pll_params, u8 pll_flags, 714 - struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock, 715 - const struct clk_ops *ops) 580 + #ifdef CONFIG_ARCH_TEGRA_114_SOC 581 + 582 + static int _pll_fixed_mdiv(struct tegra_clk_pll_params *pll_params, 583 + unsigned long parent_rate) 584 + { 585 + if (parent_rate > pll_params->cf_max) 586 + return 2; 587 + else 588 + return 1; 589 + } 590 + 591 + static int clk_pll_iddq_enable(struct clk_hw *hw) 592 + { 593 + struct tegra_clk_pll *pll = to_clk_pll(hw); 594 + unsigned long flags = 0; 595 + 596 + u32 val; 597 + int ret; 598 + 599 + if (pll->lock) 600 + spin_lock_irqsave(pll->lock, flags); 601 + 602 + val = pll_readl(pll->params->iddq_reg, pll); 603 + val &= ~BIT(pll->params->iddq_bit_idx); 604 + pll_writel(val, pll->params->iddq_reg, pll); 605 + udelay(2); 606 + 607 + _clk_pll_enable(hw); 608 + 609 + ret = clk_pll_wait_for_lock(pll); 610 + 611 + if (pll->lock) 612 + spin_unlock_irqrestore(pll->lock, flags); 613 + 614 + return 0; 615 + } 616 + 617 + static void clk_pll_iddq_disable(struct clk_hw *hw) 618 + { 619 + struct tegra_clk_pll *pll = to_clk_pll(hw); 620 + unsigned long flags = 0; 621 + u32 val; 622 + 623 + if (pll->lock) 624 + spin_lock_irqsave(pll->lock, flags); 625 + 626 + _clk_pll_disable(hw); 627 + 628 + val = pll_readl(pll->params->iddq_reg, pll); 629 + val |= BIT(pll->params->iddq_bit_idx); 630 + pll_writel(val, pll->params->iddq_reg, pll); 631 + udelay(2); 632 + 633 + if (pll->lock) 634 + spin_unlock_irqrestore(pll->lock, flags); 635 + } 636 + 637 + static int _calc_dynamic_ramp_rate(struct clk_hw *hw, 638 + struct tegra_clk_pll_freq_table *cfg, 639 + unsigned long rate, unsigned long parent_rate) 640 + { 641 + struct tegra_clk_pll *pll = to_clk_pll(hw); 642 + unsigned int p; 643 + 644 + if (!rate) 645 + return -EINVAL; 646 + 647 + p = DIV_ROUND_UP(pll->params->vco_min, rate); 648 + cfg->m = _pll_fixed_mdiv(pll->params, parent_rate); 649 + cfg->p = p; 650 + cfg->output_rate = rate * cfg->p; 651 + cfg->n = cfg->output_rate * cfg->m / parent_rate; 652 + 653 + if (cfg->n > divn_max(pll) || cfg->output_rate > pll->params->vco_max) 654 + return -EINVAL; 655 + 656 + return 0; 657 + } 658 + 659 + static int _pll_ramp_calc_pll(struct clk_hw *hw, 660 + struct tegra_clk_pll_freq_table *cfg, 661 + unsigned long rate, unsigned long parent_rate) 662 + { 663 + struct tegra_clk_pll *pll = to_clk_pll(hw); 664 + int err = 0; 665 + 666 + err = _get_table_rate(hw, cfg, rate, parent_rate); 667 + if (err < 0) 668 + err = _calc_dynamic_ramp_rate(hw, cfg, rate, parent_rate); 669 + else if (cfg->m != _pll_fixed_mdiv(pll->params, parent_rate)) { 670 + WARN_ON(1); 671 + err = -EINVAL; 672 + goto out; 673 + } 674 + 675 + if (!cfg->p || (cfg->p > pll->params->max_p)) 676 + err = -EINVAL; 677 + 678 + out: 679 + return err; 680 + } 681 + 682 + static int clk_pllxc_set_rate(struct clk_hw *hw, unsigned long rate, 683 + unsigned long parent_rate) 684 + { 685 + struct tegra_clk_pll *pll = to_clk_pll(hw); 686 + struct tegra_clk_pll_freq_table cfg, old_cfg; 687 + unsigned long flags = 0; 688 + int ret = 0; 689 + u8 old_p; 690 + 691 + ret = _pll_ramp_calc_pll(hw, &cfg, rate, parent_rate); 692 + if (ret < 0) 693 + return ret; 694 + 695 + if (pll->lock) 696 + spin_lock_irqsave(pll->lock, flags); 697 + 698 + _get_pll_mnp(pll, &old_cfg); 699 + 700 + old_p = pllxc_p[old_cfg.p]; 701 + if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_p != cfg.p) { 702 + cfg.p -= 1; 703 + ret = _program_pll(hw, &cfg, rate); 704 + } 705 + 706 + if (pll->lock) 707 + spin_unlock_irqrestore(pll->lock, flags); 708 + 709 + return ret; 710 + } 711 + 712 + static long clk_pll_ramp_round_rate(struct clk_hw *hw, unsigned long rate, 713 + unsigned long *prate) 714 + { 715 + struct tegra_clk_pll_freq_table cfg; 716 + int ret = 0; 717 + u64 output_rate = *prate; 718 + 719 + ret = _pll_ramp_calc_pll(hw, &cfg, rate, *prate); 720 + if (ret < 0) 721 + return ret; 722 + 723 + output_rate *= cfg.n; 724 + do_div(output_rate, cfg.m * cfg.p); 725 + 726 + return output_rate; 727 + } 728 + 729 + static int clk_pllm_set_rate(struct clk_hw *hw, unsigned long rate, 730 + unsigned long parent_rate) 731 + { 732 + struct tegra_clk_pll_freq_table cfg; 733 + struct tegra_clk_pll *pll = to_clk_pll(hw); 734 + unsigned long flags = 0; 735 + int state, ret = 0; 736 + u32 val; 737 + 738 + if (pll->lock) 739 + spin_lock_irqsave(pll->lock, flags); 740 + 741 + state = clk_pll_is_enabled(hw); 742 + if (state) { 743 + if (rate != clk_get_rate(hw->clk)) { 744 + pr_err("%s: Cannot change active PLLM\n", __func__); 745 + ret = -EINVAL; 746 + goto out; 747 + } 748 + goto out; 749 + } 750 + 751 + ret = _pll_ramp_calc_pll(hw, &cfg, rate, parent_rate); 752 + if (ret < 0) 753 + goto out; 754 + 755 + cfg.p -= 1; 756 + 757 + val = readl_relaxed(pll->pmc + PMC_PLLM_WB0_OVERRIDE); 758 + if (val & PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE) { 759 + val = readl_relaxed(pll->pmc + PMC_PLLM_WB0_OVERRIDE_2); 760 + val = cfg.p ? (val | PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK) : 761 + (val & ~PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK); 762 + writel_relaxed(val, pll->pmc + PMC_PLLM_WB0_OVERRIDE_2); 763 + 764 + val = readl_relaxed(pll->pmc + PMC_PLLM_WB0_OVERRIDE); 765 + val &= ~(divn_mask(pll) | divm_mask(pll)); 766 + val |= (cfg.m << pll->divm_shift) | (cfg.n << pll->divn_shift); 767 + writel_relaxed(val, pll->pmc + PMC_PLLM_WB0_OVERRIDE); 768 + } else 769 + _update_pll_mnp(pll, &cfg); 770 + 771 + 772 + out: 773 + if (pll->lock) 774 + spin_unlock_irqrestore(pll->lock, flags); 775 + 776 + return ret; 777 + } 778 + 779 + static void _pllcx_strobe(struct tegra_clk_pll *pll) 780 + { 781 + u32 val; 782 + 783 + val = pll_readl_misc(pll); 784 + val |= PLLCX_MISC_STROBE; 785 + pll_writel_misc(val, pll); 786 + udelay(2); 787 + 788 + val &= ~PLLCX_MISC_STROBE; 789 + pll_writel_misc(val, pll); 790 + } 791 + 792 + static int clk_pllc_enable(struct clk_hw *hw) 793 + { 794 + struct tegra_clk_pll *pll = to_clk_pll(hw); 795 + u32 val; 796 + int ret = 0; 797 + unsigned long flags = 0; 798 + 799 + if (pll->lock) 800 + spin_lock_irqsave(pll->lock, flags); 801 + 802 + _clk_pll_enable(hw); 803 + udelay(2); 804 + 805 + val = pll_readl_misc(pll); 806 + val &= ~PLLCX_MISC_RESET; 807 + pll_writel_misc(val, pll); 808 + udelay(2); 809 + 810 + _pllcx_strobe(pll); 811 + 812 + ret = clk_pll_wait_for_lock(pll); 813 + 814 + if (pll->lock) 815 + spin_unlock_irqrestore(pll->lock, flags); 816 + 817 + return ret; 818 + } 819 + 820 + static void _clk_pllc_disable(struct clk_hw *hw) 821 + { 822 + struct tegra_clk_pll *pll = to_clk_pll(hw); 823 + u32 val; 824 + 825 + _clk_pll_disable(hw); 826 + 827 + val = pll_readl_misc(pll); 828 + val |= PLLCX_MISC_RESET; 829 + pll_writel_misc(val, pll); 830 + udelay(2); 831 + } 832 + 833 + static void clk_pllc_disable(struct clk_hw *hw) 834 + { 835 + struct tegra_clk_pll *pll = to_clk_pll(hw); 836 + unsigned long flags = 0; 837 + 838 + if (pll->lock) 839 + spin_lock_irqsave(pll->lock, flags); 840 + 841 + _clk_pllc_disable(hw); 842 + 843 + if (pll->lock) 844 + spin_unlock_irqrestore(pll->lock, flags); 845 + } 846 + 847 + static int _pllcx_update_dynamic_coef(struct tegra_clk_pll *pll, 848 + unsigned long input_rate, u32 n) 849 + { 850 + u32 val, n_threshold; 851 + 852 + switch (input_rate) { 853 + case 12000000: 854 + n_threshold = 70; 855 + break; 856 + case 13000000: 857 + case 26000000: 858 + n_threshold = 71; 859 + break; 860 + case 16800000: 861 + n_threshold = 55; 862 + break; 863 + case 19200000: 864 + n_threshold = 48; 865 + break; 866 + default: 867 + pr_err("%s: Unexpected reference rate %lu\n", 868 + __func__, input_rate); 869 + return -EINVAL; 870 + } 871 + 872 + val = pll_readl_misc(pll); 873 + val &= ~(PLLCX_MISC_SDM_DIV_MASK | PLLCX_MISC_FILT_DIV_MASK); 874 + val |= n <= n_threshold ? 875 + PLLCX_MISC_DIV_LOW_RANGE : PLLCX_MISC_DIV_HIGH_RANGE; 876 + pll_writel_misc(val, pll); 877 + 878 + return 0; 879 + } 880 + 881 + static int clk_pllc_set_rate(struct clk_hw *hw, unsigned long rate, 882 + unsigned long parent_rate) 883 + { 884 + struct tegra_clk_pll_freq_table cfg; 885 + struct tegra_clk_pll *pll = to_clk_pll(hw); 886 + unsigned long flags = 0; 887 + int state, ret = 0; 888 + u32 val; 889 + u16 old_m, old_n; 890 + u8 old_p; 891 + 892 + if (pll->lock) 893 + spin_lock_irqsave(pll->lock, flags); 894 + 895 + ret = _pll_ramp_calc_pll(hw, &cfg, rate, parent_rate); 896 + if (ret < 0) 897 + goto out; 898 + 899 + val = pll_readl_base(pll); 900 + old_m = (val >> pll->divm_shift) & (divm_mask(pll)); 901 + old_n = (val >> pll->divn_shift) & (divn_mask(pll)); 902 + old_p = pllcx_p[(val >> pll->divp_shift) & (divp_mask(pll))]; 903 + 904 + if (cfg.m != old_m) { 905 + WARN_ON(1); 906 + goto out; 907 + } 908 + 909 + if (old_n == cfg.n && old_p == cfg.p) 910 + goto out; 911 + 912 + cfg.p -= 1; 913 + 914 + state = clk_pll_is_enabled(hw); 915 + if (state) 916 + _clk_pllc_disable(hw); 917 + 918 + ret = _pllcx_update_dynamic_coef(pll, parent_rate, cfg.n); 919 + if (ret < 0) 920 + goto out; 921 + 922 + _update_pll_mnp(pll, &cfg); 923 + 924 + if (state) 925 + ret = clk_pllc_enable(hw); 926 + 927 + out: 928 + if (pll->lock) 929 + spin_unlock_irqrestore(pll->lock, flags); 930 + 931 + return ret; 932 + } 933 + 934 + static long _pllre_calc_rate(struct tegra_clk_pll *pll, 935 + struct tegra_clk_pll_freq_table *cfg, 936 + unsigned long rate, unsigned long parent_rate) 937 + { 938 + u16 m, n; 939 + u64 output_rate = parent_rate; 940 + 941 + m = _pll_fixed_mdiv(pll->params, parent_rate); 942 + n = rate * m / parent_rate; 943 + 944 + output_rate *= n; 945 + do_div(output_rate, m); 946 + 947 + if (cfg) { 948 + cfg->m = m; 949 + cfg->n = n; 950 + } 951 + 952 + return output_rate; 953 + } 954 + static int clk_pllre_set_rate(struct clk_hw *hw, unsigned long rate, 955 + unsigned long parent_rate) 956 + { 957 + struct tegra_clk_pll_freq_table cfg, old_cfg; 958 + struct tegra_clk_pll *pll = to_clk_pll(hw); 959 + unsigned long flags = 0; 960 + int state, ret = 0; 961 + 962 + if (pll->lock) 963 + spin_lock_irqsave(pll->lock, flags); 964 + 965 + _pllre_calc_rate(pll, &cfg, rate, parent_rate); 966 + _get_pll_mnp(pll, &old_cfg); 967 + cfg.p = old_cfg.p; 968 + 969 + if (cfg.m != old_cfg.m || cfg.n != old_cfg.n) { 970 + state = clk_pll_is_enabled(hw); 971 + if (state) 972 + _clk_pll_disable(hw); 973 + 974 + _update_pll_mnp(pll, &cfg); 975 + 976 + if (state) { 977 + _clk_pll_enable(hw); 978 + ret = clk_pll_wait_for_lock(pll); 979 + } 980 + } 981 + 982 + if (pll->lock) 983 + spin_unlock_irqrestore(pll->lock, flags); 984 + 985 + return ret; 986 + } 987 + 988 + static unsigned long clk_pllre_recalc_rate(struct clk_hw *hw, 989 + unsigned long parent_rate) 990 + { 991 + struct tegra_clk_pll_freq_table cfg; 992 + struct tegra_clk_pll *pll = to_clk_pll(hw); 993 + u64 rate = parent_rate; 994 + 995 + _get_pll_mnp(pll, &cfg); 996 + 997 + rate *= cfg.n; 998 + do_div(rate, cfg.m); 999 + 1000 + return rate; 1001 + } 1002 + 1003 + static long clk_pllre_round_rate(struct clk_hw *hw, unsigned long rate, 1004 + unsigned long *prate) 1005 + { 1006 + struct tegra_clk_pll *pll = to_clk_pll(hw); 1007 + 1008 + return _pllre_calc_rate(pll, NULL, rate, *prate); 1009 + } 1010 + 1011 + static int clk_plle_tegra114_enable(struct clk_hw *hw) 1012 + { 1013 + struct tegra_clk_pll *pll = to_clk_pll(hw); 1014 + struct tegra_clk_pll_freq_table sel; 1015 + u32 val; 1016 + int ret; 1017 + unsigned long flags = 0; 1018 + unsigned long input_rate = clk_get_rate(clk_get_parent(hw->clk)); 1019 + 1020 + if (_get_table_rate(hw, &sel, pll->fixed_rate, input_rate)) 1021 + return -EINVAL; 1022 + 1023 + if (pll->lock) 1024 + spin_lock_irqsave(pll->lock, flags); 1025 + 1026 + val = pll_readl_base(pll); 1027 + val &= ~BIT(29); /* Disable lock override */ 1028 + pll_writel_base(val, pll); 1029 + 1030 + val = pll_readl(pll->params->aux_reg, pll); 1031 + val |= PLLE_AUX_ENABLE_SWCTL; 1032 + val &= ~PLLE_AUX_SEQ_ENABLE; 1033 + pll_writel(val, pll->params->aux_reg, pll); 1034 + udelay(1); 1035 + 1036 + val = pll_readl_misc(pll); 1037 + val |= PLLE_MISC_LOCK_ENABLE; 1038 + val |= PLLE_MISC_IDDQ_SW_CTRL; 1039 + val &= ~PLLE_MISC_IDDQ_SW_VALUE; 1040 + val |= PLLE_MISC_PLLE_PTS; 1041 + val |= PLLE_MISC_VREG_BG_CTRL_MASK | PLLE_MISC_VREG_CTRL_MASK; 1042 + pll_writel_misc(val, pll); 1043 + udelay(5); 1044 + 1045 + val = pll_readl(PLLE_SS_CTRL, pll); 1046 + val |= PLLE_SS_DISABLE; 1047 + pll_writel(val, PLLE_SS_CTRL, pll); 1048 + 1049 + val = pll_readl_base(pll); 1050 + val &= ~(divm_mask(pll) | divn_mask(pll) | divp_mask(pll)); 1051 + val &= ~(PLLE_BASE_DIVCML_WIDTH << PLLE_BASE_DIVCML_SHIFT); 1052 + val |= sel.m << pll->divm_shift; 1053 + val |= sel.n << pll->divn_shift; 1054 + val |= sel.cpcon << PLLE_BASE_DIVCML_SHIFT; 1055 + pll_writel_base(val, pll); 1056 + udelay(1); 1057 + 1058 + _clk_pll_enable(hw); 1059 + ret = clk_pll_wait_for_lock(pll); 1060 + 1061 + if (ret < 0) 1062 + goto out; 1063 + 1064 + /* TODO: enable hw control of xusb brick pll */ 1065 + 1066 + out: 1067 + if (pll->lock) 1068 + spin_unlock_irqrestore(pll->lock, flags); 1069 + 1070 + return ret; 1071 + } 1072 + 1073 + static void clk_plle_tegra114_disable(struct clk_hw *hw) 1074 + { 1075 + struct tegra_clk_pll *pll = to_clk_pll(hw); 1076 + unsigned long flags = 0; 1077 + u32 val; 1078 + 1079 + if (pll->lock) 1080 + spin_lock_irqsave(pll->lock, flags); 1081 + 1082 + _clk_pll_disable(hw); 1083 + 1084 + val = pll_readl_misc(pll); 1085 + val |= PLLE_MISC_IDDQ_SW_CTRL | PLLE_MISC_IDDQ_SW_VALUE; 1086 + pll_writel_misc(val, pll); 1087 + udelay(1); 1088 + 1089 + if (pll->lock) 1090 + spin_unlock_irqrestore(pll->lock, flags); 1091 + } 1092 + #endif 1093 + 1094 + static struct tegra_clk_pll *_tegra_init_pll(void __iomem *clk_base, 1095 + void __iomem *pmc, unsigned long fixed_rate, 1096 + struct tegra_clk_pll_params *pll_params, u32 pll_flags, 1097 + struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) 716 1098 { 717 1099 struct tegra_clk_pll *pll; 718 - struct clk *clk; 719 - struct clk_init_data init; 720 1100 721 1101 pll = kzalloc(sizeof(*pll), GFP_KERNEL); 722 1102 if (!pll) 723 1103 return ERR_PTR(-ENOMEM); 724 - 725 - init.name = name; 726 - init.ops = ops; 727 - init.flags = flags; 728 - init.parent_names = (parent_name ? &parent_name : NULL); 729 - init.num_parents = (parent_name ? 1 : 0); 730 1104 731 1105 pll->clk_base = clk_base; 732 1106 pll->pmc = pmc; ··· 1247 615 pll->divm_shift = PLL_BASE_DIVM_SHIFT; 1248 616 pll->divm_width = PLL_BASE_DIVM_WIDTH; 1249 617 618 + return pll; 619 + } 620 + 621 + static struct clk *_tegra_clk_register_pll(struct tegra_clk_pll *pll, 622 + const char *name, const char *parent_name, unsigned long flags, 623 + const struct clk_ops *ops) 624 + { 625 + struct clk_init_data init; 626 + 627 + init.name = name; 628 + init.ops = ops; 629 + init.flags = flags; 630 + init.parent_names = (parent_name ? &parent_name : NULL); 631 + init.num_parents = (parent_name ? 1 : 0); 632 + 1250 633 /* Data in .init is copied by clk_register(), so stack variable OK */ 1251 634 pll->hw.init = &init; 1252 635 1253 - clk = clk_register(NULL, &pll->hw); 636 + return clk_register(NULL, &pll->hw); 637 + } 638 + 639 + struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, 640 + void __iomem *clk_base, void __iomem *pmc, 641 + unsigned long flags, unsigned long fixed_rate, 642 + struct tegra_clk_pll_params *pll_params, u32 pll_flags, 643 + struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) 644 + { 645 + struct tegra_clk_pll *pll; 646 + struct clk *clk; 647 + 648 + pll_flags |= TEGRA_PLL_BYPASS; 649 + pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; 650 + pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, 651 + freq_table, lock); 652 + if (IS_ERR(pll)) 653 + return ERR_CAST(pll); 654 + 655 + clk = _tegra_clk_register_pll(pll, name, parent_name, flags, 656 + &tegra_clk_pll_ops); 1254 657 if (IS_ERR(clk)) 1255 658 kfree(pll); 1256 659 1257 660 return clk; 1258 661 } 1259 662 1260 - struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, 1261 - void __iomem *clk_base, void __iomem *pmc, 1262 - unsigned long flags, unsigned long fixed_rate, 1263 - struct tegra_clk_pll_params *pll_params, u8 pll_flags, 1264 - struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) 1265 - { 1266 - return _tegra_clk_register_pll(name, parent_name, clk_base, pmc, 1267 - flags, fixed_rate, pll_params, pll_flags, freq_table, 1268 - lock, &tegra_clk_pll_ops); 1269 - } 1270 - 1271 663 struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, 1272 664 void __iomem *clk_base, void __iomem *pmc, 1273 665 unsigned long flags, unsigned long fixed_rate, 1274 - struct tegra_clk_pll_params *pll_params, u8 pll_flags, 666 + struct tegra_clk_pll_params *pll_params, u32 pll_flags, 1275 667 struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) 1276 668 { 1277 - return _tegra_clk_register_pll(name, parent_name, clk_base, pmc, 1278 - flags, fixed_rate, pll_params, pll_flags, freq_table, 1279 - lock, &tegra_clk_plle_ops); 669 + struct tegra_clk_pll *pll; 670 + struct clk *clk; 671 + 672 + pll_flags |= TEGRA_PLL_LOCK_MISC | TEGRA_PLL_BYPASS; 673 + pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; 674 + pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, 675 + freq_table, lock); 676 + if (IS_ERR(pll)) 677 + return ERR_CAST(pll); 678 + 679 + clk = _tegra_clk_register_pll(pll, name, parent_name, flags, 680 + &tegra_clk_plle_ops); 681 + if (IS_ERR(clk)) 682 + kfree(pll); 683 + 684 + return clk; 1280 685 } 686 + 687 + #ifdef CONFIG_ARCH_TEGRA_114_SOC 688 + const struct clk_ops tegra_clk_pllxc_ops = { 689 + .is_enabled = clk_pll_is_enabled, 690 + .enable = clk_pll_iddq_enable, 691 + .disable = clk_pll_iddq_disable, 692 + .recalc_rate = clk_pll_recalc_rate, 693 + .round_rate = clk_pll_ramp_round_rate, 694 + .set_rate = clk_pllxc_set_rate, 695 + }; 696 + 697 + const struct clk_ops tegra_clk_pllm_ops = { 698 + .is_enabled = clk_pll_is_enabled, 699 + .enable = clk_pll_iddq_enable, 700 + .disable = clk_pll_iddq_disable, 701 + .recalc_rate = clk_pll_recalc_rate, 702 + .round_rate = clk_pll_ramp_round_rate, 703 + .set_rate = clk_pllm_set_rate, 704 + }; 705 + 706 + const struct clk_ops tegra_clk_pllc_ops = { 707 + .is_enabled = clk_pll_is_enabled, 708 + .enable = clk_pllc_enable, 709 + .disable = clk_pllc_disable, 710 + .recalc_rate = clk_pll_recalc_rate, 711 + .round_rate = clk_pll_ramp_round_rate, 712 + .set_rate = clk_pllc_set_rate, 713 + }; 714 + 715 + const struct clk_ops tegra_clk_pllre_ops = { 716 + .is_enabled = clk_pll_is_enabled, 717 + .enable = clk_pll_iddq_enable, 718 + .disable = clk_pll_iddq_disable, 719 + .recalc_rate = clk_pllre_recalc_rate, 720 + .round_rate = clk_pllre_round_rate, 721 + .set_rate = clk_pllre_set_rate, 722 + }; 723 + 724 + const struct clk_ops tegra_clk_plle_tegra114_ops = { 725 + .is_enabled = clk_pll_is_enabled, 726 + .enable = clk_plle_tegra114_enable, 727 + .disable = clk_plle_tegra114_disable, 728 + .recalc_rate = clk_pll_recalc_rate, 729 + }; 730 + 731 + 732 + struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name, 733 + void __iomem *clk_base, void __iomem *pmc, 734 + unsigned long flags, unsigned long fixed_rate, 735 + struct tegra_clk_pll_params *pll_params, 736 + u32 pll_flags, 737 + struct tegra_clk_pll_freq_table *freq_table, 738 + spinlock_t *lock) 739 + { 740 + struct tegra_clk_pll *pll; 741 + struct clk *clk; 742 + 743 + if (!pll_params->pdiv_tohw) 744 + return ERR_PTR(-EINVAL); 745 + 746 + pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; 747 + pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, 748 + freq_table, lock); 749 + if (IS_ERR(pll)) 750 + return ERR_CAST(pll); 751 + 752 + clk = _tegra_clk_register_pll(pll, name, parent_name, flags, 753 + &tegra_clk_pllxc_ops); 754 + if (IS_ERR(clk)) 755 + kfree(pll); 756 + 757 + return clk; 758 + } 759 + 760 + struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name, 761 + void __iomem *clk_base, void __iomem *pmc, 762 + unsigned long flags, unsigned long fixed_rate, 763 + struct tegra_clk_pll_params *pll_params, 764 + u32 pll_flags, 765 + struct tegra_clk_pll_freq_table *freq_table, 766 + spinlock_t *lock, unsigned long parent_rate) 767 + { 768 + u32 val; 769 + struct tegra_clk_pll *pll; 770 + struct clk *clk; 771 + 772 + pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; 773 + pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, 774 + freq_table, lock); 775 + if (IS_ERR(pll)) 776 + return ERR_CAST(pll); 777 + 778 + /* program minimum rate by default */ 779 + 780 + val = pll_readl_base(pll); 781 + if (val & PLL_BASE_ENABLE) 782 + WARN_ON(val & pll_params->iddq_bit_idx); 783 + else { 784 + int m; 785 + 786 + m = _pll_fixed_mdiv(pll_params, parent_rate); 787 + val = m << PLL_BASE_DIVM_SHIFT; 788 + val |= (pll_params->vco_min / parent_rate) 789 + << PLL_BASE_DIVN_SHIFT; 790 + pll_writel_base(val, pll); 791 + } 792 + 793 + /* disable lock override */ 794 + 795 + val = pll_readl_misc(pll); 796 + val &= ~BIT(29); 797 + pll_writel_misc(val, pll); 798 + 799 + pll_flags |= TEGRA_PLL_LOCK_MISC; 800 + clk = _tegra_clk_register_pll(pll, name, parent_name, flags, 801 + &tegra_clk_pllre_ops); 802 + if (IS_ERR(clk)) 803 + kfree(pll); 804 + 805 + return clk; 806 + } 807 + 808 + struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name, 809 + void __iomem *clk_base, void __iomem *pmc, 810 + unsigned long flags, unsigned long fixed_rate, 811 + struct tegra_clk_pll_params *pll_params, 812 + u32 pll_flags, 813 + struct tegra_clk_pll_freq_table *freq_table, 814 + spinlock_t *lock) 815 + { 816 + struct tegra_clk_pll *pll; 817 + struct clk *clk; 818 + 819 + if (!pll_params->pdiv_tohw) 820 + return ERR_PTR(-EINVAL); 821 + 822 + pll_flags |= TEGRA_PLL_BYPASS; 823 + pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; 824 + pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, 825 + freq_table, lock); 826 + if (IS_ERR(pll)) 827 + return ERR_CAST(pll); 828 + 829 + clk = _tegra_clk_register_pll(pll, name, parent_name, flags, 830 + &tegra_clk_pllm_ops); 831 + if (IS_ERR(clk)) 832 + kfree(pll); 833 + 834 + return clk; 835 + } 836 + 837 + struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, 838 + void __iomem *clk_base, void __iomem *pmc, 839 + unsigned long flags, unsigned long fixed_rate, 840 + struct tegra_clk_pll_params *pll_params, 841 + u32 pll_flags, 842 + struct tegra_clk_pll_freq_table *freq_table, 843 + spinlock_t *lock) 844 + { 845 + struct clk *parent, *clk; 846 + struct pdiv_map *p_tohw = pll_params->pdiv_tohw; 847 + struct tegra_clk_pll *pll; 848 + struct tegra_clk_pll_freq_table cfg; 849 + unsigned long parent_rate; 850 + 851 + if (!p_tohw) 852 + return ERR_PTR(-EINVAL); 853 + 854 + parent = __clk_lookup(parent_name); 855 + if (IS_ERR(parent)) { 856 + WARN(1, "parent clk %s of %s must be registered first\n", 857 + name, parent_name); 858 + return ERR_PTR(-EINVAL); 859 + } 860 + 861 + pll_flags |= TEGRA_PLL_BYPASS; 862 + pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, 863 + freq_table, lock); 864 + if (IS_ERR(pll)) 865 + return ERR_CAST(pll); 866 + 867 + parent_rate = __clk_get_rate(parent); 868 + 869 + /* 870 + * Most of PLLC register fields are shadowed, and can not be read 871 + * directly from PLL h/w. Hence, actual PLLC boot state is unknown. 872 + * Initialize PLL to default state: disabled, reset; shadow registers 873 + * loaded with default parameters; dividers are preset for half of 874 + * minimum VCO rate (the latter assured that shadowed divider settings 875 + * are within supported range). 876 + */ 877 + 878 + cfg.m = _pll_fixed_mdiv(pll_params, parent_rate); 879 + cfg.n = cfg.m * pll_params->vco_min / parent_rate; 880 + 881 + while (p_tohw->pdiv) { 882 + if (p_tohw->pdiv == 2) { 883 + cfg.p = p_tohw->hw_val; 884 + break; 885 + } 886 + p_tohw++; 887 + } 888 + 889 + if (!p_tohw->pdiv) { 890 + WARN_ON(1); 891 + return ERR_PTR(-EINVAL); 892 + } 893 + 894 + pll_writel_base(0, pll); 895 + _update_pll_mnp(pll, &cfg); 896 + 897 + pll_writel_misc(PLLCX_MISC_DEFAULT, pll); 898 + pll_writel(PLLCX_MISC1_DEFAULT, pll_params->ext_misc_reg[0], pll); 899 + pll_writel(PLLCX_MISC2_DEFAULT, pll_params->ext_misc_reg[1], pll); 900 + pll_writel(PLLCX_MISC3_DEFAULT, pll_params->ext_misc_reg[2], pll); 901 + 902 + _pllcx_update_dynamic_coef(pll, parent_rate, cfg.n); 903 + 904 + clk = _tegra_clk_register_pll(pll, name, parent_name, flags, 905 + &tegra_clk_pllc_ops); 906 + if (IS_ERR(clk)) 907 + kfree(pll); 908 + 909 + return clk; 910 + } 911 + 912 + struct clk *tegra_clk_register_plle_tegra114(const char *name, 913 + const char *parent_name, 914 + void __iomem *clk_base, unsigned long flags, 915 + unsigned long fixed_rate, 916 + struct tegra_clk_pll_params *pll_params, 917 + struct tegra_clk_pll_freq_table *freq_table, 918 + spinlock_t *lock) 919 + { 920 + struct tegra_clk_pll *pll; 921 + struct clk *clk; 922 + u32 val, val_aux; 923 + 924 + pll = _tegra_init_pll(clk_base, NULL, fixed_rate, pll_params, 925 + TEGRA_PLL_HAS_LOCK_ENABLE, freq_table, lock); 926 + if (IS_ERR(pll)) 927 + return ERR_CAST(pll); 928 + 929 + /* ensure parent is set to pll_re_vco */ 930 + 931 + val = pll_readl_base(pll); 932 + val_aux = pll_readl(pll_params->aux_reg, pll); 933 + 934 + if (val & PLL_BASE_ENABLE) { 935 + if (!(val_aux & PLLE_AUX_PLLRE_SEL)) 936 + WARN(1, "pll_e enabled with unsupported parent %s\n", 937 + (val & PLLE_AUX_PLLP_SEL) ? "pllp_out0" : "pll_ref"); 938 + } else { 939 + val_aux |= PLLE_AUX_PLLRE_SEL; 940 + pll_writel(val, pll_params->aux_reg, pll); 941 + } 942 + 943 + clk = _tegra_clk_register_pll(pll, name, parent_name, flags, 944 + &tegra_clk_plle_tegra114_ops); 945 + if (IS_ERR(clk)) 946 + kfree(pll); 947 + 948 + return clk; 949 + } 950 + #endif
+2085
drivers/clk/tegra/clk-tegra114.c
··· 1 + /* 2 + * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. 3 + * 4 + * This program is free software; you can redistribute it and/or modify it 5 + * under the terms and conditions of the GNU General Public License, 6 + * version 2, as published by the Free Software Foundation. 7 + * 8 + * This program is distributed in the hope it will be useful, but WITHOUT 9 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 + * more details. 12 + * 13 + * You should have received a copy of the GNU General Public License 14 + * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 + */ 16 + 17 + #include <linux/io.h> 18 + #include <linux/clk.h> 19 + #include <linux/clk-provider.h> 20 + #include <linux/clkdev.h> 21 + #include <linux/of.h> 22 + #include <linux/of_address.h> 23 + #include <linux/delay.h> 24 + #include <linux/clk/tegra.h> 25 + 26 + #include "clk.h" 27 + 28 + #define RST_DEVICES_L 0x004 29 + #define RST_DEVICES_H 0x008 30 + #define RST_DEVICES_U 0x00C 31 + #define RST_DEVICES_V 0x358 32 + #define RST_DEVICES_W 0x35C 33 + #define RST_DEVICES_X 0x28C 34 + #define RST_DEVICES_SET_L 0x300 35 + #define RST_DEVICES_CLR_L 0x304 36 + #define RST_DEVICES_SET_H 0x308 37 + #define RST_DEVICES_CLR_H 0x30c 38 + #define RST_DEVICES_SET_U 0x310 39 + #define RST_DEVICES_CLR_U 0x314 40 + #define RST_DEVICES_SET_V 0x430 41 + #define RST_DEVICES_CLR_V 0x434 42 + #define RST_DEVICES_SET_W 0x438 43 + #define RST_DEVICES_CLR_W 0x43c 44 + #define RST_DEVICES_NUM 5 45 + 46 + #define CLK_OUT_ENB_L 0x010 47 + #define CLK_OUT_ENB_H 0x014 48 + #define CLK_OUT_ENB_U 0x018 49 + #define CLK_OUT_ENB_V 0x360 50 + #define CLK_OUT_ENB_W 0x364 51 + #define CLK_OUT_ENB_X 0x280 52 + #define CLK_OUT_ENB_SET_L 0x320 53 + #define CLK_OUT_ENB_CLR_L 0x324 54 + #define CLK_OUT_ENB_SET_H 0x328 55 + #define CLK_OUT_ENB_CLR_H 0x32c 56 + #define CLK_OUT_ENB_SET_U 0x330 57 + #define CLK_OUT_ENB_CLR_U 0x334 58 + #define CLK_OUT_ENB_SET_V 0x440 59 + #define CLK_OUT_ENB_CLR_V 0x444 60 + #define CLK_OUT_ENB_SET_W 0x448 61 + #define CLK_OUT_ENB_CLR_W 0x44c 62 + #define CLK_OUT_ENB_SET_X 0x284 63 + #define CLK_OUT_ENB_CLR_X 0x288 64 + #define CLK_OUT_ENB_NUM 6 65 + 66 + #define PLLC_BASE 0x80 67 + #define PLLC_MISC2 0x88 68 + #define PLLC_MISC 0x8c 69 + #define PLLC2_BASE 0x4e8 70 + #define PLLC2_MISC 0x4ec 71 + #define PLLC3_BASE 0x4fc 72 + #define PLLC3_MISC 0x500 73 + #define PLLM_BASE 0x90 74 + #define PLLM_MISC 0x9c 75 + #define PLLP_BASE 0xa0 76 + #define PLLP_MISC 0xac 77 + #define PLLX_BASE 0xe0 78 + #define PLLX_MISC 0xe4 79 + #define PLLX_MISC2 0x514 80 + #define PLLX_MISC3 0x518 81 + #define PLLD_BASE 0xd0 82 + #define PLLD_MISC 0xdc 83 + #define PLLD2_BASE 0x4b8 84 + #define PLLD2_MISC 0x4bc 85 + #define PLLE_BASE 0xe8 86 + #define PLLE_MISC 0xec 87 + #define PLLA_BASE 0xb0 88 + #define PLLA_MISC 0xbc 89 + #define PLLU_BASE 0xc0 90 + #define PLLU_MISC 0xcc 91 + #define PLLRE_BASE 0x4c4 92 + #define PLLRE_MISC 0x4c8 93 + 94 + #define PLL_MISC_LOCK_ENABLE 18 95 + #define PLLC_MISC_LOCK_ENABLE 24 96 + #define PLLDU_MISC_LOCK_ENABLE 22 97 + #define PLLE_MISC_LOCK_ENABLE 9 98 + #define PLLRE_MISC_LOCK_ENABLE 30 99 + 100 + #define PLLC_IDDQ_BIT 26 101 + #define PLLX_IDDQ_BIT 3 102 + #define PLLRE_IDDQ_BIT 16 103 + 104 + #define PLL_BASE_LOCK BIT(27) 105 + #define PLLE_MISC_LOCK BIT(11) 106 + #define PLLRE_MISC_LOCK BIT(24) 107 + #define PLLCX_BASE_LOCK (BIT(26)|BIT(27)) 108 + 109 + #define PLLE_AUX 0x48c 110 + #define PLLC_OUT 0x84 111 + #define PLLM_OUT 0x94 112 + #define PLLP_OUTA 0xa4 113 + #define PLLP_OUTB 0xa8 114 + #define PLLA_OUT 0xb4 115 + 116 + #define AUDIO_SYNC_CLK_I2S0 0x4a0 117 + #define AUDIO_SYNC_CLK_I2S1 0x4a4 118 + #define AUDIO_SYNC_CLK_I2S2 0x4a8 119 + #define AUDIO_SYNC_CLK_I2S3 0x4ac 120 + #define AUDIO_SYNC_CLK_I2S4 0x4b0 121 + #define AUDIO_SYNC_CLK_SPDIF 0x4b4 122 + 123 + #define AUDIO_SYNC_DOUBLER 0x49c 124 + 125 + #define PMC_CLK_OUT_CNTRL 0x1a8 126 + #define PMC_DPD_PADS_ORIDE 0x1c 127 + #define PMC_DPD_PADS_ORIDE_BLINK_ENB 20 128 + #define PMC_CTRL 0 129 + #define PMC_CTRL_BLINK_ENB 7 130 + 131 + #define OSC_CTRL 0x50 132 + #define OSC_CTRL_OSC_FREQ_SHIFT 28 133 + #define OSC_CTRL_PLL_REF_DIV_SHIFT 26 134 + 135 + #define PLLXC_SW_MAX_P 6 136 + 137 + #define CCLKG_BURST_POLICY 0x368 138 + #define CCLKLP_BURST_POLICY 0x370 139 + #define SCLK_BURST_POLICY 0x028 140 + #define SYSTEM_CLK_RATE 0x030 141 + 142 + #define UTMIP_PLL_CFG2 0x488 143 + #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6) 144 + #define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18) 145 + #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN BIT(0) 146 + #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN BIT(2) 147 + #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN BIT(4) 148 + 149 + #define UTMIP_PLL_CFG1 0x484 150 + #define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 6) 151 + #define UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(x) (((x) & 0xfff) << 0) 152 + #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP BIT(17) 153 + #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN BIT(16) 154 + #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP BIT(15) 155 + #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN BIT(14) 156 + #define UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN BIT(12) 157 + 158 + #define UTMIPLL_HW_PWRDN_CFG0 0x52c 159 + #define UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE BIT(25) 160 + #define UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE BIT(24) 161 + #define UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET BIT(6) 162 + #define UTMIPLL_HW_PWRDN_CFG0_SEQ_RESET_INPUT_VALUE BIT(5) 163 + #define UTMIPLL_HW_PWRDN_CFG0_SEQ_IN_SWCTL BIT(4) 164 + #define UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL BIT(2) 165 + #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE BIT(1) 166 + #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0) 167 + 168 + #define CLK_SOURCE_I2S0 0x1d8 169 + #define CLK_SOURCE_I2S1 0x100 170 + #define CLK_SOURCE_I2S2 0x104 171 + #define CLK_SOURCE_NDFLASH 0x160 172 + #define CLK_SOURCE_I2S3 0x3bc 173 + #define CLK_SOURCE_I2S4 0x3c0 174 + #define CLK_SOURCE_SPDIF_OUT 0x108 175 + #define CLK_SOURCE_SPDIF_IN 0x10c 176 + #define CLK_SOURCE_PWM 0x110 177 + #define CLK_SOURCE_ADX 0x638 178 + #define CLK_SOURCE_AMX 0x63c 179 + #define CLK_SOURCE_HDA 0x428 180 + #define CLK_SOURCE_HDA2CODEC_2X 0x3e4 181 + #define CLK_SOURCE_SBC1 0x134 182 + #define CLK_SOURCE_SBC2 0x118 183 + #define CLK_SOURCE_SBC3 0x11c 184 + #define CLK_SOURCE_SBC4 0x1b4 185 + #define CLK_SOURCE_SBC5 0x3c8 186 + #define CLK_SOURCE_SBC6 0x3cc 187 + #define CLK_SOURCE_SATA_OOB 0x420 188 + #define CLK_SOURCE_SATA 0x424 189 + #define CLK_SOURCE_NDSPEED 0x3f8 190 + #define CLK_SOURCE_VFIR 0x168 191 + #define CLK_SOURCE_SDMMC1 0x150 192 + #define CLK_SOURCE_SDMMC2 0x154 193 + #define CLK_SOURCE_SDMMC3 0x1bc 194 + #define CLK_SOURCE_SDMMC4 0x164 195 + #define CLK_SOURCE_VDE 0x1c8 196 + #define CLK_SOURCE_CSITE 0x1d4 197 + #define CLK_SOURCE_LA 0x1f8 198 + #define CLK_SOURCE_TRACE 0x634 199 + #define CLK_SOURCE_OWR 0x1cc 200 + #define CLK_SOURCE_NOR 0x1d0 201 + #define CLK_SOURCE_MIPI 0x174 202 + #define CLK_SOURCE_I2C1 0x124 203 + #define CLK_SOURCE_I2C2 0x198 204 + #define CLK_SOURCE_I2C3 0x1b8 205 + #define CLK_SOURCE_I2C4 0x3c4 206 + #define CLK_SOURCE_I2C5 0x128 207 + #define CLK_SOURCE_UARTA 0x178 208 + #define CLK_SOURCE_UARTB 0x17c 209 + #define CLK_SOURCE_UARTC 0x1a0 210 + #define CLK_SOURCE_UARTD 0x1c0 211 + #define CLK_SOURCE_UARTE 0x1c4 212 + #define CLK_SOURCE_UARTA_DBG 0x178 213 + #define CLK_SOURCE_UARTB_DBG 0x17c 214 + #define CLK_SOURCE_UARTC_DBG 0x1a0 215 + #define CLK_SOURCE_UARTD_DBG 0x1c0 216 + #define CLK_SOURCE_UARTE_DBG 0x1c4 217 + #define CLK_SOURCE_3D 0x158 218 + #define CLK_SOURCE_2D 0x15c 219 + #define CLK_SOURCE_VI_SENSOR 0x1a8 220 + #define CLK_SOURCE_VI 0x148 221 + #define CLK_SOURCE_EPP 0x16c 222 + #define CLK_SOURCE_MSENC 0x1f0 223 + #define CLK_SOURCE_TSEC 0x1f4 224 + #define CLK_SOURCE_HOST1X 0x180 225 + #define CLK_SOURCE_HDMI 0x18c 226 + #define CLK_SOURCE_DISP1 0x138 227 + #define CLK_SOURCE_DISP2 0x13c 228 + #define CLK_SOURCE_CILAB 0x614 229 + #define CLK_SOURCE_CILCD 0x618 230 + #define CLK_SOURCE_CILE 0x61c 231 + #define CLK_SOURCE_DSIALP 0x620 232 + #define CLK_SOURCE_DSIBLP 0x624 233 + #define CLK_SOURCE_TSENSOR 0x3b8 234 + #define CLK_SOURCE_D_AUDIO 0x3d0 235 + #define CLK_SOURCE_DAM0 0x3d8 236 + #define CLK_SOURCE_DAM1 0x3dc 237 + #define CLK_SOURCE_DAM2 0x3e0 238 + #define CLK_SOURCE_ACTMON 0x3e8 239 + #define CLK_SOURCE_EXTERN1 0x3ec 240 + #define CLK_SOURCE_EXTERN2 0x3f0 241 + #define CLK_SOURCE_EXTERN3 0x3f4 242 + #define CLK_SOURCE_I2CSLOW 0x3fc 243 + #define CLK_SOURCE_SE 0x42c 244 + #define CLK_SOURCE_MSELECT 0x3b4 245 + #define CLK_SOURCE_SOC_THERM 0x644 246 + #define CLK_SOURCE_XUSB_HOST_SRC 0x600 247 + #define CLK_SOURCE_XUSB_FALCON_SRC 0x604 248 + #define CLK_SOURCE_XUSB_FS_SRC 0x608 249 + #define CLK_SOURCE_XUSB_SS_SRC 0x610 250 + #define CLK_SOURCE_XUSB_DEV_SRC 0x60c 251 + #define CLK_SOURCE_EMC 0x19c 252 + 253 + static int periph_clk_enb_refcnt[CLK_OUT_ENB_NUM * 32]; 254 + 255 + static void __iomem *clk_base; 256 + static void __iomem *pmc_base; 257 + 258 + static DEFINE_SPINLOCK(pll_d_lock); 259 + static DEFINE_SPINLOCK(pll_d2_lock); 260 + static DEFINE_SPINLOCK(pll_u_lock); 261 + static DEFINE_SPINLOCK(pll_div_lock); 262 + static DEFINE_SPINLOCK(pll_re_lock); 263 + static DEFINE_SPINLOCK(clk_doubler_lock); 264 + static DEFINE_SPINLOCK(clk_out_lock); 265 + static DEFINE_SPINLOCK(sysrate_lock); 266 + 267 + static struct pdiv_map pllxc_p[] = { 268 + { .pdiv = 1, .hw_val = 0 }, 269 + { .pdiv = 2, .hw_val = 1 }, 270 + { .pdiv = 3, .hw_val = 2 }, 271 + { .pdiv = 4, .hw_val = 3 }, 272 + { .pdiv = 5, .hw_val = 4 }, 273 + { .pdiv = 6, .hw_val = 5 }, 274 + { .pdiv = 8, .hw_val = 6 }, 275 + { .pdiv = 10, .hw_val = 7 }, 276 + { .pdiv = 12, .hw_val = 8 }, 277 + { .pdiv = 16, .hw_val = 9 }, 278 + { .pdiv = 12, .hw_val = 10 }, 279 + { .pdiv = 16, .hw_val = 11 }, 280 + { .pdiv = 20, .hw_val = 12 }, 281 + { .pdiv = 24, .hw_val = 13 }, 282 + { .pdiv = 32, .hw_val = 14 }, 283 + { .pdiv = 0, .hw_val = 0 }, 284 + }; 285 + 286 + static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { 287 + { 12000000, 624000000, 104, 0, 2}, 288 + { 12000000, 600000000, 100, 0, 2}, 289 + { 13000000, 600000000, 92, 0, 2}, /* actual: 598.0 MHz */ 290 + { 16800000, 600000000, 71, 0, 2}, /* actual: 596.4 MHz */ 291 + { 19200000, 600000000, 62, 0, 2}, /* actual: 595.2 MHz */ 292 + { 26000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */ 293 + { 0, 0, 0, 0, 0, 0 }, 294 + }; 295 + 296 + static struct tegra_clk_pll_params pll_c_params = { 297 + .input_min = 12000000, 298 + .input_max = 800000000, 299 + .cf_min = 12000000, 300 + .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ 301 + .vco_min = 600000000, 302 + .vco_max = 1400000000, 303 + .base_reg = PLLC_BASE, 304 + .misc_reg = PLLC_MISC, 305 + .lock_mask = PLL_BASE_LOCK, 306 + .lock_enable_bit_idx = PLLC_MISC_LOCK_ENABLE, 307 + .lock_delay = 300, 308 + .iddq_reg = PLLC_MISC, 309 + .iddq_bit_idx = PLLC_IDDQ_BIT, 310 + .max_p = PLLXC_SW_MAX_P, 311 + .dyn_ramp_reg = PLLC_MISC2, 312 + .stepa_shift = 17, 313 + .stepb_shift = 9, 314 + .pdiv_tohw = pllxc_p, 315 + }; 316 + 317 + static struct pdiv_map pllc_p[] = { 318 + { .pdiv = 1, .hw_val = 0 }, 319 + { .pdiv = 2, .hw_val = 1 }, 320 + { .pdiv = 4, .hw_val = 3 }, 321 + { .pdiv = 8, .hw_val = 5 }, 322 + { .pdiv = 16, .hw_val = 7 }, 323 + { .pdiv = 0, .hw_val = 0 }, 324 + }; 325 + 326 + static struct tegra_clk_pll_freq_table pll_cx_freq_table[] = { 327 + {12000000, 600000000, 100, 0, 2}, 328 + {13000000, 600000000, 92, 0, 2}, /* actual: 598.0 MHz */ 329 + {16800000, 600000000, 71, 0, 2}, /* actual: 596.4 MHz */ 330 + {19200000, 600000000, 62, 0, 2}, /* actual: 595.2 MHz */ 331 + {26000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */ 332 + {0, 0, 0, 0, 0, 0}, 333 + }; 334 + 335 + static struct tegra_clk_pll_params pll_c2_params = { 336 + .input_min = 12000000, 337 + .input_max = 48000000, 338 + .cf_min = 12000000, 339 + .cf_max = 19200000, 340 + .vco_min = 600000000, 341 + .vco_max = 1200000000, 342 + .base_reg = PLLC2_BASE, 343 + .misc_reg = PLLC2_MISC, 344 + .lock_mask = PLL_BASE_LOCK, 345 + .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 346 + .lock_delay = 300, 347 + .pdiv_tohw = pllc_p, 348 + .ext_misc_reg[0] = 0x4f0, 349 + .ext_misc_reg[1] = 0x4f4, 350 + .ext_misc_reg[2] = 0x4f8, 351 + }; 352 + 353 + static struct tegra_clk_pll_params pll_c3_params = { 354 + .input_min = 12000000, 355 + .input_max = 48000000, 356 + .cf_min = 12000000, 357 + .cf_max = 19200000, 358 + .vco_min = 600000000, 359 + .vco_max = 1200000000, 360 + .base_reg = PLLC3_BASE, 361 + .misc_reg = PLLC3_MISC, 362 + .lock_mask = PLL_BASE_LOCK, 363 + .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 364 + .lock_delay = 300, 365 + .pdiv_tohw = pllc_p, 366 + .ext_misc_reg[0] = 0x504, 367 + .ext_misc_reg[1] = 0x508, 368 + .ext_misc_reg[2] = 0x50c, 369 + }; 370 + 371 + static struct pdiv_map pllm_p[] = { 372 + { .pdiv = 1, .hw_val = 0 }, 373 + { .pdiv = 2, .hw_val = 1 }, 374 + { .pdiv = 0, .hw_val = 0 }, 375 + }; 376 + 377 + static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { 378 + {12000000, 800000000, 66, 0, 1}, /* actual: 792.0 MHz */ 379 + {13000000, 800000000, 61, 0, 1}, /* actual: 793.0 MHz */ 380 + {16800000, 800000000, 47, 0, 1}, /* actual: 789.6 MHz */ 381 + {19200000, 800000000, 41, 0, 1}, /* actual: 787.2 MHz */ 382 + {26000000, 800000000, 61, 1, 1}, /* actual: 793.0 MHz */ 383 + {0, 0, 0, 0, 0, 0}, 384 + }; 385 + 386 + static struct tegra_clk_pll_params pll_m_params = { 387 + .input_min = 12000000, 388 + .input_max = 500000000, 389 + .cf_min = 12000000, 390 + .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ 391 + .vco_min = 400000000, 392 + .vco_max = 1066000000, 393 + .base_reg = PLLM_BASE, 394 + .misc_reg = PLLM_MISC, 395 + .lock_mask = PLL_BASE_LOCK, 396 + .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 397 + .lock_delay = 300, 398 + .max_p = 2, 399 + .pdiv_tohw = pllm_p, 400 + }; 401 + 402 + static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { 403 + {12000000, 216000000, 432, 12, 1, 8}, 404 + {13000000, 216000000, 432, 13, 1, 8}, 405 + {16800000, 216000000, 360, 14, 1, 8}, 406 + {19200000, 216000000, 360, 16, 1, 8}, 407 + {26000000, 216000000, 432, 26, 1, 8}, 408 + {0, 0, 0, 0, 0, 0}, 409 + }; 410 + 411 + static struct tegra_clk_pll_params pll_p_params = { 412 + .input_min = 2000000, 413 + .input_max = 31000000, 414 + .cf_min = 1000000, 415 + .cf_max = 6000000, 416 + .vco_min = 200000000, 417 + .vco_max = 700000000, 418 + .base_reg = PLLP_BASE, 419 + .misc_reg = PLLP_MISC, 420 + .lock_mask = PLL_BASE_LOCK, 421 + .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 422 + .lock_delay = 300, 423 + }; 424 + 425 + static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { 426 + {9600000, 282240000, 147, 5, 0, 4}, 427 + {9600000, 368640000, 192, 5, 0, 4}, 428 + {9600000, 240000000, 200, 8, 0, 8}, 429 + 430 + {28800000, 282240000, 245, 25, 0, 8}, 431 + {28800000, 368640000, 320, 25, 0, 8}, 432 + {28800000, 240000000, 200, 24, 0, 8}, 433 + {0, 0, 0, 0, 0, 0}, 434 + }; 435 + 436 + 437 + static struct tegra_clk_pll_params pll_a_params = { 438 + .input_min = 2000000, 439 + .input_max = 31000000, 440 + .cf_min = 1000000, 441 + .cf_max = 6000000, 442 + .vco_min = 200000000, 443 + .vco_max = 700000000, 444 + .base_reg = PLLA_BASE, 445 + .misc_reg = PLLA_MISC, 446 + .lock_mask = PLL_BASE_LOCK, 447 + .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 448 + .lock_delay = 300, 449 + }; 450 + 451 + static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { 452 + {12000000, 216000000, 864, 12, 2, 12}, 453 + {13000000, 216000000, 864, 13, 2, 12}, 454 + {16800000, 216000000, 720, 14, 2, 12}, 455 + {19200000, 216000000, 720, 16, 2, 12}, 456 + {26000000, 216000000, 864, 26, 2, 12}, 457 + 458 + {12000000, 594000000, 594, 12, 0, 12}, 459 + {13000000, 594000000, 594, 13, 0, 12}, 460 + {16800000, 594000000, 495, 14, 0, 12}, 461 + {19200000, 594000000, 495, 16, 0, 12}, 462 + {26000000, 594000000, 594, 26, 0, 12}, 463 + 464 + {12000000, 1000000000, 1000, 12, 0, 12}, 465 + {13000000, 1000000000, 1000, 13, 0, 12}, 466 + {19200000, 1000000000, 625, 12, 0, 12}, 467 + {26000000, 1000000000, 1000, 26, 0, 12}, 468 + 469 + {0, 0, 0, 0, 0, 0}, 470 + }; 471 + 472 + static struct tegra_clk_pll_params pll_d_params = { 473 + .input_min = 2000000, 474 + .input_max = 40000000, 475 + .cf_min = 1000000, 476 + .cf_max = 6000000, 477 + .vco_min = 500000000, 478 + .vco_max = 1000000000, 479 + .base_reg = PLLD_BASE, 480 + .misc_reg = PLLD_MISC, 481 + .lock_mask = PLL_BASE_LOCK, 482 + .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, 483 + .lock_delay = 1000, 484 + }; 485 + 486 + static struct tegra_clk_pll_params pll_d2_params = { 487 + .input_min = 2000000, 488 + .input_max = 40000000, 489 + .cf_min = 1000000, 490 + .cf_max = 6000000, 491 + .vco_min = 500000000, 492 + .vco_max = 1000000000, 493 + .base_reg = PLLD2_BASE, 494 + .misc_reg = PLLD2_MISC, 495 + .lock_mask = PLL_BASE_LOCK, 496 + .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, 497 + .lock_delay = 1000, 498 + }; 499 + 500 + static struct pdiv_map pllu_p[] = { 501 + { .pdiv = 1, .hw_val = 1 }, 502 + { .pdiv = 2, .hw_val = 0 }, 503 + { .pdiv = 0, .hw_val = 0 }, 504 + }; 505 + 506 + static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { 507 + {12000000, 480000000, 960, 12, 0, 12}, 508 + {13000000, 480000000, 960, 13, 0, 12}, 509 + {16800000, 480000000, 400, 7, 0, 5}, 510 + {19200000, 480000000, 200, 4, 0, 3}, 511 + {26000000, 480000000, 960, 26, 0, 12}, 512 + {0, 0, 0, 0, 0, 0}, 513 + }; 514 + 515 + static struct tegra_clk_pll_params pll_u_params = { 516 + .input_min = 2000000, 517 + .input_max = 40000000, 518 + .cf_min = 1000000, 519 + .cf_max = 6000000, 520 + .vco_min = 480000000, 521 + .vco_max = 960000000, 522 + .base_reg = PLLU_BASE, 523 + .misc_reg = PLLU_MISC, 524 + .lock_mask = PLL_BASE_LOCK, 525 + .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, 526 + .lock_delay = 1000, 527 + .pdiv_tohw = pllu_p, 528 + }; 529 + 530 + static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { 531 + /* 1 GHz */ 532 + {12000000, 1000000000, 83, 0, 1}, /* actual: 996.0 MHz */ 533 + {13000000, 1000000000, 76, 0, 1}, /* actual: 988.0 MHz */ 534 + {16800000, 1000000000, 59, 0, 1}, /* actual: 991.2 MHz */ 535 + {19200000, 1000000000, 52, 0, 1}, /* actual: 998.4 MHz */ 536 + {26000000, 1000000000, 76, 1, 1}, /* actual: 988.0 MHz */ 537 + 538 + {0, 0, 0, 0, 0, 0}, 539 + }; 540 + 541 + static struct tegra_clk_pll_params pll_x_params = { 542 + .input_min = 12000000, 543 + .input_max = 800000000, 544 + .cf_min = 12000000, 545 + .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ 546 + .vco_min = 700000000, 547 + .vco_max = 2400000000U, 548 + .base_reg = PLLX_BASE, 549 + .misc_reg = PLLX_MISC, 550 + .lock_mask = PLL_BASE_LOCK, 551 + .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 552 + .lock_delay = 300, 553 + .iddq_reg = PLLX_MISC3, 554 + .iddq_bit_idx = PLLX_IDDQ_BIT, 555 + .max_p = PLLXC_SW_MAX_P, 556 + .dyn_ramp_reg = PLLX_MISC2, 557 + .stepa_shift = 16, 558 + .stepb_shift = 24, 559 + .pdiv_tohw = pllxc_p, 560 + }; 561 + 562 + static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { 563 + /* PLLE special case: use cpcon field to store cml divider value */ 564 + {336000000, 100000000, 100, 21, 16, 11}, 565 + {312000000, 100000000, 200, 26, 24, 13}, 566 + {0, 0, 0, 0, 0, 0}, 567 + }; 568 + 569 + static struct tegra_clk_pll_params pll_e_params = { 570 + .input_min = 12000000, 571 + .input_max = 1000000000, 572 + .cf_min = 12000000, 573 + .cf_max = 75000000, 574 + .vco_min = 1600000000, 575 + .vco_max = 2400000000U, 576 + .base_reg = PLLE_BASE, 577 + .misc_reg = PLLE_MISC, 578 + .aux_reg = PLLE_AUX, 579 + .lock_mask = PLLE_MISC_LOCK, 580 + .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, 581 + .lock_delay = 300, 582 + }; 583 + 584 + static struct tegra_clk_pll_params pll_re_vco_params = { 585 + .input_min = 12000000, 586 + .input_max = 1000000000, 587 + .cf_min = 12000000, 588 + .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */ 589 + .vco_min = 300000000, 590 + .vco_max = 600000000, 591 + .base_reg = PLLRE_BASE, 592 + .misc_reg = PLLRE_MISC, 593 + .lock_mask = PLLRE_MISC_LOCK, 594 + .lock_enable_bit_idx = PLLRE_MISC_LOCK_ENABLE, 595 + .lock_delay = 300, 596 + .iddq_reg = PLLRE_MISC, 597 + .iddq_bit_idx = PLLRE_IDDQ_BIT, 598 + }; 599 + 600 + /* Peripheral clock registers */ 601 + 602 + static struct tegra_clk_periph_regs periph_l_regs = { 603 + .enb_reg = CLK_OUT_ENB_L, 604 + .enb_set_reg = CLK_OUT_ENB_SET_L, 605 + .enb_clr_reg = CLK_OUT_ENB_CLR_L, 606 + .rst_reg = RST_DEVICES_L, 607 + .rst_set_reg = RST_DEVICES_SET_L, 608 + .rst_clr_reg = RST_DEVICES_CLR_L, 609 + }; 610 + 611 + static struct tegra_clk_periph_regs periph_h_regs = { 612 + .enb_reg = CLK_OUT_ENB_H, 613 + .enb_set_reg = CLK_OUT_ENB_SET_H, 614 + .enb_clr_reg = CLK_OUT_ENB_CLR_H, 615 + .rst_reg = RST_DEVICES_H, 616 + .rst_set_reg = RST_DEVICES_SET_H, 617 + .rst_clr_reg = RST_DEVICES_CLR_H, 618 + }; 619 + 620 + static struct tegra_clk_periph_regs periph_u_regs = { 621 + .enb_reg = CLK_OUT_ENB_U, 622 + .enb_set_reg = CLK_OUT_ENB_SET_U, 623 + .enb_clr_reg = CLK_OUT_ENB_CLR_U, 624 + .rst_reg = RST_DEVICES_U, 625 + .rst_set_reg = RST_DEVICES_SET_U, 626 + .rst_clr_reg = RST_DEVICES_CLR_U, 627 + }; 628 + 629 + static struct tegra_clk_periph_regs periph_v_regs = { 630 + .enb_reg = CLK_OUT_ENB_V, 631 + .enb_set_reg = CLK_OUT_ENB_SET_V, 632 + .enb_clr_reg = CLK_OUT_ENB_CLR_V, 633 + .rst_reg = RST_DEVICES_V, 634 + .rst_set_reg = RST_DEVICES_SET_V, 635 + .rst_clr_reg = RST_DEVICES_CLR_V, 636 + }; 637 + 638 + static struct tegra_clk_periph_regs periph_w_regs = { 639 + .enb_reg = CLK_OUT_ENB_W, 640 + .enb_set_reg = CLK_OUT_ENB_SET_W, 641 + .enb_clr_reg = CLK_OUT_ENB_CLR_W, 642 + .rst_reg = RST_DEVICES_W, 643 + .rst_set_reg = RST_DEVICES_SET_W, 644 + .rst_clr_reg = RST_DEVICES_CLR_W, 645 + }; 646 + 647 + /* possible OSC frequencies in Hz */ 648 + static unsigned long tegra114_input_freq[] = { 649 + [0] = 13000000, 650 + [1] = 16800000, 651 + [4] = 19200000, 652 + [5] = 38400000, 653 + [8] = 12000000, 654 + [9] = 48000000, 655 + [12] = 260000000, 656 + }; 657 + 658 + #define MASK(x) (BIT(x) - 1) 659 + 660 + #define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \ 661 + _clk_num, _regs, _gate_flags, _clk_id) \ 662 + TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ 663 + 30, MASK(2), 0, 0, 8, 1, 0, _regs, _clk_num, \ 664 + periph_clk_enb_refcnt, _gate_flags, _clk_id, \ 665 + _parents##_idx, 0) 666 + 667 + #define TEGRA_INIT_DATA_MUX_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\ 668 + _clk_num, _regs, _gate_flags, _clk_id, flags)\ 669 + TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ 670 + 30, MASK(2), 0, 0, 8, 1, 0, _regs, _clk_num, \ 671 + periph_clk_enb_refcnt, _gate_flags, _clk_id, \ 672 + _parents##_idx, flags) 673 + 674 + #define TEGRA_INIT_DATA_MUX8(_name, _con_id, _dev_id, _parents, _offset, \ 675 + _clk_num, _regs, _gate_flags, _clk_id) \ 676 + TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ 677 + 29, MASK(3), 0, 0, 8, 1, 0, _regs, _clk_num, \ 678 + periph_clk_enb_refcnt, _gate_flags, _clk_id, \ 679 + _parents##_idx, 0) 680 + 681 + #define TEGRA_INIT_DATA_INT(_name, _con_id, _dev_id, _parents, _offset, \ 682 + _clk_num, _regs, _gate_flags, _clk_id) \ 683 + TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ 684 + 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ 685 + _clk_num, periph_clk_enb_refcnt, _gate_flags, \ 686 + _clk_id, _parents##_idx, 0) 687 + 688 + #define TEGRA_INIT_DATA_INT_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\ 689 + _clk_num, _regs, _gate_flags, _clk_id, flags)\ 690 + TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ 691 + 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ 692 + _clk_num, periph_clk_enb_refcnt, _gate_flags, \ 693 + _clk_id, _parents##_idx, flags) 694 + 695 + #define TEGRA_INIT_DATA_INT8(_name, _con_id, _dev_id, _parents, _offset,\ 696 + _clk_num, _regs, _gate_flags, _clk_id) \ 697 + TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ 698 + 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ 699 + _clk_num, periph_clk_enb_refcnt, _gate_flags, \ 700 + _clk_id, _parents##_idx, 0) 701 + 702 + #define TEGRA_INIT_DATA_UART(_name, _con_id, _dev_id, _parents, _offset,\ 703 + _clk_num, _regs, _clk_id) \ 704 + TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ 705 + 30, MASK(2), 0, 0, 16, 1, TEGRA_DIVIDER_UART, _regs,\ 706 + _clk_num, periph_clk_enb_refcnt, 0, _clk_id, \ 707 + _parents##_idx, 0) 708 + 709 + #define TEGRA_INIT_DATA_I2C(_name, _con_id, _dev_id, _parents, _offset,\ 710 + _clk_num, _regs, _clk_id) \ 711 + TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ 712 + 30, MASK(2), 0, 0, 16, 0, 0, _regs, _clk_num, \ 713 + periph_clk_enb_refcnt, 0, _clk_id, _parents##_idx, 0) 714 + 715 + #define TEGRA_INIT_DATA_NODIV(_name, _con_id, _dev_id, _parents, _offset, \ 716 + _mux_shift, _mux_mask, _clk_num, _regs, \ 717 + _gate_flags, _clk_id) \ 718 + TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ 719 + _mux_shift, _mux_mask, 0, 0, 0, 0, 0, _regs, \ 720 + _clk_num, periph_clk_enb_refcnt, _gate_flags, \ 721 + _clk_id, _parents##_idx, 0) 722 + 723 + #define TEGRA_INIT_DATA_XUSB(_name, _con_id, _dev_id, _parents, _offset, \ 724 + _clk_num, _regs, _gate_flags, _clk_id) \ 725 + TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset, \ 726 + 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs, \ 727 + _clk_num, periph_clk_enb_refcnt, _gate_flags, \ 728 + _clk_id, _parents##_idx, 0) 729 + 730 + #define TEGRA_INIT_DATA_AUDIO(_name, _con_id, _dev_id, _offset, _clk_num,\ 731 + _regs, _gate_flags, _clk_id) \ 732 + TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, mux_d_audio_clk, \ 733 + _offset, 16, 0xE01F, 0, 0, 8, 1, 0, _regs, _clk_num, \ 734 + periph_clk_enb_refcnt, _gate_flags , _clk_id, \ 735 + mux_d_audio_clk_idx, 0) 736 + 737 + enum tegra114_clk { 738 + rtc = 4, timer = 5, uarta = 6, sdmmc2 = 9, i2s1 = 11, i2c1 = 12, 739 + ndflash = 13, sdmmc1 = 14, sdmmc4 = 15, pwm = 17, i2s2 = 18, epp = 19, 740 + gr_2d = 21, usbd = 22, isp = 23, gr_3d = 24, disp2 = 26, disp1 = 27, 741 + host1x = 28, vcp = 29, i2s0 = 30, apbdma = 34, kbc = 36, kfuse = 40, 742 + sbc1 = 41, nor = 42, sbc2 = 44, sbc3 = 46, i2c5 = 47, dsia = 48, 743 + mipi = 50, hdmi = 51, csi = 52, i2c2 = 54, uartc = 55, mipi_cal = 56, 744 + emc, usb2, usb3, vde = 61, bsea = 62, bsev = 63, uartd = 65, 745 + i2c3 = 67, sbc4 = 68, sdmmc3 = 69, owr = 71, csite = 73, 746 + la = 76, trace = 77, soc_therm = 78, dtv = 79, ndspeed = 80, 747 + i2cslow = 81, dsib = 82, tsec = 83, xusb_host = 89, msenc = 91, 748 + csus = 92, mselect = 99, tsensor = 100, i2s3 = 101, i2s4 = 102, 749 + i2c4 = 103, sbc5 = 104, sbc6 = 105, d_audio, apbif = 107, dam0, dam1, 750 + dam2, hda2codec_2x = 111, audio0_2x = 113, audio1_2x, audio2_2x, 751 + audio3_2x, audio4_2x, spdif_2x, actmon = 119, extern1 = 120, 752 + extern2 = 121, extern3 = 122, hda = 125, se = 127, hda2hdmi = 128, 753 + cilab = 144, cilcd = 145, cile = 146, dsialp = 147, dsiblp = 148, 754 + dds = 150, dp2 = 152, amx = 153, adx = 154, xusb_ss = 156, uartb = 192, 755 + vfir, spdif_in, spdif_out, vi, vi_sensor, fuse, fuse_burn, clk_32k, 756 + clk_m, clk_m_div2, clk_m_div4, pll_ref, pll_c, pll_c_out1, pll_c2, 757 + pll_c3, pll_m, pll_m_out1, pll_p, pll_p_out1, pll_p_out2, pll_p_out3, 758 + pll_p_out4, pll_a, pll_a_out0, pll_d, pll_d_out0, pll_d2, pll_d2_out0, 759 + pll_u, pll_u_480M, pll_u_60M, pll_u_48M, pll_u_12M, pll_x, pll_x_out0, 760 + pll_re_vco, pll_re_out, pll_e_out0, spdif_in_sync, i2s0_sync, 761 + i2s1_sync, i2s2_sync, i2s3_sync, i2s4_sync, vimclk_sync, audio0, 762 + audio1, audio2, audio3, audio4, spdif, clk_out_1, clk_out_2, clk_out_3, 763 + blink, xusb_host_src = 252, xusb_falcon_src, xusb_fs_src, xusb_ss_src, 764 + xusb_dev_src, xusb_dev, xusb_hs_src, sclk, hclk, pclk, cclk_g, cclk_lp, 765 + 766 + /* Mux clocks */ 767 + 768 + audio0_mux = 300, audio1_mux, audio2_mux, audio3_mux, audio4_mux, 769 + spdif_mux, clk_out_1_mux, clk_out_2_mux, clk_out_3_mux, dsia_mux, 770 + dsib_mux, clk_max, 771 + }; 772 + 773 + struct utmi_clk_param { 774 + /* Oscillator Frequency in KHz */ 775 + u32 osc_frequency; 776 + /* UTMIP PLL Enable Delay Count */ 777 + u8 enable_delay_count; 778 + /* UTMIP PLL Stable count */ 779 + u8 stable_count; 780 + /* UTMIP PLL Active delay count */ 781 + u8 active_delay_count; 782 + /* UTMIP PLL Xtal frequency count */ 783 + u8 xtal_freq_count; 784 + }; 785 + 786 + static const struct utmi_clk_param utmi_parameters[] = { 787 + {.osc_frequency = 13000000, .enable_delay_count = 0x02, 788 + .stable_count = 0x33, .active_delay_count = 0x05, 789 + .xtal_freq_count = 0x7F}, 790 + {.osc_frequency = 19200000, .enable_delay_count = 0x03, 791 + .stable_count = 0x4B, .active_delay_count = 0x06, 792 + .xtal_freq_count = 0xBB}, 793 + {.osc_frequency = 12000000, .enable_delay_count = 0x02, 794 + .stable_count = 0x2F, .active_delay_count = 0x04, 795 + .xtal_freq_count = 0x76}, 796 + {.osc_frequency = 26000000, .enable_delay_count = 0x04, 797 + .stable_count = 0x66, .active_delay_count = 0x09, 798 + .xtal_freq_count = 0xFE}, 799 + {.osc_frequency = 16800000, .enable_delay_count = 0x03, 800 + .stable_count = 0x41, .active_delay_count = 0x0A, 801 + .xtal_freq_count = 0xA4}, 802 + }; 803 + 804 + /* peripheral mux definitions */ 805 + 806 + #define MUX_I2S_SPDIF(_id) \ 807 + static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { "pll_a_out0", \ 808 + #_id, "pll_p",\ 809 + "clk_m"}; 810 + MUX_I2S_SPDIF(audio0) 811 + MUX_I2S_SPDIF(audio1) 812 + MUX_I2S_SPDIF(audio2) 813 + MUX_I2S_SPDIF(audio3) 814 + MUX_I2S_SPDIF(audio4) 815 + MUX_I2S_SPDIF(audio) 816 + 817 + #define mux_pllaout0_audio0_2x_pllp_clkm_idx NULL 818 + #define mux_pllaout0_audio1_2x_pllp_clkm_idx NULL 819 + #define mux_pllaout0_audio2_2x_pllp_clkm_idx NULL 820 + #define mux_pllaout0_audio3_2x_pllp_clkm_idx NULL 821 + #define mux_pllaout0_audio4_2x_pllp_clkm_idx NULL 822 + #define mux_pllaout0_audio_2x_pllp_clkm_idx NULL 823 + 824 + static const char *mux_pllp_pllc_pllm_clkm[] = { 825 + "pll_p", "pll_c", "pll_m", "clk_m" 826 + }; 827 + #define mux_pllp_pllc_pllm_clkm_idx NULL 828 + 829 + static const char *mux_pllp_pllc_pllm[] = { "pll_p", "pll_c", "pll_m" }; 830 + #define mux_pllp_pllc_pllm_idx NULL 831 + 832 + static const char *mux_pllp_pllc_clk32_clkm[] = { 833 + "pll_p", "pll_c", "clk_32k", "clk_m" 834 + }; 835 + #define mux_pllp_pllc_clk32_clkm_idx NULL 836 + 837 + static const char *mux_plla_pllc_pllp_clkm[] = { 838 + "pll_a_out0", "pll_c", "pll_p", "clk_m" 839 + }; 840 + #define mux_plla_pllc_pllp_clkm_idx mux_pllp_pllc_pllm_clkm_idx 841 + 842 + static const char *mux_pllp_pllc2_c_c3_pllm_clkm[] = { 843 + "pll_p", "pll_c2", "pll_c", "pll_c3", "pll_m", "clk_m" 844 + }; 845 + static u32 mux_pllp_pllc2_c_c3_pllm_clkm_idx[] = { 846 + [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, 847 + }; 848 + 849 + static const char *mux_pllp_clkm[] = { 850 + "pll_p", "clk_m" 851 + }; 852 + static u32 mux_pllp_clkm_idx[] = { 853 + [0] = 0, [1] = 3, 854 + }; 855 + 856 + static const char *mux_pllm_pllc2_c_c3_pllp_plla[] = { 857 + "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0" 858 + }; 859 + #define mux_pllm_pllc2_c_c3_pllp_plla_idx mux_pllp_pllc2_c_c3_pllm_clkm_idx 860 + 861 + static const char *mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = { 862 + "pll_p", "pll_m", "pll_d_out0", "pll_a_out0", "pll_c", 863 + "pll_d2_out0", "clk_m" 864 + }; 865 + #define mux_pllp_pllm_plld_plla_pllc_plld2_clkm_idx NULL 866 + 867 + static const char *mux_pllm_pllc_pllp_plla[] = { 868 + "pll_m", "pll_c", "pll_p", "pll_a_out0" 869 + }; 870 + #define mux_pllm_pllc_pllp_plla_idx mux_pllp_pllc_pllm_clkm_idx 871 + 872 + static const char *mux_pllp_pllc_clkm[] = { 873 + "pll_p", "pll_c", "pll_m" 874 + }; 875 + static u32 mux_pllp_pllc_clkm_idx[] = { 876 + [0] = 0, [1] = 1, [2] = 3, 877 + }; 878 + 879 + static const char *mux_pllp_pllc_clkm_clk32[] = { 880 + "pll_p", "pll_c", "clk_m", "clk_32k" 881 + }; 882 + #define mux_pllp_pllc_clkm_clk32_idx NULL 883 + 884 + static const char *mux_plla_clk32_pllp_clkm_plle[] = { 885 + "pll_a_out0", "clk_32k", "pll_p", "clk_m", "pll_e_out0" 886 + }; 887 + #define mux_plla_clk32_pllp_clkm_plle_idx NULL 888 + 889 + static const char *mux_clkm_pllp_pllc_pllre[] = { 890 + "clk_m", "pll_p", "pll_c", "pll_re_out" 891 + }; 892 + static u32 mux_clkm_pllp_pllc_pllre_idx[] = { 893 + [0] = 0, [1] = 1, [2] = 3, [3] = 5, 894 + }; 895 + 896 + static const char *mux_clkm_48M_pllp_480M[] = { 897 + "clk_m", "pll_u_48M", "pll_p", "pll_u_480M" 898 + }; 899 + #define mux_clkm_48M_pllp_480M_idx NULL 900 + 901 + static const char *mux_clkm_pllre_clk32_480M_pllc_ref[] = { 902 + "clk_m", "pll_re_out", "clk_32k", "pll_u_480M", "pll_c", "pll_ref" 903 + }; 904 + static u32 mux_clkm_pllre_clk32_480M_pllc_ref_idx[] = { 905 + [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 4, [5] = 7, 906 + }; 907 + 908 + static const char *mux_plld_out0_plld2_out0[] = { 909 + "pll_d_out0", "pll_d2_out0", 910 + }; 911 + #define mux_plld_out0_plld2_out0_idx NULL 912 + 913 + static const char *mux_d_audio_clk[] = { 914 + "pll_a_out0", "pll_p", "clk_m", "spdif_in_sync", "i2s0_sync", 915 + "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", 916 + }; 917 + static u32 mux_d_audio_clk_idx[] = { 918 + [0] = 0, [1] = 0x8000, [2] = 0xc000, [3] = 0xE000, [4] = 0xE001, 919 + [5] = 0xE002, [6] = 0xE003, [7] = 0xE004, [8] = 0xE005, [9] = 0xE007, 920 + }; 921 + 922 + static const char *mux_pllmcp_clkm[] = { 923 + "pll_m_out0", "pll_c_out0", "pll_p_out0", "clk_m", "pll_m_ud", 924 + }; 925 + 926 + static const struct clk_div_table pll_re_div_table[] = { 927 + { .val = 0, .div = 1 }, 928 + { .val = 1, .div = 2 }, 929 + { .val = 2, .div = 3 }, 930 + { .val = 3, .div = 4 }, 931 + { .val = 4, .div = 5 }, 932 + { .val = 5, .div = 6 }, 933 + { .val = 0, .div = 0 }, 934 + }; 935 + 936 + static struct clk *clks[clk_max]; 937 + static struct clk_onecell_data clk_data; 938 + 939 + static unsigned long osc_freq; 940 + static unsigned long pll_ref_freq; 941 + 942 + static int __init tegra114_osc_clk_init(void __iomem *clk_base) 943 + { 944 + struct clk *clk; 945 + u32 val, pll_ref_div; 946 + 947 + val = readl_relaxed(clk_base + OSC_CTRL); 948 + 949 + osc_freq = tegra114_input_freq[val >> OSC_CTRL_OSC_FREQ_SHIFT]; 950 + if (!osc_freq) { 951 + WARN_ON(1); 952 + return -EINVAL; 953 + } 954 + 955 + /* clk_m */ 956 + clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT, 957 + osc_freq); 958 + clk_register_clkdev(clk, "clk_m", NULL); 959 + clks[clk_m] = clk; 960 + 961 + /* pll_ref */ 962 + val = (val >> OSC_CTRL_PLL_REF_DIV_SHIFT) & 3; 963 + pll_ref_div = 1 << val; 964 + clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m", 965 + CLK_SET_RATE_PARENT, 1, pll_ref_div); 966 + clk_register_clkdev(clk, "pll_ref", NULL); 967 + clks[pll_ref] = clk; 968 + 969 + pll_ref_freq = osc_freq / pll_ref_div; 970 + 971 + return 0; 972 + } 973 + 974 + static void __init tegra114_fixed_clk_init(void __iomem *clk_base) 975 + { 976 + struct clk *clk; 977 + 978 + /* clk_32k */ 979 + clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT, 980 + 32768); 981 + clk_register_clkdev(clk, "clk_32k", NULL); 982 + clks[clk_32k] = clk; 983 + 984 + /* clk_m_div2 */ 985 + clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m", 986 + CLK_SET_RATE_PARENT, 1, 2); 987 + clk_register_clkdev(clk, "clk_m_div2", NULL); 988 + clks[clk_m_div2] = clk; 989 + 990 + /* clk_m_div4 */ 991 + clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m", 992 + CLK_SET_RATE_PARENT, 1, 4); 993 + clk_register_clkdev(clk, "clk_m_div4", NULL); 994 + clks[clk_m_div4] = clk; 995 + 996 + } 997 + 998 + static __init void tegra114_utmi_param_configure(void __iomem *clk_base) 999 + { 1000 + u32 reg; 1001 + int i; 1002 + 1003 + for (i = 0; i < ARRAY_SIZE(utmi_parameters); i++) { 1004 + if (osc_freq == utmi_parameters[i].osc_frequency) 1005 + break; 1006 + } 1007 + 1008 + if (i >= ARRAY_SIZE(utmi_parameters)) { 1009 + pr_err("%s: Unexpected oscillator freq %lu\n", __func__, 1010 + osc_freq); 1011 + return; 1012 + } 1013 + 1014 + reg = readl_relaxed(clk_base + UTMIP_PLL_CFG2); 1015 + 1016 + /* Program UTMIP PLL stable and active counts */ 1017 + /* [FIXME] arclk_rst.h says WRONG! This should be 1ms -> 0x50 Check! */ 1018 + reg &= ~UTMIP_PLL_CFG2_STABLE_COUNT(~0); 1019 + reg |= UTMIP_PLL_CFG2_STABLE_COUNT(utmi_parameters[i].stable_count); 1020 + 1021 + reg &= ~UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(~0); 1022 + 1023 + reg |= UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(utmi_parameters[i]. 1024 + active_delay_count); 1025 + 1026 + /* Remove power downs from UTMIP PLL control bits */ 1027 + reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN; 1028 + reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN; 1029 + reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN; 1030 + 1031 + writel_relaxed(reg, clk_base + UTMIP_PLL_CFG2); 1032 + 1033 + /* Program UTMIP PLL delay and oscillator frequency counts */ 1034 + reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1); 1035 + reg &= ~UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(~0); 1036 + 1037 + reg |= UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(utmi_parameters[i]. 1038 + enable_delay_count); 1039 + 1040 + reg &= ~UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(~0); 1041 + reg |= UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(utmi_parameters[i]. 1042 + xtal_freq_count); 1043 + 1044 + /* Remove power downs from UTMIP PLL control bits */ 1045 + reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN; 1046 + reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN; 1047 + reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP; 1048 + reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN; 1049 + writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1); 1050 + 1051 + /* Setup HW control of UTMIPLL */ 1052 + reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); 1053 + reg |= UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET; 1054 + reg &= ~UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL; 1055 + reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE; 1056 + writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); 1057 + 1058 + reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1); 1059 + reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP; 1060 + reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN; 1061 + writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1); 1062 + 1063 + udelay(1); 1064 + 1065 + /* Setup SW override of UTMIPLL assuming USB2.0 1066 + ports are assigned to USB2 */ 1067 + reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); 1068 + reg |= UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL; 1069 + reg &= ~UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE; 1070 + writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); 1071 + 1072 + udelay(1); 1073 + 1074 + /* Enable HW control UTMIPLL */ 1075 + reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); 1076 + reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE; 1077 + writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); 1078 + } 1079 + 1080 + static void __init _clip_vco_min(struct tegra_clk_pll_params *pll_params) 1081 + { 1082 + pll_params->vco_min = 1083 + DIV_ROUND_UP(pll_params->vco_min, pll_ref_freq) * pll_ref_freq; 1084 + } 1085 + 1086 + static int __init _setup_dynamic_ramp(struct tegra_clk_pll_params *pll_params, 1087 + void __iomem *clk_base) 1088 + { 1089 + u32 val; 1090 + u32 step_a, step_b; 1091 + 1092 + switch (pll_ref_freq) { 1093 + case 12000000: 1094 + case 13000000: 1095 + case 26000000: 1096 + step_a = 0x2B; 1097 + step_b = 0x0B; 1098 + break; 1099 + case 16800000: 1100 + step_a = 0x1A; 1101 + step_b = 0x09; 1102 + break; 1103 + case 19200000: 1104 + step_a = 0x12; 1105 + step_b = 0x08; 1106 + break; 1107 + default: 1108 + pr_err("%s: Unexpected reference rate %lu\n", 1109 + __func__, pll_ref_freq); 1110 + WARN_ON(1); 1111 + return -EINVAL; 1112 + } 1113 + 1114 + val = step_a << pll_params->stepa_shift; 1115 + val |= step_b << pll_params->stepb_shift; 1116 + writel_relaxed(val, clk_base + pll_params->dyn_ramp_reg); 1117 + 1118 + return 0; 1119 + } 1120 + 1121 + static void __init _init_iddq(struct tegra_clk_pll_params *pll_params, 1122 + void __iomem *clk_base) 1123 + { 1124 + u32 val, val_iddq; 1125 + 1126 + val = readl_relaxed(clk_base + pll_params->base_reg); 1127 + val_iddq = readl_relaxed(clk_base + pll_params->iddq_reg); 1128 + 1129 + if (val & BIT(30)) 1130 + WARN_ON(val_iddq & BIT(pll_params->iddq_bit_idx)); 1131 + else { 1132 + val_iddq |= BIT(pll_params->iddq_bit_idx); 1133 + writel_relaxed(val_iddq, clk_base + pll_params->iddq_reg); 1134 + } 1135 + } 1136 + 1137 + static void __init tegra114_pll_init(void __iomem *clk_base, 1138 + void __iomem *pmc) 1139 + { 1140 + u32 val; 1141 + struct clk *clk; 1142 + 1143 + /* PLLC */ 1144 + _clip_vco_min(&pll_c_params); 1145 + if (_setup_dynamic_ramp(&pll_c_params, clk_base) >= 0) { 1146 + _init_iddq(&pll_c_params, clk_base); 1147 + clk = tegra_clk_register_pllxc("pll_c", "pll_ref", clk_base, 1148 + pmc, 0, 0, &pll_c_params, TEGRA_PLL_USE_LOCK, 1149 + pll_c_freq_table, NULL); 1150 + clk_register_clkdev(clk, "pll_c", NULL); 1151 + clks[pll_c] = clk; 1152 + 1153 + /* PLLC_OUT1 */ 1154 + clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", 1155 + clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP, 1156 + 8, 8, 1, NULL); 1157 + clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div", 1158 + clk_base + PLLC_OUT, 1, 0, 1159 + CLK_SET_RATE_PARENT, 0, NULL); 1160 + clk_register_clkdev(clk, "pll_c_out1", NULL); 1161 + clks[pll_c_out1] = clk; 1162 + } 1163 + 1164 + /* PLLC2 */ 1165 + _clip_vco_min(&pll_c2_params); 1166 + clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0, 0, 1167 + &pll_c2_params, TEGRA_PLL_USE_LOCK, 1168 + pll_cx_freq_table, NULL); 1169 + clk_register_clkdev(clk, "pll_c2", NULL); 1170 + clks[pll_c2] = clk; 1171 + 1172 + /* PLLC3 */ 1173 + _clip_vco_min(&pll_c3_params); 1174 + clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0, 0, 1175 + &pll_c3_params, TEGRA_PLL_USE_LOCK, 1176 + pll_cx_freq_table, NULL); 1177 + clk_register_clkdev(clk, "pll_c3", NULL); 1178 + clks[pll_c3] = clk; 1179 + 1180 + /* PLLP */ 1181 + clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base, pmc, 0, 1182 + 408000000, &pll_p_params, 1183 + TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK, 1184 + pll_p_freq_table, NULL); 1185 + clk_register_clkdev(clk, "pll_p", NULL); 1186 + clks[pll_p] = clk; 1187 + 1188 + /* PLLP_OUT1 */ 1189 + clk = tegra_clk_register_divider("pll_p_out1_div", "pll_p", 1190 + clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | 1191 + TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock); 1192 + clk = tegra_clk_register_pll_out("pll_p_out1", "pll_p_out1_div", 1193 + clk_base + PLLP_OUTA, 1, 0, 1194 + CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, 1195 + &pll_div_lock); 1196 + clk_register_clkdev(clk, "pll_p_out1", NULL); 1197 + clks[pll_p_out1] = clk; 1198 + 1199 + /* PLLP_OUT2 */ 1200 + clk = tegra_clk_register_divider("pll_p_out2_div", "pll_p", 1201 + clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | 1202 + TEGRA_DIVIDER_ROUND_UP, 24, 8, 1, 1203 + &pll_div_lock); 1204 + clk = tegra_clk_register_pll_out("pll_p_out2", "pll_p_out2_div", 1205 + clk_base + PLLP_OUTA, 17, 16, 1206 + CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, 1207 + &pll_div_lock); 1208 + clk_register_clkdev(clk, "pll_p_out2", NULL); 1209 + clks[pll_p_out2] = clk; 1210 + 1211 + /* PLLP_OUT3 */ 1212 + clk = tegra_clk_register_divider("pll_p_out3_div", "pll_p", 1213 + clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | 1214 + TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock); 1215 + clk = tegra_clk_register_pll_out("pll_p_out3", "pll_p_out3_div", 1216 + clk_base + PLLP_OUTB, 1, 0, 1217 + CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, 1218 + &pll_div_lock); 1219 + clk_register_clkdev(clk, "pll_p_out3", NULL); 1220 + clks[pll_p_out3] = clk; 1221 + 1222 + /* PLLP_OUT4 */ 1223 + clk = tegra_clk_register_divider("pll_p_out4_div", "pll_p", 1224 + clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | 1225 + TEGRA_DIVIDER_ROUND_UP, 24, 8, 1, 1226 + &pll_div_lock); 1227 + clk = tegra_clk_register_pll_out("pll_p_out4", "pll_p_out4_div", 1228 + clk_base + PLLP_OUTB, 17, 16, 1229 + CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, 1230 + &pll_div_lock); 1231 + clk_register_clkdev(clk, "pll_p_out4", NULL); 1232 + clks[pll_p_out4] = clk; 1233 + 1234 + /* PLLM */ 1235 + _clip_vco_min(&pll_m_params); 1236 + clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc, 1237 + CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, 0, 1238 + &pll_m_params, TEGRA_PLL_USE_LOCK, 1239 + pll_m_freq_table, NULL); 1240 + clk_register_clkdev(clk, "pll_m", NULL); 1241 + clks[pll_m] = clk; 1242 + 1243 + /* PLLM_OUT1 */ 1244 + clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", 1245 + clk_base + PLLM_OUT, 0, TEGRA_DIVIDER_ROUND_UP, 1246 + 8, 8, 1, NULL); 1247 + clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div", 1248 + clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED | 1249 + CLK_SET_RATE_PARENT, 0, NULL); 1250 + clk_register_clkdev(clk, "pll_m_out1", NULL); 1251 + clks[pll_m_out1] = clk; 1252 + 1253 + /* PLLM_UD */ 1254 + clk = clk_register_fixed_factor(NULL, "pll_m_ud", "pll_m", 1255 + CLK_SET_RATE_PARENT, 1, 1); 1256 + 1257 + /* PLLX */ 1258 + _clip_vco_min(&pll_x_params); 1259 + if (_setup_dynamic_ramp(&pll_x_params, clk_base) >= 0) { 1260 + _init_iddq(&pll_x_params, clk_base); 1261 + clk = tegra_clk_register_pllxc("pll_x", "pll_ref", clk_base, 1262 + pmc, CLK_IGNORE_UNUSED, 0, &pll_x_params, 1263 + TEGRA_PLL_USE_LOCK, pll_x_freq_table, NULL); 1264 + clk_register_clkdev(clk, "pll_x", NULL); 1265 + clks[pll_x] = clk; 1266 + } 1267 + 1268 + /* PLLX_OUT0 */ 1269 + clk = clk_register_fixed_factor(NULL, "pll_x_out0", "pll_x", 1270 + CLK_SET_RATE_PARENT, 1, 2); 1271 + clk_register_clkdev(clk, "pll_x_out0", NULL); 1272 + clks[pll_x_out0] = clk; 1273 + 1274 + /* PLLU */ 1275 + val = readl(clk_base + pll_u_params.base_reg); 1276 + val &= ~BIT(24); /* disable PLLU_OVERRIDE */ 1277 + writel(val, clk_base + pll_u_params.base_reg); 1278 + 1279 + clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0, 1280 + 0, &pll_u_params, TEGRA_PLLU | 1281 + TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | 1282 + TEGRA_PLL_USE_LOCK, pll_u_freq_table, &pll_u_lock); 1283 + clk_register_clkdev(clk, "pll_u", NULL); 1284 + clks[pll_u] = clk; 1285 + 1286 + tegra114_utmi_param_configure(clk_base); 1287 + 1288 + /* PLLU_480M */ 1289 + clk = clk_register_gate(NULL, "pll_u_480M", "pll_u", 1290 + CLK_SET_RATE_PARENT, clk_base + PLLU_BASE, 1291 + 22, 0, &pll_u_lock); 1292 + clk_register_clkdev(clk, "pll_u_480M", NULL); 1293 + clks[pll_u_480M] = clk; 1294 + 1295 + /* PLLU_60M */ 1296 + clk = clk_register_fixed_factor(NULL, "pll_u_60M", "pll_u", 1297 + CLK_SET_RATE_PARENT, 1, 8); 1298 + clk_register_clkdev(clk, "pll_u_60M", NULL); 1299 + clks[pll_u_60M] = clk; 1300 + 1301 + /* PLLU_48M */ 1302 + clk = clk_register_fixed_factor(NULL, "pll_u_48M", "pll_u", 1303 + CLK_SET_RATE_PARENT, 1, 10); 1304 + clk_register_clkdev(clk, "pll_u_48M", NULL); 1305 + clks[pll_u_48M] = clk; 1306 + 1307 + /* PLLU_12M */ 1308 + clk = clk_register_fixed_factor(NULL, "pll_u_12M", "pll_u", 1309 + CLK_SET_RATE_PARENT, 1, 40); 1310 + clk_register_clkdev(clk, "pll_u_12M", NULL); 1311 + clks[pll_u_12M] = clk; 1312 + 1313 + /* PLLD */ 1314 + clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0, 1315 + 0, &pll_d_params, 1316 + TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | 1317 + TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d_lock); 1318 + clk_register_clkdev(clk, "pll_d", NULL); 1319 + clks[pll_d] = clk; 1320 + 1321 + /* PLLD_OUT0 */ 1322 + clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d", 1323 + CLK_SET_RATE_PARENT, 1, 2); 1324 + clk_register_clkdev(clk, "pll_d_out0", NULL); 1325 + clks[pll_d_out0] = clk; 1326 + 1327 + /* PLLD2 */ 1328 + clk = tegra_clk_register_pll("pll_d2", "pll_ref", clk_base, pmc, 0, 1329 + 0, &pll_d2_params, 1330 + TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | 1331 + TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d2_lock); 1332 + clk_register_clkdev(clk, "pll_d2", NULL); 1333 + clks[pll_d2] = clk; 1334 + 1335 + /* PLLD2_OUT0 */ 1336 + clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", 1337 + CLK_SET_RATE_PARENT, 1, 2); 1338 + clk_register_clkdev(clk, "pll_d2_out0", NULL); 1339 + clks[pll_d2_out0] = clk; 1340 + 1341 + /* PLLA */ 1342 + clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, pmc, 0, 1343 + 0, &pll_a_params, TEGRA_PLL_HAS_CPCON | 1344 + TEGRA_PLL_USE_LOCK, pll_a_freq_table, NULL); 1345 + clk_register_clkdev(clk, "pll_a", NULL); 1346 + clks[pll_a] = clk; 1347 + 1348 + /* PLLA_OUT0 */ 1349 + clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a", 1350 + clk_base + PLLA_OUT, 0, TEGRA_DIVIDER_ROUND_UP, 1351 + 8, 8, 1, NULL); 1352 + clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div", 1353 + clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED | 1354 + CLK_SET_RATE_PARENT, 0, NULL); 1355 + clk_register_clkdev(clk, "pll_a_out0", NULL); 1356 + clks[pll_a_out0] = clk; 1357 + 1358 + /* PLLRE */ 1359 + _clip_vco_min(&pll_re_vco_params); 1360 + clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc, 1361 + 0, 0, &pll_re_vco_params, TEGRA_PLL_USE_LOCK, 1362 + NULL, &pll_re_lock, pll_ref_freq); 1363 + clk_register_clkdev(clk, "pll_re_vco", NULL); 1364 + clks[pll_re_vco] = clk; 1365 + 1366 + clk = clk_register_divider_table(NULL, "pll_re_out", "pll_re_vco", 0, 1367 + clk_base + PLLRE_BASE, 16, 4, 0, 1368 + pll_re_div_table, &pll_re_lock); 1369 + clk_register_clkdev(clk, "pll_re_out", NULL); 1370 + clks[pll_re_out] = clk; 1371 + 1372 + /* PLLE */ 1373 + clk = tegra_clk_register_plle_tegra114("pll_e_out0", "pll_re_vco", 1374 + clk_base, 0, 100000000, &pll_e_params, 1375 + pll_e_freq_table, NULL); 1376 + clk_register_clkdev(clk, "pll_e_out0", NULL); 1377 + clks[pll_e_out0] = clk; 1378 + } 1379 + 1380 + static const char *mux_audio_sync_clk[] = { "spdif_in_sync", "i2s0_sync", 1381 + "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", 1382 + }; 1383 + 1384 + static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2", 1385 + "clk_m_div4", "extern1", 1386 + }; 1387 + 1388 + static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2", 1389 + "clk_m_div4", "extern2", 1390 + }; 1391 + 1392 + static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2", 1393 + "clk_m_div4", "extern3", 1394 + }; 1395 + 1396 + static void __init tegra114_audio_clk_init(void __iomem *clk_base) 1397 + { 1398 + struct clk *clk; 1399 + 1400 + /* spdif_in_sync */ 1401 + clk = tegra_clk_register_sync_source("spdif_in_sync", 24000000, 1402 + 24000000); 1403 + clk_register_clkdev(clk, "spdif_in_sync", NULL); 1404 + clks[spdif_in_sync] = clk; 1405 + 1406 + /* i2s0_sync */ 1407 + clk = tegra_clk_register_sync_source("i2s0_sync", 24000000, 24000000); 1408 + clk_register_clkdev(clk, "i2s0_sync", NULL); 1409 + clks[i2s0_sync] = clk; 1410 + 1411 + /* i2s1_sync */ 1412 + clk = tegra_clk_register_sync_source("i2s1_sync", 24000000, 24000000); 1413 + clk_register_clkdev(clk, "i2s1_sync", NULL); 1414 + clks[i2s1_sync] = clk; 1415 + 1416 + /* i2s2_sync */ 1417 + clk = tegra_clk_register_sync_source("i2s2_sync", 24000000, 24000000); 1418 + clk_register_clkdev(clk, "i2s2_sync", NULL); 1419 + clks[i2s2_sync] = clk; 1420 + 1421 + /* i2s3_sync */ 1422 + clk = tegra_clk_register_sync_source("i2s3_sync", 24000000, 24000000); 1423 + clk_register_clkdev(clk, "i2s3_sync", NULL); 1424 + clks[i2s3_sync] = clk; 1425 + 1426 + /* i2s4_sync */ 1427 + clk = tegra_clk_register_sync_source("i2s4_sync", 24000000, 24000000); 1428 + clk_register_clkdev(clk, "i2s4_sync", NULL); 1429 + clks[i2s4_sync] = clk; 1430 + 1431 + /* vimclk_sync */ 1432 + clk = tegra_clk_register_sync_source("vimclk_sync", 24000000, 24000000); 1433 + clk_register_clkdev(clk, "vimclk_sync", NULL); 1434 + clks[vimclk_sync] = clk; 1435 + 1436 + /* audio0 */ 1437 + clk = clk_register_mux(NULL, "audio0_mux", mux_audio_sync_clk, 1438 + ARRAY_SIZE(mux_audio_sync_clk), 0, 1439 + clk_base + AUDIO_SYNC_CLK_I2S0, 0, 3, 0, 1440 + NULL); 1441 + clks[audio0_mux] = clk; 1442 + clk = clk_register_gate(NULL, "audio0", "audio0_mux", 0, 1443 + clk_base + AUDIO_SYNC_CLK_I2S0, 4, 1444 + CLK_GATE_SET_TO_DISABLE, NULL); 1445 + clk_register_clkdev(clk, "audio0", NULL); 1446 + clks[audio0] = clk; 1447 + 1448 + /* audio1 */ 1449 + clk = clk_register_mux(NULL, "audio1_mux", mux_audio_sync_clk, 1450 + ARRAY_SIZE(mux_audio_sync_clk), 0, 1451 + clk_base + AUDIO_SYNC_CLK_I2S1, 0, 3, 0, 1452 + NULL); 1453 + clks[audio1_mux] = clk; 1454 + clk = clk_register_gate(NULL, "audio1", "audio1_mux", 0, 1455 + clk_base + AUDIO_SYNC_CLK_I2S1, 4, 1456 + CLK_GATE_SET_TO_DISABLE, NULL); 1457 + clk_register_clkdev(clk, "audio1", NULL); 1458 + clks[audio1] = clk; 1459 + 1460 + /* audio2 */ 1461 + clk = clk_register_mux(NULL, "audio2_mux", mux_audio_sync_clk, 1462 + ARRAY_SIZE(mux_audio_sync_clk), 0, 1463 + clk_base + AUDIO_SYNC_CLK_I2S2, 0, 3, 0, 1464 + NULL); 1465 + clks[audio2_mux] = clk; 1466 + clk = clk_register_gate(NULL, "audio2", "audio2_mux", 0, 1467 + clk_base + AUDIO_SYNC_CLK_I2S2, 4, 1468 + CLK_GATE_SET_TO_DISABLE, NULL); 1469 + clk_register_clkdev(clk, "audio2", NULL); 1470 + clks[audio2] = clk; 1471 + 1472 + /* audio3 */ 1473 + clk = clk_register_mux(NULL, "audio3_mux", mux_audio_sync_clk, 1474 + ARRAY_SIZE(mux_audio_sync_clk), 0, 1475 + clk_base + AUDIO_SYNC_CLK_I2S3, 0, 3, 0, 1476 + NULL); 1477 + clks[audio3_mux] = clk; 1478 + clk = clk_register_gate(NULL, "audio3", "audio3_mux", 0, 1479 + clk_base + AUDIO_SYNC_CLK_I2S3, 4, 1480 + CLK_GATE_SET_TO_DISABLE, NULL); 1481 + clk_register_clkdev(clk, "audio3", NULL); 1482 + clks[audio3] = clk; 1483 + 1484 + /* audio4 */ 1485 + clk = clk_register_mux(NULL, "audio4_mux", mux_audio_sync_clk, 1486 + ARRAY_SIZE(mux_audio_sync_clk), 0, 1487 + clk_base + AUDIO_SYNC_CLK_I2S4, 0, 3, 0, 1488 + NULL); 1489 + clks[audio4_mux] = clk; 1490 + clk = clk_register_gate(NULL, "audio4", "audio4_mux", 0, 1491 + clk_base + AUDIO_SYNC_CLK_I2S4, 4, 1492 + CLK_GATE_SET_TO_DISABLE, NULL); 1493 + clk_register_clkdev(clk, "audio4", NULL); 1494 + clks[audio4] = clk; 1495 + 1496 + /* spdif */ 1497 + clk = clk_register_mux(NULL, "spdif_mux", mux_audio_sync_clk, 1498 + ARRAY_SIZE(mux_audio_sync_clk), 0, 1499 + clk_base + AUDIO_SYNC_CLK_SPDIF, 0, 3, 0, 1500 + NULL); 1501 + clks[spdif_mux] = clk; 1502 + clk = clk_register_gate(NULL, "spdif", "spdif_mux", 0, 1503 + clk_base + AUDIO_SYNC_CLK_SPDIF, 4, 1504 + CLK_GATE_SET_TO_DISABLE, NULL); 1505 + clk_register_clkdev(clk, "spdif", NULL); 1506 + clks[spdif] = clk; 1507 + 1508 + /* audio0_2x */ 1509 + clk = clk_register_fixed_factor(NULL, "audio0_doubler", "audio0", 1510 + CLK_SET_RATE_PARENT, 2, 1); 1511 + clk = tegra_clk_register_divider("audio0_div", "audio0_doubler", 1512 + clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 24, 1, 1513 + 0, &clk_doubler_lock); 1514 + clk = tegra_clk_register_periph_gate("audio0_2x", "audio0_div", 1515 + TEGRA_PERIPH_NO_RESET, clk_base, 1516 + CLK_SET_RATE_PARENT, 113, &periph_v_regs, 1517 + periph_clk_enb_refcnt); 1518 + clk_register_clkdev(clk, "audio0_2x", NULL); 1519 + clks[audio0_2x] = clk; 1520 + 1521 + /* audio1_2x */ 1522 + clk = clk_register_fixed_factor(NULL, "audio1_doubler", "audio1", 1523 + CLK_SET_RATE_PARENT, 2, 1); 1524 + clk = tegra_clk_register_divider("audio1_div", "audio1_doubler", 1525 + clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 25, 1, 1526 + 0, &clk_doubler_lock); 1527 + clk = tegra_clk_register_periph_gate("audio1_2x", "audio1_div", 1528 + TEGRA_PERIPH_NO_RESET, clk_base, 1529 + CLK_SET_RATE_PARENT, 114, &periph_v_regs, 1530 + periph_clk_enb_refcnt); 1531 + clk_register_clkdev(clk, "audio1_2x", NULL); 1532 + clks[audio1_2x] = clk; 1533 + 1534 + /* audio2_2x */ 1535 + clk = clk_register_fixed_factor(NULL, "audio2_doubler", "audio2", 1536 + CLK_SET_RATE_PARENT, 2, 1); 1537 + clk = tegra_clk_register_divider("audio2_div", "audio2_doubler", 1538 + clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 26, 1, 1539 + 0, &clk_doubler_lock); 1540 + clk = tegra_clk_register_periph_gate("audio2_2x", "audio2_div", 1541 + TEGRA_PERIPH_NO_RESET, clk_base, 1542 + CLK_SET_RATE_PARENT, 115, &periph_v_regs, 1543 + periph_clk_enb_refcnt); 1544 + clk_register_clkdev(clk, "audio2_2x", NULL); 1545 + clks[audio2_2x] = clk; 1546 + 1547 + /* audio3_2x */ 1548 + clk = clk_register_fixed_factor(NULL, "audio3_doubler", "audio3", 1549 + CLK_SET_RATE_PARENT, 2, 1); 1550 + clk = tegra_clk_register_divider("audio3_div", "audio3_doubler", 1551 + clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 27, 1, 1552 + 0, &clk_doubler_lock); 1553 + clk = tegra_clk_register_periph_gate("audio3_2x", "audio3_div", 1554 + TEGRA_PERIPH_NO_RESET, clk_base, 1555 + CLK_SET_RATE_PARENT, 116, &periph_v_regs, 1556 + periph_clk_enb_refcnt); 1557 + clk_register_clkdev(clk, "audio3_2x", NULL); 1558 + clks[audio3_2x] = clk; 1559 + 1560 + /* audio4_2x */ 1561 + clk = clk_register_fixed_factor(NULL, "audio4_doubler", "audio4", 1562 + CLK_SET_RATE_PARENT, 2, 1); 1563 + clk = tegra_clk_register_divider("audio4_div", "audio4_doubler", 1564 + clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 28, 1, 1565 + 0, &clk_doubler_lock); 1566 + clk = tegra_clk_register_periph_gate("audio4_2x", "audio4_div", 1567 + TEGRA_PERIPH_NO_RESET, clk_base, 1568 + CLK_SET_RATE_PARENT, 117, &periph_v_regs, 1569 + periph_clk_enb_refcnt); 1570 + clk_register_clkdev(clk, "audio4_2x", NULL); 1571 + clks[audio4_2x] = clk; 1572 + 1573 + /* spdif_2x */ 1574 + clk = clk_register_fixed_factor(NULL, "spdif_doubler", "spdif", 1575 + CLK_SET_RATE_PARENT, 2, 1); 1576 + clk = tegra_clk_register_divider("spdif_div", "spdif_doubler", 1577 + clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 29, 1, 1578 + 0, &clk_doubler_lock); 1579 + clk = tegra_clk_register_periph_gate("spdif_2x", "spdif_div", 1580 + TEGRA_PERIPH_NO_RESET, clk_base, 1581 + CLK_SET_RATE_PARENT, 118, 1582 + &periph_v_regs, periph_clk_enb_refcnt); 1583 + clk_register_clkdev(clk, "spdif_2x", NULL); 1584 + clks[spdif_2x] = clk; 1585 + } 1586 + 1587 + static void __init tegra114_pmc_clk_init(void __iomem *pmc_base) 1588 + { 1589 + struct clk *clk; 1590 + 1591 + /* clk_out_1 */ 1592 + clk = clk_register_mux(NULL, "clk_out_1_mux", clk_out1_parents, 1593 + ARRAY_SIZE(clk_out1_parents), 0, 1594 + pmc_base + PMC_CLK_OUT_CNTRL, 6, 3, 0, 1595 + &clk_out_lock); 1596 + clks[clk_out_1_mux] = clk; 1597 + clk = clk_register_gate(NULL, "clk_out_1", "clk_out_1_mux", 0, 1598 + pmc_base + PMC_CLK_OUT_CNTRL, 2, 0, 1599 + &clk_out_lock); 1600 + clk_register_clkdev(clk, "extern1", "clk_out_1"); 1601 + clks[clk_out_1] = clk; 1602 + 1603 + /* clk_out_2 */ 1604 + clk = clk_register_mux(NULL, "clk_out_2_mux", clk_out2_parents, 1605 + ARRAY_SIZE(clk_out1_parents), 0, 1606 + pmc_base + PMC_CLK_OUT_CNTRL, 14, 3, 0, 1607 + &clk_out_lock); 1608 + clks[clk_out_2_mux] = clk; 1609 + clk = clk_register_gate(NULL, "clk_out_2", "clk_out_2_mux", 0, 1610 + pmc_base + PMC_CLK_OUT_CNTRL, 10, 0, 1611 + &clk_out_lock); 1612 + clk_register_clkdev(clk, "extern2", "clk_out_2"); 1613 + clks[clk_out_2] = clk; 1614 + 1615 + /* clk_out_3 */ 1616 + clk = clk_register_mux(NULL, "clk_out_3_mux", clk_out3_parents, 1617 + ARRAY_SIZE(clk_out1_parents), 0, 1618 + pmc_base + PMC_CLK_OUT_CNTRL, 22, 3, 0, 1619 + &clk_out_lock); 1620 + clks[clk_out_3_mux] = clk; 1621 + clk = clk_register_gate(NULL, "clk_out_3", "clk_out_3_mux", 0, 1622 + pmc_base + PMC_CLK_OUT_CNTRL, 18, 0, 1623 + &clk_out_lock); 1624 + clk_register_clkdev(clk, "extern3", "clk_out_3"); 1625 + clks[clk_out_3] = clk; 1626 + 1627 + /* blink */ 1628 + clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0, 1629 + pmc_base + PMC_DPD_PADS_ORIDE, 1630 + PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL); 1631 + clk = clk_register_gate(NULL, "blink", "blink_override", 0, 1632 + pmc_base + PMC_CTRL, 1633 + PMC_CTRL_BLINK_ENB, 0, NULL); 1634 + clk_register_clkdev(clk, "blink", NULL); 1635 + clks[blink] = clk; 1636 + 1637 + } 1638 + 1639 + static const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4", 1640 + "pll_p_out3", "pll_p_out2", "unused", 1641 + "clk_32k", "pll_m_out1" }; 1642 + 1643 + static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", 1644 + "pll_p", "pll_p_out4", "unused", 1645 + "unused", "pll_x" }; 1646 + 1647 + static const char *cclk_lp_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", 1648 + "pll_p", "pll_p_out4", "unused", 1649 + "unused", "pll_x", "pll_x_out0" }; 1650 + 1651 + static void __init tegra114_super_clk_init(void __iomem *clk_base) 1652 + { 1653 + struct clk *clk; 1654 + 1655 + /* CCLKG */ 1656 + clk = tegra_clk_register_super_mux("cclk_g", cclk_g_parents, 1657 + ARRAY_SIZE(cclk_g_parents), 1658 + CLK_SET_RATE_PARENT, 1659 + clk_base + CCLKG_BURST_POLICY, 1660 + 0, 4, 0, 0, NULL); 1661 + clk_register_clkdev(clk, "cclk_g", NULL); 1662 + clks[cclk_g] = clk; 1663 + 1664 + /* CCLKLP */ 1665 + clk = tegra_clk_register_super_mux("cclk_lp", cclk_lp_parents, 1666 + ARRAY_SIZE(cclk_lp_parents), 1667 + CLK_SET_RATE_PARENT, 1668 + clk_base + CCLKLP_BURST_POLICY, 1669 + 0, 4, 8, 9, NULL); 1670 + clk_register_clkdev(clk, "cclk_lp", NULL); 1671 + clks[cclk_lp] = clk; 1672 + 1673 + /* SCLK */ 1674 + clk = tegra_clk_register_super_mux("sclk", sclk_parents, 1675 + ARRAY_SIZE(sclk_parents), 1676 + CLK_SET_RATE_PARENT, 1677 + clk_base + SCLK_BURST_POLICY, 1678 + 0, 4, 0, 0, NULL); 1679 + clk_register_clkdev(clk, "sclk", NULL); 1680 + clks[sclk] = clk; 1681 + 1682 + /* HCLK */ 1683 + clk = clk_register_divider(NULL, "hclk_div", "sclk", 0, 1684 + clk_base + SYSTEM_CLK_RATE, 4, 2, 0, 1685 + &sysrate_lock); 1686 + clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT | 1687 + CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE, 1688 + 7, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); 1689 + clk_register_clkdev(clk, "hclk", NULL); 1690 + clks[hclk] = clk; 1691 + 1692 + /* PCLK */ 1693 + clk = clk_register_divider(NULL, "pclk_div", "hclk", 0, 1694 + clk_base + SYSTEM_CLK_RATE, 0, 2, 0, 1695 + &sysrate_lock); 1696 + clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT | 1697 + CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE, 1698 + 3, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); 1699 + clk_register_clkdev(clk, "pclk", NULL); 1700 + clks[pclk] = clk; 1701 + } 1702 + 1703 + static struct tegra_periph_init_data tegra_periph_clk_list[] = { 1704 + TEGRA_INIT_DATA_MUX("i2s0", NULL, "tegra30-i2s.0", mux_pllaout0_audio0_2x_pllp_clkm, CLK_SOURCE_I2S0, 30, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s0), 1705 + TEGRA_INIT_DATA_MUX("i2s1", NULL, "tegra30-i2s.1", mux_pllaout0_audio1_2x_pllp_clkm, CLK_SOURCE_I2S1, 11, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s1), 1706 + TEGRA_INIT_DATA_MUX("i2s2", NULL, "tegra30-i2s.2", mux_pllaout0_audio2_2x_pllp_clkm, CLK_SOURCE_I2S2, 18, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s2), 1707 + TEGRA_INIT_DATA_MUX("i2s3", NULL, "tegra30-i2s.3", mux_pllaout0_audio3_2x_pllp_clkm, CLK_SOURCE_I2S3, 101, &periph_v_regs, TEGRA_PERIPH_ON_APB, i2s3), 1708 + TEGRA_INIT_DATA_MUX("i2s4", NULL, "tegra30-i2s.4", mux_pllaout0_audio4_2x_pllp_clkm, CLK_SOURCE_I2S4, 102, &periph_v_regs, TEGRA_PERIPH_ON_APB, i2s4), 1709 + TEGRA_INIT_DATA_MUX("spdif_out", "spdif_out", "tegra30-spdif", mux_pllaout0_audio_2x_pllp_clkm, CLK_SOURCE_SPDIF_OUT, 10, &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_out), 1710 + TEGRA_INIT_DATA_MUX("spdif_in", "spdif_in", "tegra30-spdif", mux_pllp_pllc_pllm, CLK_SOURCE_SPDIF_IN, 10, &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_in), 1711 + TEGRA_INIT_DATA_MUX("pwm", NULL, "pwm", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_PWM, 17, &periph_l_regs, TEGRA_PERIPH_ON_APB, pwm), 1712 + TEGRA_INIT_DATA_MUX("adx", NULL, "adx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX, 154, &periph_w_regs, TEGRA_PERIPH_ON_APB, adx), 1713 + TEGRA_INIT_DATA_MUX("amx", NULL, "amx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX, 153, &periph_w_regs, TEGRA_PERIPH_ON_APB, amx), 1714 + TEGRA_INIT_DATA_MUX("hda", "hda", "tegra30-hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA, 125, &periph_v_regs, TEGRA_PERIPH_ON_APB, hda), 1715 + TEGRA_INIT_DATA_MUX("hda2codec_2x", "hda2codec", "tegra30-hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, &periph_v_regs, TEGRA_PERIPH_ON_APB, hda2codec_2x), 1716 + TEGRA_INIT_DATA_MUX("sbc1", NULL, "tegra11-spi.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC1, 41, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc1), 1717 + TEGRA_INIT_DATA_MUX("sbc2", NULL, "tegra11-spi.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC2, 44, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc2), 1718 + TEGRA_INIT_DATA_MUX("sbc3", NULL, "tegra11-spi.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC3, 46, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc3), 1719 + TEGRA_INIT_DATA_MUX("sbc4", NULL, "tegra11-spi.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC4, 68, &periph_u_regs, TEGRA_PERIPH_ON_APB, sbc4), 1720 + TEGRA_INIT_DATA_MUX("sbc5", NULL, "tegra11-spi.4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC5, 104, &periph_v_regs, TEGRA_PERIPH_ON_APB, sbc5), 1721 + TEGRA_INIT_DATA_MUX("sbc6", NULL, "tegra11-spi.5", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC6, 105, &periph_v_regs, TEGRA_PERIPH_ON_APB, sbc6), 1722 + TEGRA_INIT_DATA_MUX8("ndflash", NULL, "tegra_nand", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDFLASH, 13, &periph_u_regs, TEGRA_PERIPH_ON_APB, ndspeed), 1723 + TEGRA_INIT_DATA_MUX8("ndspeed", NULL, "tegra_nand_speed", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDSPEED, 80, &periph_u_regs, TEGRA_PERIPH_ON_APB, ndspeed), 1724 + TEGRA_INIT_DATA_MUX("vfir", NULL, "vfir", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VFIR, 7, &periph_l_regs, TEGRA_PERIPH_ON_APB, vfir), 1725 + TEGRA_INIT_DATA_MUX("sdmmc1", NULL, "sdhci-tegra.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, &periph_l_regs, 0, sdmmc1), 1726 + TEGRA_INIT_DATA_MUX("sdmmc2", NULL, "sdhci-tegra.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, &periph_l_regs, 0, sdmmc2), 1727 + TEGRA_INIT_DATA_MUX("sdmmc3", NULL, "sdhci-tegra.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, &periph_u_regs, 0, sdmmc3), 1728 + TEGRA_INIT_DATA_MUX("sdmmc4", NULL, "sdhci-tegra.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, &periph_l_regs, 0, sdmmc4), 1729 + TEGRA_INIT_DATA_INT("vde", NULL, "vde", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_VDE, 61, &periph_h_regs, 0, vde), 1730 + TEGRA_INIT_DATA_MUX_FLAGS("csite", NULL, "csite", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_CSITE, 73, &periph_u_regs, TEGRA_PERIPH_ON_APB, csite, CLK_IGNORE_UNUSED), 1731 + TEGRA_INIT_DATA_MUX("la", NULL, "la", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_LA, 76, &periph_u_regs, TEGRA_PERIPH_ON_APB, la), 1732 + TEGRA_INIT_DATA_MUX("trace", NULL, "trace", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_TRACE, 77, &periph_u_regs, TEGRA_PERIPH_ON_APB, trace), 1733 + TEGRA_INIT_DATA_MUX("owr", NULL, "tegra_w1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_OWR, 71, &periph_u_regs, TEGRA_PERIPH_ON_APB, owr), 1734 + TEGRA_INIT_DATA_MUX("nor", NULL, "tegra-nor", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NOR, 42, &periph_h_regs, 0, nor), 1735 + TEGRA_INIT_DATA_MUX("mipi", NULL, "mipi", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_MIPI, 50, &periph_h_regs, TEGRA_PERIPH_ON_APB, mipi), 1736 + TEGRA_INIT_DATA_I2C("i2c1", "div-clk", "tegra11-i2c.0", mux_pllp_clkm, CLK_SOURCE_I2C1, 12, &periph_l_regs, i2c1), 1737 + TEGRA_INIT_DATA_I2C("i2c2", "div-clk", "tegra11-i2c.1", mux_pllp_clkm, CLK_SOURCE_I2C2, 54, &periph_h_regs, i2c2), 1738 + TEGRA_INIT_DATA_I2C("i2c3", "div-clk", "tegra11-i2c.2", mux_pllp_clkm, CLK_SOURCE_I2C3, 67, &periph_u_regs, i2c3), 1739 + TEGRA_INIT_DATA_I2C("i2c4", "div-clk", "tegra11-i2c.3", mux_pllp_clkm, CLK_SOURCE_I2C4, 103, &periph_v_regs, i2c4), 1740 + TEGRA_INIT_DATA_I2C("i2c5", "div-clk", "tegra11-i2c.4", mux_pllp_clkm, CLK_SOURCE_I2C5, 47, &periph_h_regs, i2c5), 1741 + TEGRA_INIT_DATA_UART("uarta", NULL, "tegra_uart.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTA, 6, &periph_l_regs, uarta), 1742 + TEGRA_INIT_DATA_UART("uartb", NULL, "tegra_uart.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, &periph_l_regs, uartb), 1743 + TEGRA_INIT_DATA_UART("uartc", NULL, "tegra_uart.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, &periph_h_regs, uartc), 1744 + TEGRA_INIT_DATA_UART("uartd", NULL, "tegra_uart.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, &periph_u_regs, uartd), 1745 + TEGRA_INIT_DATA_INT("3d", NULL, "3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, &periph_l_regs, 0, gr_3d), 1746 + TEGRA_INIT_DATA_INT("2d", NULL, "2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, &periph_l_regs, 0, gr_2d), 1747 + TEGRA_INIT_DATA_MUX("vi_sensor", "vi_sensor", "tegra_camera", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, &periph_l_regs, TEGRA_PERIPH_NO_RESET, vi_sensor), 1748 + TEGRA_INIT_DATA_INT8("vi", "vi", "tegra_camera", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI, 20, &periph_l_regs, 0, vi), 1749 + TEGRA_INIT_DATA_INT8("epp", NULL, "epp", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_EPP, 19, &periph_l_regs, 0, epp), 1750 + TEGRA_INIT_DATA_INT8("msenc", NULL, "msenc", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_MSENC, 91, &periph_h_regs, TEGRA_PERIPH_WAR_1005168, msenc), 1751 + TEGRA_INIT_DATA_INT8("tsec", NULL, "tsec", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_TSEC, 83, &periph_u_regs, 0, tsec), 1752 + TEGRA_INIT_DATA_INT8("host1x", NULL, "host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, &periph_l_regs, 0, host1x), 1753 + TEGRA_INIT_DATA_MUX8("hdmi", NULL, "hdmi", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_HDMI, 51, &periph_h_regs, 0, hdmi), 1754 + TEGRA_INIT_DATA_MUX("cilab", "cilab", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILAB, 144, &periph_w_regs, 0, cilab), 1755 + TEGRA_INIT_DATA_MUX("cilcd", "cilcd", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILCD, 145, &periph_w_regs, 0, cilcd), 1756 + TEGRA_INIT_DATA_MUX("cile", "cile", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILE, 146, &periph_w_regs, 0, cile), 1757 + TEGRA_INIT_DATA_MUX("dsialp", "dsialp", "tegradc.0", mux_pllp_pllc_clkm, CLK_SOURCE_DSIALP, 147, &periph_w_regs, 0, dsialp), 1758 + TEGRA_INIT_DATA_MUX("dsiblp", "dsiblp", "tegradc.1", mux_pllp_pllc_clkm, CLK_SOURCE_DSIBLP, 148, &periph_w_regs, 0, dsiblp), 1759 + TEGRA_INIT_DATA_MUX("tsensor", NULL, "tegra-tsensor", mux_pllp_pllc_clkm_clk32, CLK_SOURCE_TSENSOR, 100, &periph_v_regs, TEGRA_PERIPH_ON_APB, tsensor), 1760 + TEGRA_INIT_DATA_MUX("actmon", NULL, "actmon", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_ACTMON, 119, &periph_v_regs, 0, actmon), 1761 + TEGRA_INIT_DATA_MUX8("extern1", NULL, "extern1", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN1, 120, &periph_v_regs, 0, extern1), 1762 + TEGRA_INIT_DATA_MUX8("extern2", NULL, "extern2", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, &periph_v_regs, 0, extern2), 1763 + TEGRA_INIT_DATA_MUX8("extern3", NULL, "extern3", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, &periph_v_regs, 0, extern3), 1764 + TEGRA_INIT_DATA_MUX("i2cslow", NULL, "i2cslow", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_I2CSLOW, 81, &periph_u_regs, TEGRA_PERIPH_ON_APB, i2cslow), 1765 + TEGRA_INIT_DATA_INT8("se", NULL, "se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, &periph_v_regs, TEGRA_PERIPH_ON_APB, se), 1766 + TEGRA_INIT_DATA_INT_FLAGS("mselect", NULL, "mselect", mux_pllp_clkm, CLK_SOURCE_MSELECT, 99, &periph_v_regs, 0, mselect, CLK_IGNORE_UNUSED), 1767 + TEGRA_INIT_DATA_MUX8("soc_therm", NULL, "soc_therm", mux_pllm_pllc_pllp_plla, CLK_SOURCE_SOC_THERM, 78, &periph_u_regs, TEGRA_PERIPH_ON_APB, soc_therm), 1768 + TEGRA_INIT_DATA_XUSB("xusb_host_src", "host_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, &periph_w_regs, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, xusb_host_src), 1769 + TEGRA_INIT_DATA_XUSB("xusb_falcon_src", "falcon_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, &periph_w_regs, TEGRA_PERIPH_NO_RESET, xusb_falcon_src), 1770 + TEGRA_INIT_DATA_XUSB("xusb_fs_src", "fs_src", "tegra_xhci", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, &periph_w_regs, TEGRA_PERIPH_NO_RESET, xusb_fs_src), 1771 + TEGRA_INIT_DATA_XUSB("xusb_ss_src", "ss_src", "tegra_xhci", mux_clkm_pllre_clk32_480M_pllc_ref, CLK_SOURCE_XUSB_SS_SRC, 143, &periph_w_regs, TEGRA_PERIPH_NO_RESET, xusb_ss_src), 1772 + TEGRA_INIT_DATA_XUSB("xusb_dev_src", "dev_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_DEV_SRC, 95, &periph_u_regs, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, xusb_dev_src), 1773 + TEGRA_INIT_DATA_AUDIO("d_audio", "d_audio", "tegra30-ahub", CLK_SOURCE_D_AUDIO, 106, &periph_v_regs, TEGRA_PERIPH_ON_APB, d_audio), 1774 + TEGRA_INIT_DATA_AUDIO("dam0", NULL, "tegra30-dam.0", CLK_SOURCE_DAM0, 108, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam0), 1775 + TEGRA_INIT_DATA_AUDIO("dam1", NULL, "tegra30-dam.1", CLK_SOURCE_DAM1, 109, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam1), 1776 + TEGRA_INIT_DATA_AUDIO("dam2", NULL, "tegra30-dam.2", CLK_SOURCE_DAM2, 110, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam2), 1777 + }; 1778 + 1779 + static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = { 1780 + TEGRA_INIT_DATA_NODIV("disp1", NULL, "tegradc.0", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP1, 29, 7, 27, &periph_l_regs, 0, disp1), 1781 + TEGRA_INIT_DATA_NODIV("disp2", NULL, "tegradc.1", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP2, 29, 7, 26, &periph_l_regs, 0, disp2), 1782 + }; 1783 + 1784 + static __init void tegra114_periph_clk_init(void __iomem *clk_base) 1785 + { 1786 + struct tegra_periph_init_data *data; 1787 + struct clk *clk; 1788 + int i; 1789 + u32 val; 1790 + 1791 + /* apbdma */ 1792 + clk = tegra_clk_register_periph_gate("apbdma", "clk_m", 0, clk_base, 1793 + 0, 34, &periph_h_regs, 1794 + periph_clk_enb_refcnt); 1795 + clks[apbdma] = clk; 1796 + 1797 + /* rtc */ 1798 + clk = tegra_clk_register_periph_gate("rtc", "clk_32k", 1799 + TEGRA_PERIPH_ON_APB | 1800 + TEGRA_PERIPH_NO_RESET, clk_base, 1801 + 0, 4, &periph_l_regs, 1802 + periph_clk_enb_refcnt); 1803 + clk_register_clkdev(clk, NULL, "rtc-tegra"); 1804 + clks[rtc] = clk; 1805 + 1806 + /* kbc */ 1807 + clk = tegra_clk_register_periph_gate("kbc", "clk_32k", 1808 + TEGRA_PERIPH_ON_APB | 1809 + TEGRA_PERIPH_NO_RESET, clk_base, 1810 + 0, 36, &periph_h_regs, 1811 + periph_clk_enb_refcnt); 1812 + clks[kbc] = clk; 1813 + 1814 + /* timer */ 1815 + clk = tegra_clk_register_periph_gate("timer", "clk_m", 0, clk_base, 1816 + 0, 5, &periph_l_regs, 1817 + periph_clk_enb_refcnt); 1818 + clk_register_clkdev(clk, NULL, "timer"); 1819 + clks[timer] = clk; 1820 + 1821 + /* kfuse */ 1822 + clk = tegra_clk_register_periph_gate("kfuse", "clk_m", 1823 + TEGRA_PERIPH_ON_APB, clk_base, 0, 40, 1824 + &periph_h_regs, periph_clk_enb_refcnt); 1825 + clks[kfuse] = clk; 1826 + 1827 + /* fuse */ 1828 + clk = tegra_clk_register_periph_gate("fuse", "clk_m", 1829 + TEGRA_PERIPH_ON_APB, clk_base, 0, 39, 1830 + &periph_h_regs, periph_clk_enb_refcnt); 1831 + clks[fuse] = clk; 1832 + 1833 + /* fuse_burn */ 1834 + clk = tegra_clk_register_periph_gate("fuse_burn", "clk_m", 1835 + TEGRA_PERIPH_ON_APB, clk_base, 0, 39, 1836 + &periph_h_regs, periph_clk_enb_refcnt); 1837 + clks[fuse_burn] = clk; 1838 + 1839 + /* apbif */ 1840 + clk = tegra_clk_register_periph_gate("apbif", "clk_m", 1841 + TEGRA_PERIPH_ON_APB, clk_base, 0, 107, 1842 + &periph_v_regs, periph_clk_enb_refcnt); 1843 + clks[apbif] = clk; 1844 + 1845 + /* hda2hdmi */ 1846 + clk = tegra_clk_register_periph_gate("hda2hdmi", "clk_m", 1847 + TEGRA_PERIPH_ON_APB, clk_base, 0, 128, 1848 + &periph_w_regs, periph_clk_enb_refcnt); 1849 + clks[hda2hdmi] = clk; 1850 + 1851 + /* vcp */ 1852 + clk = tegra_clk_register_periph_gate("vcp", "clk_m", 0, clk_base, 0, 1853 + 29, &periph_l_regs, 1854 + periph_clk_enb_refcnt); 1855 + clks[vcp] = clk; 1856 + 1857 + /* bsea */ 1858 + clk = tegra_clk_register_periph_gate("bsea", "clk_m", 0, clk_base, 1859 + 0, 62, &periph_h_regs, 1860 + periph_clk_enb_refcnt); 1861 + clks[bsea] = clk; 1862 + 1863 + /* bsev */ 1864 + clk = tegra_clk_register_periph_gate("bsev", "clk_m", 0, clk_base, 1865 + 0, 63, &periph_h_regs, 1866 + periph_clk_enb_refcnt); 1867 + clks[bsev] = clk; 1868 + 1869 + /* mipi-cal */ 1870 + clk = tegra_clk_register_periph_gate("mipi-cal", "clk_m", 0, clk_base, 1871 + 0, 56, &periph_h_regs, 1872 + periph_clk_enb_refcnt); 1873 + clks[mipi_cal] = clk; 1874 + 1875 + /* usbd */ 1876 + clk = tegra_clk_register_periph_gate("usbd", "clk_m", 0, clk_base, 1877 + 0, 22, &periph_l_regs, 1878 + periph_clk_enb_refcnt); 1879 + clks[usbd] = clk; 1880 + 1881 + /* usb2 */ 1882 + clk = tegra_clk_register_periph_gate("usb2", "clk_m", 0, clk_base, 1883 + 0, 58, &periph_h_regs, 1884 + periph_clk_enb_refcnt); 1885 + clks[usb2] = clk; 1886 + 1887 + /* usb3 */ 1888 + clk = tegra_clk_register_periph_gate("usb3", "clk_m", 0, clk_base, 1889 + 0, 59, &periph_h_regs, 1890 + periph_clk_enb_refcnt); 1891 + clks[usb3] = clk; 1892 + 1893 + /* csi */ 1894 + clk = tegra_clk_register_periph_gate("csi", "pll_p_out3", 0, clk_base, 1895 + 0, 52, &periph_h_regs, 1896 + periph_clk_enb_refcnt); 1897 + clks[csi] = clk; 1898 + 1899 + /* isp */ 1900 + clk = tegra_clk_register_periph_gate("isp", "clk_m", 0, clk_base, 0, 1901 + 23, &periph_l_regs, 1902 + periph_clk_enb_refcnt); 1903 + clks[isp] = clk; 1904 + 1905 + /* csus */ 1906 + clk = tegra_clk_register_periph_gate("csus", "clk_m", 1907 + TEGRA_PERIPH_NO_RESET, clk_base, 0, 92, 1908 + &periph_u_regs, periph_clk_enb_refcnt); 1909 + clks[csus] = clk; 1910 + 1911 + /* dds */ 1912 + clk = tegra_clk_register_periph_gate("dds", "clk_m", 1913 + TEGRA_PERIPH_ON_APB, clk_base, 0, 150, 1914 + &periph_w_regs, periph_clk_enb_refcnt); 1915 + clks[dds] = clk; 1916 + 1917 + /* dp2 */ 1918 + clk = tegra_clk_register_periph_gate("dp2", "clk_m", 1919 + TEGRA_PERIPH_ON_APB, clk_base, 0, 152, 1920 + &periph_w_regs, periph_clk_enb_refcnt); 1921 + clks[dp2] = clk; 1922 + 1923 + /* dtv */ 1924 + clk = tegra_clk_register_periph_gate("dtv", "clk_m", 1925 + TEGRA_PERIPH_ON_APB, clk_base, 0, 79, 1926 + &periph_u_regs, periph_clk_enb_refcnt); 1927 + clks[dtv] = clk; 1928 + 1929 + /* dsia */ 1930 + clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0, 1931 + ARRAY_SIZE(mux_plld_out0_plld2_out0), 0, 1932 + clk_base + PLLD_BASE, 25, 1, 0, &pll_d_lock); 1933 + clks[dsia_mux] = clk; 1934 + clk = tegra_clk_register_periph_gate("dsia", "dsia_mux", 0, clk_base, 1935 + 0, 48, &periph_h_regs, 1936 + periph_clk_enb_refcnt); 1937 + clks[dsia] = clk; 1938 + 1939 + /* dsib */ 1940 + clk = clk_register_mux(NULL, "dsib_mux", mux_plld_out0_plld2_out0, 1941 + ARRAY_SIZE(mux_plld_out0_plld2_out0), 0, 1942 + clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock); 1943 + clks[dsib_mux] = clk; 1944 + clk = tegra_clk_register_periph_gate("dsib", "dsib_mux", 0, clk_base, 1945 + 0, 82, &periph_u_regs, 1946 + periph_clk_enb_refcnt); 1947 + clks[dsib] = clk; 1948 + 1949 + /* xusb_hs_src */ 1950 + val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC); 1951 + val |= BIT(25); /* always select PLLU_60M */ 1952 + writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC); 1953 + 1954 + clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0, 1955 + 1, 1); 1956 + clks[xusb_hs_src] = clk; 1957 + 1958 + /* xusb_host */ 1959 + clk = tegra_clk_register_periph_gate("xusb_host", "xusb_host_src", 0, 1960 + clk_base, 0, 89, &periph_u_regs, 1961 + periph_clk_enb_refcnt); 1962 + clks[xusb_host] = clk; 1963 + 1964 + /* xusb_ss */ 1965 + clk = tegra_clk_register_periph_gate("xusb_ss", "xusb_ss_src", 0, 1966 + clk_base, 0, 156, &periph_w_regs, 1967 + periph_clk_enb_refcnt); 1968 + clks[xusb_host] = clk; 1969 + 1970 + /* xusb_dev */ 1971 + clk = tegra_clk_register_periph_gate("xusb_dev", "xusb_dev_src", 0, 1972 + clk_base, 0, 95, &periph_u_regs, 1973 + periph_clk_enb_refcnt); 1974 + clks[xusb_dev] = clk; 1975 + 1976 + /* emc */ 1977 + clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, 1978 + ARRAY_SIZE(mux_pllmcp_clkm), 0, 1979 + clk_base + CLK_SOURCE_EMC, 1980 + 29, 3, 0, NULL); 1981 + clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base, 1982 + CLK_IGNORE_UNUSED, 57, &periph_h_regs, 1983 + periph_clk_enb_refcnt); 1984 + clks[emc] = clk; 1985 + 1986 + for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) { 1987 + data = &tegra_periph_clk_list[i]; 1988 + clk = tegra_clk_register_periph(data->name, data->parent_names, 1989 + data->num_parents, &data->periph, 1990 + clk_base, data->offset, data->flags); 1991 + clks[data->clk_id] = clk; 1992 + } 1993 + 1994 + for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) { 1995 + data = &tegra_periph_nodiv_clk_list[i]; 1996 + clk = tegra_clk_register_periph_nodiv(data->name, 1997 + data->parent_names, data->num_parents, 1998 + &data->periph, clk_base, data->offset); 1999 + clks[data->clk_id] = clk; 2000 + } 2001 + } 2002 + 2003 + static struct tegra_cpu_car_ops tegra114_cpu_car_ops; 2004 + 2005 + static const struct of_device_id pmc_match[] __initconst = { 2006 + { .compatible = "nvidia,tegra114-pmc" }, 2007 + {}, 2008 + }; 2009 + 2010 + static __initdata struct tegra_clk_init_table init_table[] = { 2011 + {uarta, pll_p, 408000000, 0}, 2012 + {uartb, pll_p, 408000000, 0}, 2013 + {uartc, pll_p, 408000000, 0}, 2014 + {uartd, pll_p, 408000000, 0}, 2015 + {pll_a, clk_max, 564480000, 1}, 2016 + {pll_a_out0, clk_max, 11289600, 1}, 2017 + {extern1, pll_a_out0, 0, 1}, 2018 + {clk_out_1_mux, extern1, 0, 1}, 2019 + {clk_out_1, clk_max, 0, 1}, 2020 + {i2s0, pll_a_out0, 11289600, 0}, 2021 + {i2s1, pll_a_out0, 11289600, 0}, 2022 + {i2s2, pll_a_out0, 11289600, 0}, 2023 + {i2s3, pll_a_out0, 11289600, 0}, 2024 + {i2s4, pll_a_out0, 11289600, 0}, 2025 + {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */ 2026 + }; 2027 + 2028 + static void __init tegra114_clock_apply_init_table(void) 2029 + { 2030 + tegra_init_from_table(init_table, clks, clk_max); 2031 + } 2032 + 2033 + void __init tegra114_clock_init(struct device_node *np) 2034 + { 2035 + struct device_node *node; 2036 + int i; 2037 + 2038 + clk_base = of_iomap(np, 0); 2039 + if (!clk_base) { 2040 + pr_err("ioremap tegra114 CAR failed\n"); 2041 + return; 2042 + } 2043 + 2044 + node = of_find_matching_node(NULL, pmc_match); 2045 + if (!node) { 2046 + pr_err("Failed to find pmc node\n"); 2047 + WARN_ON(1); 2048 + return; 2049 + } 2050 + 2051 + pmc_base = of_iomap(node, 0); 2052 + if (!pmc_base) { 2053 + pr_err("Can't map pmc registers\n"); 2054 + WARN_ON(1); 2055 + return; 2056 + } 2057 + 2058 + if (tegra114_osc_clk_init(clk_base) < 0) 2059 + return; 2060 + 2061 + tegra114_fixed_clk_init(clk_base); 2062 + tegra114_pll_init(clk_base, pmc_base); 2063 + tegra114_periph_clk_init(clk_base); 2064 + tegra114_audio_clk_init(clk_base); 2065 + tegra114_pmc_clk_init(pmc_base); 2066 + tegra114_super_clk_init(clk_base); 2067 + 2068 + for (i = 0; i < ARRAY_SIZE(clks); i++) { 2069 + if (IS_ERR(clks[i])) { 2070 + pr_err 2071 + ("Tegra114 clk %d: register failed with %ld\n", 2072 + i, PTR_ERR(clks[i])); 2073 + } 2074 + if (!clks[i]) 2075 + clks[i] = ERR_PTR(-EINVAL); 2076 + } 2077 + 2078 + clk_data.clks = clks; 2079 + clk_data.clk_num = ARRAY_SIZE(clks); 2080 + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 2081 + 2082 + tegra_clk_apply_init_table = tegra114_clock_apply_init_table; 2083 + 2084 + tegra_cpu_car_ops = &tegra114_cpu_car_ops; 2085 + }
+99 -85
drivers/clk/tegra/clk-tegra20.c
··· 86 86 #define PLLE_BASE 0xe8 87 87 #define PLLE_MISC 0xec 88 88 89 - #define PLL_BASE_LOCK 27 90 - #define PLLE_MISC_LOCK 11 89 + #define PLL_BASE_LOCK BIT(27) 90 + #define PLLE_MISC_LOCK BIT(11) 91 91 92 92 #define PLL_MISC_LOCK_ENABLE 18 93 93 #define PLLDU_MISC_LOCK_ENABLE 22 ··· 236 236 dvc, dsi, mipi = 50, hdmi, csi, tvdac, i2c2, uartc, emc = 57, usb2, 237 237 usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3, 238 238 pex, owr, afi, csite, pcie_xclk, avpucq = 75, la, irama = 84, iramb, 239 - iramc, iramd, cram2, audio_2x, clk_d, csus = 92, cdev1, cdev2, 239 + iramc, iramd, cram2, audio_2x, clk_d, csus = 92, cdev2, cdev1, 240 240 uartb = 96, vfir, spdif_in, spdif_out, vi, vi_sensor, tvo, cve, 241 241 osc, clk_32k, clk_m, sclk, cclk, hclk, pclk, blink, pll_a, pll_a_out0, 242 242 pll_c, pll_c_out1, pll_d, pll_d_out0, pll_e, pll_m, pll_m_out1, ··· 248 248 static struct clk_onecell_data clk_data; 249 249 250 250 static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { 251 - { 12000000, 600000000, 600, 12, 1, 8 }, 252 - { 13000000, 600000000, 600, 13, 1, 8 }, 253 - { 19200000, 600000000, 500, 16, 1, 6 }, 254 - { 26000000, 600000000, 600, 26, 1, 8 }, 251 + { 12000000, 600000000, 600, 12, 0, 8 }, 252 + { 13000000, 600000000, 600, 13, 0, 8 }, 253 + { 19200000, 600000000, 500, 16, 0, 6 }, 254 + { 26000000, 600000000, 600, 26, 0, 8 }, 255 255 { 0, 0, 0, 0, 0, 0 }, 256 256 }; 257 257 258 258 static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { 259 - { 12000000, 666000000, 666, 12, 1, 8}, 260 - { 13000000, 666000000, 666, 13, 1, 8}, 261 - { 19200000, 666000000, 555, 16, 1, 8}, 262 - { 26000000, 666000000, 666, 26, 1, 8}, 263 - { 12000000, 600000000, 600, 12, 1, 8}, 264 - { 13000000, 600000000, 600, 13, 1, 8}, 265 - { 19200000, 600000000, 375, 12, 1, 6}, 266 - { 26000000, 600000000, 600, 26, 1, 8}, 259 + { 12000000, 666000000, 666, 12, 0, 8}, 260 + { 13000000, 666000000, 666, 13, 0, 8}, 261 + { 19200000, 666000000, 555, 16, 0, 8}, 262 + { 26000000, 666000000, 666, 26, 0, 8}, 263 + { 12000000, 600000000, 600, 12, 0, 8}, 264 + { 13000000, 600000000, 600, 13, 0, 8}, 265 + { 19200000, 600000000, 375, 12, 0, 6}, 266 + { 26000000, 600000000, 600, 26, 0, 8}, 267 267 { 0, 0, 0, 0, 0, 0 }, 268 268 }; 269 269 270 270 static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { 271 - { 12000000, 216000000, 432, 12, 2, 8}, 272 - { 13000000, 216000000, 432, 13, 2, 8}, 273 - { 19200000, 216000000, 90, 4, 2, 1}, 274 - { 26000000, 216000000, 432, 26, 2, 8}, 275 - { 12000000, 432000000, 432, 12, 1, 8}, 276 - { 13000000, 432000000, 432, 13, 1, 8}, 277 - { 19200000, 432000000, 90, 4, 1, 1}, 278 - { 26000000, 432000000, 432, 26, 1, 8}, 271 + { 12000000, 216000000, 432, 12, 1, 8}, 272 + { 13000000, 216000000, 432, 13, 1, 8}, 273 + { 19200000, 216000000, 90, 4, 1, 1}, 274 + { 26000000, 216000000, 432, 26, 1, 8}, 275 + { 12000000, 432000000, 432, 12, 0, 8}, 276 + { 13000000, 432000000, 432, 13, 0, 8}, 277 + { 19200000, 432000000, 90, 4, 0, 1}, 278 + { 26000000, 432000000, 432, 26, 0, 8}, 279 279 { 0, 0, 0, 0, 0, 0 }, 280 280 }; 281 281 282 282 static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { 283 - { 28800000, 56448000, 49, 25, 1, 1}, 284 - { 28800000, 73728000, 64, 25, 1, 1}, 285 - { 28800000, 24000000, 5, 6, 1, 1}, 283 + { 28800000, 56448000, 49, 25, 0, 1}, 284 + { 28800000, 73728000, 64, 25, 0, 1}, 285 + { 28800000, 24000000, 5, 6, 0, 1}, 286 286 { 0, 0, 0, 0, 0, 0 }, 287 287 }; 288 288 289 289 static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { 290 - { 12000000, 216000000, 216, 12, 1, 4}, 291 - { 13000000, 216000000, 216, 13, 1, 4}, 292 - { 19200000, 216000000, 135, 12, 1, 3}, 293 - { 26000000, 216000000, 216, 26, 1, 4}, 290 + { 12000000, 216000000, 216, 12, 0, 4}, 291 + { 13000000, 216000000, 216, 13, 0, 4}, 292 + { 19200000, 216000000, 135, 12, 0, 3}, 293 + { 26000000, 216000000, 216, 26, 0, 4}, 294 294 295 - { 12000000, 594000000, 594, 12, 1, 8}, 296 - { 13000000, 594000000, 594, 13, 1, 8}, 297 - { 19200000, 594000000, 495, 16, 1, 8}, 298 - { 26000000, 594000000, 594, 26, 1, 8}, 295 + { 12000000, 594000000, 594, 12, 0, 8}, 296 + { 13000000, 594000000, 594, 13, 0, 8}, 297 + { 19200000, 594000000, 495, 16, 0, 8}, 298 + { 26000000, 594000000, 594, 26, 0, 8}, 299 299 300 - { 12000000, 1000000000, 1000, 12, 1, 12}, 301 - { 13000000, 1000000000, 1000, 13, 1, 12}, 302 - { 19200000, 1000000000, 625, 12, 1, 8}, 303 - { 26000000, 1000000000, 1000, 26, 1, 12}, 300 + { 12000000, 1000000000, 1000, 12, 0, 12}, 301 + { 13000000, 1000000000, 1000, 13, 0, 12}, 302 + { 19200000, 1000000000, 625, 12, 0, 8}, 303 + { 26000000, 1000000000, 1000, 26, 0, 12}, 304 304 305 305 { 0, 0, 0, 0, 0, 0 }, 306 306 }; 307 307 308 308 static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { 309 - { 12000000, 480000000, 960, 12, 2, 0}, 310 - { 13000000, 480000000, 960, 13, 2, 0}, 311 - { 19200000, 480000000, 200, 4, 2, 0}, 312 - { 26000000, 480000000, 960, 26, 2, 0}, 309 + { 12000000, 480000000, 960, 12, 0, 0}, 310 + { 13000000, 480000000, 960, 13, 0, 0}, 311 + { 19200000, 480000000, 200, 4, 0, 0}, 312 + { 26000000, 480000000, 960, 26, 0, 0}, 313 313 { 0, 0, 0, 0, 0, 0 }, 314 314 }; 315 315 316 316 static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { 317 317 /* 1 GHz */ 318 - { 12000000, 1000000000, 1000, 12, 1, 12}, 319 - { 13000000, 1000000000, 1000, 13, 1, 12}, 320 - { 19200000, 1000000000, 625, 12, 1, 8}, 321 - { 26000000, 1000000000, 1000, 26, 1, 12}, 318 + { 12000000, 1000000000, 1000, 12, 0, 12}, 319 + { 13000000, 1000000000, 1000, 13, 0, 12}, 320 + { 19200000, 1000000000, 625, 12, 0, 8}, 321 + { 26000000, 1000000000, 1000, 26, 0, 12}, 322 322 323 323 /* 912 MHz */ 324 - { 12000000, 912000000, 912, 12, 1, 12}, 325 - { 13000000, 912000000, 912, 13, 1, 12}, 326 - { 19200000, 912000000, 760, 16, 1, 8}, 327 - { 26000000, 912000000, 912, 26, 1, 12}, 324 + { 12000000, 912000000, 912, 12, 0, 12}, 325 + { 13000000, 912000000, 912, 13, 0, 12}, 326 + { 19200000, 912000000, 760, 16, 0, 8}, 327 + { 26000000, 912000000, 912, 26, 0, 12}, 328 328 329 329 /* 816 MHz */ 330 - { 12000000, 816000000, 816, 12, 1, 12}, 331 - { 13000000, 816000000, 816, 13, 1, 12}, 332 - { 19200000, 816000000, 680, 16, 1, 8}, 333 - { 26000000, 816000000, 816, 26, 1, 12}, 330 + { 12000000, 816000000, 816, 12, 0, 12}, 331 + { 13000000, 816000000, 816, 13, 0, 12}, 332 + { 19200000, 816000000, 680, 16, 0, 8}, 333 + { 26000000, 816000000, 816, 26, 0, 12}, 334 334 335 335 /* 760 MHz */ 336 - { 12000000, 760000000, 760, 12, 1, 12}, 337 - { 13000000, 760000000, 760, 13, 1, 12}, 338 - { 19200000, 760000000, 950, 24, 1, 8}, 339 - { 26000000, 760000000, 760, 26, 1, 12}, 336 + { 12000000, 760000000, 760, 12, 0, 12}, 337 + { 13000000, 760000000, 760, 13, 0, 12}, 338 + { 19200000, 760000000, 950, 24, 0, 8}, 339 + { 26000000, 760000000, 760, 26, 0, 12}, 340 340 341 341 /* 750 MHz */ 342 - { 12000000, 750000000, 750, 12, 1, 12}, 343 - { 13000000, 750000000, 750, 13, 1, 12}, 344 - { 19200000, 750000000, 625, 16, 1, 8}, 345 - { 26000000, 750000000, 750, 26, 1, 12}, 342 + { 12000000, 750000000, 750, 12, 0, 12}, 343 + { 13000000, 750000000, 750, 13, 0, 12}, 344 + { 19200000, 750000000, 625, 16, 0, 8}, 345 + { 26000000, 750000000, 750, 26, 0, 12}, 346 346 347 347 /* 608 MHz */ 348 - { 12000000, 608000000, 608, 12, 1, 12}, 349 - { 13000000, 608000000, 608, 13, 1, 12}, 350 - { 19200000, 608000000, 380, 12, 1, 8}, 351 - { 26000000, 608000000, 608, 26, 1, 12}, 348 + { 12000000, 608000000, 608, 12, 0, 12}, 349 + { 13000000, 608000000, 608, 13, 0, 12}, 350 + { 19200000, 608000000, 380, 12, 0, 8}, 351 + { 26000000, 608000000, 608, 26, 0, 12}, 352 352 353 353 /* 456 MHz */ 354 - { 12000000, 456000000, 456, 12, 1, 12}, 355 - { 13000000, 456000000, 456, 13, 1, 12}, 356 - { 19200000, 456000000, 380, 16, 1, 8}, 357 - { 26000000, 456000000, 456, 26, 1, 12}, 354 + { 12000000, 456000000, 456, 12, 0, 12}, 355 + { 13000000, 456000000, 456, 13, 0, 12}, 356 + { 19200000, 456000000, 380, 16, 0, 8}, 357 + { 26000000, 456000000, 456, 26, 0, 12}, 358 358 359 359 /* 312 MHz */ 360 - { 12000000, 312000000, 312, 12, 1, 12}, 361 - { 13000000, 312000000, 312, 13, 1, 12}, 362 - { 19200000, 312000000, 260, 16, 1, 8}, 363 - { 26000000, 312000000, 312, 26, 1, 12}, 360 + { 12000000, 312000000, 312, 12, 0, 12}, 361 + { 13000000, 312000000, 312, 13, 0, 12}, 362 + { 19200000, 312000000, 260, 16, 0, 8}, 363 + { 26000000, 312000000, 312, 26, 0, 12}, 364 364 365 365 { 0, 0, 0, 0, 0, 0 }, 366 366 }; 367 367 368 368 static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { 369 - { 12000000, 100000000, 200, 24, 1, 0 }, 369 + { 12000000, 100000000, 200, 24, 0, 0 }, 370 370 { 0, 0, 0, 0, 0, 0 }, 371 371 }; 372 372 ··· 380 380 .vco_max = 1400000000, 381 381 .base_reg = PLLC_BASE, 382 382 .misc_reg = PLLC_MISC, 383 - .lock_bit_idx = PLL_BASE_LOCK, 383 + .lock_mask = PLL_BASE_LOCK, 384 384 .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 385 385 .lock_delay = 300, 386 386 }; ··· 394 394 .vco_max = 1200000000, 395 395 .base_reg = PLLM_BASE, 396 396 .misc_reg = PLLM_MISC, 397 - .lock_bit_idx = PLL_BASE_LOCK, 397 + .lock_mask = PLL_BASE_LOCK, 398 398 .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 399 399 .lock_delay = 300, 400 400 }; ··· 408 408 .vco_max = 1400000000, 409 409 .base_reg = PLLP_BASE, 410 410 .misc_reg = PLLP_MISC, 411 - .lock_bit_idx = PLL_BASE_LOCK, 411 + .lock_mask = PLL_BASE_LOCK, 412 412 .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 413 413 .lock_delay = 300, 414 414 }; ··· 422 422 .vco_max = 1400000000, 423 423 .base_reg = PLLA_BASE, 424 424 .misc_reg = PLLA_MISC, 425 - .lock_bit_idx = PLL_BASE_LOCK, 425 + .lock_mask = PLL_BASE_LOCK, 426 426 .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 427 427 .lock_delay = 300, 428 428 }; ··· 436 436 .vco_max = 1000000000, 437 437 .base_reg = PLLD_BASE, 438 438 .misc_reg = PLLD_MISC, 439 - .lock_bit_idx = PLL_BASE_LOCK, 439 + .lock_mask = PLL_BASE_LOCK, 440 440 .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, 441 441 .lock_delay = 1000, 442 + }; 443 + 444 + static struct pdiv_map pllu_p[] = { 445 + { .pdiv = 1, .hw_val = 1 }, 446 + { .pdiv = 2, .hw_val = 0 }, 447 + { .pdiv = 0, .hw_val = 0 }, 442 448 }; 443 449 444 450 static struct tegra_clk_pll_params pll_u_params = { ··· 456 450 .vco_max = 960000000, 457 451 .base_reg = PLLU_BASE, 458 452 .misc_reg = PLLU_MISC, 459 - .lock_bit_idx = PLL_BASE_LOCK, 453 + .lock_mask = PLL_BASE_LOCK, 460 454 .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, 461 455 .lock_delay = 1000, 456 + .pdiv_tohw = pllu_p, 462 457 }; 463 458 464 459 static struct tegra_clk_pll_params pll_x_params = { ··· 471 464 .vco_max = 1200000000, 472 465 .base_reg = PLLX_BASE, 473 466 .misc_reg = PLLX_MISC, 474 - .lock_bit_idx = PLL_BASE_LOCK, 467 + .lock_mask = PLL_BASE_LOCK, 475 468 .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 476 469 .lock_delay = 300, 477 470 }; ··· 485 478 .vco_max = 0, 486 479 .base_reg = PLLE_BASE, 487 480 .misc_reg = PLLE_MISC, 488 - .lock_bit_idx = PLLE_MISC_LOCK, 481 + .lock_mask = PLLE_MISC_LOCK, 489 482 .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, 490 483 .lock_delay = 0, 491 484 }; ··· 1019 1012 data = &tegra_periph_clk_list[i]; 1020 1013 clk = tegra_clk_register_periph(data->name, data->parent_names, 1021 1014 data->num_parents, &data->periph, 1022 - clk_base, data->offset); 1015 + clk_base, data->offset, data->flags); 1023 1016 clk_register_clkdev(clk, data->con_id, data->dev_id); 1024 1017 clks[data->clk_id] = clk; 1025 1018 } ··· 1254 1247 {host1x, pll_c, 150000000, 0}, 1255 1248 {disp1, pll_p, 600000000, 0}, 1256 1249 {disp2, pll_p, 600000000, 0}, 1250 + {gr2d, pll_c, 300000000, 0}, 1251 + {gr3d, pll_c, 300000000, 0}, 1257 1252 {clk_max, clk_max, 0, 0}, /* This MUST be the last entry */ 1258 1253 }; 1254 + 1255 + static void __init tegra20_clock_apply_init_table(void) 1256 + { 1257 + tegra_init_from_table(init_table, clks, clk_max); 1258 + } 1259 1259 1260 1260 /* 1261 1261 * Some clocks may be used by different drivers depending on the board ··· 1330 1316 clk_data.clk_num = ARRAY_SIZE(clks); 1331 1317 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 1332 1318 1333 - tegra_init_from_table(init_table, clks, clk_max); 1319 + tegra_clk_apply_init_table = tegra20_clock_apply_init_table; 1334 1320 1335 1321 tegra_cpu_car_ops = &tegra20_cpu_car_ops; 1336 1322 }
+138 -124
drivers/clk/tegra/clk-tegra30.c
··· 115 115 #define PLLDU_MISC_LOCK_ENABLE 22 116 116 #define PLLE_MISC_LOCK_ENABLE 9 117 117 118 - #define PLL_BASE_LOCK 27 119 - #define PLLE_MISC_LOCK 11 118 + #define PLL_BASE_LOCK BIT(27) 119 + #define PLLE_MISC_LOCK BIT(11) 120 120 121 121 #define PLLE_AUX 0x48c 122 122 #define PLLC_OUT 0x84 ··· 329 329 usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3, 330 330 pcie, owr, afi, csite, pciex, avpucq, la, dtv = 79, ndspeed, i2cslow, 331 331 dsib, irama = 84, iramb, iramc, iramd, cram2, audio_2x = 90, csus = 92, 332 - cdev1, cdev2, cpu_g = 96, cpu_lp, gr3d2, mselect, tsensor, i2s3, i2s4, 332 + cdev2, cdev1, cpu_g = 96, cpu_lp, gr3d2, mselect, tsensor, i2s3, i2s4, 333 333 i2c4, sbc5, sbc6, d_audio, apbif, dam0, dam1, dam2, hda2codec_2x, 334 334 atomics, audio0_2x, audio1_2x, audio2_2x, audio3_2x, audio4_2x, 335 335 spdif_2x, actmon, extern1, extern2, extern3, sata_oob, sata, hda, ··· 373 373 }; 374 374 375 375 static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { 376 - { 12000000, 1040000000, 520, 6, 1, 8}, 377 - { 13000000, 1040000000, 480, 6, 1, 8}, 378 - { 16800000, 1040000000, 495, 8, 1, 8}, /* actual: 1039.5 MHz */ 379 - { 19200000, 1040000000, 325, 6, 1, 6}, 380 - { 26000000, 1040000000, 520, 13, 1, 8}, 376 + { 12000000, 1040000000, 520, 6, 0, 8}, 377 + { 13000000, 1040000000, 480, 6, 0, 8}, 378 + { 16800000, 1040000000, 495, 8, 0, 8}, /* actual: 1039.5 MHz */ 379 + { 19200000, 1040000000, 325, 6, 0, 6}, 380 + { 26000000, 1040000000, 520, 13, 0, 8}, 381 381 382 - { 12000000, 832000000, 416, 6, 1, 8}, 383 - { 13000000, 832000000, 832, 13, 1, 8}, 384 - { 16800000, 832000000, 396, 8, 1, 8}, /* actual: 831.6 MHz */ 385 - { 19200000, 832000000, 260, 6, 1, 8}, 386 - { 26000000, 832000000, 416, 13, 1, 8}, 382 + { 12000000, 832000000, 416, 6, 0, 8}, 383 + { 13000000, 832000000, 832, 13, 0, 8}, 384 + { 16800000, 832000000, 396, 8, 0, 8}, /* actual: 831.6 MHz */ 385 + { 19200000, 832000000, 260, 6, 0, 8}, 386 + { 26000000, 832000000, 416, 13, 0, 8}, 387 387 388 - { 12000000, 624000000, 624, 12, 1, 8}, 389 - { 13000000, 624000000, 624, 13, 1, 8}, 390 - { 16800000, 600000000, 520, 14, 1, 8}, 391 - { 19200000, 624000000, 520, 16, 1, 8}, 392 - { 26000000, 624000000, 624, 26, 1, 8}, 388 + { 12000000, 624000000, 624, 12, 0, 8}, 389 + { 13000000, 624000000, 624, 13, 0, 8}, 390 + { 16800000, 600000000, 520, 14, 0, 8}, 391 + { 19200000, 624000000, 520, 16, 0, 8}, 392 + { 26000000, 624000000, 624, 26, 0, 8}, 393 393 394 - { 12000000, 600000000, 600, 12, 1, 8}, 395 - { 13000000, 600000000, 600, 13, 1, 8}, 396 - { 16800000, 600000000, 500, 14, 1, 8}, 397 - { 19200000, 600000000, 375, 12, 1, 6}, 398 - { 26000000, 600000000, 600, 26, 1, 8}, 394 + { 12000000, 600000000, 600, 12, 0, 8}, 395 + { 13000000, 600000000, 600, 13, 0, 8}, 396 + { 16800000, 600000000, 500, 14, 0, 8}, 397 + { 19200000, 600000000, 375, 12, 0, 6}, 398 + { 26000000, 600000000, 600, 26, 0, 8}, 399 399 400 - { 12000000, 520000000, 520, 12, 1, 8}, 401 - { 13000000, 520000000, 520, 13, 1, 8}, 402 - { 16800000, 520000000, 495, 16, 1, 8}, /* actual: 519.75 MHz */ 403 - { 19200000, 520000000, 325, 12, 1, 6}, 404 - { 26000000, 520000000, 520, 26, 1, 8}, 400 + { 12000000, 520000000, 520, 12, 0, 8}, 401 + { 13000000, 520000000, 520, 13, 0, 8}, 402 + { 16800000, 520000000, 495, 16, 0, 8}, /* actual: 519.75 MHz */ 403 + { 19200000, 520000000, 325, 12, 0, 6}, 404 + { 26000000, 520000000, 520, 26, 0, 8}, 405 405 406 - { 12000000, 416000000, 416, 12, 1, 8}, 407 - { 13000000, 416000000, 416, 13, 1, 8}, 408 - { 16800000, 416000000, 396, 16, 1, 8}, /* actual: 415.8 MHz */ 409 - { 19200000, 416000000, 260, 12, 1, 6}, 410 - { 26000000, 416000000, 416, 26, 1, 8}, 406 + { 12000000, 416000000, 416, 12, 0, 8}, 407 + { 13000000, 416000000, 416, 13, 0, 8}, 408 + { 16800000, 416000000, 396, 16, 0, 8}, /* actual: 415.8 MHz */ 409 + { 19200000, 416000000, 260, 12, 0, 6}, 410 + { 26000000, 416000000, 416, 26, 0, 8}, 411 411 { 0, 0, 0, 0, 0, 0 }, 412 412 }; 413 413 414 414 static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { 415 - { 12000000, 666000000, 666, 12, 1, 8}, 416 - { 13000000, 666000000, 666, 13, 1, 8}, 417 - { 16800000, 666000000, 555, 14, 1, 8}, 418 - { 19200000, 666000000, 555, 16, 1, 8}, 419 - { 26000000, 666000000, 666, 26, 1, 8}, 420 - { 12000000, 600000000, 600, 12, 1, 8}, 421 - { 13000000, 600000000, 600, 13, 1, 8}, 422 - { 16800000, 600000000, 500, 14, 1, 8}, 423 - { 19200000, 600000000, 375, 12, 1, 6}, 424 - { 26000000, 600000000, 600, 26, 1, 8}, 415 + { 12000000, 666000000, 666, 12, 0, 8}, 416 + { 13000000, 666000000, 666, 13, 0, 8}, 417 + { 16800000, 666000000, 555, 14, 0, 8}, 418 + { 19200000, 666000000, 555, 16, 0, 8}, 419 + { 26000000, 666000000, 666, 26, 0, 8}, 420 + { 12000000, 600000000, 600, 12, 0, 8}, 421 + { 13000000, 600000000, 600, 13, 0, 8}, 422 + { 16800000, 600000000, 500, 14, 0, 8}, 423 + { 19200000, 600000000, 375, 12, 0, 6}, 424 + { 26000000, 600000000, 600, 26, 0, 8}, 425 425 { 0, 0, 0, 0, 0, 0 }, 426 426 }; 427 427 428 428 static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { 429 - { 12000000, 216000000, 432, 12, 2, 8}, 430 - { 13000000, 216000000, 432, 13, 2, 8}, 431 - { 16800000, 216000000, 360, 14, 2, 8}, 432 - { 19200000, 216000000, 360, 16, 2, 8}, 433 - { 26000000, 216000000, 432, 26, 2, 8}, 429 + { 12000000, 216000000, 432, 12, 1, 8}, 430 + { 13000000, 216000000, 432, 13, 1, 8}, 431 + { 16800000, 216000000, 360, 14, 1, 8}, 432 + { 19200000, 216000000, 360, 16, 1, 8}, 433 + { 26000000, 216000000, 432, 26, 1, 8}, 434 434 { 0, 0, 0, 0, 0, 0 }, 435 435 }; 436 436 437 437 static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { 438 - { 9600000, 564480000, 294, 5, 1, 4}, 439 - { 9600000, 552960000, 288, 5, 1, 4}, 440 - { 9600000, 24000000, 5, 2, 1, 1}, 438 + { 9600000, 564480000, 294, 5, 0, 4}, 439 + { 9600000, 552960000, 288, 5, 0, 4}, 440 + { 9600000, 24000000, 5, 2, 0, 1}, 441 441 442 - { 28800000, 56448000, 49, 25, 1, 1}, 443 - { 28800000, 73728000, 64, 25, 1, 1}, 444 - { 28800000, 24000000, 5, 6, 1, 1}, 442 + { 28800000, 56448000, 49, 25, 0, 1}, 443 + { 28800000, 73728000, 64, 25, 0, 1}, 444 + { 28800000, 24000000, 5, 6, 0, 1}, 445 445 { 0, 0, 0, 0, 0, 0 }, 446 446 }; 447 447 448 448 static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { 449 - { 12000000, 216000000, 216, 12, 1, 4}, 450 - { 13000000, 216000000, 216, 13, 1, 4}, 451 - { 16800000, 216000000, 180, 14, 1, 4}, 452 - { 19200000, 216000000, 180, 16, 1, 4}, 453 - { 26000000, 216000000, 216, 26, 1, 4}, 449 + { 12000000, 216000000, 216, 12, 0, 4}, 450 + { 13000000, 216000000, 216, 13, 0, 4}, 451 + { 16800000, 216000000, 180, 14, 0, 4}, 452 + { 19200000, 216000000, 180, 16, 0, 4}, 453 + { 26000000, 216000000, 216, 26, 0, 4}, 454 454 455 - { 12000000, 594000000, 594, 12, 1, 8}, 456 - { 13000000, 594000000, 594, 13, 1, 8}, 457 - { 16800000, 594000000, 495, 14, 1, 8}, 458 - { 19200000, 594000000, 495, 16, 1, 8}, 459 - { 26000000, 594000000, 594, 26, 1, 8}, 455 + { 12000000, 594000000, 594, 12, 0, 8}, 456 + { 13000000, 594000000, 594, 13, 0, 8}, 457 + { 16800000, 594000000, 495, 14, 0, 8}, 458 + { 19200000, 594000000, 495, 16, 0, 8}, 459 + { 26000000, 594000000, 594, 26, 0, 8}, 460 460 461 - { 12000000, 1000000000, 1000, 12, 1, 12}, 462 - { 13000000, 1000000000, 1000, 13, 1, 12}, 463 - { 19200000, 1000000000, 625, 12, 1, 8}, 464 - { 26000000, 1000000000, 1000, 26, 1, 12}, 461 + { 12000000, 1000000000, 1000, 12, 0, 12}, 462 + { 13000000, 1000000000, 1000, 13, 0, 12}, 463 + { 19200000, 1000000000, 625, 12, 0, 8}, 464 + { 26000000, 1000000000, 1000, 26, 0, 12}, 465 465 466 466 { 0, 0, 0, 0, 0, 0 }, 467 467 }; 468 468 469 + static struct pdiv_map pllu_p[] = { 470 + { .pdiv = 1, .hw_val = 1 }, 471 + { .pdiv = 2, .hw_val = 0 }, 472 + { .pdiv = 0, .hw_val = 0 }, 473 + }; 474 + 469 475 static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { 470 - { 12000000, 480000000, 960, 12, 2, 12}, 471 - { 13000000, 480000000, 960, 13, 2, 12}, 472 - { 16800000, 480000000, 400, 7, 2, 5}, 473 - { 19200000, 480000000, 200, 4, 2, 3}, 474 - { 26000000, 480000000, 960, 26, 2, 12}, 476 + { 12000000, 480000000, 960, 12, 0, 12}, 477 + { 13000000, 480000000, 960, 13, 0, 12}, 478 + { 16800000, 480000000, 400, 7, 0, 5}, 479 + { 19200000, 480000000, 200, 4, 0, 3}, 480 + { 26000000, 480000000, 960, 26, 0, 12}, 475 481 { 0, 0, 0, 0, 0, 0 }, 476 482 }; 477 483 478 484 static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { 479 485 /* 1.7 GHz */ 480 - { 12000000, 1700000000, 850, 6, 1, 8}, 481 - { 13000000, 1700000000, 915, 7, 1, 8}, /* actual: 1699.2 MHz */ 482 - { 16800000, 1700000000, 708, 7, 1, 8}, /* actual: 1699.2 MHz */ 483 - { 19200000, 1700000000, 885, 10, 1, 8}, /* actual: 1699.2 MHz */ 484 - { 26000000, 1700000000, 850, 13, 1, 8}, 486 + { 12000000, 1700000000, 850, 6, 0, 8}, 487 + { 13000000, 1700000000, 915, 7, 0, 8}, /* actual: 1699.2 MHz */ 488 + { 16800000, 1700000000, 708, 7, 0, 8}, /* actual: 1699.2 MHz */ 489 + { 19200000, 1700000000, 885, 10, 0, 8}, /* actual: 1699.2 MHz */ 490 + { 26000000, 1700000000, 850, 13, 0, 8}, 485 491 486 492 /* 1.6 GHz */ 487 - { 12000000, 1600000000, 800, 6, 1, 8}, 488 - { 13000000, 1600000000, 738, 6, 1, 8}, /* actual: 1599.0 MHz */ 489 - { 16800000, 1600000000, 857, 9, 1, 8}, /* actual: 1599.7 MHz */ 490 - { 19200000, 1600000000, 500, 6, 1, 8}, 491 - { 26000000, 1600000000, 800, 13, 1, 8}, 493 + { 12000000, 1600000000, 800, 6, 0, 8}, 494 + { 13000000, 1600000000, 738, 6, 0, 8}, /* actual: 1599.0 MHz */ 495 + { 16800000, 1600000000, 857, 9, 0, 8}, /* actual: 1599.7 MHz */ 496 + { 19200000, 1600000000, 500, 6, 0, 8}, 497 + { 26000000, 1600000000, 800, 13, 0, 8}, 492 498 493 499 /* 1.5 GHz */ 494 - { 12000000, 1500000000, 750, 6, 1, 8}, 495 - { 13000000, 1500000000, 923, 8, 1, 8}, /* actual: 1499.8 MHz */ 496 - { 16800000, 1500000000, 625, 7, 1, 8}, 497 - { 19200000, 1500000000, 625, 8, 1, 8}, 498 - { 26000000, 1500000000, 750, 13, 1, 8}, 500 + { 12000000, 1500000000, 750, 6, 0, 8}, 501 + { 13000000, 1500000000, 923, 8, 0, 8}, /* actual: 1499.8 MHz */ 502 + { 16800000, 1500000000, 625, 7, 0, 8}, 503 + { 19200000, 1500000000, 625, 8, 0, 8}, 504 + { 26000000, 1500000000, 750, 13, 0, 8}, 499 505 500 506 /* 1.4 GHz */ 501 - { 12000000, 1400000000, 700, 6, 1, 8}, 502 - { 13000000, 1400000000, 969, 9, 1, 8}, /* actual: 1399.7 MHz */ 503 - { 16800000, 1400000000, 1000, 12, 1, 8}, 504 - { 19200000, 1400000000, 875, 12, 1, 8}, 505 - { 26000000, 1400000000, 700, 13, 1, 8}, 507 + { 12000000, 1400000000, 700, 6, 0, 8}, 508 + { 13000000, 1400000000, 969, 9, 0, 8}, /* actual: 1399.7 MHz */ 509 + { 16800000, 1400000000, 1000, 12, 0, 8}, 510 + { 19200000, 1400000000, 875, 12, 0, 8}, 511 + { 26000000, 1400000000, 700, 13, 0, 8}, 506 512 507 513 /* 1.3 GHz */ 508 - { 12000000, 1300000000, 975, 9, 1, 8}, 509 - { 13000000, 1300000000, 1000, 10, 1, 8}, 510 - { 16800000, 1300000000, 928, 12, 1, 8}, /* actual: 1299.2 MHz */ 511 - { 19200000, 1300000000, 812, 12, 1, 8}, /* actual: 1299.2 MHz */ 512 - { 26000000, 1300000000, 650, 13, 1, 8}, 514 + { 12000000, 1300000000, 975, 9, 0, 8}, 515 + { 13000000, 1300000000, 1000, 10, 0, 8}, 516 + { 16800000, 1300000000, 928, 12, 0, 8}, /* actual: 1299.2 MHz */ 517 + { 19200000, 1300000000, 812, 12, 0, 8}, /* actual: 1299.2 MHz */ 518 + { 26000000, 1300000000, 650, 13, 0, 8}, 513 519 514 520 /* 1.2 GHz */ 515 - { 12000000, 1200000000, 1000, 10, 1, 8}, 516 - { 13000000, 1200000000, 923, 10, 1, 8}, /* actual: 1199.9 MHz */ 517 - { 16800000, 1200000000, 1000, 14, 1, 8}, 518 - { 19200000, 1200000000, 1000, 16, 1, 8}, 519 - { 26000000, 1200000000, 600, 13, 1, 8}, 521 + { 12000000, 1200000000, 1000, 10, 0, 8}, 522 + { 13000000, 1200000000, 923, 10, 0, 8}, /* actual: 1199.9 MHz */ 523 + { 16800000, 1200000000, 1000, 14, 0, 8}, 524 + { 19200000, 1200000000, 1000, 16, 0, 8}, 525 + { 26000000, 1200000000, 600, 13, 0, 8}, 520 526 521 527 /* 1.1 GHz */ 522 - { 12000000, 1100000000, 825, 9, 1, 8}, 523 - { 13000000, 1100000000, 846, 10, 1, 8}, /* actual: 1099.8 MHz */ 524 - { 16800000, 1100000000, 982, 15, 1, 8}, /* actual: 1099.8 MHz */ 525 - { 19200000, 1100000000, 859, 15, 1, 8}, /* actual: 1099.5 MHz */ 526 - { 26000000, 1100000000, 550, 13, 1, 8}, 528 + { 12000000, 1100000000, 825, 9, 0, 8}, 529 + { 13000000, 1100000000, 846, 10, 0, 8}, /* actual: 1099.8 MHz */ 530 + { 16800000, 1100000000, 982, 15, 0, 8}, /* actual: 1099.8 MHz */ 531 + { 19200000, 1100000000, 859, 15, 0, 8}, /* actual: 1099.5 MHz */ 532 + { 26000000, 1100000000, 550, 13, 0, 8}, 527 533 528 534 /* 1 GHz */ 529 - { 12000000, 1000000000, 1000, 12, 1, 8}, 530 - { 13000000, 1000000000, 1000, 13, 1, 8}, 531 - { 16800000, 1000000000, 833, 14, 1, 8}, /* actual: 999.6 MHz */ 532 - { 19200000, 1000000000, 625, 12, 1, 8}, 533 - { 26000000, 1000000000, 1000, 26, 1, 8}, 535 + { 12000000, 1000000000, 1000, 12, 0, 8}, 536 + { 13000000, 1000000000, 1000, 13, 0, 8}, 537 + { 16800000, 1000000000, 833, 14, 0, 8}, /* actual: 999.6 MHz */ 538 + { 19200000, 1000000000, 625, 12, 0, 8}, 539 + { 26000000, 1000000000, 1000, 26, 0, 8}, 534 540 535 541 { 0, 0, 0, 0, 0, 0 }, 536 542 }; ··· 558 552 .vco_max = 1400000000, 559 553 .base_reg = PLLC_BASE, 560 554 .misc_reg = PLLC_MISC, 561 - .lock_bit_idx = PLL_BASE_LOCK, 555 + .lock_mask = PLL_BASE_LOCK, 562 556 .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 563 557 .lock_delay = 300, 564 558 }; ··· 572 566 .vco_max = 1200000000, 573 567 .base_reg = PLLM_BASE, 574 568 .misc_reg = PLLM_MISC, 575 - .lock_bit_idx = PLL_BASE_LOCK, 569 + .lock_mask = PLL_BASE_LOCK, 576 570 .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 577 571 .lock_delay = 300, 578 572 }; ··· 586 580 .vco_max = 1400000000, 587 581 .base_reg = PLLP_BASE, 588 582 .misc_reg = PLLP_MISC, 589 - .lock_bit_idx = PLL_BASE_LOCK, 583 + .lock_mask = PLL_BASE_LOCK, 590 584 .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 591 585 .lock_delay = 300, 592 586 }; ··· 600 594 .vco_max = 1400000000, 601 595 .base_reg = PLLA_BASE, 602 596 .misc_reg = PLLA_MISC, 603 - .lock_bit_idx = PLL_BASE_LOCK, 597 + .lock_mask = PLL_BASE_LOCK, 604 598 .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 605 599 .lock_delay = 300, 606 600 }; ··· 614 608 .vco_max = 1000000000, 615 609 .base_reg = PLLD_BASE, 616 610 .misc_reg = PLLD_MISC, 617 - .lock_bit_idx = PLL_BASE_LOCK, 611 + .lock_mask = PLL_BASE_LOCK, 618 612 .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, 619 613 .lock_delay = 1000, 620 614 }; ··· 628 622 .vco_max = 1000000000, 629 623 .base_reg = PLLD2_BASE, 630 624 .misc_reg = PLLD2_MISC, 631 - .lock_bit_idx = PLL_BASE_LOCK, 625 + .lock_mask = PLL_BASE_LOCK, 632 626 .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, 633 627 .lock_delay = 1000, 634 628 }; ··· 642 636 .vco_max = 960000000, 643 637 .base_reg = PLLU_BASE, 644 638 .misc_reg = PLLU_MISC, 645 - .lock_bit_idx = PLL_BASE_LOCK, 639 + .lock_mask = PLL_BASE_LOCK, 646 640 .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, 647 641 .lock_delay = 1000, 642 + .pdiv_tohw = pllu_p, 648 643 }; 649 644 650 645 static struct tegra_clk_pll_params pll_x_params = { ··· 657 650 .vco_max = 1700000000, 658 651 .base_reg = PLLX_BASE, 659 652 .misc_reg = PLLX_MISC, 660 - .lock_bit_idx = PLL_BASE_LOCK, 653 + .lock_mask = PLL_BASE_LOCK, 661 654 .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, 662 655 .lock_delay = 300, 663 656 }; ··· 671 664 .vco_max = 2400000000U, 672 665 .base_reg = PLLE_BASE, 673 666 .misc_reg = PLLE_MISC, 674 - .lock_bit_idx = PLLE_MISC_LOCK, 667 + .lock_mask = PLLE_MISC_LOCK, 675 668 .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, 676 669 .lock_delay = 300, 677 670 }; ··· 1667 1660 data = &tegra_periph_clk_list[i]; 1668 1661 clk = tegra_clk_register_periph(data->name, data->parent_names, 1669 1662 data->num_parents, &data->periph, 1670 - clk_base, data->offset); 1663 + clk_base, data->offset, data->flags); 1671 1664 clk_register_clkdev(clk, data->con_id, data->dev_id); 1672 1665 clks[data->clk_id] = clk; 1673 1666 } ··· 1917 1910 {disp1, pll_p, 600000000, 0}, 1918 1911 {disp2, pll_p, 600000000, 0}, 1919 1912 {twd, clk_max, 0, 1}, 1913 + {gr2d, pll_c, 300000000, 0}, 1914 + {gr3d, pll_c, 300000000, 0}, 1920 1915 {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */ 1921 1916 }; 1917 + 1918 + static void __init tegra30_clock_apply_init_table(void) 1919 + { 1920 + tegra_init_from_table(init_table, clks, clk_max); 1921 + } 1922 1922 1923 1923 /* 1924 1924 * Some clocks may be used by different drivers depending on the board ··· 2000 1986 clk_data.clk_num = ARRAY_SIZE(clks); 2001 1987 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 2002 1988 2003 - tegra_init_from_table(init_table, clks, clk_max); 1989 + tegra_clk_apply_init_table = tegra30_clock_apply_init_table; 2004 1990 2005 1991 tegra_cpu_car_ops = &tegra30_cpu_car_ops; 2006 1992 }
+13 -1
drivers/clk/tegra/clk.c
··· 22 22 #include "clk.h" 23 23 24 24 /* Global data of Tegra CPU CAR ops */ 25 - struct tegra_cpu_car_ops *tegra_cpu_car_ops; 25 + static struct tegra_cpu_car_ops dummy_car_ops; 26 + struct tegra_cpu_car_ops *tegra_cpu_car_ops = &dummy_car_ops; 26 27 27 28 void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, 28 29 struct clk *clks[], int clk_max) ··· 77 76 static const struct of_device_id tegra_dt_clk_match[] = { 78 77 { .compatible = "nvidia,tegra20-car", .data = tegra20_clock_init }, 79 78 { .compatible = "nvidia,tegra30-car", .data = tegra30_clock_init }, 79 + { .compatible = "nvidia,tegra114-car", .data = tegra114_clock_init }, 80 80 { } 81 81 }; 82 82 83 83 void __init tegra_clocks_init(void) 84 84 { 85 85 of_clk_init(tegra_dt_clk_match); 86 + } 87 + 88 + tegra_clk_apply_init_table_func tegra_clk_apply_init_table; 89 + 90 + void __init tegra_clocks_apply_init_table(void) 91 + { 92 + if (!tegra_clk_apply_init_table) 93 + return; 94 + 95 + tegra_clk_apply_init_table(); 86 96 }
+90 -8
drivers/clk/tegra/clk.h
··· 1 - /* 1 + /* 2 2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. 3 3 * 4 4 * This program is free software; you can redistribute it and/or modify it ··· 117 117 }; 118 118 119 119 /** 120 + * struct pdiv_map - map post divider to hw value 121 + * 122 + * @pdiv: post divider 123 + * @hw_val: value to be written to the PLL hw 124 + */ 125 + struct pdiv_map { 126 + u8 pdiv; 127 + u8 hw_val; 128 + }; 129 + 130 + /** 120 131 * struct clk_pll_params - PLL parameters 121 132 * 122 133 * @input_min: Minimum input frequency ··· 154 143 u32 base_reg; 155 144 u32 misc_reg; 156 145 u32 lock_reg; 157 - u32 lock_bit_idx; 146 + u32 lock_mask; 158 147 u32 lock_enable_bit_idx; 148 + u32 iddq_reg; 149 + u32 iddq_bit_idx; 150 + u32 aux_reg; 151 + u32 dyn_ramp_reg; 152 + u32 ext_misc_reg[3]; 153 + int stepa_shift; 154 + int stepb_shift; 159 155 int lock_delay; 156 + int max_p; 157 + struct pdiv_map *pdiv_tohw; 160 158 }; 161 159 162 160 /** ··· 202 182 * TEGRA_PLL_FIXED - We are not supposed to change output frequency 203 183 * of some plls. 204 184 * TEGRA_PLLE_CONFIGURE - Configure PLLE when enabling. 185 + * TEGRA_PLL_LOCK_MISC - Lock bit is in the misc register instead of the 186 + * base register. 187 + * TEGRA_PLL_BYPASS - PLL has bypass bit 188 + * TEGRA_PLL_HAS_LOCK_ENABLE - PLL has bit to enable lock monitoring 205 189 */ 206 190 struct tegra_clk_pll { 207 191 struct clk_hw hw; 208 192 void __iomem *clk_base; 209 193 void __iomem *pmc; 210 - u8 flags; 194 + u32 flags; 211 195 unsigned long fixed_rate; 212 196 spinlock_t *lock; 213 197 u8 divn_shift; ··· 234 210 #define TEGRA_PLLM BIT(5) 235 211 #define TEGRA_PLL_FIXED BIT(6) 236 212 #define TEGRA_PLLE_CONFIGURE BIT(7) 213 + #define TEGRA_PLL_LOCK_MISC BIT(8) 214 + #define TEGRA_PLL_BYPASS BIT(9) 215 + #define TEGRA_PLL_HAS_LOCK_ENABLE BIT(10) 237 216 238 217 extern const struct clk_ops tegra_clk_pll_ops; 239 218 extern const struct clk_ops tegra_clk_plle_ops; 240 219 struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, 241 220 void __iomem *clk_base, void __iomem *pmc, 242 221 unsigned long flags, unsigned long fixed_rate, 243 - struct tegra_clk_pll_params *pll_params, u8 pll_flags, 222 + struct tegra_clk_pll_params *pll_params, u32 pll_flags, 244 223 struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); 224 + 245 225 struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, 246 226 void __iomem *clk_base, void __iomem *pmc, 247 227 unsigned long flags, unsigned long fixed_rate, 248 - struct tegra_clk_pll_params *pll_params, u8 pll_flags, 228 + struct tegra_clk_pll_params *pll_params, u32 pll_flags, 249 229 struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); 230 + 231 + struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name, 232 + void __iomem *clk_base, void __iomem *pmc, 233 + unsigned long flags, unsigned long fixed_rate, 234 + struct tegra_clk_pll_params *pll_params, 235 + u32 pll_flags, 236 + struct tegra_clk_pll_freq_table *freq_table, 237 + spinlock_t *lock); 238 + 239 + struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name, 240 + void __iomem *clk_base, void __iomem *pmc, 241 + unsigned long flags, unsigned long fixed_rate, 242 + struct tegra_clk_pll_params *pll_params, 243 + u32 pll_flags, 244 + struct tegra_clk_pll_freq_table *freq_table, 245 + spinlock_t *lock); 246 + 247 + struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, 248 + void __iomem *clk_base, void __iomem *pmc, 249 + unsigned long flags, unsigned long fixed_rate, 250 + struct tegra_clk_pll_params *pll_params, 251 + u32 pll_flags, 252 + struct tegra_clk_pll_freq_table *freq_table, 253 + spinlock_t *lock); 254 + 255 + struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name, 256 + void __iomem *clk_base, void __iomem *pmc, 257 + unsigned long flags, unsigned long fixed_rate, 258 + struct tegra_clk_pll_params *pll_params, 259 + u32 pll_flags, 260 + struct tegra_clk_pll_freq_table *freq_table, 261 + spinlock_t *lock, unsigned long parent_rate); 262 + 263 + struct clk *tegra_clk_register_plle_tegra114(const char *name, 264 + const char *parent_name, 265 + void __iomem *clk_base, unsigned long flags, 266 + unsigned long fixed_rate, 267 + struct tegra_clk_pll_params *pll_params, 268 + struct tegra_clk_pll_freq_table *freq_table, 269 + spinlock_t *lock); 250 270 251 271 /** 252 272 * struct tegra_clk_pll_out - PLL divider down clock ··· 358 290 * TEGRA_PERIPH_ON_APB - If peripheral is in the APB bus then read the 359 291 * bus to flush the write operation in apb bus. This flag indicates 360 292 * that this peripheral is in apb bus. 293 + * TEGRA_PERIPH_WAR_1005168 - Apply workaround for Tegra114 MSENC bug 361 294 */ 362 295 struct tegra_clk_periph_gate { 363 296 u32 magic; ··· 378 309 #define TEGRA_PERIPH_NO_RESET BIT(0) 379 310 #define TEGRA_PERIPH_MANUAL_RESET BIT(1) 380 311 #define TEGRA_PERIPH_ON_APB BIT(2) 312 + #define TEGRA_PERIPH_WAR_1005168 BIT(3) 381 313 382 314 void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert); 383 315 extern const struct clk_ops tegra_clk_periph_gate_ops; ··· 419 349 struct clk *tegra_clk_register_periph(const char *name, 420 350 const char **parent_names, int num_parents, 421 351 struct tegra_clk_periph *periph, void __iomem *clk_base, 422 - u32 offset); 352 + u32 offset, unsigned long flags); 423 353 struct clk *tegra_clk_register_periph_nodiv(const char *name, 424 354 const char **parent_names, int num_parents, 425 355 struct tegra_clk_periph *periph, void __iomem *clk_base, ··· 462 392 u32 offset; 463 393 const char *con_id; 464 394 const char *dev_id; 395 + unsigned long flags; 465 396 }; 466 397 467 398 #define TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\ 468 399 _mux_shift, _mux_mask, _mux_flags, _div_shift, \ 469 400 _div_width, _div_frac_width, _div_flags, _regs, \ 470 - _clk_num, _enb_refcnt, _gate_flags, _clk_id, _table) \ 401 + _clk_num, _enb_refcnt, _gate_flags, _clk_id, _table,\ 402 + _flags) \ 471 403 { \ 472 404 .name = _name, \ 473 405 .clk_id = _clk_id, \ ··· 484 412 .offset = _offset, \ 485 413 .con_id = _con_id, \ 486 414 .dev_id = _dev_id, \ 415 + .flags = _flags \ 487 416 } 488 417 489 418 #define TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parent_names, _offset,\ ··· 495 422 _mux_shift, BIT(_mux_width) - 1, _mux_flags, \ 496 423 _div_shift, _div_width, _div_frac_width, _div_flags, \ 497 424 _regs, _clk_num, _enb_refcnt, _gate_flags, _clk_id,\ 498 - NULL) 425 + NULL, 0) 499 426 500 427 /** 501 428 * struct clk_super_mux - super clock ··· 582 509 #else 583 510 static inline void tegra30_clock_init(struct device_node *np) {} 584 511 #endif /* CONFIG_ARCH_TEGRA_3x_SOC */ 512 + 513 + #ifdef CONFIG_ARCH_TEGRA_114_SOC 514 + void tegra114_clock_init(struct device_node *np); 515 + #else 516 + static inline void tegra114_clock_init(struct device_node *np) {} 517 + #endif /* CONFIG_ARCH_TEGRA114_SOC */ 518 + 519 + typedef void (*tegra_clk_apply_init_table_func)(void); 520 + extern tegra_clk_apply_init_table_func tegra_clk_apply_init_table; 585 521 586 522 #endif /* TEGRA_CLK_H */
+8
drivers/clocksource/Kconfig
··· 31 31 config VT8500_TIMER 32 32 bool 33 33 34 + config CADENCE_TTC_TIMER 35 + bool 36 + 34 37 config CLKSRC_NOMADIK_MTU 35 38 bool 36 39 depends on (ARCH_NOMADIK || ARCH_U8500) ··· 70 67 def_bool y if METAG 71 68 help 72 69 This option enables support for the Meta per-thread timers. 70 + 71 + config CLKSRC_EXYNOS_MCT 72 + def_bool y if ARCH_EXYNOS 73 + help 74 + Support for Multi Core Timer controller on Exynos SoCs.
+2
drivers/clocksource/Makefile
··· 23 23 obj-$(CONFIG_ARCH_TEGRA) += tegra20_timer.o 24 24 obj-$(CONFIG_VT8500_TIMER) += vt8500_timer.o 25 25 obj-$(CONFIG_ARCH_BCM) += bcm_kona_timer.o 26 + obj-$(CONFIG_CADENCE_TTC_TIMER) += cadence_ttc_timer.o 27 + obj-$(CONFIG_CLKSRC_EXYNOS_MCT) += exynos_mct.o 26 28 27 29 obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o 28 30 obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o
+436
drivers/clocksource/cadence_ttc_timer.c
··· 1 + /* 2 + * This file contains driver for the Cadence Triple Timer Counter Rev 06 3 + * 4 + * Copyright (C) 2011-2013 Xilinx 5 + * 6 + * based on arch/mips/kernel/time.c timer driver 7 + * 8 + * This software is licensed under the terms of the GNU General Public 9 + * License version 2, as published by the Free Software Foundation, and 10 + * may be copied, distributed, and modified under those terms. 11 + * 12 + * This program is distributed in the hope that it will be useful, 13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + */ 17 + 18 + #include <linux/clk.h> 19 + #include <linux/interrupt.h> 20 + #include <linux/clockchips.h> 21 + #include <linux/of_address.h> 22 + #include <linux/of_irq.h> 23 + #include <linux/slab.h> 24 + #include <linux/clk-provider.h> 25 + 26 + /* 27 + * This driver configures the 2 16-bit count-up timers as follows: 28 + * 29 + * T1: Timer 1, clocksource for generic timekeeping 30 + * T2: Timer 2, clockevent source for hrtimers 31 + * T3: Timer 3, <unused> 32 + * 33 + * The input frequency to the timer module for emulation is 2.5MHz which is 34 + * common to all the timer channels (T1, T2, and T3). With a pre-scaler of 32, 35 + * the timers are clocked at 78.125KHz (12.8 us resolution). 36 + 37 + * The input frequency to the timer module in silicon is configurable and 38 + * obtained from device tree. The pre-scaler of 32 is used. 39 + */ 40 + 41 + /* 42 + * Timer Register Offset Definitions of Timer 1, Increment base address by 4 43 + * and use same offsets for Timer 2 44 + */ 45 + #define TTC_CLK_CNTRL_OFFSET 0x00 /* Clock Control Reg, RW */ 46 + #define TTC_CNT_CNTRL_OFFSET 0x0C /* Counter Control Reg, RW */ 47 + #define TTC_COUNT_VAL_OFFSET 0x18 /* Counter Value Reg, RO */ 48 + #define TTC_INTR_VAL_OFFSET 0x24 /* Interval Count Reg, RW */ 49 + #define TTC_ISR_OFFSET 0x54 /* Interrupt Status Reg, RO */ 50 + #define TTC_IER_OFFSET 0x60 /* Interrupt Enable Reg, RW */ 51 + 52 + #define TTC_CNT_CNTRL_DISABLE_MASK 0x1 53 + 54 + /* 55 + * Setup the timers to use pre-scaling, using a fixed value for now that will 56 + * work across most input frequency, but it may need to be more dynamic 57 + */ 58 + #define PRESCALE_EXPONENT 11 /* 2 ^ PRESCALE_EXPONENT = PRESCALE */ 59 + #define PRESCALE 2048 /* The exponent must match this */ 60 + #define CLK_CNTRL_PRESCALE ((PRESCALE_EXPONENT - 1) << 1) 61 + #define CLK_CNTRL_PRESCALE_EN 1 62 + #define CNT_CNTRL_RESET (1 << 4) 63 + 64 + /** 65 + * struct ttc_timer - This definition defines local timer structure 66 + * 67 + * @base_addr: Base address of timer 68 + * @clk: Associated clock source 69 + * @clk_rate_change_nb Notifier block for clock rate changes 70 + */ 71 + struct ttc_timer { 72 + void __iomem *base_addr; 73 + struct clk *clk; 74 + struct notifier_block clk_rate_change_nb; 75 + }; 76 + 77 + #define to_ttc_timer(x) \ 78 + container_of(x, struct ttc_timer, clk_rate_change_nb) 79 + 80 + struct ttc_timer_clocksource { 81 + struct ttc_timer ttc; 82 + struct clocksource cs; 83 + }; 84 + 85 + #define to_ttc_timer_clksrc(x) \ 86 + container_of(x, struct ttc_timer_clocksource, cs) 87 + 88 + struct ttc_timer_clockevent { 89 + struct ttc_timer ttc; 90 + struct clock_event_device ce; 91 + }; 92 + 93 + #define to_ttc_timer_clkevent(x) \ 94 + container_of(x, struct ttc_timer_clockevent, ce) 95 + 96 + /** 97 + * ttc_set_interval - Set the timer interval value 98 + * 99 + * @timer: Pointer to the timer instance 100 + * @cycles: Timer interval ticks 101 + **/ 102 + static void ttc_set_interval(struct ttc_timer *timer, 103 + unsigned long cycles) 104 + { 105 + u32 ctrl_reg; 106 + 107 + /* Disable the counter, set the counter value and re-enable counter */ 108 + ctrl_reg = __raw_readl(timer->base_addr + TTC_CNT_CNTRL_OFFSET); 109 + ctrl_reg |= TTC_CNT_CNTRL_DISABLE_MASK; 110 + __raw_writel(ctrl_reg, timer->base_addr + TTC_CNT_CNTRL_OFFSET); 111 + 112 + __raw_writel(cycles, timer->base_addr + TTC_INTR_VAL_OFFSET); 113 + 114 + /* 115 + * Reset the counter (0x10) so that it starts from 0, one-shot 116 + * mode makes this needed for timing to be right. 117 + */ 118 + ctrl_reg |= CNT_CNTRL_RESET; 119 + ctrl_reg &= ~TTC_CNT_CNTRL_DISABLE_MASK; 120 + __raw_writel(ctrl_reg, timer->base_addr + TTC_CNT_CNTRL_OFFSET); 121 + } 122 + 123 + /** 124 + * ttc_clock_event_interrupt - Clock event timer interrupt handler 125 + * 126 + * @irq: IRQ number of the Timer 127 + * @dev_id: void pointer to the ttc_timer instance 128 + * 129 + * returns: Always IRQ_HANDLED - success 130 + **/ 131 + static irqreturn_t ttc_clock_event_interrupt(int irq, void *dev_id) 132 + { 133 + struct ttc_timer_clockevent *ttce = dev_id; 134 + struct ttc_timer *timer = &ttce->ttc; 135 + 136 + /* Acknowledge the interrupt and call event handler */ 137 + __raw_readl(timer->base_addr + TTC_ISR_OFFSET); 138 + 139 + ttce->ce.event_handler(&ttce->ce); 140 + 141 + return IRQ_HANDLED; 142 + } 143 + 144 + /** 145 + * __ttc_clocksource_read - Reads the timer counter register 146 + * 147 + * returns: Current timer counter register value 148 + **/ 149 + static cycle_t __ttc_clocksource_read(struct clocksource *cs) 150 + { 151 + struct ttc_timer *timer = &to_ttc_timer_clksrc(cs)->ttc; 152 + 153 + return (cycle_t)__raw_readl(timer->base_addr + 154 + TTC_COUNT_VAL_OFFSET); 155 + } 156 + 157 + /** 158 + * ttc_set_next_event - Sets the time interval for next event 159 + * 160 + * @cycles: Timer interval ticks 161 + * @evt: Address of clock event instance 162 + * 163 + * returns: Always 0 - success 164 + **/ 165 + static int ttc_set_next_event(unsigned long cycles, 166 + struct clock_event_device *evt) 167 + { 168 + struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt); 169 + struct ttc_timer *timer = &ttce->ttc; 170 + 171 + ttc_set_interval(timer, cycles); 172 + return 0; 173 + } 174 + 175 + /** 176 + * ttc_set_mode - Sets the mode of timer 177 + * 178 + * @mode: Mode to be set 179 + * @evt: Address of clock event instance 180 + **/ 181 + static void ttc_set_mode(enum clock_event_mode mode, 182 + struct clock_event_device *evt) 183 + { 184 + struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt); 185 + struct ttc_timer *timer = &ttce->ttc; 186 + u32 ctrl_reg; 187 + 188 + switch (mode) { 189 + case CLOCK_EVT_MODE_PERIODIC: 190 + ttc_set_interval(timer, 191 + DIV_ROUND_CLOSEST(clk_get_rate(ttce->ttc.clk), 192 + PRESCALE * HZ)); 193 + break; 194 + case CLOCK_EVT_MODE_ONESHOT: 195 + case CLOCK_EVT_MODE_UNUSED: 196 + case CLOCK_EVT_MODE_SHUTDOWN: 197 + ctrl_reg = __raw_readl(timer->base_addr + 198 + TTC_CNT_CNTRL_OFFSET); 199 + ctrl_reg |= TTC_CNT_CNTRL_DISABLE_MASK; 200 + __raw_writel(ctrl_reg, 201 + timer->base_addr + TTC_CNT_CNTRL_OFFSET); 202 + break; 203 + case CLOCK_EVT_MODE_RESUME: 204 + ctrl_reg = __raw_readl(timer->base_addr + 205 + TTC_CNT_CNTRL_OFFSET); 206 + ctrl_reg &= ~TTC_CNT_CNTRL_DISABLE_MASK; 207 + __raw_writel(ctrl_reg, 208 + timer->base_addr + TTC_CNT_CNTRL_OFFSET); 209 + break; 210 + } 211 + } 212 + 213 + static int ttc_rate_change_clocksource_cb(struct notifier_block *nb, 214 + unsigned long event, void *data) 215 + { 216 + struct clk_notifier_data *ndata = data; 217 + struct ttc_timer *ttc = to_ttc_timer(nb); 218 + struct ttc_timer_clocksource *ttccs = container_of(ttc, 219 + struct ttc_timer_clocksource, ttc); 220 + 221 + switch (event) { 222 + case POST_RATE_CHANGE: 223 + /* 224 + * Do whatever is necessary to maintain a proper time base 225 + * 226 + * I cannot find a way to adjust the currently used clocksource 227 + * to the new frequency. __clocksource_updatefreq_hz() sounds 228 + * good, but does not work. Not sure what's that missing. 229 + * 230 + * This approach works, but triggers two clocksource switches. 231 + * The first after unregister to clocksource jiffies. And 232 + * another one after the register to the newly registered timer. 233 + * 234 + * Alternatively we could 'waste' another HW timer to ping pong 235 + * between clock sources. That would also use one register and 236 + * one unregister call, but only trigger one clocksource switch 237 + * for the cost of another HW timer used by the OS. 238 + */ 239 + clocksource_unregister(&ttccs->cs); 240 + clocksource_register_hz(&ttccs->cs, 241 + ndata->new_rate / PRESCALE); 242 + /* fall through */ 243 + case PRE_RATE_CHANGE: 244 + case ABORT_RATE_CHANGE: 245 + default: 246 + return NOTIFY_DONE; 247 + } 248 + } 249 + 250 + static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base) 251 + { 252 + struct ttc_timer_clocksource *ttccs; 253 + int err; 254 + 255 + ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL); 256 + if (WARN_ON(!ttccs)) 257 + return; 258 + 259 + ttccs->ttc.clk = clk; 260 + 261 + err = clk_prepare_enable(ttccs->ttc.clk); 262 + if (WARN_ON(err)) { 263 + kfree(ttccs); 264 + return; 265 + } 266 + 267 + ttccs->ttc.clk_rate_change_nb.notifier_call = 268 + ttc_rate_change_clocksource_cb; 269 + ttccs->ttc.clk_rate_change_nb.next = NULL; 270 + if (clk_notifier_register(ttccs->ttc.clk, 271 + &ttccs->ttc.clk_rate_change_nb)) 272 + pr_warn("Unable to register clock notifier.\n"); 273 + 274 + ttccs->ttc.base_addr = base; 275 + ttccs->cs.name = "ttc_clocksource"; 276 + ttccs->cs.rating = 200; 277 + ttccs->cs.read = __ttc_clocksource_read; 278 + ttccs->cs.mask = CLOCKSOURCE_MASK(16); 279 + ttccs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS; 280 + 281 + /* 282 + * Setup the clock source counter to be an incrementing counter 283 + * with no interrupt and it rolls over at 0xFFFF. Pre-scale 284 + * it by 32 also. Let it start running now. 285 + */ 286 + __raw_writel(0x0, ttccs->ttc.base_addr + TTC_IER_OFFSET); 287 + __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, 288 + ttccs->ttc.base_addr + TTC_CLK_CNTRL_OFFSET); 289 + __raw_writel(CNT_CNTRL_RESET, 290 + ttccs->ttc.base_addr + TTC_CNT_CNTRL_OFFSET); 291 + 292 + err = clocksource_register_hz(&ttccs->cs, 293 + clk_get_rate(ttccs->ttc.clk) / PRESCALE); 294 + if (WARN_ON(err)) { 295 + kfree(ttccs); 296 + return; 297 + } 298 + } 299 + 300 + static int ttc_rate_change_clockevent_cb(struct notifier_block *nb, 301 + unsigned long event, void *data) 302 + { 303 + struct clk_notifier_data *ndata = data; 304 + struct ttc_timer *ttc = to_ttc_timer(nb); 305 + struct ttc_timer_clockevent *ttcce = container_of(ttc, 306 + struct ttc_timer_clockevent, ttc); 307 + 308 + switch (event) { 309 + case POST_RATE_CHANGE: 310 + { 311 + unsigned long flags; 312 + 313 + /* 314 + * clockevents_update_freq should be called with IRQ disabled on 315 + * the CPU the timer provides events for. The timer we use is 316 + * common to both CPUs, not sure if we need to run on both 317 + * cores. 318 + */ 319 + local_irq_save(flags); 320 + clockevents_update_freq(&ttcce->ce, 321 + ndata->new_rate / PRESCALE); 322 + local_irq_restore(flags); 323 + 324 + /* fall through */ 325 + } 326 + case PRE_RATE_CHANGE: 327 + case ABORT_RATE_CHANGE: 328 + default: 329 + return NOTIFY_DONE; 330 + } 331 + } 332 + 333 + static void __init ttc_setup_clockevent(struct clk *clk, 334 + void __iomem *base, u32 irq) 335 + { 336 + struct ttc_timer_clockevent *ttcce; 337 + int err; 338 + 339 + ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL); 340 + if (WARN_ON(!ttcce)) 341 + return; 342 + 343 + ttcce->ttc.clk = clk; 344 + 345 + err = clk_prepare_enable(ttcce->ttc.clk); 346 + if (WARN_ON(err)) { 347 + kfree(ttcce); 348 + return; 349 + } 350 + 351 + ttcce->ttc.clk_rate_change_nb.notifier_call = 352 + ttc_rate_change_clockevent_cb; 353 + ttcce->ttc.clk_rate_change_nb.next = NULL; 354 + if (clk_notifier_register(ttcce->ttc.clk, 355 + &ttcce->ttc.clk_rate_change_nb)) 356 + pr_warn("Unable to register clock notifier.\n"); 357 + 358 + ttcce->ttc.base_addr = base; 359 + ttcce->ce.name = "ttc_clockevent"; 360 + ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; 361 + ttcce->ce.set_next_event = ttc_set_next_event; 362 + ttcce->ce.set_mode = ttc_set_mode; 363 + ttcce->ce.rating = 200; 364 + ttcce->ce.irq = irq; 365 + ttcce->ce.cpumask = cpu_possible_mask; 366 + 367 + /* 368 + * Setup the clock event timer to be an interval timer which 369 + * is prescaled by 32 using the interval interrupt. Leave it 370 + * disabled for now. 371 + */ 372 + __raw_writel(0x23, ttcce->ttc.base_addr + TTC_CNT_CNTRL_OFFSET); 373 + __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, 374 + ttcce->ttc.base_addr + TTC_CLK_CNTRL_OFFSET); 375 + __raw_writel(0x1, ttcce->ttc.base_addr + TTC_IER_OFFSET); 376 + 377 + err = request_irq(irq, ttc_clock_event_interrupt, 378 + IRQF_DISABLED | IRQF_TIMER, 379 + ttcce->ce.name, ttcce); 380 + if (WARN_ON(err)) { 381 + kfree(ttcce); 382 + return; 383 + } 384 + 385 + clockevents_config_and_register(&ttcce->ce, 386 + clk_get_rate(ttcce->ttc.clk) / PRESCALE, 1, 0xfffe); 387 + } 388 + 389 + /** 390 + * ttc_timer_init - Initialize the timer 391 + * 392 + * Initializes the timer hardware and register the clock source and clock event 393 + * timers with Linux kernal timer framework 394 + */ 395 + static void __init ttc_timer_init(struct device_node *timer) 396 + { 397 + unsigned int irq; 398 + void __iomem *timer_baseaddr; 399 + struct clk *clk; 400 + static int initialized; 401 + 402 + if (initialized) 403 + return; 404 + 405 + initialized = 1; 406 + 407 + /* 408 + * Get the 1st Triple Timer Counter (TTC) block from the device tree 409 + * and use it. Note that the event timer uses the interrupt and it's the 410 + * 2nd TTC hence the irq_of_parse_and_map(,1) 411 + */ 412 + timer_baseaddr = of_iomap(timer, 0); 413 + if (!timer_baseaddr) { 414 + pr_err("ERROR: invalid timer base address\n"); 415 + BUG(); 416 + } 417 + 418 + irq = irq_of_parse_and_map(timer, 1); 419 + if (irq <= 0) { 420 + pr_err("ERROR: invalid interrupt number\n"); 421 + BUG(); 422 + } 423 + 424 + clk = of_clk_get_by_name(timer, "cpu_1x"); 425 + if (IS_ERR(clk)) { 426 + pr_err("ERROR: timer input clock not found\n"); 427 + BUG(); 428 + } 429 + 430 + ttc_setup_clocksource(clk, timer_baseaddr); 431 + ttc_setup_clockevent(clk, timer_baseaddr + 4, irq); 432 + 433 + pr_info("%s #0 at %p, irq=%d\n", timer->name, timer_baseaddr, irq); 434 + } 435 + 436 + CLOCKSOURCE_OF_DECLARE(ttc, "cdns,ttc", ttc_timer_init);
+12 -1
drivers/clocksource/em_sti.c
··· 399 399 } 400 400 }; 401 401 402 - module_platform_driver(em_sti_device_driver); 402 + static int __init em_sti_init(void) 403 + { 404 + return platform_driver_register(&em_sti_device_driver); 405 + } 406 + 407 + static void __exit em_sti_exit(void) 408 + { 409 + platform_driver_unregister(&em_sti_device_driver); 410 + } 411 + 412 + subsys_initcall(em_sti_init); 413 + module_exit(em_sti_exit); 403 414 404 415 MODULE_AUTHOR("Magnus Damm"); 405 416 MODULE_DESCRIPTION("Renesas Emma Mobile STI Timer Driver");
+116 -69
drivers/clocksource/sh_cmt.c
··· 54 54 struct clocksource cs; 55 55 unsigned long total_cycles; 56 56 bool cs_enabled; 57 + 58 + /* callbacks for CMSTR and CMCSR access */ 59 + unsigned long (*read_control)(void __iomem *base, unsigned long offs); 60 + void (*write_control)(void __iomem *base, unsigned long offs, 61 + unsigned long value); 62 + 63 + /* callbacks for CMCNT and CMCOR access */ 64 + unsigned long (*read_count)(void __iomem *base, unsigned long offs); 65 + void (*write_count)(void __iomem *base, unsigned long offs, 66 + unsigned long value); 57 67 }; 58 68 59 - static DEFINE_RAW_SPINLOCK(sh_cmt_lock); 69 + /* Examples of supported CMT timer register layouts and I/O access widths: 70 + * 71 + * "16-bit counter and 16-bit control" as found on sh7263: 72 + * CMSTR 0xfffec000 16-bit 73 + * CMCSR 0xfffec002 16-bit 74 + * CMCNT 0xfffec004 16-bit 75 + * CMCOR 0xfffec006 16-bit 76 + * 77 + * "32-bit counter and 16-bit control" as found on sh7372, sh73a0, r8a7740: 78 + * CMSTR 0xffca0000 16-bit 79 + * CMCSR 0xffca0060 16-bit 80 + * CMCNT 0xffca0064 32-bit 81 + * CMCOR 0xffca0068 32-bit 82 + */ 60 83 61 - #define CMSTR -1 /* shared register */ 84 + static unsigned long sh_cmt_read16(void __iomem *base, unsigned long offs) 85 + { 86 + return ioread16(base + (offs << 1)); 87 + } 88 + 89 + static unsigned long sh_cmt_read32(void __iomem *base, unsigned long offs) 90 + { 91 + return ioread32(base + (offs << 2)); 92 + } 93 + 94 + static void sh_cmt_write16(void __iomem *base, unsigned long offs, 95 + unsigned long value) 96 + { 97 + iowrite16(value, base + (offs << 1)); 98 + } 99 + 100 + static void sh_cmt_write32(void __iomem *base, unsigned long offs, 101 + unsigned long value) 102 + { 103 + iowrite32(value, base + (offs << 2)); 104 + } 105 + 62 106 #define CMCSR 0 /* channel register */ 63 107 #define CMCNT 1 /* channel register */ 64 108 #define CMCOR 2 /* channel register */ 65 109 66 - static inline unsigned long sh_cmt_read(struct sh_cmt_priv *p, int reg_nr) 110 + static inline unsigned long sh_cmt_read_cmstr(struct sh_cmt_priv *p) 67 111 { 68 112 struct sh_timer_config *cfg = p->pdev->dev.platform_data; 69 - void __iomem *base = p->mapbase; 70 - unsigned long offs; 71 113 72 - if (reg_nr == CMSTR) { 73 - offs = 0; 74 - base -= cfg->channel_offset; 75 - } else 76 - offs = reg_nr; 77 - 78 - if (p->width == 16) 79 - offs <<= 1; 80 - else { 81 - offs <<= 2; 82 - if ((reg_nr == CMCNT) || (reg_nr == CMCOR)) 83 - return ioread32(base + offs); 84 - } 85 - 86 - return ioread16(base + offs); 114 + return p->read_control(p->mapbase - cfg->channel_offset, 0); 87 115 } 88 116 89 - static inline void sh_cmt_write(struct sh_cmt_priv *p, int reg_nr, 90 - unsigned long value) 117 + static inline unsigned long sh_cmt_read_cmcsr(struct sh_cmt_priv *p) 118 + { 119 + return p->read_control(p->mapbase, CMCSR); 120 + } 121 + 122 + static inline unsigned long sh_cmt_read_cmcnt(struct sh_cmt_priv *p) 123 + { 124 + return p->read_count(p->mapbase, CMCNT); 125 + } 126 + 127 + static inline void sh_cmt_write_cmstr(struct sh_cmt_priv *p, 128 + unsigned long value) 91 129 { 92 130 struct sh_timer_config *cfg = p->pdev->dev.platform_data; 93 - void __iomem *base = p->mapbase; 94 - unsigned long offs; 95 131 96 - if (reg_nr == CMSTR) { 97 - offs = 0; 98 - base -= cfg->channel_offset; 99 - } else 100 - offs = reg_nr; 132 + p->write_control(p->mapbase - cfg->channel_offset, 0, value); 133 + } 101 134 102 - if (p->width == 16) 103 - offs <<= 1; 104 - else { 105 - offs <<= 2; 106 - if ((reg_nr == CMCNT) || (reg_nr == CMCOR)) { 107 - iowrite32(value, base + offs); 108 - return; 109 - } 110 - } 135 + static inline void sh_cmt_write_cmcsr(struct sh_cmt_priv *p, 136 + unsigned long value) 137 + { 138 + p->write_control(p->mapbase, CMCSR, value); 139 + } 111 140 112 - iowrite16(value, base + offs); 141 + static inline void sh_cmt_write_cmcnt(struct sh_cmt_priv *p, 142 + unsigned long value) 143 + { 144 + p->write_count(p->mapbase, CMCNT, value); 145 + } 146 + 147 + static inline void sh_cmt_write_cmcor(struct sh_cmt_priv *p, 148 + unsigned long value) 149 + { 150 + p->write_count(p->mapbase, CMCOR, value); 113 151 } 114 152 115 153 static unsigned long sh_cmt_get_counter(struct sh_cmt_priv *p, ··· 156 118 unsigned long v1, v2, v3; 157 119 int o1, o2; 158 120 159 - o1 = sh_cmt_read(p, CMCSR) & p->overflow_bit; 121 + o1 = sh_cmt_read_cmcsr(p) & p->overflow_bit; 160 122 161 123 /* Make sure the timer value is stable. Stolen from acpi_pm.c */ 162 124 do { 163 125 o2 = o1; 164 - v1 = sh_cmt_read(p, CMCNT); 165 - v2 = sh_cmt_read(p, CMCNT); 166 - v3 = sh_cmt_read(p, CMCNT); 167 - o1 = sh_cmt_read(p, CMCSR) & p->overflow_bit; 126 + v1 = sh_cmt_read_cmcnt(p); 127 + v2 = sh_cmt_read_cmcnt(p); 128 + v3 = sh_cmt_read_cmcnt(p); 129 + o1 = sh_cmt_read_cmcsr(p) & p->overflow_bit; 168 130 } while (unlikely((o1 != o2) || (v1 > v2 && v1 < v3) 169 131 || (v2 > v3 && v2 < v1) || (v3 > v1 && v3 < v2))); 170 132 ··· 172 134 return v2; 173 135 } 174 136 137 + static DEFINE_RAW_SPINLOCK(sh_cmt_lock); 175 138 176 139 static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) 177 140 { ··· 181 142 182 143 /* start stop register shared by multiple timer channels */ 183 144 raw_spin_lock_irqsave(&sh_cmt_lock, flags); 184 - value = sh_cmt_read(p, CMSTR); 145 + value = sh_cmt_read_cmstr(p); 185 146 186 147 if (start) 187 148 value |= 1 << cfg->timer_bit; 188 149 else 189 150 value &= ~(1 << cfg->timer_bit); 190 151 191 - sh_cmt_write(p, CMSTR, value); 152 + sh_cmt_write_cmstr(p, value); 192 153 raw_spin_unlock_irqrestore(&sh_cmt_lock, flags); 193 154 } 194 155 ··· 212 173 /* configure channel, periodic mode and maximum timeout */ 213 174 if (p->width == 16) { 214 175 *rate = clk_get_rate(p->clk) / 512; 215 - sh_cmt_write(p, CMCSR, 0x43); 176 + sh_cmt_write_cmcsr(p, 0x43); 216 177 } else { 217 178 *rate = clk_get_rate(p->clk) / 8; 218 - sh_cmt_write(p, CMCSR, 0x01a4); 179 + sh_cmt_write_cmcsr(p, 0x01a4); 219 180 } 220 181 221 - sh_cmt_write(p, CMCOR, 0xffffffff); 222 - sh_cmt_write(p, CMCNT, 0); 182 + sh_cmt_write_cmcor(p, 0xffffffff); 183 + sh_cmt_write_cmcnt(p, 0); 223 184 224 185 /* 225 186 * According to the sh73a0 user's manual, as CMCNT can be operated ··· 233 194 * take RCLKx2 at maximum. 234 195 */ 235 196 for (k = 0; k < 100; k++) { 236 - if (!sh_cmt_read(p, CMCNT)) 197 + if (!sh_cmt_read_cmcnt(p)) 237 198 break; 238 199 udelay(1); 239 200 } 240 201 241 - if (sh_cmt_read(p, CMCNT)) { 202 + if (sh_cmt_read_cmcnt(p)) { 242 203 dev_err(&p->pdev->dev, "cannot clear CMCNT\n"); 243 204 ret = -ETIMEDOUT; 244 205 goto err1; ··· 261 222 sh_cmt_start_stop_ch(p, 0); 262 223 263 224 /* disable interrupts in CMT block */ 264 - sh_cmt_write(p, CMCSR, 0); 225 + sh_cmt_write_cmcsr(p, 0); 265 226 266 227 /* stop clock */ 267 228 clk_disable(p->clk); ··· 309 270 if (new_match > p->max_match_value) 310 271 new_match = p->max_match_value; 311 272 312 - sh_cmt_write(p, CMCOR, new_match); 273 + sh_cmt_write_cmcor(p, new_match); 313 274 314 275 now = sh_cmt_get_counter(p, &has_wrapped); 315 276 if (has_wrapped && (new_match > p->match_value)) { ··· 385 346 struct sh_cmt_priv *p = dev_id; 386 347 387 348 /* clear flags */ 388 - sh_cmt_write(p, CMCSR, sh_cmt_read(p, CMCSR) & p->clear_bits); 349 + sh_cmt_write_cmcsr(p, sh_cmt_read_cmcsr(p) & p->clear_bits); 389 350 390 351 /* update clock source counter to begin with if enabled 391 352 * the wrap flag should be cleared by the timer specific ··· 664 625 unsigned long clockevent_rating, 665 626 unsigned long clocksource_rating) 666 627 { 667 - if (p->width == (sizeof(p->max_match_value) * 8)) 668 - p->max_match_value = ~0; 669 - else 670 - p->max_match_value = (1 << p->width) - 1; 671 - 672 - p->match_value = p->max_match_value; 673 - raw_spin_lock_init(&p->lock); 674 - 675 628 if (clockevent_rating) 676 629 sh_cmt_register_clockevent(p, name, clockevent_rating); 677 630 ··· 687 656 dev_err(&p->pdev->dev, "missing platform data\n"); 688 657 goto err0; 689 658 } 690 - 691 - platform_set_drvdata(pdev, p); 692 659 693 660 res = platform_get_resource(p->pdev, IORESOURCE_MEM, 0); 694 661 if (!res) { ··· 722 693 goto err1; 723 694 } 724 695 696 + p->read_control = sh_cmt_read16; 697 + p->write_control = sh_cmt_write16; 698 + 725 699 if (resource_size(res) == 6) { 726 700 p->width = 16; 701 + p->read_count = sh_cmt_read16; 702 + p->write_count = sh_cmt_write16; 727 703 p->overflow_bit = 0x80; 728 704 p->clear_bits = ~0x80; 729 705 } else { 730 706 p->width = 32; 707 + p->read_count = sh_cmt_read32; 708 + p->write_count = sh_cmt_write32; 731 709 p->overflow_bit = 0x8000; 732 710 p->clear_bits = ~0xc000; 733 711 } 712 + 713 + if (p->width == (sizeof(p->max_match_value) * 8)) 714 + p->max_match_value = ~0; 715 + else 716 + p->max_match_value = (1 << p->width) - 1; 717 + 718 + p->match_value = p->max_match_value; 719 + raw_spin_lock_init(&p->lock); 734 720 735 721 ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev), 736 722 cfg->clockevent_rating, 737 723 cfg->clocksource_rating); 738 724 if (ret) { 739 725 dev_err(&p->pdev->dev, "registration failed\n"); 740 - goto err1; 726 + goto err2; 741 727 } 742 728 p->cs_enabled = false; 743 729 744 730 ret = setup_irq(irq, &p->irqaction); 745 731 if (ret) { 746 732 dev_err(&p->pdev->dev, "failed to request irq %d\n", irq); 747 - goto err1; 733 + goto err2; 748 734 } 749 735 736 + platform_set_drvdata(pdev, p); 737 + 750 738 return 0; 739 + err2: 740 + clk_put(p->clk); 751 741 752 742 err1: 753 743 iounmap(p->mapbase); ··· 799 751 ret = sh_cmt_setup(p, pdev); 800 752 if (ret) { 801 753 kfree(p); 802 - platform_set_drvdata(pdev, NULL); 803 754 pm_runtime_idle(&pdev->dev); 804 755 return ret; 805 756 } ··· 838 791 } 839 792 840 793 early_platform_init("earlytimer", &sh_cmt_device_driver); 841 - module_init(sh_cmt_init); 794 + subsys_initcall(sh_cmt_init); 842 795 module_exit(sh_cmt_exit); 843 796 844 797 MODULE_AUTHOR("Magnus Damm");
+1 -1
drivers/clocksource/sh_mtu2.c
··· 386 386 } 387 387 388 388 early_platform_init("earlytimer", &sh_mtu2_device_driver); 389 - module_init(sh_mtu2_init); 389 + subsys_initcall(sh_mtu2_init); 390 390 module_exit(sh_mtu2_exit); 391 391 392 392 MODULE_AUTHOR("Magnus Damm");
+1 -1
drivers/clocksource/sh_tmu.c
··· 549 549 } 550 550 551 551 early_platform_init("earlytimer", &sh_tmu_device_driver); 552 - module_init(sh_tmu_init); 552 + subsys_initcall(sh_tmu_init); 553 553 module_exit(sh_tmu_exit); 554 554 555 555 MODULE_AUTHOR("Magnus Damm");
-6
drivers/gpio/Kconfig
··· 227 227 blocks of the TS-5500: DIO1, DIO2 and the LCD port, and the TS-5600 228 228 LCD port. 229 229 230 - config GPIO_VT8500 231 - bool "VIA/Wondermedia SoC GPIO Support" 232 - depends on ARCH_VT8500 233 - help 234 - Say yes here to support the VT8500/WM8505/WM8650 GPIO controller. 235 - 236 230 config GPIO_XILINX 237 231 bool "Xilinx GPIO support" 238 232 depends on PPC_OF || MICROBLAZE
-1
drivers/gpio/Makefile
··· 80 80 obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o 81 81 obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o 82 82 obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o 83 - obj-$(CONFIG_GPIO_VT8500) += gpio-vt8500.o 84 83 obj-$(CONFIG_GPIO_VX855) += gpio-vx855.o 85 84 obj-$(CONFIG_GPIO_WM831X) += gpio-wm831x.o 86 85 obj-$(CONFIG_GPIO_WM8350) += gpio-wm8350.o
+7 -2
drivers/gpio/gpio-samsung.c
··· 1122 1122 #ifdef CONFIG_PLAT_S3C24XX 1123 1123 static int s3c24xx_gpiolib_fbank_to_irq(struct gpio_chip *chip, unsigned offset) 1124 1124 { 1125 - if (offset < 4) 1126 - return IRQ_EINT0 + offset; 1125 + if (offset < 4) { 1126 + if (soc_is_s3c2412()) 1127 + return IRQ_EINT0_2412 + offset; 1128 + else 1129 + return IRQ_EINT0 + offset; 1130 + } 1127 1131 1128 1132 if (offset < 8) 1129 1133 return IRQ_EINT4 + offset - 4; ··· 3028 3024 static const struct of_device_id exynos_pinctrl_ids[] = { 3029 3025 { .compatible = "samsung,exynos4210-pinctrl", }, 3030 3026 { .compatible = "samsung,exynos4x12-pinctrl", }, 3027 + { .compatible = "samsung,exynos5250-pinctrl", }, 3031 3028 { .compatible = "samsung,exynos5440-pinctrl", }, 3032 3029 }; 3033 3030 for_each_matching_node(pctrl_np, exynos_pinctrl_ids)
-355
drivers/gpio/gpio-vt8500.c
··· 1 - /* drivers/gpio/gpio-vt8500.c 2 - * 3 - * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> 4 - * Based on arch/arm/mach-vt8500/gpio.c: 5 - * - Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> 6 - * 7 - * This software is licensed under the terms of the GNU General Public 8 - * License version 2, as published by the Free Software Foundation, and 9 - * may be copied, distributed, and modified under those terms. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - */ 17 - 18 - #include <linux/module.h> 19 - #include <linux/err.h> 20 - #include <linux/io.h> 21 - #include <linux/gpio.h> 22 - #include <linux/platform_device.h> 23 - #include <linux/bitops.h> 24 - #include <linux/of.h> 25 - #include <linux/of_address.h> 26 - #include <linux/of_irq.h> 27 - #include <linux/of_device.h> 28 - 29 - /* 30 - We handle GPIOs by bank, each bank containing up to 32 GPIOs covered 31 - by one set of registers (although not all may be valid). 32 - 33 - Because different SoC's have different register offsets, we pass the 34 - register offsets as data in vt8500_gpio_dt_ids[]. 35 - 36 - A value of NO_REG is used to indicate that this register is not 37 - supported. Only used for ->en at the moment. 38 - */ 39 - 40 - #define NO_REG 0xFFFF 41 - 42 - /* 43 - * struct vt8500_gpio_bank_regoffsets 44 - * @en: offset to enable register of the bank 45 - * @dir: offset to direction register of the bank 46 - * @data_out: offset to the data out register of the bank 47 - * @data_in: offset to the data in register of the bank 48 - * @ngpio: highest valid pin in this bank 49 - */ 50 - 51 - struct vt8500_gpio_bank_regoffsets { 52 - unsigned int en; 53 - unsigned int dir; 54 - unsigned int data_out; 55 - unsigned int data_in; 56 - unsigned char ngpio; 57 - }; 58 - 59 - struct vt8500_gpio_data { 60 - unsigned int num_banks; 61 - struct vt8500_gpio_bank_regoffsets banks[]; 62 - }; 63 - 64 - #define VT8500_BANK(__en, __dir, __out, __in, __ngpio) \ 65 - { \ 66 - .en = __en, \ 67 - .dir = __dir, \ 68 - .data_out = __out, \ 69 - .data_in = __in, \ 70 - .ngpio = __ngpio, \ 71 - } 72 - 73 - static struct vt8500_gpio_data vt8500_data = { 74 - .num_banks = 7, 75 - .banks = { 76 - VT8500_BANK(NO_REG, 0x3C, 0x5C, 0x7C, 9), 77 - VT8500_BANK(0x00, 0x20, 0x40, 0x60, 26), 78 - VT8500_BANK(0x04, 0x24, 0x44, 0x64, 28), 79 - VT8500_BANK(0x08, 0x28, 0x48, 0x68, 31), 80 - VT8500_BANK(0x0C, 0x2C, 0x4C, 0x6C, 19), 81 - VT8500_BANK(0x10, 0x30, 0x50, 0x70, 19), 82 - VT8500_BANK(0x14, 0x34, 0x54, 0x74, 23), 83 - }, 84 - }; 85 - 86 - static struct vt8500_gpio_data wm8505_data = { 87 - .num_banks = 10, 88 - .banks = { 89 - VT8500_BANK(0x64, 0x8C, 0xB4, 0xDC, 22), 90 - VT8500_BANK(0x40, 0x68, 0x90, 0xB8, 8), 91 - VT8500_BANK(0x44, 0x6C, 0x94, 0xBC, 32), 92 - VT8500_BANK(0x48, 0x70, 0x98, 0xC0, 6), 93 - VT8500_BANK(0x4C, 0x74, 0x9C, 0xC4, 16), 94 - VT8500_BANK(0x50, 0x78, 0xA0, 0xC8, 25), 95 - VT8500_BANK(0x54, 0x7C, 0xA4, 0xCC, 5), 96 - VT8500_BANK(0x58, 0x80, 0xA8, 0xD0, 5), 97 - VT8500_BANK(0x5C, 0x84, 0xAC, 0xD4, 12), 98 - VT8500_BANK(0x60, 0x88, 0xB0, 0xD8, 16), 99 - VT8500_BANK(0x500, 0x504, 0x508, 0x50C, 6), 100 - }, 101 - }; 102 - 103 - /* 104 - * No information about which bits are valid so we just make 105 - * them all available until its figured out. 106 - */ 107 - static struct vt8500_gpio_data wm8650_data = { 108 - .num_banks = 9, 109 - .banks = { 110 - VT8500_BANK(0x40, 0x80, 0xC0, 0x00, 32), 111 - VT8500_BANK(0x44, 0x84, 0xC4, 0x04, 32), 112 - VT8500_BANK(0x48, 0x88, 0xC8, 0x08, 32), 113 - VT8500_BANK(0x4C, 0x8C, 0xCC, 0x0C, 32), 114 - VT8500_BANK(0x50, 0x90, 0xD0, 0x10, 32), 115 - VT8500_BANK(0x54, 0x94, 0xD4, 0x14, 32), 116 - VT8500_BANK(0x58, 0x98, 0xD8, 0x18, 32), 117 - VT8500_BANK(0x5C, 0x9C, 0xDC, 0x1C, 32), 118 - VT8500_BANK(0x7C, 0xBC, 0xFC, 0x3C, 32), 119 - VT8500_BANK(0x500, 0x504, 0x508, 0x50C, 6), 120 - }, 121 - }; 122 - 123 - struct vt8500_gpio_chip { 124 - struct gpio_chip chip; 125 - 126 - const struct vt8500_gpio_bank_regoffsets *regs; 127 - void __iomem *base; 128 - }; 129 - 130 - struct vt8500_data { 131 - struct vt8500_gpio_chip *chip; 132 - void __iomem *iobase; 133 - int num_banks; 134 - }; 135 - 136 - 137 - #define to_vt8500(__chip) container_of(__chip, struct vt8500_gpio_chip, chip) 138 - 139 - static int vt8500_gpio_request(struct gpio_chip *chip, unsigned offset) 140 - { 141 - u32 val; 142 - struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); 143 - 144 - if (vt8500_chip->regs->en == NO_REG) 145 - return 0; 146 - 147 - val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->en); 148 - val |= BIT(offset); 149 - writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->en); 150 - 151 - return 0; 152 - } 153 - 154 - static void vt8500_gpio_free(struct gpio_chip *chip, unsigned offset) 155 - { 156 - struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); 157 - u32 val; 158 - 159 - if (vt8500_chip->regs->en == NO_REG) 160 - return; 161 - 162 - val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->en); 163 - val &= ~BIT(offset); 164 - writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->en); 165 - } 166 - 167 - static int vt8500_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 168 - { 169 - struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); 170 - 171 - u32 val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->dir); 172 - val &= ~BIT(offset); 173 - writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->dir); 174 - 175 - return 0; 176 - } 177 - 178 - static int vt8500_gpio_direction_output(struct gpio_chip *chip, unsigned offset, 179 - int value) 180 - { 181 - struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); 182 - 183 - u32 val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->dir); 184 - val |= BIT(offset); 185 - writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->dir); 186 - 187 - if (value) { 188 - val = readl_relaxed(vt8500_chip->base + 189 - vt8500_chip->regs->data_out); 190 - val |= BIT(offset); 191 - writel_relaxed(val, vt8500_chip->base + 192 - vt8500_chip->regs->data_out); 193 - } 194 - return 0; 195 - } 196 - 197 - static int vt8500_gpio_get_value(struct gpio_chip *chip, unsigned offset) 198 - { 199 - struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); 200 - 201 - return (readl_relaxed(vt8500_chip->base + vt8500_chip->regs->data_in) >> 202 - offset) & 1; 203 - } 204 - 205 - static void vt8500_gpio_set_value(struct gpio_chip *chip, unsigned offset, 206 - int value) 207 - { 208 - struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); 209 - 210 - u32 val = readl_relaxed(vt8500_chip->base + 211 - vt8500_chip->regs->data_out); 212 - if (value) 213 - val |= BIT(offset); 214 - else 215 - val &= ~BIT(offset); 216 - 217 - writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->data_out); 218 - } 219 - 220 - static int vt8500_of_xlate(struct gpio_chip *gc, 221 - const struct of_phandle_args *gpiospec, u32 *flags) 222 - { 223 - /* bank if specificed in gpiospec->args[0] */ 224 - if (flags) 225 - *flags = gpiospec->args[2]; 226 - 227 - return gpiospec->args[1]; 228 - } 229 - 230 - static int vt8500_add_chips(struct platform_device *pdev, void __iomem *base, 231 - const struct vt8500_gpio_data *data) 232 - { 233 - struct vt8500_data *priv; 234 - struct vt8500_gpio_chip *vtchip; 235 - struct gpio_chip *chip; 236 - int i; 237 - int pin_cnt = 0; 238 - 239 - priv = devm_kzalloc(&pdev->dev, sizeof(struct vt8500_data), GFP_KERNEL); 240 - if (!priv) { 241 - dev_err(&pdev->dev, "failed to allocate memory\n"); 242 - return -ENOMEM; 243 - } 244 - 245 - priv->chip = devm_kzalloc(&pdev->dev, 246 - sizeof(struct vt8500_gpio_chip) * data->num_banks, 247 - GFP_KERNEL); 248 - if (!priv->chip) { 249 - dev_err(&pdev->dev, "failed to allocate chip memory\n"); 250 - return -ENOMEM; 251 - } 252 - 253 - priv->iobase = base; 254 - priv->num_banks = data->num_banks; 255 - platform_set_drvdata(pdev, priv); 256 - 257 - vtchip = priv->chip; 258 - 259 - for (i = 0; i < data->num_banks; i++) { 260 - vtchip[i].base = base; 261 - vtchip[i].regs = &data->banks[i]; 262 - 263 - chip = &vtchip[i].chip; 264 - 265 - chip->of_xlate = vt8500_of_xlate; 266 - chip->of_gpio_n_cells = 3; 267 - chip->of_node = pdev->dev.of_node; 268 - 269 - chip->request = vt8500_gpio_request; 270 - chip->free = vt8500_gpio_free; 271 - chip->direction_input = vt8500_gpio_direction_input; 272 - chip->direction_output = vt8500_gpio_direction_output; 273 - chip->get = vt8500_gpio_get_value; 274 - chip->set = vt8500_gpio_set_value; 275 - chip->can_sleep = 0; 276 - chip->base = pin_cnt; 277 - chip->ngpio = data->banks[i].ngpio; 278 - 279 - pin_cnt += data->banks[i].ngpio; 280 - 281 - gpiochip_add(chip); 282 - } 283 - return 0; 284 - } 285 - 286 - static struct of_device_id vt8500_gpio_dt_ids[] = { 287 - { .compatible = "via,vt8500-gpio", .data = &vt8500_data, }, 288 - { .compatible = "wm,wm8505-gpio", .data = &wm8505_data, }, 289 - { .compatible = "wm,wm8650-gpio", .data = &wm8650_data, }, 290 - { /* Sentinel */ }, 291 - }; 292 - 293 - static int vt8500_gpio_probe(struct platform_device *pdev) 294 - { 295 - int ret; 296 - void __iomem *gpio_base; 297 - struct resource *res; 298 - const struct of_device_id *of_id = 299 - of_match_device(vt8500_gpio_dt_ids, &pdev->dev); 300 - 301 - if (!of_id) { 302 - dev_err(&pdev->dev, "No matching driver data\n"); 303 - return -ENODEV; 304 - } 305 - 306 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 307 - if (!res) { 308 - dev_err(&pdev->dev, "Unable to get IO resource\n"); 309 - return -ENODEV; 310 - } 311 - 312 - gpio_base = devm_request_and_ioremap(&pdev->dev, res); 313 - if (!gpio_base) { 314 - dev_err(&pdev->dev, "Unable to map GPIO registers\n"); 315 - return -ENOMEM; 316 - } 317 - 318 - ret = vt8500_add_chips(pdev, gpio_base, of_id->data); 319 - 320 - return ret; 321 - } 322 - 323 - static int vt8500_gpio_remove(struct platform_device *pdev) 324 - { 325 - int i; 326 - int ret; 327 - struct vt8500_data *priv = platform_get_drvdata(pdev); 328 - struct vt8500_gpio_chip *vtchip = priv->chip; 329 - 330 - for (i = 0; i < priv->num_banks; i++) { 331 - ret = gpiochip_remove(&vtchip[i].chip); 332 - if (ret) 333 - dev_warn(&pdev->dev, "gpiochip_remove returned %d\n", 334 - ret); 335 - } 336 - 337 - return 0; 338 - } 339 - 340 - static struct platform_driver vt8500_gpio_driver = { 341 - .probe = vt8500_gpio_probe, 342 - .remove = vt8500_gpio_remove, 343 - .driver = { 344 - .name = "vt8500-gpio", 345 - .owner = THIS_MODULE, 346 - .of_match_table = vt8500_gpio_dt_ids, 347 - }, 348 - }; 349 - 350 - module_platform_driver(vt8500_gpio_driver); 351 - 352 - MODULE_DESCRIPTION("VT8500 GPIO Driver"); 353 - MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); 354 - MODULE_LICENSE("GPL v2"); 355 - MODULE_DEVICE_TABLE(of, vt8500_gpio_dt_ids);
+8
drivers/irqchip/Kconfig
··· 25 25 The maximum number of VICs available in the system, for 26 26 power management. 27 27 28 + config RENESAS_INTC_IRQPIN 29 + bool 30 + select IRQ_DOMAIN 31 + 32 + config RENESAS_IRQC 33 + bool 34 + select IRQ_DOMAIN 35 + 28 36 config VERSATILE_FPGA_IRQ 29 37 bool 30 38 select IRQ_DOMAIN
+4
drivers/irqchip/Makefile
··· 3 3 obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o 4 4 obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o 5 5 obj-$(CONFIG_ARCH_MXS) += irq-mxs.o 6 + obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o 6 7 obj-$(CONFIG_METAG) += irq-metag-ext.o 7 8 obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o 8 9 obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o ··· 11 10 obj-$(CONFIG_ARM_GIC) += irq-gic.o 12 11 obj-$(CONFIG_ARM_VIC) += irq-vic.o 13 12 obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o 13 + obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o 14 + obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o 14 15 obj-$(CONFIG_VERSATILE_FPGA_IRQ) += irq-versatile-fpga.o 16 + obj-$(CONFIG_ARCH_VT8500) += irq-vt8500.o
+62 -18
drivers/irqchip/exynos-combiner.c
··· 32 32 unsigned int irq_offset; 33 33 unsigned int irq_mask; 34 34 void __iomem *base; 35 + unsigned int parent_irq; 35 36 }; 36 37 37 38 static struct irq_domain *combiner_irq_domain; ··· 89 88 chained_irq_exit(chip, desc); 90 89 } 91 90 91 + #ifdef CONFIG_SMP 92 + static int combiner_set_affinity(struct irq_data *d, 93 + const struct cpumask *mask_val, bool force) 94 + { 95 + struct combiner_chip_data *chip_data = irq_data_get_irq_chip_data(d); 96 + struct irq_chip *chip = irq_get_chip(chip_data->parent_irq); 97 + struct irq_data *data = irq_get_irq_data(chip_data->parent_irq); 98 + 99 + if (chip && chip->irq_set_affinity) 100 + return chip->irq_set_affinity(data, mask_val, force); 101 + else 102 + return -EINVAL; 103 + } 104 + #endif 105 + 92 106 static struct irq_chip combiner_chip = { 93 - .name = "COMBINER", 94 - .irq_mask = combiner_mask_irq, 95 - .irq_unmask = combiner_unmask_irq, 107 + .name = "COMBINER", 108 + .irq_mask = combiner_mask_irq, 109 + .irq_unmask = combiner_unmask_irq, 110 + #ifdef CONFIG_SMP 111 + .irq_set_affinity = combiner_set_affinity, 112 + #endif 96 113 }; 97 114 98 - static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq) 115 + static unsigned int max_combiner_nr(void) 99 116 { 100 - unsigned int max_nr; 101 - 102 117 if (soc_is_exynos5250()) 103 - max_nr = EXYNOS5_MAX_COMBINER_NR; 118 + return EXYNOS5_MAX_COMBINER_NR; 119 + else if (soc_is_exynos4412()) 120 + return EXYNOS4412_MAX_COMBINER_NR; 121 + else if (soc_is_exynos4212()) 122 + return EXYNOS4212_MAX_COMBINER_NR; 104 123 else 105 - max_nr = EXYNOS4_MAX_COMBINER_NR; 124 + return EXYNOS4210_MAX_COMBINER_NR; 125 + } 106 126 107 - if (combiner_nr >= max_nr) 127 + static void __init combiner_cascade_irq(unsigned int combiner_nr, 128 + unsigned int irq) 129 + { 130 + if (combiner_nr >= max_combiner_nr()) 108 131 BUG(); 109 132 if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0) 110 133 BUG(); ··· 136 111 } 137 112 138 113 static void __init combiner_init_one(unsigned int combiner_nr, 139 - void __iomem *base) 114 + void __iomem *base, unsigned int irq) 140 115 { 141 116 combiner_data[combiner_nr].base = base; 142 117 combiner_data[combiner_nr].irq_offset = irq_find_mapping( 143 118 combiner_irq_domain, combiner_nr * MAX_IRQ_IN_COMBINER); 144 119 combiner_data[combiner_nr].irq_mask = 0xff << ((combiner_nr % 4) << 3); 120 + combiner_data[combiner_nr].parent_irq = irq; 145 121 146 122 /* Disable all interrupts */ 147 123 __raw_writel(combiner_data[combiner_nr].irq_mask, ··· 193 167 .map = combiner_irq_domain_map, 194 168 }; 195 169 170 + static unsigned int exynos4x12_combiner_extra_irq(int group) 171 + { 172 + switch (group) { 173 + case 16: 174 + return IRQ_SPI(107); 175 + case 17: 176 + return IRQ_SPI(108); 177 + case 18: 178 + return IRQ_SPI(48); 179 + case 19: 180 + return IRQ_SPI(42); 181 + default: 182 + return 0; 183 + } 184 + } 185 + 196 186 void __init combiner_init(void __iomem *combiner_base, 197 187 struct device_node *np) 198 188 { 199 189 int i, irq, irq_base; 200 190 unsigned int max_nr, nr_irq; 201 191 192 + max_nr = max_combiner_nr(); 193 + 202 194 if (np) { 203 195 if (of_property_read_u32(np, "samsung,combiner-nr", &max_nr)) { 204 - pr_warning("%s: number of combiners not specified, " 196 + pr_info("%s: number of combiners not specified, " 205 197 "setting default as %d.\n", 206 - __func__, EXYNOS4_MAX_COMBINER_NR); 207 - max_nr = EXYNOS4_MAX_COMBINER_NR; 198 + __func__, max_nr); 208 199 } 209 - } else { 210 - max_nr = soc_is_exynos5250() ? EXYNOS5_MAX_COMBINER_NR : 211 - EXYNOS4_MAX_COMBINER_NR; 212 200 } 201 + 213 202 nr_irq = max_nr * MAX_IRQ_IN_COMBINER; 214 203 215 204 irq_base = irq_alloc_descs(COMBINER_IRQ(0, 0), 1, nr_irq, 0); ··· 241 200 } 242 201 243 202 for (i = 0; i < max_nr; i++) { 244 - combiner_init_one(i, combiner_base + (i >> 2) * 0x10); 245 - irq = IRQ_SPI(i); 203 + if (i < EXYNOS4210_MAX_COMBINER_NR || soc_is_exynos5250()) 204 + irq = IRQ_SPI(i); 205 + else 206 + irq = exynos4x12_combiner_extra_irq(i); 246 207 #ifdef CONFIG_OF 247 208 if (np) 248 209 irq = irq_of_parse_and_map(np, i); 249 210 #endif 211 + combiner_init_one(i, combiner_base + (i >> 2) * 0x10, irq); 250 212 combiner_cascade_irq(i, irq); 251 213 } 252 214 }
+547
drivers/irqchip/irq-renesas-intc-irqpin.c
··· 1 + /* 2 + * Renesas INTC External IRQ Pin Driver 3 + * 4 + * Copyright (C) 2013 Magnus Damm 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 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + * 15 + * You should have received a copy of the GNU General Public License 16 + * along with this program; if not, write to the Free Software 17 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 + */ 19 + 20 + #include <linux/init.h> 21 + #include <linux/platform_device.h> 22 + #include <linux/spinlock.h> 23 + #include <linux/interrupt.h> 24 + #include <linux/ioport.h> 25 + #include <linux/io.h> 26 + #include <linux/irq.h> 27 + #include <linux/irqdomain.h> 28 + #include <linux/err.h> 29 + #include <linux/slab.h> 30 + #include <linux/module.h> 31 + #include <linux/platform_data/irq-renesas-intc-irqpin.h> 32 + 33 + #define INTC_IRQPIN_MAX 8 /* maximum 8 interrupts per driver instance */ 34 + 35 + #define INTC_IRQPIN_REG_SENSE 0 /* ICRn */ 36 + #define INTC_IRQPIN_REG_PRIO 1 /* INTPRInn */ 37 + #define INTC_IRQPIN_REG_SOURCE 2 /* INTREQnn */ 38 + #define INTC_IRQPIN_REG_MASK 3 /* INTMSKnn */ 39 + #define INTC_IRQPIN_REG_CLEAR 4 /* INTMSKCLRnn */ 40 + #define INTC_IRQPIN_REG_NR 5 41 + 42 + /* INTC external IRQ PIN hardware register access: 43 + * 44 + * SENSE is read-write 32-bit with 2-bits or 4-bits per IRQ (*) 45 + * PRIO is read-write 32-bit with 4-bits per IRQ (**) 46 + * SOURCE is read-only 32-bit or 8-bit with 1-bit per IRQ (***) 47 + * MASK is write-only 32-bit or 8-bit with 1-bit per IRQ (***) 48 + * CLEAR is write-only 32-bit or 8-bit with 1-bit per IRQ (***) 49 + * 50 + * (*) May be accessed by more than one driver instance - lock needed 51 + * (**) Read-modify-write access by one driver instance - lock needed 52 + * (***) Accessed by one driver instance only - no locking needed 53 + */ 54 + 55 + struct intc_irqpin_iomem { 56 + void __iomem *iomem; 57 + unsigned long (*read)(void __iomem *iomem); 58 + void (*write)(void __iomem *iomem, unsigned long data); 59 + int width; 60 + }; 61 + 62 + struct intc_irqpin_irq { 63 + int hw_irq; 64 + int requested_irq; 65 + int domain_irq; 66 + struct intc_irqpin_priv *p; 67 + }; 68 + 69 + struct intc_irqpin_priv { 70 + struct intc_irqpin_iomem iomem[INTC_IRQPIN_REG_NR]; 71 + struct intc_irqpin_irq irq[INTC_IRQPIN_MAX]; 72 + struct renesas_intc_irqpin_config config; 73 + unsigned int number_of_irqs; 74 + struct platform_device *pdev; 75 + struct irq_chip irq_chip; 76 + struct irq_domain *irq_domain; 77 + bool shared_irqs; 78 + u8 shared_irq_mask; 79 + }; 80 + 81 + static unsigned long intc_irqpin_read32(void __iomem *iomem) 82 + { 83 + return ioread32(iomem); 84 + } 85 + 86 + static unsigned long intc_irqpin_read8(void __iomem *iomem) 87 + { 88 + return ioread8(iomem); 89 + } 90 + 91 + static void intc_irqpin_write32(void __iomem *iomem, unsigned long data) 92 + { 93 + iowrite32(data, iomem); 94 + } 95 + 96 + static void intc_irqpin_write8(void __iomem *iomem, unsigned long data) 97 + { 98 + iowrite8(data, iomem); 99 + } 100 + 101 + static inline unsigned long intc_irqpin_read(struct intc_irqpin_priv *p, 102 + int reg) 103 + { 104 + struct intc_irqpin_iomem *i = &p->iomem[reg]; 105 + 106 + return i->read(i->iomem); 107 + } 108 + 109 + static inline void intc_irqpin_write(struct intc_irqpin_priv *p, 110 + int reg, unsigned long data) 111 + { 112 + struct intc_irqpin_iomem *i = &p->iomem[reg]; 113 + 114 + i->write(i->iomem, data); 115 + } 116 + 117 + static inline unsigned long intc_irqpin_hwirq_mask(struct intc_irqpin_priv *p, 118 + int reg, int hw_irq) 119 + { 120 + return BIT((p->iomem[reg].width - 1) - hw_irq); 121 + } 122 + 123 + static inline void intc_irqpin_irq_write_hwirq(struct intc_irqpin_priv *p, 124 + int reg, int hw_irq) 125 + { 126 + intc_irqpin_write(p, reg, intc_irqpin_hwirq_mask(p, reg, hw_irq)); 127 + } 128 + 129 + static DEFINE_RAW_SPINLOCK(intc_irqpin_lock); /* only used by slow path */ 130 + 131 + static void intc_irqpin_read_modify_write(struct intc_irqpin_priv *p, 132 + int reg, int shift, 133 + int width, int value) 134 + { 135 + unsigned long flags; 136 + unsigned long tmp; 137 + 138 + raw_spin_lock_irqsave(&intc_irqpin_lock, flags); 139 + 140 + tmp = intc_irqpin_read(p, reg); 141 + tmp &= ~(((1 << width) - 1) << shift); 142 + tmp |= value << shift; 143 + intc_irqpin_write(p, reg, tmp); 144 + 145 + raw_spin_unlock_irqrestore(&intc_irqpin_lock, flags); 146 + } 147 + 148 + static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p, 149 + int irq, int do_mask) 150 + { 151 + int bitfield_width = 4; /* PRIO assumed to have fixed bitfield width */ 152 + int shift = (7 - irq) * bitfield_width; /* PRIO assumed to be 32-bit */ 153 + 154 + intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_PRIO, 155 + shift, bitfield_width, 156 + do_mask ? 0 : (1 << bitfield_width) - 1); 157 + } 158 + 159 + static int intc_irqpin_set_sense(struct intc_irqpin_priv *p, int irq, int value) 160 + { 161 + int bitfield_width = p->config.sense_bitfield_width; 162 + int shift = (7 - irq) * bitfield_width; /* SENSE assumed to be 32-bit */ 163 + 164 + dev_dbg(&p->pdev->dev, "sense irq = %d, mode = %d\n", irq, value); 165 + 166 + if (value >= (1 << bitfield_width)) 167 + return -EINVAL; 168 + 169 + intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_SENSE, shift, 170 + bitfield_width, value); 171 + return 0; 172 + } 173 + 174 + static void intc_irqpin_dbg(struct intc_irqpin_irq *i, char *str) 175 + { 176 + dev_dbg(&i->p->pdev->dev, "%s (%d:%d:%d)\n", 177 + str, i->requested_irq, i->hw_irq, i->domain_irq); 178 + } 179 + 180 + static void intc_irqpin_irq_enable(struct irq_data *d) 181 + { 182 + struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); 183 + int hw_irq = irqd_to_hwirq(d); 184 + 185 + intc_irqpin_dbg(&p->irq[hw_irq], "enable"); 186 + intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_CLEAR, hw_irq); 187 + } 188 + 189 + static void intc_irqpin_irq_disable(struct irq_data *d) 190 + { 191 + struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); 192 + int hw_irq = irqd_to_hwirq(d); 193 + 194 + intc_irqpin_dbg(&p->irq[hw_irq], "disable"); 195 + intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_MASK, hw_irq); 196 + } 197 + 198 + static void intc_irqpin_shared_irq_enable(struct irq_data *d) 199 + { 200 + struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); 201 + int hw_irq = irqd_to_hwirq(d); 202 + 203 + intc_irqpin_dbg(&p->irq[hw_irq], "shared enable"); 204 + intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_CLEAR, hw_irq); 205 + 206 + p->shared_irq_mask &= ~BIT(hw_irq); 207 + } 208 + 209 + static void intc_irqpin_shared_irq_disable(struct irq_data *d) 210 + { 211 + struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); 212 + int hw_irq = irqd_to_hwirq(d); 213 + 214 + intc_irqpin_dbg(&p->irq[hw_irq], "shared disable"); 215 + intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_MASK, hw_irq); 216 + 217 + p->shared_irq_mask |= BIT(hw_irq); 218 + } 219 + 220 + static void intc_irqpin_irq_enable_force(struct irq_data *d) 221 + { 222 + struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); 223 + int irq = p->irq[irqd_to_hwirq(d)].requested_irq; 224 + 225 + intc_irqpin_irq_enable(d); 226 + 227 + /* enable interrupt through parent interrupt controller, 228 + * assumes non-shared interrupt with 1:1 mapping 229 + * needed for busted IRQs on some SoCs like sh73a0 230 + */ 231 + irq_get_chip(irq)->irq_unmask(irq_get_irq_data(irq)); 232 + } 233 + 234 + static void intc_irqpin_irq_disable_force(struct irq_data *d) 235 + { 236 + struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); 237 + int irq = p->irq[irqd_to_hwirq(d)].requested_irq; 238 + 239 + /* disable interrupt through parent interrupt controller, 240 + * assumes non-shared interrupt with 1:1 mapping 241 + * needed for busted IRQs on some SoCs like sh73a0 242 + */ 243 + irq_get_chip(irq)->irq_mask(irq_get_irq_data(irq)); 244 + intc_irqpin_irq_disable(d); 245 + } 246 + 247 + #define INTC_IRQ_SENSE_VALID 0x10 248 + #define INTC_IRQ_SENSE(x) (x + INTC_IRQ_SENSE_VALID) 249 + 250 + static unsigned char intc_irqpin_sense[IRQ_TYPE_SENSE_MASK + 1] = { 251 + [IRQ_TYPE_EDGE_FALLING] = INTC_IRQ_SENSE(0x00), 252 + [IRQ_TYPE_EDGE_RISING] = INTC_IRQ_SENSE(0x01), 253 + [IRQ_TYPE_LEVEL_LOW] = INTC_IRQ_SENSE(0x02), 254 + [IRQ_TYPE_LEVEL_HIGH] = INTC_IRQ_SENSE(0x03), 255 + [IRQ_TYPE_EDGE_BOTH] = INTC_IRQ_SENSE(0x04), 256 + }; 257 + 258 + static int intc_irqpin_irq_set_type(struct irq_data *d, unsigned int type) 259 + { 260 + unsigned char value = intc_irqpin_sense[type & IRQ_TYPE_SENSE_MASK]; 261 + struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); 262 + 263 + if (!(value & INTC_IRQ_SENSE_VALID)) 264 + return -EINVAL; 265 + 266 + return intc_irqpin_set_sense(p, irqd_to_hwirq(d), 267 + value ^ INTC_IRQ_SENSE_VALID); 268 + } 269 + 270 + static irqreturn_t intc_irqpin_irq_handler(int irq, void *dev_id) 271 + { 272 + struct intc_irqpin_irq *i = dev_id; 273 + struct intc_irqpin_priv *p = i->p; 274 + unsigned long bit; 275 + 276 + intc_irqpin_dbg(i, "demux1"); 277 + bit = intc_irqpin_hwirq_mask(p, INTC_IRQPIN_REG_SOURCE, i->hw_irq); 278 + 279 + if (intc_irqpin_read(p, INTC_IRQPIN_REG_SOURCE) & bit) { 280 + intc_irqpin_write(p, INTC_IRQPIN_REG_SOURCE, ~bit); 281 + intc_irqpin_dbg(i, "demux2"); 282 + generic_handle_irq(i->domain_irq); 283 + return IRQ_HANDLED; 284 + } 285 + return IRQ_NONE; 286 + } 287 + 288 + static irqreturn_t intc_irqpin_shared_irq_handler(int irq, void *dev_id) 289 + { 290 + struct intc_irqpin_priv *p = dev_id; 291 + unsigned int reg_source = intc_irqpin_read(p, INTC_IRQPIN_REG_SOURCE); 292 + irqreturn_t status = IRQ_NONE; 293 + int k; 294 + 295 + for (k = 0; k < 8; k++) { 296 + if (reg_source & BIT(7 - k)) { 297 + if (BIT(k) & p->shared_irq_mask) 298 + continue; 299 + 300 + status |= intc_irqpin_irq_handler(irq, &p->irq[k]); 301 + } 302 + } 303 + 304 + return status; 305 + } 306 + 307 + static int intc_irqpin_irq_domain_map(struct irq_domain *h, unsigned int virq, 308 + irq_hw_number_t hw) 309 + { 310 + struct intc_irqpin_priv *p = h->host_data; 311 + 312 + p->irq[hw].domain_irq = virq; 313 + p->irq[hw].hw_irq = hw; 314 + 315 + intc_irqpin_dbg(&p->irq[hw], "map"); 316 + irq_set_chip_data(virq, h->host_data); 317 + irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq); 318 + set_irq_flags(virq, IRQF_VALID); /* kill me now */ 319 + return 0; 320 + } 321 + 322 + static struct irq_domain_ops intc_irqpin_irq_domain_ops = { 323 + .map = intc_irqpin_irq_domain_map, 324 + .xlate = irq_domain_xlate_twocell, 325 + }; 326 + 327 + static int intc_irqpin_probe(struct platform_device *pdev) 328 + { 329 + struct renesas_intc_irqpin_config *pdata = pdev->dev.platform_data; 330 + struct intc_irqpin_priv *p; 331 + struct intc_irqpin_iomem *i; 332 + struct resource *io[INTC_IRQPIN_REG_NR]; 333 + struct resource *irq; 334 + struct irq_chip *irq_chip; 335 + void (*enable_fn)(struct irq_data *d); 336 + void (*disable_fn)(struct irq_data *d); 337 + const char *name = dev_name(&pdev->dev); 338 + int ref_irq; 339 + int ret; 340 + int k; 341 + 342 + p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); 343 + if (!p) { 344 + dev_err(&pdev->dev, "failed to allocate driver data\n"); 345 + ret = -ENOMEM; 346 + goto err0; 347 + } 348 + 349 + /* deal with driver instance configuration */ 350 + if (pdata) 351 + memcpy(&p->config, pdata, sizeof(*pdata)); 352 + if (!p->config.sense_bitfield_width) 353 + p->config.sense_bitfield_width = 4; /* default to 4 bits */ 354 + 355 + p->pdev = pdev; 356 + platform_set_drvdata(pdev, p); 357 + 358 + /* get hold of manadatory IOMEM */ 359 + for (k = 0; k < INTC_IRQPIN_REG_NR; k++) { 360 + io[k] = platform_get_resource(pdev, IORESOURCE_MEM, k); 361 + if (!io[k]) { 362 + dev_err(&pdev->dev, "not enough IOMEM resources\n"); 363 + ret = -EINVAL; 364 + goto err0; 365 + } 366 + } 367 + 368 + /* allow any number of IRQs between 1 and INTC_IRQPIN_MAX */ 369 + for (k = 0; k < INTC_IRQPIN_MAX; k++) { 370 + irq = platform_get_resource(pdev, IORESOURCE_IRQ, k); 371 + if (!irq) 372 + break; 373 + 374 + p->irq[k].p = p; 375 + p->irq[k].requested_irq = irq->start; 376 + } 377 + 378 + p->number_of_irqs = k; 379 + if (p->number_of_irqs < 1) { 380 + dev_err(&pdev->dev, "not enough IRQ resources\n"); 381 + ret = -EINVAL; 382 + goto err0; 383 + } 384 + 385 + /* ioremap IOMEM and setup read/write callbacks */ 386 + for (k = 0; k < INTC_IRQPIN_REG_NR; k++) { 387 + i = &p->iomem[k]; 388 + 389 + switch (resource_size(io[k])) { 390 + case 1: 391 + i->width = 8; 392 + i->read = intc_irqpin_read8; 393 + i->write = intc_irqpin_write8; 394 + break; 395 + case 4: 396 + i->width = 32; 397 + i->read = intc_irqpin_read32; 398 + i->write = intc_irqpin_write32; 399 + break; 400 + default: 401 + dev_err(&pdev->dev, "IOMEM size mismatch\n"); 402 + ret = -EINVAL; 403 + goto err0; 404 + } 405 + 406 + i->iomem = devm_ioremap_nocache(&pdev->dev, io[k]->start, 407 + resource_size(io[k])); 408 + if (!i->iomem) { 409 + dev_err(&pdev->dev, "failed to remap IOMEM\n"); 410 + ret = -ENXIO; 411 + goto err0; 412 + } 413 + } 414 + 415 + /* mask all interrupts using priority */ 416 + for (k = 0; k < p->number_of_irqs; k++) 417 + intc_irqpin_mask_unmask_prio(p, k, 1); 418 + 419 + /* clear all pending interrupts */ 420 + intc_irqpin_write(p, INTC_IRQPIN_REG_SOURCE, 0x0); 421 + 422 + /* scan for shared interrupt lines */ 423 + ref_irq = p->irq[0].requested_irq; 424 + p->shared_irqs = true; 425 + for (k = 1; k < p->number_of_irqs; k++) { 426 + if (ref_irq != p->irq[k].requested_irq) { 427 + p->shared_irqs = false; 428 + break; 429 + } 430 + } 431 + 432 + /* use more severe masking method if requested */ 433 + if (p->config.control_parent) { 434 + enable_fn = intc_irqpin_irq_enable_force; 435 + disable_fn = intc_irqpin_irq_disable_force; 436 + } else if (!p->shared_irqs) { 437 + enable_fn = intc_irqpin_irq_enable; 438 + disable_fn = intc_irqpin_irq_disable; 439 + } else { 440 + enable_fn = intc_irqpin_shared_irq_enable; 441 + disable_fn = intc_irqpin_shared_irq_disable; 442 + } 443 + 444 + irq_chip = &p->irq_chip; 445 + irq_chip->name = name; 446 + irq_chip->irq_mask = disable_fn; 447 + irq_chip->irq_unmask = enable_fn; 448 + irq_chip->irq_enable = enable_fn; 449 + irq_chip->irq_disable = disable_fn; 450 + irq_chip->irq_set_type = intc_irqpin_irq_set_type; 451 + irq_chip->flags = IRQCHIP_SKIP_SET_WAKE; 452 + 453 + p->irq_domain = irq_domain_add_simple(pdev->dev.of_node, 454 + p->number_of_irqs, 455 + p->config.irq_base, 456 + &intc_irqpin_irq_domain_ops, p); 457 + if (!p->irq_domain) { 458 + ret = -ENXIO; 459 + dev_err(&pdev->dev, "cannot initialize irq domain\n"); 460 + goto err0; 461 + } 462 + 463 + if (p->shared_irqs) { 464 + /* request one shared interrupt */ 465 + if (devm_request_irq(&pdev->dev, p->irq[0].requested_irq, 466 + intc_irqpin_shared_irq_handler, 467 + IRQF_SHARED, name, p)) { 468 + dev_err(&pdev->dev, "failed to request low IRQ\n"); 469 + ret = -ENOENT; 470 + goto err1; 471 + } 472 + } else { 473 + /* request interrupts one by one */ 474 + for (k = 0; k < p->number_of_irqs; k++) { 475 + if (devm_request_irq(&pdev->dev, 476 + p->irq[k].requested_irq, 477 + intc_irqpin_irq_handler, 478 + 0, name, &p->irq[k])) { 479 + dev_err(&pdev->dev, 480 + "failed to request low IRQ\n"); 481 + ret = -ENOENT; 482 + goto err1; 483 + } 484 + } 485 + } 486 + 487 + /* unmask all interrupts on prio level */ 488 + for (k = 0; k < p->number_of_irqs; k++) 489 + intc_irqpin_mask_unmask_prio(p, k, 0); 490 + 491 + dev_info(&pdev->dev, "driving %d irqs\n", p->number_of_irqs); 492 + 493 + /* warn in case of mismatch if irq base is specified */ 494 + if (p->config.irq_base) { 495 + if (p->config.irq_base != p->irq[0].domain_irq) 496 + dev_warn(&pdev->dev, "irq base mismatch (%d/%d)\n", 497 + p->config.irq_base, p->irq[0].domain_irq); 498 + } 499 + 500 + return 0; 501 + 502 + err1: 503 + irq_domain_remove(p->irq_domain); 504 + err0: 505 + return ret; 506 + } 507 + 508 + static int intc_irqpin_remove(struct platform_device *pdev) 509 + { 510 + struct intc_irqpin_priv *p = platform_get_drvdata(pdev); 511 + 512 + irq_domain_remove(p->irq_domain); 513 + 514 + return 0; 515 + } 516 + 517 + static const struct of_device_id intc_irqpin_dt_ids[] = { 518 + { .compatible = "renesas,intc-irqpin", }, 519 + {}, 520 + }; 521 + MODULE_DEVICE_TABLE(of, intc_irqpin_dt_ids); 522 + 523 + static struct platform_driver intc_irqpin_device_driver = { 524 + .probe = intc_irqpin_probe, 525 + .remove = intc_irqpin_remove, 526 + .driver = { 527 + .name = "renesas_intc_irqpin", 528 + .of_match_table = intc_irqpin_dt_ids, 529 + .owner = THIS_MODULE, 530 + } 531 + }; 532 + 533 + static int __init intc_irqpin_init(void) 534 + { 535 + return platform_driver_register(&intc_irqpin_device_driver); 536 + } 537 + postcore_initcall(intc_irqpin_init); 538 + 539 + static void __exit intc_irqpin_exit(void) 540 + { 541 + platform_driver_unregister(&intc_irqpin_device_driver); 542 + } 543 + module_exit(intc_irqpin_exit); 544 + 545 + MODULE_AUTHOR("Magnus Damm"); 546 + MODULE_DESCRIPTION("Renesas INTC External IRQ Pin Driver"); 547 + MODULE_LICENSE("GPL v2");
+307
drivers/irqchip/irq-renesas-irqc.c
··· 1 + /* 2 + * Renesas IRQC Driver 3 + * 4 + * Copyright (C) 2013 Magnus Damm 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 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + * 15 + * You should have received a copy of the GNU General Public License 16 + * along with this program; if not, write to the Free Software 17 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 + */ 19 + 20 + #include <linux/init.h> 21 + #include <linux/platform_device.h> 22 + #include <linux/spinlock.h> 23 + #include <linux/interrupt.h> 24 + #include <linux/ioport.h> 25 + #include <linux/io.h> 26 + #include <linux/irq.h> 27 + #include <linux/irqdomain.h> 28 + #include <linux/err.h> 29 + #include <linux/slab.h> 30 + #include <linux/module.h> 31 + #include <linux/platform_data/irq-renesas-irqc.h> 32 + 33 + #define IRQC_IRQ_MAX 32 /* maximum 32 interrupts per driver instance */ 34 + 35 + #define IRQC_REQ_STS 0x00 36 + #define IRQC_EN_STS 0x04 37 + #define IRQC_EN_SET 0x08 38 + #define IRQC_INT_CPU_BASE(n) (0x000 + ((n) * 0x10)) 39 + #define DETECT_STATUS 0x100 40 + #define IRQC_CONFIG(n) (0x180 + ((n) * 0x04)) 41 + 42 + struct irqc_irq { 43 + int hw_irq; 44 + int requested_irq; 45 + int domain_irq; 46 + struct irqc_priv *p; 47 + }; 48 + 49 + struct irqc_priv { 50 + void __iomem *iomem; 51 + void __iomem *cpu_int_base; 52 + struct irqc_irq irq[IRQC_IRQ_MAX]; 53 + struct renesas_irqc_config config; 54 + unsigned int number_of_irqs; 55 + struct platform_device *pdev; 56 + struct irq_chip irq_chip; 57 + struct irq_domain *irq_domain; 58 + }; 59 + 60 + static void irqc_dbg(struct irqc_irq *i, char *str) 61 + { 62 + dev_dbg(&i->p->pdev->dev, "%s (%d:%d:%d)\n", 63 + str, i->requested_irq, i->hw_irq, i->domain_irq); 64 + } 65 + 66 + static void irqc_irq_enable(struct irq_data *d) 67 + { 68 + struct irqc_priv *p = irq_data_get_irq_chip_data(d); 69 + int hw_irq = irqd_to_hwirq(d); 70 + 71 + irqc_dbg(&p->irq[hw_irq], "enable"); 72 + iowrite32(BIT(hw_irq), p->cpu_int_base + IRQC_EN_SET); 73 + } 74 + 75 + static void irqc_irq_disable(struct irq_data *d) 76 + { 77 + struct irqc_priv *p = irq_data_get_irq_chip_data(d); 78 + int hw_irq = irqd_to_hwirq(d); 79 + 80 + irqc_dbg(&p->irq[hw_irq], "disable"); 81 + iowrite32(BIT(hw_irq), p->cpu_int_base + IRQC_EN_STS); 82 + } 83 + 84 + #define INTC_IRQ_SENSE_VALID 0x10 85 + #define INTC_IRQ_SENSE(x) (x + INTC_IRQ_SENSE_VALID) 86 + 87 + static unsigned char irqc_sense[IRQ_TYPE_SENSE_MASK + 1] = { 88 + [IRQ_TYPE_LEVEL_LOW] = INTC_IRQ_SENSE(0x01), 89 + [IRQ_TYPE_LEVEL_HIGH] = INTC_IRQ_SENSE(0x02), 90 + [IRQ_TYPE_EDGE_FALLING] = INTC_IRQ_SENSE(0x04), /* Synchronous */ 91 + [IRQ_TYPE_EDGE_RISING] = INTC_IRQ_SENSE(0x08), /* Synchronous */ 92 + [IRQ_TYPE_EDGE_BOTH] = INTC_IRQ_SENSE(0x0c), /* Synchronous */ 93 + }; 94 + 95 + static int irqc_irq_set_type(struct irq_data *d, unsigned int type) 96 + { 97 + struct irqc_priv *p = irq_data_get_irq_chip_data(d); 98 + int hw_irq = irqd_to_hwirq(d); 99 + unsigned char value = irqc_sense[type & IRQ_TYPE_SENSE_MASK]; 100 + unsigned long tmp; 101 + 102 + irqc_dbg(&p->irq[hw_irq], "sense"); 103 + 104 + if (!(value & INTC_IRQ_SENSE_VALID)) 105 + return -EINVAL; 106 + 107 + tmp = ioread32(p->iomem + IRQC_CONFIG(hw_irq)); 108 + tmp &= ~0x3f; 109 + tmp |= value ^ INTC_IRQ_SENSE_VALID; 110 + iowrite32(tmp, p->iomem + IRQC_CONFIG(hw_irq)); 111 + return 0; 112 + } 113 + 114 + static irqreturn_t irqc_irq_handler(int irq, void *dev_id) 115 + { 116 + struct irqc_irq *i = dev_id; 117 + struct irqc_priv *p = i->p; 118 + unsigned long bit = BIT(i->hw_irq); 119 + 120 + irqc_dbg(i, "demux1"); 121 + 122 + if (ioread32(p->iomem + DETECT_STATUS) & bit) { 123 + iowrite32(bit, p->iomem + DETECT_STATUS); 124 + irqc_dbg(i, "demux2"); 125 + generic_handle_irq(i->domain_irq); 126 + return IRQ_HANDLED; 127 + } 128 + return IRQ_NONE; 129 + } 130 + 131 + static int irqc_irq_domain_map(struct irq_domain *h, unsigned int virq, 132 + irq_hw_number_t hw) 133 + { 134 + struct irqc_priv *p = h->host_data; 135 + 136 + p->irq[hw].domain_irq = virq; 137 + p->irq[hw].hw_irq = hw; 138 + 139 + irqc_dbg(&p->irq[hw], "map"); 140 + irq_set_chip_data(virq, h->host_data); 141 + irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq); 142 + set_irq_flags(virq, IRQF_VALID); /* kill me now */ 143 + return 0; 144 + } 145 + 146 + static struct irq_domain_ops irqc_irq_domain_ops = { 147 + .map = irqc_irq_domain_map, 148 + .xlate = irq_domain_xlate_twocell, 149 + }; 150 + 151 + static int irqc_probe(struct platform_device *pdev) 152 + { 153 + struct renesas_irqc_config *pdata = pdev->dev.platform_data; 154 + struct irqc_priv *p; 155 + struct resource *io; 156 + struct resource *irq; 157 + struct irq_chip *irq_chip; 158 + const char *name = dev_name(&pdev->dev); 159 + int ret; 160 + int k; 161 + 162 + p = kzalloc(sizeof(*p), GFP_KERNEL); 163 + if (!p) { 164 + dev_err(&pdev->dev, "failed to allocate driver data\n"); 165 + ret = -ENOMEM; 166 + goto err0; 167 + } 168 + 169 + /* deal with driver instance configuration */ 170 + if (pdata) 171 + memcpy(&p->config, pdata, sizeof(*pdata)); 172 + 173 + p->pdev = pdev; 174 + platform_set_drvdata(pdev, p); 175 + 176 + /* get hold of manadatory IOMEM */ 177 + io = platform_get_resource(pdev, IORESOURCE_MEM, 0); 178 + if (!io) { 179 + dev_err(&pdev->dev, "not enough IOMEM resources\n"); 180 + ret = -EINVAL; 181 + goto err1; 182 + } 183 + 184 + /* allow any number of IRQs between 1 and IRQC_IRQ_MAX */ 185 + for (k = 0; k < IRQC_IRQ_MAX; k++) { 186 + irq = platform_get_resource(pdev, IORESOURCE_IRQ, k); 187 + if (!irq) 188 + break; 189 + 190 + p->irq[k].p = p; 191 + p->irq[k].requested_irq = irq->start; 192 + } 193 + 194 + p->number_of_irqs = k; 195 + if (p->number_of_irqs < 1) { 196 + dev_err(&pdev->dev, "not enough IRQ resources\n"); 197 + ret = -EINVAL; 198 + goto err1; 199 + } 200 + 201 + /* ioremap IOMEM and setup read/write callbacks */ 202 + p->iomem = ioremap_nocache(io->start, resource_size(io)); 203 + if (!p->iomem) { 204 + dev_err(&pdev->dev, "failed to remap IOMEM\n"); 205 + ret = -ENXIO; 206 + goto err2; 207 + } 208 + 209 + p->cpu_int_base = p->iomem + IRQC_INT_CPU_BASE(0); /* SYS-SPI */ 210 + 211 + irq_chip = &p->irq_chip; 212 + irq_chip->name = name; 213 + irq_chip->irq_mask = irqc_irq_disable; 214 + irq_chip->irq_unmask = irqc_irq_enable; 215 + irq_chip->irq_enable = irqc_irq_enable; 216 + irq_chip->irq_disable = irqc_irq_disable; 217 + irq_chip->irq_set_type = irqc_irq_set_type; 218 + irq_chip->flags = IRQCHIP_SKIP_SET_WAKE; 219 + 220 + p->irq_domain = irq_domain_add_simple(pdev->dev.of_node, 221 + p->number_of_irqs, 222 + p->config.irq_base, 223 + &irqc_irq_domain_ops, p); 224 + if (!p->irq_domain) { 225 + ret = -ENXIO; 226 + dev_err(&pdev->dev, "cannot initialize irq domain\n"); 227 + goto err2; 228 + } 229 + 230 + /* request interrupts one by one */ 231 + for (k = 0; k < p->number_of_irqs; k++) { 232 + if (request_irq(p->irq[k].requested_irq, irqc_irq_handler, 233 + 0, name, &p->irq[k])) { 234 + dev_err(&pdev->dev, "failed to request IRQ\n"); 235 + ret = -ENOENT; 236 + goto err3; 237 + } 238 + } 239 + 240 + dev_info(&pdev->dev, "driving %d irqs\n", p->number_of_irqs); 241 + 242 + /* warn in case of mismatch if irq base is specified */ 243 + if (p->config.irq_base) { 244 + if (p->config.irq_base != p->irq[0].domain_irq) 245 + dev_warn(&pdev->dev, "irq base mismatch (%d/%d)\n", 246 + p->config.irq_base, p->irq[0].domain_irq); 247 + } 248 + 249 + return 0; 250 + err3: 251 + for (; k >= 0; k--) 252 + free_irq(p->irq[k - 1].requested_irq, &p->irq[k - 1]); 253 + 254 + irq_domain_remove(p->irq_domain); 255 + err2: 256 + iounmap(p->iomem); 257 + err1: 258 + kfree(p); 259 + err0: 260 + return ret; 261 + } 262 + 263 + static int irqc_remove(struct platform_device *pdev) 264 + { 265 + struct irqc_priv *p = platform_get_drvdata(pdev); 266 + int k; 267 + 268 + for (k = 0; k < p->number_of_irqs; k++) 269 + free_irq(p->irq[k].requested_irq, &p->irq[k]); 270 + 271 + irq_domain_remove(p->irq_domain); 272 + iounmap(p->iomem); 273 + kfree(p); 274 + return 0; 275 + } 276 + 277 + static const struct of_device_id irqc_dt_ids[] = { 278 + { .compatible = "renesas,irqc", }, 279 + {}, 280 + }; 281 + MODULE_DEVICE_TABLE(of, irqc_dt_ids); 282 + 283 + static struct platform_driver irqc_device_driver = { 284 + .probe = irqc_probe, 285 + .remove = irqc_remove, 286 + .driver = { 287 + .name = "renesas_irqc", 288 + .of_match_table = irqc_dt_ids, 289 + .owner = THIS_MODULE, 290 + } 291 + }; 292 + 293 + static int __init irqc_init(void) 294 + { 295 + return platform_driver_register(&irqc_device_driver); 296 + } 297 + postcore_initcall(irqc_init); 298 + 299 + static void __exit irqc_exit(void) 300 + { 301 + platform_driver_unregister(&irqc_device_driver); 302 + } 303 + module_exit(irqc_exit); 304 + 305 + MODULE_AUTHOR("Magnus Damm"); 306 + MODULE_DESCRIPTION("Renesas IRQC Driver"); 307 + MODULE_LICENSE("GPL v2");
+76 -35
drivers/of/base.c
··· 747 747 EXPORT_SYMBOL(of_find_node_by_phandle); 748 748 749 749 /** 750 + * of_find_property_value_of_size 751 + * 752 + * @np: device node from which the property value is to be read. 753 + * @propname: name of the property to be searched. 754 + * @len: requested length of property value 755 + * 756 + * Search for a property in a device node and valid the requested size. 757 + * Returns the property value on success, -EINVAL if the property does not 758 + * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the 759 + * property data isn't large enough. 760 + * 761 + */ 762 + static void *of_find_property_value_of_size(const struct device_node *np, 763 + const char *propname, u32 len) 764 + { 765 + struct property *prop = of_find_property(np, propname, NULL); 766 + 767 + if (!prop) 768 + return ERR_PTR(-EINVAL); 769 + if (!prop->value) 770 + return ERR_PTR(-ENODATA); 771 + if (len > prop->length) 772 + return ERR_PTR(-EOVERFLOW); 773 + 774 + return prop->value; 775 + } 776 + 777 + /** 778 + * of_property_read_u32_index - Find and read a u32 from a multi-value property. 779 + * 780 + * @np: device node from which the property value is to be read. 781 + * @propname: name of the property to be searched. 782 + * @index: index of the u32 in the list of values 783 + * @out_value: pointer to return value, modified only if no error. 784 + * 785 + * Search for a property in a device node and read nth 32-bit value from 786 + * it. Returns 0 on success, -EINVAL if the property does not exist, 787 + * -ENODATA if property does not have a value, and -EOVERFLOW if the 788 + * property data isn't large enough. 789 + * 790 + * The out_value is modified only if a valid u32 value can be decoded. 791 + */ 792 + int of_property_read_u32_index(const struct device_node *np, 793 + const char *propname, 794 + u32 index, u32 *out_value) 795 + { 796 + const u32 *val = of_find_property_value_of_size(np, propname, 797 + ((index + 1) * sizeof(*out_value))); 798 + 799 + if (IS_ERR(val)) 800 + return PTR_ERR(val); 801 + 802 + *out_value = be32_to_cpup(((__be32 *)val) + index); 803 + return 0; 804 + } 805 + EXPORT_SYMBOL_GPL(of_property_read_u32_index); 806 + 807 + /** 750 808 * of_property_read_u8_array - Find and read an array of u8 from a property. 751 809 * 752 810 * @np: device node from which the property value is to be read. ··· 825 767 int of_property_read_u8_array(const struct device_node *np, 826 768 const char *propname, u8 *out_values, size_t sz) 827 769 { 828 - struct property *prop = of_find_property(np, propname, NULL); 829 - const u8 *val; 770 + const u8 *val = of_find_property_value_of_size(np, propname, 771 + (sz * sizeof(*out_values))); 830 772 831 - if (!prop) 832 - return -EINVAL; 833 - if (!prop->value) 834 - return -ENODATA; 835 - if ((sz * sizeof(*out_values)) > prop->length) 836 - return -EOVERFLOW; 773 + if (IS_ERR(val)) 774 + return PTR_ERR(val); 837 775 838 - val = prop->value; 839 776 while (sz--) 840 777 *out_values++ = *val++; 841 778 return 0; ··· 858 805 int of_property_read_u16_array(const struct device_node *np, 859 806 const char *propname, u16 *out_values, size_t sz) 860 807 { 861 - struct property *prop = of_find_property(np, propname, NULL); 862 - const __be16 *val; 808 + const __be16 *val = of_find_property_value_of_size(np, propname, 809 + (sz * sizeof(*out_values))); 863 810 864 - if (!prop) 865 - return -EINVAL; 866 - if (!prop->value) 867 - return -ENODATA; 868 - if ((sz * sizeof(*out_values)) > prop->length) 869 - return -EOVERFLOW; 811 + if (IS_ERR(val)) 812 + return PTR_ERR(val); 870 813 871 - val = prop->value; 872 814 while (sz--) 873 815 *out_values++ = be16_to_cpup(val++); 874 816 return 0; ··· 890 842 const char *propname, u32 *out_values, 891 843 size_t sz) 892 844 { 893 - struct property *prop = of_find_property(np, propname, NULL); 894 - const __be32 *val; 845 + const __be32 *val = of_find_property_value_of_size(np, propname, 846 + (sz * sizeof(*out_values))); 895 847 896 - if (!prop) 897 - return -EINVAL; 898 - if (!prop->value) 899 - return -ENODATA; 900 - if ((sz * sizeof(*out_values)) > prop->length) 901 - return -EOVERFLOW; 848 + if (IS_ERR(val)) 849 + return PTR_ERR(val); 902 850 903 - val = prop->value; 904 851 while (sz--) 905 852 *out_values++ = be32_to_cpup(val++); 906 853 return 0; ··· 918 875 int of_property_read_u64(const struct device_node *np, const char *propname, 919 876 u64 *out_value) 920 877 { 921 - struct property *prop = of_find_property(np, propname, NULL); 878 + const __be32 *val = of_find_property_value_of_size(np, propname, 879 + sizeof(*out_value)); 922 880 923 - if (!prop) 924 - return -EINVAL; 925 - if (!prop->value) 926 - return -ENODATA; 927 - if (sizeof(*out_value) > prop->length) 928 - return -EOVERFLOW; 929 - *out_value = of_read_number(prop->value, 2); 881 + if (IS_ERR(val)) 882 + return PTR_ERR(val); 883 + 884 + *out_value = of_read_number(val, 2); 930 885 return 0; 931 886 } 932 887 EXPORT_SYMBOL_GPL(of_property_read_u64);
+1
drivers/pinctrl/Kconfig
··· 224 224 source "drivers/pinctrl/mvebu/Kconfig" 225 225 source "drivers/pinctrl/sh-pfc/Kconfig" 226 226 source "drivers/pinctrl/spear/Kconfig" 227 + source "drivers/pinctrl/vt8500/Kconfig" 227 228 228 229 config PINCTRL_XWAY 229 230 bool
+1
drivers/pinctrl/Makefile
··· 50 50 obj-$(CONFIG_ARCH_SHMOBILE) += sh-pfc/ 51 51 obj-$(CONFIG_SUPERH) += sh-pfc/ 52 52 obj-$(CONFIG_PLAT_SPEAR) += spear/ 53 + obj-$(CONFIG_ARCH_VT8500) += vt8500/
+11 -8
drivers/pinctrl/pinctrl-bcm2835.c
··· 699 699 return 0; 700 700 } 701 701 702 - static inline u32 prop_u32(struct property *p, int i) 703 - { 704 - return be32_to_cpup(((__be32 *)p->value) + i); 705 - } 706 - 707 702 static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, 708 703 struct device_node *np, 709 704 struct pinctrl_map **map, unsigned *num_maps) ··· 756 761 return -ENOMEM; 757 762 758 763 for (i = 0; i < num_pins; i++) { 759 - pin = prop_u32(pins, i); 764 + err = of_property_read_u32_index(np, "brcm,pins", i, &pin); 765 + if (err) 766 + goto out; 760 767 if (pin >= ARRAY_SIZE(bcm2835_gpio_pins)) { 761 768 dev_err(pc->dev, "%s: invalid brcm,pins value %d\n", 762 769 of_node_full_name(np), pin); ··· 767 770 } 768 771 769 772 if (num_funcs) { 770 - func = prop_u32(funcs, (num_funcs > 1) ? i : 0); 773 + err = of_property_read_u32_index(np, "brcm,function", 774 + (num_funcs > 1) ? i : 0, &func); 775 + if (err) 776 + goto out; 771 777 err = bcm2835_pctl_dt_node_to_map_func(pc, np, pin, 772 778 func, &cur_map); 773 779 if (err) 774 780 goto out; 775 781 } 776 782 if (num_pulls) { 777 - pull = prop_u32(pulls, (num_pulls > 1) ? i : 0); 783 + err = of_property_read_u32_index(np, "brcm,pull", 784 + (num_funcs > 1) ? i : 0, &pull); 785 + if (err) 786 + goto out; 778 787 err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin, 779 788 pull, &cur_map); 780 789 if (err)
+108
drivers/pinctrl/pinctrl-exynos.c
··· 700 700 .label = "exynos4x12-gpio-ctrl3", 701 701 }, 702 702 }; 703 + 704 + /* pin banks of exynos5250 pin-controller 0 */ 705 + static struct samsung_pin_bank exynos5250_pin_banks0[] = { 706 + EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), 707 + EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04), 708 + EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpa2", 0x08), 709 + EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpb0", 0x0c), 710 + EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpb1", 0x10), 711 + EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpb2", 0x14), 712 + EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpb3", 0x18), 713 + EXYNOS_PIN_BANK_EINTG(7, 0x0E0, "gpc0", 0x1c), 714 + EXYNOS_PIN_BANK_EINTG(4, 0x100, "gpc1", 0x20), 715 + EXYNOS_PIN_BANK_EINTG(7, 0x120, "gpc2", 0x24), 716 + EXYNOS_PIN_BANK_EINTG(7, 0x140, "gpc3", 0x28), 717 + EXYNOS_PIN_BANK_EINTG(4, 0x160, "gpd0", 0x2c), 718 + EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpd1", 0x30), 719 + EXYNOS_PIN_BANK_EINTG(7, 0x2E0, "gpc4", 0x34), 720 + EXYNOS_PIN_BANK_EINTN(6, 0x1A0, "gpy0"), 721 + EXYNOS_PIN_BANK_EINTN(4, 0x1C0, "gpy1"), 722 + EXYNOS_PIN_BANK_EINTN(6, 0x1E0, "gpy2"), 723 + EXYNOS_PIN_BANK_EINTN(8, 0x200, "gpy3"), 724 + EXYNOS_PIN_BANK_EINTN(8, 0x220, "gpy4"), 725 + EXYNOS_PIN_BANK_EINTN(8, 0x240, "gpy5"), 726 + EXYNOS_PIN_BANK_EINTN(8, 0x260, "gpy6"), 727 + EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00), 728 + EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04), 729 + EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08), 730 + EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c), 731 + }; 732 + 733 + /* pin banks of exynos5250 pin-controller 1 */ 734 + static struct samsung_pin_bank exynos5250_pin_banks1[] = { 735 + EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpe0", 0x00), 736 + EXYNOS_PIN_BANK_EINTG(2, 0x020, "gpe1", 0x04), 737 + EXYNOS_PIN_BANK_EINTG(4, 0x040, "gpf0", 0x08), 738 + EXYNOS_PIN_BANK_EINTG(4, 0x060, "gpf1", 0x0c), 739 + EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpg0", 0x10), 740 + EXYNOS_PIN_BANK_EINTG(8, 0x0A0, "gpg1", 0x14), 741 + EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpg2", 0x18), 742 + EXYNOS_PIN_BANK_EINTG(4, 0x0E0, "gph0", 0x1c), 743 + EXYNOS_PIN_BANK_EINTG(8, 0x100, "gph1", 0x20), 744 + }; 745 + 746 + /* pin banks of exynos5250 pin-controller 2 */ 747 + static struct samsung_pin_bank exynos5250_pin_banks2[] = { 748 + EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpv0", 0x00), 749 + EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpv1", 0x04), 750 + EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpv2", 0x08), 751 + EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpv3", 0x0c), 752 + EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpv4", 0x10), 753 + }; 754 + 755 + /* pin banks of exynos5250 pin-controller 3 */ 756 + static struct samsung_pin_bank exynos5250_pin_banks3[] = { 757 + EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz", 0x00), 758 + }; 759 + 760 + /* 761 + * Samsung pinctrl driver data for Exynos5250 SoC. Exynos5250 SoC includes 762 + * four gpio/pin-mux/pinconfig controllers. 763 + */ 764 + struct samsung_pin_ctrl exynos5250_pin_ctrl[] = { 765 + { 766 + /* pin-controller instance 0 data */ 767 + .pin_banks = exynos5250_pin_banks0, 768 + .nr_banks = ARRAY_SIZE(exynos5250_pin_banks0), 769 + .geint_con = EXYNOS_GPIO_ECON_OFFSET, 770 + .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, 771 + .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, 772 + .weint_con = EXYNOS_WKUP_ECON_OFFSET, 773 + .weint_mask = EXYNOS_WKUP_EMASK_OFFSET, 774 + .weint_pend = EXYNOS_WKUP_EPEND_OFFSET, 775 + .svc = EXYNOS_SVC_OFFSET, 776 + .eint_gpio_init = exynos_eint_gpio_init, 777 + .eint_wkup_init = exynos_eint_wkup_init, 778 + .label = "exynos5250-gpio-ctrl0", 779 + }, { 780 + /* pin-controller instance 1 data */ 781 + .pin_banks = exynos5250_pin_banks1, 782 + .nr_banks = ARRAY_SIZE(exynos5250_pin_banks1), 783 + .geint_con = EXYNOS_GPIO_ECON_OFFSET, 784 + .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, 785 + .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, 786 + .svc = EXYNOS_SVC_OFFSET, 787 + .eint_gpio_init = exynos_eint_gpio_init, 788 + .label = "exynos5250-gpio-ctrl1", 789 + }, { 790 + /* pin-controller instance 2 data */ 791 + .pin_banks = exynos5250_pin_banks2, 792 + .nr_banks = ARRAY_SIZE(exynos5250_pin_banks2), 793 + .geint_con = EXYNOS_GPIO_ECON_OFFSET, 794 + .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, 795 + .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, 796 + .svc = EXYNOS_SVC_OFFSET, 797 + .eint_gpio_init = exynos_eint_gpio_init, 798 + .label = "exynos5250-gpio-ctrl2", 799 + }, { 800 + /* pin-controller instance 3 data */ 801 + .pin_banks = exynos5250_pin_banks3, 802 + .nr_banks = ARRAY_SIZE(exynos5250_pin_banks3), 803 + .geint_con = EXYNOS_GPIO_ECON_OFFSET, 804 + .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, 805 + .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, 806 + .svc = EXYNOS_SVC_OFFSET, 807 + .eint_gpio_init = exynos_eint_gpio_init, 808 + .label = "exynos5250-gpio-ctrl3", 809 + }, 810 + };
+2
drivers/pinctrl/pinctrl-samsung.c
··· 970 970 .data = (void *)exynos4210_pin_ctrl }, 971 971 { .compatible = "samsung,exynos4x12-pinctrl", 972 972 .data = (void *)exynos4x12_pin_ctrl }, 973 + { .compatible = "samsung,exynos5250-pinctrl", 974 + .data = (void *)exynos5250_pin_ctrl }, 973 975 #endif 974 976 #ifdef CONFIG_PINCTRL_S3C64XX 975 977 { .compatible = "samsung,s3c64xx-pinctrl",
+1
drivers/pinctrl/pinctrl-samsung.h
··· 244 244 /* list of all exported SoC specific data */ 245 245 extern struct samsung_pin_ctrl exynos4210_pin_ctrl[]; 246 246 extern struct samsung_pin_ctrl exynos4x12_pin_ctrl[]; 247 + extern struct samsung_pin_ctrl exynos5250_pin_ctrl[]; 247 248 extern struct samsung_pin_ctrl s3c64xx_pin_ctrl[]; 248 249 249 250 #endif /* __PINCTRL_SAMSUNG_H */
+3 -3
drivers/pinctrl/sh-pfc/pfc-sh73a0.c
··· 2733 2733 { }, 2734 2734 }; 2735 2735 2736 - /* IRQ pins through INTCS with IRQ0->15 from 0x200 and IRQ16-31 from 0x3200 */ 2737 - #define EXT_IRQ16L(n) intcs_evt2irq(0x200 + ((n) << 5)) 2738 - #define EXT_IRQ16H(n) intcs_evt2irq(0x3200 + ((n - 16) << 5)) 2736 + /* External IRQ pins mapped at IRQPIN_BASE */ 2737 + #define EXT_IRQ16L(n) irq_pin(n) 2738 + #define EXT_IRQ16H(n) irq_pin(n) 2739 2739 2740 2740 static struct pinmux_irq pinmux_irqs[] = { 2741 2741 PINMUX_IRQ(EXT_IRQ16H(19), PORT9_FN0),
+52
drivers/pinctrl/vt8500/Kconfig
··· 1 + # 2 + # VIA/Wondermedia PINCTRL drivers 3 + # 4 + 5 + if ARCH_VT8500 6 + 7 + config PINCTRL_WMT 8 + bool 9 + select PINMUX 10 + select GENERIC_PINCONF 11 + 12 + config PINCTRL_VT8500 13 + bool "VIA VT8500 pin controller driver" 14 + depends on ARCH_WM8505 15 + select PINCTRL_WMT 16 + help 17 + Say yes here to support the gpio/pin control module on 18 + VIA VT8500 SoCs. 19 + 20 + config PINCTRL_WM8505 21 + bool "Wondermedia WM8505 pin controller driver" 22 + depends on ARCH_WM8505 23 + select PINCTRL_WMT 24 + help 25 + Say yes here to support the gpio/pin control module on 26 + Wondermedia WM8505 SoCs. 27 + 28 + config PINCTRL_WM8650 29 + bool "Wondermedia WM8650 pin controller driver" 30 + depends on ARCH_WM8505 31 + select PINCTRL_WMT 32 + help 33 + Say yes here to support the gpio/pin control module on 34 + Wondermedia WM8650 SoCs. 35 + 36 + config PINCTRL_WM8750 37 + bool "Wondermedia WM8750 pin controller driver" 38 + depends on ARCH_WM8750 39 + select PINCTRL_WMT 40 + help 41 + Say yes here to support the gpio/pin control module on 42 + Wondermedia WM8750 SoCs. 43 + 44 + config PINCTRL_WM8850 45 + bool "Wondermedia WM8850 pin controller driver" 46 + depends on ARCH_WM8850 47 + select PINCTRL_WMT 48 + help 49 + Say yes here to support the gpio/pin control module on 50 + Wondermedia WM8850 SoCs. 51 + 52 + endif
+8
drivers/pinctrl/vt8500/Makefile
··· 1 + # VIA/Wondermedia pinctrl support 2 + 3 + obj-$(CONFIG_PINCTRL_WMT) += pinctrl-wmt.o 4 + obj-$(CONFIG_PINCTRL_VT8500) += pinctrl-vt8500.o 5 + obj-$(CONFIG_PINCTRL_WM8505) += pinctrl-wm8505.o 6 + obj-$(CONFIG_PINCTRL_WM8650) += pinctrl-wm8650.o 7 + obj-$(CONFIG_PINCTRL_WM8750) += pinctrl-wm8750.o 8 + obj-$(CONFIG_PINCTRL_WM8850) += pinctrl-wm8850.o
+501
drivers/pinctrl/vt8500/pinctrl-vt8500.c
··· 1 + /* 2 + * Pinctrl data for VIA VT8500 SoC 3 + * 4 + * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope it will be useful, but WITHOUT 11 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + * more details. 14 + */ 15 + 16 + #include <linux/io.h> 17 + #include <linux/module.h> 18 + #include <linux/pinctrl/pinctrl.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/slab.h> 21 + 22 + #include "pinctrl-wmt.h" 23 + 24 + /* 25 + * Describe the register offsets within the GPIO memory space 26 + * The dedicated external GPIO's should always be listed in bank 0 27 + * so they are exported in the 0..31 range which is what users 28 + * expect. 29 + * 30 + * Do not reorder these banks as it will change the pin numbering 31 + */ 32 + static const struct wmt_pinctrl_bank_registers vt8500_banks[] = { 33 + WMT_PINCTRL_BANK(NO_REG, 0x3C, 0x5C, 0x7C, NO_REG, NO_REG), /* 0 */ 34 + WMT_PINCTRL_BANK(0x00, 0x20, 0x40, 0x60, NO_REG, NO_REG), /* 1 */ 35 + WMT_PINCTRL_BANK(0x04, 0x24, 0x44, 0x64, NO_REG, NO_REG), /* 2 */ 36 + WMT_PINCTRL_BANK(0x08, 0x28, 0x48, 0x68, NO_REG, NO_REG), /* 3 */ 37 + WMT_PINCTRL_BANK(0x0C, 0x2C, 0x4C, 0x6C, NO_REG, NO_REG), /* 4 */ 38 + WMT_PINCTRL_BANK(0x10, 0x30, 0x50, 0x70, NO_REG, NO_REG), /* 5 */ 39 + WMT_PINCTRL_BANK(0x14, 0x34, 0x54, 0x74, NO_REG, NO_REG), /* 6 */ 40 + }; 41 + 42 + /* Please keep sorted by bank/bit */ 43 + #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) 44 + #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) 45 + #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) 46 + #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) 47 + #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) 48 + #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) 49 + #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) 50 + #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) 51 + #define WMT_PIN_EXTGPIO8 WMT_PIN(0, 8) 52 + #define WMT_PIN_UART0RTS WMT_PIN(1, 0) 53 + #define WMT_PIN_UART0TXD WMT_PIN(1, 1) 54 + #define WMT_PIN_UART0CTS WMT_PIN(1, 2) 55 + #define WMT_PIN_UART0RXD WMT_PIN(1, 3) 56 + #define WMT_PIN_UART1RTS WMT_PIN(1, 4) 57 + #define WMT_PIN_UART1TXD WMT_PIN(1, 5) 58 + #define WMT_PIN_UART1CTS WMT_PIN(1, 6) 59 + #define WMT_PIN_UART1RXD WMT_PIN(1, 7) 60 + #define WMT_PIN_SPI0CLK WMT_PIN(1, 8) 61 + #define WMT_PIN_SPI0SS WMT_PIN(1, 9) 62 + #define WMT_PIN_SPI0MISO WMT_PIN(1, 10) 63 + #define WMT_PIN_SPI0MOSI WMT_PIN(1, 11) 64 + #define WMT_PIN_SPI1CLK WMT_PIN(1, 12) 65 + #define WMT_PIN_SPI1SS WMT_PIN(1, 13) 66 + #define WMT_PIN_SPI1MISO WMT_PIN(1, 14) 67 + #define WMT_PIN_SPI1MOSI WMT_PIN(1, 15) 68 + #define WMT_PIN_SPI2CLK WMT_PIN(1, 16) 69 + #define WMT_PIN_SPI2SS WMT_PIN(1, 17) 70 + #define WMT_PIN_SPI2MISO WMT_PIN(1, 18) 71 + #define WMT_PIN_SPI2MOSI WMT_PIN(1, 19) 72 + #define WMT_PIN_SDDATA0 WMT_PIN(2, 0) 73 + #define WMT_PIN_SDDATA1 WMT_PIN(2, 1) 74 + #define WMT_PIN_SDDATA2 WMT_PIN(2, 2) 75 + #define WMT_PIN_SDDATA3 WMT_PIN(2, 3) 76 + #define WMT_PIN_MMCDATA0 WMT_PIN(2, 4) 77 + #define WMT_PIN_MMCDATA1 WMT_PIN(2, 5) 78 + #define WMT_PIN_MMCDATA2 WMT_PIN(2, 6) 79 + #define WMT_PIN_MMCDATA3 WMT_PIN(2, 7) 80 + #define WMT_PIN_SDCLK WMT_PIN(2, 8) 81 + #define WMT_PIN_SDWP WMT_PIN(2, 9) 82 + #define WMT_PIN_SDCMD WMT_PIN(2, 10) 83 + #define WMT_PIN_MSDATA0 WMT_PIN(2, 16) 84 + #define WMT_PIN_MSDATA1 WMT_PIN(2, 17) 85 + #define WMT_PIN_MSDATA2 WMT_PIN(2, 18) 86 + #define WMT_PIN_MSDATA3 WMT_PIN(2, 19) 87 + #define WMT_PIN_MSCLK WMT_PIN(2, 20) 88 + #define WMT_PIN_MSBS WMT_PIN(2, 21) 89 + #define WMT_PIN_MSINS WMT_PIN(2, 22) 90 + #define WMT_PIN_I2C0SCL WMT_PIN(2, 24) 91 + #define WMT_PIN_I2C0SDA WMT_PIN(2, 25) 92 + #define WMT_PIN_I2C1SCL WMT_PIN(2, 26) 93 + #define WMT_PIN_I2C1SDA WMT_PIN(2, 27) 94 + #define WMT_PIN_MII0RXD0 WMT_PIN(3, 0) 95 + #define WMT_PIN_MII0RXD1 WMT_PIN(3, 1) 96 + #define WMT_PIN_MII0RXD2 WMT_PIN(3, 2) 97 + #define WMT_PIN_MII0RXD3 WMT_PIN(3, 3) 98 + #define WMT_PIN_MII0RXCLK WMT_PIN(3, 4) 99 + #define WMT_PIN_MII0RXDV WMT_PIN(3, 5) 100 + #define WMT_PIN_MII0RXERR WMT_PIN(3, 6) 101 + #define WMT_PIN_MII0PHYRST WMT_PIN(3, 7) 102 + #define WMT_PIN_MII0TXD0 WMT_PIN(3, 8) 103 + #define WMT_PIN_MII0TXD1 WMT_PIN(3, 9) 104 + #define WMT_PIN_MII0TXD2 WMT_PIN(3, 10) 105 + #define WMT_PIN_MII0TXD3 WMT_PIN(3, 11) 106 + #define WMT_PIN_MII0TXCLK WMT_PIN(3, 12) 107 + #define WMT_PIN_MII0TXEN WMT_PIN(3, 13) 108 + #define WMT_PIN_MII0TXERR WMT_PIN(3, 14) 109 + #define WMT_PIN_MII0PHYPD WMT_PIN(3, 15) 110 + #define WMT_PIN_MII0COL WMT_PIN(3, 16) 111 + #define WMT_PIN_MII0CRS WMT_PIN(3, 17) 112 + #define WMT_PIN_MII0MDIO WMT_PIN(3, 18) 113 + #define WMT_PIN_MII0MDC WMT_PIN(3, 19) 114 + #define WMT_PIN_SEECS WMT_PIN(3, 20) 115 + #define WMT_PIN_SEECK WMT_PIN(3, 21) 116 + #define WMT_PIN_SEEDI WMT_PIN(3, 22) 117 + #define WMT_PIN_SEEDO WMT_PIN(3, 23) 118 + #define WMT_PIN_IDEDREQ0 WMT_PIN(3, 24) 119 + #define WMT_PIN_IDEDREQ1 WMT_PIN(3, 25) 120 + #define WMT_PIN_IDEIOW WMT_PIN(3, 26) 121 + #define WMT_PIN_IDEIOR WMT_PIN(3, 27) 122 + #define WMT_PIN_IDEDACK WMT_PIN(3, 28) 123 + #define WMT_PIN_IDEIORDY WMT_PIN(3, 29) 124 + #define WMT_PIN_IDEINTRQ WMT_PIN(3, 30) 125 + #define WMT_PIN_VDIN0 WMT_PIN(4, 0) 126 + #define WMT_PIN_VDIN1 WMT_PIN(4, 1) 127 + #define WMT_PIN_VDIN2 WMT_PIN(4, 2) 128 + #define WMT_PIN_VDIN3 WMT_PIN(4, 3) 129 + #define WMT_PIN_VDIN4 WMT_PIN(4, 4) 130 + #define WMT_PIN_VDIN5 WMT_PIN(4, 5) 131 + #define WMT_PIN_VDIN6 WMT_PIN(4, 6) 132 + #define WMT_PIN_VDIN7 WMT_PIN(4, 7) 133 + #define WMT_PIN_VDOUT0 WMT_PIN(4, 8) 134 + #define WMT_PIN_VDOUT1 WMT_PIN(4, 9) 135 + #define WMT_PIN_VDOUT2 WMT_PIN(4, 10) 136 + #define WMT_PIN_VDOUT3 WMT_PIN(4, 11) 137 + #define WMT_PIN_VDOUT4 WMT_PIN(4, 12) 138 + #define WMT_PIN_VDOUT5 WMT_PIN(4, 13) 139 + #define WMT_PIN_NANDCLE0 WMT_PIN(4, 14) 140 + #define WMT_PIN_NANDCLE1 WMT_PIN(4, 15) 141 + #define WMT_PIN_VDOUT6_7 WMT_PIN(4, 16) 142 + #define WMT_PIN_VHSYNC WMT_PIN(4, 17) 143 + #define WMT_PIN_VVSYNC WMT_PIN(4, 18) 144 + #define WMT_PIN_TSDIN0 WMT_PIN(5, 8) 145 + #define WMT_PIN_TSDIN1 WMT_PIN(5, 9) 146 + #define WMT_PIN_TSDIN2 WMT_PIN(5, 10) 147 + #define WMT_PIN_TSDIN3 WMT_PIN(5, 11) 148 + #define WMT_PIN_TSDIN4 WMT_PIN(5, 12) 149 + #define WMT_PIN_TSDIN5 WMT_PIN(5, 13) 150 + #define WMT_PIN_TSDIN6 WMT_PIN(5, 14) 151 + #define WMT_PIN_TSDIN7 WMT_PIN(5, 15) 152 + #define WMT_PIN_TSSYNC WMT_PIN(5, 16) 153 + #define WMT_PIN_TSVALID WMT_PIN(5, 17) 154 + #define WMT_PIN_TSCLK WMT_PIN(5, 18) 155 + #define WMT_PIN_LCDD0 WMT_PIN(6, 0) 156 + #define WMT_PIN_LCDD1 WMT_PIN(6, 1) 157 + #define WMT_PIN_LCDD2 WMT_PIN(6, 2) 158 + #define WMT_PIN_LCDD3 WMT_PIN(6, 3) 159 + #define WMT_PIN_LCDD4 WMT_PIN(6, 4) 160 + #define WMT_PIN_LCDD5 WMT_PIN(6, 5) 161 + #define WMT_PIN_LCDD6 WMT_PIN(6, 6) 162 + #define WMT_PIN_LCDD7 WMT_PIN(6, 7) 163 + #define WMT_PIN_LCDD8 WMT_PIN(6, 8) 164 + #define WMT_PIN_LCDD9 WMT_PIN(6, 9) 165 + #define WMT_PIN_LCDD10 WMT_PIN(6, 10) 166 + #define WMT_PIN_LCDD11 WMT_PIN(6, 11) 167 + #define WMT_PIN_LCDD12 WMT_PIN(6, 12) 168 + #define WMT_PIN_LCDD13 WMT_PIN(6, 13) 169 + #define WMT_PIN_LCDD14 WMT_PIN(6, 14) 170 + #define WMT_PIN_LCDD15 WMT_PIN(6, 15) 171 + #define WMT_PIN_LCDD16 WMT_PIN(6, 16) 172 + #define WMT_PIN_LCDD17 WMT_PIN(6, 17) 173 + #define WMT_PIN_LCDCLK WMT_PIN(6, 18) 174 + #define WMT_PIN_LCDDEN WMT_PIN(6, 19) 175 + #define WMT_PIN_LCDLINE WMT_PIN(6, 20) 176 + #define WMT_PIN_LCDFRM WMT_PIN(6, 21) 177 + #define WMT_PIN_LCDBIAS WMT_PIN(6, 22) 178 + 179 + static const struct pinctrl_pin_desc vt8500_pins[] = { 180 + PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), 181 + PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), 182 + PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), 183 + PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), 184 + PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), 185 + PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), 186 + PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), 187 + PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), 188 + PINCTRL_PIN(WMT_PIN_EXTGPIO8, "extgpio8"), 189 + PINCTRL_PIN(WMT_PIN_UART0RTS, "uart0_rts"), 190 + PINCTRL_PIN(WMT_PIN_UART0TXD, "uart0_txd"), 191 + PINCTRL_PIN(WMT_PIN_UART0CTS, "uart0_cts"), 192 + PINCTRL_PIN(WMT_PIN_UART0RXD, "uart0_rxd"), 193 + PINCTRL_PIN(WMT_PIN_UART1RTS, "uart1_rts"), 194 + PINCTRL_PIN(WMT_PIN_UART1TXD, "uart1_txd"), 195 + PINCTRL_PIN(WMT_PIN_UART1CTS, "uart1_cts"), 196 + PINCTRL_PIN(WMT_PIN_UART1RXD, "uart1_rxd"), 197 + PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"), 198 + PINCTRL_PIN(WMT_PIN_SPI0SS, "spi0_ss"), 199 + PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"), 200 + PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"), 201 + PINCTRL_PIN(WMT_PIN_SPI1CLK, "spi1_clk"), 202 + PINCTRL_PIN(WMT_PIN_SPI1SS, "spi1_ss"), 203 + PINCTRL_PIN(WMT_PIN_SPI1MISO, "spi1_miso"), 204 + PINCTRL_PIN(WMT_PIN_SPI1MOSI, "spi1_mosi"), 205 + PINCTRL_PIN(WMT_PIN_SPI2CLK, "spi2_clk"), 206 + PINCTRL_PIN(WMT_PIN_SPI2SS, "spi2_ss"), 207 + PINCTRL_PIN(WMT_PIN_SPI2MISO, "spi2_miso"), 208 + PINCTRL_PIN(WMT_PIN_SPI2MOSI, "spi2_mosi"), 209 + PINCTRL_PIN(WMT_PIN_SDDATA0, "sd_data0"), 210 + PINCTRL_PIN(WMT_PIN_SDDATA1, "sd_data1"), 211 + PINCTRL_PIN(WMT_PIN_SDDATA2, "sd_data2"), 212 + PINCTRL_PIN(WMT_PIN_SDDATA3, "sd_data3"), 213 + PINCTRL_PIN(WMT_PIN_MMCDATA0, "mmc_data0"), 214 + PINCTRL_PIN(WMT_PIN_MMCDATA1, "mmc_data1"), 215 + PINCTRL_PIN(WMT_PIN_MMCDATA2, "mmc_data2"), 216 + PINCTRL_PIN(WMT_PIN_MMCDATA3, "mmc_data3"), 217 + PINCTRL_PIN(WMT_PIN_SDCLK, "sd_clk"), 218 + PINCTRL_PIN(WMT_PIN_SDWP, "sd_wp"), 219 + PINCTRL_PIN(WMT_PIN_SDCMD, "sd_cmd"), 220 + PINCTRL_PIN(WMT_PIN_MSDATA0, "ms_data0"), 221 + PINCTRL_PIN(WMT_PIN_MSDATA1, "ms_data1"), 222 + PINCTRL_PIN(WMT_PIN_MSDATA2, "ms_data2"), 223 + PINCTRL_PIN(WMT_PIN_MSDATA3, "ms_data3"), 224 + PINCTRL_PIN(WMT_PIN_MSCLK, "ms_clk"), 225 + PINCTRL_PIN(WMT_PIN_MSBS, "ms_bs"), 226 + PINCTRL_PIN(WMT_PIN_MSINS, "ms_ins"), 227 + PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"), 228 + PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"), 229 + PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"), 230 + PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"), 231 + PINCTRL_PIN(WMT_PIN_MII0RXD0, "mii0_rxd0"), 232 + PINCTRL_PIN(WMT_PIN_MII0RXD1, "mii0_rxd1"), 233 + PINCTRL_PIN(WMT_PIN_MII0RXD2, "mii0_rxd2"), 234 + PINCTRL_PIN(WMT_PIN_MII0RXD3, "mii0_rxd3"), 235 + PINCTRL_PIN(WMT_PIN_MII0RXCLK, "mii0_rxclk"), 236 + PINCTRL_PIN(WMT_PIN_MII0RXDV, "mii0_rxdv"), 237 + PINCTRL_PIN(WMT_PIN_MII0RXERR, "mii0_rxerr"), 238 + PINCTRL_PIN(WMT_PIN_MII0PHYRST, "mii0_phyrst"), 239 + PINCTRL_PIN(WMT_PIN_MII0TXD0, "mii0_txd0"), 240 + PINCTRL_PIN(WMT_PIN_MII0TXD1, "mii0_txd1"), 241 + PINCTRL_PIN(WMT_PIN_MII0TXD2, "mii0_txd2"), 242 + PINCTRL_PIN(WMT_PIN_MII0TXD3, "mii0_txd3"), 243 + PINCTRL_PIN(WMT_PIN_MII0TXCLK, "mii0_txclk"), 244 + PINCTRL_PIN(WMT_PIN_MII0TXEN, "mii0_txen"), 245 + PINCTRL_PIN(WMT_PIN_MII0TXERR, "mii0_txerr"), 246 + PINCTRL_PIN(WMT_PIN_MII0PHYPD, "mii0_phypd"), 247 + PINCTRL_PIN(WMT_PIN_MII0COL, "mii0_col"), 248 + PINCTRL_PIN(WMT_PIN_MII0CRS, "mii0_crs"), 249 + PINCTRL_PIN(WMT_PIN_MII0MDIO, "mii0_mdio"), 250 + PINCTRL_PIN(WMT_PIN_MII0MDC, "mii0_mdc"), 251 + PINCTRL_PIN(WMT_PIN_SEECS, "see_cs"), 252 + PINCTRL_PIN(WMT_PIN_SEECK, "see_ck"), 253 + PINCTRL_PIN(WMT_PIN_SEEDI, "see_di"), 254 + PINCTRL_PIN(WMT_PIN_SEEDO, "see_do"), 255 + PINCTRL_PIN(WMT_PIN_IDEDREQ0, "ide_dreq0"), 256 + PINCTRL_PIN(WMT_PIN_IDEDREQ1, "ide_dreq1"), 257 + PINCTRL_PIN(WMT_PIN_IDEIOW, "ide_iow"), 258 + PINCTRL_PIN(WMT_PIN_IDEIOR, "ide_ior"), 259 + PINCTRL_PIN(WMT_PIN_IDEDACK, "ide_dack"), 260 + PINCTRL_PIN(WMT_PIN_IDEIORDY, "ide_iordy"), 261 + PINCTRL_PIN(WMT_PIN_IDEINTRQ, "ide_intrq"), 262 + PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), 263 + PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), 264 + PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), 265 + PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), 266 + PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), 267 + PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), 268 + PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), 269 + PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), 270 + PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), 271 + PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), 272 + PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), 273 + PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), 274 + PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), 275 + PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), 276 + PINCTRL_PIN(WMT_PIN_NANDCLE0, "nand_cle0"), 277 + PINCTRL_PIN(WMT_PIN_NANDCLE1, "nand_cle1"), 278 + PINCTRL_PIN(WMT_PIN_VDOUT6_7, "vdout6_7"), 279 + PINCTRL_PIN(WMT_PIN_VHSYNC, "vhsync"), 280 + PINCTRL_PIN(WMT_PIN_VVSYNC, "vvsync"), 281 + PINCTRL_PIN(WMT_PIN_TSDIN0, "tsdin0"), 282 + PINCTRL_PIN(WMT_PIN_TSDIN1, "tsdin1"), 283 + PINCTRL_PIN(WMT_PIN_TSDIN2, "tsdin2"), 284 + PINCTRL_PIN(WMT_PIN_TSDIN3, "tsdin3"), 285 + PINCTRL_PIN(WMT_PIN_TSDIN4, "tsdin4"), 286 + PINCTRL_PIN(WMT_PIN_TSDIN5, "tsdin5"), 287 + PINCTRL_PIN(WMT_PIN_TSDIN6, "tsdin6"), 288 + PINCTRL_PIN(WMT_PIN_TSDIN7, "tsdin7"), 289 + PINCTRL_PIN(WMT_PIN_TSSYNC, "tssync"), 290 + PINCTRL_PIN(WMT_PIN_TSVALID, "tsvalid"), 291 + PINCTRL_PIN(WMT_PIN_TSCLK, "tsclk"), 292 + PINCTRL_PIN(WMT_PIN_LCDD0, "lcd_d0"), 293 + PINCTRL_PIN(WMT_PIN_LCDD1, "lcd_d1"), 294 + PINCTRL_PIN(WMT_PIN_LCDD2, "lcd_d2"), 295 + PINCTRL_PIN(WMT_PIN_LCDD3, "lcd_d3"), 296 + PINCTRL_PIN(WMT_PIN_LCDD4, "lcd_d4"), 297 + PINCTRL_PIN(WMT_PIN_LCDD5, "lcd_d5"), 298 + PINCTRL_PIN(WMT_PIN_LCDD6, "lcd_d6"), 299 + PINCTRL_PIN(WMT_PIN_LCDD7, "lcd_d7"), 300 + PINCTRL_PIN(WMT_PIN_LCDD8, "lcd_d8"), 301 + PINCTRL_PIN(WMT_PIN_LCDD9, "lcd_d9"), 302 + PINCTRL_PIN(WMT_PIN_LCDD10, "lcd_d10"), 303 + PINCTRL_PIN(WMT_PIN_LCDD11, "lcd_d11"), 304 + PINCTRL_PIN(WMT_PIN_LCDD12, "lcd_d12"), 305 + PINCTRL_PIN(WMT_PIN_LCDD13, "lcd_d13"), 306 + PINCTRL_PIN(WMT_PIN_LCDD14, "lcd_d14"), 307 + PINCTRL_PIN(WMT_PIN_LCDD15, "lcd_d15"), 308 + PINCTRL_PIN(WMT_PIN_LCDD16, "lcd_d16"), 309 + PINCTRL_PIN(WMT_PIN_LCDD17, "lcd_d17"), 310 + PINCTRL_PIN(WMT_PIN_LCDCLK, "lcd_clk"), 311 + PINCTRL_PIN(WMT_PIN_LCDDEN, "lcd_den"), 312 + PINCTRL_PIN(WMT_PIN_LCDLINE, "lcd_line"), 313 + PINCTRL_PIN(WMT_PIN_LCDFRM, "lcd_frm"), 314 + PINCTRL_PIN(WMT_PIN_LCDBIAS, "lcd_bias"), 315 + }; 316 + 317 + /* Order of these names must match the above list */ 318 + static const char * const vt8500_groups[] = { 319 + "extgpio0", 320 + "extgpio1", 321 + "extgpio2", 322 + "extgpio3", 323 + "extgpio4", 324 + "extgpio5", 325 + "extgpio6", 326 + "extgpio7", 327 + "extgpio8", 328 + "uart0_rts", 329 + "uart0_txd", 330 + "uart0_cts", 331 + "uart0_rxd", 332 + "uart1_rts", 333 + "uart1_txd", 334 + "uart1_cts", 335 + "uart1_rxd", 336 + "spi0_clk", 337 + "spi0_ss", 338 + "spi0_miso", 339 + "spi0_mosi", 340 + "spi1_clk", 341 + "spi1_ss", 342 + "spi1_miso", 343 + "spi1_mosi", 344 + "spi2_clk", 345 + "spi2_ss", 346 + "spi2_miso", 347 + "spi2_mosi", 348 + "sd_data0", 349 + "sd_data1", 350 + "sd_data2", 351 + "sd_data3", 352 + "mmc_data0", 353 + "mmc_data1", 354 + "mmc_data2", 355 + "mmc_data3", 356 + "sd_clk", 357 + "sd_wp", 358 + "sd_cmd", 359 + "ms_data0", 360 + "ms_data1", 361 + "ms_data2", 362 + "ms_data3", 363 + "ms_clk", 364 + "ms_bs", 365 + "ms_ins", 366 + "i2c0_scl", 367 + "i2c0_sda", 368 + "i2c1_scl", 369 + "i2c1_sda", 370 + "mii0_rxd0", 371 + "mii0_rxd1", 372 + "mii0_rxd2", 373 + "mii0_rxd3", 374 + "mii0_rxclk", 375 + "mii0_rxdv", 376 + "mii0_rxerr", 377 + "mii0_phyrst", 378 + "mii0_txd0", 379 + "mii0_txd1", 380 + "mii0_txd2", 381 + "mii0_txd3", 382 + "mii0_txclk", 383 + "mii0_txen", 384 + "mii0_txerr", 385 + "mii0_phypd", 386 + "mii0_col", 387 + "mii0_crs", 388 + "mii0_mdio", 389 + "mii0_mdc", 390 + "see_cs", 391 + "see_ck", 392 + "see_di", 393 + "see_do", 394 + "ide_dreq0", 395 + "ide_dreq1", 396 + "ide_iow", 397 + "ide_ior", 398 + "ide_dack", 399 + "ide_iordy", 400 + "ide_intrq", 401 + "vdin0", 402 + "vdin1", 403 + "vdin2", 404 + "vdin3", 405 + "vdin4", 406 + "vdin5", 407 + "vdin6", 408 + "vdin7", 409 + "vdout0", 410 + "vdout1", 411 + "vdout2", 412 + "vdout3", 413 + "vdout4", 414 + "vdout5", 415 + "nand_cle0", 416 + "nand_cle1", 417 + "vdout6_7", 418 + "vhsync", 419 + "vvsync", 420 + "tsdin0", 421 + "tsdin1", 422 + "tsdin2", 423 + "tsdin3", 424 + "tsdin4", 425 + "tsdin5", 426 + "tsdin6", 427 + "tsdin7", 428 + "tssync", 429 + "tsvalid", 430 + "tsclk", 431 + "lcd_d0", 432 + "lcd_d1", 433 + "lcd_d2", 434 + "lcd_d3", 435 + "lcd_d4", 436 + "lcd_d5", 437 + "lcd_d6", 438 + "lcd_d7", 439 + "lcd_d8", 440 + "lcd_d9", 441 + "lcd_d10", 442 + "lcd_d11", 443 + "lcd_d12", 444 + "lcd_d13", 445 + "lcd_d14", 446 + "lcd_d15", 447 + "lcd_d16", 448 + "lcd_d17", 449 + "lcd_clk", 450 + "lcd_den", 451 + "lcd_line", 452 + "lcd_frm", 453 + "lcd_bias", 454 + }; 455 + 456 + static int vt8500_pinctrl_probe(struct platform_device *pdev) 457 + { 458 + struct wmt_pinctrl_data *data; 459 + 460 + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 461 + if (!data) { 462 + dev_err(&pdev->dev, "failed to allocate data\n"); 463 + return -ENOMEM; 464 + } 465 + 466 + data->banks = vt8500_banks; 467 + data->nbanks = ARRAY_SIZE(vt8500_banks); 468 + data->pins = vt8500_pins; 469 + data->npins = ARRAY_SIZE(vt8500_pins); 470 + data->groups = vt8500_groups; 471 + data->ngroups = ARRAY_SIZE(vt8500_groups); 472 + 473 + return wmt_pinctrl_probe(pdev, data); 474 + } 475 + 476 + static int vt8500_pinctrl_remove(struct platform_device *pdev) 477 + { 478 + return wmt_pinctrl_remove(pdev); 479 + } 480 + 481 + static struct of_device_id wmt_pinctrl_of_match[] = { 482 + { .compatible = "via,vt8500-pinctrl" }, 483 + { /* sentinel */ }, 484 + }; 485 + 486 + static struct platform_driver wmt_pinctrl_driver = { 487 + .probe = vt8500_pinctrl_probe, 488 + .remove = vt8500_pinctrl_remove, 489 + .driver = { 490 + .name = "pinctrl-vt8500", 491 + .owner = THIS_MODULE, 492 + .of_match_table = wmt_pinctrl_of_match, 493 + }, 494 + }; 495 + 496 + module_platform_driver(wmt_pinctrl_driver); 497 + 498 + MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); 499 + MODULE_DESCRIPTION("VIA VT8500 Pincontrol driver"); 500 + MODULE_LICENSE("GPL v2"); 501 + MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match);
+532
drivers/pinctrl/vt8500/pinctrl-wm8505.c
··· 1 + /* 2 + * Pinctrl data for Wondermedia WM8505 SoC 3 + * 4 + * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope it will be useful, but WITHOUT 11 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + * more details. 14 + */ 15 + 16 + #include <linux/io.h> 17 + #include <linux/module.h> 18 + #include <linux/pinctrl/pinctrl.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/slab.h> 21 + 22 + #include "pinctrl-wmt.h" 23 + 24 + /* 25 + * Describe the register offsets within the GPIO memory space 26 + * The dedicated external GPIO's should always be listed in bank 0 27 + * so they are exported in the 0..31 range which is what users 28 + * expect. 29 + * 30 + * Do not reorder these banks as it will change the pin numbering 31 + */ 32 + static const struct wmt_pinctrl_bank_registers wm8505_banks[] = { 33 + WMT_PINCTRL_BANK(0x64, 0x8C, 0xB4, 0xDC, NO_REG, NO_REG), /* 0 */ 34 + WMT_PINCTRL_BANK(0x40, 0x68, 0x90, 0xB8, NO_REG, NO_REG), /* 1 */ 35 + WMT_PINCTRL_BANK(0x44, 0x6C, 0x94, 0xBC, NO_REG, NO_REG), /* 2 */ 36 + WMT_PINCTRL_BANK(0x48, 0x70, 0x98, 0xC0, NO_REG, NO_REG), /* 3 */ 37 + WMT_PINCTRL_BANK(0x4C, 0x74, 0x9C, 0xC4, NO_REG, NO_REG), /* 4 */ 38 + WMT_PINCTRL_BANK(0x50, 0x78, 0xA0, 0xC8, NO_REG, NO_REG), /* 5 */ 39 + WMT_PINCTRL_BANK(0x54, 0x7C, 0xA4, 0xD0, NO_REG, NO_REG), /* 6 */ 40 + WMT_PINCTRL_BANK(0x58, 0x80, 0xA8, 0xD4, NO_REG, NO_REG), /* 7 */ 41 + WMT_PINCTRL_BANK(0x5C, 0x84, 0xAC, 0xD8, NO_REG, NO_REG), /* 8 */ 42 + WMT_PINCTRL_BANK(0x60, 0x88, 0xB0, 0xDC, NO_REG, NO_REG), /* 9 */ 43 + WMT_PINCTRL_BANK(0x500, 0x504, 0x508, 0x50C, NO_REG, NO_REG), /* 10 */ 44 + }; 45 + 46 + /* Please keep sorted by bank/bit */ 47 + #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) 48 + #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) 49 + #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) 50 + #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) 51 + #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) 52 + #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) 53 + #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) 54 + #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) 55 + #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) 56 + #define WMT_PIN_WAKEUP1 WMT_PIN(0, 17) 57 + #define WMT_PIN_WAKEUP2 WMT_PIN(0, 18) 58 + #define WMT_PIN_WAKEUP3 WMT_PIN(0, 19) 59 + #define WMT_PIN_SUSGPIO0 WMT_PIN(0, 21) 60 + #define WMT_PIN_SDDATA0 WMT_PIN(1, 0) 61 + #define WMT_PIN_SDDATA1 WMT_PIN(1, 1) 62 + #define WMT_PIN_SDDATA2 WMT_PIN(1, 2) 63 + #define WMT_PIN_SDDATA3 WMT_PIN(1, 3) 64 + #define WMT_PIN_MMCDATA0 WMT_PIN(1, 4) 65 + #define WMT_PIN_MMCDATA1 WMT_PIN(1, 5) 66 + #define WMT_PIN_MMCDATA2 WMT_PIN(1, 6) 67 + #define WMT_PIN_MMCDATA3 WMT_PIN(1, 7) 68 + #define WMT_PIN_VDIN0 WMT_PIN(2, 0) 69 + #define WMT_PIN_VDIN1 WMT_PIN(2, 1) 70 + #define WMT_PIN_VDIN2 WMT_PIN(2, 2) 71 + #define WMT_PIN_VDIN3 WMT_PIN(2, 3) 72 + #define WMT_PIN_VDIN4 WMT_PIN(2, 4) 73 + #define WMT_PIN_VDIN5 WMT_PIN(2, 5) 74 + #define WMT_PIN_VDIN6 WMT_PIN(2, 6) 75 + #define WMT_PIN_VDIN7 WMT_PIN(2, 7) 76 + #define WMT_PIN_VDOUT0 WMT_PIN(2, 8) 77 + #define WMT_PIN_VDOUT1 WMT_PIN(2, 9) 78 + #define WMT_PIN_VDOUT2 WMT_PIN(2, 10) 79 + #define WMT_PIN_VDOUT3 WMT_PIN(2, 11) 80 + #define WMT_PIN_VDOUT4 WMT_PIN(2, 12) 81 + #define WMT_PIN_VDOUT5 WMT_PIN(2, 13) 82 + #define WMT_PIN_VDOUT6 WMT_PIN(2, 14) 83 + #define WMT_PIN_VDOUT7 WMT_PIN(2, 15) 84 + #define WMT_PIN_VDOUT8 WMT_PIN(2, 16) 85 + #define WMT_PIN_VDOUT9 WMT_PIN(2, 17) 86 + #define WMT_PIN_VDOUT10 WMT_PIN(2, 18) 87 + #define WMT_PIN_VDOUT11 WMT_PIN(2, 19) 88 + #define WMT_PIN_VDOUT12 WMT_PIN(2, 20) 89 + #define WMT_PIN_VDOUT13 WMT_PIN(2, 21) 90 + #define WMT_PIN_VDOUT14 WMT_PIN(2, 22) 91 + #define WMT_PIN_VDOUT15 WMT_PIN(2, 23) 92 + #define WMT_PIN_VDOUT16 WMT_PIN(2, 24) 93 + #define WMT_PIN_VDOUT17 WMT_PIN(2, 25) 94 + #define WMT_PIN_VDOUT18 WMT_PIN(2, 26) 95 + #define WMT_PIN_VDOUT19 WMT_PIN(2, 27) 96 + #define WMT_PIN_VDOUT20 WMT_PIN(2, 28) 97 + #define WMT_PIN_VDOUT21 WMT_PIN(2, 29) 98 + #define WMT_PIN_VDOUT22 WMT_PIN(2, 30) 99 + #define WMT_PIN_VDOUT23 WMT_PIN(2, 31) 100 + #define WMT_PIN_VHSYNC WMT_PIN(3, 0) 101 + #define WMT_PIN_VVSYNC WMT_PIN(3, 1) 102 + #define WMT_PIN_VGAHSYNC WMT_PIN(3, 2) 103 + #define WMT_PIN_VGAVSYNC WMT_PIN(3, 3) 104 + #define WMT_PIN_VDHSYNC WMT_PIN(3, 4) 105 + #define WMT_PIN_VDVSYNC WMT_PIN(3, 5) 106 + #define WMT_PIN_NORD0 WMT_PIN(4, 0) 107 + #define WMT_PIN_NORD1 WMT_PIN(4, 1) 108 + #define WMT_PIN_NORD2 WMT_PIN(4, 2) 109 + #define WMT_PIN_NORD3 WMT_PIN(4, 3) 110 + #define WMT_PIN_NORD4 WMT_PIN(4, 4) 111 + #define WMT_PIN_NORD5 WMT_PIN(4, 5) 112 + #define WMT_PIN_NORD6 WMT_PIN(4, 6) 113 + #define WMT_PIN_NORD7 WMT_PIN(4, 7) 114 + #define WMT_PIN_NORD8 WMT_PIN(4, 8) 115 + #define WMT_PIN_NORD9 WMT_PIN(4, 9) 116 + #define WMT_PIN_NORD10 WMT_PIN(4, 10) 117 + #define WMT_PIN_NORD11 WMT_PIN(4, 11) 118 + #define WMT_PIN_NORD12 WMT_PIN(4, 12) 119 + #define WMT_PIN_NORD13 WMT_PIN(4, 13) 120 + #define WMT_PIN_NORD14 WMT_PIN(4, 14) 121 + #define WMT_PIN_NORD15 WMT_PIN(4, 15) 122 + #define WMT_PIN_NORA0 WMT_PIN(5, 0) 123 + #define WMT_PIN_NORA1 WMT_PIN(5, 1) 124 + #define WMT_PIN_NORA2 WMT_PIN(5, 2) 125 + #define WMT_PIN_NORA3 WMT_PIN(5, 3) 126 + #define WMT_PIN_NORA4 WMT_PIN(5, 4) 127 + #define WMT_PIN_NORA5 WMT_PIN(5, 5) 128 + #define WMT_PIN_NORA6 WMT_PIN(5, 6) 129 + #define WMT_PIN_NORA7 WMT_PIN(5, 7) 130 + #define WMT_PIN_NORA8 WMT_PIN(5, 8) 131 + #define WMT_PIN_NORA9 WMT_PIN(5, 9) 132 + #define WMT_PIN_NORA10 WMT_PIN(5, 10) 133 + #define WMT_PIN_NORA11 WMT_PIN(5, 11) 134 + #define WMT_PIN_NORA12 WMT_PIN(5, 12) 135 + #define WMT_PIN_NORA13 WMT_PIN(5, 13) 136 + #define WMT_PIN_NORA14 WMT_PIN(5, 14) 137 + #define WMT_PIN_NORA15 WMT_PIN(5, 15) 138 + #define WMT_PIN_NORA16 WMT_PIN(5, 16) 139 + #define WMT_PIN_NORA17 WMT_PIN(5, 17) 140 + #define WMT_PIN_NORA18 WMT_PIN(5, 18) 141 + #define WMT_PIN_NORA19 WMT_PIN(5, 19) 142 + #define WMT_PIN_NORA20 WMT_PIN(5, 20) 143 + #define WMT_PIN_NORA21 WMT_PIN(5, 21) 144 + #define WMT_PIN_NORA22 WMT_PIN(5, 22) 145 + #define WMT_PIN_NORA23 WMT_PIN(5, 23) 146 + #define WMT_PIN_NORA24 WMT_PIN(5, 24) 147 + #define WMT_PIN_AC97SDI WMT_PIN(6, 0) 148 + #define WMT_PIN_AC97SYNC WMT_PIN(6, 1) 149 + #define WMT_PIN_AC97SDO WMT_PIN(6, 2) 150 + #define WMT_PIN_AC97BCLK WMT_PIN(6, 3) 151 + #define WMT_PIN_AC97RST WMT_PIN(6, 4) 152 + #define WMT_PIN_SFDO WMT_PIN(7, 0) 153 + #define WMT_PIN_SFCS0 WMT_PIN(7, 1) 154 + #define WMT_PIN_SFCS1 WMT_PIN(7, 2) 155 + #define WMT_PIN_SFCLK WMT_PIN(7, 3) 156 + #define WMT_PIN_SFDI WMT_PIN(7, 4) 157 + #define WMT_PIN_SPI0CLK WMT_PIN(8, 0) 158 + #define WMT_PIN_SPI0MISO WMT_PIN(8, 1) 159 + #define WMT_PIN_SPI0MOSI WMT_PIN(8, 2) 160 + #define WMT_PIN_SPI0SS WMT_PIN(8, 3) 161 + #define WMT_PIN_SPI1CLK WMT_PIN(8, 4) 162 + #define WMT_PIN_SPI1MISO WMT_PIN(8, 5) 163 + #define WMT_PIN_SPI1MOSI WMT_PIN(8, 6) 164 + #define WMT_PIN_SPI1SS WMT_PIN(8, 7) 165 + #define WMT_PIN_SPI2CLK WMT_PIN(8, 8) 166 + #define WMT_PIN_SPI2MISO WMT_PIN(8, 9) 167 + #define WMT_PIN_SPI2MOSI WMT_PIN(8, 10) 168 + #define WMT_PIN_SPI2SS WMT_PIN(8, 11) 169 + #define WMT_PIN_UART0_RTS WMT_PIN(9, 0) 170 + #define WMT_PIN_UART0_TXD WMT_PIN(9, 1) 171 + #define WMT_PIN_UART0_CTS WMT_PIN(9, 2) 172 + #define WMT_PIN_UART0_RXD WMT_PIN(9, 3) 173 + #define WMT_PIN_UART1_RTS WMT_PIN(9, 4) 174 + #define WMT_PIN_UART1_TXD WMT_PIN(9, 5) 175 + #define WMT_PIN_UART1_CTS WMT_PIN(9, 6) 176 + #define WMT_PIN_UART1_RXD WMT_PIN(9, 7) 177 + #define WMT_PIN_UART2_RTS WMT_PIN(9, 8) 178 + #define WMT_PIN_UART2_TXD WMT_PIN(9, 9) 179 + #define WMT_PIN_UART2_CTS WMT_PIN(9, 10) 180 + #define WMT_PIN_UART2_RXD WMT_PIN(9, 11) 181 + #define WMT_PIN_UART3_RTS WMT_PIN(9, 12) 182 + #define WMT_PIN_UART3_TXD WMT_PIN(9, 13) 183 + #define WMT_PIN_UART3_CTS WMT_PIN(9, 14) 184 + #define WMT_PIN_UART3_RXD WMT_PIN(9, 15) 185 + #define WMT_PIN_I2C0SCL WMT_PIN(10, 0) 186 + #define WMT_PIN_I2C0SDA WMT_PIN(10, 1) 187 + #define WMT_PIN_I2C1SCL WMT_PIN(10, 2) 188 + #define WMT_PIN_I2C1SDA WMT_PIN(10, 3) 189 + #define WMT_PIN_I2C2SCL WMT_PIN(10, 4) 190 + #define WMT_PIN_I2C2SDA WMT_PIN(10, 5) 191 + 192 + static const struct pinctrl_pin_desc wm8505_pins[] = { 193 + PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), 194 + PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), 195 + PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), 196 + PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), 197 + PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), 198 + PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), 199 + PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), 200 + PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), 201 + PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), 202 + PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), 203 + PINCTRL_PIN(WMT_PIN_WAKEUP2, "wakeup2"), 204 + PINCTRL_PIN(WMT_PIN_WAKEUP3, "wakeup3"), 205 + PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"), 206 + PINCTRL_PIN(WMT_PIN_SDDATA0, "sd_data0"), 207 + PINCTRL_PIN(WMT_PIN_SDDATA1, "sd_data1"), 208 + PINCTRL_PIN(WMT_PIN_SDDATA2, "sd_data2"), 209 + PINCTRL_PIN(WMT_PIN_SDDATA3, "sd_data3"), 210 + PINCTRL_PIN(WMT_PIN_MMCDATA0, "mmc_data0"), 211 + PINCTRL_PIN(WMT_PIN_MMCDATA1, "mmc_data1"), 212 + PINCTRL_PIN(WMT_PIN_MMCDATA2, "mmc_data2"), 213 + PINCTRL_PIN(WMT_PIN_MMCDATA3, "mmc_data3"), 214 + PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), 215 + PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), 216 + PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), 217 + PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), 218 + PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), 219 + PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), 220 + PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), 221 + PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), 222 + PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), 223 + PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), 224 + PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), 225 + PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), 226 + PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), 227 + PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), 228 + PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), 229 + PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), 230 + PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), 231 + PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), 232 + PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), 233 + PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), 234 + PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), 235 + PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), 236 + PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), 237 + PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), 238 + PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), 239 + PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), 240 + PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), 241 + PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), 242 + PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), 243 + PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), 244 + PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), 245 + PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), 246 + PINCTRL_PIN(WMT_PIN_VHSYNC, "v_hsync"), 247 + PINCTRL_PIN(WMT_PIN_VVSYNC, "v_vsync"), 248 + PINCTRL_PIN(WMT_PIN_VGAHSYNC, "vga_hsync"), 249 + PINCTRL_PIN(WMT_PIN_VGAVSYNC, "vga_vsync"), 250 + PINCTRL_PIN(WMT_PIN_VDHSYNC, "vd_hsync"), 251 + PINCTRL_PIN(WMT_PIN_VDVSYNC, "vd_vsync"), 252 + PINCTRL_PIN(WMT_PIN_NORD0, "nor_d0"), 253 + PINCTRL_PIN(WMT_PIN_NORD1, "nor_d1"), 254 + PINCTRL_PIN(WMT_PIN_NORD2, "nor_d2"), 255 + PINCTRL_PIN(WMT_PIN_NORD3, "nor_d3"), 256 + PINCTRL_PIN(WMT_PIN_NORD4, "nor_d4"), 257 + PINCTRL_PIN(WMT_PIN_NORD5, "nor_d5"), 258 + PINCTRL_PIN(WMT_PIN_NORD6, "nor_d6"), 259 + PINCTRL_PIN(WMT_PIN_NORD7, "nor_d7"), 260 + PINCTRL_PIN(WMT_PIN_NORD8, "nor_d8"), 261 + PINCTRL_PIN(WMT_PIN_NORD9, "nor_d9"), 262 + PINCTRL_PIN(WMT_PIN_NORD10, "nor_d10"), 263 + PINCTRL_PIN(WMT_PIN_NORD11, "nor_d11"), 264 + PINCTRL_PIN(WMT_PIN_NORD12, "nor_d12"), 265 + PINCTRL_PIN(WMT_PIN_NORD13, "nor_d13"), 266 + PINCTRL_PIN(WMT_PIN_NORD14, "nor_d14"), 267 + PINCTRL_PIN(WMT_PIN_NORD15, "nor_d15"), 268 + PINCTRL_PIN(WMT_PIN_NORA0, "nor_a0"), 269 + PINCTRL_PIN(WMT_PIN_NORA1, "nor_a1"), 270 + PINCTRL_PIN(WMT_PIN_NORA2, "nor_a2"), 271 + PINCTRL_PIN(WMT_PIN_NORA3, "nor_a3"), 272 + PINCTRL_PIN(WMT_PIN_NORA4, "nor_a4"), 273 + PINCTRL_PIN(WMT_PIN_NORA5, "nor_a5"), 274 + PINCTRL_PIN(WMT_PIN_NORA6, "nor_a6"), 275 + PINCTRL_PIN(WMT_PIN_NORA7, "nor_a7"), 276 + PINCTRL_PIN(WMT_PIN_NORA8, "nor_a8"), 277 + PINCTRL_PIN(WMT_PIN_NORA9, "nor_a9"), 278 + PINCTRL_PIN(WMT_PIN_NORA10, "nor_a10"), 279 + PINCTRL_PIN(WMT_PIN_NORA11, "nor_a11"), 280 + PINCTRL_PIN(WMT_PIN_NORA12, "nor_a12"), 281 + PINCTRL_PIN(WMT_PIN_NORA13, "nor_a13"), 282 + PINCTRL_PIN(WMT_PIN_NORA14, "nor_a14"), 283 + PINCTRL_PIN(WMT_PIN_NORA15, "nor_a15"), 284 + PINCTRL_PIN(WMT_PIN_NORA16, "nor_a16"), 285 + PINCTRL_PIN(WMT_PIN_NORA17, "nor_a17"), 286 + PINCTRL_PIN(WMT_PIN_NORA18, "nor_a18"), 287 + PINCTRL_PIN(WMT_PIN_NORA19, "nor_a19"), 288 + PINCTRL_PIN(WMT_PIN_NORA20, "nor_a20"), 289 + PINCTRL_PIN(WMT_PIN_NORA21, "nor_a21"), 290 + PINCTRL_PIN(WMT_PIN_NORA22, "nor_a22"), 291 + PINCTRL_PIN(WMT_PIN_NORA23, "nor_a23"), 292 + PINCTRL_PIN(WMT_PIN_NORA24, "nor_a24"), 293 + PINCTRL_PIN(WMT_PIN_AC97SDI, "ac97_sdi"), 294 + PINCTRL_PIN(WMT_PIN_AC97SYNC, "ac97_sync"), 295 + PINCTRL_PIN(WMT_PIN_AC97SDO, "ac97_sdo"), 296 + PINCTRL_PIN(WMT_PIN_AC97BCLK, "ac97_bclk"), 297 + PINCTRL_PIN(WMT_PIN_AC97RST, "ac97_rst"), 298 + PINCTRL_PIN(WMT_PIN_SFDO, "sf_do"), 299 + PINCTRL_PIN(WMT_PIN_SFCS0, "sf_cs0"), 300 + PINCTRL_PIN(WMT_PIN_SFCS1, "sf_cs1"), 301 + PINCTRL_PIN(WMT_PIN_SFCLK, "sf_clk"), 302 + PINCTRL_PIN(WMT_PIN_SFDI, "sf_di"), 303 + PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"), 304 + PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"), 305 + PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"), 306 + PINCTRL_PIN(WMT_PIN_SPI0SS, "spi0_ss"), 307 + PINCTRL_PIN(WMT_PIN_SPI1CLK, "spi1_clk"), 308 + PINCTRL_PIN(WMT_PIN_SPI1MISO, "spi1_miso"), 309 + PINCTRL_PIN(WMT_PIN_SPI1MOSI, "spi1_mosi"), 310 + PINCTRL_PIN(WMT_PIN_SPI1SS, "spi1_ss"), 311 + PINCTRL_PIN(WMT_PIN_SPI2CLK, "spi2_clk"), 312 + PINCTRL_PIN(WMT_PIN_SPI2MISO, "spi2_miso"), 313 + PINCTRL_PIN(WMT_PIN_SPI2MOSI, "spi2_mosi"), 314 + PINCTRL_PIN(WMT_PIN_SPI2SS, "spi2_ss"), 315 + PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"), 316 + PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"), 317 + PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"), 318 + PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"), 319 + PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"), 320 + PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"), 321 + PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"), 322 + PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"), 323 + PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"), 324 + PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"), 325 + PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"), 326 + PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"), 327 + PINCTRL_PIN(WMT_PIN_UART3_RTS, "uart3_rts"), 328 + PINCTRL_PIN(WMT_PIN_UART3_TXD, "uart3_txd"), 329 + PINCTRL_PIN(WMT_PIN_UART3_CTS, "uart3_cts"), 330 + PINCTRL_PIN(WMT_PIN_UART3_RXD, "uart3_rxd"), 331 + PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"), 332 + PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"), 333 + PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"), 334 + PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"), 335 + PINCTRL_PIN(WMT_PIN_I2C2SCL, "i2c2_scl"), 336 + PINCTRL_PIN(WMT_PIN_I2C2SDA, "i2c2_sda"), 337 + }; 338 + 339 + /* Order of these names must match the above list */ 340 + static const char * const wm8505_groups[] = { 341 + "extgpio0", 342 + "extgpio1", 343 + "extgpio2", 344 + "extgpio3", 345 + "extgpio4", 346 + "extgpio5", 347 + "extgpio6", 348 + "extgpio7", 349 + "wakeup0", 350 + "wakeup1", 351 + "wakeup2", 352 + "wakeup3", 353 + "susgpio0", 354 + "sd_data0", 355 + "sd_data1", 356 + "sd_data2", 357 + "sd_data3", 358 + "mmc_data0", 359 + "mmc_data1", 360 + "mmc_data2", 361 + "mmc_data3", 362 + "vdin0", 363 + "vdin1", 364 + "vdin2", 365 + "vdin3", 366 + "vdin4", 367 + "vdin5", 368 + "vdin6", 369 + "vdin7", 370 + "vdout0", 371 + "vdout1", 372 + "vdout2", 373 + "vdout3", 374 + "vdout4", 375 + "vdout5", 376 + "vdout6", 377 + "vdout7", 378 + "vdout8", 379 + "vdout9", 380 + "vdout10", 381 + "vdout11", 382 + "vdout12", 383 + "vdout13", 384 + "vdout14", 385 + "vdout15", 386 + "vdout16", 387 + "vdout17", 388 + "vdout18", 389 + "vdout19", 390 + "vdout20", 391 + "vdout21", 392 + "vdout22", 393 + "vdout23", 394 + "v_hsync", 395 + "v_vsync", 396 + "vga_hsync", 397 + "vga_vsync", 398 + "vd_hsync", 399 + "vd_vsync", 400 + "nor_d0", 401 + "nor_d1", 402 + "nor_d2", 403 + "nor_d3", 404 + "nor_d4", 405 + "nor_d5", 406 + "nor_d6", 407 + "nor_d7", 408 + "nor_d8", 409 + "nor_d9", 410 + "nor_d10", 411 + "nor_d11", 412 + "nor_d12", 413 + "nor_d13", 414 + "nor_d14", 415 + "nor_d15", 416 + "nor_a0", 417 + "nor_a1", 418 + "nor_a2", 419 + "nor_a3", 420 + "nor_a4", 421 + "nor_a5", 422 + "nor_a6", 423 + "nor_a7", 424 + "nor_a8", 425 + "nor_a9", 426 + "nor_a10", 427 + "nor_a11", 428 + "nor_a12", 429 + "nor_a13", 430 + "nor_a14", 431 + "nor_a15", 432 + "nor_a16", 433 + "nor_a17", 434 + "nor_a18", 435 + "nor_a19", 436 + "nor_a20", 437 + "nor_a21", 438 + "nor_a22", 439 + "nor_a23", 440 + "nor_a24", 441 + "ac97_sdi", 442 + "ac97_sync", 443 + "ac97_sdo", 444 + "ac97_bclk", 445 + "ac97_rst", 446 + "sf_do", 447 + "sf_cs0", 448 + "sf_cs1", 449 + "sf_clk", 450 + "sf_di", 451 + "spi0_clk", 452 + "spi0_miso", 453 + "spi0_mosi", 454 + "spi0_ss", 455 + "spi1_clk", 456 + "spi1_miso", 457 + "spi1_mosi", 458 + "spi1_ss", 459 + "spi2_clk", 460 + "spi2_miso", 461 + "spi2_mosi", 462 + "spi2_ss", 463 + "uart0_rts", 464 + "uart0_txd", 465 + "uart0_cts", 466 + "uart0_rxd", 467 + "uart1_rts", 468 + "uart1_txd", 469 + "uart1_cts", 470 + "uart1_rxd", 471 + "uart2_rts", 472 + "uart2_txd", 473 + "uart2_cts", 474 + "uart2_rxd", 475 + "uart3_rts", 476 + "uart3_txd", 477 + "uart3_cts", 478 + "uart3_rxd", 479 + "i2c0_scl", 480 + "i2c0_sda", 481 + "i2c1_scl", 482 + "i2c1_sda", 483 + "i2c2_scl", 484 + "i2c2_sda", 485 + }; 486 + 487 + static int wm8505_pinctrl_probe(struct platform_device *pdev) 488 + { 489 + struct wmt_pinctrl_data *data; 490 + 491 + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 492 + if (!data) { 493 + dev_err(&pdev->dev, "failed to allocate data\n"); 494 + return -ENOMEM; 495 + } 496 + 497 + data->banks = wm8505_banks; 498 + data->nbanks = ARRAY_SIZE(wm8505_banks); 499 + data->pins = wm8505_pins; 500 + data->npins = ARRAY_SIZE(wm8505_pins); 501 + data->groups = wm8505_groups; 502 + data->ngroups = ARRAY_SIZE(wm8505_groups); 503 + 504 + return wmt_pinctrl_probe(pdev, data); 505 + } 506 + 507 + static int wm8505_pinctrl_remove(struct platform_device *pdev) 508 + { 509 + return wmt_pinctrl_remove(pdev); 510 + } 511 + 512 + static struct of_device_id wmt_pinctrl_of_match[] = { 513 + { .compatible = "wm,wm8505-pinctrl" }, 514 + { /* sentinel */ }, 515 + }; 516 + 517 + static struct platform_driver wmt_pinctrl_driver = { 518 + .probe = wm8505_pinctrl_probe, 519 + .remove = wm8505_pinctrl_remove, 520 + .driver = { 521 + .name = "pinctrl-wm8505", 522 + .owner = THIS_MODULE, 523 + .of_match_table = wmt_pinctrl_of_match, 524 + }, 525 + }; 526 + 527 + module_platform_driver(wmt_pinctrl_driver); 528 + 529 + MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); 530 + MODULE_DESCRIPTION("Wondermedia WM8505 Pincontrol driver"); 531 + MODULE_LICENSE("GPL v2"); 532 + MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match);
+370
drivers/pinctrl/vt8500/pinctrl-wm8650.c
··· 1 + /* 2 + * Pinctrl data for Wondermedia WM8650 SoC 3 + * 4 + * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope it will be useful, but WITHOUT 11 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + * more details. 14 + */ 15 + 16 + #include <linux/io.h> 17 + #include <linux/module.h> 18 + #include <linux/pinctrl/pinctrl.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/slab.h> 21 + 22 + #include "pinctrl-wmt.h" 23 + 24 + /* 25 + * Describe the register offsets within the GPIO memory space 26 + * The dedicated external GPIO's should always be listed in bank 0 27 + * so they are exported in the 0..31 range which is what users 28 + * expect. 29 + * 30 + * Do not reorder these banks as it will change the pin numbering 31 + */ 32 + static const struct wmt_pinctrl_bank_registers wm8650_banks[] = { 33 + WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0), /* 0 */ 34 + WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4), /* 1 */ 35 + WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8), /* 2 */ 36 + WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC), /* 3 */ 37 + WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0), /* 4 */ 38 + WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4), /* 5 */ 39 + WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8), /* 6 */ 40 + WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC), /* 7 */ 41 + }; 42 + 43 + /* Please keep sorted by bank/bit */ 44 + #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) 45 + #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) 46 + #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) 47 + #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) 48 + #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) 49 + #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) 50 + #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) 51 + #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) 52 + #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) 53 + #define WMT_PIN_WAKEUP1 WMT_PIN(0, 17) 54 + #define WMT_PIN_SUSGPIO0 WMT_PIN(0, 21) 55 + #define WMT_PIN_SD0CD WMT_PIN(0, 28) 56 + #define WMT_PIN_SD1CD WMT_PIN(0, 29) 57 + #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) 58 + #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) 59 + #define WMT_PIN_VDOUT2 WMT_PIN(1, 2) 60 + #define WMT_PIN_VDOUT3 WMT_PIN(1, 3) 61 + #define WMT_PIN_VDOUT4 WMT_PIN(1, 4) 62 + #define WMT_PIN_VDOUT5 WMT_PIN(1, 5) 63 + #define WMT_PIN_VDOUT6 WMT_PIN(1, 6) 64 + #define WMT_PIN_VDOUT7 WMT_PIN(1, 7) 65 + #define WMT_PIN_VDOUT8 WMT_PIN(1, 8) 66 + #define WMT_PIN_VDOUT9 WMT_PIN(1, 9) 67 + #define WMT_PIN_VDOUT10 WMT_PIN(1, 10) 68 + #define WMT_PIN_VDOUT11 WMT_PIN(1, 11) 69 + #define WMT_PIN_VDOUT12 WMT_PIN(1, 12) 70 + #define WMT_PIN_VDOUT13 WMT_PIN(1, 13) 71 + #define WMT_PIN_VDOUT14 WMT_PIN(1, 14) 72 + #define WMT_PIN_VDOUT15 WMT_PIN(1, 15) 73 + #define WMT_PIN_VDOUT16 WMT_PIN(1, 16) 74 + #define WMT_PIN_VDOUT17 WMT_PIN(1, 17) 75 + #define WMT_PIN_VDOUT18 WMT_PIN(1, 18) 76 + #define WMT_PIN_VDOUT19 WMT_PIN(1, 19) 77 + #define WMT_PIN_VDOUT20 WMT_PIN(1, 20) 78 + #define WMT_PIN_VDOUT21 WMT_PIN(1, 21) 79 + #define WMT_PIN_VDOUT22 WMT_PIN(1, 22) 80 + #define WMT_PIN_VDOUT23 WMT_PIN(1, 23) 81 + #define WMT_PIN_VDIN0 WMT_PIN(2, 0) 82 + #define WMT_PIN_VDIN1 WMT_PIN(2, 1) 83 + #define WMT_PIN_VDIN2 WMT_PIN(2, 2) 84 + #define WMT_PIN_VDIN3 WMT_PIN(2, 3) 85 + #define WMT_PIN_VDIN4 WMT_PIN(2, 4) 86 + #define WMT_PIN_VDIN5 WMT_PIN(2, 5) 87 + #define WMT_PIN_VDIN6 WMT_PIN(2, 6) 88 + #define WMT_PIN_VDIN7 WMT_PIN(2, 7) 89 + #define WMT_PIN_I2C1SCL WMT_PIN(2, 12) 90 + #define WMT_PIN_I2C1SDA WMT_PIN(2, 13) 91 + #define WMT_PIN_SPI0MOSI WMT_PIN(2, 24) 92 + #define WMT_PIN_SPI0MISO WMT_PIN(2, 25) 93 + #define WMT_PIN_SPI0SS0 WMT_PIN(2, 26) 94 + #define WMT_PIN_SPI0CLK WMT_PIN(2, 27) 95 + #define WMT_PIN_SD0DATA0 WMT_PIN(3, 8) 96 + #define WMT_PIN_SD0DATA1 WMT_PIN(3, 9) 97 + #define WMT_PIN_SD0DATA2 WMT_PIN(3, 10) 98 + #define WMT_PIN_SD0DATA3 WMT_PIN(3, 11) 99 + #define WMT_PIN_SD0CLK WMT_PIN(3, 12) 100 + #define WMT_PIN_SD0WP WMT_PIN(3, 13) 101 + #define WMT_PIN_SD0CMD WMT_PIN(3, 14) 102 + #define WMT_PIN_SD1DATA0 WMT_PIN(3, 24) 103 + #define WMT_PIN_SD1DATA1 WMT_PIN(3, 25) 104 + #define WMT_PIN_SD1DATA2 WMT_PIN(3, 26) 105 + #define WMT_PIN_SD1DATA3 WMT_PIN(3, 27) 106 + #define WMT_PIN_SD1DATA4 WMT_PIN(3, 28) 107 + #define WMT_PIN_SD1DATA5 WMT_PIN(3, 29) 108 + #define WMT_PIN_SD1DATA6 WMT_PIN(3, 30) 109 + #define WMT_PIN_SD1DATA7 WMT_PIN(3, 31) 110 + #define WMT_PIN_I2C0SCL WMT_PIN(5, 8) 111 + #define WMT_PIN_I2C0SDA WMT_PIN(5, 9) 112 + #define WMT_PIN_UART0RTS WMT_PIN(5, 16) 113 + #define WMT_PIN_UART0TXD WMT_PIN(5, 17) 114 + #define WMT_PIN_UART0CTS WMT_PIN(5, 18) 115 + #define WMT_PIN_UART0RXD WMT_PIN(5, 19) 116 + #define WMT_PIN_UART1RTS WMT_PIN(5, 20) 117 + #define WMT_PIN_UART1TXD WMT_PIN(5, 21) 118 + #define WMT_PIN_UART1CTS WMT_PIN(5, 22) 119 + #define WMT_PIN_UART1RXD WMT_PIN(5, 23) 120 + #define WMT_PIN_UART2RTS WMT_PIN(5, 24) 121 + #define WMT_PIN_UART2TXD WMT_PIN(5, 25) 122 + #define WMT_PIN_UART2CTS WMT_PIN(5, 26) 123 + #define WMT_PIN_UART2RXD WMT_PIN(5, 27) 124 + #define WMT_PIN_UART3RTS WMT_PIN(5, 28) 125 + #define WMT_PIN_UART3TXD WMT_PIN(5, 29) 126 + #define WMT_PIN_UART3CTS WMT_PIN(5, 30) 127 + #define WMT_PIN_UART3RXD WMT_PIN(5, 31) 128 + #define WMT_PIN_KPADROW0 WMT_PIN(6, 16) 129 + #define WMT_PIN_KPADROW1 WMT_PIN(6, 17) 130 + #define WMT_PIN_KPADCOL0 WMT_PIN(6, 18) 131 + #define WMT_PIN_KPADCOL1 WMT_PIN(6, 19) 132 + #define WMT_PIN_SD1CLK WMT_PIN(7, 0) 133 + #define WMT_PIN_SD1CMD WMT_PIN(7, 1) 134 + #define WMT_PIN_SD1WP WMT_PIN(7, 13) 135 + 136 + static const struct pinctrl_pin_desc wm8650_pins[] = { 137 + PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), 138 + PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), 139 + PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), 140 + PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), 141 + PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), 142 + PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), 143 + PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), 144 + PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), 145 + PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), 146 + PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), 147 + PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"), 148 + PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"), 149 + PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"), 150 + PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), 151 + PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), 152 + PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), 153 + PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), 154 + PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), 155 + PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), 156 + PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), 157 + PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), 158 + PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), 159 + PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), 160 + PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), 161 + PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), 162 + PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), 163 + PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), 164 + PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), 165 + PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), 166 + PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), 167 + PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), 168 + PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), 169 + PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), 170 + PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), 171 + PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), 172 + PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), 173 + PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), 174 + PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), 175 + PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), 176 + PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), 177 + PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), 178 + PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), 179 + PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), 180 + PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), 181 + PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), 182 + PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"), 183 + PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"), 184 + PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"), 185 + PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"), 186 + PINCTRL_PIN(WMT_PIN_SPI0SS0, "spi0_ss0"), 187 + PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"), 188 + PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"), 189 + PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"), 190 + PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"), 191 + PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"), 192 + PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"), 193 + PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"), 194 + PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"), 195 + PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"), 196 + PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"), 197 + PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"), 198 + PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"), 199 + PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"), 200 + PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"), 201 + PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"), 202 + PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"), 203 + PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"), 204 + PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"), 205 + PINCTRL_PIN(WMT_PIN_UART0RTS, "uart0_rts"), 206 + PINCTRL_PIN(WMT_PIN_UART0TXD, "uart0_txd"), 207 + PINCTRL_PIN(WMT_PIN_UART0CTS, "uart0_cts"), 208 + PINCTRL_PIN(WMT_PIN_UART0RXD, "uart0_rxd"), 209 + PINCTRL_PIN(WMT_PIN_UART1RTS, "uart1_rts"), 210 + PINCTRL_PIN(WMT_PIN_UART1TXD, "uart1_txd"), 211 + PINCTRL_PIN(WMT_PIN_UART1CTS, "uart1_cts"), 212 + PINCTRL_PIN(WMT_PIN_UART1RXD, "uart1_rxd"), 213 + PINCTRL_PIN(WMT_PIN_UART2RTS, "uart2_rts"), 214 + PINCTRL_PIN(WMT_PIN_UART2TXD, "uart2_txd"), 215 + PINCTRL_PIN(WMT_PIN_UART2CTS, "uart2_cts"), 216 + PINCTRL_PIN(WMT_PIN_UART2RXD, "uart2_rxd"), 217 + PINCTRL_PIN(WMT_PIN_UART3RTS, "uart3_rts"), 218 + PINCTRL_PIN(WMT_PIN_UART3TXD, "uart3_txd"), 219 + PINCTRL_PIN(WMT_PIN_UART3CTS, "uart3_cts"), 220 + PINCTRL_PIN(WMT_PIN_UART3RXD, "uart3_rxd"), 221 + PINCTRL_PIN(WMT_PIN_KPADROW0, "kpadrow0"), 222 + PINCTRL_PIN(WMT_PIN_KPADROW1, "kpadrow1"), 223 + PINCTRL_PIN(WMT_PIN_KPADCOL0, "kpadcol0"), 224 + PINCTRL_PIN(WMT_PIN_KPADCOL1, "kpadcol1"), 225 + PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"), 226 + PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"), 227 + PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"), 228 + }; 229 + 230 + /* Order of these names must match the above list */ 231 + static const char * const wm8650_groups[] = { 232 + "extgpio0", 233 + "extgpio1", 234 + "extgpio2", 235 + "extgpio3", 236 + "extgpio4", 237 + "extgpio5", 238 + "extgpio6", 239 + "extgpio7", 240 + "wakeup0", 241 + "wakeup1", 242 + "susgpio0", 243 + "sd0_cd", 244 + "sd1_cd", 245 + "vdout0", 246 + "vdout1", 247 + "vdout2", 248 + "vdout3", 249 + "vdout4", 250 + "vdout5", 251 + "vdout6", 252 + "vdout7", 253 + "vdout8", 254 + "vdout9", 255 + "vdout10", 256 + "vdout11", 257 + "vdout12", 258 + "vdout13", 259 + "vdout14", 260 + "vdout15", 261 + "vdout16", 262 + "vdout17", 263 + "vdout18", 264 + "vdout19", 265 + "vdout20", 266 + "vdout21", 267 + "vdout22", 268 + "vdout23", 269 + "vdin0", 270 + "vdin1", 271 + "vdin2", 272 + "vdin3", 273 + "vdin4", 274 + "vdin5", 275 + "vdin6", 276 + "vdin7", 277 + "i2c1_scl", 278 + "i2c1_sda", 279 + "spi0_mosi", 280 + "spi0_miso", 281 + "spi0_ss0", 282 + "spi0_clk", 283 + "sd0_data0", 284 + "sd0_data1", 285 + "sd0_data2", 286 + "sd0_data3", 287 + "sd0_clk", 288 + "sd0_wp", 289 + "sd0_cmd", 290 + "sd1_data0", 291 + "sd1_data1", 292 + "sd1_data2", 293 + "sd1_data3", 294 + "sd1_data4", 295 + "sd1_data5", 296 + "sd1_data6", 297 + "sd1_data7", 298 + "i2c0_scl", 299 + "i2c0_sda", 300 + "uart0_rts", 301 + "uart0_txd", 302 + "uart0_cts", 303 + "uart0_rxd", 304 + "uart1_rts", 305 + "uart1_txd", 306 + "uart1_cts", 307 + "uart1_rxd", 308 + "uart2_rts", 309 + "uart2_txd", 310 + "uart2_cts", 311 + "uart2_rxd", 312 + "uart3_rts", 313 + "uart3_txd", 314 + "uart3_cts", 315 + "uart3_rxd", 316 + "kpadrow0", 317 + "kpadrow1", 318 + "kpadcol0", 319 + "kpadcol1", 320 + "sd1_clk", 321 + "sd1_cmd", 322 + "sd1_wp", 323 + }; 324 + 325 + static int wm8650_pinctrl_probe(struct platform_device *pdev) 326 + { 327 + struct wmt_pinctrl_data *data; 328 + 329 + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 330 + if (!data) { 331 + dev_err(&pdev->dev, "failed to allocate data\n"); 332 + return -ENOMEM; 333 + } 334 + 335 + data->banks = wm8650_banks; 336 + data->nbanks = ARRAY_SIZE(wm8650_banks); 337 + data->pins = wm8650_pins; 338 + data->npins = ARRAY_SIZE(wm8650_pins); 339 + data->groups = wm8650_groups; 340 + data->ngroups = ARRAY_SIZE(wm8650_groups); 341 + 342 + return wmt_pinctrl_probe(pdev, data); 343 + } 344 + 345 + static int wm8650_pinctrl_remove(struct platform_device *pdev) 346 + { 347 + return wmt_pinctrl_remove(pdev); 348 + } 349 + 350 + static struct of_device_id wmt_pinctrl_of_match[] = { 351 + { .compatible = "wm,wm8650-pinctrl" }, 352 + { /* sentinel */ }, 353 + }; 354 + 355 + static struct platform_driver wmt_pinctrl_driver = { 356 + .probe = wm8650_pinctrl_probe, 357 + .remove = wm8650_pinctrl_remove, 358 + .driver = { 359 + .name = "pinctrl-wm8650", 360 + .owner = THIS_MODULE, 361 + .of_match_table = wmt_pinctrl_of_match, 362 + }, 363 + }; 364 + 365 + module_platform_driver(wmt_pinctrl_driver); 366 + 367 + MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); 368 + MODULE_DESCRIPTION("Wondermedia WM8650 Pincontrol driver"); 369 + MODULE_LICENSE("GPL v2"); 370 + MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match);
+409
drivers/pinctrl/vt8500/pinctrl-wm8750.c
··· 1 + /* 2 + * Pinctrl data for Wondermedia WM8750 SoC 3 + * 4 + * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope it will be useful, but WITHOUT 11 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + * more details. 14 + */ 15 + 16 + #include <linux/io.h> 17 + #include <linux/module.h> 18 + #include <linux/pinctrl/pinctrl.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/slab.h> 21 + 22 + #include "pinctrl-wmt.h" 23 + 24 + /* 25 + * Describe the register offsets within the GPIO memory space 26 + * The dedicated external GPIO's should always be listed in bank 0 27 + * so they are exported in the 0..31 range which is what users 28 + * expect. 29 + * 30 + * Do not reorder these banks as it will change the pin numbering 31 + */ 32 + static const struct wmt_pinctrl_bank_registers wm8750_banks[] = { 33 + WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0), /* 0 */ 34 + WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4), /* 1 */ 35 + WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8), /* 2 */ 36 + WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC), /* 3 */ 37 + WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0), /* 4 */ 38 + WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4), /* 5 */ 39 + WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8), /* 6 */ 40 + WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC), /* 7 */ 41 + WMT_PINCTRL_BANK(0x60, 0xA0, 0xE0, 0x20, 0x4A0, 0x4E0), /* 8 */ 42 + WMT_PINCTRL_BANK(0x70, 0xB0, 0xF0, 0x30, 0x4B0, 0x4F0), /* 9 */ 43 + WMT_PINCTRL_BANK(0x7C, 0xBC, 0xDC, 0x3C, 0x4BC, 0x4FC), /* 10 */ 44 + }; 45 + 46 + /* Please keep sorted by bank/bit */ 47 + #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) 48 + #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) 49 + #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) 50 + #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) 51 + #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) 52 + #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) 53 + #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) 54 + #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) 55 + #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) 56 + #define WMT_PIN_WAKEUP1 WMT_PIN(0, 16) 57 + #define WMT_PIN_SD0CD WMT_PIN(0, 28) 58 + #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) 59 + #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) 60 + #define WMT_PIN_VDOUT2 WMT_PIN(1, 2) 61 + #define WMT_PIN_VDOUT3 WMT_PIN(1, 3) 62 + #define WMT_PIN_VDOUT4 WMT_PIN(1, 4) 63 + #define WMT_PIN_VDOUT5 WMT_PIN(1, 5) 64 + #define WMT_PIN_VDOUT6 WMT_PIN(1, 6) 65 + #define WMT_PIN_VDOUT7 WMT_PIN(1, 7) 66 + #define WMT_PIN_VDOUT8 WMT_PIN(1, 8) 67 + #define WMT_PIN_VDOUT9 WMT_PIN(1, 9) 68 + #define WMT_PIN_VDOUT10 WMT_PIN(1, 10) 69 + #define WMT_PIN_VDOUT11 WMT_PIN(1, 11) 70 + #define WMT_PIN_VDOUT12 WMT_PIN(1, 12) 71 + #define WMT_PIN_VDOUT13 WMT_PIN(1, 13) 72 + #define WMT_PIN_VDOUT14 WMT_PIN(1, 14) 73 + #define WMT_PIN_VDOUT15 WMT_PIN(1, 15) 74 + #define WMT_PIN_VDOUT16 WMT_PIN(1, 16) 75 + #define WMT_PIN_VDOUT17 WMT_PIN(1, 17) 76 + #define WMT_PIN_VDOUT18 WMT_PIN(1, 18) 77 + #define WMT_PIN_VDOUT19 WMT_PIN(1, 19) 78 + #define WMT_PIN_VDOUT20 WMT_PIN(1, 20) 79 + #define WMT_PIN_VDOUT21 WMT_PIN(1, 21) 80 + #define WMT_PIN_VDOUT22 WMT_PIN(1, 22) 81 + #define WMT_PIN_VDOUT23 WMT_PIN(1, 23) 82 + #define WMT_PIN_VDIN0 WMT_PIN(2, 0) 83 + #define WMT_PIN_VDIN1 WMT_PIN(2, 1) 84 + #define WMT_PIN_VDIN2 WMT_PIN(2, 2) 85 + #define WMT_PIN_VDIN3 WMT_PIN(2, 3) 86 + #define WMT_PIN_VDIN4 WMT_PIN(2, 4) 87 + #define WMT_PIN_VDIN5 WMT_PIN(2, 5) 88 + #define WMT_PIN_VDIN6 WMT_PIN(2, 6) 89 + #define WMT_PIN_VDIN7 WMT_PIN(2, 7) 90 + #define WMT_PIN_SPI0_MOSI WMT_PIN(2, 24) 91 + #define WMT_PIN_SPI0_MISO WMT_PIN(2, 25) 92 + #define WMT_PIN_SPI0_SS WMT_PIN(2, 26) 93 + #define WMT_PIN_SPI0_CLK WMT_PIN(2, 27) 94 + #define WMT_PIN_SPI0_SSB WMT_PIN(2, 28) 95 + #define WMT_PIN_SD0CLK WMT_PIN(3, 17) 96 + #define WMT_PIN_SD0CMD WMT_PIN(3, 18) 97 + #define WMT_PIN_SD0WP WMT_PIN(3, 19) 98 + #define WMT_PIN_SD0DATA0 WMT_PIN(3, 20) 99 + #define WMT_PIN_SD0DATA1 WMT_PIN(3, 21) 100 + #define WMT_PIN_SD0DATA2 WMT_PIN(3, 22) 101 + #define WMT_PIN_SD0DATA3 WMT_PIN(3, 23) 102 + #define WMT_PIN_SD1DATA0 WMT_PIN(3, 24) 103 + #define WMT_PIN_SD1DATA1 WMT_PIN(3, 25) 104 + #define WMT_PIN_SD1DATA2 WMT_PIN(3, 26) 105 + #define WMT_PIN_SD1DATA3 WMT_PIN(3, 27) 106 + #define WMT_PIN_SD1DATA4 WMT_PIN(3, 28) 107 + #define WMT_PIN_SD1DATA5 WMT_PIN(3, 29) 108 + #define WMT_PIN_SD1DATA6 WMT_PIN(3, 30) 109 + #define WMT_PIN_SD1DATA7 WMT_PIN(3, 31) 110 + #define WMT_PIN_I2C0_SCL WMT_PIN(5, 8) 111 + #define WMT_PIN_I2C0_SDA WMT_PIN(5, 9) 112 + #define WMT_PIN_I2C1_SCL WMT_PIN(5, 10) 113 + #define WMT_PIN_I2C1_SDA WMT_PIN(5, 11) 114 + #define WMT_PIN_I2C2_SCL WMT_PIN(5, 12) 115 + #define WMT_PIN_I2C2_SDA WMT_PIN(5, 13) 116 + #define WMT_PIN_UART0_RTS WMT_PIN(5, 16) 117 + #define WMT_PIN_UART0_TXD WMT_PIN(5, 17) 118 + #define WMT_PIN_UART0_CTS WMT_PIN(5, 18) 119 + #define WMT_PIN_UART0_RXD WMT_PIN(5, 19) 120 + #define WMT_PIN_UART1_RTS WMT_PIN(5, 20) 121 + #define WMT_PIN_UART1_TXD WMT_PIN(5, 21) 122 + #define WMT_PIN_UART1_CTS WMT_PIN(5, 22) 123 + #define WMT_PIN_UART1_RXD WMT_PIN(5, 23) 124 + #define WMT_PIN_UART2_RTS WMT_PIN(5, 24) 125 + #define WMT_PIN_UART2_TXD WMT_PIN(5, 25) 126 + #define WMT_PIN_UART2_CTS WMT_PIN(5, 26) 127 + #define WMT_PIN_UART2_RXD WMT_PIN(5, 27) 128 + #define WMT_PIN_UART3_RTS WMT_PIN(5, 28) 129 + #define WMT_PIN_UART3_TXD WMT_PIN(5, 29) 130 + #define WMT_PIN_UART3_CTS WMT_PIN(5, 30) 131 + #define WMT_PIN_UART3_RXD WMT_PIN(5, 31) 132 + #define WMT_PIN_SD2CD WMT_PIN(6, 0) 133 + #define WMT_PIN_SD2DATA3 WMT_PIN(6, 1) 134 + #define WMT_PIN_SD2DATA0 WMT_PIN(6, 2) 135 + #define WMT_PIN_SD2WP WMT_PIN(6, 3) 136 + #define WMT_PIN_SD2DATA1 WMT_PIN(6, 4) 137 + #define WMT_PIN_SD2DATA2 WMT_PIN(6, 5) 138 + #define WMT_PIN_SD2CMD WMT_PIN(6, 6) 139 + #define WMT_PIN_SD2CLK WMT_PIN(6, 7) 140 + #define WMT_PIN_SD2PWR WMT_PIN(6, 9) 141 + #define WMT_PIN_SD1CLK WMT_PIN(7, 0) 142 + #define WMT_PIN_SD1CMD WMT_PIN(7, 1) 143 + #define WMT_PIN_SD1PWR WMT_PIN(7, 10) 144 + #define WMT_PIN_SD1WP WMT_PIN(7, 11) 145 + #define WMT_PIN_SD1CD WMT_PIN(7, 12) 146 + #define WMT_PIN_SPI0SS3 WMT_PIN(7, 24) 147 + #define WMT_PIN_SPI0SS2 WMT_PIN(7, 25) 148 + #define WMT_PIN_PWMOUT1 WMT_PIN(7, 26) 149 + #define WMT_PIN_PWMOUT0 WMT_PIN(7, 27) 150 + 151 + static const struct pinctrl_pin_desc wm8750_pins[] = { 152 + PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), 153 + PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), 154 + PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), 155 + PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), 156 + PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), 157 + PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), 158 + PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), 159 + PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), 160 + PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), 161 + PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), 162 + PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"), 163 + PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), 164 + PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), 165 + PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), 166 + PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), 167 + PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), 168 + PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), 169 + PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), 170 + PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), 171 + PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), 172 + PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), 173 + PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), 174 + PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), 175 + PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), 176 + PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), 177 + PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), 178 + PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), 179 + PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), 180 + PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), 181 + PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), 182 + PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), 183 + PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), 184 + PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), 185 + PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), 186 + PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), 187 + PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), 188 + PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), 189 + PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), 190 + PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), 191 + PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), 192 + PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), 193 + PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), 194 + PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), 195 + PINCTRL_PIN(WMT_PIN_SPI0_MOSI, "spi0_mosi"), 196 + PINCTRL_PIN(WMT_PIN_SPI0_MISO, "spi0_miso"), 197 + PINCTRL_PIN(WMT_PIN_SPI0_SS, "spi0_ss"), 198 + PINCTRL_PIN(WMT_PIN_SPI0_CLK, "spi0_clk"), 199 + PINCTRL_PIN(WMT_PIN_SPI0_SSB, "spi0_ssb"), 200 + PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"), 201 + PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"), 202 + PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"), 203 + PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"), 204 + PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"), 205 + PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"), 206 + PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"), 207 + PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"), 208 + PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"), 209 + PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"), 210 + PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"), 211 + PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"), 212 + PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"), 213 + PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"), 214 + PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"), 215 + PINCTRL_PIN(WMT_PIN_I2C0_SCL, "i2c0_scl"), 216 + PINCTRL_PIN(WMT_PIN_I2C0_SDA, "i2c0_sda"), 217 + PINCTRL_PIN(WMT_PIN_I2C1_SCL, "i2c1_scl"), 218 + PINCTRL_PIN(WMT_PIN_I2C1_SDA, "i2c1_sda"), 219 + PINCTRL_PIN(WMT_PIN_I2C2_SCL, "i2c2_scl"), 220 + PINCTRL_PIN(WMT_PIN_I2C2_SDA, "i2c2_sda"), 221 + PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"), 222 + PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"), 223 + PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"), 224 + PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"), 225 + PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"), 226 + PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"), 227 + PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"), 228 + PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"), 229 + PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"), 230 + PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"), 231 + PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"), 232 + PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"), 233 + PINCTRL_PIN(WMT_PIN_UART3_RTS, "uart3_rts"), 234 + PINCTRL_PIN(WMT_PIN_UART3_TXD, "uart3_txd"), 235 + PINCTRL_PIN(WMT_PIN_UART3_CTS, "uart3_cts"), 236 + PINCTRL_PIN(WMT_PIN_UART3_RXD, "uart3_rxd"), 237 + PINCTRL_PIN(WMT_PIN_SD2CD, "sd2_cd"), 238 + PINCTRL_PIN(WMT_PIN_SD2DATA3, "sd2_data3"), 239 + PINCTRL_PIN(WMT_PIN_SD2DATA0, "sd2_data0"), 240 + PINCTRL_PIN(WMT_PIN_SD2WP, "sd2_wp"), 241 + PINCTRL_PIN(WMT_PIN_SD2DATA1, "sd2_data1"), 242 + PINCTRL_PIN(WMT_PIN_SD2DATA2, "sd2_data2"), 243 + PINCTRL_PIN(WMT_PIN_SD2CMD, "sd2_cmd"), 244 + PINCTRL_PIN(WMT_PIN_SD2CLK, "sd2_clk"), 245 + PINCTRL_PIN(WMT_PIN_SD2PWR, "sd2_pwr"), 246 + PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"), 247 + PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"), 248 + PINCTRL_PIN(WMT_PIN_SD1PWR, "sd1_pwr"), 249 + PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"), 250 + PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"), 251 + PINCTRL_PIN(WMT_PIN_SPI0SS3, "spi0_ss3"), 252 + PINCTRL_PIN(WMT_PIN_SPI0SS2, "spi0_ss2"), 253 + PINCTRL_PIN(WMT_PIN_PWMOUT1, "pwmout1"), 254 + PINCTRL_PIN(WMT_PIN_PWMOUT0, "pwmout0"), 255 + }; 256 + 257 + /* Order of these names must match the above list */ 258 + static const char * const wm8750_groups[] = { 259 + "extgpio0", 260 + "extgpio1", 261 + "extgpio2", 262 + "extgpio3", 263 + "extgpio4", 264 + "extgpio5", 265 + "extgpio6", 266 + "extgpio7", 267 + "wakeup0", 268 + "wakeup1", 269 + "sd0_cd", 270 + "vdout0", 271 + "vdout1", 272 + "vdout2", 273 + "vdout3", 274 + "vdout4", 275 + "vdout5", 276 + "vdout6", 277 + "vdout7", 278 + "vdout8", 279 + "vdout9", 280 + "vdout10", 281 + "vdout11", 282 + "vdout12", 283 + "vdout13", 284 + "vdout14", 285 + "vdout15", 286 + "vdout16", 287 + "vdout17", 288 + "vdout18", 289 + "vdout19", 290 + "vdout20", 291 + "vdout21", 292 + "vdout22", 293 + "vdout23", 294 + "vdin0", 295 + "vdin1", 296 + "vdin2", 297 + "vdin3", 298 + "vdin4", 299 + "vdin5", 300 + "vdin6", 301 + "vdin7", 302 + "spi0_mosi", 303 + "spi0_miso", 304 + "spi0_ss", 305 + "spi0_clk", 306 + "spi0_ssb", 307 + "sd0_clk", 308 + "sd0_cmd", 309 + "sd0_wp", 310 + "sd0_data0", 311 + "sd0_data1", 312 + "sd0_data2", 313 + "sd0_data3", 314 + "sd1_data0", 315 + "sd1_data1", 316 + "sd1_data2", 317 + "sd1_data3", 318 + "sd1_data4", 319 + "sd1_data5", 320 + "sd1_data6", 321 + "sd1_data7", 322 + "i2c0_scl", 323 + "i2c0_sda", 324 + "i2c1_scl", 325 + "i2c1_sda", 326 + "i2c2_scl", 327 + "i2c2_sda", 328 + "uart0_rts", 329 + "uart0_txd", 330 + "uart0_cts", 331 + "uart0_rxd", 332 + "uart1_rts", 333 + "uart1_txd", 334 + "uart1_cts", 335 + "uart1_rxd", 336 + "uart2_rts", 337 + "uart2_txd", 338 + "uart2_cts", 339 + "uart2_rxd", 340 + "uart3_rts", 341 + "uart3_txd", 342 + "uart3_cts", 343 + "uart3_rxd", 344 + "sd2_cd", 345 + "sd2_data3", 346 + "sd2_data0", 347 + "sd2_wp", 348 + "sd2_data1", 349 + "sd2_data2", 350 + "sd2_cmd", 351 + "sd2_clk", 352 + "sd2_pwr", 353 + "sd1_clk", 354 + "sd1_cmd", 355 + "sd1_pwr", 356 + "sd1_wp", 357 + "sd1_cd", 358 + "spi0_ss3", 359 + "spi0_ss2", 360 + "pwmout1", 361 + "pwmout0", 362 + }; 363 + 364 + static int wm8750_pinctrl_probe(struct platform_device *pdev) 365 + { 366 + struct wmt_pinctrl_data *data; 367 + 368 + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 369 + if (!data) { 370 + dev_err(&pdev->dev, "failed to allocate data\n"); 371 + return -ENOMEM; 372 + } 373 + 374 + data->banks = wm8750_banks; 375 + data->nbanks = ARRAY_SIZE(wm8750_banks); 376 + data->pins = wm8750_pins; 377 + data->npins = ARRAY_SIZE(wm8750_pins); 378 + data->groups = wm8750_groups; 379 + data->ngroups = ARRAY_SIZE(wm8750_groups); 380 + 381 + return wmt_pinctrl_probe(pdev, data); 382 + } 383 + 384 + static int wm8750_pinctrl_remove(struct platform_device *pdev) 385 + { 386 + return wmt_pinctrl_remove(pdev); 387 + } 388 + 389 + static struct of_device_id wmt_pinctrl_of_match[] = { 390 + { .compatible = "wm,wm8750-pinctrl" }, 391 + { /* sentinel */ }, 392 + }; 393 + 394 + static struct platform_driver wmt_pinctrl_driver = { 395 + .probe = wm8750_pinctrl_probe, 396 + .remove = wm8750_pinctrl_remove, 397 + .driver = { 398 + .name = "pinctrl-wm8750", 399 + .owner = THIS_MODULE, 400 + .of_match_table = wmt_pinctrl_of_match, 401 + }, 402 + }; 403 + 404 + module_platform_driver(wmt_pinctrl_driver); 405 + 406 + MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); 407 + MODULE_DESCRIPTION("Wondermedia WM8750 Pincontrol driver"); 408 + MODULE_LICENSE("GPL v2"); 409 + MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match);
+388
drivers/pinctrl/vt8500/pinctrl-wm8850.c
··· 1 + /* 2 + * Pinctrl data for Wondermedia WM8850 SoC 3 + * 4 + * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope it will be useful, but WITHOUT 11 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + * more details. 14 + */ 15 + 16 + #include <linux/io.h> 17 + #include <linux/module.h> 18 + #include <linux/pinctrl/pinctrl.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/slab.h> 21 + 22 + #include "pinctrl-wmt.h" 23 + 24 + /* 25 + * Describe the register offsets within the GPIO memory space 26 + * The dedicated external GPIO's should always be listed in bank 0 27 + * so they are exported in the 0..31 range which is what users 28 + * expect. 29 + * 30 + * Do not reorder these banks as it will change the pin numbering 31 + */ 32 + static const struct wmt_pinctrl_bank_registers wm8850_banks[] = { 33 + WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0), /* 0 */ 34 + WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4), /* 1 */ 35 + WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8), /* 2 */ 36 + WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC), /* 3 */ 37 + WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0), /* 4 */ 38 + WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4), /* 5 */ 39 + WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8), /* 6 */ 40 + WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC), /* 7 */ 41 + WMT_PINCTRL_BANK(0x60, 0xA0, 0xE0, 0x20, 0x4A0, 0x4E0), /* 8 */ 42 + WMT_PINCTRL_BANK(0x70, 0xB0, 0xF0, 0x30, 0x4B0, 0x4F0), /* 9 */ 43 + WMT_PINCTRL_BANK(0x7C, 0xBC, 0xDC, 0x3C, 0x4BC, 0x4FC), /* 10 */ 44 + }; 45 + 46 + /* Please keep sorted by bank/bit */ 47 + #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) 48 + #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) 49 + #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) 50 + #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) 51 + #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) 52 + #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) 53 + #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) 54 + #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) 55 + #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) 56 + #define WMT_PIN_WAKEUP1 WMT_PIN(0, 17) 57 + #define WMT_PIN_WAKEUP2 WMT_PIN(0, 18) 58 + #define WMT_PIN_WAKEUP3 WMT_PIN(0, 19) 59 + #define WMT_PIN_SUSGPIO0 WMT_PIN(0, 21) 60 + #define WMT_PIN_SUSGPIO1 WMT_PIN(0, 22) 61 + #define WMT_PIN_SD0CD WMT_PIN(0, 28) 62 + #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) 63 + #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) 64 + #define WMT_PIN_VDOUT2 WMT_PIN(1, 2) 65 + #define WMT_PIN_VDOUT3 WMT_PIN(1, 3) 66 + #define WMT_PIN_VDOUT4 WMT_PIN(1, 4) 67 + #define WMT_PIN_VDOUT5 WMT_PIN(1, 5) 68 + #define WMT_PIN_VDOUT6 WMT_PIN(1, 6) 69 + #define WMT_PIN_VDOUT7 WMT_PIN(1, 7) 70 + #define WMT_PIN_VDOUT8 WMT_PIN(1, 8) 71 + #define WMT_PIN_VDOUT9 WMT_PIN(1, 9) 72 + #define WMT_PIN_VDOUT10 WMT_PIN(1, 10) 73 + #define WMT_PIN_VDOUT11 WMT_PIN(1, 11) 74 + #define WMT_PIN_VDOUT12 WMT_PIN(1, 12) 75 + #define WMT_PIN_VDOUT13 WMT_PIN(1, 13) 76 + #define WMT_PIN_VDOUT14 WMT_PIN(1, 14) 77 + #define WMT_PIN_VDOUT15 WMT_PIN(1, 15) 78 + #define WMT_PIN_VDOUT16 WMT_PIN(1, 16) 79 + #define WMT_PIN_VDOUT17 WMT_PIN(1, 17) 80 + #define WMT_PIN_VDOUT18 WMT_PIN(1, 18) 81 + #define WMT_PIN_VDOUT19 WMT_PIN(1, 19) 82 + #define WMT_PIN_VDOUT20 WMT_PIN(1, 20) 83 + #define WMT_PIN_VDOUT21 WMT_PIN(1, 21) 84 + #define WMT_PIN_VDOUT22 WMT_PIN(1, 22) 85 + #define WMT_PIN_VDOUT23 WMT_PIN(1, 23) 86 + #define WMT_PIN_VDIN0 WMT_PIN(2, 0) 87 + #define WMT_PIN_VDIN1 WMT_PIN(2, 1) 88 + #define WMT_PIN_VDIN2 WMT_PIN(2, 2) 89 + #define WMT_PIN_VDIN3 WMT_PIN(2, 3) 90 + #define WMT_PIN_VDIN4 WMT_PIN(2, 4) 91 + #define WMT_PIN_VDIN5 WMT_PIN(2, 5) 92 + #define WMT_PIN_VDIN6 WMT_PIN(2, 6) 93 + #define WMT_PIN_VDIN7 WMT_PIN(2, 7) 94 + #define WMT_PIN_SPI0_MOSI WMT_PIN(2, 24) 95 + #define WMT_PIN_SPI0_MISO WMT_PIN(2, 25) 96 + #define WMT_PIN_SPI0_SS WMT_PIN(2, 26) 97 + #define WMT_PIN_SPI0_CLK WMT_PIN(2, 27) 98 + #define WMT_PIN_SPI0_SSB WMT_PIN(2, 28) 99 + #define WMT_PIN_SD0CLK WMT_PIN(3, 17) 100 + #define WMT_PIN_SD0CMD WMT_PIN(3, 18) 101 + #define WMT_PIN_SD0WP WMT_PIN(3, 19) 102 + #define WMT_PIN_SD0DATA0 WMT_PIN(3, 20) 103 + #define WMT_PIN_SD0DATA1 WMT_PIN(3, 21) 104 + #define WMT_PIN_SD0DATA2 WMT_PIN(3, 22) 105 + #define WMT_PIN_SD0DATA3 WMT_PIN(3, 23) 106 + #define WMT_PIN_SD1DATA0 WMT_PIN(3, 24) 107 + #define WMT_PIN_SD1DATA1 WMT_PIN(3, 25) 108 + #define WMT_PIN_SD1DATA2 WMT_PIN(3, 26) 109 + #define WMT_PIN_SD1DATA3 WMT_PIN(3, 27) 110 + #define WMT_PIN_SD1DATA4 WMT_PIN(3, 28) 111 + #define WMT_PIN_SD1DATA5 WMT_PIN(3, 29) 112 + #define WMT_PIN_SD1DATA6 WMT_PIN(3, 30) 113 + #define WMT_PIN_SD1DATA7 WMT_PIN(3, 31) 114 + #define WMT_PIN_I2C0_SCL WMT_PIN(5, 8) 115 + #define WMT_PIN_I2C0_SDA WMT_PIN(5, 9) 116 + #define WMT_PIN_I2C1_SCL WMT_PIN(5, 10) 117 + #define WMT_PIN_I2C1_SDA WMT_PIN(5, 11) 118 + #define WMT_PIN_I2C2_SCL WMT_PIN(5, 12) 119 + #define WMT_PIN_I2C2_SDA WMT_PIN(5, 13) 120 + #define WMT_PIN_UART0_RTS WMT_PIN(5, 16) 121 + #define WMT_PIN_UART0_TXD WMT_PIN(5, 17) 122 + #define WMT_PIN_UART0_CTS WMT_PIN(5, 18) 123 + #define WMT_PIN_UART0_RXD WMT_PIN(5, 19) 124 + #define WMT_PIN_UART1_RTS WMT_PIN(5, 20) 125 + #define WMT_PIN_UART1_TXD WMT_PIN(5, 21) 126 + #define WMT_PIN_UART1_CTS WMT_PIN(5, 22) 127 + #define WMT_PIN_UART1_RXD WMT_PIN(5, 23) 128 + #define WMT_PIN_UART2_RTS WMT_PIN(5, 24) 129 + #define WMT_PIN_UART2_TXD WMT_PIN(5, 25) 130 + #define WMT_PIN_UART2_CTS WMT_PIN(5, 26) 131 + #define WMT_PIN_UART2_RXD WMT_PIN(5, 27) 132 + #define WMT_PIN_SD2WP WMT_PIN(6, 3) 133 + #define WMT_PIN_SD2CMD WMT_PIN(6, 6) 134 + #define WMT_PIN_SD2CLK WMT_PIN(6, 7) 135 + #define WMT_PIN_SD2PWR WMT_PIN(6, 9) 136 + #define WMT_PIN_SD1CLK WMT_PIN(7, 0) 137 + #define WMT_PIN_SD1CMD WMT_PIN(7, 1) 138 + #define WMT_PIN_SD1PWR WMT_PIN(7, 10) 139 + #define WMT_PIN_SD1WP WMT_PIN(7, 11) 140 + #define WMT_PIN_SD1CD WMT_PIN(7, 12) 141 + #define WMT_PIN_PWMOUT1 WMT_PIN(7, 26) 142 + #define WMT_PIN_PWMOUT0 WMT_PIN(7, 27) 143 + 144 + static const struct pinctrl_pin_desc wm8850_pins[] = { 145 + PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), 146 + PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), 147 + PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), 148 + PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), 149 + PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), 150 + PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), 151 + PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), 152 + PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), 153 + PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), 154 + PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), 155 + PINCTRL_PIN(WMT_PIN_WAKEUP2, "wakeup2"), 156 + PINCTRL_PIN(WMT_PIN_WAKEUP3, "wakeup3"), 157 + PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"), 158 + PINCTRL_PIN(WMT_PIN_SUSGPIO1, "susgpio1"), 159 + PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"), 160 + PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), 161 + PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), 162 + PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), 163 + PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), 164 + PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), 165 + PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), 166 + PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), 167 + PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), 168 + PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), 169 + PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), 170 + PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), 171 + PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), 172 + PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), 173 + PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), 174 + PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), 175 + PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), 176 + PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), 177 + PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), 178 + PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), 179 + PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), 180 + PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), 181 + PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), 182 + PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), 183 + PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), 184 + PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), 185 + PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), 186 + PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), 187 + PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), 188 + PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), 189 + PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), 190 + PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), 191 + PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), 192 + PINCTRL_PIN(WMT_PIN_SPI0_MOSI, "spi0_mosi"), 193 + PINCTRL_PIN(WMT_PIN_SPI0_MISO, "spi0_miso"), 194 + PINCTRL_PIN(WMT_PIN_SPI0_SS, "spi0_ss"), 195 + PINCTRL_PIN(WMT_PIN_SPI0_CLK, "spi0_clk"), 196 + PINCTRL_PIN(WMT_PIN_SPI0_SSB, "spi0_ssb"), 197 + PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"), 198 + PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"), 199 + PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"), 200 + PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"), 201 + PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"), 202 + PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"), 203 + PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"), 204 + PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"), 205 + PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"), 206 + PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"), 207 + PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"), 208 + PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"), 209 + PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"), 210 + PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"), 211 + PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"), 212 + PINCTRL_PIN(WMT_PIN_I2C0_SCL, "i2c0_scl"), 213 + PINCTRL_PIN(WMT_PIN_I2C0_SDA, "i2c0_sda"), 214 + PINCTRL_PIN(WMT_PIN_I2C1_SCL, "i2c1_scl"), 215 + PINCTRL_PIN(WMT_PIN_I2C1_SDA, "i2c1_sda"), 216 + PINCTRL_PIN(WMT_PIN_I2C2_SCL, "i2c2_scl"), 217 + PINCTRL_PIN(WMT_PIN_I2C2_SDA, "i2c2_sda"), 218 + PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"), 219 + PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"), 220 + PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"), 221 + PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"), 222 + PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"), 223 + PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"), 224 + PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"), 225 + PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"), 226 + PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"), 227 + PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"), 228 + PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"), 229 + PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"), 230 + PINCTRL_PIN(WMT_PIN_SD2WP, "sd2_wp"), 231 + PINCTRL_PIN(WMT_PIN_SD2CMD, "sd2_cmd"), 232 + PINCTRL_PIN(WMT_PIN_SD2CLK, "sd2_clk"), 233 + PINCTRL_PIN(WMT_PIN_SD2PWR, "sd2_pwr"), 234 + PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"), 235 + PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"), 236 + PINCTRL_PIN(WMT_PIN_SD1PWR, "sd1_pwr"), 237 + PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"), 238 + PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"), 239 + PINCTRL_PIN(WMT_PIN_PWMOUT1, "pwmout1"), 240 + PINCTRL_PIN(WMT_PIN_PWMOUT0, "pwmout0"), 241 + }; 242 + 243 + /* Order of these names must match the above list */ 244 + static const char * const wm8850_groups[] = { 245 + "extgpio0", 246 + "extgpio1", 247 + "extgpio2", 248 + "extgpio3", 249 + "extgpio4", 250 + "extgpio5", 251 + "extgpio6", 252 + "extgpio7", 253 + "wakeup0", 254 + "wakeup1", 255 + "wakeup2", 256 + "wakeup3", 257 + "susgpio0", 258 + "susgpio1", 259 + "sd0_cd", 260 + "vdout0", 261 + "vdout1", 262 + "vdout2", 263 + "vdout3", 264 + "vdout4", 265 + "vdout5", 266 + "vdout6", 267 + "vdout7", 268 + "vdout8", 269 + "vdout9", 270 + "vdout10", 271 + "vdout11", 272 + "vdout12", 273 + "vdout13", 274 + "vdout14", 275 + "vdout15", 276 + "vdout16", 277 + "vdout17", 278 + "vdout18", 279 + "vdout19", 280 + "vdout20", 281 + "vdout21", 282 + "vdout22", 283 + "vdout23", 284 + "vdin0", 285 + "vdin1", 286 + "vdin2", 287 + "vdin3", 288 + "vdin4", 289 + "vdin5", 290 + "vdin6", 291 + "vdin7", 292 + "spi0_mosi", 293 + "spi0_miso", 294 + "spi0_ss", 295 + "spi0_clk", 296 + "spi0_ssb", 297 + "sd0_clk", 298 + "sd0_cmd", 299 + "sd0_wp", 300 + "sd0_data0", 301 + "sd0_data1", 302 + "sd0_data2", 303 + "sd0_data3", 304 + "sd1_data0", 305 + "sd1_data1", 306 + "sd1_data2", 307 + "sd1_data3", 308 + "sd1_data4", 309 + "sd1_data5", 310 + "sd1_data6", 311 + "sd1_data7", 312 + "i2c0_scl", 313 + "i2c0_sda", 314 + "i2c1_scl", 315 + "i2c1_sda", 316 + "i2c2_scl", 317 + "i2c2_sda", 318 + "uart0_rts", 319 + "uart0_txd", 320 + "uart0_cts", 321 + "uart0_rxd", 322 + "uart1_rts", 323 + "uart1_txd", 324 + "uart1_cts", 325 + "uart1_rxd", 326 + "uart2_rts", 327 + "uart2_txd", 328 + "uart2_cts", 329 + "uart2_rxd", 330 + "sd2_wp", 331 + "sd2_cmd", 332 + "sd2_clk", 333 + "sd2_pwr", 334 + "sd1_clk", 335 + "sd1_cmd", 336 + "sd1_pwr", 337 + "sd1_wp", 338 + "sd1_cd", 339 + "pwmout1", 340 + "pwmout0", 341 + }; 342 + 343 + static int wm8850_pinctrl_probe(struct platform_device *pdev) 344 + { 345 + struct wmt_pinctrl_data *data; 346 + 347 + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 348 + if (!data) { 349 + dev_err(&pdev->dev, "failed to allocate data\n"); 350 + return -ENOMEM; 351 + } 352 + 353 + data->banks = wm8850_banks; 354 + data->nbanks = ARRAY_SIZE(wm8850_banks); 355 + data->pins = wm8850_pins; 356 + data->npins = ARRAY_SIZE(wm8850_pins); 357 + data->groups = wm8850_groups; 358 + data->ngroups = ARRAY_SIZE(wm8850_groups); 359 + 360 + return wmt_pinctrl_probe(pdev, data); 361 + } 362 + 363 + static int wm8850_pinctrl_remove(struct platform_device *pdev) 364 + { 365 + return wmt_pinctrl_remove(pdev); 366 + } 367 + 368 + static struct of_device_id wmt_pinctrl_of_match[] = { 369 + { .compatible = "wm,wm8850-pinctrl" }, 370 + { /* sentinel */ }, 371 + }; 372 + 373 + static struct platform_driver wmt_pinctrl_driver = { 374 + .probe = wm8850_pinctrl_probe, 375 + .remove = wm8850_pinctrl_remove, 376 + .driver = { 377 + .name = "pinctrl-wm8850", 378 + .owner = THIS_MODULE, 379 + .of_match_table = wmt_pinctrl_of_match, 380 + }, 381 + }; 382 + 383 + module_platform_driver(wmt_pinctrl_driver); 384 + 385 + MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); 386 + MODULE_DESCRIPTION("Wondermedia WM8850 Pincontrol driver"); 387 + MODULE_LICENSE("GPL v2"); 388 + MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match);
+632
drivers/pinctrl/vt8500/pinctrl-wmt.c
··· 1 + /* 2 + * Pinctrl driver for the Wondermedia SoC's 3 + * 4 + * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope it will be useful, but WITHOUT 11 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + * more details. 14 + */ 15 + 16 + #include <linux/err.h> 17 + #include <linux/gpio.h> 18 + #include <linux/interrupt.h> 19 + #include <linux/io.h> 20 + #include <linux/irq.h> 21 + #include <linux/module.h> 22 + #include <linux/of.h> 23 + #include <linux/of_irq.h> 24 + #include <linux/pinctrl/consumer.h> 25 + #include <linux/pinctrl/machine.h> 26 + #include <linux/pinctrl/pinconf.h> 27 + #include <linux/pinctrl/pinconf-generic.h> 28 + #include <linux/pinctrl/pinctrl.h> 29 + #include <linux/pinctrl/pinmux.h> 30 + #include <linux/platform_device.h> 31 + #include <linux/slab.h> 32 + 33 + #include "pinctrl-wmt.h" 34 + 35 + static inline void wmt_setbits(struct wmt_pinctrl_data *data, u32 reg, 36 + u32 mask) 37 + { 38 + u32 val; 39 + 40 + val = readl_relaxed(data->base + reg); 41 + val |= mask; 42 + writel_relaxed(val, data->base + reg); 43 + } 44 + 45 + static inline void wmt_clearbits(struct wmt_pinctrl_data *data, u32 reg, 46 + u32 mask) 47 + { 48 + u32 val; 49 + 50 + val = readl_relaxed(data->base + reg); 51 + val &= ~mask; 52 + writel_relaxed(val, data->base + reg); 53 + } 54 + 55 + enum wmt_func_sel { 56 + WMT_FSEL_GPIO_IN = 0, 57 + WMT_FSEL_GPIO_OUT = 1, 58 + WMT_FSEL_ALT = 2, 59 + WMT_FSEL_COUNT = 3, 60 + }; 61 + 62 + static const char * const wmt_functions[WMT_FSEL_COUNT] = { 63 + [WMT_FSEL_GPIO_IN] = "gpio_in", 64 + [WMT_FSEL_GPIO_OUT] = "gpio_out", 65 + [WMT_FSEL_ALT] = "alt", 66 + }; 67 + 68 + static int wmt_pmx_get_functions_count(struct pinctrl_dev *pctldev) 69 + { 70 + return WMT_FSEL_COUNT; 71 + } 72 + 73 + static const char *wmt_pmx_get_function_name(struct pinctrl_dev *pctldev, 74 + unsigned selector) 75 + { 76 + return wmt_functions[selector]; 77 + } 78 + 79 + static int wmt_pmx_get_function_groups(struct pinctrl_dev *pctldev, 80 + unsigned selector, 81 + const char * const **groups, 82 + unsigned * const num_groups) 83 + { 84 + struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); 85 + 86 + /* every pin does every function */ 87 + *groups = data->groups; 88 + *num_groups = data->ngroups; 89 + 90 + return 0; 91 + } 92 + 93 + static int wmt_set_pinmux(struct wmt_pinctrl_data *data, unsigned func, 94 + unsigned pin) 95 + { 96 + u32 bank = WMT_BANK_FROM_PIN(pin); 97 + u32 bit = WMT_BIT_FROM_PIN(pin); 98 + u32 reg_en = data->banks[bank].reg_en; 99 + u32 reg_dir = data->banks[bank].reg_dir; 100 + 101 + if (reg_dir == NO_REG) { 102 + dev_err(data->dev, "pin:%d no direction register defined\n", 103 + pin); 104 + return -EINVAL; 105 + } 106 + 107 + /* 108 + * If reg_en == NO_REG, we assume it is a dedicated GPIO and cannot be 109 + * disabled (as on VT8500) and that no alternate function is available. 110 + */ 111 + switch (func) { 112 + case WMT_FSEL_GPIO_IN: 113 + if (reg_en != NO_REG) 114 + wmt_setbits(data, reg_en, BIT(bit)); 115 + wmt_clearbits(data, reg_dir, BIT(bit)); 116 + break; 117 + case WMT_FSEL_GPIO_OUT: 118 + if (reg_en != NO_REG) 119 + wmt_setbits(data, reg_en, BIT(bit)); 120 + wmt_setbits(data, reg_dir, BIT(bit)); 121 + break; 122 + case WMT_FSEL_ALT: 123 + if (reg_en == NO_REG) { 124 + dev_err(data->dev, "pin:%d no alt function available\n", 125 + pin); 126 + return -EINVAL; 127 + } 128 + wmt_clearbits(data, reg_en, BIT(bit)); 129 + } 130 + 131 + return 0; 132 + } 133 + 134 + static int wmt_pmx_enable(struct pinctrl_dev *pctldev, 135 + unsigned func_selector, 136 + unsigned group_selector) 137 + { 138 + struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); 139 + u32 pinnum = data->pins[group_selector].number; 140 + 141 + return wmt_set_pinmux(data, func_selector, pinnum); 142 + } 143 + 144 + static void wmt_pmx_disable(struct pinctrl_dev *pctldev, 145 + unsigned func_selector, 146 + unsigned group_selector) 147 + { 148 + struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); 149 + u32 pinnum = data->pins[group_selector].number; 150 + 151 + /* disable by setting GPIO_IN */ 152 + wmt_set_pinmux(data, WMT_FSEL_GPIO_IN, pinnum); 153 + } 154 + 155 + static void wmt_pmx_gpio_disable_free(struct pinctrl_dev *pctldev, 156 + struct pinctrl_gpio_range *range, 157 + unsigned offset) 158 + { 159 + struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); 160 + 161 + /* disable by setting GPIO_IN */ 162 + wmt_set_pinmux(data, WMT_FSEL_GPIO_IN, offset); 163 + } 164 + 165 + static int wmt_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, 166 + struct pinctrl_gpio_range *range, 167 + unsigned offset, 168 + bool input) 169 + { 170 + struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); 171 + 172 + wmt_set_pinmux(data, (input ? WMT_FSEL_GPIO_IN : WMT_FSEL_GPIO_OUT), 173 + offset); 174 + 175 + return 0; 176 + } 177 + 178 + static struct pinmux_ops wmt_pinmux_ops = { 179 + .get_functions_count = wmt_pmx_get_functions_count, 180 + .get_function_name = wmt_pmx_get_function_name, 181 + .get_function_groups = wmt_pmx_get_function_groups, 182 + .enable = wmt_pmx_enable, 183 + .disable = wmt_pmx_disable, 184 + .gpio_disable_free = wmt_pmx_gpio_disable_free, 185 + .gpio_set_direction = wmt_pmx_gpio_set_direction, 186 + }; 187 + 188 + static int wmt_get_groups_count(struct pinctrl_dev *pctldev) 189 + { 190 + struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); 191 + 192 + return data->ngroups; 193 + } 194 + 195 + static const char *wmt_get_group_name(struct pinctrl_dev *pctldev, 196 + unsigned selector) 197 + { 198 + struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); 199 + 200 + return data->groups[selector]; 201 + } 202 + 203 + static int wmt_get_group_pins(struct pinctrl_dev *pctldev, 204 + unsigned selector, 205 + const unsigned **pins, 206 + unsigned *num_pins) 207 + { 208 + struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); 209 + 210 + *pins = &data->pins[selector].number; 211 + *num_pins = 1; 212 + 213 + return 0; 214 + } 215 + 216 + static int wmt_pctl_find_group_by_pin(struct wmt_pinctrl_data *data, u32 pin) 217 + { 218 + int i; 219 + 220 + for (i = 0; i < data->npins; i++) { 221 + if (data->pins[i].number == pin) 222 + return i; 223 + } 224 + 225 + return -EINVAL; 226 + } 227 + 228 + static int wmt_pctl_dt_node_to_map_func(struct wmt_pinctrl_data *data, 229 + struct device_node *np, 230 + u32 pin, u32 fnum, 231 + struct pinctrl_map **maps) 232 + { 233 + int group; 234 + struct pinctrl_map *map = *maps; 235 + 236 + if (fnum >= ARRAY_SIZE(wmt_functions)) { 237 + dev_err(data->dev, "invalid wm,function %d\n", fnum); 238 + return -EINVAL; 239 + } 240 + 241 + group = wmt_pctl_find_group_by_pin(data, pin); 242 + if (group < 0) { 243 + dev_err(data->dev, "unable to match pin %d to group\n", pin); 244 + return group; 245 + } 246 + 247 + map->type = PIN_MAP_TYPE_MUX_GROUP; 248 + map->data.mux.group = data->groups[group]; 249 + map->data.mux.function = wmt_functions[fnum]; 250 + (*maps)++; 251 + 252 + return 0; 253 + } 254 + 255 + static int wmt_pctl_dt_node_to_map_pull(struct wmt_pinctrl_data *data, 256 + struct device_node *np, 257 + u32 pin, u32 pull, 258 + struct pinctrl_map **maps) 259 + { 260 + int group; 261 + unsigned long *configs; 262 + struct pinctrl_map *map = *maps; 263 + 264 + if (pull > 2) { 265 + dev_err(data->dev, "invalid wm,pull %d\n", pull); 266 + return -EINVAL; 267 + } 268 + 269 + group = wmt_pctl_find_group_by_pin(data, pin); 270 + if (group < 0) { 271 + dev_err(data->dev, "unable to match pin %d to group\n", pin); 272 + return group; 273 + } 274 + 275 + configs = kzalloc(sizeof(*configs), GFP_KERNEL); 276 + if (!configs) 277 + return -ENOMEM; 278 + 279 + configs[0] = pull; 280 + 281 + map->type = PIN_MAP_TYPE_CONFIGS_PIN; 282 + map->data.configs.group_or_pin = data->groups[group]; 283 + map->data.configs.configs = configs; 284 + map->data.configs.num_configs = 1; 285 + (*maps)++; 286 + 287 + return 0; 288 + } 289 + 290 + static void wmt_pctl_dt_free_map(struct pinctrl_dev *pctldev, 291 + struct pinctrl_map *maps, 292 + unsigned num_maps) 293 + { 294 + int i; 295 + 296 + for (i = 0; i < num_maps; i++) 297 + if (maps[i].type == PIN_MAP_TYPE_CONFIGS_PIN) 298 + kfree(maps[i].data.configs.configs); 299 + 300 + kfree(maps); 301 + } 302 + 303 + static int wmt_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, 304 + struct device_node *np, 305 + struct pinctrl_map **map, 306 + unsigned *num_maps) 307 + { 308 + struct pinctrl_map *maps, *cur_map; 309 + struct property *pins, *funcs, *pulls; 310 + u32 pin, func, pull; 311 + int num_pins, num_funcs, num_pulls, maps_per_pin; 312 + int i, err; 313 + struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); 314 + 315 + pins = of_find_property(np, "wm,pins", NULL); 316 + if (!pins) { 317 + dev_err(data->dev, "missing wmt,pins property\n"); 318 + return -EINVAL; 319 + } 320 + 321 + funcs = of_find_property(np, "wm,function", NULL); 322 + pulls = of_find_property(np, "wm,pull", NULL); 323 + 324 + if (!funcs && !pulls) { 325 + dev_err(data->dev, "neither wm,function nor wm,pull specified\n"); 326 + return -EINVAL; 327 + } 328 + 329 + /* 330 + * The following lines calculate how many values are defined for each 331 + * of the properties. 332 + */ 333 + num_pins = pins->length / sizeof(u32); 334 + num_funcs = funcs ? (funcs->length / sizeof(u32)) : 0; 335 + num_pulls = pulls ? (pulls->length / sizeof(u32)) : 0; 336 + 337 + if (num_funcs > 1 && num_funcs != num_pins) { 338 + dev_err(data->dev, "wm,function must have 1 or %d entries\n", 339 + num_pins); 340 + return -EINVAL; 341 + } 342 + 343 + if (num_pulls > 1 && num_pulls != num_pins) { 344 + dev_err(data->dev, "wm,pull must have 1 or %d entries\n", 345 + num_pins); 346 + return -EINVAL; 347 + } 348 + 349 + maps_per_pin = 0; 350 + if (num_funcs) 351 + maps_per_pin++; 352 + if (num_pulls) 353 + maps_per_pin++; 354 + 355 + cur_map = maps = kzalloc(num_pins * maps_per_pin * sizeof(*maps), 356 + GFP_KERNEL); 357 + if (!maps) 358 + return -ENOMEM; 359 + 360 + for (i = 0; i < num_pins; i++) { 361 + err = of_property_read_u32_index(np, "wm,pins", i, &pin); 362 + if (err) 363 + goto fail; 364 + 365 + if (pin >= (data->nbanks * 32)) { 366 + dev_err(data->dev, "invalid wm,pins value\n"); 367 + err = -EINVAL; 368 + goto fail; 369 + } 370 + 371 + if (num_funcs) { 372 + err = of_property_read_u32_index(np, "wm,function", 373 + (num_funcs > 1 ? i : 0), &func); 374 + if (err) 375 + goto fail; 376 + 377 + err = wmt_pctl_dt_node_to_map_func(data, np, pin, func, 378 + &cur_map); 379 + if (err) 380 + goto fail; 381 + } 382 + 383 + if (num_pulls) { 384 + err = of_property_read_u32_index(np, "wm,pull", 385 + (num_pulls > 1 ? i : 0), &pull); 386 + if (err) 387 + goto fail; 388 + 389 + err = wmt_pctl_dt_node_to_map_pull(data, np, pin, pull, 390 + &cur_map); 391 + if (err) 392 + goto fail; 393 + } 394 + } 395 + *map = maps; 396 + *num_maps = num_pins * maps_per_pin; 397 + return 0; 398 + 399 + /* 400 + * The fail path removes any maps that have been allocated. The fail path is 401 + * only called from code after maps has been kzalloc'd. It is also safe to 402 + * pass 'num_pins * maps_per_pin' as the map count even though we probably 403 + * failed before all the mappings were read as all maps are allocated at once, 404 + * and configs are only allocated for .type = PIN_MAP_TYPE_CONFIGS_PIN - there 405 + * is no failpath where a config can be allocated without .type being set. 406 + */ 407 + fail: 408 + wmt_pctl_dt_free_map(pctldev, maps, num_pins * maps_per_pin); 409 + return err; 410 + } 411 + 412 + static struct pinctrl_ops wmt_pctl_ops = { 413 + .get_groups_count = wmt_get_groups_count, 414 + .get_group_name = wmt_get_group_name, 415 + .get_group_pins = wmt_get_group_pins, 416 + .dt_node_to_map = wmt_pctl_dt_node_to_map, 417 + .dt_free_map = wmt_pctl_dt_free_map, 418 + }; 419 + 420 + static int wmt_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin, 421 + unsigned long *config) 422 + { 423 + return -ENOTSUPP; 424 + } 425 + 426 + static int wmt_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin, 427 + unsigned long config) 428 + { 429 + struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); 430 + enum pin_config_param param = pinconf_to_config_param(config); 431 + u16 arg = pinconf_to_config_argument(config); 432 + u32 bank = WMT_BANK_FROM_PIN(pin); 433 + u32 bit = WMT_BIT_FROM_PIN(pin); 434 + u32 reg_pull_en = data->banks[bank].reg_pull_en; 435 + u32 reg_pull_cfg = data->banks[bank].reg_pull_cfg; 436 + 437 + if ((reg_pull_en == NO_REG) || (reg_pull_cfg == NO_REG)) { 438 + dev_err(data->dev, "bias functions not supported on pin %d\n", 439 + pin); 440 + return -EINVAL; 441 + } 442 + 443 + if ((param == PIN_CONFIG_BIAS_PULL_DOWN) || 444 + (param == PIN_CONFIG_BIAS_PULL_UP)) { 445 + if (arg == 0) 446 + param = PIN_CONFIG_BIAS_DISABLE; 447 + } 448 + 449 + switch (param) { 450 + case PIN_CONFIG_BIAS_DISABLE: 451 + wmt_clearbits(data, reg_pull_en, BIT(bit)); 452 + break; 453 + case PIN_CONFIG_BIAS_PULL_DOWN: 454 + wmt_clearbits(data, reg_pull_cfg, BIT(bit)); 455 + wmt_setbits(data, reg_pull_en, BIT(bit)); 456 + break; 457 + case PIN_CONFIG_BIAS_PULL_UP: 458 + wmt_setbits(data, reg_pull_cfg, BIT(bit)); 459 + wmt_setbits(data, reg_pull_en, BIT(bit)); 460 + break; 461 + default: 462 + dev_err(data->dev, "unknown pinconf param\n"); 463 + return -EINVAL; 464 + } 465 + 466 + return 0; 467 + } 468 + 469 + static struct pinconf_ops wmt_pinconf_ops = { 470 + .pin_config_get = wmt_pinconf_get, 471 + .pin_config_set = wmt_pinconf_set, 472 + }; 473 + 474 + static struct pinctrl_desc wmt_desc = { 475 + .owner = THIS_MODULE, 476 + .name = "pinctrl-wmt", 477 + .pctlops = &wmt_pctl_ops, 478 + .pmxops = &wmt_pinmux_ops, 479 + .confops = &wmt_pinconf_ops, 480 + }; 481 + 482 + static int wmt_gpio_request(struct gpio_chip *chip, unsigned offset) 483 + { 484 + return pinctrl_request_gpio(chip->base + offset); 485 + } 486 + 487 + static void wmt_gpio_free(struct gpio_chip *chip, unsigned offset) 488 + { 489 + pinctrl_free_gpio(chip->base + offset); 490 + } 491 + 492 + static int wmt_gpio_get_direction(struct gpio_chip *chip, unsigned offset) 493 + { 494 + struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev); 495 + u32 bank = WMT_BANK_FROM_PIN(offset); 496 + u32 bit = WMT_BIT_FROM_PIN(offset); 497 + u32 reg_dir = data->banks[bank].reg_dir; 498 + u32 val; 499 + 500 + val = readl_relaxed(data->base + reg_dir); 501 + if (val & BIT(bit)) 502 + return GPIOF_DIR_OUT; 503 + else 504 + return GPIOF_DIR_IN; 505 + } 506 + 507 + static int wmt_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 508 + { 509 + return pinctrl_gpio_direction_input(chip->base + offset); 510 + } 511 + 512 + static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset, 513 + int value) 514 + { 515 + return pinctrl_gpio_direction_output(chip->base + offset); 516 + } 517 + 518 + static int wmt_gpio_get_value(struct gpio_chip *chip, unsigned offset) 519 + { 520 + struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev); 521 + u32 bank = WMT_BANK_FROM_PIN(offset); 522 + u32 bit = WMT_BIT_FROM_PIN(offset); 523 + u32 reg_data_in = data->banks[bank].reg_data_in; 524 + 525 + if (reg_data_in == NO_REG) { 526 + dev_err(data->dev, "no data in register defined\n"); 527 + return -EINVAL; 528 + } 529 + 530 + return !!(readl_relaxed(data->base + reg_data_in) & BIT(bit)); 531 + } 532 + 533 + static void wmt_gpio_set_value(struct gpio_chip *chip, unsigned offset, 534 + int val) 535 + { 536 + struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev); 537 + u32 bank = WMT_BANK_FROM_PIN(offset); 538 + u32 bit = WMT_BIT_FROM_PIN(offset); 539 + u32 reg_data_out = data->banks[bank].reg_data_out; 540 + 541 + if (reg_data_out == NO_REG) { 542 + dev_err(data->dev, "no data out register defined\n"); 543 + return; 544 + } 545 + 546 + if (val) 547 + wmt_setbits(data, reg_data_out, BIT(bit)); 548 + else 549 + wmt_clearbits(data, reg_data_out, BIT(bit)); 550 + } 551 + 552 + static struct gpio_chip wmt_gpio_chip = { 553 + .label = "gpio-wmt", 554 + .owner = THIS_MODULE, 555 + .request = wmt_gpio_request, 556 + .free = wmt_gpio_free, 557 + .get_direction = wmt_gpio_get_direction, 558 + .direction_input = wmt_gpio_direction_input, 559 + .direction_output = wmt_gpio_direction_output, 560 + .get = wmt_gpio_get_value, 561 + .set = wmt_gpio_set_value, 562 + .can_sleep = 0, 563 + }; 564 + 565 + int wmt_pinctrl_probe(struct platform_device *pdev, 566 + struct wmt_pinctrl_data *data) 567 + { 568 + int err; 569 + struct resource *res; 570 + 571 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 572 + data->base = devm_request_and_ioremap(&pdev->dev, res); 573 + if (!data->base) { 574 + dev_err(&pdev->dev, "failed to map memory resource\n"); 575 + return -EBUSY; 576 + } 577 + 578 + wmt_desc.pins = data->pins; 579 + wmt_desc.npins = data->npins; 580 + 581 + data->gpio_chip = wmt_gpio_chip; 582 + data->gpio_chip.dev = &pdev->dev; 583 + data->gpio_chip.of_node = pdev->dev.of_node; 584 + data->gpio_chip.ngpio = data->nbanks * 32; 585 + 586 + platform_set_drvdata(pdev, data); 587 + 588 + data->dev = &pdev->dev; 589 + 590 + data->pctl_dev = pinctrl_register(&wmt_desc, &pdev->dev, data); 591 + if (!data->pctl_dev) { 592 + dev_err(&pdev->dev, "Failed to register pinctrl\n"); 593 + return -EINVAL; 594 + } 595 + 596 + err = gpiochip_add(&data->gpio_chip); 597 + if (err) { 598 + dev_err(&pdev->dev, "could not add GPIO chip\n"); 599 + goto fail_gpio; 600 + } 601 + 602 + err = gpiochip_add_pin_range(&data->gpio_chip, dev_name(data->dev), 603 + 0, 0, data->nbanks * 32); 604 + if (err) 605 + goto fail_range; 606 + 607 + dev_info(&pdev->dev, "Pin controller initialized\n"); 608 + 609 + return 0; 610 + 611 + fail_range: 612 + err = gpiochip_remove(&data->gpio_chip); 613 + if (err) 614 + dev_err(&pdev->dev, "failed to remove gpio chip\n"); 615 + fail_gpio: 616 + pinctrl_unregister(data->pctl_dev); 617 + return err; 618 + } 619 + 620 + int wmt_pinctrl_remove(struct platform_device *pdev) 621 + { 622 + struct wmt_pinctrl_data *data = platform_get_drvdata(pdev); 623 + int err; 624 + 625 + err = gpiochip_remove(&data->gpio_chip); 626 + if (err) 627 + dev_err(&pdev->dev, "failed to remove gpio chip\n"); 628 + 629 + pinctrl_unregister(data->pctl_dev); 630 + 631 + return 0; 632 + }
+79
drivers/pinctrl/vt8500/pinctrl-wmt.h
··· 1 + /* 2 + * Pinctrl driver for the Wondermedia SoC's 3 + * 4 + * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope it will be useful, but WITHOUT 11 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + * more details. 14 + */ 15 + 16 + #include <linux/gpio.h> 17 + 18 + /* VT8500 has no enable register in the extgpio bank. */ 19 + #define NO_REG 0xFFFF 20 + 21 + #define WMT_PINCTRL_BANK(__en, __dir, __dout, __din, __pen, __pcfg) \ 22 + { \ 23 + .reg_en = __en, \ 24 + .reg_dir = __dir, \ 25 + .reg_data_out = __dout, \ 26 + .reg_data_in = __din, \ 27 + .reg_pull_en = __pen, \ 28 + .reg_pull_cfg = __pcfg, \ 29 + } 30 + 31 + /* Encode/decode the bank/bit pairs into a pin value */ 32 + #define WMT_PIN(__bank, __offset) ((__bank << 5) | __offset) 33 + #define WMT_BANK_FROM_PIN(__pin) (__pin >> 5) 34 + #define WMT_BIT_FROM_PIN(__pin) (__pin & 0x1f) 35 + 36 + #define WMT_GROUP(__name, __data) \ 37 + { \ 38 + .name = __name, \ 39 + .pins = __data, \ 40 + .npins = ARRAY_SIZE(__data), \ 41 + } 42 + 43 + struct wmt_pinctrl_bank_registers { 44 + u32 reg_en; 45 + u32 reg_dir; 46 + u32 reg_data_out; 47 + u32 reg_data_in; 48 + 49 + u32 reg_pull_en; 50 + u32 reg_pull_cfg; 51 + }; 52 + 53 + struct wmt_pinctrl_group { 54 + const char *name; 55 + const unsigned int *pins; 56 + const unsigned npins; 57 + }; 58 + 59 + struct wmt_pinctrl_data { 60 + struct device *dev; 61 + struct pinctrl_dev *pctl_dev; 62 + 63 + /* must be initialized before calling wmt_pinctrl_probe */ 64 + void __iomem *base; 65 + const struct wmt_pinctrl_bank_registers *banks; 66 + const struct pinctrl_pin_desc *pins; 67 + const char * const *groups; 68 + 69 + u32 nbanks; 70 + u32 npins; 71 + u32 ngroups; 72 + 73 + struct gpio_chip gpio_chip; 74 + struct pinctrl_gpio_range gpio_range; 75 + }; 76 + 77 + int wmt_pinctrl_probe(struct platform_device *pdev, 78 + struct wmt_pinctrl_data *data); 79 + int wmt_pinctrl_remove(struct platform_device *pdev);
+13
drivers/reset/Kconfig
··· 1 + config ARCH_HAS_RESET_CONTROLLER 2 + bool 3 + 4 + menuconfig RESET_CONTROLLER 5 + bool "Reset Controller Support" 6 + default y if ARCH_HAS_RESET_CONTROLLER 7 + help 8 + Generic Reset Controller support. 9 + 10 + This framework is designed to abstract reset handling of devices 11 + via GPIOs or SoC-internal reset controller modules. 12 + 13 + If unsure, say no.
+1
drivers/reset/Makefile
··· 1 + obj-$(CONFIG_RESET_CONTROLLER) += core.o
+297
drivers/reset/core.c
··· 1 + /* 2 + * Reset Controller framework 3 + * 4 + * Copyright 2013 Philipp Zabel, Pengutronix 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 + #include <linux/device.h> 12 + #include <linux/err.h> 13 + #include <linux/export.h> 14 + #include <linux/kernel.h> 15 + #include <linux/module.h> 16 + #include <linux/of.h> 17 + #include <linux/reset.h> 18 + #include <linux/reset-controller.h> 19 + #include <linux/slab.h> 20 + 21 + static DEFINE_MUTEX(reset_controller_list_mutex); 22 + static LIST_HEAD(reset_controller_list); 23 + 24 + /** 25 + * struct reset_control - a reset control 26 + * @rcdev: a pointer to the reset controller device 27 + * this reset control belongs to 28 + * @id: ID of the reset controller in the reset 29 + * controller device 30 + */ 31 + struct reset_control { 32 + struct reset_controller_dev *rcdev; 33 + struct device *dev; 34 + unsigned int id; 35 + }; 36 + 37 + /** 38 + * of_reset_simple_xlate - translate reset_spec to the reset line number 39 + * @rcdev: a pointer to the reset controller device 40 + * @reset_spec: reset line specifier as found in the device tree 41 + * @flags: a flags pointer to fill in (optional) 42 + * 43 + * This simple translation function should be used for reset controllers 44 + * with 1:1 mapping, where reset lines can be indexed by number without gaps. 45 + */ 46 + int of_reset_simple_xlate(struct reset_controller_dev *rcdev, 47 + const struct of_phandle_args *reset_spec) 48 + { 49 + if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells)) 50 + return -EINVAL; 51 + 52 + if (reset_spec->args[0] >= rcdev->nr_resets) 53 + return -EINVAL; 54 + 55 + return reset_spec->args[0]; 56 + } 57 + EXPORT_SYMBOL_GPL(of_reset_simple_xlate); 58 + 59 + /** 60 + * reset_controller_register - register a reset controller device 61 + * @rcdev: a pointer to the initialized reset controller device 62 + */ 63 + int reset_controller_register(struct reset_controller_dev *rcdev) 64 + { 65 + if (!rcdev->of_xlate) { 66 + rcdev->of_reset_n_cells = 1; 67 + rcdev->of_xlate = of_reset_simple_xlate; 68 + } 69 + 70 + mutex_lock(&reset_controller_list_mutex); 71 + list_add(&rcdev->list, &reset_controller_list); 72 + mutex_unlock(&reset_controller_list_mutex); 73 + 74 + return 0; 75 + } 76 + EXPORT_SYMBOL_GPL(reset_controller_register); 77 + 78 + /** 79 + * reset_controller_unregister - unregister a reset controller device 80 + * @rcdev: a pointer to the reset controller device 81 + */ 82 + void reset_controller_unregister(struct reset_controller_dev *rcdev) 83 + { 84 + mutex_lock(&reset_controller_list_mutex); 85 + list_del(&rcdev->list); 86 + mutex_unlock(&reset_controller_list_mutex); 87 + } 88 + EXPORT_SYMBOL_GPL(reset_controller_unregister); 89 + 90 + /** 91 + * reset_control_reset - reset the controlled device 92 + * @rstc: reset controller 93 + */ 94 + int reset_control_reset(struct reset_control *rstc) 95 + { 96 + if (rstc->rcdev->ops->reset) 97 + return rstc->rcdev->ops->reset(rstc->rcdev, rstc->id); 98 + 99 + return -ENOSYS; 100 + } 101 + EXPORT_SYMBOL_GPL(reset_control_reset); 102 + 103 + /** 104 + * reset_control_assert - asserts the reset line 105 + * @rstc: reset controller 106 + */ 107 + int reset_control_assert(struct reset_control *rstc) 108 + { 109 + if (rstc->rcdev->ops->assert) 110 + return rstc->rcdev->ops->assert(rstc->rcdev, rstc->id); 111 + 112 + return -ENOSYS; 113 + } 114 + EXPORT_SYMBOL_GPL(reset_control_assert); 115 + 116 + /** 117 + * reset_control_deassert - deasserts the reset line 118 + * @rstc: reset controller 119 + */ 120 + int reset_control_deassert(struct reset_control *rstc) 121 + { 122 + if (rstc->rcdev->ops->deassert) 123 + return rstc->rcdev->ops->deassert(rstc->rcdev, rstc->id); 124 + 125 + return -ENOSYS; 126 + } 127 + EXPORT_SYMBOL_GPL(reset_control_deassert); 128 + 129 + /** 130 + * reset_control_get - Lookup and obtain a reference to a reset controller. 131 + * @dev: device to be reset by the controller 132 + * @id: reset line name 133 + * 134 + * Returns a struct reset_control or IS_ERR() condition containing errno. 135 + * 136 + * Use of id names is optional. 137 + */ 138 + struct reset_control *reset_control_get(struct device *dev, const char *id) 139 + { 140 + struct reset_control *rstc = ERR_PTR(-EPROBE_DEFER); 141 + struct reset_controller_dev *r, *rcdev; 142 + struct of_phandle_args args; 143 + int index = 0; 144 + int rstc_id; 145 + int ret; 146 + 147 + if (!dev) 148 + return ERR_PTR(-EINVAL); 149 + 150 + if (id) 151 + index = of_property_match_string(dev->of_node, 152 + "reset-names", id); 153 + ret = of_parse_phandle_with_args(dev->of_node, "resets", "#reset-cells", 154 + index, &args); 155 + if (ret) 156 + return ERR_PTR(ret); 157 + 158 + mutex_lock(&reset_controller_list_mutex); 159 + rcdev = NULL; 160 + list_for_each_entry(r, &reset_controller_list, list) { 161 + if (args.np == r->of_node) { 162 + rcdev = r; 163 + break; 164 + } 165 + } 166 + of_node_put(args.np); 167 + 168 + if (!rcdev) { 169 + mutex_unlock(&reset_controller_list_mutex); 170 + return ERR_PTR(-ENODEV); 171 + } 172 + 173 + rstc_id = rcdev->of_xlate(rcdev, &args); 174 + if (rstc_id < 0) { 175 + mutex_unlock(&reset_controller_list_mutex); 176 + return ERR_PTR(rstc_id); 177 + } 178 + 179 + try_module_get(rcdev->owner); 180 + mutex_unlock(&reset_controller_list_mutex); 181 + 182 + rstc = kzalloc(sizeof(*rstc), GFP_KERNEL); 183 + if (!rstc) { 184 + module_put(rcdev->owner); 185 + return ERR_PTR(-ENOMEM); 186 + } 187 + 188 + rstc->dev = dev; 189 + rstc->rcdev = rcdev; 190 + rstc->id = rstc_id; 191 + 192 + return rstc; 193 + } 194 + EXPORT_SYMBOL_GPL(reset_control_get); 195 + 196 + /** 197 + * reset_control_put - free the reset controller 198 + * @rstc: reset controller 199 + */ 200 + 201 + void reset_control_put(struct reset_control *rstc) 202 + { 203 + if (IS_ERR(rstc)) 204 + return; 205 + 206 + module_put(rstc->rcdev->owner); 207 + kfree(rstc); 208 + } 209 + EXPORT_SYMBOL_GPL(reset_control_put); 210 + 211 + static void devm_reset_control_release(struct device *dev, void *res) 212 + { 213 + reset_control_put(*(struct reset_control **)res); 214 + } 215 + 216 + /** 217 + * devm_reset_control_get - resource managed reset_control_get() 218 + * @dev: device to be reset by the controller 219 + * @id: reset line name 220 + * 221 + * Managed reset_control_get(). For reset controllers returned from this 222 + * function, reset_control_put() is called automatically on driver detach. 223 + * See reset_control_get() for more information. 224 + */ 225 + struct reset_control *devm_reset_control_get(struct device *dev, const char *id) 226 + { 227 + struct reset_control **ptr, *rstc; 228 + 229 + ptr = devres_alloc(devm_reset_control_release, sizeof(*ptr), 230 + GFP_KERNEL); 231 + if (!ptr) 232 + return ERR_PTR(-ENOMEM); 233 + 234 + rstc = reset_control_get(dev, id); 235 + if (!IS_ERR(rstc)) { 236 + *ptr = rstc; 237 + devres_add(dev, ptr); 238 + } else { 239 + devres_free(ptr); 240 + } 241 + 242 + return rstc; 243 + } 244 + EXPORT_SYMBOL_GPL(devm_reset_control_get); 245 + 246 + static int devm_reset_control_match(struct device *dev, void *res, void *data) 247 + { 248 + struct reset_control **rstc = res; 249 + if (WARN_ON(!rstc || !*rstc)) 250 + return 0; 251 + return *rstc == data; 252 + } 253 + 254 + /** 255 + * devm_reset_control_put - resource managed reset_control_put() 256 + * @rstc: reset controller to free 257 + * 258 + * Deallocate a reset control allocated withd devm_reset_control_get(). 259 + * This function will not need to be called normally, as devres will take 260 + * care of freeing the resource. 261 + */ 262 + void devm_reset_control_put(struct reset_control *rstc) 263 + { 264 + int ret; 265 + 266 + ret = devres_release(rstc->dev, devm_reset_control_release, 267 + devm_reset_control_match, rstc); 268 + if (ret) 269 + WARN_ON(ret); 270 + } 271 + EXPORT_SYMBOL_GPL(devm_reset_control_put); 272 + 273 + /** 274 + * device_reset - find reset controller associated with the device 275 + * and perform reset 276 + * @dev: device to be reset by the controller 277 + * 278 + * Convenience wrapper for reset_control_get() and reset_control_reset(). 279 + * This is useful for the common case of devices with single, dedicated reset 280 + * lines. 281 + */ 282 + int device_reset(struct device *dev) 283 + { 284 + struct reset_control *rstc; 285 + int ret; 286 + 287 + rstc = reset_control_get(dev, NULL); 288 + if (IS_ERR(rstc)) 289 + return PTR_ERR(rstc); 290 + 291 + ret = reset_control_reset(rstc); 292 + 293 + reset_control_put(rstc); 294 + 295 + return ret; 296 + } 297 + EXPORT_SYMBOL_GPL(device_reset);
+92 -28
drivers/video/atmel_lcdfb.c
··· 34 34 #define ATMEL_LCDC_DMA_BURST_LEN 8 /* words */ 35 35 #define ATMEL_LCDC_FIFO_SIZE 512 /* words */ 36 36 37 + struct atmel_lcdfb_config { 38 + bool have_alt_pixclock; 39 + bool have_hozval; 40 + bool have_intensity_bit; 41 + }; 42 + 43 + static struct atmel_lcdfb_config at91sam9261_config = { 44 + .have_hozval = true, 45 + .have_intensity_bit = true, 46 + }; 47 + 48 + static struct atmel_lcdfb_config at91sam9263_config = { 49 + .have_intensity_bit = true, 50 + }; 51 + 52 + static struct atmel_lcdfb_config at91sam9g10_config = { 53 + .have_hozval = true, 54 + }; 55 + 56 + static struct atmel_lcdfb_config at91sam9g45_config = { 57 + .have_alt_pixclock = true, 58 + }; 59 + 60 + static struct atmel_lcdfb_config at91sam9g45es_config = { 61 + }; 62 + 63 + static struct atmel_lcdfb_config at91sam9rl_config = { 64 + .have_intensity_bit = true, 65 + }; 66 + 67 + static struct atmel_lcdfb_config at32ap_config = { 68 + .have_hozval = true, 69 + }; 70 + 71 + static const struct platform_device_id atmel_lcdfb_devtypes[] = { 72 + { 73 + .name = "at91sam9261-lcdfb", 74 + .driver_data = (unsigned long)&at91sam9261_config, 75 + }, { 76 + .name = "at91sam9263-lcdfb", 77 + .driver_data = (unsigned long)&at91sam9263_config, 78 + }, { 79 + .name = "at91sam9g10-lcdfb", 80 + .driver_data = (unsigned long)&at91sam9g10_config, 81 + }, { 82 + .name = "at91sam9g45-lcdfb", 83 + .driver_data = (unsigned long)&at91sam9g45_config, 84 + }, { 85 + .name = "at91sam9g45es-lcdfb", 86 + .driver_data = (unsigned long)&at91sam9g45es_config, 87 + }, { 88 + .name = "at91sam9rl-lcdfb", 89 + .driver_data = (unsigned long)&at91sam9rl_config, 90 + }, { 91 + .name = "at32ap-lcdfb", 92 + .driver_data = (unsigned long)&at32ap_config, 93 + }, { 94 + /* terminator */ 95 + } 96 + }; 97 + 98 + static struct atmel_lcdfb_config * 99 + atmel_lcdfb_get_config(struct platform_device *pdev) 100 + { 101 + unsigned long data; 102 + 103 + data = platform_get_device_id(pdev)->driver_data; 104 + 105 + return (struct atmel_lcdfb_config *)data; 106 + } 107 + 37 108 #if defined(CONFIG_ARCH_AT91) 38 109 #define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \ 39 110 | FBINFO_PARTIAL_PAN_OK \ ··· 264 193 .accel = FB_ACCEL_NONE, 265 194 }; 266 195 267 - static unsigned long compute_hozval(unsigned long xres, unsigned long lcdcon2) 196 + static unsigned long compute_hozval(struct atmel_lcdfb_info *sinfo, 197 + unsigned long xres) 268 198 { 199 + unsigned long lcdcon2; 269 200 unsigned long value; 270 201 271 - if (!(cpu_is_at91sam9261() || cpu_is_at91sam9g10() 272 - || cpu_is_at32ap7000())) 202 + if (!sinfo->config->have_hozval) 273 203 return xres; 274 204 205 + lcdcon2 = lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2); 275 206 value = xres; 276 207 if ((lcdcon2 & ATMEL_LCDC_DISTYPE) != ATMEL_LCDC_DISTYPE_TFT) { 277 208 /* STN display */ ··· 496 423 break; 497 424 case 16: 498 425 /* Older SOCs use IBGR:555 rather than BGR:565. */ 499 - if (sinfo->have_intensity_bit) 426 + if (sinfo->config->have_intensity_bit) 500 427 var->green.length = 5; 501 428 else 502 429 var->green.length = 6; ··· 604 531 /* Now, the LCDC core... */ 605 532 606 533 /* Set pixel clock */ 607 - if (cpu_is_at91sam9g45() && !cpu_is_at91sam9g45es()) 534 + if (sinfo->config->have_alt_pixclock) 608 535 pix_factor = 1; 609 536 610 537 clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000; ··· 664 591 lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value); 665 592 666 593 /* Horizontal value (aka line size) */ 667 - hozval_linesz = compute_hozval(info->var.xres, 668 - lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2)); 594 + hozval_linesz = compute_hozval(sinfo, info->var.xres); 669 595 670 596 /* Display size */ 671 597 value = (hozval_linesz - 1) << ATMEL_LCDC_HOZVAL_OFFSET; ··· 756 684 757 685 case FB_VISUAL_PSEUDOCOLOR: 758 686 if (regno < 256) { 759 - if (sinfo->have_intensity_bit) { 687 + if (sinfo->config->have_intensity_bit) { 760 688 /* old style I+BGR:555 */ 761 689 val = ((red >> 11) & 0x001f); 762 690 val |= ((green >> 6) & 0x03e0); ··· 893 821 894 822 static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo) 895 823 { 896 - if (sinfo->bus_clk) 897 - clk_enable(sinfo->bus_clk); 824 + clk_enable(sinfo->bus_clk); 898 825 clk_enable(sinfo->lcdc_clk); 899 826 } 900 827 901 828 static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo) 902 829 { 903 - if (sinfo->bus_clk) 904 - clk_disable(sinfo->bus_clk); 830 + clk_disable(sinfo->bus_clk); 905 831 clk_disable(sinfo->lcdc_clk); 906 832 } 907 833 ··· 944 874 } 945 875 sinfo->info = info; 946 876 sinfo->pdev = pdev; 947 - if (cpu_is_at91sam9261() || cpu_is_at91sam9263() || 948 - cpu_is_at91sam9rl()) { 949 - sinfo->have_intensity_bit = true; 950 - } 877 + sinfo->config = atmel_lcdfb_get_config(pdev); 878 + if (!sinfo->config) 879 + goto free_info; 951 880 952 881 strcpy(info->fix.id, sinfo->pdev->name); 953 882 info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; ··· 957 888 info->fix = atmel_lcdfb_fix; 958 889 959 890 /* Enable LCDC Clocks */ 960 - if (cpu_is_at91sam9261() || cpu_is_at91sam9g10() 961 - || cpu_is_at32ap7000()) { 962 - sinfo->bus_clk = clk_get(dev, "hck1"); 963 - if (IS_ERR(sinfo->bus_clk)) { 964 - ret = PTR_ERR(sinfo->bus_clk); 965 - goto free_info; 966 - } 891 + sinfo->bus_clk = clk_get(dev, "hclk"); 892 + if (IS_ERR(sinfo->bus_clk)) { 893 + ret = PTR_ERR(sinfo->bus_clk); 894 + goto free_info; 967 895 } 968 896 sinfo->lcdc_clk = clk_get(dev, "lcdc_clk"); 969 897 if (IS_ERR(sinfo->lcdc_clk)) { ··· 1121 1055 atmel_lcdfb_stop_clock(sinfo); 1122 1056 clk_put(sinfo->lcdc_clk); 1123 1057 put_bus_clk: 1124 - if (sinfo->bus_clk) 1125 - clk_put(sinfo->bus_clk); 1058 + clk_put(sinfo->bus_clk); 1126 1059 free_info: 1127 1060 framebuffer_release(info); 1128 1061 out: ··· 1146 1081 unregister_framebuffer(info); 1147 1082 atmel_lcdfb_stop_clock(sinfo); 1148 1083 clk_put(sinfo->lcdc_clk); 1149 - if (sinfo->bus_clk) 1150 - clk_put(sinfo->bus_clk); 1084 + clk_put(sinfo->bus_clk); 1151 1085 fb_dealloc_cmap(&info->cmap); 1152 1086 free_irq(sinfo->irq_base, info); 1153 1087 iounmap(sinfo->mmio); ··· 1215 1151 .remove = __exit_p(atmel_lcdfb_remove), 1216 1152 .suspend = atmel_lcdfb_suspend, 1217 1153 .resume = atmel_lcdfb_resume, 1218 - 1154 + .id_table = atmel_lcdfb_devtypes, 1219 1155 .driver = { 1220 1156 .name = "atmel_lcdfb", 1221 1157 .owner = THIS_MODULE,
+1
include/linux/clk/tegra.h
··· 123 123 void tegra_periph_reset_deassert(struct clk *c); 124 124 void tegra_periph_reset_assert(struct clk *c); 125 125 void tegra_clocks_init(void); 126 + void tegra_clocks_apply_init_table(void); 126 127 127 128 #endif /* __LINUX_CLK_TEGRA_H_ */
+9
include/linux/of.h
··· 235 235 extern struct property *of_find_property(const struct device_node *np, 236 236 const char *name, 237 237 int *lenp); 238 + extern int of_property_read_u32_index(const struct device_node *np, 239 + const char *propname, 240 + u32 index, u32 *out_value); 238 241 extern int of_property_read_u8_array(const struct device_node *np, 239 242 const char *propname, u8 *out_values, size_t sz); 240 243 extern int of_property_read_u16_array(const struct device_node *np, ··· 395 392 const char *compat) 396 393 { 397 394 return NULL; 395 + } 396 + 397 + static inline int of_property_read_u32_index(const struct device_node *np, 398 + const char *propname, u32 index, u32 *out_value) 399 + { 400 + return -ENOSYS; 398 401 } 399 402 400 403 static inline int of_property_read_u8_array(const struct device_node *np,
+29
include/linux/platform_data/irq-renesas-intc-irqpin.h
··· 1 + /* 2 + * Renesas INTC External IRQ Pin Driver 3 + * 4 + * Copyright (C) 2013 Magnus Damm 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 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + * 15 + * You should have received a copy of the GNU General Public License 16 + * along with this program; if not, write to the Free Software 17 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 + */ 19 + 20 + #ifndef __IRQ_RENESAS_INTC_IRQPIN_H__ 21 + #define __IRQ_RENESAS_INTC_IRQPIN_H__ 22 + 23 + struct renesas_intc_irqpin_config { 24 + unsigned int sense_bitfield_width; 25 + unsigned int irq_base; 26 + bool control_parent; 27 + }; 28 + 29 + #endif /* __IRQ_RENESAS_INTC_IRQPIN_H__ */
+27
include/linux/platform_data/irq-renesas-irqc.h
··· 1 + /* 2 + * Renesas IRQC Driver 3 + * 4 + * Copyright (C) 2013 Magnus Damm 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 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + * 15 + * You should have received a copy of the GNU General Public License 16 + * along with this program; if not, write to the Free Software 17 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 + */ 19 + 20 + #ifndef __IRQ_RENESAS_IRQC_H__ 21 + #define __IRQ_RENESAS_IRQC_H__ 22 + 23 + struct renesas_irqc_config { 24 + unsigned int irq_base; 25 + }; 26 + 27 + #endif /* __IRQ_RENESAS_IRQC_H__ */
+51
include/linux/reset-controller.h
··· 1 + #ifndef _LINUX_RESET_CONTROLLER_H_ 2 + #define _LINUX_RESET_CONTROLLER_H_ 3 + 4 + #include <linux/list.h> 5 + 6 + struct reset_controller_dev; 7 + 8 + /** 9 + * struct reset_control_ops 10 + * 11 + * @reset: for self-deasserting resets, does all necessary 12 + * things to reset the device 13 + * @assert: manually assert the reset line, if supported 14 + * @deassert: manually deassert the reset line, if supported 15 + */ 16 + struct reset_control_ops { 17 + int (*reset)(struct reset_controller_dev *rcdev, unsigned long id); 18 + int (*assert)(struct reset_controller_dev *rcdev, unsigned long id); 19 + int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id); 20 + }; 21 + 22 + struct module; 23 + struct device_node; 24 + 25 + /** 26 + * struct reset_controller_dev - reset controller entity that might 27 + * provide multiple reset controls 28 + * @ops: a pointer to device specific struct reset_control_ops 29 + * @owner: kernel module of the reset controller driver 30 + * @list: internal list of reset controller devices 31 + * @of_node: corresponding device tree node as phandle target 32 + * @of_reset_n_cells: number of cells in reset line specifiers 33 + * @of_xlate: translation function to translate from specifier as found in the 34 + * device tree to id as given to the reset control ops 35 + * @nr_resets: number of reset controls in this reset controller device 36 + */ 37 + struct reset_controller_dev { 38 + struct reset_control_ops *ops; 39 + struct module *owner; 40 + struct list_head list; 41 + struct device_node *of_node; 42 + int of_reset_n_cells; 43 + int (*of_xlate)(struct reset_controller_dev *rcdev, 44 + const struct of_phandle_args *reset_spec); 45 + unsigned int nr_resets; 46 + }; 47 + 48 + int reset_controller_register(struct reset_controller_dev *rcdev); 49 + void reset_controller_unregister(struct reset_controller_dev *rcdev); 50 + 51 + #endif
+17
include/linux/reset.h
··· 1 + #ifndef _LINUX_RESET_H_ 2 + #define _LINUX_RESET_H_ 3 + 4 + struct device; 5 + struct reset_control; 6 + 7 + int reset_control_reset(struct reset_control *rstc); 8 + int reset_control_assert(struct reset_control *rstc); 9 + int reset_control_deassert(struct reset_control *rstc); 10 + 11 + struct reset_control *reset_control_get(struct device *dev, const char *id); 12 + void reset_control_put(struct reset_control *rstc); 13 + struct reset_control *devm_reset_control_get(struct device *dev, const char *id); 14 + 15 + int device_reset(struct device *dev); 16 + 17 + #endif
+3 -1
include/video/atmel_lcdc.h
··· 31 31 #define ATMEL_LCDC_WIRING_BGR 0 32 32 #define ATMEL_LCDC_WIRING_RGB 1 33 33 34 + struct atmel_lcdfb_config; 34 35 35 36 /* LCD Controller info data structure, stored in device platform_data */ 36 37 struct atmel_lcdfb_info { ··· 62 61 void (*atmel_lcdfb_power_control)(int on); 63 62 struct fb_monspecs *default_monspecs; 64 63 u32 pseudo_palette[16]; 65 - bool have_intensity_bit; 64 + 65 + struct atmel_lcdfb_config *config; 66 66 }; 67 67 68 68 #define ATMEL_LCDC_DMABADDR1 0x00