Merge branch 'akpm' (incoming from Andrew)
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 24 Jan 2014 03:11:50 +0000 (19:11 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 24 Jan 2014 03:11:50 +0000 (19:11 -0800)
Merge second patch-bomb from Andrew Morton:
 - various misc bits
 - the rest of MM
 - add generic fixmap.h, use it
 - backlight updates
 - dynamic_debug updates
 - printk() updates
 - checkpatch updates
 - binfmt_elf
 - ramfs
 - init/
 - autofs4
 - drivers/rtc
 - nilfs
 - hfsplus
 - Documentation/
 - coredump
 - procfs
 - fork
 - exec
 - kexec
 - kdump
 - partitions
 - rapidio
 - rbtree
 - userns
 - memstick
 - w1
 - decompressors

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (197 commits)
  lib/decompress_unlz4.c: always set an error return code on failures
  romfs: fix returm err while getting inode in fill_super
  drivers/w1/masters/w1-gpio.c: add strong pullup emulation
  drivers/memstick/host/rtsx_pci_ms.c: fix ms card data transfer bug
  userns: relax the posix_acl_valid() checks
  arch/sh/kernel/dwarf.c: use rbtree postorder iteration helper instead of solution using repeated rb_erase()
  fs-ext3-use-rbtree-postorder-iteration-helper-instead-of-opencoding-fix
  fs/ext3: use rbtree postorder iteration helper instead of opencoding
  fs/jffs2: use rbtree postorder iteration helper instead of opencoding
  fs/ext4: use rbtree postorder iteration helper instead of opencoding
  fs/ubifs: use rbtree postorder iteration helper instead of opencoding
  net/netfilter/ipset/ip_set_hash_netiface.c: use rbtree postorder iteration instead of opencoding
  rbtree/test: test rbtree_postorder_for_each_entry_safe()
  rbtree/test: move rb_node to the middle of the test struct
  rapidio: add modular rapidio core build into powerpc and mips branches
  partitions/efi: complete documentation of gpt kernel param purpose
  kdump: add /sys/kernel/vmcoreinfo ABI documentation
  kdump: fix exported size of vmcoreinfo note
  kexec: add sysctl to disable kexec_load
  fs/exec.c: call arch_pick_mmap_layout() only once
  ...

981 files changed:
Documentation/arm/Marvell/README
Documentation/clk.txt
Documentation/devicetree/bindings/arm/arm-boards
Documentation/devicetree/bindings/arm/atmel-aic.txt
Documentation/devicetree/bindings/arm/atmel-at91.txt
Documentation/devicetree/bindings/arm/firmware/tlm,trusted-foundations.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/l2cc.txt
Documentation/devicetree/bindings/arm/marvell,berlin.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/moxart.txt [new file with mode: 0644]
Documentation/devicetree/bindings/arm/omap/omap.txt
Documentation/devicetree/bindings/arm/samsung/sysreg.txt
Documentation/devicetree/bindings/arm/tegra.txt
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt
Documentation/devicetree/bindings/arm/versatile-fpga-irq.txt
Documentation/devicetree/bindings/clock/at91-clock.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/clk-exynos-audss.txt
Documentation/devicetree/bindings/clock/emev2-clock.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/exynos5250-clock.txt
Documentation/devicetree/bindings/clock/fixed-clock.txt
Documentation/devicetree/bindings/clock/fixed-factor-clock.txt
Documentation/devicetree/bindings/clock/hi3620-clock.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/imx35-clock.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/imx5-clock.txt
Documentation/devicetree/bindings/clock/keystone-pll.txt
Documentation/devicetree/bindings/clock/maxim,max77686.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt
Documentation/devicetree/bindings/clock/nvidia,tegra124-car.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt
Documentation/devicetree/bindings/clock/nvidia,tegra30-car.txt
Documentation/devicetree/bindings/clock/qcom,gcc.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/qcom,mmcc.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/silabs,si570.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/sunxi.txt
Documentation/devicetree/bindings/clock/zynq-7000.txt
Documentation/devicetree/bindings/crypto/atmel-crypto.txt [new file with mode: 0644]
Documentation/devicetree/bindings/crypto/fsl-dcp.txt [new file with mode: 0644]
Documentation/devicetree/bindings/dma/ste-dma40.txt
Documentation/devicetree/bindings/dma/tegra20-apbdma.txt
Documentation/devicetree/bindings/gpio/gpio-davinci.txt [new file with mode: 0644]
Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt
Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.txt
Documentation/devicetree/bindings/i2c/trivial-devices.txt
Documentation/devicetree/bindings/input/nvidia,tegra20-kbc.txt
Documentation/devicetree/bindings/interrupt-controller/allwinner,sun4i-ic.txt
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt [new file with mode: 0644]
Documentation/devicetree/bindings/mfd/max77686.txt
Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.txt
Documentation/devicetree/bindings/nvec/nvidia,nvec.txt
Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt
Documentation/devicetree/bindings/pwm/nvidia,tegra20-pwm.txt
Documentation/devicetree/bindings/rtc/nvidia,tegra20-rtc.txt
Documentation/devicetree/bindings/rtc/sunxi-rtc.txt [new file with mode: 0644]
Documentation/devicetree/bindings/serial/nvidia,tegra20-hsuart.txt
Documentation/devicetree/bindings/serial/renesas,sci-serial.txt [new file with mode: 0644]
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-alc5632.txt
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5640.txt
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8753.txt
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm9712.txt
Documentation/devicetree/bindings/sound/nvidia,tegra20-ac97.txt
Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt
Documentation/devicetree/bindings/sound/nvidia,tegra30-ahub.txt
Documentation/devicetree/bindings/sound/nvidia,tegra30-i2s.txt
Documentation/devicetree/bindings/spi/nvidia,tegra114-spi.txt
Documentation/devicetree/bindings/spi/nvidia,tegra20-sflash.txt
Documentation/devicetree/bindings/spi/nvidia,tegra20-slink.txt
Documentation/devicetree/bindings/timer/nvidia,tegra20-timer.txt
Documentation/devicetree/bindings/timer/nvidia,tegra30-timer.txt
Documentation/devicetree/bindings/timer/samsung,exynos4210-mct.txt
Documentation/devicetree/bindings/usb/keystone-phy.txt [new file with mode: 0644]
Documentation/devicetree/bindings/usb/keystone-usb.txt [new file with mode: 0644]
Documentation/devicetree/bindings/usb/nvidia,tegra20-ehci.txt
Documentation/devicetree/bindings/vendor-prefixes.txt
Documentation/kernel-parameters.txt
MAINTAINERS
arch/arm/Kconfig
arch/arm/Kconfig.debug
arch/arm/Makefile
arch/arm/boot/compressed/Makefile
arch/arm/boot/dts/Makefile
arch/arm/boot/dts/am3517-evm.dts
arch/arm/boot/dts/animeo_ip.dts
arch/arm/boot/dts/armada-370-mirabox.dts
arch/arm/boot/dts/armada-370-netgear-rn102.dts
arch/arm/boot/dts/armada-370-netgear-rn104.dts
arch/arm/boot/dts/armada-370-rd.dts
arch/arm/boot/dts/armada-370-xp.dtsi
arch/arm/boot/dts/armada-370.dtsi
arch/arm/boot/dts/armada-xp-gp.dts
arch/arm/boot/dts/armada-xp-netgear-rn2120.dts [new file with mode: 0644]
arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
arch/arm/boot/dts/armada-xp.dtsi
arch/arm/boot/dts/armv7-m.dtsi [new file with mode: 0644]
arch/arm/boot/dts/at91-cosino.dtsi [new file with mode: 0644]
arch/arm/boot/dts/at91-cosino_mega2560.dts [new file with mode: 0644]
arch/arm/boot/dts/at91-qil_a9260.dts [new file with mode: 0644]
arch/arm/boot/dts/at91rm9200.dtsi
arch/arm/boot/dts/at91rm9200ek.dts
arch/arm/boot/dts/at91sam9263.dtsi
arch/arm/boot/dts/at91sam9263ek.dts
arch/arm/boot/dts/at91sam9g45.dtsi
arch/arm/boot/dts/at91sam9m10g45ek.dts
arch/arm/boot/dts/at91sam9n12.dtsi
arch/arm/boot/dts/at91sam9x5.dtsi
arch/arm/boot/dts/atlas6.dtsi
arch/arm/boot/dts/bcm2835-rpi-b.dts
arch/arm/boot/dts/bcm2835.dtsi
arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts [new file with mode: 0644]
arch/arm/boot/dts/berlin2.dtsi [new file with mode: 0644]
arch/arm/boot/dts/berlin2cd-google-chromecast.dts [new file with mode: 0644]
arch/arm/boot/dts/berlin2cd.dtsi [new file with mode: 0644]
arch/arm/boot/dts/cros5250-common.dtsi [deleted file]
arch/arm/boot/dts/da850-evm.dts
arch/arm/boot/dts/da850.dtsi
arch/arm/boot/dts/dove-cubox.dts
arch/arm/boot/dts/dove.dtsi
arch/arm/boot/dts/efm32gg-dk3750.dts [new file with mode: 0644]
arch/arm/boot/dts/efm32gg.dtsi [new file with mode: 0644]
arch/arm/boot/dts/emev2-kzm9d.dts
arch/arm/boot/dts/emev2.dtsi
arch/arm/boot/dts/exynos4.dtsi
arch/arm/boot/dts/exynos4210-origen.dts
arch/arm/boot/dts/exynos4210.dtsi
arch/arm/boot/dts/exynos4212.dtsi
arch/arm/boot/dts/exynos4412-odroidx.dts
arch/arm/boot/dts/exynos4412-origen.dts
arch/arm/boot/dts/exynos4412-tiny4412.dts [new file with mode: 0644]
arch/arm/boot/dts/exynos4412-trats2.dts
arch/arm/boot/dts/exynos4412.dtsi
arch/arm/boot/dts/exynos4x12.dtsi
arch/arm/boot/dts/exynos5.dtsi
arch/arm/boot/dts/exynos5250-arndale.dts
arch/arm/boot/dts/exynos5250-cros-common.dtsi [new file with mode: 0644]
arch/arm/boot/dts/exynos5250-smdk5250.dts
arch/arm/boot/dts/exynos5250-snow.dts
arch/arm/boot/dts/exynos5250.dtsi
arch/arm/boot/dts/exynos5420-arndale-octa.dts [new file with mode: 0644]
arch/arm/boot/dts/exynos5420-pinctrl.dtsi
arch/arm/boot/dts/exynos5420-smdk5420.dts
arch/arm/boot/dts/exynos5420.dtsi
arch/arm/boot/dts/exynos5440.dtsi
arch/arm/boot/dts/hi3620-hi4511.dts [new file with mode: 0644]
arch/arm/boot/dts/hi3620.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx23.dtsi
arch/arm/boot/dts/imx28.dtsi
arch/arm/boot/dts/integrator.dtsi
arch/arm/boot/dts/integratorcp.dts
arch/arm/boot/dts/k2hk-evm.dts [new file with mode: 0644]
arch/arm/boot/dts/keystone-clocks.dtsi
arch/arm/boot/dts/keystone.dts [deleted file]
arch/arm/boot/dts/keystone.dtsi [new file with mode: 0644]
arch/arm/boot/dts/kirkwood-6192.dtsi [new file with mode: 0644]
arch/arm/boot/dts/kirkwood-6281.dtsi
arch/arm/boot/dts/kirkwood-6282.dtsi
arch/arm/boot/dts/kirkwood-cloudbox.dts
arch/arm/boot/dts/kirkwood-db.dtsi
arch/arm/boot/dts/kirkwood-dns320.dts
arch/arm/boot/dts/kirkwood-dns325.dts
arch/arm/boot/dts/kirkwood-dnskw.dtsi
arch/arm/boot/dts/kirkwood-dockstar.dts
arch/arm/boot/dts/kirkwood-dreamplug.dts
arch/arm/boot/dts/kirkwood-goflexnet.dts
arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
arch/arm/boot/dts/kirkwood-ib62x0.dts
arch/arm/boot/dts/kirkwood-iconnect.dts
arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
arch/arm/boot/dts/kirkwood-km_kirkwood.dts
arch/arm/boot/dts/kirkwood-laplug.dts [new file with mode: 0644]
arch/arm/boot/dts/kirkwood-lsxl.dtsi
arch/arm/boot/dts/kirkwood-mplcec4.dts
arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
arch/arm/boot/dts/kirkwood-netgear_readynas_nv+_v2.dts [new file with mode: 0644]
arch/arm/boot/dts/kirkwood-ns2-common.dtsi
arch/arm/boot/dts/kirkwood-ns2lite.dts
arch/arm/boot/dts/kirkwood-ns2max.dts
arch/arm/boot/dts/kirkwood-ns2mini.dts
arch/arm/boot/dts/kirkwood-nsa310-common.dtsi
arch/arm/boot/dts/kirkwood-nsa310.dts
arch/arm/boot/dts/kirkwood-nsa310a.dts
arch/arm/boot/dts/kirkwood-openblocks_a6.dts
arch/arm/boot/dts/kirkwood-openblocks_a7.dts
arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi
arch/arm/boot/dts/kirkwood-sheevaplug-esata.dts
arch/arm/boot/dts/kirkwood-sheevaplug.dts
arch/arm/boot/dts/kirkwood-topkick.dts
arch/arm/boot/dts/kirkwood-ts219-6281.dts
arch/arm/boot/dts/kirkwood-ts219-6282.dts
arch/arm/boot/dts/kirkwood.dtsi
arch/arm/boot/dts/moxart-uc7112lx.dts [new file with mode: 0644]
arch/arm/boot/dts/moxart.dtsi [new file with mode: 0644]
arch/arm/boot/dts/omap2.dtsi
arch/arm/boot/dts/omap2420-n800.dts [new file with mode: 0644]
arch/arm/boot/dts/omap2420-n810-wimax.dts [new file with mode: 0644]
arch/arm/boot/dts/omap2420-n810.dts [new file with mode: 0644]
arch/arm/boot/dts/omap2420-n8x0-common.dtsi [new file with mode: 0644]
arch/arm/boot/dts/omap2430-sdp.dts [new file with mode: 0644]
arch/arm/boot/dts/omap3-beagle-xm.dts
arch/arm/boot/dts/omap3-beagle.dts
arch/arm/boot/dts/omap3-cm-t3730.dts [new file with mode: 0644]
arch/arm/boot/dts/omap3-cm-t3x30.dtsi [new file with mode: 0644]
arch/arm/boot/dts/omap3-igep.dtsi
arch/arm/boot/dts/omap3-igep0020.dts
arch/arm/boot/dts/omap3-igep0030.dts
arch/arm/boot/dts/omap3-ldp.dts [new file with mode: 0644]
arch/arm/boot/dts/omap3-sb-t35.dtsi [new file with mode: 0644]
arch/arm/boot/dts/omap3-sbc-t3730.dts [new file with mode: 0644]
arch/arm/boot/dts/omap3-zoom3.dts
arch/arm/boot/dts/omap3.dtsi
arch/arm/boot/dts/omap34xx.dtsi
arch/arm/boot/dts/omap36xx.dtsi
arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts
arch/arm/boot/dts/orion5x.dtsi
arch/arm/boot/dts/prima2.dtsi
arch/arm/boot/dts/pxa27x.dtsi
arch/arm/boot/dts/qcom-apq8074-dragonboard.dts [new file with mode: 0644]
arch/arm/boot/dts/qcom-msm8660-surf.dts
arch/arm/boot/dts/qcom-msm8960-cdp.dts
arch/arm/boot/dts/qcom-msm8974.dtsi [new file with mode: 0644]
arch/arm/boot/dts/r7s72100-genmai-reference.dts [new file with mode: 0644]
arch/arm/boot/dts/r7s72100-genmai.dts
arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
arch/arm/boot/dts/r8a73a4-ape6evm.dts
arch/arm/boot/dts/r8a73a4.dtsi
arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
arch/arm/boot/dts/r8a7740-armadillo800eva.dts
arch/arm/boot/dts/r8a7740.dtsi
arch/arm/boot/dts/r8a7778-bockw-reference.dts
arch/arm/boot/dts/r8a7778-bockw.dts
arch/arm/boot/dts/r8a7778.dtsi
arch/arm/boot/dts/r8a7779-marzen-reference.dts
arch/arm/boot/dts/r8a7779-marzen.dts
arch/arm/boot/dts/r8a7779.dtsi
arch/arm/boot/dts/r8a7790-lager-reference.dts [deleted file]
arch/arm/boot/dts/r8a7790-lager.dts
arch/arm/boot/dts/r8a7790.dtsi
arch/arm/boot/dts/r8a7791-koelsch-reference.dts [new file with mode: 0644]
arch/arm/boot/dts/r8a7791-koelsch.dts
arch/arm/boot/dts/r8a7791.dtsi
arch/arm/boot/dts/sama5d3.dtsi
arch/arm/boot/dts/sama5d36.dtsi [new file with mode: 0644]
arch/arm/boot/dts/sama5d36ek.dts [new file with mode: 0644]
arch/arm/boot/dts/sama5d3_can.dtsi
arch/arm/boot/dts/sama5d3_emac.dtsi
arch/arm/boot/dts/sama5d3_gmac.dtsi
arch/arm/boot/dts/sama5d3_lcd.dtsi
arch/arm/boot/dts/sama5d3_mci2.dtsi
arch/arm/boot/dts/sama5d3_tcb1.dtsi
arch/arm/boot/dts/sama5d3_uart.dtsi
arch/arm/boot/dts/sama5d3xcm.dtsi
arch/arm/boot/dts/sama5d3xdm.dtsi
arch/arm/boot/dts/sh7372-mackerel.dts
arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
arch/arm/boot/dts/sh73a0-kzm9g.dts
arch/arm/boot/dts/sh73a0.dtsi
arch/arm/boot/dts/socfpga.dtsi
arch/arm/boot/dts/st-pincfg.h
arch/arm/boot/dts/ste-dbx5x0.dtsi
arch/arm/boot/dts/ste-href-family-pinctrl.dtsi [new file with mode: 0644]
arch/arm/boot/dts/ste-href-stuib.dtsi
arch/arm/boot/dts/ste-href-tvk1281618.dtsi
arch/arm/boot/dts/ste-href.dtsi
arch/arm/boot/dts/ste-hrefprev60.dtsi
arch/arm/boot/dts/ste-hrefv60plus.dtsi
arch/arm/boot/dts/ste-nomadik-pinctrl.dtsi
arch/arm/boot/dts/ste-nomadik-s8815.dts
arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
arch/arm/boot/dts/ste-snowball.dts
arch/arm/boot/dts/ste-u300.dts
arch/arm/boot/dts/stih415-pinctrl.dtsi
arch/arm/boot/dts/stih415.dtsi
arch/arm/boot/dts/stih416-pinctrl.dtsi
arch/arm/boot/dts/stih416.dtsi
arch/arm/boot/dts/stih41x-b2000.dtsi
arch/arm/boot/dts/stih41x-b2020.dtsi
arch/arm/boot/dts/sun4i-a10-a1000.dts
arch/arm/boot/dts/sun4i-a10-cubieboard.dts
arch/arm/boot/dts/sun4i-a10-hackberry.dts
arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
arch/arm/boot/dts/sun4i-a10.dtsi
arch/arm/boot/dts/sun5i-a10s.dtsi
arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts [new file with mode: 0644]
arch/arm/boot/dts/sun5i-a13-olinuxino.dts
arch/arm/boot/dts/sun5i-a13.dtsi
arch/arm/boot/dts/sun6i-a31.dtsi
arch/arm/boot/dts/sun7i-a20-cubietruck.dts
arch/arm/boot/dts/sun7i-a20.dtsi
arch/arm/boot/dts/tegra114-dalmore.dts
arch/arm/boot/dts/tegra114.dtsi
arch/arm/boot/dts/tegra124-venice2.dts
arch/arm/boot/dts/tegra124.dtsi
arch/arm/boot/dts/tegra20-colibri-512.dtsi
arch/arm/boot/dts/tegra20-harmony.dts
arch/arm/boot/dts/tegra20-iris-512.dts
arch/arm/boot/dts/tegra20-medcom-wide.dts
arch/arm/boot/dts/tegra20-paz00.dts
arch/arm/boot/dts/tegra20-plutux.dts
arch/arm/boot/dts/tegra20-seaboard.dts
arch/arm/boot/dts/tegra20-tamonten.dtsi
arch/arm/boot/dts/tegra20-tec.dts
arch/arm/boot/dts/tegra20-trimslice.dts
arch/arm/boot/dts/tegra20-ventana.dts
arch/arm/boot/dts/tegra20-whistler.dts
arch/arm/boot/dts/tegra20.dtsi
arch/arm/boot/dts/tegra30-beaver.dts
arch/arm/boot/dts/tegra30-cardhu-a02.dts
arch/arm/boot/dts/tegra30-cardhu-a04.dts
arch/arm/boot/dts/tegra30-cardhu.dtsi
arch/arm/boot/dts/tegra30.dtsi
arch/arm/boot/dts/zynq-7000.dtsi
arch/arm/boot/dts/zynq-zc702.dts
arch/arm/boot/dts/zynq-zc706.dts
arch/arm/boot/dts/zynq-zed.dts
arch/arm/common/mcpm_entry.c
arch/arm/common/timer-sp.c
arch/arm/configs/ape6evm_defconfig
arch/arm/configs/armadillo800eva_defconfig
arch/arm/configs/at91_dt_defconfig
arch/arm/configs/at91rm9200_defconfig
arch/arm/configs/at91sam9260_9g20_defconfig
arch/arm/configs/at91sam9261_9g10_defconfig
arch/arm/configs/at91sam9g45_defconfig
arch/arm/configs/at91sam9rl_defconfig
arch/arm/configs/bcm2835_defconfig
arch/arm/configs/bcm_defconfig
arch/arm/configs/bockw_defconfig
arch/arm/configs/efm32_defconfig [new file with mode: 0644]
arch/arm/configs/exynos_defconfig
arch/arm/configs/genmai_defconfig [new file with mode: 0644]
arch/arm/configs/hi3xxx_defconfig [new file with mode: 0644]
arch/arm/configs/imx_v4_v5_defconfig
arch/arm/configs/imx_v6_v7_defconfig
arch/arm/configs/keystone_defconfig
arch/arm/configs/kirkwood_defconfig
arch/arm/configs/koelsch_defconfig
arch/arm/configs/kzm9d_defconfig
arch/arm/configs/kzm9g_defconfig
arch/arm/configs/lager_defconfig
arch/arm/configs/mackerel_defconfig
arch/arm/configs/marzen_defconfig
arch/arm/configs/moxart_defconfig [new file with mode: 0644]
arch/arm/configs/msm_defconfig
arch/arm/configs/multi_v7_defconfig
arch/arm/configs/mvebu_defconfig
arch/arm/configs/omap2plus_defconfig
arch/arm/configs/sama5_defconfig
arch/arm/configs/tegra_defconfig
arch/arm/configs/u8500_defconfig
arch/arm/configs/versatile_defconfig
arch/arm/firmware/Kconfig [new file with mode: 0644]
arch/arm/firmware/Makefile [new file with mode: 0644]
arch/arm/firmware/trusted_foundations.c [new file with mode: 0644]
arch/arm/include/asm/bitops.h
arch/arm/include/asm/cacheflush.h
arch/arm/include/asm/checksum.h
arch/arm/include/asm/clkdev.h
arch/arm/include/asm/hardware/cache-l2x0.h
arch/arm/include/asm/mach/map.h
arch/arm/include/asm/pci.h
arch/arm/include/asm/pgtable-2level.h
arch/arm/include/asm/pgtable-3level.h
arch/arm/include/asm/pgtable.h
arch/arm/include/asm/trusted_foundations.h [new file with mode: 0644]
arch/arm/include/asm/word-at-a-time.h
arch/arm/include/debug/imx-uart.h
arch/arm/include/debug/tegra.S
arch/arm/kernel/armksyms.c
arch/arm/kernel/entry-v7m.S
arch/arm/kernel/etm.c
arch/arm/kernel/setup.c
arch/arm/kernel/smp.c
arch/arm/kernel/tcm.c
arch/arm/kernel/topology.c
arch/arm/kernel/traps.c
arch/arm/lib/Makefile
arch/arm/lib/backtrace.S
arch/arm/lib/bswapsdi2.S [new file with mode: 0644]
arch/arm/mach-at91/Kconfig
arch/arm/mach-at91/Kconfig.non_dt
arch/arm/mach-at91/Makefile
arch/arm/mach-at91/at91rm9200.c
arch/arm/mach-at91/at91sam9260.c
arch/arm/mach-at91/at91sam9261.c
arch/arm/mach-at91/at91sam9263.c
arch/arm/mach-at91/at91sam926x_time.c
arch/arm/mach-at91/at91sam9g45.c
arch/arm/mach-at91/at91sam9n12.c
arch/arm/mach-at91/at91sam9rl.c
arch/arm/mach-at91/at91sam9x5.c
arch/arm/mach-at91/board-dt-sama5.c
arch/arm/mach-at91/board-qil-a9260.c [deleted file]
arch/arm/mach-at91/clock.c
arch/arm/mach-at91/generic.h
arch/arm/mach-at91/include/mach/at91_pmc.h [deleted file]
arch/arm/mach-at91/include/mach/cpu.h
arch/arm/mach-at91/pm.c
arch/arm/mach-at91/pm_slowclock.S
arch/arm/mach-at91/sam9_smc.c
arch/arm/mach-at91/sama5d3.c
arch/arm/mach-at91/setup.c
arch/arm/mach-bcm2835/Kconfig
arch/arm/mach-berlin/Kconfig [new file with mode: 0644]
arch/arm/mach-berlin/Makefile [new file with mode: 0644]
arch/arm/mach-berlin/berlin.c [new file with mode: 0644]
arch/arm/mach-clps711x/common.c
arch/arm/mach-davinci/clock.c
arch/arm/mach-davinci/da830.c
arch/arm/mach-davinci/da850.c
arch/arm/mach-davinci/da8xx-dt.c
arch/arm/mach-davinci/devices-da8xx.c
arch/arm/mach-davinci/devices.c
arch/arm/mach-davinci/dm355.c
arch/arm/mach-davinci/dm365.c
arch/arm/mach-davinci/dm644x.c
arch/arm/mach-davinci/dm646x.c
arch/arm/mach-davinci/time.c
arch/arm/mach-dove/common.c
arch/arm/mach-efm32/Makefile [new file with mode: 0644]
arch/arm/mach-efm32/Makefile.boot [new file with mode: 0644]
arch/arm/mach-efm32/dtmachine.c [new file with mode: 0644]
arch/arm/mach-efm32/include/mach/entry-macro.S [new file with mode: 0644]
arch/arm/mach-efm32/include/mach/timex.h [new file with mode: 0644]
arch/arm/mach-ep93xx/Kconfig
arch/arm/mach-ep93xx/core.c
arch/arm/mach-ep93xx/include/mach/platform.h
arch/arm/mach-exynos/Kconfig
arch/arm/mach-exynos/common.c
arch/arm/mach-exynos/common.h
arch/arm/mach-exynos/cpuidle.c
arch/arm/mach-exynos/hotplug.c
arch/arm/mach-exynos/include/mach/pm-core.h
arch/arm/mach-exynos/include/mach/regs-clock.h [deleted file]
arch/arm/mach-exynos/include/mach/regs-irq.h [deleted file]
arch/arm/mach-exynos/include/mach/regs-pmu.h [deleted file]
arch/arm/mach-exynos/mach-exynos5-dt.c
arch/arm/mach-exynos/platsmp.c
arch/arm/mach-exynos/pm.c
arch/arm/mach-exynos/pm_domains.c
arch/arm/mach-exynos/pmu.c
arch/arm/mach-exynos/regs-pmu.h [new file with mode: 0644]
arch/arm/mach-footbridge/common.c
arch/arm/mach-footbridge/common.h
arch/arm/mach-footbridge/dc21285-timer.c
arch/arm/mach-footbridge/ebsa285.c
arch/arm/mach-footbridge/include/mach/hardware.h
arch/arm/mach-hisi/Kconfig [new file with mode: 0644]
arch/arm/mach-hisi/Makefile [new file with mode: 0644]
arch/arm/mach-hisi/core.h [new file with mode: 0644]
arch/arm/mach-hisi/hisilicon.c [new file with mode: 0644]
arch/arm/mach-hisi/hotplug.c [new file with mode: 0644]
arch/arm/mach-hisi/platsmp.c [new file with mode: 0644]
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/avic.c
arch/arm/mach-imx/clk-gate2.c
arch/arm/mach-imx/clk-imx35.c
arch/arm/mach-imx/clk-imx51-imx53.c
arch/arm/mach-imx/clk-imx6q.c
arch/arm/mach-imx/clk-imx6sl.c
arch/arm/mach-imx/clk-pfd.c
arch/arm/mach-imx/clk-pllv1.c
arch/arm/mach-imx/clk-vf610.c
arch/arm/mach-imx/common.h
arch/arm/mach-imx/imx31-dt.c
arch/arm/mach-imx/imx35-dt.c [new file with mode: 0644]
arch/arm/mach-imx/imx51-dt.c
arch/arm/mach-imx/irq-common.h
arch/arm/mach-imx/mach-imx50.c [new file with mode: 0644]
arch/arm/mach-imx/mach-imx53.c
arch/arm/mach-imx/mach-imx6q.c
arch/arm/mach-imx/mach-imx6sl.c
arch/arm/mach-imx/mach-vf610.c
arch/arm/mach-imx/mm-imx5.c
arch/arm/mach-imx/platsmp.c
arch/arm/mach-imx/pm-imx6q.c
arch/arm/mach-imx/time.c
arch/arm/mach-integrator/integrator_ap.c
arch/arm/mach-integrator/integrator_cp.c
arch/arm/mach-ixp4xx/common.c
arch/arm/mach-keystone/Kconfig
arch/arm/mach-keystone/keystone.c
arch/arm/mach-keystone/keystone.h
arch/arm/mach-keystone/pm_domain.c
arch/arm/mach-kirkwood/board-dt.c
arch/arm/mach-mmp/Kconfig
arch/arm/mach-mmp/Makefile
arch/arm/mach-mmp/time.c
arch/arm/mach-moxart/Kconfig [new file with mode: 0644]
arch/arm/mach-moxart/Makefile [new file with mode: 0644]
arch/arm/mach-moxart/moxart.c [new file with mode: 0644]
arch/arm/mach-msm/Kconfig
arch/arm/mach-msm/Makefile
arch/arm/mach-msm/board-dt.c
arch/arm/mach-msm/board-msm7x30.c
arch/arm/mach-msm/board-qsd8x50.c
arch/arm/mach-msm/board-trout.c
arch/arm/mach-msm/platsmp.c
arch/arm/mach-msm/timer.c
arch/arm/mach-mvebu/Makefile
arch/arm/mach-mvebu/armada-370-xp.c
arch/arm/mach-mvebu/armada-370-xp.h
arch/arm/mach-mvebu/coherency.c
arch/arm/mach-mvebu/coherency.h
arch/arm/mach-mvebu/common.h
arch/arm/mach-mvebu/hotplug.c
arch/arm/mach-mvebu/mvebu-soc-id.c [new file with mode: 0644]
arch/arm/mach-mvebu/mvebu-soc-id.h [new file with mode: 0644]
arch/arm/mach-mvebu/platsmp.c
arch/arm/mach-mvebu/pmsu.c
arch/arm/mach-mvebu/system-controller.c
arch/arm/mach-nomadik/cpu-8815.c
arch/arm/mach-omap1/time.c
arch/arm/mach-omap2/Kconfig
arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/board-2430sdp.c [deleted file]
arch/arm/mach-omap2/board-generic.c
arch/arm/mach-omap2/board-h4.c [deleted file]
arch/arm/mach-omap2/board-n8x0.c
arch/arm/mach-omap2/common-board-devices.h
arch/arm/mach-omap2/common.h
arch/arm/mach-omap2/gpmc-nand.c
arch/arm/mach-omap2/io.c
arch/arm/mach-omap2/msdi.c
arch/arm/mach-omap2/mux.h
arch/arm/mach-omap2/mux2420.c [deleted file]
arch/arm/mach-omap2/mux2420.h [deleted file]
arch/arm/mach-omap2/mux2430.c [deleted file]
arch/arm/mach-omap2/mux2430.h [deleted file]
arch/arm/mach-omap2/omap4-common.c
arch/arm/mach-omap2/omap_device.c
arch/arm/mach-omap2/omap_hwmod_2420_data.c
arch/arm/mach-omap2/omap_hwmod_2430_data.c
arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
arch/arm/mach-omap2/omap_hwmod_common_data.h
arch/arm/mach-omap2/pdata-quirks.c
arch/arm/mach-omap2/timer.c
arch/arm/mach-orion5x/board-dt.c
arch/arm/mach-orion5x/common.c
arch/arm/mach-orion5x/db88f5281-setup.c
arch/arm/mach-orion5x/irq.c
arch/arm/mach-orion5x/pci.c
arch/arm/mach-orion5x/rd88f5182-setup.c
arch/arm/mach-orion5x/terastation_pro2-setup.c
arch/arm/mach-orion5x/ts209-setup.c
arch/arm/mach-orion5x/ts78xx-setup.c
arch/arm/mach-prima2/platsmp.c
arch/arm/mach-pxa/am200epd.c
arch/arm/mach-pxa/am300epd.c
arch/arm/mach-pxa/em-x270.c
arch/arm/mach-pxa/irq.c
arch/arm/mach-pxa/magician.c
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-pxa/pcm990-baseboard.c
arch/arm/mach-pxa/sharpsl_pm.c
arch/arm/mach-pxa/time.c
arch/arm/mach-pxa/trizeps4.c
arch/arm/mach-s3c24xx/dma.c
arch/arm/mach-s3c24xx/simtec-usb.c
arch/arm/mach-s3c64xx/mach-mini6410.c
arch/arm/mach-s3c64xx/mach-smartq.c
arch/arm/mach-sa1100/assabet.c
arch/arm/mach-sa1100/collie.c
arch/arm/mach-sa1100/h3100.c
arch/arm/mach-sa1100/h3600.c
arch/arm/mach-sa1100/include/mach/assabet.h
arch/arm/mach-sa1100/time.c
arch/arm/mach-shmobile/Kconfig
arch/arm/mach-shmobile/Makefile
arch/arm/mach-shmobile/Makefile.boot
arch/arm/mach-shmobile/board-ape6evm.c
arch/arm/mach-shmobile/board-armadillo800eva.c
arch/arm/mach-shmobile/board-bockw-reference.c
arch/arm/mach-shmobile/board-bockw.c
arch/arm/mach-shmobile/board-genmai-reference.c [new file with mode: 0644]
arch/arm/mach-shmobile/board-koelsch-reference.c [new file with mode: 0644]
arch/arm/mach-shmobile/board-koelsch.c
arch/arm/mach-shmobile/board-kzm9d.c [deleted file]
arch/arm/mach-shmobile/board-lager-reference.c
arch/arm/mach-shmobile/board-lager.c
arch/arm/mach-shmobile/board-mackerel.c
arch/arm/mach-shmobile/board-marzen.c
arch/arm/mach-shmobile/clock-r7s72100.c
arch/arm/mach-shmobile/clock-r8a73a4.c
arch/arm/mach-shmobile/clock-r8a7740.c
arch/arm/mach-shmobile/clock-r8a7778.c
arch/arm/mach-shmobile/clock-r8a7779.c
arch/arm/mach-shmobile/clock-r8a7790.c
arch/arm/mach-shmobile/clock-r8a7791.c
arch/arm/mach-shmobile/clock-sh7372.c
arch/arm/mach-shmobile/clock-sh73a0.c
arch/arm/mach-shmobile/include/mach/emev2.h
arch/arm/mach-shmobile/include/mach/r8a7778.h
arch/arm/mach-shmobile/include/mach/r8a7779.h
arch/arm/mach-shmobile/include/mach/r8a7791.h
arch/arm/mach-shmobile/setup-emev2.c
arch/arm/mach-shmobile/setup-r7s72100.c
arch/arm/mach-shmobile/setup-r8a73a4.c
arch/arm/mach-shmobile/setup-r8a7740.c
arch/arm/mach-shmobile/setup-r8a7778.c
arch/arm/mach-shmobile/setup-r8a7779.c
arch/arm/mach-shmobile/setup-r8a7790.c
arch/arm/mach-shmobile/setup-r8a7791.c
arch/arm/mach-shmobile/setup-rcar-gen2.c
arch/arm/mach-shmobile/setup-sh7372.c
arch/arm/mach-shmobile/setup-sh73a0.c
arch/arm/mach-shmobile/sh-gpio.h
arch/arm/mach-sti/platsmp.c
arch/arm/mach-sunxi/Kconfig
arch/arm/mach-sunxi/Makefile
arch/arm/mach-sunxi/common.h [new file with mode: 0644]
arch/arm/mach-sunxi/headsmp.S [new file with mode: 0644]
arch/arm/mach-sunxi/platsmp.c [new file with mode: 0644]
arch/arm/mach-sunxi/sunxi.c
arch/arm/mach-tegra/Kconfig
arch/arm/mach-tegra/fuse.c
arch/arm/mach-tegra/iomap.h
arch/arm/mach-tegra/powergate.c
arch/arm/mach-tegra/reset.c
arch/arm/mach-tegra/tegra.c
arch/arm/mach-u300/regulator.c
arch/arm/mach-u300/timer.c
arch/arm/mach-ux500/Makefile
arch/arm/mach-ux500/board-mop500-audio.c
arch/arm/mach-ux500/board-mop500-pins.c
arch/arm/mach-ux500/board-mop500-regulators.c
arch/arm/mach-ux500/board-mop500-regulators.h
arch/arm/mach-ux500/board-mop500-sdi.c
arch/arm/mach-ux500/board-mop500.c [deleted file]
arch/arm/mach-ux500/board-mop500.h
arch/arm/mach-ux500/cpu-db8500.c
arch/arm/mach-ux500/cpu.c
arch/arm/mach-ux500/devices-db8500.c [deleted file]
arch/arm/mach-ux500/devices-db8500.h [deleted file]
arch/arm/mach-ux500/devices.c [deleted file]
arch/arm/mach-ux500/devices.h [deleted file]
arch/arm/mach-ux500/platsmp.c
arch/arm/mach-ux500/pm.c
arch/arm/mach-ux500/setup.h
arch/arm/mach-ux500/timer.c
arch/arm/mach-versatile/core.c
arch/arm/mach-versatile/versatile_pb.c
arch/arm/mach-zynq/common.c
arch/arm/mach-zynq/common.h
arch/arm/mach-zynq/headsmp.S
arch/arm/mach-zynq/platsmp.c
arch/arm/mm/Makefile
arch/arm/mm/cache-l2x0.c
arch/arm/mm/cache-tauros3.h [new file with mode: 0644]
arch/arm/mm/cache-v7.S
arch/arm/mm/context.c
arch/arm/mm/dma-mapping.c
arch/arm/mm/dump.c [new file with mode: 0644]
arch/arm/mm/init.c
arch/arm/mm/ioremap.c
arch/arm/mm/mmu.c
arch/arm/mm/pgd.c
arch/arm/plat-iop/time.c
arch/arm/plat-omap/counter_32k.c
arch/arm/plat-orion/common.c
arch/arm/plat-orion/time.c
arch/arm/plat-pxa/dma.c
arch/arm/plat-samsung/Kconfig
arch/arm/plat-samsung/include/plat/pm.h
arch/arm/plat-samsung/include/plat/uncompress.h
arch/arm/plat-samsung/pm.c
arch/arm/plat-samsung/s5p-irq-eint.c
arch/arm/plat-samsung/s5p-irq-pm.c
arch/arm/plat-versatile/platsmp.c
arch/arm/plat-versatile/sched-clock.c
arch/blackfin/include/asm/clkdev.h
arch/mips/include/asm/clkdev.h
arch/s390/crypto/des_s390.c
arch/sh/include/asm/clkdev.h
arch/sh/kernel/cpu/sh2/setup-sh7619.c
arch/sh/kernel/cpu/sh2a/setup-mxg.c
arch/sh/kernel/cpu/sh2a/setup-sh7201.c
arch/sh/kernel/cpu/sh2a/setup-sh7203.c
arch/sh/kernel/cpu/sh2a/setup-sh7206.c
arch/sh/kernel/cpu/sh2a/setup-sh7264.c
arch/sh/kernel/cpu/sh2a/setup-sh7269.c
arch/sh/kernel/cpu/sh3/setup-sh7705.c
arch/sh/kernel/cpu/sh3/setup-sh770x.c
arch/sh/kernel/cpu/sh3/setup-sh7710.c
arch/sh/kernel/cpu/sh3/setup-sh7720.c
arch/sh/kernel/cpu/sh4/setup-sh4-202.c
arch/sh/kernel/cpu/sh4/setup-sh7750.c
arch/sh/kernel/cpu/sh4/setup-sh7760.c
arch/sh/kernel/cpu/sh4a/setup-sh7343.c
arch/sh/kernel/cpu/sh4a/setup-sh7366.c
arch/sh/kernel/cpu/sh4a/setup-sh7722.c
arch/sh/kernel/cpu/sh4a/setup-sh7723.c
arch/sh/kernel/cpu/sh4a/setup-sh7724.c
arch/sh/kernel/cpu/sh4a/setup-sh7734.c
arch/sh/kernel/cpu/sh4a/setup-sh7757.c
arch/sh/kernel/cpu/sh4a/setup-sh7763.c
arch/sh/kernel/cpu/sh4a/setup-sh7770.c
arch/sh/kernel/cpu/sh4a/setup-sh7780.c
arch/sh/kernel/cpu/sh4a/setup-sh7785.c
arch/sh/kernel/cpu/sh4a/setup-sh7786.c
arch/sh/kernel/cpu/sh4a/setup-shx3.c
arch/sh/kernel/cpu/sh5/setup-sh5.c
arch/x86/crypto/Makefile
arch/x86/crypto/aesni-intel_avx-x86_64.S [new file with mode: 0644]
arch/x86/crypto/aesni-intel_glue.c
crypto/Makefile
crypto/ahash.c
crypto/memneq.c
crypto/pcrypt.c
crypto/tcrypt.c
crypto/tcrypt.h
drivers/Makefile
drivers/amba/bus.c
drivers/bus/mvebu-mbus.c
drivers/clk/Kconfig
drivers/clk/Makefile
drivers/clk/at91/Makefile [new file with mode: 0644]
drivers/clk/at91/clk-main.c [new file with mode: 0644]
drivers/clk/at91/clk-master.c [new file with mode: 0644]
drivers/clk/at91/clk-peripheral.c [new file with mode: 0644]
drivers/clk/at91/clk-pll.c [new file with mode: 0644]
drivers/clk/at91/clk-plldiv.c [new file with mode: 0644]
drivers/clk/at91/clk-programmable.c [new file with mode: 0644]
drivers/clk/at91/clk-smd.c [new file with mode: 0644]
drivers/clk/at91/clk-system.c [new file with mode: 0644]
drivers/clk/at91/clk-usb.c [new file with mode: 0644]
drivers/clk/at91/clk-utmi.c [new file with mode: 0644]
drivers/clk/at91/pmc.c [new file with mode: 0644]
drivers/clk/at91/pmc.h [new file with mode: 0644]
drivers/clk/clk-composite.c
drivers/clk/clk-fixed-rate.c
drivers/clk/clk-max77686.c
drivers/clk/clk-prima2.c [deleted file]
drivers/clk/clk-si570.c [new file with mode: 0644]
drivers/clk/clk-vt8500.c
drivers/clk/clk.c
drivers/clk/clk.h [new file with mode: 0644]
drivers/clk/clkdev.c
drivers/clk/hisilicon/Makefile [new file with mode: 0644]
drivers/clk/hisilicon/clk-hi3620.c [new file with mode: 0644]
drivers/clk/hisilicon/clk.c [new file with mode: 0644]
drivers/clk/hisilicon/clk.h [new file with mode: 0644]
drivers/clk/hisilicon/clkgate-separated.c [new file with mode: 0644]
drivers/clk/keystone/gate.c
drivers/clk/keystone/pll.c
drivers/clk/mvebu/Kconfig
drivers/clk/mvebu/Makefile
drivers/clk/mvebu/clk-corediv.c [new file with mode: 0644]
drivers/clk/mvebu/clk-cpu.c
drivers/clk/qcom/Kconfig [new file with mode: 0644]
drivers/clk/qcom/Makefile [new file with mode: 0644]
drivers/clk/qcom/clk-branch.c [new file with mode: 0644]
drivers/clk/qcom/clk-branch.h [new file with mode: 0644]
drivers/clk/qcom/clk-pll.c [new file with mode: 0644]
drivers/clk/qcom/clk-pll.h [new file with mode: 0644]
drivers/clk/qcom/clk-rcg.c [new file with mode: 0644]
drivers/clk/qcom/clk-rcg.h [new file with mode: 0644]
drivers/clk/qcom/clk-rcg2.c [new file with mode: 0644]
drivers/clk/qcom/clk-regmap.c [new file with mode: 0644]
drivers/clk/qcom/clk-regmap.h [new file with mode: 0644]
drivers/clk/qcom/gcc-msm8660.c [new file with mode: 0644]
drivers/clk/qcom/gcc-msm8960.c [new file with mode: 0644]
drivers/clk/qcom/gcc-msm8974.c [new file with mode: 0644]
drivers/clk/qcom/mmcc-msm8960.c [new file with mode: 0644]
drivers/clk/qcom/mmcc-msm8974.c [new file with mode: 0644]
drivers/clk/qcom/reset.c [new file with mode: 0644]
drivers/clk/qcom/reset.h [new file with mode: 0644]
drivers/clk/samsung/clk-exynos-audss.c
drivers/clk/samsung/clk-exynos4.c
drivers/clk/samsung/clk-exynos5250.c
drivers/clk/samsung/clk-exynos5420.c
drivers/clk/samsung/clk-exynos5440.c
drivers/clk/shmobile/Makefile [new file with mode: 0644]
drivers/clk/shmobile/clk-div6.c [new file with mode: 0644]
drivers/clk/shmobile/clk-emev2.c [new file with mode: 0644]
drivers/clk/shmobile/clk-mstp.c [new file with mode: 0644]
drivers/clk/shmobile/clk-rcar-gen2.c [new file with mode: 0644]
drivers/clk/sirf/Makefile [new file with mode: 0644]
drivers/clk/sirf/atlas6.h [new file with mode: 0644]
drivers/clk/sirf/clk-atlas6.c [new file with mode: 0644]
drivers/clk/sirf/clk-common.c [new file with mode: 0644]
drivers/clk/sirf/clk-prima2.c [new file with mode: 0644]
drivers/clk/sirf/prima2.h [new file with mode: 0644]
drivers/clk/socfpga/clk.c
drivers/clk/spear/clk-frac-synth.c
drivers/clk/sunxi/clk-factors.c
drivers/clk/sunxi/clk-factors.h
drivers/clk/sunxi/clk-sunxi.c
drivers/clk/tegra/Makefile
drivers/clk/tegra/clk-id.h [new file with mode: 0644]
drivers/clk/tegra/clk-periph-gate.c
drivers/clk/tegra/clk-periph.c
drivers/clk/tegra/clk-pll.c
drivers/clk/tegra/clk-tegra-audio.c [new file with mode: 0644]
drivers/clk/tegra/clk-tegra-fixed.c [new file with mode: 0644]
drivers/clk/tegra/clk-tegra-periph.c [new file with mode: 0644]
drivers/clk/tegra/clk-tegra-pmc.c [new file with mode: 0644]
drivers/clk/tegra/clk-tegra-super-gen4.c [new file with mode: 0644]
drivers/clk/tegra/clk-tegra114.c
drivers/clk/tegra/clk-tegra124.c [new file with mode: 0644]
drivers/clk/tegra/clk-tegra20.c
drivers/clk/tegra/clk-tegra30.c
drivers/clk/tegra/clk.c
drivers/clk/tegra/clk.h
drivers/clk/ux500/clk-prcmu.c
drivers/clk/versatile/clk-icst.c
drivers/clk/versatile/clk-icst.h
drivers/clk/versatile/clk-impd1.c
drivers/clk/versatile/clk-integrator.c
drivers/clk/versatile/clk-realview.c
drivers/clk/versatile/clk-sp810.c
drivers/clk/zynq/clkc.c
drivers/clocksource/Makefile
drivers/clocksource/exynos_mct.c
drivers/clocksource/nomadik-mtu.c
drivers/cpufreq/exynos-cpufreq.h
drivers/cpufreq/exynos4210-cpufreq.c
drivers/cpufreq/exynos4x12-cpufreq.c
drivers/cpufreq/exynos5250-cpufreq.c
drivers/crypto/Kconfig
drivers/crypto/Makefile
drivers/crypto/amcc/crypto4xx_core.c
drivers/crypto/atmel-aes.c
drivers/crypto/atmel-sha.c
drivers/crypto/atmel-tdes.c
drivers/crypto/caam/caamalg.c
drivers/crypto/ccp/Kconfig [new file with mode: 0644]
drivers/crypto/ccp/Makefile [new file with mode: 0644]
drivers/crypto/ccp/ccp-crypto-aes-cmac.c [new file with mode: 0644]
drivers/crypto/ccp/ccp-crypto-aes-xts.c [new file with mode: 0644]
drivers/crypto/ccp/ccp-crypto-aes.c [new file with mode: 0644]
drivers/crypto/ccp/ccp-crypto-main.c [new file with mode: 0644]
drivers/crypto/ccp/ccp-crypto-sha.c [new file with mode: 0644]
drivers/crypto/ccp/ccp-crypto.h [new file with mode: 0644]
drivers/crypto/ccp/ccp-dev.c [new file with mode: 0644]
drivers/crypto/ccp/ccp-dev.h [new file with mode: 0644]
drivers/crypto/ccp/ccp-ops.c [new file with mode: 0644]
drivers/crypto/ccp/ccp-pci.c [new file with mode: 0644]
drivers/crypto/dcp.c [deleted file]
drivers/crypto/mxs-dcp.c [new file with mode: 0644]
drivers/crypto/omap-aes.c
drivers/crypto/omap-sham.c
drivers/crypto/talitos.c
drivers/devfreq/exynos/exynos4_bus.c
drivers/devfreq/exynos/exynos4_bus.h [new file with mode: 0644]
drivers/dma/Kconfig
drivers/dma/dmaengine.c
drivers/dma/mmp_pdma.c
drivers/dma/ste_dma40.c
drivers/dma/tegra20-apb-dma.c
drivers/gpio/Kconfig
drivers/gpio/Makefile
drivers/gpio/gpio-davinci.c
drivers/gpu/drm/tegra/Kconfig
drivers/gpu/drm/tegra/dc.c
drivers/gpu/drm/tegra/drm.h
drivers/gpu/drm/tegra/gr3d.c
drivers/gpu/drm/tegra/hdmi.c
drivers/i2c/busses/i2c-mv64xxx.c
drivers/i2c/busses/i2c-tegra.c
drivers/input/keyboard/tegra-kbc.c
drivers/input/serio/ambakmi.c
drivers/irqchip/Kconfig
drivers/irqchip/Makefile
drivers/irqchip/exynos-combiner.c
drivers/irqchip/irq-dw-apb-ictl.c [new file with mode: 0644]
drivers/irqchip/irq-renesas-irqc.c
drivers/irqchip/irq-sirfsoc.c
drivers/irqchip/irq-versatile-fpga.c
drivers/media/platform/omap3isp/isp.c
drivers/media/platform/omap3isp/isp.h
drivers/mmc/host/Kconfig
drivers/mmc/host/mmci.c
drivers/pci/host/pci-tegra.c
drivers/pinctrl/pinctrl-nomadik.c
drivers/pinctrl/pinctrl-nomadik.h
drivers/reset/Makefile
drivers/reset/reset-sunxi.c [new file with mode: 0644]
drivers/rtc/Kconfig
drivers/rtc/Makefile
drivers/rtc/rtc-isl12057.c [new file with mode: 0644]
drivers/rtc/rtc-sunxi.c [new file with mode: 0644]
drivers/spi/Kconfig
drivers/spi/spi-tegra114.c
drivers/spi/spi-tegra20-sflash.c
drivers/spi/spi-tegra20-slink.c
drivers/staging/nvec/nvec.c
drivers/staging/nvec/nvec.h
drivers/tty/serial/Kconfig
drivers/tty/serial/serial-tegra.c
drivers/tty/serial/sh-sci.c
drivers/tty/serial/sh-sci.h
drivers/tty/tty_audit.c
drivers/usb/gadget/atmel_usba_udc.c
drivers/usb/host/ehci-tegra.c
drivers/usb/host/r8a66597-hcd.c
drivers/usb/phy/phy-msm-usb.c
drivers/watchdog/davinci_wdt.c
include/asm-generic/audit_change_attr.h
include/asm-generic/audit_write.h
include/dt-bindings/clk/at91.h [new file with mode: 0644]
include/dt-bindings/clk/exynos-audss-clk.h
include/dt-bindings/clock/exynos4.h [new file with mode: 0644]
include/dt-bindings/clock/exynos5250.h [new file with mode: 0644]
include/dt-bindings/clock/exynos5420.h [new file with mode: 0644]
include/dt-bindings/clock/exynos5440.h [new file with mode: 0644]
include/dt-bindings/clock/hi3620-clock.h [new file with mode: 0644]
include/dt-bindings/clock/imx5-clock.h [new file with mode: 0644]
include/dt-bindings/clock/imx6sl-clock.h
include/dt-bindings/clock/qcom,gcc-msm8660.h [new file with mode: 0644]
include/dt-bindings/clock/qcom,gcc-msm8960.h [new file with mode: 0644]
include/dt-bindings/clock/qcom,gcc-msm8974.h [new file with mode: 0644]
include/dt-bindings/clock/qcom,mmcc-msm8960.h [new file with mode: 0644]
include/dt-bindings/clock/qcom,mmcc-msm8974.h [new file with mode: 0644]
include/dt-bindings/clock/r8a7790-clock.h [new file with mode: 0644]
include/dt-bindings/clock/r8a7791-clock.h [new file with mode: 0644]
include/dt-bindings/clock/tegra114-car.h
include/dt-bindings/clock/tegra124-car.h [new file with mode: 0644]
include/dt-bindings/clock/tegra20-car.h
include/dt-bindings/clock/tegra30-car.h
include/dt-bindings/clock/vf610-clock.h
include/dt-bindings/gpio/tegra-gpio.h
include/dt-bindings/pinctrl/omap.h
include/dt-bindings/pinctrl/pinctrl-tegra.h [new file with mode: 0644]
include/dt-bindings/reset/qcom,gcc-msm8660.h [new file with mode: 0644]
include/dt-bindings/reset/qcom,gcc-msm8960.h [new file with mode: 0644]
include/dt-bindings/reset/qcom,gcc-msm8974.h [new file with mode: 0644]
include/dt-bindings/reset/qcom,mmcc-msm8960.h [new file with mode: 0644]
include/dt-bindings/reset/qcom,mmcc-msm8974.h [new file with mode: 0644]
include/linux/audit.h
include/linux/ccp.h [new file with mode: 0644]
include/linux/clk-private.h
include/linux/clk-provider.h
include/linux/clk.h
include/linux/clk/at91_pmc.h [new file with mode: 0644]
include/linux/clk/shmobile.h [new file with mode: 0644]
include/linux/clk/tegra.h
include/linux/clkdev.h
include/linux/compiler-gcc.h
include/linux/compiler-intel.h
include/linux/compiler.h
include/linux/dmaengine.h
include/linux/init_task.h
include/linux/platform_data/clocksource-nomadik-mtu.h [deleted file]
include/linux/platform_data/gpio-davinci.h
include/linux/platform_data/pinctrl-nomadik.h [deleted file]
include/linux/reset-controller.h
include/linux/serial_sci.h
include/linux/tegra-powergate.h
include/linux/usb/msm_hsusb.h
include/net/netlabel.h
include/net/xfrm.h
include/sound/rcar_snd.h
include/uapi/linux/audit.h
kernel/audit.c
kernel/audit.h
kernel/auditfilter.c
kernel/auditsc.c
kernel/capability.c
kernel/padata.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
security/selinux/ss/services.c
security/smack/smack_lsm.c
sound/soc/atmel/Kconfig
sound/soc/tegra/Kconfig
sound/soc/tegra/tegra20_ac97.c
sound/soc/tegra/tegra20_i2s.c
sound/soc/tegra/tegra30_ahub.c
sound/soc/tegra/tegra30_ahub.h
sound/soc/tegra/tegra30_i2s.c
sound/soc/tegra/tegra30_i2s.h
sound/soc/tegra/tegra_pcm.c
sound/soc/tegra/tegra_pcm.h

index da0151db996419f0b685f35b0f461d38ffaec924..5a930c1528ad25c67f3cf98aa05a3ce9560b0019 100644 (file)
@@ -211,6 +211,30 @@ MMP/MMP2 family (communication processor)
    Linux kernel mach directory: arch/arm/mach-mmp
    Linux kernel plat directory: arch/arm/plat-pxa
 
+Berlin family (Digital Entertainment)
+-------------------------------------
+
+  Flavors:
+       88DE3005, Armada 1500-mini
+               Design name:    BG2CD
+               Core:           ARM Cortex-A9, PL310 L2CC
+               Homepage:       http://www.marvell.com/digital-entertainment/armada-1500-mini/
+       88DE3100, Armada 1500
+               Design name:    BG2
+               Core:           Marvell PJ4B (ARMv7), Tauros3 L2CC
+               Homepage:       http://www.marvell.com/digital-entertainment/armada-1500/
+               Product Brief:  http://www.marvell.com/digital-entertainment/armada-1500/assets/Marvell-ARMADA-1500-Product-Brief.pdf
+       88DE????
+               Design name:    BG3
+               Core:           ARM Cortex-A15, CA15 integrated L2CC
+
+  Homepage: http://www.marvell.com/digital-entertainment/
+  Directory: arch/arm/mach-berlin
+
+  Comments:
+   * This line of SoCs is based on Marvell Sheeva or ARM Cortex CPUs
+     with Synopsys DesignWare (IRQ, GPIO, Timers, ...) and PXA IP (SDHCI, USB, ETH, ...).
+
 Long-term plans
 ---------------
 
index 3aeb5c4404424a49b86232f55b7e118e2a06ae7c..699ef2a323b102a7c176a8cf30fcbd7ef99997ba 100644 (file)
@@ -77,6 +77,11 @@ the operations defined in clk.h:
                int             (*set_parent)(struct clk_hw *hw, u8 index);
                u8              (*get_parent)(struct clk_hw *hw);
                int             (*set_rate)(struct clk_hw *hw, unsigned long);
+               int             (*set_rate_and_parent)(struct clk_hw *hw,
+                                           unsigned long rate,
+                                           unsigned long parent_rate, u8 index);
+               unsigned long   (*recalc_accuracy)(struct clk_hw *hw,
+                                                  unsigned long parent_accuracy);
                void            (*init)(struct clk_hw *hw);
        };
 
@@ -202,6 +207,8 @@ optional or must be evaluated on a case-by-case basis.
 .set_parent     |      |             | n             | y           | n    |
 .get_parent     |      |             | n             | y           | n    |
                 |      |             |               |             |      |
+.recalc_accuracy|      |             |               |             |      |
+                |      |             |               |             |      |
 .init           |      |             |               |             |      |
                 -----------------------------------------------------------
 [1] either one of round_rate or determine_rate is required.
index 5fac246a9530168fc42b378d7b37da9e694dbb91..3509707f932085a8380576ee4c6b63a453dab1a7 100644 (file)
@@ -14,6 +14,9 @@ Required nodes:
 - core-module: the root node to the Integrator platforms must have
   a core-module with regs and the compatible string
   "arm,core-module-integrator"
+- external-bus-interface: the root node to the Integrator platforms
+  must have an external bus interface with regs and the
+  compatible-string "arm,external-bus-interface"
 
   Required properties for the core module:
   - regs: the location and size of the core module registers, one
@@ -48,6 +51,11 @@ Required nodes:
                reg = <0x10000000 0x200>;
        };
 
+       ebi@12000000 {
+               compatible = "arm,external-bus-interface";
+               reg = <0x12000000 0x100>;
+       };
+
        syscon {
                compatible = "arm,integrator-ap-syscon";
                reg = <0x11000000 0x100>;
index ad031211b5b8291e51f43cf9cfe34a431164de87..2742e9cfd6b1166c18fff7cabe63f972aea92b49 100644 (file)
@@ -2,6 +2,7 @@
 
 Required properties:
 - compatible: Should be "atmel,<chip>-aic"
+  <chip> can be "at91rm9200" or "sama5d3"
 - interrupt-controller: Identifies the node as an interrupt controller.
 - interrupt-parent: For single AIC system, it is an empty property.
 - #interrupt-cells: The number of cells to define the interrupts. It should be 3.
index 78530e621a1ea8fa89f6b000f1bf8b678424adb2..16f60b41c14722893584faf3e60148e2edb56f39 100644 (file)
@@ -58,7 +58,8 @@ Example:
        };
 
 RAMC SDRAM/DDR Controller required properties:
-- compatible: Should be "atmel,at91sam9260-sdramc",
+- compatible: Should be "atmel,at91rm9200-sdramc",
+                       "atmel,at91sam9260-sdramc",
                        "atmel,at91sam9g45-ddramc",
 - reg: Should contain registers location and length
   For at91sam9263 and at91sam9g45 you must specify 2 entries.
diff --git a/Documentation/devicetree/bindings/arm/firmware/tlm,trusted-foundations.txt b/Documentation/devicetree/bindings/arm/firmware/tlm,trusted-foundations.txt
new file mode 100644 (file)
index 0000000..780d039
--- /dev/null
@@ -0,0 +1,20 @@
+Trusted Foundations
+-------------------
+
+Boards that use the Trusted Foundations secure monitor can signal its
+presence by declaring a node compatible with "tlm,trusted-foundations"
+under the /firmware/ node
+
+Required properties:
+- compatible: "tlm,trusted-foundations"
+- tlm,version-major: major version number of Trusted Foundations firmware
+- tlm,version-minor: minor version number of Trusted Foundations firmware
+
+Example:
+       firmware {
+               trusted-foundations {
+                       compatible = "tlm,trusted-foundations";
+                       tlm,version-major = <2>;
+                       tlm,version-minor = <8>;
+               };
+       };
diff --git a/Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt b/Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt
new file mode 100644 (file)
index 0000000..8c7a465
--- /dev/null
@@ -0,0 +1,32 @@
+Hisilicon Platforms Device Tree Bindings
+----------------------------------------------------
+
+Hi4511 Board
+Required root node properties:
+       - compatible = "hisilicon,hi3620-hi4511";
+
+Hisilicon system controller
+
+Required properties:
+- compatible : "hisilicon,sysctrl"
+- reg : Register address and size
+
+Optional properties:
+- smp-offset : offset in sysctrl for notifying slave cpu booting
+               cpu 1, reg;
+               cpu 2, reg + 0x4;
+               cpu 3, reg + 0x8;
+               If reg value is not zero, cpun exit wfi and go
+- resume-offset : offset in sysctrl for notifying cpu0 when resume
+- reboot-offset : offset in sysctrl for system reboot
+
+Example:
+
+       /* for Hi3620 */
+       sysctrl: system-controller@fc802000 {
+               compatible = "hisilicon,sysctrl";
+               reg = <0xfc802000 0x1000>;
+               smp-offset = <0x31c>;
+               resume-offset = <0x308>;
+               reboot-offset = <0x4>;
+       };
index c0c7626fd0ff760075c2c97c866c9f83cdb21819..b513cb8196fefd3564c09ee8b6bc60285875185a 100644 (file)
@@ -7,20 +7,21 @@ The ARM L2 cache representation in the device tree should be done as follows:
 Required properties:
 
 - compatible : should be one of:
-       "arm,pl310-cache"
-       "arm,l220-cache"
-       "arm,l210-cache"
-       "marvell,aurora-system-cache": Marvell Controller designed to be
+  "arm,pl310-cache"
+  "arm,l220-cache"
+  "arm,l210-cache"
+  "bcm,bcm11351-a2-pl310-cache": DEPRECATED by "brcm,bcm11351-a2-pl310-cache"
+  "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
+     offset needs to be added to the address before passing down to the L2
+     cache controller
+  "marvell,aurora-system-cache": Marvell Controller designed to be
      compatible with the ARM one, with system cache mode (meaning
      maintenance operations on L1 are broadcasted to the L2 and L2
      performs the same operation).
-       "marvell,"aurora-outer-cache: Marvell Controller designed to be
-        compatible with the ARM one with outer cache mode.
-       "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
-       offset needs to be added to the address before passing down to the L2
-       cache controller
-       "bcm,bcm11351-a2-pl310-cache": DEPRECATED by
-                                      "brcm,bcm11351-a2-pl310-cache"
+  "marvell,aurora-outer-cache": Marvell Controller designed to be
+     compatible with the ARM one with outer cache mode.
+  "marvell,tauros3-cache": Marvell Tauros3 cache controller, compatible
+     with arm,pl310-cache controller.
 - cache-unified : Specifies the cache is a unified cache.
 - cache-level : Should be set to 2 for a level 2 cache.
 - reg : Physical base address and size of cache controller's memory mapped
diff --git a/Documentation/devicetree/bindings/arm/marvell,berlin.txt b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
new file mode 100644 (file)
index 0000000..737afa5
--- /dev/null
@@ -0,0 +1,24 @@
+Marvell Berlin SoC Family Device Tree Bindings
+---------------------------------------------------------------
+
+Boards with a SoC of the Marvell Berlin family, e.g. Armada 1500
+shall have the following properties:
+
+* Required root node properties:
+compatible: must contain "marvell,berlin"
+
+In addition, the above compatible shall be extended with the specific
+SoC and board used. Currently known SoC compatibles are:
+    "marvell,berlin2"      for Marvell Armada 1500 (BG2, 88DE3100),
+    "marvell,berlin2cd"    for Marvell Armada 1500-mini (BG2CD, 88DE3005)
+    "marvell,berlin2ct"    for Marvell Armada ? (BG2CT, 88DE????)
+    "marvell,berlin3"      for Marvell Armada ? (BG3, 88DE????)
+
+* Example:
+
+/ {
+       model = "Sony NSZ-GS7";
+       compatible = "sony,nsz-gs7", "marvell,berlin2", "marvell,berlin";
+
+       ...
+}
diff --git a/Documentation/devicetree/bindings/arm/moxart.txt b/Documentation/devicetree/bindings/arm/moxart.txt
new file mode 100644 (file)
index 0000000..11087ed
--- /dev/null
@@ -0,0 +1,12 @@
+MOXA ART device tree bindings
+
+Boards with the MOXA ART SoC shall have the following properties:
+
+Required root node property:
+
+compatible = "moxa,moxart";
+
+Boards:
+
+- UC-7112-LX: embedded computer
+  compatible = "moxa,moxart-uc-7112-lx", "moxa,moxart"
index 808c1543b0f87f374c5d93517d8389a3b3479be9..34dc40cffdfd8bfa316d55c2db5cc7a49fc1e999 100644 (file)
@@ -31,6 +31,59 @@ spinlock@1 {
     ti,hwmods = "spinlock";
 };
 
+SoC Type (optional):
+
+- General Purpose devices
+  compatible = "ti,gp"
+- High Security devices
+  compatible = "ti,hs"
+
+SoC Families:
+
+- OMAP2 generic - defaults to OMAP2420
+  compatible = "ti,omap2"
+- OMAP3 generic - defaults to OMAP3430
+  compatible = "ti,omap3"
+- OMAP4 generic - defaults to OMAP4430
+  compatible = "ti,omap4"
+- OMAP5 generic - defaults to OMAP5430
+  compatible = "ti,omap5"
+- DRA7 generic - defaults to DRA742
+  compatible = "ti,dra7"
+- AM43x generic - defaults to AM4372
+  compatible = "ti,am43"
+
+SoCs:
+
+- OMAP2420
+  compatible = "ti,omap2420", "ti,omap2"
+- OMAP2430
+  compatible = "ti,omap2430", "ti,omap2"
+
+- OMAP3430
+  compatible = "ti,omap3430", "ti,omap3"
+- AM3517
+  compatible = "ti,am3517", "ti,omap3"
+- OMAP3630
+  compatible = "ti,omap36xx", "ti,omap3"
+- AM33xx
+  compatible = "ti,am33xx", "ti,omap3"
+
+- OMAP4430
+  compatible = "ti,omap4430", "ti,omap4"
+- OMAP4460
+  compatible = "ti,omap4460", "ti,omap4"
+
+- OMAP5430
+  compatible = "ti,omap5430", "ti,omap5"
+- OMAP5432
+  compatible = "ti,omap5432", "ti,omap5"
+
+- DRA742
+  compatible = "ti,dra7xx", "ti,dra7"
+
+- AM4372
+  compatible = "ti,am4372", "ti,am43"
 
 Boards:
 
index 5039c0a12f55a6bae5f6de7a1981d452330923df..0ab3251a6ec23e6853002d3a55172dac6d8c281d 100644 (file)
@@ -1,7 +1,12 @@
 SAMSUNG S5P/Exynos SoC series System Registers (SYSREG)
 
 Properties:
- - name : should be 'sysreg';
  - compatible : should contain "samsung,<chip name>-sysreg", "syscon";
    For Exynos4 SoC series it should be "samsung,exynos4-sysreg", "syscon";
  - reg : offset and length of the register set.
+
+Example:
+       syscon@10010000 {
+               compatible = "samsung,exynos4-sysreg", "syscon";
+               reg = <0x10010000 0x400>;
+       };
index ed9c85334436f4a263a974c29d7d871eefb08f93..558ed4b4ef391faffe47afe815012f43ff13080b 100644 (file)
@@ -32,3 +32,8 @@ board-specific compatible values:
   nvidia,whistler
   toradex,colibri_t20-512
   toradex,iris
+
+Trusted Foundations
+-------------------------------------------
+Tegra supports the Trusted Foundation secure monitor. See the
+"tlm,trusted-foundations" binding's documentation for more details.
index 1608a54e90e1541e6a1f7ca918f194f9763ed35e..68ac65f82a1c590e6f046c6b926523d816d5fbe7 100644 (file)
@@ -9,6 +9,7 @@ Required properties:
 - compatible : Should contain "nvidia,tegra<chip>-pmc".
 - reg : Offset and length of the register set for the device
 - clocks : Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
 - clock-names : Must include the following entries:
   "pclk" (The Tegra clock of that name),
   "clk32k_in" (The 32KHz clock input to Tegra).
index 9989eda755d9bef56ac37048300fd2a879d66b60..c9cf605bb9957028bf234bd249f52573fb5212b8 100644 (file)
@@ -29,3 +29,8 @@ pic: pic@14000000 {
         clear-mask = <0xffffffff>;
         valid-mask = <0x003fffff>;
 };
+
+Optional properties:
+- interrupts: if the FPGA IRQ controller is cascaded, i.e. if its IRQ
+  output is simply connected to the input of another IRQ controller,
+  then the parent IRQ shall be specified in this property.
diff --git a/Documentation/devicetree/bindings/clock/at91-clock.txt b/Documentation/devicetree/bindings/clock/at91-clock.txt
new file mode 100644 (file)
index 0000000..cd5e239
--- /dev/null
@@ -0,0 +1,339 @@
+Device Tree Clock bindings for arch-at91
+
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties:
+- compatible : shall be one of the following:
+       "atmel,at91rm9200-pmc" or
+       "atmel,at91sam9g45-pmc" or
+       "atmel,at91sam9n12-pmc" or
+       "atmel,at91sam9x5-pmc" or
+       "atmel,sama5d3-pmc":
+               at91 PMC (Power Management Controller)
+               All at91 specific clocks (clocks defined below) must be child
+               node of the PMC node.
+
+       "atmel,at91rm9200-clk-main":
+               at91 main oscillator
+
+       "atmel,at91rm9200-clk-master" or
+       "atmel,at91sam9x5-clk-master":
+               at91 master clock
+
+       "atmel,at91sam9x5-clk-peripheral" or
+       "atmel,at91rm9200-clk-peripheral":
+               at91 peripheral clocks
+
+       "atmel,at91rm9200-clk-pll" or
+       "atmel,at91sam9g45-clk-pll" or
+       "atmel,at91sam9g20-clk-pllb" or
+       "atmel,sama5d3-clk-pll":
+               at91 pll clocks
+
+       "atmel,at91sam9x5-clk-plldiv":
+               at91 plla divisor
+
+       "atmel,at91rm9200-clk-programmable" or
+       "atmel,at91sam9g45-clk-programmable" or
+       "atmel,at91sam9x5-clk-programmable":
+               at91 programmable clocks
+
+       "atmel,at91sam9x5-clk-smd":
+               at91 SMD (Soft Modem) clock
+
+       "atmel,at91rm9200-clk-system":
+               at91 system clocks
+
+       "atmel,at91rm9200-clk-usb" or
+       "atmel,at91sam9x5-clk-usb" or
+       "atmel,at91sam9n12-clk-usb":
+               at91 usb clock
+
+       "atmel,at91sam9x5-clk-utmi":
+               at91 utmi clock
+
+Required properties for PMC node:
+- reg : defines the IO memory reserved for the PMC.
+- #size-cells : shall be 0 (reg is used to encode clk id).
+- #address-cells : shall be 1 (reg is used to encode clk id).
+- interrupts : shall be set to PMC interrupt line.
+- interrupt-controller : tell that the PMC is an interrupt controller.
+- #interrupt-cells : must be set to 1. The first cell encodes the interrupt id,
+       and reflect the bit position in the PMC_ER/DR/SR registers.
+       You can use the dt macros defined in dt-bindings/clk/at91.h.
+       0 (AT91_PMC_MOSCS) -> main oscillator ready
+       1 (AT91_PMC_LOCKA) -> PLL A ready
+       2 (AT91_PMC_LOCKB) -> PLL B ready
+       3 (AT91_PMC_MCKRDY) -> master clock ready
+       6 (AT91_PMC_LOCKU) -> UTMI PLL clock ready
+       8 .. 15 (AT91_PMC_PCKRDY(id)) -> programmable clock ready
+       16 (AT91_PMC_MOSCSELS) -> main oscillator selected
+       17 (AT91_PMC_MOSCRCS) -> RC main oscillator stabilized
+       18 (AT91_PMC_CFDEV) -> clock failure detected
+
+For example:
+       pmc: pmc@fffffc00 {
+               compatible = "atmel,sama5d3-pmc";
+               interrupts = <1 4 7>;
+               interrupt-controller;
+               #interrupt-cells = <2>;
+               #size-cells = <0>;
+               #address-cells = <1>;
+
+               /* put at91 clocks here */
+       };
+
+Required properties for main clock:
+- interrupt-parent : must reference the PMC node.
+- interrupts : shall be set to "<0>".
+- #clock-cells : from common clock binding; shall be set to 0.
+- clocks (optional if clock-frequency is provided) : shall be the slow clock
+       phandle. This clock is used to calculate the main clock rate if
+       "clock-frequency" is not provided.
+- clock-frequency : the main oscillator frequency.Prefer the use of
+       "clock-frequency" over automatic clock rate calculation.
+
+For example:
+       main: mainck {
+               compatible = "atmel,at91rm9200-clk-main";
+               interrupt-parent = <&pmc>;
+               interrupts = <0>;
+               #clock-cells = <0>;
+               clocks = <&ck32k>;
+               clock-frequency = <18432000>;
+       };
+
+Required properties for master clock:
+- interrupt-parent : must reference the PMC node.
+- interrupts : shall be set to "<3>".
+- #clock-cells : from common clock binding; shall be set to 0.
+- clocks : shall be the master clock sources (see atmel datasheet) phandles.
+       e.g. "<&ck32k>, <&main>, <&plla>, <&pllb>".
+- atmel,clk-output-range : minimum and maximum clock frequency (two u32
+                          fields).
+          e.g. output = <0 133000000>; <=> 0 to 133MHz.
+- atmel,clk-divisors : master clock divisors table (four u32 fields).
+               0 <=> reserved value.
+               e.g. divisors = <1 2 4 6>;
+- atmel,master-clk-have-div3-pres : some SoC use the reserved value 7 in the
+                                   PRES field as CLOCK_DIV3 (e.g sam9x5).
+
+For example:
+       mck: mck {
+               compatible = "atmel,at91rm9200-clk-master";
+               interrupt-parent = <&pmc>;
+               interrupts = <3>;
+               #clock-cells = <0>;
+               atmel,clk-output-range = <0 133000000>;
+               atmel,clk-divisors = <1 2 4 0>;
+       };
+
+Required properties for peripheral clocks:
+- #size-cells : shall be 0 (reg is used to encode clk id).
+- #address-cells : shall be 1 (reg is used to encode clk id).
+- clocks : shall be the master clock phandle.
+       e.g. clocks = <&mck>;
+- name: device tree node describing a specific system clock.
+       * #clock-cells : from common clock binding; shall be set to 0.
+       * reg: peripheral id. See Atmel's datasheets to get a full
+         list of peripheral ids.
+       * atmel,clk-output-range : minimum and maximum clock frequency
+         (two u32 fields). Only valid on at91sam9x5-clk-peripheral
+         compatible IPs.
+
+For example:
+       periph: periphck {
+               compatible = "atmel,at91sam9x5-clk-peripheral";
+               #size-cells = <0>;
+               #address-cells = <1>;
+               clocks = <&mck>;
+
+               ssc0_clk {
+                       #clock-cells = <0>;
+                       reg = <2>;
+                       atmel,clk-output-range = <0 133000000>;
+               };
+
+               usart0_clk {
+                       #clock-cells = <0>;
+                       reg = <3>;
+                       atmel,clk-output-range = <0 66000000>;
+               };
+       };
+
+
+Required properties for pll clocks:
+- interrupt-parent : must reference the PMC node.
+- interrupts : shall be set to "<1>".
+- #clock-cells : from common clock binding; shall be set to 0.
+- clocks : shall be the main clock phandle.
+- reg : pll id.
+       0 -> PLL A
+       1 -> PLL B
+- atmel,clk-input-range : minimum and maximum source clock frequency (two u32
+                         fields).
+         e.g. input = <1 32000000>; <=> 1 to 32MHz.
+- #atmel,pll-clk-output-range-cells : number of cells reserved for pll output
+                                     range description. Sould be set to 2, 3
+                                     or 4.
+       * 1st and 2nd cells represent the frequency range (min-max).
+       * 3rd cell is optional and represents the OUT field value for the given
+         range.
+       * 4th cell is optional and represents the ICPLL field (PLLICPR
+         register)
+- atmel,pll-clk-output-ranges : pll output frequency ranges + optional parameter
+                               depending on #atmel,pll-output-range-cells
+                               property value.
+
+For example:
+       plla: pllack {
+               compatible = "atmel,at91sam9g45-clk-pll";
+               interrupt-parent = <&pmc>;
+               interrupts = <1>;
+               #clock-cells = <0>;
+               clocks = <&main>;
+               reg = <0>;
+               atmel,clk-input-range = <2000000 32000000>;
+               #atmel,pll-clk-output-range-cells = <4>;
+               atmel,pll-clk-output-ranges = <74500000 800000000 0 0
+                                              69500000 750000000 1 0
+                                              64500000 700000000 2 0
+                                              59500000 650000000 3 0
+                                              54500000 600000000 0 1
+                                              49500000 550000000 1 1
+                                              44500000 500000000 2 1
+                                              40000000 450000000 3 1>;
+       };
+
+Required properties for plldiv clocks (plldiv = pll / 2):
+- #clock-cells : from common clock binding; shall be set to 0.
+- clocks : shall be the plla clock phandle.
+
+The pll divisor is equal to 2 and cannot be changed.
+
+For example:
+       plladiv: plladivck {
+               compatible = "atmel,at91sam9x5-clk-plldiv";
+               #clock-cells = <0>;
+               clocks = <&plla>;
+       };
+
+Required properties for programmable clocks:
+- interrupt-parent : must reference the PMC node.
+- #size-cells : shall be 0 (reg is used to encode clk id).
+- #address-cells : shall be 1 (reg is used to encode clk id).
+- clocks : shall be the programmable clock source phandles.
+       e.g. clocks = <&clk32k>, <&main>, <&plla>, <&pllb>;
+- name: device tree node describing a specific prog clock.
+       * #clock-cells : from common clock binding; shall be set to 0.
+       * reg : programmable clock id (register offset from  PCKx
+                        register).
+       * interrupts : shall be set to "<(8 + id)>".
+
+For example:
+       prog: progck {
+               compatible = "atmel,at91sam9g45-clk-programmable";
+               #size-cells = <0>;
+               #address-cells = <1>;
+               interrupt-parent = <&pmc>;
+               clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>;
+
+               prog0 {
+                       #clock-cells = <0>;
+                       reg = <0>;
+                       interrupts = <8>;
+               };
+
+               prog1 {
+                       #clock-cells = <0>;
+                       reg = <1>;
+                       interrupts = <9>;
+               };
+       };
+
+
+Required properties for smd clock:
+- #clock-cells : from common clock binding; shall be set to 0.
+- clocks : shall be the smd clock source phandles.
+       e.g. clocks = <&plladiv>, <&utmi>;
+
+For example:
+       smd: smdck {
+               compatible = "atmel,at91sam9x5-clk-smd";
+               #clock-cells = <0>;
+               clocks = <&plladiv>, <&utmi>;
+       };
+
+Required properties for system clocks:
+- #size-cells : shall be 0 (reg is used to encode clk id).
+- #address-cells : shall be 1 (reg is used to encode clk id).
+- name: device tree node describing a specific system clock.
+       * #clock-cells : from common clock binding; shall be set to 0.
+       * reg: system clock id (bit position in SCER/SCDR/SCSR registers).
+             See Atmel's datasheet to get a full list of system clock ids.
+
+For example:
+       system: systemck {
+               compatible = "atmel,at91rm9200-clk-system";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ddrck {
+                       #clock-cells = <0>;
+                       reg = <2>;
+                       clocks = <&mck>;
+               };
+
+               uhpck {
+                       #clock-cells = <0>;
+                       reg = <6>;
+                       clocks = <&usb>;
+               };
+
+               udpck {
+                       #clock-cells = <0>;
+                       reg = <7>;
+                       clocks = <&usb>;
+               };
+       };
+
+
+Required properties for usb clock:
+- #clock-cells : from common clock binding; shall be set to 0.
+- clocks : shall be the smd clock source phandles.
+       e.g. clocks = <&pllb>;
+- atmel,clk-divisors (only available for "atmel,at91rm9200-clk-usb"):
+       usb clock divisor table.
+       e.g. divisors = <1 2 4 0>;
+
+For example:
+       usb: usbck {
+               compatible = "atmel,at91sam9x5-clk-usb";
+               #clock-cells = <0>;
+               clocks = <&plladiv>, <&utmi>;
+       };
+
+       usb: usbck {
+               compatible = "atmel,at91rm9200-clk-usb";
+               #clock-cells = <0>;
+               clocks = <&pllb>;
+               atmel,clk-divisors = <1 2 4 0>;
+       };
+
+
+Required properties for utmi clock:
+- interrupt-parent : must reference the PMC node.
+- interrupts : shall be set to "<AT91_PMC_LOCKU IRQ_TYPE_LEVEL_HIGH>".
+- #clock-cells : from common clock binding; shall be set to 0.
+- clocks : shall be the main clock source phandle.
+
+For example:
+       utmi: utmick {
+               compatible = "atmel,at91sam9x5-clk-utmi";
+               interrupt-parent = <&pmc>;
+               interrupts = <AT91_PMC_LOCKU IRQ_TYPE_LEVEL_HIGH>;
+               #clock-cells = <0>;
+               clocks = <&main>;
+       };
index 75e2e1999f87dabdb7eccc94ba01d472533a69fd..180e8835569e9e017bb7148b83d3e5b79f5d0495 100644 (file)
@@ -8,12 +8,29 @@ Required Properties:
 
 - compatible: should be one of the following:
   - "samsung,exynos4210-audss-clock" - controller compatible with all Exynos4 SoCs.
-  - "samsung,exynos5250-audss-clock" - controller compatible with all Exynos5 SoCs.
-
+  - "samsung,exynos5250-audss-clock" - controller compatible with Exynos5250
+    SoCs.
+  - "samsung,exynos5420-audss-clock" - controller compatible with Exynos5420
+    SoCs.
 - reg: physical base address and length of the controller's register set.
 
 - #clock-cells: should be 1.
 
+- clocks:
+  - pll_ref: Fixed rate PLL reference clock, parent of mout_audss. "fin_pll"
+    is used if not specified.
+  - pll_in: Input PLL to the AudioSS block, parent of mout_audss. "fout_epll"
+    is used if not specified.
+  - cdclk: External i2s clock, parent of mout_i2s. "cdclk0" is used if not
+    specified.
+  - sclk_audio: Audio bus clock, parent of mout_i2s. "sclk_audio0" is used if
+    not specified.
+  - sclk_pcm_in: PCM clock, parent of sclk_pcm.  "sclk_pcm0" is used if not
+    specified.
+
+- clock-names: Aliases for the above clocks. They should be "pll_ref",
+  "pll_in", "cdclk", "sclk_audio", and "sclk_pcm_in" respectively.
+
 The following is the list of clocks generated by the controller. Each clock is
 assigned an identifier and client nodes use this identifier to specify the
 clock which they consume. Some of the clocks are available only on a particular
@@ -34,16 +51,30 @@ i2s_bus         6
 sclk_i2s        7
 pcm_bus         8
 sclk_pcm        9
+adma            10      Exynos5420
+
+Example 1: An example of a clock controller node using the default input
+          clock names is listed below.
+
+clock_audss: audss-clock-controller@3810000 {
+       compatible = "samsung,exynos5250-audss-clock";
+       reg = <0x03810000 0x0C>;
+       #clock-cells = <1>;
+};
 
-Example 1: An example of a clock controller node is listed below.
+Example 2: An example of a clock controller node with the input clocks
+           specified.
 
 clock_audss: audss-clock-controller@3810000 {
        compatible = "samsung,exynos5250-audss-clock";
        reg = <0x03810000 0x0C>;
        #clock-cells = <1>;
+       clocks = <&clock 1>, <&clock 7>, <&clock 138>, <&clock 160>,
+               <&ext_i2s_clk>;
+       clock-names = "pll_ref", "pll_in", "sclk_audio", "sclk_pcm_in", "cdclk";
 };
 
-Example 2: I2S controller node that consumes the clock generated by the clock
+Example 3: I2S controller node that consumes the clock generated by the clock
            controller. Refer to the standard clock bindings for information
            about 'clocks' and 'clock-names' property.
 
diff --git a/Documentation/devicetree/bindings/clock/emev2-clock.txt b/Documentation/devicetree/bindings/clock/emev2-clock.txt
new file mode 100644 (file)
index 0000000..60bbb1a
--- /dev/null
@@ -0,0 +1,98 @@
+Device tree Clock bindings for Renesas EMMA Mobile EV2
+
+This binding uses the common clock binding.
+
+* SMU
+System Management Unit described in user's manual R19UH0037EJ1000_SMU.
+This is not a clock provider, but clocks under SMU depend on it.
+
+Required properties:
+- compatible: Should be "renesas,emev2-smu"
+- reg: Address and Size of SMU registers
+
+* SMU_CLKDIV
+Function block with an input mux and a divider, which corresponds to
+"Serial clock generator" in fig."Clock System Overview" of the manual,
+and "xxx frequency division setting register" (XXXCLKDIV) registers.
+This makes internal (neither input nor output) clock that is provided
+to input of xxxGCLK block.
+
+Required properties:
+- compatible: Should be "renesas,emev2-smu-clkdiv"
+- reg: Byte offset from SMU base and Bit position in the register
+- clocks: Parent clocks. Input clocks as described in clock-bindings.txt
+- #clock-cells: Should be <0>
+
+* SMU_GCLK
+Clock gating node shown as "Clock stop processing block" in the
+fig."Clock System Overview" of the manual.
+Registers are "xxx clock gate control register" (XXXGCLKCTRL).
+
+Required properties:
+- compatible: Should be "renesas,emev2-smu-gclk"
+- reg: Byte offset from SMU base and Bit position in the register
+- clocks: Input clock as described in clock-bindings.txt
+- #clock-cells: Should be <0>
+
+Example of provider:
+
+usia_u0_sclkdiv: usia_u0_sclkdiv {
+       compatible = "renesas,emev2-smu-clkdiv";
+       reg = <0x610 0>;
+       clocks = <&pll3_fo>, <&pll4_fo>, <&pll1_fo>, <&osc1_fo>;
+       #clock-cells = <0>;
+};
+
+usia_u0_sclk: usia_u0_sclk {
+       compatible = "renesas,emev2-smu-gclk";
+       reg = <0x4a0 1>;
+       clocks = <&usia_u0_sclkdiv>;
+       #clock-cells = <0>;
+};
+
+Example of consumer:
+
+uart@e1020000 {
+       compatible = "renesas,em-uart";
+       reg = <0xe1020000 0x38>;
+       interrupts = <0 8 0>;
+       clocks = <&usia_u0_sclk>;
+       clock-names = "sclk";
+};
+
+Example of clock-tree description:
+
+ This describes a clock path in the clock tree
+  c32ki -> pll3_fo -> usia_u0_sclkdiv -> usia_u0_sclk
+
+smu@e0110000 {
+       compatible = "renesas,emev2-smu";
+       reg = <0xe0110000 0x10000>;
+       #address-cells = <2>;
+       #size-cells = <0>;
+
+       c32ki: c32ki {
+               compatible = "fixed-clock";
+               clock-frequency = <32768>;
+               #clock-cells = <0>;
+       };
+       pll3_fo: pll3_fo {
+               compatible = "fixed-factor-clock";
+               clocks = <&c32ki>;
+               clock-div = <1>;
+               clock-mult = <7000>;
+               #clock-cells = <0>;
+       };
+       usia_u0_sclkdiv: usia_u0_sclkdiv {
+               compatible = "renesas,emev2-smu-clkdiv";
+               reg = <0x610 0>;
+               clocks = <&pll3_fo>;
+               #clock-cells = <0>;
+       };
+       usia_u0_sclk: usia_u0_sclk {
+               compatible = "renesas,emev2-smu-gclk";
+               reg = <0x4a0 1>;
+               clocks = <&usia_u0_sclkdiv>;
+               #clock-cells = <0>;
+       };
+};
index 0f2f920e87348515995cb553ece45cf0949213b7..72ce617dea8210572f300501b4f9e79ad5aade78 100644 (file)
@@ -62,6 +62,7 @@ clock which they consume.
   div_i2s1             157
   div_i2s2             158
   sclk_hdmiphy         159
+  div_pcm0             160
 
 
    [Peripheral Clock Gates]
index 0b1fe7824093ae7c300bc4cd9077e71768056487..48ea0ad8ad46a7b24748fc83359c19e343f7bfbb 100644 (file)
@@ -10,6 +10,8 @@ Required properties:
 - clock-frequency : frequency of clock in Hz. Should be a single cell.
 
 Optional properties:
+- clock-accuracy : accuracy of clock in ppb (parts per billion).
+                  Should be a single cell.
 - gpios : From common gpio binding; gpio connection to clock enable pin.
 - clock-output-names : From common clock binding.
 
@@ -18,4 +20,5 @@ Example:
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <1000000000>;
+               clock-accuracy = <100>;
        };
index 5757f9abfc26e10ac737ff1278aaa885721c9abc..1bae8527eb9bc15cdb148daa861ee79272098094 100644 (file)
@@ -19,6 +19,6 @@ Example:
                compatible = "fixed-factor-clock";
                clocks = <&parentclk>;
                #clock-cells = <0>;
-               div = <2>;
-               mult = <1>;
+               clock-div = <2>;
+               clock-mult = <1>;
        };
diff --git a/Documentation/devicetree/bindings/clock/hi3620-clock.txt b/Documentation/devicetree/bindings/clock/hi3620-clock.txt
new file mode 100644 (file)
index 0000000..4b71ab4
--- /dev/null
@@ -0,0 +1,19 @@
+* Hisilicon Hi3620 Clock Controller
+
+The Hi3620 clock controller generates and supplies clock to various
+controllers within the Hi3620 SoC.
+
+Required Properties:
+
+- compatible: should be one of the following.
+  - "hisilicon,hi3620-clock" - controller compatible with Hi3620 SoC.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+Each clock is assigned an identifier and client nodes use this identifier
+to specify the clock which they consume.
+
+All these identifier could be found in <dt-bindings/clock/hi3620-clock.h>.
diff --git a/Documentation/devicetree/bindings/clock/imx35-clock.txt b/Documentation/devicetree/bindings/clock/imx35-clock.txt
new file mode 100644 (file)
index 0000000..a703564
--- /dev/null
@@ -0,0 +1,113 @@
+* Clock bindings for Freescale i.MX35
+
+Required properties:
+- compatible: Should be "fsl,imx35-ccm"
+- reg: Address and length of the register set
+- interrupts: Should contain CCM interrupt
+- #clock-cells: Should be <1>
+
+The clock consumer should specify the desired clock by having the clock
+ID in its "clocks" phandle cell.  The following is a full list of i.MX35
+clocks and IDs.
+
+       Clock                   ID
+       ---------------------------
+       ckih                    0
+       mpll                    1
+       ppll                    2
+       mpll_075                3
+       arm                     4
+       hsp                     5
+       hsp_div                 6
+       hsp_sel                 7
+       ahb                     8
+       ipg                     9
+       arm_per_div             10
+       ahb_per_div             11
+       ipg_per                 12
+       uart_sel                13
+       uart_div                14
+       esdhc_sel               15
+       esdhc1_div              16
+       esdhc2_div              17
+       esdhc3_div              18
+       spdif_sel               19
+       spdif_div_pre           20
+       spdif_div_post          21
+       ssi_sel                 22
+       ssi1_div_pre            23
+       ssi1_div_post           24
+       ssi2_div_pre            25
+       ssi2_div_post           26
+       usb_sel                 27
+       usb_div                 28
+       nfc_div                 29
+       asrc_gate               30
+       pata_gate               31
+       audmux_gate             32
+       can1_gate               33
+       can2_gate               34
+       cspi1_gate              35
+       cspi2_gate              36
+       ect_gate                37
+       edio_gate               38
+       emi_gate                39
+       epit1_gate              40
+       epit2_gate              41
+       esai_gate               42
+       esdhc1_gate             43
+       esdhc2_gate             44
+       esdhc3_gate             45
+       fec_gate                46
+       gpio1_gate              47
+       gpio2_gate              48
+       gpio3_gate              49
+       gpt_gate                50
+       i2c1_gate               51
+       i2c2_gate               52
+       i2c3_gate               53
+       iomuxc_gate             54
+       ipu_gate                55
+       kpp_gate                56
+       mlb_gate                57
+       mshc_gate               58
+       owire_gate              59
+       pwm_gate                60
+       rngc_gate               61
+       rtc_gate                62
+       rtic_gate               63
+       scc_gate                64
+       sdma_gate               65
+       spba_gate               66
+       spdif_gate              67
+       ssi1_gate               68
+       ssi2_gate               69
+       uart1_gate              70
+       uart2_gate              71
+       uart3_gate              72
+       usbotg_gate             73
+       wdog_gate               74
+       max_gate                75
+       admux_gate              76
+       csi_gate                77
+       csi_div                 78
+       csi_sel                 79
+       iim_gate                80
+       gpu2d_gate              81
+
+Examples:
+
+clks: ccm@53f80000 {
+       compatible = "fsl,imx35-ccm";
+       reg = <0x53f80000 0x4000>;
+       interrupts = <31>;
+       #clock-cells = <1>;
+};
+
+esdhc1: esdhc@53fb4000 {
+       compatible = "fsl,imx35-esdhc";
+       reg = <0x53fb4000 0x4000>;
+       interrupts = <7>;
+       clocks = <&clks 9>, <&clks 8>, <&clks 43>;
+       clock-names = "ipg", "ahb", "per";
+};
index 4c029a8739d3abae79c08ea1e100fc9b91efe642..cadc4d29ada6663716c5135f78adcc3df902ee8e 100644 (file)
@@ -7,197 +7,8 @@ Required properties:
 - #clock-cells: Should be <1>
 
 The clock consumer should specify the desired clock by having the clock
-ID in its "clocks" phandle cell.  The following is a full list of i.MX5
-clocks and IDs.
-
-       Clock                   ID
-       ---------------------------
-       dummy                   0
-       ckil                    1
-       osc                     2
-       ckih1                   3
-       ckih2                   4
-       ahb                     5
-       ipg                     6
-       axi_a                   7
-       axi_b                   8
-       uart_pred               9
-       uart_root               10
-       esdhc_a_pred            11
-       esdhc_b_pred            12
-       esdhc_c_s               13
-       esdhc_d_s               14
-       emi_sel                 15
-       emi_slow_podf           16
-       nfc_podf                17
-       ecspi_pred              18
-       ecspi_podf              19
-       usboh3_pred             20
-       usboh3_podf             21
-       usb_phy_pred            22
-       usb_phy_podf            23
-       cpu_podf                24
-       di_pred                 25
-       tve_s                   27
-       uart1_ipg_gate          28
-       uart1_per_gate          29
-       uart2_ipg_gate          30
-       uart2_per_gate          31
-       uart3_ipg_gate          32
-       uart3_per_gate          33
-       i2c1_gate               34
-       i2c2_gate               35
-       gpt_ipg_gate            36
-       pwm1_ipg_gate           37
-       pwm1_hf_gate            38
-       pwm2_ipg_gate           39
-       pwm2_hf_gate            40
-       gpt_hf_gate             41
-       fec_gate                42
-       usboh3_per_gate         43
-       esdhc1_ipg_gate         44
-       esdhc2_ipg_gate         45
-       esdhc3_ipg_gate         46
-       esdhc4_ipg_gate         47
-       ssi1_ipg_gate           48
-       ssi2_ipg_gate           49
-       ssi3_ipg_gate           50
-       ecspi1_ipg_gate         51
-       ecspi1_per_gate         52
-       ecspi2_ipg_gate         53
-       ecspi2_per_gate         54
-       cspi_ipg_gate           55
-       sdma_gate               56
-       emi_slow_gate           57
-       ipu_s                   58
-       ipu_gate                59
-       nfc_gate                60
-       ipu_di1_gate            61
-       vpu_s                   62
-       vpu_gate                63
-       vpu_reference_gate      64
-       uart4_ipg_gate          65
-       uart4_per_gate          66
-       uart5_ipg_gate          67
-       uart5_per_gate          68
-       tve_gate                69
-       tve_pred                70
-       esdhc1_per_gate         71
-       esdhc2_per_gate         72
-       esdhc3_per_gate         73
-       esdhc4_per_gate         74
-       usb_phy_gate            75
-       hsi2c_gate              76
-       mipi_hsc1_gate          77
-       mipi_hsc2_gate          78
-       mipi_esc_gate           79
-       mipi_hsp_gate           80
-       ldb_di1_div_3_5         81
-       ldb_di1_div             82
-       ldb_di0_div_3_5         83
-       ldb_di0_div             84
-       ldb_di1_gate            85
-       can2_serial_gate        86
-       can2_ipg_gate           87
-       i2c3_gate               88
-       lp_apm                  89
-       periph_apm              90
-       main_bus                91
-       ahb_max                 92
-       aips_tz1                93
-       aips_tz2                94
-       tmax1                   95
-       tmax2                   96
-       tmax3                   97
-       spba                    98
-       uart_sel                99
-       esdhc_a_sel             100
-       esdhc_b_sel             101
-       esdhc_a_podf            102
-       esdhc_b_podf            103
-       ecspi_sel               104
-       usboh3_sel              105
-       usb_phy_sel             106
-       iim_gate                107
-       usboh3_gate             108
-       emi_fast_gate           109
-       ipu_di0_gate            110
-       gpc_dvfs                111
-       pll1_sw                 112
-       pll2_sw                 113
-       pll3_sw                 114
-       ipu_di0_sel             115
-       ipu_di1_sel             116
-       tve_ext_sel             117
-       mx51_mipi               118
-       pll4_sw                 119
-       ldb_di1_sel             120
-       di_pll4_podf            121
-       ldb_di0_sel             122
-       ldb_di0_gate            123
-       usb_phy1_gate           124
-       usb_phy2_gate           125
-       per_lp_apm              126
-       per_pred1               127
-       per_pred2               128
-       per_podf                129
-       per_root                130
-       ssi_apm                 131
-       ssi1_root_sel           132
-       ssi2_root_sel           133
-       ssi3_root_sel           134
-       ssi_ext1_sel            135
-       ssi_ext2_sel            136
-       ssi_ext1_com_sel        137
-       ssi_ext2_com_sel        138
-       ssi1_root_pred          139
-       ssi1_root_podf          140
-       ssi2_root_pred          141
-       ssi2_root_podf          142
-       ssi_ext1_pred           143
-       ssi_ext1_podf           144
-       ssi_ext2_pred           145
-       ssi_ext2_podf           146
-       ssi1_root_gate          147
-       ssi2_root_gate          148
-       ssi3_root_gate          149
-       ssi_ext1_gate           150
-       ssi_ext2_gate           151
-       epit1_ipg_gate          152
-       epit1_hf_gate           153
-       epit2_ipg_gate          154
-       epit2_hf_gate           155
-       can_sel                 156
-       can1_serial_gate        157
-       can1_ipg_gate           158
-       owire_gate              159
-       gpu3d_s                 160
-       gpu2d_s                 161
-       gpu3d_gate              162
-       gpu2d_gate              163
-       garb_gate               164
-       cko1_sel                165
-       cko1_podf               166
-       cko1                    167
-       cko2_sel                168
-       cko2_podf               169
-       cko2                    170
-       srtc_gate               171
-       pata_gate               172
-       sata_gate               173
-       spdif_xtal_sel          174
-       spdif0_sel              175
-       spdif1_sel              176
-       spdif0_pred             177
-       spdif0_podf             178
-       spdif1_pred             179
-       spdif1_podf             180
-       spdif0_com_sel          181
-       spdif1_com_sel          182
-       spdif0_gate             183
-       spdif1_gate             184
-       spdif_ipg_gate          185
-       ocram                   186
+ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx5-clock.h
+for the full list of i.MX5 clock IDs.
 
 Examples (for mx53):
 
@@ -212,7 +23,7 @@ can1: can@53fc8000 {
        compatible = "fsl,imx53-flexcan", "fsl,p1010-flexcan";
        reg = <0x53fc8000 0x4000>;
        interrupts = <82>;
-       clocks = <&clks 158>, <&clks 157>;
+       clocks = <&clks IMX5_CLK_CAN1_IPG_GATE>, <&clks IMX5_CLK_CAN1_SERIAL_GATE>;
        clock-names = "ipg", "per";
        status = "disabled";
 };
index 12bd72605a31b10cfd44b9d46eeff65199cc7e15..225990f79b7c577f50594cec23e1abb889bc5502 100644 (file)
@@ -17,13 +17,14 @@ Required properties:
 - reg - pll control0 and pll multipler registers
 - reg-names : control and multiplier. The multiplier is applicable only for
                main pll clock
-- fixed-postdiv : fixed post divider value
+- fixed-postdiv : fixed post divider value. If absent, use clkod register bits
+               for postdiv
 
 Example:
        mainpllclk: mainpllclk@2310110 {
                #clock-cells = <0>;
                compatible = "ti,keystone,main-pll-clock";
-               clocks = <&refclkmain>;
+               clocks = <&refclksys>;
                reg = <0x02620350 4>, <0x02310110 4>;
                reg-names = "control", "multiplier";
                fixed-postdiv = <2>;
@@ -32,11 +33,10 @@ Example:
        papllclk: papllclk@2620358 {
                #clock-cells = <0>;
                compatible = "ti,keystone,pll-clock";
-               clocks = <&refclkmain>;
+               clocks = <&refclkpass>;
                clock-output-names = "pa-pll-clk";
                reg = <0x02620358 4>;
                reg-names = "control";
-               fixed-postdiv = <6>;
        };
 
 Required properties:
diff --git a/Documentation/devicetree/bindings/clock/maxim,max77686.txt b/Documentation/devicetree/bindings/clock/maxim,max77686.txt
new file mode 100644 (file)
index 0000000..96ce71b
--- /dev/null
@@ -0,0 +1,38 @@
+Binding for Maxim MAX77686 32k clock generator block
+
+This is a part of device tree bindings of MAX77686 multi-function device.
+More information can be found in bindings/mfd/max77686.txt file.
+
+The MAX77686 contains three 32.768khz clock outputs that can be controlled
+(gated/ungated) over I2C.
+
+Following properties should be presend in main device node of the MFD chip.
+
+Required properties:
+- #clock-cells: simple one-cell clock specifier format is used, where the
+  only cell is used as an index of the clock inside the provider. Following
+  indices are allowed:
+    - 0: 32khz_ap clock,
+    - 1: 32khz_cp clock,
+    - 2: 32khz_pmic clock.
+
+Example: Node of the MFD chip
+
+       max77686: max77686@09 {
+               compatible = "maxim,max77686";
+               interrupt-parent = <&wakeup_eint>;
+               interrupts = <26 0>;
+               reg = <0x09>;
+               #clock-cells = <1>;
+
+               /* ... */
+       };
+
+Example: Clock consumer node
+
+       foo@0 {
+               compatible = "bar,foo";
+               /* ... */
+               clock-names = "my-clock";
+               clocks = <&max77686 2>;
+       };
index 0c80c267710451918297675c1e47f2020e183cff..9acea9d931600e01fe37ec0b40a25bcf82a2e864 100644 (file)
@@ -15,6 +15,9 @@ Required properties :
   In clock consumers, this cell represents the clock ID exposed by the
   CAR. The assignments may be found in header file
   <dt-bindings/clock/tegra114-car.h>.
+- #reset-cells : Should be 1.
+  In clock consumers, this cell represents the bit number in the CAR's
+  array of CLK_RST_CONTROLLER_RST_DEVICES_* registers.
 
 Example SoC include file:
 
@@ -23,6 +26,7 @@ Example SoC include file:
                compatible = "nvidia,tegra114-car";
                reg = <0x60006000 0x1000>;
                #clock-cells = <1>;
+               #reset-cells = <1>;
        };
 
        usb@c5004000 {
diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra124-car.txt b/Documentation/devicetree/bindings/clock/nvidia,tegra124-car.txt
new file mode 100644 (file)
index 0000000..ded5d62
--- /dev/null
@@ -0,0 +1,63 @@
+NVIDIA Tegra124 Clock And Reset Controller
+
+This binding uses the common clock binding:
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+The CAR (Clock And Reset) Controller on Tegra is the HW module responsible
+for muxing and gating Tegra's clocks, and setting their rates.
+
+Required properties :
+- compatible : Should be "nvidia,tegra124-car"
+- reg : Should contain CAR registers location and length
+- clocks : Should contain phandle and clock specifiers for two clocks:
+  the 32 KHz "32k_in", and the board-specific oscillator "osc".
+- #clock-cells : Should be 1.
+  In clock consumers, this cell represents the clock ID exposed by the
+  CAR. The assignments may be found in header file
+  <dt-bindings/clock/tegra124-car.h>.
+- #reset-cells : Should be 1.
+  In clock consumers, this cell represents the bit number in the CAR's
+  array of CLK_RST_CONTROLLER_RST_DEVICES_* registers.
+
+Example SoC include file:
+
+/ {
+       tegra_car: clock {
+               compatible = "nvidia,tegra124-car";
+               reg = <0x60006000 0x1000>;
+               #clock-cells = <1>;
+               #reset-cells = <1>;
+       };
+
+       usb@c5004000 {
+               clocks = <&tegra_car TEGRA124_CLK_USB2>;
+       };
+};
+
+Example board file:
+
+/ {
+       clocks {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               osc: clock@0 {
+                       compatible = "fixed-clock";
+                       reg = <0>;
+                       #clock-cells = <0>;
+                       clock-frequency = <112400000>;
+               };
+
+               clk_32k: clock@1 {
+                       compatible = "fixed-clock";
+                       reg = <1>;
+                       #clock-cells = <0>;
+                       clock-frequency = <32768>;
+               };
+       };
+
+       &tegra_car {
+               clocks = <&clk_32k> <&osc>;
+       };
+};
index fcfed5bf73fb8ad6c862457165445577bd25694f..6c5901b503d019adfcd0f24bc8c99aed03fb50f0 100644 (file)
@@ -15,6 +15,9 @@ Required properties :
   In clock consumers, this cell represents the clock ID exposed by the
   CAR. The assignments may be found in header file
   <dt-bindings/clock/tegra20-car.h>.
+- #reset-cells : Should be 1.
+  In clock consumers, this cell represents the bit number in the CAR's
+  array of CLK_RST_CONTROLLER_RST_DEVICES_* registers.
 
 Example SoC include file:
 
@@ -23,6 +26,7 @@ Example SoC include file:
                compatible = "nvidia,tegra20-car";
                reg = <0x60006000 0x1000>;
                #clock-cells = <1>;
+               #reset-cells = <1>;
        };
 
        usb@c5004000 {
index 0f714081e986b5c722d29d42a3599bd2399369cc..63618cde12df16a7e842834799f6f058bd2ac7a6 100644 (file)
@@ -15,6 +15,9 @@ Required properties :
   In clock consumers, this cell represents the clock ID exposed by the
   CAR. The assignments may be found in header file
   <dt-bindings/clock/tegra30-car.h>.
+- #reset-cells : Should be 1.
+  In clock consumers, this cell represents the bit number in the CAR's
+  array of CLK_RST_CONTROLLER_RST_DEVICES_* registers.
 
 Example SoC include file:
 
@@ -23,6 +26,7 @@ Example SoC include file:
                compatible = "nvidia,tegra30-car";
                reg = <0x60006000 0x1000>;
                #clock-cells = <1>;
+               #reset-cells = <1>;
        };
 
        usb@c5004000 {
diff --git a/Documentation/devicetree/bindings/clock/qcom,gcc.txt b/Documentation/devicetree/bindings/clock/qcom,gcc.txt
new file mode 100644 (file)
index 0000000..767401f
--- /dev/null
@@ -0,0 +1,21 @@
+Qualcomm Global Clock & Reset Controller Binding
+------------------------------------------------
+
+Required properties :
+- compatible : shall contain only one of the following:
+
+                       "qcom,gcc-msm8660"
+                       "qcom,gcc-msm8960"
+                       "qcom,gcc-msm8974"
+
+- reg : shall contain base register location and length
+- #clock-cells : shall contain 1
+- #reset-cells : shall contain 1
+
+Example:
+       clock-controller@900000 {
+               compatible = "qcom,gcc-msm8960";
+               reg = <0x900000 0x4000>;
+               #clock-cells = <1>;
+               #reset-cells = <1>;
+       };
diff --git a/Documentation/devicetree/bindings/clock/qcom,mmcc.txt b/Documentation/devicetree/bindings/clock/qcom,mmcc.txt
new file mode 100644 (file)
index 0000000..d572e99
--- /dev/null
@@ -0,0 +1,21 @@
+Qualcomm Multimedia Clock & Reset Controller Binding
+----------------------------------------------------
+
+Required properties :
+- compatible : shall contain only one of the following:
+
+                       "qcom,mmcc-msm8660"
+                       "qcom,mmcc-msm8960"
+                       "qcom,mmcc-msm8974"
+
+- reg : shall contain base register location and length
+- #clock-cells : shall contain 1
+- #reset-cells : shall contain 1
+
+Example:
+       clock-controller@4000000 {
+               compatible = "qcom,mmcc-msm8960";
+               reg = <0x4000000 0x1000>;
+               #clock-cells = <1>;
+               #reset-cells = <1>;
+       };
diff --git a/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt
new file mode 100644 (file)
index 0000000..952e373
--- /dev/null
@@ -0,0 +1,28 @@
+* Renesas CPG DIV6 Clock
+
+The CPG DIV6 clocks are variable factor clocks provided by the Clock Pulse
+Generator (CPG). They clock input is divided by a configurable factor from 1
+to 64.
+
+Required Properties:
+
+  - compatible: Must be one of the following
+    - "renesas,r8a7790-div6-clock" for R8A7790 (R-Car H2) DIV6 clocks
+    - "renesas,r8a7791-div6-clock" for R8A7791 (R-Car M2) DIV6 clocks
+    - "renesas,cpg-div6-clock" for generic DIV6 clocks
+  - reg: Base address and length of the memory resource used by the DIV6 clock
+  - clocks: Reference to the parent clock
+  - #clock-cells: Must be 0
+  - clock-output-names: The name of the clock as a free-form string
+
+
+Example
+-------
+
+       sd2_clk: sd2_clk@e6150078 {
+               compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
+               reg = <0 0xe6150078 0 4>;
+               clocks = <&pll1_div2_clk>;
+               #clock-cells = <0>;
+               clock-output-names = "sd2";
+       };
diff --git a/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
new file mode 100644 (file)
index 0000000..a6a352c
--- /dev/null
@@ -0,0 +1,51 @@
+* Renesas CPG Module Stop (MSTP) Clocks
+
+The CPG can gate SoC device clocks. The gates are organized in groups of up to
+32 gates.
+
+This device tree binding describes a single 32 gate clocks group per node.
+Clocks are referenced by user nodes by the MSTP node phandle and the clock
+index in the group, from 0 to 31.
+
+Required Properties:
+
+  - compatible: Must be one of the following
+    - "renesas,r8a7790-mstp-clocks" for R8A7790 (R-Car H2) MSTP gate clocks
+    - "renesas,r8a7791-mstp-clocks" for R8A7791 (R-Car M2) MSTP gate clocks
+    - "renesas,cpg-mstp-clock" for generic MSTP gate clocks
+  - reg: Base address and length of the I/O mapped registers used by the MSTP
+    clocks. The first register is the clock control register and is mandatory.
+    The second register is the clock status register and is optional when not
+    implemented in hardware.
+  - clocks: Reference to the parent clocks, one per output clock. The parents
+    must appear in the same order as the output clocks.
+  - #clock-cells: Must be 1
+  - clock-output-names: The name of the clocks as free-form strings
+  - renesas,indices: Indices of the gate clocks into the group (0 to 31)
+
+The clocks, clock-output-names and renesas,indices properties contain one
+entry per gate clock. The MSTP groups are sparsely populated. Unimplemented
+gate clocks must not be declared.
+
+
+Example
+-------
+
+       #include <dt-bindings/clock/r8a7790-clock.h>
+
+       mstp3_clks: mstp3_clks@e615013c {
+               compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+               reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
+               clocks = <&cp_clk>, <&mmc1_clk>, <&sd3_clk>, <&sd2_clk>,
+                        <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>,
+                        <&mmc0_clk>;
+               #clock-cells = <1>;
+               clock-output-names =
+                       "tpu0", "mmcif1", "sdhi3", "sdhi2",
+                        "sdhi1", "sdhi0", "mmcif0";
+               renesas,clock-indices = <
+                       R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
+                       R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0
+                       R8A7790_CLK_MMCIF0
+               >;
+       };
diff --git a/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
new file mode 100644 (file)
index 0000000..7b41c2f
--- /dev/null
@@ -0,0 +1,32 @@
+* Renesas R-Car Gen2 Clock Pulse Generator (CPG)
+
+The CPG generates core clocks for the R-Car Gen2 SoCs. It includes three PLLs
+and several fixed ratio dividers.
+
+Required Properties:
+
+  - compatible: Must be one of
+    - "renesas,r8a7790-cpg-clocks" for the r8a7790 CPG
+    - "renesas,r8a7791-cpg-clocks" for the r8a7791 CPG
+    - "renesas,rcar-gen2-cpg-clocks" for the generic R-Car Gen2 CPG
+
+  - reg: Base address and length of the memory resource used by the CPG
+
+  - clocks: Reference to the parent clock
+  - #clock-cells: Must be 1
+  - clock-output-names: The names of the clocks. Supported clocks are "main",
+    "pll0", "pll1", "pll3", "lb", "qspi", "sdh", "sd0", "sd1" and "z"
+
+
+Example
+-------
+
+       cpg_clocks: cpg_clocks@e6150000 {
+               compatible = "renesas,r8a7790-cpg-clocks",
+                            "renesas,rcar-gen2-cpg-clocks";
+               reg = <0 0xe6150000 0 0x1000>;
+               clocks = <&extal_clk>;
+               #clock-cells = <1>;
+               clock-output-names = "main", "pll0, "pll1", "pll3",
+                                    "lb", "qspi", "sdh", "sd0", "sd1", "z";
+       };
diff --git a/Documentation/devicetree/bindings/clock/silabs,si570.txt b/Documentation/devicetree/bindings/clock/silabs,si570.txt
new file mode 100644 (file)
index 0000000..c09f21e
--- /dev/null
@@ -0,0 +1,39 @@
+Binding for Silicon Labs 570, 571, 598 and 599 programmable
+I2C clock generators.
+
+Reference
+This binding uses the common clock binding[1]. Details about the devices can be
+found in the data sheets[2][3].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+[2] Si570/571 Data Sheet
+    http://www.silabs.com/Support%20Documents/TechnicalDocs/si570.pdf
+[3] Si598/599 Data Sheet
+    http://www.silabs.com/Support%20Documents/TechnicalDocs/si598-99.pdf
+
+Required properties:
+ - compatible: Shall be one of "silabs,si570", "silabs,si571",
+                              "silabs,si598", "silabs,si599"
+ - reg: I2C device address.
+ - #clock-cells: From common clock bindings: Shall be 0.
+ - factory-fout: Factory set default frequency. This frequency is part specific.
+                The correct frequency for the part used has to be provided in
+                order to generate the correct output frequencies. For more
+                details, please refer to the data sheet.
+ - temperature-stability: Temperature stability of the device in PPM. Should be
+                         one of: 7, 20, 50 or 100.
+
+Optional properties:
+ - clock-output-names: From common clock bindings. Recommended to be "si570".
+ - clock-frequency: Output frequency to generate. This defines the output
+                   frequency set during boot. It can be reprogrammed during
+                   runtime through the common clock framework.
+
+Example:
+       si570: clock-generator@5d {
+               #clock-cells = <0>;
+               compatible = "silabs,si570";
+               temperature-stability = <50>;
+               reg = <0x5d>;
+               factory-fout = <156250000>;
+       };
index 91a748fed13d0c540084781ee8cd68491d4f5bfd..c2cb7621ad2dd194f8342ac353770694136558aa 100644 (file)
@@ -7,8 +7,10 @@ This binding uses the common clock binding[1].
 Required properties:
 - compatible : shall be one of the following:
        "allwinner,sun4i-osc-clk" - for a gatable oscillator
-       "allwinner,sun4i-pll1-clk" - for the main PLL clock
+       "allwinner,sun4i-pll1-clk" - for the main PLL clock and PLL4
        "allwinner,sun6i-a31-pll1-clk" - for the main PLL clock on A31
+       "allwinner,sun4i-pll5-clk" - for the PLL5 clock
+       "allwinner,sun4i-pll6-clk" - for the PLL6 clock
        "allwinner,sun4i-cpu-clk" - for the CPU multiplexer clock
        "allwinner,sun4i-axi-clk" - for the AXI clock
        "allwinner,sun4i-axi-gates-clk" - for the AXI gates
@@ -33,10 +35,14 @@ Required properties:
        "allwinner,sun7i-a20-apb1-gates-clk" - for the APB1 gates on A20
        "allwinner,sun6i-a31-apb2-div-clk" - for the APB2 gates on A31
        "allwinner,sun6i-a31-apb2-gates-clk" - for the APB2 gates on A31
+       "allwinner,sun4i-mod0-clk" - for the module 0 family of clocks
+       "allwinner,sun7i-a20-out-clk" - for the external output clocks
 
 Required properties for all clocks:
 - reg : shall be the control register address for the clock.
-- clocks : shall be the input parent clock(s) phandle for the clock
+- clocks : shall be the input parent clock(s) phandle for the clock. For
+       multiplexed clocks, the list order must match the hardware
+       programming order.
 - #clock-cells : from common clock binding; shall be set to 0 except for
        "allwinner,*-gates-clk" where it shall be set to 1
 
index d99af878f5d7db6f59d6160f251edec22d902ed8..17b4a94916d6d87c9d1fb9f42da49522594b5e2d 100644 (file)
@@ -22,6 +22,10 @@ Required properties:
 Optional properties:
  - clocks : as described in the clock bindings
  - clock-names : as described in the clock bindings
+ - fclk-enable : Bit mask to enable FCLKs statically at boot time.
+                Bit [0..3] correspond to FCLK0..FCLK3. The corresponding
+                FCLK will only be enabled if it is actually running at
+                boot time.
 
 Clock inputs:
 The following strings are optional parameters to the 'clock-names' property in
diff --git a/Documentation/devicetree/bindings/crypto/atmel-crypto.txt b/Documentation/devicetree/bindings/crypto/atmel-crypto.txt
new file mode 100644 (file)
index 0000000..f2aab3d
--- /dev/null
@@ -0,0 +1,68 @@
+* Atmel HW cryptographic accelerators
+
+These are the HW cryptographic accelerators found on some Atmel products.
+
+* Advanced Encryption Standard (AES)
+
+Required properties:
+- compatible : Should be "atmel,at91sam9g46-aes".
+- reg: Should contain AES registers location and length.
+- interrupts: Should contain the IRQ line for the AES.
+- dmas: List of two DMA specifiers as described in
+        atmel-dma.txt and dma.txt files.
+- dma-names: Contains one identifier string for each DMA specifier
+             in the dmas property.
+
+Example:
+aes@f8038000 {
+       compatible = "atmel,at91sam9g46-aes";
+       reg = <0xf8038000 0x100>;
+       interrupts = <43 4 0>;
+       dmas = <&dma1 2 18>,
+              <&dma1 2 19>;
+       dma-names = "tx", "rx";
+
+* Triple Data Encryption Standard (Triple DES)
+
+Required properties:
+- compatible : Should be "atmel,at91sam9g46-tdes".
+- reg: Should contain TDES registers location and length.
+- interrupts: Should contain the IRQ line for the TDES.
+
+Optional properties:
+- dmas: List of two DMA specifiers as described in
+        atmel-dma.txt and dma.txt files.
+- dma-names: Contains one identifier string for each DMA specifier
+             in the dmas property.
+
+Example:
+tdes@f803c000 {
+       compatible = "atmel,at91sam9g46-tdes";
+       reg = <0xf803c000 0x100>;
+       interrupts = <44 4 0>;
+       dmas = <&dma1 2 20>,
+              <&dma1 2 21>;
+       dma-names = "tx", "rx";
+};
+
+* Secure Hash Algorithm (SHA)
+
+Required properties:
+- compatible : Should be "atmel,at91sam9g46-sha".
+- reg: Should contain SHA registers location and length.
+- interrupts: Should contain the IRQ line for the SHA.
+
+Optional properties:
+- dmas: One DMA specifiers as described in
+        atmel-dma.txt and dma.txt files.
+- dma-names: Contains one identifier string for each DMA specifier
+             in the dmas property. Only one "tx" string needed.
+
+Example:
+sha@f8034000 {
+       compatible = "atmel,at91sam9g46-sha";
+       reg = <0xf8034000 0x100>;
+       interrupts = <42 4 0>;
+       dmas = <&dma1 2 17>;
+       dma-names = "tx";
+};
diff --git a/Documentation/devicetree/bindings/crypto/fsl-dcp.txt b/Documentation/devicetree/bindings/crypto/fsl-dcp.txt
new file mode 100644 (file)
index 0000000..6949e50
--- /dev/null
@@ -0,0 +1,17 @@
+Freescale DCP (Data Co-Processor) found on i.MX23/i.MX28 .
+
+Required properties:
+- compatible : Should be "fsl,<soc>-dcp"
+- reg : Should contain MXS DCP registers location and length
+- interrupts : Should contain MXS DCP interrupt numbers, VMI IRQ and DCP IRQ
+               must be supplied, optionally Secure IRQ can be present, but
+              is currently not implemented and not used.
+
+Example:
+
+dcp@80028000 {
+       compatible = "fsl,imx28-dcp", "fsl,imx23-dcp";
+       reg = <0x80028000 0x2000>;
+       interrupts = <52 53>;
+       status = "okay";
+};
index a8c21c256baa5afbcb4b1a43d150ca47a5c4e3ea..1f5729f106216ecb079af2c4912fd61e20098585 100644 (file)
@@ -50,6 +50,9 @@ Each dmas request consists of 4 cells:
         0x00000008: Use fixed channel:
                 Use automatic channel selection when unset
                 Use DMA request line number when set
+        0x00000010: Set channel as high priority:
+                Normal priority when unset
+                High priority when set
 
 Example:
 
index 90fa7da525b8dd7ede457b5e44a00338f805d099..c6908e7c42cca6936ec9798f5614af25298fb981 100644 (file)
@@ -5,6 +5,16 @@ Required properties:
 - reg: Should contain DMA registers location and length. This shuld include
   all of the per-channel registers.
 - interrupts: Should contain all of the per-channel DMA interrupts.
+- clocks: Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
+- resets : Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names : Must include the following entries:
+  - dma
+- #dma-cells : Must be <1>. This dictates the length of DMA specifiers in
+  client nodes' dmas properties. The specifier represents the DMA request
+  select value for the peripheral. For more details, consult the Tegra TRM's
+  documentation of the APB DMA channel control register REQ_SEL field.
 
 Examples:
 
@@ -27,4 +37,8 @@ apbdma: dma@6000a000 {
                       0 149 0x04
                       0 150 0x04
                       0 151 0x04 >;
+       clocks = <&tegra_car 34>;
+       resets = <&tegra_car 34>;
+       reset-names = "dma";
+       #dma-cells = <1>;
 };
diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt
new file mode 100644 (file)
index 0000000..a2e839d
--- /dev/null
@@ -0,0 +1,41 @@
+Davinci GPIO controller bindings
+
+Required Properties:
+- compatible: should be "ti,dm6441-gpio"
+
+- reg: Physical base address of the controller and the size of memory mapped
+       registers.
+
+- gpio-controller : Marks the device node as a gpio controller.
+
+- interrupt-parent: phandle of the parent interrupt controller.
+
+- interrupts: Array of GPIO interrupt number. Only banked or unbanked IRQs are
+             supported at a time.
+
+- ti,ngpio: The number of GPIO pins supported.
+
+- ti,davinci-gpio-unbanked: The number of GPIOs that have an individual interrupt
+                            line to processor.
+
+The GPIO controller also acts as an interrupt controller. It uses the default
+two cells specifier as described in Documentation/devicetree/bindings/
+interrupt-controller/interrupts.txt.
+
+Example:
+
+gpio: gpio@1e26000 {
+       compatible = "ti,dm6441-gpio";
+       gpio-controller;
+       reg = <0x226000 0x1000>;
+       interrupt-parent = <&intc>;
+       interrupts = <42 IRQ_TYPE_EDGE_BOTH 43 IRQ_TYPE_EDGE_BOTH
+               44 IRQ_TYPE_EDGE_BOTH 45 IRQ_TYPE_EDGE_BOTH
+               46 IRQ_TYPE_EDGE_BOTH 47 IRQ_TYPE_EDGE_BOTH
+               48 IRQ_TYPE_EDGE_BOTH 49 IRQ_TYPE_EDGE_BOTH
+               50 IRQ_TYPE_EDGE_BOTH>;
+       ti,ngpio = <144>;
+       ti,davinci-gpio-unbanked = <0>;
+       interrupt-controller;
+       #interrupt-cells = <2>;
+};
index b4fa934ae3a2a2fa0e68e85199d676a4b8a682ff..ab45c02aa658f666b78b1f4bedf4dc87255033db 100644 (file)
@@ -9,6 +9,12 @@ Required properties:
 - #size-cells: The number of cells used to represent the size of an address
   range in the host1x address space. Should be 1.
 - ranges: The mapping of the host1x address space to the CPU address space.
+- clocks: Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
+- resets: Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names: Must include the following entries:
+  - host1x
 
 The host1x top-level node defines a number of children, each representing one
 of the following host1x client modules:
@@ -19,6 +25,12 @@ of the following host1x client modules:
   - compatible: "nvidia,tegra<chip>-mpe"
   - reg: Physical base address and length of the controller's registers.
   - interrupts: The interrupt outputs from the controller.
+  - clocks: Must contain one entry, for the module clock.
+    See ../clocks/clock-bindings.txt for details.
+  - resets: Must contain an entry for each entry in reset-names.
+    See ../reset/reset.txt for details.
+  - reset-names: Must include the following entries:
+    - mpe
 
 - vi: video input
 
@@ -26,6 +38,12 @@ of the following host1x client modules:
   - compatible: "nvidia,tegra<chip>-vi"
   - reg: Physical base address and length of the controller's registers.
   - interrupts: The interrupt outputs from the controller.
+  - clocks: Must contain one entry, for the module clock.
+    See ../clocks/clock-bindings.txt for details.
+  - resets: Must contain an entry for each entry in reset-names.
+    See ../reset/reset.txt for details.
+  - reset-names: Must include the following entries:
+    - vi
 
 - epp: encoder pre-processor
 
@@ -33,6 +51,12 @@ of the following host1x client modules:
   - compatible: "nvidia,tegra<chip>-epp"
   - reg: Physical base address and length of the controller's registers.
   - interrupts: The interrupt outputs from the controller.
+  - clocks: Must contain one entry, for the module clock.
+    See ../clocks/clock-bindings.txt for details.
+  - resets: Must contain an entry for each entry in reset-names.
+    See ../reset/reset.txt for details.
+  - reset-names: Must include the following entries:
+    - epp
 
 - isp: image signal processor
 
@@ -40,6 +64,12 @@ of the following host1x client modules:
   - compatible: "nvidia,tegra<chip>-isp"
   - reg: Physical base address and length of the controller's registers.
   - interrupts: The interrupt outputs from the controller.
+  - clocks: Must contain one entry, for the module clock.
+    See ../clocks/clock-bindings.txt for details.
+  - resets: Must contain an entry for each entry in reset-names.
+    See ../reset/reset.txt for details.
+  - reset-names: Must include the following entries:
+    - isp
 
 - gr2d: 2D graphics engine
 
@@ -47,12 +77,30 @@ of the following host1x client modules:
   - compatible: "nvidia,tegra<chip>-gr2d"
   - reg: Physical base address and length of the controller's registers.
   - interrupts: The interrupt outputs from the controller.
+  - clocks: Must contain one entry, for the module clock.
+    See ../clocks/clock-bindings.txt for details.
+  - resets: Must contain an entry for each entry in reset-names.
+    See ../reset/reset.txt for details.
+  - reset-names: Must include the following entries:
+    - 2d
 
 - gr3d: 3D graphics engine
 
   Required properties:
   - compatible: "nvidia,tegra<chip>-gr3d"
   - reg: Physical base address and length of the controller's registers.
+  - clocks: Must contain an entry for each entry in clock-names.
+    See ../clocks/clock-bindings.txt for details.
+  - clock-names: Must include the following entries:
+    (This property may be omitted if the only clock in the list is "3d")
+    - 3d
+      This MUST be the first entry.
+    - 3d2 (Only required on SoCs with two 3D clocks)
+  - resets: Must contain an entry for each entry in reset-names.
+    See ../reset/reset.txt for details.
+  - reset-names: Must include the following entries:
+    - 3d
+    - 3d2 (Only required on SoCs with two 3D clocks)
 
 - dc: display controller
 
@@ -60,6 +108,16 @@ of the following host1x client modules:
   - compatible: "nvidia,tegra<chip>-dc"
   - reg: Physical base address and length of the controller's registers.
   - interrupts: The interrupt outputs from the controller.
+  - clocks: Must contain an entry for each entry in clock-names.
+    See ../clocks/clock-bindings.txt for details.
+  - clock-names: Must include the following entries:
+    - dc
+      This MUST be the first entry.
+    - parent
+  - resets: Must contain an entry for each entry in reset-names.
+    See ../reset/reset.txt for details.
+  - reset-names: Must include the following entries:
+    - dc
 
   Each display controller node has a child node, named "rgb", that represents
   the RGB output associated with the controller. It can take the following
@@ -76,6 +134,16 @@ of the following host1x client modules:
   - interrupts: The interrupt outputs from the controller.
   - vdd-supply: regulator for supply voltage
   - pll-supply: regulator for PLL
+  - clocks: Must contain an entry for each entry in clock-names.
+    See ../clocks/clock-bindings.txt for details.
+  - clock-names: Must include the following entries:
+    - hdmi
+      This MUST be the first entry.
+    - parent
+  - resets: Must contain an entry for each entry in reset-names.
+    See ../reset/reset.txt for details.
+  - reset-names: Must include the following entries:
+    - hdmi
 
   Optional properties:
   - nvidia,ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
@@ -88,12 +156,24 @@ of the following host1x client modules:
   - compatible: "nvidia,tegra<chip>-tvo"
   - reg: Physical base address and length of the controller's registers.
   - interrupts: The interrupt outputs from the controller.
+  - clocks: Must contain one entry, for the module clock.
+    See ../clocks/clock-bindings.txt for details.
 
 - dsi: display serial interface
 
   Required properties:
   - compatible: "nvidia,tegra<chip>-dsi"
   - reg: Physical base address and length of the controller's registers.
+  - clocks: Must contain an entry for each entry in clock-names.
+    See ../clocks/clock-bindings.txt for details.
+  - clock-names: Must include the following entries:
+    - dsi
+      This MUST be the first entry.
+    - parent
+  - resets: Must contain an entry for each entry in reset-names.
+    See ../reset/reset.txt for details.
+  - reset-names: Must include the following entries:
+    - dsi
 
 Example:
 
@@ -105,6 +185,9 @@ Example:
                reg = <0x50000000 0x00024000>;
                interrupts = <0 65 0x04   /* mpcore syncpt */
                              0 67 0x04>; /* mpcore general */
+               clocks = <&tegra_car TEGRA20_CLK_HOST1X>;
+               resets = <&tegra_car 28>;
+               reset-names = "host1x";
 
                #address-cells = <1>;
                #size-cells = <1>;
@@ -115,41 +198,64 @@ Example:
                        compatible = "nvidia,tegra20-mpe";
                        reg = <0x54040000 0x00040000>;
                        interrupts = <0 68 0x04>;
+                       clocks = <&tegra_car TEGRA20_CLK_MPE>;
+                       resets = <&tegra_car 60>;
+                       reset-names = "mpe";
                };
 
                vi {
                        compatible = "nvidia,tegra20-vi";
                        reg = <0x54080000 0x00040000>;
                        interrupts = <0 69 0x04>;
+                       clocks = <&tegra_car TEGRA20_CLK_VI>;
+                       resets = <&tegra_car 100>;
+                       reset-names = "vi";
                };
 
                epp {
                        compatible = "nvidia,tegra20-epp";
                        reg = <0x540c0000 0x00040000>;
                        interrupts = <0 70 0x04>;
+                       clocks = <&tegra_car TEGRA20_CLK_EPP>;
+                       resets = <&tegra_car 19>;
+                       reset-names = "epp";
                };
 
                isp {
                        compatible = "nvidia,tegra20-isp";
                        reg = <0x54100000 0x00040000>;
                        interrupts = <0 71 0x04>;
+                       clocks = <&tegra_car TEGRA20_CLK_ISP>;
+                       resets = <&tegra_car 23>;
+                       reset-names = "isp";
                };
 
                gr2d {
                        compatible = "nvidia,tegra20-gr2d";
                        reg = <0x54140000 0x00040000>;
                        interrupts = <0 72 0x04>;
+                       clocks = <&tegra_car TEGRA20_CLK_GR2D>;
+                       resets = <&tegra_car 21>;
+                       reset-names = "2d";
                };
 
                gr3d {
                        compatible = "nvidia,tegra20-gr3d";
                        reg = <0x54180000 0x00040000>;
+                       clocks = <&tegra_car TEGRA20_CLK_GR3D>;
+                       resets = <&tegra_car 24>;
+                       reset-names = "3d";
                };
 
                dc@54200000 {
                        compatible = "nvidia,tegra20-dc";
                        reg = <0x54200000 0x00040000>;
                        interrupts = <0 73 0x04>;
+                       clocks = <&tegra_car TEGRA20_CLK_DISP1>,
+                                <&tegra_car TEGRA20_CLK_PLL_P>;
+                       clock-names = "disp1", "parent";
+                       resets = <&tegra_car 27>;
+                       reset-names = "dc";
 
                        rgb {
                                status = "disabled";
@@ -160,6 +266,11 @@ Example:
                        compatible = "nvidia,tegra20-dc";
                        reg = <0x54240000 0x00040000>;
                        interrupts = <0 74 0x04>;
+                       clocks = <&tegra_car TEGRA20_CLK_DISP2>,
+                                <&tegra_car TEGRA20_CLK_PLL_P>;
+                       clock-names = "disp2", "parent";
+                       resets = <&tegra_car 26>;
+                       reset-names = "dc";
 
                        rgb {
                                status = "disabled";
@@ -170,6 +281,11 @@ Example:
                        compatible = "nvidia,tegra20-hdmi";
                        reg = <0x54280000 0x00040000>;
                        interrupts = <0 75 0x04>;
+                       clocks = <&tegra_car TEGRA20_CLK_HDMI>,
+                                <&tegra_car TEGRA20_CLK_PLL_D_OUT0>;
+                       clock-names = "hdmi", "parent";
+                       resets = <&tegra_car 51>;
+                       reset-names = "hdmi";
                        status = "disabled";
                };
 
@@ -177,12 +293,18 @@ Example:
                        compatible = "nvidia,tegra20-tvo";
                        reg = <0x542c0000 0x00040000>;
                        interrupts = <0 76 0x04>;
+                       clocks = <&tegra_car TEGRA20_CLK_TVO>;
                        status = "disabled";
                };
 
                dsi {
                        compatible = "nvidia,tegra20-dsi";
                        reg = <0x54300000 0x00040000>;
+                       clocks = <&tegra_car TEGRA20_CLK_DSI>,
+                                <&tegra_car TEGRA20_CLK_PLL_D_OUT0>;
+                       clock-names = "dsi", "parent";
+                       resets = <&tegra_car 48>;
+                       reset-names = "dsi";
                        status = "disabled";
                };
        };
index 82e8f6f17179b9b951e3d14f17d5a8b1671990ec..582b4652a82a98e32c124e012a111e9476fd747c 100644 (file)
@@ -5,7 +5,11 @@ Required properties :
 
  - reg             : Offset and length of the register set for the device
  - compatible      : Should be "marvell,mv64xxx-i2c" or "allwinner,sun4i-i2c"
-                     or "marvell,mv78230-i2c"
+                     or "marvell,mv78230-i2c" or "marvell,mv78230-a0-i2c"
+                     Note: Only use "marvell,mv78230-a0-i2c" for a very rare,
+                     initial version of the SoC which had broken offload
+                     support.  Linux auto-detects this and sets it
+                     appropriately.
  - interrupts      : The interrupt number
 
 Optional properties :
index ef77cc7a0e466d4a40a481625cb13e00d6f76754..87507e9ce6db50ee4eac7089291afa115806084c 100644 (file)
@@ -39,12 +39,23 @@ Required properties:
 - interrupts: Should contain I2C controller interrupts.
 - address-cells: Address cells for I2C device address.
 - size-cells: Size of the I2C device address.
-- clocks: Clock ID as per
-               Documentation/devicetree/bindings/clock/tegra<chip-id>.txt
-       for I2C controller.
-- clock-names: Name of the clock:
-       Tegra20/Tegra30 I2C controller: "div-clk and "fast-clk".
-       Tegra114 I2C controller: "div-clk".
+- clocks: Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
+- clock-names: Must include the following entries:
+  Tegra20/Tegra30:
+  - div-clk
+  - fast-clk
+  Tegra114:
+  - div-clk
+- resets: Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names: Must include the following entries:
+  - i2c
+- dmas: Must contain an entry for each entry in clock-names.
+  See ../dma/dma.txt for details.
+- dma-names: Must include the following entries:
+  - rx
+  - tx
 
 Example:
 
@@ -56,5 +67,9 @@ Example:
                #size-cells = <0>;
                clocks = <&tegra_car 12>, <&tegra_car 124>;
                clock-names = "div-clk", "fast-clk";
+               resets = <&tegra_car 12>;
+               reset-names = "i2c";
+               dmas = <&apbdma 16>, <&apbdma 16>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
index c65f71cfaa5c598d4089924d7cb3445cdd79283a..1a1ac2e560e94a083c5df71fa9bad004e12df7ab 100644 (file)
@@ -40,6 +40,7 @@ fsl,sgtl5000          SGTL5000: Ultra Low-Power Audio Codec
 gmt,g751               G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface
 infineon,slb9635tt     Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz)
 infineon,slb9645tt     Infineon SLB9645 I2C TPM (new protocol, max 400khz)
+isl,isl12057           Intersil ISL12057 I2C RTC Chip
 maxim,ds1050           5 Bit Programmable, Pulse-Width Modulator
 maxim,max1237          Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
 maxim,max6625          9-Bit/12-Bit Temperature Sensors with I²C-Compatible Serial Interface
index 2995fae7ee474ce81b1a4fdeca3e195d77154ded..0382b8bd69c63b2e821f3a976028384254c81437 100644 (file)
@@ -13,6 +13,12 @@ Required properties:
   array of pin numbers which is used as column.
 - linux,keymap: The keymap for keys as described in the binding document
   devicetree/bindings/input/matrix-keymap.txt.
+- clocks: Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
+- resets: Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names: Must include the following entries:
+  - kbc
 
 Optional properties, in addition to those specified by the shared
 matrix-keyboard bindings:
@@ -31,6 +37,9 @@ keyboard: keyboard {
        compatible = "nvidia,tegra20-kbc";
        reg = <0x7000e200 0x100>;
        interrupts = <0 85 0x04>;
+       clocks = <&tegra_car 36>;
+       resets = <&tegra_car 36>;
+       reset-names = "kbc";
        nvidia,ghost-filter;
        nvidia,debounce-delay-ms = <640>;
        nvidia,kbc-row-pins = <0 1 2>;    /* pin 0, 1, 2 as rows */
index 3d3b2b91e3330665d365ccae672c844379832711..32cec4b26cd08f69e5380c05234b4c0fb50bc9e4 100644 (file)
@@ -14,5 +14,5 @@ intc: interrupt-controller {
        compatible = "allwinner,sun4i-ic";
        reg = <0x01c20400 0x400>;
        interrupt-controller;
-       #interrupt-cells = <2>;
+       #interrupt-cells = <1>;
 };
diff --git a/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
new file mode 100644 (file)
index 0000000..4929117
--- /dev/null
@@ -0,0 +1,32 @@
+Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
+
+Synopsys DesignWare provides interrupt controller IP for APB known as
+dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
+APB bus, e.g. Marvell Armada 1500.
+
+Required properties:
+- compatible: shall be "snps,dw-apb-ictl"
+- reg: physical base address of the controller and length of memory mapped
+  region starting with ENABLE_LOW register
+- interrupt-controller: identifies the node as an interrupt controller
+- #interrupt-cells: number of cells to encode an interrupt-specifier, shall be 1
+- interrupts: interrupt reference to primary interrupt controller
+- interrupt-parent: (optional) reference specific primary interrupt controller
+
+The interrupt sources map to the corresponding bits in the interrupt
+registers, i.e.
+- 0 maps to bit 0 of low interrupts,
+- 1 maps to bit 1 of low interrupts,
+- 32 maps to bit 0 of high interrupts,
+- 33 maps to bit 1 of high interrupts,
+- (optional) fast interrupts start at 64.
+
+Example:
+       aic: interrupt-controller@3000 {
+               compatible = "snps,dw-apb-ictl";
+               reg = <0x3000 0xc00>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               interrupt-parent = <&gic>;
+               interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+       };
index c6a3469d3436d6fee990f2b016e6766994456fcf..678f3cf0b8f005759c8bdba2c3ebb34438a2ba76 100644 (file)
@@ -7,6 +7,9 @@ different i2c slave address,presently for which we are statically creating i2c
 client while probing.This document describes the binding for mfd device and
 PMIC submodule.
 
+Binding for the built-in 32k clock generator block is defined separately
+in bindings/clk/maxim,max77686.txt file.
+
 Required properties:
 - compatible : Must be "maxim,max77686";
 - reg : Specifies the i2c slave address of PMIC block.
index c67b975c89063f51fa20ae563f601c7c6113fe08..532b1d440abc15d1f1d1e61791b274a6ec8dafe0 100644 (file)
@@ -16,6 +16,8 @@ Required Properties:
          specific extensions.
        - "samsung,exynos5250-dw-mshc": for controllers with Samsung Exynos5250
          specific extensions.
+       - "samsung,exynos5420-dw-mshc": for controllers with Samsung Exynos5420
+         specific extensions.
 
 * samsung,dw-mshc-ciu-div: Specifies the divider value for the card interface
   unit (ciu) clock. This property is applicable only for Exynos5 SoC's and
index c6d7b11db9eb00ed81ad3fcff3ddb78c9dbdc072..f357c16ea815c5fc6c3b2d7a8a4c41a9683f60bc 100644 (file)
@@ -8,6 +8,12 @@ by mmc.txt and the properties used by the sdhci-tegra driver.
 
 Required properties:
 - compatible : Should be "nvidia,<chip>-sdhci"
+- clocks : Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
+- resets : Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names : Must include the following entries:
+  - sdhci
 
 Optional properties:
 - power-gpios : Specify GPIOs for power control
@@ -18,6 +24,9 @@ sdhci@c8000200 {
        compatible = "nvidia,tegra20-sdhci";
        reg = <0xc8000200 0x200>;
        interrupts = <47>;
+       clocks = <&tegra_car 14>;
+       resets = <&tegra_car 14>;
+       reset-names = "sdhci";
        cd-gpios = <&gpio 69 0>; /* gpio PI5 */
        wp-gpios = <&gpio 57 0>; /* gpio PH1 */
        power-gpios = <&gpio 155 0>; /* gpio PT3 */
index 5aeee53ff9f4afcb78fba8516d50e4f97edbccbf..5ae601e7f51f313a5c0a0f4dbc0095151841a519 100644 (file)
@@ -7,3 +7,15 @@ Required properties:
 - clock-frequency : the frequency of the i2c bus
 - gpios : the gpio used for ec request
 - slave-addr: the i2c address of the slave controller
+- clocks : Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
+- clock-names : Must include the following entries:
+  Tegra20/Tegra30:
+  - div-clk
+  - fast-clk
+  Tegra114:
+  - div-clk
+- resets : Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names : Must include the following entries:
+  - i2c
index 6b7510775c50da125ff55c491613afaa0f216e16..24cee06915c989cfd6866ad5f3d86e3605cd0ae3 100644 (file)
@@ -42,14 +42,19 @@ Required properties:
     - 0xc2000000: prefetchable memory region
   Please refer to the standard PCI bus binding document for a more detailed
   explanation.
-- clocks: List of clock inputs of the controller. Must contain an entry for
-  each entry in the clock-names property.
+- clocks: Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
 - clock-names: Must include the following entries:
-  "pex": The Tegra clock of that name
-  "afi": The Tegra clock of that name
-  "pcie_xclk": The Tegra clock of that name
-  "pll_e": The Tegra clock of that name
-  "cml": The Tegra clock of that name (not required for Tegra20)
+  - pex
+  - afi
+  - pll_e
+  - cml (not required for Tegra20)
+- resets: Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names: Must include the following entries:
+  - pex
+  - afi
+  - pcie_x
 
 Root ports are defined as subnodes of the PCIe controller node.
 
@@ -91,9 +96,10 @@ SoC DTSI:
                          0x82000000 0 0xa0000000 0xa0000000 0 0x10000000   /* non-prefetchable memory */
                          0xc2000000 0 0xb0000000 0xb0000000 0 0x10000000>; /* prefetchable memory */
 
-               clocks = <&tegra_car 70>, <&tegra_car 72>, <&tegra_car 74>,
-                        <&tegra_car 118>;
-               clock-names = "pex", "afi", "pcie_xclk", "pll_e";
+               clocks = <&tegra_car 70>, <&tegra_car 72>, <&tegra_car 118>;
+               clock-names = "pex", "afi", "pll_e";
+               resets = <&tegra_car 70>, <&tegra_car 72>, <&tegra_car 74>;
+               reset-names = "pex", "afi", "pcie_x";
                status = "disabled";
 
                pci@1,0 {
index c3fc57af877260e5f25ca1290e1ca333895d9bdd..c7ea9d4a988b8d78971a96cf585a011ae7274711 100644 (file)
@@ -7,6 +7,12 @@ Required properties:
 - reg: physical base address and length of the controller's registers
 - #pwm-cells: should be 2. See pwm.txt in this directory for a description of
   the cells format.
+- clocks: Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
+- resets: Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names: Must include the following entries:
+  - pwm
 
 Example:
 
@@ -14,4 +20,7 @@ Example:
                compatible = "nvidia,tegra20-pwm";
                reg = <0x7000a000 0x100>;
                #pwm-cells = <2>;
+               clocks = <&tegra_car 17>;
+               resets = <&tegra_car 17>;
+               reset-names = "pwm";
        };
index 93f45e9dce7cf07899d65c525181684d0bfd30c5..652d1ff2e8beb6f9ca33d145be74f2e12fb0eacf 100644 (file)
@@ -9,6 +9,8 @@ Required properties:
 - compatible : should be "nvidia,tegra20-rtc".
 - reg : Specifies base physical address and size of the registers.
 - interrupts : A single interrupt specifier.
+- clocks : Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
 
 Example:
 
@@ -16,4 +18,5 @@ timer {
        compatible = "nvidia,tegra20-rtc";
        reg = <0x7000e000 0x100>;
        interrupts = <0 2 0x04>;
+       clocks = <&tegra_car 4>;
 };
diff --git a/Documentation/devicetree/bindings/rtc/sunxi-rtc.txt b/Documentation/devicetree/bindings/rtc/sunxi-rtc.txt
new file mode 100644 (file)
index 0000000..7cb9dbf
--- /dev/null
@@ -0,0 +1,17 @@
+* sun4i/sun7i Real Time Clock
+
+RTC controller for the Allwinner A10/A20
+
+Required properties:
+- compatible : Should be "allwinner,sun4i-rtc" or "allwinner,sun7i-a20-rtc"
+- reg: physical base address of the controller and length of memory mapped
+  region.
+- interrupts: IRQ line for the RTC.
+
+Example:
+
+rtc: rtc@01c20d00 {
+       compatible = "allwinner,sun4i-rtc";
+       reg = <0x01c20d00 0x20>;
+       interrupts = <24>;
+};
index 392a4493eebd59354161b5c6fc6ee5f7a44d59fa..845850caf088100fb325d5353a6c4a1e1073e730 100644 (file)
@@ -4,8 +4,17 @@ Required properties:
 - compatible : should be "nvidia,tegra30-hsuart", "nvidia,tegra20-hsuart".
 - reg: Should contain UART controller registers location and length.
 - interrupts: Should contain UART controller interrupts.
-- nvidia,dma-request-selector : The Tegra DMA controller's phandle and
-  request selector for this UART controller.
+- clocks: Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
+- resets : Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names : Must include the following entries:
+  - serial
+- dmas : Must contain an entry for each entry in clock-names.
+  See ../dma/dma.txt for details.
+- dma-names : Must include the following entries:
+  - rx
+  - tx
 
 Optional properties:
 - nvidia,enable-modem-interrupt: Enable modem interrupts. Should be enable
@@ -18,7 +27,11 @@ serial@70006000 {
        reg = <0x70006000 0x40>;
        reg-shift = <2>;
        interrupts = <0 36 0x04>;
-       nvidia,dma-request-selector = <&apbdma 8>;
        nvidia,enable-modem-interrupt;
+       clocks = <&tegra_car 6>;
+       resets = <&tegra_car 6>;
+       reset-names = "serial";
+       dmas = <&apbdma 8>, <&apbdma 8>;
+       dma-names = "rx", "tx";
        status = "disabled";
 };
diff --git a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
new file mode 100644 (file)
index 0000000..f372cf2
--- /dev/null
@@ -0,0 +1,46 @@
+* Renesas SH-Mobile Serial Communication Interface
+
+Required properties:
+
+  - compatible: Must contain one of the following:
+
+    - "renesas,scif-r8a7790" for R8A7790 (R-Car H2) SCIF compatible UART.
+    - "renesas,scifa-r8a7790" for R8A7790 (R-Car H2) SCIFA compatible UART.
+    - "renesas,scifb-r8a7790" for R8A7790 (R-Car H2) SCIFB compatible UART.
+    - "renesas,hscif-r8a7790" for R8A7790 (R-Car H2) HSCIF compatible UART.
+    - "renesas,scif-r8a7791" for R8A7791 (R-Car M2) SCIF compatible UART.
+    - "renesas,scifa-r8a7791" for R8A7791 (R-Car M2) SCIFA compatible UART.
+    - "renesas,scifb-r8a7791" for R8A7791 (R-Car M2) SCIFB compatible UART.
+    - "renesas,hscif-r8a7791" for R8A7791 (R-Car M2) HSCIF compatible UART.
+    - "renesas,scif" for generic SCIF compatible UART.
+    - "renesas,scifa" for generic SCIFA compatible UART.
+    - "renesas,scifb" for generic SCIFB compatible UART.
+    - "renesas,hscif" for generic HSCIF compatible UART.
+
+    When compatible with the generic version, nodes must list the
+    SoC-specific version corresponding to the platform first followed by the
+    generic version.
+
+  - reg: Base address and length of the I/O registers used by the UART.
+  - interrupts: Must contain an interrupt-specifier for the SCIx interrupt.
+
+  - clocks: Must contain a phandle and clock-specifier pair for each entry
+    in clock-names.
+  - clock-names: Must contain "sci_ick" for the SCIx UART interface clock.
+
+Note: Each enabled SCIx UART should have an alias correctly numbered in the
+"aliases" node.
+
+Example:
+       aliases {
+               serial0 = &scifa0;
+       };
+
+       scifa0: serial@e6c40000 {
+               compatible = "renesas,scifa-r8a7790", "renesas,scifa-generic";
+               reg = <0 0xe6c40000 0 64>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp2_clks R8A7790_CLK_SCIFA0>;
+               clock-names = "sci_ick";
+       };
index 8b8903ef0800069afdad90f10e5964f3bd2e20c9..57f40f93453ecabbf89763ef66a2f709ca29af7b 100644 (file)
@@ -3,10 +3,11 @@ NVIDIA Tegra audio complex
 Required properties:
 - compatible : "nvidia,tegra-audio-alc5632"
 - clocks : Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
 - clock-names : Must include the following entries:
-  "pll_a" (The Tegra clock of that name),
-  "pll_a_out0" (The Tegra clock of that name),
-  "mclk" (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
+  - pll_a
+  - pll_a_out0
+  - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
 - nvidia,model : The user-visible name of this sound complex.
 - nvidia,audio-routing : A list of the connections between audio components.
   Each entry is a pair of strings, the first being the connection's sink,
index dc6224994d69d97f31614a308d71ba6cf2c9784c..7788808dcd0bb20d5183bdce92d2591f9ac90bdb 100644 (file)
@@ -3,10 +3,11 @@ NVIDIA Tegra audio complex, with RT5640 CODEC
 Required properties:
 - compatible : "nvidia,tegra-audio-rt5640"
 - clocks : Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
 - clock-names : Must include the following entries:
-  "pll_a" (The Tegra clock of that name),
-  "pll_a_out0" (The Tegra clock of that name),
-  "mclk" (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
+  - pll_a
+  - pll_a_out0
+  - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
 - nvidia,model : The user-visible name of this sound complex.
 - nvidia,audio-routing : A list of the connections between audio components.
   Each entry is a pair of strings, the first being the connection's sink,
index aab6ce0ad2fc5930054a1f97c73ea5781aa57e10..96f6a57dd6b40669b5addf6fbd9319b81c501fae 100644 (file)
@@ -3,10 +3,11 @@ NVIDIA Tegra audio complex
 Required properties:
 - compatible : "nvidia,tegra-audio-wm8753"
 - clocks : Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
 - clock-names : Must include the following entries:
-  "pll_a" (The Tegra clock of that name),
-  "pll_a_out0" (The Tegra clock of that name),
-  "mclk" (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
+  - pll_a
+  - pll_a_out0
+  - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
 - nvidia,model : The user-visible name of this sound complex.
 - nvidia,audio-routing : A list of the connections between audio components.
   Each entry is a pair of strings, the first being the connection's sink,
index 4b44dfb6ca0dcb08e5ad4468df6aeee853d3d56e..b795d282818d8acd34b9c57fdc53cb5e721d009a 100644 (file)
@@ -3,10 +3,11 @@ NVIDIA Tegra audio complex
 Required properties:
 - compatible : "nvidia,tegra-audio-wm8903"
 - clocks : Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
 - clock-names : Must include the following entries:
-  "pll_a" (The Tegra clock of that name),
-  "pll_a_out0" (The Tegra clock of that name),
-  "mclk" (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
+  - pll_a
+  - pll_a_out0
+  - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
 - nvidia,model : The user-visible name of this sound complex.
 - nvidia,audio-routing : A list of the connections between audio components.
   Each entry is a pair of strings, the first being the connection's sink,
index ad589b16363988460afb2f697535a0c8dfaa47e4..436f6cd9d07cdfc6cdc4dc93416329e3db7ecdad 100644 (file)
@@ -3,10 +3,11 @@ NVIDIA Tegra audio complex
 Required properties:
 - compatible : "nvidia,tegra-audio-wm9712"
 - clocks : Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
 - clock-names : Must include the following entries:
-  "pll_a" (The Tegra clock of that name),
-  "pll_a_out0" (The Tegra clock of that name),
-  "mclk" (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
+  - pll_a
+  - pll_a_out0
+  - mclk (The Tegra cdev1/extern1 clock, which feeds the CODEC's mclk)
 - nvidia,model : The user-visible name of this sound complex.
 - nvidia,audio-routing : A list of the connections between audio components.
   Each entry is a pair of strings, the first being the connection's sink,
index c1454979c1ef71b8a5b506154418f5d1f9c24357..eaf00102d92c295765ddd895f9a937511a9cc80b 100644 (file)
@@ -4,19 +4,33 @@ Required properties:
 - compatible : "nvidia,tegra20-ac97"
 - reg : Should contain AC97 controller registers location and length
 - interrupts : Should contain AC97 interrupt
-- nvidia,dma-request-selector : The Tegra DMA controller's phandle and
-  request selector for the AC97 controller
+- resets : Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names : Must include the following entries:
+  - ac97
+- dmas : Must contain an entry for each entry in clock-names.
+  See ../dma/dma.txt for details.
+- dma-names : Must include the following entries:
+  - rx
+  - tx
+- clocks : Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
 - nvidia,codec-reset-gpio : The Tegra GPIO controller's phandle and the number
   of the GPIO used to reset the external AC97 codec
 - nvidia,codec-sync-gpio : The Tegra GPIO controller's phandle and the number
   of the GPIO corresponding with the AC97 DAP _FS line
+
 Example:
 
 ac97@70002000 {
        compatible = "nvidia,tegra20-ac97";
        reg = <0x70002000 0x200>;
        interrupts = <0 81 0x04>;
-       nvidia,dma-request-selector = <&apbdma 12>;
        nvidia,codec-reset-gpio = <&gpio 170 0>;
        nvidia,codec-sync-gpio = <&gpio 120 0>;
+       clocks = <&tegra_car 3>;
+       resets = <&tegra_car 3>;
+       reset-names = "ac97";
+       dmas = <&apbdma 12>, <&apbdma 12>;
+       dma-names = "rx", "tx";
 };
index 0df2b5c816e3fd31beb853e51a922a1a0f65ad49..dc30c6bfbe95fc60a2642695fcacc7125221cc75 100644 (file)
@@ -4,8 +4,17 @@ Required properties:
 - compatible : "nvidia,tegra20-i2s"
 - reg : Should contain I2S registers location and length
 - interrupts : Should contain I2S interrupt
-- nvidia,dma-request-selector : The Tegra DMA controller's phandle and
-  request selector for this I2S controller
+- resets : Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names : Must include the following entries:
+  - i2s
+- dmas : Must contain an entry for each entry in clock-names.
+  See ../dma/dma.txt for details.
+- dma-names : Must include the following entries:
+  - rx
+  - tx
+- clocks : Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
 
 Example:
 
@@ -13,5 +22,9 @@ i2s@70002800 {
        compatible = "nvidia,tegra20-i2s";
        reg = <0x70002800 0x200>;
        interrupts = < 45 >;
-       nvidia,dma-request-selector = < &apbdma 2 >;
+       clocks = <&tegra_car 11>;
+       resets = <&tegra_car 11>;
+       reset-names = "i2s";
+       dmas = <&apbdma 21>, <&apbdma 21>;
+       dma-names = "rx", "tx";
 };
index 0e5c12c665230d5f5d1df14bb4d3faed5621b4c4..946e2ac46091c05dfd9266febfb8362ad646e0cc 100644 (file)
@@ -7,18 +7,48 @@ Required properties:
   - Tegra30 requires 2 entries, for the APBIF and AHUB/AUDIO register blocks.
   - Tegra114 requires an additional entry, for the APBIF2 register block.
 - interrupts : Should contain AHUB interrupt
-- nvidia,dma-request-selector : A list of the DMA channel specifiers. Each
-  entry contains the Tegra DMA controller's phandle and request selector.
-  If a single entry is present, the request selectors for the channels are
-  assumed to be contiguous, and increment from this value.
-  If multiple values are given, one value must be given per channel.
-- clocks : Must contain an entry for each required entry in clock-names.
+- clocks : Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
 - clock-names : Must include the following entries:
-  - Tegra30: Requires d_audio, apbif, i2s0, i2s1, i2s2, i2s3, i2s4, dam0,
-    dam1, dam2, spdif_in.
-  - Tegra114: Additionally requires amx, adx.
+  - d_audio
+  - apbif
+- resets : Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names : Must include the following entries:
+  Tegra30 and later:
+  - d_audio
+  - apbif
+  - i2s0
+  - i2s1
+  - i2s2
+  - i2s3
+  - i2s4
+  - dam0
+  - dam1
+  - dam2
+  - spdif
+  Tegra114 and later additionally require:
+  - amx
+  - adx
+  Tegra124 and later additionally require:
+  - amx1
+  - adx1
+  - afc0
+  - afc1
+  - afc2
+  - afc3
+  - afc4
+  - afc5
 - ranges : The bus address mapping for the configlink register bus.
   Can be empty since the mapping is 1:1.
+- dmas : Must contain an entry for each entry in clock-names.
+  See ../dma/dma.txt for details.
+- dma-names : Must include the following entries:
+  - rx0 .. rx<n>
+  - tx0 .. tx<n>
+  ... where n is:
+  Tegra30: 3
+  Tegra114, Tegra124: 9
 - #address-cells : For the configlink bus. Should be <1>;
 - #size-cells : For the configlink bus. Should be <1>.
 
@@ -35,13 +65,20 @@ ahub@70080000 {
        reg = <0x70080000 0x200 0x70080200 0x100>;
        interrupts = < 0 103 0x04 >;
        nvidia,dma-request-selector = <&apbdma 1>;
-       clocks = <&tegra_car 106>, <&tegra_car 107>, <&tegra_car 30>,
+       clocks = <&tegra_car 106>, <&tegra_car 107>;
+       clock-names = "d_audio", "apbif";
+       resets = <&tegra_car 106>, <&tegra_car 107>, <&tegra_car 30>,
                <&tegra_car 11>, <&tegra_car 18>, <&tegra_car 101>,
                <&tegra_car 102>, <&tegra_car 108>, <&tegra_car 109>,
-               <&tegra_car 110>, <&tegra_car 162>;
-       clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
+               <&tegra_car 110>, <&tegra_car 10>;
+       reset-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
                "i2s3", "i2s4", "dam0", "dam1", "dam2",
-               "spdif_in";
+               "spdif";
+       dmas = <&apbdma 1>, <&apbdma 1>;
+              <&apbdma 2>, <&apbdma 2>;
+              <&apbdma 3>, <&apbdma 3>;
+              <&apbdma 4>, <&apbdma 4>;
+       dma-names = "rx0", "tx0", "rx1", "tx1", "rx2", "tx2", "rx3", "tx3";
        ranges;
        #address-cells = <1>;
        #size-cells = <1>;
index dfa6c037124aeb242ffdc4c2919aae058e7543a9..0c113ffe381492627474948aeb3f8357c4693d44 100644 (file)
@@ -3,13 +3,22 @@ NVIDIA Tegra30 I2S controller
 Required properties:
 - compatible : "nvidia,tegra30-i2s"
 - reg : Should contain I2S registers location and length
+- clocks : Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
+- resets : Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names : Must include the following entries:
+  - i2s
 - nvidia,ahub-cif-ids : The list of AHUB CIF IDs for this port, rx (playback)
   first, tx (capture) second. See nvidia,tegra30-ahub.txt for values.
 
 Example:
 
-i2s@70002800 {
+i2s@70080300 {
        compatible = "nvidia,tegra30-i2s";
        reg = <0x70080300 0x100>;
        nvidia,ahub-cif-ids = <4 4>;
+       clocks = <&tegra_car 11>;
+       resets = <&tegra_car 11>;
+       reset-names = "i2s";
 };
index 91ff771c7e77da25031f19e0bd8cdf973494f63e..7ea701e07dc2603453eb4b37d1aaef1c626a3e06 100644 (file)
@@ -4,10 +4,19 @@ Required properties:
 - compatible : should be "nvidia,tegra114-spi".
 - reg: Should contain SPI registers location and length.
 - interrupts: Should contain SPI interrupts.
-- nvidia,dma-request-selector : The Tegra DMA controller's phandle and
-  request selector for this SPI controller.
-- This is also require clock named "spi" as per binding document
-  Documentation/devicetree/bindings/clock/clock-bindings.txt
+- clock-names : Must include the following entries:
+  - spi
+- resets : Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names : Must include the following entries:
+  - spi
+- dmas : Must contain an entry for each entry in clock-names.
+  See ../dma/dma.txt for details.
+- dma-names : Must include the following entries:
+  - rx
+  - tx
+- clocks : Must contain an entry for each entry in clock-names.
+  See ../clocks/clock-bindings.txt for details.
 
 Recommended properties:
 - spi-max-frequency: Definition as per
@@ -18,9 +27,14 @@ spi@7000d600 {
        compatible = "nvidia,tegra114-spi";
        reg = <0x7000d600 0x200>;
        interrupts = <0 82 0x04>;
-       nvidia,dma-request-selector = <&apbdma 16>;
        spi-max-frequency = <25000000>;
        #address-cells = <1>;
        #size-cells = <0>;
+       clocks = <&tegra_car 44>;
+       clock-names = "spi";
+       resets = <&tegra_car 44>;
+       reset-names = "spi";
+       dmas = <&apbdma 16>, <&apbdma 16>;
+       dma-names = "rx", "tx";
        status = "disabled";
 };
index 7b53da5cb75b9d24e11652f15bd15d11e67d6ada..bdf08e6dec9bdf325fe9a992c2dfd611dbd46a92 100644 (file)
@@ -4,8 +4,17 @@ Required properties:
 - compatible : should be "nvidia,tegra20-sflash".
 - reg: Should contain SFLASH registers location and length.
 - interrupts: Should contain SFLASH interrupts.
-- nvidia,dma-request-selector : The Tegra DMA controller's phandle and
-  request selector for this SFLASH controller.
+- clocks : Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
+- resets : Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names : Must include the following entries:
+  - spi
+- dmas : Must contain an entry for each entry in clock-names.
+  See ../dma/dma.txt for details.
+- dma-names : Must include the following entries:
+  - rx
+  - tx
 
 Recommended properties:
 - spi-max-frequency: Definition as per
@@ -17,10 +26,13 @@ spi@7000c380 {
        compatible = "nvidia,tegra20-sflash";
        reg = <0x7000c380 0x80>;
        interrupts = <0 39 0x04>;
-       nvidia,dma-request-selector = <&apbdma 16>;
        spi-max-frequency = <25000000>;
        #address-cells = <1>;
        #size-cells = <0>;
+       clocks = <&tegra_car 43>;
+       resets = <&tegra_car 43>;
+       reset-names = "spi";
+       dmas = <&apbdma 11>, <&apbdma 11>;
+       dma-names = "rx", "tx";
        status = "disabled";
 };
-
index eefe15e3d95e8f3cc9a8ff2885ec494563d488cd..5db9144a33c8beee16993c5f79100b59e8de669b 100644 (file)
@@ -4,8 +4,17 @@ Required properties:
 - compatible : should be "nvidia,tegra20-slink", "nvidia,tegra30-slink".
 - reg: Should contain SLINK registers location and length.
 - interrupts: Should contain SLINK interrupts.
-- nvidia,dma-request-selector : The Tegra DMA controller's phandle and
-  request selector for this SLINK controller.
+- clocks : Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
+- resets : Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names : Must include the following entries:
+  - spi
+- dmas : Must contain an entry for each entry in clock-names.
+  See ../dma/dma.txt for details.
+- dma-names : Must include the following entries:
+  - rx
+  - tx
 
 Recommended properties:
 - spi-max-frequency: Definition as per
@@ -17,10 +26,13 @@ spi@7000d600 {
        compatible = "nvidia,tegra20-slink";
        reg = <0x7000d600 0x200>;
        interrupts = <0 82 0x04>;
-       nvidia,dma-request-selector = <&apbdma 16>;
        spi-max-frequency = <25000000>;
        #address-cells = <1>;
        #size-cells = <0>;
+       clocks = <&tegra_car 44>;
+       resets = <&tegra_car 44>;
+       reset-names = "spi";
+       dmas = <&apbdma 16>, <&apbdma 16>;
+       dma-names = "rx", "tx";
        status = "disabled";
 };
-
index e019fdc38773c8046617a33aee0aad5883aa1ce7..4a864bd10d3d3cb8a9eb32c95a0e2899dbb97f4c 100644 (file)
@@ -8,6 +8,8 @@ Required properties:
 - compatible : should be "nvidia,tegra20-timer".
 - reg : Specifies base physical address and size of the registers.
 - interrupts : A list of 4 interrupts; one per timer channel.
+- clocks : Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
 
 Example:
 
@@ -18,4 +20,5 @@ timer {
                        0 1 0x04
                        0 41 0x04
                        0 42 0x04>;
+       clocks = <&tegra_car 132>;
 };
index 906109d4c593303ed3453f9284ba13426a21e5de..b5082a1cf461a16af5d37a5691a1b603ae47e031 100644 (file)
@@ -10,6 +10,8 @@ Required properties:
 - reg : Specifies base physical address and size of the registers.
 - interrupts : A list of 6 interrupts; one per each of timer channels 1
     through 5, and one for the shared interrupt for the remaining channels.
+- clocks : Must contain one entry, for the module clock.
+  See ../clocks/clock-bindings.txt for details.
 
 timer {
        compatible = "nvidia,tegra30-timer", "nvidia,tegra20-timer";
@@ -20,4 +22,5 @@ timer {
                      0 42 0x04
                      0 121 0x04
                      0 122 0x04>;
+       clocks = <&tegra_car 214>;
 };
index b5a86d20ee369413dafc97742bfe3288b62f8062..167d5dab9f649a43d12b84d92eb29cf731b57e5d 100644 (file)
@@ -31,38 +31,58 @@ Required properties:
        7: ..
        i: Local Timer Interrupt n
 
-Example 1: In this example, the system uses only the first global timer
-          interrupt generated by MCT and the remaining three global timer
-          interrupts are unused. Two local timer interrupts have been
-          specified.
+  For MCT block that uses a per-processor interrupt for local timers, such
+  as ones compatible with "samsung,exynos4412-mct", only one local timer
+  interrupt might be specified, meaning that all local timers use the same
+  per processor interrupt.
+
+Example 1: In this example, the IP contains two local timers, using separate
+          interrupts, so two local timer interrupts have been specified,
+          in addition to four global timer interrupts.
 
        mct@10050000 {
                compatible = "samsung,exynos4210-mct";
                reg = <0x10050000 0x800>;
-               interrupts = <0 57 0>, <0 0 0>, <0 0 0>, <0 0 0>,
+               interrupts = <0 57 0>, <0 69 0>, <0 70 0>, <0 71 0>,
                             <0 42 0>, <0 48 0>;
        };
 
-Example 2: In this example, the MCT global and local timer interrupts are
-          connected to two separate interrupt controllers. Hence, an
-          interrupt-map is created to map the interrupts to the respective
-          interrupt controllers.
+Example 2: In this example, the timer interrupts are connected to two separate
+          interrupt controllers. Hence, an interrupt-map is created to map
+          the interrupts to the respective interrupt controllers.
 
        mct@101C0000 {
                compatible = "samsung,exynos4210-mct";
                reg = <0x101C0000 0x800>;
-               interrupt-controller;
-               #interrups-cells = <2>;
                interrupt-parent = <&mct_map>;
-               interrupts = <0 0>, <1 0>, <2 0>, <3 0>,
-                            <4 0>, <5 0>;
+               interrupts = <0>, <1>, <2>, <3>, <4>, <5>;
 
                mct_map: mct-map {
-                       #interrupt-cells = <2>;
+                       #interrupt-cells = <1>;
                        #address-cells = <0>;
                        #size-cells = <0>;
-                       interrupt-map = <0x0 0 &combiner 23 3>,
-                                       <0x4 0 &gic 0 120 0>,
-                                       <0x5 0 &gic 0 121 0>;
+                       interrupt-map = <0 &gic 0 57 0>,
+                                       <1 &gic 0 69 0>,
+                                       <2 &combiner 12 6>,
+                                       <3 &combiner 12 7>,
+                                       <4 &gic 0 42 0>,
+                                       <5 &gic 0 48 0>;
                };
        };
+
+Example 3: In this example, the IP contains four local timers, but using
+          a per-processor interrupt to handle them. Either all the local
+          timer interrupts can be specified, with the same interrupt specifier
+          value or just the first one.
+
+       mct@10050000 {
+               compatible = "samsung,exynos4412-mct";
+               reg = <0x10050000 0x800>;
+
+               /* Both ways are possible in this case. Either: */
+               interrupts = <0 57 0>, <0 69 0>, <0 70 0>, <0 71 0>,
+                            <0 42 0>;
+               /* or: */
+               interrupts = <0 57 0>, <0 69 0>, <0 70 0>, <0 71 0>,
+                            <0 42 0>, <0 42 0>, <0 42 0>, <0 42 0>;
+       };
diff --git a/Documentation/devicetree/bindings/usb/keystone-phy.txt b/Documentation/devicetree/bindings/usb/keystone-phy.txt
new file mode 100644 (file)
index 0000000..f37b3a8
--- /dev/null
@@ -0,0 +1,20 @@
+TI Keystone USB PHY
+
+Required properties:
+ - compatible: should be "ti,keystone-usbphy".
+ - #address-cells, #size-cells : should be '1' if the device has sub-nodes
+   with 'reg' property.
+ - reg : Address and length of the usb phy control register set.
+
+The main purpose of this PHY driver is to enable the USB PHY reference clock
+gate on the Keystone SOC for both the USB2 and USB3 PHY. Otherwise it is just
+an NOP PHY driver.  Hence this node is referenced as both the usb2 and usb3
+phy node in the USB Glue layer driver node.
+
+usb_phy: usb_phy@2620738 {
+       compatible = "ti,keystone-usbphy";
+       #address-cells = <1>;
+       #size-cells = <1>;
+       reg = <0x2620738 32>;
+       status = "disabled";
+};
diff --git a/Documentation/devicetree/bindings/usb/keystone-usb.txt b/Documentation/devicetree/bindings/usb/keystone-usb.txt
new file mode 100644 (file)
index 0000000..60527d3
--- /dev/null
@@ -0,0 +1,42 @@
+TI Keystone Soc USB Controller
+
+DWC3 GLUE
+
+Required properties:
+ - compatible: should be "ti,keystone-dwc3".
+ - #address-cells, #size-cells : should be '1' if the device has sub-nodes
+   with 'reg' property.
+ - reg : Address and length of the register set for the USB subsystem on
+   the SOC.
+ - interrupts : The irq number of this device that is used to interrupt the
+   MPU.
+ - ranges: allows valid 1:1 translation between child's address space and
+   parent's address space.
+ - clocks: Clock IDs array as required by the controller.
+ - clock-names: names of clocks correseponding to IDs in the clock property.
+
+Sub-nodes:
+The dwc3 core should be added as subnode to Keystone DWC3 glue.
+- dwc3 :
+   The binding details of dwc3 can be found in:
+   Documentation/devicetree/bindings/usb/dwc3.txt
+
+Example:
+       usb: usb@2680000 {
+               compatible = "ti,keystone-dwc3";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               reg = <0x2680000 0x10000>;
+               clocks = <&clkusb>;
+               clock-names = "usb";
+               interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>;
+               ranges;
+               status = "disabled";
+
+               dwc3@2690000 {
+                       compatible = "synopsys,dwc3";
+                       reg = <0x2690000 0x70000>;
+                       interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>;
+                       usb-phy = <&usb_phy>, <&usb_phy>;
+               };
+       };
index df0933043a5be46f705a450e3956f92d8ef77600..3dc9140e3dfba6d26f7c43e43d04308134cb543e 100644 (file)
@@ -8,7 +8,12 @@ and additions :
 Required properties :
  - compatible : Should be "nvidia,tegra20-ehci".
  - nvidia,phy : phandle of the PHY that the controller is connected to.
- - clocks : Contains a single entry which defines the USB controller's clock.
+ - clocks : Must contain one entry, for the module clock.
+   See ../clocks/clock-bindings.txt for details.
+ - resets : Must contain an entry for each entry in reset-names.
+   See ../reset/reset.txt for details.
+ - reset-names : Must include the following entries:
+   - usb
 
 Optional properties:
  - nvidia,needs-double-reset : boolean is to be set for some of the Tegra20
index 0977b150585922846fff4751377c6c4a9e5b6989..520596da7953b7395bb654c5d5bb97d8de5963f5 100644 (file)
@@ -41,6 +41,7 @@ ibm   International Business Machines (IBM)
 idt    Integrated Device Technologies, Inc.
 img    Imagination Technologies Ltd.
 intercontrol   Inter Control Group
+isl    Intersil
 lg     LG Corporation
 linux  Linux-specific binding
 lsi    LSI Corp. (LSI Logic)
@@ -75,6 +76,7 @@ st    STMicroelectronics
 ste    ST-Ericsson
 stericsson     ST-Ericsson
 ti     Texas Instruments
+tlm    Trusted Logic Mobility
 toshiba        Toshiba Corporation
 toumaz Toumaz
 v3     V3 Semiconductor
index 248fe9da0b26f06f4d002896f8d0847a7097fc4c..44738564b2eecca00f86ab64e33f0992ee6faeb1 100644 (file)
@@ -463,6 +463,22 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
        atkbd.softrepeat= [HW]
                        Use software keyboard repeat
 
+       audit=          [KNL] Enable the audit sub-system
+                       Format: { "0" | "1" } (0 = disabled, 1 = enabled)
+                       0 - kernel audit is disabled and can not be enabled
+                           until the next reboot
+                       unset - kernel audit is initialized but disabled and
+                           will be fully enabled by the userspace auditd.
+                       1 - kernel audit is initialized and partially enabled,
+                           storing at most audit_backlog_limit messages in
+                           RAM until it is fully enabled by the userspace
+                           auditd.
+                       Default: unset
+
+       audit_backlog_limit= [KNL] Set the audit queue size limit.
+                       Format: <int> (must be >=0)
+                       Default: 64
+
        baycom_epp=     [HW,AX25]
                        Format: <io>,<mode>
 
index 29ccb5f0e8080918db361593aaf182c1266994c6..6270a0b2b99dfdf293635ad3debed95c1f121726 100644 (file)
@@ -543,6 +543,13 @@ F: drivers/tty/serial/altera_jtaguart.c
 F:     include/linux/altera_uart.h
 F:     include/linux/altera_jtaguart.h
 
+AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER
+M:     Tom Lendacky <thomas.lendacky@amd.com>
+L:     linux-crypto@vger.kernel.org
+S:     Supported
+F:     drivers/crypto/ccp/
+F:     include/linux/ccp.h
+
 AMD FAM15H PROCESSOR POWER MONITORING DRIVER
 M:     Andreas Herrmann <herrmann.der.user@googlemail.com>
 L:     lm-sensors@lm-sensors.org
@@ -770,7 +777,12 @@ ARM/Allwinner A1X SoC support
 M:     Maxime Ripard <maxime.ripard@free-electrons.com>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Maintained
-F:     arch/arm/mach-sunxi/
+N:     sun[x4567]i
+
+ARM/Allwinner SoC Clock Support
+M:     Emilio López <emilio@elopez.com.ar>
+S:     Maintained
+F:     drivers/clk/sunxi/
 
 ARM/ATMEL AT91RM9200 AND AT91SAM ARM ARCHITECTURES
 M:     Andrew Victor <linux@maxim.org.za>
@@ -871,6 +883,12 @@ S: Maintained
 F:     arch/arm/mach-ebsa110/
 F:     drivers/net/ethernet/amd/am79c961a.*
 
+ARM/ENERGY MICRO (SILICON LABS) EFM32 SUPPORT
+M:     Uwe Kleine-König <kernel@pengutronix.de>
+L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+S:     Maintained
+N:     efm32
+
 ARM/EZX SMARTPHONES (A780, A910, A1200, E680, ROKR E2 and ROKR E6)
 M:     Daniel Ribeiro <drwyrm@gmail.com>
 M:     Stefan Schmidt <stefan@openezx.org>
@@ -1033,6 +1051,12 @@ L:       linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Maintained
 F:     arch/arm/mach-mvebu/
 
+ARM/Marvell Berlin SoC support
+M:     Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+S:     Maintained
+F:     arch/arm/mach-berlin/
+
 ARM/Marvell Dove/Kirkwood/MV78xx0/Orion SOC support
 M:     Jason Cooper <jason@lakedaemon.net>
 M:     Andrew Lunn <andrew@lunn.ch>
@@ -1326,6 +1350,14 @@ F:       drivers/rtc/rtc-ab8500.c
 F:     drivers/rtc/rtc-pl031.c
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git
 
+ARM/Ux500 CLOCK FRAMEWORK SUPPORT
+M:     Ulf Hansson <ulf.hansson@linaro.org>
+L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+T:     git git://git.linaro.org/people/ulfh/clk.git
+S:     Maintained
+F:     drivers/clk/ux500/
+F:     include/linux/platform_data/clk-ux500.h
+
 ARM/VFP SUPPORT
 M:     Russell King <linux@arm.linux.org.uk>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -1602,11 +1634,10 @@ S:      Supported
 F:      drivers/scsi/esas2r
 
 AUDIT SUBSYSTEM
-M:     Al Viro <viro@zeniv.linux.org.uk>
 M:     Eric Paris <eparis@redhat.com>
 L:     linux-audit@redhat.com (subscribers-only)
 W:     http://people.redhat.com/sgrubb/audit/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current.git
+T:     git git://git.infradead.org/users/eparis/audit.git
 S:     Maintained
 F:     include/linux/audit.h
 F:     include/uapi/linux/audit.h
@@ -7418,6 +7449,12 @@ L:       linux-media@vger.kernel.org
 S:     Supported
 F:     drivers/media/i2c/s5c73m3/*
 
+SAMSUNG SOC CLOCK DRIVERS
+M:     Tomasz Figa <t.figa@samsung.com>
+S:     Supported
+L:     linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
+F:     drivers/clk/samsung/
+
 SERIAL DRIVERS
 M:     Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 L:     linux-serial@vger.kernel.org
index 4797b244eeee50af6dff5a2e10043ef12114100b..dc6ef9a2c649df04d0d8de515b5565978164dde5 100644 (file)
@@ -6,12 +6,13 @@ config ARM
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
        select ARCH_HAVE_CUSTOM_GPIO_H
        select ARCH_MIGHT_HAVE_PC_PARPORT
+       select ARCH_USE_BUILTIN_BSWAP
        select ARCH_USE_CMPXCHG_LOCKREF
        select ARCH_WANT_IPC_PARSE_VERSION
        select BUILDTIME_EXTABLE_SORT if MMU
        select CLONE_BACKWARDS
        select CPU_PM if (SUSPEND || CPU_IDLE)
-       select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN && MMU
+       select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
        select GENERIC_ATOMIC64 if (CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI)
        select GENERIC_CLOCKEVENTS_BROADCAST if SMP
        select GENERIC_IDLE_POLL_SETUP
@@ -36,6 +37,7 @@ config ARM
        select HAVE_DMA_ATTRS
        select HAVE_DMA_CONTIGUOUS if MMU
        select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL)
+       select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU
        select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL)
        select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL)
        select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
@@ -63,6 +65,7 @@ config ARM
        select IRQ_FORCED_THREADING
        select KTIME_SCALAR
        select MODULES_USE_ELF_REL
+       select NO_BOOTMEM
        select OLD_SIGACTION
        select OLD_SIGSUSPEND3
        select PERF_USE_VMALLOC
@@ -314,6 +317,8 @@ config ARCH_INTEGRATOR
        bool "ARM Ltd. Integrator family"
        select ARCH_HAS_CPUFREQ
        select ARM_AMBA
+       select ARM_PATCH_PHYS_VIRT
+       select AUTO_ZRELADDR
        select COMMON_CLK
        select COMMON_CLK_VERSATILE
        select GENERIC_CLOCKEVENTS
@@ -411,6 +416,26 @@ config ARCH_EBSA110
          Ethernet interface, two PCMCIA sockets, two serial ports and a
          parallel port.
 
+config ARCH_EFM32
+       bool "Energy Micro efm32"
+       depends on !MMU
+       select ARCH_REQUIRE_GPIOLIB
+       select ARM_NVIC
+       # CLKSRC_MMIO is wrong here, but needed until a proper fix is merged,
+       # i.e. CLKSRC_EFM32 selecting CLKSRC_MMIO
+       select CLKSRC_MMIO
+       select CLKSRC_OF
+       select COMMON_CLK
+       select CPU_V7M
+       select GENERIC_CLOCKEVENTS
+       select NO_DMA
+       select NO_IOPORT
+       select SPARSE_IRQ
+       select USE_OF
+       help
+         Support for Energy Micro's (now Silicon Labs) efm32 Giant Gecko
+         processors.
+
 config ARCH_EP93XX
        bool "EP93xx-based"
        select ARCH_HAS_HOLES_MEMORYMODEL
@@ -632,10 +657,10 @@ config ARCH_PXA
        help
          Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
 
-config ARCH_MSM
+config ARCH_MSM_NODT
        bool "Qualcomm MSM"
+       select ARCH_MSM
        select ARCH_REQUIRE_GPIOLIB
-       select CLKSRC_OF if OF
        select COMMON_CLK
        select GENERIC_CLOCKEVENTS
        help
@@ -645,8 +670,9 @@ config ARCH_MSM
          stack and controls some vital subsystems
          (clock and power control, etc).
 
-config ARCH_SHMOBILE
-       bool "Renesas SH-Mobile / R-Mobile"
+config ARCH_SHMOBILE_LEGACY
+       bool "Renesas ARM SoCs (non-multiplatform)"
+       select ARCH_SHMOBILE
        select ARM_PATCH_PHYS_VIRT
        select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
@@ -661,7 +687,9 @@ config ARCH_SHMOBILE
        select PM_GENERIC_DOMAINS if PM
        select SPARSE_IRQ
        help
-         Support for Renesas's SH-Mobile and R-Mobile ARM platforms.
+         Support for Renesas ARM SoC platforms using a non-multiplatform
+         kernel. This includes the SH-Mobile, R-Mobile, EMMA-Mobile, R-Car
+         and RZ families.
 
 config ARCH_RPC
        bool "RiscPC"
@@ -728,7 +756,7 @@ config ARCH_S3C64XX
        select CLKDEV_LOOKUP
        select CLKSRC_SAMSUNG_PWM
        select COMMON_CLK
-       select CPU_V6
+       select CPU_V6K
        select GENERIC_CLOCKEVENTS
        select GPIO_SAMSUNG
        select HAVE_S3C2410_I2C if I2C
@@ -740,7 +768,6 @@ config ARCH_S3C64XX
        select S3C_DEV_NAND
        select S3C_GPIO_TRACK
        select SAMSUNG_ATAGS
-       select SAMSUNG_GPIOLIB_4BIT
        select SAMSUNG_WAKEMASK
        select SAMSUNG_WDT_RESET
        select USB_ARCH_HAS_OHCI
@@ -911,6 +938,8 @@ source "arch/arm/mach-bcm/Kconfig"
 
 source "arch/arm/mach-bcm2835/Kconfig"
 
+source "arch/arm/mach-berlin/Kconfig"
+
 source "arch/arm/mach-clps711x/Kconfig"
 
 source "arch/arm/mach-cns3xxx/Kconfig"
@@ -927,6 +956,8 @@ source "arch/arm/mach-gemini/Kconfig"
 
 source "arch/arm/mach-highbank/Kconfig"
 
+source "arch/arm/mach-hisi/Kconfig"
+
 source "arch/arm/mach-integrator/Kconfig"
 
 source "arch/arm/mach-iop32x/Kconfig"
@@ -945,6 +976,8 @@ source "arch/arm/mach-ks8695/Kconfig"
 
 source "arch/arm/mach-msm/Kconfig"
 
+source "arch/arm/mach-moxart/Kconfig"
+
 source "arch/arm/mach-mv78xx0/Kconfig"
 
 source "arch/arm/mach-imx/Kconfig"
@@ -1053,6 +1086,8 @@ config ARM_TIMER_SP804
        select CLKSRC_MMIO
        select CLKSRC_OF if OF
 
+source "arch/arm/firmware/Kconfig"
+
 source arch/arm/mm/Kconfig
 
 config ARM_NR_BANKS
@@ -1611,7 +1646,7 @@ config HZ_FIXED
        default 200 if ARCH_EBSA110 || ARCH_S3C24XX || ARCH_S5P64X0 || \
                ARCH_S5PV210 || ARCH_EXYNOS4
        default AT91_TIMER_HZ if ARCH_AT91
-       default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE
+       default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE_LEGACY
        default 0
 
 choice
@@ -1651,9 +1686,6 @@ config HZ
 config SCHED_HRTICK
        def_bool HIGH_RES_TIMERS
 
-config SCHED_HRTICK
-       def_bool HIGH_RES_TIMERS
-
 config THUMB2_KERNEL
        bool "Compile the kernel in Thumb-2 mode" if !CPU_THUMBONLY
        depends on (CPU_V7 || CPU_V7M) && !CPU_V6 && !CPU_V6K
@@ -1796,10 +1828,10 @@ config ARCH_WANT_GENERAL_HUGETLB
 source "mm/Kconfig"
 
 config FORCE_MAX_ZONEORDER
-       int "Maximum zone order" if ARCH_SHMOBILE
-       range 11 64 if ARCH_SHMOBILE
+       int "Maximum zone order" if ARCH_SHMOBILE_LEGACY
+       range 11 64 if ARCH_SHMOBILE_LEGACY
        default "12" if SOC_AM33XX
-       default "9" if SA1111
+       default "9" if SA1111 || ARCH_EFM32
        default "11"
        help
          The kernel memory allocator divides physically contiguous memory
@@ -1934,6 +1966,7 @@ config ZBOOT_ROM_BSS
 config ZBOOT_ROM
        bool "Compressed boot loader in ROM/flash"
        depends on ZBOOT_ROM_TEXT != ZBOOT_ROM_BSS
+       depends on !ARM_APPENDED_DTB && !XIP_KERNEL && !AUTO_ZRELADDR
        help
          Say Y here if you intend to execute your compressed kernel image
          (zImage) directly from ROM or flash.  If unsure, say N.
@@ -1969,7 +2002,7 @@ endchoice
 
 config ARM_APPENDED_DTB
        bool "Use appended device tree blob to zImage (EXPERIMENTAL)"
-       depends on OF && !ZBOOT_ROM
+       depends on OF
        help
          With this option, the boot code will look for a device tree binary
          (DTB) appended to zImage
@@ -2057,7 +2090,7 @@ endchoice
 
 config XIP_KERNEL
        bool "Kernel Execute-In-Place from ROM"
-       depends on !ZBOOT_ROM && !ARM_LPAE && !ARCH_MULTIPLATFORM
+       depends on !ARM_LPAE && !ARCH_MULTIPLATFORM
        help
          Execute-In-Place allows the kernel to run from non-volatile storage
          directly addressable by the CPU, such as NOR flash. This saves RAM
@@ -2120,7 +2153,6 @@ config CRASH_DUMP
 
 config AUTO_ZRELADDR
        bool "Auto calculation of the decompressed kernel image address"
-       depends on !ZBOOT_ROM
        help
          ZRELADDR is the physical address where the decompressed kernel
          image will be placed. If AUTO_ZRELADDR is selected, the address
index 5765abf5ce84576d8de31df83d709160905d7b19..0531da8e5216e442ee1f9c8878e4fb9d84611581 100644 (file)
@@ -2,6 +2,18 @@ menu "Kernel hacking"
 
 source "lib/Kconfig.debug"
 
+config ARM_PTDUMP
+       bool "Export kernel pagetable layout to userspace via debugfs"
+       depends on DEBUG_KERNEL
+       select DEBUG_FS
+       ---help---
+         Say Y here if you want to show the kernel pagetable layout in a
+         debugfs file. This information is only useful for kernel developers
+         who are working in architecture specific areas of the kernel.
+         It is probably not a good idea to enable this feature in a production
+         kernel.
+         If in doubt, say "N"
+
 config STRICT_DEVMEM
        bool "Filter access to /dev/mem"
        depends on MMU
@@ -94,6 +106,25 @@ choice
                depends on ARCH_BCM2835
                select DEBUG_UART_PL01X
 
+       config DEBUG_BCM_KONA_UART
+               bool "Kernel low-level debugging messages via BCM KONA UART"
+               depends on ARCH_BCM
+               select DEBUG_UART_8250
+               help
+                 Say Y here if you want kernel low-level debugging support
+                 on Broadcom SoC platforms.
+                 This low level debug works for Broadcom
+                 mobile SoCs in the Kona family of chips (e.g. bcm28155,
+                 bcm11351, etc...)
+
+       config DEBUG_BERLIN_UART
+               bool "Marvell Berlin SoC Debug UART"
+               depends on ARCH_BERLIN
+               select DEBUG_UART_8250
+               help
+                 Say Y here if you want kernel low-level debugging support
+                 on Marvell Berlin SoC based platforms.
+
        config DEBUG_CLPS711X_UART1
                bool "Kernel low-level debugging messages via UART1"
                depends on ARCH_CLPS711X
@@ -255,6 +286,13 @@ choice
                  Say Y here if you want kernel low-level debugging support
                  on i.MX35.
 
+       config DEBUG_IMX50_UART
+               bool "i.MX50 Debug UART"
+               depends on SOC_IMX50
+               help
+                 Say Y here if you want kernel low-level debugging support
+                 on i.MX50.
+
        config DEBUG_IMX51_UART
                bool "i.MX51 Debug UART"
                depends on SOC_IMX51
@@ -897,6 +935,7 @@ config DEBUG_IMX_UART_PORT
                                                DEBUG_IMX21_IMX27_UART || \
                                                DEBUG_IMX31_UART || \
                                                DEBUG_IMX35_UART || \
+                                               DEBUG_IMX50_UART || \
                                                DEBUG_IMX51_UART || \
                                                DEBUG_IMX53_UART || \
                                                DEBUG_IMX6Q_UART || \
@@ -931,6 +970,7 @@ config DEBUG_LL_INCLUDE
                                 DEBUG_IMX21_IMX27_UART || \
                                 DEBUG_IMX31_UART || \
                                 DEBUG_IMX35_UART || \
+                                DEBUG_IMX50_UART || \
                                 DEBUG_IMX51_UART || \
                                 DEBUG_IMX53_UART ||\
                                 DEBUG_IMX6Q_UART || \
@@ -988,6 +1028,7 @@ config DEBUG_UART_PHYS
        default 0x20064000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2
        default 0x20068000 if DEBUG_RK29_UART2 || DEBUG_RK3X_UART3
        default 0x20201000 if DEBUG_BCM2835
+       default 0x3e000000 if DEBUG_BCM_KONA_UART
        default 0x4000e400 if DEBUG_LL_UART_EFM32
        default 0x40090000 if ARCH_LPC32XX
        default 0x40100000 if DEBUG_PXA_UART1
@@ -1011,6 +1052,7 @@ config DEBUG_UART_PHYS
        default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE
        default 0xf1012000 if ARCH_DOVE || ARCH_KIRKWOOD || ARCH_MV78XX0 || \
                                ARCH_ORION5X
+       default 0xf7fc9000 if DEBUG_BERLIN_UART
        default 0xf8b00000 if DEBUG_HI3716_UART
        default 0xfcb00000 if DEBUG_HI3620_UART
        default 0xfe800000 if ARCH_IOP32X
@@ -1036,6 +1078,7 @@ config DEBUG_UART_VIRT
        default 0xf2100000 if DEBUG_PXA_UART1
        default 0xf4090000 if ARCH_LPC32XX
        default 0xf4200000 if ARCH_GEMINI
+       default 0xf7fc9000 if DEBUG_BERLIN_UART
        default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9
        default 0xf8090000 if DEBUG_VEXPRESS_UART0_RS1
        default 0xfb009000 if DEBUG_REALVIEW_STD_PORT
@@ -1049,6 +1092,7 @@ config DEBUG_UART_VIRT
        default 0xfe018000 if DEBUG_MMP_UART3
        default 0xfe100000 if DEBUG_IMX23_UART || DEBUG_IMX28_UART
        default 0xfe230000 if DEBUG_PICOXCELL_UART
+       default 0xfe300000 if DEBUG_BCM_KONA_UART
        default 0xfe800000 if ARCH_IOP32X
        default 0xfeb00000 if DEBUG_HI3620_UART || DEBUG_HI3716_UART
        default 0xfeb24000 if DEBUG_RK3X_UART0
@@ -1091,7 +1135,8 @@ config DEBUG_UART_8250_WORD
        default y if DEBUG_PICOXCELL_UART || DEBUG_SOCFPGA_UART || \
                ARCH_KEYSTONE || \
                DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \
-               DEBUG_DAVINCI_DA8XX_UART2 || DEBUG_DAVINCI_TNETV107X_UART1
+               DEBUG_DAVINCI_DA8XX_UART2 || DEBUG_DAVINCI_TNETV107X_UART1 || \
+               DEBUG_BCM_KONA_UART
 
 config DEBUG_UART_8250_FLOW_CONTROL
        bool "Enable flow control for 8250 UART"
@@ -1150,4 +1195,15 @@ config PID_IN_CONTEXTIDR
          additional instructions during context switch. Say Y here only if you
          are planning to use hardware trace tools with this kernel.
 
+config DEBUG_SET_MODULE_RONX
+       bool "Set loadable kernel module data as NX and text as RO"
+       depends on MODULES
+       ---help---
+         This option helps catch unintended modifications to loadable
+         kernel module's text and read-only data. It also prevents execution
+         of module data. Such protection may interfere with run-time code
+         patching and dynamic kernel tracing - and they might also protect
+         against certain classes of kernel exploits.
+         If in doubt, say "N".
+
 endmenu
index 55b4255ad6ed9dd3e911d45b72acd822e81422f0..23d5e3946589a6c5e240b7d0060d84efee71d5d5 100644 (file)
@@ -144,15 +144,18 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
 machine-$(CONFIG_ARCH_AT91)            += at91
 machine-$(CONFIG_ARCH_BCM)             += bcm
 machine-$(CONFIG_ARCH_BCM2835)         += bcm2835
+machine-$(CONFIG_ARCH_BERLIN)          += berlin
 machine-$(CONFIG_ARCH_CLPS711X)                += clps711x
 machine-$(CONFIG_ARCH_CNS3XXX)         += cns3xxx
 machine-$(CONFIG_ARCH_DAVINCI)         += davinci
 machine-$(CONFIG_ARCH_DOVE)            += dove
 machine-$(CONFIG_ARCH_EBSA110)         += ebsa110
+machine-$(CONFIG_ARCH_EFM32)           += efm32
 machine-$(CONFIG_ARCH_EP93XX)          += ep93xx
 machine-$(CONFIG_ARCH_EXYNOS)          += exynos
 machine-$(CONFIG_ARCH_GEMINI)          += gemini
 machine-$(CONFIG_ARCH_HIGHBANK)                += highbank
+machine-$(CONFIG_ARCH_HI3xxx)          += hisi
 machine-$(CONFIG_ARCH_INTEGRATOR)      += integrator
 machine-$(CONFIG_ARCH_IOP13XX)         += iop13xx
 machine-$(CONFIG_ARCH_IOP32X)          += iop32x
@@ -163,6 +166,7 @@ machine-$(CONFIG_ARCH_KIRKWOOD)             += kirkwood
 machine-$(CONFIG_ARCH_KS8695)          += ks8695
 machine-$(CONFIG_ARCH_LPC32XX)         += lpc32xx
 machine-$(CONFIG_ARCH_MMP)             += mmp
+machine-$(CONFIG_ARCH_MOXART)          += moxart
 machine-$(CONFIG_ARCH_MSM)             += msm
 machine-$(CONFIG_ARCH_MV78XX0)         += mv78xx0
 machine-$(CONFIG_ARCH_MVEBU)           += mvebu
@@ -186,7 +190,6 @@ machine-$(CONFIG_ARCH_S5PC100)              += s5pc100
 machine-$(CONFIG_ARCH_S5PV210)         += s5pv210
 machine-$(CONFIG_ARCH_SA1100)          += sa1100
 machine-$(CONFIG_ARCH_SHMOBILE)        += shmobile
-machine-$(CONFIG_ARCH_SHMOBILE_MULTI)  += shmobile
 machine-$(CONFIG_ARCH_SIRF)            += prima2
 machine-$(CONFIG_ARCH_SOCFPGA)         += socfpga
 machine-$(CONFIG_ARCH_STI)             += sti
@@ -264,6 +267,7 @@ core-$(CONFIG_KVM_ARM_HOST)         += arch/arm/kvm/
 core-y                         += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
 core-y                         += arch/arm/net/
 core-y                         += arch/arm/crypto/
+core-y                         += arch/arm/firmware/
 core-y                         += $(machdirs) $(platdirs)
 
 drivers-$(CONFIG_OPROFILE)      += arch/arm/oprofile/
index e7190bb5998e149906a4763e815712953c7421f5..68c918362b79a7dba1baf799697019be2fb70912 100644 (file)
@@ -64,7 +64,7 @@ else
 endif
 endif
 
-ifeq ($(CONFIG_ARCH_SHMOBILE),y)
+ifeq ($(CONFIG_ARCH_SHMOBILE_LEGACY),y)
 OBJS           += head-shmobile.o
 endif
 
@@ -108,12 +108,12 @@ endif
 
 targets       := vmlinux vmlinux.lds \
                 piggy.$(suffix_y) piggy.$(suffix_y).o \
-                lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S \
-                font.o font.c head.o misc.o $(OBJS)
+                lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S bswapsdi2.o \
+                bswapsdi2.S font.o font.c head.o misc.o $(OBJS)
 
 # Make sure files are removed during clean
 extra-y       += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \
-                lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) \
+                lib1funcs.S ashldi3.S bswapsdi2.S $(libfdt) $(libfdt_hdrs) \
                 hyp-stub.S
 
 ifeq ($(CONFIG_FUNCTION_TRACER),y)
@@ -156,6 +156,12 @@ ashldi3 = $(obj)/ashldi3.o
 $(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S
        $(call cmd,shipped)
 
+# For __bswapsi2, __bswapdi2
+bswapsdi2 = $(obj)/bswapsdi2.o
+
+$(obj)/bswapsdi2.S: $(srctree)/arch/$(SRCARCH)/lib/bswapsdi2.S
+       $(call cmd,shipped)
+
 # We need to prevent any GOTOFF relocs being used with references
 # to symbols in the .bss section since we cannot relocate them
 # independently from the rest at run time.  This can be achieved by
@@ -177,7 +183,8 @@ if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \
 fi
 
 $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
-               $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) FORCE
+               $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) \
+               $(bswapsdi2) FORCE
        @$(check_for_multiple_zreladdr)
        $(call if_changed,ld)
        @$(check_for_bad_syms)
index d57c1a65b24f981fb25c62aa58c73c1fedd84ab8..ede21c16fdc03f38d585de84d1f13b83192f5bf9 100644 (file)
@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_AT91) += at91rm9200ek.dtb
 dtb-$(CONFIG_ARCH_AT91) += mpa1600.dtb
 # sam9260
 dtb-$(CONFIG_ARCH_AT91) += animeo_ip.dtb
+dtb-$(CONFIG_ARCH_AT91) += at91-qil_a9260.dtb
 dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb
 dtb-$(CONFIG_ARCH_AT91) += ethernut5.dtb
 dtb-$(CONFIG_ARCH_AT91) += evk-pro3.dtb
@@ -30,6 +31,7 @@ dtb-$(CONFIG_ARCH_AT91) += pm9g45.dtb
 dtb-$(CONFIG_ARCH_AT91) += at91sam9n12ek.dtb
 # sam9x5
 dtb-$(CONFIG_ARCH_AT91) += at91-ariag25.dtb
+dtb-$(CONFIG_ARCH_AT91) += at91-cosino_mega2560.dtb
 dtb-$(CONFIG_ARCH_AT91) += at91sam9g15ek.dtb
 dtb-$(CONFIG_ARCH_AT91) += at91sam9g25ek.dtb
 dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb
@@ -40,11 +42,16 @@ dtb-$(CONFIG_ARCH_AT91)     += sama5d31ek.dtb
 dtb-$(CONFIG_ARCH_AT91)        += sama5d33ek.dtb
 dtb-$(CONFIG_ARCH_AT91)        += sama5d34ek.dtb
 dtb-$(CONFIG_ARCH_AT91)        += sama5d35ek.dtb
+dtb-$(CONFIG_ARCH_AT91)        += sama5d36ek.dtb
+
 dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
 dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
 dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm11351-brt.dtb \
        bcm28155-ap.dtb
 dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
+dtb-$(CONFIG_ARCH_BERLIN) += \
+       berlin2-sony-nsz-gs7.dtb        \
+       berlin2cd-google-chromecast.dtb
 dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
        da850-evm.dtb
 dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
@@ -52,6 +59,7 @@ dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
        dove-d2plug.dtb \
        dove-d3plug.dtb \
        dove-dove-db.dtb
+dtb-$(CONFIG_ARCH_EFM32) += efm32gg-dk3750.dtb
 dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
        exynos4210-smdkv310.dtb \
        exynos4210-trats.dtb \
@@ -59,13 +67,16 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
        exynos4412-odroidx.dtb \
        exynos4412-origen.dtb \
        exynos4412-smdk4412.dtb \
+       exynos4412-tiny4412.dtb \
        exynos4412-trats2.dtb \
        exynos5250-arndale.dtb \
        exynos5250-smdk5250.dtb \
        exynos5250-snow.dtb \
+       exynos5420-arndale-octa.dtb \
        exynos5420-smdk5420.dtb \
        exynos5440-sd5v1.dtb \
        exynos5440-ssdk5440.dtb
+dtb-$(CONFIG_ARCH_HI3xxx) += hi3620-hi4511.dtb
 dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
        ecx-2000.dtb
 dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
@@ -85,11 +96,13 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
        kirkwood-iomega_ix2_200.dtb \
        kirkwood-is2.dtb \
        kirkwood-km_kirkwood.dtb \
+       kirkwood-laplug.dtb \
        kirkwood-lschlv2.dtb \
        kirkwood-lsxhl.dtb \
        kirkwood-mplcec4.dtb \
        kirkwood-mv88f6281gtw-ge.dtb \
        kirkwood-netgear_readynas_duo_v2.dtb \
+       kirkwood-netgear_readynas_nv+_v2.dtb \
        kirkwood-ns2.dtb \
        kirkwood-ns2lite.dtb \
        kirkwood-ns2max.dtb \
@@ -104,8 +117,10 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
        kirkwood-ts219-6281.dtb \
        kirkwood-ts219-6282.dtb
 dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb
+dtb-$(CONFIG_ARCH_MOXART) += moxart-uc7112lx.dtb
 dtb-$(CONFIG_ARCH_MSM) += qcom-msm8660-surf.dtb \
-       qcom-msm8960-cdp.dtb
+       qcom-msm8960-cdp.dtb \
+       qcom-apq8074-dragonboard.dtb
 dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
        armada-370-mirabox.dtb \
        armada-370-netgear-rn102.dtb \
@@ -114,6 +129,7 @@ dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
        armada-xp-axpwifiap.dtb \
        armada-xp-db.dtb \
        armada-xp-gp.dtb \
+       armada-xp-netgear-rn2120.dtb \
        armada-xp-matrix.dtb \
        armada-xp-openblocks-ax3-4.dtb
 dtb-$(CONFIG_ARCH_MXC) += \
@@ -173,12 +189,19 @@ dtb-$(CONFIG_ARCH_NSPIRE) += nspire-cx.dtb \
        nspire-tp.dtb \
        nspire-clp.dtb
 dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
+       omap2430-sdp.dtb \
+       omap2420-n800.dtb \
+       omap2420-n810.dtb \
+       omap2420-n810-wimax.dtb \
        omap3430-sdp.dtb \
        omap3-beagle.dtb \
+       omap3-cm-t3730.dtb \
+       omap3-sbc-t3730.dtb \
        omap3-devkit8000.dtb \
        omap3-beagle-xm.dtb \
        omap3-evm.dtb \
        omap3-evm-37xx.dtb \
+       omap3-ldp.dtb \
        omap3-n900.dtb \
        omap3-n9.dtb \
        omap3-n950.dtb \
@@ -216,8 +239,9 @@ dtb-$(CONFIG_ARCH_U8500) += ste-snowball.dtb \
 dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
 dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \
        s3c6410-smdk6410.dtb
-dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
+dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += emev2-kzm9d.dtb \
        r7s72100-genmai.dtb \
+       r7s72100-genmai-reference.dtb \
        r8a7740-armadillo800eva.dtb \
        r8a7778-bockw.dtb \
        r8a7778-bockw-reference.dtb \
@@ -226,13 +250,15 @@ dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
        r8a7779-marzen-reference.dtb \
        r8a7791-koelsch.dtb \
        r8a7790-lager.dtb \
-       r8a7790-lager-reference.dtb \
        sh73a0-kzm9g.dtb \
        sh73a0-kzm9g-reference.dtb \
        r8a73a4-ape6evm.dtb \
        r8a73a4-ape6evm-reference.dtb \
        sh7372-mackerel.dtb
-dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb
+dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
+       r7s72100-genmai-reference.dtb \
+       r8a7791-koelsch.dtb \
+       r8a7790-lager.dtb
 dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \
        socfpga_cyclone5_socdk.dtb \
        socfpga_cyclone5_sockit.dtb \
@@ -255,6 +281,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += \
        sun4i-a10-hackberry.dtb \
        sun5i-a10s-olinuxino-micro.dtb \
        sun5i-a13-olinuxino.dtb \
+       sun5i-a13-olinuxino-micro.dtb \
        sun6i-a31-colombus.dtb \
        sun7i-a20-cubieboard2.dtb \
        sun7i-a20-cubietruck.dtb \
index 03fcbf0a88a8ef24565257d32be79ab75dd4aa79..b4127c6493a2901f6d813ecf0b4507d691abb1cc 100644 (file)
                device_type = "memory";
                reg = <0x80000000 0x10000000>; /* 256 MB */
        };
+
+        vmmc_fixed: vmmc {
+                compatible = "regulator-fixed";
+                regulator-name = "vmmc_fixed";
+                regulator-min-microvolt = <3300000>;
+                regulator-max-microvolt = <3300000>;
+        };
+};
+
+&davinci_emac {
+            status = "okay";
+};
+
+&davinci_mdio {
+            status = "okay";
 };
 
 &i2c1 {
 &i2c3 {
        clock-frequency = <400000>;
 };
+
+&mmc1 {
+       vmmc-supply = <&vmmc_fixed>;
+       bus-width = <4>;
+};
+
+&mmc2 {
+      status = "disabled";
+};
+
+&mmc3 {
+      status = "disabled";
+};
+
index 3a1de9eb51112f2eb0c6eb00b5b20026985800b5..3c4f6d983cbd4c32175373ad8a3d0740098f8149 100644 (file)
                        nand-on-flash-bbt;
                        status = "okay";
 
-                       at91bootstrap@0 {
-                               label = "at91bootstrap";
-                               reg = <0x0 0x8000>;
-                       };
-
-                       barebox@8000 {
+                       barebox@0 {
                                label = "barebox";
-                               reg = <0x8000 0x40000>;
-                       };
-
-                       bareboxenv@48000 {
-                               label = "bareboxenv";
-                               reg = <0x48000 0x8000>;
-                       };
-
-                       user_block@0x50000 {
-                               label = "user_block";
-                               reg = <0x50000 0xb0000>;
+                               reg = <0x0 0x58000>;
                        };
 
-                       kernel@100000 {
-                               label = "kernel";
-                               reg = <0x100000 0x1b0000>;
+                       u_boot_env@58000 {
+                               label = "u_boot_env";
+                               reg = <0x58000 0x8000>;
                        };
 
-                       root@2b0000 {
-                               label = "root";
-                               reg = <0x2b0000 0x1D50000>;
+                       ubi@60000 {
+                               label = "ubi";
+                               reg = <0x60000 0x1FA0000>;
                        };
                };
 
index 2471d9da767bfad77a4419c20d17407473e704fb..944e8785b30833ea34ace20884c6844a7d3cfe15 100644 (file)
                                green_pwr_led {
                                        label = "mirabox:green:pwr";
                                        gpios = <&gpio1 31 1>;
-                                       linux,default-trigger = "heartbeat";
+                                       default-state = "keep";
                                };
 
                                blue_stat_led {
                                        label = "mirabox:blue:stat";
                                        gpios = <&gpio2 0 1>;
-                                       linux,default-trigger = "cpu0";
+                                       default-state = "off";
                                };
 
                                green_stat_led {
                                        reg = <0x25>;
                                };
                        };
+
+                       nand@d0000 {
+                               status = "okay";
+                               num-cs = <1>;
+                               marvell,nand-keep-config;
+                               marvell,nand-enable-arbiter;
+                               nand-on-flash-bbt;
+
+                               partition@0 {
+                                       label = "U-Boot";
+                                       reg = <0 0x400000>;
+                               };
+                               partition@400000 {
+                                       label = "Linux";
+                                       reg = <0x400000 0x400000>;
+                               };
+                               partition@800000 {
+                                       label = "Filesystem";
+                                       reg = <0x800000 0x3f800000>;
+                               };
+                       };
                };
        };
 };
index 8ac2ac1f69cc0d6f50101c815fada7c9183ce9d8..651aeb5ef43956e27cb945ae1e5d6dc2bce560e9 100644 (file)
@@ -11,6 +11,8 @@
 
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-370.dtsi"
 
 / {
@@ -62,6 +64,7 @@
                                        marvell,pins = "mpp57";
                                        marvell,function = "gpio";
                                };
+
                                sata1_led_pin: sata1-led-pin {
                                        marvell,pins = "mpp15";
                                        marvell,function = "gpio";
                                        marvell,function = "gpio";
                                };
 
+                               backup_button_pin: backup-button-pin {
+                                       marvell,pins = "mpp58";
+                                       marvell,function = "gpio";
+                               };
+
+                               power_button_pin: power-button-pin {
+                                       marvell,pins = "mpp62";
+                                       marvell,function = "gpio";
+                               };
+
+                               reset_button_pin: reset-button-pin {
+                                       marvell,pins = "mpp6";
+                                       marvell,function = "gpio";
+                               };
+
                                poweroff: poweroff {
                                        marvell,pins = "mpp8";
                                        marvell,function = "gpio";
                        };
 
                        mdio {
-                               phy0: ethernet-phy@0 {
+                               phy0: ethernet-phy@0 { /* Marvell 88E1318 */
                                        reg = <0>;
                                };
                        };
                                clock-frequency = <100000>;
                                status = "okay";
 
+                               isl12057: isl12057@68 {
+                                       compatible = "isl,isl12057";
+                                       reg = <0x68>;
+                               };
+
                                g762: g762@3e {
                                        compatible = "gmt,g762";
                                        reg = <0x3e>;
                                        pwm_polarity = <0>;
                                };
                        };
+
+                       nand@d0000 {
+                               status = "okay";
+                               num-cs = <1>;
+                               marvell,nand-keep-config;
+                               marvell,nand-enable-arbiter;
+                               nand-on-flash-bbt;
+
+                               partition@0 {
+                                       label = "u-boot";
+                                       reg = <0x0000000 0x180000>;  /* 1.5MB */
+                                       read-only;
+                               };
+
+                               partition@180000 {
+                                       label = "u-boot-env";
+                                       reg = <0x180000 0x20000>;    /* 128KB */
+                                       read-only;
+                               };
+
+                               partition@200000 {
+                                       label = "uImage";
+                                       reg = <0x0200000 0x600000>;    /* 6MB */
+                               };
+
+                               partition@800000 {
+                                       label = "minirootfs";
+                                       reg = <0x0800000 0x400000>;    /* 4MB */
+                               };
+
+                               /* Last MB is for the BBT, i.e. not writable */
+                               partition@c00000 {
+                                       label = "ubifs";
+                                       reg = <0x0c00000 0x7400000>; /* 116MB */
+                               };
+                       };
                };
        };
 
        clocks {
-              #address-cells = <1>;
-              #size-cells = <0>;
-
-              g762_clk: fixedclk {
+              g762_clk: g762-oscillator {
                         compatible = "fixed-clock";
                         #clock-cells = <0>;
                         clock-frequency = <8192>;
               };
        };
 
-       gpio_leds {
+       gpio-leds {
                compatible = "gpio-leds";
-               pinctrl-0 = < &power_led_pin
-                             &sata1_led_pin
-                             &sata2_led_pin
-                             &backup_led_pin >;
+               pinctrl-0 = <&power_led_pin
+                            &sata1_led_pin
+                            &sata2_led_pin
+                            &backup_led_pin>;
                pinctrl-names = "default";
 
-               blue_power_led {
+               blue-power-led {
                        label = "rn102:blue:pwr";
-                       gpios = <&gpio1 25 1>;  /* GPIO 57 Active Low */
-                       linux,default-trigger = "heartbeat";
+                       gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
                };
 
-               green_sata1_led {
+               green-sata1-led {
                        label = "rn102:green:sata1";
-                       gpios = <&gpio0 15 1>;  /* GPIO 15 Active Low */
+                       gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
                        default-state = "on";
                };
 
-               green_sata2_led {
+               green-sata2-led {
                        label = "rn102:green:sata2";
-                       gpios = <&gpio0 14 1>;   /* GPIO 14 Active Low */
+                       gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
                        default-state = "on";
                };
 
-               green_backup_led {
+               green-backup-led {
                        label = "rn102:green:backup";
-                       gpios = <&gpio1 24 1>;   /* GPIO 56 Active Low */
+                       gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
                        default-state = "on";
                };
        };
 
-       gpio_keys {
+       gpio-keys {
                compatible = "gpio-keys";
-               #address-cells = <1>;
-               #size-cells = <0>;
+               pinctrl-0 = <&power_button_pin
+                            &reset_button_pin
+                            &backup_button_pin>;
+               pinctrl-names = "default";
 
-               button@1 {
+               power-button {
                        label = "Power Button";
-                       linux,code = <116>;     /* KEY_POWER */
-                       gpios = <&gpio1 30 0>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
                };
 
-               button@2 {
+               reset-button {
                        label = "Reset Button";
-                       linux,code = <0x198>;   /* KEY_RESTART */
-                       gpios = <&gpio0 6 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
                };
 
-               button@3 {
+               backup-button {
                        label = "Backup Button";
-                       linux,code = <133>;     /* KEY_COPY */
-                       gpios = <&gpio1 26 1>;
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio1 26 GPIO_ACTIVE_LOW>;
                };
        };
 
-       gpio_poweroff {
+       gpio-poweroff {
                compatible = "gpio-poweroff";
                pinctrl-0 = <&poweroff>;
                pinctrl-names = "default";
-               gpios = <&gpio0 8 1>;
+               gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
        };
-
 };
index b0b32f5fbeb473c6a44275db69e2b27928648a58..4e27587667bf5df680bb18af95f43633e90fced1 100644 (file)
@@ -11,6 +11,8 @@
 
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-370.dtsi"
 
 / {
                                        marvell,function = "gpio";
                                };
 
-                               backup_key_pin: backup-key-pin {
+                               backup_button_pin: backup-button-pin {
                                        marvell,pins = "mpp52";
                                        marvell,function = "gpio";
                                };
 
-                               power_key_pin: power-key-pin {
+                               power_button_pin: power-button-pin {
                                        marvell,pins = "mpp62";
                                        marvell,function = "gpio";
                                };
                                        marvell,function = "gpio";
                                };
 
-                               reset_key_pin: reset-key-pin {
+                               reset_button_pin: reset-button-pin {
                                        marvell,pins = "mpp65";
                                        marvell,function = "gpio";
                                };
                        };
 
                        mdio {
-                               phy0: ethernet-phy@0 {
+                               phy0: ethernet-phy@0 { /* Marvell 88E1318 */
                                        reg = <0>;
                                };
 
-                               phy1: ethernet-phy@1 {
+                               phy1: ethernet-phy@1 { /* Marvell 88E1318 */
                                        reg = <1>;
                                };
                        };
                                clock-frequency = <100000>;
                                status = "okay";
 
+                               isl12057: isl12057@68 {
+                                       compatible = "isl,isl12057";
+                                       reg = <0x68>;
+                               };
+
                                g762: g762@3e {
                                        compatible = "gmt,g762";
                                        reg = <0x3e>;
                                        fan_startv = <1>;
                                        pwm_polarity = <0>;
                                };
+
+                               pca9554: pca9554@23 {
+                                       compatible = "nxp,pca9554";
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       reg = <0x23>;
+                               };
+                       };
+
+                       nand@d0000 {
+                               status = "okay";
+                               num-cs = <1>;
+                               marvell,nand-keep-config;
+                               marvell,nand-enable-arbiter;
+                               nand-on-flash-bbt;
+
+                               partition@0 {
+                                       label = "u-boot";
+                                       reg = <0x0000000 0x180000>;  /* 1.5MB */
+                                       read-only;
+                               };
+
+                               partition@180000 {
+                                       label = "u-boot-env";
+                                       reg = <0x180000 0x20000>;    /* 128KB */
+                                       read-only;
+                               };
+
+                               partition@200000 {
+                                       label = "uImage";
+                                       reg = <0x0200000 0x600000>;    /* 6MB */
+                               };
+
+                               partition@800000 {
+                                       label = "minirootfs";
+                                       reg = <0x0800000 0x400000>;    /* 4MB */
+                               };
+
+                               /* Last MB is for the BBT, i.e. not writable */
+                               partition@c00000 {
+                                       label = "ubifs";
+                                       reg = <0x0c00000 0x7400000>; /* 116MB */
+                               };
                        };
                };
        };
 
        clocks {
-              #address-cells = <1>;
-              #size-cells = <0>;
-
-              g762_clk: fixedclk {
+              g762_clk: g762-oscillator {
                         compatible = "fixed-clock";
                         #clock-cells = <0>;
                         clock-frequency = <8192>;
               };
        };
 
-       gpio_leds {
+       gpio-leds {
                compatible = "gpio-leds";
                pinctrl-0 = <&backup_led_pin &power_led_pin>;
                pinctrl-names = "default";
 
-               blue_backup_led {
+               blue-backup-led {
                        label = "rn104:blue:backup";
-                       gpios = <&gpio1 31 0>;   /* GPIO 63 Active High */
+                       gpios = <&gpio1 31 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                };
 
-               blue_power_led {
+               blue-power-led {
                        label = "rn104:blue:pwr";
-                       gpios = <&gpio2 0 1>;    /* GPIO 64 Active Low */
+                       gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
                        linux,default-trigger = "keep";
                };
+
+               blue-sata1-led {
+                       label = "rn104:blue:sata1";
+                       gpios = <&pca9554 0 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+
+               blue-sata2-led {
+                       label = "rn104:blue:sata2";
+                       gpios = <&pca9554 1 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+
+               blue-sata3-led {
+                       label = "rn104:blue:sata3";
+                       gpios = <&pca9554 2 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+
+               blue-sata4-led {
+                       label = "rn104:blue:sata4";
+                       gpios = <&pca9554 3 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
        };
 
-       gpio_keys {
+       gpio-keys {
                compatible = "gpio-keys";
-               #address-cells = <1>;
-               #size-cells = <0>;
-               pinctrl-0 = <&backup_key_pin
-                            &power_key_pin
-                            &reset_key_pin>;
+               pinctrl-0 = <&backup_button_pin
+                            &power_button_pin
+                            &reset_button_pin>;
                pinctrl-names = "default";
 
-               button@1 {
+               backup-button {
                        label = "Backup Button";
-                       linux,code = <133>;     /* KEY_COPY */
-                       gpios = <&gpio1 20 1>;
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio1 20 GPIO_ACTIVE_LOW>;
                };
 
-               button@2 {
+               power-button {
                        label = "Power Button";
-                       linux,code = <116>;     /* KEY_POWER */
-                       gpios = <&gpio1 30 0>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
                };
 
-               button@3 {
+               reset-button {
                        label = "Reset Button";
-                       linux,code = <0x198>;   /* KEY_RESTART */
-                       gpios = <&gpio2 1 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
                };
        };
 
-       gpio_poweroff {
+       gpio-poweroff {
                compatible = "gpio-poweroff";
                pinctrl-0 = <&poweroff>;
                pinctrl-names = "default";
-               gpios = <&gpio1 28 1>;
+               gpios = <&gpio1 28 GPIO_ACTIVE_LOW>;
        };
 };
index f81810a596292ffa4494d5b50b34bdc974118ecf..abbb807459d26d6708ed01822702f43d79d362e5 100644 (file)
                                        gpios = <&gpio0 6 1>;
                                };
                        };
+
+                       nand@d0000 {
+                               status = "okay";
+                               num-cs = <1>;
+                               marvell,nand-keep-config;
+                               marvell,nand-enable-arbiter;
+                               nand-on-flash-bbt;
+
+                               partition@0 {
+                                       label = "U-Boot";
+                                       reg = <0 0x800000>;
+                               };
+                               partition@800000 {
+                                       label = "Linux";
+                                       reg = <0x800000 0x800000>;
+                               };
+                               partition@1000000 {
+                                       label = "Filesystem";
+                                       reg = <0x1000000 0x3f000000>;
+                               };
+                       };
                };
        };
  };
index 80ffacd128f828be3439ddc9b52f7139db6471e4..74b5964430ac3a7d833d8fce12eb655746acba4b 100644 (file)
                        #size-cells = <1>;
                        ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>;
 
-                       mbusc: mbus-controller@20000 {
-                               compatible = "marvell,mbus-controller";
-                               reg = <0x20000 0x100>, <0x20180 0x20>;
+                       rtc@10300 {
+                               compatible = "marvell,orion-rtc";
+                               reg = <0x10300 0x20>;
+                               interrupts = <50>;
                        };
 
-                       mpic: interrupt-controller@20000 {
-                               compatible = "marvell,mpic";
-                               #interrupt-cells = <1>;
-                               #size-cells = <1>;
-                               interrupt-controller;
-                               msi-controller;
+                       spi0: spi@10600 {
+                               compatible = "marvell,orion-spi";
+                               reg = <0x10600 0x28>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               cell-index = <0>;
+                               interrupts = <30>;
+                               clocks = <&coreclk 0>;
+                               status = "disabled";
                        };
 
-                       coherency-fabric@20200 {
-                               compatible = "marvell,coherency-fabric";
-                               reg = <0x20200 0xb0>, <0x21010 0x1c>;
+                       spi1: spi@10680 {
+                               compatible = "marvell,orion-spi";
+                               reg = <0x10680 0x28>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               cell-index = <1>;
+                               interrupts = <92>;
+                               clocks = <&coreclk 0>;
+                               status = "disabled";
+                       };
+
+                       i2c0: i2c@11000 {
+                               compatible = "marvell,mv64xxx-i2c";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               interrupts = <31>;
+                               timeout-ms = <1000>;
+                               clocks = <&coreclk 0>;
+                               status = "disabled";
+                       };
+
+                       i2c1: i2c@11100 {
+                               compatible = "marvell,mv64xxx-i2c";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               interrupts = <32>;
+                               timeout-ms = <1000>;
+                               clocks = <&coreclk 0>;
+                               status = "disabled";
                        };
 
                        serial@12000 {
                                clock-output-names = "nand";
                        };
 
+                       mbusc: mbus-controller@20000 {
+                               compatible = "marvell,mbus-controller";
+                               reg = <0x20000 0x100>, <0x20180 0x20>;
+                       };
+
+                       mpic: interrupt-controller@20000 {
+                               compatible = "marvell,mpic";
+                               #interrupt-cells = <1>;
+                               #size-cells = <1>;
+                               interrupt-controller;
+                               msi-controller;
+                       };
+
+                       coherency-fabric@20200 {
+                               compatible = "marvell,coherency-fabric";
+                               reg = <0x20200 0xb0>, <0x21010 0x1c>;
+                       };
+
                        timer@20300 {
                                reg = <0x20300 0x30>, <0x21040 0x30>;
                                interrupts = <37>, <38>, <39>, <40>, <5>, <6>;
                        };
 
-                       sata@a0000 {
-                               compatible = "marvell,armada-370-sata";
-                               reg = <0xa0000 0x5000>;
-                               interrupts = <55>;
-                               clocks = <&gateclk 15>, <&gateclk 30>;
-                               clock-names = "0", "1";
+                       usb@50000 {
+                               compatible = "marvell,orion-ehci";
+                               reg = <0x50000 0x500>;
+                               interrupts = <45>;
                                status = "disabled";
                        };
 
-                       mdio {
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               compatible = "marvell,orion-mdio";
-                               reg = <0x72004 0x4>;
+                       usb@51000 {
+                               compatible = "marvell,orion-ehci";
+                               reg = <0x51000 0x500>;
+                               interrupts = <46>;
+                               status = "disabled";
                        };
 
                        eth0: ethernet@70000 {
                                status = "disabled";
                        };
 
+                       mdio {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "marvell,orion-mdio";
+                               reg = <0x72004 0x4>;
+                       };
+
                        eth1: ethernet@74000 {
                                compatible = "marvell,armada-370-neta";
                                reg = <0x74000 0x4000>;
                                status = "disabled";
                        };
 
-                       i2c0: i2c@11000 {
-                               compatible = "marvell,mv64xxx-i2c";
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               interrupts = <31>;
-                               timeout-ms = <1000>;
-                               clocks = <&coreclk 0>;
+                       sata@a0000 {
+                               compatible = "marvell,armada-370-sata";
+                               reg = <0xa0000 0x5000>;
+                               interrupts = <55>;
+                               clocks = <&gateclk 15>, <&gateclk 30>;
+                               clock-names = "0", "1";
                                status = "disabled";
                        };
 
-                       i2c1: i2c@11100 {
-                               compatible = "marvell,mv64xxx-i2c";
+                       nand@d0000 {
+                               compatible = "marvell,armada370-nand";
+                               reg = <0xd0000 0x54>;
                                #address-cells = <1>;
-                               #size-cells = <0>;
-                               interrupts = <32>;
-                               timeout-ms = <1000>;
-                               clocks = <&coreclk 0>;
+                               #size-cells = <1>;
+                               interrupts = <113>;
+                               clocks = <&coredivclk 0>;
                                status = "disabled";
                        };
 
-                       rtc@10300 {
-                               compatible = "marvell,orion-rtc";
-                               reg = <0x10300 0x20>;
-                               interrupts = <50>;
-                       };
-
                        mvsdio@d4000 {
                                compatible = "marvell,orion-sdio";
                                reg = <0xd4000 0x200>;
                                cap-mmc-highspeed;
                                status = "disabled";
                        };
-
-                       usb@50000 {
-                               compatible = "marvell,orion-ehci";
-                               reg = <0x50000 0x500>;
-                               interrupts = <45>;
-                               status = "disabled";
-                       };
-
-                       usb@51000 {
-                               compatible = "marvell,orion-ehci";
-                               reg = <0x51000 0x500>;
-                               interrupts = <46>;
-                               status = "disabled";
-                       };
-
-                       spi0: spi@10600 {
-                               compatible = "marvell,orion-spi";
-                               reg = <0x10600 0x28>;
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               cell-index = <0>;
-                               interrupts = <30>;
-                               clocks = <&coreclk 0>;
-                               status = "disabled";
-                       };
-
-                       spi1: spi@10680 {
-                               compatible = "marvell,orion-spi";
-                               reg = <0x10680 0x28>;
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               cell-index = <1>;
-                               interrupts = <92>;
-                               clocks = <&coreclk 0>;
-                               status = "disabled";
-                       };
-
                };
        };
 
index 7a4b82e71aaf399eec2dc461656826e2fdad738a..0d8530c98cf5072f75662807f5cddcf2a40bee40 100644 (file)
                };
 
                internal-regs {
-                       system-controller@18200 {
-                               compatible = "marvell,armada-370-xp-system-controller";
-                               reg = <0x18200 0x100>;
-                       };
-
                        L2: l2-cache {
                                compatible = "marvell,aurora-outer-cache";
                                reg = <0x08000 0x1000>;
                                wt-override;
                        };
 
-                       interrupt-controller@20000 {
-                               reg = <0x20a00 0x1d0>, <0x21870 0x58>;
+                       i2c0: i2c@11000 {
+                               reg = <0x11000 0x20>;
+                       };
+
+                       i2c1: i2c@11100 {
+                               reg = <0x11100 0x20>;
+                       };
+
+                       system-controller@18200 {
+                               compatible = "marvell,armada-370-xp-system-controller";
+                               reg = <0x18200 0x100>;
                        };
 
                        pinctrl {
                                interrupts = <91>;
                        };
 
-                       timer@20300 {
-                               compatible = "marvell,armada-370-timer";
-                               clocks = <&coreclk 2>;
+                       gateclk: clock-gating-control@18220 {
+                               compatible = "marvell,armada-370-gating-clock";
+                               reg = <0x18220 0x4>;
+                               clocks = <&coreclk 0>;
+                               #clock-cells = <1>;
                        };
 
                        coreclk: mvebu-sar@18230 {
                                #clock-cells = <1>;
                        };
 
-                       gateclk: clock-gating-control@18220 {
-                               compatible = "marvell,armada-370-gating-clock";
-                               reg = <0x18220 0x4>;
+                       thermal@18300 {
+                               compatible = "marvell,armada370-thermal";
+                               reg = <0x18300 0x4
+                                       0x18304 0x4>;
+                               status = "okay";
+                       };
+
+                       interrupt-controller@20000 {
+                               reg = <0x20a00 0x1d0>, <0x21870 0x58>;
+                       };
+
+                       timer@20300 {
+                               compatible = "marvell,armada-370-timer";
+                               clocks = <&coreclk 2>;
+                       };
+
+                       usb@50000 {
+                               clocks = <&coreclk 0>;
+                       };
+
+                       usb@51000 {
                                clocks = <&coreclk 0>;
-                               #clock-cells = <1>;
                        };
 
                        xor@60800 {
                                        dmacap,memset;
                                };
                        };
-
-                       i2c0: i2c@11000 {
-                               reg = <0x11000 0x20>;
-                       };
-
-                       i2c1: i2c@11100 {
-                               reg = <0x11100 0x20>;
-                       };
-
-                       usb@50000 {
-                               clocks = <&coreclk 0>;
-                       };
-
-                       usb@51000 {
-                               clocks = <&coreclk 0>;
-                       };
-
-                       thermal@18300 {
-                               compatible = "marvell,armada370-thermal";
-                               reg = <0x18300 0x4
-                                       0x18304 0x4>;
-                               status = "okay";
-                       };
                };
        };
 };
index 2298e4a910e230748dda13cb70cab55713932a10..274e2ad5f51c67114b99786c0c4356971cdec492 100644 (file)
                                        spi-max-frequency = <108000000>;
                                };
                        };
+
+                       nand@d0000 {
+                               status = "okay";
+                               num-cs = <1>;
+                               marvell,nand-keep-config;
+                               marvell,nand-enable-arbiter;
+                               nand-on-flash-bbt;
+                       };
                };
        };
 };
diff --git a/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts b/arch/arm/boot/dts/armada-xp-netgear-rn2120.dts
new file mode 100644 (file)
index 0000000..ff049ee
--- /dev/null
@@ -0,0 +1,327 @@
+/*
+ * Device Tree file for NETGEAR ReadyNAS 2120
+ *
+ * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+#include "armada-xp-mv78230.dtsi"
+
+/ {
+       model = "NETGEAR ReadyNAS 2120";
+       compatible = "netgear,readynas-2120", "marvell,armadaxp-mv78230", "marvell,armadaxp", "marvell,armada-370-xp";
+
+       chosen {
+               bootargs = "console=ttyS0,115200 earlyprintk";
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0 0x00000000 0 0x80000000>; /* 2GB */
+       };
+
+       soc {
+               ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000
+                         MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000>;
+
+               pcie-controller {
+                       status = "okay";
+
+                       /* Connected to first Marvell 88SE9170 SATA controller */
+                       pcie@1,0 {
+                               /* Port 0, Lane 0 */
+                               status = "okay";
+                       };
+
+                       /* Connected to second Marvell 88SE9170 SATA controller */
+                       pcie@2,0 {
+                               /* Port 0, Lane 1 */
+                               status = "okay";
+                       };
+
+                       /* Connected to Fresco Logic FL1009 USB 3.0 controller */
+                       pcie@5,0 {
+                               /* Port 1, Lane 0 */
+                               status = "okay";
+                       };
+               };
+
+               internal-regs {
+                       pinctrl {
+                               poweroff: poweroff {
+                                       marvell,pins = "mpp42";
+                                       marvell,function = "gpio";
+                               };
+
+                               power_button_pin: power-button-pin {
+                                       marvell,pins = "mpp27";
+                                       marvell,function = "gpio";
+                               };
+
+                               reset_button_pin: reset-button-pin {
+                                       marvell,pins = "mpp41";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata1_led_pin: sata1-led-pin {
+                                       marvell,pins = "mpp31";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata2_led_pin: sata2-led-pin {
+                                       marvell,pins = "mpp40";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata3_led_pin: sata3-led-pin {
+                                       marvell,pins = "mpp44";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata4_led_pin: sata4-led-pin {
+                                       marvell,pins = "mpp47";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata1_power_pin: sata1-power-pin {
+                                       marvell,pins = "mpp24";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata2_power_pin: sata2-power-pin {
+                                       marvell,pins = "mpp25";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata3_power_pin: sata3-power-pin {
+                                       marvell,pins = "mpp26";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata4_power_pin: sata4-power-pin {
+                                       marvell,pins = "mpp28";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata1_pres_pin: sata1-pres-pin {
+                                       marvell,pins = "mpp32";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata2_pres_pin: sata2-pres-pin {
+                                       marvell,pins = "mpp33";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata3_pres_pin: sata3-pres-pin {
+                                       marvell,pins = "mpp34";
+                                       marvell,function = "gpio";
+                               };
+
+                               sata4_pres_pin: sata4-pres-pin {
+                                       marvell,pins = "mpp35";
+                                       marvell,function = "gpio";
+                               };
+
+                               err_led_pin: err-led-pin {
+                                       marvell,pins = "mpp45";
+                                       marvell,function = "gpio";
+                               };
+                       };
+
+                       serial@12000 {
+                               clocks = <&coreclk 0>;
+                               status = "okay";
+                       };
+
+                       mdio {
+                               phy0: ethernet-phy@0 { /* Marvell 88E1318 */
+                                       reg = <0>;
+                               };
+
+                               phy1: ethernet-phy@1 { /* Marvell 88E1318 */
+                                       reg = <1>;
+                               };
+                       };
+
+                       ethernet@70000 {
+                               status = "okay";
+                               phy = <&phy0>;
+                               phy-mode = "rgmii-id";
+                       };
+
+                       ethernet@74000 {
+                               status = "okay";
+                               phy = <&phy1>;
+                               phy-mode = "rgmii-id";
+                       };
+
+                       /* Front USB 2.0 port */
+                       usb@50000 {
+                               status = "okay";
+                       };
+
+                       i2c@11000 {
+                               compatible = "marvell,mv64xxx-i2c";
+                               clock-frequency = <400000>;
+                               status = "okay";
+
+                               isl12057: isl12057@68 {
+                                       compatible = "isl,isl12057";
+                                       reg = <0x68>;
+                               };
+
+                               /* Controller for rear fan #1 of 3 (Protechnic
+                                * MGT4012XB-O20, 8000RPM) near eSATA port */
+                               g762_fan1: g762@3e {
+                                       compatible = "gmt,g762";
+                                       reg = <0x3e>;
+                                       clocks = <&g762_clk>; /* input clock */
+                                       fan_gear_mode = <0>;
+                                       fan_startv = <1>;
+                                       pwm_polarity = <0>;
+                               };
+
+                               /*  Controller for rear (center) fan #2 of 3 */
+                               g762_fan2: g762@48 {
+                                       compatible = "gmt,g762";
+                                       reg = <0x48>;
+                                       clocks = <&g762_clk>; /* input clock */
+                                       fan_gear_mode = <0>;
+                                       fan_startv = <1>;
+                                       pwm_polarity = <0>;
+                               };
+
+                               /*  Controller for rear fan #3 of 3 */
+                               g762_fan3: g762@49 {
+                                       compatible = "gmt,g762";
+                                       reg = <0x49>;
+                                       clocks = <&g762_clk>; /* input clock */
+                                       fan_gear_mode = <0>;
+                                       fan_startv = <1>;
+                                       pwm_polarity = <0>;
+                               };
+
+                               /* Temperature sensor */
+                               g751: g751@4c {
+                                       compatible = "gmt,g751";
+                                       reg = <0x4c>;
+                               };
+                       };
+
+                       nand@d0000 {
+                               status = "okay";
+                               num-cs = <1>;
+                               marvell,nand-keep-config;
+                               marvell,nand-enable-arbiter;
+                               nand-on-flash-bbt;
+
+                               partition@0 {
+                                       label = "u-boot";
+                                       reg = <0x0000000 0x180000>;  /* 1.5MB */
+                                       read-only;
+                               };
+
+                               partition@180000 {
+                                       label = "u-boot-env";
+                                       reg = <0x180000 0x20000>;    /* 128KB */
+                                       read-only;
+                               };
+
+                               partition@200000 {
+                                       label = "uImage";
+                                       reg = <0x0200000 0x600000>;    /* 6MB */
+                               };
+
+                               partition@800000 {
+                                       label = "minirootfs";
+                                       reg = <0x0800000 0x400000>;    /* 4MB */
+                               };
+
+                               /* Last MB is for the BBT, i.e. not writable */
+                               partition@c00000 {
+                                       label = "ubifs";
+                                       reg = <0x0c00000 0x7400000>; /* 116MB */
+                               };
+                       };
+               };
+       };
+
+       clocks {
+              g762_clk: g762-oscillator {
+                        compatible = "fixed-clock";
+                        #clock-cells = <0>;
+                        clock-frequency = <32768>;
+              };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+               pinctrl-0 = <&sata1_led_pin &sata2_led_pin &err_led_pin
+                            &sata3_led_pin &sata4_led_pin>;
+               pinctrl-names = "default";
+
+               red-sata1-led {
+                       label = "rn2120:red:sata1";
+                       gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               red-sata2-led {
+                       label = "rn2120:red:sata2";
+                       gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               red-sata3-led {
+                       label = "rn2120:red:sata3";
+                       gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               red-sata4-led {
+                       label = "rn2120:red:sata4";
+                       gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
+                       default-state = "off";
+               };
+
+               red-err-led {
+                       label = "rn2120:red:err";
+                       gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               pinctrl-0 = <&power_button_pin &reset_button_pin>;
+               pinctrl-names = "default";
+
+               power-button {
+                       label = "Power Button";
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
+               };
+
+               reset-button {
+                       label = "Reset Button";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-poweroff {
+               compatible = "gpio-poweroff";
+               pinctrl-0 = <&poweroff>;
+               pinctrl-names = "default";
+               gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+       };
+};
index 5695afcc04bf1a7fa7fa13024acd8bb794464ed5..99bcf76e6953d3e0af3e72fe6372cdecdfbecb1f 100644 (file)
                                green_led {
                                        label = "green_led";
                                        gpios = <&gpio1 21 1>;
-                                       default-state = "off";
-                                       linux,default-trigger = "heartbeat";
+                                       default-state = "keep";
                                };
                        };
 
index 281c6447e87272c0df44f89da6489876b8c9ade8..b8b84a22f0f3971b7013862821ecb0e2cfc237aa 100644 (file)
                                wt-override;
                        };
 
-                       interrupt-controller@20000 {
-                             reg = <0x20a00 0x2d0>, <0x21070 0x58>;
+                       i2c0: i2c@11000 {
+                               compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
+                               reg = <0x11000 0x100>;
                        };
 
-                       armada-370-xp-pmsu@22000 {
-                               compatible = "marvell,armada-370-xp-pmsu";
-                               reg = <0x22100 0x430>, <0x20800 0x20>;
+                       i2c1: i2c@11100 {
+                               compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
+                               reg = <0x11100 0x100>;
                        };
 
                        serial@12200 {
                                status = "disabled";
                        };
 
-                       timer@20300 {
-                               compatible = "marvell,armada-xp-timer";
-                               clocks = <&coreclk 2>, <&refclk>;
-                               clock-names = "nbclk", "fixed";
+                       system-controller@18200 {
+                               compatible = "marvell,armada-370-xp-system-controller";
+                               reg = <0x18200 0x500>;
+                       };
+
+                       gateclk: clock-gating-control@18220 {
+                               compatible = "marvell,armada-xp-gating-clock";
+                               reg = <0x18220 0x4>;
+                               clocks = <&coreclk 0>;
+                               #clock-cells = <1>;
                        };
 
                        coreclk: mvebu-sar@18230 {
                                #clock-cells = <1>;
                        };
 
+                       thermal@182b0 {
+                               compatible = "marvell,armadaxp-thermal";
+                               reg = <0x182b0 0x4
+                                       0x184d0 0x4>;
+                               status = "okay";
+                       };
+
                        cpuclk: clock-complex@18700 {
                                #clock-cells = <1>;
                                compatible = "marvell,armada-xp-cpu-clock";
                                clocks = <&coreclk 1>;
                        };
 
-                       gateclk: clock-gating-control@18220 {
-                               compatible = "marvell,armada-xp-gating-clock";
-                               reg = <0x18220 0x4>;
-                               clocks = <&coreclk 0>;
-                               #clock-cells = <1>;
+                       interrupt-controller@20000 {
+                             reg = <0x20a00 0x2d0>, <0x21070 0x58>;
                        };
 
-                       system-controller@18200 {
-                               compatible = "marvell,armada-370-xp-system-controller";
-                               reg = <0x18200 0x500>;
+                       timer@20300 {
+                               compatible = "marvell,armada-xp-timer";
+                               clocks = <&coreclk 2>, <&refclk>;
+                               clock-names = "nbclk", "fixed";
+                       };
+
+                       armada-370-xp-pmsu@22000 {
+                               compatible = "marvell,armada-370-xp-pmsu";
+                               reg = <0x22100 0x400>, <0x20800 0x20>;
                        };
 
                        eth2: ethernet@30000 {
                                status = "disabled";
                        };
 
+                       usb@50000 {
+                               clocks = <&gateclk 18>;
+                       };
+
+                       usb@51000 {
+                               clocks = <&gateclk 19>;
+                       };
+
+                       usb@52000 {
+                               compatible = "marvell,orion-ehci";
+                               reg = <0x52000 0x500>;
+                               interrupts = <47>;
+                               clocks = <&gateclk 20>;
+                               status = "disabled";
+                       };
+
                        xor@60900 {
                                compatible = "marvell,orion-xor";
                                reg = <0x60900 0x100
                                        dmacap,memset;
                                };
                        };
-
-                       i2c0: i2c@11000 {
-                               compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
-                               reg = <0x11000 0x100>;
-                       };
-
-                       i2c1: i2c@11100 {
-                               compatible = "marvell,mv78230-i2c", "marvell,mv64xxx-i2c";
-                               reg = <0x11100 0x100>;
-                       };
-
-                       usb@50000 {
-                               clocks = <&gateclk 18>;
-                       };
-
-                       usb@51000 {
-                               clocks = <&gateclk 19>;
-                       };
-
-                       usb@52000 {
-                               compatible = "marvell,orion-ehci";
-                               reg = <0x52000 0x500>;
-                               interrupts = <47>;
-                               clocks = <&gateclk 20>;
-                               status = "disabled";
-                       };
-
-                       thermal@182b0 {
-                               compatible = "marvell,armadaxp-thermal";
-                               reg = <0x182b0 0x4
-                                       0x184d0 0x4>;
-                               status = "okay";
-                       };
                };
        };
 
diff --git a/arch/arm/boot/dts/armv7-m.dtsi b/arch/arm/boot/dts/armv7-m.dtsi
new file mode 100644 (file)
index 0000000..5a660d0
--- /dev/null
@@ -0,0 +1,18 @@
+#include "skeleton.dtsi"
+
+/ {
+       nvic: nv-interrupt-controller  {
+               compatible = "arm,armv7m-nvic";
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               reg = <0xe000e100 0xc00>;
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               interrupt-parent = <&nvic>;
+               ranges;
+       };
+};
diff --git a/arch/arm/boot/dts/at91-cosino.dtsi b/arch/arm/boot/dts/at91-cosino.dtsi
new file mode 100644 (file)
index 0000000..2093c4d
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * at91-cosino.dtsi - Device Tree file for Cosino core module
+ *
+ * Copyright (C) 2013 - Rodolfo Giometti <giometti@linux.it>
+ *                     HCE Engineering
+ *
+ * Derived from at91sam9x5ek.dtsi by:
+ *     Copyright (C) 2012 Atmel,
+ *     2012 Nicolas Ferre <nicolas.ferre@atmel.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+#include "at91sam9g35.dtsi"
+
+/ {
+       model = "HCE Cosino core module";
+       compatible = "hce,cosino", "atmel,at91sam9x5", "atmel,at91sam9";
+
+       chosen {
+               bootargs = "console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait";
+       };
+
+       memory {
+               reg = <0x20000000 0x8000000>;
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               main_clock: clock@0 {
+                       compatible = "atmel,osc", "fixed-clock";
+                       clock-frequency = <12000000>;
+               };
+       };
+
+       ahb {
+               apb {
+                       mmc0: mmc@f0008000 {
+                               pinctrl-0 = <
+                                       &pinctrl_board_mmc0
+                                       &pinctrl_mmc0_slot0_clk_cmd_dat0
+                                       &pinctrl_mmc0_slot0_dat1_3>;
+                               status = "okay";
+                               slot@0 {
+                                       reg = <0>;
+                                       bus-width = <4>;
+                                       cd-gpios = <&pioD 15 GPIO_ACTIVE_HIGH>;
+                               };
+                       };
+
+                       dbgu: serial@fffff200 {
+                               status = "okay";
+                       };
+
+                       usart0: serial@f801c000 {
+                               status = "okay";
+                       };
+
+                       i2c0: i2c@f8010000 {
+                               status = "okay";
+                       };
+
+                       adc0: adc@f804c000 {
+                               atmel,adc-clock-rate = <1000000>;
+                               atmel,adc-ts-wires = <4>;
+                               atmel,adc-ts-pressure-threshold = <10000>;
+                               status = "okay";
+                       };
+
+                       pinctrl@fffff400 {
+                               mmc0 {
+                                       pinctrl_board_mmc0: mmc0-board {
+                                               atmel,pins =
+                                                       <AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;  /* PD15 gpio CD pin pull up and deglitch */
+                                       };
+                               };
+                       };
+
+                       watchdog@fffffe40 {
+                               status = "okay";
+                       };
+               };
+
+               nand0: nand@40000000 {
+                       nand-bus-width = <8>;
+                       nand-ecc-mode = "hw";
+                       atmel,has-pmecc;        /* Enable PMECC */
+                       atmel,pmecc-cap = <4>;
+                       atmel,pmecc-sector-size = <512>;
+                       nand-on-flash-bbt;
+                       status = "okay";
+
+                       at91bootstrap@0 {
+                               label = "at91bootstrap";
+                               reg = <0x0 0x40000>;
+                       };
+
+                       uboot@40000 {
+                               label = "u-boot";
+                               reg = <0x40000 0x80000>;
+                       };
+
+                       ubootenv@c0000 {
+                               label = "U-Boot Env";
+                               reg = <0xc0000 0x140000>;
+                       };
+
+                       kernel@200000 {
+                               label = "kernel";
+                               reg = <0x200000 0x600000>;
+                       };
+
+                       rootfs@800000 {
+                               label = "rootfs";
+                               reg = <0x800000 0x0f800000>;
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/at91-cosino_mega2560.dts b/arch/arm/boot/dts/at91-cosino_mega2560.dts
new file mode 100644 (file)
index 0000000..f9415dd
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * at91-cosino_mega2560.dts - Device Tree file for Cosino board with
+ *                           Mega 2560 extension
+ *
+ * Copyright (C) 2013 - Rodolfo Giometti <giometti@linux.it>
+ *                     HCE Engineering
+ *
+ * Derived from at91sam9g35ek.dts by:
+ *     Copyright (C) 2012 Atmel,
+ *      2012 Nicolas Ferre <nicolas.ferre@atmel.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+/dts-v1/;
+#include "at91-cosino.dtsi"
+
+/ {
+       model = "HCE Cosino Mega 2560";
+       compatible = "hce,cosino_mega2560", "atmel,at91sam9x5", "atmel,at91sam9";
+
+       ahb {
+               apb {
+                       macb0: ethernet@f802c000 {
+                               phy-mode = "rmii";
+                               status = "okay";
+                       };
+
+                       adc0: adc@f804c000 {
+                               atmel,adc-clock-rate = <1000000>;
+                               atmel,adc-ts-wires = <4>;
+                               atmel,adc-ts-pressure-threshold = <10000>;
+                               status = "okay";
+                       };
+
+
+                       tsadcc: tsadcc@f804c000 {
+                               status = "okay";
+                       };
+
+                       rtc@fffffeb0 {
+                               status = "okay";
+                       };
+
+                       usart1: serial@f8020000 {
+                               status = "okay";
+                       };
+
+                       usart2: serial@f8024000 {
+                               status = "okay";
+                       };
+
+                       usb2: gadget@f803c000 {
+                               atmel,vbus-gpio = <&pioB 16 GPIO_ACTIVE_HIGH>;
+                               status = "okay";
+                       };
+
+                       mmc1: mmc@f000c000 {
+                               pinctrl-0 = <
+                                       &pinctrl_mmc1_slot0_clk_cmd_dat0
+                                       &pinctrl_mmc1_slot0_dat1_3>;
+                               status = "okay";
+                               slot@0 {
+                                       reg = <0>;
+                                       bus-width = <4>;
+                                       non-removable;
+                               };
+                       };
+               };
+
+               usb0: ohci@00600000 {
+                       status = "okay";
+                       num-ports = <3>;
+                       atmel,vbus-gpio = <0 /* &pioD 18 GPIO_ACTIVE_LOW */
+                                          &pioD 19 GPIO_ACTIVE_LOW
+                                          &pioD 20 GPIO_ACTIVE_LOW
+                                         >;
+               };
+
+               usb1: ehci@00700000 {
+                       status = "okay";
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/at91-qil_a9260.dts b/arch/arm/boot/dts/at91-qil_a9260.dts
new file mode 100644 (file)
index 0000000..5576ae8
--- /dev/null
@@ -0,0 +1,185 @@
+/*
+ * at91-qil_a9260.dts - Device Tree file for Calao QIL A9260 board
+ *
+ * Copyright (C) 2011-2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Licensed under GPLv2.
+ */
+/dts-v1/;
+#include "at91sam9260.dtsi"
+/ {
+       model = "Calao QIL A9260";
+       compatible = "calao,qil-a9260", "atmel,at91sam9260", "atmel,at91sam9";
+
+       chosen {
+               bootargs = "console=ttyS0,115200";
+       };
+
+       memory {
+               reg = <0x20000000 0x4000000>;
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               main_clock: clock@0 {
+                       compatible = "atmel,osc", "fixed-clock";
+                       clock-frequency = <12000000>;
+               };
+       };
+
+       ahb {
+               apb {
+                       usb1: gadget@fffa4000 {
+                               atmel,vbus-gpio = <&pioC 5 GPIO_ACTIVE_HIGH>;
+                               status = "okay";
+                       };
+
+                       mmc0: mmc@fffa8000 {
+                               pinctrl-0 = <
+                                       &pinctrl_mmc0_clk
+                                       &pinctrl_mmc0_slot0_cmd_dat0
+                                       &pinctrl_mmc0_slot0_dat1_3>;
+                               status = "okay";
+                               slot@0 {
+                                       reg = <0>;
+                                       bus-width = <4>;
+                               };
+                       };
+
+                       usart0: serial@fffb0000 {
+                               pinctrl-0 =
+                                       <&pinctrl_usart0
+                                        &pinctrl_usart0_rts
+                                        &pinctrl_usart0_cts
+                                        &pinctrl_usart0_dtr_dsr
+                                        &pinctrl_usart0_dcd
+                                        &pinctrl_usart0_ri>;
+                               status = "okay";
+                       };
+
+                       usart1: serial@fffb4000 {
+                               pinctrl-0 =
+                                       <&pinctrl_usart1
+                                        &pinctrl_usart1_rts
+                                        &pinctrl_usart1_cts>;
+                               status = "okay";
+                       };
+
+                       usart2: serial@fffb8000 {
+                               pinctrl-0 =
+                                       <&pinctrl_usart2
+                                        &pinctrl_usart2_rts
+                                        &pinctrl_usart2_cts>;
+                               status = "okay";
+                       };
+
+                       macb0: ethernet@fffc4000 {
+                               phy-mode = "rmii";
+                               status = "okay";
+                       };
+
+                       spi0: spi@fffc8000 {
+                               status = "okay";
+                               cs-gpios = <&pioA 3 GPIO_ACTIVE_HIGH>;
+
+                               m41t94@0 {
+                                       compatible = "st,m41t94";
+                                       reg = <0>;
+                                       spi-max-frequency = <1000000>;
+                               };
+
+                       };
+
+                       dbgu: serial@fffff200 {
+                               status = "okay";
+                       };
+
+                       shdwc@fffffd10 {
+                               atmel,wakeup-counter = <10>;
+                               atmel,wakeup-rtt-timer;
+                       };
+               };
+
+               usb0: ohci@00500000 {
+                       num-ports = <2>;
+                       status = "okay";
+               };
+
+               nand0: nand@40000000 {
+                       nand-bus-width = <8>;
+                       nand-ecc-mode = "soft";
+                       nand-on-flash-bbt;
+                       status = "okay";
+
+                       at91bootstrap@0 {
+                               label = "at91bootstrap";
+                               reg = <0x0 0x20000>;
+                       };
+
+                       barebox@20000 {
+                               label = "barebox";
+                               reg = <0x20000 0x40000>;
+                       };
+
+                       bareboxenv@60000 {
+                               label = "bareboxenv";
+                               reg = <0x60000 0x20000>;
+                       };
+
+                       bareboxenv2@80000 {
+                               label = "bareboxenv2";
+                               reg = <0x80000 0x20000>;
+                       };
+
+                       oftree@a0000 {
+                               label = "oftree";
+                               reg = <0xa0000 0x20000>;
+                       };
+
+                       kernel@c0000 {
+                               label = "kernel";
+                               reg = <0xc0000 0x400000>;
+                       };
+
+                       rootfs@4c0000 {
+                               label = "rootfs";
+                               reg = <0x4c0000 0x7800000>;
+                       };
+
+                       data@7cc0000 {
+                               label = "data";
+                               reg = <0x7cc0000 0x8340000>;
+                       };
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               user_led {
+                       label = "user_led";
+                       gpios = <&pioB 21 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       gpio_keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user_pb {
+                       label = "user_pb";
+                       gpios = <&pioB 10 GPIO_ACTIVE_LOW>;
+                       linux,code = <28>;
+                       gpio-key,wakeup;
+               };
+       };
+
+       i2c@0 {
+               status = "okay";
+       };
+};
index f77065506f1e63df9183ac1309a5788ed4714cb7..c61b16fba79babaa5c6e2a4dd4fb51b09e27d379 100644 (file)
                                                         AT91_PIOA 18 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA18 periph A */
                                        };
 
-                                       pinctrl_uart0_rts: uart0_rts-0 {
+                                       pinctrl_uart0_cts: uart0_cts-0 {
                                                atmel,pins =
                                                        <AT91_PIOA 20 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA20 periph A */
                                        };
 
-                                       pinctrl_uart0_cts: uart0_cts-0 {
+                                       pinctrl_uart0_rts: uart0_rts-0 {
                                                atmel,pins =
                                                        <AT91_PIOA 21 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA21 periph A */
                                        };
index d2d72c3b44c42bd45060dcc3b4566cb624c9b7f1..df6b0aa0e4ddd6388110a655c14b1ad889eb6bf0 100644 (file)
 
        ahb {
                apb {
-                       dbgu: serial@fffff200 {
+                       usb1: gadget@fffb0000 {
+                               atmel,vbus-gpio = <&pioD 4 GPIO_ACTIVE_HIGH>;
+                               atmel,pullup-gpio = <&pioD 5 GPIO_ACTIVE_HIGH>;
                                status = "okay";
                        };
 
+                       macb0: ethernet@fffbc000 {
+                               phy-mode = "rmii";
+                               status = "okay";
+
+                               phy0: ethernet-phy {
+                                       interrupt-parent = <&pioC>;
+                                       interrupts = <4 IRQ_TYPE_EDGE_BOTH>;
+                               };
+                       };
+
                        usart1: serial@fffc4000 {
                                pinctrl-0 =
                                                <&pinctrl_uart1
                                status = "okay";
                        };
 
-                       macb0: ethernet@fffbc000 {
-                               phy-mode = "rmii";
-                               status = "okay";
-                       };
-
-                       usb1: gadget@fffb0000 {
-                               atmel,vbus-gpio = <&pioD 4 GPIO_ACTIVE_HIGH>;
-                               status = "okay";
-                       };
-
                        spi0: spi@fffe0000 {
                                status = "okay";
                                cs-gpios = <&pioA 3 0>, <0>, <0>, <0>;
                                        reg = <0>;
                                };
                        };
+
+                       dbgu: serial@fffff200 {
+                               status = "okay";
+                       };
                };
 
                usb0: ohci@00300000 {
                        num-ports = <2>;
                        status = "okay";
                };
+
+               nor_flash@10000000 {
+                       compatible = "cfi-flash";
+                       reg = <0x10000000 0x800000>;
+                       linux,mtd-name = "physmap-flash.0";
+                       bank-width = <2>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       barebox@0 {
+                               label = "barebox";
+                               reg = <0x00000 0x40000>;
+                       };
+
+                       bareboxenv@40000 {
+                               label = "bareboxenv";
+                               reg = <0x40000 0x10000>;
+                       };
+
+                       kernel@50000 {
+                               label = "kernel";
+                               reg = <0x50000 0x300000>;
+                       };
+
+                       root@350000  {
+                               label = "root";
+                               reg = <0x350000 0x4B0000>;
+                       };
+               };
        };
 
        leds {
index d5bd65f7460258daa91bb4a5227071b2b67fc5de..c8fa9b9f07e34e0b38e089c5a5cbd9fab9c5507e 100644 (file)
@@ -30,6 +30,7 @@
                i2c0 = &i2c0;
                ssc0 = &ssc0;
                ssc1 = &ssc1;
+               pwm0 = &pwm0;
        };
        cpus {
                #address-cells = <0>;
                                        };
                                };
 
+                               fb {
+                                       pinctrl_fb: fb-0 {
+                                               atmel,pins =
+                                                       <AT91_PIOC 1 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PC1 periph A */
+                                                        AT91_PIOC 2 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PC2 periph A */
+                                                        AT91_PIOC 3 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PC3 periph A */
+                                                        AT91_PIOB 9 AT91_PERIPH_B AT91_PINCTRL_NONE    /* PB9 periph B */
+                                                        AT91_PIOC 6 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PC6 periph A */
+                                                        AT91_PIOC 7 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PC7 periph A */
+                                                        AT91_PIOC 8 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PC8 periph A */
+                                                        AT91_PIOC 9 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PC9 periph A */
+                                                        AT91_PIOC 10 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PC10 periph A */
+                                                        AT91_PIOC 11 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PC11 periph A */
+                                                        AT91_PIOC 14 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PC14 periph A */
+                                                        AT91_PIOC 15 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PC15 periph A */
+                                                        AT91_PIOC 16 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PC16 periph A */
+                                                        AT91_PIOC 12 AT91_PERIPH_B AT91_PINCTRL_NONE   /* PC12 periph B */
+                                                        AT91_PIOC 18 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PC18 periph A */
+                                                        AT91_PIOC 19 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PC19 periph A */
+                                                        AT91_PIOC 22 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PC22 periph A */
+                                                        AT91_PIOC 23 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PC23 periph A */
+                                                        AT91_PIOC 24 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PC24 periph A */
+                                                        AT91_PIOC 17 AT91_PERIPH_B AT91_PINCTRL_NONE   /* PC17 periph B */
+                                                        AT91_PIOC 26 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PC26 periph A */
+                                                        AT91_PIOC 27 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC27 periph A */
+                                       };
+                               };
+
                                pioA: gpio@fffff200 {
                                        compatible = "atmel,at91rm9200-gpio";
                                        reg = <0xfffff200 0x200>;
                                pinctrl-0 = <&pinctrl_spi1>;
                                status = "disabled";
                        };
+
+                       pwm0: pwm@fffb8000 {
+                               compatible = "atmel,at91sam9rl-pwm";
+                               reg = <0xfffb8000 0x300>;
+                               interrupts = <20 IRQ_TYPE_LEVEL_HIGH 4>;
+                               #pwm-cells = <3>;
+                               status = "disabled";
+                       };
+               };
+
+               fb0: fb@0x00700000 {
+                       compatible = "atmel,at91sam9263-lcdc";
+                       reg = <0x00700000 0x1000>;
+                       interrupts = <26 IRQ_TYPE_LEVEL_HIGH 3>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&pinctrl_fb>;
+                       status = "disabled";
                };
 
                nand0: nand@40000000 {
index 70f835b55c0bd91bb07949bf309ca674264bc82e..15009c9f229328957221a7b536de9ce3c0e8e630 100644 (file)
                        };
                };
 
+               fb0: fb@0x00700000 {
+                       display = <&display0>;
+                       status = "okay";
+
+                       display0: display {
+                               bits-per-pixel = <16>;
+                               atmel,lcdcon-backlight;
+                               atmel,dmacon = <0x1>;
+                               atmel,lcdcon2 = <0x80008002>;
+                               atmel,guard-time = <1>;
+
+                               display-timings {
+                                       native-mode = <&timing0>;
+                                       timing0: timing0 {
+                                               clock-frequency = <4965000>;
+                                               hactive = <240>;
+                                               vactive = <320>;
+                                               hback-porch = <1>;
+                                               hfront-porch = <33>;
+                                               vback-porch = <1>;
+                                               vfront-porch = <0>;
+                                               hsync-len = <5>;
+                                               vsync-len = <1>;
+                                               hsync-active = <1>;
+                                               vsync-active = <1>;
+                                       };
+                               };
+                       };
+               };
+
                nand0: nand@40000000 {
                        nand-bus-width = <8>;
                        nand-ecc-mode = "soft";
index c3e514837074c1874412e88cb294fd4ec976a2ba..ef0857cb171c4aab25aac34b6bf9048e18f59d9b 100644 (file)
@@ -37,6 +37,7 @@
                i2c1 = &i2c1;
                ssc0 = &ssc0;
                ssc1 = &ssc1;
+               pwm0 = &pwm0;
        };
        cpus {
                #address-cells = <0>;
                                        };
                                };
 
+                               i2c0 {
+                                       pinctrl_i2c0: i2c0-0 {
+                                               atmel,pins =
+                                                       <AT91_PIOA 21 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PA21 periph A TWCK0 */
+                                                        AT91_PIOA 20 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA20 periph A TWD0 */
+                                       };
+                               };
+
+                               i2c1 {
+                                       pinctrl_i2c1: i2c1-0 {
+                                               atmel,pins =
+                                                       <AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PB11 periph A TWCK1 */
+                                                        AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB10 periph A TWD1 */
+                                       };
+                               };
+
                                usart0 {
                                        pinctrl_usart0: usart0-0 {
                                                atmel,pins =
                                        };
                                };
 
+                               fb {
+                                       pinctrl_fb: fb-0 {
+                                               atmel,pins =
+                                                       <AT91_PIOE 0 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PE0 periph A */
+                                                        AT91_PIOE 2 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PE2 periph A */
+                                                        AT91_PIOE 3 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PE3 periph A */
+                                                        AT91_PIOE 4 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PE4 periph A */
+                                                        AT91_PIOE 5 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PE5 periph A */
+                                                        AT91_PIOE 6 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PE6 periph A */
+                                                        AT91_PIOE 7 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PE7 periph A */
+                                                        AT91_PIOE 8 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PE8 periph A */
+                                                        AT91_PIOE 9 AT91_PERIPH_A AT91_PINCTRL_NONE    /* PE9 periph A */
+                                                        AT91_PIOE 10 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE10 periph A */
+                                                        AT91_PIOE 11 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE11 periph A */
+                                                        AT91_PIOE 12 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE12 periph A */
+                                                        AT91_PIOE 13 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE13 periph A */
+                                                        AT91_PIOE 14 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE14 periph A */
+                                                        AT91_PIOE 15 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE15 periph A */
+                                                        AT91_PIOE 16 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE16 periph A */
+                                                        AT91_PIOE 17 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE17 periph A */
+                                                        AT91_PIOE 18 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE18 periph A */
+                                                        AT91_PIOE 19 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE19 periph A */
+                                                        AT91_PIOE 20 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE20 periph A */
+                                                        AT91_PIOE 21 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE21 periph A */
+                                                        AT91_PIOE 22 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE22 periph A */
+                                                        AT91_PIOE 23 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE23 periph A */
+                                                        AT91_PIOE 24 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE24 periph A */
+                                                        AT91_PIOE 25 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE25 periph A */
+                                                        AT91_PIOE 26 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE26 periph A */
+                                                        AT91_PIOE 27 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE27 periph A */
+                                                        AT91_PIOE 28 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE28 periph A */
+                                                        AT91_PIOE 29 AT91_PERIPH_A AT91_PINCTRL_NONE   /* PE29 periph A */
+                                                        AT91_PIOE 30 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PE30 periph A */
+                                       };
+                               };
+
                                pioA: gpio@fffff200 {
                                        compatible = "atmel,at91rm9200-gpio";
                                        reg = <0xfffff200 0x200>;
                                compatible = "atmel,at91sam9g10-i2c";
                                reg = <0xfff84000 0x100>;
                                interrupts = <12 IRQ_TYPE_LEVEL_HIGH 6>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_i2c0>;
                                #address-cells = <1>;
                                #size-cells = <0>;
                                status = "disabled";
                                compatible = "atmel,at91sam9g10-i2c";
                                reg = <0xfff88000 0x100>;
                                interrupts = <13 IRQ_TYPE_LEVEL_HIGH 6>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_i2c1>;
                                #address-cells = <1>;
                                #size-cells = <0>;
                                status = "disabled";
                                };
                        };
 
+                       pwm0: pwm@fffb8000 {
+                               compatible = "atmel,at91sam9rl-pwm";
+                               reg = <0xfffb8000 0x300>;
+                               interrupts = <19 IRQ_TYPE_LEVEL_HIGH 4>;
+                               #pwm-cells = <3>;
+                               status = "disabled";
+                       };
+
                        mmc0: mmc@fff80000 {
                                compatible = "atmel,hsmci";
                                reg = <0xfff80000 0x600>;
                                interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>;
+                               pinctrl-names = "default";
                                dmas = <&dma 1 AT91_DMA_CFG_PER_ID(0)>;
                                dma-names = "rxtx";
                                #address-cells = <1>;
                                compatible = "atmel,hsmci";
                                reg = <0xfffd0000 0x600>;
                                interrupts = <29 IRQ_TYPE_LEVEL_HIGH 0>;
+                               pinctrl-names = "default";
                                dmas = <&dma 1 AT91_DMA_CFG_PER_ID(13)>;
                                dma-names = "rxtx";
                                #address-cells = <1>;
                        };
                };
 
+               fb0: fb@0x00500000 {
+                       compatible = "atmel,at91sam9g45-lcdc";
+                       reg = <0x00500000 0x1000>;
+                       interrupts = <23 IRQ_TYPE_LEVEL_HIGH 3>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&pinctrl_fb>;
+                       status = "disabled";
+               };
+
                nand0: nand@40000000 {
                        compatible = "atmel,at91rm9200-nand";
                        #address-cells = <1>;
index a4b00e5c61c09faca05f8e5b9e2604394982cba8..7ff665a8c7080b2634fd2095e9b24fb550044a4b 100644 (file)
                                                         AT91_PIOD 29 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;   /* PD29 gpio WP pin pull up */
                                        };
                                };
+
+                               pwm0 {
+                                       pinctrl_pwm_leds: pwm-led {
+                                               atmel,pins =
+                                                       <AT91_PIOD 0  AT91_PERIPH_B AT91_PINCTRL_PULL_UP        /* PD0 periph B */
+                                                        AT91_PIOD 31 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>;      /* PD31 periph B */
+                                       };
+                               };
                        };
 
                        spi0: spi@fffa4000{
                                atmel,vbus-gpio = <&pioB 19 GPIO_ACTIVE_HIGH>;
                                status = "okay";
                        };
+
+                       pwm0: pwm@fffb8000 {
+                               status = "okay";
+
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_pwm_leds>;
+                       };
+               };
+
+               fb0: fb@0x00500000 {
+                       display = <&display0>;
+                       status = "okay";
+
+                       display0: display {
+                               bits-per-pixel = <32>;
+                               atmel,lcdcon-backlight;
+                               atmel,dmacon = <0x1>;
+                               atmel,lcdcon2 = <0x80008002>;
+                               atmel,guard-time = <9>;
+                               atmel,lcd-wiring-mode = "RGB";
+
+                               display-timings {
+                                       native-mode = <&timing0>;
+                                       timing0: timing0 {
+                                               clock-frequency = <9000000>;
+                                               hactive = <480>;
+                                               vactive = <272>;
+                                               hback-porch = <1>;
+                                               hfront-porch = <1>;
+                                               vback-porch = <40>;
+                                               vfront-porch = <1>;
+                                               hsync-len = <45>;
+                                               vsync-len = <1>;
+                                       };
+                               };
+                       };
                };
 
                nand0: nand@40000000 {
                        gpios = <&pioD 30 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
                };
+       };
+
+       pwmleds {
+               compatible = "pwm-leds";
 
                d6 {
                        label = "d6";
-                       gpios = <&pioD 0 GPIO_ACTIVE_LOW>;
+                       pwms = <&pwm0 3 5000 0>;
+                       max-brightness = <255>;
                        linux,default-trigger = "nand-disk";
                };
 
                d7 {
                        label = "d7";
-                       gpios = <&pioD 31 GPIO_ACTIVE_LOW>;
+                       pwms = <&pwm0 1 5000 0>;
+                       max-brightness = <255>;
                        linux,default-trigger = "mmc0";
                };
        };
index 6224f9fe2f2b7205f32a3205ff78d0b31036ad09..7248270a3ea61525ac75f5f6a206ca6f3afd277f 100644 (file)
@@ -33,6 +33,7 @@
                i2c0 = &i2c0;
                i2c1 = &i2c1;
                ssc0 = &ssc0;
+               pwm0 = &pwm0;
        };
        cpus {
                #address-cells = <0>;
                                reg = <0xfffffe40 0x10>;
                                status = "disabled";
                        };
+
+                       pwm0: pwm@f8034000 {
+                               compatible = "atmel,at91sam9rl-pwm";
+                               reg = <0xf8034000 0x300>;
+                               interrupts = <18 IRQ_TYPE_LEVEL_HIGH 4>;
+                               #pwm-cells = <3>;
+                               status = "disabled";
+                       };
                };
 
                nand0: nand@40000000 {
index 40267a116c3c44438d7d915e10c9d119a4577540..6e5e9cfc3c4997f98af3b5608b743ddd97cd0d8d 100644 (file)
@@ -35,6 +35,7 @@
                i2c1 = &i2c1;
                i2c2 = &i2c2;
                ssc0 = &ssc0;
+               pwm0 = &pwm0;
        };
        cpus {
                #address-cells = <0>;
                                interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
                                status = "disabled";
                        };
+
+                       pwm0: pwm@f8034000 {
+                               compatible = "atmel,at91sam9rl-pwm";
+                               reg = <0xf8034000 0x300>;
+                               interrupts = <18 IRQ_TYPE_LEVEL_HIGH 4>;
+                               #pwm-cells = <3>;
+                               status = "disabled";
+                       };
                };
 
                nand0: nand@40000000 {
index 978bab4991dfb03a8a7ce96ea5f7c985ca47daae..f8674bcc4489f0ce09d5409711baddfbb7efae76 100644 (file)
                        timebase-frequency = <0>;
                        bus-frequency = <0>;
                        clock-frequency = <0>;
+                       clocks = <&clks 12>;
+                       operating-points = <
+                               /* kHz    uV */
+                               200000  1025000
+                               400000  1025000
+                               600000  1050000
+                               800000  1100000
+                       >;
+                       clock-latency = <150000>;
                };
        };
 
@@ -69,6 +78,7 @@
                        cphifbg@88030000 {
                                compatible = "sirf,prima2-cphifbg";
                                reg = <0x88030000 0x1000>;
+                               clocks = <&clks 42>;
                        };
                };
 
                                                 sirf,function = "usp1";
                                         };
                                 };
+                               usp1_uart_nostreamctrl_pins_a: usp1@1 {
+                                        usp1 {
+                                                sirf,pins = "usp1_uart_nostreamctrl_grp";
+                                                sirf,function = "usp1_uart_nostreamctrl";
+                                        };
+                                };
                                 usb0_upli_drvbus_pins_a: usb0_upli_drvbus@0 {
                                         usb0_upli_drvbus {
                                                 sirf,pins = "usb0_upli_drvbusgrp";
                                        reg = <0x56100000 0x100000>;
                                        interrupts = <38>;
                                        status = "disabled";
+                                       bus-width = <4>;
                                        clocks = <&clks 36>;
                                };
 
                                        reg = <0x56200000 0x100000>;
                                        interrupts = <23>;
                                        status = "disabled";
+                                       bus-width = <4>;
                                        clocks = <&clks 37>;
                                };
 
                                        reg = <0x56300000 0x100000>;
                                        interrupts = <23>;
                                        status = "disabled";
+                                       bus-width = <4>;
                                        clocks = <&clks 37>;
                                };
 
                                        reg = <0x56500000 0x100000>;
                                        interrupts = <39>;
                                        status = "disabled";
+                                       bus-width = <4>;
                                        clocks = <&clks 38>;
                                };
 
                                interrupts = <52 53 54>;
                        };
 
+                       minigpsrtc@2000 {
+                               compatible = "sirf,prima2-minigpsrtc";
+                               reg = <0x2000 0x1000>;
+                               interrupts = <54>;
+                       };
+
                        pwrc@3000 {
                                compatible = "sirf,prima2-pwrc";
                                reg = <0x3000 0x1000>;
index 6e9deb786a7d1e4d6a19ee5a1613da8dde882bc0..2a3b1c1313a0c474bed0c681fea43029ba8fe20d 100644 (file)
 
 &gpio {
        pinctrl-names = "default";
-       pinctrl-0 = <&alt0 &alt3>;
+       pinctrl-0 = <&gpioout &alt0 &alt3>;
+
+       gpioout: gpioout {
+               brcm,pins = <6>;
+               brcm,function = <1>; /* GPIO out */
+       };
 
        alt0: alt0 {
-               brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>;
+               brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>;
                brcm,function = <4>; /* alt0 */
        };
 
index aa537ed13f0a578ade79e74c62a56302f1d65437..b021c96d3ba18225660185b037b5a5e1d65f68d5 100644 (file)
                        clocks = <&clk_mmc>;
                        status = "disabled";
                };
+
+               usb {
+                       compatible = "brcm,bcm2835-usb";
+                       reg = <0x7e980000 0x10000>;
+                       interrupts = <1 9>;
+               };
        };
 
        clocks {
diff --git a/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts b/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
new file mode 100644 (file)
index 0000000..c72bfd4
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Device Tree file for Sony NSZ-GS7
+ *
+ * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+#include "berlin2.dtsi"
+
+/ {
+       model = "Sony NSZ-GS7";
+       compatible = "sony,nsz-gs7", "marvell,berlin2", "marvell,berlin";
+
+       chosen {
+               bootargs = "console=ttyS0,115200 earlyprintk";
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x40000000>; /* 1 GB */
+       };
+};
+
+&uart0 { status = "okay"; };
diff --git a/arch/arm/boot/dts/berlin2.dtsi b/arch/arm/boot/dts/berlin2.dtsi
new file mode 100644 (file)
index 0000000..56a1af2
--- /dev/null
@@ -0,0 +1,227 @@
+/*
+ * Device Tree Include file for Marvell Armada 1500 (Berlin BG2) SoC
+ *
+ * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ *  (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include "skeleton.dtsi"
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+       model = "Marvell Armada 1500 (BG2) SoC";
+       compatible = "marvell,berlin2", "marvell,berlin";
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       compatible = "marvell,pj4b";
+                       device_type = "cpu";
+                       next-level-cache = <&l2>;
+                       reg = <0>;
+               };
+
+               cpu@1 {
+                       compatible = "marvell,pj4b";
+                       device_type = "cpu";
+                       next-level-cache = <&l2>;
+                       reg = <1>;
+               };
+       };
+
+       clocks {
+               smclk: sysmgr-clock {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <25000000>;
+               };
+
+               cfgclk: cfg-clock {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <100000000>;
+               };
+
+               sysclk: system-clock {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <400000000>;
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               interrupt-parent = <&gic>;
+
+               ranges = <0 0xf7000000 0x1000000>;
+
+               l2: l2-cache-controller@ac0000 {
+                       compatible = "marvell,tauros3-cache", "arm,pl310-cache";
+                       reg = <0xac0000 0x1000>;
+                       cache-unified;
+                       cache-level = <2>;
+               };
+
+               gic: interrupt-controller@ad1000 {
+                       compatible = "arm,cortex-a9-gic";
+                       reg = <0xad1000 0x1000>, <0xad0100 0x0100>;
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
+               };
+
+               local-timer@ad0600 {
+                       compatible = "arm,cortex-a9-twd-timer";
+                       reg = <0xad0600 0x20>;
+                       interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&sysclk>;
+               };
+
+               apb@e80000 {
+                       compatible = "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       ranges = <0 0xe80000 0x10000>;
+                       interrupt-parent = <&aic>;
+
+                       timer0: timer@2c00 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c00 0x14>;
+                               interrupts = <8>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "okay";
+                       };
+
+                       timer1: timer@2c14 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c14 0x14>;
+                               interrupts = <9>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "okay";
+                       };
+
+                       timer2: timer@2c28 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c28 0x14>;
+                               interrupts = <10>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       timer3: timer@2c3c {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c3c 0x14>;
+                               interrupts = <11>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       timer4: timer@2c50 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c50 0x14>;
+                               interrupts = <12>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       timer5: timer@2c64 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c64 0x14>;
+                               interrupts = <13>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       timer6: timer@2c78 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c78 0x14>;
+                               interrupts = <14>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       timer7: timer@2c8c {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c8c 0x14>;
+                               interrupts = <15>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       aic: interrupt-controller@3000 {
+                               compatible = "snps,dw-apb-ictl";
+                               reg = <0x3000 0xc00>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                               interrupt-parent = <&gic>;
+                               interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+                       };
+               };
+
+               apb@fc0000 {
+                       compatible = "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       ranges = <0 0xfc0000 0x10000>;
+                       interrupt-parent = <&sic>;
+
+                       uart0: serial@9000 {
+                               compatible = "snps,dw-apb-uart";
+                               reg = <0x9000 0x100>;
+                               reg-shift = <2>;
+                               reg-io-width = <1>;
+                               interrupts = <8>;
+                               clocks = <&smclk>;
+                               status = "disabled";
+                       };
+
+                       uart1: serial@a000 {
+                               compatible = "snps,dw-apb-uart";
+                               reg = <0xa000 0x100>;
+                               reg-shift = <2>;
+                               reg-io-width = <1>;
+                               interrupts = <9>;
+                               clocks = <&smclk>;
+                               status = "disabled";
+                       };
+
+                       uart2: serial@b000 {
+                               compatible = "snps,dw-apb-uart";
+                               reg = <0xb000 0x100>;
+                               reg-shift = <2>;
+                               reg-io-width = <1>;
+                               interrupts = <10>;
+                               clocks = <&smclk>;
+                               status = "disabled";
+                       };
+
+                       sic: interrupt-controller@e000 {
+                               compatible = "snps,dw-apb-ictl";
+                               reg = <0xe000 0x400>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                               interrupt-parent = <&gic>;
+                               interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts
new file mode 100644 (file)
index 0000000..bcd81ff
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Device Tree file for Google Chromecast
+ *
+ * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+#include "berlin2cd.dtsi"
+
+/ {
+       model = "Google Chromecast";
+       compatible = "google,chromecast", "marvell,berlin2cd", "marvell,berlin";
+
+       chosen {
+               bootargs = "console=ttyS0,115200 earlyprintk";
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x20000000>; /* 512 MB */
+       };
+};
+
+&uart0 { status = "okay"; };
diff --git a/arch/arm/boot/dts/berlin2cd.dtsi b/arch/arm/boot/dts/berlin2cd.dtsi
new file mode 100644 (file)
index 0000000..094968c
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * Device Tree Include file for Marvell Armada 1500-mini (Berlin BG2CD) SoC
+ *
+ * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ *  (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include "skeleton.dtsi"
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+       model = "Marvell Armada 1500-mini (BG2CD) SoC";
+       compatible = "marvell,berlin2cd", "marvell,berlin";
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       compatible = "arm,cortex-a9";
+                       device_type = "cpu";
+                       next-level-cache = <&l2>;
+                       reg = <0>;
+               };
+       };
+
+       clocks {
+               smclk: sysmgr-clock {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <25000000>;
+               };
+
+               cfgclk: cfg-clock {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <75000000>;
+               };
+
+               sysclk: system-clock {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <300000000>;
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               interrupt-parent = <&gic>;
+
+               ranges = <0 0xf7000000 0x1000000>;
+
+               l2: l2-cache-controller@ac0000 {
+                       compatible = "arm,pl310-cache";
+                       reg = <0xac0000 0x1000>;
+                       cache-unified;
+                       cache-level = <2>;
+               };
+
+               gic: interrupt-controller@ad1000 {
+                       compatible = "arm,cortex-a9-gic";
+                       reg = <0xad1000 0x1000>, <0xad0100 0x0100>;
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
+               };
+
+               local-timer@ad0600 {
+                       compatible = "arm,cortex-a9-twd-timer";
+                       reg = <0xad0600 0x20>;
+                       interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&sysclk>;
+               };
+
+               apb@e80000 {
+                       compatible = "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       ranges = <0 0xe80000 0x10000>;
+                       interrupt-parent = <&aic>;
+
+                       timer0: timer@2c00 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c00 0x14>;
+                               interrupts = <8>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "okay";
+                       };
+
+                       timer1: timer@2c14 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c14 0x14>;
+                               interrupts = <9>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "okay";
+                       };
+
+                       timer2: timer@2c28 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c28 0x14>;
+                               interrupts = <10>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       timer3: timer@2c3c {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c3c 0x14>;
+                               interrupts = <11>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       timer4: timer@2c50 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c50 0x14>;
+                               interrupts = <12>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       timer5: timer@2c64 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c64 0x14>;
+                               interrupts = <13>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       timer6: timer@2c78 {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c78 0x14>;
+                               interrupts = <14>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       timer7: timer@2c8c {
+                               compatible = "snps,dw-apb-timer";
+                               reg = <0x2c8c 0x14>;
+                               interrupts = <15>;
+                               clocks = <&cfgclk>;
+                               clock-names = "timer";
+                               status = "disabled";
+                       };
+
+                       aic: interrupt-controller@3000 {
+                               compatible = "snps,dw-apb-ictl";
+                               reg = <0x3000 0xc00>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                               interrupt-parent = <&gic>;
+                               interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+                       };
+               };
+
+               apb@fc0000 {
+                       compatible = "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       ranges = <0 0xfc0000 0x10000>;
+                       interrupt-parent = <&sic>;
+
+                       uart0: serial@9000 {
+                               compatible = "snps,dw-apb-uart";
+                               reg = <0x9000 0x100>;
+                               reg-shift = <2>;
+                               reg-io-width = <1>;
+                               interrupts = <8>;
+                               clocks = <&smclk>;
+                               status = "disabled";
+                       };
+
+                       uart1: serial@a000 {
+                               compatible = "snps,dw-apb-uart";
+                               reg = <0xa000 0x100>;
+                               reg-shift = <2>;
+                               reg-io-width = <1>;
+                               interrupts = <9>;
+                               clocks = <&smclk>;
+                               status = "disabled";
+                       };
+
+                       sic: interrupt-controller@e000 {
+                               compatible = "snps,dw-apb-ictl";
+                               reg = <0xe000 0x400>;
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                               interrupt-parent = <&gic>;
+                               interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/cros5250-common.dtsi b/arch/arm/boot/dts/cros5250-common.dtsi
deleted file mode 100644 (file)
index 9b186ac..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Common device tree include for all Exynos 5250 boards based off of Daisy.
- *
- * Copyright (c) 2012 Google, Inc
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-/ {
-       aliases {
-       };
-
-       memory {
-               reg = <0x40000000 0x80000000>;
-       };
-
-       chosen {
-       };
-
-       pinctrl@11400000 {
-               /*
-                * Disabled pullups since external part has its own pullups and
-                * double-pulling gets us out of spec in some cases.
-                */
-               i2c2_bus: i2c2-bus {
-                       samsung,pin-pud = <0>;
-               };
-
-               max77686_irq: max77686-irq {
-                       samsung,pins = "gpx3-2";
-                       samsung,pin-function = <0>;
-                       samsung,pin-pud = <0>;
-                       samsung,pin-drv = <0>;
-               };
-       };
-
-       i2c@12C60000 {
-               samsung,i2c-sda-delay = <100>;
-               samsung,i2c-max-bus-freq = <378000>;
-
-               max77686@09 {
-                       compatible = "maxim,max77686";
-                       interrupt-parent = <&gpx3>;
-                       interrupts = <2 0>;
-                       pinctrl-names = "default";
-                       pinctrl-0 = <&max77686_irq>;
-                       wakeup-source;
-                       reg = <0x09>;
-
-                       voltage-regulators {
-                               ldo1_reg: LDO1 {
-                                       regulator-name = "P1.0V_LDO_OUT1";
-                                       regulator-min-microvolt = <1000000>;
-                                       regulator-max-microvolt = <1000000>;
-                                       regulator-always-on;
-                               };
-
-                               ldo2_reg: LDO2 {
-                                       regulator-name = "P1.8V_LDO_OUT2";
-                                       regulator-min-microvolt = <1800000>;
-                                       regulator-max-microvolt = <1800000>;
-                                       regulator-always-on;
-                               };
-
-                               ldo3_reg: LDO3 {
-                                       regulator-name = "P1.8V_LDO_OUT3";
-                                       regulator-min-microvolt = <1800000>;
-                                       regulator-max-microvolt = <1800000>;
-                                       regulator-always-on;
-                               };
-
-                               ldo7_reg: LDO7 {
-                                       regulator-name = "P1.1V_LDO_OUT7";
-                                       regulator-min-microvolt = <1100000>;
-                                       regulator-max-microvolt = <1100000>;
-                                       regulator-always-on;
-                               };
-
-                               ldo8_reg: LDO8 {
-                                       regulator-name = "P1.0V_LDO_OUT8";
-                                       regulator-min-microvolt = <1000000>;
-                                       regulator-max-microvolt = <1000000>;
-                                       regulator-always-on;
-                               };
-
-                               ldo10_reg: LDO10 {
-                                       regulator-name = "P1.8V_LDO_OUT10";
-                                       regulator-min-microvolt = <1800000>;
-                                       regulator-max-microvolt = <1800000>;
-                                       regulator-always-on;
-                               };
-
-                               ldo12_reg: LDO12 {
-                                       regulator-name = "P3.0V_LDO_OUT12";
-                                       regulator-min-microvolt = <3000000>;
-                                       regulator-max-microvolt = <3000000>;
-                                       regulator-always-on;
-                               };
-
-                               ldo14_reg: LDO14 {
-                                       regulator-name = "P1.8V_LDO_OUT14";
-                                       regulator-min-microvolt = <1800000>;
-                                       regulator-max-microvolt = <1800000>;
-                                       regulator-always-on;
-                               };
-
-                               ldo15_reg: LDO15 {
-                                       regulator-name = "P1.0V_LDO_OUT15";
-                                       regulator-min-microvolt = <1000000>;
-                                       regulator-max-microvolt = <1000000>;
-                                       regulator-always-on;
-                               };
-
-                               ldo16_reg: LDO16 {
-                                       regulator-name = "P1.8V_LDO_OUT16";
-                                       regulator-min-microvolt = <1800000>;
-                                       regulator-max-microvolt = <1800000>;
-                                       regulator-always-on;
-                               };
-
-                               buck1_reg: BUCK1 {
-                                       regulator-name = "vdd_mif";
-                                       regulator-min-microvolt = <950000>;
-                                       regulator-max-microvolt = <1300000>;
-                                       regulator-always-on;
-                                       regulator-boot-on;
-                               };
-
-                               buck2_reg: BUCK2 {
-                                       regulator-name = "vdd_arm";
-                                       regulator-min-microvolt = <850000>;
-                                       regulator-max-microvolt = <1350000>;
-                                       regulator-always-on;
-                                       regulator-boot-on;
-                               };
-
-                               buck3_reg: BUCK3 {
-                                       regulator-name = "vdd_int";
-                                       regulator-min-microvolt = <900000>;
-                                       regulator-max-microvolt = <1200000>;
-                                       regulator-always-on;
-                                       regulator-boot-on;
-                               };
-
-                               buck4_reg: BUCK4 {
-                                       regulator-name = "vdd_g3d";
-                                       regulator-min-microvolt = <850000>;
-                                       regulator-max-microvolt = <1300000>;
-                                       regulator-always-on;
-                                       regulator-boot-on;
-                               };
-
-                               buck5_reg: BUCK5 {
-                                       regulator-name = "P1.8V_BUCK_OUT5";
-                                       regulator-min-microvolt = <1800000>;
-                                       regulator-max-microvolt = <1800000>;
-                                       regulator-always-on;
-                                       regulator-boot-on;
-                               };
-
-                               buck6_reg: BUCK6 {
-                                       regulator-name = "P1.35V_BUCK_OUT6";
-                                       regulator-min-microvolt = <1350000>;
-                                       regulator-max-microvolt = <1350000>;
-                                       regulator-always-on;
-                               };
-
-                               buck7_reg: BUCK7 {
-                                       regulator-name = "P2.0V_BUCK_OUT7";
-                                       regulator-min-microvolt = <2000000>;
-                                       regulator-max-microvolt = <2000000>;
-                                       regulator-always-on;
-                               };
-
-                               buck8_reg: BUCK8 {
-                                       regulator-name = "P2.85V_BUCK_OUT8";
-                                       regulator-min-microvolt = <2850000>;
-                                       regulator-max-microvolt = <2850000>;
-                                       regulator-always-on;
-                               };
-                       };
-               };
-       };
-
-       i2c@12C70000 {
-               samsung,i2c-sda-delay = <100>;
-               samsung,i2c-max-bus-freq = <378000>;
-
-               trackpad {
-                       reg = <0x67>;
-                       compatible = "cypress,cyapa";
-                       interrupts = <2 0>;
-                       interrupt-parent = <&gpx1>;
-                       wakeup-source;
-               };
-       };
-
-       i2c@12C80000 {
-               samsung,i2c-sda-delay = <100>;
-               samsung,i2c-max-bus-freq = <66000>;
-
-               hdmiddc@50 {
-                       compatible = "samsung,exynos4210-hdmiddc";
-                       reg = <0x50>;
-               };
-       };
-
-       i2c@12C90000 {
-               samsung,i2c-sda-delay = <100>;
-               samsung,i2c-max-bus-freq = <66000>;
-       };
-
-       i2c@12CA0000 {
-               samsung,i2c-sda-delay = <100>;
-               samsung,i2c-max-bus-freq = <66000>;
-       };
-
-       i2c@12CB0000 {
-               samsung,i2c-sda-delay = <100>;
-               samsung,i2c-max-bus-freq = <66000>;
-       };
-
-       i2c@12CC0000 {
-               status = "disabled";
-       };
-
-       i2c@12CD0000 {
-               samsung,i2c-sda-delay = <100>;
-               samsung,i2c-max-bus-freq = <66000>;
-       };
-
-       i2c@12CE0000 {
-               samsung,i2c-sda-delay = <100>;
-               samsung,i2c-max-bus-freq = <378000>;
-
-               hdmiphy@38 {
-                       compatible = "samsung,exynos4212-hdmiphy";
-                       reg = <0x38>;
-               };
-       };
-
-       dwmmc0@12200000 {
-               num-slots = <1>;
-               supports-highspeed;
-               broken-cd;
-               fifo-depth = <0x80>;
-               card-detect-delay = <200>;
-               samsung,dw-mshc-ciu-div = <3>;
-               samsung,dw-mshc-sdr-timing = <2 3>;
-               samsung,dw-mshc-ddr-timing = <1 2>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus4 &sd0_bus8>;
-
-               slot@0 {
-                       reg = <0>;
-                       bus-width = <8>;
-               };
-       };
-
-       dwmmc1@12210000 {
-               status = "disabled";
-       };
-
-       dwmmc2@12220000 {
-               num-slots = <1>;
-               supports-highspeed;
-               fifo-depth = <0x80>;
-               card-detect-delay = <200>;
-               samsung,dw-mshc-ciu-div = <3>;
-               samsung,dw-mshc-sdr-timing = <2 3>;
-               samsung,dw-mshc-ddr-timing = <1 2>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
-
-               slot@0 {
-                       reg = <0>;
-                       bus-width = <4>;
-                       wp-gpios = <&gpc2 1 0>;
-               };
-       };
-
-       dwmmc3@12230000 {
-               num-slots = <1>;
-               supports-highspeed;
-               broken-cd;
-               fifo-depth = <0x80>;
-               card-detect-delay = <200>;
-               samsung,dw-mshc-ciu-div = <3>;
-               samsung,dw-mshc-sdr-timing = <2 3>;
-               samsung,dw-mshc-ddr-timing = <1 2>;
-               /* See board-specific dts files for pin setup */
-
-               slot@0 {
-                       reg = <0>;
-                       bus-width = <4>;
-               };
-       };
-
-       spi_0: spi@12d20000 {
-               status = "disabled";
-       };
-
-       spi_1: spi@12d30000 {
-               samsung,spi-src-clk = <0>;
-               num-cs = <1>;
-       };
-
-       spi_2: spi@12d40000 {
-               status = "disabled";
-       };
-
-       hdmi {
-               hpd-gpio = <&gpx3 7 0>;
-       };
-
-       gpio-keys {
-               compatible = "gpio-keys";
-
-               power {
-                       label = "Power";
-                       gpios = <&gpx1 3 1>;
-                       linux,code = <116>; /* KEY_POWER */
-                       gpio-key,wakeup;
-               };
-       };
-};
index 588ce58a2959f0215b3a6c2b16c0c2b6a502b625..1e11e5a5f7231e58a2f19ed13d1ded0d21ffe3db 100644 (file)
                        pinctrl-names = "default";
                        pinctrl-0 = <&mii_pins>;
                };
+               gpio: gpio@1e26000 {
+                       status = "okay";
+               };
        };
        nand_cs3@62000000 {
                status = "okay";
index 8d17346f9702173184da0b61d217f91fc6a1fff1..b695548dbb4e7e7ebae851b53bfc747dfbd05ec8 100644 (file)
@@ -8,6 +8,7 @@
  * option) any later version.
  */
 #include "skeleton.dtsi"
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        arm {
                                        36
                                        >;
                };
+               gpio: gpio@1e26000 {
+                       compatible = "ti,dm6441-gpio";
+                       gpio-controller;
+                       reg = <0x226000 0x1000>;
+                       interrupts = <42 IRQ_TYPE_EDGE_BOTH
+                               43 IRQ_TYPE_EDGE_BOTH 44 IRQ_TYPE_EDGE_BOTH
+                               45 IRQ_TYPE_EDGE_BOTH 46 IRQ_TYPE_EDGE_BOTH
+                               47 IRQ_TYPE_EDGE_BOTH 48 IRQ_TYPE_EDGE_BOTH
+                               49 IRQ_TYPE_EDGE_BOTH 50 IRQ_TYPE_EDGE_BOTH>;
+                       ti,ngpio = <144>;
+                       ti,davinci-gpio-unbanked = <0>;
+                       status = "disabled";
+               };
        };
        nand_cs3@62000000 {
                compatible = "ti,davinci-nand";
index 8349a248eceaf242f8a079e6c565af109ee69708..7a70f4ca502a1665fa21cb31360d2869cbd3617c 100644 (file)
@@ -23,7 +23,7 @@
                power {
                        label = "Power";
                        gpios = <&gpio0 18 1>;
-                       linux,default-trigger = "default-on";
+                       default-state = "keep";
                };
        };
 
index 113a8bc7bee73649a33cc3e212336536f47399b3..8de1031233ae578dc45f6e9db8f78b1d951f085a 100644 (file)
                                  0xffffe000 MBUS_ID(0x03, 0x01) 0 0x0000800   /* CESA SRAM  2k */
                                  0xfffff000 MBUS_ID(0x0d, 0x00) 0 0x0000800>; /* PMU  SRAM  2k */
 
-                       mbusc: mbus-ctrl@20000 {
-                               compatible = "marvell,mbus-controller";
-                               reg = <0x20000 0x80>, <0x800100 0x8>;
-                       };
-
-                       timer: timer@20300 {
-                               compatible = "marvell,orion-timer";
-                               reg = <0x20300 0x20>;
-                               interrupt-parent = <&bridge_intc>;
-                               interrupts = <1>, <2>;
+                       spi0: spi-ctrl@10600 {
+                               compatible = "marvell,orion-spi";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               cell-index = <0>;
+                               interrupts = <6>;
+                               reg = <0x10600 0x28>;
                                clocks = <&core_clk 0>;
+                               pinctrl-0 = <&pmx_spi0>;
+                               pinctrl-names = "default";
+                               status = "disabled";
                        };
 
-                       intc: main-interrupt-ctrl@20200 {
-                               compatible = "marvell,orion-intc";
-                               interrupt-controller;
-                               #interrupt-cells = <1>;
-                               reg = <0x20200 0x10>, <0x20210 0x10>;
-                       };
-
-                       bridge_intc: bridge-interrupt-ctrl@20110 {
-                               compatible = "marvell,orion-bridge-intc";
-                               interrupt-controller;
-                               #interrupt-cells = <1>;
-                               reg = <0x20110 0x8>;
-                               interrupts = <0>;
-                               marvell,#interrupts = <5>;
-                       };
-
-                       core_clk: core-clocks@d0214 {
-                               compatible = "marvell,dove-core-clock";
-                               reg = <0xd0214 0x4>;
-                               #clock-cells = <1>;
-                       };
-
-                       gate_clk: clock-gating-ctrl@d0038 {
-                               compatible = "marvell,dove-gating-clock";
-                               reg = <0xd0038 0x4>;
+                       i2c0: i2c-ctrl@11000 {
+                               compatible = "marvell,mv64xxx-i2c";
+                               reg = <0x11000 0x20>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               interrupts = <11>;
+                               clock-frequency = <400000>;
+                               timeout-ms = <1000>;
                                clocks = <&core_clk 0>;
-                               #clock-cells = <1>;
-                       };
-
-                       thermal: thermal-diode@d001c {
-                               compatible = "marvell,dove-thermal";
-                               reg = <0xd001c 0x0c>, <0xd005c 0x08>;
+                               status = "disabled";
                        };
 
                        uart0: serial@12000 {
                                status = "disabled";
                        };
 
-                       gpio0: gpio-ctrl@d0400 {
-                               compatible = "marvell,orion-gpio";
-                               #gpio-cells = <2>;
-                               gpio-controller;
-                               reg = <0xd0400 0x20>;
-                               ngpios = <32>;
+                       spi1: spi-ctrl@14600 {
+                               compatible = "marvell,orion-spi";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               cell-index = <1>;
+                               interrupts = <5>;
+                               reg = <0x14600 0x28>;
+                               clocks = <&core_clk 0>;
+                               status = "disabled";
+                       };
+
+                       mbusc: mbus-ctrl@20000 {
+                               compatible = "marvell,mbus-controller";
+                               reg = <0x20000 0x80>, <0x800100 0x8>;
+                       };
+
+                       bridge_intc: bridge-interrupt-ctrl@20110 {
+                               compatible = "marvell,orion-bridge-intc";
                                interrupt-controller;
-                               #interrupt-cells = <2>;
-                               interrupts = <12>, <13>, <14>, <60>;
+                               #interrupt-cells = <1>;
+                               reg = <0x20110 0x8>;
+                               interrupts = <0>;
+                               marvell,#interrupts = <5>;
                        };
 
-                       gpio1: gpio-ctrl@d0420 {
-                               compatible = "marvell,orion-gpio";
-                               #gpio-cells = <2>;
-                               gpio-controller;
-                               reg = <0xd0420 0x20>;
-                               ngpios = <32>;
+                       intc: main-interrupt-ctrl@20200 {
+                               compatible = "marvell,orion-intc";
                                interrupt-controller;
-                               #interrupt-cells = <2>;
-                               interrupts = <61>;
+                               #interrupt-cells = <1>;
+                               reg = <0x20200 0x10>, <0x20210 0x10>;
                        };
 
-                       gpio2: gpio-ctrl@e8400 {
-                               compatible = "marvell,orion-gpio";
-                               #gpio-cells = <2>;
-                               gpio-controller;
-                               reg = <0xe8400 0x0c>;
-                               ngpios = <8>;
+                       timer: timer@20300 {
+                               compatible = "marvell,orion-timer";
+                               reg = <0x20300 0x20>;
+                               interrupt-parent = <&bridge_intc>;
+                               interrupts = <1>, <2>;
+                               clocks = <&core_clk 0>;
+                       };
+
+                       crypto: crypto-engine@30000 {
+                               compatible = "marvell,orion-crypto";
+                               reg = <0x30000 0x10000>,
+                                     <0xffffe000 0x800>;
+                               reg-names = "regs", "sram";
+                               interrupts = <31>;
+                               clocks = <&gate_clk 15>;
+                               status = "okay";
+                       };
+
+                       ehci0: usb-host@50000 {
+                               compatible = "marvell,orion-ehci";
+                               reg = <0x50000 0x1000>;
+                               interrupts = <24>;
+                               clocks = <&gate_clk 0>;
+                               status = "okay";
+                       };
+
+                       ehci1: usb-host@51000 {
+                               compatible = "marvell,orion-ehci";
+                               reg = <0x51000 0x1000>;
+                               interrupts = <25>;
+                               clocks = <&gate_clk 1>;
+                               status = "okay";
+                       };
+
+                       xor0: dma-engine@60800 {
+                               compatible = "marvell,orion-xor";
+                               reg = <0x60800 0x100
+                                      0x60a00 0x100>;
+                               clocks = <&gate_clk 23>;
+                               status = "okay";
+
+                               channel0 {
+                                       interrupts = <39>;
+                                       dmacap,memcpy;
+                                       dmacap,xor;
+                               };
+
+                               channel1 {
+                                       interrupts = <40>;
+                                       dmacap,memcpy;
+                                       dmacap,xor;
+                               };
+                       };
+
+                       xor1: dma-engine@60900 {
+                               compatible = "marvell,orion-xor";
+                               reg = <0x60900 0x100
+                                      0x60b00 0x100>;
+                               clocks = <&gate_clk 24>;
+                               status = "okay";
+
+                               channel0 {
+                                       interrupts = <42>;
+                                       dmacap,memcpy;
+                                       dmacap,xor;
+                               };
+
+                               channel1 {
+                                       interrupts = <43>;
+                                       dmacap,memcpy;
+                                       dmacap,xor;
+                               };
+                       };
+
+                       sdio1: sdio-host@90000 {
+                               compatible = "marvell,dove-sdhci";
+                               reg = <0x90000 0x100>;
+                               interrupts = <36>, <38>;
+                               clocks = <&gate_clk 9>;
+                               pinctrl-0 = <&pmx_sdio1>;
+                               pinctrl-names = "default";
+                               status = "disabled";
+                       };
+
+                       eth: ethernet-ctrl@72000 {
+                               compatible = "marvell,orion-eth";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg = <0x72000 0x4000>;
+                               clocks = <&gate_clk 2>;
+                               marvell,tx-checksum-limit = <1600>;
+                               status = "disabled";
+
+                               ethernet-port@0 {
+                                       device_type = "network";
+                                       compatible = "marvell,orion-eth-port";
+                                       reg = <0>;
+                                       interrupts = <29>;
+                                       /* overwrite MAC address in bootloader */
+                                       local-mac-address = [00 00 00 00 00 00];
+                                       phy-handle = <&ethphy>;
+                               };
+                       };
+
+                       mdio: mdio-bus@72004 {
+                               compatible = "marvell,orion-mdio";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg = <0x72004 0x84>;
+                               interrupts = <30>;
+                               clocks = <&gate_clk 2>;
+                               status = "disabled";
+
+                               ethphy: ethernet-phy {
+                                       device_type = "ethernet-phy";
+                                       /* set phy address in board file */
+                               };
+                       };
+
+                       sdio0: sdio-host@92000 {
+                               compatible = "marvell,dove-sdhci";
+                               reg = <0x92000 0x100>;
+                               interrupts = <35>, <37>;
+                               clocks = <&gate_clk 8>;
+                               pinctrl-0 = <&pmx_sdio0>;
+                               pinctrl-names = "default";
+                               status = "disabled";
+                       };
+
+                       sata0: sata-host@a0000 {
+                               compatible = "marvell,orion-sata";
+                               reg = <0xa0000 0x2400>;
+                               interrupts = <62>;
+                               clocks = <&gate_clk 3>;
+                               phys = <&sata_phy0>;
+                               phy-names = "port0";
+                               nr-ports = <1>;
+                               status = "disabled";
+                       };
+
+                       sata_phy0: sata-phy@a2000 {
+                               compatible = "marvell,mvebu-sata-phy";
+                               reg = <0xa2000 0x0334>;
+                               clocks = <&gate_clk 3>;
+                               clock-names = "sata";
+                               #phy-cells = <0>;
+                               status = "ok";
+                       };
+
+                       audio0: audio-controller@b0000 {
+                               compatible = "marvell,dove-audio";
+                               reg = <0xb0000 0x2210>;
+                               interrupts = <19>, <20>;
+                               clocks = <&gate_clk 12>;
+                               clock-names = "internal";
+                               status = "disabled";
+                       };
+
+                       audio1: audio-controller@b4000 {
+                               compatible = "marvell,dove-audio";
+                               reg = <0xb4000 0x2210>;
+                               interrupts = <21>, <22>;
+                               clocks = <&gate_clk 13>;
+                               clock-names = "internal";
+                               status = "disabled";
+                       };
+
+                       thermal: thermal-diode@d001c {
+                               compatible = "marvell,dove-thermal";
+                               reg = <0xd001c 0x0c>, <0xd005c 0x08>;
+                       };
+
+                       gate_clk: clock-gating-ctrl@d0038 {
+                               compatible = "marvell,dove-gating-clock";
+                               reg = <0xd0038 0x4>;
+                               clocks = <&core_clk 0>;
+                               #clock-cells = <1>;
+                       };
+
+                       pmu_intc: pmu-interrupt-ctrl@d0050 {
+                               compatible = "marvell,dove-pmu-intc";
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                               reg = <0xd0050 0x8>;
+                               interrupts = <33>;
+                               marvell,#interrupts = <7>;
                        };
 
                        pinctrl: pin-ctrl@d0200 {
                                };
                        };
 
-                       spi0: spi-ctrl@10600 {
-                               compatible = "marvell,orion-spi";
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               cell-index = <0>;
-                               interrupts = <6>;
-                               reg = <0x10600 0x28>;
-                               clocks = <&core_clk 0>;
-                               pinctrl-0 = <&pmx_spi0>;
-                               pinctrl-names = "default";
-                               status = "disabled";
-                       };
-
-                       spi1: spi-ctrl@14600 {
-                               compatible = "marvell,orion-spi";
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               cell-index = <1>;
-                               interrupts = <5>;
-                               reg = <0x14600 0x28>;
-                               clocks = <&core_clk 0>;
-                               status = "disabled";
-                       };
-
-                       i2c0: i2c-ctrl@11000 {
-                               compatible = "marvell,mv64xxx-i2c";
-                               reg = <0x11000 0x20>;
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               interrupts = <11>;
-                               clock-frequency = <400000>;
-                               timeout-ms = <1000>;
-                               clocks = <&core_clk 0>;
-                               status = "disabled";
-                       };
-
-                       ehci0: usb-host@50000 {
-                               compatible = "marvell,orion-ehci";
-                               reg = <0x50000 0x1000>;
-                               interrupts = <24>;
-                               clocks = <&gate_clk 0>;
-                               status = "okay";
-                       };
-
-                       ehci1: usb-host@51000 {
-                               compatible = "marvell,orion-ehci";
-                               reg = <0x51000 0x1000>;
-                               interrupts = <25>;
-                               clocks = <&gate_clk 1>;
-                               status = "okay";
-                       };
-
-                       sdio0: sdio-host@92000 {
-                               compatible = "marvell,dove-sdhci";
-                               reg = <0x92000 0x100>;
-                               interrupts = <35>, <37>;
-                               clocks = <&gate_clk 8>;
-                               pinctrl-0 = <&pmx_sdio0>;
-                               pinctrl-names = "default";
-                               status = "disabled";
+                       core_clk: core-clocks@d0214 {
+                               compatible = "marvell,dove-core-clock";
+                               reg = <0xd0214 0x4>;
+                               #clock-cells = <1>;
                        };
 
-                       sdio1: sdio-host@90000 {
-                               compatible = "marvell,dove-sdhci";
-                               reg = <0x90000 0x100>;
-                               interrupts = <36>, <38>;
-                               clocks = <&gate_clk 9>;
-                               pinctrl-0 = <&pmx_sdio1>;
-                               pinctrl-names = "default";
-                               status = "disabled";
+                       gpio0: gpio-ctrl@d0400 {
+                               compatible = "marvell,orion-gpio";
+                               #gpio-cells = <2>;
+                               gpio-controller;
+                               reg = <0xd0400 0x20>;
+                               ngpios = <32>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               interrupts = <12>, <13>, <14>, <60>;
                        };
 
-                       sata0: sata-host@a0000 {
-                               compatible = "marvell,orion-sata";
-                               reg = <0xa0000 0x2400>;
-                               interrupts = <62>;
-                               clocks = <&gate_clk 3>;
-                               nr-ports = <1>;
-                               status = "disabled";
+                       gpio1: gpio-ctrl@d0420 {
+                               compatible = "marvell,orion-gpio";
+                               #gpio-cells = <2>;
+                               gpio-controller;
+                               reg = <0xd0420 0x20>;
+                               ngpios = <32>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                               interrupts = <61>;
                        };
 
                        rtc: real-time-clock@d8500 {
                                compatible = "marvell,orion-rtc";
                                reg = <0xd8500 0x20>;
+                               interrupt-parent = <&pmu_intc>;
+                               interrupts = <5>;
                        };
 
-                       crypto: crypto-engine@30000 {
-                               compatible = "marvell,orion-crypto";
-                               reg = <0x30000 0x10000>,
-                                     <0xffffe000 0x800>;
-                               reg-names = "regs", "sram";
-                               interrupts = <31>;
-                               clocks = <&gate_clk 15>;
-                               status = "okay";
-                       };
-
-                       xor0: dma-engine@60800 {
-                               compatible = "marvell,orion-xor";
-                               reg = <0x60800 0x100
-                                      0x60a00 0x100>;
-                               clocks = <&gate_clk 23>;
-                               status = "okay";
-
-                               channel0 {
-                                       interrupts = <39>;
-                                       dmacap,memcpy;
-                                       dmacap,xor;
-                               };
-
-                               channel1 {
-                                       interrupts = <40>;
-                                       dmacap,memcpy;
-                                       dmacap,xor;
-                               };
-                       };
-
-                       xor1: dma-engine@60900 {
-                               compatible = "marvell,orion-xor";
-                               reg = <0x60900 0x100
-                                      0x60b00 0x100>;
-                               clocks = <&gate_clk 24>;
-                               status = "okay";
-
-                               channel0 {
-                                       interrupts = <42>;
-                                       dmacap,memcpy;
-                                       dmacap,xor;
-                               };
-
-                               channel1 {
-                                       interrupts = <43>;
-                                       dmacap,memcpy;
-                                       dmacap,xor;
-                               };
-                       };
-
-                       mdio: mdio-bus@72004 {
-                               compatible = "marvell,orion-mdio";
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               reg = <0x72004 0x84>;
-                               interrupts = <30>;
-                               clocks = <&gate_clk 2>;
-                               status = "disabled";
-
-                               ethphy: ethernet-phy {
-                                       device-type = "ethernet-phy";
-                                       /* set phy address in board file */
-                               };
-                       };
-
-                       eth: ethernet-ctrl@72000 {
-                               compatible = "marvell,orion-eth";
-                               #address-cells = <1>;
-                               #size-cells = <0>;
-                               reg = <0x72000 0x4000>;
-                               clocks = <&gate_clk 2>;
-                               marvell,tx-checksum-limit = <1600>;
-                               status = "disabled";
-
-                               ethernet-port@0 {
-                                       device_type = "network";
-                                       compatible = "marvell,orion-eth-port";
-                                       reg = <0>;
-                                       interrupts = <29>;
-                                       /* overwrite MAC address in bootloader */
-                                       local-mac-address = [00 00 00 00 00 00];
-                                       phy-handle = <&ethphy>;
-                               };
-                       };
-
-                       audio0: audio-controller@b0000 {
-                               compatible = "marvell,dove-audio";
-                               reg = <0xb0000 0x2210>;
-                               interrupts = <19>, <20>;
-                               clocks = <&gate_clk 12>;
-                               clock-names = "internal";
-                               status = "disabled";
-                       };
-
-                       audio1: audio-controller@b4000 {
-                               compatible = "marvell,dove-audio";
-                               reg = <0xb4000 0x2210>;
-                               interrupts = <21>, <22>;
-                               clocks = <&gate_clk 13>;
-                               clock-names = "internal";
-                               status = "disabled";
+                       gpio2: gpio-ctrl@e8400 {
+                               compatible = "marvell,orion-gpio";
+                               #gpio-cells = <2>;
+                               gpio-controller;
+                               reg = <0xe8400 0x0c>;
+                               ngpios = <8>;
                        };
                };
        };
diff --git a/arch/arm/boot/dts/efm32gg-dk3750.dts b/arch/arm/boot/dts/efm32gg-dk3750.dts
new file mode 100644 (file)
index 0000000..aa5c0f6
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Device tree for EFM32GG-DK3750 development board.
+ *
+ * Documentation available from
+ * http://www.silabs.com/Support%20Documents/TechnicalDocs/efm32gg-dk3750-ug.pdf
+ */
+
+/dts-v1/;
+#include "efm32gg.dtsi"
+
+/ {
+       model = "Energy Micro Giant Gecko Development Kit";
+       compatible = "efm32,dk3750";
+
+       chosen {
+               bootargs = "console=ttyefm4,115200 init=/linuxrc ignore_loglevel ihash_entries=64 dhash_entries=64 earlyprintk uclinux.physaddr=0x8c400000 root=/dev/mtdblock0";
+       };
+
+       memory {
+               reg = <0x88000000 0x400000>;
+       };
+
+       soc {
+               adc@40002000 {
+                       status = "ok";
+               };
+
+               i2c@4000a000 {
+                       location = <3>;
+                       status = "ok";
+
+                       temp@48 {
+                               compatible = "st,stds75";
+                               reg = <0x48>;
+                       };
+
+                       eeprom@50 {
+                               compatible = "microchip,24c02";
+                               reg = <0x50>;
+                               pagesize = <16>;
+                       };
+               };
+
+               spi0: spi@4000c000 { /* USART0 */
+                       cs-gpios = <&gpio 68 1>; // E4
+                       location = <1>;
+                       status = "ok";
+
+                       microsd@0 {
+                               compatible = "mmc-spi-slot";
+                               spi-max-frequency = <100000>;
+                               voltage-ranges = <3200 3400>;
+                               broken-cd;
+                               reg = <0>;
+                       };
+               };
+
+               spi1: spi@4000c400 { /* USART1 */
+                       cs-gpios = <&gpio 51 1>; // D3
+                       location = <1>;
+                       status = "ok";
+
+                       ks8851@0 {
+                               compatible = "ks8851";
+                               spi-max-frequency = <6000000>;
+                               reg = <0>;
+                               interrupt-parent = <&boardfpga>;
+                               interrupts = <4>;
+                       };
+               };
+
+               uart4: uart@4000e400 { /* UART1 */
+                       location = <2>;
+                       status = "ok";
+               };
+
+               boardfpga: boardfpga {
+                       compatible = "efm32board";
+                       reg = <0x80000000 0x400>;
+                       irq-gpios = <&gpio 64 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+                       status = "ok";
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/efm32gg.dtsi b/arch/arm/boot/dts/efm32gg.dtsi
new file mode 100644 (file)
index 0000000..a342ab0
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * Device tree for Energy Micro EFM32 Giant Gecko SoC.
+ *
+ * Documentation available from
+ * http://www.silabs.com/Support%20Documents/TechnicalDocs/EFM32GG-RM.pdf
+ */
+#include "armv7-m.dtsi"
+#include "dt-bindings/clock/efm32-cmu.h"
+
+/ {
+       aliases {
+               i2c0 = &i2c0;
+               i2c1 = &i2c1;
+               serial0 = &uart0;
+               serial1 = &uart1;
+               serial2 = &uart2;
+               serial3 = &uart3;
+               serial4 = &uart4;
+               spi0 = &spi0;
+               spi1 = &spi1;
+               spi2 = &spi2;
+       };
+
+       soc {
+               adc: adc@40002000 {
+                       compatible = "efm32,adc";
+                       reg = <0x40002000 0x400>;
+                       interrupts = <7>;
+                       clocks = <&cmu clk_HFPERCLKADC0>;
+                       status = "disabled";
+               };
+
+               gpio: gpio@40006000 {
+                       compatible = "efm32,gpio";
+                       reg = <0x40006000 0x1000>;
+                       interrupts = <1 11>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+                       clocks = <&cmu clk_HFPERCLKGPIO>;
+                       status = "ok";
+               };
+
+               i2c0: i2c@4000a000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "efm32,i2c";
+                       reg = <0x4000a000 0x400>;
+                       interrupts = <9>;
+                       clocks = <&cmu clk_HFPERCLKI2C0>;
+                       clock-frequency = <100000>;
+                       status = "disabled";
+               };
+
+               i2c1: i2c@4000a400 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "efm32,i2c";
+                       reg = <0x4000a400 0x400>;
+                       interrupts = <10>;
+                       clocks = <&cmu clk_HFPERCLKI2C1>;
+                       clock-frequency = <100000>;
+                       status = "disabled";
+               };
+
+               spi0: spi@4000c000 { /* USART0 */
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "efm32,spi";
+                       reg = <0x4000c000 0x400>;
+                       interrupts = <3 4>;
+                       clocks = <&cmu clk_HFPERCLKUSART0>;
+                       status = "disabled";
+               };
+
+               spi1: spi@4000c400 { /* USART1 */
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "efm32,spi";
+                       reg = <0x4000c400 0x400>;
+                       interrupts = <15 16>;
+                       clocks = <&cmu clk_HFPERCLKUSART1>;
+                       status = "disabled";
+               };
+
+               spi2: spi@40x4000c800 { /* USART2 */
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "efm32,spi";
+                       reg = <0x4000c800 0x400>;
+                       interrupts = <18 19>;
+                       clocks = <&cmu clk_HFPERCLKUSART2>;
+                       status = "disabled";
+               };
+
+               uart0: uart@4000c000 { /* USART0 */
+                       compatible = "efm32,uart";
+                       reg = <0x4000c000 0x400>;
+                       interrupts = <3 4>;
+                       clocks = <&cmu clk_HFPERCLKUSART0>;
+                       status = "disabled";
+               };
+
+               uart1: uart@4000c400 { /* USART1 */
+                       compatible = "efm32,uart";
+                       reg = <0x4000c400 0x400>;
+                       interrupts = <15 16>;
+                       clocks = <&cmu clk_HFPERCLKUSART1>;
+                       status = "disabled";
+               };
+
+               uart2: uart@40x4000c800 { /* USART2 */
+                       compatible = "efm32,uart";
+                       reg = <0x4000c800 0x400>;
+                       interrupts = <18 19>;
+                       clocks = <&cmu clk_HFPERCLKUSART2>;
+                       status = "disabled";
+               };
+
+               uart3: uart@4000e000 { /* UART0 */
+                       compatible = "efm32,uart";
+                       reg = <0x4000e000 0x400>;
+                       interrupts = <20 21>;
+                       clocks = <&cmu clk_HFPERCLKUART0>;
+                       status = "disabled";
+               };
+
+               uart4: uart@4000e400 { /* UART1 */
+                       compatible = "efm32,uart";
+                       reg = <0x4000e400 0x400>;
+                       interrupts = <22 23>;
+                       clocks = <&cmu clk_HFPERCLKUART1>;
+                       status = "disabled";
+               };
+
+               timer0: timer@40010000 {
+                       compatible = "efm32,timer";
+                       reg = <0x40010000 0x400>;
+                       interrupts = <2>;
+                       clocks = <&cmu clk_HFPERCLKTIMER0>;
+               };
+
+               timer1: timer@40010400 {
+                       compatible = "efm32,timer";
+                       reg = <0x40010400 0x400>;
+                       interrupts = <12>;
+                       clocks = <&cmu clk_HFPERCLKTIMER1>;
+               };
+
+               timer2: timer@40010800 {
+                       compatible = "efm32,timer";
+                       reg = <0x40010800 0x400>;
+                       interrupts = <13>;
+                       clocks = <&cmu clk_HFPERCLKTIMER2>;
+               };
+
+               timer3: timer@40010c00 {
+                       compatible = "efm32,timer";
+                       reg = <0x40010c00 0x400>;
+                       interrupts = <14>;
+                       clocks = <&cmu clk_HFPERCLKTIMER3>;
+               };
+
+               cmu: cmu@400c8000 {
+                       compatible = "efm32gg,cmu";
+                       reg = <0x400c8000 0x400>;
+                       interrupts = <32>;
+                       #clock-cells = <1>;
+               };
+       };
+};
index 861aa7d6fc7dbc480c0b9d6b185d6a291d38fcd2..50ccd151091e23d3acbec986bb3a321181b987b5 100644 (file)
@@ -9,7 +9,10 @@
  */
 /dts-v1/;
 
-/include/ "emev2.dtsi"
+#include "emev2.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        model = "EMEV2 KZM9D Board";
                reg = <0x20000000 0x10000>;
                phy-mode = "mii";
                interrupt-parent = <&gpio0>;
-               interrupts = <1 1>;     /* active high */
+               interrupts = <1 IRQ_TYPE_EDGE_RISING>;
                reg-io-width = <4>;
                smsc,irq-active-high;
                smsc,irq-push-pull;
                vddvario-supply = <&reg_1p8v>;
                vdd33a-supply = <&reg_3p3v>;
        };
+
+       gpio_keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               button@1 {
+                       debounce_interval = <50>;
+                       wakeup = <1>;
+                       label = "DSW2-1";
+                       linux,code = <KEY_1>;
+                       gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
+               };
+               button@2 {
+                       debounce_interval = <50>;
+                       wakeup = <1>;
+                       label = "DSW2-2";
+                       linux,code = <KEY_2>;
+                       gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
+               };
+               button@3 {
+                       debounce_interval = <50>;
+                       wakeup = <1>;
+                       label = "DSW2-3";
+                       linux,code = <KEY_3>;
+                       gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+               };
+               button@4 {
+                       debounce_interval = <50>;
+                       wakeup = <1>;
+                       label = "DSW2-4";
+                       linux,code = <KEY_4>;
+                       gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
+               };
+       };
 };
index 9063a4434d6a59b26e3bac76e24f1643bc6121e8..e37985fa10e2b6aca96f047f788f9674ddf0bf9f 100644 (file)
@@ -8,7 +8,8 @@
  * kind, whether express or implied.
  */
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        compatible = "renesas,emev2";
 
        pmu {
                compatible = "arm,cortex-a9-pmu";
-               interrupts = <0 120 4>,
-                            <0 121 4>;
+               interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 121 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       smu@e0110000 {
+               compatible = "renesas,emev2-smu";
+               reg = <0xe0110000 0x10000>;
+               #address-cells = <2>;
+               #size-cells = <0>;
+
+               c32ki: c32ki {
+                       compatible = "fixed-clock";
+                       clock-frequency = <32768>;
+                       #clock-cells = <0>;
+               };
+               pll3_fo: pll3_fo {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&c32ki>;
+                       clock-div = <1>;
+                       clock-mult = <7000>;
+                       #clock-cells = <0>;
+               };
+               usia_u0_sclkdiv: usia_u0_sclkdiv {
+                       compatible = "renesas,emev2-smu-clkdiv";
+                       reg = <0x610 0>;
+                       clocks = <&pll3_fo>;
+                       #clock-cells = <0>;
+               };
+               usib_u1_sclkdiv: usib_u1_sclkdiv {
+                       compatible = "renesas,emev2-smu-clkdiv";
+                       reg = <0x65c 0>;
+                       clocks = <&pll3_fo>;
+                       #clock-cells = <0>;
+               };
+               usib_u2_sclkdiv: usib_u2_sclkdiv {
+                       compatible = "renesas,emev2-smu-clkdiv";
+                       reg = <0x65c 16>;
+                       clocks = <&pll3_fo>;
+                       #clock-cells = <0>;
+               };
+               usib_u3_sclkdiv: usib_u3_sclkdiv {
+                       compatible = "renesas,emev2-smu-clkdiv";
+                       reg = <0x660 0>;
+                       clocks = <&pll3_fo>;
+                       #clock-cells = <0>;
+               };
+               usia_u0_sclk: usia_u0_sclk {
+                       compatible = "renesas,emev2-smu-gclk";
+                       reg = <0x4a0 1>;
+                       clocks = <&usia_u0_sclkdiv>;
+                       #clock-cells = <0>;
+               };
+               usib_u1_sclk: usib_u1_sclk {
+                       compatible = "renesas,emev2-smu-gclk";
+                       reg = <0x4b8 1>;
+                       clocks = <&usib_u1_sclkdiv>;
+                       #clock-cells = <0>;
+               };
+               usib_u2_sclk: usib_u2_sclk {
+                       compatible = "renesas,emev2-smu-gclk";
+                       reg = <0x4bc 1>;
+                       clocks = <&usib_u2_sclkdiv>;
+                       #clock-cells = <0>;
+               };
+               usib_u3_sclk: usib_u3_sclk {
+                       compatible = "renesas,emev2-smu-gclk";
+                       reg = <0x4c0 1>;
+                       clocks = <&usib_u3_sclkdiv>;
+                       #clock-cells = <0>;
+               };
+               sti_sclk: sti_sclk {
+                       compatible = "renesas,emev2-smu-gclk";
+                       reg = <0x528 1>;
+                       clocks = <&c32ki>;
+                       #clock-cells = <0>;
+               };
        };
 
        sti@e0180000 {
                compatible = "renesas,em-sti";
                reg = <0xe0180000 0x54>;
-               interrupts = <0 125 0>;
+               interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&sti_sclk>;
+               clock-names = "sclk";
        };
 
        uart@e1020000 {
                compatible = "renesas,em-uart";
                reg = <0xe1020000 0x38>;
-               interrupts = <0 8 0>;
+               interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&usia_u0_sclk>;
+               clock-names = "sclk";
        };
 
        uart@e1030000 {
                compatible = "renesas,em-uart";
                reg = <0xe1030000 0x38>;
-               interrupts = <0 9 0>;
+               interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&usib_u1_sclk>;
+               clock-names = "sclk";
        };
 
        uart@e1040000 {
                compatible = "renesas,em-uart";
                reg = <0xe1040000 0x38>;
-               interrupts = <0 10 0>;
+               interrupts = <0 10 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&usib_u2_sclk>;
+               clock-names = "sclk";
        };
 
        uart@e1050000 {
                compatible = "renesas,em-uart";
                reg = <0xe1050000 0x38>;
-               interrupts = <0 11 0>;
+               interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&usib_u3_sclk>;
+               clock-names = "sclk";
        };
 
        gpio0: gpio@e0050000 {
                compatible = "renesas,em-gio";
                reg = <0xe0050000 0x2c>, <0xe0050040 0x20>;
-               interrupts = <0 67 0>, <0 68 0>;
+               interrupts = <0 67 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 68 IRQ_TYPE_LEVEL_HIGH>;
                gpio-controller;
                #gpio-cells = <2>;
                ngpios = <32>;
        gpio1: gpio@e0050080 {
                compatible = "renesas,em-gio";
                reg = <0xe0050080 0x2c>, <0xe00500c0 0x20>;
-               interrupts = <0 69 0>, <0 70 0>;
+               interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 70 IRQ_TYPE_LEVEL_HIGH>;
                gpio-controller;
                #gpio-cells = <2>;
                ngpios = <32>;
        gpio2: gpio@e0050100 {
                compatible = "renesas,em-gio";
                reg = <0xe0050100 0x2c>, <0xe0050140 0x20>;
-               interrupts = <0 71 0>, <0 72 0>;
+               interrupts = <0 71 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 72 IRQ_TYPE_LEVEL_HIGH>;
                gpio-controller;
                #gpio-cells = <2>;
                ngpios = <32>;
        gpio3: gpio@e0050180 {
                compatible = "renesas,em-gio";
                reg = <0xe0050180 0x2c>, <0xe00501c0 0x20>;
-               interrupts = <0 73 0>, <0 74 0>;
+               interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 74 IRQ_TYPE_LEVEL_HIGH>;
                gpio-controller;
                #gpio-cells = <2>;
                ngpios = <32>;
        gpio4: gpio@e0050200 {
                compatible = "renesas,em-gio";
                reg = <0xe0050200 0x2c>, <0xe0050240 0x20>;
-               interrupts = <0 75 0>, <0 76 0>;
+               interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 76 IRQ_TYPE_LEVEL_HIGH>;
                gpio-controller;
                #gpio-cells = <2>;
                ngpios = <31>;
index a73eeb5f258fba0b88e55640f6e0df220b7b1cbb..08452e183b57a642581d37fdff11f5d0f651a4db 100644 (file)
                reg = <0x10023CE0 0x20>;
        };
 
-       gic:interrupt-controller@10490000 {
+       gic: interrupt-controller@10490000 {
                compatible = "arm,cortex-a9-gic";
                #interrupt-cells = <3>;
                interrupt-controller;
                reg = <0x10490000 0x1000>, <0x10480000 0x100>;
        };
 
-       combiner:interrupt-controller@10440000 {
+       combiner: interrupt-controller@10440000 {
                compatible = "samsung,exynos4210-combiner";
                #interrupt-cells = <2>;
                interrupt-controller;
                reg = <0x10440000 0x1000>;
        };
 
-       sys_reg: sysreg {
+       sys_reg: syscon@10010000 {
                compatible = "samsung,exynos4-sysreg", "syscon";
                reg = <0x10010000 0x400>;
        };
index 1a12fb23767c522be3f6af9311a858d93750846a..2aa13cb3bbed00053c910ddae2246ebf426cdd29 100644 (file)
        display-timings {
                native-mode = <&timing0>;
                timing0: timing {
-                       clock-frequency = <50000>;
+                       clock-frequency = <47500000>;
                        hactive = <1024>;
                        vactive = <600>;
                        hfront-porch = <64>;
index 057d6829d31998632a350ad3fd22a4a7bc639a18..48ecd7a755ab90cdca387a2a8de9898c180bd849 100644 (file)
                reg = <0x10023CA0 0x20>;
        };
 
-       gic:interrupt-controller@10490000 {
+       gic: interrupt-controller@10490000 {
                cpu-offset = <0x8000>;
        };
 
-       combiner:interrupt-controller@10440000 {
+       combiner: interrupt-controller@10440000 {
                samsung,combiner-nr = <16>;
                interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
                             <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
        mct@10050000 {
                compatible = "samsung,exynos4210-mct";
                reg = <0x10050000 0x800>;
-               interrupt-controller;
-               #interrups-cells = <2>;
                interrupt-parent = <&mct_map>;
-               interrupts = <0 0>, <1 0>, <2 0>, <3 0>,
-                            <4 0>, <5 0>;
+               interrupts = <0>, <1>, <2>, <3>, <4>, <5>;
                clocks = <&clock 3>, <&clock 344>;
                clock-names = "fin_pll", "mct";
 
                mct_map: mct-map {
-                       #interrupt-cells = <2>;
+                       #interrupt-cells = <1>;
                        #address-cells = <0>;
                        #size-cells = <0>;
-                       interrupt-map = <0x0 0 &gic 0 57 0>,
-                                       <0x1 0 &gic 0 69 0>,
-                                       <0x2 0 &combiner 12 6>,
-                                       <0x3 0 &combiner 12 7>,
-                                       <0x4 0 &gic 0 42 0>,
-                                       <0x5 0 &gic 0 48 0>;
+                       interrupt-map = <0 &gic 0 57 0>,
+                                       <1 &gic 0 69 0>,
+                                       <2 &combiner 12 6>,
+                                       <3 &combiner 12 7>,
+                                       <4 &gic 0 42 0>,
+                                       <5 &gic 0 48 0>;
                };
        };
 
index 6f34d7f6ba7ed886e7cc74e5daa8ae8bb3db125e..94a43f9a05e2684a4fc311404b4c46d72afe4e4e 100644 (file)
@@ -22,7 +22,7 @@
 / {
        compatible = "samsung,exynos4212";
 
-       gic:interrupt-controller@10490000 {
+       gic: interrupt-controller@10490000 {
                cpu-offset = <0x8000>;
        };
 
                             <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>,
                             <0 107 0>, <0 108 0>;
        };
-
-       mct@10050000 {
-               compatible = "samsung,exynos4412-mct";
-               reg = <0x10050000 0x800>;
-               interrupt-controller;
-               #interrups-cells = <2>;
-               interrupt-parent = <&mct_map>;
-               interrupts = <0 0>, <1 0>, <2 0>, <3 0>,
-                            <4 0>, <5 0>;
-
-               mct_map: mct-map {
-                       #interrupt-cells = <2>;
-                       #address-cells = <0>;
-                       #size-cells = <0>;
-                       interrupt-map = <0x0 0 &gic 0 57 0>,
-                                       <0x1 0 &combiner 12 5>,
-                                       <0x2 0 &combiner 12 6>,
-                                       <0x3 0 &combiner 12 7>,
-                                       <0x4 0 &gic 1 12 0>,
-                                       <0x5 0 &gic 1 12 0>;
-               };
-       };
 };
index 46c678ee119caae17bd1792490c9516c8049306b..9804fcb71f8cb22338ffa1ddd92426f3c3bf98f3 100644 (file)
@@ -38,9 +38,7 @@
                };
        };
 
-       mshc@12550000 {
-               #address-cells = <1>;
-               #size-cells = <0>;
+       mmc@12550000 {
                pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
                pinctrl-names = "default";
                vmmc-supply = <&ldo20_reg &buck8_reg>;
@@ -49,7 +47,6 @@
                num-slots = <1>;
                supports-highspeed;
                broken-cd;
-               fifo-depth = <0x80>;
                card-detect-delay = <200>;
                samsung,dw-mshc-ciu-div = <3>;
                samsung,dw-mshc-sdr-timing = <2 3>;
                max77686: pmic@09 {
                        compatible = "maxim,max77686";
                        reg = <0x09>;
+                       #clock-cells = <1>;
 
                        voltage-regulators {
                                ldo1_reg: LDO1 {
index d65984c440f6786b245275a09497670271714e90..6bc053924e9e69a70cc30eca78cd365c5fcafc6a 100644 (file)
                status = "okay";
        };
 
-       mshc@12550000 {
-               #address-cells = <1>;
-               #size-cells = <0>;
+       mmc@12550000 {
                pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
                pinctrl-names = "default";
                status = "okay";
                num-slots = <1>;
                supports-highspeed;
                broken-cd;
-               fifo-depth = <0x80>;
                card-detect-delay = <200>;
                samsung,dw-mshc-ciu-div = <3>;
                samsung,dw-mshc-sdr-timing = <2 3>;
        display-timings {
                native-mode = <&timing0>;
                timing0: timing {
-                       clock-frequency = <50000>;
+                       clock-frequency = <47500000>;
                        hactive = <1024>;
                        vactive = <600>;
                        hfront-porch = <64>;
diff --git a/arch/arm/boot/dts/exynos4412-tiny4412.dts b/arch/arm/boot/dts/exynos4412-tiny4412.dts
new file mode 100644 (file)
index 0000000..0a98312
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * FriendlyARM's Exynos4412 based TINY4412 board device tree source
+ *
+ * Copyright (c) 2013 Alex Ling <kasimling@gmail.com>
+ *
+ * Device tree source file for FriendlyARM's TINY4412 board which is based on
+ * Samsung's Exynos4412 SoC.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+/dts-v1/;
+#include "exynos4412.dtsi"
+
+/ {
+       model = "FriendlyARM TINY4412 board based on Exynos4412";
+       compatible = "friendlyarm,tiny4412", "samsung,exynos4412";
+
+       memory {
+               reg = <0x40000000 0x40000000>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led1 {
+                       label = "led1";
+                       gpios = <&gpm4 0 1>;
+                       default-state = "off";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led2 {
+                       label = "led2";
+                       gpios = <&gpm4 1 1>;
+                       default-state = "off";
+               };
+
+               led3 {
+                       label = "led3";
+                       gpios = <&gpm4 2 1>;
+                       default-state = "off";
+               };
+
+               led4 {
+                       label = "led4";
+                       gpios = <&gpm4 3 1>;
+                       default-state = "off";
+                       linux,default-trigger = "mmc0";
+               };
+       };
+
+       rtc@10070000 {
+               status = "okay";
+       };
+
+       sdhci@12530000 {
+               bus-width = <4>;
+               pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
+               pinctrl-names = "default";
+               status = "okay";
+       };
+
+       serial@13800000 {
+               status = "okay";
+       };
+
+       serial@13810000 {
+               status = "okay";
+       };
+
+       serial@13820000 {
+               status = "okay";
+       };
+
+       serial@13830000 {
+               status = "okay";
+       };
+
+       fixed-rate-clocks {
+               xxti {
+                       compatible = "samsung,clock-xxti";
+                       clock-frequency = <0>;
+               };
+
+               xusbxti {
+                       compatible = "samsung,clock-xusbxti";
+                       clock-frequency = <24000000>;
+               };
+       };
+};
index fb7b9ae5f39992514afe434142cbd3118055a661..4f851ccf40eb48831ebb78474dd458eebf873b58 100644 (file)
                        interrupt-parent = <&gpx0>;
                        interrupts = <7 0>;
                        reg = <0x09>;
+                       #clock-cells = <1>;
 
                        voltage-regulators {
                                ldo1_reg: ldo1 {
                };
        };
 
-       sdhci@12510000 {
-               bus-width = <8>;
+       mmc@12550000 {
+               num-slots = <1>;
+               supports-highspeed;
+               broken-cd;
                non-removable;
-               pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus8>;
-               pinctrl-names = "default";
+               card-detect-delay = <200>;
                vmmc-supply = <&vemmc_reg>;
+               clock-frequency = <400000000>;
+               samsung,dw-mshc-ciu-div = <0>;
+               samsung,dw-mshc-sdr-timing = <2 3>;
+               samsung,dw-mshc-ddr-timing = <1 2>;
+               pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
+               pinctrl-names = "default";
                status = "okay";
+
+               slot@0 {
+                       reg = <0>;
+                       bus-width = <8>;
+               };
        };
 
        serial@13800000 {
index e743e677a9e242250b9b1da6ace78b1c8ca114aa..87b339c739de708beaf5d2ed818e3a424c8fcc7a 100644 (file)
@@ -22,7 +22,7 @@
 / {
        compatible = "samsung,exynos4412";
 
-       gic:interrupt-controller@10490000 {
+       gic: interrupt-controller@10490000 {
                cpu-offset = <0x4000>;
        };
 
                             <0 107 0>, <0 108 0>, <0 48 0>, <0 42 0>;
        };
 
-       mct@10050000 {
-               compatible = "samsung,exynos4412-mct";
-               reg = <0x10050000 0x800>;
-               interrupt-controller;
-               #interrups-cells = <2>;
-               interrupt-parent = <&mct_map>;
-               interrupts = <0 0>, <1 0>, <2 0>, <3 0>,
-                            <4 0>, <5 0>, <6 0>, <7 0>;
-               clocks = <&clock 3>, <&clock 344>;
-               clock-names = "fin_pll", "mct";
-
-               mct_map: mct-map {
-                       #interrupt-cells = <2>;
-                       #address-cells = <0>;
-                       #size-cells = <0>;
-                       interrupt-map = <0x0 0 &gic 0 57 0>,
-                                       <0x1 0 &combiner 12 5>,
-                                       <0x2 0 &combiner 12 6>,
-                                       <0x3 0 &combiner 12 7>,
-                                       <0x4 0 &gic 1 12 0>,
-                                       <0x5 0 &gic 1 12 0>,
-                                       <0x6 0 &gic 1 12 0>,
-                                       <0x7 0 &gic 1 12 0>;
-               };
-       };
-
-       mshc@12550000 {
-               compatible = "samsung,exynos4412-dw-mshc";
-               reg = <0x12550000 0x1000>;
-               interrupts = <0 77 0>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
 };
index ad531fe6ab9528fdfcca50635bc4c833651db15b..5c412aa147382fb44ba6be6333f5d08485d28b5f 100644 (file)
@@ -28,6 +28,7 @@
                pinctrl3 = &pinctrl_3;
                fimc-lite0 = &fimc_lite_0;
                fimc-lite1 = &fimc_lite_1;
+               mshc0 = &mshc_0;
        };
 
        pd_isp: isp-power-domain@10023CA0 {
                #clock-cells = <1>;
        };
 
+       mct@10050000 {
+               compatible = "samsung,exynos4412-mct";
+               reg = <0x10050000 0x800>;
+               interrupt-parent = <&mct_map>;
+               interrupts = <0>, <1>, <2>, <3>, <4>;
+               clocks = <&clock 3>, <&clock 344>;
+               clock-names = "fin_pll", "mct";
+
+               mct_map: mct-map {
+                       #interrupt-cells = <1>;
+                       #address-cells = <0>;
+                       #size-cells = <0>;
+                       interrupt-map = <0 &gic 0 57 0>,
+                                       <1 &combiner 12 5>,
+                                       <2 &combiner 12 6>,
+                                       <3 &combiner 12 7>,
+                                       <4 &gic 1 12 0>;
+               };
+       };
+
        pinctrl_0: pinctrl@11400000 {
                compatible = "samsung,exynos4x12-pinctrl";
                reg = <0x11400000 0x1000>;
                        };
                };
        };
+
+       mshc_0: mmc@12550000 {
+               compatible = "samsung,exynos4412-dw-mshc";
+               reg = <0x12550000 0x1000>;
+               interrupts = <0 77 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               fifo-depth = <0x80>;
+               clocks = <&clock 301>, <&clock 149>;
+               clock-names = "biu", "ciu";
+               status = "disabled";
+       };
 };
index 074739d39e2db04490c3575fbb2131519f6cf53d..258dca441f36c9991152ab75403a2f4056699349 100644 (file)
@@ -23,7 +23,7 @@
                reg = <0x10000000 0x100>;
        };
 
-       combiner:interrupt-controller@10440000 {
+       combiner: interrupt-controller@10440000 {
                compatible = "samsung,exynos4210-combiner";
                #interrupt-cells = <2>;
                interrupt-controller;
@@ -39,7 +39,7 @@
                                <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>;
        };
 
-       gic:interrupt-controller@10481000 {
+       gic: interrupt-controller@10481000 {
                compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
                #interrupt-cells = <3>;
                interrupt-controller;
                interrupts = <1 9 0xf04>;
        };
 
-       dwmmc_0: dwmmc0@12200000 {
-               compatible = "samsung,exynos5250-dw-mshc";
-               interrupts = <0 75 0>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-
-       dwmmc_1: dwmmc1@12210000 {
-               compatible = "samsung,exynos5250-dw-mshc";
-               interrupts = <0 76 0>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-
-       dwmmc_2: dwmmc2@12220000 {
-               compatible = "samsung,exynos5250-dw-mshc";
-               interrupts = <0 77 0>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-
        serial@12C00000 {
                compatible = "samsung,exynos4210-uart";
                reg = <0x12C00000 0x100>;
index 684527087aa4cc2bdc8da3c3f801a1626f3d9439..b42e658876e5f0f3313e8ca07c3e19c55fa92924 100644 (file)
@@ -34,6 +34,7 @@
                samsung,i2c-sda-delay = <100>;
                samsung,i2c-max-bus-freq = <20000>;
                samsung,i2c-slave-addr = <0x66>;
+               status = "okay";
 
                s5m8767_pmic@66 {
                        compatible = "samsung,s5m8767-pmic";
 
                                buck2_reg: BUCK2 {
                                        regulator-name = "vdd_arm";
-                                       regulator-min-microvolt = <925000>;
+                                       regulator-min-microvolt = <912500>;
                                        regulator-max-microvolt = <1300000>;
                                        regulator-always-on;
                                        regulator-boot-on;
                                buck7_reg: BUCK7 {
                                        regulator-name = "PVDD_BUCK7";
                                        regulator-always-on;
+                                       op_mode = <1>;
                                };
 
                                buck8_reg: BUCK8 {
                                        regulator-name = "PVDD_BUCK8";
                                        regulator-always-on;
+                                       op_mode = <1>;
                                };
 
                                buck9_reg: BUCK9 {
                };
        };
 
-       i2c@12C70000 {
-               status = "disabled";
-       };
-
        i2c@12C80000 {
+               status = "okay";
+
                samsung,i2c-sda-delay = <100>;
                samsung,i2c-max-bus-freq = <66000>;
                samsung,i2c-slave-addr = <0x50>;
        };
 
        i2c@12C90000 {
+               status = "okay";
+
                wm1811a@1a {
+
                        compatible = "wlf,wm1811";
                        reg = <0x1a>;
 
                };
        };
 
-       i2c@12CA0000 {
-               status = "disabled";
-       };
-
-       i2c@12CB0000 {
-               status = "disabled";
-       };
-
-       i2c@12CC0000 {
-               status = "disabled";
-       };
-
-       i2c@12CD0000 {
-               status = "disabled";
-       };
-
        i2c@12CE0000 {
+               status = "okay";
+
                samsung,i2c-sda-delay = <100>;
                samsung,i2c-max-bus-freq = <66000>;
                samsung,i2c-slave-addr = <0x38>;
                };
        };
 
-       i2c@121D0000 {
-               status = "disabled";
-       };
-
-       dwmmc_0: dwmmc0@12200000 {
+       mmc_0: mmc@12200000 {
+               status = "okay";
                num-slots = <1>;
                supports-highspeed;
                broken-cd;
-               fifo-depth = <0x80>;
                card-detect-delay = <200>;
                samsung,dw-mshc-ciu-div = <3>;
                samsung,dw-mshc-sdr-timing = <2 3>;
                };
        };
 
-       dwmmc_1: dwmmc1@12210000 {
-               status = "disabled";
-       };
-
-       dwmmc_2: dwmmc2@12220000 {
+       mmc_2: mmc@12220000 {
+               status = "okay";
                num-slots = <1>;
                supports-highspeed;
-               fifo-depth = <0x80>;
                card-detect-delay = <200>;
                samsung,dw-mshc-ciu-div = <3>;
                samsung,dw-mshc-sdr-timing = <2 3>;
                };
        };
 
-       dwmmc_3: dwmmc3@12230000 {
-               status = "disabled";
-       };
-
        i2s0: i2s@03830000 {
                status = "okay";
        };
 
-       spi_0: spi@12d20000 {
-               status = "disabled";
-       };
-
-       spi_1: spi@12d30000 {
-               status = "disabled";
-       };
-
-       spi_2: spi@12d40000 {
-               status = "disabled";
-       };
-
        gpio_keys {
                compatible = "gpio-keys";
 
diff --git a/arch/arm/boot/dts/exynos5250-cros-common.dtsi b/arch/arm/boot/dts/exynos5250-cros-common.dtsi
new file mode 100644 (file)
index 0000000..2c1560d
--- /dev/null
@@ -0,0 +1,319 @@
+/*
+ * Common device tree include for all Exynos 5250 boards based off of Daisy.
+ *
+ * Copyright (c) 2012 Google, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+/ {
+       aliases {
+       };
+
+       memory {
+               reg = <0x40000000 0x80000000>;
+       };
+
+       chosen {
+       };
+
+       pinctrl@11400000 {
+               /*
+                * Disabled pullups since external part has its own pullups and
+                * double-pulling gets us out of spec in some cases.
+                */
+               i2c2_bus: i2c2-bus {
+                       samsung,pin-pud = <0>;
+               };
+
+               max77686_irq: max77686-irq {
+                       samsung,pins = "gpx3-2";
+                       samsung,pin-function = <0>;
+                       samsung,pin-pud = <0>;
+                       samsung,pin-drv = <0>;
+               };
+       };
+
+       i2c@12C60000 {
+               status = "okay";
+               samsung,i2c-sda-delay = <100>;
+               samsung,i2c-max-bus-freq = <378000>;
+
+               max77686@09 {
+                       compatible = "maxim,max77686";
+                       interrupt-parent = <&gpx3>;
+                       interrupts = <2 0>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&max77686_irq>;
+                       wakeup-source;
+                       reg = <0x09>;
+                       #clock-cells = <1>;
+
+                       voltage-regulators {
+                               ldo1_reg: LDO1 {
+                                       regulator-name = "P1.0V_LDO_OUT1";
+                                       regulator-min-microvolt = <1000000>;
+                                       regulator-max-microvolt = <1000000>;
+                                       regulator-always-on;
+                               };
+
+                               ldo2_reg: LDO2 {
+                                       regulator-name = "P1.8V_LDO_OUT2";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <1800000>;
+                                       regulator-always-on;
+                               };
+
+                               ldo3_reg: LDO3 {
+                                       regulator-name = "P1.8V_LDO_OUT3";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <1800000>;
+                                       regulator-always-on;
+                               };
+
+                               ldo7_reg: LDO7 {
+                                       regulator-name = "P1.1V_LDO_OUT7";
+                                       regulator-min-microvolt = <1100000>;
+                                       regulator-max-microvolt = <1100000>;
+                                       regulator-always-on;
+                               };
+
+                               ldo8_reg: LDO8 {
+                                       regulator-name = "P1.0V_LDO_OUT8";
+                                       regulator-min-microvolt = <1000000>;
+                                       regulator-max-microvolt = <1000000>;
+                                       regulator-always-on;
+                               };
+
+                               ldo10_reg: LDO10 {
+                                       regulator-name = "P1.8V_LDO_OUT10";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <1800000>;
+                                       regulator-always-on;
+                               };
+
+                               ldo12_reg: LDO12 {
+                                       regulator-name = "P3.0V_LDO_OUT12";
+                                       regulator-min-microvolt = <3000000>;
+                                       regulator-max-microvolt = <3000000>;
+                                       regulator-always-on;
+                               };
+
+                               ldo14_reg: LDO14 {
+                                       regulator-name = "P1.8V_LDO_OUT14";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <1800000>;
+                                       regulator-always-on;
+                               };
+
+                               ldo15_reg: LDO15 {
+                                       regulator-name = "P1.0V_LDO_OUT15";
+                                       regulator-min-microvolt = <1000000>;
+                                       regulator-max-microvolt = <1000000>;
+                                       regulator-always-on;
+                               };
+
+                               ldo16_reg: LDO16 {
+                                       regulator-name = "P1.8V_LDO_OUT16";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <1800000>;
+                                       regulator-always-on;
+                               };
+
+                               buck1_reg: BUCK1 {
+                                       regulator-name = "vdd_mif";
+                                       regulator-min-microvolt = <950000>;
+                                       regulator-max-microvolt = <1300000>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+                               };
+
+                               buck2_reg: BUCK2 {
+                                       regulator-name = "vdd_arm";
+                                       regulator-min-microvolt = <850000>;
+                                       regulator-max-microvolt = <1350000>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+                               };
+
+                               buck3_reg: BUCK3 {
+                                       regulator-name = "vdd_int";
+                                       regulator-min-microvolt = <900000>;
+                                       regulator-max-microvolt = <1200000>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+                               };
+
+                               buck4_reg: BUCK4 {
+                                       regulator-name = "vdd_g3d";
+                                       regulator-min-microvolt = <850000>;
+                                       regulator-max-microvolt = <1300000>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+                               };
+
+                               buck5_reg: BUCK5 {
+                                       regulator-name = "P1.8V_BUCK_OUT5";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <1800000>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+                               };
+
+                               buck6_reg: BUCK6 {
+                                       regulator-name = "P1.35V_BUCK_OUT6";
+                                       regulator-min-microvolt = <1350000>;
+                                       regulator-max-microvolt = <1350000>;
+                                       regulator-always-on;
+                               };
+
+                               buck7_reg: BUCK7 {
+                                       regulator-name = "P2.0V_BUCK_OUT7";
+                                       regulator-min-microvolt = <2000000>;
+                                       regulator-max-microvolt = <2000000>;
+                                       regulator-always-on;
+                               };
+
+                               buck8_reg: BUCK8 {
+                                       regulator-name = "P2.85V_BUCK_OUT8";
+                                       regulator-min-microvolt = <2850000>;
+                                       regulator-max-microvolt = <2850000>;
+                                       regulator-always-on;
+                               };
+                       };
+               };
+       };
+
+       i2c@12C70000 {
+               status = "okay";
+               samsung,i2c-sda-delay = <100>;
+               samsung,i2c-max-bus-freq = <378000>;
+
+               trackpad {
+                       reg = <0x67>;
+                       compatible = "cypress,cyapa";
+                       interrupts = <2 0>;
+                       interrupt-parent = <&gpx1>;
+                       wakeup-source;
+               };
+       };
+
+       i2c@12C80000 {
+               status = "okay";
+               samsung,i2c-sda-delay = <100>;
+               samsung,i2c-max-bus-freq = <66000>;
+
+               hdmiddc@50 {
+                       compatible = "samsung,exynos4210-hdmiddc";
+                       reg = <0x50>;
+               };
+       };
+
+       i2c@12C90000 {
+               status = "okay";
+               samsung,i2c-sda-delay = <100>;
+               samsung,i2c-max-bus-freq = <66000>;
+       };
+
+       i2c@12CA0000 {
+               status = "okay";
+               samsung,i2c-sda-delay = <100>;
+               samsung,i2c-max-bus-freq = <66000>;
+       };
+
+       i2c@12CB0000 {
+               status = "okay";
+               samsung,i2c-sda-delay = <100>;
+               samsung,i2c-max-bus-freq = <66000>;
+       };
+
+       i2c@12CD0000 {
+               status = "okay";
+               samsung,i2c-sda-delay = <100>;
+               samsung,i2c-max-bus-freq = <66000>;
+       };
+
+       i2c@12CE0000 {
+               status = "okay";
+               samsung,i2c-sda-delay = <100>;
+               samsung,i2c-max-bus-freq = <378000>;
+
+               hdmiphy@38 {
+                       compatible = "samsung,exynos4212-hdmiphy";
+                       reg = <0x38>;
+               };
+       };
+
+       mmc@12200000 {
+               num-slots = <1>;
+               supports-highspeed;
+               broken-cd;
+               card-detect-delay = <200>;
+               samsung,dw-mshc-ciu-div = <3>;
+               samsung,dw-mshc-sdr-timing = <2 3>;
+               samsung,dw-mshc-ddr-timing = <1 2>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_bus4 &sd0_bus8>;
+
+               slot@0 {
+                       reg = <0>;
+                       bus-width = <8>;
+               };
+       };
+
+       mmc@12220000 {
+               num-slots = <1>;
+               supports-highspeed;
+               card-detect-delay = <200>;
+               samsung,dw-mshc-ciu-div = <3>;
+               samsung,dw-mshc-sdr-timing = <2 3>;
+               samsung,dw-mshc-ddr-timing = <1 2>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
+
+               slot@0 {
+                       reg = <0>;
+                       bus-width = <4>;
+                       wp-gpios = <&gpc2 1 0>;
+               };
+       };
+
+       mmc@12230000 {
+               num-slots = <1>;
+               supports-highspeed;
+               broken-cd;
+               card-detect-delay = <200>;
+               samsung,dw-mshc-ciu-div = <3>;
+               samsung,dw-mshc-sdr-timing = <2 3>;
+               samsung,dw-mshc-ddr-timing = <1 2>;
+               /* See board-specific dts files for pin setup */
+
+               slot@0 {
+                       reg = <0>;
+                       bus-width = <4>;
+               };
+       };
+
+       spi_1: spi@12d30000 {
+               status = "okay";
+               samsung,spi-src-clk = <0>;
+               num-cs = <1>;
+       };
+
+       hdmi {
+               hpd-gpio = <&gpx3 7 0>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               power {
+                       label = "Power";
+                       gpios = <&gpx1 3 1>;
+                       linux,code = <116>; /* KEY_POWER */
+                       gpio-key,wakeup;
+               };
+       };
+};
index f86d56760a45a0f42692f5636376c899f81edbc3..3e69837c435c6b49ca81643f9717ae78d16a2403 100644 (file)
@@ -30,6 +30,7 @@
        i2c@12C60000 {
                samsung,i2c-sda-delay = <100>;
                samsung,i2c-max-bus-freq = <20000>;
+               status = "okay";
 
                eeprom@50 {
                        compatible = "samsung,s524ad0xd1";
@@ -37,7 +38,7 @@
                };
        };
 
-       vdd:fixed-regulator@0 {
+       vdd: fixed-regulator@0 {
                compatible = "regulator-fixed";
                regulator-name = "vdd-supply";
                regulator-min-microvolt = <1800000>;
@@ -45,7 +46,7 @@
                regulator-always-on;
        };
 
-       dbvdd:fixed-regulator@1 {
+       dbvdd: fixed-regulator@1 {
                compatible = "regulator-fixed";
                regulator-name = "dbvdd-supply";
                regulator-min-microvolt = <3300000>;
@@ -53,7 +54,7 @@
                regulator-always-on;
        };
 
-       spkvdd:fixed-regulator@2 {
+       spkvdd: fixed-regulator@2 {
                compatible = "regulator-fixed";
                regulator-name = "spkvdd-supply";
                regulator-min-microvolt = <5000000>;
@@ -64,6 +65,7 @@
        i2c@12C70000 {
                samsung,i2c-sda-delay = <100>;
                samsung,i2c-max-bus-freq = <20000>;
+               status = "okay";
 
                eeprom@51 {
                        compatible = "samsung,s524ad0xd1";
@@ -77,6 +79,9 @@
                        gpio-controller;
                        #gpio-cells = <2>;
 
+                       clocks = <&codec_mclk>;
+                       clock-names = "MCLK1";
+
                        AVDD2-supply = <&vdd>;
                        CPVDD-supply = <&vdd>;
                        DBVDD-supply = <&dbvdd>;
@@ -89,6 +94,7 @@
                samsung,i2c-sda-delay = <100>;
                samsung,i2c-max-bus-freq = <40000>;
                samsung,i2c-slave-addr = <0x38>;
+               status = "okay";
 
                sata-phy {
                        compatible = "samsung,sata-phy";
        i2c@12C80000 {
                samsung,i2c-sda-delay = <100>;
                samsung,i2c-max-bus-freq = <66000>;
+               status = "okay";
 
                hdmiddc@50 {
                        compatible = "samsung,exynos4210-hdmiddc";
                };
        };
 
-       i2c@12C90000 {
-               status = "disabled";
-       };
-
-       i2c@12CA0000 {
-               status = "disabled";
-       };
-
-       i2c@12CB0000 {
-               status = "disabled";
-       };
-
-       i2c@12CC0000 {
-               status = "disabled";
-       };
-
-       i2c@12CD0000 {
-               status = "disabled";
-       };
-
        i2c@12CE0000 {
                samsung,i2c-sda-delay = <100>;
                samsung,i2c-max-bus-freq = <66000>;
+               status = "okay";
 
                hdmiphy@38 {
                        compatible = "samsung,exynos4212-hdmiphy";
                };
        };
 
-       dwmmc0@12200000 {
+       mmc@12200000 {
+               status = "okay";
                num-slots = <1>;
                supports-highspeed;
                broken-cd;
-               fifo-depth = <0x80>;
                card-detect-delay = <200>;
                samsung,dw-mshc-ciu-div = <3>;
                samsung,dw-mshc-sdr-timing = <2 3>;
                };
        };
 
-       dwmmc1@12210000 {
-               status = "disabled";
-       };
-
-       dwmmc2@12220000 {
+       mmc@12220000 {
+               status = "okay";
                num-slots = <1>;
                supports-highspeed;
-               fifo-depth = <0x80>;
                card-detect-delay = <200>;
                samsung,dw-mshc-ciu-div = <3>;
                samsung,dw-mshc-sdr-timing = <2 3>;
                };
        };
 
-       dwmmc3@12230000 {
-               status = "disabled";
-       };
-
        spi_0: spi@12d20000 {
                status = "disabled";
        };
 
        spi_1: spi@12d30000 {
+               status = "okay";
+
                w25q80bw@0 {
                        #address-cells = <1>;
                        #size-cells = <1>;
                };
        };
 
-       spi_2: spi@12d40000 {
-               status = "disabled";
-       };
-
        hdmi {
                hpd-gpio = <&gpx3 7 0>;
        };
                        compatible = "samsung,clock-xxti";
                        clock-frequency = <24000000>;
                };
+
+               codec_mclk: codec-mclk {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <16934000>;
+               };
        };
 };
index fd711e245e8d311f392bedfed7bb48dee4d4b7e6..7e45eea2d78f1a29670342272dfe950a812d5209 100644 (file)
@@ -10,7 +10,7 @@
 
 /dts-v1/;
 #include "exynos5250.dtsi"
-#include "cros5250-common.dtsi"
+#include "exynos5250-cros-common.dtsi"
 
 / {
        model = "Google Snow";
@@ -85,7 +85,7 @@
                                        keypad,num-rows = <8>;
                                        keypad,num-columns = <13>;
                                        google,needs-ghost-filter;
-                                       linux,keymap = <0x0001003a      /* CAPSLK */
+                                       linux,keymap = <0x0001007d      /* L_META */
                                                        0x0002003b      /* F1 */
                                                        0x00030030      /* B */
                                                        0x00040044      /* F10 */
                                                        0x04060024      /* J */
                                                        0x04080027      /* ; */
                                                        0x04090026      /* L */
+                                                       0x040a002b      /* \ */
                                                        0x040b001c      /* ENTER */
 
                                                        0x0501002c      /* Z */
                };
        };
 
+       mmc@12200000 {
+               status = "okay";
+       };
+
+       mmc@12220000 {
+               status = "okay";
+       };
+
        /*
         * On Snow we've got SIP WiFi and so can keep drive strengths low to
         * reduce EMI.
         */
-       dwmmc3@12230000 {
+       mmc@12230000 {
+               status = "okay";
                slot@0 {
                        pinctrl-names = "default";
                        pinctrl-0 = <&sd3_clk &sd3_cmd &sd3_bus4>;
index 177becde7a268bdcee91be7b049567d17daf9809..b7dec41e32afd7ac6cce4d02022b0929b98aacac 100644 (file)
                gsc1 = &gsc_1;
                gsc2 = &gsc_2;
                gsc3 = &gsc_3;
-               mshc0 = &dwmmc_0;
-               mshc1 = &dwmmc_1;
-               mshc2 = &dwmmc_2;
-               mshc3 = &dwmmc_3;
+               mshc0 = &mmc_0;
+               mshc1 = &mmc_1;
+               mshc2 = &mmc_2;
+               mshc3 = &mmc_3;
                i2c0 = &i2c_0;
                i2c1 = &i2c_1;
                i2c2 = &i2c_2;
                        device_type = "cpu";
                        compatible = "arm,cortex-a15";
                        reg = <0>;
+                       clock-frequency = <1700000000>;
                };
                cpu@1 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a15";
                        reg = <1>;
+                       clock-frequency = <1700000000>;
                };
        };
 
@@ -88,6 +90,8 @@
                compatible = "samsung,exynos5250-audss-clock";
                reg = <0x03810000 0x0C>;
                #clock-cells = <1>;
+               clocks = <&clock 1>, <&clock 7>, <&clock 138>, <&clock 160>;
+               clock-names = "pll_ref", "pll_in", "sclk_audio", "sclk_pcm_in";
        };
 
        timer {
                clock-names = "i2c";
                pinctrl-names = "default";
                pinctrl-0 = <&i2c0_bus>;
+               status = "disabled";
        };
 
        i2c_1: i2c@12C70000 {
                clock-names = "i2c";
                pinctrl-names = "default";
                pinctrl-0 = <&i2c1_bus>;
+               status = "disabled";
        };
 
        i2c_2: i2c@12C80000 {
                clock-names = "i2c";
                pinctrl-names = "default";
                pinctrl-0 = <&i2c2_bus>;
+               status = "disabled";
        };
 
        i2c_3: i2c@12C90000 {
                clock-names = "i2c";
                pinctrl-names = "default";
                pinctrl-0 = <&i2c3_bus>;
+               status = "disabled";
        };
 
        i2c_4: i2c@12CA0000 {
                clock-names = "i2c";
                pinctrl-names = "default";
                pinctrl-0 = <&i2c4_bus>;
+               status = "disabled";
        };
 
        i2c_5: i2c@12CB0000 {
                clock-names = "i2c";
                pinctrl-names = "default";
                pinctrl-0 = <&i2c5_bus>;
+               status = "disabled";
        };
 
        i2c_6: i2c@12CC0000 {
                clock-names = "i2c";
                pinctrl-names = "default";
                pinctrl-0 = <&i2c6_bus>;
+               status = "disabled";
        };
 
        i2c_7: i2c@12CD0000 {
                clock-names = "i2c";
                pinctrl-names = "default";
                pinctrl-0 = <&i2c7_bus>;
+               status = "disabled";
        };
 
        i2c_8: i2c@12CE0000 {
                #size-cells = <0>;
                clocks = <&clock 302>;
                clock-names = "i2c";
+               status = "disabled";
        };
 
        i2c@121D0000 {
                 #size-cells = <0>;
                clocks = <&clock 288>;
                clock-names = "i2c";
+               status = "disabled";
        };
 
        spi_0: spi@12d20000 {
                compatible = "samsung,exynos4210-spi";
+               status = "disabled";
                reg = <0x12d20000 0x100>;
                interrupts = <0 66 0>;
                dmas = <&pdma0 5
 
        spi_1: spi@12d30000 {
                compatible = "samsung,exynos4210-spi";
+               status = "disabled";
                reg = <0x12d30000 0x100>;
                interrupts = <0 67 0>;
                dmas = <&pdma1 5
 
        spi_2: spi@12d40000 {
                compatible = "samsung,exynos4210-spi";
+               status = "disabled";
                reg = <0x12d40000 0x100>;
                interrupts = <0 68 0>;
                dmas = <&pdma0 7
                pinctrl-0 = <&spi2_bus>;
        };
 
-       dwmmc_0: dwmmc0@12200000 {
+       mmc_0: mmc@12200000 {
+               compatible = "samsung,exynos5250-dw-mshc";
+               interrupts = <0 75 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
                reg = <0x12200000 0x1000>;
                clocks = <&clock 280>, <&clock 139>;
                clock-names = "biu", "ciu";
+               fifo-depth = <0x80>;
+               status = "disabled";
        };
 
-       dwmmc_1: dwmmc1@12210000 {
+       mmc_1: mmc@12210000 {
+               compatible = "samsung,exynos5250-dw-mshc";
+               interrupts = <0 76 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
                reg = <0x12210000 0x1000>;
                clocks = <&clock 281>, <&clock 140>;
                clock-names = "biu", "ciu";
+               fifo-depth = <0x80>;
+               status = "disabled";
        };
 
-       dwmmc_2: dwmmc2@12220000 {
+       mmc_2: mmc@12220000 {
+               compatible = "samsung,exynos5250-dw-mshc";
+               interrupts = <0 77 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
                reg = <0x12220000 0x1000>;
                clocks = <&clock 282>, <&clock 141>;
                clock-names = "biu", "ciu";
+               fifo-depth = <0x80>;
+               status = "disabled";
        };
 
-       dwmmc_3: dwmmc3@12230000 {
+       mmc_3: mmc@12230000 {
                compatible = "samsung,exynos5250-dw-mshc";
                reg = <0x12230000 0x1000>;
                interrupts = <0 78 0>;
                #size-cells = <0>;
                clocks = <&clock 283>, <&clock 142>;
                clock-names = "biu", "ciu";
+               fifo-depth = <0x80>;
+               status = "disabled";
        };
 
        i2s0: i2s@03830000 {
                };
        };
 
+       pwm: pwm@12dd0000 {
+               compatible = "samsung,exynos4210-pwm";
+               reg = <0x12dd0000 0x100>;
+               samsung,pwm-outputs = <0>, <1>, <2>, <3>;
+               #pwm-cells = <3>;
+               clocks = <&clock 311>;
+               clock-names = "timers";
+       };
+
        amba {
                #address-cells = <1>;
                #size-cells = <1>;
diff --git a/arch/arm/boot/dts/exynos5420-arndale-octa.dts b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
new file mode 100644 (file)
index 0000000..7340745
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Samsung's Exynos5420 based Arndale Octa board device tree source
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+/dts-v1/;
+#include "exynos5420.dtsi"
+
+/ {
+       model = "Insignal Arndale Octa evaluation board based on EXYNOS5420";
+       compatible = "insignal,arndale-octa", "samsung,exynos5420";
+
+       memory {
+               reg = <0x20000000 0x80000000>;
+       };
+
+       chosen {
+               bootargs = "console=ttySAC3,115200";
+       };
+
+       fixed-rate-clocks {
+               oscclk {
+                       compatible = "samsung,exynos5420-oscclk";
+                       clock-frequency = <24000000>;
+               };
+       };
+
+       mmc@12200000 {
+               status = "okay";
+               broken-cd;
+               supports-highspeed;
+               card-detect-delay = <200>;
+               samsung,dw-mshc-ciu-div = <3>;
+               samsung,dw-mshc-sdr-timing = <0 4>;
+               samsung,dw-mshc-ddr-timing = <0 2>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
+
+               slot@0 {
+                       reg = <0>;
+                       bus-width = <8>;
+               };
+       };
+
+       mmc@12220000 {
+               status = "okay";
+               supports-highspeed;
+               card-detect-delay = <200>;
+               samsung,dw-mshc-ciu-div = <3>;
+               samsung,dw-mshc-sdr-timing = <2 3>;
+               samsung,dw-mshc-ddr-timing = <1 2>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
+
+               slot@0 {
+                       reg = <0>;
+                       bus-width = <4>;
+               };
+       };
+};
index e695aba5f73c4d75527c5d0fb33c7a671bb58006..e62c8eb57438988c0c5493cfb2a88c2471e624e3 100644 (file)
@@ -64,7 +64,7 @@
                        samsung,pins = "gpx0-7";
                        samsung,pin-function = <3>;
                        samsung,pin-pud = <0>;
-                       samaung,pin-drv = <0>;
+                       samsung,pin-drv = <0>;
                };
        };
 
index 79524c74c60354344bd9026b67614ce414ffbe31..fb5a1e25c632d3a4cbb3544e5e44ee67a0c1d8aa 100644 (file)
                };
        };
 
+       mmc@12200000 {
+               status = "okay";
+               broken-cd;
+               supports-highspeed;
+               card-detect-delay = <200>;
+               samsung,dw-mshc-ciu-div = <3>;
+               samsung,dw-mshc-sdr-timing = <0 4>;
+               samsung,dw-mshc-ddr-timing = <0 2>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
+
+               slot@0 {
+                       reg = <0>;
+                       bus-width = <8>;
+               };
+       };
+
+       mmc@12220000 {
+               status = "okay";
+               supports-highspeed;
+               card-detect-delay = <200>;
+               samsung,dw-mshc-ciu-div = <3>;
+               samsung,dw-mshc-sdr-timing = <2 3>;
+               samsung,dw-mshc-ddr-timing = <1 2>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
+
+               slot@0 {
+                       reg = <0>;
+                       bus-width = <4>;
+               };
+       };
+
        dp-controller@145B0000 {
                pinctrl-names = "default";
                pinctrl-0 = <&dp_hpd>;
index 09aa06cb3d3af77be582328167c25f8735a09fb2..8db792b26f79c1046523c584c4b2e9c910438d73 100644 (file)
@@ -22,6 +22,9 @@
        compatible = "samsung,exynos5420";
 
        aliases {
+               mshc0 = &mmc_0;
+               mshc1 = &mmc_1;
+               mshc2 = &mmc_2;
                pinctrl0 = &pinctrl_0;
                pinctrl1 = &pinctrl_1;
                pinctrl2 = &pinctrl_2;
                i2c1 = &i2c_1;
                i2c2 = &i2c_2;
                i2c3 = &i2c_3;
+               i2c4 = &hsi2c_4;
+               i2c5 = &hsi2c_5;
+               i2c6 = &hsi2c_6;
+               i2c7 = &hsi2c_7;
+               i2c8 = &hsi2c_8;
+               i2c9 = &hsi2c_9;
+               i2c10 = &hsi2c_10;
+               gsc0 = &gsc_0;
+               gsc1 = &gsc_1;
+               spi0 = &spi_0;
+               spi1 = &spi_1;
+               spi2 = &spi_2;
        };
 
        cpus {
                        reg = <0x3>;
                        clock-frequency = <1800000000>;
                };
+
+               cpu4: cpu@100 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a7";
+                       reg = <0x100>;
+                       clock-frequency = <1000000000>;
+               };
+
+               cpu5: cpu@101 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a7";
+                       reg = <0x101>;
+                       clock-frequency = <1000000000>;
+               };
+
+               cpu6: cpu@102 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a7";
+                       reg = <0x102>;
+                       clock-frequency = <1000000000>;
+               };
+
+               cpu7: cpu@103 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a7";
+                       reg = <0x103>;
+                       clock-frequency = <1000000000>;
+               };
        };
 
        clock: clock-controller@10010000 {
                compatible = "samsung,exynos5420-audss-clock";
                reg = <0x03810000 0x0C>;
                #clock-cells = <1>;
-               clocks = <&clock 148>;
-               clock-names = "sclk_audio";
+               clocks = <&clock 1>, <&clock 5>, <&clock 148>, <&clock 149>;
+               clock-names = "pll_ref", "pll_in", "sclk_audio", "sclk_pcm_in";
        };
 
        codec@11000000 {
                clock-names = "mfc";
        };
 
+       mmc_0: mmc@12200000 {
+               compatible = "samsung,exynos5420-dw-mshc-smu";
+               interrupts = <0 75 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x12200000 0x2000>;
+               clocks = <&clock 351>, <&clock 132>;
+               clock-names = "biu", "ciu";
+               fifo-depth = <0x40>;
+               status = "disabled";
+       };
+
+       mmc_1: mmc@12210000 {
+               compatible = "samsung,exynos5420-dw-mshc-smu";
+               interrupts = <0 76 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x12210000 0x2000>;
+               clocks = <&clock 352>, <&clock 133>;
+               clock-names = "biu", "ciu";
+               fifo-depth = <0x40>;
+               status = "disabled";
+       };
+
+       mmc_2: mmc@12220000 {
+               compatible = "samsung,exynos5420-dw-mshc";
+               interrupts = <0 77 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x12220000 0x1000>;
+               clocks = <&clock 353>, <&clock 134>;
+               clock-names = "biu", "ciu";
+               fifo-depth = <0x40>;
+               status = "disabled";
+       };
+
        mct@101C0000 {
                compatible = "samsung,exynos4210-mct";
                reg = <0x101C0000 0x800>;
                interrupt-controller;
                #interrups-cells = <1>;
                interrupt-parent = <&mct_map>;
-               interrupts = <0>, <1>, <2>, <3>, <4>, <5>, <6>, <7>;
+               interrupts = <0>, <1>, <2>, <3>, <4>, <5>, <6>, <7>,
+                               <8>, <9>, <10>, <11>;
                clocks = <&clock 1>, <&clock 315>;
                clock-names = "fin_pll", "mct";
 
                                        <4 &gic 0 120 0>,
                                        <5 &gic 0 121 0>,
                                        <6 &gic 0 122 0>,
-                                       <7 &gic 0 123 0>;
+                                       <7 &gic 0 123 0>,
+                                       <8 &gic 0 128 0>,
+                                       <9 &gic 0 129 0>,
+                                       <10 &gic 0 130 0>,
+                                       <11 &gic 0 131 0>;
                };
        };
 
                status = "okay";
        };
 
+       amba {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "arm,amba-bus";
+               interrupt-parent = <&gic>;
+               ranges;
+
+               pdma0: pdma@121A0000 {
+                       compatible = "arm,pl330", "arm,primecell";
+                       reg = <0x121A0000 0x1000>;
+                       interrupts = <0 34 0>;
+                       clocks = <&clock 362>;
+                       clock-names = "apb_pclk";
+                       #dma-cells = <1>;
+                       #dma-channels = <8>;
+                       #dma-requests = <32>;
+               };
+
+               pdma1: pdma@121B0000 {
+                       compatible = "arm,pl330", "arm,primecell";
+                       reg = <0x121B0000 0x1000>;
+                       interrupts = <0 35 0>;
+                       clocks = <&clock 363>;
+                       clock-names = "apb_pclk";
+                       #dma-cells = <1>;
+                       #dma-channels = <8>;
+                       #dma-requests = <32>;
+               };
+
+               mdma0: mdma@10800000 {
+                       compatible = "arm,pl330", "arm,primecell";
+                       reg = <0x10800000 0x1000>;
+                       interrupts = <0 33 0>;
+                       clocks = <&clock 473>;
+                       clock-names = "apb_pclk";
+                       #dma-cells = <1>;
+                       #dma-channels = <8>;
+                       #dma-requests = <1>;
+               };
+
+               mdma1: mdma@11C10000 {
+                       compatible = "arm,pl330", "arm,primecell";
+                       reg = <0x11C10000 0x1000>;
+                       interrupts = <0 124 0>;
+                       clocks = <&clock 442>;
+                       clock-names = "apb_pclk";
+                       #dma-cells = <1>;
+                       #dma-channels = <8>;
+                       #dma-requests = <1>;
+               };
+       };
+
+       spi_0: spi@12d20000 {
+               compatible = "samsung,exynos4210-spi";
+               reg = <0x12d20000 0x100>;
+               interrupts = <0 66 0>;
+               dmas = <&pdma0 5
+                       &pdma0 4>;
+               dma-names = "tx", "rx";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&spi0_bus>;
+               clocks = <&clock 271>, <&clock 135>;
+               clock-names = "spi", "spi_busclk0";
+               status = "disabled";
+       };
+
+       spi_1: spi@12d30000 {
+               compatible = "samsung,exynos4210-spi";
+               reg = <0x12d30000 0x100>;
+               interrupts = <0 67 0>;
+               dmas = <&pdma1 5
+                       &pdma1 4>;
+               dma-names = "tx", "rx";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&spi1_bus>;
+               clocks = <&clock 272>, <&clock 136>;
+               clock-names = "spi", "spi_busclk0";
+               status = "disabled";
+       };
+
+       spi_2: spi@12d40000 {
+               compatible = "samsung,exynos4210-spi";
+               reg = <0x12d40000 0x100>;
+               interrupts = <0 68 0>;
+               dmas = <&pdma0 7
+                       &pdma0 6>;
+               dma-names = "tx", "rx";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&spi2_bus>;
+               clocks = <&clock 273>, <&clock 137>;
+               clock-names = "spi", "spi_busclk0";
+               status = "disabled";
+       };
+
        serial@12C00000 {
                clocks = <&clock 257>, <&clock 128>;
                clock-names = "uart", "clk_uart_baud0";
                clock-names = "uart", "clk_uart_baud0";
        };
 
+       pwm: pwm@12dd0000 {
+               compatible = "samsung,exynos4210-pwm";
+               reg = <0x12dd0000 0x100>;
+               samsung,pwm-outputs = <0>, <1>, <2>, <3>;
+               #pwm-cells = <3>;
+               clocks = <&clock 279>;
+               clock-names = "timers";
+       };
+
        dp_phy: video-phy@10040728 {
                compatible = "samsung,exynos5250-dp-video-phy";
                reg = <0x10040728 4>;
                status = "disabled";
        };
 
+       hsi2c_4: i2c@12CA0000 {
+               compatible = "samsung,exynos5-hsi2c";
+               reg = <0x12CA0000 0x1000>;
+               interrupts = <0 60 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&i2c4_hs_bus>;
+               clocks = <&clock 265>;
+               clock-names = "hsi2c";
+               status = "disabled";
+       };
+
+       hsi2c_5: i2c@12CB0000 {
+               compatible = "samsung,exynos5-hsi2c";
+               reg = <0x12CB0000 0x1000>;
+               interrupts = <0 61 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&i2c5_hs_bus>;
+               clocks = <&clock 266>;
+               clock-names = "hsi2c";
+               status = "disabled";
+       };
+
+       hsi2c_6: i2c@12CC0000 {
+               compatible = "samsung,exynos5-hsi2c";
+               reg = <0x12CC0000 0x1000>;
+               interrupts = <0 62 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&i2c6_hs_bus>;
+               clocks = <&clock 267>;
+               clock-names = "hsi2c";
+               status = "disabled";
+       };
+
+       hsi2c_7: i2c@12CD0000 {
+               compatible = "samsung,exynos5-hsi2c";
+               reg = <0x12CD0000 0x1000>;
+               interrupts = <0 63 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&i2c7_hs_bus>;
+               clocks = <&clock 268>;
+               clock-names = "hsi2c";
+               status = "disabled";
+       };
+
+       hsi2c_8: i2c@12E00000 {
+               compatible = "samsung,exynos5-hsi2c";
+               reg = <0x12E00000 0x1000>;
+               interrupts = <0 87 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&i2c8_hs_bus>;
+               clocks = <&clock 281>;
+               clock-names = "hsi2c";
+               status = "disabled";
+       };
+
+       hsi2c_9: i2c@12E10000 {
+               compatible = "samsung,exynos5-hsi2c";
+               reg = <0x12E10000 0x1000>;
+               interrupts = <0 88 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&i2c9_hs_bus>;
+               clocks = <&clock 282>;
+               clock-names = "hsi2c";
+               status = "disabled";
+       };
+
+       hsi2c_10: i2c@12E20000 {
+               compatible = "samsung,exynos5-hsi2c";
+               reg = <0x12E20000 0x1000>;
+               interrupts = <0 203 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&i2c10_hs_bus>;
+               clocks = <&clock 283>;
+               clock-names = "hsi2c";
+               status = "disabled";
+       };
+
        hdmi@14530000 {
                compatible = "samsung,exynos4212-hdmi";
                reg = <0x14530000 0x70000>;
                clocks = <&clock 431>, <&clock 143>;
                clock-names = "mixer", "sclk_hdmi";
        };
+
+       gsc_0: video-scaler@13e00000 {
+               compatible = "samsung,exynos5-gsc";
+               reg = <0x13e00000 0x1000>;
+               interrupts = <0 85 0>;
+               clocks = <&clock 465>;
+               clock-names = "gscl";
+               samsung,power-domain = <&gsc_pd>;
+       };
+
+       gsc_1: video-scaler@13e10000 {
+               compatible = "samsung,exynos5-gsc";
+               reg = <0x13e10000 0x1000>;
+               interrupts = <0 86 0>;
+               clocks = <&clock 466>;
+               clock-names = "gscl";
+               samsung,power-domain = <&gsc_pd>;
+       };
+
+       tmu_cpu0: tmu@10060000 {
+               compatible = "samsung,exynos5420-tmu";
+               reg = <0x10060000 0x100>;
+               interrupts = <0 65 0>;
+               clocks = <&clock 318>;
+               clock-names = "tmu_apbif";
+       };
+
+       tmu_cpu1: tmu@10064000 {
+               compatible = "samsung,exynos5420-tmu";
+               reg = <0x10064000 0x100>;
+               interrupts = <0 183 0>;
+               clocks = <&clock 318>;
+               clock-names = "tmu_apbif";
+       };
+
+       tmu_cpu2: tmu@10068000 {
+               compatible = "samsung,exynos5420-tmu-ext-triminfo";
+               reg = <0x10068000 0x100>, <0x1006c000 0x4>;
+               interrupts = <0 184 0>;
+               clocks = <&clock 318>, <&clock 318>;
+               clock-names = "tmu_apbif", "tmu_triminfo_apbif";
+       };
+
+       tmu_cpu3: tmu@1006c000 {
+               compatible = "samsung,exynos5420-tmu-ext-triminfo";
+               reg = <0x1006c000 0x100>, <0x100a0000 0x4>;
+               interrupts = <0 185 0>;
+               clocks = <&clock 318>, <&clock 319>;
+               clock-names = "tmu_apbif", "tmu_triminfo_apbif";
+       };
+
+       tmu_gpu: tmu@100a0000 {
+               compatible = "samsung,exynos5420-tmu-ext-triminfo";
+               reg = <0x100a0000 0x100>, <0x10068000 0x4>;
+               interrupts = <0 215 0>;
+               clocks = <&clock 319>, <&clock 318>;
+               clock-names = "tmu_apbif", "tmu_triminfo_apbif";
+       };
 };
index 8da107088ce414b3138d9073a07304fb3575bcea..02a0a1226cef7a81b4f5e629d0d2bb58d734e3a9 100644 (file)
@@ -29,7 +29,7 @@
                #clock-cells = <1>;
        };
 
-       gic:interrupt-controller@2E0000 {
+       gic: interrupt-controller@2E0000 {
                compatible = "arm,cortex-a15-gic";
                #interrupt-cells = <3>;
                interrupt-controller;
diff --git a/arch/arm/boot/dts/hi3620-hi4511.dts b/arch/arm/boot/dts/hi3620-hi4511.dts
new file mode 100644 (file)
index 0000000..fe62392
--- /dev/null
@@ -0,0 +1,649 @@
+/*
+ *  Copyright (C) 2012-2013 Linaro Ltd.
+ *  Author: Haojian Zhuang <haojian.zhuang@linaro.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  publishhed by the Free Software Foundation.
+ */
+
+/dts-v1/;
+
+#include "hi3620.dtsi"
+
+/ {
+       model = "Hisilicon Hi4511 Development Board";
+       compatible = "hisilicon,hi3620-hi4511";
+
+       chosen {
+               bootargs = "console=ttyAMA0,115200 root=/dev/ram0 earlyprintk";
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x40000000 0x20000000>;
+       };
+
+       amba {
+               dual_timer0: dual_timer@800000 {
+                       status = "ok";
+               };
+
+               uart0: uart@b00000 {    /* console */
+                       pinctrl-names = "default", "idle";
+                       pinctrl-0 = <&uart0_pmx_func &uart0_cfg_func>;
+                       pinctrl-1 = <&uart0_pmx_idle &uart0_cfg_idle>;
+                       status = "ok";
+               };
+
+               uart1: uart@b01000 { /* modem */
+                       pinctrl-names = "default", "idle";
+                       pinctrl-0 = <&uart1_pmx_func &uart1_cfg_func>;
+                       pinctrl-1 = <&uart1_pmx_idle &uart1_cfg_idle>;
+                       status = "ok";
+               };
+
+               uart2: uart@b02000 { /* audience */
+                       pinctrl-names = "default", "idle";
+                       pinctrl-0 = <&uart2_pmx_func &uart2_cfg_func>;
+                       pinctrl-1 = <&uart2_pmx_idle &uart2_cfg_idle>;
+                       status = "ok";
+               };
+
+               uart3: uart@b03000 {
+                       pinctrl-names = "default", "idle";
+                       pinctrl-0 = <&uart3_pmx_func &uart3_cfg_func>;
+                       pinctrl-1 = <&uart3_pmx_idle &uart3_cfg_idle>;
+                       status = "ok";
+               };
+
+               uart4: uart@b04000 {
+                       pinctrl-names = "default", "idle";
+                       pinctrl-0 = <&uart4_pmx_func &uart4_cfg_func>;
+                       pinctrl-1 = <&uart4_pmx_idle &uart4_cfg_func>;
+                       status = "ok";
+               };
+
+               pmx0: pinmux@803000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&board_pmx_pins>;
+
+                       board_pmx_pins: board_pmx_pins {
+                               pinctrl-single,pins = <
+                                       0x008 0x0       /* GPIO -- eFUSE_DOUT */
+                                       0x100 0x0       /* USIM_CLK & USIM_DATA (IOMG63) */
+                               >;
+                       };
+                       uart0_pmx_func: uart0_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x0f0 0x0
+                                       0x0f4 0x0       /* UART0_RX & UART0_TX */
+                               >;
+                       };
+                       uart0_pmx_idle: uart0_pmx_idle {
+                               pinctrl-single,pins = <
+                                       /*0x0f0 0x1*/   /* UART0_CTS & UART0_RTS */
+                                       0x0f4 0x1       /* UART0_RX & UART0_TX */
+                               >;
+                       };
+                       uart1_pmx_func: uart1_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x0f8 0x0       /* UART1_CTS & UART1_RTS (IOMG61) */
+                                       0x0fc 0x0       /* UART1_RX & UART1_TX (IOMG62) */
+                               >;
+                       };
+                       uart1_pmx_idle: uart1_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x0f8 0x1       /* GPIO (IOMG61) */
+                                       0x0fc 0x1       /* GPIO (IOMG62) */
+                               >;
+                       };
+                       uart2_pmx_func: uart2_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x104 0x2       /* UART2_RXD (IOMG96) */
+                                       0x108 0x2       /* UART2_TXD (IOMG64) */
+                               >;
+                       };
+                       uart2_pmx_idle: uart2_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x104 0x1       /* GPIO (IOMG96) */
+                                       0x108 0x1       /* GPIO (IOMG64) */
+                               >;
+                       };
+                       uart3_pmx_func: uart3_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x160 0x2       /* UART3_CTS & UART3_RTS (IOMG85) */
+                                       0x164 0x2       /* UART3_RXD & UART3_TXD (IOMG86) */
+                               >;
+                       };
+                       uart3_pmx_idle: uart3_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x160 0x1       /* GPIO (IOMG85) */
+                                       0x164 0x1       /* GPIO (IOMG86) */
+                               >;
+                       };
+                       uart4_pmx_func: uart4_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x168 0x0       /* UART4_CTS & UART4_RTS (IOMG87) */
+                                       0x16c 0x0       /* UART4_RXD (IOMG88) */
+                                       0x170 0x0       /* UART4_TXD (IOMG93) */
+                               >;
+                       };
+                       uart4_pmx_idle: uart4_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x168 0x1       /* GPIO (IOMG87) */
+                                       0x16c 0x1       /* GPIO (IOMG88) */
+                                       0x170 0x1       /* GPIO (IOMG93) */
+                               >;
+                       };
+                       i2c0_pmx_func: i2c0_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x0b4 0x0       /* I2C0_SCL & I2C0_SDA (IOMG45) */
+                               >;
+                       };
+                       i2c0_pmx_idle: i2c0_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x0b4 0x1       /* GPIO (IOMG45) */
+                               >;
+                       };
+                       i2c1_pmx_func: i2c1_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x0b8 0x0       /* I2C1_SCL & I2C1_SDA (IOMG46) */
+                               >;
+                       };
+                       i2c1_pmx_idle: i2c1_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x0b8 0x1       /* GPIO (IOMG46) */
+                               >;
+                       };
+                       i2c2_pmx_func: i2c2_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x068 0x0       /* I2C2_SCL (IOMG26) */
+                                       0x06c 0x0       /* I2C2_SDA (IOMG27) */
+                               >;
+                       };
+                       i2c2_pmx_idle: i2c2_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x068 0x1       /* GPIO (IOMG26) */
+                                       0x06c 0x1       /* GPIO (IOMG27) */
+                               >;
+                       };
+                       i2c3_pmx_func: i2c3_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x050 0x2       /* I2C3_SCL (IOMG20) */
+                                       0x054 0x2       /* I2C3_SDA (IOMG21) */
+                               >;
+                       };
+                       i2c3_pmx_idle: i2c3_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x050 0x1       /* GPIO (IOMG20) */
+                                       0x054 0x1       /* GPIO (IOMG21) */
+                               >;
+                       };
+                       spi0_pmx_func: spi0_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x0d4 0x0       /* SPI0_CLK/SPI0_DI/SPI0_DO (IOMG53) */
+                                       0x0d8 0x0       /* SPI0_CS0 (IOMG54) */
+                                       0x0dc 0x0       /* SPI0_CS1 (IOMG55) */
+                                       0x0e0 0x0       /* SPI0_CS2 (IOMG56) */
+                                       0x0e4 0x0       /* SPI0_CS3 (IOMG57) */
+                               >;
+                       };
+                       spi0_pmx_idle: spi0_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x0d4 0x1       /* GPIO (IOMG53) */
+                                       0x0d8 0x1       /* GPIO (IOMG54) */
+                                       0x0dc 0x1       /* GPIO (IOMG55) */
+                                       0x0e0 0x1       /* GPIO (IOMG56) */
+                                       0x0e4 0x1       /* GPIO (IOMG57) */
+                               >;
+                       };
+                       spi1_pmx_func: spi1_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x184 0x0       /* SPI1_CLK/SPI1_DI (IOMG98) */
+                                       0x0e8 0x0       /* SPI1_DO (IOMG58) */
+                                       0x0ec 0x0       /* SPI1_CS (IOMG95) */
+                               >;
+                       };
+                       spi1_pmx_idle: spi1_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x184 0x1       /* GPIO (IOMG98) */
+                                       0x0e8 0x1       /* GPIO (IOMG58) */
+                                       0x0ec 0x1       /* GPIO (IOMG95) */
+                               >;
+                       };
+                       kpc_pmx_func: kpc_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x12c 0x0       /* KEY_IN0 (IOMG73) */
+                                       0x130 0x0       /* KEY_IN1 (IOMG74) */
+                                       0x134 0x0       /* KEY_IN2 (IOMG75) */
+                                       0x10c 0x0       /* KEY_OUT0 (IOMG65) */
+                                       0x110 0x0       /* KEY_OUT1 (IOMG66) */
+                                       0x114 0x0       /* KEY_OUT2 (IOMG67) */
+                               >;
+                       };
+                       kpc_pmx_idle: kpc_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x12c 0x1       /* GPIO (IOMG73) */
+                                       0x130 0x1       /* GPIO (IOMG74) */
+                                       0x134 0x1       /* GPIO (IOMG75) */
+                                       0x10c 0x1       /* GPIO (IOMG65) */
+                                       0x110 0x1       /* GPIO (IOMG66) */
+                                       0x114 0x1       /* GPIO (IOMG67) */
+                               >;
+                       };
+                       gpio_key_func: gpio_key_func {
+                               pinctrl-single,pins = <
+                                       0x10c 0x1       /* KEY_OUT0/GPIO (IOMG65) */
+                                       0x130 0x1       /* KEY_IN1/GPIO (IOMG74) */
+                               >;
+                       };
+                       emmc_pmx_func: emmc_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x030 0x2       /* eMMC_CMD/eMMC_CLK (IOMG12) */
+                                       0x018 0x0       /* NAND_CS3_N (IOMG6) */
+                                       0x024 0x0       /* NAND_BUSY2_N (IOMG8) */
+                                       0x028 0x0       /* NAND_BUSY3_N (IOMG9) */
+                                       0x02c 0x2       /* eMMC_DATA[0:7] (IOMG10) */
+                               >;
+                       };
+                       emmc_pmx_idle: emmc_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x030 0x0       /* GPIO (IOMG12) */
+                                       0x018 0x1       /* GPIO (IOMG6) */
+                                       0x024 0x1       /* GPIO (IOMG8) */
+                                       0x028 0x1       /* GPIO (IOMG9) */
+                                       0x02c 0x1       /* GPIO (IOMG10) */
+                               >;
+                       };
+                       sd_pmx_func: sd_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x0bc 0x0       /* SD_CLK/SD_CMD/SD_DATA0/SD_DATA1/SD_DATA2 (IOMG47) */
+                                       0x0c0 0x0       /* SD_DATA3 (IOMG48) */
+                               >;
+                       };
+                       sd_pmx_idle: sd_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x0bc 0x1       /* GPIO (IOMG47) */
+                                       0x0c0 0x1       /* GPIO (IOMG48) */
+                               >;
+                       };
+                       nand_pmx_func: nand_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x00c 0x0       /* NAND_ALE/NAND_CLE/.../NAND_DATA[0:7] (IOMG3) */
+                                       0x010 0x0       /* NAND_CS1_N (IOMG4) */
+                                       0x014 0x0       /* NAND_CS2_N (IOMG5) */
+                                       0x018 0x0       /* NAND_CS3_N (IOMG6) */
+                                       0x01c 0x0       /* NAND_BUSY0_N (IOMG94) */
+                                       0x020 0x0       /* NAND_BUSY1_N (IOMG7) */
+                                       0x024 0x0       /* NAND_BUSY2_N (IOMG8) */
+                                       0x028 0x0       /* NAND_BUSY3_N (IOMG9) */
+                                       0x02c 0x0       /* NAND_DATA[8:15] (IOMG10) */
+                               >;
+                       };
+                       nand_pmx_idle: nand_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x00c 0x1       /* GPIO (IOMG3) */
+                                       0x010 0x1       /* GPIO (IOMG4) */
+                                       0x014 0x1       /* GPIO (IOMG5) */
+                                       0x018 0x1       /* GPIO (IOMG6) */
+                                       0x01c 0x1       /* GPIO (IOMG94) */
+                                       0x020 0x1       /* GPIO (IOMG7) */
+                                       0x024 0x1       /* GPIO (IOMG8) */
+                                       0x028 0x1       /* GPIO (IOMG9) */
+                                       0x02c 0x1       /* GPIO (IOMG10) */
+                               >;
+                       };
+                       sdio_pmx_func: sdio_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x0c4 0x0       /* SDIO_CLK/SDIO_CMD/SDIO_DATA[0:3] (IOMG49) */
+                               >;
+                       };
+                       sdio_pmx_idle: sdio_pmx_idle {
+                               pinctrl-single,pins = <
+                                       0x0c4 0x1       /* GPIO (IOMG49) */
+                               >;
+                       };
+                       audio_out_pmx_func: audio_out_pmx_func {
+                               pinctrl-single,pins = <
+                                       0x0f0 0x1       /* GPIO (IOMG59), audio spk & earphone */
+                               >;
+                       };
+               };
+
+               pmx1: pinmux@803800 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <   &board_pu_pins &board_pd_pins &board_pd_ps_pins
+                                       &board_np_pins &board_ps_pins &kpc_cfg_func
+                                       &audio_out_cfg_func>;
+                       board_pu_pins: board_pu_pins {
+                               pinctrl-single,pins = <
+                                       0x014 0         /* GPIO_158 (IOCFG2) */
+                                       0x018 0         /* GPIO_159 (IOCFG3) */
+                                       0x01c 0         /* BOOT_MODE0 (IOCFG4) */
+                                       0x020 0         /* BOOT_MODE1 (IOCFG5) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <1 1 0 1>;
+                       };
+                       board_pd_pins: board_pd_pins {
+                               pinctrl-single,pins = <
+                                       0x038 0         /* eFUSE_DOUT (IOCFG11) */
+                                       0x150 0         /* ISP_GPIO8 (IOCFG93) */
+                                       0x154 0         /* ISP_GPIO9 (IOCFG94) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       board_pd_ps_pins: board_pd_ps_pins {
+                               pinctrl-single,pins = <
+                                       0x2d8 0         /* CLK_OUT0 (IOCFG190) */
+                                       0x004 0         /* PMU_SPI_DATA (IOCFG192) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       board_np_pins: board_np_pins {
+                               pinctrl-single,pins = <
+                                       0x24c 0         /* KEYPAD_OUT7 (IOCFG155) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       board_ps_pins: board_ps_pins {
+                               pinctrl-single,pins = <
+                                       0x000 0         /* PMU_SPI_CLK (IOCFG191) */
+                                       0x008 0         /* PMU_SPI_CS_N (IOCFG193) */
+                               >;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       uart0_cfg_func: uart0_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x208 0         /* UART0_RXD (IOCFG138) */
+                                       0x20c 0         /* UART0_TXD (IOCFG139) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       uart0_cfg_idle: uart0_cfg_idle {
+                               pinctrl-single,pins = <
+                                       0x208 0         /* UART0_RXD (IOCFG138) */
+                                       0x20c 0         /* UART0_TXD (IOCFG139) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       uart1_cfg_func: uart1_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x210 0         /* UART1_CTS (IOCFG140) */
+                                       0x214 0         /* UART1_RTS (IOCFG141) */
+                                       0x218 0         /* UART1_RXD (IOCFG142) */
+                                       0x21c 0         /* UART1_TXD (IOCFG143) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       uart1_cfg_idle: uart1_cfg_idle {
+                               pinctrl-single,pins = <
+                                       0x210 0         /* UART1_CTS (IOCFG140) */
+                                       0x214 0         /* UART1_RTS (IOCFG141) */
+                                       0x218 0         /* UART1_RXD (IOCFG142) */
+                                       0x21c 0         /* UART1_TXD (IOCFG143) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       uart2_cfg_func: uart2_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x220 0         /* UART2_CTS (IOCFG144) */
+                                       0x224 0         /* UART2_RTS (IOCFG145) */
+                                       0x228 0         /* UART2_RXD (IOCFG146) */
+                                       0x22c 0         /* UART2_TXD (IOCFG147) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       uart2_cfg_idle: uart2_cfg_idle {
+                               pinctrl-single,pins = <
+                                       0x220 0         /* GPIO (IOCFG144) */
+                                       0x224 0         /* GPIO (IOCFG145) */
+                                       0x228 0         /* GPIO (IOCFG146) */
+                                       0x22c 0         /* GPIO (IOCFG147) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       uart3_cfg_func: uart3_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x294 0         /* UART3_CTS (IOCFG173) */
+                                       0x298 0         /* UART3_RTS (IOCFG174) */
+                                       0x29c 0         /* UART3_RXD (IOCFG175) */
+                                       0x2a0 0         /* UART3_TXD (IOCFG176) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       uart3_cfg_idle: uart3_cfg_idle {
+                               pinctrl-single,pins = <
+                                       0x294 0         /* UART3_CTS (IOCFG173) */
+                                       0x298 0         /* UART3_RTS (IOCFG174) */
+                                       0x29c 0         /* UART3_RXD (IOCFG175) */
+                                       0x2a0 0         /* UART3_TXD (IOCFG176) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       uart4_cfg_func: uart4_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x2a4 0         /* UART4_CTS (IOCFG177) */
+                                       0x2a8 0         /* UART4_RTS (IOCFG178) */
+                                       0x2ac 0         /* UART4_RXD (IOCFG179) */
+                                       0x2b0 0         /* UART4_TXD (IOCFG180) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       i2c0_cfg_func: i2c0_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x17c 0         /* I2C0_SCL (IOCFG103) */
+                                       0x180 0         /* I2C0_SDA (IOCFG104) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       i2c1_cfg_func: i2c1_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x184 0         /* I2C1_SCL (IOCFG105) */
+                                       0x188 0         /* I2C1_SDA (IOCFG106) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       i2c2_cfg_func: i2c2_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x118 0         /* I2C2_SCL (IOCFG79) */
+                                       0x11c 0         /* I2C2_SDA (IOCFG80) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       i2c3_cfg_func: i2c3_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x100 0         /* I2C3_SCL (IOCFG73) */
+                                       0x104 0         /* I2C3_SDA (IOCFG74) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       spi0_cfg_func1: spi0_cfg_func1 {
+                               pinctrl-single,pins = <
+                                       0x1d4 0         /* SPI0_CLK (IOCFG125) */
+                                       0x1d8 0         /* SPI0_DI (IOCFG126) */
+                                       0x1dc 0         /* SPI0_DO (IOCFG127) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       spi0_cfg_func2: spi0_cfg_func2 {
+                               pinctrl-single,pins = <
+                                       0x1e0 0         /* SPI0_CS0 (IOCFG128) */
+                                       0x1e4 0         /* SPI0_CS1 (IOCFG129) */
+                                       0x1e8 0         /* SPI0_CS2 (IOCFG130 */
+                                       0x1ec 0         /* SPI0_CS3 (IOCFG131) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <1 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       spi1_cfg_func1: spi1_cfg_func1 {
+                               pinctrl-single,pins = <
+                                       0x1f0 0         /* SPI1_CLK (IOCFG132) */
+                                       0x1f4 0         /* SPI1_DI (IOCFG133) */
+                                       0x1f8 0         /* SPI1_DO (IOCFG134) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       spi1_cfg_func2: spi1_cfg_func2 {
+                               pinctrl-single,pins = <
+                                       0x1fc 0         /* SPI1_CS (IOCFG135) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <1 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       kpc_cfg_func: kpc_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x250 0         /* KEY_IN0 (IOCFG156) */
+                                       0x254 0         /* KEY_IN1 (IOCFG157) */
+                                       0x258 0         /* KEY_IN2 (IOCFG158) */
+                                       0x230 0         /* KEY_OUT0 (IOCFG148) */
+                                       0x234 0         /* KEY_OUT1 (IOCFG149) */
+                                       0x238 0         /* KEY_OUT2 (IOCFG150) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+                       emmc_cfg_func: emmc_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x0ac 0         /* eMMC_CMD (IOCFG40) */
+                                       0x0b0 0         /* eMMC_CLK (IOCFG41) */
+                                       0x058 0         /* NAND_CS3_N (IOCFG19) */
+                                       0x064 0         /* NAND_BUSY2_N (IOCFG22) */
+                                       0x068 0         /* NAND_BUSY3_N (IOCFG23) */
+                                       0x08c 0         /* NAND_DATA8 (IOCFG32) */
+                                       0x090 0         /* NAND_DATA9 (IOCFG33) */
+                                       0x094 0         /* NAND_DATA10 (IOCFG34) */
+                                       0x098 0         /* NAND_DATA11 (IOCFG35) */
+                                       0x09c 0         /* NAND_DATA12 (IOCFG36) */
+                                       0x0a0 0         /* NAND_DATA13 (IOCFG37) */
+                                       0x0a4 0         /* NAND_DATA14 (IOCFG38) */
+                                       0x0a8 0         /* NAND_DATA15 (IOCFG39) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <1 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       sd_cfg_func1: sd_cfg_func1 {
+                               pinctrl-single,pins = <
+                                       0x18c 0         /* SD_CLK (IOCFG107) */
+                                       0x190 0         /* SD_CMD (IOCFG108) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       sd_cfg_func2: sd_cfg_func2 {
+                               pinctrl-single,pins = <
+                                       0x194 0         /* SD_DATA0 (IOCFG109) */
+                                       0x198 0         /* SD_DATA1 (IOCFG110) */
+                                       0x19c 0         /* SD_DATA2 (IOCFG111) */
+                                       0x1a0 0         /* SD_DATA3 (IOCFG112) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                               pinctrl-single,drive-strength = <0x70 0xf0>;
+                       };
+                       nand_cfg_func1: nand_cfg_func1 {
+                               pinctrl-single,pins = <
+                                       0x03c 0         /* NAND_ALE (IOCFG12) */
+                                       0x040 0         /* NAND_CLE (IOCFG13) */
+                                       0x06c 0         /* NAND_DATA0 (IOCFG24) */
+                                       0x070 0         /* NAND_DATA1 (IOCFG25) */
+                                       0x074 0         /* NAND_DATA2 (IOCFG26) */
+                                       0x078 0         /* NAND_DATA3 (IOCFG27) */
+                                       0x07c 0         /* NAND_DATA4 (IOCFG28) */
+                                       0x080 0         /* NAND_DATA5 (IOCFG29) */
+                                       0x084 0         /* NAND_DATA6 (IOCFG30) */
+                                       0x088 0         /* NAND_DATA7 (IOCFG31) */
+                                       0x08c 0         /* NAND_DATA8 (IOCFG32) */
+                                       0x090 0         /* NAND_DATA9 (IOCFG33) */
+                                       0x094 0         /* NAND_DATA10 (IOCFG34) */
+                                       0x098 0         /* NAND_DATA11 (IOCFG35) */
+                                       0x09c 0         /* NAND_DATA12 (IOCFG36) */
+                                       0x0a0 0         /* NAND_DATA13 (IOCFG37) */
+                                       0x0a4 0         /* NAND_DATA14 (IOCFG38) */
+                                       0x0a8 0         /* NAND_DATA15 (IOCFG39) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       nand_cfg_func2: nand_cfg_func2 {
+                               pinctrl-single,pins = <
+                                       0x044 0         /* NAND_RE_N (IOCFG14) */
+                                       0x048 0         /* NAND_WE_N (IOCFG15) */
+                                       0x04c 0         /* NAND_CS0_N (IOCFG16) */
+                                       0x050 0         /* NAND_CS1_N (IOCFG17) */
+                                       0x054 0         /* NAND_CS2_N (IOCFG18) */
+                                       0x058 0         /* NAND_CS3_N (IOCFG19) */
+                                       0x05c 0         /* NAND_BUSY0_N (IOCFG20) */
+                                       0x060 0         /* NAND_BUSY1_N (IOCFG21) */
+                                       0x064 0         /* NAND_BUSY2_N (IOCFG22) */
+                                       0x068 0         /* NAND_BUSY3_N (IOCFG23) */
+                               >;
+                               pinctrl-single,bias-pulldown = <0 2 0 2>;
+                               pinctrl-single,bias-pullup = <1 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       sdio_cfg_func: sdio_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x1a4 0         /* SDIO0_CLK (IOCG113) */
+                                       0x1a8 0         /* SDIO0_CMD (IOCG114) */
+                                       0x1ac 0         /* SDIO0_DATA0 (IOCG115) */
+                                       0x1b0 0         /* SDIO0_DATA1 (IOCG116) */
+                                       0x1b4 0         /* SDIO0_DATA2 (IOCG117) */
+                                       0x1b8 0         /* SDIO0_DATA3 (IOCG118) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                               pinctrl-single,drive-strength = <0x30 0xf0>;
+                       };
+                       audio_out_cfg_func: audio_out_cfg_func {
+                               pinctrl-single,pins = <
+                                       0x200 0         /* GPIO (IOCFG136) */
+                                       0x204 0         /* GPIO (IOCFG137) */
+                               >;
+                               pinctrl-single,bias-pulldown = <2 2 0 2>;
+                               pinctrl-single,bias-pullup = <0 1 0 1>;
+                       };
+               };
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               call {
+                       label = "call";
+                       gpios = <&gpio17 2 0>;
+                       linux,code = <169>;     /* KEY_PHONE */
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/hi3620.dtsi b/arch/arm/boot/dts/hi3620.dtsi
new file mode 100644 (file)
index 0000000..ab1116d
--- /dev/null
@@ -0,0 +1,565 @@
+/*
+ * Hisilicon Ltd. Hi3620 SoC
+ *
+ * Copyright (C) 2012-2013 Hisilicon Ltd.
+ * Copyright (C) 2012-2013 Linaro Ltd.
+ *
+ * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * publishhed by the Free Software Foundation.
+ */
+
+#include "skeleton.dtsi"
+#include <dt-bindings/clock/hi3620-clock.h>
+
+/ {
+       aliases {
+               serial0 = &uart0;
+               serial1 = &uart1;
+               serial2 = &uart2;
+               serial3 = &uart3;
+               serial4 = &uart4;
+       };
+
+       pclk: clk {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <26000000>;
+               clock-output-names = "apb_pclk";
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a9";
+                       reg = <0x0>;
+                       next-level-cache = <&L2>;
+               };
+
+               cpu@1 {
+                       compatible = "arm,cortex-a9";
+                       device_type = "cpu";
+                       reg = <1>;
+                       next-level-cache = <&L2>;
+               };
+
+               cpu@2 {
+                       compatible = "arm,cortex-a9";
+                       device_type = "cpu";
+                       reg = <2>;
+                       next-level-cache = <&L2>;
+               };
+
+               cpu@3 {
+                       compatible = "arm,cortex-a9";
+                       device_type = "cpu";
+                       reg = <3>;
+                       next-level-cache = <&L2>;
+               };
+       };
+
+       amba {
+
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "arm,amba-bus";
+               interrupt-parent = <&gic>;
+               ranges = <0 0xfc000000 0x2000000>;
+
+               L2: l2-cache {
+                       compatible = "arm,pl310-cache";
+                       reg = <0xfc10000 0x100000>;
+                       interrupts = <0 15 4>;
+                       cache-unified;
+                       cache-level = <2>;
+               };
+
+               gic: interrupt-controller@1000 {
+                       compatible = "arm,cortex-a9-gic";
+                       #interrupt-cells = <3>;
+                       #address-cells = <0>;
+                       interrupt-controller;
+                       /* gic dist base, gic cpu base */
+                       reg = <0x1000 0x1000>, <0x100 0x100>;
+               };
+
+               sysctrl: system-controller@802000 {
+                       compatible = "hisilicon,sysctrl";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges = <0 0x802000 0x1000>;
+                       reg = <0x802000 0x1000>;
+
+                       smp-offset = <0x31c>;
+                       resume-offset = <0x308>;
+                       reboot-offset = <0x4>;
+
+                       clock: clock@0 {
+                               compatible = "hisilicon,hi3620-clock";
+                               reg = <0 0x10000>;
+                               #clock-cells = <1>;
+                       };
+               };
+
+               dual_timer0: dual_timer@800000 {
+                       compatible = "arm,sp804", "arm,primecell";
+                       reg = <0x800000 0x1000>;
+                       /* timer00 & timer01 */
+                       interrupts = <0 0 4>, <0 1 4>;
+                       clocks = <&clock HI3620_TIMER0_MUX>, <&clock HI3620_TIMER1_MUX>;
+                       clock-names = "apb_pclk";
+                       status = "disabled";
+               };
+
+               dual_timer1: dual_timer@801000 {
+                       compatible = "arm,sp804", "arm,primecell";
+                       reg = <0x801000 0x1000>;
+                       /* timer10 & timer11 */
+                       interrupts = <0 2 4>, <0 3 4>;
+                       clocks = <&clock HI3620_TIMER2_MUX>, <&clock HI3620_TIMER3_MUX>;
+                       clock-names = "apb_pclk";
+                       status = "disabled";
+               };
+
+               dual_timer2: dual_timer@a01000 {
+                       compatible = "arm,sp804", "arm,primecell";
+                       reg = <0xa01000 0x1000>;
+                       /* timer20 & timer21 */
+                       interrupts = <0 4 4>, <0 5 4>;
+                       clocks = <&clock HI3620_TIMER4_MUX>, <&clock HI3620_TIMER5_MUX>;
+                       clock-names = "apb_pclk";
+                       status = "disabled";
+               };
+
+               dual_timer3: dual_timer@a02000 {
+                       compatible = "arm,sp804", "arm,primecell";
+                       reg = <0xa02000 0x1000>;
+                       /* timer30 & timer31 */
+                       interrupts = <0 6 4>, <0 7 4>;
+                       clocks = <&clock HI3620_TIMER6_MUX>, <&clock HI3620_TIMER7_MUX>;
+                       clock-names = "apb_pclk";
+                       status = "disabled";
+               };
+
+               dual_timer4: dual_timer@a03000 {
+                       compatible = "arm,sp804", "arm,primecell";
+                       reg = <0xa03000 0x1000>;
+                       /* timer40 & timer41 */
+                       interrupts = <0 96 4>, <0 97 4>;
+                       clocks = <&clock HI3620_TIMER8_MUX>, <&clock HI3620_TIMER9_MUX>;
+                       clock-names = "apb_pclk";
+                       status = "disabled";
+               };
+
+               timer5: timer@600 {
+                       compatible = "arm,cortex-a9-twd-timer";
+                       reg = <0x600 0x20>;
+                       interrupts = <1 13 0xf01>;
+               };
+
+               uart0: uart@b00000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0xb00000 0x1000>;
+                       interrupts = <0 20 4>;
+                       clocks = <&clock HI3620_UARTCLK0>;
+                       clock-names = "apb_pclk";
+                       status = "disabled";
+               };
+
+               uart1: uart@b01000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0xb01000 0x1000>;
+                       interrupts = <0 21 4>;
+                       clocks = <&clock HI3620_UARTCLK1>;
+                       clock-names = "apb_pclk";
+                       status = "disabled";
+               };
+
+               uart2: uart@b02000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0xb02000 0x1000>;
+                       interrupts = <0 22 4>;
+                       clocks = <&clock HI3620_UARTCLK2>;
+                       clock-names = "apb_pclk";
+                       status = "disabled";
+               };
+
+               uart3: uart@b03000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0xb03000 0x1000>;
+                       interrupts = <0 23 4>;
+                       clocks = <&clock HI3620_UARTCLK3>;
+                       clock-names = "apb_pclk";
+                       status = "disabled";
+               };
+
+               uart4: uart@b04000 {
+                       compatible = "arm,pl011", "arm,primecell";
+                       reg = <0xb04000 0x1000>;
+                       interrupts = <0 24 4>;
+                       clocks = <&clock HI3620_UARTCLK4>;
+                       clock-names = "apb_pclk";
+                       status = "disabled";
+               };
+
+               gpio0: gpio@806000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x806000 0x1000>;
+                       interrupts = <0 64 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 2 0 1 &pmx0 3 0 1 &pmx0 4 0 1
+                                       &pmx0 5 0 1 &pmx0 6 1 1 &pmx0 7 2 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK0>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio1: gpio@807000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x807000 0x1000>;
+                       interrupts = <0 65 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 3 1 &pmx0 1 3 1 &pmx0 2 3 1
+                                       &pmx0 3 3 1 &pmx0 4 3 1 &pmx0 5 4 1
+                                       &pmx0 6 5 1 &pmx0 7 6 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK1>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio2: gpio@808000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x808000 0x1000>;
+                       interrupts = <0 66 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 7 1 &pmx0 1 8 1 &pmx0 2 9 1
+                                       &pmx0 3 10 1 &pmx0 4 3 1 &pmx0 5 3 1
+                                       &pmx0 6 3 1 &pmx0 7 3 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK2>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio3: gpio@809000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x809000 0x1000>;
+                       interrupts = <0 67 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 3 1 &pmx0 1 3 1 &pmx0 2 3 1
+                                       &pmx0 3 3 1 &pmx0 4 11 1 &pmx0 5 11 1
+                                       &pmx0 6 11 1 &pmx0 7 11 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK3>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio4: gpio@80a000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x80a000 0x1000>;
+                       interrupts = <0 68 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 11 1 &pmx0 1 11 1 &pmx0 2 11 1
+                                       &pmx0 3 11 1 &pmx0 4 12 1 &pmx0 5 12 1
+                                       &pmx0 6 13 1 &pmx0 7 13 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK4>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio5: gpio@80b000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x80b000 0x1000>;
+                       interrupts = <0 69 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 14 1 &pmx0 1 15 1 &pmx0 2 16 1
+                                       &pmx0 3 16 1 &pmx0 4 16 1 &pmx0 5 16 1
+                                       &pmx0 6 16 1 &pmx0 7 16 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK5>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio6: gpio@80c000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x80c000 0x1000>;
+                       interrupts = <0 70 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 16 1 &pmx0 1 16 1 &pmx0 2 17 1
+                                       &pmx0 3 17 1 &pmx0 4 18 1 &pmx0 5 18 1
+                                       &pmx0 6 18 1 &pmx0 7 19 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK6>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio7: gpio@80d000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x80d000 0x1000>;
+                       interrupts = <0 71 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 19 1 &pmx0 1 20 1 &pmx0 2 21 1
+                                       &pmx0 3 22 1 &pmx0 4 23 1 &pmx0 5 24 1
+                                       &pmx0 6 25 1 &pmx0 7 26 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK7>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio8: gpio@80e000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x80e000 0x1000>;
+                       interrupts = <0 72 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 27 1 &pmx0 1 28 1 &pmx0 2 29 1
+                                       &pmx0 3 30 1 &pmx0 4 31 1 &pmx0 5 32 1
+                                       &pmx0 6 33 1 &pmx0 7 34 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK8>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio9: gpio@80f000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x80f000 0x1000>;
+                       interrupts = <0 73 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 35 1 &pmx0 1 36 1 &pmx0 2 37 1
+                                       &pmx0 3 38 1 &pmx0 4 39 1 &pmx0 5 40 1
+                                       &pmx0 6 41 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK9>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio10: gpio@810000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x810000 0x1000>;
+                       interrupts = <0 74 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 2 43 1 &pmx0 3 44 1 &pmx0 4 45 1
+                                       &pmx0 5 45 1 &pmx0 6 46 1 &pmx0 7 46 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK10>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio11: gpio@811000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x811000 0x1000>;
+                       interrupts = <0 75 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 47 1 &pmx0 1 47 1 &pmx0 2 47 1
+                                       &pmx0 3 47 1 &pmx0 4 47 1 &pmx0 5 48 1
+                                       &pmx0 6 49 1 &pmx0 7 49 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK11>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio12: gpio@812000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x812000 0x1000>;
+                       interrupts = <0 76 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 49 1 &pmx0 1 50 1 &pmx0 2 49 1
+                                       &pmx0 3 49 1 &pmx0 4 51 1 &pmx0 5 51 1
+                                       &pmx0 6 51 1 &pmx0 7 52 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK12>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio13: gpio@813000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x813000 0x1000>;
+                       interrupts = <0 77 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 51 1 &pmx0 1 51 1 &pmx0 2 53 1
+                                       &pmx0 3 53 1 &pmx0 4 53 1 &pmx0 5 54 1
+                                       &pmx0 6 55 1 &pmx0 7 56 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK13>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio14: gpio@814000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x814000 0x1000>;
+                       interrupts = <0 78 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 57 1 &pmx0 1 97 1 &pmx0 2 97 1
+                                       &pmx0 3 58 1 &pmx0 4 59 1 &pmx0 5 60 1
+                                       &pmx0 6 60 1 &pmx0 7 61 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK14>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio15: gpio@815000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x815000 0x1000>;
+                       interrupts = <0 79 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 61 1 &pmx0 1 62 1 &pmx0 2 62 1
+                                       &pmx0 3 63 1 &pmx0 4 63 1 &pmx0 5 64 1
+                                       &pmx0 6 64 1 &pmx0 7 65 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK15>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio16: gpio@816000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x816000 0x1000>;
+                       interrupts = <0 80 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 66 1 &pmx0 1 67 1 &pmx0 2 68 1
+                                       &pmx0 3 69 1 &pmx0 4 70 1 &pmx0 5 71 1
+                                       &pmx0 6 72 1 &pmx0 7 73 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK16>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio17: gpio@817000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x817000 0x1000>;
+                       interrupts = <0 81 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 74 1 &pmx0 1 75 1 &pmx0 2 76 1
+                                       &pmx0 3 77 1 &pmx0 4 78 1 &pmx0 5 79 1
+                                       &pmx0 6 80 1 &pmx0 7 81 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK17>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio18: gpio@818000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x818000 0x1000>;
+                       interrupts = <0 82 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 82 1 &pmx0 1 83 1 &pmx0 2 83 1
+                                       &pmx0 3 84 1 &pmx0 4 84 1 &pmx0 5 85 1
+                                       &pmx0 6 86 1 &pmx0 7 87 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK18>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio19: gpio@819000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x819000 0x1000>;
+                       interrupts = <0 83 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 87 1 &pmx0 1 87 1 &pmx0 2 88 1
+                                       &pmx0 3 88 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK19>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio20: gpio@81a000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x81a000 0x1000>;
+                       interrupts = <0 84 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 0 89 1 &pmx0 1 89 1 &pmx0 2 90 1
+                                       &pmx0 3 90 1 &pmx0 4 91 1 &pmx0 5 92 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK20>;
+                       clock-names = "apb_pclk";
+               };
+
+               gpio21: gpio@81b000 {
+                       compatible = "arm,pl061", "arm,primecell";
+                       reg = <0x81b000 0x1000>;
+                       interrupts = <0 85 0x4>;
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       gpio-ranges = < &pmx0 3 94 1 &pmx0 7 96 1>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       clocks = <&clock HI3620_GPIOCLK21>;
+                       clock-names = "apb_pclk";
+               };
+
+               pmx0: pinmux@803000 {
+                       compatible = "pinctrl-single";
+                       reg = <0x803000 0x188>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       #gpio-range-cells = <3>;
+                       ranges;
+
+                       pinctrl-single,register-width = <32>;
+                       pinctrl-single,function-mask = <7>;
+                       /* pin base, nr pins & gpio function */
+                       pinctrl-single,gpio-range = <&range 0 3 0 &range 3 9 1
+                                               &range 12 1 0 &range 13 29 1
+                                               &range 43 1 0 &range 44 49 1
+                                               &range 94 1 1 &range 96 2 1>;
+
+                       range: gpio-range {
+                               #pinctrl-single,gpio-range-cells = <3>;
+                       };
+               };
+
+               pmx1: pinmux@803800 {
+                       compatible = "pinconf-single";
+                       reg = <0x803800 0x2dc>;
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+
+                       pinctrl-single,register-width = <32>;
+               };
+       };
+};
index c96ceaef7ddf565b448f5b3ba707ff80824d3cf2..581b75433be68b8bf01c44a48a8d8299cac95285 100644 (file)
                        };
 
                        dcp@80028000 {
+                               compatible = "fsl,imx23-dcp";
                                reg = <0x80028000 0x2000>;
-                               status = "disabled";
+                               interrupts = <53 54>;
+                               status = "okay";
                        };
 
                        pxp@8002a000 {
index cda19c8b0a470ecb6900255c8a9eb17b85bdf9dc..f8e9b20f69820c6948bd84b11a14166db6b4bdd3 100644 (file)
                        };
 
                        dcp: dcp@80028000 {
+                               compatible = "fsl,imx28-dcp", "fsl,imx23-dcp";
                                reg = <0x80028000 0x2000>;
                                interrupts = <52 53 54>;
-                               compatible = "fsl-dcp";
+                               status = "okay";
                        };
 
                        pxp: pxp@8002a000 {
index 0f06f8687b0bb46581be1b75dce84a4f93e303e5..88e3d477bf16394b0f789d855cabea0ae6217b9e 100644 (file)
                reg = <0x10000000 0x200>;
        };
 
+       ebi@12000000 {
+               compatible = "arm,external-bus-interface";
+               reg = <0x12000000 0x100>;
+       };
+
        timer@13000000 {
                reg = <0x13000000 0x100>;
                interrupt-parent = <&pic>;
index 7deb3a3182b42513d95bfdf34894692425a62c43..a21c17de9a5e9bcc8f1974deae775faa48aafd14 100644 (file)
                valid-mask = <0x00000007>;
        };
 
+       /* The SIC is cascaded off IRQ 26 on the PIC */
        sic: sic@ca000000 {
                compatible = "arm,versatile-fpga-irq";
+               interrupt-parent = <&pic>;
+               interrupts = <26>;
                #interrupt-cells = <1>;
                interrupt-controller;
                reg = <0xca000000 0x100>;
diff --git a/arch/arm/boot/dts/k2hk-evm.dts b/arch/arm/boot/dts/k2hk-evm.dts
new file mode 100644 (file)
index 0000000..eaefdfe
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2013 Texas Instruments, Inc.
+ *
+ * Keystone 2 Kepler/Hawking EVM device tree
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include "keystone.dtsi"
+
+/ {
+       compatible =  "ti,keystone-evm";
+
+       soc {
+               clock {
+                       refclksys: refclksys {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <122880000>;
+                               clock-output-names = "refclk-sys";
+                       };
+
+                       refclkpass: refclkpass {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <122880000>;
+                               clock-output-names = "refclk-pass";
+                       };
+
+                       refclkarm: refclkarm {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <125000000>;
+                               clock-output-names = "refclk-arm";
+                       };
+
+                       refclkddr3a: refclkddr3a {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <100000000>;
+                               clock-output-names = "refclk-ddr3a";
+                       };
+
+                       refclkddr3b: refclkddr3b {
+                               #clock-cells = <0>;
+                               compatible = "fixed-clock";
+                               clock-frequency = <100000000>;
+                               clock-output-names = "refclk-ddr3b";
+                       };
+               };
+       };
+};
+
+&usb_phy {
+       status = "okay";
+};
+
+&usb {
+       status = "okay";
+};
index d6713b113258f14523f813e04479c01a802b1d7f..2363593e1050b7b84b4705878fc10cb653b33cca 100644 (file)
@@ -13,17 +13,10 @@ clocks {
        #size-cells = <1>;
        ranges;
 
-       refclkmain: refclkmain {
-               #clock-cells = <0>;
-               compatible = "fixed-clock";
-               clock-frequency = <122880000>;
-               clock-output-names = "refclk-main";
-       };
-
        mainpllclk: mainpllclk@2310110 {
                #clock-cells = <0>;
                compatible = "ti,keystone,main-pll-clock";
-               clocks = <&refclkmain>;
+               clocks = <&refclksys>;
                reg = <0x02620350 4>, <0x02310110 4>;
                reg-names = "control", "multiplier";
                fixed-postdiv = <2>;
@@ -32,47 +25,43 @@ clocks {
        papllclk: papllclk@2620358 {
                #clock-cells = <0>;
                compatible = "ti,keystone,pll-clock";
-               clocks = <&refclkmain>;
+               clocks = <&refclkpass>;
                clock-output-names = "pa-pll-clk";
                reg = <0x02620358 4>;
                reg-names = "control";
-               fixed-postdiv = <6>;
        };
 
-       ddr3allclk: ddr3apllclk@2620360 {
+       ddr3apllclk: ddr3apllclk@2620360 {
                #clock-cells = <0>;
                compatible = "ti,keystone,pll-clock";
-               clocks = <&refclkmain>;
+               clocks = <&refclkddr3a>;
                clock-output-names = "ddr-3a-pll-clk";
                reg = <0x02620360 4>;
                reg-names = "control";
-               fixed-postdiv = <6>;
        };
 
-       ddr3bllclk: ddr3bpllclk@2620368 {
+       ddr3bpllclk: ddr3bpllclk@2620368 {
                #clock-cells = <0>;
                compatible = "ti,keystone,pll-clock";
-               clocks = <&refclkmain>;
+               clocks = <&refclkddr3b>;
                clock-output-names = "ddr-3b-pll-clk";
                reg = <0x02620368 4>;
                reg-names = "control";
-               fixed-postdiv = <6>;
        };
 
        armpllclk: armpllclk@2620370 {
                #clock-cells = <0>;
                compatible = "ti,keystone,pll-clock";
-               clocks = <&refclkmain>;
+               clocks = <&refclkarm>;
                clock-output-names = "arm-pll-clk";
                reg = <0x02620370 4>;
                reg-names = "control";
-               fixed-postdiv = <6>;
        };
 
        mainmuxclk: mainmuxclk@2310108 {
                #clock-cells = <0>;
                compatible = "ti,keystone,pll-mux-clock";
-               clocks = <&mainpllclk>, <&refclkmain>;
+               clocks = <&mainpllclk>, <&refclksys>;
                reg = <0x02310108 4>;
                bit-shift = <23>;
                bit-mask = <1>;
@@ -135,6 +124,15 @@ clocks {
                clock-output-names = "chipclk13";
        };
 
+       paclk13: paclk13 {
+               #clock-cells = <0>;
+               compatible = "fixed-factor-clock";
+               clocks = <&papllclk>;
+               clock-div = <3>;
+               clock-mult = <1>;
+               clock-output-names = "paclk13";
+       };
+
        chipclk14: chipclk14 {
                #clock-cells = <0>;
                compatible = "fixed-factor-clock";
diff --git a/arch/arm/boot/dts/keystone.dts b/arch/arm/boot/dts/keystone.dts
deleted file mode 100644 (file)
index 100bdf5..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 2013 Texas Instruments, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-/dts-v1/;
-#include <dt-bindings/interrupt-controller/arm-gic.h>
-
-#include "skeleton.dtsi"
-
-/ {
-       model = "Texas Instruments Keystone 2 SoC";
-       compatible =  "ti,keystone-evm";
-       #address-cells = <2>;
-       #size-cells = <2>;
-       interrupt-parent = <&gic>;
-
-       aliases {
-               serial0 = &uart0;
-       };
-
-       memory {
-               reg = <0x00000000 0x80000000 0x00000000 0x40000000>;
-       };
-
-       cpus {
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               interrupt-parent = <&gic>;
-
-               cpu@0 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <0>;
-               };
-
-               cpu@1 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <1>;
-               };
-
-               cpu@2 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <2>;
-               };
-
-               cpu@3 {
-                       compatible = "arm,cortex-a15";
-                       device_type = "cpu";
-                       reg = <3>;
-               };
-       };
-
-       gic: interrupt-controller {
-               compatible = "arm,cortex-a15-gic";
-               #interrupt-cells = <3>;
-               #size-cells = <0>;
-               #address-cells = <1>;
-               interrupt-controller;
-               reg = <0x0 0x02561000 0x0 0x1000>,
-                     <0x0 0x02562000 0x0 0x2000>;
-       };
-
-       timer {
-               compatible = "arm,armv7-timer";
-               interrupts =
-                       <GIC_PPI 13
-                               (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-                       <GIC_PPI 14
-                               (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-                       <GIC_PPI 11
-                               (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-                       <GIC_PPI 10
-                               (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
-       };
-
-       pmu {
-               compatible = "arm,cortex-a15-pmu";
-               interrupts = <GIC_SPI 20 IRQ_TYPE_EDGE_RISING>,
-                            <GIC_SPI 21 IRQ_TYPE_EDGE_RISING>,
-                            <GIC_SPI 22 IRQ_TYPE_EDGE_RISING>,
-                            <GIC_SPI 23 IRQ_TYPE_EDGE_RISING>;
-       };
-
-       soc {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               compatible = "ti,keystone","simple-bus";
-               interrupt-parent = <&gic>;
-               ranges = <0x0 0x0 0x0 0xc0000000>;
-
-               rstctrl: reset-controller {
-                       compatible = "ti,keystone-reset";
-                       reg = <0x023100e8 4>;   /* pll reset control reg */
-               };
-
-               /include/ "keystone-clocks.dtsi"
-
-               uart0: serial@02530c00 {
-                       compatible = "ns16550a";
-                       current-speed = <115200>;
-                       reg-shift = <2>;
-                       reg-io-width = <4>;
-                       reg = <0x02530c00 0x100>;
-                       clocks  = <&clkuart0>;
-                       interrupts = <GIC_SPI 277 IRQ_TYPE_EDGE_RISING>;
-               };
-
-               uart1:  serial@02531000 {
-                       compatible = "ns16550a";
-                       current-speed = <115200>;
-                       reg-shift = <2>;
-                       reg-io-width = <4>;
-                       reg = <0x02531000 0x100>;
-                       clocks  = <&clkuart1>;
-                       interrupts = <GIC_SPI 280 IRQ_TYPE_EDGE_RISING>;
-               };
-
-               i2c0: i2c@2530000 {
-                       compatible = "ti,davinci-i2c";
-                       reg = <0x02530000 0x400>;
-                       clock-frequency = <100000>;
-                       clocks = <&clki2c>;
-                       interrupts = <GIC_SPI 283 IRQ_TYPE_EDGE_RISING>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-
-                       dtt@50 {
-                               compatible = "at,24c1024";
-                               reg = <0x50>;
-                       };
-               };
-
-               i2c1: i2c@2530400 {
-                       compatible = "ti,davinci-i2c";
-                       reg = <0x02530400 0x400>;
-                       clock-frequency = <100000>;
-                       clocks = <&clki2c>;
-                       interrupts = <GIC_SPI 286 IRQ_TYPE_EDGE_RISING>;
-               };
-
-               i2c2: i2c@2530800 {
-                       compatible = "ti,davinci-i2c";
-                       reg = <0x02530800 0x400>;
-                       clock-frequency = <100000>;
-                       clocks = <&clki2c>;
-                       interrupts = <GIC_SPI 289 IRQ_TYPE_EDGE_RISING>;
-               };
-
-               spi0: spi@21000400 {
-                       compatible = "ti,dm6441-spi";
-                       reg = <0x21000400 0x200>;
-                       num-cs = <4>;
-                       ti,davinci-spi-intr-line = <0>;
-                       interrupts = <GIC_SPI 292 IRQ_TYPE_EDGE_RISING>;
-                       clocks = <&clkspi>;
-               };
-
-               spi1: spi@21000600 {
-                       compatible = "ti,dm6441-spi";
-                       reg = <0x21000600 0x200>;
-                       num-cs = <4>;
-                       ti,davinci-spi-intr-line = <0>;
-                       interrupts = <GIC_SPI 296 IRQ_TYPE_EDGE_RISING>;
-                       clocks = <&clkspi>;
-               };
-
-               spi2: spi@21000800 {
-                       compatible = "ti,dm6441-spi";
-                       reg = <0x21000800 0x200>;
-                       num-cs = <4>;
-                       ti,davinci-spi-intr-line = <0>;
-                       interrupts = <GIC_SPI 300 IRQ_TYPE_EDGE_RISING>;
-                       clocks = <&clkspi>;
-               };
-       };
-};
diff --git a/arch/arm/boot/dts/keystone.dtsi b/arch/arm/boot/dts/keystone.dtsi
new file mode 100644 (file)
index 0000000..b420290
--- /dev/null
@@ -0,0 +1,212 @@
+/*
+ * Copyright 2013 Texas Instruments, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+#include "skeleton.dtsi"
+
+/ {
+       model = "Texas Instruments Keystone 2 SoC";
+       #address-cells = <2>;
+       #size-cells = <2>;
+       interrupt-parent = <&gic>;
+
+       aliases {
+               serial0 = &uart0;
+       };
+
+       memory {
+               reg = <0x00000000 0x80000000 0x00000000 0x40000000>;
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               interrupt-parent = <&gic>;
+
+               cpu@0 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <0>;
+               };
+
+               cpu@1 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <1>;
+               };
+
+               cpu@2 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <2>;
+               };
+
+               cpu@3 {
+                       compatible = "arm,cortex-a15";
+                       device_type = "cpu";
+                       reg = <3>;
+               };
+       };
+
+       gic: interrupt-controller {
+               compatible = "arm,cortex-a15-gic";
+               #interrupt-cells = <3>;
+               #size-cells = <0>;
+               #address-cells = <1>;
+               interrupt-controller;
+               reg = <0x0 0x02561000 0x0 0x1000>,
+                     <0x0 0x02562000 0x0 0x2000>,
+                     <0x0 0x02564000 0x0 0x1000>,
+                     <0x0 0x02566000 0x0 0x2000>;
+               interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) |
+                               IRQ_TYPE_LEVEL_HIGH)>;
+       };
+
+       timer {
+               compatible = "arm,armv7-timer";
+               interrupts =
+                       <GIC_PPI 13
+                               (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                       <GIC_PPI 14
+                               (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                       <GIC_PPI 11
+                               (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                       <GIC_PPI 10
+                               (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+       };
+
+       pmu {
+               compatible = "arm,cortex-a15-pmu";
+               interrupts = <GIC_SPI 20 IRQ_TYPE_EDGE_RISING>,
+                            <GIC_SPI 21 IRQ_TYPE_EDGE_RISING>,
+                            <GIC_SPI 22 IRQ_TYPE_EDGE_RISING>,
+                            <GIC_SPI 23 IRQ_TYPE_EDGE_RISING>;
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "ti,keystone","simple-bus";
+               interrupt-parent = <&gic>;
+               ranges = <0x0 0x0 0x0 0xc0000000>;
+
+               rstctrl: reset-controller {
+                       compatible = "ti,keystone-reset";
+                       reg = <0x023100e8 4>;   /* pll reset control reg */
+               };
+
+               /include/ "keystone-clocks.dtsi"
+
+               uart0: serial@02530c00 {
+                       compatible = "ns16550a";
+                       current-speed = <115200>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       reg = <0x02530c00 0x100>;
+                       clocks  = <&clkuart0>;
+                       interrupts = <GIC_SPI 277 IRQ_TYPE_EDGE_RISING>;
+               };
+
+               uart1:  serial@02531000 {
+                       compatible = "ns16550a";
+                       current-speed = <115200>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       reg = <0x02531000 0x100>;
+                       clocks  = <&clkuart1>;
+                       interrupts = <GIC_SPI 280 IRQ_TYPE_EDGE_RISING>;
+               };
+
+               i2c0: i2c@2530000 {
+                       compatible = "ti,davinci-i2c";
+                       reg = <0x02530000 0x400>;
+                       clock-frequency = <100000>;
+                       clocks = <&clki2c>;
+                       interrupts = <GIC_SPI 283 IRQ_TYPE_EDGE_RISING>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       dtt@50 {
+                               compatible = "at,24c1024";
+                               reg = <0x50>;
+                       };
+               };
+
+               i2c1: i2c@2530400 {
+                       compatible = "ti,davinci-i2c";
+                       reg = <0x02530400 0x400>;
+                       clock-frequency = <100000>;
+                       clocks = <&clki2c>;
+                       interrupts = <GIC_SPI 286 IRQ_TYPE_EDGE_RISING>;
+               };
+
+               i2c2: i2c@2530800 {
+                       compatible = "ti,davinci-i2c";
+                       reg = <0x02530800 0x400>;
+                       clock-frequency = <100000>;
+                       clocks = <&clki2c>;
+                       interrupts = <GIC_SPI 289 IRQ_TYPE_EDGE_RISING>;
+               };
+
+               spi0: spi@21000400 {
+                       compatible = "ti,dm6441-spi";
+                       reg = <0x21000400 0x200>;
+                       num-cs = <4>;
+                       ti,davinci-spi-intr-line = <0>;
+                       interrupts = <GIC_SPI 292 IRQ_TYPE_EDGE_RISING>;
+                       clocks = <&clkspi>;
+               };
+
+               spi1: spi@21000600 {
+                       compatible = "ti,dm6441-spi";
+                       reg = <0x21000600 0x200>;
+                       num-cs = <4>;
+                       ti,davinci-spi-intr-line = <0>;
+                       interrupts = <GIC_SPI 296 IRQ_TYPE_EDGE_RISING>;
+                       clocks = <&clkspi>;
+               };
+
+               spi2: spi@21000800 {
+                       compatible = "ti,dm6441-spi";
+                       reg = <0x21000800 0x200>;
+                       num-cs = <4>;
+                       ti,davinci-spi-intr-line = <0>;
+                       interrupts = <GIC_SPI 300 IRQ_TYPE_EDGE_RISING>;
+                       clocks = <&clkspi>;
+               };
+
+               usb_phy: usb_phy@2620738 {
+                       compatible = "ti,keystone-usbphy";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x2620738 32>;
+                       status = "disabled";
+               };
+
+               usb: usb@2680000 {
+                       compatible = "ti,keystone-dwc3";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x2680000 0x10000>;
+                       clocks = <&clkusb>;
+                       clock-names = "usb";
+                       interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>;
+                       ranges;
+                       status = "disabled";
+
+                       dwc3@2690000 {
+                               compatible = "synopsys,dwc3";
+                               reg = <0x2690000 0x70000>;
+                               interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>;
+                               usb-phy = <&usb_phy>, <&usb_phy>;
+                       };
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/kirkwood-6192.dtsi b/arch/arm/boot/dts/kirkwood-6192.dtsi
new file mode 100644 (file)
index 0000000..3916937
--- /dev/null
@@ -0,0 +1,107 @@
+/ {
+       mbus {
+               pcie-controller {
+                       compatible = "marvell,kirkwood-pcie";
+                       status = "disabled";
+                       device_type = "pci";
+
+                       #address-cells = <3>;
+                       #size-cells = <2>;
+
+                       bus-range = <0x00 0xff>;
+
+                       ranges =
+                              <0x82000000 0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x00002000
+                               0x82000000 0x1 0     MBUS_ID(0x04, 0xe8) 0       1 0 /* Port 0.0 MEM */
+                               0x81000000 0x1 0     MBUS_ID(0x04, 0xe0) 0       1 0 /* Port 0.0 IO  */>;
+
+                       pcie@1,0 {
+                               device_type = "pci";
+                               assigned-addresses = <0x82000800 0 0x00040000 0 0x2000>;
+                               reg = <0x0800 0 0 0 0>;
+                               #address-cells = <3>;
+                               #size-cells = <2>;
+                               #interrupt-cells = <1>;
+                               ranges = <0x82000000 0 0 0x82000000 0x1 0 1 0
+                                         0x81000000 0 0 0x81000000 0x1 0 1 0>;
+                               interrupt-map-mask = <0 0 0 0>;
+                               interrupt-map = <0 0 0 0 &intc 9>;
+                               marvell,pcie-port = <0>;
+                               marvell,pcie-lane = <0>;
+                               clocks = <&gate_clk 2>;
+                               status = "disabled";
+                       };
+               };
+       };
+
+       ocp@f1000000 {
+               pinctrl: pinctrl@10000 {
+                       compatible = "marvell,88f6192-pinctrl";
+                       reg = <0x10000 0x20>;
+
+                       pmx_nand: pmx-nand {
+                               marvell,pins = "mpp0", "mpp1", "mpp2", "mpp3",
+                                              "mpp4", "mpp5", "mpp18",
+                                              "mpp19";
+                               marvell,function = "nand";
+                       };
+                       pmx_sata0: pmx-sata0 {
+                               marvell,pins = "mpp5", "mpp21", "mpp23";
+                               marvell,function = "sata0";
+                       };
+                       pmx_sata1: pmx-sata1 {
+                               marvell,pins = "mpp4", "mpp20", "mpp22";
+                               marvell,function = "sata1";
+                       };
+                       pmx_spi: pmx-spi {
+                               marvell,pins = "mpp0", "mpp1", "mpp2", "mpp3";
+                               marvell,function = "spi";
+                       };
+                       pmx_twsi0: pmx-twsi0 {
+                               marvell,pins = "mpp8", "mpp9";
+                               marvell,function = "twsi0";
+                       };
+                       pmx_uart0: pmx-uart0 {
+                               marvell,pins = "mpp10", "mpp11";
+                               marvell,function = "uart0";
+                       };
+                       pmx_uart1: pmx-uart1 {
+                               marvell,pins = "mpp13", "mpp14";
+                               marvell,function = "uart1";
+                       };
+                       pmx_sdio: pmx-sdio {
+                               marvell,pins = "mpp12", "mpp13", "mpp14",
+                                              "mpp15", "mpp16", "mpp17";
+                               marvell,function = "sdio";
+                       };
+               };
+
+               rtc@10300 {
+                       compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc";
+                       reg = <0x10300 0x20>;
+                       interrupts = <53>;
+                       clocks = <&gate_clk 7>;
+               };
+
+               sata@80000 {
+                       compatible = "marvell,orion-sata";
+                       reg = <0x80000 0x5000>;
+                       interrupts = <21>;
+                       clocks = <&gate_clk 14>, <&gate_clk 15>;
+                       clock-names = "0", "1";
+                       status = "disabled";
+               };
+
+               mvsdio@90000 {
+                       compatible = "marvell,orion-sdio";
+                       reg = <0x90000 0x200>;
+                       interrupts = <28>;
+                       clocks = <&gate_clk 4>;
+                       bus-width = <4>;
+                       cap-sdio-irq;
+                       cap-sd-highspeed;
+                       cap-mmc-highspeed;
+                       status = "disabled";
+               };
+       };
+};
index 650ef30e1856f9591f32a445f279489c82b22b68..416d96e1302fab6e9af0d61ebb5cdbbe0290cfa7 100644 (file)
@@ -89,6 +89,8 @@
                        interrupts = <21>;
                        clocks = <&gate_clk 14>, <&gate_clk 15>;
                        clock-names = "0", "1";
+                       phys = <&sata_phy0>, <&sata_phy1>;
+                       phy-names = "port0", "port1";
                        status = "disabled";
                };
 
@@ -97,6 +99,8 @@
                        reg = <0x90000 0x200>;
                        interrupts = <28>;
                        clocks = <&gate_clk 4>;
+                       pinctrl-0 = <&pmx_sdio>;
+                       pinctrl-names = "default";
                        bus-width = <4>;
                        cap-sdio-irq;
                        cap-sd-highspeed;
index 3933a331ddc2ed8d8f71b58c4cc7389e7e860220..2902e0d7971d061599d13ef8733e3a3c4ad49fd2 100644 (file)
                        };
                };
 
+               thermal@10078 {
+                       compatible = "marvell,kirkwood-thermal";
+                       reg = <0x10078 0x4>;
+                       status = "okay";
+               };
+
                rtc@10300 {
                        compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc";
                        reg = <0x10300 0x20>;
                        clocks = <&gate_clk 7>;
                };
 
+               i2c@11100 {
+                       compatible = "marvell,mv64xxx-i2c";
+                       reg = <0x11100 0x20>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <32>;
+                       clock-frequency = <100000>;
+                       clocks = <&gate_clk 7>;
+                       status = "disabled";
+               };
+
                sata@80000 {
                        compatible = "marvell,orion-sata";
                        reg = <0x80000 0x5000>;
                        interrupts = <21>;
                        clocks = <&gate_clk 14>, <&gate_clk 15>;
                        clock-names = "0", "1";
+                       phys = <&sata_phy0>, <&sata_phy1>;
+                       phy-names = "port0", "port1";
                        status = "disabled";
                };
 
                        reg = <0x90000 0x200>;
                        interrupts = <28>;
                        clocks = <&gate_clk 4>;
+                       pinctrl-0 = <&pmx_sdio>;
+                       pinctrl-names = "default";
                        bus-width = <4>;
                        cap-sdio-irq;
                        cap-sd-highspeed;
                        cap-mmc-highspeed;
                        status = "disabled";
                };
-
-               thermal@10078 {
-                       compatible = "marvell,kirkwood-thermal";
-                       reg = <0x10078 0x4>;
-                       status = "okay";
-               };
-
-               i2c@11100 {
-                       compatible = "marvell,mv64xxx-i2c";
-                       reg = <0x11100 0x20>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       interrupts = <32>;
-                       clock-frequency = <100000>;
-                       clocks = <&gate_clk 7>;
-                       status = "disabled";
-               };
-
        };
 };
index 142b9cd3b4541d9fbc8205ad2770c2084a6dfee3..bb4df405527c825b8dbfb7df8ba3c5330f8163c0 100644 (file)
@@ -66,8 +66,8 @@
 
                button@1 {
                        label = "Power push button";
-                       linux,code = <116>;
-                       gpios = <&gpio0 16 1>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
                };
        };
 
 
                red-fail {
                        label = "cloudbox:red:fail";
-                       gpios = <&gpio0 14 0>;
+                       gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
                };
                blue-sata {
                        label = "cloudbox:blue:sata";
-                       gpios = <&gpio0 15 0>;
+                       gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
                };
        };
 
        gpio_poweroff {
                compatible = "gpio-poweroff";
-               gpios = <&gpio0 17 0>;
+               gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
        };
 };
 
index 053aa20fb30f88a0e13be1878e9d9d6ba241c4c2..afebc157031828ddd850a6186cbdfb5e6e42b869 100644 (file)
@@ -51,8 +51,8 @@
                mvsdio@90000 {
                        pinctrl-0 = <&pmx_sdio_gpios>;
                        pinctrl-names = "default";
-                       wp-gpios = <&gpio1 5 0>;
-                       cd-gpios = <&gpio1 6 0>;
+                       wp-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
+                       cd-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
                        status = "okay";
                };
        };
index e112ca62d978e9ccdedfb37d06bec0b8fe036de8..bf7fe8ab88f4353d0e1688d7fdf8cbd9718e1f7e 100644 (file)
 
                blue-power {
                        label = "dns320:blue:power";
-                       gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
                };
                blue-usb {
                        label = "dns320:blue:usb";
-                       gpios = <&gpio1 11 1>; /* GPIO 43 Active Low */
+                       gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
                };
                orange-l_hdd {
                        label = "dns320:orange:l_hdd";
-                       gpios = <&gpio0 28 1>; /* GPIO 28 Active Low */
+                       gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
                };
                orange-r_hdd {
                        label = "dns320:orange:r_hdd";
-                       gpios = <&gpio0 27 1>; /* GPIO 27 Active Low */
+                       gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
                };
                orange-usb {
                        label = "dns320:orange:usb";
-                       gpios = <&gpio1 3 1>; /* GPIO 35 Active Low */
+                       gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; /* GPIO 35 */
                };
        };
 
index 5119fb8a8eb6203c5743294246bdd62731da7523..cb9978c652f2d1635b762e5aa3ef09097aa0b79e 100644 (file)
 
                white-power {
                        label = "dns325:white:power";
-                       gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
                };
                white-usb {
                        label = "dns325:white:usb";
-                       gpios = <&gpio1 11 1>; /* GPIO 43 Active Low */
+                       gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; /* GPIO 43 */
                };
                red-l_hdd {
                        label = "dns325:red:l_hdd";
-                       gpios = <&gpio0 28 1>; /* GPIO 28 Active Low */
+                       gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
                };
                red-r_hdd {
                        label = "dns325:red:r_hdd";
-                       gpios = <&gpio0 27 1>; /* GPIO 27 Active Low */
+                       gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
                };
                red-usb {
                        label = "dns325:red:usb";
-                       gpios = <&gpio0 29 1>; /* GPIO 29 Active Low */
+                       gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
                };
        };
 
index aefa375a550d3ac0e7615cd76ba50e83c99ac094..12087566ac6de1ba640f8875390ec125c5dec7a1 100644 (file)
 
                button@1 {
                        label = "Power button";
-                       linux,code = <116>;
-                       gpios = <&gpio1 2 1>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
                };
                button@2 {
                        label = "USB unmount button";
-                       linux,code = <161>;
-                       gpios = <&gpio1 15 1>;
+                       linux,code = <KEY_EJECTCD>;
+                       gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
                };
                button@3 {
                        label = "Reset button";
-                       linux,code = <0x198>;
-                       gpios = <&gpio1 16 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
                };
        };
 
@@ -35,8 +35,8 @@
                compatible = "gpio-fan";
                pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>;
                pinctrl-names = "default";
-               gpios = <&gpio1 14 1
-                        &gpio1 13 1>;
+               gpios = <&gpio1 14 GPIO_ACTIVE_LOW
+                        &gpio1 13 GPIO_ACTIVE_LOW>;
                gpio-fan,speed-map = <0    0
                                      3000 1
                                      6000 2>;
@@ -46,7 +46,7 @@
                compatible = "gpio-poweroff";
                pinctrl-0 = <&pmx_power_off>;
                pinctrl-names = "default";
-               gpios = <&gpio1 4 0>;
+               gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
        };
 
        ocp@f1000000 {
index 33ff368fbfa5696353353fc5151b4fefd7cc6198..2a41c75c5c21f4118a8db5662602452632c84eeb 100644 (file)
 
                health {
                        label = "status:green:health";
-                       gpios = <&gpio1 14 1>;
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
                };
                fault {
                        label = "status:orange:fault";
-                       gpios = <&gpio1 15 1>;
+                       gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
                };
        };
        regulators {
index 6f62af99c9cbebe4da42d000c6ae28c34054e52f..a7558375e06f15ec08a3194145314edb11964072 100644 (file)
 
                bluetooth {
                        label = "dreamplug:blue:bluetooth";
-                       gpios = <&gpio1 15 1>;
+                       gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
                };
                wifi {
                        label = "dreamplug:green:wifi";
-                       gpios = <&gpio1 16 1>;
+                       gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
                };
                wifi-ap {
                        label = "dreamplug:green:wifi_ap";
-                       gpios = <&gpio1 17 1>;
+                       gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
                };
        };
 };
index a43bebb251102fbbfcde84e58f1955ce52f5de5b..c2e512953570a729717999f046924496fc2aa223 100644 (file)
 
                health {
                        label = "status:green:health";
-                       gpios = <&gpio1 14 1>;
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
                };
                fault {
                        label = "status:orange:fault";
-                       gpios = <&gpio1 15 1>;
+                       gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
                };
                left0 {
                        label = "status:white:left0";
-                       gpios = <&gpio1 10 0>;
+                       gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
                };
                left1 {
                        label = "status:white:left1";
-                       gpios = <&gpio1 11 0>;
+                       gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
                };
                left2 {
                        label = "status:white:left2";
-                       gpios = <&gpio1 12 0>;
+                       gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
                };
                left3 {
                        label = "status:white:left3";
-                       gpios = <&gpio1 13 0>;
+                       gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
                };
                right0 {
                        label = "status:white:right0";
-                       gpios = <&gpio1 6 0>;
+                       gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
                };
                right1 {
                        label = "status:white:right1";
-                       gpios = <&gpio1 7 0>;
+                       gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
                };
                right2 {
                        label = "status:white:right2";
-                       gpios = <&gpio1 8 0>;
+                       gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
                };
                right3 {
                        label = "status:white:right3";
-                       gpios = <&gpio1 9 0>;
+                       gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
                };
        };
        regulators {
                        enable-active-high;
                        regulator-always-on;
                        regulator-boot-on;
-                       gpio = <&gpio0 29 0>;
+                       gpio = <&gpio0 29 GPIO_ACTIVE_HIGH>;
                };
        };
 };
index d30a91a5047d6939c2dfdd69989bde39c359f9b7..0b557d5cb723823ddce68e5261488c2e815bd45a 100644 (file)
                        nr-ports = <1>;
                };
 
+               /* AzureWave AW-GH381 WiFi/BT */
                mvsdio@90000 {
                        status = "okay";
-                       /* No CD or WP GPIOs */
-                       broken-cd;
+                       non-removable;
                };
        };
 
 
                health-r {
                        label = "guruplug:red:health";
-                       gpios = <&gpio1 14 1>;
+                       gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
                };
                health-g {
                        label = "guruplug:green:health";
-                       gpios = <&gpio1 15 1>;
+                       gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
                };
                wmode-r {
                        label = "guruplug:red:wmode";
-                       gpios = <&gpio1 16 1>;
+                       gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
                };
                wmode-g {
                        label = "guruplug:green:wmode";
-                       gpios = <&gpio1 17 1>;
+                       gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
                };
        };
 };
index c5fb02f7ebc3e33107ac067d46a6394d6c21b27d..6ccc78866e6dc97b14884c521eb7b93ec9c5a942 100644 (file)
 
                button@1 {
                        label = "USB Copy";
-                       linux,code = <133>;
-                       gpios = <&gpio0 29 1>;
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
                };
                button@2 {
                        label = "Reset";
-                       linux,code = <0x198>;
-                       gpios = <&gpio0 28 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
                };
        };
 
 
                green-os {
                        label = "ib62x0:green:os";
-                       gpios = <&gpio0 25 0>;
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
+                       default-state = "keep";
                };
                red-os {
                        label = "ib62x0:red:os";
-                       gpios = <&gpio0 22 0>;
+                       gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
                };
                usb-copy {
                        label = "ib62x0:red:usb_copy";
-                       gpios = <&gpio0 27 0>;
+                       gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
                };
        };
 
@@ -98,7 +98,7 @@
                compatible = "gpio-poweroff";
                pinctrl-0 = <&pmx_power_off>;
                pinctrl-names = "default";
-               gpios = <&gpio0 24 0>;
+               gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
        };
 };
 
index 4a62b206f680b4c1261a404ce16ce26fb498f6c0..f7636291de77bbec296f632c528bebd7303d7ec4 100644 (file)
 
                led-level {
                        label = "led_level";
-                       gpios = <&gpio1 9 0>;
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
                };
                power-blue {
                        label = "power:blue";
-                       gpios = <&gpio1 10 0>;
-                       linux,default-trigger = "timer";
+                       gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
+                       default-state = "keep";
                };
                power-red {
                        label = "power:red";
-                       gpios = <&gpio1 11 0>;
+                       gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
                };
                usb1 {
                        label = "usb1:blue";
-                       gpios = <&gpio1 12 0>;
+                       gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
                };
                usb2 {
                        label = "usb2:blue";
-                       gpios = <&gpio1 13 0>;
+                       gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
                };
                usb3 {
                        label = "usb3:blue";
-                       gpios = <&gpio1 14 0>;
+                       gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
                };
                usb4 {
                        label = "usb4:blue";
-                       gpios = <&gpio1 15 0>;
+                       gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
                };
                otb {
                        label = "otb:blue";
-                       gpios = <&gpio1 16 0>;
+                       gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
                };
        };
 
 
                button@1 {
                        label = "OTB Button";
-                       linux,code = <133>;
-                       gpios = <&gpio1 3 1>;
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
                        debounce-interval = <100>;
                };
                button@2 {
                        label = "Reset";
-                       linux,code = <0x198>;
-                       gpios = <&gpio0 12 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
                        debounce-interval = <100>;
                };
        };
index d15395d671ededf4caf501518bb1e33ffba0cba8..589000631b5a581e23a9afa8b469c2c513e7ff59 100644 (file)
 
                power_led {
                        label = "status:white:power_led";
-                       gpios = <&gpio0 16 0>;
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+                       default-state = "keep";
                };
                rebuild_led {
                        label = "status:white:rebuild_led";
-                       gpios = <&gpio1 4 0>;
+                       gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
                };
                health_led {
                        label = "status:red:health_led";
-                       gpios = <&gpio1 5 0>;
+                       gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
                };
                backup_led {
                        label = "status:blue:backup_led";
-                       gpios = <&gpio0 15 0>;
+                       gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
                };
        };
        gpio-keys {
 
                Power {
                        label = "Power Button";
-                       linux,code = <116>;
-                       gpios = <&gpio0 14 1>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
                };
                Reset {
                        label = "Reset Button";
-                       linux,code = <0x198>;
-                       gpios = <&gpio0 12 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
                };
                OTB {
                        label = "OTB Button";
-                       linux,code = <133>;
-                       gpios = <&gpio1 3 1>;
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
                };
        };
 };
index cd44f37e54b5b7fb81f6c53f966abc9e3e511c8e..5b5808ebc6e0771a521ac9e4e72eac78149149df 100644 (file)
@@ -38,8 +38,8 @@
 
        i2c@0 {
                compatible = "i2c-gpio";
-               gpios = < &gpio0 8 0            /* sda */
-                       &gpio0 9 0 >;           /* scl */
+               gpios = < &gpio0 8 GPIO_ACTIVE_HIGH             /* sda */
+                         &gpio0 9 GPIO_ACTIVE_HIGH>;           /* scl */
                i2c-gpio,delay-us = <2>;        /* ~100 kHz */
        };
 };
diff --git a/arch/arm/boot/dts/kirkwood-laplug.dts b/arch/arm/boot/dts/kirkwood-laplug.dts
new file mode 100644 (file)
index 0000000..c9e82ef
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2013 Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include "kirkwood.dtsi"
+#include "kirkwood-6192.dtsi"
+
+/ {
+       model = "LaCie LaPlug";
+       compatible = "lacie,laplug", "marvell,kirkwood-88f6192", "marvell,kirkwood";
+
+       memory {
+               device_type = "memory";
+               reg = <0x00000000 0x8000000>; /* 128 MB */
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8 earlyprintk";
+       };
+
+       mbus {
+               pcie-controller {
+                       status = "okay";
+                       pcie@1,0 {
+                               status = "okay";
+                       };
+               };
+       };
+
+       ocp@f1000000 {
+               serial@12000 {
+                       pinctrl-0 = <&pmx_uart0>;
+                       pinctrl-names = "default";
+                       status = "okay";
+               };
+
+               i2c@11000 {
+                       pinctrl-0 = <&pmx_twsi0>;
+                       pinctrl-names = "default";
+                       status = "okay";
+
+                       eeprom@50 {
+                               compatible = "at,24c04";
+                               pagesize = <16>;
+                               reg = <0x50>;
+                       };
+               };
+
+               pinctrl: pinctrl@10000 {
+                       pmx_usb_power_enable: pmx-usb-power-enable {
+                               marvell,pins = "mpp14";
+                               marvell,function = "gpio";
+                       };
+               };
+       };
+
+       gpio_keys {
+               compatible = "gpio-keys";
+
+               button@1{
+                       label = "Power push button";
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               red-fail {
+                       label = "laplug_v2:red:power";
+                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+               };
+               blue-power {
+                       label = "laplug_v2:blue:power";
+                       gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "default-on";
+               };
+       };
+
+       gpio_poweroff {
+               compatible = "gpio-poweroff";
+               gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               pinctrl-0 = <&pmx_usb_power_enable>;
+               pinctrl-names = "default";
+
+               usb_power_back1: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "USB Power Back 1";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       gpio = <&gpio0 15 GPIO_ACTIVE_HIGH>;
+               };
+
+               usb_power_back2: regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "USB Power Back 2";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       gpio = <&gpio0 28 GPIO_ACTIVE_HIGH>;
+               };
+
+               usb_power_front: regulator@3 {
+                       compatible = "regulator-fixed";
+                       reg = <3>;
+                       regulator-name = "USB Power Front";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&nand {
+       /* Total size : 512MB */
+       status = "okay";
+       pinctrl-0 = <&pmx_nand>;
+
+       partition@0 {
+               label = "u-boot";
+               reg = <0x0 0x100000>; /* 1MB */
+               read-only;
+       };
+
+       partition@100000 {
+               label = "uImage";
+               reg = <0x100000 0x1000000>; /* 16MB */
+       };
+
+       partition@1100000 {
+               label = "rootfs";
+               reg = <0x1100000 0x1EF00000>; /* 495MB */
+       };
+};
+
+&mdio {
+       status = "okay";
+
+       ethphy0: ethernet-phy@0 {
+               device_type = "ethernet-phy";
+               reg = <0>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+       ethernet0-port@0 {
+               phy-handle = <&ethphy0>;
+       };
+};
index 4e8f9e42c5929135e05109142bcec7100ed83d02..fc1cd3b7b9687c190fc27122cee71aabc2dd8208 100644 (file)
 
                button@1 {
                        label = "Function Button";
-                       linux,code = <357>;
-                       gpios = <&gpio1 9 1>;
+                       linux,code = <KEY_OPTION>;
+                       gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
                };
                button@2 {
                        label = "Power-on Switch";
-                       linux,code = <0>;
+                       linux,code = <KEY_RESERVED>;
                        linux,input-type = <5>;
-                       gpios = <&gpio1 10 1>;
+                       gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
                };
                button@3 {
                        label = "Power-auto Switch";
-                       linux,code = <1>;
+                       linux,code = <KEY_ESC>;
                        linux,input-type = <5>;
-                       gpios = <&gpio1 11 1>;
+                       gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
                };
        };
 
 
                led@1 {
                        label = "lsxl:blue:func";
-                       gpios = <&gpio1 4 1>;
+                       gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
                };
 
                led@2 {
                        label = "lsxl:red:alarm";
-                       gpios = <&gpio1 5 1>;
+                       gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
                };
 
                led@3 {
                        label = "lsxl:amber:info";
-                       gpios = <&gpio1 6 1>;
+                       gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
                };
 
                led@4 {
                        label = "lsxl:blue:power";
-                       gpios = <&gpio1 7 1>;
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
                };
 
                led@5 {
                        label = "lsxl:red:func";
-                       gpios = <&gpio1 16 1>;
+                       gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
                };
        };
 
                compatible = "gpio-fan";
                pinctrl-0 = <&pmx_fan_low &pmx_fan_high &pmx_fan_lock>;
                pinctrl-names = "default";
-               gpios = <&gpio0 19 1
-                        &gpio0 18 1>;
+               gpios = <&gpio0 19 GPIO_ACTIVE_LOW
+                        &gpio0 18 GPIO_ACTIVE_LOW>;
                gpio-fan,speed-map = <0    3
                                      1500 2
                                      3250 1
                                      5000 0>;
-               alarm-gpios = <&gpio1 8 0>;
+               alarm-gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
        };
 
        restart_poweroff {
index 6c1ec2786e6e2f77c334292bab84b4e24d4cfef6..c20607cd7d7c774d7819b6cb2aba522cc2bad3eb 100644 (file)
                        pinctrl-0 = <&pmx_sdio &pmx_sdio_cd>;
                        pinctrl-names = "default";
                        status = "okay";
-                       cd-gpios = <&gpio1 15 1>;
+                       cd-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
                        /* No WP GPIO */
                };
        };
 
                health {
                        label = "status:green:health";
-                       gpios = <&gpio0 7 1>;
+                       gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
                };
 
                user1o {
                        label = "user1:orange";
-                       gpios = <&gpio1 8 1>;
+                       gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
                        default-state = "on";
                };
 
                user1g {
                        label = "user1:green";
-                       gpios = <&gpio1 9 1>;
+                       gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
                        default-state = "on";
                };
 
                user0o {
                        label = "user0:orange";
-                       gpios = <&gpio1 12 1>;
+                       gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
                        default-state = "on";
                };
 
                user0g {
                        label = "user0:green";
-                       gpios = <&gpio1 13 1>;
+                       gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
                        default-state = "on";
                };
 
                misc {
                        label = "status:orange:misc";
-                       gpios = <&gpio1 14 1>;
+                       gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
                        default-state = "on";
                };
 
index 6317e1d088b3e16b89df5e9620c19f053ac34451..dc86429756d79787a780946668e2a80cd50fa893 100644 (file)
 
                green-status {
                        label = "gtw:green:Status";
-                       gpios = <&gpio0 20 0>;
+                       gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
                };
 
                red-status {
                        label = "gtw:red:Status";
-                       gpios = <&gpio0 21 0>;
+                       gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
                };
 
                green-usb {
                        label = "gtw:green:USB";
-                       gpios = <&gpio0 12 0>;
+                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
                };
        };
 
 
                button@1 {
                        label = "SWR Button";
-                       linux,code = <0x198>; /* KEY_RESTART */
-                       gpios = <&gpio1 15 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
                };
                button@2 {
                        label = "WPS Button";
-                       linux,code = <0x211>; /* KEY_WPS_BUTTON */
-                       gpios = <&gpio1 14 1>;
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
                };
        };
 };
index e6a102cf424cd646d9e121acd2b821ea46bb81be..4d2a8db9ab77b40b1145c84e5209960efa7cb7ce 100644 (file)
@@ -1,3 +1,14 @@
+/*
+ * Device Tree file for NETGEAR ReadyNAS Duo v2
+ *
+ * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
 /dts-v1/;
 
 #include "kirkwood.dtsi"
                                marvell,pins = "mpp47";
                                marvell,function = "gpio";
                        };
+
                        pmx_button_backup: pmx-button-backup {
                                marvell,pins = "mpp45";
                                marvell,function = "gpio";
                        };
+
                        pmx_button_reset: pmx-button-reset {
                                marvell,pins = "mpp13";
                                marvell,function = "gpio";
                        };
+
                        pmx_led_blue_power: pmx-led-blue-power {
                                marvell,pins = "mpp31";
                                marvell,function = "gpio";
                        };
+
                        pmx_led_blue_activity: pmx-led-blue-activity {
                                marvell,pins = "mpp38";
                                marvell,function = "gpio";
                        };
+
                        pmx_led_blue_disk1: pmx-led-blue-disk1 {
                                marvell,pins = "mpp23";
                                marvell,function = "gpio";
                        };
+
                        pmx_led_blue_disk2: pmx-led-blue-disk2 {
                                marvell,pins = "mpp22";
                                marvell,function = "gpio";
                        };
+
                        pmx_led_blue_backup: pmx-led-blue-backup {
                                marvell,pins = "mpp29";
                                marvell,function = "gpio";
                        };
+
+                       pmx_poweroff: pmx-poweroff {
+                               marvell,pins = "mpp30";
+                               marvell,function = "gpio";
+                       };
                };
 
                clocks {
-                      #address-cells = <1>;
-                      #size-cells = <0>;
-
-                      g762_clk: fixedclk {
+                      g762_clk: g762-oscillator {
                                 compatible = "fixed-clock";
                                 #clock-cells = <0>;
                                 clock-frequency = <8192>;
 
                power_led {
                        label = "status:blue:power_led";
-                       gpios = <&gpio0 31 1>;   /* GPIO 31 Active Low */
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
                };
+
                activity_led {
                        label = "status:blue:activity_led";
-                       gpios = <&gpio1 6 1>;    /* GPIO 38 Active Low */
+                       gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
                };
+
                disk1_led {
                        label = "status:blue:disk1_led";
-                       gpios = <&gpio0 23 1>;   /* GPIO 23 Active Low */
+                       gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
                };
+
                disk2_led {
                        label = "status:blue:disk2_led";
-                       gpios = <&gpio0 22 1>;   /* GPIO 22 Active Low */
+                       gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
                };
+
                backup_led {
                        label = "status:blue:backup_led";
-                       gpios = <&gpio0 29 1>;   /* GPIO 29 Active Low*/
+                       gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
                };
        };
 
-       gpio_keys {
+       gpio-keys {
                compatible = "gpio-keys";
-               #address-cells = <1>;
-               #size-cells = <0>;
                pinctrl-0 = <&pmx_button_power &pmx_button_backup
                             &pmx_button_reset>;
                pinctrl-names = "default";
 
-               button@1 {
+               power-button {
                        label = "Power Button";
-                       linux,code = <116>;     /* KEY_POWER */
-                       gpios = <&gpio1 15 1>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
                };
-               button@2 {
+
+               reset-button {
                        label = "Reset Button";
-                       linux,code = <0x198>;   /* KEY_RESTART */
-                       gpios = <&gpio0 13 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
                };
-               button@3 {
+
+               backup-button {
                        label = "Backup Button";
-                       linux,code = <133>;     /* KEY_COPY */
-                       gpios = <&gpio1 13 1>;
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
                };
        };
 
-        regulators {
-                compatible = "simple-bus";
-                #address-cells = <1>;
-                #size-cells = <0>;
-
-                usb_power: regulator@1 {
-                        compatible = "regulator-fixed";
-                        reg = <1>;
-                        regulator-name = "USB 3.0 Power";
-                        regulator-min-microvolt = <5000000>;
-                        regulator-max-microvolt = <5000000>;
-                        enable-active-high;
-                        regulator-always-on;
-                        regulator-boot-on;
-                        gpio = <&gpio1 14 0>;
-                };
-        };
+       gpio-poweroff {
+               compatible = "gpio-poweroff";
+               pinctrl-0 = <&pmx_poweroff>;
+               pinctrl-names = "default";
+               gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               usb3_regulator: usb3-regulator {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "USB 3.0 Power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
+               };
+       };
 };
 
 &nand {
 &mdio {
        status = "okay";
 
-       ethphy0: ethernet-phy@0 {
+       ethphy0: ethernet-phy@0 { /* Marvell 88E1318 */
                device_type = "ethernet-phy";
                reg = <0>;
        };
diff --git a/arch/arm/boot/dts/kirkwood-netgear_readynas_nv+_v2.dts b/arch/arm/boot/dts/kirkwood-netgear_readynas_nv+_v2.dts
new file mode 100644 (file)
index 0000000..7c8a0d9
--- /dev/null
@@ -0,0 +1,268 @@
+/*
+ * Device Tree file for NETGEAR ReadyNAS NV+ v2
+ *
+ * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-6282.dtsi"
+
+/ {
+       model = "NETGEAR ReadyNAS NV+ v2";
+       compatible = "netgear,readynas-nv+-v2", "netgear,readynas", "marvell,kirkwood-88f6282", "marvell,kirkwood";
+
+       memory { /* 256 MB */
+               device_type = "memory";
+               reg = <0x00000000 0x10000000>;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8 earlyprintk";
+       };
+
+       mbus {
+               pcie-controller {
+                       status = "okay";
+
+                       /* Connected to NEC uPD720200 USB 3.0 controller */
+                       pcie@1,0 {
+                               /* Port 0, Lane 0 */
+                               status = "okay";
+                       };
+               };
+       };
+
+       ocp@f1000000 {
+               pinctrl: pinctrl@10000 {
+                       pmx_button_power: pmx-button-power {
+                               marvell,pins = "mpp47";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_button_backup: pmx-button-backup {
+                               marvell,pins = "mpp45";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_button_reset: pmx-button-reset {
+                               marvell,pins = "mpp13";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_led_blue_power: pmx-led-blue-power {
+                               marvell,pins = "mpp31";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_led_blue_backup: pmx-led-blue-backup {
+                               marvell,pins = "mpp22";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_led_blue_disk1: pmx-led-blue-disk1 {
+                               marvell,pins = "mpp20";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_led_blue_disk2: pmx-led-blue-disk2 {
+                               marvell,pins = "mpp23";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_led_blue_disk3: pmx-led-blue-disk3 {
+                               marvell,pins = "mpp24";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_led_blue_disk4: pmx-led-blue-disk4 {
+                               marvell,pins = "mpp29";
+                               marvell,function = "gpio";
+                       };
+
+                       pmx_poweroff: pmx-poweroff {
+                               marvell,pins = "mpp30";
+                               marvell,function = "gpio";
+                       };
+               };
+
+               clocks {
+                      g762_clk: g762-oscillator {
+                                compatible = "fixed-clock";
+                                #clock-cells = <0>;
+                                clock-frequency = <8192>;
+                      };
+               };
+
+               i2c@11000 {
+                       status = "okay";
+
+                       rs5c372a: rs5c372a@32 {
+                               compatible = "ricoh,rs5c372a";
+                               reg = <0x32>;
+                       };
+
+                       g762: g762@3e {
+                               compatible = "gmt,g762";
+                               reg = <0x3e>;
+                               clocks = <&g762_clk>; /* input clock */
+                               fan_gear_mode = <0>;
+                               fan_startv = <1>;
+                               pwm_polarity = <0>;
+                       };
+               };
+
+               serial@12000 {
+                       pinctrl-0 = <&pmx_uart0>;
+                       pinctrl-names = "default";
+                       status = "okay";
+               };
+
+               sata@80000 { /* Connected to Marvell 88SM4140 SATA port multiplier */
+                       status = "okay";
+                       nr-ports = <1>;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+               pinctrl-0 = < &pmx_led_blue_power &pmx_led_blue_backup
+                             &pmx_led_blue_disk1 &pmx_led_blue_disk2
+                             &pmx_led_blue_disk3 &pmx_led_blue_disk3 >;
+               pinctrl-names = "default";
+
+               power_led {
+                       label = "status:blue:power_led";
+                       gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "default-on";
+               };
+
+               backup_led {
+                       label = "status:blue:backup_led";
+                       gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
+               };
+
+               disk1_led {
+                       label = "status:blue:disk1_led";
+                       gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
+               };
+
+               disk2_led {
+                       label = "status:blue:disk2_led";
+                       gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
+               };
+
+               disk3_led {
+                       label = "status:blue:disk3_led";
+                       gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
+               };
+
+               disk4_led {
+                       label = "status:blue:disk4_led";
+                       gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               pinctrl-0 = <&pmx_button_power &pmx_button_backup
+                            &pmx_button_reset>;
+               pinctrl-names = "default";
+
+               power-button {
+                       label = "Power Button";
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
+               };
+
+               reset-button {
+                       label = "Reset Button";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+               };
+
+               backup-button {
+                       label = "Backup Button";
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-poweroff {
+               compatible = "gpio-poweroff";
+               pinctrl-0 = <&pmx_poweroff>;
+               pinctrl-names = "default";
+               gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               usb3_regulator: usb3-regulator {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "USB 3.0 Power";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&nand {
+       status = "okay";
+
+       partition@0 {
+               label = "u-boot";
+               reg = <0x0000000 0x180000>;
+               read-only;
+       };
+
+       partition@180000 {
+               label = "u-boot-env";
+               reg = <0x180000 0x20000>;
+       };
+
+       partition@200000 {
+               label = "uImage";
+               reg = <0x0200000 0x600000>;
+       };
+
+       partition@800000 {
+               label = "minirootfs";
+               reg = <0x0800000 0x1000000>;
+       };
+
+       partition@1800000 {
+               label = "jffs2";
+               reg = <0x1800000 0x6800000>;
+       };
+};
+
+&mdio {
+       status = "okay";
+
+       ethphy0: ethernet-phy@0 { /* Marvell 88E1318 */
+               device_type = "ethernet-phy";
+               reg = <0>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+
+       ethernet0-port@0 {
+               phy-handle = <&ethphy0>;
+       };
+};
index 2fcb82e208288e6f0d9e72afc7d7650a2ec946aa..ae1ccbe41029d32d8da5cb8e7722fffcb1b5b1e1 100644 (file)
@@ -64,8 +64,8 @@
 
                button@1 {
                        label = "Power push button";
-                       linux,code = <116>;
-                       gpios = <&gpio1 0 0>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
                };
        };
 
 
                red-fail {
                        label = "ns2:red:fail";
-                       gpios = <&gpio0 12 0>;
+                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
                };
        };
 
        gpio_poweroff {
                compatible = "gpio-poweroff";
-               gpios = <&gpio0 31 0>;
+               gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
        };
 
 };
index 279607093cdbdbda0c0c80207256ab156272e334..1f2ca60d8b3d46f283672b93af35772a852797c9 100644 (file)
@@ -25,8 +25,8 @@
 
                blue-sata {
                        label = "ns2:blue:sata";
-                       gpios = <&gpio0 30 1>;
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "ide-disk";
                };
        };
 };
index defdc77fb5506bdb7b3bf7260685cf266b077af6..72c78d0b1116112cb224676073c57d534359a6b5 100644 (file)
 
        gpio_fan {
                compatible = "gpio-fan";
-               gpios = <&gpio0 22 1
-                        &gpio0  7 1
-                        &gpio1  1 1
-                        &gpio0 23 1>;
+               gpios = <&gpio0 22 GPIO_ACTIVE_LOW
+                        &gpio0  7 GPIO_ACTIVE_LOW
+                        &gpio1  1 GPIO_ACTIVE_LOW
+                        &gpio0 23 GPIO_ACTIVE_LOW>;
                gpio-fan,speed-map =
                        <   0  0
                         1500 15
@@ -36,7 +36,7 @@
                         3300 10
                         4300  9
                         5500  8>;
-               alarm-gpios = <&gpio0 25 1>;
+               alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
        };
 
        ns2-leds {
index adbafdd909915841aae8825de27265026d842672..c441bf62c09fcfa9cab080b00eeb0e76129c31d0 100644 (file)
 
        gpio_fan {
                compatible = "gpio-fan";
-               gpios = <&gpio0 22 1
-                        &gpio0  7 1
-                        &gpio1  1 1
-                        &gpio0 23 1>;
+               gpios = <&gpio0 22 GPIO_ACTIVE_LOW
+                        &gpio0  7 GPIO_ACTIVE_LOW
+                        &gpio1  1 GPIO_ACTIVE_LOW
+                        &gpio0 23 GPIO_ACTIVE_LOW>;
                gpio-fan,speed-map =
                        <   0  0
                         3000 15
@@ -37,7 +37,7 @@
                         7140 10
                         7980  9
                         9200  8>;
-               alarm-gpios = <&gpio0 25 1>;
+               alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
        };
 
        ns2-leds {
index e3f915defd3da6174ad0e1829cf1be0c15e38f80..aa78c2d11fe738fc843f716bd1a6f98ff1054a5b 100644 (file)
@@ -40,7 +40,7 @@
                compatible = "gpio-poweroff";
                pinctrl-0 = <&pmx_pwr_off>;
                pinctrl-names = "default";
-               gpios = <&gpio1 16 0>;
+               gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
        };
 
        regulators {
@@ -58,7 +58,7 @@
                        regulator-max-microvolt = <5000000>;
                        regulator-always-on;
                        regulator-boot-on;
-                       gpio = <&gpio0 21 0>;
+                       gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
                };
        };
 };
index b5418bcaeccead3b1313074c5ebf885d5f8f0e49..03fa24cf334468ff66095883b64ac5b76ae6bc42 100644 (file)
 
                button@1 {
                        label = "Power Button";
-                       linux,code = <116>;
-                       gpios = <&gpio1 14 0>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
                };
                button@2 {
                        label = "Copy Button";
-                       linux,code = <133>;
-                       gpios = <&gpio1 5 1>;
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
                };
                button@3 {
                        label = "Reset Button";
-                       linux,code = <0x198>;
-                       gpios = <&gpio1 4 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
                };
        };
 
 
                green-sys {
                        label = "nsa310:green:sys";
-                       gpios = <&gpio0 28 0>;
+                       gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
                };
                red-sys {
                        label = "nsa310:red:sys";
-                       gpios = <&gpio0 29 0>;
+                       gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
                };
                green-hdd {
                        label = "nsa310:green:hdd";
-                       gpios = <&gpio1 9 0>;
+                       gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
                };
                red-hdd {
                        label = "nsa310:red:hdd";
-                       gpios = <&gpio1 10 0>;
+                       gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
                };
                green-esata {
                        label = "nsa310:green:esata";
-                       gpios = <&gpio0 12 0>;
+                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
                };
                red-esata {
                        label = "nsa310:red:esata";
-                       gpios = <&gpio0 13 0>;
+                       gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
                };
                green-usb {
                        label = "nsa310:green:usb";
-                       gpios = <&gpio0 15 0>;
+                       gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
                };
                red-usb {
                        label = "nsa310:red:usb";
-                       gpios = <&gpio0 16 0>;
+                       gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
                };
                green-copy {
                        label = "nsa310:green:copy";
-                       gpios = <&gpio1 7 0>;
+                       gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
                };
                red-copy {
                        label = "nsa310:red:copy";
-                       gpios = <&gpio1 8 0>;
+                       gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
                };
        };
 };
index ab0212b0e6f58629e593cd6a4e2dbecb5957c166..a5e77945286776940aa38d363ad08bc081e85e3b 100644 (file)
 
                button@1 {
                        label = "Power Button";
-                       linux,code = <116>;
-                       gpios = <&gpio1 14 0>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
                };
                button@2 {
                        label = "Copy Button";
-                       linux,code = <133>;
-                       gpios = <&gpio1 5 1>;
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
                };
                button@3 {
                        label = "Reset Button";
-                       linux,code = <0x198>;
-                       gpios = <&gpio1 4 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
                };
        };
 
 
                green-sys {
                        label = "nsa310:green:sys";
-                       gpios = <&gpio0 28 0>;
+                       gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
                };
                red-sys {
                        label = "nsa310:red:sys";
-                       gpios = <&gpio0 29 0>;
+                       gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
                };
                green-hdd {
                        label = "nsa310:green:hdd";
-                       gpios = <&gpio1 9 0>;
+                       gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
                };
                red-hdd {
                        label = "nsa310:red:hdd";
-                       gpios = <&gpio1 10 0>;
+                       gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
                };
                green-esata {
                        label = "nsa310:green:esata";
-                       gpios = <&gpio0 12 0>;
+                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
                };
                red-esata {
                        label = "nsa310:red:esata";
-                       gpios = <&gpio0 13 0>;
+                       gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
                };
                green-usb {
                        label = "nsa310:green:usb";
-                       gpios = <&gpio0 15 0>;
+                       gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
                };
                green-copy {
                        label = "nsa310:green:copy";
-                       gpios = <&gpio1 7 0>;
+                       gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
                };
                red-copy {
                        label = "nsa310:red:copy";
-                       gpios = <&gpio1 8 0>;
+                       gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
                };
        };
 };
index f0e3d213604c975b760173bc854d624d68e38ccd..5c6a4f1b4e93270137e988caa113da3ecce0c4cf 100644 (file)
 
                led-red {
                        label = "obsa6:red:stat";
-                       gpios = <&gpio1 9 1>;
+                       gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
                };
 
                led-green {
                        label = "obsa6:green:stat";
-                       gpios = <&gpio1 10 1>;
+                       gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
                };
 
                led-yellow {
                        label = "obsa6:yellow:stat";
-                       gpios = <&gpio1 11 1>;
+                       gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
                };
         };
 
 
                button@1 {
                        label = "Init Button";
-                       linux,code = <116>;
-                       gpios = <&gpio1 6 0>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
                };
        };
 };
index 851fb2a60f20bd7c34401accd522cf6c38aeea67..c054ef61cff5996ae2eeee39259b7a76433c875c 100644 (file)
 
                led-red {
                        label = "obsa7:red:stat";
-                       gpios = <&gpio1 9 1>;
+                       gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
                };
 
                led-green {
                        label = "obsa7:green:stat";
-                       gpios = <&gpio1 10 1>;
+                       gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
                };
 
                led-yellow {
                        label = "obsa7:yellow:stat";
-                       gpios = <&gpio1 11 1>;
+                       gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
                };
         };
 
 
                button@1 {
                        label = "Init Button";
-                       linux,code = <116>;
-                       gpios = <&gpio1 6 0>;
+                       linux,code = <KEY_POWER>;
+                       gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
                };
        };
 };
index 1173d7fb31b23f9e11565a45592fcb99f17e41bf..7b1cd993e891126fdc4f08e445b7371f890e1ff3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * kirkwood-sheevaplug-common.dts - Common parts for Sheevaplugs
+ * kirkwood-sheevaplug-common.dtsi - Common parts for Sheevaplugs
  *
  * Copyright (C) 2013 Simon Baatz <gmbnomis@gmail.com>
  *
index eac6a21f3b1f0b2402bf58c341b96f25945e455a..e2b4ea4f9e10726dc8cd3182277e1f2aeb7516ff 100644 (file)
@@ -24,8 +24,8 @@
                        pinctrl-0 = <&pmx_sdio &pmx_sdio_cd &pmx_sdio_wp>;
                        pinctrl-names = "default";
                        status = "okay";
-                       cd-gpios = <&gpio1 12 1>;
-                       wp-gpios = <&gpio1 15 0>;
+                       cd-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
+                       wp-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
                };
        };
 
@@ -36,8 +36,8 @@
 
                health {
                        label = "sheevaplug:blue:health";
-                       gpios = <&gpio1 17 1>;
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
                };
        };
 };
index bb61918313dbf8c495b546273b34b6401c3ba8be..82f6abf120fd33b0f6a093b390483545e41db0af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * kirkwood-sheevaplug-esata.dts - Device tree file for Sheevaplug
+ * kirkwood-sheevaplug.dts - Device tree file for Sheevaplug
  *
  * Copyright (C) 2013 Simon Baatz <gmbnomis@gmail.com>
  *
 
                health {
                        label = "sheevaplug:blue:health";
-                       gpios = <&gpio1 17 1>;
-                       linux,default-trigger = "default-on";
+                       gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
                };
 
                misc {
                        label = "sheevaplug:red:misc";
-                       gpios = <&gpio1 14 1>;
+                       gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
                };
        };
 };
index 320da677b9847e94f0aba2bcc634bd90890686a6..40d6adf678ca1193fc6966090b5757b052336016 100644 (file)
 
                disk {
                        label = "topkick:yellow:disk";
-                       gpios = <&gpio0 21 1>;
+                       gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
                        linux,default-trigger = "ide-disk";
                };
                system2 {
                        label = "topkick:red:system";
-                       gpios = <&gpio1 5 1>;
+                       gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
                };
                system {
                        label = "topkick:blue:system";
-                       gpios = <&gpio1 6 1>;
+                       gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
                        default-state = "on";
                };
                wifi {
                        label = "topkick:green:wifi";
-                       gpios = <&gpio1 7 1>;
+                       gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
                };
                wifi2 {
                        label = "topkick:yellow:wifi";
-                       gpios = <&gpio1 16 1>;
+                       gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
                };
        };
        regulators {
index f755bc1dc604b16b97bd889c1605540875e7080a..c17ae45e19be3ffc33f500e172e3a6e04c439b10 100644 (file)
 
                button@1 {
                        label = "USB Copy";
-                       linux,code = <133>;
-                       gpios = <&gpio0 15 1>;
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
                };
                button@2 {
                        label = "Reset";
-                       linux,code = <0x198>;
-                       gpios = <&gpio0 16 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
                };
        };
 };
index 345562f7589182975d27ae5e95b1e4319bc7f843..0713d072758a1e22a30b86bf3921cdc806cf6b61 100644 (file)
 
                button@1 {
                        label = "USB Copy";
-                       linux,code = <133>;
-                       gpios = <&gpio1 11 1>;
+                       linux,code = <KEY_COPY>;
+                       gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
                };
                button@2 {
                        label = "Reset";
-                       linux,code = <0x198>;
-                       gpios = <&gpio1 5 1>;
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
                };
        };
 };
index 8b73c80f1dad40995be65547ee5caa4a4fbffdaa..81e6c409284e8a42ad68373bee24570151cde287 100644 (file)
@@ -1,4 +1,6 @@
 /include/ "skeleton.dtsi"
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
 
 #define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16))
 
                #address-cells = <1>;
                #size-cells = <1>;
 
-               mbusc: mbus-controller@20000 {
-                       compatible = "marvell,mbus-controller";
-                       reg = <0x20000 0x80>, <0x1500 0x20>;
-               };
-
-               timer: timer@20300 {
-                       compatible = "marvell,orion-timer";
-                       reg = <0x20300 0x20>;
-                       interrupt-parent = <&bridge_intc>;
-                       interrupts = <1>, <2>;
-                       clocks = <&core_clk 0>;
-               };
-
-               intc: main-interrupt-ctrl@20200 {
-                       compatible = "marvell,orion-intc";
-                       interrupt-controller;
-                       #interrupt-cells = <1>;
-                       reg = <0x20200 0x10>, <0x20210 0x10>;
-               };
-
-               bridge_intc: bridge-interrupt-ctrl@20110 {
-                       compatible = "marvell,orion-bridge-intc";
-                       interrupt-controller;
-                       #interrupt-cells = <1>;
-                       reg = <0x20110 0x8>;
-                       interrupts = <1>;
-                       marvell,#interrupts = <6>;
-               };
-
                core_clk: core-clocks@10030 {
                        compatible = "marvell,kirkwood-core-clock";
                        reg = <0x10030 0x4>;
-                       #clock-cells = <1>;
+                       #clock-cells = <1>;
+               };
+
+               spi@10600 {
+                       compatible = "marvell,orion-spi";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       cell-index = <0>;
+                       interrupts = <23>;
+                       reg = <0x10600 0x28>;
+                       clocks = <&gate_clk 7>;
+                       status = "disabled";
                };
 
                gpio0: gpio@10100 {
                        clocks = <&gate_clk 7>;
                };
 
+               i2c@11000 {
+                       compatible = "marvell,mv64xxx-i2c";
+                       reg = <0x11000 0x20>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <29>;
+                       clock-frequency = <100000>;
+                       clocks = <&gate_clk 7>;
+                       status = "disabled";
+               };
+
                serial@12000 {
                        compatible = "ns16550a";
                        reg = <0x12000 0x100>;
                        status = "disabled";
                };
 
-               spi@10600 {
-                       compatible = "marvell,orion-spi";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       cell-index = <0>;
-                       interrupts = <23>;
-                       reg = <0x10600 0x28>;
-                       clocks = <&gate_clk 7>;
-                       status = "disabled";
+               mbusc: mbus-controller@20000 {
+                       compatible = "marvell,mbus-controller";
+                       reg = <0x20000 0x80>, <0x1500 0x20>;
+               };
+
+               bridge_intc: bridge-interrupt-ctrl@20110 {
+                       compatible = "marvell,orion-bridge-intc";
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+                       reg = <0x20110 0x8>;
+                       interrupts = <1>;
+                       marvell,#interrupts = <6>;
                };
 
                gate_clk: clock-gating-control@2011c {
                        #clock-cells = <1>;
                };
 
+               intc: main-interrupt-ctrl@20200 {
+                       compatible = "marvell,orion-intc";
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+                       reg = <0x20200 0x10>, <0x20210 0x10>;
+               };
+
+               timer: timer@20300 {
+                       compatible = "marvell,orion-timer";
+                       reg = <0x20300 0x20>;
+                       interrupt-parent = <&bridge_intc>;
+                       interrupts = <1>, <2>;
+                       clocks = <&core_clk 0>;
+               };
+
                wdt: watchdog-timer@20300 {
                        compatible = "marvell,orion-wdt";
                        reg = <0x20300 0x28>;
                        status = "okay";
                };
 
+               ehci@50000 {
+                       compatible = "marvell,orion-ehci";
+                       reg = <0x50000 0x1000>;
+                       interrupts = <19>;
+                       clocks = <&gate_clk 3>;
+                       status = "okay";
+               };
+
                xor@60800 {
                        compatible = "marvell,orion-xor";
                        reg = <0x60800 0x100
                        };
                };
 
-               ehci@50000 {
-                       compatible = "marvell,orion-ehci";
-                       reg = <0x50000 0x1000>;
-                       interrupts = <19>;
-                       clocks = <&gate_clk 3>;
-                       status = "okay";
-               };
-
-               i2c@11000 {
-                       compatible = "marvell,mv64xxx-i2c";
-                       reg = <0x11000 0x20>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       interrupts = <29>;
-                       clock-frequency = <100000>;
-                       clocks = <&gate_clk 7>;
-                       status = "disabled";
-               };
-
-               mdio: mdio-bus@72004 {
-                       compatible = "marvell,orion-mdio";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       reg = <0x72004 0x84>;
-                       interrupts = <46>;
-                       clocks = <&gate_clk 0>;
-                       status = "disabled";
-
-                       /* add phy nodes in board file */
-               };
-
                eth0: ethernet-controller@72000 {
                        compatible = "marvell,kirkwood-eth";
                        #address-cells = <1>;
                        };
                };
 
+               mdio: mdio-bus@72004 {
+                       compatible = "marvell,orion-mdio";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x72004 0x84>;
+                       interrupts = <46>;
+                       clocks = <&gate_clk 0>;
+                       status = "disabled";
+
+                       /* add phy nodes in board file */
+               };
+
                eth1: ethernet-controller@76000 {
                        compatible = "marvell,kirkwood-eth";
                        #address-cells = <1>;
                                /* set phy-handle property in board file */
                        };
                };
+
+               sata_phy0: sata-phy@82000 {
+                       compatible = "marvell,mvebu-sata-phy";
+                       reg = <0x82000 0x0334>;
+                       clocks = <&gate_clk 14>;
+                       clock-names = "sata";
+                       #phy-cells = <0>;
+                       status = "ok";
+               };
+
+               sata_phy1: sata-phy@84000 {
+                       compatible = "marvell,mvebu-sata-phy";
+                       reg = <0x84000 0x0334>;
+                       clocks = <&gate_clk 15>;
+                       clock-names = "sata";
+                       #phy-cells = <0>;
+                       status = "ok";
+               };
        };
 };
diff --git a/arch/arm/boot/dts/moxart-uc7112lx.dts b/arch/arm/boot/dts/moxart-uc7112lx.dts
new file mode 100644 (file)
index 0000000..90749d5
--- /dev/null
@@ -0,0 +1,109 @@
+/* moxart-uc7112lx.dts - Device Tree file for MOXA UC-7112-LX
+ *
+ * Copyright (C) 2013 Jonas Jensen <jonas.jensen@gmail.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+/dts-v1/;
+/include/ "moxart.dtsi"
+
+/ {
+       model = "MOXA UC-7112-LX";
+       compatible = "moxa,moxart-uc-7112-lx", "moxa,moxart";
+
+       memory {
+               device_type = "memory";
+               reg = <0x0 0x2000000>;
+       };
+
+       flash@80000000,0 {
+               compatible = "numonyx,js28f128", "cfi-flash";
+               reg = <0x80000000 0x1000000>;
+               bank-width = <2>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               partition@0 {
+                       label = "bootloader";
+                       reg = <0x0 0x40000>;
+               };
+               partition@40000 {
+                       label = "linux kernel";
+                       reg = <0x40000 0x1C0000>;
+               };
+               partition@200000 {
+                       label = "root filesystem";
+                       reg = <0x200000 0x800000>;
+               };
+               partition@a00000 {
+                       label = "user filesystem";
+                       reg = <0xa00000 0x600000>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               user-led {
+                       label = "ready-led";
+                       gpios = <&gpio 27 0x1>;
+                       default-state = "on";
+                       linux,default-trigger = "default-on";
+               };
+       };
+
+       gpio_keys_polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               poll-interval = <500>;
+               button@25 {
+                       label = "GPIO Reset";
+                       linux,code = <116>;
+                       gpios = <&gpio 25 1>;
+               };
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200n8 earlyprintk root=/dev/mmcblk0p1 rw rootwait";
+       };
+};
+
+&clk_pll {
+       clocks = <&ref12>;
+};
+
+&sdhci {
+       status = "okay";
+};
+
+&mdio0 {
+       status = "okay";
+
+       ethphy0: ethernet-phy@1 {
+               device_type = "ethernet-phy";
+               compatible = "moxa,moxart-rtl8201cp", "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
+
+&mdio1 {
+       status = "okay";
+
+       ethphy1: ethernet-phy@1 {
+               device_type = "ethernet-phy";
+               compatible = "moxa,moxart-rtl8201cp", "ethernet-phy-ieee802.3-c22";
+               reg = <1>;
+       };
+};
+
+&mac0 {
+       status = "okay";
+};
+
+&mac1 {
+       status = "okay";
+};
+
+&uart0 {
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/moxart.dtsi b/arch/arm/boot/dts/moxart.dtsi
new file mode 100644 (file)
index 0000000..da1d8ef
--- /dev/null
@@ -0,0 +1,154 @@
+/* moxart.dtsi - Device Tree Include file for MOXA ART family SoC
+ *
+ * Copyright (C) 2013 Jonas Jensen <jonas.jensen@gmail.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+       compatible = "moxa,moxart";
+       model = "MOXART";
+       interrupt-parent = <&intc>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       device_type = "cpu";
+                       compatible = "faraday,fa526";
+                       reg = <0>;
+               };
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ref12: ref12M {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <12000000>;
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               reg = <0x90000000 0x10000000>;
+               ranges;
+
+               intc: interrupt-controller@98800000 {
+                       compatible = "moxa,moxart-ic";
+                       reg = <0x98800000 0x38>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+                       interrupt-mask = <0x00080000>;
+               };
+
+               clk_pll: clk_pll@98100000 {
+                       compatible = "moxa,moxart-pll-clock";
+                       #clock-cells = <0>;
+                       reg = <0x98100000 0x34>;
+               };
+
+               clk_apb: clk_apb@98100000 {
+                       compatible = "moxa,moxart-apb-clock";
+                       #clock-cells = <0>;
+                       reg = <0x98100000 0x34>;
+                       clocks = <&clk_pll>;
+               };
+
+               timer: timer@98400000 {
+                       compatible = "moxa,moxart-timer";
+                       reg = <0x98400000 0x42>;
+                       interrupts = <19 1>;
+                       clocks = <&clk_apb>;
+               };
+
+               gpio: gpio@98700000 {
+                       gpio-controller;
+                       #gpio-cells = <2>;
+                       compatible = "moxa,moxart-gpio";
+                       reg = <0x98700000 0xC>;
+               };
+
+               rtc: rtc {
+                       compatible = "moxa,moxart-rtc";
+                       gpio-rtc-sclk = <&gpio 5 0>;
+                       gpio-rtc-data = <&gpio 6 0>;
+                       gpio-rtc-reset = <&gpio 7 0>;
+               };
+
+               dma: dma@90500000 {
+                       compatible = "moxa,moxart-dma";
+                       reg = <0x90500080 0x40>;
+                       interrupts = <24 0>;
+                       #dma-cells = <1>;
+               };
+
+               watchdog: watchdog@98500000 {
+                       compatible = "moxa,moxart-watchdog";
+                       reg = <0x98500000 0x10>;
+                       clocks = <&clk_apb>;
+               };
+
+               sdhci: sdhci@98e00000 {
+                       compatible = "moxa,moxart-sdhci";
+                       reg = <0x98e00000 0x5C>;
+                       interrupts = <5 0>;
+                       clocks = <&clk_apb>;
+                       dmas =  <&dma 5>,
+                               <&dma 5>;
+                       dma-names = "tx", "rx";
+                       status = "disabled";
+               };
+
+               mdio0: mdio@90900090 {
+                       compatible = "moxa,moxart-mdio";
+                       reg = <0x90900090 0x8>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               mdio1: mdio@92000090 {
+                       compatible = "moxa,moxart-mdio";
+                       reg = <0x92000090 0x8>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       status = "disabled";
+               };
+
+               mac0: mac@90900000 {
+                       compatible = "moxa,moxart-mac";
+                       reg = <0x90900000 0x90>;
+                       interrupts = <25 0>;
+                       phy-handle = <&ethphy0>;
+                       phy-mode = "mii";
+                       status = "disabled";
+               };
+
+               mac1: mac@92000000 {
+                       compatible = "moxa,moxart-mac";
+                       reg = <0x92000000 0x90>;
+                       interrupts = <27 0>;
+                       phy-handle = <&ethphy1>;
+                       phy-mode = "mii";
+                       status = "disabled";
+               };
+
+               uart0: uart@98200000 {
+                       compatible = "ns16550a";
+                       reg = <0x98200000 0x20>;
+                       interrupts = <31 8>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clock-frequency = <14745600>;
+                       status = "disabled";
+               };
+       };
+};
index d0c5b37e248c76734d8c58bc54660f65fc6f877a..5377ddf83bf8f99aebb33d2e5019e870ee5f2e18 100644 (file)
                        compatible = "ti,omap2-rng";
                        ti,hwmods = "rng";
                        reg = <0x480a0000 0x50>;
-                       interrupts = <36>;
+                       interrupts = <52>;
                };
 
                sham: sham@480a4000 {
diff --git a/arch/arm/boot/dts/omap2420-n800.dts b/arch/arm/boot/dts/omap2420-n800.dts
new file mode 100644 (file)
index 0000000..d8c1b42
--- /dev/null
@@ -0,0 +1,8 @@
+/dts-v1/;
+
+#include "omap2420-n8x0-common.dtsi"
+
+/ {
+       model = "Nokia N800";
+       compatible = "nokia,n800", "nokia,n8x0", "ti,omap2420", "ti,omap2";
+};
diff --git a/arch/arm/boot/dts/omap2420-n810-wimax.dts b/arch/arm/boot/dts/omap2420-n810-wimax.dts
new file mode 100644 (file)
index 0000000..6b25b03
--- /dev/null
@@ -0,0 +1,8 @@
+/dts-v1/;
+
+#include "omap2420-n8x0-common.dtsi"
+
+/ {
+       model = "Nokia N810 WiMax";
+       compatible = "nokia,n810-wimax", "nokia,n8x0", "ti,omap2420", "ti,omap2";
+};
diff --git a/arch/arm/boot/dts/omap2420-n810.dts b/arch/arm/boot/dts/omap2420-n810.dts
new file mode 100644 (file)
index 0000000..21baec1
--- /dev/null
@@ -0,0 +1,8 @@
+/dts-v1/;
+
+#include "omap2420-n8x0-common.dtsi"
+
+/ {
+       model = "Nokia N810";
+       compatible = "nokia,n810", "nokia,n8x0", "ti,omap2420", "ti,omap2";
+};
diff --git a/arch/arm/boot/dts/omap2420-n8x0-common.dtsi b/arch/arm/boot/dts/omap2420-n8x0-common.dtsi
new file mode 100644 (file)
index 0000000..89608b2
--- /dev/null
@@ -0,0 +1,99 @@
+#include "omap2420.dtsi"
+
+/ {
+       memory {
+               device_type = "memory";
+               reg = <0x80000000 0x8000000>; /* 128 MB */
+       };
+
+       ocp {
+               i2c@0 {
+                       compatible = "i2c-cbus-gpio";
+                       gpios = <&gpio3 2 0 /* gpio66 clk */
+                                &gpio3 1 0 /* gpio65 dat */
+                                &gpio3 0 0 /* gpio64 sel */
+                               >;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       retu_mfd: retu@1 {
+                               compatible = "retu-mfd";
+                               interrupt-parent = <&gpio4>;
+                               interrupts = <12 IRQ_TYPE_EDGE_RISING>;
+                               reg = <0x1>;
+                       };
+               };
+       };
+};
+
+&i2c1 {
+       clock-frequency = <400000>;
+};
+
+&i2c2 {
+       clock-frequency = <400000>;
+};
+
+&gpmc {
+       ranges = <0 0 0x04000000 0x10000000>;
+
+       /* gpio-irq for dma: 26 */
+
+       onenand@0,0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               reg = <0 0 0x10000000>;
+
+               gpmc,sync-read;
+               gpmc,burst-length = <16>;
+               gpmc,burst-read;
+               gpmc,burst-wrap;
+               gpmc,device-width = <2>;
+               gpmc,mux-add-data = <2>;
+               gpmc,cs-on-ns = <0>;
+               gpmc,cs-rd-off-ns = <127>;
+               gpmc,cs-wr-off-ns = <109>;
+               gpmc,adv-on-ns = <0>;
+               gpmc,adv-rd-off-ns = <18>;
+               gpmc,adv-wr-off-ns = <18>;
+               gpmc,oe-on-ns = <27>;
+               gpmc,oe-off-ns = <127>;
+               gpmc,we-on-ns = <27>;
+               gpmc,we-off-ns = <72>;
+               gpmc,rd-cycle-ns = <145>;
+               gpmc,wr-cycle-ns = <136>;
+               gpmc,access-ns = <118>;
+               gpmc,page-burst-access-ns = <27>;
+               gpmc,bus-turnaround-ns = <0>;
+               gpmc,cycle2cycle-delay-ns = <0>;
+               gpmc,wait-monitoring-ns = <0>;
+               gpmc,clk-activation-ns = <9>;
+               gpmc,sync-clk-ps = <27000>;
+
+               /* MTD partition table corresponding to old board-n8x0 file. */
+               partition@0 {
+                       label = "bootloader";
+                       reg = <0x00000000 0x00020000>;
+                       read-only;
+               };
+               partition@1 {
+                       label = "config";
+                       reg = <0x00020000 0x00060000>;
+               };
+               partition@2 {
+                       label = "kernel";
+                       reg = <0x00080000 0x00200000>;
+               };
+               partition@3 {
+                       label = "initfs";
+                       reg = <0x00280000 0x00400000>;
+               };
+               partition@4 {
+                       label = "rootfs";
+                       reg = <0x00680000 0x0f980000>;
+               };
+               partition@5 {
+                       label = "omap2-onenand";
+                       reg = <0x00000000 0x10000000>;
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/omap2430-sdp.dts b/arch/arm/boot/dts/omap2430-sdp.dts
new file mode 100644 (file)
index 0000000..2c90d29
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include "omap2430.dtsi"
+
+/ {
+       model = "TI OMAP2430 SDP";
+       compatible = "ti,omap2430-sdp", "ti,omap2430", "ti,omap2";
+
+       memory {
+               device_type = "memory";
+               reg = <0x80000000 0x8000000>; /* 128 MB */
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+
+       twl: twl@48 {
+               reg = <0x48>;
+               interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+       };
+};
+
+#include "twl4030.dtsi"
+
+&mmc1 {
+       vmmc-supply = <&vmmc1>;
+       bus-width = <4>;
+};
+
+&gpmc {
+       ranges = <5 0 0x08000000 0x01000000>;
+       ethernet@gpmc {
+               compatible = "smsc,lan91c94";
+               interrupt-parent = <&gpio5>;
+               interrupts = <21 IRQ_TYPE_LEVEL_LOW>;   /* gpio149 */
+               reg = <5 0x300 0xf>;
+               bank-width = <2>;
+               gpmc,mux-add-data;
+        };
+};
+
index df33a50bc070b508fd8dacd8a3c72f645c18d3e0..447e714d435b66a769a05256d82cc0bebdc879b3 100644 (file)
@@ -99,7 +99,7 @@
 &omap3_pmx_core {
        pinctrl-names = "default";
        pinctrl-0 = <
-                       &hsusbb2_pins
+                       &hsusb2_pins
        >;
 
        uart3_pins: pinmux_uart3_pins {
                >;
        };
 
-       hsusbb2_pins: pinmux_hsusbb2_pins {
+       hsusb2_pins: pinmux_hsusb2_pins {
                pinctrl-single,pins = <
-                       0x5c0 (PIN_OUTPUT | MUX_MODE3)          /* etk_d10.hsusb2_clk */
-                       0x5c2 (PIN_OUTPUT | MUX_MODE3)          /* etk_d11.hsusb2_stp */
-                       0x5c4 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d12.hsusb2_dir */
-                       0x5c6 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d13.hsusb2_nxt */
-                       0x5c8 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d14.hsusb2_data0 */
-                       0x5cA (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d15.hsusb2_data1 */
-                       0x1a4 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi1_cs3.hsusb2_data2 */
-                       0x1a6 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi2_clk.hsusb2_data7 */
-                       0x1a8 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi2_simo.hsusb2_data4 */
-                       0x1aa (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi2_somi.hsusb2_data5 */
-                       0x1ac (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi2_cs0.hsusb2_data6 */
-                       0x1ae (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi2_cs1.hsusb2_data3 */
+                       OMAP3_CORE1_IOPAD(0x21d4, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi1_cs3.hsusb2_data2 */
+                       OMAP3_CORE1_IOPAD(0x21d6, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi2_clk.hsusb2_data7 */
+                       OMAP3_CORE1_IOPAD(0x21d8, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi2_simo.hsusb2_data4 */
+                       OMAP3_CORE1_IOPAD(0x21da, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi2_somi.hsusb2_data5 */
+                       OMAP3_CORE1_IOPAD(0x21dc, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi2_cs0.hsusb2_data6 */
+                       OMAP3_CORE1_IOPAD(0x21de, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi2_cs1.hsusb2_data3 */
+               >;
+       };
+};
+
+&omap3_pmx_core2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <
+                       &hsusb2_2_pins
+       >;
+
+       hsusb2_2_pins: pinmux_hsusb2_2_pins {
+               pinctrl-single,pins = <
+                       OMAP3630_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3)            /* etk_d10.hsusb2_clk */
+                       OMAP3630_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3)            /* etk_d11.hsusb2_stp */
+                       OMAP3630_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d12.hsusb2_dir */
+                       OMAP3630_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d13.hsusb2_nxt */
+                       OMAP3630_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d14.hsusb2_data0 */
+                       OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d15.hsusb2_data1 */
                >;
        };
 };
index 3ba4a625ea5b9714ce4371e8a9637c108349158c..5053766d369b696afaac39fc8dba1f811f010d41 100644 (file)
 &omap3_pmx_core {
        pinctrl-names = "default";
        pinctrl-0 = <
-                       &hsusbb2_pins
+                       &hsusb2_pins
        >;
 
-       hsusbb2_pins: pinmux_hsusbb2_pins {
+       hsusb2_pins: pinmux_hsusb2_pins {
                pinctrl-single,pins = <
-                       0x5c0 (PIN_OUTPUT | MUX_MODE3)          /* etk_d10.hsusb2_clk */
-                       0x5c2 (PIN_OUTPUT | MUX_MODE3)          /* etk_d11.hsusb2_stp */
-                       0x5c4 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d12.hsusb2_dir */
-                       0x5c6 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d13.hsusb2_nxt */
-                       0x5c8 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d14.hsusb2_data0 */
-                       0x5cA (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d15.hsusb2_data1 */
-                       0x1a4 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi1_cs3.hsusb2_data2 */
-                       0x1a6 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi2_clk.hsusb2_data7 */
-                       0x1a8 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi2_simo.hsusb2_data4 */
-                       0x1aa (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi2_somi.hsusb2_data5 */
-                       0x1ac (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi2_cs0.hsusb2_data6 */
-                       0x1ae (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* mcspi2_cs1.hsusb2_data3 */
+                       OMAP3_CORE1_IOPAD(0x21d4, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi1_cs3.hsusb2_data2 */
+                       OMAP3_CORE1_IOPAD(0x21d6, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi2_clk.hsusb2_data7 */
+                       OMAP3_CORE1_IOPAD(0x21d8, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi2_simo.hsusb2_data4 */
+                       OMAP3_CORE1_IOPAD(0x21da, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi2_somi.hsusb2_data5 */
+                       OMAP3_CORE1_IOPAD(0x21dc, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi2_cs0.hsusb2_data6 */
+                       OMAP3_CORE1_IOPAD(0x21de, PIN_INPUT_PULLDOWN | MUX_MODE3)       /* mcspi2_cs1.hsusb2_data3 */
                >;
        };
 
        };
 };
 
+&omap3_pmx_core2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <
+                       &hsusb2_2_pins
+       >;
+
+       hsusb2_2_pins: pinmux_hsusb2_2_pins {
+               pinctrl-single,pins = <
+                       OMAP3430_CORE2_IOPAD(0x25f0, PIN_OUTPUT | MUX_MODE3)            /* etk_d10.hsusb2_clk */
+                       OMAP3430_CORE2_IOPAD(0x25f2, PIN_OUTPUT | MUX_MODE3)            /* etk_d11.hsusb2_stp */
+                       OMAP3430_CORE2_IOPAD(0x25f4, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d12.hsusb2_dir */
+                       OMAP3430_CORE2_IOPAD(0x25f6, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d13.hsusb2_nxt */
+                       OMAP3430_CORE2_IOPAD(0x25f8, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d14.hsusb2_data0 */
+                       OMAP3430_CORE2_IOPAD(0x25fa, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d15.hsusb2_data1 */
+               >;
+       };
+};
+
 &i2c1 {
        clock-frequency = <2600000>;
 
diff --git a/arch/arm/boot/dts/omap3-cm-t3730.dts b/arch/arm/boot/dts/omap3-cm-t3730.dts
new file mode 100644 (file)
index 0000000..486f4d6
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Support for CompuLab CM-T3730
+ */
+/dts-v1/;
+
+#include "omap36xx.dtsi"
+#include "omap3-cm-t3x30.dtsi"
+
+/ {
+       model = "CompuLab CM-T3730";
+       compatible = "compulab,omap3-cm-t3730", "ti,omap36xx", "ti,omap3";
+
+       wl12xx_vmmc2: wl12xx_vmmc2 {
+               compatible = "regulator-fixed";
+               regulator-name = "vw1271";
+               pinctrl-names = "default";
+               pinctrl-0 = <&wl12xx_gpio>;
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               gpio = <&gpio3 9 GPIO_ACTIVE_HIGH>;   /* gpio73 */
+               startup-delay-us = <20000>;
+               enable-active-high;
+       };
+
+       wl12xx_vaux2: wl12xx_vaux2 {
+               compatible = "regulator-fixed";
+               regulator-name = "vwl1271_vaux2";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vaux2>;
+       };
+};
+
+&omap3_pmx_core {
+       mmc1_pins: pinmux_mmc1_pins {
+               pinctrl-single,pins = <
+                       0x114 (PIN_OUTPUT_PULLUP | MUX_MODE0)   /* sdmmc1_clk.sdmmc1_clk */
+                       0x116 (PIN_INPUT_PULLUP | MUX_MODE0)    /* sdmmc1_cmd.sdmmc1_cmd */
+                       0x118 (PIN_INPUT_PULLUP | MUX_MODE0)    /* sdmmc1_dat0.sdmmc1_dat0 */
+                       0x11a (PIN_INPUT_PULLUP | MUX_MODE0)    /* sdmmc1_dat1.sdmmc1_dat1 */
+                       0x11c (PIN_INPUT_PULLUP | MUX_MODE0)    /* sdmmc1_dat2.sdmmc1_dat2 */
+                       0x11e (PIN_INPUT_PULLUP | MUX_MODE0)    /* sdmmc1_dat3.sdmmc1_dat3 */
+               >;
+       };
+
+       mmc2_pins: pinmux_mmc2_pins {
+               pinctrl-single,pins = <
+                       0x128 (PIN_INPUT_PULLUP | MUX_MODE0)    /* sdmmc2_clk.sdmmc2_clk */
+                       0x12a (PIN_INPUT_PULLUP | MUX_MODE0)    /* sdmmc2_cmd.sdmmc2_cmd */
+                       0x12c (PIN_INPUT_PULLUP | MUX_MODE0)    /* sdmmc2_dat0.sdmmc2_dat0 */
+                       0x12e (PIN_INPUT_PULLUP | MUX_MODE0)    /* sdmmc2_dat1.sdmmc2_dat1 */
+                       0x130 (PIN_INPUT_PULLUP | MUX_MODE0)    /* sdmmc2_dat2.sdmmc2_dat2 */
+                       0x132 (PIN_INPUT_PULLUP | MUX_MODE0)    /* sdmmc2_dat3.sdmmc2_dat3 */
+               >;
+       };
+
+       smsc1_pins: pinmux_smsc1_pins {
+               pinctrl-single,pins = <
+                       0x88 (PIN_OUTPUT | MUX_MODE0)           /* gpmc_ncs5.gpmc_ncs5 */
+                       0x16a (PIN_INPUT_PULLUP | MUX_MODE4)    /* uart3_cts_rctx.gpio_163 */
+               >;
+       };
+
+       uart3_pins: pinmux_uart3_pins {
+               pinctrl-single,pins = <
+                       0x16e (PIN_INPUT | MUX_MODE0)           /* uart3_rx_irrx.uart3_rx_irrx */
+                       0x170 (PIN_OUTPUT | MUX_MODE0)          /* uart3_tx_irtx.uart3_tx_irtx */
+               >;
+       };
+
+       wl12xx_gpio: pinmux_wl12xx_gpio {
+               pinctrl-single,pins = <
+                       0xb2 (PIN_OUTPUT | MUX_MODE4)           /* dss_data3.gpio_73 */
+                       0x134 (PIN_INPUT | MUX_MODE4)           /* sdmmc2_dat4.gpio_136 */
+               >;
+       };
+};
+
+&mmc1 {
+       vmmc-supply = <&vmmc1>;
+       bus-width = <4>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc1_pins>;
+};
+
+&mmc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc2_pins>;
+       vmmc-supply = <&wl12xx_vmmc2>;
+       vmmc_aux-supply = <&wl12xx_vaux2>;
+       non-removable;
+       bus-width = <4>;
+       cap-power-off-card;
+};
+
+&smsc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&smsc1_pins>;
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart3_pins>;
+};
diff --git a/arch/arm/boot/dts/omap3-cm-t3x30.dtsi b/arch/arm/boot/dts/omap3-cm-t3x30.dtsi
new file mode 100644 (file)
index 0000000..3a9f004
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Common support for CompuLab CM-T3530 and  CM-T3730
+ */
+
+/ {
+       memory {
+               device_type = "memory";
+               reg = <0x80000000 0x10000000>; /* 256 MB */
+       };
+
+       cpus {
+               cpu@0 {
+                       cpu0-supply = <&vcc>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               ledb {
+                       label = "cm-t35:green";
+                       gpios = <&gpio6 26 GPIO_ACTIVE_HIGH>;  /* gpio186 */
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       vddvario: regulator-vddvario {
+               compatible = "regulator-fixed";
+               regulator-name = "vddvario";
+               regulator-always-on;
+       };
+
+       vdd33a: regulator-vdd33a {
+               compatible = "regulator-fixed";
+               regulator-name = "vdd33a";
+               regulator-always-on;
+       };
+};
+
+&gpmc {
+       ranges = <5 0 0x2c000000 0x01000000>;
+
+       smsc1: ethernet@5,0 {
+               compatible = "smsc,lan9221", "smsc,lan9115";
+               interrupt-parent = <&gpio6>;
+               interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
+               reg = <5 0 0xff>;
+               bank-width = <2>;
+               gpmc,mux-add-data;
+               gpmc,cs-on-ns = <0>;
+               gpmc,cs-rd-off-ns = <186>;
+               gpmc,cs-wr-off-ns = <186>;
+               gpmc,adv-on-ns = <12>;
+               gpmc,adv-rd-off-ns = <48>;
+               gpmc,adv-wr-off-ns = <48>;
+               gpmc,oe-on-ns = <54>;
+               gpmc,oe-off-ns = <168>;
+               gpmc,we-on-ns = <54>;
+               gpmc,we-off-ns = <168>;
+               gpmc,rd-cycle-ns = <186>;
+               gpmc,wr-cycle-ns = <186>;
+               gpmc,access-ns = <114>;
+               gpmc,page-burst-access-ns = <6>;
+               gpmc,bus-turnaround-ns = <12>;
+               gpmc,cycle2cycle-delay-ns = <18>;
+               gpmc,wr-data-mux-bus-ns = <90>;
+               gpmc,wr-access-ns = <186>;
+               gpmc,cycle2cycle-samecsen;
+               gpmc,cycle2cycle-diffcsen;
+               vddvario-supply = <&vddvario>;
+               vdd33a-supply = <&vdd33a>;
+               reg-io-width = <4>;
+               smsc,save-mac-address;
+       };
+};
+
+&i2c1 {
+       clock-frequency = <400000>;
+
+       twl: twl@48 {
+               reg = <0x48>;
+               interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+               interrupt-parent = <&intc>;
+       };
+};
+
+#include "twl4030.dtsi"
+#include "twl4030_omap3.dtsi"
+
+&i2c3 {
+       clock-frequency = <400000>;
+};
+
+&twl_gpio {
+       ti,use-leds;
+};
index 165aaf7591ba8ef51856474d85db8754710a33ed..c17009323520a87b62a2898bbfc65888f1d9bb2d 100644 (file)
                        0x194 (PIN_INPUT | MUX_MODE0)   /* i2c3_sda.i2c3_sda */
                >;
        };
-
-       leds_pins: pinmux_leds_pins { };
 };
 
 &i2c1 {
index 1c7e74d2d2bc7bd03f1a970cea9442f715c0f3eb..25a2b5f652fd1949ceac364ec8a154436aba05e4 100644 (file)
 &omap3_pmx_core {
        pinctrl-names = "default";
        pinctrl-0 = <
-               &hsusbb1_pins
                &tfp410_pins
                &dss_pins
        >;
 
-       hsusbb1_pins: pinmux_hsusbb1_pins {
-               pinctrl-single,pins = <
-                       0x5aa (PIN_OUTPUT | MUX_MODE3)          /* etk_ctl.hsusb1_clk */
-                       0x5a8 (PIN_OUTPUT | MUX_MODE3)          /* etk_clk.hsusb1_stp */
-                       0x5bc (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d8.hsusb1_dir */
-                       0x5be (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d9.hsusb1_nxt */
-                       0x5ac (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d0.hsusb1_data0 */
-                       0x5ae (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d1.hsusb1_data1 */
-                       0x5b0 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d2.hsusb1_data2 */
-                       0x5b2 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d3.hsusb1_data7 */
-                       0x5b4 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d4.hsusb1_data4 */
-                       0x5b6 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d5.hsusb1_data5 */
-                       0x5b8 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d6.hsusb1_data6 */
-                       0x5ba (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* etk_d7.hsusb1_data3 */
-               >;
-       };
-
        tfp410_pins: tfp410_dvi_pins {
                pinctrl-single,pins = <
                        0x196 (PIN_OUTPUT | MUX_MODE4)   /* hdq_sio.gpio_170 */
        };
 };
 
-&leds_pins {
-       pinctrl-single,pins = <
-               0x5c4 (PIN_OUTPUT | MUX_MODE4) /* etk_d12.gpio_26 */
-               0x5c6 (PIN_OUTPUT | MUX_MODE4) /* etk_d13.gpio_27 */
-               0x5c8 (PIN_OUTPUT | MUX_MODE4) /* etk_d14.gpio_28 */
+&omap3_pmx_core2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <
+               &hsusbb1_pins
        >;
+
+       hsusbb1_pins: pinmux_hsusbb1_pins {
+               pinctrl-single,pins = <
+                       OMAP3630_CORE2_IOPAD(0x25da, PIN_OUTPUT | MUX_MODE3)            /* etk_ctl.hsusb1_clk */
+                       OMAP3630_CORE2_IOPAD(0x25d8, PIN_OUTPUT | MUX_MODE3)            /* etk_clk.hsusb1_stp */
+                       OMAP3630_CORE2_IOPAD(0x25ec, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d8.hsusb1_dir */
+                       OMAP3630_CORE2_IOPAD(0x25ee, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d9.hsusb1_nxt */
+                       OMAP3630_CORE2_IOPAD(0x25dc, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d0.hsusb1_data0 */
+                       OMAP3630_CORE2_IOPAD(0x25de, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d1.hsusb1_data1 */
+                       OMAP3630_CORE2_IOPAD(0x25e0, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d2.hsusb1_data2 */
+                       OMAP3630_CORE2_IOPAD(0x25e2, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d3.hsusb1_data7 */
+                       OMAP3630_CORE2_IOPAD(0x25e4, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d4.hsusb1_data4 */
+                       OMAP3630_CORE2_IOPAD(0x25e6, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d5.hsusb1_data5 */
+                       OMAP3630_CORE2_IOPAD(0x25e8, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d6.hsusb1_data6 */
+                       OMAP3630_CORE2_IOPAD(0x25ea, PIN_INPUT_PULLDOWN | MUX_MODE3)    /* etk_d7.hsusb1_data3 */
+               >;
+       };
+
+       leds_pins: pinmux_leds_pins {
+               pinctrl-single,pins = <
+                       OMAP3630_CORE2_IOPAD(0x25f4, PIN_OUTPUT | MUX_MODE4) /* etk_d12.gpio_26 */
+                       OMAP3630_CORE2_IOPAD(0x25f6, PIN_OUTPUT | MUX_MODE4) /* etk_d13.gpio_27 */
+                       OMAP3630_CORE2_IOPAD(0x25f8, PIN_OUTPUT | MUX_MODE4) /* etk_d14.gpio_28 */
+               >;
+       };
 };
 
 &i2c3 {
index 02a23f8a3384255abca5d54ecf53417226a8347f..145c58cfc8ac1d3c322f2a2ad44abac2734bbb30 100644 (file)
        };
 };
 
-&leds_pins {
-       pinctrl-single,pins = <
-               0x5b0 (PIN_OUTPUT | MUX_MODE4) /* etk_d2.gpio_16 */
-       >;
+&omap3_pmx_core2 {
+       leds_pins: pinmux_leds_pins {
+               pinctrl-single,pins = <
+                       OMAP3630_CORE2_IOPAD(0x25e0, PIN_OUTPUT | MUX_MODE4) /* etk_d2.gpio_16 */
+               >;
+       };
 };
 
 &gpmc {
diff --git a/arch/arm/boot/dts/omap3-ldp.dts b/arch/arm/boot/dts/omap3-ldp.dts
new file mode 100644 (file)
index 0000000..ddce0d8
--- /dev/null
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include "omap34xx.dtsi"
+#include "omap-gpmc-smsc911x.dtsi"
+
+/ {
+       model = "TI OMAP3430 LDP (Zoom1 Labrador)";
+       compatible = "ti,omap3-ldp", "ti,omap3";
+
+       memory {
+               device_type = "memory";
+               reg = <0x80000000 0x8000000>; /* 128 MB */
+       };
+
+       cpus {
+               cpu@0 {
+                       cpu0-supply = <&vcc>;
+               };
+       };
+
+       gpio_keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&gpio_key_pins>;
+
+               key_enter {
+                       label = "enter";
+                       gpios = <&gpio4 5 GPIO_ACTIVE_LOW>; /* gpio101 */
+                       linux,code = <0x0107001c>; /* KEY_ENTER */
+                       gpio-key,wakeup;
+               };
+
+               key_f1 {
+                       label = "f1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_LOW>; /* gpio102 */
+                       linux,code = <0x0303003b>; /* KEY_F1 */
+                       gpio-key,wakeup;
+               };
+
+               key_f2 {
+                       label = "f2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_LOW>; /* gpio103 */
+                       linux,code = <0x0403003c>; /* KEY_F2 */
+                       gpio-key,wakeup;
+               };
+
+               key_f3 {
+                       label = "f3";
+                       gpios = <&gpio4 8 GPIO_ACTIVE_LOW>; /* gpio104 */
+                       linux,code = <0x0503003d>; /* KEY_F3 */
+                       gpio-key,wakeup;
+               };
+
+               key_f4 {
+                       label = "f4";
+                       gpios = <&gpio4 9 GPIO_ACTIVE_LOW>; /* gpio105 */
+                       linux,code = <0x0704003e>; /* KEY_F4 */
+                       gpio-key,wakeup;
+               };
+
+               key_left {
+                       label = "left";
+                       gpios = <&gpio4 10 GPIO_ACTIVE_LOW>; /* gpio106 */
+                       linux,code = <0x04070069>; /* KEY_LEFT */
+                       gpio-key,wakeup;
+               };
+
+               key_right {
+                       label = "right";
+                       gpios = <&gpio4 11 GPIO_ACTIVE_LOW>; /* gpio107 */
+                       linux,code = <0x0507006a>; /* KEY_RIGHT */
+                       gpio-key,wakeup;
+               };
+
+               key_up {
+                       label = "up";
+                       gpios = <&gpio4 12 GPIO_ACTIVE_LOW>; /* gpio108 */
+                       linux,code = <0x06070067>; /* KEY_UP */
+                       gpio-key,wakeup;
+               };
+
+               key_down {
+                       label = "down";
+                       gpios = <&gpio4 13 GPIO_ACTIVE_LOW>; /* gpio109 */
+                       linux,code = <0x0707006c>; /* KEY_DOWN */
+                       gpio-key,wakeup;
+               };
+       };
+};
+
+&gpmc {
+       ranges = <0 0 0x00000000 0x01000000>,
+                <1 0 0x08000000 0x01000000>;
+
+       nand@0,0 {
+               linux,mtd-name= "micron,nand";
+               reg = <0 0 0>;
+               nand-bus-width = <16>;
+               ti,nand-ecc-opt = "bch8";
+
+               gpmc,sync-clk-ps = <0>;
+               gpmc,cs-on-ns = <0>;
+               gpmc,cs-rd-off-ns = <44>;
+               gpmc,cs-wr-off-ns = <44>;
+               gpmc,adv-on-ns = <6>;
+               gpmc,adv-rd-off-ns = <34>;
+               gpmc,adv-wr-off-ns = <44>;
+               gpmc,we-off-ns = <40>;
+               gpmc,oe-off-ns = <54>;
+               gpmc,access-ns = <64>;
+               gpmc,rd-cycle-ns = <82>;
+               gpmc,wr-cycle-ns = <82>;
+               gpmc,wr-access-ns = <40>;
+               gpmc,wr-data-mux-bus-ns = <0>;
+
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               partition@0 {
+                       label = "X-Loader";
+                       reg = <0 0x80000>;
+               };
+               partition@80000 {
+                       label = "U-Boot";
+                       reg = <0x80000 0x140000>;
+               };
+               partition@1c0000 {
+                       label = "Environment";
+                       reg = <0x1c0000 0x40000>;
+               };
+               partition@200000 {
+                       label = "Kernel";
+                       reg = <0x200000 0x1e00000>;
+               };
+               partition@2000000 {
+                       label = "Filesystem";
+                       reg = <0x2000000 0xe000000>;
+               };
+       };
+
+       ethernet@gpmc {
+               interrupt-parent = <&gpio5>;
+               interrupts = <24 IRQ_TYPE_LEVEL_LOW>;
+               reg = <1 0 0xff>;
+       };
+};
+
+&i2c1 {
+       clock-frequency = <2600000>;
+
+       twl: twl@48 {
+               reg = <0x48>;
+               interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+               interrupt-parent = <&intc>;
+       };
+};
+
+#include "twl4030.dtsi"
+#include "twl4030_omap3.dtsi"
+
+&i2c2 {
+       clock-frequency = <400000>;
+};
+
+&i2c3 {
+       clock-frequency = <400000>;
+};
+
+&mmc1 {
+       vmmc-supply = <&vmmc1>;
+       bus-width = <4>;
+};
+
+&omap3_pmx_core {
+       gpio_key_pins: pinmux_gpio_key_pins {
+               pinctrl-single,pins = <
+                       0xea (PIN_INPUT | MUX_MODE4)    /* cam_d2.gpio_101 */
+                       0xec (PIN_INPUT | MUX_MODE4)    /* cam_d3.gpio_102 */
+                       0xee (PIN_INPUT | MUX_MODE4)    /* cam_d4.gpio_103 */
+                       0xf0 (PIN_INPUT | MUX_MODE4)    /* cam_d5.gpio_104 */
+                       0xf2 (PIN_INPUT | MUX_MODE4)    /* cam_d6.gpio_105 */
+                       0xf4 (PIN_INPUT | MUX_MODE4)    /* cam_d7.gpio_106 */
+                       0xf6 (PIN_INPUT | MUX_MODE4)    /* cam_d8.gpio_107 */
+                       0xf8 (PIN_INPUT | MUX_MODE4)    /* cam_d9.gpio_108 */
+                       0xfa (PIN_INPUT | MUX_MODE4)    /* cam_d10.gpio_109 */
+               >;
+       };
+
+       musb_pins: pinmux_musb_pins {
+               pinctrl-single,pins = <
+                       0x172 (PIN_INPUT | MUX_MODE0)   /* hsusb0_clk.hsusb0_clk */
+                       0x17a (PIN_INPUT | MUX_MODE0)   /* hsusb0_data0.hsusb0_data0 */
+                       0x17c (PIN_INPUT | MUX_MODE0)   /* hsusb0_data1.hsusb0_data1 */
+                       0x17e (PIN_INPUT | MUX_MODE0)   /* hsusb0_data2.hsusb0_data2 */
+                       0x180 (PIN_INPUT | MUX_MODE0)   /* hsusb0_data3.hsusb0_data3 */
+                       0x182 (PIN_INPUT | MUX_MODE0)   /* hsusb0_data4.hsusb0_data4 */
+                       0x184 (PIN_INPUT | MUX_MODE0)   /* hsusb0_data5.hsusb0_data5 */
+                       0x186 (PIN_INPUT | MUX_MODE0)   /* hsusb0_data6.hsusb0_data6 */
+                       0x188 (PIN_INPUT | MUX_MODE0)   /* hsusb0_data7.hsusb0_data7 */
+                       0x176 (PIN_INPUT | MUX_MODE0)   /* hsusb0_dir.hsusb0_dir */
+                       0x178 (PIN_INPUT | MUX_MODE0)   /* hsusb0_nxt.hsusb0_nxt */
+                       0x174 (PIN_OUTPUT | MUX_MODE0)  /* hsusb0_stp.hsusb0_stp */
+               >;
+       };
+};
+
+&usb_otg_hs {
+       pinctrl-names = "default";
+       pinctrl-0 = <&musb_pins>;
+       interface-type = <0>;
+       usb-phy = <&usb2_phy>;
+       mode = <3>;
+       power = <50>;
+};
+
+&vaux1 {
+       /* Needed for ads7846 */
+        regulator-name = "vcc";
+};
+
+&vpll2 {
+       /* Needed for DSS */
+       regulator-name = "vdds_dsi";
+};
diff --git a/arch/arm/boot/dts/omap3-sb-t35.dtsi b/arch/arm/boot/dts/omap3-sb-t35.dtsi
new file mode 100644 (file)
index 0000000..b9a2fed
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Common support for CompuLab SB-T35 used on SBC-T3530, SBC-T3517 and SBC-T3730
+ */
+
+&gpmc {
+       ranges = <4 0 0x2d000000 0x01000000>;
+
+       smsc2: ethernet@4,0 {
+               compatible = "smsc,lan9221", "smsc,lan9115";
+               interrupt-parent = <&gpio3>;
+               interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
+               reg = <4 0 0xff>;
+               bank-width = <2>;
+               gpmc,mux-add-data;
+               gpmc,cs-on-ns = <0>;
+               gpmc,cs-rd-off-ns = <186>;
+               gpmc,cs-wr-off-ns = <186>;
+               gpmc,adv-on-ns = <12>;
+               gpmc,adv-rd-off-ns = <48>;
+               gpmc,adv-wr-off-ns = <48>;
+               gpmc,oe-on-ns = <54>;
+               gpmc,oe-off-ns = <168>;
+               gpmc,we-on-ns = <54>;
+               gpmc,we-off-ns = <168>;
+               gpmc,rd-cycle-ns = <186>;
+               gpmc,wr-cycle-ns = <186>;
+               gpmc,access-ns = <114>;
+               gpmc,page-burst-access-ns = <6>;
+               gpmc,bus-turnaround-ns = <12>;
+               gpmc,cycle2cycle-delay-ns = <18>;
+               gpmc,wr-data-mux-bus-ns = <90>;
+               gpmc,wr-access-ns = <186>;
+               gpmc,cycle2cycle-samecsen;
+               gpmc,cycle2cycle-diffcsen;
+               vddvario-supply = <&vddvario>;
+               vdd33a-supply = <&vdd33a>;
+               reg-io-width = <4>;
+               smsc,save-mac-address;
+       };
+};
diff --git a/arch/arm/boot/dts/omap3-sbc-t3730.dts b/arch/arm/boot/dts/omap3-sbc-t3730.dts
new file mode 100644 (file)
index 0000000..c119bd5
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Suppport for CompuLab SBC-T3730 with CM-T3730
+ */
+
+#include "omap3-cm-t3730.dts"
+#include "omap3-sb-t35.dtsi"
+
+/ {
+       model = "CompuLab SBC-T3730 with CM-T3730";
+       compatible = "compulab,omap3-sbc-t3730", "compulab,omap3-cm-t3730", "ti,omap36xx", "ti,omap3";
+};
+
+&gpmc {
+       ranges = <5 0 0x2c000000 0x01000000>,
+                <4 0 0x2d000000 0x01000000>;
+};
+
+&smsc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&smsc2_pins>;
+};
+
+&omap3_pmx_core {
+       smsc2_pins: pinmux_smsc2_pins {
+               pinctrl-single,pins = <
+                       0x86 (PIN_OUTPUT | MUX_MODE0)           /* gpmc_ncs4.gpmc_ncs4 */
+                       0xa2 (PIN_INPUT_PULLUP | MUX_MODE4)     /* gpmc_wait3.gpio_65 */
+               >;
+       };
+};
\ No newline at end of file
index 15eb9fe5169c2badee8f26cd1c79393ebed4db68..6644f516a42bd9de5f5fb52a707051ad502e18a8 100644 (file)
 
        mmc3_pins: pinmux_mmc3_pins {
                pinctrl-single,pins = <
-                       0x168 (PIN_INPUT | MUX_MODE4)   /* mcbsp1_clkx.gpio_162 WLAN IRQ */
-                       0x1a0 (PIN_INPUT_PULLUP | MUX_MODE3)    /* mcspi1_cs1.sdmmc3_cmd */
-                       0x5a8 (PIN_INPUT_PULLUP | MUX_MODE2)    /* etk_clk.sdmmc3_clk */
-                       0x5b4 (PIN_INPUT_PULLUP | MUX_MODE2)    /* etk_d4.sdmmc3_dat0 */
-                       0x5b6 (WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d5.sdmmc3_dat1 */
-                       0x5b8 (PIN_INPUT_PULLUP | MUX_MODE2)    /* etk_d6.sdmmc3_dat2 */
-                       0x5b2 (PIN_INPUT_PULLUP | MUX_MODE2)    /* etk_d3.sdmmc3_dat3 */
+                       OMAP3_CORE1_IOPAD(0x2198, PIN_INPUT | MUX_MODE4)        /* mcbsp1_clkx.gpio_162 WLAN IRQ */
+                       OMAP3_CORE1_IOPAD(0x21d0, PIN_INPUT_PULLUP | MUX_MODE3) /* mcspi1_cs1.sdmmc3_cmd */
                >;
        };
 
        };
 };
 
+&omap3_pmx_core2 {
+       mmc3_2_pins: pinmux_mmc3_2_pins {
+               pinctrl-single,pins = <
+                       OMAP3630_CORE2_IOPAD(0x25d8, PIN_INPUT_PULLUP | MUX_MODE2)      /* etk_clk.sdmmc3_clk */
+                       OMAP3630_CORE2_IOPAD(0x25e4, PIN_INPUT_PULLUP | MUX_MODE2)      /* etk_d4.sdmmc3_dat0 */
+                       OMAP3630_CORE2_IOPAD(0x25e6, WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d5.sdmmc3_dat1 */
+                       OMAP3630_CORE2_IOPAD(0x25e8, PIN_INPUT_PULLUP | MUX_MODE2)      /* etk_d6.sdmmc3_dat2 */
+                       OMAP3630_CORE2_IOPAD(0x25e2, PIN_INPUT_PULLUP | MUX_MODE2)      /* etk_d3.sdmmc3_dat3 */
+               >;
+       };
+};
+
 &omap3_pmx_wkup {
        wlan_host_wkup: pinmux_wlan_host_wkup_pins {
                pinctrl-single,pins = <
        bus-width = <4>;
        cap-power-off-card;
        pinctrl-names = "default";
-       pinctrl-0 = <&mmc3_pins>;
+       pinctrl-0 = <&mmc3_pins &mmc3_2_pins>;
 };
 
 &uart1 {
index daabf99d402a8e4ff645824dcad9d56fc693b17d..427395c083f59e63c3b41bfeeefaa0fab1b66ee0 100644 (file)
 
                omap3_pmx_core: pinmux@48002030 {
                        compatible = "ti,omap3-padconf", "pinctrl-single";
-                       reg = <0x48002030 0x05cc>;
+                       reg = <0x48002030 0x0238>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                        #interrupt-cells = <1>;
index 5355d6173748776f31b000beace07130515f7787..77d124678c9587905b4da1fb9ee18b9759883efe 100644 (file)
                        clock-latency = <300000>; /* From legacy driver */
                };
        };
+
+       ocp {
+               omap3_pmx_core2: pinmux@480025d8 {
+                       compatible = "ti,omap3-padconf", "pinctrl-single";
+                       reg = <0x480025d8 0x24>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       #interrupt-cells = <1>;
+                       interrupt-controller;
+                       pinctrl-single,register-width = <16>;
+                       pinctrl-single,function-mask = <0xff1f>;
+               };
+       };
 };
index 380c22eb468ef705186e9f3f55137e19809ac8d4..b7c7bd96c4041e70752e64c7f70c16c4d7ff4456 100644 (file)
                        ti,hwmods = "uart4";
                        clock-frequency = <48000000>;
                };
+
+               omap3_pmx_core2: pinmux@480025a0 {
+                       compatible = "ti,omap3-padconf", "pinctrl-single";
+                       reg = <0x480025a0 0x5c>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       #interrupt-cells = <1>;
+                       interrupt-controller;
+                       pinctrl-single,register-width = <16>;
+                       pinctrl-single,function-mask = <0xff1f>;
+               };
        };
 };
index aed83deaa991c9b8856218ef0792f1c3f51cc2b4..fcc5bb63f03a949cd80ed090a66f8a901614899f 100644 (file)
@@ -58,7 +58,7 @@
        status = "okay";
 
        ethphy: ethernet-phy {
-               device-type = "ethernet-phy";
+               device_type = "ethernet-phy";
                reg = <8>;
        };
 };
index e06c37e91ac69b0ebbbe0d772264cb61b45be906..9f51538cd9ef9b831e738af1941be58b143b4c62 100644 (file)
                        interrupts = <6>, <7>, <8>, <9>;
                };
 
+               spi@10600 {
+                       compatible = "marvell,orion-spi";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       cell-index = <0>;
+                       reg = <0x10600 0x28>;
+                       status = "disabled";
+               };
+
+               i2c@11000 {
+                       compatible = "marvell,mv64xxx-i2c";
+                       reg = <0x11000 0x20>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       interrupts = <5>;
+                       clock-frequency = <100000>;
+                       status = "disabled";
+               };
+
                serial@12000 {
                        compatible = "ns16550a";
                        reg = <0x12000 0x100>;
                        status = "disabled";
                };
 
-               spi@10600 {
-                       compatible = "marvell,orion-spi";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       cell-index = <0>;
-                       reg = <0x10600 0x28>;
-                       status = "disabled";
-               };
-
                wdt@20300 {
                        compatible = "marvell,orion-wdt";
                        reg = <0x20300 0x28>;
                        status = "disabled";
                };
 
-               ehci@a0000 {
-                       compatible = "marvell,orion-ehci";
-                       reg = <0xa0000 0x1000>;
-                       interrupts = <12>;
-                       status = "disabled";
-               };
-
-               sata@80000 {
-                       compatible = "marvell,orion-sata";
-                       reg = <0x80000 0x5000>;
-                       interrupts = <29>;
-                       status = "disabled";
-               };
-
-               i2c@11000 {
-                       compatible = "marvell,mv64xxx-i2c";
-                       reg = <0x11000 0x20>;
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       interrupts = <5>;
-                       clock-frequency = <100000>;
-                       status = "disabled";
-               };
-
                xor@60900 {
                        compatible = "marvell,orion-xor";
                        reg = <0x60900 0x100
                        };
                };
 
-               crypto@90000 {
-                       compatible = "marvell,orion-crypto";
-                       reg = <0x90000 0x10000>,
-                             <0xf2200000 0x800>;
-                       reg-names = "regs", "sram";
-                       interrupts = <28>;
-                       status = "okay";
-               };
-
-               mdio: mdio-bus@72004 {
-                       compatible = "marvell,orion-mdio";
-                       #address-cells = <1>;
-                       #size-cells = <0>;
-                       reg = <0x72004 0x84>;
-                       interrupts = <22>;
-                       status = "disabled";
-
-                       /* add phy nodes in board file */
-               };
-
                eth: ethernet-controller@72000 {
                        compatible = "marvell,orion-eth";
                        #address-cells = <1>;
                                /* set phy-handle property in board file */
                        };
                };
+
+               mdio: mdio-bus@72004 {
+                       compatible = "marvell,orion-mdio";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x72004 0x84>;
+                       interrupts = <22>;
+                       status = "disabled";
+
+                       /* add phy nodes in board file */
+               };
+
+               sata@80000 {
+                       compatible = "marvell,orion-sata";
+                       reg = <0x80000 0x5000>;
+                       interrupts = <29>;
+                       status = "disabled";
+               };
+
+               crypto@90000 {
+                       compatible = "marvell,orion-crypto";
+                       reg = <0x90000 0x10000>,
+                             <0xf2200000 0x800>;
+                       reg-names = "regs", "sram";
+                       interrupts = <28>;
+                       status = "okay";
+               };
+
+               ehci@a0000 {
+                       compatible = "marvell,orion-ehci";
+                       reg = <0xa0000 0x1000>;
+                       interrupts = <12>;
+                       status = "disabled";
+               };
        };
 };
index daee58944e153dac7d2583a849400790daafdb14..0e219932d7cce360ea8011893424ec52979a1bfb 100644 (file)
                        timebase-frequency = <0>;
                        bus-frequency = <0>;
                        clock-frequency = <0>;
+                       clocks = <&clks 12>;
+                       operating-points = <
+                               /* kHz    uV */
+                               200000  1025000
+                               400000  1025000
+                               664000  1050000
+                               800000  1100000
+                       >;
+                       clock-latency = <150000>;
                };
        };
 
@@ -80,6 +89,7 @@
                        cphifbg@88030000 {
                                compatible = "sirf,prima2-cphifbg";
                                reg = <0x88030000 0x1000>;
+                               clocks = <&clks 42>;
                        };
                };
 
                                                        "usp0_uart_nostreamctrl";
                                         };
                                 };
+                                usp0_only_utfs_pins_a: usp0@2 {
+                                        usp0 {
+                                                sirf,pins = "usp0_only_utfs_grp";
+                                                sirf,function = "usp0_only_utfs";
+                                        };
+                                };
+                                usp0_only_urfs_pins_a: usp0@3 {
+                                        usp0 {
+                                                sirf,pins = "usp0_only_urfs_grp";
+                                                sirf,function = "usp0_only_urfs";
+                                        };
+                                };
                                 usp1_pins_a: usp1@0 {
                                         usp1 {
                                                 sirf,pins = "usp1grp";
                                        compatible = "sirf,prima2-sdhc";
                                        reg = <0x56000000 0x100000>;
                                        interrupts = <38>;
+                                       status = "disabled";
+                                       bus-width = <8>;
+                                       clocks = <&clks 36>;
                                };
 
                                sd1: sdhci@56100000 {
                                        compatible = "sirf,prima2-sdhc";
                                        reg = <0x56100000 0x100000>;
                                        interrupts = <38>;
+                                       status = "disabled";
+                                       bus-width = <4>;
+                                       clocks = <&clks 36>;
                                };
 
                                sd2: sdhci@56200000 {
                                        compatible = "sirf,prima2-sdhc";
                                        reg = <0x56200000 0x100000>;
                                        interrupts = <23>;
+                                       status = "disabled";
+                                       clocks = <&clks 37>;
                                };
 
                                sd3: sdhci@56300000 {
                                        compatible = "sirf,prima2-sdhc";
                                        reg = <0x56300000 0x100000>;
                                        interrupts = <23>;
+                                       status = "disabled";
+                                       clocks = <&clks 37>;
                                };
 
                                sd4: sdhci@56400000 {
                                        compatible = "sirf,prima2-sdhc";
                                        reg = <0x56400000 0x100000>;
                                        interrupts = <39>;
+                                       status = "disabled";
+                                       clocks = <&clks 38>;
                                };
 
                                sd5: sdhci@56500000 {
                                        compatible = "sirf,prima2-sdhc";
                                        reg = <0x56500000 0x100000>;
                                        interrupts = <39>;
+                                       clocks = <&clks 38>;
                                };
 
                                pci-copy@57900000 {
                                interrupts = <52 53 54>;
                        };
 
+                       minigpsrtc@2000 {
+                               compatible = "sirf,prima2-minigpsrtc";
+                               reg = <0x2000 0x1000>;
+                               interrupts = <54>;
+                       };
+
                        pwrc@3000 {
                                compatible = "sirf,prima2-pwrc";
                                reg = <0x3000 0x1000>;
index d7c5d721a5c78fdea12fd8cff9abc7af0985f1e7..a7054694598594cb91aefb77b791c6f3f1706018 100644 (file)
                        marvell,intc-priority;
                        marvell,intc-nr-irqs = <34>;
                };
+
+               pwm0: pwm@40b00000 {
+                       compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+                       reg = <0x40b00000 0x10>;
+                       #pwm-cells = <1>;
+               };
+
+               pwm1: pwm@40b00010 {
+                       compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+                       reg = <0x40b00010 0x10>;
+                       #pwm-cells = <1>;
+               };
+
+               pwm2: pwm@40c00000 {
+                       compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+                       reg = <0x40c00000 0x10>;
+                       #pwm-cells = <1>;
+               };
+
+               pwm3: pwm@40c00010 {
+                       compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+                       reg = <0x40c00010 0x10>;
+                       #pwm-cells = <1>;
+               };
        };
 };
diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
new file mode 100644 (file)
index 0000000..13ac3e2
--- /dev/null
@@ -0,0 +1,6 @@
+#include "qcom-msm8974.dtsi"
+
+/ {
+       model = "Qualcomm APQ8074 Dragonboard";
+       compatible = "qcom,apq8074-dragonboard", "qcom,apq8074";
+};
index 386d4287021534345dcfbed2f3e2f6d5079dcf0f..1187185cf25bb24e9d0d862882f9d6a8c0df5744 100644 (file)
 
        msmgpio: gpio@800000 {
                compatible = "qcom,msm-gpio";
-               reg = <0x00800000 0x1000>;
+               reg = <0x00800000 0x4000>;
                gpio-controller;
                #gpio-cells = <2>;
                ngpio = <173>;
-               interrupts = <0 32 0x4>;
+               interrupts = <0 16 0x4>;
                interrupt-controller;
                #interrupt-cells = <2>;
        };
index 93e9f7e0b7ad22bdd1d0a096902bf80d8cd2be2d..6ccbac77931e210022bf4f9066f812ca75d739af 100644 (file)
@@ -31,7 +31,7 @@
                gpio-controller;
                #gpio-cells = <2>;
                ngpio = <150>;
-               interrupts = <0 32 0x4>;
+               interrupts = <0 16 0x4>;
                interrupt-controller;
                #interrupt-cells = <2>;
                reg = <0x800000 0x4000>;
diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi
new file mode 100644 (file)
index 0000000..6ac9496
--- /dev/null
@@ -0,0 +1,97 @@
+/dts-v1/;
+
+#include "skeleton.dtsi"
+
+/ {
+       model = "Qualcomm MSM8974";
+       compatible = "qcom,msm8974";
+       interrupt-parent = <&intc>;
+
+       soc: soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+               compatible = "simple-bus";
+
+               intc: interrupt-controller@f9000000 {
+                       compatible = "qcom,msm-qgic2";
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
+                       reg = <0xf9000000 0x1000>,
+                             <0xf9002000 0x1000>;
+               };
+
+               timer {
+                       compatible = "arm,armv7-timer";
+                       interrupts = <1 2 0xf08>,
+                                    <1 3 0xf08>,
+                                    <1 4 0xf08>,
+                                    <1 1 0xf08>;
+                       clock-frequency = <19200000>;
+               };
+
+               timer@f9020000 {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       ranges;
+                       compatible = "arm,armv7-timer-mem";
+                       reg = <0xf9020000 0x1000>;
+                       clock-frequency = <19200000>;
+
+                       frame@f9021000 {
+                               frame-number = <0>;
+                               interrupts = <0 8 0x4>,
+                                            <0 7 0x4>;
+                               reg = <0xf9021000 0x1000>,
+                                     <0xf9022000 0x1000>;
+                       };
+
+                       frame@f9023000 {
+                               frame-number = <1>;
+                               interrupts = <0 9 0x4>;
+                               reg = <0xf9023000 0x1000>;
+                               status = "disabled";
+                       };
+
+                       frame@f9024000 {
+                               frame-number = <2>;
+                               interrupts = <0 10 0x4>;
+                               reg = <0xf9024000 0x1000>;
+                               status = "disabled";
+                       };
+
+                       frame@f9025000 {
+                               frame-number = <3>;
+                               interrupts = <0 11 0x4>;
+                               reg = <0xf9025000 0x1000>;
+                               status = "disabled";
+                       };
+
+                       frame@f9026000 {
+                               frame-number = <4>;
+                               interrupts = <0 12 0x4>;
+                               reg = <0xf9026000 0x1000>;
+                               status = "disabled";
+                       };
+
+                       frame@f9027000 {
+                               frame-number = <5>;
+                               interrupts = <0 13 0x4>;
+                               reg = <0xf9027000 0x1000>;
+                               status = "disabled";
+                       };
+
+                       frame@f9028000 {
+                               frame-number = <6>;
+                               interrupts = <0 14 0x4>;
+                               reg = <0xf9028000 0x1000>;
+                               status = "disabled";
+                       };
+               };
+
+               restart@fc4ab000 {
+                       compatible = "qcom,pshold";
+                       reg = <0xfc4ab000 0x4>;
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/r7s72100-genmai-reference.dts b/arch/arm/boot/dts/r7s72100-genmai-reference.dts
new file mode 100644 (file)
index 0000000..da19c70
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Device Tree Source for the Genmai board
+ *
+ * Copyright (C) 2013 Renesas Solutions Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/dts-v1/;
+/include/ "r7s72100.dtsi"
+
+/ {
+       model = "Genmai";
+       compatible = "renesas,genmai-reference", "renesas,r7s72100";
+
+       chosen {
+               bootargs = "console=ttySC2,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp";
+       };
+
+       memory {
+               device_type = "memory";
+               reg = <0x08000000 0x08000000>;
+       };
+
+       lbsc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+       };
+};
index 1fb20f2333cc80a8a89ae1c15485c6f60fc64572..b1deaf7e2e06826b1893925e19812420aa46eeec 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "r7s72100.dtsi"
+#include "r7s72100.dtsi"
 
 / {
        model = "Genmai";
index 9443e93d3cac7f07cfdca4fa24b825424ab310a2..70b1fff8f4a3592a69bf889455504fa1d553adde 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "r8a73a4.dtsi"
+#include "r8a73a4.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 
 / {
                reg = <0 0x40000000 0 0x40000000>;
        };
 
+       memory@200000000 {
+               device_type = "memory";
+               reg = <2 0x00000000 0 0x40000000>;
+       };
+
        vcc_mmc0: regulator@0 {
                compatible = "regulator-fixed";
                regulator-name = "MMC0 Vcc";
        pinctrl-0 = <&scifa0_pins>;
        pinctrl-names = "default";
 
-       scifa0_pins: scifa0 {
+       scifa0_pins: serial0 {
                renesas,groups = "scifa0_data";
                renesas,function = "scifa0";
        };
 
-       mmc0_pins: mmcif {
+       mmc0_pins: mmc {
                renesas,groups = "mmc0_data8", "mmc0_ctrl";
                renesas,function = "mmc0";
        };
 
-       sdhi0_pins: sdhi0 {
+       sdhi0_pins: sd0 {
                renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
                renesas,function = "sdhi0";
        };
 
-       sdhi1_pins: sdhi1 {
+       sdhi1_pins: sd1 {
                renesas,groups = "sdhi1_data4", "sdhi1_ctrl";
                renesas,function = "sdhi1";
        };
index 91436b58016f1d48fa5cd12c3946377500b9d70a..ce085fa444a12ae24230ac87ff1e55a8efd43e9f 100644 (file)
@@ -9,7 +9,8 @@
  */
 
 /dts-v1/;
-/include/ "r8a73a4.dtsi"
+#include "r8a73a4.dtsi"
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        model = "APE6EVM";
                reg = <0 0x40000000 0 0x40000000>;
        };
 
+       memory@200000000 {
+               device_type = "memory";
+               reg = <2 0x00000000 0 0x40000000>;
+       };
+
        ape6evm_fixed_3v3: fixedregulator@0 {
                compatible = "regulator-fixed";
                regulator-name = "3V3";
@@ -40,7 +46,7 @@
                        compatible = "smsc,lan9118", "smsc,lan9115";
                        reg = <0x08000000 0x1000>;
                        interrupt-parent = <&irqc1>;
-                       interrupts = <8 0x4>;
+                       interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
                        phy-mode = "mii";
                        reg-io-width = <4>;
                        smsc,irq-active-high;
index 287e047592a03d28e009cc0500c27ab6a18e6de1..62d0211bd19202a093fde2c45b51faec273c6bfa 100644 (file)
@@ -9,6 +9,9 @@
  * kind, whether express or implied.
  */
 
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
 / {
        compatible = "renesas,r8a73a4";
        interrupt-parent = <&gic>;
                        <0 0xf1002000 0 0x1000>,
                        <0 0xf1004000 0 0x2000>,
                        <0 0xf1006000 0 0x2000>;
-               interrupts = <1 9 0xf04>;
+               interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
        };
 
        timer {
                compatible = "arm,armv7-timer";
-               interrupts = <1 13 0xf08>,
-                               <1 14 0xf08>,
-                               <1 11 0xf08>,
-                               <1 10 0xf08>;
+               interrupts = <1 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <1 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <1 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
        };
 
        irqc0: interrupt-controller@e61c0000 {
                interrupt-controller;
                reg = <0 0xe61c0000 0 0x200>;
                interrupt-parent = <&gic>;
-               interrupts = <0 0 4>, <0 1 4>, <0 2 4>, <0 3 4>,
-                               <0 4 4>, <0 5 4>, <0 6 4>, <0 7 4>,
-                               <0 8 4>, <0 9 4>, <0 10 4>, <0 11 4>,
-                               <0 12 4>, <0 13 4>, <0 14 4>, <0 15 4>,
-                               <0 16 4>, <0 17 4>, <0 18 4>, <0 19 4>,
-                               <0 20 4>, <0 21 4>, <0 22 4>, <0 23 4>,
-                               <0 24 4>, <0 25 4>, <0 26 4>, <0 27 4>,
-                               <0 28 4>, <0 29 4>, <0 30 4>, <0 31 4>;
+               interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 1 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 2 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 3 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 4 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 5 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 6 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 7 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 8 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 9 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 10 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 11 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 12 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 13 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 14 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 15 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 16 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 17 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 18 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 19 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 20 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 21 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 22 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 23 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 24 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 25 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 26 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 27 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 28 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 29 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 30 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 31 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        irqc1: interrupt-controller@e61c0200 {
                interrupt-controller;
                reg = <0 0xe61c0200 0 0x200>;
                interrupt-parent = <&gic>;
-               interrupts = <0 32 4>, <0 33 4>, <0 34 4>, <0 35 4>,
-                               <0 36 4>, <0 37 4>, <0 38 4>, <0 39 4>,
-                               <0 40 4>, <0 41 4>, <0 42 4>, <0 43 4>,
-                               <0 44 4>, <0 45 4>, <0 46 4>, <0 47 4>,
-                               <0 48 4>, <0 49 4>, <0 50 4>, <0 51 4>,
-                               <0 52 4>, <0 53 4>, <0 54 4>, <0 55 4>,
-                               <0 56 4>, <0 57 4>;
+               interrupts = <0 32 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 33 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 34 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 35 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 36 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 37 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 38 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 39 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 40 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 41 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 42 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 43 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 44 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 45 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 46 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 47 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 48 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 49 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 50 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 51 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 52 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 53 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 54 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 55 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 56 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 57 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        dmac: dma-multiplexer@0 {
                        compatible = "renesas,shdma-r8a73a4";
                        reg = <0 0xe6700020 0 0x89e0>;
                        interrupt-parent = <&gic>;
-                       interrupts = <0 220 4
-                                       0 200 4
-                                       0 201 4
-                                       0 202 4
-                                       0 203 4
-                                       0 204 4
-                                       0 205 4
-                                       0 206 4
-                                       0 207 4
-                                       0 208 4
-                                       0 209 4
-                                       0 210 4
-                                       0 211 4
-                                       0 212 4
-                                       0 213 4
-                                       0 214 4
-                                       0 215 4
-                                       0 216 4
-                                       0 217 4
-                                       0 218 4
-                                       0 219 4>;
+                       interrupts = <0 220 IRQ_TYPE_LEVEL_HIGH
+                                       0 200 IRQ_TYPE_LEVEL_HIGH
+                                       0 201 IRQ_TYPE_LEVEL_HIGH
+                                       0 202 IRQ_TYPE_LEVEL_HIGH
+                                       0 203 IRQ_TYPE_LEVEL_HIGH
+                                       0 204 IRQ_TYPE_LEVEL_HIGH
+                                       0 205 IRQ_TYPE_LEVEL_HIGH
+                                       0 206 IRQ_TYPE_LEVEL_HIGH
+                                       0 207 IRQ_TYPE_LEVEL_HIGH
+                                       0 208 IRQ_TYPE_LEVEL_HIGH
+                                       0 209 IRQ_TYPE_LEVEL_HIGH
+                                       0 210 IRQ_TYPE_LEVEL_HIGH
+                                       0 211 IRQ_TYPE_LEVEL_HIGH
+                                       0 212 IRQ_TYPE_LEVEL_HIGH
+                                       0 213 IRQ_TYPE_LEVEL_HIGH
+                                       0 214 IRQ_TYPE_LEVEL_HIGH
+                                       0 215 IRQ_TYPE_LEVEL_HIGH
+                                       0 216 IRQ_TYPE_LEVEL_HIGH
+                                       0 217 IRQ_TYPE_LEVEL_HIGH
+                                       0 218 IRQ_TYPE_LEVEL_HIGH
+                                       0 219 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-names = "error",
                                        "ch0", "ch1", "ch2", "ch3",
                                        "ch4", "ch5", "ch6", "ch7",
                reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>,
                         <0 0xe61f0200 0 0x38>, <0 0xe61f0300 0 0x38>;
                interrupt-parent = <&gic>;
-               interrupts = <0 69 4>;
+               interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        i2c0: i2c@e6500000 {
                compatible = "renesas,rmobile-iic";
                reg = <0 0xe6500000 0 0x428>;
                interrupt-parent = <&gic>;
-               interrupts = <0 174 0x4>;
+               interrupts = <0 174 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0 0xe6510000 0 0x428>;
                interrupt-parent = <&gic>;
-               interrupts = <0 175 0x4>;
+               interrupts = <0 175 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0 0xe6520000 0 0x428>;
                interrupt-parent = <&gic>;
-               interrupts = <0 176 0x4>;
+               interrupts = <0 176 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0 0xe6530000 0 0x428>;
                interrupt-parent = <&gic>;
-               interrupts = <0 177 0x4>;
+               interrupts = <0 177 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0 0xe6540000 0 0x428>;
                interrupt-parent = <&gic>;
-               interrupts = <0 178 0x4>;
+               interrupts = <0 178 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0 0xe60b0000 0 0x428>;
                interrupt-parent = <&gic>;
-               interrupts = <0 179 0x4>;
+               interrupts = <0 179 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0 0xe6550000 0 0x428>;
                interrupt-parent = <&gic>;
-               interrupts = <0 184 0x4>;
+               interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0 0xe6560000 0 0x428>;
                interrupt-parent = <&gic>;
-               interrupts = <0 185 0x4>;
+               interrupts = <0 185 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0 0xe6570000 0 0x428>;
                interrupt-parent = <&gic>;
-               interrupts = <0 173 0x4>;
+               interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
-       mmcif0: mmcif@ee200000 {
+       mmcif0: mmc@ee200000 {
                compatible = "renesas,sh-mmcif";
                reg = <0 0xee200000 0 0x80>;
                interrupt-parent = <&gic>;
-               interrupts = <0 169 0x4>;
+               interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>;
                reg-io-width = <4>;
                status = "disabled";
        };
 
-       mmcif1: mmcif@ee220000 {
+       mmcif1: mmc@ee220000 {
                compatible = "renesas,sh-mmcif";
                reg = <0 0xee220000 0 0x80>;
                interrupt-parent = <&gic>;
-               interrupts = <0 170 0x4>;
+               interrupts = <0 170 IRQ_TYPE_LEVEL_HIGH>;
                reg-io-width = <4>;
                status = "disabled";
        };
                reg = <0 0xe6050000 0 0x9000>;
                gpio-controller;
                #gpio-cells = <2>;
+               interrupts-extended =
+                       <&irqc0  0 0>, <&irqc0  1 0>, <&irqc0  2 0>, <&irqc0  3 0>,
+                       <&irqc0  4 0>, <&irqc0  5 0>, <&irqc0  6 0>, <&irqc0  7 0>,
+                       <&irqc0  8 0>, <&irqc0  9 0>, <&irqc0 10 0>, <&irqc0 11 0>,
+                       <&irqc0 12 0>, <&irqc0 13 0>, <&irqc0 14 0>, <&irqc0 15 0>,
+                       <&irqc0 16 0>, <&irqc0 17 0>, <&irqc0 18 0>, <&irqc0 19 0>,
+                       <&irqc0 20 0>, <&irqc0 21 0>, <&irqc0 22 0>, <&irqc0 23 0>,
+                       <&irqc0 24 0>, <&irqc0 25 0>, <&irqc0 26 0>, <&irqc0 27 0>,
+                       <&irqc0 28 0>, <&irqc0 29 0>, <&irqc0 30 0>, <&irqc0 31 0>,
+                       <&irqc1  0 0>, <&irqc1  1 0>, <&irqc1  2 0>, <&irqc1  3 0>,
+                       <&irqc1  4 0>, <&irqc1  5 0>, <&irqc1  6 0>, <&irqc1  7 0>,
+                       <&irqc1  8 0>, <&irqc1  9 0>, <&irqc1 10 0>, <&irqc1 11 0>,
+                       <&irqc1 12 0>, <&irqc1 13 0>, <&irqc1 14 0>, <&irqc1 15 0>,
+                       <&irqc1 16 0>, <&irqc1 17 0>, <&irqc1 18 0>, <&irqc1 19 0>,
+                       <&irqc1 20 0>, <&irqc1 21 0>, <&irqc1 22 0>, <&irqc1 23 0>,
+                       <&irqc1 24 0>, <&irqc1 25 0>;
        };
 
-       sdhi0: sdhi@ee100000 {
+       sdhi0: sd@ee100000 {
                compatible = "renesas,sdhi-r8a73a4";
                reg = <0 0xee100000 0 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 165 4>;
+               interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>;
                cap-sd-highspeed;
                status = "disabled";
        };
 
-       sdhi1: sdhi@ee120000 {
+       sdhi1: sd@ee120000 {
                compatible = "renesas,sdhi-r8a73a4";
                reg = <0 0xee120000 0 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 166 4>;
+               interrupts = <0 166 IRQ_TYPE_LEVEL_HIGH>;
                cap-sd-highspeed;
                status = "disabled";
        };
 
-       sdhi2: sdhi@ee140000 {
+       sdhi2: sd@ee140000 {
                compatible = "renesas,sdhi-r8a73a4";
                reg = <0 0xee140000 0 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 167 4>;
+               interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH>;
                cap-sd-highspeed;
                status = "disabled";
        };
index 1c56c5e56950846217471ae98ee00c5bed4922ac..95a849bf921f464fa4e59bcada97d7a048dcd876 100644 (file)
@@ -9,8 +9,9 @@
  */
 
 /dts-v1/;
-/include/ "r8a7740.dtsi"
+#include "r8a7740.dtsi"
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/pwm/pwm.h>
 
 / {
                enable-active-high;
        };
 
+       reg_5p0v: regulator@3 {
+               compatible = "regulator-fixed";
+               regulator-name = "fixed-5.0V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               power-key {
+                       gpios = <&pfc 99 GPIO_ACTIVE_LOW>;
+                       linux,code = <116>;
+                       label = "SW3";
+                       gpio-key,wakeup;
+               };
+
+               back-key {
+                       gpios = <&pfc 100 GPIO_ACTIVE_LOW>;
+                       linux,code = <158>;
+                       label = "SW4";
+               };
+
+               menu-key {
+                       gpios = <&pfc 97 GPIO_ACTIVE_LOW>;
+                       linux,code = <139>;
+                       label = "SW5";
+               };
+
+               home-key {
+                       gpios = <&pfc 98 GPIO_ACTIVE_LOW>;
+                       linux,code = <102>;
+                       label = "SW6";
+               };
+       };
+
        leds {
                compatible = "gpio-leds";
                led1 {
                default-brightness-level = <9>;
                pinctrl-0 = <&backlight_pins>;
                pinctrl-names = "default";
+               power-supply = <&reg_5p0v>;
+               enable-gpios = <&pfc 61 GPIO_ACTIVE_HIGH>;
+       };
+
+       sound {
+               compatible = "simple-audio-card";
+
+               simple-audio-card,format = "i2s";
+
+               simple-audio-card,cpu {
+                       sound-dai = <&sh_fsi2 0>;
+                       bitclock-inversion;
+               };
+
+               simple-audio-card,codec {
+                       sound-dai = <&wm8978>;
+                       bitclock-master;
+                       frame-master;
+                       system-clock-frequency = <12288000>;
+               };
        };
 };
 
 &i2c0 {
        status = "okay";
-       touchscreen: st1232@55 {
+       touchscreen@55 {
                compatible = "sitronix,st1232";
                reg = <0x55>;
                interrupt-parent = <&irqpin1>;
-               interrupts = <2 0>; /* IRQ10: hwirq 2 on irqpin1 */
+               interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
                pinctrl-0 = <&st1232_pins>;
                pinctrl-names = "default";
                gpios = <&pfc 166 GPIO_ACTIVE_LOW>;
        };
+
+       wm8978: wm8978@1a {
+               #sound-dai-cells = <0>;
+               compatible = "wlf,wm8978";
+               reg = <0x1a>;
+       };
 };
 
 &pfc {
        pinctrl-0 = <&scifa1_pins>;
        pinctrl-names = "default";
 
-       scifa1_pins: scifa1 {
+       scifa1_pins: serial1 {
                renesas,groups = "scifa1_data";
                renesas,function = "scifa1";
        };
 
-       st1232_pins: st1232 {
+       st1232_pins: touchscreen {
                renesas,groups = "intc_irq10";
                renesas,function = "intc";
        };
                renesas,function = "mmc0";
        };
 
-       sdhi0_pins: sdhi0 {
+       sdhi0_pins: sd0 {
                renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_wp";
                renesas,function = "sdhi0";
        };
+
+       fsia_pins: sounda {
+               renesas,groups = "fsia_sclk_in", "fsia_mclk_out",
+                                "fsia_data_in_1", "fsia_data_out_0";
+               renesas,function = "fsia";
+       };
 };
 
 &tpu {
        cd-gpios = <&pfc 167 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
+
+&sh_fsi2 {
+       pinctrl-0 = <&fsia_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
index 426cd9c3e1c430fc214651809be12c489b2765b9..a06a11e1a84026efaf0cc39914e7629c1fde72a1 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "r8a7740.dtsi"
+#include "r8a7740.dtsi"
 
 / {
        model = "armadillo 800 eva";
index ae1e230f711ddf243168abc55cfc6cd3e3095cf8..8280884bfa596b95d447b11505b775783dc260a2 100644 (file)
@@ -10,6 +10,8 @@
 
 /include/ "skeleton.dtsi"
 
+#include <dt-bindings/interrupt-controller/irq.h>
+
 / {
        compatible = "renesas,r8a7740";
 
 
        pmu {
                compatible = "arm,cortex-a9-pmu";
-               interrupts = <0 83 4>;
+               interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        /* irqpin0: IRQ0 - IRQ7 */
        irqpin0: irqpin@e6900000 {
-               compatible = "renesas,intc-irqpin";
+               compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
                #interrupt-cells = <2>;
                interrupt-controller;
                reg = <0xe6900000 4>,
                        <0xe6900040 1>,
                        <0xe6900060 1>;
                interrupt-parent = <&gic>;
-               interrupts = <0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4>;
+               interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        /* irqpin1: IRQ8 - IRQ15 */
        irqpin1: irqpin@e6900004 {
-               compatible = "renesas,intc-irqpin";
+               compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
                #interrupt-cells = <2>;
                interrupt-controller;
                reg = <0xe6900004 4>,
                        <0xe6900044 1>,
                        <0xe6900064 1>;
                interrupt-parent = <&gic>;
-               interrupts = <0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4>;
+               interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        /* irqpin2: IRQ16 - IRQ23 */
        irqpin2: irqpin@e6900008 {
-               compatible = "renesas,intc-irqpin";
+               compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
                #interrupt-cells = <2>;
                interrupt-controller;
                reg = <0xe6900008 4>,
                        <0xe6900048 1>,
                        <0xe6900068 1>;
                interrupt-parent = <&gic>;
-               interrupts = <0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4>;
+               interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        /* irqpin3: IRQ24 - IRQ31 */
        irqpin3: irqpin@e690000c {
-               compatible = "renesas,intc-irqpin";
+               compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
                #interrupt-cells = <2>;
                interrupt-controller;
                reg = <0xe690000c 4>,
                        <0xe690004c 1>,
                        <0xe690006c 1>;
                interrupt-parent = <&gic>;
-               interrupts = <0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4
-                             0 149 0x4>;
+               interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH
+                             0 149 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        i2c0: i2c@fff20000 {
                compatible = "renesas,rmobile-iic";
                reg = <0xfff20000 0x425>;
                interrupt-parent = <&gic>;
-               interrupts = <0 201 0x4
-                             0 202 0x4
-                             0 203 0x4
-                             0 204 0x4>;
+               interrupts = <0 201 IRQ_TYPE_LEVEL_HIGH
+                             0 202 IRQ_TYPE_LEVEL_HIGH
+                             0 203 IRQ_TYPE_LEVEL_HIGH
+                             0 204 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0xe6c20000 0x425>;
                interrupt-parent = <&gic>;
-               interrupts = <0 70 0x4
-                             0 71 0x4
-                             0 72 0x4
-                             0 73 0x4>;
+               interrupts = <0 70 IRQ_TYPE_LEVEL_HIGH
+                             0 71 IRQ_TYPE_LEVEL_HIGH
+                             0 72 IRQ_TYPE_LEVEL_HIGH
+                             0 73 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                      <0xe605800c 0x20>;
                gpio-controller;
                #gpio-cells = <2>;
+               interrupts-extended =
+                       <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>,
+                       <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>,
+                       <&irqpin1 0 0>, <&irqpin1 1 0>, <&irqpin1 2 0>, <&irqpin1 3 0>,
+                       <&irqpin1 4 0>, <&irqpin1 5 0>, <&irqpin1 6 0>, <&irqpin1 7 0>,
+                       <&irqpin2 0 0>, <&irqpin2 1 0>, <&irqpin2 2 0>, <&irqpin2 3 0>,
+                       <&irqpin2 4 0>, <&irqpin2 5 0>, <&irqpin2 6 0>, <&irqpin2 7 0>,
+                       <&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>,
+                       <&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>;
        };
 
        tpu: pwm@e6600000 {
                #pwm-cells = <3>;
        };
 
-       mmcif0: mmcif@e6bd0000 {
+       mmcif0: mmc@e6bd0000 {
                compatible = "renesas,sh-mmcif";
                reg = <0xe6bd0000 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 56 4
-                               0 57 4>;
+               interrupts = <0 56 IRQ_TYPE_LEVEL_HIGH
+                             0 57 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
-       sdhi0: sdhi@e6850000 {
+       sdhi0: sd@e6850000 {
                compatible = "renesas,sdhi-r8a7740";
                reg = <0xe6850000 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 117 4
-                               0 118 4
-                               0 119 4>;
+               interrupts = <0 117 IRQ_TYPE_LEVEL_HIGH
+                             0 118 IRQ_TYPE_LEVEL_HIGH
+                             0 119 IRQ_TYPE_LEVEL_HIGH>;
                cap-sd-highspeed;
                cap-sdio-irq;
                status = "disabled";
        };
 
-       sdhi1: sdhi@e6860000 {
+       sdhi1: sd@e6860000 {
                compatible = "renesas,sdhi-r8a7740";
                reg = <0xe6860000 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 121 4
-                               0 122 4
-                               0 123 4>;
+               interrupts = <0 121 IRQ_TYPE_LEVEL_HIGH
+                             0 122 IRQ_TYPE_LEVEL_HIGH
+                             0 123 IRQ_TYPE_LEVEL_HIGH>;
+               cap-sd-highspeed;
+               cap-sdio-irq;
+               status = "disabled";
+       };
+
+       sdhi2: sd@e6870000 {
+               compatible = "renesas,sdhi-r8a7740";
+               reg = <0xe6870000 0x100>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH
+                             0 126 IRQ_TYPE_LEVEL_HIGH
+                             0 127 IRQ_TYPE_LEVEL_HIGH>;
                cap-sd-highspeed;
                cap-sdio-irq;
                status = "disabled";
        };
+
+       sh_fsi2: sound@fe1f0000 {
+               #sound-dai-cells = <1>;
+               compatible = "renesas,sh_fsi2";
+               reg = <0xfe1f0000 0x400>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 9 0x4>;
+               status = "disabled";
+       };
 };
index 969e386e852c443f0b5bb95440a0e595d491c04e..bb62c7a906f47c7b52b8563aedcaf6ae56e46197 100644 (file)
@@ -15,7 +15,8 @@
  */
 
 /dts-v1/;
-/include/ "r8a7778.dtsi"
+#include "r8a7778.dtsi"
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        model = "bockw";
 
                phy-mode = "mii";
                interrupt-parent = <&irqpin>;
-               interrupts = <0 0>; /* IRQ0: hwirq 0 on irqpin */
+               interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
                reg-io-width = <4>;
                vddvario-supply = <&fixedregulator3v3>;
                vdd33a-supply = <&fixedregulator3v3>;
        };
+
+};
+
+&mmcif {
+       pinctrl-0 = <&mmc_pins>;
+       pinctrl-names = "default";
+
+       vmmc-supply = <&fixedregulator3v3>;
+       bus-width = <8>;
+       broken-cd;
+       status = "okay";
 };
 
 &irqpin {
        status = "okay";
 };
+
+&pfc {
+       pinctrl-0 = <&scif0_pins>;
+       pinctrl-names = "default";
+
+       scif0_pins: serial0 {
+               renesas,groups = "scif0_data_a", "scif0_ctrl";
+               renesas,function = "scif0";
+       };
+
+       mmc_pins: mmc {
+               renesas,groups = "mmc_data8", "mmc_ctrl";
+               renesas,function = "mmc";
+       };
+
+       sdhi0_pins: sd0 {
+               renesas,groups = "sdhi0_data4", "sdhi0_ctrl",
+                                 "sdhi0_cd", "sdhi0_wp";
+               renesas,function = "sdhi0";
+       };
+
+       hspi0_pins: hspi0 {
+               renesas,groups = "hspi0_a";
+               renesas,function = "hspi0";
+       };
+};
+
+&sdhi0 {
+       pinctrl-0 = <&sdhi0_pins>;
+       pinctrl-names = "default";
+
+       vmmc-supply = <&fixedregulator3v3>;
+       bus-width = <4>;
+       status = "okay";
+};
+
+&hspi0 {
+       pinctrl-0 = <&hspi0_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+};
index 12bbebc9c95594bcbcc7093c472c42a4b0a492ca..46a884d4517566959992b98901d6a13b94064798 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 /dts-v1/;
-/include/ "r8a7778.dtsi"
+#include "r8a7778.dtsi"
 
 / {
        model = "bockw";
index a6308a399e2d2dbbf4fed33ee943b37f98ed0991..ddb3bd7a8838f63f8a1f369c9778d7a8c2519392 100644 (file)
@@ -16,6 +16,8 @@
 
 /include/ "skeleton.dtsi"
 
+#include <dt-bindings/interrupt-controller/irq.h>
+
 / {
        compatible = "renesas,r8a7778";
 
                };
        };
 
+       aliases {
+               spi0 = &hspi0;
+               spi1 = &hspi1;
+               spi2 = &hspi2;
+       };
+
        gic: interrupt-controller@fe438000 {
                compatible = "arm,cortex-a9-gic";
                #interrupt-cells = <3>;
@@ -35,7 +43,7 @@
 
        /* irqpin: IRQ0 - IRQ3 */
        irqpin: irqpin@fe78001c {
-               compatible = "renesas,intc-irqpin";
+               compatible = "renesas,intc-irqpin-r8a7778", "renesas,intc-irqpin";
                #interrupt-cells = <2>;
                interrupt-controller;
                status = "disabled"; /* default off */
                        <0xfe780044 4>,
                        <0xfe780064 4>;
                interrupt-parent = <&gic>;
-               interrupts =   <0 27 0x4
-                               0 28 0x4
-                               0 29 0x4
-                               0 30 0x4>;
+               interrupts =   <0 27 IRQ_TYPE_LEVEL_HIGH
+                               0 28 IRQ_TYPE_LEVEL_HIGH
+                               0 29 IRQ_TYPE_LEVEL_HIGH
+                               0 30 IRQ_TYPE_LEVEL_HIGH>;
                sense-bitfield-width = <2>;
        };
 
@@ -56,7 +64,7 @@
                compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
                reg = <0xffc40000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 103 0x4>;
+               interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 0 32>;
@@ -68,7 +76,7 @@
                compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
                reg = <0xffc41000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 103 0x4>;
+               interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 32 32>;
@@ -80,7 +88,7 @@
                compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
                reg = <0xffc42000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 103 0x4>;
+               interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 64 32>;
                compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
                reg = <0xffc43000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 103 0x4>;
+               interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 96 32>;
                compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar";
                reg = <0xffc44000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 103 0x4>;
+               interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 128 27>;
 
        pfc: pfc@fffc0000 {
                compatible = "renesas,pfc-r8a7778";
-               reg = <0xfffc000 0x118>;
+               reg = <0xfffc0000 0x118>;
+       };
+
+       i2c0: i2c@ffc70000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "renesas,i2c-r8a7778";
+               reg = <0xffc70000 0x1000>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 67 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       i2c1: i2c@ffc71000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "renesas,i2c-r8a7778";
+               reg = <0xffc71000 0x1000>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       i2c2: i2c@ffc72000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "renesas,i2c-r8a7778";
+               reg = <0xffc72000 0x1000>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       i2c3: i2c@ffc73000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "renesas,i2c-r8a7778";
+               reg = <0xffc73000 0x1000>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 77 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       mmcif: mmc@ffe4e000 {
+               compatible = "renesas,sh-mmcif";
+               reg = <0xffe4e000 0x100>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 61 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       sdhi0: sd@ffe4c000 {
+               compatible = "renesas,sdhi-r8a7778";
+               reg = <0xffe4c000 0x100>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 87 IRQ_TYPE_LEVEL_HIGH>;
+               cap-sd-highspeed;
+               cap-sdio-irq;
+               status = "disabled";
+       };
+
+       sdhi1: sd@ffe4d000 {
+               compatible = "renesas,sdhi-r8a7778";
+               reg = <0xffe4d000 0x100>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>;
+               cap-sd-highspeed;
+               cap-sdio-irq;
+               status = "disabled";
+       };
+
+       sdhi2: sd@ffe4f000 {
+               compatible = "renesas,sdhi-r8a7778";
+               reg = <0xffe4f000 0x100>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
+               cap-sd-highspeed;
+               cap-sdio-irq;
+               status = "disabled";
+       };
+
+       i2c0: i2c@ffc70000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "renesas,i2c-r8a7778";
+               reg = <0xffc70000 0x1000>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 67 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       i2c1: i2c@ffc71000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "renesas,i2c-r8a7778";
+               reg = <0xffc71000 0x1000>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       i2c2: i2c@ffc72000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "renesas,i2c-r8a7778";
+               reg = <0xffc72000 0x1000>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       i2c3: i2c@ffc73000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "renesas,i2c-r8a7778";
+               reg = <0xffc73000 0x1000>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 77 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       hspi0: spi@fffc7000 {
+               compatible = "renesas,hspi";
+               reg = <0xfffc7000 0x18>;
+               interrupt-controller = <&gic>;
+               interrupts = <0 63 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       hspi1: spi@fffc8000 {
+               compatible = "renesas,hspi";
+               reg = <0xfffc8000 0x18>;
+               interrupt-controller = <&gic>;
+               interrupts = <0 84 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       hspi2: spi@fffc6000 {
+               compatible = "renesas,hspi";
+               reg = <0xfffc6000 0x18>;
+               interrupt-controller = <&gic>;
+               interrupts = <0 85 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
        };
 };
index ab4110aa3c3b5a4ad31f1600959195099f8ace9c..76f5eef7d1cce9055587164f5a157a48ec66956a 100644 (file)
@@ -10,8 +10,9 @@
  */
 
 /dts-v1/;
-/include/ "r8a7779.dtsi"
+#include "r8a7779.dtsi"
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        model = "marzen";
@@ -43,7 +44,7 @@
 
                phy-mode = "mii";
                interrupt-parent = <&irqpin0>;
-               interrupts = <1 0>; /* IRQ1: hwirq 1 on irqpin0 */
+               interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
                reg-io-width = <4>;
                vddvario-supply = <&fixedregulator3v3>;
                vdd33a-supply = <&fixedregulator3v3>;
@@ -68,7 +69,7 @@
 };
 
 &pfc {
-       pinctrl-0 = <&scif2_pins &scif4_pins &sdhi0_pins>;
+       pinctrl-0 = <&scif2_pins &scif4_pins>;
        pinctrl-names = "default";
 
        lan0_pins: lan0 {
                };
        };
 
-       scif2_pins: scif2 {
+       scif2_pins: serial2 {
                renesas,groups = "scif2_data_c";
                renesas,function = "scif2";
        };
 
-       scif4_pins: scif4 {
+       scif4_pins: serial4 {
                renesas,groups = "scif4_data";
                renesas,function = "scif4";
        };
 
-       sdhi0_pins: sdhi0 {
-               renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd",
-                                "sdhi0_wp";
+       sdhi0_pins: sd0 {
+               renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
                renesas,function = "sdhi0";
        };
+
+       hspi0_pins: hspi0 {
+               renesas,groups = "hspi0";
+               renesas,function = "hspi0";
+       };
+};
+
+&sdhi0 {
+       pinctrl-0 = <&sdhi0_pins>;
+       pinctrl-names = "default";
+
+       vmmc-supply = <&fixedregulator3v3>;
+       bus-width = <4>;
+       status = "okay";
+};
+
+&hspi0 {
+       pinctrl-0 = <&hspi0_pins>;
+       pinctrl-names = "default";
+       status = "okay";
 };
index f3f7f79997360d65c7a8d5bfeeba9d23e76168d3..a7af2c2371f2581b6e9f8e1e43a064eef46bc60e 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 /dts-v1/;
-/include/ "r8a7779.dtsi"
+#include "r8a7779.dtsi"
 
 / {
        model = "marzen";
index 19faeac3fd2e1b74f5d289948dd486f473f931de..d0561d4c7c466056096969331d467f6196b9ff63 100644 (file)
@@ -11,6 +11,8 @@
 
 /include/ "skeleton.dtsi"
 
+#include <dt-bindings/interrupt-controller/irq.h>
+
 / {
        compatible = "renesas,r8a7779";
 
                };
        };
 
+       aliases {
+               spi0 = &hspi0;
+               spi1 = &hspi1;
+               spi2 = &hspi2;
+       };
+
         gic: interrupt-controller@f0001000 {
                 compatible = "arm,cortex-a9-gic";
                 #interrupt-cells = <3>;
@@ -52,7 +60,7 @@
                compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
                reg = <0xffc40000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 141 0x4>;
+               interrupts = <0 141 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 0 32>;
@@ -64,7 +72,7 @@
                compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
                reg = <0xffc41000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 142 0x4>;
+               interrupts = <0 142 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 32 32>;
@@ -76,7 +84,7 @@
                compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
                reg = <0xffc42000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 143 0x4>;
+               interrupts = <0 143 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 64 32>;
@@ -88,7 +96,7 @@
                compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
                reg = <0xffc43000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 144 0x4>;
+               interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 96 32>;
                compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
                reg = <0xffc44000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 145 0x4>;
+               interrupts = <0 145 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 128 32>;
                compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
                reg = <0xffc45000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 146 0x4>;
+               interrupts = <0 146 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 160 32>;
                compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
                reg = <0xffc46000 0x2c>;
                interrupt-parent = <&gic>;
-               interrupts = <0 147 0x4>;
+               interrupts = <0 147 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 192 9>;
        };
 
        irqpin0: irqpin@fe780010 {
-               compatible = "renesas,intc-irqpin";
+               compatible = "renesas,intc-irqpin-r8a7779", "renesas,intc-irqpin";
                #interrupt-cells = <2>;
                status = "disabled";
                interrupt-controller;
                        <0xfe780044 4>,
                        <0xfe780064 4>;
                interrupt-parent = <&gic>;
-               interrupts = <0 27 0x4
-                               0 28 0x4
-                               0 29 0x4
-                               0 30 0x4>;
+               interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH
+                             0 28 IRQ_TYPE_LEVEL_HIGH
+                             0 29 IRQ_TYPE_LEVEL_HIGH
+                             0 30 IRQ_TYPE_LEVEL_HIGH>;
                sense-bitfield-width = <2>;
        };
 
        i2c0: i2c@ffc70000 {
                #address-cells = <1>;
                #size-cells = <0>;
-               compatible = "renesas,rmobile-iic";
+               compatible = "renesas,i2c-r8a7779";
                reg = <0xffc70000 0x1000>;
                interrupt-parent = <&gic>;
-               interrupts = <0 79 0x4>;
+               interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
        i2c1: i2c@ffc71000 {
                #address-cells = <1>;
                #size-cells = <0>;
-               compatible = "renesas,rmobile-iic";
+               compatible = "renesas,i2c-r8a7779";
                reg = <0xffc71000 0x1000>;
                interrupt-parent = <&gic>;
-               interrupts = <0 82 0x4>;
+               interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
        i2c2: i2c@ffc72000 {
                #address-cells = <1>;
                #size-cells = <0>;
-               compatible = "renesas,rmobile-iic";
+               compatible = "renesas,i2c-r8a7779";
                reg = <0xffc72000 0x1000>;
                interrupt-parent = <&gic>;
-               interrupts = <0 80 0x4>;
+               interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
        i2c3: i2c@ffc73000 {
                #address-cells = <1>;
                #size-cells = <0>;
-               compatible = "renesas,rmobile-iic";
+               compatible = "renesas,i2c-r8a7779";
                reg = <0xffc73000 0x1000>;
                interrupt-parent = <&gic>;
-               interrupts = <0 81 0x4>;
+               interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rcar-sata";
                reg = <0xfc600000 0x2000>;
                interrupt-parent = <&gic>;
-               interrupts = <0 100 0x4>;
+               interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       sdhi0: sd@ffe4c000 {
+               compatible = "renesas,sdhi-r8a7779";
+               reg = <0xffe4c000 0x100>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
+               cap-sd-highspeed;
+               cap-sdio-irq;
+               status = "disabled";
+       };
+
+       sdhi1: sd@ffe4d000 {
+               compatible = "renesas,sdhi-r8a7779";
+               reg = <0xffe4d000 0x100>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
+               cap-sd-highspeed;
+               cap-sdio-irq;
+               status = "disabled";
+       };
+
+       sdhi2: sd@ffe4e000 {
+               compatible = "renesas,sdhi-r8a7779";
+               reg = <0xffe4e000 0x100>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
+               cap-sd-highspeed;
+               cap-sdio-irq;
+               status = "disabled";
+       };
+
+       sdhi3: sd@ffe4f000 {
+               compatible = "renesas,sdhi-r8a7779";
+               reg = <0xffe4f000 0x100>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
+               cap-sd-highspeed;
+               cap-sdio-irq;
+               status = "disabled";
+       };
+
+       hspi0: spi@fffc7000 {
+               compatible = "renesas,hspi";
+               reg = <0xfffc7000 0x18>;
+               interrupt-controller = <&gic>;
+               interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       hspi1: spi@fffc8000 {
+               compatible = "renesas,hspi";
+               reg = <0xfffc8000 0x18>;
+               interrupt-controller = <&gic>;
+               interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
+       };
+
+       hspi2: spi@fffc6000 {
+               compatible = "renesas,hspi";
+               reg = <0xfffc6000 0x18>;
+               interrupt-controller = <&gic>;
+               interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
+               status = "disabled";
        };
 };
diff --git a/arch/arm/boot/dts/r8a7790-lager-reference.dts b/arch/arm/boot/dts/r8a7790-lager-reference.dts
deleted file mode 100644 (file)
index c462ef1..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Device Tree Source for the Lager board
- *
- * Copyright (C) 2013 Renesas Solutions Corp.
- *
- * This file is licensed under the terms of the GNU General Public License
- * version 2.  This program is licensed "as is" without any warranty of any
- * kind, whether express or implied.
- */
-
-/dts-v1/;
-/include/ "r8a7790.dtsi"
-#include <dt-bindings/gpio/gpio.h>
-
-/ {
-       model = "Lager";
-       compatible = "renesas,lager-reference", "renesas,r8a7790";
-
-       chosen {
-               bootargs = "console=ttySC6,115200 ignore_loglevel rw";
-       };
-
-       memory@40000000 {
-               device_type = "memory";
-               reg = <0 0x40000000 0 0x80000000>;
-       };
-
-       lbsc {
-               #address-cells = <1>;
-               #size-cells = <1>;
-       };
-
-       leds {
-               compatible = "gpio-leds";
-               led6 {
-                       gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>;
-               };
-               led7 {
-                       gpios = <&gpio4 23 GPIO_ACTIVE_HIGH>;
-               };
-               led8 {
-                       gpios = <&gpio5 17 GPIO_ACTIVE_HIGH>;
-               };
-       };
-};
index 203bd089af29d83355ed9b2ebdc029045012320f..57569cba152856d634ccb68474b0647012624b52 100644 (file)
@@ -9,7 +9,8 @@
  */
 
 /dts-v1/;
-/include/ "r8a7790.dtsi"
+#include "r8a7790.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
        model = "Lager";
                reg = <0 0x40000000 0 0x80000000>;
        };
 
+       memory@180000000 {
+               device_type = "memory";
+               reg = <1 0x80000000 0 0x80000000>;
+       };
+
        lbsc {
                #address-cells = <1>;
                #size-cells = <1>;
        };
+
+       leds {
+               compatible = "gpio-leds";
+               led6 {
+                       gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>;
+               };
+               led7 {
+                       gpios = <&gpio4 23 GPIO_ACTIVE_HIGH>;
+               };
+               led8 {
+                       gpios = <&gpio5 17 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       fixedregulator3v3: fixedregulator@0 {
+               compatible = "regulator-fixed";
+               regulator-name = "fixed-3.3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-boot-on;
+               regulator-always-on;
+       };
+};
+
+&extal_clk {
+       clock-frequency = <20000000>;
+};
+
+&pfc {
+       pinctrl-0 = <&scif0_pins &scif1_pins>;
+       pinctrl-names = "default";
+
+       scif0_pins: serial0 {
+               renesas,groups = "scif0_data";
+               renesas,function = "scif0";
+       };
+
+       scif1_pins: serial1 {
+               renesas,groups = "scif1_data";
+               renesas,function = "scif1";
+       };
+
+       mmc1_pins: mmc1 {
+               renesas,groups = "mmc1_data8", "mmc1_ctrl";
+               renesas,function = "mmc1";
+       };
+};
+
+&mmcif1 {
+       pinctrl-0 = <&mmc1_pins>;
+       pinctrl-names = "default";
+
+       vmmc-supply = <&fixedregulator3v3>;
+       bus-width = <8>;
+       non-removable;
+       status = "okay";
 };
index 9987dd0e9c599929042b1ce70d4b1d6c3ec1ebfb..f48487c2a970aa6020d7400dfa3fbc2c710855cc 100644 (file)
@@ -8,6 +8,10 @@
  * kind, whether express or implied.
  */
 
+#include <dt-bindings/clock/r8a7790-clock.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
 / {
        compatible = "renesas,r8a7790";
        interrupt-parent = <&gic>;
                        <0 0xf1002000 0 0x1000>,
                        <0 0xf1004000 0 0x2000>,
                        <0 0xf1006000 0 0x2000>;
-               interrupts = <1 9 0xf04>;
+               interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
        };
 
        gpio0: gpio@e6050000 {
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
                reg = <0 0xe6050000 0 0x50>;
                interrupt-parent = <&gic>;
-               interrupts = <0 4 0x4>;
+               interrupts = <0 4 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 0 32>;
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
                reg = <0 0xe6051000 0 0x50>;
                interrupt-parent = <&gic>;
-               interrupts = <0 5 0x4>;
+               interrupts = <0 5 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 32 32>;
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
                reg = <0 0xe6052000 0 0x50>;
                interrupt-parent = <&gic>;
-               interrupts = <0 6 0x4>;
+               interrupts = <0 6 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 64 32>;
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
                reg = <0 0xe6053000 0 0x50>;
                interrupt-parent = <&gic>;
-               interrupts = <0 7 0x4>;
+               interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 96 32>;
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
                reg = <0 0xe6054000 0 0x50>;
                interrupt-parent = <&gic>;
-               interrupts = <0 8 0x4>;
+               interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 128 32>;
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
                reg = <0 0xe6055000 0 0x50>;
                interrupt-parent = <&gic>;
-               interrupts = <0 9 0x4>;
+               interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
                #gpio-cells = <2>;
                gpio-controller;
                gpio-ranges = <&pfc 0 160 32>;
                interrupt-controller;
        };
 
+       thermal@e61f0000 {
+               compatible = "renesas,thermal-r8a7790", "renesas,rcar-thermal";
+               reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
        timer {
                compatible = "arm,armv7-timer";
-               interrupts = <1 13 0xf08>,
-                               <1 14 0xf08>,
-                               <1 11 0xf08>,
-                               <1 10 0xf08>;
+               interrupts = <1 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <1 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <1 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
        };
 
        irqc0: interrupt-controller@e61c0000 {
-               compatible = "renesas,irqc";
+               compatible = "renesas,irqc-r8a7790", "renesas,irqc";
                #interrupt-cells = <2>;
                interrupt-controller;
                reg = <0 0xe61c0000 0 0x200>;
                interrupt-parent = <&gic>;
-               interrupts = <0 0 4>, <0 1 4>, <0 2 4>, <0 3 4>;
+               interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 1 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 2 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 3 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        i2c0: i2c@e6508000 {
                compatible = "renesas,i2c-r8a7790";
                reg = <0 0xe6508000 0 0x40>;
                interrupt-parent = <&gic>;
-               interrupts = <0 287 0x4>;
+               interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp3_clks R8A7790_CLK_I2C0>;
                status = "disabled";
        };
 
                compatible = "renesas,i2c-r8a7790";
                reg = <0 0xe6518000 0 0x40>;
                interrupt-parent = <&gic>;
-               interrupts = <0 288 0x4>;
+               interrupts = <0 288 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp3_clks R8A7790_CLK_I2C1>;
                status = "disabled";
        };
 
                compatible = "renesas,i2c-r8a7790";
                reg = <0 0xe6530000 0 0x40>;
                interrupt-parent = <&gic>;
-               interrupts = <0 286 0x4>;
+               interrupts = <0 286 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp3_clks R8A7790_CLK_I2C2>;
                status = "disabled";
        };
 
                compatible = "renesas,i2c-r8a7790";
                reg = <0 0xe6540000 0 0x40>;
                interrupt-parent = <&gic>;
-               interrupts = <0 290 0x4>;
+               interrupts = <0 290 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp3_clks R8A7790_CLK_I2C3>;
                status = "disabled";
        };
 
        mmcif0: mmcif@ee200000 {
-               compatible = "renesas,sh-mmcif";
+               compatible = "renesas,mmcif-r8a7790", "renesas,sh-mmcif";
                reg = <0 0xee200000 0 0x80>;
                interrupt-parent = <&gic>;
-               interrupts = <0 169 0x4>;
+               interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp3_clks R8A7790_CLK_MMCIF0>;
                reg-io-width = <4>;
                status = "disabled";
        };
 
-       mmcif1: mmcif@ee220000 {
-               compatible = "renesas,sh-mmcif";
+       mmcif1: mmc@ee220000 {
+               compatible = "renesas,mmcif-r8a7790", "renesas,sh-mmcif";
                reg = <0 0xee220000 0 0x80>;
                interrupt-parent = <&gic>;
-               interrupts = <0 170 0x4>;
+               interrupts = <0 170 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp3_clks R8A7790_CLK_MMCIF1>;
                reg-io-width = <4>;
                status = "disabled";
        };
                reg = <0 0xe6060000 0 0x250>;
        };
 
-       sdhi0: sdhi@ee100000 {
+       sdhi0: sd@ee100000 {
                compatible = "renesas,sdhi-r8a7790";
                reg = <0 0xee100000 0 0x200>;
                interrupt-parent = <&gic>;
-               interrupts = <0 165 4>;
+               interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp3_clks R8A7790_CLK_SDHI0>;
                cap-sd-highspeed;
                status = "disabled";
        };
 
-       sdhi1: sdhi@ee120000 {
+       sdhi1: sd@ee120000 {
                compatible = "renesas,sdhi-r8a7790";
                reg = <0 0xee120000 0 0x200>;
                interrupt-parent = <&gic>;
-               interrupts = <0 166 4>;
+               interrupts = <0 166 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp3_clks R8A7790_CLK_SDHI1>;
                cap-sd-highspeed;
                status = "disabled";
        };
 
-       sdhi2: sdhi@ee140000 {
+       sdhi2: sd@ee140000 {
                compatible = "renesas,sdhi-r8a7790";
                reg = <0 0xee140000 0 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 167 4>;
+               interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp3_clks R8A7790_CLK_SDHI2>;
                cap-sd-highspeed;
                status = "disabled";
        };
 
-       sdhi3: sdhi@ee160000 {
+       sdhi3: sd@ee160000 {
                compatible = "renesas,sdhi-r8a7790";
                reg = <0 0xee160000 0 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 168 4>;
+               interrupts = <0 168 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&mstp3_clks R8A7790_CLK_SDHI3>;
                cap-sd-highspeed;
                status = "disabled";
        };
+
+       clocks {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               /* External root clock */
+               extal_clk: extal_clk {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       /* This value must be overriden by the board. */
+                       clock-frequency = <0>;
+                       clock-output-names = "extal";
+               };
+
+               /* Special CPG clocks */
+               cpg_clocks: cpg_clocks@e6150000 {
+                       compatible = "renesas,r8a7790-cpg-clocks",
+                                    "renesas,rcar-gen2-cpg-clocks";
+                       reg = <0 0xe6150000 0 0x1000>;
+                       clocks = <&extal_clk>;
+                       #clock-cells = <1>;
+                       clock-output-names = "main", "pll0", "pll1", "pll3",
+                                            "lb", "qspi", "sdh", "sd0", "sd1",
+                                            "z";
+               };
+
+               /* Variable factor clocks */
+               sd2_clk: sd2_clk@e6150078 {
+                       compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
+                       reg = <0 0xe6150078 0 4>;
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-output-names = "sd2";
+               };
+               sd3_clk: sd3_clk@e615007c {
+                       compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
+                       reg = <0 0xe615007c 0 4>;
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-output-names = "sd3";
+               };
+               mmc0_clk: mmc0_clk@e6150240 {
+                       compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
+                       reg = <0 0xe6150240 0 4>;
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-output-names = "mmc0";
+               };
+               mmc1_clk: mmc1_clk@e6150244 {
+                       compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
+                       reg = <0 0xe6150244 0 4>;
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-output-names = "mmc1";
+               };
+               ssp_clk: ssp_clk@e6150248 {
+                       compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
+                       reg = <0 0xe6150248 0 4>;
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-output-names = "ssp";
+               };
+               ssprs_clk: ssprs_clk@e615024c {
+                       compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
+                       reg = <0 0xe615024c 0 4>;
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-output-names = "ssprs";
+               };
+
+               /* Fixed factor clocks */
+               pll1_div2_clk: pll1_div2_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <2>;
+                       clock-mult = <1>;
+                       clock-output-names = "pll1_div2";
+               };
+               z2_clk: z2_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <2>;
+                       clock-mult = <1>;
+                       clock-output-names = "z2";
+               };
+               zg_clk: zg_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <3>;
+                       clock-mult = <1>;
+                       clock-output-names = "zg";
+               };
+               zx_clk: zx_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <3>;
+                       clock-mult = <1>;
+                       clock-output-names = "zx";
+               };
+               zs_clk: zs_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <6>;
+                       clock-mult = <1>;
+                       clock-output-names = "zs";
+               };
+               hp_clk: hp_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <12>;
+                       clock-mult = <1>;
+                       clock-output-names = "hp";
+               };
+               i_clk: i_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <2>;
+                       clock-mult = <1>;
+                       clock-output-names = "i";
+               };
+               b_clk: b_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <12>;
+                       clock-mult = <1>;
+                       clock-output-names = "b";
+               };
+               p_clk: p_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <24>;
+                       clock-mult = <1>;
+                       clock-output-names = "p";
+               };
+               cl_clk: cl_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <48>;
+                       clock-mult = <1>;
+                       clock-output-names = "cl";
+               };
+               m2_clk: m2_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <8>;
+                       clock-mult = <1>;
+                       clock-output-names = "m2";
+               };
+               imp_clk: imp_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <4>;
+                       clock-mult = <1>;
+                       clock-output-names = "imp";
+               };
+               rclk_clk: rclk_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <(48 * 1024)>;
+                       clock-mult = <1>;
+                       clock-output-names = "rclk";
+               };
+               oscclk_clk: oscclk_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <(12 * 1024)>;
+                       clock-mult = <1>;
+                       clock-output-names = "oscclk";
+               };
+               zb3_clk: zb3_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL3>;
+                       #clock-cells = <0>;
+                       clock-div = <4>;
+                       clock-mult = <1>;
+                       clock-output-names = "zb3";
+               };
+               zb3d2_clk: zb3d2_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL3>;
+                       #clock-cells = <0>;
+                       clock-div = <8>;
+                       clock-mult = <1>;
+                       clock-output-names = "zb3d2";
+               };
+               ddr_clk: ddr_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7790_CLK_PLL3>;
+                       #clock-cells = <0>;
+                       clock-div = <8>;
+                       clock-mult = <1>;
+                       clock-output-names = "ddr";
+               };
+               mp_clk: mp_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-div = <15>;
+                       clock-mult = <1>;
+                       clock-output-names = "mp";
+               };
+               cp_clk: cp_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&extal_clk>;
+                       #clock-cells = <0>;
+                       clock-div = <2>;
+                       clock-mult = <1>;
+                       clock-output-names = "cp";
+               };
+
+               /* Gate clocks */
+               mstp0_clks: mstp0_clks@e6150130 {
+                       compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150130 0 4>, <0 0xe6150030 0 4>;
+                       clocks = <&mp_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <R8A7790_CLK_MSIOF0>;
+                       clock-output-names = "msiof0";
+               };
+               mstp1_clks: mstp1_clks@e6150134 {
+                       compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>;
+                       clocks = <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>,
+                                <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>,
+                                <&zs_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <
+                               R8A7790_CLK_TMU1 R8A7790_CLK_TMU3 R8A7790_CLK_TMU2
+                               R8A7790_CLK_CMT0 R8A7790_CLK_TMU0 R8A7790_CLK_VSP1_DU1
+                               R8A7790_CLK_VSP1_DU0 R8A7790_CLK_VSP1_RT R8A7790_CLK_VSP1_SY
+                       >;
+                       clock-output-names =
+                               "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1",
+                               "vsp1-du0", "vsp1-rt", "vsp1-sy";
+               };
+               mstp2_clks: mstp2_clks@e6150138 {
+                       compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>;
+                       clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>,
+                                <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <
+                               R8A7790_CLK_SCIFA2 R8A7790_CLK_SCIFA1 R8A7790_CLK_SCIFA0
+                               R8A7790_CLK_MSIOF2 R8A7790_CLK_SCIFB0 R8A7790_CLK_SCIFB1
+                               R8A7790_CLK_MSIOF1 R8A7790_CLK_MSIOF3 R8A7790_CLK_SCIFB2
+                       >;
+                       clock-output-names =
+                               "scifa2", "scifa1", "scifa0", "msiof2", "scifb0",
+                               "scifb1", "msiof1", "msiof3", "scifb2";
+               };
+               mstp3_clks: mstp3_clks@e615013c {
+                       compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
+                       clocks = <&cp_clk>, <&mmc1_clk>, <&sd3_clk>, <&sd2_clk>,
+                                <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>,
+                                <&mmc0_clk>, <&rclk_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <
+                               R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
+                               R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0
+                               R8A7790_CLK_MMCIF0 R8A7790_CLK_CMT1
+                       >;
+                       clock-output-names =
+                               "tpu0", "mmcif1", "sdhi3", "sdhi2",
+                               "sdhi1", "sdhi0", "mmcif0", "cmt1";
+               };
+               mstp5_clks: mstp5_clks@e6150144 {
+                       compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>;
+                       clocks = <&extal_clk>, <&p_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <R8A7790_CLK_THERMAL R8A7790_CLK_PWM>;
+                       clock-output-names = "thermal", "pwm";
+               };
+               mstp7_clks: mstp7_clks@e615014c {
+                       compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe615014c 0 4>, <0 0xe61501c4 0 4>;
+                       clocks = <&mp_clk>, <&mp_clk>, <&zs_clk>, <&zs_clk>, <&p_clk>,
+                                <&p_clk>, <&zx_clk>, <&zx_clk>, <&zx_clk>, <&zx_clk>,
+                                <&zx_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <
+                               R8A7790_CLK_EHCI R8A7790_CLK_HSUSB R8A7790_CLK_HSCIF1
+                               R8A7790_CLK_HSCIF0 R8A7790_CLK_SCIF1 R8A7790_CLK_SCIF0
+                               R8A7790_CLK_DU2 R8A7790_CLK_DU1 R8A7790_CLK_DU0
+                               R8A7790_CLK_LVDS1 R8A7790_CLK_LVDS0
+                       >;
+                       clock-output-names =
+                               "ehci", "hsusb", "hscif1", "hscif0", "scif1",
+                               "scif0", "du2", "du1", "du0", "lvds1", "lvds0";
+               };
+               mstp8_clks: mstp8_clks@e6150990 {
+                       compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150990 0 4>, <0 0xe61509a0 0 4>;
+                       clocks = <&p_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <R8A7790_CLK_ETHER>;
+                       clock-output-names = "ether";
+               };
+               mstp9_clks: mstp9_clks@e6150994 {
+                       compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150994 0 4>, <0 0xe61509a4 0 4>;
+                       clocks = <&p_clk>, <&p_clk>, <&cpg_clocks R8A7790_CLK_QSPI>,
+                                <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <
+                               R8A7790_CLK_RCAN1 R8A7790_CLK_RCAN0 R8A7790_CLK_QSPI_MOD
+                               R8A7790_CLK_I2C3 R8A7790_CLK_I2C2 R8A7790_CLK_I2C1
+                               R8A7790_CLK_I2C0
+                       >;
+                       clock-output-names =
+                               "rcan1", "rcan0", "qspi_mod", "i2c3", "i2c2", "i2c1", "i2c0";
+               };
+       };
 };
diff --git a/arch/arm/boot/dts/r8a7791-koelsch-reference.dts b/arch/arm/boot/dts/r8a7791-koelsch-reference.dts
new file mode 100644 (file)
index 0000000..588ca17
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Device Tree Source for the Koelsch board
+ *
+ * Copyright (C) 2013 Renesas Electronics Corporation
+ * Copyright (C) 2013 Renesas Solutions Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/dts-v1/;
+#include "r8a7791.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "Koelsch";
+       compatible = "renesas,koelsch-reference", "renesas,r8a7791";
+
+       chosen {
+               bootargs = "console=ttySC6,115200 ignore_loglevel rw root=/dev/nfs ip=dhcp";
+       };
+
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0 0x40000000 0 0x80000000>;
+       };
+
+       lbsc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               key-a {
+                       gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <30>;
+                       label = "SW30";
+                       gpio-key,wakeup;
+                       debounce-interval = <20>;
+               };
+               key-b {
+                       gpios = <&gpio7 1 GPIO_ACTIVE_LOW>;
+                       linux,code = <48>;
+                       label = "SW31";
+                       gpio-key,wakeup;
+                       debounce-interval = <20>;
+               };
+               key-c {
+                       gpios = <&gpio7 2 GPIO_ACTIVE_LOW>;
+                       linux,code = <46>;
+                       label = "SW32";
+                       gpio-key,wakeup;
+                       debounce-interval = <20>;
+               };
+               key-d {
+                       gpios = <&gpio7 3 GPIO_ACTIVE_LOW>;
+                       linux,code = <32>;
+                       label = "SW33";
+                       gpio-key,wakeup;
+                       debounce-interval = <20>;
+               };
+               key-e {
+                       gpios = <&gpio7 4 GPIO_ACTIVE_LOW>;
+                       linux,code = <18>;
+                       label = "SW34";
+                       gpio-key,wakeup;
+                       debounce-interval = <20>;
+               };
+               key-f {
+                       gpios = <&gpio7 5 GPIO_ACTIVE_LOW>;
+                       linux,code = <33>;
+                       label = "SW35";
+                       gpio-key,wakeup;
+                       debounce-interval = <20>;
+               };
+               key-g {
+                       gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
+                       linux,code = <34>;
+                       label = "SW36";
+                       gpio-key,wakeup;
+                       debounce-interval = <20>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               led6 {
+                       gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>;
+               };
+               led7 {
+                       gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
+               };
+               led8 {
+                       gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&pfc {
+       pinctrl-0 = <&scif0_pins &scif1_pins>;
+       pinctrl-names = "default";
+
+       scif0_pins: serial0 {
+               renesas,groups = "scif0_data_d";
+               renesas,function = "scif0";
+       };
+
+       scif1_pins: serial1 {
+               renesas,groups = "scif1_data_d";
+               renesas,function = "scif1";
+       };
+};
index 1ce5250ec278fef727fa46c2a09c9cc09007b259..fd556c3483e38cffe0c9d57eba1dce58330b168f 100644 (file)
@@ -10,7 +10,8 @@
  */
 
 /dts-v1/;
-/include/ "r8a7791.dtsi"
+#include "r8a7791.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
        model = "Koelsch";
                #address-cells = <1>;
                #size-cells = <1>;
        };
+
+       leds {
+               compatible = "gpio-leds";
+               led6 {
+                       gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>;
+               };
+               led7 {
+                       gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
+               };
+               led8 {
+                       gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&extal_clk {
+       clock-frequency = <20000000>;
+};
+
+&pfc {
+       pinctrl-0 = <&scif0_pins &scif1_pins>;
+       pinctrl-names = "default";
+
+       scif0_pins: serial0 {
+               renesas,groups = "scif0_data_d";
+               renesas,function = "scif0";
+       };
+
+       scif1_pins: serial1 {
+               renesas,groups = "scif1_data_d";
+               renesas,function = "scif1";
+       };
 };
index fea5cfef4691c3656b7b34560eedccaee38ef0b1..19c65509a22d8b10cc48e667fb747bdda0d6ee1e 100644 (file)
@@ -9,6 +9,10 @@
  * kind, whether express or implied.
  */
 
+#include <dt-bindings/clock/r8a7791-clock.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
 / {
        compatible = "renesas,r8a7791";
        interrupt-parent = <&gic>;
                        <0 0xf1002000 0 0x1000>,
                        <0 0xf1004000 0 0x2000>,
                        <0 0xf1006000 0 0x2000>;
-               interrupts = <1 9 0xf04>;
+               interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+       };
+
+       gpio0: gpio@e6050000 {
+               compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
+               reg = <0 0xe6050000 0 0x50>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 4 IRQ_TYPE_LEVEL_HIGH>;
+               #gpio-cells = <2>;
+               gpio-controller;
+               gpio-ranges = <&pfc 0 0 32>;
+               #interrupt-cells = <2>;
+               interrupt-controller;
+       };
+
+       gpio1: gpio@e6051000 {
+               compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
+               reg = <0 0xe6051000 0 0x50>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 5 IRQ_TYPE_LEVEL_HIGH>;
+               #gpio-cells = <2>;
+               gpio-controller;
+               gpio-ranges = <&pfc 0 32 32>;
+               #interrupt-cells = <2>;
+               interrupt-controller;
+       };
+
+       gpio2: gpio@e6052000 {
+               compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
+               reg = <0 0xe6052000 0 0x50>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 6 IRQ_TYPE_LEVEL_HIGH>;
+               #gpio-cells = <2>;
+               gpio-controller;
+               gpio-ranges = <&pfc 0 64 32>;
+               #interrupt-cells = <2>;
+               interrupt-controller;
+       };
+
+       gpio3: gpio@e6053000 {
+               compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
+               reg = <0 0xe6053000 0 0x50>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>;
+               #gpio-cells = <2>;
+               gpio-controller;
+               gpio-ranges = <&pfc 0 96 32>;
+               #interrupt-cells = <2>;
+               interrupt-controller;
+       };
+
+       gpio4: gpio@e6054000 {
+               compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
+               reg = <0 0xe6054000 0 0x50>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>;
+               #gpio-cells = <2>;
+               gpio-controller;
+               gpio-ranges = <&pfc 0 128 32>;
+               #interrupt-cells = <2>;
+               interrupt-controller;
+       };
+
+       gpio5: gpio@e6055000 {
+               compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
+               reg = <0 0xe6055000 0 0x50>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
+               #gpio-cells = <2>;
+               gpio-controller;
+               gpio-ranges = <&pfc 0 160 32>;
+               #interrupt-cells = <2>;
+               interrupt-controller;
+       };
+
+       gpio6: gpio@e6055400 {
+               compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
+               reg = <0 0xe6055400 0 0x50>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 10 IRQ_TYPE_LEVEL_HIGH>;
+               #gpio-cells = <2>;
+               gpio-controller;
+               gpio-ranges = <&pfc 0 192 32>;
+               #interrupt-cells = <2>;
+               interrupt-controller;
+       };
+
+       gpio7: gpio@e6055800 {
+               compatible = "renesas,gpio-r8a7791", "renesas,gpio-rcar";
+               reg = <0 0xe6055800 0 0x50>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>;
+               #gpio-cells = <2>;
+               gpio-controller;
+               gpio-ranges = <&pfc 0 224 26>;
+               #interrupt-cells = <2>;
+               interrupt-controller;
+       };
+
+       thermal@e61f0000 {
+               compatible = "renesas,thermal-r8a7791", "renesas,rcar-thermal";
+               reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        timer {
                compatible = "arm,armv7-timer";
-               interrupts = <1 13 0xf08>,
-                               <1 14 0xf08>,
-                               <1 11 0xf08>,
-                               <1 10 0xf08>;
+               interrupts = <1 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <1 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <1 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <1 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
        };
 
        irqc0: interrupt-controller@e61c0000 {
-               compatible = "renesas,irqc";
+               compatible = "renesas,irqc-r8a7791", "renesas,irqc";
                #interrupt-cells = <2>;
                interrupt-controller;
                reg = <0 0xe61c0000 0 0x200>;
                interrupt-parent = <&gic>;
-               interrupts = <0 0 4>,
-                             <0 1 4>,
-                             <0 2 4>,
-                             <0 3 4>,
-                             <0 12 4>,
-                             <0 13 4>,
-                             <0 14 4>,
-                             <0 15 4>,
-                             <0 16 4>,
-                             <0 17 4>;
+               interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 1 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 2 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 3 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 12 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 13 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 14 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 15 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 16 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 17 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       pfc: pfc@e6060000 {
+               compatible = "renesas,pfc-r8a7791";
+               reg = <0 0xe6060000 0 0x250>;
+               #gpio-range-cells = <3>;
+       };
+
+       clocks {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               /* External root clock */
+               extal_clk: extal_clk {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       /* This value must be overriden by the board. */
+                       clock-frequency = <0>;
+                       clock-output-names = "extal";
+               };
+
+               /* Special CPG clocks */
+               cpg_clocks: cpg_clocks@e6150000 {
+                       compatible = "renesas,r8a7791-cpg-clocks",
+                                    "renesas,rcar-gen2-cpg-clocks";
+                       reg = <0 0xe6150000 0 0x1000>;
+                       clocks = <&extal_clk>;
+                       #clock-cells = <1>;
+                       clock-output-names = "main", "pll0", "pll1", "pll3",
+                                            "lb", "qspi", "sdh", "sd0", "z";
+               };
+
+               /* Variable factor clocks */
+               sd1_clk: sd2_clk@e6150078 {
+                       compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
+                       reg = <0 0xe6150078 0 4>;
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-output-names = "sd1";
+               };
+               sd2_clk: sd3_clk@e615007c {
+                       compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
+                       reg = <0 0xe615007c 0 4>;
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-output-names = "sd2";
+               };
+               mmc0_clk: mmc0_clk@e6150240 {
+                       compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
+                       reg = <0 0xe6150240 0 4>;
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-output-names = "mmc0";
+               };
+               ssp_clk: ssp_clk@e6150248 {
+                       compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
+                       reg = <0 0xe6150248 0 4>;
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-output-names = "ssp";
+               };
+               ssprs_clk: ssprs_clk@e615024c {
+                       compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
+                       reg = <0 0xe615024c 0 4>;
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-output-names = "ssprs";
+               };
+
+               /* Fixed factor clocks */
+               pll1_div2_clk: pll1_div2_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <2>;
+                       clock-mult = <1>;
+                       clock-output-names = "pll1_div2";
+               };
+               zg_clk: zg_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <3>;
+                       clock-mult = <1>;
+                       clock-output-names = "zg";
+               };
+               zx_clk: zx_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <3>;
+                       clock-mult = <1>;
+                       clock-output-names = "zx";
+               };
+               zs_clk: zs_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <6>;
+                       clock-mult = <1>;
+                       clock-output-names = "zs";
+               };
+               hp_clk: hp_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <12>;
+                       clock-mult = <1>;
+                       clock-output-names = "hp";
+               };
+               i_clk: i_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <2>;
+                       clock-mult = <1>;
+                       clock-output-names = "i";
+               };
+               b_clk: b_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <12>;
+                       clock-mult = <1>;
+                       clock-output-names = "b";
+               };
+               p_clk: p_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <24>;
+                       clock-mult = <1>;
+                       clock-output-names = "p";
+               };
+               cl_clk: cl_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <48>;
+                       clock-mult = <1>;
+                       clock-output-names = "cl";
+               };
+               m2_clk: m2_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <8>;
+                       clock-mult = <1>;
+                       clock-output-names = "m2";
+               };
+               imp_clk: imp_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <4>;
+                       clock-mult = <1>;
+                       clock-output-names = "imp";
+               };
+               rclk_clk: rclk_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <(48 * 1024)>;
+                       clock-mult = <1>;
+                       clock-output-names = "rclk";
+               };
+               oscclk_clk: oscclk_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL1>;
+                       #clock-cells = <0>;
+                       clock-div = <(12 * 1024)>;
+                       clock-mult = <1>;
+                       clock-output-names = "oscclk";
+               };
+               zb3_clk: zb3_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL3>;
+                       #clock-cells = <0>;
+                       clock-div = <4>;
+                       clock-mult = <1>;
+                       clock-output-names = "zb3";
+               };
+               zb3d2_clk: zb3d2_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL3>;
+                       #clock-cells = <0>;
+                       clock-div = <8>;
+                       clock-mult = <1>;
+                       clock-output-names = "zb3d2";
+               };
+               ddr_clk: ddr_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&cpg_clocks R8A7791_CLK_PLL3>;
+                       #clock-cells = <0>;
+                       clock-div = <8>;
+                       clock-mult = <1>;
+                       clock-output-names = "ddr";
+               };
+               mp_clk: mp_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&pll1_div2_clk>;
+                       #clock-cells = <0>;
+                       clock-div = <15>;
+                       clock-mult = <1>;
+                       clock-output-names = "mp";
+               };
+               cp_clk: cp_clk {
+                       compatible = "fixed-factor-clock";
+                       clocks = <&extal_clk>;
+                       #clock-cells = <0>;
+                       clock-div = <2>;
+                       clock-mult = <1>;
+                       clock-output-names = "cp";
+               };
+
+               /* Gate clocks */
+               mstp0_clks: mstp0_clks@e6150130 {
+                       compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150130 0 4>, <0 0xe6150030 0 4>;
+                       clocks = <&mp_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <R8A7791_CLK_MSIOF0>;
+                       clock-output-names = "msiof0";
+               };
+               mstp1_clks: mstp1_clks@e6150134 {
+                       compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>;
+                       clocks = <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>,
+                                <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <
+                               R8A7791_CLK_TMU1 R8A7791_CLK_TMU3 R8A7791_CLK_TMU2
+                               R8A7791_CLK_CMT0 R8A7791_CLK_TMU0 R8A7791_CLK_VSP1_DU1
+                               R8A7791_CLK_VSP1_DU0 R8A7791_CLK_VSP1_SY
+                       >;
+                       clock-output-names =
+                               "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1",
+                               "vsp1-du0", "vsp1-sy";
+               };
+               mstp2_clks: mstp2_clks@e6150138 {
+                       compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>;
+                       clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>,
+                                <&mp_clk>, <&mp_clk>, <&mp_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <
+                               R8A7791_CLK_SCIFA2 R8A7791_CLK_SCIFA1 R8A7791_CLK_SCIFA0
+                               R8A7791_CLK_MSIOF2 R8A7791_CLK_SCIFB0 R8A7791_CLK_SCIFB1
+                               R8A7791_CLK_MSIOF1 R8A7791_CLK_SCIFB2
+                       >;
+                       clock-output-names =
+                               "scifa2", "scifa1", "scifa0", "misof2", "scifb0",
+                               "scifb1", "msiof1", "scifb2";
+               };
+               mstp3_clks: mstp3_clks@e615013c {
+                       compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
+                       clocks = <&cp_clk>, <&sd2_clk>, <&sd1_clk>,
+                               <&cpg_clocks R8A7791_CLK_SD0>, <&mmc0_clk>, <&rclk_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <
+                               R8A7791_CLK_TPU0 R8A7791_CLK_SDHI2 R8A7791_CLK_SDHI1
+                               R8A7791_CLK_SDHI0 R8A7791_CLK_MMCIF0 R8A7791_CLK_CMT1
+                       >;
+                       clock-output-names =
+                               "tpu0", "sdhi2", "sdhi1", "sdhi0", "mmcif0", "cmt1";
+               };
+               mstp5_clks: mstp5_clks@e6150144 {
+                       compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>;
+                       clocks = <&extal_clk>, <&p_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <R8A7791_CLK_THERMAL R8A7791_CLK_PWM>;
+                       clock-output-names = "thermal", "pwm";
+               };
+               mstp7_clks: mstp7_clks@e615014c {
+                       compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe615014c 0 4>, <0 0xe61501c4 0 4>;
+                       clocks = <&mp_clk>, <&zs_clk>, <&p_clk>, <&p_clk>, <&zs_clk>,
+                                <&zs_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
+                                <&zx_clk>, <&zx_clk>, <&zx_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <
+                               R8A7791_CLK_HSUSB R8A7791_CLK_HSCIF2 R8A7791_CLK_SCIF5
+                               R8A7791_CLK_SCIF4 R8A7791_CLK_HSCIF1 R8A7791_CLK_HSCIF0
+                               R8A7791_CLK_SCIF3 R8A7791_CLK_SCIF2 R8A7791_CLK_SCIF1
+                               R8A7791_CLK_SCIF0 R8A7791_CLK_DU1 R8A7791_CLK_DU0
+                               R8A7791_CLK_LVDS0
+                       >;
+                       clock-output-names =
+                               "hsusb", "hscif2", "scif5", "scif4", "hscif1", "hscif0",
+                               "scif3", "scif2", "scif1", "scif0", "du1", "du0", "lvds0";
+               };
+               mstp8_clks: mstp8_clks@e6150990 {
+                       compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150990 0 4>, <0 0xe61509a0 0 4>;
+                       clocks = <&p_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <R8A7791_CLK_ETHER>;
+                       clock-output-names = "ether";
+               };
+               mstp9_clks: mstp9_clks@e6150994 {
+                       compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe6150994 0 4>, <0 0xe61509a4 0 4>;
+                       clocks = <&p_clk>, <&p_clk>, <&cpg_clocks R8A7791_CLK_QSPI>,
+                                <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
+                                <&p_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <
+                               R8A7791_CLK_RCAN1 R8A7791_CLK_RCAN0 R8A7791_CLK_QSPI_MOD
+                               R8A7791_CLK_I2C4 R8A7791_CLK_I2C4 R8A7791_CLK_I2C3
+                               R8A7791_CLK_I2C2 R8A7791_CLK_I2C1 R8A7791_CLK_I2C0
+                       >;
+                       clock-output-names =
+                               "rcan1", "rcan0", "qspi_mod", "i2c5", "i2c4", "i2c3",
+                               "i2c2", "i2c1", "i2c0";
+               };
+               mstp11_clks: mstp11_clks@e615099c {
+                       compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+                       reg = <0 0xe615099c 0 4>, <0 0xe61509ac 0 4>;
+                       clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>;
+                       #clock-cells = <1>;
+                       renesas,clock-indices = <
+                               R8A7791_CLK_SCIFA3 R8A7791_CLK_SCIFA4 R8A7791_CLK_SCIFA5
+                       >;
+                       clock-output-names = "scifa3", "scifa4", "scifa5";
+               };
        };
 };
index 5cdaba4cea8653d8db51616f443a4d8ee2d79ef4..1105558d188b2fe485aaf0cd9c4ba2ecc482b31b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * sama5d3.dtsi - Device Tree Include file for SAMA5D3 family SoC
- *                applies to SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35 SoC
+ *                applies to SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35, SAMA5D36 SoC
  *
  *  Copyright (C) 2013 Atmel,
  *                2013 Ludovic Desroches <ludovic.desroches@atmel.com>
@@ -13,6 +13,7 @@
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/clk/at91.h>
 
 / {
        model = "Atmel SAMA5D3 family SoC";
@@ -36,6 +37,7 @@
                i2c2 = &i2c2;
                ssc0 = &ssc0;
                ssc1 = &ssc1;
+               pwm0 = &pwm0;
        };
        cpus {
                #address-cells = <1>;
                reg = <0x20000000 0x8000000>;
        };
 
+       clocks {
+               adc_op_clk: adc_op_clk{
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <20000000>;
+               };
+       };
+
        ahb {
                compatible = "simple-bus";
                #address-cells = <1>;
@@ -79,6 +89,8 @@
                                status = "disabled";
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               clocks = <&mci0_clk>;
+                               clock-names = "mci_clk";
                        };
 
                        spi0: spi@f0004000 {
                                dma-names = "tx", "rx";
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_spi0>;
+                               clocks = <&spi0_clk>;
+                               clock-names = "spi_clk";
                                status = "disabled";
                        };
 
                                interrupts = <38 IRQ_TYPE_LEVEL_HIGH 4>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
+                               clocks = <&ssc0_clk>;
+                               clock-names = "pclk";
                                status = "disabled";
                        };
 
                                compatible = "atmel,at91sam9x5-tcb";
                                reg = <0xf0010000 0x100>;
                                interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>;
+                               clocks = <&tcb0_clk>;
+                               clock-names = "t0_clk";
                        };
 
                        i2c0: i2c@f0014000 {
                                pinctrl-0 = <&pinctrl_i2c0>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               clocks = <&twi0_clk>;
                                status = "disabled";
                        };
 
                                pinctrl-0 = <&pinctrl_i2c1>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               clocks = <&twi1_clk>;
                                status = "disabled";
                        };
 
                                interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_usart0>;
+                               clocks = <&usart0_clk>;
+                               clock-names = "usart";
                                status = "disabled";
                        };
 
                                interrupts = <13 IRQ_TYPE_LEVEL_HIGH 5>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_usart1>;
+                               clocks = <&usart1_clk>;
+                               clock-names = "usart";
+                               status = "disabled";
+                       };
+
+                       pwm0: pwm@f002c000 {
+                               compatible = "atmel,sama5d3-pwm";
+                               reg = <0xf002c000 0x300>;
+                               interrupts = <28 IRQ_TYPE_LEVEL_HIGH 4>;
+                               #pwm-cells = <3>;
+                               clocks = <&pwm_clk>;
                                status = "disabled";
                        };
 
                                status = "disabled";
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               clocks = <&mci1_clk>;
+                               clock-names = "mci_clk";
                        };
 
                        spi1: spi@f8008000 {
                                dma-names = "tx", "rx";
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_spi1>;
+                               clocks = <&spi1_clk>;
+                               clock-names = "spi_clk";
                                status = "disabled";
                        };
 
                                interrupts = <39 IRQ_TYPE_LEVEL_HIGH 4>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
+                               clocks = <&ssc1_clk>;
+                               clock-names = "pclk";
                                status = "disabled";
                        };
 
                                        &pinctrl_adc0_ad10
                                        &pinctrl_adc0_ad11
                                        >;
+                               clocks = <&adc_clk>,
+                                        <&adc_op_clk>;
+                               clock-names = "adc_clk", "adc_op_clk";
                                atmel,adc-channel-base = <0x50>;
                                atmel,adc-channels-used = <0xfff>;
                                atmel,adc-drdy-mask = <0x1000000>;
                                dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(11)>,
                                       <&dma1 2 AT91_DMA_CFG_PER_ID(12)>;
                                dma-names = "tx", "rx";
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_i2c2>;
                                #address-cells = <1>;
                                #size-cells = <0>;
+                               clocks = <&twi2_clk>;
                                status = "disabled";
                        };
 
                                interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_usart2>;
+                               clocks = <&usart2_clk>;
+                               clock-names = "usart";
                                status = "disabled";
                        };
 
                                interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_usart3>;
+                               clocks = <&usart3_clk>;
+                               clock-names = "usart";
                                status = "disabled";
                        };
 
                        sha@f8034000 {
-                               compatible = "atmel,sam9g46-sha";
+                               compatible = "atmel,at91sam9g46-sha";
                                reg = <0xf8034000 0x100>;
                                interrupts = <42 IRQ_TYPE_LEVEL_HIGH 0>;
+                               dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(17)>;
+                               dma-names = "tx";
+                               clocks = <&sha_clk>;
+                               clock-names = "sha_clk";
                        };
 
                        aes@f8038000 {
-                               compatible = "atmel,sam9g46-aes";
+                               compatible = "atmel,at91sam9g46-aes";
                                reg = <0xf8038000 0x100>;
-                               interrupts = <43 4 0>;
+                               interrupts = <43 IRQ_TYPE_LEVEL_HIGH 0>;
+                               dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(18)>,
+                                      <&dma1 2 AT91_DMA_CFG_PER_ID(19)>;
+                               dma-names = "tx", "rx";
+                               clocks = <&aes_clk>;
+                               clock-names = "aes_clk";
                        };
 
                        tdes@f803c000 {
-                               compatible = "atmel,sam9g46-tdes";
+                               compatible = "atmel,at91sam9g46-tdes";
                                reg = <0xf803c000 0x100>;
                                interrupts = <44 IRQ_TYPE_LEVEL_HIGH 0>;
+                               dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(20)>,
+                                      <&dma1 2 AT91_DMA_CFG_PER_ID(21)>;
+                               dma-names = "tx", "rx";
+                               clocks = <&tdes_clk>;
+                               clock-names = "tdes_clk";
                        };
 
                        dma0: dma-controller@ffffe600 {
                                reg = <0xffffe600 0x200>;
                                interrupts = <30 IRQ_TYPE_LEVEL_HIGH 0>;
                                #dma-cells = <2>;
+                               clocks = <&dma0_clk>;
+                               clock-names = "dma_clk";
                        };
 
                        dma1: dma-controller@ffffe800 {
                                reg = <0xffffe800 0x200>;
                                interrupts = <31 IRQ_TYPE_LEVEL_HIGH 0>;
                                #dma-cells = <2>;
+                               clocks = <&dma1_clk>;
+                               clock-names = "dma_clk";
                        };
 
                        ramc0: ramc@ffffea00 {
                                interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_dbgu>;
+                               clocks = <&dbgu_clk>;
+                               clock-names = "usart";
                                status = "disabled";
                        };
 
                                        };
                                };
 
+                               i2c2 {
+                                       pinctrl_i2c2: i2c2-0 {
+                                               atmel,pins =
+                                                       <AT91_PIOA 18 AT91_PERIPH_B AT91_PINCTRL_NONE   /* TWD2 pin, conflicts with LCDDAT18, ISI_D2 */
+                                                        AT91_PIOA 19 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* TWCK2 pin, conflicts with LCDDAT19, ISI_D3 */
+                                       };
+                               };
+
                                isi {
                                        pinctrl_isi: isi-0 {
                                                atmel,pins =
                                        gpio-controller;
                                        interrupt-controller;
                                        #interrupt-cells = <2>;
+                                       clocks = <&pioA_clk>;
                                };
 
                                pioB: gpio@fffff400 {
                                        gpio-controller;
                                        interrupt-controller;
                                        #interrupt-cells = <2>;
+                                       clocks = <&pioB_clk>;
                                };
 
                                pioC: gpio@fffff600 {
                                        gpio-controller;
                                        interrupt-controller;
                                        #interrupt-cells = <2>;
+                                       clocks = <&pioC_clk>;
                                };
 
                                pioD: gpio@fffff800 {
                                        gpio-controller;
                                        interrupt-controller;
                                        #interrupt-cells = <2>;
+                                       clocks = <&pioD_clk>;
                                };
 
                                pioE: gpio@fffffa00 {
                                        gpio-controller;
                                        interrupt-controller;
                                        #interrupt-cells = <2>;
+                                       clocks = <&pioE_clk>;
                                };
                        };
 
                        pmc: pmc@fffffc00 {
-                               compatible = "atmel,at91rm9200-pmc";
+                               compatible = "atmel,sama5d3-pmc";
                                reg = <0xfffffc00 0x120>;
+                               interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+                               interrupt-controller;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               #interrupt-cells = <1>;
+
+                               clk32k: slck {
+                                       compatible = "fixed-clock";
+                                       #clock-cells = <0>;
+                                       clock-frequency = <32768>;
+                               };
+
+                               main: mainck {
+                                       compatible = "atmel,at91rm9200-clk-main";
+                                       #clock-cells = <0>;
+                                       interrupt-parent = <&pmc>;
+                                       interrupts = <AT91_PMC_MOSCS>;
+                                       clocks = <&clk32k>;
+                               };
+
+                               plla: pllack {
+                                       compatible = "atmel,sama5d3-clk-pll";
+                                       #clock-cells = <0>;
+                                       interrupt-parent = <&pmc>;
+                                       interrupts = <AT91_PMC_LOCKA>;
+                                       clocks = <&main>;
+                                       reg = <0>;
+                                       atmel,clk-input-range = <8000000 50000000>;
+                                       #atmel,pll-clk-output-range-cells = <4>;
+                                       atmel,pll-clk-output-ranges = <400000000 1000000000 0 0>;
+                               };
+
+                               plladiv: plladivck {
+                                       compatible = "atmel,at91sam9x5-clk-plldiv";
+                                       #clock-cells = <0>;
+                                       clocks = <&plla>;
+                               };
+
+                               utmi: utmick {
+                                       compatible = "atmel,at91sam9x5-clk-utmi";
+                                       #clock-cells = <0>;
+                                       interrupt-parent = <&pmc>;
+                                       interrupts = <AT91_PMC_LOCKU>;
+                                       clocks = <&main>;
+                               };
+
+                               mck: masterck {
+                                       compatible = "atmel,at91sam9x5-clk-master";
+                                       #clock-cells = <0>;
+                                       interrupt-parent = <&pmc>;
+                                       interrupts = <AT91_PMC_MCKRDY>;
+                                       clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>;
+                                       atmel,clk-output-range = <0 166000000>;
+                                       atmel,clk-divisors = <1 2 4 3>;
+                               };
+
+                               usb: usbck {
+                                       compatible = "atmel,at91sam9x5-clk-usb";
+                                       #clock-cells = <0>;
+                                       clocks = <&plladiv>, <&utmi>;
+                               };
+
+                               prog: progck {
+                                       compatible = "atmel,at91sam9x5-clk-programmable";
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       interrupt-parent = <&pmc>;
+                                       clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>;
+
+                                       prog0: prog0 {
+                                               #clock-cells = <0>;
+                                               reg = <0>;
+                                               interrupts = <AT91_PMC_PCKRDY(0)>;
+                                       };
+
+                                       prog1: prog1 {
+                                               #clock-cells = <0>;
+                                               reg = <1>;
+                                               interrupts = <AT91_PMC_PCKRDY(1)>;
+                                       };
+
+                                       prog2: prog2 {
+                                               #clock-cells = <0>;
+                                               reg = <2>;
+                                               interrupts = <AT91_PMC_PCKRDY(2)>;
+                                       };
+                               };
+
+                               smd: smdclk {
+                                       compatible = "atmel,at91sam9x5-clk-smd";
+                                       #clock-cells = <0>;
+                                       clocks = <&plladiv>, <&utmi>;
+                               };
+
+                               systemck {
+                                       compatible = "atmel,at91rm9200-clk-system";
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       ddrck: ddrck {
+                                               #clock-cells = <0>;
+                                               reg = <2>;
+                                               clocks = <&mck>;
+                                       };
+
+                                       smdck: smdck {
+                                               #clock-cells = <0>;
+                                               reg = <4>;
+                                               clocks = <&smd>;
+                                       };
+
+                                       uhpck: uhpck {
+                                               #clock-cells = <0>;
+                                               reg = <6>;
+                                               clocks = <&usb>;
+                                       };
+
+                                       udpck: udpck {
+                                               #clock-cells = <0>;
+                                               reg = <7>;
+                                               clocks = <&usb>;
+                                       };
+
+                                       pck0: pck0 {
+                                               #clock-cells = <0>;
+                                               reg = <8>;
+                                               clocks = <&prog0>;
+                                       };
+
+                                       pck1: pck1 {
+                                               #clock-cells = <0>;
+                                               reg = <9>;
+                                               clocks = <&prog1>;
+                                       };
+
+                                       pck2: pck2 {
+                                               #clock-cells = <0>;
+                                               reg = <10>;
+                                               clocks = <&prog2>;
+                                       };
+                               };
+
+                               periphck {
+                                       compatible = "atmel,at91sam9x5-clk-peripheral";
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       clocks = <&mck>;
+
+                                       dbgu_clk: dbgu_clk {
+                                               #clock-cells = <0>;
+                                               reg = <2>;
+                                       };
+
+                                       pioA_clk: pioA_clk {
+                                               #clock-cells = <0>;
+                                               reg = <6>;
+                                       };
+
+                                       pioB_clk: pioB_clk {
+                                               #clock-cells = <0>;
+                                               reg = <7>;
+                                       };
+
+                                       pioC_clk: pioC_clk {
+                                               #clock-cells = <0>;
+                                               reg = <8>;
+                                       };
+
+                                       pioD_clk: pioD_clk {
+                                               #clock-cells = <0>;
+                                               reg = <9>;
+                                       };
+
+                                       pioE_clk: pioE_clk {
+                                               #clock-cells = <0>;
+                                               reg = <10>;
+                                       };
+
+                                       usart0_clk: usart0_clk {
+                                               #clock-cells = <0>;
+                                               reg = <12>;
+                                               atmel,clk-output-range = <0 66000000>;
+                                       };
+
+                                       usart1_clk: usart1_clk {
+                                               #clock-cells = <0>;
+                                               reg = <13>;
+                                               atmel,clk-output-range = <0 66000000>;
+                                       };
+
+                                       usart2_clk: usart2_clk {
+                                               #clock-cells = <0>;
+                                               reg = <14>;
+                                               atmel,clk-output-range = <0 66000000>;
+                                       };
+
+                                       usart3_clk: usart3_clk {
+                                               #clock-cells = <0>;
+                                               reg = <15>;
+                                               atmel,clk-output-range = <0 66000000>;
+                                       };
+
+                                       twi0_clk: twi0_clk {
+                                               reg = <18>;
+                                               #clock-cells = <0>;
+                                               atmel,clk-output-range = <0 16625000>;
+                                       };
+
+                                       twi1_clk: twi1_clk {
+                                               #clock-cells = <0>;
+                                               reg = <19>;
+                                               atmel,clk-output-range = <0 16625000>;
+                                       };
+
+                                       twi2_clk: twi2_clk {
+                                               #clock-cells = <0>;
+                                               reg = <20>;
+                                               atmel,clk-output-range = <0 16625000>;
+                                       };
+
+                                       mci0_clk: mci0_clk {
+                                               #clock-cells = <0>;
+                                               reg = <21>;
+                                       };
+
+                                       mci1_clk: mci1_clk {
+                                               #clock-cells = <0>;
+                                               reg = <22>;
+                                       };
+
+                                       spi0_clk: spi0_clk {
+                                               #clock-cells = <0>;
+                                               reg = <24>;
+                                               atmel,clk-output-range = <0 133000000>;
+                                       };
+
+                                       spi1_clk: spi1_clk {
+                                               #clock-cells = <0>;
+                                               reg = <25>;
+                                               atmel,clk-output-range = <0 133000000>;
+                                       };
+
+                                       tcb0_clk: tcb0_clk {
+                                               #clock-cells = <0>;
+                                               reg = <26>;
+                                               atmel,clk-output-range = <0 133000000>;
+                                       };
+
+                                       pwm_clk: pwm_clk {
+                                               #clock-cells = <0>;
+                                               reg = <28>;
+                                       };
+
+                                       adc_clk: adc_clk {
+                                               #clock-cells = <0>;
+                                               reg = <29>;
+                                               atmel,clk-output-range = <0 66000000>;
+                                       };
+
+                                       dma0_clk: dma0_clk {
+                                               #clock-cells = <0>;
+                                               reg = <30>;
+                                       };
+
+                                       dma1_clk: dma1_clk {
+                                               #clock-cells = <0>;
+                                               reg = <31>;
+                                       };
+
+                                       uhphs_clk: uhphs_clk {
+                                               #clock-cells = <0>;
+                                               reg = <32>;
+                                       };
+
+                                       udphs_clk: udphs_clk {
+                                               #clock-cells = <0>;
+                                               reg = <33>;
+                                       };
+
+                                       isi_clk: isi_clk {
+                                               #clock-cells = <0>;
+                                               reg = <37>;
+                                       };
+
+                                       ssc0_clk: ssc0_clk {
+                                               #clock-cells = <0>;
+                                               reg = <38>;
+                                               atmel,clk-output-range = <0 66000000>;
+                                       };
+
+                                       ssc1_clk: ssc1_clk {
+                                               #clock-cells = <0>;
+                                               reg = <39>;
+                                               atmel,clk-output-range = <0 66000000>;
+                                       };
+
+                                       sha_clk: sha_clk {
+                                               #clock-cells = <0>;
+                                               reg = <42>;
+                                       };
+
+                                       aes_clk: aes_clk {
+                                               #clock-cells = <0>;
+                                               reg = <43>;
+                                       };
+
+                                       tdes_clk: tdes_clk {
+                                               #clock-cells = <0>;
+                                               reg = <44>;
+                                       };
+
+                                       trng_clk: trng_clk {
+                                               #clock-cells = <0>;
+                                               reg = <45>;
+                                       };
+
+                                       fuse_clk: fuse_clk {
+                                               #clock-cells = <0>;
+                                               reg = <48>;
+                                       };
+                               };
                        };
 
                        rstc@fffffe00 {
                                compatible = "atmel,at91sam9260-pit";
                                reg = <0xfffffe30 0xf>;
                                interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>;
+                               clocks = <&mck>;
                        };
 
                        watchdog@fffffe40 {
                        reg = <0x00500000 0x100000
                               0xf8030000 0x4000>;
                        interrupts = <33 IRQ_TYPE_LEVEL_HIGH 2>;
+                       clocks = <&udphs_clk>, <&utmi>;
+                       clock-names = "pclk", "hclk";
                        status = "disabled";
 
                        ep0 {
                        compatible = "atmel,at91rm9200-ohci", "usb-ohci";
                        reg = <0x00600000 0x100000>;
                        interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>;
+                       clocks = <&usb>, <&uhphs_clk>, <&udphs_clk>,
+                                <&uhpck>;
+                       clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck";
                        status = "disabled";
                };
 
                        compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
                        reg = <0x00700000 0x100000>;
                        interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>;
+                       clocks = <&usb>, <&uhphs_clk>, <&uhpck>;
+                       clock-names = "usb_clk", "ehci_clk", "uhpck";
                        status = "disabled";
                };
 
diff --git a/arch/arm/boot/dts/sama5d36.dtsi b/arch/arm/boot/dts/sama5d36.dtsi
new file mode 100644 (file)
index 0000000..6c31c26
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * sama5d36.dtsi - Device Tree Include file for SAMA5D36 SoC
+ *
+ *  Copyright (C) 2013 Atmel,
+ *                2013 Josh Wu <josh.wu@atmel.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+#include "sama5d3.dtsi"
+#include "sama5d3_can.dtsi"
+#include "sama5d3_emac.dtsi"
+#include "sama5d3_gmac.dtsi"
+#include "sama5d3_lcd.dtsi"
+#include "sama5d3_mci2.dtsi"
+#include "sama5d3_tcb1.dtsi"
+#include "sama5d3_uart.dtsi"
+
+/ {
+       compatible = "atmel,samad36", "atmel,sama5d3", "atmel,sama5";
+};
diff --git a/arch/arm/boot/dts/sama5d36ek.dts b/arch/arm/boot/dts/sama5d36ek.dts
new file mode 100644 (file)
index 0000000..59576c6
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * sama5d36ek.dts - Device Tree file for SAMA5D36-EK board
+ *
+ *  Copyright (C) 2013 Atmel,
+ *                2013 Josh Wu <josh.wu@atmel.com>
+ *
+ * Licensed under GPLv2 or later.
+ */
+/dts-v1/;
+#include "sama5d36.dtsi"
+#include "sama5d3xmb.dtsi"
+#include "sama5d3xdm.dtsi"
+
+/ {
+       model = "Atmel SAMA5D36-EK";
+       compatible = "atmel,sama5d36ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d36", "atmel,sama5d3", "atmel,sama5";
+
+       ahb {
+               apb {
+                       spi0: spi@f0004000 {
+                               status = "okay";
+                       };
+
+                       ssc0: ssc@f0008000 {
+                               status = "okay";
+                       };
+
+                       can0: can@f000c000 {
+                               status = "okay";
+                       };
+
+                       i2c0: i2c@f0014000 {
+                               status = "okay";
+                       };
+
+                       i2c1: i2c@f0018000 {
+                               status = "okay";
+                       };
+
+                       macb0: ethernet@f0028000 {
+                               status = "okay";
+                       };
+
+                       macb1: ethernet@f802c000 {
+                               status = "okay";
+                       };
+               };
+       };
+
+       sound {
+               status = "okay";
+       };
+};
index 8ed3260cef6687b59e084c07366633ef3c9acc0e..a0775851cce56d01c696adb65a4cbf2f8dc9d514 100644 (file)
 
                        };
 
+                       pmc: pmc@fffffc00 {
+                               periphck {
+                                       can0_clk: can0_clk {
+                                               #clock-cells = <0>;
+                                               reg = <40>;
+                                               atmel,clk-output-range = <0 66000000>;
+                                       };
+
+                                       can1_clk: can0_clk {
+                                               #clock-cells = <0>;
+                                               reg = <41>;
+                                               atmel,clk-output-range = <0 66000000>;
+                                       };
+                               };
+                       };
+
                        can0: can@f000c000 {
                                compatible = "atmel,at91sam9x5-can";
                                reg = <0xf000c000 0x300>;
                                interrupts = <40 IRQ_TYPE_LEVEL_HIGH 3>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_can0_rx_tx>;
+                               clocks = <&can0_clk>;
+                               clock-names = "can_clk";
                                status = "disabled";
                        };
 
@@ -47,6 +65,8 @@
                                interrupts = <41 IRQ_TYPE_LEVEL_HIGH 3>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_can1_rx_tx>;
+                               clocks = <&can1_clk>;
+                               clock-names = "can_clk";
                                status = "disabled";
                        };
                };
index 4d4f351f1f9facbc30cc249dffa34d94bfcf4113..fe2af92763129beb8b4b493adbfb847684b4a264 100644 (file)
                                };
                        };
 
+                       pmc: pmc@fffffc00 {
+                               periphck {
+                                       macb1_clk: macb1_clk {
+                                               #clock-cells = <0>;
+                                               reg = <35>;
+                                       };
+                               };
+                       };
+
                        macb1: ethernet@f802c000 {
                                compatible = "cdns,at32ap7000-macb", "cdns,macb";
                                reg = <0xf802c000 0x100>;
                                interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_macb1_rmii>;
+                               clocks = <&macb1_clk>, <&macb1_clk>;
+                               clock-names = "hclk", "pclk";
                                status = "disabled";
                        };
                };
index 0ba8be30ccd8900bfc77b803aeac537fb89ce619..a6cb0508762f159579d719032e2dbb2d28ccb879 100644 (file)
                                };
                        };
 
+                       pmc: pmc@fffffc00 {
+                               periphck {
+                                       macb0_clk: macb0_clk {
+                                               #clock-cells = <0>;
+                                               reg = <34>;
+                                       };
+                               };
+                       };
+
                        macb0: ethernet@f0028000 {
                                compatible = "cdns,pc302-gem", "cdns,gem";
                                reg = <0xf0028000 0x100>;
                                interrupts = <34 IRQ_TYPE_LEVEL_HIGH 3>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>;
+                               clocks = <&macb0_clk>, <&macb0_clk>;
+                               clock-names = "hclk", "pclk";
                                status = "disabled";
                        };
                };
index 01f52a79f8baeb458532b60bfac20a20f6283db2..85d30270156561c3e8b44cc189482ec469c6e1af 100644 (file)
                                        };
                                };
                        };
+
+                       pmc: pmc@fffffc00 {
+                               periphck {
+                                       lcdc_clk: lcdc_clk {
+                                               #clock-cells = <0>;
+                                               reg = <36>;
+                                       };
+                               };
+
+                               systemck {
+                                       lcdck: lcdck {
+                                               #clock-cells = <0>;
+                                               reg = <3>;
+                                               clocks = <&mck>;
+                                       };
+                               };
+                       };
                };
        };
 };
index 38e88e39e551c2c68b75720b1133b5b4591e5d8f..b029fe7ef17a657946de4d2fe71168b4b03210d8 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/clk/at91.h>
 
 / {
        ahb {
                                };
                        };
 
+                       pmc: pmc@fffffc00 {
+                               periphck {
+                                       mci2_clk: mci2_clk {
+                                               #clock-cells = <0>;
+                                               reg = <23>;
+                                       };
+                               };
+                       };
+
                        mmc2: mmc@f8004000 {
                                compatible = "atmel,hsmci";
                                reg = <0xf8004000 0x600>;
@@ -38,6 +48,8 @@
                                dma-names = "rxtx";
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>;
+                               clocks = <&mci2_clk>;
+                               clock-names = "mci_clk";
                                status = "disabled";
                                #address-cells = <1>;
                                #size-cells = <0>;
index 5264bb4a69988606c0c5e8dd19c61fc0a8c9c0db..382b04431f66b621e01a9f2fe7a9e488ac4c171b 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/clk/at91.h>
 
 / {
        aliases {
 
        ahb {
                apb {
+                       pmc: pmc@fffffc00 {
+                               periphck {
+                                       tcb1_clk: tcb1_clk {
+                                               #clock-cells = <0>;
+                                               reg = <27>;
+                                       };
+                               };
+                       };
+
                        tcb1: timer@f8014000 {
                                compatible = "atmel,at91sam9x5-tcb";
                                reg = <0xf8014000 0x100>;
                                interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>;
+                               clocks = <&tcb1_clk>;
+                               clock-names = "t0_clk";
                        };
                };
        };
index 98fcb2d57446708e42cc22892d0def31273cd543..a9fa75e4165205f9a1259f9a0821519faee54070 100644 (file)
@@ -9,8 +9,14 @@
 
 #include <dt-bindings/pinctrl/at91.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/clk/at91.h>
 
 / {
+       aliases {
+               serial5 = &uart0;
+               serial6 = &uart1;
+       };
+
        ahb {
                apb {
                        pinctrl@fffff200 {
                                };
                        };
 
+                       pmc: pmc@fffffc00 {
+                               periphck {
+                                       uart0_clk: uart0_clk {
+                                               #clock-cells = <0>;
+                                               reg = <16>;
+                                               atmel,clk-output-range = <0 66000000>;
+                                       };
+
+                                       uart1_clk: uart1_clk {
+                                               #clock-cells = <0>;
+                                               reg = <17>;
+                                               atmel,clk-output-range = <0 66000000>;
+                                       };
+                               };
+                       };
+
                        uart0: serial@f0024000 {
                                compatible = "atmel,at91sam9260-usart";
                                reg = <0xf0024000 0x200>;
                                interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_uart0>;
+                               clocks = <&uart0_clk>;
+                               clock-names = "usart";
                                status = "disabled";
                        };
 
@@ -46,6 +70,8 @@
                                interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&pinctrl_uart1>;
+                               clocks = <&uart1_clk>;
+                               clock-names = "usart";
                                status = "disabled";
                        };
                };
index 726a0f35100c5218fb0b467bef7fa611f953b6de..f55ed072c8e6b1c0290a5aa3eb4ab4b7680e121b 100644 (file)
                reg = <0x20000000 0x20000000>;
        };
 
-       clocks {
-               #address-cells = <1>;
-               #size-cells = <1>;
-               ranges;
-
-               main_clock: clock@0 {
-                       compatible = "atmel,osc", "fixed-clock";
-                       clock-frequency = <12000000>;
-               };
-       };
-
        ahb {
                apb {
                        spi0: spi@f0004000 {
                        macb0: ethernet@f0028000 {
                                phy-mode = "rgmii";
                        };
+
+                       pmc: pmc@fffffc00 {
+                               main: mainck {
+                                       clock-frequency = <12000000>;
+                               };
+                       };
                };
 
                nand0: nand@60000000 {
index 1c296d6b2f2a7925cd3af7d9b6e73e439d17d25d..f9bdde542ced2f9e0a76aa6ae73a5a7478215ae6 100644 (file)
@@ -18,6 +18,7 @@
                                        interrupts = <31 0x0>;
                                        pinctrl-names = "default";
                                        pinctrl-0 = <&pinctrl_qt1070_irq>;
+                                       wakeup-source;
                                };
                        };
 
index 8acf51e0cdae8b10bdda5d875a61f4c9e543e19c..a759a276c9a972d4174e519240e4f9ed7d720fd0 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "sh7372.dtsi"
+#include "sh7372.dtsi"
 
 / {
        model = "Mackerel (AP4 EVM 2nd)";
index 8ee06dd81799da98cbe14ed6c43973e4d4bd513f..eb8886b535e4a28345ac5ae848ce85de47fcbbe4 100644 (file)
@@ -12,8 +12,9 @@
  */
 
 /dts-v1/;
-/include/ "sh73a0.dtsi"
+#include "sh73a0.dtsi"
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
        model = "KZM-A9-GT";
@@ -82,7 +83,7 @@
                reg = <0x10000000 0x100>;
                phy-mode = "mii";
                interrupt-parent = <&irqpin0>;
-               interrupts = <3 0>;     /* active low */
+               interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
                reg-io-width = <4>;
                smsc,irq-push-pull;
                smsc,save-mac-address;
                        gpios = <&pfc 23 GPIO_ACTIVE_LOW>;
                };
        };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               back-key {
+                       gpios = <&pcf8575 8 GPIO_ACTIVE_LOW>;
+                       linux,code = <158>;
+                       label = "SW3";
+               };
+
+               right-key {
+                       gpios = <&pcf8575 9 GPIO_ACTIVE_LOW>;
+                       linux,code = <106>;
+                       label = "SW2-R";
+               };
+
+               left-key {
+                       gpios = <&pcf8575 10 GPIO_ACTIVE_LOW>;
+                       linux,code = <105>;
+                       label = "SW2-L";
+               };
+
+               enter-key {
+                       gpios = <&pcf8575 11 GPIO_ACTIVE_LOW>;
+                       linux,code = <28>;
+                       label = "SW2-P";
+               };
+
+               up-key {
+                       gpios = <&pcf8575 12 GPIO_ACTIVE_LOW>;
+                       linux,code = <103>;
+                       label = "SW2-U";
+               };
+
+               down-key {
+                       gpios = <&pcf8575 13 GPIO_ACTIVE_LOW>;
+                       linux,code = <108>;
+                       label = "SW2-D";
+               };
+
+               home-key {
+                       gpios = <&pcf8575 14 GPIO_ACTIVE_LOW>;
+                       linux,code = <102>;
+                       label = "SW1";
+               };
+       };
+
+       sound {
+               compatible = "simple-audio-card";
+               simple-audio-card,format = "left_j";
+               simple-audio-card,cpu {
+                       sound-dai = <&sh_fsi2 0>;
+               };
+               simple-audio-card,codec {
+                       sound-dai = <&ak4648>;
+                       bitclock-master;
+                       frame-master;
+                       system-clock-frequency = <11289600>;
+               };
+       };
 };
 
 &i2c0 {
                        };
                };
        };
+
+       ak4648: ak4648@0x12 {
+               #sound-dai-cells = <0>;
+               compatible = "asahi-kasei,ak4648";
+               reg = <0x12>;
+       };
 };
 
 &i2c3 {
        pinctrl-0 = <&i2c3_pins>;
        pinctrl-names = "default";
        status = "okay";
+
+       pcf8575: gpio@20 {
+               compatible = "nxp,pcf8575";
+               reg = <0x20>;
+               interrupt-parent = <&irqpin2>;
+               interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-controller;
+               #interrupt-cells = <2>;
+       };
 };
 
 &mmcif {
                renesas,function = "i2c3";
        };
 
-       mmcif_pins: mmcif {
+       mmcif_pins: mmc {
                mux {
                        renesas,groups = "mmc0_data8_0", "mmc0_ctrl_0";
                        renesas,function = "mmc0";
                };
        };
 
-       scifa4_pins: scifa4 {
+       scifa4_pins: serial4 {
                renesas,groups = "scifa4_data", "scifa4_ctrl";
                renesas,function = "scifa4";
        };
 
-       sdhi0_pins: sdhi0 {
+       sdhi0_pins: sd0 {
                renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd", "sdhi0_wp";
                renesas,function = "sdhi0";
        };
 
-       sdhi2_pins: sdhi2 {
+       sdhi2_pins: sd2 {
                renesas,groups = "sdhi2_data4", "sdhi2_ctrl";
                renesas,function = "sdhi2";
        };
+
+       fsia_pins: sounda {
+               renesas,groups = "fsia_mclk_in", "fsia_sclk_in",
+                                "fsia_data_in", "fsia_data_out";
+               renesas,function = "fsia";
+       };
 };
 
 &sdhi0 {
        broken-cd;
        status = "okay";
 };
+
+&sh_fsi2 {
+       pinctrl-0 = <&fsia_pins>;
+       pinctrl-names = "default";
+
+       status = "okay";
+};
index 0f1ca7792c46acebbbce831371e04200aa89846d..27c5f426d172f03d53801875ec5a5293c4f45b88 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "sh73a0.dtsi"
+#include "sh73a0.dtsi"
 
 / {
        model = "KZM-A9-GT";
index fcf26889a8a0aacb380d980fb6cccdd36ee36dff..b7bd3b9a67533933623ba5b5c118ae46c035f019 100644 (file)
@@ -10,6 +10,8 @@
 
 /include/ "skeleton.dtsi"
 
+#include <dt-bindings/interrupt-controller/irq.h>
+
 / {
        compatible = "renesas,sh73a0";
 
 
        pmu {
                compatible = "arm,cortex-a9-pmu";
-               interrupts = <0 55 4>,
-                            <0 56 4>;
+               interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>,
+                            <0 56 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        irqpin0: irqpin@e6900000 {
-               compatible = "renesas,intc-irqpin";
+               compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
                #interrupt-cells = <2>;
                interrupt-controller;
                reg = <0xe6900000 4>,
                        <0xe6900040 1>,
                        <0xe6900060 1>;
                interrupt-parent = <&gic>;
-               interrupts = <0 1 0x4
-                             0 2 0x4
-                             0 3 0x4
-                             0 4 0x4
-                             0 5 0x4
-                             0 6 0x4
-                             0 7 0x4
-                             0 8 0x4>;
+               interrupts = <0 1 IRQ_TYPE_LEVEL_HIGH
+                             0 2 IRQ_TYPE_LEVEL_HIGH
+                             0 3 IRQ_TYPE_LEVEL_HIGH
+                             0 4 IRQ_TYPE_LEVEL_HIGH
+                             0 5 IRQ_TYPE_LEVEL_HIGH
+                             0 6 IRQ_TYPE_LEVEL_HIGH
+                             0 7 IRQ_TYPE_LEVEL_HIGH
+                             0 8 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        irqpin1: irqpin@e6900004 {
-               compatible = "renesas,intc-irqpin";
+               compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
                #interrupt-cells = <2>;
                interrupt-controller;
                reg = <0xe6900004 4>,
                        <0xe6900044 1>,
                        <0xe6900064 1>;
                interrupt-parent = <&gic>;
-               interrupts = <0 9 0x4
-                             0 10 0x4
-                             0 11 0x4
-                             0 12 0x4
-                             0 13 0x4
-                             0 14 0x4
-                             0 15 0x4
-                             0 16 0x4>;
+               interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH
+                             0 10 IRQ_TYPE_LEVEL_HIGH
+                             0 11 IRQ_TYPE_LEVEL_HIGH
+                             0 12 IRQ_TYPE_LEVEL_HIGH
+                             0 13 IRQ_TYPE_LEVEL_HIGH
+                             0 14 IRQ_TYPE_LEVEL_HIGH
+                             0 15 IRQ_TYPE_LEVEL_HIGH
+                             0 16 IRQ_TYPE_LEVEL_HIGH>;
                control-parent;
        };
 
        irqpin2: irqpin@e6900008 {
-               compatible = "renesas,intc-irqpin";
+               compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
                #interrupt-cells = <2>;
                interrupt-controller;
                reg = <0xe6900008 4>,
                        <0xe6900048 1>,
                        <0xe6900068 1>;
                interrupt-parent = <&gic>;
-               interrupts = <0 17 0x4
-                             0 18 0x4
-                             0 19 0x4
-                             0 20 0x4
-                             0 21 0x4
-                             0 22 0x4
-                             0 23 0x4
-                             0 24 0x4>;
+               interrupts = <0 17 IRQ_TYPE_LEVEL_HIGH
+                             0 18 IRQ_TYPE_LEVEL_HIGH
+                             0 19 IRQ_TYPE_LEVEL_HIGH
+                             0 20 IRQ_TYPE_LEVEL_HIGH
+                             0 21 IRQ_TYPE_LEVEL_HIGH
+                             0 22 IRQ_TYPE_LEVEL_HIGH
+                             0 23 IRQ_TYPE_LEVEL_HIGH
+                             0 24 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        irqpin3: irqpin@e690000c {
-               compatible = "renesas,intc-irqpin";
+               compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
                #interrupt-cells = <2>;
                interrupt-controller;
                reg = <0xe690000c 4>,
                        <0xe690004c 1>,
                        <0xe690006c 1>;
                interrupt-parent = <&gic>;
-               interrupts = <0 25 0x4
-                             0 26 0x4
-                             0 27 0x4
-                             0 28 0x4
-                             0 29 0x4
-                             0 30 0x4
-                             0 31 0x4
-                             0 32 0x4>;
+               interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH
+                             0 26 IRQ_TYPE_LEVEL_HIGH
+                             0 27 IRQ_TYPE_LEVEL_HIGH
+                             0 28 IRQ_TYPE_LEVEL_HIGH
+                             0 29 IRQ_TYPE_LEVEL_HIGH
+                             0 30 IRQ_TYPE_LEVEL_HIGH
+                             0 31 IRQ_TYPE_LEVEL_HIGH
+                             0 32 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        i2c0: i2c@e6820000 {
                compatible = "renesas,rmobile-iic";
                reg = <0xe6820000 0x425>;
                interrupt-parent = <&gic>;
-               interrupts = <0 167 0x4
-                             0 168 0x4
-                             0 169 0x4
-                             0 170 0x4>;
+               interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH
+                             0 168 IRQ_TYPE_LEVEL_HIGH
+                             0 169 IRQ_TYPE_LEVEL_HIGH
+                             0 170 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0xe6822000 0x425>;
                interrupt-parent = <&gic>;
-               interrupts = <0 51 0x4
-                             0 52 0x4
-                             0 53 0x4
-                             0 54 0x4>;
+               interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH
+                             0 52 IRQ_TYPE_LEVEL_HIGH
+                             0 53 IRQ_TYPE_LEVEL_HIGH
+                             0 54 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0xe6824000 0x425>;
                interrupt-parent = <&gic>;
-               interrupts = <0 171 0x4
-                             0 172 0x4
-                             0 173 0x4
-                             0 174 0x4>;
+               interrupts = <0 171 IRQ_TYPE_LEVEL_HIGH
+                             0 172 IRQ_TYPE_LEVEL_HIGH
+                             0 173 IRQ_TYPE_LEVEL_HIGH
+                             0 174 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0xe6826000 0x425>;
                interrupt-parent = <&gic>;
-               interrupts = <0 183 0x4
-                             0 184 0x4
-                             0 185 0x4
-                             0 186 0x4>;
+               interrupts = <0 183 IRQ_TYPE_LEVEL_HIGH
+                             0 184 IRQ_TYPE_LEVEL_HIGH
+                             0 185 IRQ_TYPE_LEVEL_HIGH
+                             0 186 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
                compatible = "renesas,rmobile-iic";
                reg = <0xe6828000 0x425>;
                interrupt-parent = <&gic>;
-               interrupts = <0 187 0x4
-                             0 188 0x4
-                             0 189 0x4
-                             0 190 0x4>;
+               interrupts = <0 187 IRQ_TYPE_LEVEL_HIGH
+                             0 188 IRQ_TYPE_LEVEL_HIGH
+                             0 189 IRQ_TYPE_LEVEL_HIGH
+                             0 190 IRQ_TYPE_LEVEL_HIGH>;
                status = "disabled";
        };
 
-       mmcif: mmcif@e6bd0000 {
+       mmcif: mmc@e6bd0000 {
                compatible = "renesas,sh-mmcif";
                reg = <0xe6bd0000 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 140 0x4
-                             0 141 0x4>;
+               interrupts = <0 140 IRQ_TYPE_LEVEL_HIGH
+                             0 141 IRQ_TYPE_LEVEL_HIGH>;
                reg-io-width = <4>;
                status = "disabled";
        };
 
-       sdhi0: sdhi@ee100000 {
-               compatible = "renesas,sdhi-r8a7740";
+       sdhi0: sd@ee100000 {
+               compatible = "renesas,sdhi-sh73a0";
                reg = <0xee100000 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 83 4
-                               0 84 4
-                               0 85 4>;
+               interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH
+                             0 84 IRQ_TYPE_LEVEL_HIGH
+                             0 85 IRQ_TYPE_LEVEL_HIGH>;
                cap-sd-highspeed;
                status = "disabled";
        };
 
        /* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */
-       sdhi1: sdhi@ee120000 {
-               compatible = "renesas,sdhi-r8a7740";
+       sdhi1: sd@ee120000 {
+               compatible = "renesas,sdhi-sh73a0";
                reg = <0xee120000 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 88 4
-                               0 89 4>;
+               interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH
+                             0 89 IRQ_TYPE_LEVEL_HIGH>;
                toshiba,mmc-wrprotect-disable;
                cap-sd-highspeed;
                status = "disabled";
        };
 
-       sdhi2: sdhi@ee140000 {
-               compatible = "renesas,sdhi-r8a7740";
+       sdhi2: sd@ee140000 {
+               compatible = "renesas,sdhi-sh73a0";
                reg = <0xee140000 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 104 4
-                               0 105 4>;
+               interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH
+                             0 105 IRQ_TYPE_LEVEL_HIGH>;
                toshiba,mmc-wrprotect-disable;
                cap-sd-highspeed;
                status = "disabled";
                      <0xe605801c 0x1c>;
                gpio-controller;
                #gpio-cells = <2>;
+               interrupts-extended =
+                       <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>,
+                       <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>,
+                       <&irqpin1 0 0>, <&irqpin1 1 0>, <&irqpin1 2 0>, <&irqpin1 3 0>,
+                       <&irqpin1 4 0>, <&irqpin1 5 0>, <&irqpin1 6 0>, <&irqpin1 7 0>,
+                       <&irqpin2 0 0>, <&irqpin2 1 0>, <&irqpin2 2 0>, <&irqpin2 3 0>,
+                       <&irqpin2 4 0>, <&irqpin2 5 0>, <&irqpin2 6 0>, <&irqpin2 7 0>,
+                       <&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>,
+                       <&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>;
+       };
+
+       sh_fsi2: sound@ec230000 {
+               #sound-dai-cells = <1>;
+               compatible = "renesas,sh_fsi2";
+               reg = <0xec230000 0x400>;
+               interrupt-parent = <&gic>;
+               interrupts = <0 146 0x4>;
+               status = "disabled";
        };
 };
index f936476c2753ff380ab7cfe04064fba2598d87c4..537f1a5c07f55538ca161a16f8d0594b6170ca62 100644 (file)
@@ -79,6 +79,8 @@
                                #dma-cells = <1>;
                                #dma-channels = <8>;
                                #dma-requests = <32>;
+                               clocks = <&l4_main_clk>;
+                               clock-names = "apb_pclk";
                        };
                };
 
                        interrupts = <0 38 0x04>;
                        cache-unified;
                        cache-level = <2>;
+                       arm,tag-latency = <1 1 1>;
+                       arm,data-latency = <2 1 1>;
                };
 
                /* Local timer */
index 8c45d85ac13edd437c082c8f63966052b67bdab8..4851c387d52dfa843ed9eff81e5e098146854d27 100644 (file)
@@ -15,7 +15,7 @@
 /* Pull Up */
 #define PU                     (1 << 26)
 /* Open Drain */
-#define OD                     (1 << 26)
+#define OD                     (1 << 25)
 #define RT                     (1 << 23)
 #define INVERTCLK              (1 << 22)
 #define CLKNOTDATA             (1 << 21)
index 7da99fe497e13d59215b2bdd1b16a41fcd120c70..e0853ea02df2296dc78c997123f3173754df48a8 100644 (file)
                        interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
                        v-ape-supply = <&db8500_vape_reg>;
 
+                       dmas = <&dma 31 0 0x12>, /* Logical - DevToMem - HighPrio */
+                              <&dma 31 0 0x10>; /* Logical - MemToDev - HighPrio */
+                       dma-names = "rx", "tx";
+
                        clocks = <&prcc_kclk 1 3>, <&prcc_pclk 1 3>;
                        clock-names = "msp", "apb_pclk";
 
                        interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
                        v-ape-supply = <&db8500_vape_reg>;
 
+                       dmas = <&dma 30 0 0x10>; /* Logical - MemToDev - HighPrio */
+                       dma-names = "tx";
+
                        clocks = <&prcc_kclk 1 4>, <&prcc_pclk 1 4>;
                        clock-names = "msp", "apb_pclk";
 
                        interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>;
                        v-ape-supply = <&db8500_vape_reg>;
 
+                       dmas = <&dma 14 0 0x12>, /* Logical  - DevToMem - HighPrio */
+                              <&dma 14 1 0x19>; /* Physical Chan 1 - MemToDev
+                                                    HighPrio - Fixed */
+                       dma-names = "rx", "tx";
+
                        clocks = <&prcc_kclk 2 3>, <&prcc_pclk 2 5>;
                        clock-names = "msp", "apb_pclk";
 
                        interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
                        v-ape-supply = <&db8500_vape_reg>;
 
+                       dmas = <&dma 30 0 0x12>; /* Logical - DevToMem - HighPrio */
+                       dma-names = "rx";
+
                        clocks = <&prcc_kclk 1 10>, <&prcc_pclk 1 11>;
                        clock-names = "msp", "apb_pclk";
 
                        status = "disabled";
                };
 
+               mcde@a0350000 {
+                       compatible = "stericsson,mcde";
+                       reg = <0xa0350000 0x1000>, /* MCDE */
+                             <0xa0351000 0x1000>, /* DSI link 1 */
+                             <0xa0352000 0x1000>, /* DSI link 2 */
+                             <0xa0353000 0x1000>; /* DSI link 3 */
+                       interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&prcmu_clk PRCMU_MCDECLK>, /* Main MCDE clock */
+                                <&prcmu_clk PRCMU_LCDCLK>, /* LCD clock */
+                                <&prcmu_clk PRCMU_PLLDSI>, /* HDMI clock */
+                                <&prcmu_clk PRCMU_DSI0CLK>, /* DSI 0 */
+                                <&prcmu_clk PRCMU_DSI1CLK>, /* DSI 1 */
+                                <&prcmu_clk PRCMU_DSI0ESCCLK>, /* TVout clock 0 */
+                                <&prcmu_clk PRCMU_DSI1ESCCLK>, /* TVout clock 1 */
+                                <&prcmu_clk PRCMU_DSI2ESCCLK>; /* TVout clock 2 */
+               };
+
                cryp@a03cb000 {
                        compatible = "stericsson,ux500-cryp";
                        reg = <0xa03cb000 0x1000>;
diff --git a/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi b/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi
new file mode 100644 (file)
index 0000000..addfcc7
--- /dev/null
@@ -0,0 +1,745 @@
+/*
+ * Copyright 2013 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include "ste-nomadik-pinctrl.dtsi"
+
+/ {
+       soc {
+               pinctrl {
+                       /* Settings for all UART default and sleep states */
+                       uart0 {
+                               uart0_default_mode: uart0_default {
+                                       default_mux {
+                                               ste,function = "u0";
+                                               ste,pins = "u0_a_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO0_AJ5", "GPIO2_AH4"; /* CTS+RXD */
+                                               ste,config = <&in_pu>;
+                                       };
+
+                                       default_cfg2 {
+                                               ste,pins = "GPIO1_AJ3", "GPIO3_AH3"; /* RTS+TXD */
+                                               ste,config = <&out_hi>;
+                                       };
+                               };
+
+                               uart0_sleep_mode: uart0_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO0_AJ5", "GPIO2_AH4"; /* CTS+RXD */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+
+                                       sleep_cfg2 {
+                                               ste,pins = "GPIO1_AJ3"; /* RTS */
+                                               ste,config = <&slpm_out_hi_wkup_pdis>;
+                                       };
+
+                                       sleep_cfg3 {
+                                               ste,pins = "GPIO3_AH3"; /* TXD */
+                                               ste,config = <&slpm_out_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       uart1 {
+                               uart1_default_mode: uart1_default {
+                                       default_mux {
+                                               ste,function = "u1";
+                                               ste,pins = "u1rxtx_a_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO4_AH6"; /* RXD */
+                                               ste,config = <&in_pu>;
+                                       };
+
+                                       default_cfg2 {
+                                               ste,pins = "GPIO5_AG6"; /* TXD */
+                                               ste,config = <&out_hi>;
+                                       };
+                               };
+
+                               uart1_sleep_mode: uart1_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO4_AH6"; /* RXD */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+
+                                       sleep_cfg2 {
+                                               ste,pins = "GPIO5_AG6"; /* TXD */
+                                               ste,config = <&slpm_out_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       uart2 {
+                               uart2_default_mode: uart2_default {
+                                       default_mux {
+                                               ste,function = "u2";
+                                               ste,pins = "u2rxtx_c_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO29_W2"; /* RXD */
+                                               ste,config = <&in_pu>;
+                                       };
+
+                                       default_cfg2 {
+                                               ste,pins = "GPIO30_W3"; /* TXD */
+                                               ste,config = <&out_hi>;
+                                       };
+                               };
+
+                               uart2_sleep_mode: uart2_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO29_W2"; /* RXD */
+                                               ste,config = <&in_wkup_pdis>;
+                                       };
+
+                                       sleep_cfg2 {
+                                               ste,pins = "GPIO30_W3"; /* TXD */
+                                               ste,config = <&out_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       /* Settings for all I2C default and sleep states */
+                       i2c0 {
+                               i2c0_default_mode: i2c_default {
+                                       default_mux {
+                                               ste,function = "i2c0";
+                                               ste,pins = "i2c0_a_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO147_C15", "GPIO148_B16"; /* SDA/SCL */
+                                               ste,config = <&in_pu>;
+                                       };
+                               };
+
+                               i2c0_sleep_mode: i2c_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO147_C15", "GPIO148_B16"; /* SDA/SCL */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       i2c1 {
+                               i2c1_default_mode: i2c_default {
+                                       default_mux {
+                                               ste,function = "i2c1";
+                                               ste,pins = "i2c1_b_2";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO16_AD3", "GPIO17_AD4"; /* SDA/SCL */
+                                               ste,config = <&in_pu>;
+                                       };
+                               };
+
+                               i2c1_sleep_mode: i2c_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO16_AD3", "GPIO17_AD4"; /* SDA/SCL */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       i2c2 {
+                               i2c2_default_mode: i2c_default {
+                                       default_mux {
+                                               ste,function = "i2c2";
+                                               ste,pins = "i2c2_b_2";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO10_AF5", "GPIO11_AG4"; /* SDA/SCL */
+                                               ste,config = <&in_pu>;
+                                       };
+                               };
+
+                               i2c2_sleep_mode: i2c_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO10_AF5", "GPIO11_AG4"; /* SDA/SCL */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       i2c3 {
+                               i2c3_default_mode: i2c_default {
+                                       default_mux {
+                                               ste,function = "i2c3";
+                                               ste,pins = "i2c3_c_2";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO229_AG7", "GPIO230_AF7"; /* SDA/SCL */
+                                               ste,config = <&in_pu>;
+                                       };
+                               };
+
+                               i2c3_sleep_mode: i2c_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO229_AG7", "GPIO230_AF7"; /* SDA/SCL */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       /*
+                        * Activating I2C4 will conflict with UART1 about the same pins so do not
+                        * enable I2C4 and UART1 at the same time.
+                        */
+                       i2c4 {
+                               i2c4_default_mode: i2c_default {
+                                       default_mux {
+                                               ste,function = "i2c4";
+                                               ste,pins = "i2c4_b_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO4_AH6", "GPIO5_AG6"; /* SDA/SCL */
+                                               ste,config = <&in_pu>;
+                                       };
+                               };
+
+                               i2c4_sleep_mode: i2c_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO4_AH6", "GPIO5_AG6"; /* SDA/SCL */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       /* Settings for all SPI default and sleep states */
+                       spi2 {
+                               spi2_default_mode: spi_default {
+                                       default_mux {
+                                               ste,function = "spi2";
+                                               ste,pins = "spi2_oc1_2";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO216_AG12"; /* FRM */
+                                               ste,config = <&gpio_out_hi>;
+                                       };
+                                       default_cfg2 {
+                                               ste,pins = "GPIO218_AH11"; /* RXD */
+                                               ste,config = <&in_pd>;
+                                       };
+                                       default_cfg3 {
+                                               ste,pins =
+                                               "GPIO215_AH13", /* TXD */
+                                               "GPIO217_AH12"; /* CLK */
+                                               ste,config = <&out_lo>;
+                                       };
+                               };
+
+                               spi2_idle_mode: spi_idle {
+                                       /*
+                                        * The idle mode is basically sleep mode sans wakeups. Also
+                                        * note that we have muxes the pins off the function here
+                                        * as we do not state any muxing.
+                                        */
+                                       idle_cfg1 {
+                                               ste,pins = "GPIO218_AH11"; /* RXD */
+                                               ste,config = <&slpm_in_pdis>;
+                                       };
+                                       idle_cfg2 {
+                                               ste,pins = "GPIO215_AH13"; /* TXD */
+                                               ste,config = <&slpm_out_lo_pdis>;
+                                       };
+                                       idle_cfg3 {
+                                               ste,pins = "GPIO217_AH12"; /* CLK */
+                                               ste,config = <&slpm_pdis>;
+                                       };
+                               };
+
+                               spi2_sleep_mode: spi_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins =
+                                               "GPIO216_AG12", /* FRM */
+                                               "GPIO218_AH11"; /* RXD */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+                                       sleep_cfg2 {
+                                               ste,pins = "GPIO215_AH13"; /* TXD */
+                                               ste,config = <&slpm_out_lo_wkup_pdis>;
+                                       };
+                                       sleep_cfg3 {
+                                               ste,pins = "GPIO217_AH12"; /* CLK */
+                                               ste,config = <&slpm_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       /* Settings for all MMC/SD/SDIO default and sleep states */
+                       sdi0 {
+                               /* This is the external SD card slot, 4 bits wide */
+                               sdi0_default_mode: sdi0_default {
+                                       default_mux {
+                                               ste,function = "mc0";
+                                               ste,pins = "mc0_a_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins =
+                                               "GPIO18_AC2", /* CMDDIR */
+                                               "GPIO19_AC1", /* DAT0DIR */
+                                               "GPIO20_AB4"; /* DAT2DIR */
+                                               ste,config = <&out_hi>;
+                                       };
+                                       default_cfg2 {
+                                               ste,pins = "GPIO22_AA3"; /* FBCLK */
+                                               ste,config = <&in_nopull>;
+                                       };
+                                       default_cfg3 {
+                                               ste,pins = "GPIO23_AA4"; /* CLK */
+                                               ste,config = <&out_lo>;
+                                       };
+                                       default_cfg4 {
+                                               ste,pins =
+                                               "GPIO24_AB2", /* CMD */
+                                               "GPIO25_Y4", /* DAT0 */
+                                               "GPIO26_Y2", /* DAT1 */
+                                               "GPIO27_AA2", /* DAT2 */
+                                               "GPIO28_AA1"; /* DAT3 */
+                                               ste,config = <&in_pu>;
+                                       };
+                               };
+
+                               sdi0_sleep_mode: sdi0_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins =
+                                               "GPIO18_AC2", /* CMDDIR */
+                                               "GPIO19_AC1", /* DAT0DIR */
+                                               "GPIO20_AB4"; /* DAT2DIR */
+                                               ste,config = <&slpm_out_hi_wkup_pdis>;
+                                       };
+                                       sleep_cfg2 {
+                                               ste,pins =
+                                               "GPIO22_AA3", /* FBCLK */
+                                               "GPIO24_AB2", /* CMD */
+                                               "GPIO25_Y4", /* DAT0 */
+                                               "GPIO26_Y2", /* DAT1 */
+                                               "GPIO27_AA2", /* DAT2 */
+                                               "GPIO28_AA1"; /* DAT3 */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+                                       sleep_cfg3 {
+                                               ste,pins = "GPIO23_AA4"; /* CLK */
+                                               ste,config = <&slpm_out_lo_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       sdi1 {
+                               /* This is the WLAN SDIO 4 bits wide */
+                               sdi1_default_mode: sdi1_default {
+                                       default_mux {
+                                               ste,function = "mc1";
+                                               ste,pins = "mc1_a_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO208_AH16"; /* CLK */
+                                               ste,config = <&out_lo>;
+                                       };
+                                       default_cfg2 {
+                                               ste,pins = "GPIO209_AG15"; /* FBCLK */
+                                               ste,config = <&in_nopull>;
+                                       };
+                                       default_cfg3 {
+                                               ste,pins =
+                                               "GPIO210_AJ15", /* CMD */
+                                               "GPIO211_AG14", /* DAT0 */
+                                               "GPIO212_AF13", /* DAT1 */
+                                               "GPIO213_AG13", /* DAT2 */
+                                               "GPIO214_AH15"; /* DAT3 */
+                                               ste,config = <&in_pu>;
+                                       };
+                               };
+
+                               sdi1_sleep_mode: sdi1_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO208_AH16"; /* CLK */
+                                               ste,config = <&slpm_out_lo_wkup_pdis>;
+                                       };
+                                       sleep_cfg2 {
+                                               ste,pins =
+                                               "GPIO209_AG15", /* FBCLK */
+                                               "GPIO210_AJ15", /* CMD */
+                                               "GPIO211_AG14", /* DAT0 */
+                                               "GPIO212_AF13", /* DAT1 */
+                                               "GPIO213_AG13", /* DAT2 */
+                                               "GPIO214_AH15"; /* DAT3 */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       sdi2 {
+                               /* This is the eMMC 8 bits wide, usually PoP eMMC */
+                               sdi2_default_mode: sdi2_default {
+                                       default_mux {
+                                               ste,function = "mc2";
+                                               ste,pins = "mc2_a_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO128_A5"; /* CLK */
+                                               ste,config = <&out_lo>;
+                                       };
+                                       default_cfg2 {
+                                               ste,pins = "GPIO130_C8"; /* FBCLK */
+                                               ste,config = <&in_nopull>;
+                                       };
+                                       default_cfg3 {
+                                               ste,pins =
+                                               "GPIO129_B4", /* CMD */
+                                               "GPIO131_A12", /* DAT0 */
+                                               "GPIO132_C10", /* DAT1 */
+                                               "GPIO133_B10", /* DAT2 */
+                                               "GPIO134_B9", /* DAT3 */
+                                               "GPIO135_A9", /* DAT4 */
+                                               "GPIO136_C7", /* DAT5 */
+                                               "GPIO137_A7", /* DAT6 */
+                                               "GPIO138_C5"; /* DAT7 */
+                                               ste,config = <&in_pu>;
+                                       };
+                               };
+
+                               sdi2_sleep_mode: sdi2_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO128_A5"; /* CLK */
+                                               ste,config = <&out_lo_wkup_pdis>;
+                                       };
+                                       sleep_cfg2 {
+                                               ste,pins =
+                                               "GPIO130_C8", /* FBCLK */
+                                               "GPIO129_B4"; /* CMD */
+                                               ste,config = <&in_wkup_pdis_en>;
+                                       };
+                                       sleep_cfg3 {
+                                               ste,pins =
+                                               "GPIO131_A12", /* DAT0 */
+                                               "GPIO132_C10", /* DAT1 */
+                                               "GPIO133_B10", /* DAT2 */
+                                               "GPIO134_B9", /* DAT3 */
+                                               "GPIO135_A9", /* DAT4 */
+                                               "GPIO136_C7", /* DAT5 */
+                                               "GPIO137_A7", /* DAT6 */
+                                               "GPIO138_C5"; /* DAT7 */
+                                               ste,config = <&in_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       sdi4 {
+                               /* This is the eMMC 8 bits wide, usually PCB-mounted eMMC */
+                               sdi4_default_mode: sdi4_default {
+                                       default_mux {
+                                               ste,function = "mc4";
+                                               ste,pins = "mc4_a_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO203_AE23"; /* CLK */
+                                               ste,config = <&out_lo>;
+                                       };
+                                       default_cfg2 {
+                                               ste,pins = "GPIO202_AF25"; /* FBCLK */
+                                               ste,config = <&in_nopull>;
+                                       };
+                                       default_cfg3 {
+                                               ste,pins =
+                                               "GPIO201_AF24", /* CMD */
+                                               "GPIO200_AH26", /* DAT0 */
+                                               "GPIO199_AH23", /* DAT1 */
+                                               "GPIO198_AG25", /* DAT2 */
+                                               "GPIO197_AH24", /* DAT3 */
+                                               "GPIO207_AJ23", /* DAT4 */
+                                               "GPIO206_AG24", /* DAT5 */
+                                               "GPIO205_AG23", /* DAT6 */
+                                               "GPIO204_AF23"; /* DAT7 */
+                                               ste,config = <&in_pu>;
+                                       };
+                               };
+
+                               sdi4_sleep_mode: sdi4_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO203_AE23"; /* CLK */
+                                               ste,config = <&out_lo_wkup_pdis>;
+                                       };
+                                       sleep_cfg2 {
+                                               ste,pins =
+                                               "GPIO202_AF25", /* FBCLK */
+                                               "GPIO201_AF24", /* CMD */
+                                               "GPIO200_AH26", /* DAT0 */
+                                               "GPIO199_AH23", /* DAT1 */
+                                               "GPIO198_AG25", /* DAT2 */
+                                               "GPIO197_AH24", /* DAT3 */
+                                               "GPIO207_AJ23", /* DAT4 */
+                                               "GPIO206_AG24", /* DAT5 */
+                                               "GPIO205_AG23", /* DAT6 */
+                                               "GPIO204_AF23"; /* DAT7 */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       /*
+                        * Multi-rate serial ports (MSPs) - MSP3 output is internal and
+                        * cannot be muxed onto any pins.
+                        */
+                       msp0 {
+                               msp0_default_mode: msp0_default {
+                                       default_msp0_mux {
+                                               ste,function = "msp0";
+                                               ste,pins = "msp0txrx_a_1", "msp0tfstck_a_1";
+                                       };
+                                       default_msp0_cfg {
+                                               ste,pins =
+                                               "GPIO12_AC4", /* TXD */
+                                               "GPIO15_AC3", /* RXD */
+                                               "GPIO13_AF3", /* TFS */
+                                               "GPIO14_AE3"; /* TCK */
+                                               ste,config = <&in_nopull>;
+                                       };
+                               };
+                       };
+
+                       msp1 {
+                               msp1_default_mode: msp1_default {
+                                       default_mux {
+                                               ste,function = "msp1";
+                                               ste,pins = "msp1txrx_a_1", "msp1_a_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins = "GPIO33_AF2";
+                                               ste,config = <&out_lo>;
+                                       };
+                                       default_cfg2 {
+                                               ste,pins =
+                                               "GPIO34_AE1",
+                                               "GPIO35_AE2",
+                                               "GPIO36_AG2";
+                                               ste,config = <&in_nopull>;
+                                       };
+
+                               };
+                       };
+
+                       msp2 {
+                               msp2_default_mode: msp2_default {
+                                       /* MSP2 usually used for HDMI audio */
+                                       default_mux {
+                                               ste,function = "msp2";
+                                               ste,pins = "msp2_a_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins =
+                                               "GPIO193_AH27", /* TXD */
+                                               "GPIO194_AF27", /* TCK */
+                                               "GPIO195_AG28"; /* TFS */
+                                               ste,config = <&in_pd>;
+                                       };
+                                       default_cfg2 {
+                                               ste,pins = "GPIO196_AG26"; /* RXD */
+                                               ste,config = <&out_lo>;
+                                       };
+                               };
+                       };
+
+
+                       musb {
+                               musb_default_mode: musb_default {
+                                       default_mux {
+                                               ste,function = "usb";
+                                               ste,pins = "usb_a_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins =
+                                               "GPIO256_AF28", /* NXT */
+                                               "GPIO258_AD29", /* XCLK */
+                                               "GPIO259_AC29", /* DIR */
+                                               "GPIO260_AD28", /* DAT7 */
+                                               "GPIO261_AD26", /* DAT6 */
+                                               "GPIO262_AE26", /* DAT5 */
+                                               "GPIO263_AG29", /* DAT4 */
+                                               "GPIO264_AE27", /* DAT3 */
+                                               "GPIO265_AD27", /* DAT2 */
+                                               "GPIO266_AC28", /* DAT1 */
+                                               "GPIO267_AC27"; /* DAT0 */
+                                               ste,config = <&in_nopull>;
+                                       };
+                                       default_cfg2 {
+                                               ste,pins = "GPIO257_AE29"; /* STP */
+                                               ste,config = <&out_hi>;
+                                       };
+                               };
+
+                               musb_sleep_mode: musb_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins =
+                                               "GPIO256_AF28", /* NXT */
+                                               "GPIO258_AD29", /* XCLK */
+                                               "GPIO259_AC29"; /* DIR */
+                                               ste,config = <&slpm_wkup_pdis_en>;
+                                       };
+                                       sleep_cfg2 {
+                                               ste,pins = "GPIO257_AE29"; /* STP */
+                                               ste,config = <&slpm_out_hi_wkup_pdis>;
+                                       };
+                                       sleep_cfg3 {
+                                               ste,pins =
+                                               "GPIO260_AD28", /* DAT7 */
+                                               "GPIO261_AD26", /* DAT6 */
+                                               "GPIO262_AE26", /* DAT5 */
+                                               "GPIO263_AG29", /* DAT4 */
+                                               "GPIO264_AE27", /* DAT3 */
+                                               "GPIO265_AD27", /* DAT2 */
+                                               "GPIO266_AC28", /* DAT1 */
+                                               "GPIO267_AC27"; /* DAT0 */
+                                               ste,config = <&slpm_in_wkup_pdis_en>;
+                                       };
+                               };
+                       };
+
+                       mcde {
+                               lcd_default_mode: lcd_default {
+                                       default_mux {
+                                               /* Mux in VSI0 and all the data lines */
+                                               ste,function = "lcd";
+                                               ste,pins =
+                                               "lcdvsi0_a_1", /* VSI0 for LCD */
+                                               "lcd_d0_d7_a_1", /* Data lines */
+                                               "lcd_d8_d11_a_1", /* TV-out */
+                                               "lcdaclk_b_1", /* Clock line for TV-out */
+                                               "lcdvsi1_a_1"; /* VSI1 for HDMI */
+                                       };
+                                       default_cfg1 {
+                                               ste,pins =
+                                               "GPIO68_E1", /* VSI0 */
+                                               "GPIO69_E2"; /* VSI1 */
+                                               ste,config = <&in_pu>;
+                                       };
+                               };
+                               lcd_sleep_mode: lcd_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins = "GPIO69_E2"; /* VSI1 */
+                                               ste,config = <&slpm_in_wkup_pdis>;
+                                       };
+                               };
+                       };
+
+                       ske {
+                               /* SKE keys on position 2 in an 8x8 matrix */
+                               ske_kpa2_default_mode: ske_kpa2_default {
+                                       default_mux {
+                                               ste,function = "kp";
+                                               ste,pins = "kp_a_2";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins =
+                                               "GPIO153_B17", /* I7 */
+                                               "GPIO154_C16", /* I6 */
+                                               "GPIO155_C19", /* I5 */
+                                               "GPIO156_C17", /* I4 */
+                                               "GPIO161_D21", /* I3 */
+                                               "GPIO162_D20", /* I2 */
+                                               "GPIO163_C20", /* I1 */
+                                               "GPIO164_B21"; /* I0 */
+                                               ste,config = <&in_pd>;
+                                       };
+                                       default_cfg2 {
+                                               ste,pins =
+                                               "GPIO157_A18", /* O7 */
+                                               "GPIO158_C18", /* O6 */
+                                               "GPIO159_B19", /* O5 */
+                                               "GPIO160_B20", /* O4 */
+                                               "GPIO165_C21", /* O3 */
+                                               "GPIO166_A22", /* O2 */
+                                               "GPIO167_B24", /* O1 */
+                                               "GPIO168_C22"; /* O0 */
+                                               ste,config = <&out_lo>;
+                                       };
+                               };
+                               ske_kpa2_sleep_mode: ske_kpa2_sleep {
+                                       sleep_cfg1 {
+                                               ste,pins =
+                                               "GPIO153_B17", /* I7 */
+                                               "GPIO154_C16", /* I6 */
+                                               "GPIO155_C19", /* I5 */
+                                               "GPIO156_C17", /* I4 */
+                                               "GPIO161_D21", /* I3 */
+                                               "GPIO162_D20", /* I2 */
+                                               "GPIO163_C20", /* I1 */
+                                               "GPIO164_B21"; /* I0 */
+                                               ste,config = <&slpm_in_pu_wkup_pdis_en>;
+                                       };
+                                       sleep_cfg2 {
+                                               ste,pins =
+                                               "GPIO157_A18", /* O7 */
+                                               "GPIO158_C18", /* O6 */
+                                               "GPIO159_B19", /* O5 */
+                                               "GPIO160_B20", /* O4 */
+                                               "GPIO165_C21", /* O3 */
+                                               "GPIO166_A22", /* O2 */
+                                               "GPIO167_B24", /* O1 */
+                                               "GPIO168_C22"; /* O0 */
+                                               ste,config = <&slpm_out_lo_pdis>;
+                                       };
+                               };
+                               /*
+                                * SKE keys on position 1 and "other C1" combi giving
+                                * six rows of six keys.
+                                */
+                               ske_kpaoc1_default_mode: ske_kpaoc1_default {
+                                       default_mux {
+                                               ste,function = "kp";
+                                               ste,pins = "kp_a_1", "kp_oc1_1";
+                                       };
+                                       default_cfg1 {
+                                               ste,pins =
+                                               "GPIO91_B6", /* KP_O0 */
+                                               "GPIO90_A3", /* KP_O1 */
+                                               "GPIO87_B3", /* KP_O2 */
+                                               "GPIO86_C6", /* KP_O3 */
+                                               "GPIO96_D8", /* KP_O6 */
+                                               "GPIO94_D7"; /* KP_O7 */
+                                               ste,config = <&out_lo>;
+                                       };
+                                       default_cfg2 {
+                                               ste,pins =
+                                               "GPIO93_B7", /* KP_I0 */
+                                               "GPIO92_D6", /* KP_I1 */
+                                               "GPIO89_E6", /* KP_I2 */
+                                               "GPIO88_C4", /* KP_I3 */
+                                               "GPIO97_D9", /* KP_I6 */
+                                               "GPIO95_E8"; /* KP_I7 */
+                                               ste,config = <&in_pu>;
+                                       };
+                               };
+                       };
+
+                       wlan {
+                               wlan_default_mode: wlan_default {
+                                       /*
+                                        * Activate this mode with the WLAN chip.
+                                        * These are plain GPIO pins used by WLAN
+                                        */
+                                       default_cfg1 {
+                                               ste,pins =
+                                               "GPIO226_AF8", /* WLAN_PMU_EN */
+                                               "GPIO85_D5"; /* WLAN_ENA */
+                                               ste,config = <&gpio_out_lo>;
+                                       };
+                                       default_cfg2 {
+                                               ste,pins = "GPIO4_AH6"; /* WLAN_IRQ on UART1 */
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+               };
+       };
+};
index 76704ec0ffcc89bf3fd0d7e90726c6cc1502807b..1c3574435ea81fe6f275aff7244c6fd828cd99d0 100644 (file)
 #include <dt-bindings/interrupt-controller/irq.h>
 
 / {
+       gpio_keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               vdd-supply = <&ab8500_ldo_aux1_reg>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&prox_stuib_mode>, <&hall_stuib_mode>;
+
+               button@139 {
+                       /* Proximity sensor */
+                       gpios = <&gpio6 25 0x4>;
+                       linux,code = <11>; /* SW_FRONT_PROXIMITY */
+                       label = "SFH7741 Proximity Sensor";
+               };
+               button@145 {
+                       /* Hall sensor */
+                       gpios = <&gpio4 17 0x4>;
+                       linux,code = <0>; /* SW_LID */
+                       label = "HED54XXU11 Hall Effect Sensor";
+               };
+       };
+
        soc {
                i2c@80004000 {
                        stmpe1601: stmpe1601@40 {
                                rohm,flip-y;
                        };
                };
+
+               pinctrl {
+                       prox {
+                               prox_stuib_mode: prox_stuib {
+                                       stuib_cfg {
+                                               ste,pins = "GPIO217_AH12";
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+                       hall {
+                               hall_stuib_mode: stuib_tvk {
+                                       stuib_cfg {
+                                               ste,pins = "GPIO145_C13";
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+               };
        };
 };
index 76d3ef13175f4d40ff9fb4ef3cbe0e8a287504ce..c40565320978e78f71c7d798476ba2b9b4a62689 100644 (file)
 #include <dt-bindings/interrupt-controller/irq.h>
 
 / {
+       gpio_keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               vdd-supply = <&ab8500_ldo_aux1_reg>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&prox_tvk_mode>, <&hall_tvk_mode>;
+
+               button@139 {
+                       /* Proximity sensor */
+                       gpios = <&gpio6 25 0x4>;
+                       linux,code = <11>; /* SW_FRONT_PROXIMITY */
+                       label = "SFH7741 Proximity Sensor";
+               };
+               button@145 {
+                       /* Hall sensor */
+                       gpios = <&gpio4 17 0x4>;
+                       linux,code = <0>; /* SW_LID */
+                       label = "HED54XXU11 Hall Effect Sensor";
+               };
+       };
+
        soc {
-               /* Add Synaptics touch screen, TC35892 keypad etc here */
+               /* Add Synaptics touch screen, TC35893 keypad etc here */
                i2c@80004000 {
-                       tc3589x@44 {
-                               compatible = "tc3589x";
+                       tc35893@44 {
+                               compatible = "toshiba,tc35893";
                                reg = <0x44>;
                                interrupt-parent = <&gpio6>;
                                interrupts = <26 IRQ_TYPE_EDGE_RISING>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&tc35893_tvk_mode>;
 
                                interrupt-controller;
-                               #interrupt-cells = <2>;
+                               #interrupt-cells = <1>;
 
                                tc3589x_gpio {
-                                       compatible = "tc3589x-gpio";
-                                       interrupts = <0 IRQ_TYPE_EDGE_RISING>;
+                                       compatible = "toshiba,tc3589x-gpio";
+                                       interrupts = <0>;
 
                                        interrupt-controller;
                                        #interrupt-cells = <2>;
                                        gpio-controller;
                                        #gpio-cells = <2>;
                                };
+                               tc3589x_keypad {
+                                       compatible = "toshiba,tc3589x-keypad";
+                                       interrupts = <6>;
+                                       debounce-delay-ms = <4>;
+                                       keypad,num-columns = <8>;
+                                       keypad,num-rows = <8>;
+                                       linux,no-autorepeat;
+                                       linux,wakeup;
+                                       linux,keymap = <0x0301006b
+                                                       0x04010066
+                                                       0x06040072
+                                                       0x040200d7
+                                                       0x0303006a
+                                                       0x0205000e
+                                                       0x0607008b
+                                                       0x0500001c
+                                                       0x0403000b
+                                                       0x03040034
+                                                       0x05020067
+                                                       0x0305006c
+                                                       0x040500e7
+                                                       0x0005009e
+                                                       0x06020073
+                                                       0x01030039
+                                                       0x07060069
+                                                       0x050500d9>;
+                               };
+                       };
+               };
+               pinctrl {
+                       /* Pull up this GPIO pin */
+                       tc35893 {
+                               tc35893_tvk_mode: tc35893_tvk {
+                                       tvk_cfg {
+                                               ste,pins = "GPIO218_AH11";
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+                       prox {
+                               prox_tvk_mode: prox_tvk {
+                                       tvk_cfg {
+                                               ste,pins = "GPIO217_AH12";
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+                       hall {
+                               hall_tvk_mode: hall_tvk {
+                                       tvk_cfg {
+                                               ste,pins = "GPIO145_C13";
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
                        };
                };
        };
index aa3f02060fdd43114570eceedbf1ef54dc49a01f..0c1e8d871ed1a45662198501fb133aa29bf46af0 100644 (file)
 
 #include <dt-bindings/interrupt-controller/irq.h>
 #include "ste-dbx5x0.dtsi"
+#include "ste-href-family-pinctrl.dtsi"
 
 / {
        memory {
                reg = <0x00000000 0x20000000>;
        };
 
-       gpio_keys {
-               compatible = "gpio-keys";
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               button@1 {
-                       linux,code = <11>;
-                       label = "SFH7741 Proximity Sensor";
+       soc {
+               usb_per5@a03e0000 {
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&musb_default_mode>;
+                       pinctrl-1 = <&musb_sleep_mode>;
                };
-       };
 
-       soc {
                uart@80120000 {
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&uart0_default_mode>;
+                       pinctrl-1 = <&uart0_sleep_mode>;
                        status = "okay";
                };
 
                uart@80121000 {
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&uart1_default_mode>;
+                       pinctrl-1 = <&uart1_sleep_mode>;
                        status = "okay";
                };
 
                uart@80007000 {
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&uart2_default_mode>;
+                       pinctrl-1 = <&uart2_sleep_mode>;
                        status = "okay";
                };
 
+               i2c@80004000 {
+                       pinctrl-names = "default","sleep";
+                       pinctrl-0 = <&i2c0_default_mode>;
+                       pinctrl-1 = <&i2c0_sleep_mode>;
+               };
+
+               i2c@80122000 {
+                       pinctrl-names = "default","sleep";
+                       pinctrl-0 = <&i2c1_default_mode>;
+                       pinctrl-1 = <&i2c1_sleep_mode>;
+               };
+
                i2c@80128000 {
+                       pinctrl-names = "default","sleep";
+                       pinctrl-0 = <&i2c2_default_mode>;
+                       pinctrl-1 = <&i2c2_sleep_mode>;
                        lp5521@33 {
                                compatible = "national,lp5521";
                                reg = <0x33>;
                        };
                };
 
+               i2c@80110000 {
+                       pinctrl-names = "default","sleep";
+                       pinctrl-0 = <&i2c3_default_mode>;
+                       pinctrl-1 = <&i2c3_sleep_mode>;
+               };
+
                // External Micro SD slot
                sdi0_per1@80126000 {
                        arm,primecell-periphid = <0x10480180>;
                        mmc-cap-mmc-highspeed;
                        vmmc-supply = <&ab8500_ldo_aux3_reg>;
                        vqmmc-supply = <&vmmci>;
-
-                       cd-gpios  = <&tc3589x_gpio 3 0x4>;
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&sdi0_default_mode>;
+                       pinctrl-1 = <&sdi0_sleep_mode>;
 
                        status = "okay";
                };
                        arm,primecell-periphid = <0x10480180>;
                        max-frequency = <100000000>;
                        bus-width = <4>;
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&sdi1_default_mode>;
+                       pinctrl-1 = <&sdi1_sleep_mode>;
 
                        status = "okay";
                };
                        max-frequency = <100000000>;
                        bus-width = <8>;
                        mmc-cap-mmc-highspeed;
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&sdi2_default_mode>;
+                       pinctrl-1 = <&sdi2_sleep_mode>;
 
                        status = "okay";
                };
                        bus-width = <8>;
                        mmc-cap-mmc-highspeed;
                        vmmc-supply = <&ab8500_ldo_aux2_reg>;
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&sdi4_default_mode>;
+                       pinctrl-1 = <&sdi4_sleep_mode>;
 
                        status = "okay";
                };
                        stericsson,audio-codec = <&codec>;
                };
 
+               msp0: msp@80123000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&msp0_default_mode>;
+                       status = "okay";
+               };
+
                msp1: msp@80124000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&msp1_default_mode>;
+                       status = "okay";
+               };
+
+               msp2: msp@80117000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&msp2_default_mode>;
                        status = "okay";
                };
 
                                };
                        };
                };
+
+               mcde@a0350000 {
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&lcd_default_mode>;
+                       pinctrl-1 = <&lcd_sleep_mode>;
+               };
        };
 };
index b2cd7bc2752f2a6ea67e0849593410cc61dd176a..40f0ecdf9303ca2c9db18ef5180bd0afb23564ca 100644 (file)
                                reg = <0x33>;
                        };
 
-                       tc3589x@42 {
-                               compatible = "tc3589x";
+                       tc35892@42 {
+                               compatible = "toshiba,tc35892";
                                reg = <0x42>;
                                interrupt-parent = <&gpio6>;
                                interrupts = <25 IRQ_TYPE_EDGE_RISING>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&tc35892_hrefprev60_mode>;
 
                                interrupt-controller;
-                               #interrupt-cells = <2>;
+                               #interrupt-cells = <1>;
 
                                tc3589x_gpio: tc3589x_gpio {
                                        compatible = "tc3589x-gpio";
-                                       interrupts = <0 IRQ_TYPE_EDGE_RISING>;
+                                       interrupts = <0>;
 
                                        interrupt-controller;
                                        #interrupt-cells = <2>;
                        };
                };
 
+               ssp@80002000 {
+                       /*
+                        * On the first generation boards, this SSP/SPI port was connected
+                        * to the AB8500.
+                        */
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&ssp0_hrefprev60_mode>;
+               };
+
+               // External Micro SD slot
+               sdi0_per1@80126000 {
+                       cd-gpios  = <&tc3589x_gpio 3 0x4>;
+               };
+
                vmmci: regulator-gpio {
                        gpios = <&tc3589x_gpio 18 0x4>;
                        enable-gpio = <&tc3589x_gpio 17 0x4>;
+               };
+
+               pinctrl {
+                       /* Set this up using hogs */
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&ipgpio_hrefprev60_mode>;
 
-                       status = "okay";
+                       ssp0 {
+                               ssp0_hrefprev60_mode: ssp0_hrefprev60_default {
+                                       hrefprev60_mux {
+                                               ste,function = "ssp0";
+                                               ste,pins = "ssp0_a_1";
+                                       };
+                                       hrefprev60_cfg1 {
+                                               ste,pins = "GPIO145_C13"; /* RXD */
+                                               ste,config = <&in_pd>;
+                                       };
+
+                               };
+                       };
+                       sdi0 {
+                               /* This additional pin needed on early MOP500 and HREFs previous to v60 */
+                               sdi0_default_mode: sdi0_default {
+                                       hrefprev60_mux {
+                                               ste,function = "mc0";
+                                               ste,pins = "mc0dat31dir_a_1";
+                                       };
+                                       hrefprev60_cfg1 {
+                                               ste,pins = "GPIO21_AB3"; /* DAT31DIR */
+                                               ste,config = <&out_hi>;
+                                       };
+
+                               };
+                       };
+                       tc35892 {
+                               tc35892_hrefprev60_mode: tc35892_hrefprev60 {
+                                       hrefprev60_cfg {
+                                               ste,pins = "GPIO217_AH12";
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+                       ipgpio {
+                                ipgpio_hrefprev60_mode: ipgpio_hrefprev60 {
+                                       hrefprev60_mux {
+                                               ste,function = "ipgpio";
+                                               ste,pins = "ipgpio0_c_1", "ipgpio1_c_1";
+                                       };
+                                       hrefprev60_cfg1 {
+                                               ste,pins = "GPIO6_AF6", "GPIO7_AG5";
+                                               ste,config = <&in_pu>;
+                                       };
+                                };
+                       };
                };
        };
 };
index aed511b47a9e6fe015050920bb8ed3a0e19eb918..3b6d1181939bc118f6980b583084367c3d395a73 100644 (file)
        model = "ST-Ericsson HREF (v60+) platform with Device Tree";
        compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500";
 
-       gpio_keys {
-               button@1 {
-                       gpios = <&gpio5 25 0x4>;
-               };
-       };
-
        soc {
                // External Micro SD slot
                sdi0_per1@80126000 {
-                       arm,primecell-periphid = <0x10480180>;
-                       max-frequency = <100000000>;
-                       bus-width = <4>;
-                       mmc-cap-sd-highspeed;
-                       mmc-cap-mmc-highspeed;
-                       vmmc-supply = <&ab8500_ldo_aux3_reg>;
-
                        cd-gpios  = <&gpio2 31 0x4>; // 95
-
-                       status = "okay";
                };
 
-               // WLAN SDIO channel
-               sdi1_per2@80118000 {
-                       arm,primecell-periphid = <0x10480180>;
-                       max-frequency = <100000000>;
-                       bus-width = <4>;
-
-                       status = "okay";
-               };
-
-               // PoP:ed eMMC
-               sdi2_per3@80005000 {
-                       arm,primecell-periphid = <0x10480180>;
-                       max-frequency = <100000000>;
-                       bus-width = <8>;
-                       mmc-cap-mmc-highspeed;
-
-                       status = "okay";
+               vmmci: regulator-gpio {
+                       gpios = <&gpio0 5 0x4>;
+                       enable-gpio = <&gpio5 9 0x4>;
                };
 
-               // On-board eMMC
-               sdi4_per2@80114000 {
-                       arm,primecell-periphid = <0x10480180>;
-                       max-frequency = <100000000>;
-                       bus-width = <8>;
-                       mmc-cap-mmc-highspeed;
-                       vmmc-supply = <&ab8500_ldo_aux2_reg>;
+               pinctrl {
+                       /*
+                        * Set this up using hogs, as time goes by and as seems fit, these
+                        * can be moved over to being controlled by respective device.
+                        */
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&ipgpio_hrefv60_mode>,
+                                 <&accel_hrefv60_mode>,
+                                 <&magneto_hrefv60_mode>,
+                                 <&etm_hrefv60_mode>,
+                                 <&nahj_hrefv60_mode>,
+                                 <&nfc_hrefv60_mode>,
+                                 <&force_hrefv60_mode>,
+                                 <&dipro_hrefv60_mode>,
+                                 <&vaudio_hf_hrefv60_mode>,
+                                 <&gbf_hrefv60_mode>,
+                                 <&hdtv_hrefv60_mode>,
+                                 <&touch_hrefv60_mode>;
 
-                       status = "okay";
+                       sdi0 {
+                               /* SD card detect GPIO pin, extend default state */
+                               sdi0_default_mode: sdi0_default {
+                                       default_hrefv60_cfg1 {
+                                               ste,pins = "GPIO95_E8";
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+                       ipgpio {
+                               /*
+                                * XENON Flashgun on image processor GPIO (controlled from image
+                                * processor firmware), mux in these image processor GPIO lines 0
+                                * (XENON_FLASH_ID), 1 (XENON_READY) and there is an assistant
+                                * LED on IP GPIO 4 (XENON_EN2) on altfunction C, that need bias
+                                * from GPIO21 so pull up 0, 1 and drive 4 and GPIO21 low as output.
+                                */
+                               ipgpio_hrefv60_mode: ipgpio_hrefv60 {
+                                       hrefv60_mux {
+                                               ste,function = "ipgpio";
+                                               ste,pins = "ipgpio0_c_1", "ipgpio1_c_1", "ipgpio4_c_1";
+                                       };
+                                       hrefv60_cfg1 {
+                                               ste,pins = "GPIO6_AF6", "GPIO7_AG5";
+                                               ste,config = <&in_pu>;
+                                       };
+                                       hrefv60_cfg2 {
+                                               ste,pins = "GPIO21_AB3";
+                                               ste,config = <&gpio_out_lo>;
+                                       };
+                                       hrefv60_cfg3 {
+                                               ste,pins = "GPIO64_F3";
+                                               ste,config = <&out_lo>;
+                                       };
+                               };
+                       };
+                       accelerometer {
+                               accel_hrefv60_mode: accel_hrefv60 {
+                                       /* Accelerometer interrupt lines 1 & 2 */
+                                       hrefv60_cfg1 {
+                                               ste,pins = "GPIO82_C1", "GPIO83_D3";
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+                       magnetometer {
+                               magneto_hrefv60_mode: magneto_hrefv60 {
+                                       /* Magnetometer uses GPIO 31 and 32, pull these up/down respectively */
+                                       hrefv60_cfg1 {
+                                               ste,pins = "GPIO31_V3";
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                                       hrefv60_cfg2 {
+                                               ste,pins = "GPIO32_V2";
+                                               ste,config = <&gpio_in_pd>;
+                                       };
+                               };
+                       };
+                       etm {
+                               /*
+                                * Drive D19-D23 for the ETM PTM trace interface low,
+                                * (presumably pins are unconnected therefore grounded here,
+                                * the "other alt C1" setting enables these pins)
+                                */
+                               etm_hrefv60_mode: etm_hrefv60 {
+                                       hrefv60_cfg1 {
+                                               ste,pins =
+                                               "GPIO70_G5",
+                                               "GPIO71_G4",
+                                               "GPIO72_H4",
+                                               "GPIO73_H3",
+                                               "GPIO74_J3";
+                                               ste,config = <&gpio_out_lo>;
+                                       };
+                                };
+                       };
+                       nahj {
+                               nahj_hrefv60_mode: nahj_hrefv60 {
+                                       /* NAHJ CTRL on GPIO76 to low, CTRL_INV on GPIO216 to high */
+                                       hrefv60_cfg1 {
+                                               ste,pins = "GPIO76_J2";
+                                               ste,config = <&gpio_out_lo>;
+                                       };
+                                       hrefv60_cfg2 {
+                                               ste,pins = "GPIO216_AG12";
+                                               ste,config = <&gpio_out_hi>;
+                                       };
+                                };
+                       };
+                       nfc {
+                               nfc_hrefv60_mode: nfc_hrefv60 {
+                                       /* NFC ENA and RESET to low, pulldown IRQ line */
+                                       hrefv60_cfg1 {
+                                               ste,pins =
+                                               "GPIO77_H1", /* NFC_ENA */
+                                               "GPIO142_C11"; /* NFC_RESET */
+                                               ste,config = <&gpio_out_lo>;
+                                       };
+                                       hrefv60_cfg2 {
+                                               ste,pins = "GPIO144_B13"; /* NFC_IRQ */
+                                               ste,config = <&gpio_in_pd>;
+                                       };
+                                };
+                       };
+                       force {
+                               force_hrefv60_mode: force_hrefv60 {
+                                       hrefv60_cfg1 {
+                                               ste,pins = "GPIO91_B6"; /* FORCE_SENSING_INT */
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                                       hrefv60_cfg2 {
+                                               ste,pins =
+                                               "GPIO92_D6", /* FORCE_SENSING_RST */
+                                               "GPIO97_D9"; /* FORCE_SENSING_WU */
+                                               ste,config = <&gpio_out_lo>;
+                                       };
+                                };
+                       };
+                       dipro {
+                               dipro_hrefv60_mode: dipro_hrefv60 {
+                                       hrefv60_cfg1 {
+                                               ste,pins = "GPIO139_C9"; /* DIPRO_INT */
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                                };
+                       };
+                       vaudio_hf {
+                               vaudio_hf_hrefv60_mode: vaudio_hf_hrefv60 {
+                                       /* Audio Amplifier HF enable GPIO */
+                                       hrefv60_cfg1 {
+                                               ste,pins = "GPIO149_B14"; /* VAUDIO_HF_EN, enable MAX8968 */
+                                               ste,config = <&gpio_out_hi>;
+                                       };
+                                };
+                       };
+                       gbf {
+                               gbf_hrefv60_mode: gbf_hrefv60 {
+                                       /*
+                                        * GBF (GPS, Bluetooth, FM-radio) interface,
+                                        * pull low to reset state
+                                        */
+                                       hrefv60_cfg1 {
+                                               ste,pins = "GPIO171_D23"; /* GBF_ENA_RESET */
+                                               ste,config = <&gpio_out_lo>;
+                                       };
+                                };
+                       };
+                       hdtv {
+                               hdtv_hrefv60_mode: hdtv_hrefv60 {
+                                       /* MSP : HDTV INTERFACE GPIO line */
+                                       hrefv60_cfg1 {
+                                               ste,pins = "GPIO192_AJ27";
+                                               ste,config = <&gpio_in_pd>;
+                                       };
+                                };
+                       };
+                       touch {
+                               touch_hrefv60_mode: touch_hrefv60 {
+                                       /*
+                                        * Touch screen uses GPIO 143 for RST1, GPIO 146 for RST2 and
+                                        * GPIO 67 for interrupts. Pull-up the IRQ line and drive both
+                                        * reset signals low.
+                                        */
+                                       hrefv60_cfg1 {
+                                               ste,pins = "GPIO143_D12", "GPIO146_D13";
+                                               ste,config = <&gpio_out_lo>;
+                                       };
+                                       hrefv60_cfg2 {
+                                               ste,pins = "GPIO67_G2";
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+                       mcde {
+                               lcd_hrefv60_mode: lcd_hrefv60 {
+                                       /*
+                                        * Display Interface 1 uses GPIO 65 for RST (reset).
+                                        * Display Interface 2 uses GPIO 66 for RST (reset).
+                                        * Drive DISP1 reset high (not reset), driver DISP2 reset low (reset)
+                                        */
+                                       hrefv60_cfg1 {
+                                               ste,pins ="GPIO65_F1";
+                                               ste,config = <&gpio_out_hi>;
+                                       };
+                                       hrefv60_cfg2 {
+                                               ste,pins ="GPIO66_G3";
+                                               ste,config = <&gpio_out_lo>;
+                                       };
+                               };
+                       };
                };
        };
 };
index efddee9403c424b1bb2c0e21d027fae10fc13808..e6f22b266420d0be0ead75fe81e500ac427b8d11 100644 (file)
                ste,output = <OUTPUT_LOW>;
        };
 
+       gpio_in_pu: gpio_input_pull_up {
+               ste,gpio = <GPIOMODE_ENABLED>;
+               ste,input = <INPUT_PULLUP>;
+       };
+
+       gpio_in_pd: gpio_input_pull_down {
+               ste,gpio = <GPIOMODE_ENABLED>;
+               ste,input = <INPUT_PULLDOWN>;
+       };
+
        gpio_out_lo: gpio_output_low {
                ste,gpio = <GPIOMODE_ENABLED>;
                ste,output = <OUTPUT_LOW>;
        };
 
+       gpio_out_hi: gpio_output_high {
+               ste,gpio = <GPIOMODE_ENABLED>;
+               ste,output = <OUTPUT_HIGH>;
+       };
+
+       slpm_pdis: slpm_pdis {
+               ste,sleep = <SLPM_ENABLED>;
+               ste,sleep-wakeup = <SLPM_WAKEUP_DISABLE>;
+               ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
+       };
+
+       slpm_wkup_pdis: slpm_wkup_pdis {
+               ste,sleep = <SLPM_ENABLED>;
+               ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
+               ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
+       };
+
+       slpm_wkup_pdis_en: slpm_wkup_pdis_en {
+               ste,sleep = <SLPM_ENABLED>;
+               ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
+               ste,sleep-pull-disable = <SLPM_PDIS_ENABLED>;
+       };
+
        slpm_in_pu: slpm_in_pu {
                ste,sleep = <SLPM_ENABLED>;
                ste,sleep-input = <SLPM_INPUT_PULLUP>;
                ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
        };
 
+       slpm_in_pdis: slpm_in_pdis {
+               ste,sleep = <SLPM_ENABLED>;
+               ste,sleep-input = <SLPM_DIR_INPUT>;
+               ste,sleep-wakeup = <SLPM_WAKEUP_DISABLE>;
+               ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
+       };
+
        slpm_in_wkup_pdis: slpm_in_wkup_pdis {
                ste,sleep = <SLPM_ENABLED>;
                ste,sleep-input = <SLPM_DIR_INPUT>;
                ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
        };
 
+       slpm_in_wkup_pdis_en: slpm_in_wkup_pdis_en {
+               ste,sleep = <SLPM_ENABLED>;
+               ste,sleep-input = <SLPM_DIR_INPUT>;
+               ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
+               ste,sleep-pull-disable = <SLPM_PDIS_ENABLED>;
+       };
+
+       slpm_in_pu_wkup_pdis_en: slpm_in_wkup_pdis_en {
+               ste,sleep = <SLPM_ENABLED>;
+               ste,sleep-input = <SLPM_INPUT_PULLUP>;
+               ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
+               ste,sleep-pull-disable = <SLPM_PDIS_ENABLED>;
+       };
+
        slpm_out_lo: slpm_out_lo {
                ste,sleep = <SLPM_ENABLED>;
                ste,sleep-output = <SLPM_OUTPUT_LOW>;
                ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
        };
 
+       slpm_out_lo_pdis: slpm_out_lo_pdis {
+               ste,sleep = <SLPM_ENABLED>;
+               ste,sleep-output = <SLPM_OUTPUT_LOW>;
+               ste,sleep-wakeup = <SLPM_WAKEUP_DISABLE>;
+               ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
+       };
+
+       slpm_out_lo_wkup_pdis: slpm_out_lo_wkup_pdis {
+               ste,sleep = <SLPM_ENABLED>;
+               ste,sleep-output = <SLPM_OUTPUT_LOW>;
+               ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
+               ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
+       };
+
        slpm_out_wkup_pdis: slpm_out_wkup_pdis {
                ste,sleep = <SLPM_ENABLED>;
                ste,sleep-output = <SLPM_DIR_OUTPUT>;
                ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
        };
 
+       in_wkup_pdis_en: in_wkup_pdis_en {
+               ste,sleep-input = <SLPM_DIR_INPUT>;
+               ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
+               ste,sleep-pull-disable = <SLPM_PDIS_ENABLED>;
+       };
+
+       out_lo_wkup_pdis: out_lo_wkup_pdis {
+               ste,sleep-output = <SLPM_OUTPUT_LOW>;
+               ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
+               ste,sleep-pull-disable = <SLPM_PDIS_DISABLED>;
+       };
+
        out_hi_wkup_pdis: out_hi_wkup_pdis {
                ste,sleep-output = <SLPM_OUTPUT_HIGH>;
                ste,sleep-wakeup = <SLPM_WAKEUP_ENABLE>;
index 16c3888b7b15005579ecef4fcdb0cb9d4678be70..f557feb997f46ff449df70859c0a3e3cf367c226 100644 (file)
 
        /* Custom board node with GPIO pins to active etc */
        usb-s8815 {
-               /* The S8815 is using this very GPIO pin for the SMSC91x IRQs */
-               ethernet-gpio {
-                       gpios = <&gpio3 8 0x1>;
-               };
                /* This will bias the MMC/SD card detect line */
                mmcsd-gpio {
                        gpios = <&gpio3 16 0x1>;
index 79425e3836cec4e957ef6e9b21dd7f70e83fa394..5acc0449676a99fbc09b58554ea17216ab4d9b97 100644 (file)
                #size-cells = <1>;
                ranges;
 
-               vica: intc@0x10140000 {
+               vica: intc@10140000 {
                        compatible = "arm,versatile-vic";
                        interrupt-controller;
                        #interrupt-cells = <1>;
                        reg = <0x10140000 0x20>;
                };
 
-               vicb: intc@0x10140020 {
+               vicb: intc@10140020 {
                        compatible = "arm,versatile-vic";
                        interrupt-controller;
                        #interrupt-cells = <1>;
index f0b39f835914beda02952a3cd9eb8860e38599ba..97d5d21b7db7c2bdb416c064ef389b3425f82b41 100644 (file)
@@ -11,6 +11,7 @@
 
 /dts-v1/;
 #include "ste-dbx5x0.dtsi"
+#include "ste-href-family-pinctrl.dtsi"
 
 / {
        model = "Calao Systems Snowball platform with device tree";
@@ -75,6 +76,8 @@
 
        leds {
                compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&gpioled_snowball_mode>;
                used-led {
                        label = "user_led";
                        gpios = <&gpio4 14 0x4>;
        };
 
        soc {
+               usb_per5@a03e0000 {
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&musb_default_mode>;
+                       pinctrl-1 = <&musb_sleep_mode>;
+               };
 
                sound {
                        compatible = "stericsson,snd-soc-mop500";
                        stericsson,audio-codec = <&codec>;
                };
 
+               msp0: msp@80123000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&msp0_default_mode>;
+                       status = "okay";
+               };
+
                msp1: msp@80124000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&msp1_default_mode>;
+                       status = "okay";
+               };
+
+               msp2: msp@80117000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&msp2_default_mode>;
                        status = "okay";
                };
 
                                interrupt-parent = <&gpio4>;
                                vdd33a-supply = <&en_3v3_reg>;
                                vddvario-supply = <&db8500_vape_reg>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&eth_snowball_mode>;
 
                                reg-shift = <1>;
                                reg-io-width = <2>;
                };
 
                vmmci: regulator-gpio {
-                       gpios = <&gpio6 25 0x4>;
-                       enable-gpio = <&gpio7 4 0x4>;
-
-                       status = "okay";
+                       gpios = <&gpio7 4 0x4>;
+                       enable-gpio = <&gpio6 25 0x4>;
                };
 
                // External Micro SD slot
                        mmc-cap-mmc-highspeed;
                        vmmc-supply = <&ab8500_ldo_aux3_reg>;
                        vqmmc-supply = <&vmmci>;
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&sdi0_default_mode>;
+                       pinctrl-1 = <&sdi0_sleep_mode>;
 
                        cd-gpios  = <&gpio6 26 0x4>; // 218
                        cd-inverted;
                        status = "okay";
                };
 
+               // WLAN SDIO channel
+               sdi1_per2@80118000 {
+                       arm,primecell-periphid = <0x10480180>;
+                       max-frequency = <100000000>;
+                       bus-width = <4>;
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&sdi1_default_mode>;
+                       pinctrl-1 = <&sdi1_sleep_mode>;
+
+                       status = "okay";
+               };
+
+               // Unused PoP eMMC - register and put it to sleep by default */
+               sdi2_per3@80005000 {
+                       arm,primecell-periphid = <0x10480180>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&sdi2_sleep_mode>;
+
+                       status = "okay";
+               };
+
                // On-board eMMC
                sdi4_per2@80114000 {
                        arm,primecell-periphid = <0x10480180>;
                        bus-width = <8>;
                        mmc-cap-mmc-highspeed;
                        vmmc-supply = <&ab8500_ldo_aux2_reg>;
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&sdi4_default_mode>;
+                       pinctrl-1 = <&sdi4_sleep_mode>;
 
                        status = "okay";
                };
 
                uart@80120000 {
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&uart0_default_mode>;
+                       pinctrl-1 = <&uart0_sleep_mode>;
                        status = "okay";
                };
 
                uart@80121000 {
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&uart1_default_mode>;
+                       pinctrl-1 = <&uart1_sleep_mode>;
                        status = "okay";
                };
 
                uart@80007000 {
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&uart2_default_mode>;
+                       pinctrl-1 = <&uart2_sleep_mode>;
                        status = "okay";
                };
 
+               i2c@80004000 {
+                       pinctrl-names = "default","sleep";
+                       pinctrl-0 = <&i2c0_default_mode>;
+                       pinctrl-1 = <&i2c0_sleep_mode>;
+               };
+
+               i2c@80122000 {
+                       pinctrl-names = "default","sleep";
+                       pinctrl-0 = <&i2c1_default_mode>;
+                       pinctrl-1 = <&i2c1_sleep_mode>;
+               };
+
+               i2c@80128000 {
+                       pinctrl-names = "default","sleep";
+                       pinctrl-0 = <&i2c2_default_mode>;
+                       pinctrl-1 = <&i2c2_sleep_mode>;
+               };
+
+               i2c@80110000 {
+                       pinctrl-names = "default","sleep";
+                       pinctrl-0 = <&i2c3_default_mode>;
+                       pinctrl-1 = <&i2c3_sleep_mode>;
+               };
+
+               ssp@80002000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&ssp0_snowball_mode>;
+               };
+
                cpufreq-cooling {
                        status = "okay";
                };
                                };
                        };
                };
+
+               pinctrl {
+                       /*
+                        * Set this up using hogs, as time goes by and as seems fit, these
+                        * can be moved over to being controlled by respective device.
+                        */
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&accel_snowball_mode>,
+                                 <&magneto_snowball_mode>,
+                                 <&gbf_snowball_mode>,
+                                 <&wlan_snowball_mode>;
+
+                       ethernet {
+                               /*
+                                * Mux in "SM" which is used for the
+                                * SMSC911x Ethernet adapter
+                                */
+                               eth_snowball_mode: eth_snowball {
+                                       snowball_mux {
+                                               ste,function = "sm";
+                                               ste,pins = "sm_b_1";
+                                       };
+                                       /* LAN IRQ pin */
+                                       snowball_cfg1 {
+                                               ste,pins = "GPIO140_B11";
+                                               ste,config = <&in_nopull>;
+                                       };
+                                       /* LAN reset pin */
+                                       snowball_cfg2 {
+                                               ste,pins = "GPIO141_C12";
+                                               ste,config = <&gpio_out_hi>;
+                                       };
+
+                               };
+                       };
+                       sdi0 {
+                               sdi0_default_mode: sdi0_default {
+                                       snowball_mux {
+                                               ste,function = "mc0";
+                                               ste,pins = "mc0dat31dir_a_1";
+                                       };
+                                       snowball_cfg1 {
+                                               ste,pins = "GPIO21_AB3"; /* DAT31DIR */
+                                               ste,config = <&out_hi>;
+                                       };
+
+                               };
+                       };
+                       ssp0 {
+                               ssp0_snowball_mode: ssp0_snowball_default {
+                                       snowball_mux {
+                                               ste,function = "ssp0";
+                                               ste,pins = "ssp0_a_1";
+                                       };
+                                       snowball_cfg1 {
+                                               ste,pins = "GPIO144_B13"; /* FRM */
+                                               ste,config = <&gpio_out_hi>;
+                                       };
+                                       snowball_cfg2 {
+                                               ste,pins = "GPIO145_C13"; /* RXD */
+                                               ste,config = <&in_pd>;
+                                       };
+                                       snowball_cfg3 {
+                                               ste,pins =
+                                               "GPIO146_D13", /* TXD */
+                                               "GPIO143_D12"; /* CLK */
+                                               ste,config = <&out_lo>;
+                                       };
+
+                               };
+                       };
+                       gpio_led {
+                               gpioled_snowball_mode: gpioled_default {
+                                       snowball_cfg1 {
+                                               ste,pins = "GPIO142_C11";
+                                               ste,config = <&gpio_out_hi>;
+                                       };
+
+                               };
+                       };
+                       accelerometer {
+                               accel_snowball_mode: accel_snowball {
+                                       /* Accelerometer lines */
+                                       snowball_cfg1 {
+                                               ste,pins =
+                                               "GPIO163_C20", /* ACCEL_IRQ1 */
+                                               "GPIO164_B21"; /* ACCEL_IRQ2 */
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+                       magnetometer {
+                               magneto_snowball_mode: magneto_snowball {
+                                       snowball_cfg1 {
+                                               ste,pins = "GPIO165_C21"; /* MAG_DRDY */
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+                       gbf {
+                               gbf_snowball_mode: gbf_snowball {
+                                       /*
+                                        * GBF (GPS, Bluetooth, FM-radio) interface,
+                                        * pull low to reset state
+                                        */
+                                       snowball_cfg1 {
+                                               ste,pins = "GPIO171_D23"; /* GBF_ENA_RESET */
+                                               ste,config = <&gpio_out_lo>;
+                                       };
+                                };
+                       };
+                       wlan {
+                               wlan_snowball_mode: wlan_snowball {
+                                       /*
+                                        * Activate this mode with the WLAN chip.
+                                        * These are plain GPIO pins used by WLAN
+                                        */
+                                       snowball_cfg1 {
+                                               ste,pins =
+                                               "GPIO161_D21", /* WLAN_PMU_EN */
+                                               "GPIO215_AH13"; /* WLAN_ENA */
+                                               ste,config = <&gpio_out_lo>;
+                                       };
+                                       snowball_cfg2 {
+                                               ste,pins = "GPIO216_AG12"; /* WLAN_IRQ */
+                                               ste,config = <&gpio_in_pu>;
+                                       };
+                               };
+                       };
+               };
+
+               mcde@a0350000 {
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&lcd_default_mode>;
+                       pinctrl-1 = <&lcd_sleep_mode>;
+               };
        };
 };
index 8a1032c1ffc9fd3bc129554d850f9d941585d390..a9da4800daf0edf96d5b5a853afce566dc0e411a 100644 (file)
                clocks = <&i2c0_clk>;
                #address-cells = <1>;
                #size-cells = <0>;
-               ab3100: ab3100@0x48 {
+               ab3100: ab3100@48 {
                        compatible = "stericsson,ab3100";
                        reg = <0x48>;
                        interrupt-parent = <&vica>;
                clocks = <&i2c1_clk>;
                #address-cells = <1>;
                #size-cells = <0>;
-               fwcam0: fwcam@0x10 {
+               fwcam0: fwcam@10 {
                        reg = <0x10>;
                };
-               fwcam1: fwcam@0x5d {
+               fwcam1: fwcam@5d {
                        reg = <0x5d>;
                };
        };
index 1d322b24d1e441bebabfd55d93ec9738b067f1ee..e56449d41481fc3badf5fdd83ce3930c77f628f8 100644 (file)
                                        };
                                };
                        };
+
+                       sbc_i2c0 {
+                               pinctrl_sbc_i2c0_default: sbc_i2c0-default {
+                                       st,pins {
+                                               sda = <&PIO4 6 ALT1 BIDIR>;
+                                               scl = <&PIO4 5 ALT1 BIDIR>;
+                                       };
+                               };
+                       };
+
+                       sbc_i2c1 {
+                               pinctrl_sbc_i2c1_default: sbc_i2c1-default {
+                                       st,pins {
+                                               sda = <&PIO3 2 ALT2 BIDIR>;
+                                               scl = <&PIO3 1 ALT2 BIDIR>;
+                                       };
+                               };
+                       };
                };
 
                pin-controller-front {
                                reg             = <0x7000 0x100>;
                                st,bank-name    = "PIO12";
                        };
+
+                       i2c0 {
+                               pinctrl_i2c0_default: i2c0-default {
+                                       st,pins {
+                                               sda = <&PIO9 3 ALT1 BIDIR>;
+                                               scl = <&PIO9 2 ALT1 BIDIR>;
+                                       };
+                               };
+                       };
+
+                       i2c1 {
+                               pinctrl_i2c1_default: i2c1-default {
+                                       st,pins {
+                                               sda = <&PIO12 1 ALT1 BIDIR>;
+                                               scl = <&PIO12 0 ALT1 BIDIR>;
+                                       };
+                               };
+                       };
                };
 
                pin-controller-rear {
index 74ab8ded4b49b0faf3ecdf4729b22d16fd8b27b8..d9c7dd1d95a4545a083874f8d0a4193f96063198 100644 (file)
@@ -9,6 +9,7 @@
 #include "stih41x.dtsi"
 #include "stih415-clock.dtsi"
 #include "stih415-pinctrl.dtsi"
+#include <dt-bindings/interrupt-controller/arm-gic.h>
 / {
 
        L2: cache-controller {
                        pinctrl-names   = "default";
                        pinctrl-0       = <&pinctrl_sbc_serial1>;
                };
+
+               i2c@fed40000 {
+                       compatible      = "st,comms-ssc4-i2c";
+                       reg             = <0xfed40000 0x110>;
+                       interrupts      = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks          = <&CLKS_ICN_REG_0>;
+                       clock-names     = "ssc";
+                       clock-frequency = <400000>;
+                       pinctrl-names   = "default";
+                       pinctrl-0       = <&pinctrl_i2c0_default>;
+
+                       status          = "disabled";
+               };
+
+               i2c@fed41000 {
+                       compatible      = "st,comms-ssc4-i2c";
+                       reg             = <0xfed41000 0x110>;
+                       interrupts      = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks          = <&CLKS_ICN_REG_0>;
+                       clock-names     = "ssc";
+                       clock-frequency = <400000>;
+                       pinctrl-names   = "default";
+                       pinctrl-0       = <&pinctrl_i2c1_default>;
+
+                       status          = "disabled";
+               };
+
+               i2c@fe540000 {
+                       compatible      = "st,comms-ssc4-i2c";
+                       reg             = <0xfe540000 0x110>;
+                       interrupts      = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks          = <&CLK_SYSIN>;
+                       clock-names     = "ssc";
+                       clock-frequency = <400000>;
+                       pinctrl-names   = "default";
+                       pinctrl-0       = <&pinctrl_sbc_i2c0_default>;
+
+                       status          = "disabled";
+               };
+
+               i2c@fe541000 {
+                       compatible      = "st,comms-ssc4-i2c";
+                       reg             = <0xfe541000 0x110>;
+                       interrupts      = <GIC_SPI 207 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks          = <&CLK_SYSIN>;
+                       clock-names     = "ssc";
+                       clock-frequency = <400000>;
+                       pinctrl-names   = "default";
+                       pinctrl-0       = <&pinctrl_sbc_i2c1_default>;
+
+                       status          = "disabled";
+               };
        };
 };
index 0f246c979262d3c39676576fdde4c2797cb0d118..b29ff4ba542c51300d566f9649a78ed614e0f3b0 100644 (file)
                                        };
                                };
                        };
+
+                       sbc_i2c0 {
+                               pinctrl_sbc_i2c0_default: sbc_i2c0-default {
+                                       st,pins {
+                                               sda = <&PIO4 6 ALT1 BIDIR>;
+                                               scl = <&PIO4 5 ALT1 BIDIR>;
+                                       };
+                               };
+                       };
+
+                       sbc_i2c1 {
+                               pinctrl_sbc_i2c1_default: sbc_i2c1-default {
+                                       st,pins {
+                                               sda = <&PIO3 2 ALT2 BIDIR>;
+                                               scl = <&PIO3 1 ALT2 BIDIR>;
+                                       };
+                               };
+                       };
                };
 
                pin-controller-front {
                                };
                        };
 
+                       i2c0 {
+                               pinctrl_i2c0_default: i2c0-default {
+                                       st,pins {
+                                               sda = <&PIO9 3 ALT1 BIDIR>;
+                                               scl = <&PIO9 2 ALT1 BIDIR>;
+                                       };
+                               };
+                       };
+
+                       i2c1 {
+                               pinctrl_i2c1_default: i2c1-default {
+                                       st,pins {
+                                               sda = <&PIO12 1 ALT1 BIDIR>;
+                                               scl = <&PIO12 0 ALT1 BIDIR>;
+                                       };
+                               };
+                       };
                };
 
                pin-controller-rear {
index 1a0326ea7d070ad762d6f83719aa0fcc29a98dd2..b7ab47b95816de67897c567fcbab4ffb61e90219 100644 (file)
@@ -9,6 +9,7 @@
 #include "stih41x.dtsi"
 #include "stih416-clock.dtsi"
 #include "stih416-pinctrl.dtsi"
+#include <dt-bindings/interrupt-controller/arm-gic.h>
 / {
        L2: cache-controller {
                compatible = "arm,pl310-cache";
                        pinctrl-0       = <&pinctrl_sbc_serial1>;
                        clocks          = <&CLK_SYSIN>;
                };
+
+               i2c@fed40000 {
+                       compatible      = "st,comms-ssc4-i2c";
+                       reg             = <0xfed40000 0x110>;
+                       interrupts      = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks          = <&CLK_S_ICN_REG_0>;
+                       clock-names     = "ssc";
+                       clock-frequency = <400000>;
+                       pinctrl-names   = "default";
+                       pinctrl-0       = <&pinctrl_i2c0_default>;
+
+                       status          = "disabled";
+               };
+
+               i2c@fed41000 {
+                       compatible      = "st,comms-ssc4-i2c";
+                       reg             = <0xfed41000 0x110>;
+                       interrupts      = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks          = <&CLK_S_ICN_REG_0>;
+                       clock-names     = "ssc";
+                       clock-frequency = <400000>;
+                       pinctrl-names   = "default";
+                       pinctrl-0       = <&pinctrl_i2c1_default>;
+
+                       status          = "disabled";
+               };
+
+               i2c@fe540000 {
+                       compatible      = "st,comms-ssc4-i2c";
+                       reg             = <0xfe540000 0x110>;
+                       interrupts      = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks          = <&CLK_SYSIN>;
+                       clock-names     = "ssc";
+                       clock-frequency = <400000>;
+                       pinctrl-names   = "default";
+                       pinctrl-0       = <&pinctrl_sbc_i2c0_default>;
+
+                       status          = "disabled";
+               };
+
+               i2c@fe541000 {
+                       compatible      = "st,comms-ssc4-i2c";
+                       reg             = <0xfe541000 0x110>;
+                       interrupts      = <GIC_SPI 207 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks          = <&CLK_SYSIN>;
+                       clock-names     = "ssc";
+                       clock-frequency = <400000>;
+                       pinctrl-names   = "default";
+                       pinctrl-0       = <&pinctrl_sbc_i2c1_default>;
+
+                       status          = "disabled";
+               };
        };
 };
index 8e694d2b8f5b9910879404a8e6e64b00c81c11b8..1e6aa92772f55588d5b8c32b87490f781dc4dfa6 100644 (file)
                        };
                };
 
+               /* HDMI Tx I2C */
+               i2c@fed41000 {
+                       /* HDMI V1.3a supports Standard mode only */
+                       clock-frequency = <100000>;
+                       i2c-min-scl-pulse-width-us = <0>;
+                       i2c-min-sda-pulse-width-us = <5>;
+
+                       status = "okay";
+               };
        };
 };
index 133e18143b1ba0d2c278d98c45d247a963d08491..0ef0a69df8ea36909f38e40d6552a8be27fb5d6c 100644 (file)
                                default-state = "off";
                        };
                };
+
+               i2c@fed40000 {
+                       status = "okay";
+               };
+
+               /* HDMI Tx I2C */
+               i2c@fed41000 {
+                       /* HDMI V1.3a supports Standard mode only */
+                       clock-frequency = <100000>;
+                       i2c-min-scl-pulse-width-us = <0>;
+                       i2c-min-sda-pulse-width-us = <5>;
+
+                       status = "okay";
+               };
+
+               i2c@fe540000 {
+                       status = "okay";
+               };
+
+               i2c@fe541000 {
+                       status = "okay";
+               };
        };
 };
index eb4d73b6a0904fafa03308e16eb4ce1389a8340a..d4b081d6a16772cbac6835abd4bec6c21753c3c1 100644 (file)
        model = "Mele A1000";
        compatible = "mele,a1000", "allwinner,sun4i-a10";
 
-       aliases {
-               serial0 = &uart0;
-       };
-
        soc@01c00000 {
                emac: ethernet@01c0b000 {
                        pinctrl-names = "default";
index 425a7db898c553b043798d953451cb9b00a5d146..b139ee6bcf99f422535899173f481777c7751541 100644 (file)
        model = "Cubietech Cubieboard";
        compatible = "cubietech,a10-cubieboard", "allwinner,sun4i-a10";
 
-       aliases {
-               serial0 = &uart0;
-               serial1 = &uart1;
-       };
-
-       chosen {
-               bootargs = "earlyprintk console=ttyS0,115200";
-       };
-
        soc@01c00000 {
                emac: ethernet@01c0b000 {
                        pinctrl-names = "default";
index b3ae51fa9372328f7fc9c7dee5eb577536f87bdb..3a1595f67823c1999f2ea4c1929ed66fd46fe055 100644 (file)
        model = "Miniand Hackberry";
        compatible = "miniand,hackberry", "allwinner,sun4i-a10";
 
-       chosen {
-               bootargs = "earlyprintk console=ttyS0,115200";
-       };
-
        soc@01c00000 {
                emac: ethernet@01c0b000 {
                        pinctrl-names = "default";
index 0c1447c68059785cef99693b3c788c7281f4b9ba..70b3323caf1ad071c6683d759b90955f6bb2b8c1 100644 (file)
        model = "PineRiver Mini X-Plus";
        compatible = "pineriver,mini-xplus", "allwinner,sun4i-a10";
 
-       chosen {
-               bootargs = "earlyprintk console=ttyS0,115200";
-       };
-
        soc@01c00000 {
                uart0: serial@01c28000 {
                        pinctrl-names = "default";
index 319cc6b509da8e29ee657730497d87f1215745a8..040bb0eba1526f9747ad9955f874c39f3a757d85 100644 (file)
 / {
        interrupt-parent = <&intc>;
 
+       aliases {
+               ethernet0 = &emac;
+               serial0 = &uart0;
+               serial1 = &uart1;
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                        clocks = <&osc24M>;
                };
 
+               pll4: pll4@01c20018 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-pll1-clk";
+                       reg = <0x01c20018 0x4>;
+                       clocks = <&osc24M>;
+               };
+
+               pll5: pll5@01c20020 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-pll5-clk";
+                       reg = <0x01c20020 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll5_ddr", "pll5_other";
+               };
+
+               pll6: pll6@01c20028 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-pll6-clk";
+                       reg = <0x01c20028 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll6_sata", "pll6_other", "pll6";
+               };
+
                /* dummy is 200M */
                cpu: cpu@01c20054 {
                        #clock-cells = <0>;
                                "apb0_ir1", "apb0_keypad";
                };
 
-               /* dummy is pll62 */
                apb1_mux: apb1_mux@01c20058 {
                        #clock-cells = <0>;
                        compatible = "allwinner,sun4i-apb1-mux-clk";
                        reg = <0x01c20058 0x4>;
-                       clocks = <&osc24M>, <&dummy>, <&osc32k>;
+                       clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
                };
 
                apb1: apb1@01c20058 {
                                "apb1_uart4", "apb1_uart5", "apb1_uart6",
                                "apb1_uart7";
                };
+
+               nand_clk: clk@01c20080 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20080 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "nand";
+               };
+
+               ms_clk: clk@01c20084 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20084 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ms";
+               };
+
+               mmc0_clk: clk@01c20088 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20088 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc0";
+               };
+
+               mmc1_clk: clk@01c2008c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c2008c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc1";
+               };
+
+               mmc2_clk: clk@01c20090 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20090 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc2";
+               };
+
+               mmc3_clk: clk@01c20094 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20094 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc3";
+               };
+
+               ts_clk: clk@01c20098 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20098 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ts";
+               };
+
+               ss_clk: clk@01c2009c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c2009c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ss";
+               };
+
+               spi0_clk: clk@01c200a0 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a0 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi0";
+               };
+
+               spi1_clk: clk@01c200a4 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a4 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi1";
+               };
+
+               spi2_clk: clk@01c200a8 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a8 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi2";
+               };
+
+               pata_clk: clk@01c200ac {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200ac 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "pata";
+               };
+
+               ir0_clk: clk@01c200b0 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200b0 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ir0";
+               };
+
+               ir1_clk: clk@01c200b4 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200b4 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ir1";
+               };
+
+               spi3_clk: clk@01c200d4 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200d4 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi3";
+               };
        };
 
        soc@01c00000 {
                        reg = <0x01c20c90 0x10>;
                };
 
+               rtc: rtc@01c20d00 {
+                       compatible = "allwinner,sun4i-rtc";
+                       reg = <0x01c20d00 0x20>;
+                       interrupts = <24>;
+               };
+
                sid: eeprom@01c23800 {
                        compatible = "allwinner,sun4i-sid";
                        reg = <0x01c23800 0x10>;
                };
 
+               rtp: rtp@01c25000 {
+                       compatible = "allwinner,sun4i-ts";
+                       reg = <0x01c25000 0x100>;
+                       interrupts = <29>;
+               };
+
                uart0: serial@01c28000 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c28000 0x400>;
index e674c94c720698e70b8a934ef5e560e4b725d0c7..ea16054857a497e4794167402d4a0a456f2f378f 100644 (file)
 / {
        interrupt-parent = <&intc>;
 
+       aliases {
+               ethernet0 = &emac;
+       };
+
        cpus {
                cpu@0 {
                        compatible = "arm,cortex-a8";
                        clocks = <&osc24M>;
                };
 
+               pll4: pll4@01c20018 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-pll1-clk";
+                       reg = <0x01c20018 0x4>;
+                       clocks = <&osc24M>;
+               };
+
+               pll5: pll5@01c20020 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-pll5-clk";
+                       reg = <0x01c20020 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll5_ddr", "pll5_other";
+               };
+
+               pll6: pll6@01c20028 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-pll6-clk";
+                       reg = <0x01c20028 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll6_sata", "pll6_other", "pll6";
+               };
+
                /* dummy is 200M */
                cpu: cpu@01c20054 {
                        #clock-cells = <0>;
                                "apb0_ir", "apb0_keypad";
                };
 
-               /* dummy is pll62 */
                apb1_mux: apb1_mux@01c20058 {
                        #clock-cells = <0>;
                        compatible = "allwinner,sun4i-apb1-mux-clk";
                        reg = <0x01c20058 0x4>;
-                       clocks = <&osc24M>, <&dummy>, <&osc32k>;
+                       clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
                };
 
                apb1: apb1@01c20058 {
                                "apb1_i2c2", "apb1_uart0", "apb1_uart1",
                                "apb1_uart2", "apb1_uart3";
                };
+
+               nand_clk: clk@01c20080 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20080 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "nand";
+               };
+
+               ms_clk: clk@01c20084 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20084 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ms";
+               };
+
+               mmc0_clk: clk@01c20088 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20088 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc0";
+               };
+
+               mmc1_clk: clk@01c2008c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c2008c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc1";
+               };
+
+               mmc2_clk: clk@01c20090 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20090 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc2";
+               };
+
+               ts_clk: clk@01c20098 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20098 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ts";
+               };
+
+               ss_clk: clk@01c2009c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c2009c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ss";
+               };
+
+               spi0_clk: clk@01c200a0 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a0 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi0";
+               };
+
+               spi1_clk: clk@01c200a4 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a4 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi1";
+               };
+
+               spi2_clk: clk@01c200a8 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a8 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi2";
+               };
+
+               ir0_clk: clk@01c200b0 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200b0 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ir0";
+               };
+
+               mbus_clk: clk@01c2015c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c2015c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mbus";
+               };
        };
 
        soc@01c00000 {
                        reg = <0x01c23800 0x10>;
                };
 
+               rtp: rtp@01c25000 {
+                       compatible = "allwinner,sun4i-ts";
+                       reg = <0x01c25000 0x100>;
+                       interrupts = <29>;
+               };
+
                uart0: serial@01c28000 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c28000 0x400>;
diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino-micro.dts
new file mode 100644 (file)
index 0000000..fe2ce0a
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2012 Maxime Ripard
+ * Copyright 2013 Hans de Goede <hdegoede@redhat.com>
+ *
+ * Maxime Ripard <maxime.ripard@free-electrons.com>
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ "sun5i-a13.dtsi"
+
+/ {
+       model = "Olimex A13-Olinuxino Micro";
+       compatible = "olimex,a13-olinuxino-micro", "allwinner,sun5i-a13";
+
+       soc@01c00000 {
+               pinctrl@01c20800 {
+                       led_pins_olinuxinom: led_pins@0 {
+                               allwinner,pins = "PG9";
+                               allwinner,function = "gpio_out";
+                               allwinner,drive = <1>;
+                               allwinner,pull = <0>;
+                       };
+               };
+
+               uart1: serial@01c28400 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart1_pins_b>;
+                       status = "okay";
+               };
+
+               i2c0: i2c@01c2ac00 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c0_pins_a>;
+                       status = "okay";
+               };
+
+               i2c1: i2c@01c2b000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c1_pins_a>;
+                       status = "okay";
+               };
+
+               i2c2: i2c@01c2b400 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c2_pins_a>;
+                       status = "okay";
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&led_pins_olinuxinom>;
+
+               power {
+                       label = "a13-olinuxino-micro:green:power";
+                       gpios = <&pio 6 9 0>;
+                       default-state = "on";
+               };
+       };
+};
index 9e508dcc4245da295d28a719edeb866108e32354..a4ba5ff010cf78b96f9f357c9c4e637a9720171b 100644 (file)
        model = "Olimex A13-Olinuxino";
        compatible = "olimex,a13-olinuxino", "allwinner,sun5i-a13";
 
-       chosen {
-               bootargs = "earlyprintk console=ttyS0,115200";
-       };
-
        soc@01c00000 {
                pinctrl@01c20800 {
                        led_pins_olinuxino: led_pins@0 {
index 1ccd75d37f49d4aeffbec39f0c518d62fd49b22b..320335abfccd763118408f3f836c0fba39ca6f69 100644 (file)
                        clocks = <&osc24M>;
                };
 
+               pll4: pll4@01c20018 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-pll1-clk";
+                       reg = <0x01c20018 0x4>;
+                       clocks = <&osc24M>;
+               };
+
+               pll5: pll5@01c20020 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-pll5-clk";
+                       reg = <0x01c20020 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll5_ddr", "pll5_other";
+               };
+
+               pll6: pll6@01c20028 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-pll6-clk";
+                       reg = <0x01c20028 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll6_sata", "pll6_other", "pll6";
+               };
+
                /* dummy is 200M */
                cpu: cpu@01c20054 {
                        #clock-cells = <0>;
                        clock-output-names = "apb0_codec", "apb0_pio", "apb0_ir";
                };
 
-               /* dummy is pll6 */
                apb1_mux: apb1_mux@01c20058 {
                        #clock-cells = <0>;
                        compatible = "allwinner,sun4i-apb1-mux-clk";
                        reg = <0x01c20058 0x4>;
-                       clocks = <&osc24M>, <&dummy>, <&osc32k>;
+                       clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
                };
 
                apb1: apb1@01c20058 {
                        clock-output-names = "apb1_i2c0", "apb1_i2c1",
                                "apb1_i2c2", "apb1_uart1", "apb1_uart3";
                };
+
+               nand_clk: clk@01c20080 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20080 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "nand";
+               };
+
+               ms_clk: clk@01c20084 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20084 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ms";
+               };
+
+               mmc0_clk: clk@01c20088 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20088 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc0";
+               };
+
+               mmc1_clk: clk@01c2008c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c2008c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc1";
+               };
+
+               mmc2_clk: clk@01c20090 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20090 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc2";
+               };
+
+               ts_clk: clk@01c20098 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20098 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ts";
+               };
+
+               ss_clk: clk@01c2009c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c2009c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ss";
+               };
+
+               spi0_clk: clk@01c200a0 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a0 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi0";
+               };
+
+               spi1_clk: clk@01c200a4 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a4 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi1";
+               };
+
+               spi2_clk: clk@01c200a8 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a8 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi2";
+               };
+
+               ir0_clk: clk@01c200b0 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200b0 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ir0";
+               };
+
+               mbus_clk: clk@01c2015c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c2015c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mbus";
+               };
        };
 
        soc@01c00000 {
                        reg = <0x01c23800 0x10>;
                };
 
+               rtp: rtp@01c25000 {
+                       compatible = "allwinner,sun4i-ts";
+                       reg = <0x01c25000 0x100>;
+                       interrupts = <29>;
+               };
+
                uart1: serial@01c28400 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c28400 0x400>;
index 7f5878c2784ab28eff69c2a278dfa408fe70bc4d..5256ad9be52c691022ce99e81b679b012f766350 100644 (file)
                        };
                };
 
+               ahb1_rst: reset@01c202c0 {
+                       #reset-cells = <1>;
+                       compatible = "allwinner,sun6i-a31-ahb1-reset";
+                       reg = <0x01c202c0 0xc>;
+               };
+
+               apb1_rst: reset@01c202d0 {
+                       #reset-cells = <1>;
+                       compatible = "allwinner,sun6i-a31-clock-reset";
+                       reg = <0x01c202d0 0x4>;
+               };
+
+               apb2_rst: reset@01c202d8 {
+                       #reset-cells = <1>;
+                       compatible = "allwinner,sun6i-a31-clock-reset";
+                       reg = <0x01c202d8 0x4>;
+               };
+
                timer@01c20c00 {
                        compatible = "allwinner,sun4i-timer";
                        reg = <0x01c20c00 0xa0>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb2_gates 16>;
+                       resets = <&apb2_rst 16>;
                        status = "disabled";
                };
 
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb2_gates 17>;
+                       resets = <&apb2_rst 17>;
                        status = "disabled";
                };
 
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb2_gates 18>;
+                       resets = <&apb2_rst 18>;
                        status = "disabled";
                };
 
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb2_gates 19>;
+                       resets = <&apb2_rst 19>;
                        status = "disabled";
                };
 
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb2_gates 20>;
+                       resets = <&apb2_rst 20>;
                        status = "disabled";
                };
 
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb2_gates 21>;
+                       resets = <&apb2_rst 21>;
                        status = "disabled";
                };
 
                        #interrupt-cells = <3>;
                        interrupts = <1 9 0xf04>;
                };
+
+               cpucfg@01f01c00 {
+                       compatible = "allwinner,sun6i-a31-cpuconfig";
+                       reg = <0x01f01c00 0x300>;
+               };
+
+               prcm@01f01c00 {
+                       compatible = "allwinner,sun6i-a31-prcm";
+                       reg = <0x01f01400 0x200>;
+               };
        };
 };
index 8a1009d6c8293f7633102d691fb856affabfb4e3..f9dcb61a5305b08b8ef1c50352401bc2e9ba9487 100644 (file)
                        pinctrl-0 = <&uart0_pins_a>;
                        status = "okay";
                };
+
+               i2c0: i2c@01c2ac00 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c0_pins_a>;
+                       status = "okay";
+               };
+
+               i2c1: i2c@01c2b000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c1_pins_a>;
+                       status = "okay";
+               };
+
+               i2c2: i2c@01c2b400 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&i2c2_pins_a>;
+                       status = "okay";
+               };
        };
 
        leds {
index 0135039eff96440dfc5b2fbb7813a137bd51122d..119f066f0d98aa16221855e04e8a3f83e4afe33e 100644 (file)
 / {
        interrupt-parent = <&gic>;
 
+       aliases {
+               ethernet0 = &emac;
+       };
+
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
                        clock-frequency = <24000000>;
                };
 
-               osc32k: osc32k {
+               osc32k: clk@0 {
                        #clock-cells = <0>;
                        compatible = "fixed-clock";
                        clock-frequency = <32768>;
+                       clock-output-names = "osc32k";
                };
 
                pll1: pll1@01c20000 {
                        clocks = <&osc24M>;
                };
 
-               /*
-                * This is a dummy clock, to be used as placeholder on
-                * other mux clocks when a specific parent clock is not
-                * yet implemented. It should be dropped when the driver
-                * is complete.
-                */
-               pll6: pll6 {
+               pll4: pll4@01c20018 {
                        #clock-cells = <0>;
-                       compatible = "fixed-clock";
-                       clock-frequency = <0>;
+                       compatible = "allwinner,sun4i-pll1-clk";
+                       reg = <0x01c20018 0x4>;
+                       clocks = <&osc24M>;
+               };
+
+               pll5: pll5@01c20020 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-pll5-clk";
+                       reg = <0x01c20020 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll5_ddr", "pll5_other";
+               };
+
+               pll6: pll6@01c20028 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-pll6-clk";
+                       reg = <0x01c20028 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll6_sata", "pll6_other", "pll6";
                };
 
                cpu: cpu@01c20054 {
                        #clock-cells = <0>;
                        compatible = "allwinner,sun4i-cpu-clk";
                        reg = <0x01c20054 0x4>;
-                       clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll6>;
+                       clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll6 1>;
                };
 
                axi: axi@01c20054 {
                        #clock-cells = <0>;
                        compatible = "allwinner,sun4i-apb1-mux-clk";
                        reg = <0x01c20058 0x4>;
-                       clocks = <&osc24M>, <&pll6>, <&osc32k>;
+                       clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
                };
 
                apb1: apb1@01c20058 {
                                "apb1_uart2", "apb1_uart3", "apb1_uart4",
                                "apb1_uart5", "apb1_uart6", "apb1_uart7";
                };
+
+               nand_clk: clk@01c20080 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20080 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "nand";
+               };
+
+               ms_clk: clk@01c20084 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20084 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ms";
+               };
+
+               mmc0_clk: clk@01c20088 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20088 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc0";
+               };
+
+               mmc1_clk: clk@01c2008c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c2008c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc1";
+               };
+
+               mmc2_clk: clk@01c20090 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20090 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc2";
+               };
+
+               mmc3_clk: clk@01c20094 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20094 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "mmc3";
+               };
+
+               ts_clk: clk@01c20098 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c20098 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ts";
+               };
+
+               ss_clk: clk@01c2009c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c2009c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ss";
+               };
+
+               spi0_clk: clk@01c200a0 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a0 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi0";
+               };
+
+               spi1_clk: clk@01c200a4 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a4 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi1";
+               };
+
+               spi2_clk: clk@01c200a8 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200a8 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi2";
+               };
+
+               pata_clk: clk@01c200ac {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200ac 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "pata";
+               };
+
+               ir0_clk: clk@01c200b0 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200b0 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ir0";
+               };
+
+               ir1_clk: clk@01c200b4 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200b4 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "ir1";
+               };
+
+               spi3_clk: clk@01c200d4 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c200d4 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
+                       clock-output-names = "spi3";
+               };
+
+               mbus_clk: clk@01c2015c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-mod0-clk";
+                       reg = <0x01c2015c 0x4>;
+                       clocks = <&osc24M>, <&pll6 2>, <&pll5 1>;
+                       clock-output-names = "mbus";
+               };
+
+               /*
+                * Dummy clock used by output clocks
+                */
+               osc24M_32k: clk@1 {
+                       #clock-cells = <0>;
+                       compatible = "fixed-factor-clock";
+                       clock-div = <750>;
+                       clock-mult = <1>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "osc24M_32k";
+               };
+
+               clk_out_a: clk@01c201f0 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun7i-a20-out-clk";
+                       reg = <0x01c201f0 0x4>;
+                       clocks = <&osc24M_32k>, <&osc32k>, <&osc24M>;
+                       clock-output-names = "clk_out_a";
+               };
+
+               clk_out_b: clk@01c201f4 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun7i-a20-out-clk";
+                       reg = <0x01c201f4 0x4>;
+                       clocks = <&osc24M_32k>, <&osc32k>, <&osc24M>;
+                       clock-output-names = "clk_out_b";
+               };
        };
 
        soc@01c00000 {
                                allwinner,drive = <0>;
                                allwinner,pull = <0>;
                        };
+
+                       clk_out_a_pins_a: clk_out_a@0 {
+                               allwinner,pins = "PI12";
+                               allwinner,function = "clk_out_a";
+                               allwinner,drive = <0>;
+                               allwinner,pull = <0>;
+                       };
+
+                       clk_out_b_pins_a: clk_out_b@0 {
+                               allwinner,pins = "PI13";
+                               allwinner,function = "clk_out_b";
+                               allwinner,drive = <0>;
+                               allwinner,pull = <0>;
+                       };
                };
 
                timer@01c20c00 {
                        reg = <0x01c20c90 0x10>;
                };
 
+               rtc: rtc@01c20d00 {
+                       compatible = "allwinner,sun7i-a20-rtc";
+                       reg = <0x01c20d00 0x20>;
+                       interrupts = <0 24 1>;
+               };
+
                sid: eeprom@01c23800 {
                        compatible = "allwinner,sun7i-a20-sid";
                        reg = <0x01c23800 0x200>;
                };
 
+               rtp: rtp@01c25000 {
+                       compatible = "allwinner,sun4i-ts";
+                       reg = <0x01c25000 0x100>;
+                       interrupts = <0 29 4>;
+               };
+
                uart0: serial@01c28000 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c28000 0x400>;
index cb5ec23b03a71b59e8fac5f3df740f3eaa730f32..73aecfb57ccb0a6b4210e6babf0b0d063e893e16 100644 (file)
@@ -7,11 +7,42 @@
        model = "NVIDIA Tegra114 Dalmore evaluation board";
        compatible = "nvidia,dalmore", "nvidia,tegra114";
 
+       aliases {
+               rtc0 = "/i2c@7000d000/tps65913@58";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x80000000 0x40000000>;
        };
 
-       pinmux {
+       host1x@50000000 {
+               hdmi@54280000 {
+                       status = "okay";
+
+                       vdd-supply = <&vdd_hdmi_reg>;
+                       pll-supply = <&palmas_smps3_reg>;
+
+                       nvidia,ddc-i2c-bus = <&hdmi_ddc>;
+                       nvidia,hpd-gpio =
+                               <&gpio TEGRA_GPIO(N, 7) GPIO_ACTIVE_HIGH>;
+               };
+
+               dsi@54300000 {
+                       status = "okay";
+
+                       panel@0 {
+                               compatible = "panasonic,vvx10f004b00",
+                                            "simple-panel";
+                               reg = <0>;
+
+                               power-supply = <&avdd_lcd_reg>;
+                               backlight = <&backlight>;
+                       };
+               };
+       };
+
+       pinmux@70000868 {
                pinctrl-names = "default";
                pinctrl-0 = <&state_default>;
 
                        clk1_out_pw4 {
                                nvidia,pins = "clk1_out_pw4";
                                nvidia,function = "extperiph1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        dap1_din_pn1 {
                                nvidia,pins = "dap1_din_pn1";
                                nvidia,function = "i2s0";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        dap1_dout_pn2 {
                                nvidia,pins = "dap1_dout_pn2",
                                                "dap1_fs_pn0",
                                                "dap1_sclk_pn3";
                                nvidia,function = "i2s0";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        dap2_din_pa4 {
                                nvidia,pins = "dap2_din_pa4";
                                nvidia,function = "i2s1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        dap2_dout_pa5 {
                                nvidia,pins = "dap2_dout_pa5",
                                                "dap2_fs_pa2",
                                                "dap2_sclk_pa3";
                                nvidia,function = "i2s1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        dap4_din_pp5 {
                                nvidia,pins = "dap4_din_pp5",
                                                "dap4_fs_pp4",
                                                "dap4_sclk_pp7";
                                nvidia,function = "i2s3";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        dvfs_pwm_px0 {
                                nvidia,pins = "dvfs_pwm_px0",
                                                "dvfs_clk_px2";
                                nvidia,function = "cldvfs";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        ulpi_clk_py0 {
                                nvidia,pins = "ulpi_clk_py0",
                                                "ulpi_data6_po7",
                                                "ulpi_data7_po0";
                                nvidia,function = "ulpi";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        ulpi_dir_py1 {
                                nvidia,pins = "ulpi_dir_py1",
                                                "ulpi_nxt_py2";
                                nvidia,function = "ulpi";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        ulpi_stp_py3 {
                                nvidia,pins = "ulpi_stp_py3";
                                nvidia,function = "ulpi";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        cam_i2c_scl_pbb1 {
                                nvidia,pins = "cam_i2c_scl_pbb1",
                                                "cam_i2c_sda_pbb2";
                                nvidia,function = "i2c3";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
-                               nvidia,lock = <0>;
-                               nvidia,open-drain = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_DISABLE>;
                        };
                        cam_mclk_pcc0 {
                                nvidia,pins = "cam_mclk_pcc0",
                                                "pbb0";
                                nvidia,function = "vi_alt3";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
-                               nvidia,lock = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
                        };
                        gen2_i2c_scl_pt5 {
                                nvidia,pins = "gen2_i2c_scl_pt5",
                                                "gen2_i2c_sda_pt6";
                                nvidia,function = "i2c2";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
-                               nvidia,lock = <0>;
-                               nvidia,open-drain = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_DISABLE>;
                        };
                        gmi_a16_pj7 {
                                nvidia,pins = "gmi_a16_pj7";
                                nvidia,function = "uartd";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        gmi_a17_pb0 {
                                nvidia,pins = "gmi_a17_pb0",
                                                "gmi_a18_pb1";
                                nvidia,function = "uartd";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        gmi_a19_pk7 {
                                nvidia,pins = "gmi_a19_pk7";
                                nvidia,function = "uartd";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        gmi_ad5_pg5 {
                                nvidia,pins = "gmi_ad5_pg5",
                                                "gmi_cs6_n_pi3",
                                                "gmi_wr_n_pi0";
                                nvidia,function = "spi4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        gmi_ad6_pg6 {
                                nvidia,pins = "gmi_ad6_pg6",
                                                "gmi_ad7_pg7";
                                nvidia,function = "spi4";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        gmi_ad12_ph4 {
                                nvidia,pins = "gmi_ad12_ph4";
                                nvidia,function = "rsvd4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        gmi_ad9_ph1 {
                                nvidia,pins = "gmi_ad9_ph1";
                                nvidia,function = "pwm1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        gmi_cs1_n_pj2 {
                                nvidia,pins = "gmi_cs1_n_pj2",
                                                "gmi_oe_n_pi1";
                                nvidia,function = "soc";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        clk2_out_pw5 {
                                nvidia,pins = "clk2_out_pw5";
                                nvidia,function = "extperiph2";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc1_clk_pz0 {
                                nvidia,pins = "sdmmc1_clk_pz0";
                                nvidia,function = "sdmmc1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        sdmmc1_cmd_pz1 {
                                nvidia,pins = "sdmmc1_cmd_pz1",
                                                "sdmmc1_dat2_py5",
                                                "sdmmc1_dat3_py4";
                                nvidia,function = "sdmmc1";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        sdmmc1_wp_n_pv3 {
                                nvidia,pins = "sdmmc1_wp_n_pv3";
                                nvidia,function = "spi4";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc3_clk_pa6 {
                                nvidia,pins = "sdmmc3_clk_pa6";
                                nvidia,function = "sdmmc3";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        sdmmc3_cmd_pa7 {
                                nvidia,pins = "sdmmc3_cmd_pa7",
                                                "sdmmc3_clk_lb_out_pee4",
                                                "sdmmc3_clk_lb_in_pee5";
                                nvidia,function = "sdmmc3";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        sdmmc4_clk_pcc4 {
                                nvidia,pins = "sdmmc4_clk_pcc4";
                                nvidia,function = "sdmmc4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        sdmmc4_cmd_pt7 {
                                nvidia,pins = "sdmmc4_cmd_pt7",
                                                "sdmmc4_dat6_paa6",
                                                "sdmmc4_dat7_paa7";
                                nvidia,function = "sdmmc4";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        clk_32k_out_pa0 {
                                nvidia,pins = "clk_32k_out_pa0";
                                nvidia,function = "blink";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        kb_col0_pq0 {
                                nvidia,pins = "kb_col0_pq0",
                                                "kb_row1_pr1",
                                                "kb_row2_pr2";
                                nvidia,function = "kbc";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        dap3_din_pp1 {
                                nvidia,pins = "dap3_din_pp1",
                                                "dap3_sclk_pp3";
                                nvidia,function = "displayb";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        pv0 {
                                nvidia,pins = "pv0";
                                nvidia,function = "rsvd4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        kb_row7_pr7 {
                                nvidia,pins = "kb_row7_pr7";
                                nvidia,function = "rsvd2";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        kb_row10_ps2 {
                                nvidia,pins = "kb_row10_ps2";
                                nvidia,function = "uarta";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        kb_row9_ps1 {
                                nvidia,pins = "kb_row9_ps1";
                                nvidia,function = "uarta";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        pwr_i2c_scl_pz6 {
                                nvidia,pins = "pwr_i2c_scl_pz6",
                                                "pwr_i2c_sda_pz7";
                                nvidia,function = "i2cpwr";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
-                               nvidia,lock = <0>;
-                               nvidia,open-drain = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_DISABLE>;
                        };
                        sys_clk_req_pz5 {
                                nvidia,pins = "sys_clk_req_pz5";
                                nvidia,function = "sysclk";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        core_pwr_req {
                                nvidia,pins = "core_pwr_req";
                                nvidia,function = "pwron";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        cpu_pwr_req {
                                nvidia,pins = "cpu_pwr_req";
                                nvidia,function = "cpu";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        pwr_int_n {
                                nvidia,pins = "pwr_int_n";
                                nvidia,function = "pmi";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        reset_out_n {
                                nvidia,pins = "reset_out_n";
                                nvidia,function = "reset_out_n";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        clk3_out_pee0 {
                                nvidia,pins = "clk3_out_pee0";
                                nvidia,function = "extperiph3";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        gen1_i2c_scl_pc4 {
                                nvidia,pins = "gen1_i2c_scl_pc4",
                                                "gen1_i2c_sda_pc5";
                                nvidia,function = "i2c1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
-                               nvidia,lock = <0>;
-                               nvidia,open-drain = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_DISABLE>;
                        };
                        uart2_cts_n_pj5 {
                                nvidia,pins = "uart2_cts_n_pj5";
                                nvidia,function = "uartb";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        uart2_rts_n_pj6 {
                                nvidia,pins = "uart2_rts_n_pj6";
                                nvidia,function = "uartb";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        uart2_rxd_pc3 {
                                nvidia,pins = "uart2_rxd_pc3";
                                nvidia,function = "irda";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        uart2_txd_pc2 {
                                nvidia,pins = "uart2_txd_pc2";
                                nvidia,function = "irda";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        uart3_cts_n_pa1 {
                                nvidia,pins = "uart3_cts_n_pa1",
                                                "uart3_rxd_pw7";
                                nvidia,function = "uartc";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        uart3_rts_n_pc0 {
                                nvidia,pins = "uart3_rts_n_pc0",
                                                "uart3_txd_pw6";
                                nvidia,function = "uartc";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        owr {
                                nvidia,pins = "owr";
                                nvidia,function = "owr";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        hdmi_cec_pee3 {
                                nvidia,pins = "hdmi_cec_pee3";
                                nvidia,function = "cec";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
-                               nvidia,lock = <0>;
-                               nvidia,open-drain = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_DISABLE>;
                        };
                        ddc_scl_pv4 {
                                nvidia,pins = "ddc_scl_pv4",
                                                "ddc_sda_pv5";
                                nvidia,function = "i2c4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
-                               nvidia,lock = <0>;
-                               nvidia,rcv-sel = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,rcv-sel = <TEGRA_PIN_ENABLE>;
                        };
                        spdif_in_pk6 {
                                nvidia,pins = "spdif_in_pk6";
                                nvidia,function = "usb";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
-                               nvidia,lock = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
                        };
                        usb_vbus_en0_pn4 {
                                nvidia,pins = "usb_vbus_en0_pn4";
                                nvidia,function = "usb";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
-                               nvidia,lock = <0>;
-                               nvidia,open-drain = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_ENABLE>;
                        };
                        gpio_x6_aud_px6 {
                                nvidia,pins = "gpio_x6_aud_px6";
                                nvidia,function = "spi6";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        gpio_x4_aud_px4 {
                                nvidia,pins = "gpio_x4_aud_px4",
                                                "gpio_x7_aud_px7";
                                nvidia,function = "rsvd1";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        gpio_x5_aud_px5 {
                                nvidia,pins = "gpio_x5_aud_px5";
                                nvidia,function = "rsvd1";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        gpio_w2_aud_pw2 {
                                nvidia,pins = "gpio_w2_aud_pw2";
                                nvidia,function = "rsvd2";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        gpio_w3_aud_pw3 {
                                nvidia,pins = "gpio_w3_aud_pw3";
                                nvidia,function = "spi6";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        gpio_x1_aud_px1 {
                                nvidia,pins = "gpio_x1_aud_px1";
                                nvidia,function = "rsvd4";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        gpio_x3_aud_px3 {
                                nvidia,pins = "gpio_x3_aud_px3";
                                nvidia,function = "rsvd4";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        dap3_fs_pp0 {
                                nvidia,pins = "dap3_fs_pp0";
                                nvidia,function = "i2s2";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        dap3_dout_pp2 {
                                nvidia,pins = "dap3_dout_pp2";
                                nvidia,function = "i2s2";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        pv1 {
                                nvidia,pins = "pv1";
                                nvidia,function = "rsvd1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        pbb3 {
                                nvidia,pins = "pbb3",
                                                "pbb6",
                                                "pbb7";
                                nvidia,function = "rsvd4";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        pcc1 {
                                nvidia,pins = "pcc1",
                                                "pcc2";
                                nvidia,function = "rsvd4";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        gmi_ad0_pg0 {
                                nvidia,pins = "gmi_ad0_pg0",
                                                "gmi_ad1_pg1";
                                nvidia,function = "gmi";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        gmi_ad10_ph2 {
                                nvidia,pins = "gmi_ad10_ph2",
                                                "gmi_ad8_ph0",
                                                "gmi_clk_pk1";
                                nvidia,function = "gmi";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        gmi_ad2_pg2 {
                                nvidia,pins = "gmi_ad2_pg2",
                                                "gmi_ad3_pg3";
                                nvidia,function = "gmi";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        gmi_adv_n_pk0 {
                                nvidia,pins = "gmi_adv_n_pk0",
                                                "gmi_iordy_pi5",
                                                "gmi_wp_n_pc7";
                                nvidia,function = "gmi";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        gmi_cs3_n_pk4 {
                                nvidia,pins = "gmi_cs3_n_pk4";
                                nvidia,function = "gmi";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        clk2_req_pcc5 {
                                nvidia,pins = "clk2_req_pcc5";
                                nvidia,function = "rsvd4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        kb_col3_pq3 {
                                nvidia,pins = "kb_col3_pq3",
                                                "kb_col6_pq6",
                                                "kb_col7_pq7";
                                nvidia,function = "kbc";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        kb_col5_pq5 {
                                nvidia,pins = "kb_col5_pq5";
                                nvidia,function = "kbc";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        kb_row3_pr3 {
                                nvidia,pins = "kb_row3_pr3",
                                                "kb_row6_pr6",
                                                "kb_row8_ps0";
                                nvidia,function = "kbc";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        clk3_req_pee1 {
                                nvidia,pins = "clk3_req_pee1";
                                nvidia,function = "rsvd4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        pu4 {
                                nvidia,pins = "pu4";
                                nvidia,function = "displayb";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
                        pu5 {
                                nvidia,pins = "pu5",
                                                "pu6";
                                nvidia,function = "displayb";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        hdmi_int_pn7 {
                                nvidia,pins = "hdmi_int_pn7";
                                nvidia,function = "rsvd1";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
-                               nvidia,enable-input = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                        };
                        clk1_req_pee2 {
                                nvidia,pins = "clk1_req_pee2",
                                                "usb_vbus_en1_pn5";
                                nvidia,function = "rsvd4";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <1>;
-                               nvidia,enable-input = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                        };
 
                        drive_sdio1 {
                                nvidia,pins = "drive_sdio1";
-                               nvidia,high-speed-mode = <1>;
-                               nvidia,schmitt = <0>;
-                               nvidia,low-power-mode = <3>;
+                               nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
+                               nvidia,schmitt = <TEGRA_PIN_DISABLE>;
+                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
                                nvidia,pull-down-strength = <36>;
                                nvidia,pull-up-strength = <20>;
-                               nvidia,slew-rate-rising = <2>;
-                               nvidia,slew-rate-falling = <2>;
+                               nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_SLOW>;
+                               nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_SLOW>;
                        };
                        drive_sdio3 {
                                nvidia,pins = "drive_sdio3";
-                               nvidia,high-speed-mode = <1>;
-                               nvidia,schmitt = <0>;
-                               nvidia,low-power-mode = <3>;
+                               nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
+                               nvidia,schmitt = <TEGRA_PIN_DISABLE>;
+                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
                                nvidia,pull-down-strength = <22>;
                                nvidia,pull-up-strength = <36>;
-                               nvidia,slew-rate-rising = <0>;
-                               nvidia,slew-rate-falling = <0>;
+                               nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
+                               nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
                        };
                        drive_gma {
                                nvidia,pins = "drive_gma";
-                               nvidia,high-speed-mode = <1>;
-                               nvidia,schmitt = <0>;
-                               nvidia,low-power-mode = <3>;
+                               nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
+                               nvidia,schmitt = <TEGRA_PIN_DISABLE>;
+                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
                                nvidia,pull-down-strength = <2>;
                                nvidia,pull-up-strength = <1>;
-                               nvidia,slew-rate-rising = <0>;
-                               nvidia,slew-rate-falling = <0>;
+                               nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
+                               nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
                                nvidia,drive-type = <1>;
                        };
                };
                status = "okay";
        };
 
+       pwm@7000a000 {
+               status = "okay";
+       };
+
        i2c@7000c000 {
                status = "okay";
                clock-frequency = <100000>;
 
-               battery: smart-battery {
+               battery: smart-battery@b {
                        compatible = "ti,bq20z45", "sbs,sbs-battery";
                        reg = <0xb>;
                        battery-name = "battery";
                        power-supplies = <&charger>;
                };
 
-               rt5640: rt5640 {
+               rt5640: rt5640@1c {
                        compatible = "realtek,rt5640";
                        reg = <0x1c>;
                        interrupt-parent = <&gpio>;
                };
        };
 
+       hdmi_ddc: i2c@7000c700 {
+               status = "okay";
+       };
+
        i2c@7000d000 {
                status = "okay";
                clock-frequency = <400000>;
 
-               tps51632 {
+               tps51632@43 {
                        compatible = "ti,tps51632";
                        reg = <0x43>;
                        regulator-name = "vdd-cpu";
                        regulator-always-on;
                };
 
-               tps65090 {
+               tps65090@48 {
                        compatible = "ti,tps65090";
                        reg = <0x48>;
                        interrupt-parent = <&gpio>;
                                        regulator-boot-on;
                                };
 
-                               fet1 {
+                               vdd_bl_reg: fet1 {
                                        regulator-name = "vdd-lcd-bl";
                                };
 
                                        regulator-name = "vdd-modem-3v3";
                                };
 
-                               fet4 {
+                               avdd_lcd_reg: fet4 {
                                        regulator-name = "avdd-lcd";
                                };
 
                        };
                };
 
-               palmas: tps65913 {
+               palmas: tps65913@58 {
                        compatible = "ti,palmas";
                        reg = <0x58>;
                        interrupts = <0 86 IRQ_TYPE_LEVEL_LOW>;
                };
        };
 
-       pmc {
+       pmc@7000e400 {
                nvidia,invert-interrupt;
                nvidia,suspend-mode = <1>;
                nvidia,cpu-pwr-good-time = <500>;
                nvidia,sys-clock-req-active-high;
        };
 
-       ahub {
+       ahub@70080000 {
                i2s@70080400 {
                        status = "okay";
                };
                vbus-supply = <&usb3_vbus_reg>;
        };
 
+       backlight: backlight {
+               compatible = "pwm-backlight";
+
+               enable-gpios = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_HIGH>;
+               power-supply = <&vdd_bl_reg>;
+               pwms = <&pwm 1 1000000>;
+
+               brightness-levels = <0 4 8 16 32 64 128 255>;
+               default-brightness-level = <6>;
+       };
+
        clocks {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <0>;
 
-               clk32k_in: clock {
+               clk32k_in: clock@0 {
                        compatible = "fixed-clock";
                        reg=<0>;
                        #clock-cells = <0>;
                        gpio = <&gpio TEGRA_GPIO(H, 5) GPIO_ACTIVE_HIGH>;
                };
 
-               lcd_bl_en_reg: regulator@2 {
-                       compatible = "regulator-fixed";
-                       reg = <2>;
-                       regulator-name = "lcd_bl_en";
-                       regulator-min-microvolt = <5000000>;
-                       regulator-max-microvolt = <5000000>;
-                       enable-active-high;
-                       gpio = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_HIGH>;
-               };
-
                usb1_vbus_reg: regulator@3 {
                        compatible = "regulator-fixed";
                        reg = <3>;
index 8d42787c8ff172a0b8594899b8ef92dd08d2be10..389e987ec2819e31725329102f84d6f3cecbb5cd 100644 (file)
@@ -1,5 +1,6 @@
 #include <dt-bindings/clock/tegra114-car.h>
 #include <dt-bindings/gpio/tegra-gpio.h>
+#include <dt-bindings/pinctrl/pinctrl-tegra.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
 #include "skeleton.dtsi"
                serial3 = &uartd;
        };
 
-       gic: interrupt-controller {
+       host1x@50000000 {
+               compatible = "nvidia,tegra114-host1x", "simple-bus";
+               reg = <0x50000000 0x00028000>;
+               interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */
+                            <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */
+               clocks = <&tegra_car TEGRA114_CLK_HOST1X>;
+               resets = <&tegra_car 28>;
+               reset-names = "host1x";
+
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               ranges = <0x54000000 0x54000000 0x01000000>;
+
+               gr2d@54140000 {
+                       compatible = "nvidia,tegra114-gr2d", "nvidia,tegra20-gr2d";
+                       reg = <0x54140000 0x00040000>;
+                       interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&tegra_car TEGRA114_CLK_GR2D>;
+                       resets = <&tegra_car 21>;
+                       reset-names = "2d";
+               };
+
+               gr3d@54180000 {
+                       compatible = "nvidia,tegra114-gr3d", "nvidia,tegra20-gr3d";
+                       reg = <0x54180000 0x00040000>;
+                       clocks = <&tegra_car TEGRA114_CLK_GR3D>;
+                       resets = <&tegra_car 24>;
+                       reset-names = "3d";
+               };
+
+               dc@54200000 {
+                       compatible = "nvidia,tegra114-dc", "nvidia,tegra20-dc";
+                       reg = <0x54200000 0x00040000>;
+                       interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&tegra_car TEGRA114_CLK_DISP1>,
+                                <&tegra_car TEGRA114_CLK_PLL_P>;
+                       clock-names = "dc", "parent";
+                       resets = <&tegra_car 27>;
+                       reset-names = "dc";
+
+                       rgb {
+                               status = "disabled";
+                       };
+               };
+
+               dc@54240000 {
+                       compatible = "nvidia,tegra114-dc", "nvidia,tegra20-dc";
+                       reg = <0x54240000 0x00040000>;
+                       interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&tegra_car TEGRA114_CLK_DISP2>,
+                                <&tegra_car TEGRA114_CLK_PLL_P>;
+                       clock-names = "dc", "parent";
+                       resets = <&tegra_car 26>;
+                       reset-names = "dc";
+
+                       rgb {
+                               status = "disabled";
+                       };
+               };
+
+               hdmi@54280000 {
+                       compatible = "nvidia,tegra114-hdmi";
+                       reg = <0x54280000 0x00040000>;
+                       interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&tegra_car TEGRA114_CLK_HDMI>,
+                                <&tegra_car TEGRA114_CLK_PLL_D2_OUT0>;
+                       clock-names = "hdmi", "parent";
+                       resets = <&tegra_car 51>;
+                       reset-names = "hdmi";
+                       status = "disabled";
+               };
+
+               dsi@54300000 {
+                       compatible = "nvidia,tegra114-dsi";
+                       reg = <0x54300000 0x00040000>;
+                       clocks = <&tegra_car TEGRA114_CLK_DSIA>,
+                                <&tegra_car TEGRA114_CLK_DSIALP>,
+                                <&tegra_car TEGRA114_CLK_PLL_D_OUT0>;
+                       clock-names = "dsi", "lp", "parent";
+                       resets = <&tegra_car 48>;
+                       reset-names = "dsi";
+                       nvidia,mipi-calibrate = <&mipi 0x060>; /* DSIA & DSIB pads */
+                       status = "disabled";
+
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               dsi@54400000 {
+                       compatible = "nvidia,tegra114-dsi";
+                       reg = <0x54400000 0x00040000>;
+                       clocks = <&tegra_car TEGRA114_CLK_DSIB>,
+                                <&tegra_car TEGRA114_CLK_DSIBLP>,
+                                <&tegra_car TEGRA114_CLK_PLL_D2_OUT0>;
+                       clock-names = "dsi", "lp", "parent";
+                       resets = <&tegra_car 82>;
+                       reset-names = "dsi";
+                       nvidia,mipi-calibrate = <&mipi 0x180>; /* DSIC & DSID pads */
+                       status = "disabled";
+
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+       };
+
+       gic: interrupt-controller@50041000 {
                compatible = "arm,cortex-a15-gic";
                #interrupt-cells = <3>;
                interrupt-controller;
                clocks = <&tegra_car TEGRA114_CLK_TIMER>;
        };
 
-       tegra_car: clock {
+       tegra_car: clock@60006000 {
                compatible = "nvidia,tegra114-car";
                reg = <0x60006000 0x1000>;
                #clock-cells = <1>;
+               #reset-cells = <1>;
        };
 
-       apbdma: dma {
+       apbdma: dma@6000a000 {
                compatible = "nvidia,tegra114-apbdma";
                reg = <0x6000a000 0x1400>;
                interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA114_CLK_APBDMA>;
+               resets = <&tegra_car 34>;
+               reset-names = "dma";
+               #dma-cells = <1>;
        };
 
-       ahb: ahb {
+       ahb: ahb@6000c004 {
                compatible = "nvidia,tegra114-ahb", "nvidia,tegra30-ahb";
                reg = <0x6000c004 0x14c>;
        };
 
-       gpio: gpio {
+       gpio: gpio@6000d000 {
                compatible = "nvidia,tegra114-gpio", "nvidia,tegra30-gpio";
                reg = <0x6000d000 0x1000>;
                interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
                interrupt-controller;
        };
 
-       pinmux: pinmux {
+       pinmux: pinmux@70000868 {
                compatible = "nvidia,tegra114-pinmux";
                reg = <0x70000868 0x148         /* Pad control registers */
                       0x70003000 0x40c>;       /* Mux registers */
                reg = <0x70006000 0x40>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 8>;
-               status = "disabled";
                clocks = <&tegra_car TEGRA114_CLK_UARTA>;
+               resets = <&tegra_car 6>;
+               reset-names = "serial";
+               dmas = <&apbdma 8>, <&apbdma 8>;
+               dma-names = "rx", "tx";
+               status = "disabled";
        };
 
        uartb: serial@70006040 {
                reg = <0x70006040 0x40>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 9>;
-               status = "disabled";
                clocks = <&tegra_car TEGRA114_CLK_UARTB>;
+               resets = <&tegra_car 7>;
+               reset-names = "serial";
+               dmas = <&apbdma 9>, <&apbdma 9>;
+               dma-names = "rx", "tx";
+               status = "disabled";
        };
 
        uartc: serial@70006200 {
                reg = <0x70006200 0x100>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 10>;
-               status = "disabled";
                clocks = <&tegra_car TEGRA114_CLK_UARTC>;
+               resets = <&tegra_car 55>;
+               reset-names = "serial";
+               dmas = <&apbdma 10>, <&apbdma 10>;
+               dma-names = "rx", "tx";
+               status = "disabled";
        };
 
        uartd: serial@70006300 {
                reg = <0x70006300 0x100>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 19>;
-               status = "disabled";
                clocks = <&tegra_car TEGRA114_CLK_UARTD>;
+               resets = <&tegra_car 65>;
+               reset-names = "serial";
+               dmas = <&apbdma 19>, <&apbdma 19>;
+               dma-names = "rx", "tx";
+               status = "disabled";
        };
 
-       pwm: pwm {
+       pwm: pwm@7000a000 {
                compatible = "nvidia,tegra114-pwm", "nvidia,tegra20-pwm";
                reg = <0x7000a000 0x100>;
                #pwm-cells = <2>;
                clocks = <&tegra_car TEGRA114_CLK_PWM>;
+               resets = <&tegra_car 17>;
+               reset-names = "pwm";
                status = "disabled";
        };
 
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA114_CLK_I2C1>;
                clock-names = "div-clk";
+               resets = <&tegra_car 12>;
+               reset-names = "i2c";
+               dmas = <&apbdma 21>, <&apbdma 21>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA114_CLK_I2C2>;
                clock-names = "div-clk";
+               resets = <&tegra_car 54>;
+               reset-names = "i2c";
+               dmas = <&apbdma 22>, <&apbdma 22>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA114_CLK_I2C3>;
                clock-names = "div-clk";
+               resets = <&tegra_car 67>;
+               reset-names = "i2c";
+               dmas = <&apbdma 23>, <&apbdma 23>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA114_CLK_I2C4>;
                clock-names = "div-clk";
+               resets = <&tegra_car 103>;
+               reset-names = "i2c";
+               dmas = <&apbdma 26>, <&apbdma 26>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA114_CLK_I2C5>;
                clock-names = "div-clk";
+               resets = <&tegra_car 47>;
+               reset-names = "i2c";
+               dmas = <&apbdma 24>, <&apbdma 24>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra114-spi";
                reg = <0x7000d400 0x200>;
                interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 15>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA114_CLK_SBC1>;
                clock-names = "spi";
+               resets = <&tegra_car 41>;
+               reset-names = "spi";
+               dmas = <&apbdma 15>, <&apbdma 15>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra114-spi";
                reg = <0x7000d600 0x200>;
                interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 16>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA114_CLK_SBC2>;
                clock-names = "spi";
+               resets = <&tegra_car 44>;
+               reset-names = "spi";
+               dmas = <&apbdma 16>, <&apbdma 16>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra114-spi";
                reg = <0x7000d800 0x200>;
                interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 17>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA114_CLK_SBC3>;
                clock-names = "spi";
+               resets = <&tegra_car 46>;
+               reset-names = "spi";
+               dmas = <&apbdma 17>, <&apbdma 17>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra114-spi";
                reg = <0x7000da00 0x200>;
                interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 18>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA114_CLK_SBC4>;
                clock-names = "spi";
+               resets = <&tegra_car 68>;
+               reset-names = "spi";
+               dmas = <&apbdma 18>, <&apbdma 18>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra114-spi";
                reg = <0x7000dc00 0x200>;
                interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 27>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA114_CLK_SBC5>;
                clock-names = "spi";
+               resets = <&tegra_car 104>;
+               reset-names = "spi";
+               dmas = <&apbdma 27>, <&apbdma 27>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra114-spi";
                reg = <0x7000de00 0x200>;
                interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 28>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA114_CLK_SBC6>;
                clock-names = "spi";
+               resets = <&tegra_car 105>;
+               reset-names = "spi";
+               dmas = <&apbdma 28>, <&apbdma 28>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
-       rtc {
+       rtc@7000e000 {
                compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc";
                reg = <0x7000e000 0x100>;
                interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA114_CLK_RTC>;
        };
 
-       kbc {
+       kbc@7000e200 {
                compatible = "nvidia,tegra114-kbc";
                reg = <0x7000e200 0x100>;
                interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA114_CLK_KBC>;
+               resets = <&tegra_car 36>;
+               reset-names = "kbc";
                status = "disabled";
        };
 
-       pmc {
+       pmc@7000e400 {
                compatible = "nvidia,tegra114-pmc";
                reg = <0x7000e400 0x400>;
                clocks = <&tegra_car TEGRA114_CLK_PCLK>, <&clk32k_in>;
                clock-names = "pclk", "clk32k_in";
        };
 
-       iommu {
+       iommu@70019010 {
                compatible = "nvidia,tegra114-smmu", "nvidia,tegra30-smmu";
                reg = <0x70019010 0x02c
                       0x700191f0 0x010
                nvidia,ahb = <&ahb>;
        };
 
-       ahub {
+       ahub@70080000 {
                compatible = "nvidia,tegra114-ahub";
                reg = <0x70080000 0x200>,
                      <0x70080200 0x100>,
                      <0x70081000 0x200>;
                interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 1>, <&apbdma 2>,
-                       <&apbdma 3>, <&apbdma 4>, <&apbdma 6>, <&apbdma 7>,
-                       <&apbdma 12>, <&apbdma 13>, <&apbdma 14>,
-                       <&apbdma 29>;
                clocks = <&tegra_car TEGRA114_CLK_D_AUDIO>,
-                        <&tegra_car TEGRA114_CLK_APBIF>,
-                        <&tegra_car TEGRA114_CLK_I2S0>,
-                        <&tegra_car TEGRA114_CLK_I2S1>,
-                        <&tegra_car TEGRA114_CLK_I2S2>,
-                        <&tegra_car TEGRA114_CLK_I2S3>,
-                        <&tegra_car TEGRA114_CLK_I2S4>,
-                        <&tegra_car TEGRA114_CLK_DAM0>,
-                        <&tegra_car TEGRA114_CLK_DAM1>,
-                        <&tegra_car TEGRA114_CLK_DAM2>,
-                        <&tegra_car TEGRA114_CLK_SPDIF_IN>,
-                        <&tegra_car TEGRA114_CLK_AMX>,
-                        <&tegra_car TEGRA114_CLK_ADX>;
-               clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
+                        <&tegra_car TEGRA114_CLK_APBIF>;
+               clock-names = "d_audio", "apbif";
+               resets = <&tegra_car 106>, /* d_audio */
+                        <&tegra_car 107>, /* apbif */
+                        <&tegra_car 30>,  /* i2s0 */
+                        <&tegra_car 11>,  /* i2s1 */
+                        <&tegra_car 18>,  /* i2s2 */
+                        <&tegra_car 101>, /* i2s3 */
+                        <&tegra_car 102>, /* i2s4 */
+                        <&tegra_car 108>, /* dam0 */
+                        <&tegra_car 109>, /* dam1 */
+                        <&tegra_car 110>, /* dam2 */
+                        <&tegra_car 10>,  /* spdif */
+                        <&tegra_car 153>, /* amx */
+                        <&tegra_car 154>; /* adx */
+               reset-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
                              "i2s3", "i2s4", "dam0", "dam1", "dam2",
-                             "spdif_in", "amx", "adx";
+                             "spdif", "amx", "adx";
+               dmas = <&apbdma 1>, <&apbdma 1>,
+                      <&apbdma 2>, <&apbdma 2>,
+                      <&apbdma 3>, <&apbdma 3>,
+                      <&apbdma 4>, <&apbdma 4>,
+                      <&apbdma 6>, <&apbdma 6>,
+                      <&apbdma 7>, <&apbdma 7>,
+                      <&apbdma 12>, <&apbdma 12>,
+                      <&apbdma 13>, <&apbdma 13>,
+                      <&apbdma 14>, <&apbdma 14>,
+                      <&apbdma 29>, <&apbdma 29>;
+               dma-names = "rx0", "tx0", "rx1", "tx1", "rx2", "tx2",
+                           "rx3", "tx3", "rx4", "tx4", "rx5", "tx5",
+                           "rx6", "tx6", "rx7", "tx7", "rx8", "tx8",
+                           "rx9", "tx9";
                ranges;
                #address-cells = <1>;
                #size-cells = <1>;
                        reg = <0x70080300 0x100>;
                        nvidia,ahub-cif-ids = <4 4>;
                        clocks = <&tegra_car TEGRA114_CLK_I2S0>;
+                       resets = <&tegra_car 30>;
+                       reset-names = "i2s";
                        status = "disabled";
                };
 
                        reg = <0x70080400 0x100>;
                        nvidia,ahub-cif-ids = <5 5>;
                        clocks = <&tegra_car TEGRA114_CLK_I2S1>;
+                       resets = <&tegra_car 11>;
+                       reset-names = "i2s";
                        status = "disabled";
                };
 
                        reg = <0x70080500 0x100>;
                        nvidia,ahub-cif-ids = <6 6>;
                        clocks = <&tegra_car TEGRA114_CLK_I2S2>;
+                       resets = <&tegra_car 18>;
+                       reset-names = "i2s";
                        status = "disabled";
                };
 
                        reg = <0x70080600 0x100>;
                        nvidia,ahub-cif-ids = <7 7>;
                        clocks = <&tegra_car TEGRA114_CLK_I2S3>;
+                       resets = <&tegra_car 101>;
+                       reset-names = "i2s";
                        status = "disabled";
                };
 
                        reg = <0x70080700 0x100>;
                        nvidia,ahub-cif-ids = <8 8>;
                        clocks = <&tegra_car TEGRA114_CLK_I2S4>;
+                       resets = <&tegra_car 102>;
+                       reset-names = "i2s";
                        status = "disabled";
                };
        };
 
+       mipi: mipi@700e3000 {
+               compatible = "nvidia,tegra114-mipi";
+               reg = <0x700e3000 0x100>;
+               clocks = <&tegra_car TEGRA114_CLK_MIPI_CAL>;
+               #nvidia,mipi-calibrate-cells = <1>;
+       };
+
        sdhci@78000000 {
                compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci";
                reg = <0x78000000 0x200>;
                interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA114_CLK_SDMMC1>;
+               resets = <&tegra_car 14>;
+               reset-names = "sdhci";
                status = "disable";
        };
 
                reg = <0x78000200 0x200>;
                interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA114_CLK_SDMMC2>;
+               resets = <&tegra_car 9>;
+               reset-names = "sdhci";
                status = "disable";
        };
 
                reg = <0x78000400 0x200>;
                interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA114_CLK_SDMMC3>;
+               resets = <&tegra_car 69>;
+               reset-names = "sdhci";
                status = "disable";
        };
 
                reg = <0x78000600 0x200>;
                interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA114_CLK_SDMMC4>;
+               resets = <&tegra_car 15>;
+               reset-names = "sdhci";
                status = "disable";
        };
 
                interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
                phy_type = "utmi";
                clocks = <&tegra_car TEGRA114_CLK_USBD>;
+               resets = <&tegra_car 22>;
+               reset-names = "usb";
                nvidia,phy = <&phy1>;
                status = "disabled";
        };
                interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
                phy_type = "utmi";
                clocks = <&tegra_car TEGRA114_CLK_USB3>;
+               resets = <&tegra_car 59>;
+               reset-names = "usb";
                nvidia,phy = <&phy3>;
                status = "disabled";
        };
index 431d67a2b413bc5569ddd5f23850248fda424262..c6dcef513e5d0bc34cee9ede445364356cf130ba 100644 (file)
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
 #include "tegra124.dtsi"
 
 / {
        model = "NVIDIA Tegra124 Venice2";
        compatible = "nvidia,venice2", "nvidia,tegra124";
 
+       aliases {
+               rtc0 = "/i2c@7000d000/as3722@40";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x80000000 0x80000000>;
        };
 
+       pinmux: pinmux@70000868 {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinmux_default>;
+
+               pinmux_default: common {
+                       dap_mclk1_pw4 {
+                               nvidia,pins = "dap_mclk1_pw4";
+                               nvidia,function = "extperiph1";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       dap1_din_pn1 {
+                               nvidia,pins = "dap1_din_pn1";
+                               nvidia,function = "i2s0";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                       };
+                       dap1_dout_pn2 {
+                               nvidia,pins = "dap1_dout_pn2",
+                                             "dap1_fs_pn0",
+                                             "dap1_sclk_pn3";
+                               nvidia,function = "i2s0";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                       };
+                       dap2_din_pa4 {
+                               nvidia,pins = "dap2_din_pa4";
+                               nvidia,function = "i2s1";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       dap2_dout_pa5 {
+                               nvidia,pins = "dap2_dout_pa5",
+                                             "dap2_fs_pa2",
+                                             "dap2_sclk_pa3";
+                               nvidia,function = "i2s1";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       dvfs_pwm_px0 {
+                               nvidia,pins = "dvfs_pwm_px0",
+                                             "dvfs_clk_px2";
+                               nvidia,function = "cldvfs";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       ulpi_clk_py0 {
+                               nvidia,pins = "ulpi_clk_py0",
+                                             "ulpi_nxt_py2",
+                                             "ulpi_stp_py3";
+                               nvidia,function = "spi1";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       ulpi_dir_py1 {
+                               nvidia,pins = "ulpi_dir_py1";
+                               nvidia,function = "spi1";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       cam_i2c_scl_pbb1 {
+                               nvidia,pins = "cam_i2c_scl_pbb1",
+                                             "cam_i2c_sda_pbb2";
+                               nvidia,function = "i2c3";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_ENABLE>;
+                       };
+                       gen2_i2c_scl_pt5 {
+                               nvidia,pins = "gen2_i2c_scl_pt5",
+                                             "gen2_i2c_sda_pt6";
+                               nvidia,function = "i2c2";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_ENABLE>;
+                       };
+                       pg4 {
+                               nvidia,pins = "pg4",
+                                             "pg5",
+                                             "pg6",
+                                             "pi3";
+                               nvidia,function = "spi4";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       pg7 {
+                               nvidia,pins = "pg7";
+                               nvidia,function = "spi4";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       ph1 {
+                               nvidia,pins = "ph1";
+                               nvidia,function = "pwm1";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       pk0 {
+                               nvidia,pins = "pk0",
+                                             "kb_row15_ps7",
+                                             "clk_32k_out_pa0";
+                               nvidia,function = "soc";
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       sdmmc1_clk_pz0 {
+                               nvidia,pins = "sdmmc1_clk_pz0",
+                                             "sdmmc1_cmd_pz1",
+                                             "sdmmc1_dat0_py7",
+                                             "sdmmc1_dat1_py6",
+                                             "sdmmc1_dat2_py5",
+                                             "sdmmc1_dat3_py4";
+                               nvidia,function = "sdmmc1";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       sdmmc1_cmd_pz1 {
+                               nvidia,pins = "sdmmc1_cmd_pz1",
+                                             "sdmmc1_dat0_py7",
+                                             "sdmmc1_dat1_py6",
+                                             "sdmmc1_dat2_py5",
+                                             "sdmmc1_dat3_py4";
+                               nvidia,function = "sdmmc1";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       sdmmc3_clk_pa6 {
+                               nvidia,pins = "sdmmc3_clk_pa6";
+                               nvidia,function = "sdmmc3";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       sdmmc3_cmd_pa7 {
+                               nvidia,pins = "sdmmc3_cmd_pa7",
+                                             "sdmmc3_dat0_pb7",
+                                             "sdmmc3_dat1_pb6",
+                                             "sdmmc3_dat2_pb5",
+                                             "sdmmc3_dat3_pb4",
+                                             "sdmmc3_clk_lb_out_pee4",
+                                             "sdmmc3_clk_lb_in_pee5";
+                               nvidia,function = "sdmmc3";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       sdmmc4_clk_pcc4 {
+                               nvidia,pins = "sdmmc4_clk_pcc4";
+                               nvidia,function = "sdmmc4";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       sdmmc4_cmd_pt7 {
+                               nvidia,pins = "sdmmc4_cmd_pt7",
+                                             "sdmmc4_dat0_paa0",
+                                             "sdmmc4_dat1_paa1",
+                                             "sdmmc4_dat2_paa2",
+                                             "sdmmc4_dat3_paa3",
+                                             "sdmmc4_dat4_paa4",
+                                             "sdmmc4_dat5_paa5",
+                                             "sdmmc4_dat6_paa6",
+                                             "sdmmc4_dat7_paa7";
+                               nvidia,function = "sdmmc4";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       pwr_i2c_scl_pz6 {
+                               nvidia,pins = "pwr_i2c_scl_pz6",
+                                             "pwr_i2c_sda_pz7";
+                               nvidia,function = "i2cpwr";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_ENABLE>;
+                       };
+                       jtag_rtck {
+                               nvidia,pins = "jtag_rtck";
+                               nvidia,function = "rtck";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       clk_32k_in {
+                               nvidia,pins = "clk_32k_in";
+                               nvidia,function = "clk";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       core_pwr_req {
+                               nvidia,pins = "core_pwr_req";
+                               nvidia,function = "pwron";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       cpu_pwr_req {
+                               nvidia,pins = "cpu_pwr_req";
+                               nvidia,function = "cpu";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       pwr_int_n {
+                               nvidia,pins = "pwr_int_n";
+                               nvidia,function = "pmi";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       reset_out_n {
+                               nvidia,pins = "reset_out_n";
+                               nvidia,function = "reset_out_n";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       clk3_out_pee0 {
+                               nvidia,pins = "clk3_out_pee0";
+                               nvidia,function = "extperiph3";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       dap4_din_pp5 {
+                               nvidia,pins = "dap4_din_pp5";
+                               nvidia,function = "i2s3";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                       };
+                       dap4_dout_pp6 {
+                               nvidia,pins = "dap4_dout_pp6",
+                                             "dap4_fs_pp4",
+                                             "dap4_sclk_pp7";
+                               nvidia,function = "i2s3";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                       };
+                       gen1_i2c_sda_pc5 {
+                               nvidia,pins = "gen1_i2c_sda_pc5",
+                                             "gen1_i2c_scl_pc4";
+                               nvidia,function = "i2c1";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_ENABLE>;
+                       };
+                       uart2_cts_n_pj5 {
+                               nvidia,pins = "uart2_cts_n_pj5";
+                               nvidia,function = "uartb";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       uart2_rts_n_pj6 {
+                               nvidia,pins = "uart2_rts_n_pj6";
+                               nvidia,function = "uartb";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       uart2_rxd_pc3 {
+                               nvidia,pins = "uart2_rxd_pc3";
+                               nvidia,function = "irda";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       uart2_txd_pc2 {
+                               nvidia,pins = "uart2_txd_pc2";
+                               nvidia,function = "irda";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       uart3_cts_n_pa1 {
+                               nvidia,pins = "uart3_cts_n_pa1",
+                                             "uart3_rxd_pw7";
+                               nvidia,function = "uartc";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       uart3_rts_n_pc0 {
+                               nvidia,pins = "uart3_rts_n_pc0",
+                                             "uart3_txd_pw6";
+                               nvidia,function = "uartc";
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       hdmi_cec_pee3 {
+                               nvidia,pins = "hdmi_cec_pee3";
+                               nvidia,function = "cec";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_DISABLE>;
+                       };
+                       hdmi_int_pn7 {
+                               nvidia,pins = "hdmi_int_pn7";
+                               nvidia,function = "rsvd1";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                       };
+                       ddc_scl_pv4 {
+                               nvidia,pins = "ddc_scl_pv4",
+                                             "ddc_sda_pv5";
+                               nvidia,function = "i2c4";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,rcv-sel = <TEGRA_PIN_ENABLE>;
+                       };
+                       pj7 {
+                               nvidia,pins = "pj7",
+                                             "pk7";
+                               nvidia,function = "uartd";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                       };
+                       pb0 {
+                               nvidia,pins = "pb0",
+                                             "pb1";
+                               nvidia,function = "uartd";
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       ph0 {
+                               nvidia,pins = "ph0";
+                               nvidia,function = "pwm0";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                       };
+                       kb_row10_ps2 {
+                               nvidia,pins = "kb_row10_ps2";
+                               nvidia,function = "uarta";
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       kb_row9_ps1 {
+                               nvidia,pins = "kb_row9_ps1";
+                               nvidia,function = "uarta";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                       };
+                       kb_row6_pr6 {
+                               nvidia,pins = "kb_row6_pr6";
+                               nvidia,function = "displaya_alt";
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       usb_vbus_en0_pn4 {
+                               nvidia,pins = "usb_vbus_en0_pn4";
+                               nvidia,function = "usb";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_ENABLE>;
+                       };
+                       usb_vbus_en1_pn5 {
+                               nvidia,pins = "usb_vbus_en1_pn5";
+                               nvidia,function = "usb";
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,lock = <TEGRA_PIN_DISABLE>;
+                               nvidia,open-drain = <TEGRA_PIN_ENABLE>;
+                       };
+                       drive_sdio1 {
+                               nvidia,pins = "drive_sdio1";
+                               nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
+                               nvidia,schmitt = <TEGRA_PIN_DISABLE>;
+                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
+                               nvidia,pull-down-strength = <32>;
+                               nvidia,pull-up-strength = <42>;
+                               nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
+                               nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
+                       };
+                       drive_sdio3 {
+                               nvidia,pins = "drive_sdio3";
+                               nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
+                               nvidia,schmitt = <TEGRA_PIN_DISABLE>;
+                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
+                               nvidia,pull-down-strength = <20>;
+                               nvidia,pull-up-strength = <36>;
+                               nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
+                               nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
+                       };
+                       drive_gma {
+                               nvidia,pins = "drive_gma";
+                               nvidia,high-speed-mode = <TEGRA_PIN_ENABLE>;
+                               nvidia,schmitt = <TEGRA_PIN_DISABLE>;
+                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
+                               nvidia,pull-down-strength = <1>;
+                               nvidia,pull-up-strength = <2>;
+                               nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
+                               nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
+                               nvidia,drive-type = <1>;
+                       };
+                       als_irq_l {
+                               nvidia,pins = "gpio_x3_aud_px3";
+                               nvidia,function = "gmi";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       codec_irq_l {
+                               nvidia,pins = "ph4";
+                               nvidia,function = "gmi";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       lcd_bl_en {
+                               nvidia,pins = "ph2";
+                               nvidia,function = "gmi";
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                       };
+                       touch_irq_l {
+                               nvidia,pins = "gpio_w3_aud_pw3";
+                               nvidia,function = "spi6";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       tpm_davint_l {
+                               nvidia,pins = "ph6";
+                               nvidia,function = "gmi";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       ts_irq_l {
+                               nvidia,pins = "pk2";
+                               nvidia,function = "gmi";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       ts_reset_l {
+                               nvidia,pins = "pk4";
+                               nvidia,function = "gmi";
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                       };
+                       ts_shdn_l {
+                               nvidia,pins = "pk1";
+                               nvidia,function = "gmi";
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                       };
+                       ph7 {
+                               nvidia,pins = "ph7";
+                               nvidia,function = "gmi";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       kb_col0_ap {
+                               nvidia,pins = "kb_col0_pq0";
+                               nvidia,function = "rsvd4";
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       lid_open {
+                               nvidia,pins = "kb_row4_pr4";
+                               nvidia,function = "rsvd3";
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       en_vdd_sd {
+                               nvidia,pins = "kb_row0_pr0";
+                               nvidia,function = "rsvd4";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                       };
+                       ac_ok {
+                               nvidia,pins = "pj0";
+                               nvidia,function = "gmi";
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       sensor_irq_l {
+                               nvidia,pins = "pi6";
+                               nvidia,function = "gmi";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       wifi_en {
+                               nvidia,pins = "gpio_x7_aud_px7";
+                               nvidia,function = "rsvd4";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                       };
+                       wifi_rst_l {
+                               nvidia,pins = "clk2_req_pcc5";
+                               nvidia,function = "dap";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+                       hp_det_l {
+                               nvidia,pins = "ulpi_data1_po2";
+                               nvidia,function = "spi3";
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+               };
+       };
+
        serial@70006000 {
                status = "okay";
        };
 
+       pwm: pwm@7000a000 {
+               status = "okay";
+       };
+
+       i2c@7000c000 {
+               status = "okay";
+               clock-frequency = <100000>;
+
+               acodec: audio-codec@10 {
+                       compatible = "maxim,max98090";
+                       reg = <0x10>;
+                       interrupt-parent = <&gpio>;
+                       interrupts = <TEGRA_GPIO(H, 4) GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       i2c@7000c400 {
+               status = "okay";
+               clock-frequency = <100000>;
+       };
+
+       i2c@7000c500 {
+               status = "okay";
+               clock-frequency = <100000>;
+       };
+
+       i2c@7000c700 {
+               status = "okay";
+               clock-frequency = <100000>;
+       };
+
+       i2c@7000d000 {
+               status = "okay";
+               clock-frequency = <400000>;
+
+               as3722: as3722@40 {
+                       compatible = "ams,as3722";
+                       reg = <0x40>;
+                       interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
+
+                       #interrupt-cells = <2>;
+                       interrupt-controller;
+
+                       gpio-controller;
+                       #gpio-cells = <2>;
+
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&as3722_default>;
+
+                       as3722_default: pinmux {
+                               gpio0 {
+                                       pins = "gpio0";
+                                       function = "gpio";
+                                       bias-pull-down;
+                               };
+
+                               gpio1_2_4_7 {
+                                       pins = "gpio1", "gpio2", "gpio4", "gpio7";
+                                       function = "gpio";
+                                       bias-pull-up;
+                               };
+
+                               gpio3_6 {
+                                       pins = "gpio3", "gpio6";
+                                       bias-high-impedance;
+                               };
+
+                               gpio5 {
+                                       pins = "gpio5";
+                                       function = "clk32k-out";
+                               };
+                       };
+
+                       regulators {
+                               vsup-sd2-supply = <&vdd_ac_bat_reg>;
+                               vsup-sd3-supply = <&vdd_ac_bat_reg>;
+                               vsup-sd4-supply = <&vdd_ac_bat_reg>;
+                               vsup-sd5-supply = <&vdd_ac_bat_reg>;
+                               vin-ldo0-supply = <&as3722_sd2>;
+                               vin-ldo1-6-supply = <&vdd_ac_bat_reg>;
+                               vin-ldo2-5-7-supply = <&as3722_sd5>;
+                               vin-ldo3-4-supply = <&vdd_ac_bat_reg>;
+                               vin-ldo9-10-supply = <&vdd_ac_bat_reg>;
+                               vin-ldo11-supply = <&vdd_ac_bat_reg>;
+
+                               sd0 {
+                                       regulator-name = "vdd-cpu";
+                                       regulator-min-microvolt = <700000>;
+                                       regulator-max-microvolt = <1400000>;
+                                       regulator-min-microamp = <3500000>;
+                                       regulator-max-microamp = <3500000>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+                                       ams,external-control = <2>;
+                               };
+
+                               sd1 {
+                                       regulator-name = "vdd-core";
+                                       regulator-min-microvolt = <700000>;
+                                       regulator-max-microvolt = <1350000>;
+                                       regulator-min-microamp = <2500000>;
+                                       regulator-max-microamp = <2500000>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+                                       ams,external-control = <1>;
+                               };
+
+                               as3722_sd2: sd2 {
+                                       regulator-name = "vddio-ddr";
+                                       regulator-min-microvolt = <1350000>;
+                                       regulator-max-microvolt = <1350000>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+                               };
+
+                               sd3 {
+                                       regulator-name = "vddio-ddr-2phase";
+                                       regulator-min-microvolt = <1350000>;
+                                       regulator-max-microvolt = <1350000>;
+                                       regulator-always-on;
+                                       regulator-boot-on;
+                               };
+
+                               sd4 {
+                                       regulator-name = "avdd-pex-sata";
+                                       regulator-min-microvolt = <1050000>;
+                                       regulator-max-microvolt = <1050000>;
+                                       regulator-boot-on;
+                                       regulator-always-on;
+                               };
+
+                               as3722_sd5: sd5 {
+                                       regulator-name = "vddio-sys";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <1800000>;
+                                       regulator-boot-on;
+                                       regulator-always-on;
+                               };
+
+                               sd6 {
+                                       regulator-name = "vdd-gpu";
+                                       regulator-min-microvolt = <650000>;
+                                       regulator-max-microvolt = <1200000>;
+                                       regulator-min-microamp = <3500000>;
+                                       regulator-max-microamp = <3500000>;
+                                       regulator-boot-on;
+                                       regulator-always-on;
+                               };
+
+                               ldo0 {
+                                       regulator-name = "avdd_pll";
+                                       regulator-min-microvolt = <1050000>;
+                                       regulator-max-microvolt = <1050000>;
+                                       regulator-boot-on;
+                                       regulator-always-on;
+                                       ams,external-control = <1>;
+                               };
+
+                               ldo1 {
+                                       regulator-name = "run-cam-1.8";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <1800000>;
+                               };
+
+                               ldo2 {
+                                       regulator-name = "gen-avdd,vddio-hsic";
+                                       regulator-min-microvolt = <1200000>;
+                                       regulator-max-microvolt = <1200000>;
+                                       regulator-boot-on;
+                                       regulator-always-on;
+                               };
+
+                               ldo3 {
+                                       regulator-name = "vdd-rtc";
+                                       regulator-min-microvolt = <1000000>;
+                                       regulator-max-microvolt = <1000000>;
+                                       regulator-boot-on;
+                                       regulator-always-on;
+                                       ams,enable-tracking;
+                               };
+
+                               ldo4 {
+                                       regulator-name = "vdd-cam";
+                                       regulator-min-microvolt = <2800000>;
+                                       regulator-max-microvolt = <2800000>;
+                                       regulator-boot-on;
+                                       regulator-always-on;
+                               };
+
+                               ldo5 {
+                                       regulator-name = "vdd-cam-front";
+                                       regulator-min-microvolt = <1200000>;
+                                       regulator-max-microvolt = <1200000>;
+                               };
+
+                               ldo6 {
+                                       regulator-name = "vddio-sdmmc3";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <3300000>;
+                                       regulator-boot-on;
+                                       regulator-always-on;
+                               };
+
+                               ldo7 {
+                                       regulator-name = "vdd-cam-rear";
+                                       regulator-min-microvolt = <1050000>;
+                                       regulator-max-microvolt = <1050000>;
+                               };
+
+                               ldo9 {
+                                       regulator-name = "vdd-touch";
+                                       regulator-min-microvolt = <2800000>;
+                                       regulator-max-microvolt = <2800000>;
+                               };
+
+                               ldo10 {
+                                       regulator-name = "vdd-cam-af";
+                                       regulator-min-microvolt = <2800000>;
+                                       regulator-max-microvolt = <2800000>;
+                               };
+
+                               ldo11 {
+                                       regulator-name = "vpp-fuse";
+                                       regulator-min-microvolt = <1800000>;
+                                       regulator-max-microvolt = <1800000>;
+                               };
+                       };
+               };
+       };
+
+       spi@7000d400 {
+               status = "okay";
+
+               cros-ec@0 {
+                       compatible = "google,cros-ec-spi";
+                       spi-max-frequency = <4000000>;
+                       interrupt-parent = <&gpio>;
+                       interrupts = <TEGRA_GPIO(C, 7) IRQ_TYPE_LEVEL_LOW>;
+                       reg = <0>;
+
+                       google,cros-ec-spi-msg-delay = <2000>;
+
+                       cros-ec-keyb {
+                               compatible = "google,cros-ec-keyb";
+                               keypad,num-rows = <8>;
+                               keypad,num-columns = <13>;
+                               google,needs-ghost-filter;
+
+                               linux,keymap = <
+                                       MATRIX_KEY(0x00, 0x01, KEY_LEFTMETA)
+                                       MATRIX_KEY(0x00, 0x02, KEY_F1)
+                                       MATRIX_KEY(0x00, 0x03, KEY_B)
+                                       MATRIX_KEY(0x00, 0x04, KEY_F10)
+                                       MATRIX_KEY(0x00, 0x06, KEY_N)
+                                       MATRIX_KEY(0x00, 0x08, KEY_EQUAL)
+                                       MATRIX_KEY(0x00, 0x0a, KEY_RIGHTALT)
+
+                                       MATRIX_KEY(0x01, 0x01, KEY_ESC)
+                                       MATRIX_KEY(0x01, 0x02, KEY_F4)
+                                       MATRIX_KEY(0x01, 0x03, KEY_G)
+                                       MATRIX_KEY(0x01, 0x04, KEY_F7)
+                                       MATRIX_KEY(0x01, 0x06, KEY_H)
+                                       MATRIX_KEY(0x01, 0x08, KEY_APOSTROPHE)
+                                       MATRIX_KEY(0x01, 0x09, KEY_F9)
+                                       MATRIX_KEY(0x01, 0x0b, KEY_BACKSPACE)
+
+                                       MATRIX_KEY(0x02, 0x00, KEY_LEFTCTRL)
+                                       MATRIX_KEY(0x02, 0x01, KEY_TAB)
+                                       MATRIX_KEY(0x02, 0x02, KEY_F3)
+                                       MATRIX_KEY(0x02, 0x03, KEY_T)
+                                       MATRIX_KEY(0x02, 0x04, KEY_F6)
+                                       MATRIX_KEY(0x02, 0x05, KEY_RIGHTBRACE)
+                                       MATRIX_KEY(0x02, 0x06, KEY_Y)
+                                       MATRIX_KEY(0x02, 0x07, KEY_102ND)
+                                       MATRIX_KEY(0x02, 0x08, KEY_LEFTBRACE)
+                                       MATRIX_KEY(0x02, 0x09, KEY_F8)
+
+                                       MATRIX_KEY(0x03, 0x01, KEY_GRAVE)
+                                       MATRIX_KEY(0x03, 0x02, KEY_F2)
+                                       MATRIX_KEY(0x03, 0x03, KEY_5)
+                                       MATRIX_KEY(0x03, 0x04, KEY_F5)
+                                       MATRIX_KEY(0x03, 0x06, KEY_6)
+                                       MATRIX_KEY(0x03, 0x08, KEY_MINUS)
+                                       MATRIX_KEY(0x03, 0x0b, KEY_BACKSLASH)
+
+                                       MATRIX_KEY(0x04, 0x00, KEY_RIGHTCTRL)
+                                       MATRIX_KEY(0x04, 0x01, KEY_A)
+                                       MATRIX_KEY(0x04, 0x02, KEY_D)
+                                       MATRIX_KEY(0x04, 0x03, KEY_F)
+                                       MATRIX_KEY(0x04, 0x04, KEY_S)
+                                       MATRIX_KEY(0x04, 0x05, KEY_K)
+                                       MATRIX_KEY(0x04, 0x06, KEY_J)
+                                       MATRIX_KEY(0x04, 0x08, KEY_SEMICOLON)
+                                       MATRIX_KEY(0x04, 0x09, KEY_L)
+                                       MATRIX_KEY(0x04, 0x0a, KEY_BACKSLASH)
+                                       MATRIX_KEY(0x04, 0x0b, KEY_ENTER)
+
+                                       MATRIX_KEY(0x05, 0x01, KEY_Z)
+                                       MATRIX_KEY(0x05, 0x02, KEY_C)
+                                       MATRIX_KEY(0x05, 0x03, KEY_V)
+                                       MATRIX_KEY(0x05, 0x04, KEY_X)
+                                       MATRIX_KEY(0x05, 0x05, KEY_COMMA)
+                                       MATRIX_KEY(0x05, 0x06, KEY_M)
+                                       MATRIX_KEY(0x05, 0x07, KEY_LEFTSHIFT)
+                                       MATRIX_KEY(0x05, 0x08, KEY_SLASH)
+                                       MATRIX_KEY(0x05, 0x09, KEY_DOT)
+                                       MATRIX_KEY(0x05, 0x0b, KEY_SPACE)
+
+                                       MATRIX_KEY(0x06, 0x01, KEY_1)
+                                       MATRIX_KEY(0x06, 0x02, KEY_3)
+                                       MATRIX_KEY(0x06, 0x03, KEY_4)
+                                       MATRIX_KEY(0x06, 0x04, KEY_2)
+                                       MATRIX_KEY(0x06, 0x05, KEY_8)
+                                       MATRIX_KEY(0x06, 0x06, KEY_7)
+                                       MATRIX_KEY(0x06, 0x08, KEY_0)
+                                       MATRIX_KEY(0x06, 0x09, KEY_9)
+                                       MATRIX_KEY(0x06, 0x0a, KEY_LEFTALT)
+                                       MATRIX_KEY(0x06, 0x0b, KEY_DOWN)
+                                       MATRIX_KEY(0x06, 0x0c, KEY_RIGHT)
+
+                                       MATRIX_KEY(0x07, 0x01, KEY_Q)
+                                       MATRIX_KEY(0x07, 0x02, KEY_E)
+                                       MATRIX_KEY(0x07, 0x03, KEY_R)
+                                       MATRIX_KEY(0x07, 0x04, KEY_W)
+                                       MATRIX_KEY(0x07, 0x05, KEY_I)
+                                       MATRIX_KEY(0x07, 0x06, KEY_U)
+                                       MATRIX_KEY(0x07, 0x07, KEY_RIGHTSHIFT)
+                                       MATRIX_KEY(0x07, 0x08, KEY_P)
+                                       MATRIX_KEY(0x07, 0x09, KEY_O)
+                                       MATRIX_KEY(0x07, 0x0b, KEY_UP)
+                                       MATRIX_KEY(0x07, 0x0c, KEY_LEFT)
+                               >;
+                       };
+               };
+       };
+
        pmc@7000e400 {
                nvidia,invert-interrupt;
                nvidia,suspend-mode = <1>;
                nvidia,core-power-req-active-high;
                nvidia,sys-clock-req-active-high;
        };
+
+       sdhci@700b0400 {
+               cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>;
+               power-gpios = <&gpio TEGRA_GPIO(R, 0) GPIO_ACTIVE_HIGH>;
+               status = "okay";
+               bus-width = <4>;
+       };
+
+       sdhci@700b0600 {
+               status = "okay";
+               bus-width = <8>;
+       };
+
+       ahub@70300000 {
+               i2s@70301100 {
+                       status = "okay";
+               };
+       };
+
+       clocks {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               clk32k_in: clock@0 {
+                       compatible = "fixed-clock";
+                       reg=<0>;
+                       #clock-cells = <0>;
+                       clock-frequency = <32768>;
+               };
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               power {
+                       label = "Power";
+                       gpios = <&gpio TEGRA_GPIO(Q, 0) GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_POWER>;
+                       debounce-interval = <10>;
+                       gpio-key,wakeup;
+               };
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               vdd_ac_bat_reg: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "vdd_ac_bat";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-always-on;
+               };
+
+               vdd_3v3_reg: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "vdd_3v3";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+                       regulator-boot-on;
+                       enable-active-high;
+                       gpio = <&as3722 1 GPIO_ACTIVE_HIGH>;
+               };
+
+               vdd_3v3_modem_reg: regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "vdd-modem-3v3";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       enable-active-high;
+                       gpio = <&as3722 2 GPIO_ACTIVE_HIGH>;
+               };
+
+               vdd_hdmi_5v0_reg: regulator@3 {
+                       compatible = "regulator-fixed";
+                       reg = <3>;
+                       regulator-name = "vdd-hdmi-5v0";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       gpio = <&gpio TEGRA_GPIO(K, 6) GPIO_ACTIVE_HIGH>;
+               };
+
+               vdd_bl_reg: regulator@4 {
+                       compatible = "regulator-fixed";
+                       reg = <4>;
+                       regulator-name = "vdd-bl";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       gpio = <&gpio TEGRA_GPIO(P, 2) GPIO_ACTIVE_LOW>;
+               };
+
+               vdd_ts_sw_5v0: regulator@5 {
+                       compatible = "regulator-fixed";
+                       reg = <5>;
+                       regulator-name = "vdd_ts_sw";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       regulator-boot-on;
+                       gpio = <&gpio TEGRA_GPIO(K, 1) GPIO_ACTIVE_LOW>;
+               };
+
+               usb1_vbus_reg: regulator@6 {
+                       compatible = "regulator-fixed";
+                       reg = <6>;
+                       regulator-name = "usb1_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-boot-on;
+                       enable-active-high;
+                       gpio = <&gpio TEGRA_GPIO(N, 4) GPIO_ACTIVE_HIGH>;
+                       gpio-open-drain;
+               };
+
+               usb3_vbus_reg: regulator@7 {
+                       compatible = "regulator-fixed";
+                       reg = <7>;
+                       regulator-name = "usb3_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-boot-on;
+                       enable-active-high;
+                       gpio = <&gpio TEGRA_GPIO(N, 5) GPIO_ACTIVE_HIGH>;
+                       gpio-open-drain;
+               };
+
+               panel_3v3_reg: regulator@8 {
+                       compatible = "regulator-fixed";
+                       reg = <8>;
+                       regulator-name = "panel_3v3";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       enable-active-high;
+                       gpio = <&as3722 4 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       sound {
+               compatible = "nvidia,tegra-audio-max98090-venice2",
+                            "nvidia,tegra-audio-max98090";
+               nvidia,model = "NVIDIA Tegra Venice2";
+
+               nvidia,audio-routing =
+                       "Headphones", "HPR",
+                       "Headphones", "HPL",
+                       "Speakers", "SPKR",
+                       "Speakers", "SPKL",
+                       "Mic Jack", "MICBIAS",
+                       "IN34", "Mic Jack";
+
+               nvidia,i2s-controller = <&tegra_i2s1>;
+               nvidia,audio-codec = <&acodec>;
+
+               clocks = <&tegra_car TEGRA124_CLK_PLL_A>,
+                        <&tegra_car TEGRA124_CLK_PLL_A_OUT0>,
+                        <&tegra_car TEGRA124_CLK_EXTERN1>;
+               clock-names = "pll_a", "pll_a_out0", "mclk";
+       };
 };
index b7413004ee7756bbc0799a034153e1b4673a42cd..ec0698a8354a4795a64318adffe12820efd198c6 100644 (file)
@@ -1,4 +1,6 @@
+#include <dt-bindings/clock/tegra124-car.h>
 #include <dt-bindings/gpio/tegra-gpio.h>
+#include <dt-bindings/pinctrl/pinctrl-tegra.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
 #include "skeleton.dtsi"
                             <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_TIMER>;
+       };
+
+       tegra_car: clock@60006000 {
+               compatible = "nvidia,tegra124-car";
+               reg = <0x60006000 0x1000>;
+               #clock-cells = <1>;
+               #reset-cells = <1>;
        };
 
        gpio: gpio@6000d000 {
                interrupt-controller;
        };
 
+       apbdma: dma@60020000 {
+               compatible = "nvidia,tegra124-apbdma", "nvidia,tegra148-apbdma";
+               reg = <0x60020000 0x1400>;
+               interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
+                            <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_APBDMA>;
+               resets = <&tegra_car 34>;
+               reset-names = "dma";
+               #dma-cells = <1>;
+       };
+
+       pinmux: pinmux@70000868 {
+               compatible = "nvidia,tegra124-pinmux";
+               reg = <0x70000868 0x164>,       /* Pad control registers */
+                     <0x70003000 0x434>;       /* Mux registers */
+       };
+
        /*
         * There are two serial driver i.e. 8250 based simple serial
         * driver and APB DMA based serial driver for higher baudrate
                reg = <0x70006000 0x40>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_UARTA>;
+               resets = <&tegra_car 6>;
+               reset-names = "serial";
+               dmas = <&apbdma 8>, <&apbdma 8>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006040 0x40>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_UARTB>;
+               resets = <&tegra_car 7>;
+               reset-names = "serial";
+               dmas = <&apbdma 9>, <&apbdma 9>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006200 0x40>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_UARTC>;
+               resets = <&tegra_car 55>;
+               reset-names = "serial";
+               dmas = <&apbdma 10>, <&apbdma 10>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006300 0x40>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_UARTD>;
+               resets = <&tegra_car 65>;
+               reset-names = "serial";
+               dmas = <&apbdma 19>, <&apbdma 19>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006400 0x40>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_UARTE>;
+               resets = <&tegra_car 66>;
+               reset-names = "serial";
+               dmas = <&apbdma 20>, <&apbdma 20>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       pwm@7000a000 {
+               compatible = "nvidia,tegra124-pwm", "nvidia,tegra20-pwm";
+               reg = <0x7000a000 0x100>;
+               #pwm-cells = <2>;
+               clocks = <&tegra_car TEGRA124_CLK_PWM>;
+               resets = <&tegra_car 17>;
+               reset-names = "pwm";
+               status = "disabled";
+       };
+
+       i2c@7000c000 {
+               compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+               reg = <0x7000c000 0x100>;
+               interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_I2C1>;
+               clock-names = "div-clk";
+               resets = <&tegra_car 12>;
+               reset-names = "i2c";
+               dmas = <&apbdma 21>, <&apbdma 21>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       i2c@7000c400 {
+               compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+               reg = <0x7000c400 0x100>;
+               interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_I2C2>;
+               clock-names = "div-clk";
+               resets = <&tegra_car 54>;
+               reset-names = "i2c";
+               dmas = <&apbdma 22>, <&apbdma 22>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       i2c@7000c500 {
+               compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+               reg = <0x7000c500 0x100>;
+               interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_I2C3>;
+               clock-names = "div-clk";
+               resets = <&tegra_car 67>;
+               reset-names = "i2c";
+               dmas = <&apbdma 23>, <&apbdma 23>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       i2c@7000c700 {
+               compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+               reg = <0x7000c700 0x100>;
+               interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_I2C4>;
+               clock-names = "div-clk";
+               resets = <&tegra_car 103>;
+               reset-names = "i2c";
+               dmas = <&apbdma 26>, <&apbdma 26>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       i2c@7000d000 {
+               compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+               reg = <0x7000d000 0x100>;
+               interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_I2C5>;
+               clock-names = "div-clk";
+               resets = <&tegra_car 47>;
+               reset-names = "i2c";
+               dmas = <&apbdma 24>, <&apbdma 24>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       i2c@7000d100 {
+               compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+               reg = <0x7000d100 0x100>;
+               interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_I2C6>;
+               clock-names = "div-clk";
+               resets = <&tegra_car 166>;
+               reset-names = "i2c";
+               dmas = <&apbdma 30>, <&apbdma 30>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       spi@7000d400 {
+               compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+               reg = <0x7000d400 0x200>;
+               interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_SBC1>;
+               clock-names = "spi";
+               resets = <&tegra_car 41>;
+               reset-names = "spi";
+               dmas = <&apbdma 15>, <&apbdma 15>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       spi@7000d600 {
+               compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+               reg = <0x7000d600 0x200>;
+               interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_SBC2>;
+               clock-names = "spi";
+               resets = <&tegra_car 44>;
+               reset-names = "spi";
+               dmas = <&apbdma 16>, <&apbdma 16>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       spi@7000d800 {
+               compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+               reg = <0x7000d800 0x200>;
+               interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_SBC3>;
+               clock-names = "spi";
+               resets = <&tegra_car 46>;
+               reset-names = "spi";
+               dmas = <&apbdma 17>, <&apbdma 17>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       spi@7000da00 {
+               compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+               reg = <0x7000da00 0x200>;
+               interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_SBC4>;
+               clock-names = "spi";
+               resets = <&tegra_car 68>;
+               reset-names = "spi";
+               dmas = <&apbdma 18>, <&apbdma 18>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       spi@7000dc00 {
+               compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+               reg = <0x7000dc00 0x200>;
+               interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_SBC5>;
+               clock-names = "spi";
+               resets = <&tegra_car 104>;
+               reset-names = "spi";
+               dmas = <&apbdma 27>, <&apbdma 27>;
+               dma-names = "rx", "tx";
+               status = "disabled";
+       };
+
+       spi@7000de00 {
+               compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+               reg = <0x7000de00 0x200>;
+               interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&tegra_car TEGRA124_CLK_SBC6>;
+               clock-names = "spi";
+               resets = <&tegra_car 105>;
+               reset-names = "spi";
+               dmas = <&apbdma 28>, <&apbdma 28>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra124-rtc", "nvidia,tegra20-rtc";
                reg = <0x7000e000 0x100>;
                interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_RTC>;
        };
 
        pmc@7000e400 {
                compatible = "nvidia,tegra124-pmc";
                reg = <0x7000e400 0x400>;
+               clocks = <&tegra_car TEGRA124_CLK_PCLK>, <&clk32k_in>;
+               clock-names = "pclk", "clk32k_in";
+       };
+
+       sdhci@700b0000 {
+               compatible = "nvidia,tegra124-sdhci";
+               reg = <0x700b0000 0x200>;
+               interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_SDMMC1>;
+               resets = <&tegra_car 14>;
+               reset-names = "sdhci";
+               status = "disable";
+       };
+
+       sdhci@700b0200 {
+               compatible = "nvidia,tegra124-sdhci";
+               reg = <0x700b0200 0x200>;
+               interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_SDMMC2>;
+               resets = <&tegra_car 9>;
+               reset-names = "sdhci";
+               status = "disable";
+       };
+
+       sdhci@700b0400 {
+               compatible = "nvidia,tegra124-sdhci";
+               reg = <0x700b0400 0x200>;
+               interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_SDMMC3>;
+               resets = <&tegra_car 69>;
+               reset-names = "sdhci";
+               status = "disable";
+       };
+
+       sdhci@700b0600 {
+               compatible = "nvidia,tegra124-sdhci";
+               reg = <0x700b0600 0x200>;
+               interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_SDMMC4>;
+               resets = <&tegra_car 15>;
+               reset-names = "sdhci";
+               status = "disable";
+       };
+
+       ahub@70300000 {
+               compatible = "nvidia,tegra124-ahub";
+               reg = <0x70300000 0x200>,
+                     <0x70300800 0x800>,
+                     <0x70300200 0x600>;
+               interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&tegra_car TEGRA124_CLK_D_AUDIO>,
+                        <&tegra_car TEGRA124_CLK_APBIF>;
+               clock-names = "d_audio", "apbif";
+               resets = <&tegra_car 106>, /* d_audio */
+                        <&tegra_car 107>, /* apbif */
+                        <&tegra_car 30>,  /* i2s0 */
+                        <&tegra_car 11>,  /* i2s1 */
+                        <&tegra_car 18>,  /* i2s2 */
+                        <&tegra_car 101>, /* i2s3 */
+                        <&tegra_car 102>, /* i2s4 */
+                        <&tegra_car 108>, /* dam0 */
+                        <&tegra_car 109>, /* dam1 */
+                        <&tegra_car 110>, /* dam2 */
+                        <&tegra_car 10>,  /* spdif */
+                        <&tegra_car 153>, /* amx */
+                        <&tegra_car 185>, /* amx1 */
+                        <&tegra_car 154>, /* adx */
+                        <&tegra_car 180>, /* adx1 */
+                        <&tegra_car 186>, /* afc0 */
+                        <&tegra_car 187>, /* afc1 */
+                        <&tegra_car 188>, /* afc2 */
+                        <&tegra_car 189>, /* afc3 */
+                        <&tegra_car 190>, /* afc4 */
+                        <&tegra_car 191>; /* afc5 */
+               reset-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
+                             "i2s3", "i2s4", "dam0", "dam1", "dam2",
+                             "spdif", "amx", "amx1", "adx", "adx1",
+                             "afc0", "afc1", "afc2", "afc3", "afc4", "afc5";
+               dmas = <&apbdma 1>, <&apbdma 1>,
+                      <&apbdma 2>, <&apbdma 2>,
+                      <&apbdma 3>, <&apbdma 3>,
+                      <&apbdma 4>, <&apbdma 4>,
+                      <&apbdma 6>, <&apbdma 6>,
+                      <&apbdma 7>, <&apbdma 7>,
+                      <&apbdma 12>, <&apbdma 12>,
+                      <&apbdma 13>, <&apbdma 13>,
+                      <&apbdma 14>, <&apbdma 14>,
+                      <&apbdma 29>, <&apbdma 29>;
+               dma-names = "rx0", "tx0", "rx1", "tx1", "rx2", "tx2",
+                           "rx3", "tx3", "rx4", "tx4", "rx5", "tx5",
+                           "rx6", "tx6", "rx7", "tx7", "rx8", "tx8",
+                           "rx9", "tx9";
+               ranges;
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               tegra_i2s0: i2s@70301000 {
+                       compatible = "nvidia,tegra124-i2s";
+                       reg = <0x70301000 0x100>;
+                       nvidia,ahub-cif-ids = <4 4>;
+                       clocks = <&tegra_car TEGRA124_CLK_I2S0>;
+                       resets = <&tegra_car 30>;
+                       reset-names = "i2s";
+                       status = "disabled";
+               };
+
+               tegra_i2s1: i2s@70301100 {
+                       compatible = "nvidia,tegra124-i2s";
+                       reg = <0x70301100 0x100>;
+                       nvidia,ahub-cif-ids = <5 5>;
+                       clocks = <&tegra_car TEGRA124_CLK_I2S1>;
+                       resets = <&tegra_car 11>;
+                       reset-names = "i2s";
+                       status = "disabled";
+               };
+
+               tegra_i2s2: i2s@70301200 {
+                       compatible = "nvidia,tegra124-i2s";
+                       reg = <0x70301200 0x100>;
+                       nvidia,ahub-cif-ids = <6 6>;
+                       clocks = <&tegra_car TEGRA124_CLK_I2S2>;
+                       resets = <&tegra_car 18>;
+                       reset-names = "i2s";
+                       status = "disabled";
+               };
+
+               tegra_i2s3: i2s@70301300 {
+                       compatible = "nvidia,tegra124-i2s";
+                       reg = <0x70301300 0x100>;
+                       nvidia,ahub-cif-ids = <7 7>;
+                       clocks = <&tegra_car TEGRA124_CLK_I2S3>;
+                       resets = <&tegra_car 101>;
+                       reset-names = "i2s";
+                       status = "disabled";
+               };
+
+               tegra_i2s4: i2s@70301400 {
+                       compatible = "nvidia,tegra124-i2s";
+                       reg = <0x70301400 0x100>;
+                       nvidia,ahub-cif-ids = <8 8>;
+                       clocks = <&tegra_car TEGRA124_CLK_I2S4>;
+                       resets = <&tegra_car 102>;
+                       reset-names = "i2s";
+                       status = "disabled";
+               };
        };
 
        cpus {
index cbe89ff10686b15e008cb4bfc42ac385038b6a4a..8e0066ad9628e745fa167ff7047fb474c29d6dcb 100644 (file)
@@ -4,12 +4,17 @@
        model = "Toradex Colibri T20 512MB";
        compatible = "toradex,colibri_t20-512", "nvidia,tegra20";
 
+       aliases {
+               rtc0 = "/i2c@7000d000/tps6586x@34";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x00000000 0x20000000>;
        };
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               hdmi@54280000 {
                        vdd-supply = <&hdmi_vdd_reg>;
                        pll-supply = <&hdmi_pll_reg>;
 
@@ -19,7 +24,7 @@
                };
        };
 
-       pinmux {
+       pinmux@70000014 {
                pinctrl-names = "default";
                pinctrl-0 = <&state_default>;
 
                        audio_refclk {
                                nvidia,pins = "cdev1";
                                nvidia,function = "plla_out";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        crt {
                                nvidia,pins = "crtp";
                                nvidia,function = "crt";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        dap3 {
                                nvidia,pins = "dap3";
                                nvidia,function = "dap3";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        displaya {
                                nvidia,pins = "ld0", "ld1", "ld2", "ld3",
                                        "lhs", "lpw0", "lpw2", "lsc0",
                                        "lsc1", "lsck", "lsda", "lspi", "lvs";
                                nvidia,function = "displaya";
-                               nvidia,tristate = <1>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        gpio_dte {
                                nvidia,pins = "dte";
                                nvidia,function = "rsvd1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        gpio_gmi {
                                nvidia,pins = "ata", "atc", "atd", "ate",
                                        "dap1", "dap2", "dap4", "gpu", "irrx",
                                        "irtx", "spia", "spib", "spic";
                                nvidia,function = "gmi";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        gpio_pta {
                                nvidia,pins = "pta";
                                nvidia,function = "rsvd4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        gpio_uac {
                                nvidia,pins = "uac";
                                nvidia,function = "rsvd2";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        hdint {
                                nvidia,pins = "hdint";
                                nvidia,function = "hdmi";
-                               nvidia,tristate = <1>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        i2c1 {
                                nvidia,pins = "rm";
                                nvidia,function = "i2c1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        i2c3 {
                                nvidia,pins = "dtf";
                                nvidia,function = "i2c3";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        i2cddc {
                                nvidia,pins = "ddc";
                                nvidia,function = "i2c2";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        i2cp {
                                nvidia,pins = "i2cp";
                                nvidia,function = "i2cp";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        irda {
                                nvidia,pins = "uad";
                                nvidia,function = "irda";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        nand {
                                nvidia,pins = "kbca", "kbcc", "kbcd",
                                        "kbce", "kbcf";
                                nvidia,function = "nand";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        owc {
                                nvidia,pins = "owc";
                                nvidia,function = "owr";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        pmc {
                                nvidia,pins = "pmc";
                                nvidia,function = "pwr_on";
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        pwm {
                                nvidia,pins = "sdb", "sdc", "sdd";
                                nvidia,function = "pwm";
-                               nvidia,tristate = <1>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        sdio4 {
                                nvidia,pins = "atb", "gma", "gme";
                                nvidia,function = "sdio4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        spi1 {
                                nvidia,pins = "spid", "spie", "spif";
                                nvidia,function = "spi1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        spi4 {
                                nvidia,pins = "slxa", "slxc", "slxd", "slxk";
                                nvidia,function = "spi4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        uarta {
                                nvidia,pins = "sdio1";
                                nvidia,function = "uarta";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        uartd {
                                nvidia,pins = "gmc";
                                nvidia,function = "uartd";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        ulpi {
                                nvidia,pins = "uaa", "uab", "uda";
                                nvidia,function = "ulpi";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        ulpi_refclk {
                                nvidia,pins = "cdev2";
                                nvidia,function = "pllp_out4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        usb_gpio {
                                nvidia,pins = "spig", "spih";
                                nvidia,function = "spi2_alt";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        vi {
                                nvidia,pins = "dta", "dtb", "dtc", "dtd";
                                nvidia,function = "vi";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        vi_sc {
                                nvidia,pins = "csus";
                                nvidia,function = "vi_sensor_clk";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                };
        };
 
+       ac97: ac97@70002000 {
+               status = "okay";
+               nvidia,codec-reset-gpio = <&gpio TEGRA_GPIO(V, 0)
+                       GPIO_ACTIVE_HIGH>;
+               nvidia,codec-sync-gpio = <&gpio TEGRA_GPIO(P, 0)
+                       GPIO_ACTIVE_HIGH>;
+       };
+
        i2c@7000c000 {
                clock-frequency = <400000>;
        };
                        #gpio-cells = <2>;
                        gpio-controller;
 
-                       sys-supply = <&vdd_5v0_reg>;
+                       sys-supply = <&vdd_3v3_reg>;
                        vin-sm0-supply = <&sys_reg>;
                        vin-sm1-supply = <&sys_reg>;
                        vin-sm2-supply = <&sys_reg>;
                        vinldo01-supply = <&sm2_reg>;
-                       vinldo23-supply = <&sm2_reg>;
-                       vinldo4-supply = <&sm2_reg>;
-                       vinldo678-supply = <&sm2_reg>;
-                       vinldo9-supply = <&sm2_reg>;
+                       vinldo23-supply = <&vdd_3v3_reg>;
+                       vinldo4-supply = <&vdd_3v3_reg>;
+                       vinldo678-supply = <&vdd_3v3_reg>;
+                       vinldo9-supply = <&vdd_3v3_reg>;
 
                        regulators {
                                #address-cells = <1>;
                                        reg = <1>;
                                        regulator-compatible = "sm0";
                                        regulator-name = "vdd_sm0,vdd_core";
-                                       regulator-min-microvolt = <1275000>;
-                                       regulator-max-microvolt = <1275000>;
+                                       regulator-min-microvolt = <1200000>;
+                                       regulator-max-microvolt = <1200000>;
                                        regulator-always-on;
                                };
 
                                        reg = <2>;
                                        regulator-compatible = "sm1";
                                        regulator-name = "vdd_sm1,vdd_cpu";
-                                       regulator-min-microvolt = <1100000>;
-                                       regulator-max-microvolt = <1100000>;
+                                       regulator-min-microvolt = <1000000>;
+                                       regulator-max-microvolt = <1000000>;
                                        regulator-always-on;
                                };
 
                                        reg = <10>;
                                        regulator-compatible = "ldo6";
                                        regulator-name = "vdd_ldo6,avdd_vdac,vddio_vi,vddio_cam";
-                                       regulator-min-microvolt = <1800000>;
-                                       regulator-max-microvolt = <1800000>;
+                                       regulator-min-microvolt = <2850000>;
+                                       regulator-max-microvolt = <2850000>;
                                };
 
                                hdmi_vdd_reg: regulator@11 {
                };
        };
 
-       pmc {
+       pmc@7000e400 {
                nvidia,suspend-mode = <1>;
                nvidia,cpu-pwr-good-time = <5000>;
                nvidia,cpu-pwr-off-time = <5000>;
                };
        };
 
-       ac97: ac97 {
-               status = "okay";
-               nvidia,codec-reset-gpio = <&gpio TEGRA_GPIO(V, 0)
-                       GPIO_ACTIVE_HIGH>;
-               nvidia,codec-sync-gpio = <&gpio TEGRA_GPIO(P, 0)
-                       GPIO_ACTIVE_HIGH>;
-       };
-
        usb@c5004000 {
                status = "okay";
                nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
                #address-cells = <1>;
                #size-cells = <0>;
 
-               clk32k_in: clock {
+               clk32k_in: clock@0 {
                        compatible = "fixed-clock";
                        reg=<0>;
                        #clock-cells = <0>;
                };
        };
 
-       sound {
-               compatible = "nvidia,tegra-audio-wm9712-colibri_t20",
-                                "nvidia,tegra-audio-wm9712";
-               nvidia,model = "Colibri T20 AC97 Audio";
-
-               nvidia,audio-routing =
-                       "Headphone", "HPOUTL",
-                       "Headphone", "HPOUTR",
-                       "LineIn", "LINEINL",
-                       "LineIn", "LINEINR",
-                       "Mic", "MIC1";
-
-               nvidia,ac97-controller = <&ac97>;
-
-               clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
-                        <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
-                        <&tegra_car TEGRA20_CLK_CDEV1>;
-               clock-names = "pll_a", "pll_a_out0", "mclk";
-       };
-
        regulators {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <0>;
 
-               vdd_5v0_reg: regulator@100 {
+               vdd_3v3_reg: regulator@100 {
                        compatible = "regulator-fixed";
                        reg = <100>;
-                       regulator-name = "vdd_5v0";
-                       regulator-min-microvolt = <5000000>;
-                       regulator-max-microvolt = <5000000>;
+                       regulator-name = "vdd_3v3";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
                        regulator-always-on;
                };
 
                        gpio = <&gpio TEGRA_GPIO(BB, 1) GPIO_ACTIVE_HIGH>;
                };
        };
+
+       sound {
+               compatible = "nvidia,tegra-audio-wm9712-colibri_t20",
+                                "nvidia,tegra-audio-wm9712";
+               nvidia,model = "Colibri T20 AC97 Audio";
+
+               nvidia,audio-routing =
+                       "Headphone", "HPOUTL",
+                       "Headphone", "HPOUTR",
+                       "LineIn", "LINEINL",
+                       "LineIn", "LINEINR",
+                       "Mic", "MIC1";
+
+               nvidia,ac97-controller = <&ac97>;
+
+               clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
+                        <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
+                        <&tegra_car TEGRA20_CLK_CDEV1>;
+               clock-names = "pll_a", "pll_a_out0", "mclk";
+       };
 };
index e156ab30e76343b37271b7f650e71b55d263be85..3fb1f50f6d4628a3bdc42214450e03ace2a41e2d 100644 (file)
@@ -1,17 +1,31 @@
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
 #include "tegra20.dtsi"
 
 / {
        model = "NVIDIA Tegra20 Harmony evaluation board";
        compatible = "nvidia,harmony", "nvidia,tegra20";
 
+       aliases {
+               rtc0 = "/i2c@7000d000/tps6586x@34";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x00000000 0x40000000>;
        };
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               dc@54200000 {
+                       rgb {
+                               status = "okay";
+
+                               nvidia,panel = <&panel>;
+                       };
+               };
+
+               hdmi@54280000 {
                        status = "okay";
 
                        vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +37,7 @@
                };
        };
 
-       pinmux {
+       pinmux@70000014 {
                pinctrl-names = "default";
                pinctrl-0 = <&state_default>;
 
                                        "gmb", "gmc", "gmd", "gme", "gpu7",
                                        "gpv", "i2cp", "pta", "rm", "slxa",
                                        "slxk", "spia", "spib", "uac";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_ck32 {
                                nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
                                        "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
-                               nvidia,pull = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
                        };
                        conf_csus {
                                nvidia,pins = "csus", "spid", "spif";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_crtp {
                                nvidia,pins = "crtp", "dap2", "dap3", "dap4",
                                        "dtc", "dte", "dtf", "gpu", "sdio1",
                                        "slxc", "slxd", "spdi", "spdo", "spig",
                                        "uda";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_ddc {
                                nvidia,pins = "ddc", "dta", "dtd", "kbca",
                                        "kbcb", "kbcc", "kbcd", "kbce", "kbcf",
                                        "sdc";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_hdint {
                                nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
                                        "lpw1", "lsc1", "lsck", "lsda", "lsdi",
                                        "lvp0", "owc", "sdb";
-                               nvidia,tristate = <1>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_irrx {
                                nvidia,pins = "irrx", "irtx", "sdd", "spic",
                                        "spie", "spih", "uaa", "uab", "uad",
                                        "uca", "ucb";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_lc {
                                nvidia,pins = "lc", "ls";
-                               nvidia,pull = <2>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
                        };
                        conf_ld0 {
                                nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
                                        "lhp1", "lhp2", "lhs", "lm0", "lpp",
                                        "lpw0", "lpw2", "lsc0", "lspi", "lvp1",
                                        "lvs", "pmc";
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_ld17_0 {
                                nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
                                        "ld23_22";
-                               nvidia,pull = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                        };
                };
        };
                status = "okay";
        };
 
+       pwm: pwm@7000a000 {
+               status = "okay";
+       };
+
        i2c@7000c000 {
                status = "okay";
                clock-frequency = <400000>;
                };
        };
 
-       pmc {
+       kbc@7000e200 {
+               status = "okay";
+               nvidia,debounce-delay-ms = <2>;
+               nvidia,repeat-delay-ms = <160>;
+               nvidia,kbc-row-pins = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15>;
+               nvidia,kbc-col-pins = <16 17 18 19 20 21 22 23>;
+               linux,keymap = <MATRIX_KEY(0x00, 0x02, KEY_W)
+                               MATRIX_KEY(0x00, 0x03, KEY_S)
+                               MATRIX_KEY(0x00, 0x04, KEY_A)
+                               MATRIX_KEY(0x00, 0x05, KEY_Z)
+                               MATRIX_KEY(0x00, 0x07, KEY_FN)
+                               MATRIX_KEY(0x01, 0x07, KEY_MENU)
+                               MATRIX_KEY(0x02, 0x06, KEY_LEFTALT)
+                               MATRIX_KEY(0x02, 0x07, KEY_RIGHTALT)
+                               MATRIX_KEY(0x03, 0x00, KEY_5)
+                               MATRIX_KEY(0x03, 0x01, KEY_4)
+                               MATRIX_KEY(0x03, 0x02, KEY_R)
+                               MATRIX_KEY(0x03, 0x03, KEY_E)
+                               MATRIX_KEY(0x03, 0x04, KEY_F)
+                               MATRIX_KEY(0x03, 0x05, KEY_D)
+                               MATRIX_KEY(0x03, 0x06, KEY_X)
+                               MATRIX_KEY(0x04, 0x00, KEY_7)
+                               MATRIX_KEY(0x04, 0x01, KEY_6)
+                               MATRIX_KEY(0x04, 0x02, KEY_T)
+                               MATRIX_KEY(0x04, 0x03, KEY_H)
+                               MATRIX_KEY(0x04, 0x04, KEY_G)
+                               MATRIX_KEY(0x04, 0x05, KEY_V)
+                               MATRIX_KEY(0x04, 0x06, KEY_C)
+                               MATRIX_KEY(0x04, 0x07, KEY_SPACE)
+                               MATRIX_KEY(0x05, 0x00, KEY_9)
+                               MATRIX_KEY(0x05, 0x01, KEY_8)
+                               MATRIX_KEY(0x05, 0x02, KEY_U)
+                               MATRIX_KEY(0x05, 0x03, KEY_Y)
+                               MATRIX_KEY(0x05, 0x04, KEY_J)
+                               MATRIX_KEY(0x05, 0x05, KEY_N)
+                               MATRIX_KEY(0x05, 0x06, KEY_B)
+                               MATRIX_KEY(0x05, 0x07, KEY_BACKSLASH)
+                               MATRIX_KEY(0x06, 0x00, KEY_MINUS)
+                               MATRIX_KEY(0x06, 0x01, KEY_0)
+                               MATRIX_KEY(0x06, 0x02, KEY_O)
+                               MATRIX_KEY(0x06, 0x03, KEY_I)
+                               MATRIX_KEY(0x06, 0x04, KEY_L)
+                               MATRIX_KEY(0x06, 0x05, KEY_K)
+                               MATRIX_KEY(0x06, 0x06, KEY_COMMA)
+                               MATRIX_KEY(0x06, 0x07, KEY_M)
+                               MATRIX_KEY(0x07, 0x01, KEY_EQUAL)
+                               MATRIX_KEY(0x07, 0x02, KEY_RIGHTBRACE)
+                               MATRIX_KEY(0x07, 0x03, KEY_ENTER)
+                               MATRIX_KEY(0x07, 0x07, KEY_MENU)
+                               MATRIX_KEY(0x08, 0x04, KEY_LEFTSHIFT)
+                               MATRIX_KEY(0x08, 0x05, KEY_RIGHTSHIFT)
+                               MATRIX_KEY(0x09, 0x05, KEY_LEFTCTRL)
+                               MATRIX_KEY(0x09, 0x07, KEY_RIGHTCTRL)
+                               MATRIX_KEY(0x0B, 0x00, KEY_LEFTBRACE)
+                               MATRIX_KEY(0x0B, 0x01, KEY_P)
+                               MATRIX_KEY(0x0B, 0x02, KEY_APOSTROPHE)
+                               MATRIX_KEY(0x0B, 0x03, KEY_SEMICOLON)
+                               MATRIX_KEY(0x0B, 0x04, KEY_SLASH)
+                               MATRIX_KEY(0x0B, 0x05, KEY_DOT)
+                               MATRIX_KEY(0x0C, 0x00, KEY_F10)
+                               MATRIX_KEY(0x0C, 0x01, KEY_F9)
+                               MATRIX_KEY(0x0C, 0x02, KEY_BACKSPACE)
+                               MATRIX_KEY(0x0C, 0x03, KEY_3)
+                               MATRIX_KEY(0x0C, 0x04, KEY_2)
+                               MATRIX_KEY(0x0C, 0x05, KEY_UP)
+                               MATRIX_KEY(0x0C, 0x06, KEY_PRINT)
+                               MATRIX_KEY(0x0C, 0x07, KEY_PAUSE)
+                               MATRIX_KEY(0x0D, 0x00, KEY_INSERT)
+                               MATRIX_KEY(0x0D, 0x01, KEY_DELETE)
+                               MATRIX_KEY(0x0D, 0x03, KEY_PAGEUP )
+                               MATRIX_KEY(0x0D, 0x04, KEY_PAGEDOWN)
+                               MATRIX_KEY(0x0D, 0x05, KEY_RIGHT)
+                               MATRIX_KEY(0x0D, 0x06, KEY_DOWN)
+                               MATRIX_KEY(0x0D, 0x07, KEY_LEFT)
+                               MATRIX_KEY(0x0E, 0x00, KEY_F11)
+                               MATRIX_KEY(0x0E, 0x01, KEY_F12)
+                               MATRIX_KEY(0x0E, 0x02, KEY_F8)
+                               MATRIX_KEY(0x0E, 0x03, KEY_Q)
+                               MATRIX_KEY(0x0E, 0x04, KEY_F4)
+                               MATRIX_KEY(0x0E, 0x05, KEY_F3)
+                               MATRIX_KEY(0x0E, 0x06, KEY_1)
+                               MATRIX_KEY(0x0E, 0x07, KEY_F7)
+                               MATRIX_KEY(0x0F, 0x00, KEY_ESC)
+                               MATRIX_KEY(0x0F, 0x01, KEY_GRAVE)
+                               MATRIX_KEY(0x0F, 0x02, KEY_F5)
+                               MATRIX_KEY(0x0F, 0x03, KEY_TAB)
+                               MATRIX_KEY(0x0F, 0x04, KEY_F1)
+                               MATRIX_KEY(0x0F, 0x05, KEY_F2)
+                               MATRIX_KEY(0x0F, 0x06, KEY_CAPSLOCK)
+                               MATRIX_KEY(0x0F, 0x07, KEY_F6)
+                               MATRIX_KEY(0x14, 0x00, KEY_KP7)
+                               MATRIX_KEY(0x15, 0x00, KEY_KP9)
+                               MATRIX_KEY(0x15, 0x01, KEY_KP8)
+                               MATRIX_KEY(0x15, 0x02, KEY_KP4)
+                               MATRIX_KEY(0x15, 0x04, KEY_KP1)
+                               MATRIX_KEY(0x16, 0x01, KEY_KPSLASH)
+                               MATRIX_KEY(0x16, 0x02, KEY_KP6)
+                               MATRIX_KEY(0x16, 0x03, KEY_KP5)
+                               MATRIX_KEY(0x16, 0x04, KEY_KP3)
+                               MATRIX_KEY(0x16, 0x05, KEY_KP2)
+                               MATRIX_KEY(0x16, 0x07, KEY_KP0)
+                               MATRIX_KEY(0x1B, 0x01, KEY_KPASTERISK)
+                               MATRIX_KEY(0x1B, 0x03, KEY_KPMINUS)
+                               MATRIX_KEY(0x1B, 0x04, KEY_KPPLUS)
+                               MATRIX_KEY(0x1B, 0x05, KEY_KPDOT)
+                               MATRIX_KEY(0x1C, 0x05, KEY_VOLUMEUP)
+                               MATRIX_KEY(0x1D, 0x03, KEY_HOME)
+                               MATRIX_KEY(0x1D, 0x04, KEY_END)
+                               MATRIX_KEY(0x1D, 0x05, KEY_BRIGHTNESSUP)
+                               MATRIX_KEY(0x1D, 0x06, KEY_VOLUMEDOWN)
+                               MATRIX_KEY(0x1D, 0x07, KEY_BRIGHTNESSDOWN)
+                               MATRIX_KEY(0x1E, 0x00, KEY_NUMLOCK)
+                               MATRIX_KEY(0x1E, 0x01, KEY_SCROLLLOCK)
+                               MATRIX_KEY(0x1E, 0x02, KEY_MUTE)
+                               MATRIX_KEY(0x1F, 0x04, KEY_QUESTION)>;
+       };
+
+       pmc@7000e400 {
                nvidia,invert-interrupt;
                nvidia,suspend-mode = <1>;
                nvidia,cpu-pwr-good-time = <5000>;
                nvidia,sys-clock-req-active-high;
        };
 
-       pcie-controller {
+       pcie-controller@80003000 {
                pex-clk-supply = <&pci_clk_reg>;
                vdd-supply = <&pci_vdd_reg>;
                status = "okay";
                bus-width = <8>;
        };
 
+       backlight: backlight {
+               compatible = "pwm-backlight";
+
+               enable-gpios = <&gpio TEGRA_GPIO(B, 5) GPIO_ACTIVE_HIGH>;
+               power-supply = <&vdd_bl_reg>;
+               pwms = <&pwm 0 5000000>;
+
+               brightness-levels = <0 4 8 16 32 64 128 255>;
+               default-brightness-level = <6>;
+       };
+
        clocks {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <0>;
 
-               clk32k_in: clock {
+               clk32k_in: clock@0 {
                        compatible = "fixed-clock";
                        reg=<0>;
                        #clock-cells = <0>;
                power {
                        label = "Power";
                        gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
-                       linux,code = <116>; /* KEY_POWER */
+                       linux,code = <KEY_POWER>;
                        gpio-key,wakeup;
                };
        };
 
-       kbc {
-               status = "okay";
-               nvidia,debounce-delay-ms = <2>;
-               nvidia,repeat-delay-ms = <160>;
-               nvidia,kbc-row-pins = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15>;
-               nvidia,kbc-col-pins = <16 17 18 19 20 21 22 23>;
-               linux,keymap = <0x00020011      /* KEY_W */
-                               0x0003001F      /* KEY_S */
-                               0x0004001E      /* KEY_A */
-                               0x0005002C      /* KEY_Z */
-                               0x000701D0      /* KEY_FN */
-                               0x0107008B      /* KEY_MENU */
-                               0x02060038      /* KEY_LEFTALT */
-                               0x02070064      /* KEY_RIGHTALT */
-                               0x03000006      /* KEY_5 */
-                               0x03010005      /* KEY_4 */
-                               0x03020013      /* KEY_R */
-                               0x03030012      /* KEY_E */
-                               0x03040021      /* KEY_F */
-                               0x03050020      /* KEY_D */
-                               0x0306002D      /* KEY_X */
-                               0x04000008      /* KEY_7 */
-                               0x04010007      /* KEY_6 */
-                               0x04020014      /* KEY_T */
-                               0x04030023      /* KEY_H */
-                               0x04040022      /* KEY_G */
-                               0x0405002F      /* KEY_V */
-                               0x0406002E      /* KEY_C */
-                               0x04070039      /* KEY_SPACE */
-                               0x0500000A      /* KEY_9 */
-                               0x05010009      /* KEY_8 */
-                               0x05020016      /* KEY_U */
-                               0x05030015      /* KEY_Y */
-                               0x05040024      /* KEY_J */
-                               0x05050031      /* KEY_N */
-                               0x05060030      /* KEY_B */
-                               0x0507002B      /* KEY_BACKSLASH */
-                               0x0600000C      /* KEY_MINUS */
-                               0x0601000B      /* KEY_0 */
-                               0x06020018      /* KEY_O */
-                               0x06030017      /* KEY_I */
-                               0x06040026      /* KEY_L */
-                               0x06050025      /* KEY_K */
-                               0x06060033      /* KEY_COMMA */
-                               0x06070032      /* KEY_M */
-                               0x0701000D      /* KEY_EQUAL */
-                               0x0702001B      /* KEY_RIGHTBRACE */
-                               0x0703001C      /* KEY_ENTER */
-                               0x0707008B      /* KEY_MENU */
-                               0x0804002A      /* KEY_LEFTSHIFT */
-                               0x08050036      /* KEY_RIGHTSHIFT */
-                               0x0905001D      /* KEY_LEFTCTRL */
-                               0x09070061      /* KEY_RIGHTCTRL */
-                               0x0B00001A      /* KEY_LEFTBRACE */
-                               0x0B010019      /* KEY_P */
-                               0x0B020028      /* KEY_APOSTROPHE */
-                               0x0B030027      /* KEY_SEMICOLON */
-                               0x0B040035      /* KEY_SLASH */
-                               0x0B050034      /* KEY_DOT */
-                               0x0C000044      /* KEY_F10 */
-                               0x0C010043      /* KEY_F9 */
-                               0x0C02000E      /* KEY_BACKSPACE */
-                               0x0C030004      /* KEY_3 */
-                               0x0C040003      /* KEY_2 */
-                               0x0C050067      /* KEY_UP */
-                               0x0C0600D2      /* KEY_PRINT */
-                               0x0C070077      /* KEY_PAUSE */
-                               0x0D00006E      /* KEY_INSERT */
-                               0x0D01006F      /* KEY_DELETE */
-                               0x0D030068      /* KEY_PAGEUP */
-                               0x0D04006D      /* KEY_PAGEDOWN */
-                               0x0D05006A      /* KEY_RIGHT */
-                               0x0D06006C      /* KEY_DOWN */
-                               0x0D070069      /* KEY_LEFT */
-                               0x0E000057      /* KEY_F11 */
-                               0x0E010058      /* KEY_F12 */
-                               0x0E020042      /* KEY_F8 */
-                               0x0E030010      /* KEY_Q */
-                               0x0E04003E      /* KEY_F4 */
-                               0x0E05003D      /* KEY_F3 */
-                               0x0E060002      /* KEY_1 */
-                               0x0E070041      /* KEY_F7 */
-                               0x0F000001      /* KEY_ESC */
-                               0x0F010029      /* KEY_GRAVE */
-                               0x0F02003F      /* KEY_F5 */
-                               0x0F03000F      /* KEY_TAB */
-                               0x0F04003B      /* KEY_F1 */
-                               0x0F05003C      /* KEY_F2 */
-                               0x0F06003A      /* KEY_CAPSLOCK */
-                               0x0F070040      /* KEY_F6 */
-                               0x14000047      /* KEY_KP7 */
-                               0x15000049      /* KEY_KP9 */
-                               0x15010048      /* KEY_KP8 */
-                               0x1502004B      /* KEY_KP4 */
-                               0x1504004F      /* KEY_KP1 */
-                               0x1601004E      /* KEY_KPSLASH */
-                               0x1602004D      /* KEY_KP6 */
-                               0x1603004C      /* KEY_KP5 */
-                               0x16040051      /* KEY_KP3 */
-                               0x16050050      /* KEY_KP2 */
-                               0x16070052      /* KEY_KP0 */
-                               0x1B010037      /* KEY_KPASTERISK */
-                               0x1B03004A      /* KEY_KPMINUS */
-                               0x1B04004E      /* KEY_KPPLUS */
-                               0x1B050053      /* KEY_KPDOT */
-                               0x1C050073      /* KEY_VOLUMEUP */
-                               0x1D030066      /* KEY_HOME */
-                               0x1D04006B      /* KEY_END */
-                               0x1D0500E1      /* KEY_BRIGHTNESSUP */
-                               0x1D060072      /* KEY_VOLUMEDOWN */
-                               0x1D0700E0      /* KEY_BRIGHTNESSDOWN */
-                               0x1E000045      /* KEY_NUMLOCK */
-                               0x1E010046      /* KEY_SCROLLLOCK */
-                               0x1E020071      /* KEY_MUTE */
-                               0x1F0400D6>;    /* KEY_QUESTION */
+       panel: panel {
+               compatible = "auo,b101aw03", "simple-panel";
+
+               power-supply = <&vdd_pnl_reg>;
+               enable-gpios = <&gpio TEGRA_GPIO(B, 2) GPIO_ACTIVE_HIGH>;
+
+               backlight = <&backlight>;
        };
 
        regulators {
                        enable-active-high;
                };
 
-               regulator@4 {
+               vdd_pnl_reg: regulator@4 {
                        compatible = "regulator-fixed";
                        reg = <4>;
                        regulator-name = "vdd_pnl";
                        enable-active-high;
                };
 
-               regulator@5 {
+               vdd_bl_reg: regulator@5 {
                        compatible = "regulator-fixed";
                        reg = <5>;
                        regulator-name = "vdd_bl";
index f2222bd74eab157f94ffcf884d9265765766f7d6..8cfb83f42e1fd87ff608b171a2c404942975b0ff 100644 (file)
@@ -6,61 +6,61 @@
        model = "Toradex Colibri T20 512MB on Iris";
        compatible = "toradex,iris", "toradex,colibri_t20-512", "nvidia,tegra20";
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               hdmi@54280000 {
                        status = "okay";
                };
        };
 
-       pinmux {
+       pinmux@70000014 {
                state_default: pinmux {
                        hdint {
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
 
                        i2cddc {
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
 
                        sdio4 {
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
 
                        uarta {
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
 
                        uartd {
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                };
        };
 
-       usb@c5000000 {
+       serial@70006000 {
                status = "okay";
        };
 
-       usb-phy@c5000000 {
+       serial@70006300 {
                status = "okay";
        };
 
-       usb@c5008000 {
+       i2c_ddc: i2c@7000c400 {
                status = "okay";
        };
 
-       usb-phy@c5008000 {
+       usb@c5000000 {
                status = "okay";
        };
 
-       serial@70006000 {
+       usb-phy@c5000000 {
                status = "okay";
        };
 
-       serial@70006300 {
+       usb@c5008000 {
                status = "okay";
        };
 
-       i2c_ddc: i2c@7000c400 {
+       usb-phy@c5008000 {
                status = "okay";
        };
 
index 7580578903cfa21c23d8b458efbb1ad2770ccb0a..6d3a4cbc36cc358ecdac0313283078e0d1fd4545 100644 (file)
@@ -6,7 +6,7 @@
        model = "Avionic Design Medcom-Wide board";
        compatible = "ad,medcom-wide", "ad,tamonten", "nvidia,tegra20";
 
-       pwm {
+       pwm@7000a000 {
                status = "okay";
        };
 
index 8d71fc9d8a2f6cca72ef5f04d1fe5517ffbc5de0..c7cd8e6802d75687169e69ba8b41cec57d40b1de 100644 (file)
@@ -1,17 +1,23 @@
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
 #include "tegra20.dtsi"
 
 / {
        model = "Toshiba AC100 / Dynabook AZ";
        compatible = "compal,paz00", "nvidia,tegra20";
 
+       aliases {
+               rtc0 = "/i2c@7000d000/tps6586x@34";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x00000000 0x20000000>;
        };
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               hdmi@54280000 {
                        status = "okay";
 
                        vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +29,7 @@
                };
        };
 
-       pinmux {
+       pinmux@70000014 {
                pinctrl-names = "default";
                pinctrl-0 = <&state_default>;
 
                                        "gpu", "gpu7", "gpv", "i2cp", "pta",
                                        "rm", "sdio1", "slxk", "spdo", "uac",
                                        "uda";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_ck32 {
                                nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
                                        "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
-                               nvidia,pull = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
                        };
                        conf_crtp {
                                nvidia,pins = "crtp", "dap3", "dap4", "dtb",
                                        "dtc", "dte", "slxa", "slxc", "slxd",
                                        "spdi";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_csus {
                                nvidia,pins = "csus", "spia", "spib", "spid",
                                        "spif";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_ddc {
                                nvidia,pins = "ddc", "irrx", "irtx", "kbca",
                                        "kbcb", "kbcc", "kbcd", "kbce", "kbcf",
                                        "spic", "spig", "uaa", "uab";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_dta {
                                nvidia,pins = "dta", "dtd", "owc", "sdc", "sdd",
                                        "spie", "spih", "uad", "uca", "ucb";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_hdint {
                                nvidia,pins = "hdint", "ld0", "ld1", "ld2",
                                        "ld13", "ld14", "ld15", "ld16", "ld17",
                                        "ldc", "ldi", "lhs", "lsc0", "lspi",
                                        "lvs", "pmc";
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_lc {
                                nvidia,pins = "lc", "ls";
-                               nvidia,pull = <2>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
                        };
                        conf_lcsn {
                                nvidia,pins = "lcsn", "lhp0", "lhp1", "lhp2",
                                        "lm0", "lm1", "lpp", "lpw0", "lpw1",
                                        "lpw2", "lsc1", "lsck", "lsda", "lsdi",
                                        "lvp0", "lvp1", "sdb";
-                               nvidia,tristate = <1>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_ld17_0 {
                                nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
                                        "ld23_22";
-                               nvidia,pull = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                        };
                };
        };
                clock-frequency = <100000>;
        };
 
-       nvec {
+       nvec@7000c500 {
                compatible = "nvidia,nvec";
                reg = <0x7000c500 0x100>;
                interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA20_CLK_I2C3>,
                         <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
                clock-names = "div-clk", "fast-clk";
+               resets = <&tegra_car 67>;
+               reset-names = "i2c";
        };
 
        i2c@7000d000 {
                };
        };
 
-       pmc {
+       pmc@7000e400 {
                nvidia,invert-interrupt;
                nvidia,suspend-mode = <1>;
                nvidia,cpu-pwr-good-time = <2000>;
                #address-cells = <1>;
                #size-cells = <0>;
 
-               clk32k_in: clock {
+               clk32k_in: clock@0 {
                        compatible = "fixed-clock";
                        reg=<0>;
                        #clock-cells = <0>;
                power {
                        label = "Power";
                        gpios = <&gpio TEGRA_GPIO(J, 7) GPIO_ACTIVE_LOW>;
-                       linux,code = <116>; /* KEY_POWER */
+                       linux,code = <KEY_POWER>;
                        gpio-key,wakeup;
                };
        };
index d7a358a6a647aa9668bebb24ffb76bfa6154055e..29051a2ae0aed6194c77e1a5e323fd88484e3b57 100644 (file)
@@ -6,8 +6,8 @@
        model = "Avionic Design Plutux board";
        compatible = "ad,plutux", "ad,tamonten", "nvidia,tegra20";
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               hdmi@54280000 {
                        status = "okay";
                };
        };
index 315aae26c3cdb1e2ed84f741e8669cfadf870524..a11b6e7b47595eb22a17a4c4d293b7614478e156 100644 (file)
@@ -1,17 +1,23 @@
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
 #include "tegra20.dtsi"
 
 / {
        model = "NVIDIA Seaboard";
        compatible = "nvidia,seaboard", "nvidia,tegra20";
 
+       aliases {
+               rtc0 = "/i2c@7000d000/tps6586x@34";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x00000000 0x40000000>;
        };
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               hdmi@54280000 {
                        status = "okay";
 
                        vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +29,7 @@
                };
        };
 
-       pinmux {
+       pinmux@70000014 {
                pinctrl-names = "default";
                pinctrl-0 = <&state_default>;
 
                                        "irtx", "pta", "rm", "sdc", "sdd",
                                        "slxd", "slxk", "spdi", "spdo", "uac",
                                        "uad", "uca", "ucb", "uda";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_ate {
                                nvidia,pins = "ate", "csus", "dap3",
                                        "gpv", "owc", "slxc", "spib", "spid",
                                        "spie";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_ck32 {
                                nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
                                        "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
-                               nvidia,pull = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
                        };
                        conf_crtp {
                                nvidia,pins = "crtp", "gmb", "slxa", "spia",
                                        "spig", "spih";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_dta {
                                nvidia,pins = "dta", "dtb", "dtc", "dtd";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_dte {
                                nvidia,pins = "dte", "spif";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_hdint {
                                nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
                                        "lpw1", "lsc1", "lsck", "lsda", "lsdi",
                                        "lvp0";
-                               nvidia,tristate = <1>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_kbca {
                                nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd",
                                        "kbce", "kbcf", "sdio1", "spic", "uaa",
                                        "uab";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_lc {
                                nvidia,pins = "lc", "ls";
-                               nvidia,pull = <2>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
                        };
                        conf_ld0 {
                                nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
                                        "lhp1", "lhp2", "lhs", "lm0", "lpp",
                                        "lpw0", "lpw2", "lsc0", "lspi", "lvp1",
                                        "lvs", "pmc", "sdb";
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_ld17_0 {
                                nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
                                        "ld23_22";
-                               nvidia,pull = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                        };
                        drive_sdio1 {
                                nvidia,pins = "drive_sdio1";
-                               nvidia,high-speed-mode = <0>;
-                               nvidia,schmitt = <0>;
-                               nvidia,low-power-mode = <3>;
+                               nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
+                               nvidia,schmitt = <TEGRA_PIN_DISABLE>;
+                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
                                nvidia,pull-down-strength = <31>;
                                nvidia,pull-up-strength = <31>;
-                               nvidia,slew-rate-rising = <3>;
-                               nvidia,slew-rate-falling = <3>;
+                               nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_SLOWEST>;
+                               nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_SLOWEST>;
                        };
                };
 
                status = "okay";
                clock-frequency = <400000>;
 
+               magnetometer@c {
+                       compatible = "ak,ak8975";
+                       reg = <0xc>;
+                       interrupt-parent = <&gpio>;
+                       interrupts = <TEGRA_GPIO(N, 5) IRQ_TYPE_LEVEL_HIGH>;
+               };
+
                pmic: tps6586x@34 {
                        compatible = "ti,tps6586x";
                        reg = <0x34>;
                        compatible = "onnn,nct1008";
                        reg = <0x4c>;
                };
+       };
 
-               magnetometer@c {
-                       compatible = "ak,ak8975";
-                       reg = <0xc>;
-                       interrupt-parent = <&gpio>;
-                       interrupts = <TEGRA_GPIO(N, 5) IRQ_TYPE_LEVEL_HIGH>;
-               };
+       kbc@7000e200 {
+               status = "okay";
+               nvidia,debounce-delay-ms = <32>;
+               nvidia,repeat-delay-ms = <160>;
+               nvidia,ghost-filter;
+               nvidia,kbc-row-pins = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15>;
+               nvidia,kbc-col-pins = <16 17 18 19 20 21 22 23>;
+               linux,keymap = <MATRIX_KEY(0x00, 0x02, KEY_W)
+                               MATRIX_KEY(0x00, 0x03, KEY_S)
+                               MATRIX_KEY(0x00, 0x04, KEY_A)
+                               MATRIX_KEY(0x00, 0x05, KEY_Z)
+                               MATRIX_KEY(0x00, 0x07, KEY_FN)
+
+                               MATRIX_KEY(0x01, 0x07, KEY_LEFTMETA)
+                               MATRIX_KEY(0x02, 0x06, KEY_RIGHTALT)
+                               MATRIX_KEY(0x02, 0x07, KEY_LEFTALT)
+
+                               MATRIX_KEY(0x03, 0x00, KEY_5)
+                               MATRIX_KEY(0x03, 0x01, KEY_4)
+                               MATRIX_KEY(0x03, 0x02, KEY_R)
+                               MATRIX_KEY(0x03, 0x03, KEY_E)
+                               MATRIX_KEY(0x03, 0x04, KEY_F)
+                               MATRIX_KEY(0x03, 0x05, KEY_D)
+                               MATRIX_KEY(0x03, 0x06, KEY_X)
+
+                               MATRIX_KEY(0x04, 0x00, KEY_7)
+                               MATRIX_KEY(0x04, 0x01, KEY_6)
+                               MATRIX_KEY(0x04, 0x02, KEY_T)
+                               MATRIX_KEY(0x04, 0x03, KEY_H)
+                               MATRIX_KEY(0x04, 0x04, KEY_G)
+                               MATRIX_KEY(0x04, 0x05, KEY_V)
+                               MATRIX_KEY(0x04, 0x06, KEY_C)
+                               MATRIX_KEY(0x04, 0x07, KEY_SPACE)
+
+                               MATRIX_KEY(0x05, 0x00, KEY_9)
+                               MATRIX_KEY(0x05, 0x01, KEY_8)
+                               MATRIX_KEY(0x05, 0x02, KEY_U)
+                               MATRIX_KEY(0x05, 0x03, KEY_Y)
+                               MATRIX_KEY(0x05, 0x04, KEY_J)
+                               MATRIX_KEY(0x05, 0x05, KEY_N)
+                               MATRIX_KEY(0x05, 0x06, KEY_B)
+                               MATRIX_KEY(0x05, 0x07, KEY_BACKSLASH)
+
+                               MATRIX_KEY(0x06, 0x00, KEY_MINUS)
+                               MATRIX_KEY(0x06, 0x01, KEY_0)
+                               MATRIX_KEY(0x06, 0x02, KEY_O)
+                               MATRIX_KEY(0x06, 0x03, KEY_I)
+                               MATRIX_KEY(0x06, 0x04, KEY_L)
+                               MATRIX_KEY(0x06, 0x05, KEY_K)
+                               MATRIX_KEY(0x06, 0x06, KEY_COMMA)
+                               MATRIX_KEY(0x06, 0x07, KEY_M)
+
+                               MATRIX_KEY(0x07, 0x01, KEY_EQUAL)
+                               MATRIX_KEY(0x07, 0x02, KEY_RIGHTBRACE)
+                               MATRIX_KEY(0x07, 0x03, KEY_ENTER)
+                               MATRIX_KEY(0x07, 0x07, KEY_MENU)
+
+                               MATRIX_KEY(0x08, 0x04, KEY_RIGHTSHIFT)
+                               MATRIX_KEY(0x08, 0x05, KEY_LEFTSHIFT)
+
+                               MATRIX_KEY(0x09, 0x05, KEY_RIGHTCTRL)
+                               MATRIX_KEY(0x09, 0x07, KEY_LEFTCTRL)
+
+                               MATRIX_KEY(0x0B, 0x00, KEY_LEFTBRACE)
+                               MATRIX_KEY(0x0B, 0x01, KEY_P)
+                               MATRIX_KEY(0x0B, 0x02, KEY_APOSTROPHE)
+                               MATRIX_KEY(0x0B, 0x03, KEY_SEMICOLON)
+                               MATRIX_KEY(0x0B, 0x04, KEY_SLASH)
+                               MATRIX_KEY(0x0B, 0x05, KEY_DOT)
+
+                               MATRIX_KEY(0x0C, 0x00, KEY_F10)
+                               MATRIX_KEY(0x0C, 0x01, KEY_F9)
+                               MATRIX_KEY(0x0C, 0x02, KEY_BACKSPACE)
+                               MATRIX_KEY(0x0C, 0x03, KEY_3)
+                               MATRIX_KEY(0x0C, 0x04, KEY_2)
+                               MATRIX_KEY(0x0C, 0x05, KEY_UP)
+                               MATRIX_KEY(0x0C, 0x06, KEY_PRINT)
+                               MATRIX_KEY(0x0C, 0x07, KEY_PAUSE)
+
+                               MATRIX_KEY(0x0D, 0x00, KEY_INSERT)
+                               MATRIX_KEY(0x0D, 0x01, KEY_DELETE)
+                               MATRIX_KEY(0x0D, 0x03, KEY_PAGEUP )
+                               MATRIX_KEY(0x0D, 0x04, KEY_PAGEDOWN)
+                               MATRIX_KEY(0x0D, 0x05, KEY_RIGHT)
+                               MATRIX_KEY(0x0D, 0x06, KEY_DOWN)
+                               MATRIX_KEY(0x0D, 0x07, KEY_LEFT)
+
+                               MATRIX_KEY(0x0E, 0x00, KEY_F11)
+                               MATRIX_KEY(0x0E, 0x01, KEY_F12)
+                               MATRIX_KEY(0x0E, 0x02, KEY_F8)
+                               MATRIX_KEY(0x0E, 0x03, KEY_Q)
+                               MATRIX_KEY(0x0E, 0x04, KEY_F4)
+                               MATRIX_KEY(0x0E, 0x05, KEY_F3)
+                               MATRIX_KEY(0x0E, 0x06, KEY_1)
+                               MATRIX_KEY(0x0E, 0x07, KEY_F7)
+
+                               MATRIX_KEY(0x0F, 0x00, KEY_ESC)
+                               MATRIX_KEY(0x0F, 0x01, KEY_GRAVE)
+                               MATRIX_KEY(0x0F, 0x02, KEY_F5)
+                               MATRIX_KEY(0x0F, 0x03, KEY_TAB)
+                               MATRIX_KEY(0x0F, 0x04, KEY_F1)
+                               MATRIX_KEY(0x0F, 0x05, KEY_F2)
+                               MATRIX_KEY(0x0F, 0x06, KEY_CAPSLOCK)
+                               MATRIX_KEY(0x0F, 0x07, KEY_F6)
+
+                               /* Software Handled Function Keys */
+                               MATRIX_KEY(0x14, 0x00, KEY_KP7)
+
+                               MATRIX_KEY(0x15, 0x00, KEY_KP9)
+                               MATRIX_KEY(0x15, 0x01, KEY_KP8)
+                               MATRIX_KEY(0x15, 0x02, KEY_KP4)
+                               MATRIX_KEY(0x15, 0x04, KEY_KP1)
+
+                               MATRIX_KEY(0x16, 0x01, KEY_KPSLASH)
+                               MATRIX_KEY(0x16, 0x02, KEY_KP6)
+                               MATRIX_KEY(0x16, 0x03, KEY_KP5)
+                               MATRIX_KEY(0x16, 0x04, KEY_KP3)
+                               MATRIX_KEY(0x16, 0x05, KEY_KP2)
+                               MATRIX_KEY(0x16, 0x07, KEY_KP0)
+
+                               MATRIX_KEY(0x1B, 0x01, KEY_KPASTERISK)
+                               MATRIX_KEY(0x1B, 0x03, KEY_KPMINUS)
+                               MATRIX_KEY(0x1B, 0x04, KEY_KPPLUS)
+                               MATRIX_KEY(0x1B, 0x05, KEY_KPDOT)
+
+                               MATRIX_KEY(0x1C, 0x05, KEY_VOLUMEUP)
+
+                               MATRIX_KEY(0x1D, 0x03, KEY_HOME)
+                               MATRIX_KEY(0x1D, 0x04, KEY_END)
+                               MATRIX_KEY(0x1D, 0x05, KEY_BRIGHTNESSDOWN)
+                               MATRIX_KEY(0x1D, 0x06, KEY_VOLUMEDOWN)
+                               MATRIX_KEY(0x1D, 0x07, KEY_BRIGHTNESSUP)
+
+                               MATRIX_KEY(0x1E, 0x00, KEY_NUMLOCK)
+                               MATRIX_KEY(0x1E, 0x01, KEY_SCROLLLOCK)
+                               MATRIX_KEY(0x1E, 0x02, KEY_MUTE)
+
+                               MATRIX_KEY(0x1F, 0x04, KEY_HELP)>;
        };
 
-       pmc {
+       pmc@7000e400 {
                nvidia,invert-interrupt;
                nvidia,suspend-mode = <1>;
                nvidia,cpu-pwr-good-time = <5000>;
                #address-cells = <1>;
                #size-cells = <0>;
 
-               clk32k_in: clock {
+               clk32k_in: clock@0 {
                        compatible = "fixed-clock";
                        reg=<0>;
                        #clock-cells = <0>;
                power {
                        label = "Power";
                        gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
-                       linux,code = <116>; /* KEY_POWER */
+                       linux,code = <KEY_POWER>;
                        gpio-key,wakeup;
                };
 
                };
        };
 
-       kbc {
-               status = "okay";
-               nvidia,debounce-delay-ms = <32>;
-               nvidia,repeat-delay-ms = <160>;
-               nvidia,ghost-filter;
-               nvidia,kbc-row-pins = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15>;
-               nvidia,kbc-col-pins = <16 17 18 19 20 21 22 23>;
-               linux,keymap = <0x00020011      /* KEY_W */
-                               0x0003001F      /* KEY_S */
-                               0x0004001E      /* KEY_A */
-                               0x0005002C      /* KEY_Z */
-                               0x000701d0      /* KEY_FN */
-
-                               0x0107007D      /* KEY_LEFTMETA */
-                               0x02060064      /* KEY_RIGHTALT */
-                               0x02070038      /* KEY_LEFTALT */
-
-                               0x03000006      /* KEY_5 */
-                               0x03010005      /* KEY_4 */
-                               0x03020013      /* KEY_R */
-                               0x03030012      /* KEY_E */
-                               0x03040021      /* KEY_F */
-                               0x03050020      /* KEY_D */
-                               0x0306002D      /* KEY_X */
-
-                               0x04000008      /* KEY_7 */
-                               0x04010007      /* KEY_6 */
-                               0x04020014      /* KEY_T */
-                               0x04030023      /* KEY_H */
-                               0x04040022      /* KEY_G */
-                               0x0405002F      /* KEY_V */
-                               0x0406002E      /* KEY_C */
-                               0x04070039      /* KEY_SPACE */
-
-                               0x0500000A      /* KEY_9 */
-                               0x05010009      /* KEY_8 */
-                               0x05020016      /* KEY_U */
-                               0x05030015      /* KEY_Y */
-                               0x05040024      /* KEY_J */
-                               0x05050031      /* KEY_N */
-                               0x05060030      /* KEY_B */
-                               0x0507002B      /* KEY_BACKSLASH */
-
-                               0x0600000C      /* KEY_MINUS */
-                               0x0601000B      /* KEY_0 */
-                               0x06020018      /* KEY_O */
-                               0x06030017      /* KEY_I */
-                               0x06040026      /* KEY_L */
-                               0x06050025      /* KEY_K */
-                               0x06060033      /* KEY_COMMA */
-                               0x06070032      /* KEY_M */
-
-                               0x0701000D      /* KEY_EQUAL */
-                               0x0702001B      /* KEY_RIGHTBRACE */
-                               0x0703001C      /* KEY_ENTER */
-                               0x0707008B      /* KEY_MENU */
-
-                               0x08040036      /* KEY_RIGHTSHIFT */
-                               0x0805002A      /* KEY_LEFTSHIFT */
-
-                               0x09050061      /* KEY_RIGHTCTRL */
-                               0x0907001D      /* KEY_LEFTCTRL */
-
-                               0x0B00001A      /* KEY_LEFTBRACE */
-                               0x0B010019      /* KEY_P */
-                               0x0B020028      /* KEY_APOSTROPHE */
-                               0x0B030027      /* KEY_SEMICOLON */
-                               0x0B040035      /* KEY_SLASH */
-                               0x0B050034      /* KEY_DOT */
-
-                               0x0C000044      /* KEY_F10 */
-                               0x0C010043      /* KEY_F9 */
-                               0x0C02000E      /* KEY_BACKSPACE */
-                               0x0C030004      /* KEY_3 */
-                               0x0C040003      /* KEY_2 */
-                               0x0C050067      /* KEY_UP */
-                               0x0C0600D2      /* KEY_PRINT */
-                               0x0C070077      /* KEY_PAUSE */
-
-                               0x0D00006E      /* KEY_INSERT */
-                               0x0D01006F      /* KEY_DELETE */
-                               0x0D030068      /* KEY_PAGEUP  */
-                               0x0D04006D      /* KEY_PAGEDOWN */
-                               0x0D05006A      /* KEY_RIGHT */
-                               0x0D06006C      /* KEY_DOWN */
-                               0x0D070069      /* KEY_LEFT */
-
-                               0x0E000057      /* KEY_F11 */
-                               0x0E010058      /* KEY_F12 */
-                               0x0E020042      /* KEY_F8 */
-                               0x0E030010      /* KEY_Q */
-                               0x0E04003E      /* KEY_F4 */
-                               0x0E05003D      /* KEY_F3 */
-                               0x0E060002      /* KEY_1 */
-                               0x0E070041      /* KEY_F7 */
-
-                               0x0F000001      /* KEY_ESC */
-                               0x0F010029      /* KEY_GRAVE */
-                               0x0F02003F      /* KEY_F5 */
-                               0x0F03000F      /* KEY_TAB */
-                               0x0F04003B      /* KEY_F1 */
-                               0x0F05003C      /* KEY_F2 */
-                               0x0F06003A      /* KEY_CAPSLOCK */
-                               0x0F070040      /* KEY_F6 */
-
-                               /* Software Handled Function Keys */
-                               0x14000047      /* KEY_KP7 */
-
-                               0x15000049      /* KEY_KP9 */
-                               0x15010048      /* KEY_KP8 */
-                               0x1502004B      /* KEY_KP4 */
-                               0x1504004F      /* KEY_KP1 */
-
-                               0x1601004E      /* KEY_KPSLASH */
-                               0x1602004D      /* KEY_KP6 */
-                               0x1603004C      /* KEY_KP5 */
-                               0x16040051      /* KEY_KP3 */
-                               0x16050050      /* KEY_KP2 */
-                               0x16070052      /* KEY_KP0 */
-
-                               0x1B010037      /* KEY_KPASTERISK */
-                               0x1B03004A      /* KEY_KPMINUS */
-                               0x1B04004E      /* KEY_KPPLUS */
-                               0x1B050053      /* KEY_KPDOT */
-
-                               0x1C050073      /* KEY_VOLUMEUP */
-
-                               0x1D030066      /* KEY_HOME */
-                               0x1D04006B      /* KEY_END */
-                               0x1D0500E0      /* KEY_BRIGHTNESSDOWN */
-                               0x1D060072      /* KEY_VOLUMEDOWN */
-                               0x1D0700E1      /* KEY_BRIGHTNESSUP */
-
-                               0x1E000045      /* KEY_NUMLOCK */
-                               0x1E010046      /* KEY_SCROLLLOCK */
-                               0x1E020071      /* KEY_MUTE */
-
-                               0x1F04008A>;    /* KEY_HELP */
-       };
        regulators {
                compatible = "simple-bus";
                #address-cells = <1>;
index 7726dab3d08d520c4656b11a558b905b842f909b..a1b0d965757f49a757b9dd4b88e4b427b236a8a9 100644 (file)
@@ -4,12 +4,17 @@
        model = "Avionic Design Tamonten SOM";
        compatible = "ad,tamonten", "nvidia,tegra20";
 
+       aliases {
+               rtc0 = "/i2c@7000d000/tps6586x@34";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x00000000 0x20000000>;
        };
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               hdmi@54280000 {
                        vdd-supply = <&hdmi_vdd_reg>;
                        pll-supply = <&hdmi_pll_reg>;
 
@@ -19,7 +24,7 @@
                };
        };
 
-       pinmux {
+       pinmux@70000014 {
                pinctrl-names = "default";
                pinctrl-0 = <&state_default>;
 
                                        "gmb", "gmc", "gmd", "gme", "gpu7",
                                        "gpv", "i2cp", "pta", "rm", "slxa",
                                        "slxk", "spia", "spib", "uac";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_ck32 {
                                nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
                                        "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
-                               nvidia,pull = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
                        };
                        conf_csus {
                                nvidia,pins = "csus", "spid", "spif";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_crtp {
                                nvidia,pins = "crtp", "dap2", "dap3", "dap4",
                                        "dtc", "dte", "dtf", "gpu", "sdio1",
                                        "slxc", "slxd", "spdi", "spdo", "spig",
                                        "uda";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_ddc {
                                nvidia,pins = "ddc", "dta", "dtd", "kbca",
                                        "kbcb", "kbcc", "kbcd", "kbce", "kbcf",
                                        "sdc";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_hdint {
                                nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
                                        "lpw1", "lsc1", "lsck", "lsda", "lsdi",
                                        "lvp0", "owc", "sdb";
-                               nvidia,tristate = <1>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_irrx {
                                nvidia,pins = "irrx", "irtx", "sdd", "spic",
                                        "spie", "spih", "uaa", "uab", "uad",
                                        "uca", "ucb";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_lc {
                                nvidia,pins = "lc", "ls";
-                               nvidia,pull = <2>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
                        };
                        conf_ld0 {
                                nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
                                        "lhp1", "lhp2", "lhs", "lm0", "lpp",
                                        "lpw0", "lpw2", "lsc0", "lspi", "lvp1",
                                        "lvs", "pmc";
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_ld17_0 {
                                nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
                                        "ld23_22";
-                               nvidia,pull = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                        };
                };
 
                };
        };
 
-       pmc {
+       pmc@7000e400 {
                nvidia,invert-interrupt;
                nvidia,suspend-mode = <1>;
                nvidia,cpu-pwr-good-time = <5000>;
                nvidia,sys-clock-req-active-high;
        };
 
-       pcie-controller {
+       pcie-controller@80003000 {
                pex-clk-supply = <&pci_clk_reg>;
                vdd-supply = <&pci_vdd_reg>;
        };
                #address-cells = <1>;
                #size-cells = <0>;
 
-               clk32k_in: clock {
+               clk32k_in: clock@0 {
                        compatible = "fixed-clock";
                        reg=<0>;
                        #clock-cells = <0>;
index 3ada3cb67f07bd32689ddc3f780f45c9541faa74..890562c667fbee28b6713e0f5f74314ad98e8470 100644 (file)
@@ -6,8 +6,8 @@
        model = "Avionic Design Tamonten Evaluation Carrier";
        compatible = "ad,tec", "ad,tamonten", "nvidia,tegra20";
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               hdmi@54280000 {
                        status = "okay";
                };
        };
@@ -32,7 +32,7 @@
                };
        };
 
-       pcie-controller {
+       pcie-controller@80003000 {
                status = "okay";
 
                pci@1,0 {
index 78deea5c0d217342979e1940cdaa912f9d53696a..216fa6d50c65439f86d6049a089ee0396c68ec09 100644 (file)
@@ -1,17 +1,23 @@
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
 #include "tegra20.dtsi"
 
 / {
        model = "Compulab TrimSlice board";
        compatible = "compulab,trimslice", "nvidia,tegra20";
 
+       aliases {
+               rtc0 = "/i2c@7000c500/rtc@56";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x00000000 0x40000000>;
        };
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               hdmi@54280000 {
                        status = "okay";
 
                        vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +29,7 @@
                };
        };
 
-       pinmux {
+       pinmux@70000014 {
                pinctrl-names = "default";
                pinctrl-0 = <&state_default>;
 
                                        "dtb", "dtc", "dtd", "dte", "gmb",
                                        "gme", "i2cp", "pta", "slxc", "slxd",
                                        "spdi", "spdo", "uda";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_atb {
                                nvidia,pins = "atb", "cdev1", "cdev2", "dap1",
                                        "gma", "gmc", "gmd", "gpu", "gpu7",
                                        "gpv", "sdio1", "slxa", "slxk", "uac";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_ck32 {
                                nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
                                        "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
-                               nvidia,pull = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
                        };
                        conf_csus {
                                nvidia,pins = "csus", "spia", "spib",
                                        "spid", "spif";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_ddc {
                                nvidia,pins = "ddc", "dtf", "rm", "sdc", "sdd";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_hdint {
                                nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
                                        "lpw1", "lsc1", "lsck", "lsda", "lsdi",
                                        "lvp0", "pmc";
-                               nvidia,tristate = <1>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_irrx {
                                nvidia,pins = "irrx", "irtx", "kbca", "kbcb",
                                        "kbcc", "kbcd", "kbce", "kbcf", "owc",
                                        "spic", "spie", "spig", "spih", "uaa",
                                        "uab", "uad", "uca", "ucb";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_lc {
                                nvidia,pins = "lc", "ls";
-                               nvidia,pull = <2>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
                        };
                        conf_ld0 {
                                nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
                                        "lhp1", "lhp2", "lhs", "lm0", "lpp",
                                        "lpw0", "lpw2", "lsc0", "lspi", "lvp1",
                                        "lvs", "sdb";
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_ld17_0 {
                                nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
                                        "ld23_22";
-                               nvidia,pull = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                        };
                        conf_spif {
                                nvidia,pins = "spif";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                };
        };
                };
        };
 
-       pmc {
+       pmc@7000e400 {
                nvidia,suspend-mode = <1>;
                nvidia,cpu-pwr-good-time = <5000>;
                nvidia,cpu-pwr-off-time = <5000>;
                nvidia,sys-clock-req-active-high;
        };
 
-       pcie-controller {
+       pcie-controller@80003000 {
                status = "okay";
                pex-clk-supply = <&pci_clk_reg>;
                vdd-supply = <&pci_vdd_reg>;
                #address-cells = <1>;
                #size-cells = <0>;
 
-               clk32k_in: clock {
+               clk32k_in: clock@0 {
                        compatible = "fixed-clock";
                        reg=<0>;
                        #clock-cells = <0>;
                power {
                        label = "Power";
                        gpios = <&gpio TEGRA_GPIO(X, 6) GPIO_ACTIVE_LOW>;
-                       linux,code = <116>; /* KEY_POWER */
+                       linux,code = <KEY_POWER>;
                        gpio-key,wakeup;
                };
        };
index aab872cd05300cd3084a3cb3e3edb11bdd757b90..571d12e6ac2d0e6164d5a73ca07c033070ea4b5e 100644 (file)
@@ -1,17 +1,23 @@
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
 #include "tegra20.dtsi"
 
 / {
        model = "NVIDIA Tegra20 Ventana evaluation board";
        compatible = "nvidia,ventana", "nvidia,tegra20";
 
+       aliases {
+               rtc0 = "/i2c@7000d000/tps6586x@34";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x00000000 0x40000000>;
        };
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               hdmi@54280000 {
                        status = "okay";
 
                        vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +29,7 @@
                };
        };
 
-       pinmux {
+       pinmux@70000014 {
                pinctrl-names = "default";
                pinctrl-0 = <&state_default>;
 
                                        "irtx", "pta", "rm", "sdc", "sdd",
                                        "slxc", "slxd", "slxk", "spdi", "spdo",
                                        "uac", "uad", "uca", "ucb", "uda";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_ate {
                                nvidia,pins = "ate", "csus", "dap3", "gmd",
                                        "gpv", "owc", "spia", "spib", "spic",
                                        "spid", "spie", "spig";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_ck32 {
                                nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
                                        "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
-                               nvidia,pull = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
                        };
                        conf_crtp {
                                nvidia,pins = "crtp", "gmb", "slxa", "spih";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_dta {
                                nvidia,pins = "dta", "dtb", "dtc", "dtd";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_dte {
                                nvidia,pins = "dte", "spif";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_hdint {
                                nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
                                        "lpw1", "lsck", "lsda", "lsdi", "lvp0";
-                               nvidia,tristate = <1>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_kbca {
                                nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd",
                                        "kbce", "kbcf", "sdio1", "uaa", "uab";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_lc {
                                nvidia,pins = "lc", "ls";
-                               nvidia,pull = <2>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
                        };
                        conf_ld0 {
                                nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
                                        "lhp1", "lhp2", "lhs", "lm0", "lpp",
                                        "lpw0", "lpw2", "lsc0", "lsc1", "lspi",
                                        "lvp1", "lvs", "pmc", "sdb";
-                               nvidia,tristate = <0>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_ld17_0 {
                                nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
                                        "ld23_22";
-                               nvidia,pull = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                        };
                        drive_sdio1 {
                                nvidia,pins = "drive_sdio1";
-                               nvidia,high-speed-mode = <0>;
-                               nvidia,schmitt = <1>;
-                               nvidia,low-power-mode = <3>;
+                               nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
+                               nvidia,schmitt = <TEGRA_PIN_ENABLE>;
+                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_1>;
                                nvidia,pull-down-strength = <31>;
                                nvidia,pull-up-strength = <31>;
-                               nvidia,slew-rate-rising = <3>;
-                               nvidia,slew-rate-falling = <3>;
+                               nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_SLOWEST>;
+                               nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_SLOWEST>;
                        };
                };
 
                };
        };
 
-       pmc {
+       pmc@7000e400 {
                nvidia,invert-interrupt;
                nvidia,suspend-mode = <1>;
                nvidia,cpu-pwr-good-time = <2000>;
                #address-cells = <1>;
                #size-cells = <0>;
 
-               clk32k_in: clock {
+               clk32k_in: clock@0 {
                        compatible = "fixed-clock";
                        reg=<0>;
                        #clock-cells = <0>;
                power {
                        label = "Power";
                        gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
-                       linux,code = <116>; /* KEY_POWER */
+                       linux,code = <KEY_POWER>;
                        gpio-key,wakeup;
                };
        };
index d33a73cf167c42b295b5b8252608176888759875..1843725785c90f1f2518bade455af7dead4c6ec8 100644 (file)
@@ -1,17 +1,23 @@
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
 #include "tegra20.dtsi"
 
 / {
        model = "NVIDIA Tegra20 Whistler evaluation board";
        compatible = "nvidia,whistler", "nvidia,tegra20";
 
+       aliases {
+               rtc0 = "/i2c@7000d000/max8907@3c";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x00000000 0x20000000>;
        };
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               hdmi@54280000 {
                        status = "okay";
 
                        vdd-supply = <&hdmi_vdd_reg>;
@@ -23,7 +29,7 @@
                };
        };
 
-       pinmux {
+       pinmux@70000014 {
                pinctrl-names = "default";
                pinctrl-0 = <&state_default>;
 
                                        "kbcf", "sdc", "sdd", "spie", "spig",
                                        "spih", "uaa", "uab", "uad", "uca",
                                        "ucb";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_atd {
                                nvidia,pins = "atd", "ate", "cdev1", "csus",
                                        "dtf", "gpu", "gpu7", "gpv", "i2cp",
                                        "rm", "sdio1", "slxa", "slxc", "slxd",
                                        "slxk", "spdi", "spdo", "uac", "uda";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_cdev2 {
                                nvidia,pins = "cdev2", "spia", "spib";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_ck32 {
                                nvidia,pins = "ck32", "ddrc", "lc", "pmca",
                                        "pmcb", "pmcc", "pmcd", "xm2c",
                                        "xm2d";
-                               nvidia,pull = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
                        };
                        conf_crtp {
                                nvidia,pins = "crtp";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_dta {
                                nvidia,pins = "dta", "dtb", "dtc", "dtd",
                                        "spid", "spif";
-                               nvidia,pull = <1>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        conf_gme {
                                nvidia,pins = "gme", "owc", "pta", "spic";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
                        };
                        conf_ld17_0 {
                                nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
                                        "ld23_22";
-                               nvidia,pull = <1>;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                        };
                        conf_ls {
                                nvidia,pins = "ls", "pmce";
-                               nvidia,pull = <2>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
                        };
                        drive_dap1 {
                                nvidia,pins = "drive_dap1";
-                               nvidia,high-speed-mode = <0>;
-                               nvidia,schmitt = <1>;
-                               nvidia,low-power-mode = <0>;
+                               nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
+                               nvidia,schmitt = <TEGRA_PIN_ENABLE>;
+                               nvidia,low-power-mode = <TEGRA_PIN_LP_DRIVE_DIV_8>;
                                nvidia,pull-down-strength = <0>;
                                nvidia,pull-up-strength = <0>;
-                               nvidia,slew-rate-rising = <0>;
-                               nvidia,slew-rate-falling = <0>;
+                               nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FASTEST>;
+                               nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FASTEST>;
                        };
                };
        };
                };
        };
 
-       pmc {
+       kbc@7000e200 {
+               status = "okay";
+               nvidia,debounce-delay-ms = <20>;
+               nvidia,repeat-delay-ms = <160>;
+               nvidia,kbc-row-pins = <0 1 2>;
+               nvidia,kbc-col-pins = <16 17>;
+               nvidia,wakeup-source;
+               linux,keymap = <MATRIX_KEY(0x00, 0x00, KEY_POWER)
+                               MATRIX_KEY(0x01, 0x00, KEY_HOME)
+                               MATRIX_KEY(0x01, 0x01, KEY_BACK)
+                               MATRIX_KEY(0x02, 0x01, KEY_MENU)>;
+       };
+
+       pmc@7000e400 {
                nvidia,invert-interrupt;
                nvidia,suspend-mode = <1>;
                nvidia,cpu-pwr-good-time = <2000>;
                #address-cells = <1>;
                #size-cells = <0>;
 
-               clk32k_in: clock {
+               clk32k_in: clock@0 {
                        compatible = "fixed-clock";
                        reg=<0>;
                        #clock-cells = <0>;
                };
        };
 
-       kbc {
-               status = "okay";
-               nvidia,debounce-delay-ms = <20>;
-               nvidia,repeat-delay-ms = <160>;
-               nvidia,kbc-row-pins = <0 1 2>;
-               nvidia,kbc-col-pins = <16 17>;
-               nvidia,wakeup-source;
-               linux,keymap = <0x00000074      /* KEY_POWER */
-                               0x01000066      /* KEY_HOME */
-                               0x0101009E      /* KEY_BACK */
-                               0x0201008B>;    /* KEY_MENU */
-       };
-
        regulators {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <0>;
 
-               usb0_vbus_reg: regulator {
+               usb0_vbus_reg: regulator@0 {
                        compatible = "regulator-fixed";
                        reg = <0>;
                        regulator-name = "usb0_vbus";
index df40b54fd8bca58eeeb610d6a5c755d4fec51aae..480ecda3416b841b8941105d24646f1240f5ab37 100644 (file)
@@ -1,5 +1,6 @@
 #include <dt-bindings/clock/tegra20-car.h>
 #include <dt-bindings/gpio/tegra-gpio.h>
+#include <dt-bindings/pinctrl/pinctrl-tegra.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
 #include "skeleton.dtsi"
                serial4 = &uarte;
        };
 
-       host1x {
+       host1x@50000000 {
                compatible = "nvidia,tegra20-host1x", "simple-bus";
                reg = <0x50000000 0x00024000>;
                interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */
                             <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */
                clocks = <&tegra_car TEGRA20_CLK_HOST1X>;
+               resets = <&tegra_car 28>;
+               reset-names = "host1x";
 
                #address-cells = <1>;
                #size-cells = <1>;
 
                ranges = <0x54000000 0x54000000 0x04000000>;
 
-               mpe {
+               mpe@54040000 {
                        compatible = "nvidia,tegra20-mpe";
                        reg = <0x54040000 0x00040000>;
                        interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA20_CLK_MPE>;
+                       resets = <&tegra_car 60>;
+                       reset-names = "mpe";
                };
 
-               vi {
+               vi@54080000 {
                        compatible = "nvidia,tegra20-vi";
                        reg = <0x54080000 0x00040000>;
                        interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA20_CLK_VI>;
+                       resets = <&tegra_car 20>;
+                       reset-names = "vi";
                };
 
-               epp {
+               epp@540c0000 {
                        compatible = "nvidia,tegra20-epp";
                        reg = <0x540c0000 0x00040000>;
                        interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA20_CLK_EPP>;
+                       resets = <&tegra_car 19>;
+                       reset-names = "epp";
                };
 
-               isp {
+               isp@54100000 {
                        compatible = "nvidia,tegra20-isp";
                        reg = <0x54100000 0x00040000>;
                        interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA20_CLK_ISP>;
+                       resets = <&tegra_car 23>;
+                       reset-names = "isp";
                };
 
-               gr2d {
+               gr2d@54140000 {
                        compatible = "nvidia,tegra20-gr2d";
                        reg = <0x54140000 0x00040000>;
                        interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA20_CLK_GR2D>;
+                       resets = <&tegra_car 21>;
+                       reset-names = "2d";
                };
 
-               gr3d {
+               gr3d@54140000 {
                        compatible = "nvidia,tegra20-gr3d";
-                       reg = <0x54180000 0x00040000>;
+                       reg = <0x54140000 0x00040000>;
                        clocks = <&tegra_car TEGRA20_CLK_GR3D>;
+                       resets = <&tegra_car 24>;
+                       reset-names = "3d";
                };
 
                dc@54200000 {
@@ -75,7 +90,9 @@
                        interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA20_CLK_DISP1>,
                                 <&tegra_car TEGRA20_CLK_PLL_P>;
-                       clock-names = "disp1", "parent";
+                       clock-names = "dc", "parent";
+                       resets = <&tegra_car 27>;
+                       reset-names = "dc";
 
                        rgb {
                                status = "disabled";
                        interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA20_CLK_DISP2>,
                                 <&tegra_car TEGRA20_CLK_PLL_P>;
-                       clock-names = "disp2", "parent";
+                       clock-names = "dc", "parent";
+                       resets = <&tegra_car 26>;
+                       reset-names = "dc";
 
                        rgb {
                                status = "disabled";
                        };
                };
 
-               hdmi {
+               hdmi@54280000 {
                        compatible = "nvidia,tegra20-hdmi";
                        reg = <0x54280000 0x00040000>;
                        interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA20_CLK_HDMI>,
                                 <&tegra_car TEGRA20_CLK_PLL_D_OUT0>;
                        clock-names = "hdmi", "parent";
+                       resets = <&tegra_car 51>;
+                       reset-names = "hdmi";
                        status = "disabled";
                };
 
-               tvo {
+               tvo@542c0000 {
                        compatible = "nvidia,tegra20-tvo";
                        reg = <0x542c0000 0x00040000>;
                        interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
                        status = "disabled";
                };
 
-               dsi {
+               dsi@542c0000 {
                        compatible = "nvidia,tegra20-dsi";
-                       reg = <0x54300000 0x00040000>;
+                       reg = <0x542c0000 0x00040000>;
                        clocks = <&tegra_car TEGRA20_CLK_DSI>;
+                       resets = <&tegra_car 48>;
+                       reset-names = "dsi";
                        status = "disabled";
                };
        };
                clocks = <&tegra_car TEGRA20_CLK_TWD>;
        };
 
-       intc: interrupt-controller {
+       intc: interrupt-controller@50041000 {
                compatible = "arm,cortex-a9-gic";
                reg = <0x50041000 0x1000
                       0x50040100 0x0100>;
                #interrupt-cells = <3>;
        };
 
-       cache-controller {
+       cache-controller@50043000 {
                compatible = "arm,pl310-cache";
                reg = <0x50043000 0x1000>;
                arm,data-latency = <5 5 2>;
                clocks = <&tegra_car TEGRA20_CLK_TIMER>;
        };
 
-       tegra_car: clock {
+       tegra_car: clock@60006000 {
                compatible = "nvidia,tegra20-car";
                reg = <0x60006000 0x1000>;
                #clock-cells = <1>;
+               #reset-cells = <1>;
        };
 
-       apbdma: dma {
+       apbdma: dma@6000a000 {
                compatible = "nvidia,tegra20-apbdma";
                reg = <0x6000a000 0x1200>;
                interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA20_CLK_APBDMA>;
+               resets = <&tegra_car 34>;
+               reset-names = "dma";
+               #dma-cells = <1>;
        };
 
-       ahb {
+       ahb@6000c004 {
                compatible = "nvidia,tegra20-ahb";
                reg = <0x6000c004 0x10c>; /* AHB Arbitration + Gizmo Controller */
        };
 
-       gpio: gpio {
+       gpio: gpio@6000d000 {
                compatible = "nvidia,tegra20-gpio";
                reg = <0x6000d000 0x1000>;
                interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
                interrupt-controller;
        };
 
-       pinmux: pinmux {
+       pinmux: pinmux@70000014 {
                compatible = "nvidia,tegra20-pinmux";
                reg = <0x70000014 0x10   /* Tri-state registers */
                       0x70000080 0x20   /* Mux registers */
                       0x70000868 0xa8>; /* Pad control registers */
        };
 
-       das {
+       das@70000c00 {
                compatible = "nvidia,tegra20-das";
                reg = <0x70000c00 0x80>;
        };
 
-       tegra_ac97: ac97 {
+       tegra_ac97: ac97@70002000 {
                compatible = "nvidia,tegra20-ac97";
                reg = <0x70002000 0x200>;
                interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 12>;
                clocks = <&tegra_car TEGRA20_CLK_AC97>;
+               resets = <&tegra_car 3>;
+               reset-names = "ac97";
+               dmas = <&apbdma 12>, <&apbdma 12>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra20-i2s";
                reg = <0x70002800 0x200>;
                interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 2>;
                clocks = <&tegra_car TEGRA20_CLK_I2S1>;
+               resets = <&tegra_car 11>;
+               reset-names = "i2s";
+               dmas = <&apbdma 2>, <&apbdma 2>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra20-i2s";
                reg = <0x70002a00 0x200>;
                interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 1>;
                clocks = <&tegra_car TEGRA20_CLK_I2S2>;
+               resets = <&tegra_car 18>;
+               reset-names = "i2s";
+               dmas = <&apbdma 1>, <&apbdma 1>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006000 0x40>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 8>;
                clocks = <&tegra_car TEGRA20_CLK_UARTA>;
+               resets = <&tegra_car 6>;
+               reset-names = "serial";
+               dmas = <&apbdma 8>, <&apbdma 8>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006040 0x40>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 9>;
                clocks = <&tegra_car TEGRA20_CLK_UARTB>;
+               resets = <&tegra_car 7>;
+               reset-names = "serial";
+               dmas = <&apbdma 9>, <&apbdma 9>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006200 0x100>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 10>;
                clocks = <&tegra_car TEGRA20_CLK_UARTC>;
+               resets = <&tegra_car 55>;
+               reset-names = "serial";
+               dmas = <&apbdma 10>, <&apbdma 10>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006300 0x100>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 19>;
                clocks = <&tegra_car TEGRA20_CLK_UARTD>;
+               resets = <&tegra_car 65>;
+               reset-names = "serial";
+               dmas = <&apbdma 19>, <&apbdma 19>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006400 0x100>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 20>;
                clocks = <&tegra_car TEGRA20_CLK_UARTE>;
+               resets = <&tegra_car 66>;
+               reset-names = "serial";
+               dmas = <&apbdma 20>, <&apbdma 20>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
-       pwm: pwm {
+       pwm: pwm@7000a000 {
                compatible = "nvidia,tegra20-pwm";
                reg = <0x7000a000 0x100>;
                #pwm-cells = <2>;
                clocks = <&tegra_car TEGRA20_CLK_PWM>;
+               resets = <&tegra_car 17>;
+               reset-names = "pwm";
                status = "disabled";
        };
 
-       rtc {
+       rtc@7000e000 {
                compatible = "nvidia,tegra20-rtc";
                reg = <0x7000e000 0x100>;
                interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA20_CLK_I2C1>,
                         <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
                clock-names = "div-clk", "fast-clk";
+               resets = <&tegra_car 12>;
+               reset-names = "i2c";
+               dmas = <&apbdma 21>, <&apbdma 21>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra20-sflash";
                reg = <0x7000c380 0x80>;
                interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 11>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA20_CLK_SPI>;
+               resets = <&tegra_car 43>;
+               reset-names = "spi";
+               dmas = <&apbdma 11>, <&apbdma 11>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                clocks = <&tegra_car TEGRA20_CLK_I2C2>,
                         <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
                clock-names = "div-clk", "fast-clk";
+               resets = <&tegra_car 54>;
+               reset-names = "i2c";
+               dmas = <&apbdma 22>, <&apbdma 22>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                clocks = <&tegra_car TEGRA20_CLK_I2C3>,
                         <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
                clock-names = "div-clk", "fast-clk";
+               resets = <&tegra_car 67>;
+               reset-names = "i2c";
+               dmas = <&apbdma 23>, <&apbdma 23>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                clocks = <&tegra_car TEGRA20_CLK_DVC>,
                         <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
                clock-names = "div-clk", "fast-clk";
+               resets = <&tegra_car 47>;
+               reset-names = "i2c";
+               dmas = <&apbdma 24>, <&apbdma 24>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra20-slink";
                reg = <0x7000d400 0x200>;
                interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 15>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA20_CLK_SBC1>;
+               resets = <&tegra_car 41>;
+               reset-names = "spi";
+               dmas = <&apbdma 15>, <&apbdma 15>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra20-slink";
                reg = <0x7000d600 0x200>;
                interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 16>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA20_CLK_SBC2>;
+               resets = <&tegra_car 44>;
+               reset-names = "spi";
+               dmas = <&apbdma 16>, <&apbdma 16>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra20-slink";
                reg = <0x7000d800 0x200>;
                interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 17>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA20_CLK_SBC3>;
+               resets = <&tegra_car 46>;
+               reset-names = "spi";
+               dmas = <&apbdma 17>, <&apbdma 17>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra20-slink";
                reg = <0x7000da00 0x200>;
                interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 18>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA20_CLK_SBC4>;
+               resets = <&tegra_car 68>;
+               reset-names = "spi";
+               dmas = <&apbdma 18>, <&apbdma 18>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
-       kbc {
+       kbc@7000e200 {
                compatible = "nvidia,tegra20-kbc";
                reg = <0x7000e200 0x100>;
                interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA20_CLK_KBC>;
+               resets = <&tegra_car 36>;
+               reset-names = "kbc";
                status = "disabled";
        };
 
-       pmc {
+       pmc@7000e400 {
                compatible = "nvidia,tegra20-pmc";
                reg = <0x7000e400 0x400>;
                clocks = <&tegra_car TEGRA20_CLK_PCLK>, <&clk32k_in>;
                interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
        };
 
-       iommu {
+       iommu@7000f024 {
                compatible = "nvidia,tegra20-gart";
                reg = <0x7000f024 0x00000018    /* controller registers */
                       0x58000000 0x02000000>;  /* GART aperture */
                #size-cells = <0>;
        };
 
-       pcie-controller {
+       pcie-controller@80003000 {
                compatible = "nvidia,tegra20-pcie";
                device_type = "pci";
                reg = <0x80003000 0x00000800   /* PADS registers */
 
                clocks = <&tegra_car TEGRA20_CLK_PEX>,
                         <&tegra_car TEGRA20_CLK_AFI>,
-                        <&tegra_car TEGRA20_CLK_PCIE_XCLK>,
                         <&tegra_car TEGRA20_CLK_PLL_E>;
-               clock-names = "pex", "afi", "pcie_xclk", "pll_e";
+               clock-names = "pex", "afi", "pll_e";
+               resets = <&tegra_car 70>,
+                        <&tegra_car 72>,
+                        <&tegra_car 74>;
+               reset-names = "pex", "afi", "pcie_x";
                status = "disabled";
 
                pci@1,0 {
                phy_type = "utmi";
                nvidia,has-legacy-mode;
                clocks = <&tegra_car TEGRA20_CLK_USBD>;
+               resets = <&tegra_car 22>;
+               reset-names = "usb";
                nvidia,needs-double-reset;
                nvidia,phy = <&phy1>;
                status = "disabled";
                interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
                phy_type = "ulpi";
                clocks = <&tegra_car TEGRA20_CLK_USB2>;
+               resets = <&tegra_car 58>;
+               reset-names = "usb";
                nvidia,phy = <&phy2>;
                status = "disabled";
        };
                interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
                phy_type = "utmi";
                clocks = <&tegra_car TEGRA20_CLK_USB3>;
+               resets = <&tegra_car 59>;
+               reset-names = "usb";
                nvidia,phy = <&phy3>;
                status = "disabled";
        };
                reg = <0xc8000000 0x200>;
                interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA20_CLK_SDMMC1>;
+               resets = <&tegra_car 14>;
+               reset-names = "sdhci";
                status = "disabled";
        };
 
                reg = <0xc8000200 0x200>;
                interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA20_CLK_SDMMC2>;
+               resets = <&tegra_car 9>;
+               reset-names = "sdhci";
                status = "disabled";
        };
 
                reg = <0xc8000400 0x200>;
                interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA20_CLK_SDMMC3>;
+               resets = <&tegra_car 69>;
+               reset-names = "sdhci";
                status = "disabled";
        };
 
                reg = <0xc8000600 0x200>;
                interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA20_CLK_SDMMC4>;
+               resets = <&tegra_car 15>;
+               reset-names = "sdhci";
                status = "disabled";
        };
 
index 08cad696e89fbd648c0c76a6f42c5fcbc2594cc5..e93fe45b7803e7030d1dbb114ea7db12da8b6026 100644 (file)
@@ -6,11 +6,16 @@
        model = "NVIDIA Tegra30 Beaver evaluation board";
        compatible = "nvidia,beaver", "nvidia,tegra30";
 
+       aliases {
+               rtc0 = "/i2c@7000d000/tps65911@2d";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x80000000 0x7ff00000>;
        };
 
-       pcie-controller {
+       pcie-controller@00003000 {
                status = "okay";
                pex-clk-supply = <&sys_3v3_pexs_reg>;
                vdd-supply = <&ldo1_reg>;
@@ -31,8 +36,8 @@
                };
        };
 
-       host1x {
-               hdmi {
+       host1x@50000000 {
+               hdmi@54280000 {
                        status = "okay";
 
                        vdd-supply = <&sys_3v3_reg>;
@@ -44,7 +49,7 @@
                };
        };
 
-       pinmux {
+       pinmux@70000868 {
                pinctrl-names = "default";
                pinctrl-0 = <&state_default>;
 
@@ -52,8 +57,8 @@
                        sdmmc1_clk_pz0 {
                                nvidia,pins = "sdmmc1_clk_pz0";
                                nvidia,function = "sdmmc1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc1_cmd_pz1 {
                                nvidia,pins =   "sdmmc1_cmd_pz1",
                                                "sdmmc1_dat2_py5",
                                                "sdmmc1_dat3_py4";
                                nvidia,function = "sdmmc1";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc3_clk_pa6 {
                                nvidia,pins = "sdmmc3_clk_pa6";
                                nvidia,function = "sdmmc3";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc3_cmd_pa7 {
                                nvidia,pins =   "sdmmc3_cmd_pa7",
                                                "sdmmc3_dat2_pb5",
                                                "sdmmc3_dat3_pb4";
                                nvidia,function = "sdmmc3";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc4_clk_pcc4 {
                                nvidia,pins =   "sdmmc4_clk_pcc4",
                                                "sdmmc4_rst_n_pcc3";
                                nvidia,function = "sdmmc4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc4_dat0_paa0 {
                                nvidia,pins =   "sdmmc4_dat0_paa0",
                                                "sdmmc4_dat6_paa6",
                                                "sdmmc4_dat7_paa7";
                                nvidia,function = "sdmmc4";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        dap2_fs_pa2 {
                                nvidia,pins =   "dap2_fs_pa2",
                                                "dap2_din_pa4",
                                                "dap2_dout_pa5";
                                nvidia,function = "i2s1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        pex_l1_prsnt_n_pdd4 {
                                nvidia,pins =   "pex_l1_prsnt_n_pdd4",
                                                "pex_l1_clkreq_n_pdd6";
-                               nvidia,pull = <2>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
                        };
                        sdio3 {
                                nvidia,pins = "drive_sdio3";
-                               nvidia,high-speed-mode = <0>;
-                               nvidia,schmitt = <0>;
+                               nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
+                               nvidia,schmitt = <TEGRA_PIN_DISABLE>;
                                nvidia,pull-down-strength = <46>;
                                nvidia,pull-up-strength = <42>;
                                nvidia,slew-rate-rising = <1>;
                status = "okay";
                clock-frequency = <100000>;
 
-               rt5640: rt5640 {
+               rt5640: rt5640@1c {
                        compatible = "realtek,rt5640";
                        reg = <0x1c>;
                        interrupt-parent = <&gpio>;
                                <&gpio TEGRA_GPIO(X, 2) GPIO_ACTIVE_HIGH>;
                };
 
-               tps62361 {
-                       compatible = "ti,tps62361";
-                       reg = <0x60>;
-
-                       regulator-name = "tps62361-vout";
-                       regulator-min-microvolt = <500000>;
-                       regulator-max-microvolt = <1500000>;
-                       regulator-boot-on;
-                       regulator-always-on;
-                       ti,vsel0-state-high;
-                       ti,vsel1-state-high;
-               };
-
                pmic: tps65911@2d {
                        compatible = "ti,tps65911";
                        reg = <0x2d>;
                                };
                        };
                };
+
+               tps62361@60 {
+                       compatible = "ti,tps62361";
+                       reg = <0x60>;
+
+                       regulator-name = "tps62361-vout";
+                       regulator-min-microvolt = <500000>;
+                       regulator-max-microvolt = <1500000>;
+                       regulator-boot-on;
+                       regulator-always-on;
+                       ti,vsel0-state-high;
+                       ti,vsel1-state-high;
+               };
        };
 
        spi@7000da00 {
                };
        };
 
-       ahub {
-               i2s@70080400 {
-                       status = "okay";
-               };
-       };
-
-       pmc {
+       pmc@7000e400 {
                status = "okay";
                nvidia,invert-interrupt;
                nvidia,suspend-mode = <1>;
                nvidia,sys-clock-req-active-high;
        };
 
+       ahub@70080000 {
+               i2s@70080400 {
+                       status = "okay";
+               };
+       };
+
        sdhci@78000000 {
                status = "okay";
                cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
                non-removable;
        };
 
+       usb@7d004000 {
+               status = "okay";
+       };
+
+       phy2: usb-phy@7d004000 {
+               vbus-supply = <&sys_3v3_reg>;
+               status = "okay";
+       };
+
        usb@7d008000 {
                status = "okay";
        };
                #address-cells = <1>;
                #size-cells = <0>;
 
-               clk32k_in: clock {
+               clk32k_in: clock@0 {
                        compatible = "fixed-clock";
                        reg=<0>;
                        #clock-cells = <0>;
                };
        };
 
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               gpled1 {
+                       label = "LED1"; /* CR5A1 (blue) */
+                       gpios = <&gpio TEGRA_GPIO(L, 1) GPIO_ACTIVE_HIGH>;
+               };
+               gpled2 {
+                       label = "LED2"; /* CR4A2 (green) */
+                       gpios = <&gpio TEGRA_GPIO(L, 0) GPIO_ACTIVE_HIGH>;
+               };
+       };
+
        regulators {
                compatible = "simple-bus";
                #address-cells = <1>;
                };
        };
 
-       gpio-leds {
-               compatible = "gpio-leds";
-
-               gpled1 {
-                       label = "LED1"; /* CR5A1 (blue) */
-                       gpios = <&gpio TEGRA_GPIO(L, 1) GPIO_ACTIVE_HIGH>;
-               };
-               gpled2 {
-                       label = "LED2"; /* CR4A2 (green) */
-                       gpios = <&gpio TEGRA_GPIO(L, 0) GPIO_ACTIVE_HIGH>;
-               };
-       };
-
        sound {
                compatible = "nvidia,tegra-audio-rt5640-beaver",
                             "nvidia,tegra-audio-rt5640";
index 1082c5ed90d18ecdd413cc43c5874cb7c27013ab..c9bfedcca6ed5ddaa8821717e41d14e520bce94b 100644 (file)
@@ -8,6 +8,13 @@
        model = "NVIDIA Tegra30 Cardhu A02 evaluation board";
        compatible = "nvidia,cardhu-a02", "nvidia,cardhu", "nvidia,tegra30";
 
+       sdhci@78000400 {
+               status = "okay";
+               power-gpios = <&gpio TEGRA_GPIO(D, 4) GPIO_ACTIVE_HIGH>;
+               bus-width = <4>;
+               keep-power-in-suspend;
+       };
+
        regulators {
                compatible = "simple-bus";
                #address-cells = <1>;
                        gpio = <&gpio TEGRA_GPIO(K, 3) GPIO_ACTIVE_HIGH>;
                };
        };
-
-       sdhci@78000400 {
-               status = "okay";
-               power-gpios = <&gpio TEGRA_GPIO(D, 4) GPIO_ACTIVE_HIGH>;
-               bus-width = <4>;
-               keep-power-in-suspend;
-       };
 };
 
index bf012bddaafba6691e3aefe99437e5a70b870fe2..fadf55e46b2ba4c3adea79322d9b7b0f1eec5ab9 100644 (file)
@@ -8,6 +8,13 @@
        model = "NVIDIA Tegra30 Cardhu A04 (A05, A06, A07) evaluation board";
        compatible = "nvidia,cardhu-a04", "nvidia,cardhu", "nvidia,tegra30";
 
+       sdhci@78000400 {
+               status = "okay";
+               power-gpios = <&gpio TEGRA_GPIO(D, 3) GPIO_ACTIVE_HIGH>;
+               bus-width = <4>;
+               keep-power-in-suspend;
+       };
+
        regulators {
                compatible = "simple-bus";
                #address-cells = <1>;
                        gpio = <&gpio TEGRA_GPIO(DD, 0) GPIO_ACTIVE_HIGH>;
                };
        };
-
-       sdhci@78000400 {
-               status = "okay";
-               power-gpios = <&gpio TEGRA_GPIO(D, 3) GPIO_ACTIVE_HIGH>;
-               bus-width = <4>;
-               keep-power-in-suspend;
-       };
 };
index 5ea7dfa4d9fa5de680ead80110b9c9ad31737490..9104224124eeaac83bcedbd0e2fb7bcb3887d631 100644 (file)
        model = "NVIDIA Tegra30 Cardhu evaluation board";
        compatible = "nvidia,cardhu", "nvidia,tegra30";
 
+       aliases {
+               rtc0 = "/i2c@7000d000/tps6586x@34";
+               rtc1 = "/rtc@7000e000";
+       };
+
        memory {
                reg = <0x80000000 0x40000000>;
        };
 
-       pcie-controller {
+       pcie-controller@00003000 {
                status = "okay";
                pex-clk-supply = <&pex_hvdd_3v3_reg>;
                vdd-supply = <&ldo1_reg>;
                };
        };
 
-       pinmux {
+       host1x@50000000 {
+               dc@54200000 {
+                       rgb {
+                               status = "okay";
+
+                               nvidia,panel = <&panel>;
+                       };
+               };
+       };
+
+       pinmux@70000868 {
                pinctrl-names = "default";
                pinctrl-0 = <&state_default>;
 
@@ -59,8 +74,8 @@
                        sdmmc1_clk_pz0 {
                                nvidia,pins = "sdmmc1_clk_pz0";
                                nvidia,function = "sdmmc1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc1_cmd_pz1 {
                                nvidia,pins =   "sdmmc1_cmd_pz1",
                                                "sdmmc1_dat2_py5",
                                                "sdmmc1_dat3_py4";
                                nvidia,function = "sdmmc1";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc3_clk_pa6 {
                                nvidia,pins = "sdmmc3_clk_pa6";
                                nvidia,function = "sdmmc3";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc3_cmd_pa7 {
                                nvidia,pins =   "sdmmc3_cmd_pa7",
                                                "sdmmc3_dat2_pb5",
                                                "sdmmc3_dat3_pb4";
                                nvidia,function = "sdmmc3";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc4_clk_pcc4 {
                                nvidia,pins =   "sdmmc4_clk_pcc4",
                                                "sdmmc4_rst_n_pcc3";
                                nvidia,function = "sdmmc4";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        sdmmc4_dat0_paa0 {
                                nvidia,pins =   "sdmmc4_dat0_paa0",
                                                "sdmmc4_dat6_paa6",
                                                "sdmmc4_dat7_paa7";
                                nvidia,function = "sdmmc4";
-                               nvidia,pull = <2>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_UP>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        dap2_fs_pa2 {
                                nvidia,pins =   "dap2_fs_pa2",
                                                "dap2_din_pa4",
                                                "dap2_dout_pa5";
                                nvidia,function = "i2s1";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                        sdio3 {
                                nvidia,pins = "drive_sdio3";
-                               nvidia,high-speed-mode = <0>;
-                               nvidia,schmitt = <0>;
+                               nvidia,high-speed-mode = <TEGRA_PIN_DISABLE>;
+                               nvidia,schmitt = <TEGRA_PIN_DISABLE>;
                                nvidia,pull-down-strength = <46>;
                                nvidia,pull-up-strength = <42>;
-                               nvidia,slew-rate-rising = <1>;
-                               nvidia,slew-rate-falling = <1>;
+                               nvidia,slew-rate-rising = <TEGRA_PIN_SLEW_RATE_FAST>;
+                               nvidia,slew-rate-falling = <TEGRA_PIN_SLEW_RATE_FAST>;
                        };
                        uart3_txd_pw6 {
                                nvidia,pins =   "uart3_txd_pw6",
                                                "uart3_rts_n_pc0",
                                                "uart3_rxd_pw7";
                                nvidia,function = "uartc";
-                               nvidia,pull = <0>;
-                               nvidia,tristate = <0>;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
                        };
                };
        };
                status = "okay";
        };
 
-       i2c@7000c000 {
+       pwm@7000a000 {
+               status = "okay";
+       };
+
+       panelddc: i2c@7000c000 {
                status = "okay";
                clock-frequency = <100000>;
        };
                        interrupts = <TEGRA_GPIO(CC, 2) IRQ_TYPE_LEVEL_LOW>;
                };
 
-               tps62361 {
+               tps62361@60 {
                        compatible = "ti,tps62361";
                        reg = <0x60>;
 
                };
        };
 
-       ahub {
-               i2s@70080400 {
-                       status = "okay";
-               };
-       };
-
-       pmc {
+       pmc@7000e400 {
                status = "okay";
                nvidia,invert-interrupt;
                nvidia,suspend-mode = <1>;
                nvidia,sys-clock-req-active-high;
        };
 
+       ahub@70080000 {
+               i2s@70080400 {
+                       status = "okay";
+               };
+       };
+
        sdhci@78000000 {
                status = "okay";
                cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
                status = "okay";
        };
 
+       backlight: backlight {
+               compatible = "pwm-backlight";
+
+               enable-gpios = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_HIGH>;
+               power-supply = <&vdd_bl_reg>;
+               pwms = <&pwm 0 5000000>;
+
+               brightness-levels = <0 4 8 16 32 64 128 255>;
+               default-brightness-level = <6>;
+       };
+
        clocks {
                compatible = "simple-bus";
                #address-cells = <1>;
                #size-cells = <0>;
 
-               clk32k_in: clock {
+               clk32k_in: clock@0 {
                        compatible = "fixed-clock";
                        reg=<0>;
                        #clock-cells = <0>;
                };
        };
 
+       panel: panel {
+               compatible = "chunghwa,claa101wb01", "simple-panel";
+               ddc-i2c-bus = <&panelddc>;
+
+               power-supply = <&vdd_pnl1_reg>;
+               enable-gpios = <&gpio TEGRA_GPIO(L, 2) GPIO_ACTIVE_HIGH>;
+
+               backlight = <&backlight>;
+       };
+
        regulators {
                compatible = "simple-bus";
                #address-cells = <1>;
index 2bd55cfd88adcb4d3e525ae45ea471a6376a8e34..ed8e7700b46dac0ba9d5ba34754fb5f8ae3dd976 100644 (file)
@@ -1,5 +1,6 @@
 #include <dt-bindings/clock/tegra30-car.h>
 #include <dt-bindings/gpio/tegra-gpio.h>
+#include <dt-bindings/pinctrl/pinctrl-tegra.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
 #include "skeleton.dtsi"
@@ -16,7 +17,7 @@
                serial4 = &uarte;
        };
 
-       pcie-controller {
+       pcie-controller@00003000 {
                compatible = "nvidia,tegra30-pcie";
                device_type = "pci";
                reg = <0x00003000 0x00000800   /* PADS registers */
 
                clocks = <&tegra_car TEGRA30_CLK_PCIE>,
                         <&tegra_car TEGRA30_CLK_AFI>,
-                        <&tegra_car TEGRA30_CLK_PCIEX>,
                         <&tegra_car TEGRA30_CLK_PLL_E>,
                         <&tegra_car TEGRA30_CLK_CML0>;
-               clock-names = "pex", "afi", "pcie_xclk", "pll_e", "cml";
+               clock-names = "pex", "afi", "pll_e", "cml";
+               resets = <&tegra_car 70>,
+                        <&tegra_car 72>,
+                        <&tegra_car 74>;
+               reset-names = "pex", "afi", "pcie_x";
                status = "disabled";
 
                pci@1,0 {
                };
        };
 
-       host1x {
+       host1x@50000000 {
                compatible = "nvidia,tegra30-host1x", "simple-bus";
                reg = <0x50000000 0x00024000>;
                interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */
                             <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */
                clocks = <&tegra_car TEGRA30_CLK_HOST1X>;
+               resets = <&tegra_car 28>;
+               reset-names = "host1x";
 
                #address-cells = <1>;
                #size-cells = <1>;
 
                ranges = <0x54000000 0x54000000 0x04000000>;
 
-               mpe {
+               mpe@54040000 {
                        compatible = "nvidia,tegra30-mpe";
                        reg = <0x54040000 0x00040000>;
                        interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA30_CLK_MPE>;
+                       resets = <&tegra_car 60>;
+                       reset-names = "mpe";
                };
 
-               vi {
+               vi@54080000 {
                        compatible = "nvidia,tegra30-vi";
                        reg = <0x54080000 0x00040000>;
                        interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA30_CLK_VI>;
+                       resets = <&tegra_car 20>;
+                       reset-names = "vi";
                };
 
-               epp {
+               epp@540c0000 {
                        compatible = "nvidia,tegra30-epp";
                        reg = <0x540c0000 0x00040000>;
                        interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA30_CLK_EPP>;
+                       resets = <&tegra_car 19>;
+                       reset-names = "epp";
                };
 
-               isp {
+               isp@54100000 {
                        compatible = "nvidia,tegra30-isp";
                        reg = <0x54100000 0x00040000>;
                        interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA30_CLK_ISP>;
+                       resets = <&tegra_car 23>;
+                       reset-names = "isp";
                };
 
-               gr2d {
+               gr2d@54140000 {
                        compatible = "nvidia,tegra30-gr2d";
                        reg = <0x54140000 0x00040000>;
                        interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
+                       resets = <&tegra_car 21>;
+                       reset-names = "2d";
                        clocks = <&tegra_car TEGRA30_CLK_GR2D>;
                };
 
-               gr3d {
+               gr3d@54180000 {
                        compatible = "nvidia,tegra30-gr3d";
                        reg = <0x54180000 0x00040000>;
                        clocks = <&tegra_car TEGRA30_CLK_GR3D
                                  &tegra_car TEGRA30_CLK_GR3D2>;
                        clock-names = "3d", "3d2";
+                       resets = <&tegra_car 24>,
+                                <&tegra_car 98>;
+                       reset-names = "3d", "3d2";
                };
 
                dc@54200000 {
                        interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA30_CLK_DISP1>,
                                 <&tegra_car TEGRA30_CLK_PLL_P>;
-                       clock-names = "disp1", "parent";
+                       clock-names = "dc", "parent";
+                       resets = <&tegra_car 27>;
+                       reset-names = "dc";
 
                        rgb {
                                status = "disabled";
                        interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA30_CLK_DISP2>,
                                 <&tegra_car TEGRA30_CLK_PLL_P>;
-                       clock-names = "disp2", "parent";
+                       clock-names = "dc", "parent";
+                       resets = <&tegra_car 26>;
+                       reset-names = "dc";
 
                        rgb {
                                status = "disabled";
                        };
                };
 
-               hdmi {
+               hdmi@54280000 {
                        compatible = "nvidia,tegra30-hdmi";
                        reg = <0x54280000 0x00040000>;
                        interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&tegra_car TEGRA30_CLK_HDMI>,
                                 <&tegra_car TEGRA30_CLK_PLL_D2_OUT0>;
                        clock-names = "hdmi", "parent";
+                       resets = <&tegra_car 51>;
+                       reset-names = "hdmi";
                        status = "disabled";
                };
 
-               tvo {
+               tvo@542c0000 {
                        compatible = "nvidia,tegra30-tvo";
                        reg = <0x542c0000 0x00040000>;
                        interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
                        status = "disabled";
                };
 
-               dsi {
+               dsi@54300000 {
                        compatible = "nvidia,tegra30-dsi";
                        reg = <0x54300000 0x00040000>;
                        clocks = <&tegra_car TEGRA30_CLK_DSIA>;
+                       resets = <&tegra_car 48>;
+                       reset-names = "dsi";
                        status = "disabled";
                };
        };
                clocks = <&tegra_car TEGRA30_CLK_TWD>;
        };
 
-       intc: interrupt-controller {
+       intc: interrupt-controller@50041000 {
                compatible = "arm,cortex-a9-gic";
                reg = <0x50041000 0x1000
                       0x50040100 0x0100>;
                #interrupt-cells = <3>;
        };
 
-       cache-controller {
+       cache-controller@50043000 {
                compatible = "arm,pl310-cache";
                reg = <0x50043000 0x1000>;
                arm,data-latency = <6 6 2>;
                clocks = <&tegra_car TEGRA30_CLK_TIMER>;
        };
 
-       tegra_car: clock {
+       tegra_car: clock@60006000 {
                compatible = "nvidia,tegra30-car";
                reg = <0x60006000 0x1000>;
                #clock-cells = <1>;
+               #reset-cells = <1>;
        };
 
-       apbdma: dma {
+       apbdma: dma@6000a000 {
                compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma";
                reg = <0x6000a000 0x1400>;
                interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA30_CLK_APBDMA>;
+               resets = <&tegra_car 34>;
+               reset-names = "dma";
+               #dma-cells = <1>;
        };
 
-       ahb: ahb {
+       ahb: ahb@6000c004 {
                compatible = "nvidia,tegra30-ahb";
                reg = <0x6000c004 0x14c>; /* AHB Arbitration + Gizmo Controller */
        };
 
-       gpio: gpio {
+       gpio: gpio@6000d000 {
                compatible = "nvidia,tegra30-gpio";
                reg = <0x6000d000 0x1000>;
                interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
                interrupt-controller;
        };
 
-       pinmux: pinmux {
+       pinmux: pinmux@70000868 {
                compatible = "nvidia,tegra30-pinmux";
                reg = <0x70000868 0xd4    /* Pad control registers */
                       0x70003000 0x3e4>; /* Mux registers */
                reg = <0x70006000 0x40>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 8>;
                clocks = <&tegra_car TEGRA30_CLK_UARTA>;
+               resets = <&tegra_car 6>;
+               reset-names = "serial";
+               dmas = <&apbdma 8>, <&apbdma 8>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006040 0x40>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 9>;
                clocks = <&tegra_car TEGRA30_CLK_UARTB>;
+               resets = <&tegra_car 7>;
+               reset-names = "serial";
+               dmas = <&apbdma 9>, <&apbdma 9>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006200 0x100>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 10>;
                clocks = <&tegra_car TEGRA30_CLK_UARTC>;
+               resets = <&tegra_car 55>;
+               reset-names = "serial";
+               dmas = <&apbdma 10>, <&apbdma 10>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006300 0x100>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 19>;
                clocks = <&tegra_car TEGRA30_CLK_UARTD>;
+               resets = <&tegra_car 65>;
+               reset-names = "serial";
+               dmas = <&apbdma 19>, <&apbdma 19>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                reg = <0x70006400 0x100>;
                reg-shift = <2>;
                interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 20>;
                clocks = <&tegra_car TEGRA30_CLK_UARTE>;
+               resets = <&tegra_car 66>;
+               reset-names = "serial";
+               dmas = <&apbdma 20>, <&apbdma 20>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
-       pwm: pwm {
+       pwm: pwm@7000a000 {
                compatible = "nvidia,tegra30-pwm", "nvidia,tegra20-pwm";
                reg = <0x7000a000 0x100>;
                #pwm-cells = <2>;
                clocks = <&tegra_car TEGRA30_CLK_PWM>;
+               resets = <&tegra_car 17>;
+               reset-names = "pwm";
                status = "disabled";
        };
 
-       rtc {
+       rtc@7000e000 {
                compatible = "nvidia,tegra30-rtc", "nvidia,tegra20-rtc";
                reg = <0x7000e000 0x100>;
                interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA30_CLK_I2C1>,
                         <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
                clock-names = "div-clk", "fast-clk";
+               resets = <&tegra_car 12>;
+               reset-names = "i2c";
+               dmas = <&apbdma 21>, <&apbdma 21>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                clocks = <&tegra_car TEGRA30_CLK_I2C2>,
                         <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
                clock-names = "div-clk", "fast-clk";
+               resets = <&tegra_car 54>;
+               reset-names = "i2c";
+               dmas = <&apbdma 22>, <&apbdma 22>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                clocks = <&tegra_car TEGRA30_CLK_I2C3>,
                         <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
                clock-names = "div-clk", "fast-clk";
+               resets = <&tegra_car 67>;
+               reset-names = "i2c";
+               dmas = <&apbdma 23>, <&apbdma 23>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA30_CLK_I2C4>,
                         <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
+               resets = <&tegra_car 103>;
+               reset-names = "i2c";
                clock-names = "div-clk", "fast-clk";
+               dmas = <&apbdma 26>, <&apbdma 26>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                clocks = <&tegra_car TEGRA30_CLK_I2C5>,
                         <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
                clock-names = "div-clk", "fast-clk";
+               resets = <&tegra_car 47>;
+               reset-names = "i2c";
+               dmas = <&apbdma 24>, <&apbdma 24>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
                reg = <0x7000d400 0x200>;
                interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 15>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA30_CLK_SBC1>;
+               resets = <&tegra_car 41>;
+               reset-names = "spi";
+               dmas = <&apbdma 15>, <&apbdma 15>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
                reg = <0x7000d600 0x200>;
                interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 16>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA30_CLK_SBC2>;
+               resets = <&tegra_car 44>;
+               reset-names = "spi";
+               dmas = <&apbdma 16>, <&apbdma 16>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
                reg = <0x7000d800 0x200>;
                interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 17>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA30_CLK_SBC3>;
+               resets = <&tegra_car 46>;
+               reset-names = "spi";
+               dmas = <&apbdma 17>, <&apbdma 17>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
                reg = <0x7000da00 0x200>;
                interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 18>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA30_CLK_SBC4>;
+               resets = <&tegra_car 68>;
+               reset-names = "spi";
+               dmas = <&apbdma 18>, <&apbdma 18>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
                reg = <0x7000dc00 0x200>;
                interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 27>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA30_CLK_SBC5>;
+               resets = <&tegra_car 104>;
+               reset-names = "spi";
+               dmas = <&apbdma 27>, <&apbdma 27>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
                compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
                reg = <0x7000de00 0x200>;
                interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 28>;
                #address-cells = <1>;
                #size-cells = <0>;
                clocks = <&tegra_car TEGRA30_CLK_SBC6>;
+               resets = <&tegra_car 106>;
+               reset-names = "spi";
+               dmas = <&apbdma 28>, <&apbdma 28>;
+               dma-names = "rx", "tx";
                status = "disabled";
        };
 
-       kbc {
+       kbc@7000e200 {
                compatible = "nvidia,tegra30-kbc", "nvidia,tegra20-kbc";
                reg = <0x7000e200 0x100>;
                interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA30_CLK_KBC>;
+               resets = <&tegra_car 36>;
+               reset-names = "kbc";
                status = "disabled";
        };
 
-       pmc {
+       pmc@7000e400 {
                compatible = "nvidia,tegra30-pmc";
                reg = <0x7000e400 0x400>;
                clocks = <&tegra_car TEGRA30_CLK_PCLK>, <&clk32k_in>;
                clock-names = "pclk", "clk32k_in";
        };
 
-       memory-controller {
+       memory-controller@7000f000 {
                compatible = "nvidia,tegra30-mc";
                reg = <0x7000f000 0x010
                       0x7000f03c 0x1b4
                interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
        };
 
-       iommu {
+       iommu@7000f010 {
                compatible = "nvidia,tegra30-smmu";
                reg = <0x7000f010 0x02c
                       0x7000f1f0 0x010
                nvidia,ahb = <&ahb>;
        };
 
-       ahub {
+       ahub@70080000 {
                compatible = "nvidia,tegra30-ahub";
                reg = <0x70080000 0x200
                       0x70080200 0x100>;
                interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
-               nvidia,dma-request-selector = <&apbdma 1>;
                clocks = <&tegra_car TEGRA30_CLK_D_AUDIO>,
-                        <&tegra_car TEGRA30_CLK_APBIF>,
-                        <&tegra_car TEGRA30_CLK_I2S0>,
-                        <&tegra_car TEGRA30_CLK_I2S1>,
-                        <&tegra_car TEGRA30_CLK_I2S2>,
-                        <&tegra_car TEGRA30_CLK_I2S3>,
-                        <&tegra_car TEGRA30_CLK_I2S4>,
-                        <&tegra_car TEGRA30_CLK_DAM0>,
-                        <&tegra_car TEGRA30_CLK_DAM1>,
-                        <&tegra_car TEGRA30_CLK_DAM2>,
-                        <&tegra_car TEGRA30_CLK_SPDIF_IN>;
-               clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
+                        <&tegra_car TEGRA30_CLK_APBIF>;
+               clock-names = "d_audio", "apbif";
+               resets = <&tegra_car 106>, /* d_audio */
+                        <&tegra_car 107>, /* apbif */
+                        <&tegra_car 30>,  /* i2s0 */
+                        <&tegra_car 11>,  /* i2s1 */
+                        <&tegra_car 18>,  /* i2s2 */
+                        <&tegra_car 101>, /* i2s3 */
+                        <&tegra_car 102>, /* i2s4 */
+                        <&tegra_car 108>, /* dam0 */
+                        <&tegra_car 109>, /* dam1 */
+                        <&tegra_car 110>, /* dam2 */
+                        <&tegra_car 10>;  /* spdif */
+               reset-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
                              "i2s3", "i2s4", "dam0", "dam1", "dam2",
-                             "spdif_in";
+                             "spdif";
+               dmas = <&apbdma 1>, <&apbdma 1>,
+                      <&apbdma 2>, <&apbdma 2>,
+                      <&apbdma 3>, <&apbdma 3>,
+                      <&apbdma 4>, <&apbdma 4>;
+               dma-names = "rx0", "tx0", "rx1", "tx1", "rx2", "tx2",
+                           "rx3", "tx3";
                ranges;
                #address-cells = <1>;
                #size-cells = <1>;
                        reg = <0x70080300 0x100>;
                        nvidia,ahub-cif-ids = <4 4>;
                        clocks = <&tegra_car TEGRA30_CLK_I2S0>;
+                       resets = <&tegra_car 30>;
+                       reset-names = "i2s";
                        status = "disabled";
                };
 
                        reg = <0x70080400 0x100>;
                        nvidia,ahub-cif-ids = <5 5>;
                        clocks = <&tegra_car TEGRA30_CLK_I2S1>;
+                       resets = <&tegra_car 11>;
+                       reset-names = "i2s";
                        status = "disabled";
                };
 
                        reg = <0x70080500 0x100>;
                        nvidia,ahub-cif-ids = <6 6>;
                        clocks = <&tegra_car TEGRA30_CLK_I2S2>;
+                       resets = <&tegra_car 18>;
+                       reset-names = "i2s";
                        status = "disabled";
                };
 
                        reg = <0x70080600 0x100>;
                        nvidia,ahub-cif-ids = <7 7>;
                        clocks = <&tegra_car TEGRA30_CLK_I2S3>;
+                       resets = <&tegra_car 101>;
+                       reset-names = "i2s";
                        status = "disabled";
                };
 
                        reg = <0x70080700 0x100>;
                        nvidia,ahub-cif-ids = <8 8>;
                        clocks = <&tegra_car TEGRA30_CLK_I2S4>;
+                       resets = <&tegra_car 102>;
+                       reset-names = "i2s";
                        status = "disabled";
                };
        };
                reg = <0x78000000 0x200>;
                interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA30_CLK_SDMMC1>;
+               resets = <&tegra_car 14>;
+               reset-names = "sdhci";
                status = "disabled";
        };
 
                reg = <0x78000200 0x200>;
                interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA30_CLK_SDMMC2>;
+               resets = <&tegra_car 9>;
+               reset-names = "sdhci";
                status = "disabled";
        };
 
                reg = <0x78000400 0x200>;
                interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA30_CLK_SDMMC3>;
+               resets = <&tegra_car 69>;
+               reset-names = "sdhci";
                status = "disabled";
        };
 
                reg = <0x78000600 0x200>;
                interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&tegra_car TEGRA30_CLK_SDMMC4>;
+               resets = <&tegra_car 15>;
+               reset-names = "sdhci";
                status = "disabled";
        };
 
                interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
                phy_type = "utmi";
                clocks = <&tegra_car TEGRA30_CLK_USBD>;
+               resets = <&tegra_car 22>;
+               reset-names = "usb";
                nvidia,needs-double-reset;
                nvidia,phy = <&phy1>;
                status = "disabled";
                compatible = "nvidia,tegra30-ehci", "usb-ehci";
                reg = <0x7d004000 0x4000>;
                interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
-               phy_type = "ulpi";
+               phy_type = "utmi";
                clocks = <&tegra_car TEGRA30_CLK_USB2>;
+               resets = <&tegra_car 58>;
+               reset-names = "usb";
                nvidia,phy = <&phy2>;
                status = "disabled";
        };
 
        phy2: usb-phy@7d004000 {
                compatible = "nvidia,tegra30-usb-phy";
-               reg = <0x7d004000 0x4000>;
-               phy_type = "ulpi";
+               reg = <0x7d004000 0x4000 0x7d000000 0x4000>;
+               phy_type = "utmi";
                clocks = <&tegra_car TEGRA30_CLK_USB2>,
                         <&tegra_car TEGRA30_CLK_PLL_U>,
-                        <&tegra_car TEGRA30_CLK_CDEV2>;
-               clock-names = "reg", "pll_u", "ulpi-link";
+                        <&tegra_car TEGRA30_CLK_USBD>;
+               clock-names = "reg", "pll_u", "utmi-pads";
+               nvidia,hssync-start-delay = <9>;
+               nvidia,idle-wait-delay = <17>;
+               nvidia,elastic-limit = <16>;
+               nvidia,term-range-adj = <6>;
+               nvidia,xcvr-setup = <51>;
+               nvidia.xcvr-setup-use-fuses;
+               nvidia,xcvr-lsfslew = <2>;
+               nvidia,xcvr-lsrslew = <2>;
+               nvidia,xcvr-hsslew = <32>;
+               nvidia,hssquelch-level = <2>;
+               nvidia,hsdiscon-level = <5>;
                status = "disabled";
        };
 
                interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
                phy_type = "utmi";
                clocks = <&tegra_car TEGRA30_CLK_USB3>;
+               resets = <&tegra_car 59>;
+               reset-names = "usb";
                nvidia,phy = <&phy3>;
                status = "disabled";
        };
index e7f73b2e45501772b94ce8489ea8e67f4e8c3ac0..5d7681be058027534724b4efd0bb6ef2790f1de3 100644 (file)
 / {
        compatible = "xlnx,zynq-7000";
 
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu@0 {
+                       compatible = "arm,cortex-a9";
+                       device_type = "cpu";
+                       reg = <0>;
+                       clocks = <&clkc 3>;
+               };
+
+               cpu@1 {
+                       compatible = "arm,cortex-a9";
+                       device_type = "cpu";
+                       reg = <1>;
+                       clocks = <&clkc 3>;
+               };
+       };
+
        pmu {
                compatible = "arm,cortex-a9-pmu";
                interrupts = <0 5 4>, <0 6 4>;
                        interrupts = <0 50 4>;
                };
 
+               gem0: ethernet@e000b000 {
+                       compatible = "cdns,gem";
+                       reg = <0xe000b000 0x4000>;
+                       status = "disabled";
+                       interrupts = <0 22 4>;
+                       clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>;
+                       clock-names = "pclk", "hclk", "tx_clk";
+               };
+
+               gem1: ethernet@e000c000 {
+                       compatible = "cdns,gem";
+                       reg = <0xe000c000 0x4000>;
+                       status = "disabled";
+                       interrupts = <0 45 4>;
+                       clocks = <&clkc 31>, <&clkc 31>, <&clkc 14>;
+                       clock-names = "pclk", "hclk", "tx_clk";
+               };
+
                slcr: slcr@f8000000 {
                        compatible = "xlnx,zynq-slcr";
                        reg = <0xF8000000 0x1000>;
                        compatible = "cdns,ttc";
                        clocks = <&clkc 6>;
                        reg = <0xF8001000 0x1000>;
-                       clock-ranges;
                };
 
                ttc1: ttc1@f8002000 {
                        compatible = "cdns,ttc";
                        clocks = <&clkc 6>;
                        reg = <0xF8002000 0x1000>;
-                       clock-ranges;
                };
                scutimer: scutimer@f8f00600 {
                        interrupt-parent = <&intc>;
index 21aea99a067b63824ef270e19d1c047039317a44..34d680a46b7e6096ca44ac1a81d003a9d12049de 100644 (file)
 
 };
 
+&gem0 {
+       status = "okay";
+       phy-mode = "rgmii";
+};
+
 &uart1 {
        status = "okay";
 };
index 79009e0b74b90ae7d9711c3b67be65c09695eef2..b2835d5fc09a7de640082c462c27eacb694f1d2c 100644 (file)
 
 };
 
+&gem0 {
+       status = "okay";
+       phy-mode = "rgmii";
+};
+
 &uart1 {
        status = "okay";
 };
index d6acf2b1cdf478a831f16e120eb9b72b58f938dc..2eda06889dfc244b24adaa883e87e5a03e61114c 100644 (file)
 
 };
 
+&gem0 {
+       status = "okay";
+       phy-mode = "rgmii";
+};
+
 &uart1 {
        status = "okay";
 };
index 26020a03f659f2d78fe37f2dca7f3e0a0eb573ca..1e361abc29eb0e106492223348de051d1e4e9f3d 100644 (file)
@@ -35,8 +35,7 @@ void mcpm_set_early_poke(unsigned cpu, unsigned cluster,
        unsigned long *poke = &mcpm_entry_early_pokes[cluster][cpu][0];
        poke[0] = poke_phys_addr;
        poke[1] = poke_val;
-       __cpuc_flush_dcache_area((void *)poke, 8);
-       outer_clean_range(__pa(poke), __pa(poke + 2));
+       __sync_cache_range_w(poke, 2 * sizeof(*poke));
 }
 
 static const struct mcpm_platform_ops *platform_ops;
@@ -167,7 +166,7 @@ void __mcpm_cpu_down(unsigned int cpu, unsigned int cluster)
        dmb();
        mcpm_sync.clusters[cluster].cpus[cpu].cpu = CPU_DOWN;
        sync_cache_w(&mcpm_sync.clusters[cluster].cpus[cpu].cpu);
-       dsb_sev();
+       sev();
 }
 
 /*
@@ -183,7 +182,7 @@ void __mcpm_outbound_leave_critical(unsigned int cluster, int state)
        dmb();
        mcpm_sync.clusters[cluster].cluster = state;
        sync_cache_w(&mcpm_sync.clusters[cluster].cluster);
-       dsb_sev();
+       sev();
 }
 
 /*
index ce922d0ea7aa85daa59c408ac5cd79beab5459a6..53c6a26b633d678f6d63f530931157aaefc68f84 100644 (file)
@@ -66,7 +66,7 @@ static long __init sp804_get_clock_rate(struct clk *clk)
 
 static void __iomem *sched_clock_base;
 
-static u32 sp804_read(void)
+static u64 notrace sp804_read(void)
 {
        return ~readl_relaxed(sched_clock_base + TIMER_VALUE);
 }
@@ -104,7 +104,7 @@ void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base,
 
        if (use_sched_clock) {
                sched_clock_base = base;
-               setup_sched_clock(sp804_read, 32, rate);
+               sched_clock_register(sp804_read, 32, rate);
        }
 }
 
index 1ce39940795d9ebddb81509e84577b6be88e23ed..cb26c62dc7228a47335f79e50f32029721cc8bf5 100644 (file)
@@ -13,7 +13,7 @@ CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 # CONFIG_BLOCK is not set
-CONFIG_ARCH_SHMOBILE=y
+CONFIG_ARCH_SHMOBILE_LEGACY=y
 CONFIG_ARCH_R8A73A4=y
 CONFIG_MACH_APE6EVM=y
 # CONFIG_ARM_THUMB is not set
index fae939d3d7f0a863b5284e95778fbc2f6c67f9c4..9287a62de830424737e136e412d3239757c2251e 100644 (file)
@@ -15,7 +15,7 @@ CONFIG_MODULE_FORCE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_DEADLINE is not set
 # CONFIG_IOSCHED_CFQ is not set
-CONFIG_ARCH_SHMOBILE=y
+CONFIG_ARCH_SHMOBILE_LEGACY=y
 CONFIG_ARCH_R8A7740=y
 CONFIG_MACH_ARMADILLO800EVA=y
 # CONFIG_SH_TIMER_TMU is not set
@@ -105,6 +105,7 @@ CONFIG_FB=y
 CONFIG_FB_SH_MOBILE_LCDC=y
 CONFIG_FB_SH_MOBILE_HDMI=y
 CONFIG_LCD_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_PWM=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 CONFIG_LOGO=y
@@ -130,6 +131,8 @@ CONFIG_DMADEVICES=y
 CONFIG_SH_DMAE=y
 CONFIG_UIO=y
 CONFIG_UIO_PDRV_GENIRQ=y
+CONFIG_PWM=y
+CONFIG_PWM_RENESAS_TPU=y
 # CONFIG_DNOTIFY is not set
 CONFIG_MSDOS_FS=y
 CONFIG_VFAT_FS=y
index 690e89273230b06c2ca87c01bc623f21a9c5ef32..0b4e9b5210d8dc29435990acd6f0a37b223c62c8 100644 (file)
@@ -22,7 +22,6 @@ CONFIG_SOC_AT91SAM9X5=y
 CONFIG_SOC_AT91SAM9N12=y
 CONFIG_MACH_AT91RM9200_DT=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_TIMER_HZ=128
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
index 75502c4d222cbd0bd2e29a43f42f1d0522e27d9c..bf057719dab0b3087145bb77c5cc14fd20f5c123 100644 (file)
@@ -31,7 +31,6 @@ CONFIG_MACH_YL9200=y
 CONFIG_MACH_CPUAT91=y
 CONFIG_MACH_ECO920=y
 CONFIG_MTD_AT91_DATAFLASH_CARD=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_TIMER_HZ=100
 # CONFIG_ARM_THUMB is not set
 CONFIG_PCCARD=y
index 69b6928d3d9d68a901a6ffc40e711963a6f51094..2cd832918e9ccb7a51d9893c2c6f4e17366b284d 100644 (file)
@@ -15,7 +15,6 @@ CONFIG_MACH_AT91SAM9260EK=y
 CONFIG_MACH_CAM60=y
 CONFIG_MACH_SAM9_L9260=y
 CONFIG_MACH_AFEB9260=y
-CONFIG_MACH_QIL_A9260=y
 CONFIG_MACH_CPU9260=y
 CONFIG_MACH_FLEXIBITY=y
 CONFIG_MACH_AT91SAM9G20EK=y
@@ -28,7 +27,6 @@ CONFIG_MACH_PCONTROL_G20=y
 CONFIG_MACH_GSIA18S=y
 CONFIG_MACH_SNAPPER_9260=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_SLOW_CLOCK=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_AEABI=y
index 9d35cd81c61193db3ce07129afcc0a7ea550c7ee..f80e993b04ce1c13de3b76d308d548fb150fcf19 100644 (file)
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9261=y
 CONFIG_MACH_AT91SAM9261EK=y
 CONFIG_MACH_AT91SAM9G10EK=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
index 08166cd4e7d618700bfcd39913da54650bf53532..e181a50fd65a9713000317c1cf04b16136d95477 100644 (file)
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9G45=y
 CONFIG_MACH_AT91SAM9M10G45EK=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_SLOW_CLOCK=y
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
index 7cf87856d63ca2738112d59f336f615ec3ce36d5..7b6f131cecd6701f553de8f4e479c0c92de952c5 100644 (file)
@@ -13,7 +13,6 @@ CONFIG_MODULE_UNLOAD=y
 CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9RL=y
 CONFIG_MACH_AT91SAM9RLEK=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
index 34e9780e63baa9f4f77467a0c9884cca3a9ddaf8..f43392dc2dcf659c1b1ac4d8a6b524e21f106cd6 100644 (file)
@@ -44,17 +44,26 @@ CONFIG_VFP=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 # CONFIG_SUSPEND is not set
 CONFIG_NET=y
+CONFIG_PACKET=y
 CONFIG_UNIX=y
 CONFIG_INET=y
 CONFIG_NETWORK_SECMARK=y
-# CONFIG_WIRELESS is not set
+CONFIG_NETFILTER=y
+CONFIG_CFG80211=y
+CONFIG_MAC80211=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_STANDALONE is not set
-# CONFIG_INPUT_MOUSEDEV is not set
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-# CONFIG_SERIO is not set
+CONFIG_SCSI=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_SCSI_MULTI_LUN=y
+CONFIG_SCSI_CONSTANTS=y
+CONFIG_SCSI_SCAN_ASYNC=y
+CONFIG_NETDEVICES=y
+CONFIG_USB_USBNET=y
+CONFIG_USB_NET_SMSC95XX=y
+CONFIG_ZD1211RW=y
+CONFIG_INPUT_EVDEV=y
 # CONFIG_LEGACY_PTYS is not set
 # CONFIG_DEVKMEM is not set
 CONFIG_SERIAL_AMBA_PL011=y
@@ -71,15 +80,13 @@ CONFIG_FB=y
 CONFIG_FB_SIMPLE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
-# CONFIG_USB_SUPPORT is not set
+CONFIG_USB=y
+CONFIG_USB_STORAGE=y
 CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_PLTFM=y
 CONFIG_MMC_SDHCI_BCM2835=y
-CONFIG_NEW_LEDS=y
-CONFIG_LEDS_CLASS=y
 CONFIG_LEDS_GPIO=y
-CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_ONESHOT=y
 CONFIG_LEDS_TRIGGER_HEARTBEAT=y
@@ -88,6 +95,8 @@ CONFIG_LEDS_TRIGGER_GPIO=y
 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
 CONFIG_LEDS_TRIGGER_TRANSIENT=y
 CONFIG_LEDS_TRIGGER_CAMERA=y
+CONFIG_STAGING=y
+CONFIG_USB_DWC2=y
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_EXT2_FS=y
 CONFIG_EXT2_FS_XATTR=y
@@ -109,20 +118,20 @@ CONFIG_NLS_ASCII=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_UTF8=y
 CONFIG_PRINTK_TIME=y
+CONFIG_BOOT_PRINTK_DELAY=y
+CONFIG_DYNAMIC_DEBUG=y
+CONFIG_DEBUG_INFO=y
 # CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_UNUSED_SYMBOLS=y
-CONFIG_LOCKUP_DETECTOR=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_MEMORY_INIT=y
-CONFIG_BOOT_PRINTK_DELAY=y
+CONFIG_LOCKUP_DETECTOR=y
 CONFIG_SCHED_TRACER=y
 CONFIG_STACK_TRACER=y
 CONFIG_FUNCTION_PROFILER=y
-CONFIG_DYNAMIC_DEBUG=y
+CONFIG_TEST_KSTRTOX=y
 CONFIG_KGDB=y
 CONFIG_KGDB_KDB=y
-CONFIG_TEST_KSTRTOX=y
 CONFIG_STRICT_DEVMEM=y
 CONFIG_DEBUG_LL=y
 CONFIG_EARLY_PRINTK=y
index bede51171d988a15b2e4aca8dd5de814aeba96e1..2c38fdf1951d377ee648778a847fb3776fabc70a 100644 (file)
@@ -29,11 +29,9 @@ CONFIG_ARCH_BCM_MOBILE=y
 CONFIG_ARM_THUMBEE=y
 CONFIG_PREEMPT=y
 CONFIG_AEABI=y
-# CONFIG_OABI_COMPAT is not set
 # CONFIG_COMPACTION is not set
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_ARM_APPENDED_DTB=y
 CONFIG_CMDLINE="console=ttyS0,115200n8 mem=128M"
 CONFIG_CPU_IDLE=y
 CONFIG_VFP=y
@@ -120,6 +118,7 @@ CONFIG_DETECT_HUNG_TASK=y
 CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=110
 CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
 # CONFIG_FTRACE is not set
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
 CONFIG_CRC_CCITT=y
 CONFIG_CRC_T10DIF=y
 CONFIG_CRC_ITU_T=y
index b38cd107f82dfe5b1efffb4075e04fc39f9f41c5..80cff50beb34ab930709077d03d9a69d72481f5b 100644 (file)
@@ -8,7 +8,7 @@ CONFIG_SYSCTL_SYSCALL=y
 CONFIG_EMBEDDED=y
 CONFIG_SLAB=y
 # CONFIG_IOSCHED_CFQ is not set
-CONFIG_ARCH_SHMOBILE=y
+CONFIG_ARCH_SHMOBILE_LEGACY=y
 CONFIG_ARCH_R8A7778=y
 CONFIG_MACH_BOCKW=y
 CONFIG_MEMORY_START=0x60000000
@@ -27,12 +27,12 @@ CONFIG_HIGHMEM=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
-CONFIG_CMDLINE="console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp"
-CONFIG_CMDLINE_FORCE=y
+CONFIG_VFP=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 # CONFIG_SUSPEND is not set
 CONFIG_PM_RUNTIME=y
 CONFIG_NET=y
+CONFIG_PACKET=y
 CONFIG_UNIX=y
 CONFIG_INET=y
 CONFIG_IP_PNP=y
@@ -44,8 +44,6 @@ CONFIG_IP_PNP_DHCP=y
 # CONFIG_INET_DIAG is not set
 # CONFIG_IPV6 is not set
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
-CONFIG_DEVTMPFS=y
-CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_FW_LOADER is not set
@@ -82,6 +80,7 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y
 # CONFIG_HWMON is not set
 CONFIG_I2C=y
 CONFIG_I2C_RCAR=y
+CONFIG_REGULATOR=y
 CONFIG_MEDIA_SUPPORT=y
 CONFIG_MEDIA_CAMERA_SUPPORT=y
 CONFIG_V4L_PLATFORM_DRIVERS=y
@@ -108,11 +107,12 @@ CONFIG_MMC_SDHI=y
 CONFIG_MMC_SH_MMCIF=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_RX8581=y
+CONFIG_DMADEVICES=y
+CONFIG_RCAR_HPB_DMAE=y
 CONFIG_UIO=y
 CONFIG_UIO_PDRV_GENIRQ=y
 # CONFIG_IOMMU_SUPPORT is not set
 # CONFIG_DNOTIFY is not set
-# CONFIG_INOTIFY_USER is not set
 CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_NFS_FS=y
diff --git a/arch/arm/configs/efm32_defconfig b/arch/arm/configs/efm32_defconfig
new file mode 100644 (file)
index 0000000..f59fffb
--- /dev/null
@@ -0,0 +1,102 @@
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_LOG_BUF_SHIFT=12
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+# CONFIG_UID16 is not set
+# CONFIG_BASE_FULL is not set
+# CONFIG_FUTEX is not set
+# CONFIG_EPOLL is not set
+# CONFIG_SIGNALFD is not set
+# CONFIG_EVENTFD is not set
+# CONFIG_AIO is not set
+CONFIG_EMBEDDED=y
+# CONFIG_VM_EVENT_COUNTERS is not set
+# CONFIG_SLUB_DEBUG is not set
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+# CONFIG_MMU is not set
+CONFIG_ARCH_EFM32=y
+# CONFIG_KUSER_HELPERS is not set
+CONFIG_SET_MEM_PARAM=y
+CONFIG_DRAM_BASE=0x88000000
+CONFIG_DRAM_SIZE=0x00400000
+CONFIG_FLASH_MEM_BASE=0x8c000000
+CONFIG_FLASH_SIZE=0x01000000
+CONFIG_PREEMPT=y
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_XIP_KERNEL=y
+CONFIG_XIP_PHYS_ADDR=0x8c000000
+CONFIG_BINFMT_FLAT=y
+CONFIG_BINFMT_SHARED_FLAT=y
+# CONFIG_COREDUMP is not set
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_WIRELESS is not set
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# CONFIG_FW_LOADER is not set
+CONFIG_MTD=y
+CONFIG_MTD_BLOCK_RO=y
+CONFIG_MTD_ROM=y
+CONFIG_MTD_UCLINUX=y
+CONFIG_PROC_DEVICETREE=y
+# CONFIG_BLK_DEV is not set
+CONFIG_NETDEVICES=y
+# CONFIG_NET_VENDOR_ARC is not set
+# CONFIG_NET_CADENCE is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CIRRUS is not set
+# CONFIG_NET_VENDOR_FARADAY is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+CONFIG_KS8851=y
+# CONFIG_NET_VENDOR_MICROCHIP is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+# CONFIG_NET_VENDOR_SMSC is not set
+# CONFIG_NET_VENDOR_STMICRO is not set
+# CONFIG_NET_VENDOR_VIA is not set
+# CONFIG_NET_VENDOR_WIZNET is not set
+# CONFIG_WLAN is not set
+# CONFIG_INPUT is not set
+# CONFIG_SERIO is not set
+# CONFIG_VT is not set
+# CONFIG_UNIX98_PTYS is not set
+# CONFIG_LEGACY_PTYS is not set
+CONFIG_SERIAL_NONSTANDARD=y
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_EFM32_UART=y
+CONFIG_SERIAL_EFM32_UART_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+CONFIG_SPI=y
+CONFIG_SPI_EFM32=y
+CONFIG_GPIO_SYSFS=y
+# CONFIG_USB_SUPPORT is not set
+CONFIG_MMC=y
+CONFIG_MMC_SPI=y
+# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_EXT2_FS=y
+# CONFIG_FILE_LOCKING is not set
+# CONFIG_DNOTIFY is not set
+# CONFIG_INOTIFY_USER is not set
+CONFIG_ROMFS_FS=y
+CONFIG_ROMFS_BACKED_BY_MTD=y
+# CONFIG_NETWORK_FILESYSTEMS is not set
+CONFIG_PRINTK_TIME=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_FTRACE is not set
index ad7dfbbafa453422fc5c986e2f749d3eaf609a0c..dbe1f1c47bb0defeb03635030fe9ec0f3ba8a42e 100644 (file)
@@ -13,7 +13,7 @@ CONFIG_S3C24XX_PWM=y
 CONFIG_ARCH_EXYNOS5=y
 CONFIG_MACH_EXYNOS4_DT=y
 CONFIG_SMP=y
-CONFIG_NR_CPUS=2
+CONFIG_NR_CPUS=8
 CONFIG_PREEMPT=y
 CONFIG_AEABI=y
 CONFIG_HIGHMEM=y
@@ -79,6 +79,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_GPIO=y
 CONFIG_REGULATOR_MAX8997=y
 CONFIG_REGULATOR_MAX77686=y
+CONFIG_REGULATOR_S2MPS11=y
 CONFIG_REGULATOR_S5M8767=y
 CONFIG_REGULATOR_TPS65090=y
 CONFIG_FB=y
diff --git a/arch/arm/configs/genmai_defconfig b/arch/arm/configs/genmai_defconfig
new file mode 100644 (file)
index 0000000..aa0b704
--- /dev/null
@@ -0,0 +1,116 @@
+CONFIG_SYSVIPC=y
+CONFIG_NO_HZ=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=16
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_EMBEDDED=y
+CONFIG_PERF_EVENTS=y
+CONFIG_SLAB=y
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+CONFIG_ARCH_SHMOBILE_LEGACY=y
+CONFIG_ARCH_R7S72100=y
+CONFIG_MACH_GENMAI=y
+# CONFIG_SH_TIMER_CMT is not set
+# CONFIG_SH_TIMER_MTU2 is not set
+# CONFIG_SH_TIMER_TMU is not set
+# CONFIG_EM_TIMER_STI is not set
+CONFIG_ARM_ERRATA_430973=y
+CONFIG_ARM_ERRATA_458693=y
+CONFIG_ARM_ERRATA_460075=y
+CONFIG_ARM_ERRATA_743622=y
+CONFIG_ARM_ERRATA_754322=y
+CONFIG_AEABI=y
+# CONFIG_OABI_COMPAT is not set
+CONFIG_FORCE_MAX_ZONEORDER=13
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_ARM_APPENDED_DTB=y
+CONFIG_KEXEC=y
+CONFIG_AUTO_ZRELADDR=y
+CONFIG_VFP=y
+CONFIG_NEON=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+CONFIG_PM_RUNTIME=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_WIRELESS is not set
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+CONFIG_NETDEVICES=y
+# CONFIG_NET_CORE is not set
+# CONFIG_NET_VENDOR_ARC is not set
+# CONFIG_NET_CADENCE is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CIRRUS is not set
+# CONFIG_NET_VENDOR_FARADAY is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+CONFIG_SH_ETH=y
+# CONFIG_NET_VENDOR_SEEQ is not set
+# CONFIG_NET_VENDOR_SMSC is not set
+# CONFIG_NET_VENDOR_STMICRO is not set
+# CONFIG_NET_VENDOR_VIA is not set
+# CONFIG_NET_VENDOR_WIZNET is not set
+# CONFIG_WLAN is not set
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_KEYBOARD_ATKBD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+# CONFIG_LEGACY_PTYS is not set
+CONFIG_SERIAL_SH_SCI=y
+CONFIG_SERIAL_SH_SCI_NR_UARTS=10
+CONFIG_SERIAL_SH_SCI_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+CONFIG_I2C_SH_MOBILE=y
+# CONFIG_HWMON is not set
+CONFIG_THERMAL=y
+CONFIG_RCAR_THERMAL=y
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
+CONFIG_DRM=y
+CONFIG_DRM_RCAR_DU=y
+# CONFIG_USB_SUPPORT is not set
+CONFIG_MMC=y
+CONFIG_MMC_SDHI=y
+CONFIG_MMC_SH_MMCIF=y
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_RTC_CLASS=y
+CONFIG_DMADEVICES=y
+CONFIG_SH_DMAE=y
+# CONFIG_IOMMU_SUPPORT is not set
+# CONFIG_DNOTIFY is not set
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_TMPFS=y
+CONFIG_CONFIGFS_FS=y
+# CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+CONFIG_NFS_V4_1=y
+CONFIG_ROOT_NFS=y
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+# CONFIG_ARM_UNWIND is not set
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+# CONFIG_CRYPTO_HW is not set
diff --git a/arch/arm/configs/hi3xxx_defconfig b/arch/arm/configs/hi3xxx_defconfig
new file mode 100644 (file)
index 0000000..f186bdf
--- /dev/null
@@ -0,0 +1,56 @@
+CONFIG_IRQ_DOMAIN_DEBUG=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_RD_LZMA=y
+CONFIG_ARCH_HI3xxx=y
+CONFIG_SMP=y
+CONFIG_PREEMPT=y
+CONFIG_AEABI=y
+CONFIG_ARM_APPENDED_DTB=y
+CONFIG_NET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_ATA=y
+CONFIG_SATA_AHCI_PLATFORM=y
+CONFIG_NETDEVICES=y
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_I2C_DESIGNWARE_PLATFORM=y
+CONFIG_SPI=y
+CONFIG_SPI_PL022=y
+CONFIG_PINCTRL_SINGLE=y
+CONFIG_GPIO_GENERIC_PLATFORM=y
+CONFIG_REGULATOR_GPIO=y
+CONFIG_DRM=y
+CONFIG_FB_SIMPLE=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_MXC=y
+CONFIG_USB_EHCI_HCD_PLATFORM=y
+CONFIG_USB_STORAGE=y
+CONFIG_NOP_USB_XCEIV=y
+CONFIG_MMC=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_PL031=y
+CONFIG_DMADEVICES=y
+CONFIG_DW_DMAC=y
+CONFIG_PL330_DMA=y
+CONFIG_PWM=y
+CONFIG_EXT4_FS=y
+CONFIG_TMPFS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+CONFIG_ROOT_NFS=y
+CONFIG_PRINTK_TIME=y
+CONFIG_DEBUG_FS=y
+CONFIG_DEBUG_KERNEL=y
+CONFIG_LOCKUP_DETECTOR=y
index e958ebe7977984be0a2a30746b2acefcfadfecca..6309ee52ccfcb3d74563f8ea6d5bfe396daf546c 100644 (file)
@@ -91,6 +91,7 @@ CONFIG_SMSC911X=y
 CONFIG_SMSC_PHY=y
 # CONFIG_INPUT_MOUSEDEV is not set
 CONFIG_INPUT_EVDEV=y
+CONFIG_KEYBOARD_GPIO=y
 CONFIG_KEYBOARD_IMX=y
 # CONFIG_INPUT_MOUSE is not set
 CONFIG_INPUT_TOUCHSCREEN=y
@@ -118,6 +119,7 @@ CONFIG_IMX2_WDT=y
 CONFIG_MFD_MC13XXX_SPI=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
+CONFIG_REGULATOR_GPIO=y
 CONFIG_REGULATOR_MC13783=y
 CONFIG_REGULATOR_MC13892=y
 CONFIG_MEDIA_SUPPORT=y
index 8d0c5a018ed72b720f0b235be8dff2ee9bf1e77a..53e82c2523ebe0bbff2b1ddde62ab9a026799dd9 100644 (file)
@@ -28,11 +28,13 @@ CONFIG_MACH_QONG=y
 CONFIG_MACH_ARMADILLO5X0=y
 CONFIG_MACH_KZM_ARM11_01=y
 CONFIG_MACH_IMX31_DT=y
+CONFIG_MACH_IMX35_DT=y
 CONFIG_MACH_PCM043=y
 CONFIG_MACH_MX35_3DS=y
 CONFIG_MACH_VPR200=y
 CONFIG_MACH_IMX51_DT=y
 CONFIG_MACH_EUKREA_CPUIMX51SD=y
+CONFIG_SOC_IMX50=y
 CONFIG_SOC_IMX53=y
 CONFIG_SOC_IMX6Q=y
 CONFIG_SOC_IMX6SL=y
@@ -41,7 +43,7 @@ CONFIG_SMP=y
 CONFIG_VMSPLIT_2G=y
 CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_AEABI=y
-# CONFIG_OABI_COMPAT is not set
+CONFIG_HIGHMEM=y
 CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
 CONFIG_VFP=y
 CONFIG_NEON=y
@@ -89,7 +91,6 @@ CONFIG_MTD_UBI=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=65536
-CONFIG_SRAM=y
 CONFIG_EEPROM_AT24=y
 CONFIG_EEPROM_AT25=y
 # CONFIG_SCSI_PROC_FS is not set
@@ -118,6 +119,7 @@ CONFIG_SMC91X=y
 CONFIG_SMC911X=y
 CONFIG_SMSC911X=y
 # CONFIG_NET_VENDOR_STMICRO is not set
+CONFIG_AT803X_PHY=y
 CONFIG_BRCMFMAC=m
 # CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 CONFIG_INPUT_EVDEV=y
@@ -129,6 +131,8 @@ CONFIG_MOUSE_PS2_ELANTECH=y
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_TOUCHSCREEN_EGALAX=y
 CONFIG_TOUCHSCREEN_MC13783=y
+CONFIG_TOUCHSCREEN_TSC2007=y
+CONFIG_TOUCHSCREEN_STMPE=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_MMA8450=y
 CONFIG_SERIO_SERPORT=m
@@ -156,14 +160,19 @@ CONFIG_IMX2_WDT=y
 CONFIG_MFD_DA9052_I2C=y
 CONFIG_MFD_MC13XXX_SPI=y
 CONFIG_MFD_MC13XXX_I2C=y
+CONFIG_MFD_STMPE=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_ANATOP=y
 CONFIG_REGULATOR_DA9052=y
 CONFIG_REGULATOR_MC13783=y
 CONFIG_REGULATOR_MC13892=y
+CONFIG_REGULATOR_PFUZE100=y
 CONFIG_MEDIA_SUPPORT=y
 CONFIG_MEDIA_CAMERA_SUPPORT=y
+CONFIG_MEDIA_RC_SUPPORT=y
+CONFIG_RC_DEVICES=y
+CONFIG_IR_GPIO_CIR=y
 CONFIG_V4L_PLATFORM_DRIVERS=y
 CONFIG_SOC_CAMERA=y
 CONFIG_VIDEO_MX3=y
index 9943e5da74f18c8ffe89168829eb3326d0de1b47..a0182447d1334d6823d7e397e3a9a94cbd8c1e12 100644 (file)
@@ -115,6 +115,8 @@ CONFIG_MTD_UBI=y
 CONFIG_PROC_DEVICETREE=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_EEPROM_AT24=y
+CONFIG_SCSI=y
+CONFIG_BLK_DEV_SD=y
 CONFIG_NETDEVICES=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
@@ -129,10 +131,24 @@ CONFIG_SPI_DAVINCI=y
 CONFIG_SPI_SPIDEV=y
 # CONFIG_HWMON is not set
 CONFIG_WATCHDOG=y
-# CONFIG_USB_SUPPORT is not set
+CONFIG_USB=y
+CONFIG_USB_DEBUG=y
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+CONFIG_USB_MON=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_DEBUG=y
+CONFIG_USB_DWC3_VERBOSE=y
+CONFIG_KEYSTONE_USB_PHY=y
 CONFIG_DMADEVICES=y
 CONFIG_COMMON_CLK_DEBUG=y
 CONFIG_MEMORY=y
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_FS_POSIX_ACL=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_NTFS_FS=y
 CONFIG_TMPFS=y
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_FS_WBUF_VERIFY=y
@@ -144,6 +160,8 @@ CONFIG_ROOT_NFS=y
 CONFIG_NFSD=y
 CONFIG_NFSD_V3=y
 CONFIG_NFSD_V3_ACL=y
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_ISO8859_1=y
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_SHIRQ=y
 CONFIG_DEBUG_INFO=y
index 0ae0eaebf6b22ea7c71ed5746ee448029346af9f..2e762d94e94b31501c1e7e3ea16965c72d3d9b9c 100644 (file)
@@ -27,6 +27,7 @@ CONFIG_PCI_MVEBU=y
 CONFIG_PREEMPT=y
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
+CONFIG_HIGHMEM=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_CPU_FREQ=y
index 825c16dee8a002689b6498ad94c0421ea19aef13..e248f49d55498491d00434467826a512d2fe9c2a 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 # CONFIG_BLOCK is not set
-CONFIG_ARCH_SHMOBILE=y
+CONFIG_ARCH_SHMOBILE_LEGACY=y
 CONFIG_ARCH_R8A7791=y
 CONFIG_MACH_KOELSCH=y
 # CONFIG_SWP_EMULATE is not set
@@ -29,7 +29,29 @@ CONFIG_VFP=y
 CONFIG_NEON=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 CONFIG_PM_RUNTIME=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+CONFIG_NETDEVICES=y
+# CONFIG_NET_VENDOR_ARC is not set
+# CONFIG_NET_CADENCE is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CIRRUS is not set
+# CONFIG_NET_VENDOR_FARADAY is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+CONFIG_SH_ETH=y
+# CONFIG_NET_VENDOR_SEEQ is not set
+# CONFIG_NET_VENDOR_SMSC is not set
+# CONFIG_NET_VENDOR_STMICRO is not set
+# CONFIG_NET_VENDOR_VIA is not set
+# CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -45,10 +67,11 @@ CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
 # CONFIG_IOMMU_SUPPORT is not set
 # CONFIG_DNOTIFY is not set
-# CONFIG_INOTIFY_USER is not set
 CONFIG_TMPFS=y
 CONFIG_CONFIGFS_FS=y
 # CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NFS_FS=y
+CONFIG_ROOT_NFS=y
 # CONFIG_ENABLE_WARN_DEPRECATED is not set
 # CONFIG_ENABLE_MUST_CHECK is not set
 # CONFIG_ARM_UNWIND is not set
index 6c37f4a98eb82b3dbabdecf9a2f60dceb5737aa4..e42ce3756af3e9cac163fca222fcbcb3c30fb440 100644 (file)
@@ -13,7 +13,7 @@ CONFIG_SLAB=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_DEADLINE is not set
 # CONFIG_IOSCHED_CFQ is not set
-CONFIG_ARCH_SHMOBILE=y
+CONFIG_ARCH_SHMOBILE_LEGACY=y
 CONFIG_ARCH_EMEV2=y
 CONFIG_MACH_KZM9D=y
 CONFIG_MEMORY_START=0x40000000
@@ -32,6 +32,7 @@ CONFIG_FORCE_MAX_ZONEORDER=13
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
+CONFIG_AUTO_ZRELADDR=y
 CONFIG_VFP=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 CONFIG_PM_RUNTIME=y
index 1ad028023a6460e3b665b4044c6994232b9b3ca1..9934dbc23d64f7892d09e213720cbf0ff6b581c8 100644 (file)
@@ -22,7 +22,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_DEADLINE is not set
 # CONFIG_IOSCHED_CFQ is not set
-CONFIG_ARCH_SHMOBILE=y
+CONFIG_ARCH_SHMOBILE_LEGACY=y
 CONFIG_ARCH_SH73A0=y
 CONFIG_MACH_KZM9G=y
 CONFIG_MEMORY_START=0x41000000
index 35bff5e0d57a26b799e4554497859dcf1f029e9b..883443f8f4f30ec5af446e5683e08cfad512b3e8 100644 (file)
@@ -12,7 +12,7 @@ CONFIG_SLAB=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_DEADLINE is not set
 # CONFIG_IOSCHED_CFQ is not set
-CONFIG_ARCH_SHMOBILE=y
+CONFIG_ARCH_SHMOBILE_LEGACY=y
 CONFIG_ARCH_R8A7790=y
 CONFIG_MACH_LAGER=y
 # CONFIG_SH_TIMER_TMU is not set
@@ -80,7 +80,7 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y
 # CONFIG_HW_RANDOM is not set
 CONFIG_I2C=y
 CONFIG_I2C_GPIO=y
-CONFIG_I2C_SH_MOBILE=y
+CONFIG_I2C_RCAR=y
 CONFIG_GPIO_SH_PFC=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_RCAR=y
@@ -89,6 +89,7 @@ CONFIG_THERMAL=y
 CONFIG_RCAR_THERMAL=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
+CONFIG_REGULATOR_GPIO=y
 CONFIG_DRM=y
 CONFIG_DRM_RCAR_DU=y
 # CONFIG_USB_SUPPORT is not set
index 9fb11895b2e27f73663b547a7abb4719adeece34..a61e1653fc5e07c728b5cc17048968818ed53117 100644 (file)
@@ -14,7 +14,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_DEADLINE is not set
 # CONFIG_IOSCHED_CFQ is not set
-CONFIG_ARCH_SHMOBILE=y
+CONFIG_ARCH_SHMOBILE_LEGACY=y
 CONFIG_ARCH_SH7372=y
 CONFIG_MACH_MACKEREL=y
 CONFIG_MEMORY_SIZE=0x10000000
index 5cc6360340b1c683dfe5b31c15a54c61e457963a..f21bd405cc2a4f3d756bc11cae91f8f332f41732 100644 (file)
@@ -9,7 +9,7 @@ CONFIG_SYSCTL_SYSCALL=y
 CONFIG_EMBEDDED=y
 CONFIG_SLAB=y
 # CONFIG_IOSCHED_CFQ is not set
-CONFIG_ARCH_SHMOBILE=y
+CONFIG_ARCH_SHMOBILE_LEGACY=y
 CONFIG_ARCH_R8A7779=y
 CONFIG_MACH_MARZEN=y
 CONFIG_MEMORY_START=0x60000000
@@ -30,12 +30,12 @@ CONFIG_HIGHMEM=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
-CONFIG_CMDLINE="console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel root=/dev/nfs ip=on"
-CONFIG_CMDLINE_FORCE=y
+CONFIG_VFP=y
 CONFIG_KEXEC=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 CONFIG_PM_RUNTIME=y
 CONFIG_NET=y
+CONFIG_PACKET=y
 CONFIG_UNIX=y
 CONFIG_INET=y
 CONFIG_IP_PNP=y
@@ -43,8 +43,6 @@ CONFIG_IP_PNP_DHCP=y
 # CONFIG_IPV6 is not set
 # CONFIG_WIRELESS is not set
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
-CONFIG_DEVTMPFS=y
-CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_FW_LOADER is not set
@@ -61,7 +59,6 @@ CONFIG_NETDEVICES=y
 # CONFIG_NET_VENDOR_MICREL is not set
 # CONFIG_NET_VENDOR_NATSEMI is not set
 # CONFIG_NET_VENDOR_SEEQ is not set
-CONFIG_SMC911X=y
 CONFIG_SMSC911X=y
 # CONFIG_NET_VENDOR_STMICRO is not set
 # CONFIG_WLAN is not set
@@ -106,11 +103,12 @@ CONFIG_USB_STORAGE=y
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
 CONFIG_LEDS_GPIO=y
+CONFIG_DMADEVICES=y
+CONFIG_RCAR_HPB_DMAE=y
 CONFIG_UIO=y
 CONFIG_UIO_PDRV_GENIRQ=y
 # CONFIG_IOMMU_SUPPORT is not set
 # CONFIG_DNOTIFY is not set
-# CONFIG_INOTIFY_USER is not set
 CONFIG_TMPFS=y
 # CONFIG_MISC_FILESYSTEMS is not set
 CONFIG_NFS_FS=y
diff --git a/arch/arm/configs/moxart_defconfig b/arch/arm/configs/moxart_defconfig
new file mode 100644 (file)
index 0000000..a3cb76c
--- /dev/null
@@ -0,0 +1,149 @@
+# CONFIG_LOCALVERSION_AUTO is not set
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+CONFIG_NO_HZ=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_SYSCTL_SYSCALL=y
+# CONFIG_ELF_CORE is not set
+# CONFIG_BASE_FULL is not set
+# CONFIG_SIGNALFD is not set
+# CONFIG_TIMERFD is not set
+# CONFIG_EVENTFD is not set
+# CONFIG_AIO is not set
+CONFIG_EMBEDDED=y
+# CONFIG_VM_EVENT_COUNTERS is not set
+# CONFIG_SLUB_DEBUG is not set
+# CONFIG_COMPAT_BRK is not set
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+CONFIG_ARCH_MULTI_V4T=y
+# CONFIG_ARCH_MULTI_V7 is not set
+CONFIG_KEYBOARD_GPIO_POLLED=y
+CONFIG_ARCH_MOXART=y
+CONFIG_MACH_UC7112LX=y
+CONFIG_PREEMPT=y
+CONFIG_AEABI=y
+# CONFIG_ATAGS is not set
+CONFIG_ARM_APPENDED_DTB=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_WIRELESS is not set
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# CONFIG_PREVENT_FIRMWARE_BUILD is not set
+# CONFIG_FW_LOADER is not set
+CONFIG_MTD=y
+CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CFI=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_GEOMETRY=y
+CONFIG_MTD_CFI_INTELEXT=y
+CONFIG_MTD_COMPLEX_MAPPINGS=y
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_OF=y
+CONFIG_PROC_DEVICETREE=y
+CONFIG_NETDEVICES=y
+CONFIG_NETCONSOLE=y
+CONFIG_NETCONSOLE_DYNAMIC=y
+# CONFIG_NET_VENDOR_ARC is not set
+# CONFIG_NET_CADENCE is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_CIRRUS is not set
+# CONFIG_NET_VENDOR_FARADAY is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+CONFIG_ARM_MOXART_ETHER=y
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+# CONFIG_NET_VENDOR_SMSC is not set
+# CONFIG_NET_VENDOR_STMICRO is not set
+# CONFIG_NET_VENDOR_VIA is not set
+# CONFIG_NET_VENDOR_WIZNET is not set
+CONFIG_REALTEK_PHY=y
+CONFIG_MDIO_MOXART=y
+# CONFIG_WLAN is not set
+# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_EVDEV=y
+CONFIG_INPUT_EVBUG=y
+# CONFIG_KEYBOARD_ATKBD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+# CONFIG_VT is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=1
+CONFIG_SERIAL_8250_RUNTIME_UARTS=1
+CONFIG_SERIAL_8250_EXTENDED=y
+CONFIG_SERIAL_8250_SHARE_IRQ=y
+CONFIG_SERIAL_OF_PLATFORM=y
+# CONFIG_HW_RANDOM is not set
+CONFIG_DEBUG_GPIO=y
+CONFIG_GPIO_SYSFS=y
+CONFIG_GPIO_MOXART=y
+CONFIG_POWER_SUPPLY=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_GPIO=y
+# CONFIG_HWMON is not set
+CONFIG_WATCHDOG=y
+CONFIG_WATCHDOG_CORE=y
+CONFIG_WATCHDOG_NOWAYOUT=y
+CONFIG_MOXART_WDT=y
+# CONFIG_USB_SUPPORT is not set
+CONFIG_MMC=y
+CONFIG_MMC_SDHCI_MOXART=y
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_ONESHOT=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_MOXART=y
+CONFIG_DMADEVICES=y
+CONFIG_MOXART_DMA=y
+# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_EXT3_FS=y
+CONFIG_TMPFS=y
+CONFIG_CONFIGFS_FS=y
+CONFIG_JFFS2_FS=y
+CONFIG_PRINTK_TIME=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_DEBUG_PAGEALLOC=y
+CONFIG_DEBUG_OBJECTS=y
+CONFIG_DEBUG_KMEMLEAK=y
+CONFIG_DEBUG_STACK_USAGE=y
+CONFIG_DEBUG_MEMORY_INIT=y
+CONFIG_DEBUG_SHIRQ=y
+CONFIG_DETECT_HUNG_TASK=y
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_DEBUG_PREEMPT is not set
+CONFIG_PROVE_LOCKING=y
+CONFIG_DMA_API_DEBUG=y
+CONFIG_KGDB=y
+CONFIG_DEBUG_LL=y
+CONFIG_DEBUG_LL_UART_8250=y
+CONFIG_DEBUG_UART_PHYS=0x98200000
+CONFIG_DEBUG_UART_VIRT=0xf9820000
+CONFIG_EARLY_PRINTK=y
+CONFIG_KEYS=y
+CONFIG_CRC32_BIT=y
index 690b5f9c7462b8f6b09431cff11c16b0dc990589..0219c65cefd5ab24c12afa762cfd8697996f64ce 100644 (file)
@@ -17,9 +17,10 @@ CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 CONFIG_MODVERSIONS=y
 CONFIG_PARTITION_ADVANCED=y
-CONFIG_ARCH_MSM=y
+CONFIG_ARCH_MSM_DT=y
 CONFIG_ARCH_MSM8X60=y
 CONFIG_ARCH_MSM8960=y
+CONFIG_ARCH_MSM8974=y
 CONFIG_SMP=y
 CONFIG_PREEMPT=y
 CONFIG_AEABI=y
@@ -29,7 +30,6 @@ CONFIG_CLEANCACHE=y
 CONFIG_CC_STACKPROTECTOR=y
 CONFIG_ARM_APPENDED_DTB=y
 CONFIG_ARM_ATAG_DTB_COMPAT=y
-CONFIG_AUTO_ZRELADDR=y
 CONFIG_VFP=y
 CONFIG_NEON=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
@@ -62,7 +62,6 @@ CONFIG_SCSI_LOGGING=y
 CONFIG_SCSI_SCAN_ASYNC=y
 CONFIG_NETDEVICES=y
 CONFIG_DUMMY=y
-CONFIG_PHYLIB=y
 CONFIG_SLIP=y
 CONFIG_SLIP_COMPRESSED=y
 CONFIG_SLIP_MODE_SLIP6=y
@@ -81,13 +80,15 @@ CONFIG_SERIO_LIBPS2=y
 CONFIG_SERIAL_MSM=y
 CONFIG_SERIAL_MSM_CONSOLE=y
 CONFIG_HW_RANDOM=y
+CONFIG_HW_RANDOM_MSM=y
 CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_SPI=y
-CONFIG_SSBI=y
 CONFIG_DEBUG_GPIO=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_POWER_SUPPLY=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_MSM=y
 CONFIG_THERMAL=y
 CONFIG_REGULATOR=y
 CONFIG_MEDIA_SUPPORT=y
@@ -101,7 +102,6 @@ CONFIG_SND_DYNAMIC_MINORS=y
 CONFIG_SND_SOC=y
 CONFIG_HID_BATTERY_STRENGTH=y
 CONFIG_USB=y
-CONFIG_USB_PHY=y
 CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
 CONFIG_USB_MON=y
 CONFIG_USB_EHCI_HCD=y
@@ -128,10 +128,10 @@ CONFIG_NFS_V3_ACL=y
 CONFIG_NFS_V4=y
 CONFIG_CIFS=y
 CONFIG_PRINTK_TIME=y
+CONFIG_DYNAMIC_DEBUG=y
+CONFIG_DEBUG_INFO=y
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_LOCKUP_DETECTOR=y
 # CONFIG_DETECT_HUNG_TASK is not set
 # CONFIG_SCHED_DEBUG is not set
 CONFIG_TIMER_STATS=y
-CONFIG_DEBUG_INFO=y
-CONFIG_DYNAMIC_DEBUG=y
index c1df4e9db140831e45e5b91b2c280b1a1d813fef..687e4e811b2aa0d2d191df4d64adad96c541576a 100644 (file)
@@ -7,8 +7,12 @@ CONFIG_MACH_ARMADA_370=y
 CONFIG_MACH_ARMADA_XP=y
 CONFIG_ARCH_BCM=y
 CONFIG_ARCH_BCM_MOBILE=y
+CONFIG_ARCH_BERLIN=y
+CONFIG_MACH_BERLIN_BG2=y
+CONFIG_MACH_BERLIN_BG2CD=y
 CONFIG_GPIO_PCA953X=y
 CONFIG_ARCH_HIGHBANK=y
+CONFIG_ARCH_HI3xxx=y
 CONFIG_ARCH_KEYSTONE=y
 CONFIG_ARCH_MXC=y
 CONFIG_MACH_IMX51_DT=y
@@ -68,6 +72,7 @@ CONFIG_NET_CALXEDA_XGMAC=y
 CONFIG_KS8851=y
 CONFIG_SMSC911X=y
 CONFIG_STMMAC_ETH=y
+CONFIG_ICPLUS_PHY=y
 CONFIG_MDIO_SUN4I=y
 CONFIG_TI_CPSW=y
 CONFIG_KEYBOARD_SPEAR=y
@@ -91,6 +96,8 @@ CONFIG_SERIAL_XILINX_PS_UART=y
 CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
 CONFIG_SERIAL_FSL_LPUART=y
 CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
+CONFIG_SERIAL_ST_ASC=y
+CONFIG_SERIAL_ST_ASC_CONSOLE=y
 CONFIG_I2C_DESIGNWARE_PLATFORM=y
 CONFIG_I2C_SIRF=y
 CONFIG_I2C_TEGRA=y
index 594d706b641f8df1de256c875d638795acaa054f..0f4511d2849f6cb05bd99aa6c49acf3efceeabfb 100644 (file)
@@ -55,6 +55,8 @@ CONFIG_MTD_CFI_INTELEXT=y
 CONFIG_MTD_CFI_AMDSTD=y
 CONFIG_MTD_CFI_STAA=y
 CONFIG_MTD_PHYSMAP_OF=y
+CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_PXA3xx=y
 CONFIG_SERIAL_8250_DW=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_SYSFS=y
@@ -69,6 +71,7 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_MMC=y
 CONFIG_MMC_MVSDIO=y
 CONFIG_NEW_LEDS=y
+CONFIG_LEDS_GPIO=y
 CONFIG_LEDS_CLASS=m
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
index bfa80a11e8c76304c800f2df62090f1f50d089c1..3a0b53d225e7093098d87398e55dba32ecfef98b 100644 (file)
@@ -208,6 +208,8 @@ CONFIG_SND_DEBUG=y
 CONFIG_SND_USB_AUDIO=m
 CONFIG_SND_SOC=m
 CONFIG_SND_OMAP_SOC=m
+CONFIG_SND_AM33XX_SOC_EVM=m
+CONFIG_SND_DAVINCI_SOC=m
 CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m
 CONFIG_SND_OMAP_SOC_OMAP_ABE_TWL6040=m
 CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
@@ -222,6 +224,7 @@ CONFIG_USB_TEST=y
 CONFIG_NOP_USB_XCEIV=y
 CONFIG_OMAP_USB2=y
 CONFIG_OMAP_USB3=y
+CONFIG_AM335X_PHY_USB=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DEBUG=y
 CONFIG_USB_GADGET_DEBUG_FILES=y
index f6e78f83c3c3f593f88033919f7da3ec8f1b5b61..dc3881e07630c8924356436936927d020055862a 100644 (file)
@@ -20,7 +20,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_SOC_SAM_V7=y
 CONFIG_SOC_SAMA5D3=y
 CONFIG_MACH_SAMA5_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
 CONFIG_UACCESS_WITH_MEMCPY=y
index 4934295bb4f0905df99d302e4bd11eef2f4a659c..5fdc9a09d33919e82b82aeb62de5e27aff84c192 100644 (file)
@@ -33,11 +33,12 @@ CONFIG_PCI=y
 CONFIG_PCI_MSI=y
 CONFIG_PCI_TEGRA=y
 CONFIG_PCIEPORTBUS=y
+CONFIG_TRUSTED_FOUNDATIONS=y
 CONFIG_SMP=y
 CONFIG_PREEMPT=y
 CONFIG_AEABI=y
-# CONFIG_OABI_COMPAT is not set
 CONFIG_HIGHMEM=y
+CONFIG_CMA=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_KEXEC=y
@@ -63,7 +64,6 @@ CONFIG_INET_ESP=y
 # CONFIG_INET_LRO is not set
 # CONFIG_INET_DIAG is not set
 CONFIG_IPV6=y
-CONFIG_IPV6_PRIVACY=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_IPV6_OPTIMISTIC_DAD=y
 CONFIG_INET6_AH=y
@@ -85,7 +85,6 @@ CONFIG_RFKILL_GPIO=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_FIRMWARE_IN_KERNEL is not set
-CONFIG_CMA=y
 CONFIG_DMA_CMA=y
 CONFIG_MTD=y
 CONFIG_MTD_M25P80=y
@@ -114,6 +113,7 @@ CONFIG_RT2800USB=m
 CONFIG_INPUT_EVDEV=y
 CONFIG_KEYBOARD_GPIO=y
 CONFIG_KEYBOARD_TEGRA=y
+CONFIG_KEYBOARD_CROS_EC=y
 CONFIG_MOUSE_PS2_ELANTECH=y
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_MPU3050=y
@@ -132,6 +132,7 @@ CONFIG_SPI=y
 CONFIG_SPI_TEGRA114=y
 CONFIG_SPI_TEGRA20_SFLASH=y
 CONFIG_SPI_TEGRA20_SLINK=y
+CONFIG_PINCTRL_AS3722=y
 CONFIG_PINCTRL_PALMAS=y
 CONFIG_GPIO_PCA953X_IRQ=y
 CONFIG_GPIO_PALMAS=y
@@ -143,6 +144,9 @@ CONFIG_CHARGER_TPS65090=y
 CONFIG_POWER_RESET=y
 CONFIG_POWER_RESET_GPIO=y
 CONFIG_SENSORS_LM90=y
+CONFIG_MFD_AS3722=y
+CONFIG_MFD_CROS_EC=y
+CONFIG_MFD_CROS_EC_SPI=y
 CONFIG_MFD_MAX8907=y
 CONFIG_MFD_PALMAS=y
 CONFIG_MFD_TPS65090=y
@@ -151,6 +155,7 @@ CONFIG_MFD_TPS65910=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
+CONFIG_REGULATOR_AS3722=y
 CONFIG_REGULATOR_GPIO=y
 CONFIG_REGULATOR_MAX8907=y
 CONFIG_REGULATOR_PALMAS=y
@@ -164,7 +169,8 @@ CONFIG_MEDIA_CAMERA_SUPPORT=y
 CONFIG_MEDIA_USB_SUPPORT=y
 CONFIG_USB_VIDEO_CLASS=m
 CONFIG_DRM=y
-CONFIG_TEGRA_HOST1X=y
+CONFIG_DRM_PANEL=y
+CONFIG_DRM_PANEL_SIMPLE=y
 CONFIG_DRM_TEGRA=y
 CONFIG_BACKLIGHT_LCD_SUPPORT=y
 # CONFIG_LCD_CLASS_DEVICE is not set
@@ -187,6 +193,7 @@ CONFIG_SND_SOC_TEGRA_WM8753=y
 CONFIG_SND_SOC_TEGRA_WM8903=y
 CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
 CONFIG_SND_SOC_TEGRA_ALC5632=y
+CONFIG_SND_SOC_TEGRA_MAX98090=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_EHCI_HCD=y
@@ -211,6 +218,7 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
 CONFIG_LEDS_TRIGGER_TRANSIENT=y
 CONFIG_LEDS_TRIGGER_CAMERA=y
 CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_AS3722=y
 CONFIG_RTC_DRV_MAX8907=y
 CONFIG_RTC_DRV_PALMAS=y
 CONFIG_RTC_DRV_TPS6586X=y
@@ -256,16 +264,15 @@ CONFIG_ROOT_NFS=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_PRINTK_TIME=y
+CONFIG_DEBUG_INFO=y
 CONFIG_MAGIC_SYSRQ=y
-CONFIG_DEBUG_FS=y
+CONFIG_DEBUG_SLAB=y
+CONFIG_DEBUG_VM=y
 CONFIG_DETECT_HUNG_TASK=y
 CONFIG_SCHEDSTATS=y
 CONFIG_TIMER_STATS=y
-CONFIG_DEBUG_SLAB=y
 # CONFIG_DEBUG_PREEMPT is not set
 CONFIG_DEBUG_MUTEXES=y
-CONFIG_DEBUG_INFO=y
-CONFIG_DEBUG_VM=y
 CONFIG_DEBUG_SG=y
 CONFIG_DEBUG_LL=y
 CONFIG_EARLY_PRINTK=y
index c6ebc184bf68201c69a0791ed83f0bbfc64b4348..65f77885c1674df038d6d92d17603e76e0058a46 100644 (file)
@@ -119,6 +119,7 @@ CONFIG_NFS_FS=y
 CONFIG_ROOT_NFS=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
+CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_FS=y
 CONFIG_MAGIC_SYSRQ=y
index 2ba9e63d0f177142699a56e4a4b3408cee10df43..073541a50e2313869aeb0d0c60fd705e9833cec5 100644 (file)
@@ -1,5 +1,3 @@
-CONFIG_ARCH_VERSATILE=y
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_LOG_BUF_SHIFT=14
@@ -7,15 +5,16 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_SLAB=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
+CONFIG_PARTITION_ADVANCED=y
+CONFIG_ARCH_VERSATILE=y
 CONFIG_MACH_VERSATILE_AB=y
-CONFIG_LEDS=y
-CONFIG_LEDS_CPU=y
+CONFIG_AEABI=y
+CONFIG_OABI_COMPAT=y
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_CMDLINE="root=1f03 mem=32M"
 CONFIG_FPE_NWFPE=y
 CONFIG_VFP=y
-CONFIG_PM=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
@@ -26,9 +25,7 @@ CONFIG_IP_PNP_BOOTP=y
 # CONFIG_INET_DIAG is not set
 # CONFIG_IPV6 is not set
 CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
 CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_CHAR=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_CFI=y
 CONFIG_MTD_CFI_ADV_OPTIONS=y
@@ -37,10 +34,10 @@ CONFIG_MTD_PHYSMAP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_EEPROM_LEGACY=m
 CONFIG_NETDEVICES=y
-CONFIG_NET_ETHERNET=y
 CONFIG_SMC91X=y
 # CONFIG_SERIO_SERPORT is not set
 CONFIG_SERIO_AMBAKMI=y
+CONFIG_LEGACY_PTY_COUNT=16
 CONFIG_SERIAL_8250=m
 CONFIG_SERIAL_8250_EXTENDED=y
 CONFIG_SERIAL_8250_MANY_PORTS=y
@@ -48,15 +45,14 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
 CONFIG_SERIAL_8250_RSA=y
 CONFIG_SERIAL_AMBA_PL011=y
 CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
-CONFIG_LEGACY_PTY_COUNT=16
 CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=m
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_PL061=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
 CONFIG_FB_ARMCLCD=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_FONTS=y
-CONFIG_FONT_ACORN_8x8=y
 CONFIG_SOUND=y
 CONFIG_SND=m
 CONFIG_SND_MIXER_OSS=m
@@ -64,6 +60,9 @@ CONFIG_SND_PCM_OSS=m
 CONFIG_SND_ARMAACI=m
 CONFIG_MMC=y
 CONFIG_MMC_ARMMMCI=m
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+CONFIG_LEDS_TRIGGER_CPU=y
 CONFIG_EXT2_FS=y
 CONFIG_VFAT_FS=m
 CONFIG_JFFS2_FS=y
@@ -71,15 +70,14 @@ CONFIG_CRAMFS=y
 CONFIG_MINIX_FS=y
 CONFIG_ROMFS_FS=y
 CONFIG_NFS_FS=y
-CONFIG_NFS_V3=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=y
 CONFIG_NFSD_V3=y
-CONFIG_PARTITION_ADVANCED=y
 CONFIG_NLS_CODEPAGE_850=m
 CONFIG_NLS_ISO8859_1=m
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_DEBUG_USER=y
-CONFIG_DEBUG_ERRORS=y
 CONFIG_DEBUG_LL=y
+CONFIG_FONTS=y
+CONFIG_FONT_ACORN_8x8=y
diff --git a/arch/arm/firmware/Kconfig b/arch/arm/firmware/Kconfig
new file mode 100644 (file)
index 0000000..bb00ccf
--- /dev/null
@@ -0,0 +1,28 @@
+config ARCH_SUPPORTS_FIRMWARE
+       bool
+
+config ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
+       bool
+       select ARCH_SUPPORTS_FIRMWARE
+
+menu "Firmware options"
+       depends on ARCH_SUPPORTS_FIRMWARE
+
+config TRUSTED_FOUNDATIONS
+       bool "Trusted Foundations secure monitor support"
+       depends on ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
+       help
+         Some devices (including most Tegra-based consumer devices on the
+         market) are booted with the Trusted Foundations secure monitor
+         active, requiring some core operations to be performed by the secure
+         monitor instead of the kernel.
+
+         This option allows the kernel to invoke the secure monitor whenever
+         required on devices using Trusted Foundations. See
+         arch/arm/include/asm/trusted_foundations.h or the
+         tl,trusted-foundations device tree binding documentation for details
+         on how to use it.
+
+         Say n if you don't know what this is about.
+
+endmenu
diff --git a/arch/arm/firmware/Makefile b/arch/arm/firmware/Makefile
new file mode 100644 (file)
index 0000000..a71f165
--- /dev/null
@@ -0,0 +1 @@
+obj-$(CONFIG_TRUSTED_FOUNDATIONS)      += trusted_foundations.o
diff --git a/arch/arm/firmware/trusted_foundations.c b/arch/arm/firmware/trusted_foundations.c
new file mode 100644 (file)
index 0000000..ef1e3d8
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Trusted Foundations support for ARM CPUs
+ *
+ * Copyright (c) 2013, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/of.h>
+#include <asm/firmware.h>
+#include <asm/trusted_foundations.h>
+
+#define TF_SET_CPU_BOOT_ADDR_SMC 0xfffff200
+
+static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2)
+{
+       asm volatile(
+               ".arch_extension        sec\n\t"
+               "stmfd  sp!, {r4 - r11, lr}\n\t"
+               __asmeq("%0", "r0")
+               __asmeq("%1", "r1")
+               __asmeq("%2", "r2")
+               "mov    r3, #0\n\t"
+               "mov    r4, #0\n\t"
+               "smc    #0\n\t"
+               "ldmfd  sp!, {r4 - r11, pc}"
+               :
+               : "r" (type), "r" (arg1), "r" (arg2)
+               : "memory");
+}
+
+static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
+{
+       tf_generic_smc(TF_SET_CPU_BOOT_ADDR_SMC, boot_addr, 0);
+
+       return 0;
+}
+
+static const struct firmware_ops trusted_foundations_ops = {
+       .set_cpu_boot_addr = tf_set_cpu_boot_addr,
+};
+
+void register_trusted_foundations(struct trusted_foundations_platform_data *pd)
+{
+       /*
+        * we are not using version information for now since currently
+        * supported SMCs are compatible with all TF releases
+        */
+       register_firmware_ops(&trusted_foundations_ops);
+}
+
+void of_register_trusted_foundations(void)
+{
+       struct device_node *node;
+       struct trusted_foundations_platform_data pdata;
+       int err;
+
+       node = of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations");
+       if (!node)
+               return;
+
+       err = of_property_read_u32(node, "tlm,version-major",
+                                  &pdata.version_major);
+       if (err != 0)
+               panic("Trusted Foundation: missing version-major property\n");
+       err = of_property_read_u32(node, "tlm,version-minor",
+                                  &pdata.version_minor);
+       if (err != 0)
+               panic("Trusted Foundation: missing version-minor property\n");
+       register_trusted_foundations(&pdata);
+}
index e691ec91e4d339648e4b64733e23999570940d62..b2e298a90d76fa700df85007a23d652959912f4e 100644 (file)
@@ -254,25 +254,59 @@ static inline int constant_fls(int x)
 }
 
 /*
- * On ARMv5 and above those functions can be implemented around
- * the clz instruction for much better code efficiency.
+ * On ARMv5 and above those functions can be implemented around the
+ * clz instruction for much better code efficiency.  __clz returns
+ * the number of leading zeros, zero input will return 32, and
+ * 0x80000000 will return 0.
  */
+static inline unsigned int __clz(unsigned int x)
+{
+       unsigned int ret;
+
+       asm("clz\t%0, %1" : "=r" (ret) : "r" (x));
 
+       return ret;
+}
+
+/*
+ * fls() returns zero if the input is zero, otherwise returns the bit
+ * position of the last set bit, where the LSB is 1 and MSB is 32.
+ */
 static inline int fls(int x)
 {
-       int ret;
-
        if (__builtin_constant_p(x))
               return constant_fls(x);
 
-       asm("clz\t%0, %1" : "=r" (ret) : "r" (x));
-               ret = 32 - ret;
-       return ret;
+       return 32 - __clz(x);
+}
+
+/*
+ * __fls() returns the bit position of the last bit set, where the
+ * LSB is 0 and MSB is 31.  Zero input is undefined.
+ */
+static inline unsigned long __fls(unsigned long x)
+{
+       return fls(x) - 1;
+}
+
+/*
+ * ffs() returns zero if the input was zero, otherwise returns the bit
+ * position of the first set bit, where the LSB is 1 and MSB is 32.
+ */
+static inline int ffs(int x)
+{
+       return fls(x & -x);
+}
+
+/*
+ * __ffs() returns the bit position of the first bit set, where the
+ * LSB is 0 and MSB is 31.  Zero input is undefined.
+ */
+static inline unsigned long __ffs(unsigned long x)
+{
+       return ffs(x) - 1;
 }
 
-#define __fls(x) (fls(x) - 1)
-#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
-#define __ffs(x) (ffs(x) - 1)
 #define ffz(x) __ffs( ~(x) )
 
 #endif
index ee753f1749cd795b03557273afdb3d0832d6fc8e..e9a49fe0284e41c2f6d6d9448fb73e9a2ad99ead 100644 (file)
@@ -481,4 +481,9 @@ static inline void __sync_cache_range_r(volatile void *p, size_t size)
        : : : "r0","r1","r2","r3","r4","r5","r6","r7", \
              "r9","r10","lr","memory" )
 
+int set_memory_ro(unsigned long addr, int numpages);
+int set_memory_rw(unsigned long addr, int numpages);
+int set_memory_x(unsigned long addr, int numpages);
+int set_memory_nx(unsigned long addr, int numpages);
+
 #endif
index 6dcc164308688c8efdf7f688f239169537470da4..523315115478960a2e433a66276fea007b120cda 100644 (file)
@@ -87,19 +87,33 @@ static inline __wsum
 csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
                   unsigned short proto, __wsum sum)
 {
-       __asm__(
-       "adds   %0, %1, %2              @ csum_tcpudp_nofold    \n\
-       adcs    %0, %0, %3                                      \n"
+       u32 lenprot = len | proto << 16;
+       if (__builtin_constant_p(sum) && sum == 0) {
+               __asm__(
+               "adds   %0, %1, %2      @ csum_tcpudp_nofold0   \n\t"
 #ifdef __ARMEB__
-       "adcs   %0, %0, %4                                      \n"
+               "adcs   %0, %0, %3                              \n\t"
 #else
-       "adcs   %0, %0, %4, lsl #8                              \n"
+               "adcs   %0, %0, %3, ror #8                      \n\t"
 #endif
-       "adcs   %0, %0, %5                                      \n\
-       adc     %0, %0, #0"
-       : "=&r"(sum)
-       : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto))
-       : "cc");
+               "adc    %0, %0, #0"
+               : "=&r" (sum)
+               : "r" (daddr), "r" (saddr), "r" (lenprot)
+               : "cc");
+       } else {
+               __asm__(
+               "adds   %0, %1, %2      @ csum_tcpudp_nofold    \n\t"
+               "adcs   %0, %0, %3                              \n\t"
+#ifdef __ARMEB__
+               "adcs   %0, %0, %4                              \n\t"
+#else
+               "adcs   %0, %0, %4, ror #8                      \n\t"
+#endif
+               "adc    %0, %0, #0"
+               : "=&r"(sum)
+               : "r" (sum), "r" (daddr), "r" (saddr), "r" (lenprot)
+               : "cc");
+       }
        return sum;
 }      
 /*
index 80751c15c3005b4e5b1460d9d9380112c6ba7a1e..4e8a4b27d7c7948ed1104f247e4ba5f85e0104c7 100644 (file)
 
 #include <linux/slab.h>
 
+#ifndef CONFIG_COMMON_CLK
 #ifdef CONFIG_HAVE_MACH_CLKDEV
 #include <mach/clkdev.h>
 #else
 #define __clk_get(clk) ({ 1; })
 #define __clk_put(clk) do { } while (0)
 #endif
+#endif
 
 static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
 {
index 3b2c40b5bfa22de982fce4e79afc8ced0326dce1..6795ff743b3dbc8664760b54088f765e1790c06d 100644 (file)
@@ -131,6 +131,7 @@ struct l2x0_regs {
        unsigned long prefetch_ctrl;
        unsigned long pwr_ctrl;
        unsigned long ctrl;
+       unsigned long aux2_ctrl;
 };
 
 extern struct l2x0_regs l2x0_saved_regs;
index 2fe141fcc8d63311b63a2be06a0289a31b0174a3..f98c7f32c9c8aefb256c7c7a287c6c2d69602011 100644 (file)
@@ -22,18 +22,21 @@ struct map_desc {
 };
 
 /* types 0-3 are defined in asm/io.h */
-#define MT_UNCACHED            4
-#define MT_CACHECLEAN          5
-#define MT_MINICLEAN           6
-#define MT_LOW_VECTORS         7
-#define MT_HIGH_VECTORS                8
-#define MT_MEMORY              9
-#define MT_ROM                 10
-#define MT_MEMORY_NONCACHED    11
-#define MT_MEMORY_DTCM         12
-#define MT_MEMORY_ITCM         13
-#define MT_MEMORY_SO           14
-#define MT_MEMORY_DMA_READY    15
+enum {
+       MT_UNCACHED = 4,
+       MT_CACHECLEAN,
+       MT_MINICLEAN,
+       MT_LOW_VECTORS,
+       MT_HIGH_VECTORS,
+       MT_MEMORY_RWX,
+       MT_MEMORY_RW,
+       MT_ROM,
+       MT_MEMORY_RWX_NONCACHED,
+       MT_MEMORY_RW_DTCM,
+       MT_MEMORY_RWX_ITCM,
+       MT_MEMORY_RW_SO,
+       MT_MEMORY_DMA_READY,
+};
 
 #ifdef CONFIG_MMU
 extern void iotable_init(struct map_desc *, int);
index a98a2e112fae0ef9b33ac8319398dde8418b0b09..680a83e944672d876d7d05144ecebb2f2eff321a 100644 (file)
@@ -57,12 +57,9 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
 extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                                enum pci_mmap_state mmap_state, int write_combine);
 
-/*
- * Dummy implementation; always return 0.
- */
 static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 {
-       return 0;
+       return channel ? 15 : 14;
 }
 
 #endif /* __KERNEL__ */
index 86a659a19526c75a2ba3b91ce839925cc52d26de..dfff709fda3ccdddbc0d67f3ff1a04c702c85ad6 100644 (file)
@@ -160,6 +160,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
        return (pmd_t *)pud;
 }
 
+#define pmd_large(pmd)         (pmd_val(pmd) & 2)
 #define pmd_bad(pmd)           (pmd_val(pmd) & 2)
 
 #define copy_pmd(pmdpd,pmdps)          \
index 4f9503908dca4a7dc536324514801bcbd03d32fd..03243f7eeddfc57beebb8100132dae059f96af77 100644 (file)
                                                 PMD_TYPE_TABLE)
 #define pmd_sect(pmd)          ((pmd_val(pmd) & PMD_TYPE_MASK) == \
                                                 PMD_TYPE_SECT)
+#define pmd_large(pmd)         pmd_sect(pmd)
 
 #define pud_clear(pudp)                        \
        do {                            \
index 1571d126e9ddb08b77c99955538209212755ebfd..7d59b524f2af3c48480762a9b41f36fefb04e546 100644 (file)
@@ -254,6 +254,8 @@ PTE_BIT_FUNC(mkclean,   &= ~L_PTE_DIRTY);
 PTE_BIT_FUNC(mkdirty,   |= L_PTE_DIRTY);
 PTE_BIT_FUNC(mkold,     &= ~L_PTE_YOUNG);
 PTE_BIT_FUNC(mkyoung,   |= L_PTE_YOUNG);
+PTE_BIT_FUNC(mkexec,   &= ~L_PTE_XN);
+PTE_BIT_FUNC(mknexec,   |= L_PTE_XN);
 
 static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
 
diff --git a/arch/arm/include/asm/trusted_foundations.h b/arch/arm/include/asm/trusted_foundations.h
new file mode 100644 (file)
index 0000000..3bd36e2
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2013, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+/*
+ * Support for the Trusted Foundations secure monitor.
+ *
+ * Trusted Foundation comes active on some ARM consumer devices (most
+ * Tegra-based devices sold on the market are concerned). Such devices can only
+ * perform some basic operations, like setting the CPU reset vector, through
+ * SMC calls to the secure monitor. The calls are completely specific to
+ * Trusted Foundations, and do *not* follow the SMC calling convention or the
+ * PSCI standard.
+ */
+
+#ifndef __ASM_ARM_TRUSTED_FOUNDATIONS_H
+#define __ASM_ARM_TRUSTED_FOUNDATIONS_H
+
+#include <linux/kconfig.h>
+#include <linux/printk.h>
+#include <linux/bug.h>
+#include <linux/of.h>
+
+struct trusted_foundations_platform_data {
+       unsigned int version_major;
+       unsigned int version_minor;
+};
+
+#if IS_ENABLED(CONFIG_TRUSTED_FOUNDATIONS)
+
+void register_trusted_foundations(struct trusted_foundations_platform_data *pd);
+void of_register_trusted_foundations(void);
+
+#else /* CONFIG_TRUSTED_FOUNDATIONS */
+
+static inline void register_trusted_foundations(
+                                  struct trusted_foundations_platform_data *pd)
+{
+       /*
+        * If we try to register TF, this means the system needs it to continue.
+        * Its absence if thus a fatal error.
+        */
+       panic("No support for Trusted Foundations, stopping...\n");
+}
+
+static inline void of_register_trusted_foundations(void)
+{
+       /*
+        * If we find the target should enable TF but does not support it,
+        * fail as the system won't be able to do much anyway
+        */
+       if (of_find_compatible_node(NULL, NULL, "tl,trusted-foundations"))
+               register_trusted_foundations(NULL);
+}
+#endif /* CONFIG_TRUSTED_FOUNDATIONS */
+
+#endif
index 4d52f92967a65a09e57d5e02595bcf8ff3af2351..a6d0a29861e7cef407a5514c5a2d8687726d4a30 100644 (file)
@@ -48,10 +48,14 @@ static inline unsigned long find_zero(unsigned long mask)
        return ret;
 }
 
-#ifdef CONFIG_DCACHE_WORD_ACCESS
-
 #define zero_bytemask(mask) (mask)
 
+#else  /* __ARMEB__ */
+#include <asm-generic/word-at-a-time.h>
+#endif
+
+#ifdef CONFIG_DCACHE_WORD_ACCESS
+
 /*
  * Load an unaligned word from kernel space.
  *
@@ -73,7 +77,11 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
        "       bic     %2, %2, #0x3\n"
        "       ldr     %0, [%2]\n"
        "       lsl     %1, %1, #0x3\n"
+#ifndef __ARMEB__
        "       lsr     %0, %0, %1\n"
+#else
+       "       lsl     %0, %0, %1\n"
+#endif
        "       b       2b\n"
        "       .popsection\n"
        "       .pushsection __ex_table,\"a\"\n"
@@ -86,11 +94,5 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
        return ret;
 }
 
-
 #endif /* DCACHE_WORD_ACCESS */
-
-#else  /* __ARMEB__ */
-#include <asm-generic/word-at-a-time.h>
-#endif
-
 #endif /* __ASM_ARM_WORD_AT_A_TIME_H */
index 29da84e183f4a7939ff9e9bb69c96f1b93f68538..42b823cd2d22ffd119b303610ea865880253eb4d 100644 (file)
 #define IMX35_UART_BASE_ADDR(n)        IMX35_UART##n##_BASE_ADDR
 #define IMX35_UART_BASE(n)     IMX35_UART_BASE_ADDR(n)
 
+#define IMX50_UART1_BASE_ADDR  0x53fbc000
+#define IMX50_UART2_BASE_ADDR  0x53fc0000
+#define IMX50_UART3_BASE_ADDR  0x5000c000
+#define IMX50_UART4_BASE_ADDR  0x53ff0000
+#define IMX50_UART5_BASE_ADDR  0x63f90000
+#define IMX50_UART_BASE_ADDR(n)        IMX50_UART##n##_BASE_ADDR
+#define IMX50_UART_BASE(n)     IMX50_UART_BASE_ADDR(n)
+
 #define IMX51_UART1_BASE_ADDR  0x73fbc000
 #define IMX51_UART2_BASE_ADDR  0x73fc0000
 #define IMX51_UART3_BASE_ADDR  0x7000c000
@@ -85,6 +93,8 @@
 #define UART_PADDR     IMX_DEBUG_UART_BASE(IMX31)
 #elif defined(CONFIG_DEBUG_IMX35_UART)
 #define UART_PADDR     IMX_DEBUG_UART_BASE(IMX35)
+#elif defined(CONFIG_DEBUG_IMX50_UART)
+#define UART_PADDR     IMX_DEBUG_UART_BASE(IMX50)
 #elif defined(CONFIG_DEBUG_IMX51_UART)
 #define UART_PADDR     IMX_DEBUG_UART_BASE(IMX51)
 #elif defined(CONFIG_DEBUG_IMX53_UART)
index be6a720dd1834a8f697fc9db98170c15a39f484f..f98763f0bc179f30edf4a6e1b0b1f0f58bed27c6 100644 (file)
 #define TEGRA_APB_MISC_GP_HIDREV       (TEGRA_APB_MISC_BASE + 0x804)
 
 /*
- * Must be 1MB-aligned since a 1MB mapping is used early on.
+ * Must be section-aligned since a section mapping is used early on.
  * Must not overlap with regions in mach-tegra/io.c:tegra_io_desc[].
  */
-#define UART_VIRTUAL_BASE              0xfe100000
+#define UART_VIRTUAL_BASE              0xfe800000
 
 #define checkuart(rp, rv, lhu, bit, uart) \
                /* Load address of CLK_RST register */ \
 92:            and     \rv, \rp, #0xffffff     @ offset within 1MB section
                add     \rv, \rv, #UART_VIRTUAL_BASE
                str     \rv, [\tmp, #8]         @ Store in tegra_uart_virt
-               movw    \rv, #TEGRA_APB_MISC_GP_HIDREV & 0xffff
-               movt    \rv, #TEGRA_APB_MISC_GP_HIDREV >> 16
-               ldr     \rv, [\rv, #0]          @ Load HIDREV
-               ubfx    \rv, \rv, #8, #8        @ 15:8 are SoC version
-               cmp     \rv, #0x20              @ Tegra20?
-               moveq   \rv, #0x75              @ Tegra20 divisor
-               movne   \rv, #0xdd              @ Tegra30 divisor
-               str     \rv, [\tmp, #12]        @ Save divisor to scratch
-               /* uart[UART_LCR] = UART_LCR_WLEN8 | UART_LCR_DLAB; */
-               mov     \rv, #UART_LCR_WLEN8 | UART_LCR_DLAB
-               str     \rv, [\rp, #UART_LCR << UART_SHIFT]
-               /* uart[UART_DLL] = div & 0xff; */
-               ldr     \rv, [\tmp, #12]
-               and     \rv, \rv, #0xff
-               str     \rv, [\rp, #UART_DLL << UART_SHIFT]
-               /* uart[UART_DLM] = div >> 8; */
-               ldr     \rv, [\tmp, #12]
-               lsr     \rv, \rv, #8
-               str     \rv, [\rp, #UART_DLM << UART_SHIFT]
-               /* uart[UART_LCR] = UART_LCR_WLEN8; */
-               mov     \rv, #UART_LCR_WLEN8
-               str     \rv, [\rp, #UART_LCR << UART_SHIFT]
                b       100f
 
                .align
                cmp     \rx, #0
                beq     1002f
 1001:          ldrb    \rd, [\rx, #UART_LSR << UART_SHIFT]
-               and     \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
-               teq     \rd, #UART_LSR_TEMT | UART_LSR_THRE
+               and     \rd, \rd, #UART_LSR_THRE
+               teq     \rd, #UART_LSR_THRE
                bne     1001b
 1002:
                .endm
 /*
  * Storage for the state maintained by the macros above.
  *
- * In the kernel proper, this data is located in arch/arm/mach-tegra/common.c.
+ * In the kernel proper, this data is located in arch/arm/mach-tegra/tegra.c.
  * That's because this header is included from multiple files, and we only
  * want a single copy of the data. In particular, the UART probing code above
  * assumes it's running using physical addresses. This is true when this file
@@ -247,6 +225,4 @@ tegra_uart_config:
        .word 0
        /* Debug UART virtual address */
        .word 0
-       /* Scratch space for debug macro */
-       .word 0
 #endif
index 1f031ddd0667a3e842317a90c59db3acc2284894..85e664b6a5f19be5e92d5f2fc5047dd2567ce09f 100644 (file)
@@ -35,6 +35,8 @@ extern void __ucmpdi2(void);
 extern void __udivsi3(void);
 extern void __umodsi3(void);
 extern void __do_div64(void);
+extern void __bswapsi2(void);
+extern void __bswapdi2(void);
 
 extern void __aeabi_idiv(void);
 extern void __aeabi_idivmod(void);
@@ -114,6 +116,8 @@ EXPORT_SYMBOL(__ucmpdi2);
 EXPORT_SYMBOL(__udivsi3);
 EXPORT_SYMBOL(__umodsi3);
 EXPORT_SYMBOL(__do_div64);
+EXPORT_SYMBOL(__bswapsi2);
+EXPORT_SYMBOL(__bswapdi2);
 
 #ifdef CONFIG_AEABI
 EXPORT_SYMBOL(__aeabi_idiv);
index 52b26432c9a9941e8281a4483dd7aed148a99995..2260f1855820fa2d2961025b2683c2e30982a8e0 100644 (file)
@@ -14,8 +14,6 @@
 #include <asm/thread_notify.h>
 #include <asm/v7m.h>
 
-#include <mach/entry-macro.S>
-
 #include "entry-header.S"
 
 #ifdef CONFIG_TRACE_IRQFLAGS
index 8ff0ecdc637fd3bd2b41c0d129715acad13152e2..131a6ab5f35504dfc70c6f9e1421632c25d5feae 100644 (file)
@@ -385,7 +385,6 @@ out:
        return ret;
 
 out_unmap:
-       amba_set_drvdata(dev, NULL);
        iounmap(t->etb_regs);
 
 out_release:
@@ -398,8 +397,6 @@ static int etb_remove(struct amba_device *dev)
 {
        struct tracectx *t = amba_get_drvdata(dev);
 
-       amba_set_drvdata(dev, NULL);
-
        iounmap(t->etb_regs);
        t->etb_regs = NULL;
 
@@ -588,7 +585,6 @@ out:
        return ret;
 
 out_unmap:
-       amba_set_drvdata(dev, NULL);
        iounmap(t->etm_regs);
 
 out_release:
@@ -601,8 +597,6 @@ static int etm_remove(struct amba_device *dev)
 {
        struct tracectx *t = amba_get_drvdata(dev);
 
-       amba_set_drvdata(dev, NULL);
-
        iounmap(t->etm_regs);
        t->etm_regs = NULL;
 
index 8ce1cbd08dba29369860d756b0a1a373afd607b2..1e8b030dbefd8b2b19da27d9ca8ecabfaf610bba 100644 (file)
@@ -334,7 +334,7 @@ static void __init cacheid_init(void)
                cacheid = CACHEID_VIVT;
        }
 
-       printk("CPU: %s data cache, %s instruction cache\n",
+       pr_info("CPU: %s data cache, %s instruction cache\n",
                cache_is_vivt() ? "VIVT" :
                cache_is_vipt_aliasing() ? "VIPT aliasing" :
                cache_is_vipt_nonaliasing() ? "PIPT / VIPT nonaliasing" : "unknown",
@@ -416,7 +416,7 @@ void notrace cpu_init(void)
        struct stack *stk = &stacks[cpu];
 
        if (cpu >= NR_CPUS) {
-               printk(KERN_CRIT "CPU%u: bad primary CPU number\n", cpu);
+               pr_crit("CPU%u: bad primary CPU number\n", cpu);
                BUG();
        }
 
@@ -484,7 +484,7 @@ void __init smp_setup_processor_id(void)
         */
        set_my_cpu_offset(0);
 
-       printk(KERN_INFO "Booting Linux on physical CPU 0x%x\n", mpidr);
+       pr_info("Booting Linux on physical CPU 0x%x\n", mpidr);
 }
 
 struct mpidr_hash mpidr_hash;
@@ -564,8 +564,8 @@ static void __init setup_processor(void)
         */
        list = lookup_processor_type(read_cpuid_id());
        if (!list) {
-               printk("CPU configuration botched (ID %08x), unable "
-                      "to continue.\n", read_cpuid_id());
+               pr_err("CPU configuration botched (ID %08x), unable to continue.\n",
+                      read_cpuid_id());
                while (1);
        }
 
@@ -585,9 +585,9 @@ static void __init setup_processor(void)
        cpu_cache = *list->cache;
 #endif
 
-       printk("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n",
-              cpu_name, read_cpuid_id(), read_cpuid_id() & 15,
-              proc_arch[cpu_architecture()], cr_alignment);
+       pr_info("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n",
+               cpu_name, read_cpuid_id(), read_cpuid_id() & 15,
+               proc_arch[cpu_architecture()], cr_alignment);
 
        snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c",
                 list->arch_name, ENDIANNESS);
@@ -629,8 +629,8 @@ int __init arm_add_memory(u64 start, u64 size)
        u64 aligned_start;
 
        if (meminfo.nr_banks >= NR_BANKS) {
-               printk(KERN_CRIT "NR_BANKS too low, "
-                       "ignoring memory at 0x%08llx\n", (long long)start);
+               pr_crit("NR_BANKS too low, ignoring memory at 0x%08llx\n",
+                       (long long)start);
                return -EINVAL;
        }
 
@@ -643,14 +643,14 @@ int __init arm_add_memory(u64 start, u64 size)
 
 #ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT
        if (aligned_start > ULONG_MAX) {
-               printk(KERN_CRIT "Ignoring memory at 0x%08llx outside "
-                      "32-bit physical address space\n", (long long)start);
+               pr_crit("Ignoring memory at 0x%08llx outside 32-bit physical address space\n",
+                       (long long)start);
                return -EINVAL;
        }
 
        if (aligned_start + size > ULONG_MAX) {
-               printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in "
-                       "32-bit physical address space\n", (long long)start);
+               pr_crit("Truncating memory at 0x%08llx to fit in 32-bit physical address space\n",
+                       (long long)start);
                /*
                 * To ensure bank->start + bank->size is representable in
                 * 32 bits, we use ULONG_MAX as the upper limit rather than 4GB.
@@ -660,6 +660,20 @@ int __init arm_add_memory(u64 start, u64 size)
        }
 #endif
 
+       if (aligned_start < PHYS_OFFSET) {
+               if (aligned_start + size <= PHYS_OFFSET) {
+                       pr_info("Ignoring memory below PHYS_OFFSET: 0x%08llx-0x%08llx\n",
+                               aligned_start, aligned_start + size);
+                       return -EINVAL;
+               }
+
+               pr_info("Ignoring memory below PHYS_OFFSET: 0x%08llx-0x%08llx\n",
+                       aligned_start, (u64)PHYS_OFFSET);
+
+               size -= PHYS_OFFSET - aligned_start;
+               aligned_start = PHYS_OFFSET;
+       }
+
        bank->start = aligned_start;
        bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1);
 
@@ -817,18 +831,17 @@ static void __init reserve_crashkernel(void)
        if (ret)
                return;
 
-       ret = reserve_bootmem(crash_base, crash_size, BOOTMEM_EXCLUSIVE);
+       ret = memblock_reserve(crash_base, crash_size);
        if (ret < 0) {
-               printk(KERN_WARNING "crashkernel reservation failed - "
-                      "memory is in use (0x%lx)\n", (unsigned long)crash_base);
+               pr_warn("crashkernel reservation failed - memory is in use (0x%lx)\n",
+                       (unsigned long)crash_base);
                return;
        }
 
-       printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
-              "for crashkernel (System RAM: %ldMB)\n",
-              (unsigned long)(crash_size >> 20),
-              (unsigned long)(crash_base >> 20),
-              (unsigned long)(total_mem >> 20));
+       pr_info("Reserving %ldMB of memory at %ldMB for crashkernel (System RAM: %ldMB)\n",
+               (unsigned long)(crash_size >> 20),
+               (unsigned long)(crash_base >> 20),
+               (unsigned long)(total_mem >> 20));
 
        crashk_res.start = crash_base;
        crashk_res.end = crash_base + crash_size - 1;
index dc894ab3622b1effac1b885bd919bf629f66dc5d..b7b4c86e338b0264919152caee8bec654e2b7757 100644 (file)
@@ -105,8 +105,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
        secondary_data.pgdir = get_arch_pgd(idmap_pgd);
        secondary_data.swapper_pg_dir = get_arch_pgd(swapper_pg_dir);
 #endif
-       __cpuc_flush_dcache_area(&secondary_data, sizeof(secondary_data));
-       outer_clean_range(__pa(&secondary_data), __pa(&secondary_data + 1));
+       sync_cache_w(&secondary_data);
 
        /*
         * Now bring the CPU into our world.
@@ -294,6 +293,9 @@ void __ref cpu_die(void)
        if (smp_ops.cpu_die)
                smp_ops.cpu_die(cpu);
 
+       pr_warn("CPU%u: smp_ops.cpu_die() returned, trying to resuscitate\n",
+               cpu);
+
        /*
         * Do not return to the idle loop - jump back to the secondary
         * cpu initialisation.  There's some initialisation which needs
index f50f19e5c138839bede270baf3531a41aa5af7c4..7a3be1d4d0b13b7ca984721403aafda47ecb574c 100644 (file)
@@ -52,7 +52,7 @@ static struct map_desc dtcm_iomap[] __initdata = {
                .virtual        = DTCM_OFFSET,
                .pfn            = __phys_to_pfn(DTCM_OFFSET),
                .length         = 0,
-               .type           = MT_MEMORY_DTCM
+               .type           = MT_MEMORY_RW_DTCM
        }
 };
 
@@ -61,7 +61,7 @@ static struct map_desc itcm_iomap[] __initdata = {
                .virtual        = ITCM_OFFSET,
                .pfn            = __phys_to_pfn(ITCM_OFFSET),
                .length         = 0,
-               .type           = MT_MEMORY_ITCM
+               .type           = MT_MEMORY_RWX_ITCM,
        }
 };
 
index 85a87370f144a4b383c390c39c7fa18a4be87dcb..0bc94b1fd1ae9e73bdc95987797012396d9ef6bb 100644 (file)
@@ -68,16 +68,16 @@ struct cpu_efficiency {
  * Processors that are not defined in the table,
  * use the default SCHED_POWER_SCALE value for cpu_scale.
  */
-struct cpu_efficiency table_efficiency[] = {
+static const struct cpu_efficiency table_efficiency[] = {
        {"arm,cortex-a15", 3891},
        {"arm,cortex-a7",  2048},
        {NULL, },
 };
 
-unsigned long *__cpu_capacity;
+static unsigned long *__cpu_capacity;
 #define cpu_capacity(cpu)      __cpu_capacity[cpu]
 
-unsigned long middle_capacity = 1;
+static unsigned long middle_capacity = 1;
 
 /*
  * Iterate all CPUs' descriptor in DT and compute the efficiency
@@ -89,7 +89,7 @@ unsigned long middle_capacity = 1;
  */
 static void __init parse_dt_topology(void)
 {
-       struct cpu_efficiency *cpu_eff;
+       const struct cpu_efficiency *cpu_eff;
        struct device_node *cn = NULL;
        unsigned long min_capacity = (unsigned long)(-1);
        unsigned long max_capacity = 0;
@@ -158,7 +158,7 @@ static void __init parse_dt_topology(void)
  * boot. The update of all CPUs is in O(n^2) for heteregeneous system but the
  * function returns directly for SMP system.
  */
-void update_cpu_power(unsigned int cpu)
+static void update_cpu_power(unsigned int cpu)
 {
        if (!cpu_capacity(cpu))
                return;
@@ -185,7 +185,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
        return &cpu_topology[cpu].core_sibling;
 }
 
-void update_siblings_masks(unsigned int cpuid)
+static void update_siblings_masks(unsigned int cpuid)
 {
        struct cputopo_arm *cpu_topo, *cpuid_topo = &cpu_topology[cpuid];
        int cpu;
index 4636d56af2db63f64703b7417a551d78dffecbe0..172ee18ff1247b3159c355d899bf09bfc06579c8 100644 (file)
@@ -62,7 +62,7 @@ static void dump_mem(const char *, const char *, unsigned long, unsigned long);
 void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame)
 {
 #ifdef CONFIG_KALLSYMS
-       printk("[<%08lx>] (%pS) from [<%08lx>] (%pS)\n", where, (void *)where, from, (void *)from);
+       printk("[<%08lx>] (%ps) from [<%08lx>] (%pS)\n", where, (void *)where, from, (void *)from);
 #else
        printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from);
 #endif
index 47d7338561de3c93c19a1345226e7078f779b6c6..0573faab96ad2cb815a4fcf26f678864dfcd80c5 100644 (file)
@@ -13,7 +13,7 @@ lib-y         := backtrace.o changebit.o csumipv6.o csumpartial.o   \
                   ashldi3.o ashrdi3.o lshrdi3.o muldi3.o             \
                   ucmpdi2.o lib1funcs.o div64.o                      \
                   io-readsb.o io-writesb.o io-readsl.o io-writesl.o  \
-                  call_with_stack.o
+                  call_with_stack.o bswapsdi2.o
 
 mmu-y  := clear_user.o copy_page.o getuser.o putuser.o
 
index cd07b5814c2304f0908342b04291af09388790b7..4102be617fce0644434e3aa7f7fec65c09fcb5e7 100644 (file)
@@ -80,14 +80,14 @@ for_each_frame:     tst     frame, mask             @ Check for address exceptions
 
                ldr     r1, [sv_pc, #-4]        @ if stmfd sp!, {args} exists,
                ldr     r3, .Ldsi+4
-               teq     r3, r1, lsr #10
+               teq     r3, r1, lsr #11
                ldreq   r0, [frame, #-8]        @ get sp
                subeq   r0, r0, #4              @ point at the last arg
                bleq    .Ldumpstm               @ dump saved registers
 
 1004:          ldr     r1, [sv_pc, #0]         @ if stmfd sp!, {..., fp, ip, lr, pc}
                ldr     r3, .Ldsi               @ instruction exists,
-               teq     r3, r1, lsr #10
+               teq     r3, r1, lsr #11
                subeq   r0, frame, #16
                bleq    .Ldumpstm               @ dump saved registers
 
@@ -128,11 +128,11 @@ ENDPROC(c_backtrace)
                beq     2f
                add     r7, r7, #1
                teq     r7, #6
-               moveq   r7, #1
-               moveq   r1, #'\n'
-               movne   r1, #' '
-               ldr     r3, [stack], #-4
-               mov     r2, reg
+               moveq   r7, #0
+               adr     r3, .Lcr
+               addne   r3, r3, #1              @ skip newline
+               ldr     r2, [stack], #-4
+               mov     r1, reg
                adr     r0, .Lfp
                bl      printk
 2:             subs    reg, reg, #1
@@ -142,11 +142,11 @@ ENDPROC(c_backtrace)
                blne    printk
                ldmfd   sp!, {instr, reg, stack, r7, pc}
 
-.Lfp:          .asciz  "%cr%d:%08x"
+.Lfp:          .asciz  " r%d:%08x%s"
 .Lcr:          .asciz  "\n"
 .Lbad:         .asciz  "Backtrace aborted due to bad frame pointer <%p>\n"
                .align
-.Ldsi:         .word   0xe92dd800 >> 10        @ stmfd sp!, {... fp, ip, lr, pc}
-               .word   0xe92d0000 >> 10        @ stmfd sp!, {}
+.Ldsi:         .word   0xe92dd800 >> 11        @ stmfd sp!, {... fp, ip, lr, pc}
+               .word   0xe92d0000 >> 11        @ stmfd sp!, {}
 
 #endif
diff --git a/arch/arm/lib/bswapsdi2.S b/arch/arm/lib/bswapsdi2.S
new file mode 100644 (file)
index 0000000..9fcdd15
--- /dev/null
@@ -0,0 +1,36 @@
+#include <linux/linkage.h>
+
+#if __LINUX_ARM_ARCH__ >= 6
+ENTRY(__bswapsi2)
+       rev r0, r0
+       bx lr
+ENDPROC(__bswapsi2)
+
+ENTRY(__bswapdi2)
+       rev r3, r0
+       rev r0, r1
+       mov r1, r3
+       bx lr
+ENDPROC(__bswapdi2)
+#else
+ENTRY(__bswapsi2)
+       eor r3, r0, r0, ror #16
+       mov r3, r3, lsr #8
+       bic r3, r3, #0xff00
+       eor r0, r3, r0, ror #8
+       mov pc, lr
+ENDPROC(__bswapsi2)
+
+ENTRY(__bswapdi2)
+       mov ip, r1
+       eor r3, ip, ip, ror #16
+       eor r1, r0, r0, ror #16
+       mov r1, r1, lsr #8
+       mov r3, r3, lsr #8
+       bic r3, r3, #0xff00
+       bic r1, r1, #0xff00
+       eor r1, r1, r0, ror #8
+       eor r0, r3, ip, ror #8
+       mov pc, lr
+ENDPROC(__bswapdi2)
+#endif
index 699b71e7f7ecffb0e978a8387af33699c19233ca..4f0e800e7e711707caaf9c3331f9f90c4eae8cab 100644 (file)
@@ -1,15 +1,33 @@
 if ARCH_AT91
 
+config HAVE_AT91_UTMI
+       bool
+
+config HAVE_AT91_USB_CLK
+       bool
+
 config HAVE_AT91_DBGU0
        bool
 
 config HAVE_AT91_DBGU1
        bool
 
+config AT91_USE_OLD_CLK
+       bool
+
 config AT91_PMC_UNIT
        bool
        default !ARCH_AT91X40
 
+config COMMON_CLK_AT91
+       bool
+       default AT91_PMC_UNIT && USE_OF && !AT91_USE_OLD_CLK
+       select COMMON_CLK
+
+config OLD_CLK_AT91
+       bool
+       default AT91_PMC_UNIT && AT91_USE_OLD_CLK
+
 config AT91_SAM9_ALT_RESET
        bool
        default !ARCH_AT91X40
@@ -21,6 +39,9 @@ config AT91_SAM9G45_RESET
 config AT91_SAM9_TIME
        bool
 
+config HAVE_AT91_SMD
+       bool
+
 config SOC_AT91SAM9
        bool
        select AT91_SAM9_TIME
@@ -61,13 +82,15 @@ comment "Atmel AT91 Processor"
 if SOC_SAM_V7
 config SOC_SAMA5D3
        bool "SAMA5D3 family"
-       depends on SOC_SAM_V7
        select SOC_SAMA5
        select HAVE_FB_ATMEL
        select HAVE_AT91_DBGU1
+       select HAVE_AT91_UTMI
+       select HAVE_AT91_SMD
+       select HAVE_AT91_USB_CLK
        help
          Select this if you are using one of Atmel's SAMA5D3 family SoC.
-         This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35.
+         This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35, SAMA5D36.
 endif
 
 if SOC_SAM_V4_V5
@@ -78,11 +101,15 @@ config SOC_AT91RM9200
        select HAVE_AT91_DBGU0
        select MULTI_IRQ_HANDLER
        select SPARSE_IRQ
+       select AT91_USE_OLD_CLK
+       select HAVE_AT91_USB_CLK
 
 config SOC_AT91SAM9260
        bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20"
        select HAVE_AT91_DBGU0
        select SOC_AT91SAM9
+       select AT91_USE_OLD_CLK
+       select HAVE_AT91_USB_CLK
        help
          Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE
          or AT91SAM9G20 SoC.
@@ -92,6 +119,8 @@ config SOC_AT91SAM9261
        select HAVE_AT91_DBGU0
        select HAVE_FB_ATMEL
        select SOC_AT91SAM9
+       select AT91_USE_OLD_CLK
+       select HAVE_AT91_USB_CLK
        help
          Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC.
 
@@ -100,18 +129,25 @@ config SOC_AT91SAM9263
        select HAVE_AT91_DBGU1
        select HAVE_FB_ATMEL
        select SOC_AT91SAM9
+       select AT91_USE_OLD_CLK
+       select HAVE_AT91_USB_CLK
 
 config SOC_AT91SAM9RL
        bool "AT91SAM9RL"
        select HAVE_AT91_DBGU0
        select HAVE_FB_ATMEL
        select SOC_AT91SAM9
+       select AT91_USE_OLD_CLK
+       select HAVE_AT91_UTMI
 
 config SOC_AT91SAM9G45
        bool "AT91SAM9G45 or AT91SAM9M10 families"
        select HAVE_AT91_DBGU1
        select HAVE_FB_ATMEL
        select SOC_AT91SAM9
+       select AT91_USE_OLD_CLK
+       select HAVE_AT91_UTMI
+       select HAVE_AT91_USB_CLK
        help
          Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
          This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
@@ -121,6 +157,10 @@ config SOC_AT91SAM9X5
        select HAVE_AT91_DBGU0
        select HAVE_FB_ATMEL
        select SOC_AT91SAM9
+       select AT91_USE_OLD_CLK
+       select HAVE_AT91_UTMI
+       select HAVE_AT91_SMD
+       select HAVE_AT91_USB_CLK
        help
          Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
          This means that your SAM9 name finishes with a '5' (except if it is
@@ -133,6 +173,8 @@ config SOC_AT91SAM9N12
        select HAVE_AT91_DBGU0
        select HAVE_FB_ATMEL
        select SOC_AT91SAM9
+       select AT91_USE_OLD_CLK
+       select HAVE_AT91_USB_CLK
        help
          Select this if you are using Atmel's AT91SAM9N12 SoC.
 
@@ -172,12 +214,6 @@ config MACH_SAMA5_DT
 
 comment "AT91 Feature Selections"
 
-config AT91_PROGRAMMABLE_CLOCKS
-       bool "Programmable Clocks"
-       help
-         Select this if you need to program one or more of the PCK0..PCK3
-         programmable clock outputs.
-
 config AT91_SLOW_CLOCK
        bool "Suspend-to-RAM disables main oscillator"
        depends on SUSPEND
index 0363dba7d3f6fcadd4452d6f97bcc790936dff7a..1f73e9b527dac56f57ca37ec7af80f47b05c37fe 100644 (file)
@@ -12,26 +12,32 @@ config ARCH_AT91_NONE
 config ARCH_AT91RM9200
        bool "AT91RM9200"
        select SOC_AT91RM9200
+       select AT91_USE_OLD_CLK
 
 config ARCH_AT91SAM9260
        bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20"
        select SOC_AT91SAM9260
+       select AT91_USE_OLD_CLK
 
 config ARCH_AT91SAM9261
        bool "AT91SAM9261 or AT91SAM9G10"
        select SOC_AT91SAM9261
+       select AT91_USE_OLD_CLK
 
 config ARCH_AT91SAM9263
        bool "AT91SAM9263"
        select SOC_AT91SAM9263
+       select AT91_USE_OLD_CLK
 
 config ARCH_AT91SAM9RL
        bool "AT91SAM9RL"
        select SOC_AT91SAM9RL
+       select AT91_USE_OLD_CLK
 
 config ARCH_AT91SAM9G45
        bool "AT91SAM9G45"
        select SOC_AT91SAM9G45
+       select AT91_USE_OLD_CLK
 
 config ARCH_AT91X40
        bool "AT91x40"
@@ -176,12 +182,6 @@ config MACH_AFEB9260
          <svn://194.85.238.22/home/users/george/svn/arm9eb>
          <http://groups.google.com/group/arm9fpga-evolution-board>
 
-config MACH_QIL_A9260
-       bool "CALAO QIL-A9260 board"
-       help
-         Select this if you are using a Calao Systems QIL-A9260 Board.
-         <http://www.calao-systems.com>
-
 config MACH_CPU9260
        bool "Eukrea CPU9260 board"
        help
index 90aab2d5a07f3aed6acc2ed8788105b877756fe6..78e9cec282f451c6e17c03845107087bb7ae0892 100644 (file)
@@ -7,7 +7,7 @@ obj-m           :=
 obj-n          :=
 obj-           :=
 
-obj-$(CONFIG_AT91_PMC_UNIT)    += clock.o
+obj-$(CONFIG_OLD_CLK_AT91)     += clock.o
 obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o
 obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o
 obj-$(CONFIG_AT91_SAM9_TIME)   += at91sam926x_time.o
@@ -52,7 +52,6 @@ obj-$(CONFIG_MACH_RSI_EWS)    += board-rsi-ews.o
 obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
 obj-$(CONFIG_MACH_CAM60)       += board-cam60.o
 obj-$(CONFIG_MACH_SAM9_L9260)  += board-sam9-l9260.o
-obj-$(CONFIG_MACH_QIL_A9260)   += board-qil-a9260.o
 obj-$(CONFIG_MACH_AFEB9260)    += board-afeb-9260v1.o
 obj-$(CONFIG_MACH_CPU9260)     += board-cpu9krea.o
 obj-$(CONFIG_MACH_FLEXIBITY)   += board-flexibity.o
index 25805f2f6010f3d7b98035f9c8e3b1e09524a4e3..e47f5fd232f5f91e9a42b83beb8a21faddc6ac65 100644 (file)
 
 #include <linux/module.h>
 #include <linux/reboot.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <asm/irq.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
 #include <mach/at91rm9200.h>
-#include <mach/at91_pmc.h>
 #include <mach/at91_st.h>
 #include <mach/cpu.h>
 
index d6a1fa85371d3ee732f4048298532dab817478fc..6c821e5621590b5e920d330a2d895b196b7530b9 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <asm/proc-fns.h>
 #include <asm/irq.h>
@@ -20,7 +21,6 @@
 #include <mach/cpu.h>
 #include <mach/at91_dbgu.h>
 #include <mach/at91sam9260.h>
-#include <mach/at91_pmc.h>
 
 #include "at91_aic.h"
 #include "at91_rstc.h"
index 23ba1d8a1531ca5f123f94591290450a0a403be6..6276b4c1acfed2943354809b8b5f6ddd37bba9f9 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <asm/proc-fns.h>
 #include <asm/irq.h>
@@ -19,7 +20,6 @@
 #include <asm/system_misc.h>
 #include <mach/cpu.h>
 #include <mach/at91sam9261.h>
-#include <mach/at91_pmc.h>
 
 #include "at91_aic.h"
 #include "at91_rstc.h"
index 7eccb0fc57bc080c3eaee8c8f830a2a7fb127cad..37b90f4b990c3ce4e5360c526ca979810277121c 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <asm/proc-fns.h>
 #include <asm/irq.h>
@@ -18,7 +19,6 @@
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
 #include <mach/at91sam9263.h>
-#include <mach/at91_pmc.h>
 
 #include "at91_aic.h"
 #include "at91_rstc.h"
index bb392320a0dd39d978bd5f1d3e861d2fce14b14c..0f04ffe9c5a87c2afb4f90b02d75b86b70fd722b 100644 (file)
@@ -39,6 +39,7 @@
 static u32 pit_cycle;          /* write-once */
 static u32 pit_cnt;            /* access only w/system irq blocked */
 static void __iomem *pit_base_addr __read_mostly;
+static struct clk *mck;
 
 static inline unsigned int pit_read(unsigned int reg_offset)
 {
@@ -195,10 +196,14 @@ static int __init of_at91sam926x_pit_init(void)
        if (!pit_base_addr)
                goto node_err;
 
+       mck = of_clk_get(np, 0);
+
        /* Get the interrupts property */
        ret = irq_of_parse_and_map(np, 0);
        if (!ret) {
                pr_crit("AT91: PIT: Unable to get IRQ from DT\n");
+               if (!IS_ERR(mck))
+                       clk_put(mck);
                goto ioremap_err;
        }
        at91sam926x_pit_irq.irq = ret;
@@ -230,6 +235,8 @@ void __init at91sam926x_pit_init(void)
        unsigned        bits;
        int             ret;
 
+       mck = ERR_PTR(-ENOENT);
+
        /* For device tree enabled device: initialize here */
        of_at91sam926x_pit_init();
 
@@ -237,7 +244,12 @@ void __init at91sam926x_pit_init(void)
         * Use our actual MCK to figure out how many MCK/16 ticks per
         * 1/HZ period (instead of a compile-time constant LATCH).
         */
-       pit_rate = clk_get_rate(clk_get(NULL, "mck")) / 16;
+       if (IS_ERR(mck))
+               mck = clk_get(NULL, "mck");
+
+       if (IS_ERR(mck))
+               panic("AT91: PIT: Unable to get mck clk\n");
+       pit_rate = clk_get_rate(mck) / 16;
        pit_cycle = (pit_rate + HZ/2) / HZ;
        WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0);
 
index 9405aa08b10498430b097594865c95976297c6ba..2f455ce35268513d5abaafc954a54be76ef48a26 100644 (file)
 
 #include <linux/module.h>
 #include <linux/dma-mapping.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <asm/irq.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
 #include <mach/at91sam9g45.h>
-#include <mach/at91_pmc.h>
 #include <mach/cpu.h>
 
 #include "at91_aic.h"
index 388ec3aec4b95edc8e63f8907a09fd66b2889a15..4ef088c62eabdf6661a801f495e795912f250cd5 100644 (file)
@@ -8,12 +8,12 @@
 
 #include <linux/module.h>
 #include <linux/dma-mapping.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <asm/irq.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <mach/at91sam9n12.h>
-#include <mach/at91_pmc.h>
 #include <mach/cpu.h>
 
 #include "board.h"
index 0750ffb7e6b16d7a52dd636475226b9b9035b301..3651517abedfb1214386cabd93d7ab82844d16aa 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <asm/proc-fns.h>
 #include <asm/irq.h>
@@ -19,7 +20,6 @@
 #include <mach/cpu.h>
 #include <mach/at91_dbgu.h>
 #include <mach/at91sam9rl.h>
-#include <mach/at91_pmc.h>
 
 #include "at91_aic.h"
 #include "at91_rstc.h"
index e8a2e075a1b888262077e46457774679d51776e9..3e8ec26e39dcc7404120fab8cbbfb0e168d9fa44 100644 (file)
@@ -8,12 +8,12 @@
 
 #include <linux/module.h>
 #include <linux/dma-mapping.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <asm/irq.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <mach/at91sam9x5.h>
-#include <mach/at91_pmc.h>
 #include <mach/cpu.h>
 
 #include "board.h"
index bf00d15d954d3d3f1b6ce1d55ec5840890518fa4..075ec0576adaf8b3d5b234a1aad729cb9aaeced7 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/phy.h>
+#include <linux/clk-provider.h>
 
 #include <asm/setup.h>
 #include <asm/irq.h>
 #include "at91_aic.h"
 #include "generic.h"
 
+static void __init sama5_dt_timer_init(void)
+{
+#if defined(CONFIG_COMMON_CLK)
+       of_clk_init(NULL);
+#endif
+       at91sam926x_pit_init();
+}
 
 static const struct of_device_id irq_of_match[] __initconst = {
 
@@ -72,7 +80,7 @@ static const char *sama5_dt_board_compat[] __initdata = {
 
 DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)")
        /* Maintainer: Atmel */
-       .init_time      = at91sam926x_pit_init,
+       .init_time      = sama5_dt_timer_init,
        .map_io         = at91_map_io,
        .handle_irq     = at91_aic5_handle_irq,
        .init_early     = at91_dt_initialize,
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
deleted file mode 100644 (file)
index aa3bc9b..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * linux/arch/arm/mach-at91/board-qil-a9260.c
- *
- *  Copyright (C) 2005 SAN People
- *  Copyright (C) 2006 Atmel
- *  Copyright (C) 2007 Calao-systems
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <linux/types.h>
-#include <linux/gpio.h>
-#include <linux/init.h>
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/spi/spi.h>
-#include <linux/gpio_keys.h>
-#include <linux/input.h>
-#include <linux/clk.h>
-
-#include <asm/setup.h>
-#include <asm/mach-types.h>
-#include <asm/irq.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-#include <mach/hardware.h>
-#include <mach/at91sam9_smc.h>
-
-#include "at91_aic.h"
-#include "at91_shdwc.h"
-#include "board.h"
-#include "sam9_smc.h"
-#include "generic.h"
-
-
-static void __init ek_init_early(void)
-{
-       /* Initialize processor: 12.000 MHz crystal */
-       at91_initialize(12000000);
-}
-
-/*
- * USB Host port
- */
-static struct at91_usbh_data __initdata ek_usbh_data = {
-       .ports          = 2,
-       .vbus_pin       = {-EINVAL, -EINVAL},
-       .overcurrent_pin= {-EINVAL, -EINVAL},
-};
-
-/*
- * USB Device port
- */
-static struct at91_udc_data __initdata ek_udc_data = {
-       .vbus_pin       = AT91_PIN_PC5,
-       .pullup_pin     = -EINVAL,              /* pull-up driven by UDC */
-};
-
-/*
- * SPI devices.
- */
-static struct spi_board_info ek_spi_devices[] = {
-#if defined(CONFIG_RTC_DRV_M41T94)
-       {       /* M41T94 RTC */
-               .modalias       = "m41t94",
-               .chip_select    = 0,
-               .max_speed_hz   = 1 * 1000 * 1000,
-               .bus_num        = 0,
-       }
-#endif
-};
-
-/*
- * MACB Ethernet device
- */
-static struct macb_platform_data __initdata ek_macb_data = {
-       .phy_irq_pin    = AT91_PIN_PA31,
-       .is_rmii        = 1,
-};
-
-/*
- * NAND flash
- */
-static struct mtd_partition __initdata ek_nand_partition[] = {
-       {
-               .name   = "Uboot & Kernel",
-               .offset = 0,
-               .size   = SZ_16M,
-       },
-       {
-               .name   = "Root FS",
-               .offset = MTDPART_OFS_NXTBLK,
-               .size   = 120 * SZ_1M,
-       },
-       {
-               .name   = "FS",
-               .offset = MTDPART_OFS_NXTBLK,
-               .size   = 120 * SZ_1M,
-       },
-};
-
-static struct atmel_nand_data __initdata ek_nand_data = {
-       .ale            = 21,
-       .cle            = 22,
-       .det_pin        = -EINVAL,
-       .rdy_pin        = AT91_PIN_PC13,
-       .enable_pin     = AT91_PIN_PC14,
-       .ecc_mode       = NAND_ECC_SOFT,
-       .on_flash_bbt   = 1,
-       .parts          = ek_nand_partition,
-       .num_parts      = ARRAY_SIZE(ek_nand_partition),
-};
-
-static struct sam9_smc_config __initdata ek_nand_smc_config = {
-       .ncs_read_setup         = 0,
-       .nrd_setup              = 1,
-       .ncs_write_setup        = 0,
-       .nwe_setup              = 1,
-
-       .ncs_read_pulse         = 3,
-       .nrd_pulse              = 3,
-       .ncs_write_pulse        = 3,
-       .nwe_pulse              = 3,
-
-       .read_cycle             = 5,
-       .write_cycle            = 5,
-
-       .mode                   = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
-       .tdf_cycles             = 2,
-};
-
-static void __init ek_add_device_nand(void)
-{
-       /* configure chip-select 3 (NAND) */
-       sam9_smc_configure(0, 3, &ek_nand_smc_config);
-
-       at91_add_device_nand(&ek_nand_data);
-}
-
-/*
- * MCI (SD/MMC)
- */
-static struct mci_platform_data __initdata ek_mci0_data = {
-       .slot[0] = {
-               .bus_width      = 4,
-               .detect_pin     = -EINVAL,
-               .wp_pin         = -EINVAL,
-       },
-};
-
-/*
- * GPIO Buttons
- */
-#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
-static struct gpio_keys_button ek_buttons[] = {
-       {       /* USER PUSH BUTTON */
-               .code           = KEY_ENTER,
-               .gpio           = AT91_PIN_PB10,
-               .active_low     = 1,
-               .desc           = "user_pb",
-               .wakeup         = 1,
-       }
-};
-
-static struct gpio_keys_platform_data ek_button_data = {
-       .buttons        = ek_buttons,
-       .nbuttons       = ARRAY_SIZE(ek_buttons),
-};
-
-static struct platform_device ek_button_device = {
-       .name           = "gpio-keys",
-       .id             = -1,
-       .num_resources  = 0,
-       .dev            = {
-               .platform_data  = &ek_button_data,
-       }
-};
-
-static void __init ek_add_device_buttons(void)
-{
-       at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
-       at91_set_deglitch(AT91_PIN_PB10, 1);
-
-       platform_device_register(&ek_button_device);
-}
-#else
-static void __init ek_add_device_buttons(void) {}
-#endif
-
-/*
- * LEDs
- */
-static struct gpio_led ek_leds[] = {
-       {       /* user_led (green) */
-               .name                   = "user_led",
-               .gpio                   = AT91_PIN_PB21,
-               .active_low             = 0,
-               .default_trigger        = "heartbeat",
-       }
-};
-
-static void __init ek_board_init(void)
-{
-       /* Serial */
-       /* DBGU on ttyS0. (Rx & Tx only) */
-       at91_register_uart(0, 0, 0);
-
-       /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
-       at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
-                          | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
-                          | ATMEL_UART_RI);
-
-       /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
-       at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
-
-       /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
-       at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
-       at91_add_device_serial();
-       /* USB Host */
-       at91_add_device_usbh(&ek_usbh_data);
-       /* USB Device */
-       at91_add_device_udc(&ek_udc_data);
-       /* SPI */
-       at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
-       /* NAND */
-       ek_add_device_nand();
-       /* I2C */
-       at91_add_device_i2c(NULL, 0);
-       /* Ethernet */
-       at91_add_device_eth(&ek_macb_data);
-       /* MMC */
-       at91_add_device_mci(0, &ek_mci0_data);
-       /* Push Buttons */
-       ek_add_device_buttons();
-       /* LEDs */
-       at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
-       /* shutdown controller, wakeup button (5 msec low) */
-       at91_shdwc_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
-                               | AT91_SHDW_RTTWKEN);
-}
-
-MACHINE_START(QIL_A9260, "CALAO QIL_A9260")
-       /* Maintainer: calao-systems */
-       .init_time      = at91sam926x_pit_init,
-       .map_io         = at91_map_io,
-       .handle_irq     = at91_aic_handle_irq,
-       .init_early     = ek_init_early,
-       .init_irq       = at91_init_irq_default,
-       .init_machine   = ek_board_init,
-MACHINE_END
index 6b2630a92f71723644ff7c7242cf6579aa7f4802..034529d801b278e3cc0ed280d897df567f289c1d 100644 (file)
@@ -24,9 +24,9 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/of_address.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <mach/hardware.h>
-#include <mach/at91_pmc.h>
 #include <mach/cpu.h>
 
 #include <asm/proc-fns.h>
@@ -330,8 +330,6 @@ EXPORT_SYMBOL(clk_get_rate);
 
 /*------------------------------------------------------------------------*/
 
-#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
-
 /*
  * For now, only the programmable clocks support reparenting (MCK could
  * do this too, with care) or rate changing (the PLLs could do this too,
@@ -459,8 +457,6 @@ static void __init init_programmable_clock(struct clk *clk)
        clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
 }
 
-#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
-
 /*------------------------------------------------------------------------*/
 
 #ifdef CONFIG_DEBUG_FS
@@ -577,12 +573,10 @@ int __init clk_register(struct clk *clk)
                clk->parent = &mck;
                clk->mode = pmc_sys_mode;
        }
-#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
        else if (clk_is_programmable(clk)) {
                clk->mode = pmc_sys_mode;
                init_programmable_clock(clk);
        }
-#endif
 
        at91_clk_add(clk);
 
@@ -884,6 +878,11 @@ static int __init at91_pmc_init(unsigned long main_clock)
 #if defined(CONFIG_OF)
 static struct of_device_id pmc_ids[] = {
        { .compatible = "atmel,at91rm9200-pmc" },
+       { .compatible = "atmel,at91sam9260-pmc" },
+       { .compatible = "atmel,at91sam9g45-pmc" },
+       { .compatible = "atmel,at91sam9n12-pmc" },
+       { .compatible = "atmel,at91sam9x5-pmc" },
+       { .compatible = "atmel,sama5d3-pmc" },
        { /*sentinel*/ }
 };
 
index 26dee3ce9397a0cf41705d0fbafe6ee87b0a9fbc..631fa3b8c16d77be9832f7aa89345e9e7259e94d 100644 (file)
@@ -46,11 +46,12 @@ extern void at91sam926x_pit_init(void);
 extern void at91x40_timer_init(void);
 
  /* Clocks */
-#ifdef CONFIG_AT91_PMC_UNIT
+#ifdef CONFIG_OLD_CLK_AT91
 extern int __init at91_clock_init(unsigned long main_clock);
 extern int __init at91_dt_clock_init(void);
 #else
 static int inline at91_clock_init(unsigned long main_clock) { return 0; }
+static int inline at91_dt_clock_init(void) { return 0; }
 #endif
 struct device;
 
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
deleted file mode 100644 (file)
index c604cc6..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * arch/arm/mach-at91/include/mach/at91_pmc.h
- *
- * Copyright (C) 2005 Ivan Kokshaysky
- * Copyright (C) SAN People
- *
- * Power Management Controller (PMC) - System peripherals registers.
- * Based on AT91RM9200 datasheet revision E.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef AT91_PMC_H
-#define AT91_PMC_H
-
-#ifndef __ASSEMBLY__
-extern void __iomem *at91_pmc_base;
-
-#define at91_pmc_read(field) \
-       __raw_readl(at91_pmc_base + field)
-
-#define at91_pmc_write(field, value) \
-       __raw_writel(value, at91_pmc_base + field)
-#else
-.extern at91_pmc_base
-#endif
-
-#define        AT91_PMC_SCER           0x00                    /* System Clock Enable Register */
-#define        AT91_PMC_SCDR           0x04                    /* System Clock Disable Register */
-
-#define        AT91_PMC_SCSR           0x08                    /* System Clock Status Register */
-#define                AT91_PMC_PCK            (1 <<  0)               /* Processor Clock */
-#define                AT91RM9200_PMC_UDP      (1 <<  1)               /* USB Devcice Port Clock [AT91RM9200 only] */
-#define                AT91RM9200_PMC_MCKUDP   (1 <<  2)               /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */
-#define                AT91RM9200_PMC_UHP      (1 <<  4)               /* USB Host Port Clock [AT91RM9200 only] */
-#define                AT91SAM926x_PMC_UHP     (1 <<  6)               /* USB Host Port Clock [AT91SAM926x only] */
-#define                AT91SAM926x_PMC_UDP     (1 <<  7)               /* USB Devcice Port Clock [AT91SAM926x only] */
-#define                AT91_PMC_PCK0           (1 <<  8)               /* Programmable Clock 0 */
-#define                AT91_PMC_PCK1           (1 <<  9)               /* Programmable Clock 1 */
-#define                AT91_PMC_PCK2           (1 << 10)               /* Programmable Clock 2 */
-#define                AT91_PMC_PCK3           (1 << 11)               /* Programmable Clock 3 */
-#define                AT91_PMC_PCK4           (1 << 12)               /* Programmable Clock 4 [AT572D940HF only] */
-#define                AT91_PMC_HCK0           (1 << 16)               /* AHB Clock (USB host) [AT91SAM9261 only] */
-#define                AT91_PMC_HCK1           (1 << 17)               /* AHB Clock (LCD) [AT91SAM9261 only] */
-
-#define        AT91_PMC_PCER           0x10                    /* Peripheral Clock Enable Register */
-#define        AT91_PMC_PCDR           0x14                    /* Peripheral Clock Disable Register */
-#define        AT91_PMC_PCSR           0x18                    /* Peripheral Clock Status Register */
-
-#define        AT91_CKGR_UCKR          0x1C                    /* UTMI Clock Register [some SAM9] */
-#define                AT91_PMC_UPLLEN         (1   << 16)             /* UTMI PLL Enable */
-#define                AT91_PMC_UPLLCOUNT      (0xf << 20)             /* UTMI PLL Start-up Time */
-#define                AT91_PMC_BIASEN         (1   << 24)             /* UTMI BIAS Enable */
-#define                AT91_PMC_BIASCOUNT      (0xf << 28)             /* UTMI BIAS Start-up Time */
-
-#define        AT91_CKGR_MOR           0x20                    /* Main Oscillator Register [not on SAM9RL] */
-#define                AT91_PMC_MOSCEN         (1    <<  0)            /* Main Oscillator Enable */
-#define                AT91_PMC_OSCBYPASS      (1    <<  1)            /* Oscillator Bypass */
-#define                AT91_PMC_MOSCRCEN       (1    <<  3)            /* Main On-Chip RC Oscillator Enable [some SAM9] */
-#define                AT91_PMC_OSCOUNT        (0xff <<  8)            /* Main Oscillator Start-up Time */
-#define                AT91_PMC_KEY            (0x37 << 16)            /* MOR Writing Key */
-#define                AT91_PMC_MOSCSEL        (1    << 24)            /* Main Oscillator Selection [some SAM9] */
-#define                AT91_PMC_CFDEN          (1    << 25)            /* Clock Failure Detector Enable [some SAM9] */
-
-#define        AT91_CKGR_MCFR          0x24                    /* Main Clock Frequency Register */
-#define                AT91_PMC_MAINF          (0xffff <<  0)          /* Main Clock Frequency */
-#define                AT91_PMC_MAINRDY        (1      << 16)          /* Main Clock Ready */
-
-#define        AT91_CKGR_PLLAR         0x28                    /* PLL A Register */
-#define        AT91_CKGR_PLLBR         0x2c                    /* PLL B Register */
-#define                AT91_PMC_DIV            (0xff  <<  0)           /* Divider */
-#define                AT91_PMC_PLLCOUNT       (0x3f  <<  8)           /* PLL Counter */
-#define                AT91_PMC_OUT            (3     << 14)           /* PLL Clock Frequency Range */
-#define                AT91_PMC_MUL            (0x7ff << 16)           /* PLL Multiplier */
-#define                AT91_PMC_MUL_GET(n)     ((n) >> 16 & 0x7ff)
-#define                AT91_PMC3_MUL           (0x7f  << 18)           /* PLL Multiplier [SAMA5 only] */
-#define                AT91_PMC3_MUL_GET(n)    ((n) >> 18 & 0x7f)
-#define                AT91_PMC_USBDIV         (3     << 28)           /* USB Divisor (PLLB only) */
-#define                        AT91_PMC_USBDIV_1               (0 << 28)
-#define                        AT91_PMC_USBDIV_2               (1 << 28)
-#define                        AT91_PMC_USBDIV_4               (2 << 28)
-#define                AT91_PMC_USB96M         (1     << 28)           /* Divider by 2 Enable (PLLB only) */
-
-#define        AT91_PMC_MCKR           0x30                    /* Master Clock Register */
-#define                AT91_PMC_CSS            (3 <<  0)               /* Master Clock Selection */
-#define                        AT91_PMC_CSS_SLOW               (0 << 0)
-#define                        AT91_PMC_CSS_MAIN               (1 << 0)
-#define                        AT91_PMC_CSS_PLLA               (2 << 0)
-#define                        AT91_PMC_CSS_PLLB               (3 << 0)
-#define                        AT91_PMC_CSS_UPLL               (3 << 0)        /* [some SAM9 only] */
-#define                PMC_PRES_OFFSET         2
-#define                AT91_PMC_PRES           (7 <<  PMC_PRES_OFFSET)         /* Master Clock Prescaler */
-#define                        AT91_PMC_PRES_1                 (0 << PMC_PRES_OFFSET)
-#define                        AT91_PMC_PRES_2                 (1 << PMC_PRES_OFFSET)
-#define                        AT91_PMC_PRES_4                 (2 << PMC_PRES_OFFSET)
-#define                        AT91_PMC_PRES_8                 (3 << PMC_PRES_OFFSET)
-#define                        AT91_PMC_PRES_16                (4 << PMC_PRES_OFFSET)
-#define                        AT91_PMC_PRES_32                (5 << PMC_PRES_OFFSET)
-#define                        AT91_PMC_PRES_64                (6 << PMC_PRES_OFFSET)
-#define                PMC_ALT_PRES_OFFSET     4
-#define                AT91_PMC_ALT_PRES       (7 <<  PMC_ALT_PRES_OFFSET)             /* Master Clock Prescaler [alternate location] */
-#define                        AT91_PMC_ALT_PRES_1             (0 << PMC_ALT_PRES_OFFSET)
-#define                        AT91_PMC_ALT_PRES_2             (1 << PMC_ALT_PRES_OFFSET)
-#define                        AT91_PMC_ALT_PRES_4             (2 << PMC_ALT_PRES_OFFSET)
-#define                        AT91_PMC_ALT_PRES_8             (3 << PMC_ALT_PRES_OFFSET)
-#define                        AT91_PMC_ALT_PRES_16            (4 << PMC_ALT_PRES_OFFSET)
-#define                        AT91_PMC_ALT_PRES_32            (5 << PMC_ALT_PRES_OFFSET)
-#define                        AT91_PMC_ALT_PRES_64            (6 << PMC_ALT_PRES_OFFSET)
-#define                AT91_PMC_MDIV           (3 <<  8)               /* Master Clock Division */
-#define                        AT91RM9200_PMC_MDIV_1           (0 << 8)        /* [AT91RM9200 only] */
-#define                        AT91RM9200_PMC_MDIV_2           (1 << 8)
-#define                        AT91RM9200_PMC_MDIV_3           (2 << 8)
-#define                        AT91RM9200_PMC_MDIV_4           (3 << 8)
-#define                        AT91SAM9_PMC_MDIV_1             (0 << 8)        /* [SAM9 only] */
-#define                        AT91SAM9_PMC_MDIV_2             (1 << 8)
-#define                        AT91SAM9_PMC_MDIV_4             (2 << 8)
-#define                        AT91SAM9_PMC_MDIV_6             (3 << 8)        /* [some SAM9 only] */
-#define                        AT91SAM9_PMC_MDIV_3             (3 << 8)        /* [some SAM9 only] */
-#define                AT91_PMC_PDIV           (1 << 12)               /* Processor Clock Division [some SAM9 only] */
-#define                        AT91_PMC_PDIV_1                 (0 << 12)
-#define                        AT91_PMC_PDIV_2                 (1 << 12)
-#define                AT91_PMC_PLLADIV2       (1 << 12)               /* PLLA divisor by 2 [some SAM9 only] */
-#define                        AT91_PMC_PLLADIV2_OFF           (0 << 12)
-#define                        AT91_PMC_PLLADIV2_ON            (1 << 12)
-
-#define        AT91_PMC_USB            0x38                    /* USB Clock Register [some SAM9 only] */
-#define                AT91_PMC_USBS           (0x1 <<  0)             /* USB OHCI Input clock selection */
-#define                        AT91_PMC_USBS_PLLA              (0 << 0)
-#define                        AT91_PMC_USBS_UPLL              (1 << 0)
-#define                        AT91_PMC_USBS_PLLB              (1 << 0)        /* [AT91SAMN12 only] */
-#define                AT91_PMC_OHCIUSBDIV     (0xF <<  8)             /* Divider for USB OHCI Clock */
-#define                        AT91_PMC_OHCIUSBDIV_1   (0x0 <<  8)
-#define                        AT91_PMC_OHCIUSBDIV_2   (0x1 <<  8)
-
-#define        AT91_PMC_SMD            0x3c                    /* Soft Modem Clock Register [some SAM9 only] */
-#define                AT91_PMC_SMDS           (0x1  <<  0)            /* SMD input clock selection */
-#define                AT91_PMC_SMD_DIV        (0x1f <<  8)            /* SMD input clock divider */
-#define                AT91_PMC_SMDDIV(n)      (((n) <<  8) & AT91_PMC_SMD_DIV)
-
-#define        AT91_PMC_PCKR(n)        (0x40 + ((n) * 4))      /* Programmable Clock 0-N Registers */
-#define                AT91_PMC_ALT_PCKR_CSS   (0x7 <<  0)             /* Programmable Clock Source Selection [alternate length] */
-#define                        AT91_PMC_CSS_MASTER             (4 << 0)        /* [some SAM9 only] */
-#define                AT91_PMC_CSSMCK         (0x1 <<  8)             /* CSS or Master Clock Selection */
-#define                        AT91_PMC_CSSMCK_CSS             (0 << 8)
-#define                        AT91_PMC_CSSMCK_MCK             (1 << 8)
-
-#define        AT91_PMC_IER            0x60                    /* Interrupt Enable Register */
-#define        AT91_PMC_IDR            0x64                    /* Interrupt Disable Register */
-#define        AT91_PMC_SR             0x68                    /* Status Register */
-#define                AT91_PMC_MOSCS          (1 <<  0)               /* MOSCS Flag */
-#define                AT91_PMC_LOCKA          (1 <<  1)               /* PLLA Lock */
-#define                AT91_PMC_LOCKB          (1 <<  2)               /* PLLB Lock */
-#define                AT91_PMC_MCKRDY         (1 <<  3)               /* Master Clock */
-#define                AT91_PMC_LOCKU          (1 <<  6)               /* UPLL Lock [some SAM9] */
-#define                AT91_PMC_PCK0RDY        (1 <<  8)               /* Programmable Clock 0 */
-#define                AT91_PMC_PCK1RDY        (1 <<  9)               /* Programmable Clock 1 */
-#define                AT91_PMC_PCK2RDY        (1 << 10)               /* Programmable Clock 2 */
-#define                AT91_PMC_PCK3RDY        (1 << 11)               /* Programmable Clock 3 */
-#define                AT91_PMC_MOSCSELS       (1 << 16)               /* Main Oscillator Selection [some SAM9] */
-#define                AT91_PMC_MOSCRCS        (1 << 17)               /* Main On-Chip RC [some SAM9] */
-#define                AT91_PMC_CFDEV          (1 << 18)               /* Clock Failure Detector Event [some SAM9] */
-#define        AT91_PMC_IMR            0x6c                    /* Interrupt Mask Register */
-
-#define AT91_PMC_PROT          0xe4                    /* Write Protect Mode Register [some SAM9] */
-#define                AT91_PMC_WPEN           (0x1  <<  0)            /* Write Protect Enable */
-#define                AT91_PMC_WPKEY          (0xffffff << 8)         /* Write Protect Key */
-#define                AT91_PMC_PROTKEY        (0x504d43 << 8)         /* Activation Code */
-
-#define AT91_PMC_WPSR          0xe8                    /* Write Protect Status Register [some SAM9] */
-#define                AT91_PMC_WPVS           (0x1  <<  0)            /* Write Protect Violation Status */
-#define                AT91_PMC_WPVSRC         (0xffff  <<  8)         /* Write Protect Violation Source */
-
-#define AT91_PMC_PCER1         0x100                   /* Peripheral Clock Enable Register 1 [SAMA5 only]*/
-#define AT91_PMC_PCDR1         0x104                   /* Peripheral Clock Enable Register 1 */
-#define AT91_PMC_PCSR1         0x108                   /* Peripheral Clock Enable Register 1 */
-
-#define AT91_PMC_PCR           0x10c                   /* Peripheral Control Register [some SAM9 and SAMA5] */
-#define                AT91_PMC_PCR_PID        (0x3f  <<  0)           /* Peripheral ID */
-#define                AT91_PMC_PCR_CMD        (0x1  <<  12)           /* Command (read=0, write=1) */
-#define                AT91_PMC_PCR_DIV(n)     ((n)  <<  16)           /* Divisor Value */
-#define                        AT91_PMC_PCR_DIV0       0x0                     /* Peripheral clock is MCK */
-#define                        AT91_PMC_PCR_DIV2       0x1                     /* Peripheral clock is MCK/2 */
-#define                        AT91_PMC_PCR_DIV4       0x2                     /* Peripheral clock is MCK/4 */
-#define                        AT91_PMC_PCR_DIV8       0x3                     /* Peripheral clock is MCK/8 */
-#define                AT91_PMC_PCR_EN         (0x1  <<  28)           /* Enable */
-
-#endif
index d3d7b993846bb14103134289643c0fd004ae21ef..86c71debab5b617f11e50f701f7c1d768a232913 100644 (file)
@@ -53,6 +53,7 @@
 #define ARCH_EXID_SAMA5D33     0x00414300
 #define ARCH_EXID_SAMA5D34     0x00414301
 #define ARCH_EXID_SAMA5D35     0x00584300
+#define ARCH_EXID_SAMA5D36     0x00004301
 
 #define ARCH_FAMILY_AT91X92    0x09200000
 #define ARCH_FAMILY_AT91SAM9   0x01900000
@@ -105,7 +106,7 @@ enum at91_soc_subtype {
 
        /* SAMA5D3 */
        AT91_SOC_SAMA5D31, AT91_SOC_SAMA5D33, AT91_SOC_SAMA5D34,
-       AT91_SOC_SAMA5D35,
+       AT91_SOC_SAMA5D35, AT91_SOC_SAMA5D36,
 
        /* No subtype for this SoC */
        AT91_SOC_SUBTYPE_NONE,
index 9986542e8060119fcad4eee37564fdf3d8d164a6..590b52dea9f7a2c1da84440dd3c556ea06efcd8f 100644 (file)
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <asm/irq.h>
 #include <linux/atomic.h>
 #include <asm/mach/time.h>
 #include <asm/mach/irq.h>
 
-#include <mach/at91_pmc.h>
 #include <mach/cpu.h>
 
 #include "at91_aic.h"
@@ -155,9 +155,6 @@ static int at91_pm_verify_clocks(void)
                }
        }
 
-       if (!IS_ENABLED(CONFIG_AT91_PROGRAMMABLE_CLOCKS))
-               return 1;
-
        /* PCK0..PCK3 must be disabled, or configured to use clk32k */
        for (i = 0; i < 4; i++) {
                u32 css;
index 098c28ddf025fb95dfae6530ee547a7aaf76358b..20018779bae7a50db61b75ca8a1e9ebf1858d02d 100644 (file)
@@ -13,8 +13,8 @@
  */
 
 #include <linux/linkage.h>
+#include <linux/clk/at91_pmc.h>
 #include <mach/hardware.h>
-#include <mach/at91_pmc.h>
 #include <mach/at91_ramc.h>
 
 
index 99a0a1d2b7dce8503d303c7af2dc022f06738d74..b26156bf15db487b11080c4942730ad27bb1521a 100644 (file)
@@ -101,7 +101,7 @@ static void sam9_smc_cs_read(void __iomem *base,
        /* Pulse register */
        val = __raw_readl(base + AT91_SMC_PULSE);
 
-       config->nwe_setup = val & AT91_SMC_NWEPULSE;
+       config->nwe_pulse = val & AT91_SMC_NWEPULSE;
        config->ncs_write_pulse = (val & AT91_SMC_NCS_WRPULSE) >> 8;
        config->nrd_pulse = (val & AT91_SMC_NRDPULSE) >> 16;
        config->ncs_read_pulse = (val & AT91_SMC_NCS_RDPULSE) >> 24;
index a28873fe30491334e9feaad188901bea37d34d24..3d775d08de08def15011e449bca421fe19dc0f95 100644 (file)
 
 #include <linux/module.h>
 #include <linux/dma-mapping.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <asm/irq.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <mach/sama5d3.h>
-#include <mach/at91_pmc.h>
 #include <mach/cpu.h>
 
 #include "soc.h"
 #include "generic.h"
-#include "clock.h"
 #include "sam9_smc.h"
 
-/* --------------------------------------------------------------------
- *  Clocks
- * -------------------------------------------------------------------- */
-
-/*
- * The peripheral clocks.
- */
-
-static struct clk pioA_clk = {
-       .name           = "pioA_clk",
-       .pid            = SAMA5D3_ID_PIOA,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk pioB_clk = {
-       .name           = "pioB_clk",
-       .pid            = SAMA5D3_ID_PIOB,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk pioC_clk = {
-       .name           = "pioC_clk",
-       .pid            = SAMA5D3_ID_PIOC,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk pioD_clk = {
-       .name           = "pioD_clk",
-       .pid            = SAMA5D3_ID_PIOD,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk pioE_clk = {
-       .name           = "pioE_clk",
-       .pid            = SAMA5D3_ID_PIOE,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk usart0_clk = {
-       .name           = "usart0_clk",
-       .pid            = SAMA5D3_ID_USART0,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk usart1_clk = {
-       .name           = "usart1_clk",
-       .pid            = SAMA5D3_ID_USART1,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk usart2_clk = {
-       .name           = "usart2_clk",
-       .pid            = SAMA5D3_ID_USART2,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk usart3_clk = {
-       .name           = "usart3_clk",
-       .pid            = SAMA5D3_ID_USART3,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk uart0_clk = {
-       .name           = "uart0_clk",
-       .pid            = SAMA5D3_ID_UART0,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk uart1_clk = {
-       .name           = "uart1_clk",
-       .pid            = SAMA5D3_ID_UART1,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk twi0_clk = {
-       .name           = "twi0_clk",
-       .pid            = SAMA5D3_ID_TWI0,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV8,
-};
-static struct clk twi1_clk = {
-       .name           = "twi1_clk",
-       .pid            = SAMA5D3_ID_TWI1,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV8,
-};
-static struct clk twi2_clk = {
-       .name           = "twi2_clk",
-       .pid            = SAMA5D3_ID_TWI2,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV8,
-};
-static struct clk mmc0_clk = {
-       .name           = "mci0_clk",
-       .pid            = SAMA5D3_ID_HSMCI0,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk mmc1_clk = {
-       .name           = "mci1_clk",
-       .pid            = SAMA5D3_ID_HSMCI1,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk mmc2_clk = {
-       .name           = "mci2_clk",
-       .pid            = SAMA5D3_ID_HSMCI2,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk spi0_clk = {
-       .name           = "spi0_clk",
-       .pid            = SAMA5D3_ID_SPI0,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk spi1_clk = {
-       .name           = "spi1_clk",
-       .pid            = SAMA5D3_ID_SPI1,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk tcb0_clk = {
-       .name           = "tcb0_clk",
-       .pid            = SAMA5D3_ID_TC0,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk tcb1_clk = {
-       .name           = "tcb1_clk",
-       .pid            = SAMA5D3_ID_TC1,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk adc_clk = {
-       .name           = "adc_clk",
-       .pid            = SAMA5D3_ID_ADC,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk adc_op_clk = {
-       .name           = "adc_op_clk",
-       .type           = CLK_TYPE_PERIPHERAL,
-       .rate_hz        = 5000000,
-};
-static struct clk dma0_clk = {
-       .name           = "dma0_clk",
-       .pid            = SAMA5D3_ID_DMA0,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk dma1_clk = {
-       .name           = "dma1_clk",
-       .pid            = SAMA5D3_ID_DMA1,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk uhphs_clk = {
-       .name           = "uhphs",
-       .pid            = SAMA5D3_ID_UHPHS,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk udphs_clk = {
-       .name           = "udphs_clk",
-       .pid            = SAMA5D3_ID_UDPHS,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-/* gmac only for sama5d33, sama5d34, sama5d35 */
-static struct clk macb0_clk = {
-       .name           = "macb0_clk",
-       .pid            = SAMA5D3_ID_GMAC,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-/* emac only for sama5d31, sama5d35 */
-static struct clk macb1_clk = {
-       .name           = "macb1_clk",
-       .pid            = SAMA5D3_ID_EMAC,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-/* lcd only for sama5d31, sama5d33, sama5d34 */
-static struct clk lcdc_clk = {
-       .name           = "lcdc_clk",
-       .pid            = SAMA5D3_ID_LCDC,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-/* isi only for sama5d33, sama5d35 */
-static struct clk isi_clk = {
-       .name           = "isi_clk",
-       .pid            = SAMA5D3_ID_ISI,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk can0_clk = {
-       .name           = "can0_clk",
-       .pid            = SAMA5D3_ID_CAN0,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk can1_clk = {
-       .name           = "can1_clk",
-       .pid            = SAMA5D3_ID_CAN1,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk ssc0_clk = {
-       .name           = "ssc0_clk",
-       .pid            = SAMA5D3_ID_SSC0,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk ssc1_clk = {
-       .name           = "ssc1_clk",
-       .pid            = SAMA5D3_ID_SSC1,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV2,
-};
-static struct clk sha_clk = {
-       .name           = "sha_clk",
-       .pid            = SAMA5D3_ID_SHA,
-       .type           = CLK_TYPE_PERIPHERAL,
-       .div            = AT91_PMC_PCR_DIV8,
-};
-static struct clk aes_clk = {
-       .name           = "aes_clk",
-       .pid            = SAMA5D3_ID_AES,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-static struct clk tdes_clk = {
-       .name           = "tdes_clk",
-       .pid            = SAMA5D3_ID_TDES,
-       .type           = CLK_TYPE_PERIPHERAL,
-};
-
-static struct clk *periph_clocks[] __initdata = {
-       &pioA_clk,
-       &pioB_clk,
-       &pioC_clk,
-       &pioD_clk,
-       &pioE_clk,
-       &usart0_clk,
-       &usart1_clk,
-       &usart2_clk,
-       &usart3_clk,
-       &uart0_clk,
-       &uart1_clk,
-       &twi0_clk,
-       &twi1_clk,
-       &twi2_clk,
-       &mmc0_clk,
-       &mmc1_clk,
-       &mmc2_clk,
-       &spi0_clk,
-       &spi1_clk,
-       &tcb0_clk,
-       &tcb1_clk,
-       &adc_clk,
-       &adc_op_clk,
-       &dma0_clk,
-       &dma1_clk,
-       &uhphs_clk,
-       &udphs_clk,
-       &macb0_clk,
-       &macb1_clk,
-       &lcdc_clk,
-       &isi_clk,
-       &can0_clk,
-       &can1_clk,
-       &ssc0_clk,
-       &ssc1_clk,
-       &sha_clk,
-       &aes_clk,
-       &tdes_clk,
-};
-
-static struct clk pck0 = {
-       .name           = "pck0",
-       .pmc_mask       = AT91_PMC_PCK0,
-       .type           = CLK_TYPE_PROGRAMMABLE,
-       .id             = 0,
-};
-
-static struct clk pck1 = {
-       .name           = "pck1",
-       .pmc_mask       = AT91_PMC_PCK1,
-       .type           = CLK_TYPE_PROGRAMMABLE,
-       .id             = 1,
-};
-
-static struct clk pck2 = {
-       .name           = "pck2",
-       .pmc_mask       = AT91_PMC_PCK2,
-       .type           = CLK_TYPE_PROGRAMMABLE,
-       .id             = 2,
-};
-
-static struct clk_lookup periph_clocks_lookups[] = {
-       /* lookup table for DT entries */
-       CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck),
-       CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
-       CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk),
-       CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioC_clk),
-       CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioD_clk),
-       CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioE_clk),
-       CLKDEV_CON_DEV_ID("usart", "f001c000.serial", &usart0_clk),
-       CLKDEV_CON_DEV_ID("usart", "f0020000.serial", &usart1_clk),
-       CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart2_clk),
-       CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart3_clk),
-       CLKDEV_CON_DEV_ID(NULL, "f0014000.i2c", &twi0_clk),
-       CLKDEV_CON_DEV_ID(NULL, "f0018000.i2c", &twi1_clk),
-       CLKDEV_CON_DEV_ID(NULL, "f801c000.i2c", &twi2_clk),
-       CLKDEV_CON_DEV_ID("mci_clk", "f0000000.mmc", &mmc0_clk),
-       CLKDEV_CON_DEV_ID("mci_clk", "f8000000.mmc", &mmc1_clk),
-       CLKDEV_CON_DEV_ID("mci_clk", "f8004000.mmc", &mmc2_clk),
-       CLKDEV_CON_DEV_ID("spi_clk", "f0004000.spi", &spi0_clk),
-       CLKDEV_CON_DEV_ID("spi_clk", "f8008000.spi", &spi1_clk),
-       CLKDEV_CON_DEV_ID("t0_clk", "f0010000.timer", &tcb0_clk),
-       CLKDEV_CON_DEV_ID("t0_clk", "f8014000.timer", &tcb1_clk),
-       CLKDEV_CON_DEV_ID("tsc_clk", "f8018000.tsadcc", &adc_clk),
-       CLKDEV_CON_DEV_ID("dma_clk", "ffffe600.dma-controller", &dma0_clk),
-       CLKDEV_CON_DEV_ID("dma_clk", "ffffe800.dma-controller", &dma1_clk),
-       CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk),
-       CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk),
-       CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk),
-       CLKDEV_CON_DEV_ID("pclk", "500000.gadget", &udphs_clk),
-       CLKDEV_CON_DEV_ID("hclk", "500000.gadget", &utmi_clk),
-       CLKDEV_CON_DEV_ID("hclk", "f0028000.ethernet", &macb0_clk),
-       CLKDEV_CON_DEV_ID("pclk", "f0028000.ethernet", &macb0_clk),
-       CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb1_clk),
-       CLKDEV_CON_DEV_ID("pclk", "f802c000.ethernet", &macb1_clk),
-       CLKDEV_CON_DEV_ID("pclk", "f0008000.ssc", &ssc0_clk),
-       CLKDEV_CON_DEV_ID("pclk", "f000c000.ssc", &ssc1_clk),
-       CLKDEV_CON_DEV_ID("can_clk", "f000c000.can", &can0_clk),
-       CLKDEV_CON_DEV_ID("can_clk", "f8010000.can", &can1_clk),
-       CLKDEV_CON_DEV_ID("sha_clk", "f8034000.sha", &sha_clk),
-       CLKDEV_CON_DEV_ID("aes_clk", "f8038000.aes", &aes_clk),
-       CLKDEV_CON_DEV_ID("tdes_clk", "f803c000.tdes", &tdes_clk),
-};
-
-static void __init sama5d3_register_clocks(void)
-{
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
-               clk_register(periph_clocks[i]);
-
-       clkdev_add_table(periph_clocks_lookups,
-                        ARRAY_SIZE(periph_clocks_lookups));
-
-       clk_register(&pck0);
-       clk_register(&pck1);
-       clk_register(&pck2);
-}
-
 /* --------------------------------------------------------------------
  *  AT91SAM9x5 processor initialization
  * -------------------------------------------------------------------- */
@@ -378,6 +37,5 @@ static void __init sama5d3_initialize(void)
 
 AT91_SOC_START(sama5d3)
        .map_io = sama5d3_map_io,
-       .register_clocks = sama5d3_register_clocks,
        .init = sama5d3_initialize,
 AT91_SOC_END
index 094b3459c288e37700c42ea85a57ced905323eda..f7ca97b7291e2f9b48a2968f47bc92e788ff79cf 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/pm.h>
 #include <linux/of_address.h>
 #include <linux/pinctrl/machine.h>
+#include <linux/clk/at91_pmc.h>
 
 #include <asm/system_misc.h>
 #include <asm/mach/map.h>
@@ -18,7 +19,6 @@
 #include <mach/hardware.h>
 #include <mach/cpu.h>
 #include <mach/at91_dbgu.h>
-#include <mach/at91_pmc.h>
 
 #include "at91_shdwc.h"
 #include "soc.h"
@@ -81,7 +81,7 @@ void __init at91_init_sram(int bank, unsigned long base, unsigned int length)
 
        desc->pfn = __phys_to_pfn(base);
        desc->length = length;
-       desc->type = MT_MEMORY_NONCACHED;
+       desc->type = MT_MEMORY_RWX_NONCACHED;
 
        pr_info("AT91: sram at 0x%lx of 0x%x mapped at 0x%lx\n",
                base, length, desc->virtual);
@@ -233,6 +233,9 @@ static void __init soc_detect(u32 dbgu_base)
                case ARCH_EXID_SAMA5D35:
                        at91_soc_initdata.subtype = AT91_SOC_SAMA5D35;
                        break;
+               case ARCH_EXID_SAMA5D36:
+                       at91_soc_initdata.subtype = AT91_SOC_SAMA5D36;
+                       break;
                }
        }
 }
@@ -275,6 +278,7 @@ static const char *soc_subtype_name[] = {
        [AT91_SOC_SAMA5D33]     = "sama5d33",
        [AT91_SOC_SAMA5D34]     = "sama5d34",
        [AT91_SOC_SAMA5D35]     = "sama5d35",
+       [AT91_SOC_SAMA5D36]     = "sama5d36",
        [AT91_SOC_SUBTYPE_NONE] = "None",
        [AT91_SOC_SUBTYPE_UNKNOWN] = "Unknown",
 };
@@ -491,7 +495,8 @@ void __init at91rm9200_dt_initialize(void)
        at91_dt_clock_init();
 
        /* Register the processor-specific clocks */
-       at91_boot_soc.register_clocks();
+       if (at91_boot_soc.register_clocks)
+               at91_boot_soc.register_clocks();
 
        at91_boot_soc.init();
 }
@@ -506,7 +511,8 @@ void __init at91_dt_initialize(void)
        at91_dt_clock_init();
 
        /* Register the processor-specific clocks */
-       at91_boot_soc.register_clocks();
+       if (at91_boot_soc.register_clocks)
+               at91_boot_soc.register_clocks();
 
        if (at91_boot_soc.init)
                at91_boot_soc.init();
index 560045cafc3417c4fe8aba877ff7d233a4fbf949..d1f9612f8c1544bebd7ffc9a19001e73cbcfdd05 100644 (file)
@@ -12,4 +12,4 @@ config ARCH_BCM2835
        select PINCTRL_BCM2835
        help
          This enables support for the Broadcom BCM2835 SoC. This SoC is
-         use in the Raspberry Pi, and Roku 2 devices.
+         used in the Raspberry Pi and Roku 2 devices.
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
new file mode 100644 (file)
index 0000000..7a02d22
--- /dev/null
@@ -0,0 +1,29 @@
+config ARCH_BERLIN
+       bool "Marvell Berlin SoCs" if ARCH_MULTI_V7
+       select ARM_GIC
+       select GENERIC_CLOCKEVENTS
+       select GENERIC_IRQ_CHIP
+       select COMMON_CLK
+       select DW_APB_ICTL
+       select DW_APB_TIMER_OF
+
+if ARCH_BERLIN
+
+menu "Marvell Berlin SoC variants"
+
+config MACH_BERLIN_BG2
+       bool "Marvell Armada 1500 (BG2)"
+       select CACHE_L2X0
+       select CPU_PJ4B
+       select HAVE_ARM_TWD if SMP
+       select HAVE_SMP
+
+config MACH_BERLIN_BG2CD
+       bool "Marvell Armada 1500-mini (BG2CD)"
+       select CACHE_L2X0
+       select CPU_V7
+       select HAVE_ARM_TWD if SMP
+
+endmenu
+
+endif
diff --git a/arch/arm/mach-berlin/Makefile b/arch/arm/mach-berlin/Makefile
new file mode 100644 (file)
index 0000000..ab69fe9
--- /dev/null
@@ -0,0 +1 @@
+obj-y += berlin.o
diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c
new file mode 100644 (file)
index 0000000..025bcb5
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Device Tree support for Marvell Berlin SoCs.
+ *
+ * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ *  (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+#include <asm/hardware/cache-l2x0.h>
+#include <asm/mach/arch.h>
+
+static void __init berlin_init_machine(void)
+{
+       /*
+        * with DT probing for L2CCs, berlin_init_machine can be removed.
+        * Note: 88DE3005 (Armada 1500-mini) uses pl310 l2cc
+        */
+       l2x0_of_init(0x70c00000, 0xfeffffff);
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char * const berlin_dt_compat[] = {
+       "marvell,berlin",
+       NULL,
+};
+
+DT_MACHINE_START(BERLIN_DT, "Marvell Berlin")
+       .dt_compat      = berlin_dt_compat,
+       .init_machine   = berlin_init_machine,
+MACHINE_END
index 134641d688bb12f201dd2d0cedcd166890a8ce71..a1935911e4f19ffd1a62080241470a6651cc2c10 100644 (file)
@@ -259,7 +259,7 @@ asmlinkage void __exception_irq_entry clps711x_handle_irq(struct pt_regs *regs)
        } while (1);
 }
 
-static u32 notrace clps711x_sched_clock_read(void)
+static u64 notrace clps711x_sched_clock_read(void)
 {
        return ~readw_relaxed(CLPS711X_VIRT_BASE + TC1D);
 }
@@ -366,7 +366,7 @@ void __init clps711x_timer_init(void)
        tmp = clps_readl(SYSCON1) & ~(SYSCON1_TC1S | SYSCON1_TC1M);
        clps_writel(tmp, SYSCON1);
 
-       setup_sched_clock(clps711x_sched_clock_read, 16, timl);
+       sched_clock_register(clps711x_sched_clock_read, 16, timl);
 
        clocksource_mmio_init(CLPS711X_VIRT_BASE + TC1D,
                              "clps711x_clocksource", timl, 300, 16,
index dc9a470ff9c57afe9855bfaf592a27a62b3888a6..985e5fd00fb27d82297c94208a63e911263c6996 100644 (file)
@@ -133,7 +133,7 @@ EXPORT_SYMBOL(clk_get_rate);
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
        if (clk == NULL || IS_ERR(clk))
-               return -EINVAL;
+               return 0;
 
        if (clk->round_rate)
                return clk->round_rate(clk, rate);
index 0813b5167e059e1c7c32d82374bbdb6470eb9370..115d5736da80a887ef00843782f70ebf6f0c4ee8 100644 (file)
@@ -385,7 +385,7 @@ static struct clk_lookup da830_clks[] = {
        CLK(NULL,               "pll0_sysclk7", &pll0_sysclk7),
        CLK("i2c_davinci.1",    NULL,           &i2c0_clk),
        CLK(NULL,               "timer0",       &timerp64_0_clk),
-       CLK("watchdog",         NULL,           &timerp64_1_clk),
+       CLK("davinci-wdt",      NULL,           &timerp64_1_clk),
        CLK(NULL,               "arm_rom",      &arm_rom_clk),
        CLK(NULL,               "scr0_ss",      &scr0_ss_clk),
        CLK(NULL,               "scr1_ss",      &scr1_ss_clk),
@@ -1153,7 +1153,6 @@ static struct davinci_id da830_ids[] = {
 
 static struct davinci_gpio_platform_data da830_gpio_platform_data = {
        .ngpio = 128,
-       .intc_irq_num = DA830_N_CP_INTC_IRQ,
 };
 
 int __init da830_register_gpio(void)
index 352984e1528a4ab08cdd2e52b072e841e6a895e1..2ab00434b2eb64405a2c4b75f315950cbe9663c0 100644 (file)
@@ -443,7 +443,7 @@ static struct clk_lookup da850_clks[] = {
        CLK(NULL,               "pll1_sysclk3", &pll1_sysclk3),
        CLK("i2c_davinci.1",    NULL,           &i2c0_clk),
        CLK(NULL,               "timer0",       &timerp64_0_clk),
-       CLK("watchdog",         NULL,           &timerp64_1_clk),
+       CLK("davinci-wdt",      NULL,           &timerp64_1_clk),
        CLK(NULL,               "arm_rom",      &arm_rom_clk),
        CLK(NULL,               "tpcc0",        &tpcc0_clk),
        CLK(NULL,               "tptc0",        &tptc0_clk),
@@ -1283,7 +1283,6 @@ int __init da850_register_vpif_capture(struct vpif_capture_config
 
 static struct davinci_gpio_platform_data da850_gpio_platform_data = {
        .ngpio = 144,
-       .intc_irq_num = DA850_N_CP_INTC_IRQ,
 };
 
 int __init da850_register_gpio(void)
index d2bc574ae172cfbfc2671f24372c137baa73056d..ed1928740b5f5d1817d5c214ca31486257a04e94 100644 (file)
@@ -32,7 +32,7 @@ static void __init da8xx_init_irq(void)
 
 static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
-       OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL),
+       OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "davinci-wdt", NULL),
        OF_DEV_AUXDATA("ti,da830-mmc", 0x01c40000, "da830-mmc.0", NULL),
        OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f00000, "ehrpwm", NULL),
        OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f02000, "ehrpwm", NULL),
index 78829c513fdc354bce631d67f45922efff84368d..0486cdf28c8d552205ff4285fe7d7476721cc2a6 100644 (file)
@@ -389,7 +389,7 @@ static struct resource da8xx_watchdog_resources[] = {
 };
 
 static struct platform_device da8xx_wdt_device = {
-       .name           = "watchdog",
+       .name           = "davinci-wdt",
        .id             = -1,
        .num_resources  = ARRAY_SIZE(da8xx_watchdog_resources),
        .resource       = da8xx_watchdog_resources,
@@ -399,7 +399,7 @@ void da8xx_restart(enum reboot_mode mode, const char *cmd)
 {
        struct device *dev;
 
-       dev = bus_find_device_by_name(&platform_bus_type, NULL, "watchdog");
+       dev = bus_find_device_by_name(&platform_bus_type, NULL, "davinci-wdt");
        if (!dev) {
                pr_err("%s: failed to find watchdog device\n", __func__);
                return;
index 3996e98f52fbe0c4e8601bb2dc1b8d0932a8ffd9..5cf9a027dcc6ae23063182c2461f1ddb66339e7b 100644 (file)
@@ -302,7 +302,7 @@ static struct resource wdt_resources[] = {
 };
 
 struct platform_device davinci_wdt_device = {
-       .name           = "watchdog",
+       .name           = "davinci-wdt",
        .id             = -1,
        .num_resources  = ARRAY_SIZE(wdt_resources),
        .resource       = wdt_resources,
index 6117fc644188d9aa81c2397dbb60538db190beea..4668c0e197670123aea18a95a61a4cc78e796884 100644 (file)
@@ -375,7 +375,7 @@ static struct clk_lookup dm355_clks[] = {
        CLK(NULL, "pwm3", &pwm3_clk),
        CLK(NULL, "timer0", &timer0_clk),
        CLK(NULL, "timer1", &timer1_clk),
-       CLK("watchdog", NULL, &timer2_clk),
+       CLK("davinci-wdt", NULL, &timer2_clk),
        CLK(NULL, "timer3", &timer3_clk),
        CLK(NULL, "rto", &rto_clk),
        CLK(NULL, "usb", &usb_clk),
@@ -901,7 +901,6 @@ static struct resource dm355_gpio_resources[] = {
 
 static struct davinci_gpio_platform_data dm355_gpio_platform_data = {
        .ngpio          = 104,
-       .intc_irq_num   = DAVINCI_N_AINTC_IRQ,
 };
 
 int __init dm355_gpio_register(void)
index d7c6f85d3fc9d5c4347ec214ae8e71a310f89b62..b44b49e2801af7b33842ed2e996cdf13fa600b63 100644 (file)
@@ -473,7 +473,7 @@ static struct clk_lookup dm365_clks[] = {
        CLK(NULL, "pwm3", &pwm3_clk),
        CLK(NULL, "timer0", &timer0_clk),
        CLK(NULL, "timer1", &timer1_clk),
-       CLK("watchdog", NULL, &timer2_clk),
+       CLK("davinci-wdt", NULL, &timer2_clk),
        CLK(NULL, "timer3", &timer3_clk),
        CLK(NULL, "usb", &usb_clk),
        CLK("davinci_emac.1", NULL, &emac_clk),
@@ -713,7 +713,6 @@ static struct resource dm365_gpio_resources[] = {
 
 static struct davinci_gpio_platform_data dm365_gpio_platform_data = {
        .ngpio          = 104,
-       .intc_irq_num   = DAVINCI_N_AINTC_IRQ,
        .gpio_unbanked  = 8,
 };
 
index 3ce47997bb46150e82f40e718474feeae52b6d5e..5c3e0be95ef3d283b653d5842001386527ab2979 100644 (file)
@@ -322,7 +322,7 @@ static struct clk_lookup dm644x_clks[] = {
        CLK(NULL, "pwm2", &pwm2_clk),
        CLK(NULL, "timer0", &timer0_clk),
        CLK(NULL, "timer1", &timer1_clk),
-       CLK("watchdog", NULL, &timer2_clk),
+       CLK("davinci-wdt", NULL, &timer2_clk),
        CLK(NULL, NULL, NULL),
 };
 
@@ -787,7 +787,6 @@ static struct resource dm644_gpio_resources[] = {
 
 static struct davinci_gpio_platform_data dm644_gpio_platform_data = {
        .ngpio          = 71,
-       .intc_irq_num   = DAVINCI_N_AINTC_IRQ,
 };
 
 int __init dm644x_gpio_register(void)
index 0e81fea65e7fb484cda893f0a4cd91d0b74fc0ad..81768dd47096ec0f5a476c5c90d9fcd70690521a 100644 (file)
@@ -356,7 +356,7 @@ static struct clk_lookup dm646x_clks[] = {
        CLK(NULL, "pwm1", &pwm1_clk),
        CLK(NULL, "timer0", &timer0_clk),
        CLK(NULL, "timer1", &timer1_clk),
-       CLK("watchdog", NULL, &timer2_clk),
+       CLK("davinci-wdt", NULL, &timer2_clk),
        CLK("palm_bk3710", NULL, &ide_clk),
        CLK(NULL, "vpif0", &vpif0_clk),
        CLK(NULL, "vpif1", &vpif1_clk),
@@ -763,7 +763,6 @@ static struct resource dm646x_gpio_resources[] = {
 
 static struct davinci_gpio_platform_data dm646x_gpio_platform_data = {
        .ngpio          = 43,
-       .intc_irq_num   = DAVINCI_N_AINTC_IRQ,
 };
 
 int __init dm646x_gpio_register(void)
index 56c6eb5266adf8f5c18629db9cfb65018f5bad50..24ad30f32ae327d8e8bd0bb3056232ab78e66da0 100644 (file)
@@ -285,7 +285,7 @@ static struct clocksource clocksource_davinci = {
 /*
  * Overwrite weak default sched_clock with something more precise
  */
-static u32 notrace davinci_read_sched_clock(void)
+static u64 notrace davinci_read_sched_clock(void)
 {
        return timer32_read(&timers[TID_CLOCKSOURCE]);
 }
@@ -391,7 +391,7 @@ void __init davinci_timer_init(void)
                                    davinci_clock_tick_rate))
                printk(err, clocksource_davinci.name);
 
-       setup_sched_clock(davinci_read_sched_clock, 32,
+       sched_clock_register(davinci_read_sched_clock, 32,
                          davinci_clock_tick_rate);
 
        /* setup clockevent */
index c122bcff9f7c91647a3251266348bef2c531a12b..0d1a89298ece95518c43e07c2c32aa0b15147c69 100644 (file)
@@ -162,7 +162,7 @@ void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
 /*****************************************************************************
  * SoC RTC
  ****************************************************************************/
-void __init dove_rtc_init(void)
+static void __init dove_rtc_init(void)
 {
        orion_rtc_init(DOVE_RTC_PHYS_BASE, IRQ_DOVE_RTC);
 }
@@ -256,19 +256,10 @@ void __init dove_timer_init(void)
                        IRQ_DOVE_BRIDGE, dove_tclk);
 }
 
-/*****************************************************************************
- * Cryptographic Engines and Security Accelerator (CESA)
- ****************************************************************************/
-void __init dove_crypto_init(void)
-{
-       orion_crypto_init(DOVE_CRYPT_PHYS_BASE, DOVE_CESA_PHYS_BASE,
-                         DOVE_CESA_SIZE, IRQ_DOVE_CRYPTO);
-}
-
 /*****************************************************************************
  * XOR 0
  ****************************************************************************/
-void __init dove_xor0_init(void)
+static void __init dove_xor0_init(void)
 {
        orion_xor0_init(DOVE_XOR0_PHYS_BASE, DOVE_XOR0_HIGH_PHYS_BASE,
                        IRQ_DOVE_XOR_00, IRQ_DOVE_XOR_01);
@@ -277,7 +268,7 @@ void __init dove_xor0_init(void)
 /*****************************************************************************
  * XOR 1
  ****************************************************************************/
-void __init dove_xor1_init(void)
+static void __init dove_xor1_init(void)
 {
        orion_xor1_init(DOVE_XOR1_PHYS_BASE, DOVE_XOR1_HIGH_PHYS_BASE,
                        IRQ_DOVE_XOR_10, IRQ_DOVE_XOR_11);
diff --git a/arch/arm/mach-efm32/Makefile b/arch/arm/mach-efm32/Makefile
new file mode 100644 (file)
index 0000000..3a74af7
--- /dev/null
@@ -0,0 +1 @@
+obj-y += dtmachine.o
diff --git a/arch/arm/mach-efm32/Makefile.boot b/arch/arm/mach-efm32/Makefile.boot
new file mode 100644 (file)
index 0000000..eacfc3f
--- /dev/null
@@ -0,0 +1,3 @@
+# Empty file waiting for deletion once Makefile.boot isn't needed any more.
+# Patch waits for application at
+# http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7889/1 .
diff --git a/arch/arm/mach-efm32/dtmachine.c b/arch/arm/mach-efm32/dtmachine.c
new file mode 100644 (file)
index 0000000..2367495
--- /dev/null
@@ -0,0 +1,15 @@
+#include <linux/kernel.h>
+
+#include <asm/v7m.h>
+
+#include <asm/mach/arch.h>
+
+static const char *const efm32gg_compat[] __initconst = {
+       "efm32,dk3750",
+       NULL
+};
+
+DT_MACHINE_START(EFM32DT, "EFM32 (Device Tree Support)")
+       .dt_compat = efm32gg_compat,
+       .restart = armv7m_restart,
+MACHINE_END
diff --git a/arch/arm/mach-efm32/include/mach/entry-macro.S b/arch/arm/mach-efm32/include/mach/entry-macro.S
new file mode 100644 (file)
index 0000000..322159d
--- /dev/null
@@ -0,0 +1,4 @@
+/*
+ * Empty file waiting for deletion once <mach/entry-macro.S> isn't needed any
+ * more. Patch "ARM: v7-M: drop using mach/entry-macro.S" sitting in next.
+ */
diff --git a/arch/arm/mach-efm32/include/mach/timex.h b/arch/arm/mach-efm32/include/mach/timex.h
new file mode 100644 (file)
index 0000000..7a8b26d
--- /dev/null
@@ -0,0 +1,3 @@
+/*
+ * Empty file waiting for deletion once <mach/timex.h> isn't needed any more.
+ */
index 93e54fd4e3d55900192f62e573d6d97a2919aa4b..bec570ae6494d0bfacd8b479ee9876fbc61dbfeb 100644 (file)
@@ -5,6 +5,7 @@ menu "Cirrus EP93xx Implementation Options"
 config EP93XX_SOC_COMMON
        bool
        default y
+       select SOC_BUS
        select LEDS_GPIO_REGISTER
 
 config CRUNCH
index d95ee28a616a3ed53c776dda2df2fa5da6f229f1..157ba88433c949c1db4595400cfbea3cc29a5c47 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/dma-mapping.h>
+#include <linux/sys_soc.h>
 #include <linux/timex.h>
 #include <linux/irq.h>
 #include <linux/io.h>
@@ -44,6 +45,7 @@
 #include <linux/platform_data/spi-ep93xx.h>
 #include <mach/gpio-ep93xx.h>
 
+#include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 
@@ -137,7 +139,7 @@ static irqreturn_t ep93xx_timer_interrupt(int irq, void *dev_id)
 
 static struct irqaction ep93xx_timer_irq = {
        .name           = "ep93xx timer",
-       .flags          = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
+       .flags          = IRQF_TIMER | IRQF_IRQPOLL,
        .handler        = ep93xx_timer_interrupt,
 };
 
@@ -925,8 +927,108 @@ void ep93xx_ide_release_gpio(struct platform_device *pdev)
 }
 EXPORT_SYMBOL(ep93xx_ide_release_gpio);
 
-void __init ep93xx_init_devices(void)
+/*************************************************************************
+ * EP93xx Security peripheral
+ *************************************************************************/
+
+/*
+ * The Maverick Key is 256 bits of micro fuses blown at the factory during
+ * manufacturing to uniquely identify a part.
+ *
+ * See: http://arm.cirrus.com/forum/viewtopic.php?t=486&highlight=maverick+key
+ */
+#define EP93XX_SECURITY_REG(x)         (EP93XX_SECURITY_BASE + (x))
+#define EP93XX_SECURITY_SECFLG         EP93XX_SECURITY_REG(0x2400)
+#define EP93XX_SECURITY_FUSEFLG                EP93XX_SECURITY_REG(0x2410)
+#define EP93XX_SECURITY_UNIQID         EP93XX_SECURITY_REG(0x2440)
+#define EP93XX_SECURITY_UNIQCHK                EP93XX_SECURITY_REG(0x2450)
+#define EP93XX_SECURITY_UNIQVAL                EP93XX_SECURITY_REG(0x2460)
+#define EP93XX_SECURITY_SECID1         EP93XX_SECURITY_REG(0x2500)
+#define EP93XX_SECURITY_SECID2         EP93XX_SECURITY_REG(0x2504)
+#define EP93XX_SECURITY_SECCHK1                EP93XX_SECURITY_REG(0x2520)
+#define EP93XX_SECURITY_SECCHK2                EP93XX_SECURITY_REG(0x2524)
+#define EP93XX_SECURITY_UNIQID2                EP93XX_SECURITY_REG(0x2700)
+#define EP93XX_SECURITY_UNIQID3                EP93XX_SECURITY_REG(0x2704)
+#define EP93XX_SECURITY_UNIQID4                EP93XX_SECURITY_REG(0x2708)
+#define EP93XX_SECURITY_UNIQID5                EP93XX_SECURITY_REG(0x270c)
+
+static char ep93xx_soc_id[33];
+
+static const char __init *ep93xx_get_soc_id(void)
 {
+       unsigned int id, id2, id3, id4, id5;
+
+       if (__raw_readl(EP93XX_SECURITY_UNIQVAL) != 1)
+               return "bad Hamming code";
+
+       id = __raw_readl(EP93XX_SECURITY_UNIQID);
+       id2 = __raw_readl(EP93XX_SECURITY_UNIQID2);
+       id3 = __raw_readl(EP93XX_SECURITY_UNIQID3);
+       id4 = __raw_readl(EP93XX_SECURITY_UNIQID4);
+       id5 = __raw_readl(EP93XX_SECURITY_UNIQID5);
+
+       if (id != id2)
+               return "invalid";
+
+       snprintf(ep93xx_soc_id, sizeof(ep93xx_soc_id),
+                "%08x%08x%08x%08x", id2, id3, id4, id5);
+
+       return ep93xx_soc_id;
+}
+
+static const char __init *ep93xx_get_soc_rev(void)
+{
+       int rev = ep93xx_chip_revision();
+
+       switch (rev) {
+       case EP93XX_CHIP_REV_D0:
+               return "D0";
+       case EP93XX_CHIP_REV_D1:
+               return "D1";
+       case EP93XX_CHIP_REV_E0:
+               return "E0";
+       case EP93XX_CHIP_REV_E1:
+               return "E1";
+       case EP93XX_CHIP_REV_E2:
+               return "E2";
+       default:
+               return "unknown";
+       }
+}
+
+static const char __init *ep93xx_get_machine_name(void)
+{
+       return kasprintf(GFP_KERNEL,"%s", machine_desc->name);
+}
+
+static struct device __init *ep93xx_init_soc(void)
+{
+       struct soc_device_attribute *soc_dev_attr;
+       struct soc_device *soc_dev;
+
+       soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+       if (!soc_dev_attr)
+               return NULL;
+
+       soc_dev_attr->machine = ep93xx_get_machine_name();
+       soc_dev_attr->family = "Cirrus Logic EP93xx";
+       soc_dev_attr->revision = ep93xx_get_soc_rev();
+       soc_dev_attr->soc_id = ep93xx_get_soc_id();
+
+       soc_dev = soc_device_register(soc_dev_attr);
+       if (IS_ERR(soc_dev)) {
+               kfree(soc_dev_attr->machine);
+               kfree(soc_dev_attr);
+               return NULL;
+       }
+
+       return soc_device_to_device(soc_dev);
+}
+
+struct device __init *ep93xx_init_devices(void)
+{
+       struct device *parent;
+
        /* Disallow access to MaverickCrunch initially */
        ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_CPENA);
 
@@ -937,6 +1039,8 @@ void __init ep93xx_init_devices(void)
                               EP93XX_SYSCON_DEVCFG_GONIDE |
                               EP93XX_SYSCON_DEVCFG_HONIDE);
 
+       parent = ep93xx_init_soc();
+
        /* Get the GPIO working early, other devices need it */
        platform_device_register(&ep93xx_gpio_device);
 
@@ -949,6 +1053,8 @@ void __init ep93xx_init_devices(void)
        platform_device_register(&ep93xx_wdt_device);
 
        gpio_led_register_device(-1, &ep93xx_led_data);
+
+       return parent;
 }
 
 void ep93xx_restart(enum reboot_mode mode, const char *cmd)
index e256e0baec2ec729344333d198004a637f20123f..4c0bbd97f741c7a6ab90de0260a77e9c4877fb82 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <linux/reboot.h>
 
+struct device;
 struct i2c_gpio_platform_data;
 struct i2c_board_info;
 struct spi_board_info;
@@ -54,7 +55,7 @@ void ep93xx_register_ide(void);
 int ep93xx_ide_acquire_gpio(struct platform_device *pdev);
 void ep93xx_ide_release_gpio(struct platform_device *pdev);
 
-void ep93xx_init_devices(void);
+struct device *ep93xx_init_devices(void);
 extern void ep93xx_timer_init(void);
 
 void ep93xx_restart(enum reboot_mode, const char *);
index f9d67a0acb2af170737db3aa60a0b54f1f4091dd..4c414af75ef0edf9e09f8f3a3ba91509de2e9ef8 100644 (file)
@@ -24,6 +24,7 @@ config ARCH_EXYNOS4
        select HAVE_SMP
        select MIGHT_HAVE_CACHE_L2X0
        select PINCTRL
+       select PM_GENERIC_DOMAINS if PM
        select S5P_DEV_MFC
        help
          Samsung EXYNOS4 SoCs based systems
@@ -48,7 +49,6 @@ config CPU_EXYNOS4210
        select ARCH_HAS_BANDGAP
        select ARM_CPU_SUSPEND if PM
        select PINCTRL_EXYNOS
-       select PM_GENERIC_DOMAINS if PM
        select S5P_PM if PM
        select S5P_SLEEP if PM
        select SAMSUNG_DMADEV
@@ -61,7 +61,6 @@ config SOC_EXYNOS4212
        depends on ARCH_EXYNOS4
        select ARCH_HAS_BANDGAP
        select PINCTRL_EXYNOS
-       select PM_GENERIC_DOMAINS if PM
        select S5P_PM if PM
        select S5P_SLEEP if PM
        select SAMSUNG_DMADEV
@@ -74,7 +73,6 @@ config SOC_EXYNOS4412
        depends on ARCH_EXYNOS4
        select ARCH_HAS_BANDGAP
        select PINCTRL_EXYNOS
-       select PM_GENERIC_DOMAINS if PM
        select SAMSUNG_DMADEV
        help
          Enable EXYNOS4412 SoC support
index 61d2906ccefb3660b3061bb1782576bd0a3ec78e..72ae5d3a87d2a8b0d9a4b30664d68272b69ab9b3 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 #include <linux/of_irq.h>
+#include <linux/pm_domain.h>
 #include <linux/export.h>
 #include <linux/irqdomain.h>
 #include <linux/of_address.h>
 #include <asm/mach/irq.h>
 #include <asm/cacheflush.h>
 
-#include <mach/regs-irq.h>
-#include <mach/regs-pmu.h>
-
 #include <plat/cpu.h>
 #include <plat/pm.h>
 #include <plat/regs-serial.h>
 
 #include "common.h"
+#include "regs-pmu.h"
+
 #define L2_AUX_VAL 0x7C470001
 #define L2_AUX_MASK 0xC200ffff
 
@@ -309,7 +309,7 @@ void __init exynos_init_late(void)
                /* to be supported later */
                return;
 
-       exynos_pm_late_initcall();
+       pm_genpd_poweroff_unused();
 }
 
 static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
index ff9b6a9419b01dfe1f6a0b9e0c42f6bcdaebee18..0c31b34f0de5e96475fdcdef0b7587e1b4c0b462 100644 (file)
@@ -26,12 +26,6 @@ void exynos_init_late(void);
 
 void exynos_firmware_init(void);
 
-#ifdef CONFIG_PM_GENERIC_DOMAINS
-int exynos_pm_late_initcall(void);
-#else
-static inline int exynos_pm_late_initcall(void) { return 0; }
-#endif
-
 extern struct smp_operations exynos_smp_ops;
 
 extern void exynos_cpu_die(unsigned int cpu);
index ddbfe8709fe7fe4bd43fb5f2ea3301ba1e304b63..da65b036af2b453e0750792f2dd3de75b02ea53d 100644 (file)
 #include <asm/suspend.h>
 #include <asm/unified.h>
 #include <asm/cpuidle.h>
-#include <mach/regs-clock.h>
-#include <mach/regs-pmu.h>
 
 #include <plat/cpu.h>
 #include <plat/pm.h>
 
+#include <mach/pm-core.h>
+#include <mach/map.h>
+
 #include "common.h"
+#include "regs-pmu.h"
 
 #define REG_DIRECTGO_ADDR      (samsung_rev() == EXYNOS4210_REV_1_1 ? \
                        S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
 
 #define S5P_CHECK_AFTR         0xFCBA0D10
 
+#define EXYNOS5_PWR_CTRL1                      (S5P_VA_CMU + 0x01020)
+#define EXYNOS5_PWR_CTRL2                      (S5P_VA_CMU + 0x01024)
+
+#define PWR_CTRL1_CORE2_DOWN_RATIO             (7 << 28)
+#define PWR_CTRL1_CORE1_DOWN_RATIO             (7 << 16)
+#define PWR_CTRL1_DIV2_DOWN_EN                 (1 << 9)
+#define PWR_CTRL1_DIV1_DOWN_EN                 (1 << 8)
+#define PWR_CTRL1_USE_CORE1_WFE                        (1 << 5)
+#define PWR_CTRL1_USE_CORE0_WFE                        (1 << 4)
+#define PWR_CTRL1_USE_CORE1_WFI                        (1 << 1)
+#define PWR_CTRL1_USE_CORE0_WFI                        (1 << 0)
+
+#define PWR_CTRL2_DIV2_UP_EN                   (1 << 25)
+#define PWR_CTRL2_DIV1_UP_EN                   (1 << 24)
+#define PWR_CTRL2_DUR_STANDBY2_VAL             (1 << 16)
+#define PWR_CTRL2_DUR_STANDBY1_VAL             (1 << 8)
+#define PWR_CTRL2_CORE2_UP_RATIO               (1 << 4)
+#define PWR_CTRL2_CORE1_UP_RATIO               (1 << 0)
+
 static int exynos4_enter_lowpower(struct cpuidle_device *dev,
                                struct cpuidle_driver *drv,
                                int index);
index af90cfa2f826e80f9045976a17f824a854b817a8..5eead530c6f8fa57ab8444911b19b684ef1e84fc 100644 (file)
 #include <asm/cp15.h>
 #include <asm/smp_plat.h>
 
-#include <mach/regs-pmu.h>
 #include <plat/cpu.h>
 
 #include "common.h"
+#include "regs-pmu.h"
 
 static inline void cpu_enter_lowpower_a9(void)
 {
index 2b00833b6641d862ace121280d06da577ddd4a97..dc0697c2fa927c4065248cc4fe1acc4e0ee3e9be 100644 (file)
 #define __ASM_ARCH_PM_CORE_H __FILE__
 
 #include <linux/of.h>
-#include <mach/regs-pmu.h>
+#include <mach/map.h>
+
+#define S5P_EINT_WAKEUP_MASK                   (S5P_VA_PMU + 0x0604)
+#define S5P_WAKEUP_MASK                                (S5P_VA_PMU + 0x0608)
 
 #ifdef CONFIG_PINCTRL_EXYNOS
 extern u32 exynos_get_eint_wake_mask(void);
diff --git a/arch/arm/mach-exynos/include/mach/regs-clock.h b/arch/arm/mach-exynos/include/mach/regs-clock.h
deleted file mode 100644 (file)
index d36ad76..0000000
+++ /dev/null
@@ -1,372 +0,0 @@
-/* linux/arch/arm/mach-exynos4/include/mach/regs-clock.h
- *
- * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com
- *
- * EXYNOS4 - Clock register definitions
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#ifndef __ASM_ARCH_REGS_CLOCK_H
-#define __ASM_ARCH_REGS_CLOCK_H __FILE__
-
-#include <plat/cpu.h>
-#include <mach/map.h>
-
-#define EXYNOS_CLKREG(x)                       (S5P_VA_CMU + (x))
-
-#define EXYNOS4_CLKDIV_LEFTBUS                 EXYNOS_CLKREG(0x04500)
-#define EXYNOS4_CLKDIV_STAT_LEFTBUS            EXYNOS_CLKREG(0x04600)
-#define EXYNOS4_CLKGATE_IP_LEFTBUS             EXYNOS_CLKREG(0x04800)
-
-#define EXYNOS4_CLKDIV_RIGHTBUS                        EXYNOS_CLKREG(0x08500)
-#define EXYNOS4_CLKDIV_STAT_RIGHTBUS           EXYNOS_CLKREG(0x08600)
-#define EXYNOS4_CLKGATE_IP_RIGHTBUS            EXYNOS_CLKREG(0x08800)
-
-#define EXYNOS4_EPLL_LOCK                      EXYNOS_CLKREG(0x0C010)
-#define EXYNOS4_VPLL_LOCK                      EXYNOS_CLKREG(0x0C020)
-
-#define EXYNOS4_EPLL_CON0                      EXYNOS_CLKREG(0x0C110)
-#define EXYNOS4_EPLL_CON1                      EXYNOS_CLKREG(0x0C114)
-#define EXYNOS4_VPLL_CON0                      EXYNOS_CLKREG(0x0C120)
-#define EXYNOS4_VPLL_CON1                      EXYNOS_CLKREG(0x0C124)
-
-#define EXYNOS4_CLKSRC_TOP0                    EXYNOS_CLKREG(0x0C210)
-#define EXYNOS4_CLKSRC_TOP1                    EXYNOS_CLKREG(0x0C214)
-#define EXYNOS4_CLKSRC_CAM                     EXYNOS_CLKREG(0x0C220)
-#define EXYNOS4_CLKSRC_TV                      EXYNOS_CLKREG(0x0C224)
-#define EXYNOS4_CLKSRC_MFC                     EXYNOS_CLKREG(0x0C228)
-#define EXYNOS4_CLKSRC_G3D                     EXYNOS_CLKREG(0x0C22C)
-#define EXYNOS4_CLKSRC_IMAGE                   EXYNOS_CLKREG(0x0C230)
-#define EXYNOS4_CLKSRC_LCD0                    EXYNOS_CLKREG(0x0C234)
-#define EXYNOS4_CLKSRC_MAUDIO                  EXYNOS_CLKREG(0x0C23C)
-#define EXYNOS4_CLKSRC_FSYS                    EXYNOS_CLKREG(0x0C240)
-#define EXYNOS4_CLKSRC_PERIL0                  EXYNOS_CLKREG(0x0C250)
-#define EXYNOS4_CLKSRC_PERIL1                  EXYNOS_CLKREG(0x0C254)
-
-#define EXYNOS4_CLKSRC_MASK_TOP                        EXYNOS_CLKREG(0x0C310)
-#define EXYNOS4_CLKSRC_MASK_CAM                        EXYNOS_CLKREG(0x0C320)
-#define EXYNOS4_CLKSRC_MASK_TV                 EXYNOS_CLKREG(0x0C324)
-#define EXYNOS4_CLKSRC_MASK_LCD0               EXYNOS_CLKREG(0x0C334)
-#define EXYNOS4_CLKSRC_MASK_MAUDIO             EXYNOS_CLKREG(0x0C33C)
-#define EXYNOS4_CLKSRC_MASK_FSYS               EXYNOS_CLKREG(0x0C340)
-#define EXYNOS4_CLKSRC_MASK_PERIL0             EXYNOS_CLKREG(0x0C350)
-#define EXYNOS4_CLKSRC_MASK_PERIL1             EXYNOS_CLKREG(0x0C354)
-
-#define EXYNOS4_CLKDIV_TOP                     EXYNOS_CLKREG(0x0C510)
-#define EXYNOS4_CLKDIV_CAM                     EXYNOS_CLKREG(0x0C520)
-#define EXYNOS4_CLKDIV_TV                      EXYNOS_CLKREG(0x0C524)
-#define EXYNOS4_CLKDIV_MFC                     EXYNOS_CLKREG(0x0C528)
-#define EXYNOS4_CLKDIV_G3D                     EXYNOS_CLKREG(0x0C52C)
-#define EXYNOS4_CLKDIV_IMAGE                   EXYNOS_CLKREG(0x0C530)
-#define EXYNOS4_CLKDIV_LCD0                    EXYNOS_CLKREG(0x0C534)
-#define EXYNOS4_CLKDIV_MAUDIO                  EXYNOS_CLKREG(0x0C53C)
-#define EXYNOS4_CLKDIV_FSYS0                   EXYNOS_CLKREG(0x0C540)
-#define EXYNOS4_CLKDIV_FSYS1                   EXYNOS_CLKREG(0x0C544)
-#define EXYNOS4_CLKDIV_FSYS2                   EXYNOS_CLKREG(0x0C548)
-#define EXYNOS4_CLKDIV_FSYS3                   EXYNOS_CLKREG(0x0C54C)
-#define EXYNOS4_CLKDIV_PERIL0                  EXYNOS_CLKREG(0x0C550)
-#define EXYNOS4_CLKDIV_PERIL1                  EXYNOS_CLKREG(0x0C554)
-#define EXYNOS4_CLKDIV_PERIL2                  EXYNOS_CLKREG(0x0C558)
-#define EXYNOS4_CLKDIV_PERIL3                  EXYNOS_CLKREG(0x0C55C)
-#define EXYNOS4_CLKDIV_PERIL4                  EXYNOS_CLKREG(0x0C560)
-#define EXYNOS4_CLKDIV_PERIL5                  EXYNOS_CLKREG(0x0C564)
-#define EXYNOS4_CLKDIV2_RATIO                  EXYNOS_CLKREG(0x0C580)
-
-#define EXYNOS4_CLKDIV_STAT_TOP                        EXYNOS_CLKREG(0x0C610)
-#define EXYNOS4_CLKDIV_STAT_MFC                        EXYNOS_CLKREG(0x0C628)
-
-#define EXYNOS4_CLKGATE_SCLKCAM                        EXYNOS_CLKREG(0x0C820)
-#define EXYNOS4_CLKGATE_IP_CAM                 EXYNOS_CLKREG(0x0C920)
-#define EXYNOS4_CLKGATE_IP_TV                  EXYNOS_CLKREG(0x0C924)
-#define EXYNOS4_CLKGATE_IP_MFC                 EXYNOS_CLKREG(0x0C928)
-#define EXYNOS4_CLKGATE_IP_G3D                 EXYNOS_CLKREG(0x0C92C)
-#define EXYNOS4_CLKGATE_IP_IMAGE               (soc_is_exynos4210() ? \
-                                               EXYNOS_CLKREG(0x0C930) : \
-                                               EXYNOS_CLKREG(0x04930))
-#define EXYNOS4210_CLKGATE_IP_IMAGE            EXYNOS_CLKREG(0x0C930)
-#define EXYNOS4212_CLKGATE_IP_IMAGE            EXYNOS_CLKREG(0x04930)
-#define EXYNOS4_CLKGATE_IP_LCD0                        EXYNOS_CLKREG(0x0C934)
-#define EXYNOS4_CLKGATE_IP_FSYS                        EXYNOS_CLKREG(0x0C940)
-#define EXYNOS4_CLKGATE_IP_GPS                 EXYNOS_CLKREG(0x0C94C)
-#define EXYNOS4_CLKGATE_IP_PERIL               EXYNOS_CLKREG(0x0C950)
-#define EXYNOS4_CLKGATE_IP_PERIR               (soc_is_exynos4210() ? \
-                                               EXYNOS_CLKREG(0x0C960) : \
-                                               EXYNOS_CLKREG(0x08960))
-#define EXYNOS4210_CLKGATE_IP_PERIR            EXYNOS_CLKREG(0x0C960)
-#define EXYNOS4212_CLKGATE_IP_PERIR            EXYNOS_CLKREG(0x08960)
-#define EXYNOS4_CLKGATE_BLOCK                  EXYNOS_CLKREG(0x0C970)
-
-#define EXYNOS4_CLKSRC_MASK_DMC                        EXYNOS_CLKREG(0x10300)
-#define EXYNOS4_CLKSRC_DMC                     EXYNOS_CLKREG(0x10200)
-#define EXYNOS4_CLKDIV_DMC0                    EXYNOS_CLKREG(0x10500)
-#define EXYNOS4_CLKDIV_DMC1                    EXYNOS_CLKREG(0x10504)
-#define EXYNOS4_CLKDIV_STAT_DMC0               EXYNOS_CLKREG(0x10600)
-#define EXYNOS4_CLKDIV_STAT_DMC1               EXYNOS_CLKREG(0x10604)
-#define EXYNOS4_CLKGATE_IP_DMC                 EXYNOS_CLKREG(0x10900)
-
-#define EXYNOS4_DMC_PAUSE_CTRL                 EXYNOS_CLKREG(0x11094)
-#define EXYNOS4_DMC_PAUSE_ENABLE               (1 << 0)
-
-#define EXYNOS4_APLL_LOCK                      EXYNOS_CLKREG(0x14000)
-#define EXYNOS4_MPLL_LOCK                      (soc_is_exynos4210() ? \
-                                               EXYNOS_CLKREG(0x14004) :  \
-                                               EXYNOS_CLKREG(0x10008))
-#define EXYNOS4_APLL_CON0                      EXYNOS_CLKREG(0x14100)
-#define EXYNOS4_APLL_CON1                      EXYNOS_CLKREG(0x14104)
-#define EXYNOS4_MPLL_CON0                      (soc_is_exynos4210() ? \
-                                               EXYNOS_CLKREG(0x14108) : \
-                                               EXYNOS_CLKREG(0x10108))
-#define EXYNOS4_MPLL_CON1                      (soc_is_exynos4210() ? \
-                                               EXYNOS_CLKREG(0x1410C) : \
-                                               EXYNOS_CLKREG(0x1010C))
-
-#define EXYNOS4_CLKSRC_CPU                     EXYNOS_CLKREG(0x14200)
-#define EXYNOS4_CLKMUX_STATCPU                 EXYNOS_CLKREG(0x14400)
-
-#define EXYNOS4_CLKDIV_CPU                     EXYNOS_CLKREG(0x14500)
-#define EXYNOS4_CLKDIV_CPU1                    EXYNOS_CLKREG(0x14504)
-#define EXYNOS4_CLKDIV_STATCPU                 EXYNOS_CLKREG(0x14600)
-#define EXYNOS4_CLKDIV_STATCPU1                        EXYNOS_CLKREG(0x14604)
-
-#define EXYNOS4_CLKGATE_SCLKCPU                        EXYNOS_CLKREG(0x14800)
-#define EXYNOS4_CLKGATE_IP_CPU                 EXYNOS_CLKREG(0x14900)
-
-#define EXYNOS4_CLKGATE_IP_ISP0                        EXYNOS_CLKREG(0x18800)
-#define EXYNOS4_CLKGATE_IP_ISP1                        EXYNOS_CLKREG(0x18804)
-
-#define EXYNOS4_APLL_LOCKTIME                  (0x1C20)        /* 300us */
-
-#define EXYNOS4_APLLCON0_ENABLE_SHIFT          (31)
-#define EXYNOS4_APLLCON0_LOCKED_SHIFT          (29)
-#define EXYNOS4_APLL_VAL_1000                  ((250 << 16) | (6 << 8) | 1)
-#define EXYNOS4_APLL_VAL_800                   ((200 << 16) | (6 << 8) | 1)
-
-#define EXYNOS4_EPLLCON0_ENABLE_SHIFT          (31)
-#define EXYNOS4_EPLLCON0_LOCKED_SHIFT          (29)
-
-#define EXYNOS4_VPLLCON0_ENABLE_SHIFT          (31)
-#define EXYNOS4_VPLLCON0_LOCKED_SHIFT          (29)
-
-#define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT       (16)
-#define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK    (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)
-
-#define EXYNOS4_CLKDIV_CPU0_CORE_SHIFT         (0)
-#define EXYNOS4_CLKDIV_CPU0_CORE_MASK          (0x7 << EXYNOS4_CLKDIV_CPU0_CORE_SHIFT)
-#define EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT       (4)
-#define EXYNOS4_CLKDIV_CPU0_COREM0_MASK                (0x7 << EXYNOS4_CLKDIV_CPU0_COREM0_SHIFT)
-#define EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT       (8)
-#define EXYNOS4_CLKDIV_CPU0_COREM1_MASK                (0x7 << EXYNOS4_CLKDIV_CPU0_COREM1_SHIFT)
-#define EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT       (12)
-#define EXYNOS4_CLKDIV_CPU0_PERIPH_MASK                (0x7 << EXYNOS4_CLKDIV_CPU0_PERIPH_SHIFT)
-#define EXYNOS4_CLKDIV_CPU0_ATB_SHIFT          (16)
-#define EXYNOS4_CLKDIV_CPU0_ATB_MASK           (0x7 << EXYNOS4_CLKDIV_CPU0_ATB_SHIFT)
-#define EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT      (20)
-#define EXYNOS4_CLKDIV_CPU0_PCLKDBG_MASK       (0x7 << EXYNOS4_CLKDIV_CPU0_PCLKDBG_SHIFT)
-#define EXYNOS4_CLKDIV_CPU0_APLL_SHIFT         (24)
-#define EXYNOS4_CLKDIV_CPU0_APLL_MASK          (0x7 << EXYNOS4_CLKDIV_CPU0_APLL_SHIFT)
-#define EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT                28
-#define EXYNOS4_CLKDIV_CPU0_CORE2_MASK         (0x7 << EXYNOS4_CLKDIV_CPU0_CORE2_SHIFT)
-
-#define EXYNOS4_CLKDIV_CPU1_COPY_SHIFT         0
-#define EXYNOS4_CLKDIV_CPU1_COPY_MASK          (0x7 << EXYNOS4_CLKDIV_CPU1_COPY_SHIFT)
-#define EXYNOS4_CLKDIV_CPU1_HPM_SHIFT          4
-#define EXYNOS4_CLKDIV_CPU1_HPM_MASK           (0x7 << EXYNOS4_CLKDIV_CPU1_HPM_SHIFT)
-#define EXYNOS4_CLKDIV_CPU1_CORES_SHIFT                8
-#define EXYNOS4_CLKDIV_CPU1_CORES_MASK         (0x7 << EXYNOS4_CLKDIV_CPU1_CORES_SHIFT)
-
-#define EXYNOS4_CLKDIV_DMC0_ACP_SHIFT          (0)
-#define EXYNOS4_CLKDIV_DMC0_ACP_MASK           (0x7 << EXYNOS4_CLKDIV_DMC0_ACP_SHIFT)
-#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT      (4)
-#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK       (0x7 << EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT)
-#define EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT         (8)
-#define EXYNOS4_CLKDIV_DMC0_DPHY_MASK          (0x7 << EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT)
-#define EXYNOS4_CLKDIV_DMC0_DMC_SHIFT          (12)
-#define EXYNOS4_CLKDIV_DMC0_DMC_MASK           (0x7 << EXYNOS4_CLKDIV_DMC0_DMC_SHIFT)
-#define EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT         (16)
-#define EXYNOS4_CLKDIV_DMC0_DMCD_MASK          (0x7 << EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT)
-#define EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT         (20)
-#define EXYNOS4_CLKDIV_DMC0_DMCP_MASK          (0x7 << EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT)
-#define EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT                (24)
-#define EXYNOS4_CLKDIV_DMC0_COPY2_MASK         (0x7 << EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT)
-#define EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT       (28)
-#define EXYNOS4_CLKDIV_DMC0_CORETI_MASK                (0x7 << EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT)
-
-#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT      (0)
-#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_MASK       (0xf << EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT)
-#define EXYNOS4_CLKDIV_DMC1_C2C_SHIFT          (4)
-#define EXYNOS4_CLKDIV_DMC1_C2C_MASK           (0x7 << EXYNOS4_CLKDIV_DMC1_C2C_SHIFT)
-#define EXYNOS4_CLKDIV_DMC1_PWI_SHIFT          (8)
-#define EXYNOS4_CLKDIV_DMC1_PWI_MASK           (0xf << EXYNOS4_CLKDIV_DMC1_PWI_SHIFT)
-#define EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT      (12)
-#define EXYNOS4_CLKDIV_DMC1_C2CACLK_MASK       (0x7 << EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT)
-#define EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT                (16)
-#define EXYNOS4_CLKDIV_DMC1_DVSEM_MASK         (0x7f << EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT)
-#define EXYNOS4_CLKDIV_DMC1_DPM_SHIFT          (24)
-#define EXYNOS4_CLKDIV_DMC1_DPM_MASK           (0x7f << EXYNOS4_CLKDIV_DMC1_DPM_SHIFT)
-
-#define EXYNOS4_CLKDIV_MFC_SHIFT               (0)
-#define EXYNOS4_CLKDIV_MFC_MASK                        (0x7 << EXYNOS4_CLKDIV_MFC_SHIFT)
-
-#define EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT       (0)
-#define EXYNOS4_CLKDIV_TOP_ACLK200_MASK                (0x7 << EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT)
-#define EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT       (4)
-#define EXYNOS4_CLKDIV_TOP_ACLK100_MASK                (0xF << EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT)
-#define EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT       (8)
-#define EXYNOS4_CLKDIV_TOP_ACLK160_MASK                (0x7 << EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT)
-#define EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT       (12)
-#define EXYNOS4_CLKDIV_TOP_ACLK133_MASK                (0x7 << EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT)
-#define EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT       (16)
-#define EXYNOS4_CLKDIV_TOP_ONENAND_MASK                (0x7 << EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT)
-#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT   (20)
-#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_MASK    (0x7 << EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT)
-#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT        (24)
-#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT)
-
-#define EXYNOS4_CLKDIV_BUS_GDLR_SHIFT          (0)
-#define EXYNOS4_CLKDIV_BUS_GDLR_MASK           (0x7 << EXYNOS4_CLKDIV_BUS_GDLR_SHIFT)
-#define EXYNOS4_CLKDIV_BUS_GPLR_SHIFT          (4)
-#define EXYNOS4_CLKDIV_BUS_GPLR_MASK           (0x7 << EXYNOS4_CLKDIV_BUS_GPLR_SHIFT)
-
-#define EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT         (0)
-#define EXYNOS4_CLKDIV_CAM_FIMC0_MASK          (0xf << EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT)
-#define EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT         (4)
-#define EXYNOS4_CLKDIV_CAM_FIMC1_MASK          (0xf << EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT)
-#define EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT         (8)
-#define EXYNOS4_CLKDIV_CAM_FIMC2_MASK          (0xf << EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT)
-#define EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT         (12)
-#define EXYNOS4_CLKDIV_CAM_FIMC3_MASK          (0xf << EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT)
-
-/* Only for EXYNOS4210 */
-
-#define EXYNOS4210_CLKSRC_LCD1                 EXYNOS_CLKREG(0x0C238)
-#define EXYNOS4210_CLKSRC_MASK_LCD1            EXYNOS_CLKREG(0x0C338)
-#define EXYNOS4210_CLKDIV_LCD1                 EXYNOS_CLKREG(0x0C538)
-#define EXYNOS4210_CLKGATE_IP_LCD1             EXYNOS_CLKREG(0x0C938)
-
-/* Only for EXYNOS4212 */
-
-#define EXYNOS4_CLKDIV_CAM1                    EXYNOS_CLKREG(0x0C568)
-
-#define EXYNOS4_CLKDIV_STAT_CAM1               EXYNOS_CLKREG(0x0C668)
-
-#define EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT         (0)
-#define EXYNOS4_CLKDIV_CAM1_JPEG_MASK          (0xf << EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT)
-
-/* For EXYNOS5250 */
-
-#define EXYNOS5_APLL_LOCK                      EXYNOS_CLKREG(0x00000)
-#define EXYNOS5_APLL_CON0                      EXYNOS_CLKREG(0x00100)
-#define EXYNOS5_CLKSRC_CPU                     EXYNOS_CLKREG(0x00200)
-#define EXYNOS5_CLKMUX_STATCPU                 EXYNOS_CLKREG(0x00400)
-#define EXYNOS5_CLKDIV_CPU0                    EXYNOS_CLKREG(0x00500)
-#define EXYNOS5_CLKDIV_CPU1                    EXYNOS_CLKREG(0x00504)
-#define EXYNOS5_CLKDIV_STATCPU0                        EXYNOS_CLKREG(0x00600)
-#define EXYNOS5_CLKDIV_STATCPU1                        EXYNOS_CLKREG(0x00604)
-
-#define EXYNOS5_PWR_CTRL1                      EXYNOS_CLKREG(0x01020)
-#define EXYNOS5_PWR_CTRL2                      EXYNOS_CLKREG(0x01024)
-
-#define EXYNOS5_MPLL_CON0                      EXYNOS_CLKREG(0x04100)
-#define EXYNOS5_CLKSRC_CORE1                   EXYNOS_CLKREG(0x04204)
-
-#define EXYNOS5_CLKGATE_IP_CORE                        EXYNOS_CLKREG(0x04900)
-
-#define EXYNOS5_CLKDIV_ACP                     EXYNOS_CLKREG(0x08500)
-
-#define EXYNOS5_EPLL_CON0                      EXYNOS_CLKREG(0x10130)
-#define EXYNOS5_EPLL_CON1                      EXYNOS_CLKREG(0x10134)
-#define EXYNOS5_EPLL_CON2                      EXYNOS_CLKREG(0x10138)
-#define EXYNOS5_VPLL_CON0                      EXYNOS_CLKREG(0x10140)
-#define EXYNOS5_VPLL_CON1                      EXYNOS_CLKREG(0x10144)
-#define EXYNOS5_VPLL_CON2                      EXYNOS_CLKREG(0x10148)
-#define EXYNOS5_CPLL_CON0                      EXYNOS_CLKREG(0x10120)
-
-#define EXYNOS5_CLKSRC_TOP0                    EXYNOS_CLKREG(0x10210)
-#define EXYNOS5_CLKSRC_TOP1                    EXYNOS_CLKREG(0x10214)
-#define EXYNOS5_CLKSRC_TOP2                    EXYNOS_CLKREG(0x10218)
-#define EXYNOS5_CLKSRC_TOP3                    EXYNOS_CLKREG(0x1021C)
-#define EXYNOS5_CLKSRC_GSCL                    EXYNOS_CLKREG(0x10220)
-#define EXYNOS5_CLKSRC_DISP1_0                 EXYNOS_CLKREG(0x1022C)
-#define EXYNOS5_CLKSRC_MAUDIO                  EXYNOS_CLKREG(0x10240)
-#define EXYNOS5_CLKSRC_FSYS                    EXYNOS_CLKREG(0x10244)
-#define EXYNOS5_CLKSRC_PERIC0                  EXYNOS_CLKREG(0x10250)
-#define EXYNOS5_CLKSRC_PERIC1                  EXYNOS_CLKREG(0x10254)
-#define EXYNOS5_SCLK_SRC_ISP                   EXYNOS_CLKREG(0x10270)
-
-#define EXYNOS5_CLKSRC_MASK_TOP                        EXYNOS_CLKREG(0x10310)
-#define EXYNOS5_CLKSRC_MASK_GSCL               EXYNOS_CLKREG(0x10320)
-#define EXYNOS5_CLKSRC_MASK_DISP1_0            EXYNOS_CLKREG(0x1032C)
-#define EXYNOS5_CLKSRC_MASK_MAUDIO             EXYNOS_CLKREG(0x10334)
-#define EXYNOS5_CLKSRC_MASK_FSYS               EXYNOS_CLKREG(0x10340)
-#define EXYNOS5_CLKSRC_MASK_PERIC0             EXYNOS_CLKREG(0x10350)
-#define EXYNOS5_CLKSRC_MASK_PERIC1             EXYNOS_CLKREG(0x10354)
-
-#define EXYNOS5_CLKDIV_TOP0                    EXYNOS_CLKREG(0x10510)
-#define EXYNOS5_CLKDIV_TOP1                    EXYNOS_CLKREG(0x10514)
-#define EXYNOS5_CLKDIV_GSCL                    EXYNOS_CLKREG(0x10520)
-#define EXYNOS5_CLKDIV_DISP1_0                 EXYNOS_CLKREG(0x1052C)
-#define EXYNOS5_CLKDIV_GEN                     EXYNOS_CLKREG(0x1053C)
-#define EXYNOS5_CLKDIV_MAUDIO                  EXYNOS_CLKREG(0x10544)
-#define EXYNOS5_CLKDIV_FSYS0                   EXYNOS_CLKREG(0x10548)
-#define EXYNOS5_CLKDIV_FSYS1                   EXYNOS_CLKREG(0x1054C)
-#define EXYNOS5_CLKDIV_FSYS2                   EXYNOS_CLKREG(0x10550)
-#define EXYNOS5_CLKDIV_FSYS3                   EXYNOS_CLKREG(0x10554)
-#define EXYNOS5_CLKDIV_PERIC0                  EXYNOS_CLKREG(0x10558)
-#define EXYNOS5_CLKDIV_PERIC1                  EXYNOS_CLKREG(0x1055C)
-#define EXYNOS5_CLKDIV_PERIC2                  EXYNOS_CLKREG(0x10560)
-#define EXYNOS5_CLKDIV_PERIC3                  EXYNOS_CLKREG(0x10564)
-#define EXYNOS5_CLKDIV_PERIC4                  EXYNOS_CLKREG(0x10568)
-#define EXYNOS5_CLKDIV_PERIC5                  EXYNOS_CLKREG(0x1056C)
-#define EXYNOS5_SCLK_DIV_ISP                   EXYNOS_CLKREG(0x10580)
-
-#define EXYNOS5_CLKGATE_IP_ACP                 EXYNOS_CLKREG(0x08800)
-#define EXYNOS5_CLKGATE_IP_ISP0                        EXYNOS_CLKREG(0x0C800)
-#define EXYNOS5_CLKGATE_IP_ISP1                        EXYNOS_CLKREG(0x0C804)
-#define EXYNOS5_CLKGATE_IP_GSCL                        EXYNOS_CLKREG(0x10920)
-#define EXYNOS5_CLKGATE_IP_DISP1               EXYNOS_CLKREG(0x10928)
-#define EXYNOS5_CLKGATE_IP_MFC                 EXYNOS_CLKREG(0x1092C)
-#define EXYNOS5_CLKGATE_IP_G3D                 EXYNOS_CLKREG(0x10930)
-#define EXYNOS5_CLKGATE_IP_GEN                 EXYNOS_CLKREG(0x10934)
-#define EXYNOS5_CLKGATE_IP_FSYS                        EXYNOS_CLKREG(0x10944)
-#define EXYNOS5_CLKGATE_IP_GPS                 EXYNOS_CLKREG(0x1094C)
-#define EXYNOS5_CLKGATE_IP_PERIC               EXYNOS_CLKREG(0x10950)
-#define EXYNOS5_CLKGATE_IP_PERIS               EXYNOS_CLKREG(0x10960)
-#define EXYNOS5_CLKGATE_BLOCK                  EXYNOS_CLKREG(0x10980)
-
-#define EXYNOS5_BPLL_CON0                      EXYNOS_CLKREG(0x20110)
-#define EXYNOS5_CLKSRC_CDREX                   EXYNOS_CLKREG(0x20200)
-#define EXYNOS5_CLKDIV_CDREX                   EXYNOS_CLKREG(0x20500)
-
-#define EXYNOS5_PLL_DIV2_SEL                   EXYNOS_CLKREG(0x20A24)
-
-#define EXYNOS5_EPLL_LOCK                      EXYNOS_CLKREG(0x10030)
-
-#define EXYNOS5_EPLLCON0_LOCKED_SHIFT          (29)
-
-#define PWR_CTRL1_CORE2_DOWN_RATIO             (7 << 28)
-#define PWR_CTRL1_CORE1_DOWN_RATIO             (7 << 16)
-#define PWR_CTRL1_DIV2_DOWN_EN                 (1 << 9)
-#define PWR_CTRL1_DIV1_DOWN_EN                 (1 << 8)
-#define PWR_CTRL1_USE_CORE1_WFE                        (1 << 5)
-#define PWR_CTRL1_USE_CORE0_WFE                        (1 << 4)
-#define PWR_CTRL1_USE_CORE1_WFI                        (1 << 1)
-#define PWR_CTRL1_USE_CORE0_WFI                        (1 << 0)
-
-#define PWR_CTRL2_DIV2_UP_EN                   (1 << 25)
-#define PWR_CTRL2_DIV1_UP_EN                   (1 << 24)
-#define PWR_CTRL2_DUR_STANDBY2_VAL             (1 << 16)
-#define PWR_CTRL2_DUR_STANDBY1_VAL             (1 << 8)
-#define PWR_CTRL2_CORE2_UP_RATIO               (1 << 4)
-#define PWR_CTRL2_CORE1_UP_RATIO               (1 << 0)
-
-/* Compatibility defines and inclusion */
-
-#include <mach/regs-pmu.h>
-
-#define S5P_EPLL_CON                           EXYNOS4_EPLL_CON0
-
-#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-irq.h b/arch/arm/mach-exynos/include/mach/regs-irq.h
deleted file mode 100644 (file)
index f2b5050..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* linux/arch/arm/mach-exynos4/include/mach/regs-irq.h
- *
- * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com
- *
- * EXYNOS4 - IRQ register definitions
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#ifndef __ASM_ARCH_REGS_IRQ_H
-#define __ASM_ARCH_REGS_IRQ_H __FILE__
-
-#include <linux/irqchip/arm-gic.h>
-#include <mach/map.h>
-
-#endif /* __ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h
deleted file mode 100644 (file)
index 2cdb63e..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
- *             http://www.samsung.com
- *
- * EXYNOS - Power management unit definition
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#ifndef __ASM_ARCH_REGS_PMU_H
-#define __ASM_ARCH_REGS_PMU_H __FILE__
-
-#include <mach/map.h>
-
-#define S5P_PMUREG(x)                          (S5P_VA_PMU + (x))
-#define S5P_SYSREG(x)                          (S3C_VA_SYS + (x))
-
-#define S5P_CENTRAL_SEQ_CONFIGURATION          S5P_PMUREG(0x0200)
-
-#define S5P_CENTRAL_LOWPWR_CFG                 (1 << 16)
-
-#define S5P_CENTRAL_SEQ_OPTION                 S5P_PMUREG(0x0208)
-
-#define S5P_USE_STANDBY_WFI0                   (1 << 16)
-#define S5P_USE_STANDBY_WFI1                   (1 << 17)
-#define S5P_USE_STANDBYWFI_ISP_ARM             (1 << 18)
-#define S5P_USE_STANDBY_WFE0                   (1 << 24)
-#define S5P_USE_STANDBY_WFE1                   (1 << 25)
-#define S5P_USE_STANDBYWFE_ISP_ARM             (1 << 26)
-
-#define S5P_SWRESET                            S5P_PMUREG(0x0400)
-#define EXYNOS_SWRESET                         S5P_PMUREG(0x0400)
-#define EXYNOS5440_SWRESET                     S5P_PMUREG(0x00C4)
-
-#define S5P_WAKEUP_STAT                                S5P_PMUREG(0x0600)
-#define S5P_EINT_WAKEUP_MASK                   S5P_PMUREG(0x0604)
-#define S5P_WAKEUP_MASK                                S5P_PMUREG(0x0608)
-
-#define S5P_HDMI_PHY_CONTROL                   S5P_PMUREG(0x0700)
-#define S5P_HDMI_PHY_ENABLE                    (1 << 0)
-
-#define S5P_DAC_PHY_CONTROL                    S5P_PMUREG(0x070C)
-#define S5P_DAC_PHY_ENABLE                     (1 << 0)
-
-#define S5P_INFORM0                            S5P_PMUREG(0x0800)
-#define S5P_INFORM1                            S5P_PMUREG(0x0804)
-#define S5P_INFORM2                            S5P_PMUREG(0x0808)
-#define S5P_INFORM3                            S5P_PMUREG(0x080C)
-#define S5P_INFORM4                            S5P_PMUREG(0x0810)
-#define S5P_INFORM5                            S5P_PMUREG(0x0814)
-#define S5P_INFORM6                            S5P_PMUREG(0x0818)
-#define S5P_INFORM7                            S5P_PMUREG(0x081C)
-
-#define S5P_ARM_CORE0_LOWPWR                   S5P_PMUREG(0x1000)
-#define S5P_DIS_IRQ_CORE0                      S5P_PMUREG(0x1004)
-#define S5P_DIS_IRQ_CENTRAL0                   S5P_PMUREG(0x1008)
-#define S5P_ARM_CORE1_LOWPWR                   S5P_PMUREG(0x1010)
-#define S5P_DIS_IRQ_CORE1                      S5P_PMUREG(0x1014)
-#define S5P_DIS_IRQ_CENTRAL1                   S5P_PMUREG(0x1018)
-#define S5P_ARM_COMMON_LOWPWR                  S5P_PMUREG(0x1080)
-#define S5P_L2_0_LOWPWR                                S5P_PMUREG(0x10C0)
-#define S5P_L2_1_LOWPWR                                S5P_PMUREG(0x10C4)
-#define S5P_CMU_ACLKSTOP_LOWPWR                        S5P_PMUREG(0x1100)
-#define S5P_CMU_SCLKSTOP_LOWPWR                        S5P_PMUREG(0x1104)
-#define S5P_CMU_RESET_LOWPWR                   S5P_PMUREG(0x110C)
-#define S5P_APLL_SYSCLK_LOWPWR                 S5P_PMUREG(0x1120)
-#define S5P_MPLL_SYSCLK_LOWPWR                 S5P_PMUREG(0x1124)
-#define S5P_VPLL_SYSCLK_LOWPWR                 S5P_PMUREG(0x1128)
-#define S5P_EPLL_SYSCLK_LOWPWR                 S5P_PMUREG(0x112C)
-#define S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR       S5P_PMUREG(0x1138)
-#define S5P_CMU_RESET_GPSALIVE_LOWPWR          S5P_PMUREG(0x113C)
-#define S5P_CMU_CLKSTOP_CAM_LOWPWR             S5P_PMUREG(0x1140)
-#define S5P_CMU_CLKSTOP_TV_LOWPWR              S5P_PMUREG(0x1144)
-#define S5P_CMU_CLKSTOP_MFC_LOWPWR             S5P_PMUREG(0x1148)
-#define S5P_CMU_CLKSTOP_G3D_LOWPWR             S5P_PMUREG(0x114C)
-#define S5P_CMU_CLKSTOP_LCD0_LOWPWR            S5P_PMUREG(0x1150)
-#define S5P_CMU_CLKSTOP_MAUDIO_LOWPWR          S5P_PMUREG(0x1158)
-#define S5P_CMU_CLKSTOP_GPS_LOWPWR             S5P_PMUREG(0x115C)
-#define S5P_CMU_RESET_CAM_LOWPWR               S5P_PMUREG(0x1160)
-#define S5P_CMU_RESET_TV_LOWPWR                        S5P_PMUREG(0x1164)
-#define S5P_CMU_RESET_MFC_LOWPWR               S5P_PMUREG(0x1168)
-#define S5P_CMU_RESET_G3D_LOWPWR               S5P_PMUREG(0x116C)
-#define S5P_CMU_RESET_LCD0_LOWPWR              S5P_PMUREG(0x1170)
-#define S5P_CMU_RESET_MAUDIO_LOWPWR            S5P_PMUREG(0x1178)
-#define S5P_CMU_RESET_GPS_LOWPWR               S5P_PMUREG(0x117C)
-#define S5P_TOP_BUS_LOWPWR                     S5P_PMUREG(0x1180)
-#define S5P_TOP_RETENTION_LOWPWR               S5P_PMUREG(0x1184)
-#define S5P_TOP_PWR_LOWPWR                     S5P_PMUREG(0x1188)
-#define S5P_LOGIC_RESET_LOWPWR                 S5P_PMUREG(0x11A0)
-#define S5P_ONENAND_MEM_LOWPWR                 S5P_PMUREG(0x11C0)
-#define S5P_G2D_ACP_MEM_LOWPWR                 S5P_PMUREG(0x11C8)
-#define S5P_USBOTG_MEM_LOWPWR                  S5P_PMUREG(0x11CC)
-#define S5P_HSMMC_MEM_LOWPWR                   S5P_PMUREG(0x11D0)
-#define S5P_CSSYS_MEM_LOWPWR                   S5P_PMUREG(0x11D4)
-#define S5P_SECSS_MEM_LOWPWR                   S5P_PMUREG(0x11D8)
-#define S5P_PAD_RETENTION_DRAM_LOWPWR          S5P_PMUREG(0x1200)
-#define S5P_PAD_RETENTION_MAUDIO_LOWPWR                S5P_PMUREG(0x1204)
-#define S5P_PAD_RETENTION_GPIO_LOWPWR          S5P_PMUREG(0x1220)
-#define S5P_PAD_RETENTION_UART_LOWPWR          S5P_PMUREG(0x1224)
-#define S5P_PAD_RETENTION_MMCA_LOWPWR          S5P_PMUREG(0x1228)
-#define S5P_PAD_RETENTION_MMCB_LOWPWR          S5P_PMUREG(0x122C)
-#define S5P_PAD_RETENTION_EBIA_LOWPWR          S5P_PMUREG(0x1230)
-#define S5P_PAD_RETENTION_EBIB_LOWPWR          S5P_PMUREG(0x1234)
-#define S5P_PAD_RETENTION_ISOLATION_LOWPWR     S5P_PMUREG(0x1240)
-#define S5P_PAD_RETENTION_ALV_SEL_LOWPWR       S5P_PMUREG(0x1260)
-#define S5P_XUSBXTI_LOWPWR                     S5P_PMUREG(0x1280)
-#define S5P_XXTI_LOWPWR                                S5P_PMUREG(0x1284)
-#define S5P_EXT_REGULATOR_LOWPWR               S5P_PMUREG(0x12C0)
-#define S5P_GPIO_MODE_LOWPWR                   S5P_PMUREG(0x1300)
-#define S5P_GPIO_MODE_MAUDIO_LOWPWR            S5P_PMUREG(0x1340)
-#define S5P_CAM_LOWPWR                         S5P_PMUREG(0x1380)
-#define S5P_TV_LOWPWR                          S5P_PMUREG(0x1384)
-#define S5P_MFC_LOWPWR                         S5P_PMUREG(0x1388)
-#define S5P_G3D_LOWPWR                         S5P_PMUREG(0x138C)
-#define S5P_LCD0_LOWPWR                                S5P_PMUREG(0x1390)
-#define S5P_MAUDIO_LOWPWR                      S5P_PMUREG(0x1398)
-#define S5P_GPS_LOWPWR                         S5P_PMUREG(0x139C)
-#define S5P_GPS_ALIVE_LOWPWR                   S5P_PMUREG(0x13A0)
-
-#define S5P_ARM_CORE0_CONFIGURATION            S5P_PMUREG(0x2000)
-#define S5P_ARM_CORE0_OPTION                   S5P_PMUREG(0x2008)
-#define S5P_ARM_CORE1_CONFIGURATION            S5P_PMUREG(0x2080)
-#define S5P_ARM_CORE1_STATUS                   S5P_PMUREG(0x2084)
-#define S5P_ARM_CORE1_OPTION                   S5P_PMUREG(0x2088)
-
-#define S5P_ARM_COMMON_OPTION                  S5P_PMUREG(0x2408)
-#define S5P_TOP_PWR_OPTION                     S5P_PMUREG(0x2C48)
-#define S5P_CAM_OPTION                         S5P_PMUREG(0x3C08)
-#define S5P_TV_OPTION                          S5P_PMUREG(0x3C28)
-#define S5P_MFC_OPTION                         S5P_PMUREG(0x3C48)
-#define S5P_G3D_OPTION                         S5P_PMUREG(0x3C68)
-#define S5P_LCD0_OPTION                                S5P_PMUREG(0x3C88)
-#define S5P_LCD1_OPTION                                S5P_PMUREG(0x3CA8)
-#define S5P_MAUDIO_OPTION                      S5P_PMUREG(0x3CC8)
-#define S5P_GPS_OPTION                         S5P_PMUREG(0x3CE8)
-#define S5P_GPS_ALIVE_OPTION                   S5P_PMUREG(0x3D08)
-
-#define S5P_PAD_RET_MAUDIO_OPTION              S5P_PMUREG(0x3028)
-#define S5P_PAD_RET_GPIO_OPTION                        S5P_PMUREG(0x3108)
-#define S5P_PAD_RET_UART_OPTION                        S5P_PMUREG(0x3128)
-#define S5P_PAD_RET_MMCA_OPTION                        S5P_PMUREG(0x3148)
-#define S5P_PAD_RET_MMCB_OPTION                        S5P_PMUREG(0x3168)
-#define S5P_PAD_RET_EBIA_OPTION                        S5P_PMUREG(0x3188)
-#define S5P_PAD_RET_EBIB_OPTION                        S5P_PMUREG(0x31A8)
-
-#define S5P_PMU_CAM_CONF                       S5P_PMUREG(0x3C00)
-#define S5P_PMU_TV_CONF                                S5P_PMUREG(0x3C20)
-#define S5P_PMU_MFC_CONF                       S5P_PMUREG(0x3C40)
-#define S5P_PMU_G3D_CONF                       S5P_PMUREG(0x3C60)
-#define S5P_PMU_LCD0_CONF                      S5P_PMUREG(0x3C80)
-#define S5P_PMU_GPS_CONF                       S5P_PMUREG(0x3CE0)
-
-#define S5P_PMU_SATA_PHY_CONTROL_EN            0x1
-#define S5P_CORE_LOCAL_PWR_EN                  0x3
-#define S5P_INT_LOCAL_PWR_EN                   0x7
-
-#define S5P_CHECK_SLEEP                                0x00000BAD
-
-/* Only for EXYNOS4210 */
-#define S5P_USBDEVICE_PHY_CONTROL      S5P_PMUREG(0x0704)
-#define S5P_USBDEVICE_PHY_ENABLE       (1 << 0)
-
-#define S5P_USBHOST_PHY_CONTROL                S5P_PMUREG(0x0708)
-#define S5P_USBHOST_PHY_ENABLE         (1 << 0)
-
-#define S5P_PMU_SATA_PHY_CONTROL       S5P_PMUREG(0x0720)
-
-#define S5P_CMU_CLKSTOP_LCD1_LOWPWR    S5P_PMUREG(0x1154)
-#define S5P_CMU_RESET_LCD1_LOWPWR      S5P_PMUREG(0x1174)
-#define S5P_MODIMIF_MEM_LOWPWR         S5P_PMUREG(0x11C4)
-#define S5P_PCIE_MEM_LOWPWR            S5P_PMUREG(0x11E0)
-#define S5P_SATA_MEM_LOWPWR            S5P_PMUREG(0x11E4)
-#define S5P_LCD1_LOWPWR                        S5P_PMUREG(0x1394)
-
-#define S5P_PMU_LCD1_CONF              S5P_PMUREG(0x3CA0)
-
-/* Only for EXYNOS4x12 */
-#define S5P_ISP_ARM_LOWPWR                     S5P_PMUREG(0x1050)
-#define S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR       S5P_PMUREG(0x1054)
-#define S5P_DIS_IRQ_ISP_ARM_CENTRAL_LOWPWR     S5P_PMUREG(0x1058)
-#define S5P_CMU_ACLKSTOP_COREBLK_LOWPWR                S5P_PMUREG(0x1110)
-#define S5P_CMU_SCLKSTOP_COREBLK_LOWPWR                S5P_PMUREG(0x1114)
-#define S5P_CMU_RESET_COREBLK_LOWPWR           S5P_PMUREG(0x111C)
-#define S5P_MPLLUSER_SYSCLK_LOWPWR             S5P_PMUREG(0x1130)
-#define S5P_CMU_CLKSTOP_ISP_LOWPWR             S5P_PMUREG(0x1154)
-#define S5P_CMU_RESET_ISP_LOWPWR               S5P_PMUREG(0x1174)
-#define S5P_TOP_BUS_COREBLK_LOWPWR             S5P_PMUREG(0x1190)
-#define S5P_TOP_RETENTION_COREBLK_LOWPWR       S5P_PMUREG(0x1194)
-#define S5P_TOP_PWR_COREBLK_LOWPWR             S5P_PMUREG(0x1198)
-#define S5P_OSCCLK_GATE_LOWPWR                 S5P_PMUREG(0x11A4)
-#define S5P_LOGIC_RESET_COREBLK_LOWPWR         S5P_PMUREG(0x11B0)
-#define S5P_OSCCLK_GATE_COREBLK_LOWPWR         S5P_PMUREG(0x11B4)
-#define S5P_HSI_MEM_LOWPWR                     S5P_PMUREG(0x11C4)
-#define S5P_ROTATOR_MEM_LOWPWR                 S5P_PMUREG(0x11DC)
-#define S5P_PAD_RETENTION_GPIO_COREBLK_LOWPWR  S5P_PMUREG(0x123C)
-#define S5P_PAD_ISOLATION_COREBLK_LOWPWR       S5P_PMUREG(0x1250)
-#define S5P_GPIO_MODE_COREBLK_LOWPWR           S5P_PMUREG(0x1320)
-#define S5P_TOP_ASB_RESET_LOWPWR               S5P_PMUREG(0x1344)
-#define S5P_TOP_ASB_ISOLATION_LOWPWR           S5P_PMUREG(0x1348)
-#define S5P_ISP_LOWPWR                         S5P_PMUREG(0x1394)
-#define S5P_DRAM_FREQ_DOWN_LOWPWR              S5P_PMUREG(0x13B0)
-#define S5P_DDRPHY_DLLOFF_LOWPWR               S5P_PMUREG(0x13B4)
-#define S5P_CMU_SYSCLK_ISP_LOWPWR              S5P_PMUREG(0x13B8)
-#define S5P_CMU_SYSCLK_GPS_LOWPWR              S5P_PMUREG(0x13BC)
-#define S5P_LPDDR_PHY_DLL_LOCK_LOWPWR          S5P_PMUREG(0x13C0)
-
-#define S5P_ARM_L2_0_OPTION                    S5P_PMUREG(0x2608)
-#define S5P_ARM_L2_1_OPTION                    S5P_PMUREG(0x2628)
-#define S5P_ONENAND_MEM_OPTION                 S5P_PMUREG(0x2E08)
-#define S5P_HSI_MEM_OPTION                     S5P_PMUREG(0x2E28)
-#define S5P_G2D_ACP_MEM_OPTION                 S5P_PMUREG(0x2E48)
-#define S5P_USBOTG_MEM_OPTION                  S5P_PMUREG(0x2E68)
-#define S5P_HSMMC_MEM_OPTION                   S5P_PMUREG(0x2E88)
-#define S5P_CSSYS_MEM_OPTION                   S5P_PMUREG(0x2EA8)
-#define S5P_SECSS_MEM_OPTION                   S5P_PMUREG(0x2EC8)
-#define S5P_ROTATOR_MEM_OPTION                 S5P_PMUREG(0x2F48)
-
-/* Only for EXYNOS4412 */
-#define S5P_ARM_CORE2_LOWPWR                   S5P_PMUREG(0x1020)
-#define S5P_DIS_IRQ_CORE2                      S5P_PMUREG(0x1024)
-#define S5P_DIS_IRQ_CENTRAL2                   S5P_PMUREG(0x1028)
-#define S5P_ARM_CORE3_LOWPWR                   S5P_PMUREG(0x1030)
-#define S5P_DIS_IRQ_CORE3                      S5P_PMUREG(0x1034)
-#define S5P_DIS_IRQ_CENTRAL3                   S5P_PMUREG(0x1038)
-
-/* For EXYNOS5 */
-
-#define EXYNOS5_SYS_I2C_CFG                                    S5P_SYSREG(0x0234)
-
-#define EXYNOS5_AUTO_WDTRESET_DISABLE                          S5P_PMUREG(0x0408)
-#define EXYNOS5_MASK_WDTRESET_REQUEST                          S5P_PMUREG(0x040C)
-
-#define EXYNOS5_SYS_WDTRESET                                   (1 << 20)
-
-#define EXYNOS5_ARM_CORE0_SYS_PWR_REG                          S5P_PMUREG(0x1000)
-#define EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG            S5P_PMUREG(0x1004)
-#define EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG          S5P_PMUREG(0x1008)
-#define EXYNOS5_ARM_CORE1_SYS_PWR_REG                          S5P_PMUREG(0x1010)
-#define EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG            S5P_PMUREG(0x1014)
-#define EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG          S5P_PMUREG(0x1018)
-#define EXYNOS5_FSYS_ARM_SYS_PWR_REG                           S5P_PMUREG(0x1040)
-#define EXYNOS5_DIS_IRQ_FSYS_ARM_CENTRAL_SYS_PWR_REG           S5P_PMUREG(0x1048)
-#define EXYNOS5_ISP_ARM_SYS_PWR_REG                            S5P_PMUREG(0x1050)
-#define EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG              S5P_PMUREG(0x1054)
-#define EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG            S5P_PMUREG(0x1058)
-#define EXYNOS5_ARM_COMMON_SYS_PWR_REG                         S5P_PMUREG(0x1080)
-#define EXYNOS5_ARM_L2_SYS_PWR_REG                             S5P_PMUREG(0x10C0)
-#define EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG                       S5P_PMUREG(0x1100)
-#define EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG                       S5P_PMUREG(0x1104)
-#define EXYNOS5_CMU_RESET_SYS_PWR_REG                          S5P_PMUREG(0x110C)
-#define EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG                        S5P_PMUREG(0x1120)
-#define EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG                        S5P_PMUREG(0x1124)
-#define EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG                   S5P_PMUREG(0x112C)
-#define EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG                     S5P_PMUREG(0x1130)
-#define EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG                      S5P_PMUREG(0x1134)
-#define EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG                     S5P_PMUREG(0x1138)
-#define EXYNOS5_APLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x1140)
-#define EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x1144)
-#define EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x1148)
-#define EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x114C)
-#define EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x1150)
-#define EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x1154)
-#define EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG                    S5P_PMUREG(0x1164)
-#define EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG                    S5P_PMUREG(0x1170)
-#define EXYNOS5_TOP_BUS_SYS_PWR_REG                            S5P_PMUREG(0x1180)
-#define EXYNOS5_TOP_RETENTION_SYS_PWR_REG                      S5P_PMUREG(0x1184)
-#define EXYNOS5_TOP_PWR_SYS_PWR_REG                            S5P_PMUREG(0x1188)
-#define EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG                     S5P_PMUREG(0x1190)
-#define EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG               S5P_PMUREG(0x1194)
-#define EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG                     S5P_PMUREG(0x1198)
-#define EXYNOS5_LOGIC_RESET_SYS_PWR_REG                                S5P_PMUREG(0x11A0)
-#define EXYNOS5_OSCCLK_GATE_SYS_PWR_REG                                S5P_PMUREG(0x11A4)
-#define EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG                 S5P_PMUREG(0x11B0)
-#define EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG                 S5P_PMUREG(0x11B4)
-#define EXYNOS5_USBOTG_MEM_SYS_PWR_REG                         S5P_PMUREG(0x11C0)
-#define EXYNOS5_G2D_MEM_SYS_PWR_REG                            S5P_PMUREG(0x11C8)
-#define EXYNOS5_USBDRD_MEM_SYS_PWR_REG                         S5P_PMUREG(0x11CC)
-#define EXYNOS5_SDMMC_MEM_SYS_PWR_REG                          S5P_PMUREG(0x11D0)
-#define EXYNOS5_CSSYS_MEM_SYS_PWR_REG                          S5P_PMUREG(0x11D4)
-#define EXYNOS5_SECSS_MEM_SYS_PWR_REG                          S5P_PMUREG(0x11D8)
-#define EXYNOS5_ROTATOR_MEM_SYS_PWR_REG                                S5P_PMUREG(0x11DC)
-#define EXYNOS5_INTRAM_MEM_SYS_PWR_REG                         S5P_PMUREG(0x11E0)
-#define EXYNOS5_INTROM_MEM_SYS_PWR_REG                         S5P_PMUREG(0x11E4)
-#define EXYNOS5_JPEG_MEM_SYS_PWR_REG                           S5P_PMUREG(0x11E8)
-#define EXYNOS5_HSI_MEM_SYS_PWR_REG                            S5P_PMUREG(0x11EC)
-#define EXYNOS5_MCUIOP_MEM_SYS_PWR_REG                         S5P_PMUREG(0x11F4)
-#define EXYNOS5_SATA_MEM_SYS_PWR_REG                           S5P_PMUREG(0x11FC)
-#define EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG                 S5P_PMUREG(0x1200)
-#define EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG                  S5P_PMUREG(0x1204)
-#define EXYNOS5_PAD_RETENTION_EFNAND_SYS_PWR_REG               S5P_PMUREG(0x1208)
-#define EXYNOS5_PAD_RETENTION_GPIO_SYS_PWR_REG                 S5P_PMUREG(0x1220)
-#define EXYNOS5_PAD_RETENTION_UART_SYS_PWR_REG                 S5P_PMUREG(0x1224)
-#define EXYNOS5_PAD_RETENTION_MMCA_SYS_PWR_REG                 S5P_PMUREG(0x1228)
-#define EXYNOS5_PAD_RETENTION_MMCB_SYS_PWR_REG                 S5P_PMUREG(0x122C)
-#define EXYNOS5_PAD_RETENTION_EBIA_SYS_PWR_REG                 S5P_PMUREG(0x1230)
-#define EXYNOS5_PAD_RETENTION_EBIB_SYS_PWR_REG                 S5P_PMUREG(0x1234)
-#define EXYNOS5_PAD_RETENTION_SPI_SYS_PWR_REG                  S5P_PMUREG(0x1238)
-#define EXYNOS5_PAD_RETENTION_GPIO_SYSMEM_SYS_PWR_REG          S5P_PMUREG(0x123C)
-#define EXYNOS5_PAD_ISOLATION_SYS_PWR_REG                      S5P_PMUREG(0x1240)
-#define EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG               S5P_PMUREG(0x1250)
-#define EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG                                S5P_PMUREG(0x1260)
-#define EXYNOS5_XUSBXTI_SYS_PWR_REG                            S5P_PMUREG(0x1280)
-#define EXYNOS5_XXTI_SYS_PWR_REG                               S5P_PMUREG(0x1284)
-#define EXYNOS5_EXT_REGULATOR_SYS_PWR_REG                      S5P_PMUREG(0x12C0)
-#define EXYNOS5_GPIO_MODE_SYS_PWR_REG                          S5P_PMUREG(0x1300)
-#define EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG                   S5P_PMUREG(0x1320)
-#define EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG                      S5P_PMUREG(0x1340)
-#define EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG                      S5P_PMUREG(0x1344)
-#define EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG                  S5P_PMUREG(0x1348)
-#define EXYNOS5_GSCL_SYS_PWR_REG                               S5P_PMUREG(0x1400)
-#define EXYNOS5_ISP_SYS_PWR_REG                                        S5P_PMUREG(0x1404)
-#define EXYNOS5_MFC_SYS_PWR_REG                                        S5P_PMUREG(0x1408)
-#define EXYNOS5_G3D_SYS_PWR_REG                                        S5P_PMUREG(0x140C)
-#define EXYNOS5_DISP1_SYS_PWR_REG                              S5P_PMUREG(0x1414)
-#define EXYNOS5_MAU_SYS_PWR_REG                                        S5P_PMUREG(0x1418)
-#define EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG                   S5P_PMUREG(0x1480)
-#define EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG                    S5P_PMUREG(0x1484)
-#define EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG                    S5P_PMUREG(0x1488)
-#define EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG                    S5P_PMUREG(0x148C)
-#define EXYNOS5_CMU_CLKSTOP_DISP1_SYS_PWR_REG                  S5P_PMUREG(0x1494)
-#define EXYNOS5_CMU_CLKSTOP_MAU_SYS_PWR_REG                    S5P_PMUREG(0x1498)
-#define EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG                    S5P_PMUREG(0x14C0)
-#define EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG                     S5P_PMUREG(0x14C4)
-#define EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG                     S5P_PMUREG(0x14C8)
-#define EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG                     S5P_PMUREG(0x14CC)
-#define EXYNOS5_CMU_SYSCLK_DISP1_SYS_PWR_REG                   S5P_PMUREG(0x14D4)
-#define EXYNOS5_CMU_SYSCLK_MAU_SYS_PWR_REG                     S5P_PMUREG(0x14D8)
-#define EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG                     S5P_PMUREG(0x1580)
-#define EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG                      S5P_PMUREG(0x1584)
-#define EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG                      S5P_PMUREG(0x1588)
-#define EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG                      S5P_PMUREG(0x158C)
-#define EXYNOS5_CMU_RESET_DISP1_SYS_PWR_REG                    S5P_PMUREG(0x1594)
-#define EXYNOS5_CMU_RESET_MAU_SYS_PWR_REG                      S5P_PMUREG(0x1598)
-
-#define EXYNOS5_ARM_CORE0_OPTION                               S5P_PMUREG(0x2008)
-#define EXYNOS5_ARM_CORE1_OPTION                               S5P_PMUREG(0x2088)
-#define EXYNOS5_FSYS_ARM_OPTION                                        S5P_PMUREG(0x2208)
-#define EXYNOS5_ISP_ARM_OPTION                                 S5P_PMUREG(0x2288)
-#define EXYNOS5_ARM_COMMON_OPTION                              S5P_PMUREG(0x2408)
-#define EXYNOS5_ARM_L2_OPTION                                  S5P_PMUREG(0x2608)
-#define EXYNOS5_TOP_PWR_OPTION                                 S5P_PMUREG(0x2C48)
-#define EXYNOS5_TOP_PWR_SYSMEM_OPTION                          S5P_PMUREG(0x2CC8)
-#define EXYNOS5_JPEG_MEM_OPTION                                        S5P_PMUREG(0x2F48)
-#define EXYNOS5_GSCL_STATUS                                    S5P_PMUREG(0x4004)
-#define EXYNOS5_ISP_STATUS                                     S5P_PMUREG(0x4024)
-#define EXYNOS5_GSCL_OPTION                                    S5P_PMUREG(0x4008)
-#define EXYNOS5_ISP_OPTION                                     S5P_PMUREG(0x4028)
-#define EXYNOS5_MFC_OPTION                                     S5P_PMUREG(0x4048)
-#define EXYNOS5_G3D_CONFIGURATION                              S5P_PMUREG(0x4060)
-#define EXYNOS5_G3D_STATUS                                     S5P_PMUREG(0x4064)
-#define EXYNOS5_G3D_OPTION                                     S5P_PMUREG(0x4068)
-#define EXYNOS5_DISP1_OPTION                                   S5P_PMUREG(0x40A8)
-#define EXYNOS5_MAU_OPTION                                     S5P_PMUREG(0x40C8)
-
-#define EXYNOS5_USE_SC_FEEDBACK                                        (1 << 1)
-#define EXYNOS5_USE_SC_COUNTER                                 (1 << 0)
-
-#define EXYNOS5_MANUAL_L2RSTDISABLE_CONTROL                    (1 << 2)
-#define EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN                 (1 << 7)
-
-#define EXYNOS5_OPTION_USE_STANDBYWFE                          (1 << 24)
-#define EXYNOS5_OPTION_USE_STANDBYWFI                          (1 << 16)
-
-#define EXYNOS5_OPTION_USE_RETENTION                           (1 << 4)
-
-#endif /* __ASM_ARCH_REGS_PMU_H */
index 1fe075a70c1e83d34bf1440ac030fe86b551a4a6..65a46465ac5edd9b0c14ca4ec93b9bc7eb63536c 100644 (file)
 #include <linux/io.h>
 
 #include <asm/mach/arch.h>
-#include <mach/regs-pmu.h>
 #include <plat/mfc.h>
 
 #include "common.h"
+#include "regs-pmu.h"
 
 static void __init exynos5_dt_machine_init(void)
 {
index 58b43e6f926212277c38257ff50956c1aca16776..8ea02f63fed9565993e15fb6d645888191926436 100644 (file)
 #include <asm/firmware.h>
 
 #include <mach/hardware.h>
-#include <mach/regs-clock.h>
-#include <mach/regs-pmu.h>
 
 #include <plat/cpu.h>
 
 #include "common.h"
+#include "regs-pmu.h"
 
 extern void exynos4_secondary_startup(void);
 
@@ -64,8 +63,7 @@ static void write_pen_release(int val)
 {
        pen_release = val;
        smp_wmb();
-       __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
-       outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
+       sync_cache_w(&pen_release);
 }
 
 static void __iomem *scu_base_addr(void)
index c679db57726934de2f0338fadbbda0be05e49e74..e00025bbbe89c914accb61ec42f519415823f8a3 100644 (file)
 #include <plat/pll.h>
 #include <plat/regs-srom.h>
 
-#include <mach/regs-irq.h>
-#include <mach/regs-clock.h>
-#include <mach/regs-pmu.h>
+#include <mach/map.h>
 #include <mach/pm-core.h>
 
 #include "common.h"
+#include "regs-pmu.h"
 
-static struct sleep_save exynos4_set_clksrc[] = {
+#define EXYNOS4_EPLL_LOCK                      (S5P_VA_CMU + 0x0C010)
+#define EXYNOS4_VPLL_LOCK                      (S5P_VA_CMU + 0x0C020)
+
+#define EXYNOS4_EPLL_CON0                      (S5P_VA_CMU + 0x0C110)
+#define EXYNOS4_EPLL_CON1                      (S5P_VA_CMU + 0x0C114)
+#define EXYNOS4_VPLL_CON0                      (S5P_VA_CMU + 0x0C120)
+#define EXYNOS4_VPLL_CON1                      (S5P_VA_CMU + 0x0C124)
+
+#define EXYNOS4_CLKSRC_MASK_TOP                        (S5P_VA_CMU + 0x0C310)
+#define EXYNOS4_CLKSRC_MASK_CAM                        (S5P_VA_CMU + 0x0C320)
+#define EXYNOS4_CLKSRC_MASK_TV                 (S5P_VA_CMU + 0x0C324)
+#define EXYNOS4_CLKSRC_MASK_LCD0               (S5P_VA_CMU + 0x0C334)
+#define EXYNOS4_CLKSRC_MASK_MAUDIO             (S5P_VA_CMU + 0x0C33C)
+#define EXYNOS4_CLKSRC_MASK_FSYS               (S5P_VA_CMU + 0x0C340)
+#define EXYNOS4_CLKSRC_MASK_PERIL0             (S5P_VA_CMU + 0x0C350)
+#define EXYNOS4_CLKSRC_MASK_PERIL1             (S5P_VA_CMU + 0x0C354)
+
+#define EXYNOS4_CLKSRC_MASK_DMC                        (S5P_VA_CMU + 0x10300)
+
+#define EXYNOS4_EPLLCON0_LOCKED_SHIFT          (29)
+#define EXYNOS4_VPLLCON0_LOCKED_SHIFT          (29)
+
+#define EXYNOS4210_CLKSRC_MASK_LCD1            (S5P_VA_CMU + 0x0C338)
+
+static const struct sleep_save exynos4_set_clksrc[] = {
        { .reg = EXYNOS4_CLKSRC_MASK_TOP                , .val = 0x00000001, },
        { .reg = EXYNOS4_CLKSRC_MASK_CAM                , .val = 0x11111111, },
        { .reg = EXYNOS4_CLKSRC_MASK_TV                 , .val = 0x00000111, },
@@ -48,7 +71,7 @@ static struct sleep_save exynos4_set_clksrc[] = {
        { .reg = EXYNOS4_CLKSRC_MASK_DMC                , .val = 0x00010000, },
 };
 
-static struct sleep_save exynos4210_set_clksrc[] = {
+static const struct sleep_save exynos4210_set_clksrc[] = {
        { .reg = EXYNOS4210_CLKSRC_MASK_LCD1            , .val = 0x00001111, },
 };
 
index 1703593e366ccd82452c080bc76c8ba56d6ada27..8fd24882f0b1eb5a1963fdb985c577729170e081 100644 (file)
 #include <linux/of_platform.h>
 #include <linux/sched.h>
 
-#include <mach/regs-pmu.h>
 #include <plat/devs.h>
 
+#include "regs-pmu.h"
+
 /*
  * Exynos specific wrapper around the generic power domain
  */
@@ -183,9 +184,3 @@ static __init int exynos4_pm_init_power_domain(void)
        return 0;
 }
 arch_initcall(exynos4_pm_init_power_domain);
-
-int __init exynos_pm_late_initcall(void)
-{
-       pm_genpd_poweroff_unused();
-       return 0;
-}
index 97d6885262587e763ff9b0a7a67db57e5a8a73a0..05c7ce15322a7ec2175cca94f1ed75410595f15e 100644 (file)
 #include <linux/kernel.h>
 #include <linux/bug.h>
 
-#include <mach/regs-clock.h>
+#include <plat/cpu.h>
 
 #include "common.h"
+#include "regs-pmu.h"
 
-static struct exynos_pmu_conf *exynos_pmu_config;
+static const struct exynos_pmu_conf *exynos_pmu_config;
 
-static struct exynos_pmu_conf exynos4210_pmu_config[] = {
+static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
        /* { .reg = address, .val = { AFTR, LPA, SLEEP } */
        { S5P_ARM_CORE0_LOWPWR,                 { 0x0, 0x0, 0x2 } },
        { S5P_DIS_IRQ_CORE0,                    { 0x0, 0x0, 0x0 } },
@@ -95,7 +96,7 @@ static struct exynos_pmu_conf exynos4210_pmu_config[] = {
        { PMU_TABLE_END,},
 };
 
-static struct exynos_pmu_conf exynos4x12_pmu_config[] = {
+static const struct exynos_pmu_conf exynos4x12_pmu_config[] = {
        { S5P_ARM_CORE0_LOWPWR,                 { 0x0, 0x0, 0x2 } },
        { S5P_DIS_IRQ_CORE0,                    { 0x0, 0x0, 0x0 } },
        { S5P_DIS_IRQ_CENTRAL0,                 { 0x0, 0x0, 0x0 } },
@@ -203,7 +204,7 @@ static struct exynos_pmu_conf exynos4x12_pmu_config[] = {
        { PMU_TABLE_END,},
 };
 
-static struct exynos_pmu_conf exynos4412_pmu_config[] = {
+static const struct exynos_pmu_conf exynos4412_pmu_config[] = {
        { S5P_ARM_CORE2_LOWPWR,                 { 0x0, 0x0, 0x2 } },
        { S5P_DIS_IRQ_CORE2,                    { 0x0, 0x0, 0x0 } },
        { S5P_DIS_IRQ_CENTRAL2,                 { 0x0, 0x0, 0x0 } },
@@ -213,7 +214,7 @@ static struct exynos_pmu_conf exynos4412_pmu_config[] = {
        { PMU_TABLE_END,},
 };
 
-static struct exynos_pmu_conf exynos5250_pmu_config[] = {
+static const struct exynos_pmu_conf exynos5250_pmu_config[] = {
        /* { .reg = address, .val = { AFTR, LPA, SLEEP } */
        { EXYNOS5_ARM_CORE0_SYS_PWR_REG,                { 0x0, 0x0, 0x2} },
        { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG,  { 0x0, 0x0, 0x0} },
@@ -317,7 +318,7 @@ static struct exynos_pmu_conf exynos5250_pmu_config[] = {
        { PMU_TABLE_END,},
 };
 
-static void __iomem *exynos5_list_both_cnt_feed[] = {
+static void __iomem * const exynos5_list_both_cnt_feed[] = {
        EXYNOS5_ARM_CORE0_OPTION,
        EXYNOS5_ARM_CORE1_OPTION,
        EXYNOS5_ARM_COMMON_OPTION,
@@ -331,7 +332,7 @@ static void __iomem *exynos5_list_both_cnt_feed[] = {
        EXYNOS5_TOP_PWR_SYSMEM_OPTION,
 };
 
-static void __iomem *exynos5_list_diable_wfi_wfe[] = {
+static void __iomem * const exynos5_list_diable_wfi_wfe[] = {
        EXYNOS5_ARM_CORE1_OPTION,
        EXYNOS5_FSYS_ARM_OPTION,
        EXYNOS5_ISP_ARM_OPTION,
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
new file mode 100644 (file)
index 0000000..7c029ce
--- /dev/null
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com
+ *
+ * EXYNOS - Power management unit definition
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_ARCH_REGS_PMU_H
+#define __ASM_ARCH_REGS_PMU_H __FILE__
+
+#include <mach/map.h>
+
+#define S5P_PMUREG(x)                          (S5P_VA_PMU + (x))
+#define S5P_SYSREG(x)                          (S3C_VA_SYS + (x))
+
+#define S5P_CENTRAL_SEQ_CONFIGURATION          S5P_PMUREG(0x0200)
+
+#define S5P_CENTRAL_LOWPWR_CFG                 (1 << 16)
+
+#define S5P_CENTRAL_SEQ_OPTION                 S5P_PMUREG(0x0208)
+
+#define S5P_USE_STANDBY_WFI0                   (1 << 16)
+#define S5P_USE_STANDBY_WFE0                   (1 << 24)
+
+#define S5P_SWRESET                            S5P_PMUREG(0x0400)
+#define EXYNOS_SWRESET                         S5P_PMUREG(0x0400)
+#define EXYNOS5440_SWRESET                     S5P_PMUREG(0x00C4)
+
+#define S5P_WAKEUP_STAT                                S5P_PMUREG(0x0600)
+
+#define S5P_INFORM0                            S5P_PMUREG(0x0800)
+#define S5P_INFORM1                            S5P_PMUREG(0x0804)
+#define S5P_INFORM5                            S5P_PMUREG(0x0814)
+#define S5P_INFORM6                            S5P_PMUREG(0x0818)
+#define S5P_INFORM7                            S5P_PMUREG(0x081C)
+
+#define S5P_ARM_CORE0_LOWPWR                   S5P_PMUREG(0x1000)
+#define S5P_DIS_IRQ_CORE0                      S5P_PMUREG(0x1004)
+#define S5P_DIS_IRQ_CENTRAL0                   S5P_PMUREG(0x1008)
+#define S5P_ARM_CORE1_LOWPWR                   S5P_PMUREG(0x1010)
+#define S5P_DIS_IRQ_CORE1                      S5P_PMUREG(0x1014)
+#define S5P_DIS_IRQ_CENTRAL1                   S5P_PMUREG(0x1018)
+#define S5P_ARM_COMMON_LOWPWR                  S5P_PMUREG(0x1080)
+#define S5P_L2_0_LOWPWR                                S5P_PMUREG(0x10C0)
+#define S5P_L2_1_LOWPWR                                S5P_PMUREG(0x10C4)
+#define S5P_CMU_ACLKSTOP_LOWPWR                        S5P_PMUREG(0x1100)
+#define S5P_CMU_SCLKSTOP_LOWPWR                        S5P_PMUREG(0x1104)
+#define S5P_CMU_RESET_LOWPWR                   S5P_PMUREG(0x110C)
+#define S5P_APLL_SYSCLK_LOWPWR                 S5P_PMUREG(0x1120)
+#define S5P_MPLL_SYSCLK_LOWPWR                 S5P_PMUREG(0x1124)
+#define S5P_VPLL_SYSCLK_LOWPWR                 S5P_PMUREG(0x1128)
+#define S5P_EPLL_SYSCLK_LOWPWR                 S5P_PMUREG(0x112C)
+#define S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR       S5P_PMUREG(0x1138)
+#define S5P_CMU_RESET_GPSALIVE_LOWPWR          S5P_PMUREG(0x113C)
+#define S5P_CMU_CLKSTOP_CAM_LOWPWR             S5P_PMUREG(0x1140)
+#define S5P_CMU_CLKSTOP_TV_LOWPWR              S5P_PMUREG(0x1144)
+#define S5P_CMU_CLKSTOP_MFC_LOWPWR             S5P_PMUREG(0x1148)
+#define S5P_CMU_CLKSTOP_G3D_LOWPWR             S5P_PMUREG(0x114C)
+#define S5P_CMU_CLKSTOP_LCD0_LOWPWR            S5P_PMUREG(0x1150)
+#define S5P_CMU_CLKSTOP_MAUDIO_LOWPWR          S5P_PMUREG(0x1158)
+#define S5P_CMU_CLKSTOP_GPS_LOWPWR             S5P_PMUREG(0x115C)
+#define S5P_CMU_RESET_CAM_LOWPWR               S5P_PMUREG(0x1160)
+#define S5P_CMU_RESET_TV_LOWPWR                        S5P_PMUREG(0x1164)
+#define S5P_CMU_RESET_MFC_LOWPWR               S5P_PMUREG(0x1168)
+#define S5P_CMU_RESET_G3D_LOWPWR               S5P_PMUREG(0x116C)
+#define S5P_CMU_RESET_LCD0_LOWPWR              S5P_PMUREG(0x1170)
+#define S5P_CMU_RESET_MAUDIO_LOWPWR            S5P_PMUREG(0x1178)
+#define S5P_CMU_RESET_GPS_LOWPWR               S5P_PMUREG(0x117C)
+#define S5P_TOP_BUS_LOWPWR                     S5P_PMUREG(0x1180)
+#define S5P_TOP_RETENTION_LOWPWR               S5P_PMUREG(0x1184)
+#define S5P_TOP_PWR_LOWPWR                     S5P_PMUREG(0x1188)
+#define S5P_LOGIC_RESET_LOWPWR                 S5P_PMUREG(0x11A0)
+#define S5P_ONENAND_MEM_LOWPWR                 S5P_PMUREG(0x11C0)
+#define S5P_G2D_ACP_MEM_LOWPWR                 S5P_PMUREG(0x11C8)
+#define S5P_USBOTG_MEM_LOWPWR                  S5P_PMUREG(0x11CC)
+#define S5P_HSMMC_MEM_LOWPWR                   S5P_PMUREG(0x11D0)
+#define S5P_CSSYS_MEM_LOWPWR                   S5P_PMUREG(0x11D4)
+#define S5P_SECSS_MEM_LOWPWR                   S5P_PMUREG(0x11D8)
+#define S5P_PAD_RETENTION_DRAM_LOWPWR          S5P_PMUREG(0x1200)
+#define S5P_PAD_RETENTION_MAUDIO_LOWPWR                S5P_PMUREG(0x1204)
+#define S5P_PAD_RETENTION_GPIO_LOWPWR          S5P_PMUREG(0x1220)
+#define S5P_PAD_RETENTION_UART_LOWPWR          S5P_PMUREG(0x1224)
+#define S5P_PAD_RETENTION_MMCA_LOWPWR          S5P_PMUREG(0x1228)
+#define S5P_PAD_RETENTION_MMCB_LOWPWR          S5P_PMUREG(0x122C)
+#define S5P_PAD_RETENTION_EBIA_LOWPWR          S5P_PMUREG(0x1230)
+#define S5P_PAD_RETENTION_EBIB_LOWPWR          S5P_PMUREG(0x1234)
+#define S5P_PAD_RETENTION_ISOLATION_LOWPWR     S5P_PMUREG(0x1240)
+#define S5P_PAD_RETENTION_ALV_SEL_LOWPWR       S5P_PMUREG(0x1260)
+#define S5P_XUSBXTI_LOWPWR                     S5P_PMUREG(0x1280)
+#define S5P_XXTI_LOWPWR                                S5P_PMUREG(0x1284)
+#define S5P_EXT_REGULATOR_LOWPWR               S5P_PMUREG(0x12C0)
+#define S5P_GPIO_MODE_LOWPWR                   S5P_PMUREG(0x1300)
+#define S5P_GPIO_MODE_MAUDIO_LOWPWR            S5P_PMUREG(0x1340)
+#define S5P_CAM_LOWPWR                         S5P_PMUREG(0x1380)
+#define S5P_TV_LOWPWR                          S5P_PMUREG(0x1384)
+#define S5P_MFC_LOWPWR                         S5P_PMUREG(0x1388)
+#define S5P_G3D_LOWPWR                         S5P_PMUREG(0x138C)
+#define S5P_LCD0_LOWPWR                                S5P_PMUREG(0x1390)
+#define S5P_MAUDIO_LOWPWR                      S5P_PMUREG(0x1398)
+#define S5P_GPS_LOWPWR                         S5P_PMUREG(0x139C)
+#define S5P_GPS_ALIVE_LOWPWR                   S5P_PMUREG(0x13A0)
+
+#define S5P_ARM_CORE1_CONFIGURATION            S5P_PMUREG(0x2080)
+#define S5P_ARM_CORE1_STATUS                   S5P_PMUREG(0x2084)
+
+#define S5P_PAD_RET_MAUDIO_OPTION              S5P_PMUREG(0x3028)
+#define S5P_PAD_RET_GPIO_OPTION                        S5P_PMUREG(0x3108)
+#define S5P_PAD_RET_UART_OPTION                        S5P_PMUREG(0x3128)
+#define S5P_PAD_RET_MMCA_OPTION                        S5P_PMUREG(0x3148)
+#define S5P_PAD_RET_MMCB_OPTION                        S5P_PMUREG(0x3168)
+#define S5P_PAD_RET_EBIA_OPTION                        S5P_PMUREG(0x3188)
+#define S5P_PAD_RET_EBIB_OPTION                        S5P_PMUREG(0x31A8)
+
+#define S5P_CORE_LOCAL_PWR_EN                  0x3
+#define S5P_INT_LOCAL_PWR_EN                   0x7
+
+#define S5P_CHECK_SLEEP                                0x00000BAD
+
+/* Only for EXYNOS4210 */
+#define S5P_CMU_CLKSTOP_LCD1_LOWPWR    S5P_PMUREG(0x1154)
+#define S5P_CMU_RESET_LCD1_LOWPWR      S5P_PMUREG(0x1174)
+#define S5P_MODIMIF_MEM_LOWPWR         S5P_PMUREG(0x11C4)
+#define S5P_PCIE_MEM_LOWPWR            S5P_PMUREG(0x11E0)
+#define S5P_SATA_MEM_LOWPWR            S5P_PMUREG(0x11E4)
+#define S5P_LCD1_LOWPWR                        S5P_PMUREG(0x1394)
+
+/* Only for EXYNOS4x12 */
+#define S5P_ISP_ARM_LOWPWR                     S5P_PMUREG(0x1050)
+#define S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR       S5P_PMUREG(0x1054)
+#define S5P_DIS_IRQ_ISP_ARM_CENTRAL_LOWPWR     S5P_PMUREG(0x1058)
+#define S5P_CMU_ACLKSTOP_COREBLK_LOWPWR                S5P_PMUREG(0x1110)
+#define S5P_CMU_SCLKSTOP_COREBLK_LOWPWR                S5P_PMUREG(0x1114)
+#define S5P_CMU_RESET_COREBLK_LOWPWR           S5P_PMUREG(0x111C)
+#define S5P_MPLLUSER_SYSCLK_LOWPWR             S5P_PMUREG(0x1130)
+#define S5P_CMU_CLKSTOP_ISP_LOWPWR             S5P_PMUREG(0x1154)
+#define S5P_CMU_RESET_ISP_LOWPWR               S5P_PMUREG(0x1174)
+#define S5P_TOP_BUS_COREBLK_LOWPWR             S5P_PMUREG(0x1190)
+#define S5P_TOP_RETENTION_COREBLK_LOWPWR       S5P_PMUREG(0x1194)
+#define S5P_TOP_PWR_COREBLK_LOWPWR             S5P_PMUREG(0x1198)
+#define S5P_OSCCLK_GATE_LOWPWR                 S5P_PMUREG(0x11A4)
+#define S5P_LOGIC_RESET_COREBLK_LOWPWR         S5P_PMUREG(0x11B0)
+#define S5P_OSCCLK_GATE_COREBLK_LOWPWR         S5P_PMUREG(0x11B4)
+#define S5P_HSI_MEM_LOWPWR                     S5P_PMUREG(0x11C4)
+#define S5P_ROTATOR_MEM_LOWPWR                 S5P_PMUREG(0x11DC)
+#define S5P_PAD_RETENTION_GPIO_COREBLK_LOWPWR  S5P_PMUREG(0x123C)
+#define S5P_PAD_ISOLATION_COREBLK_LOWPWR       S5P_PMUREG(0x1250)
+#define S5P_GPIO_MODE_COREBLK_LOWPWR           S5P_PMUREG(0x1320)
+#define S5P_TOP_ASB_RESET_LOWPWR               S5P_PMUREG(0x1344)
+#define S5P_TOP_ASB_ISOLATION_LOWPWR           S5P_PMUREG(0x1348)
+#define S5P_ISP_LOWPWR                         S5P_PMUREG(0x1394)
+#define S5P_DRAM_FREQ_DOWN_LOWPWR              S5P_PMUREG(0x13B0)
+#define S5P_DDRPHY_DLLOFF_LOWPWR               S5P_PMUREG(0x13B4)
+#define S5P_CMU_SYSCLK_ISP_LOWPWR              S5P_PMUREG(0x13B8)
+#define S5P_CMU_SYSCLK_GPS_LOWPWR              S5P_PMUREG(0x13BC)
+#define S5P_LPDDR_PHY_DLL_LOCK_LOWPWR          S5P_PMUREG(0x13C0)
+
+#define S5P_ARM_L2_0_OPTION                    S5P_PMUREG(0x2608)
+#define S5P_ARM_L2_1_OPTION                    S5P_PMUREG(0x2628)
+#define S5P_ONENAND_MEM_OPTION                 S5P_PMUREG(0x2E08)
+#define S5P_HSI_MEM_OPTION                     S5P_PMUREG(0x2E28)
+#define S5P_G2D_ACP_MEM_OPTION                 S5P_PMUREG(0x2E48)
+#define S5P_USBOTG_MEM_OPTION                  S5P_PMUREG(0x2E68)
+#define S5P_HSMMC_MEM_OPTION                   S5P_PMUREG(0x2E88)
+#define S5P_CSSYS_MEM_OPTION                   S5P_PMUREG(0x2EA8)
+#define S5P_SECSS_MEM_OPTION                   S5P_PMUREG(0x2EC8)
+#define S5P_ROTATOR_MEM_OPTION                 S5P_PMUREG(0x2F48)
+
+/* Only for EXYNOS4412 */
+#define S5P_ARM_CORE2_LOWPWR                   S5P_PMUREG(0x1020)
+#define S5P_DIS_IRQ_CORE2                      S5P_PMUREG(0x1024)
+#define S5P_DIS_IRQ_CENTRAL2                   S5P_PMUREG(0x1028)
+#define S5P_ARM_CORE3_LOWPWR                   S5P_PMUREG(0x1030)
+#define S5P_DIS_IRQ_CORE3                      S5P_PMUREG(0x1034)
+#define S5P_DIS_IRQ_CENTRAL3                   S5P_PMUREG(0x1038)
+
+/* For EXYNOS5 */
+
+#define EXYNOS5_SYS_I2C_CFG                                    S5P_SYSREG(0x0234)
+
+#define EXYNOS5_AUTO_WDTRESET_DISABLE                          S5P_PMUREG(0x0408)
+#define EXYNOS5_MASK_WDTRESET_REQUEST                          S5P_PMUREG(0x040C)
+
+#define EXYNOS5_SYS_WDTRESET                                   (1 << 20)
+
+#define EXYNOS5_ARM_CORE0_SYS_PWR_REG                          S5P_PMUREG(0x1000)
+#define EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG            S5P_PMUREG(0x1004)
+#define EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG          S5P_PMUREG(0x1008)
+#define EXYNOS5_ARM_CORE1_SYS_PWR_REG                          S5P_PMUREG(0x1010)
+#define EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG            S5P_PMUREG(0x1014)
+#define EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG          S5P_PMUREG(0x1018)
+#define EXYNOS5_FSYS_ARM_SYS_PWR_REG                           S5P_PMUREG(0x1040)
+#define EXYNOS5_DIS_IRQ_FSYS_ARM_CENTRAL_SYS_PWR_REG           S5P_PMUREG(0x1048)
+#define EXYNOS5_ISP_ARM_SYS_PWR_REG                            S5P_PMUREG(0x1050)
+#define EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG              S5P_PMUREG(0x1054)
+#define EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG            S5P_PMUREG(0x1058)
+#define EXYNOS5_ARM_COMMON_SYS_PWR_REG                         S5P_PMUREG(0x1080)
+#define EXYNOS5_ARM_L2_SYS_PWR_REG                             S5P_PMUREG(0x10C0)
+#define EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG                       S5P_PMUREG(0x1100)
+#define EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG                       S5P_PMUREG(0x1104)
+#define EXYNOS5_CMU_RESET_SYS_PWR_REG                          S5P_PMUREG(0x110C)
+#define EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG                        S5P_PMUREG(0x1120)
+#define EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG                        S5P_PMUREG(0x1124)
+#define EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG                   S5P_PMUREG(0x112C)
+#define EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG                     S5P_PMUREG(0x1130)
+#define EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG                      S5P_PMUREG(0x1134)
+#define EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG                     S5P_PMUREG(0x1138)
+#define EXYNOS5_APLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x1140)
+#define EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x1144)
+#define EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x1148)
+#define EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x114C)
+#define EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x1150)
+#define EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG                                S5P_PMUREG(0x1154)
+#define EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG                    S5P_PMUREG(0x1164)
+#define EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG                    S5P_PMUREG(0x1170)
+#define EXYNOS5_TOP_BUS_SYS_PWR_REG                            S5P_PMUREG(0x1180)
+#define EXYNOS5_TOP_RETENTION_SYS_PWR_REG                      S5P_PMUREG(0x1184)
+#define EXYNOS5_TOP_PWR_SYS_PWR_REG                            S5P_PMUREG(0x1188)
+#define EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG                     S5P_PMUREG(0x1190)
+#define EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG               S5P_PMUREG(0x1194)
+#define EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG                     S5P_PMUREG(0x1198)
+#define EXYNOS5_LOGIC_RESET_SYS_PWR_REG                                S5P_PMUREG(0x11A0)
+#define EXYNOS5_OSCCLK_GATE_SYS_PWR_REG                                S5P_PMUREG(0x11A4)
+#define EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG                 S5P_PMUREG(0x11B0)
+#define EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG                 S5P_PMUREG(0x11B4)
+#define EXYNOS5_USBOTG_MEM_SYS_PWR_REG                         S5P_PMUREG(0x11C0)
+#define EXYNOS5_G2D_MEM_SYS_PWR_REG                            S5P_PMUREG(0x11C8)
+#define EXYNOS5_USBDRD_MEM_SYS_PWR_REG                         S5P_PMUREG(0x11CC)
+#define EXYNOS5_SDMMC_MEM_SYS_PWR_REG                          S5P_PMUREG(0x11D0)
+#define EXYNOS5_CSSYS_MEM_SYS_PWR_REG                          S5P_PMUREG(0x11D4)
+#define EXYNOS5_SECSS_MEM_SYS_PWR_REG                          S5P_PMUREG(0x11D8)
+#define EXYNOS5_ROTATOR_MEM_SYS_PWR_REG                                S5P_PMUREG(0x11DC)
+#define EXYNOS5_INTRAM_MEM_SYS_PWR_REG                         S5P_PMUREG(0x11E0)
+#define EXYNOS5_INTROM_MEM_SYS_PWR_REG                         S5P_PMUREG(0x11E4)
+#define EXYNOS5_JPEG_MEM_SYS_PWR_REG                           S5P_PMUREG(0x11E8)
+#define EXYNOS5_HSI_MEM_SYS_PWR_REG                            S5P_PMUREG(0x11EC)
+#define EXYNOS5_MCUIOP_MEM_SYS_PWR_REG                         S5P_PMUREG(0x11F4)
+#define EXYNOS5_SATA_MEM_SYS_PWR_REG                           S5P_PMUREG(0x11FC)
+#define EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG                 S5P_PMUREG(0x1200)
+#define EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG                  S5P_PMUREG(0x1204)
+#define EXYNOS5_PAD_RETENTION_EFNAND_SYS_PWR_REG               S5P_PMUREG(0x1208)
+#define EXYNOS5_PAD_RETENTION_GPIO_SYS_PWR_REG                 S5P_PMUREG(0x1220)
+#define EXYNOS5_PAD_RETENTION_UART_SYS_PWR_REG                 S5P_PMUREG(0x1224)
+#define EXYNOS5_PAD_RETENTION_MMCA_SYS_PWR_REG                 S5P_PMUREG(0x1228)
+#define EXYNOS5_PAD_RETENTION_MMCB_SYS_PWR_REG                 S5P_PMUREG(0x122C)
+#define EXYNOS5_PAD_RETENTION_EBIA_SYS_PWR_REG                 S5P_PMUREG(0x1230)
+#define EXYNOS5_PAD_RETENTION_EBIB_SYS_PWR_REG                 S5P_PMUREG(0x1234)
+#define EXYNOS5_PAD_RETENTION_SPI_SYS_PWR_REG                  S5P_PMUREG(0x1238)
+#define EXYNOS5_PAD_RETENTION_GPIO_SYSMEM_SYS_PWR_REG          S5P_PMUREG(0x123C)
+#define EXYNOS5_PAD_ISOLATION_SYS_PWR_REG                      S5P_PMUREG(0x1240)
+#define EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG               S5P_PMUREG(0x1250)
+#define EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG                                S5P_PMUREG(0x1260)
+#define EXYNOS5_XUSBXTI_SYS_PWR_REG                            S5P_PMUREG(0x1280)
+#define EXYNOS5_XXTI_SYS_PWR_REG                               S5P_PMUREG(0x1284)
+#define EXYNOS5_EXT_REGULATOR_SYS_PWR_REG                      S5P_PMUREG(0x12C0)
+#define EXYNOS5_GPIO_MODE_SYS_PWR_REG                          S5P_PMUREG(0x1300)
+#define EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG                   S5P_PMUREG(0x1320)
+#define EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG                      S5P_PMUREG(0x1340)
+#define EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG                      S5P_PMUREG(0x1344)
+#define EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG                  S5P_PMUREG(0x1348)
+#define EXYNOS5_GSCL_SYS_PWR_REG                               S5P_PMUREG(0x1400)
+#define EXYNOS5_ISP_SYS_PWR_REG                                        S5P_PMUREG(0x1404)
+#define EXYNOS5_MFC_SYS_PWR_REG                                        S5P_PMUREG(0x1408)
+#define EXYNOS5_G3D_SYS_PWR_REG                                        S5P_PMUREG(0x140C)
+#define EXYNOS5_DISP1_SYS_PWR_REG                              S5P_PMUREG(0x1414)
+#define EXYNOS5_MAU_SYS_PWR_REG                                        S5P_PMUREG(0x1418)
+#define EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG                   S5P_PMUREG(0x1480)
+#define EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG                    S5P_PMUREG(0x1484)
+#define EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG                    S5P_PMUREG(0x1488)
+#define EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG                    S5P_PMUREG(0x148C)
+#define EXYNOS5_CMU_CLKSTOP_DISP1_SYS_PWR_REG                  S5P_PMUREG(0x1494)
+#define EXYNOS5_CMU_CLKSTOP_MAU_SYS_PWR_REG                    S5P_PMUREG(0x1498)
+#define EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG                    S5P_PMUREG(0x14C0)
+#define EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG                     S5P_PMUREG(0x14C4)
+#define EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG                     S5P_PMUREG(0x14C8)
+#define EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG                     S5P_PMUREG(0x14CC)
+#define EXYNOS5_CMU_SYSCLK_DISP1_SYS_PWR_REG                   S5P_PMUREG(0x14D4)
+#define EXYNOS5_CMU_SYSCLK_MAU_SYS_PWR_REG                     S5P_PMUREG(0x14D8)
+#define EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG                     S5P_PMUREG(0x1580)
+#define EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG                      S5P_PMUREG(0x1584)
+#define EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG                      S5P_PMUREG(0x1588)
+#define EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG                      S5P_PMUREG(0x158C)
+#define EXYNOS5_CMU_RESET_DISP1_SYS_PWR_REG                    S5P_PMUREG(0x1594)
+#define EXYNOS5_CMU_RESET_MAU_SYS_PWR_REG                      S5P_PMUREG(0x1598)
+
+#define EXYNOS5_ARM_CORE0_OPTION                               S5P_PMUREG(0x2008)
+#define EXYNOS5_ARM_CORE1_OPTION                               S5P_PMUREG(0x2088)
+#define EXYNOS5_FSYS_ARM_OPTION                                        S5P_PMUREG(0x2208)
+#define EXYNOS5_ISP_ARM_OPTION                                 S5P_PMUREG(0x2288)
+#define EXYNOS5_ARM_COMMON_OPTION                              S5P_PMUREG(0x2408)
+#define EXYNOS5_ARM_L2_OPTION                                  S5P_PMUREG(0x2608)
+#define EXYNOS5_TOP_PWR_OPTION                                 S5P_PMUREG(0x2C48)
+#define EXYNOS5_TOP_PWR_SYSMEM_OPTION                          S5P_PMUREG(0x2CC8)
+#define EXYNOS5_JPEG_MEM_OPTION                                        S5P_PMUREG(0x2F48)
+#define EXYNOS5_GSCL_OPTION                                    S5P_PMUREG(0x4008)
+#define EXYNOS5_ISP_OPTION                                     S5P_PMUREG(0x4028)
+#define EXYNOS5_MFC_OPTION                                     S5P_PMUREG(0x4048)
+#define EXYNOS5_G3D_OPTION                                     S5P_PMUREG(0x4068)
+#define EXYNOS5_DISP1_OPTION                                   S5P_PMUREG(0x40A8)
+#define EXYNOS5_MAU_OPTION                                     S5P_PMUREG(0x40C8)
+
+#define EXYNOS5_USE_SC_FEEDBACK                                        (1 << 1)
+#define EXYNOS5_USE_SC_COUNTER                                 (1 << 0)
+
+#define EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN                 (1 << 7)
+
+#define EXYNOS5_OPTION_USE_STANDBYWFE                          (1 << 24)
+#define EXYNOS5_OPTION_USE_STANDBYWFI                          (1 << 16)
+
+#define EXYNOS5_OPTION_USE_RETENTION                           (1 << 4)
+
+#endif /* __ASM_ARCH_REGS_PMU_H */
index e0091685fd4861c8eb6f41b00c5f316865c1668b..9e8220e38398f87d368bcaa97dec961b846b22f3 100644 (file)
@@ -143,11 +143,6 @@ static struct map_desc fb_common_io_desc[] __initdata = {
                .pfn            = __phys_to_pfn(DC21285_ARMCSR_BASE),
                .length         = ARMCSR_SIZE,
                .type           = MT_DEVICE,
-       }, {
-               .virtual        = XBUS_BASE,
-               .pfn            = __phys_to_pfn(0x40000000),
-               .length         = XBUS_SIZE,
-               .type           = MT_DEVICE,
        }
 };
 
index 56607b3a773e074eb82d8d88cb9b505e416a8da8..b911e5587ecf2116c57736aad32ef339bd08771a 100644 (file)
@@ -10,3 +10,5 @@ extern void footbridge_init_irq(void);
 
 extern void isa_init_irq(unsigned int irq);
 extern void footbridge_restart(enum reboot_mode, const char *);
+
+extern void footbridge_sched_clock(void);
index 782f6c71fa0a6c761269cfc4b74fc6cdd0839e75..3971104d32d4794591199f2ac7df54829032e07d 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
+#include <linux/sched_clock.h>
 
 #include <asm/irq.h>
 
@@ -46,6 +47,16 @@ static struct clocksource cksrc_dc21285 = {
        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
+static int ckevt_dc21285_set_next_event(unsigned long delta,
+       struct clock_event_device *c)
+{
+       *CSR_TIMER1_CLR = 0;
+       *CSR_TIMER1_LOAD = delta;
+       *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_DIV16;
+
+       return 0;
+}
+
 static void ckevt_dc21285_set_mode(enum clock_event_mode mode,
        struct clock_event_device *c)
 {
@@ -58,7 +69,9 @@ static void ckevt_dc21285_set_mode(enum clock_event_mode mode,
                                   TIMER_CNTL_DIV16;
                break;
 
-       default:
+       case CLOCK_EVT_MODE_ONESHOT:
+       case CLOCK_EVT_MODE_UNUSED:
+       case CLOCK_EVT_MODE_SHUTDOWN:
                *CSR_TIMER1_CNTL = 0;
                break;
        }
@@ -66,9 +79,11 @@ static void ckevt_dc21285_set_mode(enum clock_event_mode mode,
 
 static struct clock_event_device ckevt_dc21285 = {
        .name           = "dc21285_timer1",
-       .features       = CLOCK_EVT_FEAT_PERIODIC,
+       .features       = CLOCK_EVT_FEAT_PERIODIC |
+                         CLOCK_EVT_FEAT_ONESHOT,
        .rating         = 200,
        .irq            = IRQ_TIMER1,
+       .set_next_event = ckevt_dc21285_set_next_event,
        .set_mode       = ckevt_dc21285_set_mode,
 };
 
@@ -78,6 +93,10 @@ static irqreturn_t timer1_interrupt(int irq, void *dev_id)
 
        *CSR_TIMER1_CLR = 0;
 
+       /* Stop the timer if in one-shot mode */
+       if (ce->mode == CLOCK_EVT_MODE_ONESHOT)
+               *CSR_TIMER1_CNTL = 0;
+
        ce->event_handler(ce);
 
        return IRQ_HANDLED;
@@ -105,3 +124,19 @@ void __init footbridge_timer_init(void)
        ce->cpumask = cpumask_of(smp_processor_id());
        clockevents_config_and_register(ce, rate, 0x4, 0xffffff);
 }
+
+static u32 notrace footbridge_read_sched_clock(void)
+{
+       return ~*CSR_TIMER3_VALUE;
+}
+
+void __init footbridge_sched_clock(void)
+{
+       unsigned rate = DIV_ROUND_CLOSEST(mem_fclk_21285, 16);
+
+       *CSR_TIMER3_LOAD = 0;
+       *CSR_TIMER3_CLR = 0;
+       *CSR_TIMER3_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_DIV16;
+
+       setup_sched_clock(footbridge_read_sched_clock, 24, rate);
+}
index 1a7235fb52acb3cb8ae784dbeeda4fb3c940594a..aee8300f34906d584ba6e38df4ba7a4d54264a19 100644 (file)
@@ -4,6 +4,7 @@
  * EBSA285 machine fixup
  */
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/leds.h>
 
 /* LEDs */
 #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
+#define XBUS_AMBER_L   BIT(0)
+#define XBUS_GREEN_L   BIT(1)
+#define XBUS_RED_L     BIT(2)
+#define XBUS_TOGGLE    BIT(7)
+
 struct ebsa285_led {
        struct led_classdev     cdev;
        u8                      mask;
@@ -36,6 +42,7 @@ static const struct {
 };
 
 static unsigned char hw_led_state;
+static void __iomem *xbus;
 
 static void ebsa285_led_set(struct led_classdev *cdev,
                enum led_brightness b)
@@ -47,7 +54,7 @@ static void ebsa285_led_set(struct led_classdev *cdev,
                hw_led_state |= led->mask;
        else
                hw_led_state &= ~led->mask;
-       *XBUS_LEDS = hw_led_state;
+       writeb(hw_led_state, xbus);
 }
 
 static enum led_brightness ebsa285_led_get(struct led_classdev *cdev)
@@ -65,9 +72,13 @@ static int __init ebsa285_leds_init(void)
        if (!machine_is_ebsa285())
                return -ENODEV;
 
+       xbus = ioremap(XBUS_CS2, SZ_4K);
+       if (!xbus)
+               return -ENOMEM;
+
        /* 3 LEDS all off */
-       hw_led_state = XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED;
-       *XBUS_LEDS = hw_led_state;
+       hw_led_state = XBUS_AMBER_L | XBUS_GREEN_L | XBUS_RED_L;
+       writeb(hw_led_state, xbus);
 
        for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) {
                struct ebsa285_led *led;
@@ -104,6 +115,7 @@ MACHINE_START(EBSA285, "EBSA285")
        .video_start    = 0x000a0000,
        .video_end      = 0x000bffff,
        .map_io         = footbridge_map_io,
+       .init_early     = footbridge_sched_clock,
        .init_irq       = footbridge_init_irq,
        .init_time      = footbridge_timer_init,
        .restart        = footbridge_restart,
index e3d6ccac21628fc323c042b3c5feb6e6a6e19d25..02f6d7a706b1f2455c6331809b62494ca3df6aca 100644 (file)
 #define PCIMEM_SIZE            0x01000000
 #define PCIMEM_BASE            MMU_IO(0xf0000000, 0x80000000)
 
-#define XBUS_LEDS              ((volatile unsigned char *)(XBUS_BASE + 0x12000))
-#define XBUS_LED_AMBER         (1 << 0)
-#define XBUS_LED_GREEN         (1 << 1)
-#define XBUS_LED_RED           (1 << 2)
-#define XBUS_LED_TOGGLE                (1 << 8)
+#define XBUS_CS2               0x40012000
 
 #define XBUS_SWITCH            ((volatile unsigned char *)(XBUS_BASE + 0x12000))
 #define XBUS_SWITCH_SWITCH     ((*XBUS_SWITCH) & 15)
diff --git a/arch/arm/mach-hisi/Kconfig b/arch/arm/mach-hisi/Kconfig
new file mode 100644 (file)
index 0000000..018ad67
--- /dev/null
@@ -0,0 +1,17 @@
+config ARCH_HI3xxx
+       bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7
+       select ARM_AMBA
+       select ARM_GIC
+       select ARM_TIMER_SP804
+       select ARCH_WANT_OPTIONAL_GPIOLIB
+       select CACHE_L2X0
+       select CLKSRC_OF
+       select GENERIC_CLOCKEVENTS
+       select HAVE_ARM_SCU
+       select HAVE_ARM_TWD
+       select HAVE_SMP
+       select PINCTRL
+       select PINCTRL_SINGLE
+       select SMP
+       help
+         Support for Hisilicon Hi36xx/Hi37xx processor family
diff --git a/arch/arm/mach-hisi/Makefile b/arch/arm/mach-hisi/Makefile
new file mode 100644 (file)
index 0000000..6870058
--- /dev/null
@@ -0,0 +1,7 @@
+#
+# Makefile for Hisilicon processors family
+#
+
+obj-y  += hisilicon.o
+obj-$(CONFIG_SMP)              += platsmp.o
+obj-$(CONFIG_HOTPLUG_CPU)      += hotplug.o
diff --git a/arch/arm/mach-hisi/core.h b/arch/arm/mach-hisi/core.h
new file mode 100644 (file)
index 0000000..af23ec2
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __HISILICON_CORE_H
+#define __HISILICON_CORE_H
+
+#include <linux/reboot.h>
+
+extern void hi3xxx_set_cpu_jump(int cpu, void *jump_addr);
+extern int hi3xxx_get_cpu_jump(int cpu);
+extern void secondary_startup(void);
+extern struct smp_operations hi3xxx_smp_ops;
+
+extern void hi3xxx_cpu_die(unsigned int cpu);
+extern int hi3xxx_cpu_kill(unsigned int cpu);
+extern void hi3xxx_set_cpu(int cpu, bool enable);
+
+#endif
diff --git a/arch/arm/mach-hisi/hisilicon.c b/arch/arm/mach-hisi/hisilicon.c
new file mode 100644 (file)
index 0000000..741faf3
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * (Hisilicon's SoC based) flattened device tree enabled machine
+ *
+ * Copyright (c) 2012-2013 Hisilicon Ltd.
+ * Copyright (c) 2012-2013 Linaro Ltd.
+ *
+ * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/clk-provider.h>
+#include <linux/clocksource.h>
+#include <linux/irqchip.h>
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
+
+#include <asm/proc-fns.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include "core.h"
+
+#define HI3620_SYSCTRL_PHYS_BASE               0xfc802000
+#define HI3620_SYSCTRL_VIRT_BASE               0xfe802000
+
+/*
+ * This table is only for optimization. Since ioremap() could always share
+ * the same mapping if it's defined as static IO mapping.
+ *
+ * Without this table, system could also work. The cost is some virtual address
+ * spaces wasted since ioremap() may be called multi times for the same
+ * IO space.
+ */
+static struct map_desc hi3620_io_desc[] __initdata = {
+       {
+               /* sysctrl */
+               .pfn            = __phys_to_pfn(HI3620_SYSCTRL_PHYS_BASE),
+               .virtual        = HI3620_SYSCTRL_VIRT_BASE,
+               .length         = 0x1000,
+               .type           = MT_DEVICE,
+       },
+};
+
+static void __init hi3620_map_io(void)
+{
+       debug_ll_io_init();
+       iotable_init(hi3620_io_desc, ARRAY_SIZE(hi3620_io_desc));
+}
+
+static void hi3xxx_restart(enum reboot_mode mode, const char *cmd)
+{
+       struct device_node *np;
+       void __iomem *base;
+       int offset;
+
+       np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
+       if (!np) {
+               pr_err("failed to find hisilicon,sysctrl node\n");
+               return;
+       }
+       base = of_iomap(np, 0);
+       if (!base) {
+               pr_err("failed to map address in hisilicon,sysctrl node\n");
+               return;
+       }
+       if (of_property_read_u32(np, "reboot-offset", &offset) < 0) {
+               pr_err("failed to find reboot-offset property\n");
+               return;
+       }
+       writel_relaxed(0xdeadbeef, base + offset);
+
+       while (1)
+               cpu_do_idle();
+}
+
+static const char *hi3xxx_compat[] __initconst = {
+       "hisilicon,hi3620-hi4511",
+       NULL,
+};
+
+DT_MACHINE_START(HI3620, "Hisilicon Hi3620 (Flattened Device Tree)")
+       .map_io         = hi3620_map_io,
+       .dt_compat      = hi3xxx_compat,
+       .smp            = smp_ops(hi3xxx_smp_ops),
+       .restart        = hi3xxx_restart,
+MACHINE_END
diff --git a/arch/arm/mach-hisi/hotplug.c b/arch/arm/mach-hisi/hotplug.c
new file mode 100644 (file)
index 0000000..b909854
--- /dev/null
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2013 Linaro Ltd.
+ * Copyright (c) 2013 Hisilicon Limited.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include <linux/cpu.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
+#include <asm/cacheflush.h>
+#include <asm/smp_plat.h>
+#include "core.h"
+
+/* Sysctrl registers in Hi3620 SoC */
+#define SCISOEN                                0xc0
+#define SCISODIS                       0xc4
+#define SCPERPWREN                     0xd0
+#define SCPERPWRDIS                    0xd4
+#define SCCPUCOREEN                    0xf4
+#define SCCPUCOREDIS                   0xf8
+#define SCPERCTRL0                     0x200
+#define SCCPURSTEN                     0x410
+#define SCCPURSTDIS                    0x414
+
+/*
+ * bit definition in SCISOEN/SCPERPWREN/...
+ *
+ * CPU2_ISO_CTRL       (1 << 5)
+ * CPU3_ISO_CTRL       (1 << 6)
+ * ...
+ */
+#define CPU2_ISO_CTRL                  (1 << 5)
+
+/*
+ * bit definition in SCPERCTRL0
+ *
+ * CPU0_WFI_MASK_CFG   (1 << 28)
+ * CPU1_WFI_MASK_CFG   (1 << 29)
+ * ...
+ */
+#define CPU0_WFI_MASK_CFG              (1 << 28)
+
+/*
+ * bit definition in SCCPURSTEN/...
+ *
+ * CPU0_SRST_REQ_EN    (1 << 0)
+ * CPU1_SRST_REQ_EN    (1 << 1)
+ * ...
+ */
+#define CPU0_HPM_SRST_REQ_EN           (1 << 22)
+#define CPU0_DBG_SRST_REQ_EN           (1 << 12)
+#define CPU0_NEON_SRST_REQ_EN          (1 << 4)
+#define CPU0_SRST_REQ_EN               (1 << 0)
+
+enum {
+       HI3620_CTRL,
+       ERROR_CTRL,
+};
+
+static void __iomem *ctrl_base;
+static int id;
+
+static void set_cpu_hi3620(int cpu, bool enable)
+{
+       u32 val = 0;
+
+       if (enable) {
+               /* MTCMOS set */
+               if ((cpu == 2) || (cpu == 3))
+                       writel_relaxed(CPU2_ISO_CTRL << (cpu - 2),
+                                      ctrl_base + SCPERPWREN);
+               udelay(100);
+
+               /* Enable core */
+               writel_relaxed(0x01 << cpu, ctrl_base + SCCPUCOREEN);
+
+               /* unreset */
+               val = CPU0_DBG_SRST_REQ_EN | CPU0_NEON_SRST_REQ_EN
+                       | CPU0_SRST_REQ_EN;
+               writel_relaxed(val << cpu, ctrl_base + SCCPURSTDIS);
+               /* reset */
+               val |= CPU0_HPM_SRST_REQ_EN;
+               writel_relaxed(val << cpu, ctrl_base + SCCPURSTEN);
+
+               /* ISO disable */
+               if ((cpu == 2) || (cpu == 3))
+                       writel_relaxed(CPU2_ISO_CTRL << (cpu - 2),
+                                      ctrl_base + SCISODIS);
+               udelay(1);
+
+               /* WFI Mask */
+               val = readl_relaxed(ctrl_base + SCPERCTRL0);
+               val &= ~(CPU0_WFI_MASK_CFG << cpu);
+               writel_relaxed(val, ctrl_base + SCPERCTRL0);
+
+               /* Unreset */
+               val = CPU0_DBG_SRST_REQ_EN | CPU0_NEON_SRST_REQ_EN
+                       | CPU0_SRST_REQ_EN | CPU0_HPM_SRST_REQ_EN;
+               writel_relaxed(val << cpu, ctrl_base + SCCPURSTDIS);
+       } else {
+               /* wfi mask */
+               val = readl_relaxed(ctrl_base + SCPERCTRL0);
+               val |= (CPU0_WFI_MASK_CFG << cpu);
+               writel_relaxed(val, ctrl_base + SCPERCTRL0);
+
+               /* disable core*/
+               writel_relaxed(0x01 << cpu, ctrl_base + SCCPUCOREDIS);
+
+               if ((cpu == 2) || (cpu == 3)) {
+                       /* iso enable */
+                       writel_relaxed(CPU2_ISO_CTRL << (cpu - 2),
+                                      ctrl_base + SCISOEN);
+                       udelay(1);
+               }
+
+               /* reset */
+               val = CPU0_DBG_SRST_REQ_EN | CPU0_NEON_SRST_REQ_EN
+                       | CPU0_SRST_REQ_EN | CPU0_HPM_SRST_REQ_EN;
+               writel_relaxed(val << cpu, ctrl_base + SCCPURSTEN);
+
+               if ((cpu == 2) || (cpu == 3)) {
+                       /* MTCMOS unset */
+                       writel_relaxed(CPU2_ISO_CTRL << (cpu - 2),
+                                      ctrl_base + SCPERPWRDIS);
+                       udelay(100);
+               }
+       }
+}
+
+static int hi3xxx_hotplug_init(void)
+{
+       struct device_node *node;
+
+       node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
+       if (node) {
+               ctrl_base = of_iomap(node, 0);
+               id = HI3620_CTRL;
+               return 0;
+       }
+       id = ERROR_CTRL;
+       return -ENOENT;
+}
+
+void hi3xxx_set_cpu(int cpu, bool enable)
+{
+       if (!ctrl_base) {
+               if (hi3xxx_hotplug_init() < 0)
+                       return;
+       }
+
+       if (id == HI3620_CTRL)
+               set_cpu_hi3620(cpu, enable);
+}
+
+static inline void cpu_enter_lowpower(void)
+{
+       unsigned int v;
+
+       flush_cache_all();
+
+       /*
+        * Turn off coherency and L1 D-cache
+        */
+       asm volatile(
+       "       mrc     p15, 0, %0, c1, c0, 1\n"
+       "       bic     %0, %0, #0x40\n"
+       "       mcr     p15, 0, %0, c1, c0, 1\n"
+       "       mrc     p15, 0, %0, c1, c0, 0\n"
+       "       bic     %0, %0, #0x04\n"
+       "       mcr     p15, 0, %0, c1, c0, 0\n"
+         : "=&r" (v)
+         : "r" (0)
+         : "cc");
+}
+
+void hi3xxx_cpu_die(unsigned int cpu)
+{
+       cpu_enter_lowpower();
+       hi3xxx_set_cpu_jump(cpu, phys_to_virt(0));
+       cpu_do_idle();
+
+       /* We should have never returned from idle */
+       panic("cpu %d unexpectedly exit from shutdown\n", cpu);
+}
+
+int hi3xxx_cpu_kill(unsigned int cpu)
+{
+       unsigned long timeout = jiffies + msecs_to_jiffies(50);
+
+       while (hi3xxx_get_cpu_jump(cpu))
+               if (time_after(jiffies, timeout))
+                       return 0;
+       hi3xxx_set_cpu(cpu, false);
+       return 1;
+}
diff --git a/arch/arm/mach-hisi/platsmp.c b/arch/arm/mach-hisi/platsmp.c
new file mode 100644 (file)
index 0000000..471f1ee
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2013 Linaro Ltd.
+ * Copyright (c) 2013 Hisilicon Limited.
+ * Based on arch/arm/mach-vexpress/platsmp.c, Copyright (C) 2002 ARM Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+#include <linux/smp.h>
+#include <linux/io.h>
+#include <linux/of_address.h>
+
+#include <asm/cacheflush.h>
+#include <asm/smp_plat.h>
+#include <asm/smp_scu.h>
+
+#include "core.h"
+
+static void __iomem *ctrl_base;
+
+void hi3xxx_set_cpu_jump(int cpu, void *jump_addr)
+{
+       cpu = cpu_logical_map(cpu);
+       if (!cpu || !ctrl_base)
+               return;
+       writel_relaxed(virt_to_phys(jump_addr), ctrl_base + ((cpu - 1) << 2));
+}
+
+int hi3xxx_get_cpu_jump(int cpu)
+{
+       cpu = cpu_logical_map(cpu);
+       if (!cpu || !ctrl_base)
+               return 0;
+       return readl_relaxed(ctrl_base + ((cpu - 1) << 2));
+}
+
+static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
+{
+       struct device_node *np = NULL;
+       unsigned long base = 0;
+       u32 offset = 0;
+       void __iomem *scu_base = NULL;
+
+       if (scu_a9_has_base()) {
+               base = scu_a9_get_base();
+               scu_base = ioremap(base, SZ_4K);
+               if (!scu_base) {
+                       pr_err("ioremap(scu_base) failed\n");
+                       return;
+               }
+               scu_enable(scu_base);
+               iounmap(scu_base);
+       }
+       if (!ctrl_base) {
+               np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
+               if (!np) {
+                       pr_err("failed to find hisilicon,sysctrl node\n");
+                       return;
+               }
+               ctrl_base = of_iomap(np, 0);
+               if (!ctrl_base) {
+                       pr_err("failed to map address\n");
+                       return;
+               }
+               if (of_property_read_u32(np, "smp-offset", &offset) < 0) {
+                       pr_err("failed to find smp-offset property\n");
+                       return;
+               }
+               ctrl_base += offset;
+       }
+}
+
+static int hi3xxx_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+       hi3xxx_set_cpu(cpu, true);
+       hi3xxx_set_cpu_jump(cpu, secondary_startup);
+       arch_send_wakeup_ipi_mask(cpumask_of(cpu));
+       return 0;
+}
+
+struct smp_operations hi3xxx_smp_ops __initdata = {
+       .smp_prepare_cpus       = hi3xxx_smp_prepare_cpus,
+       .smp_boot_secondary     = hi3xxx_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+       .cpu_die                = hi3xxx_cpu_die,
+       .cpu_kill               = hi3xxx_cpu_kill,
+#endif
+};
index 7a6e6f71006893a9c2a54d4a17166762c4647977..33567aa5880f423f936aefd5e59dda722c9c3371 100644 (file)
@@ -3,7 +3,6 @@ config ARCH_MXC
        select ARCH_REQUIRE_GPIOLIB
        select ARM_CPU_SUSPEND if PM
        select ARM_PATCH_PHYS_VIRT
-       select AUTO_ZRELADDR if !ZBOOT_ROM
        select CLKSRC_MMIO
        select COMMON_CLK
        select GENERIC_ALLOCATOR
@@ -11,6 +10,7 @@ config ARCH_MXC
        select GENERIC_IRQ_CHIP
        select MIGHT_HAVE_CACHE_L2X0 if ARCH_MULTI_V6_V7
        select MULTI_IRQ_HANDLER
+       select PINCTRL
        select SOC_BUS
        select SPARSE_IRQ
        select USE_OF
@@ -20,16 +20,6 @@ config ARCH_MXC
 menu "Freescale i.MX support"
        depends on ARCH_MXC
 
-config MXC_IRQ_PRIOR
-       bool "Use IRQ priority"
-       help
-         Select this if you want to use prioritized IRQ handling.
-         This feature prevents higher priority ISR to be interrupted
-         by lower priority IRQ.
-         This may be useful in embedded applications, where are strong
-         requirements for timing.
-         Say N here, unless you have a specialized requirement.
-
 config MXC_TZIC
        bool
 
@@ -109,6 +99,7 @@ config SOC_IMX25
        select ARCH_MXC_IOMUX_V3
        select CPU_ARM926T
        select MXC_AVIC
+       select PINCTRL_IMX25
 
 config SOC_IMX27
        bool
@@ -118,6 +109,7 @@ config SOC_IMX27
        select IMX_HAVE_IOMUX_V1
        select MACH_MX27
        select MXC_AVIC
+       select PINCTRL_IMX27
 
 config SOC_IMX31
        bool
@@ -133,6 +125,7 @@ config SOC_IMX35
        select HAVE_EPIT
        select MXC_AVIC
        select SMP_ON_UP if SMP
+       select PINCTRL
 
 config SOC_IMX5
        bool
@@ -145,7 +138,6 @@ config SOC_IMX5
 config SOC_IMX51
        bool
        select HAVE_IMX_SRC
-       select PINCTRL
        select PINCTRL_IMX51
        select SOC_IMX5
 
@@ -619,6 +611,13 @@ config MACH_IMX31_DT
 
 comment "MX35 platforms:"
 
+config MACH_IMX35_DT
+       bool "Support i.MX35 platforms from device tree"
+       select SOC_IMX35
+       help
+         Include support for Freescale i.MX35 based platforms
+         using the device tree for discovery.
+
 config MACH_PCM043
        bool "Support Phytec pcm043 (i.MX35) platforms"
        select IMX_HAVE_PLATFORM_FLEXCAN
@@ -766,11 +765,19 @@ endchoice
 
 comment "Device tree only"
 
+config SOC_IMX50
+       bool "i.MX50 support"
+       select HAVE_IMX_SRC
+       select PINCTRL_IMX50
+       select SOC_IMX5
+
+       help
+         This enables support for Freescale i.MX50 processor.
+
 config SOC_IMX53
        bool "i.MX53 support"
        select HAVE_IMX_SRC
        select IMX_HAVE_PLATFORM_IMX2_WDT
-       select PINCTRL
        select PINCTRL_IMX53
        select SOC_IMX5
 
@@ -796,7 +803,6 @@ config SOC_IMX6Q
        select MFD_SYSCON
        select MIGHT_HAVE_PCI
        select PCI_DOMAINS if PCI
-       select PINCTRL
        select PINCTRL_IMX6Q
        select PL310_ERRATA_588369 if CACHE_PL310
        select PL310_ERRATA_727915 if CACHE_PL310
@@ -817,7 +823,6 @@ config SOC_IMX6SL
        select HAVE_IMX_MMDC
        select HAVE_IMX_SRC
        select MFD_SYSCON
-       select PINCTRL
        select PINCTRL_IMX6SL
        select PL310_ERRATA_588369 if CACHE_PL310
        select PL310_ERRATA_727915 if CACHE_PL310
@@ -831,7 +836,6 @@ config SOC_VF610
        select CPU_V7
        select ARM_GIC
        select CLKSRC_OF
-       select PINCTRL
        select PINCTRL_VF610
        select VF_PIT_TIMER
        select PL310_ERRATA_588369 if CACHE_PL310
index 1789e2b3190389f287a4ce79a747b17c1072a48d..befcaf5d05740c4ad1a417d8be62ddae9a38f59a 100644 (file)
@@ -89,6 +89,7 @@ obj-$(CONFIG_MACH_MX35_3DS) += mach-mx35_3ds.o
 obj-$(CONFIG_MACH_EUKREA_CPUIMX35SD) += mach-cpuimx35.o
 obj-$(CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD) += eukrea_mbimxsd35-baseboard.o
 obj-$(CONFIG_MACH_VPR200) += mach-vpr200.o
+obj-$(CONFIG_MACH_IMX35_DT) += imx35-dt.o
 
 obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o
 obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
@@ -112,6 +113,7 @@ obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += mach-cpuimx51sd.o
 obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd51-baseboard.o
 
 obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
+obj-$(CONFIG_SOC_IMX50) += mach-imx50.o
 obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
 
 obj-$(CONFIG_SOC_VF610) += clk-vf610.o mach-vf610.o
index e163ec7a8441170151493adc38146dadf4115b39..8d1df2e4b7ac23a5bea5a101342bd8fa313686b7 100644 (file)
 static void __iomem *avic_base;
 static struct irq_domain *domain;
 
-#ifdef CONFIG_MXC_IRQ_PRIOR
-static int avic_irq_set_priority(unsigned char irq, unsigned char prio)
-{
-       struct irq_data *d = irq_get_irq_data(irq);
-       unsigned int temp;
-       unsigned int mask = 0x0F << irq % 8 * 4;
-
-       irq = d->hwirq;
-
-       if (irq >= AVIC_NUM_IRQS)
-               return -EINVAL;
-
-       temp = __raw_readl(avic_base + AVIC_NIPRIORITY(irq / 8));
-       temp &= ~mask;
-       temp |= prio & mask;
-
-       __raw_writel(temp, avic_base + AVIC_NIPRIORITY(irq / 8));
-
-       return 0;
-}
-#endif
-
 #ifdef CONFIG_FIQ
 static int avic_set_irq_fiq(unsigned int irq, unsigned int type)
 {
@@ -102,9 +80,6 @@ static int avic_set_irq_fiq(unsigned int irq, unsigned int type)
 
 
 static struct mxc_extra_irq avic_extra_irq = {
-#ifdef CONFIG_MXC_IRQ_PRIOR
-       .set_priority = avic_irq_set_priority,
-#endif
 #ifdef CONFIG_FIQ
        .set_irq_fiq = avic_set_irq_fiq,
 #endif
index a63e415609a88a637490c7aaf7c27160572c71c0..a2ecc006b322c2d6bdb328e353aa3eadcdcac436 100644 (file)
@@ -72,7 +72,7 @@ static int clk_gate2_is_enabled(struct clk_hw *hw)
 
        reg = readl(gate->reg);
 
-       if (((reg >> gate->bit_idx) & 3) == 3)
+       if (((reg >> gate->bit_idx) & 1) == 1)
                return 1;
 
        return 0;
index 2193c834f55ccc68dcbd35cb3ebb1d68dc9f35d6..a4d5e425cd8219389c5ba32887cc7ab867e41ed3 100644 (file)
@@ -45,6 +45,8 @@ static struct arm_ahb_div clk_consumer[] = {
 static char hsp_div_532[] = { 4, 8, 3, 0 };
 static char hsp_div_400[] = { 3, 6, 3, 0 };
 
+static struct clk_onecell_data clk_data;
+
 static const char *std_sel[] = {"ppll", "arm"};
 static const char *ipg_per_sel[] = {"ahb_per_div", "arm_per_div"};
 
@@ -286,3 +288,15 @@ int __init mx35_clocks_init(void)
 
        return 0;
 }
+
+static int __init mx35_clocks_init_dt(struct device_node *ccm_node)
+{
+       clk_data.clks = clk;
+       clk_data.clk_num = ARRAY_SIZE(clk);
+       of_clk_add_provider(ccm_node, of_clk_src_onecell_get, &clk_data);
+
+       mx35_clocks_init();
+
+       return 0;
+}
+CLK_OF_DECLARE(imx35, "fsl,imx35-ccm", mx35_clocks_init_dt);
index ce37af26ff8c6931b62e9459d7ffb7df1daf81ab..19fca1fdc6feb76f0e86805ec7d5c980b716c515 100644 (file)
 #include <linux/io.h>
 #include <linux/clkdev.h>
 #include <linux/clk-provider.h>
-#include <linux/of.h>
 #include <linux/err.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <dt-bindings/clock/imx5-clock.h>
 
 #include "crm-regs-imx5.h"
 #include "clk.h"
@@ -83,50 +83,7 @@ static const char *spdif_sel[] = { "pll1_sw", "pll2_sw", "pll3_sw", "spdif_xtal_
 static const char *spdif0_com_sel[] = { "spdif0_podf", "ssi1_root_gate", };
 static const char *mx51_spdif1_com_sel[] = { "spdif1_podf", "ssi2_root_gate", };
 
-
-enum imx5_clks {
-       dummy, ckil, osc, ckih1, ckih2, ahb, ipg, axi_a, axi_b, uart_pred,
-       uart_root, esdhc_a_pred, esdhc_b_pred, esdhc_c_s, esdhc_d_s,
-       emi_sel, emi_slow_podf, nfc_podf, ecspi_pred, ecspi_podf, usboh3_pred,
-       usboh3_podf, usb_phy_pred, usb_phy_podf, cpu_podf, di_pred, tve_di_unused,
-       tve_s, uart1_ipg_gate, uart1_per_gate, uart2_ipg_gate,
-       uart2_per_gate, uart3_ipg_gate, uart3_per_gate, i2c1_gate, i2c2_gate,
-       gpt_ipg_gate, pwm1_ipg_gate, pwm1_hf_gate, pwm2_ipg_gate, pwm2_hf_gate,
-       gpt_hf_gate, fec_gate, usboh3_per_gate, esdhc1_ipg_gate, esdhc2_ipg_gate,
-       esdhc3_ipg_gate, esdhc4_ipg_gate, ssi1_ipg_gate, ssi2_ipg_gate,
-       ssi3_ipg_gate, ecspi1_ipg_gate, ecspi1_per_gate, ecspi2_ipg_gate,
-       ecspi2_per_gate, cspi_ipg_gate, sdma_gate, emi_slow_gate, ipu_s,
-       ipu_gate, nfc_gate, ipu_di1_gate, vpu_s, vpu_gate,
-       vpu_reference_gate, uart4_ipg_gate, uart4_per_gate, uart5_ipg_gate,
-       uart5_per_gate, tve_gate, tve_pred, esdhc1_per_gate, esdhc2_per_gate,
-       esdhc3_per_gate, esdhc4_per_gate, usb_phy_gate, hsi2c_gate,
-       mipi_hsc1_gate, mipi_hsc2_gate, mipi_esc_gate, mipi_hsp_gate,
-       ldb_di1_div_3_5, ldb_di1_div, ldb_di0_div_3_5, ldb_di0_div,
-       ldb_di1_gate, can2_serial_gate, can2_ipg_gate, i2c3_gate, lp_apm,
-       periph_apm, main_bus, ahb_max, aips_tz1, aips_tz2, tmax1, tmax2,
-       tmax3, spba, uart_sel, esdhc_a_sel, esdhc_b_sel, esdhc_a_podf,
-       esdhc_b_podf, ecspi_sel, usboh3_sel, usb_phy_sel, iim_gate,
-       usboh3_gate, emi_fast_gate, ipu_di0_gate,gpc_dvfs, pll1_sw, pll2_sw,
-       pll3_sw, ipu_di0_sel, ipu_di1_sel, tve_ext_sel, mx51_mipi, pll4_sw,
-       ldb_di1_sel, di_pll4_podf, ldb_di0_sel, ldb_di0_gate, usb_phy1_gate,
-       usb_phy2_gate, per_lp_apm, per_pred1, per_pred2, per_podf, per_root,
-       ssi_apm, ssi1_root_sel, ssi2_root_sel, ssi3_root_sel, ssi_ext1_sel,
-       ssi_ext2_sel, ssi_ext1_com_sel, ssi_ext2_com_sel, ssi1_root_pred,
-       ssi1_root_podf, ssi2_root_pred, ssi2_root_podf, ssi_ext1_pred,
-       ssi_ext1_podf, ssi_ext2_pred, ssi_ext2_podf, ssi1_root_gate,
-       ssi2_root_gate, ssi3_root_gate, ssi_ext1_gate, ssi_ext2_gate,
-       epit1_ipg_gate, epit1_hf_gate, epit2_ipg_gate, epit2_hf_gate,
-       can_sel, can1_serial_gate, can1_ipg_gate,
-       owire_gate, gpu3d_s, gpu2d_s, gpu3d_gate, gpu2d_gate, garb_gate,
-       cko1_sel, cko1_podf, cko1,
-       cko2_sel, cko2_podf, cko2,
-       srtc_gate, pata_gate, sata_gate, spdif_xtal_sel, spdif0_sel,
-       spdif1_sel, spdif0_pred, spdif0_podf, spdif1_pred, spdif1_podf,
-       spdif0_com_s, spdif1_com_sel, spdif0_gate, spdif1_gate, spdif_ipg_gate,
-       ocram, clk_max
-};
-
-static struct clk *clk[clk_max];
+static struct clk *clk[IMX5_CLK_END];
 static struct clk_onecell_data clk_data;
 
 static void __init mx5_clocks_common_init(unsigned long rate_ckil,
@@ -135,236 +92,296 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
 {
        int i;
 
-       clk[dummy] = imx_clk_fixed("dummy", 0);
-       clk[ckil] = imx_obtain_fixed_clock("ckil", rate_ckil);
-       clk[osc] = imx_obtain_fixed_clock("osc", rate_osc);
-       clk[ckih1] = imx_obtain_fixed_clock("ckih1", rate_ckih1);
-       clk[ckih2] = imx_obtain_fixed_clock("ckih2", rate_ckih2);
-
-       clk[lp_apm] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 9, 1,
-                               lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
-       clk[periph_apm] = imx_clk_mux("periph_apm", MXC_CCM_CBCMR, 12, 2,
-                               periph_apm_sel, ARRAY_SIZE(periph_apm_sel));
-       clk[main_bus] = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 1,
-                               main_bus_sel, ARRAY_SIZE(main_bus_sel));
-       clk[per_lp_apm] = imx_clk_mux("per_lp_apm", MXC_CCM_CBCMR, 1, 1,
-                               per_lp_apm_sel, ARRAY_SIZE(per_lp_apm_sel));
-       clk[per_pred1] = imx_clk_divider("per_pred1", "per_lp_apm", MXC_CCM_CBCDR, 6, 2);
-       clk[per_pred2] = imx_clk_divider("per_pred2", "per_pred1", MXC_CCM_CBCDR, 3, 3);
-       clk[per_podf] = imx_clk_divider("per_podf", "per_pred2", MXC_CCM_CBCDR, 0, 3);
-       clk[per_root] = imx_clk_mux("per_root", MXC_CCM_CBCMR, 0, 1,
-                               per_root_sel, ARRAY_SIZE(per_root_sel));
-       clk[ahb] = imx_clk_divider("ahb", "main_bus", MXC_CCM_CBCDR, 10, 3);
-       clk[ahb_max] = imx_clk_gate2("ahb_max", "ahb", MXC_CCM_CCGR0, 28);
-       clk[aips_tz1] = imx_clk_gate2("aips_tz1", "ahb", MXC_CCM_CCGR0, 24);
-       clk[aips_tz2] = imx_clk_gate2("aips_tz2", "ahb", MXC_CCM_CCGR0, 26);
-       clk[tmax1] = imx_clk_gate2("tmax1", "ahb", MXC_CCM_CCGR1, 0);
-       clk[tmax2] = imx_clk_gate2("tmax2", "ahb", MXC_CCM_CCGR1, 2);
-       clk[tmax3] = imx_clk_gate2("tmax3", "ahb", MXC_CCM_CCGR1, 4);
-       clk[spba] = imx_clk_gate2("spba", "ipg", MXC_CCM_CCGR5, 0);
-       clk[ipg] = imx_clk_divider("ipg", "ahb", MXC_CCM_CBCDR, 8, 2);
-       clk[axi_a] = imx_clk_divider("axi_a", "main_bus", MXC_CCM_CBCDR, 16, 3);
-       clk[axi_b] = imx_clk_divider("axi_b", "main_bus", MXC_CCM_CBCDR, 19, 3);
-       clk[uart_sel] = imx_clk_mux("uart_sel", MXC_CCM_CSCMR1, 24, 2,
-                               standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
-       clk[uart_pred] = imx_clk_divider("uart_pred", "uart_sel", MXC_CCM_CSCDR1, 3, 3);
-       clk[uart_root] = imx_clk_divider("uart_root", "uart_pred", MXC_CCM_CSCDR1, 0, 3);
-
-       clk[esdhc_a_sel] = imx_clk_mux("esdhc_a_sel", MXC_CCM_CSCMR1, 20, 2,
-                               standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
-       clk[esdhc_b_sel] = imx_clk_mux("esdhc_b_sel", MXC_CCM_CSCMR1, 16, 2,
-                               standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
-       clk[esdhc_a_pred] = imx_clk_divider("esdhc_a_pred", "esdhc_a_sel", MXC_CCM_CSCDR1, 16, 3);
-       clk[esdhc_a_podf] = imx_clk_divider("esdhc_a_podf", "esdhc_a_pred", MXC_CCM_CSCDR1, 11, 3);
-       clk[esdhc_b_pred] = imx_clk_divider("esdhc_b_pred", "esdhc_b_sel", MXC_CCM_CSCDR1, 22, 3);
-       clk[esdhc_b_podf] = imx_clk_divider("esdhc_b_podf", "esdhc_b_pred", MXC_CCM_CSCDR1, 19, 3);
-       clk[esdhc_c_s] = imx_clk_mux("esdhc_c_sel", MXC_CCM_CSCMR1, 19, 1, esdhc_c_sel, ARRAY_SIZE(esdhc_c_sel));
-       clk[esdhc_d_s] = imx_clk_mux("esdhc_d_sel", MXC_CCM_CSCMR1, 18, 1, esdhc_d_sel, ARRAY_SIZE(esdhc_d_sel));
-
-       clk[emi_sel] = imx_clk_mux("emi_sel", MXC_CCM_CBCDR, 26, 1,
-                               emi_slow_sel, ARRAY_SIZE(emi_slow_sel));
-       clk[emi_slow_podf] = imx_clk_divider("emi_slow_podf", "emi_sel", MXC_CCM_CBCDR, 22, 3);
-       clk[nfc_podf] = imx_clk_divider("nfc_podf", "emi_slow_podf", MXC_CCM_CBCDR, 13, 3);
-       clk[ecspi_sel] = imx_clk_mux("ecspi_sel", MXC_CCM_CSCMR1, 4, 2,
-                               standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
-       clk[ecspi_pred] = imx_clk_divider("ecspi_pred", "ecspi_sel", MXC_CCM_CSCDR2, 25, 3);
-       clk[ecspi_podf] = imx_clk_divider("ecspi_podf", "ecspi_pred", MXC_CCM_CSCDR2, 19, 6);
-       clk[usboh3_sel] = imx_clk_mux("usboh3_sel", MXC_CCM_CSCMR1, 22, 2,
-                               standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
-       clk[usboh3_pred] = imx_clk_divider("usboh3_pred", "usboh3_sel", MXC_CCM_CSCDR1, 8, 3);
-       clk[usboh3_podf] = imx_clk_divider("usboh3_podf", "usboh3_pred", MXC_CCM_CSCDR1, 6, 2);
-       clk[usb_phy_pred] = imx_clk_divider("usb_phy_pred", "pll3_sw", MXC_CCM_CDCDR, 3, 3);
-       clk[usb_phy_podf] = imx_clk_divider("usb_phy_podf", "usb_phy_pred", MXC_CCM_CDCDR, 0, 3);
-       clk[usb_phy_sel] = imx_clk_mux("usb_phy_sel", MXC_CCM_CSCMR1, 26, 1,
-                               usb_phy_sel_str, ARRAY_SIZE(usb_phy_sel_str));
-       clk[cpu_podf] = imx_clk_divider("cpu_podf", "pll1_sw", MXC_CCM_CACRR, 0, 3);
-       clk[di_pred] = imx_clk_divider("di_pred", "pll3_sw", MXC_CCM_CDCDR, 6, 3);
-       clk[iim_gate] = imx_clk_gate2("iim_gate", "ipg", MXC_CCM_CCGR0, 30);
-       clk[uart1_ipg_gate] = imx_clk_gate2("uart1_ipg_gate", "ipg", MXC_CCM_CCGR1, 6);
-       clk[uart1_per_gate] = imx_clk_gate2("uart1_per_gate", "uart_root", MXC_CCM_CCGR1, 8);
-       clk[uart2_ipg_gate] = imx_clk_gate2("uart2_ipg_gate", "ipg", MXC_CCM_CCGR1, 10);
-       clk[uart2_per_gate] = imx_clk_gate2("uart2_per_gate", "uart_root", MXC_CCM_CCGR1, 12);
-       clk[uart3_ipg_gate] = imx_clk_gate2("uart3_ipg_gate", "ipg", MXC_CCM_CCGR1, 14);
-       clk[uart3_per_gate] = imx_clk_gate2("uart3_per_gate", "uart_root", MXC_CCM_CCGR1, 16);
-       clk[i2c1_gate] = imx_clk_gate2("i2c1_gate", "per_root", MXC_CCM_CCGR1, 18);
-       clk[i2c2_gate] = imx_clk_gate2("i2c2_gate", "per_root", MXC_CCM_CCGR1, 20);
-       clk[pwm1_ipg_gate] = imx_clk_gate2("pwm1_ipg_gate", "ipg", MXC_CCM_CCGR2, 10);
-       clk[pwm1_hf_gate] = imx_clk_gate2("pwm1_hf_gate", "per_root", MXC_CCM_CCGR2, 12);
-       clk[pwm2_ipg_gate] = imx_clk_gate2("pwm2_ipg_gate", "ipg", MXC_CCM_CCGR2, 14);
-       clk[pwm2_hf_gate] = imx_clk_gate2("pwm2_hf_gate", "per_root", MXC_CCM_CCGR2, 16);
-       clk[gpt_ipg_gate] = imx_clk_gate2("gpt_ipg_gate", "ipg", MXC_CCM_CCGR2, 18);
-       clk[gpt_hf_gate] = imx_clk_gate2("gpt_hf_gate", "per_root", MXC_CCM_CCGR2, 20);
-       clk[fec_gate] = imx_clk_gate2("fec_gate", "ipg", MXC_CCM_CCGR2, 24);
-       clk[usboh3_gate] = imx_clk_gate2("usboh3_gate", "ipg", MXC_CCM_CCGR2, 26);
-       clk[usboh3_per_gate] = imx_clk_gate2("usboh3_per_gate", "usboh3_podf", MXC_CCM_CCGR2, 28);
-       clk[esdhc1_ipg_gate] = imx_clk_gate2("esdhc1_ipg_gate", "ipg", MXC_CCM_CCGR3, 0);
-       clk[esdhc2_ipg_gate] = imx_clk_gate2("esdhc2_ipg_gate", "ipg", MXC_CCM_CCGR3, 4);
-       clk[esdhc3_ipg_gate] = imx_clk_gate2("esdhc3_ipg_gate", "ipg", MXC_CCM_CCGR3, 8);
-       clk[esdhc4_ipg_gate] = imx_clk_gate2("esdhc4_ipg_gate", "ipg", MXC_CCM_CCGR3, 12);
-       clk[ssi1_ipg_gate] = imx_clk_gate2("ssi1_ipg_gate", "ipg", MXC_CCM_CCGR3, 16);
-       clk[ssi2_ipg_gate] = imx_clk_gate2("ssi2_ipg_gate", "ipg", MXC_CCM_CCGR3, 20);
-       clk[ssi3_ipg_gate] = imx_clk_gate2("ssi3_ipg_gate", "ipg", MXC_CCM_CCGR3, 24);
-       clk[ecspi1_ipg_gate] = imx_clk_gate2("ecspi1_ipg_gate", "ipg", MXC_CCM_CCGR4, 18);
-       clk[ecspi1_per_gate] = imx_clk_gate2("ecspi1_per_gate", "ecspi_podf", MXC_CCM_CCGR4, 20);
-       clk[ecspi2_ipg_gate] = imx_clk_gate2("ecspi2_ipg_gate", "ipg", MXC_CCM_CCGR4, 22);
-       clk[ecspi2_per_gate] = imx_clk_gate2("ecspi2_per_gate", "ecspi_podf", MXC_CCM_CCGR4, 24);
-       clk[cspi_ipg_gate] = imx_clk_gate2("cspi_ipg_gate", "ipg", MXC_CCM_CCGR4, 26);
-       clk[sdma_gate] = imx_clk_gate2("sdma_gate", "ipg", MXC_CCM_CCGR4, 30);
-       clk[emi_fast_gate] = imx_clk_gate2("emi_fast_gate", "dummy", MXC_CCM_CCGR5, 14);
-       clk[emi_slow_gate] = imx_clk_gate2("emi_slow_gate", "emi_slow_podf", MXC_CCM_CCGR5, 16);
-       clk[ipu_s] = imx_clk_mux("ipu_sel", MXC_CCM_CBCMR, 6, 2, ipu_sel, ARRAY_SIZE(ipu_sel));
-       clk[ipu_gate] = imx_clk_gate2("ipu_gate", "ipu_sel", MXC_CCM_CCGR5, 10);
-       clk[nfc_gate] = imx_clk_gate2("nfc_gate", "nfc_podf", MXC_CCM_CCGR5, 20);
-       clk[ipu_di0_gate] = imx_clk_gate2("ipu_di0_gate", "ipu_di0_sel", MXC_CCM_CCGR6, 10);
-       clk[ipu_di1_gate] = imx_clk_gate2("ipu_di1_gate", "ipu_di1_sel", MXC_CCM_CCGR6, 12);
-       clk[gpu3d_s] = imx_clk_mux("gpu3d_sel", MXC_CCM_CBCMR, 4, 2, gpu3d_sel, ARRAY_SIZE(gpu3d_sel));
-       clk[gpu2d_s] = imx_clk_mux("gpu2d_sel", MXC_CCM_CBCMR, 16, 2, gpu2d_sel, ARRAY_SIZE(gpu2d_sel));
-       clk[gpu3d_gate] = imx_clk_gate2("gpu3d_gate", "gpu3d_sel", MXC_CCM_CCGR5, 2);
-       clk[garb_gate] = imx_clk_gate2("garb_gate", "axi_a", MXC_CCM_CCGR5, 4);
-       clk[gpu2d_gate] = imx_clk_gate2("gpu2d_gate", "gpu2d_sel", MXC_CCM_CCGR6, 14);
-       clk[vpu_s] = imx_clk_mux("vpu_sel", MXC_CCM_CBCMR, 14, 2, vpu_sel, ARRAY_SIZE(vpu_sel));
-       clk[vpu_gate] = imx_clk_gate2("vpu_gate", "vpu_sel", MXC_CCM_CCGR5, 6);
-       clk[vpu_reference_gate] = imx_clk_gate2("vpu_reference_gate", "osc", MXC_CCM_CCGR5, 8);
-       clk[uart4_ipg_gate] = imx_clk_gate2("uart4_ipg_gate", "ipg", MXC_CCM_CCGR7, 8);
-       clk[uart4_per_gate] = imx_clk_gate2("uart4_per_gate", "uart_root", MXC_CCM_CCGR7, 10);
-       clk[uart5_ipg_gate] = imx_clk_gate2("uart5_ipg_gate", "ipg", MXC_CCM_CCGR7, 12);
-       clk[uart5_per_gate] = imx_clk_gate2("uart5_per_gate", "uart_root", MXC_CCM_CCGR7, 14);
-       clk[gpc_dvfs] = imx_clk_gate2("gpc_dvfs", "dummy", MXC_CCM_CCGR5, 24);
-
-       clk[ssi_apm] = imx_clk_mux("ssi_apm", MXC_CCM_CSCMR1, 8, 2, ssi_apm_sels, ARRAY_SIZE(ssi_apm_sels));
-       clk[ssi1_root_sel] = imx_clk_mux("ssi1_root_sel", MXC_CCM_CSCMR1, 14, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
-       clk[ssi2_root_sel] = imx_clk_mux("ssi2_root_sel", MXC_CCM_CSCMR1, 12, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
-       clk[ssi3_root_sel] = imx_clk_mux("ssi3_root_sel", MXC_CCM_CSCMR1, 11, 1, ssi3_clk_sels, ARRAY_SIZE(ssi3_clk_sels));
-       clk[ssi_ext1_sel] = imx_clk_mux("ssi_ext1_sel", MXC_CCM_CSCMR1, 28, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
-       clk[ssi_ext2_sel] = imx_clk_mux("ssi_ext2_sel", MXC_CCM_CSCMR1, 30, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
-       clk[ssi_ext1_com_sel] = imx_clk_mux("ssi_ext1_com_sel", MXC_CCM_CSCMR1, 0, 1, ssi_ext1_com_sels, ARRAY_SIZE(ssi_ext1_com_sels));
-       clk[ssi_ext2_com_sel] = imx_clk_mux("ssi_ext2_com_sel", MXC_CCM_CSCMR1, 1, 1, ssi_ext2_com_sels, ARRAY_SIZE(ssi_ext2_com_sels));
-       clk[ssi1_root_pred] = imx_clk_divider("ssi1_root_pred", "ssi1_root_sel", MXC_CCM_CS1CDR, 6, 3);
-       clk[ssi1_root_podf] = imx_clk_divider("ssi1_root_podf", "ssi1_root_pred", MXC_CCM_CS1CDR, 0, 6);
-       clk[ssi2_root_pred] = imx_clk_divider("ssi2_root_pred", "ssi2_root_sel", MXC_CCM_CS2CDR, 6, 3);
-       clk[ssi2_root_podf] = imx_clk_divider("ssi2_root_podf", "ssi2_root_pred", MXC_CCM_CS2CDR, 0, 6);
-       clk[ssi_ext1_pred] = imx_clk_divider("ssi_ext1_pred", "ssi_ext1_sel", MXC_CCM_CS1CDR, 22, 3);
-       clk[ssi_ext1_podf] = imx_clk_divider("ssi_ext1_podf", "ssi_ext1_pred", MXC_CCM_CS1CDR, 16, 6);
-       clk[ssi_ext2_pred] = imx_clk_divider("ssi_ext2_pred", "ssi_ext2_sel", MXC_CCM_CS2CDR, 22, 3);
-       clk[ssi_ext2_podf] = imx_clk_divider("ssi_ext2_podf", "ssi_ext2_pred", MXC_CCM_CS2CDR, 16, 6);
-       clk[ssi1_root_gate] = imx_clk_gate2("ssi1_root_gate", "ssi1_root_podf", MXC_CCM_CCGR3, 18);
-       clk[ssi2_root_gate] = imx_clk_gate2("ssi2_root_gate", "ssi2_root_podf", MXC_CCM_CCGR3, 22);
-       clk[ssi3_root_gate] = imx_clk_gate2("ssi3_root_gate", "ssi3_root_sel", MXC_CCM_CCGR3, 26);
-       clk[ssi_ext1_gate] = imx_clk_gate2("ssi_ext1_gate", "ssi_ext1_com_sel", MXC_CCM_CCGR3, 28);
-       clk[ssi_ext2_gate] = imx_clk_gate2("ssi_ext2_gate", "ssi_ext2_com_sel", MXC_CCM_CCGR3, 30);
-       clk[epit1_ipg_gate] = imx_clk_gate2("epit1_ipg_gate", "ipg", MXC_CCM_CCGR2, 2);
-       clk[epit1_hf_gate] = imx_clk_gate2("epit1_hf_gate", "per_root", MXC_CCM_CCGR2, 4);
-       clk[epit2_ipg_gate] = imx_clk_gate2("epit2_ipg_gate", "ipg", MXC_CCM_CCGR2, 6);
-       clk[epit2_hf_gate] = imx_clk_gate2("epit2_hf_gate", "per_root", MXC_CCM_CCGR2, 8);
-       clk[owire_gate] = imx_clk_gate2("owire_gate", "per_root", MXC_CCM_CCGR2, 22);
-       clk[srtc_gate] = imx_clk_gate2("srtc_gate", "per_root", MXC_CCM_CCGR4, 28);
-       clk[pata_gate] = imx_clk_gate2("pata_gate", "ipg", MXC_CCM_CCGR4, 0);
-       clk[spdif0_sel] = imx_clk_mux("spdif0_sel", MXC_CCM_CSCMR2, 0, 2, spdif_sel, ARRAY_SIZE(spdif_sel));
-       clk[spdif0_pred] = imx_clk_divider("spdif0_pred", "spdif0_sel", MXC_CCM_CDCDR, 25, 3);
-       clk[spdif0_podf] = imx_clk_divider("spdif0_podf", "spdif0_pred", MXC_CCM_CDCDR, 19, 6);
-       clk[spdif0_com_s] = imx_clk_mux_flags("spdif0_com_sel", MXC_CCM_CSCMR2, 4, 1,
-                               spdif0_com_sel, ARRAY_SIZE(spdif0_com_sel), CLK_SET_RATE_PARENT);
-       clk[spdif0_gate] = imx_clk_gate2("spdif0_gate", "spdif0_com_sel", MXC_CCM_CCGR5, 26);
-       clk[spdif_ipg_gate] = imx_clk_gate2("spdif_ipg_gate", "ipg", MXC_CCM_CCGR5, 30);
+       clk[IMX5_CLK_DUMMY]             = imx_clk_fixed("dummy", 0);
+       clk[IMX5_CLK_CKIL]              = imx_obtain_fixed_clock("ckil", rate_ckil);
+       clk[IMX5_CLK_OSC]               = imx_obtain_fixed_clock("osc", rate_osc);
+       clk[IMX5_CLK_CKIH1]             = imx_obtain_fixed_clock("ckih1", rate_ckih1);
+       clk[IMX5_CLK_CKIH2]             = imx_obtain_fixed_clock("ckih2", rate_ckih2);
+
+       clk[IMX5_CLK_PERIPH_APM]        = imx_clk_mux("periph_apm", MXC_CCM_CBCMR, 12, 2,
+                                               periph_apm_sel, ARRAY_SIZE(periph_apm_sel));
+       clk[IMX5_CLK_MAIN_BUS]          = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 1,
+                                               main_bus_sel, ARRAY_SIZE(main_bus_sel));
+       clk[IMX5_CLK_PER_LP_APM]        = imx_clk_mux("per_lp_apm", MXC_CCM_CBCMR, 1, 1,
+                                               per_lp_apm_sel, ARRAY_SIZE(per_lp_apm_sel));
+       clk[IMX5_CLK_PER_PRED1]         = imx_clk_divider("per_pred1", "per_lp_apm", MXC_CCM_CBCDR, 6, 2);
+       clk[IMX5_CLK_PER_PRED2]         = imx_clk_divider("per_pred2", "per_pred1", MXC_CCM_CBCDR, 3, 3);
+       clk[IMX5_CLK_PER_PODF]          = imx_clk_divider("per_podf", "per_pred2", MXC_CCM_CBCDR, 0, 3);
+       clk[IMX5_CLK_PER_ROOT]          = imx_clk_mux("per_root", MXC_CCM_CBCMR, 0, 1,
+                                               per_root_sel, ARRAY_SIZE(per_root_sel));
+       clk[IMX5_CLK_AHB]               = imx_clk_divider("ahb", "main_bus", MXC_CCM_CBCDR, 10, 3);
+       clk[IMX5_CLK_AHB_MAX]           = imx_clk_gate2("ahb_max", "ahb", MXC_CCM_CCGR0, 28);
+       clk[IMX5_CLK_AIPS_TZ1]          = imx_clk_gate2("aips_tz1", "ahb", MXC_CCM_CCGR0, 24);
+       clk[IMX5_CLK_AIPS_TZ2]          = imx_clk_gate2("aips_tz2", "ahb", MXC_CCM_CCGR0, 26);
+       clk[IMX5_CLK_TMAX1]             = imx_clk_gate2("tmax1", "ahb", MXC_CCM_CCGR1, 0);
+       clk[IMX5_CLK_TMAX2]             = imx_clk_gate2("tmax2", "ahb", MXC_CCM_CCGR1, 2);
+       clk[IMX5_CLK_TMAX3]             = imx_clk_gate2("tmax3", "ahb", MXC_CCM_CCGR1, 4);
+       clk[IMX5_CLK_SPBA]              = imx_clk_gate2("spba", "ipg", MXC_CCM_CCGR5, 0);
+       clk[IMX5_CLK_IPG]               = imx_clk_divider("ipg", "ahb", MXC_CCM_CBCDR, 8, 2);
+       clk[IMX5_CLK_AXI_A]             = imx_clk_divider("axi_a", "main_bus", MXC_CCM_CBCDR, 16, 3);
+       clk[IMX5_CLK_AXI_B]             = imx_clk_divider("axi_b", "main_bus", MXC_CCM_CBCDR, 19, 3);
+       clk[IMX5_CLK_UART_SEL]          = imx_clk_mux("uart_sel", MXC_CCM_CSCMR1, 24, 2,
+                                               standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
+       clk[IMX5_CLK_UART_PRED]         = imx_clk_divider("uart_pred", "uart_sel", MXC_CCM_CSCDR1, 3, 3);
+       clk[IMX5_CLK_UART_ROOT]         = imx_clk_divider("uart_root", "uart_pred", MXC_CCM_CSCDR1, 0, 3);
+
+       clk[IMX5_CLK_ESDHC_A_SEL]       = imx_clk_mux("esdhc_a_sel", MXC_CCM_CSCMR1, 20, 2,
+                                               standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
+       clk[IMX5_CLK_ESDHC_B_SEL]       = imx_clk_mux("esdhc_b_sel", MXC_CCM_CSCMR1, 16, 2,
+                                               standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
+       clk[IMX5_CLK_ESDHC_A_PRED]      = imx_clk_divider("esdhc_a_pred", "esdhc_a_sel", MXC_CCM_CSCDR1, 16, 3);
+       clk[IMX5_CLK_ESDHC_A_PODF]      = imx_clk_divider("esdhc_a_podf", "esdhc_a_pred", MXC_CCM_CSCDR1, 11, 3);
+       clk[IMX5_CLK_ESDHC_B_PRED]      = imx_clk_divider("esdhc_b_pred", "esdhc_b_sel", MXC_CCM_CSCDR1, 22, 3);
+       clk[IMX5_CLK_ESDHC_B_PODF]      = imx_clk_divider("esdhc_b_podf", "esdhc_b_pred", MXC_CCM_CSCDR1, 19, 3);
+       clk[IMX5_CLK_ESDHC_C_SEL]       = imx_clk_mux("esdhc_c_sel", MXC_CCM_CSCMR1, 19, 1, esdhc_c_sel, ARRAY_SIZE(esdhc_c_sel));
+       clk[IMX5_CLK_ESDHC_D_SEL]       = imx_clk_mux("esdhc_d_sel", MXC_CCM_CSCMR1, 18, 1, esdhc_d_sel, ARRAY_SIZE(esdhc_d_sel));
+
+       clk[IMX5_CLK_EMI_SEL]           = imx_clk_mux("emi_sel", MXC_CCM_CBCDR, 26, 1,
+                                               emi_slow_sel, ARRAY_SIZE(emi_slow_sel));
+       clk[IMX5_CLK_EMI_SLOW_PODF]     = imx_clk_divider("emi_slow_podf", "emi_sel", MXC_CCM_CBCDR, 22, 3);
+       clk[IMX5_CLK_NFC_PODF]          = imx_clk_divider("nfc_podf", "emi_slow_podf", MXC_CCM_CBCDR, 13, 3);
+       clk[IMX5_CLK_ECSPI_SEL]         = imx_clk_mux("ecspi_sel", MXC_CCM_CSCMR1, 4, 2,
+                                               standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
+       clk[IMX5_CLK_ECSPI_PRED]        = imx_clk_divider("ecspi_pred", "ecspi_sel", MXC_CCM_CSCDR2, 25, 3);
+       clk[IMX5_CLK_ECSPI_PODF]        = imx_clk_divider("ecspi_podf", "ecspi_pred", MXC_CCM_CSCDR2, 19, 6);
+       clk[IMX5_CLK_USBOH3_SEL]        = imx_clk_mux("usboh3_sel", MXC_CCM_CSCMR1, 22, 2,
+                                               standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
+       clk[IMX5_CLK_USBOH3_PRED]       = imx_clk_divider("usboh3_pred", "usboh3_sel", MXC_CCM_CSCDR1, 8, 3);
+       clk[IMX5_CLK_USBOH3_PODF]       = imx_clk_divider("usboh3_podf", "usboh3_pred", MXC_CCM_CSCDR1, 6, 2);
+       clk[IMX5_CLK_USB_PHY_PRED]      = imx_clk_divider("usb_phy_pred", "pll3_sw", MXC_CCM_CDCDR, 3, 3);
+       clk[IMX5_CLK_USB_PHY_PODF]      = imx_clk_divider("usb_phy_podf", "usb_phy_pred", MXC_CCM_CDCDR, 0, 3);
+       clk[IMX5_CLK_USB_PHY_SEL]       = imx_clk_mux("usb_phy_sel", MXC_CCM_CSCMR1, 26, 1,
+                                               usb_phy_sel_str, ARRAY_SIZE(usb_phy_sel_str));
+       clk[IMX5_CLK_CPU_PODF]          = imx_clk_divider("cpu_podf", "pll1_sw", MXC_CCM_CACRR, 0, 3);
+       clk[IMX5_CLK_DI_PRED]           = imx_clk_divider("di_pred", "pll3_sw", MXC_CCM_CDCDR, 6, 3);
+       clk[IMX5_CLK_IIM_GATE]          = imx_clk_gate2("iim_gate", "ipg", MXC_CCM_CCGR0, 30);
+       clk[IMX5_CLK_UART1_IPG_GATE]    = imx_clk_gate2("uart1_ipg_gate", "ipg", MXC_CCM_CCGR1, 6);
+       clk[IMX5_CLK_UART1_PER_GATE]    = imx_clk_gate2("uart1_per_gate", "uart_root", MXC_CCM_CCGR1, 8);
+       clk[IMX5_CLK_UART2_IPG_GATE]    = imx_clk_gate2("uart2_ipg_gate", "ipg", MXC_CCM_CCGR1, 10);
+       clk[IMX5_CLK_UART2_PER_GATE]    = imx_clk_gate2("uart2_per_gate", "uart_root", MXC_CCM_CCGR1, 12);
+       clk[IMX5_CLK_UART3_IPG_GATE]    = imx_clk_gate2("uart3_ipg_gate", "ipg", MXC_CCM_CCGR1, 14);
+       clk[IMX5_CLK_UART3_PER_GATE]    = imx_clk_gate2("uart3_per_gate", "uart_root", MXC_CCM_CCGR1, 16);
+       clk[IMX5_CLK_I2C1_GATE]         = imx_clk_gate2("i2c1_gate", "per_root", MXC_CCM_CCGR1, 18);
+       clk[IMX5_CLK_I2C2_GATE]         = imx_clk_gate2("i2c2_gate", "per_root", MXC_CCM_CCGR1, 20);
+       clk[IMX5_CLK_PWM1_IPG_GATE]     = imx_clk_gate2("pwm1_ipg_gate", "ipg", MXC_CCM_CCGR2, 10);
+       clk[IMX5_CLK_PWM1_HF_GATE]      = imx_clk_gate2("pwm1_hf_gate", "per_root", MXC_CCM_CCGR2, 12);
+       clk[IMX5_CLK_PWM2_IPG_GATE]     = imx_clk_gate2("pwm2_ipg_gate", "ipg", MXC_CCM_CCGR2, 14);
+       clk[IMX5_CLK_PWM2_HF_GATE]      = imx_clk_gate2("pwm2_hf_gate", "per_root", MXC_CCM_CCGR2, 16);
+       clk[IMX5_CLK_GPT_IPG_GATE]      = imx_clk_gate2("gpt_ipg_gate", "ipg", MXC_CCM_CCGR2, 18);
+       clk[IMX5_CLK_GPT_HF_GATE]       = imx_clk_gate2("gpt_hf_gate", "per_root", MXC_CCM_CCGR2, 20);
+       clk[IMX5_CLK_FEC_GATE]          = imx_clk_gate2("fec_gate", "ipg", MXC_CCM_CCGR2, 24);
+       clk[IMX5_CLK_USBOH3_GATE]       = imx_clk_gate2("usboh3_gate", "ipg", MXC_CCM_CCGR2, 26);
+       clk[IMX5_CLK_USBOH3_PER_GATE]   = imx_clk_gate2("usboh3_per_gate", "usboh3_podf", MXC_CCM_CCGR2, 28);
+       clk[IMX5_CLK_ESDHC1_IPG_GATE]   = imx_clk_gate2("esdhc1_ipg_gate", "ipg", MXC_CCM_CCGR3, 0);
+       clk[IMX5_CLK_ESDHC2_IPG_GATE]   = imx_clk_gate2("esdhc2_ipg_gate", "ipg", MXC_CCM_CCGR3, 4);
+       clk[IMX5_CLK_ESDHC3_IPG_GATE]   = imx_clk_gate2("esdhc3_ipg_gate", "ipg", MXC_CCM_CCGR3, 8);
+       clk[IMX5_CLK_ESDHC4_IPG_GATE]   = imx_clk_gate2("esdhc4_ipg_gate", "ipg", MXC_CCM_CCGR3, 12);
+       clk[IMX5_CLK_SSI1_IPG_GATE]     = imx_clk_gate2("ssi1_ipg_gate", "ipg", MXC_CCM_CCGR3, 16);
+       clk[IMX5_CLK_SSI2_IPG_GATE]     = imx_clk_gate2("ssi2_ipg_gate", "ipg", MXC_CCM_CCGR3, 20);
+       clk[IMX5_CLK_SSI3_IPG_GATE]     = imx_clk_gate2("ssi3_ipg_gate", "ipg", MXC_CCM_CCGR3, 24);
+       clk[IMX5_CLK_ECSPI1_IPG_GATE]   = imx_clk_gate2("ecspi1_ipg_gate", "ipg", MXC_CCM_CCGR4, 18);
+       clk[IMX5_CLK_ECSPI1_PER_GATE]   = imx_clk_gate2("ecspi1_per_gate", "ecspi_podf", MXC_CCM_CCGR4, 20);
+       clk[IMX5_CLK_ECSPI2_IPG_GATE]   = imx_clk_gate2("ecspi2_ipg_gate", "ipg", MXC_CCM_CCGR4, 22);
+       clk[IMX5_CLK_ECSPI2_PER_GATE]   = imx_clk_gate2("ecspi2_per_gate", "ecspi_podf", MXC_CCM_CCGR4, 24);
+       clk[IMX5_CLK_CSPI_IPG_GATE]     = imx_clk_gate2("cspi_ipg_gate", "ipg", MXC_CCM_CCGR4, 26);
+       clk[IMX5_CLK_SDMA_GATE]         = imx_clk_gate2("sdma_gate", "ipg", MXC_CCM_CCGR4, 30);
+       clk[IMX5_CLK_EMI_FAST_GATE]     = imx_clk_gate2("emi_fast_gate", "dummy", MXC_CCM_CCGR5, 14);
+       clk[IMX5_CLK_EMI_SLOW_GATE]     = imx_clk_gate2("emi_slow_gate", "emi_slow_podf", MXC_CCM_CCGR5, 16);
+       clk[IMX5_CLK_IPU_SEL]           = imx_clk_mux("ipu_sel", MXC_CCM_CBCMR, 6, 2, ipu_sel, ARRAY_SIZE(ipu_sel));
+       clk[IMX5_CLK_IPU_GATE]          = imx_clk_gate2("ipu_gate", "ipu_sel", MXC_CCM_CCGR5, 10);
+       clk[IMX5_CLK_NFC_GATE]          = imx_clk_gate2("nfc_gate", "nfc_podf", MXC_CCM_CCGR5, 20);
+       clk[IMX5_CLK_IPU_DI0_GATE]      = imx_clk_gate2("ipu_di0_gate", "ipu_di0_sel", MXC_CCM_CCGR6, 10);
+       clk[IMX5_CLK_IPU_DI1_GATE]      = imx_clk_gate2("ipu_di1_gate", "ipu_di1_sel", MXC_CCM_CCGR6, 12);
+       clk[IMX5_CLK_GPU3D_SEL]         = imx_clk_mux("gpu3d_sel", MXC_CCM_CBCMR, 4, 2, gpu3d_sel, ARRAY_SIZE(gpu3d_sel));
+       clk[IMX5_CLK_GPU2D_SEL]         = imx_clk_mux("gpu2d_sel", MXC_CCM_CBCMR, 16, 2, gpu2d_sel, ARRAY_SIZE(gpu2d_sel));
+       clk[IMX5_CLK_GPU3D_GATE]        = imx_clk_gate2("gpu3d_gate", "gpu3d_sel", MXC_CCM_CCGR5, 2);
+       clk[IMX5_CLK_GARB_GATE]         = imx_clk_gate2("garb_gate", "axi_a", MXC_CCM_CCGR5, 4);
+       clk[IMX5_CLK_GPU2D_GATE]        = imx_clk_gate2("gpu2d_gate", "gpu2d_sel", MXC_CCM_CCGR6, 14);
+       clk[IMX5_CLK_VPU_SEL]           = imx_clk_mux("vpu_sel", MXC_CCM_CBCMR, 14, 2, vpu_sel, ARRAY_SIZE(vpu_sel));
+       clk[IMX5_CLK_VPU_GATE]          = imx_clk_gate2("vpu_gate", "vpu_sel", MXC_CCM_CCGR5, 6);
+       clk[IMX5_CLK_VPU_REFERENCE_GATE] = imx_clk_gate2("vpu_reference_gate", "osc", MXC_CCM_CCGR5, 8);
+       clk[IMX5_CLK_UART4_IPG_GATE]    = imx_clk_gate2("uart4_ipg_gate", "ipg", MXC_CCM_CCGR7, 8);
+       clk[IMX5_CLK_UART4_PER_GATE]    = imx_clk_gate2("uart4_per_gate", "uart_root", MXC_CCM_CCGR7, 10);
+       clk[IMX5_CLK_UART5_IPG_GATE]    = imx_clk_gate2("uart5_ipg_gate", "ipg", MXC_CCM_CCGR7, 12);
+       clk[IMX5_CLK_UART5_PER_GATE]    = imx_clk_gate2("uart5_per_gate", "uart_root", MXC_CCM_CCGR7, 14);
+       clk[IMX5_CLK_GPC_DVFS]          = imx_clk_gate2("gpc_dvfs", "dummy", MXC_CCM_CCGR5, 24);
+
+       clk[IMX5_CLK_SSI_APM]           = imx_clk_mux("ssi_apm", MXC_CCM_CSCMR1, 8, 2, ssi_apm_sels, ARRAY_SIZE(ssi_apm_sels));
+       clk[IMX5_CLK_SSI1_ROOT_SEL]     = imx_clk_mux("ssi1_root_sel", MXC_CCM_CSCMR1, 14, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
+       clk[IMX5_CLK_SSI2_ROOT_SEL]     = imx_clk_mux("ssi2_root_sel", MXC_CCM_CSCMR1, 12, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
+       clk[IMX5_CLK_SSI3_ROOT_SEL]     = imx_clk_mux("ssi3_root_sel", MXC_CCM_CSCMR1, 11, 1, ssi3_clk_sels, ARRAY_SIZE(ssi3_clk_sels));
+       clk[IMX5_CLK_SSI_EXT1_SEL]      = imx_clk_mux("ssi_ext1_sel", MXC_CCM_CSCMR1, 28, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
+       clk[IMX5_CLK_SSI_EXT2_SEL]      = imx_clk_mux("ssi_ext2_sel", MXC_CCM_CSCMR1, 30, 2, ssi_clk_sels, ARRAY_SIZE(ssi_clk_sels));
+       clk[IMX5_CLK_SSI_EXT1_COM_SEL]  = imx_clk_mux("ssi_ext1_com_sel", MXC_CCM_CSCMR1, 0, 1, ssi_ext1_com_sels, ARRAY_SIZE(ssi_ext1_com_sels));
+       clk[IMX5_CLK_SSI_EXT2_COM_SEL]  = imx_clk_mux("ssi_ext2_com_sel", MXC_CCM_CSCMR1, 1, 1, ssi_ext2_com_sels, ARRAY_SIZE(ssi_ext2_com_sels));
+       clk[IMX5_CLK_SSI1_ROOT_PRED]    = imx_clk_divider("ssi1_root_pred", "ssi1_root_sel", MXC_CCM_CS1CDR, 6, 3);
+       clk[IMX5_CLK_SSI1_ROOT_PODF]    = imx_clk_divider("ssi1_root_podf", "ssi1_root_pred", MXC_CCM_CS1CDR, 0, 6);
+       clk[IMX5_CLK_SSI2_ROOT_PRED]    = imx_clk_divider("ssi2_root_pred", "ssi2_root_sel", MXC_CCM_CS2CDR, 6, 3);
+       clk[IMX5_CLK_SSI2_ROOT_PODF]    = imx_clk_divider("ssi2_root_podf", "ssi2_root_pred", MXC_CCM_CS2CDR, 0, 6);
+       clk[IMX5_CLK_SSI_EXT1_PRED]     = imx_clk_divider("ssi_ext1_pred", "ssi_ext1_sel", MXC_CCM_CS1CDR, 22, 3);
+       clk[IMX5_CLK_SSI_EXT1_PODF]     = imx_clk_divider("ssi_ext1_podf", "ssi_ext1_pred", MXC_CCM_CS1CDR, 16, 6);
+       clk[IMX5_CLK_SSI_EXT2_PRED]     = imx_clk_divider("ssi_ext2_pred", "ssi_ext2_sel", MXC_CCM_CS2CDR, 22, 3);
+       clk[IMX5_CLK_SSI_EXT2_PODF]     = imx_clk_divider("ssi_ext2_podf", "ssi_ext2_pred", MXC_CCM_CS2CDR, 16, 6);
+       clk[IMX5_CLK_SSI1_ROOT_GATE]    = imx_clk_gate2("ssi1_root_gate", "ssi1_root_podf", MXC_CCM_CCGR3, 18);
+       clk[IMX5_CLK_SSI2_ROOT_GATE]    = imx_clk_gate2("ssi2_root_gate", "ssi2_root_podf", MXC_CCM_CCGR3, 22);
+       clk[IMX5_CLK_SSI3_ROOT_GATE]    = imx_clk_gate2("ssi3_root_gate", "ssi3_root_sel", MXC_CCM_CCGR3, 26);
+       clk[IMX5_CLK_SSI_EXT1_GATE]     = imx_clk_gate2("ssi_ext1_gate", "ssi_ext1_com_sel", MXC_CCM_CCGR3, 28);
+       clk[IMX5_CLK_SSI_EXT2_GATE]     = imx_clk_gate2("ssi_ext2_gate", "ssi_ext2_com_sel", MXC_CCM_CCGR3, 30);
+       clk[IMX5_CLK_EPIT1_IPG_GATE]    = imx_clk_gate2("epit1_ipg_gate", "ipg", MXC_CCM_CCGR2, 2);
+       clk[IMX5_CLK_EPIT1_HF_GATE]     = imx_clk_gate2("epit1_hf_gate", "per_root", MXC_CCM_CCGR2, 4);
+       clk[IMX5_CLK_EPIT2_IPG_GATE]    = imx_clk_gate2("epit2_ipg_gate", "ipg", MXC_CCM_CCGR2, 6);
+       clk[IMX5_CLK_EPIT2_HF_GATE]     = imx_clk_gate2("epit2_hf_gate", "per_root", MXC_CCM_CCGR2, 8);
+       clk[IMX5_CLK_OWIRE_GATE]        = imx_clk_gate2("owire_gate", "per_root", MXC_CCM_CCGR2, 22);
+       clk[IMX5_CLK_SRTC_GATE]         = imx_clk_gate2("srtc_gate", "per_root", MXC_CCM_CCGR4, 28);
+       clk[IMX5_CLK_PATA_GATE]         = imx_clk_gate2("pata_gate", "ipg", MXC_CCM_CCGR4, 0);
+       clk[IMX5_CLK_SPDIF0_SEL]        = imx_clk_mux("spdif0_sel", MXC_CCM_CSCMR2, 0, 2, spdif_sel, ARRAY_SIZE(spdif_sel));
+       clk[IMX5_CLK_SPDIF0_PRED]       = imx_clk_divider("spdif0_pred", "spdif0_sel", MXC_CCM_CDCDR, 25, 3);
+       clk[IMX5_CLK_SPDIF0_PODF]       = imx_clk_divider("spdif0_podf", "spdif0_pred", MXC_CCM_CDCDR, 19, 6);
+       clk[IMX5_CLK_SPDIF0_COM_SEL]    = imx_clk_mux_flags("spdif0_com_sel", MXC_CCM_CSCMR2, 4, 1,
+                                               spdif0_com_sel, ARRAY_SIZE(spdif0_com_sel), CLK_SET_RATE_PARENT);
+       clk[IMX5_CLK_SPDIF0_GATE]       = imx_clk_gate2("spdif0_gate", "spdif0_com_sel", MXC_CCM_CCGR5, 26);
+       clk[IMX5_CLK_SPDIF_IPG_GATE]    = imx_clk_gate2("spdif_ipg_gate", "ipg", MXC_CCM_CCGR5, 30);
+       clk[IMX5_CLK_SAHARA_IPG_GATE]   = imx_clk_gate2("sahara_ipg_gate", "ipg", MXC_CCM_CCGR4, 14);
+       clk[IMX5_CLK_SATA_REF]          = imx_clk_fixed_factor("sata_ref", "usb_phy1_gate", 1, 1);
 
        for (i = 0; i < ARRAY_SIZE(clk); i++)
                if (IS_ERR(clk[i]))
                        pr_err("i.MX5 clk %d: register failed with %ld\n",
                                i, PTR_ERR(clk[i]));
 
-       clk_register_clkdev(clk[gpt_hf_gate], "per", "imx-gpt.0");
-       clk_register_clkdev(clk[gpt_ipg_gate], "ipg", "imx-gpt.0");
-       clk_register_clkdev(clk[uart1_per_gate], "per", "imx21-uart.0");
-       clk_register_clkdev(clk[uart1_ipg_gate], "ipg", "imx21-uart.0");
-       clk_register_clkdev(clk[uart2_per_gate], "per", "imx21-uart.1");
-       clk_register_clkdev(clk[uart2_ipg_gate], "ipg", "imx21-uart.1");
-       clk_register_clkdev(clk[uart3_per_gate], "per", "imx21-uart.2");
-       clk_register_clkdev(clk[uart3_ipg_gate], "ipg", "imx21-uart.2");
-       clk_register_clkdev(clk[uart4_per_gate], "per", "imx21-uart.3");
-       clk_register_clkdev(clk[uart4_ipg_gate], "ipg", "imx21-uart.3");
-       clk_register_clkdev(clk[uart5_per_gate], "per", "imx21-uart.4");
-       clk_register_clkdev(clk[uart5_ipg_gate], "ipg", "imx21-uart.4");
-       clk_register_clkdev(clk[ecspi1_per_gate], "per", "imx51-ecspi.0");
-       clk_register_clkdev(clk[ecspi1_ipg_gate], "ipg", "imx51-ecspi.0");
-       clk_register_clkdev(clk[ecspi2_per_gate], "per", "imx51-ecspi.1");
-       clk_register_clkdev(clk[ecspi2_ipg_gate], "ipg", "imx51-ecspi.1");
-       clk_register_clkdev(clk[cspi_ipg_gate], NULL, "imx35-cspi.2");
-       clk_register_clkdev(clk[pwm1_ipg_gate], "pwm", "mxc_pwm.0");
-       clk_register_clkdev(clk[pwm2_ipg_gate], "pwm", "mxc_pwm.1");
-       clk_register_clkdev(clk[i2c1_gate], NULL, "imx21-i2c.0");
-       clk_register_clkdev(clk[i2c2_gate], NULL, "imx21-i2c.1");
-       clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.0");
-       clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.0");
-       clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.0");
-       clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.1");
-       clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.1");
-       clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.1");
-       clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.2");
-       clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.2");
-       clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.2");
-       clk_register_clkdev(clk[usboh3_per_gate], "per", "imx-udc-mx51");
-       clk_register_clkdev(clk[usboh3_gate], "ipg", "imx-udc-mx51");
-       clk_register_clkdev(clk[usboh3_gate], "ahb", "imx-udc-mx51");
-       clk_register_clkdev(clk[nfc_gate], NULL, "imx51-nand");
-       clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0");
-       clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1");
-       clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "imx-ssi.2");
-       clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma");
-       clk_register_clkdev(clk[cpu_podf], NULL, "cpu0");
-       clk_register_clkdev(clk[iim_gate], "iim", NULL);
-       clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.0");
-       clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.1");
-       clk_register_clkdev(clk[dummy], NULL, "imx-keypad");
-       clk_register_clkdev(clk[ipu_di1_gate], "di1", "imx-tve.0");
-       clk_register_clkdev(clk[gpc_dvfs], "gpc_dvfs", NULL);
-       clk_register_clkdev(clk[epit1_ipg_gate], "ipg", "imx-epit.0");
-       clk_register_clkdev(clk[epit1_hf_gate], "per", "imx-epit.0");
-       clk_register_clkdev(clk[epit2_ipg_gate], "ipg", "imx-epit.1");
-       clk_register_clkdev(clk[epit2_hf_gate], "per", "imx-epit.1");
+       clk_register_clkdev(clk[IMX5_CLK_GPT_HF_GATE], "per", "imx-gpt.0");
+       clk_register_clkdev(clk[IMX5_CLK_GPT_IPG_GATE], "ipg", "imx-gpt.0");
+       clk_register_clkdev(clk[IMX5_CLK_UART1_PER_GATE], "per", "imx21-uart.0");
+       clk_register_clkdev(clk[IMX5_CLK_UART1_IPG_GATE], "ipg", "imx21-uart.0");
+       clk_register_clkdev(clk[IMX5_CLK_UART2_PER_GATE], "per", "imx21-uart.1");
+       clk_register_clkdev(clk[IMX5_CLK_UART2_IPG_GATE], "ipg", "imx21-uart.1");
+       clk_register_clkdev(clk[IMX5_CLK_UART3_PER_GATE], "per", "imx21-uart.2");
+       clk_register_clkdev(clk[IMX5_CLK_UART3_IPG_GATE], "ipg", "imx21-uart.2");
+       clk_register_clkdev(clk[IMX5_CLK_UART4_PER_GATE], "per", "imx21-uart.3");
+       clk_register_clkdev(clk[IMX5_CLK_UART4_IPG_GATE], "ipg", "imx21-uart.3");
+       clk_register_clkdev(clk[IMX5_CLK_UART5_PER_GATE], "per", "imx21-uart.4");
+       clk_register_clkdev(clk[IMX5_CLK_UART5_IPG_GATE], "ipg", "imx21-uart.4");
+       clk_register_clkdev(clk[IMX5_CLK_ECSPI1_PER_GATE], "per", "imx51-ecspi.0");
+       clk_register_clkdev(clk[IMX5_CLK_ECSPI1_IPG_GATE], "ipg", "imx51-ecspi.0");
+       clk_register_clkdev(clk[IMX5_CLK_ECSPI2_PER_GATE], "per", "imx51-ecspi.1");
+       clk_register_clkdev(clk[IMX5_CLK_ECSPI2_IPG_GATE], "ipg", "imx51-ecspi.1");
+       clk_register_clkdev(clk[IMX5_CLK_CSPI_IPG_GATE], NULL, "imx35-cspi.2");
+       clk_register_clkdev(clk[IMX5_CLK_PWM1_IPG_GATE], "pwm", "mxc_pwm.0");
+       clk_register_clkdev(clk[IMX5_CLK_PWM2_IPG_GATE], "pwm", "mxc_pwm.1");
+       clk_register_clkdev(clk[IMX5_CLK_I2C1_GATE], NULL, "imx21-i2c.0");
+       clk_register_clkdev(clk[IMX5_CLK_I2C2_GATE], NULL, "imx21-i2c.1");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "mxc-ehci.0");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "mxc-ehci.0");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "mxc-ehci.0");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "mxc-ehci.1");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "mxc-ehci.1");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "mxc-ehci.1");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "mxc-ehci.2");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "mxc-ehci.2");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "mxc-ehci.2");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "imx-udc-mx51");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ipg", "imx-udc-mx51");
+       clk_register_clkdev(clk[IMX5_CLK_USBOH3_GATE], "ahb", "imx-udc-mx51");
+       clk_register_clkdev(clk[IMX5_CLK_NFC_GATE], NULL, "imx51-nand");
+       clk_register_clkdev(clk[IMX5_CLK_SSI1_IPG_GATE], NULL, "imx-ssi.0");
+       clk_register_clkdev(clk[IMX5_CLK_SSI2_IPG_GATE], NULL, "imx-ssi.1");
+       clk_register_clkdev(clk[IMX5_CLK_SSI3_IPG_GATE], NULL, "imx-ssi.2");
+       clk_register_clkdev(clk[IMX5_CLK_SDMA_GATE], NULL, "imx35-sdma");
+       clk_register_clkdev(clk[IMX5_CLK_CPU_PODF], NULL, "cpu0");
+       clk_register_clkdev(clk[IMX5_CLK_IIM_GATE], "iim", NULL);
+       clk_register_clkdev(clk[IMX5_CLK_DUMMY], NULL, "imx2-wdt.0");
+       clk_register_clkdev(clk[IMX5_CLK_DUMMY], NULL, "imx2-wdt.1");
+       clk_register_clkdev(clk[IMX5_CLK_DUMMY], NULL, "imx-keypad");
+       clk_register_clkdev(clk[IMX5_CLK_IPU_DI1_GATE], "di1", "imx-tve.0");
+       clk_register_clkdev(clk[IMX5_CLK_GPC_DVFS], "gpc_dvfs", NULL);
+       clk_register_clkdev(clk[IMX5_CLK_EPIT1_IPG_GATE], "ipg", "imx-epit.0");
+       clk_register_clkdev(clk[IMX5_CLK_EPIT1_HF_GATE], "per", "imx-epit.0");
+       clk_register_clkdev(clk[IMX5_CLK_EPIT2_IPG_GATE], "ipg", "imx-epit.1");
+       clk_register_clkdev(clk[IMX5_CLK_EPIT2_HF_GATE], "per", "imx-epit.1");
 
        /* Set SDHC parents to be PLL2 */
-       clk_set_parent(clk[esdhc_a_sel], clk[pll2_sw]);
-       clk_set_parent(clk[esdhc_b_sel], clk[pll2_sw]);
+       clk_set_parent(clk[IMX5_CLK_ESDHC_A_SEL], clk[IMX5_CLK_PLL2_SW]);
+       clk_set_parent(clk[IMX5_CLK_ESDHC_B_SEL], clk[IMX5_CLK_PLL2_SW]);
 
        /* move usb phy clk to 24MHz */
-       clk_set_parent(clk[usb_phy_sel], clk[osc]);
-
-       clk_prepare_enable(clk[gpc_dvfs]);
-       clk_prepare_enable(clk[ahb_max]); /* esdhc3 */
-       clk_prepare_enable(clk[aips_tz1]);
-       clk_prepare_enable(clk[aips_tz2]); /* fec */
-       clk_prepare_enable(clk[spba]);
-       clk_prepare_enable(clk[emi_fast_gate]); /* fec */
-       clk_prepare_enable(clk[emi_slow_gate]); /* eim */
-       clk_prepare_enable(clk[mipi_hsc1_gate]);
-       clk_prepare_enable(clk[mipi_hsc2_gate]);
-       clk_prepare_enable(clk[mipi_esc_gate]);
-       clk_prepare_enable(clk[mipi_hsp_gate]);
-       clk_prepare_enable(clk[tmax1]);
-       clk_prepare_enable(clk[tmax2]); /* esdhc2, fec */
-       clk_prepare_enable(clk[tmax3]); /* esdhc1, esdhc4 */
+       clk_set_parent(clk[IMX5_CLK_USB_PHY_SEL], clk[IMX5_CLK_OSC]);
+
+       clk_prepare_enable(clk[IMX5_CLK_GPC_DVFS]);
+       clk_prepare_enable(clk[IMX5_CLK_AHB_MAX]); /* esdhc3 */
+       clk_prepare_enable(clk[IMX5_CLK_AIPS_TZ1]);
+       clk_prepare_enable(clk[IMX5_CLK_AIPS_TZ2]); /* fec */
+       clk_prepare_enable(clk[IMX5_CLK_SPBA]);
+       clk_prepare_enable(clk[IMX5_CLK_EMI_FAST_GATE]); /* fec */
+       clk_prepare_enable(clk[IMX5_CLK_EMI_SLOW_GATE]); /* eim */
+       clk_prepare_enable(clk[IMX5_CLK_MIPI_HSC1_GATE]);
+       clk_prepare_enable(clk[IMX5_CLK_MIPI_HSC2_GATE]);
+       clk_prepare_enable(clk[IMX5_CLK_MIPI_ESC_GATE]);
+       clk_prepare_enable(clk[IMX5_CLK_MIPI_HSP_GATE]);
+       clk_prepare_enable(clk[IMX5_CLK_TMAX1]);
+       clk_prepare_enable(clk[IMX5_CLK_TMAX2]); /* esdhc2, fec */
+       clk_prepare_enable(clk[IMX5_CLK_TMAX3]); /* esdhc1, esdhc4 */
 }
 
+static void __init mx50_clocks_init(struct device_node *np)
+{
+       void __iomem *base;
+       unsigned long r;
+       int i, irq;
+
+       clk[IMX5_CLK_PLL1_SW]           = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
+       clk[IMX5_CLK_PLL2_SW]           = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
+       clk[IMX5_CLK_PLL3_SW]           = imx_clk_pllv2("pll3_sw", "osc", MX53_DPLL3_BASE);
+
+       clk[IMX5_CLK_LP_APM]            = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1,
+                                               lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
+       clk[IMX5_CLK_ESDHC1_PER_GATE]   = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
+       clk[IMX5_CLK_ESDHC2_PER_GATE]   = imx_clk_gate2("esdhc2_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 6);
+       clk[IMX5_CLK_ESDHC3_PER_GATE]   = imx_clk_gate2("esdhc3_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 10);
+       clk[IMX5_CLK_ESDHC4_PER_GATE]   = imx_clk_gate2("esdhc4_per_gate", "esdhc_d_sel", MXC_CCM_CCGR3, 14);
+       clk[IMX5_CLK_USB_PHY1_GATE]     = imx_clk_gate2("usb_phy1_gate", "usb_phy_sel", MXC_CCM_CCGR4, 10);
+       clk[IMX5_CLK_USB_PHY2_GATE]     = imx_clk_gate2("usb_phy2_gate", "usb_phy_sel", MXC_CCM_CCGR4, 12);
+       clk[IMX5_CLK_I2C3_GATE]         = imx_clk_gate2("i2c3_gate", "per_root", MXC_CCM_CCGR1, 22);
+
+       clk[IMX5_CLK_CKO1_SEL]          = imx_clk_mux("cko1_sel", MXC_CCM_CCOSR, 0, 4,
+                                               mx53_cko1_sel, ARRAY_SIZE(mx53_cko1_sel));
+       clk[IMX5_CLK_CKO1_PODF]         = imx_clk_divider("cko1_podf", "cko1_sel", MXC_CCM_CCOSR, 4, 3);
+       clk[IMX5_CLK_CKO1]              = imx_clk_gate2("cko1", "cko1_podf", MXC_CCM_CCOSR, 7);
+
+       clk[IMX5_CLK_CKO2_SEL]          = imx_clk_mux("cko2_sel", MXC_CCM_CCOSR, 16, 5,
+                                               mx53_cko2_sel, ARRAY_SIZE(mx53_cko2_sel));
+       clk[IMX5_CLK_CKO2_PODF]         = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3);
+       clk[IMX5_CLK_CKO2]              = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24);
+
+       for (i = 0; i < ARRAY_SIZE(clk); i++)
+               if (IS_ERR(clk[i]))
+                       pr_err("i.MX50 clk %d: register failed with %ld\n",
+                               i, PTR_ERR(clk[i]));
+
+       clk_data.clks = clk;
+       clk_data.clk_num = ARRAY_SIZE(clk);
+       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+
+       mx5_clocks_common_init(0, 0, 0, 0);
+
+       /* set SDHC root clock to 200MHZ*/
+       clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000);
+       clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000);
+
+       clk_prepare_enable(clk[IMX5_CLK_IIM_GATE]);
+       imx_print_silicon_rev("i.MX50", IMX_CHIP_REVISION_1_1);
+       clk_disable_unprepare(clk[IMX5_CLK_IIM_GATE]);
+
+       r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000);
+       clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r);
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx50-gpt");
+       base = of_iomap(np, 0);
+       WARN_ON(!base);
+       irq = irq_of_parse_and_map(np, 0);
+       mxc_timer_init(base, irq);
+}
+CLK_OF_DECLARE(imx50_ccm, "fsl,imx50-ccm", mx50_clocks_init);
+
 int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
                        unsigned long rate_ckih1, unsigned long rate_ckih2)
 {
@@ -372,38 +389,40 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
        u32 val;
        struct device_node *np;
 
-       clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX51_DPLL1_BASE);
-       clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX51_DPLL2_BASE);
-       clk[pll3_sw] = imx_clk_pllv2("pll3_sw", "osc", MX51_DPLL3_BASE);
-       clk[ipu_di0_sel] = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3,
-                               mx51_ipu_di0_sel, ARRAY_SIZE(mx51_ipu_di0_sel));
-       clk[ipu_di1_sel] = imx_clk_mux("ipu_di1_sel", MXC_CCM_CSCMR2, 29, 3,
-                               mx51_ipu_di1_sel, ARRAY_SIZE(mx51_ipu_di1_sel));
-       clk[tve_ext_sel] = imx_clk_mux_flags("tve_ext_sel", MXC_CCM_CSCMR1, 6, 1,
-                               mx51_tve_ext_sel, ARRAY_SIZE(mx51_tve_ext_sel), CLK_SET_RATE_PARENT);
-       clk[tve_s] = imx_clk_mux("tve_sel", MXC_CCM_CSCMR1, 7, 1,
-                               mx51_tve_sel, ARRAY_SIZE(mx51_tve_sel));
-       clk[tve_gate] = imx_clk_gate2("tve_gate", "tve_sel", MXC_CCM_CCGR2, 30);
-       clk[tve_pred] = imx_clk_divider("tve_pred", "pll3_sw", MXC_CCM_CDCDR, 28, 3);
-       clk[esdhc1_per_gate] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
-       clk[esdhc2_per_gate] = imx_clk_gate2("esdhc2_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 6);
-       clk[esdhc3_per_gate] = imx_clk_gate2("esdhc3_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 10);
-       clk[esdhc4_per_gate] = imx_clk_gate2("esdhc4_per_gate", "esdhc_d_sel", MXC_CCM_CCGR3, 14);
-       clk[usb_phy_gate] = imx_clk_gate2("usb_phy_gate", "usb_phy_sel", MXC_CCM_CCGR2, 0);
-       clk[hsi2c_gate] = imx_clk_gate2("hsi2c_gate", "ipg", MXC_CCM_CCGR1, 22);
-       clk[mipi_hsc1_gate] = imx_clk_gate2("mipi_hsc1_gate", "ipg", MXC_CCM_CCGR4, 6);
-       clk[mipi_hsc2_gate] = imx_clk_gate2("mipi_hsc2_gate", "ipg", MXC_CCM_CCGR4, 8);
-       clk[mipi_esc_gate] = imx_clk_gate2("mipi_esc_gate", "ipg", MXC_CCM_CCGR4, 10);
-       clk[mipi_hsp_gate] = imx_clk_gate2("mipi_hsp_gate", "ipg", MXC_CCM_CCGR4, 12);
-       clk[spdif_xtal_sel] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2,
-                               mx51_spdif_xtal_sel, ARRAY_SIZE(mx51_spdif_xtal_sel));
-       clk[spdif1_sel] = imx_clk_mux("spdif1_sel", MXC_CCM_CSCMR2, 2, 2,
-                               spdif_sel, ARRAY_SIZE(spdif_sel));
-       clk[spdif1_pred] = imx_clk_divider("spdif1_pred", "spdif1_sel", MXC_CCM_CDCDR, 16, 3);
-       clk[spdif1_podf] = imx_clk_divider("spdif1_podf", "spdif1_pred", MXC_CCM_CDCDR, 9, 6);
-       clk[spdif1_com_sel] = imx_clk_mux("spdif1_com_sel", MXC_CCM_CSCMR2, 5, 1,
-                               mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel));
-       clk[spdif1_gate] = imx_clk_gate2("spdif1_gate", "spdif1_com_sel", MXC_CCM_CCGR5, 28);
+       clk[IMX5_CLK_PLL1_SW]           = imx_clk_pllv2("pll1_sw", "osc", MX51_DPLL1_BASE);
+       clk[IMX5_CLK_PLL2_SW]           = imx_clk_pllv2("pll2_sw", "osc", MX51_DPLL2_BASE);
+       clk[IMX5_CLK_PLL3_SW]           = imx_clk_pllv2("pll3_sw", "osc", MX51_DPLL3_BASE);
+       clk[IMX5_CLK_LP_APM]            = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 9, 1,
+                                               lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
+       clk[IMX5_CLK_IPU_DI0_SEL]       = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3,
+                                               mx51_ipu_di0_sel, ARRAY_SIZE(mx51_ipu_di0_sel));
+       clk[IMX5_CLK_IPU_DI1_SEL]       = imx_clk_mux("ipu_di1_sel", MXC_CCM_CSCMR2, 29, 3,
+                                               mx51_ipu_di1_sel, ARRAY_SIZE(mx51_ipu_di1_sel));
+       clk[IMX5_CLK_TVE_EXT_SEL]       = imx_clk_mux_flags("tve_ext_sel", MXC_CCM_CSCMR1, 6, 1,
+                                               mx51_tve_ext_sel, ARRAY_SIZE(mx51_tve_ext_sel), CLK_SET_RATE_PARENT);
+       clk[IMX5_CLK_TVE_SEL]           = imx_clk_mux("tve_sel", MXC_CCM_CSCMR1, 7, 1,
+                                               mx51_tve_sel, ARRAY_SIZE(mx51_tve_sel));
+       clk[IMX5_CLK_TVE_GATE]          = imx_clk_gate2("tve_gate", "tve_sel", MXC_CCM_CCGR2, 30);
+       clk[IMX5_CLK_TVE_PRED]          = imx_clk_divider("tve_pred", "pll3_sw", MXC_CCM_CDCDR, 28, 3);
+       clk[IMX5_CLK_ESDHC1_PER_GATE]   = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
+       clk[IMX5_CLK_ESDHC2_PER_GATE]   = imx_clk_gate2("esdhc2_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 6);
+       clk[IMX5_CLK_ESDHC3_PER_GATE]   = imx_clk_gate2("esdhc3_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 10);
+       clk[IMX5_CLK_ESDHC4_PER_GATE]   = imx_clk_gate2("esdhc4_per_gate", "esdhc_d_sel", MXC_CCM_CCGR3, 14);
+       clk[IMX5_CLK_USB_PHY_GATE]      = imx_clk_gate2("usb_phy_gate", "usb_phy_sel", MXC_CCM_CCGR2, 0);
+       clk[IMX5_CLK_HSI2C_GATE]        = imx_clk_gate2("hsi2c_gate", "ipg", MXC_CCM_CCGR1, 22);
+       clk[IMX5_CLK_MIPI_HSC1_GATE]    = imx_clk_gate2("mipi_hsc1_gate", "ipg", MXC_CCM_CCGR4, 6);
+       clk[IMX5_CLK_MIPI_HSC2_GATE]    = imx_clk_gate2("mipi_hsc2_gate", "ipg", MXC_CCM_CCGR4, 8);
+       clk[IMX5_CLK_MIPI_ESC_GATE]     = imx_clk_gate2("mipi_esc_gate", "ipg", MXC_CCM_CCGR4, 10);
+       clk[IMX5_CLK_MIPI_HSP_GATE]     = imx_clk_gate2("mipi_hsp_gate", "ipg", MXC_CCM_CCGR4, 12);
+       clk[IMX5_CLK_SPDIF_XTAL_SEL]    = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2,
+                                               mx51_spdif_xtal_sel, ARRAY_SIZE(mx51_spdif_xtal_sel));
+       clk[IMX5_CLK_SPDIF1_SEL]        = imx_clk_mux("spdif1_sel", MXC_CCM_CSCMR2, 2, 2,
+                                               spdif_sel, ARRAY_SIZE(spdif_sel));
+       clk[IMX5_CLK_SPDIF1_PRED]       = imx_clk_divider("spdif1_pred", "spdif1_sel", MXC_CCM_CDCDR, 16, 3);
+       clk[IMX5_CLK_SPDIF1_PODF]       = imx_clk_divider("spdif1_podf", "spdif1_pred", MXC_CCM_CDCDR, 9, 6);
+       clk[IMX5_CLK_SPDIF1_COM_SEL]    = imx_clk_mux("spdif1_com_sel", MXC_CCM_CSCMR2, 5, 1,
+                                               mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel));
+       clk[IMX5_CLK_SPDIF1_GATE]       = imx_clk_gate2("spdif1_gate", "spdif1_com_sel", MXC_CCM_CCGR5, 28);
 
        for (i = 0; i < ARRAY_SIZE(clk); i++)
                if (IS_ERR(clk[i]))
@@ -417,37 +436,37 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
 
        mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2);
 
-       clk_register_clkdev(clk[hsi2c_gate], NULL, "imx21-i2c.2");
-       clk_register_clkdev(clk[mx51_mipi], "mipi_hsp", NULL);
-       clk_register_clkdev(clk[vpu_gate], NULL, "imx51-vpu.0");
-       clk_register_clkdev(clk[fec_gate], NULL, "imx27-fec.0");
-       clk_register_clkdev(clk[usb_phy_gate], "phy", "mxc-ehci.0");
-       clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx51.0");
-       clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.0");
-       clk_register_clkdev(clk[esdhc1_per_gate], "per", "sdhci-esdhc-imx51.0");
-       clk_register_clkdev(clk[esdhc2_ipg_gate], "ipg", "sdhci-esdhc-imx51.1");
-       clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.1");
-       clk_register_clkdev(clk[esdhc2_per_gate], "per", "sdhci-esdhc-imx51.1");
-       clk_register_clkdev(clk[esdhc3_ipg_gate], "ipg", "sdhci-esdhc-imx51.2");
-       clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.2");
-       clk_register_clkdev(clk[esdhc3_per_gate], "per", "sdhci-esdhc-imx51.2");
-       clk_register_clkdev(clk[esdhc4_ipg_gate], "ipg", "sdhci-esdhc-imx51.3");
-       clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.3");
-       clk_register_clkdev(clk[esdhc4_per_gate], "per", "sdhci-esdhc-imx51.3");
+       clk_register_clkdev(clk[IMX5_CLK_HSI2C_GATE], NULL, "imx21-i2c.2");
+       clk_register_clkdev(clk[IMX5_CLK_MX51_MIPI], "mipi_hsp", NULL);
+       clk_register_clkdev(clk[IMX5_CLK_VPU_GATE], NULL, "imx51-vpu.0");
+       clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx27-fec.0");
+       clk_register_clkdev(clk[IMX5_CLK_USB_PHY_GATE], "phy", "mxc-ehci.0");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC1_IPG_GATE], "ipg", "sdhci-esdhc-imx51.0");
+       clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.0");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC1_PER_GATE], "per", "sdhci-esdhc-imx51.0");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC2_IPG_GATE], "ipg", "sdhci-esdhc-imx51.1");
+       clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.1");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC2_PER_GATE], "per", "sdhci-esdhc-imx51.1");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC3_IPG_GATE], "ipg", "sdhci-esdhc-imx51.2");
+       clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.2");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC3_PER_GATE], "per", "sdhci-esdhc-imx51.2");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC4_IPG_GATE], "ipg", "sdhci-esdhc-imx51.3");
+       clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx51.3");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC4_PER_GATE], "per", "sdhci-esdhc-imx51.3");
 
        /* set the usboh3 parent to pll2_sw */
-       clk_set_parent(clk[usboh3_sel], clk[pll2_sw]);
+       clk_set_parent(clk[IMX5_CLK_USBOH3_SEL], clk[IMX5_CLK_PLL2_SW]);
 
        /* set SDHC root clock to 166.25MHZ*/
-       clk_set_rate(clk[esdhc_a_podf], 166250000);
-       clk_set_rate(clk[esdhc_b_podf], 166250000);
+       clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 166250000);
+       clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 166250000);
 
        /* System timer */
        mxc_timer_init(MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR), MX51_INT_GPT);
 
-       clk_prepare_enable(clk[iim_gate]);
+       clk_prepare_enable(clk[IMX5_CLK_IIM_GATE]);
        imx_print_silicon_rev("i.MX51", mx51_revision());
-       clk_disable_unprepare(clk[iim_gate]);
+       clk_disable_unprepare(clk[IMX5_CLK_IIM_GATE]);
 
        /*
         * Reference Manual says: Functionality of CCDR[18] and CLPCR[23] is no
@@ -479,57 +498,59 @@ static void __init mx53_clocks_init(struct device_node *np)
        unsigned long r;
        void __iomem *base;
 
-       clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
-       clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
-       clk[pll3_sw] = imx_clk_pllv2("pll3_sw", "osc", MX53_DPLL3_BASE);
-       clk[pll4_sw] = imx_clk_pllv2("pll4_sw", "osc", MX53_DPLL4_BASE);
-
-       clk[ldb_di1_div_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7);
-       clk[ldb_di1_div] = imx_clk_divider_flags("ldb_di1_div", "ldb_di1_div_3_5", MXC_CCM_CSCMR2, 11, 1, 0);
-       clk[ldb_di1_sel] = imx_clk_mux_flags("ldb_di1_sel", MXC_CCM_CSCMR2, 9, 1,
-                               mx53_ldb_di1_sel, ARRAY_SIZE(mx53_ldb_di1_sel), CLK_SET_RATE_PARENT);
-       clk[di_pll4_podf] = imx_clk_divider("di_pll4_podf", "pll4_sw", MXC_CCM_CDCDR, 16, 3);
-       clk[ldb_di0_div_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7);
-       clk[ldb_di0_div] = imx_clk_divider_flags("ldb_di0_div", "ldb_di0_div_3_5", MXC_CCM_CSCMR2, 10, 1, 0);
-       clk[ldb_di0_sel] = imx_clk_mux_flags("ldb_di0_sel", MXC_CCM_CSCMR2, 8, 1,
-                               mx53_ldb_di0_sel, ARRAY_SIZE(mx53_ldb_di0_sel), CLK_SET_RATE_PARENT);
-       clk[ldb_di0_gate] = imx_clk_gate2("ldb_di0_gate", "ldb_di0_div", MXC_CCM_CCGR6, 28);
-       clk[ldb_di1_gate] = imx_clk_gate2("ldb_di1_gate", "ldb_di1_div", MXC_CCM_CCGR6, 30);
-       clk[ipu_di0_sel] = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3,
-                               mx53_ipu_di0_sel, ARRAY_SIZE(mx53_ipu_di0_sel));
-       clk[ipu_di1_sel] = imx_clk_mux("ipu_di1_sel", MXC_CCM_CSCMR2, 29, 3,
-                               mx53_ipu_di1_sel, ARRAY_SIZE(mx53_ipu_di1_sel));
-       clk[tve_ext_sel] = imx_clk_mux_flags("tve_ext_sel", MXC_CCM_CSCMR1, 6, 1,
-                               mx53_tve_ext_sel, ARRAY_SIZE(mx53_tve_ext_sel), CLK_SET_RATE_PARENT);
-       clk[tve_gate] = imx_clk_gate2("tve_gate", "tve_pred", MXC_CCM_CCGR2, 30);
-       clk[tve_pred] = imx_clk_divider("tve_pred", "tve_ext_sel", MXC_CCM_CDCDR, 28, 3);
-       clk[esdhc1_per_gate] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
-       clk[esdhc2_per_gate] = imx_clk_gate2("esdhc2_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 6);
-       clk[esdhc3_per_gate] = imx_clk_gate2("esdhc3_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 10);
-       clk[esdhc4_per_gate] = imx_clk_gate2("esdhc4_per_gate", "esdhc_d_sel", MXC_CCM_CCGR3, 14);
-       clk[usb_phy1_gate] = imx_clk_gate2("usb_phy1_gate", "usb_phy_sel", MXC_CCM_CCGR4, 10);
-       clk[usb_phy2_gate] = imx_clk_gate2("usb_phy2_gate", "usb_phy_sel", MXC_CCM_CCGR4, 12);
-       clk[can_sel] = imx_clk_mux("can_sel", MXC_CCM_CSCMR2, 6, 2,
-                               mx53_can_sel, ARRAY_SIZE(mx53_can_sel));
-       clk[can1_serial_gate] = imx_clk_gate2("can1_serial_gate", "can_sel", MXC_CCM_CCGR6, 22);
-       clk[can1_ipg_gate] = imx_clk_gate2("can1_ipg_gate", "ipg", MXC_CCM_CCGR6, 20);
-       clk[ocram] = imx_clk_gate2("ocram", "ahb", MXC_CCM_CCGR6, 2);
-       clk[can2_serial_gate] = imx_clk_gate2("can2_serial_gate", "can_sel", MXC_CCM_CCGR4, 8);
-       clk[can2_ipg_gate] = imx_clk_gate2("can2_ipg_gate", "ipg", MXC_CCM_CCGR4, 6);
-       clk[i2c3_gate] = imx_clk_gate2("i2c3_gate", "per_root", MXC_CCM_CCGR1, 22);
-       clk[sata_gate] = imx_clk_gate2("sata_gate", "ipg", MXC_CCM_CCGR4, 2);
-
-       clk[cko1_sel] = imx_clk_mux("cko1_sel", MXC_CCM_CCOSR, 0, 4,
-                               mx53_cko1_sel, ARRAY_SIZE(mx53_cko1_sel));
-       clk[cko1_podf] = imx_clk_divider("cko1_podf", "cko1_sel", MXC_CCM_CCOSR, 4, 3);
-       clk[cko1] = imx_clk_gate2("cko1", "cko1_podf", MXC_CCM_CCOSR, 7);
-
-       clk[cko2_sel] = imx_clk_mux("cko2_sel", MXC_CCM_CCOSR, 16, 5,
-                               mx53_cko2_sel, ARRAY_SIZE(mx53_cko2_sel));
-       clk[cko2_podf] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3);
-       clk[cko2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24);
-       clk[spdif_xtal_sel] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2,
-                               mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel));
+       clk[IMX5_CLK_PLL1_SW]           = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
+       clk[IMX5_CLK_PLL2_SW]           = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
+       clk[IMX5_CLK_PLL3_SW]           = imx_clk_pllv2("pll3_sw", "osc", MX53_DPLL3_BASE);
+       clk[IMX5_CLK_PLL4_SW]           = imx_clk_pllv2("pll4_sw", "osc", MX53_DPLL4_BASE);
+
+       clk[IMX5_CLK_LP_APM]            = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1,
+                                               lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
+       clk[IMX5_CLK_LDB_DI1_DIV_3_5]   = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7);
+       clk[IMX5_CLK_LDB_DI1_DIV]       = imx_clk_divider_flags("ldb_di1_div", "ldb_di1_div_3_5", MXC_CCM_CSCMR2, 11, 1, 0);
+       clk[IMX5_CLK_LDB_DI1_SEL]       = imx_clk_mux_flags("ldb_di1_sel", MXC_CCM_CSCMR2, 9, 1,
+                                               mx53_ldb_di1_sel, ARRAY_SIZE(mx53_ldb_di1_sel), CLK_SET_RATE_PARENT);
+       clk[IMX5_CLK_DI_PLL4_PODF]      = imx_clk_divider("di_pll4_podf", "pll4_sw", MXC_CCM_CDCDR, 16, 3);
+       clk[IMX5_CLK_LDB_DI0_DIV_3_5]   = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7);
+       clk[IMX5_CLK_LDB_DI0_DIV]       = imx_clk_divider_flags("ldb_di0_div", "ldb_di0_div_3_5", MXC_CCM_CSCMR2, 10, 1, 0);
+       clk[IMX5_CLK_LDB_DI0_SEL]       = imx_clk_mux_flags("ldb_di0_sel", MXC_CCM_CSCMR2, 8, 1,
+                                               mx53_ldb_di0_sel, ARRAY_SIZE(mx53_ldb_di0_sel), CLK_SET_RATE_PARENT);
+       clk[IMX5_CLK_LDB_DI0_GATE]      = imx_clk_gate2("ldb_di0_gate", "ldb_di0_div", MXC_CCM_CCGR6, 28);
+       clk[IMX5_CLK_LDB_DI1_GATE]      = imx_clk_gate2("ldb_di1_gate", "ldb_di1_div", MXC_CCM_CCGR6, 30);
+       clk[IMX5_CLK_IPU_DI0_SEL]       = imx_clk_mux("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3,
+                                               mx53_ipu_di0_sel, ARRAY_SIZE(mx53_ipu_di0_sel));
+       clk[IMX5_CLK_IPU_DI1_SEL]       = imx_clk_mux("ipu_di1_sel", MXC_CCM_CSCMR2, 29, 3,
+                                               mx53_ipu_di1_sel, ARRAY_SIZE(mx53_ipu_di1_sel));
+       clk[IMX5_CLK_TVE_EXT_SEL]       = imx_clk_mux_flags("tve_ext_sel", MXC_CCM_CSCMR1, 6, 1,
+                                               mx53_tve_ext_sel, ARRAY_SIZE(mx53_tve_ext_sel), CLK_SET_RATE_PARENT);
+       clk[IMX5_CLK_TVE_GATE]          = imx_clk_gate2("tve_gate", "tve_pred", MXC_CCM_CCGR2, 30);
+       clk[IMX5_CLK_TVE_PRED]          = imx_clk_divider("tve_pred", "tve_ext_sel", MXC_CCM_CDCDR, 28, 3);
+       clk[IMX5_CLK_ESDHC1_PER_GATE]   = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
+       clk[IMX5_CLK_ESDHC2_PER_GATE]   = imx_clk_gate2("esdhc2_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 6);
+       clk[IMX5_CLK_ESDHC3_PER_GATE]   = imx_clk_gate2("esdhc3_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 10);
+       clk[IMX5_CLK_ESDHC4_PER_GATE]   = imx_clk_gate2("esdhc4_per_gate", "esdhc_d_sel", MXC_CCM_CCGR3, 14);
+       clk[IMX5_CLK_USB_PHY1_GATE]     = imx_clk_gate2("usb_phy1_gate", "usb_phy_sel", MXC_CCM_CCGR4, 10);
+       clk[IMX5_CLK_USB_PHY2_GATE]     = imx_clk_gate2("usb_phy2_gate", "usb_phy_sel", MXC_CCM_CCGR4, 12);
+       clk[IMX5_CLK_CAN_SEL]           = imx_clk_mux("can_sel", MXC_CCM_CSCMR2, 6, 2,
+                                               mx53_can_sel, ARRAY_SIZE(mx53_can_sel));
+       clk[IMX5_CLK_CAN1_SERIAL_GATE]  = imx_clk_gate2("can1_serial_gate", "can_sel", MXC_CCM_CCGR6, 22);
+       clk[IMX5_CLK_CAN1_IPG_GATE]     = imx_clk_gate2("can1_ipg_gate", "ipg", MXC_CCM_CCGR6, 20);
+       clk[IMX5_CLK_OCRAM]             = imx_clk_gate2("ocram", "ahb", MXC_CCM_CCGR6, 2);
+       clk[IMX5_CLK_CAN2_SERIAL_GATE]  = imx_clk_gate2("can2_serial_gate", "can_sel", MXC_CCM_CCGR4, 8);
+       clk[IMX5_CLK_CAN2_IPG_GATE]     = imx_clk_gate2("can2_ipg_gate", "ipg", MXC_CCM_CCGR4, 6);
+       clk[IMX5_CLK_I2C3_GATE]         = imx_clk_gate2("i2c3_gate", "per_root", MXC_CCM_CCGR1, 22);
+       clk[IMX5_CLK_SATA_GATE]         = imx_clk_gate2("sata_gate", "ipg", MXC_CCM_CCGR4, 2);
+
+       clk[IMX5_CLK_CKO1_SEL]          = imx_clk_mux("cko1_sel", MXC_CCM_CCOSR, 0, 4,
+                                               mx53_cko1_sel, ARRAY_SIZE(mx53_cko1_sel));
+       clk[IMX5_CLK_CKO1_PODF]         = imx_clk_divider("cko1_podf", "cko1_sel", MXC_CCM_CCOSR, 4, 3);
+       clk[IMX5_CLK_CKO1]              = imx_clk_gate2("cko1", "cko1_podf", MXC_CCM_CCOSR, 7);
+
+       clk[IMX5_CLK_CKO2_SEL]          = imx_clk_mux("cko2_sel", MXC_CCM_CCOSR, 16, 5,
+                                               mx53_cko2_sel, ARRAY_SIZE(mx53_cko2_sel));
+       clk[IMX5_CLK_CKO2_PODF]         = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3);
+       clk[IMX5_CLK_CKO2]              = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24);
+       clk[IMX5_CLK_SPDIF_XTAL_SEL]    = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2,
+                                               mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel));
 
        for (i = 0; i < ARRAY_SIZE(clk); i++)
                if (IS_ERR(clk[i]))
@@ -542,33 +563,36 @@ static void __init mx53_clocks_init(struct device_node *np)
 
        mx5_clocks_common_init(0, 0, 0, 0);
 
-       clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0");
-       clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
-       clk_register_clkdev(clk[fec_gate], NULL, "imx25-fec.0");
-       clk_register_clkdev(clk[usb_phy1_gate], "usb_phy1", "mxc-ehci.0");
-       clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx53.0");
-       clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.0");
-       clk_register_clkdev(clk[esdhc1_per_gate], "per", "sdhci-esdhc-imx53.0");
-       clk_register_clkdev(clk[esdhc2_ipg_gate], "ipg", "sdhci-esdhc-imx53.1");
-       clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.1");
-       clk_register_clkdev(clk[esdhc2_per_gate], "per", "sdhci-esdhc-imx53.1");
-       clk_register_clkdev(clk[esdhc3_ipg_gate], "ipg", "sdhci-esdhc-imx53.2");
-       clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.2");
-       clk_register_clkdev(clk[esdhc3_per_gate], "per", "sdhci-esdhc-imx53.2");
-       clk_register_clkdev(clk[esdhc4_ipg_gate], "ipg", "sdhci-esdhc-imx53.3");
-       clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.3");
-       clk_register_clkdev(clk[esdhc4_per_gate], "per", "sdhci-esdhc-imx53.3");
+       clk_register_clkdev(clk[IMX5_CLK_VPU_GATE], NULL, "imx53-vpu.0");
+       clk_register_clkdev(clk[IMX5_CLK_I2C3_GATE], NULL, "imx21-i2c.2");
+       clk_register_clkdev(clk[IMX5_CLK_FEC_GATE], NULL, "imx25-fec.0");
+       clk_register_clkdev(clk[IMX5_CLK_USB_PHY1_GATE], "usb_phy1", "mxc-ehci.0");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC1_IPG_GATE], "ipg", "sdhci-esdhc-imx53.0");
+       clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.0");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC1_PER_GATE], "per", "sdhci-esdhc-imx53.0");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC2_IPG_GATE], "ipg", "sdhci-esdhc-imx53.1");
+       clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.1");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC2_PER_GATE], "per", "sdhci-esdhc-imx53.1");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC3_IPG_GATE], "ipg", "sdhci-esdhc-imx53.2");
+       clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.2");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC3_PER_GATE], "per", "sdhci-esdhc-imx53.2");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC4_IPG_GATE], "ipg", "sdhci-esdhc-imx53.3");
+       clk_register_clkdev(clk[IMX5_CLK_DUMMY], "ahb", "sdhci-esdhc-imx53.3");
+       clk_register_clkdev(clk[IMX5_CLK_ESDHC4_PER_GATE], "per", "sdhci-esdhc-imx53.3");
 
        /* set SDHC root clock to 200MHZ*/
-       clk_set_rate(clk[esdhc_a_podf], 200000000);
-       clk_set_rate(clk[esdhc_b_podf], 200000000);
+       clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000);
+       clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000);
+
+       /* move can bus clk to 24MHz */
+       clk_set_parent(clk[IMX5_CLK_CAN_SEL], clk[IMX5_CLK_LP_APM]);
 
-       clk_prepare_enable(clk[iim_gate]);
+       clk_prepare_enable(clk[IMX5_CLK_IIM_GATE]);
        imx_print_silicon_rev("i.MX53", mx53_revision());
-       clk_disable_unprepare(clk[iim_gate]);
+       clk_disable_unprepare(clk[IMX5_CLK_IIM_GATE]);
 
-       r = clk_round_rate(clk[usboh3_per_gate], 54000000);
-       clk_set_rate(clk[usboh3_per_gate], r);
+       r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000);
+       clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r);
 
        np = of_find_compatible_node(NULL, NULL, "fsl,imx53-gpt");
        base = of_iomap(np, 0);
index 04cfd0fcb0e56db864d28f4240b2341ae20927b0..af2e582d2b7427e1ffa72b65fb3b90bcdb257c3a 100644 (file)
@@ -114,7 +114,7 @@ static struct clk *clk[clk_max];
 static struct clk_onecell_data clk_data;
 
 static enum mx6q_clks const clks_init_on[] __initconst = {
-       mmdc_ch0_axi, rom, pll1_sys,
+       mmdc_ch0_axi, rom, arm,
 };
 
 static struct clk_div_table clk_enet_ref_table[] = {
@@ -475,6 +475,9 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
        if (ret)
                pr_warn("failed to set up CLKO: %d\n", ret);
 
+       /* Audio-related clocks configuration */
+       clk_set_parent(clk[spdif_sel], clk[pll3_pfd3_454m]);
+
        /* All existing boards with PCIe use LVDS1 */
        if (IS_ENABLED(CONFIG_PCI_IMX6))
                clk_set_parent(clk[lvds1_sel], clk[sata_ref]);
index c0c4ef55e35bd7e522b4f83d038d50f752265db4..3781a1853998c30520961cde9c27dd02e8068267 100644 (file)
@@ -29,14 +29,14 @@ static const char const *periph_sels[]              = { "pre_periph_sel", "periph_clk2_podf"
 static const char const *periph2_sels[]                = { "pre_periph2_sel", "periph2_clk2_podf", };
 static const char const *csi_lcdif_sels[]      = { "mmdc", "pll2_pfd2", "pll3_120m", "pll3_pfd1", };
 static const char const *usdhc_sels[]          = { "pll2_pfd2", "pll2_pfd0", };
-static const char const *ssi_sels[]            = { "pll3_pfd2", "pll3_pfd3", "pll4_post_div", "dummy", };
+static const char const *ssi_sels[]            = { "pll3_pfd2", "pll3_pfd3", "pll4_audio_div", "dummy", };
 static const char const *perclk_sels[]         = { "ipg", "osc", };
 static const char const *epdc_pxp_sels[]       = { "mmdc", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd2", "pll3_pfd1", };
 static const char const *gpu2d_ovg_sels[]      = { "pll3_pfd1", "pll3_usb_otg", "pll2_bus", "pll2_pfd2", };
 static const char const *gpu2d_sels[]          = { "pll2_pfd2", "pll3_usb_otg", "pll3_pfd1", "pll2_bus", };
 static const char const *lcdif_pix_sels[]      = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll3_pfd0", "pll3_pfd1", };
 static const char const *epdc_pix_sels[]       = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd1", "pll3_pfd1", };
-static const char const *audio_sels[]          = { "pll4_post_div", "pll3_pfd2", "pll3_pfd3", "pll3_usb_otg", };
+static const char const *audio_sels[]          = { "pll4_audio_div", "pll3_pfd2", "pll3_pfd3", "pll3_usb_otg", };
 static const char const *ecspi_sels[]          = { "pll3_60m", "osc", };
 static const char const *uart_sels[]           = { "pll3_80m", "osc", };
 
@@ -63,7 +63,7 @@ static struct clk_div_table video_div_table[] = {
        { }
 };
 
-static struct clk *clks[IMX6SL_CLK_CLK_END];
+static struct clk *clks[IMX6SL_CLK_END];
 static struct clk_onecell_data clk_data;
 
 static void __init imx6sl_clocks_init(struct device_node *ccm_node)
@@ -104,6 +104,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
 
        /*                                                           dev   name              parent_name      flags                reg        shift width div: flags, div_table lock */
        clks[IMX6SL_CLK_PLL4_POST_DIV]  = clk_register_divider_table(NULL, "pll4_post_div",  "pll4_audio",    CLK_SET_RATE_PARENT, base + 0x70,  19, 2,   0, post_div_table, &imx_ccm_lock);
+       clks[IMX6SL_CLK_PLL4_AUDIO_DIV] =       clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1,   0, &imx_ccm_lock);
        clks[IMX6SL_CLK_PLL5_POST_DIV]  = clk_register_divider_table(NULL, "pll5_post_div",  "pll5_video",    CLK_SET_RATE_PARENT, base + 0xa0,  19, 2,   0, post_div_table, &imx_ccm_lock);
        clks[IMX6SL_CLK_PLL5_VIDEO_DIV] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", CLK_SET_RATE_PARENT, base + 0x170, 30, 2,   0, video_div_table, &imx_ccm_lock);
        clks[IMX6SL_CLK_ENET_REF]       = clk_register_divider_table(NULL, "enet_ref",       "pll6_enet",     0,                   base + 0xe0,  0,  2,   0, clk_enet_ref_table, &imx_ccm_lock);
@@ -232,6 +233,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
        clks[IMX6SL_CLK_PWM3]         = imx_clk_gate2("pwm3",         "perclk",            base + 0x78, 20);
        clks[IMX6SL_CLK_PWM4]         = imx_clk_gate2("pwm4",         "perclk",            base + 0x78, 22);
        clks[IMX6SL_CLK_SDMA]         = imx_clk_gate2("sdma",         "ipg",               base + 0x7c, 6);
+       clks[IMX6SL_CLK_SPBA]         = imx_clk_gate2("spba",         "ipg",               base + 0x7c, 12);
        clks[IMX6SL_CLK_SPDIF]        = imx_clk_gate2("spdif",        "spdif0_podf",       base + 0x7c, 14);
        clks[IMX6SL_CLK_SSI1]         = imx_clk_gate2("ssi1",         "ssi1_podf",         base + 0x7c, 18);
        clks[IMX6SL_CLK_SSI2]         = imx_clk_gate2("ssi2",         "ssi2_podf",         base + 0x7c, 20);
@@ -261,6 +263,9 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
                clk_prepare_enable(clks[IMX6SL_CLK_USBPHY2_GATE]);
        }
 
+       /* Audio-related clocks configuration */
+       clk_set_parent(clks[IMX6SL_CLK_SPDIF0_SEL], clks[IMX6SL_CLK_PLL3_PFD3]);
+
        np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-gpt");
        base = of_iomap(np, 0);
        WARN_ON(!base);
index e2ed4160f329515531a6e72e5b7260a651f2e3ec..0b0f6f66ec56b680219bdcad3e550670e7130131 100644 (file)
@@ -109,12 +109,23 @@ static int clk_pfd_set_rate(struct clk_hw *hw, unsigned long rate,
        return 0;
 }
 
+static int clk_pfd_is_enabled(struct clk_hw *hw)
+{
+       struct clk_pfd *pfd = to_clk_pfd(hw);
+
+       if (readl_relaxed(pfd->reg) & (1 << ((pfd->idx + 1) * 8 - 1)))
+               return 0;
+
+       return 1;
+}
+
 static const struct clk_ops clk_pfd_ops = {
        .enable         = clk_pfd_enable,
        .disable        = clk_pfd_disable,
        .recalc_rate    = clk_pfd_recalc_rate,
        .round_rate     = clk_pfd_round_rate,
        .set_rate       = clk_pfd_set_rate,
+       .is_enabled     = clk_pfd_is_enabled,
 };
 
 struct clk *imx_clk_pfd(const char *name, const char *parent_name,
index c1eaee3469542d08660d0a4aecc81a1f468f5041..d21d14ca46c1786b4cc42f47976cbdc6cc384d5d 100644 (file)
  *
  * PLL clock version 1, found on i.MX1/21/25/27/31/35
  */
+
+#define MFN_BITS       (10)
+#define MFN_SIGN       (BIT(MFN_BITS - 1))
+#define MFN_MASK       (MFN_SIGN - 1)
+
 struct clk_pllv1 {
        struct clk_hw   hw;
        void __iomem    *base;
@@ -25,6 +30,11 @@ struct clk_pllv1 {
 
 #define to_clk_pllv1(clk) (container_of(clk, struct clk_pllv1, clk))
 
+static inline bool mfn_is_negative(unsigned int mfn)
+{
+       return !cpu_is_mx1() && !cpu_is_mx21() && (mfn & MFN_SIGN);
+}
+
 static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw,
                unsigned long parent_rate)
 {
@@ -58,10 +68,15 @@ static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw,
 
        /*
         * On all i.MXs except i.MX1 and i.MX21 mfn is a 10bit
-        * 2's complements number
+        * 2's complements number.
+        * On i.MX27 the bit 9 is the sign bit.
         */
-       if (!cpu_is_mx1() && !cpu_is_mx21() && mfn >= 0x200)
-               mfn_abs = 0x400 - mfn;
+       if (mfn_is_negative(mfn)) {
+               if (cpu_is_mx27())
+                       mfn_abs = mfn & MFN_MASK;
+               else
+                       mfn_abs = BIT(MFN_BITS) - mfn;
+       }
 
        rate = parent_rate * 2;
        rate /= pd + 1;
@@ -70,7 +85,7 @@ static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw,
 
        do_div(ll, mfd + 1);
 
-       if (!cpu_is_mx1() && !cpu_is_mx21() && mfn >= 0x200)
+       if (mfn_is_negative(mfn))
                ll = -ll;
 
        ll = (rate * mfi) + ll;
index b169a396d93bfcf193c83d7329a6fdc290101425..ecd66d8e20b62b84419f0c0bcc4a54d0c5ef8a02 100644 (file)
@@ -298,6 +298,11 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
        clk[VF610_CLK_FLEXCAN0] = imx_clk_gate2("flexcan0", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(0));
        clk[VF610_CLK_FLEXCAN1] = imx_clk_gate2("flexcan1", "ipg_bus", CCM_CCGR9, CCM_CCGRx_CGn(4));
 
+       clk[VF610_CLK_DMAMUX0] = imx_clk_gate2("dmamux0", "platform_bus", CCM_CCGR0, CCM_CCGRx_CGn(4));
+       clk[VF610_CLK_DMAMUX1] = imx_clk_gate2("dmamux1", "platform_bus", CCM_CCGR0, CCM_CCGRx_CGn(5));
+       clk[VF610_CLK_DMAMUX2] = imx_clk_gate2("dmamux2", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(1));
+       clk[VF610_CLK_DMAMUX3] = imx_clk_gate2("dmamux3", "platform_bus", CCM_CCGR6, CCM_CCGRx_CGn(2));
+
        clk_set_parent(clk[VF610_CLK_QSPI0_SEL], clk[VF610_CLK_PLL1_PFD4]);
        clk_set_rate(clk[VF610_CLK_QSPI0_X4_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_SEL]) / 2);
        clk_set_rate(clk[VF610_CLK_QSPI0_X2_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_X4_DIV]) / 2);
index 24a7899e36a8abed143d2bfdadcf854e0970a14c..59c3b9b26bb40bbabe40f471d6a420efee43a1c2 100644 (file)
@@ -108,6 +108,7 @@ void tzic_handle_irq(struct pt_regs *);
 #define imx27_handle_irq avic_handle_irq
 #define imx31_handle_irq avic_handle_irq
 #define imx35_handle_irq avic_handle_irq
+#define imx50_handle_irq tzic_handle_irq
 #define imx51_handle_irq tzic_handle_irq
 #define imx53_handle_irq tzic_handle_irq
 
index 818a1cc2fe45e4ead8c2f4cd367ba24148d2aa30..e1e70ef7bc2d2f62916d9da5c84c87f18881e569 100644 (file)
@@ -25,7 +25,7 @@ static void __init imx31_dt_init(void)
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
-static const char *imx31_dt_board_compat[] __initdata = {
+static const char *imx31_dt_board_compat[] __initconst = {
        "fsl,imx31",
        NULL
 };
diff --git a/arch/arm/mach-imx/imx35-dt.c b/arch/arm/mach-imx/imx35-dt.c
new file mode 100644 (file)
index 0000000..9d48e00
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2012 Steffen Trumtrar, Pengutronix
+ *
+ * based on imx27-dt.c
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation.
+ */
+
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/clk-provider.h>
+#include <linux/clocksource.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/time.h>
+#include <asm/hardware/cache-l2x0.h>
+#include "common.h"
+#include "mx35.h"
+
+static void __init imx35_dt_init(void)
+{
+       mxc_arch_reset_init_dt();
+
+       of_platform_populate(NULL, of_default_bus_match_table,
+                            NULL, NULL);
+}
+
+static void __init imx35_irq_init(void)
+{
+       imx_init_l2cache();
+       mx35_init_irq();
+}
+
+static const char *imx35_dt_board_compat[] __initconst = {
+       "fsl,imx35",
+       NULL
+};
+
+DT_MACHINE_START(IMX35_DT, "Freescale i.MX35 (Device Tree Support)")
+       .map_io         = mx35_map_io,
+       .init_early     = imx35_init_early,
+       .init_irq       = imx35_irq_init,
+       .handle_irq     = imx35_handle_irq,
+       .init_machine   = imx35_dt_init,
+       .dt_compat      = imx35_dt_board_compat,
+       .restart        = mxc_restart,
+MACHINE_END
index bece8a65e6f01893e9e58df0799b580b8c356365..0230d78d141322f3288a5728f294ea4be9376ec9 100644 (file)
@@ -29,7 +29,7 @@ static void __init imx51_dt_init(void)
        platform_device_register_full(&devinfo);
 }
 
-static const char *imx51_dt_board_compat[] __initdata = {
+static const char *imx51_dt_board_compat[] __initconst = {
        "fsl,imx51",
        NULL
 };
index 5b2dabba330fd7ad69c534aa3714bc821d77342a..6e3175dc0c0aaed7dccca96b9767f4c0d4baf3ae 100644 (file)
@@ -24,7 +24,6 @@
 
 struct mxc_extra_irq
 {
-       int (*set_priority)(unsigned char irq, unsigned char prio);
        int (*set_irq_fiq)(unsigned int irq, unsigned int type);
 };
 
diff --git a/arch/arm/mach-imx/mach-imx50.c b/arch/arm/mach-imx/mach-imx50.c
new file mode 100644 (file)
index 0000000..77b77a9
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2013 Greg Ungerer <gerg@uclinux.org>
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/of_platform.h>
+#include <asm/mach/arch.h>
+
+#include "common.h"
+
+static void __init imx50_dt_init(void)
+{
+       mxc_arch_reset_init_dt();
+
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char *imx50_dt_board_compat[] __initconst = {
+       "fsl,imx50",
+       NULL
+};
+
+DT_MACHINE_START(IMX50_DT, "Freescale i.MX50 (Device Tree Support)")
+       .map_io         = mx53_map_io,
+       .init_irq       = mx53_init_irq,
+       .handle_irq     = imx50_handle_irq,
+       .init_machine   = imx50_dt_init,
+       .dt_compat      = imx50_dt_board_compat,
+       .restart        = mxc_restart,
+MACHINE_END
index c9c4d8d96931daf05794c4bab73facedb9fb943c..65850908a4b4d88b31e32f3a750df7b13c45fcec 100644 (file)
@@ -31,7 +31,7 @@ static void __init imx53_dt_init(void)
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
-static const char *imx53_dt_board_compat[] __initdata = {
+static const char *imx53_dt_board_compat[] __initconst = {
        "fsl,imx53",
        NULL
 };
index d0cfb225ec9aa5e9e9599b6e3ee5c6c32870e0f7..d2ea6e60ea7b2042f6ff8d73503db73f95fd9770 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/cpu.h>
+#include <linux/delay.h>
 #include <linux/export.h>
 #include <linux/init.h>
 #include <linux/io.h>
@@ -23,6 +24,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/pm_opp.h>
+#include <linux/pci.h>
 #include <linux/phy.h>
 #include <linux/reboot.h>
 #include <linux/regmap.h>
@@ -78,6 +80,34 @@ static int ksz9031rn_phy_fixup(struct phy_device *dev)
        return 0;
 }
 
+/*
+ * fixup for PLX PEX8909 bridge to configure GPIO1-7 as output High
+ * as they are used for slots1-7 PERST#
+ */
+static void ventana_pciesw_early_fixup(struct pci_dev *dev)
+{
+       u32 dw;
+
+       if (!of_machine_is_compatible("gw,ventana"))
+               return;
+
+       if (dev->devfn != 0)
+               return;
+
+       pci_read_config_dword(dev, 0x62c, &dw);
+       dw |= 0xaaa8; // GPIO1-7 outputs
+       pci_write_config_dword(dev, 0x62c, dw);
+
+       pci_read_config_dword(dev, 0x644, &dw);
+       dw |= 0xfe;   // GPIO1-7 output high
+       pci_write_config_dword(dev, 0x644, dw);
+
+       msleep(100);
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8609, ventana_pciesw_early_fixup);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8606, ventana_pciesw_early_fixup);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8604, ventana_pciesw_early_fixup);
+
 static int ar8031_phy_fixup(struct phy_device *dev)
 {
        u16 val;
@@ -243,7 +273,7 @@ static void __init imx6q_init_irq(void)
        irqchip_init();
 }
 
-static const char *imx6q_dt_compat[] __initdata = {
+static const char *imx6q_dt_compat[] __initconst = {
        "fsl,imx6dl",
        "fsl,imx6q",
        NULL,
index 2f952e3fcf899172b40ffc7e1cfff7aa94718bc2..0f4fd4c0ab8e7db0cca2e04e2cb65f6dd43092d6 100644 (file)
@@ -34,6 +34,13 @@ static void __init imx6sl_fec_init(void)
        }
 }
 
+static void __init imx6sl_init_late(void)
+{
+       /* imx6sl reuses imx6q cpufreq driver */
+       if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ))
+               platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);
+}
+
 static void __init imx6sl_init_machine(void)
 {
        struct device *parent;
@@ -61,7 +68,7 @@ static void __init imx6sl_init_irq(void)
        irqchip_init();
 }
 
-static const char *imx6sl_dt_compat[] __initdata = {
+static const char *imx6sl_dt_compat[] __initconst = {
        "fsl,imx6sl",
        NULL,
 };
@@ -70,6 +77,7 @@ DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)")
        .map_io         = debug_ll_io_init,
        .init_irq       = imx6sl_init_irq,
        .init_machine   = imx6sl_init_machine,
+       .init_late      = imx6sl_init_late,
        .dt_compat      = imx6sl_dt_compat,
        .restart        = mxc_restart,
 MACHINE_END
index af0cb8a9dc4898827b1c569506b761fb4b476787..2d8aef5a6efab86ff0a9bbecae52f64f02f301f8 100644 (file)
@@ -26,7 +26,7 @@ static void __init vf610_init_irq(void)
        irqchip_init();
 }
 
-static const char *vf610_dt_compat[] __initdata = {
+static const char *vf610_dt_compat[] __initconst = {
        "fsl,vf610",
        NULL,
 };
index d1d52600f458c3604eb77c4bcfae51432b2a932c..4c112021aa4ef8511121a0237179a5b7a6ebcf4f 100644 (file)
@@ -89,15 +89,7 @@ void __init imx51_init_early(void)
 
 void __init imx53_init_early(void)
 {
-       struct device_node *np;
-       void __iomem *base;
-
        mxc_set_cpu_type(MXC_CPU_MX53);
-
-       np = of_find_compatible_node(NULL, NULL, "fsl,imx53-iomuxc");
-       base = of_iomap(np, 0);
-       WARN_ON(!base);
-       mxc_iomux_v3_init(base);
        imx_src_init();
 }
 
index 1f24c1fdfea4eec4dafaf2ed4072682145fdb3b1..5b57c17c06bda86ca93b6c3f9d53534cfdc88b6f 100644 (file)
@@ -92,8 +92,7 @@ static void __init imx_smp_prepare_cpus(unsigned int max_cpus)
         * secondary cores when booting them.
         */
        asm("mrc p15, 0, %0, c15, c0, 1" : "=r" (g_diag_reg) : : "cc");
-       __cpuc_flush_dcache_area(&g_diag_reg, sizeof(g_diag_reg));
-       outer_clean_range(__pa(&g_diag_reg), __pa(&g_diag_reg + 1));
+       sync_cache_w(&g_diag_reg);
 }
 
 struct smp_operations  imx_smp_ops __initdata = {
index aecd9f8037e0aab65e44482ffe817314b6bbd1be..9d47adc078aa76cac2262063dfc94d3d54a6966b 100644 (file)
@@ -156,10 +156,16 @@ int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
        }
 
        /*
-        * Unmask the always pending IOMUXC interrupt #32 as wakeup source to
-        * deassert dsm_request signal, so that we can ensure dsm_request
-        * is not asserted when we're going to write CLPCR register to set LPM.
-        * After setting up LPM bits, we need to mask this wakeup source.
+        * ERR007265: CCM: When improper low-power sequence is used,
+        * the SoC enters low power mode before the ARM core executes WFI.
+        *
+        * Software workaround:
+        * 1) Software should trigger IRQ #32 (IOMUX) to be always pending
+        *    by setting IOMUX_GPR1_GINT.
+        * 2) Software should then unmask IRQ #32 in GPC before setting CCM
+        *    Low-Power mode.
+        * 3) Software should mask IRQ #32 right after CCM Low-Power mode
+        *    is set (set bits 0-1 of CCM_CLPCR).
         */
        iomuxc_irq_desc = irq_to_desc(32);
        imx_gpc_irq_unmask(&iomuxc_irq_desc->irq_data);
@@ -219,6 +225,8 @@ void __init imx6q_pm_init(void)
        WARN_ON(!ccm_base);
 
        /*
+        * This is for SW workaround step #1 of ERR007265, see comments
+        * in imx6q_set_lpm for details of this errata.
         * Force IOMUXC irq pending, so that the interrupt to GPC can be
         * used to deassert dsm_request signal when the signal gets
         * asserted unexpectedly.
index 9b6638aadeaa8958069f018c734c077593410044..1a3a5f6157706c7f9400d3bfd61ffffcce1b9424 100644 (file)
@@ -111,7 +111,7 @@ static void gpt_irq_acknowledge(void)
 
 static void __iomem *sched_clock_reg;
 
-static u32 notrace mxc_read_sched_clock(void)
+static u64 notrace mxc_read_sched_clock(void)
 {
        return sched_clock_reg ? __raw_readl(sched_clock_reg) : 0;
 }
@@ -123,7 +123,7 @@ static int __init mxc_clocksource_init(struct clk *timer_clk)
 
        sched_clock_reg = reg;
 
-       setup_sched_clock(mxc_read_sched_clock, 32, c);
+       sched_clock_register(mxc_read_sched_clock, 32, c);
        return clocksource_mmio_init(reg, "mxc_timer1", c, 200, 32,
                        clocksource_mmio_readl_up);
 }
index d50dc2dbfd89e53571a716b80e01bd567400ea36..17c0fe6274357842d2769efc2f0bf2ac5241b982 100644 (file)
@@ -63,6 +63,9 @@
 
 /* Base address to the AP system controller */
 void __iomem *ap_syscon_base;
+/* Base address to the external bus interface */
+static void __iomem *ebi_base;
+
 
 /*
  * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
@@ -72,15 +75,11 @@ void __iomem *ap_syscon_base;
  * just for now).
  */
 #define VA_IC_BASE     __io_address(INTEGRATOR_IC_BASE)
-#define VA_EBI_BASE    __io_address(INTEGRATOR_EBI_BASE)
-#define VA_CMIC_BASE   __io_address(INTEGRATOR_HDR_IC)
 
 /*
  * Logical      Physical
  * ef000000                    Cache flush
- * f1000000    10000000        Core module registers
  * f1100000    11000000        System controller registers
- * f1200000    12000000        EBI registers
  * f1300000    13000000        Counter/Timer
  * f1400000    14000000        Interrupt controller
  * f1600000    16000000        UART 0
@@ -91,16 +90,6 @@ void __iomem *ap_syscon_base;
 
 static struct map_desc ap_io_desc[] __initdata __maybe_unused = {
        {
-               .virtual        = IO_ADDRESS(INTEGRATOR_HDR_BASE),
-               .pfn            = __phys_to_pfn(INTEGRATOR_HDR_BASE),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE
-       }, {
-               .virtual        = IO_ADDRESS(INTEGRATOR_EBI_BASE),
-               .pfn            = __phys_to_pfn(INTEGRATOR_EBI_BASE),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE
-       }, {
                .virtual        = IO_ADDRESS(INTEGRATOR_CT_BASE),
                .pfn            = __phys_to_pfn(INTEGRATOR_CT_BASE),
                .length         = SZ_4K,
@@ -174,9 +163,6 @@ device_initcall(irq_syscore_init);
 /*
  * Flash handling.
  */
-#define EBI_CSR1 (VA_EBI_BASE + INTEGRATOR_EBI_CSR1_OFFSET)
-#define EBI_LOCK (VA_EBI_BASE + INTEGRATOR_EBI_LOCK_OFFSET)
-
 static int ap_flash_init(struct platform_device *dev)
 {
        u32 tmp;
@@ -184,13 +170,15 @@ static int ap_flash_init(struct platform_device *dev)
        writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP,
               ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
 
-       tmp = readl(EBI_CSR1) | INTEGRATOR_EBI_WRITE_ENABLE;
-       writel(tmp, EBI_CSR1);
+       tmp = readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET) |
+               INTEGRATOR_EBI_WRITE_ENABLE;
+       writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
 
-       if (!(readl(EBI_CSR1) & INTEGRATOR_EBI_WRITE_ENABLE)) {
-               writel(0xa05f, EBI_LOCK);
-               writel(tmp, EBI_CSR1);
-               writel(0, EBI_LOCK);
+       if (!(readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET)
+             & INTEGRATOR_EBI_WRITE_ENABLE)) {
+               writel(0xa05f, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
+               writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
+               writel(0, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
        }
        return 0;
 }
@@ -202,13 +190,15 @@ static void ap_flash_exit(struct platform_device *dev)
        writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP,
               ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
 
-       tmp = readl(EBI_CSR1) & ~INTEGRATOR_EBI_WRITE_ENABLE;
-       writel(tmp, EBI_CSR1);
+       tmp = readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET) &
+               ~INTEGRATOR_EBI_WRITE_ENABLE;
+       writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
 
-       if (readl(EBI_CSR1) & INTEGRATOR_EBI_WRITE_ENABLE) {
-               writel(0xa05f, EBI_LOCK);
-               writel(tmp, EBI_CSR1);
-               writel(0, EBI_LOCK);
+       if (readl(ebi_base + INTEGRATOR_EBI_CSR1_OFFSET) &
+           INTEGRATOR_EBI_WRITE_ENABLE) {
+               writel(0xa05f, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
+               writel(tmp, ebi_base + INTEGRATOR_EBI_CSR1_OFFSET);
+               writel(0, ebi_base + INTEGRATOR_EBI_LOCK_OFFSET);
        }
 }
 
@@ -277,7 +267,7 @@ struct amba_pl010_data ap_uart_data = {
 
 static unsigned long timer_reload;
 
-static u32 notrace integrator_read_sched_clock(void)
+static u64 notrace integrator_read_sched_clock(void)
 {
        return -readl((void __iomem *) TIMER2_VA_BASE + TIMER_VALUE);
 }
@@ -298,7 +288,7 @@ static void integrator_clocksource_init(unsigned long inrate,
 
        clocksource_mmio_init(base + TIMER_VALUE, "timer2",
                        rate, 200, 16, clocksource_mmio_readl_down);
-       setup_sched_clock(integrator_read_sched_clock, 16, rate);
+       sched_clock_register(integrator_read_sched_clock, 16, rate);
 }
 
 static void __iomem * clkevt_base;
@@ -475,11 +465,17 @@ static const struct of_device_id ap_syscon_match[] = {
        { },
 };
 
+static const struct of_device_id ebi_match[] = {
+       { .compatible = "arm,external-bus-interface"},
+       { },
+};
+
 static void __init ap_init_of(void)
 {
        unsigned long sc_dec;
        struct device_node *root;
        struct device_node *syscon;
+       struct device_node *ebi;
        struct device *parent;
        struct soc_device *soc_dev;
        struct soc_device_attribute *soc_dev_attr;
@@ -495,10 +491,16 @@ static void __init ap_init_of(void)
        syscon = of_find_matching_node(root, ap_syscon_match);
        if (!syscon)
                return;
+       ebi = of_find_matching_node(root, ebi_match);
+       if (!ebi)
+               return;
 
        ap_syscon_base = of_iomap(syscon, 0);
        if (!ap_syscon_base)
                return;
+       ebi_base = of_iomap(ebi, 0);
+       if (!ebi_base)
+               return;
 
        ap_sc_id = readl(ap_syscon_base);
 
index 4fc0a195de0103e865b4827af89dd101f6336241..5e84149d1790dccf090a4c0b7373d07b7435b91b 100644 (file)
@@ -64,9 +64,6 @@ static void __iomem *intcp_con_base;
 
 /*
  * Logical      Physical
- * f1000000    10000000        Core module registers
- * f1100000    11000000        System controller registers
- * f1200000    12000000        EBI registers
  * f1300000    13000000        Counter/Timer
  * f1400000    14000000        Interrupt controller
  * f1600000    16000000        UART 0
@@ -74,21 +71,10 @@ static void __iomem *intcp_con_base;
  * f1a00000    1a000000        Debug LEDs
  * fc900000    c9000000        GPIO
  * fca00000    ca000000        SIC
- * fcb00000    cb000000        CP system control
  */
 
 static struct map_desc intcp_io_desc[] __initdata __maybe_unused = {
        {
-               .virtual        = IO_ADDRESS(INTEGRATOR_HDR_BASE),
-               .pfn            = __phys_to_pfn(INTEGRATOR_HDR_BASE),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE
-       }, {
-               .virtual        = IO_ADDRESS(INTEGRATOR_EBI_BASE),
-               .pfn            = __phys_to_pfn(INTEGRATOR_EBI_BASE),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE
-       }, {
                .virtual        = IO_ADDRESS(INTEGRATOR_CT_BASE),
                .pfn            = __phys_to_pfn(INTEGRATOR_CT_BASE),
                .length         = SZ_4K,
index a7906ebedb19ad202fda88ed91ad1c147e5614d0..6d68aed6548a504c23ba0639ea96871760381f12 100644 (file)
@@ -475,7 +475,7 @@ void __init ixp4xx_sys_init(void)
 /*
  * sched_clock()
  */
-static u32 notrace ixp4xx_read_sched_clock(void)
+static u64 notrace ixp4xx_read_sched_clock(void)
 {
        return *IXP4XX_OSTS;
 }
@@ -493,7 +493,7 @@ unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ;
 EXPORT_SYMBOL(ixp4xx_timer_freq);
 static void __init ixp4xx_clocksource_init(void)
 {
-       setup_sched_clock(ixp4xx_read_sched_clock, 32, ixp4xx_timer_freq);
+       sched_clock_register(ixp4xx_read_sched_clock, 32, ixp4xx_timer_freq);
 
        clocksource_mmio_init(NULL, "OSTS", ixp4xx_timer_freq, 200, 32,
                        ixp4xx_clocksource_read);
index f20c53e75ed934d78acd1bdcb758bdf34690adfb..dabc5eee52e71b082de0a23af8645df2c206468d 100644 (file)
@@ -11,6 +11,8 @@ config ARCH_KEYSTONE
        select ARM_ERRATA_798181 if SMP
        select COMMON_CLK_KEYSTONE
        select TI_EDMA
+       select ARCH_SUPPORTS_BIG_ENDIAN
+       select ZONE_DMA if ARM_LPAE
        help
          Support for boards based on the Texas Instruments Keystone family of
          SoCs.
index b661c5c2870a88d09a76b51d7166650a693250ac..6e6bb7d5ea308ca890e56439481b51e211437346 100644 (file)
@@ -41,6 +41,7 @@ static void __init keystone_init(void)
        if (WARN_ON(!keystone_rstctrl))
                pr_warn("ti,keystone-reset iomap error\n");
 
+       keystone_pm_runtime_init();
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
@@ -68,6 +69,9 @@ void keystone_restart(enum reboot_mode mode, const char *cmd)
 }
 
 DT_MACHINE_START(KEYSTONE, "Keystone")
+#if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
+       .dma_zone_size  = SZ_2G,
+#endif
        .smp            = smp_ops(keystone_smp_ops),
        .init_machine   = keystone_init,
        .dt_compat      = keystone_match,
index 60bef9dedb129b29a7aa67097cb51b0a05f0559d..cd04a1c14de8034b8c27dc5c5f9dbf7f0f31b64a 100644 (file)
@@ -18,6 +18,7 @@
 extern struct smp_operations keystone_smp_ops;
 extern void secondary_startup(void);
 extern u32 keystone_cpu_smc(u32 command, u32 cpu, u32 addr);
+extern int keystone_pm_runtime_init(void);
 
 #endif /* __ASSEMBLER__ */
 #endif /* __KEYSTONE_H__ */
index 29625232e9543aba107f29bc8cd6260c4f12c658..ca79ddac38bcd6ff1e00457a858006271762c861 100644 (file)
@@ -74,9 +74,7 @@ int __init keystone_pm_runtime_init(void)
        if (!np)
                return 0;
 
-       of_clk_init(NULL);
        pm_clk_add_notifier(&platform_bus_type, &platform_domain_notifier);
 
        return 0;
 }
-subsys_initcall(keystone_pm_runtime_init);
index 9caa4fe95913c672a6b874c5b8b8d573294ae857..78188159484d79e760d8ec22a6303a81d100aeae 100644 (file)
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/clk.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_net.h>
 #include <linux/of_platform.h>
-#include <linux/clk-provider.h>
 #include <linux/dma-mapping.h>
 #include <linux/irqchip.h>
 #include <linux/kexec.h>
 #include <asm/mach/arch.h>
-#include <asm/mach/map.h>
 #include <mach/bridge-regs.h>
-#include <linux/platform_data/usb-ehci-orion.h>
-#include <plat/irq.h>
 #include <plat/common.h>
 #include "common.h"
 
-/*
- * There are still devices that doesn't know about DT yet.  Get clock
- * gates here and add a clock lookup alias, so that old platform
- * devices still work.
-*/
-
-static void __init kirkwood_legacy_clk_init(void)
-{
-
-       struct device_node *np = of_find_compatible_node(
-               NULL, NULL, "marvell,kirkwood-gating-clock");
-       struct of_phandle_args clkspec;
-       struct clk *clk;
-
-       clkspec.np = np;
-       clkspec.args_count = 1;
-
-       /*
-        * The ethernet interfaces forget the MAC address assigned by
-        * u-boot if the clocks are turned off. Until proper DT support
-        * is available we always enable them for now.
-        */
-       clkspec.args[0] = CGC_BIT_GE0;
-       clk = of_clk_get_from_provider(&clkspec);
-       clk_prepare_enable(clk);
-
-       clkspec.args[0] = CGC_BIT_GE1;
-       clk = of_clk_get_from_provider(&clkspec);
-       clk_prepare_enable(clk);
-}
-
 #define MV643XX_ETH_MAC_ADDR_LOW       0x0414
 #define MV643XX_ETH_MAC_ADDR_HIGH      0x0418
 
@@ -140,7 +106,7 @@ eth_fixup_skip:
 
 static void __init kirkwood_dt_init(void)
 {
-       pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
+       pr_info("Kirkwood: %s.\n", kirkwood_id());
 
        /*
         * Disable propagation of mbus errors to the CPU local bus,
@@ -156,8 +122,6 @@ static void __init kirkwood_dt_init(void)
 
        kirkwood_cpufreq_init();
        kirkwood_cpuidle_init();
-       /* Setup clocks for legacy devices */
-       kirkwood_legacy_clk_init();
 
        kirkwood_pm_init();
        kirkwood_dt_eth_fixup();
index ebdda8346a265e293c13a6508b858ab875b87b93..ebdba87b96711a4a2a3970bcd824253ea9273327 100644 (file)
@@ -136,4 +136,7 @@ config USB_EHCI_MV_U2O
        help
          Enables support for OTG controller which can be switched to host mode.
 
+config MMP_SRAM
+       bool
+
 endif
index 9b702a1dc7b04a48d374ba01e200395ce7d341ff..98f0f6388e4458ad08935e131268a6ba640af3c5 100644 (file)
@@ -7,7 +7,8 @@ obj-y                           += common.o devices.o time.o
 # SoC support
 obj-$(CONFIG_CPU_PXA168)       += pxa168.o
 obj-$(CONFIG_CPU_PXA910)       += pxa910.o
-obj-$(CONFIG_CPU_MMP2)         += mmp2.o sram.o
+obj-$(CONFIG_CPU_MMP2)         += mmp2.o
+obj-$(CONFIG_MMP_SRAM)         += sram.o
 
 ifeq ($(CONFIG_COMMON_CLK), )
 obj-y                          += clock.o
index 7ac41e83cfefd42b0e219a2f6cfc173f0624ab2f..024022d91fe3e453dc4462fae847d12cb87dcdfa 100644 (file)
@@ -61,7 +61,7 @@ static inline uint32_t timer_read(void)
        return __raw_readl(mmp_timer_base + TMR_CVWR(1));
 }
 
-static u32 notrace mmp_read_sched_clock(void)
+static u64 notrace mmp_read_sched_clock(void)
 {
        return timer_read();
 }
@@ -195,7 +195,7 @@ void __init timer_init(int irq)
 {
        timer_config();
 
-       setup_sched_clock(mmp_read_sched_clock, 32, CLOCK_TICK_RATE);
+       sched_clock_register(mmp_read_sched_clock, 32, CLOCK_TICK_RATE);
 
        ckevt.cpumask = cpumask_of(0);
 
diff --git a/arch/arm/mach-moxart/Kconfig b/arch/arm/mach-moxart/Kconfig
new file mode 100644 (file)
index 0000000..ba470d6
--- /dev/null
@@ -0,0 +1,31 @@
+config ARCH_MOXART
+       bool "MOXA ART SoC" if ARCH_MULTI_V4T
+       select CPU_FA526
+       select ARM_DMA_MEM_BUFFERABLE
+       select DMA_OF
+       select USE_OF
+       select CLKSRC_OF
+       select CLKSRC_MMIO
+       select HAVE_CLK
+       select COMMON_CLK
+       select GENERIC_IRQ_CHIP
+       select ARCH_REQUIRE_GPIOLIB
+       select GENERIC_CLOCKEVENTS
+       select PHYLIB if NETDEVICES
+       help
+         Say Y here if you want to run your kernel on hardware with a
+         MOXA ART SoC.
+         The MOXA ART SoC is based on a Faraday FA526 ARMv4 32-bit
+         192 MHz CPU with MMU and 16KB/8KB D/I-cache (UC-7112-LX).
+         Used on models UC-7101, UC-7112/UC-7110, IA240/IA241, IA3341.
+
+if ARCH_MOXART
+
+config MACH_UC7112LX
+       bool "MOXA UC-7112-LX"
+       depends on ARCH_MOXART
+       help
+         Say Y here if you intend to run this kernel on a MOXA
+         UC-7112-LX embedded computer.
+
+endif
diff --git a/arch/arm/mach-moxart/Makefile b/arch/arm/mach-moxart/Makefile
new file mode 100644 (file)
index 0000000..fa022eb
--- /dev/null
@@ -0,0 +1,3 @@
+# Object file lists.
+
+obj-$(CONFIG_MACH_UC7112LX)    += moxart.o
diff --git a/arch/arm/mach-moxart/moxart.c b/arch/arm/mach-moxart/moxart.c
new file mode 100644 (file)
index 0000000..86b6d9b
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * arch/arm/mach-moxart/moxart.c
+ *
+ * (C) Copyright 2013, Jonas Jensen <jonas.jensen@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
index 2586c28658740f7ff1a19d1ce979f286a2e112b4..9625cf378931faa7b3e6740f963ac2128d7f92fe 100644 (file)
@@ -1,12 +1,50 @@
+config ARCH_MSM
+       bool
+
+config ARCH_MSM_DT
+       bool "Qualcomm MSM DT Support" if ARCH_MULTI_V7
+       select ARCH_MSM
+       select ARCH_REQUIRE_GPIOLIB
+       select CLKSRC_OF
+       select GENERIC_CLOCKEVENTS
+       help
+         Support for Qualcomm's devicetree based MSM systems.
+
 if ARCH_MSM
 
-comment "Qualcomm MSM SoC Type"
+menu "Qualcomm MSM SoC Selection"
        depends on ARCH_MSM_DT
 
+config ARCH_MSM8X60
+       bool "Enable support for MSM8X60"
+       select ARM_GIC
+       select CPU_V7
+       select HAVE_SMP
+       select MSM_SCM if SMP
+       select MSM_TIMER
+
+config ARCH_MSM8960
+       bool "Enable support for MSM8960"
+       select ARM_GIC
+       select CPU_V7
+       select HAVE_SMP
+       select MSM_SCM if SMP
+       select MSM_TIMER
+
+config ARCH_MSM8974
+       bool "Enable support for MSM8974"
+       select ARM_GIC
+       select CPU_V7
+       select HAVE_ARM_ARCH_TIMER
+       select HAVE_SMP
+       select MSM_SCM if SMP
+
+endmenu
+
 choice
        prompt "Qualcomm MSM SoC Type"
        default ARCH_MSM7X00A
-       depends on !ARCH_MSM_DT
+       depends on ARCH_MSM_NODT
 
 config ARCH_MSM7X00A
        bool "MSM7x00A / MSM7x01A"
@@ -16,6 +54,7 @@ config ARCH_MSM7X00A
        select MACH_TROUT if !MACH_HALIBUT
        select MSM_PROC_COMM
        select MSM_SMD
+       select MSM_TIMER
        select MSM_SMD_PKG3
 
 config ARCH_MSM7X30
@@ -27,6 +66,7 @@ config ARCH_MSM7X30
        select MSM_GPIOMUX
        select MSM_PROC_COMM
        select MSM_SMD
+       select MSM_TIMER
        select MSM_VIC
 
 config ARCH_QSD8X50
@@ -38,32 +78,11 @@ config ARCH_QSD8X50
        select MSM_GPIOMUX
        select MSM_PROC_COMM
        select MSM_SMD
+       select MSM_TIMER
        select MSM_VIC
 
 endchoice
 
-config ARCH_MSM8X60
-       bool "MSM8X60"
-       select ARM_GIC
-       select CPU_V7
-       select GPIO_MSM_V2
-       select HAVE_SMP
-       select MSM_SCM if SMP
-
-config ARCH_MSM8960
-       bool "MSM8960"
-       select ARM_GIC
-       select CPU_V7
-       select HAVE_SMP
-       select GPIO_MSM_V2
-       select MSM_SCM if SMP
-
-config ARCH_MSM_DT
-       def_bool y
-       depends on (ARCH_MSM8X60 || ARCH_MSM8960)
-       select SPARSE_IRQ
-       select USE_OF
-
 config MSM_HAS_DEBUG_UART_HS
        bool
 
@@ -80,7 +99,7 @@ config  MSM_VIC
        bool
 
 menu "Qualcomm MSM Board Type"
-       depends on !ARCH_MSM_DT
+       depends on ARCH_MSM_NODT
 
 config MACH_HALIBUT
        depends on ARCH_MSM
@@ -128,10 +147,13 @@ config MSM_SMD
 
 config MSM_GPIOMUX
        bool
-       depends on !ARCH_MSM_DT
        help
          Support for MSM V1 TLMM GPIOMUX architecture.
 
 config MSM_SCM
        bool
+
+config MSM_TIMER
+       bool
+
 endif
index 7ed4c1b2bdd20fd24ffd090ee63f7b9607ba66cb..8e307a10d3c344a5dd2acb6900812baef9e4b43c 100644 (file)
@@ -1,5 +1,5 @@
-obj-y += timer.o
-obj-y += clock.o
+obj-$(CONFIG_MSM_TIMER) += timer.o
+obj-$(CONFIG_MSM_PROC_COMM) += clock.o
 
 obj-$(CONFIG_MSM_VIC) += irq-vic.o
 
index 16e6183ac9f12b067dc13831b1e7f2664dfa7d3c..1f11d93e700e4784d5b5d33e333f708b6d0cd295 100644 (file)
@@ -26,7 +26,16 @@ static const char * const msm_dt_match[] __initconst = {
        NULL
 };
 
+static const char * const apq8074_dt_match[] __initconst = {
+       "qcom,apq8074-dragonboard",
+       NULL
+};
+
 DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
        .smp = smp_ops(msm_smp_ops),
        .dt_compat = msm_dt_match,
 MACHINE_END
+
+DT_MACHINE_START(APQ_DT, "Qualcomm MSM (Flattened Device Tree)")
+       .dt_compat = apq8074_dt_match,
+MACHINE_END
index f9af5a46e8b684b0e2f2126f0a7abc7e665e02bf..46de789ad3ae8e7a9f0b1c172ad36106cf2ab86c 100644 (file)
@@ -30,6 +30,7 @@
 #include <asm/memory.h>
 #include <asm/setup.h>
 
+#include <mach/clk.h>
 #include <mach/msm_iomap.h>
 #include <mach/dma.h>
 
@@ -60,10 +61,44 @@ static int hsusb_phy_init_seq[] = {
        -1
 };
 
+static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
+{
+       int ret;
+
+       if (assert) {
+               ret = clk_reset(link_clk, CLK_RESET_ASSERT);
+               if (ret)
+                       pr_err("usb hs_clk assert failed\n");
+       } else {
+               ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
+               if (ret)
+                       pr_err("usb hs_clk deassert failed\n");
+       }
+       return ret;
+}
+
+static int hsusb_phy_clk_reset(struct clk *phy_clk)
+{
+       int ret;
+
+       ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
+       if (ret) {
+               pr_err("usb phy clk assert failed\n");
+               return ret;
+       }
+       usleep_range(10000, 12000);
+       ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
+       if (ret)
+               pr_err("usb phy clk deassert failed\n");
+       return ret;
+}
+
 static struct msm_otg_platform_data msm_otg_pdata = {
        .phy_init_seq           = hsusb_phy_init_seq,
        .mode                   = USB_PERIPHERAL,
        .otg_control            = OTG_PHY_CONTROL,
+       .link_clk_reset         = hsusb_link_clk_reset,
+       .phy_clk_reset          = hsusb_phy_clk_reset,
 };
 
 struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
index 5f933bc507838e10cb408e5088b06b706d1894b7..9169ec324a43dc88f9cdf5d22f1a6adfac6c9187 100644 (file)
@@ -31,6 +31,7 @@
 #include <mach/irqs.h>
 #include <mach/sirc.h>
 #include <mach/vreg.h>
+#include <mach/clk.h>
 #include <linux/platform_data/mmc-msm_sdcc.h>
 
 #include "devices.h"
@@ -81,10 +82,44 @@ static int hsusb_phy_init_seq[] = {
        -1
 };
 
+static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
+{
+       int ret;
+
+       if (assert) {
+               ret = clk_reset(link_clk, CLK_RESET_ASSERT);
+               if (ret)
+                       pr_err("usb hs_clk assert failed\n");
+       } else {
+               ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
+               if (ret)
+                       pr_err("usb hs_clk deassert failed\n");
+       }
+       return ret;
+}
+
+static int hsusb_phy_clk_reset(struct clk *phy_clk)
+{
+       int ret;
+
+       ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
+       if (ret) {
+               pr_err("usb phy clk assert failed\n");
+               return ret;
+       }
+       usleep_range(10000, 12000);
+       ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
+       if (ret)
+               pr_err("usb phy clk deassert failed\n");
+       return ret;
+}
+
 static struct msm_otg_platform_data msm_otg_pdata = {
        .phy_init_seq           = hsusb_phy_init_seq,
        .mode                   = USB_PERIPHERAL,
        .otg_control            = OTG_PHY_CONTROL,
+       .link_clk_reset         = hsusb_link_clk_reset,
+       .phy_clk_reset          = hsusb_phy_clk_reset,
 };
 
 static struct platform_device *devices[] __initdata = {
index ccf6621bc664e4403e953a2cbb99c44048d8d37d..015d544aa01791ae811e45f581bb63ad347fec0e 100644 (file)
@@ -13,6 +13,7 @@
  * GNU General Public License for more details.
  *
  */
+#define pr_fmt(fmt) "%s: " fmt, __func__
 
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -68,12 +69,11 @@ static void __init trout_init(void)
 
        platform_add_devices(devices, ARRAY_SIZE(devices));
 
-#ifdef CONFIG_MMC
-        rc = trout_init_mmc(system_rev);
-        if (rc)
-                printk(KERN_CRIT "%s: MMC init failure (%d)\n", __func__, rc);
-#endif
-
+       if (IS_ENABLED(CONFIG_MMC)) {
+               rc = trout_init_mmc(system_rev);
+               if (rc)
+                       pr_crit("MMC init failure (%d)\n", rc);
+       }
 }
 
 static struct map_desc trout_io_desc[] __initdata = {
index 3f06edcdd0ce7a05e84aab9babd912a2033ffa97..f10a1f58fde96a0cb70b6cfc43ae4b5203f67466 100644 (file)
@@ -99,8 +99,7 @@ static int msm_boot_secondary(unsigned int cpu, struct task_struct *idle)
         * "cpu" is Linux's internal ID.
         */
        pen_release = cpu_logical_map(cpu);
-       __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
-       outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
+       sync_cache_w(&pen_release);
 
        /*
         * Send the secondary CPU a soft interrupt, thereby causing
index 1e9c3383daba7e6995f301527eb480b5ebdb8662..fd1644987534e6a54db4a7b157f9df817eff222e 100644 (file)
@@ -187,7 +187,7 @@ static struct notifier_block msm_timer_cpu_nb = {
        .notifier_call = msm_timer_cpu_notify,
 };
 
-static notrace u32 msm_sched_clock_read(void)
+static u64 notrace msm_sched_clock_read(void)
 {
        return msm_clocksource.read(&msm_clocksource);
 }
@@ -229,7 +229,7 @@ err:
        res = clocksource_register_hz(cs, dgt_hz);
        if (res)
                pr_err("clocksource_register failed\n");
-       setup_sched_clock(msm_sched_clock_read, sched_bits, dgt_hz);
+       sched_clock_register(msm_sched_clock_read, sched_bits, dgt_hz);
 }
 
 #ifdef CONFIG_OF
index 2d04f0e218703e74da2ba700f640c6378d93fe66..878aebe98dcc817029732847f6b2fb39880f8ba2 100644 (file)
@@ -3,7 +3,7 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
 
 AFLAGS_coherency_ll.o          := -Wa,-march=armv7-a
 
-obj-y                           += system-controller.o
+obj-y                           += system-controller.o mvebu-soc-id.o
 obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o
 obj-$(CONFIG_ARCH_MVEBU)        += coherency.o coherency_ll.o pmsu.o
 obj-$(CONFIG_SMP)                += platsmp.o headsmp.o
index e2acff98e750a013dd54356249306259cb055091..f6c9d1d85c14271b2adbaddaab8431d8c675033c 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/clocksource.h>
 #include <linux/dma-mapping.h>
 #include <linux/mbus.h>
+#include <linux/slab.h>
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -28,6 +29,7 @@
 #include "armada-370-xp.h"
 #include "common.h"
 #include "coherency.h"
+#include "mvebu-soc-id.h"
 
 static void __init armada_370_xp_map_io(void)
 {
@@ -45,8 +47,38 @@ static void __init armada_370_xp_timer_and_clk_init(void)
 #endif
 }
 
+static void __init i2c_quirk(void)
+{
+       struct device_node *np;
+       u32 dev, rev;
+
+       /*
+        * Only revisons more recent than A0 support the offload
+        * mechanism. We can exit only if we are sure that we can
+        * get the SoC revision and it is more recent than A0.
+        */
+       if (mvebu_get_soc_id(&rev, &dev) == 0 && dev > MV78XX0_A0_REV)
+               return;
+
+       for_each_compatible_node(np, NULL, "marvell,mv78230-i2c") {
+               struct property *new_compat;
+
+               new_compat = kzalloc(sizeof(*new_compat), GFP_KERNEL);
+
+               new_compat->name = kstrdup("compatible", GFP_KERNEL);
+               new_compat->length = sizeof("marvell,mv78230-a0-i2c");
+               new_compat->value = kstrdup("marvell,mv78230-a0-i2c",
+                                               GFP_KERNEL);
+
+               of_update_property(np, new_compat);
+       }
+       return;
+}
+
 static void __init armada_370_xp_dt_init(void)
 {
+       if (of_machine_is_compatible("plathome,openblocks-ax3-4"))
+               i2c_quirk();
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
index c612b2c4ed6cf9969153c1cee7c96221f054d1d8..237c86b83390178a069f22971c960766bdaa22f2 100644 (file)
 #ifdef CONFIG_SMP
 #include <linux/cpumask.h>
 
+#define ARMADA_XP_MAX_CPUS 4
+
 void armada_mpic_send_doorbell(const struct cpumask *mask, unsigned int irq);
 void armada_xp_mpic_smp_cpu_init(void);
+void armada_xp_secondary_startup(void);
+extern struct smp_operations armada_xp_smp_ops;
 #endif
 
 #endif /* __MACH_ARMADA_370_XP_H */
index 58adf2fd9cfc98ea03f6b1f8cfe037ceb01bd78b..4e9d58148ca7e3031cbbdaa5dba2bb5aa0607619 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/smp_plat.h>
 #include <asm/cacheflush.h>
 #include "armada-370-xp.h"
+#include "coherency.h"
 
 unsigned long coherency_phys_base;
 static void __iomem *coherency_base;
index df33ad8a6c08935b9fea023c570c8881b22ecb8b..760226c4135309b4ec79ddda47ba9fb18c31a3f4 100644 (file)
@@ -14,7 +14,9 @@
 #ifndef __MACH_370_XP_COHERENCY_H
 #define __MACH_370_XP_COHERENCY_H
 
-int set_cpu_coherent(int cpu_id, int smp_group_id);
+extern unsigned long coherency_phys_base;
+
+int set_cpu_coherent(unsigned int cpu_id, int smp_group_id);
 int coherency_init(void);
 
 #endif /* __MACH_370_XP_COHERENCY_H */
index e366010e1d91097432383f7c9c6cca7e220a6bc7..55449c487c9e9dff0a8e084b75a269d650cb5a93 100644 (file)
 #ifndef __ARCH_MVEBU_COMMON_H
 #define __ARCH_MVEBU_COMMON_H
 
-#define ARMADA_XP_MAX_CPUS 4
-
 #include <linux/reboot.h>
 
 void mvebu_restart(enum reboot_mode mode, const char *cmd);
 
-void armada_370_xp_init_irq(void);
-void armada_370_xp_handle_irq(struct pt_regs *regs);
-
 void armada_xp_cpu_die(unsigned int cpu);
-int armada_370_xp_coherency_init(void);
-int armada_370_xp_pmsu_init(void);
-void armada_xp_secondary_startup(void);
-extern struct smp_operations armada_xp_smp_ops;
+
 #endif
index b228b6a80c85cc9693b3246de4272bd115c0e561..d95e910471684544d63e853308419d68036ec01c 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/errno.h>
 #include <linux/smp.h>
 #include <asm/proc-fns.h>
+#include "common.h"
 
 /*
  * platform-specific code to shutdown a CPU
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c
new file mode 100644 (file)
index 0000000..fe4fc1c
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * ID and revision information for mvebu SoCs
+ *
+ * Copyright (C) 2014 Marvell
+ *
+ * Gregory CLEMENT <gregory.clement@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ *
+ * All the mvebu SoCs have information related to their variant and
+ * revision that can be read from the PCI control register. This is
+ * done before the PCI initialization to avoid any conflict. Once the
+ * ID and revision are retrieved, the mapping is freed.
+ */
+
+#define pr_fmt(fmt) "mvebu-soc-id: " fmt
+
+#include <linux/clk.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include "mvebu-soc-id.h"
+
+#define PCIE_DEV_ID_OFF                0x0
+#define PCIE_DEV_REV_OFF       0x8
+
+#define SOC_ID_MASK        0xFFFF0000
+#define SOC_REV_MASK       0xFF
+
+static u32 soc_dev_id;
+static u32 soc_rev;
+static bool is_id_valid;
+
+static const struct of_device_id mvebu_pcie_of_match_table[] = {
+       { .compatible = "marvell,armada-xp-pcie", },
+       { .compatible = "marvell,armada-370-pcie", },
+       {},
+};
+
+int mvebu_get_soc_id(u32 *dev, u32 *rev)
+{
+       if (is_id_valid) {
+               *dev = soc_dev_id;
+               *rev = soc_rev;
+               return 0;
+       } else
+               return -1;
+}
+
+static int __init mvebu_soc_id_init(void)
+{
+       struct device_node *np;
+       int ret = 0;
+       void __iomem *pci_base;
+       struct clk *clk;
+       struct device_node *child;
+
+       np = of_find_matching_node(NULL, mvebu_pcie_of_match_table);
+       if (!np)
+               return ret;
+
+       /*
+        * ID and revision are available from any port, so we
+        * just pick the first one
+        */
+       child = of_get_next_child(np, NULL);
+       if (child == NULL) {
+               pr_err("cannot get pci node\n");
+               ret = -ENOMEM;
+               goto clk_err;
+       }
+
+       clk = of_clk_get_by_name(child, NULL);
+       if (IS_ERR(clk)) {
+               pr_err("cannot get clock\n");
+               ret = -ENOMEM;
+               goto clk_err;
+       }
+
+       ret = clk_prepare_enable(clk);
+       if (ret) {
+               pr_err("cannot enable clock\n");
+               goto clk_err;
+       }
+
+       pci_base = of_iomap(child, 0);
+       if (IS_ERR(pci_base)) {
+               pr_err("cannot map registers\n");
+               ret = -ENOMEM;
+               goto res_ioremap;
+       }
+
+       /* SoC ID */
+       soc_dev_id = readl(pci_base + PCIE_DEV_ID_OFF) >> 16;
+
+       /* SoC revision */
+       soc_rev = readl(pci_base + PCIE_DEV_REV_OFF) & SOC_REV_MASK;
+
+       is_id_valid = true;
+
+       pr_info("MVEBU SoC ID=0x%X, Rev=0x%X\n", soc_dev_id, soc_rev);
+
+       iounmap(pci_base);
+
+res_ioremap:
+       clk_disable_unprepare(clk);
+
+clk_err:
+       of_node_put(child);
+       of_node_put(np);
+
+       return ret;
+}
+core_initcall(mvebu_soc_id_init);
+
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.h b/arch/arm/mach-mvebu/mvebu-soc-id.h
new file mode 100644 (file)
index 0000000..3165425
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Marvell EBU SoC ID and revision definitions.
+ *
+ * Copyright (C) 2014 Marvell Semiconductor
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef __LINUX_MVEBU_SOC_ID_H
+#define __LINUX_MVEBU_SOC_ID_H
+
+/* Armada XP ID */
+#define MV78230_DEV_ID     0x7823
+#define MV78260_DEV_ID     0x7826
+#define MV78460_DEV_ID     0x7846
+
+/* Armada XP Revision */
+#define MV78XX0_A0_REV     0x1
+#define MV78XX0_B0_REV     0x2
+
+#ifdef CONFIG_ARCH_MVEBU
+int mvebu_get_soc_id(u32 *dev, u32 *rev);
+#else
+static inline int mvebu_get_soc_id(u32 *dev, u32 *rev)
+{
+       return -1;
+}
+#endif
+
+#endif /* __LINUX_MVEBU_SOC_ID_H */
index ff69c2df298b6b2ce69f742c7f5b6dbcf179f821..a6da03f5b24ec921090af5508a2b6d87a66c7197 100644 (file)
@@ -46,7 +46,7 @@ static struct clk *__init get_cpu_clk(int cpu)
        return cpu_clk;
 }
 
-void __init set_secondary_cpus_clock(void)
+static void __init set_secondary_cpus_clock(void)
 {
        int thiscpu, cpu;
        unsigned long rate;
@@ -94,7 +94,7 @@ static void __init armada_xp_smp_init_cpus(void)
        set_smp_cross_call(armada_mpic_send_doorbell);
 }
 
-void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
+static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
 {
        struct device_node *node;
        struct resource res;
index 27fc4f049474ed94b07cef00dfe3304b1165369c..d71ef53107c4e9a530a558458d31eecf92039bd2 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/smp.h>
 #include <asm/smp_plat.h>
+#include "pmsu.h"
 
 static void __iomem *pmsu_mp_base;
 static void __iomem *pmsu_reset_base;
@@ -58,7 +59,7 @@ int armada_xp_boot_cpu(unsigned int cpu_id, void *boot_addr)
 }
 #endif
 
-int __init armada_370_xp_pmsu_init(void)
+static int __init armada_370_xp_pmsu_init(void)
 {
        struct device_node *np;
 
index 5175083cdb34650802288789c55a82aee8c20d08..a7fb89a5b5d9818db3174916d0e7e0589ed53456 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/of_address.h>
 #include <linux/io.h>
 #include <linux/reboot.h>
+#include "common.h"
 
 static void __iomem *system_controller_base;
 
@@ -39,14 +40,14 @@ struct mvebu_system_controller {
 };
 static struct mvebu_system_controller *mvebu_sc;
 
-const struct mvebu_system_controller armada_370_xp_system_controller = {
+static const struct mvebu_system_controller armada_370_xp_system_controller = {
        .rstoutn_mask_offset = 0x60,
        .system_soft_reset_offset = 0x64,
        .rstoutn_mask_reset_out_en = 0x1,
        .system_soft_reset = 0x1,
 };
 
-const struct mvebu_system_controller orion_system_controller = {
+static const struct mvebu_system_controller orion_system_controller = {
        .rstoutn_mask_offset = 0x108,
        .system_soft_reset_offset = 0x10c,
        .rstoutn_mask_reset_out_en = 0x4,
index cce2c9dfb5d13d73b92076bd675415de6ff85bc6..4a1065e41e9c5a9994fc2b2f9807f7bf6bbcfa1d 100644 (file)
@@ -109,38 +109,6 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)
        writel(1, srcbase + 0x18);
 }
 
-/*
- * The SMSC911x IRQ is connected to a GPIO pin, but the driver expects
- * to simply request an IRQ passed as a resource. So the GPIO pin needs
- * to be requested by this hog and set as input.
- */
-static int __init cpu8815_eth_init(void)
-{
-       struct device_node *eth;
-       int gpio, irq, err;
-
-       eth = of_find_node_by_path("/usb-s8815/ethernet-gpio");
-       if (!eth) {
-               pr_info("could not find any ethernet GPIO\n");
-               return 0;
-       }
-       gpio = of_get_gpio(eth, 0);
-       err = gpio_request(gpio, "eth_irq");
-       if (err) {
-               pr_info("failed to request ethernet GPIO\n");
-               return -ENODEV;
-       }
-       err = gpio_direction_input(gpio);
-       if (err) {
-               pr_info("failed to set ethernet GPIO as input\n");
-               return -ENODEV;
-       }
-       irq = gpio_to_irq(gpio);
-       pr_info("enabled USB-S8815 ethernet GPIO %d, IRQ %d\n", gpio, irq);
-       return 0;
-}
-device_initcall(cpu8815_eth_init);
-
 /*
  * This GPIO pin turns on a line that is used to detect card insertion
  * on this board.
index 6b5f298d66382abe2f380952c32fda20bcfdfa56..a7588cfd0286d9293c73ea76723cc9e17b612ac5 100644 (file)
@@ -181,7 +181,7 @@ static __init void omap_init_mpu_timer(unsigned long rate)
  * ---------------------------------------------------------------------------
  */
 
-static u32 notrace omap_mpu_read_sched_clock(void)
+static u64 notrace omap_mpu_read_sched_clock(void)
 {
        return ~omap_mpu_timer_read(1);
 }
@@ -193,7 +193,7 @@ static void __init omap_init_clocksource(unsigned long rate)
                        "%s: can't register clocksource!\n";
 
        omap_mpu_timer_start(1, ~0, 1);
-       setup_sched_clock(omap_mpu_read_sched_clock, 32, rate);
+       sched_clock_register(omap_mpu_read_sched_clock, 32, rate);
 
        if (clocksource_mmio_init(&timer->read_tim, "mpu_timer2", rate,
                        300, 32, clocksource_mmio_readl_down))
index dc21df16616119f8341077fd5131537065590088..4191ae08f4c81a2c95059df01fac77f883f30b70 100644 (file)
@@ -192,19 +192,6 @@ config MACH_OMAP2_TUSB6010
        depends on ARCH_OMAP2 && SOC_OMAP2420
        default y if MACH_NOKIA_N8X0
 
-config MACH_OMAP_H4
-       bool "OMAP 2420 H4 board"
-       depends on SOC_OMAP2420
-       default y
-       select OMAP_DEBUG_DEVICES
-       select OMAP_PACKAGE_ZAF
-
-config MACH_OMAP_2430SDP
-       bool "OMAP 2430 SDP board"
-       depends on SOC_OMAP2430
-       default y
-       select OMAP_PACKAGE_ZAC
-
 config MACH_OMAP3_BEAGLE
        bool "OMAP3 BEAGLE board"
        depends on ARCH_OMAP3
index adcef406ff0abdc5a1695cac7f9cb04dc6ac542e..f78b177e8f4fd17849c3265200b319fc17d52198 100644 (file)
@@ -66,8 +66,6 @@ obj-$(CONFIG_SOC_OMAP5)                       += omap4-restart.o
 obj-$(CONFIG_SOC_DRA7XX)               += omap4-restart.o
 
 # Pin multiplexing
-obj-$(CONFIG_SOC_OMAP2420)             += mux2420.o
-obj-$(CONFIG_SOC_OMAP2430)             += mux2430.o
 obj-$(CONFIG_ARCH_OMAP3)               += mux34xx.o
 
 # SMS/SDRC
@@ -237,8 +235,6 @@ obj-$(CONFIG_SOC_OMAP2420)          += msdi.o
 
 # Specific board support
 obj-$(CONFIG_MACH_OMAP_GENERIC)                += board-generic.o pdata-quirks.o
-obj-$(CONFIG_MACH_OMAP_H4)             += board-h4.o
-obj-$(CONFIG_MACH_OMAP_2430SDP)                += board-2430sdp.o
 obj-$(CONFIG_MACH_OMAP3_BEAGLE)                += board-omap3beagle.o
 obj-$(CONFIG_MACH_DEVKIT8000)          += board-devkit8000.o
 obj-$(CONFIG_MACH_OMAP_LDP)            += board-ldp.o
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
deleted file mode 100644 (file)
index c711ad6..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * linux/arch/arm/mach-omap2/board-2430sdp.c
- *
- * Copyright (C) 2006 Texas Instruments
- *
- * Modified from mach-omap2/board-generic.c
- *
- * Initial Code : Based on a patch from Komal Shah and Richard Woodruff
- * Updated the Code for 2430 SDP : Syed Mohammed Khasim
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
-#include <linux/mmc/host.h>
-#include <linux/delay.h>
-#include <linux/i2c/twl.h>
-#include <linux/regulator/machine.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/gpio.h>
-#include <linux/usb/phy.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include "common.h"
-#include "gpmc.h"
-#include "gpmc-smc91x.h"
-
-#include <video/omapdss.h>
-#include <video/omap-panel-data.h>
-
-#include "mux.h"
-#include "hsmmc.h"
-#include "common-board-devices.h"
-
-#define SDP2430_CS0_BASE       0x04000000
-#define SECONDARY_LCD_GPIO             147
-
-static struct mtd_partition sdp2430_partitions[] = {
-       /* bootloader (U-Boot, etc) in first sector */
-       {
-               .name           = "bootloader",
-               .offset         = 0,
-               .size           = SZ_256K,
-               .mask_flags     = MTD_WRITEABLE,        /* force read-only */
-        },
-       /* bootloader params in the next sector */
-       {
-               .name           = "params",
-               .offset         = MTDPART_OFS_APPEND,
-               .size           = SZ_128K,
-               .mask_flags     = 0,
-        },
-       /* kernel */
-       {
-               .name           = "kernel",
-               .offset         = MTDPART_OFS_APPEND,
-               .size           = SZ_2M,
-               .mask_flags     = 0
-       },
-       /* file system */
-       {
-               .name           = "filesystem",
-               .offset         = MTDPART_OFS_APPEND,
-               .size           = MTDPART_SIZ_FULL,
-               .mask_flags     = 0
-       }
-};
-
-static struct physmap_flash_data sdp2430_flash_data = {
-       .width          = 2,
-       .parts          = sdp2430_partitions,
-       .nr_parts       = ARRAY_SIZE(sdp2430_partitions),
-};
-
-static struct resource sdp2430_flash_resource = {
-       .start          = SDP2430_CS0_BASE,
-       .end            = SDP2430_CS0_BASE + SZ_64M - 1,
-       .flags          = IORESOURCE_MEM,
-};
-
-static struct platform_device sdp2430_flash_device = {
-       .name           = "physmap-flash",
-       .id             = 0,
-       .dev = {
-               .platform_data  = &sdp2430_flash_data,
-       },
-       .num_resources  = 1,
-       .resource       = &sdp2430_flash_resource,
-};
-
-/* LCD */
-#define SDP2430_LCD_PANEL_BACKLIGHT_GPIO       91
-#define SDP2430_LCD_PANEL_ENABLE_GPIO          154
-
-static const struct display_timing sdp2430_lcd_videomode = {
-       .pixelclock     = { 0, 5400000, 0 },
-
-       .hactive = { 0, 240, 0 },
-       .hfront_porch = { 0, 3, 0 },
-       .hback_porch = { 0, 39, 0 },
-       .hsync_len = { 0, 3, 0 },
-
-       .vactive = { 0, 320, 0 },
-       .vfront_porch = { 0, 2, 0 },
-       .vback_porch = { 0, 7, 0 },
-       .vsync_len = { 0, 1, 0 },
-
-       .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
-               DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE,
-};
-
-static struct panel_dpi_platform_data sdp2430_lcd_pdata = {
-       .name                   = "lcd",
-       .source                 = "dpi.0",
-
-       .data_lines             = 16,
-
-       .display_timing         = &sdp2430_lcd_videomode,
-
-       .enable_gpio            = SDP2430_LCD_PANEL_ENABLE_GPIO,
-       .backlight_gpio         = SDP2430_LCD_PANEL_BACKLIGHT_GPIO,
-};
-
-static struct platform_device sdp2430_lcd_device = {
-       .name                   = "panel-dpi",
-       .id                     = 0,
-       .dev.platform_data      = &sdp2430_lcd_pdata,
-};
-
-static struct omap_dss_board_info sdp2430_dss_data = {
-       .default_display_name = "lcd",
-};
-
-static struct platform_device *sdp2430_devices[] __initdata = {
-       &sdp2430_flash_device,
-       &sdp2430_lcd_device,
-};
-
-#if IS_ENABLED(CONFIG_SMC91X)
-
-static struct omap_smc91x_platform_data board_smc91x_data = {
-       .cs             = 5,
-       .gpio_irq       = 149,
-       .flags          = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 |
-                               IORESOURCE_IRQ_LOWLEVEL,
-
-};
-
-static void __init board_smc91x_init(void)
-{
-       omap_mux_init_gpio(149, OMAP_PIN_INPUT);
-       gpmc_smc91x_init(&board_smc91x_data);
-}
-
-#else
-
-static inline void board_smc91x_init(void)
-{
-}
-
-#endif
-
-static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = {
-       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
-};
-
-/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
-static struct regulator_init_data sdp2430_vmmc1 = {
-       .constraints = {
-               .min_uV                 = 1850000,
-               .max_uV                 = 3150000,
-               .valid_modes_mask       = REGULATOR_MODE_NORMAL
-                                       | REGULATOR_MODE_STANDBY,
-               .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
-                                       | REGULATOR_CHANGE_MODE
-                                       | REGULATOR_CHANGE_STATUS,
-       },
-       .num_consumer_supplies  = ARRAY_SIZE(sdp2430_vmmc1_supplies),
-       .consumer_supplies      = &sdp2430_vmmc1_supplies[0],
-};
-
-static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
-};
-
-static struct twl4030_platform_data sdp2430_twldata = {
-       /* platform_data for children goes here */
-       .gpio           = &sdp2430_gpio_data,
-       .vmmc1          = &sdp2430_vmmc1,
-};
-
-static struct i2c_board_info __initdata sdp2430_i2c1_boardinfo[] = {
-       {
-               I2C_BOARD_INFO("isp1301_omap", 0x2D),
-               .flags = I2C_CLIENT_WAKE,
-       },
-};
-
-static int __init omap2430_i2c_init(void)
-{
-       sdp2430_i2c1_boardinfo[0].irq = gpio_to_irq(78);
-       omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo,
-                       ARRAY_SIZE(sdp2430_i2c1_boardinfo));
-       omap_pmic_init(2, 100, "twl4030", 7 + OMAP_INTC_START,
-                       &sdp2430_twldata);
-       return 0;
-}
-
-static struct omap2_hsmmc_info mmc[] __initdata = {
-       {
-               .mmc            = 1,
-               .caps           = MMC_CAP_4_BIT_DATA,
-               .gpio_cd        = -EINVAL,
-               .gpio_wp        = -EINVAL,
-               .ext_clock      = 1,
-       },
-       {}      /* Terminator */
-};
-
-#ifdef CONFIG_OMAP_MUX
-static struct omap_board_mux board_mux[] __initdata = {
-       { .reg_offset = OMAP_MUX_TERMINATOR },
-};
-#endif
-
-static void __init omap_2430sdp_init(void)
-{
-       omap2430_mux_init(board_mux, OMAP_PACKAGE_ZAC);
-
-       omap2430_i2c_init();
-
-       platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
-       omap_serial_init();
-       omap_sdrc_init(NULL, NULL);
-       omap_hsmmc_init(mmc);
-
-       omap_mux_init_signal("usb0hs_stp", OMAP_PULL_ENA | OMAP_PULL_UP);
-       usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
-       usb_musb_init(NULL);
-
-       board_smc91x_init();
-
-       /* Turn off secondary LCD backlight */
-       gpio_request_one(SECONDARY_LCD_GPIO, GPIOF_OUT_INIT_LOW,
-                        "Secondary LCD backlight");
-
-       omap_display_init(&sdp2430_dss_data);
-}
-
-MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
-       /* Maintainer: Syed Khasim - Texas Instruments Inc */
-       .atag_offset    = 0x100,
-       .reserve        = omap_reserve,
-       .map_io         = omap243x_map_io,
-       .init_early     = omap2430_init_early,
-       .init_irq       = omap2_init_irq,
-       .handle_irq     = omap2_intc_handle_irq,
-       .init_machine   = omap_2430sdp_init,
-       .init_late      = omap2430_init_late,
-       .init_time      = omap2_sync32k_timer_init,
-       .restart        = omap2xxx_restart,
-MACHINE_END
index 8d972ff18c561111317aa96d61c0b9fda2d8cade..8e3daa11602b305473b63ded02749cf152c6f415 100644 (file)
@@ -78,6 +78,7 @@ MACHINE_END
 
 #ifdef CONFIG_ARCH_OMAP3
 static const char *omap3_boards_compat[] __initdata = {
+       "ti,omap3430",
        "ti,omap3",
        NULL,
 };
@@ -173,6 +174,8 @@ MACHINE_END
 
 #ifdef CONFIG_ARCH_OMAP4
 static const char *omap4_boards_compat[] __initdata = {
+       "ti,omap4460",
+       "ti,omap4430",
        "ti,omap4",
        NULL,
 };
@@ -193,6 +196,8 @@ MACHINE_END
 
 #ifdef CONFIG_SOC_OMAP5
 static const char *omap5_boards_compat[] __initdata = {
+       "ti,omap5432",
+       "ti,omap5430",
        "ti,omap5",
        NULL,
 };
@@ -213,6 +218,7 @@ MACHINE_END
 
 #ifdef CONFIG_SOC_AM43XX
 static const char *am43_boards_compat[] __initdata = {
+       "ti,am4372",
        "ti,am43",
        NULL,
 };
@@ -230,6 +236,7 @@ MACHINE_END
 
 #ifdef CONFIG_SOC_DRA7XX
 static const char *dra7xx_boards_compat[] __initdata = {
+       "ti,dra7xx",
        "ti,dra7",
        NULL,
 };
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
deleted file mode 100644 (file)
index f780834..0000000
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * linux/arch/arm/mach-omap2/board-h4.c
- *
- * Copyright (C) 2005 Nokia Corporation
- * Author: Paul Mundt <paul.mundt@nokia.com>
- *
- * Modified from mach-omap/omap1/board-generic.c
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/gpio.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
-#include <linux/delay.h>
-#include <linux/workqueue.h>
-#include <linux/i2c.h>
-#include <linux/platform_data/at24.h>
-#include <linux/input.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/input/matrix_keypad.h>
-#include <linux/mfd/menelaus.h>
-#include <linux/omap-dma.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <video/omapdss.h>
-#include <video/omap-panel-data.h>
-
-#include "common.h"
-#include "mux.h"
-#include "control.h"
-#include "gpmc.h"
-#include "gpmc-smc91x.h"
-
-#define H4_FLASH_CS    0
-
-#if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
-static const uint32_t board_matrix_keys[] = {
-       KEY(0, 0, KEY_LEFT),
-       KEY(1, 0, KEY_RIGHT),
-       KEY(2, 0, KEY_A),
-       KEY(3, 0, KEY_B),
-       KEY(4, 0, KEY_C),
-       KEY(0, 1, KEY_DOWN),
-       KEY(1, 1, KEY_UP),
-       KEY(2, 1, KEY_E),
-       KEY(3, 1, KEY_F),
-       KEY(4, 1, KEY_G),
-       KEY(0, 2, KEY_ENTER),
-       KEY(1, 2, KEY_I),
-       KEY(2, 2, KEY_J),
-       KEY(3, 2, KEY_K),
-       KEY(4, 2, KEY_3),
-       KEY(0, 3, KEY_M),
-       KEY(1, 3, KEY_N),
-       KEY(2, 3, KEY_O),
-       KEY(3, 3, KEY_P),
-       KEY(4, 3, KEY_Q),
-       KEY(0, 4, KEY_R),
-       KEY(1, 4, KEY_4),
-       KEY(2, 4, KEY_T),
-       KEY(3, 4, KEY_U),
-       KEY(4, 4, KEY_ENTER),
-       KEY(0, 5, KEY_V),
-       KEY(1, 5, KEY_W),
-       KEY(2, 5, KEY_L),
-       KEY(3, 5, KEY_S),
-       KEY(4, 5, KEY_ENTER),
-};
-
-static const struct matrix_keymap_data board_keymap_data = {
-       .keymap                 = board_matrix_keys,
-       .keymap_size            = ARRAY_SIZE(board_matrix_keys),
-};
-
-static unsigned int board_keypad_row_gpios[] = {
-       88, 89, 124, 11, 6, 96
-};
-
-static unsigned int board_keypad_col_gpios[] = {
-       90, 91, 100, 36, 12, 97, 98
-};
-
-static struct matrix_keypad_platform_data board_keypad_platform_data = {
-       .keymap_data    = &board_keymap_data,
-       .row_gpios      = board_keypad_row_gpios,
-       .num_row_gpios  = ARRAY_SIZE(board_keypad_row_gpios),
-       .col_gpios      = board_keypad_col_gpios,
-       .num_col_gpios  = ARRAY_SIZE(board_keypad_col_gpios),
-       .active_low     = 1,
-
-       .debounce_ms            = 20,
-       .col_scan_delay_us      = 5,
-};
-
-static struct platform_device board_keyboard = {
-       .name   = "matrix-keypad",
-       .id     = -1,
-       .dev    = {
-               .platform_data = &board_keypad_platform_data,
-       },
-};
-static void __init board_mkp_init(void)
-{
-       omap_mux_init_gpio(88, OMAP_PULL_ENA | OMAP_PULL_UP);
-       omap_mux_init_gpio(89, OMAP_PULL_ENA | OMAP_PULL_UP);
-       omap_mux_init_gpio(124, OMAP_PULL_ENA | OMAP_PULL_UP);
-       omap_mux_init_signal("mcbsp2_dr.gpio_11", OMAP_PULL_ENA | OMAP_PULL_UP);
-       if (omap_has_menelaus()) {
-               omap_mux_init_signal("sdrc_a14.gpio0",
-                       OMAP_PULL_ENA | OMAP_PULL_UP);
-               omap_mux_init_signal("vlynq_rx0.gpio_15", 0);
-               omap_mux_init_signal("gpio_98", 0);
-               board_keypad_row_gpios[5] = 0;
-               board_keypad_col_gpios[2] = 15;
-               board_keypad_col_gpios[6] = 18;
-       } else {
-               omap_mux_init_signal("gpio_96", OMAP_PULL_ENA | OMAP_PULL_UP);
-               omap_mux_init_signal("gpio_100", 0);
-               omap_mux_init_signal("gpio_98", 0);
-       }
-       omap_mux_init_signal("gpio_90", 0);
-       omap_mux_init_signal("gpio_91", 0);
-       omap_mux_init_signal("gpio_36", 0);
-       omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0);
-       omap_mux_init_signal("gpio_97", 0);
-
-       platform_device_register(&board_keyboard);
-}
-#else
-static inline void board_mkp_init(void)
-{
-}
-#endif
-
-static struct mtd_partition h4_partitions[] = {
-       /* bootloader (U-Boot, etc) in first sector */
-       {
-             .name             = "bootloader",
-             .offset           = 0,
-             .size             = SZ_128K,
-             .mask_flags       = MTD_WRITEABLE, /* force read-only */
-       },
-       /* bootloader params in the next sector */
-       {
-             .name             = "params",
-             .offset           = MTDPART_OFS_APPEND,
-             .size             = SZ_128K,
-             .mask_flags       = 0,
-       },
-       /* kernel */
-       {
-             .name             = "kernel",
-             .offset           = MTDPART_OFS_APPEND,
-             .size             = SZ_2M,
-             .mask_flags       = 0
-       },
-       /* file system */
-       {
-             .name             = "filesystem",
-             .offset           = MTDPART_OFS_APPEND,
-             .size             = MTDPART_SIZ_FULL,
-             .mask_flags       = 0
-       }
-};
-
-static struct physmap_flash_data h4_flash_data = {
-       .width          = 2,
-       .parts          = h4_partitions,
-       .nr_parts       = ARRAY_SIZE(h4_partitions),
-};
-
-static struct resource h4_flash_resource = {
-       .flags          = IORESOURCE_MEM,
-};
-
-static struct platform_device h4_flash_device = {
-       .name           = "physmap-flash",
-       .id             = 0,
-       .dev            = {
-               .platform_data  = &h4_flash_data,
-       },
-       .num_resources  = 1,
-       .resource       = &h4_flash_resource,
-};
-
-static const struct display_timing cm_t35_lcd_videomode = {
-       .pixelclock     = { 0, 6250000, 0 },
-
-       .hactive = { 0, 240, 0 },
-       .hfront_porch = { 0, 15, 0 },
-       .hback_porch = { 0, 60, 0 },
-       .hsync_len = { 0, 15, 0 },
-
-       .vactive = { 0, 320, 0 },
-       .vfront_porch = { 0, 1, 0 },
-       .vback_porch = { 0, 1, 0 },
-       .vsync_len = { 0, 1, 0 },
-
-       .flags = DISPLAY_FLAGS_HSYNC_HIGH | DISPLAY_FLAGS_VSYNC_HIGH |
-               DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE,
-};
-
-static struct panel_dpi_platform_data cm_t35_lcd_pdata = {
-       .name                   = "lcd",
-       .source                 = "dpi.0",
-
-       .data_lines             = 16,
-
-       .display_timing         = &cm_t35_lcd_videomode,
-
-       .enable_gpio            = -1,
-       .backlight_gpio         = -1,
-};
-
-static struct platform_device cm_t35_lcd_device = {
-       .name                   = "panel-dpi",
-       .id                     = 0,
-       .dev.platform_data      = &cm_t35_lcd_pdata,
-};
-
-static struct platform_device *h4_devices[] __initdata = {
-       &h4_flash_device,
-       &cm_t35_lcd_device,
-};
-
-static struct omap_dss_board_info h4_dss_data = {
-       .default_display_name = "lcd",
-};
-
-/* 2420 Sysboot setup (2430 is different) */
-static u32 get_sysboot_value(void)
-{
-       return (omap_ctrl_readl(OMAP24XX_CONTROL_STATUS) &
-               (OMAP2_SYSBOOT_5_MASK | OMAP2_SYSBOOT_4_MASK |
-                OMAP2_SYSBOOT_3_MASK | OMAP2_SYSBOOT_2_MASK |
-                OMAP2_SYSBOOT_1_MASK | OMAP2_SYSBOOT_0_MASK));
-}
-
-/* H4-2420's always used muxed mode, H4-2422's always use non-muxed
- *
- * Note: OMAP-GIT doesn't correctly do is_cpu_omap2422 and is_cpu_omap2423
- *  correctly.  The macro needs to look at production_id not just hawkeye.
- */
-static u32 is_gpmc_muxed(void)
-{
-       u32 mux;
-       mux = get_sysboot_value();
-       if ((mux & 0xF) == 0xd)
-               return 1;       /* NAND config (could be either) */
-       if (mux & 0x2)          /* if mux'ed */
-               return 1;
-       else
-               return 0;
-}
-
-#if IS_ENABLED(CONFIG_SMC91X)
-
-static struct omap_smc91x_platform_data board_smc91x_data = {
-       .cs             = 1,
-       .gpio_irq       = 92,
-       .flags          = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_LOWLEVEL,
-};
-
-static void __init board_smc91x_init(void)
-{
-       if (is_gpmc_muxed())
-               board_smc91x_data.flags |= GPMC_MUX_ADD_DATA;
-
-       omap_mux_init_gpio(board_smc91x_data.gpio_irq, OMAP_PIN_INPUT);
-       gpmc_smc91x_init(&board_smc91x_data);
-}
-
-#else
-
-static inline void board_smc91x_init(void)
-{
-}
-
-#endif
-
-static void __init h4_init_flash(void)
-{
-       unsigned long base;
-
-       if (gpmc_cs_request(H4_FLASH_CS, SZ_64M, &base) < 0) {
-               printk("Can't request GPMC CS for flash\n");
-               return;
-       }
-       h4_flash_resource.start = base;
-       h4_flash_resource.end   = base + SZ_64M - 1;
-}
-
-static struct at24_platform_data m24c01 = {
-       .byte_len       = SZ_1K / 8,
-       .page_size      = 16,
-};
-
-static struct i2c_board_info __initdata h4_i2c_board_info[] = {
-       {
-               I2C_BOARD_INFO("isp1301_omap", 0x2d),
-       },
-       {       /* EEPROM on mainboard */
-               I2C_BOARD_INFO("24c01", 0x52),
-               .platform_data  = &m24c01,
-       },
-       {       /* EEPROM on cpu card */
-               I2C_BOARD_INFO("24c01", 0x57),
-               .platform_data  = &m24c01,
-       },
-};
-
-#ifdef CONFIG_OMAP_MUX
-static struct omap_board_mux board_mux[] __initdata = {
-       { .reg_offset = OMAP_MUX_TERMINATOR },
-};
-#endif
-
-static void __init omap_h4_init(void)
-{
-       omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAF);
-
-       /*
-        * Make sure the serial ports are muxed on at this point.
-        * You have to mux them off in device drivers later on
-        * if not needed.
-        */
-
-       board_mkp_init();
-       h4_i2c_board_info[0].irq = gpio_to_irq(125);
-       i2c_register_board_info(1, h4_i2c_board_info,
-                       ARRAY_SIZE(h4_i2c_board_info));
-
-       platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
-       omap_serial_init();
-       omap_sdrc_init(NULL, NULL);
-       h4_init_flash();
-       board_smc91x_init();
-
-       omap_display_init(&h4_dss_data);
-}
-
-MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
-       /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
-       .atag_offset    = 0x100,
-       .reserve        = omap_reserve,
-       .map_io         = omap242x_map_io,
-       .init_early     = omap2420_init_early,
-       .init_irq       = omap2_init_irq,
-       .handle_irq     = omap2_intc_handle_irq,
-       .init_machine   = omap_h4_init,
-       .init_late      = omap2420_init_late,
-       .init_time      = omap2_sync32k_timer_init,
-       .restart        = omap2xxx_restart,
-MACHINE_END
index 827d15009a86c980a9577ad8951c2a94e0cbd17d..aead77a4bc6dc34d75a16a80631ce8ff9d703bf4 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/i2c.h>
 #include <linux/spi/spi.h>
 #include <linux/usb/musb.h>
-#include <linux/platform_data/i2c-cbus-gpio.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/platform_data/mtd-onenand-omap2.h>
 #include <linux/mfd/menelaus.h>
@@ -32,8 +31,7 @@
 
 #include "common.h"
 #include "mmc.h"
-
-#include "mux.h"
+#include "soc.h"
 #include "gpmc-onenand.h"
 
 #define TUSB6010_ASYNC_CS      1
 #define TUSB6010_GPIO_ENABLE   0
 #define TUSB6010_DMACHAN       0x3f
 
-#if defined(CONFIG_I2C_CBUS_GPIO) || defined(CONFIG_I2C_CBUS_GPIO_MODULE)
-static struct i2c_cbus_platform_data n8x0_cbus_data = {
-       .clk_gpio = 66,
-       .dat_gpio = 65,
-       .sel_gpio = 64,
-};
+#define NOKIA_N810_WIMAX       (1 << 2)
+#define NOKIA_N810             (1 << 1)
+#define NOKIA_N800             (1 << 0)
 
-static struct platform_device n8x0_cbus_device = {
-       .name   = "i2c-cbus-gpio",
-       .id     = 3,
-       .dev    = {
-               .platform_data = &n8x0_cbus_data,
-       },
-};
+static u32 board_caps;
 
-static struct i2c_board_info n8x0_i2c_board_info_3[] __initdata = {
-       {
-               I2C_BOARD_INFO("retu-mfd", 0x01),
-       },
-};
+#define board_is_n800()                (board_caps & NOKIA_N800)
+#define board_is_n810()                (board_caps & NOKIA_N810)
+#define board_is_n810_wimax()  (board_caps & NOKIA_N810_WIMAX)
 
-static void __init n8x0_cbus_init(void)
+static void board_check_revision(void)
 {
-       const int retu_irq_gpio = 108;
+       if (of_have_populated_dt()) {
+               if (of_machine_is_compatible("nokia,n800"))
+                       board_caps = NOKIA_N800;
+               else if (of_machine_is_compatible("nokia,n810"))
+                       board_caps = NOKIA_N810;
+               else if (of_machine_is_compatible("nokia,n810-wimax"))
+                       board_caps = NOKIA_N810_WIMAX;
+       }
 
-       if (gpio_request_one(retu_irq_gpio, GPIOF_IN, "Retu IRQ"))
-               return;
-       irq_set_irq_type(gpio_to_irq(retu_irq_gpio), IRQ_TYPE_EDGE_RISING);
-       n8x0_i2c_board_info_3[0].irq = gpio_to_irq(retu_irq_gpio);
-       i2c_register_board_info(3, n8x0_i2c_board_info_3,
-                               ARRAY_SIZE(n8x0_i2c_board_info_3));
-       platform_device_register(&n8x0_cbus_device);
-}
-#else /* CONFIG_I2C_CBUS_GPIO */
-static void __init n8x0_cbus_init(void)
-{
+       if (!board_caps)
+               pr_err("Unknown board\n");
 }
-#endif /* CONFIG_I2C_CBUS_GPIO */
 
 #if defined(CONFIG_USB_MUSB_TUSB6010) || defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
 /*
@@ -178,49 +162,6 @@ static struct spi_board_info n800_spi_board_info[] __initdata = {
        },
 };
 
-#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
-       defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
-
-static struct mtd_partition onenand_partitions[] = {
-       {
-               .name           = "bootloader",
-               .offset         = 0,
-               .size           = 0x20000,
-               .mask_flags     = MTD_WRITEABLE,        /* Force read-only */
-       },
-       {
-               .name           = "config",
-               .offset         = MTDPART_OFS_APPEND,
-               .size           = 0x60000,
-       },
-       {
-               .name           = "kernel",
-               .offset         = MTDPART_OFS_APPEND,
-               .size           = 0x200000,
-       },
-       {
-               .name           = "initfs",
-               .offset         = MTDPART_OFS_APPEND,
-               .size           = 0x400000,
-       },
-       {
-               .name           = "rootfs",
-               .offset         = MTDPART_OFS_APPEND,
-               .size           = MTDPART_SIZ_FULL,
-       },
-};
-
-static struct omap_onenand_platform_data board_onenand_data[] = {
-       {
-               .cs             = 0,
-               .gpio_irq       = 26,
-               .parts          = onenand_partitions,
-               .nr_parts       = ARRAY_SIZE(onenand_partitions),
-               .flags          = ONENAND_SYNC_READ,
-       }
-};
-#endif
-
 #if defined(CONFIG_MENELAUS) &&                                                \
        (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE))
 
@@ -342,7 +283,7 @@ static void n810_set_power_emmc(struct device *dev,
 static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on,
                              int vdd)
 {
-       if (machine_is_nokia_n800() || slot == 0)
+       if (board_is_n800() || slot == 0)
                return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd);
 
        n810_set_power_emmc(dev, power_on);
@@ -388,7 +329,7 @@ static void n8x0_mmc_callback(void *data, u8 card_mask)
 {
        int bit, *openp, index;
 
-       if (machine_is_nokia_n800()) {
+       if (board_is_n800()) {
                bit = 1 << 1;
                openp = &slot2_cover_open;
                index = 1;
@@ -421,7 +362,7 @@ static int n8x0_mmc_late_init(struct device *dev)
        if (r < 0)
                return r;
 
-       if (machine_is_nokia_n800())
+       if (board_is_n800())
                vs2sel = 0;
        else
                vs2sel = 2;
@@ -444,7 +385,7 @@ static int n8x0_mmc_late_init(struct device *dev)
        if (r < 0)
                return r;
 
-       if (machine_is_nokia_n800()) {
+       if (board_is_n800()) {
                bit = 1 << 1;
                openp = &slot2_cover_open;
        } else {
@@ -471,7 +412,7 @@ static void n8x0_mmc_shutdown(struct device *dev)
 {
        int vs2sel;
 
-       if (machine_is_nokia_n800())
+       if (board_is_n800())
                vs2sel = 0;
        else
                vs2sel = 2;
@@ -486,7 +427,7 @@ static void n8x0_mmc_cleanup(struct device *dev)
 
        gpio_free(N8X0_SLOT_SWITCH_GPIO);
 
-       if (machine_is_nokia_n810()) {
+       if (board_is_n810()) {
                gpio_free(N810_EMMC_VSD_GPIO);
                gpio_free(N810_EMMC_VIO_GPIO);
        }
@@ -497,7 +438,7 @@ static void n8x0_mmc_cleanup(struct device *dev)
  * MMC controller2 is not in use.
  */
 static struct omap_mmc_platform_data mmc1_data = {
-       .nr_slots                       = 2,
+       .nr_slots                       = 0,
        .switch_slot                    = n8x0_mmc_switch_slot,
        .init                           = n8x0_mmc_late_init,
        .cleanup                        = n8x0_mmc_cleanup,
@@ -537,7 +478,7 @@ static void __init n8x0_mmc_init(void)
 {
        int err;
 
-       if (machine_is_nokia_n810()) {
+       if (board_is_n810()) {
                mmc1_data.slots[0].name = "external";
 
                /*
@@ -555,7 +496,7 @@ static void __init n8x0_mmc_init(void)
        if (err)
                return;
 
-       if (machine_is_nokia_n810()) {
+       if (board_is_n810()) {
                err = gpio_request_array(n810_emmc_gpios,
                                         ARRAY_SIZE(n810_emmc_gpios));
                if (err) {
@@ -564,11 +505,11 @@ static void __init n8x0_mmc_init(void)
                }
        }
 
+       mmc1_data.nr_slots = 2;
        mmc_data[0] = &mmc1_data;
-       omap242x_init_mmc(mmc_data);
 }
 #else
-
+static struct omap_mmc_platform_data mmc1_data;
 void __init n8x0_mmc_init(void)
 {
 }
@@ -650,109 +591,32 @@ static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
        },
 };
 
-#ifdef CONFIG_OMAP_MUX
-static struct omap_board_mux board_mux[] __initdata = {
-       /* I2S codec port pins for McBSP block */
-       OMAP2420_MUX(EAC_AC_SCLK, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
-       OMAP2420_MUX(EAC_AC_FS, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
-       OMAP2420_MUX(EAC_AC_DIN, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
-       OMAP2420_MUX(EAC_AC_DOUT, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
-       { .reg_offset = OMAP_MUX_TERMINATOR },
-};
-
-static struct omap_device_pad serial2_pads[] __initdata = {
-       {
-               .name   = "uart3_rx_irrx.uart3_rx_irrx",
-               .flags  = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
-               .enable = OMAP_MUX_MODE0,
-               .idle   = OMAP_MUX_MODE3        /* Mux as GPIO for idle */
-       },
-};
-
-static inline void board_serial_init(void)
+static int __init n8x0_late_initcall(void)
 {
-       struct omap_board_data bdata;
-
-       bdata.flags = 0;
-       bdata.pads = NULL;
-       bdata.pads_cnt = 0;
-
-       bdata.id = 0;
-       omap_serial_init_port(&bdata, NULL);
-
-       bdata.id = 1;
-       omap_serial_init_port(&bdata, NULL);
-
-       bdata.id = 2;
-       bdata.pads = serial2_pads;
-       bdata.pads_cnt = ARRAY_SIZE(serial2_pads);
-       omap_serial_init_port(&bdata, NULL);
-}
+       if (!board_caps)
+               return -ENODEV;
 
-#else
+       n8x0_mmc_init();
+       n8x0_usb_init();
 
-static inline void board_serial_init(void)
-{
-       omap_serial_init();
+       return 0;
 }
+omap_late_initcall(n8x0_late_initcall);
 
-#endif
-
-static void __init n8x0_init_machine(void)
+/*
+ * Legacy init pdata init for n8x0. Note that we want to follow the
+ * I2C bus numbering starting at 0 for device tree like other omaps.
+ */
+void * __init n8x0_legacy_init(void)
 {
-       omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
-       /* FIXME: add n810 spi devices */
+       board_check_revision();
        spi_register_board_info(n800_spi_board_info,
                                ARRAY_SIZE(n800_spi_board_info));
-       omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
-                             ARRAY_SIZE(n8x0_i2c_board_info_1));
-       omap_register_i2c_bus(2, 400, NULL, 0);
-       if (machine_is_nokia_n810())
-               i2c_register_board_info(2, n810_i2c_board_info_2,
+       i2c_register_board_info(0, n8x0_i2c_board_info_1,
+                               ARRAY_SIZE(n8x0_i2c_board_info_1));
+       if (board_is_n810())
+               i2c_register_board_info(1, n810_i2c_board_info_2,
                                        ARRAY_SIZE(n810_i2c_board_info_2));
-       board_serial_init();
-       omap_sdrc_init(NULL, NULL);
-       gpmc_onenand_init(board_onenand_data);
-       n8x0_mmc_init();
-       n8x0_usb_init();
-       n8x0_cbus_init();
-}
 
-MACHINE_START(NOKIA_N800, "Nokia N800")
-       .atag_offset    = 0x100,
-       .reserve        = omap_reserve,
-       .map_io         = omap242x_map_io,
-       .init_early     = omap2420_init_early,
-       .init_irq       = omap2_init_irq,
-       .handle_irq     = omap2_intc_handle_irq,
-       .init_machine   = n8x0_init_machine,
-       .init_late      = omap2420_init_late,
-       .init_time      = omap2_sync32k_timer_init,
-       .restart        = omap2xxx_restart,
-MACHINE_END
-
-MACHINE_START(NOKIA_N810, "Nokia N810")
-       .atag_offset    = 0x100,
-       .reserve        = omap_reserve,
-       .map_io         = omap242x_map_io,
-       .init_early     = omap2420_init_early,
-       .init_irq       = omap2_init_irq,
-       .handle_irq     = omap2_intc_handle_irq,
-       .init_machine   = n8x0_init_machine,
-       .init_late      = omap2420_init_late,
-       .init_time      = omap2_sync32k_timer_init,
-       .restart        = omap2xxx_restart,
-MACHINE_END
-
-MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
-       .atag_offset    = 0x100,
-       .reserve        = omap_reserve,
-       .map_io         = omap242x_map_io,
-       .init_early     = omap2420_init_early,
-       .init_irq       = omap2_init_irq,
-       .handle_irq     = omap2_intc_handle_irq,
-       .init_machine   = n8x0_init_machine,
-       .init_late      = omap2420_init_late,
-       .init_time      = omap2_sync32k_timer_init,
-       .restart        = omap2xxx_restart,
-MACHINE_END
+       return &mmc1_data;
+}
index 72bb41b3fd254382ce23a5759ba607a7f7777f1f..f338177e6900c16b4a526f4e33710b50368bc62f 100644 (file)
@@ -10,5 +10,6 @@ struct ads7846_platform_data;
 
 void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
                       struct ads7846_platform_data *board_pdata);
+void *n8x0_legacy_init(void);
 
 #endif /* __OMAP_COMMON_BOARD_DEVICES__ */
index e30ef6797c6311798cbb92b4521c56306b7fdc67..240db38f232c66226bca15be02aa144a8021acce 100644 (file)
@@ -293,6 +293,7 @@ static inline void omap4_cpu_resume(void)
 #endif
 
 void pdata_quirks_init(struct of_device_id *);
+void omap_auxdata_legacy_init(struct device *dev);
 void omap_pcs_legacy_init(int irq, void (*rearm)(void));
 
 struct omap_sdrc_params;
index 662c7fd633ccf3b28847c3d9663d308c5be14961..174caecc3186cbe6d25cb998be40a32478042484 100644 (file)
@@ -65,6 +65,22 @@ static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
        return 1;
 }
 
+/* This function will go away once the device-tree convertion is complete */
+static void gpmc_set_legacy(struct omap_nand_platform_data *gpmc_nand_data,
+                           struct gpmc_settings *s)
+{
+       /* Enable RD PIN Monitoring Reg */
+       if (gpmc_nand_data->dev_ready) {
+               s->wait_on_read = true;
+               s->wait_on_write = true;
+       }
+
+       if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
+               s->device_width = GPMC_DEVWIDTH_16BIT;
+       else
+               s->device_width = GPMC_DEVWIDTH_8BIT;
+}
+
 int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
                   struct gpmc_timings *gpmc_t)
 {
@@ -98,32 +114,22 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
                        dev_err(dev, "Unable to set gpmc timings: %d\n", err);
                        return err;
                }
+       }
 
-               if (gpmc_nand_data->of_node) {
-                       gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
-               } else {
-                       /* Enable RD PIN Monitoring Reg */
-                       if (gpmc_nand_data->dev_ready) {
-                               s.wait_on_read = true;
-                               s.wait_on_write = true;
-                       }
-               }
-
-               s.device_nand = true;
+       if (gpmc_nand_data->of_node)
+               gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
+       else
+               gpmc_set_legacy(gpmc_nand_data, &s);
 
-               if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
-                       s.device_width = GPMC_DEVWIDTH_16BIT;
-               else
-                       s.device_width = GPMC_DEVWIDTH_8BIT;
+       s.device_nand = true;
 
-               err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s);
-               if (err < 0)
-                       goto out_free_cs;
+       err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s);
+       if (err < 0)
+               goto out_free_cs;
 
-               err = gpmc_configure(GPMC_CONFIG_WP, 0);
-               if (err < 0)
-                       goto out_free_cs;
-       }
+       err = gpmc_configure(GPMC_CONFIG_WP, 0);
+       if (err < 0)
+               goto out_free_cs;
 
        gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
 
index cd22262a2cc09a1ad5b951254500a11afdfc8e30..07b68d5a7940e402705568114b7e0523cdda44f8 100644 (file)
@@ -244,7 +244,7 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
                .virtual        = OMAP4_SRAM_VA,
                .pfn            = __phys_to_pfn(OMAP4_SRAM_PA),
                .length         = PAGE_SIZE,
-               .type           = MT_MEMORY_SO,
+               .type           = MT_MEMORY_RW_SO,
        },
 #endif
 
@@ -282,7 +282,7 @@ static struct map_desc omap54xx_io_desc[] __initdata = {
                .virtual        = OMAP4_SRAM_VA,
                .pfn            = __phys_to_pfn(OMAP4_SRAM_PA),
                .length         = PAGE_SIZE,
-               .type           = MT_MEMORY_SO,
+               .type           = MT_MEMORY_RW_SO,
        },
 #endif
 };
index c52d8b4a3e9152e84a95749e9e088f2532d10124..828e0db3d943ce2fc2800c18d7ceaf5a3a87cdc4 100644 (file)
@@ -88,72 +88,3 @@ int omap_msdi_reset(struct omap_hwmod *oh)
 
        return 0;
 }
-
-#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
-
-static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
-                                   *mmc_controller)
-{
-       if ((mmc_controller->slots[0].switch_pin > 0) && \
-               (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
-               omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
-                                       OMAP_PIN_INPUT_PULLUP);
-       if ((mmc_controller->slots[0].gpio_wp > 0) && \
-               (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
-               omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
-                                       OMAP_PIN_INPUT_PULLUP);
-
-       omap_mux_init_signal("sdmmc_cmd", 0);
-       omap_mux_init_signal("sdmmc_clki", 0);
-       omap_mux_init_signal("sdmmc_clko", 0);
-       omap_mux_init_signal("sdmmc_dat0", 0);
-       omap_mux_init_signal("sdmmc_dat_dir0", 0);
-       omap_mux_init_signal("sdmmc_cmd_dir", 0);
-       if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
-               omap_mux_init_signal("sdmmc_dat1", 0);
-               omap_mux_init_signal("sdmmc_dat2", 0);
-               omap_mux_init_signal("sdmmc_dat3", 0);
-               omap_mux_init_signal("sdmmc_dat_dir1", 0);
-               omap_mux_init_signal("sdmmc_dat_dir2", 0);
-               omap_mux_init_signal("sdmmc_dat_dir3", 0);
-       }
-
-       /*
-        * Use internal loop-back in MMC/SDIO Module Input Clock
-        * selection
-        */
-       if (mmc_controller->slots[0].internal_clock) {
-               u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
-               v |= (1 << 24);
-               omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
-       }
-}
-
-void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
-{
-       struct platform_device *pdev;
-       struct omap_hwmod *oh;
-       int id = 0;
-       char *oh_name = "msdi1";
-       char *dev_name = "mmci-omap";
-
-       if (!mmc_data[0]) {
-               pr_err("%s fails: Incomplete platform data\n", __func__);
-               return;
-       }
-
-       omap242x_mmc_mux(mmc_data[0]);
-
-       oh = omap_hwmod_lookup(oh_name);
-       if (!oh) {
-               pr_err("Could not look up %s\n", oh_name);
-               return;
-       }
-       pdev = omap_device_build(dev_name, id, oh, mmc_data[0],
-                                sizeof(struct omap_mmc_platform_data));
-       if (IS_ERR(pdev))
-               WARN(1, "Can'd build omap_device for %s:%s.\n",
-                                       dev_name, oh->name);
-}
-
-#endif
index 16f78a990d04cafbd7dd1fcaa81b7d7dd061e979..a722330d4d53deb4888df89704c81c1a42936412 100644 (file)
@@ -7,8 +7,6 @@
  * published by the Free Software Foundation.
  */
 
-#include "mux2420.h"
-#include "mux2430.h"
 #include "mux34xx.h"
 
 #define OMAP_MUX_TERMINATOR    0xffff
diff --git a/arch/arm/mach-omap2/mux2420.c b/arch/arm/mach-omap2/mux2420.c
deleted file mode 100644 (file)
index cf6de09..0000000
+++ /dev/null
@@ -1,690 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia
- * Copyright (C) 2010 Texas Instruments
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-
-#include "mux.h"
-
-#ifdef CONFIG_OMAP_MUX
-
-#define _OMAP2420_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7)              \
-{                                                                      \
-       .reg_offset     = (OMAP2420_CONTROL_PADCONF_##M0##_OFFSET),     \
-       .gpio           = (g),                                          \
-       .muxnames       = { m0, m1, m2, m3, m4, m5, m6, m7 },           \
-}
-
-#else
-
-#define _OMAP2420_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7)              \
-{                                                                      \
-       .reg_offset     = (OMAP2420_CONTROL_PADCONF_##M0##_OFFSET),     \
-       .gpio           = (g),                                          \
-}
-
-#endif
-
-#define _OMAP2420_BALLENTRY(M0, bb, bt)                                        \
-{                                                                      \
-       .reg_offset     = (OMAP2420_CONTROL_PADCONF_##M0##_OFFSET),     \
-       .balls          = { bb, bt },                                   \
-}
-
-/*
- * Superset of all mux modes for omap2420
- */
-static struct omap_mux __initdata omap2420_muxmodes[] = {
-       _OMAP2420_MUXENTRY(CAM_D0, 54,
-               "cam_d0", "hw_dbg2", "sti_dout", "gpio_54",
-               NULL, NULL, "etk_d2", NULL),
-       _OMAP2420_MUXENTRY(CAM_D1, 53,
-               "cam_d1", "hw_dbg3", "sti_din", "gpio_53",
-               NULL, NULL, "etk_d3", NULL),
-       _OMAP2420_MUXENTRY(CAM_D2, 52,
-               "cam_d2", "hw_dbg4", "mcbsp1_clkx", "gpio_52",
-               NULL, NULL, "etk_d4", NULL),
-       _OMAP2420_MUXENTRY(CAM_D3, 51,
-               "cam_d3", "hw_dbg5", "mcbsp1_dr", "gpio_51",
-               NULL, NULL, "etk_d5", NULL),
-       _OMAP2420_MUXENTRY(CAM_D4, 50,
-               "cam_d4", "hw_dbg6", "mcbsp1_fsr", "gpio_50",
-               NULL, NULL, "etk_d6", NULL),
-       _OMAP2420_MUXENTRY(CAM_D5, 49,
-               "cam_d5", "hw_dbg7", "mcbsp1_clkr", "gpio_49",
-               NULL, NULL, "etk_d7", NULL),
-       _OMAP2420_MUXENTRY(CAM_D6, 0,
-               "cam_d6", "hw_dbg8", NULL, NULL,
-               NULL, NULL, "etk_d8", NULL),
-       _OMAP2420_MUXENTRY(CAM_D7, 0,
-               "cam_d7", "hw_dbg9", NULL, NULL,
-               NULL, NULL, "etk_d9", NULL),
-       _OMAP2420_MUXENTRY(CAM_D8, 54,
-               "cam_d8", "hw_dbg10", NULL, "gpio_54",
-               NULL, NULL, "etk_d10", NULL),
-       _OMAP2420_MUXENTRY(CAM_D9, 53,
-               "cam_d9", "hw_dbg11", NULL, "gpio_53",
-               NULL, NULL, "etk_d11", NULL),
-       _OMAP2420_MUXENTRY(CAM_HS, 55,
-               "cam_hs", "hw_dbg1", "mcbsp1_dx", "gpio_55",
-               NULL, NULL, "etk_d1", NULL),
-       _OMAP2420_MUXENTRY(CAM_LCLK, 57,
-               "cam_lclk", NULL, "mcbsp_clks", "gpio_57",
-               NULL, NULL, "etk_c1", NULL),
-       _OMAP2420_MUXENTRY(CAM_VS, 56,
-               "cam_vs", "hw_dbg0", "mcbsp1_fsx", "gpio_56",
-               NULL, NULL, "etk_d0", NULL),
-       _OMAP2420_MUXENTRY(CAM_XCLK, 0,
-               "cam_xclk", NULL, "sti_clk", NULL,
-               NULL, NULL, "etk_c2", NULL),
-       _OMAP2420_MUXENTRY(DSS_ACBIAS, 48,
-               "dss_acbias", NULL, "mcbsp2_fsx", "gpio_48",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(DSS_DATA10, 40,
-               "dss_data10", NULL, NULL, "gpio_40",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(DSS_DATA11, 41,
-               "dss_data11", NULL, NULL, "gpio_41",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(DSS_DATA12, 42,
-               "dss_data12", NULL, NULL, "gpio_42",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(DSS_DATA13, 43,
-               "dss_data13", NULL, NULL, "gpio_43",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(DSS_DATA14, 44,
-               "dss_data14", NULL, NULL, "gpio_44",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(DSS_DATA15, 45,
-               "dss_data15", NULL, NULL, "gpio_45",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(DSS_DATA16, 46,
-               "dss_data16", NULL, NULL, "gpio_46",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(DSS_DATA17, 47,
-               "dss_data17", NULL, NULL, "gpio_47",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(DSS_DATA8, 38,
-               "dss_data8", NULL, NULL, "gpio_38",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(DSS_DATA9, 39,
-               "dss_data9", NULL, NULL, "gpio_39",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(EAC_AC_DIN, 115,
-               "eac_ac_din", "mcbsp2_dr", NULL, "gpio_115",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(EAC_AC_DOUT, 116,
-               "eac_ac_dout", "mcbsp2_dx", NULL, "gpio_116",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(EAC_AC_FS, 114,
-               "eac_ac_fs", "mcbsp2_fsx", NULL, "gpio_114",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(EAC_AC_MCLK, 117,
-               "eac_ac_mclk", NULL, NULL, "gpio_117",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(EAC_AC_RST, 118,
-               "eac_ac_rst", "eac_bt_din", NULL, "gpio_118",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(EAC_AC_SCLK, 113,
-               "eac_ac_sclk", "mcbsp2_clkx", NULL, "gpio_113",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(EAC_BT_DIN, 73,
-               "eac_bt_din", NULL, NULL, "gpio_73",
-               NULL, NULL, "etk_d9", NULL),
-       _OMAP2420_MUXENTRY(EAC_BT_DOUT, 74,
-               "eac_bt_dout", NULL, "sti_clk", "gpio_74",
-               NULL, NULL, "etk_d8", NULL),
-       _OMAP2420_MUXENTRY(EAC_BT_FS, 72,
-               "eac_bt_fs", NULL, NULL, "gpio_72",
-               NULL, NULL, "etk_d10", NULL),
-       _OMAP2420_MUXENTRY(EAC_BT_SCLK, 71,
-               "eac_bt_sclk", NULL, NULL, "gpio_71",
-               NULL, NULL, "etk_d11", NULL),
-       _OMAP2420_MUXENTRY(GPIO_119, 119,
-               "gpio_119", NULL, "sti_din", "gpio_119",
-               NULL, "sys_boot0", "etk_d12", NULL),
-       _OMAP2420_MUXENTRY(GPIO_120, 120,
-               "gpio_120", NULL, "sti_dout", "gpio_120",
-               "cam_d9", "sys_boot1", "etk_d13", NULL),
-       _OMAP2420_MUXENTRY(GPIO_121, 121,
-               "gpio_121", NULL, NULL, "gpio_121",
-               "jtag_emu2", "sys_boot2", "etk_d14", NULL),
-       _OMAP2420_MUXENTRY(GPIO_122, 122,
-               "gpio_122", NULL, NULL, "gpio_122",
-               "jtag_emu3", "sys_boot3", "etk_d15", NULL),
-       _OMAP2420_MUXENTRY(GPIO_124, 124,
-               "gpio_124", NULL, NULL, "gpio_124",
-               NULL, "sys_boot5", NULL, NULL),
-       _OMAP2420_MUXENTRY(GPIO_125, 125,
-               "gpio_125", "sys_jtagsel1", "sys_jtagsel2", "gpio_125",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPIO_36, 36,
-               "gpio_36", NULL, NULL, "gpio_36",
-               NULL, "sys_boot4", NULL, NULL),
-       _OMAP2420_MUXENTRY(GPIO_62, 62,
-               "gpio_62", "uart1_rx", "usb1_dat", "gpio_62",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPIO_6, 6,
-               "gpio_6", "tv_detpulse", NULL, "gpio_6",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_A10, 3,
-               "gpmc_a10", NULL, "sys_ndmareq5", "gpio_3",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_A1, 12,
-               "gpmc_a1", "dss_data18", NULL, "gpio_12",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_A2, 11,
-               "gpmc_a2", "dss_data19", NULL, "gpio_11",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_A3, 10,
-               "gpmc_a3", "dss_data20", NULL, "gpio_10",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_A4, 9,
-               "gpmc_a4", "dss_data21", NULL, "gpio_9",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_A5, 8,
-               "gpmc_a5", "dss_data22", NULL, "gpio_8",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_A6, 7,
-               "gpmc_a6", "dss_data23", NULL, "gpio_7",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_A7, 6,
-               "gpmc_a7", NULL, "sys_ndmareq2", "gpio_6",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_A8, 5,
-               "gpmc_a8", NULL, "sys_ndmareq3", "gpio_5",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_A9, 4,
-               "gpmc_a9", NULL, "sys_ndmareq4", "gpio_4",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_CLK, 21,
-               "gpmc_clk", NULL, NULL, "gpio_21",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_D10, 18,
-               "gpmc_d10", "ssi2_rdy_rx", NULL, "gpio_18",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_D11, 17,
-               "gpmc_d11", "ssi2_flag_rx", NULL, "gpio_17",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_D12, 16,
-               "gpmc_d12", "ssi2_dat_rx", NULL, "gpio_16",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_D13, 15,
-               "gpmc_d13", "ssi2_rdy_tx", NULL, "gpio_15",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_D14, 14,
-               "gpmc_d14", "ssi2_flag_tx", NULL, "gpio_14",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_D15, 13,
-               "gpmc_d15", "ssi2_dat_tx", NULL, "gpio_13",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_D8, 20,
-               "gpmc_d8", NULL, NULL, "gpio_20",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_D9, 19,
-               "gpmc_d9", "ssi2_wake", NULL, "gpio_19",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_NBE0, 29,
-               "gpmc_nbe0", NULL, NULL, "gpio_29",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_NBE1, 30,
-               "gpmc_nbe1", NULL, NULL, "gpio_30",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_NCS1, 22,
-               "gpmc_ncs1", NULL, NULL, "gpio_22",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_NCS2, 23,
-               "gpmc_ncs2", NULL, NULL, "gpio_23",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_NCS3, 24,
-               "gpmc_ncs3", "gpmc_io_dir", NULL, "gpio_24",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_NCS4, 25,
-               "gpmc_ncs4", NULL, NULL, "gpio_25",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_NCS5, 26,
-               "gpmc_ncs5", NULL, NULL, "gpio_26",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_NCS6, 27,
-               "gpmc_ncs6", NULL, NULL, "gpio_27",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_NCS7, 28,
-               "gpmc_ncs7", "gpmc_io_dir", "gpio_28", NULL,
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_NWP, 31,
-               "gpmc_nwp", NULL, NULL, "gpio_31",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_WAIT1, 33,
-               "gpmc_wait1", NULL, NULL, "gpio_33",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_WAIT2, 34,
-               "gpmc_wait2", NULL, NULL, "gpio_34",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(GPMC_WAIT3, 35,
-               "gpmc_wait3", NULL, NULL, "gpio_35",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(HDQ_SIO, 101,
-               "hdq_sio", "usb2_tllse0", "sys_altclk", "gpio_101",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(I2C2_SCL, 99,
-               "i2c2_scl", NULL, "gpt9_pwm_evt", "gpio_99",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(I2C2_SDA, 100,
-               "i2c2_sda", NULL, "spi2_ncs1", "gpio_100",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(JTAG_EMU0, 127,
-               "jtag_emu0", NULL, NULL, "gpio_127",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(JTAG_EMU1, 126,
-               "jtag_emu1", NULL, NULL, "gpio_126",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MCBSP1_CLKR, 92,
-               "mcbsp1_clkr", "ssi2_dat_tx", "vlynq_tx1", "gpio_92",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MCBSP1_CLKX, 98,
-               "mcbsp1_clkx", "ssi2_wake", "vlynq_nla", "gpio_98",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MCBSP1_DR, 95,
-               "mcbsp1_dr", "ssi2_dat_rx", "vlynq_rx1", "gpio_95",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MCBSP1_DX, 94,
-               "mcbsp1_dx", "ssi2_rdy_tx", "vlynq_clk", "gpio_94",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MCBSP1_FSR, 93,
-               "mcbsp1_fsr", "ssi2_flag_tx", "vlynq_tx0", "gpio_93",
-               "spi2_ncs1", NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MCBSP1_FSX, 97,
-               "mcbsp1_fsx", "ssi2_rdy_rx", NULL, "gpio_97",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MCBSP2_CLKX, 12,
-               "mcbsp2_clkx", NULL, "dss_data23", "gpio_12",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MCBSP2_DR, 11,
-               "mcbsp2_dr", NULL, "dss_data22", "gpio_11",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MCBSP_CLKS, 96,
-               "mcbsp_clks", "ssi2_flag_rx", "vlynq_rx0", "gpio_96",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_CLKI, 59,
-               "sdmmc_clki", "ms_clki", NULL, "gpio_59",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_CLKO, 0,
-               "sdmmc_clko", "ms_clko", NULL, NULL,
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_CMD_DIR, 8,
-               "sdmmc_cmd_dir", NULL, NULL, "gpio_8",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_CMD, 0,
-               "sdmmc_cmd", "ms_bs", NULL, NULL,
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_DAT_DIR0, 7,
-               "sdmmc_dat_dir0", "ms_dat0_dir", NULL, "gpio_7",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_DAT0, 0,
-               "sdmmc_dat0", "ms_dat0", NULL, NULL,
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_DAT_DIR1, 78,
-               "sdmmc_dat_dir1", "ms_datu_dir", "uart2_rts", "gpio_78",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_DAT1, 75,
-               "sdmmc_dat1", "ms_dat1", NULL, "gpio_75",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_DAT_DIR2, 79,
-               "sdmmc_dat_dir2", "ms_datu_dir", "uart2_tx", "gpio_79",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_DAT2, 76,
-               "sdmmc_dat2", "ms_dat2", "uart2_cts", "gpio_76",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_DAT_DIR3, 80,
-               "sdmmc_dat_dir3", "ms_datu_dir", "uart2_rx", "gpio_80",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(MMC_DAT3, 77,
-               "sdmmc_dat3", "ms_dat3", NULL, "gpio_77",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SDRC_A12, 2,
-               "sdrc_a12", NULL, NULL, "gpio_2",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SDRC_A13, 1,
-               "sdrc_a13", NULL, NULL, "gpio_1",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SDRC_A14, 0,
-               "sdrc_a14", NULL, NULL, "gpio_0",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SDRC_CKE1, 38,
-               "sdrc_cke1", NULL, NULL, "gpio_38",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SDRC_NCS1, 37,
-               "sdrc_ncs1", NULL, NULL, "gpio_37",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SPI1_CLK, 81,
-               "spi1_clk", NULL, NULL, "gpio_81",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SPI1_NCS0, 84,
-               "spi1_ncs0", NULL, NULL, "gpio_84",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SPI1_NCS1, 85,
-               "spi1_ncs1", NULL, NULL, "gpio_85",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SPI1_NCS2, 86,
-               "spi1_ncs2", NULL, NULL, "gpio_86",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SPI1_NCS3, 87,
-               "spi1_ncs3", NULL, NULL, "gpio_87",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SPI1_SIMO, 82,
-               "spi1_simo", NULL, NULL, "gpio_82",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SPI1_SOMI, 83,
-               "spi1_somi", NULL, NULL, "gpio_83",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SPI2_CLK, 88,
-               "spi2_clk", NULL, NULL, "gpio_88",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SPI2_NCS0, 91,
-               "spi2_ncs0", "gpt12_pwm_evt", NULL, "gpio_91",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SPI2_SIMO, 89,
-               "spi2_simo", "gpt10_pwm_evt", NULL, "gpio_89",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SPI2_SOMI, 90,
-               "spi2_somi", "gpt11_pwm_evt", NULL, "gpio_90",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SSI1_DAT_RX, 63,
-               "ssi1_dat_rx", "eac_md_sclk", NULL, "gpio_63",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SSI1_DAT_TX, 59,
-               "ssi1_dat_tx", "uart1_tx", "usb1_se0", "gpio_59",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SSI1_FLAG_RX, 64,
-               "ssi1_flag_rx", "eac_md_din", NULL, "gpio_64",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SSI1_FLAG_TX, 25,
-               "ssi1_flag_tx", "uart1_rts", "usb1_rcv", "gpio_25",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SSI1_RDY_RX, 65,
-               "ssi1_rdy_rx", "eac_md_dout", NULL, "gpio_65",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SSI1_RDY_TX, 61,
-               "ssi1_rdy_tx", "uart1_cts", "usb1_txen", "gpio_61",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SSI1_WAKE, 66,
-               "ssi1_wake", "eac_md_fs", NULL, "gpio_66",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SYS_CLKOUT, 123,
-               "sys_clkout", NULL, NULL, "gpio_123",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SYS_CLKREQ, 52,
-               "sys_clkreq", NULL, NULL, "gpio_52",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(SYS_NIRQ, 60,
-               "sys_nirq", NULL, NULL, "gpio_60",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART1_CTS, 32,
-               "uart1_cts", NULL, "dss_data18", "gpio_32",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART1_RTS, 8,
-               "uart1_rts", NULL, "dss_data19", "gpio_8",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART1_RX, 10,
-               "uart1_rx", NULL, "dss_data21", "gpio_10",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART1_TX, 9,
-               "uart1_tx", NULL, "dss_data20", "gpio_9",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART2_CTS, 67,
-               "uart2_cts", "usb1_rcv", "gpt9_pwm_evt", "gpio_67",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART2_RTS, 68,
-               "uart2_rts", "usb1_txen", "gpt10_pwm_evt", "gpio_68",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART2_RX, 70,
-               "uart2_rx", "usb1_dat", "gpt12_pwm_evt", "gpio_70",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART2_TX, 69,
-               "uart2_tx", "usb1_se0", "gpt11_pwm_evt", "gpio_69",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART3_CTS_RCTX, 102,
-               "uart3_cts_rctx", "uart3_rx_irrx", NULL, "gpio_102",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART3_RTS_SD, 103,
-               "uart3_rts_sd", "uart3_tx_irtx", NULL, "gpio_103",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART3_RX_IRRX, 105,
-               "uart3_rx_irrx", NULL, NULL, "gpio_105",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(UART3_TX_IRTX, 104,
-               "uart3_tx_irtx", "uart3_cts_rctx", NULL, "gpio_104",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(USB0_DAT, 112,
-               "usb0_dat", "uart3_rx_irrx", "uart2_rx", "gpio_112",
-               "uart2_tx", NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(USB0_PUEN, 106,
-               "usb0_puen", "mcbsp2_dx", NULL, "gpio_106",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(USB0_RCV, 109,
-               "usb0_rcv", "mcbsp2_fsx", NULL, "gpio_109",
-               "uart2_cts", NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(USB0_SE0, 111,
-               "usb0_se0", "uart3_tx_irtx", "uart2_tx", "gpio_111",
-               "uart2_rx", NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(USB0_TXEN, 110,
-               "usb0_txen", "uart3_cts_rctx", "uart2_cts", "gpio_110",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(USB0_VM, 108,
-               "usb0_vm", "mcbsp2_clkx", NULL, "gpio_108",
-               "uart2_rx", NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(USB0_VP, 107,
-               "usb0_vp", "mcbsp2_dr", NULL, "gpio_107",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(VLYNQ_CLK, 13,
-               "vlynq_clk", "usb2_se0", "sys_ndmareq0", "gpio_13",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(VLYNQ_NLA, 58,
-               "vlynq_nla", NULL, NULL, "gpio_58",
-               "cam_d6", NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(VLYNQ_RX0, 15,
-               "vlynq_rx0", "usb2_tllse0", NULL, "gpio_15",
-               "cam_d7", NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(VLYNQ_RX1, 14,
-               "vlynq_rx1", "usb2_rcv", "sys_ndmareq1", "gpio_14",
-               "cam_d8", NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(VLYNQ_TX0, 17,
-               "vlynq_tx0", "usb2_txen", NULL, "gpio_17",
-               NULL, NULL, NULL, NULL),
-       _OMAP2420_MUXENTRY(VLYNQ_TX1, 16,
-               "vlynq_tx1", "usb2_dat", "sys_clkout2", "gpio_16",
-               NULL, NULL, NULL, NULL),
-       { .reg_offset = OMAP_MUX_TERMINATOR },
-};
-
-/*
- * Balls for 447-pin POP package
- */
-#ifdef CONFIG_DEBUG_FS
-static struct omap_ball __initdata omap2420_pop_ball[] = {
-       _OMAP2420_BALLENTRY(CAM_D0, "y4", NULL),
-       _OMAP2420_BALLENTRY(CAM_D1, "y3", NULL),
-       _OMAP2420_BALLENTRY(CAM_D2, "u7", NULL),
-       _OMAP2420_BALLENTRY(CAM_D3, "ab3", NULL),
-       _OMAP2420_BALLENTRY(CAM_D4, "v2", NULL),
-       _OMAP2420_BALLENTRY(CAM_D5, "ad3", NULL),
-       _OMAP2420_BALLENTRY(CAM_D6, "aa4", NULL),
-       _OMAP2420_BALLENTRY(CAM_D7, "ab4", NULL),
-       _OMAP2420_BALLENTRY(CAM_D8, "ac6", NULL),
-       _OMAP2420_BALLENTRY(CAM_D9, "ac7", NULL),
-       _OMAP2420_BALLENTRY(CAM_HS, "v4", NULL),
-       _OMAP2420_BALLENTRY(CAM_LCLK, "ad6", NULL),
-       _OMAP2420_BALLENTRY(CAM_VS, "p7", NULL),
-       _OMAP2420_BALLENTRY(CAM_XCLK, "w4", NULL),
-       _OMAP2420_BALLENTRY(DSS_ACBIAS, "ae8", NULL),
-       _OMAP2420_BALLENTRY(DSS_DATA10, "ac12", NULL),
-       _OMAP2420_BALLENTRY(DSS_DATA11, "ae11", NULL),
-       _OMAP2420_BALLENTRY(DSS_DATA12, "ae13", NULL),
-       _OMAP2420_BALLENTRY(DSS_DATA13, "ad13", NULL),
-       _OMAP2420_BALLENTRY(DSS_DATA14, "ac13", NULL),
-       _OMAP2420_BALLENTRY(DSS_DATA15, "y12", NULL),
-       _OMAP2420_BALLENTRY(DSS_DATA16, "ad14", NULL),
-       _OMAP2420_BALLENTRY(DSS_DATA17, "y13", NULL),
-       _OMAP2420_BALLENTRY(DSS_DATA8, "ad11", NULL),
-       _OMAP2420_BALLENTRY(DSS_DATA9, "ad12", NULL),
-       _OMAP2420_BALLENTRY(EAC_AC_DIN, "ad19", NULL),
-       _OMAP2420_BALLENTRY(EAC_AC_DOUT, "af22", NULL),
-       _OMAP2420_BALLENTRY(EAC_AC_FS, "ad16", NULL),
-       _OMAP2420_BALLENTRY(EAC_AC_MCLK, "y17", NULL),
-       _OMAP2420_BALLENTRY(EAC_AC_RST, "ae22", NULL),
-       _OMAP2420_BALLENTRY(EAC_AC_SCLK, "ac18", NULL),
-       _OMAP2420_BALLENTRY(EAC_BT_DIN, "u8", NULL),
-       _OMAP2420_BALLENTRY(EAC_BT_DOUT, "ad5", NULL),
-       _OMAP2420_BALLENTRY(EAC_BT_FS, "w7", NULL),
-       _OMAP2420_BALLENTRY(EAC_BT_SCLK, "ad4", NULL),
-       _OMAP2420_BALLENTRY(GPIO_119, "af6", NULL),
-       _OMAP2420_BALLENTRY(GPIO_120, "af4", NULL),
-       _OMAP2420_BALLENTRY(GPIO_121, "ae6", NULL),
-       _OMAP2420_BALLENTRY(GPIO_122, "w3", NULL),
-       _OMAP2420_BALLENTRY(GPIO_124, "y19", NULL),
-       _OMAP2420_BALLENTRY(GPIO_125, "ae24", NULL),
-       _OMAP2420_BALLENTRY(GPIO_36, "y18", NULL),
-       _OMAP2420_BALLENTRY(GPIO_6, "d6", NULL),
-       _OMAP2420_BALLENTRY(GPIO_62, "ad18", NULL),
-       _OMAP2420_BALLENTRY(GPMC_A1, "m8", NULL),
-       _OMAP2420_BALLENTRY(GPMC_A10, "d5", NULL),
-       _OMAP2420_BALLENTRY(GPMC_A2, "w9", NULL),
-       _OMAP2420_BALLENTRY(GPMC_A3, "af10", NULL),
-       _OMAP2420_BALLENTRY(GPMC_A4, "w8", NULL),
-       _OMAP2420_BALLENTRY(GPMC_A5, "ae16", NULL),
-       _OMAP2420_BALLENTRY(GPMC_A6, "af9", NULL),
-       _OMAP2420_BALLENTRY(GPMC_A7, "e4", NULL),
-       _OMAP2420_BALLENTRY(GPMC_A8, "j7", NULL),
-       _OMAP2420_BALLENTRY(GPMC_A9, "ae18", NULL),
-       _OMAP2420_BALLENTRY(GPMC_CLK, "p1", "l1"),
-       _OMAP2420_BALLENTRY(GPMC_D10, "t1", "n1"),
-       _OMAP2420_BALLENTRY(GPMC_D11, "u2", "p2"),
-       _OMAP2420_BALLENTRY(GPMC_D12, "u1", "p1"),
-       _OMAP2420_BALLENTRY(GPMC_D13, "p2", "m1"),
-       _OMAP2420_BALLENTRY(GPMC_D14, "h2", "j2"),
-       _OMAP2420_BALLENTRY(GPMC_D15, "h1", "k2"),
-       _OMAP2420_BALLENTRY(GPMC_D8, "v1", "r1"),
-       _OMAP2420_BALLENTRY(GPMC_D9, "y1", "t1"),
-       _OMAP2420_BALLENTRY(GPMC_NBE0, "af12", "aa10"),
-       _OMAP2420_BALLENTRY(GPMC_NBE1, "u3", NULL),
-       _OMAP2420_BALLENTRY(GPMC_NCS1, "af14", "w1"),
-       _OMAP2420_BALLENTRY(GPMC_NCS2, "g4", NULL),
-       _OMAP2420_BALLENTRY(GPMC_NCS3, "t8", NULL),
-       _OMAP2420_BALLENTRY(GPMC_NCS4, "h8", NULL),
-       _OMAP2420_BALLENTRY(GPMC_NCS5, "k3", NULL),
-       _OMAP2420_BALLENTRY(GPMC_NCS6, "m7", NULL),
-       _OMAP2420_BALLENTRY(GPMC_NCS7, "p3", NULL),
-       _OMAP2420_BALLENTRY(GPMC_NWP, "ae15", "y5"),
-       _OMAP2420_BALLENTRY(GPMC_WAIT1, "ae20", "y8"),
-       _OMAP2420_BALLENTRY(GPMC_WAIT2, "n2", NULL),
-       _OMAP2420_BALLENTRY(GPMC_WAIT3, "t4", NULL),
-       _OMAP2420_BALLENTRY(HDQ_SIO, "t23", NULL),
-       _OMAP2420_BALLENTRY(I2C2_SCL, "l2", NULL),
-       _OMAP2420_BALLENTRY(I2C2_SDA, "k19", NULL),
-       _OMAP2420_BALLENTRY(JTAG_EMU0, "n24", NULL),
-       _OMAP2420_BALLENTRY(JTAG_EMU1, "ac22", NULL),
-       _OMAP2420_BALLENTRY(MCBSP1_CLKR, "y24", NULL),
-       _OMAP2420_BALLENTRY(MCBSP1_CLKX, "t19", NULL),
-       _OMAP2420_BALLENTRY(MCBSP1_DR, "u23", NULL),
-       _OMAP2420_BALLENTRY(MCBSP1_DX, "r24", NULL),
-       _OMAP2420_BALLENTRY(MCBSP1_FSR, "r20", NULL),
-       _OMAP2420_BALLENTRY(MCBSP1_FSX, "r23", NULL),
-       _OMAP2420_BALLENTRY(MCBSP2_CLKX, "t24", NULL),
-       _OMAP2420_BALLENTRY(MCBSP2_DR, "p20", NULL),
-       _OMAP2420_BALLENTRY(MCBSP_CLKS, "p23", NULL),
-       _OMAP2420_BALLENTRY(MMC_CLKI, "c23", NULL),
-       _OMAP2420_BALLENTRY(MMC_CLKO, "h23", NULL),
-       _OMAP2420_BALLENTRY(MMC_CMD, "j23", NULL),
-       _OMAP2420_BALLENTRY(MMC_CMD_DIR, "j24", NULL),
-       _OMAP2420_BALLENTRY(MMC_DAT0, "h17", NULL),
-       _OMAP2420_BALLENTRY(MMC_DAT_DIR0, "f23", NULL),
-       _OMAP2420_BALLENTRY(MMC_DAT1, "g19", NULL),
-       _OMAP2420_BALLENTRY(MMC_DAT_DIR1, "d23", NULL),
-       _OMAP2420_BALLENTRY(MMC_DAT2, "h20", NULL),
-       _OMAP2420_BALLENTRY(MMC_DAT_DIR2, "g23", NULL),
-       _OMAP2420_BALLENTRY(MMC_DAT3, "d24", NULL),
-       _OMAP2420_BALLENTRY(MMC_DAT_DIR3, "e23", NULL),
-       _OMAP2420_BALLENTRY(SDRC_A12, "w26", "r21"),
-       _OMAP2420_BALLENTRY(SDRC_A13, "w25", "aa15"),
-       _OMAP2420_BALLENTRY(SDRC_A14, "aa26", "y12"),
-       _OMAP2420_BALLENTRY(SDRC_CKE1, "ae25", "y13"),
-       _OMAP2420_BALLENTRY(SDRC_NCS1, "y25", "t20"),
-       _OMAP2420_BALLENTRY(SPI1_CLK, "y23", NULL),
-       _OMAP2420_BALLENTRY(SPI1_NCS0, "w24", NULL),
-       _OMAP2420_BALLENTRY(SPI1_NCS1, "w23", NULL),
-       _OMAP2420_BALLENTRY(SPI1_NCS2, "v23", NULL),
-       _OMAP2420_BALLENTRY(SPI1_NCS3, "u20", NULL),
-       _OMAP2420_BALLENTRY(SPI1_SIMO, "h10", NULL),
-       _OMAP2420_BALLENTRY(SPI1_SOMI, "v19", NULL),
-       _OMAP2420_BALLENTRY(SPI2_CLK, "v24", NULL),
-       _OMAP2420_BALLENTRY(SPI2_NCS0, "aa24", NULL),
-       _OMAP2420_BALLENTRY(SPI2_SIMO, "u24", NULL),
-       _OMAP2420_BALLENTRY(SPI2_SOMI, "v25", NULL),
-       _OMAP2420_BALLENTRY(SSI1_DAT_RX, "w15", NULL),
-       _OMAP2420_BALLENTRY(SSI1_DAT_TX, "w13", NULL),
-       _OMAP2420_BALLENTRY(SSI1_FLAG_RX, "af11", NULL),
-       _OMAP2420_BALLENTRY(SSI1_FLAG_TX, "ac15", NULL),
-       _OMAP2420_BALLENTRY(SSI1_RDY_RX, "ac16", NULL),
-       _OMAP2420_BALLENTRY(SSI1_RDY_TX, "af15", NULL),
-       _OMAP2420_BALLENTRY(SSI1_WAKE, "ad15", NULL),
-       _OMAP2420_BALLENTRY(SYS_CLKOUT, "ae19", NULL),
-       _OMAP2420_BALLENTRY(SYS_CLKREQ, "ad20", NULL),
-       _OMAP2420_BALLENTRY(SYS_NIRQ, "y20", NULL),
-       _OMAP2420_BALLENTRY(UART1_CTS, "g20", NULL),
-       _OMAP2420_BALLENTRY(UART1_RTS, "k20", NULL),
-       _OMAP2420_BALLENTRY(UART1_RX, "t20", NULL),
-       _OMAP2420_BALLENTRY(UART1_TX, "h12", NULL),
-       _OMAP2420_BALLENTRY(UART2_CTS, "ac24", NULL),
-       _OMAP2420_BALLENTRY(UART2_RTS, "w20", NULL),
-       _OMAP2420_BALLENTRY(UART2_RX, "ad24", NULL),
-       _OMAP2420_BALLENTRY(UART2_TX, "ab24", NULL),
-       _OMAP2420_BALLENTRY(UART3_CTS_RCTX, "k24", NULL),
-       _OMAP2420_BALLENTRY(UART3_RTS_SD, "m20", NULL),
-       _OMAP2420_BALLENTRY(UART3_RX_IRRX, "h24", NULL),
-       _OMAP2420_BALLENTRY(UART3_TX_IRTX, "g24", NULL),
-       _OMAP2420_BALLENTRY(USB0_DAT, "j25", NULL),
-       _OMAP2420_BALLENTRY(USB0_PUEN, "l23", NULL),
-       _OMAP2420_BALLENTRY(USB0_RCV, "k23", NULL),
-       _OMAP2420_BALLENTRY(USB0_SE0, "l24", NULL),
-       _OMAP2420_BALLENTRY(USB0_TXEN, "m24", NULL),
-       _OMAP2420_BALLENTRY(USB0_VM, "n23", NULL),
-       _OMAP2420_BALLENTRY(USB0_VP, "m23", NULL),
-       _OMAP2420_BALLENTRY(VLYNQ_CLK, "w12", NULL),
-       _OMAP2420_BALLENTRY(VLYNQ_NLA, "ae10", NULL),
-       _OMAP2420_BALLENTRY(VLYNQ_RX0, "ad7", NULL),
-       _OMAP2420_BALLENTRY(VLYNQ_RX1, "w10", NULL),
-       _OMAP2420_BALLENTRY(VLYNQ_TX0, "y15", NULL),
-       _OMAP2420_BALLENTRY(VLYNQ_TX1, "w14", NULL),
-       { .reg_offset = OMAP_MUX_TERMINATOR },
-};
-#else
-#define omap2420_pop_ball       NULL
-#endif
-
-int __init omap2420_mux_init(struct omap_board_mux *board_subset, int flags)
-{
-       struct omap_ball *package_balls = NULL;
-
-       switch (flags & OMAP_PACKAGE_MASK) {
-       case OMAP_PACKAGE_ZAC:
-               package_balls = omap2420_pop_ball;
-               break;
-       case OMAP_PACKAGE_ZAF:
-               /* REVISIT: Please add data */
-       default:
-               pr_warning("%s: No ball data available for omap2420 package\n",
-                               __func__);
-       }
-
-       return omap_mux_init("core", OMAP_MUX_REG_8BIT | OMAP_MUX_GPIO_IN_MODE3,
-                            OMAP2420_CONTROL_PADCONF_MUX_PBASE,
-                            OMAP2420_CONTROL_PADCONF_MUX_SIZE,
-                            omap2420_muxmodes, NULL, board_subset,
-                            package_balls);
-}
diff --git a/arch/arm/mach-omap2/mux2420.h b/arch/arm/mach-omap2/mux2420.h
deleted file mode 100644 (file)
index 0f555aa..0000000
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright (C) 2009 Nokia
- * Copyright (C) 2009 Texas Instruments
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#define OMAP2420_CONTROL_PADCONF_MUX_PBASE                     0x48000030LU
-
-#define OMAP2420_MUX(mode0, mux_value)                                 \
-{                                                                      \
-       .reg_offset     = (OMAP2420_CONTROL_PADCONF_##mode0##_OFFSET),  \
-       .value          = (mux_value),                                  \
-}
-
-/*
- * OMAP2420 CONTROL_PADCONF* register offsets for pin-muxing
- *
- * Extracted from the TRM.  Add 0x48000030 to these values to get the
- * absolute addresses.  The name in the macro is the mode-0 name of
- * the pin.  NOTE: These registers are 8-bits wide.
- */
-#define OMAP2420_CONTROL_PADCONF_SDRC_A14_OFFSET                       0x000
-#define OMAP2420_CONTROL_PADCONF_SDRC_A13_OFFSET                       0x001
-#define OMAP2420_CONTROL_PADCONF_SDRC_A12_OFFSET                       0x002
-#define OMAP2420_CONTROL_PADCONF_SDRC_BA1_OFFSET                       0x003
-#define OMAP2420_CONTROL_PADCONF_SDRC_BA0_OFFSET                       0x004
-#define OMAP2420_CONTROL_PADCONF_SDRC_A11_OFFSET                       0x005
-#define OMAP2420_CONTROL_PADCONF_SDRC_A10_OFFSET                       0x006
-#define OMAP2420_CONTROL_PADCONF_SDRC_A9_OFFSET                                0x007
-#define OMAP2420_CONTROL_PADCONF_SDRC_A8_OFFSET                                0x008
-#define OMAP2420_CONTROL_PADCONF_SDRC_A7_OFFSET                                0x009
-#define OMAP2420_CONTROL_PADCONF_SDRC_A6_OFFSET                                0x00a
-#define OMAP2420_CONTROL_PADCONF_SDRC_A5_OFFSET                                0x00b
-#define OMAP2420_CONTROL_PADCONF_SDRC_A4_OFFSET                                0x00c
-#define OMAP2420_CONTROL_PADCONF_SDRC_A3_OFFSET                                0x00d
-#define OMAP2420_CONTROL_PADCONF_SDRC_A2_OFFSET                                0x00e
-#define OMAP2420_CONTROL_PADCONF_SDRC_A1_OFFSET                                0x00f
-#define OMAP2420_CONTROL_PADCONF_SDRC_A0_OFFSET                                0x010
-#define OMAP2420_CONTROL_PADCONF_SDRC_D31_OFFSET                       0x021
-#define OMAP2420_CONTROL_PADCONF_SDRC_D30_OFFSET                       0x022
-#define OMAP2420_CONTROL_PADCONF_SDRC_D29_OFFSET                       0x023
-#define OMAP2420_CONTROL_PADCONF_SDRC_D28_OFFSET                       0x024
-#define OMAP2420_CONTROL_PADCONF_SDRC_D27_OFFSET                       0x025
-#define OMAP2420_CONTROL_PADCONF_SDRC_D26_OFFSET                       0x026
-#define OMAP2420_CONTROL_PADCONF_SDRC_D25_OFFSET                       0x027
-#define OMAP2420_CONTROL_PADCONF_SDRC_D24_OFFSET                       0x028
-#define OMAP2420_CONTROL_PADCONF_SDRC_D23_OFFSET                       0x029
-#define OMAP2420_CONTROL_PADCONF_SDRC_D22_OFFSET                       0x02a
-#define OMAP2420_CONTROL_PADCONF_SDRC_D21_OFFSET                       0x02b
-#define OMAP2420_CONTROL_PADCONF_SDRC_D20_OFFSET                       0x02c
-#define OMAP2420_CONTROL_PADCONF_SDRC_D19_OFFSET                       0x02d
-#define OMAP2420_CONTROL_PADCONF_SDRC_D18_OFFSET                       0x02e
-#define OMAP2420_CONTROL_PADCONF_SDRC_D17_OFFSET                       0x02f
-#define OMAP2420_CONTROL_PADCONF_SDRC_D16_OFFSET                       0x030
-#define OMAP2420_CONTROL_PADCONF_SDRC_D15_OFFSET                       0x031
-#define OMAP2420_CONTROL_PADCONF_SDRC_D14_OFFSET                       0x032
-#define OMAP2420_CONTROL_PADCONF_SDRC_D13_OFFSET                       0x033
-#define OMAP2420_CONTROL_PADCONF_SDRC_D12_OFFSET                       0x034
-#define OMAP2420_CONTROL_PADCONF_SDRC_D11_OFFSET                       0x035
-#define OMAP2420_CONTROL_PADCONF_SDRC_D10_OFFSET                       0x036
-#define OMAP2420_CONTROL_PADCONF_SDRC_D9_OFFSET                                0x037
-#define OMAP2420_CONTROL_PADCONF_SDRC_D8_OFFSET                                0x038
-#define OMAP2420_CONTROL_PADCONF_SDRC_D7_OFFSET                                0x039
-#define OMAP2420_CONTROL_PADCONF_SDRC_D6_OFFSET                                0x03a
-#define OMAP2420_CONTROL_PADCONF_SDRC_D5_OFFSET                                0x03b
-#define OMAP2420_CONTROL_PADCONF_SDRC_D4_OFFSET                                0x03c
-#define OMAP2420_CONTROL_PADCONF_SDRC_D3_OFFSET                                0x03d
-#define OMAP2420_CONTROL_PADCONF_SDRC_D2_OFFSET                                0x03e
-#define OMAP2420_CONTROL_PADCONF_SDRC_D1_OFFSET                                0x03f
-#define OMAP2420_CONTROL_PADCONF_SDRC_D0_OFFSET                                0x040
-#define OMAP2420_CONTROL_PADCONF_GPMC_A10_OFFSET                       0x041
-#define OMAP2420_CONTROL_PADCONF_GPMC_A9_OFFSET                                0x042
-#define OMAP2420_CONTROL_PADCONF_GPMC_A8_OFFSET                                0x043
-#define OMAP2420_CONTROL_PADCONF_GPMC_A7_OFFSET                                0x044
-#define OMAP2420_CONTROL_PADCONF_GPMC_A6_OFFSET                                0x045
-#define OMAP2420_CONTROL_PADCONF_GPMC_A5_OFFSET                                0x046
-#define OMAP2420_CONTROL_PADCONF_GPMC_A4_OFFSET                                0x047
-#define OMAP2420_CONTROL_PADCONF_GPMC_A3_OFFSET                                0x048
-#define OMAP2420_CONTROL_PADCONF_GPMC_A2_OFFSET                                0x049
-#define OMAP2420_CONTROL_PADCONF_GPMC_A1_OFFSET                                0x04a
-#define OMAP2420_CONTROL_PADCONF_GPMC_D15_OFFSET                       0x04b
-#define OMAP2420_CONTROL_PADCONF_GPMC_D14_OFFSET                       0x04c
-#define OMAP2420_CONTROL_PADCONF_GPMC_D13_OFFSET                       0x04d
-#define OMAP2420_CONTROL_PADCONF_GPMC_D12_OFFSET                       0x04e
-#define OMAP2420_CONTROL_PADCONF_GPMC_D11_OFFSET                       0x04f
-#define OMAP2420_CONTROL_PADCONF_GPMC_D10_OFFSET                       0x050
-#define OMAP2420_CONTROL_PADCONF_GPMC_D9_OFFSET                                0x051
-#define OMAP2420_CONTROL_PADCONF_GPMC_D8_OFFSET                                0x052
-#define OMAP2420_CONTROL_PADCONF_GPMC_D7_OFFSET                                0x053
-#define OMAP2420_CONTROL_PADCONF_GPMC_D6_OFFSET                                0x054
-#define OMAP2420_CONTROL_PADCONF_GPMC_D5_OFFSET                                0x055
-#define OMAP2420_CONTROL_PADCONF_GPMC_D4_OFFSET                                0x056
-#define OMAP2420_CONTROL_PADCONF_GPMC_D3_OFFSET                                0x057
-#define OMAP2420_CONTROL_PADCONF_GPMC_D2_OFFSET                                0x058
-#define OMAP2420_CONTROL_PADCONF_GPMC_D1_OFFSET                                0x059
-#define OMAP2420_CONTROL_PADCONF_GPMC_D0_OFFSET                                0x05a
-#define OMAP2420_CONTROL_PADCONF_GPMC_CLK_OFFSET                       0x05b
-#define OMAP2420_CONTROL_PADCONF_GPMC_NCS0_OFFSET                      0x05c
-#define OMAP2420_CONTROL_PADCONF_GPMC_NCS1_OFFSET                      0x05d
-#define OMAP2420_CONTROL_PADCONF_GPMC_NCS2_OFFSET                      0x05e
-#define OMAP2420_CONTROL_PADCONF_GPMC_NCS3_OFFSET                      0x05f
-#define OMAP2420_CONTROL_PADCONF_GPMC_NCS4_OFFSET                      0x060
-#define OMAP2420_CONTROL_PADCONF_GPMC_NCS5_OFFSET                      0x061
-#define OMAP2420_CONTROL_PADCONF_GPMC_NCS6_OFFSET                      0x062
-#define OMAP2420_CONTROL_PADCONF_GPMC_NCS7_OFFSET                      0x063
-#define OMAP2420_CONTROL_PADCONF_GPMC_NALE_ALE_OFFSET                  0x064
-#define OMAP2420_CONTROL_PADCONF_GPMC_NOE_OFFSET                       0x065
-#define OMAP2420_CONTROL_PADCONF_GPMC_NWE_OFFSET                       0x066
-#define OMAP2420_CONTROL_PADCONF_GPMC_NBE0_OFFSET                      0x067
-#define OMAP2420_CONTROL_PADCONF_GPMC_NBE1_OFFSET                      0x068
-#define OMAP2420_CONTROL_PADCONF_GPMC_NWP_OFFSET                       0x069
-#define OMAP2420_CONTROL_PADCONF_GPMC_WAIT0_OFFSET                     0x06a
-#define OMAP2420_CONTROL_PADCONF_GPMC_WAIT1_OFFSET                     0x06b
-#define OMAP2420_CONTROL_PADCONF_GPMC_WAIT2_OFFSET                     0x06c
-#define OMAP2420_CONTROL_PADCONF_GPMC_WAIT3_OFFSET                     0x06d
-#define OMAP2420_CONTROL_PADCONF_SDRC_CLK_OFFSET                       0x06e
-#define OMAP2420_CONTROL_PADCONF_SDRC_NCLK_OFFSET                      0x06f
-#define OMAP2420_CONTROL_PADCONF_SDRC_NCS0_OFFSET                      0x070
-#define OMAP2420_CONTROL_PADCONF_SDRC_NCS1_OFFSET                      0x071
-#define OMAP2420_CONTROL_PADCONF_SDRC_CKE0_OFFSET                      0x072
-#define OMAP2420_CONTROL_PADCONF_SDRC_CKE1_OFFSET                      0x073
-#define OMAP2420_CONTROL_PADCONF_SDRC_NRAS_OFFSET                      0x074
-#define OMAP2420_CONTROL_PADCONF_SDRC_NCAS_OFFSET                      0x075
-#define OMAP2420_CONTROL_PADCONF_SDRC_NWE_OFFSET                       0x076
-#define OMAP2420_CONTROL_PADCONF_SDRC_DM0_OFFSET                       0x077
-#define OMAP2420_CONTROL_PADCONF_SDRC_DM1_OFFSET                       0x078
-#define OMAP2420_CONTROL_PADCONF_SDRC_DM2_OFFSET                       0x079
-#define OMAP2420_CONTROL_PADCONF_SDRC_DM3_OFFSET                       0x07a
-#define OMAP2420_CONTROL_PADCONF_SDRC_DQS0_OFFSET                      0x07f
-#define OMAP2420_CONTROL_PADCONF_SDRC_DQS1_OFFSET                      0x080
-#define OMAP2420_CONTROL_PADCONF_SDRC_DQS2_OFFSET                      0x081
-#define OMAP2420_CONTROL_PADCONF_SDRC_DQS3_OFFSET                      0x082
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA0_OFFSET                      0x083
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA1_OFFSET                      0x084
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA2_OFFSET                      0x085
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA3_OFFSET                      0x086
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA4_OFFSET                      0x087
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA5_OFFSET                      0x088
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA6_OFFSET                      0x089
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA7_OFFSET                      0x08a
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA8_OFFSET                      0x08b
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA9_OFFSET                      0x08c
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA10_OFFSET                     0x08d
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA11_OFFSET                     0x08e
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA12_OFFSET                     0x08f
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA13_OFFSET                     0x090
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA14_OFFSET                     0x091
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA15_OFFSET                     0x092
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA16_OFFSET                     0x093
-#define OMAP2420_CONTROL_PADCONF_DSS_DATA17_OFFSET                     0x094
-#define OMAP2420_CONTROL_PADCONF_UART1_CTS_OFFSET                      0x095
-#define OMAP2420_CONTROL_PADCONF_UART1_RTS_OFFSET                      0x096
-#define OMAP2420_CONTROL_PADCONF_UART1_TX_OFFSET                       0x097
-#define OMAP2420_CONTROL_PADCONF_UART1_RX_OFFSET                       0x098
-#define OMAP2420_CONTROL_PADCONF_MCBSP2_DR_OFFSET                      0x099
-#define OMAP2420_CONTROL_PADCONF_MCBSP2_CLKX_OFFSET                    0x09a
-#define OMAP2420_CONTROL_PADCONF_DSS_PCL_OFFSET                                0x09b
-#define OMAP2420_CONTROL_PADCONF_DSS_VSYNC_OFFSET                      0x09c
-#define OMAP2420_CONTROL_PADCONF_DSS_HSYNC_OFFSET                      0x09d
-#define OMAP2420_CONTROL_PADCONF_DSS_ACBIAS_OFFSET                     0x09e
-#define OMAP2420_CONTROL_PADCONF_CAM_D9_OFFSET                         0x09f
-#define OMAP2420_CONTROL_PADCONF_CAM_D8_OFFSET                         0x0a0
-#define OMAP2420_CONTROL_PADCONF_CAM_D7_OFFSET                         0x0a1
-#define OMAP2420_CONTROL_PADCONF_CAM_D6_OFFSET                         0x0a2
-#define OMAP2420_CONTROL_PADCONF_CAM_D5_OFFSET                         0x0a3
-#define OMAP2420_CONTROL_PADCONF_CAM_D4_OFFSET                         0x0a4
-#define OMAP2420_CONTROL_PADCONF_CAM_D3_OFFSET                         0x0a5
-#define OMAP2420_CONTROL_PADCONF_CAM_D2_OFFSET                         0x0a6
-#define OMAP2420_CONTROL_PADCONF_CAM_D1_OFFSET                         0x0a7
-#define OMAP2420_CONTROL_PADCONF_CAM_D0_OFFSET                         0x0a8
-#define OMAP2420_CONTROL_PADCONF_CAM_HS_OFFSET                         0x0a9
-#define OMAP2420_CONTROL_PADCONF_CAM_VS_OFFSET                         0x0aa
-#define OMAP2420_CONTROL_PADCONF_CAM_LCLK_OFFSET                       0x0ab
-#define OMAP2420_CONTROL_PADCONF_CAM_XCLK_OFFSET                       0x0ac
-#define OMAP2420_CONTROL_PADCONF_SSI1_DAT_TX_OFFSET                    0x0ad
-#define OMAP2420_CONTROL_PADCONF_SSI1_FLAG_TX_OFFSET                   0x0ae
-#define OMAP2420_CONTROL_PADCONF_SSI1_RDY_TX_OFFSET                    0x0af
-#define OMAP2420_CONTROL_PADCONF_GPIO_62_OFFSET                                0x0b0
-#define OMAP2420_CONTROL_PADCONF_SSI1_DAT_RX_OFFSET                    0x0b1
-#define OMAP2420_CONTROL_PADCONF_SSI1_FLAG_RX_OFFSET                   0x0b2
-#define OMAP2420_CONTROL_PADCONF_SSI1_RDY_RX_OFFSET                    0x0b3
-#define OMAP2420_CONTROL_PADCONF_SSI1_WAKE_OFFSET                      0x0b4
-#define OMAP2420_CONTROL_PADCONF_VLYNQ_CLK_OFFSET                      0x0b5
-#define OMAP2420_CONTROL_PADCONF_VLYNQ_RX1_OFFSET                      0x0b6
-#define OMAP2420_CONTROL_PADCONF_VLYNQ_RX0_OFFSET                      0x0b7
-#define OMAP2420_CONTROL_PADCONF_VLYNQ_TX1_OFFSET                      0x0b8
-#define OMAP2420_CONTROL_PADCONF_VLYNQ_TX0_OFFSET                      0x0b9
-#define OMAP2420_CONTROL_PADCONF_VLYNQ_NLA_OFFSET                      0x0ba
-#define OMAP2420_CONTROL_PADCONF_UART2_CTS_OFFSET                      0x0bb
-#define OMAP2420_CONTROL_PADCONF_UART2_RTS_OFFSET                      0x0bc
-#define OMAP2420_CONTROL_PADCONF_UART2_TX_OFFSET                       0x0bd
-#define OMAP2420_CONTROL_PADCONF_UART2_RX_OFFSET                       0x0be
-#define OMAP2420_CONTROL_PADCONF_EAC_BT_SCLK_OFFSET                    0x0bf
-#define OMAP2420_CONTROL_PADCONF_EAC_BT_FS_OFFSET                      0x0c0
-#define OMAP2420_CONTROL_PADCONF_EAC_BT_DIN_OFFSET                     0x0c1
-#define OMAP2420_CONTROL_PADCONF_EAC_BT_DOUT_OFFSET                    0x0c2
-#define OMAP2420_CONTROL_PADCONF_MMC_CLKO_OFFSET                       0x0c3
-#define OMAP2420_CONTROL_PADCONF_MMC_CMD_OFFSET                                0x0c4
-#define OMAP2420_CONTROL_PADCONF_MMC_DAT0_OFFSET                       0x0c5
-#define OMAP2420_CONTROL_PADCONF_MMC_DAT1_OFFSET                       0x0c6
-#define OMAP2420_CONTROL_PADCONF_MMC_DAT2_OFFSET                       0x0c7
-#define OMAP2420_CONTROL_PADCONF_MMC_DAT3_OFFSET                       0x0c8
-#define OMAP2420_CONTROL_PADCONF_MMC_DAT_DIR0_OFFSET                   0x0c9
-#define OMAP2420_CONTROL_PADCONF_MMC_DAT_DIR1_OFFSET                   0x0ca
-#define OMAP2420_CONTROL_PADCONF_MMC_DAT_DIR2_OFFSET                   0x0cb
-#define OMAP2420_CONTROL_PADCONF_MMC_DAT_DIR3_OFFSET                   0x0cc
-#define OMAP2420_CONTROL_PADCONF_MMC_CMD_DIR_OFFSET                    0x0cd
-#define OMAP2420_CONTROL_PADCONF_MMC_CLKI_OFFSET                       0x0ce
-#define OMAP2420_CONTROL_PADCONF_SPI1_CLK_OFFSET                       0x0cf
-#define OMAP2420_CONTROL_PADCONF_SPI1_SIMO_OFFSET                      0x0d0
-#define OMAP2420_CONTROL_PADCONF_SPI1_SOMI_OFFSET                      0x0d1
-#define OMAP2420_CONTROL_PADCONF_SPI1_NCS0_OFFSET                      0x0d2
-#define OMAP2420_CONTROL_PADCONF_SPI1_NCS1_OFFSET                      0x0d3
-#define OMAP2420_CONTROL_PADCONF_SPI1_NCS2_OFFSET                      0x0d4
-#define OMAP2420_CONTROL_PADCONF_SPI1_NCS3_OFFSET                      0x0d5
-#define OMAP2420_CONTROL_PADCONF_SPI2_CLK_OFFSET                       0x0d6
-#define OMAP2420_CONTROL_PADCONF_SPI2_SIMO_OFFSET                      0x0d7
-#define OMAP2420_CONTROL_PADCONF_SPI2_SOMI_OFFSET                      0x0d8
-#define OMAP2420_CONTROL_PADCONF_SPI2_NCS0_OFFSET                      0x0d9
-#define OMAP2420_CONTROL_PADCONF_MCBSP1_CLKR_OFFSET                    0x0da
-#define OMAP2420_CONTROL_PADCONF_MCBSP1_FSR_OFFSET                     0x0db
-#define OMAP2420_CONTROL_PADCONF_MCBSP1_DX_OFFSET                      0x0dc
-#define OMAP2420_CONTROL_PADCONF_MCBSP1_DR_OFFSET                      0x0dd
-#define OMAP2420_CONTROL_PADCONF_MCBSP_CLKS_OFFSET                     0x0de
-#define OMAP2420_CONTROL_PADCONF_MCBSP1_FSX_OFFSET                     0x0df
-#define OMAP2420_CONTROL_PADCONF_MCBSP1_CLKX_OFFSET                    0x0e0
-#define OMAP2420_CONTROL_PADCONF_I2C1_SCL_OFFSET                       0x0e1
-#define OMAP2420_CONTROL_PADCONF_I2C1_SDA_OFFSET                       0x0e2
-#define OMAP2420_CONTROL_PADCONF_I2C2_SCL_OFFSET                       0x0e3
-#define OMAP2420_CONTROL_PADCONF_I2C2_SDA_OFFSET                       0x0e4
-#define OMAP2420_CONTROL_PADCONF_HDQ_SIO_OFFSET                                0x0e5
-#define OMAP2420_CONTROL_PADCONF_UART3_CTS_RCTX_OFFSET                 0x0e6
-#define OMAP2420_CONTROL_PADCONF_UART3_RTS_SD_OFFSET                   0x0e7
-#define OMAP2420_CONTROL_PADCONF_UART3_TX_IRTX_OFFSET                  0x0e8
-#define OMAP2420_CONTROL_PADCONF_UART3_RX_IRRX_OFFSET                  0x0e9
-#define OMAP2420_CONTROL_PADCONF_TV_CVBS_OFFSET                                0x0ea
-#define OMAP2420_CONTROL_PADCONF_TV_VREF_OFFSET                                0x0eb
-#define OMAP2420_CONTROL_PADCONF_TV_RREF_OFFSET                                0x0ec
-#define OMAP2420_CONTROL_PADCONF_USB0_PUEN_OFFSET                      0x0ed
-#define OMAP2420_CONTROL_PADCONF_USB0_VP_OFFSET                                0x0ee
-#define OMAP2420_CONTROL_PADCONF_USB0_VM_OFFSET                                0x0ef
-#define OMAP2420_CONTROL_PADCONF_USB0_RCV_OFFSET                       0x0f0
-#define OMAP2420_CONTROL_PADCONF_USB0_TXEN_OFFSET                      0x0f1
-#define OMAP2420_CONTROL_PADCONF_USB0_SE0_OFFSET                       0x0f2
-#define OMAP2420_CONTROL_PADCONF_USB0_DAT_OFFSET                       0x0f3
-#define OMAP2420_CONTROL_PADCONF_EAC_AC_SCLK_OFFSET                    0x0f4
-#define OMAP2420_CONTROL_PADCONF_EAC_AC_FS_OFFSET                      0x0f5
-#define OMAP2420_CONTROL_PADCONF_EAC_AC_DIN_OFFSET                     0x0f6
-#define OMAP2420_CONTROL_PADCONF_EAC_AC_DOUT_OFFSET                    0x0f7
-#define OMAP2420_CONTROL_PADCONF_EAC_AC_MCLK_OFFSET                    0x0f8
-#define OMAP2420_CONTROL_PADCONF_EAC_AC_RST_OFFSET                     0x0f9
-#define OMAP2420_CONTROL_PADCONF_SYS_NRESPWRON_OFFSET                  0x0fa
-#define OMAP2420_CONTROL_PADCONF_SYS_NRESWARM_OFFSET                   0x0fb
-#define OMAP2420_CONTROL_PADCONF_SYS_NIRQ_OFFSET                       0x0fc
-#define OMAP2420_CONTROL_PADCONF_SYS_NV_OFFSET                         0x0fd
-#define OMAP2420_CONTROL_PADCONF_GPIO_119_OFFSET                       0x0fe
-#define OMAP2420_CONTROL_PADCONF_GPIO_120_OFFSET                       0x0ff
-#define OMAP2420_CONTROL_PADCONF_GPIO_121_OFFSET                       0x100
-#define OMAP2420_CONTROL_PADCONF_GPIO_122_OFFSET                       0x101
-#define OMAP2420_CONTROL_PADCONF_SYS_32K_OFFSET                                0x102
-#define OMAP2420_CONTROL_PADCONF_SYS_XTALIN_OFFSET                     0x103
-#define OMAP2420_CONTROL_PADCONF_SYS_XTALOUT_OFFSET                    0x104
-#define OMAP2420_CONTROL_PADCONF_GPIO_36_OFFSET                                0x105
-#define OMAP2420_CONTROL_PADCONF_SYS_CLKREQ_OFFSET                     0x106
-#define OMAP2420_CONTROL_PADCONF_SYS_CLKOUT_OFFSET                     0x107
-#define OMAP2420_CONTROL_PADCONF_GPIO_6_OFFSET                         0x108
-#define OMAP2420_CONTROL_PADCONF_GPIO_124_OFFSET                       0x109
-#define OMAP2420_CONTROL_PADCONF_GPIO_125_OFFSET                       0x10a
-#define OMAP2420_CONTROL_PADCONF_JTAG_EMU1_OFFSET                      0x10b
-#define OMAP2420_CONTROL_PADCONF_JTAG_EMU0_OFFSET                      0x10c
-#define OMAP2420_CONTROL_PADCONF_JTAG_NTRST_OFFSET                     0x10d
-#define OMAP2420_CONTROL_PADCONF_JTAG_TCK_OFFSET                       0x10e
-#define OMAP2420_CONTROL_PADCONF_JTAG_RTCK_OFFSET                      0x10f
-#define OMAP2420_CONTROL_PADCONF_JTAG_TMS_OFFSET                       0x110
-#define OMAP2420_CONTROL_PADCONF_JTAG_TDI_OFFSET                       0x111
-#define OMAP2420_CONTROL_PADCONF_JTAG_TDO_OFFSET                       0x112
-
-#define OMAP2420_CONTROL_PADCONF_MUX_SIZE                      \
-               (OMAP2420_CONTROL_PADCONF_JTAG_TDO_OFFSET + 0x1)
diff --git a/arch/arm/mach-omap2/mux2430.c b/arch/arm/mach-omap2/mux2430.c
deleted file mode 100644 (file)
index 4185f92..0000000
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia
- * Copyright (C) 2010 Texas Instruments
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-
-#include "mux.h"
-
-#ifdef CONFIG_OMAP_MUX
-
-#define _OMAP2430_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7)              \
-{                                                                      \
-       .reg_offset     = (OMAP2430_CONTROL_PADCONF_##M0##_OFFSET),     \
-       .gpio           = (g),                                          \
-       .muxnames       = { m0, m1, m2, m3, m4, m5, m6, m7 },           \
-}
-
-#else
-
-#define _OMAP2430_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7)              \
-{                                                                      \
-       .reg_offset     = (OMAP2430_CONTROL_PADCONF_##M0##_OFFSET),     \
-       .gpio           = (g),                                          \
-}
-
-#endif
-
-#define _OMAP2430_BALLENTRY(M0, bb, bt)                                        \
-{                                                                      \
-       .reg_offset     = (OMAP2430_CONTROL_PADCONF_##M0##_OFFSET),     \
-       .balls          = { bb, bt },                                   \
-}
-
-/*
- * Superset of all mux modes for omap2430
- */
-static struct omap_mux __initdata omap2430_muxmodes[] = {
-       _OMAP2430_MUXENTRY(CAM_D0, 133,
-               "cam_d0", "hw_dbg0", "sti_dout", "gpio_133",
-               NULL, NULL, "etk_d2", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_D10, 146,
-               "cam_d10", NULL, NULL, "gpio_146",
-               NULL, NULL, "etk_d12", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_D11, 145,
-               "cam_d11", NULL, NULL, "gpio_145",
-               NULL, NULL, "etk_d13", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_D1, 132,
-               "cam_d1", "hw_dbg1", "sti_din", "gpio_132",
-               NULL, NULL, "etk_d3", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_D2, 129,
-               "cam_d2", "hw_dbg2", "mcbsp1_clkx", "gpio_129",
-               NULL, NULL, "etk_d4", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_D3, 128,
-               "cam_d3", "hw_dbg3", "mcbsp1_dr", "gpio_128",
-               NULL, NULL, "etk_d5", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_D4, 143,
-               "cam_d4", "hw_dbg4", "mcbsp1_fsr", "gpio_143",
-               NULL, NULL, "etk_d6", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_D5, 112,
-               "cam_d5", "hw_dbg5", "mcbsp1_clkr", "gpio_112",
-               NULL, NULL, "etk_d7", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_D6, 137,
-               "cam_d6", "hw_dbg6", NULL, "gpio_137",
-               NULL, NULL, "etk_d8", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_D7, 136,
-               "cam_d7", "hw_dbg7", NULL, "gpio_136",
-               NULL, NULL, "etk_d9", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_D8, 135,
-               "cam_d8", "hw_dbg8", NULL, "gpio_135",
-               NULL, NULL, "etk_d10", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_D9, 134,
-               "cam_d9", "hw_dbg9", NULL, "gpio_134",
-               NULL, NULL, "etk_d11", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_HS, 11,
-               "cam_hs", "hw_dbg10", "mcbsp1_dx", "gpio_11",
-               NULL, NULL, "etk_d1", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_LCLK, 0,
-               "cam_lclk", NULL, "mcbsp_clks", NULL,
-               NULL, NULL, "etk_c1", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_VS, 12,
-               "cam_vs", "hw_dbg11", "mcbsp1_fsx", "gpio_12",
-               NULL, NULL, "etk_d0", "safe_mode"),
-       _OMAP2430_MUXENTRY(CAM_XCLK, 0,
-               "cam_xclk", NULL, "sti_clk", NULL,
-               NULL, NULL, "etk_c2", NULL),
-       _OMAP2430_MUXENTRY(DSS_ACBIAS, 48,
-               "dss_acbias", NULL, "mcbsp2_fsx", "gpio_48",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA0, 40,
-               "dss_data0", "uart1_cts", NULL, "gpio_40",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA10, 128,
-               "dss_data10", "sdi_data1n", NULL, "gpio_128",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA11, 129,
-               "dss_data11", "sdi_data1p", NULL, "gpio_129",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA12, 130,
-               "dss_data12", "sdi_data2n", NULL, "gpio_130",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA13, 131,
-               "dss_data13", "sdi_data2p", NULL, "gpio_131",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA14, 132,
-               "dss_data14", "sdi_data3n", NULL, "gpio_132",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA15, 133,
-               "dss_data15", "sdi_data3p", NULL, "gpio_133",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA16, 46,
-               "dss_data16", NULL, NULL, "gpio_46",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA17, 47,
-               "dss_data17", NULL, NULL, "gpio_47",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA1, 41,
-               "dss_data1", "uart1_rts", NULL, "gpio_41",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA2, 42,
-               "dss_data2", "uart1_tx", NULL, "gpio_42",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA3, 43,
-               "dss_data3", "uart1_rx", NULL, "gpio_43",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA4, 44,
-               "dss_data4", "uart3_rx_irrx", NULL, "gpio_44",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA5, 45,
-               "dss_data5", "uart3_tx_irtx", NULL, "gpio_45",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA6, 144,
-               "dss_data6", NULL, NULL, "gpio_144",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA7, 147,
-               "dss_data7", NULL, NULL, "gpio_147",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA8, 38,
-               "dss_data8", NULL, NULL, "gpio_38",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_DATA9, 39,
-               "dss_data9", NULL, NULL, "gpio_39",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(DSS_HSYNC, 110,
-               "dss_hsync", NULL, NULL, "gpio_110",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_113, 113,
-               "gpio_113", "mcbsp2_clkx", NULL, "gpio_113",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_114, 114,
-               "gpio_114", "mcbsp2_fsx", NULL, "gpio_114",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_115, 115,
-               "gpio_115", "mcbsp2_dr", NULL, "gpio_115",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_116, 116,
-               "gpio_116", "mcbsp2_dx", NULL, "gpio_116",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_128, 128,
-               "gpio_128", NULL, "sti_din", "gpio_128",
-               NULL, "sys_boot0", NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_129, 129,
-               "gpio_129", NULL, "sti_dout", "gpio_129",
-               NULL, "sys_boot1", NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_130, 130,
-               "gpio_130", NULL, NULL, "gpio_130",
-               "jtag_emu2", "sys_boot2", NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_131, 131,
-               "gpio_131", NULL, NULL, "gpio_131",
-               "jtag_emu3", "sys_boot3", NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_132, 132,
-               "gpio_132", NULL, NULL, "gpio_132",
-               NULL, "sys_boot4", NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_133, 133,
-               "gpio_133", NULL, NULL, "gpio_133",
-               NULL, "sys_boot5", NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_134, 134,
-               "gpio_134", "ccp_datn", NULL, "gpio_134",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_135, 135,
-               "gpio_135", "ccp_datp", NULL, "gpio_135",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_136, 136,
-               "gpio_136", "ccp_clkn", NULL, "gpio_136",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_137, 137,
-               "gpio_137", "ccp_clkp", NULL, "gpio_137",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_138, 138,
-               "gpio_138", "spi3_clk", NULL, "gpio_138",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_139, 139,
-               "gpio_139", "spi3_cs0", "sys_ndmareq3", "gpio_139",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_140, 140,
-               "gpio_140", "spi3_simo", "sys_ndmareq4", "gpio_140",
-               NULL, NULL, "etk_d14", "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_141, 141,
-               "gpio_141", "spi3_somi", NULL, "gpio_141",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_142, 142,
-               "gpio_142", "spi3_cs1", "sys_ndmareq2", "gpio_142",
-               NULL, NULL, "etk_d15", "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_148, 148,
-               "gpio_148", "mcbsp5_fsx", NULL, "gpio_148",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_149, 149,
-               "gpio_149", "mcbsp5_dx", NULL, "gpio_149",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_150, 150,
-               "gpio_150", "mcbsp5_dr", NULL, "gpio_150",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_151, 151,
-               "gpio_151", "sys_pwrok", NULL, "gpio_151",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_152, 152,
-               "gpio_152", "uart1_cts", "sys_ndmareq1", "gpio_152",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_153, 153,
-               "gpio_153", "uart1_rx", "sys_ndmareq0", "gpio_153",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_154, 154,
-               "gpio_154", "mcbsp5_clkx", NULL, "gpio_154",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_63, 63,
-               "gpio_63", "mcbsp4_clkx", NULL, "gpio_63",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_78, 78,
-               "gpio_78", NULL, "uart2_rts", "gpio_78",
-               "uart3_rts_sd", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_79, 79,
-               "gpio_79", "secure_indicator", "uart2_tx", "gpio_79",
-               "uart3_tx_irtx", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_7, 7,
-               "gpio_7", NULL, "uart2_cts", "gpio_7",
-               "uart3_cts_rctx", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPIO_80, 80,
-               "gpio_80", NULL, "uart2_rx", "gpio_80",
-               "uart3_rx_irrx", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_A10, 3,
-               "gpmc_a10", NULL, "sys_ndmareq0", "gpio_3",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_A1, 31,
-               "gpmc_a1", NULL, NULL, "gpio_31",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_A2, 30,
-               "gpmc_a2", NULL, NULL, "gpio_30",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_A3, 29,
-               "gpmc_a3", NULL, NULL, "gpio_29",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_A4, 49,
-               "gpmc_a4", NULL, NULL, "gpio_49",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_A5, 53,
-               "gpmc_a5", NULL, NULL, "gpio_53",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_A6, 52,
-               "gpmc_a6", NULL, NULL, "gpio_52",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_A7, 6,
-               "gpmc_a7", NULL, NULL, "gpio_6",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_A8, 5,
-               "gpmc_a8", NULL, NULL, "gpio_5",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_A9, 4,
-               "gpmc_a9", NULL, "sys_ndmareq1", "gpio_4",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_CLK, 21,
-               "gpmc_clk", NULL, NULL, "gpio_21",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_D10, 18,
-               "gpmc_d10", NULL, NULL, "gpio_18",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_D11, 57,
-               "gpmc_d11", NULL, NULL, "gpio_57",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_D12, 77,
-               "gpmc_d12", NULL, NULL, "gpio_77",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_D13, 76,
-               "gpmc_d13", NULL, NULL, "gpio_76",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_D14, 55,
-               "gpmc_d14", NULL, NULL, "gpio_55",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_D15, 54,
-               "gpmc_d15", NULL, NULL, "gpio_54",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_D8, 20,
-               "gpmc_d8", NULL, NULL, "gpio_20",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_D9, 19,
-               "gpmc_d9", NULL, NULL, "gpio_19",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_NCS1, 22,
-               "gpmc_ncs1", NULL, NULL, "gpio_22",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_NCS2, 23,
-               "gpmc_ncs2", NULL, NULL, "gpio_23",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_NCS3, 24,
-               "gpmc_ncs3", "gpmc_io_dir", NULL, "gpio_24",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_NCS4, 25,
-               "gpmc_ncs4", NULL, NULL, "gpio_25",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_NCS5, 26,
-               "gpmc_ncs5", NULL, NULL, "gpio_26",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_NCS6, 27,
-               "gpmc_ncs6", NULL, NULL, "gpio_27",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_NCS7, 28,
-               "gpmc_ncs7", "gpmc_io_dir", NULL, "gpio_28",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_WAIT1, 33,
-               "gpmc_wait1", NULL, NULL, "gpio_33",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_WAIT2, 34,
-               "gpmc_wait2", NULL, NULL, "gpio_34",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(GPMC_WAIT3, 35,
-               "gpmc_wait3", NULL, NULL, "gpio_35",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(HDQ_SIO, 101,
-               "hdq_sio", "usb2_tllse0", "sys_altclk", "gpio_101",
-               "uart3_rx_irrx", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(I2C1_SCL, 50,
-               "i2c1_scl", NULL, NULL, "gpio_50",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(I2C1_SDA, 51,
-               "i2c1_sda", NULL, NULL, "gpio_51",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(I2C2_SCL, 99,
-               "i2c2_scl", NULL, NULL, "gpio_99",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(I2C2_SDA, 100,
-               "i2c2_sda", NULL, NULL, "gpio_100",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(JTAG_EMU0, 127,
-               "jtag_emu0", "secure_indicator", NULL, "gpio_127",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(JTAG_EMU1, 126,
-               "jtag_emu1", NULL, NULL, "gpio_126",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP1_CLKR, 92,
-               "mcbsp1_clkr", "ssi2_dat_tx", NULL, "gpio_92",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP1_CLKX, 98,
-               "mcbsp1_clkx", "ssi2_wake", NULL, "gpio_98",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP1_DR, 95,
-               "mcbsp1_dr", "ssi2_dat_rx", NULL, "gpio_95",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP1_DX, 94,
-               "mcbsp1_dx", "ssi2_rdy_tx", NULL, "gpio_94",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP1_FSR, 93,
-               "mcbsp1_fsr", "ssi2_flag_tx", NULL, "gpio_93",
-               "spi2_cs1", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP1_FSX, 97,
-               "mcbsp1_fsx", "ssi2_rdy_rx", NULL, "gpio_97",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP2_CLKX, 147,
-               "mcbsp2_clkx", "sdi_clkp", "dss_data23", "gpio_147",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP2_DR, 144,
-               "mcbsp2_dr", "sdi_clkn", "dss_data22", "gpio_144",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP3_CLKX, 71,
-               "mcbsp3_clkx", NULL, NULL, "gpio_71",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP3_DR, 73,
-               "mcbsp3_dr", NULL, NULL, "gpio_73",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP3_DX, 74,
-               "mcbsp3_dx", NULL, "sti_clk", "gpio_74",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP3_FSX, 72,
-               "mcbsp3_fsx", NULL, NULL, "gpio_72",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(MCBSP_CLKS, 96,
-               "mcbsp_clks", "ssi2_flag_rx", NULL, "gpio_96",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC1_CLKO, 0,
-               "sdmmc1_clko", "ms_clko", NULL, NULL,
-               NULL, "hw_dbg9", "hw_dbg3", "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC1_CMD, 0,
-               "sdmmc1_cmd", "ms_bs", NULL, NULL,
-               NULL, "hw_dbg8", "hw_dbg2", "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC1_DAT0, 0,
-               "sdmmc1_dat0", "ms_dat0", NULL, NULL,
-               NULL, "hw_dbg7", "hw_dbg1", "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC1_DAT1, 75,
-               "sdmmc1_dat1", "ms_dat1", NULL, "gpio_75",
-               NULL, "hw_dbg6", "hw_dbg0", "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC1_DAT2, 0,
-               "sdmmc1_dat2", "ms_dat2", NULL, NULL,
-               NULL, "hw_dbg5", "hw_dbg10", "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC1_DAT3, 0,
-               "sdmmc1_dat3", "ms_dat3", NULL, NULL,
-               NULL, "hw_dbg4", "hw_dbg11", "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC2_CLKO, 13,
-               "sdmmc2_clko", NULL, NULL, "gpio_13",
-               NULL, "spi3_clk", NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC2_CMD, 15,
-               "sdmmc2_cmd", "usb2_rcv", NULL, "gpio_15",
-               NULL, "spi3_simo", NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC2_DAT0, 16,
-               "sdmmc2_dat0", "usb2_tllse0", NULL, "gpio_16",
-               NULL, "spi3_somi", NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC2_DAT1, 58,
-               "sdmmc2_dat1", "usb2_txen", NULL, "gpio_58",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC2_DAT2, 17,
-               "sdmmc2_dat2", "usb2_dat", NULL, "gpio_17",
-               NULL, "spi3_cs1", NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SDMMC2_DAT3, 14,
-               "sdmmc2_dat3", "usb2_se0", NULL, "gpio_14",
-               NULL, "spi3_cs0", NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SDRC_A12, 2,
-               "sdrc_a12", NULL, NULL, "gpio_2",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SDRC_A13, 1,
-               "sdrc_a13", NULL, NULL, "gpio_1",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SDRC_A14, 0,
-               "sdrc_a14", NULL, NULL, "gpio_0",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SDRC_CKE1, 36,
-               "sdrc_cke1", NULL, NULL, "gpio_36",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SDRC_NCS1, 37,
-               "sdrc_ncs1", NULL, NULL, "gpio_37",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SPI1_CLK, 81,
-               "spi1_clk", NULL, NULL, "gpio_81",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SPI1_CS0, 84,
-               "spi1_cs0", NULL, NULL, "gpio_84",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SPI1_CS1, 85,
-               "spi1_cs1", NULL, NULL, "gpio_85",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SPI1_CS2, 86,
-               "spi1_cs2", NULL, NULL, "gpio_86",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SPI1_CS3, 87,
-               "spi1_cs3", "spi2_cs1", NULL, "gpio_87",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SPI1_SIMO, 82,
-               "spi1_simo", NULL, NULL, "gpio_82",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SPI1_SOMI, 83,
-               "spi1_somi", NULL, NULL, "gpio_83",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SPI2_CLK, 88,
-               "spi2_clk", "gpt9_pwm_evt", NULL, "gpio_88",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SPI2_CS0, 91,
-               "spi2_cs0", "gpt12_pwm_evt", NULL, "gpio_91",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SPI2_SIMO, 89,
-               "spi2_simo", "gpt10_pwm_evt", NULL, "gpio_89",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SPI2_SOMI, 90,
-               "spi2_somi", "gpt11_pwm_evt", NULL, "gpio_90",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SSI1_DAT_RX, 62,
-               "ssi1_dat_rx", "uart1_rx", "usb1_dat", "gpio_62",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SSI1_DAT_TX, 59,
-               "ssi1_dat_tx", "uart1_tx", "usb1_se0", "gpio_59",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SSI1_FLAG_RX, 64,
-               "ssi1_flag_rx", "mcbsp4_dr", NULL, "gpio_64",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SSI1_FLAG_TX, 60,
-               "ssi1_flag_tx", "uart1_rts", "usb1_rcv", "gpio_60",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SSI1_RDY_RX, 65,
-               "ssi1_rdy_rx", "mcbsp4_dx", NULL, "gpio_65",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SSI1_RDY_TX, 61,
-               "ssi1_rdy_tx", "uart1_cts", "usb1_txen", "gpio_61",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SSI1_WAKE, 66,
-               "ssi1_wake", "mcbsp4_fsx", NULL, "gpio_66",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SYS_CLKOUT, 111,
-               "sys_clkout", NULL, NULL, "gpio_111",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SYS_DRM_MSECURE, 118,
-               "sys_drm_msecure", NULL, "sys_ndmareq6", "gpio_118",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SYS_NIRQ0, 56,
-               "sys_nirq0", NULL, NULL, "gpio_56",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(SYS_NIRQ1, 125,
-               "sys_nirq1", NULL, "sys_ndmareq5", "gpio_125",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART1_CTS, 32,
-               "uart1_cts", "sdi_vsync", "dss_data18", "gpio_32",
-               "mcbsp5_clkx", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART1_RTS, 8,
-               "uart1_rts", "sdi_hsync", "dss_data19", "gpio_8",
-               "mcbsp5_fsx", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART1_RX, 10,
-               "uart1_rx", "sdi_stp", "dss_data21", "gpio_10",
-               "mcbsp5_dr", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART1_TX, 9,
-               "uart1_tx", "sdi_den", "dss_data20", "gpio_9",
-               "mcbsp5_dx", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART2_CTS, 67,
-               "uart2_cts", "usb1_rcv", "gpt9_pwm_evt", "gpio_67",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART2_RTS, 68,
-               "uart2_rts", "usb1_txen", "gpt10_pwm_evt", "gpio_68",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART2_RX, 70,
-               "uart2_rx", "usb1_dat", "gpt12_pwm_evt", "gpio_70",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART2_TX, 69,
-               "uart2_tx", "usb1_se0", "gpt11_pwm_evt", "gpio_69",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART3_CTS_RCTX, 102,
-               "uart3_cts_rctx", "uart3_rx_irrx", NULL, "gpio_102",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART3_RTS_SD, 103,
-               "uart3_rts_sd", "uart3_tx_irtx", NULL, "gpio_103",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART3_RX_IRRX, 105,
-               "uart3_rx_irrx", NULL, NULL, "gpio_105",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(UART3_TX_IRTX, 104,
-               "uart3_tx_irtx", "uart3_cts_rctx", NULL, "gpio_104",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_CLK, 120,
-               "usb0hs_clk", NULL, NULL, "gpio_120",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_DATA0, 0,
-               "usb0hs_data0", "uart3_tx_irtx", NULL, NULL,
-               "usb0_txen", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_DATA1, 0,
-               "usb0hs_data1", "uart3_rx_irrx", NULL, NULL,
-               "usb0_dat", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_DATA2, 0,
-               "usb0hs_data2", "uart3_rts_sd", NULL, NULL,
-               "usb0_se0", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_DATA3, 106,
-               "usb0hs_data3", NULL, "uart3_cts_rctx", "gpio_106",
-               "usb0_puen", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_DATA4, 107,
-               "usb0hs_data4", "mcbsp2_dr", NULL, "gpio_107",
-               "usb0_vp", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_DATA5, 108,
-               "usb0hs_data5", "mcbsp2_dx", NULL, "gpio_108",
-               "usb0_vm", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_DATA6, 109,
-               "usb0hs_data6", "mcbsp2_fsx", NULL, "gpio_109",
-               "usb0_rcv", NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_DATA7, 124,
-               "usb0hs_data7", "mcbsp2_clkx", NULL, "gpio_124",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_DIR, 121,
-               "usb0hs_dir", NULL, NULL, "gpio_121",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_NXT, 123,
-               "usb0hs_nxt", NULL, NULL, "gpio_123",
-               NULL, NULL, NULL, "safe_mode"),
-       _OMAP2430_MUXENTRY(USB0HS_STP, 122,
-               "usb0hs_stp", NULL, NULL, "gpio_122",
-               NULL, NULL, NULL, "safe_mode"),
-       { .reg_offset = OMAP_MUX_TERMINATOR },
-};
-
-/*
- * Balls for POP package
- * 447-pin s-PBGA Package, 0.00mm Ball Pitch (Bottom)
- */
-#ifdef CONFIG_DEBUG_FS
-static struct omap_ball __initdata omap2430_pop_ball[] = {
-       _OMAP2430_BALLENTRY(CAM_D0, "t8", NULL),
-       _OMAP2430_BALLENTRY(CAM_D1, "t4", NULL),
-       _OMAP2430_BALLENTRY(CAM_D10, "r4", NULL),
-       _OMAP2430_BALLENTRY(CAM_D11, "w3", NULL),
-       _OMAP2430_BALLENTRY(CAM_D2, "r2", NULL),
-       _OMAP2430_BALLENTRY(CAM_D3, "u3", NULL),
-       _OMAP2430_BALLENTRY(CAM_D4, "u2", NULL),
-       _OMAP2430_BALLENTRY(CAM_D5, "v1", NULL),
-       _OMAP2430_BALLENTRY(CAM_D6, "t3", NULL),
-       _OMAP2430_BALLENTRY(CAM_D7, "r3", NULL),
-       _OMAP2430_BALLENTRY(CAM_D8, "u7", NULL),
-       _OMAP2430_BALLENTRY(CAM_D9, "t7", NULL),
-       _OMAP2430_BALLENTRY(CAM_HS, "p2", NULL),
-       _OMAP2430_BALLENTRY(CAM_LCLK, "r7", NULL),
-       _OMAP2430_BALLENTRY(CAM_VS, "n2", NULL),
-       _OMAP2430_BALLENTRY(CAM_XCLK, "p3", NULL),
-       _OMAP2430_BALLENTRY(DSS_ACBIAS, "y3", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA0, "v8", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA1, "w1", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA10, "k25", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA11, "j25", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA12, "k24", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA13, "j24", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA14, "h25", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA15, "g25", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA16, "ac3", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA17, "y7", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA2, "u8", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA3, "u4", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA4, "v3", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA5, "aa4", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA6, "w8", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA7, "y1", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA8, "aa2", NULL),
-       _OMAP2430_BALLENTRY(DSS_DATA9, "ab4", NULL),
-       _OMAP2430_BALLENTRY(DSS_HSYNC, "v2", NULL),
-       _OMAP2430_BALLENTRY(GPIO_113, "ad16", NULL),
-       _OMAP2430_BALLENTRY(GPIO_114, "ac10", NULL),
-       _OMAP2430_BALLENTRY(GPIO_115, "ad13", NULL),
-       _OMAP2430_BALLENTRY(GPIO_116, "ae15", NULL),
-       _OMAP2430_BALLENTRY(GPIO_128, "p1", NULL),
-       _OMAP2430_BALLENTRY(GPIO_129, "r1", NULL),
-       _OMAP2430_BALLENTRY(GPIO_130, "p7", NULL),
-       _OMAP2430_BALLENTRY(GPIO_131, "l8", NULL),
-       _OMAP2430_BALLENTRY(GPIO_132, "w24", NULL),
-       _OMAP2430_BALLENTRY(GPIO_133, "aa24", NULL),
-       _OMAP2430_BALLENTRY(GPIO_134, "ae12", NULL),
-       _OMAP2430_BALLENTRY(GPIO_135, "ae11", NULL),
-       _OMAP2430_BALLENTRY(GPIO_136, "ad12", NULL),
-       _OMAP2430_BALLENTRY(GPIO_137, "ad11", NULL),
-       _OMAP2430_BALLENTRY(GPIO_138, "y12", NULL),
-       _OMAP2430_BALLENTRY(GPIO_139, "ad17", NULL),
-       _OMAP2430_BALLENTRY(GPIO_140, "l7", NULL),
-       _OMAP2430_BALLENTRY(GPIO_141, "ac24", NULL),
-       _OMAP2430_BALLENTRY(GPIO_142, "m3", NULL),
-       _OMAP2430_BALLENTRY(GPIO_148, "af12", NULL),
-       _OMAP2430_BALLENTRY(GPIO_149, "k7", NULL),
-       _OMAP2430_BALLENTRY(GPIO_150, "m1", NULL),
-       _OMAP2430_BALLENTRY(GPIO_151, "ad14", NULL),
-       _OMAP2430_BALLENTRY(GPIO_152, "ad18", NULL),
-       _OMAP2430_BALLENTRY(GPIO_153, "u24", NULL),
-       _OMAP2430_BALLENTRY(GPIO_154, "ae16", NULL),
-       _OMAP2430_BALLENTRY(GPIO_63, "n3", NULL),
-       _OMAP2430_BALLENTRY(GPIO_7, "ac23", NULL),
-       _OMAP2430_BALLENTRY(GPIO_78, "ad10", NULL),
-       _OMAP2430_BALLENTRY(GPIO_79, "ae10", NULL),
-       _OMAP2430_BALLENTRY(GPIO_80, "ae13", NULL),
-       _OMAP2430_BALLENTRY(GPMC_A1, "a9", NULL),
-       _OMAP2430_BALLENTRY(GPMC_A10, "g12", NULL),
-       _OMAP2430_BALLENTRY(GPMC_A2, "b8", NULL),
-       _OMAP2430_BALLENTRY(GPMC_A3, "g10", NULL),
-       _OMAP2430_BALLENTRY(GPMC_A4, "g11", NULL),
-       _OMAP2430_BALLENTRY(GPMC_A5, "a10", NULL),
-       _OMAP2430_BALLENTRY(GPMC_A6, "g13", NULL),
-       _OMAP2430_BALLENTRY(GPMC_A7, "a6", NULL),
-       _OMAP2430_BALLENTRY(GPMC_A8, "h1", NULL),
-       _OMAP2430_BALLENTRY(GPMC_A9, "c8", NULL),
-       _OMAP2430_BALLENTRY(GPMC_CLK, "n1", "l1"),
-       _OMAP2430_BALLENTRY(GPMC_D10, "d1", "n1"),
-       _OMAP2430_BALLENTRY(GPMC_D11, "d2", "p2"),
-       _OMAP2430_BALLENTRY(GPMC_D12, "e1", "p1"),
-       _OMAP2430_BALLENTRY(GPMC_D13, "e3", "m1"),
-       _OMAP2430_BALLENTRY(GPMC_D14, "c7", "j2"),
-       _OMAP2430_BALLENTRY(GPMC_D15, "f3", "k2"),
-       _OMAP2430_BALLENTRY(GPMC_D8, "e2", "r1"),
-       _OMAP2430_BALLENTRY(GPMC_D9, "ab1", "t1"),
-       _OMAP2430_BALLENTRY(GPMC_NCS1, "ac1", "w1"),
-       _OMAP2430_BALLENTRY(GPMC_NCS2, "c6", NULL),
-       _OMAP2430_BALLENTRY(GPMC_NCS3, "b9", NULL),
-       _OMAP2430_BALLENTRY(GPMC_NCS4, "b4", NULL),
-       _OMAP2430_BALLENTRY(GPMC_NCS5, "a4", NULL),
-       _OMAP2430_BALLENTRY(GPMC_NCS6, "f1", NULL),
-       _OMAP2430_BALLENTRY(GPMC_NCS7, "a7", NULL),
-       _OMAP2430_BALLENTRY(GPMC_WAIT1, "j1", "y8"),
-       _OMAP2430_BALLENTRY(GPMC_WAIT2, "b7", NULL),
-       _OMAP2430_BALLENTRY(GPMC_WAIT3, "g14", NULL),
-       _OMAP2430_BALLENTRY(HDQ_SIO, "h20", NULL),
-       _OMAP2430_BALLENTRY(I2C1_SCL, "y17", NULL),
-       _OMAP2430_BALLENTRY(I2C1_SDA, "ac19", NULL),
-       _OMAP2430_BALLENTRY(I2C2_SCL, "n7", NULL),
-       _OMAP2430_BALLENTRY(I2C2_SDA, "m4", NULL),
-       _OMAP2430_BALLENTRY(JTAG_EMU0, "e25", NULL),
-       _OMAP2430_BALLENTRY(JTAG_EMU1, "e24", NULL),
-       _OMAP2430_BALLENTRY(MCBSP1_CLKR, "ab2", NULL),
-       _OMAP2430_BALLENTRY(MCBSP1_CLKX, "y9", NULL),
-       _OMAP2430_BALLENTRY(MCBSP1_DR, "af3", NULL),
-       _OMAP2430_BALLENTRY(MCBSP1_DX, "aa1", NULL),
-       _OMAP2430_BALLENTRY(MCBSP1_FSR, "ad5", NULL),
-       _OMAP2430_BALLENTRY(MCBSP1_FSX, "ab3", NULL),
-       _OMAP2430_BALLENTRY(MCBSP2_CLKX, "j26", NULL),
-       _OMAP2430_BALLENTRY(MCBSP2_DR, "k26", NULL),
-       _OMAP2430_BALLENTRY(MCBSP3_CLKX, "ac9", NULL),
-       _OMAP2430_BALLENTRY(MCBSP3_DR, "ae2", NULL),
-       _OMAP2430_BALLENTRY(MCBSP3_DX, "af4", NULL),
-       _OMAP2430_BALLENTRY(MCBSP3_FSX, "ae4", NULL),
-       _OMAP2430_BALLENTRY(MCBSP_CLKS, "ad6", NULL),
-       _OMAP2430_BALLENTRY(SDMMC1_CLKO, "n23", NULL),
-       _OMAP2430_BALLENTRY(SDMMC1_CMD, "l23", NULL),
-       _OMAP2430_BALLENTRY(SDMMC1_DAT0, "m24", NULL),
-       _OMAP2430_BALLENTRY(SDMMC1_DAT1, "p23", NULL),
-       _OMAP2430_BALLENTRY(SDMMC1_DAT2, "t20", NULL),
-       _OMAP2430_BALLENTRY(SDMMC1_DAT3, "r20", NULL),
-       _OMAP2430_BALLENTRY(SDMMC2_CLKO, "v26", NULL),
-       _OMAP2430_BALLENTRY(SDMMC2_CMD, "w20", NULL),
-       _OMAP2430_BALLENTRY(SDMMC2_DAT0, "v23", NULL),
-       _OMAP2430_BALLENTRY(SDMMC2_DAT1, "y24", NULL),
-       _OMAP2430_BALLENTRY(SDMMC2_DAT2, "v25", NULL),
-       _OMAP2430_BALLENTRY(SDMMC2_DAT3, "v24", NULL),
-       _OMAP2430_BALLENTRY(SDRC_A12, "w26", "r21"),
-       _OMAP2430_BALLENTRY(SDRC_A13, "af20", "aa15"),
-       _OMAP2430_BALLENTRY(SDRC_A14, "af16", "y12"),
-       _OMAP2430_BALLENTRY(SDRC_CKE1, "af15", "y13"),
-       _OMAP2430_BALLENTRY(SDRC_NCS1, "aa25", "t20"),
-       _OMAP2430_BALLENTRY(SPI1_CLK, "y18", NULL),
-       _OMAP2430_BALLENTRY(SPI1_CS0, "u1", NULL),
-       _OMAP2430_BALLENTRY(SPI1_CS1, "af19", NULL),
-       _OMAP2430_BALLENTRY(SPI1_CS2, "ae19", NULL),
-       _OMAP2430_BALLENTRY(SPI1_CS3, "h24", NULL),
-       _OMAP2430_BALLENTRY(SPI1_SIMO, "ad15", NULL),
-       _OMAP2430_BALLENTRY(SPI1_SOMI, "ae17", NULL),
-       _OMAP2430_BALLENTRY(SPI2_CLK, "y20", NULL),
-       _OMAP2430_BALLENTRY(SPI2_CS0, "y19", NULL),
-       _OMAP2430_BALLENTRY(SPI2_SIMO, "ac20", NULL),
-       _OMAP2430_BALLENTRY(SPI2_SOMI, "ad19", NULL),
-       _OMAP2430_BALLENTRY(SSI1_DAT_RX, "aa26", NULL),
-       _OMAP2430_BALLENTRY(SSI1_DAT_TX, "ad24", NULL),
-       _OMAP2430_BALLENTRY(SSI1_FLAG_RX, "ad23", NULL),
-       _OMAP2430_BALLENTRY(SSI1_FLAG_TX, "ab24", NULL),
-       _OMAP2430_BALLENTRY(SSI1_RDY_RX, "ab25", NULL),
-       _OMAP2430_BALLENTRY(SSI1_RDY_TX, "y25", NULL),
-       _OMAP2430_BALLENTRY(SSI1_WAKE, "ac25", NULL),
-       _OMAP2430_BALLENTRY(SYS_CLKOUT, "r25", NULL),
-       _OMAP2430_BALLENTRY(SYS_DRM_MSECURE, "ae3", NULL),
-       _OMAP2430_BALLENTRY(SYS_NIRQ0, "w25", NULL),
-       _OMAP2430_BALLENTRY(SYS_NIRQ1, "ad21", NULL),
-       _OMAP2430_BALLENTRY(UART1_CTS, "p24", NULL),
-       _OMAP2430_BALLENTRY(UART1_RTS, "p25", NULL),
-       _OMAP2430_BALLENTRY(UART1_RX, "n24", NULL),
-       _OMAP2430_BALLENTRY(UART1_TX, "r24", NULL),
-       _OMAP2430_BALLENTRY(UART2_CTS, "u25", NULL),
-       _OMAP2430_BALLENTRY(UART2_RTS, "t23", NULL),
-       _OMAP2430_BALLENTRY(UART2_RX, "t24", NULL),
-       _OMAP2430_BALLENTRY(UART2_TX, "u20", NULL),
-       _OMAP2430_BALLENTRY(UART3_CTS_RCTX, "m2", NULL),
-       _OMAP2430_BALLENTRY(UART3_RTS_SD, "k2", NULL),
-       _OMAP2430_BALLENTRY(UART3_RX_IRRX, "l3", NULL),
-       _OMAP2430_BALLENTRY(UART3_TX_IRTX, "l2", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_CLK, "ae8", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_DATA0, "ad4", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_DATA1, "ae6", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_DATA2, "af9", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_DATA3, "ad9", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_DATA4, "y11", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_DATA5, "ad7", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_DATA6, "ae7", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_DATA7, "ac7", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_DIR, "ad8", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_NXT, "ae9", NULL),
-       _OMAP2430_BALLENTRY(USB0HS_STP, "ae5", NULL),
-       { .reg_offset = OMAP_MUX_TERMINATOR },
-};
-#else
-#define omap2430_pop_ball       NULL
-#endif
-
-int __init omap2430_mux_init(struct omap_board_mux *board_subset, int flags)
-{
-       struct omap_ball *package_balls = NULL;
-
-       switch (flags & OMAP_PACKAGE_MASK) {
-       case OMAP_PACKAGE_ZAC:
-               package_balls = omap2430_pop_ball;
-               break;
-       default:
-               pr_warning("%s: No ball data available for omap2420 package\n",
-                               __func__);
-       }
-
-       return omap_mux_init("core", OMAP_MUX_REG_8BIT | OMAP_MUX_GPIO_IN_MODE3,
-                            OMAP2430_CONTROL_PADCONF_MUX_PBASE,
-                            OMAP2430_CONTROL_PADCONF_MUX_SIZE,
-                            omap2430_muxmodes, NULL, board_subset,
-                            package_balls);
-}
diff --git a/arch/arm/mach-omap2/mux2430.h b/arch/arm/mach-omap2/mux2430.h
deleted file mode 100644 (file)
index 9fd9314..0000000
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * Copyright (C) 2009 Nokia
- * Copyright (C) 2009 Texas Instruments
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#define OMAP2430_CONTROL_PADCONF_MUX_PBASE                     0x49002030LU
-
-#define OMAP2430_MUX(mode0, mux_value)                                 \
-{                                                                      \
-       .reg_offset     = (OMAP2430_CONTROL_PADCONF_##mode0##_OFFSET),  \
-       .value          = (mux_value),                                  \
-}
-
-/*
- * OMAP2430 CONTROL_PADCONF* register offsets for pin-muxing
- *
- * Extracted from the TRM.  Add 0x49002030 to these values to get the
- * absolute addresses.  The name in the macro is the mode-0 name of
- * the pin.  NOTE: These registers are 8-bits wide.
- *
- * Note that these defines use SDMMC instead of MMC for compatibility
- * with signal names used in 3630.
- */
-#define OMAP2430_CONTROL_PADCONF_GPMC_CLK_OFFSET               0x000
-#define OMAP2430_CONTROL_PADCONF_GPMC_NCS0_OFFSET              0x001
-#define OMAP2430_CONTROL_PADCONF_GPMC_NCS1_OFFSET              0x002
-#define OMAP2430_CONTROL_PADCONF_GPMC_NCS2_OFFSET              0x003
-#define OMAP2430_CONTROL_PADCONF_GPMC_NCS3_OFFSET              0x004
-#define OMAP2430_CONTROL_PADCONF_GPMC_NCS4_OFFSET              0x005
-#define OMAP2430_CONTROL_PADCONF_GPMC_NCS5_OFFSET              0x006
-#define OMAP2430_CONTROL_PADCONF_GPMC_NCS6_OFFSET              0x007
-#define OMAP2430_CONTROL_PADCONF_GPMC_NCS7_OFFSET              0x008
-#define OMAP2430_CONTROL_PADCONF_GPMC_NADV_ALE_OFFSET          0x009
-#define OMAP2430_CONTROL_PADCONF_GPMC_NOE_NRE_OFFSET           0x00a
-#define OMAP2430_CONTROL_PADCONF_GPMC_NWE_OFFSET               0x00b
-#define OMAP2430_CONTROL_PADCONF_GPMC_NBE0_CLE_OFFSET          0x00c
-#define OMAP2430_CONTROL_PADCONF_GPMC_NBE1_OFFSET              0x00d
-#define OMAP2430_CONTROL_PADCONF_GPMC_NWP_OFFSET               0x00e
-#define OMAP2430_CONTROL_PADCONF_GPMC_WAIT0_OFFSET             0x00f
-#define OMAP2430_CONTROL_PADCONF_GPMC_WAIT1_OFFSET             0x010
-#define OMAP2430_CONTROL_PADCONF_GPMC_WAIT2_OFFSET             0x011
-#define OMAP2430_CONTROL_PADCONF_GPMC_WAIT3_OFFSET             0x012
-#define OMAP2430_CONTROL_PADCONF_SDRC_CLK_OFFSET               0x013
-#define OMAP2430_CONTROL_PADCONF_SDRC_NCLK_OFFSET              0x014
-#define OMAP2430_CONTROL_PADCONF_SDRC_NCS0_OFFSET              0x015
-#define OMAP2430_CONTROL_PADCONF_SDRC_NCS1_OFFSET              0x016
-#define OMAP2430_CONTROL_PADCONF_SDRC_CKE0_OFFSET              0x017
-#define OMAP2430_CONTROL_PADCONF_SDRC_CKE1_OFFSET              0x018
-#define OMAP2430_CONTROL_PADCONF_SDRC_NRAS_OFFSET              0x019
-#define OMAP2430_CONTROL_PADCONF_SDRC_NCAS_OFFSET              0x01a
-#define OMAP2430_CONTROL_PADCONF_SDRC_NWE_OFFSET               0x01b
-#define OMAP2430_CONTROL_PADCONF_SDRC_DM0_OFFSET               0x01c
-#define OMAP2430_CONTROL_PADCONF_SDRC_DM1_OFFSET               0x01d
-#define OMAP2430_CONTROL_PADCONF_SDRC_DM2_OFFSET               0x01e
-#define OMAP2430_CONTROL_PADCONF_SDRC_DM3_OFFSET               0x01f
-#define OMAP2430_CONTROL_PADCONF_SDRC_DQS0_OFFSET              0x020
-#define OMAP2430_CONTROL_PADCONF_SDRC_DQS1_OFFSET              0x021
-#define OMAP2430_CONTROL_PADCONF_SDRC_DQS2_OFFSET              0x022
-#define OMAP2430_CONTROL_PADCONF_SDRC_DQS3_OFFSET              0x023
-#define OMAP2430_CONTROL_PADCONF_SDRC_A14_OFFSET               0x024
-#define OMAP2430_CONTROL_PADCONF_SDRC_A13_OFFSET               0x025
-#define OMAP2430_CONTROL_PADCONF_SDRC_A12_OFFSET               0x026
-#define OMAP2430_CONTROL_PADCONF_SDRC_BA1_OFFSET               0x027
-#define OMAP2430_CONTROL_PADCONF_SDRC_BA0_OFFSET               0x028
-#define OMAP2430_CONTROL_PADCONF_SDRC_A11_OFFSET               0x029
-#define OMAP2430_CONTROL_PADCONF_SDRC_A10_OFFSET               0x02a
-#define OMAP2430_CONTROL_PADCONF_SDRC_A9_OFFSET                        0x02b
-#define OMAP2430_CONTROL_PADCONF_SDRC_A8_OFFSET                        0x02c
-#define OMAP2430_CONTROL_PADCONF_SDRC_A7_OFFSET                        0x02d
-#define OMAP2430_CONTROL_PADCONF_SDRC_A6_OFFSET                        0x02e
-#define OMAP2430_CONTROL_PADCONF_SDRC_A5_OFFSET                        0x02f
-#define OMAP2430_CONTROL_PADCONF_SDRC_A4_OFFSET                        0x030
-#define OMAP2430_CONTROL_PADCONF_SDRC_A3_OFFSET                        0x031
-#define OMAP2430_CONTROL_PADCONF_SDRC_A2_OFFSET                        0x032
-#define OMAP2430_CONTROL_PADCONF_SDRC_A1_OFFSET                        0x033
-#define OMAP2430_CONTROL_PADCONF_SDRC_A0_OFFSET                        0x034
-#define OMAP2430_CONTROL_PADCONF_SDRC_D31_OFFSET               0x035
-#define OMAP2430_CONTROL_PADCONF_SDRC_D30_OFFSET               0x036
-#define OMAP2430_CONTROL_PADCONF_SDRC_D29_OFFSET               0x037
-#define OMAP2430_CONTROL_PADCONF_SDRC_D28_OFFSET               0x038
-#define OMAP2430_CONTROL_PADCONF_SDRC_D27_OFFSET               0x039
-#define OMAP2430_CONTROL_PADCONF_SDRC_D26_OFFSET               0x03a
-#define OMAP2430_CONTROL_PADCONF_SDRC_D25_OFFSET               0x03b
-#define OMAP2430_CONTROL_PADCONF_SDRC_D24_OFFSET               0x03c
-#define OMAP2430_CONTROL_PADCONF_SDRC_D23_OFFSET               0x03d
-#define OMAP2430_CONTROL_PADCONF_SDRC_D22_OFFSET               0x03e
-#define OMAP2430_CONTROL_PADCONF_SDRC_D21_OFFSET               0x03f
-#define OMAP2430_CONTROL_PADCONF_SDRC_D20_OFFSET               0x040
-#define OMAP2430_CONTROL_PADCONF_SDRC_D19_OFFSET               0x041
-#define OMAP2430_CONTROL_PADCONF_SDRC_D18_OFFSET               0x042
-#define OMAP2430_CONTROL_PADCONF_SDRC_D17_OFFSET               0x043
-#define OMAP2430_CONTROL_PADCONF_SDRC_D16_OFFSET               0x044
-#define OMAP2430_CONTROL_PADCONF_SDRC_D15_OFFSET               0x045
-#define OMAP2430_CONTROL_PADCONF_SDRC_D14_OFFSET               0x046
-#define OMAP2430_CONTROL_PADCONF_SDRC_D13_OFFSET               0x047
-#define OMAP2430_CONTROL_PADCONF_SDRC_D12_OFFSET               0x048
-#define OMAP2430_CONTROL_PADCONF_SDRC_D11_OFFSET               0x049
-#define OMAP2430_CONTROL_PADCONF_SDRC_D10_OFFSET               0x04a
-#define OMAP2430_CONTROL_PADCONF_SDRC_D9_OFFSET                        0x04b
-#define OMAP2430_CONTROL_PADCONF_SDRC_D8_OFFSET                        0x04c
-#define OMAP2430_CONTROL_PADCONF_SDRC_D7_OFFSET                        0x04d
-#define OMAP2430_CONTROL_PADCONF_SDRC_D6_OFFSET                        0x04e
-#define OMAP2430_CONTROL_PADCONF_SDRC_D5_OFFSET                        0x04f
-#define OMAP2430_CONTROL_PADCONF_SDRC_D4_OFFSET                        0x050
-#define OMAP2430_CONTROL_PADCONF_SDRC_D3_OFFSET                        0x051
-#define OMAP2430_CONTROL_PADCONF_SDRC_D2_OFFSET                        0x052
-#define OMAP2430_CONTROL_PADCONF_SDRC_D1_OFFSET                        0x053
-#define OMAP2430_CONTROL_PADCONF_SDRC_D0_OFFSET                        0x054
-#define OMAP2430_CONTROL_PADCONF_GPMC_A10_OFFSET               0x055
-#define OMAP2430_CONTROL_PADCONF_GPMC_A9_OFFSET                        0x056
-#define OMAP2430_CONTROL_PADCONF_GPMC_A8_OFFSET                        0x057
-#define OMAP2430_CONTROL_PADCONF_GPMC_A7_OFFSET                        0x058
-#define OMAP2430_CONTROL_PADCONF_GPMC_A6_OFFSET                        0x059
-#define OMAP2430_CONTROL_PADCONF_GPMC_A5_OFFSET                        0x05a
-#define OMAP2430_CONTROL_PADCONF_GPMC_A4_OFFSET                        0x05b
-#define OMAP2430_CONTROL_PADCONF_GPMC_A3_OFFSET                        0x05c
-#define OMAP2430_CONTROL_PADCONF_GPMC_A2_OFFSET                        0x05d
-#define OMAP2430_CONTROL_PADCONF_GPMC_A1_OFFSET                        0x05e
-#define OMAP2430_CONTROL_PADCONF_GPMC_D15_OFFSET               0x05f
-#define OMAP2430_CONTROL_PADCONF_GPMC_D14_OFFSET               0x060
-#define OMAP2430_CONTROL_PADCONF_GPMC_D13_OFFSET               0x061
-#define OMAP2430_CONTROL_PADCONF_GPMC_D12_OFFSET               0x062
-#define OMAP2430_CONTROL_PADCONF_GPMC_D11_OFFSET               0x063
-#define OMAP2430_CONTROL_PADCONF_GPMC_D10_OFFSET               0x064
-#define OMAP2430_CONTROL_PADCONF_GPMC_D9_OFFSET                        0x065
-#define OMAP2430_CONTROL_PADCONF_GPMC_D8_OFFSET                        0x066
-#define OMAP2430_CONTROL_PADCONF_GPMC_D7_OFFSET                        0x067
-#define OMAP2430_CONTROL_PADCONF_GPMC_D6_OFFSET                        0x068
-#define OMAP2430_CONTROL_PADCONF_GPMC_D5_OFFSET                        0x069
-#define OMAP2430_CONTROL_PADCONF_GPMC_D4_OFFSET                        0x06a
-#define OMAP2430_CONTROL_PADCONF_GPMC_D3_OFFSET                        0x06b
-#define OMAP2430_CONTROL_PADCONF_GPMC_D2_OFFSET                        0x06c
-#define OMAP2430_CONTROL_PADCONF_GPMC_D1_OFFSET                        0x06d
-#define OMAP2430_CONTROL_PADCONF_GPMC_D0_OFFSET                        0x06e
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA0_OFFSET              0x06f
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA1_OFFSET              0x070
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA2_OFFSET              0x071
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA3_OFFSET              0x072
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA4_OFFSET              0x073
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA5_OFFSET              0x074
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA6_OFFSET              0x075
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA7_OFFSET              0x076
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA8_OFFSET              0x077
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA9_OFFSET              0x078
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA10_OFFSET             0x079
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA11_OFFSET             0x07a
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA12_OFFSET             0x07b
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA13_OFFSET             0x07c
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA14_OFFSET             0x07d
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA15_OFFSET             0x07e
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA16_OFFSET             0x07f
-#define OMAP2430_CONTROL_PADCONF_DSS_DATA17_OFFSET             0x080
-#define OMAP2430_CONTROL_PADCONF_UART1_CTS_OFFSET              0x081
-#define OMAP2430_CONTROL_PADCONF_UART1_RTS_OFFSET              0x082
-#define OMAP2430_CONTROL_PADCONF_UART1_TX_OFFSET               0x083
-#define OMAP2430_CONTROL_PADCONF_UART1_RX_OFFSET               0x084
-#define OMAP2430_CONTROL_PADCONF_MCBSP2_DR_OFFSET              0x085
-#define OMAP2430_CONTROL_PADCONF_MCBSP2_CLKX_OFFSET            0x086
-#define OMAP2430_CONTROL_PADCONF_DSS_PCLK_OFFSET               0x087
-#define OMAP2430_CONTROL_PADCONF_DSS_VSYNC_OFFSET              0x088
-#define OMAP2430_CONTROL_PADCONF_DSS_HSYNC_OFFSET              0x089
-#define OMAP2430_CONTROL_PADCONF_DSS_ACBIAS_OFFSET             0x08a
-#define OMAP2430_CONTROL_PADCONF_SYS_NRESPWRON_OFFSET          0x08b
-#define OMAP2430_CONTROL_PADCONF_SYS_NRESWARM_OFFSET           0x08c
-#define OMAP2430_CONTROL_PADCONF_SYS_NIRQ0_OFFSET              0x08d
-#define OMAP2430_CONTROL_PADCONF_SYS_NIRQ1_OFFSET              0x08e
-#define OMAP2430_CONTROL_PADCONF_SYS_VMODE_OFFSET              0x08f
-#define OMAP2430_CONTROL_PADCONF_GPIO_128_OFFSET               0x090
-#define OMAP2430_CONTROL_PADCONF_GPIO_129_OFFSET               0x091
-#define OMAP2430_CONTROL_PADCONF_GPIO_130_OFFSET               0x092
-#define OMAP2430_CONTROL_PADCONF_GPIO_131_OFFSET               0x093
-#define OMAP2430_CONTROL_PADCONF_SYS_32K_OFFSET                        0x094
-#define OMAP2430_CONTROL_PADCONF_SYS_XTALIN_OFFSET             0x095
-#define OMAP2430_CONTROL_PADCONF_SYS_XTALOUT_OFFSET            0x096
-#define OMAP2430_CONTROL_PADCONF_GPIO_132_OFFSET               0x097
-#define OMAP2430_CONTROL_PADCONF_SYS_CLKREQ_OFFSET             0x098
-#define OMAP2430_CONTROL_PADCONF_SYS_CLKOUT_OFFSET             0x099
-#define OMAP2430_CONTROL_PADCONF_GPIO_151_OFFSET               0x09a
-#define OMAP2430_CONTROL_PADCONF_GPIO_133_OFFSET               0x09b
-#define OMAP2430_CONTROL_PADCONF_JTAG_EMU1_OFFSET              0x09c
-#define OMAP2430_CONTROL_PADCONF_JTAG_EMU0_OFFSET              0x09d
-#define OMAP2430_CONTROL_PADCONF_JTAG_NTRST_OFFSET             0x09e
-#define OMAP2430_CONTROL_PADCONF_JTAG_TCK_OFFSET               0x09f
-#define OMAP2430_CONTROL_PADCONF_JTAG_RTCK_OFFSET              0x0a0
-#define OMAP2430_CONTROL_PADCONF_JTAG_TMS_OFFSET               0x0a1
-#define OMAP2430_CONTROL_PADCONF_JTAG_TDI_OFFSET               0x0a2
-#define OMAP2430_CONTROL_PADCONF_JTAG_TDO_OFFSET               0x0a3
-#define OMAP2430_CONTROL_PADCONF_CAM_D9_OFFSET                 0x0a4
-#define OMAP2430_CONTROL_PADCONF_CAM_D8_OFFSET                 0x0a5
-#define OMAP2430_CONTROL_PADCONF_CAM_D7_OFFSET                 0x0a6
-#define OMAP2430_CONTROL_PADCONF_CAM_D6_OFFSET                 0x0a7
-#define OMAP2430_CONTROL_PADCONF_CAM_D5_OFFSET                 0x0a8
-#define OMAP2430_CONTROL_PADCONF_CAM_D4_OFFSET                 0x0a9
-#define OMAP2430_CONTROL_PADCONF_CAM_D3_OFFSET                 0x0aa
-#define OMAP2430_CONTROL_PADCONF_CAM_D2_OFFSET                 0x0ab
-#define OMAP2430_CONTROL_PADCONF_CAM_D1_OFFSET                 0x0ac
-#define OMAP2430_CONTROL_PADCONF_CAM_D0_OFFSET                 0x0ad
-#define OMAP2430_CONTROL_PADCONF_CAM_HS_OFFSET                 0x0ae
-#define OMAP2430_CONTROL_PADCONF_CAM_VS_OFFSET                 0x0af
-#define OMAP2430_CONTROL_PADCONF_CAM_LCLK_OFFSET               0x0b0
-#define OMAP2430_CONTROL_PADCONF_CAM_XCLK_OFFSET               0x0b1
-#define OMAP2430_CONTROL_PADCONF_CAM_D11_OFFSET                        0x0b2
-#define OMAP2430_CONTROL_PADCONF_CAM_D10_OFFSET                        0x0b3
-#define OMAP2430_CONTROL_PADCONF_GPIO_134_OFFSET               0x0b4
-#define OMAP2430_CONTROL_PADCONF_GPIO_135_OFFSET               0x0b5
-#define OMAP2430_CONTROL_PADCONF_GPIO_136_OFFSET               0x0b6
-#define OMAP2430_CONTROL_PADCONF_GPIO_137_OFFSET               0x0b7
-#define OMAP2430_CONTROL_PADCONF_GPIO_138_OFFSET               0x0b8
-#define OMAP2430_CONTROL_PADCONF_GPIO_139_OFFSET               0x0b9
-#define OMAP2430_CONTROL_PADCONF_GPIO_140_OFFSET               0x0ba
-#define OMAP2430_CONTROL_PADCONF_GPIO_141_OFFSET               0x0bb
-#define OMAP2430_CONTROL_PADCONF_GPIO_142_OFFSET               0x0bc
-#define OMAP2430_CONTROL_PADCONF_GPIO_154_OFFSET               0x0bd
-#define OMAP2430_CONTROL_PADCONF_GPIO_148_OFFSET               0x0be
-#define OMAP2430_CONTROL_PADCONF_GPIO_149_OFFSET               0x0bf
-#define OMAP2430_CONTROL_PADCONF_GPIO_150_OFFSET               0x0c0
-#define OMAP2430_CONTROL_PADCONF_GPIO_152_OFFSET               0x0c1
-#define OMAP2430_CONTROL_PADCONF_GPIO_153_OFFSET               0x0c2
-#define OMAP2430_CONTROL_PADCONF_SDMMC1_CLKO_OFFSET            0x0c3
-#define OMAP2430_CONTROL_PADCONF_SDMMC1_CMD_OFFSET             0x0c4
-#define OMAP2430_CONTROL_PADCONF_SDMMC1_DAT0_OFFSET            0x0c5
-#define OMAP2430_CONTROL_PADCONF_SDMMC1_DAT1_OFFSET            0x0c6
-#define OMAP2430_CONTROL_PADCONF_SDMMC1_DAT2_OFFSET            0x0c7
-#define OMAP2430_CONTROL_PADCONF_SDMMC1_DAT3_OFFSET            0x0c8
-#define OMAP2430_CONTROL_PADCONF_SDMMC2_CLKO_OFFSET            0x0c9
-#define OMAP2430_CONTROL_PADCONF_SDMMC2_DAT3_OFFSET            0x0ca
-#define OMAP2430_CONTROL_PADCONF_SDMMC2_CMD_OFFSET             0x0cb
-#define OMAP2430_CONTROL_PADCONF_SDMMC2_DAT0_OFFSET            0x0cc
-#define OMAP2430_CONTROL_PADCONF_SDMMC2_DAT2_OFFSET            0x0cd
-#define OMAP2430_CONTROL_PADCONF_SDMMC2_DAT1_OFFSET            0x0ce
-#define OMAP2430_CONTROL_PADCONF_UART2_CTS_OFFSET              0x0cf
-#define OMAP2430_CONTROL_PADCONF_UART2_RTS_OFFSET              0x0d0
-#define OMAP2430_CONTROL_PADCONF_UART2_TX_OFFSET               0x0d1
-#define OMAP2430_CONTROL_PADCONF_UART2_RX_OFFSET               0x0d2
-#define OMAP2430_CONTROL_PADCONF_MCBSP3_CLKX_OFFSET            0x0d3
-#define OMAP2430_CONTROL_PADCONF_MCBSP3_FSX_OFFSET             0x0d4
-#define OMAP2430_CONTROL_PADCONF_MCBSP3_DR_OFFSET              0x0d5
-#define OMAP2430_CONTROL_PADCONF_MCBSP3_DX_OFFSET              0x0d6
-#define OMAP2430_CONTROL_PADCONF_SSI1_DAT_TX_OFFSET            0x0d7
-#define OMAP2430_CONTROL_PADCONF_SSI1_FLAG_TX_OFFSET           0x0d8
-#define OMAP2430_CONTROL_PADCONF_SSI1_RDY_TX_OFFSET            0x0d9
-#define OMAP2430_CONTROL_PADCONF_SSI1_DAT_RX_OFFSET            0x0da
-#define OMAP2430_CONTROL_PADCONF_GPIO_63_OFFSET                        0x0db
-#define OMAP2430_CONTROL_PADCONF_SSI1_FLAG_RX_OFFSET           0x0dc
-#define OMAP2430_CONTROL_PADCONF_SSI1_RDY_RX_OFFSET            0x0dd
-#define OMAP2430_CONTROL_PADCONF_SSI1_WAKE_OFFSET              0x0de
-#define OMAP2430_CONTROL_PADCONF_SPI1_CLK_OFFSET               0x0df
-#define OMAP2430_CONTROL_PADCONF_SPI1_SIMO_OFFSET              0x0e0
-#define OMAP2430_CONTROL_PADCONF_SPI1_SOMI_OFFSET              0x0e1
-#define OMAP2430_CONTROL_PADCONF_SPI1_CS0_OFFSET               0x0e2
-#define OMAP2430_CONTROL_PADCONF_SPI1_CS1_OFFSET               0x0e3
-#define OMAP2430_CONTROL_PADCONF_SPI1_CS2_OFFSET               0x0e4
-#define OMAP2430_CONTROL_PADCONF_SPI1_CS3_OFFSET               0x0e5
-#define OMAP2430_CONTROL_PADCONF_SPI2_CLK_OFFSET               0x0e6
-#define OMAP2430_CONTROL_PADCONF_SPI2_SIMO_OFFSET              0x0e7
-#define OMAP2430_CONTROL_PADCONF_SPI2_SOMI_OFFSET              0x0e8
-#define OMAP2430_CONTROL_PADCONF_SPI2_CS0_OFFSET               0x0e9
-#define OMAP2430_CONTROL_PADCONF_MCBSP1_CLKR_OFFSET            0x0ea
-#define OMAP2430_CONTROL_PADCONF_MCBSP1_FSR_OFFSET             0x0eb
-#define OMAP2430_CONTROL_PADCONF_MCBSP1_DX_OFFSET              0x0ec
-#define OMAP2430_CONTROL_PADCONF_MCBSP1_DR_OFFSET              0x0ed
-#define OMAP2430_CONTROL_PADCONF_MCBSP_CLKS_OFFSET             0x0ee
-#define OMAP2430_CONTROL_PADCONF_MCBSP1_FSX_OFFSET             0x0ef
-#define OMAP2430_CONTROL_PADCONF_MCBSP1_CLKX_OFFSET            0x0f0
-#define OMAP2430_CONTROL_PADCONF_I2C1_SCL_OFFSET               0x0f1
-#define OMAP2430_CONTROL_PADCONF_I2C1_SDA_OFFSET               0x0f2
-#define OMAP2430_CONTROL_PADCONF_I2C2_SCL_OFFSET               0x0f3
-#define OMAP2430_CONTROL_PADCONF_I2C2_SDA_OFFSET               0x0f4
-#define OMAP2430_CONTROL_PADCONF_HDQ_SIO_OFFSET                        0x0f5
-#define OMAP2430_CONTROL_PADCONF_UART3_CTS_RCTX_OFFSET         0x0f6
-#define OMAP2430_CONTROL_PADCONF_UART3_RTS_SD_OFFSET           0x0f7
-#define OMAP2430_CONTROL_PADCONF_UART3_TX_IRTX_OFFSET          0x0f8
-#define OMAP2430_CONTROL_PADCONF_UART3_RX_IRRX_OFFSET          0x0f9
-#define OMAP2430_CONTROL_PADCONF_GPIO_7_OFFSET                 0x0fa
-#define OMAP2430_CONTROL_PADCONF_GPIO_78_OFFSET                        0x0fb
-#define OMAP2430_CONTROL_PADCONF_GPIO_79_OFFSET                        0x0fc
-#define OMAP2430_CONTROL_PADCONF_GPIO_80_OFFSET                        0x0fd
-#define OMAP2430_CONTROL_PADCONF_GPIO_113_OFFSET               0x0fe
-#define OMAP2430_CONTROL_PADCONF_GPIO_114_OFFSET               0x0ff
-#define OMAP2430_CONTROL_PADCONF_GPIO_115_OFFSET               0x100
-#define OMAP2430_CONTROL_PADCONF_GPIO_116_OFFSET               0x101
-#define OMAP2430_CONTROL_PADCONF_SYS_DRM_MSECURE_OFFSET                0x102
-#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA3_OFFSET           0x103
-#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA4_OFFSET           0x104
-#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA5_OFFSET           0x105
-#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA6_OFFSET           0x106
-#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA2_OFFSET           0x107
-#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA0_OFFSET           0x108
-#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA1_OFFSET           0x109
-#define OMAP2430_CONTROL_PADCONF_USB0HS_CLK_OFFSET             0x10a
-#define OMAP2430_CONTROL_PADCONF_USB0HS_DIR_OFFSET             0x10b
-#define OMAP2430_CONTROL_PADCONF_USB0HS_STP_OFFSET             0x10c
-#define OMAP2430_CONTROL_PADCONF_USB0HS_NXT_OFFSET             0x10d
-#define OMAP2430_CONTROL_PADCONF_USB0HS_DATA7_OFFSET           0x10e
-#define OMAP2430_CONTROL_PADCONF_TV_OUT_OFFSET                 0x10f
-#define OMAP2430_CONTROL_PADCONF_TV_VREF_OFFSET                        0x110
-#define OMAP2430_CONTROL_PADCONF_TV_RSET_OFFSET                        0x111
-#define OMAP2430_CONTROL_PADCONF_TV_VFB_OFFSET                 0x112
-#define OMAP2430_CONTROL_PADCONF_TV_DACOUT_OFFSET              0x113
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD0_OFFSET              0x114
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD1_OFFSET              0x115
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD2_OFFSET              0x116
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD3_OFFSET              0x117
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD4_OFFSET              0x118
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD5_OFFSET              0x119
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD6_OFFSET              0x11a
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD7_OFFSET              0x11b
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD8_OFFSET              0x11c
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD9_OFFSET              0x11d
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD10_OFFSET             0x11e
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD11_OFFSET             0x11f
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD12_OFFSET             0x120
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD13_OFFSET             0x121
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD14_OFFSET             0x122
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD15_OFFSET             0x123
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD16_OFFSET             0x124
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD17_OFFSET             0x125
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD18_OFFSET             0x126
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD19_OFFSET             0x127
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD20_OFFSET             0x128
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD21_OFFSET             0x129
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD22_OFFSET             0x12a
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD23_OFFSET             0x12b
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD24_OFFSET             0x12c
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD25_OFFSET             0x12d
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD26_OFFSET             0x12e
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD27_OFFSET             0x12f
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD28_OFFSET             0x130
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD29_OFFSET             0x131
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD30_OFFSET             0x132
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD31_OFFSET             0x133
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD32_OFFSET             0x134
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD33_OFFSET             0x135
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD34_OFFSET             0x136
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD35_OFFSET             0x137
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD36_OFFSET             0x138
-#define OMAP2430_CONTROL_PADCONF_AD2DMCAD37_OFFSET             0x139
-#define OMAP2430_CONTROL_PADCONF_AD2DMWRITE_OFFSET             0x13a
-#define OMAP2430_CONTROL_PADCONF_D2DCLK26MI_OFFSET             0x13b
-#define OMAP2430_CONTROL_PADCONF_D2DNRESPWRON1_OFFSET          0x13c
-#define OMAP2430_CONTROL_PADCONF_D2DNRESWARM_OFFSET            0x13d
-#define OMAP2430_CONTROL_PADCONF_D2DARM9NIRQ_OFFSET            0x13e
-#define OMAP2430_CONTROL_PADCONF_D2DUMA2P6FIQ_OFFSET           0x13f
-#define OMAP2430_CONTROL_PADCONF_D2DSPINT_OFFSET               0x140
-#define OMAP2430_CONTROL_PADCONF_D2DFRINT_OFFSET               0x141
-#define OMAP2430_CONTROL_PADCONF_D2DDMAREQ0_OFFSET             0x142
-#define OMAP2430_CONTROL_PADCONF_D2DDMAREQ1_OFFSET             0x143
-#define OMAP2430_CONTROL_PADCONF_D2DDMAREQ2_OFFSET             0x144
-#define OMAP2430_CONTROL_PADCONF_D2DDMAREQ3_OFFSET             0x145
-#define OMAP2430_CONTROL_PADCONF_D2DN3GTRST_OFFSET             0x146
-#define OMAP2430_CONTROL_PADCONF_D2DN3GTDI_OFFSET              0x147
-#define OMAP2430_CONTROL_PADCONF_D2DN3GTDO_OFFSET              0x148
-#define OMAP2430_CONTROL_PADCONF_D2DN3GTMS_OFFSET              0x149
-#define OMAP2430_CONTROL_PADCONF_D2DN3GTCK_OFFSET              0x14a
-#define OMAP2430_CONTROL_PADCONF_D2DN3GRTCK_OFFSET             0x14b
-#define OMAP2430_CONTROL_PADCONF_D2DMSTDBY_OFFSET              0x14c
-#define OMAP2430_CONTROL_PADCONF_AD2DSREAD_OFFSET              0x14d
-#define OMAP2430_CONTROL_PADCONF_D2DSWAKEUP_OFFSET             0x14e
-#define OMAP2430_CONTROL_PADCONF_D2DIDLEREQ_OFFSET             0x14f
-#define OMAP2430_CONTROL_PADCONF_D2DIDLEACK_OFFSET             0x150
-#define OMAP2430_CONTROL_PADCONF_D2DSPARE0_OFFSET              0x151
-#define OMAP2430_CONTROL_PADCONF_AD2DSWRITE_OFFSET             0x152
-#define OMAP2430_CONTROL_PADCONF_AD2DMREAD_OFFSET              0x153
-
-#define OMAP2430_CONTROL_PADCONF_MUX_SIZE                      \
-               (OMAP2430_CONTROL_PADCONF_AD2DMREAD_OFFSET + 0x1)
index c0ab9b26be3da9f0c50630cfacf5b371467fd015..dd893ec4c8f271989b591e7e09e4270f2a2927ca 100644 (file)
@@ -87,7 +87,7 @@ void __init omap_barriers_init(void)
        dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA;
        dram_io_desc[0].pfn = __phys_to_pfn(paddr);
        dram_io_desc[0].length = size;
-       dram_io_desc[0].type = MT_MEMORY_SO;
+       dram_io_desc[0].type = MT_MEMORY_RW_SO;
        iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc));
        dram_sync = (void __iomem *) dram_io_desc[0].virtual;
        sram_sync = (void __iomem *) OMAP4_SRAM_VA;
index e0a398cf28d80a409e25055c19ad44baef25d7fc..01ef59def44b86e84a5a1afc1b84d34f0caa17e4 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/of.h>
 #include <linux/notifier.h>
 
+#include "common.h"
 #include "soc.h"
 #include "omap_device.h"
 #include "omap_hwmod.h"
@@ -204,6 +205,7 @@ static int _omap_device_notifier_call(struct notifier_block *nb,
        case BUS_NOTIFY_ADD_DEVICE:
                if (pdev->dev.of_node)
                        omap_device_build_from_dt(pdev);
+               omap_auxdata_legacy_init(dev);
                /* fall through */
        default:
                od = to_omap_device(pdev);
index d8b9d60f854f9a1b4b2b633b4cede6f46d092183..2f15979c2e9c410ed6c8ee42b7deb4a17c8d85ca 100644 (file)
@@ -108,8 +108,6 @@ static struct omap_i2c_dev_attr i2c_dev_attr = {
 /* I2C1 */
 static struct omap_hwmod omap2420_i2c1_hwmod = {
        .name           = "i2c1",
-       .mpu_irqs       = omap2_i2c1_mpu_irqs,
-       .sdma_reqs      = omap2_i2c1_sdma_reqs,
        .main_clk       = "i2c1_fck",
        .prcm           = {
                .omap2 = {
@@ -133,8 +131,6 @@ static struct omap_hwmod omap2420_i2c1_hwmod = {
 /* I2C2 */
 static struct omap_hwmod omap2420_i2c2_hwmod = {
        .name           = "i2c2",
-       .mpu_irqs       = omap2_i2c2_mpu_irqs,
-       .sdma_reqs      = omap2_i2c2_sdma_reqs,
        .main_clk       = "i2c2_fck",
        .prcm           = {
                .omap2 = {
@@ -179,16 +175,9 @@ static struct omap_mbox_pdata omap2420_mailbox_attrs = {
        .info           = omap2420_mailbox_info,
 };
 
-static struct omap_hwmod_irq_info omap2420_mailbox_irqs[] = {
-       { .name = "dsp", .irq = 26 + OMAP_INTC_START, },
-       { .name = "iva", .irq = 34 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
 static struct omap_hwmod omap2420_mailbox_hwmod = {
        .name           = "mailbox",
        .class          = &omap2xxx_mailbox_hwmod_class,
-       .mpu_irqs       = omap2420_mailbox_irqs,
        .main_clk       = "mailboxes_ick",
        .prcm           = {
                .omap2 = {
@@ -217,17 +206,9 @@ static struct omap_hwmod_opt_clk mcbsp_opt_clks[] = {
 };
 
 /* mcbsp1 */
-static struct omap_hwmod_irq_info omap2420_mcbsp1_irqs[] = {
-       { .name = "tx", .irq = 59 + OMAP_INTC_START, },
-       { .name = "rx", .irq = 60 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
 static struct omap_hwmod omap2420_mcbsp1_hwmod = {
        .name           = "mcbsp1",
        .class          = &omap2420_mcbsp_hwmod_class,
-       .mpu_irqs       = omap2420_mcbsp1_irqs,
-       .sdma_reqs      = omap2_mcbsp1_sdma_reqs,
        .main_clk       = "mcbsp1_fck",
        .prcm           = {
                .omap2 = {
@@ -243,17 +224,9 @@ static struct omap_hwmod omap2420_mcbsp1_hwmod = {
 };
 
 /* mcbsp2 */
-static struct omap_hwmod_irq_info omap2420_mcbsp2_irqs[] = {
-       { .name = "tx", .irq = 62 + OMAP_INTC_START, },
-       { .name = "rx", .irq = 63 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
 static struct omap_hwmod omap2420_mcbsp2_hwmod = {
        .name           = "mcbsp2",
        .class          = &omap2420_mcbsp_hwmod_class,
-       .mpu_irqs       = omap2420_mcbsp2_irqs,
-       .sdma_reqs      = omap2_mcbsp2_sdma_reqs,
        .main_clk       = "mcbsp2_fck",
        .prcm           = {
                .omap2 = {
@@ -283,22 +256,9 @@ static struct omap_hwmod_class omap2420_msdi_hwmod_class = {
 };
 
 /* msdi1 */
-static struct omap_hwmod_irq_info omap2420_msdi1_irqs[] = {
-       { .irq = 83 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
-static struct omap_hwmod_dma_info omap2420_msdi1_sdma_reqs[] = {
-       { .name = "tx", .dma_req = 61 }, /* OMAP24XX_DMA_MMC1_TX */
-       { .name = "rx", .dma_req = 62 }, /* OMAP24XX_DMA_MMC1_RX */
-       { .dma_req = -1 }
-};
-
 static struct omap_hwmod omap2420_msdi1_hwmod = {
        .name           = "msdi1",
        .class          = &omap2420_msdi_hwmod_class,
-       .mpu_irqs       = omap2420_msdi1_irqs,
-       .sdma_reqs      = omap2420_msdi1_sdma_reqs,
        .main_clk       = "mmc_fck",
        .prcm           = {
                .omap2 = {
@@ -315,7 +275,6 @@ static struct omap_hwmod omap2420_msdi1_hwmod = {
 /* HDQ1W/1-wire */
 static struct omap_hwmod omap2420_hdq1w_hwmod = {
        .name           = "hdq1w",
-       .mpu_irqs       = omap2_hdq1w_mpu_irqs,
        .main_clk       = "hdq_fck",
        .prcm           = {
                .omap2 = {
@@ -338,7 +297,6 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__i2c1 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2420_i2c1_hwmod,
        .clk            = "i2c1_ick",
-       .addr           = omap2_i2c1_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -347,7 +305,6 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__i2c2 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2420_i2c2_hwmod,
        .clk            = "i2c2_ick",
-       .addr           = omap2_i2c2_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -367,111 +324,51 @@ static struct omap_hwmod_ocp_if omap2420_l3__dsp = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-static struct omap_hwmod_addr_space omap2420_timer1_addrs[] = {
-       {
-               .pa_start       = 0x48028000,
-               .pa_end         = 0x48028000 + SZ_1K - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 /* l4_wkup -> timer1 */
 static struct omap_hwmod_ocp_if omap2420_l4_wkup__timer1 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_timer1_hwmod,
        .clk            = "gpt1_ick",
-       .addr           = omap2420_timer1_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 /* l4_wkup -> wd_timer2 */
-static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = {
-       {
-               .pa_start       = 0x48022000,
-               .pa_end         = 0x4802207f,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_wd_timer2_hwmod,
        .clk            = "mpu_wdt_ick",
-       .addr           = omap2420_wd_timer2_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 /* l4_wkup -> gpio1 */
-static struct omap_hwmod_addr_space omap2420_gpio1_addr_space[] = {
-       {
-               .pa_start       = 0x48018000,
-               .pa_end         = 0x480181ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio1 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_gpio1_hwmod,
        .clk            = "gpios_ick",
-       .addr           = omap2420_gpio1_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 /* l4_wkup -> gpio2 */
-static struct omap_hwmod_addr_space omap2420_gpio2_addr_space[] = {
-       {
-               .pa_start       = 0x4801a000,
-               .pa_end         = 0x4801a1ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio2 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_gpio2_hwmod,
        .clk            = "gpios_ick",
-       .addr           = omap2420_gpio2_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 /* l4_wkup -> gpio3 */
-static struct omap_hwmod_addr_space omap2420_gpio3_addr_space[] = {
-       {
-               .pa_start       = 0x4801c000,
-               .pa_end         = 0x4801c1ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio3 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_gpio3_hwmod,
        .clk            = "gpios_ick",
-       .addr           = omap2420_gpio3_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 /* l4_wkup -> gpio4 */
-static struct omap_hwmod_addr_space omap2420_gpio4_addr_space[] = {
-       {
-               .pa_start       = 0x4801e000,
-               .pa_end         = 0x4801e1ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio4 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_gpio4_hwmod,
        .clk            = "gpios_ick",
-       .addr           = omap2420_gpio4_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -496,7 +393,6 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__dma_system = {
 static struct omap_hwmod_ocp_if omap2420_l4_core__mailbox = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2420_mailbox_hwmod,
-       .addr           = omap2_mailbox_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -505,7 +401,6 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__mcbsp1 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2420_mcbsp1_hwmod,
        .clk            = "mcbsp1_ick",
-       .addr           = omap2_mcbsp1_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -514,25 +409,14 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__mcbsp2 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2420_mcbsp2_hwmod,
        .clk            = "mcbsp2_ick",
-       .addr           = omap2xxx_mcbsp2_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-static struct omap_hwmod_addr_space omap2420_msdi1_addrs[] = {
-       {
-               .pa_start       = 0x4809c000,
-               .pa_end         = 0x4809c000 + SZ_128 - 1,
-               .flags          = ADDR_TYPE_RT,
-       },
-       { }
-};
-
 /* l4_core -> msdi1 */
 static struct omap_hwmod_ocp_if omap2420_l4_core__msdi1 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2420_msdi1_hwmod,
        .clk            = "mmc_ick",
-       .addr           = omap2420_msdi1_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -541,36 +425,16 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__hdq1w = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2420_hdq1w_hwmod,
        .clk            = "hdq_ick",
-       .addr           = omap2_hdq1w_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
        .flags          = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE,
 };
 
 
 /* l4_wkup -> 32ksync_counter */
-static struct omap_hwmod_addr_space omap2420_counter_32k_addrs[] = {
-       {
-               .pa_start       = 0x48004000,
-               .pa_end         = 0x4800401f,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2420_gpmc_addrs[] = {
-       {
-               .pa_start       = 0x6800a000,
-               .pa_end         = 0x6800afff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2420_l4_wkup__counter_32k = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_counter_32k_hwmod,
        .clk            = "sync_32k_ick",
-       .addr           = omap2420_counter_32k_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -578,7 +442,6 @@ static struct omap_hwmod_ocp_if omap2420_l3__gpmc = {
        .master         = &omap2xxx_l3_main_hwmod,
        .slave          = &omap2xxx_gpmc_hwmod,
        .clk            = "core_l3_ck",
-       .addr           = omap2420_gpmc_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
index 5b9083461dc5e025ba83ab05d63603861722a1fb..6d1b60902179d12e707f5b1f7564080072eea371 100644 (file)
@@ -86,8 +86,6 @@ static struct omap_i2c_dev_attr i2c_dev_attr = {
 static struct omap_hwmod omap2430_i2c1_hwmod = {
        .name           = "i2c1",
        .flags          = HWMOD_16BIT_REG,
-       .mpu_irqs       = omap2_i2c1_mpu_irqs,
-       .sdma_reqs      = omap2_i2c1_sdma_reqs,
        .main_clk       = "i2chs1_fck",
        .prcm           = {
                .omap2 = {
@@ -114,8 +112,6 @@ static struct omap_hwmod omap2430_i2c1_hwmod = {
 static struct omap_hwmod omap2430_i2c2_hwmod = {
        .name           = "i2c2",
        .flags          = HWMOD_16BIT_REG,
-       .mpu_irqs       = omap2_i2c2_mpu_irqs,
-       .sdma_reqs      = omap2_i2c2_sdma_reqs,
        .main_clk       = "i2chs2_fck",
        .prcm           = {
                .omap2 = {
@@ -131,15 +127,9 @@ static struct omap_hwmod omap2430_i2c2_hwmod = {
 };
 
 /* gpio5 */
-static struct omap_hwmod_irq_info omap243x_gpio5_irqs[] = {
-       { .irq = 33 + OMAP_INTC_START, }, /* INT_24XX_GPIO_BANK5 */
-       { .irq = -1 },
-};
-
 static struct omap_hwmod omap2430_gpio5_hwmod = {
        .name           = "gpio5",
        .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .mpu_irqs       = omap243x_gpio5_irqs,
        .main_clk       = "gpio5_fck",
        .prcm           = {
                .omap2 = {
@@ -182,15 +172,9 @@ static struct omap_mbox_pdata omap2430_mailbox_attrs = {
        .info           = omap2430_mailbox_info,
 };
 
-static struct omap_hwmod_irq_info omap2430_mailbox_irqs[] = {
-       { .irq = 26 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
 static struct omap_hwmod omap2430_mailbox_hwmod = {
        .name           = "mailbox",
        .class          = &omap2xxx_mailbox_hwmod_class,
-       .mpu_irqs       = omap2430_mailbox_irqs,
        .main_clk       = "mailboxes_ick",
        .prcm           = {
                .omap2 = {
@@ -205,27 +189,12 @@ static struct omap_hwmod omap2430_mailbox_hwmod = {
 };
 
 /* mcspi3 */
-static struct omap_hwmod_irq_info omap2430_mcspi3_mpu_irqs[] = {
-       { .irq = 91 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
-static struct omap_hwmod_dma_info omap2430_mcspi3_sdma_reqs[] = {
-       { .name = "tx0", .dma_req = 15 }, /* DMA_SPI3_TX0 */
-       { .name = "rx0", .dma_req = 16 }, /* DMA_SPI3_RX0 */
-       { .name = "tx1", .dma_req = 23 }, /* DMA_SPI3_TX1 */
-       { .name = "rx1", .dma_req = 24 }, /* DMA_SPI3_RX1 */
-       { .dma_req = -1 }
-};
-
 static struct omap2_mcspi_dev_attr omap_mcspi3_dev_attr = {
        .num_chipselect = 2,
 };
 
 static struct omap_hwmod omap2430_mcspi3_hwmod = {
        .name           = "mcspi3",
-       .mpu_irqs       = omap2430_mcspi3_mpu_irqs,
-       .sdma_reqs      = omap2430_mcspi3_sdma_reqs,
        .main_clk       = "mcspi3_fck",
        .prcm           = {
                .omap2 = {
@@ -259,16 +228,8 @@ static struct omap_hwmod_class usbotg_class = {
 };
 
 /* usb_otg_hs */
-static struct omap_hwmod_irq_info omap2430_usbhsotg_mpu_irqs[] = {
-
-       { .name = "mc", .irq = 92 + OMAP_INTC_START, },
-       { .name = "dma", .irq = 93 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
 static struct omap_hwmod omap2430_usbhsotg_hwmod = {
        .name           = "usb_otg_hs",
-       .mpu_irqs       = omap2430_usbhsotg_mpu_irqs,
        .main_clk       = "usbhs_ick",
        .prcm           = {
                .omap2 = {
@@ -313,19 +274,9 @@ static struct omap_hwmod_opt_clk mcbsp_opt_clks[] = {
 };
 
 /* mcbsp1 */
-static struct omap_hwmod_irq_info omap2430_mcbsp1_irqs[] = {
-       { .name = "tx",         .irq = 59 + OMAP_INTC_START, },
-       { .name = "rx",         .irq = 60 + OMAP_INTC_START, },
-       { .name = "ovr",        .irq = 61 + OMAP_INTC_START, },
-       { .name = "common",     .irq = 64 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
 static struct omap_hwmod omap2430_mcbsp1_hwmod = {
        .name           = "mcbsp1",
        .class          = &omap2430_mcbsp_hwmod_class,
-       .mpu_irqs       = omap2430_mcbsp1_irqs,
-       .sdma_reqs      = omap2_mcbsp1_sdma_reqs,
        .main_clk       = "mcbsp1_fck",
        .prcm           = {
                .omap2 = {
@@ -341,18 +292,9 @@ static struct omap_hwmod omap2430_mcbsp1_hwmod = {
 };
 
 /* mcbsp2 */
-static struct omap_hwmod_irq_info omap2430_mcbsp2_irqs[] = {
-       { .name = "tx",         .irq = 62 + OMAP_INTC_START, },
-       { .name = "rx",         .irq = 63 + OMAP_INTC_START, },
-       { .name = "common",     .irq = 16 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
 static struct omap_hwmod omap2430_mcbsp2_hwmod = {
        .name           = "mcbsp2",
        .class          = &omap2430_mcbsp_hwmod_class,
-       .mpu_irqs       = omap2430_mcbsp2_irqs,
-       .sdma_reqs      = omap2_mcbsp2_sdma_reqs,
        .main_clk       = "mcbsp2_fck",
        .prcm           = {
                .omap2 = {
@@ -368,18 +310,9 @@ static struct omap_hwmod omap2430_mcbsp2_hwmod = {
 };
 
 /* mcbsp3 */
-static struct omap_hwmod_irq_info omap2430_mcbsp3_irqs[] = {
-       { .name = "tx",         .irq = 89 + OMAP_INTC_START, },
-       { .name = "rx",         .irq = 90 + OMAP_INTC_START, },
-       { .name = "common",     .irq = 17 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
 static struct omap_hwmod omap2430_mcbsp3_hwmod = {
        .name           = "mcbsp3",
        .class          = &omap2430_mcbsp_hwmod_class,
-       .mpu_irqs       = omap2430_mcbsp3_irqs,
-       .sdma_reqs      = omap2_mcbsp3_sdma_reqs,
        .main_clk       = "mcbsp3_fck",
        .prcm           = {
                .omap2 = {
@@ -395,24 +328,9 @@ static struct omap_hwmod omap2430_mcbsp3_hwmod = {
 };
 
 /* mcbsp4 */
-static struct omap_hwmod_irq_info omap2430_mcbsp4_irqs[] = {
-       { .name = "tx",         .irq = 54 + OMAP_INTC_START, },
-       { .name = "rx",         .irq = 55 + OMAP_INTC_START, },
-       { .name = "common",     .irq = 18 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
-static struct omap_hwmod_dma_info omap2430_mcbsp4_sdma_chs[] = {
-       { .name = "rx", .dma_req = 20 },
-       { .name = "tx", .dma_req = 19 },
-       { .dma_req = -1 }
-};
-
 static struct omap_hwmod omap2430_mcbsp4_hwmod = {
        .name           = "mcbsp4",
        .class          = &omap2430_mcbsp_hwmod_class,
-       .mpu_irqs       = omap2430_mcbsp4_irqs,
-       .sdma_reqs      = omap2430_mcbsp4_sdma_chs,
        .main_clk       = "mcbsp4_fck",
        .prcm           = {
                .omap2 = {
@@ -428,24 +346,9 @@ static struct omap_hwmod omap2430_mcbsp4_hwmod = {
 };
 
 /* mcbsp5 */
-static struct omap_hwmod_irq_info omap2430_mcbsp5_irqs[] = {
-       { .name = "tx",         .irq = 81 + OMAP_INTC_START, },
-       { .name = "rx",         .irq = 82 + OMAP_INTC_START, },
-       { .name = "common",     .irq = 19 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
-static struct omap_hwmod_dma_info omap2430_mcbsp5_sdma_chs[] = {
-       { .name = "rx", .dma_req = 22 },
-       { .name = "tx", .dma_req = 21 },
-       { .dma_req = -1 }
-};
-
 static struct omap_hwmod omap2430_mcbsp5_hwmod = {
        .name           = "mcbsp5",
        .class          = &omap2430_mcbsp_hwmod_class,
-       .mpu_irqs       = omap2430_mcbsp5_irqs,
-       .sdma_reqs      = omap2430_mcbsp5_sdma_chs,
        .main_clk       = "mcbsp5_fck",
        .prcm           = {
                .omap2 = {
@@ -478,17 +381,6 @@ static struct omap_hwmod_class omap2430_mmc_class = {
 };
 
 /* MMC/SD/SDIO1 */
-static struct omap_hwmod_irq_info omap2430_mmc1_mpu_irqs[] = {
-       { .irq = 83 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
-static struct omap_hwmod_dma_info omap2430_mmc1_sdma_reqs[] = {
-       { .name = "tx", .dma_req = 61 }, /* DMA_MMC1_TX */
-       { .name = "rx", .dma_req = 62 }, /* DMA_MMC1_RX */
-       { .dma_req = -1 }
-};
-
 static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = {
        { .role = "dbck", .clk = "mmchsdb1_fck" },
 };
@@ -500,8 +392,6 @@ static struct omap_mmc_dev_attr mmc1_dev_attr = {
 static struct omap_hwmod omap2430_mmc1_hwmod = {
        .name           = "mmc1",
        .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .mpu_irqs       = omap2430_mmc1_mpu_irqs,
-       .sdma_reqs      = omap2430_mmc1_sdma_reqs,
        .opt_clks       = omap2430_mmc1_opt_clks,
        .opt_clks_cnt   = ARRAY_SIZE(omap2430_mmc1_opt_clks),
        .main_clk       = "mmchs1_fck",
@@ -519,17 +409,6 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
 };
 
 /* MMC/SD/SDIO2 */
-static struct omap_hwmod_irq_info omap2430_mmc2_mpu_irqs[] = {
-       { .irq = 86 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
-static struct omap_hwmod_dma_info omap2430_mmc2_sdma_reqs[] = {
-       { .name = "tx", .dma_req = 47 }, /* DMA_MMC2_TX */
-       { .name = "rx", .dma_req = 48 }, /* DMA_MMC2_RX */
-       { .dma_req = -1 }
-};
-
 static struct omap_hwmod_opt_clk omap2430_mmc2_opt_clks[] = {
        { .role = "dbck", .clk = "mmchsdb2_fck" },
 };
@@ -537,8 +416,6 @@ static struct omap_hwmod_opt_clk omap2430_mmc2_opt_clks[] = {
 static struct omap_hwmod omap2430_mmc2_hwmod = {
        .name           = "mmc2",
        .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .mpu_irqs       = omap2430_mmc2_mpu_irqs,
-       .sdma_reqs      = omap2430_mmc2_sdma_reqs,
        .opt_clks       = omap2430_mmc2_opt_clks,
        .opt_clks_cnt   = ARRAY_SIZE(omap2430_mmc2_opt_clks),
        .main_clk       = "mmchs2_fck",
@@ -557,7 +434,6 @@ static struct omap_hwmod omap2430_mmc2_hwmod = {
 /* HDQ1W/1-wire */
 static struct omap_hwmod omap2430_hdq1w_hwmod = {
        .name           = "hdq1w",
-       .mpu_irqs       = omap2_hdq1w_mpu_irqs,
        .main_clk       = "hdq_fck",
        .prcm           = {
                .omap2 = {
@@ -589,7 +465,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__i2c1 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_i2c1_hwmod,
        .clk            = "i2c1_ick",
-       .addr           = omap2_i2c1_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -598,25 +473,14 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__i2c2 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_i2c2_hwmod,
        .clk            = "i2c2_ick",
-       .addr           = omap2_i2c2_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-static struct omap_hwmod_addr_space omap2430_usbhsotg_addrs[] = {
-       {
-               .pa_start       = OMAP243X_HS_BASE,
-               .pa_end         = OMAP243X_HS_BASE + SZ_4K - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 /*  l4_core ->usbhsotg  interface */
 static struct omap_hwmod_ocp_if omap2430_l4_core__usbhsotg = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_usbhsotg_hwmod,
        .clk            = "usb_l4_ick",
-       .addr           = omap2430_usbhsotg_addrs,
        .user           = OCP_USER_MPU,
 };
 
@@ -625,7 +489,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_mmc1_hwmod,
        .clk            = "mmchs1_ick",
-       .addr           = omap2430_mmc1_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -634,7 +497,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_mmc2_hwmod,
        .clk            = "mmchs2_ick",
-       .addr           = omap2430_mmc2_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -643,7 +505,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mcspi3 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_mcspi3_hwmod,
        .clk            = "mcspi3_ick",
-       .addr           = omap2430_mcspi3_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -655,129 +516,59 @@ static struct omap_hwmod_ocp_if omap2430_l3__iva = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-static struct omap_hwmod_addr_space omap2430_timer1_addrs[] = {
-       {
-               .pa_start       = 0x49018000,
-               .pa_end         = 0x49018000 + SZ_1K - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 /* l4_wkup -> timer1 */
 static struct omap_hwmod_ocp_if omap2430_l4_wkup__timer1 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_timer1_hwmod,
        .clk            = "gpt1_ick",
-       .addr           = omap2430_timer1_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 /* l4_wkup -> wd_timer2 */
-static struct omap_hwmod_addr_space omap2430_wd_timer2_addrs[] = {
-       {
-               .pa_start       = 0x49016000,
-               .pa_end         = 0x4901607f,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2430_l4_wkup__wd_timer2 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_wd_timer2_hwmod,
        .clk            = "mpu_wdt_ick",
-       .addr           = omap2430_wd_timer2_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 /* l4_wkup -> gpio1 */
-static struct omap_hwmod_addr_space omap2430_gpio1_addr_space[] = {
-       {
-               .pa_start       = 0x4900C000,
-               .pa_end         = 0x4900C1ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio1 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_gpio1_hwmod,
        .clk            = "gpios_ick",
-       .addr           = omap2430_gpio1_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 /* l4_wkup -> gpio2 */
-static struct omap_hwmod_addr_space omap2430_gpio2_addr_space[] = {
-       {
-               .pa_start       = 0x4900E000,
-               .pa_end         = 0x4900E1ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio2 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_gpio2_hwmod,
        .clk            = "gpios_ick",
-       .addr           = omap2430_gpio2_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 /* l4_wkup -> gpio3 */
-static struct omap_hwmod_addr_space omap2430_gpio3_addr_space[] = {
-       {
-               .pa_start       = 0x49010000,
-               .pa_end         = 0x490101ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio3 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_gpio3_hwmod,
        .clk            = "gpios_ick",
-       .addr           = omap2430_gpio3_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 /* l4_wkup -> gpio4 */
-static struct omap_hwmod_addr_space omap2430_gpio4_addr_space[] = {
-       {
-               .pa_start       = 0x49012000,
-               .pa_end         = 0x490121ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio4 = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_gpio4_hwmod,
        .clk            = "gpios_ick",
-       .addr           = omap2430_gpio4_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 /* l4_core -> gpio5 */
-static struct omap_hwmod_addr_space omap2430_gpio5_addr_space[] = {
-       {
-               .pa_start       = 0x480B6000,
-               .pa_end         = 0x480B61ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2430_l4_core__gpio5 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_gpio5_hwmod,
        .clk            = "gpio5_ick",
-       .addr           = omap2430_gpio5_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -802,7 +593,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__dma_system = {
 static struct omap_hwmod_ocp_if omap2430_l4_core__mailbox = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_mailbox_hwmod,
-       .addr           = omap2_mailbox_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -811,7 +601,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp1 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_mcbsp1_hwmod,
        .clk            = "mcbsp1_ick",
-       .addr           = omap2_mcbsp1_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -820,64 +609,30 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp2 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_mcbsp2_hwmod,
        .clk            = "mcbsp2_ick",
-       .addr           = omap2xxx_mcbsp2_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-static struct omap_hwmod_addr_space omap2430_mcbsp3_addrs[] = {
-       {
-               .name           = "mpu",
-               .pa_start       = 0x4808C000,
-               .pa_end         = 0x4808C0ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 /* l4_core -> mcbsp3 */
 static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp3 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_mcbsp3_hwmod,
        .clk            = "mcbsp3_ick",
-       .addr           = omap2430_mcbsp3_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-static struct omap_hwmod_addr_space omap2430_mcbsp4_addrs[] = {
-       {
-               .name           = "mpu",
-               .pa_start       = 0x4808E000,
-               .pa_end         = 0x4808E0ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 /* l4_core -> mcbsp4 */
 static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp4 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_mcbsp4_hwmod,
        .clk            = "mcbsp4_ick",
-       .addr           = omap2430_mcbsp4_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
-static struct omap_hwmod_addr_space omap2430_mcbsp5_addrs[] = {
-       {
-               .name           = "mpu",
-               .pa_start       = 0x48096000,
-               .pa_end         = 0x480960ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 /* l4_core -> mcbsp5 */
 static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp5 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_mcbsp5_hwmod,
        .clk            = "mcbsp5_ick",
-       .addr           = omap2430_mcbsp5_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -886,35 +641,15 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__hdq1w = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2430_hdq1w_hwmod,
        .clk            = "hdq_ick",
-       .addr           = omap2_hdq1w_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
        .flags          = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE,
 };
 
 /* l4_wkup -> 32ksync_counter */
-static struct omap_hwmod_addr_space omap2430_counter_32k_addrs[] = {
-       {
-               .pa_start       = 0x49020000,
-               .pa_end         = 0x4902001f,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2430_gpmc_addrs[] = {
-       {
-               .pa_start       = 0x6e000000,
-               .pa_end         = 0x6e000fff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 static struct omap_hwmod_ocp_if omap2430_l4_wkup__counter_32k = {
        .master         = &omap2xxx_l4_wkup_hwmod,
        .slave          = &omap2xxx_counter_32k_hwmod,
        .clk            = "sync_32k_ick",
-       .addr           = omap2430_counter_32k_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -922,7 +657,6 @@ static struct omap_hwmod_ocp_if omap2430_l3__gpmc = {
        .master         = &omap2xxx_l3_main_hwmod,
        .slave          = &omap2xxx_gpmc_hwmod,
        .clk            = "core_l3_ck",
-       .addr           = omap2430_gpmc_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
index 5fd40d4a989e9954469799fd76e1509f41f88c0a..656861c29d5cae1aba49b622a2aa88f0181717a5 100644 (file)
 
 #include "omap_hwmod_common_data.h"
 
-static struct omap_hwmod_addr_space omap2xxx_uart1_addr_space[] = {
-       {
-               .pa_start       = OMAP2_UART1_BASE,
-               .pa_end         = OMAP2_UART1_BASE + SZ_8K - 1,
-               .flags          = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_uart2_addr_space[] = {
-       {
-               .pa_start       = OMAP2_UART2_BASE,
-               .pa_end         = OMAP2_UART2_BASE + SZ_1K - 1,
-               .flags          = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_uart3_addr_space[] = {
-       {
-               .pa_start       = OMAP2_UART3_BASE,
-               .pa_end         = OMAP2_UART3_BASE + SZ_1K - 1,
-               .flags          = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_timer2_addrs[] = {
-       {
-               .pa_start       = 0x4802a000,
-               .pa_end         = 0x4802a000 + SZ_1K - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_timer3_addrs[] = {
-       {
-               .pa_start       = 0x48078000,
-               .pa_end         = 0x48078000 + SZ_1K - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_timer4_addrs[] = {
-       {
-               .pa_start       = 0x4807a000,
-               .pa_end         = 0x4807a000 + SZ_1K - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_timer5_addrs[] = {
-       {
-               .pa_start       = 0x4807c000,
-               .pa_end         = 0x4807c000 + SZ_1K - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_timer6_addrs[] = {
-       {
-               .pa_start       = 0x4807e000,
-               .pa_end         = 0x4807e000 + SZ_1K - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_timer7_addrs[] = {
-       {
-               .pa_start       = 0x48080000,
-               .pa_end         = 0x48080000 + SZ_1K - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_timer8_addrs[] = {
-       {
-               .pa_start       = 0x48082000,
-               .pa_end         = 0x48082000 + SZ_1K - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_timer9_addrs[] = {
-       {
-               .pa_start       = 0x48084000,
-               .pa_end         = 0x48084000 + SZ_1K - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-struct omap_hwmod_addr_space omap2xxx_mcbsp2_addrs[] = {
-       {
-               .name           = "mpu",
-               .pa_start       = 0x48076000,
-               .pa_end         = 0x480760ff,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2_rng_addr_space[] = {
-       {
-               .pa_start       = 0x480a0000,
-               .pa_end         = 0x480a004f,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_sham_addrs[] = {
-       {
-               .pa_start       = 0x480a4000,
-               .pa_end         = 0x480a4000 + 0x64 - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
-static struct omap_hwmod_addr_space omap2xxx_aes_addrs[] = {
-       {
-               .pa_start       = 0x480a6000,
-               .pa_end         = 0x480a6000 + 0x50 - 1,
-               .flags          = ADDR_TYPE_RT
-       },
-       { }
-};
-
 /*
  * Common interconnect data
  */
@@ -182,7 +46,7 @@ struct omap_hwmod_ocp_if omap2xxx_dss__l3 = {
                .omap2 = {
                        .l3_perm_bit  = OMAP2_L3_CORE_FW_CONNID_DSS,
                        .flags  = OMAP_FIREWALL_L3,
-               }
+               },
        },
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
@@ -199,7 +63,6 @@ struct omap_hwmod_ocp_if omap2_l4_core__uart1 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_uart1_hwmod,
        .clk            = "uart1_ick",
-       .addr           = omap2xxx_uart1_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -208,7 +71,6 @@ struct omap_hwmod_ocp_if omap2_l4_core__uart2 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_uart2_hwmod,
        .clk            = "uart2_ick",
-       .addr           = omap2xxx_uart2_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -217,7 +79,6 @@ struct omap_hwmod_ocp_if omap2_l4_core__uart3 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_uart3_hwmod,
        .clk            = "uart3_ick",
-       .addr           = omap2xxx_uart3_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -226,7 +87,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__mcspi1 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_mcspi1_hwmod,
        .clk            = "mcspi1_ick",
-       .addr           = omap2_mcspi1_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -235,7 +95,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__mcspi2 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_mcspi2_hwmod,
        .clk            = "mcspi2_ick",
-       .addr           = omap2_mcspi2_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -244,7 +103,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer2 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_timer2_hwmod,
        .clk            = "gpt2_ick",
-       .addr           = omap2xxx_timer2_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -253,7 +111,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer3 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_timer3_hwmod,
        .clk            = "gpt3_ick",
-       .addr           = omap2xxx_timer3_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -262,7 +119,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer4 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_timer4_hwmod,
        .clk            = "gpt4_ick",
-       .addr           = omap2xxx_timer4_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -271,7 +127,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer5 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_timer5_hwmod,
        .clk            = "gpt5_ick",
-       .addr           = omap2xxx_timer5_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -280,7 +135,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer6 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_timer6_hwmod,
        .clk            = "gpt6_ick",
-       .addr           = omap2xxx_timer6_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -289,7 +143,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer7 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_timer7_hwmod,
        .clk            = "gpt7_ick",
-       .addr           = omap2xxx_timer7_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -298,7 +151,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer8 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_timer8_hwmod,
        .clk            = "gpt8_ick",
-       .addr           = omap2xxx_timer8_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -307,7 +159,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer9 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_timer9_hwmod,
        .clk            = "gpt9_ick",
-       .addr           = omap2xxx_timer9_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -316,7 +167,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer10 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_timer10_hwmod,
        .clk            = "gpt10_ick",
-       .addr           = omap2_timer10_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -325,7 +175,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer11 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_timer11_hwmod,
        .clk            = "gpt11_ick",
-       .addr           = omap2_timer11_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -334,7 +183,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__timer12 = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_timer12_hwmod,
        .clk            = "gpt12_ick",
-       .addr           = omap2xxx_timer12_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -348,7 +196,7 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__dss = {
                .omap2 = {
                        .l4_fw_region  = OMAP2420_L4_CORE_FW_DSS_CORE_REGION,
                        .flags  = OMAP_FIREWALL_L4,
-               }
+               },
        },
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
@@ -363,7 +211,7 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_dispc = {
                .omap2 = {
                        .l4_fw_region  = OMAP2420_L4_CORE_FW_DSS_DISPC_REGION,
                        .flags  = OMAP_FIREWALL_L4,
-               }
+               },
        },
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
@@ -378,7 +226,7 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_rfbi = {
                .omap2 = {
                        .l4_fw_region  = OMAP2420_L4_CORE_FW_DSS_CORE_REGION,
                        .flags  = OMAP_FIREWALL_L4,
-               }
+               },
        },
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
@@ -393,7 +241,7 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_venc = {
                .omap2 = {
                        .l4_fw_region  = OMAP2420_L4_CORE_FW_DSS_VENC_REGION,
                        .flags  = OMAP_FIREWALL_L4,
-               }
+               },
        },
        .flags          = OCPIF_SWSUP_IDLE,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
@@ -404,7 +252,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__rng = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_rng_hwmod,
        .clk            = "rng_ick",
-       .addr           = omap2_rng_addr_space,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -413,7 +260,6 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__sham = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_sham_hwmod,
        .clk            = "sha_ick",
-       .addr           = omap2xxx_sham_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -422,6 +268,5 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__aes = {
        .master         = &omap2xxx_l4_core_hwmod,
        .slave          = &omap2xxx_aes_hwmod,
        .clk            = "aes_ick",
-       .addr           = omap2xxx_aes_addrs,
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
index d23c77fadb31036058ab7b750cf02495d2ef33ab..8821b9d6bae432859a6415f5686e10f977e92ae4 100644 (file)
 #include "prm-regbits-24xx.h"
 #include "wd_timer.h"
 
-struct omap_hwmod_irq_info omap2xxx_timer12_mpu_irqs[] = {
-       { .irq = 48 + OMAP_INTC_START, },
-       { .irq = -1 },
-};
-
 struct omap_hwmod_dma_info omap2xxx_dss_sdma_chs[] = {
        { .name = "dispc", .dma_req = 5 },
-       { .dma_req = -1 }
+       { .dma_req = -1, },
 };
 
 /*
@@ -219,14 +214,8 @@ struct omap_hwmod omap2xxx_l4_wkup_hwmod = {
 };
 
 /* MPU */
-static struct omap_hwmod_irq_info omap2xxx_mpu_irqs[] = {
-       { .name = "pmu", .irq = 3 + OMAP_INTC_START },
-       { .irq = -1 }
-};
-
 struct omap_hwmod omap2xxx_mpu_hwmod = {
        .name           = "mpu",
-       .mpu_irqs       = omap2xxx_mpu_irqs,
        .class          = &mpu_hwmod_class,
        .main_clk       = "mpu_ck",
 };
@@ -256,7 +245,6 @@ static struct omap_timer_capability_dev_attr capability_dsp_dev_attr = {
 
 struct omap_hwmod omap2xxx_timer1_hwmod = {
        .name           = "timer1",
-       .mpu_irqs       = omap2_timer1_mpu_irqs,
        .main_clk       = "gpt1_fck",
        .prcm           = {
                .omap2 = {
@@ -276,7 +264,6 @@ struct omap_hwmod omap2xxx_timer1_hwmod = {
 
 struct omap_hwmod omap2xxx_timer2_hwmod = {
        .name           = "timer2",
-       .mpu_irqs       = omap2_timer2_mpu_irqs,
        .main_clk       = "gpt2_fck",
        .prcm           = {
                .omap2 = {
@@ -295,7 +282,6 @@ struct omap_hwmod omap2xxx_timer2_hwmod = {
 
 struct omap_hwmod omap2xxx_timer3_hwmod = {
        .name           = "timer3",
-       .mpu_irqs       = omap2_timer3_mpu_irqs,
        .main_clk       = "gpt3_fck",
        .prcm           = {
                .omap2 = {
@@ -314,7 +300,6 @@ struct omap_hwmod omap2xxx_timer3_hwmod = {
 
 struct omap_hwmod omap2xxx_timer4_hwmod = {
        .name           = "timer4",
-       .mpu_irqs       = omap2_timer4_mpu_irqs,
        .main_clk       = "gpt4_fck",
        .prcm           = {
                .omap2 = {
@@ -333,7 +318,6 @@ struct omap_hwmod omap2xxx_timer4_hwmod = {
 
 struct omap_hwmod omap2xxx_timer5_hwmod = {
        .name           = "timer5",
-       .mpu_irqs       = omap2_timer5_mpu_irqs,
        .main_clk       = "gpt5_fck",
        .prcm           = {
                .omap2 = {
@@ -353,7 +337,6 @@ struct omap_hwmod omap2xxx_timer5_hwmod = {
 
 struct omap_hwmod omap2xxx_timer6_hwmod = {
        .name           = "timer6",
-       .mpu_irqs       = omap2_timer6_mpu_irqs,
        .main_clk       = "gpt6_fck",
        .prcm           = {
                .omap2 = {
@@ -373,7 +356,6 @@ struct omap_hwmod omap2xxx_timer6_hwmod = {
 
 struct omap_hwmod omap2xxx_timer7_hwmod = {
        .name           = "timer7",
-       .mpu_irqs       = omap2_timer7_mpu_irqs,
        .main_clk       = "gpt7_fck",
        .prcm           = {
                .omap2 = {
@@ -393,7 +375,6 @@ struct omap_hwmod omap2xxx_timer7_hwmod = {
 
 struct omap_hwmod omap2xxx_timer8_hwmod = {
        .name           = "timer8",
-       .mpu_irqs       = omap2_timer8_mpu_irqs,
        .main_clk       = "gpt8_fck",
        .prcm           = {
                .omap2 = {
@@ -413,7 +394,6 @@ struct omap_hwmod omap2xxx_timer8_hwmod = {
 
 struct omap_hwmod omap2xxx_timer9_hwmod = {
        .name           = "timer9",
-       .mpu_irqs       = omap2_timer9_mpu_irqs,
        .main_clk       = "gpt9_fck",
        .prcm           = {
                .omap2 = {
@@ -433,7 +413,6 @@ struct omap_hwmod omap2xxx_timer9_hwmod = {
 
 struct omap_hwmod omap2xxx_timer10_hwmod = {
        .name           = "timer10",
-       .mpu_irqs       = omap2_timer10_mpu_irqs,
        .main_clk       = "gpt10_fck",
        .prcm           = {
                .omap2 = {
@@ -453,7 +432,6 @@ struct omap_hwmod omap2xxx_timer10_hwmod = {
 
 struct omap_hwmod omap2xxx_timer11_hwmod = {
        .name           = "timer11",
-       .mpu_irqs       = omap2_timer11_mpu_irqs,
        .main_clk       = "gpt11_fck",
        .prcm           = {
                .omap2 = {
@@ -473,7 +451,6 @@ struct omap_hwmod omap2xxx_timer11_hwmod = {
 
 struct omap_hwmod omap2xxx_timer12_hwmod = {
        .name           = "timer12",
-       .mpu_irqs       = omap2xxx_timer12_mpu_irqs,
        .main_clk       = "gpt12_fck",
        .prcm           = {
                .omap2 = {
@@ -509,8 +486,6 @@ struct omap_hwmod omap2xxx_wd_timer2_hwmod = {
 
 struct omap_hwmod omap2xxx_uart1_hwmod = {
        .name           = "uart1",
-       .mpu_irqs       = omap2_uart1_mpu_irqs,
-       .sdma_reqs      = omap2_uart1_sdma_reqs,
        .main_clk       = "uart1_fck",
        .flags          = DEBUG_OMAP2UART1_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
        .prcm           = {
@@ -529,8 +504,6 @@ struct omap_hwmod omap2xxx_uart1_hwmod = {
 
 struct omap_hwmod omap2xxx_uart2_hwmod = {
        .name           = "uart2",
-       .mpu_irqs       = omap2_uart2_mpu_irqs,
-       .sdma_reqs      = omap2_uart2_sdma_reqs,
        .main_clk       = "uart2_fck",
        .flags          = DEBUG_OMAP2UART2_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
        .prcm           = {
@@ -549,8 +522,6 @@ struct omap_hwmod omap2xxx_uart2_hwmod = {
 
 struct omap_hwmod omap2xxx_uart3_hwmod = {
        .name           = "uart3",
-       .mpu_irqs       = omap2_uart3_mpu_irqs,
-       .sdma_reqs      = omap2_uart3_sdma_reqs,
        .main_clk       = "uart3_fck",
        .flags          = DEBUG_OMAP2UART3_FLAGS | HWMOD_SWSUP_SIDLE_ACT,
        .prcm           = {
@@ -610,7 +581,7 @@ struct omap_hwmod omap2xxx_dss_dispc_hwmod = {
                },
        },
        .flags          = HWMOD_NO_IDLEST,
-       .dev_attr       = &omap2_3_dss_dispc_dev_attr
+       .dev_attr       = &omap2_3_dss_dispc_dev_attr,
 };
 
 static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = {
@@ -657,7 +628,6 @@ struct omap_gpio_dev_attr omap2xxx_gpio_dev_attr = {
 struct omap_hwmod omap2xxx_gpio1_hwmod = {
        .name           = "gpio1",
        .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .mpu_irqs       = omap2_gpio1_irqs,
        .main_clk       = "gpios_fck",
        .prcm           = {
                .omap2 = {
@@ -676,7 +646,6 @@ struct omap_hwmod omap2xxx_gpio1_hwmod = {
 struct omap_hwmod omap2xxx_gpio2_hwmod = {
        .name           = "gpio2",
        .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .mpu_irqs       = omap2_gpio2_irqs,
        .main_clk       = "gpios_fck",
        .prcm           = {
                .omap2 = {
@@ -695,7 +664,6 @@ struct omap_hwmod omap2xxx_gpio2_hwmod = {
 struct omap_hwmod omap2xxx_gpio3_hwmod = {
        .name           = "gpio3",
        .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .mpu_irqs       = omap2_gpio3_irqs,
        .main_clk       = "gpios_fck",
        .prcm           = {
                .omap2 = {
@@ -714,7 +682,6 @@ struct omap_hwmod omap2xxx_gpio3_hwmod = {
 struct omap_hwmod omap2xxx_gpio4_hwmod = {
        .name           = "gpio4",
        .flags          = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
-       .mpu_irqs       = omap2_gpio4_irqs,
        .main_clk       = "gpios_fck",
        .prcm           = {
                .omap2 = {
@@ -736,8 +703,6 @@ static struct omap2_mcspi_dev_attr omap_mcspi1_dev_attr = {
 
 struct omap_hwmod omap2xxx_mcspi1_hwmod = {
        .name           = "mcspi1",
-       .mpu_irqs       = omap2_mcspi1_mpu_irqs,
-       .sdma_reqs      = omap2_mcspi1_sdma_reqs,
        .main_clk       = "mcspi1_fck",
        .prcm           = {
                .omap2 = {
@@ -759,8 +724,6 @@ static struct omap2_mcspi_dev_attr omap_mcspi2_dev_attr = {
 
 struct omap_hwmod omap2xxx_mcspi2_hwmod = {
        .name           = "mcspi2",
-       .mpu_irqs       = omap2_mcspi2_mpu_irqs,
-       .sdma_reqs      = omap2_mcspi2_sdma_reqs,
        .main_clk       = "mcspi2_fck",
        .prcm           = {
                .omap2 = {
@@ -795,15 +758,9 @@ struct omap_hwmod omap2xxx_counter_32k_hwmod = {
 };
 
 /* gpmc */
-static struct omap_hwmod_irq_info omap2xxx_gpmc_irqs[] = {
-       { .irq = 20 + OMAP_INTC_START, },
-       { .irq = -1 }
-};
-
 struct omap_hwmod omap2xxx_gpmc_hwmod = {
        .name           = "gpmc",
        .class          = &omap2xxx_gpmc_hwmod_class,
-       .mpu_irqs       = omap2xxx_gpmc_irqs,
        .main_clk       = "gpmc_fck",
        /*
         * XXX HWMOD_INIT_NO_RESET should not be needed for this IP
@@ -840,14 +797,8 @@ static struct omap_hwmod_class omap2_rng_hwmod_class = {
        .sysc           = &omap2_rng_sysc,
 };
 
-static struct omap_hwmod_irq_info omap2_rng_mpu_irqs[] = {
-       { .irq = 52 + OMAP_INTC_START, },
-       { .irq = -1 }
-};
-
 struct omap_hwmod omap2xxx_rng_hwmod = {
        .name           = "rng",
-       .mpu_irqs       = omap2_rng_mpu_irqs,
        .main_clk       = "l4_ck",
        .prcm           = {
                .omap2 = {
@@ -884,20 +835,8 @@ static struct omap_hwmod_class omap2xxx_sham_class = {
        .sysc   = &omap2_sham_sysc,
 };
 
-static struct omap_hwmod_irq_info omap2_sham_mpu_irqs[] = {
-       { .irq = 51 + OMAP_INTC_START, },
-       { .irq = -1 }
-};
-
-static struct omap_hwmod_dma_info omap2_sham_sdma_chs[] = {
-       { .name = "rx", .dma_req = 13 },
-       { .dma_req = -1 }
-};
-
 struct omap_hwmod omap2xxx_sham_hwmod = {
        .name           = "sham",
-       .mpu_irqs       = omap2_sham_mpu_irqs,
-       .sdma_reqs      = omap2_sham_sdma_chs,
        .main_clk       = "l4_ck",
        .prcm           = {
                .omap2 = {
@@ -927,15 +866,8 @@ static struct omap_hwmod_class omap2xxx_aes_class = {
        .sysc   = &omap2_aes_sysc,
 };
 
-static struct omap_hwmod_dma_info omap2_aes_sdma_chs[] = {
-       { .name = "tx", .dma_req = 9 },
-       { .name = "rx", .dma_req = 10 },
-       { .dma_req = -1 }
-};
-
 struct omap_hwmod omap2xxx_aes_hwmod = {
        .name           = "aes",
-       .sdma_reqs      = omap2_aes_sdma_chs,
        .main_clk       = "l4_ck",
        .prcm           = {
                .omap2 = {
index 6e04ff7065e11b0b84a520d40f50afd9a1ab3547..2c38c6b0ee034691faf75c1205be0bb6edcbb4e0 100644 (file)
@@ -18,9 +18,6 @@
 #include "common.h"
 #include "display.h"
 
-/* Common address space across OMAP2xxx */
-extern struct omap_hwmod_addr_space omap2xxx_mcbsp2_addrs[];
-
 /* Common address space across OMAP2xxx/3xxx */
 extern struct omap_hwmod_addr_space omap2_i2c1_addr_space[];
 extern struct omap_hwmod_addr_space omap2_i2c2_addr_space[];
@@ -41,8 +38,6 @@ extern struct omap_hwmod_addr_space omap2_mcbsp1_addrs[];
 extern struct omap_hwmod_addr_space omap2_hdq1w_addr_space[];
 
 /* Common IP block data across OMAP2xxx */
-extern struct omap_hwmod_irq_info omap2xxx_timer12_mpu_irqs[];
-extern struct omap_hwmod_dma_info omap2xxx_dss_sdma_chs[];
 extern struct omap_gpio_dev_attr omap2xxx_gpio_dev_attr;
 extern struct omap_hwmod omap2xxx_l3_main_hwmod;
 extern struct omap_hwmod omap2xxx_l4_core_hwmod;
index 39f020c982e8b3a41d547d9d45b60c46cb08877b..3d5b24dcd9a41e2b7f4c16052bc2d931de74a0e4 100644 (file)
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 #include <linux/clk.h>
+#include <linux/davinci_emac.h>
 #include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -16,6 +17,7 @@
 
 #include <linux/platform_data/pinctrl-single.h>
 
+#include "am35xx.h"
 #include "common.h"
 #include "common-board-devices.h"
 #include "dss-common.h"
@@ -26,6 +28,9 @@ struct pdata_init {
        void (*fn)(void);
 };
 
+struct of_dev_auxdata omap_auxdata_lookup[];
+static struct twl4030_gpio_platform_data twl_gpio_auxdata;
+
 /*
  * Create alias for USB host PHY clock.
  * Remove this when clock phandle can be provided via DT
@@ -68,6 +73,15 @@ static inline void legacy_init_wl12xx(unsigned ref_clock,
 }
 #endif
 
+#ifdef CONFIG_MACH_NOKIA_N8X0
+static void __init omap2420_n8x0_legacy_init(void)
+{
+       omap_auxdata_lookup[0].platform_data = n8x0_legacy_init();
+}
+#else
+#define omap2420_n8x0_legacy_init      NULL
+#endif
+
 #ifdef CONFIG_ARCH_OMAP3
 static void __init hsmmc2_internal_input_clk(void)
 {
@@ -78,6 +92,33 @@ static void __init hsmmc2_internal_input_clk(void)
        omap_ctrl_writel(reg, OMAP343X_CONTROL_DEVCONF1);
 }
 
+static int omap3_sbc_t3730_twl_callback(struct device *dev,
+                                          unsigned gpio,
+                                          unsigned ngpio)
+{
+       int res;
+
+       res = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
+                              "wlan rst");
+       if (res)
+               return res;
+
+       gpio_export(gpio, 0);
+
+       return 0;
+}
+
+static void __init omap3_sbc_t3730_twl_init(void)
+{
+       twl_gpio_auxdata.setup = omap3_sbc_t3730_twl_callback;
+}
+
+static void __init omap3_sbc_t3730_legacy_init(void)
+{
+       legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 136);
+       omap_ads7846_init(1, 57, 0, NULL);
+}
+
 static void __init omap3_igep0020_legacy_init(void)
 {
        omap3_igep2_display_init_of();
@@ -92,6 +133,42 @@ static void __init omap3_zoom_legacy_init(void)
 {
        legacy_init_wl12xx(WL12XX_REFCLOCK_26, 0, 162);
 }
+
+static void am35xx_enable_emac_int(void)
+{
+       u32 v;
+
+       v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
+       v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR |
+             AM35XX_CPGMAC_C0_MISC_PULSE_CLR | AM35XX_CPGMAC_C0_RX_THRESH_CLR);
+       omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
+       omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
+}
+
+static void am35xx_disable_emac_int(void)
+{
+       u32 v;
+
+       v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
+       v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR);
+       omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
+       omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
+}
+
+static struct emac_platform_data am35xx_emac_pdata = {
+       .interrupt_enable       = am35xx_enable_emac_int,
+       .interrupt_disable      = am35xx_disable_emac_int,
+};
+
+static void __init am3517_evm_legacy_init(void)
+{
+       u32 v;
+
+       v = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
+       v &= ~AM35XX_CPGMACSS_SW_RST;
+       omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET);
+       omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */
+}
 #endif /* CONFIG_ARCH_OMAP3 */
 
 #ifdef CONFIG_ARCH_OMAP4
@@ -125,10 +202,48 @@ void omap_pcs_legacy_init(int irq, void (*rearm)(void))
        pcs_pdata.rearm = rearm;
 }
 
+/*
+ * GPIOs for TWL are initialized by the I2C bus and need custom
+ * handing until DSS has device tree bindings.
+ */
+void omap_auxdata_legacy_init(struct device *dev)
+{
+       if (dev->platform_data)
+               return;
+
+       if (strcmp("twl4030-gpio", dev_name(dev)))
+               return;
+
+       dev->platform_data = &twl_gpio_auxdata;
+}
+
+/*
+ * Few boards still need auxdata populated before we populate
+ * the dev entries in of_platform_populate().
+ */
+static struct pdata_init auxdata_quirks[] __initdata = {
+#ifdef CONFIG_SOC_OMAP2420
+       { "nokia,n800", omap2420_n8x0_legacy_init, },
+       { "nokia,n810", omap2420_n8x0_legacy_init, },
+       { "nokia,n810-wimax", omap2420_n8x0_legacy_init, },
+#endif
+#ifdef CONFIG_ARCH_OMAP3
+       { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_twl_init, },
+#endif
+       { /* sentinel */ },
+};
+
 struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
+#ifdef CONFIG_MACH_NOKIA_N8X0
+       OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
+#endif
 #ifdef CONFIG_ARCH_OMAP3
        OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata),
        OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata),
+       /* Only on am3517 */
+       OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL),
+       OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0",
+                      &am35xx_emac_pdata),
 #endif
 #ifdef CONFIG_ARCH_OMAP4
        OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata),
@@ -137,14 +252,20 @@ struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
        { /* sentinel */ },
 };
 
+/*
+ * Few boards still need to initialize some legacy devices with
+ * platform data until the drivers support device tree.
+ */
 static struct pdata_init pdata_quirks[] __initdata = {
 #ifdef CONFIG_ARCH_OMAP3
+       { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, },
        { "nokia,omap3-n900", hsmmc2_internal_input_clk, },
        { "nokia,omap3-n9", hsmmc2_internal_input_clk, },
        { "nokia,omap3-n950", hsmmc2_internal_input_clk, },
        { "isee,omap3-igep0020", omap3_igep0020_legacy_init, },
        { "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
        { "ti,omap3-zoom3", omap3_zoom_legacy_init, },
+       { "ti,am3517-evm", am3517_evm_legacy_init, },
 #endif
 #ifdef CONFIG_ARCH_OMAP4
        { "ti,omap4-sdp", omap4_sdp_legacy_init, },
@@ -156,14 +277,8 @@ static struct pdata_init pdata_quirks[] __initdata = {
        { /* sentinel */ },
 };
 
-void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table)
+static void pdata_quirks_check(struct pdata_init *quirks)
 {
-       struct pdata_init *quirks = pdata_quirks;
-
-       omap_sdrc_init(NULL, NULL);
-       of_platform_populate(NULL, omap_dt_match_table,
-                            omap_auxdata_lookup, NULL);
-
        while (quirks->compatible) {
                if (of_machine_is_compatible(quirks->compatible)) {
                        if (quirks->fn)
@@ -173,3 +288,12 @@ void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table)
                quirks++;
        }
 }
+
+void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table)
+{
+       omap_sdrc_init(NULL, NULL);
+       pdata_quirks_check(auxdata_quirks);
+       of_platform_populate(NULL, omap_dt_match_table,
+                            omap_auxdata_lookup, NULL);
+       pdata_quirks_check(pdata_quirks);
+}
index 3ca81e0ada5e228e083ed591f0976174e2e6b972..ec084d158f642b3cf919adbbb0c6fd97e64f6317 100644 (file)
@@ -379,7 +379,7 @@ static struct clocksource clocksource_gpt = {
        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
-static u32 notrace dmtimer_read_sched_clock(void)
+static u64 notrace dmtimer_read_sched_clock(void)
 {
        if (clksrc.reserved)
                return __omap_dm_timer_read_counter(&clksrc,
@@ -471,7 +471,7 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id,
        __omap_dm_timer_load_start(&clksrc,
                                   OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0,
                                   OMAP_TIMER_NONPOSTED);
-       setup_sched_clock(dmtimer_read_sched_clock, 32, clksrc.rate);
+       sched_clock_register(dmtimer_read_sched_clock, 32, clksrc.rate);
 
        if (clocksource_register_hz(&clocksource_gpt, clksrc.rate))
                pr_err("Could not register clocksource %s\n",
index b91002ca92f3b42b6a04f54683daa4f2504e5c2a..c134a826070a14ccadda4293181f27cf81278804 100644 (file)
@@ -21,7 +21,7 @@
 #include <plat/irq.h>
 #include "common.h"
 
-struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = {
+static struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
        OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
                       NULL),
index 91a5852b44f3a8fe09d0815009ff54329b23c582..3f1de1111e0f207e4a0dbd5d66208d2054f1a810 100644 (file)
@@ -24,7 +24,6 @@
 #include <asm/page.h>
 #include <asm/setup.h>
 #include <asm/system_misc.h>
-#include <asm/timex.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
@@ -135,7 +134,7 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
 /*****************************************************************************
  * SPI
  ****************************************************************************/
-void __init orion5x_spi_init()
+void __init orion5x_spi_init(void)
 {
        orion_spi_init(SPI_PHYS_BASE);
 }
@@ -185,7 +184,7 @@ static void __init orion5x_crypto_init(void)
 /*****************************************************************************
  * Watchdog
  ****************************************************************************/
-void __init orion5x_wdt_init(void)
+static void __init orion5x_wdt_init(void)
 {
        orion_wdt_init();
 }
@@ -246,7 +245,7 @@ void orion5x_setup_wins(void)
 
 int orion5x_tclk;
 
-int __init orion5x_find_tclk(void)
+static int __init orion5x_find_tclk(void)
 {
        u32 dev, rev;
 
index 4b2aefd1d96180e7a3e5962a72c907734a136539..dc01c4ffc9a8d090ad8d7691ffedf9588cdd2414 100644 (file)
@@ -202,7 +202,7 @@ __initcall(db88f5281_7seg_init);
  * PCI
  ****************************************************************************/
 
-void __init db88f5281_pci_preinit(void)
+static void __init db88f5281_pci_preinit(void)
 {
        int pin;
 
index 30a192b9c51730da9dfb94ccdf93128ceb8143de..9654b0cc58928741c13281eaf7c6b737411dd7ec 100644 (file)
@@ -16,6 +16,7 @@
 #include <mach/bridge-regs.h>
 #include <plat/orion-gpio.h>
 #include <plat/irq.h>
+#include "common.h"
 
 static int __initdata gpio0_irqs[4] = {
        IRQ_ORION5X_GPIO_0_7,
index 7fab6705303073ab9b6cdb1dbf6cae17a0840390..87a12d6930ffc4525a1a1335789162711968e4fe 100644 (file)
@@ -240,11 +240,11 @@ static int __init pcie_setup(struct pci_sys_data *sys)
 #define PCI_BAR_SIZE_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc08) : \
                                 ((n) == 1) ? ORION5X_PCI_REG(0xd08) : \
                                 ((n) == 2) ? ORION5X_PCI_REG(0xc0c) : \
-                                ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : 0)
+                                ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : NULL)
 #define PCI_BAR_REMAP_DDR_CS(n)        (((n) == 0) ? ORION5X_PCI_REG(0xc48) : \
                                 ((n) == 1) ? ORION5X_PCI_REG(0xd48) : \
                                 ((n) == 2) ? ORION5X_PCI_REG(0xc4c) : \
-                                ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : 0)
+                                ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : NULL)
 #define PCI_BAR_ENABLE         ORION5X_PCI_REG(0xc3c)
 #define PCI_ADDR_DECODE_CTRL   ORION5X_PCI_REG(0xd3c)
 
index b1cf68493ffc35666b357d61242fafd01097b97d..b576ef5f18a16a777fd7948995d10d047a82eafe 100644 (file)
@@ -108,7 +108,7 @@ static struct platform_device rd88f5182_gpio_leds = {
  * PCI
  ****************************************************************************/
 
-void __init rd88f5182_pci_preinit(void)
+static void __init rd88f5182_pci_preinit(void)
 {
        int pin;
 
index 7e90648446980995bf00778342d1d2e57d546850..6208d125c1b946602ce12977ca45607a264685f6 100644 (file)
@@ -77,7 +77,7 @@ static struct platform_device tsp2_nor_flash = {
 #define TSP2_PCI_SLOT0_OFFS            7
 #define TSP2_PCI_SLOT0_IRQ_PIN         11
 
-void __init tsp2_pci_preinit(void)
+static void __init tsp2_pci_preinit(void)
 {
        int pin;
 
index e90c0618fdad5cb7cefe722639310811703b186d..9136797addb271816579c78505bd06630397d4d4 100644 (file)
@@ -106,7 +106,7 @@ static struct platform_device qnap_ts209_nor_flash = {
 #define QNAP_TS209_PCI_SLOT0_IRQ_PIN   6
 #define QNAP_TS209_PCI_SLOT1_IRQ_PIN   7
 
-void __init qnap_ts209_pci_preinit(void)
+static void __init qnap_ts209_pci_preinit(void)
 {
        int pin;
 
index e960855d32ac30b75e6a328181be3cbe8fed9535..db16dae441e252607bcb2d13f6e172b7410cc19d 100644 (file)
@@ -57,7 +57,7 @@ static struct map_desc ts78xx_io_desc[] __initdata = {
        },
 };
 
-void __init ts78xx_map_io(void)
+static void __init ts78xx_map_io(void)
 {
        orion5x_map_io();
        iotable_init(ts78xx_io_desc, ARRAY_SIZE(ts78xx_io_desc));
index 3dbcb1ab6e37e5ea5eeedcc05c27e45b9e14ac2b..e358b0736dea464fbf56d3a0e59858daf7998bfe 100644 (file)
@@ -106,8 +106,7 @@ static int sirfsoc_boot_secondary(unsigned int cpu, struct task_struct *idle)
         * "cpu" is Linux's internal ID.
         */
        pen_release = cpu_logical_map(cpu);
-       __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
-       outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
+       sync_cache_w(&pen_release);
 
        /*
         * Send the secondary CPU SEV, thereby causing the boot monitor to read
index ffa6d811aad87f9febe4f4da663f40d2005203f1..12fb0f4ae359a284bf6a886b897a533a4f784694 100644 (file)
@@ -293,8 +293,7 @@ static int am200_setup_irq(struct fb_info *info)
        int ret;
 
        ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am200_handle_irq,
-                               IRQF_DISABLED|IRQF_TRIGGER_FALLING,
-                               "AM200", info->par);
+                               IRQF_TRIGGER_FALLING, "AM200", info->par);
        if (ret)
                dev_err(&am200_device->dev, "request_irq failed: %d\n", ret);
 
index 3dfec1ec462d68e6b1ed97d5daf594224e0e5af0..c9f309ae88c5b57d0ecf60ac8025d704df37bdc2 100644 (file)
@@ -241,8 +241,7 @@ static int am300_setup_irq(struct fb_info *info)
        struct broadsheetfb_par *par = info->par;
 
        ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am300_handle_irq,
-                               IRQF_DISABLED|IRQF_TRIGGER_RISING,
-                               "AM300", par);
+                               IRQF_TRIGGER_RISING, "AM300", par);
        if (ret)
                dev_err(&am300_device->dev, "request_irq failed: %d\n", ret);
 
index 8eb4e23c561d2569c1ede0e00dac6ecc402815c4..6915a9f6b3a32b11370841095c81627231ff55c6 100644 (file)
@@ -564,8 +564,7 @@ static int em_x270_mci_init(struct device *dev,
        }
 
        err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int,
-                             IRQF_DISABLED | IRQF_TRIGGER_RISING |
-                             IRQF_TRIGGER_FALLING,
+                             IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
                              "MMC card detect", data);
        if (err) {
                dev_err(dev, "can't request MMC card detect IRQ: %d\n", err);
index b6cc1816463e57570622b2fbd59f0092647cb980..0eecd83c624e3d98573d542efb834e7371cffc00 100644 (file)
@@ -235,8 +235,6 @@ static const struct of_device_id intc_ids[] __initconst = {
 void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int))
 {
        struct device_node *node;
-       const struct of_device_id *of_id;
-       struct pxa_intc_conf *conf;
        struct resource res;
        int n, ret;
 
@@ -245,8 +243,6 @@ void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int))
                pr_err("Failed to find interrupt controller in arch-pxa\n");
                return;
        }
-       of_id = of_match_node(intc_ids, node);
-       conf = of_id->data;
 
        ret = of_property_read_u32(node, "marvell,intc-nr-irqs",
                                   &pxa_internal_irq_nr);
index fab30d666cc72534493839521324a577a40e5a54..a9761c293028cebd348fbf7e43facdf34b166376 100644 (file)
@@ -634,7 +634,7 @@ static struct platform_device bq24022 = {
 static int magician_mci_init(struct device *dev,
                                irq_handler_t detect_irq, void *data)
 {
-       return request_irq(IRQ_MAGICIAN_SD, detect_irq, IRQF_DISABLED,
+       return request_irq(IRQ_MAGICIAN_SD, detect_irq, 0,
                           "mmc card detect", data);
 }
 
index 08ccc0718f319e4f7209e8592e50d0f26b92862d..78b84c0dfc79e63f173e3d299ea397d59bcf2115 100644 (file)
@@ -401,7 +401,7 @@ static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_in
         */
        MST_MSCWR1 &= ~MST_MSCWR1_MS_SEL;
 
-       err = request_irq(MAINSTONE_MMC_IRQ, mstone_detect_int, IRQF_DISABLED,
+       err = request_irq(MAINSTONE_MMC_IRQ, mstone_detect_int, 0,
                             "MMC card detect", data);
        if (err)
                printk(KERN_ERR "mainstone_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
index 9a4e470f162bc0fc2403a1985e25d0cfd5bd2018..2897da2a5df6e69b7d6d330f2685eeedc4e09733 100644 (file)
@@ -327,7 +327,7 @@ static int pcm990_mci_init(struct device *dev, irq_handler_t mci_detect_int,
 {
        int err;
 
-       err = request_irq(PCM027_MMCDET_IRQ, mci_detect_int, IRQF_DISABLED,
+       err = request_irq(PCM027_MMCDET_IRQ, mci_detect_int, 0,
                             "MMC card detect", data);
        if (err)
                printk(KERN_ERR "pcm990_mci_init: MMC/SD: can't request MMC "
index 0a36d3585f26822191e7355c9d2e4208c77fcaff..051a6555cbf9ebfae29c4dbe88c3b13c047fbd77 100644 (file)
@@ -860,18 +860,18 @@ static int sharpsl_pm_probe(struct platform_device *pdev)
 
        /* Register interrupt handlers */
        irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_acin);
-       if (request_irq(irq, sharpsl_ac_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) {
+       if (request_irq(irq, sharpsl_ac_isr, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) {
                dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq);
        }
 
        irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_batlock);
-       if (request_irq(irq, sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) {
+       if (request_irq(irq, sharpsl_fatal_isr, IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) {
                dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq);
        }
 
        if (sharpsl_pm.machinfo->gpio_fatal) {
                irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_fatal);
-               if (request_irq(irq, sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) {
+               if (request_irq(irq, sharpsl_fatal_isr, IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) {
                        dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq);
                }
        }
@@ -879,7 +879,7 @@ static int sharpsl_pm_probe(struct platform_device *pdev)
        if (sharpsl_pm.machinfo->batfull_irq) {
                /* Register interrupt handler. */
                irq = gpio_to_irq(sharpsl_pm.machinfo->gpio_batfull);
-               if (request_irq(irq, sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) {
+               if (request_irq(irq, sharpsl_chrg_full_isr, IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) {
                        dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", irq);
                }
        }
index 9aa852a8fab9f2c7784003764086cd9d1af8dc2e..fca174e3865d692f91715459131f8508c707ff01 100644 (file)
@@ -33,7 +33,7 @@
  * calls to sched_clock() which should always be the case in practice.
  */
 
-static u32 notrace pxa_read_sched_clock(void)
+static u64 notrace pxa_read_sched_clock(void)
 {
        return readl_relaxed(OSCR);
 }
@@ -137,7 +137,7 @@ static struct clock_event_device ckevt_pxa_osmr0 = {
 
 static struct irqaction pxa_ost0_irq = {
        .name           = "ost0",
-       .flags          = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
+       .flags          = IRQF_TIMER | IRQF_IRQPOLL,
        .handler        = pxa_ost0_interrupt,
        .dev_id         = &ckevt_pxa_osmr0,
 };
@@ -149,7 +149,7 @@ void __init pxa_timer_init(void)
        writel_relaxed(0, OIER);
        writel_relaxed(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR);
 
-       setup_sched_clock(pxa_read_sched_clock, 32, clock_tick_rate);
+       sched_clock_register(pxa_read_sched_clock, 32, clock_tick_rate);
 
        ckevt_pxa_osmr0.cpumask = cpumask_of(0);
 
index c58043462acddc932ce7b1728488aa1eb290f361..872dcb20e75784710000bb7d409407be269e2bd3 100644 (file)
@@ -332,8 +332,7 @@ static int trizeps4_mci_init(struct device *dev, irq_handler_t mci_detect_int,
        int err;
 
        err = request_irq(TRIZEPS4_MMC_IRQ, mci_detect_int,
-                         IRQF_DISABLED | IRQF_TRIGGER_RISING,
-                         "MMC card detect", data);
+                         IRQF_TRIGGER_RISING, "MMC card detect", data);
        if (err) {
                printk(KERN_ERR "trizeps4_mci_init: MMC/SD: can't request"
                                                "MMC card detect IRQ\n");
index 4a65cba3295d69ce0bcec9168307f81dfa36fc09..a8dafc174fe3815479ae9572e008d8cb16f2d139 100644 (file)
@@ -742,7 +742,7 @@ int s3c2410_dma_request(enum dma_ch channel,
                chan->irq_claimed = 1;
                local_irq_restore(flags);
 
-               err = request_irq(chan->irq, s3c2410_dma_irq, IRQF_DISABLED,
+               err = request_irq(chan->irq, s3c2410_dma_irq, 0,
                                  client->name, (void *)chan);
 
                local_irq_save(flags);
index 8dea917e954b83cb993491741ccea391befe52d3..b70aa66efebea9246159155ffbcf5ea2782c30af 100644 (file)
@@ -79,8 +79,7 @@ static void usb_simtec_enableoc(struct s3c2410_hcd_info *info, int on)
 
        if (on) {
                ret = request_irq(BAST_IRQ_USBOC, usb_simtec_ocirq,
-                                 IRQF_DISABLED | IRQF_TRIGGER_RISING |
-                                  IRQF_TRIGGER_FALLING,
+                                 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
                                  "USB Over-current", info);
                if (ret != 0) {
                        printk(KERN_ERR "failed to request usb oc irq\n");
index 8c84d3448dac2c8820e2a46a961fb07e4671c7e4..8d553a418e1c9076898878d0a8039f5597804112 100644 (file)
@@ -37,7 +37,9 @@
 #include <plat/devs.h>
 #include <plat/fb.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/mmc-sdhci-s3c.h>
 #include <plat/regs-serial.h>
+#include <plat/sdhci.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
 
 #include <video/platform_lcd.h>
@@ -215,6 +217,13 @@ static struct platform_device mini6410_lcd_powerdev = {
        .dev.platform_data      = &mini6410_lcd_power_data,
 };
 
+static struct s3c_sdhci_platdata mini6410_hsmmc1_pdata = {
+       .max_width              = 4,
+       .cd_type                = S3C_SDHCI_CD_GPIO,
+       .ext_cd_gpio            = S3C64XX_GPN(10),
+       .ext_cd_gpio_invert     = true,
+};
+
 static struct platform_device *mini6410_devices[] __initdata = {
        &mini6410_device_eth,
        &s3c_device_hsmmc0,
@@ -322,6 +331,7 @@ static void __init mini6410_machine_init(void)
 
        s3c_nand_set_platdata(&mini6410_nand_info);
        s3c_fb_set_platdata(&mini6410_lcd_pdata[features.lcd_index]);
+       s3c_sdhci1_set_platdata(&mini6410_hsmmc1_pdata);
        s3c24xx_ts_set_platdata(NULL);
 
        /* configure nCS1 width to 16 bits */
index 5629df905fcdac2f422013f263dd97f65ffe4338..6e72bd5c1d0cc934232ea27d8953a5da8048ecf1 100644 (file)
@@ -107,7 +107,7 @@ static void smartq_usb_host_enableoc(struct s3c2410_hcd_info *info, int on)
 
        if (on) {
                ret = request_irq(gpio_to_irq(S3C64XX_GPL(10)),
-                                 smartq_usb_host_ocirq, IRQF_DISABLED |
+                                 smartq_usb_host_ocirq,
                                  IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
                                  "USB host overcurrent", info);
                if (ret != 0)
index c9808c6841526204144e36a273596e6955696dc8..8443a27bca2f1cd6f66e476440c6503f38901cb1 100644 (file)
@@ -75,12 +75,143 @@ void ASSABET_BCR_frob(unsigned int mask, unsigned int val)
 
 EXPORT_SYMBOL(ASSABET_BCR_frob);
 
+/*
+ * The codec reset goes to three devices, so we need to release
+ * the rest when any one of these requests it.  However, that
+ * causes the ADV7171 to consume around 100mA - more than half
+ * the LCD-blanked power.
+ *
+ * With the ADV7171, LCD and backlight enabled, we go over
+ * budget on the MAX846 Li-Ion charger, and if no Li-Ion battery
+ * is connected, the Assabet crashes.
+ */
+#define RST_UCB1X00 (1 << 0)
+#define RST_UDA1341 (1 << 1)
+#define RST_ADV7171 (1 << 2)
+
+#define SDA GPIO_GPIO(15)
+#define SCK GPIO_GPIO(18)
+#define MOD GPIO_GPIO(17)
+
+static void adv7171_start(void)
+{
+       GPSR = SCK;
+       udelay(1);
+       GPSR = SDA;
+       udelay(2);
+       GPCR = SDA;
+}
+
+static void adv7171_stop(void)
+{
+       GPSR = SCK;
+       udelay(2);
+       GPSR = SDA;
+       udelay(1);
+}
+
+static void adv7171_send(unsigned byte)
+{
+       unsigned i;
+
+       for (i = 0; i < 8; i++, byte <<= 1) {
+               GPCR = SCK;
+               udelay(1);
+               if (byte & 0x80)
+                       GPSR = SDA;
+               else
+                       GPCR = SDA;
+               udelay(1);
+               GPSR = SCK;
+               udelay(1);
+       }
+       GPCR = SCK;
+       udelay(1);
+       GPSR = SDA;
+       udelay(1);
+       GPDR &= ~SDA;
+       GPSR = SCK;
+       udelay(1);
+       if (GPLR & SDA)
+               printk(KERN_WARNING "No ACK from ADV7171\n");
+       udelay(1);
+       GPCR = SCK | SDA;
+       udelay(1);
+       GPDR |= SDA;
+       udelay(1);
+}
+
+static void adv7171_write(unsigned reg, unsigned val)
+{
+       unsigned gpdr = GPDR;
+       unsigned gplr = GPLR;
+
+       ASSABET_BCR = BCR_value | ASSABET_BCR_AUDIO_ON;
+       udelay(100);
+
+       GPCR = SDA | SCK | MOD; /* clear L3 mode to ensure UDA1341 doesn't respond */
+       GPDR = (GPDR | SCK | MOD) & ~SDA;
+       udelay(10);
+       if (!(GPLR & SDA))
+               printk(KERN_WARNING "Something dragging SDA down?\n");
+       GPDR |= SDA;
+
+       adv7171_start();
+       adv7171_send(0x54);
+       adv7171_send(reg);
+       adv7171_send(val);
+       adv7171_stop();
+
+       /* Restore GPIO state for L3 bus */
+       GPSR = gplr & (SDA | SCK | MOD);
+       GPCR = (~gplr) & (SDA | SCK | MOD);
+       GPDR = gpdr;
+}
+
+static void adv7171_sleep(void)
+{
+       /* Put the ADV7171 into sleep mode */
+       adv7171_write(0x04, 0x40);
+}
+
+static unsigned codec_nreset;
+
+static void assabet_codec_reset(unsigned mask, int set)
+{
+       unsigned long flags;
+       bool old;
+
+       local_irq_save(flags);
+       old = !codec_nreset;
+       if (set)
+               codec_nreset &= ~mask;
+       else
+               codec_nreset |= mask;
+
+       if (old != !codec_nreset) {
+               if (codec_nreset) {
+                       ASSABET_BCR_set(ASSABET_BCR_NCODEC_RST);
+                       adv7171_sleep();
+               } else {
+                       ASSABET_BCR_clear(ASSABET_BCR_NCODEC_RST);
+               }
+       }
+       local_irq_restore(flags);
+}
+
 static void assabet_ucb1x00_reset(enum ucb1x00_reset state)
 {
-       if (state == UCB_RST_PROBE)
-               ASSABET_BCR_set(ASSABET_BCR_CODEC_RST);
+       int set = state == UCB_RST_REMOVE || state == UCB_RST_SUSPEND ||
+               state == UCB_RST_PROBE_FAIL;
+       assabet_codec_reset(RST_UCB1X00, set);
 }
 
+void assabet_uda1341_reset(int set)
+{
+       assabet_codec_reset(RST_UDA1341, set);
+}
+EXPORT_SYMBOL(assabet_uda1341_reset);
+
 
 /*
  * Assabet flash support code.
@@ -155,12 +286,9 @@ static int assabet_irda_set_power(struct device *dev, unsigned int state)
                0
        };
 
-       if (state < 4) {
-               state = bcr_state[state];
-               ASSABET_BCR_clear(state ^ (ASSABET_BCR_IRDA_MD1|
-                                          ASSABET_BCR_IRDA_MD0));
-               ASSABET_BCR_set(state);
-       }
+       if (state < 4)
+               ASSABET_BCR_frob(ASSABET_BCR_IRDA_MD1 | ASSABET_BCR_IRDA_MD0,
+                                bcr_state[state]);
        return 0;
 }
 
@@ -180,6 +308,7 @@ static struct irda_platform_data assabet_irda_data = {
 static struct ucb1x00_plat_data assabet_ucb1x00_data = {
        .reset          = assabet_ucb1x00_reset,
        .gpio_base      = -1,
+       .can_wakeup     = 1,
 };
 
 static struct mcp_plat_data assabet_mcp_data = {
index 7fb96ebdc0fbc74d37b1122fe0462026031a8889..831a15824ec8c5eeed1f4b215a13f2bdcfb3f9c7 100644 (file)
@@ -27,6 +27,8 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/timer.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
 #include <linux/gpio.h>
 #include <linux/pda_power.h>
 
@@ -242,10 +244,43 @@ struct platform_device collie_locomo_device = {
        .resource       = locomo_resources,
 };
 
+static struct gpio_keys_button collie_gpio_keys[] = {
+       {
+               .type   = EV_PWR,
+               .code   = KEY_RESERVED,
+               .gpio   = COLLIE_GPIO_ON_KEY,
+               .desc   = "On key",
+               .wakeup = 1,
+               .active_low = 1,
+       },
+       {
+               .type   = EV_PWR,
+               .code   = KEY_WAKEUP,
+               .gpio   = COLLIE_GPIO_WAKEUP,
+               .desc   = "Sync",
+               .wakeup = 1,
+               .active_low = 1,
+       },
+};
+
+static struct gpio_keys_platform_data collie_gpio_keys_data = {
+       .buttons        = collie_gpio_keys,
+       .nbuttons       = ARRAY_SIZE(collie_gpio_keys),
+};
+
+static struct platform_device collie_gpio_keys_device = {
+       .name   = "gpio-keys",
+       .id     = -1,
+       .dev    = {
+               .platform_data = &collie_gpio_keys_data,
+       },
+};
+
 static struct platform_device *devices[] __initdata = {
        &collie_locomo_device,
        &colliescoop_device,
        &collie_power_device,
+       &collie_gpio_keys_device,
 };
 
 static struct mtd_partition collie_partitions[] = {
index b8f2b151539bd96358824f000fe597f0d0cb894c..daa27c474c133c460c7515fca129c5742d8c1d03 100644 (file)
 /*
  * helper for sa1100fb
  */
+static struct gpio h3100_lcd_gpio[] = {
+       { H3100_GPIO_LCD_3V_ON, GPIOF_OUT_INIT_LOW, "LCD 3V" },
+       { H3XXX_EGPIO_LCD_ON, GPIOF_OUT_INIT_LOW, "LCD ON" },
+};
+
+static bool h3100_lcd_request(void)
+{
+       static bool h3100_lcd_ok;
+       int rc;
+
+       if (h3100_lcd_ok)
+               return true;
+
+       rc = gpio_request_array(h3100_lcd_gpio, ARRAY_SIZE(h3100_lcd_gpio));
+       if (rc)
+               pr_err("%s: can't request GPIOs\n", __func__);
+       else
+               h3100_lcd_ok = true;
+
+       return h3100_lcd_ok;
+}
+
 static void h3100_lcd_power(int enable)
 {
-       if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) {
-               gpio_set_value(H3100_GPIO_LCD_3V_ON, enable);
-               gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
-               gpio_free(H3XXX_EGPIO_LCD_ON);
-       } else {
-               pr_err("%s: can't request H3XXX_EGPIO_LCD_ON\n", __func__);
-       }
+       if (!h3100_lcd_request())
+               return;
+
+       gpio_set_value(H3100_GPIO_LCD_3V_ON, enable);
+       gpio_set_value(H3XXX_EGPIO_LCD_ON, enable);
 }
 
 static struct sa1100fb_mach_info h3100_lcd_info = {
@@ -69,6 +89,11 @@ static void __init h3100_map_io(void)
 /*
  * This turns the IRDA power on or off on the Compaq H3100
  */
+static struct gpio h3100_irda_gpio[] = {
+       { H3100_GPIO_IR_ON,     GPIOF_OUT_INIT_LOW, "IrDA power" },
+       { H3100_GPIO_IR_FSEL,   GPIOF_OUT_INIT_LOW, "IrDA fsel" },
+};
+
 static int h3100_irda_set_power(struct device *dev, unsigned int state)
 {
        gpio_set_value(H3100_GPIO_IR_ON, state);
@@ -80,18 +105,27 @@ static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
        gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
 }
 
+static int h3100_irda_startup(struct device *dev)
+{
+       return gpio_request_array(h3100_irda_gpio, sizeof(h3100_irda_gpio));
+}
+
+static void h3100_irda_shutdown(struct device *dev)
+{
+       return gpio_free_array(h3100_irda_gpio, sizeof(h3100_irda_gpio));
+}
+
 static struct irda_platform_data h3100_irda_data = {
        .set_power      = h3100_irda_set_power,
        .set_speed      = h3100_irda_set_speed,
+       .startup        = h3100_irda_startup,
+       .shutdown       = h3100_irda_shutdown,
 };
 
 static struct gpio_default_state h3100_default_gpio[] = {
-       { H3100_GPIO_IR_ON,     GPIO_MODE_OUT0, "IrDA power" },
-       { H3100_GPIO_IR_FSEL,   GPIO_MODE_OUT0, "IrDA fsel" },
        { H3XXX_GPIO_COM_DCD,   GPIO_MODE_IN,   "COM DCD" },
        { H3XXX_GPIO_COM_CTS,   GPIO_MODE_IN,   "COM CTS" },
        { H3XXX_GPIO_COM_RTS,   GPIO_MODE_OUT0, "COM RTS" },
-       { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" },
 };
 
 static void __init h3100_mach_init(void)
index b8dc5bd2262388d8dd56c20756ce5acd03e35b83..a663e723014142e2fb5fabfb81508e310e0c4c52 100644 (file)
 /*
  * helper for sa1100fb
  */
+static struct gpio h3600_lcd_gpio[] = {
+       { H3XXX_EGPIO_LCD_ON,   GPIOF_OUT_INIT_LOW,     "LCD power" },
+       { H3600_EGPIO_LCD_PCI,  GPIOF_OUT_INIT_LOW,     "LCD control" },
+       { H3600_EGPIO_LCD_5V_ON, GPIOF_OUT_INIT_LOW,    "LCD 5v" },
+       { H3600_EGPIO_LVDD_ON,  GPIOF_OUT_INIT_LOW,     "LCD 9v/-6.5v" },
+};
+
+static bool h3600_lcd_request(void)
+{
+       static bool h3600_lcd_ok;
+       int rc;
+
+       if (h3600_lcd_ok)
+               return true;
+
+       rc = gpio_request_array(h3600_lcd_gpio, ARRAY_SIZE(h3600_lcd_gpio));
+       if (rc)
+               pr_err("%s: can't request GPIOs\n", __func__);
+       else
+               h3600_lcd_ok = true;
+
+       return h3600_lcd_ok;
+}
+
 static void h3600_lcd_power(int enable)
 {
-       if (gpio_request(H3XXX_EGPIO_LCD_ON, "LCD power")) {
-               pr_err("%s: can't request H3XXX_EGPIO_LCD_ON\n", __func__);
-               goto err1;
-       }
-       if (gpio_request(H3600_EGPIO_LCD_PCI, "LCD control")) {
-               pr_err("%s: can't request H3XXX_EGPIO_LCD_PCI\n", __func__);
-               goto err2;
-       }
-       if (gpio_request(H3600_EGPIO_LCD_5V_ON, "LCD 5v")) {
-               pr_err("%s: can't request H3XXX_EGPIO_LCD_5V_ON\n", __func__);
-               goto err3;
-       }
-       if (gpio_request(H3600_EGPIO_LVDD_ON, "LCD 9v/-6.5v")) {
-               pr_err("%s: can't request H3600_EGPIO_LVDD_ON\n", __func__);
-               goto err4;
-       }
+       if (!h3600_lcd_request())
+               return;
 
        gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
        gpio_direction_output(H3600_EGPIO_LCD_PCI, enable);
        gpio_direction_output(H3600_EGPIO_LCD_5V_ON, enable);
        gpio_direction_output(H3600_EGPIO_LVDD_ON, enable);
-
-       gpio_free(H3600_EGPIO_LVDD_ON);
-err4:  gpio_free(H3600_EGPIO_LCD_5V_ON);
-err3:  gpio_free(H3600_EGPIO_LCD_PCI);
-err2:  gpio_free(H3XXX_EGPIO_LCD_ON);
-err1:  return;
 }
 
 static const struct sa1100fb_rgb h3600_rgb_16 = {
@@ -93,6 +97,11 @@ static void __init h3600_map_io(void)
 /*
  * This turns the IRDA power on or off on the Compaq H3600
  */
+static struct gpio h3600_irda_gpio[] = {
+       { H3600_EGPIO_IR_ON,    GPIOF_OUT_INIT_LOW, "IrDA power" },
+       { H3600_EGPIO_IR_FSEL,  GPIOF_OUT_INIT_LOW, "IrDA fsel" },
+};
+
 static int h3600_irda_set_power(struct device *dev, unsigned int state)
 {
        gpio_set_value(H3600_EGPIO_IR_ON, state);
@@ -106,29 +115,12 @@ static void h3600_irda_set_speed(struct device *dev, unsigned int speed)
 
 static int h3600_irda_startup(struct device *dev)
 {
-       int err = gpio_request(H3600_EGPIO_IR_ON, "IrDA power");
-       if (err)
-               goto err1;
-       err = gpio_direction_output(H3600_EGPIO_IR_ON, 0);
-       if (err)
-               goto err2;
-       err = gpio_request(H3600_EGPIO_IR_FSEL, "IrDA fsel");
-       if (err)
-               goto err2;
-       err = gpio_direction_output(H3600_EGPIO_IR_FSEL, 0);
-       if (err)
-               goto err3;
-       return 0;
-
-err3:  gpio_free(H3600_EGPIO_IR_FSEL);
-err2:  gpio_free(H3600_EGPIO_IR_ON);
-err1:  return err;
+       return gpio_request_array(h3600_irda_gpio, sizeof(h3600_irda_gpio));
 }
 
 static void h3600_irda_shutdown(struct device *dev)
 {
-       gpio_free(H3600_EGPIO_IR_ON);
-       gpio_free(H3600_EGPIO_IR_FSEL);
+       return gpio_free_array(h3600_irda_gpio, sizeof(h3600_irda_gpio));
 }
 
 static struct irda_platform_data h3600_irda_data = {
index 307391488c22607c617d7931ed7867c3bdcd185d..c23fcdb047a5de3ea2260198ec6565a39626e059 100644 (file)
@@ -39,8 +39,8 @@ extern unsigned long SCR_value;
 
 #define ASSABET_BCR_CF_PWR     (1<<0)  /* Compact Flash Power (1 = 3.3v, 0 = off) */
 #define ASSABET_BCR_CF_RST     (1<<1)  /* Compact Flash Reset (1 = power up reset) */
-#define ASSABET_BCR_GFX_RST    (1<<1)  /* Graphics Accelerator Reset (0 = hold reset) */
-#define ASSABET_BCR_CODEC_RST  (1<<2)  /* 0 = Holds UCB1300, ADI7171, and UDA1341 in reset */
+#define ASSABET_BCR_NGFX_RST   (1<<1)  /* Graphics Accelerator Reset (0 = hold reset) */
+#define ASSABET_BCR_NCODEC_RST (1<<2)  /* 0 = Holds UCB1300, ADI7171, and UDA1341 in reset */
 #define ASSABET_BCR_IRDA_FSEL  (1<<3)  /* IRDA Frequency select (0 = SIR, 1 = MIR/ FIR) */
 #define ASSABET_BCR_IRDA_MD0   (1<<4)  /* Range/Power select */
 #define ASSABET_BCR_IRDA_MD1   (1<<5)  /* Range/Power select */
@@ -69,6 +69,8 @@ extern void ASSABET_BCR_frob(unsigned int mask, unsigned int set);
 #define ASSABET_BCR_frob(x,y)  do { } while (0)
 #endif
 
+extern void assabet_uda1341_reset(int set);
+
 #define ASSABET_BCR_set(x)     ASSABET_BCR_frob((x), (x))
 #define ASSABET_BCR_clear(x)   ASSABET_BCR_frob((x), 0)
 
index 713c86cd3d640ab758b723da8e4abd4ee6bf85c6..6fd4acb8f18713b204e45d2c8a32f8854b061ae9 100644 (file)
@@ -20,7 +20,7 @@
 #include <mach/hardware.h>
 #include <mach/irqs.h>
 
-static u32 notrace sa1100_read_sched_clock(void)
+static u64 notrace sa1100_read_sched_clock(void)
 {
        return readl_relaxed(OSCR);
 }
@@ -122,7 +122,7 @@ void __init sa1100_timer_init(void)
        writel_relaxed(0, OIER);
        writel_relaxed(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR);
 
-       setup_sched_clock(sa1100_read_sched_clock, 32, 3686400);
+       sched_clock_register(sa1100_read_sched_clock, 32, 3686400);
 
        ckevt_sa1100_osmr0.cpumask = cpumask_of(0);
 
index a4a4b75109b218c53fc2cb8357f2465fb90b18d7..338640631e08234ebcab2a5616dec8240e68aed8 100644 (file)
@@ -1,6 +1,10 @@
+config ARCH_SHMOBILE
+       bool
+
 config ARCH_SHMOBILE_MULTI
-       bool "SH-Mobile Series" if ARCH_MULTI_V7
+       bool "Renesas ARM SoCs" if ARCH_MULTI_V7
        depends on MMU
+       select ARCH_SHMOBILE
        select CPU_V7
        select GENERIC_CLOCKEVENTS
        select HAVE_ARM_SCU if SMP
@@ -8,6 +12,7 @@ config ARCH_SHMOBILE_MULTI
        select HAVE_SMP
        select ARM_GIC
        select MIGHT_HAVE_CACHE_L2X0
+       select MIGHT_HAVE_PCI
        select NO_IOPORT
        select PINCTRL
        select ARCH_REQUIRE_GPIOLIB
@@ -15,24 +20,47 @@ config ARCH_SHMOBILE_MULTI
 
 if ARCH_SHMOBILE_MULTI
 
-comment "SH-Mobile System Type"
+comment "Renesas ARM SoCs System Type"
 
 config ARCH_EMEV2
        bool "Emma Mobile EV2"
 
-comment "SH-Mobile Board Type"
+config ARCH_R7S72100
+       bool "RZ/A1H (R7S72100)"
+
+config ARCH_R8A7790
+       bool "R-Car H2 (R8A77900)"
+       select RENESAS_IRQC
+
+config ARCH_R8A7791
+       bool "R-Car M2 (R8A77910)"
+       select RENESAS_IRQC
+
+comment "Renesas ARM SoCs Board Type"
+
+config MACH_GENMAI
+       bool "Genmai board"
+       depends on ARCH_R7S72100
+
+config MACH_KOELSCH
+       bool "Koelsch board"
+       depends on ARCH_R8A7791
 
 config MACH_KZM9D
        bool "KZM9D board"
        depends on ARCH_EMEV2
        select REGULATOR_FIXED_VOLTAGE if REGULATOR
 
-comment "SH-Mobile System Configuration"
+config MACH_LAGER
+       bool "Lager board"
+       depends on ARCH_R8A7790
+
+comment "Renesas ARM SoCs System Configuration"
 endif
 
-if ARCH_SHMOBILE
+if ARCH_SHMOBILE_LEGACY
 
-comment "SH-Mobile System Type"
+comment "Renesas ARM SoCs System Type"
 
 config ARCH_SH7372
        bool "SH-Mobile AP4 (SH7372)"
@@ -92,28 +120,36 @@ config ARCH_R8A7790
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
        select CPU_V7
+       select MIGHT_HAVE_PCI
        select SH_CLK_CPG
        select RENESAS_IRQC
 
 config ARCH_R8A7791
        bool "R-Car M2 (R8A77910)"
+       select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
        select CPU_V7
+       select MIGHT_HAVE_PCI
        select SH_CLK_CPG
+       select RENESAS_IRQC
 
 config ARCH_EMEV2
        bool "Emma Mobile EV2"
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
        select CPU_V7
+       select MIGHT_HAVE_PCI
+       select USE_OF
+       select AUTO_ZRELADDR
 
 config ARCH_R7S72100
        bool "RZ/A1H (R7S72100)"
+       select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
        select CPU_V7
        select SH_CLK_CPG
 
-comment "SH-Mobile Board Type"
+comment "Renesas ARM SoCs Board Type"
 
 config MACH_APE6EVM
        bool "APE6EVM board"
@@ -190,6 +226,17 @@ config MACH_GENMAI
        depends on ARCH_R7S72100
        select USE_OF
 
+config MACH_GENMAI_REFERENCE
+       bool "Genmai board - Reference Device Tree Implementation"
+       depends on ARCH_R7S72100
+       select USE_OF
+       ---help---
+          Use reference implementation of Genmai board support
+          which makes use of device tree at the expense
+          of not supporting a number of devices.
+
+          This is intended to aid developers
+
 config MACH_MARZEN
        bool "MARZEN board"
        depends on ARCH_R8A7779
@@ -215,27 +262,11 @@ config MACH_LAGER
        depends on ARCH_R8A7790
        select USE_OF
 
-config MACH_LAGER_REFERENCE
-       bool "Lager board - Reference Device Tree Implementation"
-       depends on ARCH_R8A7790
-       select USE_OF
-       ---help---
-          Use reference implementation of Lager board support
-          which makes use of device tree at the expense
-          of not supporting a number of devices.
-
-          This is intended to aid developers
-
 config MACH_KOELSCH
        bool "Koelsch board"
        depends on ARCH_R8A7791
        select USE_OF
-
-config MACH_KZM9D
-       bool "KZM9D board"
-       depends on ARCH_EMEV2
-       select REGULATOR_FIXED_VOLTAGE if REGULATOR
-       select USE_OF
+       select MICREL_PHY if SH_ETH
 
 config MACH_KZM9G
        bool "KZM-A9-GT board"
@@ -261,7 +292,7 @@ config MACH_KZM9G_REFERENCE
 
           This is intended to aid developers
 
-comment "SH-Mobile System Configuration"
+comment "Renesas ARM SoCs System Configuration"
 
 config CPU_HAS_INTEVT
         bool
@@ -274,7 +305,7 @@ source "drivers/sh/Kconfig"
 
 endif
 
-if ARCH_SHMOBILE || ARCH_SHMOBILE_MULTI
+if ARCH_SHMOBILE
 
 menu "Timer and clock configuration"
 
@@ -286,8 +317,8 @@ config SHMOBILE_TIMER_HZ
          Allows the configuration of the timer frequency. It is customary
          to have the timer interrupt run at 1000 Hz or 100 Hz, but in the
          case of low timer frequencies other values may be more suitable.
-         SH-Mobile systems using a 32768 Hz RCLK for clock events may want
-         to select a HZ value such as 128 that can evenly divide RCLK.
+         Renesas ARM SoC systems using a 32768 Hz RCLK for clock events may
+         want to select a HZ value such as 128 that can evenly divide RCLK.
          A HZ value that does not divide evenly may cause timer drift.
 
 config SH_TIMER_CMT
index 51db2bcafabf028f97cb4ffc5e32def8ef1aad77..fe7d4ff706e4d70534b31ab3a93efddb78eabeb2 100644 (file)
@@ -56,7 +56,10 @@ obj-$(CONFIG_ARCH_R8A7779)   += pm-r8a7779.o
 
 # Board objects
 ifdef CONFIG_ARCH_SHMOBILE_MULTI
+obj-$(CONFIG_MACH_GENMAI)      += board-genmai-reference.o
+obj-$(CONFIG_MACH_KOELSCH)     += board-koelsch-reference.o
 obj-$(CONFIG_MACH_KZM9D)       += board-kzm9d-reference.o
+obj-$(CONFIG_MACH_LAGER)       += board-lager-reference.o
 else
 obj-$(CONFIG_MACH_APE6EVM)     += board-ape6evm.o
 obj-$(CONFIG_MACH_APE6EVM_REFERENCE)   += board-ape6evm-reference.o
@@ -64,14 +67,13 @@ obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
 obj-$(CONFIG_MACH_BOCKW)       += board-bockw.o
 obj-$(CONFIG_MACH_BOCKW_REFERENCE)     += board-bockw-reference.o
 obj-$(CONFIG_MACH_GENMAI)      += board-genmai.o
+obj-$(CONFIG_MACH_GENMAI_REFERENCE)    += board-genmai-reference.o
 obj-$(CONFIG_MACH_MARZEN)      += board-marzen.o
 obj-$(CONFIG_MACH_MARZEN_REFERENCE)    += board-marzen-reference.o
 obj-$(CONFIG_MACH_LAGER)       += board-lager.o
-obj-$(CONFIG_MACH_LAGER_REFERENCE)     += board-lager-reference.o
 obj-$(CONFIG_MACH_ARMADILLO800EVA)     += board-armadillo800eva.o
 obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE)   += board-armadillo800eva-reference.o
 obj-$(CONFIG_MACH_KOELSCH)     += board-koelsch.o
-obj-$(CONFIG_MACH_KZM9D)       += board-kzm9d.o
 obj-$(CONFIG_MACH_KZM9G)       += board-kzm9g.o
 obj-$(CONFIG_MACH_KZM9G_REFERENCE)     += board-kzm9g-reference.o
 endif
index 391d72a5536ceb473acee7eaf2f0312ef268b6ce..99455ecafa0580b9f59217fff88bc84c2cdf4cfb 100644 (file)
@@ -6,13 +6,12 @@ loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
 loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000
 loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
 loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000
-loadaddr-$(CONFIG_MACH_GENMAI) += 0x8008000
+loadaddr-$(CONFIG_MACH_GENMAI) += 0x08008000
+loadaddr-$(CONFIG_MACH_GENMAI_REFERENCE) += 0x08008000
 loadaddr-$(CONFIG_MACH_KOELSCH) += 0x40008000
-loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000
 loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
 loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
 loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
-loadaddr-$(CONFIG_MACH_LAGER_REFERENCE) += 0x40008000
 loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000
 loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
 loadaddr-$(CONFIG_MACH_MARZEN_REFERENCE) += 0x60008000
index 0fa068e30a3001992952a41230cf9ca609793c72..fe071a9130b78d2986faecabfa7fb2f208166d4e 100644 (file)
@@ -168,7 +168,7 @@ static const struct sh_mmcif_plat_data mmcif0_pdata __initconst = {
 };
 
 static const struct resource mmcif0_resources[] __initconst = {
-       DEFINE_RES_MEM_NAMED(0xee200000, 0x100, "MMCIF0"),
+       DEFINE_RES_MEM(0xee200000, 0x100),
        DEFINE_RES_IRQ(gic_spi(169)),
 };
 
@@ -179,7 +179,7 @@ static const struct sh_mobile_sdhi_info sdhi0_pdata __initconst = {
 };
 
 static const struct resource sdhi0_resources[] __initconst = {
-       DEFINE_RES_MEM_NAMED(0xee100000, 0x100, "SDHI0"),
+       DEFINE_RES_MEM(0xee100000, 0x100),
        DEFINE_RES_IRQ(gic_spi(165)),
 };
 
@@ -191,7 +191,7 @@ static const struct sh_mobile_sdhi_info sdhi1_pdata __initconst = {
 };
 
 static const struct resource sdhi1_resources[] __initconst = {
-       DEFINE_RES_MEM_NAMED(0xee120000, 0x100, "SDHI1"),
+       DEFINE_RES_MEM(0xee120000, 0x100),
        DEFINE_RES_IRQ(gic_spi(166)),
 };
 
index 8ea87bd45c330abd37df9eba0b30b8f4efc8dc47..93533e2710a83927d1935799ce56410bb26d098f 100644 (file)
@@ -423,7 +423,7 @@ static struct platform_pwm_backlight_data pwm_backlight_data = {
        .max_brightness = 255,
        .dft_brightness = 255,
        .pwm_period_ns = 33333, /* 30kHz */
-       .enable_gpio = -1,
+       .enable_gpio = 61,
 };
 
 static struct platform_device pwm_backlight_device = {
@@ -963,7 +963,7 @@ static struct resource fsi_resources[] = {
        [0] = {
                .name   = "FSI",
                .start  = 0xfe1f0000,
-               .end    = 0xfe1f8400 - 1,
+               .end    = 0xfe1f0400 - 1,
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
@@ -1210,9 +1210,6 @@ static void __init eva_init(void)
        r8a7740_pinmux_init();
        r8a7740_meram_workaround();
 
-       /* LCDC0 */
-       gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
-
        /* GETHER */
        gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */
 
index ae88fdad4b3a9921ea02f9c1db001348753bb98a..027373f8de8215a74dc2b757e25d6e638416e7c8 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 #include <linux/of_platform.h>
-#include <linux/pinctrl/machine.h>
 #include <mach/common.h>
 #include <mach/r8a7778.h>
 #include <asm/mach/arch.h>
  *     see board-bock.c for checking detail of dip-switch
  */
 
-static const struct pinctrl_map bockw_pinctrl_map[] = {
-       /* SCIF0 */
-       PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
-                                 "scif0_data_a", "scif0"),
-       PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
-                                 "scif0_ctrl", "scif0"),
-};
-
 #define FPGA   0x18200000
 #define IRQ0MR 0x30
 #define COMCTLR        0x101c
+
+#define PFC    0xfffc0000
+#define PUPR4  0x110
 static void __init bockw_init(void)
 {
-       static void __iomem *fpga;
+       void __iomem *fpga;
+       void __iomem *pfc;
 
        r8a7778_clock_init();
        r8a7778_init_irq_extpin_dt(1);
-
-       pinctrl_register_mappings(bockw_pinctrl_map,
-                                 ARRAY_SIZE(bockw_pinctrl_map));
-       r8a7778_pinmux_init();
        r8a7778_add_dt_devices();
 
        fpga = ioremap_nocache(FPGA, SZ_1M);
@@ -63,6 +54,19 @@ static void __init bockw_init(void)
                u16 val = ioread16(fpga + IRQ0MR);
                val &= ~(1 << 4); /* enable SMSC911x */
                iowrite16(val, fpga + IRQ0MR);
+
+               iounmap(fpga);
+       }
+
+       pfc = ioremap_nocache(PFC, 0x200);
+       if (pfc) {
+               /*
+                * FIXME
+                *
+                * SDHI CD/WP pin needs pull-up
+                */
+               iowrite32(ioread32(pfc + PUPR4) | (3 << 26), pfc + PUPR4);
+               iounmap(pfc);
        }
 
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
index 3c4995aebd220870406934ba905d90d5949d18ca..c475220545f2a1c11180330d99ba31fa97099f91 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/mmc/sh_mmcif.h>
 #include <linux/mtd/partitions.h>
 #include <linux/pinctrl/machine.h>
+#include <linux/platform_data/camera-rcar.h>
 #include <linux/platform_data/usb-rcar-phy.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/fixed.h>
@@ -116,6 +117,11 @@ static struct regulator_consumer_supply dummy_supplies[] = {
        REGULATOR_SUPPLY("vdd33a", "smsc911x"),
 };
 
+static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
+       REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
+       REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
+};
+
 static struct smsc911x_platform_config smsc911x_data __initdata = {
        .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
        .irq_type       = SMSC911X_IRQ_TYPE_PUSH_PULL,
@@ -271,7 +277,6 @@ static struct resource mmc_resources[] __initdata = {
 
 static struct sh_mmcif_plat_data sh_mmcif_plat __initdata = {
        .sup_pclk       = 0,
-       .ocr            = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
        .caps           = MMC_CAP_4_BIT_DATA |
                          MMC_CAP_8_BIT_DATA |
                          MMC_CAP_NEEDS_POLL,
@@ -328,11 +333,11 @@ static struct rsnd_ssi_platform_info rsnd_ssi[] = {
        RSND_SSI_UNUSED, /* SSI 1 */
        RSND_SSI_UNUSED, /* SSI 2 */
        RSND_SSI_SET(1, 0, gic_iid(0x85), RSND_SSI_PLAY),
-       RSND_SSI_SET(2, 0, gic_iid(0x85), RSND_SSI_CLK_PIN_SHARE | RSND_SSI_CLK_FROM_ADG),
+       RSND_SSI_SET(2, 0, gic_iid(0x85), RSND_SSI_CLK_PIN_SHARE),
        RSND_SSI_SET(0, 0, gic_iid(0x86), RSND_SSI_PLAY),
        RSND_SSI_SET(0, 0, gic_iid(0x86), 0),
        RSND_SSI_SET(3, 0, gic_iid(0x86), RSND_SSI_PLAY),
-       RSND_SSI_SET(4, 0, gic_iid(0x86), RSND_SSI_CLK_PIN_SHARE | RSND_SSI_CLK_FROM_ADG),
+       RSND_SSI_SET(4, 0, gic_iid(0x86), RSND_SSI_CLK_PIN_SHARE),
 };
 
 static struct rsnd_scu_platform_info rsnd_scu[9] = {
@@ -614,6 +619,10 @@ static void __init bockw_init(void)
                &usb_phy_platform_data,
                sizeof(struct rcar_phy_platform_data));
 
+       regulator_register_fixed(0, dummy_supplies,
+                                ARRAY_SIZE(dummy_supplies));
+       regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers,
+                                    ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
 
        /* for SMSC */
        fpga = ioremap_nocache(FPGA, SZ_1M);
@@ -629,9 +638,6 @@ static void __init bockw_init(void)
                val &= ~(1 << 4); /* enable SMSC911x */
                iowrite16(val, fpga + IRQ0MR);
 
-               regulator_register_fixed(0, dummy_supplies,
-                                        ARRAY_SIZE(dummy_supplies));
-
                platform_device_register_resndata(
                        &platform_bus, "smsc911x", -1,
                        smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
diff --git a/arch/arm/mach-shmobile/board-genmai-reference.c b/arch/arm/mach-shmobile/board-genmai-reference.c
new file mode 100644 (file)
index 0000000..7630c10
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Genmai board support
+ *
+ * Copyright (C) 2013  Renesas Solutions Corp.
+ * Copyright (C) 2013  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+#include <mach/common.h>
+#include <mach/r7s72100.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+
+static void __init genmai_add_standard_devices(void)
+{
+#ifdef CONFIG_COMMON_CLK
+       of_clk_init(NULL);
+#else
+       r7s72100_clock_init();
+#endif
+       r7s72100_add_dt_devices();
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char * const genmai_boards_compat_dt[] __initconst = {
+       "renesas,genmai-reference",
+       NULL,
+};
+
+DT_MACHINE_START(GENMAI_DT, "genmai")
+       .init_early     = r7s72100_init_early,
+       .init_machine   = genmai_add_standard_devices,
+       .dt_compat      = genmai_boards_compat_dt,
+MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
new file mode 100644 (file)
index 0000000..652b592
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Koelsch board support - Reference DT implementation
+ *
+ * Copyright (C) 2013  Renesas Electronics Corporation
+ * Copyright (C) 2013  Renesas Solutions Corp.
+ * Copyright (C) 2013  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+#include <mach/common.h>
+#include <mach/rcar-gen2.h>
+#include <mach/r8a7791.h>
+#include <asm/mach/arch.h>
+
+static void __init koelsch_add_standard_devices(void)
+{
+#ifdef CONFIG_COMMON_CLK
+       /*
+        * This is a really crude hack to provide clkdev support to the SCIF
+        * and CMT devices until they get moved to DT.
+        */
+       static const char * const scif_names[] = {
+               "scifa0", "scifa1", "scifb0", "scifb1", "scifb2", "scifa2",
+               "scif0", "scif1", "scif2", "scif3", "scif4", "scif5", "scifa3",
+               "scifa4", "scifa5",
+       };
+       struct clk *clk;
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(scif_names); ++i) {
+               clk = clk_get(NULL, scif_names[i]);
+               if (clk) {
+                       clk_register_clkdev(clk, NULL, "sh-sci.%u", i);
+                       clk_put(clk);
+               }
+       }
+
+       clk = clk_get(NULL, "cmt0");
+       if (clk) {
+               clk_register_clkdev(clk, NULL, "sh_cmt.0");
+               clk_put(clk);
+       }
+#else
+       r8a7791_clock_init();
+#endif
+       r8a7791_add_dt_devices();
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char * const koelsch_boards_compat_dt[] __initconst = {
+       "renesas,koelsch",
+       "renesas,koelsch-reference",
+       NULL,
+};
+
+DT_MACHINE_START(KOELSCH_DT, "koelsch")
+       .smp            = smp_ops(r8a7791_smp_ops),
+       .init_early     = r8a7791_init_early,
+       .init_time      = rcar_gen2_timer_init,
+       .init_machine   = koelsch_add_standard_devices,
+       .init_late      = shmobile_init_late,
+       .dt_compat      = koelsch_boards_compat_dt,
+MACHINE_END
index ace1711a6cd83b1b8dcde8aead16a97156d72c8d..de7cc64b1f3733823fa0b041ad7853ea73ba5c09 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/dma-mapping.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
 #include <linux/kernel.h>
+#include <linux/leds.h>
+#include <linux/phy.h>
+#include <linux/pinctrl/machine.h>
+#include <linux/platform_data/gpio-rcar.h>
+#include <linux/platform_data/rcar-du.h>
 #include <linux/platform_device.h>
+#include <linux/sh_eth.h>
 #include <mach/common.h>
+#include <mach/irqs.h>
 #include <mach/r8a7791.h>
 #include <mach/rcar-gen2.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/* DU */
+static struct rcar_du_encoder_data koelsch_du_encoders[] = {
+       {
+               .type = RCAR_DU_ENCODER_NONE,
+               .output = RCAR_DU_OUTPUT_LVDS0,
+               .connector.lvds.panel = {
+                       .width_mm = 210,
+                       .height_mm = 158,
+                       .mode = {
+                               .clock = 65000,
+                               .hdisplay = 1024,
+                               .hsync_start = 1048,
+                               .hsync_end = 1184,
+                               .htotal = 1344,
+                               .vdisplay = 768,
+                               .vsync_start = 771,
+                               .vsync_end = 777,
+                               .vtotal = 806,
+                               .flags = 0,
+                       },
+               },
+       },
+};
+
+static const struct rcar_du_platform_data koelsch_du_pdata __initconst = {
+       .encoders = koelsch_du_encoders,
+       .num_encoders = ARRAY_SIZE(koelsch_du_encoders),
+};
+
+static const struct resource du_resources[] __initconst = {
+       DEFINE_RES_MEM(0xfeb00000, 0x40000),
+       DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
+       DEFINE_RES_IRQ(gic_spi(256)),
+       DEFINE_RES_IRQ(gic_spi(268)),
+};
+
+static void __init koelsch_add_du_device(void)
+{
+       struct platform_device_info info = {
+               .name = "rcar-du-r8a7791",
+               .id = -1,
+               .res = du_resources,
+               .num_res = ARRAY_SIZE(du_resources),
+               .data = &koelsch_du_pdata,
+               .size_data = sizeof(koelsch_du_pdata),
+               .dma_mask = DMA_BIT_MASK(32),
+       };
+
+       platform_device_register_full(&info);
+}
+
+/* Ether */
+static const struct sh_eth_plat_data ether_pdata __initconst = {
+       .phy                    = 0x1,
+       .edmac_endian           = EDMAC_LITTLE_ENDIAN,
+       .phy_interface          = PHY_INTERFACE_MODE_RMII,
+       .ether_link_active_low  = 1,
+};
+
+static const struct resource ether_resources[] __initconst = {
+       DEFINE_RES_MEM(0xee700000, 0x400),
+       DEFINE_RES_IRQ(gic_spi(162)),
+};
+
+/* LEDS */
+static struct gpio_led koelsch_leds[] = {
+       {
+               .name           = "led8",
+               .gpio           = RCAR_GP_PIN(2, 21),
+               .default_state  = LEDS_GPIO_DEFSTATE_ON,
+       }, {
+               .name           = "led7",
+               .gpio           = RCAR_GP_PIN(2, 20),
+               .default_state  = LEDS_GPIO_DEFSTATE_ON,
+       }, {
+               .name           = "led6",
+               .gpio           = RCAR_GP_PIN(2, 19),
+               .default_state  = LEDS_GPIO_DEFSTATE_ON,
+       },
+};
+
+static const struct gpio_led_platform_data koelsch_leds_pdata __initconst = {
+       .leds           = koelsch_leds,
+       .num_leds       = ARRAY_SIZE(koelsch_leds),
+};
+
+/* GPIO KEY */
+#define GPIO_KEY(c, g, d, ...) \
+       { .code = c, .gpio = g, .desc = d, .active_low = 1, \
+         .wakeup = 1, .debounce_interval = 20 }
+
+static struct gpio_keys_button gpio_buttons[] = {
+       GPIO_KEY(KEY_4,         RCAR_GP_PIN(5, 3),      "SW2-pin4"),
+       GPIO_KEY(KEY_3,         RCAR_GP_PIN(5, 2),      "SW2-pin3"),
+       GPIO_KEY(KEY_2,         RCAR_GP_PIN(5, 1),      "SW2-pin2"),
+       GPIO_KEY(KEY_1,         RCAR_GP_PIN(5, 0),      "SW2-pin1"),
+       GPIO_KEY(KEY_G,         RCAR_GP_PIN(7, 6),      "SW36"),
+       GPIO_KEY(KEY_F,         RCAR_GP_PIN(7, 5),      "SW35"),
+       GPIO_KEY(KEY_E,         RCAR_GP_PIN(7, 4),      "SW34"),
+       GPIO_KEY(KEY_D,         RCAR_GP_PIN(7, 3),      "SW33"),
+       GPIO_KEY(KEY_C,         RCAR_GP_PIN(7, 2),      "SW32"),
+       GPIO_KEY(KEY_B,         RCAR_GP_PIN(7, 1),      "SW31"),
+       GPIO_KEY(KEY_A,         RCAR_GP_PIN(7, 0),      "SW30"),
+};
+
+static const struct gpio_keys_platform_data koelsch_keys_pdata __initconst = {
+       .buttons        = gpio_buttons,
+       .nbuttons       = ARRAY_SIZE(gpio_buttons),
+};
+
+static const struct pinctrl_map koelsch_pinctrl_map[] = {
+       /* DU */
+       PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
+                                 "du_rgb666", "du"),
+       PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
+                                 "du_sync", "du"),
+       PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
+                                 "du_clk_out_0", "du"),
+       /* Ether */
+       PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
+                                 "eth_link", "eth"),
+       PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
+                                 "eth_mdio", "eth"),
+       PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
+                                 "eth_rmii", "eth"),
+       PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
+                                 "intc_irq0", "intc"),
+       /* SCIF0 (CN19: DEBUG SERIAL0) */
+       PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7791",
+                                 "scif0_data_d", "scif0"),
+       /* SCIF1 (CN20: DEBUG SERIAL1) */
+       PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7791",
+                                 "scif1_data_d", "scif1"),
+};
+
 static void __init koelsch_add_standard_devices(void)
 {
        r8a7791_clock_init();
+       pinctrl_register_mappings(koelsch_pinctrl_map,
+                                 ARRAY_SIZE(koelsch_pinctrl_map));
+       r8a7791_pinmux_init();
        r8a7791_add_standard_devices();
+       platform_device_register_resndata(&platform_bus, "r8a7791-ether", -1,
+                                         ether_resources,
+                                         ARRAY_SIZE(ether_resources),
+                                         &ether_pdata, sizeof(ether_pdata));
+       platform_device_register_data(&platform_bus, "leds-gpio", -1,
+                                     &koelsch_leds_pdata,
+                                     sizeof(koelsch_leds_pdata));
+       platform_device_register_data(&platform_bus, "gpio-keys", -1,
+                                     &koelsch_keys_pdata,
+                                     sizeof(koelsch_keys_pdata));
+
+       koelsch_add_du_device();
+}
+
+/*
+ * Ether LEDs on the Koelsch board are named LINK and ACTIVE which corresponds
+ * to non-default 01 setting of the Micrel KSZ8041 PHY control register 1 bits
+ * 14-15. We have to set them back to 01 from the default 00 value each time
+ * the PHY is reset. It's also important because the PHY's LED0 signal is
+ * connected to SoC's ETH_LINK signal and in the PHY's default mode it will
+ * bounce on and off after each packet, which we apparently want to avoid.
+ */
+static int koelsch_ksz8041_fixup(struct phy_device *phydev)
+{
+       u16 phyctrl1 = phy_read(phydev, 0x1e);
+
+       phyctrl1 &= ~0xc000;
+       phyctrl1 |= 0x4000;
+       return phy_write(phydev, 0x1e, phyctrl1);
+}
+
+static void __init koelsch_init(void)
+{
+       koelsch_add_standard_devices();
+
+       if (IS_ENABLED(CONFIG_PHYLIB))
+               phy_register_fixup_for_id("r8a7791-ether-ff:01",
+                                         koelsch_ksz8041_fixup);
 }
 
 static const char * const koelsch_boards_compat_dt[] __initconst = {
@@ -41,7 +228,8 @@ static const char * const koelsch_boards_compat_dt[] __initconst = {
 DT_MACHINE_START(KOELSCH_DT, "koelsch")
        .smp            = smp_ops(r8a7791_smp_ops),
        .init_early     = r8a7791_init_early,
-       .init_machine   = koelsch_add_standard_devices,
        .init_time      = rcar_gen2_timer_init,
+       .init_machine   = koelsch_init,
+       .init_late      = shmobile_init_late,
        .dt_compat      = koelsch_boards_compat_dt,
 MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9d.c b/arch/arm/mach-shmobile/board-kzm9d.c
deleted file mode 100644 (file)
index 30c2cc6..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * kzm9d board support
- *
- * Copyright (C) 2012  Renesas Solutions Corp.
- * Copyright (C) 2012  Magnus Damm
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include <linux/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/regulator/fixed.h>
-#include <linux/regulator/machine.h>
-#include <linux/smsc911x.h>
-#include <mach/common.h>
-#include <mach/emev2.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-
-/* Dummy supplies, where voltage doesn't matter */
-static struct regulator_consumer_supply dummy_supplies[] = {
-       REGULATOR_SUPPLY("vddvario", "smsc911x"),
-       REGULATOR_SUPPLY("vdd33a", "smsc911x"),
-};
-
-/* Ether */
-static struct resource smsc911x_resources[] = {
-       [0] = {
-               .start  = 0x20000000,
-               .end    = 0x2000ffff,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = EMEV2_GPIO_IRQ(1),
-               .flags  = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
-       },
-};
-
-static struct smsc911x_platform_config smsc911x_platdata = {
-       .flags          = SMSC911X_USE_32BIT,
-       .irq_type       = SMSC911X_IRQ_TYPE_PUSH_PULL,
-       .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
-};
-
-static struct platform_device smsc91x_device = {
-       .name   = "smsc911x",
-       .id     = -1,
-       .dev    = {
-                 .platform_data = &smsc911x_platdata,
-               },
-       .num_resources  = ARRAY_SIZE(smsc911x_resources),
-       .resource       = smsc911x_resources,
-};
-
-static struct platform_device *kzm9d_devices[] __initdata = {
-       &smsc91x_device,
-};
-
-void __init kzm9d_add_standard_devices(void)
-{
-       regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
-
-       emev2_add_standard_devices();
-
-       platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices));
-}
-
-static const char *kzm9d_boards_compat_dt[] __initdata = {
-       "renesas,kzm9d",
-       NULL,
-};
-
-DT_MACHINE_START(KZM9D_DT, "kzm9d")
-       .smp            = smp_ops(emev2_smp_ops),
-       .map_io         = emev2_map_io,
-       .init_early     = emev2_init_delay,
-       .init_machine   = kzm9d_add_standard_devices,
-       .init_late      = shmobile_init_late,
-       .dt_compat      = kzm9d_boards_compat_dt,
-MACHINE_END
index 1a1a4a888632afb67fa47a532d3c251d3818fd65..a6e271d92af04b4fb7037f615684d0508375a844 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/clk.h>
+#include <linux/clkdev.h>
 #include <linux/init.h>
 #include <linux/of_platform.h>
+#include <mach/common.h>
+#include <mach/rcar-gen2.h>
 #include <mach/r8a7790.h>
 #include <asm/mach/arch.h>
 
 static void __init lager_add_standard_devices(void)
 {
-       /* clocks are setup late during boot in the case of DT */
+#ifdef CONFIG_COMMON_CLK
+       /*
+        * This is a really crude hack to provide clkdev support to the SCIF
+        * and CMT devices until they get moved to DT.
+        */
+       static const char * const scif_names[] = {
+               "scifa0", "scifa1", "scifb0", "scifb1",
+               "scifb2", "scifa2", "scif0", "scif1",
+               "hscif0", "hscif1",
+       };
+       struct clk *clk;
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(scif_names); ++i) {
+               clk = clk_get(NULL, scif_names[i]);
+               if (clk) {
+                       clk_register_clkdev(clk, NULL, "sh-sci.%u", i);
+                       clk_put(clk);
+               }
+       }
+
+       clk = clk_get(NULL, "cmt0");
+       if (clk) {
+               clk_register_clkdev(clk, NULL, "sh_cmt.0");
+               clk_put(clk);
+       }
+#else
        r8a7790_clock_init();
+#endif
 
        r8a7790_add_dt_devices();
-        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
 static const char *lager_boards_compat_dt[] __initdata = {
+       "renesas,lager",
        "renesas,lager-reference",
        NULL,
 };
@@ -42,5 +74,6 @@ DT_MACHINE_START(LAGER_DT, "lager")
        .init_early     = r8a7790_init_early,
        .init_time      = rcar_gen2_timer_init,
        .init_machine   = lager_add_standard_devices,
+       .init_late      = shmobile_init_late,
        .dt_compat      = lager_boards_compat_dt,
 MACHINE_END
index e0406fd373906e4d43d53769a7d7cfa548b6f388..f20c10a18543973c3d5797d83e8ac4bae26c8708 100644 (file)
@@ -31,7 +31,9 @@
 #include <linux/platform_data/rcar-du.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
+#include <linux/regulator/driver.h>
 #include <linux/regulator/fixed.h>
+#include <linux/regulator/gpio-regulator.h>
 #include <linux/regulator/machine.h>
 #include <linux/sh_eth.h>
 #include <mach/common.h>
 #include <mach/r8a7790.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/mtd.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/rspi.h>
+#include <linux/spi/spi.h>
 
 /* DU */
 static struct rcar_du_encoder_data lager_du_encoders[] = {
@@ -120,7 +127,8 @@ static const struct gpio_led_platform_data lager_leds_pdata __initconst = {
 
 /* GPIO KEY */
 #define GPIO_KEY(c, g, d, ...) \
-       { .code = c, .gpio = g, .desc = d, .active_low = 1 }
+       { .code = c, .gpio = g, .desc = d, .active_low = 1, \
+         .wakeup = 1, .debounce_interval = 20 }
 
 static struct gpio_keys_button gpio_buttons[] = {
        GPIO_KEY(KEY_4,         RCAR_GP_PIN(1, 28),     "SW2-pin4"),
@@ -140,6 +148,71 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] =
        REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
 };
 
+/*
+ * SDHI regulator macro
+ *
+ ** FIXME**
+ * Lager board vqmmc is provided via DA9063 PMIC chip,
+ * and we should use ${LINK}/drivers/mfd/da9063-* driver for it.
+ * but, it doesn't have regulator support at this point.
+ * It uses gpio-regulator for vqmmc as quick-hack.
+ */
+#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin)                         \
+static struct regulator_consumer_supply vcc_sdhi##idx##_consumer =     \
+       REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx);               \
+                                                                       \
+static struct regulator_init_data vcc_sdhi##idx##_init_data = {                \
+       .constraints = {                                                \
+               .valid_ops_mask = REGULATOR_CHANGE_STATUS,              \
+       },                                                              \
+       .consumer_supplies      = &vcc_sdhi##idx##_consumer,            \
+       .num_consumer_supplies  = 1,                                    \
+};                                                                     \
+                                                                       \
+static const struct fixed_voltage_config vcc_sdhi##idx##_info __initconst = {\
+       .supply_name    = "SDHI" #idx "Vcc",                            \
+       .microvolts     = 3300000,                                      \
+       .gpio           = vdd_pin,                                      \
+       .enable_high    = 1,                                            \
+       .init_data      = &vcc_sdhi##idx##_init_data,                   \
+};                                                                     \
+                                                                       \
+static struct regulator_consumer_supply vccq_sdhi##idx##_consumer =    \
+       REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx);              \
+                                                                       \
+static struct regulator_init_data vccq_sdhi##idx##_init_data = {       \
+       .constraints = {                                                \
+               .input_uV       = 3300000,                              \
+               .min_uV         = 1800000,                              \
+               .max_uV         = 3300000,                              \
+               .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |            \
+                                 REGULATOR_CHANGE_STATUS,              \
+       },                                                              \
+       .consumer_supplies      = &vccq_sdhi##idx##_consumer,           \
+       .num_consumer_supplies  = 1,                                    \
+};                                                                     \
+                                                                       \
+static struct gpio vccq_sdhi##idx##_gpio =                             \
+       { vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx };            \
+                                                                       \
+static struct gpio_regulator_state vccq_sdhi##idx##_states[] = {       \
+       { .value = 1800000, .gpios = 0 },                               \
+       { .value = 3300000, .gpios = 1 },                               \
+};                                                                     \
+                                                                       \
+static const struct gpio_regulator_config vccq_sdhi##idx##_info __initconst = {\
+       .supply_name    = "vqmmc",                                      \
+       .gpios          = &vccq_sdhi##idx##_gpio,                       \
+       .nr_gpios       = 1,                                            \
+       .states         = vccq_sdhi##idx##_states,                      \
+       .nr_states      = ARRAY_SIZE(vccq_sdhi##idx##_states),          \
+       .type           = REGULATOR_VOLTAGE,                            \
+       .init_data      = &vccq_sdhi##idx##_init_data,                  \
+};
+
+SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
+SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
+
 /* MMCIF */
 static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
        .caps           = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
@@ -148,7 +221,7 @@ static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
 };
 
 static const struct resource mmcif1_resources[] __initconst = {
-       DEFINE_RES_MEM_NAMED(0xee220000, 0x80, "MMCIF1"),
+       DEFINE_RES_MEM(0xee220000, 0x80),
        DEFINE_RES_IRQ(gic_spi(170)),
 };
 
@@ -165,6 +238,59 @@ static const struct resource ether_resources[] __initconst = {
        DEFINE_RES_IRQ(gic_spi(162)),
 };
 
+/* SPI Flash memory (Spansion S25FL512SAGMFIG11 64Mb) */
+static struct mtd_partition spi_flash_part[] = {
+       /* Reserved for user loader program, read-only */
+       {
+               .name = "loader",
+               .offset = 0,
+               .size = SZ_256K,
+               .mask_flags = MTD_WRITEABLE,
+       },
+       /* Reserved for user program, read-only */
+       {
+               .name = "user",
+               .offset = MTDPART_OFS_APPEND,
+               .size = SZ_4M,
+               .mask_flags = MTD_WRITEABLE,
+       },
+       /* All else is writable (e.g. JFFS2) */
+       {
+               .name = "flash",
+               .offset = MTDPART_OFS_APPEND,
+               .size = MTDPART_SIZ_FULL,
+               .mask_flags = 0,
+       },
+};
+
+static struct flash_platform_data spi_flash_data = {
+       .name           = "m25p80",
+       .parts          = spi_flash_part,
+       .nr_parts       = ARRAY_SIZE(spi_flash_part),
+       .type           = "s25fl512s",
+};
+
+static const struct rspi_plat_data qspi_pdata __initconst = {
+       .num_chipselect = 1,
+};
+
+static const struct spi_board_info spi_info[] __initconst = {
+       {
+               .modalias               = "m25p80",
+               .platform_data          = &spi_flash_data,
+               .mode                   = SPI_MODE_0,
+               .max_speed_hz           = 30000000,
+               .bus_num                = 0,
+               .chip_select            = 0,
+       },
+};
+
+/* QSPI resource */
+static const struct resource qspi_resources[] __initconst = {
+       DEFINE_RES_MEM(0xe6b10000, 0x1000),
+       DEFINE_RES_IRQ(gic_spi(184)),
+};
+
 static const struct pinctrl_map lager_pinctrl_map[] = {
        /* DU (CN10: ARGB0, CN13: LVDS) */
        PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -197,6 +323,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 
 static void __init lager_add_standard_devices(void)
 {
+       int fixed_regulator_idx = 0;
+       int gpio_regulator_idx = 0;
+
        r8a7790_clock_init();
 
        pinctrl_register_mappings(lager_pinctrl_map,
@@ -210,7 +339,8 @@ static void __init lager_add_standard_devices(void)
        platform_device_register_data(&platform_bus, "gpio-keys", -1,
                                      &lager_keys_pdata,
                                      sizeof(lager_keys_pdata));
-       regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
+       regulator_register_always_on(fixed_regulator_idx++,
+                                    "fixed-3.3V", fixed3v3_power_consumers,
                                     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
        platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
                                          mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
@@ -222,6 +352,22 @@ static void __init lager_add_standard_devices(void)
                                          &ether_pdata, sizeof(ether_pdata));
 
        lager_add_du_device();
+
+       platform_device_register_resndata(&platform_bus, "qspi", 0,
+                                         qspi_resources,
+                                         ARRAY_SIZE(qspi_resources),
+                                         &qspi_pdata, sizeof(qspi_pdata));
+       spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
+
+       platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+                                     &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
+       platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+                                     &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
+
+       platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+                                     &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
+       platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+                                     &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
 }
 
 /*
@@ -260,5 +406,6 @@ DT_MACHINE_START(LAGER_DT, "lager")
        .init_early     = r8a7790_init_early,
        .init_time      = rcar_gen2_timer_init,
        .init_machine   = lager_init,
+       .init_late      = shmobile_init_late,
        .dt_compat      = lager_boards_compat_dt,
 MACHINE_END
index e721d2ccceaef8c1d57bd0d671fa097a2c0f539a..3aba0372f6305b7458e87dcffa9b27c8c515425e 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/sh_flctl.h>
 #include <linux/pinctrl/machine.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_data/gpio_backlight.h>
 #include <linux/pm_clock.h>
 #include <linux/regulator/fixed.h>
@@ -548,9 +549,9 @@ static void __init hdmi_init_pm_clock(void)
                 clk_get_rate(&sh7372_pllc2_clk));
 
        rate = clk_round_rate(&sh7372_pllc2_clk, 594000000);
-       if (rate < 0) {
+       if (rate <= 0) {
                pr_err("Cannot get suitable rate: %ld\n", rate);
-               ret = rate;
+               ret = -EINVAL;
                goto out;
        }
 
@@ -1311,6 +1312,10 @@ static struct i2c_board_info i2c1_devices[] = {
        },
 };
 
+static unsigned long pin_pulldown_conf[] = {
+       PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_DOWN, 0),
+};
+
 static const struct pinctrl_map mackerel_pinctrl_map[] = {
        /* ADXL34X */
        PIN_MAP_MUX_GROUP_DEFAULT("1-0053", "pfc-sh7372",
@@ -1396,17 +1401,19 @@ static const struct pinctrl_map mackerel_pinctrl_map[] = {
        /* USBHS0 */
        PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.0", "pfc-sh7372",
                                  "usb0_vbus", "usb0"),
+       PIN_MAP_CONFIGS_GROUP_DEFAULT("renesas_usbhs.0", "pfc-sh7372",
+                                     "usb0_vbus", pin_pulldown_conf),
        /* USBHS1 */
        PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372",
                                  "usb1_vbus", "usb1"),
+       PIN_MAP_CONFIGS_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372",
+                                     "usb1_vbus", pin_pulldown_conf),
        PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372",
                                  "usb1_otg_id_0", "usb1"),
 };
 
 #define GPIO_PORT9CR   IOMEM(0xE6051009)
 #define GPIO_PORT10CR  IOMEM(0xE605100A)
-#define GPIO_PORT167CR IOMEM(0xE60520A7)
-#define GPIO_PORT168CR IOMEM(0xE60520A8)
 #define SRCR4          IOMEM(0xe61580bc)
 #define USCCR1         IOMEM(0xE6058144)
 static void __init mackerel_init(void)
@@ -1446,12 +1453,6 @@ static void __init mackerel_init(void)
 
        gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
 
-       /* USBHS0 */
-       gpio_request_pulldown(GPIO_PORT168CR); /* VBUS0_0 pull down */
-
-       /* USBHS1 */
-       gpio_request_pulldown(GPIO_PORT167CR); /* VBUS0_1 pull down */
-
        /* FSI2 port A (ak4643) */
        gpio_request_one(161, GPIOF_OUT_INIT_LOW, NULL); /* slave */
 
index da1352f5f71b6195969d17ef0de30ba9d4c8e7fe..d832a4477b4bdb8e46970c49ed1b45843405cf45 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/leds.h>
 #include <linux/dma-mapping.h>
 #include <linux/pinctrl/machine.h>
+#include <linux/platform_data/camera-rcar.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_data/rcar-du.h>
 #include <linux/platform_data/usb-rcar-phy.h>
@@ -259,10 +260,30 @@ static struct platform_device leds_device = {
        },
 };
 
+/* VIN */
 static struct rcar_vin_platform_data vin_platform_data __initdata = {
        .flags  = RCAR_VIN_BT656,
 };
 
+#define MARZEN_VIN(idx)                                                \
+static struct resource vin##idx##_resources[] __initdata = {   \
+       DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000),    \
+       DEFINE_RES_IRQ(gic_iid(0x5f + (idx))),                  \
+};                                                             \
+                                                               \
+static struct platform_device_info vin##idx##_info __initdata = { \
+       .parent         = &platform_bus,                        \
+       .name           = "r8a7779-vin",                        \
+       .id             = idx,                                  \
+       .res            = vin##idx##_resources,                 \
+       .num_res        = ARRAY_SIZE(vin##idx##_resources),     \
+       .dma_mask       = DMA_BIT_MASK(32),                     \
+       .data           = &vin_platform_data,                   \
+       .size_data      = sizeof(vin_platform_data),            \
+}
+MARZEN_VIN(1);
+MARZEN_VIN(3);
+
 #define MARZEN_CAMERA(idx)                                     \
 static struct i2c_board_info camera##idx##_info = {            \
        I2C_BOARD_INFO("adv7180", 0x20 + (idx)),                \
@@ -326,8 +347,6 @@ static const struct pinctrl_map marzen_pinctrl_map[] = {
                                  "sdhi0_ctrl", "sdhi0"),
        PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
                                  "sdhi0_cd", "sdhi0"),
-       PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
-                                 "sdhi0_wp", "sdhi0"),
        /* SMSC */
        PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
                                  "intc_irq1_b", "intc"),
@@ -367,8 +386,8 @@ static void __init marzen_init(void)
        r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */
 
        r8a7779_add_standard_devices();
-       r8a7779_add_vin_device(1, &vin_platform_data);
-       r8a7779_add_vin_device(3, &vin_platform_data);
+       platform_device_register_full(&vin1_info);
+       platform_device_register_full(&vin3_info);
        platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
        marzen_add_du_device();
 }
index 4aba20ca127e1ef5f2cc214bfa946a28f216a6bf..e6ab0cd5b28628dbd65a5c3f7dfa1cc57428f090 100644 (file)
@@ -27,6 +27,7 @@
 #define FRQCR2         0xfcfe0014
 #define STBCR3         0xfcfe0420
 #define STBCR4         0xfcfe0424
+#define STBCR9         0xfcfe0438
 
 #define PLL_RATE 30
 
@@ -144,10 +145,15 @@ struct clk div4_clks[DIV4_NR] = {
                                        | CLK_ENABLE_ON_INIT),
 };
 
-enum { MSTP47, MSTP46, MSTP45, MSTP44, MSTP43, MSTP42, MSTP41, MSTP40,
+enum { MSTP97, MSTP96, MSTP95, MSTP94,
+       MSTP47, MSTP46, MSTP45, MSTP44, MSTP43, MSTP42, MSTP41, MSTP40,
        MSTP33, MSTP_NR };
 
 static struct clk mstp_clks[MSTP_NR] = {
+       [MSTP97] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 7, 0), /* RIIC0 */
+       [MSTP96] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 6, 0), /* RIIC1 */
+       [MSTP95] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 5, 0), /* RIIC2 */
+       [MSTP94] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 4, 0), /* RIIC3 */
        [MSTP47] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 7, 0), /* SCIF0 */
        [MSTP46] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 6, 0), /* SCIF1 */
        [MSTP45] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 5, 0), /* SCIF2 */
@@ -170,6 +176,9 @@ static struct clk_lookup lookups[] = {
        CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]),
 
        /* MSTP clocks */
+       CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]),
+
+       /* ICK */
        CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP47]),
        CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP46]),
        CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP45]),
index 571409b611d386b5067236248d129d2f0ca154a1..7348d58f500e9089bd46ef7a97cf4be79a8ec46b 100644 (file)
@@ -584,15 +584,15 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
        CLKDEV_DEV_ID("e6520000.i2c", &mstp_clks[MSTP300]),
        CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
-       CLKDEV_DEV_ID("ee220000.mmcif", &mstp_clks[MSTP305]),
+       CLKDEV_DEV_ID("ee220000.mmc", &mstp_clks[MSTP305]),
        CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]),
-       CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP312]),
+       CLKDEV_DEV_ID("ee140000.sd", &mstp_clks[MSTP312]),
        CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
-       CLKDEV_DEV_ID("ee120000.sdhi", &mstp_clks[MSTP313]),
+       CLKDEV_DEV_ID("ee120000.sd", &mstp_clks[MSTP313]),
        CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
-       CLKDEV_DEV_ID("ee100000.sdhi", &mstp_clks[MSTP314]),
+       CLKDEV_DEV_ID("ee100000.sd", &mstp_clks[MSTP314]),
        CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP315]),
-       CLKDEV_DEV_ID("ee200000.mmcif", &mstp_clks[MSTP315]),
+       CLKDEV_DEV_ID("ee200000.mmc", &mstp_clks[MSTP315]),
        CLKDEV_DEV_ID("e6550000.i2c", &mstp_clks[MSTP316]),
        CLKDEV_DEV_ID("e6560000.i2c", &mstp_clks[MSTP317]),
        CLKDEV_DEV_ID("e6500000.i2c", &mstp_clks[MSTP318]),
index c826bca4024e30bfc45a2cd07338f55cb5d97bac..dd989f93498f66bca2534f4a9daac35fe14ab7ef 100644 (file)
@@ -585,22 +585,23 @@ static struct clk_lookup lookups[] = {
 
        CLKDEV_DEV_ID("sh_cmt.10",              &mstp_clks[MSTP329]),
        CLKDEV_DEV_ID("sh_fsi2",                &mstp_clks[MSTP328]),
+       CLKDEV_DEV_ID("fe1f0000.sound",         &mstp_clks[MSTP328]),
        CLKDEV_DEV_ID("i2c-sh_mobile.1",        &mstp_clks[MSTP323]),
        CLKDEV_DEV_ID("e6c20000.i2c",           &mstp_clks[MSTP323]),
        CLKDEV_DEV_ID("renesas_usbhs",          &mstp_clks[MSTP320]),
        CLKDEV_DEV_ID("sh_mobile_sdhi.0",       &mstp_clks[MSTP314]),
-       CLKDEV_DEV_ID("e6850000.sdhi",          &mstp_clks[MSTP314]),
+       CLKDEV_DEV_ID("e6850000.sd",            &mstp_clks[MSTP314]),
        CLKDEV_DEV_ID("sh_mobile_sdhi.1",       &mstp_clks[MSTP313]),
-       CLKDEV_DEV_ID("e6860000.sdhi",          &mstp_clks[MSTP313]),
+       CLKDEV_DEV_ID("e6860000.sd",            &mstp_clks[MSTP313]),
        CLKDEV_DEV_ID("sh_mmcif",               &mstp_clks[MSTP312]),
-       CLKDEV_DEV_ID("e6bd0000.mmcif",         &mstp_clks[MSTP312]),
+       CLKDEV_DEV_ID("e6bd0000.mmc",           &mstp_clks[MSTP312]),
        CLKDEV_DEV_ID("r8a7740-gether",         &mstp_clks[MSTP309]),
        CLKDEV_DEV_ID("e9a00000.sh-eth",        &mstp_clks[MSTP309]),
        CLKDEV_DEV_ID("renesas-tpu-pwm",        &mstp_clks[MSTP304]),
        CLKDEV_DEV_ID("e6600000.pwm",           &mstp_clks[MSTP304]),
 
        CLKDEV_DEV_ID("sh_mobile_sdhi.2",       &mstp_clks[MSTP415]),
-       CLKDEV_DEV_ID("e6870000.sdhi",          &mstp_clks[MSTP415]),
+       CLKDEV_DEV_ID("e6870000.sd",            &mstp_clks[MSTP415]),
 
        /* ICK */
        CLKDEV_ICK_ID("host",   "renesas_usbhs",        &mstp_clks[MSTP416]),
index fb6af83858e3f0210f9eeaae2c2794a5a618ca48..9783945f8bc7972e9f13123c16335c3cbebefb9e 100644 (file)
@@ -115,6 +115,8 @@ static struct clk *main_clks[] = {
 };
 
 enum {
+       MSTP531, MSTP530,
+       MSTP529, MSTP528, MSTP527, MSTP526, MSTP525, MSTP524, MSTP523,
        MSTP331,
        MSTP323, MSTP322, MSTP321,
        MSTP311, MSTP310,
@@ -129,6 +131,15 @@ enum {
        MSTP_NR };
 
 static struct clk mstp_clks[MSTP_NR] = {
+       [MSTP531] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 31, 0), /* SCU0 */
+       [MSTP530] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 30, 0), /* SCU1 */
+       [MSTP529] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 29, 0), /* SCU2 */
+       [MSTP528] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 28, 0), /* SCU3 */
+       [MSTP527] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 27, 0), /* SCU4 */
+       [MSTP526] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 26, 0), /* SCU5 */
+       [MSTP525] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 25, 0), /* SCU6 */
+       [MSTP524] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 24, 0), /* SCU7 */
+       [MSTP523] = SH_CLK_MSTP32(&p_clk, MSTPCR5, 23, 0), /* SCU8 */
        [MSTP331] = SH_CLK_MSTP32(&s4_clk, MSTPCR3, 31, 0), /* MMC */
        [MSTP323] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 23, 0), /* SDHI0 */
        [MSTP322] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 22, 0), /* SDHI1 */
@@ -173,9 +184,13 @@ static struct clk_lookup lookups[] = {
 
        /* MSTP32 clocks */
        CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP331]), /* MMC */
+       CLKDEV_DEV_ID("ffe4e000.mmc", &mstp_clks[MSTP331]), /* MMC */
        CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */
+       CLKDEV_DEV_ID("ffe4c000.sd", &mstp_clks[MSTP323]), /* SDHI0 */
        CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
+       CLKDEV_DEV_ID("ffe4d000.sd", &mstp_clks[MSTP322]), /* SDHI1 */
        CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
+       CLKDEV_DEV_ID("ffe4f000.sd", &mstp_clks[MSTP321]), /* SDHI2 */
        CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
        CLKDEV_DEV_ID("r8a7778-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
        CLKDEV_DEV_ID("r8a7778-vin.1", &mstp_clks[MSTP109]), /* VIN1 */
@@ -183,9 +198,13 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
        CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP100]), /* USB FUNC */
        CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
+       CLKDEV_DEV_ID("ffc70000.i2c", &mstp_clks[MSTP030]), /* I2C0 */
        CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */
+       CLKDEV_DEV_ID("ffc71000.i2c", &mstp_clks[MSTP029]), /* I2C1 */
        CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */
+       CLKDEV_DEV_ID("ffc72000.i2c", &mstp_clks[MSTP028]), /* I2C2 */
        CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */
+       CLKDEV_DEV_ID("ffc73000.i2c", &mstp_clks[MSTP027]), /* I2C3 */
        CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
        CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
        CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
@@ -195,8 +214,11 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP016]), /* TMU00 */
        CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP015]), /* TMU01 */
        CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */
+       CLKDEV_DEV_ID("fffc7000.spi", &mstp_clks[MSTP007]), /* HSPI0 */
        CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
+       CLKDEV_DEV_ID("fffc8000.spi", &mstp_clks[MSTP007]), /* HSPI1 */
        CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */
+       CLKDEV_DEV_ID("fffc6000.spi", &mstp_clks[MSTP007]), /* HSPI2 */
        CLKDEV_DEV_ID("rcar_sound", &mstp_clks[MSTP008]), /* SRU */
 
        CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP012]),
@@ -208,6 +230,15 @@ static struct clk_lookup lookups[] = {
        CLKDEV_ICK_ID("ssi.6", "rcar_sound", &mstp_clks[MSTP309]),
        CLKDEV_ICK_ID("ssi.7", "rcar_sound", &mstp_clks[MSTP308]),
        CLKDEV_ICK_ID("ssi.8", "rcar_sound", &mstp_clks[MSTP307]),
+       CLKDEV_ICK_ID("scu.0", "rcar_sound", &mstp_clks[MSTP531]),
+       CLKDEV_ICK_ID("scu.1", "rcar_sound", &mstp_clks[MSTP530]),
+       CLKDEV_ICK_ID("scu.2", "rcar_sound", &mstp_clks[MSTP529]),
+       CLKDEV_ICK_ID("scu.3", "rcar_sound", &mstp_clks[MSTP528]),
+       CLKDEV_ICK_ID("scu.4", "rcar_sound", &mstp_clks[MSTP527]),
+       CLKDEV_ICK_ID("scu.5", "rcar_sound", &mstp_clks[MSTP526]),
+       CLKDEV_ICK_ID("scu.6", "rcar_sound", &mstp_clks[MSTP525]),
+       CLKDEV_ICK_ID("scu.7", "rcar_sound", &mstp_clks[MSTP524]),
+       CLKDEV_ICK_ID("scu.8", "rcar_sound", &mstp_clks[MSTP523]),
 };
 
 void __init r8a7778_clock_init(void)
index 1f7080fab0a53556a4ce5efb3cbf3368dce71465..f1fb89b76786a690037b154d907c9668707f192b 100644 (file)
@@ -184,9 +184,13 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP016]), /* TMU01 */
        CLKDEV_DEV_ID("sh_tmu.2", &mstp_clks[MSTP016]), /* TMU02 */
        CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
+       CLKDEV_DEV_ID("ffc70000.i2c", &mstp_clks[MSTP030]), /* I2C0 */
        CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */
+       CLKDEV_DEV_ID("ffc71000.i2c", &mstp_clks[MSTP029]), /* I2C1 */
        CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */
+       CLKDEV_DEV_ID("ffc72000.i2c", &mstp_clks[MSTP028]), /* I2C2 */
        CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */
+       CLKDEV_DEV_ID("ffc73000.i2c", &mstp_clks[MSTP027]), /* I2C3 */
        CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
        CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
        CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
@@ -194,12 +198,19 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */
        CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */
        CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */
+       CLKDEV_DEV_ID("fffc7000.spi", &mstp_clks[MSTP007]), /* HSPI0 */
        CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
+       CLKDEV_DEV_ID("fffc8000.spi", &mstp_clks[MSTP007]), /* HSPI1 */
        CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */
+       CLKDEV_DEV_ID("fffc6000.spi", &mstp_clks[MSTP007]), /* HSPI2 */
        CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */
+       CLKDEV_DEV_ID("ffe4c000.sd", &mstp_clks[MSTP323]), /* SDHI0 */
        CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
+       CLKDEV_DEV_ID("ffe4d000.sd", &mstp_clks[MSTP322]), /* SDHI1 */
        CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
+       CLKDEV_DEV_ID("ffe4e000.sd", &mstp_clks[MSTP321]), /* SDHI2 */
        CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */
+       CLKDEV_DEV_ID("ffe4f000.sd", &mstp_clks[MSTP320]), /* SDHI3 */
        CLKDEV_DEV_ID("rcar-du-r8a7779", &mstp_clks[MSTP103]), /* DU */
 };
 
index a64f965c7da142b118ab42a52afadeb5038dff81..f44987a92ad420d27fb3dab5638a1a1f6a32942a 100644 (file)
@@ -53,6 +53,7 @@
 #define SMSTPCR7 0xe615014c
 #define SMSTPCR8 0xe6150990
 #define SMSTPCR9 0xe6150994
+#define SMSTPCR10 0xe6150998
 
 #define SDCKCR         0xE6150074
 #define SD2CKCR                0xE6150078
@@ -77,7 +78,7 @@ static struct sh_clk_ops followparent_clk_ops = {
 };
 
 static struct clk main_clk = {
-       /* .parent will be set r8a73a4_clock_init */
+       /* .parent will be set r8a7790_clock_init */
        .ops    = &followparent_clk_ops,
 };
 
@@ -182,10 +183,14 @@ static struct clk div6_clks[DIV6_NR] = {
 
 /* MSTP */
 enum {
+       MSTP1015, MSTP1014, MSTP1013, MSTP1012, MSTP1011, MSTP1010,
+       MSTP1009, MSTP1008, MSTP1007, MSTP1006, MSTP1005,
        MSTP931, MSTP930, MSTP929, MSTP928,
+       MSTP917,
        MSTP813,
        MSTP726, MSTP725, MSTP724, MSTP723, MSTP722, MSTP721, MSTP720,
        MSTP717, MSTP716,
+       MSTP704,
        MSTP522,
        MSTP315, MSTP314, MSTP313, MSTP312, MSTP311, MSTP305, MSTP304,
        MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, MSTP202,
@@ -194,10 +199,22 @@ enum {
 };
 
 static struct clk mstp_clks[MSTP_NR] = {
-       [MSTP931] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 31, 0), /* I2C0 */
-       [MSTP930] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 30, 0), /* I2C1 */
-       [MSTP929] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 29, 0), /* I2C2 */
-       [MSTP928] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 28, 0), /* I2C3 */
+       [MSTP1015] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 15, 0), /* SSI0 */
+       [MSTP1014] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 14, 0), /* SSI1 */
+       [MSTP1013] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 13, 0), /* SSI2 */
+       [MSTP1012] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 12, 0), /* SSI3 */
+       [MSTP1011] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 11, 0), /* SSI4 */
+       [MSTP1010] = SH_CLK_MSTP32(&p_clk, SMSTPCR10, 10, 0), /* SSI5 */
+       [MSTP1009] = SH_CLK_MSTP32(&p_clk, SMSTPCR10,  9, 0), /* SSI6 */
+       [MSTP1008] = SH_CLK_MSTP32(&p_clk, SMSTPCR10,  8, 0), /* SSI7 */
+       [MSTP1007] = SH_CLK_MSTP32(&p_clk, SMSTPCR10,  7, 0), /* SSI8 */
+       [MSTP1006] = SH_CLK_MSTP32(&p_clk, SMSTPCR10,  6, 0), /* SSI9 */
+       [MSTP1005] = SH_CLK_MSTP32(&p_clk, SMSTPCR10,  5, 0), /* SSI ALL */
+       [MSTP931] = SH_CLK_MSTP32(&p_clk, SMSTPCR9, 31, 0), /* I2C0 */
+       [MSTP930] = SH_CLK_MSTP32(&p_clk, SMSTPCR9, 30, 0), /* I2C1 */
+       [MSTP929] = SH_CLK_MSTP32(&p_clk, SMSTPCR9, 29, 0), /* I2C2 */
+       [MSTP928] = SH_CLK_MSTP32(&p_clk, SMSTPCR9, 28, 0), /* I2C3 */
+       [MSTP917] = SH_CLK_MSTP32(&qspi_clk, SMSTPCR9, 17, 0), /* QSPI */
        [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */
        [MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */
        [MSTP725] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 25, 0), /* LVDS1 */
@@ -208,6 +225,7 @@ static struct clk mstp_clks[MSTP_NR] = {
        [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */
        [MSTP717] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 17, 0), /* HSCIF0 */
        [MSTP716] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 16, 0), /* HSCIF1 */
+       [MSTP704] = SH_CLK_MSTP32(&mp_clk, SMSTPCR7, 4, 0), /* HSUSB */
        [MSTP522] = SH_CLK_MSTP32(&extal_clk, SMSTPCR5, 22, 0), /* Thermal */
        [MSTP315] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC0], SMSTPCR3, 15, 0), /* MMC0 */
        [MSTP314] = SH_CLK_MSTP32(&div4_clks[DIV4_SD0], SMSTPCR3, 14, 0), /* SDHI0 */
@@ -262,11 +280,7 @@ static struct clk_lookup lookups[] = {
        CLKDEV_CON_ID("ssprs",          &div6_clks[DIV6_SSPRS]),
 
        /* MSTP */
-       CLKDEV_ICK_ID("lvds.0", "rcar-du-r8a7790", &mstp_clks[MSTP726]),
-       CLKDEV_ICK_ID("lvds.1", "rcar-du-r8a7790", &mstp_clks[MSTP725]),
-       CLKDEV_ICK_ID("du.0", "rcar-du-r8a7790", &mstp_clks[MSTP724]),
-       CLKDEV_ICK_ID("du.1", "rcar-du-r8a7790", &mstp_clks[MSTP723]),
-       CLKDEV_ICK_ID("du.2", "rcar-du-r8a7790", &mstp_clks[MSTP722]),
+       CLKDEV_DEV_ID("rcar_sound", &mstp_clks[MSTP1005]),
        CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
        CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
        CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]),
@@ -278,24 +292,50 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]),
        CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]),
        CLKDEV_DEV_ID("e6508000.i2c", &mstp_clks[MSTP931]),
+       CLKDEV_DEV_ID("i2c-rcar_gen2.0", &mstp_clks[MSTP931]),
        CLKDEV_DEV_ID("e6518000.i2c", &mstp_clks[MSTP930]),
+       CLKDEV_DEV_ID("i2c-rcar_gen2.1", &mstp_clks[MSTP930]),
        CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP929]),
+       CLKDEV_DEV_ID("i2c-rcar_gen2.2", &mstp_clks[MSTP929]),
        CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP928]),
+       CLKDEV_DEV_ID("i2c-rcar_gen2.3", &mstp_clks[MSTP928]),
        CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]),
+       CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]),
        CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
-       CLKDEV_DEV_ID("ee200000.mmcif", &mstp_clks[MSTP315]),
+       CLKDEV_DEV_ID("ee200000.mmc", &mstp_clks[MSTP315]),
        CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP315]),
-       CLKDEV_DEV_ID("ee100000.sdhi", &mstp_clks[MSTP314]),
+       CLKDEV_DEV_ID("ee100000.sd", &mstp_clks[MSTP314]),
        CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
-       CLKDEV_DEV_ID("ee120000.sdhi", &mstp_clks[MSTP313]),
+       CLKDEV_DEV_ID("ee120000.sd", &mstp_clks[MSTP313]),
        CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
-       CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP312]),
+       CLKDEV_DEV_ID("ee140000.sd", &mstp_clks[MSTP312]),
        CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]),
-       CLKDEV_DEV_ID("ee160000.sdhi", &mstp_clks[MSTP311]),
+       CLKDEV_DEV_ID("ee160000.sd", &mstp_clks[MSTP311]),
        CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP311]),
-       CLKDEV_DEV_ID("ee220000.mmcif", &mstp_clks[MSTP305]),
+       CLKDEV_DEV_ID("ee220000.mmc", &mstp_clks[MSTP305]),
        CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
        CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]),
+       CLKDEV_DEV_ID("qspi.0", &mstp_clks[MSTP917]),
+       CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP704]),
+
+       /* ICK */
+       CLKDEV_ICK_ID("usbhs", "usb_phy_rcar_gen2", &mstp_clks[MSTP704]),
+       CLKDEV_ICK_ID("lvds.0", "rcar-du-r8a7790", &mstp_clks[MSTP726]),
+       CLKDEV_ICK_ID("lvds.1", "rcar-du-r8a7790", &mstp_clks[MSTP725]),
+       CLKDEV_ICK_ID("du.0", "rcar-du-r8a7790", &mstp_clks[MSTP724]),
+       CLKDEV_ICK_ID("du.1", "rcar-du-r8a7790", &mstp_clks[MSTP723]),
+       CLKDEV_ICK_ID("du.2", "rcar-du-r8a7790", &mstp_clks[MSTP722]),
+       CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP1015]),
+       CLKDEV_ICK_ID("ssi.1", "rcar_sound", &mstp_clks[MSTP1014]),
+       CLKDEV_ICK_ID("ssi.2", "rcar_sound", &mstp_clks[MSTP1013]),
+       CLKDEV_ICK_ID("ssi.3", "rcar_sound", &mstp_clks[MSTP1012]),
+       CLKDEV_ICK_ID("ssi.4", "rcar_sound", &mstp_clks[MSTP1011]),
+       CLKDEV_ICK_ID("ssi.5", "rcar_sound", &mstp_clks[MSTP1010]),
+       CLKDEV_ICK_ID("ssi.6", "rcar_sound", &mstp_clks[MSTP1009]),
+       CLKDEV_ICK_ID("ssi.7", "rcar_sound", &mstp_clks[MSTP1008]),
+       CLKDEV_ICK_ID("ssi.8", "rcar_sound", &mstp_clks[MSTP1007]),
+       CLKDEV_ICK_ID("ssi.9", "rcar_sound", &mstp_clks[MSTP1006]),
+
 };
 
 #define R8A7790_CLOCK_ROOT(e, m, p0, p1, p30, p31)             \
@@ -321,10 +361,10 @@ void __init r8a7790_clock_init(void)
                R8A7790_CLOCK_ROOT(20, &extal_clk, 130, 156, 80, 66);
                break;
        case MD(14):
-               R8A7790_CLOCK_ROOT(26, &extal_div2_clk, 200, 240, 122, 102);
+               R8A7790_CLOCK_ROOT(26 / 2, &extal_div2_clk, 200, 240, 122, 102);
                break;
        case MD(13) | MD(14):
-               R8A7790_CLOCK_ROOT(30, &extal_div2_clk, 172, 208, 106, 88);
+               R8A7790_CLOCK_ROOT(30 / 2, &extal_div2_clk, 172, 208, 106, 88);
                break;
        }
 
index c9a26f16ce5b68bb1fc01a9c036a8299262df0e7..f5461262ee25ab1c04b5074a9055c686df363b94 100644 (file)
@@ -103,6 +103,7 @@ SH_FIXED_RATIO_CLK_SET(hp_clk,                      pll1_clk,       1, 12);
 SH_FIXED_RATIO_CLK_SET(p_clk,                  pll1_clk,       1, 24);
 SH_FIXED_RATIO_CLK_SET(rclk_clk,               pll1_clk,       1, (48 * 1024));
 SH_FIXED_RATIO_CLK_SET(mp_clk,                 pll1_div2_clk,  1, 15);
+SH_FIXED_RATIO_CLK_SET(zx_clk,                 pll1_clk,       1, 3);
 
 static struct clk *main_clks[] = {
        &extal_clk,
@@ -116,12 +117,15 @@ static struct clk *main_clks[] = {
        &rclk_clk,
        &mp_clk,
        &cp_clk,
+       &zx_clk,
 };
 
 /* MSTP */
 enum {
-       MSTP721, MSTP720,
+       MSTP813,
+       MSTP726, MSTP724, MSTP723, MSTP721, MSTP720,
        MSTP719, MSTP718, MSTP715, MSTP714,
+       MSTP522,
        MSTP216, MSTP207, MSTP206,
        MSTP204, MSTP203, MSTP202, MSTP1105, MSTP1106, MSTP1107,
        MSTP124,
@@ -129,12 +133,17 @@ enum {
 };
 
 static struct clk mstp_clks[MSTP_NR] = {
+       [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */
+       [MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */
+       [MSTP724] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 24, 0), /* DU0 */
+       [MSTP723] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 23, 0), /* DU1 */
        [MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */
        [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */
        [MSTP719] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 19, 0), /* SCIF2 */
        [MSTP718] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 18, 0), /* SCIF3 */
        [MSTP715] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 15, 0), /* SCIF4 */
        [MSTP714] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 14, 0), /* SCIF5 */
+       [MSTP522] = SH_CLK_MSTP32(&extal_clk, SMSTPCR5, 22, 0), /* Thermal */
        [MSTP216] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 16, 0), /* SCIFB2 */
        [MSTP207] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 7, 0), /* SCIFB1 */
        [MSTP206] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 6, 0), /* SCIFB0 */
@@ -164,6 +173,9 @@ static struct clk_lookup lookups[] = {
        CLKDEV_CON_ID("peripheral_clk", &hp_clk),
 
        /* MSTP */
+       CLKDEV_ICK_ID("lvds.0", "rcar-du-r8a7791", &mstp_clks[MSTP726]),
+       CLKDEV_ICK_ID("du.0", "rcar-du-r8a7791", &mstp_clks[MSTP724]),
+       CLKDEV_ICK_ID("du.1", "rcar-du-r8a7791", &mstp_clks[MSTP723]),
        CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
        CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
        CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), /* SCIFB0 */
@@ -180,6 +192,9 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("sh-sci.13", &mstp_clks[MSTP1106]), /* SCIFA4 */
        CLKDEV_DEV_ID("sh-sci.14", &mstp_clks[MSTP1107]), /* SCIFA5 */
        CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]),
+       CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]),
+       CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
+       CLKDEV_DEV_ID("r8a7791-ether", &mstp_clks[MSTP813]), /* Ether */
 };
 
 #define R8A7791_CLOCK_ROOT(e, m, p0, p1, p30, p31)             \
index 5390c6bbbc02dd389852ba519118ddaab2222a37..28489978b09ca949e7f6b1209a7f200c2373ae16 100644 (file)
@@ -504,10 +504,6 @@ static struct clk_lookup lookups[] = {
        CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]),
        CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]),
        CLKDEV_CON_ID("hdmi_clk", &div6_reparent_clks[DIV6_HDMI]),
-       CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
-       CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
-       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
-       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
 
        /* MSTP32 clocks */
        CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */
@@ -574,6 +570,11 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
        CLKDEV_DEV_ID("sh_cmt.2", &mstp_clks[MSTP400]), /* CMT2 */
 
+       /* ICK */
+       CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
+       CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
+       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
+       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
        CLKDEV_ICK_ID("hdmi", "sh_mobile_lcdc_fb.1",
                      &div6_reparent_clks[DIV6_HDMI]),
        CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]),
index c92c023f0d27c1de8778665e372d1abfba82db42..23edf8360c273ce502f3960963e35409be5ee4dd 100644 (file)
@@ -625,12 +625,6 @@ static struct clk_lookup lookups[] = {
        CLKDEV_CON_ID("sdhi0_clk", &div6_clks[DIV6_SDHI0]),
        CLKDEV_CON_ID("sdhi1_clk", &div6_clks[DIV6_SDHI1]),
        CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]),
-       CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
-       CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
-       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
-       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
-       CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk),
-       CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk),
 
        /* MSTP32 clocks */
        CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
@@ -658,18 +652,19 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */
        CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
        CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */
+       CLKDEV_DEV_ID("ec230000.sound", &mstp_clks[MSTP328]), /* FSI */
        CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */
        CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */
        CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */
        CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */
        CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
-       CLKDEV_DEV_ID("ee100000.sdhi", &mstp_clks[MSTP314]), /* SDHI0 */
+       CLKDEV_DEV_ID("ee100000.sd", &mstp_clks[MSTP314]), /* SDHI0 */
        CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
-       CLKDEV_DEV_ID("ee120000.sdhi", &mstp_clks[MSTP313]), /* SDHI1 */
+       CLKDEV_DEV_ID("ee120000.sd", &mstp_clks[MSTP313]), /* SDHI1 */
        CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */
-       CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), /* MMCIF0 */
+       CLKDEV_DEV_ID("e6bd0000.mmc", &mstp_clks[MSTP312]), /* MMCIF0 */
        CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */
-       CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP311]), /* SDHI2 */
+       CLKDEV_DEV_ID("ee140000.sd", &mstp_clks[MSTP311]), /* SDHI2 */
        CLKDEV_DEV_ID("renesas-tpu-pwm.0", &mstp_clks[MSTP304]), /* TPU0 */
        CLKDEV_DEV_ID("renesas-tpu-pwm.1", &mstp_clks[MSTP303]), /* TPU1 */
        CLKDEV_DEV_ID("renesas-tpu-pwm.2", &mstp_clks[MSTP302]), /* TPU2 */
@@ -680,6 +675,14 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */
        CLKDEV_DEV_ID("e6828000.i2c", &mstp_clks[MSTP410]), /* I2C4 */
        CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
+
+       /* ICK */
+       CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
+       CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
+       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
+       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
+       CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk),
+       CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk),
 };
 
 void __init sh73a0_clock_init(void)
index c2eb7568d9bed4080b468efa9aba4a26e7d6d043..fcb142a14e0756b55eedec81a63fb0c78e51f302 100644 (file)
@@ -3,12 +3,7 @@
 
 extern void emev2_map_io(void);
 extern void emev2_init_delay(void);
-extern void emev2_add_standard_devices(void);
 extern void emev2_clock_init(void);
-
-#define EMEV2_GPIO_BASE 200
-#define EMEV2_GPIO_IRQ(n) (EMEV2_GPIO_BASE + (n))
-
 extern struct smp_operations emev2_smp_ops;
 
 #endif /* __ASM_EMEV2_H__ */
index 441886c9714baddffb609247b872fca7054c514a..f4076a50e970a357c8c9dfbbbc07d4f6d61ada25 100644 (file)
 #define __ASM_R8A7778_H__
 
 #include <linux/sh_eth.h>
-#include <linux/platform_data/camera-rcar.h>
 
 /* HPB-DMA slave IDs */
 enum {
        HPBDMA_SLAVE_DUMMY,
        HPBDMA_SLAVE_SDHI0_TX,
        HPBDMA_SLAVE_SDHI0_RX,
+       HPBDMA_SLAVE_SSI0_TX,
+       HPBDMA_SLAVE_SSI0_RX,
+       HPBDMA_SLAVE_SSI1_TX,
+       HPBDMA_SLAVE_SSI1_RX,
+       HPBDMA_SLAVE_SSI2_TX,
+       HPBDMA_SLAVE_SSI2_RX,
+       HPBDMA_SLAVE_SSI3_TX,
+       HPBDMA_SLAVE_SSI3_RX,
+       HPBDMA_SLAVE_SSI4_TX,
+       HPBDMA_SLAVE_SSI4_RX,
+       HPBDMA_SLAVE_SSI5_TX,
+       HPBDMA_SLAVE_SSI5_RX,
+       HPBDMA_SLAVE_SSI6_TX,
+       HPBDMA_SLAVE_SSI6_RX,
+       HPBDMA_SLAVE_SSI7_TX,
+       HPBDMA_SLAVE_SSI7_RX,
+       HPBDMA_SLAVE_SSI8_TX,
+       HPBDMA_SLAVE_SSI8_RX,
+       HPBDMA_SLAVE_HPBIF0_TX,
+       HPBDMA_SLAVE_HPBIF0_RX,
+       HPBDMA_SLAVE_HPBIF1_TX,
+       HPBDMA_SLAVE_HPBIF1_RX,
+       HPBDMA_SLAVE_HPBIF2_TX,
+       HPBDMA_SLAVE_HPBIF2_RX,
+       HPBDMA_SLAVE_HPBIF3_TX,
+       HPBDMA_SLAVE_HPBIF3_RX,
+       HPBDMA_SLAVE_HPBIF4_TX,
+       HPBDMA_SLAVE_HPBIF4_RX,
+       HPBDMA_SLAVE_HPBIF5_TX,
+       HPBDMA_SLAVE_HPBIF5_RX,
+       HPBDMA_SLAVE_HPBIF6_TX,
+       HPBDMA_SLAVE_HPBIF6_RX,
+       HPBDMA_SLAVE_HPBIF7_TX,
+       HPBDMA_SLAVE_HPBIF7_RX,
+       HPBDMA_SLAVE_HPBIF8_TX,
+       HPBDMA_SLAVE_HPBIF8_RX,
+       HPBDMA_SLAVE_USBFUNC_TX,
+       HPBDMA_SLAVE_USBFUNC_RX,
 };
 
 extern void r8a7778_add_standard_devices(void);
index 17af34ed89c801553b248f12f0d3c39336553854..b40e13631f6a2040887ffdada677c7c7ed58b260 100644 (file)
@@ -3,8 +3,6 @@
 
 #include <linux/sh_clk.h>
 #include <linux/pm_domain.h>
-#include <linux/sh_eth.h>
-#include <linux/platform_data/camera-rcar.h>
 
 /* HPB-DMA slave IDs */
 enum {
@@ -13,8 +11,6 @@ enum {
        HPBDMA_SLAVE_SDHI0_RX,
 };
 
-struct platform_device;
-
 struct r8a7779_pm_ch {
        unsigned long chan_offs;
        unsigned int chan_bit;
@@ -40,9 +36,6 @@ extern void r8a7779_earlytimer_init(void);
 extern void r8a7779_add_early_devices(void);
 extern void r8a7779_add_standard_devices(void);
 extern void r8a7779_add_standard_devices_dt(void);
-extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata);
-extern void r8a7779_add_vin_device(int idx,
-                                  struct rcar_vin_platform_data *pdata);
 extern void r8a7779_init_late(void);
 extern void r8a7779_clock_init(void);
 extern void r8a7779_pinmux_init(void);
index 051ead3c286e7f4a7bc2015bb8e384e74972cc5c..200fa699f730e81fe8e02336ee69e07cc20e6898 100644 (file)
@@ -4,6 +4,7 @@
 void r8a7791_add_standard_devices(void);
 void r8a7791_add_dt_devices(void);
 void r8a7791_clock_init(void);
+void r8a7791_pinmux_init(void);
 void r8a7791_init_early(void);
 extern struct smp_operations r8a7791_smp_ops;
 
index 3ad531caf4f098a172d01824263546c5e2cc2c08..c8f2a1a69a5274bec8eab99f44549fb3bbbae955 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
+#include <linux/clk-provider.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/platform_device.h>
-#include <linux/platform_data/gpio-em.h>
 #include <linux/of_platform.h>
-#include <linux/delay.h>
-#include <linux/input.h>
-#include <linux/io.h>
-#include <linux/irqchip/arm-gic.h>
 #include <mach/common.h>
 #include <mach/emev2.h>
-#include <mach/irqs.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
-#include <asm/mach/time.h>
 
 static struct map_desc emev2_io_desc[] __initdata = {
 #ifdef CONFIG_SMP
@@ -52,150 +43,20 @@ void __init emev2_map_io(void)
        iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
 }
 
-/* UART */
-static struct resource uart0_resources[] = {
-       DEFINE_RES_MEM(0xe1020000, 0x38),
-       DEFINE_RES_IRQ(40),
-};
-
-static struct resource uart1_resources[] = {
-       DEFINE_RES_MEM(0xe1030000, 0x38),
-       DEFINE_RES_IRQ(41),
-};
-
-static struct resource uart2_resources[] = {
-       DEFINE_RES_MEM(0xe1040000, 0x38),
-       DEFINE_RES_IRQ(42),
-};
-
-static struct resource uart3_resources[] = {
-       DEFINE_RES_MEM(0xe1050000, 0x38),
-       DEFINE_RES_IRQ(43),
-};
-
-#define emev2_register_uart(idx)                                       \
-       platform_device_register_simple("serial8250-em", idx,           \
-                                       uart##idx##_resources,          \
-                                       ARRAY_SIZE(uart##idx##_resources))
-
-/* STI */
-static struct resource sti_resources[] = {
-       DEFINE_RES_MEM(0xe0180000, 0x54),
-       DEFINE_RES_IRQ(157),
-};
-
-#define emev2_register_sti()                                   \
-       platform_device_register_simple("em_sti", 0,            \
-                                       sti_resources,          \
-                                       ARRAY_SIZE(sti_resources))
-
-/* GIO */
-static struct gpio_em_config gio0_config = {
-       .gpio_base = 0,
-       .irq_base = EMEV2_GPIO_IRQ(0),
-       .number_of_pins = 32,
-};
-
-static struct resource gio0_resources[] = {
-       DEFINE_RES_MEM(0xe0050000, 0x2c),
-       DEFINE_RES_MEM(0xe0050040, 0x20),
-       DEFINE_RES_IRQ(99),
-       DEFINE_RES_IRQ(100),
-};
-
-static struct gpio_em_config gio1_config = {
-       .gpio_base = 32,
-       .irq_base = EMEV2_GPIO_IRQ(32),
-       .number_of_pins = 32,
-};
-
-static struct resource gio1_resources[] = {
-       DEFINE_RES_MEM(0xe0050080, 0x2c),
-       DEFINE_RES_MEM(0xe00500c0, 0x20),
-       DEFINE_RES_IRQ(101),
-       DEFINE_RES_IRQ(102),
-};
-
-static struct gpio_em_config gio2_config = {
-       .gpio_base = 64,
-       .irq_base = EMEV2_GPIO_IRQ(64),
-       .number_of_pins = 32,
-};
-
-static struct resource gio2_resources[] = {
-       DEFINE_RES_MEM(0xe0050100, 0x2c),
-       DEFINE_RES_MEM(0xe0050140, 0x20),
-       DEFINE_RES_IRQ(103),
-       DEFINE_RES_IRQ(104),
-};
-
-static struct gpio_em_config gio3_config = {
-       .gpio_base = 96,
-       .irq_base = EMEV2_GPIO_IRQ(96),
-       .number_of_pins = 32,
-};
-
-static struct resource gio3_resources[] = {
-       DEFINE_RES_MEM(0xe0050180, 0x2c),
-       DEFINE_RES_MEM(0xe00501c0, 0x20),
-       DEFINE_RES_IRQ(105),
-       DEFINE_RES_IRQ(106),
-};
-
-static struct gpio_em_config gio4_config = {
-       .gpio_base = 128,
-       .irq_base = EMEV2_GPIO_IRQ(128),
-       .number_of_pins = 31,
-};
-
-static struct resource gio4_resources[] = {
-       DEFINE_RES_MEM(0xe0050200, 0x2c),
-       DEFINE_RES_MEM(0xe0050240, 0x20),
-       DEFINE_RES_IRQ(107),
-       DEFINE_RES_IRQ(108),
-};
-
-#define emev2_register_gio(idx)                                                \
-       platform_device_register_resndata(&platform_bus, "em_gio",      \
-                                         idx, gio##idx##_resources,    \
-                                         ARRAY_SIZE(gio##idx##_resources), \
-                                         &gio##idx##_config,           \
-                                         sizeof(struct gpio_em_config))
-
-static struct resource pmu_resources[] = {
-       DEFINE_RES_IRQ(152),
-       DEFINE_RES_IRQ(153),
-};
-
-#define emev2_register_pmu()                                   \
-       platform_device_register_simple("arm-pmu", -1,          \
-                                       pmu_resources,          \
-                                       ARRAY_SIZE(pmu_resources))
-
-void __init emev2_add_standard_devices(void)
-{
-       if (!IS_ENABLED(CONFIG_COMMON_CLK))
-               emev2_clock_init();
-
-       emev2_register_uart(0);
-       emev2_register_uart(1);
-       emev2_register_uart(2);
-       emev2_register_uart(3);
-       emev2_register_sti();
-       emev2_register_gio(0);
-       emev2_register_gio(1);
-       emev2_register_gio(2);
-       emev2_register_gio(3);
-       emev2_register_gio(4);
-       emev2_register_pmu();
-}
-
 void __init emev2_init_delay(void)
 {
        shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
 }
 
-#ifdef CONFIG_USE_OF
+static void __init emev2_add_standard_devices_dt(void)
+{
+#ifdef CONFIG_COMMON_CLK
+       of_clk_init(NULL);
+#else
+       emev2_clock_init();
+#endif
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
 
 static const char *emev2_boards_compat_dt[] __initdata = {
        "renesas,emev2",
@@ -206,7 +67,7 @@ DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
        .smp            = smp_ops(emev2_smp_ops),
        .map_io         = emev2_map_io,
        .init_early     = emev2_init_delay,
+       .init_machine   = emev2_add_standard_devices_dt,
+       .init_late      = shmobile_init_late,
        .dt_compat      = emev2_boards_compat_dt,
 MACHINE_END
-
-#endif /* CONFIG_USE_OF */
index d4eb509a1c878b2add188c4760b30684773535ac..9c0b3a9d5f7ab1c351498e15bed806ab84f7985d 100644 (file)
 #include <linux/kernel.h>
 #include <linux/of_platform.h>
 #include <linux/serial_sci.h>
+#include <linux/sh_timer.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/r7s72100.h>
 #include <asm/mach/arch.h>
 
-#define SCIF_DATA(index, baseaddr, irq)                                        \
-[index] = {                                                            \
+#define R7S72100_SCIF(index, baseaddr, irq)                            \
+static const struct plat_sci_port scif##index##_platform_data = {      \
        .type           = PORT_SCIF,                                    \
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,               \
        .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,              \
-       .scbrr_algo_id  = SCBRR_ALGO_2,                                 \
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | \
                          SCSCR_REIE,                                   \
-       .mapbase        = baseaddr,                                     \
-       .irqs           = { irq + 1, irq + 2, irq + 3, irq },           \
-}
+};                                                                     \
+                                                                       \
+static struct resource scif##index##_resources[] = {                   \
+       DEFINE_RES_MEM(baseaddr, 0x100),                                \
+       DEFINE_RES_IRQ(irq + 1),                                        \
+       DEFINE_RES_IRQ(irq + 2),                                        \
+       DEFINE_RES_IRQ(irq + 3),                                        \
+       DEFINE_RES_IRQ(irq),                                            \
+}                                                                      \
+
+R7S72100_SCIF(0, 0xe8007000, gic_iid(221));
+R7S72100_SCIF(1, 0xe8007800, gic_iid(225));
+R7S72100_SCIF(2, 0xe8008000, gic_iid(229));
+R7S72100_SCIF(3, 0xe8008800, gic_iid(233));
+R7S72100_SCIF(4, 0xe8009000, gic_iid(237));
+R7S72100_SCIF(5, 0xe8009800, gic_iid(241));
+R7S72100_SCIF(6, 0xe800a000, gic_iid(245));
+R7S72100_SCIF(7, 0xe800a800, gic_iid(249));
 
-enum { SCIF0, SCIF1, SCIF2, SCIF3, SCIF4, SCIF5, SCIF6, SCIF7 };
+#define r7s72100_register_scif(index)                                         \
+       platform_device_register_resndata(&platform_bus, "sh-sci", index,      \
+                                         scif##index##_resources,             \
+                                         ARRAY_SIZE(scif##index##_resources), \
+                                         &scif##index##_platform_data,        \
+                                         sizeof(scif##index##_platform_data))
 
-static const struct plat_sci_port scif[] __initconst = {
-       SCIF_DATA(SCIF0, 0xe8007000, gic_iid(221)), /* SCIF0 */
-       SCIF_DATA(SCIF1, 0xe8007800, gic_iid(225)), /* SCIF1 */
-       SCIF_DATA(SCIF2, 0xe8008000, gic_iid(229)), /* SCIF2 */
-       SCIF_DATA(SCIF3, 0xe8008800, gic_iid(233)), /* SCIF3 */
-       SCIF_DATA(SCIF4, 0xe8009000, gic_iid(237)), /* SCIF4 */
-       SCIF_DATA(SCIF5, 0xe8009800, gic_iid(241)), /* SCIF5 */
-       SCIF_DATA(SCIF6, 0xe800a000, gic_iid(245)), /* SCIF6 */
-       SCIF_DATA(SCIF7, 0xe800a800, gic_iid(249)), /* SCIF7 */
+
+static struct sh_timer_config mtu2_0_platform_data __initdata = {
+       .name = "MTU2_0",
+       .timer_bit = 0,
+       .channel_offset = -0x80,
+       .clockevent_rating = 200,
 };
 
-static inline void r7s72100_register_scif(int idx)
-{
-       platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx],
-                                     sizeof(struct plat_sci_port));
-}
+static struct resource mtu2_0_resources[] __initdata = {
+       DEFINE_RES_MEM(0xfcff0300, 0x27),
+       DEFINE_RES_IRQ(gic_iid(139)), /* MTU2 TGI0A */
+};
+
+#define r7s72100_register_mtu2(idx)                                    \
+       platform_device_register_resndata(&platform_bus, "sh_mtu2",     \
+                                         idx, mtu2_##idx##_resources,  \
+                                         ARRAY_SIZE(mtu2_##idx##_resources), \
+                                         &mtu2_##idx##_platform_data,  \
+                                         sizeof(struct sh_timer_config))
 
 void __init r7s72100_add_dt_devices(void)
 {
-       r7s72100_register_scif(SCIF0);
-       r7s72100_register_scif(SCIF1);
-       r7s72100_register_scif(SCIF2);
-       r7s72100_register_scif(SCIF3);
-       r7s72100_register_scif(SCIF4);
-       r7s72100_register_scif(SCIF5);
-       r7s72100_register_scif(SCIF6);
-       r7s72100_register_scif(SCIF7);
+       r7s72100_register_scif(0);
+       r7s72100_register_scif(1);
+       r7s72100_register_scif(2);
+       r7s72100_register_scif(3);
+       r7s72100_register_scif(4);
+       r7s72100_register_scif(5);
+       r7s72100_register_scif(6);
+       r7s72100_register_scif(7);
+       r7s72100_register_mtu2(0);
 }
 
 void __init r7s72100_init_early(void)
index b0f2749071bec3feee42e44a82c52449a8494e81..cd36f8078325ee402deef4b1c6abbd8f79f0c878 100644 (file)
@@ -40,41 +40,39 @@ void __init r8a73a4_pinmux_init(void)
                                        ARRAY_SIZE(pfc_resources));
 }
 
-#define SCIF_COMMON(scif_type, baseaddr, irq)                  \
+#define R8A73A4_SCIF(scif_type, _scscr, index, baseaddr, irq)  \
+static struct plat_sci_port scif##index##_platform_data = {    \
        .type           = scif_type,                            \
-       .mapbase        = baseaddr,                             \
        .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,      \
-       .scbrr_algo_id  = SCBRR_ALGO_4,                         \
-       .irqs           = SCIx_IRQ_MUXED(irq)
-
-#define SCIFA_DATA(index, baseaddr, irq)               \
-[index] = {                                            \
-       SCIF_COMMON(PORT_SCIFA, baseaddr, irq),         \
-       .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE0,      \
+       .scscr          = _scscr,                               \
+};                                                             \
+                                                               \
+static struct resource scif##index##_resources[] = {           \
+       DEFINE_RES_MEM(baseaddr, 0x100),                        \
+       DEFINE_RES_IRQ(irq),                                    \
 }
 
-#define SCIFB_DATA(index, baseaddr, irq)       \
-[index] = {                                    \
-       SCIF_COMMON(PORT_SCIFB, baseaddr, irq), \
-       .scscr = SCSCR_RE | SCSCR_TE,           \
-}
+#define R8A73A4_SCIFA(index, baseaddr, irq)    \
+       R8A73A4_SCIF(PORT_SCIFA, SCSCR_RE | SCSCR_TE | SCSCR_CKE0, \
+                    index, baseaddr, irq)
 
-enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFB3 };
+#define R8A73A4_SCIFB(index, baseaddr, irq)    \
+       R8A73A4_SCIF(PORT_SCIFB, SCSCR_RE | SCSCR_TE, \
+                    index, baseaddr, irq)
 
-static const struct plat_sci_port scif[] = {
-       SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */
-       SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */
-       SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */
-       SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */
-       SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */
-       SCIFB_DATA(SCIFB3, 0xe6cf0000, gic_spi(151)), /* SCIFB3 */
-};
+R8A73A4_SCIFA(0, 0xe6c40000, gic_spi(144)); /* SCIFA0 */
+R8A73A4_SCIFA(1, 0xe6c50000, gic_spi(145)); /* SCIFA1 */
+R8A73A4_SCIFB(2, 0xe6c20000, gic_spi(148)); /* SCIFB0 */
+R8A73A4_SCIFB(3, 0xe6c30000, gic_spi(149)); /* SCIFB1 */
+R8A73A4_SCIFB(4, 0xe6ce0000, gic_spi(150)); /* SCIFB2 */
+R8A73A4_SCIFB(5, 0xe6cf0000, gic_spi(151)); /* SCIFB3 */
 
-static inline void r8a73a4_register_scif(int idx)
-{
-       platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx],
-                                     sizeof(struct plat_sci_port));
-}
+#define r8a73a4_register_scif(index)                                          \
+       platform_device_register_resndata(&platform_bus, "sh-sci", index,      \
+                                         scif##index##_resources,             \
+                                         ARRAY_SIZE(scif##index##_resources), \
+                                         &scif##index##_platform_data,        \
+                                         sizeof(scif##index##_platform_data))
 
 static const struct renesas_irqc_config irqc0_data = {
        .irq_base = irq_pin(0), /* IRQ0 -> IRQ31 */
@@ -192,12 +190,12 @@ static struct resource cmt10_resources[] = {
 
 void __init r8a73a4_add_dt_devices(void)
 {
-       r8a73a4_register_scif(SCIFA0);
-       r8a73a4_register_scif(SCIFA1);
-       r8a73a4_register_scif(SCIFB0);
-       r8a73a4_register_scif(SCIFB1);
-       r8a73a4_register_scif(SCIFB2);
-       r8a73a4_register_scif(SCIFB3);
+       r8a73a4_register_scif(0);
+       r8a73a4_register_scif(1);
+       r8a73a4_register_scif(2);
+       r8a73a4_register_scif(3);
+       r8a73a4_register_scif(4);
+       r8a73a4_register_scif(5);
        r8a7790_register_cmt(10);
 }
 
@@ -275,7 +273,7 @@ static const struct sh_dmae_pdata dma_pdata = {
 
 static struct resource dma_resources[] = {
        DEFINE_RES_MEM(0xe6700020, 0x89e0),
-       DEFINE_RES_IRQ_NAMED(gic_spi(220), "error_irq"),
+       DEFINE_RES_IRQ(gic_spi(220)),
        {
                /* IRQ for channels 0-19 */
                .start  = gic_spi(200),
index b7d4b2c3bc2974d5778414ac5335f9042f7bc2d2..8f3c68101d59d7f3423e59ee98eb361e73b6a856 100644 (file)
@@ -203,167 +203,38 @@ static struct platform_device irqpin3_device = {
        },
 };
 
-/* SCIFA0 */
-static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xe6c40000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(gic_spi(100)),
-};
-
-static struct platform_device scif0_device = {
-       .name           = "sh-sci",
-       .id             = 0,
-       .dev            = {
-               .platform_data  = &scif0_platform_data,
-       },
-};
-
-/* SCIFA1 */
-static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xe6c50000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(gic_spi(101)),
-};
-
-static struct platform_device scif1_device = {
-       .name           = "sh-sci",
-       .id             = 1,
-       .dev            = {
-               .platform_data  = &scif1_platform_data,
-       },
-};
-
-/* SCIFA2 */
-static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xe6c60000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(gic_spi(102)),
-};
-
-static struct platform_device scif2_device = {
-       .name           = "sh-sci",
-       .id             = 2,
-       .dev            = {
-               .platform_data  = &scif2_platform_data,
-       },
-};
-
-/* SCIFA3 */
-static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xe6c70000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(gic_spi(103)),
-};
-
-static struct platform_device scif3_device = {
-       .name           = "sh-sci",
-       .id             = 3,
-       .dev            = {
-               .platform_data  = &scif3_platform_data,
-       },
-};
-
-/* SCIFA4 */
-static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xe6c80000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(gic_spi(104)),
-};
-
-static struct platform_device scif4_device = {
-       .name           = "sh-sci",
-       .id             = 4,
-       .dev            = {
-               .platform_data  = &scif4_platform_data,
-       },
-};
-
-/* SCIFA5 */
-static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xe6cb0000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(gic_spi(105)),
-};
-
-static struct platform_device scif5_device = {
-       .name           = "sh-sci",
-       .id             = 5,
-       .dev            = {
-               .platform_data  = &scif5_platform_data,
-       },
-};
-
-/* SCIFA6 */
-static struct plat_sci_port scif6_platform_data = {
-       .mapbase        = 0xe6cc0000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(gic_spi(106)),
-};
-
-static struct platform_device scif6_device = {
-       .name           = "sh-sci",
-       .id             = 6,
-       .dev            = {
-               .platform_data  = &scif6_platform_data,
-       },
-};
-
-/* SCIFA7 */
-static struct plat_sci_port scif7_platform_data = {
-       .mapbase        = 0xe6cd0000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(gic_spi(107)),
-};
-
-static struct platform_device scif7_device = {
-       .name           = "sh-sci",
-       .id             = 7,
-       .dev            = {
-               .platform_data  = &scif7_platform_data,
-       },
-};
-
-/* SCIFB */
-static struct plat_sci_port scifb_platform_data = {
-       .mapbase        = 0xe6c30000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFB,
-       .irqs           = SCIx_IRQ_MUXED(gic_spi(108)),
-};
+/* SCIF */
+#define R8A7740_SCIF(scif_type, index, baseaddr, irq)          \
+static struct plat_sci_port scif##index##_platform_data = {    \
+       .type           = scif_type,                            \
+       .flags          = UPF_BOOT_AUTOCONF,                    \
+       .scscr          = SCSCR_RE | SCSCR_TE,                  \
+};                                                             \
+                                                               \
+static struct resource scif##index##_resources[] = {           \
+       DEFINE_RES_MEM(baseaddr, 0x100),                        \
+       DEFINE_RES_IRQ(irq),                                    \
+};                                                             \
+                                                               \
+static struct platform_device scif##index##_device = {         \
+       .name           = "sh-sci",                             \
+       .id             = index,                                \
+       .resource       = scif##index##_resources,              \
+       .num_resources  = ARRAY_SIZE(scif##index##_resources),  \
+       .dev            = {                                     \
+               .platform_data  = &scif##index##_platform_data, \
+       },                                                      \
+}
 
-static struct platform_device scifb_device = {
-       .name           = "sh-sci",
-       .id             = 8,
-       .dev            = {
-               .platform_data  = &scifb_platform_data,
-       },
-};
+R8A7740_SCIF(PORT_SCIFA, 0, 0xe6c40000, gic_spi(100));
+R8A7740_SCIF(PORT_SCIFA, 1, 0xe6c50000, gic_spi(101));
+R8A7740_SCIF(PORT_SCIFA, 2, 0xe6c60000, gic_spi(102));
+R8A7740_SCIF(PORT_SCIFA, 3, 0xe6c70000, gic_spi(103));
+R8A7740_SCIF(PORT_SCIFA, 4, 0xe6c80000, gic_spi(104));
+R8A7740_SCIF(PORT_SCIFA, 5, 0xe6cb0000, gic_spi(105));
+R8A7740_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(106));
+R8A7740_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(107));
+R8A7740_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(108));
 
 /* CMT */
 static struct sh_timer_config cmt10_platform_data = {
@@ -528,7 +399,7 @@ static struct platform_device *r8a7740_devices_dt[] __initdata = {
        &scif5_device,
        &scif6_device,
        &scif7_device,
-       &scifb_device,
+       &scif8_device,
        &cmt10_device,
 };
 
@@ -981,7 +852,7 @@ void __init r8a7740_add_standard_devices(void)
        rmobile_add_device_to_domain("A3SP",    &scif5_device);
        rmobile_add_device_to_domain("A3SP",    &scif6_device);
        rmobile_add_device_to_domain("A3SP",    &scif7_device);
-       rmobile_add_device_to_domain("A3SP",    &scifb_device);
+       rmobile_add_device_to_domain("A3SP",    &scif8_device);
        rmobile_add_device_to_domain("A3SP",    &i2c1_device);
 }
 
index 03fcc5974ef92170c5002bf857ddb35e95a49d57..6d694526e4ca1b09be05a64cd163c4f83540e4df 100644 (file)
 #include <asm/hardware/cache-l2x0.h>
 
 /* SCIF */
-#define SCIF_INFO(baseaddr, irq)                               \
-{                                                              \
-       .mapbase        = baseaddr,                             \
+#define R8A7778_SCIF(index, baseaddr, irq)                     \
+static struct plat_sci_port scif##index##_platform_data = {    \
        .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,      \
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,     \
-       .scbrr_algo_id  = SCBRR_ALGO_2,                         \
        .type           = PORT_SCIF,                            \
-       .irqs           = SCIx_IRQ_MUXED(irq),                  \
+};                                                             \
+                                                               \
+static struct resource scif##index##_resources[] = {           \
+       DEFINE_RES_MEM(baseaddr, 0x100),                        \
+       DEFINE_RES_IRQ(irq),                                    \
 }
 
-static struct plat_sci_port scif_platform_data[] __initdata = {
-       SCIF_INFO(0xffe40000, gic_iid(0x66)),
-       SCIF_INFO(0xffe41000, gic_iid(0x67)),
-       SCIF_INFO(0xffe42000, gic_iid(0x68)),
-       SCIF_INFO(0xffe43000, gic_iid(0x69)),
-       SCIF_INFO(0xffe44000, gic_iid(0x6a)),
-       SCIF_INFO(0xffe45000, gic_iid(0x6b)),
-};
+R8A7778_SCIF(0, 0xffe40000, gic_iid(0x66));
+R8A7778_SCIF(1, 0xffe41000, gic_iid(0x67));
+R8A7778_SCIF(2, 0xffe42000, gic_iid(0x68));
+R8A7778_SCIF(3, 0xffe43000, gic_iid(0x69));
+R8A7778_SCIF(4, 0xffe44000, gic_iid(0x6a));
+R8A7778_SCIF(5, 0xffe45000, gic_iid(0x6b));
+
+#define r8a7778_register_scif(index)                                          \
+       platform_device_register_resndata(&platform_bus, "sh-sci", index,      \
+                                         scif##index##_resources,             \
+                                         ARRAY_SIZE(scif##index##_resources), \
+                                         &scif##index##_platform_data,        \
+                                         sizeof(scif##index##_platform_data))
 
 /* TMU */
 static struct resource sh_tmu0_resources[] __initdata = {
@@ -287,8 +294,6 @@ static void __init r8a7778_register_hspi(int id)
 
 void __init r8a7778_add_dt_devices(void)
 {
-       int i;
-
 #ifdef CONFIG_CACHE_L2X0
        void __iomem *base = ioremap_nocache(0xf0100000, 0x1000);
        if (base) {
@@ -300,11 +305,12 @@ void __init r8a7778_add_dt_devices(void)
        }
 #endif
 
-       for (i = 0; i < ARRAY_SIZE(scif_platform_data); i++)
-               platform_device_register_data(&platform_bus, "sh-sci", i,
-                                             &scif_platform_data[i],
-                                             sizeof(struct plat_sci_port));
-
+       r8a7778_register_scif(0);
+       r8a7778_register_scif(1);
+       r8a7778_register_scif(2);
+       r8a7778_register_scif(3);
+       r8a7778_register_scif(4);
+       r8a7778_register_scif(5);
        r8a7778_register_tmu(0);
        r8a7778_register_tmu(1);
 }
@@ -319,6 +325,52 @@ void __init r8a7778_add_dt_devices(void)
 #define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE        BIT(1)  /* SDHI0 */
 #define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0       /* SDHI0 */
 
+#define HPBDMA_SSI(_id)                                \
+{                                              \
+       .id     = HPBDMA_SLAVE_SSI## _id ##_TX, \
+       .addr   = 0xffd91008 + (_id * 0x40),    \
+       .dcr    = HPB_DMAE_DCR_CT |             \
+                 HPB_DMAE_DCR_DIP |            \
+                 HPB_DMAE_DCR_SPDS_32BIT |     \
+                 HPB_DMAE_DCR_DMDL |           \
+                 HPB_DMAE_DCR_DPDS_32BIT,      \
+       .port   = _id + (_id << 8),             \
+       .dma_ch = (28 + _id),                   \
+}, {                                           \
+       .id     = HPBDMA_SLAVE_SSI## _id ##_RX, \
+       .addr   = 0xffd9100c + (_id * 0x40),    \
+       .dcr    = HPB_DMAE_DCR_CT |             \
+                 HPB_DMAE_DCR_DIP |            \
+                 HPB_DMAE_DCR_SMDL |           \
+                 HPB_DMAE_DCR_SPDS_32BIT |     \
+                 HPB_DMAE_DCR_DPDS_32BIT,      \
+       .port   = _id + (_id << 8),             \
+       .dma_ch = (28 + _id),                   \
+}
+
+#define HPBDMA_HPBIF(_id)                              \
+{                                                      \
+       .id     = HPBDMA_SLAVE_HPBIF## _id ##_TX,       \
+       .addr   = 0xffda0000 + (_id * 0x1000),          \
+       .dcr    = HPB_DMAE_DCR_CT |                     \
+                 HPB_DMAE_DCR_DIP |                    \
+                 HPB_DMAE_DCR_SPDS_32BIT |             \
+                 HPB_DMAE_DCR_DMDL |                   \
+                 HPB_DMAE_DCR_DPDS_32BIT,              \
+       .port   = 0x1111,                               \
+       .dma_ch = (28 + _id),                           \
+}, {                                                   \
+       .id     = HPBDMA_SLAVE_HPBIF## _id ##_RX,       \
+       .addr   = 0xffda0000 + (_id * 0x1000),          \
+       .dcr    = HPB_DMAE_DCR_CT |                     \
+                 HPB_DMAE_DCR_DIP |                    \
+                 HPB_DMAE_DCR_SMDL |                   \
+                 HPB_DMAE_DCR_SPDS_32BIT |             \
+                 HPB_DMAE_DCR_DPDS_32BIT,              \
+       .port   = 0x1111,                               \
+       .dma_ch = (28 + _id),                           \
+}
+
 static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
        {
                .id     = HPBDMA_SLAVE_SDHI0_TX,
@@ -348,12 +400,86 @@ static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
                .port   = 0x0D0C,
                .flags  = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
                .dma_ch = 22,
+       }, {
+               .id     = HPBDMA_SLAVE_USBFUNC_TX, /* for D0 */
+               .addr   = 0xffe60018,
+               .dcr    = HPB_DMAE_DCR_SPDS_32BIT |
+                         HPB_DMAE_DCR_DMDL |
+                         HPB_DMAE_DCR_DPDS_32BIT,
+               .port   = 0x0000,
+               .dma_ch = 14,
+       }, {
+               .id     = HPBDMA_SLAVE_USBFUNC_RX, /* for D1 */
+               .addr   = 0xffe6001c,
+               .dcr    = HPB_DMAE_DCR_SMDL |
+                         HPB_DMAE_DCR_SPDS_32BIT |
+                         HPB_DMAE_DCR_DPDS_32BIT,
+               .port   = 0x0101,
+               .dma_ch = 15,
        },
+
+       HPBDMA_SSI(0),
+       HPBDMA_SSI(1),
+       HPBDMA_SSI(2),
+       HPBDMA_SSI(3),
+       HPBDMA_SSI(4),
+       HPBDMA_SSI(5),
+       HPBDMA_SSI(6),
+       HPBDMA_SSI(7),
+       HPBDMA_SSI(8),
+
+       HPBDMA_HPBIF(0),
+       HPBDMA_HPBIF(1),
+       HPBDMA_HPBIF(2),
+       HPBDMA_HPBIF(3),
+       HPBDMA_HPBIF(4),
+       HPBDMA_HPBIF(5),
+       HPBDMA_HPBIF(6),
+       HPBDMA_HPBIF(7),
+       HPBDMA_HPBIF(8),
 };
 
 static const struct hpb_dmae_channel hpb_dmae_channels[] = {
+       HPB_DMAE_CHANNEL(0x7c, HPBDMA_SLAVE_USBFUNC_TX), /* ch. 14 */
+       HPB_DMAE_CHANNEL(0x7c, HPBDMA_SLAVE_USBFUNC_RX), /* ch. 15 */
        HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */
        HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI0_TX),   /* ch. 28 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI0_RX),   /* ch. 28 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF0_TX), /* ch. 28 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF0_RX), /* ch. 28 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI1_TX),   /* ch. 29 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI1_RX),   /* ch. 29 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF1_TX), /* ch. 29 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF1_RX), /* ch. 29 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI2_TX),   /* ch. 30 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI2_RX),   /* ch. 30 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF2_TX), /* ch. 30 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF2_RX), /* ch. 30 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI3_TX),   /* ch. 31 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI3_RX),   /* ch. 31 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF3_TX), /* ch. 31 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF3_RX), /* ch. 31 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI4_TX),   /* ch. 32 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI4_RX),   /* ch. 32 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF4_TX), /* ch. 32 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF4_RX), /* ch. 32 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI5_TX),   /* ch. 33 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI5_RX),   /* ch. 33 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF5_TX), /* ch. 33 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF5_RX), /* ch. 33 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI6_TX),   /* ch. 34 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI6_RX),   /* ch. 34 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF6_TX), /* ch. 34 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF6_RX), /* ch. 34 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI7_TX),   /* ch. 35 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI7_RX),   /* ch. 35 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF7_TX), /* ch. 35 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF7_RX), /* ch. 35 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI8_TX),   /* ch. 36 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI8_RX),   /* ch. 36 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF8_TX), /* ch. 36 */
+       HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF8_RX), /* ch. 36 */
 };
 
 static struct hpb_dmae_pdata dma_platform_data __initdata = {
index 13049e9d691ca17d7be5d5d3dc9b8b565b42a3e3..8e860b36997a670b4e0ad5a4af1368f5b5da510e 100644 (file)
@@ -188,107 +188,35 @@ void __init r8a7779_pinmux_init(void)
                            ARRAY_SIZE(r8a7779_pinctrl_devices));
 }
 
-static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffe40000,
-       .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
-       .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
-       .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(gic_iid(0x78)),
-};
-
-static struct platform_device scif0_device = {
-       .name           = "sh-sci",
-       .id             = 0,
-       .dev            = {
-               .platform_data  = &scif0_platform_data,
-       },
-};
-
-static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xffe41000,
-       .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
-       .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
-       .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(gic_iid(0x79)),
-};
-
-static struct platform_device scif1_device = {
-       .name           = "sh-sci",
-       .id             = 1,
-       .dev            = {
-               .platform_data  = &scif1_platform_data,
-       },
-};
-
-static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xffe42000,
-       .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
-       .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
-       .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(gic_iid(0x7a)),
-};
-
-static struct platform_device scif2_device = {
-       .name           = "sh-sci",
-       .id             = 2,
-       .dev            = {
-               .platform_data  = &scif2_platform_data,
-       },
-};
-
-static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xffe43000,
-       .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
-       .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
-       .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(gic_iid(0x7b)),
-};
-
-static struct platform_device scif3_device = {
-       .name           = "sh-sci",
-       .id             = 3,
-       .dev            = {
-               .platform_data  = &scif3_platform_data,
-       },
-};
-
-static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xffe44000,
-       .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
-       .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
-       .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(gic_iid(0x7c)),
-};
-
-static struct platform_device scif4_device = {
-       .name           = "sh-sci",
-       .id             = 4,
-       .dev            = {
-               .platform_data  = &scif4_platform_data,
-       },
-};
-
-static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xffe45000,
-       .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
-       .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
-       .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(gic_iid(0x7d)),
-};
+/* SCIF */
+#define R8A7779_SCIF(index, baseaddr, irq)                     \
+static struct plat_sci_port scif##index##_platform_data = {    \
+       .type           = PORT_SCIF,                            \
+       .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,      \
+       .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,     \
+};                                                             \
+                                                               \
+static struct resource scif##index##_resources[] = {           \
+       DEFINE_RES_MEM(baseaddr, 0x100),                        \
+       DEFINE_RES_IRQ(irq),                                    \
+};                                                             \
+                                                               \
+static struct platform_device scif##index##_device = {         \
+       .name           = "sh-sci",                             \
+       .id             = index,                                \
+       .resource       = scif##index##_resources,              \
+       .num_resources  = ARRAY_SIZE(scif##index##_resources),  \
+       .dev            = {                                     \
+               .platform_data  = &scif##index##_platform_data, \
+       },                                                      \
+}
 
-static struct platform_device scif5_device = {
-       .name           = "sh-sci",
-       .id             = 5,
-       .dev            = {
-               .platform_data  = &scif5_platform_data,
-       },
-};
+R8A7779_SCIF(0, 0xffe40000, gic_iid(0x78));
+R8A7779_SCIF(1, 0xffe41000, gic_iid(0x79));
+R8A7779_SCIF(2, 0xffe42000, gic_iid(0x7a));
+R8A7779_SCIF(3, 0xffe43000, gic_iid(0x7b));
+R8A7779_SCIF(4, 0xffe44000, gic_iid(0x7c));
+R8A7779_SCIF(5, 0xffe45000, gic_iid(0x7d));
 
 /* TMU */
 static struct sh_timer_config tmu00_platform_data = {
@@ -598,45 +526,6 @@ static struct platform_device ohci1_device = {
        .resource       = ohci1_resources,
 };
 
-/* Ether */
-static struct resource ether_resources[] __initdata = {
-       {
-               .start  = 0xfde00000,
-               .end    = 0xfde003ff,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .start  = gic_iid(0xb4),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-#define R8A7779_VIN(idx) \
-static struct resource vin##idx##_resources[] __initdata = {           \
-       DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000),            \
-       DEFINE_RES_IRQ(gic_iid(0x5f + (idx))),                          \
-};                                                                     \
-                                                                       \
-static struct platform_device_info vin##idx##_info __initdata = {      \
-       .parent         = &platform_bus,                                \
-       .name           = "r8a7779-vin",                                \
-       .id             = idx,                                          \
-       .res            = vin##idx##_resources,                         \
-       .num_res        = ARRAY_SIZE(vin##idx##_resources),             \
-       .dma_mask       = DMA_BIT_MASK(32),                             \
-}
-
-R8A7779_VIN(0);
-R8A7779_VIN(1);
-R8A7779_VIN(2);
-R8A7779_VIN(3);
-
-static struct platform_device_info *vin_info_table[] __initdata = {
-       &vin0_info,
-       &vin1_info,
-       &vin2_info,
-       &vin3_info,
-};
-
 /* HPB-DMA */
 
 /* Asynchronous mode register bits */
@@ -825,24 +714,6 @@ void __init r8a7779_add_standard_devices(void)
        r8a7779_register_hpb_dmae();
 }
 
-void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata)
-{
-       platform_device_register_resndata(&platform_bus, "r8a777x-ether", -1,
-                                         ether_resources,
-                                         ARRAY_SIZE(ether_resources),
-                                         pdata, sizeof(*pdata));
-}
-
-void __init r8a7779_add_vin_device(int id, struct rcar_vin_platform_data *pdata)
-{
-       BUG_ON(id < 0 || id > 3);
-
-       vin_info_table[id]->data = pdata;
-       vin_info_table[id]->size_data = sizeof(*pdata);
-
-       platform_device_register_full(vin_info_table[id]);
-}
-
 /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
 void __init __weak r8a7779_register_twd(void) { }
 
index c47bcebbcb00bbfa229d16c9d2fcad2430ef631e..6ab37aa1e919825aa6584441cffc91b7057fcbf5 100644 (file)
@@ -34,6 +34,10 @@ static const struct resource pfc_resources[] __initconst = {
        DEFINE_RES_MEM(0xe6060000, 0x250),
 };
 
+#define r8a7790_register_pfc()                                         \
+       platform_device_register_simple("pfc-r8a7790", -1, pfc_resources, \
+                                       ARRAY_SIZE(pfc_resources))
+
 #define R8A7790_GPIO(idx)                                              \
 static const struct resource r8a7790_gpio##idx##_resources[] __initconst = { \
        DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50),              \
@@ -63,73 +67,87 @@ R8A7790_GPIO(5);
                &r8a7790_gpio##idx##_platform_data,                     \
                sizeof(r8a7790_gpio##idx##_platform_data))
 
+static struct resource i2c_resources[] __initdata = {
+       /* I2C0 */
+       DEFINE_RES_MEM(0xE6508000, 0x40),
+       DEFINE_RES_IRQ(gic_spi(287)),
+       /* I2C1 */
+       DEFINE_RES_MEM(0xE6518000, 0x40),
+       DEFINE_RES_IRQ(gic_spi(288)),
+       /* I2C2 */
+       DEFINE_RES_MEM(0xE6530000, 0x40),
+       DEFINE_RES_IRQ(gic_spi(286)),
+       /* I2C3 */
+       DEFINE_RES_MEM(0xE6540000, 0x40),
+       DEFINE_RES_IRQ(gic_spi(290)),
+
+};
+
+#define r8a7790_register_i2c(idx)              \
+       platform_device_register_simple(        \
+               "i2c-rcar_gen2", idx,           \
+               i2c_resources + (2 * idx), 2);  \
+
 void __init r8a7790_pinmux_init(void)
 {
-       platform_device_register_simple("pfc-r8a7790", -1, pfc_resources,
-                                       ARRAY_SIZE(pfc_resources));
+       r8a7790_register_pfc();
        r8a7790_register_gpio(0);
        r8a7790_register_gpio(1);
        r8a7790_register_gpio(2);
        r8a7790_register_gpio(3);
        r8a7790_register_gpio(4);
        r8a7790_register_gpio(5);
+       r8a7790_register_i2c(0);
+       r8a7790_register_i2c(1);
+       r8a7790_register_i2c(2);
+       r8a7790_register_i2c(3);
 }
 
-#define SCIF_COMMON(scif_type, baseaddr, irq)                  \
-       .type           = scif_type,                            \
-       .mapbase        = baseaddr,                             \
-       .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,      \
-       .irqs           = SCIx_IRQ_MUXED(irq)
-
-#define SCIFA_DATA(index, baseaddr, irq)               \
-[index] = {                                            \
-       SCIF_COMMON(PORT_SCIFA, baseaddr, irq),         \
-       .scbrr_algo_id  = SCBRR_ALGO_4,                 \
-       .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE0,      \
-}
-
-#define SCIFB_DATA(index, baseaddr, irq)       \
-[index] = {                                    \
-       SCIF_COMMON(PORT_SCIFB, baseaddr, irq), \
-       .scbrr_algo_id  = SCBRR_ALGO_4,         \
-       .scscr = SCSCR_RE | SCSCR_TE,           \
-}
-
-#define SCIF_DATA(index, baseaddr, irq)                \
-[index] = {                                            \
-       SCIF_COMMON(PORT_SCIF, baseaddr, irq),          \
-       .scbrr_algo_id  = SCBRR_ALGO_2,                 \
-       .scscr = SCSCR_RE | SCSCR_TE,   \
-}
-
-#define HSCIF_DATA(index, baseaddr, irq)               \
-[index] = {                                            \
-       SCIF_COMMON(PORT_HSCIF, baseaddr, irq),         \
-       .scbrr_algo_id  = SCBRR_ALGO_6,                 \
-       .scscr = SCSCR_RE | SCSCR_TE,   \
+#define __R8A7790_SCIF(scif_type, _scscr, index, baseaddr, irq)                \
+static struct plat_sci_port scif##index##_platform_data = {            \
+       .type           = scif_type,                                    \
+       .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,              \
+       .scscr          = _scscr,                                       \
+};                                                                     \
+                                                                       \
+static struct resource scif##index##_resources[] = {                   \
+       DEFINE_RES_MEM(baseaddr, 0x100),                                \
+       DEFINE_RES_IRQ(irq),                                            \
 }
 
-enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1,
-       HSCIF0, HSCIF1 };
-
-static const struct plat_sci_port scif[] __initconst = {
-       SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */
-       SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */
-       SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */
-       SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */
-       SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */
-       SCIFA_DATA(SCIFA2, 0xe6c60000, gic_spi(151)), /* SCIFA2 */
-       SCIF_DATA(SCIF0, 0xe6e60000, gic_spi(152)), /* SCIF0 */
-       SCIF_DATA(SCIF1, 0xe6e68000, gic_spi(153)), /* SCIF1 */
-       HSCIF_DATA(HSCIF0, 0xe62c0000, gic_spi(154)), /* HSCIF0 */
-       HSCIF_DATA(HSCIF1, 0xe62c8000, gic_spi(155)), /* HSCIF1 */
-};
-
-static inline void r8a7790_register_scif(int idx)
-{
-       platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx],
-                                     sizeof(struct plat_sci_port));
-}
+#define R8A7790_SCIF(index, baseaddr, irq)                             \
+       __R8A7790_SCIF(PORT_SCIF, SCSCR_RE | SCSCR_TE,                  \
+                      index, baseaddr, irq)
+
+#define R8A7790_SCIFA(index, baseaddr, irq)                            \
+       __R8A7790_SCIF(PORT_SCIFA, SCSCR_RE | SCSCR_TE | SCSCR_CKE0,    \
+                      index, baseaddr, irq)
+
+#define R8A7790_SCIFB(index, baseaddr, irq)                            \
+       __R8A7790_SCIF(PORT_SCIFB, SCSCR_RE | SCSCR_TE,                 \
+                      index, baseaddr, irq)
+
+#define R8A7790_HSCIF(index, baseaddr, irq)                            \
+       __R8A7790_SCIF(PORT_HSCIF, SCSCR_RE | SCSCR_TE,                 \
+                      index, baseaddr, irq)
+
+R8A7790_SCIFA(0, 0xe6c40000, gic_spi(144)); /* SCIFA0 */
+R8A7790_SCIFA(1, 0xe6c50000, gic_spi(145)); /* SCIFA1 */
+R8A7790_SCIFB(2, 0xe6c20000, gic_spi(148)); /* SCIFB0 */
+R8A7790_SCIFB(3, 0xe6c30000, gic_spi(149)); /* SCIFB1 */
+R8A7790_SCIFB(4, 0xe6ce0000, gic_spi(150)); /* SCIFB2 */
+R8A7790_SCIFA(5, 0xe6c60000, gic_spi(151)); /* SCIFA2 */
+R8A7790_SCIF(6,  0xe6e60000, gic_spi(152)); /* SCIF0 */
+R8A7790_SCIF(7,  0xe6e68000, gic_spi(153)); /* SCIF1 */
+R8A7790_HSCIF(8, 0xe62c0000, gic_spi(154)); /* HSCIF0 */
+R8A7790_HSCIF(9, 0xe62c8000, gic_spi(155)); /* HSCIF1 */
+
+#define r8a7790_register_scif(index)                                          \
+       platform_device_register_resndata(&platform_bus, "sh-sci", index,      \
+                                         scif##index##_resources,             \
+                                         ARRAY_SIZE(scif##index##_resources), \
+                                         &scif##index##_platform_data,        \
+                                         sizeof(scif##index##_platform_data))
 
 static const struct renesas_irqc_config irqc0_data __initconst = {
        .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
@@ -182,16 +200,16 @@ static const struct resource cmt00_resources[] __initconst = {
 
 void __init r8a7790_add_dt_devices(void)
 {
-       r8a7790_register_scif(SCIFA0);
-       r8a7790_register_scif(SCIFA1);
-       r8a7790_register_scif(SCIFB0);
-       r8a7790_register_scif(SCIFB1);
-       r8a7790_register_scif(SCIFB2);
-       r8a7790_register_scif(SCIFA2);
-       r8a7790_register_scif(SCIF0);
-       r8a7790_register_scif(SCIF1);
-       r8a7790_register_scif(HSCIF0);
-       r8a7790_register_scif(HSCIF1);
+       r8a7790_register_scif(0);
+       r8a7790_register_scif(1);
+       r8a7790_register_scif(2);
+       r8a7790_register_scif(3);
+       r8a7790_register_scif(4);
+       r8a7790_register_scif(5);
+       r8a7790_register_scif(6);
+       r8a7790_register_scif(7);
+       r8a7790_register_scif(8);
+       r8a7790_register_scif(9);
        r8a7790_register_cmt(00);
 }
 
index d9393d61ee27028fb59efe284cc7d9d69db132d6..e28404e43860ac371a766dbf97c0f9f47902ec50 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/of_platform.h>
+#include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_data/irq-renesas-irqc.h>
 #include <linux/serial_sci.h>
 #include <linux/sh_timer.h>
 #include <mach/rcar-gen2.h>
 #include <asm/mach/arch.h>
 
-#define SCIF_COMMON(scif_type, baseaddr, irq)                  \
-       .type           = scif_type,                            \
-       .mapbase        = baseaddr,                             \
-       .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,      \
-       .irqs           = SCIx_IRQ_MUXED(irq)
-
-#define SCIFA_DATA(index, baseaddr, irq)               \
-[index] = {                                            \
-       SCIF_COMMON(PORT_SCIFA, baseaddr, irq),         \
-       .scbrr_algo_id  = SCBRR_ALGO_4,                 \
-       .scscr = SCSCR_RE | SCSCR_TE,   \
-}
-
-#define SCIFB_DATA(index, baseaddr, irq)       \
-[index] = {                                    \
-       SCIF_COMMON(PORT_SCIFB, baseaddr, irq), \
-       .scbrr_algo_id  = SCBRR_ALGO_4,         \
-       .scscr = SCSCR_RE | SCSCR_TE,           \
-}
+static const struct resource pfc_resources[] __initconst = {
+       DEFINE_RES_MEM(0xe6060000, 0x250),
+};
 
-#define SCIF_DATA(index, baseaddr, irq)                \
-[index] = {                                            \
-       SCIF_COMMON(PORT_SCIF, baseaddr, irq),          \
-       .scbrr_algo_id  = SCBRR_ALGO_2,                 \
-       .scscr = SCSCR_RE | SCSCR_TE,   \
+#define r8a7791_register_pfc()                                         \
+       platform_device_register_simple("pfc-r8a7791", -1, pfc_resources, \
+                                       ARRAY_SIZE(pfc_resources))
+
+#define R8A7791_GPIO(idx, base, nr)                                    \
+static const struct resource r8a7791_gpio##idx##_resources[] __initconst = { \
+       DEFINE_RES_MEM((base), 0x50),                                   \
+       DEFINE_RES_IRQ(gic_spi(4 + (idx))),                             \
+};                                                                     \
+                                                                       \
+static const struct gpio_rcar_config                                   \
+r8a7791_gpio##idx##_platform_data __initconst = {                      \
+       .gpio_base      = 32 * (idx),                                   \
+       .irq_base       = 0,                                            \
+       .number_of_pins = (nr),                                         \
+       .pctl_name      = "pfc-r8a7791",                                \
+       .has_both_edge_trigger = 1,                                     \
+};                                                                     \
+
+R8A7791_GPIO(0, 0xe6050000, 32);
+R8A7791_GPIO(1, 0xe6051000, 32);
+R8A7791_GPIO(2, 0xe6052000, 32);
+R8A7791_GPIO(3, 0xe6053000, 32);
+R8A7791_GPIO(4, 0xe6054000, 32);
+R8A7791_GPIO(5, 0xe6055000, 32);
+R8A7791_GPIO(6, 0xe6055400, 32);
+R8A7791_GPIO(7, 0xe6055800, 26);
+
+#define r8a7791_register_gpio(idx)                                     \
+       platform_device_register_resndata(&platform_bus, "gpio_rcar", idx, \
+               r8a7791_gpio##idx##_resources,                          \
+               ARRAY_SIZE(r8a7791_gpio##idx##_resources),              \
+               &r8a7791_gpio##idx##_platform_data,                     \
+               sizeof(r8a7791_gpio##idx##_platform_data))
+
+void __init r8a7791_pinmux_init(void)
+{
+       r8a7791_register_pfc();
+       r8a7791_register_gpio(0);
+       r8a7791_register_gpio(1);
+       r8a7791_register_gpio(2);
+       r8a7791_register_gpio(3);
+       r8a7791_register_gpio(4);
+       r8a7791_register_gpio(5);
+       r8a7791_register_gpio(6);
+       r8a7791_register_gpio(7);
 }
 
-#define HSCIF_DATA(index, baseaddr, irq)               \
-[index] = {                                            \
-       SCIF_COMMON(PORT_HSCIF, baseaddr, irq),         \
-       .scbrr_algo_id  = SCBRR_ALGO_6,                 \
-       .scscr = SCSCR_RE | SCSCR_TE,   \
+#define __R8A7791_SCIF(scif_type, index, baseaddr, irq)                        \
+static struct plat_sci_port scif##index##_platform_data = {            \
+       .type           = scif_type,                                    \
+       .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,              \
+       .scscr          = SCSCR_RE | SCSCR_TE,                          \
+};                                                                     \
+                                                                       \
+static struct resource scif##index##_resources[] = {                   \
+       DEFINE_RES_MEM(baseaddr, 0x100),                                \
+       DEFINE_RES_IRQ(irq),                                            \
 }
 
-enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1,
-       SCIF2, SCIF3, SCIF4, SCIF5, SCIFA3, SCIFA4, SCIFA5 };
-
-static const struct plat_sci_port scif[] __initconst = {
-       SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */
-       SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */
-       SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */
-       SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */
-       SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */
-       SCIFA_DATA(SCIFA2, 0xe6c60000, gic_spi(151)), /* SCIFA2 */
-       SCIF_DATA(SCIF0, 0xe6e60000, gic_spi(152)), /* SCIF0 */
-       SCIF_DATA(SCIF1, 0xe6e68000, gic_spi(153)), /* SCIF1 */
-       SCIF_DATA(SCIF2, 0xe6e58000, gic_spi(22)), /* SCIF2 */
-       SCIF_DATA(SCIF3, 0xe6ea8000, gic_spi(23)), /* SCIF3 */
-       SCIF_DATA(SCIF4, 0xe6ee0000, gic_spi(24)), /* SCIF4 */
-       SCIF_DATA(SCIF5, 0xe6ee8000, gic_spi(25)), /* SCIF5 */
-       SCIFA_DATA(SCIFA3, 0xe6c70000, gic_spi(29)), /* SCIFA3 */
-       SCIFA_DATA(SCIFA4, 0xe6c78000, gic_spi(30)), /* SCIFA4 */
-       SCIFA_DATA(SCIFA5, 0xe6c80000, gic_spi(31)), /* SCIFA5 */
-};
-
-static inline void r8a7791_register_scif(int idx)
-{
-       platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx],
-                                     sizeof(struct plat_sci_port));
-}
+#define R8A7791_SCIF(index, baseaddr, irq)                             \
+       __R8A7791_SCIF(PORT_SCIF, index, baseaddr, irq)
+
+#define R8A7791_SCIFA(index, baseaddr, irq)                            \
+       __R8A7791_SCIF(PORT_SCIFA, index, baseaddr, irq)
+
+#define R8A7791_SCIFB(index, baseaddr, irq)                            \
+       __R8A7791_SCIF(PORT_SCIFB, index, baseaddr, irq)
+
+R8A7791_SCIFA(0,  0xe6c40000, gic_spi(144)); /* SCIFA0 */
+R8A7791_SCIFA(1,  0xe6c50000, gic_spi(145)); /* SCIFA1 */
+R8A7791_SCIFB(2,  0xe6c20000, gic_spi(148)); /* SCIFB0 */
+R8A7791_SCIFB(3,  0xe6c30000, gic_spi(149)); /* SCIFB1 */
+R8A7791_SCIFB(4,  0xe6ce0000, gic_spi(150)); /* SCIFB2 */
+R8A7791_SCIFA(5,  0xe6c60000, gic_spi(151)); /* SCIFA2 */
+R8A7791_SCIF(6,   0xe6e60000, gic_spi(152)); /* SCIF0 */
+R8A7791_SCIF(7,   0xe6e68000, gic_spi(153)); /* SCIF1 */
+R8A7791_SCIF(8,   0xe6e58000, gic_spi(22)); /* SCIF2 */
+R8A7791_SCIF(9,   0xe6ea8000, gic_spi(23)); /* SCIF3 */
+R8A7791_SCIF(10,  0xe6ee0000, gic_spi(24)); /* SCIF4 */
+R8A7791_SCIF(11,  0xe6ee8000, gic_spi(25)); /* SCIF5 */
+R8A7791_SCIFA(12, 0xe6c70000, gic_spi(29)); /* SCIFA3 */
+R8A7791_SCIFA(13, 0xe6c78000, gic_spi(30)); /* SCIFA4 */
+R8A7791_SCIFA(14, 0xe6c80000, gic_spi(31)); /* SCIFA5 */
+
+#define r8a7791_register_scif(index)                                          \
+       platform_device_register_resndata(&platform_bus, "sh-sci", index,      \
+                                         scif##index##_resources,             \
+                                         ARRAY_SIZE(scif##index##_resources), \
+                                         &scif##index##_platform_data,        \
+                                         sizeof(scif##index##_platform_data))
 
 static const struct sh_timer_config cmt00_platform_data __initconst = {
        .name = "CMT00",
@@ -136,23 +172,34 @@ static struct resource irqc0_resources[] = {
                                          &irqc##idx##_data,            \
                                          sizeof(struct renesas_irqc_config))
 
+static const struct resource thermal_resources[] __initconst = {
+       DEFINE_RES_MEM(0xe61f0000, 0x14),
+       DEFINE_RES_MEM(0xe61f0100, 0x38),
+       DEFINE_RES_IRQ(gic_spi(69)),
+};
+
+#define r8a7791_register_thermal()                                     \
+       platform_device_register_simple("rcar_thermal", -1,             \
+                                       thermal_resources,              \
+                                       ARRAY_SIZE(thermal_resources))
+
 void __init r8a7791_add_dt_devices(void)
 {
-       r8a7791_register_scif(SCIFA0);
-       r8a7791_register_scif(SCIFA1);
-       r8a7791_register_scif(SCIFB0);
-       r8a7791_register_scif(SCIFB1);
-       r8a7791_register_scif(SCIFB2);
-       r8a7791_register_scif(SCIFA2);
-       r8a7791_register_scif(SCIF0);
-       r8a7791_register_scif(SCIF1);
-       r8a7791_register_scif(SCIF2);
-       r8a7791_register_scif(SCIF3);
-       r8a7791_register_scif(SCIF4);
-       r8a7791_register_scif(SCIF5);
-       r8a7791_register_scif(SCIFA3);
-       r8a7791_register_scif(SCIFA4);
-       r8a7791_register_scif(SCIFA5);
+       r8a7791_register_scif(0);
+       r8a7791_register_scif(1);
+       r8a7791_register_scif(2);
+       r8a7791_register_scif(3);
+       r8a7791_register_scif(4);
+       r8a7791_register_scif(5);
+       r8a7791_register_scif(6);
+       r8a7791_register_scif(7);
+       r8a7791_register_scif(8);
+       r8a7791_register_scif(9);
+       r8a7791_register_scif(10);
+       r8a7791_register_scif(11);
+       r8a7791_register_scif(12);
+       r8a7791_register_scif(13);
+       r8a7791_register_scif(14);
        r8a7791_register_cmt(00);
 }
 
@@ -160,6 +207,7 @@ void __init r8a7791_add_standard_devices(void)
 {
        r8a7791_add_dt_devices();
        r8a7791_register_irqc(0);
+       r8a7791_register_thermal();
 }
 
 void __init r8a7791_init_early(void)
index 5734c24bf6c78721d6bf916e26363a303cdeb64d..69ccc6c6fd334ffe39795bafa3260a7ae422a8c9 100644 (file)
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/clk/shmobile.h>
 #include <linux/clocksource.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
@@ -44,8 +45,10 @@ u32 __init rcar_gen2_read_mode_pins(void)
 
 void __init rcar_gen2_timer_init(void)
 {
-#ifdef CONFIG_ARM_ARCH_TIMER
+#if defined(CONFIG_ARM_ARCH_TIMER) || defined(CONFIG_COMMON_CLK)
        u32 mode = rcar_gen2_read_mode_pins();
+#endif
+#ifdef CONFIG_ARM_ARCH_TIMER
        void __iomem *base;
        int extal_mhz = 0;
        u32 freq;
@@ -78,14 +81,28 @@ void __init rcar_gen2_timer_init(void)
        /* Remap "armgcnt address map" space */
        base = ioremap(0xe6080000, PAGE_SIZE);
 
-       /* Update registers with correct frequency */
-       iowrite32(freq, base + CNTFID0);
-       asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
+       /*
+        * Update the timer if it is either not running, or is not at the
+        * right frequency. The timer is only configurable in secure mode
+        * so this avoids an abort if the loader started the timer and
+        * entered the kernel in non-secure mode.
+        */
+
+       if ((ioread32(base + CNTCR) & 1) == 0 ||
+           ioread32(base + CNTFID0) != freq) {
+               /* Update registers with correct frequency */
+               iowrite32(freq, base + CNTFID0);
+               asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
+
+               /* make sure arch timer is started by setting bit 0 of CNTCR */
+               iowrite32(1, base + CNTCR);
+       }
 
-       /* make sure arch timer is started by setting bit 0 of CNTCR */
-       iowrite32(1, base + CNTCR);
        iounmap(base);
 #endif /* CONFIG_ARM_ARCH_TIMER */
 
+#ifdef CONFIG_COMMON_CLK
+       rcar_gen2_clocks_init(mode);
+#endif
        clocksource_of_init();
 }
index 311878391e188f64dbb5fc46d737782e7e4666ae..27301278c20840064c7e88d857660e2dbb216015 100644 (file)
@@ -86,138 +86,36 @@ void __init sh7372_pinmux_init(void)
        platform_device_register(&sh7372_pfc_device);
 }
 
-/* SCIFA0 */
-static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xe6c40000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { evt2irq(0x0c00), evt2irq(0x0c00),
-                           evt2irq(0x0c00), evt2irq(0x0c00) },
-};
-
-static struct platform_device scif0_device = {
-       .name           = "sh-sci",
-       .id             = 0,
-       .dev            = {
-               .platform_data  = &scif0_platform_data,
-       },
-};
-
-/* SCIFA1 */
-static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xe6c50000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { evt2irq(0x0c20), evt2irq(0x0c20),
-                           evt2irq(0x0c20), evt2irq(0x0c20) },
-};
-
-static struct platform_device scif1_device = {
-       .name           = "sh-sci",
-       .id             = 1,
-       .dev            = {
-               .platform_data  = &scif1_platform_data,
-       },
-};
-
-/* SCIFA2 */
-static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xe6c60000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { evt2irq(0x0c40), evt2irq(0x0c40),
-                           evt2irq(0x0c40), evt2irq(0x0c40) },
-};
-
-static struct platform_device scif2_device = {
-       .name           = "sh-sci",
-       .id             = 2,
-       .dev            = {
-               .platform_data  = &scif2_platform_data,
-       },
-};
-
-/* SCIFA3 */
-static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xe6c70000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { evt2irq(0x0c60), evt2irq(0x0c60),
-                           evt2irq(0x0c60), evt2irq(0x0c60) },
-};
-
-static struct platform_device scif3_device = {
-       .name           = "sh-sci",
-       .id             = 3,
-       .dev            = {
-               .platform_data  = &scif3_platform_data,
-       },
-};
-
-/* SCIFA4 */
-static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xe6c80000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { evt2irq(0x0d20), evt2irq(0x0d20),
-                           evt2irq(0x0d20), evt2irq(0x0d20) },
-};
-
-static struct platform_device scif4_device = {
-       .name           = "sh-sci",
-       .id             = 4,
-       .dev            = {
-               .platform_data  = &scif4_platform_data,
-       },
-};
-
-/* SCIFA5 */
-static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xe6cb0000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { evt2irq(0x0d40), evt2irq(0x0d40),
-                           evt2irq(0x0d40), evt2irq(0x0d40) },
-};
-
-static struct platform_device scif5_device = {
-       .name           = "sh-sci",
-       .id             = 5,
-       .dev            = {
-               .platform_data  = &scif5_platform_data,
-       },
-};
-
-/* SCIFB */
-static struct plat_sci_port scif6_platform_data = {
-       .mapbase        = 0xe6c30000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFB,
-       .irqs           = { evt2irq(0x0d60), evt2irq(0x0d60),
-                           evt2irq(0x0d60), evt2irq(0x0d60) },
-};
+/* SCIF */
+#define SH7372_SCIF(scif_type, index, baseaddr, irq)           \
+static struct plat_sci_port scif##index##_platform_data = {    \
+       .type           = scif_type,                            \
+       .flags          = UPF_BOOT_AUTOCONF,                    \
+       .scscr          = SCSCR_RE | SCSCR_TE,                  \
+};                                                             \
+                                                               \
+static struct resource scif##index##_resources[] = {           \
+       DEFINE_RES_MEM(baseaddr, 0x100),                        \
+       DEFINE_RES_IRQ(irq),                                    \
+};                                                             \
+                                                               \
+static struct platform_device scif##index##_device = {         \
+       .name           = "sh-sci",                             \
+       .id             = index,                                \
+       .resource       = scif##index##_resources,              \
+       .num_resources  = ARRAY_SIZE(scif##index##_resources),  \
+       .dev            = {                                     \
+               .platform_data  = &scif##index##_platform_data, \
+       },                                                      \
+}
 
-static struct platform_device scif6_device = {
-       .name           = "sh-sci",
-       .id             = 6,
-       .dev            = {
-               .platform_data  = &scif6_platform_data,
-       },
-};
+SH7372_SCIF(PORT_SCIFA, 0, 0xe6c40000, evt2irq(0x0c00));
+SH7372_SCIF(PORT_SCIFA, 1, 0xe6c50000, evt2irq(0x0c20));
+SH7372_SCIF(PORT_SCIFA, 2, 0xe6c60000, evt2irq(0x0c40));
+SH7372_SCIF(PORT_SCIFA, 3, 0xe6c70000, evt2irq(0x0c60));
+SH7372_SCIF(PORT_SCIFA, 4, 0xe6c80000, evt2irq(0x0d20));
+SH7372_SCIF(PORT_SCIFA, 5, 0xe6cb0000, evt2irq(0x0d40));
+SH7372_SCIF(PORT_SCIFB, 6, 0xe6c30000, evt2irq(0x0d60));
 
 /* CMT */
 static struct sh_timer_config cmt2_platform_data = {
index 22de17417fd7c83a4ae4c9b66162cd3c16f1cb04..f74ab530c71df767a8d6f9f1dcc0ea018f328298 100644 (file)
@@ -71,167 +71,38 @@ void __init sh73a0_pinmux_init(void)
                                        ARRAY_SIZE(pfc_resources));
 }
 
-static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xe6c40000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { gic_spi(72), gic_spi(72),
-                           gic_spi(72), gic_spi(72) },
-};
-
-static struct platform_device scif0_device = {
-       .name           = "sh-sci",
-       .id             = 0,
-       .dev            = {
-               .platform_data  = &scif0_platform_data,
-       },
-};
-
-static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xe6c50000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { gic_spi(73), gic_spi(73),
-                           gic_spi(73), gic_spi(73) },
-};
-
-static struct platform_device scif1_device = {
-       .name           = "sh-sci",
-       .id             = 1,
-       .dev            = {
-               .platform_data  = &scif1_platform_data,
-       },
-};
-
-static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xe6c60000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { gic_spi(74), gic_spi(74),
-                           gic_spi(74), gic_spi(74) },
-};
-
-static struct platform_device scif2_device = {
-       .name           = "sh-sci",
-       .id             = 2,
-       .dev            = {
-               .platform_data  = &scif2_platform_data,
-       },
-};
-
-static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xe6c70000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { gic_spi(75), gic_spi(75),
-                           gic_spi(75), gic_spi(75) },
-};
-
-static struct platform_device scif3_device = {
-       .name           = "sh-sci",
-       .id             = 3,
-       .dev            = {
-               .platform_data  = &scif3_platform_data,
-       },
-};
-
-static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xe6c80000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { gic_spi(78), gic_spi(78),
-                           gic_spi(78), gic_spi(78) },
-};
-
-static struct platform_device scif4_device = {
-       .name           = "sh-sci",
-       .id             = 4,
-       .dev            = {
-               .platform_data  = &scif4_platform_data,
-       },
-};
-
-static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xe6cb0000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { gic_spi(79), gic_spi(79),
-                           gic_spi(79), gic_spi(79) },
-};
-
-static struct platform_device scif5_device = {
-       .name           = "sh-sci",
-       .id             = 5,
-       .dev            = {
-               .platform_data  = &scif5_platform_data,
-       },
-};
-
-static struct plat_sci_port scif6_platform_data = {
-       .mapbase        = 0xe6cc0000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { gic_spi(156), gic_spi(156),
-                           gic_spi(156), gic_spi(156) },
-};
-
-static struct platform_device scif6_device = {
-       .name           = "sh-sci",
-       .id             = 6,
-       .dev            = {
-               .platform_data  = &scif6_platform_data,
-       },
-};
-
-static struct plat_sci_port scif7_platform_data = {
-       .mapbase        = 0xe6cd0000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFA,
-       .irqs           = { gic_spi(143), gic_spi(143),
-                           gic_spi(143), gic_spi(143) },
-};
-
-static struct platform_device scif7_device = {
-       .name           = "sh-sci",
-       .id             = 7,
-       .dev            = {
-               .platform_data  = &scif7_platform_data,
-       },
-};
-
-static struct plat_sci_port scif8_platform_data = {
-       .mapbase        = 0xe6c30000,
-       .flags          = UPF_BOOT_AUTOCONF,
-       .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
-       .type           = PORT_SCIFB,
-       .irqs           = { gic_spi(80), gic_spi(80),
-                           gic_spi(80), gic_spi(80) },
-};
+/* SCIF */
+#define SH73A0_SCIF(scif_type, index, baseaddr, irq)           \
+static struct plat_sci_port scif##index##_platform_data = {    \
+       .type           = scif_type,                            \
+       .flags          = UPF_BOOT_AUTOCONF,                    \
+       .scscr          = SCSCR_RE | SCSCR_TE,                  \
+};                                                             \
+                                                               \
+static struct resource scif##index##_resources[] = {           \
+       DEFINE_RES_MEM(baseaddr, 0x100),                        \
+       DEFINE_RES_IRQ(irq),                                    \
+};                                                             \
+                                                               \
+static struct platform_device scif##index##_device = {         \
+       .name           = "sh-sci",                             \
+       .id             = index,                                \
+       .resource       = scif##index##_resources,              \
+       .num_resources  = ARRAY_SIZE(scif##index##_resources),  \
+       .dev            = {                                     \
+               .platform_data  = &scif##index##_platform_data, \
+       },                                                      \
+}
 
-static struct platform_device scif8_device = {
-       .name           = "sh-sci",
-       .id             = 8,
-       .dev            = {
-               .platform_data  = &scif8_platform_data,
-       },
-};
+SH73A0_SCIF(PORT_SCIFA, 0, 0xe6c40000, gic_spi(72));
+SH73A0_SCIF(PORT_SCIFA, 1, 0xe6c50000, gic_spi(73));
+SH73A0_SCIF(PORT_SCIFA, 2, 0xe6c60000, gic_spi(74));
+SH73A0_SCIF(PORT_SCIFA, 3, 0xe6c70000, gic_spi(75));
+SH73A0_SCIF(PORT_SCIFA, 4, 0xe6c80000, gic_spi(78));
+SH73A0_SCIF(PORT_SCIFA, 5, 0xe6cb0000, gic_spi(79));
+SH73A0_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(156));
+SH73A0_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(143));
+SH73A0_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(80));
 
 static struct sh_timer_config cmt10_platform_data = {
        .name = "CMT10",
@@ -273,7 +144,7 @@ static struct sh_timer_config tmu00_platform_data = {
 };
 
 static struct resource tmu00_resources[] = {
-       [0] = DEFINE_RES_MEM_NAMED(0xfff60008, 0xc, "TMU00"),
+       [0] = DEFINE_RES_MEM(0xfff60008, 0xc),
        [1] = {
                .start  = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */
                .flags  = IORESOURCE_IRQ,
@@ -298,7 +169,7 @@ static struct sh_timer_config tmu01_platform_data = {
 };
 
 static struct resource tmu01_resources[] = {
-       [0] = DEFINE_RES_MEM_NAMED(0xfff60014, 0xc, "TMU00"),
+       [0] = DEFINE_RES_MEM(0xfff60014, 0xc),
        [1] = {
                .start  = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */
                .flags  = IORESOURCE_IRQ,
@@ -316,7 +187,7 @@ static struct platform_device tmu01_device = {
 };
 
 static struct resource i2c0_resources[] = {
-       [0] = DEFINE_RES_MEM_NAMED(0xe6820000, 0x426, "IIC0"),
+       [0] = DEFINE_RES_MEM(0xe6820000, 0x426),
        [1] = {
                .start  = gic_spi(167),
                .end    = gic_spi(170),
@@ -325,7 +196,7 @@ static struct resource i2c0_resources[] = {
 };
 
 static struct resource i2c1_resources[] = {
-       [0] = DEFINE_RES_MEM_NAMED(0xe6822000, 0x426, "IIC1"),
+       [0] = DEFINE_RES_MEM(0xe6822000, 0x426),
        [1] = {
                .start  = gic_spi(51),
                .end    = gic_spi(54),
@@ -334,7 +205,7 @@ static struct resource i2c1_resources[] = {
 };
 
 static struct resource i2c2_resources[] = {
-       [0] = DEFINE_RES_MEM_NAMED(0xe6824000, 0x426, "IIC2"),
+       [0] = DEFINE_RES_MEM(0xe6824000, 0x426),
        [1] = {
                .start  = gic_spi(171),
                .end    = gic_spi(174),
@@ -343,7 +214,7 @@ static struct resource i2c2_resources[] = {
 };
 
 static struct resource i2c3_resources[] = {
-       [0] = DEFINE_RES_MEM_NAMED(0xe6826000, 0x426, "IIC3"),
+       [0] = DEFINE_RES_MEM(0xe6826000, 0x426),
        [1] = {
                .start  = gic_spi(183),
                .end    = gic_spi(186),
@@ -352,7 +223,7 @@ static struct resource i2c3_resources[] = {
 };
 
 static struct resource i2c4_resources[] = {
-       [0] = DEFINE_RES_MEM_NAMED(0xe6828000, 0x426, "IIC4"),
+       [0] = DEFINE_RES_MEM(0xe6828000, 0x426),
        [1] = {
                .start  = gic_spi(187),
                .end    = gic_spi(190),
@@ -722,7 +593,7 @@ static struct platform_device pmu_device = {
 
 /* an IPMMU module for ICB */
 static struct resource ipmmu_resources[] = {
-       DEFINE_RES_MEM_NAMED(0xfe951000, 0x100, "IPMMU"),
+       DEFINE_RES_MEM(0xfe951000, 0x100),
 };
 
 static const char * const ipmmu_dev_names[] = {
index e834763ac2a521bd02ff6a7704d30576657cd10c..2c4141413db92ebbd0e39f43fef95a53ca6a034f 100644 (file)
@@ -26,23 +26,4 @@ static inline void __init gpio_direction_none(void __iomem * addr)
        __raw_writeb(0x00, addr);
 }
 
-static inline void __init gpio_request_pullup(void __iomem * addr)
-{
-       u8 data = __raw_readb(addr);
-
-       data &= 0x0F;
-       data |= 0xC0;
-       __raw_writeb(data, addr);
-}
-
-static inline void __init gpio_request_pulldown(void __iomem * addr)
-{
-       u8 data = __raw_readb(addr);
-
-       data &= 0x0F;
-       data |= 0xA0;
-
-       __raw_writeb(data, addr);
-}
-
 #endif /* __ASM_ARCH_GPIO_H */
index dce50d983a8edc267c4157903952f07487a177c7..fa2c33ffac044e45ec0e2d88ecbb2f146cbbbc85 100644 (file)
@@ -31,8 +31,7 @@ static void write_pen_release(int val)
 {
        pen_release = val;
        smp_wmb();
-       __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
-       outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
+       sync_cache_w(&pen_release);
 }
 
 static DEFINE_SPINLOCK(boot_lock);
index bce0d4277f71974ceefb7a2f9ec8e31ef75ceb9d..b9d6cad8669b8ea623aa5787de36c80d8caa5621 100644 (file)
@@ -1,7 +1,9 @@
 config ARCH_SUNXI
        bool "Allwinner A1X SOCs" if ARCH_MULTI_V7
+       select ARCH_HAS_RESET_CONTROLLER
        select ARCH_REQUIRE_GPIOLIB
        select ARM_GIC
+       select ARM_PSCI
        select CLKSRC_MMIO
        select CLKSRC_OF
        select COMMON_CLK
@@ -10,6 +12,7 @@ config ARCH_SUNXI
        select HAVE_SMP
        select PINCTRL
        select PINCTRL_SUNXI
+       select RESET_CONTROLLER
        select SPARSE_IRQ
        select SUN4I_TIMER
        select SUN5I_HSTIMER
index 93bebfc3ff9f44d6367b1071bfb7a3a8d7e34204..d9397202d6ecd8e7ed4d0908fd656b559a41ebb2 100644 (file)
@@ -1 +1,2 @@
 obj-$(CONFIG_ARCH_SUNXI) += sunxi.o
+obj-$(CONFIG_SMP) += platsmp.o headsmp.o
diff --git a/arch/arm/mach-sunxi/common.h b/arch/arm/mach-sunxi/common.h
new file mode 100644 (file)
index 0000000..9e5ac47
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Core functions for Allwinner SoCs
+ *
+ * Copyright (C) 2013 Maxime Ripard
+ *
+ * Maxime Ripard <maxime.ripard@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef __ARCH_SUNXI_COMMON_H_
+#define __ARCH_SUNXI_COMMON_H_
+
+void sun6i_secondary_startup(void);
+extern struct smp_operations sun6i_smp_ops;
+
+#endif /* __ARCH_SUNXI_COMMON_H_ */
diff --git a/arch/arm/mach-sunxi/headsmp.S b/arch/arm/mach-sunxi/headsmp.S
new file mode 100644 (file)
index 0000000..a10d494
--- /dev/null
@@ -0,0 +1,9 @@
+#include <linux/linkage.h>
+#include <linux/init.h>
+
+        .section ".text.head", "ax"
+
+ENTRY(sun6i_secondary_startup)
+       msr     cpsr_fsxc, #0xd3
+       b       secondary_startup
+ENDPROC(sun6i_secondary_startup)
diff --git a/arch/arm/mach-sunxi/platsmp.c b/arch/arm/mach-sunxi/platsmp.c
new file mode 100644 (file)
index 0000000..7b141d8
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * SMP support for Allwinner SoCs
+ *
+ * Copyright (C) 2013 Maxime Ripard
+ *
+ * Maxime Ripard <maxime.ripard@free-electrons.com>
+ *
+ * Based on code
+ *  Copyright (C) 2012-2013 Allwinner Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/memory.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/smp.h>
+
+#include "common.h"
+
+#define CPUCFG_CPU_PWR_CLAMP_STATUS_REG(cpu)   ((cpu) * 0x40 + 0x64)
+#define CPUCFG_CPU_RST_CTRL_REG(cpu)           (((cpu) + 1) * 0x40)
+#define CPUCFG_CPU_CTRL_REG(cpu)               (((cpu) + 1) * 0x40 + 0x04)
+#define CPUCFG_CPU_STATUS_REG(cpu)             (((cpu) + 1) * 0x40 + 0x08)
+#define CPUCFG_GEN_CTRL_REG                    0x184
+#define CPUCFG_PRIVATE0_REG                    0x1a4
+#define CPUCFG_PRIVATE1_REG                    0x1a8
+#define CPUCFG_DBG_CTL0_REG                    0x1e0
+#define CPUCFG_DBG_CTL1_REG                    0x1e4
+
+#define PRCM_CPU_PWROFF_REG                    0x100
+#define PRCM_CPU_PWR_CLAMP_REG(cpu)            (((cpu) * 4) + 0x140)
+
+static void __iomem *cpucfg_membase;
+static void __iomem *prcm_membase;
+
+static DEFINE_SPINLOCK(cpu_lock);
+
+static void __init sun6i_smp_prepare_cpus(unsigned int max_cpus)
+{
+       struct device_node *node;
+
+       node = of_find_compatible_node(NULL, NULL, "allwinner,sun6i-a31-prcm");
+       if (!node) {
+               pr_err("Missing A31 PRCM node in the device tree\n");
+               return;
+       }
+
+       prcm_membase = of_iomap(node, 0);
+       if (!prcm_membase) {
+               pr_err("Couldn't map A31 PRCM registers\n");
+               return;
+       }
+
+       node = of_find_compatible_node(NULL, NULL,
+                                      "allwinner,sun6i-a31-cpuconfig");
+       if (!node) {
+               pr_err("Missing A31 CPU config node in the device tree\n");
+               return;
+       }
+
+       cpucfg_membase = of_iomap(node, 0);
+       if (!cpucfg_membase)
+               pr_err("Couldn't map A31 CPU config registers\n");
+
+}
+
+static int sun6i_smp_boot_secondary(unsigned int cpu,
+                                   struct task_struct *idle)
+{
+       u32 reg;
+       int i;
+
+       if (!(prcm_membase && cpucfg_membase))
+               return -EFAULT;
+
+       spin_lock(&cpu_lock);
+
+       /* Set CPU boot address */
+       writel(virt_to_phys(sun6i_secondary_startup),
+              cpucfg_membase + CPUCFG_PRIVATE0_REG);
+
+       /* Assert the CPU core in reset */
+       writel(0, cpucfg_membase + CPUCFG_CPU_RST_CTRL_REG(cpu));
+
+       /* Assert the L1 cache in reset */
+       reg = readl(cpucfg_membase + CPUCFG_GEN_CTRL_REG);
+       writel(reg & ~BIT(cpu), cpucfg_membase + CPUCFG_GEN_CTRL_REG);
+
+       /* Disable external debug access */
+       reg = readl(cpucfg_membase + CPUCFG_DBG_CTL1_REG);
+       writel(reg & ~BIT(cpu), cpucfg_membase + CPUCFG_DBG_CTL1_REG);
+
+       /* Power up the CPU */
+       for (i = 0; i <= 8; i++)
+               writel(0xff >> i, prcm_membase + PRCM_CPU_PWR_CLAMP_REG(cpu));
+       mdelay(10);
+
+       /* Clear CPU power-off gating */
+       reg = readl(prcm_membase + PRCM_CPU_PWROFF_REG);
+       writel(reg & ~BIT(cpu), prcm_membase + PRCM_CPU_PWROFF_REG);
+       mdelay(1);
+
+       /* Deassert the CPU core reset */
+       writel(3, cpucfg_membase + CPUCFG_CPU_RST_CTRL_REG(cpu));
+
+       /* Enable back the external debug accesses */
+       reg = readl(cpucfg_membase + CPUCFG_DBG_CTL1_REG);
+       writel(reg | BIT(cpu), cpucfg_membase + CPUCFG_DBG_CTL1_REG);
+
+       spin_unlock(&cpu_lock);
+
+       return 0;
+}
+
+struct smp_operations sun6i_smp_ops __initdata = {
+       .smp_prepare_cpus       = sun6i_smp_prepare_cpus,
+       .smp_boot_secondary     = sun6i_smp_boot_secondary,
+};
index 61d3a387f01c52f746568f7d075f92704a471ce6..aeea6ceea725f5e8fb8495f09850616400679710 100644 (file)
@@ -10,6 +10,8 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/clk-provider.h>
+#include <linux/clocksource.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -23,6 +25,8 @@
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
 
+#include "common.h"
+
 #define SUN4I_WATCHDOG_CTRL_REG                0x00
 #define SUN4I_WATCHDOG_CTRL_RESTART            BIT(0)
 #define SUN4I_WATCHDOG_MODE_REG                0x04
@@ -132,10 +136,20 @@ static const char * const sun6i_board_dt_compat[] = {
        NULL,
 };
 
+extern void __init sun6i_reset_init(void);
+static void __init sun6i_timer_init(void)
+{
+       of_clk_init(NULL);
+       sun6i_reset_init();
+       clocksource_of_init();
+}
+
 DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
        .init_machine   = sunxi_dt_init,
+       .init_time      = sun6i_timer_init,
        .dt_compat      = sun6i_board_dt_compat,
        .restart        = sun6i_restart,
+       .smp            = smp_ops(sun6i_smp_ops),
 MACHINE_END
 
 static const char * const sun7i_board_dt_compat[] = {
index 09e740f58b274184f0cd22b282def431d037b6d9..b1232d8be6f568d208d92888f1519788f764902d 100644 (file)
@@ -2,6 +2,7 @@ config ARCH_TEGRA
        bool "NVIDIA Tegra" if ARCH_MULTI_V7
        select ARCH_HAS_CPUFREQ
        select ARCH_REQUIRE_GPIOLIB
+       select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
        select ARM_GIC
        select CLKSRC_MMIO
        select CLKSRC_OF
@@ -14,6 +15,8 @@ config ARCH_TEGRA
        select MIGHT_HAVE_CACHE_L2X0
        select MIGHT_HAVE_PCI
        select PINCTRL
+       select ARCH_HAS_RESET_CONTROLLER
+       select RESET_CONTROLLER
        select SOC_BUS
        select SPARSE_IRQ
        select USB_ARCH_HAS_EHCI if USB_SUPPORT
@@ -63,6 +66,7 @@ config ARCH_TEGRA_124_SOC
        bool "Enable support for Tegra124 family"
        select ARM_L1_CACHE_SHIFT_6
        select HAVE_ARM_ARCH_TIMER
+       select PINCTRL_TEGRA124
        help
          Support for NVIDIA Tegra T124 processor family, based on the
          ARM CortexA15MP CPU
index 3a9c1f1c219dd47bd79ecb1c3bb9f1538abe4463..c9ac23b385bef9b1e736e7d3480d2b05a6da63a4 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/export.h>
 #include <linux/random.h>
+#include <linux/clk.h>
 #include <linux/tegra-soc.h>
 
 #include "fuse.h"
@@ -54,6 +55,7 @@ int tegra_cpu_speedo_id;              /* only exist in Tegra30 and later */
 int tegra_soc_speedo_id;
 enum tegra_revision tegra_revision;
 
+static struct clk *fuse_clk;
 static int tegra_fuse_spare_bit;
 static void (*tegra_init_speedo_data)(void);
 
@@ -77,6 +79,22 @@ static const char *tegra_revision_name[TEGRA_REVISION_MAX] = {
        [TEGRA_REVISION_A04]     = "A04",
 };
 
+static void tegra_fuse_enable_clk(void)
+{
+       if (IS_ERR(fuse_clk))
+               fuse_clk = clk_get_sys(NULL, "fuse");
+       if (IS_ERR(fuse_clk))
+               return;
+       clk_prepare_enable(fuse_clk);
+}
+
+static void tegra_fuse_disable_clk(void)
+{
+       if (IS_ERR(fuse_clk))
+               return;
+       clk_disable_unprepare(fuse_clk);
+}
+
 u32 tegra_fuse_readl(unsigned long offset)
 {
        return tegra_apb_readl(TEGRA_FUSE_BASE + offset);
@@ -84,7 +102,15 @@ u32 tegra_fuse_readl(unsigned long offset)
 
 bool tegra_spare_fuse(int bit)
 {
-       return tegra_fuse_readl(tegra_fuse_spare_bit + bit * 4);
+       bool ret;
+
+       tegra_fuse_enable_clk();
+
+       ret = tegra_fuse_readl(tegra_fuse_spare_bit + bit * 4);
+
+       tegra_fuse_disable_clk();
+
+       return ret;
 }
 
 static enum tegra_revision tegra_get_revision(u32 id)
@@ -113,10 +139,14 @@ static void tegra_get_process_id(void)
 {
        u32 reg;
 
+       tegra_fuse_enable_clk();
+
        reg = tegra_fuse_readl(tegra_fuse_spare_bit);
        tegra_cpu_process_id = (reg >> 6) & 3;
        reg = tegra_fuse_readl(tegra_fuse_spare_bit);
        tegra_core_process_id = (reg >> 12) & 3;
+
+       tegra_fuse_disable_clk();
 }
 
 u32 tegra_read_chipid(void)
@@ -159,6 +189,15 @@ void __init tegra_init_fuse(void)
        reg |= 1 << 28;
        writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x48));
 
+       /*
+        * Enable FUSE clock. This needs to be hardcoded because the clock
+        * subsystem is not active during early boot.
+        */
+       reg = readl(IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x14));
+       reg |= 1 << 7;
+       writel(reg, IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x14));
+       fuse_clk = ERR_PTR(-EINVAL);
+
        reg = tegra_fuse_readl(FUSE_SKU_INFO);
        randomness[0] = reg;
        tegra_sku_id = reg & 0xFF;
index 26b1c2ad0cebfd30a50573138808b7df17cd34cf..ee79808e93a3f2edf91e43f2f6c069917cf1f4dd 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef __MACH_TEGRA_IOMAP_H
 #define __MACH_TEGRA_IOMAP_H
 
+#include <asm/pgtable.h>
 #include <asm/sizes.h>
 
 #define TEGRA_IRAM_BASE                        0x40000000
  * two 256MB io windows (that actually only use about 64KB
  * at the start of each).
  *
- * We will just map the first 1MB of each window (to minimize
+ * We will just map the first MMU section of each window (to minimize
  * pt entries needed) and provide a macro to transform physical
  * io addresses to an appropriate void __iomem *.
- *
  */
 
 #define IO_IRAM_PHYS   0x40000000
 #define IO_IRAM_VIRT   IOMEM(0xFE400000)
 #define IO_IRAM_SIZE   SZ_256K
 
-#define IO_CPU_PHYS     0x50040000
-#define IO_CPU_VIRT     IOMEM(0xFE000000)
+#define IO_CPU_PHYS    0x50040000
+#define IO_CPU_VIRT    IOMEM(0xFE440000)
 #define IO_CPU_SIZE    SZ_16K
 
 #define IO_PPSB_PHYS   0x60000000
 #define IO_PPSB_VIRT   IOMEM(0xFE200000)
-#define IO_PPSB_SIZE   SZ_1M
+#define IO_PPSB_SIZE   SECTION_SIZE
 
 #define IO_APB_PHYS    0x70000000
-#define IO_APB_VIRT    IOMEM(0xFE300000)
-#define IO_APB_SIZE    SZ_1M
+#define IO_APB_VIRT    IOMEM(0xFE000000)
+#define IO_APB_SIZE    SECTION_SIZE
 
 #define IO_TO_VIRT_BETWEEN(p, st, sz)  ((p) >= (st) && (p) < ((st) + (sz)))
 #define IO_TO_VIRT_XLATE(p, pst, vst)  (((p) - (pst) + (vst)))
index 85d28e756bb77e8d3b4b66342608e136716288b3..3d0c537d9b945af08de57ecaa354169674fdc33e 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/export.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/reset.h>
 #include <linux/seq_file.h>
 #include <linux/spinlock.h>
 #include <linux/clk/tegra.h>
 #include "fuse.h"
 #include "iomap.h"
 
+#define DPD_SAMPLE             0x020
+#define  DPD_SAMPLE_ENABLE     (1 << 0)
+#define  DPD_SAMPLE_DISABLE    (0 << 0)
+
 #define PWRGATE_TOGGLE         0x30
 #define  PWRGATE_TOGGLE_START  (1 << 8)
 
 
 #define PWRGATE_STATUS         0x38
 
+#define IO_DPD_REQ             0x1b8
+#define  IO_DPD_REQ_CODE_IDLE  (0 << 30)
+#define  IO_DPD_REQ_CODE_OFF   (1 << 30)
+#define  IO_DPD_REQ_CODE_ON    (2 << 30)
+#define  IO_DPD_REQ_CODE_MASK  (3 << 30)
+
+#define IO_DPD_STATUS          0x1bc
+#define IO_DPD2_REQ            0x1c0
+#define IO_DPD2_STATUS         0x1c4
+#define SEL_DPD_TIM            0x1c8
+
+#define GPU_RG_CNTRL           0x2d4
+
 static int tegra_num_powerdomains;
 static int tegra_num_cpu_domains;
 static const u8 *tegra_cpu_domains;
@@ -58,6 +76,13 @@ static const u8 tegra114_cpu_domains[] = {
        TEGRA_POWERGATE_CPU3,
 };
 
+static const u8 tegra124_cpu_domains[] = {
+       TEGRA_POWERGATE_CPU0,
+       TEGRA_POWERGATE_CPU1,
+       TEGRA_POWERGATE_CPU2,
+       TEGRA_POWERGATE_CPU3,
+};
+
 static DEFINE_SPINLOCK(tegra_powergate_lock);
 
 static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
@@ -108,6 +133,7 @@ int tegra_powergate_power_off(int id)
 
        return tegra_powergate_set(id, false);
 }
+EXPORT_SYMBOL(tegra_powergate_power_off);
 
 int tegra_powergate_is_powered(int id)
 {
@@ -127,13 +153,24 @@ int tegra_powergate_remove_clamping(int id)
        if (id < 0 || id >= tegra_num_powerdomains)
                return -EINVAL;
 
+       /*
+        * The Tegra124 GPU has a separate register (with different semantics)
+        * to remove clamps.
+        */
+       if (tegra_chip_id == TEGRA124) {
+               if (id == TEGRA_POWERGATE_3D) {
+                       pmc_write(0, GPU_RG_CNTRL);
+                       return 0;
+               }
+       }
+
        /*
         * Tegra 2 has a bug where PCIE and VDE clamping masks are
         * swapped relatively to the partition ids
         */
-       if (id ==  TEGRA_POWERGATE_VDEC)
+       if (id == TEGRA_POWERGATE_VDEC)
                mask = (1 << TEGRA_POWERGATE_PCIE);
-       else if (id == TEGRA_POWERGATE_PCIE)
+       else if (id == TEGRA_POWERGATE_PCIE)
                mask = (1 << TEGRA_POWERGATE_VDEC);
        else
                mask = (1 << id);
@@ -142,13 +179,15 @@ int tegra_powergate_remove_clamping(int id)
 
        return 0;
 }
+EXPORT_SYMBOL(tegra_powergate_remove_clamping);
 
 /* Must be called with clk disabled, and returns with clk enabled */
-int tegra_powergate_sequence_power_up(int id, struct clk *clk)
+int tegra_powergate_sequence_power_up(int id, struct clk *clk,
+                                       struct reset_control *rst)
 {
        int ret;
 
-       tegra_periph_reset_assert(clk);
+       reset_control_assert(rst);
 
        ret = tegra_powergate_power_on(id);
        if (ret)
@@ -165,7 +204,7 @@ int tegra_powergate_sequence_power_up(int id, struct clk *clk)
                goto err_clamp;
 
        udelay(10);
-       tegra_periph_reset_deassert(clk);
+       reset_control_deassert(rst);
 
        return 0;
 
@@ -202,6 +241,11 @@ int __init tegra_powergate_init(void)
                tegra_num_cpu_domains = 4;
                tegra_cpu_domains = tegra114_cpu_domains;
                break;
+       case TEGRA124:
+               tegra_num_powerdomains = 25;
+               tegra_num_cpu_domains = 4;
+               tegra_cpu_domains = tegra124_cpu_domains;
+               break;
        default:
                /* Unknown Tegra variant. Disable powergating */
                tegra_num_powerdomains = 0;
@@ -243,12 +287,36 @@ static const char * const powergate_name_t30[] = {
 };
 
 static const char * const powergate_name_t114[] = {
-       [TEGRA_POWERGATE_CPU]   = "cpu0",
+       [TEGRA_POWERGATE_CPU]   = "crail",
+       [TEGRA_POWERGATE_3D]    = "3d",
+       [TEGRA_POWERGATE_VENC]  = "venc",
+       [TEGRA_POWERGATE_VDEC]  = "vdec",
+       [TEGRA_POWERGATE_MPE]   = "mpe",
+       [TEGRA_POWERGATE_HEG]   = "heg",
+       [TEGRA_POWERGATE_CPU1]  = "cpu1",
+       [TEGRA_POWERGATE_CPU2]  = "cpu2",
+       [TEGRA_POWERGATE_CPU3]  = "cpu3",
+       [TEGRA_POWERGATE_CELP]  = "celp",
+       [TEGRA_POWERGATE_CPU0]  = "cpu0",
+       [TEGRA_POWERGATE_C0NC]  = "c0nc",
+       [TEGRA_POWERGATE_C1NC]  = "c1nc",
+       [TEGRA_POWERGATE_DIS]   = "dis",
+       [TEGRA_POWERGATE_DISB]  = "disb",
+       [TEGRA_POWERGATE_XUSBA] = "xusba",
+       [TEGRA_POWERGATE_XUSBB] = "xusbb",
+       [TEGRA_POWERGATE_XUSBC] = "xusbc",
+};
+
+static const char * const powergate_name_t124[] = {
+       [TEGRA_POWERGATE_CPU]   = "crail",
        [TEGRA_POWERGATE_3D]    = "3d",
        [TEGRA_POWERGATE_VENC]  = "venc",
+       [TEGRA_POWERGATE_PCIE]  = "pcie",
        [TEGRA_POWERGATE_VDEC]  = "vdec",
+       [TEGRA_POWERGATE_L2]    = "l2",
        [TEGRA_POWERGATE_MPE]   = "mpe",
        [TEGRA_POWERGATE_HEG]   = "heg",
+       [TEGRA_POWERGATE_SATA]  = "sata",
        [TEGRA_POWERGATE_CPU1]  = "cpu1",
        [TEGRA_POWERGATE_CPU2]  = "cpu2",
        [TEGRA_POWERGATE_CPU3]  = "cpu3",
@@ -256,11 +324,14 @@ static const char * const powergate_name_t114[] = {
        [TEGRA_POWERGATE_CPU0]  = "cpu0",
        [TEGRA_POWERGATE_C0NC]  = "c0nc",
        [TEGRA_POWERGATE_C1NC]  = "c1nc",
+       [TEGRA_POWERGATE_SOR]   = "sor",
        [TEGRA_POWERGATE_DIS]   = "dis",
        [TEGRA_POWERGATE_DISB]  = "disb",
        [TEGRA_POWERGATE_XUSBA] = "xusba",
        [TEGRA_POWERGATE_XUSBB] = "xusbb",
        [TEGRA_POWERGATE_XUSBC] = "xusbc",
+       [TEGRA_POWERGATE_VIC]   = "vic",
+       [TEGRA_POWERGATE_IRAM]  = "iram",
 };
 
 static int powergate_show(struct seq_file *s, void *data)
@@ -307,6 +378,9 @@ int __init tegra_powergate_debugfs_init(void)
        case TEGRA114:
                powergate_name = powergate_name_t114;
                break;
+       case TEGRA124:
+               powergate_name = powergate_name_t124;
+               break;
        }
 
        if (powergate_name) {
@@ -320,3 +394,120 @@ int __init tegra_powergate_debugfs_init(void)
 }
 
 #endif
+
+static int tegra_io_rail_prepare(int id, unsigned long *request,
+                                unsigned long *status, unsigned int *bit)
+{
+       unsigned long rate, value;
+       struct clk *clk;
+
+       *bit = id % 32;
+
+       /*
+        * There are two sets of 30 bits to select IO rails, but bits 30 and
+        * 31 are control bits rather than IO rail selection bits.
+        */
+       if (id > 63 || *bit == 30 || *bit == 31)
+               return -EINVAL;
+
+       if (id < 32) {
+               *status = IO_DPD_STATUS;
+               *request = IO_DPD_REQ;
+       } else {
+               *status = IO_DPD2_STATUS;
+               *request = IO_DPD2_REQ;
+       }
+
+       clk = clk_get_sys(NULL, "pclk");
+       if (IS_ERR(clk))
+               return PTR_ERR(clk);
+
+       rate = clk_get_rate(clk);
+       clk_put(clk);
+
+       pmc_write(DPD_SAMPLE_ENABLE, DPD_SAMPLE);
+
+       /* must be at least 200 ns, in APB (PCLK) clock cycles */
+       value = DIV_ROUND_UP(1000000000, rate);
+       value = DIV_ROUND_UP(200, value);
+       pmc_write(value, SEL_DPD_TIM);
+
+       return 0;
+}
+
+static int tegra_io_rail_poll(unsigned long offset, unsigned long mask,
+                             unsigned long val, unsigned long timeout)
+{
+       unsigned long value;
+
+       timeout = jiffies + msecs_to_jiffies(timeout);
+
+       while (time_after(timeout, jiffies)) {
+               value = pmc_read(offset);
+               if ((value & mask) == val)
+                       return 0;
+
+               usleep_range(250, 1000);
+       }
+
+       return -ETIMEDOUT;
+}
+
+static void tegra_io_rail_unprepare(void)
+{
+       pmc_write(DPD_SAMPLE_DISABLE, DPD_SAMPLE);
+}
+
+int tegra_io_rail_power_on(int id)
+{
+       unsigned long request, status, value;
+       unsigned int bit, mask;
+       int err;
+
+       err = tegra_io_rail_prepare(id, &request, &status, &bit);
+       if (err < 0)
+               return err;
+
+       mask = 1 << bit;
+
+       value = pmc_read(request);
+       value |= mask;
+       value &= ~IO_DPD_REQ_CODE_MASK;
+       value |= IO_DPD_REQ_CODE_OFF;
+       pmc_write(value, request);
+
+       err = tegra_io_rail_poll(status, mask, 0, 250);
+       if (err < 0)
+               return err;
+
+       tegra_io_rail_unprepare();
+
+       return 0;
+}
+
+int tegra_io_rail_power_off(int id)
+{
+       unsigned long request, status, value;
+       unsigned int bit, mask;
+       int err;
+
+       err = tegra_io_rail_prepare(id, &request, &status, &bit);
+       if (err < 0)
+               return err;
+
+       mask = 1 << bit;
+
+       value = pmc_read(request);
+       value |= mask;
+       value &= ~IO_DPD_REQ_CODE_MASK;
+       value |= IO_DPD_REQ_CODE_ON;
+       pmc_write(value, request);
+
+       err = tegra_io_rail_poll(status, mask, mask, 250);
+       if (err < 0)
+               return err;
+
+       tegra_io_rail_unprepare();
+
+       return 0;
+}
index 568f5bbf979da4429e677430dd582d2a6c2f9f29..146fe8e0ae7ce52eea0e960c3c508ebb0a35f3b6 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <asm/cacheflush.h>
 #include <asm/hardware/cache-l2x0.h>
+#include <asm/firmware.h>
 
 #include "iomap.h"
 #include "irammap.h"
 
 static bool is_enabled;
 
-static void __init tegra_cpu_reset_handler_enable(void)
+static void __init tegra_cpu_reset_handler_set(const u32 reset_address)
 {
-       void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE);
        void __iomem *evp_cpu_reset =
                IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE + 0x100);
        void __iomem *sb_ctrl = IO_ADDRESS(TEGRA_SB_BASE);
        u32 reg;
 
-       BUG_ON(is_enabled);
-       BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE);
-
-       memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start,
-                       tegra_cpu_reset_handler_size);
-
        /*
         * NOTE: This must be the one and only write to the EVP CPU reset
         *       vector in the entire system.
         */
-       writel(TEGRA_IRAM_RESET_BASE + tegra_cpu_reset_handler_offset,
-                       evp_cpu_reset);
+       writel(reset_address, evp_cpu_reset);
        wmb();
        reg = readl(evp_cpu_reset);
 
@@ -66,8 +59,33 @@ static void __init tegra_cpu_reset_handler_enable(void)
                writel(reg, sb_ctrl);
                wmb();
        }
+}
+
+static void __init tegra_cpu_reset_handler_enable(void)
+{
+       void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE);
+       const u32 reset_address = TEGRA_IRAM_RESET_BASE +
+                                               tegra_cpu_reset_handler_offset;
+       int err;
+
+       BUG_ON(is_enabled);
+       BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE);
 
-       is_enabled = true;
+       memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start,
+                       tegra_cpu_reset_handler_size);
+
+       err = call_firmware_op(set_cpu_boot_addr, 0, reset_address);
+       switch (err) {
+       case -ENOSYS:
+               tegra_cpu_reset_handler_set(reset_address);
+               /* pass-through */
+       case 0:
+               is_enabled = true;
+               break;
+       default:
+               pr_crit("Cannot set CPU reset handler: %d\n", err);
+               BUG();
+       }
 }
 
 void __init tegra_cpu_reset_handler_init(void)
index 73368176c6e8592ecc5f2f0155d5598885692fd3..303a285d80fd7b7d7cc4280779c343b4a3123f4a 100644 (file)
@@ -40,6 +40,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/setup.h>
+#include <asm/trusted_foundations.h>
 
 #include "apbio.h"
 #include "board.h"
  * kernel is loaded. The data is declared here rather than debug-macro.S so
  * that multiple inclusions of debug-macro.S point at the same data.
  */
-u32 tegra_uart_config[4] = {
+u32 tegra_uart_config[3] = {
        /* Debug UART initialization required */
        1,
        /* Debug UART physical address */
        0,
        /* Debug UART virtual address */
        0,
-       /* Scratch space for debug macro */
-       0,
 };
 
 static void __init tegra_init_cache(void)
@@ -90,6 +89,7 @@ static void __init tegra_init_cache(void)
 
 static void __init tegra_init_early(void)
 {
+       of_register_trusted_foundations();
        tegra_apb_io_init();
        tegra_init_fuse();
        tegra_cpu_reset_handler_init();
index bf40cd478fe95d82d64073bb1ff184c07f25808f..0493a845b6bc5975d1626becd2a2ebbf078cd235 100644 (file)
@@ -69,9 +69,9 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
                return -ENODEV;
        }
        regmap = syscon_node_to_regmap(syscon_np);
-       if (!regmap) {
+       if (IS_ERR(regmap)) {
                pr_crit("U300: could not locate syscon regmap\n");
-               return -ENODEV;
+               return PTR_ERR(regmap);
        }
 
        main_power_15 = regulator_get(&pdev->dev, "vana15");
index 9a5f9fb352ce1c7ca97baa3e4269ef54770e2faa..fe08fd34c0ce8422b00508efb20cb94ff3a2dda2 100644 (file)
 #define U300_TIMER_APP_CRC                                     (0x100)
 #define U300_TIMER_APP_CRC_CLOCK_REQUEST_ENABLE                        (0x00000001)
 
-#define TICKS_PER_JIFFY ((CLOCK_TICK_RATE + (HZ/2)) / HZ)
-#define US_PER_TICK ((1000000 + (HZ/2)) / HZ)
-
 static void __iomem *u300_timer_base;
 
+struct u300_clockevent_data {
+       struct clock_event_device cevd;
+       unsigned ticks_per_jiffy;
+};
+
 /*
  * The u300_set_mode() function is always called first, if we
  * have oneshot timer active, the oneshot scheduling function
@@ -197,6 +199,9 @@ static void __iomem *u300_timer_base;
 static void u300_set_mode(enum clock_event_mode mode,
                          struct clock_event_device *evt)
 {
+       struct u300_clockevent_data *cevdata =
+               container_of(evt, struct u300_clockevent_data, cevd);
+
        switch (mode) {
        case CLOCK_EVT_MODE_PERIODIC:
                /* Disable interrupts on GPT1 */
@@ -209,7 +214,7 @@ static void u300_set_mode(enum clock_event_mode mode,
                 * Set the periodic mode to a certain number of ticks per
                 * jiffy.
                 */
-               writel(TICKS_PER_JIFFY,
+               writel(cevdata->ticks_per_jiffy,
                       u300_timer_base + U300_TIMER_APP_GPT1TC);
                /*
                 * Set continuous mode, so the timer keeps triggering
@@ -305,20 +310,23 @@ static int u300_set_next_event(unsigned long cycles,
        return 0;
 }
 
-
-/* Use general purpose timer 1 as clock event */
-static struct clock_event_device clockevent_u300_1mhz = {
-       .name           = "GPT1",
-       .rating         = 300, /* Reasonably fast and accurate clock event */
-       .features       = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
-       .set_next_event = u300_set_next_event,
-       .set_mode       = u300_set_mode,
+static struct u300_clockevent_data u300_clockevent_data = {
+       /* Use general purpose timer 1 as clock event */
+       .cevd = {
+               .name           = "GPT1",
+               /* Reasonably fast and accurate clock event */
+               .rating         = 300,
+               .features       = CLOCK_EVT_FEAT_PERIODIC |
+                       CLOCK_EVT_FEAT_ONESHOT,
+               .set_next_event = u300_set_next_event,
+               .set_mode       = u300_set_mode,
+       },
 };
 
 /* Clock event timer interrupt handler */
 static irqreturn_t u300_timer_interrupt(int irq, void *dev_id)
 {
-       struct clock_event_device *evt = &clockevent_u300_1mhz;
+       struct clock_event_device *evt = &u300_clockevent_data.cevd;
        /* ACK/Clear timer IRQ for the APP GPT1 Timer */
 
        writel(U300_TIMER_APP_GPT1IA_IRQ_ACK,
@@ -341,7 +349,7 @@ static struct irqaction u300_timer_irq = {
  * stamp. (Inspired by OMAP implementation.)
  */
 
-static u32 notrace u300_read_sched_clock(void)
+static u64 notrace u300_read_sched_clock(void)
 {
        return readl(u300_timer_base + U300_TIMER_APP_GPT2CC);
 }
@@ -379,7 +387,9 @@ static void __init u300_timer_init_of(struct device_node *np)
        clk_prepare_enable(clk);
        rate = clk_get_rate(clk);
 
-       setup_sched_clock(u300_read_sched_clock, 32, rate);
+       u300_clockevent_data.ticks_per_jiffy = DIV_ROUND_CLOSEST(rate, HZ);
+
+       sched_clock_register(u300_read_sched_clock, 32, rate);
 
        u300_delay_timer.read_current_timer = &u300_read_current_timer;
        u300_delay_timer.freq = rate;
@@ -428,7 +438,7 @@ static void __init u300_timer_init_of(struct device_node *np)
                pr_err("timer: failed to initialize U300 clock source\n");
 
        /* Configure and register the clockevent */
-       clockevents_config_and_register(&clockevent_u300_1mhz, rate,
+       clockevents_config_and_register(&u300_clockevent_data.cevd, rate,
                                        1, 0xffffffff);
 
        /*
index 616b96e86ad4fb067395ad4d2411cb8befcb92b8..d05ba759da3015a1aa54bafc7dceaef190c2a212 100644 (file)
@@ -2,10 +2,10 @@
 # Makefile for the linux kernel, U8500 machine.
 #
 
-obj-y                          := cpu.o devices.o id.o timer.o pm.o
+obj-y                          := cpu.o id.o timer.o pm.o
 obj-$(CONFIG_CACHE_L2X0)       += cache-l2x0.o
-obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o
-obj-$(CONFIG_MACH_MOP500)      += board-mop500.o board-mop500-sdi.o \
+obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o
+obj-$(CONFIG_MACH_MOP500)      += board-mop500-sdi.o \
                                board-mop500-regulators.o \
                                board-mop500-pins.o \
                                board-mop500-audio.o
index 43d6cb8c381da9d4364afd45ae686dd155e1975d..9309ad4cbd09596f215f86dfebe2d0ece9a7ca65 100644 (file)
@@ -7,16 +7,13 @@
 #include <linux/platform_device.h>
 #include <linux/init.h>
 #include <linux/gpio.h>
-#include <linux/platform_data/pinctrl-nomadik.h>
 #include <linux/platform_data/dma-ste-dma40.h>
 
-#include "devices.h"
 #include "irqs.h"
 #include <linux/platform_data/asoc-ux500-msp.h>
 
 #include "ste-dma40-db8500.h"
 #include "board-mop500.h"
-#include "devices-db8500.h"
 
 static struct stedma40_chan_cfg msp0_dma_rx = {
        .high_priority = true,
index 0efb1560fc355dc4f1f7887bfcba4cca260fda27..f63619b69113f16e274c3addb6843949f8f94cd4 100644 (file)
 #include <linux/string.h>
 #include <linux/pinctrl/machine.h>
 #include <linux/pinctrl/pinconf-generic.h>
-#include <linux/platform_data/pinctrl-nomadik.h>
 
 #include <asm/mach-types.h>
 
 #include "board-mop500.h"
 
-enum custom_pin_cfg_t {
-       PINS_FOR_DEFAULT,
-       PINS_FOR_U9500,
-};
-
-static enum custom_pin_cfg_t pinsfor;
-
 /* These simply sets bias for pins */
 #define BIAS(a,b) static unsigned long a[] = { b }
 
-BIAS(pd, PIN_PULL_DOWN);
-BIAS(in_nopull, PIN_INPUT_NOPULL);
-BIAS(in_nopull_slpm_nowkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_DISABLE);
-BIAS(in_pu, PIN_INPUT_PULLUP);
-BIAS(in_pd, PIN_INPUT_PULLDOWN);
-BIAS(out_hi, PIN_OUTPUT_HIGH);
-BIAS(out_lo, PIN_OUTPUT_LOW);
-BIAS(out_lo_slpm_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE);
-
 BIAS(abx500_out_lo, PIN_CONF_PACKED(PIN_CONFIG_OUTPUT, 0));
 BIAS(abx500_in_pd, PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_DOWN, 1));
 BIAS(abx500_in_nopull, PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_DOWN, 0));
 
-/* These also force them into GPIO mode */
-BIAS(gpio_in_pu, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED);
-BIAS(gpio_in_pd, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED);
-BIAS(gpio_in_pu_slpm_gpio_nopull, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED|PIN_SLPM_GPIO|PIN_SLPM_INPUT_NOPULL);
-BIAS(gpio_in_pd_slpm_gpio_nopull, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED|PIN_SLPM_GPIO|PIN_SLPM_INPUT_NOPULL);
-BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED);
-BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED);
-/* Sleep modes */
-BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED|
-       PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
-BIAS(slpm_in_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|
-       PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED);
-BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED|
-       PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
-BIAS(slpm_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|
-       PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED);
-BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED|
-       PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED);
-BIAS(slpm_out_lo_wkup_pdis, PIN_SLEEPMODE_ENABLED|
-       PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
-BIAS(slpm_out_hi_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_HIGH|
-       PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
-BIAS(slpm_in_nopull_wkup_pdis, PIN_SLEEPMODE_ENABLED|
-       PIN_SLPM_INPUT_NOPULL|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
-BIAS(slpm_in_pu_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|PIN_SLPM_INPUT_PULLUP|
-       PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED);
-BIAS(slpm_out_wkup_pdis, PIN_SLEEPMODE_ENABLED|
-       PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
-BIAS(out_lo_wkup_pdis, PIN_SLPM_OUTPUT_LOW|
-       PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
-BIAS(in_wkup_pdis_en, PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|
-       PIN_SLPM_PDIS_ENABLED);
-BIAS(in_wkup_pdis, PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|
-       PIN_SLPM_PDIS_DISABLED);
-BIAS(out_wkup_pdis, PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|
-       PIN_SLPM_PDIS_DISABLED);
-
-/* We use these to define hog settings that are always done on boot */
-#define DB8500_MUX_HOG(group,func) \
-       PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func)
-#define DB8500_PIN_HOG(pin,conf) \
-       PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf)
-
-/* These are default states associated with device and changed runtime */
-#define DB8500_MUX(group,func,dev) \
-       PIN_MAP_MUX_GROUP_DEFAULT(dev, "pinctrl-db8500", group, func)
-#define DB8500_PIN(pin,conf,dev) \
-       PIN_MAP_CONFIGS_PIN_DEFAULT(dev, "pinctrl-db8500", pin, conf)
-#define DB8500_PIN_IDLE(pin, conf, dev) \
-       PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_IDLE, "pinctrl-db8500",  \
-                           pin, conf)
-#define DB8500_PIN_SLEEP(pin, conf, dev) \
-       PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \
-                           pin, conf)
-#define DB8500_MUX_STATE(group, func, dev, state) \
-       PIN_MAP_MUX_GROUP(dev, state, "pinctrl-db8500", group, func)
-#define DB8500_PIN_STATE(pin, conf, dev, state) \
-       PIN_MAP_CONFIGS_PIN(dev, state, "pinctrl-db8500", pin, conf)
-
 #define AB8500_MUX_HOG(group, func) \
        PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-ab8500.0", group, func)
 #define AB8500_PIN_HOG(pin, conf) \
@@ -344,725 +268,8 @@ static struct pinctrl_map __initdata ab8505_pinmap[] = {
        AB8505_PIN_HOG("GPIO53_D15", in_pd),
 };
 
-/* Pin control settings */
-static struct pinctrl_map __initdata mop500_family_pinmap[] = {
-       /*
-        * uMSP0, mux in 4 pins, regular placement of RX/TX
-        * explicitly set the pins to no pull
-        */
-       DB8500_MUX_HOG("msp0txrx_a_1", "msp0"),
-       DB8500_MUX_HOG("msp0tfstck_a_1", "msp0"),
-       DB8500_PIN_HOG("GPIO12_AC4", in_nopull), /* TXD */
-       DB8500_PIN_HOG("GPIO15_AC3", in_nopull), /* RXD */
-       DB8500_PIN_HOG("GPIO13_AF3", in_nopull), /* TFS */
-       DB8500_PIN_HOG("GPIO14_AE3", in_nopull), /* TCK */
-       /* MSP2 for HDMI, pull down TXD, TCK, TFS  */
-       DB8500_MUX_HOG("msp2_a_1", "msp2"),
-       DB8500_PIN_HOG("GPIO193_AH27", in_pd), /* TXD */
-       DB8500_PIN_HOG("GPIO194_AF27", in_pd), /* TCK */
-       DB8500_PIN_HOG("GPIO195_AG28", in_pd), /* TFS */
-       DB8500_PIN_HOG("GPIO196_AG26", out_lo), /* RXD */
-       /*
-        * LCD, set TE0 (using LCD VSI0) and D14 (touch screen interrupt) to
-        * pull-up
-        * TODO: is this really correct? Snowball doesn't have a LCD.
-        */
-       DB8500_MUX_HOG("lcdvsi0_a_1", "lcd"),
-       DB8500_PIN_HOG("GPIO68_E1", in_pu),
-       DB8500_PIN_HOG("GPIO84_C2", gpio_in_pu),
-       /*
-        * STMPE1601/tc35893 keypad IRQ GPIO 218
-        * TODO: set for snowball and HREF really??
-        */
-       DB8500_PIN_HOG("GPIO218_AH11", gpio_in_pu),
-       /*
-        * UART0, we do not mux in u0 here.
-        * uart-0 pins gpio configuration should be kept intact to prevent
-        * a glitch in tx line when the tty dev is opened. Later these pins
-        * are configured by uart driver
-        */
-       DB8500_PIN_HOG("GPIO0_AJ5", in_pu), /* CTS */
-       DB8500_PIN_HOG("GPIO1_AJ3", out_hi), /* RTS */
-       DB8500_PIN_HOG("GPIO2_AH4", in_pu), /* RXD */
-       DB8500_PIN_HOG("GPIO3_AH3", out_hi), /* TXD */
-       /*
-        * Mux in UART2 on altfunction C and set pull-ups.
-        * TODO: is this used on U8500 variants and Snowball really?
-        * The setting on GPIO31 conflicts with magnetometer use on hrefv60
-        */
-       /* default state for UART2 */
-       DB8500_MUX("u2rxtx_c_1", "u2", "uart2"),
-       DB8500_PIN("GPIO29_W2", in_pu, "uart2"), /* RXD */
-       DB8500_PIN("GPIO30_W3", out_hi, "uart2"), /* TXD */
-       /* Sleep state for UART2 */
-       DB8500_PIN_SLEEP("GPIO29_W2", in_wkup_pdis, "uart2"),
-       DB8500_PIN_SLEEP("GPIO30_W3", out_wkup_pdis, "uart2"),
-       /*
-        * The following pin sets were known as "runtime pins" before being
-        * converted to the pinctrl model. Here we model them as "default"
-        * states.
-        */
-       /* Mux in UART0 after initialization */
-       DB8500_MUX("u0_a_1", "u0", "uart0"),
-       DB8500_PIN("GPIO0_AJ5", in_pu, "uart0"), /* CTS */
-       DB8500_PIN("GPIO1_AJ3", out_hi, "uart0"), /* RTS */
-       DB8500_PIN("GPIO2_AH4", in_pu, "uart0"), /* RXD */
-       DB8500_PIN("GPIO3_AH3", out_hi, "uart0"), /* TXD */
-       /* Sleep state for UART0 */
-       DB8500_PIN_SLEEP("GPIO0_AJ5", slpm_in_wkup_pdis, "uart0"),
-       DB8500_PIN_SLEEP("GPIO1_AJ3", slpm_out_hi_wkup_pdis, "uart0"),
-       DB8500_PIN_SLEEP("GPIO2_AH4", slpm_in_wkup_pdis, "uart0"),
-       DB8500_PIN_SLEEP("GPIO3_AH3", slpm_out_wkup_pdis, "uart0"),
-       /* Mux in UART1 after initialization */
-       DB8500_MUX("u1rxtx_a_1", "u1", "uart1"),
-       DB8500_PIN("GPIO4_AH6", in_pu, "uart1"), /* RXD */
-       DB8500_PIN("GPIO5_AG6", out_hi, "uart1"), /* TXD */
-       /* Sleep state for UART1 */
-       DB8500_PIN_SLEEP("GPIO4_AH6", slpm_in_wkup_pdis, "uart1"),
-       DB8500_PIN_SLEEP("GPIO5_AG6", slpm_out_wkup_pdis, "uart1"),
-       /* MSP1 for ALSA codec */
-       DB8500_MUX_HOG("msp1txrx_a_1", "msp1"),
-       DB8500_MUX_HOG("msp1_a_1", "msp1"),
-       DB8500_PIN_HOG("GPIO33_AF2", out_lo_slpm_nowkup),
-       DB8500_PIN_HOG("GPIO34_AE1", in_nopull_slpm_nowkup),
-       DB8500_PIN_HOG("GPIO35_AE2", in_nopull_slpm_nowkup),
-       DB8500_PIN_HOG("GPIO36_AG2", in_nopull_slpm_nowkup),
-       /* Mux in LCD data lines 8 thru 11 and LCDA CLK for MCDE TVOUT */
-       DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"),
-       DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"),
-       /* Mux in LCD VSI1 and pull it up for MCDE HDMI output */
-       DB8500_MUX("lcdvsi1_a_1", "lcd", "0-0070"),
-       DB8500_PIN("GPIO69_E2", in_pu, "0-0070"),
-       /* LCD VSI1 sleep state */
-       DB8500_PIN_SLEEP("GPIO69_E2", slpm_in_wkup_pdis, "0-0070"),
-       /* Mux in i2c0 block, default state */
-       DB8500_MUX("i2c0_a_1", "i2c0", "nmk-i2c.0"),
-       /* i2c0 sleep state */
-       DB8500_PIN_SLEEP("GPIO147_C15", slpm_in_nopull_wkup_pdis, "nmk-i2c.0"), /* SDA */
-       DB8500_PIN_SLEEP("GPIO148_B16", slpm_in_nopull_wkup_pdis, "nmk-i2c.0"), /* SCL */
-       /* Mux in i2c1 block, default state  */
-       DB8500_MUX("i2c1_b_2", "i2c1", "nmk-i2c.1"),
-       /* i2c1 sleep state */
-       DB8500_PIN_SLEEP("GPIO16_AD3", slpm_in_nopull_wkup_pdis, "nmk-i2c.1"), /* SDA */
-       DB8500_PIN_SLEEP("GPIO17_AD4", slpm_in_nopull_wkup_pdis, "nmk-i2c.1"), /* SCL */
-       /* Mux in i2c2 block, default state  */
-       DB8500_MUX("i2c2_b_2", "i2c2", "nmk-i2c.2"),
-       /* i2c2 sleep state */
-       DB8500_PIN_SLEEP("GPIO10_AF5", slpm_in_nopull_wkup_pdis, "nmk-i2c.2"), /* SDA */
-       DB8500_PIN_SLEEP("GPIO11_AG4", slpm_in_nopull_wkup_pdis, "nmk-i2c.2"), /* SCL */
-       /* Mux in i2c3 block, default state  */
-       DB8500_MUX("i2c3_c_2", "i2c3", "nmk-i2c.3"),
-       /* i2c3 sleep state */
-       DB8500_PIN_SLEEP("GPIO229_AG7", slpm_in_nopull_wkup_pdis, "nmk-i2c.3"), /* SDA */
-       DB8500_PIN_SLEEP("GPIO230_AF7", slpm_in_nopull_wkup_pdis, "nmk-i2c.3"), /* SCL */
-       /* Mux in SDI0 (here called MC0) used for removable MMC/SD/SDIO cards */
-       DB8500_MUX("mc0_a_1", "mc0", "sdi0"),
-       DB8500_PIN("GPIO18_AC2", out_hi, "sdi0"), /* CMDDIR */
-       DB8500_PIN("GPIO19_AC1", out_hi, "sdi0"), /* DAT0DIR */
-       DB8500_PIN("GPIO20_AB4", out_hi, "sdi0"), /* DAT2DIR */
-       DB8500_PIN("GPIO22_AA3", in_nopull, "sdi0"), /* FBCLK */
-       DB8500_PIN("GPIO23_AA4", out_lo, "sdi0"), /* CLK */
-       DB8500_PIN("GPIO24_AB2", in_pu, "sdi0"), /* CMD */
-       DB8500_PIN("GPIO25_Y4", in_pu, "sdi0"), /* DAT0 */
-       DB8500_PIN("GPIO26_Y2", in_pu, "sdi0"), /* DAT1 */
-       DB8500_PIN("GPIO27_AA2", in_pu, "sdi0"), /* DAT2 */
-       DB8500_PIN("GPIO28_AA1", in_pu, "sdi0"), /* DAT3 */
-       /* SDI0 sleep state */
-       DB8500_PIN_SLEEP("GPIO18_AC2", slpm_out_hi_wkup_pdis, "sdi0"),
-       DB8500_PIN_SLEEP("GPIO19_AC1", slpm_out_hi_wkup_pdis, "sdi0"),
-       DB8500_PIN_SLEEP("GPIO20_AB4", slpm_out_hi_wkup_pdis, "sdi0"),
-       DB8500_PIN_SLEEP("GPIO22_AA3", slpm_in_wkup_pdis, "sdi0"),
-       DB8500_PIN_SLEEP("GPIO23_AA4", slpm_out_lo_wkup_pdis, "sdi0"),
-       DB8500_PIN_SLEEP("GPIO24_AB2", slpm_in_wkup_pdis, "sdi0"),
-       DB8500_PIN_SLEEP("GPIO25_Y4", slpm_in_wkup_pdis, "sdi0"),
-       DB8500_PIN_SLEEP("GPIO26_Y2", slpm_in_wkup_pdis, "sdi0"),
-       DB8500_PIN_SLEEP("GPIO27_AA2", slpm_in_wkup_pdis, "sdi0"),
-       DB8500_PIN_SLEEP("GPIO28_AA1", slpm_in_wkup_pdis, "sdi0"),
-
-       /* Mux in SDI1 (here called MC1) used for SDIO for CW1200 WLAN */
-       DB8500_MUX("mc1_a_1", "mc1", "sdi1"),
-       DB8500_PIN("GPIO208_AH16", out_lo, "sdi1"), /* CLK */
-       DB8500_PIN("GPIO209_AG15", in_nopull, "sdi1"), /* FBCLK */
-       DB8500_PIN("GPIO210_AJ15", in_pu, "sdi1"), /* CMD */
-       DB8500_PIN("GPIO211_AG14", in_pu, "sdi1"), /* DAT0 */
-       DB8500_PIN("GPIO212_AF13", in_pu, "sdi1"), /* DAT1 */
-       DB8500_PIN("GPIO213_AG13", in_pu, "sdi1"), /* DAT2 */
-       DB8500_PIN("GPIO214_AH15", in_pu, "sdi1"), /* DAT3 */
-       /* SDI1 sleep state */
-       DB8500_PIN_SLEEP("GPIO208_AH16", slpm_out_lo_wkup_pdis, "sdi1"), /* CLK */
-       DB8500_PIN_SLEEP("GPIO209_AG15", slpm_in_wkup_pdis, "sdi1"), /* FBCLK */
-       DB8500_PIN_SLEEP("GPIO210_AJ15", slpm_in_wkup_pdis, "sdi1"), /* CMD */
-       DB8500_PIN_SLEEP("GPIO211_AG14", slpm_in_wkup_pdis, "sdi1"), /* DAT0 */
-       DB8500_PIN_SLEEP("GPIO212_AF13", slpm_in_wkup_pdis, "sdi1"), /* DAT1 */
-       DB8500_PIN_SLEEP("GPIO213_AG13", slpm_in_wkup_pdis, "sdi1"), /* DAT2 */
-       DB8500_PIN_SLEEP("GPIO214_AH15", slpm_in_wkup_pdis, "sdi1"), /* DAT3 */
-
-       /* Mux in SDI2 (here called MC2) used for for PoP eMMC */
-       DB8500_MUX("mc2_a_1", "mc2", "sdi2"),
-       DB8500_PIN("GPIO128_A5", out_lo, "sdi2"), /* CLK */
-       DB8500_PIN("GPIO129_B4", in_pu, "sdi2"), /* CMD */
-       DB8500_PIN("GPIO130_C8", in_nopull, "sdi2"), /* FBCLK */
-       DB8500_PIN("GPIO131_A12", in_pu, "sdi2"), /* DAT0 */
-       DB8500_PIN("GPIO132_C10", in_pu, "sdi2"), /* DAT1 */
-       DB8500_PIN("GPIO133_B10", in_pu, "sdi2"), /* DAT2 */
-       DB8500_PIN("GPIO134_B9", in_pu, "sdi2"), /* DAT3 */
-       DB8500_PIN("GPIO135_A9", in_pu, "sdi2"), /* DAT4 */
-       DB8500_PIN("GPIO136_C7", in_pu, "sdi2"), /* DAT5 */
-       DB8500_PIN("GPIO137_A7", in_pu, "sdi2"), /* DAT6 */
-       DB8500_PIN("GPIO138_C5", in_pu, "sdi2"), /* DAT7 */
-       /* SDI2 sleep state */
-       DB8500_PIN_SLEEP("GPIO128_A5", out_lo_wkup_pdis, "sdi2"), /* CLK */
-       DB8500_PIN_SLEEP("GPIO129_B4", in_wkup_pdis_en, "sdi2"), /* CMD */
-       DB8500_PIN_SLEEP("GPIO130_C8", in_wkup_pdis_en, "sdi2"), /* FBCLK */
-       DB8500_PIN_SLEEP("GPIO131_A12", in_wkup_pdis, "sdi2"), /* DAT0 */
-       DB8500_PIN_SLEEP("GPIO132_C10", in_wkup_pdis, "sdi2"), /* DAT1 */
-       DB8500_PIN_SLEEP("GPIO133_B10", in_wkup_pdis, "sdi2"), /* DAT2 */
-       DB8500_PIN_SLEEP("GPIO134_B9", in_wkup_pdis, "sdi2"), /* DAT3 */
-       DB8500_PIN_SLEEP("GPIO135_A9", in_wkup_pdis, "sdi2"), /* DAT4 */
-       DB8500_PIN_SLEEP("GPIO136_C7", in_wkup_pdis, "sdi2"), /* DAT5 */
-       DB8500_PIN_SLEEP("GPIO137_A7", in_wkup_pdis, "sdi2"), /* DAT6 */
-       DB8500_PIN_SLEEP("GPIO138_C5", in_wkup_pdis, "sdi2"), /* DAT7 */
-
-       /* Mux in SDI4 (here called MC4) used for for PCB-mounted eMMC */
-       DB8500_MUX("mc4_a_1", "mc4", "sdi4"),
-       DB8500_PIN("GPIO197_AH24", in_pu, "sdi4"), /* DAT3 */
-       DB8500_PIN("GPIO198_AG25", in_pu, "sdi4"), /* DAT2 */
-       DB8500_PIN("GPIO199_AH23", in_pu, "sdi4"), /* DAT1 */
-       DB8500_PIN("GPIO200_AH26", in_pu, "sdi4"), /* DAT0 */
-       DB8500_PIN("GPIO201_AF24", in_pu, "sdi4"), /* CMD */
-       DB8500_PIN("GPIO202_AF25", in_nopull, "sdi4"), /* FBCLK */
-       DB8500_PIN("GPIO203_AE23", out_lo, "sdi4"), /* CLK */
-       DB8500_PIN("GPIO204_AF23", in_pu, "sdi4"), /* DAT7 */
-       DB8500_PIN("GPIO205_AG23", in_pu, "sdi4"), /* DAT6 */
-       DB8500_PIN("GPIO206_AG24", in_pu, "sdi4"), /* DAT5 */
-       DB8500_PIN("GPIO207_AJ23", in_pu, "sdi4"), /* DAT4 */
-       /*SDI4 sleep state */
-       DB8500_PIN_SLEEP("GPIO197_AH24", slpm_in_wkup_pdis, "sdi4"), /* DAT3 */
-       DB8500_PIN_SLEEP("GPIO198_AG25", slpm_in_wkup_pdis, "sdi4"), /* DAT2 */
-       DB8500_PIN_SLEEP("GPIO199_AH23", slpm_in_wkup_pdis, "sdi4"), /* DAT1 */
-       DB8500_PIN_SLEEP("GPIO200_AH26", slpm_in_wkup_pdis, "sdi4"), /* DAT0 */
-       DB8500_PIN_SLEEP("GPIO201_AF24", slpm_in_wkup_pdis, "sdi4"), /* CMD */
-       DB8500_PIN_SLEEP("GPIO202_AF25", slpm_in_wkup_pdis, "sdi4"), /* FBCLK */
-       DB8500_PIN_SLEEP("GPIO203_AE23", slpm_out_lo_wkup_pdis, "sdi4"), /* CLK */
-       DB8500_PIN_SLEEP("GPIO204_AF23", slpm_in_wkup_pdis, "sdi4"), /* DAT7 */
-       DB8500_PIN_SLEEP("GPIO205_AG23", slpm_in_wkup_pdis, "sdi4"), /* DAT6 */
-       DB8500_PIN_SLEEP("GPIO206_AG24", slpm_in_wkup_pdis, "sdi4"), /* DAT5 */
-       DB8500_PIN_SLEEP("GPIO207_AJ23", slpm_in_wkup_pdis, "sdi4"), /* DAT4 */
-
-       /* Mux in USB pins, drive STP high */
-       /* USB default state */
-       DB8500_MUX("usb_a_1", "usb", "ab8500-usb.0"),
-       DB8500_PIN("GPIO257_AE29", out_hi, "ab8500-usb.0"), /* STP */
-       /* USB sleep state */
-       DB8500_PIN_SLEEP("GPIO256_AF28", slpm_wkup_pdis_en, "ab8500-usb.0"), /* NXT */
-       DB8500_PIN_SLEEP("GPIO257_AE29", slpm_out_hi_wkup_pdis, "ab8500-usb.0"), /* STP */
-       DB8500_PIN_SLEEP("GPIO258_AD29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* XCLK */
-       DB8500_PIN_SLEEP("GPIO259_AC29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* DIR */
-       DB8500_PIN_SLEEP("GPIO260_AD28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT7 */
-       DB8500_PIN_SLEEP("GPIO261_AD26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT6 */
-       DB8500_PIN_SLEEP("GPIO262_AE26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT5 */
-       DB8500_PIN_SLEEP("GPIO263_AG29", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT4 */
-       DB8500_PIN_SLEEP("GPIO264_AE27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT3 */
-       DB8500_PIN_SLEEP("GPIO265_AD27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT2 */
-       DB8500_PIN_SLEEP("GPIO266_AC28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT1 */
-       DB8500_PIN_SLEEP("GPIO267_AC27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT0 */
-
-       /* Mux in SPI2 pins on the "other C1" altfunction */
-       DB8500_MUX("spi2_oc1_2", "spi2", "spi2"),
-       DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */
-       DB8500_PIN("GPIO218_AH11", in_pd, "spi2"), /* RXD */
-       DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */
-       DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */
-       /* SPI2 idle state */
-       DB8500_PIN_IDLE("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */
-       DB8500_PIN_IDLE("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */
-       DB8500_PIN_IDLE("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */
-       /* SPI2 sleep state */
-       DB8500_PIN_SLEEP("GPIO216_AG12", slpm_in_wkup_pdis, "spi2"), /* FRM */
-       DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */
-       DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */
-       DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */
-
-       /* ske default state */
-       DB8500_MUX("kp_a_2", "kp", "nmk-ske-keypad"),
-       DB8500_PIN("GPIO153_B17", in_pd, "nmk-ske-keypad"), /* I7 */
-       DB8500_PIN("GPIO154_C16", in_pd, "nmk-ske-keypad"), /* I6 */
-       DB8500_PIN("GPIO155_C19", in_pd, "nmk-ske-keypad"), /* I5 */
-       DB8500_PIN("GPIO156_C17", in_pd, "nmk-ske-keypad"), /* I4 */
-       DB8500_PIN("GPIO161_D21", in_pd, "nmk-ske-keypad"), /* I3 */
-       DB8500_PIN("GPIO162_D20", in_pd, "nmk-ske-keypad"), /* I2 */
-       DB8500_PIN("GPIO163_C20", in_pd, "nmk-ske-keypad"), /* I1 */
-       DB8500_PIN("GPIO164_B21", in_pd, "nmk-ske-keypad"), /* I0 */
-       DB8500_PIN("GPIO157_A18", out_lo, "nmk-ske-keypad"), /* O7 */
-       DB8500_PIN("GPIO158_C18", out_lo, "nmk-ske-keypad"), /* O6 */
-       DB8500_PIN("GPIO159_B19", out_lo, "nmk-ske-keypad"), /* O5 */
-       DB8500_PIN("GPIO160_B20", out_lo, "nmk-ske-keypad"), /* O4 */
-       DB8500_PIN("GPIO165_C21", out_lo, "nmk-ske-keypad"), /* O3 */
-       DB8500_PIN("GPIO166_A22", out_lo, "nmk-ske-keypad"), /* O2 */
-       DB8500_PIN("GPIO167_B24", out_lo, "nmk-ske-keypad"), /* O1 */
-       DB8500_PIN("GPIO168_C22", out_lo, "nmk-ske-keypad"), /* O0 */
-       /* ske sleep state */
-       DB8500_PIN_SLEEP("GPIO153_B17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I7 */
-       DB8500_PIN_SLEEP("GPIO154_C16", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I6 */
-       DB8500_PIN_SLEEP("GPIO155_C19", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I5 */
-       DB8500_PIN_SLEEP("GPIO156_C17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I4 */
-       DB8500_PIN_SLEEP("GPIO161_D21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I3 */
-       DB8500_PIN_SLEEP("GPIO162_D20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I2 */
-       DB8500_PIN_SLEEP("GPIO163_C20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I1 */
-       DB8500_PIN_SLEEP("GPIO164_B21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I0 */
-       DB8500_PIN_SLEEP("GPIO157_A18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O7 */
-       DB8500_PIN_SLEEP("GPIO158_C18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O6 */
-       DB8500_PIN_SLEEP("GPIO159_B19", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O5 */
-       DB8500_PIN_SLEEP("GPIO160_B20", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O4 */
-       DB8500_PIN_SLEEP("GPIO165_C21", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O3 */
-       DB8500_PIN_SLEEP("GPIO166_A22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O2 */
-       DB8500_PIN_SLEEP("GPIO167_B24", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O1 */
-       DB8500_PIN_SLEEP("GPIO168_C22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O0 */
-
-       /* STM APE pins states */
-       DB8500_MUX_STATE("stmape_c_1", "stmape",
-               "stm", "ape_mipi34"),
-       DB8500_PIN_STATE("GPIO70_G5", in_nopull,
-               "stm", "ape_mipi34"), /* clk */
-       DB8500_PIN_STATE("GPIO71_G4", in_nopull,
-               "stm", "ape_mipi34"), /* dat3 */
-       DB8500_PIN_STATE("GPIO72_H4", in_nopull,
-               "stm", "ape_mipi34"), /* dat2 */
-       DB8500_PIN_STATE("GPIO73_H3", in_nopull,
-               "stm", "ape_mipi34"), /* dat1 */
-       DB8500_PIN_STATE("GPIO74_J3", in_nopull,
-               "stm", "ape_mipi34"), /* dat0 */
-
-       DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
-               "stm", "ape_mipi34_sleep"), /* clk */
-       DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
-               "stm", "ape_mipi34_sleep"), /* dat3 */
-       DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
-               "stm", "ape_mipi34_sleep"), /* dat2 */
-       DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
-               "stm", "ape_mipi34_sleep"), /* dat1 */
-       DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
-               "stm", "ape_mipi34_sleep"), /* dat0 */
-
-       DB8500_MUX_STATE("stmape_oc1_1", "stmape",
-               "stm", "ape_microsd"),
-       DB8500_PIN_STATE("GPIO23_AA4", in_nopull,
-               "stm", "ape_microsd"), /* clk */
-       DB8500_PIN_STATE("GPIO25_Y4", in_nopull,
-               "stm", "ape_microsd"), /* dat0 */
-       DB8500_PIN_STATE("GPIO26_Y2", in_nopull,
-               "stm", "ape_microsd"), /* dat1 */
-       DB8500_PIN_STATE("GPIO27_AA2", in_nopull,
-               "stm", "ape_microsd"), /* dat2 */
-       DB8500_PIN_STATE("GPIO28_AA1", in_nopull,
-               "stm", "ape_microsd"), /* dat3 */
-
-       DB8500_PIN_STATE("GPIO23_AA4", slpm_out_lo_wkup_pdis,
-               "stm", "ape_microsd_sleep"), /* clk */
-       DB8500_PIN_STATE("GPIO25_Y4", slpm_in_wkup_pdis,
-               "stm", "ape_microsd_sleep"), /* dat0 */
-       DB8500_PIN_STATE("GPIO26_Y2", slpm_in_wkup_pdis,
-               "stm", "ape_microsd_sleep"), /* dat1 */
-       DB8500_PIN_STATE("GPIO27_AA2", slpm_in_wkup_pdis,
-               "stm", "ape_microsd_sleep"), /* dat2 */
-       DB8500_PIN_STATE("GPIO28_AA1", slpm_in_wkup_pdis,
-               "stm", "ape_microsd_sleep"), /* dat3 */
-
-       /*  STM Modem pins states */
-       DB8500_MUX_STATE("stmmod_oc3_2", "stmmod",
-               "stm", "mod_mipi34"),
-       DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
-               "stm", "mod_mipi34"),
-       DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
-               "stm", "mod_mipi34"),
-       DB8500_PIN_STATE("GPIO70_G5", in_nopull,
-               "stm", "mod_mipi34"), /* clk */
-       DB8500_PIN_STATE("GPIO71_G4", in_nopull,
-               "stm", "mod_mipi34"), /* dat3 */
-       DB8500_PIN_STATE("GPIO72_H4", in_nopull,
-               "stm", "mod_mipi34"), /* dat2 */
-       DB8500_PIN_STATE("GPIO73_H3", in_nopull,
-               "stm", "mod_mipi34"), /* dat1 */
-       DB8500_PIN_STATE("GPIO74_J3", in_nopull,
-               "stm", "mod_mipi34"), /* dat0 */
-       DB8500_PIN_STATE("GPIO75_H2", in_pu,
-               "stm", "mod_mipi34"), /* uartmod rx */
-       DB8500_PIN_STATE("GPIO76_J2", out_lo,
-               "stm", "mod_mipi34"), /* uartmod tx */
-
-       DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
-               "stm", "mod_mipi34_sleep"), /* clk */
-       DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
-               "stm", "mod_mipi34_sleep"), /* dat3 */
-       DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
-               "stm", "mod_mipi34_sleep"), /* dat2 */
-       DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
-               "stm", "mod_mipi34_sleep"), /* dat1 */
-       DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
-               "stm", "mod_mipi34_sleep"), /* dat0 */
-       DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
-               "stm", "mod_mipi34_sleep"), /* uartmod rx */
-       DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
-               "stm", "mod_mipi34_sleep"), /* uartmod tx */
-
-       DB8500_MUX_STATE("stmmod_b_1", "stmmod",
-               "stm", "mod_microsd"),
-       DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
-               "stm", "mod_microsd"),
-       DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
-               "stm", "mod_microsd"),
-       DB8500_PIN_STATE("GPIO23_AA4", in_nopull,
-               "stm", "mod_microsd"), /* clk */
-       DB8500_PIN_STATE("GPIO25_Y4", in_nopull,
-               "stm", "mod_microsd"), /* dat0 */
-       DB8500_PIN_STATE("GPIO26_Y2", in_nopull,
-               "stm", "mod_microsd"), /* dat1 */
-       DB8500_PIN_STATE("GPIO27_AA2", in_nopull,
-               "stm", "mod_microsd"), /* dat2 */
-       DB8500_PIN_STATE("GPIO28_AA1", in_nopull,
-               "stm", "mod_microsd"), /* dat3 */
-       DB8500_PIN_STATE("GPIO75_H2", in_pu,
-               "stm", "mod_microsd"), /* uartmod rx */
-       DB8500_PIN_STATE("GPIO76_J2", out_lo,
-               "stm", "mod_microsd"), /* uartmod tx */
-
-       DB8500_PIN_STATE("GPIO23_AA4", slpm_out_lo_wkup_pdis,
-               "stm", "mod_microsd_sleep"), /* clk */
-       DB8500_PIN_STATE("GPIO25_Y4", slpm_in_wkup_pdis,
-               "stm", "mod_microsd_sleep"), /* dat0 */
-       DB8500_PIN_STATE("GPIO26_Y2", slpm_in_wkup_pdis,
-               "stm", "mod_microsd_sleep"), /* dat1 */
-       DB8500_PIN_STATE("GPIO27_AA2", slpm_in_wkup_pdis,
-               "stm", "mod_microsd_sleep"), /* dat2 */
-       DB8500_PIN_STATE("GPIO28_AA1", slpm_in_wkup_pdis,
-               "stm", "mod_microsd_sleep"), /* dat3 */
-       DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
-               "stm", "mod_microsd_sleep"), /* uartmod rx */
-       DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
-               "stm", "mod_microsd_sleep"), /* uartmod tx */
-
-       /*  STM dual Modem/APE pins state */
-       DB8500_MUX_STATE("stmmod_oc3_2", "stmmod",
-               "stm", "mod_mipi34_ape_mipi60"),
-       DB8500_MUX_STATE("stmape_c_2", "stmape",
-               "stm", "mod_mipi34_ape_mipi60"),
-       DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
-               "stm", "mod_mipi34_ape_mipi60"),
-       DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
-               "stm", "mod_mipi34_ape_mipi60"),
-       DB8500_PIN_STATE("GPIO70_G5", in_nopull,
-               "stm", "mod_mipi34_ape_mipi60"), /* clk */
-       DB8500_PIN_STATE("GPIO71_G4", in_nopull,
-               "stm", "mod_mipi34_ape_mipi60"), /* dat3 */
-       DB8500_PIN_STATE("GPIO72_H4", in_nopull,
-               "stm", "mod_mipi34_ape_mipi60"), /* dat2 */
-       DB8500_PIN_STATE("GPIO73_H3", in_nopull,
-               "stm", "mod_mipi34_ape_mipi60"), /* dat1 */
-       DB8500_PIN_STATE("GPIO74_J3", in_nopull,
-               "stm", "mod_mipi34_ape_mipi60"), /* dat0 */
-       DB8500_PIN_STATE("GPIO75_H2", in_pu,
-               "stm", "mod_mipi34_ape_mipi60"), /* uartmod rx */
-       DB8500_PIN_STATE("GPIO76_J2", out_lo,
-               "stm", "mod_mipi34_ape_mipi60"), /* uartmod tx */
-       DB8500_PIN_STATE("GPIO155_C19", in_nopull,
-               "stm", "mod_mipi34_ape_mipi60"), /* clk */
-       DB8500_PIN_STATE("GPIO156_C17", in_nopull,
-               "stm", "mod_mipi34_ape_mipi60"), /* dat3 */
-       DB8500_PIN_STATE("GPIO157_A18", in_nopull,
-               "stm", "mod_mipi34_ape_mipi60"), /* dat2 */
-       DB8500_PIN_STATE("GPIO158_C18", in_nopull,
-               "stm", "mod_mipi34_ape_mipi60"), /* dat1 */
-       DB8500_PIN_STATE("GPIO159_B19", in_nopull,
-               "stm", "mod_mipi34_ape_mipi60"), /* dat0 */
-
-       DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* clk */
-       DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat3 */
-       DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat2 */
-       DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat1 */
-       DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat0 */
-       DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* uartmod rx */
-       DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* uartmod tx */
-       DB8500_PIN_STATE("GPIO155_C19", slpm_in_wkup_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* clk */
-       DB8500_PIN_STATE("GPIO156_C17", slpm_in_wkup_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat3 */
-       DB8500_PIN_STATE("GPIO157_A18", slpm_in_wkup_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat2 */
-       DB8500_PIN_STATE("GPIO158_C18", slpm_in_wkup_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat1 */
-       DB8500_PIN_STATE("GPIO159_B19", slpm_in_wkup_pdis,
-               "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat0 */
-};
-
-/*
- * These are specifically for the MOP500 and HREFP (pre-v60) version of the
- * board, which utilized a TC35892 GPIO expander instead of using a lot of
- * on-chip pins as the HREFv60 and later does.
- */
-static struct pinctrl_map __initdata mop500_pinmap[] = {
-       /* Mux in SSP0, pull down RXD pin */
-       DB8500_MUX_HOG("ssp0_a_1", "ssp0"),
-       DB8500_PIN_HOG("GPIO145_C13", pd),
-       /*
-        * XENON Flashgun on image processor GPIO (controlled from image
-        * processor firmware), mux in these image processor GPIO lines 0
-        * (XENON_FLASH_ID) and 1 (XENON_READY) on altfunction C and pull up
-        * the pins.
-        */
-       DB8500_MUX_HOG("ipgpio0_c_1", "ipgpio"),
-       DB8500_MUX_HOG("ipgpio1_c_1", "ipgpio"),
-       DB8500_PIN_HOG("GPIO6_AF6", in_pu),
-       DB8500_PIN_HOG("GPIO7_AG5", in_pu),
-       /* TC35892 IRQ, pull up the line, let the driver mux in the pin */
-       DB8500_PIN_HOG("GPIO217_AH12", gpio_in_pu),
-       /* Mux in UART1 and set the pull-ups */
-       DB8500_MUX_HOG("u1rxtx_a_1", "u1"),
-       DB8500_PIN_HOG("GPIO4_AH6", in_pu), /* RXD */
-       DB8500_PIN_HOG("GPIO5_AG6", out_hi), /* TXD */
-       /*
-        * Runtime stuff: make it possible to mux in the SKE keypad
-        * and bias the pins
-        */
-       /* ske default state */
-       DB8500_MUX("kp_a_2", "kp", "nmk-ske-keypad"),
-       DB8500_PIN("GPIO153_B17", in_pu, "nmk-ske-keypad"), /* I7 */
-       DB8500_PIN("GPIO154_C16", in_pu, "nmk-ske-keypad"), /* I6 */
-       DB8500_PIN("GPIO155_C19", in_pu, "nmk-ske-keypad"), /* I5 */
-       DB8500_PIN("GPIO156_C17", in_pu, "nmk-ske-keypad"), /* I4 */
-       DB8500_PIN("GPIO161_D21", in_pu, "nmk-ske-keypad"), /* I3 */
-       DB8500_PIN("GPIO162_D20", in_pu, "nmk-ske-keypad"), /* I2 */
-       DB8500_PIN("GPIO163_C20", in_pu, "nmk-ske-keypad"), /* I1 */
-       DB8500_PIN("GPIO164_B21", in_pu, "nmk-ske-keypad"), /* I0 */
-       DB8500_PIN("GPIO157_A18", out_lo, "nmk-ske-keypad"), /* O7 */
-       DB8500_PIN("GPIO158_C18", out_lo, "nmk-ske-keypad"), /* O6 */
-       DB8500_PIN("GPIO159_B19", out_lo, "nmk-ske-keypad"), /* O5 */
-       DB8500_PIN("GPIO160_B20", out_lo, "nmk-ske-keypad"), /* O4 */
-       DB8500_PIN("GPIO165_C21", out_lo, "nmk-ske-keypad"), /* O3 */
-       DB8500_PIN("GPIO166_A22", out_lo, "nmk-ske-keypad"), /* O2 */
-       DB8500_PIN("GPIO167_B24", out_lo, "nmk-ske-keypad"), /* O1 */
-       DB8500_PIN("GPIO168_C22", out_lo, "nmk-ske-keypad"), /* O0 */
-       /* ske sleep state */
-       DB8500_PIN_SLEEP("GPIO153_B17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I7 */
-       DB8500_PIN_SLEEP("GPIO154_C16", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I6 */
-       DB8500_PIN_SLEEP("GPIO155_C19", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I5 */
-       DB8500_PIN_SLEEP("GPIO156_C17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I4 */
-       DB8500_PIN_SLEEP("GPIO161_D21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I3 */
-       DB8500_PIN_SLEEP("GPIO162_D20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I2 */
-       DB8500_PIN_SLEEP("GPIO163_C20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I1 */
-       DB8500_PIN_SLEEP("GPIO164_B21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I0 */
-       DB8500_PIN_SLEEP("GPIO157_A18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O7 */
-       DB8500_PIN_SLEEP("GPIO158_C18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O6 */
-       DB8500_PIN_SLEEP("GPIO159_B19", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O5 */
-       DB8500_PIN_SLEEP("GPIO160_B20", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O4 */
-       DB8500_PIN_SLEEP("GPIO165_C21", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O3 */
-       DB8500_PIN_SLEEP("GPIO166_A22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O2 */
-       DB8500_PIN_SLEEP("GPIO167_B24", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O1 */
-       DB8500_PIN_SLEEP("GPIO168_C22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O0 */
-
-       /* Mux in and drive the SDI0 DAT31DIR line high at runtime */
-       DB8500_MUX("mc0dat31dir_a_1", "mc0", "sdi0"),
-       DB8500_PIN("GPIO21_AB3", out_hi, "sdi0"),
-};
-
-/*
- * The HREFv60 series of platforms is using available pins on the DB8500
- * insteaf of the Toshiba I2C GPIO expander, reusing some pins like the SSP0
- * and SSP1 ports (previously connected to the AB8500) as generic GPIO lines.
- */
-static struct pinctrl_map __initdata hrefv60_pinmap[] = {
-       /* Drive WLAN_ENA low */
-       DB8500_PIN_HOG("GPIO85_D5", gpio_out_lo), /* WLAN_ENA */
-       /*
-        * XENON Flashgun on image processor GPIO (controlled from image
-        * processor firmware), mux in these image processor GPIO lines 0
-        * (XENON_FLASH_ID), 1 (XENON_READY) and there is an assistant
-        * LED on IP GPIO 4 (XENON_EN2) on altfunction C, that need bias
-        * from GPIO21 so pull up 0, 1 and drive 4 and GPIO21 low as output.
-        */
-       DB8500_MUX_HOG("ipgpio0_c_1", "ipgpio"),
-       DB8500_MUX_HOG("ipgpio1_c_1", "ipgpio"),
-       DB8500_MUX_HOG("ipgpio4_c_1", "ipgpio"),
-       DB8500_PIN_HOG("GPIO6_AF6", in_pu), /* XENON_FLASH_ID */
-       DB8500_PIN_HOG("GPIO7_AG5", in_pu), /* XENON_READY */
-       DB8500_PIN_HOG("GPIO21_AB3", gpio_out_lo), /* XENON_EN1 */
-       DB8500_PIN_HOG("GPIO64_F3", out_lo), /* XENON_EN2 */
-       /* Magnetometer uses GPIO 31 and 32, pull these up/down respectively */
-       DB8500_PIN_HOG("GPIO31_V3", gpio_in_pu), /* EN1 */
-       DB8500_PIN_HOG("GPIO32_V2", gpio_in_pd), /* DRDY */
-       /*
-        * Display Interface 1 uses GPIO 65 for RST (reset).
-        * Display Interface 2 uses GPIO 66 for RST (reset).
-        * Drive DISP1 reset high (not reset), driver DISP2 reset low (reset)
-        */
-       DB8500_PIN_HOG("GPIO65_F1", gpio_out_hi), /* DISP1 NO RST */
-       DB8500_PIN_HOG("GPIO66_G3", gpio_out_lo), /* DISP2 RST */
-       /*
-        * Touch screen uses GPIO 143 for RST1, GPIO 146 for RST2 and
-        * GPIO 67 for interrupts. Pull-up the IRQ line and drive both
-        * reset signals low.
-        */
-       DB8500_PIN_HOG("GPIO143_D12", gpio_out_lo), /* TOUCH_RST1 */
-       DB8500_PIN_HOG("GPIO67_G2", gpio_in_pu), /* TOUCH_INT2 */
-       DB8500_PIN_HOG("GPIO146_D13", gpio_out_lo), /* TOUCH_RST2 */
-       /*
-        * Drive D19-D23 for the ETM PTM trace interface low,
-        * (presumably pins are unconnected therefore grounded here,
-        * the "other alt C1" setting enables these pins)
-        */
-       DB8500_PIN_HOG("GPIO70_G5", gpio_out_lo),
-       DB8500_PIN_HOG("GPIO71_G4", gpio_out_lo),
-       DB8500_PIN_HOG("GPIO72_H4", gpio_out_lo),
-       DB8500_PIN_HOG("GPIO73_H3", gpio_out_lo),
-       DB8500_PIN_HOG("GPIO74_J3", gpio_out_lo),
-       /* NAHJ CTRL on GPIO 76 to low, CTRL_INV on GPIO216 to high */
-       DB8500_PIN_HOG("GPIO76_J2", gpio_out_lo), /* CTRL */
-       DB8500_PIN_HOG("GPIO216_AG12", gpio_out_hi), /* CTRL_INV */
-       /* NFC ENA and RESET to low, pulldown IRQ line */
-       DB8500_PIN_HOG("GPIO77_H1", gpio_out_lo), /* NFC_ENA */
-       DB8500_PIN_HOG("GPIO144_B13", gpio_in_pd), /* NFC_IRQ */
-       DB8500_PIN_HOG("GPIO142_C11", gpio_out_lo), /* NFC_RESET */
-       /*
-        * SKE keyboard partly on alt A and partly on "Other alt C1"
-        * Driver KP_O1,2,3,6,7 low and pull up KP_I 0,2,3 for three
-        * rows of 6 keys, then pull up force sensing interrup and
-        * drive reset and force sensing WU low.
-        */
-       DB8500_MUX_HOG("kp_a_1", "kp"),
-       DB8500_MUX_HOG("kp_oc1_1", "kp"),
-       DB8500_PIN_HOG("GPIO90_A3", out_lo), /* KP_O1 */
-       DB8500_PIN_HOG("GPIO87_B3", out_lo), /* KP_O2 */
-       DB8500_PIN_HOG("GPIO86_C6", out_lo), /* KP_O3 */
-       DB8500_PIN_HOG("GPIO96_D8", out_lo), /* KP_O6 */
-       DB8500_PIN_HOG("GPIO94_D7", out_lo), /* KP_O7 */
-       DB8500_PIN_HOG("GPIO93_B7", in_pu), /* KP_I0 */
-       DB8500_PIN_HOG("GPIO89_E6", in_pu), /* KP_I2 */
-       DB8500_PIN_HOG("GPIO88_C4", in_pu), /* KP_I3 */
-       DB8500_PIN_HOG("GPIO91_B6", gpio_in_pu), /* FORCE_SENSING_INT */
-       DB8500_PIN_HOG("GPIO92_D6", gpio_out_lo), /* FORCE_SENSING_RST */
-       DB8500_PIN_HOG("GPIO97_D9", gpio_out_lo), /* FORCE_SENSING_WU */
-       /* DiPro Sensor interrupt */
-       DB8500_PIN_HOG("GPIO139_C9", gpio_in_pu), /* DIPRO_INT */
-       /* Audio Amplifier HF enable */
-       DB8500_PIN_HOG("GPIO149_B14", gpio_out_hi), /* VAUDIO_HF_EN, enable MAX8968 */
-       /* GBF interface, pull low to reset state */
-       DB8500_PIN_HOG("GPIO171_D23", gpio_out_lo), /* GBF_ENA_RESET */
-       /* MSP : HDTV INTERFACE GPIO line */
-       DB8500_PIN_HOG("GPIO192_AJ27", gpio_in_pd),
-       /* Accelerometer interrupt lines */
-       DB8500_PIN_HOG("GPIO82_C1", gpio_in_pu), /* ACC_INT1 */
-       DB8500_PIN_HOG("GPIO83_D3", gpio_in_pu), /* ACC_INT2 */
-       /* SD card detect GPIO pin */
-       DB8500_PIN_HOG("GPIO95_E8", gpio_in_pu),
-       /*
-        * Runtime stuff
-        * Pull up/down of some sensor GPIO pins, for proximity, HAL sensor
-        * etc.
-        */
-       DB8500_PIN("GPIO217_AH12", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
-       DB8500_PIN("GPIO145_C13", gpio_in_pd_slpm_gpio_nopull, "gpio-keys.0"),
-       DB8500_PIN("GPIO139_C9", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
-};
-
-static struct pinctrl_map __initdata u9500_pinmap[] = {
-       /* Mux in UART1 (just RX/TX) and set the pull-ups */
-       DB8500_MUX_HOG("u1rxtx_a_1", "u1"),
-       DB8500_PIN_HOG("GPIO4_AH6", in_pu),
-       DB8500_PIN_HOG("GPIO5_AG6", out_hi),
-       /* WLAN_IRQ line */
-       DB8500_PIN_HOG("GPIO144_B13", gpio_in_pu),
-       /* HSI */
-       DB8500_MUX_HOG("hsir_a_1", "hsi"),
-       DB8500_MUX_HOG("hsit_a_2", "hsi"),
-       DB8500_PIN_HOG("GPIO219_AG10", in_pd), /* RX FLA0 */
-       DB8500_PIN_HOG("GPIO220_AH10", in_pd), /* RX DAT0 */
-       DB8500_PIN_HOG("GPIO221_AJ11", out_lo), /* RX RDY0 */
-       DB8500_PIN_HOG("GPIO222_AJ9", out_lo), /* TX FLA0 */
-       DB8500_PIN_HOG("GPIO223_AH9", out_lo), /* TX DAT0 */
-       DB8500_PIN_HOG("GPIO224_AG9", in_pd), /* TX RDY0 */
-       DB8500_PIN_HOG("GPIO225_AG8", in_pd), /* CAWAKE0 */
-       DB8500_PIN_HOG("GPIO226_AF8", gpio_out_hi), /* ACWAKE0 */
-};
-
-static struct pinctrl_map __initdata u8500_pinmap[] = {
-       DB8500_PIN_HOG("GPIO226_AF8", gpio_out_lo), /* WLAN_PMU_EN */
-       DB8500_PIN_HOG("GPIO4_AH6", gpio_in_pu), /* WLAN_IRQ */
-};
-
-static struct pinctrl_map __initdata snowball_pinmap[] = {
-       /* Mux in SSP0 connected to AB8500, pull down RXD pin */
-       DB8500_MUX_HOG("ssp0_a_1", "ssp0"),
-       DB8500_PIN_HOG("GPIO145_C13", pd),
-       /* Always drive the MC0 DAT31DIR line high on these boards */
-       DB8500_PIN_HOG("GPIO21_AB3", out_hi),
-       /* Mux in "SM" which is used for the SMSC911x Ethernet adapter */
-       DB8500_MUX_HOG("sm_b_1", "sm"),
-       /* User LED */
-       DB8500_PIN_HOG("GPIO142_C11", gpio_out_hi),
-       /* Drive RSTn_LAN high */
-       DB8500_PIN_HOG("GPIO141_C12", gpio_out_hi),
-       /*  Accelerometer/Magnetometer */
-       DB8500_PIN_HOG("GPIO163_C20", gpio_in_pu), /* ACCEL_IRQ1 */
-       DB8500_PIN_HOG("GPIO164_B21", gpio_in_pu), /* ACCEL_IRQ2 */
-       DB8500_PIN_HOG("GPIO165_C21", gpio_in_pu), /* MAG_DRDY */
-       /* WLAN/GBF */
-       DB8500_PIN_HOG("GPIO161_D21", gpio_out_lo), /* WLAN_PMU_EN */
-       DB8500_PIN_HOG("GPIO171_D23", gpio_out_hi), /* GBF_ENA */
-       DB8500_PIN_HOG("GPIO215_AH13", gpio_out_lo), /* WLAN_ENA */
-       DB8500_PIN_HOG("GPIO216_AG12", gpio_in_pu), /* WLAN_IRQ */
-};
-
-/*
- * passing "pinsfor=" in kernel cmdline allows for custom
- * configuration of GPIOs on u8500 derived boards.
- */
-static int __init early_pinsfor(char *p)
-{
-       pinsfor = PINS_FOR_DEFAULT;
-
-       if (strcmp(p, "u9500-21") == 0)
-               pinsfor = PINS_FOR_U9500;
-
-       return 0;
-}
-early_param("pinsfor", early_pinsfor);
-
-int pins_for_u9500(void)
-{
-       if (pinsfor == PINS_FOR_U9500)
-               return 1;
-
-       return 0;
-}
-
-static void __init mop500_href_family_pinmaps_init(void)
-{
-       switch (pinsfor) {
-       case PINS_FOR_U9500:
-               pinctrl_register_mappings(u9500_pinmap,
-                                         ARRAY_SIZE(u9500_pinmap));
-               break;
-       case PINS_FOR_DEFAULT:
-               pinctrl_register_mappings(u8500_pinmap,
-                                         ARRAY_SIZE(u8500_pinmap));
-       default:
-               break;
-       }
-}
-
 void __init mop500_pinmaps_init(void)
 {
-       pinctrl_register_mappings(mop500_family_pinmap,
-                                 ARRAY_SIZE(mop500_family_pinmap));
-       pinctrl_register_mappings(mop500_pinmap,
-                                 ARRAY_SIZE(mop500_pinmap));
-       mop500_href_family_pinmaps_init();
        if (machine_is_u8520())
                pinctrl_register_mappings(ab8505_pinmap,
                                          ARRAY_SIZE(ab8505_pinmap));
@@ -1073,23 +280,12 @@ void __init mop500_pinmaps_init(void)
 
 void __init snowball_pinmaps_init(void)
 {
-       pinctrl_register_mappings(mop500_family_pinmap,
-                                 ARRAY_SIZE(mop500_family_pinmap));
-       pinctrl_register_mappings(snowball_pinmap,
-                                 ARRAY_SIZE(snowball_pinmap));
-       pinctrl_register_mappings(u8500_pinmap,
-                                 ARRAY_SIZE(u8500_pinmap));
        pinctrl_register_mappings(ab8500_pinmap,
                                  ARRAY_SIZE(ab8500_pinmap));
 }
 
 void __init hrefv60_pinmaps_init(void)
 {
-       pinctrl_register_mappings(mop500_family_pinmap,
-                                 ARRAY_SIZE(mop500_family_pinmap));
-       pinctrl_register_mappings(hrefv60_pinmap,
-                                 ARRAY_SIZE(hrefv60_pinmap));
-       mop500_href_family_pinmaps_init();
        pinctrl_register_mappings(ab8500_pinmap,
                                  ARRAY_SIZE(ab8500_pinmap));
 }
index 0dc44c6834273ecf915b7a6a920db3bc6b565aa4..a4e139aa244125431a838990320937f2d7d40c77 100644 (file)
@@ -30,20 +30,6 @@ struct regulator_init_data gpio_en_3v3_regulator = {
        .consumer_supplies = gpio_en_3v3_consumers,
 };
 
-static struct regulator_consumer_supply sdi0_reg_consumers[] = {
-        REGULATOR_SUPPLY("vqmmc", "sdi0"),
-};
-
-struct regulator_init_data sdi0_reg_init_data = {
-        .constraints = {
-                .min_uV         = 1800000,
-                .max_uV         = 2900000,
-                .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE|REGULATOR_CHANGE_STATUS,
-        },
-        .num_consumer_supplies  = ARRAY_SIZE(sdi0_reg_consumers),
-        .consumer_supplies      = sdi0_reg_consumers,
-};
-
 /*
  * TPS61052 regulator
  */
index 039f5132c370773c7eb8b50b1e16c94cf2e6c1c2..9bece38fe9333cf71ec1d95238b57bf955a2f14d 100644 (file)
@@ -18,7 +18,6 @@ extern struct ab8500_regulator_platform_data ab8500_regulator_plat_data;
 extern struct ab8500_regulator_platform_data ab8505_regulator_plat_data;
 extern struct regulator_init_data tps61052_regulator;
 extern struct regulator_init_data gpio_en_3v3_regulator;
-extern struct regulator_init_data sdi0_reg_init_data;
 
 void mop500_regulator_init(void);
 
index 26600a1c53190ad3ae3724456a17dd7b8a35009d..fcbf3a13a5392235a9343fb44b66f2891bdb38c4 100644 (file)
 #include <linux/platform_data/dma-ste-dma40.h>
 
 #include <asm/mach-types.h>
-#include "devices.h"
 
 #include "db8500-regs.h"
-#include "devices-db8500.h"
 #include "board-mop500.h"
 #include "ste-dma40-db8500.h"
 
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
deleted file mode 100644 (file)
index 514d40b..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2008-2012 ST-Ericsson
- *
- * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2, as
- * published by the Free Software Foundation.
- *
- */
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/platform_data/db8500_thermal.h>
-#include <linux/amba/bus.h>
-#include <linux/amba/pl022.h>
-#include <linux/mfd/abx500/ab8500.h>
-#include <linux/regulator/ab8500.h>
-#include <linux/regulator/fixed.h>
-#include <linux/regulator/driver.h>
-#include <linux/mfd/tps6105x.h>
-#include <linux/platform_data/leds-lp55xx.h>
-#include <linux/input.h>
-#include <linux/delay.h>
-#include <linux/leds.h>
-#include <linux/pinctrl/consumer.h>
-#include <linux/platform_data/pinctrl-nomadik.h>
-#include <linux/platform_data/dma-ste-dma40.h>
-
-#include <asm/mach-types.h>
-
-#include "setup.h"
-#include "devices.h"
-#include "irqs.h"
-
-#include "ste-dma40-db8500.h"
-#include "db8500-regs.h"
-#include "devices-db8500.h"
-#include "board-mop500.h"
-#include "board-mop500-regulators.h"
-
-struct ab8500_platform_data ab8500_platdata = {
-       .irq_base       = MOP500_AB8500_IRQ_BASE,
-       .regulator      = &ab8500_regulator_plat_data,
-};
-
-#ifdef CONFIG_STE_DMA40
-static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
-       .mode = STEDMA40_MODE_LOGICAL,
-       .dir = DMA_DEV_TO_MEM,
-       .dev_type = DB8500_DMA_DEV8_SSP0,
-};
-
-static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
-       .mode = STEDMA40_MODE_LOGICAL,
-       .dir = DMA_MEM_TO_DEV,
-       .dev_type = DB8500_DMA_DEV8_SSP0,
-};
-#endif
-
-struct pl022_ssp_controller ssp0_plat = {
-       .bus_id = 0,
-#ifdef CONFIG_STE_DMA40
-       .enable_dma = 1,
-       .dma_filter = stedma40_filter,
-       .dma_rx_param = &ssp0_dma_cfg_rx,
-       .dma_tx_param = &ssp0_dma_cfg_tx,
-#else
-       .enable_dma = 0,
-#endif
-       /* on this platform, gpio 31,142,144,214 &
-        * 224 are connected as chip selects
-        */
-       .num_chipselect = 5,
-};
index 511d6febbe9996ac7f4831ba6d878435765c2869..d48e8662c6763eb8a45bfd72752ab7509e0e9a5a 100644 (file)
@@ -87,7 +87,6 @@ extern struct msp_i2s_platform_data msp0_platform_data;
 extern struct msp_i2s_platform_data msp1_platform_data;
 extern struct msp_i2s_platform_data msp2_platform_data;
 extern struct msp_i2s_platform_data msp3_platform_data;
-extern struct pl022_ssp_controller ssp0_plat;
 
 void __init mop500_pinmaps_init(void);
 void __init snowball_pinmaps_init(void);
index 12c7e5c03ea488336eac954daab98f4b6a22c649..bc8a6183560dbd0bb3021b61d2b68a83cd20a566 100644 (file)
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/regulator/machine.h>
-#include <linux/platform_data/pinctrl-nomadik.h>
 #include <linux/random.h>
 
 #include <asm/pmu.h>
 #include <asm/mach/map.h>
 
 #include "setup.h"
-#include "devices.h"
 #include "irqs.h"
 
-#include "devices-db8500.h"
-#include "db8500-regs.h"
+#include "board-mop500-regulators.h"
 #include "board-mop500.h"
+#include "db8500-regs.h"
 #include "id.h"
 
+struct ab8500_platform_data ab8500_platdata = {
+       .irq_base       = MOP500_AB8500_IRQ_BASE,
+       .regulator      = &ab8500_regulator_plat_data,
+};
+
+struct prcmu_pdata db8500_prcmu_pdata = {
+       .ab_platdata    = &ab8500_platdata,
+       .ab_irq         = IRQ_DB8500_AB8500,
+       .irq_base       = IRQ_PRCMU_BASE,
+       .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET,
+       .legacy_offset  = DB8500_PRCMU_LEGACY_OFFSET,
+};
+
 /* minimum static i/o mapping required to boot U8500 platforms */
 static struct map_desc u8500_uart_io_desc[] __initdata = {
        __IO_DEV_DESC(U8500_UART0_BASE, SZ_4K),
@@ -159,17 +170,10 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("stericsson,ux500-hash", 0xa03c2000, "hash1", NULL),
        OF_DEV_AUXDATA("stericsson,snd-soc-mop500", 0, "snd-soc-mop500.0",
                        NULL),
-       /* Requires device name bindings. */
-       OF_DEV_AUXDATA("stericsson,db8500-pinctrl", U8500_PRCMU_BASE,
-               "pinctrl-db8500", NULL),
        {},
 };
 
 static struct of_dev_auxdata u8540_auxdata_lookup[] __initdata = {
-       /* Requires DMA bindings. */
-       OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", NULL),
-       OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", NULL),
-       OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", NULL),
        OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu",
                        &db8500_prcmu_pdata),
        {},
index f84d4397896b39705e0227dac27555542c1d9cc0..d11ac4bf336cb7352ac34ee079fc560a800e036e 100644 (file)
@@ -25,7 +25,6 @@
 #include <asm/mach/map.h>
 
 #include "setup.h"
-#include "devices.h"
 
 #include "board-mop500.h"
 #include "db8500-regs.h"
@@ -64,12 +63,7 @@ void __init ux500_init_irq(void)
        } else
                ux500_unknown_soc();
 
-#ifdef CONFIG_OF
-       if (of_have_populated_dt())
-               irqchip_init();
-       else
-#endif
-               gic_init(0, 29, dist_base, cpu_base);
+       irqchip_init();
 
        /*
         * Init clocks here so that they are available for system timer
@@ -79,16 +73,11 @@ void __init ux500_init_irq(void)
                prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
                ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1);
 
-               if (of_have_populated_dt())
-                       u8500_of_clk_init(U8500_CLKRST1_BASE,
-                                         U8500_CLKRST2_BASE,
-                                         U8500_CLKRST3_BASE,
-                                         U8500_CLKRST5_BASE,
-                                         U8500_CLKRST6_BASE);
-               else
-                       u8500_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
-                                      U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
-                                      U8500_CLKRST6_BASE);
+               u8500_of_clk_init(U8500_CLKRST1_BASE,
+                                 U8500_CLKRST2_BASE,
+                                 U8500_CLKRST3_BASE,
+                                 U8500_CLKRST5_BASE,
+                                 U8500_CLKRST6_BASE);
        } else if (cpu_is_u9540()) {
                prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
                ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1);
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
deleted file mode 100644 (file)
index c59f89d..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
- * License terms: GNU General Public License (GPL) version 2
- */
-
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/amba/bus.h>
-#include <linux/amba/pl022.h>
-#include <linux/mfd/dbx500-prcmu.h>
-
-#include "setup.h"
-#include "irqs.h"
-
-#include "db8500-regs.h"
-#include "devices-db8500.h"
-
-struct prcmu_pdata db8500_prcmu_pdata = {
-       .ab_platdata    = &ab8500_platdata,
-       .ab_irq         = IRQ_DB8500_AB8500,
-       .irq_base       = IRQ_PRCMU_BASE,
-       .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET,
-       .legacy_offset  = DB8500_PRCMU_LEGACY_OFFSET,
-};
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h
deleted file mode 100644 (file)
index b8ffc99..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
- * License terms: GNU General Public License (GPL), version 2.
- */
-
-#ifndef __DEVICES_DB8500_H
-#define __DEVICES_DB8500_H
-
-#include "irqs.h"
-#include "db8500-regs.h"
-
-struct platform_device;
-
-extern struct ab8500_platform_data ab8500_platdata;
-extern struct prcmu_pdata db8500_prcmu_pdata;
-
-#endif
diff --git a/arch/arm/mach-ux500/devices.c b/arch/arm/mach-ux500/devices.c
deleted file mode 100644 (file)
index 0f9e52b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
- * License terms: GNU General Public License (GPL) version 2
- */
-
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/interrupt.h>
-#include <linux/io.h>
-#include <linux/amba/bus.h>
-
-#include "setup.h"
-
-#include "db8500-regs.h"
-
-void __init amba_add_devices(struct amba_device *devs[], int num)
-{
-       int i;
-
-       for (i = 0; i < num; i++) {
-               struct amba_device *d = devs[i];
-               amba_device_register(d, &iomem_resource);
-       }
-}
diff --git a/arch/arm/mach-ux500/devices.h b/arch/arm/mach-ux500/devices.h
deleted file mode 100644 (file)
index 5bca7c6..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (C) ST-Ericsson SA 2010
- *
- * License terms: GNU General Public License (GPL) version 2
- */
-
-#ifndef __ASM_ARCH_DEVICES_H__
-#define __ASM_ARCH_DEVICES_H__
-
-struct platform_device;
-struct amba_device;
-
-extern struct amba_device ux500_pl031_device;
-
-#endif
index 1f296e796a4fe42a93972a06a5517033db1b3307..a44967f3168c8e5254f1917b5aac9a8995301f0e 100644 (file)
@@ -38,8 +38,7 @@ static void write_pen_release(int val)
 {
        pen_release = val;
        smp_wmb();
-       __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
-       outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
+       sync_cache_w(&pen_release);
 }
 
 static void __iomem *scu_base_addr(void)
index 1a468f0fd22e0abdbb747c8ffb54f81b09262e97..b80a9a2e356eca6a5f76459a8cce58195523d143 100644 (file)
@@ -3,6 +3,8 @@
  * Author: Rickard Andersson <rickard.andersson@stericsson.com> for
  *         ST-Ericsson.
  * Author: Daniel Lezcano <daniel.lezcano@linaro.org> for Linaro.
+ * Author: Ulf Hansson <ulf.hansson@linaro.org> for Linaro.
+ *
  * License terms: GNU General Public License (GPL) version 2
  *
  */
@@ -11,6 +13,7 @@
 #include <linux/irqchip/arm-gic.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/suspend.h>
 #include <linux/platform_data/arm-ux500-pm.h>
 
 #include "db8500-regs.h"
@@ -152,6 +155,27 @@ int prcmu_copy_gic_settings(void)
        return 0;
 }
 
+#ifdef CONFIG_SUSPEND
+static int ux500_suspend_enter(suspend_state_t state)
+{
+       cpu_do_idle();
+       return 0;
+}
+
+static int ux500_suspend_valid(suspend_state_t state)
+{
+       return state == PM_SUSPEND_MEM || state == PM_SUSPEND_STANDBY;
+}
+
+static const struct platform_suspend_ops ux500_suspend_ops = {
+       .enter        = ux500_suspend_enter,
+       .valid        = ux500_suspend_valid,
+};
+#define UX500_SUSPEND_OPS      (&ux500_suspend_ops)
+#else
+#define UX500_SUSPEND_OPS      NULL
+#endif
+
 void __init ux500_pm_init(u32 phy_base, u32 size)
 {
        prcmu_base = ioremap(phy_base, size);
@@ -164,4 +188,7 @@ void __init ux500_pm_init(u32 phy_base, u32 size)
         * This will make sure that the GIC is correctly configured.
         */
        prcmu_gic_recouple();
+
+       /* Set up ux500 suspend callbacks. */
+       suspend_set_ops(UX500_SUSPEND_OPS);
 }
index bdb356498a748563091d7563525db015500dbfc1..2dea8b59d2220e1bacf274bdf7c75c010bbf8728 100644 (file)
 void ux500_restart(enum reboot_mode mode, const char *cmd);
 
 void __init ux500_map_io(void);
-extern void __init u8500_map_io(void);
-
-extern struct device * __init u8500_init_devices(void);
 
 extern void __init ux500_init_irq(void);
 
 extern struct device *ux500_soc_device_init(const char *soc_id);
 
-struct amba_device;
-extern void __init amba_add_devices(struct amba_device *devs[], int num);
-
 extern void ux500_timer_init(void);
 
 #define __IO_DEV_DESC(x, sz)   {               \
@@ -43,7 +37,7 @@ extern void ux500_timer_init(void);
        .virtual        = IO_ADDRESS(x),        \
        .pfn            = __phys_to_pfn(x),     \
        .length         = sz,                   \
-       .type           = MT_MEMORY,            \
+       .type           = MT_MEMORY_RWX,                \
 }
 
 extern struct smp_operations ux500_smp_ops;
index 05a4ff78b3bd9e73deaf4c0e814f79cdae8e971e..87efda0aa348fc5c9165047cde0163195818d76a 100644 (file)
 #include <linux/clocksource.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
-#include <linux/platform_data/clocksource-nomadik-mtu.h>
-
-#include <asm/smp_twd.h>
 
 #include "setup.h"
-#include "irqs.h"
 
 #include "db8500-regs.h"
 #include "id.h"
 
-#ifdef CONFIG_HAVE_ARM_TWD
-static DEFINE_TWD_LOCAL_TIMER(u8500_twd_local_timer,
-                             U8500_TWD_BASE, IRQ_LOCALTIMER);
-
-static void __init ux500_twd_init(void)
-{
-       struct twd_local_timer *twd_local_timer;
-       int err;
-
-       /* Use this to switch local timer base if changed in new ASICs */
-       twd_local_timer = &u8500_twd_local_timer;
-
-       if (of_have_populated_dt())
-               clocksource_of_init();
-       else {
-               err = twd_local_timer_register(twd_local_timer);
-               if (err)
-                       pr_err("twd_local_timer_register failed %d\n", err);
-       }
-}
-#else
-#define ux500_twd_init()       do { } while(0)
-#endif
-
 const static struct of_device_id prcmu_timer_of_match[] __initconst = {
        { .compatible = "stericsson,db8500-prcmu-timer-4", },
        { },
@@ -51,54 +23,26 @@ const static struct of_device_id prcmu_timer_of_match[] __initconst = {
 
 void __init ux500_timer_init(void)
 {
-       void __iomem *mtu_timer_base;
        void __iomem *prcmu_timer_base;
        void __iomem *tmp_base;
        struct device_node *np;
 
-       if (cpu_is_u8500_family() || cpu_is_ux540_family()) {
-               mtu_timer_base = __io_address(U8500_MTU0_BASE);
+       if (cpu_is_u8500_family() || cpu_is_ux540_family())
                prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE);
-       } else {
+       else
                ux500_unknown_soc();
-       }
 
-       /* TODO: Once MTU has been DT:ed place code above into else. */
-       if (of_have_populated_dt()) {
-#ifdef CONFIG_OF
-               np = of_find_matching_node(NULL, prcmu_timer_of_match);
-               if (!np)
-#endif
-                       goto dt_fail;
+       np = of_find_matching_node(NULL, prcmu_timer_of_match);
+       if (!np)
+               goto dt_fail;
 
-               tmp_base = of_iomap(np, 0);
-               if (!tmp_base)
-                       goto dt_fail;
+       tmp_base = of_iomap(np, 0);
+       if (!tmp_base)
+               goto dt_fail;
 
-               prcmu_timer_base = tmp_base;
-       }
+       prcmu_timer_base = tmp_base;
 
 dt_fail:
-       /* Doing it the old fashioned way. */
-
-       /*
-        * Here we register the timerblocks active in the system.
-        * Localtimers (twd) is started when both cpu is up and running.
-        * MTU register a clocksource, clockevent and sched_clock.
-        * Since the MTU is located in the VAPE power domain
-        * it will be cleared in sleep which makes it unsuitable.
-        * We however need it as a timer tick (clockevent)
-        * during boot to calibrate delay until twd is started.
-        * RTC-RTT have problems as timer tick during boot since it is
-        * depending on delay which is not yet calibrated. RTC-RTT is in the
-        * always-on powerdomain and is used as clockevent instead of twd when
-        * sleeping.
-        * The PRCMU timer 4 register a clocksource and
-        * sched_clock with higher rating then MTU since is always-on.
-        *
-        */
-       if (!of_have_populated_dt())
-               nmdk_timer_init(mtu_timer_base, IRQ_MTU0);
        clksrc_dbx500_prcmu_init(prcmu_timer_base);
-       ux500_twd_init();
+       clocksource_of_init();
 }
index 3b0572f30d5608d7ffdafcb68f2777a0dab8afa1..a335126ae18f3abc248d1373c2e39659a53431a9 100644 (file)
@@ -570,6 +570,16 @@ static struct pl061_platform_data gpio1_plat_data = {
        .irq_base       = IRQ_GPIO1_START,
 };
 
+static struct pl061_platform_data gpio2_plat_data = {
+       .gpio_base      = 16,
+       .irq_base       = IRQ_GPIO2_START,
+};
+
+static struct pl061_platform_data gpio3_plat_data = {
+       .gpio_base      = 24,
+       .irq_base       = IRQ_GPIO3_START,
+};
+
 static struct pl022_ssp_controller ssp0_plat_data = {
        .bus_id = 0,
        .enable_dma = 0,
@@ -596,6 +606,8 @@ static struct pl022_ssp_controller ssp0_plat_data = {
 #define WATCHDOG_IRQ   { IRQ_WDOGINT }
 #define GPIO0_IRQ      { IRQ_GPIOINT0 }
 #define GPIO1_IRQ      { IRQ_GPIOINT1 }
+#define GPIO2_IRQ      { IRQ_GPIOINT2 }
+#define GPIO3_IRQ      { IRQ_GPIOINT3 }
 #define RTC_IRQ                { IRQ_RTCINT }
 
 /*
@@ -622,6 +634,8 @@ APB_DEVICE(sctl,  "dev:e0",  SCTL,     NULL);
 APB_DEVICE(wdog,  "dev:e1",  WATCHDOG, NULL);
 APB_DEVICE(gpio0, "dev:e4",  GPIO0,    &gpio0_plat_data);
 APB_DEVICE(gpio1, "dev:e5",  GPIO1,    &gpio1_plat_data);
+APB_DEVICE(gpio2, "dev:e6",  GPIO2,    &gpio2_plat_data);
+APB_DEVICE(gpio3, "dev:e7",  GPIO3,    &gpio3_plat_data);
 APB_DEVICE(rtc,   "dev:e8",  RTC,      NULL);
 APB_DEVICE(sci0,  "dev:f0",  SCI,      NULL);
 APB_DEVICE(uart0, "dev:f1",  UART0,    NULL);
@@ -641,6 +655,8 @@ static struct amba_device *amba_devs[] __initdata = {
        &wdog_device,
        &gpio0_device,
        &gpio1_device,
+       &gpio2_device,
+       &gpio3_device,
        &rtc_device,
        &sci0_device,
        &ssp0_device,
index 611d140c8695a35b9768221bd125ac76a7e393cc..9a53d0bd9144e33fa37657bf6d5215c8d2fc8e52 100644 (file)
@@ -47,26 +47,10 @@ static struct mmci_platform_data mmc1_plat_data = {
        .gpio_cd        = -1,
 };
 
-static struct pl061_platform_data gpio2_plat_data = {
-       .gpio_base      = 16,
-       .irq_base       = IRQ_GPIO2_START,
-};
-
-static struct pl061_platform_data gpio3_plat_data = {
-       .gpio_base      = 24,
-       .irq_base       = IRQ_GPIO3_START,
-};
-
 #define UART3_IRQ      { IRQ_SIC_UART3 }
 #define SCI1_IRQ       { IRQ_SIC_SCI3 }
 #define MMCI1_IRQ      { IRQ_MMCI1A, IRQ_SIC_MMCI1B }
 
-/*
- * These devices are connected via the core APB bridge
- */
-#define GPIO2_IRQ      { IRQ_GPIOINT2 }
-#define GPIO3_IRQ      { IRQ_GPIOINT3 }
-
 /*
  * These devices are connected via the DMA APB bridge
  */
@@ -76,14 +60,9 @@ APB_DEVICE(uart3, "fpga:09", UART3,    NULL);
 APB_DEVICE(sci1,  "fpga:0a", SCI1,     NULL);
 APB_DEVICE(mmc1,  "fpga:0b", MMCI1,    &mmc1_plat_data);
 
-/* DevChip Primecells */
-APB_DEVICE(gpio2, "dev:e6",  GPIO2,    &gpio2_plat_data);
-APB_DEVICE(gpio3, "dev:e7",  GPIO3,    &gpio3_plat_data);
 
 static struct amba_device *amba_devs[] __initdata = {
        &uart3_device,
-       &gpio2_device,
-       &gpio3_device,
        &sci1_device,
        &mmc1_device,
 };
index 9a7bd137c8fd27d60f42a6b78c6dbf3cc234d348..1db2a5ca9ab8c8280dd11db69e1cc98538a76ba2 100644 (file)
@@ -25,6 +25,8 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/of.h>
+#include <linux/irqchip.h>
+#include <linux/irqchip/arm-gic.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
 void __iomem *zynq_scu_base;
 
-static struct of_device_id zynq_of_bus_ids[] __initdata = {
-       { .compatible = "simple-bus", },
-       {}
-};
-
 static struct platform_device zynq_cpuidle_device = {
        .name = "cpuidle-zynq",
 };
@@ -59,7 +56,7 @@ static void __init zynq_init_machine(void)
         */
        l2x0_of_init(0x02060000, 0xF0F0FFFF);
 
-       of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
        platform_device_register(&zynq_cpuidle_device);
 }
@@ -97,6 +94,12 @@ static void __init zynq_map_io(void)
        zynq_scu_map_io();
 }
 
+static void __init zynq_irq_init(void)
+{
+       gic_arch_extn.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND;
+       irqchip_init();
+}
+
 static void zynq_system_reset(enum reboot_mode mode, const char *cmd)
 {
        zynq_slcr_system_reset();
@@ -110,6 +113,7 @@ static const char * const zynq_dt_match[] = {
 DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
        .smp            = smp_ops(zynq_smp_ops),
        .map_io         = zynq_map_io,
+       .init_irq       = zynq_irq_init,
        .init_machine   = zynq_init_machine,
        .init_time      = zynq_timer_init,
        .dt_compat      = zynq_dt_match,
index 3040d219570f23babca8b6cdbc81cfbfade17581..c22c92cea8cb47e1baba978c93d99b6e8d5ab244 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef __MACH_ZYNQ_COMMON_H__
 #define __MACH_ZYNQ_COMMON_H__
 
+void zynq_secondary_startup(void);
+
 extern int zynq_slcr_init(void);
 extern void zynq_slcr_system_reset(void);
 extern void zynq_slcr_cpu_stop(int cpu);
index d4cd5f34fe5c6a0febdc473de016377f668ae5dd..57a32869f0aa3215e0e49c282ca58d7f8976cad3 100644 (file)
@@ -18,5 +18,9 @@ zynq_secondary_trampoline_jump:
        .word   /* cpu 1 */
 .globl zynq_secondary_trampoline_end
 zynq_secondary_trampoline_end:
-
 ENDPROC(zynq_secondary_trampoline)
+
+ENTRY(zynq_secondary_startup)
+       bl      v7_invalidate_l1
+       b       secondary_startup
+ENDPROC(zynq_secondary_startup)
index 689fbbc3d9c8860347f42f60c00c01f41c0a091a..abc82ef085c1617011fa3174bfaea2b7d8cb6244 100644 (file)
@@ -39,11 +39,6 @@ int zynq_cpun_start(u32 address, int cpu)
        u32 trampoline_code_size = &zynq_secondary_trampoline_end -
                                                &zynq_secondary_trampoline;
 
-       if (cpu > ncores) {
-               pr_warn("CPU No. is not available in the system\n");
-               return -1;
-       }
-
        /* MS: Expectation that SLCR are directly map and accessible */
        /* Not possible to jump to non aligned address */
        if (!(address & 3) && (!address || (address >= trampoline_code_size))) {
@@ -95,7 +90,7 @@ EXPORT_SYMBOL(zynq_cpun_start);
 static int zynq_boot_secondary(unsigned int cpu,
                                                struct task_struct *idle)
 {
-       return zynq_cpun_start(virt_to_phys(secondary_startup), cpu);
+       return zynq_cpun_start(virt_to_phys(zynq_secondary_startup), cpu);
 }
 
 /*
@@ -114,23 +109,23 @@ static void __init zynq_smp_init_cpus(void)
 
 static void __init zynq_smp_prepare_cpus(unsigned int max_cpus)
 {
-       int i;
-
-       /*
-        * Initialise the present map, which describes the set of CPUs
-        * actually populated at the present time.
-        */
-       for (i = 0; i < max_cpus; i++)
-               set_cpu_present(i, true);
-
        scu_enable(zynq_scu_base);
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+static int zynq_cpu_kill(unsigned cpu)
+{
+       zynq_slcr_cpu_stop(cpu);
+       return 1;
+}
+#endif
+
 struct smp_operations zynq_smp_ops __initdata = {
        .smp_init_cpus          = zynq_smp_init_cpus,
        .smp_prepare_cpus       = zynq_smp_prepare_cpus,
        .smp_boot_secondary     = zynq_boot_secondary,
 #ifdef CONFIG_HOTPLUG_CPU
        .cpu_die                = zynq_platform_cpu_die,
+       .cpu_kill               = zynq_cpu_kill,
 #endif
 };
index ecfe6e53f6e03ffe7a12bf0776b784106f7efe19..7f39ce2f841fb1f9056269c1a8ce415b89a21191 100644 (file)
@@ -12,6 +12,7 @@ ifneq ($(CONFIG_MMU),y)
 obj-y                          += nommu.o
 endif
 
+obj-$(CONFIG_ARM_PTDUMP)       += dump.o
 obj-$(CONFIG_MODULES)          += proc-syms.o
 
 obj-$(CONFIG_ALIGNMENT_TRAP)   += alignment.o
index 447da6ffadd5333e10d2ce05bf7ca334cf25bc1a..7abde2ce897336939c24ffd02434b462ae8c938d 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <asm/cacheflush.h>
 #include <asm/hardware/cache-l2x0.h>
+#include "cache-tauros3.h"
 #include "cache-aurora-l2.h"
 
 #define CACHE_LINE_SIZE                32
@@ -767,6 +768,14 @@ static void aurora_save(void)
        l2x0_saved_regs.aux_ctrl = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
 }
 
+static void __init tauros3_save(void)
+{
+       l2x0_saved_regs.aux2_ctrl =
+               readl_relaxed(l2x0_base + TAUROS3_AUX2_CTRL);
+       l2x0_saved_regs.prefetch_ctrl =
+               readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL);
+}
+
 static void l2x0_resume(void)
 {
        if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
@@ -821,6 +830,18 @@ static void aurora_resume(void)
        }
 }
 
+static void tauros3_resume(void)
+{
+       if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
+               writel_relaxed(l2x0_saved_regs.aux2_ctrl,
+                              l2x0_base + TAUROS3_AUX2_CTRL);
+               writel_relaxed(l2x0_saved_regs.prefetch_ctrl,
+                              l2x0_base + L2X0_PREFETCH_CTRL);
+       }
+
+       l2x0_resume();
+}
+
 static void __init aurora_broadcast_l2_commands(void)
 {
        __u32 u;
@@ -906,6 +927,15 @@ static const struct l2x0_of_data aurora_no_outer_data = {
        },
 };
 
+static const struct l2x0_of_data tauros3_data = {
+       .setup = NULL,
+       .save  = tauros3_save,
+       /* Tauros3 broadcasts L1 cache operations to L2 */
+       .outer_cache = {
+               .resume      = tauros3_resume,
+       },
+};
+
 static const struct l2x0_of_data bcm_l2x0_data = {
        .setup = pl310_of_setup,
        .save  = pl310_save,
@@ -922,17 +952,19 @@ static const struct l2x0_of_data bcm_l2x0_data = {
 };
 
 static const struct of_device_id l2x0_ids[] __initconst = {
-       { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data },
-       { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data },
        { .compatible = "arm,l210-cache", .data = (void *)&l2x0_data },
-       { .compatible = "marvell,aurora-system-cache",
-         .data = (void *)&aurora_no_outer_data},
-       { .compatible = "marvell,aurora-outer-cache",
-         .data = (void *)&aurora_with_outer_data},
-       { .compatible = "brcm,bcm11351-a2-pl310-cache",
-         .data = (void *)&bcm_l2x0_data},
+       { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data },
+       { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data },
        { .compatible = "bcm,bcm11351-a2-pl310-cache", /* deprecated name */
          .data = (void *)&bcm_l2x0_data},
+       { .compatible = "brcm,bcm11351-a2-pl310-cache",
+         .data = (void *)&bcm_l2x0_data},
+       { .compatible = "marvell,aurora-outer-cache",
+         .data = (void *)&aurora_with_outer_data},
+       { .compatible = "marvell,aurora-system-cache",
+         .data = (void *)&aurora_no_outer_data},
+       { .compatible = "marvell,tauros3-cache",
+         .data = (void *)&tauros3_data },
        {}
 };
 
diff --git a/arch/arm/mm/cache-tauros3.h b/arch/arm/mm/cache-tauros3.h
new file mode 100644 (file)
index 0000000..02c0a97
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Marvell Tauros3 cache controller includes
+ *
+ * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ *  (c) Marvell International Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __ASM_ARM_HARDWARE_TAUROS3_H
+#define __ASM_ARM_HARDWARE_TAUROS3_H
+
+/*
+ * Marvell Tauros3 L2CC is compatible with PL310 r0p0
+ * but with PREFETCH_CTRL (r2p0) and an additional event counter.
+ * Also, there is AUX2_CTRL for some Marvell specific control.
+ */
+
+#define TAUROS3_EVENT_CNT2_CFG         0x224
+#define TAUROS3_EVENT_CNT2_VAL         0x228
+#define TAUROS3_INV_ALL                        0x780
+#define TAUROS3_CLEAN_ALL              0x784
+#define TAUROS3_AUX2_CTRL              0x820
+
+/* Registers shifts and masks */
+#define TAUROS3_AUX2_CTRL_LINEFILL_BURST8_EN   (1 << 2)
+
+#endif
index b5c467a65c271a8c8538defc2880b0689067d046..778bcf88ee798b4104f35fef3ed1d6fc933f3392 100644 (file)
@@ -146,18 +146,18 @@ flush_levels:
        ldr     r7, =0x7fff
        ands    r7, r7, r1, lsr #13             @ extract max number of the index size
 loop1:
-       mov     r9, r4                          @ create working copy of max way size
+       mov     r9, r7                          @ create working copy of max index
 loop2:
- ARM(  orr     r11, r10, r9, lsl r5    )       @ factor way and cache number into r11
- THUMB(        lsl     r6, r9, r5              )
+ ARM(  orr     r11, r10, r4, lsl r5    )       @ factor way and cache number into r11
+ THUMB(        lsl     r6, r4, r5              )
  THUMB(        orr     r11, r10, r6            )       @ factor way and cache number into r11
- ARM(  orr     r11, r11, r7, lsl r2    )       @ factor index number into r11
- THUMB(        lsl     r6, r7, r2              )
+ ARM(  orr     r11, r11, r9, lsl r2    )       @ factor index number into r11
+ THUMB(        lsl     r6, r9, r2              )
  THUMB(        orr     r11, r11, r6            )       @ factor index number into r11
        mcr     p15, 0, r11, c7, c14, 2         @ clean & invalidate by set/way
-       subs    r9, r9, #1                      @ decrement the way
+       subs    r9, r9, #1                      @ decrement the index
        bge     loop2
-       subs    r7, r7, #1                      @ decrement the index
+       subs    r4, r4, #1                      @ decrement the way
        bge     loop1
 skip:
        add     r10, r10, #2                    @ increment cache number
index 84e6f772e204597032cc0fcd4101f36ce588728f..6eb97b3a7481b9b68ee806845a534cb6d278192d 100644 (file)
@@ -36,8 +36,8 @@
  * The context ID is used by debuggers and trace logic, and
  * should be unique within all running processes.
  *
- * In big endian operation, the two 32 bit words are swapped if accesed by
- * non 64-bit operations.
+ * In big endian operation, the two 32 bit words are swapped if accessed
+ * by non-64-bit operations.
  */
 #define ASID_FIRST_VERSION     (1ULL << ASID_BITS)
 #define NUM_USER_ASIDS         ASID_FIRST_VERSION
@@ -78,20 +78,21 @@ void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,
 #endif
 
 #ifdef CONFIG_ARM_LPAE
-static void cpu_set_reserved_ttbr0(void)
-{
-       /*
-        * Set TTBR0 to swapper_pg_dir which contains only global entries. The
-        * ASID is set to 0.
-        */
-       cpu_set_ttbr(0, __pa(swapper_pg_dir));
-       isb();
-}
+/*
+ * With LPAE, the ASID and page tables are updated atomicly, so there is
+ * no need for a reserved set of tables (the active ASID tracking prevents
+ * any issues across a rollover).
+ */
+#define cpu_set_reserved_ttbr0()
 #else
 static void cpu_set_reserved_ttbr0(void)
 {
        u32 ttb;
-       /* Copy TTBR1 into TTBR0 */
+       /*
+        * Copy TTBR1 into TTBR0.
+        * This points at swapper_pg_dir, which contains only global
+        * entries so any speculative walks are perfectly safe.
+        */
        asm volatile(
        "       mrc     p15, 0, %0, c2, c0, 1           @ read TTBR1\n"
        "       mcr     p15, 0, %0, c2, c0, 0           @ set TTBR0\n"
@@ -179,6 +180,7 @@ static int is_reserved_asid(u64 asid)
 
 static u64 new_context(struct mm_struct *mm, unsigned int cpu)
 {
+       static u32 cur_idx = 1;
        u64 asid = atomic64_read(&mm->context.id);
        u64 generation = atomic64_read(&asid_generation);
 
@@ -193,10 +195,13 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
                 * Allocate a free ASID. If we can't find one, take a
                 * note of the currently active ASIDs and mark the TLBs
                 * as requiring flushes. We always count from ASID #1,
-                * as we reserve ASID #0 to switch via TTBR0 and indicate
-                * rollover events.
+                * as we reserve ASID #0 to switch via TTBR0 and to
+                * avoid speculative page table walks from hitting in
+                * any partial walk caches, which could be populated
+                * from overlapping level-1 descriptors used to map both
+                * the module area and the userspace stack.
                 */
-               asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
+               asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, cur_idx);
                if (asid == NUM_USER_ASIDS) {
                        generation = atomic64_add_return(ASID_FIRST_VERSION,
                                                         &asid_generation);
@@ -204,6 +209,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
                        asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
                }
                __set_bit(asid, asid_map);
+               cur_idx = asid;
                asid |= generation;
                cpumask_clear(mm_cpumask(mm));
        }
@@ -221,8 +227,9 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
                __check_vmalloc_seq(mm);
 
        /*
-        * Required during context switch to avoid speculative page table
-        * walking with the wrong TTBR.
+        * We cannot update the pgd and the ASID atomicly with classic
+        * MMU, so switch exclusively to global mappings to avoid
+        * speculative page table walking with the wrong TTBR.
         */
        cpu_set_reserved_ttbr0();
 
index f61a5707823a40e0af9474d4f18809f9196b1264..1a77450e728ad17cf6b8fec2beb3111a2a8bfb94 100644 (file)
@@ -376,7 +376,7 @@ void __init init_dma_coherent_pool_size(unsigned long size)
 static int __init atomic_pool_init(void)
 {
        struct dma_pool *pool = &atomic_pool;
-       pgprot_t prot = pgprot_dmacoherent(pgprot_kernel);
+       pgprot_t prot = pgprot_dmacoherent(PAGE_KERNEL);
        gfp_t gfp = GFP_KERNEL | GFP_DMA;
        unsigned long nr_pages = pool->size >> PAGE_SHIFT;
        unsigned long *bitmap;
@@ -624,7 +624,7 @@ static void __free_from_contiguous(struct device *dev, struct page *page,
        if (PageHighMem(page))
                __dma_free_remap(cpu_addr, size);
        else
-               __dma_remap(page, size, pgprot_kernel);
+               __dma_remap(page, size, PAGE_KERNEL);
        dma_release_from_contiguous(dev, page, size >> PAGE_SHIFT);
 }
 
@@ -1351,7 +1351,7 @@ static void __iommu_free_atomic(struct device *dev, void *cpu_addr,
 static void *arm_iommu_alloc_attrs(struct device *dev, size_t size,
            dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs)
 {
-       pgprot_t prot = __get_dma_pgprot(attrs, pgprot_kernel);
+       pgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL);
        struct page **pages;
        void *addr = NULL;
 
diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
new file mode 100644 (file)
index 0000000..2b3a564
--- /dev/null
@@ -0,0 +1,345 @@
+/*
+ * Debug helper to dump the current kernel pagetables of the system
+ * so that we can see what the various memory ranges are set to.
+ *
+ * Derived from x86 implementation:
+ * (C) Copyright 2008 Intel Corporation
+ *
+ * Author: Arjan van de Ven <arjan@linux.intel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+#include <linux/debugfs.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/seq_file.h>
+
+#include <asm/fixmap.h>
+#include <asm/pgtable.h>
+
+struct addr_marker {
+       unsigned long start_address;
+       const char *name;
+};
+
+static struct addr_marker address_markers[] = {
+       { MODULES_VADDR,        "Modules" },
+       { PAGE_OFFSET,          "Kernel Mapping" },
+       { 0,                    "vmalloc() Area" },
+       { VMALLOC_END,          "vmalloc() End" },
+       { FIXADDR_START,        "Fixmap Area" },
+       { CONFIG_VECTORS_BASE,  "Vectors" },
+       { CONFIG_VECTORS_BASE + PAGE_SIZE * 2, "Vectors End" },
+       { -1,                   NULL },
+};
+
+struct pg_state {
+       struct seq_file *seq;
+       const struct addr_marker *marker;
+       unsigned long start_address;
+       unsigned level;
+       u64 current_prot;
+};
+
+struct prot_bits {
+       u64             mask;
+       u64             val;
+       const char      *set;
+       const char      *clear;
+};
+
+static const struct prot_bits pte_bits[] = {
+       {
+               .mask   = L_PTE_USER,
+               .val    = L_PTE_USER,
+               .set    = "USR",
+               .clear  = "   ",
+       }, {
+               .mask   = L_PTE_RDONLY,
+               .val    = L_PTE_RDONLY,
+               .set    = "ro",
+               .clear  = "RW",
+       }, {
+               .mask   = L_PTE_XN,
+               .val    = L_PTE_XN,
+               .set    = "NX",
+               .clear  = "x ",
+       }, {
+               .mask   = L_PTE_SHARED,
+               .val    = L_PTE_SHARED,
+               .set    = "SHD",
+               .clear  = "   ",
+       }, {
+               .mask   = L_PTE_MT_MASK,
+               .val    = L_PTE_MT_UNCACHED,
+               .set    = "SO/UNCACHED",
+       }, {
+               .mask   = L_PTE_MT_MASK,
+               .val    = L_PTE_MT_BUFFERABLE,
+               .set    = "MEM/BUFFERABLE/WC",
+       }, {
+               .mask   = L_PTE_MT_MASK,
+               .val    = L_PTE_MT_WRITETHROUGH,
+               .set    = "MEM/CACHED/WT",
+       }, {
+               .mask   = L_PTE_MT_MASK,
+               .val    = L_PTE_MT_WRITEBACK,
+               .set    = "MEM/CACHED/WBRA",
+#ifndef CONFIG_ARM_LPAE
+       }, {
+               .mask   = L_PTE_MT_MASK,
+               .val    = L_PTE_MT_MINICACHE,
+               .set    = "MEM/MINICACHE",
+#endif
+       }, {
+               .mask   = L_PTE_MT_MASK,
+               .val    = L_PTE_MT_WRITEALLOC,
+               .set    = "MEM/CACHED/WBWA",
+       }, {
+               .mask   = L_PTE_MT_MASK,
+               .val    = L_PTE_MT_DEV_SHARED,
+               .set    = "DEV/SHARED",
+#ifndef CONFIG_ARM_LPAE
+       }, {
+               .mask   = L_PTE_MT_MASK,
+               .val    = L_PTE_MT_DEV_NONSHARED,
+               .set    = "DEV/NONSHARED",
+#endif
+       }, {
+               .mask   = L_PTE_MT_MASK,
+               .val    = L_PTE_MT_DEV_WC,
+               .set    = "DEV/WC",
+       }, {
+               .mask   = L_PTE_MT_MASK,
+               .val    = L_PTE_MT_DEV_CACHED,
+               .set    = "DEV/CACHED",
+       },
+};
+
+static const struct prot_bits section_bits[] = {
+#ifndef CONFIG_ARM_LPAE
+       /* These are approximate */
+       {
+               .mask   = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
+               .val    = 0,
+               .set    = "    ro",
+       }, {
+               .mask   = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
+               .val    = PMD_SECT_AP_WRITE,
+               .set    = "    RW",
+       }, {
+               .mask   = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
+               .val    = PMD_SECT_AP_READ,
+               .set    = "USR ro",
+       }, {
+               .mask   = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
+               .val    = PMD_SECT_AP_READ | PMD_SECT_AP_WRITE,
+               .set    = "USR RW",
+#else
+       {
+               .mask   = PMD_SECT_USER,
+               .val    = PMD_SECT_USER,
+               .set    = "USR",
+       }, {
+               .mask   = PMD_SECT_RDONLY,
+               .val    = PMD_SECT_RDONLY,
+               .set    = "ro",
+               .clear  = "RW",
+#endif
+       }, {
+               .mask   = PMD_SECT_XN,
+               .val    = PMD_SECT_XN,
+               .set    = "NX",
+               .clear  = "x ",
+       }, {
+               .mask   = PMD_SECT_S,
+               .val    = PMD_SECT_S,
+               .set    = "SHD",
+               .clear  = "   ",
+       },
+};
+
+struct pg_level {
+       const struct prot_bits *bits;
+       size_t num;
+       u64 mask;
+};
+
+static struct pg_level pg_level[] = {
+       {
+       }, { /* pgd */
+       }, { /* pud */
+       }, { /* pmd */
+               .bits   = section_bits,
+               .num    = ARRAY_SIZE(section_bits),
+       }, { /* pte */
+               .bits   = pte_bits,
+               .num    = ARRAY_SIZE(pte_bits),
+       },
+};
+
+static void dump_prot(struct pg_state *st, const struct prot_bits *bits, size_t num)
+{
+       unsigned i;
+
+       for (i = 0; i < num; i++, bits++) {
+               const char *s;
+
+               if ((st->current_prot & bits->mask) == bits->val)
+                       s = bits->set;
+               else
+                       s = bits->clear;
+
+               if (s)
+                       seq_printf(st->seq, " %s", s);
+       }
+}
+
+static void note_page(struct pg_state *st, unsigned long addr, unsigned level, u64 val)
+{
+       static const char units[] = "KMGTPE";
+       u64 prot = val & pg_level[level].mask;
+
+       if (addr < USER_PGTABLES_CEILING)
+               return;
+
+       if (!st->level) {
+               st->level = level;
+               st->current_prot = prot;
+               seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
+       } else if (prot != st->current_prot || level != st->level ||
+                  addr >= st->marker[1].start_address) {
+               const char *unit = units;
+               unsigned long delta;
+
+               if (st->current_prot) {
+                       seq_printf(st->seq, "0x%08lx-0x%08lx   ",
+                                  st->start_address, addr);
+
+                       delta = (addr - st->start_address) >> 10;
+                       while (!(delta & 1023) && unit[1]) {
+                               delta >>= 10;
+                               unit++;
+                       }
+                       seq_printf(st->seq, "%9lu%c", delta, *unit);
+                       if (pg_level[st->level].bits)
+                               dump_prot(st, pg_level[st->level].bits, pg_level[st->level].num);
+                       seq_printf(st->seq, "\n");
+               }
+
+               if (addr >= st->marker[1].start_address) {
+                       st->marker++;
+                       seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
+               }
+               st->start_address = addr;
+               st->current_prot = prot;
+               st->level = level;
+       }
+}
+
+static void walk_pte(struct pg_state *st, pmd_t *pmd, unsigned long start)
+{
+       pte_t *pte = pte_offset_kernel(pmd, 0);
+       unsigned long addr;
+       unsigned i;
+
+       for (i = 0; i < PTRS_PER_PTE; i++, pte++) {
+               addr = start + i * PAGE_SIZE;
+               note_page(st, addr, 4, pte_val(*pte));
+       }
+}
+
+static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start)
+{
+       pmd_t *pmd = pmd_offset(pud, 0);
+       unsigned long addr;
+       unsigned i;
+
+       for (i = 0; i < PTRS_PER_PMD; i++, pmd++) {
+               addr = start + i * PMD_SIZE;
+               if (pmd_none(*pmd) || pmd_large(*pmd) || !pmd_present(*pmd))
+                       note_page(st, addr, 3, pmd_val(*pmd));
+               else
+                       walk_pte(st, pmd, addr);
+       }
+}
+
+static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start)
+{
+       pud_t *pud = pud_offset(pgd, 0);
+       unsigned long addr;
+       unsigned i;
+
+       for (i = 0; i < PTRS_PER_PUD; i++, pud++) {
+               addr = start + i * PUD_SIZE;
+               if (!pud_none(*pud)) {
+                       walk_pmd(st, pud, addr);
+               } else {
+                       note_page(st, addr, 2, pud_val(*pud));
+               }
+       }
+}
+
+static void walk_pgd(struct seq_file *m)
+{
+       pgd_t *pgd = swapper_pg_dir;
+       struct pg_state st;
+       unsigned long addr;
+       unsigned i, pgdoff = USER_PGTABLES_CEILING / PGDIR_SIZE;
+
+       memset(&st, 0, sizeof(st));
+       st.seq = m;
+       st.marker = address_markers;
+
+       pgd += pgdoff;
+
+       for (i = pgdoff; i < PTRS_PER_PGD; i++, pgd++) {
+               addr = i * PGDIR_SIZE;
+               if (!pgd_none(*pgd)) {
+                       walk_pud(&st, pgd, addr);
+               } else {
+                       note_page(&st, addr, 1, pgd_val(*pgd));
+               }
+       }
+
+       note_page(&st, 0, 0, 0);
+}
+
+static int ptdump_show(struct seq_file *m, void *v)
+{
+       walk_pgd(m);
+       return 0;
+}
+
+static int ptdump_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, ptdump_show, NULL);
+}
+
+static const struct file_operations ptdump_fops = {
+       .open           = ptdump_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
+static int ptdump_init(void)
+{
+       struct dentry *pe;
+       unsigned i, j;
+
+       for (i = 0; i < ARRAY_SIZE(pg_level); i++)
+               if (pg_level[i].bits)
+                       for (j = 0; j < pg_level[i].num; j++)
+                               pg_level[i].mask |= pg_level[i].bits[j].mask;
+
+       address_markers[2].start_address = VMALLOC_START;
+
+       pe = debugfs_create_file("kernel_page_tables", 0400, NULL, NULL,
+                                &ptdump_fops);
+       return pe ? 0 : -ENOMEM;
+}
+__initcall(ptdump_init);
index 11eb8add78202f51a86a9d248b792a1771b16081..f57fb338cc8aaa2ee533ca77be3e06994a74b25f 100644 (file)
@@ -142,58 +142,6 @@ static void __init find_limits(unsigned long *min, unsigned long *max_low,
        *max_high = bank_pfn_end(&mi->bank[mi->nr_banks - 1]);
 }
 
-static void __init arm_bootmem_init(unsigned long start_pfn,
-       unsigned long end_pfn)
-{
-       struct memblock_region *reg;
-       unsigned int boot_pages;
-       phys_addr_t bitmap;
-       pg_data_t *pgdat;
-
-       /*
-        * Allocate the bootmem bitmap page.  This must be in a region
-        * of memory which has already been mapped.
-        */
-       boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
-       bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES,
-                               __pfn_to_phys(end_pfn));
-
-       /*
-        * Initialise the bootmem allocator, handing the
-        * memory banks over to bootmem.
-        */
-       node_set_online(0);
-       pgdat = NODE_DATA(0);
-       init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn);
-
-       /* Free the lowmem regions from memblock into bootmem. */
-       for_each_memblock(memory, reg) {
-               unsigned long start = memblock_region_memory_base_pfn(reg);
-               unsigned long end = memblock_region_memory_end_pfn(reg);
-
-               if (end >= end_pfn)
-                       end = end_pfn;
-               if (start >= end)
-                       break;
-
-               free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT);
-       }
-
-       /* Reserve the lowmem memblock reserved regions in bootmem. */
-       for_each_memblock(reserved, reg) {
-               unsigned long start = memblock_region_reserved_base_pfn(reg);
-               unsigned long end = memblock_region_reserved_end_pfn(reg);
-
-               if (end >= end_pfn)
-                       end = end_pfn;
-               if (start >= end)
-                       break;
-
-               reserve_bootmem(__pfn_to_phys(start),
-                               (end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT);
-       }
-}
-
 #ifdef CONFIG_ZONE_DMA
 
 phys_addr_t arm_dma_zone_size __read_mostly;
@@ -233,7 +181,7 @@ void __init setup_dma_zone(const struct machine_desc *mdesc)
 #endif
 }
 
-static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
+static void __init zone_sizes_init(unsigned long min, unsigned long max_low,
        unsigned long max_high)
 {
        unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
@@ -381,7 +329,6 @@ void __init arm_memblock_init(struct meminfo *mi,
        dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit));
 
        arm_memblock_steal_permitted = false;
-       memblock_allow_resize();
        memblock_dump_all();
 }
 
@@ -389,12 +336,11 @@ void __init bootmem_init(void)
 {
        unsigned long min, max_low, max_high;
 
+       memblock_allow_resize();
        max_low = max_high = 0;
 
        find_limits(&min, &max_low, &max_high);
 
-       arm_bootmem_init(min, max_low);
-
        /*
         * Sparsemem tries to allocate bootmem in memory_present(),
         * so must be done after the fixed reservations
@@ -411,7 +357,7 @@ void __init bootmem_init(void)
         * the sparse mem_map arrays initialized by sparse_init()
         * for memmap_init_zone(), otherwise all PFNs are invalid.
         */
-       arm_bootmem_free(min, max_low, max_high);
+       zone_sizes_init(min, max_low, max_high);
 
        /*
         * This doesn't seem to be used by the Linux memory manager any
@@ -584,7 +530,7 @@ void __init mem_init(void)
        extern u32 itcm_end;
 #endif
 
-       max_mapnr   = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
+       set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
 
        /* this will put all unused low memory onto the freelists */
        free_unused_memmap(&meminfo);
index f123d6eb074b056586dd840ba2465d3fba2b36a2..f9c32ba73544d64551e8ff2d4f890b74432eec15 100644 (file)
@@ -392,9 +392,9 @@ __arm_ioremap_exec(phys_addr_t phys_addr, size_t size, bool cached)
        unsigned int mtype;
 
        if (cached)
-               mtype = MT_MEMORY;
+               mtype = MT_MEMORY_RWX;
        else
-               mtype = MT_MEMORY_NONCACHED;
+               mtype = MT_MEMORY_RWX_NONCACHED;
 
        return __arm_ioremap_caller(phys_addr, size, mtype,
                        __builtin_return_address(0));
index 580ef2de82d728f8ecfde5f5f3b208a2e5525b06..4f08c133cc255e2e2c2b93a0f28b79caaf3fc795 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/cputype.h>
 #include <asm/sections.h>
 #include <asm/cachetype.h>
+#include <asm/sections.h>
 #include <asm/setup.h>
 #include <asm/smp_plat.h>
 #include <asm/tlb.h>
@@ -287,36 +288,43 @@ static struct mem_type mem_types[] = {
                .prot_l1   = PMD_TYPE_TABLE,
                .domain    = DOMAIN_USER,
        },
-       [MT_MEMORY] = {
+       [MT_MEMORY_RWX] = {
                .prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY,
                .prot_l1   = PMD_TYPE_TABLE,
                .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
                .domain    = DOMAIN_KERNEL,
        },
+       [MT_MEMORY_RW] = {
+               .prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
+                            L_PTE_XN,
+               .prot_l1   = PMD_TYPE_TABLE,
+               .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
+               .domain    = DOMAIN_KERNEL,
+       },
        [MT_ROM] = {
                .prot_sect = PMD_TYPE_SECT,
                .domain    = DOMAIN_KERNEL,
        },
-       [MT_MEMORY_NONCACHED] = {
+       [MT_MEMORY_RWX_NONCACHED] = {
                .prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
                                L_PTE_MT_BUFFERABLE,
                .prot_l1   = PMD_TYPE_TABLE,
                .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
                .domain    = DOMAIN_KERNEL,
        },
-       [MT_MEMORY_DTCM] = {
+       [MT_MEMORY_RW_DTCM] = {
                .prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
                                L_PTE_XN,
                .prot_l1   = PMD_TYPE_TABLE,
                .prot_sect = PMD_TYPE_SECT | PMD_SECT_XN,
                .domain    = DOMAIN_KERNEL,
        },
-       [MT_MEMORY_ITCM] = {
+       [MT_MEMORY_RWX_ITCM] = {
                .prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY,
                .prot_l1   = PMD_TYPE_TABLE,
                .domain    = DOMAIN_KERNEL,
        },
-       [MT_MEMORY_SO] = {
+       [MT_MEMORY_RW_SO] = {
                .prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
                                L_PTE_MT_UNCACHED | L_PTE_XN,
                .prot_l1   = PMD_TYPE_TABLE,
@@ -325,7 +333,8 @@ static struct mem_type mem_types[] = {
                .domain    = DOMAIN_KERNEL,
        },
        [MT_MEMORY_DMA_READY] = {
-               .prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY,
+               .prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
+                               L_PTE_XN,
                .prot_l1   = PMD_TYPE_TABLE,
                .domain    = DOMAIN_KERNEL,
        },
@@ -337,6 +346,44 @@ const struct mem_type *get_mem_type(unsigned int type)
 }
 EXPORT_SYMBOL(get_mem_type);
 
+#define PTE_SET_FN(_name, pteop) \
+static int pte_set_##_name(pte_t *ptep, pgtable_t token, unsigned long addr, \
+                       void *data) \
+{ \
+       pte_t pte = pteop(*ptep); \
+\
+       set_pte_ext(ptep, pte, 0); \
+       return 0; \
+} \
+
+#define SET_MEMORY_FN(_name, callback) \
+int set_memory_##_name(unsigned long addr, int numpages) \
+{ \
+       unsigned long start = addr; \
+       unsigned long size = PAGE_SIZE*numpages; \
+       unsigned end = start + size; \
+\
+       if (start < MODULES_VADDR || start >= MODULES_END) \
+               return -EINVAL;\
+\
+       if (end < MODULES_VADDR || end >= MODULES_END) \
+               return -EINVAL; \
+\
+       apply_to_page_range(&init_mm, start, size, callback, NULL); \
+       flush_tlb_kernel_range(start, end); \
+       return 0;\
+}
+
+PTE_SET_FN(ro, pte_wrprotect)
+PTE_SET_FN(rw, pte_mkwrite)
+PTE_SET_FN(x, pte_mkexec)
+PTE_SET_FN(nx, pte_mknexec)
+
+SET_MEMORY_FN(ro, pte_set_ro)
+SET_MEMORY_FN(rw, pte_set_rw)
+SET_MEMORY_FN(x, pte_set_x)
+SET_MEMORY_FN(nx, pte_set_nx)
+
 /*
  * Adjust the PMD section entries according to the CPU in use.
  */
@@ -410,6 +457,9 @@ static void __init build_mem_type_table(void)
                        mem_types[MT_DEVICE_NONSHARED].prot_sect |= PMD_SECT_XN;
                        mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_XN;
                        mem_types[MT_DEVICE_WC].prot_sect |= PMD_SECT_XN;
+
+                       /* Also setup NX memory mapping */
+                       mem_types[MT_MEMORY_RW].prot_sect |= PMD_SECT_XN;
                }
                if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) {
                        /*
@@ -487,11 +537,13 @@ static void __init build_mem_type_table(void)
                        mem_types[MT_DEVICE_WC].prot_pte |= L_PTE_SHARED;
                        mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_S;
                        mem_types[MT_DEVICE_CACHED].prot_pte |= L_PTE_SHARED;
-                       mem_types[MT_MEMORY].prot_sect |= PMD_SECT_S;
-                       mem_types[MT_MEMORY].prot_pte |= L_PTE_SHARED;
+                       mem_types[MT_MEMORY_RWX].prot_sect |= PMD_SECT_S;
+                       mem_types[MT_MEMORY_RWX].prot_pte |= L_PTE_SHARED;
+                       mem_types[MT_MEMORY_RW].prot_sect |= PMD_SECT_S;
+                       mem_types[MT_MEMORY_RW].prot_pte |= L_PTE_SHARED;
                        mem_types[MT_MEMORY_DMA_READY].prot_pte |= L_PTE_SHARED;
-                       mem_types[MT_MEMORY_NONCACHED].prot_sect |= PMD_SECT_S;
-                       mem_types[MT_MEMORY_NONCACHED].prot_pte |= L_PTE_SHARED;
+                       mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= PMD_SECT_S;
+                       mem_types[MT_MEMORY_RWX_NONCACHED].prot_pte |= L_PTE_SHARED;
                }
        }
 
@@ -502,15 +554,15 @@ static void __init build_mem_type_table(void)
        if (cpu_arch >= CPU_ARCH_ARMv6) {
                if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) {
                        /* Non-cacheable Normal is XCB = 001 */
-                       mem_types[MT_MEMORY_NONCACHED].prot_sect |=
+                       mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |=
                                PMD_SECT_BUFFERED;
                } else {
                        /* For both ARMv6 and non-TEX-remapping ARMv7 */
-                       mem_types[MT_MEMORY_NONCACHED].prot_sect |=
+                       mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |=
                                PMD_SECT_TEX(1);
                }
        } else {
-               mem_types[MT_MEMORY_NONCACHED].prot_sect |= PMD_SECT_BUFFERABLE;
+               mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= PMD_SECT_BUFFERABLE;
        }
 
 #ifdef CONFIG_ARM_LPAE
@@ -543,10 +595,12 @@ static void __init build_mem_type_table(void)
 
        mem_types[MT_LOW_VECTORS].prot_l1 |= ecc_mask;
        mem_types[MT_HIGH_VECTORS].prot_l1 |= ecc_mask;
-       mem_types[MT_MEMORY].prot_sect |= ecc_mask | cp->pmd;
-       mem_types[MT_MEMORY].prot_pte |= kern_pgprot;
+       mem_types[MT_MEMORY_RWX].prot_sect |= ecc_mask | cp->pmd;
+       mem_types[MT_MEMORY_RWX].prot_pte |= kern_pgprot;
+       mem_types[MT_MEMORY_RW].prot_sect |= ecc_mask | cp->pmd;
+       mem_types[MT_MEMORY_RW].prot_pte |= kern_pgprot;
        mem_types[MT_MEMORY_DMA_READY].prot_pte |= kern_pgprot;
-       mem_types[MT_MEMORY_NONCACHED].prot_sect |= ecc_mask;
+       mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= ecc_mask;
        mem_types[MT_ROM].prot_sect |= cp->pmd;
 
        switch (cp->pmd) {
@@ -1296,6 +1350,8 @@ static void __init kmap_init(void)
 static void __init map_lowmem(void)
 {
        struct memblock_region *reg;
+       unsigned long kernel_x_start = round_down(__pa(_stext), SECTION_SIZE);
+       unsigned long kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE);
 
        /* Map all the lowmem memory banks. */
        for_each_memblock(memory, reg) {
@@ -1308,12 +1364,40 @@ static void __init map_lowmem(void)
                if (start >= end)
                        break;
 
-               map.pfn = __phys_to_pfn(start);
-               map.virtual = __phys_to_virt(start);
-               map.length = end - start;
-               map.type = MT_MEMORY;
+               if (end < kernel_x_start || start >= kernel_x_end) {
+                       map.pfn = __phys_to_pfn(start);
+                       map.virtual = __phys_to_virt(start);
+                       map.length = end - start;
+                       map.type = MT_MEMORY_RWX;
 
-               create_mapping(&map);
+                       create_mapping(&map);
+               } else {
+                       /* This better cover the entire kernel */
+                       if (start < kernel_x_start) {
+                               map.pfn = __phys_to_pfn(start);
+                               map.virtual = __phys_to_virt(start);
+                               map.length = kernel_x_start - start;
+                               map.type = MT_MEMORY_RW;
+
+                               create_mapping(&map);
+                       }
+
+                       map.pfn = __phys_to_pfn(kernel_x_start);
+                       map.virtual = __phys_to_virt(kernel_x_start);
+                       map.length = kernel_x_end - kernel_x_start;
+                       map.type = MT_MEMORY_RWX;
+
+                       create_mapping(&map);
+
+                       if (kernel_x_end < end) {
+                               map.pfn = __phys_to_pfn(kernel_x_end);
+                               map.virtual = __phys_to_virt(kernel_x_end);
+                               map.length = end - kernel_x_end;
+                               map.type = MT_MEMORY_RW;
+
+                               create_mapping(&map);
+                       }
+               }
        }
 }
 
index 1046b373d1aedb2823e3bb62f106681f9b63fc2a..249379535be2c151bc2eacd41b6c8a15f586c3cb 100644 (file)
@@ -23,7 +23,7 @@
 #define __pgd_alloc()  kmalloc(PTRS_PER_PGD * sizeof(pgd_t), GFP_KERNEL)
 #define __pgd_free(pgd)        kfree(pgd)
 #else
-#define __pgd_alloc()  (pgd_t *)__get_free_pages(GFP_KERNEL, 2)
+#define __pgd_alloc()  (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_REPEAT, 2)
 #define __pgd_free(pgd)        free_pages((unsigned long)pgd, 2)
 #endif
 
index 29606bd75f3f19b265e7bfaf2cb11c0156afbcb7..d70b73364a3fe8a549407f51c0f8f35e786360d7 100644 (file)
@@ -54,7 +54,7 @@ static struct clocksource iop_clocksource = {
 /*
  * IOP sched_clock() implementation via its clocksource.
  */
-static u32 notrace iop_read_sched_clock(void)
+static u64 notrace iop_read_sched_clock(void)
 {
        return 0xffffffffu - read_tcr1();
 }
@@ -142,7 +142,7 @@ void __init iop_init_time(unsigned long tick_rate)
 {
        u32 timer_ctl;
 
-       setup_sched_clock(iop_read_sched_clock, 32, tick_rate);
+       sched_clock_register(iop_read_sched_clock, 32, tick_rate);
 
        ticks_per_jiffy = DIV_ROUND_CLOSEST(tick_rate, HZ);
        iop_tick_rate = tick_rate;
index d9bc98eb2a6b6b80559faa096f47cda066060e00..384a776d8eb2c8e3133642d7e118ced04e9eb951 100644 (file)
@@ -38,7 +38,7 @@
  */
 static void __iomem *sync32k_cnt_reg;
 
-static u32 notrace omap_32k_read_sched_clock(void)
+static u64 notrace omap_32k_read_sched_clock(void)
 {
        return sync32k_cnt_reg ? __raw_readl(sync32k_cnt_reg) : 0;
 }
@@ -115,7 +115,7 @@ int __init omap_init_clocksource_32k(void __iomem *vbase)
                return ret;
        }
 
-       setup_sched_clock(omap_32k_read_sched_clock, 32, 32768);
+       sched_clock_register(omap_32k_read_sched_clock, 32, 32768);
        register_persistent_clock(NULL, omap_read_persistent_clock);
        pr_info("OMAP clocksource: 32k_counter at 32768 Hz\n");
 
index c66d163d7a2a25084179e71e6a2d57f8e04263ff..830ff07f33856dfa886a3224fe352dab2bd336f5 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/platform_data/dma-mv_xor.h>
 #include <linux/platform_data/usb-ehci-orion.h>
 #include <mach/bridge-regs.h>
+#include <plat/common.h>
 
 /* Create a clkdev entry for a given device/clk */
 void __init orion_clkdev_add(const char *con_id, const char *dev_id,
@@ -256,7 +257,7 @@ static __init void ge_complete(
 /*****************************************************************************
  * GE00
  ****************************************************************************/
-struct mv643xx_eth_shared_platform_data orion_ge00_shared_data;
+static struct mv643xx_eth_shared_platform_data orion_ge00_shared_data;
 
 static struct resource orion_ge00_shared_resources[] = {
        {
@@ -322,7 +323,7 @@ void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,
 /*****************************************************************************
  * GE01
  ****************************************************************************/
-struct mv643xx_eth_shared_platform_data orion_ge01_shared_data;
+static struct mv643xx_eth_shared_platform_data orion_ge01_shared_data;
 
 static struct resource orion_ge01_shared_resources[] = {
        {
@@ -373,7 +374,7 @@ void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,
 /*****************************************************************************
  * GE10
  ****************************************************************************/
-struct mv643xx_eth_shared_platform_data orion_ge10_shared_data;
+static struct mv643xx_eth_shared_platform_data orion_ge10_shared_data;
 
 static struct resource orion_ge10_shared_resources[] = {
        {
@@ -422,7 +423,7 @@ void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,
 /*****************************************************************************
  * GE11
  ****************************************************************************/
-struct mv643xx_eth_shared_platform_data orion_ge11_shared_data;
+static struct mv643xx_eth_shared_platform_data orion_ge11_shared_data;
 
 static struct resource orion_ge11_shared_resources[] = {
        {
index 9d2b2ac74938da9b52f2ee1f629fdb6ca3b602b7..261258f717fc200f99d6768d3fe7353ccaf18b90 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/sched_clock.h>
+#include <plat/time.h>
 
 /*
  * MBus bridge block registers.
@@ -60,7 +61,7 @@ static u32 ticks_per_jiffy;
  * at least 7.5ns (133MHz TCLK).
  */
 
-static u32 notrace orion_read_sched_clock(void)
+static u64 notrace orion_read_sched_clock(void)
 {
        return ~readl(timer_base + TIMER0_VAL_OFF);
 }
@@ -174,7 +175,7 @@ static irqreturn_t orion_timer_interrupt(int irq, void *dev_id)
 
 static struct irqaction orion_timer_irq = {
        .name           = "orion_tick",
-       .flags          = IRQF_DISABLED | IRQF_TIMER,
+       .flags          = IRQF_TIMER,
        .handler        = orion_timer_interrupt
 };
 
@@ -201,7 +202,7 @@ orion_time_init(void __iomem *_bridge_base, u32 _bridge_timer1_clr_mask,
        /*
         * Set scale and timer for sched_clock.
         */
-       setup_sched_clock(orion_read_sched_clock, 32, tclk);
+       sched_clock_register(orion_read_sched_clock, 32, tclk);
 
        /*
         * Setup free-running clocksource timer (interrupts
index 79ef102e3b2bfdbd2e9b278315779e16ffbbaa39..054fc5a1a11cebb5abba72780d1eea507a961f47 100644 (file)
@@ -377,7 +377,7 @@ int __init pxa_init_dma(int irq, int num_ch)
                spin_lock_init(&dma_channels[i].lock);
        }
 
-       ret = request_irq(irq, dma_irq_handler, IRQF_DISABLED, "DMA", NULL);
+       ret = request_irq(irq, dma_irq_handler, 0, "DMA", NULL);
        if (ret) {
                printk (KERN_CRIT "Wow!  Can't register IRQ for DMA\n");
                kfree(dma_channels);
index 6d95d60276d623bee59f28391d499f0e213730d5..58645a58d0d8823762aafa573ebc4dd9aba5f3cf 100644 (file)
@@ -24,7 +24,6 @@ config PLAT_S5P
        select S3C_GPIO_TRACK
        select S5P_GPIO_DRVSTR
        select SAMSUNG_CLKSRC if !COMMON_CLK
-       select SAMSUNG_GPIOLIB_4BIT
        help
          Base platform code for Samsung's S5P series SoC.
 
@@ -115,13 +114,6 @@ config S5P_GPIO_INT
 
 # options for gpio configuration support
 
-config SAMSUNG_GPIOLIB_4BIT
-       bool
-       help
-         GPIOlib file contains the 4 bit modification functions for gpio
-         configuration. GPIOlib shall be compiled only for S3C64XX and S5P
-         series of processors.
-
 config S5P_GPIO_DRVSTR
        bool
        help
index 6bc1a8f471e391e127be0dd7cfadf0eefa33a0f2..ff6063f0d5eacb54e458ddd01b1585b7e5862e8c 100644 (file)
@@ -101,8 +101,8 @@ struct pm_uart_save {
 /* helper functions to save/restore lists of registers. */
 
 extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
-extern void s3c_pm_do_restore(struct sleep_save *ptr, int count);
-extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
+extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count);
+extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count);
 
 #ifdef CONFIG_SAMSUNG_PM
 extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
index 4afc32f90b6d51f553e7d987cf972730466adb57..f48dc0a4736c8d2d1703a29dc0ece5bb9662f3ca 100644 (file)
@@ -145,6 +145,8 @@ static inline void arch_enable_uart_fifo(void)
                        if (!(fifocon & S3C2410_UFCON_RESETBOTH))
                                break;
                }
+
+               uart_wr(S3C2410_UFCON, S3C2410_UFCON_FIFOMODE);
        }
 }
 #else
index d0c23010b693a57625d002694528d0cd2fffaaa5..e5b0f2c2d8845d1573e935feada69e47273a23bd 100644 (file)
 #ifdef CONFIG_SAMSUNG_ATAGS
 #include <mach/hardware.h>
 #include <mach/map.h>
+#ifndef CONFIG_ARCH_EXYNOS
 #include <mach/regs-clock.h>
 #include <mach/regs-irq.h>
+#endif
 #include <mach/irqs.h>
 #endif
 
@@ -182,7 +184,7 @@ void s3c_pm_do_save(struct sleep_save *ptr, int count)
  * restore the UARTs state yet
 */
 
-void s3c_pm_do_restore(struct sleep_save *ptr, int count)
+void s3c_pm_do_restore(const struct sleep_save *ptr, int count)
 {
        for (; count > 0; count--, ptr++) {
                printk(KERN_DEBUG "restore %p (restore %08lx, was %08x)\n",
@@ -203,7 +205,7 @@ void s3c_pm_do_restore(struct sleep_save *ptr, int count)
  * peripherals, as things may be changing!
 */
 
-void s3c_pm_do_restore_core(struct sleep_save *ptr, int count)
+void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count)
 {
        for (; count > 0; count--, ptr++)
                __raw_writel(ptr->val, ptr->reg);
index faa651602780b6570b1af0d079d08a9b409e651e..ebee4dc11a946686a1c558c82f3f027b7c0f173b 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/device.h>
 #include <linux/gpio.h>
 #include <linux/irqchip/arm-vic.h>
+#include <linux/of.h>
 
 #include <plat/regs-irqtype.h>
 
@@ -202,6 +203,9 @@ static int __init s5p_init_irq_eint(void)
 {
        int irq;
 
+       if (of_have_populated_dt())
+               return -ENODEV;
+
        for (irq = IRQ_EINT(0); irq <= IRQ_EINT(15); irq++)
                irq_set_chip(irq, &s5p_irq_vic_eint);
 
index 7c1e3b7072fc37ff66f0968d533f819e7611e3bd..591498035916d0ae91cd4b1d736d7b282908648a 100644 (file)
 #include <mach/map.h>
 
 #include <mach/regs-gpio.h>
+
+#ifndef CONFIG_ARCH_EXYNOS
 #include <mach/regs-irq.h>
+#endif
 
 /* state for IRQs over sleep */
 
index 39895d892c3be7d158093ddd930e0fa1ea7a8890..53feb90c840ca5c2868671b4dcdb9e942f49521d 100644 (file)
@@ -27,8 +27,7 @@ static void write_pen_release(int val)
 {
        pen_release = val;
        smp_wmb();
-       __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
-       outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
+       sync_cache_w(&pen_release);
 }
 
 static DEFINE_SPINLOCK(boot_lock);
index 51b109e3b6c38d4d265dc53f581203ecef34ab34..c966ae90f4a0cda8796ddfeed9c0caef970e81a1 100644 (file)
@@ -26,7 +26,7 @@
 
 static void __iomem *ctr;
 
-static u32 notrace versatile_read_sched_clock(void)
+static u64 notrace versatile_read_sched_clock(void)
 {
        if (ctr)
                return readl(ctr);
@@ -37,5 +37,5 @@ static u32 notrace versatile_read_sched_clock(void)
 void __init versatile_sched_clock_init(void __iomem *reg, unsigned long rate)
 {
        ctr = reg;
-       setup_sched_clock(versatile_read_sched_clock, 32, rate);
+       sched_clock_register(versatile_read_sched_clock, 32, rate);
 }
index 9053beda8c5065d0c4fe4a7c148baea406f623ba..7ac2436856a523074f301c5c3f884efc3bc0bb72 100644 (file)
@@ -8,7 +8,9 @@ static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
        return kzalloc(size, GFP_KERNEL);
 }
 
+#ifndef CONFIG_COMMON_CLK
 #define __clk_put(clk)
 #define __clk_get(clk) ({ 1; })
+#endif
 
 #endif
index 262475414e5ffd452e816c5e6156fc57243b80ef..1b3ad7b09dc1e2887f9624a9a8770041aab27b6b 100644 (file)
 
 #include <linux/slab.h>
 
+#ifndef CONFIG_COMMON_CLK
 #define __clk_get(clk) ({ 1; })
 #define __clk_put(clk) do { } while (0)
+#endif
 
 static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
 {
index bcca01c9989daf57b963db9168d64ec09c7ee5af..200f2a1b599d16badb97d4b292729512602ab59d 100644 (file)
@@ -237,9 +237,9 @@ static int des3_setkey(struct crypto_tfm *tfm, const u8 *key,
        struct s390_des_ctx *ctx = crypto_tfm_ctx(tfm);
        u32 *flags = &tfm->crt_flags;
 
-       if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) &&
-           memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2],
-                  DES_KEY_SIZE)) &&
+       if (!(crypto_memneq(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) &&
+           crypto_memneq(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2],
+                         DES_KEY_SIZE)) &&
            (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) {
                *flags |= CRYPTO_TFM_RES_WEAK_KEY;
                return -EINVAL;
index 6ba91868201ce947f625a5c982c0b4ec3a290653..c41901465fb065f702083781d34b4c187473151d 100644 (file)
@@ -25,7 +25,9 @@ static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
                return kzalloc(size, GFP_KERNEL);
 }
 
+#ifndef CONFIG_COMMON_CLK
 #define __clk_put(clk)
 #define __clk_get(clk) ({ 1; })
+#endif
 
 #endif /* __CLKDEV_H__ */
index 4df4d4ffe39ba245b8b551afe80abf338c5ce527..3860b0be56c770b831349f681c0d217bfa4a8b94 100644 (file)
@@ -61,51 +61,63 @@ static DECLARE_INTC_DESC(intc_desc, "sh7619", vectors, NULL,
                         NULL, prio_registers, NULL);
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xf8400000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(88),
+};
+
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xf8400000, 0x100),
+       DEFINE_RES_IRQ(88),
 };
 
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xf8410000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(92),
+};
+
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xf8410000, 0x100),
+       DEFINE_RES_IRQ(92),
 };
 
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xf8420000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(96),
+};
+
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xf8420000, 0x100),
+       DEFINE_RES_IRQ(96),
 };
 
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
index f7f1cf2af3028dc8a5f4d3dfeacf5370ea3e0176..63e996f9a7ed776b251626c6c98ddd533fa19552 100644 (file)
@@ -199,17 +199,21 @@ static struct platform_device mtu2_2_device = {
 };
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xff804000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(220),
+};
+
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xff804000, 0x100),
+       DEFINE_RES_IRQ(220),
 };
 
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
index 7b84785b89624664ba8a028696128f8a188c534c..2c68744615367ef32427968b3036394d5a1e1acb 100644 (file)
@@ -178,136 +178,168 @@ static DECLARE_INTC_DESC(intc_desc, "sh7201", vectors, groups,
                         mask_registers, prio_registers, NULL);
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xfffe8000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(180),
+};
+
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xfffe8000, 0x100),
+       DEFINE_RES_IRQ(180),
 };
 
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xfffe8800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(184),
+};
+
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xfffe8800, 0x100),
+       DEFINE_RES_IRQ(184),
 };
 
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xfffe9000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(188),
+};
+
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xfffe9000, 0x100),
+       DEFINE_RES_IRQ(188),
 };
 
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xfffe9800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(192),
+};
+
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xfffe9800, 0x100),
+       DEFINE_RES_IRQ(192),
 };
 
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
 };
 
 static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xfffea000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(196),
+};
+
+static struct resource scif4_resources[] = {
+       DEFINE_RES_MEM(0xfffea000, 0x100),
+       DEFINE_RES_IRQ(196),
 };
 
 static struct platform_device scif4_device = {
        .name           = "sh-sci",
        .id             = 4,
+       .resource       = scif4_resources,
+       .num_resources  = ARRAY_SIZE(scif4_resources),
        .dev            = {
                .platform_data  = &scif4_platform_data,
        },
 };
 
 static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xfffea800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(200),
+};
+
+static struct resource scif5_resources[] = {
+       DEFINE_RES_MEM(0xfffea800, 0x100),
+       DEFINE_RES_IRQ(200),
 };
 
 static struct platform_device scif5_device = {
        .name           = "sh-sci",
        .id             = 5,
+       .resource       = scif5_resources,
+       .num_resources  = ARRAY_SIZE(scif5_resources),
        .dev            = {
                .platform_data  = &scif5_platform_data,
        },
 };
 
 static struct plat_sci_port scif6_platform_data = {
-       .mapbase        = 0xfffeb000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(204),
+};
+
+static struct resource scif6_resources[] = {
+       DEFINE_RES_MEM(0xfffeb000, 0x100),
+       DEFINE_RES_IRQ(204),
 };
 
 static struct platform_device scif6_device = {
        .name           = "sh-sci",
        .id             = 6,
+       .resource       = scif6_resources,
+       .num_resources  = ARRAY_SIZE(scif6_resources),
        .dev            = {
                .platform_data  = &scif6_platform_data,
        },
 };
 
 static struct plat_sci_port scif7_platform_data = {
-       .mapbase        = 0xfffeb800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(208),
+};
+
+static struct resource scif7_resources[] = {
+       DEFINE_RES_MEM(0xfffeb800, 0x100),
+       DEFINE_RES_IRQ(208),
 };
 
 static struct platform_device scif7_device = {
        .name           = "sh-sci",
        .id             = 7,
+       .resource       = scif7_resources,
+       .num_resources  = ARRAY_SIZE(scif7_resources),
        .dev            = {
                .platform_data  = &scif7_platform_data,
        },
index bfc33f6a28c3492b3a3ec54116d0d5d3dcea1aa9..d55a0f30ada394fece4fd926ce5ba18c77576e41 100644 (file)
@@ -174,76 +174,92 @@ static DECLARE_INTC_DESC(intc_desc, "sh7203", vectors, groups,
                         mask_registers, prio_registers, NULL);
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xfffe8000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(192),
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xfffe8000, 0x100),
+       DEFINE_RES_IRQ(192),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xfffe8800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(196),
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xfffe8800, 0x100),
+       DEFINE_RES_IRQ(196),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xfffe9000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(200),
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xfffe9000, 0x100),
+       DEFINE_RES_IRQ(200),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xfffe9800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(204),
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xfffe9800, 0x100),
+       DEFINE_RES_IRQ(204),
+};
+
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
index a5010741de854cd00383b4d9431cc43b73122bc1..241e745e3ced58260fbb0ead642f5c1fff72208a 100644 (file)
@@ -134,68 +134,84 @@ static DECLARE_INTC_DESC(intc_desc, "sh7206", vectors, groups,
                         mask_registers, prio_registers, NULL);
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xfffe8000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(240),
+};
+
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xfffe8000, 0x100),
+       DEFINE_RES_IRQ(240),
 };
 
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xfffe8800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(244),
+};
+
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xfffe8800, 0x100),
+       DEFINE_RES_IRQ(244),
 };
 
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xfffe9000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(248),
+};
+
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xfffe9000, 0x100),
+       DEFINE_RES_IRQ(248),
 };
 
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xfffe9800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(252),
+};
+
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xfffe9800, 0x100),
+       DEFINE_RES_IRQ(252),
 };
 
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
index ce5c1b5aebfaf81d3aacc83dbf734c3feccf22ec..ad5b0f429882a70e4b2b1604995051370c214f8d 100644 (file)
@@ -226,152 +226,208 @@ static DECLARE_INTC_DESC(intc_desc, "sh7264", vectors, groups,
                         mask_registers, prio_registers, NULL);
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xfffe8000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 233, 234, 235, 232 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xfffe8000, 0x100),
+       DEFINE_RES_IRQ(233),
+       DEFINE_RES_IRQ(234),
+       DEFINE_RES_IRQ(235),
+       DEFINE_RES_IRQ(232),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xfffe8800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 237, 238, 239, 236 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xfffe8800, 0x100),
+       DEFINE_RES_IRQ(237),
+       DEFINE_RES_IRQ(238),
+       DEFINE_RES_IRQ(239),
+       DEFINE_RES_IRQ(236),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xfffe9000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 241, 242, 243, 240 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xfffe9000, 0x100),
+       DEFINE_RES_IRQ(241),
+       DEFINE_RES_IRQ(242),
+       DEFINE_RES_IRQ(243),
+       DEFINE_RES_IRQ(240),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xfffe9800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 245, 246, 247, 244 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xfffe9800, 0x100),
+       DEFINE_RES_IRQ(245),
+       DEFINE_RES_IRQ(246),
+       DEFINE_RES_IRQ(247),
+       DEFINE_RES_IRQ(244),
+};
+
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
 };
 
 static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xfffea000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 249, 250, 251, 248 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif4_resources[] = {
+       DEFINE_RES_MEM(0xfffea000, 0x100),
+       DEFINE_RES_IRQ(249),
+       DEFINE_RES_IRQ(250),
+       DEFINE_RES_IRQ(251),
+       DEFINE_RES_IRQ(248),
+};
+
 static struct platform_device scif4_device = {
        .name           = "sh-sci",
        .id             = 4,
+       .resource       = scif4_resources,
+       .num_resources  = ARRAY_SIZE(scif4_resources),
        .dev            = {
                .platform_data  = &scif4_platform_data,
        },
 };
 
 static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xfffea800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 253, 254, 255, 252 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif5_resources[] = {
+       DEFINE_RES_MEM(0xfffea800, 0x100),
+       DEFINE_RES_IRQ(253),
+       DEFINE_RES_IRQ(254),
+       DEFINE_RES_IRQ(255),
+       DEFINE_RES_IRQ(252),
+};
+
 static struct platform_device scif5_device = {
        .name           = "sh-sci",
        .id             = 5,
+       .resource       = scif5_resources,
+       .num_resources  = ARRAY_SIZE(scif5_resources),
        .dev            = {
                .platform_data  = &scif5_platform_data,
        },
 };
 
 static struct plat_sci_port scif6_platform_data = {
-       .mapbase        = 0xfffeb000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 257, 258, 259, 256 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif6_resources[] = {
+       DEFINE_RES_MEM(0xfffeb000, 0x100),
+       DEFINE_RES_IRQ(257),
+       DEFINE_RES_IRQ(258),
+       DEFINE_RES_IRQ(259),
+       DEFINE_RES_IRQ(256),
+};
+
 static struct platform_device scif6_device = {
        .name           = "sh-sci",
        .id             = 6,
+       .resource       = scif6_resources,
+       .num_resources  = ARRAY_SIZE(scif6_resources),
        .dev            = {
                .platform_data  = &scif6_platform_data,
        },
 };
 
 static struct plat_sci_port scif7_platform_data = {
-       .mapbase        = 0xfffeb800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 261, 262, 263, 260 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif7_resources[] = {
+       DEFINE_RES_MEM(0xfffeb800, 0x100),
+       DEFINE_RES_IRQ(261),
+       DEFINE_RES_IRQ(262),
+       DEFINE_RES_IRQ(263),
+       DEFINE_RES_IRQ(260),
+};
+
 static struct platform_device scif7_device = {
        .name           = "sh-sci",
        .id             = 7,
+       .resource       = scif7_resources,
+       .num_resources  = ARRAY_SIZE(scif7_resources),
        .dev            = {
                .platform_data  = &scif7_platform_data,
        },
index e82ae9d8d3bcb2d5a850a3b7375e76e5321db475..3995119f65dc748078d66527d3f096af8d4c25e7 100644 (file)
@@ -248,152 +248,208 @@ static DECLARE_INTC_DESC(intc_desc, "sh7269", vectors, groups,
                         mask_registers, prio_registers, NULL);
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xe8007000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 259, 260, 261, 258 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xe8007000, 0x100),
+       DEFINE_RES_IRQ(259),
+       DEFINE_RES_IRQ(260),
+       DEFINE_RES_IRQ(261),
+       DEFINE_RES_IRQ(258),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xe8007800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 263, 264, 265, 262 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xe8007800, 0x100),
+       DEFINE_RES_IRQ(263),
+       DEFINE_RES_IRQ(264),
+       DEFINE_RES_IRQ(265),
+       DEFINE_RES_IRQ(262),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xe8008000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 267, 268, 269, 266 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xe8008000, 0x100),
+       DEFINE_RES_IRQ(267),
+       DEFINE_RES_IRQ(268),
+       DEFINE_RES_IRQ(269),
+       DEFINE_RES_IRQ(266),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xe8008800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 271, 272, 273, 270 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xe8008800, 0x100),
+       DEFINE_RES_IRQ(271),
+       DEFINE_RES_IRQ(272),
+       DEFINE_RES_IRQ(273),
+       DEFINE_RES_IRQ(270),
+};
+
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
 };
 
 static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xe8009000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 275, 276, 277, 274 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif4_resources[] = {
+       DEFINE_RES_MEM(0xe8009000, 0x100),
+       DEFINE_RES_IRQ(275),
+       DEFINE_RES_IRQ(276),
+       DEFINE_RES_IRQ(277),
+       DEFINE_RES_IRQ(274),
+};
+
 static struct platform_device scif4_device = {
        .name           = "sh-sci",
        .id             = 4,
+       .resource       = scif4_resources,
+       .num_resources  = ARRAY_SIZE(scif4_resources),
        .dev            = {
                .platform_data  = &scif4_platform_data,
        },
 };
 
 static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xe8009800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 279, 280, 281, 278 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif5_resources[] = {
+       DEFINE_RES_MEM(0xe8009800, 0x100),
+       DEFINE_RES_IRQ(279),
+       DEFINE_RES_IRQ(280),
+       DEFINE_RES_IRQ(281),
+       DEFINE_RES_IRQ(278),
+};
+
 static struct platform_device scif5_device = {
        .name           = "sh-sci",
        .id             = 5,
+       .resource       = scif5_resources,
+       .num_resources  = ARRAY_SIZE(scif5_resources),
        .dev            = {
                .platform_data  = &scif5_platform_data,
        },
 };
 
 static struct plat_sci_port scif6_platform_data = {
-       .mapbase        = 0xe800a000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 283, 284, 285, 282 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif6_resources[] = {
+       DEFINE_RES_MEM(0xe800a000, 0x100),
+       DEFINE_RES_IRQ(283),
+       DEFINE_RES_IRQ(284),
+       DEFINE_RES_IRQ(285),
+       DEFINE_RES_IRQ(282),
+};
+
 static struct platform_device scif6_device = {
        .name           = "sh-sci",
        .id             = 6,
+       .resource       = scif6_resources,
+       .num_resources  = ARRAY_SIZE(scif6_resources),
        .dev            = {
                .platform_data  = &scif6_platform_data,
        },
 };
 
 static struct plat_sci_port scif7_platform_data = {
-       .mapbase        = 0xe800a800,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
                          SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           =  { 287, 288, 289, 286 },
        .regtype        = SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif7_resources[] = {
+       DEFINE_RES_MEM(0xe800a800, 0x100),
+       DEFINE_RES_IRQ(287),
+       DEFINE_RES_IRQ(288),
+       DEFINE_RES_IRQ(289),
+       DEFINE_RES_IRQ(286),
+};
+
 static struct platform_device scif7_device = {
        .name           = "sh-sci",
        .id             = 7,
+       .resource       = scif7_resources,
+       .num_resources  = ARRAY_SIZE(scif7_resources),
        .dev            = {
                .platform_data  = &scif7_platform_data,
        },
index 03e4c96f2b11d64ee86af9ab47e6343c22a384d4..c76b2543b85f4f105b2edf5451efecbf34eb60de 100644 (file)
@@ -70,39 +70,47 @@ static DECLARE_INTC_DESC(intc_desc, "sh7705", vectors, NULL,
                         NULL, prio_registers, NULL);
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xa4410000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_TIE | SCSCR_RIE  | SCSCR_TE |
                          SCSCR_RE  | SCSCR_CKE1 | SCSCR_CKE0,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x900)),
        .ops            = &sh770x_sci_port_ops,
        .regtype        = SCIx_SH7705_SCIF_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xa4410000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x900)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xa4400000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_TIE | SCSCR_RIE | SCSCR_TE | SCSCR_RE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x880)),
        .ops            = &sh770x_sci_port_ops,
        .regtype        = SCIx_SH7705_SCIF_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xa4400000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x880)),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
index ba26cd9ce69b7b581d0fea85965a16f0a6dedb4b..ff1465c0519cbcf81878528d258055886c4f6d99 100644 (file)
@@ -109,20 +109,24 @@ static struct platform_device rtc_device = {
 };
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xfffffe80,
        .port_reg       = 0xa4000136,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_TE | SCSCR_RE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCI,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x4e0)),
        .ops            = &sh770x_sci_port_ops,
        .regshift       = 1,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xfffffe80, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x4e0)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
@@ -131,19 +135,23 @@ static struct platform_device scif0_device = {
     defined(CONFIG_CPU_SUBTYPE_SH7707) || \
     defined(CONFIG_CPU_SUBTYPE_SH7709)
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xa4000150,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_TE | SCSCR_RE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x900)),
        .ops            = &sh770x_sci_port_ops,
        .regtype        = SCIx_SH3_SCIF_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xa4000150, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x900)),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
@@ -152,20 +160,24 @@ static struct platform_device scif1_device = {
 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
     defined(CONFIG_CPU_SUBTYPE_SH7709)
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xa4000140,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_TE | SCSCR_RE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_IRDA,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x880)),
        .ops            = &sh770x_sci_port_ops,
        .regshift       = 1,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xa4000140, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x880)),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
index 93c9c5e24a7abbe7e7c5b832b0497c54be6adb03..e2ce9360ed5ac0eb65dbbfab2921fa1f644f5791 100644 (file)
@@ -98,36 +98,44 @@ static struct platform_device rtc_device = {
 };
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xa4400000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_TE | SCSCR_RE | SCSCR_REIE |
                          SCSCR_CKE1 | SCSCR_CKE0,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x880)),
+};
+
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xa4400000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x880)),
 };
 
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xa4410000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_TE | SCSCR_RE | SCSCR_REIE |
                          SCSCR_CKE1 | SCSCR_CKE0,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x900)),
+};
+
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xa4410000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x900)),
 };
 
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
index 42d991f632b1f4b013b55af71df2a81f143b6090..1d5729dc072401d76faf8fffd622dbaa9995afd9 100644 (file)
@@ -52,38 +52,46 @@ static struct platform_device rtc_device = {
 };
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xa4430000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc00)),
        .ops            = &sh7720_sci_port_ops,
        .regtype        = SCIx_SH7705_SCIF_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xa4430000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc00)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xa4438000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_4,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc20)),
        .ops            = &sh7720_sci_port_ops,
        .regtype        = SCIx_SH7705_SCIF_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xa4438000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc20)),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
index 2a5320aa73bbbf8e3df126559bb0cf8514cd3a0b..a8bd778d5ac881244dc161857c307557d9363091 100644 (file)
 #include <linux/io.h>
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffe80000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = { evt2irq(0x700),
-                           evt2irq(0x720),
-                           evt2irq(0x760),
-                           evt2irq(0x740) },
+};
+
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffe80000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x700)),
+       DEFINE_RES_IRQ(evt2irq(0x720)),
+       DEFINE_RES_IRQ(evt2irq(0x760)),
+       DEFINE_RES_IRQ(evt2irq(0x740)),
 };
 
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
index 04a45512596f310fb50367c04424610ec8e83459..a447a248491f8dbdb0479ba2db03de3392100fc7 100644 (file)
@@ -38,36 +38,44 @@ static struct platform_device rtc_device = {
 };
 
 static struct plat_sci_port sci_platform_data = {
-       .mapbase        = 0xffe00000,
        .port_reg       = 0xffe0001C,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_TE | SCSCR_RE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCI,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x4e0)),
        .regshift       = 2,
 };
 
+static struct resource sci_resources[] = {
+       DEFINE_RES_MEM(0xffe00000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x4e0)),
+};
+
 static struct platform_device sci_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = sci_resources,
+       .num_resources  = ARRAY_SIZE(sci_resources),
        .dev            = {
                .platform_data  = &sci_platform_data,
        },
 };
 
 static struct plat_sci_port scif_platform_data = {
-       .mapbase        = 0xffe80000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_TE | SCSCR_RE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x700)),
+};
+
+static struct resource scif_resources[] = {
+       DEFINE_RES_MEM(0xffe80000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x700)),
 };
 
 static struct platform_device scif_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif_resources,
+       .num_resources  = ARRAY_SIZE(scif_resources),
        .dev            = {
                .platform_data  = &scif_platform_data,
        },
index 98e075ada44eee248b8f44d52ccddab7bbd53432..1abd9fb4a3865c7492abe77bf82a741793e7c6c3 100644 (file)
@@ -128,83 +128,99 @@ static DECLARE_INTC_DESC(intc_desc_irq, "sh7760-irq", vectors_irq, groups,
                         mask_registers, prio_registers, NULL);
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xfe600000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = { evt2irq(0x880),
-                           evt2irq(0x8a0),
-                           evt2irq(0x8e0),
-                           evt2irq(0x8c0) },
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xfe600000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x880)),
+       DEFINE_RES_IRQ(evt2irq(0x8a0)),
+       DEFINE_RES_IRQ(evt2irq(0x8e0)),
+       DEFINE_RES_IRQ(evt2irq(0x8c0)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xfe610000,
        .flags          = UPF_BOOT_AUTOCONF,
        .type           = PORT_SCIF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
-       .irqs           = { evt2irq(0xb00),
-                           evt2irq(0xb20),
-                           evt2irq(0xb60),
-                           evt2irq(0xb40) },
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xfe610000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xb00)),
+       DEFINE_RES_IRQ(evt2irq(0xb20)),
+       DEFINE_RES_IRQ(evt2irq(0xb60)),
+       DEFINE_RES_IRQ(evt2irq(0xb40)),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xfe620000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = { evt2irq(0xb80),
-                           evt2irq(0xba0),
-                           evt2irq(0xbe0),
-                           evt2irq(0xbc0) },
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xfe620000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xb80)),
+       DEFINE_RES_IRQ(evt2irq(0xba0)),
+       DEFINE_RES_IRQ(evt2irq(0xbe0)),
+       DEFINE_RES_IRQ(evt2irq(0xbc0)),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xfe480000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCI,
-       .irqs           = { evt2irq(0xc00),
-                           evt2irq(0xc20),
-                           evt2irq(0xc40), },
        .regshift       = 2,
 };
 
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xfe480000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc00)),
+       DEFINE_RES_IRQ(evt2irq(0xc20)),
+       DEFINE_RES_IRQ(evt2irq(0xc40)),
+};
+
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
index b91ea8300a3e8f9383cccfc758bf174c8d0a2f97..245d19254489a011b0b246d31e381580857c6450 100644 (file)
 
 /* Serial */
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffe00000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc00)),
+};
+
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffe00000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc00)),
 };
 
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xffe10000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc20)),
+};
+
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xffe10000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc20)),
 };
 
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xffe20000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc40)),
+};
+
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xffe20000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc40)),
 };
 
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xffe30000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc60)),
+};
+
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xffe30000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc60)),
 };
 
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
index 0bd09d51419fefebc683e8c0edf476e232694298..6f56cbd76b20f162885ab69080db5e488ee7df86 100644 (file)
 #include <asm/clock.h>
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffe00000,
        .port_reg       = 0xa405013e,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc00)),
+};
+
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffe00000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc00)),
 };
 
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
index 6a868b091c2da39c5c1d1bf9d3f9c1b6f7c6b6e7..5a94efc8d4ceed884d3d094a3b02a466bad6f614 100644 (file)
@@ -179,57 +179,69 @@ struct platform_device dma_device = {
 
 /* Serial */
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffe00000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc00)),
        .ops            = &sh7722_sci_port_ops,
        .regtype        = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffe00000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc00)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xffe10000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc20)),
        .ops            = &sh7722_sci_port_ops,
        .regtype        = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xffe10000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc20)),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xffe20000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc40)),
        .ops            = &sh7722_sci_port_ops,
        .regtype        = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xffe20000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc40)),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
index 28d6fd835fe001a5b7a7692da577c26e9ba50e4a..3c5eb0993a75526f088afb015d3f0aa0f07f2c70 100644 (file)
 
 /* Serial */
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffe00000,
        .port_reg       = 0xa4050160,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc00)),
        .regtype        = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffe00000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc00)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xffe10000,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc20)),
        .regtype        = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xffe10000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc20)),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xffe20000,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc40)),
        .regtype        = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xffe20000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc40)),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xa4e30000,
        .flags          = UPF_BOOT_AUTOCONF,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_3,
+       .sampling_rate  = 8,
        .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x900)),
+};
+
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xa4e30000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x900)),
 };
 
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
 };
 
 static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xa4e40000,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_3,
+       .sampling_rate  = 8,
        .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xd00)),
+};
+
+static struct resource scif4_resources[] = {
+       DEFINE_RES_MEM(0xa4e40000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xd00)),
 };
 
 static struct platform_device scif4_device = {
        .name           = "sh-sci",
        .id             = 4,
+       .resource       = scif4_resources,
+       .num_resources  = ARRAY_SIZE(scif4_resources),
        .dev            = {
                .platform_data  = &scif4_platform_data,
        },
 };
 
 static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xa4e50000,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_3,
+       .sampling_rate  = 8,
        .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xfa0)),
+};
+
+static struct resource scif5_resources[] = {
+       DEFINE_RES_MEM(0xa4e50000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xfa0)),
 };
 
 static struct platform_device scif5_device = {
        .name           = "sh-sci",
        .id             = 5,
+       .resource       = scif5_resources,
+       .num_resources  = ARRAY_SIZE(scif5_resources),
        .dev            = {
                .platform_data  = &scif5_platform_data,
        },
index 26b74c2f94968de7f56ead9227fe46751c6b67b6..60ebbc6842ff1e74d573853429b991e57ef48ef5 100644 (file)
@@ -290,111 +290,138 @@ static struct platform_device dma1_device = {
 
 /* Serial */
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffe00000,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc00)),
        .regtype        = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffe00000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc00)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xffe10000,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc20)),
        .regtype        = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xffe10000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc20)),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xffe20000,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xc40)),
        .regtype        = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xffe20000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xc40)),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xa4e30000,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_3,
+       .sampling_rate  = 8,
        .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x900)),
+};
+
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xa4e30000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x900)),
 };
 
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
 };
 
 static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xa4e40000,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_3,
+       .sampling_rate  = 8,
        .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xd00)),
+};
+
+static struct resource scif4_resources[] = {
+       DEFINE_RES_MEM(0xa4e40000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xd00)),
 };
 
 static struct platform_device scif4_device = {
        .name           = "sh-sci",
        .id             = 4,
+       .resource       = scif4_resources,
+       .num_resources  = ARRAY_SIZE(scif4_resources),
        .dev            = {
                .platform_data  = &scif4_platform_data,
        },
 };
 
 static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xa4e50000,
        .port_reg       = SCIx_NOT_SUPPORTED,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE,
-       .scbrr_algo_id  = SCBRR_ALGO_3,
+       .sampling_rate  = 8,
        .type           = PORT_SCIFA,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xfa0)),
+};
+
+static struct resource scif5_resources[] = {
+       DEFINE_RES_MEM(0xa4e50000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xfa0)),
 };
 
 static struct platform_device scif5_device = {
        .name           = "sh-sci",
        .id             = 5,
+       .resource       = scif5_resources,
+       .num_resources  = ARRAY_SIZE(scif5_resources),
        .dev            = {
                .platform_data  = &scif5_platform_data,
        },
index f799971d453cbafe55d36964e761160be8cafa8f..dad4ed1b2f9429e48803c81bac5d5e1273507905 100644 (file)
 
 /* SCIF */
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xFFE40000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x8C0)),
        .regtype        = SCIx_SH4_SCIF_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffe40000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x8c0)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
-       .id                     = 0,
+       .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xFFE41000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x8E0)),
        .regtype        = SCIx_SH4_SCIF_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xffe41000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x8e0)),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
-       .id         = 1,
+       .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xFFE42000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x900)),
        .regtype        = SCIx_SH4_SCIF_REGTYPE,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xffe42000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x900)),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
-       .id         = 2,
+       .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xFFE43000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x920)),
        .regtype        = SCIx_SH4_SCIF_REGTYPE,
 };
 
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xffe43000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x920)),
+};
+
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
-       .id             = 3,
+       .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
 };
 
 static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xFFE44000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x940)),
        .regtype        = SCIx_SH4_SCIF_REGTYPE,
 };
 
+static struct resource scif4_resources[] = {
+       DEFINE_RES_MEM(0xffe44000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x940)),
+};
+
 static struct platform_device scif4_device = {
        .name           = "sh-sci",
-       .id             = 4,
+       .id             = 4,
+       .resource       = scif4_resources,
+       .num_resources  = ARRAY_SIZE(scif4_resources),
        .dev            = {
                .platform_data  = &scif4_platform_data,
        },
 };
 
 static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xFFE43000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x960)),
        .regtype                = SCIx_SH4_SCIF_REGTYPE,
 };
 
+static struct resource scif5_resources[] = {
+       DEFINE_RES_MEM(0xffe43000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x960)),
+};
+
 static struct platform_device scif5_device = {
        .name           = "sh-sci",
-       .id             = 5,
+       .id             = 5,
+       .resource       = scif5_resources,
+       .num_resources  = ARRAY_SIZE(scif5_resources),
        .dev            = {
                .platform_data  = &scif5_platform_data,
        },
index 9079a0f9ea9be7b48369ffd7bcc2e6e516916326..e43e5db539139b55cc058ca6aaecdf51bad98746 100644 (file)
 #include <cpu/sh7757.h>
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xfe4b0000,           /* SCIF2 */
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x700)),
+};
+
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xfe4b0000, 0x100),              /* SCIF2 */
+       DEFINE_RES_IRQ(evt2irq(0x700)),
 };
 
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xfe4c0000,           /* SCIF3 */
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xb80)),
+};
+
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xfe4c0000, 0x100),              /* SCIF3 */
+       DEFINE_RES_IRQ(evt2irq(0xb80)),
 };
 
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
 };
 
 static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xfe4d0000,           /* SCIF4 */
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xF00)),
+};
+
+static struct resource scif4_resources[] = {
+       DEFINE_RES_MEM(0xfe4d0000, 0x100),              /* SCIF4 */
+       DEFINE_RES_IRQ(evt2irq(0xf00)),
 };
 
 static struct platform_device scif4_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif4_resources,
+       .num_resources  = ARRAY_SIZE(scif4_resources),
        .dev            = {
                .platform_data  = &scif4_platform_data,
        },
index 1686acaaf45af226a8f6809f937896abee8000c5..5eebbd7f4c21926df78e7cbad53f32db255cb036 100644 (file)
 #include <linux/usb/ohci_pdriver.h>
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffe00000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x700)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffe00000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x700)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xffe08000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xb80)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xffe08000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xb80)),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xffe10000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xf00)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xffe10000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xf00)),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
index 256ea7a451641bc79071b77da0dc76915d6bdc41..e1ba8cb74e5ade17fd74b5b551964cbd4ff3799e 100644 (file)
 #include <linux/io.h>
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xff923000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x9a0)),
+};
+
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xff923000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x9a0)),
 };
 
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xff924000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x9c0)),
+};
+
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xff924000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x9c0)),
 };
 
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xff925000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x9e0)),
+};
+
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xff925000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x9e0)),
 };
 
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xff926000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xa00)),
+};
+
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xff926000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xa00)),
 };
 
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
 };
 
 static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xff927000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xa20)),
+};
+
+static struct resource scif4_resources[] = {
+       DEFINE_RES_MEM(0xff927000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xa20)),
 };
 
 static struct platform_device scif4_device = {
        .name           = "sh-sci",
        .id             = 4,
+       .resource       = scif4_resources,
+       .num_resources  = ARRAY_SIZE(scif4_resources),
        .dev            = {
                .platform_data  = &scif4_platform_data,
        },
 };
 
 static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xff928000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xa40)),
+};
+
+static struct resource scif5_resources[] = {
+       DEFINE_RES_MEM(0xff928000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xa40)),
 };
 
 static struct platform_device scif5_device = {
        .name           = "sh-sci",
        .id             = 5,
+       .resource       = scif5_resources,
+       .num_resources  = ARRAY_SIZE(scif5_resources),
        .dev            = {
                .platform_data  = &scif5_platform_data,
        },
 };
 
 static struct plat_sci_port scif6_platform_data = {
-       .mapbase        = 0xff929000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xa60)),
+};
+
+static struct resource scif6_resources[] = {
+       DEFINE_RES_MEM(0xff929000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xa60)),
 };
 
 static struct platform_device scif6_device = {
        .name           = "sh-sci",
        .id             = 6,
+       .resource       = scif6_resources,
+       .num_resources  = ARRAY_SIZE(scif6_resources),
        .dev            = {
                .platform_data  = &scif6_platform_data,
        },
 };
 
 static struct plat_sci_port scif7_platform_data = {
-       .mapbase        = 0xff92a000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xa80)),
+};
+
+static struct resource scif7_resources[] = {
+       DEFINE_RES_MEM(0xff92a000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xa80)),
 };
 
 static struct platform_device scif7_device = {
        .name           = "sh-sci",
        .id             = 7,
+       .resource       = scif7_resources,
+       .num_resources  = ARRAY_SIZE(scif7_resources),
        .dev            = {
                .platform_data  = &scif7_platform_data,
        },
 };
 
 static struct plat_sci_port scif8_platform_data = {
-       .mapbase        = 0xff92b000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xaa0)),
+};
+
+static struct resource scif8_resources[] = {
+       DEFINE_RES_MEM(0xff92b000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xaa0)),
 };
 
 static struct platform_device scif8_device = {
        .name           = "sh-sci",
        .id             = 8,
+       .resource       = scif8_resources,
+       .num_resources  = ARRAY_SIZE(scif8_resources),
        .dev            = {
                .platform_data  = &scif8_platform_data,
        },
 };
 
 static struct plat_sci_port scif9_platform_data = {
-       .mapbase        = 0xff92c000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xac0)),
+};
+
+static struct resource scif9_resources[] = {
+       DEFINE_RES_MEM(0xff92c000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xac0)),
 };
 
 static struct platform_device scif9_device = {
        .name           = "sh-sci",
        .id             = 9,
+       .resource       = scif9_resources,
+       .num_resources  = ARRAY_SIZE(scif9_resources),
        .dev            = {
                .platform_data  = &scif9_platform_data,
        },
index de45b704687a07b695995a7d357dde59ce30fda9..668e54bafa863fe21525b7fb519792818ac84d2f 100644 (file)
 #include <cpu/dma-register.h>
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffe00000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x700)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffe00000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x700)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xffe10000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0xb80)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xffe10000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0xb80)),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
@@ -409,9 +417,7 @@ void __init plat_early_device_setup(void)
 {
        if (mach_is_sh2007()) {
                scif0_platform_data.scscr &= ~SCSCR_CKE1;
-               scif0_platform_data.scbrr_algo_id = SCBRR_ALGO_2;
                scif1_platform_data.scscr &= ~SCSCR_CKE1;
-               scif1_platform_data.scbrr_algo_id = SCBRR_ALGO_2;
        }
 
        early_platform_add_devices(sh7780_early_devices,
index 0968ecb962e6611fa30198bac2f2609a43093e98..4aa67914020935f82c4c37b352b2155fbcc75dea 100644 (file)
 #include <cpu/dma-register.h>
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffea0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x700)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffea0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x700)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xffeb0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x780)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xffeb0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x780)),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xffec0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x980)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xffec0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x980)),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xffed0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x9a0)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xffed0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x9a0)),
+};
+
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
 };
 
 static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xffee0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x9c0)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif4_resources[] = {
+       DEFINE_RES_MEM(0xffee0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x9c0)),
+};
+
 static struct platform_device scif4_device = {
        .name           = "sh-sci",
        .id             = 4,
+       .resource       = scif4_resources,
+       .num_resources  = ARRAY_SIZE(scif4_resources),
        .dev            = {
                .platform_data  = &scif4_platform_data,
        },
 };
 
 static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xffef0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x9e0)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif5_resources[] = {
+       DEFINE_RES_MEM(0xffef0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x9e0)),
+};
+
 static struct platform_device scif5_device = {
        .name           = "sh-sci",
        .id             = 5,
+       .resource       = scif5_resources,
+       .num_resources  = ARRAY_SIZE(scif5_resources),
        .dev            = {
                .platform_data  = &scif5_platform_data,
        },
index ab52d4d4484d460bffc3b66ec9be5a60287d92cd..5d619a551a3b6142d3b5ac761b694995a172b04f 100644 (file)
 #include <asm/mmzone.h>
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffea0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = { evt2irq(0x700),
-                           evt2irq(0x720),
-                           evt2irq(0x760),
-                           evt2irq(0x740) },
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffea0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x700)),
+       DEFINE_RES_IRQ(evt2irq(0x720)),
+       DEFINE_RES_IRQ(evt2irq(0x760)),
+       DEFINE_RES_IRQ(evt2irq(0x740)),
+};
+
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
@@ -52,90 +56,119 @@ static struct platform_device scif0_device = {
  * The rest of these all have multiplexed IRQs
  */
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xffeb0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x780)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xffeb0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x780)),
+};
+
+static struct resource scif1_demux_resources[] = {
+       DEFINE_RES_MEM(0xffeb0000, 0x100),
+       /* Placeholders, see sh7786_devices_setup() */
+       DEFINE_RES_IRQ(0),
+       DEFINE_RES_IRQ(0),
+       DEFINE_RES_IRQ(0),
+       DEFINE_RES_IRQ(0),
+};
+
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xffec0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x840)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xffec0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x840)),
+};
+
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
 };
 
 static struct plat_sci_port scif3_platform_data = {
-       .mapbase        = 0xffed0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x860)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif3_resources[] = {
+       DEFINE_RES_MEM(0xffed0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x860)),
+};
+
 static struct platform_device scif3_device = {
        .name           = "sh-sci",
        .id             = 3,
+       .resource       = scif3_resources,
+       .num_resources  = ARRAY_SIZE(scif3_resources),
        .dev            = {
                .platform_data  = &scif3_platform_data,
        },
 };
 
 static struct plat_sci_port scif4_platform_data = {
-       .mapbase        = 0xffee0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x880)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif4_resources[] = {
+       DEFINE_RES_MEM(0xffee0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x880)),
+};
+
 static struct platform_device scif4_device = {
        .name           = "sh-sci",
        .id             = 4,
+       .resource       = scif4_resources,
+       .num_resources  = ARRAY_SIZE(scif4_resources),
        .dev            = {
                .platform_data  = &scif4_platform_data,
        },
 };
 
 static struct plat_sci_port scif5_platform_data = {
-       .mapbase        = 0xffef0000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_CKE1,
-       .scbrr_algo_id  = SCBRR_ALGO_1,
        .type           = PORT_SCIF,
-       .irqs           = SCIx_IRQ_MUXED(evt2irq(0x8a0)),
        .regtype        = SCIx_SH4_SCIF_FIFODATA_REGTYPE,
 };
 
+static struct resource scif5_resources[] = {
+       DEFINE_RES_MEM(0xffef0000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x8a0)),
+};
+
 static struct platform_device scif5_device = {
        .name           = "sh-sci",
        .id             = 5,
+       .resource       = scif5_resources,
+       .num_resources  = ARRAY_SIZE(scif5_resources),
        .dev            = {
                .platform_data  = &scif5_platform_data,
        },
@@ -1037,13 +1070,16 @@ static int __init sh7786_devices_setup(void)
         */
        irq = intc_irq_lookup(sh7786_intc_desc.name, TXI1);
        if (irq > 0) {
-               scif1_platform_data.irqs[SCIx_TXI_IRQ] = irq;
-               scif1_platform_data.irqs[SCIx_ERI_IRQ] =
+               scif1_demux_resources[1].start =
                        intc_irq_lookup(sh7786_intc_desc.name, ERI1);
-               scif1_platform_data.irqs[SCIx_BRI_IRQ] =
-                       intc_irq_lookup(sh7786_intc_desc.name, BRI1);
-               scif1_platform_data.irqs[SCIx_RXI_IRQ] =
+               scif1_demux_resources[2].start =
                        intc_irq_lookup(sh7786_intc_desc.name, RXI1);
+               scif1_demux_resources[3].start = irq;
+               scif1_demux_resources[4].start =
+                       intc_irq_lookup(sh7786_intc_desc.name, BRI1);
+
+               scif1_device.resource = scif1_demux_resources;
+               scif1_device.num_resources = ARRAY_SIZE(scif1_demux_resources);
        }
 
        ret = platform_add_devices(sh7786_early_devices,
index 688f7ed1bab1e1590b4a1674f26598d9d58becfe..0856bcbb1da0df740ca0ba33ea7f552abf47b7af 100644 (file)
  * all rather than adding infrastructure to hack around it.
  */
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = 0xffc30000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = { evt2irq(0x700),
-                           evt2irq(0x720),
-                           evt2irq(0x760),
-                           evt2irq(0x740) },
+};
+
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(0xffc30000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x700)),
+       DEFINE_RES_IRQ(evt2irq(0x720)),
+       DEFINE_RES_IRQ(evt2irq(0x760)),
+       DEFINE_RES_IRQ(evt2irq(0x740)),
 };
 
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
 };
 
 static struct plat_sci_port scif1_platform_data = {
-       .mapbase        = 0xffc40000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = { evt2irq(0x780),
-                           evt2irq(0x7a0),
-                           evt2irq(0x7e0),
-                           evt2irq(0x7c0) },
+};
+
+static struct resource scif1_resources[] = {
+       DEFINE_RES_MEM(0xffc40000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x780)),
+       DEFINE_RES_IRQ(evt2irq(0x7a0)),
+       DEFINE_RES_IRQ(evt2irq(0x7e0)),
+       DEFINE_RES_IRQ(evt2irq(0x7c0)),
 };
 
 static struct platform_device scif1_device = {
        .name           = "sh-sci",
        .id             = 1,
+       .resource       = scif1_resources,
+       .num_resources  = ARRAY_SIZE(scif1_resources),
        .dev            = {
                .platform_data  = &scif1_platform_data,
        },
 };
 
 static struct plat_sci_port scif2_platform_data = {
-       .mapbase        = 0xffc60000,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = { evt2irq(0x880),
-                           evt2irq(0x8a0),
-                           evt2irq(0x8e0),
-                           evt2irq(0x8c0) },
+};
+
+static struct resource scif2_resources[] = {
+       DEFINE_RES_MEM(0xffc60000, 0x100),
+       DEFINE_RES_IRQ(evt2irq(0x880)),
+       DEFINE_RES_IRQ(evt2irq(0x8a0)),
+       DEFINE_RES_IRQ(evt2irq(0x8e0)),
+       DEFINE_RES_IRQ(evt2irq(0x8c0)),
 };
 
 static struct platform_device scif2_device = {
        .name           = "sh-sci",
        .id             = 2,
+       .resource       = scif2_resources,
+       .num_resources  = ARRAY_SIZE(scif2_resources),
        .dev            = {
                .platform_data  = &scif2_platform_data,
        },
index 18419f1de9637550733cf55b58efdbf2c37004fa..14d68213d16bdf6412d41c8b91f2f819f1ecc58a 100644 (file)
 #include <asm/addrspace.h>
 
 static struct plat_sci_port scif0_platform_data = {
-       .mapbase        = PHYS_PERIPHERAL_BLOCK + 0x01030000,
        .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
        .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_REIE,
-       .scbrr_algo_id  = SCBRR_ALGO_2,
        .type           = PORT_SCIF,
-       .irqs           = { 39, 40, 42, 0 },
+};
+
+static struct resource scif0_resources[] = {
+       DEFINE_RES_MEM(PHYS_PERIPHERAL_BLOCK + 0x01030000, 0x100),
+       DEFINE_RES_IRQ(39),
+       DEFINE_RES_IRQ(40),
+       DEFINE_RES_IRQ(42),
 };
 
 static struct platform_device scif0_device = {
        .name           = "sh-sci",
        .id             = 0,
+       .resource       = scif0_resources,
+       .num_resources  = ARRAY_SIZE(scif0_resources),
        .dev            = {
                .platform_data  = &scif0_platform_data,
        },
index e0fc24db234ac1263c96fdc18d0bf4f553647198..6ba54d640383ce626e7eb3ee452b54d7f2af1358 100644 (file)
@@ -76,6 +76,7 @@ ifeq ($(avx2_supported),yes)
 endif
 
 aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o
+aesni-intel-$(CONFIG_64BIT) += aesni-intel_avx-x86_64.o
 ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o
 sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o
 crc32c-intel-y := crc32c-intel_glue.o
diff --git a/arch/x86/crypto/aesni-intel_avx-x86_64.S b/arch/x86/crypto/aesni-intel_avx-x86_64.S
new file mode 100644 (file)
index 0000000..522ab68
--- /dev/null
@@ -0,0 +1,2811 @@
+########################################################################
+# Copyright (c) 2013, Intel Corporation
+#
+# This software is available to you under a choice of one of two
+# licenses.  You may choose to be licensed under the terms of the GNU
+# General Public License (GPL) Version 2, available from the file
+# COPYING in the main directory of this source tree, or the
+# OpenIB.org BSD license below:
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the
+#   distribution.
+#
+# * Neither the name of the Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived from
+#   this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""AS IS"" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES# LOSS OF USE, DATA, OR
+# PROFITS# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+########################################################################
+##
+## Authors:
+##     Erdinc Ozturk <erdinc.ozturk@intel.com>
+##     Vinodh Gopal <vinodh.gopal@intel.com>
+##     James Guilford <james.guilford@intel.com>
+##     Tim Chen <tim.c.chen@linux.intel.com>
+##
+## References:
+##       This code was derived and highly optimized from the code described in paper:
+##               Vinodh Gopal et. al. Optimized Galois-Counter-Mode Implementation
+##                     on Intel Architecture Processors. August, 2010
+##       The details of the implementation is explained in:
+##               Erdinc Ozturk et. al. Enabling High-Performance Galois-Counter-Mode
+##                     on Intel Architecture Processors. October, 2012.
+##
+## Assumptions:
+##
+##
+##
+## iv:
+##       0                   1                   2                   3
+##       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##       |                             Salt  (From the SA)               |
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##       |                     Initialization Vector                     |
+##       |         (This is the sequence number from IPSec header)       |
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##       |                              0x1                              |
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##
+##
+##
+## AAD:
+##       AAD padded to 128 bits with 0
+##       for example, assume AAD is a u32 vector
+##
+##       if AAD is 8 bytes:
+##       AAD[3] = {A0, A1}#
+##       padded AAD in xmm register = {A1 A0 0 0}
+##
+##       0                   1                   2                   3
+##       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##       |                               SPI (A1)                        |
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##       |                     32-bit Sequence Number (A0)               |
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##       |                              0x0                              |
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##
+##                                       AAD Format with 32-bit Sequence Number
+##
+##       if AAD is 12 bytes:
+##       AAD[3] = {A0, A1, A2}#
+##       padded AAD in xmm register = {A2 A1 A0 0}
+##
+##       0                   1                   2                   3
+##       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##       |                               SPI (A2)                        |
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##       |                 64-bit Extended Sequence Number {A1,A0}       |
+##       |                                                               |
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##       |                              0x0                              |
+##       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+##
+##        AAD Format with 64-bit Extended Sequence Number
+##
+##
+## aadLen:
+##       from the definition of the spec, aadLen can only be 8 or 12 bytes.
+##      The code additionally supports aadLen of length 16 bytes.
+##
+## TLen:
+##       from the definition of the spec, TLen can only be 8, 12 or 16 bytes.
+##
+## poly = x^128 + x^127 + x^126 + x^121 + 1
+## throughout the code, one tab and two tab indentations are used. one tab is
+## for GHASH part, two tabs is for AES part.
+##
+
+#include <linux/linkage.h>
+#include <asm/inst.h>
+
+.data
+.align 16
+
+POLY:            .octa     0xC2000000000000000000000000000001
+POLY2:           .octa     0xC20000000000000000000001C2000000
+TWOONE:          .octa     0x00000001000000000000000000000001
+
+# order of these constants should not change.
+# more specifically, ALL_F should follow SHIFT_MASK, and ZERO should follow ALL_F
+
+SHUF_MASK:       .octa     0x000102030405060708090A0B0C0D0E0F
+SHIFT_MASK:      .octa     0x0f0e0d0c0b0a09080706050403020100
+ALL_F:           .octa     0xffffffffffffffffffffffffffffffff
+ZERO:            .octa     0x00000000000000000000000000000000
+ONE:             .octa     0x00000000000000000000000000000001
+ONEf:            .octa     0x01000000000000000000000000000000
+
+.text
+
+
+##define the fields of the gcm aes context
+#{
+#        u8 expanded_keys[16*11] store expanded keys
+#        u8 shifted_hkey_1[16]   store HashKey <<1 mod poly here
+#        u8 shifted_hkey_2[16]   store HashKey^2 <<1 mod poly here
+#        u8 shifted_hkey_3[16]   store HashKey^3 <<1 mod poly here
+#        u8 shifted_hkey_4[16]   store HashKey^4 <<1 mod poly here
+#        u8 shifted_hkey_5[16]   store HashKey^5 <<1 mod poly here
+#        u8 shifted_hkey_6[16]   store HashKey^6 <<1 mod poly here
+#        u8 shifted_hkey_7[16]   store HashKey^7 <<1 mod poly here
+#        u8 shifted_hkey_8[16]   store HashKey^8 <<1 mod poly here
+#        u8 shifted_hkey_1_k[16] store XOR HashKey <<1 mod poly here (for Karatsuba purposes)
+#        u8 shifted_hkey_2_k[16] store XOR HashKey^2 <<1 mod poly here (for Karatsuba purposes)
+#        u8 shifted_hkey_3_k[16] store XOR HashKey^3 <<1 mod poly here (for Karatsuba purposes)
+#        u8 shifted_hkey_4_k[16] store XOR HashKey^4 <<1 mod poly here (for Karatsuba purposes)
+#        u8 shifted_hkey_5_k[16] store XOR HashKey^5 <<1 mod poly here (for Karatsuba purposes)
+#        u8 shifted_hkey_6_k[16] store XOR HashKey^6 <<1 mod poly here (for Karatsuba purposes)
+#        u8 shifted_hkey_7_k[16] store XOR HashKey^7 <<1 mod poly here (for Karatsuba purposes)
+#        u8 shifted_hkey_8_k[16] store XOR HashKey^8 <<1 mod poly here (for Karatsuba purposes)
+#} gcm_ctx#
+
+HashKey        = 16*11   # store HashKey <<1 mod poly here
+HashKey_2      = 16*12   # store HashKey^2 <<1 mod poly here
+HashKey_3      = 16*13   # store HashKey^3 <<1 mod poly here
+HashKey_4      = 16*14   # store HashKey^4 <<1 mod poly here
+HashKey_5      = 16*15   # store HashKey^5 <<1 mod poly here
+HashKey_6      = 16*16   # store HashKey^6 <<1 mod poly here
+HashKey_7      = 16*17   # store HashKey^7 <<1 mod poly here
+HashKey_8      = 16*18   # store HashKey^8 <<1 mod poly here
+HashKey_k      = 16*19   # store XOR of HashKey <<1 mod poly here (for Karatsuba purposes)
+HashKey_2_k    = 16*20   # store XOR of HashKey^2 <<1 mod poly here (for Karatsuba purposes)
+HashKey_3_k    = 16*21   # store XOR of HashKey^3 <<1 mod poly here (for Karatsuba purposes)
+HashKey_4_k    = 16*22   # store XOR of HashKey^4 <<1 mod poly here (for Karatsuba purposes)
+HashKey_5_k    = 16*23   # store XOR of HashKey^5 <<1 mod poly here (for Karatsuba purposes)
+HashKey_6_k    = 16*24   # store XOR of HashKey^6 <<1 mod poly here (for Karatsuba purposes)
+HashKey_7_k    = 16*25   # store XOR of HashKey^7 <<1 mod poly here (for Karatsuba purposes)
+HashKey_8_k    = 16*26   # store XOR of HashKey^8 <<1 mod poly here (for Karatsuba purposes)
+
+#define arg1 %rdi
+#define arg2 %rsi
+#define arg3 %rdx
+#define arg4 %rcx
+#define arg5 %r8
+#define arg6 %r9
+#define arg7 STACK_OFFSET+8*1(%r14)
+#define arg8 STACK_OFFSET+8*2(%r14)
+#define arg9 STACK_OFFSET+8*3(%r14)
+
+i = 0
+j = 0
+
+out_order = 0
+in_order = 1
+DEC = 0
+ENC = 1
+
+.macro define_reg r n
+reg_\r = %xmm\n
+.endm
+
+.macro setreg
+.altmacro
+define_reg i %i
+define_reg j %j
+.noaltmacro
+.endm
+
+# need to push 4 registers into stack to maintain
+STACK_OFFSET = 8*4
+
+TMP1 =   16*0    # Temporary storage for AAD
+TMP2 =   16*1    # Temporary storage for AES State 2 (State 1 is stored in an XMM register)
+TMP3 =   16*2    # Temporary storage for AES State 3
+TMP4 =   16*3    # Temporary storage for AES State 4
+TMP5 =   16*4    # Temporary storage for AES State 5
+TMP6 =   16*5    # Temporary storage for AES State 6
+TMP7 =   16*6    # Temporary storage for AES State 7
+TMP8 =   16*7    # Temporary storage for AES State 8
+
+VARIABLE_OFFSET = 16*8
+
+################################
+# Utility Macros
+################################
+
+# Encryption of a single block
+.macro ENCRYPT_SINGLE_BLOCK XMM0
+                vpxor    (arg1), \XMM0, \XMM0
+               i = 1
+               setreg
+.rep 9
+                vaesenc  16*i(arg1), \XMM0, \XMM0
+               i = (i+1)
+               setreg
+.endr
+                vaesenclast 16*10(arg1), \XMM0, \XMM0
+.endm
+
+#ifdef CONFIG_AS_AVX
+###############################################################################
+# GHASH_MUL MACRO to implement: Data*HashKey mod (128,127,126,121,0)
+# Input: A and B (128-bits each, bit-reflected)
+# Output: C = A*B*x mod poly, (i.e. >>1 )
+# To compute GH = GH*HashKey mod poly, give HK = HashKey<<1 mod poly as input
+# GH = GH * HK * x mod poly which is equivalent to GH*HashKey mod poly.
+###############################################################################
+.macro  GHASH_MUL_AVX GH HK T1 T2 T3 T4 T5
+
+        vpshufd         $0b01001110, \GH, \T2
+        vpshufd         $0b01001110, \HK, \T3
+        vpxor           \GH     , \T2, \T2      # T2 = (a1+a0)
+        vpxor           \HK     , \T3, \T3      # T3 = (b1+b0)
+
+        vpclmulqdq      $0x11, \HK, \GH, \T1    # T1 = a1*b1
+        vpclmulqdq      $0x00, \HK, \GH, \GH    # GH = a0*b0
+        vpclmulqdq      $0x00, \T3, \T2, \T2    # T2 = (a1+a0)*(b1+b0)
+        vpxor           \GH, \T2,\T2
+        vpxor           \T1, \T2,\T2            # T2 = a0*b1+a1*b0
+
+        vpslldq         $8, \T2,\T3             # shift-L T3 2 DWs
+        vpsrldq         $8, \T2,\T2             # shift-R T2 2 DWs
+        vpxor           \T3, \GH, \GH
+        vpxor           \T2, \T1, \T1           # <T1:GH> = GH x HK
+
+        #first phase of the reduction
+        vpslld  $31, \GH, \T2                   # packed right shifting << 31
+        vpslld  $30, \GH, \T3                   # packed right shifting shift << 30
+        vpslld  $25, \GH, \T4                   # packed right shifting shift << 25
+
+        vpxor   \T3, \T2, \T2                   # xor the shifted versions
+        vpxor   \T4, \T2, \T2
+
+        vpsrldq $4, \T2, \T5                    # shift-R T5 1 DW
+
+        vpslldq $12, \T2, \T2                   # shift-L T2 3 DWs
+        vpxor   \T2, \GH, \GH                   # first phase of the reduction complete
+
+        #second phase of the reduction
+
+        vpsrld  $1,\GH, \T2                     # packed left shifting >> 1
+        vpsrld  $2,\GH, \T3                     # packed left shifting >> 2
+        vpsrld  $7,\GH, \T4                     # packed left shifting >> 7
+        vpxor   \T3, \T2, \T2                   # xor the shifted versions
+        vpxor   \T4, \T2, \T2
+
+        vpxor   \T5, \T2, \T2
+        vpxor   \T2, \GH, \GH
+        vpxor   \T1, \GH, \GH                   # the result is in GH
+
+
+.endm
+
+.macro PRECOMPUTE_AVX HK T1 T2 T3 T4 T5 T6
+
+        # Haskey_i_k holds XORed values of the low and high parts of the Haskey_i
+        vmovdqa  \HK, \T5
+
+        vpshufd  $0b01001110, \T5, \T1
+        vpxor    \T5, \T1, \T1
+        vmovdqa  \T1, HashKey_k(arg1)
+
+        GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2  #  T5 = HashKey^2<<1 mod poly
+        vmovdqa  \T5, HashKey_2(arg1)                    #  [HashKey_2] = HashKey^2<<1 mod poly
+        vpshufd  $0b01001110, \T5, \T1
+        vpxor    \T5, \T1, \T1
+        vmovdqa  \T1, HashKey_2_k(arg1)
+
+        GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2  #  T5 = HashKey^3<<1 mod poly
+        vmovdqa  \T5, HashKey_3(arg1)
+        vpshufd  $0b01001110, \T5, \T1
+        vpxor    \T5, \T1, \T1
+        vmovdqa  \T1, HashKey_3_k(arg1)
+
+        GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2  #  T5 = HashKey^4<<1 mod poly
+        vmovdqa  \T5, HashKey_4(arg1)
+        vpshufd  $0b01001110, \T5, \T1
+        vpxor    \T5, \T1, \T1
+        vmovdqa  \T1, HashKey_4_k(arg1)
+
+        GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2  #  T5 = HashKey^5<<1 mod poly
+        vmovdqa  \T5, HashKey_5(arg1)
+        vpshufd  $0b01001110, \T5, \T1
+        vpxor    \T5, \T1, \T1
+        vmovdqa  \T1, HashKey_5_k(arg1)
+
+        GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2  #  T5 = HashKey^6<<1 mod poly
+        vmovdqa  \T5, HashKey_6(arg1)
+        vpshufd  $0b01001110, \T5, \T1
+        vpxor    \T5, \T1, \T1
+        vmovdqa  \T1, HashKey_6_k(arg1)
+
+        GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2  #  T5 = HashKey^7<<1 mod poly
+        vmovdqa  \T5, HashKey_7(arg1)
+        vpshufd  $0b01001110, \T5, \T1
+        vpxor    \T5, \T1, \T1
+        vmovdqa  \T1, HashKey_7_k(arg1)
+
+        GHASH_MUL_AVX \T5, \HK, \T1, \T3, \T4, \T6, \T2  #  T5 = HashKey^8<<1 mod poly
+        vmovdqa  \T5, HashKey_8(arg1)
+        vpshufd  $0b01001110, \T5, \T1
+        vpxor    \T5, \T1, \T1
+        vmovdqa  \T1, HashKey_8_k(arg1)
+
+.endm
+
+## if a = number of total plaintext bytes
+## b = floor(a/16)
+## num_initial_blocks = b mod 4#
+## encrypt the initial num_initial_blocks blocks and apply ghash on the ciphertext
+## r10, r11, r12, rax are clobbered
+## arg1, arg2, arg3, r14 are used as a pointer only, not modified
+
+.macro INITIAL_BLOCKS_AVX num_initial_blocks T1 T2 T3 T4 T5 CTR XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 T6 T_key ENC_DEC
+       i = (8-\num_initial_blocks)
+       setreg
+
+        mov     arg6, %r10                      # r10 = AAD
+        mov     arg7, %r12                      # r12 = aadLen
+
+
+        mov     %r12, %r11
+
+        vpxor   reg_i, reg_i, reg_i
+_get_AAD_loop\@:
+        vmovd   (%r10), \T1
+        vpslldq $12, \T1, \T1
+        vpsrldq $4, reg_i, reg_i
+        vpxor   \T1, reg_i, reg_i
+
+        add     $4, %r10
+        sub     $4, %r12
+        jg      _get_AAD_loop\@
+
+
+        cmp     $16, %r11
+        je      _get_AAD_loop2_done\@
+        mov     $16, %r12
+
+_get_AAD_loop2\@:
+        vpsrldq $4, reg_i, reg_i
+        sub     $4, %r12
+        cmp     %r11, %r12
+        jg      _get_AAD_loop2\@
+
+_get_AAD_loop2_done\@:
+
+        #byte-reflect the AAD data
+        vpshufb SHUF_MASK(%rip), reg_i, reg_i
+
+       # initialize the data pointer offset as zero
+       xor     %r11, %r11
+
+       # start AES for num_initial_blocks blocks
+       mov     arg5, %rax                     # rax = *Y0
+       vmovdqu (%rax), \CTR                   # CTR = Y0
+       vpshufb SHUF_MASK(%rip), \CTR, \CTR
+
+
+       i = (9-\num_initial_blocks)
+       setreg
+.rep \num_initial_blocks
+                vpaddd  ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa \CTR, reg_i
+                vpshufb SHUF_MASK(%rip), reg_i, reg_i   # perform a 16Byte swap
+       i = (i+1)
+       setreg
+.endr
+
+       vmovdqa  (arg1), \T_key
+       i = (9-\num_initial_blocks)
+       setreg
+.rep \num_initial_blocks
+                vpxor   \T_key, reg_i, reg_i
+       i = (i+1)
+       setreg
+.endr
+
+       j = 1
+       setreg
+.rep 9
+       vmovdqa  16*j(arg1), \T_key
+       i = (9-\num_initial_blocks)
+       setreg
+.rep \num_initial_blocks
+        vaesenc \T_key, reg_i, reg_i
+       i = (i+1)
+       setreg
+.endr
+
+       j = (j+1)
+       setreg
+.endr
+
+
+       vmovdqa  16*10(arg1), \T_key
+       i = (9-\num_initial_blocks)
+       setreg
+.rep \num_initial_blocks
+        vaesenclast      \T_key, reg_i, reg_i
+       i = (i+1)
+       setreg
+.endr
+
+       i = (9-\num_initial_blocks)
+       setreg
+.rep \num_initial_blocks
+                vmovdqu (arg3, %r11), \T1
+                vpxor   \T1, reg_i, reg_i
+                vmovdqu reg_i, (arg2 , %r11)           # write back ciphertext for num_initial_blocks blocks
+                add     $16, %r11
+.if  \ENC_DEC == DEC
+                vmovdqa \T1, reg_i
+.endif
+                vpshufb SHUF_MASK(%rip), reg_i, reg_i  # prepare ciphertext for GHASH computations
+       i = (i+1)
+       setreg
+.endr
+
+
+       i = (8-\num_initial_blocks)
+       j = (9-\num_initial_blocks)
+       setreg
+        GHASH_MUL_AVX       reg_i, \T2, \T1, \T3, \T4, \T5, \T6
+
+.rep \num_initial_blocks
+        vpxor    reg_i, reg_j, reg_j
+        GHASH_MUL_AVX       reg_j, \T2, \T1, \T3, \T4, \T5, \T6 # apply GHASH on num_initial_blocks blocks
+       i = (i+1)
+       j = (j+1)
+       setreg
+.endr
+        # XMM8 has the combined result here
+
+        vmovdqa  \XMM8, TMP1(%rsp)
+        vmovdqa  \XMM8, \T3
+
+        cmp     $128, %r13
+        jl      _initial_blocks_done\@                  # no need for precomputed constants
+
+###############################################################################
+# Haskey_i_k holds XORed values of the low and high parts of the Haskey_i
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM1
+                vpshufb  SHUF_MASK(%rip), \XMM1, \XMM1  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM2
+                vpshufb  SHUF_MASK(%rip), \XMM2, \XMM2  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM3
+                vpshufb  SHUF_MASK(%rip), \XMM3, \XMM3  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM4
+                vpshufb  SHUF_MASK(%rip), \XMM4, \XMM4  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM5
+                vpshufb  SHUF_MASK(%rip), \XMM5, \XMM5  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM6
+                vpshufb  SHUF_MASK(%rip), \XMM6, \XMM6  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM7
+                vpshufb  SHUF_MASK(%rip), \XMM7, \XMM7  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM8
+                vpshufb  SHUF_MASK(%rip), \XMM8, \XMM8  # perform a 16Byte swap
+
+                vmovdqa  (arg1), \T_key
+                vpxor    \T_key, \XMM1, \XMM1
+                vpxor    \T_key, \XMM2, \XMM2
+                vpxor    \T_key, \XMM3, \XMM3
+                vpxor    \T_key, \XMM4, \XMM4
+                vpxor    \T_key, \XMM5, \XMM5
+                vpxor    \T_key, \XMM6, \XMM6
+                vpxor    \T_key, \XMM7, \XMM7
+                vpxor    \T_key, \XMM8, \XMM8
+
+               i = 1
+               setreg
+.rep    9       # do 9 rounds
+                vmovdqa  16*i(arg1), \T_key
+                vaesenc  \T_key, \XMM1, \XMM1
+                vaesenc  \T_key, \XMM2, \XMM2
+                vaesenc  \T_key, \XMM3, \XMM3
+                vaesenc  \T_key, \XMM4, \XMM4
+                vaesenc  \T_key, \XMM5, \XMM5
+                vaesenc  \T_key, \XMM6, \XMM6
+                vaesenc  \T_key, \XMM7, \XMM7
+                vaesenc  \T_key, \XMM8, \XMM8
+               i = (i+1)
+               setreg
+.endr
+
+
+                vmovdqa  16*i(arg1), \T_key
+                vaesenclast  \T_key, \XMM1, \XMM1
+                vaesenclast  \T_key, \XMM2, \XMM2
+                vaesenclast  \T_key, \XMM3, \XMM3
+                vaesenclast  \T_key, \XMM4, \XMM4
+                vaesenclast  \T_key, \XMM5, \XMM5
+                vaesenclast  \T_key, \XMM6, \XMM6
+                vaesenclast  \T_key, \XMM7, \XMM7
+                vaesenclast  \T_key, \XMM8, \XMM8
+
+                vmovdqu  (arg3, %r11), \T1
+                vpxor    \T1, \XMM1, \XMM1
+                vmovdqu  \XMM1, (arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM1
+                .endif
+
+                vmovdqu  16*1(arg3, %r11), \T1
+                vpxor    \T1, \XMM2, \XMM2
+                vmovdqu  \XMM2, 16*1(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM2
+                .endif
+
+                vmovdqu  16*2(arg3, %r11), \T1
+                vpxor    \T1, \XMM3, \XMM3
+                vmovdqu  \XMM3, 16*2(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM3
+                .endif
+
+                vmovdqu  16*3(arg3, %r11), \T1
+                vpxor    \T1, \XMM4, \XMM4
+                vmovdqu  \XMM4, 16*3(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM4
+                .endif
+
+                vmovdqu  16*4(arg3, %r11), \T1
+                vpxor    \T1, \XMM5, \XMM5
+                vmovdqu  \XMM5, 16*4(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM5
+                .endif
+
+                vmovdqu  16*5(arg3, %r11), \T1
+                vpxor    \T1, \XMM6, \XMM6
+                vmovdqu  \XMM6, 16*5(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM6
+                .endif
+
+                vmovdqu  16*6(arg3, %r11), \T1
+                vpxor    \T1, \XMM7, \XMM7
+                vmovdqu  \XMM7, 16*6(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM7
+                .endif
+
+                vmovdqu  16*7(arg3, %r11), \T1
+                vpxor    \T1, \XMM8, \XMM8
+                vmovdqu  \XMM8, 16*7(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM8
+                .endif
+
+                add     $128, %r11
+
+                vpshufb  SHUF_MASK(%rip), \XMM1, \XMM1     # perform a 16Byte swap
+                vpxor    TMP1(%rsp), \XMM1, \XMM1          # combine GHASHed value with the corresponding ciphertext
+                vpshufb  SHUF_MASK(%rip), \XMM2, \XMM2     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM3, \XMM3     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM4, \XMM4     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM5, \XMM5     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM6, \XMM6     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM7, \XMM7     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM8, \XMM8     # perform a 16Byte swap
+
+###############################################################################
+
+_initial_blocks_done\@:
+
+.endm
+
+# encrypt 8 blocks at a time
+# ghash the 8 previously encrypted ciphertext blocks
+# arg1, arg2, arg3 are used as pointers only, not modified
+# r11 is the data offset value
+.macro GHASH_8_ENCRYPT_8_PARALLEL_AVX T1 T2 T3 T4 T5 T6 CTR XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 T7 loop_idx ENC_DEC
+
+        vmovdqa \XMM1, \T2
+        vmovdqa \XMM2, TMP2(%rsp)
+        vmovdqa \XMM3, TMP3(%rsp)
+        vmovdqa \XMM4, TMP4(%rsp)
+        vmovdqa \XMM5, TMP5(%rsp)
+        vmovdqa \XMM6, TMP6(%rsp)
+        vmovdqa \XMM7, TMP7(%rsp)
+        vmovdqa \XMM8, TMP8(%rsp)
+
+.if \loop_idx == in_order
+                vpaddd  ONE(%rip), \CTR, \XMM1           # INCR CNT
+                vpaddd  ONE(%rip), \XMM1, \XMM2
+                vpaddd  ONE(%rip), \XMM2, \XMM3
+                vpaddd  ONE(%rip), \XMM3, \XMM4
+                vpaddd  ONE(%rip), \XMM4, \XMM5
+                vpaddd  ONE(%rip), \XMM5, \XMM6
+                vpaddd  ONE(%rip), \XMM6, \XMM7
+                vpaddd  ONE(%rip), \XMM7, \XMM8
+                vmovdqa \XMM8, \CTR
+
+                vpshufb SHUF_MASK(%rip), \XMM1, \XMM1    # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM2, \XMM2    # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM3, \XMM3    # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM4, \XMM4    # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM5, \XMM5    # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM6, \XMM6    # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM7, \XMM7    # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM8, \XMM8    # perform a 16Byte swap
+.else
+                vpaddd  ONEf(%rip), \CTR, \XMM1           # INCR CNT
+                vpaddd  ONEf(%rip), \XMM1, \XMM2
+                vpaddd  ONEf(%rip), \XMM2, \XMM3
+                vpaddd  ONEf(%rip), \XMM3, \XMM4
+                vpaddd  ONEf(%rip), \XMM4, \XMM5
+                vpaddd  ONEf(%rip), \XMM5, \XMM6
+                vpaddd  ONEf(%rip), \XMM6, \XMM7
+                vpaddd  ONEf(%rip), \XMM7, \XMM8
+                vmovdqa \XMM8, \CTR
+.endif
+
+
+        #######################################################################
+
+                vmovdqu (arg1), \T1
+                vpxor   \T1, \XMM1, \XMM1
+                vpxor   \T1, \XMM2, \XMM2
+                vpxor   \T1, \XMM3, \XMM3
+                vpxor   \T1, \XMM4, \XMM4
+                vpxor   \T1, \XMM5, \XMM5
+                vpxor   \T1, \XMM6, \XMM6
+                vpxor   \T1, \XMM7, \XMM7
+                vpxor   \T1, \XMM8, \XMM8
+
+        #######################################################################
+
+
+
+
+
+                vmovdqu 16*1(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+                vmovdqu 16*2(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+
+        #######################################################################
+
+        vmovdqa         HashKey_8(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T2, \T4             # T4 = a1*b1
+        vpclmulqdq      $0x00, \T5, \T2, \T7             # T7 = a0*b0
+
+        vpshufd         $0b01001110, \T2, \T6
+        vpxor           \T2, \T6, \T6
+
+        vmovdqa         HashKey_8_k(arg1), \T5
+        vpclmulqdq      $0x00, \T5, \T6, \T6
+
+                vmovdqu 16*3(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+        vmovdqa         TMP2(%rsp), \T1
+        vmovdqa         HashKey_7(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpshufd         $0b01001110, \T1, \T3
+        vpxor           \T1, \T3, \T3
+        vmovdqa         HashKey_7_k(arg1), \T5
+        vpclmulqdq      $0x10, \T5, \T3, \T3
+        vpxor           \T3, \T6, \T6
+
+                vmovdqu 16*4(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+        #######################################################################
+
+        vmovdqa         TMP3(%rsp), \T1
+        vmovdqa         HashKey_6(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpshufd         $0b01001110, \T1, \T3
+        vpxor           \T1, \T3, \T3
+        vmovdqa         HashKey_6_k(arg1), \T5
+        vpclmulqdq      $0x10, \T5, \T3, \T3
+        vpxor           \T3, \T6, \T6
+
+                vmovdqu 16*5(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+        vmovdqa         TMP4(%rsp), \T1
+        vmovdqa         HashKey_5(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpshufd         $0b01001110, \T1, \T3
+        vpxor           \T1, \T3, \T3
+        vmovdqa         HashKey_5_k(arg1), \T5
+        vpclmulqdq      $0x10, \T5, \T3, \T3
+        vpxor           \T3, \T6, \T6
+
+                vmovdqu 16*6(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+
+        vmovdqa         TMP5(%rsp), \T1
+        vmovdqa         HashKey_4(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpshufd         $0b01001110, \T1, \T3
+        vpxor           \T1, \T3, \T3
+        vmovdqa         HashKey_4_k(arg1), \T5
+        vpclmulqdq      $0x10, \T5, \T3, \T3
+        vpxor           \T3, \T6, \T6
+
+                vmovdqu 16*7(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+        vmovdqa         TMP6(%rsp), \T1
+        vmovdqa         HashKey_3(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpshufd         $0b01001110, \T1, \T3
+        vpxor           \T1, \T3, \T3
+        vmovdqa         HashKey_3_k(arg1), \T5
+        vpclmulqdq      $0x10, \T5, \T3, \T3
+        vpxor           \T3, \T6, \T6
+
+
+                vmovdqu 16*8(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+        vmovdqa         TMP7(%rsp), \T1
+        vmovdqa         HashKey_2(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpshufd         $0b01001110, \T1, \T3
+        vpxor           \T1, \T3, \T3
+        vmovdqa         HashKey_2_k(arg1), \T5
+        vpclmulqdq      $0x10, \T5, \T3, \T3
+        vpxor           \T3, \T6, \T6
+
+        #######################################################################
+
+                vmovdqu 16*9(arg1), \T5
+                vaesenc \T5, \XMM1, \XMM1
+                vaesenc \T5, \XMM2, \XMM2
+                vaesenc \T5, \XMM3, \XMM3
+                vaesenc \T5, \XMM4, \XMM4
+                vaesenc \T5, \XMM5, \XMM5
+                vaesenc \T5, \XMM6, \XMM6
+                vaesenc \T5, \XMM7, \XMM7
+                vaesenc \T5, \XMM8, \XMM8
+
+        vmovdqa         TMP8(%rsp), \T1
+        vmovdqa         HashKey(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpshufd         $0b01001110, \T1, \T3
+        vpxor           \T1, \T3, \T3
+        vmovdqa         HashKey_k(arg1), \T5
+        vpclmulqdq      $0x10, \T5, \T3, \T3
+        vpxor           \T3, \T6, \T6
+
+        vpxor           \T4, \T6, \T6
+        vpxor           \T7, \T6, \T6
+
+                vmovdqu 16*10(arg1), \T5
+
+       i = 0
+       j = 1
+       setreg
+.rep 8
+               vpxor   16*i(arg3, %r11), \T5, \T2
+                .if \ENC_DEC == ENC
+                vaesenclast     \T2, reg_j, reg_j
+                .else
+                vaesenclast     \T2, reg_j, \T3
+                vmovdqu 16*i(arg3, %r11), reg_j
+                vmovdqu \T3, 16*i(arg2, %r11)
+                .endif
+       i = (i+1)
+       j = (j+1)
+       setreg
+.endr
+       #######################################################################
+
+
+       vpslldq $8, \T6, \T3                            # shift-L T3 2 DWs
+       vpsrldq $8, \T6, \T6                            # shift-R T2 2 DWs
+       vpxor   \T3, \T7, \T7
+       vpxor   \T4, \T6, \T6                           # accumulate the results in T6:T7
+
+
+
+       #######################################################################
+       #first phase of the reduction
+       #######################################################################
+        vpslld  $31, \T7, \T2                           # packed right shifting << 31
+        vpslld  $30, \T7, \T3                           # packed right shifting shift << 30
+        vpslld  $25, \T7, \T4                           # packed right shifting shift << 25
+
+        vpxor   \T3, \T2, \T2                           # xor the shifted versions
+        vpxor   \T4, \T2, \T2
+
+        vpsrldq $4, \T2, \T1                            # shift-R T1 1 DW
+
+        vpslldq $12, \T2, \T2                           # shift-L T2 3 DWs
+        vpxor   \T2, \T7, \T7                           # first phase of the reduction complete
+       #######################################################################
+                .if \ENC_DEC == ENC
+               vmovdqu  \XMM1, 16*0(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM2, 16*1(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM3, 16*2(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM4, 16*3(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM5, 16*4(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM6, 16*5(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM7, 16*6(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM8, 16*7(arg2,%r11)         # Write to the Ciphertext buffer
+                .endif
+
+       #######################################################################
+       #second phase of the reduction
+        vpsrld  $1, \T7, \T2                            # packed left shifting >> 1
+        vpsrld  $2, \T7, \T3                            # packed left shifting >> 2
+        vpsrld  $7, \T7, \T4                            # packed left shifting >> 7
+        vpxor   \T3, \T2, \T2                           # xor the shifted versions
+        vpxor   \T4, \T2, \T2
+
+        vpxor   \T1, \T2, \T2
+        vpxor   \T2, \T7, \T7
+        vpxor   \T7, \T6, \T6                           # the result is in T6
+       #######################################################################
+
+               vpshufb SHUF_MASK(%rip), \XMM1, \XMM1   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM2, \XMM2   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM3, \XMM3   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM4, \XMM4   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM5, \XMM5   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM6, \XMM6   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM7, \XMM7   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM8, \XMM8   # perform a 16Byte swap
+
+
+       vpxor   \T6, \XMM1, \XMM1
+
+
+
+.endm
+
+
+# GHASH the last 4 ciphertext blocks.
+.macro  GHASH_LAST_8_AVX T1 T2 T3 T4 T5 T6 T7 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8
+
+        ## Karatsuba Method
+
+
+        vpshufd         $0b01001110, \XMM1, \T2
+        vpxor           \XMM1, \T2, \T2
+        vmovdqa         HashKey_8(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \XMM1, \T6
+        vpclmulqdq      $0x00, \T5, \XMM1, \T7
+
+        vmovdqa         HashKey_8_k(arg1), \T3
+        vpclmulqdq      $0x00, \T3, \T2, \XMM1
+
+        ######################
+
+        vpshufd         $0b01001110, \XMM2, \T2
+        vpxor           \XMM2, \T2, \T2
+        vmovdqa         HashKey_7(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \XMM2, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM2, \T4
+        vpxor           \T4, \T7, \T7
+
+        vmovdqa         HashKey_7_k(arg1), \T3
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vpshufd         $0b01001110, \XMM3, \T2
+        vpxor           \XMM3, \T2, \T2
+        vmovdqa         HashKey_6(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \XMM3, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM3, \T4
+        vpxor           \T4, \T7, \T7
+
+        vmovdqa         HashKey_6_k(arg1), \T3
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vpshufd         $0b01001110, \XMM4, \T2
+        vpxor           \XMM4, \T2, \T2
+        vmovdqa         HashKey_5(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \XMM4, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM4, \T4
+        vpxor           \T4, \T7, \T7
+
+        vmovdqa         HashKey_5_k(arg1), \T3
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vpshufd         $0b01001110, \XMM5, \T2
+        vpxor           \XMM5, \T2, \T2
+        vmovdqa         HashKey_4(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \XMM5, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM5, \T4
+        vpxor           \T4, \T7, \T7
+
+        vmovdqa         HashKey_4_k(arg1), \T3
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vpshufd         $0b01001110, \XMM6, \T2
+        vpxor           \XMM6, \T2, \T2
+        vmovdqa         HashKey_3(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \XMM6, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM6, \T4
+        vpxor           \T4, \T7, \T7
+
+        vmovdqa         HashKey_3_k(arg1), \T3
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vpshufd         $0b01001110, \XMM7, \T2
+        vpxor           \XMM7, \T2, \T2
+        vmovdqa         HashKey_2(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \XMM7, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM7, \T4
+        vpxor           \T4, \T7, \T7
+
+        vmovdqa         HashKey_2_k(arg1), \T3
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vpshufd         $0b01001110, \XMM8, \T2
+        vpxor           \XMM8, \T2, \T2
+        vmovdqa         HashKey(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \XMM8, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM8, \T4
+        vpxor           \T4, \T7, \T7
+
+        vmovdqa         HashKey_k(arg1), \T3
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+
+        vpxor           \T2, \XMM1, \XMM1
+        vpxor           \T6, \XMM1, \XMM1
+        vpxor           \T7, \XMM1, \T2
+
+
+
+
+        vpslldq $8, \T2, \T4
+        vpsrldq $8, \T2, \T2
+
+        vpxor   \T4, \T7, \T7
+        vpxor   \T2, \T6, \T6   # <T6:T7> holds the result of
+                               # the accumulated carry-less multiplications
+
+        #######################################################################
+        #first phase of the reduction
+        vpslld  $31, \T7, \T2   # packed right shifting << 31
+        vpslld  $30, \T7, \T3   # packed right shifting shift << 30
+        vpslld  $25, \T7, \T4   # packed right shifting shift << 25
+
+        vpxor   \T3, \T2, \T2   # xor the shifted versions
+        vpxor   \T4, \T2, \T2
+
+        vpsrldq $4, \T2, \T1    # shift-R T1 1 DW
+
+        vpslldq $12, \T2, \T2   # shift-L T2 3 DWs
+        vpxor   \T2, \T7, \T7   # first phase of the reduction complete
+        #######################################################################
+
+
+        #second phase of the reduction
+        vpsrld  $1, \T7, \T2    # packed left shifting >> 1
+        vpsrld  $2, \T7, \T3    # packed left shifting >> 2
+        vpsrld  $7, \T7, \T4    # packed left shifting >> 7
+        vpxor   \T3, \T2, \T2   # xor the shifted versions
+        vpxor   \T4, \T2, \T2
+
+        vpxor   \T1, \T2, \T2
+        vpxor   \T2, \T7, \T7
+        vpxor   \T7, \T6, \T6   # the result is in T6
+
+.endm
+
+
+# combined for GCM encrypt and decrypt functions
+# clobbering all xmm registers
+# clobbering r10, r11, r12, r13, r14, r15
+.macro  GCM_ENC_DEC_AVX     ENC_DEC
+
+        #the number of pushes must equal STACK_OFFSET
+        push    %r12
+        push    %r13
+        push    %r14
+        push    %r15
+
+        mov     %rsp, %r14
+
+
+
+
+        sub     $VARIABLE_OFFSET, %rsp
+        and     $~63, %rsp                  # align rsp to 64 bytes
+
+
+        vmovdqu  HashKey(arg1), %xmm13      # xmm13 = HashKey
+
+        mov     arg4, %r13                  # save the number of bytes of plaintext/ciphertext
+        and     $-16, %r13                  # r13 = r13 - (r13 mod 16)
+
+        mov     %r13, %r12
+        shr     $4, %r12
+        and     $7, %r12
+        jz      _initial_num_blocks_is_0\@
+
+        cmp     $7, %r12
+        je      _initial_num_blocks_is_7\@
+        cmp     $6, %r12
+        je      _initial_num_blocks_is_6\@
+        cmp     $5, %r12
+        je      _initial_num_blocks_is_5\@
+        cmp     $4, %r12
+        je      _initial_num_blocks_is_4\@
+        cmp     $3, %r12
+        je      _initial_num_blocks_is_3\@
+        cmp     $2, %r12
+        je      _initial_num_blocks_is_2\@
+
+        jmp     _initial_num_blocks_is_1\@
+
+_initial_num_blocks_is_7\@:
+        INITIAL_BLOCKS_AVX  7, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*7, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_6\@:
+        INITIAL_BLOCKS_AVX  6, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*6, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_5\@:
+        INITIAL_BLOCKS_AVX  5, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*5, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_4\@:
+        INITIAL_BLOCKS_AVX  4, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*4, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_3\@:
+        INITIAL_BLOCKS_AVX  3, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*3, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_2\@:
+        INITIAL_BLOCKS_AVX  2, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*2, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_1\@:
+        INITIAL_BLOCKS_AVX  1, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*1, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_0\@:
+        INITIAL_BLOCKS_AVX  0, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+
+
+_initial_blocks_encrypted\@:
+        cmp     $0, %r13
+        je      _zero_cipher_left\@
+
+        sub     $128, %r13
+        je      _eight_cipher_left\@
+
+
+
+
+        vmovd   %xmm9, %r15d
+        and     $255, %r15d
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+
+
+_encrypt_by_8_new\@:
+        cmp     $(255-8), %r15d
+        jg      _encrypt_by_8\@
+
+
+
+        add     $8, %r15b
+        GHASH_8_ENCRYPT_8_PARALLEL_AVX      %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm15, out_order, \ENC_DEC
+        add     $128, %r11
+        sub     $128, %r13
+        jne     _encrypt_by_8_new\@
+
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        jmp     _eight_cipher_left\@
+
+_encrypt_by_8\@:
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        add     $8, %r15b
+        GHASH_8_ENCRYPT_8_PARALLEL_AVX      %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm15, in_order, \ENC_DEC
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        add     $128, %r11
+        sub     $128, %r13
+        jne     _encrypt_by_8_new\@
+
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+
+
+
+
+_eight_cipher_left\@:
+        GHASH_LAST_8_AVX    %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm15, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8
+
+
+_zero_cipher_left\@:
+        cmp     $16, arg4
+        jl      _only_less_than_16\@
+
+        mov     arg4, %r13
+        and     $15, %r13                            # r13 = (arg4 mod 16)
+
+        je      _multiple_of_16_bytes\@
+
+        # handle the last <16 Byte block seperately
+
+
+        vpaddd   ONE(%rip), %xmm9, %xmm9             # INCR CNT to get Yn
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        ENCRYPT_SINGLE_BLOCK    %xmm9                # E(K, Yn)
+
+        sub     $16, %r11
+        add     %r13, %r11
+        vmovdqu (arg3, %r11), %xmm1                  # receive the last <16 Byte block
+
+        lea     SHIFT_MASK+16(%rip), %r12
+        sub     %r13, %r12                           # adjust the shuffle mask pointer to be
+                                                    # able to shift 16-r13 bytes (r13 is the
+                                                    # number of bytes in plaintext mod 16)
+        vmovdqu (%r12), %xmm2                        # get the appropriate shuffle mask
+        vpshufb %xmm2, %xmm1, %xmm1                  # shift right 16-r13 bytes
+        jmp     _final_ghash_mul\@
+
+_only_less_than_16\@:
+        # check for 0 length
+        mov     arg4, %r13
+        and     $15, %r13                            # r13 = (arg4 mod 16)
+
+        je      _multiple_of_16_bytes\@
+
+        # handle the last <16 Byte block seperately
+
+
+        vpaddd  ONE(%rip), %xmm9, %xmm9              # INCR CNT to get Yn
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        ENCRYPT_SINGLE_BLOCK    %xmm9                # E(K, Yn)
+
+
+        lea     SHIFT_MASK+16(%rip), %r12
+        sub     %r13, %r12                           # adjust the shuffle mask pointer to be
+                                                    # able to shift 16-r13 bytes (r13 is the
+                                                    # number of bytes in plaintext mod 16)
+
+_get_last_16_byte_loop\@:
+        movb    (arg3, %r11),  %al
+        movb    %al,  TMP1 (%rsp , %r11)
+        add     $1, %r11
+        cmp     %r13,  %r11
+        jne     _get_last_16_byte_loop\@
+
+        vmovdqu  TMP1(%rsp), %xmm1
+
+        sub     $16, %r11
+
+_final_ghash_mul\@:
+        .if  \ENC_DEC ==  DEC
+        vmovdqa %xmm1, %xmm2
+        vpxor   %xmm1, %xmm9, %xmm9                  # Plaintext XOR E(K, Yn)
+        vmovdqu ALL_F-SHIFT_MASK(%r12), %xmm1        # get the appropriate mask to
+                                                    # mask out top 16-r13 bytes of xmm9
+        vpand   %xmm1, %xmm9, %xmm9                  # mask out top 16-r13 bytes of xmm9
+        vpand   %xmm1, %xmm2, %xmm2
+        vpshufb SHUF_MASK(%rip), %xmm2, %xmm2
+        vpxor   %xmm2, %xmm14, %xmm14
+       #GHASH computation for the last <16 Byte block
+        GHASH_MUL_AVX       %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6
+        sub     %r13, %r11
+        add     $16, %r11
+        .else
+        vpxor   %xmm1, %xmm9, %xmm9                  # Plaintext XOR E(K, Yn)
+        vmovdqu ALL_F-SHIFT_MASK(%r12), %xmm1        # get the appropriate mask to
+                                                    # mask out top 16-r13 bytes of xmm9
+        vpand   %xmm1, %xmm9, %xmm9                  # mask out top 16-r13 bytes of xmm9
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        vpxor   %xmm9, %xmm14, %xmm14
+       #GHASH computation for the last <16 Byte block
+        GHASH_MUL_AVX       %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6
+        sub     %r13, %r11
+        add     $16, %r11
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9        # shuffle xmm9 back to output as ciphertext
+        .endif
+
+
+        #############################
+        # output r13 Bytes
+        vmovq   %xmm9, %rax
+        cmp     $8, %r13
+        jle     _less_than_8_bytes_left\@
+
+        mov     %rax, (arg2 , %r11)
+        add     $8, %r11
+        vpsrldq $8, %xmm9, %xmm9
+        vmovq   %xmm9, %rax
+        sub     $8, %r13
+
+_less_than_8_bytes_left\@:
+        movb    %al, (arg2 , %r11)
+        add     $1, %r11
+        shr     $8, %rax
+        sub     $1, %r13
+        jne     _less_than_8_bytes_left\@
+        #############################
+
+_multiple_of_16_bytes\@:
+        mov     arg7, %r12                           # r12 = aadLen (number of bytes)
+        shl     $3, %r12                             # convert into number of bits
+        vmovd   %r12d, %xmm15                        # len(A) in xmm15
+
+        shl     $3, arg4                             # len(C) in bits  (*128)
+        vmovq   arg4, %xmm1
+        vpslldq $8, %xmm15, %xmm15                   # xmm15 = len(A)|| 0x0000000000000000
+        vpxor   %xmm1, %xmm15, %xmm15                # xmm15 = len(A)||len(C)
+
+        vpxor   %xmm15, %xmm14, %xmm14
+        GHASH_MUL_AVX       %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6    # final GHASH computation
+        vpshufb SHUF_MASK(%rip), %xmm14, %xmm14      # perform a 16Byte swap
+
+        mov     arg5, %rax                           # rax = *Y0
+        vmovdqu (%rax), %xmm9                        # xmm9 = Y0
+
+        ENCRYPT_SINGLE_BLOCK    %xmm9                # E(K, Y0)
+
+        vpxor   %xmm14, %xmm9, %xmm9
+
+
+
+_return_T\@:
+        mov     arg8, %r10              # r10 = authTag
+        mov     arg9, %r11              # r11 = auth_tag_len
+
+        cmp     $16, %r11
+        je      _T_16\@
+
+        cmp     $12, %r11
+        je      _T_12\@
+
+_T_8\@:
+        vmovq   %xmm9, %rax
+        mov     %rax, (%r10)
+        jmp     _return_T_done\@
+_T_12\@:
+        vmovq   %xmm9, %rax
+        mov     %rax, (%r10)
+        vpsrldq $8, %xmm9, %xmm9
+        vmovd   %xmm9, %eax
+        mov     %eax, 8(%r10)
+        jmp     _return_T_done\@
+
+_T_16\@:
+        vmovdqu %xmm9, (%r10)
+
+_return_T_done\@:
+        mov     %r14, %rsp
+
+        pop     %r15
+        pop     %r14
+        pop     %r13
+        pop     %r12
+.endm
+
+
+#############################################################
+#void   aesni_gcm_precomp_avx_gen2
+#        (gcm_data     *my_ctx_data,
+#        u8     *hash_subkey)# /* H, the Hash sub key input. Data starts on a 16-byte boundary. */
+#############################################################
+ENTRY(aesni_gcm_precomp_avx_gen2)
+        #the number of pushes must equal STACK_OFFSET
+        push    %r12
+        push    %r13
+        push    %r14
+        push    %r15
+
+        mov     %rsp, %r14
+
+
+
+        sub     $VARIABLE_OFFSET, %rsp
+        and     $~63, %rsp                  # align rsp to 64 bytes
+
+        vmovdqu  (arg2), %xmm6              # xmm6 = HashKey
+
+        vpshufb  SHUF_MASK(%rip), %xmm6, %xmm6
+        ###############  PRECOMPUTATION of HashKey<<1 mod poly from the HashKey
+        vmovdqa  %xmm6, %xmm2
+        vpsllq   $1, %xmm6, %xmm6
+        vpsrlq   $63, %xmm2, %xmm2
+        vmovdqa  %xmm2, %xmm1
+        vpslldq  $8, %xmm2, %xmm2
+        vpsrldq  $8, %xmm1, %xmm1
+        vpor     %xmm2, %xmm6, %xmm6
+        #reduction
+        vpshufd  $0b00100100, %xmm1, %xmm2
+        vpcmpeqd TWOONE(%rip), %xmm2, %xmm2
+        vpand    POLY(%rip), %xmm2, %xmm2
+        vpxor    %xmm2, %xmm6, %xmm6        # xmm6 holds the HashKey<<1 mod poly
+        #######################################################################
+        vmovdqa  %xmm6, HashKey(arg1)       # store HashKey<<1 mod poly
+
+
+        PRECOMPUTE_AVX  %xmm6, %xmm0, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5
+
+        mov     %r14, %rsp
+
+        pop     %r15
+        pop     %r14
+        pop     %r13
+        pop     %r12
+        ret
+ENDPROC(aesni_gcm_precomp_avx_gen2)
+
+###############################################################################
+#void   aesni_gcm_enc_avx_gen2(
+#        gcm_data        *my_ctx_data,     /* aligned to 16 Bytes */
+#        u8      *out, /* Ciphertext output. Encrypt in-place is allowed.  */
+#        const   u8 *in, /* Plaintext input */
+#        u64     plaintext_len, /* Length of data in Bytes for encryption. */
+#        u8      *iv, /* Pre-counter block j0: 4 byte salt
+#                      (from Security Association) concatenated with 8 byte
+#                      Initialisation Vector (from IPSec ESP Payload)
+#                      concatenated with 0x00000001. 16-byte aligned pointer. */
+#        const   u8 *aad, /* Additional Authentication Data (AAD)*/
+#        u64     aad_len, /* Length of AAD in bytes. With RFC4106 this is going to be 8 or 12 Bytes */
+#        u8      *auth_tag, /* Authenticated Tag output. */
+#        u64     auth_tag_len)# /* Authenticated Tag Length in bytes.
+#                              Valid values are 16 (most likely), 12 or 8. */
+###############################################################################
+ENTRY(aesni_gcm_enc_avx_gen2)
+        GCM_ENC_DEC_AVX     ENC
+       ret
+ENDPROC(aesni_gcm_enc_avx_gen2)
+
+###############################################################################
+#void   aesni_gcm_dec_avx_gen2(
+#        gcm_data        *my_ctx_data,     /* aligned to 16 Bytes */
+#        u8      *out, /* Plaintext output. Decrypt in-place is allowed.  */
+#        const   u8 *in, /* Ciphertext input */
+#        u64     plaintext_len, /* Length of data in Bytes for encryption. */
+#        u8      *iv, /* Pre-counter block j0: 4 byte salt
+#                      (from Security Association) concatenated with 8 byte
+#                      Initialisation Vector (from IPSec ESP Payload)
+#                      concatenated with 0x00000001. 16-byte aligned pointer. */
+#        const   u8 *aad, /* Additional Authentication Data (AAD)*/
+#        u64     aad_len, /* Length of AAD in bytes. With RFC4106 this is going to be 8 or 12 Bytes */
+#        u8      *auth_tag, /* Authenticated Tag output. */
+#        u64     auth_tag_len)# /* Authenticated Tag Length in bytes.
+#                              Valid values are 16 (most likely), 12 or 8. */
+###############################################################################
+ENTRY(aesni_gcm_dec_avx_gen2)
+        GCM_ENC_DEC_AVX     DEC
+       ret
+ENDPROC(aesni_gcm_dec_avx_gen2)
+#endif /* CONFIG_AS_AVX */
+
+#ifdef CONFIG_AS_AVX2
+###############################################################################
+# GHASH_MUL MACRO to implement: Data*HashKey mod (128,127,126,121,0)
+# Input: A and B (128-bits each, bit-reflected)
+# Output: C = A*B*x mod poly, (i.e. >>1 )
+# To compute GH = GH*HashKey mod poly, give HK = HashKey<<1 mod poly as input
+# GH = GH * HK * x mod poly which is equivalent to GH*HashKey mod poly.
+###############################################################################
+.macro  GHASH_MUL_AVX2 GH HK T1 T2 T3 T4 T5
+
+        vpclmulqdq      $0x11,\HK,\GH,\T1      # T1 = a1*b1
+        vpclmulqdq      $0x00,\HK,\GH,\T2      # T2 = a0*b0
+        vpclmulqdq      $0x01,\HK,\GH,\T3      # T3 = a1*b0
+        vpclmulqdq      $0x10,\HK,\GH,\GH      # GH = a0*b1
+        vpxor           \T3, \GH, \GH
+
+
+        vpsrldq         $8 , \GH, \T3          # shift-R GH 2 DWs
+        vpslldq         $8 , \GH, \GH          # shift-L GH 2 DWs
+
+        vpxor           \T3, \T1, \T1
+        vpxor           \T2, \GH, \GH
+
+        #######################################################################
+        #first phase of the reduction
+        vmovdqa         POLY2(%rip), \T3
+
+        vpclmulqdq      $0x01, \GH, \T3, \T2
+        vpslldq         $8, \T2, \T2           # shift-L T2 2 DWs
+
+        vpxor           \T2, \GH, \GH          # first phase of the reduction complete
+        #######################################################################
+        #second phase of the reduction
+        vpclmulqdq      $0x00, \GH, \T3, \T2
+        vpsrldq         $4, \T2, \T2           # shift-R T2 1 DW (Shift-R only 1-DW to obtain 2-DWs shift-R)
+
+        vpclmulqdq      $0x10, \GH, \T3, \GH
+        vpslldq         $4, \GH, \GH           # shift-L GH 1 DW (Shift-L 1-DW to obtain result with no shifts)
+
+        vpxor           \T2, \GH, \GH          # second phase of the reduction complete
+        #######################################################################
+        vpxor           \T1, \GH, \GH          # the result is in GH
+
+
+.endm
+
+.macro PRECOMPUTE_AVX2 HK T1 T2 T3 T4 T5 T6
+
+        # Haskey_i_k holds XORed values of the low and high parts of the Haskey_i
+        vmovdqa  \HK, \T5
+        GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2    #  T5 = HashKey^2<<1 mod poly
+        vmovdqa  \T5, HashKey_2(arg1)                       #  [HashKey_2] = HashKey^2<<1 mod poly
+
+        GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2    #  T5 = HashKey^3<<1 mod poly
+        vmovdqa  \T5, HashKey_3(arg1)
+
+        GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2    #  T5 = HashKey^4<<1 mod poly
+        vmovdqa  \T5, HashKey_4(arg1)
+
+        GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2    #  T5 = HashKey^5<<1 mod poly
+        vmovdqa  \T5, HashKey_5(arg1)
+
+        GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2    #  T5 = HashKey^6<<1 mod poly
+        vmovdqa  \T5, HashKey_6(arg1)
+
+        GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2    #  T5 = HashKey^7<<1 mod poly
+        vmovdqa  \T5, HashKey_7(arg1)
+
+        GHASH_MUL_AVX2 \T5, \HK, \T1, \T3, \T4, \T6, \T2    #  T5 = HashKey^8<<1 mod poly
+        vmovdqa  \T5, HashKey_8(arg1)
+
+.endm
+
+
+## if a = number of total plaintext bytes
+## b = floor(a/16)
+## num_initial_blocks = b mod 4#
+## encrypt the initial num_initial_blocks blocks and apply ghash on the ciphertext
+## r10, r11, r12, rax are clobbered
+## arg1, arg2, arg3, r14 are used as a pointer only, not modified
+
+.macro INITIAL_BLOCKS_AVX2 num_initial_blocks T1 T2 T3 T4 T5 CTR XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 T6 T_key ENC_DEC VER
+       i = (8-\num_initial_blocks)
+       setreg
+
+        mov     arg6, %r10                       # r10 = AAD
+        mov     arg7, %r12                       # r12 = aadLen
+
+
+        mov     %r12, %r11
+
+        vpxor   reg_i, reg_i, reg_i
+_get_AAD_loop\@:
+        vmovd   (%r10), \T1
+        vpslldq $12, \T1, \T1
+        vpsrldq $4, reg_i, reg_i
+        vpxor   \T1, reg_i, reg_i
+
+        add     $4, %r10
+        sub     $4, %r12
+        jg      _get_AAD_loop\@
+
+
+        cmp     $16, %r11
+        je      _get_AAD_loop2_done\@
+        mov     $16, %r12
+
+_get_AAD_loop2\@:
+        vpsrldq $4, reg_i, reg_i
+        sub     $4, %r12
+        cmp     %r11, %r12
+        jg      _get_AAD_loop2\@
+
+_get_AAD_loop2_done\@:
+
+        #byte-reflect the AAD data
+        vpshufb SHUF_MASK(%rip), reg_i, reg_i
+
+       # initialize the data pointer offset as zero
+       xor     %r11, %r11
+
+       # start AES for num_initial_blocks blocks
+       mov     arg5, %rax                     # rax = *Y0
+       vmovdqu (%rax), \CTR                   # CTR = Y0
+       vpshufb SHUF_MASK(%rip), \CTR, \CTR
+
+
+       i = (9-\num_initial_blocks)
+       setreg
+.rep \num_initial_blocks
+                vpaddd  ONE(%rip), \CTR, \CTR   # INCR Y0
+                vmovdqa \CTR, reg_i
+                vpshufb SHUF_MASK(%rip), reg_i, reg_i     # perform a 16Byte swap
+       i = (i+1)
+       setreg
+.endr
+
+       vmovdqa  (arg1), \T_key
+       i = (9-\num_initial_blocks)
+       setreg
+.rep \num_initial_blocks
+                vpxor   \T_key, reg_i, reg_i
+       i = (i+1)
+       setreg
+.endr
+
+       j = 1
+       setreg
+.rep 9
+       vmovdqa  16*j(arg1), \T_key
+       i = (9-\num_initial_blocks)
+       setreg
+.rep \num_initial_blocks
+        vaesenc \T_key, reg_i, reg_i
+       i = (i+1)
+       setreg
+.endr
+
+       j = (j+1)
+       setreg
+.endr
+
+
+       vmovdqa  16*10(arg1), \T_key
+       i = (9-\num_initial_blocks)
+       setreg
+.rep \num_initial_blocks
+        vaesenclast      \T_key, reg_i, reg_i
+       i = (i+1)
+       setreg
+.endr
+
+       i = (9-\num_initial_blocks)
+       setreg
+.rep \num_initial_blocks
+                vmovdqu (arg3, %r11), \T1
+                vpxor   \T1, reg_i, reg_i
+                vmovdqu reg_i, (arg2 , %r11)           # write back ciphertext for
+                                                      # num_initial_blocks blocks
+                add     $16, %r11
+.if  \ENC_DEC == DEC
+                vmovdqa \T1, reg_i
+.endif
+                vpshufb SHUF_MASK(%rip), reg_i, reg_i  # prepare ciphertext for GHASH computations
+       i = (i+1)
+       setreg
+.endr
+
+
+       i = (8-\num_initial_blocks)
+       j = (9-\num_initial_blocks)
+       setreg
+        GHASH_MUL_AVX2       reg_i, \T2, \T1, \T3, \T4, \T5, \T6
+
+.rep \num_initial_blocks
+        vpxor    reg_i, reg_j, reg_j
+        GHASH_MUL_AVX2       reg_j, \T2, \T1, \T3, \T4, \T5, \T6  # apply GHASH on num_initial_blocks blocks
+       i = (i+1)
+       j = (j+1)
+       setreg
+.endr
+        # XMM8 has the combined result here
+
+        vmovdqa  \XMM8, TMP1(%rsp)
+        vmovdqa  \XMM8, \T3
+
+        cmp     $128, %r13
+        jl      _initial_blocks_done\@                  # no need for precomputed constants
+
+###############################################################################
+# Haskey_i_k holds XORed values of the low and high parts of the Haskey_i
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM1
+                vpshufb  SHUF_MASK(%rip), \XMM1, \XMM1  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM2
+                vpshufb  SHUF_MASK(%rip), \XMM2, \XMM2  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM3
+                vpshufb  SHUF_MASK(%rip), \XMM3, \XMM3  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM4
+                vpshufb  SHUF_MASK(%rip), \XMM4, \XMM4  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM5
+                vpshufb  SHUF_MASK(%rip), \XMM5, \XMM5  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM6
+                vpshufb  SHUF_MASK(%rip), \XMM6, \XMM6  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM7
+                vpshufb  SHUF_MASK(%rip), \XMM7, \XMM7  # perform a 16Byte swap
+
+                vpaddd   ONE(%rip), \CTR, \CTR          # INCR Y0
+                vmovdqa  \CTR, \XMM8
+                vpshufb  SHUF_MASK(%rip), \XMM8, \XMM8  # perform a 16Byte swap
+
+                vmovdqa  (arg1), \T_key
+                vpxor    \T_key, \XMM1, \XMM1
+                vpxor    \T_key, \XMM2, \XMM2
+                vpxor    \T_key, \XMM3, \XMM3
+                vpxor    \T_key, \XMM4, \XMM4
+                vpxor    \T_key, \XMM5, \XMM5
+                vpxor    \T_key, \XMM6, \XMM6
+                vpxor    \T_key, \XMM7, \XMM7
+                vpxor    \T_key, \XMM8, \XMM8
+
+               i = 1
+               setreg
+.rep    9       # do 9 rounds
+                vmovdqa  16*i(arg1), \T_key
+                vaesenc  \T_key, \XMM1, \XMM1
+                vaesenc  \T_key, \XMM2, \XMM2
+                vaesenc  \T_key, \XMM3, \XMM3
+                vaesenc  \T_key, \XMM4, \XMM4
+                vaesenc  \T_key, \XMM5, \XMM5
+                vaesenc  \T_key, \XMM6, \XMM6
+                vaesenc  \T_key, \XMM7, \XMM7
+                vaesenc  \T_key, \XMM8, \XMM8
+               i = (i+1)
+               setreg
+.endr
+
+
+                vmovdqa  16*i(arg1), \T_key
+                vaesenclast  \T_key, \XMM1, \XMM1
+                vaesenclast  \T_key, \XMM2, \XMM2
+                vaesenclast  \T_key, \XMM3, \XMM3
+                vaesenclast  \T_key, \XMM4, \XMM4
+                vaesenclast  \T_key, \XMM5, \XMM5
+                vaesenclast  \T_key, \XMM6, \XMM6
+                vaesenclast  \T_key, \XMM7, \XMM7
+                vaesenclast  \T_key, \XMM8, \XMM8
+
+                vmovdqu  (arg3, %r11), \T1
+                vpxor    \T1, \XMM1, \XMM1
+                vmovdqu  \XMM1, (arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM1
+                .endif
+
+                vmovdqu  16*1(arg3, %r11), \T1
+                vpxor    \T1, \XMM2, \XMM2
+                vmovdqu  \XMM2, 16*1(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM2
+                .endif
+
+                vmovdqu  16*2(arg3, %r11), \T1
+                vpxor    \T1, \XMM3, \XMM3
+                vmovdqu  \XMM3, 16*2(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM3
+                .endif
+
+                vmovdqu  16*3(arg3, %r11), \T1
+                vpxor    \T1, \XMM4, \XMM4
+                vmovdqu  \XMM4, 16*3(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM4
+                .endif
+
+                vmovdqu  16*4(arg3, %r11), \T1
+                vpxor    \T1, \XMM5, \XMM5
+                vmovdqu  \XMM5, 16*4(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM5
+                .endif
+
+                vmovdqu  16*5(arg3, %r11), \T1
+                vpxor    \T1, \XMM6, \XMM6
+                vmovdqu  \XMM6, 16*5(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM6
+                .endif
+
+                vmovdqu  16*6(arg3, %r11), \T1
+                vpxor    \T1, \XMM7, \XMM7
+                vmovdqu  \XMM7, 16*6(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM7
+                .endif
+
+                vmovdqu  16*7(arg3, %r11), \T1
+                vpxor    \T1, \XMM8, \XMM8
+                vmovdqu  \XMM8, 16*7(arg2 , %r11)
+                .if   \ENC_DEC == DEC
+                vmovdqa  \T1, \XMM8
+                .endif
+
+                add     $128, %r11
+
+                vpshufb  SHUF_MASK(%rip), \XMM1, \XMM1     # perform a 16Byte swap
+                vpxor    TMP1(%rsp), \XMM1, \XMM1          # combine GHASHed value with
+                                                          # the corresponding ciphertext
+                vpshufb  SHUF_MASK(%rip), \XMM2, \XMM2     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM3, \XMM3     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM4, \XMM4     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM5, \XMM5     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM6, \XMM6     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM7, \XMM7     # perform a 16Byte swap
+                vpshufb  SHUF_MASK(%rip), \XMM8, \XMM8     # perform a 16Byte swap
+
+###############################################################################
+
+_initial_blocks_done\@:
+
+
+.endm
+
+
+
+# encrypt 8 blocks at a time
+# ghash the 8 previously encrypted ciphertext blocks
+# arg1, arg2, arg3 are used as pointers only, not modified
+# r11 is the data offset value
+.macro GHASH_8_ENCRYPT_8_PARALLEL_AVX2 T1 T2 T3 T4 T5 T6 CTR XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 T7 loop_idx ENC_DEC
+
+        vmovdqa \XMM1, \T2
+        vmovdqa \XMM2, TMP2(%rsp)
+        vmovdqa \XMM3, TMP3(%rsp)
+        vmovdqa \XMM4, TMP4(%rsp)
+        vmovdqa \XMM5, TMP5(%rsp)
+        vmovdqa \XMM6, TMP6(%rsp)
+        vmovdqa \XMM7, TMP7(%rsp)
+        vmovdqa \XMM8, TMP8(%rsp)
+
+.if \loop_idx == in_order
+                vpaddd  ONE(%rip), \CTR, \XMM1            # INCR CNT
+                vpaddd  ONE(%rip), \XMM1, \XMM2
+                vpaddd  ONE(%rip), \XMM2, \XMM3
+                vpaddd  ONE(%rip), \XMM3, \XMM4
+                vpaddd  ONE(%rip), \XMM4, \XMM5
+                vpaddd  ONE(%rip), \XMM5, \XMM6
+                vpaddd  ONE(%rip), \XMM6, \XMM7
+                vpaddd  ONE(%rip), \XMM7, \XMM8
+                vmovdqa \XMM8, \CTR
+
+                vpshufb SHUF_MASK(%rip), \XMM1, \XMM1     # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM2, \XMM2     # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM3, \XMM3     # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM4, \XMM4     # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM5, \XMM5     # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM6, \XMM6     # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM7, \XMM7     # perform a 16Byte swap
+                vpshufb SHUF_MASK(%rip), \XMM8, \XMM8     # perform a 16Byte swap
+.else
+                vpaddd  ONEf(%rip), \CTR, \XMM1            # INCR CNT
+                vpaddd  ONEf(%rip), \XMM1, \XMM2
+                vpaddd  ONEf(%rip), \XMM2, \XMM3
+                vpaddd  ONEf(%rip), \XMM3, \XMM4
+                vpaddd  ONEf(%rip), \XMM4, \XMM5
+                vpaddd  ONEf(%rip), \XMM5, \XMM6
+                vpaddd  ONEf(%rip), \XMM6, \XMM7
+                vpaddd  ONEf(%rip), \XMM7, \XMM8
+                vmovdqa \XMM8, \CTR
+.endif
+
+
+        #######################################################################
+
+                vmovdqu (arg1), \T1
+                vpxor   \T1, \XMM1, \XMM1
+                vpxor   \T1, \XMM2, \XMM2
+                vpxor   \T1, \XMM3, \XMM3
+                vpxor   \T1, \XMM4, \XMM4
+                vpxor   \T1, \XMM5, \XMM5
+                vpxor   \T1, \XMM6, \XMM6
+                vpxor   \T1, \XMM7, \XMM7
+                vpxor   \T1, \XMM8, \XMM8
+
+        #######################################################################
+
+
+
+
+
+                vmovdqu 16*1(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+                vmovdqu 16*2(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+
+        #######################################################################
+
+        vmovdqa         HashKey_8(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T2, \T4              # T4 = a1*b1
+        vpclmulqdq      $0x00, \T5, \T2, \T7              # T7 = a0*b0
+        vpclmulqdq      $0x01, \T5, \T2, \T6              # T6 = a1*b0
+        vpclmulqdq      $0x10, \T5, \T2, \T5              # T5 = a0*b1
+        vpxor           \T5, \T6, \T6
+
+                vmovdqu 16*3(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+        vmovdqa         TMP2(%rsp), \T1
+        vmovdqa         HashKey_7(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpclmulqdq      $0x01, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+        vpclmulqdq      $0x10, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+                vmovdqu 16*4(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+        #######################################################################
+
+        vmovdqa         TMP3(%rsp), \T1
+        vmovdqa         HashKey_6(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpclmulqdq      $0x01, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+        vpclmulqdq      $0x10, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+                vmovdqu 16*5(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+        vmovdqa         TMP4(%rsp), \T1
+        vmovdqa         HashKey_5(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpclmulqdq      $0x01, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+        vpclmulqdq      $0x10, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+                vmovdqu 16*6(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+
+        vmovdqa         TMP5(%rsp), \T1
+        vmovdqa         HashKey_4(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpclmulqdq      $0x01, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+        vpclmulqdq      $0x10, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+                vmovdqu 16*7(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+        vmovdqa         TMP6(%rsp), \T1
+        vmovdqa         HashKey_3(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpclmulqdq      $0x01, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+        vpclmulqdq      $0x10, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+                vmovdqu 16*8(arg1), \T1
+                vaesenc \T1, \XMM1, \XMM1
+                vaesenc \T1, \XMM2, \XMM2
+                vaesenc \T1, \XMM3, \XMM3
+                vaesenc \T1, \XMM4, \XMM4
+                vaesenc \T1, \XMM5, \XMM5
+                vaesenc \T1, \XMM6, \XMM6
+                vaesenc \T1, \XMM7, \XMM7
+                vaesenc \T1, \XMM8, \XMM8
+
+        vmovdqa         TMP7(%rsp), \T1
+        vmovdqa         HashKey_2(arg1), \T5
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T4
+
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpclmulqdq      $0x01, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+        vpclmulqdq      $0x10, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+
+        #######################################################################
+
+                vmovdqu 16*9(arg1), \T5
+                vaesenc \T5, \XMM1, \XMM1
+                vaesenc \T5, \XMM2, \XMM2
+                vaesenc \T5, \XMM3, \XMM3
+                vaesenc \T5, \XMM4, \XMM4
+                vaesenc \T5, \XMM5, \XMM5
+                vaesenc \T5, \XMM6, \XMM6
+                vaesenc \T5, \XMM7, \XMM7
+                vaesenc \T5, \XMM8, \XMM8
+
+        vmovdqa         TMP8(%rsp), \T1
+        vmovdqa         HashKey(arg1), \T5
+
+        vpclmulqdq      $0x00, \T5, \T1, \T3
+        vpxor           \T3, \T7, \T7
+
+        vpclmulqdq      $0x01, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+        vpclmulqdq      $0x10, \T5, \T1, \T3
+        vpxor           \T3, \T6, \T6
+
+        vpclmulqdq      $0x11, \T5, \T1, \T3
+        vpxor           \T3, \T4, \T1
+
+
+                vmovdqu 16*10(arg1), \T5
+
+       i = 0
+       j = 1
+       setreg
+.rep 8
+               vpxor   16*i(arg3, %r11), \T5, \T2
+                .if \ENC_DEC == ENC
+                vaesenclast     \T2, reg_j, reg_j
+                .else
+                vaesenclast     \T2, reg_j, \T3
+                vmovdqu 16*i(arg3, %r11), reg_j
+                vmovdqu \T3, 16*i(arg2, %r11)
+                .endif
+       i = (i+1)
+       j = (j+1)
+       setreg
+.endr
+       #######################################################################
+
+
+       vpslldq $8, \T6, \T3                            # shift-L T3 2 DWs
+       vpsrldq $8, \T6, \T6                            # shift-R T2 2 DWs
+       vpxor   \T3, \T7, \T7
+       vpxor   \T6, \T1, \T1                           # accumulate the results in T1:T7
+
+
+
+       #######################################################################
+       #first phase of the reduction
+       vmovdqa         POLY2(%rip), \T3
+
+       vpclmulqdq      $0x01, \T7, \T3, \T2
+       vpslldq         $8, \T2, \T2                    # shift-L xmm2 2 DWs
+
+       vpxor           \T2, \T7, \T7                   # first phase of the reduction complete
+       #######################################################################
+                .if \ENC_DEC == ENC
+               vmovdqu  \XMM1, 16*0(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM2, 16*1(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM3, 16*2(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM4, 16*3(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM5, 16*4(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM6, 16*5(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM7, 16*6(arg2,%r11)         # Write to the Ciphertext buffer
+               vmovdqu  \XMM8, 16*7(arg2,%r11)         # Write to the Ciphertext buffer
+                .endif
+
+       #######################################################################
+       #second phase of the reduction
+       vpclmulqdq      $0x00, \T7, \T3, \T2
+       vpsrldq         $4, \T2, \T2                    # shift-R xmm2 1 DW (Shift-R only 1-DW to obtain 2-DWs shift-R)
+
+       vpclmulqdq      $0x10, \T7, \T3, \T4
+       vpslldq         $4, \T4, \T4                    # shift-L xmm0 1 DW (Shift-L 1-DW to obtain result with no shifts)
+
+       vpxor           \T2, \T4, \T4                   # second phase of the reduction complete
+       #######################################################################
+       vpxor           \T4, \T1, \T1                   # the result is in T1
+
+               vpshufb SHUF_MASK(%rip), \XMM1, \XMM1   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM2, \XMM2   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM3, \XMM3   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM4, \XMM4   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM5, \XMM5   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM6, \XMM6   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM7, \XMM7   # perform a 16Byte swap
+               vpshufb SHUF_MASK(%rip), \XMM8, \XMM8   # perform a 16Byte swap
+
+
+       vpxor   \T1, \XMM1, \XMM1
+
+
+
+.endm
+
+
+# GHASH the last 4 ciphertext blocks.
+.macro  GHASH_LAST_8_AVX2 T1 T2 T3 T4 T5 T6 T7 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8
+
+        ## Karatsuba Method
+
+        vmovdqa         HashKey_8(arg1), \T5
+
+        vpshufd         $0b01001110, \XMM1, \T2
+        vpshufd         $0b01001110, \T5, \T3
+        vpxor           \XMM1, \T2, \T2
+        vpxor           \T5, \T3, \T3
+
+        vpclmulqdq      $0x11, \T5, \XMM1, \T6
+        vpclmulqdq      $0x00, \T5, \XMM1, \T7
+
+        vpclmulqdq      $0x00, \T3, \T2, \XMM1
+
+        ######################
+
+        vmovdqa         HashKey_7(arg1), \T5
+        vpshufd         $0b01001110, \XMM2, \T2
+        vpshufd         $0b01001110, \T5, \T3
+        vpxor           \XMM2, \T2, \T2
+        vpxor           \T5, \T3, \T3
+
+        vpclmulqdq      $0x11, \T5, \XMM2, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM2, \T4
+        vpxor           \T4, \T7, \T7
+
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vmovdqa         HashKey_6(arg1), \T5
+        vpshufd         $0b01001110, \XMM3, \T2
+        vpshufd         $0b01001110, \T5, \T3
+        vpxor           \XMM3, \T2, \T2
+        vpxor           \T5, \T3, \T3
+
+        vpclmulqdq      $0x11, \T5, \XMM3, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM3, \T4
+        vpxor           \T4, \T7, \T7
+
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vmovdqa         HashKey_5(arg1), \T5
+        vpshufd         $0b01001110, \XMM4, \T2
+        vpshufd         $0b01001110, \T5, \T3
+        vpxor           \XMM4, \T2, \T2
+        vpxor           \T5, \T3, \T3
+
+        vpclmulqdq      $0x11, \T5, \XMM4, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM4, \T4
+        vpxor           \T4, \T7, \T7
+
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vmovdqa         HashKey_4(arg1), \T5
+        vpshufd         $0b01001110, \XMM5, \T2
+        vpshufd         $0b01001110, \T5, \T3
+        vpxor           \XMM5, \T2, \T2
+        vpxor           \T5, \T3, \T3
+
+        vpclmulqdq      $0x11, \T5, \XMM5, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM5, \T4
+        vpxor           \T4, \T7, \T7
+
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vmovdqa         HashKey_3(arg1), \T5
+        vpshufd         $0b01001110, \XMM6, \T2
+        vpshufd         $0b01001110, \T5, \T3
+        vpxor           \XMM6, \T2, \T2
+        vpxor           \T5, \T3, \T3
+
+        vpclmulqdq      $0x11, \T5, \XMM6, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM6, \T4
+        vpxor           \T4, \T7, \T7
+
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vmovdqa         HashKey_2(arg1), \T5
+        vpshufd         $0b01001110, \XMM7, \T2
+        vpshufd         $0b01001110, \T5, \T3
+        vpxor           \XMM7, \T2, \T2
+        vpxor           \T5, \T3, \T3
+
+        vpclmulqdq      $0x11, \T5, \XMM7, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM7, \T4
+        vpxor           \T4, \T7, \T7
+
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+
+        vpxor           \T2, \XMM1, \XMM1
+
+        ######################
+
+        vmovdqa         HashKey(arg1), \T5
+        vpshufd         $0b01001110, \XMM8, \T2
+        vpshufd         $0b01001110, \T5, \T3
+        vpxor           \XMM8, \T2, \T2
+        vpxor           \T5, \T3, \T3
+
+        vpclmulqdq      $0x11, \T5, \XMM8, \T4
+        vpxor           \T4, \T6, \T6
+
+        vpclmulqdq      $0x00, \T5, \XMM8, \T4
+        vpxor           \T4, \T7, \T7
+
+        vpclmulqdq      $0x00, \T3, \T2, \T2
+
+        vpxor           \T2, \XMM1, \XMM1
+        vpxor           \T6, \XMM1, \XMM1
+        vpxor           \T7, \XMM1, \T2
+
+
+
+
+        vpslldq $8, \T2, \T4
+        vpsrldq $8, \T2, \T2
+
+        vpxor   \T4, \T7, \T7
+        vpxor   \T2, \T6, \T6                      # <T6:T7> holds the result of the
+                                                  # accumulated carry-less multiplications
+
+        #######################################################################
+        #first phase of the reduction
+        vmovdqa         POLY2(%rip), \T3
+
+        vpclmulqdq      $0x01, \T7, \T3, \T2
+        vpslldq         $8, \T2, \T2               # shift-L xmm2 2 DWs
+
+        vpxor           \T2, \T7, \T7              # first phase of the reduction complete
+        #######################################################################
+
+
+        #second phase of the reduction
+        vpclmulqdq      $0x00, \T7, \T3, \T2
+        vpsrldq         $4, \T2, \T2               # shift-R T2 1 DW (Shift-R only 1-DW to obtain 2-DWs shift-R)
+
+        vpclmulqdq      $0x10, \T7, \T3, \T4
+        vpslldq         $4, \T4, \T4               # shift-L T4 1 DW (Shift-L 1-DW to obtain result with no shifts)
+
+        vpxor           \T2, \T4, \T4              # second phase of the reduction complete
+        #######################################################################
+        vpxor           \T4, \T6, \T6              # the result is in T6
+.endm
+
+
+
+# combined for GCM encrypt and decrypt functions
+# clobbering all xmm registers
+# clobbering r10, r11, r12, r13, r14, r15
+.macro  GCM_ENC_DEC_AVX2     ENC_DEC
+
+        #the number of pushes must equal STACK_OFFSET
+        push    %r12
+        push    %r13
+        push    %r14
+        push    %r15
+
+        mov     %rsp, %r14
+
+
+
+
+        sub     $VARIABLE_OFFSET, %rsp
+        and     $~63, %rsp                         # align rsp to 64 bytes
+
+
+        vmovdqu  HashKey(arg1), %xmm13             # xmm13 = HashKey
+
+        mov     arg4, %r13                         # save the number of bytes of plaintext/ciphertext
+        and     $-16, %r13                         # r13 = r13 - (r13 mod 16)
+
+        mov     %r13, %r12
+        shr     $4, %r12
+        and     $7, %r12
+        jz      _initial_num_blocks_is_0\@
+
+        cmp     $7, %r12
+        je      _initial_num_blocks_is_7\@
+        cmp     $6, %r12
+        je      _initial_num_blocks_is_6\@
+        cmp     $5, %r12
+        je      _initial_num_blocks_is_5\@
+        cmp     $4, %r12
+        je      _initial_num_blocks_is_4\@
+        cmp     $3, %r12
+        je      _initial_num_blocks_is_3\@
+        cmp     $2, %r12
+        je      _initial_num_blocks_is_2\@
+
+        jmp     _initial_num_blocks_is_1\@
+
+_initial_num_blocks_is_7\@:
+        INITIAL_BLOCKS_AVX2  7, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*7, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_6\@:
+        INITIAL_BLOCKS_AVX2  6, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*6, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_5\@:
+        INITIAL_BLOCKS_AVX2  5, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*5, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_4\@:
+        INITIAL_BLOCKS_AVX2  4, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*4, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_3\@:
+        INITIAL_BLOCKS_AVX2  3, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*3, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_2\@:
+        INITIAL_BLOCKS_AVX2  2, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*2, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_1\@:
+        INITIAL_BLOCKS_AVX2  1, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+        sub     $16*1, %r13
+        jmp     _initial_blocks_encrypted\@
+
+_initial_num_blocks_is_0\@:
+        INITIAL_BLOCKS_AVX2  0, %xmm12, %xmm13, %xmm14, %xmm15, %xmm11, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm10, %xmm0, \ENC_DEC
+
+
+_initial_blocks_encrypted\@:
+        cmp     $0, %r13
+        je      _zero_cipher_left\@
+
+        sub     $128, %r13
+        je      _eight_cipher_left\@
+
+
+
+
+        vmovd   %xmm9, %r15d
+        and     $255, %r15d
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+
+
+_encrypt_by_8_new\@:
+        cmp     $(255-8), %r15d
+        jg      _encrypt_by_8\@
+
+
+
+        add     $8, %r15b
+        GHASH_8_ENCRYPT_8_PARALLEL_AVX2      %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm15, out_order, \ENC_DEC
+        add     $128, %r11
+        sub     $128, %r13
+        jne     _encrypt_by_8_new\@
+
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        jmp     _eight_cipher_left\@
+
+_encrypt_by_8\@:
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        add     $8, %r15b
+        GHASH_8_ENCRYPT_8_PARALLEL_AVX2      %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm9, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, %xmm15, in_order, \ENC_DEC
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        add     $128, %r11
+        sub     $128, %r13
+        jne     _encrypt_by_8_new\@
+
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+
+
+
+
+_eight_cipher_left\@:
+        GHASH_LAST_8_AVX2    %xmm0, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm15, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8
+
+
+_zero_cipher_left\@:
+        cmp     $16, arg4
+        jl      _only_less_than_16\@
+
+        mov     arg4, %r13
+        and     $15, %r13                            # r13 = (arg4 mod 16)
+
+        je      _multiple_of_16_bytes\@
+
+        # handle the last <16 Byte block seperately
+
+
+        vpaddd   ONE(%rip), %xmm9, %xmm9             # INCR CNT to get Yn
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        ENCRYPT_SINGLE_BLOCK    %xmm9                # E(K, Yn)
+
+        sub     $16, %r11
+        add     %r13, %r11
+        vmovdqu (arg3, %r11), %xmm1                  # receive the last <16 Byte block
+
+        lea     SHIFT_MASK+16(%rip), %r12
+        sub     %r13, %r12                           # adjust the shuffle mask pointer
+                                                    # to be able to shift 16-r13 bytes
+                                                    # (r13 is the number of bytes in plaintext mod 16)
+        vmovdqu (%r12), %xmm2                        # get the appropriate shuffle mask
+        vpshufb %xmm2, %xmm1, %xmm1                  # shift right 16-r13 bytes
+        jmp     _final_ghash_mul\@
+
+_only_less_than_16\@:
+        # check for 0 length
+        mov     arg4, %r13
+        and     $15, %r13                            # r13 = (arg4 mod 16)
+
+        je      _multiple_of_16_bytes\@
+
+        # handle the last <16 Byte block seperately
+
+
+        vpaddd  ONE(%rip), %xmm9, %xmm9              # INCR CNT to get Yn
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        ENCRYPT_SINGLE_BLOCK    %xmm9                # E(K, Yn)
+
+
+        lea     SHIFT_MASK+16(%rip), %r12
+        sub     %r13, %r12                           # adjust the shuffle mask pointer to be
+                                                    # able to shift 16-r13 bytes (r13 is the
+                                                    # number of bytes in plaintext mod 16)
+
+_get_last_16_byte_loop\@:
+        movb    (arg3, %r11),  %al
+        movb    %al,  TMP1 (%rsp , %r11)
+        add     $1, %r11
+        cmp     %r13,  %r11
+        jne     _get_last_16_byte_loop\@
+
+        vmovdqu  TMP1(%rsp), %xmm1
+
+        sub     $16, %r11
+
+_final_ghash_mul\@:
+        .if  \ENC_DEC ==  DEC
+        vmovdqa %xmm1, %xmm2
+        vpxor   %xmm1, %xmm9, %xmm9                  # Plaintext XOR E(K, Yn)
+        vmovdqu ALL_F-SHIFT_MASK(%r12), %xmm1        # get the appropriate mask to mask out top 16-r13 bytes of xmm9
+        vpand   %xmm1, %xmm9, %xmm9                  # mask out top 16-r13 bytes of xmm9
+        vpand   %xmm1, %xmm2, %xmm2
+        vpshufb SHUF_MASK(%rip), %xmm2, %xmm2
+        vpxor   %xmm2, %xmm14, %xmm14
+       #GHASH computation for the last <16 Byte block
+        GHASH_MUL_AVX2       %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6
+        sub     %r13, %r11
+        add     $16, %r11
+        .else
+        vpxor   %xmm1, %xmm9, %xmm9                  # Plaintext XOR E(K, Yn)
+        vmovdqu ALL_F-SHIFT_MASK(%r12), %xmm1        # get the appropriate mask to mask out top 16-r13 bytes of xmm9
+        vpand   %xmm1, %xmm9, %xmm9                  # mask out top 16-r13 bytes of xmm9
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9
+        vpxor   %xmm9, %xmm14, %xmm14
+       #GHASH computation for the last <16 Byte block
+        GHASH_MUL_AVX2       %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6
+        sub     %r13, %r11
+        add     $16, %r11
+        vpshufb SHUF_MASK(%rip), %xmm9, %xmm9        # shuffle xmm9 back to output as ciphertext
+        .endif
+
+
+        #############################
+        # output r13 Bytes
+        vmovq   %xmm9, %rax
+        cmp     $8, %r13
+        jle     _less_than_8_bytes_left\@
+
+        mov     %rax, (arg2 , %r11)
+        add     $8, %r11
+        vpsrldq $8, %xmm9, %xmm9
+        vmovq   %xmm9, %rax
+        sub     $8, %r13
+
+_less_than_8_bytes_left\@:
+        movb    %al, (arg2 , %r11)
+        add     $1, %r11
+        shr     $8, %rax
+        sub     $1, %r13
+        jne     _less_than_8_bytes_left\@
+        #############################
+
+_multiple_of_16_bytes\@:
+        mov     arg7, %r12                           # r12 = aadLen (number of bytes)
+        shl     $3, %r12                             # convert into number of bits
+        vmovd   %r12d, %xmm15                        # len(A) in xmm15
+
+        shl     $3, arg4                             # len(C) in bits  (*128)
+        vmovq   arg4, %xmm1
+        vpslldq $8, %xmm15, %xmm15                   # xmm15 = len(A)|| 0x0000000000000000
+        vpxor   %xmm1, %xmm15, %xmm15                # xmm15 = len(A)||len(C)
+
+        vpxor   %xmm15, %xmm14, %xmm14
+        GHASH_MUL_AVX2       %xmm14, %xmm13, %xmm0, %xmm10, %xmm11, %xmm5, %xmm6    # final GHASH computation
+        vpshufb SHUF_MASK(%rip), %xmm14, %xmm14              # perform a 16Byte swap
+
+        mov     arg5, %rax                           # rax = *Y0
+        vmovdqu (%rax), %xmm9                        # xmm9 = Y0
+
+        ENCRYPT_SINGLE_BLOCK    %xmm9                # E(K, Y0)
+
+        vpxor   %xmm14, %xmm9, %xmm9
+
+
+
+_return_T\@:
+        mov     arg8, %r10              # r10 = authTag
+        mov     arg9, %r11              # r11 = auth_tag_len
+
+        cmp     $16, %r11
+        je      _T_16\@
+
+        cmp     $12, %r11
+        je      _T_12\@
+
+_T_8\@:
+        vmovq   %xmm9, %rax
+        mov     %rax, (%r10)
+        jmp     _return_T_done\@
+_T_12\@:
+        vmovq   %xmm9, %rax
+        mov     %rax, (%r10)
+        vpsrldq $8, %xmm9, %xmm9
+        vmovd   %xmm9, %eax
+        mov     %eax, 8(%r10)
+        jmp     _return_T_done\@
+
+_T_16\@:
+        vmovdqu %xmm9, (%r10)
+
+_return_T_done\@:
+        mov     %r14, %rsp
+
+        pop     %r15
+        pop     %r14
+        pop     %r13
+        pop     %r12
+.endm
+
+
+#############################################################
+#void   aesni_gcm_precomp_avx_gen4
+#        (gcm_data     *my_ctx_data,
+#        u8     *hash_subkey)# /* H, the Hash sub key input.
+#                              Data starts on a 16-byte boundary. */
+#############################################################
+ENTRY(aesni_gcm_precomp_avx_gen4)
+        #the number of pushes must equal STACK_OFFSET
+        push    %r12
+        push    %r13
+        push    %r14
+        push    %r15
+
+        mov     %rsp, %r14
+
+
+
+        sub     $VARIABLE_OFFSET, %rsp
+        and     $~63, %rsp                    # align rsp to 64 bytes
+
+        vmovdqu  (arg2), %xmm6                # xmm6 = HashKey
+
+        vpshufb  SHUF_MASK(%rip), %xmm6, %xmm6
+        ###############  PRECOMPUTATION of HashKey<<1 mod poly from the HashKey
+        vmovdqa  %xmm6, %xmm2
+        vpsllq   $1, %xmm6, %xmm6
+        vpsrlq   $63, %xmm2, %xmm2
+        vmovdqa  %xmm2, %xmm1
+        vpslldq  $8, %xmm2, %xmm2
+        vpsrldq  $8, %xmm1, %xmm1
+        vpor     %xmm2, %xmm6, %xmm6
+        #reduction
+        vpshufd  $0b00100100, %xmm1, %xmm2
+        vpcmpeqd TWOONE(%rip), %xmm2, %xmm2
+        vpand    POLY(%rip), %xmm2, %xmm2
+        vpxor    %xmm2, %xmm6, %xmm6          # xmm6 holds the HashKey<<1 mod poly
+        #######################################################################
+        vmovdqa  %xmm6, HashKey(arg1)         # store HashKey<<1 mod poly
+
+
+        PRECOMPUTE_AVX2  %xmm6, %xmm0, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5
+
+        mov     %r14, %rsp
+
+        pop     %r15
+        pop     %r14
+        pop     %r13
+        pop     %r12
+        ret
+ENDPROC(aesni_gcm_precomp_avx_gen4)
+
+
+###############################################################################
+#void   aesni_gcm_enc_avx_gen4(
+#        gcm_data        *my_ctx_data,     /* aligned to 16 Bytes */
+#        u8      *out, /* Ciphertext output. Encrypt in-place is allowed.  */
+#        const   u8 *in, /* Plaintext input */
+#        u64     plaintext_len, /* Length of data in Bytes for encryption. */
+#        u8      *iv, /* Pre-counter block j0: 4 byte salt
+#                      (from Security Association) concatenated with 8 byte
+#                       Initialisation Vector (from IPSec ESP Payload)
+#                       concatenated with 0x00000001. 16-byte aligned pointer. */
+#        const   u8 *aad, /* Additional Authentication Data (AAD)*/
+#        u64     aad_len, /* Length of AAD in bytes. With RFC4106 this is going to be 8 or 12 Bytes */
+#        u8      *auth_tag, /* Authenticated Tag output. */
+#        u64     auth_tag_len)# /* Authenticated Tag Length in bytes.
+#                              Valid values are 16 (most likely), 12 or 8. */
+###############################################################################
+ENTRY(aesni_gcm_enc_avx_gen4)
+        GCM_ENC_DEC_AVX2     ENC
+       ret
+ENDPROC(aesni_gcm_enc_avx_gen4)
+
+###############################################################################
+#void   aesni_gcm_dec_avx_gen4(
+#        gcm_data        *my_ctx_data,     /* aligned to 16 Bytes */
+#        u8      *out, /* Plaintext output. Decrypt in-place is allowed.  */
+#        const   u8 *in, /* Ciphertext input */
+#        u64     plaintext_len, /* Length of data in Bytes for encryption. */
+#        u8      *iv, /* Pre-counter block j0: 4 byte salt
+#                      (from Security Association) concatenated with 8 byte
+#                      Initialisation Vector (from IPSec ESP Payload)
+#                      concatenated with 0x00000001. 16-byte aligned pointer. */
+#        const   u8 *aad, /* Additional Authentication Data (AAD)*/
+#        u64     aad_len, /* Length of AAD in bytes. With RFC4106 this is going to be 8 or 12 Bytes */
+#        u8      *auth_tag, /* Authenticated Tag output. */
+#        u64     auth_tag_len)# /* Authenticated Tag Length in bytes.
+#                              Valid values are 16 (most likely), 12 or 8. */
+###############################################################################
+ENTRY(aesni_gcm_dec_avx_gen4)
+        GCM_ENC_DEC_AVX2     DEC
+       ret
+ENDPROC(aesni_gcm_dec_avx_gen4)
+
+#endif /* CONFIG_AS_AVX2 */
index 835488b745eed5ce9484a40dfe56bf839f51d33d..948ad0e77741ca87836d7ea54bb211a41c590afc 100644 (file)
@@ -101,6 +101,9 @@ asmlinkage void aesni_cbc_dec(struct crypto_aes_ctx *ctx, u8 *out,
 int crypto_fpu_init(void);
 void crypto_fpu_exit(void);
 
+#define AVX_GEN2_OPTSIZE 640
+#define AVX_GEN4_OPTSIZE 4096
+
 #ifdef CONFIG_X86_64
 asmlinkage void aesni_ctr_enc(struct crypto_aes_ctx *ctx, u8 *out,
                              const u8 *in, unsigned int len, u8 *iv);
@@ -150,6 +153,123 @@ asmlinkage void aesni_gcm_dec(void *ctx, u8 *out,
                        u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
                        u8 *auth_tag, unsigned long auth_tag_len);
 
+
+#ifdef CONFIG_AS_AVX
+/*
+ * asmlinkage void aesni_gcm_precomp_avx_gen2()
+ * gcm_data *my_ctx_data, context data
+ * u8 *hash_subkey,  the Hash sub key input. Data starts on a 16-byte boundary.
+ */
+asmlinkage void aesni_gcm_precomp_avx_gen2(void *my_ctx_data, u8 *hash_subkey);
+
+asmlinkage void aesni_gcm_enc_avx_gen2(void *ctx, u8 *out,
+                       const u8 *in, unsigned long plaintext_len, u8 *iv,
+                       const u8 *aad, unsigned long aad_len,
+                       u8 *auth_tag, unsigned long auth_tag_len);
+
+asmlinkage void aesni_gcm_dec_avx_gen2(void *ctx, u8 *out,
+                       const u8 *in, unsigned long ciphertext_len, u8 *iv,
+                       const u8 *aad, unsigned long aad_len,
+                       u8 *auth_tag, unsigned long auth_tag_len);
+
+static void aesni_gcm_enc_avx(void *ctx, u8 *out,
+                       const u8 *in, unsigned long plaintext_len, u8 *iv,
+                       u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
+                       u8 *auth_tag, unsigned long auth_tag_len)
+{
+       if (plaintext_len < AVX_GEN2_OPTSIZE) {
+               aesni_gcm_enc(ctx, out, in, plaintext_len, iv, hash_subkey, aad,
+                               aad_len, auth_tag, auth_tag_len);
+       } else {
+               aesni_gcm_precomp_avx_gen2(ctx, hash_subkey);
+               aesni_gcm_enc_avx_gen2(ctx, out, in, plaintext_len, iv, aad,
+                                       aad_len, auth_tag, auth_tag_len);
+       }
+}
+
+static void aesni_gcm_dec_avx(void *ctx, u8 *out,
+                       const u8 *in, unsigned long ciphertext_len, u8 *iv,
+                       u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
+                       u8 *auth_tag, unsigned long auth_tag_len)
+{
+       if (ciphertext_len < AVX_GEN2_OPTSIZE) {
+               aesni_gcm_dec(ctx, out, in, ciphertext_len, iv, hash_subkey, aad,
+                               aad_len, auth_tag, auth_tag_len);
+       } else {
+               aesni_gcm_precomp_avx_gen2(ctx, hash_subkey);
+               aesni_gcm_dec_avx_gen2(ctx, out, in, ciphertext_len, iv, aad,
+                                       aad_len, auth_tag, auth_tag_len);
+       }
+}
+#endif
+
+#ifdef CONFIG_AS_AVX2
+/*
+ * asmlinkage void aesni_gcm_precomp_avx_gen4()
+ * gcm_data *my_ctx_data, context data
+ * u8 *hash_subkey,  the Hash sub key input. Data starts on a 16-byte boundary.
+ */
+asmlinkage void aesni_gcm_precomp_avx_gen4(void *my_ctx_data, u8 *hash_subkey);
+
+asmlinkage void aesni_gcm_enc_avx_gen4(void *ctx, u8 *out,
+                       const u8 *in, unsigned long plaintext_len, u8 *iv,
+                       const u8 *aad, unsigned long aad_len,
+                       u8 *auth_tag, unsigned long auth_tag_len);
+
+asmlinkage void aesni_gcm_dec_avx_gen4(void *ctx, u8 *out,
+                       const u8 *in, unsigned long ciphertext_len, u8 *iv,
+                       const u8 *aad, unsigned long aad_len,
+                       u8 *auth_tag, unsigned long auth_tag_len);
+
+static void aesni_gcm_enc_avx2(void *ctx, u8 *out,
+                       const u8 *in, unsigned long plaintext_len, u8 *iv,
+                       u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
+                       u8 *auth_tag, unsigned long auth_tag_len)
+{
+       if (plaintext_len < AVX_GEN2_OPTSIZE) {
+               aesni_gcm_enc(ctx, out, in, plaintext_len, iv, hash_subkey, aad,
+                               aad_len, auth_tag, auth_tag_len);
+       } else if (plaintext_len < AVX_GEN4_OPTSIZE) {
+               aesni_gcm_precomp_avx_gen2(ctx, hash_subkey);
+               aesni_gcm_enc_avx_gen2(ctx, out, in, plaintext_len, iv, aad,
+                                       aad_len, auth_tag, auth_tag_len);
+       } else {
+               aesni_gcm_precomp_avx_gen4(ctx, hash_subkey);
+               aesni_gcm_enc_avx_gen4(ctx, out, in, plaintext_len, iv, aad,
+                                       aad_len, auth_tag, auth_tag_len);
+       }
+}
+
+static void aesni_gcm_dec_avx2(void *ctx, u8 *out,
+                       const u8 *in, unsigned long ciphertext_len, u8 *iv,
+                       u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
+                       u8 *auth_tag, unsigned long auth_tag_len)
+{
+       if (ciphertext_len < AVX_GEN2_OPTSIZE) {
+               aesni_gcm_dec(ctx, out, in, ciphertext_len, iv, hash_subkey,
+                               aad, aad_len, auth_tag, auth_tag_len);
+       } else if (ciphertext_len < AVX_GEN4_OPTSIZE) {
+               aesni_gcm_precomp_avx_gen2(ctx, hash_subkey);
+               aesni_gcm_dec_avx_gen2(ctx, out, in, ciphertext_len, iv, aad,
+                                       aad_len, auth_tag, auth_tag_len);
+       } else {
+               aesni_gcm_precomp_avx_gen4(ctx, hash_subkey);
+               aesni_gcm_dec_avx_gen4(ctx, out, in, ciphertext_len, iv, aad,
+                                       aad_len, auth_tag, auth_tag_len);
+       }
+}
+#endif
+
+static void (*aesni_gcm_enc_tfm)(void *ctx, u8 *out,
+                       const u8 *in, unsigned long plaintext_len, u8 *iv,
+                       u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
+                       u8 *auth_tag, unsigned long auth_tag_len);
+
+static void (*aesni_gcm_dec_tfm)(void *ctx, u8 *out,
+                       const u8 *in, unsigned long ciphertext_len, u8 *iv,
+                       u8 *hash_subkey, const u8 *aad, unsigned long aad_len,
+                       u8 *auth_tag, unsigned long auth_tag_len);
+
 static inline struct
 aesni_rfc4106_gcm_ctx *aesni_rfc4106_gcm_ctx_get(struct crypto_aead *tfm)
 {
@@ -915,7 +1035,7 @@ static int __driver_rfc4106_encrypt(struct aead_request *req)
                dst = src;
        }
 
-       aesni_gcm_enc(aes_ctx, dst, src, (unsigned long)req->cryptlen, iv,
+       aesni_gcm_enc_tfm(aes_ctx, dst, src, (unsigned long)req->cryptlen, iv,
                ctx->hash_subkey, assoc, (unsigned long)req->assoclen, dst
                + ((unsigned long)req->cryptlen), auth_tag_len);
 
@@ -996,12 +1116,12 @@ static int __driver_rfc4106_decrypt(struct aead_request *req)
                dst = src;
        }
 
-       aesni_gcm_dec(aes_ctx, dst, src, tempCipherLen, iv,
+       aesni_gcm_dec_tfm(aes_ctx, dst, src, tempCipherLen, iv,
                ctx->hash_subkey, assoc, (unsigned long)req->assoclen,
                authTag, auth_tag_len);
 
        /* Compare generated tag with passed in tag. */
-       retval = memcmp(src + tempCipherLen, authTag, auth_tag_len) ?
+       retval = crypto_memneq(src + tempCipherLen, authTag, auth_tag_len) ?
                -EBADMSG : 0;
 
        if (one_entry_in_sg) {
@@ -1353,6 +1473,27 @@ static int __init aesni_init(void)
 
        if (!x86_match_cpu(aesni_cpu_id))
                return -ENODEV;
+#ifdef CONFIG_X86_64
+#ifdef CONFIG_AS_AVX2
+       if (boot_cpu_has(X86_FEATURE_AVX2)) {
+               pr_info("AVX2 version of gcm_enc/dec engaged.\n");
+               aesni_gcm_enc_tfm = aesni_gcm_enc_avx2;
+               aesni_gcm_dec_tfm = aesni_gcm_dec_avx2;
+       } else
+#endif
+#ifdef CONFIG_AS_AVX
+       if (boot_cpu_has(X86_FEATURE_AVX)) {
+               pr_info("AVX version of gcm_enc/dec engaged.\n");
+               aesni_gcm_enc_tfm = aesni_gcm_enc_avx;
+               aesni_gcm_dec_tfm = aesni_gcm_dec_avx;
+       } else
+#endif
+       {
+               pr_info("SSE version of gcm_enc/dec engaged.\n");
+               aesni_gcm_enc_tfm = aesni_gcm_enc;
+               aesni_gcm_dec_tfm = aesni_gcm_dec;
+       }
+#endif
 
        err = crypto_fpu_init();
        if (err)
index 989c510da8cc98af911976874d6c16db865ee1b3..b29402a7b9b581227e57f68e362b474350fd0da4 100644 (file)
@@ -2,11 +2,6 @@
 # Cryptographic API
 #
 
-# memneq MUST be built with -Os or -O0 to prevent early-return optimizations
-# that will defeat memneq's actual purpose to prevent timing attacks.
-CFLAGS_REMOVE_memneq.o := -O1 -O2 -O3
-CFLAGS_memneq.o := -Os
-
 obj-$(CONFIG_CRYPTO) += crypto.o
 crypto-y := api.o cipher.o compress.o memneq.o
 
index 793a27f2493e5287c1275df40feaca7b7b14c87e..a92dc382f7813eb2d8e3c7354e126c1987fedb0d 100644 (file)
@@ -213,7 +213,10 @@ static void ahash_op_unaligned_done(struct crypto_async_request *req, int err)
 
        ahash_op_unaligned_finish(areq, err);
 
-       complete(data, err);
+       areq->base.complete = complete;
+       areq->base.data = data;
+
+       complete(&areq->base, err);
 }
 
 static int ahash_op_unaligned(struct ahash_request *req,
index cd0162221c141855fcaf1920ceb9466a6baf875a..afed1bd16aee0b53f63a4bdc11aecab56927821d 100644 (file)
@@ -72,6 +72,7 @@ __crypto_memneq_generic(const void *a, const void *b, size_t size)
 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
        while (size >= sizeof(unsigned long)) {
                neq |= *(unsigned long *)a ^ *(unsigned long *)b;
+               OPTIMIZER_HIDE_VAR(neq);
                a += sizeof(unsigned long);
                b += sizeof(unsigned long);
                size -= sizeof(unsigned long);
@@ -79,6 +80,7 @@ __crypto_memneq_generic(const void *a, const void *b, size_t size)
 #endif /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
        while (size > 0) {
                neq |= *(unsigned char *)a ^ *(unsigned char *)b;
+               OPTIMIZER_HIDE_VAR(neq);
                a += 1;
                b += 1;
                size -= 1;
@@ -89,33 +91,61 @@ __crypto_memneq_generic(const void *a, const void *b, size_t size)
 /* Loop-free fast-path for frequently used 16-byte size */
 static inline unsigned long __crypto_memneq_16(const void *a, const void *b)
 {
+       unsigned long neq = 0;
+
 #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
-       if (sizeof(unsigned long) == 8)
-               return ((*(unsigned long *)(a)   ^ *(unsigned long *)(b))
-                     | (*(unsigned long *)(a+8) ^ *(unsigned long *)(b+8)));
-       else if (sizeof(unsigned int) == 4)
-               return ((*(unsigned int *)(a)    ^ *(unsigned int *)(b))
-                      | (*(unsigned int *)(a+4)  ^ *(unsigned int *)(b+4))
-                     | (*(unsigned int *)(a+8)  ^ *(unsigned int *)(b+8))
-                     | (*(unsigned int *)(a+12) ^ *(unsigned int *)(b+12)));
-       else
+       if (sizeof(unsigned long) == 8) {
+               neq |= *(unsigned long *)(a)   ^ *(unsigned long *)(b);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned long *)(a+8) ^ *(unsigned long *)(b+8);
+               OPTIMIZER_HIDE_VAR(neq);
+       } else if (sizeof(unsigned int) == 4) {
+               neq |= *(unsigned int *)(a)    ^ *(unsigned int *)(b);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned int *)(a+4)  ^ *(unsigned int *)(b+4);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned int *)(a+8)  ^ *(unsigned int *)(b+8);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned int *)(a+12) ^ *(unsigned int *)(b+12);
+               OPTIMIZER_HIDE_VAR(neq);
+       } else
 #endif /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
-               return ((*(unsigned char *)(a)    ^ *(unsigned char *)(b))
-                     | (*(unsigned char *)(a+1)  ^ *(unsigned char *)(b+1))
-                     | (*(unsigned char *)(a+2)  ^ *(unsigned char *)(b+2))
-                     | (*(unsigned char *)(a+3)  ^ *(unsigned char *)(b+3))
-                     | (*(unsigned char *)(a+4)  ^ *(unsigned char *)(b+4))
-                     | (*(unsigned char *)(a+5)  ^ *(unsigned char *)(b+5))
-                     | (*(unsigned char *)(a+6)  ^ *(unsigned char *)(b+6))
-                     | (*(unsigned char *)(a+7)  ^ *(unsigned char *)(b+7))
-                     | (*(unsigned char *)(a+8)  ^ *(unsigned char *)(b+8))
-                     | (*(unsigned char *)(a+9)  ^ *(unsigned char *)(b+9))
-                     | (*(unsigned char *)(a+10) ^ *(unsigned char *)(b+10))
-                     | (*(unsigned char *)(a+11) ^ *(unsigned char *)(b+11))
-                     | (*(unsigned char *)(a+12) ^ *(unsigned char *)(b+12))
-                     | (*(unsigned char *)(a+13) ^ *(unsigned char *)(b+13))
-                     | (*(unsigned char *)(a+14) ^ *(unsigned char *)(b+14))
-                     | (*(unsigned char *)(a+15) ^ *(unsigned char *)(b+15)));
+       {
+               neq |= *(unsigned char *)(a)    ^ *(unsigned char *)(b);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+1)  ^ *(unsigned char *)(b+1);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+2)  ^ *(unsigned char *)(b+2);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+3)  ^ *(unsigned char *)(b+3);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+4)  ^ *(unsigned char *)(b+4);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+5)  ^ *(unsigned char *)(b+5);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+6)  ^ *(unsigned char *)(b+6);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+7)  ^ *(unsigned char *)(b+7);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+8)  ^ *(unsigned char *)(b+8);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+9)  ^ *(unsigned char *)(b+9);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+10) ^ *(unsigned char *)(b+10);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+11) ^ *(unsigned char *)(b+11);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+12) ^ *(unsigned char *)(b+12);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+13) ^ *(unsigned char *)(b+13);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+14) ^ *(unsigned char *)(b+14);
+               OPTIMIZER_HIDE_VAR(neq);
+               neq |= *(unsigned char *)(a+15) ^ *(unsigned char *)(b+15);
+               OPTIMIZER_HIDE_VAR(neq);
+       }
+
+       return neq;
 }
 
 /* Compare two areas of memory without leaking timing information,
index f8c920cafe639c8451349e15b3f1e22e19da80e4..309d345ead9582896bde8c5f5c170bf5d0315f66 100644 (file)
@@ -78,7 +78,7 @@ static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu,
        cpu = *cb_cpu;
 
        rcu_read_lock_bh();
-       cpumask = rcu_dereference(pcrypt->cb_cpumask);
+       cpumask = rcu_dereference_bh(pcrypt->cb_cpumask);
        if (cpumask_test_cpu(cpu, cpumask->mask))
                        goto out;
 
index 001f07cdb828d59101521162109b9f101c34a319..0d9003ae8c61402e027ab4b5bfc933442478b966 100644 (file)
@@ -137,7 +137,272 @@ out:
        return ret;
 }
 
+static int test_aead_jiffies(struct aead_request *req, int enc,
+                               int blen, int sec)
+{
+       unsigned long start, end;
+       int bcount;
+       int ret;
+
+       for (start = jiffies, end = start + sec * HZ, bcount = 0;
+            time_before(jiffies, end); bcount++) {
+               if (enc)
+                       ret = crypto_aead_encrypt(req);
+               else
+                       ret = crypto_aead_decrypt(req);
+
+               if (ret)
+                       return ret;
+       }
+
+       printk("%d operations in %d seconds (%ld bytes)\n",
+              bcount, sec, (long)bcount * blen);
+       return 0;
+}
+
+static int test_aead_cycles(struct aead_request *req, int enc, int blen)
+{
+       unsigned long cycles = 0;
+       int ret = 0;
+       int i;
+
+       local_irq_disable();
+
+       /* Warm-up run. */
+       for (i = 0; i < 4; i++) {
+               if (enc)
+                       ret = crypto_aead_encrypt(req);
+               else
+                       ret = crypto_aead_decrypt(req);
+
+               if (ret)
+                       goto out;
+       }
+
+       /* The real thing. */
+       for (i = 0; i < 8; i++) {
+               cycles_t start, end;
+
+               start = get_cycles();
+               if (enc)
+                       ret = crypto_aead_encrypt(req);
+               else
+                       ret = crypto_aead_decrypt(req);
+               end = get_cycles();
+
+               if (ret)
+                       goto out;
+
+               cycles += end - start;
+       }
+
+out:
+       local_irq_enable();
+
+       if (ret == 0)
+               printk("1 operation in %lu cycles (%d bytes)\n",
+                      (cycles + 4) / 8, blen);
+
+       return ret;
+}
+
 static u32 block_sizes[] = { 16, 64, 256, 1024, 8192, 0 };
+static u32 aead_sizes[] = { 16, 64, 256, 512, 1024, 2048, 4096, 8192, 0 };
+
+#define XBUFSIZE 8
+#define MAX_IVLEN 32
+
+static int testmgr_alloc_buf(char *buf[XBUFSIZE])
+{
+       int i;
+
+       for (i = 0; i < XBUFSIZE; i++) {
+               buf[i] = (void *)__get_free_page(GFP_KERNEL);
+               if (!buf[i])
+                       goto err_free_buf;
+       }
+
+       return 0;
+
+err_free_buf:
+       while (i-- > 0)
+               free_page((unsigned long)buf[i]);
+
+       return -ENOMEM;
+}
+
+static void testmgr_free_buf(char *buf[XBUFSIZE])
+{
+       int i;
+
+       for (i = 0; i < XBUFSIZE; i++)
+               free_page((unsigned long)buf[i]);
+}
+
+static void sg_init_aead(struct scatterlist *sg, char *xbuf[XBUFSIZE],
+                       unsigned int buflen)
+{
+       int np = (buflen + PAGE_SIZE - 1)/PAGE_SIZE;
+       int k, rem;
+
+       np = (np > XBUFSIZE) ? XBUFSIZE : np;
+       rem = buflen % PAGE_SIZE;
+       if (np > XBUFSIZE) {
+               rem = PAGE_SIZE;
+               np = XBUFSIZE;
+       }
+       sg_init_table(sg, np);
+       for (k = 0; k < np; ++k) {
+               if (k == (np-1))
+                       sg_set_buf(&sg[k], xbuf[k], rem);
+               else
+                       sg_set_buf(&sg[k], xbuf[k], PAGE_SIZE);
+       }
+}
+
+static void test_aead_speed(const char *algo, int enc, unsigned int sec,
+                           struct aead_speed_template *template,
+                           unsigned int tcount, u8 authsize,
+                           unsigned int aad_size, u8 *keysize)
+{
+       unsigned int i, j;
+       struct crypto_aead *tfm;
+       int ret = -ENOMEM;
+       const char *key;
+       struct aead_request *req;
+       struct scatterlist *sg;
+       struct scatterlist *asg;
+       struct scatterlist *sgout;
+       const char *e;
+       void *assoc;
+       char iv[MAX_IVLEN];
+       char *xbuf[XBUFSIZE];
+       char *xoutbuf[XBUFSIZE];
+       char *axbuf[XBUFSIZE];
+       unsigned int *b_size;
+       unsigned int iv_len;
+
+       if (enc == ENCRYPT)
+               e = "encryption";
+       else
+               e = "decryption";
+
+       if (testmgr_alloc_buf(xbuf))
+               goto out_noxbuf;
+       if (testmgr_alloc_buf(axbuf))
+               goto out_noaxbuf;
+       if (testmgr_alloc_buf(xoutbuf))
+               goto out_nooutbuf;
+
+       sg = kmalloc(sizeof(*sg) * 8 * 3, GFP_KERNEL);
+       if (!sg)
+               goto out_nosg;
+       asg = &sg[8];
+       sgout = &asg[8];
+
+
+       printk(KERN_INFO "\ntesting speed of %s %s\n", algo, e);
+
+       tfm = crypto_alloc_aead(algo, 0, 0);
+
+       if (IS_ERR(tfm)) {
+               pr_err("alg: aead: Failed to load transform for %s: %ld\n", algo,
+                      PTR_ERR(tfm));
+               return;
+       }
+
+       req = aead_request_alloc(tfm, GFP_KERNEL);
+       if (!req) {
+               pr_err("alg: aead: Failed to allocate request for %s\n",
+                      algo);
+               goto out;
+       }
+
+       i = 0;
+       do {
+               b_size = aead_sizes;
+               do {
+                       assoc = axbuf[0];
+
+                       if (aad_size < PAGE_SIZE)
+                               memset(assoc, 0xff, aad_size);
+                       else {
+                               pr_err("associate data length (%u) too big\n",
+                                       aad_size);
+                               goto out_nosg;
+                       }
+                       sg_init_one(&asg[0], assoc, aad_size);
+
+                       if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) {
+                               pr_err("template (%u) too big for tvmem (%lu)\n",
+                                      *keysize + *b_size,
+                                       TVMEMSIZE * PAGE_SIZE);
+                               goto out;
+                       }
+
+                       key = tvmem[0];
+                       for (j = 0; j < tcount; j++) {
+                               if (template[j].klen == *keysize) {
+                                       key = template[j].key;
+                                       break;
+                               }
+                       }
+                       ret = crypto_aead_setkey(tfm, key, *keysize);
+                       ret = crypto_aead_setauthsize(tfm, authsize);
+
+                       iv_len = crypto_aead_ivsize(tfm);
+                       if (iv_len)
+                               memset(&iv, 0xff, iv_len);
+
+                       crypto_aead_clear_flags(tfm, ~0);
+                       printk(KERN_INFO "test %u (%d bit key, %d byte blocks): ",
+                                       i, *keysize * 8, *b_size);
+
+
+                       memset(tvmem[0], 0xff, PAGE_SIZE);
+
+                       if (ret) {
+                               pr_err("setkey() failed flags=%x\n",
+                                               crypto_aead_get_flags(tfm));
+                               goto out;
+                       }
+
+                       sg_init_aead(&sg[0], xbuf,
+                                   *b_size + (enc ? authsize : 0));
+
+                       sg_init_aead(&sgout[0], xoutbuf,
+                                   *b_size + (enc ? authsize : 0));
+
+                       aead_request_set_crypt(req, sg, sgout, *b_size, iv);
+                       aead_request_set_assoc(req, asg, aad_size);
+
+                       if (sec)
+                               ret = test_aead_jiffies(req, enc, *b_size, sec);
+                       else
+                               ret = test_aead_cycles(req, enc, *b_size);
+
+                       if (ret) {
+                               pr_err("%s() failed return code=%d\n", e, ret);
+                               break;
+                       }
+                       b_size++;
+                       i++;
+               } while (*b_size);
+               keysize++;
+       } while (*keysize);
+
+out:
+       crypto_free_aead(tfm);
+       kfree(sg);
+out_nosg:
+       testmgr_free_buf(xoutbuf);
+out_nooutbuf:
+       testmgr_free_buf(axbuf);
+out_noaxbuf:
+       testmgr_free_buf(xbuf);
+out_noxbuf:
+       return;
+}
 
 static void test_cipher_speed(const char *algo, int enc, unsigned int sec,
                              struct cipher_speed_template *template,
@@ -1427,6 +1692,11 @@ static int do_test(int m)
                                  speed_template_32_64);
                break;
 
+       case 211:
+               test_aead_speed("rfc4106(gcm(aes))", ENCRYPT, sec,
+                               NULL, 0, 16, 8, aead_speed_template_20);
+               break;
+
        case 300:
                /* fall through */
 
index ecdeeb1a7b05116301c2b6bf315319e463d09264..6c7e21a09f78f170905abf74a897c21dee7a39e9 100644 (file)
@@ -22,6 +22,11 @@ struct cipher_speed_template {
        unsigned int klen;
 };
 
+struct aead_speed_template {
+       const char *key;
+       unsigned int klen;
+};
+
 struct hash_speed {
        unsigned int blen;      /* buffer length */
        unsigned int plen;      /* per-update length */
@@ -57,6 +62,11 @@ static u8 speed_template_32_48[] = {32, 48, 0};
 static u8 speed_template_32_48_64[] = {32, 48, 64, 0};
 static u8 speed_template_32_64[] = {32, 64, 0};
 
+/*
+ * AEAD speed tests
+ */
+static u8 aead_speed_template_20[] = {20, 0};
+
 /*
  * Digest speed tests
  */
index 3cc8214f9b26630e86eddcb37ac35f7a5f57e4a1..8e3b8b06c0b2e26a90308b9f15457bfa9da06b13 100644 (file)
@@ -118,7 +118,7 @@ obj-$(CONFIG_SGI_SN)                += sn/
 obj-y                          += firmware/
 obj-$(CONFIG_CRYPTO)           += crypto/
 obj-$(CONFIG_SUPERH)           += sh/
-obj-$(CONFIG_ARCH_SHMOBILE)    += sh/
+obj-$(CONFIG_ARCH_SHMOBILE_LEGACY)     += sh/
 ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 obj-y                          += clocksource/
 endif
index c4876ac9151a56bc95a05df647e0850cea3182c4..9e602910560725acb6a2df4da885bde5312c9919 100644 (file)
@@ -83,162 +83,6 @@ static struct device_attribute amba_dev_attrs[] = {
        __ATTR_NULL,
 };
 
-#ifdef CONFIG_PM_SLEEP
-
-static int amba_legacy_suspend(struct device *dev, pm_message_t mesg)
-{
-       struct amba_driver *adrv = to_amba_driver(dev->driver);
-       struct amba_device *adev = to_amba_device(dev);
-       int ret = 0;
-
-       if (dev->driver && adrv->suspend)
-               ret = adrv->suspend(adev, mesg);
-
-       return ret;
-}
-
-static int amba_legacy_resume(struct device *dev)
-{
-       struct amba_driver *adrv = to_amba_driver(dev->driver);
-       struct amba_device *adev = to_amba_device(dev);
-       int ret = 0;
-
-       if (dev->driver && adrv->resume)
-               ret = adrv->resume(adev);
-
-       return ret;
-}
-
-#endif /* CONFIG_PM_SLEEP */
-
-#ifdef CONFIG_SUSPEND
-
-static int amba_pm_suspend(struct device *dev)
-{
-       struct device_driver *drv = dev->driver;
-       int ret = 0;
-
-       if (!drv)
-               return 0;
-
-       if (drv->pm) {
-               if (drv->pm->suspend)
-                       ret = drv->pm->suspend(dev);
-       } else {
-               ret = amba_legacy_suspend(dev, PMSG_SUSPEND);
-       }
-
-       return ret;
-}
-
-static int amba_pm_resume(struct device *dev)
-{
-       struct device_driver *drv = dev->driver;
-       int ret = 0;
-
-       if (!drv)
-               return 0;
-
-       if (drv->pm) {
-               if (drv->pm->resume)
-                       ret = drv->pm->resume(dev);
-       } else {
-               ret = amba_legacy_resume(dev);
-       }
-
-       return ret;
-}
-
-#else /* !CONFIG_SUSPEND */
-
-#define amba_pm_suspend                NULL
-#define amba_pm_resume         NULL
-
-#endif /* !CONFIG_SUSPEND */
-
-#ifdef CONFIG_HIBERNATE_CALLBACKS
-
-static int amba_pm_freeze(struct device *dev)
-{
-       struct device_driver *drv = dev->driver;
-       int ret = 0;
-
-       if (!drv)
-               return 0;
-
-       if (drv->pm) {
-               if (drv->pm->freeze)
-                       ret = drv->pm->freeze(dev);
-       } else {
-               ret = amba_legacy_suspend(dev, PMSG_FREEZE);
-       }
-
-       return ret;
-}
-
-static int amba_pm_thaw(struct device *dev)
-{
-       struct device_driver *drv = dev->driver;
-       int ret = 0;
-
-       if (!drv)
-               return 0;
-
-       if (drv->pm) {
-               if (drv->pm->thaw)
-                       ret = drv->pm->thaw(dev);
-       } else {
-               ret = amba_legacy_resume(dev);
-       }
-
-       return ret;
-}
-
-static int amba_pm_poweroff(struct device *dev)
-{
-       struct device_driver *drv = dev->driver;
-       int ret = 0;
-
-       if (!drv)
-               return 0;
-
-       if (drv->pm) {
-               if (drv->pm->poweroff)
-                       ret = drv->pm->poweroff(dev);
-       } else {
-               ret = amba_legacy_suspend(dev, PMSG_HIBERNATE);
-       }
-
-       return ret;
-}
-
-static int amba_pm_restore(struct device *dev)
-{
-       struct device_driver *drv = dev->driver;
-       int ret = 0;
-
-       if (!drv)
-               return 0;
-
-       if (drv->pm) {
-               if (drv->pm->restore)
-                       ret = drv->pm->restore(dev);
-       } else {
-               ret = amba_legacy_resume(dev);
-       }
-
-       return ret;
-}
-
-#else /* !CONFIG_HIBERNATE_CALLBACKS */
-
-#define amba_pm_freeze         NULL
-#define amba_pm_thaw           NULL
-#define amba_pm_poweroff               NULL
-#define amba_pm_restore                NULL
-
-#endif /* !CONFIG_HIBERNATE_CALLBACKS */
-
 #ifdef CONFIG_PM_RUNTIME
 /*
  * Hooks to provide runtime PM of the pclk (bus clock).  It is safe to
@@ -251,7 +95,7 @@ static int amba_pm_runtime_suspend(struct device *dev)
        int ret = pm_generic_runtime_suspend(dev);
 
        if (ret == 0 && dev->driver)
-               clk_disable(pcdev->pclk);
+               clk_disable_unprepare(pcdev->pclk);
 
        return ret;
 }
@@ -262,7 +106,7 @@ static int amba_pm_runtime_resume(struct device *dev)
        int ret;
 
        if (dev->driver) {
-               ret = clk_enable(pcdev->pclk);
+               ret = clk_prepare_enable(pcdev->pclk);
                /* Failure is probably fatal to the system, but... */
                if (ret)
                        return ret;
@@ -272,15 +116,13 @@ static int amba_pm_runtime_resume(struct device *dev)
 }
 #endif
 
-#ifdef CONFIG_PM
-
 static const struct dev_pm_ops amba_pm = {
-       .suspend        = amba_pm_suspend,
-       .resume         = amba_pm_resume,
-       .freeze         = amba_pm_freeze,
-       .thaw           = amba_pm_thaw,
-       .poweroff       = amba_pm_poweroff,
-       .restore        = amba_pm_restore,
+       .suspend        = pm_generic_suspend,
+       .resume         = pm_generic_resume,
+       .freeze         = pm_generic_freeze,
+       .thaw           = pm_generic_thaw,
+       .poweroff       = pm_generic_poweroff,
+       .restore        = pm_generic_restore,
        SET_RUNTIME_PM_OPS(
                amba_pm_runtime_suspend,
                amba_pm_runtime_resume,
@@ -288,14 +130,6 @@ static const struct dev_pm_ops amba_pm = {
        )
 };
 
-#define AMBA_PM (&amba_pm)
-
-#else /* !CONFIG_PM */
-
-#define AMBA_PM        NULL
-
-#endif /* !CONFIG_PM */
-
 /*
  * Primecells are part of the Advanced Microcontroller Bus Architecture,
  * so we call the bus "amba".
@@ -305,7 +139,7 @@ struct bus_type amba_bustype = {
        .dev_attrs      = amba_dev_attrs,
        .match          = amba_match,
        .uevent         = amba_uevent,
-       .pm             = AMBA_PM,
+       .pm             = &amba_pm,
 };
 
 static int __init amba_init(void)
@@ -317,36 +151,23 @@ postcore_initcall(amba_init);
 
 static int amba_get_enable_pclk(struct amba_device *pcdev)
 {
-       struct clk *pclk = clk_get(&pcdev->dev, "apb_pclk");
        int ret;
 
-       pcdev->pclk = pclk;
-
-       if (IS_ERR(pclk))
-               return PTR_ERR(pclk);
+       pcdev->pclk = clk_get(&pcdev->dev, "apb_pclk");
+       if (IS_ERR(pcdev->pclk))
+               return PTR_ERR(pcdev->pclk);
 
-       ret = clk_prepare(pclk);
-       if (ret) {
-               clk_put(pclk);
-               return ret;
-       }
-
-       ret = clk_enable(pclk);
-       if (ret) {
-               clk_unprepare(pclk);
-               clk_put(pclk);
-       }
+       ret = clk_prepare_enable(pcdev->pclk);
+       if (ret)
+               clk_put(pcdev->pclk);
 
        return ret;
 }
 
 static void amba_put_disable_pclk(struct amba_device *pcdev)
 {
-       struct clk *pclk = pcdev->pclk;
-
-       clk_disable(pclk);
-       clk_unprepare(pclk);
-       clk_put(pclk);
+       clk_disable_unprepare(pcdev->pclk);
+       clk_put(pcdev->pclk);
 }
 
 /*
index 2394e9753ef56b47e93d91bd7499eeb657c51383..725c46162bbd1cb0ad05624502ad16030e5991ca 100644 (file)
@@ -588,12 +588,6 @@ static const struct mvebu_mbus_soc_data mv78xx0_mbus_data = {
        .show_cpu_target     = mvebu_sdram_debug_show_orion,
 };
 
-/*
- * The driver doesn't yet have a DT binding because the details of
- * this DT binding still need to be sorted out. However, as a
- * preparation, we already use of_device_id to match a SoC description
- * string against the SoC specific details of this driver.
- */
 static const struct of_device_id of_mvebu_mbus_ids[] = {
        { .compatible = "marvell,armada370-mbus",
          .data = &armada_370_xp_mbus_data, },
@@ -734,11 +728,11 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base,
 {
        const struct of_device_id *of_id;
 
-       for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++)
+       for (of_id = of_mvebu_mbus_ids; of_id->compatible[0]; of_id++)
                if (!strcmp(of_id->compatible, soc))
                        break;
 
-       if (!of_id->compatible) {
+       if (!of_id->compatible[0]) {
                pr_err("could not find a matching SoC family\n");
                return -ENODEV;
        }
index 5c51115081b3618e61c6a78df58aabec5af77853..7641965d208d62cab3aea35a6af460b8e3ea1c2a 100644 (file)
@@ -23,16 +23,6 @@ config COMMON_CLK
 menu "Common Clock Framework"
        depends on COMMON_CLK
 
-config COMMON_CLK_DEBUG
-       bool "DebugFS representation of clock tree"
-       select DEBUG_FS
-       ---help---
-         Creates a directory hierarchy in debugfs for visualizing the clk
-         tree structure.  Each directory contains read-only members
-         that export information specific to that clk node: clk_rate,
-         clk_flags, clk_prepare_count, clk_enable_count &
-         clk_notifier_count.
-
 config COMMON_CLK_WM831X
        tristate "Clock driver for WM831x/2x PMICs"
        depends on MFD_WM831X
@@ -64,6 +54,16 @@ config COMMON_CLK_SI5351
          This driver supports Silicon Labs 5351A/B/C programmable clock
          generators.
 
+config COMMON_CLK_SI570
+       tristate "Clock driver for SiLabs 570 and compatible devices"
+       depends on I2C
+       depends on OF
+       select REGMAP_I2C
+       help
+       ---help---
+         This driver supports Silicon Labs 570/571/598/599 programmable
+         clock generators.
+
 config COMMON_CLK_S2MPS11
        tristate "Clock driver for S2MPS11 MFD"
        depends on MFD_SEC_CORE
@@ -107,6 +107,8 @@ config COMMON_CLK_KEYSTONE
           Supports clock drivers for Keystone based SOCs. These SOCs have local
          a power sleep control module that gate the clock to the IPs and PLLs.
 
+source "drivers/clk/qcom/Kconfig"
+
 endmenu
 
 source "drivers/clk/mvebu/Kconfig"
index 7a10bc9a23e7b3f11403a1e500504b80715c3557..0c16e9cdfb87857c3fd528eebefa72f4af28f629 100644 (file)
@@ -14,13 +14,14 @@ obj-$(CONFIG_ARCH_BCM2835)  += clk-bcm2835.o
 obj-$(CONFIG_ARCH_EFM32)       += clk-efm32gg.o
 obj-$(CONFIG_ARCH_NOMADIK)     += clk-nomadik.o
 obj-$(CONFIG_ARCH_HIGHBANK)    += clk-highbank.o
+obj-$(CONFIG_ARCH_HI3xxx)      += hisilicon/
 obj-$(CONFIG_ARCH_NSPIRE)      += clk-nspire.o
 obj-$(CONFIG_ARCH_MXS)         += mxs/
 obj-$(CONFIG_ARCH_SOCFPGA)     += socfpga/
 obj-$(CONFIG_PLAT_SPEAR)       += spear/
 obj-$(CONFIG_ARCH_U300)                += clk-u300.o
 obj-$(CONFIG_COMMON_CLK_VERSATILE) += versatile/
-obj-$(CONFIG_ARCH_SIRF)                += clk-prima2.o
+obj-$(CONFIG_COMMON_CLK_QCOM)  += qcom/
 obj-$(CONFIG_PLAT_ORION)       += mvebu/
 ifeq ($(CONFIG_COMMON_CLK), y)
 obj-$(CONFIG_ARCH_MMP)         += mmp/
@@ -30,11 +31,14 @@ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
 obj-$(CONFIG_ARCH_SUNXI)       += sunxi/
 obj-$(CONFIG_ARCH_U8500)       += ux500/
 obj-$(CONFIG_ARCH_VT8500)      += clk-vt8500.o
+obj-$(CONFIG_ARCH_SIRF)                += sirf/
 obj-$(CONFIG_ARCH_ZYNQ)                += zynq/
 obj-$(CONFIG_ARCH_TEGRA)       += tegra/
 obj-$(CONFIG_PLAT_SAMSUNG)     += samsung/
 obj-$(CONFIG_COMMON_CLK_XGENE)  += clk-xgene.o
 obj-$(CONFIG_COMMON_CLK_KEYSTONE)      += keystone/
+obj-$(CONFIG_COMMON_CLK_AT91)  += at91/
+obj-$(CONFIG_ARCH_SHMOBILE_MULTI)      += shmobile/
 
 obj-$(CONFIG_X86)              += x86/
 
@@ -43,6 +47,7 @@ obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o
 obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o
 obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o
 obj-$(CONFIG_COMMON_CLK_SI5351) += clk-si5351.o
+obj-$(CONFIG_COMMON_CLK_SI570) += clk-si570.o
 obj-$(CONFIG_COMMON_CLK_S2MPS11) += clk-s2mps11.o
 obj-$(CONFIG_CLK_TWL6040)      += clk-twl6040.o
 obj-$(CONFIG_CLK_PPC_CORENET)  += clk-ppc-corenet.o
diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
new file mode 100644 (file)
index 0000000..46c1d3d
--- /dev/null
@@ -0,0 +1,11 @@
+#
+# Makefile for at91 specific clk
+#
+
+obj-y += pmc.o
+obj-y += clk-main.o clk-pll.o clk-plldiv.o clk-master.o
+obj-y += clk-system.o clk-peripheral.o clk-programmable.o
+
+obj-$(CONFIG_HAVE_AT91_UTMI)           += clk-utmi.o
+obj-$(CONFIG_HAVE_AT91_USB_CLK)                += clk-usb.o
+obj-$(CONFIG_HAVE_AT91_SMD)            += clk-smd.o
diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
new file mode 100644 (file)
index 0000000..8e9e8cc
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/at91_pmc.h>
+#include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/io.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+
+#include "pmc.h"
+
+#define SLOW_CLOCK_FREQ                32768
+#define MAINF_DIV              16
+#define MAINFRDY_TIMEOUT       (((MAINF_DIV + 1) * USEC_PER_SEC) / \
+                                SLOW_CLOCK_FREQ)
+#define MAINF_LOOP_MIN_WAIT    (USEC_PER_SEC / SLOW_CLOCK_FREQ)
+#define MAINF_LOOP_MAX_WAIT    MAINFRDY_TIMEOUT
+
+struct clk_main {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+       unsigned long rate;
+       unsigned int irq;
+       wait_queue_head_t wait;
+};
+
+#define to_clk_main(hw) container_of(hw, struct clk_main, hw)
+
+static irqreturn_t clk_main_irq_handler(int irq, void *dev_id)
+{
+       struct clk_main *clkmain = (struct clk_main *)dev_id;
+
+       wake_up(&clkmain->wait);
+       disable_irq_nosync(clkmain->irq);
+
+       return IRQ_HANDLED;
+}
+
+static int clk_main_prepare(struct clk_hw *hw)
+{
+       struct clk_main *clkmain = to_clk_main(hw);
+       struct at91_pmc *pmc = clkmain->pmc;
+       unsigned long halt_time, timeout;
+       u32 tmp;
+
+       while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS)) {
+               enable_irq(clkmain->irq);
+               wait_event(clkmain->wait,
+                          pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS);
+       }
+
+       if (clkmain->rate)
+               return 0;
+
+       timeout = jiffies + usecs_to_jiffies(MAINFRDY_TIMEOUT);
+       do {
+               halt_time = jiffies;
+               tmp = pmc_read(pmc, AT91_CKGR_MCFR);
+               if (tmp & AT91_PMC_MAINRDY)
+                       return 0;
+               usleep_range(MAINF_LOOP_MIN_WAIT, MAINF_LOOP_MAX_WAIT);
+       } while (time_before(halt_time, timeout));
+
+       return 0;
+}
+
+static int clk_main_is_prepared(struct clk_hw *hw)
+{
+       struct clk_main *clkmain = to_clk_main(hw);
+
+       return !!(pmc_read(clkmain->pmc, AT91_PMC_SR) & AT91_PMC_MOSCS);
+}
+
+static unsigned long clk_main_recalc_rate(struct clk_hw *hw,
+                                         unsigned long parent_rate)
+{
+       u32 tmp;
+       struct clk_main *clkmain = to_clk_main(hw);
+       struct at91_pmc *pmc = clkmain->pmc;
+
+       if (clkmain->rate)
+               return clkmain->rate;
+
+       tmp = pmc_read(pmc, AT91_CKGR_MCFR) & AT91_PMC_MAINF;
+       clkmain->rate = (tmp * parent_rate) / MAINF_DIV;
+
+       return clkmain->rate;
+}
+
+static const struct clk_ops main_ops = {
+       .prepare = clk_main_prepare,
+       .is_prepared = clk_main_is_prepared,
+       .recalc_rate = clk_main_recalc_rate,
+};
+
+static struct clk * __init
+at91_clk_register_main(struct at91_pmc *pmc,
+                      unsigned int irq,
+                      const char *name,
+                      const char *parent_name,
+                      unsigned long rate)
+{
+       int ret;
+       struct clk_main *clkmain;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+
+       if (!pmc || !irq || !name)
+               return ERR_PTR(-EINVAL);
+
+       if (!rate && !parent_name)
+               return ERR_PTR(-EINVAL);
+
+       clkmain = kzalloc(sizeof(*clkmain), GFP_KERNEL);
+       if (!clkmain)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &main_ops;
+       init.parent_names = parent_name ? &parent_name : NULL;
+       init.num_parents = parent_name ? 1 : 0;
+       init.flags = parent_name ? 0 : CLK_IS_ROOT;
+
+       clkmain->hw.init = &init;
+       clkmain->rate = rate;
+       clkmain->pmc = pmc;
+       clkmain->irq = irq;
+       init_waitqueue_head(&clkmain->wait);
+       irq_set_status_flags(clkmain->irq, IRQ_NOAUTOEN);
+       ret = request_irq(clkmain->irq, clk_main_irq_handler,
+                         IRQF_TRIGGER_HIGH, "clk-main", clkmain);
+       if (ret)
+               return ERR_PTR(ret);
+
+       clk = clk_register(NULL, &clkmain->hw);
+       if (IS_ERR(clk)) {
+               free_irq(clkmain->irq, clkmain);
+               kfree(clkmain);
+       }
+
+       return clk;
+}
+
+
+
+static void __init
+of_at91_clk_main_setup(struct device_node *np, struct at91_pmc *pmc)
+{
+       struct clk *clk;
+       unsigned int irq;
+       const char *parent_name;
+       const char *name = np->name;
+       u32 rate = 0;
+
+       parent_name = of_clk_get_parent_name(np, 0);
+       of_property_read_string(np, "clock-output-names", &name);
+       of_property_read_u32(np, "clock-frequency", &rate);
+       irq = irq_of_parse_and_map(np, 0);
+       if (!irq)
+               return;
+
+       clk = at91_clk_register_main(pmc, irq, name, parent_name, rate);
+       if (IS_ERR(clk))
+               return;
+
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+}
+
+void __init of_at91rm9200_clk_main_setup(struct device_node *np,
+                                        struct at91_pmc *pmc)
+{
+       of_at91_clk_main_setup(np, pmc);
+}
diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
new file mode 100644 (file)
index 0000000..bd313f7
--- /dev/null
@@ -0,0 +1,270 @@
+/*
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/at91_pmc.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/io.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+
+#include "pmc.h"
+
+#define MASTER_SOURCE_MAX      4
+
+#define MASTER_PRES_MASK       0x7
+#define MASTER_PRES_MAX                MASTER_PRES_MASK
+#define MASTER_DIV_SHIFT       8
+#define MASTER_DIV_MASK                0x3
+
+struct clk_master_characteristics {
+       struct clk_range output;
+       u32 divisors[4];
+       u8 have_div3_pres;
+};
+
+struct clk_master_layout {
+       u32 mask;
+       u8 pres_shift;
+};
+
+#define to_clk_master(hw) container_of(hw, struct clk_master, hw)
+
+struct clk_master {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+       unsigned int irq;
+       wait_queue_head_t wait;
+       const struct clk_master_layout *layout;
+       const struct clk_master_characteristics *characteristics;
+};
+
+static irqreturn_t clk_master_irq_handler(int irq, void *dev_id)
+{
+       struct clk_master *master = (struct clk_master *)dev_id;
+
+       wake_up(&master->wait);
+       disable_irq_nosync(master->irq);
+
+       return IRQ_HANDLED;
+}
+static int clk_master_prepare(struct clk_hw *hw)
+{
+       struct clk_master *master = to_clk_master(hw);
+       struct at91_pmc *pmc = master->pmc;
+
+       while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY)) {
+               enable_irq(master->irq);
+               wait_event(master->wait,
+                          pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY);
+       }
+
+       return 0;
+}
+
+static int clk_master_is_prepared(struct clk_hw *hw)
+{
+       struct clk_master *master = to_clk_master(hw);
+
+       return !!(pmc_read(master->pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY);
+}
+
+static unsigned long clk_master_recalc_rate(struct clk_hw *hw,
+                                           unsigned long parent_rate)
+{
+       u8 pres;
+       u8 div;
+       unsigned long rate = parent_rate;
+       struct clk_master *master = to_clk_master(hw);
+       struct at91_pmc *pmc = master->pmc;
+       const struct clk_master_layout *layout = master->layout;
+       const struct clk_master_characteristics *characteristics =
+                                               master->characteristics;
+       u32 tmp;
+
+       pmc_lock(pmc);
+       tmp = pmc_read(pmc, AT91_PMC_MCKR) & layout->mask;
+       pmc_unlock(pmc);
+
+       pres = (tmp >> layout->pres_shift) & MASTER_PRES_MASK;
+       div = (tmp >> MASTER_DIV_SHIFT) & MASTER_DIV_MASK;
+
+       if (characteristics->have_div3_pres && pres == MASTER_PRES_MAX)
+               rate /= 3;
+       else
+               rate >>= pres;
+
+       rate /= characteristics->divisors[div];
+
+       if (rate < characteristics->output.min)
+               pr_warn("master clk is underclocked");
+       else if (rate > characteristics->output.max)
+               pr_warn("master clk is overclocked");
+
+       return rate;
+}
+
+static u8 clk_master_get_parent(struct clk_hw *hw)
+{
+       struct clk_master *master = to_clk_master(hw);
+       struct at91_pmc *pmc = master->pmc;
+
+       return pmc_read(pmc, AT91_PMC_MCKR) & AT91_PMC_CSS;
+}
+
+static const struct clk_ops master_ops = {
+       .prepare = clk_master_prepare,
+       .is_prepared = clk_master_is_prepared,
+       .recalc_rate = clk_master_recalc_rate,
+       .get_parent = clk_master_get_parent,
+};
+
+static struct clk * __init
+at91_clk_register_master(struct at91_pmc *pmc, unsigned int irq,
+               const char *name, int num_parents,
+               const char **parent_names,
+               const struct clk_master_layout *layout,
+               const struct clk_master_characteristics *characteristics)
+{
+       int ret;
+       struct clk_master *master;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+
+       if (!pmc || !irq || !name || !num_parents || !parent_names)
+               return ERR_PTR(-EINVAL);
+
+       master = kzalloc(sizeof(*master), GFP_KERNEL);
+       if (!master)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &master_ops;
+       init.parent_names = parent_names;
+       init.num_parents = num_parents;
+       init.flags = 0;
+
+       master->hw.init = &init;
+       master->layout = layout;
+       master->characteristics = characteristics;
+       master->pmc = pmc;
+       master->irq = irq;
+       init_waitqueue_head(&master->wait);
+       irq_set_status_flags(master->irq, IRQ_NOAUTOEN);
+       ret = request_irq(master->irq, clk_master_irq_handler,
+                         IRQF_TRIGGER_HIGH, "clk-master", master);
+       if (ret)
+               return ERR_PTR(ret);
+
+       clk = clk_register(NULL, &master->hw);
+       if (IS_ERR(clk))
+               kfree(master);
+
+       return clk;
+}
+
+
+static const struct clk_master_layout at91rm9200_master_layout = {
+       .mask = 0x31F,
+       .pres_shift = 2,
+};
+
+static const struct clk_master_layout at91sam9x5_master_layout = {
+       .mask = 0x373,
+       .pres_shift = 4,
+};
+
+
+static struct clk_master_characteristics * __init
+of_at91_clk_master_get_characteristics(struct device_node *np)
+{
+       struct clk_master_characteristics *characteristics;
+
+       characteristics = kzalloc(sizeof(*characteristics), GFP_KERNEL);
+       if (!characteristics)
+               return NULL;
+
+       if (of_at91_get_clk_range(np, "atmel,clk-output-range", &characteristics->output))
+               goto out_free_characteristics;
+
+       of_property_read_u32_array(np, "atmel,clk-divisors",
+                                  characteristics->divisors, 4);
+
+       characteristics->have_div3_pres =
+               of_property_read_bool(np, "atmel,master-clk-have-div3-pres");
+
+       return characteristics;
+
+out_free_characteristics:
+       kfree(characteristics);
+       return NULL;
+}
+
+static void __init
+of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,
+                        const struct clk_master_layout *layout)
+{
+       struct clk *clk;
+       int num_parents;
+       int i;
+       unsigned int irq;
+       const char *parent_names[MASTER_SOURCE_MAX];
+       const char *name = np->name;
+       struct clk_master_characteristics *characteristics;
+
+       num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+       if (num_parents <= 0 || num_parents > MASTER_SOURCE_MAX)
+               return;
+
+       for (i = 0; i < num_parents; ++i) {
+               parent_names[i] = of_clk_get_parent_name(np, i);
+               if (!parent_names[i])
+                       return;
+       }
+
+       of_property_read_string(np, "clock-output-names", &name);
+
+       characteristics = of_at91_clk_master_get_characteristics(np);
+       if (!characteristics)
+               return;
+
+       irq = irq_of_parse_and_map(np, 0);
+       if (!irq)
+               return;
+
+       clk = at91_clk_register_master(pmc, irq, name, num_parents,
+                                      parent_names, layout,
+                                      characteristics);
+       if (IS_ERR(clk))
+               goto out_free_characteristics;
+
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+       return;
+
+out_free_characteristics:
+       kfree(characteristics);
+}
+
+void __init of_at91rm9200_clk_master_setup(struct device_node *np,
+                                          struct at91_pmc *pmc)
+{
+       of_at91_clk_master_setup(np, pmc, &at91rm9200_master_layout);
+}
+
+void __init of_at91sam9x5_clk_master_setup(struct device_node *np,
+                                          struct at91_pmc *pmc)
+{
+       of_at91_clk_master_setup(np, pmc, &at91sam9x5_master_layout);
+}
diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c
new file mode 100644 (file)
index 0000000..597fed4
--- /dev/null
@@ -0,0 +1,410 @@
+/*
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/at91_pmc.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/io.h>
+
+#include "pmc.h"
+
+#define PERIPHERAL_MAX         64
+
+#define PERIPHERAL_AT91RM9200  0
+#define PERIPHERAL_AT91SAM9X5  1
+
+#define PERIPHERAL_ID_MIN      2
+#define PERIPHERAL_ID_MAX      31
+#define PERIPHERAL_MASK(id)    (1 << ((id) & PERIPHERAL_ID_MAX))
+
+#define PERIPHERAL_RSHIFT_MASK 0x3
+#define PERIPHERAL_RSHIFT(val) (((val) >> 16) & PERIPHERAL_RSHIFT_MASK)
+
+#define PERIPHERAL_MAX_SHIFT   4
+
+struct clk_peripheral {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+       u32 id;
+};
+
+#define to_clk_peripheral(hw) container_of(hw, struct clk_peripheral, hw)
+
+struct clk_sam9x5_peripheral {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+       struct clk_range range;
+       u32 id;
+       u32 div;
+       bool auto_div;
+};
+
+#define to_clk_sam9x5_peripheral(hw) \
+       container_of(hw, struct clk_sam9x5_peripheral, hw)
+
+static int clk_peripheral_enable(struct clk_hw *hw)
+{
+       struct clk_peripheral *periph = to_clk_peripheral(hw);
+       struct at91_pmc *pmc = periph->pmc;
+       int offset = AT91_PMC_PCER;
+       u32 id = periph->id;
+
+       if (id < PERIPHERAL_ID_MIN)
+               return 0;
+       if (id > PERIPHERAL_ID_MAX)
+               offset = AT91_PMC_PCER1;
+       pmc_write(pmc, offset, PERIPHERAL_MASK(id));
+       return 0;
+}
+
+static void clk_peripheral_disable(struct clk_hw *hw)
+{
+       struct clk_peripheral *periph = to_clk_peripheral(hw);
+       struct at91_pmc *pmc = periph->pmc;
+       int offset = AT91_PMC_PCDR;
+       u32 id = periph->id;
+
+       if (id < PERIPHERAL_ID_MIN)
+               return;
+       if (id > PERIPHERAL_ID_MAX)
+               offset = AT91_PMC_PCDR1;
+       pmc_write(pmc, offset, PERIPHERAL_MASK(id));
+}
+
+static int clk_peripheral_is_enabled(struct clk_hw *hw)
+{
+       struct clk_peripheral *periph = to_clk_peripheral(hw);
+       struct at91_pmc *pmc = periph->pmc;
+       int offset = AT91_PMC_PCSR;
+       u32 id = periph->id;
+
+       if (id < PERIPHERAL_ID_MIN)
+               return 1;
+       if (id > PERIPHERAL_ID_MAX)
+               offset = AT91_PMC_PCSR1;
+       return !!(pmc_read(pmc, offset) & PERIPHERAL_MASK(id));
+}
+
+static const struct clk_ops peripheral_ops = {
+       .enable = clk_peripheral_enable,
+       .disable = clk_peripheral_disable,
+       .is_enabled = clk_peripheral_is_enabled,
+};
+
+static struct clk * __init
+at91_clk_register_peripheral(struct at91_pmc *pmc, const char *name,
+                            const char *parent_name, u32 id)
+{
+       struct clk_peripheral *periph;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+
+       if (!pmc || !name || !parent_name || id > PERIPHERAL_ID_MAX)
+               return ERR_PTR(-EINVAL);
+
+       periph = kzalloc(sizeof(*periph), GFP_KERNEL);
+       if (!periph)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &peripheral_ops;
+       init.parent_names = (parent_name ? &parent_name : NULL);
+       init.num_parents = (parent_name ? 1 : 0);
+       init.flags = 0;
+
+       periph->id = id;
+       periph->hw.init = &init;
+       periph->pmc = pmc;
+
+       clk = clk_register(NULL, &periph->hw);
+       if (IS_ERR(clk))
+               kfree(periph);
+
+       return clk;
+}
+
+static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph)
+{
+       struct clk *parent;
+       unsigned long parent_rate;
+       int shift = 0;
+
+       if (!periph->auto_div)
+               return;
+
+       if (periph->range.max) {
+               parent = clk_get_parent_by_index(periph->hw.clk, 0);
+               parent_rate = __clk_get_rate(parent);
+               if (!parent_rate)
+                       return;
+
+               for (; shift < PERIPHERAL_MAX_SHIFT; shift++) {
+                       if (parent_rate >> shift <= periph->range.max)
+                               break;
+               }
+       }
+
+       periph->auto_div = false;
+       periph->div = shift;
+}
+
+static int clk_sam9x5_peripheral_enable(struct clk_hw *hw)
+{
+       struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
+       struct at91_pmc *pmc = periph->pmc;
+
+       if (periph->id < PERIPHERAL_ID_MIN)
+               return 0;
+
+       pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID) |
+                                    AT91_PMC_PCR_CMD |
+                                    AT91_PMC_PCR_DIV(periph->div) |
+                                    AT91_PMC_PCR_EN);
+       return 0;
+}
+
+static void clk_sam9x5_peripheral_disable(struct clk_hw *hw)
+{
+       struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
+       struct at91_pmc *pmc = periph->pmc;
+
+       if (periph->id < PERIPHERAL_ID_MIN)
+               return;
+
+       pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID) |
+                                    AT91_PMC_PCR_CMD);
+}
+
+static int clk_sam9x5_peripheral_is_enabled(struct clk_hw *hw)
+{
+       struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
+       struct at91_pmc *pmc = periph->pmc;
+       int ret;
+
+       if (periph->id < PERIPHERAL_ID_MIN)
+               return 1;
+
+       pmc_lock(pmc);
+       pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID));
+       ret = !!(pmc_read(pmc, AT91_PMC_PCR) & AT91_PMC_PCR_EN);
+       pmc_unlock(pmc);
+
+       return ret;
+}
+
+static unsigned long
+clk_sam9x5_peripheral_recalc_rate(struct clk_hw *hw,
+                                 unsigned long parent_rate)
+{
+       struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
+       struct at91_pmc *pmc = periph->pmc;
+       u32 tmp;
+
+       if (periph->id < PERIPHERAL_ID_MIN)
+               return parent_rate;
+
+       pmc_lock(pmc);
+       pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID));
+       tmp = pmc_read(pmc, AT91_PMC_PCR);
+       pmc_unlock(pmc);
+
+       if (tmp & AT91_PMC_PCR_EN) {
+               periph->div = PERIPHERAL_RSHIFT(tmp);
+               periph->auto_div = false;
+       } else {
+               clk_sam9x5_peripheral_autodiv(periph);
+       }
+
+       return parent_rate >> periph->div;
+}
+
+static long clk_sam9x5_peripheral_round_rate(struct clk_hw *hw,
+                                            unsigned long rate,
+                                            unsigned long *parent_rate)
+{
+       int shift = 0;
+       unsigned long best_rate;
+       unsigned long best_diff;
+       unsigned long cur_rate = *parent_rate;
+       unsigned long cur_diff;
+       struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
+
+       if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max)
+               return *parent_rate;
+
+       if (periph->range.max) {
+               for (; shift < PERIPHERAL_MAX_SHIFT; shift++) {
+                       cur_rate = *parent_rate >> shift;
+                       if (cur_rate <= periph->range.max)
+                               break;
+               }
+       }
+
+       if (rate >= cur_rate)
+               return cur_rate;
+
+       best_diff = cur_rate - rate;
+       best_rate = cur_rate;
+       for (; shift < PERIPHERAL_MAX_SHIFT; shift++) {
+               cur_rate = *parent_rate >> shift;
+               if (cur_rate < rate)
+                       cur_diff = rate - cur_rate;
+               else
+                       cur_diff = cur_rate - rate;
+
+               if (cur_diff < best_diff) {
+                       best_diff = cur_diff;
+                       best_rate = cur_rate;
+               }
+
+               if (!best_diff || cur_rate < rate)
+                       break;
+       }
+
+       return best_rate;
+}
+
+static int clk_sam9x5_peripheral_set_rate(struct clk_hw *hw,
+                                         unsigned long rate,
+                                         unsigned long parent_rate)
+{
+       int shift;
+       struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
+       if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) {
+               if (parent_rate == rate)
+                       return 0;
+               else
+                       return -EINVAL;
+       }
+
+       if (periph->range.max && rate > periph->range.max)
+               return -EINVAL;
+
+       for (shift = 0; shift < PERIPHERAL_MAX_SHIFT; shift++) {
+               if (parent_rate >> shift == rate) {
+                       periph->auto_div = false;
+                       periph->div = shift;
+                       return 0;
+               }
+       }
+
+       return -EINVAL;
+}
+
+static const struct clk_ops sam9x5_peripheral_ops = {
+       .enable = clk_sam9x5_peripheral_enable,
+       .disable = clk_sam9x5_peripheral_disable,
+       .is_enabled = clk_sam9x5_peripheral_is_enabled,
+       .recalc_rate = clk_sam9x5_peripheral_recalc_rate,
+       .round_rate = clk_sam9x5_peripheral_round_rate,
+       .set_rate = clk_sam9x5_peripheral_set_rate,
+};
+
+static struct clk * __init
+at91_clk_register_sam9x5_peripheral(struct at91_pmc *pmc, const char *name,
+                                   const char *parent_name, u32 id,
+                                   const struct clk_range *range)
+{
+       struct clk_sam9x5_peripheral *periph;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+
+       if (!pmc || !name || !parent_name)
+               return ERR_PTR(-EINVAL);
+
+       periph = kzalloc(sizeof(*periph), GFP_KERNEL);
+       if (!periph)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &sam9x5_peripheral_ops;
+       init.parent_names = (parent_name ? &parent_name : NULL);
+       init.num_parents = (parent_name ? 1 : 0);
+       init.flags = 0;
+
+       periph->id = id;
+       periph->hw.init = &init;
+       periph->div = 0;
+       periph->pmc = pmc;
+       periph->auto_div = true;
+       periph->range = *range;
+
+       clk = clk_register(NULL, &periph->hw);
+       if (IS_ERR(clk))
+               kfree(periph);
+       else
+               clk_sam9x5_peripheral_autodiv(periph);
+
+       return clk;
+}
+
+static void __init
+of_at91_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc, u8 type)
+{
+       int num;
+       u32 id;
+       struct clk *clk;
+       const char *parent_name;
+       const char *name;
+       struct device_node *periphclknp;
+
+       parent_name = of_clk_get_parent_name(np, 0);
+       if (!parent_name)
+               return;
+
+       num = of_get_child_count(np);
+       if (!num || num > PERIPHERAL_MAX)
+               return;
+
+       for_each_child_of_node(np, periphclknp) {
+               if (of_property_read_u32(periphclknp, "reg", &id))
+                       continue;
+
+               if (id >= PERIPHERAL_MAX)
+                       continue;
+
+               if (of_property_read_string(np, "clock-output-names", &name))
+                       name = periphclknp->name;
+
+               if (type == PERIPHERAL_AT91RM9200) {
+                       clk = at91_clk_register_peripheral(pmc, name,
+                                                          parent_name, id);
+               } else {
+                       struct clk_range range = CLK_RANGE(0, 0);
+
+                       of_at91_get_clk_range(periphclknp,
+                                             "atmel,clk-output-range",
+                                             &range);
+
+                       clk = at91_clk_register_sam9x5_peripheral(pmc, name,
+                                                                 parent_name,
+                                                                 id, &range);
+               }
+
+               if (IS_ERR(clk))
+                       continue;
+
+               of_clk_add_provider(periphclknp, of_clk_src_simple_get, clk);
+       }
+}
+
+void __init of_at91rm9200_clk_periph_setup(struct device_node *np,
+                                          struct at91_pmc *pmc)
+{
+       of_at91_clk_periph_setup(np, pmc, PERIPHERAL_AT91RM9200);
+}
+
+void __init of_at91sam9x5_clk_periph_setup(struct device_node *np,
+                                          struct at91_pmc *pmc)
+{
+       of_at91_clk_periph_setup(np, pmc, PERIPHERAL_AT91SAM9X5);
+}
diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c
new file mode 100644 (file)
index 0000000..cf6ed02
--- /dev/null
@@ -0,0 +1,531 @@
+/*
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/at91_pmc.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/io.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+
+#include "pmc.h"
+
+#define PLL_STATUS_MASK(id)    (1 << (1 + (id)))
+#define PLL_REG(id)            (AT91_CKGR_PLLAR + ((id) * 4))
+#define PLL_DIV_MASK           0xff
+#define PLL_DIV_MAX            PLL_DIV_MASK
+#define PLL_DIV(reg)           ((reg) & PLL_DIV_MASK)
+#define PLL_MUL(reg, layout)   (((reg) >> (layout)->mul_shift) & \
+                                (layout)->mul_mask)
+#define PLL_ICPR_SHIFT(id)     ((id) * 16)
+#define PLL_ICPR_MASK(id)      (0xffff << PLL_ICPR_SHIFT(id))
+#define PLL_MAX_COUNT          0x3ff
+#define PLL_COUNT_SHIFT                8
+#define PLL_OUT_SHIFT          14
+#define PLL_MAX_ID             1
+
+struct clk_pll_characteristics {
+       struct clk_range input;
+       int num_output;
+       struct clk_range *output;
+       u16 *icpll;
+       u8 *out;
+};
+
+struct clk_pll_layout {
+       u32 pllr_mask;
+       u16 mul_mask;
+       u8 mul_shift;
+};
+
+#define to_clk_pll(hw) container_of(hw, struct clk_pll, hw)
+
+struct clk_pll {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+       unsigned int irq;
+       wait_queue_head_t wait;
+       u8 id;
+       u8 div;
+       u8 range;
+       u16 mul;
+       const struct clk_pll_layout *layout;
+       const struct clk_pll_characteristics *characteristics;
+};
+
+static irqreturn_t clk_pll_irq_handler(int irq, void *dev_id)
+{
+       struct clk_pll *pll = (struct clk_pll *)dev_id;
+
+       wake_up(&pll->wait);
+       disable_irq_nosync(pll->irq);
+
+       return IRQ_HANDLED;
+}
+
+static int clk_pll_prepare(struct clk_hw *hw)
+{
+       struct clk_pll *pll = to_clk_pll(hw);
+       struct at91_pmc *pmc = pll->pmc;
+       const struct clk_pll_layout *layout = pll->layout;
+       const struct clk_pll_characteristics *characteristics =
+                                                       pll->characteristics;
+       u8 id = pll->id;
+       u32 mask = PLL_STATUS_MASK(id);
+       int offset = PLL_REG(id);
+       u8 out = 0;
+       u32 pllr, icpr;
+       u8 div;
+       u16 mul;
+
+       pllr = pmc_read(pmc, offset);
+       div = PLL_DIV(pllr);
+       mul = PLL_MUL(pllr, layout);
+
+       if ((pmc_read(pmc, AT91_PMC_SR) & mask) &&
+           (div == pll->div && mul == pll->mul))
+               return 0;
+
+       if (characteristics->out)
+               out = characteristics->out[pll->range];
+       if (characteristics->icpll) {
+               icpr = pmc_read(pmc, AT91_PMC_PLLICPR) & ~PLL_ICPR_MASK(id);
+               icpr |= (characteristics->icpll[pll->range] <<
+                       PLL_ICPR_SHIFT(id));
+               pmc_write(pmc, AT91_PMC_PLLICPR, icpr);
+       }
+
+       pllr &= ~layout->pllr_mask;
+       pllr |= layout->pllr_mask &
+              (pll->div | (PLL_MAX_COUNT << PLL_COUNT_SHIFT) |
+               (out << PLL_OUT_SHIFT) |
+               ((pll->mul & layout->mul_mask) << layout->mul_shift));
+       pmc_write(pmc, offset, pllr);
+
+       while (!(pmc_read(pmc, AT91_PMC_SR) & mask)) {
+               enable_irq(pll->irq);
+               wait_event(pll->wait,
+                          pmc_read(pmc, AT91_PMC_SR) & mask);
+       }
+
+       return 0;
+}
+
+static int clk_pll_is_prepared(struct clk_hw *hw)
+{
+       struct clk_pll *pll = to_clk_pll(hw);
+       struct at91_pmc *pmc = pll->pmc;
+
+       return !!(pmc_read(pmc, AT91_PMC_SR) &
+                 PLL_STATUS_MASK(pll->id));
+}
+
+static void clk_pll_unprepare(struct clk_hw *hw)
+{
+       struct clk_pll *pll = to_clk_pll(hw);
+       struct at91_pmc *pmc = pll->pmc;
+       const struct clk_pll_layout *layout = pll->layout;
+       int offset = PLL_REG(pll->id);
+       u32 tmp = pmc_read(pmc, offset) & ~(layout->pllr_mask);
+
+       pmc_write(pmc, offset, tmp);
+}
+
+static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,
+                                        unsigned long parent_rate)
+{
+       struct clk_pll *pll = to_clk_pll(hw);
+       const struct clk_pll_layout *layout = pll->layout;
+       struct at91_pmc *pmc = pll->pmc;
+       int offset = PLL_REG(pll->id);
+       u32 tmp = pmc_read(pmc, offset) & layout->pllr_mask;
+       u8 div = PLL_DIV(tmp);
+       u16 mul = PLL_MUL(tmp, layout);
+       if (!div || !mul)
+               return 0;
+
+       return (parent_rate * (mul + 1)) / div;
+}
+
+static long clk_pll_get_best_div_mul(struct clk_pll *pll, unsigned long rate,
+                                    unsigned long parent_rate,
+                                    u32 *div, u32 *mul,
+                                    u32 *index) {
+       unsigned long maxrate;
+       unsigned long minrate;
+       unsigned long divrate;
+       unsigned long bestdiv = 1;
+       unsigned long bestmul;
+       unsigned long tmpdiv;
+       unsigned long roundup;
+       unsigned long rounddown;
+       unsigned long remainder;
+       unsigned long bestremainder;
+       unsigned long maxmul;
+       unsigned long maxdiv;
+       unsigned long mindiv;
+       int i = 0;
+       const struct clk_pll_layout *layout = pll->layout;
+       const struct clk_pll_characteristics *characteristics =
+                                                       pll->characteristics;
+
+       /* Minimum divider = 1 */
+       /* Maximum multiplier = max_mul */
+       maxmul = layout->mul_mask + 1;
+       maxrate = (parent_rate * maxmul) / 1;
+
+       /* Maximum divider = max_div */
+       /* Minimum multiplier = 2 */
+       maxdiv = PLL_DIV_MAX;
+       minrate = (parent_rate * 2) / maxdiv;
+
+       if (parent_rate < characteristics->input.min ||
+           parent_rate < characteristics->input.max)
+               return -ERANGE;
+
+       if (parent_rate < minrate || parent_rate > maxrate)
+               return -ERANGE;
+
+       for (i = 0; i < characteristics->num_output; i++) {
+               if (parent_rate >= characteristics->output[i].min &&
+                   parent_rate <= characteristics->output[i].max)
+                       break;
+       }
+
+       if (i >= characteristics->num_output)
+               return -ERANGE;
+
+       bestmul = rate / parent_rate;
+       rounddown = parent_rate % rate;
+       roundup = rate - rounddown;
+       bestremainder = roundup < rounddown ? roundup : rounddown;
+
+       if (!bestremainder) {
+               if (div)
+                       *div = bestdiv;
+               if (mul)
+                       *mul = bestmul;
+               if (index)
+                       *index = i;
+               return rate;
+       }
+
+       maxdiv = 255 / (bestmul + 1);
+       if (parent_rate / maxdiv < characteristics->input.min)
+               maxdiv = parent_rate / characteristics->input.min;
+       mindiv = parent_rate / characteristics->input.max;
+       if (parent_rate % characteristics->input.max)
+               mindiv++;
+
+       for (tmpdiv = mindiv; tmpdiv < maxdiv; tmpdiv++) {
+               divrate = parent_rate / tmpdiv;
+
+               rounddown = rate % divrate;
+               roundup = divrate - rounddown;
+               remainder = roundup < rounddown ? roundup : rounddown;
+
+               if (remainder < bestremainder) {
+                       bestremainder = remainder;
+                       bestmul = rate / divrate;
+                       bestdiv = tmpdiv;
+               }
+
+               if (!remainder)
+                       break;
+       }
+
+       rate = (parent_rate / bestdiv) * bestmul;
+
+       if (div)
+               *div = bestdiv;
+       if (mul)
+               *mul = bestmul;
+       if (index)
+               *index = i;
+
+       return rate;
+}
+
+static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
+                                       unsigned long *parent_rate)
+{
+       struct clk_pll *pll = to_clk_pll(hw);
+
+       return clk_pll_get_best_div_mul(pll, rate, *parent_rate,
+                                       NULL, NULL, NULL);
+}
+
+static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
+                           unsigned long parent_rate)
+{
+       struct clk_pll *pll = to_clk_pll(hw);
+       long ret;
+       u32 div;
+       u32 mul;
+       u32 index;
+
+       ret = clk_pll_get_best_div_mul(pll, rate, parent_rate,
+                                      &div, &mul, &index);
+       if (ret < 0)
+               return ret;
+
+       pll->range = index;
+       pll->div = div;
+       pll->mul = mul;
+
+       return 0;
+}
+
+static const struct clk_ops pll_ops = {
+       .prepare = clk_pll_prepare,
+       .unprepare = clk_pll_unprepare,
+       .is_prepared = clk_pll_is_prepared,
+       .recalc_rate = clk_pll_recalc_rate,
+       .round_rate = clk_pll_round_rate,
+       .set_rate = clk_pll_set_rate,
+};
+
+static struct clk * __init
+at91_clk_register_pll(struct at91_pmc *pmc, unsigned int irq, const char *name,
+                     const char *parent_name, u8 id,
+                     const struct clk_pll_layout *layout,
+                     const struct clk_pll_characteristics *characteristics)
+{
+       struct clk_pll *pll;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+       int ret;
+       int offset = PLL_REG(id);
+       u32 tmp;
+
+       if (id > PLL_MAX_ID)
+               return ERR_PTR(-EINVAL);
+
+       pll = kzalloc(sizeof(*pll), GFP_KERNEL);
+       if (!pll)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &pll_ops;
+       init.parent_names = &parent_name;
+       init.num_parents = 1;
+       init.flags = CLK_SET_RATE_GATE;
+
+       pll->id = id;
+       pll->hw.init = &init;
+       pll->layout = layout;
+       pll->characteristics = characteristics;
+       pll->pmc = pmc;
+       pll->irq = irq;
+       tmp = pmc_read(pmc, offset) & layout->pllr_mask;
+       pll->div = PLL_DIV(tmp);
+       pll->mul = PLL_MUL(tmp, layout);
+       init_waitqueue_head(&pll->wait);
+       irq_set_status_flags(pll->irq, IRQ_NOAUTOEN);
+       ret = request_irq(pll->irq, clk_pll_irq_handler, IRQF_TRIGGER_HIGH,
+                         id ? "clk-pllb" : "clk-plla", pll);
+       if (ret)
+               return ERR_PTR(ret);
+
+       clk = clk_register(NULL, &pll->hw);
+       if (IS_ERR(clk))
+               kfree(pll);
+
+       return clk;
+}
+
+
+static const struct clk_pll_layout at91rm9200_pll_layout = {
+       .pllr_mask = 0x7FFFFFF,
+       .mul_shift = 16,
+       .mul_mask = 0x7FF,
+};
+
+static const struct clk_pll_layout at91sam9g45_pll_layout = {
+       .pllr_mask = 0xFFFFFF,
+       .mul_shift = 16,
+       .mul_mask = 0xFF,
+};
+
+static const struct clk_pll_layout at91sam9g20_pllb_layout = {
+       .pllr_mask = 0x3FFFFF,
+       .mul_shift = 16,
+       .mul_mask = 0x3F,
+};
+
+static const struct clk_pll_layout sama5d3_pll_layout = {
+       .pllr_mask = 0x1FFFFFF,
+       .mul_shift = 18,
+       .mul_mask = 0x7F,
+};
+
+
+static struct clk_pll_characteristics * __init
+of_at91_clk_pll_get_characteristics(struct device_node *np)
+{
+       int i;
+       int offset;
+       u32 tmp;
+       int num_output;
+       u32 num_cells;
+       struct clk_range input;
+       struct clk_range *output;
+       u8 *out = NULL;
+       u16 *icpll = NULL;
+       struct clk_pll_characteristics *characteristics;
+
+       if (of_at91_get_clk_range(np, "atmel,clk-input-range", &input))
+               return NULL;
+
+       if (of_property_read_u32(np, "#atmel,pll-clk-output-range-cells",
+                                &num_cells))
+               return NULL;
+
+       if (num_cells < 2 || num_cells > 4)
+               return NULL;
+
+       if (!of_get_property(np, "atmel,pll-clk-output-ranges", &tmp))
+               return NULL;
+       num_output = tmp / (sizeof(u32) * num_cells);
+
+       characteristics = kzalloc(sizeof(*characteristics), GFP_KERNEL);
+       if (!characteristics)
+               return NULL;
+
+       output = kzalloc(sizeof(*output) * num_output, GFP_KERNEL);
+       if (!output)
+               goto out_free_characteristics;
+
+       if (num_cells > 2) {
+               out = kzalloc(sizeof(*out) * num_output, GFP_KERNEL);
+               if (!out)
+                       goto out_free_output;
+       }
+
+       if (num_cells > 3) {
+               icpll = kzalloc(sizeof(*icpll) * num_output, GFP_KERNEL);
+               if (!icpll)
+                       goto out_free_output;
+       }
+
+       for (i = 0; i < num_output; i++) {
+               offset = i * num_cells;
+               if (of_property_read_u32_index(np,
+                                              "atmel,pll-clk-output-ranges",
+                                              offset, &tmp))
+                       goto out_free_output;
+               output[i].min = tmp;
+               if (of_property_read_u32_index(np,
+                                              "atmel,pll-clk-output-ranges",
+                                              offset + 1, &tmp))
+                       goto out_free_output;
+               output[i].max = tmp;
+
+               if (num_cells == 2)
+                       continue;
+
+               if (of_property_read_u32_index(np,
+                                              "atmel,pll-clk-output-ranges",
+                                              offset + 2, &tmp))
+                       goto out_free_output;
+               out[i] = tmp;
+
+               if (num_cells == 3)
+                       continue;
+
+               if (of_property_read_u32_index(np,
+                                              "atmel,pll-clk-output-ranges",
+                                              offset + 3, &tmp))
+                       goto out_free_output;
+               icpll[i] = tmp;
+       }
+
+       characteristics->input = input;
+       characteristics->num_output = num_output;
+       characteristics->output = output;
+       characteristics->out = out;
+       characteristics->icpll = icpll;
+       return characteristics;
+
+out_free_output:
+       kfree(icpll);
+       kfree(out);
+       kfree(output);
+out_free_characteristics:
+       kfree(characteristics);
+       return NULL;
+}
+
+static void __init
+of_at91_clk_pll_setup(struct device_node *np, struct at91_pmc *pmc,
+                     const struct clk_pll_layout *layout)
+{
+       u32 id;
+       unsigned int irq;
+       struct clk *clk;
+       const char *parent_name;
+       const char *name = np->name;
+       struct clk_pll_characteristics *characteristics;
+
+       if (of_property_read_u32(np, "reg", &id))
+               return;
+
+       parent_name = of_clk_get_parent_name(np, 0);
+
+       of_property_read_string(np, "clock-output-names", &name);
+
+       characteristics = of_at91_clk_pll_get_characteristics(np);
+       if (!characteristics)
+               return;
+
+       irq = irq_of_parse_and_map(np, 0);
+       if (!irq)
+               return;
+
+       clk = at91_clk_register_pll(pmc, irq, name, parent_name, id, layout,
+                                   characteristics);
+       if (IS_ERR(clk))
+               goto out_free_characteristics;
+
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+       return;
+
+out_free_characteristics:
+       kfree(characteristics);
+}
+
+void __init of_at91rm9200_clk_pll_setup(struct device_node *np,
+                                              struct at91_pmc *pmc)
+{
+       of_at91_clk_pll_setup(np, pmc, &at91rm9200_pll_layout);
+}
+
+void __init of_at91sam9g45_clk_pll_setup(struct device_node *np,
+                                               struct at91_pmc *pmc)
+{
+       of_at91_clk_pll_setup(np, pmc, &at91sam9g45_pll_layout);
+}
+
+void __init of_at91sam9g20_clk_pllb_setup(struct device_node *np,
+                                                struct at91_pmc *pmc)
+{
+       of_at91_clk_pll_setup(np, pmc, &at91sam9g20_pllb_layout);
+}
+
+void __init of_sama5d3_clk_pll_setup(struct device_node *np,
+                                           struct at91_pmc *pmc)
+{
+       of_at91_clk_pll_setup(np, pmc, &sama5d3_pll_layout);
+}
diff --git a/drivers/clk/at91/clk-plldiv.c b/drivers/clk/at91/clk-plldiv.c
new file mode 100644 (file)
index 0000000..ea22656
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/at91_pmc.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/io.h>
+
+#include "pmc.h"
+
+#define to_clk_plldiv(hw) container_of(hw, struct clk_plldiv, hw)
+
+struct clk_plldiv {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+};
+
+static unsigned long clk_plldiv_recalc_rate(struct clk_hw *hw,
+                                           unsigned long parent_rate)
+{
+       struct clk_plldiv *plldiv = to_clk_plldiv(hw);
+       struct at91_pmc *pmc = plldiv->pmc;
+
+       if (pmc_read(pmc, AT91_PMC_MCKR) & AT91_PMC_PLLADIV2)
+               return parent_rate / 2;
+
+       return parent_rate;
+}
+
+static long clk_plldiv_round_rate(struct clk_hw *hw, unsigned long rate,
+                                       unsigned long *parent_rate)
+{
+       unsigned long div;
+
+       if (rate > *parent_rate)
+               return *parent_rate;
+       div = *parent_rate / 2;
+       if (rate < div)
+               return div;
+
+       if (rate - div < *parent_rate - rate)
+               return div;
+
+       return *parent_rate;
+}
+
+static int clk_plldiv_set_rate(struct clk_hw *hw, unsigned long rate,
+                              unsigned long parent_rate)
+{
+       struct clk_plldiv *plldiv = to_clk_plldiv(hw);
+       struct at91_pmc *pmc = plldiv->pmc;
+       u32 tmp;
+
+       if (parent_rate != rate && (parent_rate / 2) != rate)
+               return -EINVAL;
+
+       pmc_lock(pmc);
+       tmp = pmc_read(pmc, AT91_PMC_MCKR) & ~AT91_PMC_PLLADIV2;
+       if ((parent_rate / 2) == rate)
+               tmp |= AT91_PMC_PLLADIV2;
+       pmc_write(pmc, AT91_PMC_MCKR, tmp);
+       pmc_unlock(pmc);
+
+       return 0;
+}
+
+static const struct clk_ops plldiv_ops = {
+       .recalc_rate = clk_plldiv_recalc_rate,
+       .round_rate = clk_plldiv_round_rate,
+       .set_rate = clk_plldiv_set_rate,
+};
+
+static struct clk * __init
+at91_clk_register_plldiv(struct at91_pmc *pmc, const char *name,
+                        const char *parent_name)
+{
+       struct clk_plldiv *plldiv;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+
+       plldiv = kzalloc(sizeof(*plldiv), GFP_KERNEL);
+       if (!plldiv)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &plldiv_ops;
+       init.parent_names = parent_name ? &parent_name : NULL;
+       init.num_parents = parent_name ? 1 : 0;
+       init.flags = CLK_SET_RATE_GATE;
+
+       plldiv->hw.init = &init;
+       plldiv->pmc = pmc;
+
+       clk = clk_register(NULL, &plldiv->hw);
+
+       if (IS_ERR(clk))
+               kfree(plldiv);
+
+       return clk;
+}
+
+static void __init
+of_at91_clk_plldiv_setup(struct device_node *np, struct at91_pmc *pmc)
+{
+       struct clk *clk;
+       const char *parent_name;
+       const char *name = np->name;
+
+       parent_name = of_clk_get_parent_name(np, 0);
+
+       of_property_read_string(np, "clock-output-names", &name);
+
+       clk = at91_clk_register_plldiv(pmc, name, parent_name);
+
+       if (IS_ERR(clk))
+               return;
+
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+       return;
+}
+
+void __init of_at91sam9x5_clk_plldiv_setup(struct device_node *np,
+                                          struct at91_pmc *pmc)
+{
+       of_at91_clk_plldiv_setup(np, pmc);
+}
diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
new file mode 100644 (file)
index 0000000..fd792b2
--- /dev/null
@@ -0,0 +1,366 @@
+/*
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/at91_pmc.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/io.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+
+#include "pmc.h"
+
+#define PROG_SOURCE_MAX                5
+#define PROG_ID_MAX            7
+
+#define PROG_STATUS_MASK(id)   (1 << ((id) + 8))
+#define PROG_PRES_MASK         0x7
+#define PROG_MAX_RM9200_CSS    3
+
+struct clk_programmable_layout {
+       u8 pres_shift;
+       u8 css_mask;
+       u8 have_slck_mck;
+};
+
+struct clk_programmable {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+       unsigned int irq;
+       wait_queue_head_t wait;
+       u8 id;
+       u8 css;
+       u8 pres;
+       u8 slckmck;
+       const struct clk_programmable_layout *layout;
+};
+
+#define to_clk_programmable(hw) container_of(hw, struct clk_programmable, hw)
+
+
+static irqreturn_t clk_programmable_irq_handler(int irq, void *dev_id)
+{
+       struct clk_programmable *prog = (struct clk_programmable *)dev_id;
+
+       wake_up(&prog->wait);
+
+       return IRQ_HANDLED;
+}
+
+static int clk_programmable_prepare(struct clk_hw *hw)
+{
+       u32 tmp;
+       struct clk_programmable *prog = to_clk_programmable(hw);
+       struct at91_pmc *pmc = prog->pmc;
+       const struct clk_programmable_layout *layout = prog->layout;
+       u8 id = prog->id;
+       u32 mask = PROG_STATUS_MASK(id);
+
+       tmp = prog->css | (prog->pres << layout->pres_shift);
+       if (layout->have_slck_mck && prog->slckmck)
+               tmp |= AT91_PMC_CSSMCK_MCK;
+
+       pmc_write(pmc, AT91_PMC_PCKR(id), tmp);
+
+       while (!(pmc_read(pmc, AT91_PMC_SR) & mask))
+               wait_event(prog->wait, pmc_read(pmc, AT91_PMC_SR) & mask);
+
+       return 0;
+}
+
+static int clk_programmable_is_ready(struct clk_hw *hw)
+{
+       struct clk_programmable *prog = to_clk_programmable(hw);
+       struct at91_pmc *pmc = prog->pmc;
+
+       return !!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_PCKR(prog->id));
+}
+
+static unsigned long clk_programmable_recalc_rate(struct clk_hw *hw,
+                                                 unsigned long parent_rate)
+{
+       u32 tmp;
+       struct clk_programmable *prog = to_clk_programmable(hw);
+       struct at91_pmc *pmc = prog->pmc;
+       const struct clk_programmable_layout *layout = prog->layout;
+
+       tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id));
+       prog->pres = (tmp >> layout->pres_shift) & PROG_PRES_MASK;
+
+       return parent_rate >> prog->pres;
+}
+
+static long clk_programmable_round_rate(struct clk_hw *hw, unsigned long rate,
+                                       unsigned long *parent_rate)
+{
+       unsigned long best_rate = *parent_rate;
+       unsigned long best_diff;
+       unsigned long new_diff;
+       unsigned long cur_rate;
+       int shift = shift;
+
+       if (rate > *parent_rate)
+               return *parent_rate;
+       else
+               best_diff = *parent_rate - rate;
+
+       if (!best_diff)
+               return best_rate;
+
+       for (shift = 1; shift < PROG_PRES_MASK; shift++) {
+               cur_rate = *parent_rate >> shift;
+
+               if (cur_rate > rate)
+                       new_diff = cur_rate - rate;
+               else
+                       new_diff = rate - cur_rate;
+
+               if (!new_diff)
+                       return cur_rate;
+
+               if (new_diff < best_diff) {
+                       best_diff = new_diff;
+                       best_rate = cur_rate;
+               }
+
+               if (rate > cur_rate)
+                       break;
+       }
+
+       return best_rate;
+}
+
+static int clk_programmable_set_parent(struct clk_hw *hw, u8 index)
+{
+       struct clk_programmable *prog = to_clk_programmable(hw);
+       const struct clk_programmable_layout *layout = prog->layout;
+       if (index > layout->css_mask) {
+               if (index > PROG_MAX_RM9200_CSS && layout->have_slck_mck) {
+                       prog->css = 0;
+                       prog->slckmck = 1;
+                       return 0;
+               } else {
+                       return -EINVAL;
+               }
+       }
+
+       prog->css = index;
+       return 0;
+}
+
+static u8 clk_programmable_get_parent(struct clk_hw *hw)
+{
+       u32 tmp;
+       u8 ret;
+       struct clk_programmable *prog = to_clk_programmable(hw);
+       struct at91_pmc *pmc = prog->pmc;
+       const struct clk_programmable_layout *layout = prog->layout;
+
+       tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id));
+       prog->css = tmp & layout->css_mask;
+       ret = prog->css;
+       if (layout->have_slck_mck) {
+               prog->slckmck = !!(tmp & AT91_PMC_CSSMCK_MCK);
+               if (prog->slckmck && !ret)
+                       ret = PROG_MAX_RM9200_CSS + 1;
+       }
+
+       return ret;
+}
+
+static int clk_programmable_set_rate(struct clk_hw *hw, unsigned long rate,
+                                    unsigned long parent_rate)
+{
+       struct clk_programmable *prog = to_clk_programmable(hw);
+       unsigned long best_rate = parent_rate;
+       unsigned long best_diff;
+       unsigned long new_diff;
+       unsigned long cur_rate;
+       int shift = 0;
+
+       if (rate > parent_rate)
+               return parent_rate;
+       else
+               best_diff = parent_rate - rate;
+
+       if (!best_diff) {
+               prog->pres = shift;
+               return 0;
+       }
+
+       for (shift = 1; shift < PROG_PRES_MASK; shift++) {
+               cur_rate = parent_rate >> shift;
+
+               if (cur_rate > rate)
+                       new_diff = cur_rate - rate;
+               else
+                       new_diff = rate - cur_rate;
+
+               if (!new_diff)
+                       break;
+
+               if (new_diff < best_diff) {
+                       best_diff = new_diff;
+                       best_rate = cur_rate;
+               }
+
+               if (rate > cur_rate)
+                       break;
+       }
+
+       prog->pres = shift;
+       return 0;
+}
+
+static const struct clk_ops programmable_ops = {
+       .prepare = clk_programmable_prepare,
+       .is_prepared = clk_programmable_is_ready,
+       .recalc_rate = clk_programmable_recalc_rate,
+       .round_rate = clk_programmable_round_rate,
+       .get_parent = clk_programmable_get_parent,
+       .set_parent = clk_programmable_set_parent,
+       .set_rate = clk_programmable_set_rate,
+};
+
+static struct clk * __init
+at91_clk_register_programmable(struct at91_pmc *pmc, unsigned int irq,
+                              const char *name, const char **parent_names,
+                              u8 num_parents, u8 id,
+                              const struct clk_programmable_layout *layout)
+{
+       int ret;
+       struct clk_programmable *prog;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+       char irq_name[11];
+
+       if (id > PROG_ID_MAX)
+               return ERR_PTR(-EINVAL);
+
+       prog = kzalloc(sizeof(*prog), GFP_KERNEL);
+       if (!prog)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &programmable_ops;
+       init.parent_names = parent_names;
+       init.num_parents = num_parents;
+       init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
+
+       prog->id = id;
+       prog->layout = layout;
+       prog->hw.init = &init;
+       prog->pmc = pmc;
+       prog->irq = irq;
+       init_waitqueue_head(&prog->wait);
+       irq_set_status_flags(prog->irq, IRQ_NOAUTOEN);
+       snprintf(irq_name, sizeof(irq_name), "clk-prog%d", id);
+       ret = request_irq(prog->irq, clk_programmable_irq_handler,
+                         IRQF_TRIGGER_HIGH, irq_name, prog);
+       if (ret)
+               return ERR_PTR(ret);
+
+       clk = clk_register(NULL, &prog->hw);
+       if (IS_ERR(clk))
+               kfree(prog);
+
+       return clk;
+}
+
+static const struct clk_programmable_layout at91rm9200_programmable_layout = {
+       .pres_shift = 2,
+       .css_mask = 0x3,
+       .have_slck_mck = 0,
+};
+
+static const struct clk_programmable_layout at91sam9g45_programmable_layout = {
+       .pres_shift = 2,
+       .css_mask = 0x3,
+       .have_slck_mck = 1,
+};
+
+static const struct clk_programmable_layout at91sam9x5_programmable_layout = {
+       .pres_shift = 4,
+       .css_mask = 0x7,
+       .have_slck_mck = 0,
+};
+
+static void __init
+of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc,
+                      const struct clk_programmable_layout *layout)
+{
+       int num;
+       u32 id;
+       int i;
+       unsigned int irq;
+       struct clk *clk;
+       int num_parents;
+       const char *parent_names[PROG_SOURCE_MAX];
+       const char *name;
+       struct device_node *progclknp;
+
+       num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+       if (num_parents <= 0 || num_parents > PROG_SOURCE_MAX)
+               return;
+
+       for (i = 0; i < num_parents; ++i) {
+               parent_names[i] = of_clk_get_parent_name(np, i);
+               if (!parent_names[i])
+                       return;
+       }
+
+       num = of_get_child_count(np);
+       if (!num || num > (PROG_ID_MAX + 1))
+               return;
+
+       for_each_child_of_node(np, progclknp) {
+               if (of_property_read_u32(progclknp, "reg", &id))
+                       continue;
+
+               if (of_property_read_string(np, "clock-output-names", &name))
+                       name = progclknp->name;
+
+               irq = irq_of_parse_and_map(progclknp, 0);
+               if (!irq)
+                       continue;
+
+               clk = at91_clk_register_programmable(pmc, irq, name,
+                                                    parent_names, num_parents,
+                                                    id, layout);
+               if (IS_ERR(clk))
+                       continue;
+
+               of_clk_add_provider(progclknp, of_clk_src_simple_get, clk);
+       }
+}
+
+
+void __init of_at91rm9200_clk_prog_setup(struct device_node *np,
+                                        struct at91_pmc *pmc)
+{
+       of_at91_clk_prog_setup(np, pmc, &at91rm9200_programmable_layout);
+}
+
+void __init of_at91sam9g45_clk_prog_setup(struct device_node *np,
+                                         struct at91_pmc *pmc)
+{
+       of_at91_clk_prog_setup(np, pmc, &at91sam9g45_programmable_layout);
+}
+
+void __init of_at91sam9x5_clk_prog_setup(struct device_node *np,
+                                        struct at91_pmc *pmc)
+{
+       of_at91_clk_prog_setup(np, pmc, &at91sam9x5_programmable_layout);
+}
diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c
new file mode 100644 (file)
index 0000000..144d47e
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/at91_pmc.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/io.h>
+
+#include "pmc.h"
+
+#define SMD_SOURCE_MAX         2
+
+#define SMD_DIV_SHIFT          8
+#define SMD_MAX_DIV            0xf
+
+struct at91sam9x5_clk_smd {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+};
+
+#define to_at91sam9x5_clk_smd(hw) \
+       container_of(hw, struct at91sam9x5_clk_smd, hw)
+
+static unsigned long at91sam9x5_clk_smd_recalc_rate(struct clk_hw *hw,
+                                                   unsigned long parent_rate)
+{
+       u32 tmp;
+       u8 smddiv;
+       struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw);
+       struct at91_pmc *pmc = smd->pmc;
+
+       tmp = pmc_read(pmc, AT91_PMC_SMD);
+       smddiv = (tmp & AT91_PMC_SMD_DIV) >> SMD_DIV_SHIFT;
+       return parent_rate / (smddiv + 1);
+}
+
+static long at91sam9x5_clk_smd_round_rate(struct clk_hw *hw, unsigned long rate,
+                                         unsigned long *parent_rate)
+{
+       unsigned long div;
+       unsigned long bestrate;
+       unsigned long tmp;
+
+       if (rate >= *parent_rate)
+               return *parent_rate;
+
+       div = *parent_rate / rate;
+       if (div > SMD_MAX_DIV)
+               return *parent_rate / (SMD_MAX_DIV + 1);
+
+       bestrate = *parent_rate / div;
+       tmp = *parent_rate / (div + 1);
+       if (bestrate - rate > rate - tmp)
+               bestrate = tmp;
+
+       return bestrate;
+}
+
+static int at91sam9x5_clk_smd_set_parent(struct clk_hw *hw, u8 index)
+{
+       u32 tmp;
+       struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw);
+       struct at91_pmc *pmc = smd->pmc;
+
+       if (index > 1)
+               return -EINVAL;
+       tmp = pmc_read(pmc, AT91_PMC_SMD) & ~AT91_PMC_SMDS;
+       if (index)
+               tmp |= AT91_PMC_SMDS;
+       pmc_write(pmc, AT91_PMC_SMD, tmp);
+       return 0;
+}
+
+static u8 at91sam9x5_clk_smd_get_parent(struct clk_hw *hw)
+{
+       struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw);
+       struct at91_pmc *pmc = smd->pmc;
+
+       return pmc_read(pmc, AT91_PMC_SMD) & AT91_PMC_SMDS;
+}
+
+static int at91sam9x5_clk_smd_set_rate(struct clk_hw *hw, unsigned long rate,
+                                      unsigned long parent_rate)
+{
+       u32 tmp;
+       struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw);
+       struct at91_pmc *pmc = smd->pmc;
+       unsigned long div = parent_rate / rate;
+
+       if (parent_rate % rate || div < 1 || div > (SMD_MAX_DIV + 1))
+               return -EINVAL;
+       tmp = pmc_read(pmc, AT91_PMC_SMD) & ~AT91_PMC_SMD_DIV;
+       tmp |= (div - 1) << SMD_DIV_SHIFT;
+       pmc_write(pmc, AT91_PMC_SMD, tmp);
+
+       return 0;
+}
+
+static const struct clk_ops at91sam9x5_smd_ops = {
+       .recalc_rate = at91sam9x5_clk_smd_recalc_rate,
+       .round_rate = at91sam9x5_clk_smd_round_rate,
+       .get_parent = at91sam9x5_clk_smd_get_parent,
+       .set_parent = at91sam9x5_clk_smd_set_parent,
+       .set_rate = at91sam9x5_clk_smd_set_rate,
+};
+
+static struct clk * __init
+at91sam9x5_clk_register_smd(struct at91_pmc *pmc, const char *name,
+                           const char **parent_names, u8 num_parents)
+{
+       struct at91sam9x5_clk_smd *smd;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+
+       smd = kzalloc(sizeof(*smd), GFP_KERNEL);
+       if (!smd)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &at91sam9x5_smd_ops;
+       init.parent_names = parent_names;
+       init.num_parents = num_parents;
+       init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
+
+       smd->hw.init = &init;
+       smd->pmc = pmc;
+
+       clk = clk_register(NULL, &smd->hw);
+       if (IS_ERR(clk))
+               kfree(smd);
+
+       return clk;
+}
+
+void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
+                                       struct at91_pmc *pmc)
+{
+       struct clk *clk;
+       int i;
+       int num_parents;
+       const char *parent_names[SMD_SOURCE_MAX];
+       const char *name = np->name;
+
+       num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+       if (num_parents <= 0 || num_parents > SMD_SOURCE_MAX)
+               return;
+
+       for (i = 0; i < num_parents; i++) {
+               parent_names[i] = of_clk_get_parent_name(np, i);
+               if (!parent_names[i])
+                       return;
+       }
+
+       of_property_read_string(np, "clock-output-names", &name);
+
+       clk = at91sam9x5_clk_register_smd(pmc, name, parent_names,
+                                         num_parents);
+       if (IS_ERR(clk))
+               return;
+
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+}
diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c
new file mode 100644 (file)
index 0000000..8f7c043
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/at91_pmc.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/io.h>
+
+#include "pmc.h"
+
+#define SYSTEM_MAX_ID          31
+
+#define SYSTEM_MAX_NAME_SZ     32
+
+#define to_clk_system(hw) container_of(hw, struct clk_system, hw)
+struct clk_system {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+       u8 id;
+};
+
+static int clk_system_enable(struct clk_hw *hw)
+{
+       struct clk_system *sys = to_clk_system(hw);
+       struct at91_pmc *pmc = sys->pmc;
+
+       pmc_write(pmc, AT91_PMC_SCER, 1 << sys->id);
+       return 0;
+}
+
+static void clk_system_disable(struct clk_hw *hw)
+{
+       struct clk_system *sys = to_clk_system(hw);
+       struct at91_pmc *pmc = sys->pmc;
+
+       pmc_write(pmc, AT91_PMC_SCDR, 1 << sys->id);
+}
+
+static int clk_system_is_enabled(struct clk_hw *hw)
+{
+       struct clk_system *sys = to_clk_system(hw);
+       struct at91_pmc *pmc = sys->pmc;
+
+       return !!(pmc_read(pmc, AT91_PMC_SCSR) & (1 << sys->id));
+}
+
+static const struct clk_ops system_ops = {
+       .enable = clk_system_enable,
+       .disable = clk_system_disable,
+       .is_enabled = clk_system_is_enabled,
+};
+
+static struct clk * __init
+at91_clk_register_system(struct at91_pmc *pmc, const char *name,
+                        const char *parent_name, u8 id)
+{
+       struct clk_system *sys;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+
+       if (!parent_name || id > SYSTEM_MAX_ID)
+               return ERR_PTR(-EINVAL);
+
+       sys = kzalloc(sizeof(*sys), GFP_KERNEL);
+       if (!sys)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &system_ops;
+       init.parent_names = &parent_name;
+       init.num_parents = 1;
+       /*
+        * CLK_IGNORE_UNUSED is used to avoid ddrck switch off.
+        * TODO : we should implement a driver supporting at91 ddr controller
+        * (see drivers/memory) which would request and enable the ddrck clock.
+        * When this is done we will be able to remove CLK_IGNORE_UNUSED flag.
+        */
+       init.flags = CLK_IGNORE_UNUSED;
+
+       sys->id = id;
+       sys->hw.init = &init;
+       sys->pmc = pmc;
+
+       clk = clk_register(NULL, &sys->hw);
+       if (IS_ERR(clk))
+               kfree(sys);
+
+       return clk;
+}
+
+static void __init
+of_at91_clk_sys_setup(struct device_node *np, struct at91_pmc *pmc)
+{
+       int num;
+       u32 id;
+       struct clk *clk;
+       const char *name;
+       struct device_node *sysclknp;
+       const char *parent_name;
+
+       num = of_get_child_count(np);
+       if (num > (SYSTEM_MAX_ID + 1))
+               return;
+
+       for_each_child_of_node(np, sysclknp) {
+               if (of_property_read_u32(sysclknp, "reg", &id))
+                       continue;
+
+               if (of_property_read_string(np, "clock-output-names", &name))
+                       name = sysclknp->name;
+
+               parent_name = of_clk_get_parent_name(sysclknp, 0);
+
+               clk = at91_clk_register_system(pmc, name, parent_name, id);
+               if (IS_ERR(clk))
+                       continue;
+
+               of_clk_add_provider(sysclknp, of_clk_src_simple_get, clk);
+       }
+}
+
+void __init of_at91rm9200_clk_sys_setup(struct device_node *np,
+                                       struct at91_pmc *pmc)
+{
+       of_at91_clk_sys_setup(np, pmc);
+}
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
new file mode 100644 (file)
index 0000000..7d1d26a
--- /dev/null
@@ -0,0 +1,398 @@
+/*
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/at91_pmc.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/io.h>
+
+#include "pmc.h"
+
+#define USB_SOURCE_MAX         2
+
+#define SAM9X5_USB_DIV_SHIFT   8
+#define SAM9X5_USB_MAX_DIV     0xf
+
+#define RM9200_USB_DIV_SHIFT   28
+#define RM9200_USB_DIV_TAB_SIZE        4
+
+struct at91sam9x5_clk_usb {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+};
+
+#define to_at91sam9x5_clk_usb(hw) \
+       container_of(hw, struct at91sam9x5_clk_usb, hw)
+
+struct at91rm9200_clk_usb {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+       u32 divisors[4];
+};
+
+#define to_at91rm9200_clk_usb(hw) \
+       container_of(hw, struct at91rm9200_clk_usb, hw)
+
+static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw,
+                                                   unsigned long parent_rate)
+{
+       u32 tmp;
+       u8 usbdiv;
+       struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw);
+       struct at91_pmc *pmc = usb->pmc;
+
+       tmp = pmc_read(pmc, AT91_PMC_USB);
+       usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT;
+       return parent_rate / (usbdiv + 1);
+}
+
+static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate,
+                                         unsigned long *parent_rate)
+{
+       unsigned long div;
+       unsigned long bestrate;
+       unsigned long tmp;
+
+       if (rate >= *parent_rate)
+               return *parent_rate;
+
+       div = *parent_rate / rate;
+       if (div >= SAM9X5_USB_MAX_DIV)
+               return *parent_rate / (SAM9X5_USB_MAX_DIV + 1);
+
+       bestrate = *parent_rate / div;
+       tmp = *parent_rate / (div + 1);
+       if (bestrate - rate > rate - tmp)
+               bestrate = tmp;
+
+       return bestrate;
+}
+
+static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index)
+{
+       u32 tmp;
+       struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw);
+       struct at91_pmc *pmc = usb->pmc;
+
+       if (index > 1)
+               return -EINVAL;
+       tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_USBS;
+       if (index)
+               tmp |= AT91_PMC_USBS;
+       pmc_write(pmc, AT91_PMC_USB, tmp);
+       return 0;
+}
+
+static u8 at91sam9x5_clk_usb_get_parent(struct clk_hw *hw)
+{
+       struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw);
+       struct at91_pmc *pmc = usb->pmc;
+
+       return pmc_read(pmc, AT91_PMC_USB) & AT91_PMC_USBS;
+}
+
+static int at91sam9x5_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate,
+                                      unsigned long parent_rate)
+{
+       u32 tmp;
+       struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw);
+       struct at91_pmc *pmc = usb->pmc;
+       unsigned long div = parent_rate / rate;
+
+       if (parent_rate % rate || div < 1 || div >= SAM9X5_USB_MAX_DIV)
+               return -EINVAL;
+
+       tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV;
+       tmp |= (div - 1) << SAM9X5_USB_DIV_SHIFT;
+       pmc_write(pmc, AT91_PMC_USB, tmp);
+
+       return 0;
+}
+
+static const struct clk_ops at91sam9x5_usb_ops = {
+       .recalc_rate = at91sam9x5_clk_usb_recalc_rate,
+       .round_rate = at91sam9x5_clk_usb_round_rate,
+       .get_parent = at91sam9x5_clk_usb_get_parent,
+       .set_parent = at91sam9x5_clk_usb_set_parent,
+       .set_rate = at91sam9x5_clk_usb_set_rate,
+};
+
+static int at91sam9n12_clk_usb_enable(struct clk_hw *hw)
+{
+       struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw);
+       struct at91_pmc *pmc = usb->pmc;
+
+       pmc_write(pmc, AT91_PMC_USB,
+                 pmc_read(pmc, AT91_PMC_USB) | AT91_PMC_USBS);
+       return 0;
+}
+
+static void at91sam9n12_clk_usb_disable(struct clk_hw *hw)
+{
+       struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw);
+       struct at91_pmc *pmc = usb->pmc;
+
+       pmc_write(pmc, AT91_PMC_USB,
+                 pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_USBS);
+}
+
+static int at91sam9n12_clk_usb_is_enabled(struct clk_hw *hw)
+{
+       struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw);
+       struct at91_pmc *pmc = usb->pmc;
+
+       return !!(pmc_read(pmc, AT91_PMC_USB) & AT91_PMC_USBS);
+}
+
+static const struct clk_ops at91sam9n12_usb_ops = {
+       .enable = at91sam9n12_clk_usb_enable,
+       .disable = at91sam9n12_clk_usb_disable,
+       .is_enabled = at91sam9n12_clk_usb_is_enabled,
+       .recalc_rate = at91sam9x5_clk_usb_recalc_rate,
+       .round_rate = at91sam9x5_clk_usb_round_rate,
+       .set_rate = at91sam9x5_clk_usb_set_rate,
+};
+
+static struct clk * __init
+at91sam9x5_clk_register_usb(struct at91_pmc *pmc, const char *name,
+                           const char **parent_names, u8 num_parents)
+{
+       struct at91sam9x5_clk_usb *usb;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+
+       usb = kzalloc(sizeof(*usb), GFP_KERNEL);
+       if (!usb)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &at91sam9x5_usb_ops;
+       init.parent_names = parent_names;
+       init.num_parents = num_parents;
+       init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
+
+       usb->hw.init = &init;
+       usb->pmc = pmc;
+
+       clk = clk_register(NULL, &usb->hw);
+       if (IS_ERR(clk))
+               kfree(usb);
+
+       return clk;
+}
+
+static struct clk * __init
+at91sam9n12_clk_register_usb(struct at91_pmc *pmc, const char *name,
+                            const char *parent_name)
+{
+       struct at91sam9x5_clk_usb *usb;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+
+       usb = kzalloc(sizeof(*usb), GFP_KERNEL);
+       if (!usb)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &at91sam9n12_usb_ops;
+       init.parent_names = &parent_name;
+       init.num_parents = 1;
+       init.flags = CLK_SET_RATE_GATE;
+
+       usb->hw.init = &init;
+       usb->pmc = pmc;
+
+       clk = clk_register(NULL, &usb->hw);
+       if (IS_ERR(clk))
+               kfree(usb);
+
+       return clk;
+}
+
+static unsigned long at91rm9200_clk_usb_recalc_rate(struct clk_hw *hw,
+                                                   unsigned long parent_rate)
+{
+       struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw);
+       struct at91_pmc *pmc = usb->pmc;
+       u32 tmp;
+       u8 usbdiv;
+
+       tmp = pmc_read(pmc, AT91_CKGR_PLLBR);
+       usbdiv = (tmp & AT91_PMC_USBDIV) >> RM9200_USB_DIV_SHIFT;
+       if (usb->divisors[usbdiv])
+               return parent_rate / usb->divisors[usbdiv];
+
+       return 0;
+}
+
+static long at91rm9200_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate,
+                                         unsigned long *parent_rate)
+{
+       struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw);
+       unsigned long bestrate = 0;
+       int bestdiff = -1;
+       unsigned long tmprate;
+       int tmpdiff;
+       int i = 0;
+
+       for (i = 0; i < 4; i++) {
+               if (!usb->divisors[i])
+                       continue;
+               tmprate = *parent_rate / usb->divisors[i];
+               if (tmprate < rate)
+                       tmpdiff = rate - tmprate;
+               else
+                       tmpdiff = tmprate - rate;
+
+               if (bestdiff < 0 || bestdiff > tmpdiff) {
+                       bestrate = tmprate;
+                       bestdiff = tmpdiff;
+               }
+
+               if (!bestdiff)
+                       break;
+       }
+
+       return bestrate;
+}
+
+static int at91rm9200_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate,
+                                      unsigned long parent_rate)
+{
+       u32 tmp;
+       int i;
+       struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw);
+       struct at91_pmc *pmc = usb->pmc;
+       unsigned long div = parent_rate / rate;
+
+       if (parent_rate % rate)
+               return -EINVAL;
+       for (i = 0; i < RM9200_USB_DIV_TAB_SIZE; i++) {
+               if (usb->divisors[i] == div) {
+                       tmp = pmc_read(pmc, AT91_CKGR_PLLBR) &
+                             ~AT91_PMC_USBDIV;
+                       tmp |= i << RM9200_USB_DIV_SHIFT;
+                       pmc_write(pmc, AT91_CKGR_PLLBR, tmp);
+                       return 0;
+               }
+       }
+
+       return -EINVAL;
+}
+
+static const struct clk_ops at91rm9200_usb_ops = {
+       .recalc_rate = at91rm9200_clk_usb_recalc_rate,
+       .round_rate = at91rm9200_clk_usb_round_rate,
+       .set_rate = at91rm9200_clk_usb_set_rate,
+};
+
+static struct clk * __init
+at91rm9200_clk_register_usb(struct at91_pmc *pmc, const char *name,
+                           const char *parent_name, const u32 *divisors)
+{
+       struct at91rm9200_clk_usb *usb;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+
+       usb = kzalloc(sizeof(*usb), GFP_KERNEL);
+       if (!usb)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &at91rm9200_usb_ops;
+       init.parent_names = &parent_name;
+       init.num_parents = 1;
+       init.flags = 0;
+
+       usb->hw.init = &init;
+       usb->pmc = pmc;
+       memcpy(usb->divisors, divisors, sizeof(usb->divisors));
+
+       clk = clk_register(NULL, &usb->hw);
+       if (IS_ERR(clk))
+               kfree(usb);
+
+       return clk;
+}
+
+void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
+                                       struct at91_pmc *pmc)
+{
+       struct clk *clk;
+       int i;
+       int num_parents;
+       const char *parent_names[USB_SOURCE_MAX];
+       const char *name = np->name;
+
+       num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+       if (num_parents <= 0 || num_parents > USB_SOURCE_MAX)
+               return;
+
+       for (i = 0; i < num_parents; i++) {
+               parent_names[i] = of_clk_get_parent_name(np, i);
+               if (!parent_names[i])
+                       return;
+       }
+
+       of_property_read_string(np, "clock-output-names", &name);
+
+       clk = at91sam9x5_clk_register_usb(pmc, name, parent_names, num_parents);
+       if (IS_ERR(clk))
+               return;
+
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+}
+
+void __init of_at91sam9n12_clk_usb_setup(struct device_node *np,
+                                        struct at91_pmc *pmc)
+{
+       struct clk *clk;
+       const char *parent_name;
+       const char *name = np->name;
+
+       parent_name = of_clk_get_parent_name(np, 0);
+       if (!parent_name)
+               return;
+
+       of_property_read_string(np, "clock-output-names", &name);
+
+       clk = at91sam9n12_clk_register_usb(pmc, name, parent_name);
+       if (IS_ERR(clk))
+               return;
+
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+}
+
+void __init of_at91rm9200_clk_usb_setup(struct device_node *np,
+                                       struct at91_pmc *pmc)
+{
+       struct clk *clk;
+       const char *parent_name;
+       const char *name = np->name;
+       u32 divisors[4] = {0, 0, 0, 0};
+
+       parent_name = of_clk_get_parent_name(np, 0);
+       if (!parent_name)
+               return;
+
+       of_property_read_u32_array(np, "atmel,clk-divisors", divisors, 4);
+       if (!divisors[0])
+               return;
+
+       of_property_read_string(np, "clock-output-names", &name);
+
+       clk = at91rm9200_clk_register_usb(pmc, name, parent_name, divisors);
+       if (IS_ERR(clk))
+               return;
+
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+}
diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c
new file mode 100644 (file)
index 0000000..ae3263b
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/at91_pmc.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/io.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+
+#include "pmc.h"
+
+#define UTMI_FIXED_MUL         40
+
+struct clk_utmi {
+       struct clk_hw hw;
+       struct at91_pmc *pmc;
+       unsigned int irq;
+       wait_queue_head_t wait;
+};
+
+#define to_clk_utmi(hw) container_of(hw, struct clk_utmi, hw)
+
+static irqreturn_t clk_utmi_irq_handler(int irq, void *dev_id)
+{
+       struct clk_utmi *utmi = (struct clk_utmi *)dev_id;
+
+       wake_up(&utmi->wait);
+       disable_irq_nosync(utmi->irq);
+
+       return IRQ_HANDLED;
+}
+
+static int clk_utmi_prepare(struct clk_hw *hw)
+{
+       struct clk_utmi *utmi = to_clk_utmi(hw);
+       struct at91_pmc *pmc = utmi->pmc;
+       u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) | AT91_PMC_UPLLEN |
+                 AT91_PMC_UPLLCOUNT | AT91_PMC_BIASEN;
+
+       pmc_write(pmc, AT91_CKGR_UCKR, tmp);
+
+       while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU)) {
+               enable_irq(utmi->irq);
+               wait_event(utmi->wait,
+                          pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU);
+       }
+
+       return 0;
+}
+
+static int clk_utmi_is_prepared(struct clk_hw *hw)
+{
+       struct clk_utmi *utmi = to_clk_utmi(hw);
+       struct at91_pmc *pmc = utmi->pmc;
+
+       return !!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU);
+}
+
+static void clk_utmi_unprepare(struct clk_hw *hw)
+{
+       struct clk_utmi *utmi = to_clk_utmi(hw);
+       struct at91_pmc *pmc = utmi->pmc;
+       u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) & ~AT91_PMC_UPLLEN;
+
+       pmc_write(pmc, AT91_CKGR_UCKR, tmp);
+}
+
+static unsigned long clk_utmi_recalc_rate(struct clk_hw *hw,
+                                         unsigned long parent_rate)
+{
+       /* UTMI clk is a fixed clk multiplier */
+       return parent_rate * UTMI_FIXED_MUL;
+}
+
+static const struct clk_ops utmi_ops = {
+       .prepare = clk_utmi_prepare,
+       .unprepare = clk_utmi_unprepare,
+       .is_prepared = clk_utmi_is_prepared,
+       .recalc_rate = clk_utmi_recalc_rate,
+};
+
+static struct clk * __init
+at91_clk_register_utmi(struct at91_pmc *pmc, unsigned int irq,
+                      const char *name, const char *parent_name)
+{
+       int ret;
+       struct clk_utmi *utmi;
+       struct clk *clk = NULL;
+       struct clk_init_data init;
+
+       utmi = kzalloc(sizeof(*utmi), GFP_KERNEL);
+       if (!utmi)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = name;
+       init.ops = &utmi_ops;
+       init.parent_names = parent_name ? &parent_name : NULL;
+       init.num_parents = parent_name ? 1 : 0;
+       init.flags = CLK_SET_RATE_GATE;
+
+       utmi->hw.init = &init;
+       utmi->pmc = pmc;
+       utmi->irq = irq;
+       init_waitqueue_head(&utmi->wait);
+       irq_set_status_flags(utmi->irq, IRQ_NOAUTOEN);
+       ret = request_irq(utmi->irq, clk_utmi_irq_handler,
+                         IRQF_TRIGGER_HIGH, "clk-utmi", utmi);
+       if (ret)
+               return ERR_PTR(ret);
+
+       clk = clk_register(NULL, &utmi->hw);
+       if (IS_ERR(clk))
+               kfree(utmi);
+
+       return clk;
+}
+
+static void __init
+of_at91_clk_utmi_setup(struct device_node *np, struct at91_pmc *pmc)
+{
+       unsigned int irq;
+       struct clk *clk;
+       const char *parent_name;
+       const char *name = np->name;
+
+       parent_name = of_clk_get_parent_name(np, 0);
+
+       of_property_read_string(np, "clock-output-names", &name);
+
+       irq = irq_of_parse_and_map(np, 0);
+       if (!irq)
+               return;
+
+       clk = at91_clk_register_utmi(pmc, irq, name, parent_name);
+       if (IS_ERR(clk))
+               return;
+
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+       return;
+}
+
+void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np,
+                                        struct at91_pmc *pmc)
+{
+       of_at91_clk_utmi_setup(np, pmc);
+}
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
new file mode 100644 (file)
index 0000000..6a61477
--- /dev/null
@@ -0,0 +1,395 @@
+/*
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/at91_pmc.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/io.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
+#include <linux/of_irq.h>
+
+#include <asm/proc-fns.h>
+
+#include "pmc.h"
+
+void __iomem *at91_pmc_base;
+EXPORT_SYMBOL_GPL(at91_pmc_base);
+
+void at91sam9_idle(void)
+{
+       at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK);
+       cpu_do_idle();
+}
+
+int of_at91_get_clk_range(struct device_node *np, const char *propname,
+                         struct clk_range *range)
+{
+       u32 min, max;
+       int ret;
+
+       ret = of_property_read_u32_index(np, propname, 0, &min);
+       if (ret)
+               return ret;
+
+       ret = of_property_read_u32_index(np, propname, 1, &max);
+       if (ret)
+               return ret;
+
+       if (range) {
+               range->min = min;
+               range->max = max;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(of_at91_get_clk_range);
+
+static void pmc_irq_mask(struct irq_data *d)
+{
+       struct at91_pmc *pmc = irq_data_get_irq_chip_data(d);
+
+       pmc_write(pmc, AT91_PMC_IDR, 1 << d->hwirq);
+}
+
+static void pmc_irq_unmask(struct irq_data *d)
+{
+       struct at91_pmc *pmc = irq_data_get_irq_chip_data(d);
+
+       pmc_write(pmc, AT91_PMC_IER, 1 << d->hwirq);
+}
+
+static int pmc_irq_set_type(struct irq_data *d, unsigned type)
+{
+       if (type != IRQ_TYPE_LEVEL_HIGH) {
+               pr_warn("PMC: type not supported (support only IRQ_TYPE_LEVEL_HIGH type)\n");
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static struct irq_chip pmc_irq = {
+       .name = "PMC",
+       .irq_disable = pmc_irq_mask,
+       .irq_mask = pmc_irq_mask,
+       .irq_unmask = pmc_irq_unmask,
+       .irq_set_type = pmc_irq_set_type,
+};
+
+static struct lock_class_key pmc_lock_class;
+
+static int pmc_irq_map(struct irq_domain *h, unsigned int virq,
+                      irq_hw_number_t hw)
+{
+       struct at91_pmc *pmc = h->host_data;
+
+       irq_set_lockdep_class(virq, &pmc_lock_class);
+
+       irq_set_chip_and_handler(virq, &pmc_irq,
+                                handle_level_irq);
+       set_irq_flags(virq, IRQF_VALID);
+       irq_set_chip_data(virq, pmc);
+
+       return 0;
+}
+
+static int pmc_irq_domain_xlate(struct irq_domain *d,
+                               struct device_node *ctrlr,
+                               const u32 *intspec, unsigned int intsize,
+                               irq_hw_number_t *out_hwirq,
+                               unsigned int *out_type)
+{
+       struct at91_pmc *pmc = d->host_data;
+       const struct at91_pmc_caps *caps = pmc->caps;
+
+       if (WARN_ON(intsize < 1))
+               return -EINVAL;
+
+       *out_hwirq = intspec[0];
+
+       if (!(caps->available_irqs & (1 << *out_hwirq)))
+               return -EINVAL;
+
+       *out_type = IRQ_TYPE_LEVEL_HIGH;
+
+       return 0;
+}
+
+static struct irq_domain_ops pmc_irq_ops = {
+       .map    = pmc_irq_map,
+       .xlate  = pmc_irq_domain_xlate,
+};
+
+static irqreturn_t pmc_irq_handler(int irq, void *data)
+{
+       struct at91_pmc *pmc = (struct at91_pmc *)data;
+       unsigned long sr;
+       int n;
+
+       sr = pmc_read(pmc, AT91_PMC_SR) & pmc_read(pmc, AT91_PMC_IMR);
+       if (!sr)
+               return IRQ_NONE;
+
+       for_each_set_bit(n, &sr, BITS_PER_LONG)
+               generic_handle_irq(irq_find_mapping(pmc->irqdomain, n));
+
+       return IRQ_HANDLED;
+}
+
+static const struct at91_pmc_caps at91rm9200_caps = {
+       .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB |
+                         AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY |
+                         AT91_PMC_PCK1RDY | AT91_PMC_PCK2RDY |
+                         AT91_PMC_PCK3RDY,
+};
+
+static const struct at91_pmc_caps at91sam9260_caps = {
+       .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB |
+                         AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY |
+                         AT91_PMC_PCK1RDY,
+};
+
+static const struct at91_pmc_caps at91sam9g45_caps = {
+       .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY |
+                         AT91_PMC_LOCKU | AT91_PMC_PCK0RDY |
+                         AT91_PMC_PCK1RDY,
+};
+
+static const struct at91_pmc_caps at91sam9n12_caps = {
+       .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB |
+                         AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY |
+                         AT91_PMC_PCK1RDY | AT91_PMC_MOSCSELS |
+                         AT91_PMC_MOSCRCS | AT91_PMC_CFDEV,
+};
+
+static const struct at91_pmc_caps at91sam9x5_caps = {
+       .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY |
+                         AT91_PMC_LOCKU | AT91_PMC_PCK0RDY |
+                         AT91_PMC_PCK1RDY | AT91_PMC_MOSCSELS |
+                         AT91_PMC_MOSCRCS | AT91_PMC_CFDEV,
+};
+
+static const struct at91_pmc_caps sama5d3_caps = {
+       .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY |
+                         AT91_PMC_LOCKU | AT91_PMC_PCK0RDY |
+                         AT91_PMC_PCK1RDY | AT91_PMC_PCK2RDY |
+                         AT91_PMC_MOSCSELS | AT91_PMC_MOSCRCS |
+                         AT91_PMC_CFDEV,
+};
+
+static struct at91_pmc *__init at91_pmc_init(struct device_node *np,
+                                            void __iomem *regbase, int virq,
+                                            const struct at91_pmc_caps *caps)
+{
+       struct at91_pmc *pmc;
+
+       if (!regbase || !virq ||  !caps)
+               return NULL;
+
+       at91_pmc_base = regbase;
+
+       pmc = kzalloc(sizeof(*pmc), GFP_KERNEL);
+       if (!pmc)
+               return NULL;
+
+       spin_lock_init(&pmc->lock);
+       pmc->regbase = regbase;
+       pmc->virq = virq;
+       pmc->caps = caps;
+
+       pmc->irqdomain = irq_domain_add_linear(np, 32, &pmc_irq_ops, pmc);
+
+       if (!pmc->irqdomain)
+               goto out_free_pmc;
+
+       pmc_write(pmc, AT91_PMC_IDR, 0xffffffff);
+       if (request_irq(pmc->virq, pmc_irq_handler, IRQF_SHARED, "pmc", pmc))
+               goto out_remove_irqdomain;
+
+       return pmc;
+
+out_remove_irqdomain:
+       irq_domain_remove(pmc->irqdomain);
+out_free_pmc:
+       kfree(pmc);
+
+       return NULL;
+}
+
+static const struct of_device_id pmc_clk_ids[] __initconst = {
+       /* Main clock */
+       {
+               .compatible = "atmel,at91rm9200-clk-main",
+               .data = of_at91rm9200_clk_main_setup,
+       },
+       /* PLL clocks */
+       {
+               .compatible = "atmel,at91rm9200-clk-pll",
+               .data = of_at91rm9200_clk_pll_setup,
+       },
+       {
+               .compatible = "atmel,at91sam9g45-clk-pll",
+               .data = of_at91sam9g45_clk_pll_setup,
+       },
+       {
+               .compatible = "atmel,at91sam9g20-clk-pllb",
+               .data = of_at91sam9g20_clk_pllb_setup,
+       },
+       {
+               .compatible = "atmel,sama5d3-clk-pll",
+               .data = of_sama5d3_clk_pll_setup,
+       },
+       {
+               .compatible = "atmel,at91sam9x5-clk-plldiv",
+               .data = of_at91sam9x5_clk_plldiv_setup,
+       },
+       /* Master clock */
+       {
+               .compatible = "atmel,at91rm9200-clk-master",
+               .data = of_at91rm9200_clk_master_setup,
+       },
+       {
+               .compatible = "atmel,at91sam9x5-clk-master",
+               .data = of_at91sam9x5_clk_master_setup,
+       },
+       /* System clocks */
+       {
+               .compatible = "atmel,at91rm9200-clk-system",
+               .data = of_at91rm9200_clk_sys_setup,
+       },
+       /* Peripheral clocks */
+       {
+               .compatible = "atmel,at91rm9200-clk-peripheral",
+               .data = of_at91rm9200_clk_periph_setup,
+       },
+       {
+               .compatible = "atmel,at91sam9x5-clk-peripheral",
+               .data = of_at91sam9x5_clk_periph_setup,
+       },
+       /* Programmable clocks */
+       {
+               .compatible = "atmel,at91rm9200-clk-programmable",
+               .data = of_at91rm9200_clk_prog_setup,
+       },
+       {
+               .compatible = "atmel,at91sam9g45-clk-programmable",
+               .data = of_at91sam9g45_clk_prog_setup,
+       },
+       {
+               .compatible = "atmel,at91sam9x5-clk-programmable",
+               .data = of_at91sam9x5_clk_prog_setup,
+       },
+       /* UTMI clock */
+#if defined(CONFIG_HAVE_AT91_UTMI)
+       {
+               .compatible = "atmel,at91sam9x5-clk-utmi",
+               .data = of_at91sam9x5_clk_utmi_setup,
+       },
+#endif
+       /* USB clock */
+#if defined(CONFIG_HAVE_AT91_USB_CLK)
+       {
+               .compatible = "atmel,at91rm9200-clk-usb",
+               .data = of_at91rm9200_clk_usb_setup,
+       },
+       {
+               .compatible = "atmel,at91sam9x5-clk-usb",
+               .data = of_at91sam9x5_clk_usb_setup,
+       },
+       {
+               .compatible = "atmel,at91sam9n12-clk-usb",
+               .data = of_at91sam9n12_clk_usb_setup,
+       },
+#endif
+       /* SMD clock */
+#if defined(CONFIG_HAVE_AT91_SMD)
+       {
+               .compatible = "atmel,at91sam9x5-clk-smd",
+               .data = of_at91sam9x5_clk_smd_setup,
+       },
+#endif
+       { /*sentinel*/ }
+};
+
+static void __init of_at91_pmc_setup(struct device_node *np,
+                                    const struct at91_pmc_caps *caps)
+{
+       struct at91_pmc *pmc;
+       struct device_node *childnp;
+       void (*clk_setup)(struct device_node *, struct at91_pmc *);
+       const struct of_device_id *clk_id;
+       void __iomem *regbase = of_iomap(np, 0);
+       int virq;
+
+       if (!regbase)
+               return;
+
+       virq = irq_of_parse_and_map(np, 0);
+       if (!virq)
+               return;
+
+       pmc = at91_pmc_init(np, regbase, virq, caps);
+       if (!pmc)
+               return;
+       for_each_child_of_node(np, childnp) {
+               clk_id = of_match_node(pmc_clk_ids, childnp);
+               if (!clk_id)
+                       continue;
+               clk_setup = clk_id->data;
+               clk_setup(childnp, pmc);
+       }
+}
+
+static void __init of_at91rm9200_pmc_setup(struct device_node *np)
+{
+       of_at91_pmc_setup(np, &at91rm9200_caps);
+}
+CLK_OF_DECLARE(at91rm9200_clk_pmc, "atmel,at91rm9200-pmc",
+              of_at91rm9200_pmc_setup);
+
+static void __init of_at91sam9260_pmc_setup(struct device_node *np)
+{
+       of_at91_pmc_setup(np, &at91sam9260_caps);
+}
+CLK_OF_DECLARE(at91sam9260_clk_pmc, "atmel,at91sam9260-pmc",
+              of_at91sam9260_pmc_setup);
+
+static void __init of_at91sam9g45_pmc_setup(struct device_node *np)
+{
+       of_at91_pmc_setup(np, &at91sam9g45_caps);
+}
+CLK_OF_DECLARE(at91sam9g45_clk_pmc, "atmel,at91sam9g45-pmc",
+              of_at91sam9g45_pmc_setup);
+
+static void __init of_at91sam9n12_pmc_setup(struct device_node *np)
+{
+       of_at91_pmc_setup(np, &at91sam9n12_caps);
+}
+CLK_OF_DECLARE(at91sam9n12_clk_pmc, "atmel,at91sam9n12-pmc",
+              of_at91sam9n12_pmc_setup);
+
+static void __init of_at91sam9x5_pmc_setup(struct device_node *np)
+{
+       of_at91_pmc_setup(np, &at91sam9x5_caps);
+}
+CLK_OF_DECLARE(at91sam9x5_clk_pmc, "atmel,at91sam9x5-pmc",
+              of_at91sam9x5_pmc_setup);
+
+static void __init of_sama5d3_pmc_setup(struct device_node *np)
+{
+       of_at91_pmc_setup(np, &sama5d3_caps);
+}
+CLK_OF_DECLARE(sama5d3_clk_pmc, "atmel,sama5d3-pmc",
+              of_sama5d3_pmc_setup);
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
new file mode 100644 (file)
index 0000000..4413509
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * drivers/clk/at91/pmc.h
+ *
+ *  Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __PMC_H_
+#define __PMC_H_
+
+#include <linux/io.h>
+#include <linux/irqdomain.h>
+#include <linux/spinlock.h>
+
+struct clk_range {
+       unsigned long min;
+       unsigned long max;
+};
+
+#define CLK_RANGE(MIN, MAX) {.min = MIN, .max = MAX,}
+
+struct at91_pmc_caps {
+       u32 available_irqs;
+};
+
+struct at91_pmc {
+       void __iomem *regbase;
+       int virq;
+       spinlock_t lock;
+       const struct at91_pmc_caps *caps;
+       struct irq_domain *irqdomain;
+};
+
+static inline void pmc_lock(struct at91_pmc *pmc)
+{
+       spin_lock(&pmc->lock);
+}
+
+static inline void pmc_unlock(struct at91_pmc *pmc)
+{
+       spin_unlock(&pmc->lock);
+}
+
+static inline u32 pmc_read(struct at91_pmc *pmc, int offset)
+{
+       return readl(pmc->regbase + offset);
+}
+
+static inline void pmc_write(struct at91_pmc *pmc, int offset, u32 value)
+{
+       writel(value, pmc->regbase + offset);
+}
+
+int of_at91_get_clk_range(struct device_node *np, const char *propname,
+                         struct clk_range *range);
+
+extern void __init of_at91rm9200_clk_main_setup(struct device_node *np,
+                                               struct at91_pmc *pmc);
+
+extern void __init of_at91rm9200_clk_pll_setup(struct device_node *np,
+                                              struct at91_pmc *pmc);
+extern void __init of_at91sam9g45_clk_pll_setup(struct device_node *np,
+                                               struct at91_pmc *pmc);
+extern void __init of_at91sam9g20_clk_pllb_setup(struct device_node *np,
+                                                struct at91_pmc *pmc);
+extern void __init of_sama5d3_clk_pll_setup(struct device_node *np,
+                                           struct at91_pmc *pmc);
+extern void __init of_at91sam9x5_clk_plldiv_setup(struct device_node *np,
+                                                 struct at91_pmc *pmc);
+
+extern void __init of_at91rm9200_clk_master_setup(struct device_node *np,
+                                                 struct at91_pmc *pmc);
+extern void __init of_at91sam9x5_clk_master_setup(struct device_node *np,
+                                                 struct at91_pmc *pmc);
+
+extern void __init of_at91rm9200_clk_sys_setup(struct device_node *np,
+                                              struct at91_pmc *pmc);
+
+extern void __init of_at91rm9200_clk_periph_setup(struct device_node *np,
+                                                 struct at91_pmc *pmc);
+extern void __init of_at91sam9x5_clk_periph_setup(struct device_node *np,
+                                                 struct at91_pmc *pmc);
+
+extern void __init of_at91rm9200_clk_prog_setup(struct device_node *np,
+                                               struct at91_pmc *pmc);
+extern void __init of_at91sam9g45_clk_prog_setup(struct device_node *np,
+                                                struct at91_pmc *pmc);
+extern void __init of_at91sam9x5_clk_prog_setup(struct device_node *np,
+                                               struct at91_pmc *pmc);
+
+#if defined(CONFIG_HAVE_AT91_UTMI)
+extern void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np,
+                                               struct at91_pmc *pmc);
+#endif
+
+#if defined(CONFIG_HAVE_AT91_USB_CLK)
+extern void __init of_at91rm9200_clk_usb_setup(struct device_node *np,
+                                              struct at91_pmc *pmc);
+extern void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
+                                              struct at91_pmc *pmc);
+extern void __init of_at91sam9n12_clk_usb_setup(struct device_node *np,
+                                               struct at91_pmc *pmc);
+#endif
+
+#if defined(CONFIG_HAVE_AT91_SMD)
+extern void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
+                                              struct at91_pmc *pmc);
+#endif
+
+#endif /* __PMC_H_ */
index a33f46f20a415c7fb925f1531a6791c4ecd2055c..57a078e06efe7cd376432d4ced0b9b41be539f1d 100644 (file)
@@ -55,6 +55,30 @@ static unsigned long clk_composite_recalc_rate(struct clk_hw *hw,
        return rate_ops->recalc_rate(rate_hw, parent_rate);
 }
 
+static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate,
+                                       unsigned long *best_parent_rate,
+                                       struct clk **best_parent_p)
+{
+       struct clk_composite *composite = to_clk_composite(hw);
+       const struct clk_ops *rate_ops = composite->rate_ops;
+       const struct clk_ops *mux_ops = composite->mux_ops;
+       struct clk_hw *rate_hw = composite->rate_hw;
+       struct clk_hw *mux_hw = composite->mux_hw;
+
+       if (rate_hw && rate_ops && rate_ops->determine_rate) {
+               rate_hw->clk = hw->clk;
+               return rate_ops->determine_rate(rate_hw, rate, best_parent_rate,
+                                               best_parent_p);
+       } else if (mux_hw && mux_ops && mux_ops->determine_rate) {
+               mux_hw->clk = hw->clk;
+               return mux_ops->determine_rate(mux_hw, rate, best_parent_rate,
+                                              best_parent_p);
+       } else {
+               pr_err("clk: clk_composite_determine_rate function called, but no mux or rate callback set!\n");
+               return 0;
+       }
+}
+
 static long clk_composite_round_rate(struct clk_hw *hw, unsigned long rate,
                                  unsigned long *prate)
 {
@@ -147,6 +171,8 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
                composite->mux_ops = mux_ops;
                clk_composite_ops->get_parent = clk_composite_get_parent;
                clk_composite_ops->set_parent = clk_composite_set_parent;
+               if (mux_ops->determine_rate)
+                       clk_composite_ops->determine_rate = clk_composite_determine_rate;
        }
 
        if (rate_hw && rate_ops) {
@@ -170,6 +196,8 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
                composite->rate_hw = rate_hw;
                composite->rate_ops = rate_ops;
                clk_composite_ops->recalc_rate = clk_composite_recalc_rate;
+               if (rate_ops->determine_rate)
+                       clk_composite_ops->determine_rate = clk_composite_determine_rate;
        }
 
        if (gate_hw && gate_ops) {
index 1ed591ab8b1d9d468a3da08c6c31c50e77b66d7b..0fc56ab6e844c88493e68f86b6a1fed8884a516e 100644 (file)
@@ -34,22 +34,31 @@ static unsigned long clk_fixed_rate_recalc_rate(struct clk_hw *hw,
        return to_clk_fixed_rate(hw)->fixed_rate;
 }
 
+static unsigned long clk_fixed_rate_recalc_accuracy(struct clk_hw *hw,
+               unsigned long parent_accuracy)
+{
+       return to_clk_fixed_rate(hw)->fixed_accuracy;
+}
+
 const struct clk_ops clk_fixed_rate_ops = {
        .recalc_rate = clk_fixed_rate_recalc_rate,
+       .recalc_accuracy = clk_fixed_rate_recalc_accuracy,
 };
 EXPORT_SYMBOL_GPL(clk_fixed_rate_ops);
 
 /**
- * clk_register_fixed_rate - register fixed-rate clock with the clock framework
+ * clk_register_fixed_rate_with_accuracy - register fixed-rate clock with the
+ *                                        clock framework
  * @dev: device that is registering this clock
  * @name: name of this clock
  * @parent_name: name of clock's parent
  * @flags: framework-specific flags
  * @fixed_rate: non-adjustable clock rate
+ * @fixed_accuracy: non-adjustable clock rate
  */
-struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
-               const char *parent_name, unsigned long flags,
-               unsigned long fixed_rate)
+struct clk *clk_register_fixed_rate_with_accuracy(struct device *dev,
+               const char *name, const char *parent_name, unsigned long flags,
+               unsigned long fixed_rate, unsigned long fixed_accuracy)
 {
        struct clk_fixed_rate *fixed;
        struct clk *clk;
@@ -70,16 +79,33 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
 
        /* struct clk_fixed_rate assignments */
        fixed->fixed_rate = fixed_rate;
+       fixed->fixed_accuracy = fixed_accuracy;
        fixed->hw.init = &init;
 
        /* register the clock */
        clk = clk_register(dev, &fixed->hw);
-
        if (IS_ERR(clk))
                kfree(fixed);
 
        return clk;
 }
+EXPORT_SYMBOL_GPL(clk_register_fixed_rate_with_accuracy);
+
+/**
+ * clk_register_fixed_rate - register fixed-rate clock with the clock framework
+ * @dev: device that is registering this clock
+ * @name: name of this clock
+ * @parent_name: name of clock's parent
+ * @flags: framework-specific flags
+ * @fixed_rate: non-adjustable clock rate
+ */
+struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
+               const char *parent_name, unsigned long flags,
+               unsigned long fixed_rate)
+{
+       return clk_register_fixed_rate_with_accuracy(dev, name, parent_name,
+                                                    flags, fixed_rate, 0);
+}
 EXPORT_SYMBOL_GPL(clk_register_fixed_rate);
 
 #ifdef CONFIG_OF
@@ -91,13 +117,18 @@ void of_fixed_clk_setup(struct device_node *node)
        struct clk *clk;
        const char *clk_name = node->name;
        u32 rate;
+       u32 accuracy = 0;
 
        if (of_property_read_u32(node, "clock-frequency", &rate))
                return;
 
+       of_property_read_u32(node, "clock-accuracy", &accuracy);
+
        of_property_read_string(node, "clock-output-names", &clk_name);
 
-       clk = clk_register_fixed_rate(NULL, clk_name, NULL, CLK_IS_ROOT, rate);
+       clk = clk_register_fixed_rate_with_accuracy(NULL, clk_name, NULL,
+                                                   CLK_IS_ROOT, rate,
+                                                   accuracy);
        if (!IS_ERR(clk))
                of_clk_add_provider(node, of_clk_src_simple_get, clk);
 }
index 9f57bc37cd60a3e7559c3972e2eb0ac55145b2b9..3d7e8dd8fd58ffba2dba7c39451bfa3f0d09ba0a 100644 (file)
@@ -66,7 +66,7 @@ static void max77686_clk_unprepare(struct clk_hw *hw)
                MAX77686_REG_32KHZ, max77686->mask, ~max77686->mask);
 }
 
-static int max77686_clk_is_enabled(struct clk_hw *hw)
+static int max77686_clk_is_prepared(struct clk_hw *hw)
 {
        struct max77686_clk *max77686 = to_max77686_clk(hw);
        int ret;
@@ -81,10 +81,17 @@ static int max77686_clk_is_enabled(struct clk_hw *hw)
        return val & max77686->mask;
 }
 
+static unsigned long max77686_recalc_rate(struct clk_hw *hw,
+                                         unsigned long parent_rate)
+{
+       return 32768;
+}
+
 static struct clk_ops max77686_clk_ops = {
        .prepare        = max77686_clk_prepare,
        .unprepare      = max77686_clk_unprepare,
-       .is_enabled     = max77686_clk_is_enabled,
+       .is_prepared    = max77686_clk_is_prepared,
+       .recalc_rate    = max77686_recalc_rate,
 };
 
 static struct clk_init_data max77686_clks_init[MAX77686_CLKS_NUM] = {
@@ -105,38 +112,38 @@ static struct clk_init_data max77686_clks_init[MAX77686_CLKS_NUM] = {
        },
 };
 
-static int max77686_clk_register(struct device *dev,
+static struct clk *max77686_clk_register(struct device *dev,
                                struct max77686_clk *max77686)
 {
        struct clk *clk;
        struct clk_hw *hw = &max77686->hw;
 
        clk = clk_register(dev, hw);
-
        if (IS_ERR(clk))
-               return -ENOMEM;
+               return clk;
 
        max77686->lookup = kzalloc(sizeof(struct clk_lookup), GFP_KERNEL);
        if (!max77686->lookup)
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
 
        max77686->lookup->con_id = hw->init->name;
        max77686->lookup->clk = clk;
 
        clkdev_add(max77686->lookup);
 
-       return 0;
+       return clk;
 }
 
 static int max77686_clk_probe(struct platform_device *pdev)
 {
        struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
-       struct max77686_clk **max77686_clks;
+       struct max77686_clk *max77686_clks[MAX77686_CLKS_NUM];
+       struct clk **clocks;
        int i, ret;
 
-       max77686_clks = devm_kzalloc(&pdev->dev, sizeof(struct max77686_clk *)
+       clocks = devm_kzalloc(&pdev->dev, sizeof(struct clk *)
                                        * MAX77686_CLKS_NUM, GFP_KERNEL);
-       if (!max77686_clks)
+       if (!clocks)
                return -ENOMEM;
 
        for (i = 0; i < MAX77686_CLKS_NUM; i++) {
@@ -151,47 +158,63 @@ static int max77686_clk_probe(struct platform_device *pdev)
                max77686_clks[i]->mask = 1 << i;
                max77686_clks[i]->hw.init = &max77686_clks_init[i];
 
-               ret = max77686_clk_register(&pdev->dev, max77686_clks[i]);
+               clocks[i] = max77686_clk_register(&pdev->dev, max77686_clks[i]);
+               if (IS_ERR(clocks[i])) {
+                       ret = PTR_ERR(clocks[i]);
+                       dev_err(&pdev->dev, "failed to register %s\n",
+                               max77686_clks[i]->hw.init->name);
+                       goto err_clocks;
+               }
+       }
+
+       platform_set_drvdata(pdev, clocks);
+
+       if (iodev->dev->of_node) {
+               struct clk_onecell_data *of_data;
+
+               of_data = devm_kzalloc(&pdev->dev,
+                                       sizeof(*of_data), GFP_KERNEL);
+               if (!of_data) {
+                       ret = -ENOMEM;
+                       goto err_clocks;
+               }
+
+               of_data->clks = clocks;
+               of_data->clk_num = MAX77686_CLKS_NUM;
+               ret = of_clk_add_provider(iodev->dev->of_node,
+                                       of_clk_src_onecell_get, of_data);
                if (ret) {
-                       switch (i) {
-                       case MAX77686_CLK_AP:
-                               dev_err(&pdev->dev, "Fail to register CLK_AP\n");
-                               goto err_clk_ap;
-                               break;
-                       case MAX77686_CLK_CP:
-                               dev_err(&pdev->dev, "Fail to register CLK_CP\n");
-                               goto err_clk_cp;
-                               break;
-                       case MAX77686_CLK_PMIC:
-                               dev_err(&pdev->dev, "Fail to register CLK_PMIC\n");
-                               goto err_clk_pmic;
-                       }
+                       dev_err(&pdev->dev, "failed to register OF clock provider\n");
+                       goto err_clocks;
                }
        }
 
-       platform_set_drvdata(pdev, max77686_clks);
+       return 0;
 
-       goto out;
+err_clocks:
+       for (--i; i >= 0; --i) {
+               clkdev_drop(max77686_clks[i]->lookup);
+               clk_unregister(max77686_clks[i]->hw.clk);
+       }
 
-err_clk_pmic:
-       clkdev_drop(max77686_clks[MAX77686_CLK_CP]->lookup);
-       kfree(max77686_clks[MAX77686_CLK_CP]->hw.clk);
-err_clk_cp:
-       clkdev_drop(max77686_clks[MAX77686_CLK_AP]->lookup);
-       kfree(max77686_clks[MAX77686_CLK_AP]->hw.clk);
-err_clk_ap:
-out:
        return ret;
 }
 
 static int max77686_clk_remove(struct platform_device *pdev)
 {
-       struct max77686_clk **max77686_clks = platform_get_drvdata(pdev);
+       struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
+       struct clk **clocks = platform_get_drvdata(pdev);
        int i;
 
+       if (iodev->dev->of_node)
+               of_clk_del_provider(iodev->dev->of_node);
+
        for (i = 0; i < MAX77686_CLKS_NUM; i++) {
-               clkdev_drop(max77686_clks[i]->lookup);
-               kfree(max77686_clks[i]->hw.clk);
+               struct clk_hw *hw = __clk_get_hw(clocks[i]);
+               struct max77686_clk *max77686 = to_max77686_clk(hw);
+
+               clkdev_drop(max77686->lookup);
+               clk_unregister(clocks[i]);
        }
        return 0;
 }
diff --git a/drivers/clk/clk-prima2.c b/drivers/clk/clk-prima2.c
deleted file mode 100644 (file)
index 6c15e33..0000000
+++ /dev/null
@@ -1,1109 +0,0 @@
-/*
- * Clock tree for CSR SiRFprimaII
- *
- * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
- */
-
-#include <linux/module.h>
-#include <linux/bitops.h>
-#include <linux/io.h>
-#include <linux/clk.h>
-#include <linux/clkdev.h>
-#include <linux/clk-provider.h>
-#include <linux/of_address.h>
-#include <linux/syscore_ops.h>
-
-#define SIRFSOC_CLKC_CLK_EN0    0x0000
-#define SIRFSOC_CLKC_CLK_EN1    0x0004
-#define SIRFSOC_CLKC_REF_CFG    0x0014
-#define SIRFSOC_CLKC_CPU_CFG    0x0018
-#define SIRFSOC_CLKC_MEM_CFG    0x001c
-#define SIRFSOC_CLKC_SYS_CFG    0x0020
-#define SIRFSOC_CLKC_IO_CFG     0x0024
-#define SIRFSOC_CLKC_DSP_CFG    0x0028
-#define SIRFSOC_CLKC_GFX_CFG    0x002c
-#define SIRFSOC_CLKC_MM_CFG     0x0030
-#define SIRFSOC_CLKC_LCD_CFG     0x0034
-#define SIRFSOC_CLKC_MMC_CFG    0x0038
-#define SIRFSOC_CLKC_PLL1_CFG0  0x0040
-#define SIRFSOC_CLKC_PLL2_CFG0  0x0044
-#define SIRFSOC_CLKC_PLL3_CFG0  0x0048
-#define SIRFSOC_CLKC_PLL1_CFG1  0x004c
-#define SIRFSOC_CLKC_PLL2_CFG1  0x0050
-#define SIRFSOC_CLKC_PLL3_CFG1  0x0054
-#define SIRFSOC_CLKC_PLL1_CFG2  0x0058
-#define SIRFSOC_CLKC_PLL2_CFG2  0x005c
-#define SIRFSOC_CLKC_PLL3_CFG2  0x0060
-#define SIRFSOC_USBPHY_PLL_CTRL 0x0008
-#define SIRFSOC_USBPHY_PLL_POWERDOWN  BIT(1)
-#define SIRFSOC_USBPHY_PLL_BYPASS     BIT(2)
-#define SIRFSOC_USBPHY_PLL_LOCK       BIT(3)
-
-static void *sirfsoc_clk_vbase, *sirfsoc_rsc_vbase;
-
-#define KHZ     1000
-#define MHZ     (KHZ * KHZ)
-
-/*
- * SiRFprimaII clock controller
- * - 2 oscillators: osc-26MHz, rtc-32.768KHz
- * - 3 standard configurable plls: pll1, pll2 & pll3
- * - 2 exclusive plls: usb phy pll and sata phy pll
- * - 8 clock domains: cpu/cpudiv, mem/memdiv, sys/io, dsp, graphic, multimedia,
- *     display and sdphy.
- *     Each clock domain can select its own clock source from five clock sources,
- *     X_XIN, X_XINW, PLL1, PLL2 and PLL3. The domain clock is used as the source
- *     clock of the group clock.
- *     - dsp domain: gps, mf
- *     - io domain: dmac, nand, audio, uart, i2c, spi, usp, pwm, pulse
- *     - sys domain: security
- */
-
-struct clk_pll {
-       struct clk_hw hw;
-       unsigned short regofs;  /* register offset */
-};
-
-#define to_pllclk(_hw) container_of(_hw, struct clk_pll, hw)
-
-struct clk_dmn {
-       struct clk_hw hw;
-       signed char enable_bit; /* enable bit: 0 ~ 63 */
-       unsigned short regofs;  /* register offset */
-};
-
-#define to_dmnclk(_hw) container_of(_hw, struct clk_dmn, hw)
-
-struct clk_std {
-       struct clk_hw hw;
-       signed char enable_bit; /* enable bit: 0 ~ 63 */
-};
-
-#define to_stdclk(_hw) container_of(_hw, struct clk_std, hw)
-
-static int std_clk_is_enabled(struct clk_hw *hw);
-static int std_clk_enable(struct clk_hw *hw);
-static void std_clk_disable(struct clk_hw *hw);
-
-static inline unsigned long clkc_readl(unsigned reg)
-{
-       return readl(sirfsoc_clk_vbase + reg);
-}
-
-static inline void clkc_writel(u32 val, unsigned reg)
-{
-       writel(val, sirfsoc_clk_vbase + reg);
-}
-
-/*
- * std pll
- */
-
-static unsigned long pll_clk_recalc_rate(struct clk_hw *hw,
-       unsigned long parent_rate)
-{
-       unsigned long fin = parent_rate;
-       struct clk_pll *clk = to_pllclk(hw);
-       u32 regcfg2 = clk->regofs + SIRFSOC_CLKC_PLL1_CFG2 -
-               SIRFSOC_CLKC_PLL1_CFG0;
-
-       if (clkc_readl(regcfg2) & BIT(2)) {
-               /* pll bypass mode */
-               return fin;
-       } else {
-               /* fout = fin * nf / nr / od */
-               u32 cfg0 = clkc_readl(clk->regofs);
-               u32 nf = (cfg0 & (BIT(13) - 1)) + 1;
-               u32 nr = ((cfg0 >> 13) & (BIT(6) - 1)) + 1;
-               u32 od = ((cfg0 >> 19) & (BIT(4) - 1)) + 1;
-               WARN_ON(fin % MHZ);
-               return fin / MHZ * nf / nr / od * MHZ;
-       }
-}
-
-static long pll_clk_round_rate(struct clk_hw *hw, unsigned long rate,
-       unsigned long *parent_rate)
-{
-       unsigned long fin, nf, nr, od;
-
-       /*
-        * fout = fin * nf / (nr * od);
-        * set od = 1, nr = fin/MHz, so fout = nf * MHz
-        */
-       rate = rate - rate % MHZ;
-
-       nf = rate / MHZ;
-       if (nf > BIT(13))
-               nf = BIT(13);
-       if (nf < 1)
-               nf = 1;
-
-       fin = *parent_rate;
-
-       nr = fin / MHZ;
-       if (nr > BIT(6))
-               nr = BIT(6);
-       od = 1;
-
-       return fin * nf / (nr * od);
-}
-
-static int pll_clk_set_rate(struct clk_hw *hw, unsigned long rate,
-       unsigned long parent_rate)
-{
-       struct clk_pll *clk = to_pllclk(hw);
-       unsigned long fin, nf, nr, od, reg;
-
-       /*
-        * fout = fin * nf / (nr * od);
-        * set od = 1, nr = fin/MHz, so fout = nf * MHz
-        */
-
-       nf = rate / MHZ;
-       if (unlikely((rate % MHZ) || nf > BIT(13) || nf < 1))
-               return -EINVAL;
-
-       fin = parent_rate;
-       BUG_ON(fin < MHZ);
-
-       nr = fin / MHZ;
-       BUG_ON((fin % MHZ) || nr > BIT(6));
-
-       od = 1;
-
-       reg = (nf - 1) | ((nr - 1) << 13) | ((od - 1) << 19);
-       clkc_writel(reg, clk->regofs);
-
-       reg = clk->regofs + SIRFSOC_CLKC_PLL1_CFG1 - SIRFSOC_CLKC_PLL1_CFG0;
-       clkc_writel((nf >> 1) - 1, reg);
-
-       reg = clk->regofs + SIRFSOC_CLKC_PLL1_CFG2 - SIRFSOC_CLKC_PLL1_CFG0;
-       while (!(clkc_readl(reg) & BIT(6)))
-               cpu_relax();
-
-       return 0;
-}
-
-static struct clk_ops std_pll_ops = {
-       .recalc_rate = pll_clk_recalc_rate,
-       .round_rate = pll_clk_round_rate,
-       .set_rate = pll_clk_set_rate,
-};
-
-static const char *pll_clk_parents[] = {
-       "osc",
-};
-
-static struct clk_init_data clk_pll1_init = {
-       .name = "pll1",
-       .ops = &std_pll_ops,
-       .parent_names = pll_clk_parents,
-       .num_parents = ARRAY_SIZE(pll_clk_parents),
-};
-
-static struct clk_init_data clk_pll2_init = {
-       .name = "pll2",
-       .ops = &std_pll_ops,
-       .parent_names = pll_clk_parents,
-       .num_parents = ARRAY_SIZE(pll_clk_parents),
-};
-
-static struct clk_init_data clk_pll3_init = {
-       .name = "pll3",
-       .ops = &std_pll_ops,
-       .parent_names = pll_clk_parents,
-       .num_parents = ARRAY_SIZE(pll_clk_parents),
-};
-
-static struct clk_pll clk_pll1 = {
-       .regofs = SIRFSOC_CLKC_PLL1_CFG0,
-       .hw = {
-               .init = &clk_pll1_init,
-       },
-};
-
-static struct clk_pll clk_pll2 = {
-       .regofs = SIRFSOC_CLKC_PLL2_CFG0,
-       .hw = {
-               .init = &clk_pll2_init,
-       },
-};
-
-static struct clk_pll clk_pll3 = {
-       .regofs = SIRFSOC_CLKC_PLL3_CFG0,
-       .hw = {
-               .init = &clk_pll3_init,
-       },
-};
-
-/*
- * usb uses specified pll
- */
-
-static int usb_pll_clk_enable(struct clk_hw *hw)
-{
-       u32 reg = readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL);
-       reg &= ~(SIRFSOC_USBPHY_PLL_POWERDOWN | SIRFSOC_USBPHY_PLL_BYPASS);
-       writel(reg, sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL);
-       while (!(readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL) &
-                       SIRFSOC_USBPHY_PLL_LOCK))
-               cpu_relax();
-
-       return 0;
-}
-
-static void usb_pll_clk_disable(struct clk_hw *clk)
-{
-       u32 reg = readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL);
-       reg |= (SIRFSOC_USBPHY_PLL_POWERDOWN | SIRFSOC_USBPHY_PLL_BYPASS);
-       writel(reg, sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL);
-}
-
-static unsigned long usb_pll_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
-{
-       u32 reg = readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL);
-       return (reg & SIRFSOC_USBPHY_PLL_BYPASS) ? parent_rate : 48*MHZ;
-}
-
-static struct clk_ops usb_pll_ops = {
-       .enable = usb_pll_clk_enable,
-       .disable = usb_pll_clk_disable,
-       .recalc_rate = usb_pll_clk_recalc_rate,
-};
-
-static struct clk_init_data clk_usb_pll_init = {
-       .name = "usb_pll",
-       .ops = &usb_pll_ops,
-       .parent_names = pll_clk_parents,
-       .num_parents = ARRAY_SIZE(pll_clk_parents),
-};
-
-static struct clk_hw usb_pll_clk_hw = {
-       .init = &clk_usb_pll_init,
-};
-
-/*
- * clock domains - cpu, mem, sys/io, dsp, gfx
- */
-
-static const char *dmn_clk_parents[] = {
-       "rtc",
-       "osc",
-       "pll1",
-       "pll2",
-       "pll3",
-};
-
-static u8 dmn_clk_get_parent(struct clk_hw *hw)
-{
-       struct clk_dmn *clk = to_dmnclk(hw);
-       u32 cfg = clkc_readl(clk->regofs);
-
-       /* parent of io domain can only be pll3 */
-       if (strcmp(hw->init->name, "io") == 0)
-               return 4;
-
-       WARN_ON((cfg & (BIT(3) - 1)) > 4);
-
-       return cfg & (BIT(3) - 1);
-}
-
-static int dmn_clk_set_parent(struct clk_hw *hw, u8 parent)
-{
-       struct clk_dmn *clk = to_dmnclk(hw);
-       u32 cfg = clkc_readl(clk->regofs);
-
-       /* parent of io domain can only be pll3 */
-       if (strcmp(hw->init->name, "io") == 0)
-               return -EINVAL;
-
-       cfg &= ~(BIT(3) - 1);
-       clkc_writel(cfg | parent, clk->regofs);
-       /* BIT(3) - switching status: 1 - busy, 0 - done */
-       while (clkc_readl(clk->regofs) & BIT(3))
-               cpu_relax();
-
-       return 0;
-}
-
-static unsigned long dmn_clk_recalc_rate(struct clk_hw *hw,
-       unsigned long parent_rate)
-
-{
-       unsigned long fin = parent_rate;
-       struct clk_dmn *clk = to_dmnclk(hw);
-
-       u32 cfg = clkc_readl(clk->regofs);
-
-       if (cfg & BIT(24)) {
-               /* fcd bypass mode */
-               return fin;
-       } else {
-               /*
-                * wait count: bit[19:16], hold count: bit[23:20]
-                */
-               u32 wait = (cfg >> 16) & (BIT(4) - 1);
-               u32 hold = (cfg >> 20) & (BIT(4) - 1);
-
-               return fin / (wait + hold + 2);
-       }
-}
-
-static long dmn_clk_round_rate(struct clk_hw *hw, unsigned long rate,
-       unsigned long *parent_rate)
-{
-       unsigned long fin;
-       unsigned ratio, wait, hold;
-       unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4;
-
-       fin = *parent_rate;
-       ratio = fin / rate;
-
-       if (ratio < 2)
-               ratio = 2;
-       if (ratio > BIT(bits + 1))
-               ratio = BIT(bits + 1);
-
-       wait = (ratio >> 1) - 1;
-       hold = ratio - wait - 2;
-
-       return fin / (wait + hold + 2);
-}
-
-static int dmn_clk_set_rate(struct clk_hw *hw, unsigned long rate,
-       unsigned long parent_rate)
-{
-       struct clk_dmn *clk = to_dmnclk(hw);
-       unsigned long fin;
-       unsigned ratio, wait, hold, reg;
-       unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4;
-
-       fin = parent_rate;
-       ratio = fin / rate;
-
-       if (unlikely(ratio < 2 || ratio > BIT(bits + 1)))
-               return -EINVAL;
-
-       WARN_ON(fin % rate);
-
-       wait = (ratio >> 1) - 1;
-       hold = ratio - wait - 2;
-
-       reg = clkc_readl(clk->regofs);
-       reg &= ~(((BIT(bits) - 1) << 16) | ((BIT(bits) - 1) << 20));
-       reg |= (wait << 16) | (hold << 20) | BIT(25);
-       clkc_writel(reg, clk->regofs);
-
-       /* waiting FCD been effective */
-       while (clkc_readl(clk->regofs) & BIT(25))
-               cpu_relax();
-
-       return 0;
-}
-
-static struct clk_ops msi_ops = {
-       .set_rate = dmn_clk_set_rate,
-       .round_rate = dmn_clk_round_rate,
-       .recalc_rate = dmn_clk_recalc_rate,
-       .set_parent = dmn_clk_set_parent,
-       .get_parent = dmn_clk_get_parent,
-};
-
-static struct clk_init_data clk_mem_init = {
-       .name = "mem",
-       .ops = &msi_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-};
-
-static struct clk_dmn clk_mem = {
-       .regofs = SIRFSOC_CLKC_MEM_CFG,
-       .hw = {
-               .init = &clk_mem_init,
-       },
-};
-
-static struct clk_init_data clk_sys_init = {
-       .name = "sys",
-       .ops = &msi_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-       .flags = CLK_SET_RATE_GATE,
-};
-
-static struct clk_dmn clk_sys = {
-       .regofs = SIRFSOC_CLKC_SYS_CFG,
-       .hw = {
-               .init = &clk_sys_init,
-       },
-};
-
-static struct clk_init_data clk_io_init = {
-       .name = "io",
-       .ops = &msi_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-};
-
-static struct clk_dmn clk_io = {
-       .regofs = SIRFSOC_CLKC_IO_CFG,
-       .hw = {
-               .init = &clk_io_init,
-       },
-};
-
-static struct clk_ops cpu_ops = {
-       .set_parent = dmn_clk_set_parent,
-       .get_parent = dmn_clk_get_parent,
-};
-
-static struct clk_init_data clk_cpu_init = {
-       .name = "cpu",
-       .ops = &cpu_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-       .flags = CLK_SET_RATE_PARENT,
-};
-
-static struct clk_dmn clk_cpu = {
-       .regofs = SIRFSOC_CLKC_CPU_CFG,
-       .hw = {
-               .init = &clk_cpu_init,
-       },
-};
-
-static struct clk_ops dmn_ops = {
-       .is_enabled = std_clk_is_enabled,
-       .enable = std_clk_enable,
-       .disable = std_clk_disable,
-       .set_rate = dmn_clk_set_rate,
-       .round_rate = dmn_clk_round_rate,
-       .recalc_rate = dmn_clk_recalc_rate,
-       .set_parent = dmn_clk_set_parent,
-       .get_parent = dmn_clk_get_parent,
-};
-
-/* dsp, gfx, mm, lcd and vpp domain */
-
-static struct clk_init_data clk_dsp_init = {
-       .name = "dsp",
-       .ops = &dmn_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-};
-
-static struct clk_dmn clk_dsp = {
-       .regofs = SIRFSOC_CLKC_DSP_CFG,
-       .enable_bit = 0,
-       .hw = {
-               .init = &clk_dsp_init,
-       },
-};
-
-static struct clk_init_data clk_gfx_init = {
-       .name = "gfx",
-       .ops = &dmn_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-};
-
-static struct clk_dmn clk_gfx = {
-       .regofs = SIRFSOC_CLKC_GFX_CFG,
-       .enable_bit = 8,
-       .hw = {
-               .init = &clk_gfx_init,
-       },
-};
-
-static struct clk_init_data clk_mm_init = {
-       .name = "mm",
-       .ops = &dmn_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-};
-
-static struct clk_dmn clk_mm = {
-       .regofs = SIRFSOC_CLKC_MM_CFG,
-       .enable_bit = 9,
-       .hw = {
-               .init = &clk_mm_init,
-       },
-};
-
-static struct clk_init_data clk_lcd_init = {
-       .name = "lcd",
-       .ops = &dmn_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-};
-
-static struct clk_dmn clk_lcd = {
-       .regofs = SIRFSOC_CLKC_LCD_CFG,
-       .enable_bit = 10,
-       .hw = {
-               .init = &clk_lcd_init,
-       },
-};
-
-static struct clk_init_data clk_vpp_init = {
-       .name = "vpp",
-       .ops = &dmn_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-};
-
-static struct clk_dmn clk_vpp = {
-       .regofs = SIRFSOC_CLKC_LCD_CFG,
-       .enable_bit = 11,
-       .hw = {
-               .init = &clk_vpp_init,
-       },
-};
-
-static struct clk_init_data clk_mmc01_init = {
-       .name = "mmc01",
-       .ops = &dmn_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-};
-
-static struct clk_dmn clk_mmc01 = {
-       .regofs = SIRFSOC_CLKC_MMC_CFG,
-       .enable_bit = 59,
-       .hw = {
-               .init = &clk_mmc01_init,
-       },
-};
-
-static struct clk_init_data clk_mmc23_init = {
-       .name = "mmc23",
-       .ops = &dmn_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-};
-
-static struct clk_dmn clk_mmc23 = {
-       .regofs = SIRFSOC_CLKC_MMC_CFG,
-       .enable_bit = 60,
-       .hw = {
-               .init = &clk_mmc23_init,
-       },
-};
-
-static struct clk_init_data clk_mmc45_init = {
-       .name = "mmc45",
-       .ops = &dmn_ops,
-       .parent_names = dmn_clk_parents,
-       .num_parents = ARRAY_SIZE(dmn_clk_parents),
-};
-
-static struct clk_dmn clk_mmc45 = {
-       .regofs = SIRFSOC_CLKC_MMC_CFG,
-       .enable_bit = 61,
-       .hw = {
-               .init = &clk_mmc45_init,
-       },
-};
-
-/*
- * peripheral controllers in io domain
- */
-
-static int std_clk_is_enabled(struct clk_hw *hw)
-{
-       u32 reg;
-       int bit;
-       struct clk_std *clk = to_stdclk(hw);
-
-       bit = clk->enable_bit % 32;
-       reg = clk->enable_bit / 32;
-       reg = SIRFSOC_CLKC_CLK_EN0 + reg * sizeof(reg);
-
-       return !!(clkc_readl(reg) & BIT(bit));
-}
-
-static int std_clk_enable(struct clk_hw *hw)
-{
-       u32 val, reg;
-       int bit;
-       struct clk_std *clk = to_stdclk(hw);
-
-       BUG_ON(clk->enable_bit < 0 || clk->enable_bit > 63);
-
-       bit = clk->enable_bit % 32;
-       reg = clk->enable_bit / 32;
-       reg = SIRFSOC_CLKC_CLK_EN0 + reg * sizeof(reg);
-
-       val = clkc_readl(reg) | BIT(bit);
-       clkc_writel(val, reg);
-       return 0;
-}
-
-static void std_clk_disable(struct clk_hw *hw)
-{
-       u32 val, reg;
-       int bit;
-       struct clk_std *clk = to_stdclk(hw);
-
-       BUG_ON(clk->enable_bit < 0 || clk->enable_bit > 63);
-
-       bit = clk->enable_bit % 32;
-       reg = clk->enable_bit / 32;
-       reg = SIRFSOC_CLKC_CLK_EN0 + reg * sizeof(reg);
-
-       val = clkc_readl(reg) & ~BIT(bit);
-       clkc_writel(val, reg);
-}
-
-static const char *std_clk_io_parents[] = {
-       "io",
-};
-
-static struct clk_ops ios_ops = {
-       .is_enabled = std_clk_is_enabled,
-       .enable = std_clk_enable,
-       .disable = std_clk_disable,
-};
-
-static struct clk_init_data clk_dmac0_init = {
-       .name = "dmac0",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_dmac0 = {
-       .enable_bit = 32,
-       .hw = {
-               .init = &clk_dmac0_init,
-       },
-};
-
-static struct clk_init_data clk_dmac1_init = {
-       .name = "dmac1",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_dmac1 = {
-       .enable_bit = 33,
-       .hw = {
-               .init = &clk_dmac1_init,
-       },
-};
-
-static struct clk_init_data clk_nand_init = {
-       .name = "nand",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_nand = {
-       .enable_bit = 34,
-       .hw = {
-               .init = &clk_nand_init,
-       },
-};
-
-static struct clk_init_data clk_audio_init = {
-       .name = "audio",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_audio = {
-       .enable_bit = 35,
-       .hw = {
-               .init = &clk_audio_init,
-       },
-};
-
-static struct clk_init_data clk_uart0_init = {
-       .name = "uart0",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_uart0 = {
-       .enable_bit = 36,
-       .hw = {
-               .init = &clk_uart0_init,
-       },
-};
-
-static struct clk_init_data clk_uart1_init = {
-       .name = "uart1",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_uart1 = {
-       .enable_bit = 37,
-       .hw = {
-               .init = &clk_uart1_init,
-       },
-};
-
-static struct clk_init_data clk_uart2_init = {
-       .name = "uart2",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_uart2 = {
-       .enable_bit = 38,
-       .hw = {
-               .init = &clk_uart2_init,
-       },
-};
-
-static struct clk_init_data clk_usp0_init = {
-       .name = "usp0",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_usp0 = {
-       .enable_bit = 39,
-       .hw = {
-               .init = &clk_usp0_init,
-       },
-};
-
-static struct clk_init_data clk_usp1_init = {
-       .name = "usp1",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_usp1 = {
-       .enable_bit = 40,
-       .hw = {
-               .init = &clk_usp1_init,
-       },
-};
-
-static struct clk_init_data clk_usp2_init = {
-       .name = "usp2",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_usp2 = {
-       .enable_bit = 41,
-       .hw = {
-               .init = &clk_usp2_init,
-       },
-};
-
-static struct clk_init_data clk_vip_init = {
-       .name = "vip",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_vip = {
-       .enable_bit = 42,
-       .hw = {
-               .init = &clk_vip_init,
-       },
-};
-
-static struct clk_init_data clk_spi0_init = {
-       .name = "spi0",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_spi0 = {
-       .enable_bit = 43,
-       .hw = {
-               .init = &clk_spi0_init,
-       },
-};
-
-static struct clk_init_data clk_spi1_init = {
-       .name = "spi1",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_spi1 = {
-       .enable_bit = 44,
-       .hw = {
-               .init = &clk_spi1_init,
-       },
-};
-
-static struct clk_init_data clk_tsc_init = {
-       .name = "tsc",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_tsc = {
-       .enable_bit = 45,
-       .hw = {
-               .init = &clk_tsc_init,
-       },
-};
-
-static struct clk_init_data clk_i2c0_init = {
-       .name = "i2c0",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_i2c0 = {
-       .enable_bit = 46,
-       .hw = {
-               .init = &clk_i2c0_init,
-       },
-};
-
-static struct clk_init_data clk_i2c1_init = {
-       .name = "i2c1",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_i2c1 = {
-       .enable_bit = 47,
-       .hw = {
-               .init = &clk_i2c1_init,
-       },
-};
-
-static struct clk_init_data clk_pwmc_init = {
-       .name = "pwmc",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_pwmc = {
-       .enable_bit = 48,
-       .hw = {
-               .init = &clk_pwmc_init,
-       },
-};
-
-static struct clk_init_data clk_efuse_init = {
-       .name = "efuse",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_efuse = {
-       .enable_bit = 49,
-       .hw = {
-               .init = &clk_efuse_init,
-       },
-};
-
-static struct clk_init_data clk_pulse_init = {
-       .name = "pulse",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_pulse = {
-       .enable_bit = 50,
-       .hw = {
-               .init = &clk_pulse_init,
-       },
-};
-
-static const char *std_clk_dsp_parents[] = {
-       "dsp",
-};
-
-static struct clk_init_data clk_gps_init = {
-       .name = "gps",
-       .ops = &ios_ops,
-       .parent_names = std_clk_dsp_parents,
-       .num_parents = ARRAY_SIZE(std_clk_dsp_parents),
-};
-
-static struct clk_std clk_gps = {
-       .enable_bit = 1,
-       .hw = {
-               .init = &clk_gps_init,
-       },
-};
-
-static struct clk_init_data clk_mf_init = {
-       .name = "mf",
-       .ops = &ios_ops,
-       .parent_names = std_clk_io_parents,
-       .num_parents = ARRAY_SIZE(std_clk_io_parents),
-};
-
-static struct clk_std clk_mf = {
-       .enable_bit = 2,
-       .hw = {
-               .init = &clk_mf_init,
-       },
-};
-
-static const char *std_clk_sys_parents[] = {
-       "sys",
-};
-
-static struct clk_init_data clk_security_init = {
-       .name = "mf",
-       .ops = &ios_ops,
-       .parent_names = std_clk_sys_parents,
-       .num_parents = ARRAY_SIZE(std_clk_sys_parents),
-};
-
-static struct clk_std clk_security = {
-       .enable_bit = 19,
-       .hw = {
-               .init = &clk_security_init,
-       },
-};
-
-static const char *std_clk_usb_parents[] = {
-       "usb_pll",
-};
-
-static struct clk_init_data clk_usb0_init = {
-       .name = "usb0",
-       .ops = &ios_ops,
-       .parent_names = std_clk_usb_parents,
-       .num_parents = ARRAY_SIZE(std_clk_usb_parents),
-};
-
-static struct clk_std clk_usb0 = {
-       .enable_bit = 16,
-       .hw = {
-               .init = &clk_usb0_init,
-       },
-};
-
-static struct clk_init_data clk_usb1_init = {
-       .name = "usb1",
-       .ops = &ios_ops,
-       .parent_names = std_clk_usb_parents,
-       .num_parents = ARRAY_SIZE(std_clk_usb_parents),
-};
-
-static struct clk_std clk_usb1 = {
-       .enable_bit = 17,
-       .hw = {
-               .init = &clk_usb1_init,
-       },
-};
-
-enum prima2_clk_index {
-       /* 0    1     2      3      4      5      6       7         8      9 */
-       rtc,    osc,   pll1,  pll2,  pll3,  mem,   sys,   security, dsp,   gps,
-       mf,     io,    cpu,   uart0, uart1, uart2, tsc,   i2c0,     i2c1,  spi0,
-       spi1,   pwmc,  efuse, pulse, dmac0, dmac1, nand,  audio,    usp0,  usp1,
-       usp2,   vip,   gfx,   mm,    lcd,   vpp,   mmc01, mmc23,    mmc45, usbpll,
-       usb0,  usb1,  maxclk,
-};
-
-static struct clk_hw *prima2_clk_hw_array[maxclk] __initdata = {
-       NULL, /* dummy */
-       NULL,
-       &clk_pll1.hw,
-       &clk_pll2.hw,
-       &clk_pll3.hw,
-       &clk_mem.hw,
-       &clk_sys.hw,
-       &clk_security.hw,
-       &clk_dsp.hw,
-       &clk_gps.hw,
-       &clk_mf.hw,
-       &clk_io.hw,
-       &clk_cpu.hw,
-       &clk_uart0.hw,
-       &clk_uart1.hw,
-       &clk_uart2.hw,
-       &clk_tsc.hw,
-       &clk_i2c0.hw,
-       &clk_i2c1.hw,
-       &clk_spi0.hw,
-       &clk_spi1.hw,
-       &clk_pwmc.hw,
-       &clk_efuse.hw,
-       &clk_pulse.hw,
-       &clk_dmac0.hw,
-       &clk_dmac1.hw,
-       &clk_nand.hw,
-       &clk_audio.hw,
-       &clk_usp0.hw,
-       &clk_usp1.hw,
-       &clk_usp2.hw,
-       &clk_vip.hw,
-       &clk_gfx.hw,
-       &clk_mm.hw,
-       &clk_lcd.hw,
-       &clk_vpp.hw,
-       &clk_mmc01.hw,
-       &clk_mmc23.hw,
-       &clk_mmc45.hw,
-       &usb_pll_clk_hw,
-       &clk_usb0.hw,
-       &clk_usb1.hw,
-};
-
-static struct clk *prima2_clks[maxclk];
-static struct clk_onecell_data clk_data;
-
-static void __init sirfsoc_clk_init(struct device_node *np)
-{
-       struct device_node *rscnp;
-       int i;
-
-       rscnp = of_find_compatible_node(NULL, NULL, "sirf,prima2-rsc");
-       sirfsoc_rsc_vbase = of_iomap(rscnp, 0);
-       if (!sirfsoc_rsc_vbase)
-               panic("unable to map rsc registers\n");
-       of_node_put(rscnp);
-
-       sirfsoc_clk_vbase = of_iomap(np, 0);
-       if (!sirfsoc_clk_vbase)
-               panic("unable to map clkc registers\n");
-
-       /* These are always available (RTC and 26MHz OSC)*/
-       prima2_clks[rtc] = clk_register_fixed_rate(NULL, "rtc", NULL,
-               CLK_IS_ROOT, 32768);
-       prima2_clks[osc]= clk_register_fixed_rate(NULL, "osc", NULL,
-               CLK_IS_ROOT, 26000000);
-
-       for (i = pll1; i < maxclk; i++) {
-               prima2_clks[i] = clk_register(NULL, prima2_clk_hw_array[i]);
-               BUG_ON(IS_ERR(prima2_clks[i]));
-       }
-       clk_register_clkdev(prima2_clks[cpu], NULL, "cpu");
-       clk_register_clkdev(prima2_clks[io],  NULL, "io");
-       clk_register_clkdev(prima2_clks[mem],  NULL, "mem");
-
-       clk_data.clks = prima2_clks;
-       clk_data.clk_num = maxclk;
-
-       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
-}
-CLK_OF_DECLARE(sirfsoc_clk, "sirf,prima2-clkc", sirfsoc_clk_init);
diff --git a/drivers/clk/clk-si570.c b/drivers/clk/clk-si570.c
new file mode 100644 (file)
index 0000000..4bbbe32
--- /dev/null
@@ -0,0 +1,531 @@
+/*
+ * Driver for Silicon Labs Si570/Si571 Programmable XO/VCXO
+ *
+ * Copyright (C) 2010, 2011 Ericsson AB.
+ * Copyright (C) 2011 Guenter Roeck.
+ * Copyright (C) 2011 - 2013 Xilinx Inc.
+ *
+ * Author: Guenter Roeck <guenter.roeck@ericsson.com>
+ *        Sören Brinkmann <soren.brinkmann@xilinx.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+/* Si570 registers */
+#define SI570_REG_HS_N1                7
+#define SI570_REG_N1_RFREQ0    8
+#define SI570_REG_RFREQ1       9
+#define SI570_REG_RFREQ2       10
+#define SI570_REG_RFREQ3       11
+#define SI570_REG_RFREQ4       12
+#define SI570_REG_CONTROL      135
+#define SI570_REG_FREEZE_DCO   137
+#define SI570_DIV_OFFSET_7PPM  6
+
+#define HS_DIV_SHIFT           5
+#define HS_DIV_MASK            0xe0
+#define HS_DIV_OFFSET          4
+#define N1_6_2_MASK            0x1f
+#define N1_1_0_MASK            0xc0
+#define RFREQ_37_32_MASK       0x3f
+
+#define SI570_MIN_FREQ         10000000L
+#define SI570_MAX_FREQ         1417500000L
+#define SI598_MAX_FREQ         525000000L
+
+#define FDCO_MIN               4850000000LL
+#define FDCO_MAX               5670000000LL
+
+#define SI570_CNTRL_RECALL     (1 << 0)
+#define SI570_CNTRL_FREEZE_M   (1 << 5)
+#define SI570_CNTRL_NEWFREQ    (1 << 6)
+
+#define SI570_FREEZE_DCO       (1 << 4)
+
+/**
+ * struct clk_si570:
+ * @hw:        Clock hw struct
+ * @regmap:    Device's regmap
+ * @div_offset:        Rgister offset for dividers
+ * @max_freq:  Maximum frequency for this device
+ * @fxtal:     Factory xtal frequency
+ * @n1:                Clock divider N1
+ * @hs_div:    Clock divider HSDIV
+ * @rfreq:     Clock multiplier RFREQ
+ * @frequency: Current output frequency
+ * @i2c_client:        I2C client pointer
+ */
+struct clk_si570 {
+       struct clk_hw hw;
+       struct regmap *regmap;
+       unsigned int div_offset;
+       u64 max_freq;
+       u64 fxtal;
+       unsigned int n1;
+       unsigned int hs_div;
+       u64 rfreq;
+       u64 frequency;
+       struct i2c_client *i2c_client;
+};
+#define to_clk_si570(_hw)      container_of(_hw, struct clk_si570, hw)
+
+enum clk_si570_variant {
+       si57x,
+       si59x
+};
+
+/**
+ * si570_get_divs() - Read clock dividers from HW
+ * @data:      Pointer to struct clk_si570
+ * @rfreq:     Fractional multiplier (output)
+ * @n1:                Divider N1 (output)
+ * @hs_div:    Divider HSDIV (output)
+ * Returns 0 on success, negative errno otherwise.
+ *
+ * Retrieve clock dividers and multipliers from the HW.
+ */
+static int si570_get_divs(struct clk_si570 *data, u64 *rfreq,
+               unsigned int *n1, unsigned int *hs_div)
+{
+       int err;
+       u8 reg[6];
+       u64 tmp;
+
+       err = regmap_bulk_read(data->regmap, SI570_REG_HS_N1 + data->div_offset,
+                       reg, ARRAY_SIZE(reg));
+       if (err)
+               return err;
+
+       *hs_div = ((reg[0] & HS_DIV_MASK) >> HS_DIV_SHIFT) + HS_DIV_OFFSET;
+       *n1 = ((reg[0] & N1_6_2_MASK) << 2) + ((reg[1] & N1_1_0_MASK) >> 6) + 1;
+       /* Handle invalid cases */
+       if (*n1 > 1)
+               *n1 &= ~1;
+
+       tmp = reg[1] & RFREQ_37_32_MASK;
+       tmp = (tmp << 8) + reg[2];
+       tmp = (tmp << 8) + reg[3];
+       tmp = (tmp << 8) + reg[4];
+       tmp = (tmp << 8) + reg[5];
+       *rfreq = tmp;
+
+       return 0;
+}
+
+/**
+ * si570_get_defaults() - Get default values
+ * @data:      Driver data structure
+ * @fout:      Factory frequency output
+ * Returns 0 on success, negative errno otherwise.
+ */
+static int si570_get_defaults(struct clk_si570 *data, u64 fout)
+{
+       int err;
+       u64 fdco;
+
+       regmap_write(data->regmap, SI570_REG_CONTROL, SI570_CNTRL_RECALL);
+
+       err = si570_get_divs(data, &data->rfreq, &data->n1, &data->hs_div);
+       if (err)
+               return err;
+
+       /*
+        * Accept optional precision loss to avoid arithmetic overflows.
+        * Acceptable per Silicon Labs Application Note AN334.
+        */
+       fdco = fout * data->n1 * data->hs_div;
+       if (fdco >= (1LL << 36))
+               data->fxtal = div64_u64(fdco << 24, data->rfreq >> 4);
+       else
+               data->fxtal = div64_u64(fdco << 28, data->rfreq);
+
+       data->frequency = fout;
+
+       return 0;
+}
+
+/**
+ * si570_update_rfreq() - Update clock multiplier
+ * @data:      Driver data structure
+ * Passes on regmap_bulk_write() return value.
+ */
+static int si570_update_rfreq(struct clk_si570 *data)
+{
+       u8 reg[5];
+
+       reg[0] = ((data->n1 - 1) << 6) |
+               ((data->rfreq >> 32) & RFREQ_37_32_MASK);
+       reg[1] = (data->rfreq >> 24) & 0xff;
+       reg[2] = (data->rfreq >> 16) & 0xff;
+       reg[3] = (data->rfreq >> 8) & 0xff;
+       reg[4] = data->rfreq & 0xff;
+
+       return regmap_bulk_write(data->regmap, SI570_REG_N1_RFREQ0 +
+                       data->div_offset, reg, ARRAY_SIZE(reg));
+}
+
+/**
+ * si570_calc_divs() - Caluclate clock dividers
+ * @frequency: Target frequency
+ * @data:      Driver data structure
+ * @out_rfreq: RFREG fractional multiplier (output)
+ * @out_n1:    Clock divider N1 (output)
+ * @out_hs_div:        Clock divider HSDIV (output)
+ * Returns 0 on success, negative errno otherwise.
+ *
+ * Calculate the clock dividers (@out_hs_div, @out_n1) and clock multiplier
+ * (@out_rfreq) for a given target @frequency.
+ */
+static int si570_calc_divs(unsigned long frequency, struct clk_si570 *data,
+               u64 *out_rfreq, unsigned int *out_n1, unsigned int *out_hs_div)
+{
+       int i;
+       unsigned int n1, hs_div;
+       u64 fdco, best_fdco = ULLONG_MAX;
+       static const uint8_t si570_hs_div_values[] = { 11, 9, 7, 6, 5, 4 };
+
+       for (i = 0; i < ARRAY_SIZE(si570_hs_div_values); i++) {
+               hs_div = si570_hs_div_values[i];
+               /* Calculate lowest possible value for n1 */
+               n1 = div_u64(div_u64(FDCO_MIN, hs_div), frequency);
+               if (!n1 || (n1 & 1))
+                       n1++;
+               while (n1 <= 128) {
+                       fdco = (u64)frequency * (u64)hs_div * (u64)n1;
+                       if (fdco > FDCO_MAX)
+                               break;
+                       if (fdco >= FDCO_MIN && fdco < best_fdco) {
+                               *out_n1 = n1;
+                               *out_hs_div = hs_div;
+                               *out_rfreq = div64_u64(fdco << 28, data->fxtal);
+                               best_fdco = fdco;
+                       }
+                       n1 += (n1 == 1 ? 1 : 2);
+               }
+       }
+
+       if (best_fdco == ULLONG_MAX)
+               return -EINVAL;
+
+       return 0;
+}
+
+static unsigned long si570_recalc_rate(struct clk_hw *hw,
+               unsigned long parent_rate)
+{
+       int err;
+       u64 rfreq, rate;
+       unsigned int n1, hs_div;
+       struct clk_si570 *data = to_clk_si570(hw);
+
+       err = si570_get_divs(data, &rfreq, &n1, &hs_div);
+       if (err) {
+               dev_err(&data->i2c_client->dev, "unable to recalc rate\n");
+               return data->frequency;
+       }
+
+       rfreq = div_u64(rfreq, hs_div * n1);
+       rate = (data->fxtal * rfreq) >> 28;
+
+       return rate;
+}
+
+static long si570_round_rate(struct clk_hw *hw, unsigned long rate,
+               unsigned long *parent_rate)
+{
+       int err;
+       u64 rfreq;
+       unsigned int n1, hs_div;
+       struct clk_si570 *data = to_clk_si570(hw);
+
+       if (!rate)
+               return 0;
+
+       if (div64_u64(abs(rate - data->frequency) * 10000LL,
+                               data->frequency) < 35) {
+               rfreq = div64_u64((data->rfreq * rate) +
+                               div64_u64(data->frequency, 2), data->frequency);
+               n1 = data->n1;
+               hs_div = data->hs_div;
+
+       } else {
+               err = si570_calc_divs(rate, data, &rfreq, &n1, &hs_div);
+               if (err) {
+                       dev_err(&data->i2c_client->dev,
+                                       "unable to round rate\n");
+                       return 0;
+               }
+       }
+
+       return rate;
+}
+
+/**
+ * si570_set_frequency() - Adjust output frequency
+ * @data:      Driver data structure
+ * @frequency: Target frequency
+ * Returns 0 on success.
+ *
+ * Update output frequency for big frequency changes (> 3,500 ppm).
+ */
+static int si570_set_frequency(struct clk_si570 *data, unsigned long frequency)
+{
+       int err;
+
+       err = si570_calc_divs(frequency, data, &data->rfreq, &data->n1,
+                       &data->hs_div);
+       if (err)
+               return err;
+
+       /*
+        * The DCO reg should be accessed with a read-modify-write operation
+        * per AN334
+        */
+       regmap_write(data->regmap, SI570_REG_FREEZE_DCO, SI570_FREEZE_DCO);
+       regmap_write(data->regmap, SI570_REG_HS_N1 + data->div_offset,
+                       ((data->hs_div - HS_DIV_OFFSET) << HS_DIV_SHIFT) |
+                       (((data->n1 - 1) >> 2) & N1_6_2_MASK));
+       si570_update_rfreq(data);
+       regmap_write(data->regmap, SI570_REG_FREEZE_DCO, 0);
+       regmap_write(data->regmap, SI570_REG_CONTROL, SI570_CNTRL_NEWFREQ);
+
+       /* Applying a new frequency can take up to 10ms */
+       usleep_range(10000, 12000);
+
+       return 0;
+}
+
+/**
+ * si570_set_frequency_small() - Adjust output frequency
+ * @data:      Driver data structure
+ * @frequency: Target frequency
+ * Returns 0 on success.
+ *
+ * Update output frequency for small frequency changes (< 3,500 ppm).
+ */
+static int si570_set_frequency_small(struct clk_si570 *data,
+                                    unsigned long frequency)
+{
+       /*
+        * This is a re-implementation of DIV_ROUND_CLOSEST
+        * using the div64_u64 function lieu of letting the compiler
+        * insert EABI calls
+        */
+       data->rfreq = div64_u64((data->rfreq * frequency) +
+                       div_u64(data->frequency, 2), data->frequency);
+       regmap_write(data->regmap, SI570_REG_CONTROL, SI570_CNTRL_FREEZE_M);
+       si570_update_rfreq(data);
+       regmap_write(data->regmap, SI570_REG_CONTROL, 0);
+
+       /* Applying a new frequency (small change) can take up to 100us */
+       usleep_range(100, 200);
+
+       return 0;
+}
+
+static int si570_set_rate(struct clk_hw *hw, unsigned long rate,
+               unsigned long parent_rate)
+{
+       struct clk_si570 *data = to_clk_si570(hw);
+       struct i2c_client *client = data->i2c_client;
+       int err;
+
+       if (rate < SI570_MIN_FREQ || rate > data->max_freq) {
+               dev_err(&client->dev,
+                       "requested frequency %lu Hz is out of range\n", rate);
+               return -EINVAL;
+       }
+
+       if (div64_u64(abs(rate - data->frequency) * 10000LL,
+                               data->frequency) < 35)
+               err = si570_set_frequency_small(data, rate);
+       else
+               err = si570_set_frequency(data, rate);
+
+       if (err)
+               return err;
+
+       data->frequency = rate;
+
+       return 0;
+}
+
+static const struct clk_ops si570_clk_ops = {
+       .recalc_rate = si570_recalc_rate,
+       .round_rate = si570_round_rate,
+       .set_rate = si570_set_rate,
+};
+
+static bool si570_regmap_is_volatile(struct device *dev, unsigned int reg)
+{
+       switch (reg) {
+       case SI570_REG_CONTROL:
+               return true;
+       default:
+               return false;
+       }
+}
+
+static bool si570_regmap_is_writeable(struct device *dev, unsigned int reg)
+{
+       switch (reg) {
+       case SI570_REG_HS_N1 ... (SI570_REG_RFREQ4 + SI570_DIV_OFFSET_7PPM):
+       case SI570_REG_CONTROL:
+       case SI570_REG_FREEZE_DCO:
+               return true;
+       default:
+               return false;
+       }
+}
+
+static struct regmap_config si570_regmap_config = {
+       .reg_bits = 8,
+       .val_bits = 8,
+       .cache_type = REGCACHE_RBTREE,
+       .max_register = 137,
+       .writeable_reg = si570_regmap_is_writeable,
+       .volatile_reg = si570_regmap_is_volatile,
+};
+
+static int si570_probe(struct i2c_client *client,
+               const struct i2c_device_id *id)
+{
+       struct clk_si570 *data;
+       struct clk_init_data init;
+       struct clk *clk;
+       u32 initial_fout, factory_fout, stability;
+       int err;
+       enum clk_si570_variant variant = id->driver_data;
+
+       data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       init.ops = &si570_clk_ops;
+       init.flags = CLK_IS_ROOT;
+       init.num_parents = 0;
+       data->hw.init = &init;
+       data->i2c_client = client;
+
+       if (variant == si57x) {
+               err = of_property_read_u32(client->dev.of_node,
+                               "temperature-stability", &stability);
+               if (err) {
+                       dev_err(&client->dev,
+                                 "'temperature-stability' property missing\n");
+                       return err;
+               }
+               /* adjust register offsets for 7ppm devices */
+               if (stability == 7)
+                       data->div_offset = SI570_DIV_OFFSET_7PPM;
+
+               data->max_freq = SI570_MAX_FREQ;
+       } else {
+               data->max_freq = SI598_MAX_FREQ;
+       }
+
+       if (of_property_read_string(client->dev.of_node, "clock-output-names",
+                       &init.name))
+               init.name = client->dev.of_node->name;
+
+       err = of_property_read_u32(client->dev.of_node, "factory-fout",
+                       &factory_fout);
+       if (err) {
+               dev_err(&client->dev, "'factory-fout' property missing\n");
+               return err;
+       }
+
+       data->regmap = devm_regmap_init_i2c(client, &si570_regmap_config);
+       if (IS_ERR(data->regmap)) {
+               dev_err(&client->dev, "failed to allocate register map\n");
+               return PTR_ERR(data->regmap);
+       }
+
+       i2c_set_clientdata(client, data);
+       err = si570_get_defaults(data, factory_fout);
+       if (err)
+               return err;
+
+       clk = devm_clk_register(&client->dev, &data->hw);
+       if (IS_ERR(clk)) {
+               dev_err(&client->dev, "clock registration failed\n");
+               return PTR_ERR(clk);
+       }
+       err = of_clk_add_provider(client->dev.of_node, of_clk_src_simple_get,
+                       clk);
+       if (err) {
+               dev_err(&client->dev, "unable to add clk provider\n");
+               return err;
+       }
+
+       /* Read the requested initial output frequency from device tree */
+       if (!of_property_read_u32(client->dev.of_node, "clock-frequency",
+                               &initial_fout)) {
+               err = clk_set_rate(clk, initial_fout);
+               if (err) {
+                       of_clk_del_provider(client->dev.of_node);
+                       return err;
+               }
+       }
+
+       /* Display a message indicating that we've successfully registered */
+       dev_info(&client->dev, "registered, current frequency %llu Hz\n",
+                       data->frequency);
+
+       return 0;
+}
+
+static int si570_remove(struct i2c_client *client)
+{
+       of_clk_del_provider(client->dev.of_node);
+       return 0;
+}
+
+static const struct i2c_device_id si570_id[] = {
+       { "si570", si57x },
+       { "si571", si57x },
+       { "si598", si59x },
+       { "si599", si59x },
+       { }
+};
+MODULE_DEVICE_TABLE(i2c, si570_id);
+
+static const struct of_device_id clk_si570_of_match[] = {
+       { .compatible = "silabs,si570" },
+       { .compatible = "silabs,si571" },
+       { .compatible = "silabs,si598" },
+       { .compatible = "silabs,si599" },
+       { },
+};
+MODULE_DEVICE_TABLE(of, clk_si570_of_match);
+
+static struct i2c_driver si570_driver = {
+       .driver = {
+               .name = "si570",
+               .of_match_table = clk_si570_of_match,
+       },
+       .probe          = si570_probe,
+       .remove         = si570_remove,
+       .id_table       = si570_id,
+};
+module_i2c_driver(si570_driver);
+
+MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>");
+MODULE_AUTHOR("Soeren Brinkmann <soren.brinkmann@xilinx.com");
+MODULE_DESCRIPTION("Si570 driver");
+MODULE_LICENSE("GPL");
index 7fd5c5e9e25dbbd72a94cd0923ddf9d0a18d1c36..37e928846ec5b3fb1fed8144570c1f8aeaa027bb 100644 (file)
@@ -641,7 +641,7 @@ static unsigned long vtwm_pll_recalc_rate(struct clk_hw *hw,
        return pll_freq;
 }
 
-const struct clk_ops vtwm_pll_ops = {
+static const struct clk_ops vtwm_pll_ops = {
        .round_rate = vtwm_pll_round_rate,
        .set_rate = vtwm_pll_set_rate,
        .recalc_rate = vtwm_pll_recalc_rate,
index 2cf2ea6b77a1ac307c22d35aed28b12d7a0da75f..2b38dc99063f1b6574df031ccea84af5df9cb9e6 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/init.h>
 #include <linux/sched.h>
 
+#include "clk.h"
+
 static DEFINE_SPINLOCK(enable_lock);
 static DEFINE_MUTEX(prepare_lock);
 
@@ -92,7 +94,7 @@ static void clk_enable_unlock(unsigned long flags)
 
 /***        debugfs support        ***/
 
-#ifdef CONFIG_COMMON_CLK_DEBUG
+#ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
 
 static struct dentry *rootdir;
@@ -104,10 +106,11 @@ static void clk_summary_show_one(struct seq_file *s, struct clk *c, int level)
        if (!c)
                return;
 
-       seq_printf(s, "%*s%-*s %-11d %-12d %-10lu",
+       seq_printf(s, "%*s%-*s %-11d %-12d %-10lu %-11lu",
                   level * 3 + 1, "",
                   30 - level * 3, c->name,
-                  c->enable_count, c->prepare_count, clk_get_rate(c));
+                  c->enable_count, c->prepare_count, clk_get_rate(c),
+                  clk_get_accuracy(c));
        seq_printf(s, "\n");
 }
 
@@ -129,8 +132,8 @@ static int clk_summary_show(struct seq_file *s, void *data)
 {
        struct clk *c;
 
-       seq_printf(s, "   clock                        enable_cnt  prepare_cnt  rate\n");
-       seq_printf(s, "---------------------------------------------------------------------\n");
+       seq_printf(s, "   clock                        enable_cnt  prepare_cnt  rate        accuracy\n");
+       seq_printf(s, "---------------------------------------------------------------------------------\n");
 
        clk_prepare_lock();
 
@@ -167,6 +170,7 @@ static void clk_dump_one(struct seq_file *s, struct clk *c, int level)
        seq_printf(s, "\"enable_count\": %d,", c->enable_count);
        seq_printf(s, "\"prepare_count\": %d,", c->prepare_count);
        seq_printf(s, "\"rate\": %lu", clk_get_rate(c));
+       seq_printf(s, "\"accuracy\": %lu", clk_get_accuracy(c));
 }
 
 static void clk_dump_subtree(struct seq_file *s, struct clk *c, int level)
@@ -248,6 +252,11 @@ static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry)
        if (!d)
                goto err_out;
 
+       d = debugfs_create_u32("clk_accuracy", S_IRUGO, clk->dentry,
+                       (u32 *)&clk->accuracy);
+       if (!d)
+               goto err_out;
+
        d = debugfs_create_x32("clk_flags", S_IRUGO, clk->dentry,
                        (u32 *)&clk->flags);
        if (!d)
@@ -272,7 +281,8 @@ static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry)
        goto out;
 
 err_out:
-       debugfs_remove(clk->dentry);
+       debugfs_remove_recursive(clk->dentry);
+       clk->dentry = NULL;
 out:
        return ret;
 }
@@ -342,6 +352,21 @@ out:
        return ret;
 }
 
+ /**
+ * clk_debug_unregister - remove a clk node from the debugfs clk tree
+ * @clk: the clk being removed from the debugfs clk tree
+ *
+ * Dynamically removes a clk and all it's children clk nodes from the
+ * debugfs clk tree if clk->dentry points to debugfs created by
+ * clk_debug_register in __clk_init.
+ *
+ * Caller must hold prepare_lock.
+ */
+static void clk_debug_unregister(struct clk *clk)
+{
+       debugfs_remove_recursive(clk->dentry);
+}
+
 /**
  * clk_debug_reparent - reparent clk node in the debugfs clk tree
  * @clk: the clk being reparented
@@ -432,6 +457,9 @@ static inline int clk_debug_register(struct clk *clk) { return 0; }
 static inline void clk_debug_reparent(struct clk *clk, struct clk *new_parent)
 {
 }
+static inline void clk_debug_unregister(struct clk *clk)
+{
+}
 #endif
 
 /* caller must hold prepare_lock */
@@ -602,6 +630,14 @@ out:
        return ret;
 }
 
+unsigned long __clk_get_accuracy(struct clk *clk)
+{
+       if (!clk)
+               return 0;
+
+       return clk->accuracy;
+}
+
 unsigned long __clk_get_flags(struct clk *clk)
 {
        return !clk ? 0 : clk->flags;
@@ -1015,6 +1051,59 @@ static int __clk_notify(struct clk *clk, unsigned long msg,
        return ret;
 }
 
+/**
+ * __clk_recalc_accuracies
+ * @clk: first clk in the subtree
+ *
+ * Walks the subtree of clks starting with clk and recalculates accuracies as
+ * it goes.  Note that if a clk does not implement the .recalc_accuracy
+ * callback then it is assumed that the clock will take on the accuracy of it's
+ * parent.
+ *
+ * Caller must hold prepare_lock.
+ */
+static void __clk_recalc_accuracies(struct clk *clk)
+{
+       unsigned long parent_accuracy = 0;
+       struct clk *child;
+
+       if (clk->parent)
+               parent_accuracy = clk->parent->accuracy;
+
+       if (clk->ops->recalc_accuracy)
+               clk->accuracy = clk->ops->recalc_accuracy(clk->hw,
+                                                         parent_accuracy);
+       else
+               clk->accuracy = parent_accuracy;
+
+       hlist_for_each_entry(child, &clk->children, child_node)
+               __clk_recalc_accuracies(child);
+}
+
+/**
+ * clk_get_accuracy - return the accuracy of clk
+ * @clk: the clk whose accuracy is being returned
+ *
+ * Simply returns the cached accuracy of the clk, unless
+ * CLK_GET_ACCURACY_NOCACHE flag is set, which means a recalc_rate will be
+ * issued.
+ * If clk is NULL then returns 0.
+ */
+long clk_get_accuracy(struct clk *clk)
+{
+       unsigned long accuracy;
+
+       clk_prepare_lock();
+       if (clk && (clk->flags & CLK_GET_ACCURACY_NOCACHE))
+               __clk_recalc_accuracies(clk);
+
+       accuracy = __clk_get_accuracy(clk);
+       clk_prepare_unlock();
+
+       return accuracy;
+}
+EXPORT_SYMBOL_GPL(clk_get_accuracy);
+
 /**
  * __clk_recalc_rates
  * @clk: first clk in the subtree
@@ -1129,10 +1218,9 @@ static void clk_reparent(struct clk *clk, struct clk *new_parent)
        clk->parent = new_parent;
 }
 
-static int __clk_set_parent(struct clk *clk, struct clk *parent, u8 p_index)
+static struct clk *__clk_set_parent_before(struct clk *clk, struct clk *parent)
 {
        unsigned long flags;
-       int ret = 0;
        struct clk *old_parent = clk->parent;
 
        /*
@@ -1163,6 +1251,34 @@ static int __clk_set_parent(struct clk *clk, struct clk *parent, u8 p_index)
        clk_reparent(clk, parent);
        clk_enable_unlock(flags);
 
+       return old_parent;
+}
+
+static void __clk_set_parent_after(struct clk *clk, struct clk *parent,
+               struct clk *old_parent)
+{
+       /*
+        * Finish the migration of prepare state and undo the changes done
+        * for preventing a race with clk_enable().
+        */
+       if (clk->prepare_count) {
+               clk_disable(clk);
+               clk_disable(old_parent);
+               __clk_unprepare(old_parent);
+       }
+
+       /* update debugfs with new clk tree topology */
+       clk_debug_reparent(clk, parent);
+}
+
+static int __clk_set_parent(struct clk *clk, struct clk *parent, u8 p_index)
+{
+       unsigned long flags;
+       int ret = 0;
+       struct clk *old_parent;
+
+       old_parent = __clk_set_parent_before(clk, parent);
+
        /* change clock input source */
        if (parent && clk->ops->set_parent)
                ret = clk->ops->set_parent(clk->hw, p_index);
@@ -1180,18 +1296,8 @@ static int __clk_set_parent(struct clk *clk, struct clk *parent, u8 p_index)
                return ret;
        }
 
-       /*
-        * Finish the migration of prepare state and undo the changes done
-        * for preventing a race with clk_enable().
-        */
-       if (clk->prepare_count) {
-               clk_disable(clk);
-               clk_disable(old_parent);
-               __clk_unprepare(old_parent);
-       }
+       __clk_set_parent_after(clk, parent, old_parent);
 
-       /* update debugfs with new clk tree topology */
-       clk_debug_reparent(clk, parent);
        return 0;
 }
 
@@ -1376,17 +1482,32 @@ static void clk_change_rate(struct clk *clk)
        struct clk *child;
        unsigned long old_rate;
        unsigned long best_parent_rate = 0;
+       bool skip_set_rate = false;
+       struct clk *old_parent;
 
        old_rate = clk->rate;
 
-       /* set parent */
-       if (clk->new_parent && clk->new_parent != clk->parent)
-               __clk_set_parent(clk, clk->new_parent, clk->new_parent_index);
-
-       if (clk->parent)
+       if (clk->new_parent)
+               best_parent_rate = clk->new_parent->rate;
+       else if (clk->parent)
                best_parent_rate = clk->parent->rate;
 
-       if (clk->ops->set_rate)
+       if (clk->new_parent && clk->new_parent != clk->parent) {
+               old_parent = __clk_set_parent_before(clk, clk->new_parent);
+
+               if (clk->ops->set_rate_and_parent) {
+                       skip_set_rate = true;
+                       clk->ops->set_rate_and_parent(clk->hw, clk->new_rate,
+                                       best_parent_rate,
+                                       clk->new_parent_index);
+               } else if (clk->ops->set_parent) {
+                       clk->ops->set_parent(clk->hw, clk->new_parent_index);
+               }
+
+               __clk_set_parent_after(clk, clk->new_parent, old_parent);
+       }
+
+       if (!skip_set_rate && clk->ops->set_rate)
                clk->ops->set_rate(clk->hw, clk->new_rate, best_parent_rate);
 
        if (clk->ops->recalc_rate)
@@ -1551,6 +1672,7 @@ void __clk_reparent(struct clk *clk, struct clk *new_parent)
 {
        clk_reparent(clk, new_parent);
        clk_debug_reparent(clk, new_parent);
+       __clk_recalc_accuracies(clk);
        __clk_recalc_rates(clk, POST_RATE_CHANGE);
 }
 
@@ -1621,11 +1743,13 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
        /* do the re-parent */
        ret = __clk_set_parent(clk, parent, p_index);
 
-       /* propagate rate recalculation accordingly */
-       if (ret)
+       /* propagate rate an accuracy recalculation accordingly */
+       if (ret) {
                __clk_recalc_rates(clk, ABORT_RATE_CHANGE);
-       else
+       } else {
                __clk_recalc_rates(clk, POST_RATE_CHANGE);
+               __clk_recalc_accuracies(clk);
+       }
 
 out:
        clk_prepare_unlock();
@@ -1678,6 +1802,14 @@ int __clk_init(struct device *dev, struct clk *clk)
                goto out;
        }
 
+       if (clk->ops->set_rate_and_parent &&
+                       !(clk->ops->set_parent && clk->ops->set_rate)) {
+               pr_warn("%s: %s must implement .set_parent & .set_rate\n",
+                               __func__, clk->name);
+               ret = -EINVAL;
+               goto out;
+       }
+
        /* throw a WARN if any entries in parent_names are NULL */
        for (i = 0; i < clk->num_parents; i++)
                WARN(!clk->parent_names[i],
@@ -1729,6 +1861,21 @@ int __clk_init(struct device *dev, struct clk *clk)
        else
                hlist_add_head(&clk->child_node, &clk_orphan_list);
 
+       /*
+        * Set clk's accuracy.  The preferred method is to use
+        * .recalc_accuracy. For simple clocks and lazy developers the default
+        * fallback is to use the parent's accuracy.  If a clock doesn't have a
+        * parent (or is orphaned) then accuracy is set to zero (perfect
+        * clock).
+        */
+       if (clk->ops->recalc_accuracy)
+               clk->accuracy = clk->ops->recalc_accuracy(clk->hw,
+                                       __clk_get_accuracy(clk->parent));
+       else if (clk->parent)
+               clk->accuracy = clk->parent->accuracy;
+       else
+               clk->accuracy = 0;
+
        /*
         * Set clk's rate.  The preferred method is to use .recalc_rate.  For
         * simple clocks and lazy developers the default fallback is to use the
@@ -1743,6 +1890,7 @@ int __clk_init(struct device *dev, struct clk *clk)
        else
                clk->rate = 0;
 
+       clk_debug_register(clk);
        /*
         * walk the list of orphan clocks and reparent any that are children of
         * this clock
@@ -1773,8 +1921,7 @@ int __clk_init(struct device *dev, struct clk *clk)
        if (clk->ops->init)
                clk->ops->init(clk->hw);
 
-       clk_debug_register(clk);
-
+       kref_init(&clk->ref);
 out:
        clk_prepare_unlock();
 
@@ -1810,6 +1957,10 @@ struct clk *__clk_register(struct device *dev, struct clk_hw *hw)
        clk->flags = hw->init->flags;
        clk->parent_names = hw->init->parent_names;
        clk->num_parents = hw->init->num_parents;
+       if (dev && dev->driver)
+               clk->owner = dev->driver->owner;
+       else
+               clk->owner = NULL;
 
        ret = __clk_init(dev, clk);
        if (ret)
@@ -1830,6 +1981,8 @@ static int _clk_register(struct device *dev, struct clk_hw *hw, struct clk *clk)
                goto fail_name;
        }
        clk->ops = hw->init->ops;
+       if (dev && dev->driver)
+               clk->owner = dev->driver->owner;
        clk->hw = hw;
        clk->flags = hw->init->flags;
        clk->num_parents = hw->init->num_parents;
@@ -1904,13 +2057,104 @@ fail_out:
 }
 EXPORT_SYMBOL_GPL(clk_register);
 
+/*
+ * Free memory allocated for a clock.
+ * Caller must hold prepare_lock.
+ */
+static void __clk_release(struct kref *ref)
+{
+       struct clk *clk = container_of(ref, struct clk, ref);
+       int i = clk->num_parents;
+
+       kfree(clk->parents);
+       while (--i >= 0)
+               kfree(clk->parent_names[i]);
+
+       kfree(clk->parent_names);
+       kfree(clk->name);
+       kfree(clk);
+}
+
+/*
+ * Empty clk_ops for unregistered clocks. These are used temporarily
+ * after clk_unregister() was called on a clock and until last clock
+ * consumer calls clk_put() and the struct clk object is freed.
+ */
+static int clk_nodrv_prepare_enable(struct clk_hw *hw)
+{
+       return -ENXIO;
+}
+
+static void clk_nodrv_disable_unprepare(struct clk_hw *hw)
+{
+       WARN_ON_ONCE(1);
+}
+
+static int clk_nodrv_set_rate(struct clk_hw *hw, unsigned long rate,
+                                       unsigned long parent_rate)
+{
+       return -ENXIO;
+}
+
+static int clk_nodrv_set_parent(struct clk_hw *hw, u8 index)
+{
+       return -ENXIO;
+}
+
+static const struct clk_ops clk_nodrv_ops = {
+       .enable         = clk_nodrv_prepare_enable,
+       .disable        = clk_nodrv_disable_unprepare,
+       .prepare        = clk_nodrv_prepare_enable,
+       .unprepare      = clk_nodrv_disable_unprepare,
+       .set_rate       = clk_nodrv_set_rate,
+       .set_parent     = clk_nodrv_set_parent,
+};
+
 /**
  * clk_unregister - unregister a currently registered clock
  * @clk: clock to unregister
- *
- * Currently unimplemented.
  */
-void clk_unregister(struct clk *clk) {}
+void clk_unregister(struct clk *clk)
+{
+       unsigned long flags;
+
+       if (!clk || WARN_ON_ONCE(IS_ERR(clk)))
+               return;
+
+       clk_prepare_lock();
+
+       if (clk->ops == &clk_nodrv_ops) {
+               pr_err("%s: unregistered clock: %s\n", __func__, clk->name);
+               goto out;
+       }
+       /*
+        * Assign empty clock ops for consumers that might still hold
+        * a reference to this clock.
+        */
+       flags = clk_enable_lock();
+       clk->ops = &clk_nodrv_ops;
+       clk_enable_unlock(flags);
+
+       if (!hlist_empty(&clk->children)) {
+               struct clk *child;
+
+               /* Reparent all children to the orphan list. */
+               hlist_for_each_entry(child, &clk->children, child_node)
+                       clk_set_parent(child, NULL);
+       }
+
+       clk_debug_unregister(clk);
+
+       hlist_del_init(&clk->child_node);
+
+       if (clk->prepare_count)
+               pr_warn("%s: unregistering prepared clock: %s\n",
+                                       __func__, clk->name);
+
+       kref_put(&clk->ref, __clk_release);
+out:
+       clk_prepare_unlock();
+}
 EXPORT_SYMBOL_GPL(clk_unregister);
 
 static void devm_clk_release(struct device *dev, void *res)
@@ -1970,6 +2214,31 @@ void devm_clk_unregister(struct device *dev, struct clk *clk)
 }
 EXPORT_SYMBOL_GPL(devm_clk_unregister);
 
+/*
+ * clkdev helpers
+ */
+int __clk_get(struct clk *clk)
+{
+       if (clk && !try_module_get(clk->owner))
+               return 0;
+
+       kref_get(&clk->ref);
+       return 1;
+}
+
+void __clk_put(struct clk *clk)
+{
+       if (WARN_ON_ONCE(IS_ERR(clk)))
+               return;
+
+       clk_prepare_lock();
+       kref_put(&clk->ref, __clk_release);
+       clk_prepare_unlock();
+
+       if (clk)
+               module_put(clk->owner);
+}
+
 /***        clk rate change notifiers        ***/
 
 /**
@@ -2110,7 +2379,18 @@ static const struct of_device_id __clk_of_table_sentinel
        __used __section(__clk_of_table_end);
 
 static LIST_HEAD(of_clk_providers);
-static DEFINE_MUTEX(of_clk_lock);
+static DEFINE_MUTEX(of_clk_mutex);
+
+/* of_clk_provider list locking helpers */
+void of_clk_lock(void)
+{
+       mutex_lock(&of_clk_mutex);
+}
+
+void of_clk_unlock(void)
+{
+       mutex_unlock(&of_clk_mutex);
+}
 
 struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
                                     void *data)
@@ -2154,9 +2434,9 @@ int of_clk_add_provider(struct device_node *np,
        cp->data = data;
        cp->get = clk_src_get;
 
-       mutex_lock(&of_clk_lock);
+       mutex_lock(&of_clk_mutex);
        list_add(&cp->link, &of_clk_providers);
-       mutex_unlock(&of_clk_lock);
+       mutex_unlock(&of_clk_mutex);
        pr_debug("Added clock from %s\n", np->full_name);
 
        return 0;
@@ -2171,7 +2451,7 @@ void of_clk_del_provider(struct device_node *np)
 {
        struct of_clk_provider *cp;
 
-       mutex_lock(&of_clk_lock);
+       mutex_lock(&of_clk_mutex);
        list_for_each_entry(cp, &of_clk_providers, link) {
                if (cp->node == np) {
                        list_del(&cp->link);
@@ -2180,24 +2460,33 @@ void of_clk_del_provider(struct device_node *np)
                        break;
                }
        }
-       mutex_unlock(&of_clk_lock);
+       mutex_unlock(&of_clk_mutex);
 }
 EXPORT_SYMBOL_GPL(of_clk_del_provider);
 
-struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
+struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec)
 {
        struct of_clk_provider *provider;
        struct clk *clk = ERR_PTR(-ENOENT);
 
        /* Check if we have such a provider in our array */
-       mutex_lock(&of_clk_lock);
        list_for_each_entry(provider, &of_clk_providers, link) {
                if (provider->node == clkspec->np)
                        clk = provider->get(clkspec, provider->data);
                if (!IS_ERR(clk))
                        break;
        }
-       mutex_unlock(&of_clk_lock);
+
+       return clk;
+}
+
+struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
+{
+       struct clk *clk;
+
+       mutex_lock(&of_clk_mutex);
+       clk = __of_clk_get_from_provider(clkspec);
+       mutex_unlock(&of_clk_mutex);
 
        return clk;
 }
diff --git a/drivers/clk/clk.h b/drivers/clk/clk.h
new file mode 100644 (file)
index 0000000..795cc9f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * linux/drivers/clk/clk.h
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Sylwester Nawrocki <s.nawrocki@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
+struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec);
+void of_clk_lock(void);
+void of_clk_unlock(void);
+#endif
index 442a31363873d35f319e0d5ee5b6b250084c02fc..48f67218247cb0cb44cfa92b8ed4903a0f193531 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/clkdev.h>
 #include <linux/of.h>
 
+#include "clk.h"
+
 static LIST_HEAD(clocks);
 static DEFINE_MUTEX(clocks_mutex);
 
@@ -39,7 +41,13 @@ struct clk *of_clk_get(struct device_node *np, int index)
        if (rc)
                return ERR_PTR(rc);
 
-       clk = of_clk_get_from_provider(&clkspec);
+       of_clk_lock();
+       clk = __of_clk_get_from_provider(&clkspec);
+
+       if (!IS_ERR(clk) && !__clk_get(clk))
+               clk = ERR_PTR(-ENOENT);
+
+       of_clk_unlock();
        of_node_put(clkspec.np);
        return clk;
 }
@@ -157,7 +165,7 @@ struct clk *clk_get(struct device *dev, const char *con_id)
 
        if (dev) {
                clk = of_clk_get_by_name(dev->of_node, con_id);
-               if (!IS_ERR(clk) && __clk_get(clk))
+               if (!IS_ERR(clk))
                        return clk;
        }
 
diff --git a/drivers/clk/hisilicon/Makefile b/drivers/clk/hisilicon/Makefile
new file mode 100644 (file)
index 0000000..a049108
--- /dev/null
@@ -0,0 +1,5 @@
+#
+# Hisilicon Clock specific Makefile
+#
+
+obj-y  += clk.o clkgate-separated.o clk-hi3620.o
diff --git a/drivers/clk/hisilicon/clk-hi3620.c b/drivers/clk/hisilicon/clk-hi3620.c
new file mode 100644 (file)
index 0000000..f24ad6a
--- /dev/null
@@ -0,0 +1,242 @@
+/*
+ * Hisilicon Hi3620 clock driver
+ *
+ * Copyright (c) 2012-2013 Hisilicon Limited.
+ * Copyright (c) 2012-2013 Linaro Limited.
+ *
+ * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
+ *        Xin Li <li.xin@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/slab.h>
+#include <linux/clk.h>
+
+#include <dt-bindings/clock/hi3620-clock.h>
+
+#include "clk.h"
+
+/* clock parent list */
+static const char *timer0_mux_p[] __initdata = { "osc32k", "timerclk01", };
+static const char *timer1_mux_p[] __initdata = { "osc32k", "timerclk01", };
+static const char *timer2_mux_p[] __initdata = { "osc32k", "timerclk23", };
+static const char *timer3_mux_p[] __initdata = { "osc32k", "timerclk23", };
+static const char *timer4_mux_p[] __initdata = { "osc32k", "timerclk45", };
+static const char *timer5_mux_p[] __initdata = { "osc32k", "timerclk45", };
+static const char *timer6_mux_p[] __initdata = { "osc32k", "timerclk67", };
+static const char *timer7_mux_p[] __initdata = { "osc32k", "timerclk67", };
+static const char *timer8_mux_p[] __initdata = { "osc32k", "timerclk89", };
+static const char *timer9_mux_p[] __initdata = { "osc32k", "timerclk89", };
+static const char *uart0_mux_p[] __initdata = { "osc26m", "pclk", };
+static const char *uart1_mux_p[] __initdata = { "osc26m", "pclk", };
+static const char *uart2_mux_p[] __initdata = { "osc26m", "pclk", };
+static const char *uart3_mux_p[] __initdata = { "osc26m", "pclk", };
+static const char *uart4_mux_p[] __initdata = { "osc26m", "pclk", };
+static const char *spi0_mux_p[] __initdata = { "osc26m", "rclk_cfgaxi", };
+static const char *spi1_mux_p[] __initdata = { "osc26m", "rclk_cfgaxi", };
+static const char *spi2_mux_p[] __initdata = { "osc26m", "rclk_cfgaxi", };
+/* share axi parent */
+static const char *saxi_mux_p[] __initdata = { "armpll3", "armpll2", };
+static const char *pwm0_mux_p[] __initdata = { "osc32k", "osc26m", };
+static const char *pwm1_mux_p[] __initdata = { "osc32k", "osc26m", };
+static const char *sd_mux_p[] __initdata = { "armpll2", "armpll3", };
+static const char *mmc1_mux_p[] __initdata = { "armpll2", "armpll3", };
+static const char *mmc1_mux2_p[] __initdata = { "osc26m", "mmc1_div", };
+static const char *g2d_mux_p[] __initdata = { "armpll2", "armpll3", };
+static const char *venc_mux_p[] __initdata = { "armpll2", "armpll3", };
+static const char *vdec_mux_p[] __initdata = { "armpll2", "armpll3", };
+static const char *vpp_mux_p[] __initdata = { "armpll2", "armpll3", };
+static const char *edc0_mux_p[] __initdata = { "armpll2", "armpll3", };
+static const char *ldi0_mux_p[] __initdata = { "armpll2", "armpll4",
+                                            "armpll3", "armpll5", };
+static const char *edc1_mux_p[] __initdata = { "armpll2", "armpll3", };
+static const char *ldi1_mux_p[] __initdata = { "armpll2", "armpll4",
+                                            "armpll3", "armpll5", };
+static const char *rclk_hsic_p[] __initdata = { "armpll3", "armpll2", };
+static const char *mmc2_mux_p[] __initdata = { "armpll2", "armpll3", };
+static const char *mmc3_mux_p[] __initdata = { "armpll2", "armpll3", };
+
+
+/* fixed rate clocks */
+static struct hisi_fixed_rate_clock hi3620_fixed_rate_clks[] __initdata = {
+       { HI3620_OSC32K,   "osc32k",   NULL, CLK_IS_ROOT, 32768, },
+       { HI3620_OSC26M,   "osc26m",   NULL, CLK_IS_ROOT, 26000000, },
+       { HI3620_PCLK,     "pclk",     NULL, CLK_IS_ROOT, 26000000, },
+       { HI3620_PLL_ARM0, "armpll0",  NULL, CLK_IS_ROOT, 1600000000, },
+       { HI3620_PLL_ARM1, "armpll1",  NULL, CLK_IS_ROOT, 1600000000, },
+       { HI3620_PLL_PERI, "armpll2",  NULL, CLK_IS_ROOT, 1440000000, },
+       { HI3620_PLL_USB,  "armpll3",  NULL, CLK_IS_ROOT, 1440000000, },
+       { HI3620_PLL_HDMI, "armpll4",  NULL, CLK_IS_ROOT, 1188000000, },
+       { HI3620_PLL_GPU,  "armpll5",  NULL, CLK_IS_ROOT, 1300000000, },
+};
+
+/* fixed factor clocks */
+static struct hisi_fixed_factor_clock hi3620_fixed_factor_clks[] __initdata = {
+       { HI3620_RCLK_TCXO,   "rclk_tcxo",   "osc26m",   1, 4,  0, },
+       { HI3620_RCLK_CFGAXI, "rclk_cfgaxi", "armpll2",  1, 30, 0, },
+       { HI3620_RCLK_PICO,   "rclk_pico",   "hsic_div", 1, 40, 0, },
+};
+
+static struct hisi_mux_clock hi3620_mux_clks[] __initdata = {
+       { HI3620_TIMER0_MUX, "timer0_mux", timer0_mux_p, ARRAY_SIZE(timer0_mux_p), CLK_SET_RATE_PARENT, 0,     15, 2, 0,                   },
+       { HI3620_TIMER1_MUX, "timer1_mux", timer1_mux_p, ARRAY_SIZE(timer1_mux_p), CLK_SET_RATE_PARENT, 0,     17, 2, 0,                   },
+       { HI3620_TIMER2_MUX, "timer2_mux", timer2_mux_p, ARRAY_SIZE(timer2_mux_p), CLK_SET_RATE_PARENT, 0,     19, 2, 0,                   },
+       { HI3620_TIMER3_MUX, "timer3_mux", timer3_mux_p, ARRAY_SIZE(timer3_mux_p), CLK_SET_RATE_PARENT, 0,     21, 2, 0,                   },
+       { HI3620_TIMER4_MUX, "timer4_mux", timer4_mux_p, ARRAY_SIZE(timer4_mux_p), CLK_SET_RATE_PARENT, 0x18,  0,  2, 0,                   },
+       { HI3620_TIMER5_MUX, "timer5_mux", timer5_mux_p, ARRAY_SIZE(timer5_mux_p), CLK_SET_RATE_PARENT, 0x18,  2,  2, 0,                   },
+       { HI3620_TIMER6_MUX, "timer6_mux", timer6_mux_p, ARRAY_SIZE(timer6_mux_p), CLK_SET_RATE_PARENT, 0x18,  4,  2, 0,                   },
+       { HI3620_TIMER7_MUX, "timer7_mux", timer7_mux_p, ARRAY_SIZE(timer7_mux_p), CLK_SET_RATE_PARENT, 0x18,  6,  2, 0,                   },
+       { HI3620_TIMER8_MUX, "timer8_mux", timer8_mux_p, ARRAY_SIZE(timer8_mux_p), CLK_SET_RATE_PARENT, 0x18,  8,  2, 0,                   },
+       { HI3620_TIMER9_MUX, "timer9_mux", timer9_mux_p, ARRAY_SIZE(timer9_mux_p), CLK_SET_RATE_PARENT, 0x18,  10, 2, 0,                   },
+       { HI3620_UART0_MUX,  "uart0_mux",  uart0_mux_p,  ARRAY_SIZE(uart0_mux_p),  CLK_SET_RATE_PARENT, 0x100, 7,  1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_UART1_MUX,  "uart1_mux",  uart1_mux_p,  ARRAY_SIZE(uart1_mux_p),  CLK_SET_RATE_PARENT, 0x100, 8,  1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_UART2_MUX,  "uart2_mux",  uart2_mux_p,  ARRAY_SIZE(uart2_mux_p),  CLK_SET_RATE_PARENT, 0x100, 9,  1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_UART3_MUX,  "uart3_mux",  uart3_mux_p,  ARRAY_SIZE(uart3_mux_p),  CLK_SET_RATE_PARENT, 0x100, 10, 1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_UART4_MUX,  "uart4_mux",  uart4_mux_p,  ARRAY_SIZE(uart4_mux_p),  CLK_SET_RATE_PARENT, 0x100, 11, 1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_SPI0_MUX,   "spi0_mux",   spi0_mux_p,   ARRAY_SIZE(spi0_mux_p),   CLK_SET_RATE_PARENT, 0x100, 12, 1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_SPI1_MUX,   "spi1_mux",   spi1_mux_p,   ARRAY_SIZE(spi1_mux_p),   CLK_SET_RATE_PARENT, 0x100, 13, 1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_SPI2_MUX,   "spi2_mux",   spi2_mux_p,   ARRAY_SIZE(spi2_mux_p),   CLK_SET_RATE_PARENT, 0x100, 14, 1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_SAXI_MUX,   "saxi_mux",   saxi_mux_p,   ARRAY_SIZE(saxi_mux_p),   CLK_SET_RATE_PARENT, 0x100, 15, 1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_PWM0_MUX,   "pwm0_mux",   pwm0_mux_p,   ARRAY_SIZE(pwm0_mux_p),   CLK_SET_RATE_PARENT, 0x104, 10, 1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_PWM1_MUX,   "pwm1_mux",   pwm1_mux_p,   ARRAY_SIZE(pwm1_mux_p),   CLK_SET_RATE_PARENT, 0x104, 11, 1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_SD_MUX,     "sd_mux",     sd_mux_p,     ARRAY_SIZE(sd_mux_p),     CLK_SET_RATE_PARENT, 0x108, 4,  1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_MMC1_MUX,   "mmc1_mux",   mmc1_mux_p,   ARRAY_SIZE(mmc1_mux_p),   CLK_SET_RATE_PARENT, 0x108, 9,  1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_MMC1_MUX2,  "mmc1_mux2",  mmc1_mux2_p,  ARRAY_SIZE(mmc1_mux2_p),  CLK_SET_RATE_PARENT, 0x108, 10, 1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_G2D_MUX,    "g2d_mux",    g2d_mux_p,    ARRAY_SIZE(g2d_mux_p),    CLK_SET_RATE_PARENT, 0x10c, 5,  1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_VENC_MUX,   "venc_mux",   venc_mux_p,   ARRAY_SIZE(venc_mux_p),   CLK_SET_RATE_PARENT, 0x10c, 11, 1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_VDEC_MUX,   "vdec_mux",   vdec_mux_p,   ARRAY_SIZE(vdec_mux_p),   CLK_SET_RATE_PARENT, 0x110, 5,  1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_VPP_MUX,    "vpp_mux",    vpp_mux_p,    ARRAY_SIZE(vpp_mux_p),    CLK_SET_RATE_PARENT, 0x110, 11, 1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_EDC0_MUX,   "edc0_mux",   edc0_mux_p,   ARRAY_SIZE(edc0_mux_p),   CLK_SET_RATE_PARENT, 0x114, 6,  1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_LDI0_MUX,   "ldi0_mux",   ldi0_mux_p,   ARRAY_SIZE(ldi0_mux_p),   CLK_SET_RATE_PARENT, 0x114, 13, 2, CLK_MUX_HIWORD_MASK, },
+       { HI3620_EDC1_MUX,   "edc1_mux",   edc1_mux_p,   ARRAY_SIZE(edc1_mux_p),   CLK_SET_RATE_PARENT, 0x118, 6,  1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_LDI1_MUX,   "ldi1_mux",   ldi1_mux_p,   ARRAY_SIZE(ldi1_mux_p),   CLK_SET_RATE_PARENT, 0x118, 14, 2, CLK_MUX_HIWORD_MASK, },
+       { HI3620_RCLK_HSIC,  "rclk_hsic",  rclk_hsic_p,  ARRAY_SIZE(rclk_hsic_p),  CLK_SET_RATE_PARENT, 0x130, 2,  1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_MMC2_MUX,   "mmc2_mux",   mmc2_mux_p,   ARRAY_SIZE(mmc2_mux_p),   CLK_SET_RATE_PARENT, 0x140, 4,  1, CLK_MUX_HIWORD_MASK, },
+       { HI3620_MMC3_MUX,   "mmc3_mux",   mmc3_mux_p,   ARRAY_SIZE(mmc3_mux_p),   CLK_SET_RATE_PARENT, 0x140, 9,  1, CLK_MUX_HIWORD_MASK, },
+};
+
+static struct hisi_divider_clock hi3620_div_clks[] __initdata = {
+       { HI3620_SHAREAXI_DIV, "saxi_div",   "saxi_mux",  0, 0x100, 0, 5, CLK_DIVIDER_HIWORD_MASK, NULL, },
+       { HI3620_CFGAXI_DIV,   "cfgaxi_div", "saxi_div",  0, 0x100, 5, 2, CLK_DIVIDER_HIWORD_MASK, NULL, },
+       { HI3620_SD_DIV,       "sd_div",     "sd_mux",    0, 0x108, 0, 4, CLK_DIVIDER_HIWORD_MASK, NULL, },
+       { HI3620_MMC1_DIV,     "mmc1_div",   "mmc1_mux",  0, 0x108, 5, 4, CLK_DIVIDER_HIWORD_MASK, NULL, },
+       { HI3620_HSIC_DIV,     "hsic_div",   "rclk_hsic", 0, 0x130, 0, 2, CLK_DIVIDER_HIWORD_MASK, NULL, },
+       { HI3620_MMC2_DIV,     "mmc2_div",   "mmc2_mux",  0, 0x140, 0, 4, CLK_DIVIDER_HIWORD_MASK, NULL, },
+       { HI3620_MMC3_DIV,     "mmc3_div",   "mmc3_mux",  0, 0x140, 5, 4, CLK_DIVIDER_HIWORD_MASK, NULL, },
+};
+
+static struct hisi_gate_clock hi3620_seperated_gate_clks[] __initdata = {
+       { HI3620_TIMERCLK01,   "timerclk01",   "timer_rclk01", CLK_SET_RATE_PARENT, 0x20, 0, 0, },
+       { HI3620_TIMER_RCLK01, "timer_rclk01", "rclk_tcxo",    CLK_SET_RATE_PARENT, 0x20, 1, 0, },
+       { HI3620_TIMERCLK23,   "timerclk23",   "timer_rclk23", CLK_SET_RATE_PARENT, 0x20, 2, 0, },
+       { HI3620_TIMER_RCLK23, "timer_rclk23", "rclk_tcxo",    CLK_SET_RATE_PARENT, 0x20, 3, 0, },
+       { HI3620_RTCCLK,       "rtcclk",       "pclk",         CLK_SET_RATE_PARENT, 0x20, 5, 0, },
+       { HI3620_KPC_CLK,      "kpc_clk",      "pclk",         CLK_SET_RATE_PARENT, 0x20, 6, 0, },
+       { HI3620_GPIOCLK0,     "gpioclk0",     "pclk",         CLK_SET_RATE_PARENT, 0x20, 8, 0, },
+       { HI3620_GPIOCLK1,     "gpioclk1",     "pclk",         CLK_SET_RATE_PARENT, 0x20, 9, 0, },
+       { HI3620_GPIOCLK2,     "gpioclk2",     "pclk",         CLK_SET_RATE_PARENT, 0x20, 10, 0, },
+       { HI3620_GPIOCLK3,     "gpioclk3",     "pclk",         CLK_SET_RATE_PARENT, 0x20, 11, 0, },
+       { HI3620_GPIOCLK4,     "gpioclk4",     "pclk",         CLK_SET_RATE_PARENT, 0x20, 12, 0, },
+       { HI3620_GPIOCLK5,     "gpioclk5",     "pclk",         CLK_SET_RATE_PARENT, 0x20, 13, 0, },
+       { HI3620_GPIOCLK6,     "gpioclk6",     "pclk",         CLK_SET_RATE_PARENT, 0x20, 14, 0, },
+       { HI3620_GPIOCLK7,     "gpioclk7",     "pclk",         CLK_SET_RATE_PARENT, 0x20, 15, 0, },
+       { HI3620_GPIOCLK8,     "gpioclk8",     "pclk",         CLK_SET_RATE_PARENT, 0x20, 16, 0, },
+       { HI3620_GPIOCLK9,     "gpioclk9",     "pclk",         CLK_SET_RATE_PARENT, 0x20, 17, 0, },
+       { HI3620_GPIOCLK10,    "gpioclk10",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 18, 0, },
+       { HI3620_GPIOCLK11,    "gpioclk11",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 19, 0, },
+       { HI3620_GPIOCLK12,    "gpioclk12",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 20, 0, },
+       { HI3620_GPIOCLK13,    "gpioclk13",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 21, 0, },
+       { HI3620_GPIOCLK14,    "gpioclk14",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 22, 0, },
+       { HI3620_GPIOCLK15,    "gpioclk15",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 23, 0, },
+       { HI3620_GPIOCLK16,    "gpioclk16",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 24, 0, },
+       { HI3620_GPIOCLK17,    "gpioclk17",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 25, 0, },
+       { HI3620_GPIOCLK18,    "gpioclk18",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 26, 0, },
+       { HI3620_GPIOCLK19,    "gpioclk19",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 27, 0, },
+       { HI3620_GPIOCLK20,    "gpioclk20",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 28, 0, },
+       { HI3620_GPIOCLK21,    "gpioclk21",    "pclk",         CLK_SET_RATE_PARENT, 0x20, 29, 0, },
+       { HI3620_DPHY0_CLK,    "dphy0_clk",    "osc26m",       CLK_SET_RATE_PARENT, 0x30, 15, 0, },
+       { HI3620_DPHY1_CLK,    "dphy1_clk",    "osc26m",       CLK_SET_RATE_PARENT, 0x30, 16, 0, },
+       { HI3620_DPHY2_CLK,    "dphy2_clk",    "osc26m",       CLK_SET_RATE_PARENT, 0x30, 17, 0, },
+       { HI3620_USBPHY_CLK,   "usbphy_clk",   "rclk_pico",    CLK_SET_RATE_PARENT, 0x30, 24, 0, },
+       { HI3620_ACP_CLK,      "acp_clk",      "rclk_cfgaxi",  CLK_SET_RATE_PARENT, 0x30, 28, 0, },
+       { HI3620_TIMERCLK45,   "timerclk45",   "rclk_tcxo",    CLK_SET_RATE_PARENT, 0x40, 3, 0, },
+       { HI3620_TIMERCLK67,   "timerclk67",   "rclk_tcxo",    CLK_SET_RATE_PARENT, 0x40, 4, 0, },
+       { HI3620_TIMERCLK89,   "timerclk89",   "rclk_tcxo",    CLK_SET_RATE_PARENT, 0x40, 5, 0, },
+       { HI3620_PWMCLK0,      "pwmclk0",      "pwm0_mux",     CLK_SET_RATE_PARENT, 0x40, 7, 0, },
+       { HI3620_PWMCLK1,      "pwmclk1",      "pwm1_mux",     CLK_SET_RATE_PARENT, 0x40, 8, 0, },
+       { HI3620_UARTCLK0,     "uartclk0",     "uart0_mux",    CLK_SET_RATE_PARENT, 0x40, 16, 0, },
+       { HI3620_UARTCLK1,     "uartclk1",     "uart1_mux",    CLK_SET_RATE_PARENT, 0x40, 17, 0, },
+       { HI3620_UARTCLK2,     "uartclk2",     "uart2_mux",    CLK_SET_RATE_PARENT, 0x40, 18, 0, },
+       { HI3620_UARTCLK3,     "uartclk3",     "uart3_mux",    CLK_SET_RATE_PARENT, 0x40, 19, 0, },
+       { HI3620_UARTCLK4,     "uartclk4",     "uart4_mux",    CLK_SET_RATE_PARENT, 0x40, 20, 0, },
+       { HI3620_SPICLK0,      "spiclk0",      "spi0_mux",     CLK_SET_RATE_PARENT, 0x40, 21, 0, },
+       { HI3620_SPICLK1,      "spiclk1",      "spi1_mux",     CLK_SET_RATE_PARENT, 0x40, 22, 0, },
+       { HI3620_SPICLK2,      "spiclk2",      "spi2_mux",     CLK_SET_RATE_PARENT, 0x40, 23, 0, },
+       { HI3620_I2CCLK0,      "i2cclk0",      "pclk",         CLK_SET_RATE_PARENT, 0x40, 24, 0, },
+       { HI3620_I2CCLK1,      "i2cclk1",      "pclk",         CLK_SET_RATE_PARENT, 0x40, 25, 0, },
+       { HI3620_SCI_CLK,      "sci_clk",      "osc26m",       CLK_SET_RATE_PARENT, 0x40, 26, 0, },
+       { HI3620_I2CCLK2,      "i2cclk2",      "pclk",         CLK_SET_RATE_PARENT, 0x40, 28, 0, },
+       { HI3620_I2CCLK3,      "i2cclk3",      "pclk",         CLK_SET_RATE_PARENT, 0x40, 29, 0, },
+       { HI3620_DDRC_PER_CLK, "ddrc_per_clk", "rclk_cfgaxi",  CLK_SET_RATE_PARENT, 0x50, 9, 0, },
+       { HI3620_DMAC_CLK,     "dmac_clk",     "rclk_cfgaxi",  CLK_SET_RATE_PARENT, 0x50, 10, 0, },
+       { HI3620_USB2DVC_CLK,  "usb2dvc_clk",  "rclk_cfgaxi",  CLK_SET_RATE_PARENT, 0x50, 17, 0, },
+       { HI3620_SD_CLK,       "sd_clk",       "sd_div",       CLK_SET_RATE_PARENT, 0x50, 20, 0, },
+       { HI3620_MMC_CLK1,     "mmc_clk1",     "mmc1_mux2",    CLK_SET_RATE_PARENT, 0x50, 21, 0, },
+       { HI3620_MMC_CLK2,     "mmc_clk2",     "mmc2_div",     CLK_SET_RATE_PARENT, 0x50, 22, 0, },
+       { HI3620_MMC_CLK3,     "mmc_clk3",     "mmc3_div",     CLK_SET_RATE_PARENT, 0x50, 23, 0, },
+       { HI3620_MCU_CLK,      "mcu_clk",      "acp_clk",      CLK_SET_RATE_PARENT, 0x50, 24, 0, },
+};
+
+static void __init hi3620_clk_init(struct device_node *np)
+{
+       void __iomem *base;
+
+       if (np) {
+               base = of_iomap(np, 0);
+               if (!base) {
+                       pr_err("failed to map Hi3620 clock registers\n");
+                       return;
+               }
+       } else {
+               pr_err("failed to find Hi3620 clock node in DTS\n");
+               return;
+       }
+
+       hisi_clk_init(np, HI3620_NR_CLKS);
+
+       hisi_clk_register_fixed_rate(hi3620_fixed_rate_clks,
+                                    ARRAY_SIZE(hi3620_fixed_rate_clks),
+                                    base);
+       hisi_clk_register_fixed_factor(hi3620_fixed_factor_clks,
+                                      ARRAY_SIZE(hi3620_fixed_factor_clks),
+                                      base);
+       hisi_clk_register_mux(hi3620_mux_clks, ARRAY_SIZE(hi3620_mux_clks),
+                             base);
+       hisi_clk_register_divider(hi3620_div_clks, ARRAY_SIZE(hi3620_div_clks),
+                                 base);
+       hisi_clk_register_gate_sep(hi3620_seperated_gate_clks,
+                                  ARRAY_SIZE(hi3620_seperated_gate_clks),
+                                  base);
+}
+CLK_OF_DECLARE(hi3620_clk, "hisilicon,hi3620-clock", hi3620_clk_init);
diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c
new file mode 100644 (file)
index 0000000..a3a7152
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Hisilicon clock driver
+ *
+ * Copyright (c) 2012-2013 Hisilicon Limited.
+ * Copyright (c) 2012-2013 Linaro Limited.
+ *
+ * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
+ *        Xin Li <li.xin@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/slab.h>
+#include <linux/clk.h>
+
+#include "clk.h"
+
+static DEFINE_SPINLOCK(hisi_clk_lock);
+static struct clk **clk_table;
+static struct clk_onecell_data clk_data;
+
+void __init hisi_clk_init(struct device_node *np, int nr_clks)
+{
+       clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL);
+       if (!clk_table) {
+               pr_err("%s: could not allocate clock lookup table\n", __func__);
+               return;
+       }
+       clk_data.clks = clk_table;
+       clk_data.clk_num = nr_clks;
+       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+}
+
+void __init hisi_clk_register_fixed_rate(struct hisi_fixed_rate_clock *clks,
+                                        int nums, void __iomem *base)
+{
+       struct clk *clk;
+       int i;
+
+       for (i = 0; i < nums; i++) {
+               clk = clk_register_fixed_rate(NULL, clks[i].name,
+                                             clks[i].parent_name,
+                                             clks[i].flags,
+                                             clks[i].fixed_rate);
+               if (IS_ERR(clk)) {
+                       pr_err("%s: failed to register clock %s\n",
+                              __func__, clks[i].name);
+                       continue;
+               }
+       }
+}
+
+void __init hisi_clk_register_fixed_factor(struct hisi_fixed_factor_clock *clks,
+                                          int nums, void __iomem *base)
+{
+       struct clk *clk;
+       int i;
+
+       for (i = 0; i < nums; i++) {
+               clk = clk_register_fixed_factor(NULL, clks[i].name,
+                                               clks[i].parent_name,
+                                               clks[i].flags, clks[i].mult,
+                                               clks[i].div);
+               if (IS_ERR(clk)) {
+                       pr_err("%s: failed to register clock %s\n",
+                              __func__, clks[i].name);
+                       continue;
+               }
+       }
+}
+
+void __init hisi_clk_register_mux(struct hisi_mux_clock *clks,
+                                 int nums, void __iomem *base)
+{
+       struct clk *clk;
+       int i;
+
+       for (i = 0; i < nums; i++) {
+               clk = clk_register_mux(NULL, clks[i].name, clks[i].parent_names,
+                                      clks[i].num_parents, clks[i].flags,
+                                      base + clks[i].offset, clks[i].shift,
+                                      clks[i].width, clks[i].mux_flags,
+                                      &hisi_clk_lock);
+               if (IS_ERR(clk)) {
+                       pr_err("%s: failed to register clock %s\n",
+                              __func__, clks[i].name);
+                       continue;
+               }
+
+               if (clks[i].alias)
+                       clk_register_clkdev(clk, clks[i].alias, NULL);
+
+               clk_table[clks[i].id] = clk;
+       }
+}
+
+void __init hisi_clk_register_divider(struct hisi_divider_clock *clks,
+                                     int nums, void __iomem *base)
+{
+       struct clk *clk;
+       int i;
+
+       for (i = 0; i < nums; i++) {
+               clk = clk_register_divider_table(NULL, clks[i].name,
+                                                clks[i].parent_name,
+                                                clks[i].flags,
+                                                base + clks[i].offset,
+                                                clks[i].shift, clks[i].width,
+                                                clks[i].div_flags,
+                                                clks[i].table,
+                                                &hisi_clk_lock);
+               if (IS_ERR(clk)) {
+                       pr_err("%s: failed to register clock %s\n",
+                              __func__, clks[i].name);
+                       continue;
+               }
+
+               if (clks[i].alias)
+                       clk_register_clkdev(clk, clks[i].alias, NULL);
+
+               clk_table[clks[i].id] = clk;
+       }
+}
+
+void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *clks,
+                                      int nums, void __iomem *base)
+{
+       struct clk *clk;
+       int i;
+
+       for (i = 0; i < nums; i++) {
+               clk = hisi_register_clkgate_sep(NULL, clks[i].name,
+                                               clks[i].parent_name,
+                                               clks[i].flags,
+                                               base + clks[i].offset,
+                                               clks[i].bit_idx,
+                                               clks[i].gate_flags,
+                                               &hisi_clk_lock);
+               if (IS_ERR(clk)) {
+                       pr_err("%s: failed to register clock %s\n",
+                              __func__, clks[i].name);
+                       continue;
+               }
+
+               if (clks[i].alias)
+                       clk_register_clkdev(clk, clks[i].alias, NULL);
+
+               clk_table[clks[i].id] = clk;
+       }
+}
diff --git a/drivers/clk/hisilicon/clk.h b/drivers/clk/hisilicon/clk.h
new file mode 100644 (file)
index 0000000..4a6beeb
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Hisilicon Hi3620 clock gate driver
+ *
+ * Copyright (c) 2012-2013 Hisilicon Limited.
+ * Copyright (c) 2012-2013 Linaro Limited.
+ *
+ * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
+ *        Xin Li <li.xin@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifndef        __HISI_CLK_H
+#define        __HISI_CLK_H
+
+#include <linux/clk-provider.h>
+#include <linux/io.h>
+#include <linux/spinlock.h>
+
+struct hisi_fixed_rate_clock {
+       unsigned int            id;
+       char                    *name;
+       const char              *parent_name;
+       unsigned long           flags;
+       unsigned long           fixed_rate;
+};
+
+struct hisi_fixed_factor_clock {
+       unsigned int            id;
+       char                    *name;
+       const char              *parent_name;
+       unsigned long           mult;
+       unsigned long           div;
+       unsigned long           flags;
+};
+
+struct hisi_mux_clock {
+       unsigned int            id;
+       const char              *name;
+       const char              **parent_names;
+       u8                      num_parents;
+       unsigned long           flags;
+       unsigned long           offset;
+       u8                      shift;
+       u8                      width;
+       u8                      mux_flags;
+       const char              *alias;
+};
+
+struct hisi_divider_clock {
+       unsigned int            id;
+       const char              *name;
+       const char              *parent_name;
+       unsigned long           flags;
+       unsigned long           offset;
+       u8                      shift;
+       u8                      width;
+       u8                      div_flags;
+       struct clk_div_table    *table;
+       const char              *alias;
+};
+
+struct hisi_gate_clock {
+       unsigned int            id;
+       const char              *name;
+       const char              *parent_name;
+       unsigned long           flags;
+       unsigned long           offset;
+       u8                      bit_idx;
+       u8                      gate_flags;
+       const char              *alias;
+};
+
+struct clk *hisi_register_clkgate_sep(struct device *, const char *,
+                               const char *, unsigned long,
+                               void __iomem *, u8,
+                               u8, spinlock_t *);
+
+void __init hisi_clk_init(struct device_node *, int);
+void __init hisi_clk_register_fixed_rate(struct hisi_fixed_rate_clock *,
+                                       int, void __iomem *);
+void __init hisi_clk_register_fixed_factor(struct hisi_fixed_factor_clock *,
+                                       int, void __iomem *);
+void __init hisi_clk_register_mux(struct hisi_mux_clock *, int,
+                               void __iomem *);
+void __init hisi_clk_register_divider(struct hisi_divider_clock *,
+                               int, void __iomem *);
+void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *,
+                                       int, void __iomem *);
+#endif /* __HISI_CLK_H */
diff --git a/drivers/clk/hisilicon/clkgate-separated.c b/drivers/clk/hisilicon/clkgate-separated.c
new file mode 100644 (file)
index 0000000..b03d5a7
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Hisilicon clock separated gate driver
+ *
+ * Copyright (c) 2012-2013 Hisilicon Limited.
+ * Copyright (c) 2012-2013 Linaro Limited.
+ *
+ * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
+ *        Xin Li <li.xin@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/io.h>
+#include <linux/slab.h>
+#include <linux/clk.h>
+
+#include "clk.h"
+
+/* clock separated gate register offset */
+#define CLKGATE_SEPERATED_ENABLE               0x0
+#define CLKGATE_SEPERATED_DISABLE              0x4
+#define CLKGATE_SEPERATED_STATUS               0x8
+
+struct clkgate_separated {
+       struct clk_hw   hw;
+       void __iomem    *enable;        /* enable register */
+       u8              bit_idx;        /* bits in enable/disable register */
+       u8              flags;
+       spinlock_t      *lock;
+};
+
+static int clkgate_separated_enable(struct clk_hw *hw)
+{
+       struct clkgate_separated *sclk;
+       unsigned long flags = 0;
+       u32 reg;
+
+       sclk = container_of(hw, struct clkgate_separated, hw);
+       if (sclk->lock)
+               spin_lock_irqsave(sclk->lock, flags);
+       reg = BIT(sclk->bit_idx);
+       writel_relaxed(reg, sclk->enable);
+       readl_relaxed(sclk->enable + CLKGATE_SEPERATED_STATUS);
+       if (sclk->lock)
+               spin_unlock_irqrestore(sclk->lock, flags);
+       return 0;
+}
+
+static void clkgate_separated_disable(struct clk_hw *hw)
+{
+       struct clkgate_separated *sclk;
+       unsigned long flags = 0;
+       u32 reg;
+
+       sclk = container_of(hw, struct clkgate_separated, hw);
+       if (sclk->lock)
+               spin_lock_irqsave(sclk->lock, flags);
+       reg = BIT(sclk->bit_idx);
+       writel_relaxed(reg, sclk->enable + CLKGATE_SEPERATED_DISABLE);
+       readl_relaxed(sclk->enable + CLKGATE_SEPERATED_STATUS);
+       if (sclk->lock)
+               spin_unlock_irqrestore(sclk->lock, flags);
+}
+
+static int clkgate_separated_is_enabled(struct clk_hw *hw)
+{
+       struct clkgate_separated *sclk;
+       u32 reg;
+
+       sclk = container_of(hw, struct clkgate_separated, hw);
+       reg = readl_relaxed(sclk->enable + CLKGATE_SEPERATED_STATUS);
+       reg &= BIT(sclk->bit_idx);
+
+       return reg ? 1 : 0;
+}
+
+static struct clk_ops clkgate_separated_ops = {
+       .enable         = clkgate_separated_enable,
+       .disable        = clkgate_separated_disable,
+       .is_enabled     = clkgate_separated_is_enabled,
+};
+
+struct clk *hisi_register_clkgate_sep(struct device *dev, const char *name,
+                                     const char *parent_name,
+                                     unsigned long flags,
+                                     void __iomem *reg, u8 bit_idx,
+                                     u8 clk_gate_flags, spinlock_t *lock)
+{
+       struct clkgate_separated *sclk;
+       struct clk *clk;
+       struct clk_init_data init;
+
+       sclk = kzalloc(sizeof(*sclk), GFP_KERNEL);
+       if (!sclk) {
+               pr_err("%s: fail to allocate separated gated clk\n", __func__);
+               return ERR_PTR(-ENOMEM);
+       }
+
+       init.name = name;
+       init.ops = &clkgate_separated_ops;
+       init.flags = flags | CLK_IS_BASIC;
+       init.parent_names = (parent_name ? &parent_name : NULL);
+       init.num_parents = (parent_name ? 1 : 0);
+
+       sclk->enable = reg + CLKGATE_SEPERATED_ENABLE;
+       sclk->bit_idx = bit_idx;
+       sclk->flags = clk_gate_flags;
+       sclk->hw.init = &init;
+
+       clk = clk_register(dev, &sclk->hw);
+       if (IS_ERR(clk))
+               kfree(sclk);
+       return clk;
+}
index 1f333bcfc22e2ebdb344103a2aaad3f486fbec7d..17a598398a53df461e110ca5c16d29e7bc92e6f5 100644 (file)
@@ -223,8 +223,7 @@ static void __init of_psc_clk_init(struct device_node *node, spinlock_t *lock)
        data->domain_base = of_iomap(node, i);
        if (!data->domain_base) {
                pr_err("%s: domain ioremap failed\n", __func__);
-               iounmap(data->control_base);
-               goto out;
+               goto unmap_ctrl;
        }
 
        of_property_read_u32(node, "domain-id", &data->domain_id);
@@ -237,16 +236,21 @@ static void __init of_psc_clk_init(struct device_node *node, spinlock_t *lock)
        parent_name = of_clk_get_parent_name(node, 0);
        if (!parent_name) {
                pr_err("%s: Parent clock not found\n", __func__);
-               goto out;
+               goto unmap_domain;
        }
 
        clk = clk_register_psc(NULL, clk_name, parent_name, data, lock);
-       if (clk) {
+       if (!IS_ERR(clk)) {
                of_clk_add_provider(node, of_clk_src_simple_get, clk);
                return;
        }
 
        pr_err("%s: error registering clk %s\n", __func__, node->name);
+
+unmap_domain:
+       iounmap(data->domain_base);
+unmap_ctrl:
+       iounmap(data->control_base);
 out:
        kfree(data);
        return;
index 47a1bd9f1726574d61fca85691d2913a7ee353b4..0dd8a4b12747b6df0ce1c88f34aaf28781fe85f8 100644 (file)
@@ -24,6 +24,8 @@
 #define MAIN_PLLM_HIGH_MASK    0x7f000
 #define PLLM_HIGH_SHIFT                6
 #define PLLD_MASK              0x3f
+#define CLKOD_MASK             0x780000
+#define CLKOD_SHIFT            19
 
 /**
  * struct clk_pll_data - pll data structure
  * @pllm_upper_mask: multiplier upper mask
  * @pllm_upper_shift: multiplier upper shift
  * @plld_mask: divider mask
- * @postdiv: Post divider
+ * @clkod_mask: output divider mask
+ * @clkod_shift: output divider shift
+ * @plld_mask: divider mask
+ * @postdiv: Fixed post divider
  */
 struct clk_pll_data {
        bool has_pllctrl;
@@ -53,6 +58,8 @@ struct clk_pll_data {
        u32 pllm_upper_mask;
        u32 pllm_upper_shift;
        u32 plld_mask;
+       u32 clkod_mask;
+       u32 clkod_shift;
        u32 postdiv;
 };
 
@@ -90,7 +97,13 @@ static unsigned long clk_pllclk_recalc(struct clk_hw *hw,
        mult |= ((val & pll_data->pllm_upper_mask)
                        >> pll_data->pllm_upper_shift);
        prediv = (val & pll_data->plld_mask);
-       postdiv = pll_data->postdiv;
+
+       if (!pll_data->has_pllctrl)
+               /* read post divider from od bits*/
+               postdiv = ((val & pll_data->clkod_mask) >>
+                                pll_data->clkod_shift) + 1;
+       else
+               postdiv = pll_data->postdiv;
 
        rate /= (prediv + 1);
        rate = (rate * (mult + 1));
@@ -155,8 +168,11 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
        }
 
        parent_name = of_clk_get_parent_name(node, 0);
-       if (of_property_read_u32(node, "fixed-postdiv", &pll_data->postdiv))
-               goto out;
+       if (of_property_read_u32(node, "fixed-postdiv", &pll_data->postdiv)) {
+               /* assume the PLL has output divider register bits */
+               pll_data->clkod_mask = CLKOD_MASK;
+               pll_data->clkod_shift = CLKOD_SHIFT;
+       }
 
        i = of_property_match_string(node, "reg-names", "control");
        pll_data->pll_ctl0 = of_iomap(node, i);
index 0b0f3e729cf7ca5ec18c322a6322ab2001a55a70..c339b829d3e33fe60af81cbfb0317cecdb12add5 100644 (file)
@@ -4,15 +4,20 @@ config MVEBU_CLK_COMMON
 config MVEBU_CLK_CPU
        bool
 
+config MVEBU_CLK_COREDIV
+       bool
+
 config ARMADA_370_CLK
        bool
        select MVEBU_CLK_COMMON
        select MVEBU_CLK_CPU
+       select MVEBU_CLK_COREDIV
 
 config ARMADA_XP_CLK
        bool
        select MVEBU_CLK_COMMON
        select MVEBU_CLK_CPU
+       select MVEBU_CLK_COREDIV
 
 config DOVE_CLK
        bool
index 1c7e70c63fb26b80145b5e506015874b5da16b64..21bbfb4a9f42e9edcda25a0705ff1f9f701ac8bd 100644 (file)
@@ -1,5 +1,6 @@
 obj-$(CONFIG_MVEBU_CLK_COMMON) += common.o
 obj-$(CONFIG_MVEBU_CLK_CPU)    += clk-cpu.o
+obj-$(CONFIG_MVEBU_CLK_COREDIV)        += clk-corediv.o
 
 obj-$(CONFIG_ARMADA_370_CLK)   += armada-370.o
 obj-$(CONFIG_ARMADA_XP_CLK)    += armada-xp.o
diff --git a/drivers/clk/mvebu/clk-corediv.c b/drivers/clk/mvebu/clk-corediv.c
new file mode 100644 (file)
index 0000000..7162615
--- /dev/null
@@ -0,0 +1,223 @@
+/*
+ * MVEBU Core divider clock
+ *
+ * Copyright (C) 2013 Marvell
+ *
+ * Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/clk-provider.h>
+#include <linux/of_address.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include "common.h"
+
+#define CORE_CLK_DIV_RATIO_MASK                0xff
+#define CORE_CLK_DIV_RATIO_RELOAD      BIT(8)
+#define CORE_CLK_DIV_ENABLE_OFFSET     24
+#define CORE_CLK_DIV_RATIO_OFFSET      0x8
+
+struct clk_corediv_desc {
+       unsigned int mask;
+       unsigned int offset;
+       unsigned int fieldbit;
+};
+
+struct clk_corediv {
+       struct clk_hw hw;
+       void __iomem *reg;
+       struct clk_corediv_desc desc;
+       spinlock_t lock;
+};
+
+static struct clk_onecell_data clk_data;
+
+static const struct clk_corediv_desc mvebu_corediv_desc[] __initconst = {
+       { .mask = 0x3f, .offset = 8, .fieldbit = 1 }, /* NAND clock */
+};
+
+#define to_corediv_clk(p) container_of(p, struct clk_corediv, hw)
+
+static int clk_corediv_is_enabled(struct clk_hw *hwclk)
+{
+       struct clk_corediv *corediv = to_corediv_clk(hwclk);
+       struct clk_corediv_desc *desc = &corediv->desc;
+       u32 enable_mask = BIT(desc->fieldbit) << CORE_CLK_DIV_ENABLE_OFFSET;
+
+       return !!(readl(corediv->reg) & enable_mask);
+}
+
+static int clk_corediv_enable(struct clk_hw *hwclk)
+{
+       struct clk_corediv *corediv = to_corediv_clk(hwclk);
+       struct clk_corediv_desc *desc = &corediv->desc;
+       unsigned long flags = 0;
+       u32 reg;
+
+       spin_lock_irqsave(&corediv->lock, flags);
+
+       reg = readl(corediv->reg);
+       reg |= (BIT(desc->fieldbit) << CORE_CLK_DIV_ENABLE_OFFSET);
+       writel(reg, corediv->reg);
+
+       spin_unlock_irqrestore(&corediv->lock, flags);
+
+       return 0;
+}
+
+static void clk_corediv_disable(struct clk_hw *hwclk)
+{
+       struct clk_corediv *corediv = to_corediv_clk(hwclk);
+       struct clk_corediv_desc *desc = &corediv->desc;
+       unsigned long flags = 0;
+       u32 reg;
+
+       spin_lock_irqsave(&corediv->lock, flags);
+
+       reg = readl(corediv->reg);
+       reg &= ~(BIT(desc->fieldbit) << CORE_CLK_DIV_ENABLE_OFFSET);
+       writel(reg, corediv->reg);
+
+       spin_unlock_irqrestore(&corediv->lock, flags);
+}
+
+static unsigned long clk_corediv_recalc_rate(struct clk_hw *hwclk,
+                                        unsigned long parent_rate)
+{
+       struct clk_corediv *corediv = to_corediv_clk(hwclk);
+       struct clk_corediv_desc *desc = &corediv->desc;
+       u32 reg, div;
+
+       reg = readl(corediv->reg + CORE_CLK_DIV_RATIO_OFFSET);
+       div = (reg >> desc->offset) & desc->mask;
+       return parent_rate / div;
+}
+
+static long clk_corediv_round_rate(struct clk_hw *hwclk, unsigned long rate,
+                              unsigned long *parent_rate)
+{
+       /* Valid ratio are 1:4, 1:5, 1:6 and 1:8 */
+       u32 div;
+
+       div = *parent_rate / rate;
+       if (div < 4)
+               div = 4;
+       else if (div > 6)
+               div = 8;
+
+       return *parent_rate / div;
+}
+
+static int clk_corediv_set_rate(struct clk_hw *hwclk, unsigned long rate,
+                           unsigned long parent_rate)
+{
+       struct clk_corediv *corediv = to_corediv_clk(hwclk);
+       struct clk_corediv_desc *desc = &corediv->desc;
+       unsigned long flags = 0;
+       u32 reg, div;
+
+       div = parent_rate / rate;
+
+       spin_lock_irqsave(&corediv->lock, flags);
+
+       /* Write new divider to the divider ratio register */
+       reg = readl(corediv->reg + CORE_CLK_DIV_RATIO_OFFSET);
+       reg &= ~(desc->mask << desc->offset);
+       reg |= (div & desc->mask) << desc->offset;
+       writel(reg, corediv->reg + CORE_CLK_DIV_RATIO_OFFSET);
+
+       /* Set reload-force for this clock */
+       reg = readl(corediv->reg) | BIT(desc->fieldbit);
+       writel(reg, corediv->reg);
+
+       /* Now trigger the clock update */
+       reg = readl(corediv->reg) | CORE_CLK_DIV_RATIO_RELOAD;
+       writel(reg, corediv->reg);
+
+       /*
+        * Wait for clocks to settle down, and then clear all the
+        * ratios request and the reload request.
+        */
+       udelay(1000);
+       reg &= ~(CORE_CLK_DIV_RATIO_MASK | CORE_CLK_DIV_RATIO_RELOAD);
+       writel(reg, corediv->reg);
+       udelay(1000);
+
+       spin_unlock_irqrestore(&corediv->lock, flags);
+
+       return 0;
+}
+
+static const struct clk_ops corediv_ops = {
+       .enable = clk_corediv_enable,
+       .disable = clk_corediv_disable,
+       .is_enabled = clk_corediv_is_enabled,
+       .recalc_rate = clk_corediv_recalc_rate,
+       .round_rate = clk_corediv_round_rate,
+       .set_rate = clk_corediv_set_rate,
+};
+
+static void __init mvebu_corediv_clk_init(struct device_node *node)
+{
+       struct clk_init_data init;
+       struct clk_corediv *corediv;
+       struct clk **clks;
+       void __iomem *base;
+       const char *parent_name;
+       const char *clk_name;
+       int i;
+
+       base = of_iomap(node, 0);
+       if (WARN_ON(!base))
+               return;
+
+       parent_name = of_clk_get_parent_name(node, 0);
+
+       clk_data.clk_num = ARRAY_SIZE(mvebu_corediv_desc);
+
+       /* clks holds the clock array */
+       clks = kcalloc(clk_data.clk_num, sizeof(struct clk *),
+                               GFP_KERNEL);
+       if (WARN_ON(!clks))
+               goto err_unmap;
+       /* corediv holds the clock specific array */
+       corediv = kcalloc(clk_data.clk_num, sizeof(struct clk_corediv),
+                               GFP_KERNEL);
+       if (WARN_ON(!corediv))
+               goto err_free_clks;
+
+       spin_lock_init(&corediv->lock);
+
+       for (i = 0; i < clk_data.clk_num; i++) {
+               of_property_read_string_index(node, "clock-output-names",
+                                             i, &clk_name);
+               init.num_parents = 1;
+               init.parent_names = &parent_name;
+               init.name = clk_name;
+               init.ops = &corediv_ops;
+               init.flags = 0;
+
+               corediv[i].desc = mvebu_corediv_desc[i];
+               corediv[i].reg = base;
+               corediv[i].hw.init = &init;
+
+               clks[i] = clk_register(NULL, &corediv[i].hw);
+               WARN_ON(IS_ERR(clks[i]));
+       }
+
+       clk_data.clks = clks;
+       of_clk_add_provider(node, of_clk_src_onecell_get, &clk_data);
+       return;
+
+err_free_clks:
+       kfree(clks);
+err_unmap:
+       iounmap(base);
+}
+CLK_OF_DECLARE(mvebu_corediv_clk, "marvell,armada-370-corediv-clock",
+              mvebu_corediv_clk_init);
index 1466865b0743bf2110b74a6832acbef832743b77..8ebf757d29e2d0885791442bfbac5efd586db22b 100644 (file)
@@ -101,7 +101,7 @@ static const struct clk_ops cpu_ops = {
        .set_rate = clk_cpu_set_rate,
 };
 
-void __init of_cpu_clk_setup(struct device_node *node)
+static void __init of_cpu_clk_setup(struct device_node *node)
 {
        struct cpu_clk *cpuclk;
        void __iomem *clock_complex_base = of_iomap(node, 0);
diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig
new file mode 100644 (file)
index 0000000..995bcfa
--- /dev/null
@@ -0,0 +1,47 @@
+config COMMON_CLK_QCOM
+       tristate "Support for Qualcomm's clock controllers"
+       depends on OF
+       select REGMAP_MMIO
+       select RESET_CONTROLLER
+
+config MSM_GCC_8660
+       tristate "MSM8660 Global Clock Controller"
+       depends on COMMON_CLK_QCOM
+       help
+         Support for the global clock controller on msm8660 devices.
+         Say Y if you want to use peripheral devices such as UART, SPI,
+         i2c, USB, SD/eMMC, etc.
+
+config MSM_GCC_8960
+       tristate "MSM8960 Global Clock Controller"
+       depends on COMMON_CLK_QCOM
+       help
+         Support for the global clock controller on msm8960 devices.
+         Say Y if you want to use peripheral devices such as UART, SPI,
+         i2c, USB, SD/eMMC, SATA, PCIe, etc.
+
+config MSM_MMCC_8960
+       tristate "MSM8960 Multimedia Clock Controller"
+       select MSM_GCC_8960
+       depends on COMMON_CLK_QCOM
+       help
+         Support for the multimedia clock controller on msm8960 devices.
+         Say Y if you want to support multimedia devices such as display,
+         graphics, video encode/decode, camera, etc.
+
+config MSM_GCC_8974
+       tristate "MSM8974 Global Clock Controller"
+       depends on COMMON_CLK_QCOM
+       help
+         Support for the global clock controller on msm8974 devices.
+         Say Y if you want to use peripheral devices such as UART, SPI,
+         i2c, USB, SD/eMMC, SATA, PCIe, etc.
+
+config MSM_MMCC_8974
+       tristate "MSM8974 Multimedia Clock Controller"
+       select MSM_GCC_8974
+       depends on COMMON_CLK_QCOM
+       help
+         Support for the multimedia clock controller on msm8974 devices.
+         Say Y if you want to support multimedia devices such as display,
+         graphics, video encode/decode, camera, etc.
diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile
new file mode 100644 (file)
index 0000000..190d384
--- /dev/null
@@ -0,0 +1,14 @@
+obj-$(CONFIG_COMMON_CLK_QCOM) += clk-qcom.o
+
+clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += clk-regmap.o
+clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += clk-pll.o
+clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += clk-rcg.o
+clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += clk-rcg2.o
+clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += clk-branch.o
+clk-qcom-$(CONFIG_COMMON_CLK_QCOM) += reset.o
+
+obj-$(CONFIG_MSM_GCC_8660) += gcc-msm8660.o
+obj-$(CONFIG_MSM_GCC_8960) += gcc-msm8960.o
+obj-$(CONFIG_MSM_GCC_8974) += gcc-msm8974.o
+obj-$(CONFIG_MSM_MMCC_8960) += mmcc-msm8960.o
+obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8974.o
diff --git a/drivers/clk/qcom/clk-branch.c b/drivers/clk/qcom/clk-branch.c
new file mode 100644 (file)
index 0000000..6b4d2bc
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+
+#include "clk-branch.h"
+
+static bool clk_branch_in_hwcg_mode(const struct clk_branch *br)
+{
+       u32 val;
+
+       if (!br->hwcg_reg)
+               return 0;
+
+       regmap_read(br->clkr.regmap, br->hwcg_reg, &val);
+
+       return !!(val & BIT(br->hwcg_bit));
+}
+
+static bool clk_branch_check_halt(const struct clk_branch *br, bool enabling)
+{
+       bool invert = (br->halt_check == BRANCH_HALT_ENABLE);
+       u32 val;
+
+       regmap_read(br->clkr.regmap, br->halt_reg, &val);
+
+       val &= BIT(br->halt_bit);
+       if (invert)
+               val = !val;
+
+       return !!val == !enabling;
+}
+
+#define BRANCH_CLK_OFF                 BIT(31)
+#define BRANCH_NOC_FSM_STATUS_SHIFT    28
+#define BRANCH_NOC_FSM_STATUS_MASK     0x7
+#define BRANCH_NOC_FSM_STATUS_ON       (0x2 << BRANCH_NOC_FSM_STATUS_SHIFT)
+
+static bool clk_branch2_check_halt(const struct clk_branch *br, bool enabling)
+{
+       u32 val;
+       u32 mask;
+
+       mask = BRANCH_NOC_FSM_STATUS_MASK << BRANCH_NOC_FSM_STATUS_SHIFT;
+       mask |= BRANCH_CLK_OFF;
+
+       regmap_read(br->clkr.regmap, br->halt_reg, &val);
+
+       if (enabling) {
+               val &= mask;
+               return (val & BRANCH_CLK_OFF) == 0 ||
+                       val == BRANCH_NOC_FSM_STATUS_ON;
+       } else {
+               return val & BRANCH_CLK_OFF;
+       }
+}
+
+static int clk_branch_wait(const struct clk_branch *br, bool enabling,
+               bool (check_halt)(const struct clk_branch *, bool))
+{
+       bool voted = br->halt_check & BRANCH_VOTED;
+       const char *name = __clk_get_name(br->clkr.hw.clk);
+
+       /* Skip checking halt bit if the clock is in hardware gated mode */
+       if (clk_branch_in_hwcg_mode(br))
+               return 0;
+
+       if (br->halt_check == BRANCH_HALT_DELAY || (!enabling && voted)) {
+               udelay(10);
+       } else if (br->halt_check == BRANCH_HALT_ENABLE ||
+                  br->halt_check == BRANCH_HALT ||
+                  (enabling && voted)) {
+               int count = 200;
+
+               while (count-- > 0) {
+                       if (check_halt(br, enabling))
+                               return 0;
+                       udelay(1);
+               }
+               WARN(1, "%s status stuck at 'o%s'", name,
+                               enabling ? "ff" : "n");
+               return -EBUSY;
+       }
+       return 0;
+}
+
+static int clk_branch_toggle(struct clk_hw *hw, bool en,
+               bool (check_halt)(const struct clk_branch *, bool))
+{
+       struct clk_branch *br = to_clk_branch(hw);
+       int ret;
+
+       if (en) {
+               ret = clk_enable_regmap(hw);
+               if (ret)
+                       return ret;
+       } else {
+               clk_disable_regmap(hw);
+       }
+
+       return clk_branch_wait(br, en, check_halt);
+}
+
+static int clk_branch_enable(struct clk_hw *hw)
+{
+       return clk_branch_toggle(hw, true, clk_branch_check_halt);
+}
+
+static void clk_branch_disable(struct clk_hw *hw)
+{
+       clk_branch_toggle(hw, false, clk_branch_check_halt);
+}
+
+const struct clk_ops clk_branch_ops = {
+       .enable = clk_branch_enable,
+       .disable = clk_branch_disable,
+       .is_enabled = clk_is_enabled_regmap,
+};
+EXPORT_SYMBOL_GPL(clk_branch_ops);
+
+static int clk_branch2_enable(struct clk_hw *hw)
+{
+       return clk_branch_toggle(hw, true, clk_branch2_check_halt);
+}
+
+static void clk_branch2_disable(struct clk_hw *hw)
+{
+       clk_branch_toggle(hw, false, clk_branch2_check_halt);
+}
+
+const struct clk_ops clk_branch2_ops = {
+       .enable = clk_branch2_enable,
+       .disable = clk_branch2_disable,
+       .is_enabled = clk_is_enabled_regmap,
+};
+EXPORT_SYMBOL_GPL(clk_branch2_ops);
+
+const struct clk_ops clk_branch_simple_ops = {
+       .enable = clk_enable_regmap,
+       .disable = clk_disable_regmap,
+       .is_enabled = clk_is_enabled_regmap,
+};
+EXPORT_SYMBOL_GPL(clk_branch_simple_ops);
diff --git a/drivers/clk/qcom/clk-branch.h b/drivers/clk/qcom/clk-branch.h
new file mode 100644 (file)
index 0000000..284df3f
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __QCOM_CLK_BRANCH_H__
+#define __QCOM_CLK_BRANCH_H__
+
+#include <linux/clk-provider.h>
+
+#include "clk-regmap.h"
+
+/**
+ * struct clk_branch - gating clock with status bit and dynamic hardware gating
+ *
+ * @hwcg_reg: dynamic hardware clock gating register
+ * @hwcg_bit: ORed with @hwcg_reg to enable dynamic hardware clock gating
+ * @halt_reg: halt register
+ * @halt_bit: ANDed with @halt_reg to test for clock halted
+ * @halt_check: type of halt checking to perform
+ * @clkr: handle between common and hardware-specific interfaces
+ *
+ * Clock which can gate its output.
+ */
+struct clk_branch {
+       u32     hwcg_reg;
+       u32     halt_reg;
+       u8      hwcg_bit;
+       u8      halt_bit;
+       u8      halt_check;
+#define BRANCH_VOTED                   BIT(7) /* Delay on disable */
+#define BRANCH_HALT                    0 /* pol: 1 = halt */
+#define BRANCH_HALT_VOTED              (BRANCH_HALT | BRANCH_VOTED)
+#define BRANCH_HALT_ENABLE             1 /* pol: 0 = halt */
+#define BRANCH_HALT_ENABLE_VOTED       (BRANCH_HALT_ENABLE | BRANCH_VOTED)
+#define BRANCH_HALT_DELAY              2 /* No bit to check; just delay */
+
+       struct clk_regmap clkr;
+};
+
+extern const struct clk_ops clk_branch_ops;
+extern const struct clk_ops clk_branch2_ops;
+extern const struct clk_ops clk_branch_simple_ops;
+
+#define to_clk_branch(_hw) \
+       container_of(to_clk_regmap(_hw), struct clk_branch, clkr)
+
+#endif
diff --git a/drivers/clk/qcom/clk-pll.c b/drivers/clk/qcom/clk-pll.c
new file mode 100644 (file)
index 0000000..0f927c5
--- /dev/null
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+
+#include <asm/div64.h>
+
+#include "clk-pll.h"
+
+#define PLL_OUTCTRL            BIT(0)
+#define PLL_BYPASSNL           BIT(1)
+#define PLL_RESET_N            BIT(2)
+#define PLL_LOCK_COUNT_SHIFT   8
+#define PLL_LOCK_COUNT_MASK    0x3f
+#define PLL_BIAS_COUNT_SHIFT   14
+#define PLL_BIAS_COUNT_MASK    0x3f
+#define PLL_VOTE_FSM_ENA       BIT(20)
+#define PLL_VOTE_FSM_RESET     BIT(21)
+
+static int clk_pll_enable(struct clk_hw *hw)
+{
+       struct clk_pll *pll = to_clk_pll(hw);
+       int ret;
+       u32 mask, val;
+
+       mask = PLL_OUTCTRL | PLL_RESET_N | PLL_BYPASSNL;
+       ret = regmap_read(pll->clkr.regmap, pll->mode_reg, &val);
+       if (ret)
+               return ret;
+
+       /* Skip if already enabled or in FSM mode */
+       if ((val & mask) == mask || val & PLL_VOTE_FSM_ENA)
+               return 0;
+
+       /* Disable PLL bypass mode. */
+       ret = regmap_update_bits(pll->clkr.regmap, pll->mode_reg, PLL_BYPASSNL,
+                                PLL_BYPASSNL);
+       if (ret)
+               return ret;
+
+       /*
+        * H/W requires a 5us delay between disabling the bypass and
+        * de-asserting the reset. Delay 10us just to be safe.
+        */
+       udelay(10);
+
+       /* De-assert active-low PLL reset. */
+       ret = regmap_update_bits(pll->clkr.regmap, pll->mode_reg, PLL_RESET_N,
+                                PLL_RESET_N);
+       if (ret)
+               return ret;
+
+       /* Wait until PLL is locked. */
+       udelay(50);
+
+       /* Enable PLL output. */
+       ret = regmap_update_bits(pll->clkr.regmap, pll->mode_reg, PLL_OUTCTRL,
+                                PLL_OUTCTRL);
+       if (ret)
+               return ret;
+
+       return 0;
+}
+
+static void clk_pll_disable(struct clk_hw *hw)
+{
+       struct clk_pll *pll = to_clk_pll(hw);
+       u32 mask;
+       u32 val;
+
+       regmap_read(pll->clkr.regmap, pll->mode_reg, &val);
+       /* Skip if in FSM mode */
+       if (val & PLL_VOTE_FSM_ENA)
+               return;
+       mask = PLL_OUTCTRL | PLL_RESET_N | PLL_BYPASSNL;
+       regmap_update_bits(pll->clkr.regmap, pll->mode_reg, mask, 0);
+}
+
+static unsigned long
+clk_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
+{
+       struct clk_pll *pll = to_clk_pll(hw);
+       u32 l, m, n;
+       unsigned long rate;
+       u64 tmp;
+
+       regmap_read(pll->clkr.regmap, pll->l_reg, &l);
+       regmap_read(pll->clkr.regmap, pll->m_reg, &m);
+       regmap_read(pll->clkr.regmap, pll->n_reg, &n);
+
+       l &= 0x3ff;
+       m &= 0x7ffff;
+       n &= 0x7ffff;
+
+       rate = parent_rate * l;
+       if (n) {
+               tmp = parent_rate;
+               tmp *= m;
+               do_div(tmp, n);
+               rate += tmp;
+       }
+       return rate;
+}
+
+const struct clk_ops clk_pll_ops = {
+       .enable = clk_pll_enable,
+       .disable = clk_pll_disable,
+       .recalc_rate = clk_pll_recalc_rate,
+};
+EXPORT_SYMBOL_GPL(clk_pll_ops);
+
+static int wait_for_pll(struct clk_pll *pll)
+{
+       u32 val;
+       int count;
+       int ret;
+       const char *name = __clk_get_name(pll->clkr.hw.clk);
+
+       /* Wait for pll to enable. */
+       for (count = 200; count > 0; count--) {
+               ret = regmap_read(pll->clkr.regmap, pll->status_reg, &val);
+               if (ret)
+                       return ret;
+               if (val & BIT(pll->status_bit))
+                       return 0;
+               udelay(1);
+       }
+
+       WARN(1, "%s didn't enable after voting for it!\n", name);
+       return -ETIMEDOUT;
+}
+
+static int clk_pll_vote_enable(struct clk_hw *hw)
+{
+       int ret;
+       struct clk_pll *p = to_clk_pll(__clk_get_hw(__clk_get_parent(hw->clk)));
+
+       ret = clk_enable_regmap(hw);
+       if (ret)
+               return ret;
+
+       return wait_for_pll(p);
+}
+
+const struct clk_ops clk_pll_vote_ops = {
+       .enable = clk_pll_vote_enable,
+       .disable = clk_disable_regmap,
+};
+EXPORT_SYMBOL_GPL(clk_pll_vote_ops);
+
+static void
+clk_pll_set_fsm_mode(struct clk_pll *pll, struct regmap *regmap)
+{
+       u32 val;
+       u32 mask;
+
+       /* De-assert reset to FSM */
+       regmap_update_bits(regmap, pll->mode_reg, PLL_VOTE_FSM_RESET, 0);
+
+       /* Program bias count and lock count */
+       val = 1 << PLL_BIAS_COUNT_SHIFT;
+       mask = PLL_BIAS_COUNT_MASK << PLL_BIAS_COUNT_SHIFT;
+       mask |= PLL_LOCK_COUNT_MASK << PLL_LOCK_COUNT_SHIFT;
+       regmap_update_bits(regmap, pll->mode_reg, mask, val);
+
+       /* Enable PLL FSM voting */
+       regmap_update_bits(regmap, pll->mode_reg, PLL_VOTE_FSM_ENA,
+               PLL_VOTE_FSM_ENA);
+}
+
+static void clk_pll_configure(struct clk_pll *pll, struct regmap *regmap,
+       const struct pll_config *config)
+{
+       u32 val;
+       u32 mask;
+
+       regmap_write(regmap, pll->l_reg, config->l);
+       regmap_write(regmap, pll->m_reg, config->m);
+       regmap_write(regmap, pll->n_reg, config->n);
+
+       val = config->vco_val;
+       val |= config->pre_div_val;
+       val |= config->post_div_val;
+       val |= config->mn_ena_mask;
+       val |= config->main_output_mask;
+       val |= config->aux_output_mask;
+
+       mask = config->vco_mask;
+       mask |= config->pre_div_mask;
+       mask |= config->post_div_mask;
+       mask |= config->mn_ena_mask;
+       mask |= config->main_output_mask;
+       mask |= config->aux_output_mask;
+
+       regmap_update_bits(regmap, pll->config_reg, mask, val);
+}
+
+void clk_pll_configure_sr_hpm_lp(struct clk_pll *pll, struct regmap *regmap,
+               const struct pll_config *config, bool fsm_mode)
+{
+       clk_pll_configure(pll, regmap, config);
+       if (fsm_mode)
+               clk_pll_set_fsm_mode(pll, regmap);
+}
+EXPORT_SYMBOL_GPL(clk_pll_configure_sr_hpm_lp);
diff --git a/drivers/clk/qcom/clk-pll.h b/drivers/clk/qcom/clk-pll.h
new file mode 100644 (file)
index 0000000..0775a99
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __QCOM_CLK_PLL_H__
+#define __QCOM_CLK_PLL_H__
+
+#include <linux/clk-provider.h>
+#include "clk-regmap.h"
+
+/**
+ * struct clk_pll - phase locked loop (PLL)
+ * @l_reg: L register
+ * @m_reg: M register
+ * @n_reg: N register
+ * @config_reg: config register
+ * @mode_reg: mode register
+ * @status_reg: status register
+ * @status_bit: ANDed with @status_reg to determine if PLL is enabled
+ * @hw: handle between common and hardware-specific interfaces
+ */
+struct clk_pll {
+       u32     l_reg;
+       u32     m_reg;
+       u32     n_reg;
+       u32     config_reg;
+       u32     mode_reg;
+       u32     status_reg;
+       u8      status_bit;
+
+       struct clk_regmap clkr;
+};
+
+extern const struct clk_ops clk_pll_ops;
+extern const struct clk_ops clk_pll_vote_ops;
+
+#define to_clk_pll(_hw) container_of(to_clk_regmap(_hw), struct clk_pll, clkr)
+
+struct pll_config {
+       u16 l;
+       u32 m;
+       u32 n;
+       u32 vco_val;
+       u32 vco_mask;
+       u32 pre_div_val;
+       u32 pre_div_mask;
+       u32 post_div_val;
+       u32 post_div_mask;
+       u32 mn_ena_mask;
+       u32 main_output_mask;
+       u32 aux_output_mask;
+};
+
+void clk_pll_configure_sr_hpm_lp(struct clk_pll *pll, struct regmap *regmap,
+               const struct pll_config *config, bool fsm_mode);
+
+#endif
diff --git a/drivers/clk/qcom/clk-rcg.c b/drivers/clk/qcom/clk-rcg.c
new file mode 100644 (file)
index 0000000..abfc2b6
--- /dev/null
@@ -0,0 +1,517 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/export.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+
+#include <asm/div64.h>
+
+#include "clk-rcg.h"
+
+static u32 ns_to_src(struct src_sel *s, u32 ns)
+{
+       ns >>= s->src_sel_shift;
+       ns &= SRC_SEL_MASK;
+       return ns;
+}
+
+static u32 src_to_ns(struct src_sel *s, u8 src, u32 ns)
+{
+       u32 mask;
+
+       mask = SRC_SEL_MASK;
+       mask <<= s->src_sel_shift;
+       ns &= ~mask;
+
+       ns |= src << s->src_sel_shift;
+       return ns;
+}
+
+static u8 clk_rcg_get_parent(struct clk_hw *hw)
+{
+       struct clk_rcg *rcg = to_clk_rcg(hw);
+       int num_parents = __clk_get_num_parents(hw->clk);
+       u32 ns;
+       int i;
+
+       regmap_read(rcg->clkr.regmap, rcg->ns_reg, &ns);
+       ns = ns_to_src(&rcg->s, ns);
+       for (i = 0; i < num_parents; i++)
+               if (ns == rcg->s.parent_map[i])
+                       return i;
+
+       return -EINVAL;
+}
+
+static int reg_to_bank(struct clk_dyn_rcg *rcg, u32 bank)
+{
+       bank &= BIT(rcg->mux_sel_bit);
+       return !!bank;
+}
+
+static u8 clk_dyn_rcg_get_parent(struct clk_hw *hw)
+{
+       struct clk_dyn_rcg *rcg = to_clk_dyn_rcg(hw);
+       int num_parents = __clk_get_num_parents(hw->clk);
+       u32 ns, ctl;
+       int bank;
+       int i;
+       struct src_sel *s;
+
+       regmap_read(rcg->clkr.regmap, rcg->clkr.enable_reg, &ctl);
+       bank = reg_to_bank(rcg, ctl);
+       s = &rcg->s[bank];
+
+       regmap_read(rcg->clkr.regmap, rcg->ns_reg, &ns);
+       ns = ns_to_src(s, ns);
+
+       for (i = 0; i < num_parents; i++)
+               if (ns == s->parent_map[i])
+                       return i;
+
+       return -EINVAL;
+}
+
+static int clk_rcg_set_parent(struct clk_hw *hw, u8 index)
+{
+       struct clk_rcg *rcg = to_clk_rcg(hw);
+       u32 ns;
+
+       regmap_read(rcg->clkr.regmap, rcg->ns_reg, &ns);
+       ns = src_to_ns(&rcg->s, rcg->s.parent_map[index], ns);
+       regmap_write(rcg->clkr.regmap, rcg->ns_reg, ns);
+
+       return 0;
+}
+
+static u32 md_to_m(struct mn *mn, u32 md)
+{
+       md >>= mn->m_val_shift;
+       md &= BIT(mn->width) - 1;
+       return md;
+}
+
+static u32 ns_to_pre_div(struct pre_div *p, u32 ns)
+{
+       ns >>= p->pre_div_shift;
+       ns &= BIT(p->pre_div_width) - 1;
+       return ns;
+}
+
+static u32 pre_div_to_ns(struct pre_div *p, u8 pre_div, u32 ns)
+{
+       u32 mask;
+
+       mask = BIT(p->pre_div_width) - 1;
+       mask <<= p->pre_div_shift;
+       ns &= ~mask;
+
+       ns |= pre_div << p->pre_div_shift;
+       return ns;
+}
+
+static u32 mn_to_md(struct mn *mn, u32 m, u32 n, u32 md)
+{
+       u32 mask, mask_w;
+
+       mask_w = BIT(mn->width) - 1;
+       mask = (mask_w << mn->m_val_shift) | mask_w;
+       md &= ~mask;
+
+       if (n) {
+               m <<= mn->m_val_shift;
+               md |= m;
+               md |= ~n & mask_w;
+       }
+
+       return md;
+}
+
+static u32 ns_m_to_n(struct mn *mn, u32 ns, u32 m)
+{
+       ns = ~ns >> mn->n_val_shift;
+       ns &= BIT(mn->width) - 1;
+       return ns + m;
+}
+
+static u32 reg_to_mnctr_mode(struct mn *mn, u32 val)
+{
+       val >>= mn->mnctr_mode_shift;
+       val &= MNCTR_MODE_MASK;
+       return val;
+}
+
+static u32 mn_to_ns(struct mn *mn, u32 m, u32 n, u32 ns)
+{
+       u32 mask;
+
+       mask = BIT(mn->width) - 1;
+       mask <<= mn->n_val_shift;
+       ns &= ~mask;
+
+       if (n) {
+               n = n - m;
+               n = ~n;
+               n &= BIT(mn->width) - 1;
+               n <<= mn->n_val_shift;
+               ns |= n;
+       }
+
+       return ns;
+}
+
+static u32 mn_to_reg(struct mn *mn, u32 m, u32 n, u32 val)
+{
+       u32 mask;
+
+       mask = MNCTR_MODE_MASK << mn->mnctr_mode_shift;
+       mask |= BIT(mn->mnctr_en_bit);
+       val &= ~mask;
+
+       if (n) {
+               val |= BIT(mn->mnctr_en_bit);
+               val |= MNCTR_MODE_DUAL << mn->mnctr_mode_shift;
+       }
+
+       return val;
+}
+
+static void configure_bank(struct clk_dyn_rcg *rcg, const struct freq_tbl *f)
+{
+       u32 ns, md, ctl, *regp;
+       int bank, new_bank;
+       struct mn *mn;
+       struct pre_div *p;
+       struct src_sel *s;
+       bool enabled;
+       u32 md_reg;
+       u32 bank_reg;
+       bool banked_mn = !!rcg->mn[1].width;
+       struct clk_hw *hw = &rcg->clkr.hw;
+
+       enabled = __clk_is_enabled(hw->clk);
+
+       regmap_read(rcg->clkr.regmap, rcg->ns_reg, &ns);
+       regmap_read(rcg->clkr.regmap, rcg->clkr.enable_reg, &ctl);
+
+       if (banked_mn) {
+               regp = &ctl;
+               bank_reg = rcg->clkr.enable_reg;
+       } else {
+               regp = &ns;
+               bank_reg = rcg->ns_reg;
+       }
+
+       bank = reg_to_bank(rcg, *regp);
+       new_bank = enabled ? !bank : bank;
+
+       if (banked_mn) {
+               mn = &rcg->mn[new_bank];
+               md_reg = rcg->md_reg[new_bank];
+
+               ns |= BIT(mn->mnctr_reset_bit);
+               regmap_write(rcg->clkr.regmap, rcg->ns_reg, ns);
+
+               regmap_read(rcg->clkr.regmap, md_reg, &md);
+               md = mn_to_md(mn, f->m, f->n, md);
+               regmap_write(rcg->clkr.regmap, md_reg, md);
+
+               ns = mn_to_ns(mn, f->m, f->n, ns);
+               regmap_write(rcg->clkr.regmap, rcg->ns_reg, ns);
+
+               ctl = mn_to_reg(mn, f->m, f->n, ctl);
+               regmap_write(rcg->clkr.regmap, rcg->clkr.enable_reg, ctl);
+
+               ns &= ~BIT(mn->mnctr_reset_bit);
+               regmap_write(rcg->clkr.regmap, rcg->ns_reg, ns);
+       } else {
+               p = &rcg->p[new_bank];
+               ns = pre_div_to_ns(p, f->pre_div - 1, ns);
+       }
+
+       s = &rcg->s[new_bank];
+       ns = src_to_ns(s, s->parent_map[f->src], ns);
+       regmap_write(rcg->clkr.regmap, rcg->ns_reg, ns);
+
+       if (enabled) {
+               *regp ^= BIT(rcg->mux_sel_bit);
+               regmap_write(rcg->clkr.regmap, bank_reg, *regp);
+       }
+}
+
+static int clk_dyn_rcg_set_parent(struct clk_hw *hw, u8 index)
+{
+       struct clk_dyn_rcg *rcg = to_clk_dyn_rcg(hw);
+       u32 ns, ctl, md, reg;
+       int bank;
+       struct freq_tbl f = { 0 };
+       bool banked_mn = !!rcg->mn[1].width;
+
+       regmap_read(rcg->clkr.regmap, rcg->ns_reg, &ns);
+       regmap_read(rcg->clkr.regmap, rcg->clkr.enable_reg, &ctl);
+       reg = banked_mn ? ctl : ns;
+
+       bank = reg_to_bank(rcg, reg);
+
+       if (banked_mn) {
+               regmap_read(rcg->clkr.regmap, rcg->md_reg[bank], &md);
+               f.m = md_to_m(&rcg->mn[bank], md);
+               f.n = ns_m_to_n(&rcg->mn[bank], ns, f.m);
+       } else {
+               f.pre_div = ns_to_pre_div(&rcg->p[bank], ns) + 1;
+       }
+       f.src = index;
+
+       configure_bank(rcg, &f);
+
+       return 0;
+}
+
+/*
+ * Calculate m/n:d rate
+ *
+ *          parent_rate     m
+ *   rate = ----------- x  ---
+ *            pre_div       n
+ */
+static unsigned long
+calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 pre_div)
+{
+       if (pre_div)
+               rate /= pre_div + 1;
+
+       if (mode) {
+               u64 tmp = rate;
+               tmp *= m;
+               do_div(tmp, n);
+               rate = tmp;
+       }
+
+       return rate;
+}
+
+static unsigned long
+clk_rcg_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
+{
+       struct clk_rcg *rcg = to_clk_rcg(hw);
+       u32 pre_div, m = 0, n = 0, ns, md, mode = 0;
+       struct mn *mn = &rcg->mn;
+
+       regmap_read(rcg->clkr.regmap, rcg->ns_reg, &ns);
+       pre_div = ns_to_pre_div(&rcg->p, ns);
+
+       if (rcg->mn.width) {
+               regmap_read(rcg->clkr.regmap, rcg->md_reg, &md);
+               m = md_to_m(mn, md);
+               n = ns_m_to_n(mn, ns, m);
+               /* MN counter mode is in hw.enable_reg sometimes */
+               if (rcg->clkr.enable_reg != rcg->ns_reg)
+                       regmap_read(rcg->clkr.regmap, rcg->clkr.enable_reg, &mode);
+               else
+                       mode = ns;
+               mode = reg_to_mnctr_mode(mn, mode);
+       }
+
+       return calc_rate(parent_rate, m, n, mode, pre_div);
+}
+
+static unsigned long
+clk_dyn_rcg_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
+{
+       struct clk_dyn_rcg *rcg = to_clk_dyn_rcg(hw);
+       u32 m, n, pre_div, ns, md, mode, reg;
+       int bank;
+       struct mn *mn;
+       bool banked_mn = !!rcg->mn[1].width;
+
+       regmap_read(rcg->clkr.regmap, rcg->ns_reg, &ns);
+
+       if (banked_mn)
+               regmap_read(rcg->clkr.regmap, rcg->clkr.enable_reg, &reg);
+       else
+               reg = ns;
+
+       bank = reg_to_bank(rcg, reg);
+
+       if (banked_mn) {
+               mn = &rcg->mn[bank];
+               regmap_read(rcg->clkr.regmap, rcg->md_reg[bank], &md);
+               m = md_to_m(mn, md);
+               n = ns_m_to_n(mn, ns, m);
+               mode = reg_to_mnctr_mode(mn, reg);
+               return calc_rate(parent_rate, m, n, mode, 0);
+       } else {
+               pre_div = ns_to_pre_div(&rcg->p[bank], ns);
+               return calc_rate(parent_rate, 0, 0, 0, pre_div);
+       }
+}
+
+static const
+struct freq_tbl *find_freq(const struct freq_tbl *f, unsigned long rate)
+{
+       if (!f)
+               return NULL;
+
+       for (; f->freq; f++)
+               if (rate <= f->freq)
+                       return f;
+
+       return NULL;
+}
+
+static long _freq_tbl_determine_rate(struct clk_hw *hw,
+               const struct freq_tbl *f, unsigned long rate,
+               unsigned long *p_rate, struct clk **p)
+{
+       unsigned long clk_flags;
+
+       f = find_freq(f, rate);
+       if (!f)
+               return -EINVAL;
+
+       clk_flags = __clk_get_flags(hw->clk);
+       *p = clk_get_parent_by_index(hw->clk, f->src);
+       if (clk_flags & CLK_SET_RATE_PARENT) {
+               rate = rate * f->pre_div;
+               if (f->n) {
+                       u64 tmp = rate;
+                       tmp = tmp * f->n;
+                       do_div(tmp, f->m);
+                       rate = tmp;
+               }
+       } else {
+               rate =  __clk_get_rate(*p);
+       }
+       *p_rate = rate;
+
+       return f->freq;
+}
+
+static long clk_rcg_determine_rate(struct clk_hw *hw, unsigned long rate,
+               unsigned long *p_rate, struct clk **p)
+{
+       struct clk_rcg *rcg = to_clk_rcg(hw);
+
+       return _freq_tbl_determine_rate(hw, rcg->freq_tbl, rate, p_rate, p);
+}
+
+static long clk_dyn_rcg_determine_rate(struct clk_hw *hw, unsigned long rate,
+               unsigned long *p_rate, struct clk **p)
+{
+       struct clk_dyn_rcg *rcg = to_clk_dyn_rcg(hw);
+
+       return _freq_tbl_determine_rate(hw, rcg->freq_tbl, rate, p_rate, p);
+}
+
+static int clk_rcg_set_rate(struct clk_hw *hw, unsigned long rate,
+                           unsigned long parent_rate)
+{
+       struct clk_rcg *rcg = to_clk_rcg(hw);
+       const struct freq_tbl *f;
+       u32 ns, md, ctl;
+       struct mn *mn = &rcg->mn;
+       u32 mask = 0;
+       unsigned int reset_reg;
+
+       f = find_freq(rcg->freq_tbl, rate);
+       if (!f)
+               return -EINVAL;
+
+       if (rcg->mn.reset_in_cc)
+               reset_reg = rcg->clkr.enable_reg;
+       else
+               reset_reg = rcg->ns_reg;
+
+       if (rcg->mn.width) {
+               mask = BIT(mn->mnctr_reset_bit);
+               regmap_update_bits(rcg->clkr.regmap, reset_reg, mask, mask);
+
+               regmap_read(rcg->clkr.regmap, rcg->md_reg, &md);
+               md = mn_to_md(mn, f->m, f->n, md);
+               regmap_write(rcg->clkr.regmap, rcg->md_reg, md);
+
+               regmap_read(rcg->clkr.regmap, rcg->ns_reg, &ns);
+               /* MN counter mode is in hw.enable_reg sometimes */
+               if (rcg->clkr.enable_reg != rcg->ns_reg) {
+                       regmap_read(rcg->clkr.regmap, rcg->clkr.enable_reg, &ctl);
+                       ctl = mn_to_reg(mn, f->m, f->n, ctl);
+                       regmap_write(rcg->clkr.regmap, rcg->clkr.enable_reg, ctl);
+               } else {
+                       ns = mn_to_reg(mn, f->m, f->n, ns);
+               }
+               ns = mn_to_ns(mn, f->m, f->n, ns);
+       } else {
+               regmap_read(rcg->clkr.regmap, rcg->ns_reg, &ns);
+       }
+
+       ns = pre_div_to_ns(&rcg->p, f->pre_div - 1, ns);
+       regmap_write(rcg->clkr.regmap, rcg->ns_reg, ns);
+
+       regmap_update_bits(rcg->clkr.regmap, reset_reg, mask, 0);
+
+       return 0;
+}
+
+static int __clk_dyn_rcg_set_rate(struct clk_hw *hw, unsigned long rate)
+{
+       struct clk_dyn_rcg *rcg = to_clk_dyn_rcg(hw);
+       const struct freq_tbl *f;
+
+       f = find_freq(rcg->freq_tbl, rate);
+       if (!f)
+               return -EINVAL;
+
+       configure_bank(rcg, f);
+
+       return 0;
+}
+
+static int clk_dyn_rcg_set_rate(struct clk_hw *hw, unsigned long rate,
+                           unsigned long parent_rate)
+{
+       return __clk_dyn_rcg_set_rate(hw, rate);
+}
+
+static int clk_dyn_rcg_set_rate_and_parent(struct clk_hw *hw,
+               unsigned long rate, unsigned long parent_rate, u8 index)
+{
+       return __clk_dyn_rcg_set_rate(hw, rate);
+}
+
+const struct clk_ops clk_rcg_ops = {
+       .enable = clk_enable_regmap,
+       .disable = clk_disable_regmap,
+       .get_parent = clk_rcg_get_parent,
+       .set_parent = clk_rcg_set_parent,
+       .recalc_rate = clk_rcg_recalc_rate,
+       .determine_rate = clk_rcg_determine_rate,
+       .set_rate = clk_rcg_set_rate,
+};
+EXPORT_SYMBOL_GPL(clk_rcg_ops);
+
+const struct clk_ops clk_dyn_rcg_ops = {
+       .enable = clk_enable_regmap,
+       .is_enabled = clk_is_enabled_regmap,
+       .disable = clk_disable_regmap,
+       .get_parent = clk_dyn_rcg_get_parent,
+       .set_parent = clk_dyn_rcg_set_parent,
+       .recalc_rate = clk_dyn_rcg_recalc_rate,
+       .determine_rate = clk_dyn_rcg_determine_rate,
+       .set_rate = clk_dyn_rcg_set_rate,
+       .set_rate_and_parent = clk_dyn_rcg_set_rate_and_parent,
+};
+EXPORT_SYMBOL_GPL(clk_dyn_rcg_ops);
diff --git a/drivers/clk/qcom/clk-rcg.h b/drivers/clk/qcom/clk-rcg.h
new file mode 100644 (file)
index 0000000..1d6b6de
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __QCOM_CLK_RCG_H__
+#define __QCOM_CLK_RCG_H__
+
+#include <linux/clk-provider.h>
+#include "clk-regmap.h"
+
+struct freq_tbl {
+       unsigned long freq;
+       u8 src;
+       u8 pre_div;
+       u16 m;
+       u16 n;
+};
+
+/**
+ * struct mn - M/N:D counter
+ * @mnctr_en_bit: bit to enable mn counter
+ * @mnctr_reset_bit: bit to assert mn counter reset
+ * @mnctr_mode_shift: lowest bit of mn counter mode field
+ * @n_val_shift: lowest bit of n value field
+ * @m_val_shift: lowest bit of m value field
+ * @width: number of bits in m/n/d values
+ * @reset_in_cc: true if the mnctr_reset_bit is in the CC register
+ */
+struct mn {
+       u8              mnctr_en_bit;
+       u8              mnctr_reset_bit;
+       u8              mnctr_mode_shift;
+#define MNCTR_MODE_DUAL 0x2
+#define MNCTR_MODE_MASK 0x3
+       u8              n_val_shift;
+       u8              m_val_shift;
+       u8              width;
+       bool            reset_in_cc;
+};
+
+/**
+ * struct pre_div - pre-divider
+ * @pre_div_shift: lowest bit of pre divider field
+ * @pre_div_width: number of bits in predivider
+ */
+struct pre_div {
+       u8              pre_div_shift;
+       u8              pre_div_width;
+};
+
+/**
+ * struct src_sel - source selector
+ * @src_sel_shift: lowest bit of source selection field
+ * @parent_map: map from software's parent index to hardware's src_sel field
+ */
+struct src_sel {
+       u8              src_sel_shift;
+#define SRC_SEL_MASK   0x7
+       const u8        *parent_map;
+};
+
+/**
+ * struct clk_rcg - root clock generator
+ *
+ * @ns_reg: NS register
+ * @md_reg: MD register
+ * @mn: mn counter
+ * @p: pre divider
+ * @s: source selector
+ * @freq_tbl: frequency table
+ * @clkr: regmap clock handle
+ * @lock: register lock
+ *
+ */
+struct clk_rcg {
+       u32             ns_reg;
+       u32             md_reg;
+
+       struct mn       mn;
+       struct pre_div  p;
+       struct src_sel  s;
+
+       const struct freq_tbl   *freq_tbl;
+
+       struct clk_regmap       clkr;
+};
+
+extern const struct clk_ops clk_rcg_ops;
+
+#define to_clk_rcg(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg, clkr)
+
+/**
+ * struct clk_dyn_rcg - root clock generator with glitch free mux
+ *
+ * @mux_sel_bit: bit to switch glitch free mux
+ * @ns_reg: NS register
+ * @md_reg: MD0 and MD1 register
+ * @mn: mn counter (banked)
+ * @s: source selector (banked)
+ * @freq_tbl: frequency table
+ * @clkr: regmap clock handle
+ * @lock: register lock
+ *
+ */
+struct clk_dyn_rcg {
+       u32     ns_reg;
+       u32     md_reg[2];
+
+       u8      mux_sel_bit;
+
+       struct mn       mn[2];
+       struct pre_div  p[2];
+       struct src_sel  s[2];
+
+       const struct freq_tbl *freq_tbl;
+
+       struct clk_regmap clkr;
+};
+
+extern const struct clk_ops clk_dyn_rcg_ops;
+
+#define to_clk_dyn_rcg(_hw) \
+       container_of(to_clk_regmap(_hw), struct clk_dyn_rcg, clkr)
+
+/**
+ * struct clk_rcg2 - root clock generator
+ *
+ * @cmd_rcgr: corresponds to *_CMD_RCGR
+ * @mnd_width: number of bits in m/n/d values
+ * @hid_width: number of bits in half integer divider
+ * @parent_map: map from software's parent index to hardware's src_sel field
+ * @freq_tbl: frequency table
+ * @clkr: regmap clock handle
+ * @lock: register lock
+ *
+ */
+struct clk_rcg2 {
+       u32                     cmd_rcgr;
+       u8                      mnd_width;
+       u8                      hid_width;
+       const u8                *parent_map;
+       const struct freq_tbl   *freq_tbl;
+       struct clk_regmap       clkr;
+};
+
+#define to_clk_rcg2(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg2, clkr)
+
+extern const struct clk_ops clk_rcg2_ops;
+
+#endif
diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
new file mode 100644 (file)
index 0000000..00f878a
--- /dev/null
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/bug.h>
+#include <linux/export.h>
+#include <linux/clk-provider.h>
+#include <linux/delay.h>
+#include <linux/regmap.h>
+
+#include <asm/div64.h>
+
+#include "clk-rcg.h"
+
+#define CMD_REG                        0x0
+#define CMD_UPDATE             BIT(0)
+#define CMD_ROOT_EN            BIT(1)
+#define CMD_DIRTY_CFG          BIT(4)
+#define CMD_DIRTY_N            BIT(5)
+#define CMD_DIRTY_M            BIT(6)
+#define CMD_DIRTY_D            BIT(7)
+#define CMD_ROOT_OFF           BIT(31)
+
+#define CFG_REG                        0x4
+#define CFG_SRC_DIV_SHIFT      0
+#define CFG_SRC_SEL_SHIFT      8
+#define CFG_SRC_SEL_MASK       (0x7 << CFG_SRC_SEL_SHIFT)
+#define CFG_MODE_SHIFT         12
+#define CFG_MODE_MASK          (0x3 << CFG_MODE_SHIFT)
+#define CFG_MODE_DUAL_EDGE     (0x2 << CFG_MODE_SHIFT)
+
+#define M_REG                  0x8
+#define N_REG                  0xc
+#define D_REG                  0x10
+
+static int clk_rcg2_is_enabled(struct clk_hw *hw)
+{
+       struct clk_rcg2 *rcg = to_clk_rcg2(hw);
+       u32 cmd;
+       int ret;
+
+       ret = regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CMD_REG, &cmd);
+       if (ret)
+               return ret;
+
+       return (cmd & CMD_ROOT_OFF) != 0;
+}
+
+static u8 clk_rcg2_get_parent(struct clk_hw *hw)
+{
+       struct clk_rcg2 *rcg = to_clk_rcg2(hw);
+       int num_parents = __clk_get_num_parents(hw->clk);
+       u32 cfg;
+       int i, ret;
+
+       ret = regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &cfg);
+       if (ret)
+               return ret;
+
+       cfg &= CFG_SRC_SEL_MASK;
+       cfg >>= CFG_SRC_SEL_SHIFT;
+
+       for (i = 0; i < num_parents; i++)
+               if (cfg == rcg->parent_map[i])
+                       return i;
+
+       return -EINVAL;
+}
+
+static int update_config(struct clk_rcg2 *rcg)
+{
+       int count, ret;
+       u32 cmd;
+       struct clk_hw *hw = &rcg->clkr.hw;
+       const char *name = __clk_get_name(hw->clk);
+
+       ret = regmap_update_bits(rcg->clkr.regmap, rcg->cmd_rcgr + CMD_REG,
+                                CMD_UPDATE, CMD_UPDATE);
+       if (ret)
+               return ret;
+
+       /* Wait for update to take effect */
+       for (count = 500; count > 0; count--) {
+               ret = regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CMD_REG, &cmd);
+               if (ret)
+                       return ret;
+               if (!(cmd & CMD_UPDATE))
+                       return 0;
+               udelay(1);
+       }
+
+       WARN(1, "%s: rcg didn't update its configuration.", name);
+       return 0;
+}
+
+static int clk_rcg2_set_parent(struct clk_hw *hw, u8 index)
+{
+       struct clk_rcg2 *rcg = to_clk_rcg2(hw);
+       int ret;
+
+       ret = regmap_update_bits(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG,
+                                CFG_SRC_SEL_MASK,
+                                rcg->parent_map[index] << CFG_SRC_SEL_SHIFT);
+       if (ret)
+               return ret;
+
+       return update_config(rcg);
+}
+
+/*
+ * Calculate m/n:d rate
+ *
+ *          parent_rate     m
+ *   rate = ----------- x  ---
+ *            hid_div       n
+ */
+static unsigned long
+calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 hid_div)
+{
+       if (hid_div) {
+               rate *= 2;
+               rate /= hid_div + 1;
+       }
+
+       if (mode) {
+               u64 tmp = rate;
+               tmp *= m;
+               do_div(tmp, n);
+               rate = tmp;
+       }
+
+       return rate;
+}
+
+static unsigned long
+clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
+{
+       struct clk_rcg2 *rcg = to_clk_rcg2(hw);
+       u32 cfg, hid_div, m = 0, n = 0, mode = 0, mask;
+
+       regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &cfg);
+
+       if (rcg->mnd_width) {
+               mask = BIT(rcg->mnd_width) - 1;
+               regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + M_REG, &m);
+               m &= mask;
+               regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + N_REG, &n);
+               n =  ~n;
+               n &= mask;
+               n += m;
+               mode = cfg & CFG_MODE_MASK;
+               mode >>= CFG_MODE_SHIFT;
+       }
+
+       mask = BIT(rcg->hid_width) - 1;
+       hid_div = cfg >> CFG_SRC_DIV_SHIFT;
+       hid_div &= mask;
+
+       return calc_rate(parent_rate, m, n, mode, hid_div);
+}
+
+static const
+struct freq_tbl *find_freq(const struct freq_tbl *f, unsigned long rate)
+{
+       if (!f)
+               return NULL;
+
+       for (; f->freq; f++)
+               if (rate <= f->freq)
+                       return f;
+
+       return NULL;
+}
+
+static long _freq_tbl_determine_rate(struct clk_hw *hw,
+               const struct freq_tbl *f, unsigned long rate,
+               unsigned long *p_rate, struct clk **p)
+{
+       unsigned long clk_flags;
+
+       f = find_freq(f, rate);
+       if (!f)
+               return -EINVAL;
+
+       clk_flags = __clk_get_flags(hw->clk);
+       *p = clk_get_parent_by_index(hw->clk, f->src);
+       if (clk_flags & CLK_SET_RATE_PARENT) {
+               if (f->pre_div) {
+                       rate /= 2;
+                       rate *= f->pre_div + 1;
+               }
+
+               if (f->n) {
+                       u64 tmp = rate;
+                       tmp = tmp * f->n;
+                       do_div(tmp, f->m);
+                       rate = tmp;
+               }
+       } else {
+               rate =  __clk_get_rate(*p);
+       }
+       *p_rate = rate;
+
+       return f->freq;
+}
+
+static long clk_rcg2_determine_rate(struct clk_hw *hw, unsigned long rate,
+               unsigned long *p_rate, struct clk **p)
+{
+       struct clk_rcg2 *rcg = to_clk_rcg2(hw);
+
+       return _freq_tbl_determine_rate(hw, rcg->freq_tbl, rate, p_rate, p);
+}
+
+static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate)
+{
+       struct clk_rcg2 *rcg = to_clk_rcg2(hw);
+       const struct freq_tbl *f;
+       u32 cfg, mask;
+       int ret;
+
+       f = find_freq(rcg->freq_tbl, rate);
+       if (!f)
+               return -EINVAL;
+
+       if (rcg->mnd_width && f->n) {
+               mask = BIT(rcg->mnd_width) - 1;
+               ret = regmap_update_bits(rcg->clkr.regmap, rcg->cmd_rcgr + M_REG,
+                                        mask, f->m);
+               if (ret)
+                       return ret;
+
+               ret = regmap_update_bits(rcg->clkr.regmap, rcg->cmd_rcgr + N_REG,
+                                        mask, ~(f->n - f->m));
+               if (ret)
+                       return ret;
+
+               ret = regmap_update_bits(rcg->clkr.regmap, rcg->cmd_rcgr + D_REG,
+                                        mask, ~f->n);
+               if (ret)
+                       return ret;
+       }
+
+       mask = BIT(rcg->hid_width) - 1;
+       mask |= CFG_SRC_SEL_MASK | CFG_MODE_MASK;
+       cfg = f->pre_div << CFG_SRC_DIV_SHIFT;
+       cfg |= rcg->parent_map[f->src] << CFG_SRC_SEL_SHIFT;
+       if (rcg->mnd_width && f->n)
+               cfg |= CFG_MODE_DUAL_EDGE;
+       ret = regmap_update_bits(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, mask,
+                       cfg);
+       if (ret)
+               return ret;
+
+       return update_config(rcg);
+}
+
+static int clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate,
+                           unsigned long parent_rate)
+{
+       return __clk_rcg2_set_rate(hw, rate);
+}
+
+static int clk_rcg2_set_rate_and_parent(struct clk_hw *hw,
+               unsigned long rate, unsigned long parent_rate, u8 index)
+{
+       return __clk_rcg2_set_rate(hw, rate);
+}
+
+const struct clk_ops clk_rcg2_ops = {
+       .is_enabled = clk_rcg2_is_enabled,
+       .get_parent = clk_rcg2_get_parent,
+       .set_parent = clk_rcg2_set_parent,
+       .recalc_rate = clk_rcg2_recalc_rate,
+       .determine_rate = clk_rcg2_determine_rate,
+       .set_rate = clk_rcg2_set_rate,
+       .set_rate_and_parent = clk_rcg2_set_rate_and_parent,
+};
+EXPORT_SYMBOL_GPL(clk_rcg2_ops);
diff --git a/drivers/clk/qcom/clk-regmap.c b/drivers/clk/qcom/clk-regmap.c
new file mode 100644 (file)
index 0000000..a58ba39
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/device.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+#include <linux/export.h>
+
+#include "clk-regmap.h"
+
+/**
+ * clk_is_enabled_regmap - standard is_enabled() for regmap users
+ *
+ * @hw: clk to operate on
+ *
+ * Clocks that use regmap for their register I/O can set the
+ * enable_reg and enable_mask fields in their struct clk_regmap and then use
+ * this as their is_enabled operation, saving some code.
+ */
+int clk_is_enabled_regmap(struct clk_hw *hw)
+{
+       struct clk_regmap *rclk = to_clk_regmap(hw);
+       unsigned int val;
+       int ret;
+
+       ret = regmap_read(rclk->regmap, rclk->enable_reg, &val);
+       if (ret != 0)
+               return ret;
+
+       if (rclk->enable_is_inverted)
+               return (val & rclk->enable_mask) == 0;
+       else
+               return (val & rclk->enable_mask) != 0;
+}
+EXPORT_SYMBOL_GPL(clk_is_enabled_regmap);
+
+/**
+ * clk_enable_regmap - standard enable() for regmap users
+ *
+ * @hw: clk to operate on
+ *
+ * Clocks that use regmap for their register I/O can set the
+ * enable_reg and enable_mask fields in their struct clk_regmap and then use
+ * this as their enable() operation, saving some code.
+ */
+int clk_enable_regmap(struct clk_hw *hw)
+{
+       struct clk_regmap *rclk = to_clk_regmap(hw);
+       unsigned int val;
+
+       if (rclk->enable_is_inverted)
+               val = 0;
+       else
+               val = rclk->enable_mask;
+
+       return regmap_update_bits(rclk->regmap, rclk->enable_reg,
+                                 rclk->enable_mask, val);
+}
+EXPORT_SYMBOL_GPL(clk_enable_regmap);
+
+/**
+ * clk_disable_regmap - standard disable() for regmap users
+ *
+ * @hw: clk to operate on
+ *
+ * Clocks that use regmap for their register I/O can set the
+ * enable_reg and enable_mask fields in their struct clk_regmap and then use
+ * this as their disable() operation, saving some code.
+ */
+void clk_disable_regmap(struct clk_hw *hw)
+{
+       struct clk_regmap *rclk = to_clk_regmap(hw);
+       unsigned int val;
+
+       if (rclk->enable_is_inverted)
+               val = rclk->enable_mask;
+       else
+               val = 0;
+
+       regmap_update_bits(rclk->regmap, rclk->enable_reg, rclk->enable_mask,
+                          val);
+}
+EXPORT_SYMBOL_GPL(clk_disable_regmap);
+
+/**
+ * devm_clk_register_regmap - register a clk_regmap clock
+ *
+ * @rclk: clk to operate on
+ *
+ * Clocks that use regmap for their register I/O should register their
+ * clk_regmap struct via this function so that the regmap is initialized
+ * and so that the clock is registered with the common clock framework.
+ */
+struct clk *devm_clk_register_regmap(struct device *dev,
+                                    struct clk_regmap *rclk)
+{
+       if (dev && dev_get_regmap(dev, NULL))
+               rclk->regmap = dev_get_regmap(dev, NULL);
+       else if (dev && dev->parent)
+               rclk->regmap = dev_get_regmap(dev->parent, NULL);
+
+       return devm_clk_register(dev, &rclk->hw);
+}
+EXPORT_SYMBOL_GPL(devm_clk_register_regmap);
diff --git a/drivers/clk/qcom/clk-regmap.h b/drivers/clk/qcom/clk-regmap.h
new file mode 100644 (file)
index 0000000..491a63d
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __QCOM_CLK_REGMAP_H__
+#define __QCOM_CLK_REGMAP_H__
+
+#include <linux/clk-provider.h>
+
+struct regmap;
+
+/**
+ * struct clk_regmap - regmap supporting clock
+ * @hw:                handle between common and hardware-specific interfaces
+ * @regmap:    regmap to use for regmap helpers and/or by providers
+ * @enable_reg: register when using regmap enable/disable ops
+ * @enable_mask: mask when using regmap enable/disable ops
+ * @enable_is_inverted: flag to indicate set enable_mask bits to disable
+ *                      when using clock_enable_regmap and friends APIs.
+ */
+struct clk_regmap {
+       struct clk_hw hw;
+       struct regmap *regmap;
+       unsigned int enable_reg;
+       unsigned int enable_mask;
+       bool enable_is_inverted;
+};
+#define to_clk_regmap(_hw) container_of(_hw, struct clk_regmap, hw)
+
+int clk_is_enabled_regmap(struct clk_hw *hw);
+int clk_enable_regmap(struct clk_hw *hw);
+void clk_disable_regmap(struct clk_hw *hw);
+struct clk *
+devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk);
+
+#endif
diff --git a/drivers/clk/qcom/gcc-msm8660.c b/drivers/clk/qcom/gcc-msm8660.c
new file mode 100644 (file)
index 0000000..bc0b7f1
--- /dev/null
@@ -0,0 +1,2819 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+#include <linux/reset-controller.h>
+
+#include <dt-bindings/clock/qcom,gcc-msm8660.h>
+#include <dt-bindings/reset/qcom,gcc-msm8660.h>
+
+#include "clk-regmap.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-branch.h"
+#include "reset.h"
+
+static struct clk_pll pll8 = {
+       .l_reg = 0x3144,
+       .m_reg = 0x3148,
+       .n_reg = 0x314c,
+       .config_reg = 0x3154,
+       .mode_reg = 0x3140,
+       .status_reg = 0x3158,
+       .status_bit = 16,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "pll8",
+               .parent_names = (const char *[]){ "pxo" },
+               .num_parents = 1,
+               .ops = &clk_pll_ops,
+       },
+};
+
+static struct clk_regmap pll8_vote = {
+       .enable_reg = 0x34c0,
+       .enable_mask = BIT(8),
+       .hw.init = &(struct clk_init_data){
+               .name = "pll8_vote",
+               .parent_names = (const char *[]){ "pll8" },
+               .num_parents = 1,
+               .ops = &clk_pll_vote_ops,
+       },
+};
+
+#define P_PXO  0
+#define P_PLL8 1
+#define P_CXO  2
+
+static const u8 gcc_pxo_pll8_map[] = {
+       [P_PXO]         = 0,
+       [P_PLL8]        = 3,
+};
+
+static const char *gcc_pxo_pll8[] = {
+       "pxo",
+       "pll8_vote",
+};
+
+static const u8 gcc_pxo_pll8_cxo_map[] = {
+       [P_PXO]         = 0,
+       [P_PLL8]        = 3,
+       [P_CXO]         = 5,
+};
+
+static const char *gcc_pxo_pll8_cxo[] = {
+       "pxo",
+       "pll8_vote",
+       "cxo",
+};
+
+static struct freq_tbl clk_tbl_gsbi_uart[] = {
+       {  1843200, P_PLL8, 2,  6, 625 },
+       {  3686400, P_PLL8, 2, 12, 625 },
+       {  7372800, P_PLL8, 2, 24, 625 },
+       { 14745600, P_PLL8, 2, 48, 625 },
+       { 16000000, P_PLL8, 4,  1,   6 },
+       { 24000000, P_PLL8, 4,  1,   4 },
+       { 32000000, P_PLL8, 4,  1,   3 },
+       { 40000000, P_PLL8, 1,  5,  48 },
+       { 46400000, P_PLL8, 1, 29, 240 },
+       { 48000000, P_PLL8, 4,  1,   2 },
+       { 51200000, P_PLL8, 1,  2,  15 },
+       { 56000000, P_PLL8, 1,  7,  48 },
+       { 58982400, P_PLL8, 1, 96, 625 },
+       { 64000000, P_PLL8, 2,  1,   3 },
+       { }
+};
+
+static struct clk_rcg gsbi1_uart_src = {
+       .ns_reg = 0x29d4,
+       .md_reg = 0x29d0,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x29d4,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi1_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi1_uart_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x29d4,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi1_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi1_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi2_uart_src = {
+       .ns_reg = 0x29f4,
+       .md_reg = 0x29f0,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x29f4,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi2_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi2_uart_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 6,
+       .clkr = {
+               .enable_reg = 0x29f4,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi2_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi2_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi3_uart_src = {
+       .ns_reg = 0x2a14,
+       .md_reg = 0x2a10,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2a14,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi3_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi3_uart_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 2,
+       .clkr = {
+               .enable_reg = 0x2a14,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi3_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi3_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi4_uart_src = {
+       .ns_reg = 0x2a34,
+       .md_reg = 0x2a30,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2a34,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi4_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi4_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 26,
+       .clkr = {
+               .enable_reg = 0x2a34,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi4_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi4_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi5_uart_src = {
+       .ns_reg = 0x2a54,
+       .md_reg = 0x2a50,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2a54,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi5_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi5_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 22,
+       .clkr = {
+               .enable_reg = 0x2a54,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi5_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi5_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi6_uart_src = {
+       .ns_reg = 0x2a74,
+       .md_reg = 0x2a70,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2a74,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi6_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi6_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 18,
+       .clkr = {
+               .enable_reg = 0x2a74,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi6_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi6_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi7_uart_src = {
+       .ns_reg = 0x2a94,
+       .md_reg = 0x2a90,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2a94,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi7_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi7_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 14,
+       .clkr = {
+               .enable_reg = 0x2a94,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi7_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi7_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi8_uart_src = {
+       .ns_reg = 0x2ab4,
+       .md_reg = 0x2ab0,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2ab4,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi8_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi8_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x2ab4,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi8_uart_clk",
+                       .parent_names = (const char *[]){ "gsbi8_uart_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi9_uart_src = {
+       .ns_reg = 0x2ad4,
+       .md_reg = 0x2ad0,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2ad4,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi9_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi9_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 6,
+       .clkr = {
+               .enable_reg = 0x2ad4,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi9_uart_clk",
+                       .parent_names = (const char *[]){ "gsbi9_uart_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi10_uart_src = {
+       .ns_reg = 0x2af4,
+       .md_reg = 0x2af0,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2af4,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi10_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi10_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 2,
+       .clkr = {
+               .enable_reg = 0x2af4,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi10_uart_clk",
+                       .parent_names = (const char *[]){ "gsbi10_uart_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi11_uart_src = {
+       .ns_reg = 0x2b14,
+       .md_reg = 0x2b10,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2b14,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi11_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi11_uart_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 17,
+       .clkr = {
+               .enable_reg = 0x2b14,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi11_uart_clk",
+                       .parent_names = (const char *[]){ "gsbi11_uart_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi12_uart_src = {
+       .ns_reg = 0x2b34,
+       .md_reg = 0x2b30,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2b34,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi12_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi12_uart_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 13,
+       .clkr = {
+               .enable_reg = 0x2b34,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi12_uart_clk",
+                       .parent_names = (const char *[]){ "gsbi12_uart_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_gsbi_qup[] = {
+       {  1100000, P_PXO,  1, 2, 49 },
+       {  5400000, P_PXO,  1, 1,  5 },
+       { 10800000, P_PXO,  1, 2,  5 },
+       { 15060000, P_PLL8, 1, 2, 51 },
+       { 24000000, P_PLL8, 4, 1,  4 },
+       { 25600000, P_PLL8, 1, 1, 15 },
+       { 27000000, P_PXO,  1, 0,  0 },
+       { 48000000, P_PLL8, 4, 1,  2 },
+       { 51200000, P_PLL8, 1, 2, 15 },
+       { }
+};
+
+static struct clk_rcg gsbi1_qup_src = {
+       .ns_reg = 0x29cc,
+       .md_reg = 0x29c8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x29cc,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi1_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi1_qup_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 9,
+       .clkr = {
+               .enable_reg = 0x29cc,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi1_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi1_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi2_qup_src = {
+       .ns_reg = 0x29ec,
+       .md_reg = 0x29e8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x29ec,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi2_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi2_qup_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 4,
+       .clkr = {
+               .enable_reg = 0x29ec,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi2_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi2_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi3_qup_src = {
+       .ns_reg = 0x2a0c,
+       .md_reg = 0x2a08,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2a0c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi3_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi3_qup_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 0,
+       .clkr = {
+               .enable_reg = 0x2a0c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi3_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi3_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi4_qup_src = {
+       .ns_reg = 0x2a2c,
+       .md_reg = 0x2a28,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2a2c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi4_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi4_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 24,
+       .clkr = {
+               .enable_reg = 0x2a2c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi4_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi4_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi5_qup_src = {
+       .ns_reg = 0x2a4c,
+       .md_reg = 0x2a48,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2a4c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi5_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi5_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 20,
+       .clkr = {
+               .enable_reg = 0x2a4c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi5_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi5_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi6_qup_src = {
+       .ns_reg = 0x2a6c,
+       .md_reg = 0x2a68,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2a6c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi6_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi6_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 16,
+       .clkr = {
+               .enable_reg = 0x2a6c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi6_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi6_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi7_qup_src = {
+       .ns_reg = 0x2a8c,
+       .md_reg = 0x2a88,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2a8c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi7_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi7_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 12,
+       .clkr = {
+               .enable_reg = 0x2a8c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi7_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi7_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi8_qup_src = {
+       .ns_reg = 0x2aac,
+       .md_reg = 0x2aa8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2aac,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi8_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi8_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 8,
+       .clkr = {
+               .enable_reg = 0x2aac,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi8_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi8_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi9_qup_src = {
+       .ns_reg = 0x2acc,
+       .md_reg = 0x2ac8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2acc,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi9_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi9_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 4,
+       .clkr = {
+               .enable_reg = 0x2acc,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi9_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi9_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi10_qup_src = {
+       .ns_reg = 0x2aec,
+       .md_reg = 0x2ae8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2aec,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi10_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi10_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 0,
+       .clkr = {
+               .enable_reg = 0x2aec,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi10_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi10_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi11_qup_src = {
+       .ns_reg = 0x2b0c,
+       .md_reg = 0x2b08,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2b0c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi11_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi11_qup_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 15,
+       .clkr = {
+               .enable_reg = 0x2b0c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi11_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi11_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi12_qup_src = {
+       .ns_reg = 0x2b2c,
+       .md_reg = 0x2b28,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2b2c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi12_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi12_qup_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 11,
+       .clkr = {
+               .enable_reg = 0x2b2c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi12_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi12_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static const struct freq_tbl clk_tbl_gp[] = {
+       { 9600000, P_CXO,  2, 0, 0 },
+       { 13500000, P_PXO,  2, 0, 0 },
+       { 19200000, P_CXO,  1, 0, 0 },
+       { 27000000, P_PXO,  1, 0, 0 },
+       { 64000000, P_PLL8, 2, 1, 3 },
+       { 76800000, P_PLL8, 1, 1, 5 },
+       { 96000000, P_PLL8, 4, 0, 0 },
+       { 128000000, P_PLL8, 3, 0, 0 },
+       { 192000000, P_PLL8, 2, 0, 0 },
+       { }
+};
+
+static struct clk_rcg gp0_src = {
+       .ns_reg = 0x2d24,
+       .md_reg = 0x2d00,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_cxo_map,
+       },
+       .freq_tbl = clk_tbl_gp,
+       .clkr = {
+               .enable_reg = 0x2d24,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp0_src",
+                       .parent_names = gcc_pxo_pll8_cxo,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       }
+};
+
+static struct clk_branch gp0_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x2d24,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp0_clk",
+                       .parent_names = (const char *[]){ "gp0_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gp1_src = {
+       .ns_reg = 0x2d44,
+       .md_reg = 0x2d40,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_cxo_map,
+       },
+       .freq_tbl = clk_tbl_gp,
+       .clkr = {
+               .enable_reg = 0x2d44,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp1_src",
+                       .parent_names = gcc_pxo_pll8_cxo,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch gp1_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_bit = 6,
+       .clkr = {
+               .enable_reg = 0x2d44,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp1_clk",
+                       .parent_names = (const char *[]){ "gp1_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gp2_src = {
+       .ns_reg = 0x2d64,
+       .md_reg = 0x2d60,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_cxo_map,
+       },
+       .freq_tbl = clk_tbl_gp,
+       .clkr = {
+               .enable_reg = 0x2d64,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp2_src",
+                       .parent_names = gcc_pxo_pll8_cxo,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch gp2_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_bit = 5,
+       .clkr = {
+               .enable_reg = 0x2d64,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp2_clk",
+                       .parent_names = (const char *[]){ "gp2_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch pmem_clk = {
+       .hwcg_reg = 0x25a0,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fc8,
+       .halt_bit = 20,
+       .clkr = {
+               .enable_reg = 0x25a0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "pmem_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_rcg prng_src = {
+       .ns_reg = 0x2e80,
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 4,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .clkr.hw = {
+               .init = &(struct clk_init_data){
+                       .name = "prng_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch prng_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(10),
+               .hw.init = &(struct clk_init_data){
+                       .name = "prng_clk",
+                       .parent_names = (const char *[]){ "prng_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+               },
+       },
+};
+
+static const struct freq_tbl clk_tbl_sdc[] = {
+       {    144000, P_PXO,   3, 2, 125 },
+       {    400000, P_PLL8,  4, 1, 240 },
+       {  16000000, P_PLL8,  4, 1,   6 },
+       {  17070000, P_PLL8,  1, 2,  45 },
+       {  20210000, P_PLL8,  1, 1,  19 },
+       {  24000000, P_PLL8,  4, 1,   4 },
+       {  48000000, P_PLL8,  4, 1,   2 },
+       { }
+};
+
+static struct clk_rcg sdc1_src = {
+       .ns_reg = 0x282c,
+       .md_reg = 0x2828,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_sdc,
+       .clkr = {
+               .enable_reg = 0x282c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc1_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch sdc1_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 6,
+       .clkr = {
+               .enable_reg = 0x282c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc1_clk",
+                       .parent_names = (const char *[]){ "sdc1_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg sdc2_src = {
+       .ns_reg = 0x284c,
+       .md_reg = 0x2848,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_sdc,
+       .clkr = {
+               .enable_reg = 0x284c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc2_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch sdc2_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 5,
+       .clkr = {
+               .enable_reg = 0x284c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc2_clk",
+                       .parent_names = (const char *[]){ "sdc2_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg sdc3_src = {
+       .ns_reg = 0x286c,
+       .md_reg = 0x2868,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_sdc,
+       .clkr = {
+               .enable_reg = 0x286c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc3_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch sdc3_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 4,
+       .clkr = {
+               .enable_reg = 0x286c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc3_clk",
+                       .parent_names = (const char *[]){ "sdc3_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg sdc4_src = {
+       .ns_reg = 0x288c,
+       .md_reg = 0x2888,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_sdc,
+       .clkr = {
+               .enable_reg = 0x288c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc4_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch sdc4_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 3,
+       .clkr = {
+               .enable_reg = 0x288c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc4_clk",
+                       .parent_names = (const char *[]){ "sdc4_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg sdc5_src = {
+       .ns_reg = 0x28ac,
+       .md_reg = 0x28a8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_sdc,
+       .clkr = {
+               .enable_reg = 0x28ac,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc5_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch sdc5_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 2,
+       .clkr = {
+               .enable_reg = 0x28ac,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc5_clk",
+                       .parent_names = (const char *[]){ "sdc5_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static const struct freq_tbl clk_tbl_tsif_ref[] = {
+       { 105000, P_PXO,  1, 1, 256 },
+       { }
+};
+
+static struct clk_rcg tsif_ref_src = {
+       .ns_reg = 0x2710,
+       .md_reg = 0x270c,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_tsif_ref,
+       .clkr = {
+               .enable_reg = 0x2710,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "tsif_ref_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch tsif_ref_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 5,
+       .clkr = {
+               .enable_reg = 0x2710,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "tsif_ref_clk",
+                       .parent_names = (const char *[]){ "tsif_ref_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static const struct freq_tbl clk_tbl_usb[] = {
+       { 60000000, P_PLL8, 1, 5, 32 },
+       { }
+};
+
+static struct clk_rcg usb_hs1_xcvr_src = {
+       .ns_reg = 0x290c,
+       .md_reg = 0x2908,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_usb,
+       .clkr = {
+               .enable_reg = 0x290c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_hs1_xcvr_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch usb_hs1_xcvr_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 0,
+       .clkr = {
+               .enable_reg = 0x290c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_hs1_xcvr_clk",
+                       .parent_names = (const char *[]){ "usb_hs1_xcvr_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg usb_fs1_xcvr_fs_src = {
+       .ns_reg = 0x2968,
+       .md_reg = 0x2964,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_usb,
+       .clkr = {
+               .enable_reg = 0x2968,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs1_xcvr_fs_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static const char *usb_fs1_xcvr_fs_src_p[] = { "usb_fs1_xcvr_fs_src" };
+
+static struct clk_branch usb_fs1_xcvr_fs_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 15,
+       .clkr = {
+               .enable_reg = 0x2968,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs1_xcvr_fs_clk",
+                       .parent_names = usb_fs1_xcvr_fs_src_p,
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch usb_fs1_system_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 16,
+       .clkr = {
+               .enable_reg = 0x296c,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = usb_fs1_xcvr_fs_src_p,
+                       .num_parents = 1,
+                       .name = "usb_fs1_system_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg usb_fs2_xcvr_fs_src = {
+       .ns_reg = 0x2988,
+       .md_reg = 0x2984,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_usb,
+       .clkr = {
+               .enable_reg = 0x2988,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs2_xcvr_fs_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static const char *usb_fs2_xcvr_fs_src_p[] = { "usb_fs2_xcvr_fs_src" };
+
+static struct clk_branch usb_fs2_xcvr_fs_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 12,
+       .clkr = {
+               .enable_reg = 0x2988,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs2_xcvr_fs_clk",
+                       .parent_names = usb_fs2_xcvr_fs_src_p,
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch usb_fs2_system_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 13,
+       .clkr = {
+               .enable_reg = 0x298c,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs2_system_clk",
+                       .parent_names = usb_fs2_xcvr_fs_src_p,
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch gsbi1_h_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 11,
+       .clkr = {
+               .enable_reg = 0x29c0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi2_h_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x29e0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi2_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi3_h_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 3,
+       .clkr = {
+               .enable_reg = 0x2a00,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi3_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi4_h_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 27,
+       .clkr = {
+               .enable_reg = 0x2a20,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi4_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi5_h_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 23,
+       .clkr = {
+               .enable_reg = 0x2a40,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi5_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi6_h_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 19,
+       .clkr = {
+               .enable_reg = 0x2a60,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi6_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi7_h_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 15,
+       .clkr = {
+               .enable_reg = 0x2a80,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi7_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi8_h_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 11,
+       .clkr = {
+               .enable_reg = 0x2aa0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi8_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi9_h_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x2ac0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi9_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi10_h_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 3,
+       .clkr = {
+               .enable_reg = 0x2ae0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi10_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi11_h_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 18,
+       .clkr = {
+               .enable_reg = 0x2b00,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi11_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi12_h_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 14,
+       .clkr = {
+               .enable_reg = 0x2b20,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi12_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch tsif_h_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x2700,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "tsif_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch usb_fs1_h_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 17,
+       .clkr = {
+               .enable_reg = 0x2960,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch usb_fs2_h_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 14,
+       .clkr = {
+               .enable_reg = 0x2980,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs2_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch usb_hs1_h_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 1,
+       .clkr = {
+               .enable_reg = 0x2900,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_hs1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch sdc1_h_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 11,
+       .clkr = {
+               .enable_reg = 0x2820,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch sdc2_h_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x2840,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc2_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch sdc3_h_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 9,
+       .clkr = {
+               .enable_reg = 0x2860,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc3_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch sdc4_h_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 8,
+       .clkr = {
+               .enable_reg = 0x2880,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc4_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch sdc5_h_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x28a0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc5_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch adm0_clk = {
+       .halt_reg = 0x2fdc,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 14,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "adm0_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch adm0_pbus_clk = {
+       .halt_reg = 0x2fdc,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 13,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(3),
+               .hw.init = &(struct clk_init_data){
+                       .name = "adm0_pbus_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch adm1_clk = {
+       .halt_reg = 0x2fdc,
+       .halt_bit = 12,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "adm1_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch adm1_pbus_clk = {
+       .halt_reg = 0x2fdc,
+       .halt_bit = 11,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(5),
+               .hw.init = &(struct clk_init_data){
+                       .name = "adm1_pbus_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch modem_ahb1_h_clk = {
+       .halt_reg = 0x2fdc,
+       .halt_bit = 8,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "modem_ahb1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch modem_ahb2_h_clk = {
+       .halt_reg = 0x2fdc,
+       .halt_bit = 7,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(1),
+               .hw.init = &(struct clk_init_data){
+                       .name = "modem_ahb2_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch pmic_arb0_h_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 22,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(8),
+               .hw.init = &(struct clk_init_data){
+                       .name = "pmic_arb0_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch pmic_arb1_h_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 21,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "pmic_arb1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch pmic_ssbi2_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 23,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(7),
+               .hw.init = &(struct clk_init_data){
+                       .name = "pmic_ssbi2_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch rpm_msg_ram_h_clk = {
+       .hwcg_reg = 0x27e0,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd8,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 12,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(6),
+               .hw.init = &(struct clk_init_data){
+                       .name = "rpm_msg_ram_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_regmap *gcc_msm8660_clks[] = {
+       [PLL8] = &pll8.clkr,
+       [PLL8_VOTE] = &pll8_vote,
+       [GSBI1_UART_SRC] = &gsbi1_uart_src.clkr,
+       [GSBI1_UART_CLK] = &gsbi1_uart_clk.clkr,
+       [GSBI2_UART_SRC] = &gsbi2_uart_src.clkr,
+       [GSBI2_UART_CLK] = &gsbi2_uart_clk.clkr,
+       [GSBI3_UART_SRC] = &gsbi3_uart_src.clkr,
+       [GSBI3_UART_CLK] = &gsbi3_uart_clk.clkr,
+       [GSBI4_UART_SRC] = &gsbi4_uart_src.clkr,
+       [GSBI4_UART_CLK] = &gsbi4_uart_clk.clkr,
+       [GSBI5_UART_SRC] = &gsbi5_uart_src.clkr,
+       [GSBI5_UART_CLK] = &gsbi5_uart_clk.clkr,
+       [GSBI6_UART_SRC] = &gsbi6_uart_src.clkr,
+       [GSBI6_UART_CLK] = &gsbi6_uart_clk.clkr,
+       [GSBI7_UART_SRC] = &gsbi7_uart_src.clkr,
+       [GSBI7_UART_CLK] = &gsbi7_uart_clk.clkr,
+       [GSBI8_UART_SRC] = &gsbi8_uart_src.clkr,
+       [GSBI8_UART_CLK] = &gsbi8_uart_clk.clkr,
+       [GSBI9_UART_SRC] = &gsbi9_uart_src.clkr,
+       [GSBI9_UART_CLK] = &gsbi9_uart_clk.clkr,
+       [GSBI10_UART_SRC] = &gsbi10_uart_src.clkr,
+       [GSBI10_UART_CLK] = &gsbi10_uart_clk.clkr,
+       [GSBI11_UART_SRC] = &gsbi11_uart_src.clkr,
+       [GSBI11_UART_CLK] = &gsbi11_uart_clk.clkr,
+       [GSBI12_UART_SRC] = &gsbi12_uart_src.clkr,
+       [GSBI12_UART_CLK] = &gsbi12_uart_clk.clkr,
+       [GSBI1_QUP_SRC] = &gsbi1_qup_src.clkr,
+       [GSBI1_QUP_CLK] = &gsbi1_qup_clk.clkr,
+       [GSBI2_QUP_SRC] = &gsbi2_qup_src.clkr,
+       [GSBI2_QUP_CLK] = &gsbi2_qup_clk.clkr,
+       [GSBI3_QUP_SRC] = &gsbi3_qup_src.clkr,
+       [GSBI3_QUP_CLK] = &gsbi3_qup_clk.clkr,
+       [GSBI4_QUP_SRC] = &gsbi4_qup_src.clkr,
+       [GSBI4_QUP_CLK] = &gsbi4_qup_clk.clkr,
+       [GSBI5_QUP_SRC] = &gsbi5_qup_src.clkr,
+       [GSBI5_QUP_CLK] = &gsbi5_qup_clk.clkr,
+       [GSBI6_QUP_SRC] = &gsbi6_qup_src.clkr,
+       [GSBI6_QUP_CLK] = &gsbi6_qup_clk.clkr,
+       [GSBI7_QUP_SRC] = &gsbi7_qup_src.clkr,
+       [GSBI7_QUP_CLK] = &gsbi7_qup_clk.clkr,
+       [GSBI8_QUP_SRC] = &gsbi8_qup_src.clkr,
+       [GSBI8_QUP_CLK] = &gsbi8_qup_clk.clkr,
+       [GSBI9_QUP_SRC] = &gsbi9_qup_src.clkr,
+       [GSBI9_QUP_CLK] = &gsbi9_qup_clk.clkr,
+       [GSBI10_QUP_SRC] = &gsbi10_qup_src.clkr,
+       [GSBI10_QUP_CLK] = &gsbi10_qup_clk.clkr,
+       [GSBI11_QUP_SRC] = &gsbi11_qup_src.clkr,
+       [GSBI11_QUP_CLK] = &gsbi11_qup_clk.clkr,
+       [GSBI12_QUP_SRC] = &gsbi12_qup_src.clkr,
+       [GSBI12_QUP_CLK] = &gsbi12_qup_clk.clkr,
+       [GP0_SRC] = &gp0_src.clkr,
+       [GP0_CLK] = &gp0_clk.clkr,
+       [GP1_SRC] = &gp1_src.clkr,
+       [GP1_CLK] = &gp1_clk.clkr,
+       [GP2_SRC] = &gp2_src.clkr,
+       [GP2_CLK] = &gp2_clk.clkr,
+       [PMEM_CLK] = &pmem_clk.clkr,
+       [PRNG_SRC] = &prng_src.clkr,
+       [PRNG_CLK] = &prng_clk.clkr,
+       [SDC1_SRC] = &sdc1_src.clkr,
+       [SDC1_CLK] = &sdc1_clk.clkr,
+       [SDC2_SRC] = &sdc2_src.clkr,
+       [SDC2_CLK] = &sdc2_clk.clkr,
+       [SDC3_SRC] = &sdc3_src.clkr,
+       [SDC3_CLK] = &sdc3_clk.clkr,
+       [SDC4_SRC] = &sdc4_src.clkr,
+       [SDC4_CLK] = &sdc4_clk.clkr,
+       [SDC5_SRC] = &sdc5_src.clkr,
+       [SDC5_CLK] = &sdc5_clk.clkr,
+       [TSIF_REF_SRC] = &tsif_ref_src.clkr,
+       [TSIF_REF_CLK] = &tsif_ref_clk.clkr,
+       [USB_HS1_XCVR_SRC] = &usb_hs1_xcvr_src.clkr,
+       [USB_HS1_XCVR_CLK] = &usb_hs1_xcvr_clk.clkr,
+       [USB_FS1_XCVR_FS_SRC] = &usb_fs1_xcvr_fs_src.clkr,
+       [USB_FS1_XCVR_FS_CLK] = &usb_fs1_xcvr_fs_clk.clkr,
+       [USB_FS1_SYSTEM_CLK] = &usb_fs1_system_clk.clkr,
+       [USB_FS2_XCVR_FS_SRC] = &usb_fs2_xcvr_fs_src.clkr,
+       [USB_FS2_XCVR_FS_CLK] = &usb_fs2_xcvr_fs_clk.clkr,
+       [USB_FS2_SYSTEM_CLK] = &usb_fs2_system_clk.clkr,
+       [GSBI1_H_CLK] = &gsbi1_h_clk.clkr,
+       [GSBI2_H_CLK] = &gsbi2_h_clk.clkr,
+       [GSBI3_H_CLK] = &gsbi3_h_clk.clkr,
+       [GSBI4_H_CLK] = &gsbi4_h_clk.clkr,
+       [GSBI5_H_CLK] = &gsbi5_h_clk.clkr,
+       [GSBI6_H_CLK] = &gsbi6_h_clk.clkr,
+       [GSBI7_H_CLK] = &gsbi7_h_clk.clkr,
+       [GSBI8_H_CLK] = &gsbi8_h_clk.clkr,
+       [GSBI9_H_CLK] = &gsbi9_h_clk.clkr,
+       [GSBI10_H_CLK] = &gsbi10_h_clk.clkr,
+       [GSBI11_H_CLK] = &gsbi11_h_clk.clkr,
+       [GSBI12_H_CLK] = &gsbi12_h_clk.clkr,
+       [TSIF_H_CLK] = &tsif_h_clk.clkr,
+       [USB_FS1_H_CLK] = &usb_fs1_h_clk.clkr,
+       [USB_FS2_H_CLK] = &usb_fs2_h_clk.clkr,
+       [USB_HS1_H_CLK] = &usb_hs1_h_clk.clkr,
+       [SDC1_H_CLK] = &sdc1_h_clk.clkr,
+       [SDC2_H_CLK] = &sdc2_h_clk.clkr,
+       [SDC3_H_CLK] = &sdc3_h_clk.clkr,
+       [SDC4_H_CLK] = &sdc4_h_clk.clkr,
+       [SDC5_H_CLK] = &sdc5_h_clk.clkr,
+       [ADM0_CLK] = &adm0_clk.clkr,
+       [ADM0_PBUS_CLK] = &adm0_pbus_clk.clkr,
+       [ADM1_CLK] = &adm1_clk.clkr,
+       [ADM1_PBUS_CLK] = &adm1_pbus_clk.clkr,
+       [MODEM_AHB1_H_CLK] = &modem_ahb1_h_clk.clkr,
+       [MODEM_AHB2_H_CLK] = &modem_ahb2_h_clk.clkr,
+       [PMIC_ARB0_H_CLK] = &pmic_arb0_h_clk.clkr,
+       [PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr,
+       [PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr,
+       [RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr,
+};
+
+static const struct qcom_reset_map gcc_msm8660_resets[] = {
+       [AFAB_CORE_RESET] = { 0x2080, 7 },
+       [SCSS_SYS_RESET] = { 0x20b4, 1 },
+       [SCSS_SYS_POR_RESET] = { 0x20b4 },
+       [AFAB_SMPSS_S_RESET] = { 0x20b8, 2 },
+       [AFAB_SMPSS_M1_RESET] = { 0x20b8, 1 },
+       [AFAB_SMPSS_M0_RESET] = { 0x20b8 },
+       [AFAB_EBI1_S_RESET] = { 0x20c0, 7 },
+       [SFAB_CORE_RESET] = { 0x2120, 7 },
+       [SFAB_ADM0_M0_RESET] = { 0x21e0, 7 },
+       [SFAB_ADM0_M1_RESET] = { 0x21e4, 7 },
+       [SFAB_ADM0_M2_RESET] = { 0x21e4, 7 },
+       [ADM0_C2_RESET] = { 0x220c, 4 },
+       [ADM0_C1_RESET] = { 0x220c, 3 },
+       [ADM0_C0_RESET] = { 0x220c, 2 },
+       [ADM0_PBUS_RESET] = { 0x220c, 1 },
+       [ADM0_RESET] = { 0x220c },
+       [SFAB_ADM1_M0_RESET] = { 0x2220, 7 },
+       [SFAB_ADM1_M1_RESET] = { 0x2224, 7 },
+       [SFAB_ADM1_M2_RESET] = { 0x2228, 7 },
+       [MMFAB_ADM1_M3_RESET] = { 0x2240, 7 },
+       [ADM1_C3_RESET] = { 0x226c, 5 },
+       [ADM1_C2_RESET] = { 0x226c, 4 },
+       [ADM1_C1_RESET] = { 0x226c, 3 },
+       [ADM1_C0_RESET] = { 0x226c, 2 },
+       [ADM1_PBUS_RESET] = { 0x226c, 1 },
+       [ADM1_RESET] = { 0x226c },
+       [IMEM0_RESET] = { 0x2280, 7 },
+       [SFAB_LPASS_Q6_RESET] = { 0x23a0, 7 },
+       [SFAB_AFAB_M_RESET] = { 0x23e0, 7 },
+       [AFAB_SFAB_M0_RESET] = { 0x2420, 7 },
+       [AFAB_SFAB_M1_RESET] = { 0x2424, 7 },
+       [DFAB_CORE_RESET] = { 0x24ac, 7 },
+       [SFAB_DFAB_M_RESET] = { 0x2500, 7 },
+       [DFAB_SFAB_M_RESET] = { 0x2520, 7 },
+       [DFAB_SWAY0_RESET] = { 0x2540, 7 },
+       [DFAB_SWAY1_RESET] = { 0x2544, 7 },
+       [DFAB_ARB0_RESET] = { 0x2560, 7 },
+       [DFAB_ARB1_RESET] = { 0x2564, 7 },
+       [PPSS_PROC_RESET] = { 0x2594, 1 },
+       [PPSS_RESET] = { 0x2594 },
+       [PMEM_RESET] = { 0x25a0, 7 },
+       [DMA_BAM_RESET] = { 0x25c0, 7 },
+       [SIC_RESET] = { 0x25e0, 7 },
+       [SPS_TIC_RESET] = { 0x2600, 7 },
+       [CFBP0_RESET] = { 0x2650, 7 },
+       [CFBP1_RESET] = { 0x2654, 7 },
+       [CFBP2_RESET] = { 0x2658, 7 },
+       [EBI2_RESET] = { 0x2664, 7 },
+       [SFAB_CFPB_M_RESET] = { 0x2680, 7 },
+       [CFPB_MASTER_RESET] = { 0x26a0, 7 },
+       [SFAB_CFPB_S_RESET] = { 0x26c0, 7 },
+       [CFPB_SPLITTER_RESET] = { 0x26e0, 7 },
+       [TSIF_RESET] = { 0x2700, 7 },
+       [CE1_RESET] = { 0x2720, 7 },
+       [CE2_RESET] = { 0x2740, 7 },
+       [SFAB_SFPB_M_RESET] = { 0x2780, 7 },
+       [SFAB_SFPB_S_RESET] = { 0x27a0, 7 },
+       [RPM_PROC_RESET] = { 0x27c0, 7 },
+       [RPM_BUS_RESET] = { 0x27c4, 7 },
+       [RPM_MSG_RAM_RESET] = { 0x27e0, 7 },
+       [PMIC_ARB0_RESET] = { 0x2800, 7 },
+       [PMIC_ARB1_RESET] = { 0x2804, 7 },
+       [PMIC_SSBI2_RESET] = { 0x280c, 12 },
+       [SDC1_RESET] = { 0x2830 },
+       [SDC2_RESET] = { 0x2850 },
+       [SDC3_RESET] = { 0x2870 },
+       [SDC4_RESET] = { 0x2890 },
+       [SDC5_RESET] = { 0x28b0 },
+       [USB_HS1_RESET] = { 0x2910 },
+       [USB_HS2_XCVR_RESET] = { 0x2934, 1 },
+       [USB_HS2_RESET] = { 0x2934 },
+       [USB_FS1_XCVR_RESET] = { 0x2974, 1 },
+       [USB_FS1_RESET] = { 0x2974 },
+       [USB_FS2_XCVR_RESET] = { 0x2994, 1 },
+       [USB_FS2_RESET] = { 0x2994 },
+       [GSBI1_RESET] = { 0x29dc },
+       [GSBI2_RESET] = { 0x29fc },
+       [GSBI3_RESET] = { 0x2a1c },
+       [GSBI4_RESET] = { 0x2a3c },
+       [GSBI5_RESET] = { 0x2a5c },
+       [GSBI6_RESET] = { 0x2a7c },
+       [GSBI7_RESET] = { 0x2a9c },
+       [GSBI8_RESET] = { 0x2abc },
+       [GSBI9_RESET] = { 0x2adc },
+       [GSBI10_RESET] = { 0x2afc },
+       [GSBI11_RESET] = { 0x2b1c },
+       [GSBI12_RESET] = { 0x2b3c },
+       [SPDM_RESET] = { 0x2b6c },
+       [SEC_CTRL_RESET] = { 0x2b80, 7 },
+       [TLMM_H_RESET] = { 0x2ba0, 7 },
+       [TLMM_RESET] = { 0x2ba4, 7 },
+       [MARRM_PWRON_RESET] = { 0x2bd4, 1 },
+       [MARM_RESET] = { 0x2bd4 },
+       [MAHB1_RESET] = { 0x2be4, 7 },
+       [SFAB_MSS_S_RESET] = { 0x2c00, 7 },
+       [MAHB2_RESET] = { 0x2c20, 7 },
+       [MODEM_SW_AHB_RESET] = { 0x2c48, 1 },
+       [MODEM_RESET] = { 0x2c48 },
+       [SFAB_MSS_MDM1_RESET] = { 0x2c4c, 1 },
+       [SFAB_MSS_MDM0_RESET] = { 0x2c4c },
+       [MSS_SLP_RESET] = { 0x2c60, 7 },
+       [MSS_MARM_SAW_RESET] = { 0x2c68, 1 },
+       [MSS_WDOG_RESET] = { 0x2c68 },
+       [TSSC_RESET] = { 0x2ca0, 7 },
+       [PDM_RESET] = { 0x2cc0, 12 },
+       [SCSS_CORE0_RESET] = { 0x2d60, 1 },
+       [SCSS_CORE0_POR_RESET] = { 0x2d60 },
+       [SCSS_CORE1_RESET] = { 0x2d80, 1 },
+       [SCSS_CORE1_POR_RESET] = { 0x2d80 },
+       [MPM_RESET] = { 0x2da4, 1 },
+       [EBI1_1X_DIV_RESET] = { 0x2dec, 9 },
+       [EBI1_RESET] = { 0x2dec, 7 },
+       [SFAB_SMPSS_S_RESET] = { 0x2e00, 7 },
+       [USB_PHY0_RESET] = { 0x2e20 },
+       [USB_PHY1_RESET] = { 0x2e40 },
+       [PRNG_RESET] = { 0x2e80, 12 },
+};
+
+static const struct regmap_config gcc_msm8660_regmap_config = {
+       .reg_bits       = 32,
+       .reg_stride     = 4,
+       .val_bits       = 32,
+       .max_register   = 0x363c,
+       .fast_io        = true,
+};
+
+static const struct of_device_id gcc_msm8660_match_table[] = {
+       { .compatible = "qcom,gcc-msm8660" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, gcc_msm8660_match_table);
+
+struct qcom_cc {
+       struct qcom_reset_controller reset;
+       struct clk_onecell_data data;
+       struct clk *clks[];
+};
+
+static int gcc_msm8660_probe(struct platform_device *pdev)
+{
+       void __iomem *base;
+       struct resource *res;
+       int i, ret;
+       struct device *dev = &pdev->dev;
+       struct clk *clk;
+       struct clk_onecell_data *data;
+       struct clk **clks;
+       struct regmap *regmap;
+       size_t num_clks;
+       struct qcom_reset_controller *reset;
+       struct qcom_cc *cc;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       base = devm_ioremap_resource(dev, res);
+       if (IS_ERR(base))
+               return PTR_ERR(base);
+
+       regmap = devm_regmap_init_mmio(dev, base, &gcc_msm8660_regmap_config);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       num_clks = ARRAY_SIZE(gcc_msm8660_clks);
+       cc = devm_kzalloc(dev, sizeof(*cc) + sizeof(*clks) * num_clks,
+                         GFP_KERNEL);
+       if (!cc)
+               return -ENOMEM;
+
+       clks = cc->clks;
+       data = &cc->data;
+       data->clks = clks;
+       data->clk_num = num_clks;
+
+       /* Temporary until RPM clocks supported */
+       clk = clk_register_fixed_rate(dev, "cxo", NULL, CLK_IS_ROOT, 19200000);
+       if (IS_ERR(clk))
+               return PTR_ERR(clk);
+
+       clk = clk_register_fixed_rate(dev, "pxo", NULL, CLK_IS_ROOT, 27000000);
+       if (IS_ERR(clk))
+               return PTR_ERR(clk);
+
+       for (i = 0; i < num_clks; i++) {
+               if (!gcc_msm8660_clks[i])
+                       continue;
+               clk = devm_clk_register_regmap(dev, gcc_msm8660_clks[i]);
+               if (IS_ERR(clk))
+                       return PTR_ERR(clk);
+               clks[i] = clk;
+       }
+
+       ret = of_clk_add_provider(dev->of_node, of_clk_src_onecell_get, data);
+       if (ret)
+               return ret;
+
+       reset = &cc->reset;
+       reset->rcdev.of_node = dev->of_node;
+       reset->rcdev.ops = &qcom_reset_ops,
+       reset->rcdev.owner = THIS_MODULE,
+       reset->rcdev.nr_resets = ARRAY_SIZE(gcc_msm8660_resets),
+       reset->regmap = regmap;
+       reset->reset_map = gcc_msm8660_resets,
+       platform_set_drvdata(pdev, &reset->rcdev);
+
+       ret = reset_controller_register(&reset->rcdev);
+       if (ret)
+               of_clk_del_provider(dev->of_node);
+
+       return ret;
+}
+
+static int gcc_msm8660_remove(struct platform_device *pdev)
+{
+       of_clk_del_provider(pdev->dev.of_node);
+       reset_controller_unregister(platform_get_drvdata(pdev));
+       return 0;
+}
+
+static struct platform_driver gcc_msm8660_driver = {
+       .probe          = gcc_msm8660_probe,
+       .remove         = gcc_msm8660_remove,
+       .driver         = {
+               .name   = "gcc-msm8660",
+               .owner  = THIS_MODULE,
+               .of_match_table = gcc_msm8660_match_table,
+       },
+};
+
+static int __init gcc_msm8660_init(void)
+{
+       return platform_driver_register(&gcc_msm8660_driver);
+}
+core_initcall(gcc_msm8660_init);
+
+static void __exit gcc_msm8660_exit(void)
+{
+       platform_driver_unregister(&gcc_msm8660_driver);
+}
+module_exit(gcc_msm8660_exit);
+
+MODULE_DESCRIPTION("GCC MSM 8660 Driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:gcc-msm8660");
diff --git a/drivers/clk/qcom/gcc-msm8960.c b/drivers/clk/qcom/gcc-msm8960.c
new file mode 100644 (file)
index 0000000..fd446ab
--- /dev/null
@@ -0,0 +1,2993 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+#include <linux/reset-controller.h>
+
+#include <dt-bindings/clock/qcom,gcc-msm8960.h>
+#include <dt-bindings/reset/qcom,gcc-msm8960.h>
+
+#include "clk-regmap.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-branch.h"
+#include "reset.h"
+
+static struct clk_pll pll3 = {
+       .l_reg = 0x3164,
+       .m_reg = 0x3168,
+       .n_reg = 0x316c,
+       .config_reg = 0x3174,
+       .mode_reg = 0x3160,
+       .status_reg = 0x3178,
+       .status_bit = 16,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "pll3",
+               .parent_names = (const char *[]){ "pxo" },
+               .num_parents = 1,
+               .ops = &clk_pll_ops,
+       },
+};
+
+static struct clk_pll pll8 = {
+       .l_reg = 0x3144,
+       .m_reg = 0x3148,
+       .n_reg = 0x314c,
+       .config_reg = 0x3154,
+       .mode_reg = 0x3140,
+       .status_reg = 0x3158,
+       .status_bit = 16,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "pll8",
+               .parent_names = (const char *[]){ "pxo" },
+               .num_parents = 1,
+               .ops = &clk_pll_ops,
+       },
+};
+
+static struct clk_regmap pll8_vote = {
+       .enable_reg = 0x34c0,
+       .enable_mask = BIT(8),
+       .hw.init = &(struct clk_init_data){
+               .name = "pll8_vote",
+               .parent_names = (const char *[]){ "pll8" },
+               .num_parents = 1,
+               .ops = &clk_pll_vote_ops,
+       },
+};
+
+static struct clk_pll pll14 = {
+       .l_reg = 0x31c4,
+       .m_reg = 0x31c8,
+       .n_reg = 0x31cc,
+       .config_reg = 0x31d4,
+       .mode_reg = 0x31c0,
+       .status_reg = 0x31d8,
+       .status_bit = 16,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "pll14",
+               .parent_names = (const char *[]){ "pxo" },
+               .num_parents = 1,
+               .ops = &clk_pll_ops,
+       },
+};
+
+static struct clk_regmap pll14_vote = {
+       .enable_reg = 0x34c0,
+       .enable_mask = BIT(14),
+       .hw.init = &(struct clk_init_data){
+               .name = "pll14_vote",
+               .parent_names = (const char *[]){ "pll14" },
+               .num_parents = 1,
+               .ops = &clk_pll_vote_ops,
+       },
+};
+
+#define P_PXO  0
+#define P_PLL8 1
+#define P_CXO  2
+
+static const u8 gcc_pxo_pll8_map[] = {
+       [P_PXO]         = 0,
+       [P_PLL8]        = 3,
+};
+
+static const char *gcc_pxo_pll8[] = {
+       "pxo",
+       "pll8_vote",
+};
+
+static const u8 gcc_pxo_pll8_cxo_map[] = {
+       [P_PXO]         = 0,
+       [P_PLL8]        = 3,
+       [P_CXO]         = 5,
+};
+
+static const char *gcc_pxo_pll8_cxo[] = {
+       "pxo",
+       "pll8_vote",
+       "cxo",
+};
+
+static struct freq_tbl clk_tbl_gsbi_uart[] = {
+       {  1843200, P_PLL8, 2,  6, 625 },
+       {  3686400, P_PLL8, 2, 12, 625 },
+       {  7372800, P_PLL8, 2, 24, 625 },
+       { 14745600, P_PLL8, 2, 48, 625 },
+       { 16000000, P_PLL8, 4,  1,   6 },
+       { 24000000, P_PLL8, 4,  1,   4 },
+       { 32000000, P_PLL8, 4,  1,   3 },
+       { 40000000, P_PLL8, 1,  5,  48 },
+       { 46400000, P_PLL8, 1, 29, 240 },
+       { 48000000, P_PLL8, 4,  1,   2 },
+       { 51200000, P_PLL8, 1,  2,  15 },
+       { 56000000, P_PLL8, 1,  7,  48 },
+       { 58982400, P_PLL8, 1, 96, 625 },
+       { 64000000, P_PLL8, 2,  1,   3 },
+       { }
+};
+
+static struct clk_rcg gsbi1_uart_src = {
+       .ns_reg = 0x29d4,
+       .md_reg = 0x29d0,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x29d4,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi1_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi1_uart_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x29d4,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi1_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi1_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi2_uart_src = {
+       .ns_reg = 0x29f4,
+       .md_reg = 0x29f0,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x29f4,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi2_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi2_uart_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 6,
+       .clkr = {
+               .enable_reg = 0x29f4,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi2_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi2_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi3_uart_src = {
+       .ns_reg = 0x2a14,
+       .md_reg = 0x2a10,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2a14,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi3_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi3_uart_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 2,
+       .clkr = {
+               .enable_reg = 0x2a14,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi3_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi3_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi4_uart_src = {
+       .ns_reg = 0x2a34,
+       .md_reg = 0x2a30,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2a34,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi4_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi4_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 26,
+       .clkr = {
+               .enable_reg = 0x2a34,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi4_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi4_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi5_uart_src = {
+       .ns_reg = 0x2a54,
+       .md_reg = 0x2a50,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2a54,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi5_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi5_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 22,
+       .clkr = {
+               .enable_reg = 0x2a54,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi5_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi5_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi6_uart_src = {
+       .ns_reg = 0x2a74,
+       .md_reg = 0x2a70,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2a74,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi6_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi6_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 18,
+       .clkr = {
+               .enable_reg = 0x2a74,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi6_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi6_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi7_uart_src = {
+       .ns_reg = 0x2a94,
+       .md_reg = 0x2a90,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2a94,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi7_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi7_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 14,
+       .clkr = {
+               .enable_reg = 0x2a94,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi7_uart_clk",
+                       .parent_names = (const char *[]){
+                               "gsbi7_uart_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi8_uart_src = {
+       .ns_reg = 0x2ab4,
+       .md_reg = 0x2ab0,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2ab4,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi8_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi8_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x2ab4,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi8_uart_clk",
+                       .parent_names = (const char *[]){ "gsbi8_uart_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi9_uart_src = {
+       .ns_reg = 0x2ad4,
+       .md_reg = 0x2ad0,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2ad4,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi9_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi9_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 6,
+       .clkr = {
+               .enable_reg = 0x2ad4,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi9_uart_clk",
+                       .parent_names = (const char *[]){ "gsbi9_uart_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi10_uart_src = {
+       .ns_reg = 0x2af4,
+       .md_reg = 0x2af0,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2af4,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi10_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi10_uart_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 2,
+       .clkr = {
+               .enable_reg = 0x2af4,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi10_uart_clk",
+                       .parent_names = (const char *[]){ "gsbi10_uart_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi11_uart_src = {
+       .ns_reg = 0x2b14,
+       .md_reg = 0x2b10,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2b14,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi11_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi11_uart_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 17,
+       .clkr = {
+               .enable_reg = 0x2b14,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi11_uart_clk",
+                       .parent_names = (const char *[]){ "gsbi11_uart_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi12_uart_src = {
+       .ns_reg = 0x2b34,
+       .md_reg = 0x2b30,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_uart,
+       .clkr = {
+               .enable_reg = 0x2b34,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi12_uart_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi12_uart_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 13,
+       .clkr = {
+               .enable_reg = 0x2b34,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi12_uart_clk",
+                       .parent_names = (const char *[]){ "gsbi12_uart_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_gsbi_qup[] = {
+       {  1100000, P_PXO,  1, 2, 49 },
+       {  5400000, P_PXO,  1, 1,  5 },
+       { 10800000, P_PXO,  1, 2,  5 },
+       { 15060000, P_PLL8, 1, 2, 51 },
+       { 24000000, P_PLL8, 4, 1,  4 },
+       { 25600000, P_PLL8, 1, 1, 15 },
+       { 27000000, P_PXO,  1, 0,  0 },
+       { 48000000, P_PLL8, 4, 1,  2 },
+       { 51200000, P_PLL8, 1, 2, 15 },
+       { }
+};
+
+static struct clk_rcg gsbi1_qup_src = {
+       .ns_reg = 0x29cc,
+       .md_reg = 0x29c8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x29cc,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi1_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi1_qup_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 9,
+       .clkr = {
+               .enable_reg = 0x29cc,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi1_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi1_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi2_qup_src = {
+       .ns_reg = 0x29ec,
+       .md_reg = 0x29e8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x29ec,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi2_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi2_qup_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 4,
+       .clkr = {
+               .enable_reg = 0x29ec,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi2_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi2_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi3_qup_src = {
+       .ns_reg = 0x2a0c,
+       .md_reg = 0x2a08,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2a0c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi3_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi3_qup_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 0,
+       .clkr = {
+               .enable_reg = 0x2a0c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi3_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi3_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi4_qup_src = {
+       .ns_reg = 0x2a2c,
+       .md_reg = 0x2a28,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2a2c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi4_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi4_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 24,
+       .clkr = {
+               .enable_reg = 0x2a2c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi4_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi4_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi5_qup_src = {
+       .ns_reg = 0x2a4c,
+       .md_reg = 0x2a48,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2a4c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi5_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi5_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 20,
+       .clkr = {
+               .enable_reg = 0x2a4c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi5_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi5_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi6_qup_src = {
+       .ns_reg = 0x2a6c,
+       .md_reg = 0x2a68,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2a6c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi6_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi6_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 16,
+       .clkr = {
+               .enable_reg = 0x2a6c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi6_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi6_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi7_qup_src = {
+       .ns_reg = 0x2a8c,
+       .md_reg = 0x2a88,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2a8c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi7_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi7_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 12,
+       .clkr = {
+               .enable_reg = 0x2a8c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi7_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi7_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi8_qup_src = {
+       .ns_reg = 0x2aac,
+       .md_reg = 0x2aa8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2aac,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi8_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi8_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 8,
+       .clkr = {
+               .enable_reg = 0x2aac,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi8_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi8_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi9_qup_src = {
+       .ns_reg = 0x2acc,
+       .md_reg = 0x2ac8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2acc,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi9_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi9_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 4,
+       .clkr = {
+               .enable_reg = 0x2acc,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi9_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi9_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi10_qup_src = {
+       .ns_reg = 0x2aec,
+       .md_reg = 0x2ae8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2aec,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi10_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi10_qup_clk = {
+       .halt_reg = 0x2fd0,
+       .halt_bit = 0,
+       .clkr = {
+               .enable_reg = 0x2aec,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi10_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi10_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi11_qup_src = {
+       .ns_reg = 0x2b0c,
+       .md_reg = 0x2b08,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2b0c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi11_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi11_qup_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 15,
+       .clkr = {
+               .enable_reg = 0x2b0c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi11_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi11_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gsbi12_qup_src = {
+       .ns_reg = 0x2b2c,
+       .md_reg = 0x2b28,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_gsbi_qup,
+       .clkr = {
+               .enable_reg = 0x2b2c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi12_qup_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       },
+};
+
+static struct clk_branch gsbi12_qup_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 11,
+       .clkr = {
+               .enable_reg = 0x2b2c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi12_qup_clk",
+                       .parent_names = (const char *[]){ "gsbi12_qup_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static const struct freq_tbl clk_tbl_gp[] = {
+       { 9600000, P_CXO,  2, 0, 0 },
+       { 13500000, P_PXO,  2, 0, 0 },
+       { 19200000, P_CXO,  1, 0, 0 },
+       { 27000000, P_PXO,  1, 0, 0 },
+       { 64000000, P_PLL8, 2, 1, 3 },
+       { 76800000, P_PLL8, 1, 1, 5 },
+       { 96000000, P_PLL8, 4, 0, 0 },
+       { 128000000, P_PLL8, 3, 0, 0 },
+       { 192000000, P_PLL8, 2, 0, 0 },
+       { }
+};
+
+static struct clk_rcg gp0_src = {
+       .ns_reg = 0x2d24,
+       .md_reg = 0x2d00,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_cxo_map,
+       },
+       .freq_tbl = clk_tbl_gp,
+       .clkr = {
+               .enable_reg = 0x2d24,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp0_src",
+                       .parent_names = gcc_pxo_pll8_cxo,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_PARENT_GATE,
+               },
+       }
+};
+
+static struct clk_branch gp0_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x2d24,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp0_clk",
+                       .parent_names = (const char *[]){ "gp0_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gp1_src = {
+       .ns_reg = 0x2d44,
+       .md_reg = 0x2d40,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_cxo_map,
+       },
+       .freq_tbl = clk_tbl_gp,
+       .clkr = {
+               .enable_reg = 0x2d44,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp1_src",
+                       .parent_names = gcc_pxo_pll8_cxo,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch gp1_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_bit = 6,
+       .clkr = {
+               .enable_reg = 0x2d44,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp1_clk",
+                       .parent_names = (const char *[]){ "gp1_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg gp2_src = {
+       .ns_reg = 0x2d64,
+       .md_reg = 0x2d60,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_cxo_map,
+       },
+       .freq_tbl = clk_tbl_gp,
+       .clkr = {
+               .enable_reg = 0x2d64,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp2_src",
+                       .parent_names = gcc_pxo_pll8_cxo,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch gp2_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_bit = 5,
+       .clkr = {
+               .enable_reg = 0x2d64,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gp2_clk",
+                       .parent_names = (const char *[]){ "gp2_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch pmem_clk = {
+       .hwcg_reg = 0x25a0,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fc8,
+       .halt_bit = 20,
+       .clkr = {
+               .enable_reg = 0x25a0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "pmem_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_rcg prng_src = {
+       .ns_reg = 0x2e80,
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 4,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .clkr = {
+               .hw.init = &(struct clk_init_data){
+                       .name = "prng_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch prng_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(10),
+               .hw.init = &(struct clk_init_data){
+                       .name = "prng_clk",
+                       .parent_names = (const char *[]){ "prng_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+               },
+       },
+};
+
+static const struct freq_tbl clk_tbl_sdc[] = {
+       {    144000, P_PXO,   3, 2, 125 },
+       {    400000, P_PLL8,  4, 1, 240 },
+       {  16000000, P_PLL8,  4, 1,   6 },
+       {  17070000, P_PLL8,  1, 2,  45 },
+       {  20210000, P_PLL8,  1, 1,  19 },
+       {  24000000, P_PLL8,  4, 1,   4 },
+       {  48000000, P_PLL8,  4, 1,   2 },
+       {  64000000, P_PLL8,  3, 1,   2 },
+       {  96000000, P_PLL8,  4, 0,   0 },
+       { 192000000, P_PLL8,  2, 0,   0 },
+       { }
+};
+
+static struct clk_rcg sdc1_src = {
+       .ns_reg = 0x282c,
+       .md_reg = 0x2828,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_sdc,
+       .clkr = {
+               .enable_reg = 0x282c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc1_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch sdc1_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 6,
+       .clkr = {
+               .enable_reg = 0x282c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc1_clk",
+                       .parent_names = (const char *[]){ "sdc1_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg sdc2_src = {
+       .ns_reg = 0x284c,
+       .md_reg = 0x2848,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_sdc,
+       .clkr = {
+               .enable_reg = 0x284c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc2_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch sdc2_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 5,
+       .clkr = {
+               .enable_reg = 0x284c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc2_clk",
+                       .parent_names = (const char *[]){ "sdc2_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg sdc3_src = {
+       .ns_reg = 0x286c,
+       .md_reg = 0x2868,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_sdc,
+       .clkr = {
+               .enable_reg = 0x286c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc3_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch sdc3_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 4,
+       .clkr = {
+               .enable_reg = 0x286c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc3_clk",
+                       .parent_names = (const char *[]){ "sdc3_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg sdc4_src = {
+       .ns_reg = 0x288c,
+       .md_reg = 0x2888,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_sdc,
+       .clkr = {
+               .enable_reg = 0x288c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc4_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch sdc4_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 3,
+       .clkr = {
+               .enable_reg = 0x288c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc4_clk",
+                       .parent_names = (const char *[]){ "sdc4_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg sdc5_src = {
+       .ns_reg = 0x28ac,
+       .md_reg = 0x28a8,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_sdc,
+       .clkr = {
+               .enable_reg = 0x28ac,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc5_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch sdc5_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 2,
+       .clkr = {
+               .enable_reg = 0x28ac,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc5_clk",
+                       .parent_names = (const char *[]){ "sdc5_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static const struct freq_tbl clk_tbl_tsif_ref[] = {
+       { 105000, P_PXO,  1, 1, 256 },
+       { }
+};
+
+static struct clk_rcg tsif_ref_src = {
+       .ns_reg = 0x2710,
+       .md_reg = 0x270c,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 16,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_tsif_ref,
+       .clkr = {
+               .enable_reg = 0x2710,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "tsif_ref_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch tsif_ref_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 5,
+       .clkr = {
+               .enable_reg = 0x2710,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "tsif_ref_clk",
+                       .parent_names = (const char *[]){ "tsif_ref_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static const struct freq_tbl clk_tbl_usb[] = {
+       { 60000000, P_PLL8, 1, 5, 32 },
+       { }
+};
+
+static struct clk_rcg usb_hs1_xcvr_src = {
+       .ns_reg = 0x290c,
+       .md_reg = 0x2908,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_usb,
+       .clkr = {
+               .enable_reg = 0x290c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_hs1_xcvr_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static struct clk_branch usb_hs1_xcvr_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 0,
+       .clkr = {
+               .enable_reg = 0x290c,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_hs1_xcvr_clk",
+                       .parent_names = (const char *[]){ "usb_hs1_xcvr_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg usb_hsic_xcvr_fs_src = {
+       .ns_reg = 0x2928,
+       .md_reg = 0x2924,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_usb,
+       .clkr = {
+               .enable_reg = 0x2928,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_hsic_xcvr_fs_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static const char *usb_hsic_xcvr_fs_src_p[] = { "usb_hsic_xcvr_fs_src" };
+
+static struct clk_branch usb_hsic_xcvr_fs_clk = {
+       .halt_reg = 0x2fc8,
+       .halt_bit = 2,
+       .clkr = {
+               .enable_reg = 0x2928,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_hsic_xcvr_fs_clk",
+                       .parent_names = usb_hsic_xcvr_fs_src_p,
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch usb_hsic_system_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 24,
+       .clkr = {
+               .enable_reg = 0x292c,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = usb_hsic_xcvr_fs_src_p,
+                       .num_parents = 1,
+                       .name = "usb_hsic_system_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch usb_hsic_hsic_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 19,
+       .clkr = {
+               .enable_reg = 0x2b44,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = (const char *[]){ "pll14_vote" },
+                       .num_parents = 1,
+                       .name = "usb_hsic_hsic_clk",
+                       .ops = &clk_branch_ops,
+               },
+       },
+};
+
+static struct clk_branch usb_hsic_hsio_cal_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 23,
+       .clkr = {
+               .enable_reg = 0x2b48,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_hsic_hsio_cal_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_rcg usb_fs1_xcvr_fs_src = {
+       .ns_reg = 0x2968,
+       .md_reg = 0x2964,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_usb,
+       .clkr = {
+               .enable_reg = 0x2968,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs1_xcvr_fs_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static const char *usb_fs1_xcvr_fs_src_p[] = { "usb_fs1_xcvr_fs_src" };
+
+static struct clk_branch usb_fs1_xcvr_fs_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 15,
+       .clkr = {
+               .enable_reg = 0x2968,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs1_xcvr_fs_clk",
+                       .parent_names = usb_fs1_xcvr_fs_src_p,
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch usb_fs1_system_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 16,
+       .clkr = {
+               .enable_reg = 0x296c,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = usb_fs1_xcvr_fs_src_p,
+                       .num_parents = 1,
+                       .name = "usb_fs1_system_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg usb_fs2_xcvr_fs_src = {
+       .ns_reg = 0x2988,
+       .md_reg = 0x2984,
+       .mn = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 5,
+               .n_val_shift = 16,
+               .m_val_shift = 16,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 3,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = gcc_pxo_pll8_map,
+       },
+       .freq_tbl = clk_tbl_usb,
+       .clkr = {
+               .enable_reg = 0x2988,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs2_xcvr_fs_src",
+                       .parent_names = gcc_pxo_pll8,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_GATE,
+               },
+       }
+};
+
+static const char *usb_fs2_xcvr_fs_src_p[] = { "usb_fs2_xcvr_fs_src" };
+
+static struct clk_branch usb_fs2_xcvr_fs_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 12,
+       .clkr = {
+               .enable_reg = 0x2988,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs2_xcvr_fs_clk",
+                       .parent_names = usb_fs2_xcvr_fs_src_p,
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch usb_fs2_system_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 13,
+       .clkr = {
+               .enable_reg = 0x298c,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs2_system_clk",
+                       .parent_names = usb_fs2_xcvr_fs_src_p,
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch ce1_core_clk = {
+       .hwcg_reg = 0x2724,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd4,
+       .halt_bit = 27,
+       .clkr = {
+               .enable_reg = 0x2724,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ce1_core_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch ce1_h_clk = {
+       .halt_reg = 0x2fd4,
+       .halt_bit = 1,
+       .clkr = {
+               .enable_reg = 0x2720,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ce1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch dma_bam_h_clk = {
+       .hwcg_reg = 0x25c0,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fc8,
+       .halt_bit = 12,
+       .clkr = {
+               .enable_reg = 0x25c0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "dma_bam_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi1_h_clk = {
+       .hwcg_reg = 0x29c0,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fcc,
+       .halt_bit = 11,
+       .clkr = {
+               .enable_reg = 0x29c0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi2_h_clk = {
+       .hwcg_reg = 0x29e0,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fcc,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x29e0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi2_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi3_h_clk = {
+       .hwcg_reg = 0x2a00,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fcc,
+       .halt_bit = 3,
+       .clkr = {
+               .enable_reg = 0x2a00,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi3_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi4_h_clk = {
+       .hwcg_reg = 0x2a20,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd0,
+       .halt_bit = 27,
+       .clkr = {
+               .enable_reg = 0x2a20,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi4_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi5_h_clk = {
+       .hwcg_reg = 0x2a40,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd0,
+       .halt_bit = 23,
+       .clkr = {
+               .enable_reg = 0x2a40,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi5_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi6_h_clk = {
+       .hwcg_reg = 0x2a60,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd0,
+       .halt_bit = 19,
+       .clkr = {
+               .enable_reg = 0x2a60,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi6_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi7_h_clk = {
+       .hwcg_reg = 0x2a80,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd0,
+       .halt_bit = 15,
+       .clkr = {
+               .enable_reg = 0x2a80,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi7_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi8_h_clk = {
+       .hwcg_reg = 0x2aa0,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd0,
+       .halt_bit = 11,
+       .clkr = {
+               .enable_reg = 0x2aa0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi8_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi9_h_clk = {
+       .hwcg_reg = 0x2ac0,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd0,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x2ac0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi9_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi10_h_clk = {
+       .hwcg_reg = 0x2ae0,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd0,
+       .halt_bit = 3,
+       .clkr = {
+               .enable_reg = 0x2ae0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi10_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi11_h_clk = {
+       .hwcg_reg = 0x2b00,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd4,
+       .halt_bit = 18,
+       .clkr = {
+               .enable_reg = 0x2b00,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi11_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gsbi12_h_clk = {
+       .hwcg_reg = 0x2b20,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd4,
+       .halt_bit = 14,
+       .clkr = {
+               .enable_reg = 0x2b20,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gsbi12_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch tsif_h_clk = {
+       .hwcg_reg = 0x2700,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd4,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x2700,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "tsif_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch usb_fs1_h_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 17,
+       .clkr = {
+               .enable_reg = 0x2960,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch usb_fs2_h_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 14,
+       .clkr = {
+               .enable_reg = 0x2980,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_fs2_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch usb_hs1_h_clk = {
+       .hwcg_reg = 0x2900,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fc8,
+       .halt_bit = 1,
+       .clkr = {
+               .enable_reg = 0x2900,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_hs1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch usb_hsic_h_clk = {
+       .halt_reg = 0x2fcc,
+       .halt_bit = 28,
+       .clkr = {
+               .enable_reg = 0x2920,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "usb_hsic_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch sdc1_h_clk = {
+       .hwcg_reg = 0x2820,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fc8,
+       .halt_bit = 11,
+       .clkr = {
+               .enable_reg = 0x2820,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch sdc2_h_clk = {
+       .hwcg_reg = 0x2840,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fc8,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x2840,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc2_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch sdc3_h_clk = {
+       .hwcg_reg = 0x2860,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fc8,
+       .halt_bit = 9,
+       .clkr = {
+               .enable_reg = 0x2860,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc3_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch sdc4_h_clk = {
+       .hwcg_reg = 0x2880,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fc8,
+       .halt_bit = 8,
+       .clkr = {
+               .enable_reg = 0x2880,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc4_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch sdc5_h_clk = {
+       .hwcg_reg = 0x28a0,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fc8,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x28a0,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "sdc5_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch adm0_clk = {
+       .halt_reg = 0x2fdc,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 14,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "adm0_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch adm0_pbus_clk = {
+       .hwcg_reg = 0x2208,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fdc,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 13,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(3),
+               .hw.init = &(struct clk_init_data){
+                       .name = "adm0_pbus_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch pmic_arb0_h_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 22,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(8),
+               .hw.init = &(struct clk_init_data){
+                       .name = "pmic_arb0_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch pmic_arb1_h_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 21,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "pmic_arb1_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch pmic_ssbi2_clk = {
+       .halt_reg = 0x2fd8,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 23,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(7),
+               .hw.init = &(struct clk_init_data){
+                       .name = "pmic_ssbi2_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch rpm_msg_ram_h_clk = {
+       .hwcg_reg = 0x27e0,
+       .hwcg_bit = 6,
+       .halt_reg = 0x2fd8,
+       .halt_check = BRANCH_HALT_VOTED,
+       .halt_bit = 12,
+       .clkr = {
+               .enable_reg = 0x3080,
+               .enable_mask = BIT(6),
+               .hw.init = &(struct clk_init_data){
+                       .name = "rpm_msg_ram_h_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_regmap *gcc_msm8960_clks[] = {
+       [PLL3] = &pll3.clkr,
+       [PLL8] = &pll8.clkr,
+       [PLL8_VOTE] = &pll8_vote,
+       [PLL14] = &pll14.clkr,
+       [PLL14_VOTE] = &pll14_vote,
+       [GSBI1_UART_SRC] = &gsbi1_uart_src.clkr,
+       [GSBI1_UART_CLK] = &gsbi1_uart_clk.clkr,
+       [GSBI2_UART_SRC] = &gsbi2_uart_src.clkr,
+       [GSBI2_UART_CLK] = &gsbi2_uart_clk.clkr,
+       [GSBI3_UART_SRC] = &gsbi3_uart_src.clkr,
+       [GSBI3_UART_CLK] = &gsbi3_uart_clk.clkr,
+       [GSBI4_UART_SRC] = &gsbi4_uart_src.clkr,
+       [GSBI4_UART_CLK] = &gsbi4_uart_clk.clkr,
+       [GSBI5_UART_SRC] = &gsbi5_uart_src.clkr,
+       [GSBI5_UART_CLK] = &gsbi5_uart_clk.clkr,
+       [GSBI6_UART_SRC] = &gsbi6_uart_src.clkr,
+       [GSBI6_UART_CLK] = &gsbi6_uart_clk.clkr,
+       [GSBI7_UART_SRC] = &gsbi7_uart_src.clkr,
+       [GSBI7_UART_CLK] = &gsbi7_uart_clk.clkr,
+       [GSBI8_UART_SRC] = &gsbi8_uart_src.clkr,
+       [GSBI8_UART_CLK] = &gsbi8_uart_clk.clkr,
+       [GSBI9_UART_SRC] = &gsbi9_uart_src.clkr,
+       [GSBI9_UART_CLK] = &gsbi9_uart_clk.clkr,
+       [GSBI10_UART_SRC] = &gsbi10_uart_src.clkr,
+       [GSBI10_UART_CLK] = &gsbi10_uart_clk.clkr,
+       [GSBI11_UART_SRC] = &gsbi11_uart_src.clkr,
+       [GSBI11_UART_CLK] = &gsbi11_uart_clk.clkr,
+       [GSBI12_UART_SRC] = &gsbi12_uart_src.clkr,
+       [GSBI12_UART_CLK] = &gsbi12_uart_clk.clkr,
+       [GSBI1_QUP_SRC] = &gsbi1_qup_src.clkr,
+       [GSBI1_QUP_CLK] = &gsbi1_qup_clk.clkr,
+       [GSBI2_QUP_SRC] = &gsbi2_qup_src.clkr,
+       [GSBI2_QUP_CLK] = &gsbi2_qup_clk.clkr,
+       [GSBI3_QUP_SRC] = &gsbi3_qup_src.clkr,
+       [GSBI3_QUP_CLK] = &gsbi3_qup_clk.clkr,
+       [GSBI4_QUP_SRC] = &gsbi4_qup_src.clkr,
+       [GSBI4_QUP_CLK] = &gsbi4_qup_clk.clkr,
+       [GSBI5_QUP_SRC] = &gsbi5_qup_src.clkr,
+       [GSBI5_QUP_CLK] = &gsbi5_qup_clk.clkr,
+       [GSBI6_QUP_SRC] = &gsbi6_qup_src.clkr,
+       [GSBI6_QUP_CLK] = &gsbi6_qup_clk.clkr,
+       [GSBI7_QUP_SRC] = &gsbi7_qup_src.clkr,
+       [GSBI7_QUP_CLK] = &gsbi7_qup_clk.clkr,
+       [GSBI8_QUP_SRC] = &gsbi8_qup_src.clkr,
+       [GSBI8_QUP_CLK] = &gsbi8_qup_clk.clkr,
+       [GSBI9_QUP_SRC] = &gsbi9_qup_src.clkr,
+       [GSBI9_QUP_CLK] = &gsbi9_qup_clk.clkr,
+       [GSBI10_QUP_SRC] = &gsbi10_qup_src.clkr,
+       [GSBI10_QUP_CLK] = &gsbi10_qup_clk.clkr,
+       [GSBI11_QUP_SRC] = &gsbi11_qup_src.clkr,
+       [GSBI11_QUP_CLK] = &gsbi11_qup_clk.clkr,
+       [GSBI12_QUP_SRC] = &gsbi12_qup_src.clkr,
+       [GSBI12_QUP_CLK] = &gsbi12_qup_clk.clkr,
+       [GP0_SRC] = &gp0_src.clkr,
+       [GP0_CLK] = &gp0_clk.clkr,
+       [GP1_SRC] = &gp1_src.clkr,
+       [GP1_CLK] = &gp1_clk.clkr,
+       [GP2_SRC] = &gp2_src.clkr,
+       [GP2_CLK] = &gp2_clk.clkr,
+       [PMEM_A_CLK] = &pmem_clk.clkr,
+       [PRNG_SRC] = &prng_src.clkr,
+       [PRNG_CLK] = &prng_clk.clkr,
+       [SDC1_SRC] = &sdc1_src.clkr,
+       [SDC1_CLK] = &sdc1_clk.clkr,
+       [SDC2_SRC] = &sdc2_src.clkr,
+       [SDC2_CLK] = &sdc2_clk.clkr,
+       [SDC3_SRC] = &sdc3_src.clkr,
+       [SDC3_CLK] = &sdc3_clk.clkr,
+       [SDC4_SRC] = &sdc4_src.clkr,
+       [SDC4_CLK] = &sdc4_clk.clkr,
+       [SDC5_SRC] = &sdc5_src.clkr,
+       [SDC5_CLK] = &sdc5_clk.clkr,
+       [TSIF_REF_SRC] = &tsif_ref_src.clkr,
+       [TSIF_REF_CLK] = &tsif_ref_clk.clkr,
+       [USB_HS1_XCVR_SRC] = &usb_hs1_xcvr_src.clkr,
+       [USB_HS1_XCVR_CLK] = &usb_hs1_xcvr_clk.clkr,
+       [USB_HSIC_XCVR_FS_SRC] = &usb_hsic_xcvr_fs_src.clkr,
+       [USB_HSIC_XCVR_FS_CLK] = &usb_hsic_xcvr_fs_clk.clkr,
+       [USB_HSIC_SYSTEM_CLK] = &usb_hsic_system_clk.clkr,
+       [USB_HSIC_HSIC_CLK] = &usb_hsic_hsic_clk.clkr,
+       [USB_HSIC_HSIO_CAL_CLK] = &usb_hsic_hsio_cal_clk.clkr,
+       [USB_FS1_XCVR_FS_SRC] = &usb_fs1_xcvr_fs_src.clkr,
+       [USB_FS1_XCVR_FS_CLK] = &usb_fs1_xcvr_fs_clk.clkr,
+       [USB_FS1_SYSTEM_CLK] = &usb_fs1_system_clk.clkr,
+       [USB_FS2_XCVR_FS_SRC] = &usb_fs2_xcvr_fs_src.clkr,
+       [USB_FS2_XCVR_FS_CLK] = &usb_fs2_xcvr_fs_clk.clkr,
+       [USB_FS2_SYSTEM_CLK] = &usb_fs2_system_clk.clkr,
+       [CE1_CORE_CLK] = &ce1_core_clk.clkr,
+       [CE1_H_CLK] = &ce1_h_clk.clkr,
+       [DMA_BAM_H_CLK] = &dma_bam_h_clk.clkr,
+       [GSBI1_H_CLK] = &gsbi1_h_clk.clkr,
+       [GSBI2_H_CLK] = &gsbi2_h_clk.clkr,
+       [GSBI3_H_CLK] = &gsbi3_h_clk.clkr,
+       [GSBI4_H_CLK] = &gsbi4_h_clk.clkr,
+       [GSBI5_H_CLK] = &gsbi5_h_clk.clkr,
+       [GSBI6_H_CLK] = &gsbi6_h_clk.clkr,
+       [GSBI7_H_CLK] = &gsbi7_h_clk.clkr,
+       [GSBI8_H_CLK] = &gsbi8_h_clk.clkr,
+       [GSBI9_H_CLK] = &gsbi9_h_clk.clkr,
+       [GSBI10_H_CLK] = &gsbi10_h_clk.clkr,
+       [GSBI11_H_CLK] = &gsbi11_h_clk.clkr,
+       [GSBI12_H_CLK] = &gsbi12_h_clk.clkr,
+       [TSIF_H_CLK] = &tsif_h_clk.clkr,
+       [USB_FS1_H_CLK] = &usb_fs1_h_clk.clkr,
+       [USB_FS2_H_CLK] = &usb_fs2_h_clk.clkr,
+       [USB_HS1_H_CLK] = &usb_hs1_h_clk.clkr,
+       [USB_HSIC_H_CLK] = &usb_hsic_h_clk.clkr,
+       [SDC1_H_CLK] = &sdc1_h_clk.clkr,
+       [SDC2_H_CLK] = &sdc2_h_clk.clkr,
+       [SDC3_H_CLK] = &sdc3_h_clk.clkr,
+       [SDC4_H_CLK] = &sdc4_h_clk.clkr,
+       [SDC5_H_CLK] = &sdc5_h_clk.clkr,
+       [ADM0_CLK] = &adm0_clk.clkr,
+       [ADM0_PBUS_CLK] = &adm0_pbus_clk.clkr,
+       [PMIC_ARB0_H_CLK] = &pmic_arb0_h_clk.clkr,
+       [PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr,
+       [PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr,
+       [RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr,
+};
+
+static const struct qcom_reset_map gcc_msm8960_resets[] = {
+       [SFAB_MSS_Q6_SW_RESET] = { 0x2040, 7 },
+       [SFAB_MSS_Q6_FW_RESET] = { 0x2044, 7 },
+       [QDSS_STM_RESET] = { 0x2060, 6 },
+       [AFAB_SMPSS_S_RESET] = { 0x20b8, 2 },
+       [AFAB_SMPSS_M1_RESET] = { 0x20b8, 1 },
+       [AFAB_SMPSS_M0_RESET] = { 0x20b8 },
+       [AFAB_EBI1_CH0_RESET] = { 0x20c0, 7 },
+       [AFAB_EBI1_CH1_RESET] = { 0x20c4, 7},
+       [SFAB_ADM0_M0_RESET] = { 0x21e0, 7 },
+       [SFAB_ADM0_M1_RESET] = { 0x21e4, 7 },
+       [SFAB_ADM0_M2_RESET] = { 0x21e8, 7 },
+       [ADM0_C2_RESET] = { 0x220c, 4},
+       [ADM0_C1_RESET] = { 0x220c, 3},
+       [ADM0_C0_RESET] = { 0x220c, 2},
+       [ADM0_PBUS_RESET] = { 0x220c, 1 },
+       [ADM0_RESET] = { 0x220c },
+       [QDSS_CLKS_SW_RESET] = { 0x2260, 5 },
+       [QDSS_POR_RESET] = { 0x2260, 4 },
+       [QDSS_TSCTR_RESET] = { 0x2260, 3 },
+       [QDSS_HRESET_RESET] = { 0x2260, 2 },
+       [QDSS_AXI_RESET] = { 0x2260, 1 },
+       [QDSS_DBG_RESET] = { 0x2260 },
+       [PCIE_A_RESET] = { 0x22c0, 7 },
+       [PCIE_AUX_RESET] = { 0x22c8, 7 },
+       [PCIE_H_RESET] = { 0x22d0, 7 },
+       [SFAB_PCIE_M_RESET] = { 0x22d4, 1 },
+       [SFAB_PCIE_S_RESET] = { 0x22d4 },
+       [SFAB_MSS_M_RESET] = { 0x2340, 7 },
+       [SFAB_USB3_M_RESET] = { 0x2360, 7 },
+       [SFAB_RIVA_M_RESET] = { 0x2380, 7 },
+       [SFAB_LPASS_RESET] = { 0x23a0, 7 },
+       [SFAB_AFAB_M_RESET] = { 0x23e0, 7 },
+       [AFAB_SFAB_M0_RESET] = { 0x2420, 7 },
+       [AFAB_SFAB_M1_RESET] = { 0x2424, 7 },
+       [SFAB_SATA_S_RESET] = { 0x2480, 7 },
+       [SFAB_DFAB_M_RESET] = { 0x2500, 7 },
+       [DFAB_SFAB_M_RESET] = { 0x2520, 7 },
+       [DFAB_SWAY0_RESET] = { 0x2540, 7 },
+       [DFAB_SWAY1_RESET] = { 0x2544, 7 },
+       [DFAB_ARB0_RESET] = { 0x2560, 7 },
+       [DFAB_ARB1_RESET] = { 0x2564, 7 },
+       [PPSS_PROC_RESET] = { 0x2594, 1 },
+       [PPSS_RESET] = { 0x2594},
+       [DMA_BAM_RESET] = { 0x25c0, 7 },
+       [SIC_TIC_RESET] = { 0x2600, 7 },
+       [SLIMBUS_H_RESET] = { 0x2620, 7 },
+       [SFAB_CFPB_M_RESET] = { 0x2680, 7 },
+       [SFAB_CFPB_S_RESET] = { 0x26c0, 7 },
+       [TSIF_H_RESET] = { 0x2700, 7 },
+       [CE1_H_RESET] = { 0x2720, 7 },
+       [CE1_CORE_RESET] = { 0x2724, 7 },
+       [CE1_SLEEP_RESET] = { 0x2728, 7 },
+       [CE2_H_RESET] = { 0x2740, 7 },
+       [CE2_CORE_RESET] = { 0x2744, 7 },
+       [SFAB_SFPB_M_RESET] = { 0x2780, 7 },
+       [SFAB_SFPB_S_RESET] = { 0x27a0, 7 },
+       [RPM_PROC_RESET] = { 0x27c0, 7 },
+       [PMIC_SSBI2_RESET] = { 0x270c, 12 },
+       [SDC1_RESET] = { 0x2830 },
+       [SDC2_RESET] = { 0x2850 },
+       [SDC3_RESET] = { 0x2870 },
+       [SDC4_RESET] = { 0x2890 },
+       [SDC5_RESET] = { 0x28b0 },
+       [DFAB_A2_RESET] = { 0x28c0, 7 },
+       [USB_HS1_RESET] = { 0x2910 },
+       [USB_HSIC_RESET] = { 0x2934 },
+       [USB_FS1_XCVR_RESET] = { 0x2974, 1 },
+       [USB_FS1_RESET] = { 0x2974 },
+       [USB_FS2_XCVR_RESET] = { 0x2994, 1 },
+       [USB_FS2_RESET] = { 0x2994 },
+       [GSBI1_RESET] = { 0x29dc },
+       [GSBI2_RESET] = { 0x29fc },
+       [GSBI3_RESET] = { 0x2a1c },
+       [GSBI4_RESET] = { 0x2a3c },
+       [GSBI5_RESET] = { 0x2a5c },
+       [GSBI6_RESET] = { 0x2a7c },
+       [GSBI7_RESET] = { 0x2a9c },
+       [GSBI8_RESET] = { 0x2abc },
+       [GSBI9_RESET] = { 0x2adc },
+       [GSBI10_RESET] = { 0x2afc },
+       [GSBI11_RESET] = { 0x2b1c },
+       [GSBI12_RESET] = { 0x2b3c },
+       [SPDM_RESET] = { 0x2b6c },
+       [TLMM_H_RESET] = { 0x2ba0, 7 },
+       [SFAB_MSS_S_RESET] = { 0x2c00, 7 },
+       [MSS_SLP_RESET] = { 0x2c60, 7 },
+       [MSS_Q6SW_JTAG_RESET] = { 0x2c68, 7 },
+       [MSS_Q6FW_JTAG_RESET] = { 0x2c6c, 7 },
+       [MSS_RESET] = { 0x2c64 },
+       [SATA_H_RESET] = { 0x2c80, 7 },
+       [SATA_RXOOB_RESE] = { 0x2c8c, 7 },
+       [SATA_PMALIVE_RESET] = { 0x2c90, 7 },
+       [SATA_SFAB_M_RESET] = { 0x2c98, 7 },
+       [TSSC_RESET] = { 0x2ca0, 7 },
+       [PDM_RESET] = { 0x2cc0, 12 },
+       [MPM_H_RESET] = { 0x2da0, 7 },
+       [MPM_RESET] = { 0x2da4 },
+       [SFAB_SMPSS_S_RESET] = { 0x2e00, 7 },
+       [PRNG_RESET] = { 0x2e80, 12 },
+       [RIVA_RESET] = { 0x35e0 },
+};
+
+static const struct regmap_config gcc_msm8960_regmap_config = {
+       .reg_bits       = 32,
+       .reg_stride     = 4,
+       .val_bits       = 32,
+       .max_register   = 0x3660,
+       .fast_io        = true,
+};
+
+static const struct of_device_id gcc_msm8960_match_table[] = {
+       { .compatible = "qcom,gcc-msm8960" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, gcc_msm8960_match_table);
+
+struct qcom_cc {
+       struct qcom_reset_controller reset;
+       struct clk_onecell_data data;
+       struct clk *clks[];
+};
+
+static int gcc_msm8960_probe(struct platform_device *pdev)
+{
+       void __iomem *base;
+       struct resource *res;
+       int i, ret;
+       struct device *dev = &pdev->dev;
+       struct clk *clk;
+       struct clk_onecell_data *data;
+       struct clk **clks;
+       struct regmap *regmap;
+       size_t num_clks;
+       struct qcom_reset_controller *reset;
+       struct qcom_cc *cc;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       base = devm_ioremap_resource(dev, res);
+       if (IS_ERR(base))
+               return PTR_ERR(base);
+
+       regmap = devm_regmap_init_mmio(dev, base, &gcc_msm8960_regmap_config);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       num_clks = ARRAY_SIZE(gcc_msm8960_clks);
+       cc = devm_kzalloc(dev, sizeof(*cc) + sizeof(*clks) * num_clks,
+                         GFP_KERNEL);
+       if (!cc)
+               return -ENOMEM;
+
+       clks = cc->clks;
+       data = &cc->data;
+       data->clks = clks;
+       data->clk_num = num_clks;
+
+       /* Temporary until RPM clocks supported */
+       clk = clk_register_fixed_rate(dev, "cxo", NULL, CLK_IS_ROOT, 19200000);
+       if (IS_ERR(clk))
+               return PTR_ERR(clk);
+
+       clk = clk_register_fixed_rate(dev, "pxo", NULL, CLK_IS_ROOT, 27000000);
+       if (IS_ERR(clk))
+               return PTR_ERR(clk);
+
+       for (i = 0; i < num_clks; i++) {
+               if (!gcc_msm8960_clks[i])
+                       continue;
+               clk = devm_clk_register_regmap(dev, gcc_msm8960_clks[i]);
+               if (IS_ERR(clk))
+                       return PTR_ERR(clk);
+               clks[i] = clk;
+       }
+
+       ret = of_clk_add_provider(dev->of_node, of_clk_src_onecell_get, data);
+       if (ret)
+               return ret;
+
+       reset = &cc->reset;
+       reset->rcdev.of_node = dev->of_node;
+       reset->rcdev.ops = &qcom_reset_ops,
+       reset->rcdev.owner = THIS_MODULE,
+       reset->rcdev.nr_resets = ARRAY_SIZE(gcc_msm8960_resets),
+       reset->regmap = regmap;
+       reset->reset_map = gcc_msm8960_resets,
+       platform_set_drvdata(pdev, &reset->rcdev);
+
+       ret = reset_controller_register(&reset->rcdev);
+       if (ret)
+               of_clk_del_provider(dev->of_node);
+
+       return ret;
+}
+
+static int gcc_msm8960_remove(struct platform_device *pdev)
+{
+       of_clk_del_provider(pdev->dev.of_node);
+       reset_controller_unregister(platform_get_drvdata(pdev));
+       return 0;
+}
+
+static struct platform_driver gcc_msm8960_driver = {
+       .probe          = gcc_msm8960_probe,
+       .remove         = gcc_msm8960_remove,
+       .driver         = {
+               .name   = "gcc-msm8960",
+               .owner  = THIS_MODULE,
+               .of_match_table = gcc_msm8960_match_table,
+       },
+};
+
+static int __init gcc_msm8960_init(void)
+{
+       return platform_driver_register(&gcc_msm8960_driver);
+}
+core_initcall(gcc_msm8960_init);
+
+static void __exit gcc_msm8960_exit(void)
+{
+       platform_driver_unregister(&gcc_msm8960_driver);
+}
+module_exit(gcc_msm8960_exit);
+
+MODULE_DESCRIPTION("QCOM GCC MSM8960 Driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:gcc-msm8960");
diff --git a/drivers/clk/qcom/gcc-msm8974.c b/drivers/clk/qcom/gcc-msm8974.c
new file mode 100644 (file)
index 0000000..51d457e
--- /dev/null
@@ -0,0 +1,2694 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+#include <linux/reset-controller.h>
+
+#include <dt-bindings/clock/qcom,gcc-msm8974.h>
+#include <dt-bindings/reset/qcom,gcc-msm8974.h>
+
+#include "clk-regmap.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-branch.h"
+#include "reset.h"
+
+#define P_XO   0
+#define P_GPLL0        1
+#define P_GPLL1        1
+
+static const u8 gcc_xo_gpll0_map[] = {
+       [P_XO]          = 0,
+       [P_GPLL0]       = 1,
+};
+
+static const char *gcc_xo_gpll0[] = {
+       "xo",
+       "gpll0_vote",
+};
+
+#define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) }
+
+static struct clk_pll gpll0 = {
+       .l_reg = 0x0004,
+       .m_reg = 0x0008,
+       .n_reg = 0x000c,
+       .config_reg = 0x0014,
+       .mode_reg = 0x0000,
+       .status_reg = 0x001c,
+       .status_bit = 17,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gpll0",
+               .parent_names = (const char *[]){ "xo" },
+               .num_parents = 1,
+               .ops = &clk_pll_ops,
+       },
+};
+
+static struct clk_regmap gpll0_vote = {
+       .enable_reg = 0x1480,
+       .enable_mask = BIT(0),
+       .hw.init = &(struct clk_init_data){
+               .name = "gpll0_vote",
+               .parent_names = (const char *[]){ "gpll0" },
+               .num_parents = 1,
+               .ops = &clk_pll_vote_ops,
+       },
+};
+
+static struct clk_rcg2 config_noc_clk_src = {
+       .cmd_rcgr = 0x0150,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "config_noc_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 periph_noc_clk_src = {
+       .cmd_rcgr = 0x0190,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "periph_noc_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 system_noc_clk_src = {
+       .cmd_rcgr = 0x0120,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "system_noc_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_pll gpll1 = {
+       .l_reg = 0x0044,
+       .m_reg = 0x0048,
+       .n_reg = 0x004c,
+       .config_reg = 0x0054,
+       .mode_reg = 0x0040,
+       .status_reg = 0x005c,
+       .status_bit = 17,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gpll1",
+               .parent_names = (const char *[]){ "xo" },
+               .num_parents = 1,
+               .ops = &clk_pll_ops,
+       },
+};
+
+static struct clk_regmap gpll1_vote = {
+       .enable_reg = 0x1480,
+       .enable_mask = BIT(1),
+       .hw.init = &(struct clk_init_data){
+               .name = "gpll1_vote",
+               .parent_names = (const char *[]){ "gpll1" },
+               .num_parents = 1,
+               .ops = &clk_pll_vote_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_usb30_master_clk[] = {
+       F(125000000, P_GPLL0, 1, 5, 24),
+       { }
+};
+
+static struct clk_rcg2 usb30_master_clk_src = {
+       .cmd_rcgr = 0x03d4,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_usb30_master_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "usb30_master_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk[] = {
+       F(19200000, P_XO, 1, 0, 0),
+       F(37500000, P_GPLL0, 16, 0, 0),
+       F(50000000, P_GPLL0, 12, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 blsp1_qup1_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x0660,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup1_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk[] = {
+       F(960000, P_XO, 10, 1, 2),
+       F(4800000, P_XO, 4, 0, 0),
+       F(9600000, P_XO, 2, 0, 0),
+       F(15000000, P_GPLL0, 10, 1, 4),
+       F(19200000, P_XO, 1, 0, 0),
+       F(25000000, P_GPLL0, 12, 1, 2),
+       F(50000000, P_GPLL0, 12, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 blsp1_qup1_spi_apps_clk_src = {
+       .cmd_rcgr = 0x064c,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup1_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_qup2_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x06e0,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup2_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_qup2_spi_apps_clk_src = {
+       .cmd_rcgr = 0x06cc,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup2_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_qup3_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x0760,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup3_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_qup3_spi_apps_clk_src = {
+       .cmd_rcgr = 0x074c,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup3_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_qup4_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x07e0,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup4_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_qup4_spi_apps_clk_src = {
+       .cmd_rcgr = 0x07cc,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup4_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_qup5_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x0860,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup5_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_qup5_spi_apps_clk_src = {
+       .cmd_rcgr = 0x084c,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup5_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_qup6_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x08e0,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup6_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_qup6_spi_apps_clk_src = {
+       .cmd_rcgr = 0x08cc,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_qup6_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_blsp1_2_uart1_6_apps_clk[] = {
+       F(3686400, P_GPLL0, 1, 96, 15625),
+       F(7372800, P_GPLL0, 1, 192, 15625),
+       F(14745600, P_GPLL0, 1, 384, 15625),
+       F(16000000, P_GPLL0, 5, 2, 15),
+       F(19200000, P_XO, 1, 0, 0),
+       F(24000000, P_GPLL0, 5, 1, 5),
+       F(32000000, P_GPLL0, 1, 4, 75),
+       F(40000000, P_GPLL0, 15, 0, 0),
+       F(46400000, P_GPLL0, 1, 29, 375),
+       F(48000000, P_GPLL0, 12.5, 0, 0),
+       F(51200000, P_GPLL0, 1, 32, 375),
+       F(56000000, P_GPLL0, 1, 7, 75),
+       F(58982400, P_GPLL0, 1, 1536, 15625),
+       F(60000000, P_GPLL0, 10, 0, 0),
+       F(63160000, P_GPLL0, 9.5, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 blsp1_uart1_apps_clk_src = {
+       .cmd_rcgr = 0x068c,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_uart1_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_uart2_apps_clk_src = {
+       .cmd_rcgr = 0x070c,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_uart2_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_uart3_apps_clk_src = {
+       .cmd_rcgr = 0x078c,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_uart3_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_uart4_apps_clk_src = {
+       .cmd_rcgr = 0x080c,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_uart4_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_uart5_apps_clk_src = {
+       .cmd_rcgr = 0x088c,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_uart5_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp1_uart6_apps_clk_src = {
+       .cmd_rcgr = 0x090c,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp1_uart6_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup1_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x09a0,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup1_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup1_spi_apps_clk_src = {
+       .cmd_rcgr = 0x098c,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup1_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup2_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x0a20,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup2_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup2_spi_apps_clk_src = {
+       .cmd_rcgr = 0x0a0c,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup2_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup3_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x0aa0,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup3_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup3_spi_apps_clk_src = {
+       .cmd_rcgr = 0x0a8c,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup3_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup4_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x0b20,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup4_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup4_spi_apps_clk_src = {
+       .cmd_rcgr = 0x0b0c,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup4_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup5_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x0ba0,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup5_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup5_spi_apps_clk_src = {
+       .cmd_rcgr = 0x0b8c,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup5_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup6_i2c_apps_clk_src = {
+       .cmd_rcgr = 0x0c20,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_i2c_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup6_i2c_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_qup6_spi_apps_clk_src = {
+       .cmd_rcgr = 0x0c0c,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_qup1_6_spi_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_qup6_spi_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_uart1_apps_clk_src = {
+       .cmd_rcgr = 0x09cc,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_uart1_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_uart2_apps_clk_src = {
+       .cmd_rcgr = 0x0a4c,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_uart2_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_uart3_apps_clk_src = {
+       .cmd_rcgr = 0x0acc,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_uart3_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_uart4_apps_clk_src = {
+       .cmd_rcgr = 0x0b4c,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_uart4_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_uart5_apps_clk_src = {
+       .cmd_rcgr = 0x0bcc,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_uart5_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 blsp2_uart6_apps_clk_src = {
+       .cmd_rcgr = 0x0c4c,
+       .mnd_width = 16,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "blsp2_uart6_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_ce1_clk[] = {
+       F(50000000, P_GPLL0, 12, 0, 0),
+       F(75000000, P_GPLL0, 8, 0, 0),
+       F(100000000, P_GPLL0, 6, 0, 0),
+       F(150000000, P_GPLL0, 4, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 ce1_clk_src = {
+       .cmd_rcgr = 0x1050,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_ce1_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "ce1_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_ce2_clk[] = {
+       F(50000000, P_GPLL0, 12, 0, 0),
+       F(75000000, P_GPLL0, 8, 0, 0),
+       F(100000000, P_GPLL0, 6, 0, 0),
+       F(150000000, P_GPLL0, 4, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 ce2_clk_src = {
+       .cmd_rcgr = 0x1090,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_ce2_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "ce2_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_gp_clk[] = {
+       F(4800000, P_XO, 4, 0, 0),
+       F(6000000, P_GPLL0, 10, 1, 10),
+       F(6750000, P_GPLL0, 1, 1, 89),
+       F(8000000, P_GPLL0, 15, 1, 5),
+       F(9600000, P_XO, 2, 0, 0),
+       F(16000000, P_GPLL0, 1, 2, 75),
+       F(19200000, P_XO, 1, 0, 0),
+       F(24000000, P_GPLL0, 5, 1, 5),
+       { }
+};
+
+
+static struct clk_rcg2 gp1_clk_src = {
+       .cmd_rcgr = 0x1904,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_gp_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gp1_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 gp2_clk_src = {
+       .cmd_rcgr = 0x1944,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_gp_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gp2_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 gp3_clk_src = {
+       .cmd_rcgr = 0x1984,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_gp_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gp3_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_pdm2_clk[] = {
+       F(60000000, P_GPLL0, 10, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 pdm2_clk_src = {
+       .cmd_rcgr = 0x0cd0,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_pdm2_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "pdm2_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_sdcc1_4_apps_clk[] = {
+       F(144000, P_XO, 16, 3, 25),
+       F(400000, P_XO, 12, 1, 4),
+       F(20000000, P_GPLL0, 15, 1, 2),
+       F(25000000, P_GPLL0, 12, 1, 2),
+       F(50000000, P_GPLL0, 12, 0, 0),
+       F(100000000, P_GPLL0, 6, 0, 0),
+       F(200000000, P_GPLL0, 3, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 sdcc1_apps_clk_src = {
+       .cmd_rcgr = 0x04d0,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_sdcc1_4_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "sdcc1_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 sdcc2_apps_clk_src = {
+       .cmd_rcgr = 0x0510,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_sdcc1_4_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "sdcc2_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 sdcc3_apps_clk_src = {
+       .cmd_rcgr = 0x0550,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_sdcc1_4_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "sdcc3_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 sdcc4_apps_clk_src = {
+       .cmd_rcgr = 0x0590,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_sdcc1_4_apps_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "sdcc4_apps_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_tsif_ref_clk[] = {
+       F(105000, P_XO, 2, 1, 91),
+       { }
+};
+
+static struct clk_rcg2 tsif_ref_clk_src = {
+       .cmd_rcgr = 0x0d90,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_tsif_ref_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "tsif_ref_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_usb30_mock_utmi_clk[] = {
+       F(60000000, P_GPLL0, 10, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 usb30_mock_utmi_clk_src = {
+       .cmd_rcgr = 0x03e8,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_usb30_mock_utmi_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "usb30_mock_utmi_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_usb_hs_system_clk[] = {
+       F(60000000, P_GPLL0, 10, 0, 0),
+       F(75000000, P_GPLL0, 8, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 usb_hs_system_clk_src = {
+       .cmd_rcgr = 0x0490,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_usb_hs_system_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "usb_hs_system_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_usb_hsic_clk[] = {
+       F(480000000, P_GPLL1, 1, 0, 0),
+       { }
+};
+
+static u8 usb_hsic_clk_src_map[] = {
+       [P_XO]          = 0,
+       [P_GPLL1]       = 4,
+};
+
+static struct clk_rcg2 usb_hsic_clk_src = {
+       .cmd_rcgr = 0x0440,
+       .hid_width = 5,
+       .parent_map = usb_hsic_clk_src_map,
+       .freq_tbl = ftbl_gcc_usb_hsic_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "usb_hsic_clk_src",
+               .parent_names = (const char *[]){
+                       "xo",
+                       "gpll1_vote",
+               },
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_usb_hsic_io_cal_clk[] = {
+       F(9600000, P_XO, 2, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 usb_hsic_io_cal_clk_src = {
+       .cmd_rcgr = 0x0458,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_usb_hsic_io_cal_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "usb_hsic_io_cal_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 1,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static const struct freq_tbl ftbl_gcc_usb_hsic_system_clk[] = {
+       F(60000000, P_GPLL0, 10, 0, 0),
+       F(75000000, P_GPLL0, 8, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 usb_hsic_system_clk_src = {
+       .cmd_rcgr = 0x041c,
+       .hid_width = 5,
+       .parent_map = gcc_xo_gpll0_map,
+       .freq_tbl = ftbl_gcc_usb_hsic_system_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "usb_hsic_system_clk_src",
+               .parent_names = gcc_xo_gpll0,
+               .num_parents = 2,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_regmap gcc_mmss_gpll0_clk_src = {
+       .enable_reg = 0x1484,
+       .enable_mask = BIT(26),
+       .hw.init = &(struct clk_init_data){
+               .name = "mmss_gpll0_vote",
+               .parent_names = (const char *[]){
+                       "gpll0_vote",
+               },
+               .num_parents = 1,
+               .ops = &clk_branch_simple_ops,
+       },
+};
+
+static struct clk_branch gcc_bam_dma_ahb_clk = {
+       .halt_reg = 0x0d44,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x1484,
+               .enable_mask = BIT(12),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_bam_dma_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_ahb_clk = {
+       .halt_reg = 0x05c4,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x1484,
+               .enable_mask = BIT(17),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup1_i2c_apps_clk = {
+       .halt_reg = 0x0648,
+       .clkr = {
+               .enable_reg = 0x0648,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup1_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup1_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup1_spi_apps_clk = {
+       .halt_reg = 0x0644,
+       .clkr = {
+               .enable_reg = 0x0644,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup1_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup1_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup2_i2c_apps_clk = {
+       .halt_reg = 0x06c8,
+       .clkr = {
+               .enable_reg = 0x06c8,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup2_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup2_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup2_spi_apps_clk = {
+       .halt_reg = 0x06c4,
+       .clkr = {
+               .enable_reg = 0x06c4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup2_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup2_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup3_i2c_apps_clk = {
+       .halt_reg = 0x0748,
+       .clkr = {
+               .enable_reg = 0x0748,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup3_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup3_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup3_spi_apps_clk = {
+       .halt_reg = 0x0744,
+       .clkr = {
+               .enable_reg = 0x0744,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup3_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup3_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup4_i2c_apps_clk = {
+       .halt_reg = 0x07c8,
+       .clkr = {
+               .enable_reg = 0x07c8,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup4_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup4_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup4_spi_apps_clk = {
+       .halt_reg = 0x07c4,
+       .clkr = {
+               .enable_reg = 0x07c4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup4_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup4_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup5_i2c_apps_clk = {
+       .halt_reg = 0x0848,
+       .clkr = {
+               .enable_reg = 0x0848,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup5_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup5_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup5_spi_apps_clk = {
+       .halt_reg = 0x0844,
+       .clkr = {
+               .enable_reg = 0x0844,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup5_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup5_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup6_i2c_apps_clk = {
+       .halt_reg = 0x08c8,
+       .clkr = {
+               .enable_reg = 0x08c8,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup6_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup6_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_qup6_spi_apps_clk = {
+       .halt_reg = 0x08c4,
+       .clkr = {
+               .enable_reg = 0x08c4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_qup6_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_qup6_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_uart1_apps_clk = {
+       .halt_reg = 0x0684,
+       .clkr = {
+               .enable_reg = 0x0684,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_uart1_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_uart1_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_uart2_apps_clk = {
+       .halt_reg = 0x0704,
+       .clkr = {
+               .enable_reg = 0x0704,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_uart2_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_uart2_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_uart3_apps_clk = {
+       .halt_reg = 0x0784,
+       .clkr = {
+               .enable_reg = 0x0784,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_uart3_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_uart3_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_uart4_apps_clk = {
+       .halt_reg = 0x0804,
+       .clkr = {
+               .enable_reg = 0x0804,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_uart4_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_uart4_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_uart5_apps_clk = {
+       .halt_reg = 0x0884,
+       .clkr = {
+               .enable_reg = 0x0884,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_uart5_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_uart5_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp1_uart6_apps_clk = {
+       .halt_reg = 0x0904,
+       .clkr = {
+               .enable_reg = 0x0904,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp1_uart6_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp1_uart6_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_ahb_clk = {
+       .halt_reg = 0x05c4,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x1484,
+               .enable_mask = BIT(15),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup1_i2c_apps_clk = {
+       .halt_reg = 0x0988,
+       .clkr = {
+               .enable_reg = 0x0988,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup1_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup1_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup1_spi_apps_clk = {
+       .halt_reg = 0x0984,
+       .clkr = {
+               .enable_reg = 0x0984,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup1_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup1_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup2_i2c_apps_clk = {
+       .halt_reg = 0x0a08,
+       .clkr = {
+               .enable_reg = 0x0a08,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup2_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup2_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup2_spi_apps_clk = {
+       .halt_reg = 0x0a04,
+       .clkr = {
+               .enable_reg = 0x0a04,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup2_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup2_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup3_i2c_apps_clk = {
+       .halt_reg = 0x0a88,
+       .clkr = {
+               .enable_reg = 0x0a88,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup3_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup3_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup3_spi_apps_clk = {
+       .halt_reg = 0x0a84,
+       .clkr = {
+               .enable_reg = 0x0a84,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup3_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup3_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup4_i2c_apps_clk = {
+       .halt_reg = 0x0b08,
+       .clkr = {
+               .enable_reg = 0x0b08,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup4_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup4_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup4_spi_apps_clk = {
+       .halt_reg = 0x0b04,
+       .clkr = {
+               .enable_reg = 0x0b04,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup4_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup4_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup5_i2c_apps_clk = {
+       .halt_reg = 0x0b88,
+       .clkr = {
+               .enable_reg = 0x0b88,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup5_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup5_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup5_spi_apps_clk = {
+       .halt_reg = 0x0b84,
+       .clkr = {
+               .enable_reg = 0x0b84,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup5_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup5_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup6_i2c_apps_clk = {
+       .halt_reg = 0x0c08,
+       .clkr = {
+               .enable_reg = 0x0c08,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup6_i2c_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup6_i2c_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_qup6_spi_apps_clk = {
+       .halt_reg = 0x0c04,
+       .clkr = {
+               .enable_reg = 0x0c04,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_qup6_spi_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_qup6_spi_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_uart1_apps_clk = {
+       .halt_reg = 0x09c4,
+       .clkr = {
+               .enable_reg = 0x09c4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_uart1_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_uart1_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_uart2_apps_clk = {
+       .halt_reg = 0x0a44,
+       .clkr = {
+               .enable_reg = 0x0a44,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_uart2_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_uart2_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_uart3_apps_clk = {
+       .halt_reg = 0x0ac4,
+       .clkr = {
+               .enable_reg = 0x0ac4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_uart3_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_uart3_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_uart4_apps_clk = {
+       .halt_reg = 0x0b44,
+       .clkr = {
+               .enable_reg = 0x0b44,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_uart4_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_uart4_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_uart5_apps_clk = {
+       .halt_reg = 0x0bc4,
+       .clkr = {
+               .enable_reg = 0x0bc4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_uart5_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_uart5_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_blsp2_uart6_apps_clk = {
+       .halt_reg = 0x0c44,
+       .clkr = {
+               .enable_reg = 0x0c44,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_blsp2_uart6_apps_clk",
+                       .parent_names = (const char *[]){
+                               "blsp2_uart6_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_boot_rom_ahb_clk = {
+       .halt_reg = 0x0e04,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x1484,
+               .enable_mask = BIT(10),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_boot_rom_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "config_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_ce1_ahb_clk = {
+       .halt_reg = 0x104c,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x1484,
+               .enable_mask = BIT(3),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_ce1_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "config_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_ce1_axi_clk = {
+       .halt_reg = 0x1048,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x1484,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_ce1_axi_clk",
+                       .parent_names = (const char *[]){
+                               "system_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_ce1_clk = {
+       .halt_reg = 0x1050,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x1484,
+               .enable_mask = BIT(5),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_ce1_clk",
+                       .parent_names = (const char *[]){
+                               "ce1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_ce2_ahb_clk = {
+       .halt_reg = 0x108c,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x1484,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_ce2_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "config_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_ce2_axi_clk = {
+       .halt_reg = 0x1088,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x1484,
+               .enable_mask = BIT(1),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_ce2_axi_clk",
+                       .parent_names = (const char *[]){
+                               "system_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_ce2_clk = {
+       .halt_reg = 0x1090,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x1484,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_ce2_clk",
+                       .parent_names = (const char *[]){
+                               "ce2_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_gp1_clk = {
+       .halt_reg = 0x1900,
+       .clkr = {
+               .enable_reg = 0x1900,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_gp1_clk",
+                       .parent_names = (const char *[]){
+                               "gp1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_gp2_clk = {
+       .halt_reg = 0x1940,
+       .clkr = {
+               .enable_reg = 0x1940,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_gp2_clk",
+                       .parent_names = (const char *[]){
+                               "gp2_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_gp3_clk = {
+       .halt_reg = 0x1980,
+       .clkr = {
+               .enable_reg = 0x1980,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_gp3_clk",
+                       .parent_names = (const char *[]){
+                               "gp3_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_lpass_q6_axi_clk = {
+       .halt_reg = 0x11c0,
+       .clkr = {
+               .enable_reg = 0x11c0,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_lpass_q6_axi_clk",
+                       .parent_names = (const char *[]){
+                               "system_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_mmss_noc_cfg_ahb_clk = {
+       .halt_reg = 0x024c,
+       .clkr = {
+               .enable_reg = 0x024c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_mmss_noc_cfg_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "config_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+                       .flags = CLK_IGNORE_UNUSED,
+               },
+       },
+};
+
+static struct clk_branch gcc_ocmem_noc_cfg_ahb_clk = {
+       .halt_reg = 0x0248,
+       .clkr = {
+               .enable_reg = 0x0248,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_ocmem_noc_cfg_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "config_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_mss_cfg_ahb_clk = {
+       .halt_reg = 0x0280,
+       .clkr = {
+               .enable_reg = 0x0280,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_mss_cfg_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "config_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_mss_q6_bimc_axi_clk = {
+       .halt_reg = 0x0284,
+       .clkr = {
+               .enable_reg = 0x0284,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_mss_q6_bimc_axi_clk",
+                       .flags = CLK_IS_ROOT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_pdm2_clk = {
+       .halt_reg = 0x0ccc,
+       .clkr = {
+               .enable_reg = 0x0ccc,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_pdm2_clk",
+                       .parent_names = (const char *[]){
+                               "pdm2_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_pdm_ahb_clk = {
+       .halt_reg = 0x0cc4,
+       .clkr = {
+               .enable_reg = 0x0cc4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_pdm_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_prng_ahb_clk = {
+       .halt_reg = 0x0d04,
+       .halt_check = BRANCH_HALT_VOTED,
+       .clkr = {
+               .enable_reg = 0x1484,
+               .enable_mask = BIT(13),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_prng_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_sdcc1_ahb_clk = {
+       .halt_reg = 0x04c8,
+       .clkr = {
+               .enable_reg = 0x04c8,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_sdcc1_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_sdcc1_apps_clk = {
+       .halt_reg = 0x04c4,
+       .clkr = {
+               .enable_reg = 0x04c4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_sdcc1_apps_clk",
+                       .parent_names = (const char *[]){
+                               "sdcc1_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_sdcc2_ahb_clk = {
+       .halt_reg = 0x0508,
+       .clkr = {
+               .enable_reg = 0x0508,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_sdcc2_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_sdcc2_apps_clk = {
+       .halt_reg = 0x0504,
+       .clkr = {
+               .enable_reg = 0x0504,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_sdcc2_apps_clk",
+                       .parent_names = (const char *[]){
+                               "sdcc2_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_sdcc3_ahb_clk = {
+       .halt_reg = 0x0548,
+       .clkr = {
+               .enable_reg = 0x0548,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_sdcc3_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_sdcc3_apps_clk = {
+       .halt_reg = 0x0544,
+       .clkr = {
+               .enable_reg = 0x0544,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_sdcc3_apps_clk",
+                       .parent_names = (const char *[]){
+                               "sdcc3_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_sdcc4_ahb_clk = {
+       .halt_reg = 0x0588,
+       .clkr = {
+               .enable_reg = 0x0588,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_sdcc4_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_sdcc4_apps_clk = {
+       .halt_reg = 0x0584,
+       .clkr = {
+               .enable_reg = 0x0584,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_sdcc4_apps_clk",
+                       .parent_names = (const char *[]){
+                               "sdcc4_apps_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_sys_noc_usb3_axi_clk = {
+       .halt_reg = 0x0108,
+       .clkr = {
+               .enable_reg = 0x0108,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_sys_noc_usb3_axi_clk",
+                       .parent_names = (const char *[]){
+                               "usb30_master_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_tsif_ahb_clk = {
+       .halt_reg = 0x0d84,
+       .clkr = {
+               .enable_reg = 0x0d84,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_tsif_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_tsif_ref_clk = {
+       .halt_reg = 0x0d88,
+       .clkr = {
+               .enable_reg = 0x0d88,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_tsif_ref_clk",
+                       .parent_names = (const char *[]){
+                               "tsif_ref_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb2a_phy_sleep_clk = {
+       .halt_reg = 0x04ac,
+       .clkr = {
+               .enable_reg = 0x04ac,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb2a_phy_sleep_clk",
+                       .parent_names = (const char *[]){
+                               "sleep_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb2b_phy_sleep_clk = {
+       .halt_reg = 0x04b4,
+       .clkr = {
+               .enable_reg = 0x04b4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb2b_phy_sleep_clk",
+                       .parent_names = (const char *[]){
+                               "sleep_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb30_master_clk = {
+       .halt_reg = 0x03c8,
+       .clkr = {
+               .enable_reg = 0x03c8,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb30_master_clk",
+                       .parent_names = (const char *[]){
+                               "usb30_master_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb30_mock_utmi_clk = {
+       .halt_reg = 0x03d0,
+       .clkr = {
+               .enable_reg = 0x03d0,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb30_mock_utmi_clk",
+                       .parent_names = (const char *[]){
+                               "usb30_mock_utmi_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb30_sleep_clk = {
+       .halt_reg = 0x03cc,
+       .clkr = {
+               .enable_reg = 0x03cc,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb30_sleep_clk",
+                       .parent_names = (const char *[]){
+                               "sleep_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb_hs_ahb_clk = {
+       .halt_reg = 0x0488,
+       .clkr = {
+               .enable_reg = 0x0488,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb_hs_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb_hs_system_clk = {
+       .halt_reg = 0x0484,
+       .clkr = {
+               .enable_reg = 0x0484,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb_hs_system_clk",
+                       .parent_names = (const char *[]){
+                               "usb_hs_system_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb_hsic_ahb_clk = {
+       .halt_reg = 0x0408,
+       .clkr = {
+               .enable_reg = 0x0408,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb_hsic_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "periph_noc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb_hsic_clk = {
+       .halt_reg = 0x0410,
+       .clkr = {
+               .enable_reg = 0x0410,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb_hsic_clk",
+                       .parent_names = (const char *[]){
+                               "usb_hsic_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb_hsic_io_cal_clk = {
+       .halt_reg = 0x0414,
+       .clkr = {
+               .enable_reg = 0x0414,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb_hsic_io_cal_clk",
+                       .parent_names = (const char *[]){
+                               "usb_hsic_io_cal_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb_hsic_io_cal_sleep_clk = {
+       .halt_reg = 0x0418,
+       .clkr = {
+               .enable_reg = 0x0418,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb_hsic_io_cal_sleep_clk",
+                       .parent_names = (const char *[]){
+                               "sleep_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_usb_hsic_system_clk = {
+       .halt_reg = 0x040c,
+       .clkr = {
+               .enable_reg = 0x040c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_usb_hsic_system_clk",
+                       .parent_names = (const char *[]){
+                               "usb_hsic_system_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_regmap *gcc_msm8974_clocks[] = {
+       [GPLL0] = &gpll0.clkr,
+       [GPLL0_VOTE] = &gpll0_vote,
+       [CONFIG_NOC_CLK_SRC] = &config_noc_clk_src.clkr,
+       [PERIPH_NOC_CLK_SRC] = &periph_noc_clk_src.clkr,
+       [SYSTEM_NOC_CLK_SRC] = &system_noc_clk_src.clkr,
+       [GPLL1] = &gpll1.clkr,
+       [GPLL1_VOTE] = &gpll1_vote,
+       [USB30_MASTER_CLK_SRC] = &usb30_master_clk_src.clkr,
+       [BLSP1_QUP1_I2C_APPS_CLK_SRC] = &blsp1_qup1_i2c_apps_clk_src.clkr,
+       [BLSP1_QUP1_SPI_APPS_CLK_SRC] = &blsp1_qup1_spi_apps_clk_src.clkr,
+       [BLSP1_QUP2_I2C_APPS_CLK_SRC] = &blsp1_qup2_i2c_apps_clk_src.clkr,
+       [BLSP1_QUP2_SPI_APPS_CLK_SRC] = &blsp1_qup2_spi_apps_clk_src.clkr,
+       [BLSP1_QUP3_I2C_APPS_CLK_SRC] = &blsp1_qup3_i2c_apps_clk_src.clkr,
+       [BLSP1_QUP3_SPI_APPS_CLK_SRC] = &blsp1_qup3_spi_apps_clk_src.clkr,
+       [BLSP1_QUP4_I2C_APPS_CLK_SRC] = &blsp1_qup4_i2c_apps_clk_src.clkr,
+       [BLSP1_QUP4_SPI_APPS_CLK_SRC] = &blsp1_qup4_spi_apps_clk_src.clkr,
+       [BLSP1_QUP5_I2C_APPS_CLK_SRC] = &blsp1_qup5_i2c_apps_clk_src.clkr,
+       [BLSP1_QUP5_SPI_APPS_CLK_SRC] = &blsp1_qup5_spi_apps_clk_src.clkr,
+       [BLSP1_QUP6_I2C_APPS_CLK_SRC] = &blsp1_qup6_i2c_apps_clk_src.clkr,
+       [BLSP1_QUP6_SPI_APPS_CLK_SRC] = &blsp1_qup6_spi_apps_clk_src.clkr,
+       [BLSP1_UART1_APPS_CLK_SRC] = &blsp1_uart1_apps_clk_src.clkr,
+       [BLSP1_UART2_APPS_CLK_SRC] = &blsp1_uart2_apps_clk_src.clkr,
+       [BLSP1_UART3_APPS_CLK_SRC] = &blsp1_uart3_apps_clk_src.clkr,
+       [BLSP1_UART4_APPS_CLK_SRC] = &blsp1_uart4_apps_clk_src.clkr,
+       [BLSP1_UART5_APPS_CLK_SRC] = &blsp1_uart5_apps_clk_src.clkr,
+       [BLSP1_UART6_APPS_CLK_SRC] = &blsp1_uart6_apps_clk_src.clkr,
+       [BLSP2_QUP1_I2C_APPS_CLK_SRC] = &blsp2_qup1_i2c_apps_clk_src.clkr,
+       [BLSP2_QUP1_SPI_APPS_CLK_SRC] = &blsp2_qup1_spi_apps_clk_src.clkr,
+       [BLSP2_QUP2_I2C_APPS_CLK_SRC] = &blsp2_qup2_i2c_apps_clk_src.clkr,
+       [BLSP2_QUP2_SPI_APPS_CLK_SRC] = &blsp2_qup2_spi_apps_clk_src.clkr,
+       [BLSP2_QUP3_I2C_APPS_CLK_SRC] = &blsp2_qup3_i2c_apps_clk_src.clkr,
+       [BLSP2_QUP3_SPI_APPS_CLK_SRC] = &blsp2_qup3_spi_apps_clk_src.clkr,
+       [BLSP2_QUP4_I2C_APPS_CLK_SRC] = &blsp2_qup4_i2c_apps_clk_src.clkr,
+       [BLSP2_QUP4_SPI_APPS_CLK_SRC] = &blsp2_qup4_spi_apps_clk_src.clkr,
+       [BLSP2_QUP5_I2C_APPS_CLK_SRC] = &blsp2_qup5_i2c_apps_clk_src.clkr,
+       [BLSP2_QUP5_SPI_APPS_CLK_SRC] = &blsp2_qup5_spi_apps_clk_src.clkr,
+       [BLSP2_QUP6_I2C_APPS_CLK_SRC] = &blsp2_qup6_i2c_apps_clk_src.clkr,
+       [BLSP2_QUP6_SPI_APPS_CLK_SRC] = &blsp2_qup6_spi_apps_clk_src.clkr,
+       [BLSP2_UART1_APPS_CLK_SRC] = &blsp2_uart1_apps_clk_src.clkr,
+       [BLSP2_UART2_APPS_CLK_SRC] = &blsp2_uart2_apps_clk_src.clkr,
+       [BLSP2_UART3_APPS_CLK_SRC] = &blsp2_uart3_apps_clk_src.clkr,
+       [BLSP2_UART4_APPS_CLK_SRC] = &blsp2_uart4_apps_clk_src.clkr,
+       [BLSP2_UART5_APPS_CLK_SRC] = &blsp2_uart5_apps_clk_src.clkr,
+       [BLSP2_UART6_APPS_CLK_SRC] = &blsp2_uart6_apps_clk_src.clkr,
+       [CE1_CLK_SRC] = &ce1_clk_src.clkr,
+       [CE2_CLK_SRC] = &ce2_clk_src.clkr,
+       [GP1_CLK_SRC] = &gp1_clk_src.clkr,
+       [GP2_CLK_SRC] = &gp2_clk_src.clkr,
+       [GP3_CLK_SRC] = &gp3_clk_src.clkr,
+       [PDM2_CLK_SRC] = &pdm2_clk_src.clkr,
+       [SDCC1_APPS_CLK_SRC] = &sdcc1_apps_clk_src.clkr,
+       [SDCC2_APPS_CLK_SRC] = &sdcc2_apps_clk_src.clkr,
+       [SDCC3_APPS_CLK_SRC] = &sdcc3_apps_clk_src.clkr,
+       [SDCC4_APPS_CLK_SRC] = &sdcc4_apps_clk_src.clkr,
+       [TSIF_REF_CLK_SRC] = &tsif_ref_clk_src.clkr,
+       [USB30_MOCK_UTMI_CLK_SRC] = &usb30_mock_utmi_clk_src.clkr,
+       [USB_HS_SYSTEM_CLK_SRC] = &usb_hs_system_clk_src.clkr,
+       [USB_HSIC_CLK_SRC] = &usb_hsic_clk_src.clkr,
+       [USB_HSIC_IO_CAL_CLK_SRC] = &usb_hsic_io_cal_clk_src.clkr,
+       [USB_HSIC_SYSTEM_CLK_SRC] = &usb_hsic_system_clk_src.clkr,
+       [GCC_BAM_DMA_AHB_CLK] = &gcc_bam_dma_ahb_clk.clkr,
+       [GCC_BLSP1_AHB_CLK] = &gcc_blsp1_ahb_clk.clkr,
+       [GCC_BLSP1_QUP1_I2C_APPS_CLK] = &gcc_blsp1_qup1_i2c_apps_clk.clkr,
+       [GCC_BLSP1_QUP1_SPI_APPS_CLK] = &gcc_blsp1_qup1_spi_apps_clk.clkr,
+       [GCC_BLSP1_QUP2_I2C_APPS_CLK] = &gcc_blsp1_qup2_i2c_apps_clk.clkr,
+       [GCC_BLSP1_QUP2_SPI_APPS_CLK] = &gcc_blsp1_qup2_spi_apps_clk.clkr,
+       [GCC_BLSP1_QUP3_I2C_APPS_CLK] = &gcc_blsp1_qup3_i2c_apps_clk.clkr,
+       [GCC_BLSP1_QUP3_SPI_APPS_CLK] = &gcc_blsp1_qup3_spi_apps_clk.clkr,
+       [GCC_BLSP1_QUP4_I2C_APPS_CLK] = &gcc_blsp1_qup4_i2c_apps_clk.clkr,
+       [GCC_BLSP1_QUP4_SPI_APPS_CLK] = &gcc_blsp1_qup4_spi_apps_clk.clkr,
+       [GCC_BLSP1_QUP5_I2C_APPS_CLK] = &gcc_blsp1_qup5_i2c_apps_clk.clkr,
+       [GCC_BLSP1_QUP5_SPI_APPS_CLK] = &gcc_blsp1_qup5_spi_apps_clk.clkr,
+       [GCC_BLSP1_QUP6_I2C_APPS_CLK] = &gcc_blsp1_qup6_i2c_apps_clk.clkr,
+       [GCC_BLSP1_QUP6_SPI_APPS_CLK] = &gcc_blsp1_qup6_spi_apps_clk.clkr,
+       [GCC_BLSP1_UART1_APPS_CLK] = &gcc_blsp1_uart1_apps_clk.clkr,
+       [GCC_BLSP1_UART2_APPS_CLK] = &gcc_blsp1_uart2_apps_clk.clkr,
+       [GCC_BLSP1_UART3_APPS_CLK] = &gcc_blsp1_uart3_apps_clk.clkr,
+       [GCC_BLSP1_UART4_APPS_CLK] = &gcc_blsp1_uart4_apps_clk.clkr,
+       [GCC_BLSP1_UART5_APPS_CLK] = &gcc_blsp1_uart5_apps_clk.clkr,
+       [GCC_BLSP1_UART6_APPS_CLK] = &gcc_blsp1_uart6_apps_clk.clkr,
+       [GCC_BLSP2_AHB_CLK] = &gcc_blsp2_ahb_clk.clkr,
+       [GCC_BLSP2_QUP1_I2C_APPS_CLK] = &gcc_blsp2_qup1_i2c_apps_clk.clkr,
+       [GCC_BLSP2_QUP1_SPI_APPS_CLK] = &gcc_blsp2_qup1_spi_apps_clk.clkr,
+       [GCC_BLSP2_QUP2_I2C_APPS_CLK] = &gcc_blsp2_qup2_i2c_apps_clk.clkr,
+       [GCC_BLSP2_QUP2_SPI_APPS_CLK] = &gcc_blsp2_qup2_spi_apps_clk.clkr,
+       [GCC_BLSP2_QUP3_I2C_APPS_CLK] = &gcc_blsp2_qup3_i2c_apps_clk.clkr,
+       [GCC_BLSP2_QUP3_SPI_APPS_CLK] = &gcc_blsp2_qup3_spi_apps_clk.clkr,
+       [GCC_BLSP2_QUP4_I2C_APPS_CLK] = &gcc_blsp2_qup4_i2c_apps_clk.clkr,
+       [GCC_BLSP2_QUP4_SPI_APPS_CLK] = &gcc_blsp2_qup4_spi_apps_clk.clkr,
+       [GCC_BLSP2_QUP5_I2C_APPS_CLK] = &gcc_blsp2_qup5_i2c_apps_clk.clkr,
+       [GCC_BLSP2_QUP5_SPI_APPS_CLK] = &gcc_blsp2_qup5_spi_apps_clk.clkr,
+       [GCC_BLSP2_QUP6_I2C_APPS_CLK] = &gcc_blsp2_qup6_i2c_apps_clk.clkr,
+       [GCC_BLSP2_QUP6_SPI_APPS_CLK] = &gcc_blsp2_qup6_spi_apps_clk.clkr,
+       [GCC_BLSP2_UART1_APPS_CLK] = &gcc_blsp2_uart1_apps_clk.clkr,
+       [GCC_BLSP2_UART2_APPS_CLK] = &gcc_blsp2_uart2_apps_clk.clkr,
+       [GCC_BLSP2_UART3_APPS_CLK] = &gcc_blsp2_uart3_apps_clk.clkr,
+       [GCC_BLSP2_UART4_APPS_CLK] = &gcc_blsp2_uart4_apps_clk.clkr,
+       [GCC_BLSP2_UART5_APPS_CLK] = &gcc_blsp2_uart5_apps_clk.clkr,
+       [GCC_BLSP2_UART6_APPS_CLK] = &gcc_blsp2_uart6_apps_clk.clkr,
+       [GCC_BOOT_ROM_AHB_CLK] = &gcc_boot_rom_ahb_clk.clkr,
+       [GCC_CE1_AHB_CLK] = &gcc_ce1_ahb_clk.clkr,
+       [GCC_CE1_AXI_CLK] = &gcc_ce1_axi_clk.clkr,
+       [GCC_CE1_CLK] = &gcc_ce1_clk.clkr,
+       [GCC_CE2_AHB_CLK] = &gcc_ce2_ahb_clk.clkr,
+       [GCC_CE2_AXI_CLK] = &gcc_ce2_axi_clk.clkr,
+       [GCC_CE2_CLK] = &gcc_ce2_clk.clkr,
+       [GCC_GP1_CLK] = &gcc_gp1_clk.clkr,
+       [GCC_GP2_CLK] = &gcc_gp2_clk.clkr,
+       [GCC_GP3_CLK] = &gcc_gp3_clk.clkr,
+       [GCC_LPASS_Q6_AXI_CLK] = &gcc_lpass_q6_axi_clk.clkr,
+       [GCC_MMSS_NOC_CFG_AHB_CLK] = &gcc_mmss_noc_cfg_ahb_clk.clkr,
+       [GCC_OCMEM_NOC_CFG_AHB_CLK] = &gcc_ocmem_noc_cfg_ahb_clk.clkr,
+       [GCC_MSS_CFG_AHB_CLK] = &gcc_mss_cfg_ahb_clk.clkr,
+       [GCC_MSS_Q6_BIMC_AXI_CLK] = &gcc_mss_q6_bimc_axi_clk.clkr,
+       [GCC_PDM2_CLK] = &gcc_pdm2_clk.clkr,
+       [GCC_PDM_AHB_CLK] = &gcc_pdm_ahb_clk.clkr,
+       [GCC_PRNG_AHB_CLK] = &gcc_prng_ahb_clk.clkr,
+       [GCC_SDCC1_AHB_CLK] = &gcc_sdcc1_ahb_clk.clkr,
+       [GCC_SDCC1_APPS_CLK] = &gcc_sdcc1_apps_clk.clkr,
+       [GCC_SDCC2_AHB_CLK] = &gcc_sdcc2_ahb_clk.clkr,
+       [GCC_SDCC2_APPS_CLK] = &gcc_sdcc2_apps_clk.clkr,
+       [GCC_SDCC3_AHB_CLK] = &gcc_sdcc3_ahb_clk.clkr,
+       [GCC_SDCC3_APPS_CLK] = &gcc_sdcc3_apps_clk.clkr,
+       [GCC_SDCC4_AHB_CLK] = &gcc_sdcc4_ahb_clk.clkr,
+       [GCC_SDCC4_APPS_CLK] = &gcc_sdcc4_apps_clk.clkr,
+       [GCC_SYS_NOC_USB3_AXI_CLK] = &gcc_sys_noc_usb3_axi_clk.clkr,
+       [GCC_TSIF_AHB_CLK] = &gcc_tsif_ahb_clk.clkr,
+       [GCC_TSIF_REF_CLK] = &gcc_tsif_ref_clk.clkr,
+       [GCC_USB2A_PHY_SLEEP_CLK] = &gcc_usb2a_phy_sleep_clk.clkr,
+       [GCC_USB2B_PHY_SLEEP_CLK] = &gcc_usb2b_phy_sleep_clk.clkr,
+       [GCC_USB30_MASTER_CLK] = &gcc_usb30_master_clk.clkr,
+       [GCC_USB30_MOCK_UTMI_CLK] = &gcc_usb30_mock_utmi_clk.clkr,
+       [GCC_USB30_SLEEP_CLK] = &gcc_usb30_sleep_clk.clkr,
+       [GCC_USB_HS_AHB_CLK] = &gcc_usb_hs_ahb_clk.clkr,
+       [GCC_USB_HS_SYSTEM_CLK] = &gcc_usb_hs_system_clk.clkr,
+       [GCC_USB_HSIC_AHB_CLK] = &gcc_usb_hsic_ahb_clk.clkr,
+       [GCC_USB_HSIC_CLK] = &gcc_usb_hsic_clk.clkr,
+       [GCC_USB_HSIC_IO_CAL_CLK] = &gcc_usb_hsic_io_cal_clk.clkr,
+       [GCC_USB_HSIC_IO_CAL_SLEEP_CLK] = &gcc_usb_hsic_io_cal_sleep_clk.clkr,
+       [GCC_USB_HSIC_SYSTEM_CLK] = &gcc_usb_hsic_system_clk.clkr,
+       [GCC_MMSS_GPLL0_CLK_SRC] = &gcc_mmss_gpll0_clk_src,
+};
+
+static const struct qcom_reset_map gcc_msm8974_resets[] = {
+       [GCC_SYSTEM_NOC_BCR] = { 0x0100 },
+       [GCC_CONFIG_NOC_BCR] = { 0x0140 },
+       [GCC_PERIPH_NOC_BCR] = { 0x0180 },
+       [GCC_IMEM_BCR] = { 0x0200 },
+       [GCC_MMSS_BCR] = { 0x0240 },
+       [GCC_QDSS_BCR] = { 0x0300 },
+       [GCC_USB_30_BCR] = { 0x03c0 },
+       [GCC_USB3_PHY_BCR] = { 0x03fc },
+       [GCC_USB_HS_HSIC_BCR] = { 0x0400 },
+       [GCC_USB_HS_BCR] = { 0x0480 },
+       [GCC_USB2A_PHY_BCR] = { 0x04a8 },
+       [GCC_USB2B_PHY_BCR] = { 0x04b0 },
+       [GCC_SDCC1_BCR] = { 0x04c0 },
+       [GCC_SDCC2_BCR] = { 0x0500 },
+       [GCC_SDCC3_BCR] = { 0x0540 },
+       [GCC_SDCC4_BCR] = { 0x0580 },
+       [GCC_BLSP1_BCR] = { 0x05c0 },
+       [GCC_BLSP1_QUP1_BCR] = { 0x0640 },
+       [GCC_BLSP1_UART1_BCR] = { 0x0680 },
+       [GCC_BLSP1_QUP2_BCR] = { 0x06c0 },
+       [GCC_BLSP1_UART2_BCR] = { 0x0700 },
+       [GCC_BLSP1_QUP3_BCR] = { 0x0740 },
+       [GCC_BLSP1_UART3_BCR] = { 0x0780 },
+       [GCC_BLSP1_QUP4_BCR] = { 0x07c0 },
+       [GCC_BLSP1_UART4_BCR] = { 0x0800 },
+       [GCC_BLSP1_QUP5_BCR] = { 0x0840 },
+       [GCC_BLSP1_UART5_BCR] = { 0x0880 },
+       [GCC_BLSP1_QUP6_BCR] = { 0x08c0 },
+       [GCC_BLSP1_UART6_BCR] = { 0x0900 },
+       [GCC_BLSP2_BCR] = { 0x0940 },
+       [GCC_BLSP2_QUP1_BCR] = { 0x0980 },
+       [GCC_BLSP2_UART1_BCR] = { 0x09c0 },
+       [GCC_BLSP2_QUP2_BCR] = { 0x0a00 },
+       [GCC_BLSP2_UART2_BCR] = { 0x0a40 },
+       [GCC_BLSP2_QUP3_BCR] = { 0x0a80 },
+       [GCC_BLSP2_UART3_BCR] = { 0x0ac0 },
+       [GCC_BLSP2_QUP4_BCR] = { 0x0b00 },
+       [GCC_BLSP2_UART4_BCR] = { 0x0b40 },
+       [GCC_BLSP2_QUP5_BCR] = { 0x0b80 },
+       [GCC_BLSP2_UART5_BCR] = { 0x0bc0 },
+       [GCC_BLSP2_QUP6_BCR] = { 0x0c00 },
+       [GCC_BLSP2_UART6_BCR] = { 0x0c40 },
+       [GCC_PDM_BCR] = { 0x0cc0 },
+       [GCC_BAM_DMA_BCR] = { 0x0d40 },
+       [GCC_TSIF_BCR] = { 0x0d80 },
+       [GCC_TCSR_BCR] = { 0x0dc0 },
+       [GCC_BOOT_ROM_BCR] = { 0x0e00 },
+       [GCC_MSG_RAM_BCR] = { 0x0e40 },
+       [GCC_TLMM_BCR] = { 0x0e80 },
+       [GCC_MPM_BCR] = { 0x0ec0 },
+       [GCC_SEC_CTRL_BCR] = { 0x0f40 },
+       [GCC_SPMI_BCR] = { 0x0fc0 },
+       [GCC_SPDM_BCR] = { 0x1000 },
+       [GCC_CE1_BCR] = { 0x1040 },
+       [GCC_CE2_BCR] = { 0x1080 },
+       [GCC_BIMC_BCR] = { 0x1100 },
+       [GCC_MPM_NON_AHB_RESET] = { 0x0ec4, 2 },
+       [GCC_MPM_AHB_RESET] = { 0x0ec4, 1 },
+       [GCC_SNOC_BUS_TIMEOUT0_BCR] = { 0x1240 },
+       [GCC_SNOC_BUS_TIMEOUT2_BCR] = { 0x1248 },
+       [GCC_PNOC_BUS_TIMEOUT0_BCR] = { 0x1280 },
+       [GCC_PNOC_BUS_TIMEOUT1_BCR] = { 0x1288 },
+       [GCC_PNOC_BUS_TIMEOUT2_BCR] = { 0x1290 },
+       [GCC_PNOC_BUS_TIMEOUT3_BCR] = { 0x1298 },
+       [GCC_PNOC_BUS_TIMEOUT4_BCR] = { 0x12a0 },
+       [GCC_CNOC_BUS_TIMEOUT0_BCR] = { 0x12c0 },
+       [GCC_CNOC_BUS_TIMEOUT1_BCR] = { 0x12c8 },
+       [GCC_CNOC_BUS_TIMEOUT2_BCR] = { 0x12d0 },
+       [GCC_CNOC_BUS_TIMEOUT3_BCR] = { 0x12d8 },
+       [GCC_CNOC_BUS_TIMEOUT4_BCR] = { 0x12e0 },
+       [GCC_CNOC_BUS_TIMEOUT5_BCR] = { 0x12e8 },
+       [GCC_CNOC_BUS_TIMEOUT6_BCR] = { 0x12f0 },
+       [GCC_DEHR_BCR] = { 0x1300 },
+       [GCC_RBCPR_BCR] = { 0x1380 },
+       [GCC_MSS_RESTART] = { 0x1680 },
+       [GCC_LPASS_RESTART] = { 0x16c0 },
+       [GCC_WCSS_RESTART] = { 0x1700 },
+       [GCC_VENUS_RESTART] = { 0x1740 },
+};
+
+static const struct regmap_config gcc_msm8974_regmap_config = {
+       .reg_bits       = 32,
+       .reg_stride     = 4,
+       .val_bits       = 32,
+       .max_register   = 0x1fc0,
+       .fast_io        = true,
+};
+
+static const struct of_device_id gcc_msm8974_match_table[] = {
+       { .compatible = "qcom,gcc-msm8974" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, gcc_msm8974_match_table);
+
+struct qcom_cc {
+       struct qcom_reset_controller reset;
+       struct clk_onecell_data data;
+       struct clk *clks[];
+};
+
+static int gcc_msm8974_probe(struct platform_device *pdev)
+{
+       void __iomem *base;
+       struct resource *res;
+       int i, ret;
+       struct device *dev = &pdev->dev;
+       struct clk *clk;
+       struct clk_onecell_data *data;
+       struct clk **clks;
+       struct regmap *regmap;
+       size_t num_clks;
+       struct qcom_reset_controller *reset;
+       struct qcom_cc *cc;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       base = devm_ioremap_resource(dev, res);
+       if (IS_ERR(base))
+               return PTR_ERR(base);
+
+       regmap = devm_regmap_init_mmio(dev, base, &gcc_msm8974_regmap_config);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       num_clks = ARRAY_SIZE(gcc_msm8974_clocks);
+       cc = devm_kzalloc(dev, sizeof(*cc) + sizeof(*clks) * num_clks,
+                         GFP_KERNEL);
+       if (!cc)
+               return -ENOMEM;
+
+       clks = cc->clks;
+       data = &cc->data;
+       data->clks = clks;
+       data->clk_num = num_clks;
+
+       /* Temporary until RPM clocks supported */
+       clk = clk_register_fixed_rate(dev, "xo", NULL, CLK_IS_ROOT, 19200000);
+       if (IS_ERR(clk))
+               return PTR_ERR(clk);
+
+       /* Should move to DT node? */
+       clk = clk_register_fixed_rate(dev, "sleep_clk_src", NULL,
+                                     CLK_IS_ROOT, 32768);
+       if (IS_ERR(clk))
+               return PTR_ERR(clk);
+
+       for (i = 0; i < num_clks; i++) {
+               if (!gcc_msm8974_clocks[i])
+                       continue;
+               clk = devm_clk_register_regmap(dev, gcc_msm8974_clocks[i]);
+               if (IS_ERR(clk))
+                       return PTR_ERR(clk);
+               clks[i] = clk;
+       }
+
+       ret = of_clk_add_provider(dev->of_node, of_clk_src_onecell_get, data);
+       if (ret)
+               return ret;
+
+       reset = &cc->reset;
+       reset->rcdev.of_node = dev->of_node;
+       reset->rcdev.ops = &qcom_reset_ops,
+       reset->rcdev.owner = THIS_MODULE,
+       reset->rcdev.nr_resets = ARRAY_SIZE(gcc_msm8974_resets),
+       reset->regmap = regmap;
+       reset->reset_map = gcc_msm8974_resets,
+       platform_set_drvdata(pdev, &reset->rcdev);
+
+       ret = reset_controller_register(&reset->rcdev);
+       if (ret)
+               of_clk_del_provider(dev->of_node);
+
+       return ret;
+}
+
+static int gcc_msm8974_remove(struct platform_device *pdev)
+{
+       of_clk_del_provider(pdev->dev.of_node);
+       reset_controller_unregister(platform_get_drvdata(pdev));
+       return 0;
+}
+
+static struct platform_driver gcc_msm8974_driver = {
+       .probe          = gcc_msm8974_probe,
+       .remove         = gcc_msm8974_remove,
+       .driver         = {
+               .name   = "gcc-msm8974",
+               .owner  = THIS_MODULE,
+               .of_match_table = gcc_msm8974_match_table,
+       },
+};
+
+static int __init gcc_msm8974_init(void)
+{
+       return platform_driver_register(&gcc_msm8974_driver);
+}
+core_initcall(gcc_msm8974_init);
+
+static void __exit gcc_msm8974_exit(void)
+{
+       platform_driver_unregister(&gcc_msm8974_driver);
+}
+module_exit(gcc_msm8974_exit);
+
+MODULE_DESCRIPTION("QCOM GCC MSM8974 Driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:gcc-msm8974");
diff --git a/drivers/clk/qcom/mmcc-msm8960.c b/drivers/clk/qcom/mmcc-msm8960.c
new file mode 100644 (file)
index 0000000..f9b59c7
--- /dev/null
@@ -0,0 +1,2321 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+#include <linux/reset-controller.h>
+
+#include <dt-bindings/clock/qcom,mmcc-msm8960.h>
+#include <dt-bindings/reset/qcom,mmcc-msm8960.h>
+
+#include "clk-regmap.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-branch.h"
+#include "reset.h"
+
+#define P_PXO  0
+#define P_PLL8 1
+#define P_PLL2 2
+#define P_PLL3 3
+
+static u8 mmcc_pxo_pll8_pll2_map[] = {
+       [P_PXO]         = 0,
+       [P_PLL8]        = 2,
+       [P_PLL2]        = 1,
+};
+
+static const char *mmcc_pxo_pll8_pll2[] = {
+       "pxo",
+       "pll8_vote",
+       "pll2",
+};
+
+static u8 mmcc_pxo_pll8_pll2_pll3_map[] = {
+       [P_PXO]         = 0,
+       [P_PLL8]        = 2,
+       [P_PLL2]        = 1,
+       [P_PLL3]        = 3,
+};
+
+static const char *mmcc_pxo_pll8_pll2_pll3[] = {
+       "pxo",
+       "pll2",
+       "pll8_vote",
+       "pll3",
+};
+
+static struct clk_pll pll2 = {
+       .l_reg = 0x320,
+       .m_reg = 0x324,
+       .n_reg = 0x328,
+       .config_reg = 0x32c,
+       .mode_reg = 0x31c,
+       .status_reg = 0x334,
+       .status_bit = 16,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "pll2",
+               .parent_names = (const char *[]){ "pxo" },
+               .num_parents = 1,
+               .ops = &clk_pll_ops,
+       },
+};
+
+static struct freq_tbl clk_tbl_cam[] = {
+       {   6000000, P_PLL8, 4, 1, 16 },
+       {   8000000, P_PLL8, 4, 1, 12 },
+       {  12000000, P_PLL8, 4, 1,  8 },
+       {  16000000, P_PLL8, 4, 1,  6 },
+       {  19200000, P_PLL8, 4, 1,  5 },
+       {  24000000, P_PLL8, 4, 1,  4 },
+       {  32000000, P_PLL8, 4, 1,  3 },
+       {  48000000, P_PLL8, 4, 1,  2 },
+       {  64000000, P_PLL8, 3, 1,  2 },
+       {  96000000, P_PLL8, 4, 0,  0 },
+       { 128000000, P_PLL8, 3, 0,  0 },
+       { }
+};
+
+static struct clk_rcg camclk0_src = {
+       .ns_reg = 0x0148,
+       .md_reg = 0x0144,
+       .mn = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 8,
+               .reset_in_cc = true,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 24,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 14,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .freq_tbl = clk_tbl_cam,
+       .clkr = {
+               .enable_reg = 0x0140,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camclk0_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch camclk0_clk = {
+       .halt_reg = 0x01e8,
+       .halt_bit = 15,
+       .clkr = {
+               .enable_reg = 0x0140,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camclk0_clk",
+                       .parent_names = (const char *[]){ "camclk0_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+               },
+       },
+
+};
+
+static struct clk_rcg camclk1_src = {
+       .ns_reg = 0x015c,
+       .md_reg = 0x0158,
+       .mn = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 8,
+               .reset_in_cc = true,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 24,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 14,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .freq_tbl = clk_tbl_cam,
+       .clkr = {
+               .enable_reg = 0x0154,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camclk1_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch camclk1_clk = {
+       .halt_reg = 0x01e8,
+       .halt_bit = 16,
+       .clkr = {
+               .enable_reg = 0x0154,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camclk1_clk",
+                       .parent_names = (const char *[]){ "camclk1_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+               },
+       },
+
+};
+
+static struct clk_rcg camclk2_src = {
+       .ns_reg = 0x0228,
+       .md_reg = 0x0224,
+       .mn = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 8,
+               .reset_in_cc = true,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 24,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 14,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .freq_tbl = clk_tbl_cam,
+       .clkr = {
+               .enable_reg = 0x0220,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camclk2_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch camclk2_clk = {
+       .halt_reg = 0x01e8,
+       .halt_bit = 16,
+       .clkr = {
+               .enable_reg = 0x0220,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camclk2_clk",
+                       .parent_names = (const char *[]){ "camclk2_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+               },
+       },
+
+};
+
+static struct freq_tbl clk_tbl_csi[] = {
+       {  27000000, P_PXO,  1, 0, 0 },
+       {  85330000, P_PLL8, 1, 2, 9 },
+       { 177780000, P_PLL2, 1, 2, 9 },
+       { }
+};
+
+static struct clk_rcg csi0_src = {
+       .ns_reg = 0x0048,
+       .md_reg = 0x0044,
+       .mn = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 24,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 14,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .freq_tbl = clk_tbl_csi,
+       .clkr = {
+               .enable_reg = 0x0040,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "csi0_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch csi0_clk = {
+       .halt_reg = 0x01cc,
+       .halt_bit = 13,
+       .clkr = {
+               .enable_reg = 0x0040,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = (const char *[]){ "csi0_src" },
+                       .num_parents = 1,
+                       .name = "csi0_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch csi0_phy_clk = {
+       .halt_reg = 0x01e8,
+       .halt_bit = 9,
+       .clkr = {
+               .enable_reg = 0x0040,
+               .enable_mask = BIT(8),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = (const char *[]){ "csi0_src" },
+                       .num_parents = 1,
+                       .name = "csi0_phy_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg csi1_src = {
+       .ns_reg = 0x0010,
+       .md_reg = 0x0028,
+       .mn = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 24,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 14,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .freq_tbl = clk_tbl_csi,
+       .clkr = {
+               .enable_reg = 0x0024,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "csi1_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch csi1_clk = {
+       .halt_reg = 0x01cc,
+       .halt_bit = 14,
+       .clkr = {
+               .enable_reg = 0x0024,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = (const char *[]){ "csi1_src" },
+                       .num_parents = 1,
+                       .name = "csi1_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch csi1_phy_clk = {
+       .halt_reg = 0x01e8,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x0024,
+               .enable_mask = BIT(8),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = (const char *[]){ "csi1_src" },
+                       .num_parents = 1,
+                       .name = "csi1_phy_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_rcg csi2_src = {
+       .ns_reg = 0x0234,
+       .md_reg = 0x022c,
+       .mn = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 24,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 14,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .freq_tbl = clk_tbl_csi,
+       .clkr = {
+               .enable_reg = 0x022c,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "csi2_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch csi2_clk = {
+       .halt_reg = 0x01cc,
+       .halt_bit = 29,
+       .clkr = {
+               .enable_reg = 0x022c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = (const char *[]){ "csi2_src" },
+                       .num_parents = 1,
+                       .name = "csi2_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch csi2_phy_clk = {
+       .halt_reg = 0x01e8,
+       .halt_bit = 29,
+       .clkr = {
+               .enable_reg = 0x022c,
+               .enable_mask = BIT(8),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = (const char *[]){ "csi2_src" },
+                       .num_parents = 1,
+                       .name = "csi2_phy_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+struct clk_pix_rdi {
+       u32 s_reg;
+       u32 s_mask;
+       u32 s2_reg;
+       u32 s2_mask;
+       struct clk_regmap clkr;
+};
+
+#define to_clk_pix_rdi(_hw) \
+       container_of(to_clk_regmap(_hw), struct clk_pix_rdi, clkr)
+
+static int pix_rdi_set_parent(struct clk_hw *hw, u8 index)
+{
+       int i;
+       int ret = 0;
+       u32 val;
+       struct clk_pix_rdi *rdi = to_clk_pix_rdi(hw);
+       struct clk *clk = hw->clk;
+       int num_parents = __clk_get_num_parents(hw->clk);
+
+       /*
+        * These clocks select three inputs via two muxes. One mux selects
+        * between csi0 and csi1 and the second mux selects between that mux's
+        * output and csi2. The source and destination selections for each
+        * mux must be clocking for the switch to succeed so just turn on
+        * all three sources because it's easier than figuring out what source
+        * needs to be on at what time.
+        */
+       for (i = 0; i < num_parents; i++) {
+               ret = clk_prepare_enable(clk_get_parent_by_index(clk, i));
+               if (ret)
+                       goto err;
+       }
+
+       if (index == 2)
+               val = rdi->s2_mask;
+       else
+               val = 0;
+       regmap_update_bits(rdi->clkr.regmap, rdi->s2_reg, rdi->s2_mask, val);
+       /*
+        * Wait at least 6 cycles of slowest clock
+        * for the glitch-free MUX to fully switch sources.
+        */
+       udelay(1);
+
+       if (index == 1)
+               val = rdi->s_mask;
+       else
+               val = 0;
+       regmap_update_bits(rdi->clkr.regmap, rdi->s_reg, rdi->s_mask, val);
+       /*
+        * Wait at least 6 cycles of slowest clock
+        * for the glitch-free MUX to fully switch sources.
+        */
+       udelay(1);
+
+err:
+       for (i--; i >= 0; i--)
+               clk_disable_unprepare(clk_get_parent_by_index(clk, i));
+
+       return ret;
+}
+
+static u8 pix_rdi_get_parent(struct clk_hw *hw)
+{
+       u32 val;
+       struct clk_pix_rdi *rdi = to_clk_pix_rdi(hw);
+
+
+       regmap_read(rdi->clkr.regmap, rdi->s2_reg, &val);
+       if (val & rdi->s2_mask)
+               return 2;
+
+       regmap_read(rdi->clkr.regmap, rdi->s_reg, &val);
+       if (val & rdi->s_mask)
+               return 1;
+
+       return 0;
+}
+
+static const struct clk_ops clk_ops_pix_rdi = {
+       .enable = clk_enable_regmap,
+       .disable = clk_disable_regmap,
+       .set_parent = pix_rdi_set_parent,
+       .get_parent = pix_rdi_get_parent,
+       .determine_rate = __clk_mux_determine_rate,
+};
+
+static const char *pix_rdi_parents[] = {
+       "csi0_clk",
+       "csi1_clk",
+       "csi2_clk",
+};
+
+static struct clk_pix_rdi csi_pix_clk = {
+       .s_reg = 0x0058,
+       .s_mask = BIT(25),
+       .s2_reg = 0x0238,
+       .s2_mask = BIT(13),
+       .clkr = {
+               .enable_reg = 0x0058,
+               .enable_mask = BIT(26),
+               .hw.init = &(struct clk_init_data){
+                       .name = "csi_pix_clk",
+                       .parent_names = pix_rdi_parents,
+                       .num_parents = 3,
+                       .ops = &clk_ops_pix_rdi,
+               },
+       },
+};
+
+static struct clk_pix_rdi csi_pix1_clk = {
+       .s_reg = 0x0238,
+       .s_mask = BIT(8),
+       .s2_reg = 0x0238,
+       .s2_mask = BIT(9),
+       .clkr = {
+               .enable_reg = 0x0238,
+               .enable_mask = BIT(10),
+               .hw.init = &(struct clk_init_data){
+                       .name = "csi_pix1_clk",
+                       .parent_names = pix_rdi_parents,
+                       .num_parents = 3,
+                       .ops = &clk_ops_pix_rdi,
+               },
+       },
+};
+
+static struct clk_pix_rdi csi_rdi_clk = {
+       .s_reg = 0x0058,
+       .s_mask = BIT(12),
+       .s2_reg = 0x0238,
+       .s2_mask = BIT(12),
+       .clkr = {
+               .enable_reg = 0x0058,
+               .enable_mask = BIT(13),
+               .hw.init = &(struct clk_init_data){
+                       .name = "csi_rdi_clk",
+                       .parent_names = pix_rdi_parents,
+                       .num_parents = 3,
+                       .ops = &clk_ops_pix_rdi,
+               },
+       },
+};
+
+static struct clk_pix_rdi csi_rdi1_clk = {
+       .s_reg = 0x0238,
+       .s_mask = BIT(0),
+       .s2_reg = 0x0238,
+       .s2_mask = BIT(1),
+       .clkr = {
+               .enable_reg = 0x0238,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "csi_rdi1_clk",
+                       .parent_names = pix_rdi_parents,
+                       .num_parents = 3,
+                       .ops = &clk_ops_pix_rdi,
+               },
+       },
+};
+
+static struct clk_pix_rdi csi_rdi2_clk = {
+       .s_reg = 0x0238,
+       .s_mask = BIT(4),
+       .s2_reg = 0x0238,
+       .s2_mask = BIT(5),
+       .clkr = {
+               .enable_reg = 0x0238,
+               .enable_mask = BIT(6),
+               .hw.init = &(struct clk_init_data){
+                       .name = "csi_rdi2_clk",
+                       .parent_names = pix_rdi_parents,
+                       .num_parents = 3,
+                       .ops = &clk_ops_pix_rdi,
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_csiphytimer[] = {
+       {  85330000, P_PLL8, 1, 2, 9 },
+       { 177780000, P_PLL2, 1, 2, 9 },
+       { }
+};
+
+static struct clk_rcg csiphytimer_src = {
+       .ns_reg = 0x0168,
+       .md_reg = 0x0164,
+       .mn = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 8,
+               .reset_in_cc = true,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 24,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 14,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .freq_tbl = clk_tbl_csiphytimer,
+       .clkr = {
+               .enable_reg = 0x0160,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "csiphytimer_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static const char *csixphy_timer_src[] = { "csiphytimer_src" };
+
+static struct clk_branch csiphy0_timer_clk = {
+       .halt_reg = 0x01e8,
+       .halt_bit = 17,
+       .clkr = {
+               .enable_reg = 0x0160,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = csixphy_timer_src,
+                       .num_parents = 1,
+                       .name = "csiphy0_timer_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch csiphy1_timer_clk = {
+       .halt_reg = 0x01e8,
+       .halt_bit = 18,
+       .clkr = {
+               .enable_reg = 0x0160,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = csixphy_timer_src,
+                       .num_parents = 1,
+                       .name = "csiphy1_timer_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch csiphy2_timer_clk = {
+       .halt_reg = 0x01e8,
+       .halt_bit = 30,
+       .clkr = {
+               .enable_reg = 0x0160,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = csixphy_timer_src,
+                       .num_parents = 1,
+                       .name = "csiphy2_timer_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_gfx2d[] = {
+       {  27000000, P_PXO,  1,  0 },
+       {  48000000, P_PLL8, 1,  8 },
+       {  54857000, P_PLL8, 1,  7 },
+       {  64000000, P_PLL8, 1,  6 },
+       {  76800000, P_PLL8, 1,  5 },
+       {  96000000, P_PLL8, 1,  4 },
+       { 128000000, P_PLL8, 1,  3 },
+       { 145455000, P_PLL2, 2, 11 },
+       { 160000000, P_PLL2, 1,  5 },
+       { 177778000, P_PLL2, 2,  9 },
+       { 200000000, P_PLL2, 1,  4 },
+       { 228571000, P_PLL2, 2,  7 },
+       { }
+};
+
+static struct clk_dyn_rcg gfx2d0_src = {
+       .ns_reg = 0x0070,
+       .md_reg[0] = 0x0064,
+       .md_reg[1] = 0x0068,
+       .mn[0] = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 25,
+               .mnctr_mode_shift = 9,
+               .n_val_shift = 20,
+               .m_val_shift = 4,
+               .width = 4,
+       },
+       .mn[1] = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 24,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 16,
+               .m_val_shift = 4,
+               .width = 4,
+       },
+       .s[0] = {
+               .src_sel_shift = 3,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .s[1] = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .mux_sel_bit = 11,
+       .freq_tbl = clk_tbl_gfx2d,
+       .clkr = {
+               .enable_reg = 0x0060,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gfx2d0_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_dyn_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch gfx2d0_clk = {
+       .halt_reg = 0x01c8,
+       .halt_bit = 9,
+       .clkr = {
+               .enable_reg = 0x0060,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gfx2d0_clk",
+                       .parent_names = (const char *[]){ "gfx2d0_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_dyn_rcg gfx2d1_src = {
+       .ns_reg = 0x007c,
+       .md_reg[0] = 0x0078,
+       .md_reg[1] = 0x006c,
+       .mn[0] = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 25,
+               .mnctr_mode_shift = 9,
+               .n_val_shift = 20,
+               .m_val_shift = 4,
+               .width = 4,
+       },
+       .mn[1] = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 24,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 16,
+               .m_val_shift = 4,
+               .width = 4,
+       },
+       .s[0] = {
+               .src_sel_shift = 3,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .s[1] = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .mux_sel_bit = 11,
+       .freq_tbl = clk_tbl_gfx2d,
+       .clkr = {
+               .enable_reg = 0x0074,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gfx2d1_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_dyn_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch gfx2d1_clk = {
+       .halt_reg = 0x01c8,
+       .halt_bit = 14,
+       .clkr = {
+               .enable_reg = 0x0074,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gfx2d1_clk",
+                       .parent_names = (const char *[]){ "gfx2d1_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_gfx3d[] = {
+       {  27000000, P_PXO,  1,  0 },
+       {  48000000, P_PLL8, 1,  8 },
+       {  54857000, P_PLL8, 1,  7 },
+       {  64000000, P_PLL8, 1,  6 },
+       {  76800000, P_PLL8, 1,  5 },
+       {  96000000, P_PLL8, 1,  4 },
+       { 128000000, P_PLL8, 1,  3 },
+       { 145455000, P_PLL2, 2, 11 },
+       { 160000000, P_PLL2, 1,  5 },
+       { 177778000, P_PLL2, 2,  9 },
+       { 200000000, P_PLL2, 1,  4 },
+       { 228571000, P_PLL2, 2,  7 },
+       { 266667000, P_PLL2, 1,  3 },
+       { 300000000, P_PLL3, 1,  4 },
+       { 320000000, P_PLL2, 2,  5 },
+       { 400000000, P_PLL2, 1,  2 },
+       { }
+};
+
+static struct clk_dyn_rcg gfx3d_src = {
+       .ns_reg = 0x008c,
+       .md_reg[0] = 0x0084,
+       .md_reg[1] = 0x0088,
+       .mn[0] = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 25,
+               .mnctr_mode_shift = 9,
+               .n_val_shift = 18,
+               .m_val_shift = 4,
+               .width = 4,
+       },
+       .mn[1] = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 24,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 14,
+               .m_val_shift = 4,
+               .width = 4,
+       },
+       .s[0] = {
+               .src_sel_shift = 3,
+               .parent_map = mmcc_pxo_pll8_pll2_pll3_map,
+       },
+       .s[1] = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_pll3_map,
+       },
+       .mux_sel_bit = 11,
+       .freq_tbl = clk_tbl_gfx3d,
+       .clkr = {
+               .enable_reg = 0x0080,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gfx3d_src",
+                       .parent_names = mmcc_pxo_pll8_pll2_pll3,
+                       .num_parents = 3,
+                       .ops = &clk_dyn_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch gfx3d_clk = {
+       .halt_reg = 0x01c8,
+       .halt_bit = 4,
+       .clkr = {
+               .enable_reg = 0x0080,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gfx3d_clk",
+                       .parent_names = (const char *[]){ "gfx3d_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_ijpeg[] = {
+       {  27000000, P_PXO,  1, 0,  0 },
+       {  36570000, P_PLL8, 1, 2, 21 },
+       {  54860000, P_PLL8, 7, 0,  0 },
+       {  96000000, P_PLL8, 4, 0,  0 },
+       { 109710000, P_PLL8, 1, 2,  7 },
+       { 128000000, P_PLL8, 3, 0,  0 },
+       { 153600000, P_PLL8, 1, 2,  5 },
+       { 200000000, P_PLL2, 4, 0,  0 },
+       { 228571000, P_PLL2, 1, 2,  7 },
+       { 266667000, P_PLL2, 1, 1,  3 },
+       { 320000000, P_PLL2, 1, 2,  5 },
+       { }
+};
+
+static struct clk_rcg ijpeg_src = {
+       .ns_reg = 0x00a0,
+       .md_reg = 0x009c,
+       .mn = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 16,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 12,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .freq_tbl = clk_tbl_ijpeg,
+       .clkr = {
+               .enable_reg = 0x0098,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ijpeg_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch ijpeg_clk = {
+       .halt_reg = 0x01c8,
+       .halt_bit = 24,
+       .clkr = {
+               .enable_reg = 0x0098,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ijpeg_clk",
+                       .parent_names = (const char *[]){ "ijpeg_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_jpegd[] = {
+       {  64000000, P_PLL8, 6 },
+       {  76800000, P_PLL8, 5 },
+       {  96000000, P_PLL8, 4 },
+       { 160000000, P_PLL2, 5 },
+       { 200000000, P_PLL2, 4 },
+       { }
+};
+
+static struct clk_rcg jpegd_src = {
+       .ns_reg = 0x00ac,
+       .p = {
+               .pre_div_shift = 12,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .freq_tbl = clk_tbl_jpegd,
+       .clkr = {
+               .enable_reg = 0x00a4,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "jpegd_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch jpegd_clk = {
+       .halt_reg = 0x01c8,
+       .halt_bit = 19,
+       .clkr = {
+               .enable_reg = 0x00a4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "jpegd_clk",
+                       .parent_names = (const char *[]){ "jpegd_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_mdp[] = {
+       {   9600000, P_PLL8, 1, 1, 40 },
+       {  13710000, P_PLL8, 1, 1, 28 },
+       {  27000000, P_PXO,  1, 0,  0 },
+       {  29540000, P_PLL8, 1, 1, 13 },
+       {  34910000, P_PLL8, 1, 1, 11 },
+       {  38400000, P_PLL8, 1, 1, 10 },
+       {  59080000, P_PLL8, 1, 2, 13 },
+       {  76800000, P_PLL8, 1, 1,  5 },
+       {  85330000, P_PLL8, 1, 2,  9 },
+       {  96000000, P_PLL8, 1, 1,  4 },
+       { 128000000, P_PLL8, 1, 1,  3 },
+       { 160000000, P_PLL2, 1, 1,  5 },
+       { 177780000, P_PLL2, 1, 2,  9 },
+       { 200000000, P_PLL2, 1, 1,  4 },
+       { 228571000, P_PLL2, 1, 2,  7 },
+       { 266667000, P_PLL2, 1, 1,  3 },
+       { }
+};
+
+static struct clk_dyn_rcg mdp_src = {
+       .ns_reg = 0x00d0,
+       .md_reg[0] = 0x00c4,
+       .md_reg[1] = 0x00c8,
+       .mn[0] = {
+               .mnctr_en_bit = 8,
+               .mnctr_reset_bit = 31,
+               .mnctr_mode_shift = 9,
+               .n_val_shift = 22,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .mn[1] = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 30,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 14,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .s[0] = {
+               .src_sel_shift = 3,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .s[1] = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .mux_sel_bit = 11,
+       .freq_tbl = clk_tbl_mdp,
+       .clkr = {
+               .enable_reg = 0x00c0,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdp_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_dyn_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch mdp_clk = {
+       .halt_reg = 0x01d0,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x00c0,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdp_clk",
+                       .parent_names = (const char *[]){ "mdp_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch mdp_lut_clk = {
+       .halt_reg = 0x01e8,
+       .halt_bit = 13,
+       .clkr = {
+               .enable_reg = 0x016c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = (const char *[]){ "mdp_clk" },
+                       .num_parents = 1,
+                       .name = "mdp_lut_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch mdp_vsync_clk = {
+       .halt_reg = 0x01cc,
+       .halt_bit = 22,
+       .clkr = {
+               .enable_reg = 0x0058,
+               .enable_mask = BIT(6),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdp_vsync_clk",
+                       .parent_names = (const char *[]){ "pxo" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_rot[] = {
+       {  27000000, P_PXO,   1 },
+       {  29540000, P_PLL8, 13 },
+       {  32000000, P_PLL8, 12 },
+       {  38400000, P_PLL8, 10 },
+       {  48000000, P_PLL8,  8 },
+       {  54860000, P_PLL8,  7 },
+       {  64000000, P_PLL8,  6 },
+       {  76800000, P_PLL8,  5 },
+       {  96000000, P_PLL8,  4 },
+       { 100000000, P_PLL2,  8 },
+       { 114290000, P_PLL2,  7 },
+       { 133330000, P_PLL2,  6 },
+       { 160000000, P_PLL2,  5 },
+       { 200000000, P_PLL2,  4 },
+       { }
+};
+
+static struct clk_dyn_rcg rot_src = {
+       .ns_reg = 0x00e8,
+       .p[0] = {
+               .pre_div_shift = 22,
+               .pre_div_width = 4,
+       },
+       .p[1] = {
+               .pre_div_shift = 26,
+               .pre_div_width = 4,
+       },
+       .s[0] = {
+               .src_sel_shift = 16,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .s[1] = {
+               .src_sel_shift = 19,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .mux_sel_bit = 30,
+       .freq_tbl = clk_tbl_rot,
+       .clkr = {
+               .enable_reg = 0x00e0,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "rot_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_dyn_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch rot_clk = {
+       .halt_reg = 0x01d0,
+       .halt_bit = 15,
+       .clkr = {
+               .enable_reg = 0x00e0,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "rot_clk",
+                       .parent_names = (const char *[]){ "rot_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+#define P_HDMI_PLL 1
+
+static u8 mmcc_pxo_hdmi_map[] = {
+       [P_PXO]         = 0,
+       [P_HDMI_PLL]    = 2,
+};
+
+static const char *mmcc_pxo_hdmi[] = {
+       "pxo",
+       "hdmi_pll",
+};
+
+static struct freq_tbl clk_tbl_tv[] = {
+       {  25200000, P_HDMI_PLL, 1, 0, 0 },
+       {  27000000, P_HDMI_PLL, 1, 0, 0 },
+       {  27030000, P_HDMI_PLL, 1, 0, 0 },
+       {  74250000, P_HDMI_PLL, 1, 0, 0 },
+       { 108000000, P_HDMI_PLL, 1, 0, 0 },
+       { 148500000, P_HDMI_PLL, 1, 0, 0 },
+       { }
+};
+
+static struct clk_rcg tv_src = {
+       .ns_reg = 0x00f4,
+       .md_reg = 0x00f0,
+       .mn = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 16,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 14,
+               .pre_div_width = 2,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_hdmi_map,
+       },
+       .freq_tbl = clk_tbl_tv,
+       .clkr = {
+               .enable_reg = 0x00ec,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "tv_src",
+                       .parent_names = mmcc_pxo_hdmi,
+                       .num_parents = 2,
+                       .ops = &clk_rcg_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static const char *tv_src_name[] = { "tv_src" };
+
+static struct clk_branch tv_enc_clk = {
+       .halt_reg = 0x01d4,
+       .halt_bit = 9,
+       .clkr = {
+               .enable_reg = 0x00ec,
+               .enable_mask = BIT(8),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = tv_src_name,
+                       .num_parents = 1,
+                       .name = "tv_enc_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch tv_dac_clk = {
+       .halt_reg = 0x01d4,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x00ec,
+               .enable_mask = BIT(10),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = tv_src_name,
+                       .num_parents = 1,
+                       .name = "tv_dac_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch mdp_tv_clk = {
+       .halt_reg = 0x01d4,
+       .halt_bit = 12,
+       .clkr = {
+               .enable_reg = 0x00ec,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = tv_src_name,
+                       .num_parents = 1,
+                       .name = "mdp_tv_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch hdmi_tv_clk = {
+       .halt_reg = 0x01d4,
+       .halt_bit = 11,
+       .clkr = {
+               .enable_reg = 0x00ec,
+               .enable_mask = BIT(12),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = tv_src_name,
+                       .num_parents = 1,
+                       .name = "hdmi_tv_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch hdmi_app_clk = {
+       .halt_reg = 0x01cc,
+       .halt_bit = 25,
+       .clkr = {
+               .enable_reg = 0x005c,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = (const char *[]){ "pxo" },
+                       .num_parents = 1,
+                       .name = "hdmi_app_clk",
+                       .ops = &clk_branch_ops,
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_vcodec[] = {
+       {  27000000, P_PXO,  1,  0 },
+       {  32000000, P_PLL8, 1, 12 },
+       {  48000000, P_PLL8, 1,  8 },
+       {  54860000, P_PLL8, 1,  7 },
+       {  96000000, P_PLL8, 1,  4 },
+       { 133330000, P_PLL2, 1,  6 },
+       { 200000000, P_PLL2, 1,  4 },
+       { 228570000, P_PLL2, 2,  7 },
+       { 266670000, P_PLL2, 1,  3 },
+       { }
+};
+
+static struct clk_dyn_rcg vcodec_src = {
+       .ns_reg = 0x0100,
+       .md_reg[0] = 0x00fc,
+       .md_reg[1] = 0x0128,
+       .mn[0] = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 31,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 11,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .mn[1] = {
+               .mnctr_en_bit = 10,
+               .mnctr_reset_bit = 30,
+               .mnctr_mode_shift = 11,
+               .n_val_shift = 19,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .s[0] = {
+               .src_sel_shift = 27,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .s[1] = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .mux_sel_bit = 13,
+       .freq_tbl = clk_tbl_vcodec,
+       .clkr = {
+               .enable_reg = 0x00f8,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vcodec_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_dyn_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch vcodec_clk = {
+       .halt_reg = 0x01d0,
+       .halt_bit = 29,
+       .clkr = {
+               .enable_reg = 0x00f8,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vcodec_clk",
+                       .parent_names = (const char *[]){ "vcodec_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_vpe[] = {
+       {  27000000, P_PXO,   1 },
+       {  34909000, P_PLL8, 11 },
+       {  38400000, P_PLL8, 10 },
+       {  64000000, P_PLL8,  6 },
+       {  76800000, P_PLL8,  5 },
+       {  96000000, P_PLL8,  4 },
+       { 100000000, P_PLL2,  8 },
+       { 160000000, P_PLL2,  5 },
+       { }
+};
+
+static struct clk_rcg vpe_src = {
+       .ns_reg = 0x0118,
+       .p = {
+               .pre_div_shift = 12,
+               .pre_div_width = 4,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .freq_tbl = clk_tbl_vpe,
+       .clkr = {
+               .enable_reg = 0x0110,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vpe_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch vpe_clk = {
+       .halt_reg = 0x01c8,
+       .halt_bit = 28,
+       .clkr = {
+               .enable_reg = 0x0110,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vpe_clk",
+                       .parent_names = (const char *[]){ "vpe_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct freq_tbl clk_tbl_vfe[] = {
+       {  13960000, P_PLL8,  1, 2, 55 },
+       {  27000000, P_PXO,   1, 0,  0 },
+       {  36570000, P_PLL8,  1, 2, 21 },
+       {  38400000, P_PLL8,  2, 1,  5 },
+       {  45180000, P_PLL8,  1, 2, 17 },
+       {  48000000, P_PLL8,  2, 1,  4 },
+       {  54860000, P_PLL8,  1, 1,  7 },
+       {  64000000, P_PLL8,  2, 1,  3 },
+       {  76800000, P_PLL8,  1, 1,  5 },
+       {  96000000, P_PLL8,  2, 1,  2 },
+       { 109710000, P_PLL8,  1, 2,  7 },
+       { 128000000, P_PLL8,  1, 1,  3 },
+       { 153600000, P_PLL8,  1, 2,  5 },
+       { 200000000, P_PLL2,  2, 1,  2 },
+       { 228570000, P_PLL2,  1, 2,  7 },
+       { 266667000, P_PLL2,  1, 1,  3 },
+       { 320000000, P_PLL2,  1, 2,  5 },
+       { }
+};
+
+static struct clk_rcg vfe_src = {
+       .ns_reg = 0x0108,
+       .mn = {
+               .mnctr_en_bit = 5,
+               .mnctr_reset_bit = 7,
+               .mnctr_mode_shift = 6,
+               .n_val_shift = 16,
+               .m_val_shift = 8,
+               .width = 8,
+       },
+       .p = {
+               .pre_div_shift = 10,
+               .pre_div_width = 1,
+       },
+       .s = {
+               .src_sel_shift = 0,
+               .parent_map = mmcc_pxo_pll8_pll2_map,
+       },
+       .freq_tbl = clk_tbl_vfe,
+       .clkr = {
+               .enable_reg = 0x0104,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vfe_src",
+                       .parent_names = mmcc_pxo_pll8_pll2,
+                       .num_parents = 3,
+                       .ops = &clk_rcg_ops,
+               },
+       },
+};
+
+static struct clk_branch vfe_clk = {
+       .halt_reg = 0x01cc,
+       .halt_bit = 6,
+       .clkr = {
+               .enable_reg = 0x0104,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vfe_clk",
+                       .parent_names = (const char *[]){ "vfe_src" },
+                       .num_parents = 1,
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch vfe_csi_clk = {
+       .halt_reg = 0x01cc,
+       .halt_bit = 8,
+       .clkr = {
+               .enable_reg = 0x0104,
+               .enable_mask = BIT(12),
+               .hw.init = &(struct clk_init_data){
+                       .parent_names = (const char *[]){ "vfe_src" },
+                       .num_parents = 1,
+                       .name = "vfe_csi_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_SET_RATE_PARENT,
+               },
+       },
+};
+
+static struct clk_branch gmem_axi_clk = {
+       .halt_reg = 0x01d8,
+       .halt_bit = 6,
+       .clkr = {
+               .enable_reg = 0x0018,
+               .enable_mask = BIT(24),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gmem_axi_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch ijpeg_axi_clk = {
+       .hwcg_reg = 0x0018,
+       .hwcg_bit = 11,
+       .halt_reg = 0x01d8,
+       .halt_bit = 4,
+       .clkr = {
+               .enable_reg = 0x0018,
+               .enable_mask = BIT(21),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ijpeg_axi_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch mmss_imem_axi_clk = {
+       .hwcg_reg = 0x0018,
+       .hwcg_bit = 15,
+       .halt_reg = 0x01d8,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x0018,
+               .enable_mask = BIT(22),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mmss_imem_axi_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch jpegd_axi_clk = {
+       .halt_reg = 0x01d8,
+       .halt_bit = 5,
+       .clkr = {
+               .enable_reg = 0x0018,
+               .enable_mask = BIT(25),
+               .hw.init = &(struct clk_init_data){
+                       .name = "jpegd_axi_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch vcodec_axi_b_clk = {
+       .hwcg_reg = 0x0114,
+       .hwcg_bit = 22,
+       .halt_reg = 0x01e8,
+       .halt_bit = 25,
+       .clkr = {
+               .enable_reg = 0x0114,
+               .enable_mask = BIT(23),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vcodec_axi_b_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch vcodec_axi_a_clk = {
+       .hwcg_reg = 0x0114,
+       .hwcg_bit = 24,
+       .halt_reg = 0x01e8,
+       .halt_bit = 26,
+       .clkr = {
+               .enable_reg = 0x0114,
+               .enable_mask = BIT(25),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vcodec_axi_a_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch vcodec_axi_clk = {
+       .hwcg_reg = 0x0018,
+       .hwcg_bit = 13,
+       .halt_reg = 0x01d8,
+       .halt_bit = 3,
+       .clkr = {
+               .enable_reg = 0x0018,
+               .enable_mask = BIT(19),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vcodec_axi_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch vfe_axi_clk = {
+       .halt_reg = 0x01d8,
+       .halt_bit = 0,
+       .clkr = {
+               .enable_reg = 0x0018,
+               .enable_mask = BIT(18),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vfe_axi_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch mdp_axi_clk = {
+       .hwcg_reg = 0x0018,
+       .hwcg_bit = 16,
+       .halt_reg = 0x01d8,
+       .halt_bit = 8,
+       .clkr = {
+               .enable_reg = 0x0018,
+               .enable_mask = BIT(23),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdp_axi_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch rot_axi_clk = {
+       .hwcg_reg = 0x0020,
+       .hwcg_bit = 25,
+       .halt_reg = 0x01d8,
+       .halt_bit = 2,
+       .clkr = {
+               .enable_reg = 0x0020,
+               .enable_mask = BIT(24),
+               .hw.init = &(struct clk_init_data){
+                       .name = "rot_axi_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch vpe_axi_clk = {
+       .hwcg_reg = 0x0020,
+       .hwcg_bit = 27,
+       .halt_reg = 0x01d8,
+       .halt_bit = 1,
+       .clkr = {
+               .enable_reg = 0x0020,
+               .enable_mask = BIT(26),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vpe_axi_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gfx3d_axi_clk = {
+       .hwcg_reg = 0x0244,
+       .hwcg_bit = 24,
+       .halt_reg = 0x0240,
+       .halt_bit = 30,
+       .clkr = {
+               .enable_reg = 0x0244,
+               .enable_mask = BIT(25),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gfx3d_axi_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch amp_ahb_clk = {
+       .halt_reg = 0x01dc,
+       .halt_bit = 18,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(24),
+               .hw.init = &(struct clk_init_data){
+                       .name = "amp_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch csi_ahb_clk = {
+       .halt_reg = 0x01dc,
+       .halt_bit = 16,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(7),
+               .hw.init = &(struct clk_init_data){
+                       .name = "csi_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT
+               },
+       },
+};
+
+static struct clk_branch dsi_m_ahb_clk = {
+       .halt_reg = 0x01dc,
+       .halt_bit = 19,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(9),
+               .hw.init = &(struct clk_init_data){
+                       .name = "dsi_m_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch dsi_s_ahb_clk = {
+       .hwcg_reg = 0x0038,
+       .hwcg_bit = 20,
+       .halt_reg = 0x01dc,
+       .halt_bit = 21,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(18),
+               .hw.init = &(struct clk_init_data){
+                       .name = "dsi_s_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch dsi2_m_ahb_clk = {
+       .halt_reg = 0x01d8,
+       .halt_bit = 18,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(17),
+               .hw.init = &(struct clk_init_data){
+                       .name = "dsi2_m_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT
+               },
+       },
+};
+
+static struct clk_branch dsi2_s_ahb_clk = {
+       .hwcg_reg = 0x0038,
+       .hwcg_bit = 15,
+       .halt_reg = 0x01dc,
+       .halt_bit = 20,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(22),
+               .hw.init = &(struct clk_init_data){
+                       .name = "dsi2_s_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gfx2d0_ahb_clk = {
+       .hwcg_reg = 0x0038,
+       .hwcg_bit = 28,
+       .halt_reg = 0x01dc,
+       .halt_bit = 2,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(19),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gfx2d0_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gfx2d1_ahb_clk = {
+       .hwcg_reg = 0x0038,
+       .hwcg_bit = 29,
+       .halt_reg = 0x01dc,
+       .halt_bit = 3,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(2),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gfx2d1_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch gfx3d_ahb_clk = {
+       .hwcg_reg = 0x0038,
+       .hwcg_bit = 27,
+       .halt_reg = 0x01dc,
+       .halt_bit = 4,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(3),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gfx3d_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch hdmi_m_ahb_clk = {
+       .hwcg_reg = 0x0038,
+       .hwcg_bit = 21,
+       .halt_reg = 0x01dc,
+       .halt_bit = 5,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(14),
+               .hw.init = &(struct clk_init_data){
+                       .name = "hdmi_m_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch hdmi_s_ahb_clk = {
+       .hwcg_reg = 0x0038,
+       .hwcg_bit = 22,
+       .halt_reg = 0x01dc,
+       .halt_bit = 6,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(4),
+               .hw.init = &(struct clk_init_data){
+                       .name = "hdmi_s_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch ijpeg_ahb_clk = {
+       .halt_reg = 0x01dc,
+       .halt_bit = 9,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(5),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ijpeg_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT
+               },
+       },
+};
+
+static struct clk_branch mmss_imem_ahb_clk = {
+       .hwcg_reg = 0x0038,
+       .hwcg_bit = 12,
+       .halt_reg = 0x01dc,
+       .halt_bit = 10,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(6),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mmss_imem_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT
+               },
+       },
+};
+
+static struct clk_branch jpegd_ahb_clk = {
+       .halt_reg = 0x01dc,
+       .halt_bit = 7,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(21),
+               .hw.init = &(struct clk_init_data){
+                       .name = "jpegd_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch mdp_ahb_clk = {
+       .halt_reg = 0x01dc,
+       .halt_bit = 11,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(10),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdp_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch rot_ahb_clk = {
+       .halt_reg = 0x01dc,
+       .halt_bit = 13,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(12),
+               .hw.init = &(struct clk_init_data){
+                       .name = "rot_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT
+               },
+       },
+};
+
+static struct clk_branch smmu_ahb_clk = {
+       .hwcg_reg = 0x0008,
+       .hwcg_bit = 26,
+       .halt_reg = 0x01dc,
+       .halt_bit = 22,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(15),
+               .hw.init = &(struct clk_init_data){
+                       .name = "smmu_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch tv_enc_ahb_clk = {
+       .halt_reg = 0x01dc,
+       .halt_bit = 23,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(25),
+               .hw.init = &(struct clk_init_data){
+                       .name = "tv_enc_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch vcodec_ahb_clk = {
+       .hwcg_reg = 0x0038,
+       .hwcg_bit = 26,
+       .halt_reg = 0x01dc,
+       .halt_bit = 12,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vcodec_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch vfe_ahb_clk = {
+       .halt_reg = 0x01dc,
+       .halt_bit = 14,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(13),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vfe_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_branch vpe_ahb_clk = {
+       .halt_reg = 0x01dc,
+       .halt_bit = 15,
+       .clkr = {
+               .enable_reg = 0x0008,
+               .enable_mask = BIT(16),
+               .hw.init = &(struct clk_init_data){
+                       .name = "vpe_ahb_clk",
+                       .ops = &clk_branch_ops,
+                       .flags = CLK_IS_ROOT,
+               },
+       },
+};
+
+static struct clk_regmap *mmcc_msm8960_clks[] = {
+       [TV_ENC_AHB_CLK] = &tv_enc_ahb_clk.clkr,
+       [AMP_AHB_CLK] = &amp_ahb_clk.clkr,
+       [DSI2_S_AHB_CLK] = &dsi2_s_ahb_clk.clkr,
+       [JPEGD_AHB_CLK] = &jpegd_ahb_clk.clkr,
+       [GFX2D0_AHB_CLK] = &gfx2d0_ahb_clk.clkr,
+       [DSI_S_AHB_CLK] = &dsi_s_ahb_clk.clkr,
+       [DSI2_M_AHB_CLK] = &dsi2_m_ahb_clk.clkr,
+       [VPE_AHB_CLK] = &vpe_ahb_clk.clkr,
+       [SMMU_AHB_CLK] = &smmu_ahb_clk.clkr,
+       [HDMI_M_AHB_CLK] = &hdmi_m_ahb_clk.clkr,
+       [VFE_AHB_CLK] = &vfe_ahb_clk.clkr,
+       [ROT_AHB_CLK] = &rot_ahb_clk.clkr,
+       [VCODEC_AHB_CLK] = &vcodec_ahb_clk.clkr,
+       [MDP_AHB_CLK] = &mdp_ahb_clk.clkr,
+       [DSI_M_AHB_CLK] = &dsi_m_ahb_clk.clkr,
+       [CSI_AHB_CLK] = &csi_ahb_clk.clkr,
+       [MMSS_IMEM_AHB_CLK] = &mmss_imem_ahb_clk.clkr,
+       [IJPEG_AHB_CLK] = &ijpeg_ahb_clk.clkr,
+       [HDMI_S_AHB_CLK] = &hdmi_s_ahb_clk.clkr,
+       [GFX3D_AHB_CLK] = &gfx3d_ahb_clk.clkr,
+       [GFX2D1_AHB_CLK] = &gfx2d1_ahb_clk.clkr,
+       [JPEGD_AXI_CLK] = &jpegd_axi_clk.clkr,
+       [GMEM_AXI_CLK] = &gmem_axi_clk.clkr,
+       [MDP_AXI_CLK] = &mdp_axi_clk.clkr,
+       [MMSS_IMEM_AXI_CLK] = &mmss_imem_axi_clk.clkr,
+       [IJPEG_AXI_CLK] = &ijpeg_axi_clk.clkr,
+       [GFX3D_AXI_CLK] = &gfx3d_axi_clk.clkr,
+       [VCODEC_AXI_CLK] = &vcodec_axi_clk.clkr,
+       [VFE_AXI_CLK] = &vfe_axi_clk.clkr,
+       [VPE_AXI_CLK] = &vpe_axi_clk.clkr,
+       [ROT_AXI_CLK] = &rot_axi_clk.clkr,
+       [VCODEC_AXI_A_CLK] = &vcodec_axi_a_clk.clkr,
+       [VCODEC_AXI_B_CLK] = &vcodec_axi_b_clk.clkr,
+       [CSI0_SRC] = &csi0_src.clkr,
+       [CSI0_CLK] = &csi0_clk.clkr,
+       [CSI0_PHY_CLK] = &csi0_phy_clk.clkr,
+       [CSI1_SRC] = &csi1_src.clkr,
+       [CSI1_CLK] = &csi1_clk.clkr,
+       [CSI1_PHY_CLK] = &csi1_phy_clk.clkr,
+       [CSI2_SRC] = &csi2_src.clkr,
+       [CSI2_CLK] = &csi2_clk.clkr,
+       [CSI2_PHY_CLK] = &csi2_phy_clk.clkr,
+       [CSI_PIX_CLK] = &csi_pix_clk.clkr,
+       [CSI_RDI_CLK] = &csi_rdi_clk.clkr,
+       [MDP_VSYNC_CLK] = &mdp_vsync_clk.clkr,
+       [HDMI_APP_CLK] = &hdmi_app_clk.clkr,
+       [CSI_PIX1_CLK] = &csi_pix1_clk.clkr,
+       [CSI_RDI2_CLK] = &csi_rdi2_clk.clkr,
+       [CSI_RDI1_CLK] = &csi_rdi1_clk.clkr,
+       [GFX2D0_SRC] = &gfx2d0_src.clkr,
+       [GFX2D0_CLK] = &gfx2d0_clk.clkr,
+       [GFX2D1_SRC] = &gfx2d1_src.clkr,
+       [GFX2D1_CLK] = &gfx2d1_clk.clkr,
+       [GFX3D_SRC] = &gfx3d_src.clkr,
+       [GFX3D_CLK] = &gfx3d_clk.clkr,
+       [IJPEG_SRC] = &ijpeg_src.clkr,
+       [IJPEG_CLK] = &ijpeg_clk.clkr,
+       [JPEGD_SRC] = &jpegd_src.clkr,
+       [JPEGD_CLK] = &jpegd_clk.clkr,
+       [MDP_SRC] = &mdp_src.clkr,
+       [MDP_CLK] = &mdp_clk.clkr,
+       [MDP_LUT_CLK] = &mdp_lut_clk.clkr,
+       [ROT_SRC] = &rot_src.clkr,
+       [ROT_CLK] = &rot_clk.clkr,
+       [TV_ENC_CLK] = &tv_enc_clk.clkr,
+       [TV_DAC_CLK] = &tv_dac_clk.clkr,
+       [HDMI_TV_CLK] = &hdmi_tv_clk.clkr,
+       [MDP_TV_CLK] = &mdp_tv_clk.clkr,
+       [TV_SRC] = &tv_src.clkr,
+       [VCODEC_SRC] = &vcodec_src.clkr,
+       [VCODEC_CLK] = &vcodec_clk.clkr,
+       [VFE_SRC] = &vfe_src.clkr,
+       [VFE_CLK] = &vfe_clk.clkr,
+       [VFE_CSI_CLK] = &vfe_csi_clk.clkr,
+       [VPE_SRC] = &vpe_src.clkr,
+       [VPE_CLK] = &vpe_clk.clkr,
+       [CAMCLK0_SRC] = &camclk0_src.clkr,
+       [CAMCLK0_CLK] = &camclk0_clk.clkr,
+       [CAMCLK1_SRC] = &camclk1_src.clkr,
+       [CAMCLK1_CLK] = &camclk1_clk.clkr,
+       [CAMCLK2_SRC] = &camclk2_src.clkr,
+       [CAMCLK2_CLK] = &camclk2_clk.clkr,
+       [CSIPHYTIMER_SRC] = &csiphytimer_src.clkr,
+       [CSIPHY2_TIMER_CLK] = &csiphy2_timer_clk.clkr,
+       [CSIPHY1_TIMER_CLK] = &csiphy1_timer_clk.clkr,
+       [CSIPHY0_TIMER_CLK] = &csiphy0_timer_clk.clkr,
+       [PLL2] = &pll2.clkr,
+};
+
+static const struct qcom_reset_map mmcc_msm8960_resets[] = {
+       [VPE_AXI_RESET] = { 0x0208, 15 },
+       [IJPEG_AXI_RESET] = { 0x0208, 14 },
+       [MPD_AXI_RESET] = { 0x0208, 13 },
+       [VFE_AXI_RESET] = { 0x0208, 9 },
+       [SP_AXI_RESET] = { 0x0208, 8 },
+       [VCODEC_AXI_RESET] = { 0x0208, 7 },
+       [ROT_AXI_RESET] = { 0x0208, 6 },
+       [VCODEC_AXI_A_RESET] = { 0x0208, 5 },
+       [VCODEC_AXI_B_RESET] = { 0x0208, 4 },
+       [FAB_S3_AXI_RESET] = { 0x0208, 3 },
+       [FAB_S2_AXI_RESET] = { 0x0208, 2 },
+       [FAB_S1_AXI_RESET] = { 0x0208, 1 },
+       [FAB_S0_AXI_RESET] = { 0x0208 },
+       [SMMU_GFX3D_ABH_RESET] = { 0x020c, 31 },
+       [SMMU_VPE_AHB_RESET] = { 0x020c, 30 },
+       [SMMU_VFE_AHB_RESET] = { 0x020c, 29 },
+       [SMMU_ROT_AHB_RESET] = { 0x020c, 28 },
+       [SMMU_VCODEC_B_AHB_RESET] = { 0x020c, 27 },
+       [SMMU_VCODEC_A_AHB_RESET] = { 0x020c, 26 },
+       [SMMU_MDP1_AHB_RESET] = { 0x020c, 25 },
+       [SMMU_MDP0_AHB_RESET] = { 0x020c, 24 },
+       [SMMU_JPEGD_AHB_RESET] = { 0x020c, 23 },
+       [SMMU_IJPEG_AHB_RESET] = { 0x020c, 22 },
+       [SMMU_GFX2D0_AHB_RESET] = { 0x020c, 21 },
+       [SMMU_GFX2D1_AHB_RESET] = { 0x020c, 20 },
+       [APU_AHB_RESET] = { 0x020c, 18 },
+       [CSI_AHB_RESET] = { 0x020c, 17 },
+       [TV_ENC_AHB_RESET] = { 0x020c, 15 },
+       [VPE_AHB_RESET] = { 0x020c, 14 },
+       [FABRIC_AHB_RESET] = { 0x020c, 13 },
+       [GFX2D0_AHB_RESET] = { 0x020c, 12 },
+       [GFX2D1_AHB_RESET] = { 0x020c, 11 },
+       [GFX3D_AHB_RESET] = { 0x020c, 10 },
+       [HDMI_AHB_RESET] = { 0x020c, 9 },
+       [MSSS_IMEM_AHB_RESET] = { 0x020c, 8 },
+       [IJPEG_AHB_RESET] = { 0x020c, 7 },
+       [DSI_M_AHB_RESET] = { 0x020c, 6 },
+       [DSI_S_AHB_RESET] = { 0x020c, 5 },
+       [JPEGD_AHB_RESET] = { 0x020c, 4 },
+       [MDP_AHB_RESET] = { 0x020c, 3 },
+       [ROT_AHB_RESET] = { 0x020c, 2 },
+       [VCODEC_AHB_RESET] = { 0x020c, 1 },
+       [VFE_AHB_RESET] = { 0x020c, 0 },
+       [DSI2_M_AHB_RESET] = { 0x0210, 31 },
+       [DSI2_S_AHB_RESET] = { 0x0210, 30 },
+       [CSIPHY2_RESET] = { 0x0210, 29 },
+       [CSI_PIX1_RESET] = { 0x0210, 28 },
+       [CSIPHY0_RESET] = { 0x0210, 27 },
+       [CSIPHY1_RESET] = { 0x0210, 26 },
+       [DSI2_RESET] = { 0x0210, 25 },
+       [VFE_CSI_RESET] = { 0x0210, 24 },
+       [MDP_RESET] = { 0x0210, 21 },
+       [AMP_RESET] = { 0x0210, 20 },
+       [JPEGD_RESET] = { 0x0210, 19 },
+       [CSI1_RESET] = { 0x0210, 18 },
+       [VPE_RESET] = { 0x0210, 17 },
+       [MMSS_FABRIC_RESET] = { 0x0210, 16 },
+       [VFE_RESET] = { 0x0210, 15 },
+       [GFX2D0_RESET] = { 0x0210, 14 },
+       [GFX2D1_RESET] = { 0x0210, 13 },
+       [GFX3D_RESET] = { 0x0210, 12 },
+       [HDMI_RESET] = { 0x0210, 11 },
+       [MMSS_IMEM_RESET] = { 0x0210, 10 },
+       [IJPEG_RESET] = { 0x0210, 9 },
+       [CSI0_RESET] = { 0x0210, 8 },
+       [DSI_RESET] = { 0x0210, 7 },
+       [VCODEC_RESET] = { 0x0210, 6 },
+       [MDP_TV_RESET] = { 0x0210, 4 },
+       [MDP_VSYNC_RESET] = { 0x0210, 3 },
+       [ROT_RESET] = { 0x0210, 2 },
+       [TV_HDMI_RESET] = { 0x0210, 1 },
+       [TV_ENC_RESET] = { 0x0210 },
+       [CSI2_RESET] = { 0x0214, 2 },
+       [CSI_RDI1_RESET] = { 0x0214, 1 },
+       [CSI_RDI2_RESET] = { 0x0214 },
+};
+
+static const struct regmap_config mmcc_msm8960_regmap_config = {
+       .reg_bits       = 32,
+       .reg_stride     = 4,
+       .val_bits       = 32,
+       .max_register   = 0x334,
+       .fast_io        = true,
+};
+
+static const struct of_device_id mmcc_msm8960_match_table[] = {
+       { .compatible = "qcom,mmcc-msm8960" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, mmcc_msm8960_match_table);
+
+struct qcom_cc {
+       struct qcom_reset_controller reset;
+       struct clk_onecell_data data;
+       struct clk *clks[];
+};
+
+static int mmcc_msm8960_probe(struct platform_device *pdev)
+{
+       void __iomem *base;
+       struct resource *res;
+       int i, ret;
+       struct device *dev = &pdev->dev;
+       struct clk *clk;
+       struct clk_onecell_data *data;
+       struct clk **clks;
+       struct regmap *regmap;
+       size_t num_clks;
+       struct qcom_reset_controller *reset;
+       struct qcom_cc *cc;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       base = devm_ioremap_resource(dev, res);
+       if (IS_ERR(base))
+               return PTR_ERR(base);
+
+       regmap = devm_regmap_init_mmio(dev, base, &mmcc_msm8960_regmap_config);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       num_clks = ARRAY_SIZE(mmcc_msm8960_clks);
+       cc = devm_kzalloc(dev, sizeof(*cc) + sizeof(*clks) * num_clks,
+                         GFP_KERNEL);
+       if (!cc)
+               return -ENOMEM;
+
+       clks = cc->clks;
+       data = &cc->data;
+       data->clks = clks;
+       data->clk_num = num_clks;
+
+       for (i = 0; i < num_clks; i++) {
+               if (!mmcc_msm8960_clks[i])
+                       continue;
+               clk = devm_clk_register_regmap(dev, mmcc_msm8960_clks[i]);
+               if (IS_ERR(clk))
+                       return PTR_ERR(clk);
+               clks[i] = clk;
+       }
+
+       ret = of_clk_add_provider(dev->of_node, of_clk_src_onecell_get, data);
+       if (ret)
+               return ret;
+
+       reset = &cc->reset;
+       reset->rcdev.of_node = dev->of_node;
+       reset->rcdev.ops = &qcom_reset_ops,
+       reset->rcdev.owner = THIS_MODULE,
+       reset->rcdev.nr_resets = ARRAY_SIZE(mmcc_msm8960_resets),
+       reset->regmap = regmap;
+       reset->reset_map = mmcc_msm8960_resets,
+       platform_set_drvdata(pdev, &reset->rcdev);
+
+       ret = reset_controller_register(&reset->rcdev);
+       if (ret)
+               of_clk_del_provider(dev->of_node);
+
+       return ret;
+}
+
+static int mmcc_msm8960_remove(struct platform_device *pdev)
+{
+       of_clk_del_provider(pdev->dev.of_node);
+       reset_controller_unregister(platform_get_drvdata(pdev));
+       return 0;
+}
+
+static struct platform_driver mmcc_msm8960_driver = {
+       .probe          = mmcc_msm8960_probe,
+       .remove         = mmcc_msm8960_remove,
+       .driver         = {
+               .name   = "mmcc-msm8960",
+               .owner  = THIS_MODULE,
+               .of_match_table = mmcc_msm8960_match_table,
+       },
+};
+
+module_platform_driver(mmcc_msm8960_driver);
+
+MODULE_DESCRIPTION("QCOM MMCC MSM8960 Driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:mmcc-msm8960");
diff --git a/drivers/clk/qcom/mmcc-msm8974.c b/drivers/clk/qcom/mmcc-msm8974.c
new file mode 100644 (file)
index 0000000..c957745
--- /dev/null
@@ -0,0 +1,2625 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+#include <linux/reset-controller.h>
+
+#include <dt-bindings/clock/qcom,mmcc-msm8974.h>
+#include <dt-bindings/reset/qcom,mmcc-msm8974.h>
+
+#include "clk-regmap.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-branch.h"
+#include "reset.h"
+
+#define P_XO           0
+#define P_MMPLL0       1
+#define P_EDPLINK      1
+#define P_MMPLL1       2
+#define P_HDMIPLL      2
+#define P_GPLL0                3
+#define P_EDPVCO       3
+#define P_GPLL1                4
+#define P_DSI0PLL      4
+#define P_MMPLL2       4
+#define P_MMPLL3       4
+#define P_DSI1PLL      5
+
+static const u8 mmcc_xo_mmpll0_mmpll1_gpll0_map[] = {
+       [P_XO]          = 0,
+       [P_MMPLL0]      = 1,
+       [P_MMPLL1]      = 2,
+       [P_GPLL0]       = 5,
+};
+
+static const char *mmcc_xo_mmpll0_mmpll1_gpll0[] = {
+       "xo",
+       "mmpll0_vote",
+       "mmpll1_vote",
+       "mmss_gpll0_vote",
+};
+
+static const u8 mmcc_xo_mmpll0_dsi_hdmi_gpll0_map[] = {
+       [P_XO]          = 0,
+       [P_MMPLL0]      = 1,
+       [P_HDMIPLL]     = 4,
+       [P_GPLL0]       = 5,
+       [P_DSI0PLL]     = 2,
+       [P_DSI1PLL]     = 3,
+};
+
+static const char *mmcc_xo_mmpll0_dsi_hdmi_gpll0[] = {
+       "xo",
+       "mmpll0_vote",
+       "hdmipll",
+       "mmss_gpll0_vote",
+       "dsi0pll",
+       "dsi1pll",
+};
+
+static const u8 mmcc_xo_mmpll0_1_2_gpll0_map[] = {
+       [P_XO]          = 0,
+       [P_MMPLL0]      = 1,
+       [P_MMPLL1]      = 2,
+       [P_GPLL0]       = 5,
+       [P_MMPLL2]      = 3,
+};
+
+static const char *mmcc_xo_mmpll0_1_2_gpll0[] = {
+       "xo",
+       "mmpll0_vote",
+       "mmpll1_vote",
+       "mmss_gpll0_vote",
+       "mmpll2",
+};
+
+static const u8 mmcc_xo_mmpll0_1_3_gpll0_map[] = {
+       [P_XO]          = 0,
+       [P_MMPLL0]      = 1,
+       [P_MMPLL1]      = 2,
+       [P_GPLL0]       = 5,
+       [P_MMPLL3]      = 3,
+};
+
+static const char *mmcc_xo_mmpll0_1_3_gpll0[] = {
+       "xo",
+       "mmpll0_vote",
+       "mmpll1_vote",
+       "mmss_gpll0_vote",
+       "mmpll3",
+};
+
+static const u8 mmcc_xo_mmpll0_1_gpll1_0_map[] = {
+       [P_XO]          = 0,
+       [P_MMPLL0]      = 1,
+       [P_MMPLL1]      = 2,
+       [P_GPLL0]       = 5,
+       [P_GPLL1]       = 4,
+};
+
+static const char *mmcc_xo_mmpll0_1_gpll1_0[] = {
+       "xo",
+       "mmpll0_vote",
+       "mmpll1_vote",
+       "mmss_gpll0_vote",
+       "gpll1_vote",
+};
+
+static const u8 mmcc_xo_dsi_hdmi_edp_map[] = {
+       [P_XO]          = 0,
+       [P_EDPLINK]     = 4,
+       [P_HDMIPLL]     = 3,
+       [P_EDPVCO]      = 5,
+       [P_DSI0PLL]     = 1,
+       [P_DSI1PLL]     = 2,
+};
+
+static const char *mmcc_xo_dsi_hdmi_edp[] = {
+       "xo",
+       "edp_link_clk",
+       "hdmipll",
+       "edp_vco_div",
+       "dsi0pll",
+       "dsi1pll",
+};
+
+static const u8 mmcc_xo_dsi_hdmi_edp_gpll0_map[] = {
+       [P_XO]          = 0,
+       [P_EDPLINK]     = 4,
+       [P_HDMIPLL]     = 3,
+       [P_GPLL0]       = 5,
+       [P_DSI0PLL]     = 1,
+       [P_DSI1PLL]     = 2,
+};
+
+static const char *mmcc_xo_dsi_hdmi_edp_gpll0[] = {
+       "xo",
+       "edp_link_clk",
+       "hdmipll",
+       "gpll0_vote",
+       "dsi0pll",
+       "dsi1pll",
+};
+
+#define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) }
+
+static struct clk_pll mmpll0 = {
+       .l_reg = 0x0004,
+       .m_reg = 0x0008,
+       .n_reg = 0x000c,
+       .config_reg = 0x0014,
+       .mode_reg = 0x0000,
+       .status_reg = 0x001c,
+        .clkr.hw.init = &(struct clk_init_data){
+                .name = "mmpll0",
+                .parent_names = (const char *[]){ "xo" },
+                .num_parents = 1,
+                .ops = &clk_pll_ops,
+        },
+};
+
+static struct clk_regmap mmpll0_vote = {
+       .enable_reg = 0x0100,
+       .enable_mask = BIT(0),
+       .hw.init = &(struct clk_init_data){
+               .name = "mmpll0_vote",
+               .parent_names = (const char *[]){ "mmpll0" },
+               .num_parents = 1,
+               .ops = &clk_pll_vote_ops,
+       },
+};
+
+static struct clk_pll mmpll1 = {
+       .l_reg = 0x0044,
+       .m_reg = 0x0048,
+       .n_reg = 0x004c,
+       .config_reg = 0x0054,
+       .mode_reg = 0x0040,
+       .status_reg = 0x005c,
+        .clkr.hw.init = &(struct clk_init_data){
+                .name = "mmpll1",
+                .parent_names = (const char *[]){ "xo" },
+                .num_parents = 1,
+                .ops = &clk_pll_ops,
+        },
+};
+
+static struct clk_regmap mmpll1_vote = {
+       .enable_reg = 0x0100,
+       .enable_mask = BIT(1),
+       .hw.init = &(struct clk_init_data){
+               .name = "mmpll1_vote",
+               .parent_names = (const char *[]){ "mmpll1" },
+               .num_parents = 1,
+               .ops = &clk_pll_vote_ops,
+       },
+};
+
+static struct clk_pll mmpll2 = {
+       .l_reg = 0x4104,
+       .m_reg = 0x4108,
+       .n_reg = 0x410c,
+       .config_reg = 0x4114,
+       .mode_reg = 0x4100,
+       .status_reg = 0x411c,
+        .clkr.hw.init = &(struct clk_init_data){
+                .name = "mmpll2",
+                .parent_names = (const char *[]){ "xo" },
+                .num_parents = 1,
+                .ops = &clk_pll_ops,
+        },
+};
+
+static struct clk_pll mmpll3 = {
+       .l_reg = 0x0084,
+       .m_reg = 0x0088,
+       .n_reg = 0x008c,
+       .config_reg = 0x0094,
+       .mode_reg = 0x0080,
+       .status_reg = 0x009c,
+        .clkr.hw.init = &(struct clk_init_data){
+                .name = "mmpll3",
+                .parent_names = (const char *[]){ "xo" },
+                .num_parents = 1,
+                .ops = &clk_pll_ops,
+        },
+};
+
+static struct clk_rcg2 mmss_ahb_clk_src = {
+       .cmd_rcgr = 0x5000,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "mmss_ahb_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_mmss_axi_clk[] = {
+       F( 19200000, P_XO, 1, 0, 0),
+       F( 37500000, P_GPLL0, 16, 0, 0),
+       F( 50000000, P_GPLL0, 12, 0, 0),
+       F( 75000000, P_GPLL0, 8, 0, 0),
+       F(100000000, P_GPLL0, 6, 0, 0),
+       F(150000000, P_GPLL0, 4, 0, 0),
+       F(291750000, P_MMPLL1, 4, 0, 0),
+       F(400000000, P_MMPLL0, 2, 0, 0),
+       F(466800000, P_MMPLL1, 2.5, 0, 0),
+};
+
+static struct clk_rcg2 mmss_axi_clk_src = {
+       .cmd_rcgr = 0x5040,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_mmss_axi_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "mmss_axi_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_ocmemnoc_clk[] = {
+       F( 19200000, P_XO, 1, 0, 0),
+       F( 37500000, P_GPLL0, 16, 0, 0),
+       F( 50000000, P_GPLL0, 12, 0, 0),
+       F( 75000000, P_GPLL0, 8, 0, 0),
+       F(100000000, P_GPLL0, 6, 0, 0),
+       F(150000000, P_GPLL0, 4, 0, 0),
+       F(291750000, P_MMPLL1, 4, 0, 0),
+       F(400000000, P_MMPLL0, 2, 0, 0),
+};
+
+static struct clk_rcg2 ocmemnoc_clk_src = {
+       .cmd_rcgr = 0x5090,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_ocmemnoc_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "ocmemnoc_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_camss_csi0_3_clk[] = {
+       F(100000000, P_GPLL0, 6, 0, 0),
+       F(200000000, P_MMPLL0, 4, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 csi0_clk_src = {
+       .cmd_rcgr = 0x3090,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_csi0_3_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "csi0_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 csi1_clk_src = {
+       .cmd_rcgr = 0x3100,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_csi0_3_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "csi1_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 csi2_clk_src = {
+       .cmd_rcgr = 0x3160,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_csi0_3_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "csi2_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 csi3_clk_src = {
+       .cmd_rcgr = 0x31c0,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_csi0_3_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "csi3_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_camss_vfe_vfe0_1_clk[] = {
+       F(37500000, P_GPLL0, 16, 0, 0),
+       F(50000000, P_GPLL0, 12, 0, 0),
+       F(60000000, P_GPLL0, 10, 0, 0),
+       F(80000000, P_GPLL0, 7.5, 0, 0),
+       F(100000000, P_GPLL0, 6, 0, 0),
+       F(109090000, P_GPLL0, 5.5, 0, 0),
+       F(133330000, P_GPLL0, 4.5, 0, 0),
+       F(200000000, P_GPLL0, 3, 0, 0),
+       F(228570000, P_MMPLL0, 3.5, 0, 0),
+       F(266670000, P_MMPLL0, 3, 0, 0),
+       F(320000000, P_MMPLL0, 2.5, 0, 0),
+       F(400000000, P_MMPLL0, 2, 0, 0),
+       F(465000000, P_MMPLL3, 2, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 vfe0_clk_src = {
+       .cmd_rcgr = 0x3600,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_vfe_vfe0_1_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "vfe0_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 vfe1_clk_src = {
+       .cmd_rcgr = 0x3620,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_vfe_vfe0_1_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "vfe1_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_mdss_mdp_clk[] = {
+       F(37500000, P_GPLL0, 16, 0, 0),
+       F(60000000, P_GPLL0, 10, 0, 0),
+       F(75000000, P_GPLL0, 8, 0, 0),
+       F(85710000, P_GPLL0, 7, 0, 0),
+       F(100000000, P_GPLL0, 6, 0, 0),
+       F(133330000, P_MMPLL0, 6, 0, 0),
+       F(160000000, P_MMPLL0, 5, 0, 0),
+       F(200000000, P_MMPLL0, 4, 0, 0),
+       F(228570000, P_MMPLL0, 3.5, 0, 0),
+       F(240000000, P_GPLL0, 2.5, 0, 0),
+       F(266670000, P_MMPLL0, 3, 0, 0),
+       F(320000000, P_MMPLL0, 2.5, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 mdp_clk_src = {
+       .cmd_rcgr = 0x2040,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_dsi_hdmi_gpll0_map,
+       .freq_tbl = ftbl_mdss_mdp_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "mdp_clk_src",
+               .parent_names = mmcc_xo_mmpll0_dsi_hdmi_gpll0,
+               .num_parents = 6,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 gfx3d_clk_src = {
+       .cmd_rcgr = 0x4000,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_1_2_gpll0_map,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "gfx3d_clk_src",
+               .parent_names = mmcc_xo_mmpll0_1_2_gpll0,
+               .num_parents = 5,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_camss_jpeg_jpeg0_2_clk[] = {
+       F(75000000, P_GPLL0, 8, 0, 0),
+       F(133330000, P_GPLL0, 4.5, 0, 0),
+       F(200000000, P_GPLL0, 3, 0, 0),
+       F(228570000, P_MMPLL0, 3.5, 0, 0),
+       F(266670000, P_MMPLL0, 3, 0, 0),
+       F(320000000, P_MMPLL0, 2.5, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 jpeg0_clk_src = {
+       .cmd_rcgr = 0x3500,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_jpeg_jpeg0_2_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "jpeg0_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 jpeg1_clk_src = {
+       .cmd_rcgr = 0x3520,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_jpeg_jpeg0_2_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "jpeg1_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 jpeg2_clk_src = {
+       .cmd_rcgr = 0x3540,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_jpeg_jpeg0_2_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "jpeg2_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_mdss_pclk0_clk[] = {
+       F(125000000, P_DSI0PLL, 2, 0, 0),
+       F(250000000, P_DSI0PLL, 1, 0, 0),
+       { }
+};
+
+static struct freq_tbl ftbl_mdss_pclk1_clk[] = {
+       F(125000000, P_DSI1PLL, 2, 0, 0),
+       F(250000000, P_DSI1PLL, 1, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 pclk0_clk_src = {
+       .cmd_rcgr = 0x2000,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_dsi_hdmi_edp_gpll0_map,
+       .freq_tbl = ftbl_mdss_pclk0_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "pclk0_clk_src",
+               .parent_names = mmcc_xo_dsi_hdmi_edp_gpll0,
+               .num_parents = 6,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 pclk1_clk_src = {
+       .cmd_rcgr = 0x2020,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_dsi_hdmi_edp_gpll0_map,
+       .freq_tbl = ftbl_mdss_pclk1_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "pclk1_clk_src",
+               .parent_names = mmcc_xo_dsi_hdmi_edp_gpll0,
+               .num_parents = 6,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_venus0_vcodec0_clk[] = {
+       F(50000000, P_GPLL0, 12, 0, 0),
+       F(100000000, P_GPLL0, 6, 0, 0),
+       F(133330000, P_MMPLL0, 6, 0, 0),
+       F(200000000, P_MMPLL0, 4, 0, 0),
+       F(266670000, P_MMPLL0, 3, 0, 0),
+       F(465000000, P_MMPLL3, 2, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 vcodec0_clk_src = {
+       .cmd_rcgr = 0x1000,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_1_3_gpll0_map,
+       .freq_tbl = ftbl_venus0_vcodec0_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "vcodec0_clk_src",
+               .parent_names = mmcc_xo_mmpll0_1_3_gpll0,
+               .num_parents = 5,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_camss_cci_cci_clk[] = {
+       F(19200000, P_XO, 1, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 cci_clk_src = {
+       .cmd_rcgr = 0x3300,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_cci_cci_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "cci_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_camss_gp0_1_clk[] = {
+       F(10000, P_XO, 16, 1, 120),
+       F(24000, P_XO, 16, 1, 50),
+       F(6000000, P_GPLL0, 10, 1, 10),
+       F(12000000, P_GPLL0, 10, 1, 5),
+       F(13000000, P_GPLL0, 4, 13, 150),
+       F(24000000, P_GPLL0, 5, 1, 5),
+       { }
+};
+
+static struct clk_rcg2 camss_gp0_clk_src = {
+       .cmd_rcgr = 0x3420,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_1_gpll1_0_map,
+       .freq_tbl = ftbl_camss_gp0_1_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "camss_gp0_clk_src",
+               .parent_names = mmcc_xo_mmpll0_1_gpll1_0,
+               .num_parents = 5,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 camss_gp1_clk_src = {
+       .cmd_rcgr = 0x3450,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_1_gpll1_0_map,
+       .freq_tbl = ftbl_camss_gp0_1_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "camss_gp1_clk_src",
+               .parent_names = mmcc_xo_mmpll0_1_gpll1_0,
+               .num_parents = 5,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_camss_mclk0_3_clk[] = {
+       F(4800000, P_XO, 4, 0, 0),
+       F(6000000, P_GPLL0, 10, 1, 10),
+       F(8000000, P_GPLL0, 15, 1, 5),
+       F(9600000, P_XO, 2, 0, 0),
+       F(16000000, P_GPLL0, 12.5, 1, 3),
+       F(19200000, P_XO, 1, 0, 0),
+       F(24000000, P_GPLL0, 5, 1, 5),
+       F(32000000, P_MMPLL0, 5, 1, 5),
+       F(48000000, P_GPLL0, 12.5, 0, 0),
+       F(64000000, P_MMPLL0, 12.5, 0, 0),
+       F(66670000, P_GPLL0, 9, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 mclk0_clk_src = {
+       .cmd_rcgr = 0x3360,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_mclk0_3_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "mclk0_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 mclk1_clk_src = {
+       .cmd_rcgr = 0x3390,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_mclk0_3_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "mclk1_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 mclk2_clk_src = {
+       .cmd_rcgr = 0x33c0,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_mclk0_3_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "mclk2_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 mclk3_clk_src = {
+       .cmd_rcgr = 0x33f0,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_mclk0_3_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "mclk3_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_camss_phy0_2_csi0_2phytimer_clk[] = {
+       F(100000000, P_GPLL0, 6, 0, 0),
+       F(200000000, P_MMPLL0, 4, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 csi0phytimer_clk_src = {
+       .cmd_rcgr = 0x3000,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_phy0_2_csi0_2phytimer_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "csi0phytimer_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 csi1phytimer_clk_src = {
+       .cmd_rcgr = 0x3030,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_phy0_2_csi0_2phytimer_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "csi1phytimer_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 csi2phytimer_clk_src = {
+       .cmd_rcgr = 0x3060,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_phy0_2_csi0_2phytimer_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "csi2phytimer_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_camss_vfe_cpp_clk[] = {
+       F(133330000, P_GPLL0, 4.5, 0, 0),
+       F(266670000, P_MMPLL0, 3, 0, 0),
+       F(320000000, P_MMPLL0, 2.5, 0, 0),
+       F(400000000, P_MMPLL0, 2, 0, 0),
+       F(465000000, P_MMPLL3, 2, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 cpp_clk_src = {
+       .cmd_rcgr = 0x3640,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_camss_vfe_cpp_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "cpp_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_mdss_byte0_clk[] = {
+       F(93750000, P_DSI0PLL, 8, 0, 0),
+       F(187500000, P_DSI0PLL, 4, 0, 0),
+       { }
+};
+
+static struct freq_tbl ftbl_mdss_byte1_clk[] = {
+       F(93750000, P_DSI1PLL, 8, 0, 0),
+       F(187500000, P_DSI1PLL, 4, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 byte0_clk_src = {
+       .cmd_rcgr = 0x2120,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_dsi_hdmi_edp_gpll0_map,
+       .freq_tbl = ftbl_mdss_byte0_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "byte0_clk_src",
+               .parent_names = mmcc_xo_dsi_hdmi_edp_gpll0,
+               .num_parents = 6,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 byte1_clk_src = {
+       .cmd_rcgr = 0x2140,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_dsi_hdmi_edp_gpll0_map,
+       .freq_tbl = ftbl_mdss_byte1_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "byte1_clk_src",
+               .parent_names = mmcc_xo_dsi_hdmi_edp_gpll0,
+               .num_parents = 6,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_mdss_edpaux_clk[] = {
+       F(19200000, P_XO, 1, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 edpaux_clk_src = {
+       .cmd_rcgr = 0x20e0,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_mdss_edpaux_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "edpaux_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_mdss_edplink_clk[] = {
+       F(135000000, P_EDPLINK, 2, 0, 0),
+       F(270000000, P_EDPLINK, 11, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 edplink_clk_src = {
+       .cmd_rcgr = 0x20c0,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_dsi_hdmi_edp_gpll0_map,
+       .freq_tbl = ftbl_mdss_edplink_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "edplink_clk_src",
+               .parent_names = mmcc_xo_dsi_hdmi_edp_gpll0,
+               .num_parents = 6,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_mdss_edppixel_clk[] = {
+       F(175000000, P_EDPVCO, 2, 0, 0),
+       F(350000000, P_EDPVCO, 11, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 edppixel_clk_src = {
+       .cmd_rcgr = 0x20a0,
+       .mnd_width = 8,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_dsi_hdmi_edp_map,
+       .freq_tbl = ftbl_mdss_edppixel_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "edppixel_clk_src",
+               .parent_names = mmcc_xo_dsi_hdmi_edp,
+               .num_parents = 6,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_mdss_esc0_1_clk[] = {
+       F(19200000, P_XO, 1, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 esc0_clk_src = {
+       .cmd_rcgr = 0x2160,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_dsi_hdmi_edp_gpll0_map,
+       .freq_tbl = ftbl_mdss_esc0_1_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "esc0_clk_src",
+               .parent_names = mmcc_xo_dsi_hdmi_edp_gpll0,
+               .num_parents = 6,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_rcg2 esc1_clk_src = {
+       .cmd_rcgr = 0x2180,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_dsi_hdmi_edp_gpll0_map,
+       .freq_tbl = ftbl_mdss_esc0_1_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "esc1_clk_src",
+               .parent_names = mmcc_xo_dsi_hdmi_edp_gpll0,
+               .num_parents = 6,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_mdss_extpclk_clk[] = {
+       F(25200000, P_HDMIPLL, 1, 0, 0),
+       F(27000000, P_HDMIPLL, 1, 0, 0),
+       F(27030000, P_HDMIPLL, 1, 0, 0),
+       F(65000000, P_HDMIPLL, 1, 0, 0),
+       F(74250000, P_HDMIPLL, 1, 0, 0),
+       F(108000000, P_HDMIPLL, 1, 0, 0),
+       F(148500000, P_HDMIPLL, 1, 0, 0),
+       F(268500000, P_HDMIPLL, 1, 0, 0),
+       F(297000000, P_HDMIPLL, 1, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 extpclk_clk_src = {
+       .cmd_rcgr = 0x2060,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_dsi_hdmi_edp_gpll0_map,
+       .freq_tbl = ftbl_mdss_extpclk_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "extpclk_clk_src",
+               .parent_names = mmcc_xo_dsi_hdmi_edp_gpll0,
+               .num_parents = 6,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_mdss_hdmi_clk[] = {
+       F(19200000, P_XO, 1, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 hdmi_clk_src = {
+       .cmd_rcgr = 0x2100,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_mdss_hdmi_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "hdmi_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct freq_tbl ftbl_mdss_vsync_clk[] = {
+       F(19200000, P_XO, 1, 0, 0),
+       { }
+};
+
+static struct clk_rcg2 vsync_clk_src = {
+       .cmd_rcgr = 0x2080,
+       .hid_width = 5,
+       .parent_map = mmcc_xo_mmpll0_mmpll1_gpll0_map,
+       .freq_tbl = ftbl_mdss_vsync_clk,
+       .clkr.hw.init = &(struct clk_init_data){
+               .name = "vsync_clk_src",
+               .parent_names = mmcc_xo_mmpll0_mmpll1_gpll0,
+               .num_parents = 4,
+               .ops = &clk_rcg2_ops,
+       },
+};
+
+static struct clk_branch camss_cci_cci_ahb_clk = {
+       .halt_reg = 0x3348,
+       .clkr = {
+               .enable_reg = 0x3348,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_cci_cci_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_cci_cci_clk = {
+       .halt_reg = 0x3344,
+       .clkr = {
+               .enable_reg = 0x3344,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_cci_cci_clk",
+                       .parent_names = (const char *[]){
+                               "cci_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi0_ahb_clk = {
+       .halt_reg = 0x30bc,
+       .clkr = {
+               .enable_reg = 0x30bc,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi0_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi0_clk = {
+       .halt_reg = 0x30b4,
+       .clkr = {
+               .enable_reg = 0x30b4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi0_clk",
+                       .parent_names = (const char *[]){
+                               "csi0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi0phy_clk = {
+       .halt_reg = 0x30c4,
+       .clkr = {
+               .enable_reg = 0x30c4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi0phy_clk",
+                       .parent_names = (const char *[]){
+                               "csi0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi0pix_clk = {
+       .halt_reg = 0x30e4,
+       .clkr = {
+               .enable_reg = 0x30e4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi0pix_clk",
+                       .parent_names = (const char *[]){
+                               "csi0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi0rdi_clk = {
+       .halt_reg = 0x30d4,
+       .clkr = {
+               .enable_reg = 0x30d4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi0rdi_clk",
+                       .parent_names = (const char *[]){
+                               "csi0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi1_ahb_clk = {
+       .halt_reg = 0x3128,
+       .clkr = {
+               .enable_reg = 0x3128,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi1_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi1_clk = {
+       .halt_reg = 0x3124,
+       .clkr = {
+               .enable_reg = 0x3124,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi1_clk",
+                       .parent_names = (const char *[]){
+                               "csi1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi1phy_clk = {
+       .halt_reg = 0x3134,
+       .clkr = {
+               .enable_reg = 0x3134,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi1phy_clk",
+                       .parent_names = (const char *[]){
+                               "csi1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi1pix_clk = {
+       .halt_reg = 0x3154,
+       .clkr = {
+               .enable_reg = 0x3154,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi1pix_clk",
+                       .parent_names = (const char *[]){
+                               "csi1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi1rdi_clk = {
+       .halt_reg = 0x3144,
+       .clkr = {
+               .enable_reg = 0x3144,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi1rdi_clk",
+                       .parent_names = (const char *[]){
+                               "csi1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi2_ahb_clk = {
+       .halt_reg = 0x3188,
+       .clkr = {
+               .enable_reg = 0x3188,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi2_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi2_clk = {
+       .halt_reg = 0x3184,
+       .clkr = {
+               .enable_reg = 0x3184,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi2_clk",
+                       .parent_names = (const char *[]){
+                               "csi2_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi2phy_clk = {
+       .halt_reg = 0x3194,
+       .clkr = {
+               .enable_reg = 0x3194,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi2phy_clk",
+                       .parent_names = (const char *[]){
+                               "csi2_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi2pix_clk = {
+       .halt_reg = 0x31b4,
+       .clkr = {
+               .enable_reg = 0x31b4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi2pix_clk",
+                       .parent_names = (const char *[]){
+                               "csi2_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi2rdi_clk = {
+       .halt_reg = 0x31a4,
+       .clkr = {
+               .enable_reg = 0x31a4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi2rdi_clk",
+                       .parent_names = (const char *[]){
+                               "csi2_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi3_ahb_clk = {
+       .halt_reg = 0x31e8,
+       .clkr = {
+               .enable_reg = 0x31e8,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi3_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi3_clk = {
+       .halt_reg = 0x31e4,
+       .clkr = {
+               .enable_reg = 0x31e4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi3_clk",
+                       .parent_names = (const char *[]){
+                               "csi3_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi3phy_clk = {
+       .halt_reg = 0x31f4,
+       .clkr = {
+               .enable_reg = 0x31f4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi3phy_clk",
+                       .parent_names = (const char *[]){
+                               "csi3_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi3pix_clk = {
+       .halt_reg = 0x3214,
+       .clkr = {
+               .enable_reg = 0x3214,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi3pix_clk",
+                       .parent_names = (const char *[]){
+                               "csi3_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi3rdi_clk = {
+       .halt_reg = 0x3204,
+       .clkr = {
+               .enable_reg = 0x3204,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi3rdi_clk",
+                       .parent_names = (const char *[]){
+                               "csi3_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi_vfe0_clk = {
+       .halt_reg = 0x3704,
+       .clkr = {
+               .enable_reg = 0x3704,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi_vfe0_clk",
+                       .parent_names = (const char *[]){
+                               "vfe0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_csi_vfe1_clk = {
+       .halt_reg = 0x3714,
+       .clkr = {
+               .enable_reg = 0x3714,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_csi_vfe1_clk",
+                       .parent_names = (const char *[]){
+                               "vfe1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_gp0_clk = {
+       .halt_reg = 0x3444,
+       .clkr = {
+               .enable_reg = 0x3444,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_gp0_clk",
+                       .parent_names = (const char *[]){
+                               "camss_gp0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_gp1_clk = {
+       .halt_reg = 0x3474,
+       .clkr = {
+               .enable_reg = 0x3474,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_gp1_clk",
+                       .parent_names = (const char *[]){
+                               "camss_gp1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_ispif_ahb_clk = {
+       .halt_reg = 0x3224,
+       .clkr = {
+               .enable_reg = 0x3224,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_ispif_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_jpeg_jpeg0_clk = {
+       .halt_reg = 0x35a8,
+       .clkr = {
+               .enable_reg = 0x35a8,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_jpeg_jpeg0_clk",
+                       .parent_names = (const char *[]){
+                               "jpeg0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_jpeg_jpeg1_clk = {
+       .halt_reg = 0x35ac,
+       .clkr = {
+               .enable_reg = 0x35ac,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_jpeg_jpeg1_clk",
+                       .parent_names = (const char *[]){
+                               "jpeg1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_jpeg_jpeg2_clk = {
+       .halt_reg = 0x35b0,
+       .clkr = {
+               .enable_reg = 0x35b0,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_jpeg_jpeg2_clk",
+                       .parent_names = (const char *[]){
+                               "jpeg2_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_jpeg_jpeg_ahb_clk = {
+       .halt_reg = 0x35b4,
+       .clkr = {
+               .enable_reg = 0x35b4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_jpeg_jpeg_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_jpeg_jpeg_axi_clk = {
+       .halt_reg = 0x35b8,
+       .clkr = {
+               .enable_reg = 0x35b8,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_jpeg_jpeg_axi_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_axi_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_jpeg_jpeg_ocmemnoc_clk = {
+       .halt_reg = 0x35bc,
+       .clkr = {
+               .enable_reg = 0x35bc,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_jpeg_jpeg_ocmemnoc_clk",
+                       .parent_names = (const char *[]){
+                               "ocmemnoc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_mclk0_clk = {
+       .halt_reg = 0x3384,
+       .clkr = {
+               .enable_reg = 0x3384,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_mclk0_clk",
+                       .parent_names = (const char *[]){
+                               "mclk0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_mclk1_clk = {
+       .halt_reg = 0x33b4,
+       .clkr = {
+               .enable_reg = 0x33b4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_mclk1_clk",
+                       .parent_names = (const char *[]){
+                               "mclk1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_mclk2_clk = {
+       .halt_reg = 0x33e4,
+       .clkr = {
+               .enable_reg = 0x33e4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_mclk2_clk",
+                       .parent_names = (const char *[]){
+                               "mclk2_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_mclk3_clk = {
+       .halt_reg = 0x3414,
+       .clkr = {
+               .enable_reg = 0x3414,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_mclk3_clk",
+                       .parent_names = (const char *[]){
+                               "mclk3_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_micro_ahb_clk = {
+       .halt_reg = 0x3494,
+       .clkr = {
+               .enable_reg = 0x3494,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_micro_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_phy0_csi0phytimer_clk = {
+       .halt_reg = 0x3024,
+       .clkr = {
+               .enable_reg = 0x3024,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_phy0_csi0phytimer_clk",
+                       .parent_names = (const char *[]){
+                               "csi0phytimer_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_phy1_csi1phytimer_clk = {
+       .halt_reg = 0x3054,
+       .clkr = {
+               .enable_reg = 0x3054,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_phy1_csi1phytimer_clk",
+                       .parent_names = (const char *[]){
+                               "csi1phytimer_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_phy2_csi2phytimer_clk = {
+       .halt_reg = 0x3084,
+       .clkr = {
+               .enable_reg = 0x3084,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_phy2_csi2phytimer_clk",
+                       .parent_names = (const char *[]){
+                               "csi2phytimer_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_top_ahb_clk = {
+       .halt_reg = 0x3484,
+       .clkr = {
+               .enable_reg = 0x3484,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_top_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_vfe_cpp_ahb_clk = {
+       .halt_reg = 0x36b4,
+       .clkr = {
+               .enable_reg = 0x36b4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_vfe_cpp_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_vfe_cpp_clk = {
+       .halt_reg = 0x36b0,
+       .clkr = {
+               .enable_reg = 0x36b0,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_vfe_cpp_clk",
+                       .parent_names = (const char *[]){
+                               "cpp_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_vfe_vfe0_clk = {
+       .halt_reg = 0x36a8,
+       .clkr = {
+               .enable_reg = 0x36a8,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_vfe_vfe0_clk",
+                       .parent_names = (const char *[]){
+                               "vfe0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_vfe_vfe1_clk = {
+       .halt_reg = 0x36ac,
+       .clkr = {
+               .enable_reg = 0x36ac,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_vfe_vfe1_clk",
+                       .parent_names = (const char *[]){
+                               "vfe1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_vfe_vfe_ahb_clk = {
+       .halt_reg = 0x36b8,
+       .clkr = {
+               .enable_reg = 0x36b8,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_vfe_vfe_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_vfe_vfe_axi_clk = {
+       .halt_reg = 0x36bc,
+       .clkr = {
+               .enable_reg = 0x36bc,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_vfe_vfe_axi_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_axi_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch camss_vfe_vfe_ocmemnoc_clk = {
+       .halt_reg = 0x36c0,
+       .clkr = {
+               .enable_reg = 0x36c0,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "camss_vfe_vfe_ocmemnoc_clk",
+                       .parent_names = (const char *[]){
+                               "ocmemnoc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_ahb_clk = {
+       .halt_reg = 0x2308,
+       .clkr = {
+               .enable_reg = 0x2308,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_axi_clk = {
+       .halt_reg = 0x2310,
+       .clkr = {
+               .enable_reg = 0x2310,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_axi_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_axi_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_byte0_clk = {
+       .halt_reg = 0x233c,
+       .clkr = {
+               .enable_reg = 0x233c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_byte0_clk",
+                       .parent_names = (const char *[]){
+                               "byte0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_byte1_clk = {
+       .halt_reg = 0x2340,
+       .clkr = {
+               .enable_reg = 0x2340,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_byte1_clk",
+                       .parent_names = (const char *[]){
+                               "byte1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_edpaux_clk = {
+       .halt_reg = 0x2334,
+       .clkr = {
+               .enable_reg = 0x2334,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_edpaux_clk",
+                       .parent_names = (const char *[]){
+                               "edpaux_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_edplink_clk = {
+       .halt_reg = 0x2330,
+       .clkr = {
+               .enable_reg = 0x2330,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_edplink_clk",
+                       .parent_names = (const char *[]){
+                               "edplink_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_edppixel_clk = {
+       .halt_reg = 0x232c,
+       .clkr = {
+               .enable_reg = 0x232c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_edppixel_clk",
+                       .parent_names = (const char *[]){
+                               "edppixel_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_esc0_clk = {
+       .halt_reg = 0x2344,
+       .clkr = {
+               .enable_reg = 0x2344,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_esc0_clk",
+                       .parent_names = (const char *[]){
+                               "esc0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_esc1_clk = {
+       .halt_reg = 0x2348,
+       .clkr = {
+               .enable_reg = 0x2348,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_esc1_clk",
+                       .parent_names = (const char *[]){
+                               "esc1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_extpclk_clk = {
+       .halt_reg = 0x2324,
+       .clkr = {
+               .enable_reg = 0x2324,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_extpclk_clk",
+                       .parent_names = (const char *[]){
+                               "extpclk_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_hdmi_ahb_clk = {
+       .halt_reg = 0x230c,
+       .clkr = {
+               .enable_reg = 0x230c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_hdmi_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_hdmi_clk = {
+       .halt_reg = 0x2338,
+       .clkr = {
+               .enable_reg = 0x2338,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_hdmi_clk",
+                       .parent_names = (const char *[]){
+                               "hdmi_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_mdp_clk = {
+       .halt_reg = 0x231c,
+       .clkr = {
+               .enable_reg = 0x231c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_mdp_clk",
+                       .parent_names = (const char *[]){
+                               "mdp_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_mdp_lut_clk = {
+       .halt_reg = 0x2320,
+       .clkr = {
+               .enable_reg = 0x2320,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_mdp_lut_clk",
+                       .parent_names = (const char *[]){
+                               "mdp_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_pclk0_clk = {
+       .halt_reg = 0x2314,
+       .clkr = {
+               .enable_reg = 0x2314,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_pclk0_clk",
+                       .parent_names = (const char *[]){
+                               "pclk0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_pclk1_clk = {
+       .halt_reg = 0x2318,
+       .clkr = {
+               .enable_reg = 0x2318,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_pclk1_clk",
+                       .parent_names = (const char *[]){
+                               "pclk1_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mdss_vsync_clk = {
+       .halt_reg = 0x2328,
+       .clkr = {
+               .enable_reg = 0x2328,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mdss_vsync_clk",
+                       .parent_names = (const char *[]){
+                               "vsync_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mmss_misc_ahb_clk = {
+       .halt_reg = 0x502c,
+       .clkr = {
+               .enable_reg = 0x502c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mmss_misc_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mmss_mmssnoc_ahb_clk = {
+       .halt_reg = 0x5024,
+       .clkr = {
+               .enable_reg = 0x5024,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mmss_mmssnoc_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+                       .flags = CLK_IGNORE_UNUSED,
+               },
+       },
+};
+
+static struct clk_branch mmss_mmssnoc_bto_ahb_clk = {
+       .halt_reg = 0x5028,
+       .clkr = {
+               .enable_reg = 0x5028,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mmss_mmssnoc_bto_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+                       .flags = CLK_IGNORE_UNUSED,
+               },
+       },
+};
+
+static struct clk_branch mmss_mmssnoc_axi_clk = {
+       .halt_reg = 0x506c,
+       .clkr = {
+               .enable_reg = 0x506c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mmss_mmssnoc_axi_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_axi_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch mmss_s0_axi_clk = {
+       .halt_reg = 0x5064,
+       .clkr = {
+               .enable_reg = 0x5064,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "mmss_s0_axi_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_axi_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+                       .flags = CLK_IGNORE_UNUSED,
+               },
+       },
+};
+
+static struct clk_branch ocmemcx_ahb_clk = {
+       .halt_reg = 0x405c,
+       .clkr = {
+               .enable_reg = 0x405c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ocmemcx_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch ocmemcx_ocmemnoc_clk = {
+       .halt_reg = 0x4058,
+       .clkr = {
+               .enable_reg = 0x4058,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ocmemcx_ocmemnoc_clk",
+                       .parent_names = (const char *[]){
+                               "ocmemnoc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch oxili_ocmemgx_clk = {
+       .halt_reg = 0x402c,
+       .clkr = {
+               .enable_reg = 0x402c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "oxili_ocmemgx_clk",
+                       .parent_names = (const char *[]){
+                               "gfx3d_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch ocmemnoc_clk = {
+       .halt_reg = 0x50b4,
+       .clkr = {
+               .enable_reg = 0x50b4,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ocmemnoc_clk",
+                       .parent_names = (const char *[]){
+                               "ocmemnoc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch oxili_gfx3d_clk = {
+       .halt_reg = 0x4028,
+       .clkr = {
+               .enable_reg = 0x4028,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "oxili_gfx3d_clk",
+                       .parent_names = (const char *[]){
+                               "gfx3d_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch oxilicx_ahb_clk = {
+       .halt_reg = 0x403c,
+       .clkr = {
+               .enable_reg = 0x403c,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "oxilicx_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch oxilicx_axi_clk = {
+       .halt_reg = 0x4038,
+       .clkr = {
+               .enable_reg = 0x4038,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "oxilicx_axi_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_axi_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch venus0_ahb_clk = {
+       .halt_reg = 0x1030,
+       .clkr = {
+               .enable_reg = 0x1030,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "venus0_ahb_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_ahb_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch venus0_axi_clk = {
+       .halt_reg = 0x1034,
+       .clkr = {
+               .enable_reg = 0x1034,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "venus0_axi_clk",
+                       .parent_names = (const char *[]){
+                               "mmss_axi_clk_src",
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch venus0_ocmemnoc_clk = {
+       .halt_reg = 0x1038,
+       .clkr = {
+               .enable_reg = 0x1038,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "venus0_ocmemnoc_clk",
+                       .parent_names = (const char *[]){
+                               "ocmemnoc_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch venus0_vcodec0_clk = {
+       .halt_reg = 0x1028,
+       .clkr = {
+               .enable_reg = 0x1028,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "venus0_vcodec0_clk",
+                       .parent_names = (const char *[]){
+                               "vcodec0_clk_src",
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static const struct pll_config mmpll1_config = {
+       .l = 60,
+       .m = 25,
+       .n = 32,
+       .vco_val = 0x0,
+       .vco_mask = 0x3 << 20,
+       .pre_div_val = 0x0,
+       .pre_div_mask = 0x3 << 12,
+       .post_div_val = 0x0,
+       .post_div_mask = 0x3 << 8,
+       .mn_ena_mask = BIT(24),
+       .main_output_mask = BIT(0),
+};
+
+static struct pll_config mmpll3_config = {
+       .l = 48,
+       .m = 7,
+       .n = 16,
+       .vco_val = 0x0,
+       .vco_mask = 0x3 << 20,
+       .pre_div_val = 0x0,
+       .pre_div_mask = 0x3 << 12,
+       .post_div_val = 0x0,
+       .post_div_mask = 0x3 << 8,
+       .mn_ena_mask = BIT(24),
+       .main_output_mask = BIT(0),
+       .aux_output_mask = BIT(1),
+};
+
+static struct clk_regmap *mmcc_msm8974_clocks[] = {
+       [MMSS_AHB_CLK_SRC] = &mmss_ahb_clk_src.clkr,
+       [MMSS_AXI_CLK_SRC] = &mmss_axi_clk_src.clkr,
+       [OCMEMNOC_CLK_SRC] = &ocmemnoc_clk_src.clkr,
+       [MMPLL0] = &mmpll0.clkr,
+       [MMPLL0_VOTE] = &mmpll0_vote,
+       [MMPLL1] = &mmpll1.clkr,
+       [MMPLL1_VOTE] = &mmpll1_vote,
+       [MMPLL2] = &mmpll2.clkr,
+       [MMPLL3] = &mmpll3.clkr,
+       [CSI0_CLK_SRC] = &csi0_clk_src.clkr,
+       [CSI1_CLK_SRC] = &csi1_clk_src.clkr,
+       [CSI2_CLK_SRC] = &csi2_clk_src.clkr,
+       [CSI3_CLK_SRC] = &csi3_clk_src.clkr,
+       [VFE0_CLK_SRC] = &vfe0_clk_src.clkr,
+       [VFE1_CLK_SRC] = &vfe1_clk_src.clkr,
+       [MDP_CLK_SRC] = &mdp_clk_src.clkr,
+       [GFX3D_CLK_SRC] = &gfx3d_clk_src.clkr,
+       [JPEG0_CLK_SRC] = &jpeg0_clk_src.clkr,
+       [JPEG1_CLK_SRC] = &jpeg1_clk_src.clkr,
+       [JPEG2_CLK_SRC] = &jpeg2_clk_src.clkr,
+       [PCLK0_CLK_SRC] = &pclk0_clk_src.clkr,
+       [PCLK1_CLK_SRC] = &pclk1_clk_src.clkr,
+       [VCODEC0_CLK_SRC] = &vcodec0_clk_src.clkr,
+       [CCI_CLK_SRC] = &cci_clk_src.clkr,
+       [CAMSS_GP0_CLK_SRC] = &camss_gp0_clk_src.clkr,
+       [CAMSS_GP1_CLK_SRC] = &camss_gp1_clk_src.clkr,
+       [MCLK0_CLK_SRC] = &mclk0_clk_src.clkr,
+       [MCLK1_CLK_SRC] = &mclk1_clk_src.clkr,
+       [MCLK2_CLK_SRC] = &mclk2_clk_src.clkr,
+       [MCLK3_CLK_SRC] = &mclk3_clk_src.clkr,
+       [CSI0PHYTIMER_CLK_SRC] = &csi0phytimer_clk_src.clkr,
+       [CSI1PHYTIMER_CLK_SRC] = &csi1phytimer_clk_src.clkr,
+       [CSI2PHYTIMER_CLK_SRC] = &csi2phytimer_clk_src.clkr,
+       [CPP_CLK_SRC] = &cpp_clk_src.clkr,
+       [BYTE0_CLK_SRC] = &byte0_clk_src.clkr,
+       [BYTE1_CLK_SRC] = &byte1_clk_src.clkr,
+       [EDPAUX_CLK_SRC] = &edpaux_clk_src.clkr,
+       [EDPLINK_CLK_SRC] = &edplink_clk_src.clkr,
+       [EDPPIXEL_CLK_SRC] = &edppixel_clk_src.clkr,
+       [ESC0_CLK_SRC] = &esc0_clk_src.clkr,
+       [ESC1_CLK_SRC] = &esc1_clk_src.clkr,
+       [EXTPCLK_CLK_SRC] = &extpclk_clk_src.clkr,
+       [HDMI_CLK_SRC] = &hdmi_clk_src.clkr,
+       [VSYNC_CLK_SRC] = &vsync_clk_src.clkr,
+       [CAMSS_CCI_CCI_AHB_CLK] = &camss_cci_cci_ahb_clk.clkr,
+       [CAMSS_CCI_CCI_CLK] = &camss_cci_cci_clk.clkr,
+       [CAMSS_CSI0_AHB_CLK] = &camss_csi0_ahb_clk.clkr,
+       [CAMSS_CSI0_CLK] = &camss_csi0_clk.clkr,
+       [CAMSS_CSI0PHY_CLK] = &camss_csi0phy_clk.clkr,
+       [CAMSS_CSI0PIX_CLK] = &camss_csi0pix_clk.clkr,
+       [CAMSS_CSI0RDI_CLK] = &camss_csi0rdi_clk.clkr,
+       [CAMSS_CSI1_AHB_CLK] = &camss_csi1_ahb_clk.clkr,
+       [CAMSS_CSI1_CLK] = &camss_csi1_clk.clkr,
+       [CAMSS_CSI1PHY_CLK] = &camss_csi1phy_clk.clkr,
+       [CAMSS_CSI1PIX_CLK] = &camss_csi1pix_clk.clkr,
+       [CAMSS_CSI1RDI_CLK] = &camss_csi1rdi_clk.clkr,
+       [CAMSS_CSI2_AHB_CLK] = &camss_csi2_ahb_clk.clkr,
+       [CAMSS_CSI2_CLK] = &camss_csi2_clk.clkr,
+       [CAMSS_CSI2PHY_CLK] = &camss_csi2phy_clk.clkr,
+       [CAMSS_CSI2PIX_CLK] = &camss_csi2pix_clk.clkr,
+       [CAMSS_CSI2RDI_CLK] = &camss_csi2rdi_clk.clkr,
+       [CAMSS_CSI3_AHB_CLK] = &camss_csi3_ahb_clk.clkr,
+       [CAMSS_CSI3_CLK] = &camss_csi3_clk.clkr,
+       [CAMSS_CSI3PHY_CLK] = &camss_csi3phy_clk.clkr,
+       [CAMSS_CSI3PIX_CLK] = &camss_csi3pix_clk.clkr,
+       [CAMSS_CSI3RDI_CLK] = &camss_csi3rdi_clk.clkr,
+       [CAMSS_CSI_VFE0_CLK] = &camss_csi_vfe0_clk.clkr,
+       [CAMSS_CSI_VFE1_CLK] = &camss_csi_vfe1_clk.clkr,
+       [CAMSS_GP0_CLK] = &camss_gp0_clk.clkr,
+       [CAMSS_GP1_CLK] = &camss_gp1_clk.clkr,
+       [CAMSS_ISPIF_AHB_CLK] = &camss_ispif_ahb_clk.clkr,
+       [CAMSS_JPEG_JPEG0_CLK] = &camss_jpeg_jpeg0_clk.clkr,
+       [CAMSS_JPEG_JPEG1_CLK] = &camss_jpeg_jpeg1_clk.clkr,
+       [CAMSS_JPEG_JPEG2_CLK] = &camss_jpeg_jpeg2_clk.clkr,
+       [CAMSS_JPEG_JPEG_AHB_CLK] = &camss_jpeg_jpeg_ahb_clk.clkr,
+       [CAMSS_JPEG_JPEG_AXI_CLK] = &camss_jpeg_jpeg_axi_clk.clkr,
+       [CAMSS_JPEG_JPEG_OCMEMNOC_CLK] = &camss_jpeg_jpeg_ocmemnoc_clk.clkr,
+       [CAMSS_MCLK0_CLK] = &camss_mclk0_clk.clkr,
+       [CAMSS_MCLK1_CLK] = &camss_mclk1_clk.clkr,
+       [CAMSS_MCLK2_CLK] = &camss_mclk2_clk.clkr,
+       [CAMSS_MCLK3_CLK] = &camss_mclk3_clk.clkr,
+       [CAMSS_MICRO_AHB_CLK] = &camss_micro_ahb_clk.clkr,
+       [CAMSS_PHY0_CSI0PHYTIMER_CLK] = &camss_phy0_csi0phytimer_clk.clkr,
+       [CAMSS_PHY1_CSI1PHYTIMER_CLK] = &camss_phy1_csi1phytimer_clk.clkr,
+       [CAMSS_PHY2_CSI2PHYTIMER_CLK] = &camss_phy2_csi2phytimer_clk.clkr,
+       [CAMSS_TOP_AHB_CLK] = &camss_top_ahb_clk.clkr,
+       [CAMSS_VFE_CPP_AHB_CLK] = &camss_vfe_cpp_ahb_clk.clkr,
+       [CAMSS_VFE_CPP_CLK] = &camss_vfe_cpp_clk.clkr,
+       [CAMSS_VFE_VFE0_CLK] = &camss_vfe_vfe0_clk.clkr,
+       [CAMSS_VFE_VFE1_CLK] = &camss_vfe_vfe1_clk.clkr,
+       [CAMSS_VFE_VFE_AHB_CLK] = &camss_vfe_vfe_ahb_clk.clkr,
+       [CAMSS_VFE_VFE_AXI_CLK] = &camss_vfe_vfe_axi_clk.clkr,
+       [CAMSS_VFE_VFE_OCMEMNOC_CLK] = &camss_vfe_vfe_ocmemnoc_clk.clkr,
+       [MDSS_AHB_CLK] = &mdss_ahb_clk.clkr,
+       [MDSS_AXI_CLK] = &mdss_axi_clk.clkr,
+       [MDSS_BYTE0_CLK] = &mdss_byte0_clk.clkr,
+       [MDSS_BYTE1_CLK] = &mdss_byte1_clk.clkr,
+       [MDSS_EDPAUX_CLK] = &mdss_edpaux_clk.clkr,
+       [MDSS_EDPLINK_CLK] = &mdss_edplink_clk.clkr,
+       [MDSS_EDPPIXEL_CLK] = &mdss_edppixel_clk.clkr,
+       [MDSS_ESC0_CLK] = &mdss_esc0_clk.clkr,
+       [MDSS_ESC1_CLK] = &mdss_esc1_clk.clkr,
+       [MDSS_EXTPCLK_CLK] = &mdss_extpclk_clk.clkr,
+       [MDSS_HDMI_AHB_CLK] = &mdss_hdmi_ahb_clk.clkr,
+       [MDSS_HDMI_CLK] = &mdss_hdmi_clk.clkr,
+       [MDSS_MDP_CLK] = &mdss_mdp_clk.clkr,
+       [MDSS_MDP_LUT_CLK] = &mdss_mdp_lut_clk.clkr,
+       [MDSS_PCLK0_CLK] = &mdss_pclk0_clk.clkr,
+       [MDSS_PCLK1_CLK] = &mdss_pclk1_clk.clkr,
+       [MDSS_VSYNC_CLK] = &mdss_vsync_clk.clkr,
+       [MMSS_MISC_AHB_CLK] = &mmss_misc_ahb_clk.clkr,
+       [MMSS_MMSSNOC_AHB_CLK] = &mmss_mmssnoc_ahb_clk.clkr,
+       [MMSS_MMSSNOC_BTO_AHB_CLK] = &mmss_mmssnoc_bto_ahb_clk.clkr,
+       [MMSS_MMSSNOC_AXI_CLK] = &mmss_mmssnoc_axi_clk.clkr,
+       [MMSS_S0_AXI_CLK] = &mmss_s0_axi_clk.clkr,
+       [OCMEMCX_AHB_CLK] = &ocmemcx_ahb_clk.clkr,
+       [OCMEMCX_OCMEMNOC_CLK] = &ocmemcx_ocmemnoc_clk.clkr,
+       [OXILI_OCMEMGX_CLK] = &oxili_ocmemgx_clk.clkr,
+       [OCMEMNOC_CLK] = &ocmemnoc_clk.clkr,
+       [OXILI_GFX3D_CLK] = &oxili_gfx3d_clk.clkr,
+       [OXILICX_AHB_CLK] = &oxilicx_ahb_clk.clkr,
+       [OXILICX_AXI_CLK] = &oxilicx_axi_clk.clkr,
+       [VENUS0_AHB_CLK] = &venus0_ahb_clk.clkr,
+       [VENUS0_AXI_CLK] = &venus0_axi_clk.clkr,
+       [VENUS0_OCMEMNOC_CLK] = &venus0_ocmemnoc_clk.clkr,
+       [VENUS0_VCODEC0_CLK] = &venus0_vcodec0_clk.clkr,
+};
+
+static const struct qcom_reset_map mmcc_msm8974_resets[] = {
+       [SPDM_RESET] = { 0x0200 },
+       [SPDM_RM_RESET] = { 0x0300 },
+       [VENUS0_RESET] = { 0x1020 },
+       [MDSS_RESET] = { 0x2300 },
+       [CAMSS_PHY0_RESET] = { 0x3020 },
+       [CAMSS_PHY1_RESET] = { 0x3050 },
+       [CAMSS_PHY2_RESET] = { 0x3080 },
+       [CAMSS_CSI0_RESET] = { 0x30b0 },
+       [CAMSS_CSI0PHY_RESET] = { 0x30c0 },
+       [CAMSS_CSI0RDI_RESET] = { 0x30d0 },
+       [CAMSS_CSI0PIX_RESET] = { 0x30e0 },
+       [CAMSS_CSI1_RESET] = { 0x3120 },
+       [CAMSS_CSI1PHY_RESET] = { 0x3130 },
+       [CAMSS_CSI1RDI_RESET] = { 0x3140 },
+       [CAMSS_CSI1PIX_RESET] = { 0x3150 },
+       [CAMSS_CSI2_RESET] = { 0x3180 },
+       [CAMSS_CSI2PHY_RESET] = { 0x3190 },
+       [CAMSS_CSI2RDI_RESET] = { 0x31a0 },
+       [CAMSS_CSI2PIX_RESET] = { 0x31b0 },
+       [CAMSS_CSI3_RESET] = { 0x31e0 },
+       [CAMSS_CSI3PHY_RESET] = { 0x31f0 },
+       [CAMSS_CSI3RDI_RESET] = { 0x3200 },
+       [CAMSS_CSI3PIX_RESET] = { 0x3210 },
+       [CAMSS_ISPIF_RESET] = { 0x3220 },
+       [CAMSS_CCI_RESET] = { 0x3340 },
+       [CAMSS_MCLK0_RESET] = { 0x3380 },
+       [CAMSS_MCLK1_RESET] = { 0x33b0 },
+       [CAMSS_MCLK2_RESET] = { 0x33e0 },
+       [CAMSS_MCLK3_RESET] = { 0x3410 },
+       [CAMSS_GP0_RESET] = { 0x3440 },
+       [CAMSS_GP1_RESET] = { 0x3470 },
+       [CAMSS_TOP_RESET] = { 0x3480 },
+       [CAMSS_MICRO_RESET] = { 0x3490 },
+       [CAMSS_JPEG_RESET] = { 0x35a0 },
+       [CAMSS_VFE_RESET] = { 0x36a0 },
+       [CAMSS_CSI_VFE0_RESET] = { 0x3700 },
+       [CAMSS_CSI_VFE1_RESET] = { 0x3710 },
+       [OXILI_RESET] = { 0x4020 },
+       [OXILICX_RESET] = { 0x4030 },
+       [OCMEMCX_RESET] = { 0x4050 },
+       [MMSS_RBCRP_RESET] = { 0x4080 },
+       [MMSSNOCAHB_RESET] = { 0x5020 },
+       [MMSSNOCAXI_RESET] = { 0x5060 },
+       [OCMEMNOC_RESET] = { 0x50b0 },
+};
+
+static const struct regmap_config mmcc_msm8974_regmap_config = {
+       .reg_bits       = 32,
+       .reg_stride     = 4,
+       .val_bits       = 32,
+       .max_register   = 0x5104,
+       .fast_io        = true,
+};
+
+static const struct of_device_id mmcc_msm8974_match_table[] = {
+       { .compatible = "qcom,mmcc-msm8974" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, mmcc_msm8974_match_table);
+
+struct qcom_cc {
+       struct qcom_reset_controller reset;
+       struct clk_onecell_data data;
+       struct clk *clks[];
+};
+
+static int mmcc_msm8974_probe(struct platform_device *pdev)
+{
+       void __iomem *base;
+       struct resource *res;
+       int i, ret;
+       struct device *dev = &pdev->dev;
+       struct clk *clk;
+       struct clk_onecell_data *data;
+       struct clk **clks;
+       struct regmap *regmap;
+       size_t num_clks;
+       struct qcom_reset_controller *reset;
+       struct qcom_cc *cc;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       base = devm_ioremap_resource(dev, res);
+       if (IS_ERR(base))
+               return PTR_ERR(base);
+
+       regmap = devm_regmap_init_mmio(dev, base, &mmcc_msm8974_regmap_config);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       num_clks = ARRAY_SIZE(mmcc_msm8974_clocks);
+       cc = devm_kzalloc(dev, sizeof(*cc) + sizeof(*clks) * num_clks,
+                         GFP_KERNEL);
+       if (!cc)
+               return -ENOMEM;
+
+       clks = cc->clks;
+       data = &cc->data;
+       data->clks = clks;
+       data->clk_num = num_clks;
+
+       clk_pll_configure_sr_hpm_lp(&mmpll1, regmap, &mmpll1_config, true);
+       clk_pll_configure_sr_hpm_lp(&mmpll3, regmap, &mmpll3_config, false);
+
+       for (i = 0; i < num_clks; i++) {
+               if (!mmcc_msm8974_clocks[i])
+                       continue;
+               clk = devm_clk_register_regmap(dev, mmcc_msm8974_clocks[i]);
+               if (IS_ERR(clk))
+                       return PTR_ERR(clk);
+               clks[i] = clk;
+       }
+
+       ret = of_clk_add_provider(dev->of_node, of_clk_src_onecell_get, data);
+       if (ret)
+               return ret;
+
+       reset = &cc->reset;
+       reset->rcdev.of_node = dev->of_node;
+       reset->rcdev.ops = &qcom_reset_ops,
+       reset->rcdev.owner = THIS_MODULE,
+       reset->rcdev.nr_resets = ARRAY_SIZE(mmcc_msm8974_resets),
+       reset->regmap = regmap;
+       reset->reset_map = mmcc_msm8974_resets,
+       platform_set_drvdata(pdev, &reset->rcdev);
+
+       ret = reset_controller_register(&reset->rcdev);
+       if (ret)
+               of_clk_del_provider(dev->of_node);
+
+       return ret;
+}
+
+static int mmcc_msm8974_remove(struct platform_device *pdev)
+{
+       of_clk_del_provider(pdev->dev.of_node);
+       reset_controller_unregister(platform_get_drvdata(pdev));
+       return 0;
+}
+
+static struct platform_driver mmcc_msm8974_driver = {
+       .probe          = mmcc_msm8974_probe,
+       .remove         = mmcc_msm8974_remove,
+       .driver         = {
+               .name   = "mmcc-msm8974",
+               .owner  = THIS_MODULE,
+               .of_match_table = mmcc_msm8974_match_table,
+       },
+};
+module_platform_driver(mmcc_msm8974_driver);
+
+MODULE_DESCRIPTION("QCOM MMCC MSM8974 Driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:mmcc-msm8974");
diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c
new file mode 100644 (file)
index 0000000..6c977d3
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/bitops.h>
+#include <linux/export.h>
+#include <linux/regmap.h>
+#include <linux/reset-controller.h>
+#include <linux/delay.h>
+
+#include "reset.h"
+
+static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)
+{
+       rcdev->ops->assert(rcdev, id);
+       udelay(1);
+       rcdev->ops->deassert(rcdev, id);
+       return 0;
+}
+
+static int
+qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
+{
+       struct qcom_reset_controller *rst;
+       const struct qcom_reset_map *map;
+       u32 mask;
+
+       rst = to_qcom_reset_controller(rcdev);
+       map = &rst->reset_map[id];
+       mask = BIT(map->bit);
+
+       return regmap_update_bits(rst->regmap, map->reg, mask, mask);
+}
+
+static int
+qcom_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
+{
+       struct qcom_reset_controller *rst;
+       const struct qcom_reset_map *map;
+       u32 mask;
+
+       rst = to_qcom_reset_controller(rcdev);
+       map = &rst->reset_map[id];
+       mask = BIT(map->bit);
+
+       return regmap_update_bits(rst->regmap, map->reg, mask, 0);
+}
+
+struct reset_control_ops qcom_reset_ops = {
+       .reset = qcom_reset,
+       .assert = qcom_reset_assert,
+       .deassert = qcom_reset_deassert,
+};
+EXPORT_SYMBOL_GPL(qcom_reset_ops);
diff --git a/drivers/clk/qcom/reset.h b/drivers/clk/qcom/reset.h
new file mode 100644 (file)
index 0000000..0e11e21
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __QCOM_CLK_RESET_H__
+#define __QCOM_CLK_RESET_H__
+
+#include <linux/reset-controller.h>
+
+struct qcom_reset_map {
+       unsigned int reg;
+       u8 bit;
+};
+
+struct regmap;
+
+struct qcom_reset_controller {
+       const struct qcom_reset_map *reset_map;
+       struct regmap *regmap;
+       struct reset_controller_dev rcdev;
+};
+
+#define to_qcom_reset_controller(r) \
+       container_of(r, struct qcom_reset_controller, rcdev);
+
+extern struct reset_control_ops qcom_reset_ops;
+
+#endif
index 68e515d093d864ca9cc704d6f90a441695e67a6d..884187fbfe00666ce109a5537e6c1b430f6359ae 100644 (file)
 #include <linux/clk-provider.h>
 #include <linux/of_address.h>
 #include <linux/syscore_ops.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
 
 #include <dt-bindings/clk/exynos-audss-clk.h>
 
+enum exynos_audss_clk_type {
+       TYPE_EXYNOS4210,
+       TYPE_EXYNOS5250,
+       TYPE_EXYNOS5420,
+};
+
 static DEFINE_SPINLOCK(lock);
 static struct clk **clk_table;
 static void __iomem *reg_base;
@@ -26,10 +34,6 @@ static struct clk_onecell_data clk_data;
 #define ASS_CLK_DIV 0x4
 #define ASS_CLK_GATE 0x8
 
-/* list of all parent clock list */
-static const char *mout_audss_p[] = { "fin_pll", "fout_epll" };
-static const char *mout_i2s_p[] = { "mout_audss", "cdclk0", "sclk_audio0" };
-
 #ifdef CONFIG_PM_SLEEP
 static unsigned long reg_save[][2] = {
        {ASS_CLK_SRC,  0},
@@ -61,31 +65,69 @@ static struct syscore_ops exynos_audss_clk_syscore_ops = {
 };
 #endif /* CONFIG_PM_SLEEP */
 
+static const struct of_device_id exynos_audss_clk_of_match[] = {
+       { .compatible = "samsung,exynos4210-audss-clock",
+         .data = (void *)TYPE_EXYNOS4210, },
+       { .compatible = "samsung,exynos5250-audss-clock",
+         .data = (void *)TYPE_EXYNOS5250, },
+       { .compatible = "samsung,exynos5420-audss-clock",
+         .data = (void *)TYPE_EXYNOS5420, },
+       {},
+};
+
 /* register exynos_audss clocks */
-static void __init exynos_audss_clk_init(struct device_node *np)
+static int exynos_audss_clk_probe(struct platform_device *pdev)
 {
-       reg_base = of_iomap(np, 0);
-       if (!reg_base) {
-               pr_err("%s: failed to map audss registers\n", __func__);
-               return;
+       int i, ret = 0;
+       struct resource *res;
+       const char *mout_audss_p[] = {"fin_pll", "fout_epll"};
+       const char *mout_i2s_p[] = {"mout_audss", "cdclk0", "sclk_audio0"};
+       const char *sclk_pcm_p = "sclk_pcm0";
+       struct clk *pll_ref, *pll_in, *cdclk, *sclk_audio, *sclk_pcm_in;
+       const struct of_device_id *match;
+       enum exynos_audss_clk_type variant;
+
+       match = of_match_node(exynos_audss_clk_of_match, pdev->dev.of_node);
+       if (!match)
+               return -EINVAL;
+       variant = (enum exynos_audss_clk_type)match->data;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       reg_base = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(reg_base)) {
+               dev_err(&pdev->dev, "failed to map audss registers\n");
+               return PTR_ERR(reg_base);
        }
 
-       clk_table = kzalloc(sizeof(struct clk *) * EXYNOS_AUDSS_MAX_CLKS,
+       clk_table = devm_kzalloc(&pdev->dev,
+                               sizeof(struct clk *) * EXYNOS_AUDSS_MAX_CLKS,
                                GFP_KERNEL);
-       if (!clk_table) {
-               pr_err("%s: could not allocate clk lookup table\n", __func__);
-               return;
-       }
+       if (!clk_table)
+               return -ENOMEM;
 
        clk_data.clks = clk_table;
-       clk_data.clk_num = EXYNOS_AUDSS_MAX_CLKS;
-       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
-
+       if (variant == TYPE_EXYNOS5420)
+               clk_data.clk_num = EXYNOS_AUDSS_MAX_CLKS;
+       else
+               clk_data.clk_num = EXYNOS_AUDSS_MAX_CLKS - 1;
+
+       pll_ref = devm_clk_get(&pdev->dev, "pll_ref");
+       pll_in = devm_clk_get(&pdev->dev, "pll_in");
+       if (!IS_ERR(pll_ref))
+               mout_audss_p[0] = __clk_get_name(pll_ref);
+       if (!IS_ERR(pll_in))
+               mout_audss_p[1] = __clk_get_name(pll_in);
        clk_table[EXYNOS_MOUT_AUDSS] = clk_register_mux(NULL, "mout_audss",
                                mout_audss_p, ARRAY_SIZE(mout_audss_p),
                                CLK_SET_RATE_NO_REPARENT,
                                reg_base + ASS_CLK_SRC, 0, 1, 0, &lock);
 
+       cdclk = devm_clk_get(&pdev->dev, "cdclk");
+       sclk_audio = devm_clk_get(&pdev->dev, "sclk_audio");
+       if (!IS_ERR(cdclk))
+               mout_i2s_p[1] = __clk_get_name(cdclk);
+       if (!IS_ERR(sclk_audio))
+               mout_i2s_p[2] = __clk_get_name(sclk_audio);
        clk_table[EXYNOS_MOUT_I2S] = clk_register_mux(NULL, "mout_i2s",
                                mout_i2s_p, ARRAY_SIZE(mout_i2s_p),
                                CLK_SET_RATE_NO_REPARENT,
@@ -119,17 +161,88 @@ static void __init exynos_audss_clk_init(struct device_node *np)
                                 "sclk_pcm", CLK_SET_RATE_PARENT,
                                reg_base + ASS_CLK_GATE, 4, 0, &lock);
 
+       sclk_pcm_in = devm_clk_get(&pdev->dev, "sclk_pcm_in");
+       if (!IS_ERR(sclk_pcm_in))
+               sclk_pcm_p = __clk_get_name(sclk_pcm_in);
        clk_table[EXYNOS_SCLK_PCM] = clk_register_gate(NULL, "sclk_pcm",
-                               "div_pcm0", CLK_SET_RATE_PARENT,
+                               sclk_pcm_p, CLK_SET_RATE_PARENT,
                                reg_base + ASS_CLK_GATE, 5, 0, &lock);
 
+       if (variant == TYPE_EXYNOS5420) {
+               clk_table[EXYNOS_ADMA] = clk_register_gate(NULL, "adma",
+                               "dout_srp", CLK_SET_RATE_PARENT,
+                               reg_base + ASS_CLK_GATE, 9, 0, &lock);
+       }
+
+       for (i = 0; i < clk_data.clk_num; i++) {
+               if (IS_ERR(clk_table[i])) {
+                       dev_err(&pdev->dev, "failed to register clock %d\n", i);
+                       ret = PTR_ERR(clk_table[i]);
+                       goto unregister;
+               }
+       }
+
+       ret = of_clk_add_provider(pdev->dev.of_node, of_clk_src_onecell_get,
+                                       &clk_data);
+       if (ret) {
+               dev_err(&pdev->dev, "failed to add clock provider\n");
+               goto unregister;
+       }
+
 #ifdef CONFIG_PM_SLEEP
        register_syscore_ops(&exynos_audss_clk_syscore_ops);
 #endif
 
-       pr_info("Exynos: Audss: clock setup completed\n");
+       dev_info(&pdev->dev, "setup completed\n");
+
+       return 0;
+
+unregister:
+       for (i = 0; i < clk_data.clk_num; i++) {
+               if (!IS_ERR(clk_table[i]))
+                       clk_unregister(clk_table[i]);
+       }
+
+       return ret;
 }
-CLK_OF_DECLARE(exynos4210_audss_clk, "samsung,exynos4210-audss-clock",
-               exynos_audss_clk_init);
-CLK_OF_DECLARE(exynos5250_audss_clk, "samsung,exynos5250-audss-clock",
-               exynos_audss_clk_init);
+
+static int exynos_audss_clk_remove(struct platform_device *pdev)
+{
+       int i;
+
+       of_clk_del_provider(pdev->dev.of_node);
+
+       for (i = 0; i < clk_data.clk_num; i++) {
+               if (!IS_ERR(clk_table[i]))
+                       clk_unregister(clk_table[i]);
+       }
+
+       return 0;
+}
+
+static struct platform_driver exynos_audss_clk_driver = {
+       .driver = {
+               .name = "exynos-audss-clk",
+               .owner = THIS_MODULE,
+               .of_match_table = exynos_audss_clk_of_match,
+       },
+       .probe = exynos_audss_clk_probe,
+       .remove = exynos_audss_clk_remove,
+};
+
+static int __init exynos_audss_clk_init(void)
+{
+       return platform_driver_register(&exynos_audss_clk_driver);
+}
+core_initcall(exynos_audss_clk_init);
+
+static void __exit exynos_audss_clk_exit(void)
+{
+       platform_driver_unregister(&exynos_audss_clk_driver);
+}
+module_exit(exynos_audss_clk_exit);
+
+MODULE_AUTHOR("Padmavathi Venna <padma.v@samsung.com>");
+MODULE_DESCRIPTION("Exynos Audio Subsystem Clock Controller");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:exynos-audss-clk");
index 1a7c1b929c690b03b2b24a1423da55a97b66aa00..010f071af88321b288c0d9d0d5f17e5ed352fc01 100644 (file)
@@ -10,6 +10,7 @@
  * Common Clock Framework support for all Exynos4 SoCs.
 */
 
+#include <dt-bindings/clock/exynos4.h>
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/clk-provider.h>
@@ -129,68 +130,6 @@ enum exynos4_plls {
        nr_plls                 /* number of PLLs */
 };
 
-/*
- * Let each supported clock get a unique id. This id is used to lookup the clock
- * for device tree based platforms. The clocks are categorized into three
- * sections: core, sclk gate and bus interface gate clocks.
- *
- * When adding a new clock to this list, it is advised to choose a clock
- * category and add it to the end of that category. That is because the the
- * device tree source file is referring to these ids and any change in the
- * sequence number of existing clocks will require corresponding change in the
- * device tree files. This limitation would go away when pre-processor support
- * for dtc would be available.
- */
-enum exynos4_clks {
-       none,
-
-       /* core clocks */
-       xxti, xusbxti, fin_pll, fout_apll, fout_mpll, fout_epll, fout_vpll,
-       sclk_apll, sclk_mpll, sclk_epll, sclk_vpll, arm_clk, aclk200, aclk100,
-       aclk160, aclk133, mout_mpll_user_t, mout_mpll_user_c, mout_core,
-       mout_apll, /* 20 */
-
-       /* gate for special clocks (sclk) */
-       sclk_fimc0 = 128, sclk_fimc1, sclk_fimc2, sclk_fimc3, sclk_cam0,
-       sclk_cam1, sclk_csis0, sclk_csis1, sclk_hdmi, sclk_mixer, sclk_dac,
-       sclk_pixel, sclk_fimd0, sclk_mdnie0, sclk_mdnie_pwm0, sclk_mipi0,
-       sclk_audio0, sclk_mmc0, sclk_mmc1, sclk_mmc2, sclk_mmc3, sclk_mmc4,
-       sclk_sata, sclk_uart0, sclk_uart1, sclk_uart2, sclk_uart3, sclk_uart4,
-       sclk_audio1, sclk_audio2, sclk_spdif, sclk_spi0, sclk_spi1, sclk_spi2,
-       sclk_slimbus, sclk_fimd1, sclk_mipi1, sclk_pcm1, sclk_pcm2, sclk_i2s1,
-       sclk_i2s2, sclk_mipihsi, sclk_mfc, sclk_pcm0, sclk_g3d, sclk_pwm_isp,
-       sclk_spi0_isp, sclk_spi1_isp, sclk_uart_isp, sclk_fimg2d,
-
-       /* gate clocks */
-       fimc0 = 256, fimc1, fimc2, fimc3, csis0, csis1, jpeg, smmu_fimc0,
-       smmu_fimc1, smmu_fimc2, smmu_fimc3, smmu_jpeg, vp, mixer, tvenc, hdmi,
-       smmu_tv, mfc, smmu_mfcl, smmu_mfcr, g3d, g2d, rotator, mdma, smmu_g2d,
-       smmu_rotator, smmu_mdma, fimd0, mie0, mdnie0, dsim0, smmu_fimd0, fimd1,
-       mie1, dsim1, smmu_fimd1, pdma0, pdma1, pcie_phy, sata_phy, tsi, sdmmc0,
-       sdmmc1, sdmmc2, sdmmc3, sdmmc4, sata, sromc, usb_host, usb_device, pcie,
-       onenand, nfcon, smmu_pcie, gps, smmu_gps, uart0, uart1, uart2, uart3,
-       uart4, i2c0, i2c1, i2c2, i2c3, i2c4, i2c5, i2c6, i2c7, i2c_hdmi, tsadc,
-       spi0, spi1, spi2, i2s1, i2s2, pcm0, i2s0, pcm1, pcm2, pwm, slimbus,
-       spdif, ac97, modemif, chipid, sysreg, hdmi_cec, mct, wdt, rtc, keyif,
-       audss, mipi_hsi, mdma2, pixelasyncm0, pixelasyncm1, fimc_lite0,
-       fimc_lite1, ppmuispx, ppmuispmx, fimc_isp, fimc_drc, fimc_fd, mcuisp,
-       gicisp, smmu_isp, smmu_drc, smmu_fd, smmu_lite0, smmu_lite1, mcuctl_isp,
-       mpwm_isp, i2c0_isp, i2c1_isp, mtcadc_isp, pwm_isp, wdt_isp, uart_isp,
-       asyncaxim, smmu_ispcx, spi0_isp, spi1_isp, pwm_isp_sclk, spi0_isp_sclk,
-       spi1_isp_sclk, uart_isp_sclk, tmu_apbif,
-
-       /* mux clocks */
-       mout_fimc0 = 384, mout_fimc1, mout_fimc2, mout_fimc3, mout_cam0,
-       mout_cam1, mout_csis0, mout_csis1, mout_g3d0, mout_g3d1, mout_g3d,
-       aclk400_mcuisp,
-
-       /* div clocks */
-       div_isp0 = 450, div_isp1, div_mcuisp0, div_mcuisp1, div_aclk200,
-       div_aclk400_mcuisp,
-
-       nr_clks,
-};
-
 /*
  * list of controller registers to be saved and restored during a
  * suspend/resume cycle.
@@ -347,255 +286,256 @@ PNAME(mout_user_aclk266_gps_p4x12) = {"fin_pll", "div_aclk266_gps", };
 
 /* fixed rate clocks generated outside the soc */
 static struct samsung_fixed_rate_clock exynos4_fixed_rate_ext_clks[] __initdata = {
-       FRATE(xxti, "xxti", NULL, CLK_IS_ROOT, 0),
-       FRATE(xusbxti, "xusbxti", NULL, CLK_IS_ROOT, 0),
+       FRATE(CLK_XXTI, "xxti", NULL, CLK_IS_ROOT, 0),
+       FRATE(CLK_XUSBXTI, "xusbxti", NULL, CLK_IS_ROOT, 0),
 };
 
 /* fixed rate clocks generated inside the soc */
 static struct samsung_fixed_rate_clock exynos4_fixed_rate_clks[] __initdata = {
-       FRATE(none, "sclk_hdmi24m", NULL, CLK_IS_ROOT, 24000000),
-       FRATE(none, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 27000000),
-       FRATE(none, "sclk_usbphy0", NULL, CLK_IS_ROOT, 48000000),
+       FRATE(0, "sclk_hdmi24m", NULL, CLK_IS_ROOT, 24000000),
+       FRATE(0, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 27000000),
+       FRATE(0, "sclk_usbphy0", NULL, CLK_IS_ROOT, 48000000),
 };
 
 static struct samsung_fixed_rate_clock exynos4210_fixed_rate_clks[] __initdata = {
-       FRATE(none, "sclk_usbphy1", NULL, CLK_IS_ROOT, 48000000),
+       FRATE(0, "sclk_usbphy1", NULL, CLK_IS_ROOT, 48000000),
 };
 
 /* list of mux clocks supported in all exynos4 soc's */
 static struct samsung_mux_clock exynos4_mux_clks[] __initdata = {
-       MUX_FA(mout_apll, "mout_apll", mout_apll_p, SRC_CPU, 0, 1,
+       MUX_FA(CLK_MOUT_APLL, "mout_apll", mout_apll_p, SRC_CPU, 0, 1,
                        CLK_SET_RATE_PARENT, 0, "mout_apll"),
-       MUX(none, "mout_hdmi", mout_hdmi_p, SRC_TV, 0, 1),
-       MUX(none, "mout_mfc1", sclk_evpll_p, SRC_MFC, 4, 1),
-       MUX(none, "mout_mfc", mout_mfc_p, SRC_MFC, 8, 1),
-       MUX_F(mout_g3d1, "mout_g3d1", sclk_evpll_p, SRC_G3D, 4, 1,
+       MUX(0, "mout_hdmi", mout_hdmi_p, SRC_TV, 0, 1),
+       MUX(0, "mout_mfc1", sclk_evpll_p, SRC_MFC, 4, 1),
+       MUX(0, "mout_mfc", mout_mfc_p, SRC_MFC, 8, 1),
+       MUX_F(CLK_MOUT_G3D1, "mout_g3d1", sclk_evpll_p, SRC_G3D, 4, 1,
                        CLK_SET_RATE_PARENT, 0),
-       MUX_F(mout_g3d, "mout_g3d", mout_g3d_p, SRC_G3D, 8, 1,
+       MUX_F(CLK_MOUT_G3D, "mout_g3d", mout_g3d_p, SRC_G3D, 8, 1,
                        CLK_SET_RATE_PARENT, 0),
-       MUX(none, "mout_spdif", mout_spdif_p, SRC_PERIL1, 8, 2),
-       MUX(none, "mout_onenand1", mout_onenand1_p, SRC_TOP0, 0, 1),
-       MUX(sclk_epll, "sclk_epll", mout_epll_p, SRC_TOP0, 4, 1),
-       MUX(none, "mout_onenand", mout_onenand_p, SRC_TOP0, 28, 1),
+       MUX(0, "mout_spdif", mout_spdif_p, SRC_PERIL1, 8, 2),
+       MUX(0, "mout_onenand1", mout_onenand1_p, SRC_TOP0, 0, 1),
+       MUX(CLK_SCLK_EPLL, "sclk_epll", mout_epll_p, SRC_TOP0, 4, 1),
+       MUX(0, "mout_onenand", mout_onenand_p, SRC_TOP0, 28, 1),
 };
 
 /* list of mux clocks supported in exynos4210 soc */
 static struct samsung_mux_clock exynos4210_mux_early[] __initdata = {
-       MUX(none, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP1, 0, 1),
+       MUX(0, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP1, 0, 1),
 };
 
 static struct samsung_mux_clock exynos4210_mux_clks[] __initdata = {
-       MUX(none, "mout_aclk200", sclk_ampll_p4210, SRC_TOP0, 12, 1),
-       MUX(none, "mout_aclk100", sclk_ampll_p4210, SRC_TOP0, 16, 1),
-       MUX(none, "mout_aclk160", sclk_ampll_p4210, SRC_TOP0, 20, 1),
-       MUX(none, "mout_aclk133", sclk_ampll_p4210, SRC_TOP0, 24, 1),
-       MUX(none, "mout_mixer", mout_mixer_p4210, SRC_TV, 4, 1),
-       MUX(none, "mout_dac", mout_dac_p4210, SRC_TV, 8, 1),
-       MUX(none, "mout_g2d0", sclk_ampll_p4210, E4210_SRC_IMAGE, 0, 1),
-       MUX(none, "mout_g2d1", sclk_evpll_p, E4210_SRC_IMAGE, 4, 1),
-       MUX(none, "mout_g2d", mout_g2d_p, E4210_SRC_IMAGE, 8, 1),
-       MUX(none, "mout_fimd1", group1_p4210, E4210_SRC_LCD1, 0, 4),
-       MUX(none, "mout_mipi1", group1_p4210, E4210_SRC_LCD1, 12, 4),
-       MUX(sclk_mpll, "sclk_mpll", mout_mpll_p, SRC_CPU, 8, 1),
-       MUX(mout_core, "mout_core", mout_core_p4210, SRC_CPU, 16, 1),
-       MUX(sclk_vpll, "sclk_vpll", sclk_vpll_p4210, SRC_TOP0, 8, 1),
-       MUX(mout_fimc0, "mout_fimc0", group1_p4210, SRC_CAM, 0, 4),
-       MUX(mout_fimc1, "mout_fimc1", group1_p4210, SRC_CAM, 4, 4),
-       MUX(mout_fimc2, "mout_fimc2", group1_p4210, SRC_CAM, 8, 4),
-       MUX(mout_fimc3, "mout_fimc3", group1_p4210, SRC_CAM, 12, 4),
-       MUX(mout_cam0, "mout_cam0", group1_p4210, SRC_CAM, 16, 4),
-       MUX(mout_cam1, "mout_cam1", group1_p4210, SRC_CAM, 20, 4),
-       MUX(mout_csis0, "mout_csis0", group1_p4210, SRC_CAM, 24, 4),
-       MUX(mout_csis1, "mout_csis1", group1_p4210, SRC_CAM, 28, 4),
-       MUX(none, "mout_mfc0", sclk_ampll_p4210, SRC_MFC, 0, 1),
-       MUX_F(mout_g3d0, "mout_g3d0", sclk_ampll_p4210, SRC_G3D, 0, 1,
+       MUX(0, "mout_aclk200", sclk_ampll_p4210, SRC_TOP0, 12, 1),
+       MUX(0, "mout_aclk100", sclk_ampll_p4210, SRC_TOP0, 16, 1),
+       MUX(0, "mout_aclk160", sclk_ampll_p4210, SRC_TOP0, 20, 1),
+       MUX(0, "mout_aclk133", sclk_ampll_p4210, SRC_TOP0, 24, 1),
+       MUX(0, "mout_mixer", mout_mixer_p4210, SRC_TV, 4, 1),
+       MUX(0, "mout_dac", mout_dac_p4210, SRC_TV, 8, 1),
+       MUX(0, "mout_g2d0", sclk_ampll_p4210, E4210_SRC_IMAGE, 0, 1),
+       MUX(0, "mout_g2d1", sclk_evpll_p, E4210_SRC_IMAGE, 4, 1),
+       MUX(0, "mout_g2d", mout_g2d_p, E4210_SRC_IMAGE, 8, 1),
+       MUX(0, "mout_fimd1", group1_p4210, E4210_SRC_LCD1, 0, 4),
+       MUX(0, "mout_mipi1", group1_p4210, E4210_SRC_LCD1, 12, 4),
+       MUX(CLK_SCLK_MPLL, "sclk_mpll", mout_mpll_p, SRC_CPU, 8, 1),
+       MUX(CLK_MOUT_CORE, "mout_core", mout_core_p4210, SRC_CPU, 16, 1),
+       MUX(CLK_SCLK_VPLL, "sclk_vpll", sclk_vpll_p4210, SRC_TOP0, 8, 1),
+       MUX(CLK_MOUT_FIMC0, "mout_fimc0", group1_p4210, SRC_CAM, 0, 4),
+       MUX(CLK_MOUT_FIMC1, "mout_fimc1", group1_p4210, SRC_CAM, 4, 4),
+       MUX(CLK_MOUT_FIMC2, "mout_fimc2", group1_p4210, SRC_CAM, 8, 4),
+       MUX(CLK_MOUT_FIMC3, "mout_fimc3", group1_p4210, SRC_CAM, 12, 4),
+       MUX(CLK_MOUT_CAM0, "mout_cam0", group1_p4210, SRC_CAM, 16, 4),
+       MUX(CLK_MOUT_CAM1, "mout_cam1", group1_p4210, SRC_CAM, 20, 4),
+       MUX(CLK_MOUT_CSIS0, "mout_csis0", group1_p4210, SRC_CAM, 24, 4),
+       MUX(CLK_MOUT_CSIS1, "mout_csis1", group1_p4210, SRC_CAM, 28, 4),
+       MUX(0, "mout_mfc0", sclk_ampll_p4210, SRC_MFC, 0, 1),
+       MUX_F(CLK_MOUT_G3D0, "mout_g3d0", sclk_ampll_p4210, SRC_G3D, 0, 1,
                        CLK_SET_RATE_PARENT, 0),
-       MUX(none, "mout_fimd0", group1_p4210, SRC_LCD0, 0, 4),
-       MUX(none, "mout_mipi0", group1_p4210, SRC_LCD0, 12, 4),
-       MUX(none, "mout_audio0", mout_audio0_p4210, SRC_MAUDIO, 0, 4),
-       MUX(none, "mout_mmc0", group1_p4210, SRC_FSYS, 0, 4),
-       MUX(none, "mout_mmc1", group1_p4210, SRC_FSYS, 4, 4),
-       MUX(none, "mout_mmc2", group1_p4210, SRC_FSYS, 8, 4),
-       MUX(none, "mout_mmc3", group1_p4210, SRC_FSYS, 12, 4),
-       MUX(none, "mout_mmc4", group1_p4210, SRC_FSYS, 16, 4),
-       MUX(none, "mout_sata", sclk_ampll_p4210, SRC_FSYS, 24, 1),
-       MUX(none, "mout_uart0", group1_p4210, SRC_PERIL0, 0, 4),
-       MUX(none, "mout_uart1", group1_p4210, SRC_PERIL0, 4, 4),
-       MUX(none, "mout_uart2", group1_p4210, SRC_PERIL0, 8, 4),
-       MUX(none, "mout_uart3", group1_p4210, SRC_PERIL0, 12, 4),
-       MUX(none, "mout_uart4", group1_p4210, SRC_PERIL0, 16, 4),
-       MUX(none, "mout_audio1", mout_audio1_p4210, SRC_PERIL1, 0, 4),
-       MUX(none, "mout_audio2", mout_audio2_p4210, SRC_PERIL1, 4, 4),
-       MUX(none, "mout_spi0", group1_p4210, SRC_PERIL1, 16, 4),
-       MUX(none, "mout_spi1", group1_p4210, SRC_PERIL1, 20, 4),
-       MUX(none, "mout_spi2", group1_p4210, SRC_PERIL1, 24, 4),
+       MUX(0, "mout_fimd0", group1_p4210, SRC_LCD0, 0, 4),
+       MUX(0, "mout_mipi0", group1_p4210, SRC_LCD0, 12, 4),
+       MUX(0, "mout_audio0", mout_audio0_p4210, SRC_MAUDIO, 0, 4),
+       MUX(0, "mout_mmc0", group1_p4210, SRC_FSYS, 0, 4),
+       MUX(0, "mout_mmc1", group1_p4210, SRC_FSYS, 4, 4),
+       MUX(0, "mout_mmc2", group1_p4210, SRC_FSYS, 8, 4),
+       MUX(0, "mout_mmc3", group1_p4210, SRC_FSYS, 12, 4),
+       MUX(0, "mout_mmc4", group1_p4210, SRC_FSYS, 16, 4),
+       MUX(0, "mout_sata", sclk_ampll_p4210, SRC_FSYS, 24, 1),
+       MUX(0, "mout_uart0", group1_p4210, SRC_PERIL0, 0, 4),
+       MUX(0, "mout_uart1", group1_p4210, SRC_PERIL0, 4, 4),
+       MUX(0, "mout_uart2", group1_p4210, SRC_PERIL0, 8, 4),
+       MUX(0, "mout_uart3", group1_p4210, SRC_PERIL0, 12, 4),
+       MUX(0, "mout_uart4", group1_p4210, SRC_PERIL0, 16, 4),
+       MUX(0, "mout_audio1", mout_audio1_p4210, SRC_PERIL1, 0, 4),
+       MUX(0, "mout_audio2", mout_audio2_p4210, SRC_PERIL1, 4, 4),
+       MUX(0, "mout_spi0", group1_p4210, SRC_PERIL1, 16, 4),
+       MUX(0, "mout_spi1", group1_p4210, SRC_PERIL1, 20, 4),
+       MUX(0, "mout_spi2", group1_p4210, SRC_PERIL1, 24, 4),
 };
 
 /* list of mux clocks supported in exynos4x12 soc */
 static struct samsung_mux_clock exynos4x12_mux_clks[] __initdata = {
-       MUX(mout_mpll_user_c, "mout_mpll_user_c", mout_mpll_user_p4x12,
+       MUX(CLK_MOUT_MPLL_USER_C, "mout_mpll_user_c", mout_mpll_user_p4x12,
                        SRC_CPU, 24, 1),
-       MUX(none, "mout_aclk266_gps", aclk_p4412, SRC_TOP1, 4, 1),
-       MUX(none, "mout_aclk400_mcuisp", aclk_p4412, SRC_TOP1, 8, 1),
-       MUX(mout_mpll_user_t, "mout_mpll_user_t", mout_mpll_user_p4x12,
+       MUX(0, "mout_aclk266_gps", aclk_p4412, SRC_TOP1, 4, 1),
+       MUX(0, "mout_aclk400_mcuisp", aclk_p4412, SRC_TOP1, 8, 1),
+       MUX(CLK_MOUT_MPLL_USER_T, "mout_mpll_user_t", mout_mpll_user_p4x12,
                        SRC_TOP1, 12, 1),
-       MUX(none, "mout_user_aclk266_gps", mout_user_aclk266_gps_p4x12,
+       MUX(0, "mout_user_aclk266_gps", mout_user_aclk266_gps_p4x12,
                        SRC_TOP1, 16, 1),
-       MUX(aclk200, "aclk200", mout_user_aclk200_p4x12, SRC_TOP1, 20, 1),
-       MUX(aclk400_mcuisp, "aclk400_mcuisp", mout_user_aclk400_mcuisp_p4x12,
-                       SRC_TOP1, 24, 1),
-       MUX(none, "mout_aclk200", aclk_p4412, SRC_TOP0, 12, 1),
-       MUX(none, "mout_aclk100", aclk_p4412, SRC_TOP0, 16, 1),
-       MUX(none, "mout_aclk160", aclk_p4412, SRC_TOP0, 20, 1),
-       MUX(none, "mout_aclk133", aclk_p4412, SRC_TOP0, 24, 1),
-       MUX(none, "mout_mdnie0", group1_p4x12, SRC_LCD0, 4, 4),
-       MUX(none, "mout_mdnie_pwm0", group1_p4x12, SRC_LCD0, 8, 4),
-       MUX(none, "mout_sata", sclk_ampll_p4x12, SRC_FSYS, 24, 1),
-       MUX(none, "mout_jpeg0", sclk_ampll_p4x12, E4X12_SRC_CAM1, 0, 1),
-       MUX(none, "mout_jpeg1", sclk_evpll_p, E4X12_SRC_CAM1, 4, 1),
-       MUX(none, "mout_jpeg", mout_jpeg_p, E4X12_SRC_CAM1, 8, 1),
-       MUX(sclk_mpll, "sclk_mpll", mout_mpll_p, SRC_DMC, 12, 1),
-       MUX(sclk_vpll, "sclk_vpll", mout_vpll_p, SRC_TOP0, 8, 1),
-       MUX(mout_core, "mout_core", mout_core_p4x12, SRC_CPU, 16, 1),
-       MUX(mout_fimc0, "mout_fimc0", group1_p4x12, SRC_CAM, 0, 4),
-       MUX(mout_fimc1, "mout_fimc1", group1_p4x12, SRC_CAM, 4, 4),
-       MUX(mout_fimc2, "mout_fimc2", group1_p4x12, SRC_CAM, 8, 4),
-       MUX(mout_fimc3, "mout_fimc3", group1_p4x12, SRC_CAM, 12, 4),
-       MUX(mout_cam0, "mout_cam0", group1_p4x12, SRC_CAM, 16, 4),
-       MUX(mout_cam1, "mout_cam1", group1_p4x12, SRC_CAM, 20, 4),
-       MUX(mout_csis0, "mout_csis0", group1_p4x12, SRC_CAM, 24, 4),
-       MUX(mout_csis1, "mout_csis1", group1_p4x12, SRC_CAM, 28, 4),
-       MUX(none, "mout_mfc0", sclk_ampll_p4x12, SRC_MFC, 0, 1),
-       MUX_F(mout_g3d0, "mout_g3d0", sclk_ampll_p4x12, SRC_G3D, 0, 1,
+       MUX(CLK_ACLK200, "aclk200", mout_user_aclk200_p4x12, SRC_TOP1, 20, 1),
+       MUX(CLK_ACLK400_MCUISP, "aclk400_mcuisp",
+               mout_user_aclk400_mcuisp_p4x12, SRC_TOP1, 24, 1),
+       MUX(0, "mout_aclk200", aclk_p4412, SRC_TOP0, 12, 1),
+       MUX(0, "mout_aclk100", aclk_p4412, SRC_TOP0, 16, 1),
+       MUX(0, "mout_aclk160", aclk_p4412, SRC_TOP0, 20, 1),
+       MUX(0, "mout_aclk133", aclk_p4412, SRC_TOP0, 24, 1),
+       MUX(0, "mout_mdnie0", group1_p4x12, SRC_LCD0, 4, 4),
+       MUX(0, "mout_mdnie_pwm0", group1_p4x12, SRC_LCD0, 8, 4),
+       MUX(0, "mout_sata", sclk_ampll_p4x12, SRC_FSYS, 24, 1),
+       MUX(0, "mout_jpeg0", sclk_ampll_p4x12, E4X12_SRC_CAM1, 0, 1),
+       MUX(0, "mout_jpeg1", sclk_evpll_p, E4X12_SRC_CAM1, 4, 1),
+       MUX(0, "mout_jpeg", mout_jpeg_p, E4X12_SRC_CAM1, 8, 1),
+       MUX(CLK_SCLK_MPLL, "sclk_mpll", mout_mpll_p, SRC_DMC, 12, 1),
+       MUX(CLK_SCLK_VPLL, "sclk_vpll", mout_vpll_p, SRC_TOP0, 8, 1),
+       MUX(CLK_MOUT_CORE, "mout_core", mout_core_p4x12, SRC_CPU, 16, 1),
+       MUX(CLK_MOUT_FIMC0, "mout_fimc0", group1_p4x12, SRC_CAM, 0, 4),
+       MUX(CLK_MOUT_FIMC1, "mout_fimc1", group1_p4x12, SRC_CAM, 4, 4),
+       MUX(CLK_MOUT_FIMC2, "mout_fimc2", group1_p4x12, SRC_CAM, 8, 4),
+       MUX(CLK_MOUT_FIMC3, "mout_fimc3", group1_p4x12, SRC_CAM, 12, 4),
+       MUX(CLK_MOUT_CAM0, "mout_cam0", group1_p4x12, SRC_CAM, 16, 4),
+       MUX(CLK_MOUT_CAM1, "mout_cam1", group1_p4x12, SRC_CAM, 20, 4),
+       MUX(CLK_MOUT_CSIS0, "mout_csis0", group1_p4x12, SRC_CAM, 24, 4),
+       MUX(CLK_MOUT_CSIS1, "mout_csis1", group1_p4x12, SRC_CAM, 28, 4),
+       MUX(0, "mout_mfc0", sclk_ampll_p4x12, SRC_MFC, 0, 1),
+       MUX_F(CLK_MOUT_G3D0, "mout_g3d0", sclk_ampll_p4x12, SRC_G3D, 0, 1,
                        CLK_SET_RATE_PARENT, 0),
-       MUX(none, "mout_fimd0", group1_p4x12, SRC_LCD0, 0, 4),
-       MUX(none, "mout_mipi0", group1_p4x12, SRC_LCD0, 12, 4),
-       MUX(none, "mout_audio0", mout_audio0_p4x12, SRC_MAUDIO, 0, 4),
-       MUX(none, "mout_mmc0", group1_p4x12, SRC_FSYS, 0, 4),
-       MUX(none, "mout_mmc1", group1_p4x12, SRC_FSYS, 4, 4),
-       MUX(none, "mout_mmc2", group1_p4x12, SRC_FSYS, 8, 4),
-       MUX(none, "mout_mmc3", group1_p4x12, SRC_FSYS, 12, 4),
-       MUX(none, "mout_mmc4", group1_p4x12, SRC_FSYS, 16, 4),
-       MUX(none, "mout_mipihsi", aclk_p4412, SRC_FSYS, 24, 1),
-       MUX(none, "mout_uart0", group1_p4x12, SRC_PERIL0, 0, 4),
-       MUX(none, "mout_uart1", group1_p4x12, SRC_PERIL0, 4, 4),
-       MUX(none, "mout_uart2", group1_p4x12, SRC_PERIL0, 8, 4),
-       MUX(none, "mout_uart3", group1_p4x12, SRC_PERIL0, 12, 4),
-       MUX(none, "mout_uart4", group1_p4x12, SRC_PERIL0, 16, 4),
-       MUX(none, "mout_audio1", mout_audio1_p4x12, SRC_PERIL1, 0, 4),
-       MUX(none, "mout_audio2", mout_audio2_p4x12, SRC_PERIL1, 4, 4),
-       MUX(none, "mout_spi0", group1_p4x12, SRC_PERIL1, 16, 4),
-       MUX(none, "mout_spi1", group1_p4x12, SRC_PERIL1, 20, 4),
-       MUX(none, "mout_spi2", group1_p4x12, SRC_PERIL1, 24, 4),
-       MUX(none, "mout_pwm_isp", group1_p4x12, E4X12_SRC_ISP, 0, 4),
-       MUX(none, "mout_spi0_isp", group1_p4x12, E4X12_SRC_ISP, 4, 4),
-       MUX(none, "mout_spi1_isp", group1_p4x12, E4X12_SRC_ISP, 8, 4),
-       MUX(none, "mout_uart_isp", group1_p4x12, E4X12_SRC_ISP, 12, 4),
-       MUX(none, "mout_g2d0", sclk_ampll_p4210, SRC_DMC, 20, 1),
-       MUX(none, "mout_g2d1", sclk_evpll_p, SRC_DMC, 24, 1),
-       MUX(none, "mout_g2d", mout_g2d_p, SRC_DMC, 28, 1),
+       MUX(0, "mout_fimd0", group1_p4x12, SRC_LCD0, 0, 4),
+       MUX(0, "mout_mipi0", group1_p4x12, SRC_LCD0, 12, 4),
+       MUX(0, "mout_audio0", mout_audio0_p4x12, SRC_MAUDIO, 0, 4),
+       MUX(0, "mout_mmc0", group1_p4x12, SRC_FSYS, 0, 4),
+       MUX(0, "mout_mmc1", group1_p4x12, SRC_FSYS, 4, 4),
+       MUX(0, "mout_mmc2", group1_p4x12, SRC_FSYS, 8, 4),
+       MUX(0, "mout_mmc3", group1_p4x12, SRC_FSYS, 12, 4),
+       MUX(0, "mout_mmc4", group1_p4x12, SRC_FSYS, 16, 4),
+       MUX(0, "mout_mipihsi", aclk_p4412, SRC_FSYS, 24, 1),
+       MUX(0, "mout_uart0", group1_p4x12, SRC_PERIL0, 0, 4),
+       MUX(0, "mout_uart1", group1_p4x12, SRC_PERIL0, 4, 4),
+       MUX(0, "mout_uart2", group1_p4x12, SRC_PERIL0, 8, 4),
+       MUX(0, "mout_uart3", group1_p4x12, SRC_PERIL0, 12, 4),
+       MUX(0, "mout_uart4", group1_p4x12, SRC_PERIL0, 16, 4),
+       MUX(0, "mout_audio1", mout_audio1_p4x12, SRC_PERIL1, 0, 4),
+       MUX(0, "mout_audio2", mout_audio2_p4x12, SRC_PERIL1, 4, 4),
+       MUX(0, "mout_spi0", group1_p4x12, SRC_PERIL1, 16, 4),
+       MUX(0, "mout_spi1", group1_p4x12, SRC_PERIL1, 20, 4),
+       MUX(0, "mout_spi2", group1_p4x12, SRC_PERIL1, 24, 4),
+       MUX(0, "mout_pwm_isp", group1_p4x12, E4X12_SRC_ISP, 0, 4),
+       MUX(0, "mout_spi0_isp", group1_p4x12, E4X12_SRC_ISP, 4, 4),
+       MUX(0, "mout_spi1_isp", group1_p4x12, E4X12_SRC_ISP, 8, 4),
+       MUX(0, "mout_uart_isp", group1_p4x12, E4X12_SRC_ISP, 12, 4),
+       MUX(0, "mout_g2d0", sclk_ampll_p4210, SRC_DMC, 20, 1),
+       MUX(0, "mout_g2d1", sclk_evpll_p, SRC_DMC, 24, 1),
+       MUX(0, "mout_g2d", mout_g2d_p, SRC_DMC, 28, 1),
 };
 
 /* list of divider clocks supported in all exynos4 soc's */
 static struct samsung_div_clock exynos4_div_clks[] __initdata = {
-       DIV(none, "div_core", "mout_core", DIV_CPU0, 0, 3),
-       DIV(none, "div_core2", "div_core", DIV_CPU0, 28, 3),
-       DIV(none, "div_fimc0", "mout_fimc0", DIV_CAM, 0, 4),
-       DIV(none, "div_fimc1", "mout_fimc1", DIV_CAM, 4, 4),
-       DIV(none, "div_fimc2", "mout_fimc2", DIV_CAM, 8, 4),
-       DIV(none, "div_fimc3", "mout_fimc3", DIV_CAM, 12, 4),
-       DIV(none, "div_cam0", "mout_cam0", DIV_CAM, 16, 4),
-       DIV(none, "div_cam1", "mout_cam1", DIV_CAM, 20, 4),
-       DIV(none, "div_csis0", "mout_csis0", DIV_CAM, 24, 4),
-       DIV(none, "div_csis1", "mout_csis1", DIV_CAM, 28, 4),
-       DIV(sclk_mfc, "sclk_mfc", "mout_mfc", DIV_MFC, 0, 4),
-       DIV_F(none, "div_g3d", "mout_g3d", DIV_G3D, 0, 4,
+       DIV(0, "div_core", "mout_core", DIV_CPU0, 0, 3),
+       DIV(0, "div_core2", "div_core", DIV_CPU0, 28, 3),
+       DIV(0, "div_fimc0", "mout_fimc0", DIV_CAM, 0, 4),
+       DIV(0, "div_fimc1", "mout_fimc1", DIV_CAM, 4, 4),
+       DIV(0, "div_fimc2", "mout_fimc2", DIV_CAM, 8, 4),
+       DIV(0, "div_fimc3", "mout_fimc3", DIV_CAM, 12, 4),
+       DIV(0, "div_cam0", "mout_cam0", DIV_CAM, 16, 4),
+       DIV(0, "div_cam1", "mout_cam1", DIV_CAM, 20, 4),
+       DIV(0, "div_csis0", "mout_csis0", DIV_CAM, 24, 4),
+       DIV(0, "div_csis1", "mout_csis1", DIV_CAM, 28, 4),
+       DIV(CLK_SCLK_MFC, "sclk_mfc", "mout_mfc", DIV_MFC, 0, 4),
+       DIV_F(0, "div_g3d", "mout_g3d", DIV_G3D, 0, 4,
+                       CLK_SET_RATE_PARENT, 0),
+       DIV(0, "div_fimd0", "mout_fimd0", DIV_LCD0, 0, 4),
+       DIV(0, "div_mipi0", "mout_mipi0", DIV_LCD0, 16, 4),
+       DIV(0, "div_audio0", "mout_audio0", DIV_MAUDIO, 0, 4),
+       DIV(CLK_SCLK_PCM0, "sclk_pcm0", "sclk_audio0", DIV_MAUDIO, 4, 8),
+       DIV(0, "div_mmc0", "mout_mmc0", DIV_FSYS1, 0, 4),
+       DIV(0, "div_mmc1", "mout_mmc1", DIV_FSYS1, 16, 4),
+       DIV(0, "div_mmc2", "mout_mmc2", DIV_FSYS2, 0, 4),
+       DIV(0, "div_mmc3", "mout_mmc3", DIV_FSYS2, 16, 4),
+       DIV(CLK_SCLK_PIXEL, "sclk_pixel", "sclk_vpll", DIV_TV, 0, 4),
+       DIV(CLK_ACLK100, "aclk100", "mout_aclk100", DIV_TOP, 4, 4),
+       DIV(CLK_ACLK160, "aclk160", "mout_aclk160", DIV_TOP, 8, 3),
+       DIV(CLK_ACLK133, "aclk133", "mout_aclk133", DIV_TOP, 12, 3),
+       DIV(0, "div_onenand", "mout_onenand1", DIV_TOP, 16, 3),
+       DIV(CLK_SCLK_SLIMBUS, "sclk_slimbus", "sclk_epll", DIV_PERIL3, 4, 4),
+       DIV(CLK_SCLK_PCM1, "sclk_pcm1", "sclk_audio1", DIV_PERIL4, 4, 8),
+       DIV(CLK_SCLK_PCM2, "sclk_pcm2", "sclk_audio2", DIV_PERIL4, 20, 8),
+       DIV(CLK_SCLK_I2S1, "sclk_i2s1", "sclk_audio1", DIV_PERIL5, 0, 6),
+       DIV(CLK_SCLK_I2S2, "sclk_i2s2", "sclk_audio2", DIV_PERIL5, 8, 6),
+       DIV(0, "div_mmc4", "mout_mmc4", DIV_FSYS3, 0, 4),
+       DIV_F(0, "div_mmc_pre4", "div_mmc4", DIV_FSYS3, 8, 8,
                        CLK_SET_RATE_PARENT, 0),
-       DIV(none, "div_fimd0", "mout_fimd0", DIV_LCD0, 0, 4),
-       DIV(none, "div_mipi0", "mout_mipi0", DIV_LCD0, 16, 4),
-       DIV(none, "div_audio0", "mout_audio0", DIV_MAUDIO, 0, 4),
-       DIV(sclk_pcm0, "sclk_pcm0", "sclk_audio0", DIV_MAUDIO, 4, 8),
-       DIV(none, "div_mmc0", "mout_mmc0", DIV_FSYS1, 0, 4),
-       DIV(none, "div_mmc1", "mout_mmc1", DIV_FSYS1, 16, 4),
-       DIV(none, "div_mmc2", "mout_mmc2", DIV_FSYS2, 0, 4),
-       DIV(none, "div_mmc3", "mout_mmc3", DIV_FSYS2, 16, 4),
-       DIV(sclk_pixel, "sclk_pixel", "sclk_vpll", DIV_TV, 0, 4),
-       DIV(aclk100, "aclk100", "mout_aclk100", DIV_TOP, 4, 4),
-       DIV(aclk160, "aclk160", "mout_aclk160", DIV_TOP, 8, 3),
-       DIV(aclk133, "aclk133", "mout_aclk133", DIV_TOP, 12, 3),
-       DIV(none, "div_onenand", "mout_onenand1", DIV_TOP, 16, 3),
-       DIV(sclk_slimbus, "sclk_slimbus", "sclk_epll", DIV_PERIL3, 4, 4),
-       DIV(sclk_pcm1, "sclk_pcm1", "sclk_audio1", DIV_PERIL4, 4, 8),
-       DIV(sclk_pcm2, "sclk_pcm2", "sclk_audio2", DIV_PERIL4, 20, 8),
-       DIV(sclk_i2s1, "sclk_i2s1", "sclk_audio1", DIV_PERIL5, 0, 6),
-       DIV(sclk_i2s2, "sclk_i2s2", "sclk_audio2", DIV_PERIL5, 8, 6),
-       DIV(none, "div_mmc4", "mout_mmc4", DIV_FSYS3, 0, 4),
-       DIV(none, "div_mmc_pre4", "div_mmc4", DIV_FSYS3, 8, 8),
-       DIV(none, "div_uart0", "mout_uart0", DIV_PERIL0, 0, 4),
-       DIV(none, "div_uart1", "mout_uart1", DIV_PERIL0, 4, 4),
-       DIV(none, "div_uart2", "mout_uart2", DIV_PERIL0, 8, 4),
-       DIV(none, "div_uart3", "mout_uart3", DIV_PERIL0, 12, 4),
-       DIV(none, "div_uart4", "mout_uart4", DIV_PERIL0, 16, 4),
-       DIV(none, "div_spi0", "mout_spi0", DIV_PERIL1, 0, 4),
-       DIV(none, "div_spi_pre0", "div_spi0", DIV_PERIL1, 8, 8),
-       DIV(none, "div_spi1", "mout_spi1", DIV_PERIL1, 16, 4),
-       DIV(none, "div_spi_pre1", "div_spi1", DIV_PERIL1, 24, 8),
-       DIV(none, "div_spi2", "mout_spi2", DIV_PERIL2, 0, 4),
-       DIV(none, "div_spi_pre2", "div_spi2", DIV_PERIL2, 8, 8),
-       DIV(none, "div_audio1", "mout_audio1", DIV_PERIL4, 0, 4),
-       DIV(none, "div_audio2", "mout_audio2", DIV_PERIL4, 16, 4),
-       DIV(arm_clk, "arm_clk", "div_core2", DIV_CPU0, 28, 3),
-       DIV(sclk_apll, "sclk_apll", "mout_apll", DIV_CPU0, 24, 3),
-       DIV_F(none, "div_mipi_pre0", "div_mipi0", DIV_LCD0, 20, 4,
+       DIV(0, "div_uart0", "mout_uart0", DIV_PERIL0, 0, 4),
+       DIV(0, "div_uart1", "mout_uart1", DIV_PERIL0, 4, 4),
+       DIV(0, "div_uart2", "mout_uart2", DIV_PERIL0, 8, 4),
+       DIV(0, "div_uart3", "mout_uart3", DIV_PERIL0, 12, 4),
+       DIV(0, "div_uart4", "mout_uart4", DIV_PERIL0, 16, 4),
+       DIV(0, "div_spi0", "mout_spi0", DIV_PERIL1, 0, 4),
+       DIV(0, "div_spi_pre0", "div_spi0", DIV_PERIL1, 8, 8),
+       DIV(0, "div_spi1", "mout_spi1", DIV_PERIL1, 16, 4),
+       DIV(0, "div_spi_pre1", "div_spi1", DIV_PERIL1, 24, 8),
+       DIV(0, "div_spi2", "mout_spi2", DIV_PERIL2, 0, 4),
+       DIV(0, "div_spi_pre2", "div_spi2", DIV_PERIL2, 8, 8),
+       DIV(0, "div_audio1", "mout_audio1", DIV_PERIL4, 0, 4),
+       DIV(0, "div_audio2", "mout_audio2", DIV_PERIL4, 16, 4),
+       DIV(CLK_ARM_CLK, "arm_clk", "div_core2", DIV_CPU0, 28, 3),
+       DIV(CLK_SCLK_APLL, "sclk_apll", "mout_apll", DIV_CPU0, 24, 3),
+       DIV_F(0, "div_mipi_pre0", "div_mipi0", DIV_LCD0, 20, 4,
                        CLK_SET_RATE_PARENT, 0),
-       DIV_F(none, "div_mmc_pre0", "div_mmc0", DIV_FSYS1, 8, 8,
+       DIV_F(0, "div_mmc_pre0", "div_mmc0", DIV_FSYS1, 8, 8,
                        CLK_SET_RATE_PARENT, 0),
-       DIV_F(none, "div_mmc_pre1", "div_mmc1", DIV_FSYS1, 24, 8,
+       DIV_F(0, "div_mmc_pre1", "div_mmc1", DIV_FSYS1, 24, 8,
                        CLK_SET_RATE_PARENT, 0),
-       DIV_F(none, "div_mmc_pre2", "div_mmc2", DIV_FSYS2, 8, 8,
+       DIV_F(0, "div_mmc_pre2", "div_mmc2", DIV_FSYS2, 8, 8,
                        CLK_SET_RATE_PARENT, 0),
-       DIV_F(none, "div_mmc_pre3", "div_mmc3", DIV_FSYS2, 24, 8,
+       DIV_F(0, "div_mmc_pre3", "div_mmc3", DIV_FSYS2, 24, 8,
                        CLK_SET_RATE_PARENT, 0),
 };
 
 /* list of divider clocks supported in exynos4210 soc */
 static struct samsung_div_clock exynos4210_div_clks[] __initdata = {
-       DIV(aclk200, "aclk200", "mout_aclk200", DIV_TOP, 0, 3),
-       DIV(sclk_fimg2d, "sclk_fimg2d", "mout_g2d", DIV_IMAGE, 0, 4),
-       DIV(none, "div_fimd1", "mout_fimd1", E4210_DIV_LCD1, 0, 4),
-       DIV(none, "div_mipi1", "mout_mipi1", E4210_DIV_LCD1, 16, 4),
-       DIV(none, "div_sata", "mout_sata", DIV_FSYS0, 20, 4),
-       DIV_F(none, "div_mipi_pre1", "div_mipi1", E4210_DIV_LCD1, 20, 4,
+       DIV(CLK_ACLK200, "aclk200", "mout_aclk200", DIV_TOP, 0, 3),
+       DIV(CLK_SCLK_FIMG2D, "sclk_fimg2d", "mout_g2d", DIV_IMAGE, 0, 4),
+       DIV(0, "div_fimd1", "mout_fimd1", E4210_DIV_LCD1, 0, 4),
+       DIV(0, "div_mipi1", "mout_mipi1", E4210_DIV_LCD1, 16, 4),
+       DIV(0, "div_sata", "mout_sata", DIV_FSYS0, 20, 4),
+       DIV_F(0, "div_mipi_pre1", "div_mipi1", E4210_DIV_LCD1, 20, 4,
                        CLK_SET_RATE_PARENT, 0),
 };
 
 /* list of divider clocks supported in exynos4x12 soc */
 static struct samsung_div_clock exynos4x12_div_clks[] __initdata = {
-       DIV(none, "div_mdnie0", "mout_mdnie0", DIV_LCD0, 4, 4),
-       DIV(none, "div_mdnie_pwm0", "mout_mdnie_pwm0", DIV_LCD0, 8, 4),
-       DIV(none, "div_mdnie_pwm_pre0", "div_mdnie_pwm0", DIV_LCD0, 12, 4),
-       DIV(none, "div_mipihsi", "mout_mipihsi", DIV_FSYS0, 20, 4),
-       DIV(none, "div_jpeg", "mout_jpeg", E4X12_DIV_CAM1, 0, 4),
-       DIV(div_aclk200, "div_aclk200", "mout_aclk200", DIV_TOP, 0, 3),
-       DIV(none, "div_aclk266_gps", "mout_aclk266_gps", DIV_TOP, 20, 3),
-       DIV(div_aclk400_mcuisp, "div_aclk400_mcuisp", "mout_aclk400_mcuisp",
+       DIV(0, "div_mdnie0", "mout_mdnie0", DIV_LCD0, 4, 4),
+       DIV(0, "div_mdnie_pwm0", "mout_mdnie_pwm0", DIV_LCD0, 8, 4),
+       DIV(0, "div_mdnie_pwm_pre0", "div_mdnie_pwm0", DIV_LCD0, 12, 4),
+       DIV(0, "div_mipihsi", "mout_mipihsi", DIV_FSYS0, 20, 4),
+       DIV(0, "div_jpeg", "mout_jpeg", E4X12_DIV_CAM1, 0, 4),
+       DIV(CLK_DIV_ACLK200, "div_aclk200", "mout_aclk200", DIV_TOP, 0, 3),
+       DIV(0, "div_aclk266_gps", "mout_aclk266_gps", DIV_TOP, 20, 3),
+       DIV(CLK_DIV_ACLK400_MCUISP, "div_aclk400_mcuisp", "mout_aclk400_mcuisp",
                                                DIV_TOP, 24, 3),
-       DIV(none, "div_pwm_isp", "mout_pwm_isp", E4X12_DIV_ISP, 0, 4),
-       DIV(none, "div_spi0_isp", "mout_spi0_isp", E4X12_DIV_ISP, 4, 4),
-       DIV(none, "div_spi0_isp_pre", "div_spi0_isp", E4X12_DIV_ISP, 8, 8),
-       DIV(none, "div_spi1_isp", "mout_spi1_isp", E4X12_DIV_ISP, 16, 4),
-       DIV(none, "div_spi1_isp_pre", "div_spi1_isp", E4X12_DIV_ISP, 20, 8),
-       DIV(none, "div_uart_isp", "mout_uart_isp", E4X12_DIV_ISP, 28, 4),
-       DIV_F(div_isp0, "div_isp0", "aclk200", E4X12_DIV_ISP0, 0, 3,
+       DIV(0, "div_pwm_isp", "mout_pwm_isp", E4X12_DIV_ISP, 0, 4),
+       DIV(0, "div_spi0_isp", "mout_spi0_isp", E4X12_DIV_ISP, 4, 4),
+       DIV(0, "div_spi0_isp_pre", "div_spi0_isp", E4X12_DIV_ISP, 8, 8),
+       DIV(0, "div_spi1_isp", "mout_spi1_isp", E4X12_DIV_ISP, 16, 4),
+       DIV(0, "div_spi1_isp_pre", "div_spi1_isp", E4X12_DIV_ISP, 20, 8),
+       DIV(0, "div_uart_isp", "mout_uart_isp", E4X12_DIV_ISP, 28, 4),
+       DIV_F(CLK_DIV_ISP0, "div_isp0", "aclk200", E4X12_DIV_ISP0, 0, 3,
                                                CLK_GET_RATE_NOCACHE, 0),
-       DIV_F(div_isp1, "div_isp1", "aclk200", E4X12_DIV_ISP0, 4, 3,
+       DIV_F(CLK_DIV_ISP1, "div_isp1", "aclk200", E4X12_DIV_ISP0, 4, 3,
                                                CLK_GET_RATE_NOCACHE, 0),
-       DIV(none, "div_mpwm", "div_isp1", E4X12_DIV_ISP1, 0, 3),
-       DIV_F(div_mcuisp0, "div_mcuisp0", "aclk400_mcuisp", E4X12_DIV_ISP1,
+       DIV(0, "div_mpwm", "div_isp1", E4X12_DIV_ISP1, 0, 3),
+       DIV_F(CLK_DIV_MCUISP0, "div_mcuisp0", "aclk400_mcuisp", E4X12_DIV_ISP1,
                                                4, 3, CLK_GET_RATE_NOCACHE, 0),
-       DIV_F(div_mcuisp1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1,
+       DIV_F(CLK_DIV_MCUISP1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1,
                                                8, 3, CLK_GET_RATE_NOCACHE, 0),
-       DIV(sclk_fimg2d, "sclk_fimg2d", "mout_g2d", DIV_DMC1, 0, 4),
+       DIV(CLK_SCLK_FIMG2D, "sclk_fimg2d", "mout_g2d", DIV_DMC1, 0, 4),
 };
 
 /* list of gate clocks supported in all exynos4 soc's */
@@ -605,333 +545,341 @@ static struct samsung_gate_clock exynos4_gate_clks[] __initdata = {
         * the device name and clock alias names specified below for some
         * of the clocks can be removed.
         */
-       GATE(sclk_hdmi, "sclk_hdmi", "mout_hdmi", SRC_MASK_TV, 0, 0, 0),
-       GATE(sclk_spdif, "sclk_spdif", "mout_spdif", SRC_MASK_PERIL1, 8, 0, 0),
-       GATE(jpeg, "jpeg", "aclk160", GATE_IP_CAM, 6, 0, 0),
-       GATE(mie0, "mie0", "aclk160", GATE_IP_LCD0, 1, 0, 0),
-       GATE(dsim0, "dsim0", "aclk160", GATE_IP_LCD0, 3, 0, 0),
-       GATE(fimd1, "fimd1", "aclk160", E4210_GATE_IP_LCD1, 0, 0, 0),
-       GATE(mie1, "mie1", "aclk160", E4210_GATE_IP_LCD1, 1, 0, 0),
-       GATE(dsim1, "dsim1", "aclk160", E4210_GATE_IP_LCD1, 3, 0, 0),
-       GATE(smmu_fimd1, "smmu_fimd1", "aclk160", E4210_GATE_IP_LCD1, 4, 0, 0),
-       GATE(tsi, "tsi", "aclk133", GATE_IP_FSYS, 4, 0, 0),
-       GATE(sromc, "sromc", "aclk133", GATE_IP_FSYS, 11, 0, 0),
-       GATE(sclk_g3d, "sclk_g3d", "div_g3d", GATE_IP_G3D, 0,
+       GATE(CLK_SCLK_HDMI, "sclk_hdmi", "mout_hdmi", SRC_MASK_TV, 0, 0, 0),
+       GATE(CLK_SCLK_SPDIF, "sclk_spdif", "mout_spdif", SRC_MASK_PERIL1, 8, 0,
+               0),
+       GATE(CLK_JPEG, "jpeg", "aclk160", GATE_IP_CAM, 6, 0, 0),
+       GATE(CLK_MIE0, "mie0", "aclk160", GATE_IP_LCD0, 1, 0, 0),
+       GATE(CLK_DSIM0, "dsim0", "aclk160", GATE_IP_LCD0, 3, 0, 0),
+       GATE(CLK_FIMD1, "fimd1", "aclk160", E4210_GATE_IP_LCD1, 0, 0, 0),
+       GATE(CLK_MIE1, "mie1", "aclk160", E4210_GATE_IP_LCD1, 1, 0, 0),
+       GATE(CLK_DSIM1, "dsim1", "aclk160", E4210_GATE_IP_LCD1, 3, 0, 0),
+       GATE(CLK_SMMU_FIMD1, "smmu_fimd1", "aclk160", E4210_GATE_IP_LCD1, 4, 0,
+               0),
+       GATE(CLK_TSI, "tsi", "aclk133", GATE_IP_FSYS, 4, 0, 0),
+       GATE(CLK_SROMC, "sromc", "aclk133", GATE_IP_FSYS, 11, 0, 0),
+       GATE(CLK_SCLK_G3D, "sclk_g3d", "div_g3d", GATE_IP_G3D, 0,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(usb_device, "usb_device", "aclk133", GATE_IP_FSYS, 13, 0, 0),
-       GATE(onenand, "onenand", "aclk133", GATE_IP_FSYS, 15, 0, 0),
-       GATE(nfcon, "nfcon", "aclk133", GATE_IP_FSYS, 16, 0, 0),
-       GATE(gps, "gps", "aclk133", GATE_IP_GPS, 0, 0, 0),
-       GATE(smmu_gps, "smmu_gps", "aclk133", GATE_IP_GPS, 1, 0, 0),
-       GATE(slimbus, "slimbus", "aclk100", GATE_IP_PERIL, 25, 0, 0),
-       GATE(sclk_cam0, "sclk_cam0", "div_cam0", GATE_SCLK_CAM, 4,
+       GATE(CLK_USB_DEVICE, "usb_device", "aclk133", GATE_IP_FSYS, 13, 0, 0),
+       GATE(CLK_ONENAND, "onenand", "aclk133", GATE_IP_FSYS, 15, 0, 0),
+       GATE(CLK_NFCON, "nfcon", "aclk133", GATE_IP_FSYS, 16, 0, 0),
+       GATE(CLK_GPS, "gps", "aclk133", GATE_IP_GPS, 0, 0, 0),
+       GATE(CLK_SMMU_GPS, "smmu_gps", "aclk133", GATE_IP_GPS, 1, 0, 0),
+       GATE(CLK_SLIMBUS, "slimbus", "aclk100", GATE_IP_PERIL, 25, 0, 0),
+       GATE(CLK_SCLK_CAM0, "sclk_cam0", "div_cam0", GATE_SCLK_CAM, 4,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_cam1, "sclk_cam1", "div_cam1", GATE_SCLK_CAM, 5,
+       GATE(CLK_SCLK_CAM1, "sclk_cam1", "div_cam1", GATE_SCLK_CAM, 5,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mipi0, "sclk_mipi0", "div_mipi_pre0",
+       GATE(CLK_SCLK_MIPI0, "sclk_mipi0", "div_mipi_pre0",
                        SRC_MASK_LCD0, 12, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_audio0, "sclk_audio0", "div_audio0", SRC_MASK_MAUDIO, 0,
+       GATE(CLK_SCLK_AUDIO0, "sclk_audio0", "div_audio0", SRC_MASK_MAUDIO, 0,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_audio1, "sclk_audio1", "div_audio1", SRC_MASK_PERIL1, 0,
+       GATE(CLK_SCLK_AUDIO1, "sclk_audio1", "div_audio1", SRC_MASK_PERIL1, 0,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(vp, "vp", "aclk160", GATE_IP_TV, 0, 0, 0),
-       GATE(mixer, "mixer", "aclk160", GATE_IP_TV, 1, 0, 0),
-       GATE(hdmi, "hdmi", "aclk160", GATE_IP_TV, 3, 0, 0),
-       GATE(pwm, "pwm", "aclk100", GATE_IP_PERIL, 24, 0, 0),
-       GATE(sdmmc4, "sdmmc4", "aclk133", GATE_IP_FSYS, 9, 0, 0),
-       GATE(usb_host, "usb_host", "aclk133", GATE_IP_FSYS, 12, 0, 0),
-       GATE(sclk_fimc0, "sclk_fimc0", "div_fimc0", SRC_MASK_CAM, 0,
+       GATE(CLK_VP, "vp", "aclk160", GATE_IP_TV, 0, 0, 0),
+       GATE(CLK_MIXER, "mixer", "aclk160", GATE_IP_TV, 1, 0, 0),
+       GATE(CLK_HDMI, "hdmi", "aclk160", GATE_IP_TV, 3, 0, 0),
+       GATE(CLK_PWM, "pwm", "aclk100", GATE_IP_PERIL, 24, 0, 0),
+       GATE(CLK_SDMMC4, "sdmmc4", "aclk133", GATE_IP_FSYS, 9, 0, 0),
+       GATE(CLK_USB_HOST, "usb_host", "aclk133", GATE_IP_FSYS, 12, 0, 0),
+       GATE(CLK_SCLK_FIMC0, "sclk_fimc0", "div_fimc0", SRC_MASK_CAM, 0,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_fimc1, "sclk_fimc1", "div_fimc1", SRC_MASK_CAM, 4,
+       GATE(CLK_SCLK_FIMC1, "sclk_fimc1", "div_fimc1", SRC_MASK_CAM, 4,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_fimc2, "sclk_fimc2", "div_fimc2", SRC_MASK_CAM, 8,
+       GATE(CLK_SCLK_FIMC2, "sclk_fimc2", "div_fimc2", SRC_MASK_CAM, 8,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_fimc3, "sclk_fimc3", "div_fimc3", SRC_MASK_CAM, 12,
+       GATE(CLK_SCLK_FIMC3, "sclk_fimc3", "div_fimc3", SRC_MASK_CAM, 12,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_csis0, "sclk_csis0", "div_csis0", SRC_MASK_CAM, 24,
+       GATE(CLK_SCLK_CSIS0, "sclk_csis0", "div_csis0", SRC_MASK_CAM, 24,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_csis1, "sclk_csis1", "div_csis1", SRC_MASK_CAM, 28,
+       GATE(CLK_SCLK_CSIS1, "sclk_csis1", "div_csis1", SRC_MASK_CAM, 28,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_fimd0, "sclk_fimd0", "div_fimd0", SRC_MASK_LCD0, 0,
+       GATE(CLK_SCLK_FIMD0, "sclk_fimd0", "div_fimd0", SRC_MASK_LCD0, 0,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mmc0, "sclk_mmc0", "div_mmc_pre0", SRC_MASK_FSYS, 0,
+       GATE(CLK_SCLK_MMC0, "sclk_mmc0", "div_mmc_pre0", SRC_MASK_FSYS, 0,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mmc1, "sclk_mmc1", "div_mmc_pre1", SRC_MASK_FSYS, 4,
+       GATE(CLK_SCLK_MMC1, "sclk_mmc1", "div_mmc_pre1", SRC_MASK_FSYS, 4,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mmc2, "sclk_mmc2", "div_mmc_pre2", SRC_MASK_FSYS, 8,
+       GATE(CLK_SCLK_MMC2, "sclk_mmc2", "div_mmc_pre2", SRC_MASK_FSYS, 8,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mmc3, "sclk_mmc3", "div_mmc_pre3", SRC_MASK_FSYS, 12,
+       GATE(CLK_SCLK_MMC3, "sclk_mmc3", "div_mmc_pre3", SRC_MASK_FSYS, 12,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mmc4, "sclk_mmc4", "div_mmc_pre4", SRC_MASK_FSYS, 16,
+       GATE(CLK_SCLK_MMC4, "sclk_mmc4", "div_mmc_pre4", SRC_MASK_FSYS, 16,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart0, "uclk0", "div_uart0", SRC_MASK_PERIL0, 0,
+       GATE(CLK_SCLK_UART0, "uclk0", "div_uart0", SRC_MASK_PERIL0, 0,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart1, "uclk1", "div_uart1", SRC_MASK_PERIL0, 4,
+       GATE(CLK_SCLK_UART1, "uclk1", "div_uart1", SRC_MASK_PERIL0, 4,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart2, "uclk2", "div_uart2", SRC_MASK_PERIL0, 8,
+       GATE(CLK_SCLK_UART2, "uclk2", "div_uart2", SRC_MASK_PERIL0, 8,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart3, "uclk3", "div_uart3", SRC_MASK_PERIL0, 12,
+       GATE(CLK_SCLK_UART3, "uclk3", "div_uart3", SRC_MASK_PERIL0, 12,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart4, "uclk4", "div_uart4", SRC_MASK_PERIL0, 16,
+       GATE(CLK_SCLK_UART4, "uclk4", "div_uart4", SRC_MASK_PERIL0, 16,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_audio2, "sclk_audio2", "div_audio2", SRC_MASK_PERIL1, 4,
+       GATE(CLK_SCLK_AUDIO2, "sclk_audio2", "div_audio2", SRC_MASK_PERIL1, 4,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spi0, "sclk_spi0", "div_spi_pre0", SRC_MASK_PERIL1, 16,
+       GATE(CLK_SCLK_SPI0, "sclk_spi0", "div_spi_pre0", SRC_MASK_PERIL1, 16,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spi1, "sclk_spi1", "div_spi_pre1", SRC_MASK_PERIL1, 20,
+       GATE(CLK_SCLK_SPI1, "sclk_spi1", "div_spi_pre1", SRC_MASK_PERIL1, 20,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spi2, "sclk_spi2", "div_spi_pre2", SRC_MASK_PERIL1, 24,
+       GATE(CLK_SCLK_SPI2, "sclk_spi2", "div_spi_pre2", SRC_MASK_PERIL1, 24,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(fimc0, "fimc0", "aclk160", GATE_IP_CAM, 0,
+       GATE(CLK_FIMC0, "fimc0", "aclk160", GATE_IP_CAM, 0,
                        0, 0),
-       GATE(fimc1, "fimc1", "aclk160", GATE_IP_CAM, 1,
+       GATE(CLK_FIMC1, "fimc1", "aclk160", GATE_IP_CAM, 1,
                        0, 0),
-       GATE(fimc2, "fimc2", "aclk160", GATE_IP_CAM, 2,
+       GATE(CLK_FIMC2, "fimc2", "aclk160", GATE_IP_CAM, 2,
                        0, 0),
-       GATE(fimc3, "fimc3", "aclk160", GATE_IP_CAM, 3,
+       GATE(CLK_FIMC3, "fimc3", "aclk160", GATE_IP_CAM, 3,
                        0, 0),
-       GATE(csis0, "csis0", "aclk160", GATE_IP_CAM, 4,
+       GATE(CLK_CSIS0, "csis0", "aclk160", GATE_IP_CAM, 4,
                        0, 0),
-       GATE(csis1, "csis1", "aclk160", GATE_IP_CAM, 5,
+       GATE(CLK_CSIS1, "csis1", "aclk160", GATE_IP_CAM, 5,
                        0, 0),
-       GATE(smmu_fimc0, "smmu_fimc0", "aclk160", GATE_IP_CAM, 7,
+       GATE(CLK_SMMU_FIMC0, "smmu_fimc0", "aclk160", GATE_IP_CAM, 7,
                        0, 0),
-       GATE(smmu_fimc1, "smmu_fimc1", "aclk160", GATE_IP_CAM, 8,
+       GATE(CLK_SMMU_FIMC1, "smmu_fimc1", "aclk160", GATE_IP_CAM, 8,
                        0, 0),
-       GATE(smmu_fimc2, "smmu_fimc2", "aclk160", GATE_IP_CAM, 9,
+       GATE(CLK_SMMU_FIMC2, "smmu_fimc2", "aclk160", GATE_IP_CAM, 9,
                        0, 0),
-       GATE(smmu_fimc3, "smmu_fimc3", "aclk160", GATE_IP_CAM, 10,
+       GATE(CLK_SMMU_FIMC3, "smmu_fimc3", "aclk160", GATE_IP_CAM, 10,
                        0, 0),
-       GATE(smmu_jpeg, "smmu_jpeg", "aclk160", GATE_IP_CAM, 11,
+       GATE(CLK_SMMU_JPEG, "smmu_jpeg", "aclk160", GATE_IP_CAM, 11,
                        0, 0),
-       GATE(pixelasyncm0, "pxl_async0", "aclk160", GATE_IP_CAM, 17, 0, 0),
-       GATE(pixelasyncm1, "pxl_async1", "aclk160", GATE_IP_CAM, 18, 0, 0),
-       GATE(smmu_tv, "smmu_tv", "aclk160", GATE_IP_TV, 4,
+       GATE(CLK_PIXELASYNCM0, "pxl_async0", "aclk160", GATE_IP_CAM, 17, 0, 0),
+       GATE(CLK_PIXELASYNCM1, "pxl_async1", "aclk160", GATE_IP_CAM, 18, 0, 0),
+       GATE(CLK_SMMU_TV, "smmu_tv", "aclk160", GATE_IP_TV, 4,
                        0, 0),
-       GATE(mfc, "mfc", "aclk100", GATE_IP_MFC, 0, 0, 0),
-       GATE(smmu_mfcl, "smmu_mfcl", "aclk100", GATE_IP_MFC, 1,
+       GATE(CLK_MFC, "mfc", "aclk100", GATE_IP_MFC, 0, 0, 0),
+       GATE(CLK_SMMU_MFCL, "smmu_mfcl", "aclk100", GATE_IP_MFC, 1,
                        0, 0),
-       GATE(smmu_mfcr, "smmu_mfcr", "aclk100", GATE_IP_MFC, 2,
+       GATE(CLK_SMMU_MFCR, "smmu_mfcr", "aclk100", GATE_IP_MFC, 2,
                        0, 0),
-       GATE(fimd0, "fimd0", "aclk160", GATE_IP_LCD0, 0,
+       GATE(CLK_FIMD0, "fimd0", "aclk160", GATE_IP_LCD0, 0,
                        0, 0),
-       GATE(smmu_fimd0, "smmu_fimd0", "aclk160", GATE_IP_LCD0, 4,
+       GATE(CLK_SMMU_FIMD0, "smmu_fimd0", "aclk160", GATE_IP_LCD0, 4,
                        0, 0),
-       GATE(pdma0, "pdma0", "aclk133", GATE_IP_FSYS, 0,
+       GATE(CLK_PDMA0, "pdma0", "aclk133", GATE_IP_FSYS, 0,
                        0, 0),
-       GATE(pdma1, "pdma1", "aclk133", GATE_IP_FSYS, 1,
+       GATE(CLK_PDMA1, "pdma1", "aclk133", GATE_IP_FSYS, 1,
                        0, 0),
-       GATE(sdmmc0, "sdmmc0", "aclk133", GATE_IP_FSYS, 5,
+       GATE(CLK_SDMMC0, "sdmmc0", "aclk133", GATE_IP_FSYS, 5,
                        0, 0),
-       GATE(sdmmc1, "sdmmc1", "aclk133", GATE_IP_FSYS, 6,
+       GATE(CLK_SDMMC1, "sdmmc1", "aclk133", GATE_IP_FSYS, 6,
                        0, 0),
-       GATE(sdmmc2, "sdmmc2", "aclk133", GATE_IP_FSYS, 7,
+       GATE(CLK_SDMMC2, "sdmmc2", "aclk133", GATE_IP_FSYS, 7,
                        0, 0),
-       GATE(sdmmc3, "sdmmc3", "aclk133", GATE_IP_FSYS, 8,
+       GATE(CLK_SDMMC3, "sdmmc3", "aclk133", GATE_IP_FSYS, 8,
                        0, 0),
-       GATE(uart0, "uart0", "aclk100", GATE_IP_PERIL, 0,
+       GATE(CLK_UART0, "uart0", "aclk100", GATE_IP_PERIL, 0,
                        0, 0),
-       GATE(uart1, "uart1", "aclk100", GATE_IP_PERIL, 1,
+       GATE(CLK_UART1, "uart1", "aclk100", GATE_IP_PERIL, 1,
                        0, 0),
-       GATE(uart2, "uart2", "aclk100", GATE_IP_PERIL, 2,
+       GATE(CLK_UART2, "uart2", "aclk100", GATE_IP_PERIL, 2,
                        0, 0),
-       GATE(uart3, "uart3", "aclk100", GATE_IP_PERIL, 3,
+       GATE(CLK_UART3, "uart3", "aclk100", GATE_IP_PERIL, 3,
                        0, 0),
-       GATE(uart4, "uart4", "aclk100", GATE_IP_PERIL, 4,
+       GATE(CLK_UART4, "uart4", "aclk100", GATE_IP_PERIL, 4,
                        0, 0),
-       GATE(i2c0, "i2c0", "aclk100", GATE_IP_PERIL, 6,
+       GATE(CLK_I2C0, "i2c0", "aclk100", GATE_IP_PERIL, 6,
                        0, 0),
-       GATE(i2c1, "i2c1", "aclk100", GATE_IP_PERIL, 7,
+       GATE(CLK_I2C1, "i2c1", "aclk100", GATE_IP_PERIL, 7,
                        0, 0),
-       GATE(i2c2, "i2c2", "aclk100", GATE_IP_PERIL, 8,
+       GATE(CLK_I2C2, "i2c2", "aclk100", GATE_IP_PERIL, 8,
                        0, 0),
-       GATE(i2c3, "i2c3", "aclk100", GATE_IP_PERIL, 9,
+       GATE(CLK_I2C3, "i2c3", "aclk100", GATE_IP_PERIL, 9,
                        0, 0),
-       GATE(i2c4, "i2c4", "aclk100", GATE_IP_PERIL, 10,
+       GATE(CLK_I2C4, "i2c4", "aclk100", GATE_IP_PERIL, 10,
                        0, 0),
-       GATE(i2c5, "i2c5", "aclk100", GATE_IP_PERIL, 11,
+       GATE(CLK_I2C5, "i2c5", "aclk100", GATE_IP_PERIL, 11,
                        0, 0),
-       GATE(i2c6, "i2c6", "aclk100", GATE_IP_PERIL, 12,
+       GATE(CLK_I2C6, "i2c6", "aclk100", GATE_IP_PERIL, 12,
                        0, 0),
-       GATE(i2c7, "i2c7", "aclk100", GATE_IP_PERIL, 13,
+       GATE(CLK_I2C7, "i2c7", "aclk100", GATE_IP_PERIL, 13,
                        0, 0),
-       GATE(i2c_hdmi, "i2c-hdmi", "aclk100", GATE_IP_PERIL, 14,
+       GATE(CLK_I2C_HDMI, "i2c-hdmi", "aclk100", GATE_IP_PERIL, 14,
                        0, 0),
-       GATE(spi0, "spi0", "aclk100", GATE_IP_PERIL, 16,
+       GATE(CLK_SPI0, "spi0", "aclk100", GATE_IP_PERIL, 16,
                        0, 0),
-       GATE(spi1, "spi1", "aclk100", GATE_IP_PERIL, 17,
+       GATE(CLK_SPI1, "spi1", "aclk100", GATE_IP_PERIL, 17,
                        0, 0),
-       GATE(spi2, "spi2", "aclk100", GATE_IP_PERIL, 18,
+       GATE(CLK_SPI2, "spi2", "aclk100", GATE_IP_PERIL, 18,
                        0, 0),
-       GATE(i2s1, "i2s1", "aclk100", GATE_IP_PERIL, 20,
+       GATE(CLK_I2S1, "i2s1", "aclk100", GATE_IP_PERIL, 20,
                        0, 0),
-       GATE(i2s2, "i2s2", "aclk100", GATE_IP_PERIL, 21,
+       GATE(CLK_I2S2, "i2s2", "aclk100", GATE_IP_PERIL, 21,
                        0, 0),
-       GATE(pcm1, "pcm1", "aclk100", GATE_IP_PERIL, 22,
+       GATE(CLK_PCM1, "pcm1", "aclk100", GATE_IP_PERIL, 22,
                        0, 0),
-       GATE(pcm2, "pcm2", "aclk100", GATE_IP_PERIL, 23,
+       GATE(CLK_PCM2, "pcm2", "aclk100", GATE_IP_PERIL, 23,
                        0, 0),
-       GATE(spdif, "spdif", "aclk100", GATE_IP_PERIL, 26,
+       GATE(CLK_SPDIF, "spdif", "aclk100", GATE_IP_PERIL, 26,
                        0, 0),
-       GATE(ac97, "ac97", "aclk100", GATE_IP_PERIL, 27,
+       GATE(CLK_AC97, "ac97", "aclk100", GATE_IP_PERIL, 27,
                        0, 0),
 };
 
 /* list of gate clocks supported in exynos4210 soc */
 static struct samsung_gate_clock exynos4210_gate_clks[] __initdata = {
-       GATE(tvenc, "tvenc", "aclk160", GATE_IP_TV, 2, 0, 0),
-       GATE(g2d, "g2d", "aclk200", E4210_GATE_IP_IMAGE, 0, 0, 0),
-       GATE(rotator, "rotator", "aclk200", E4210_GATE_IP_IMAGE, 1, 0, 0),
-       GATE(mdma, "mdma", "aclk200", E4210_GATE_IP_IMAGE, 2, 0, 0),
-       GATE(smmu_g2d, "smmu_g2d", "aclk200", E4210_GATE_IP_IMAGE, 3, 0, 0),
-       GATE(smmu_mdma, "smmu_mdma", "aclk200", E4210_GATE_IP_IMAGE, 5, 0, 0),
-       GATE(pcie_phy, "pcie_phy", "aclk133", GATE_IP_FSYS, 2, 0, 0),
-       GATE(sata_phy, "sata_phy", "aclk133", GATE_IP_FSYS, 3, 0, 0),
-       GATE(sata, "sata", "aclk133", GATE_IP_FSYS, 10, 0, 0),
-       GATE(pcie, "pcie", "aclk133", GATE_IP_FSYS, 14, 0, 0),
-       GATE(smmu_pcie, "smmu_pcie", "aclk133", GATE_IP_FSYS, 18, 0, 0),
-       GATE(modemif, "modemif", "aclk100", GATE_IP_PERIL, 28, 0, 0),
-       GATE(chipid, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0),
-       GATE(sysreg, "sysreg", "aclk100", E4210_GATE_IP_PERIR, 0,
+       GATE(CLK_TVENC, "tvenc", "aclk160", GATE_IP_TV, 2, 0, 0),
+       GATE(CLK_G2D, "g2d", "aclk200", E4210_GATE_IP_IMAGE, 0, 0, 0),
+       GATE(CLK_ROTATOR, "rotator", "aclk200", E4210_GATE_IP_IMAGE, 1, 0, 0),
+       GATE(CLK_MDMA, "mdma", "aclk200", E4210_GATE_IP_IMAGE, 2, 0, 0),
+       GATE(CLK_SMMU_G2D, "smmu_g2d", "aclk200", E4210_GATE_IP_IMAGE, 3, 0, 0),
+       GATE(CLK_SMMU_MDMA, "smmu_mdma", "aclk200", E4210_GATE_IP_IMAGE, 5, 0,
+               0),
+       GATE(CLK_PCIE_PHY, "pcie_phy", "aclk133", GATE_IP_FSYS, 2, 0, 0),
+       GATE(CLK_SATA_PHY, "sata_phy", "aclk133", GATE_IP_FSYS, 3, 0, 0),
+       GATE(CLK_SATA, "sata", "aclk133", GATE_IP_FSYS, 10, 0, 0),
+       GATE(CLK_PCIE, "pcie", "aclk133", GATE_IP_FSYS, 14, 0, 0),
+       GATE(CLK_SMMU_PCIE, "smmu_pcie", "aclk133", GATE_IP_FSYS, 18, 0, 0),
+       GATE(CLK_MODEMIF, "modemif", "aclk100", GATE_IP_PERIL, 28, 0, 0),
+       GATE(CLK_CHIPID, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0),
+       GATE(CLK_SYSREG, "sysreg", "aclk100", E4210_GATE_IP_PERIR, 0,
                        CLK_IGNORE_UNUSED, 0),
-       GATE(hdmi_cec, "hdmi_cec", "aclk100", E4210_GATE_IP_PERIR, 11, 0, 0),
-       GATE(smmu_rotator, "smmu_rotator", "aclk200",
+       GATE(CLK_HDMI_CEC, "hdmi_cec", "aclk100", E4210_GATE_IP_PERIR, 11, 0,
+               0),
+       GATE(CLK_SMMU_ROTATOR, "smmu_rotator", "aclk200",
                        E4210_GATE_IP_IMAGE, 4, 0, 0),
-       GATE(sclk_mipi1, "sclk_mipi1", "div_mipi_pre1",
+       GATE(CLK_SCLK_MIPI1, "sclk_mipi1", "div_mipi_pre1",
                        E4210_SRC_MASK_LCD1, 12, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_sata, "sclk_sata", "div_sata",
+       GATE(CLK_SCLK_SATA, "sclk_sata", "div_sata",
                        SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mixer, "sclk_mixer", "mout_mixer", SRC_MASK_TV, 4, 0, 0),
-       GATE(sclk_dac, "sclk_dac", "mout_dac", SRC_MASK_TV, 8, 0, 0),
-       GATE(tsadc, "tsadc", "aclk100", GATE_IP_PERIL, 15,
+       GATE(CLK_SCLK_MIXER, "sclk_mixer", "mout_mixer", SRC_MASK_TV, 4, 0, 0),
+       GATE(CLK_SCLK_DAC, "sclk_dac", "mout_dac", SRC_MASK_TV, 8, 0, 0),
+       GATE(CLK_TSADC, "tsadc", "aclk100", GATE_IP_PERIL, 15,
                        0, 0),
-       GATE(mct, "mct", "aclk100", E4210_GATE_IP_PERIR, 13,
+       GATE(CLK_MCT, "mct", "aclk100", E4210_GATE_IP_PERIR, 13,
                        0, 0),
-       GATE(wdt, "watchdog", "aclk100", E4210_GATE_IP_PERIR, 14,
+       GATE(CLK_WDT, "watchdog", "aclk100", E4210_GATE_IP_PERIR, 14,
                        0, 0),
-       GATE(rtc, "rtc", "aclk100", E4210_GATE_IP_PERIR, 15,
+       GATE(CLK_RTC, "rtc", "aclk100", E4210_GATE_IP_PERIR, 15,
                        0, 0),
-       GATE(keyif, "keyif", "aclk100", E4210_GATE_IP_PERIR, 16,
+       GATE(CLK_KEYIF, "keyif", "aclk100", E4210_GATE_IP_PERIR, 16,
                        0, 0),
-       GATE(sclk_fimd1, "sclk_fimd1", "div_fimd1", E4210_SRC_MASK_LCD1, 0,
+       GATE(CLK_SCLK_FIMD1, "sclk_fimd1", "div_fimd1", E4210_SRC_MASK_LCD1, 0,
                        CLK_SET_RATE_PARENT, 0),
-       GATE(tmu_apbif, "tmu_apbif", "aclk100", E4210_GATE_IP_PERIR, 17, 0, 0),
+       GATE(CLK_TMU_APBIF, "tmu_apbif", "aclk100", E4210_GATE_IP_PERIR, 17, 0,
+               0),
 };
 
 /* list of gate clocks supported in exynos4x12 soc */
 static struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = {
-       GATE(audss, "audss", "sclk_epll", E4X12_GATE_IP_MAUDIO, 0, 0, 0),
-       GATE(mdnie0, "mdnie0", "aclk160", GATE_IP_LCD0, 2, 0, 0),
-       GATE(rotator, "rotator", "aclk200", E4X12_GATE_IP_IMAGE, 1, 0, 0),
-       GATE(mdma2, "mdma2", "aclk200", E4X12_GATE_IP_IMAGE, 2, 0, 0),
-       GATE(smmu_mdma, "smmu_mdma", "aclk200", E4X12_GATE_IP_IMAGE, 5, 0, 0),
-       GATE(mipi_hsi, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0),
-       GATE(chipid, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, 0, 0),
-       GATE(sysreg, "sysreg", "aclk100", E4X12_GATE_IP_PERIR, 1,
+       GATE(CLK_AUDSS, "audss", "sclk_epll", E4X12_GATE_IP_MAUDIO, 0, 0, 0),
+       GATE(CLK_MDNIE0, "mdnie0", "aclk160", GATE_IP_LCD0, 2, 0, 0),
+       GATE(CLK_ROTATOR, "rotator", "aclk200", E4X12_GATE_IP_IMAGE, 1, 0, 0),
+       GATE(CLK_MDMA2, "mdma2", "aclk200", E4X12_GATE_IP_IMAGE, 2, 0, 0),
+       GATE(CLK_SMMU_MDMA, "smmu_mdma", "aclk200", E4X12_GATE_IP_IMAGE, 5, 0,
+               0),
+       GATE(CLK_MIPI_HSI, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0),
+       GATE(CLK_CHIPID, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, 0, 0),
+       GATE(CLK_SYSREG, "sysreg", "aclk100", E4X12_GATE_IP_PERIR, 1,
                        CLK_IGNORE_UNUSED, 0),
-       GATE(hdmi_cec, "hdmi_cec", "aclk100", E4X12_GATE_IP_PERIR, 11, 0, 0),
-       GATE(sclk_mdnie0, "sclk_mdnie0", "div_mdnie0",
+       GATE(CLK_HDMI_CEC, "hdmi_cec", "aclk100", E4X12_GATE_IP_PERIR, 11, 0,
+               0),
+       GATE(CLK_SCLK_MDNIE0, "sclk_mdnie0", "div_mdnie0",
                        SRC_MASK_LCD0, 4, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mdnie_pwm0, "sclk_mdnie_pwm0", "div_mdnie_pwm_pre0",
+       GATE(CLK_SCLK_MDNIE_PWM0, "sclk_mdnie_pwm0", "div_mdnie_pwm_pre0",
                        SRC_MASK_LCD0, 8, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mipihsi, "sclk_mipihsi", "div_mipihsi",
+       GATE(CLK_SCLK_MIPIHSI, "sclk_mipihsi", "div_mipihsi",
                        SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0),
-       GATE(smmu_rotator, "smmu_rotator", "aclk200",
+       GATE(CLK_SMMU_ROTATOR, "smmu_rotator", "aclk200",
                        E4X12_GATE_IP_IMAGE, 4, 0, 0),
-       GATE(mct, "mct", "aclk100", E4X12_GATE_IP_PERIR, 13,
+       GATE(CLK_MCT, "mct", "aclk100", E4X12_GATE_IP_PERIR, 13,
                        0, 0),
-       GATE(rtc, "rtc", "aclk100", E4X12_GATE_IP_PERIR, 15,
+       GATE(CLK_RTC, "rtc", "aclk100", E4X12_GATE_IP_PERIR, 15,
                        0, 0),
-       GATE(keyif, "keyif", "aclk100", E4X12_GATE_IP_PERIR, 16, 0, 0),
-       GATE(sclk_pwm_isp, "sclk_pwm_isp", "div_pwm_isp",
+       GATE(CLK_KEYIF, "keyif", "aclk100", E4X12_GATE_IP_PERIR, 16, 0, 0),
+       GATE(CLK_SCLK_PWM_ISP, "sclk_pwm_isp", "div_pwm_isp",
                        E4X12_SRC_MASK_ISP, 0, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spi0_isp, "sclk_spi0_isp", "div_spi0_isp_pre",
+       GATE(CLK_SCLK_SPI0_ISP, "sclk_spi0_isp", "div_spi0_isp_pre",
                        E4X12_SRC_MASK_ISP, 4, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spi1_isp, "sclk_spi1_isp", "div_spi1_isp_pre",
+       GATE(CLK_SCLK_SPI1_ISP, "sclk_spi1_isp", "div_spi1_isp_pre",
                        E4X12_SRC_MASK_ISP, 8, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart_isp, "sclk_uart_isp", "div_uart_isp",
+       GATE(CLK_SCLK_UART_ISP, "sclk_uart_isp", "div_uart_isp",
                        E4X12_SRC_MASK_ISP, 12, CLK_SET_RATE_PARENT, 0),
-       GATE(pwm_isp_sclk, "pwm_isp_sclk", "sclk_pwm_isp",
+       GATE(CLK_PWM_ISP_SCLK, "pwm_isp_sclk", "sclk_pwm_isp",
                        E4X12_GATE_IP_ISP, 0, 0, 0),
-       GATE(spi0_isp_sclk, "spi0_isp_sclk", "sclk_spi0_isp",
+       GATE(CLK_SPI0_ISP_SCLK, "spi0_isp_sclk", "sclk_spi0_isp",
                        E4X12_GATE_IP_ISP, 1, 0, 0),
-       GATE(spi1_isp_sclk, "spi1_isp_sclk", "sclk_spi1_isp",
+       GATE(CLK_SPI1_ISP_SCLK, "spi1_isp_sclk", "sclk_spi1_isp",
                        E4X12_GATE_IP_ISP, 2, 0, 0),
-       GATE(uart_isp_sclk, "uart_isp_sclk", "sclk_uart_isp",
+       GATE(CLK_UART_ISP_SCLK, "uart_isp_sclk", "sclk_uart_isp",
                        E4X12_GATE_IP_ISP, 3, 0, 0),
-       GATE(wdt, "watchdog", "aclk100", E4X12_GATE_IP_PERIR, 14, 0, 0),
-       GATE(pcm0, "pcm0", "aclk100", E4X12_GATE_IP_MAUDIO, 2,
+       GATE(CLK_WDT, "watchdog", "aclk100", E4X12_GATE_IP_PERIR, 14, 0, 0),
+       GATE(CLK_PCM0, "pcm0", "aclk100", E4X12_GATE_IP_MAUDIO, 2,
                        0, 0),
-       GATE(i2s0, "i2s0", "aclk100", E4X12_GATE_IP_MAUDIO, 3,
+       GATE(CLK_I2S0, "i2s0", "aclk100", E4X12_GATE_IP_MAUDIO, 3,
                        0, 0),
-       GATE(fimc_isp, "isp", "aclk200", E4X12_GATE_ISP0, 0,
+       GATE(CLK_FIMC_ISP, "isp", "aclk200", E4X12_GATE_ISP0, 0,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(fimc_drc, "drc", "aclk200", E4X12_GATE_ISP0, 1,
+       GATE(CLK_FIMC_DRC, "drc", "aclk200", E4X12_GATE_ISP0, 1,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(fimc_fd, "fd", "aclk200", E4X12_GATE_ISP0, 2,
+       GATE(CLK_FIMC_FD, "fd", "aclk200", E4X12_GATE_ISP0, 2,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(fimc_lite0, "lite0", "aclk200", E4X12_GATE_ISP0, 3,
+       GATE(CLK_FIMC_LITE0, "lite0", "aclk200", E4X12_GATE_ISP0, 3,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(fimc_lite1, "lite1", "aclk200", E4X12_GATE_ISP0, 4,
+       GATE(CLK_FIMC_LITE1, "lite1", "aclk200", E4X12_GATE_ISP0, 4,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(mcuisp, "mcuisp", "aclk200", E4X12_GATE_ISP0, 5,
+       GATE(CLK_MCUISP, "mcuisp", "aclk200", E4X12_GATE_ISP0, 5,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(gicisp, "gicisp", "aclk200", E4X12_GATE_ISP0, 7,
+       GATE(CLK_GICISP, "gicisp", "aclk200", E4X12_GATE_ISP0, 7,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(smmu_isp, "smmu_isp", "aclk200", E4X12_GATE_ISP0, 8,
+       GATE(CLK_SMMU_ISP, "smmu_isp", "aclk200", E4X12_GATE_ISP0, 8,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(smmu_drc, "smmu_drc", "aclk200", E4X12_GATE_ISP0, 9,
+       GATE(CLK_SMMU_DRC, "smmu_drc", "aclk200", E4X12_GATE_ISP0, 9,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(smmu_fd, "smmu_fd", "aclk200", E4X12_GATE_ISP0, 10,
+       GATE(CLK_SMMU_FD, "smmu_fd", "aclk200", E4X12_GATE_ISP0, 10,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(smmu_lite0, "smmu_lite0", "aclk200", E4X12_GATE_ISP0, 11,
+       GATE(CLK_SMMU_LITE0, "smmu_lite0", "aclk200", E4X12_GATE_ISP0, 11,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(smmu_lite1, "smmu_lite1", "aclk200", E4X12_GATE_ISP0, 12,
+       GATE(CLK_SMMU_LITE1, "smmu_lite1", "aclk200", E4X12_GATE_ISP0, 12,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(ppmuispmx, "ppmuispmx", "aclk200", E4X12_GATE_ISP0, 20,
+       GATE(CLK_PPMUISPMX, "ppmuispmx", "aclk200", E4X12_GATE_ISP0, 20,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(ppmuispx, "ppmuispx", "aclk200", E4X12_GATE_ISP0, 21,
+       GATE(CLK_PPMUISPX, "ppmuispx", "aclk200", E4X12_GATE_ISP0, 21,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(mcuctl_isp, "mcuctl_isp", "aclk200", E4X12_GATE_ISP0, 23,
+       GATE(CLK_MCUCTL_ISP, "mcuctl_isp", "aclk200", E4X12_GATE_ISP0, 23,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(mpwm_isp, "mpwm_isp", "aclk200", E4X12_GATE_ISP0, 24,
+       GATE(CLK_MPWM_ISP, "mpwm_isp", "aclk200", E4X12_GATE_ISP0, 24,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(i2c0_isp, "i2c0_isp", "aclk200", E4X12_GATE_ISP0, 25,
+       GATE(CLK_I2C0_ISP, "i2c0_isp", "aclk200", E4X12_GATE_ISP0, 25,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(i2c1_isp, "i2c1_isp", "aclk200", E4X12_GATE_ISP0, 26,
+       GATE(CLK_I2C1_ISP, "i2c1_isp", "aclk200", E4X12_GATE_ISP0, 26,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(mtcadc_isp, "mtcadc_isp", "aclk200", E4X12_GATE_ISP0, 27,
+       GATE(CLK_MTCADC_ISP, "mtcadc_isp", "aclk200", E4X12_GATE_ISP0, 27,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(pwm_isp, "pwm_isp", "aclk200", E4X12_GATE_ISP0, 28,
+       GATE(CLK_PWM_ISP, "pwm_isp", "aclk200", E4X12_GATE_ISP0, 28,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(wdt_isp, "wdt_isp", "aclk200", E4X12_GATE_ISP0, 30,
+       GATE(CLK_WDT_ISP, "wdt_isp", "aclk200", E4X12_GATE_ISP0, 30,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(uart_isp, "uart_isp", "aclk200", E4X12_GATE_ISP0, 31,
+       GATE(CLK_UART_ISP, "uart_isp", "aclk200", E4X12_GATE_ISP0, 31,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(asyncaxim, "asyncaxim", "aclk200", E4X12_GATE_ISP1, 0,
+       GATE(CLK_ASYNCAXIM, "asyncaxim", "aclk200", E4X12_GATE_ISP1, 0,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(smmu_ispcx, "smmu_ispcx", "aclk200", E4X12_GATE_ISP1, 4,
+       GATE(CLK_SMMU_ISPCX, "smmu_ispcx", "aclk200", E4X12_GATE_ISP1, 4,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(spi0_isp, "spi0_isp", "aclk200", E4X12_GATE_ISP1, 12,
+       GATE(CLK_SPI0_ISP, "spi0_isp", "aclk200", E4X12_GATE_ISP1, 12,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(spi1_isp, "spi1_isp", "aclk200", E4X12_GATE_ISP1, 13,
+       GATE(CLK_SPI1_ISP, "spi1_isp", "aclk200", E4X12_GATE_ISP1, 13,
                        CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0),
-       GATE(g2d, "g2d", "aclk200", GATE_IP_DMC, 23, 0, 0),
-       GATE(tmu_apbif, "tmu_apbif", "aclk100", E4X12_GATE_IP_PERIR, 17, 0, 0),
+       GATE(CLK_G2D, "g2d", "aclk200", GATE_IP_DMC, 23, 0, 0),
+       GATE(CLK_TMU_APBIF, "tmu_apbif", "aclk100", E4X12_GATE_IP_PERIR, 17, 0,
+               0),
 };
 
 static struct samsung_clock_alias exynos4_aliases[] __initdata = {
-       ALIAS(mout_core, NULL, "moutcore"),
-       ALIAS(arm_clk, NULL, "armclk"),
-       ALIAS(sclk_apll, NULL, "mout_apll"),
+       ALIAS(CLK_MOUT_CORE, NULL, "moutcore"),
+       ALIAS(CLK_ARM_CLK, NULL, "armclk"),
+       ALIAS(CLK_SCLK_APLL, NULL, "mout_apll"),
 };
 
 static struct samsung_clock_alias exynos4210_aliases[] __initdata = {
-       ALIAS(sclk_mpll, NULL, "mout_mpll"),
+       ALIAS(CLK_SCLK_MPLL, NULL, "mout_mpll"),
 };
 
 static struct samsung_clock_alias exynos4x12_aliases[] __initdata = {
-       ALIAS(mout_mpll_user_c, NULL, "mout_mpll"),
+       ALIAS(CLK_MOUT_MPLL_USER_C, NULL, "mout_mpll"),
 };
 
 /*
@@ -977,7 +925,7 @@ static void __init exynos4_clk_register_finpll(unsigned long xom)
                finpll_f = clk_get_rate(clk);
        }
 
-       fclk.id = fin_pll;
+       fclk.id = CLK_FIN_PLL;
        fclk.name = "fin_pll";
        fclk.parent_name = NULL;
        fclk.flags = CLK_IS_ROOT;
@@ -1067,24 +1015,24 @@ static struct samsung_pll_rate_table exynos4x12_vpll_rates[] __initdata = {
 };
 
 static struct samsung_pll_clock exynos4210_plls[nr_plls] __initdata = {
-       [apll] = PLL_A(pll_4508, fout_apll, "fout_apll", "fin_pll", APLL_LOCK,
-               APLL_CON0, "fout_apll", NULL),
-       [mpll] = PLL_A(pll_4508, fout_mpll, "fout_mpll", "fin_pll",
+       [apll] = PLL_A(pll_4508, CLK_FOUT_APLL, "fout_apll", "fin_pll",
+               APLL_LOCK, APLL_CON0, "fout_apll", NULL),
+       [mpll] = PLL_A(pll_4508, CLK_FOUT_MPLL, "fout_mpll", "fin_pll",
                E4210_MPLL_LOCK, E4210_MPLL_CON0, "fout_mpll", NULL),
-       [epll] = PLL_A(pll_4600, fout_epll, "fout_epll", "fin_pll", EPLL_LOCK,
-               EPLL_CON0, "fout_epll", NULL),
-       [vpll] = PLL_A(pll_4650c, fout_vpll, "fout_vpll", "mout_vpllsrc",
+       [epll] = PLL_A(pll_4600, CLK_FOUT_EPLL, "fout_epll", "fin_pll",
+               EPLL_LOCK, EPLL_CON0, "fout_epll", NULL),
+       [vpll] = PLL_A(pll_4650c, CLK_FOUT_VPLL, "fout_vpll", "mout_vpllsrc",
                VPLL_LOCK, VPLL_CON0, "fout_vpll", NULL),
 };
 
 static struct samsung_pll_clock exynos4x12_plls[nr_plls] __initdata = {
-       [apll] = PLL(pll_35xx, fout_apll, "fout_apll", "fin_pll",
+       [apll] = PLL(pll_35xx, CLK_FOUT_APLL, "fout_apll", "fin_pll",
                        APLL_LOCK, APLL_CON0, NULL),
-       [mpll] = PLL(pll_35xx, fout_mpll, "fout_mpll", "fin_pll",
+       [mpll] = PLL(pll_35xx, CLK_FOUT_MPLL, "fout_mpll", "fin_pll",
                        E4X12_MPLL_LOCK, E4X12_MPLL_CON0, NULL),
-       [epll] = PLL(pll_36xx, fout_epll, "fout_epll", "fin_pll",
+       [epll] = PLL(pll_36xx, CLK_FOUT_EPLL, "fout_epll", "fin_pll",
                        EPLL_LOCK, EPLL_CON0, NULL),
-       [vpll] = PLL(pll_36xx, fout_vpll, "fout_vpll", "fin_pll",
+       [vpll] = PLL(pll_36xx, CLK_FOUT_VPLL, "fout_vpll", "fin_pll",
                        VPLL_LOCK, VPLL_CON0, NULL),
 };
 
@@ -1098,11 +1046,11 @@ static void __init exynos4_clk_init(struct device_node *np,
                panic("%s: failed to map registers\n", __func__);
 
        if (exynos4_soc == EXYNOS4210)
-               samsung_clk_init(np, reg_base, nr_clks,
+               samsung_clk_init(np, reg_base, CLK_NR_CLKS,
                        exynos4_clk_regs, ARRAY_SIZE(exynos4_clk_regs),
                        exynos4210_clk_save, ARRAY_SIZE(exynos4210_clk_save));
        else
-               samsung_clk_init(np, reg_base, nr_clks,
+               samsung_clk_init(np, reg_base, CLK_NR_CLKS,
                        exynos4_clk_regs, ARRAY_SIZE(exynos4_clk_regs),
                        exynos4x12_clk_save, ARRAY_SIZE(exynos4x12_clk_save));
 
index e52359cf9b6fe76db63b787717f003454d89e12e..ff4beebe1f0b797de6fe0b465fc73d713065e612 100644 (file)
@@ -10,6 +10,7 @@
  * Common Clock Framework support for Exynos5250 SoC.
 */
 
+#include <dt-bindings/clock/exynos5250.h>
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/clk-provider.h>
@@ -36,6 +37,7 @@
 #define GPLL_CON0              0x10150
 #define SRC_TOP0               0x10210
 #define SRC_TOP2               0x10218
+#define SRC_TOP3               0x1021c
 #define SRC_GSCL               0x10220
 #define SRC_DISP1_0            0x1022c
 #define SRC_MAU                        0x10240
@@ -66,6 +68,7 @@
 #define DIV_PERIC4             0x10568
 #define DIV_PERIC5             0x1056c
 #define GATE_IP_GSCL           0x10920
+#define GATE_IP_DISP1          0x10928
 #define GATE_IP_MFC            0x1092c
 #define GATE_IP_GEN            0x10934
 #define GATE_IP_FSYS           0x10944
@@ -75,7 +78,6 @@
 #define BPLL_CON0              0x20110
 #define SRC_CDREX              0x20200
 #define PLL_DIV2_SEL           0x20a24
-#define GATE_IP_DISP1          0x10928
 
 /* list of PLLs to be registered */
 enum exynos5250_plls {
@@ -83,52 +85,6 @@ enum exynos5250_plls {
        nr_plls                 /* number of PLLs */
 };
 
-/*
- * Let each supported clock get a unique id. This id is used to lookup the clock
- * for device tree based platforms. The clocks are categorized into three
- * sections: core, sclk gate and bus interface gate clocks.
- *
- * When adding a new clock to this list, it is advised to choose a clock
- * category and add it to the end of that category. That is because the the
- * device tree source file is referring to these ids and any change in the
- * sequence number of existing clocks will require corresponding change in the
- * device tree files. This limitation would go away when pre-processor support
- * for dtc would be available.
- */
-enum exynos5250_clks {
-       none,
-
-       /* core clocks */
-       fin_pll, fout_apll, fout_mpll, fout_bpll, fout_gpll, fout_cpll,
-       fout_epll, fout_vpll,
-
-       /* gate for special clocks (sclk) */
-       sclk_cam_bayer = 128, sclk_cam0, sclk_cam1, sclk_gscl_wa, sclk_gscl_wb,
-       sclk_fimd1, sclk_mipi1, sclk_dp, sclk_hdmi, sclk_pixel, sclk_audio0,
-       sclk_mmc0, sclk_mmc1, sclk_mmc2, sclk_mmc3, sclk_sata, sclk_usb3,
-       sclk_jpeg, sclk_uart0, sclk_uart1, sclk_uart2, sclk_uart3, sclk_pwm,
-       sclk_audio1, sclk_audio2, sclk_spdif, sclk_spi0, sclk_spi1, sclk_spi2,
-       div_i2s1, div_i2s2, sclk_hdmiphy,
-
-       /* gate clocks */
-       gscl0 = 256, gscl1, gscl2, gscl3, gscl_wa, gscl_wb, smmu_gscl0,
-       smmu_gscl1, smmu_gscl2, smmu_gscl3, mfc, smmu_mfcl, smmu_mfcr, rotator,
-       jpeg, mdma1, smmu_rotator, smmu_jpeg, smmu_mdma1, pdma0, pdma1, sata,
-       usbotg, mipi_hsi, sdmmc0, sdmmc1, sdmmc2, sdmmc3, sromc, usb2, usb3,
-       sata_phyctrl, sata_phyi2c, uart0, uart1, uart2, uart3, uart4, i2c0,
-       i2c1, i2c2, i2c3, i2c4, i2c5, i2c6, i2c7, i2c_hdmi, adc, spi0, spi1,
-       spi2, i2s1, i2s2, pcm1, pcm2, pwm, spdif, ac97, hsi2c0, hsi2c1, hsi2c2,
-       hsi2c3, chipid, sysreg, pmu, cmu_top, cmu_core, cmu_mem, tzpc0, tzpc1,
-       tzpc2, tzpc3, tzpc4, tzpc5, tzpc6, tzpc7, tzpc8, tzpc9, hdmi_cec, mct,
-       wdt, rtc, tmu, fimd1, mie1, dsim0, dp, mixer, hdmi, g2d, mdma0,
-       smmu_mdma0,
-
-       /* mux clocks */
-       mout_hdmi = 1024,
-
-       nr_clks,
-};
-
 /*
  * list of controller registers to be saved and restored during a
  * suspend/resume cycle.
@@ -139,6 +95,7 @@ static unsigned long exynos5250_clk_regs[] __initdata = {
        SRC_CORE1,
        SRC_TOP0,
        SRC_TOP2,
+       SRC_TOP3,
        SRC_GSCL,
        SRC_DISP1_0,
        SRC_MAU,
@@ -182,7 +139,7 @@ static unsigned long exynos5250_clk_regs[] __initdata = {
 
 /* list of all parent clock list */
 PNAME(mout_apll_p)     = { "fin_pll", "fout_apll", };
-PNAME(mout_cpu_p)      = { "mout_apll", "sclk_mpll", };
+PNAME(mout_cpu_p)      = { "mout_apll", "mout_mpll", };
 PNAME(mout_mpll_fout_p)        = { "fout_mplldiv2", "fout_mpll" };
 PNAME(mout_mpll_p)     = { "fin_pll", "mout_mpll_fout" };
 PNAME(mout_bpll_fout_p)        = { "fout_bplldiv2", "fout_bpll" };
@@ -191,311 +148,432 @@ PNAME(mout_vpllsrc_p)   = { "fin_pll", "sclk_hdmi27m" };
 PNAME(mout_vpll_p)     = { "mout_vpllsrc", "fout_vpll" };
 PNAME(mout_cpll_p)     = { "fin_pll", "fout_cpll" };
 PNAME(mout_epll_p)     = { "fin_pll", "fout_epll" };
-PNAME(mout_mpll_user_p)        = { "fin_pll", "sclk_mpll" };
-PNAME(mout_bpll_user_p)        = { "fin_pll", "sclk_bpll" };
-PNAME(mout_aclk166_p)  = { "sclk_cpll", "sclk_mpll_user" };
-PNAME(mout_aclk200_p)  = { "sclk_mpll_user", "sclk_bpll_user" };
+PNAME(mout_mpll_user_p)        = { "fin_pll", "mout_mpll" };
+PNAME(mout_bpll_user_p)        = { "fin_pll", "mout_bpll" };
+PNAME(mout_aclk166_p)  = { "mout_cpll", "mout_mpll_user" };
+PNAME(mout_aclk200_p)  = { "mout_mpll_user", "mout_bpll_user" };
+PNAME(mout_aclk200_sub_p) = { "fin_pll", "div_aclk200" };
+PNAME(mout_aclk266_sub_p) = { "fin_pll", "div_aclk266" };
+PNAME(mout_aclk333_sub_p) = { "fin_pll", "div_aclk333" };
 PNAME(mout_hdmi_p)     = { "div_hdmi_pixel", "sclk_hdmiphy" };
-PNAME(mout_usb3_p)     = { "sclk_mpll_user", "sclk_cpll" };
+PNAME(mout_usb3_p)     = { "mout_mpll_user", "mout_cpll" };
 PNAME(mout_group1_p)   = { "fin_pll", "fin_pll", "sclk_hdmi27m",
                                "sclk_dptxphy", "sclk_uhostphy", "sclk_hdmiphy",
-                               "sclk_mpll_user", "sclk_epll", "sclk_vpll",
-                               "sclk_cpll" };
+                               "mout_mpll_user", "mout_epll", "mout_vpll",
+                               "mout_cpll", "none", "none",
+                               "none", "none", "none",
+                               "none" };
 PNAME(mout_audio0_p)   = { "cdclk0", "fin_pll", "sclk_hdmi27m", "sclk_dptxphy",
-                               "sclk_uhostphy", "sclk_hdmiphy",
-                               "sclk_mpll_user", "sclk_epll", "sclk_vpll",
-                               "sclk_cpll" };
+                               "sclk_uhostphy", "fin_pll",
+                               "mout_mpll_user", "mout_epll", "mout_vpll",
+                               "mout_cpll", "none", "none",
+                               "none", "none", "none",
+                               "none" };
 PNAME(mout_audio1_p)   = { "cdclk1", "fin_pll", "sclk_hdmi27m", "sclk_dptxphy",
-                               "sclk_uhostphy", "sclk_hdmiphy",
-                               "sclk_mpll_user", "sclk_epll", "sclk_vpll",
-                               "sclk_cpll" };
+                               "sclk_uhostphy", "fin_pll",
+                               "mout_mpll_user", "mout_epll", "mout_vpll",
+                               "mout_cpll", "none", "none",
+                               "none", "none", "none",
+                               "none" };
 PNAME(mout_audio2_p)   = { "cdclk2", "fin_pll", "sclk_hdmi27m", "sclk_dptxphy",
-                               "sclk_uhostphy", "sclk_hdmiphy",
-                               "sclk_mpll_user", "sclk_epll", "sclk_vpll",
-                               "sclk_cpll" };
+                               "sclk_uhostphy", "fin_pll",
+                               "mout_mpll_user", "mout_epll", "mout_vpll",
+                               "mout_cpll", "none", "none",
+                               "none", "none", "none",
+                               "none" };
 PNAME(mout_spdif_p)    = { "sclk_audio0", "sclk_audio1", "sclk_audio2",
                                "spdif_extclk" };
 
 /* fixed rate clocks generated outside the soc */
 static struct samsung_fixed_rate_clock exynos5250_fixed_rate_ext_clks[] __initdata = {
-       FRATE(fin_pll, "fin_pll", NULL, CLK_IS_ROOT, 0),
+       FRATE(CLK_FIN_PLL, "fin_pll", NULL, CLK_IS_ROOT, 0),
 };
 
 /* fixed rate clocks generated inside the soc */
 static struct samsung_fixed_rate_clock exynos5250_fixed_rate_clks[] __initdata = {
-       FRATE(sclk_hdmiphy, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 24000000),
-       FRATE(none, "sclk_hdmi27m", NULL, CLK_IS_ROOT, 27000000),
-       FRATE(none, "sclk_dptxphy", NULL, CLK_IS_ROOT, 24000000),
-       FRATE(none, "sclk_uhostphy", NULL, CLK_IS_ROOT, 48000000),
+       FRATE(CLK_SCLK_HDMIPHY, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 24000000),
+       FRATE(0, "sclk_hdmi27m", NULL, CLK_IS_ROOT, 27000000),
+       FRATE(0, "sclk_dptxphy", NULL, CLK_IS_ROOT, 24000000),
+       FRATE(0, "sclk_uhostphy", NULL, CLK_IS_ROOT, 48000000),
 };
 
 static struct samsung_fixed_factor_clock exynos5250_fixed_factor_clks[] __initdata = {
-       FFACTOR(none, "fout_mplldiv2", "fout_mpll", 1, 2, 0),
-       FFACTOR(none, "fout_bplldiv2", "fout_bpll", 1, 2, 0),
+       FFACTOR(0, "fout_mplldiv2", "fout_mpll", 1, 2, 0),
+       FFACTOR(0, "fout_bplldiv2", "fout_bpll", 1, 2, 0),
 };
 
 static struct samsung_mux_clock exynos5250_pll_pmux_clks[] __initdata = {
-       MUX(none, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP2, 0, 1),
+       MUX(0, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP2, 0, 1),
 };
 
 static struct samsung_mux_clock exynos5250_mux_clks[] __initdata = {
-       MUX_A(none, "mout_apll", mout_apll_p, SRC_CPU, 0, 1, "mout_apll"),
-       MUX_A(none, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1, "mout_cpu"),
-       MUX(none, "mout_mpll_fout", mout_mpll_fout_p, PLL_DIV2_SEL, 4, 1),
-       MUX_A(none, "sclk_mpll", mout_mpll_p, SRC_CORE1, 8, 1, "mout_mpll"),
-       MUX(none, "mout_bpll_fout", mout_bpll_fout_p, PLL_DIV2_SEL, 0, 1),
-       MUX(none, "sclk_bpll", mout_bpll_p, SRC_CDREX, 0, 1),
-       MUX(none, "sclk_vpll", mout_vpll_p, SRC_TOP2, 16, 1),
-       MUX(none, "sclk_epll", mout_epll_p, SRC_TOP2, 12, 1),
-       MUX(none, "sclk_cpll", mout_cpll_p, SRC_TOP2, 8, 1),
-       MUX(none, "sclk_mpll_user", mout_mpll_user_p, SRC_TOP2, 20, 1),
-       MUX(none, "sclk_bpll_user", mout_bpll_user_p, SRC_TOP2, 24, 1),
-       MUX(none, "mout_aclk166", mout_aclk166_p, SRC_TOP0, 8, 1),
-       MUX(none, "mout_aclk333", mout_aclk166_p, SRC_TOP0, 16, 1),
-       MUX(none, "mout_aclk200", mout_aclk200_p, SRC_TOP0, 12, 1),
-       MUX(none, "mout_cam_bayer", mout_group1_p, SRC_GSCL, 12, 4),
-       MUX(none, "mout_cam0", mout_group1_p, SRC_GSCL, 16, 4),
-       MUX(none, "mout_cam1", mout_group1_p, SRC_GSCL, 20, 4),
-       MUX(none, "mout_gscl_wa", mout_group1_p, SRC_GSCL, 24, 4),
-       MUX(none, "mout_gscl_wb", mout_group1_p, SRC_GSCL, 28, 4),
-       MUX(none, "mout_fimd1", mout_group1_p, SRC_DISP1_0, 0, 4),
-       MUX(none, "mout_mipi1", mout_group1_p, SRC_DISP1_0, 12, 4),
-       MUX(none, "mout_dp", mout_group1_p, SRC_DISP1_0, 16, 4),
-       MUX(mout_hdmi, "mout_hdmi", mout_hdmi_p, SRC_DISP1_0, 20, 1),
-       MUX(none, "mout_audio0", mout_audio0_p, SRC_MAU, 0, 4),
-       MUX(none, "mout_mmc0", mout_group1_p, SRC_FSYS, 0, 4),
-       MUX(none, "mout_mmc1", mout_group1_p, SRC_FSYS, 4, 4),
-       MUX(none, "mout_mmc2", mout_group1_p, SRC_FSYS, 8, 4),
-       MUX(none, "mout_mmc3", mout_group1_p, SRC_FSYS, 12, 4),
-       MUX(none, "mout_sata", mout_aclk200_p, SRC_FSYS, 24, 1),
-       MUX(none, "mout_usb3", mout_usb3_p, SRC_FSYS, 28, 1),
-       MUX(none, "mout_jpeg", mout_group1_p, SRC_GEN, 0, 4),
-       MUX(none, "mout_uart0", mout_group1_p, SRC_PERIC0, 0, 4),
-       MUX(none, "mout_uart1", mout_group1_p, SRC_PERIC0, 4, 4),
-       MUX(none, "mout_uart2", mout_group1_p, SRC_PERIC0, 8, 4),
-       MUX(none, "mout_uart3", mout_group1_p, SRC_PERIC0, 12, 4),
-       MUX(none, "mout_pwm", mout_group1_p, SRC_PERIC0, 24, 4),
-       MUX(none, "mout_audio1", mout_audio1_p, SRC_PERIC1, 0, 4),
-       MUX(none, "mout_audio2", mout_audio2_p, SRC_PERIC1, 4, 4),
-       MUX(none, "mout_spdif", mout_spdif_p, SRC_PERIC1, 8, 2),
-       MUX(none, "mout_spi0", mout_group1_p, SRC_PERIC1, 16, 4),
-       MUX(none, "mout_spi1", mout_group1_p, SRC_PERIC1, 20, 4),
-       MUX(none, "mout_spi2", mout_group1_p, SRC_PERIC1, 24, 4),
+       /*
+        * NOTE: Following table is sorted by (clock domain, register address,
+        * bitfield shift) triplet in ascending order. When adding new entries,
+        * please make sure that the order is kept, to avoid merge conflicts
+        * and make further work with defined data easier.
+        */
+
+       /*
+        * CMU_CPU
+        */
+       MUX_FA(0, "mout_apll", mout_apll_p, SRC_CPU, 0, 1,
+                                       CLK_SET_RATE_PARENT, 0, "mout_apll"),
+       MUX_A(0, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1, "mout_cpu"),
+
+       /*
+        * CMU_CORE
+        */
+       MUX_A(0, "mout_mpll", mout_mpll_p, SRC_CORE1, 8, 1, "mout_mpll"),
+
+       /*
+        * CMU_TOP
+        */
+       MUX(0, "mout_aclk166", mout_aclk166_p, SRC_TOP0, 8, 1),
+       MUX(0, "mout_aclk200", mout_aclk200_p, SRC_TOP0, 12, 1),
+       MUX(0, "mout_aclk333", mout_aclk166_p, SRC_TOP0, 16, 1),
+
+       MUX(0, "mout_cpll", mout_cpll_p, SRC_TOP2, 8, 1),
+       MUX(0, "mout_epll", mout_epll_p, SRC_TOP2, 12, 1),
+       MUX(0, "mout_vpll", mout_vpll_p, SRC_TOP2, 16, 1),
+       MUX(0, "mout_mpll_user", mout_mpll_user_p, SRC_TOP2, 20, 1),
+       MUX(0, "mout_bpll_user", mout_bpll_user_p, SRC_TOP2, 24, 1),
+
+       MUX(0, "mout_aclk200_disp1_sub", mout_aclk200_sub_p, SRC_TOP3, 4, 1),
+       MUX(0, "mout_aclk266_gscl_sub", mout_aclk266_sub_p, SRC_TOP3, 8, 1),
+       MUX(0, "mout_aclk333_sub", mout_aclk333_sub_p, SRC_TOP3, 24, 1),
+
+       MUX(0, "mout_cam_bayer", mout_group1_p, SRC_GSCL, 12, 4),
+       MUX(0, "mout_cam0", mout_group1_p, SRC_GSCL, 16, 4),
+       MUX(0, "mout_cam1", mout_group1_p, SRC_GSCL, 20, 4),
+       MUX(0, "mout_gscl_wa", mout_group1_p, SRC_GSCL, 24, 4),
+       MUX(0, "mout_gscl_wb", mout_group1_p, SRC_GSCL, 28, 4),
+
+       MUX(0, "mout_fimd1", mout_group1_p, SRC_DISP1_0, 0, 4),
+       MUX(0, "mout_mipi1", mout_group1_p, SRC_DISP1_0, 12, 4),
+       MUX(0, "mout_dp", mout_group1_p, SRC_DISP1_0, 16, 4),
+       MUX(CLK_MOUT_HDMI, "mout_hdmi", mout_hdmi_p, SRC_DISP1_0, 20, 1),
+
+       MUX(0, "mout_audio0", mout_audio0_p, SRC_MAU, 0, 4),
+
+       MUX(0, "mout_mmc0", mout_group1_p, SRC_FSYS, 0, 4),
+       MUX(0, "mout_mmc1", mout_group1_p, SRC_FSYS, 4, 4),
+       MUX(0, "mout_mmc2", mout_group1_p, SRC_FSYS, 8, 4),
+       MUX(0, "mout_mmc3", mout_group1_p, SRC_FSYS, 12, 4),
+       MUX(0, "mout_sata", mout_aclk200_p, SRC_FSYS, 24, 1),
+       MUX(0, "mout_usb3", mout_usb3_p, SRC_FSYS, 28, 1),
+
+       MUX(0, "mout_jpeg", mout_group1_p, SRC_GEN, 0, 4),
+
+       MUX(0, "mout_uart0", mout_group1_p, SRC_PERIC0, 0, 4),
+       MUX(0, "mout_uart1", mout_group1_p, SRC_PERIC0, 4, 4),
+       MUX(0, "mout_uart2", mout_group1_p, SRC_PERIC0, 8, 4),
+       MUX(0, "mout_uart3", mout_group1_p, SRC_PERIC0, 12, 4),
+       MUX(0, "mout_pwm", mout_group1_p, SRC_PERIC0, 24, 4),
+
+       MUX(0, "mout_audio1", mout_audio1_p, SRC_PERIC1, 0, 4),
+       MUX(0, "mout_audio2", mout_audio2_p, SRC_PERIC1, 4, 4),
+       MUX(0, "mout_spdif", mout_spdif_p, SRC_PERIC1, 8, 2),
+       MUX(0, "mout_spi0", mout_group1_p, SRC_PERIC1, 16, 4),
+       MUX(0, "mout_spi1", mout_group1_p, SRC_PERIC1, 20, 4),
+       MUX(0, "mout_spi2", mout_group1_p, SRC_PERIC1, 24, 4),
+
+       /*
+        * CMU_CDREX
+        */
+       MUX(0, "mout_bpll", mout_bpll_p, SRC_CDREX, 0, 1),
+
+       MUX(0, "mout_mpll_fout", mout_mpll_fout_p, PLL_DIV2_SEL, 4, 1),
+       MUX(0, "mout_bpll_fout", mout_bpll_fout_p, PLL_DIV2_SEL, 0, 1),
 };
 
 static struct samsung_div_clock exynos5250_div_clks[] __initdata = {
-       DIV(none, "div_arm", "mout_cpu", DIV_CPU0, 0, 3),
-       DIV(none, "sclk_apll", "mout_apll", DIV_CPU0, 24, 3),
-       DIV(none, "aclk66_pre", "sclk_mpll_user", DIV_TOP1, 24, 3),
-       DIV(none, "aclk66", "aclk66_pre", DIV_TOP0, 0, 3),
-       DIV(none, "aclk266", "sclk_mpll_user", DIV_TOP0, 16, 3),
-       DIV(none, "aclk166", "mout_aclk166", DIV_TOP0, 8, 3),
-       DIV(none, "aclk333", "mout_aclk333", DIV_TOP0, 20, 3),
-       DIV(none, "aclk200", "mout_aclk200", DIV_TOP0, 12, 3),
-       DIV(none, "div_cam_bayer", "mout_cam_bayer", DIV_GSCL, 12, 4),
-       DIV(none, "div_cam0", "mout_cam0", DIV_GSCL, 16, 4),
-       DIV(none, "div_cam1", "mout_cam1", DIV_GSCL, 20, 4),
-       DIV(none, "div_gscl_wa", "mout_gscl_wa", DIV_GSCL, 24, 4),
-       DIV(none, "div_gscl_wb", "mout_gscl_wb", DIV_GSCL, 28, 4),
-       DIV(none, "div_fimd1", "mout_fimd1", DIV_DISP1_0, 0, 4),
-       DIV(none, "div_mipi1", "mout_mipi1", DIV_DISP1_0, 16, 4),
-       DIV(none, "div_dp", "mout_dp", DIV_DISP1_0, 24, 4),
-       DIV(none, "div_jpeg", "mout_jpeg", DIV_GEN, 4, 4),
-       DIV(none, "div_audio0", "mout_audio0", DIV_MAU, 0, 4),
-       DIV(none, "div_pcm0", "sclk_audio0", DIV_MAU, 4, 8),
-       DIV(none, "div_sata", "mout_sata", DIV_FSYS0, 20, 4),
-       DIV(none, "div_usb3", "mout_usb3", DIV_FSYS0, 24, 4),
-       DIV(none, "div_mmc0", "mout_mmc0", DIV_FSYS1, 0, 4),
-       DIV(none, "div_mmc1", "mout_mmc1", DIV_FSYS1, 16, 4),
-       DIV(none, "div_mmc2", "mout_mmc2", DIV_FSYS2, 0, 4),
-       DIV(none, "div_mmc3", "mout_mmc3", DIV_FSYS2, 16, 4),
-       DIV(none, "div_uart0", "mout_uart0", DIV_PERIC0, 0, 4),
-       DIV(none, "div_uart1", "mout_uart1", DIV_PERIC0, 4, 4),
-       DIV(none, "div_uart2", "mout_uart2", DIV_PERIC0, 8, 4),
-       DIV(none, "div_uart3", "mout_uart3", DIV_PERIC0, 12, 4),
-       DIV(none, "div_spi0", "mout_spi0", DIV_PERIC1, 0, 4),
-       DIV(none, "div_spi1", "mout_spi1", DIV_PERIC1, 16, 4),
-       DIV(none, "div_spi2", "mout_spi2", DIV_PERIC2, 0, 4),
-       DIV(none, "div_pwm", "mout_pwm", DIV_PERIC3, 0, 4),
-       DIV(none, "div_audio1", "mout_audio1", DIV_PERIC4, 0, 4),
-       DIV(none, "div_pcm1", "sclk_audio1", DIV_PERIC4, 4, 8),
-       DIV(none, "div_audio2", "mout_audio2", DIV_PERIC4, 16, 4),
-       DIV(none, "div_pcm2", "sclk_audio2", DIV_PERIC4, 20, 8),
-       DIV(div_i2s1, "div_i2s1", "sclk_audio1", DIV_PERIC5, 0, 6),
-       DIV(div_i2s2, "div_i2s2", "sclk_audio2", DIV_PERIC5, 8, 6),
-       DIV(sclk_pixel, "div_hdmi_pixel", "sclk_vpll", DIV_DISP1_0, 28, 4),
-       DIV_A(none, "armclk", "div_arm", DIV_CPU0, 28, 3, "armclk"),
-       DIV_F(none, "div_mipi1_pre", "div_mipi1",
+       /*
+        * NOTE: Following table is sorted by (clock domain, register address,
+        * bitfield shift) triplet in ascending order. When adding new entries,
+        * please make sure that the order is kept, to avoid merge conflicts
+        * and make further work with defined data easier.
+        */
+
+       /*
+        * CMU_CPU
+        */
+       DIV(0, "div_arm", "mout_cpu", DIV_CPU0, 0, 3),
+       DIV(0, "div_apll", "mout_apll", DIV_CPU0, 24, 3),
+       DIV_A(0, "div_arm2", "div_arm", DIV_CPU0, 28, 3, "armclk"),
+
+       /*
+        * CMU_TOP
+        */
+       DIV(0, "div_aclk66", "div_aclk66_pre", DIV_TOP0, 0, 3),
+       DIV(0, "div_aclk166", "mout_aclk166", DIV_TOP0, 8, 3),
+       DIV(0, "div_aclk200", "mout_aclk200", DIV_TOP0, 12, 3),
+       DIV(0, "div_aclk266", "mout_mpll_user", DIV_TOP0, 16, 3),
+       DIV(0, "div_aclk333", "mout_aclk333", DIV_TOP0, 20, 3),
+
+       DIV(0, "div_aclk66_pre", "mout_mpll_user", DIV_TOP1, 24, 3),
+
+       DIV(0, "div_cam_bayer", "mout_cam_bayer", DIV_GSCL, 12, 4),
+       DIV(0, "div_cam0", "mout_cam0", DIV_GSCL, 16, 4),
+       DIV(0, "div_cam1", "mout_cam1", DIV_GSCL, 20, 4),
+       DIV(0, "div_gscl_wa", "mout_gscl_wa", DIV_GSCL, 24, 4),
+       DIV(0, "div_gscl_wb", "mout_gscl_wb", DIV_GSCL, 28, 4),
+
+       DIV(0, "div_fimd1", "mout_fimd1", DIV_DISP1_0, 0, 4),
+       DIV(0, "div_mipi1", "mout_mipi1", DIV_DISP1_0, 16, 4),
+       DIV_F(0, "div_mipi1_pre", "div_mipi1",
                        DIV_DISP1_0, 20, 4, CLK_SET_RATE_PARENT, 0),
-       DIV_F(none, "div_mmc_pre0", "div_mmc0",
+       DIV(0, "div_dp", "mout_dp", DIV_DISP1_0, 24, 4),
+       DIV(CLK_SCLK_PIXEL, "div_hdmi_pixel", "mout_vpll", DIV_DISP1_0, 28, 4),
+
+       DIV(0, "div_jpeg", "mout_jpeg", DIV_GEN, 4, 4),
+
+       DIV(0, "div_audio0", "mout_audio0", DIV_MAU, 0, 4),
+       DIV(CLK_DIV_PCM0, "div_pcm0", "sclk_audio0", DIV_MAU, 4, 8),
+
+       DIV(0, "div_sata", "mout_sata", DIV_FSYS0, 20, 4),
+       DIV(0, "div_usb3", "mout_usb3", DIV_FSYS0, 24, 4),
+
+       DIV(0, "div_mmc0", "mout_mmc0", DIV_FSYS1, 0, 4),
+       DIV_F(0, "div_mmc_pre0", "div_mmc0",
                        DIV_FSYS1, 8, 8, CLK_SET_RATE_PARENT, 0),
-       DIV_F(none, "div_mmc_pre1", "div_mmc1",
+       DIV(0, "div_mmc1", "mout_mmc1", DIV_FSYS1, 16, 4),
+       DIV_F(0, "div_mmc_pre1", "div_mmc1",
                        DIV_FSYS1, 24, 8, CLK_SET_RATE_PARENT, 0),
-       DIV_F(none, "div_mmc_pre2", "div_mmc2",
+
+       DIV(0, "div_mmc2", "mout_mmc2", DIV_FSYS2, 0, 4),
+       DIV_F(0, "div_mmc_pre2", "div_mmc2",
                        DIV_FSYS2, 8, 8, CLK_SET_RATE_PARENT, 0),
-       DIV_F(none, "div_mmc_pre3", "div_mmc3",
+       DIV(0, "div_mmc3", "mout_mmc3", DIV_FSYS2, 16, 4),
+       DIV_F(0, "div_mmc_pre3", "div_mmc3",
                        DIV_FSYS2, 24, 8, CLK_SET_RATE_PARENT, 0),
-       DIV_F(none, "div_spi_pre0", "div_spi0",
+
+       DIV(0, "div_uart0", "mout_uart0", DIV_PERIC0, 0, 4),
+       DIV(0, "div_uart1", "mout_uart1", DIV_PERIC0, 4, 4),
+       DIV(0, "div_uart2", "mout_uart2", DIV_PERIC0, 8, 4),
+       DIV(0, "div_uart3", "mout_uart3", DIV_PERIC0, 12, 4),
+
+       DIV(0, "div_spi0", "mout_spi0", DIV_PERIC1, 0, 4),
+       DIV_F(0, "div_spi_pre0", "div_spi0",
                        DIV_PERIC1, 8, 8, CLK_SET_RATE_PARENT, 0),
-       DIV_F(none, "div_spi_pre1", "div_spi1",
+       DIV(0, "div_spi1", "mout_spi1", DIV_PERIC1, 16, 4),
+       DIV_F(0, "div_spi_pre1", "div_spi1",
                        DIV_PERIC1, 24, 8, CLK_SET_RATE_PARENT, 0),
-       DIV_F(none, "div_spi_pre2", "div_spi2",
+
+       DIV(0, "div_spi2", "mout_spi2", DIV_PERIC2, 0, 4),
+       DIV_F(0, "div_spi_pre2", "div_spi2",
                        DIV_PERIC2, 8, 8, CLK_SET_RATE_PARENT, 0),
+
+       DIV(0, "div_pwm", "mout_pwm", DIV_PERIC3, 0, 4),
+
+       DIV(0, "div_audio1", "mout_audio1", DIV_PERIC4, 0, 4),
+       DIV(0, "div_pcm1", "sclk_audio1", DIV_PERIC4, 4, 8),
+       DIV(0, "div_audio2", "mout_audio2", DIV_PERIC4, 16, 4),
+       DIV(0, "div_pcm2", "sclk_audio2", DIV_PERIC4, 20, 8),
+
+       DIV(CLK_DIV_I2S1, "div_i2s1", "sclk_audio1", DIV_PERIC5, 0, 6),
+       DIV(CLK_DIV_I2S2, "div_i2s2", "sclk_audio2", DIV_PERIC5, 8, 6),
 };
 
 static struct samsung_gate_clock exynos5250_gate_clks[] __initdata = {
-       GATE(gscl0, "gscl0", "none", GATE_IP_GSCL, 0, 0, 0),
-       GATE(gscl1, "gscl1", "none", GATE_IP_GSCL, 1, 0, 0),
-       GATE(gscl2, "gscl2", "aclk266", GATE_IP_GSCL, 2, 0, 0),
-       GATE(gscl3, "gscl3", "aclk266", GATE_IP_GSCL, 3, 0, 0),
-       GATE(gscl_wa, "gscl_wa", "div_gscl_wa", GATE_IP_GSCL, 5, 0, 0),
-       GATE(gscl_wb, "gscl_wb", "div_gscl_wb", GATE_IP_GSCL, 6, 0, 0),
-       GATE(smmu_gscl0, "smmu_gscl0", "aclk266", GATE_IP_GSCL, 7, 0, 0),
-       GATE(smmu_gscl1, "smmu_gscl1", "aclk266", GATE_IP_GSCL, 8, 0, 0),
-       GATE(smmu_gscl2, "smmu_gscl2", "aclk266", GATE_IP_GSCL, 9, 0, 0),
-       GATE(smmu_gscl3, "smmu_gscl3", "aclk266", GATE_IP_GSCL, 10, 0, 0),
-       GATE(mfc, "mfc", "aclk333", GATE_IP_MFC, 0, 0, 0),
-       GATE(smmu_mfcl, "smmu_mfcl", "aclk333", GATE_IP_MFC, 2, 0, 0),
-       GATE(smmu_mfcr, "smmu_mfcr", "aclk333", GATE_IP_MFC, 1, 0, 0),
-       GATE(rotator, "rotator", "aclk266", GATE_IP_GEN, 1, 0, 0),
-       GATE(jpeg, "jpeg", "aclk166", GATE_IP_GEN, 2, 0, 0),
-       GATE(mdma1, "mdma1", "aclk266", GATE_IP_GEN, 4, 0, 0),
-       GATE(smmu_rotator, "smmu_rotator", "aclk266", GATE_IP_GEN, 6, 0, 0),
-       GATE(smmu_jpeg, "smmu_jpeg", "aclk166", GATE_IP_GEN, 7, 0, 0),
-       GATE(smmu_mdma1, "smmu_mdma1", "aclk266", GATE_IP_GEN, 9, 0, 0),
-       GATE(pdma0, "pdma0", "aclk200", GATE_IP_FSYS, 1, 0, 0),
-       GATE(pdma1, "pdma1", "aclk200", GATE_IP_FSYS, 2, 0, 0),
-       GATE(sata, "sata", "aclk200", GATE_IP_FSYS, 6, 0, 0),
-       GATE(usbotg, "usbotg", "aclk200", GATE_IP_FSYS, 7, 0, 0),
-       GATE(mipi_hsi, "mipi_hsi", "aclk200", GATE_IP_FSYS, 8, 0, 0),
-       GATE(sdmmc0, "sdmmc0", "aclk200", GATE_IP_FSYS, 12, 0, 0),
-       GATE(sdmmc1, "sdmmc1", "aclk200", GATE_IP_FSYS, 13, 0, 0),
-       GATE(sdmmc2, "sdmmc2", "aclk200", GATE_IP_FSYS, 14, 0, 0),
-       GATE(sdmmc3, "sdmmc3", "aclk200", GATE_IP_FSYS, 15, 0, 0),
-       GATE(sromc, "sromc", "aclk200", GATE_IP_FSYS, 17, 0, 0),
-       GATE(usb2, "usb2", "aclk200", GATE_IP_FSYS, 18, 0, 0),
-       GATE(usb3, "usb3", "aclk200", GATE_IP_FSYS, 19, 0, 0),
-       GATE(sata_phyctrl, "sata_phyctrl", "aclk200", GATE_IP_FSYS, 24, 0, 0),
-       GATE(sata_phyi2c, "sata_phyi2c", "aclk200", GATE_IP_FSYS, 25, 0, 0),
-       GATE(uart0, "uart0", "aclk66", GATE_IP_PERIC, 0, 0, 0),
-       GATE(uart1, "uart1", "aclk66", GATE_IP_PERIC, 1, 0, 0),
-       GATE(uart2, "uart2", "aclk66", GATE_IP_PERIC, 2, 0, 0),
-       GATE(uart3, "uart3", "aclk66", GATE_IP_PERIC, 3, 0, 0),
-       GATE(uart4, "uart4", "aclk66", GATE_IP_PERIC, 4, 0, 0),
-       GATE(i2c0, "i2c0", "aclk66", GATE_IP_PERIC, 6, 0, 0),
-       GATE(i2c1, "i2c1", "aclk66", GATE_IP_PERIC, 7, 0, 0),
-       GATE(i2c2, "i2c2", "aclk66", GATE_IP_PERIC, 8, 0, 0),
-       GATE(i2c3, "i2c3", "aclk66", GATE_IP_PERIC, 9, 0, 0),
-       GATE(i2c4, "i2c4", "aclk66", GATE_IP_PERIC, 10, 0, 0),
-       GATE(i2c5, "i2c5", "aclk66", GATE_IP_PERIC, 11, 0, 0),
-       GATE(i2c6, "i2c6", "aclk66", GATE_IP_PERIC, 12, 0, 0),
-       GATE(i2c7, "i2c7", "aclk66", GATE_IP_PERIC, 13, 0, 0),
-       GATE(i2c_hdmi, "i2c_hdmi", "aclk66", GATE_IP_PERIC, 14, 0, 0),
-       GATE(adc, "adc", "aclk66", GATE_IP_PERIC, 15, 0, 0),
-       GATE(spi0, "spi0", "aclk66", GATE_IP_PERIC, 16, 0, 0),
-       GATE(spi1, "spi1", "aclk66", GATE_IP_PERIC, 17, 0, 0),
-       GATE(spi2, "spi2", "aclk66", GATE_IP_PERIC, 18, 0, 0),
-       GATE(i2s1, "i2s1", "aclk66", GATE_IP_PERIC, 20, 0, 0),
-       GATE(i2s2, "i2s2", "aclk66", GATE_IP_PERIC, 21, 0, 0),
-       GATE(pcm1, "pcm1", "aclk66", GATE_IP_PERIC, 22, 0, 0),
-       GATE(pcm2, "pcm2", "aclk66", GATE_IP_PERIC, 23, 0, 0),
-       GATE(pwm, "pwm", "aclk66", GATE_IP_PERIC, 24, 0, 0),
-       GATE(spdif, "spdif", "aclk66", GATE_IP_PERIC, 26, 0, 0),
-       GATE(ac97, "ac97", "aclk66", GATE_IP_PERIC, 27, 0, 0),
-       GATE(hsi2c0, "hsi2c0", "aclk66", GATE_IP_PERIC, 28, 0, 0),
-       GATE(hsi2c1, "hsi2c1", "aclk66", GATE_IP_PERIC, 29, 0, 0),
-       GATE(hsi2c2, "hsi2c2", "aclk66", GATE_IP_PERIC, 30, 0, 0),
-       GATE(hsi2c3, "hsi2c3", "aclk66", GATE_IP_PERIC, 31, 0, 0),
-       GATE(chipid, "chipid", "aclk66", GATE_IP_PERIS, 0, 0, 0),
-       GATE(sysreg, "sysreg", "aclk66",
-                       GATE_IP_PERIS, 1, CLK_IGNORE_UNUSED, 0),
-       GATE(pmu, "pmu", "aclk66", GATE_IP_PERIS, 2, CLK_IGNORE_UNUSED, 0),
-       GATE(tzpc0, "tzpc0", "aclk66", GATE_IP_PERIS, 6, 0, 0),
-       GATE(tzpc1, "tzpc1", "aclk66", GATE_IP_PERIS, 7, 0, 0),
-       GATE(tzpc2, "tzpc2", "aclk66", GATE_IP_PERIS, 8, 0, 0),
-       GATE(tzpc3, "tzpc3", "aclk66", GATE_IP_PERIS, 9, 0, 0),
-       GATE(tzpc4, "tzpc4", "aclk66", GATE_IP_PERIS, 10, 0, 0),
-       GATE(tzpc5, "tzpc5", "aclk66", GATE_IP_PERIS, 11, 0, 0),
-       GATE(tzpc6, "tzpc6", "aclk66", GATE_IP_PERIS, 12, 0, 0),
-       GATE(tzpc7, "tzpc7", "aclk66", GATE_IP_PERIS, 13, 0, 0),
-       GATE(tzpc8, "tzpc8", "aclk66", GATE_IP_PERIS, 14, 0, 0),
-       GATE(tzpc9, "tzpc9", "aclk66", GATE_IP_PERIS, 15, 0, 0),
-       GATE(hdmi_cec, "hdmi_cec", "aclk66", GATE_IP_PERIS, 16, 0, 0),
-       GATE(mct, "mct", "aclk66", GATE_IP_PERIS, 18, 0, 0),
-       GATE(wdt, "wdt", "aclk66", GATE_IP_PERIS, 19, 0, 0),
-       GATE(rtc, "rtc", "aclk66", GATE_IP_PERIS, 20, 0, 0),
-       GATE(tmu, "tmu", "aclk66", GATE_IP_PERIS, 21, 0, 0),
-       GATE(cmu_top, "cmu_top", "aclk66",
-                       GATE_IP_PERIS, 3, CLK_IGNORE_UNUSED, 0),
-       GATE(cmu_core, "cmu_core", "aclk66",
-                       GATE_IP_PERIS, 4, CLK_IGNORE_UNUSED, 0),
-       GATE(cmu_mem, "cmu_mem", "aclk66",
-                       GATE_IP_PERIS, 5, CLK_IGNORE_UNUSED, 0),
-       GATE(sclk_cam_bayer, "sclk_cam_bayer", "div_cam_bayer",
+       /*
+        * NOTE: Following table is sorted by (clock domain, register address,
+        * bitfield shift) triplet in ascending order. When adding new entries,
+        * please make sure that the order is kept, to avoid merge conflicts
+        * and make further work with defined data easier.
+        */
+
+       /*
+        * CMU_ACP
+        */
+       GATE(CLK_MDMA0, "mdma0", "div_aclk266", GATE_IP_ACP, 1, 0, 0),
+       GATE(CLK_G2D, "g2d", "div_aclk200", GATE_IP_ACP, 3, 0, 0),
+       GATE(CLK_SMMU_MDMA0, "smmu_mdma0", "div_aclk266", GATE_IP_ACP, 5, 0, 0),
+
+       /*
+        * CMU_TOP
+        */
+       GATE(CLK_SCLK_CAM_BAYER, "sclk_cam_bayer", "div_cam_bayer",
                        SRC_MASK_GSCL, 12, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_cam0, "sclk_cam0", "div_cam0",
+       GATE(CLK_SCLK_CAM0, "sclk_cam0", "div_cam0",
                        SRC_MASK_GSCL, 16, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_cam1, "sclk_cam1", "div_cam1",
+       GATE(CLK_SCLK_CAM1, "sclk_cam1", "div_cam1",
                        SRC_MASK_GSCL, 20, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_gscl_wa, "sclk_gscl_wa", "div_gscl_wa",
+       GATE(CLK_SCLK_GSCL_WA, "sclk_gscl_wa", "div_gscl_wa",
                        SRC_MASK_GSCL, 24, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_gscl_wb, "sclk_gscl_wb", "div_gscl_wb",
+       GATE(CLK_SCLK_GSCL_WB, "sclk_gscl_wb", "div_gscl_wb",
                        SRC_MASK_GSCL, 28, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_fimd1, "sclk_fimd1", "div_fimd1",
+
+       GATE(CLK_SCLK_FIMD1, "sclk_fimd1", "div_fimd1",
                        SRC_MASK_DISP1_0, 0, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mipi1, "sclk_mipi1", "div_mipi1",
+       GATE(CLK_SCLK_MIPI1, "sclk_mipi1", "div_mipi1",
                        SRC_MASK_DISP1_0, 12, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_dp, "sclk_dp", "div_dp",
+       GATE(CLK_SCLK_DP, "sclk_dp", "div_dp",
                        SRC_MASK_DISP1_0, 16, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_hdmi, "sclk_hdmi", "mout_hdmi",
+       GATE(CLK_SCLK_HDMI, "sclk_hdmi", "mout_hdmi",
                        SRC_MASK_DISP1_0, 20, 0, 0),
-       GATE(sclk_audio0, "sclk_audio0", "div_audio0",
+
+       GATE(CLK_SCLK_AUDIO0, "sclk_audio0", "div_audio0",
                        SRC_MASK_MAU, 0, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mmc0, "sclk_mmc0", "div_mmc_pre0",
+
+       GATE(CLK_SCLK_MMC0, "sclk_mmc0", "div_mmc_pre0",
                        SRC_MASK_FSYS, 0, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mmc1, "sclk_mmc1", "div_mmc_pre1",
+       GATE(CLK_SCLK_MMC1, "sclk_mmc1", "div_mmc_pre1",
                        SRC_MASK_FSYS, 4, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mmc2, "sclk_mmc2", "div_mmc_pre2",
+       GATE(CLK_SCLK_MMC2, "sclk_mmc2", "div_mmc_pre2",
                        SRC_MASK_FSYS, 8, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mmc3, "sclk_mmc3", "div_mmc_pre3",
+       GATE(CLK_SCLK_MMC3, "sclk_mmc3", "div_mmc_pre3",
                        SRC_MASK_FSYS, 12, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_sata, "sclk_sata", "div_sata",
+       GATE(CLK_SCLK_SATA, "sclk_sata", "div_sata",
                        SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_usb3, "sclk_usb3", "div_usb3",
+       GATE(CLK_SCLK_USB3, "sclk_usb3", "div_usb3",
                        SRC_MASK_FSYS, 28, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_jpeg, "sclk_jpeg", "div_jpeg",
+
+       GATE(CLK_SCLK_JPEG, "sclk_jpeg", "div_jpeg",
                        SRC_MASK_GEN, 0, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart0, "sclk_uart0", "div_uart0",
+
+       GATE(CLK_SCLK_UART0, "sclk_uart0", "div_uart0",
                        SRC_MASK_PERIC0, 0, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart1, "sclk_uart1", "div_uart1",
+       GATE(CLK_SCLK_UART1, "sclk_uart1", "div_uart1",
                        SRC_MASK_PERIC0, 4, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart2, "sclk_uart2", "div_uart2",
+       GATE(CLK_SCLK_UART2, "sclk_uart2", "div_uart2",
                        SRC_MASK_PERIC0, 8, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart3, "sclk_uart3", "div_uart3",
+       GATE(CLK_SCLK_UART3, "sclk_uart3", "div_uart3",
                        SRC_MASK_PERIC0, 12, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_pwm, "sclk_pwm", "div_pwm",
+       GATE(CLK_SCLK_PWM, "sclk_pwm", "div_pwm",
                        SRC_MASK_PERIC0, 24, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_audio1, "sclk_audio1", "div_audio1",
+
+       GATE(CLK_SCLK_AUDIO1, "sclk_audio1", "div_audio1",
                        SRC_MASK_PERIC1, 0, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_audio2, "sclk_audio2", "div_audio2",
+       GATE(CLK_SCLK_AUDIO2, "sclk_audio2", "div_audio2",
                        SRC_MASK_PERIC1, 4, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spdif, "sclk_spdif", "mout_spdif",
+       GATE(CLK_SCLK_SPDIF, "sclk_spdif", "mout_spdif",
                        SRC_MASK_PERIC1, 4, 0, 0),
-       GATE(sclk_spi0, "sclk_spi0", "div_spi_pre0",
+       GATE(CLK_SCLK_SPI0, "sclk_spi0", "div_spi_pre0",
                        SRC_MASK_PERIC1, 16, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spi1, "sclk_spi1", "div_spi_pre1",
+       GATE(CLK_SCLK_SPI1, "sclk_spi1", "div_spi_pre1",
                        SRC_MASK_PERIC1, 20, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spi2, "sclk_spi2", "div_spi_pre2",
+       GATE(CLK_SCLK_SPI2, "sclk_spi2", "div_spi_pre2",
                        SRC_MASK_PERIC1, 24, CLK_SET_RATE_PARENT, 0),
-       GATE(fimd1, "fimd1", "aclk200", GATE_IP_DISP1, 0, 0, 0),
-       GATE(mie1, "mie1", "aclk200", GATE_IP_DISP1, 1, 0, 0),
-       GATE(dsim0, "dsim0", "aclk200", GATE_IP_DISP1, 3, 0, 0),
-       GATE(dp, "dp", "aclk200", GATE_IP_DISP1, 4, 0, 0),
-       GATE(mixer, "mixer", "mout_aclk200_disp1", GATE_IP_DISP1, 5, 0, 0),
-       GATE(hdmi, "hdmi", "mout_aclk200_disp1", GATE_IP_DISP1, 6, 0, 0),
-       GATE(g2d, "g2d", "aclk200", GATE_IP_ACP, 3, 0, 0),
-       GATE(mdma0, "mdma0", "aclk266", GATE_IP_ACP, 1, 0, 0),
-       GATE(smmu_mdma0, "smmu_mdma0", "aclk266", GATE_IP_ACP, 5, 0, 0),
+
+       GATE(CLK_GSCL0, "gscl0", "mout_aclk266_gscl_sub", GATE_IP_GSCL, 0, 0,
+               0),
+       GATE(CLK_GSCL1, "gscl1", "mout_aclk266_gscl_sub", GATE_IP_GSCL, 1, 0,
+               0),
+       GATE(CLK_GSCL2, "gscl2", "mout_aclk266_gscl_sub", GATE_IP_GSCL, 2, 0,
+               0),
+       GATE(CLK_GSCL3, "gscl3", "mout_aclk266_gscl_sub", GATE_IP_GSCL, 3, 0,
+               0),
+       GATE(CLK_GSCL_WA, "gscl_wa", "div_gscl_wa", GATE_IP_GSCL, 5, 0, 0),
+       GATE(CLK_GSCL_WB, "gscl_wb", "div_gscl_wb", GATE_IP_GSCL, 6, 0, 0),
+       GATE(CLK_SMMU_GSCL0, "smmu_gscl0", "mout_aclk266_gscl_sub",
+                       GATE_IP_GSCL, 7, 0, 0),
+       GATE(CLK_SMMU_GSCL1, "smmu_gscl1", "mout_aclk266_gscl_sub",
+                       GATE_IP_GSCL, 8, 0, 0),
+       GATE(CLK_SMMU_GSCL2, "smmu_gscl2", "mout_aclk266_gscl_sub",
+                       GATE_IP_GSCL, 9, 0, 0),
+       GATE(CLK_SMMU_GSCL3, "smmu_gscl3", "mout_aclk266_gscl_sub",
+                       GATE_IP_GSCL, 10, 0, 0),
+
+       GATE(CLK_FIMD1, "fimd1", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 0, 0,
+               0),
+       GATE(CLK_MIE1, "mie1", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 1, 0,
+               0),
+       GATE(CLK_DSIM0, "dsim0", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 3, 0,
+               0),
+       GATE(CLK_DP, "dp", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 4, 0, 0),
+       GATE(CLK_MIXER, "mixer", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 5, 0,
+               0),
+       GATE(CLK_HDMI, "hdmi", "mout_aclk200_disp1_sub", GATE_IP_DISP1, 6, 0,
+               0),
+
+       GATE(CLK_MFC, "mfc", "mout_aclk333_sub", GATE_IP_MFC, 0, 0, 0),
+       GATE(CLK_SMMU_MFCR, "smmu_mfcr", "mout_aclk333_sub", GATE_IP_MFC, 1, 0,
+               0),
+       GATE(CLK_SMMU_MFCL, "smmu_mfcl", "mout_aclk333_sub", GATE_IP_MFC, 2, 0,
+               0),
+
+       GATE(CLK_ROTATOR, "rotator", "div_aclk266", GATE_IP_GEN, 1, 0, 0),
+       GATE(CLK_JPEG, "jpeg", "div_aclk166", GATE_IP_GEN, 2, 0, 0),
+       GATE(CLK_MDMA1, "mdma1", "div_aclk266", GATE_IP_GEN, 4, 0, 0),
+       GATE(CLK_SMMU_ROTATOR, "smmu_rotator", "div_aclk266", GATE_IP_GEN, 6, 0,
+               0),
+       GATE(CLK_SMMU_JPEG, "smmu_jpeg", "div_aclk166", GATE_IP_GEN, 7, 0, 0),
+       GATE(CLK_SMMU_MDMA1, "smmu_mdma1", "div_aclk266", GATE_IP_GEN, 9, 0, 0),
+
+       GATE(CLK_PDMA0, "pdma0", "div_aclk200", GATE_IP_FSYS, 1, 0, 0),
+       GATE(CLK_PDMA1, "pdma1", "div_aclk200", GATE_IP_FSYS, 2, 0, 0),
+       GATE(CLK_SATA, "sata", "div_aclk200", GATE_IP_FSYS, 6, 0, 0),
+       GATE(CLK_USBOTG, "usbotg", "div_aclk200", GATE_IP_FSYS, 7, 0, 0),
+       GATE(CLK_MIPI_HSI, "mipi_hsi", "div_aclk200", GATE_IP_FSYS, 8, 0, 0),
+       GATE(CLK_SDMMC0, "sdmmc0", "div_aclk200", GATE_IP_FSYS, 12, 0, 0),
+       GATE(CLK_SDMMC1, "sdmmc1", "div_aclk200", GATE_IP_FSYS, 13, 0, 0),
+       GATE(CLK_SDMMC2, "sdmmc2", "div_aclk200", GATE_IP_FSYS, 14, 0, 0),
+       GATE(CLK_SDMMC3, "sdmmc3", "div_aclk200", GATE_IP_FSYS, 15, 0, 0),
+       GATE(CLK_SROMC, "sromc", "div_aclk200", GATE_IP_FSYS, 17, 0, 0),
+       GATE(CLK_USB2, "usb2", "div_aclk200", GATE_IP_FSYS, 18, 0, 0),
+       GATE(CLK_USB3, "usb3", "div_aclk200", GATE_IP_FSYS, 19, 0, 0),
+       GATE(CLK_SATA_PHYCTRL, "sata_phyctrl", "div_aclk200",
+                       GATE_IP_FSYS, 24, 0, 0),
+       GATE(CLK_SATA_PHYI2C, "sata_phyi2c", "div_aclk200", GATE_IP_FSYS, 25, 0,
+               0),
+
+       GATE(CLK_UART0, "uart0", "div_aclk66", GATE_IP_PERIC, 0, 0, 0),
+       GATE(CLK_UART1, "uart1", "div_aclk66", GATE_IP_PERIC, 1, 0, 0),
+       GATE(CLK_UART2, "uart2", "div_aclk66", GATE_IP_PERIC, 2, 0, 0),
+       GATE(CLK_UART3, "uart3", "div_aclk66", GATE_IP_PERIC, 3, 0, 0),
+       GATE(CLK_UART4, "uart4", "div_aclk66", GATE_IP_PERIC, 4, 0, 0),
+       GATE(CLK_I2C0, "i2c0", "div_aclk66", GATE_IP_PERIC, 6, 0, 0),
+       GATE(CLK_I2C1, "i2c1", "div_aclk66", GATE_IP_PERIC, 7, 0, 0),
+       GATE(CLK_I2C2, "i2c2", "div_aclk66", GATE_IP_PERIC, 8, 0, 0),
+       GATE(CLK_I2C3, "i2c3", "div_aclk66", GATE_IP_PERIC, 9, 0, 0),
+       GATE(CLK_I2C4, "i2c4", "div_aclk66", GATE_IP_PERIC, 10, 0, 0),
+       GATE(CLK_I2C5, "i2c5", "div_aclk66", GATE_IP_PERIC, 11, 0, 0),
+       GATE(CLK_I2C6, "i2c6", "div_aclk66", GATE_IP_PERIC, 12, 0, 0),
+       GATE(CLK_I2C7, "i2c7", "div_aclk66", GATE_IP_PERIC, 13, 0, 0),
+       GATE(CLK_I2C_HDMI, "i2c_hdmi", "div_aclk66", GATE_IP_PERIC, 14, 0, 0),
+       GATE(CLK_ADC, "adc", "div_aclk66", GATE_IP_PERIC, 15, 0, 0),
+       GATE(CLK_SPI0, "spi0", "div_aclk66", GATE_IP_PERIC, 16, 0, 0),
+       GATE(CLK_SPI1, "spi1", "div_aclk66", GATE_IP_PERIC, 17, 0, 0),
+       GATE(CLK_SPI2, "spi2", "div_aclk66", GATE_IP_PERIC, 18, 0, 0),
+       GATE(CLK_I2S1, "i2s1", "div_aclk66", GATE_IP_PERIC, 20, 0, 0),
+       GATE(CLK_I2S2, "i2s2", "div_aclk66", GATE_IP_PERIC, 21, 0, 0),
+       GATE(CLK_PCM1, "pcm1", "div_aclk66", GATE_IP_PERIC, 22, 0, 0),
+       GATE(CLK_PCM2, "pcm2", "div_aclk66", GATE_IP_PERIC, 23, 0, 0),
+       GATE(CLK_PWM, "pwm", "div_aclk66", GATE_IP_PERIC, 24, 0, 0),
+       GATE(CLK_SPDIF, "spdif", "div_aclk66", GATE_IP_PERIC, 26, 0, 0),
+       GATE(CLK_AC97, "ac97", "div_aclk66", GATE_IP_PERIC, 27, 0, 0),
+       GATE(CLK_HSI2C0, "hsi2c0", "div_aclk66", GATE_IP_PERIC, 28, 0, 0),
+       GATE(CLK_HSI2C1, "hsi2c1", "div_aclk66", GATE_IP_PERIC, 29, 0, 0),
+       GATE(CLK_HSI2C2, "hsi2c2", "div_aclk66", GATE_IP_PERIC, 30, 0, 0),
+       GATE(CLK_HSI2C3, "hsi2c3", "div_aclk66", GATE_IP_PERIC, 31, 0, 0),
+
+       GATE(CLK_CHIPID, "chipid", "div_aclk66", GATE_IP_PERIS, 0, 0, 0),
+       GATE(CLK_SYSREG, "sysreg", "div_aclk66",
+                       GATE_IP_PERIS, 1, CLK_IGNORE_UNUSED, 0),
+       GATE(CLK_PMU, "pmu", "div_aclk66", GATE_IP_PERIS, 2, CLK_IGNORE_UNUSED,
+               0),
+       GATE(CLK_CMU_TOP, "cmu_top", "div_aclk66",
+                       GATE_IP_PERIS, 3, CLK_IGNORE_UNUSED, 0),
+       GATE(CLK_CMU_CORE, "cmu_core", "div_aclk66",
+                       GATE_IP_PERIS, 4, CLK_IGNORE_UNUSED, 0),
+       GATE(CLK_CMU_MEM, "cmu_mem", "div_aclk66",
+                       GATE_IP_PERIS, 5, CLK_IGNORE_UNUSED, 0),
+       GATE(CLK_TZPC0, "tzpc0", "div_aclk66", GATE_IP_PERIS, 6, 0, 0),
+       GATE(CLK_TZPC1, "tzpc1", "div_aclk66", GATE_IP_PERIS, 7, 0, 0),
+       GATE(CLK_TZPC2, "tzpc2", "div_aclk66", GATE_IP_PERIS, 8, 0, 0),
+       GATE(CLK_TZPC3, "tzpc3", "div_aclk66", GATE_IP_PERIS, 9, 0, 0),
+       GATE(CLK_TZPC4, "tzpc4", "div_aclk66", GATE_IP_PERIS, 10, 0, 0),
+       GATE(CLK_TZPC5, "tzpc5", "div_aclk66", GATE_IP_PERIS, 11, 0, 0),
+       GATE(CLK_TZPC6, "tzpc6", "div_aclk66", GATE_IP_PERIS, 12, 0, 0),
+       GATE(CLK_TZPC7, "tzpc7", "div_aclk66", GATE_IP_PERIS, 13, 0, 0),
+       GATE(CLK_TZPC8, "tzpc8", "div_aclk66", GATE_IP_PERIS, 14, 0, 0),
+       GATE(CLK_TZPC9, "tzpc9", "div_aclk66", GATE_IP_PERIS, 15, 0, 0),
+       GATE(CLK_HDMI_CEC, "hdmi_cec", "div_aclk66", GATE_IP_PERIS, 16, 0, 0),
+       GATE(CLK_MCT, "mct", "div_aclk66", GATE_IP_PERIS, 18, 0, 0),
+       GATE(CLK_WDT, "wdt", "div_aclk66", GATE_IP_PERIS, 19, 0, 0),
+       GATE(CLK_RTC, "rtc", "div_aclk66", GATE_IP_PERIS, 20, 0, 0),
+       GATE(CLK_TMU, "tmu", "div_aclk66", GATE_IP_PERIS, 21, 0, 0),
 };
 
 static struct samsung_pll_rate_table vpll_24mhz_tbl[] __initdata = {
@@ -521,20 +599,41 @@ static struct samsung_pll_rate_table epll_24mhz_tbl[] __initdata = {
        { },
 };
 
+static struct samsung_pll_rate_table apll_24mhz_tbl[] __initdata = {
+       /* sorted in descending order */
+       /* PLL_35XX_RATE(rate, m, p, s) */
+       PLL_35XX_RATE(1700000000, 425, 6, 0),
+       PLL_35XX_RATE(1600000000, 200, 3, 0),
+       PLL_35XX_RATE(1500000000, 250, 4, 0),
+       PLL_35XX_RATE(1400000000, 175, 3, 0),
+       PLL_35XX_RATE(1300000000, 325, 6, 0),
+       PLL_35XX_RATE(1200000000, 200, 4, 0),
+       PLL_35XX_RATE(1100000000, 275, 6, 0),
+       PLL_35XX_RATE(1000000000, 125, 3, 0),
+       PLL_35XX_RATE(900000000, 150, 4, 0),
+       PLL_35XX_RATE(800000000, 100, 3, 0),
+       PLL_35XX_RATE(700000000, 175, 3, 1),
+       PLL_35XX_RATE(600000000, 200, 4, 1),
+       PLL_35XX_RATE(500000000, 125, 3, 1),
+       PLL_35XX_RATE(400000000, 100, 3, 1),
+       PLL_35XX_RATE(300000000, 200, 4, 2),
+       PLL_35XX_RATE(200000000, 100, 3, 2),
+};
+
 static struct samsung_pll_clock exynos5250_plls[nr_plls] __initdata = {
-       [apll] = PLL_A(pll_35xx, fout_apll, "fout_apll", "fin_pll", APLL_LOCK,
-               APLL_CON0, "fout_apll", NULL),
-       [mpll] = PLL_A(pll_35xx, fout_mpll, "fout_mpll", "fin_pll", MPLL_LOCK,
-               MPLL_CON0, "fout_mpll", NULL),
-       [bpll] = PLL(pll_35xx, fout_bpll, "fout_bpll", "fin_pll", BPLL_LOCK,
+       [apll] = PLL_A(pll_35xx, CLK_FOUT_APLL, "fout_apll", "fin_pll",
+               APLL_LOCK, APLL_CON0, "fout_apll", NULL),
+       [mpll] = PLL_A(pll_35xx, CLK_FOUT_MPLL, "fout_mpll", "fin_pll",
+               MPLL_LOCK, MPLL_CON0, "fout_mpll", NULL),
+       [bpll] = PLL(pll_35xx, CLK_FOUT_BPLL, "fout_bpll", "fin_pll", BPLL_LOCK,
                BPLL_CON0, NULL),
-       [gpll] = PLL(pll_35xx, fout_gpll, "fout_gpll", "fin_pll", GPLL_LOCK,
+       [gpll] = PLL(pll_35xx, CLK_FOUT_GPLL, "fout_gpll", "fin_pll", GPLL_LOCK,
                GPLL_CON0, NULL),
-       [cpll] = PLL(pll_35xx, fout_cpll, "fout_cpll", "fin_pll", CPLL_LOCK,
+       [cpll] = PLL(pll_35xx, CLK_FOUT_CPLL, "fout_cpll", "fin_pll", CPLL_LOCK,
                CPLL_CON0, NULL),
-       [epll] = PLL(pll_36xx, fout_epll, "fout_epll", "fin_pll", EPLL_LOCK,
+       [epll] = PLL(pll_36xx, CLK_FOUT_EPLL, "fout_epll", "fin_pll", EPLL_LOCK,
                EPLL_CON0, NULL),
-       [vpll] = PLL(pll_36xx, fout_vpll, "fout_vpll", "mout_vpllsrc",
+       [vpll] = PLL(pll_36xx, CLK_FOUT_VPLL, "fout_vpll", "mout_vpllsrc",
                VPLL_LOCK, VPLL_CON0, NULL),
 };
 
@@ -556,7 +655,7 @@ static void __init exynos5250_clk_init(struct device_node *np)
                panic("%s: unable to determine soc\n", __func__);
        }
 
-       samsung_clk_init(np, reg_base, nr_clks,
+       samsung_clk_init(np, reg_base, CLK_NR_CLKS,
                        exynos5250_clk_regs, ARRAY_SIZE(exynos5250_clk_regs),
                        NULL, 0);
        samsung_clk_of_register_fixed_ext(exynos5250_fixed_rate_ext_clks,
@@ -565,8 +664,10 @@ static void __init exynos5250_clk_init(struct device_node *np)
        samsung_clk_register_mux(exynos5250_pll_pmux_clks,
                                ARRAY_SIZE(exynos5250_pll_pmux_clks));
 
-       if (_get_rate("fin_pll") == 24 * MHZ)
+       if (_get_rate("fin_pll") == 24 * MHZ) {
                exynos5250_plls[epll].rate_table = epll_24mhz_tbl;
+               exynos5250_plls[apll].rate_table = apll_24mhz_tbl;
+       }
 
        if (_get_rate("mout_vpllsrc") == 24 * MHZ)
                exynos5250_plls[vpll].rate_table =  vpll_24mhz_tbl;
@@ -585,6 +686,6 @@ static void __init exynos5250_clk_init(struct device_node *np)
                        ARRAY_SIZE(exynos5250_gate_clks));
 
        pr_info("Exynos5250: clock setup completed, armclk=%ld\n",
-                       _get_rate("armclk"));
+                       _get_rate("div_arm2"));
 }
 CLK_OF_DECLARE(exynos5250_clk, "samsung,exynos5250-clock", exynos5250_clk_init);
index 48c4a9350b91172d6222ed74b95862e223f802ad..ab4f2f7d88ef5ec5369ed28f7e11e0496148c8e2 100644 (file)
@@ -10,6 +10,7 @@
  * Common Clock Framework support for Exynos5420 SoC.
 */
 
+#include <dt-bindings/clock/exynos5420.h>
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/clk-provider.h>
@@ -107,48 +108,6 @@ enum exynos5420_plls {
        nr_plls                 /* number of PLLs */
 };
 
-enum exynos5420_clks {
-       none,
-
-       /* core clocks */
-       fin_pll,  fout_apll, fout_cpll, fout_dpll, fout_epll, fout_rpll,
-       fout_ipll, fout_spll, fout_vpll, fout_mpll, fout_bpll, fout_kpll,
-
-       /* gate for special clocks (sclk) */
-       sclk_uart0 = 128, sclk_uart1, sclk_uart2, sclk_uart3, sclk_mmc0,
-       sclk_mmc1, sclk_mmc2, sclk_spi0, sclk_spi1, sclk_spi2, sclk_i2s1,
-       sclk_i2s2, sclk_pcm1, sclk_pcm2, sclk_spdif, sclk_hdmi, sclk_pixel,
-       sclk_dp1, sclk_mipi1, sclk_fimd1, sclk_maudio0, sclk_maupcm0,
-       sclk_usbd300, sclk_usbd301, sclk_usbphy300, sclk_usbphy301, sclk_unipro,
-       sclk_pwm, sclk_gscl_wa, sclk_gscl_wb, sclk_hdmiphy,
-
-       /* gate clocks */
-       aclk66_peric = 256, uart0, uart1, uart2, uart3, i2c0, i2c1, i2c2, i2c3,
-       i2c4, i2c5, i2c6, i2c7, i2c_hdmi, tsadc, spi0, spi1, spi2, keyif, i2s1,
-       i2s2, pcm1, pcm2, pwm, spdif, i2c8, i2c9, i2c10, aclk66_psgen = 300,
-       chipid, sysreg, tzpc0, tzpc1, tzpc2, tzpc3, tzpc4, tzpc5, tzpc6, tzpc7,
-       tzpc8, tzpc9, hdmi_cec, seckey, mct, wdt, rtc, tmu, tmu_gpu,
-       pclk66_gpio = 330, aclk200_fsys2 = 350, mmc0, mmc1, mmc2, sromc, ufs,
-       aclk200_fsys = 360, tsi, pdma0, pdma1, rtic, usbh20, usbd300, usbd301,
-       aclk400_mscl = 380, mscl0, mscl1, mscl2, smmu_mscl0, smmu_mscl1,
-       smmu_mscl2, aclk333 = 400, mfc, smmu_mfcl, smmu_mfcr,
-       aclk200_disp1 = 410, dsim1, dp1, hdmi, aclk300_disp1 = 420, fimd1,
-       smmu_fimd1, aclk166 = 430, mixer, aclk266 = 440, rotator, mdma1,
-       smmu_rotator, smmu_mdma1, aclk300_jpeg = 450, jpeg, jpeg2, smmu_jpeg,
-       aclk300_gscl = 460, smmu_gscl0, smmu_gscl1, gscl_wa, gscl_wb, gscl0,
-       gscl1, clk_3aa, aclk266_g2d = 470, sss, slim_sss, mdma0,
-       aclk333_g2d = 480, g2d, aclk333_432_gscl = 490, smmu_3aa, smmu_fimcl0,
-       smmu_fimcl1, smmu_fimcl3, fimc_lite3, aclk_g3d = 500, g3d, smmu_mixer,
-
-       /* mux clocks */
-       mout_hdmi = 640,
-
-       /* divider clocks */
-       dout_pixel = 768,
-
-       nr_clks,
-};
-
 /*
  * list of controller registers to be saved and restored during a
  * suspend/resume cycle.
@@ -298,225 +257,226 @@ PNAME(maudio0_p)        = { "fin_pll", "maudio_clk", "sclk_dpll", "sclk_mpll",
 
 /* fixed rate clocks generated outside the soc */
 static struct samsung_fixed_rate_clock exynos5420_fixed_rate_ext_clks[] __initdata = {
-       FRATE(fin_pll, "fin_pll", NULL, CLK_IS_ROOT, 0),
+       FRATE(CLK_FIN_PLL, "fin_pll", NULL, CLK_IS_ROOT, 0),
 };
 
 /* fixed rate clocks generated inside the soc */
 static struct samsung_fixed_rate_clock exynos5420_fixed_rate_clks[] __initdata = {
-       FRATE(sclk_hdmiphy, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 24000000),
-       FRATE(none, "sclk_pwi", NULL, CLK_IS_ROOT, 24000000),
-       FRATE(none, "sclk_usbh20", NULL, CLK_IS_ROOT, 48000000),
-       FRATE(none, "mphy_refclk_ixtal24", NULL, CLK_IS_ROOT, 48000000),
-       FRATE(none, "sclk_usbh20_scan_clk", NULL, CLK_IS_ROOT, 480000000),
+       FRATE(CLK_SCLK_HDMIPHY, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 24000000),
+       FRATE(0, "sclk_pwi", NULL, CLK_IS_ROOT, 24000000),
+       FRATE(0, "sclk_usbh20", NULL, CLK_IS_ROOT, 48000000),
+       FRATE(0, "mphy_refclk_ixtal24", NULL, CLK_IS_ROOT, 48000000),
+       FRATE(0, "sclk_usbh20_scan_clk", NULL, CLK_IS_ROOT, 480000000),
 };
 
 static struct samsung_fixed_factor_clock exynos5420_fixed_factor_clks[] __initdata = {
-       FFACTOR(none, "sclk_hsic_12m", "fin_pll", 1, 2, 0),
+       FFACTOR(0, "sclk_hsic_12m", "fin_pll", 1, 2, 0),
 };
 
 static struct samsung_mux_clock exynos5420_mux_clks[] __initdata = {
-       MUX(none, "mout_mspll_kfc", mspll_cpu_p, SRC_TOP7, 8, 2),
-       MUX(none, "mout_mspll_cpu", mspll_cpu_p, SRC_TOP7, 12, 2),
-       MUX(none, "mout_apll", apll_p, SRC_CPU, 0, 1),
-       MUX(none, "mout_cpu", cpu_p, SRC_CPU, 16, 1),
-       MUX(none, "mout_kpll", kpll_p, SRC_KFC, 0, 1),
-       MUX(none, "mout_cpu_kfc", kfc_p, SRC_KFC, 16, 1),
+       MUX(0, "mout_mspll_kfc", mspll_cpu_p, SRC_TOP7, 8, 2),
+       MUX(0, "mout_mspll_cpu", mspll_cpu_p, SRC_TOP7, 12, 2),
+       MUX(0, "mout_apll", apll_p, SRC_CPU, 0, 1),
+       MUX(0, "mout_cpu", cpu_p, SRC_CPU, 16, 1),
+       MUX(0, "mout_kpll", kpll_p, SRC_KFC, 0, 1),
+       MUX(0, "mout_cpu_kfc", kfc_p, SRC_KFC, 16, 1),
 
-       MUX(none, "sclk_bpll", bpll_p, SRC_CDREX, 0, 1),
+       MUX(0, "sclk_bpll", bpll_p, SRC_CDREX, 0, 1),
 
-       MUX_A(none, "mout_aclk400_mscl", group1_p,
+       MUX_A(0, "mout_aclk400_mscl", group1_p,
                        SRC_TOP0, 4, 2, "aclk400_mscl"),
-       MUX(none, "mout_aclk200", group1_p, SRC_TOP0, 8, 2),
-       MUX(none, "mout_aclk200_fsys2", group1_p, SRC_TOP0, 12, 2),
-       MUX(none, "mout_aclk200_fsys", group1_p, SRC_TOP0, 28, 2),
-
-       MUX(none, "mout_aclk333_432_gscl", group4_p, SRC_TOP1, 0, 2),
-       MUX(none, "mout_aclk66", group1_p, SRC_TOP1, 8, 2),
-       MUX(none, "mout_aclk266", group1_p, SRC_TOP1, 20, 2),
-       MUX(none, "mout_aclk166", group1_p, SRC_TOP1, 24, 2),
-       MUX(none, "mout_aclk333", group1_p, SRC_TOP1, 28, 2),
-
-       MUX(none, "mout_aclk333_g2d", group1_p, SRC_TOP2, 8, 2),
-       MUX(none, "mout_aclk266_g2d", group1_p, SRC_TOP2, 12, 2),
-       MUX(none, "mout_aclk_g3d", group5_p, SRC_TOP2, 16, 1),
-       MUX(none, "mout_aclk300_jpeg", group1_p, SRC_TOP2, 20, 2),
-       MUX(none, "mout_aclk300_disp1", group1_p, SRC_TOP2, 24, 2),
-       MUX(none, "mout_aclk300_gscl", group1_p, SRC_TOP2, 28, 2),
-
-       MUX(none, "mout_user_aclk400_mscl", user_aclk400_mscl_p,
+       MUX(0, "mout_aclk200", group1_p, SRC_TOP0, 8, 2),
+       MUX(0, "mout_aclk200_fsys2", group1_p, SRC_TOP0, 12, 2),
+       MUX(0, "mout_aclk200_fsys", group1_p, SRC_TOP0, 28, 2),
+
+       MUX(0, "mout_aclk333_432_gscl", group4_p, SRC_TOP1, 0, 2),
+       MUX(0, "mout_aclk66", group1_p, SRC_TOP1, 8, 2),
+       MUX(0, "mout_aclk266", group1_p, SRC_TOP1, 20, 2),
+       MUX(0, "mout_aclk166", group1_p, SRC_TOP1, 24, 2),
+       MUX(0, "mout_aclk333", group1_p, SRC_TOP1, 28, 2),
+
+       MUX(0, "mout_aclk333_g2d", group1_p, SRC_TOP2, 8, 2),
+       MUX(0, "mout_aclk266_g2d", group1_p, SRC_TOP2, 12, 2),
+       MUX(0, "mout_aclk_g3d", group5_p, SRC_TOP2, 16, 1),
+       MUX(0, "mout_aclk300_jpeg", group1_p, SRC_TOP2, 20, 2),
+       MUX(0, "mout_aclk300_disp1", group1_p, SRC_TOP2, 24, 2),
+       MUX(0, "mout_aclk300_gscl", group1_p, SRC_TOP2, 28, 2),
+
+       MUX(0, "mout_user_aclk400_mscl", user_aclk400_mscl_p,
                        SRC_TOP3, 4, 1),
-       MUX_A(none, "mout_aclk200_disp1", aclk200_disp1_p,
+       MUX_A(0, "mout_aclk200_disp1", aclk200_disp1_p,
                        SRC_TOP3, 8, 1, "aclk200_disp1"),
-       MUX(none, "mout_user_aclk200_fsys2", user_aclk200_fsys2_p,
+       MUX(0, "mout_user_aclk200_fsys2", user_aclk200_fsys2_p,
                        SRC_TOP3, 12, 1),
-       MUX(none, "mout_user_aclk200_fsys", user_aclk200_fsys_p,
+       MUX(0, "mout_user_aclk200_fsys", user_aclk200_fsys_p,
                        SRC_TOP3, 28, 1),
 
-       MUX(none, "mout_user_aclk333_432_gscl", user_aclk333_432_gscl_p,
+       MUX(0, "mout_user_aclk333_432_gscl", user_aclk333_432_gscl_p,
                        SRC_TOP4, 0, 1),
-       MUX(none, "mout_aclk66_peric", aclk66_peric_p, SRC_TOP4, 8, 1),
-       MUX(none, "mout_user_aclk266", user_aclk266_p, SRC_TOP4, 20, 1),
-       MUX(none, "mout_user_aclk166", user_aclk166_p, SRC_TOP4, 24, 1),
-       MUX(none, "mout_user_aclk333", user_aclk333_p, SRC_TOP4, 28, 1),
-
-       MUX(none, "mout_aclk66_psgen", aclk66_peric_p, SRC_TOP5, 4, 1),
-       MUX(none, "mout_user_aclk333_g2d", user_aclk333_g2d_p, SRC_TOP5, 8, 1),
-       MUX(none, "mout_user_aclk266_g2d", user_aclk266_g2d_p, SRC_TOP5, 12, 1),
-       MUX_A(none, "mout_user_aclk_g3d", user_aclk_g3d_p,
+       MUX(0, "mout_aclk66_peric", aclk66_peric_p, SRC_TOP4, 8, 1),
+       MUX(0, "mout_user_aclk266", user_aclk266_p, SRC_TOP4, 20, 1),
+       MUX(0, "mout_user_aclk166", user_aclk166_p, SRC_TOP4, 24, 1),
+       MUX(0, "mout_user_aclk333", user_aclk333_p, SRC_TOP4, 28, 1),
+
+       MUX(0, "mout_aclk66_psgen", aclk66_peric_p, SRC_TOP5, 4, 1),
+       MUX(0, "mout_user_aclk333_g2d", user_aclk333_g2d_p, SRC_TOP5, 8, 1),
+       MUX(0, "mout_user_aclk266_g2d", user_aclk266_g2d_p, SRC_TOP5, 12, 1),
+       MUX_A(0, "mout_user_aclk_g3d", user_aclk_g3d_p,
                        SRC_TOP5, 16, 1, "aclkg3d"),
-       MUX(none, "mout_user_aclk300_jpeg", user_aclk300_jpeg_p,
+       MUX(0, "mout_user_aclk300_jpeg", user_aclk300_jpeg_p,
                        SRC_TOP5, 20, 1),
-       MUX(none, "mout_user_aclk300_disp1", user_aclk300_disp1_p,
+       MUX(0, "mout_user_aclk300_disp1", user_aclk300_disp1_p,
                        SRC_TOP5, 24, 1),
-       MUX(none, "mout_user_aclk300_gscl", user_aclk300_gscl_p,
+       MUX(0, "mout_user_aclk300_gscl", user_aclk300_gscl_p,
                        SRC_TOP5, 28, 1),
 
-       MUX(none, "sclk_mpll", mpll_p, SRC_TOP6, 0, 1),
-       MUX(none, "sclk_vpll", vpll_p, SRC_TOP6, 4, 1),
-       MUX(none, "sclk_spll", spll_p, SRC_TOP6, 8, 1),
-       MUX(none, "sclk_ipll", ipll_p, SRC_TOP6, 12, 1),
-       MUX(none, "sclk_rpll", rpll_p, SRC_TOP6, 16, 1),
-       MUX(none, "sclk_epll", epll_p, SRC_TOP6, 20, 1),
-       MUX(none, "sclk_dpll", dpll_p, SRC_TOP6, 24, 1),
-       MUX(none, "sclk_cpll", cpll_p, SRC_TOP6, 28, 1),
-
-       MUX(none, "mout_sw_aclk400_mscl", sw_aclk400_mscl_p, SRC_TOP10, 4, 1),
-       MUX(none, "mout_sw_aclk200", sw_aclk200_p, SRC_TOP10, 8, 1),
-       MUX(none, "mout_sw_aclk200_fsys2", sw_aclk200_fsys2_p,
+       MUX(0, "sclk_mpll", mpll_p, SRC_TOP6, 0, 1),
+       MUX(0, "sclk_vpll", vpll_p, SRC_TOP6, 4, 1),
+       MUX(0, "sclk_spll", spll_p, SRC_TOP6, 8, 1),
+       MUX(0, "sclk_ipll", ipll_p, SRC_TOP6, 12, 1),
+       MUX(0, "sclk_rpll", rpll_p, SRC_TOP6, 16, 1),
+       MUX(0, "sclk_epll", epll_p, SRC_TOP6, 20, 1),
+       MUX(0, "sclk_dpll", dpll_p, SRC_TOP6, 24, 1),
+       MUX(0, "sclk_cpll", cpll_p, SRC_TOP6, 28, 1),
+
+       MUX(0, "mout_sw_aclk400_mscl", sw_aclk400_mscl_p, SRC_TOP10, 4, 1),
+       MUX(0, "mout_sw_aclk200", sw_aclk200_p, SRC_TOP10, 8, 1),
+       MUX(0, "mout_sw_aclk200_fsys2", sw_aclk200_fsys2_p,
                        SRC_TOP10, 12, 1),
-       MUX(none, "mout_sw_aclk200_fsys", sw_aclk200_fsys_p, SRC_TOP10, 28, 1),
+       MUX(0, "mout_sw_aclk200_fsys", sw_aclk200_fsys_p, SRC_TOP10, 28, 1),
 
-       MUX(none, "mout_sw_aclk333_432_gscl", sw_aclk333_432_gscl_p,
+       MUX(0, "mout_sw_aclk333_432_gscl", sw_aclk333_432_gscl_p,
                        SRC_TOP11, 0, 1),
-       MUX(none, "mout_sw_aclk66", sw_aclk66_p, SRC_TOP11, 8, 1),
-       MUX(none, "mout_sw_aclk266", sw_aclk266_p, SRC_TOP11, 20, 1),
-       MUX(none, "mout_sw_aclk166", sw_aclk166_p, SRC_TOP11, 24, 1),
-       MUX(none, "mout_sw_aclk333", sw_aclk333_p, SRC_TOP11, 28, 1),
-
-       MUX(none, "mout_sw_aclk333_g2d", sw_aclk333_g2d_p, SRC_TOP12, 8, 1),
-       MUX(none, "mout_sw_aclk266_g2d", sw_aclk266_g2d_p, SRC_TOP12, 12, 1),
-       MUX(none, "mout_sw_aclk_g3d", sw_aclk_g3d_p, SRC_TOP12, 16, 1),
-       MUX(none, "mout_sw_aclk300_jpeg", sw_aclk300_jpeg_p, SRC_TOP12, 20, 1),
-       MUX(none, "mout_sw_aclk300_disp1", sw_aclk300_disp1_p,
+       MUX(0, "mout_sw_aclk66", sw_aclk66_p, SRC_TOP11, 8, 1),
+       MUX(0, "mout_sw_aclk266", sw_aclk266_p, SRC_TOP11, 20, 1),
+       MUX(0, "mout_sw_aclk166", sw_aclk166_p, SRC_TOP11, 24, 1),
+       MUX(0, "mout_sw_aclk333", sw_aclk333_p, SRC_TOP11, 28, 1),
+
+       MUX(0, "mout_sw_aclk333_g2d", sw_aclk333_g2d_p, SRC_TOP12, 8, 1),
+       MUX(0, "mout_sw_aclk266_g2d", sw_aclk266_g2d_p, SRC_TOP12, 12, 1),
+       MUX(0, "mout_sw_aclk_g3d", sw_aclk_g3d_p, SRC_TOP12, 16, 1),
+       MUX(0, "mout_sw_aclk300_jpeg", sw_aclk300_jpeg_p, SRC_TOP12, 20, 1),
+       MUX(0, "mout_sw_aclk300_disp1", sw_aclk300_disp1_p,
                        SRC_TOP12, 24, 1),
-       MUX(none, "mout_sw_aclk300_gscl", sw_aclk300_gscl_p, SRC_TOP12, 28, 1),
+       MUX(0, "mout_sw_aclk300_gscl", sw_aclk300_gscl_p, SRC_TOP12, 28, 1),
 
        /* DISP1 Block */
-       MUX(none, "mout_fimd1", group3_p, SRC_DISP10, 4, 1),
-       MUX(none, "mout_mipi1", group2_p, SRC_DISP10, 16, 3),
-       MUX(none, "mout_dp1", group2_p, SRC_DISP10, 20, 3),
-       MUX(none, "mout_pixel", group2_p, SRC_DISP10, 24, 3),
-       MUX(mout_hdmi, "mout_hdmi", hdmi_p, SRC_DISP10, 28, 1),
+       MUX(0, "mout_fimd1", group3_p, SRC_DISP10, 4, 1),
+       MUX(0, "mout_mipi1", group2_p, SRC_DISP10, 16, 3),
+       MUX(0, "mout_dp1", group2_p, SRC_DISP10, 20, 3),
+       MUX(0, "mout_pixel", group2_p, SRC_DISP10, 24, 3),
+       MUX(CLK_MOUT_HDMI, "mout_hdmi", hdmi_p, SRC_DISP10, 28, 1),
 
        /* MAU Block */
-       MUX(none, "mout_maudio0", maudio0_p, SRC_MAU, 28, 3),
+       MUX(0, "mout_maudio0", maudio0_p, SRC_MAU, 28, 3),
 
        /* FSYS Block */
-       MUX(none, "mout_usbd301", group2_p, SRC_FSYS, 4, 3),
-       MUX(none, "mout_mmc0", group2_p, SRC_FSYS, 8, 3),
-       MUX(none, "mout_mmc1", group2_p, SRC_FSYS, 12, 3),
-       MUX(none, "mout_mmc2", group2_p, SRC_FSYS, 16, 3),
-       MUX(none, "mout_usbd300", group2_p, SRC_FSYS, 20, 3),
-       MUX(none, "mout_unipro", group2_p, SRC_FSYS, 24, 3),
+       MUX(0, "mout_usbd301", group2_p, SRC_FSYS, 4, 3),
+       MUX(0, "mout_mmc0", group2_p, SRC_FSYS, 8, 3),
+       MUX(0, "mout_mmc1", group2_p, SRC_FSYS, 12, 3),
+       MUX(0, "mout_mmc2", group2_p, SRC_FSYS, 16, 3),
+       MUX(0, "mout_usbd300", group2_p, SRC_FSYS, 20, 3),
+       MUX(0, "mout_unipro", group2_p, SRC_FSYS, 24, 3),
 
        /* PERIC Block */
-       MUX(none, "mout_uart0", group2_p, SRC_PERIC0, 4, 3),
-       MUX(none, "mout_uart1", group2_p, SRC_PERIC0, 8, 3),
-       MUX(none, "mout_uart2", group2_p, SRC_PERIC0, 12, 3),
-       MUX(none, "mout_uart3", group2_p, SRC_PERIC0, 16, 3),
-       MUX(none, "mout_pwm", group2_p, SRC_PERIC0, 24, 3),
-       MUX(none, "mout_spdif", spdif_p, SRC_PERIC0, 28, 3),
-       MUX(none, "mout_audio0", audio0_p, SRC_PERIC1, 8, 3),
-       MUX(none, "mout_audio1", audio1_p, SRC_PERIC1, 12, 3),
-       MUX(none, "mout_audio2", audio2_p, SRC_PERIC1, 16, 3),
-       MUX(none, "mout_spi0", group2_p, SRC_PERIC1, 20, 3),
-       MUX(none, "mout_spi1", group2_p, SRC_PERIC1, 24, 3),
-       MUX(none, "mout_spi2", group2_p, SRC_PERIC1, 28, 3),
+       MUX(0, "mout_uart0", group2_p, SRC_PERIC0, 4, 3),
+       MUX(0, "mout_uart1", group2_p, SRC_PERIC0, 8, 3),
+       MUX(0, "mout_uart2", group2_p, SRC_PERIC0, 12, 3),
+       MUX(0, "mout_uart3", group2_p, SRC_PERIC0, 16, 3),
+       MUX(0, "mout_pwm", group2_p, SRC_PERIC0, 24, 3),
+       MUX(0, "mout_spdif", spdif_p, SRC_PERIC0, 28, 3),
+       MUX(0, "mout_audio0", audio0_p, SRC_PERIC1, 8, 3),
+       MUX(0, "mout_audio1", audio1_p, SRC_PERIC1, 12, 3),
+       MUX(0, "mout_audio2", audio2_p, SRC_PERIC1, 16, 3),
+       MUX(0, "mout_spi0", group2_p, SRC_PERIC1, 20, 3),
+       MUX(0, "mout_spi1", group2_p, SRC_PERIC1, 24, 3),
+       MUX(0, "mout_spi2", group2_p, SRC_PERIC1, 28, 3),
 };
 
 static struct samsung_div_clock exynos5420_div_clks[] __initdata = {
-       DIV(none, "div_arm", "mout_cpu", DIV_CPU0, 0, 3),
-       DIV(none, "sclk_apll", "mout_apll", DIV_CPU0, 24, 3),
-       DIV(none, "armclk2", "div_arm", DIV_CPU0, 28, 3),
-       DIV(none, "div_kfc", "mout_cpu_kfc", DIV_KFC0, 0, 3),
-       DIV(none, "sclk_kpll", "mout_kpll", DIV_KFC0, 24, 3),
-
-       DIV(none, "dout_aclk400_mscl", "mout_aclk400_mscl", DIV_TOP0, 4, 3),
-       DIV(none, "dout_aclk200", "mout_aclk200", DIV_TOP0, 8, 3),
-       DIV(none, "dout_aclk200_fsys2", "mout_aclk200_fsys2", DIV_TOP0, 12, 3),
-       DIV(none, "dout_pclk200_fsys", "mout_pclk200_fsys", DIV_TOP0, 24, 3),
-       DIV(none, "dout_aclk200_fsys", "mout_aclk200_fsys", DIV_TOP0, 28, 3),
-
-       DIV(none, "dout_aclk333_432_gscl", "mout_aclk333_432_gscl",
+       DIV(0, "div_arm", "mout_cpu", DIV_CPU0, 0, 3),
+       DIV(0, "sclk_apll", "mout_apll", DIV_CPU0, 24, 3),
+       DIV(0, "armclk2", "div_arm", DIV_CPU0, 28, 3),
+       DIV(0, "div_kfc", "mout_cpu_kfc", DIV_KFC0, 0, 3),
+       DIV(0, "sclk_kpll", "mout_kpll", DIV_KFC0, 24, 3),
+
+       DIV(0, "dout_aclk400_mscl", "mout_aclk400_mscl", DIV_TOP0, 4, 3),
+       DIV(0, "dout_aclk200", "mout_aclk200", DIV_TOP0, 8, 3),
+       DIV(0, "dout_aclk200_fsys2", "mout_aclk200_fsys2", DIV_TOP0, 12, 3),
+       DIV(0, "dout_pclk200_fsys", "mout_pclk200_fsys", DIV_TOP0, 24, 3),
+       DIV(0, "dout_aclk200_fsys", "mout_aclk200_fsys", DIV_TOP0, 28, 3),
+
+       DIV(0, "dout_aclk333_432_gscl", "mout_aclk333_432_gscl",
                        DIV_TOP1, 0, 3),
-       DIV(none, "dout_aclk66", "mout_aclk66", DIV_TOP1, 8, 6),
-       DIV(none, "dout_aclk266", "mout_aclk266", DIV_TOP1, 20, 3),
-       DIV(none, "dout_aclk166", "mout_aclk166", DIV_TOP1, 24, 3),
-       DIV(none, "dout_aclk333", "mout_aclk333", DIV_TOP1, 28, 3),
-
-       DIV(none, "dout_aclk333_g2d", "mout_aclk333_g2d", DIV_TOP2, 8, 3),
-       DIV(none, "dout_aclk266_g2d", "mout_aclk266_g2d", DIV_TOP2, 12, 3),
-       DIV(none, "dout_aclk_g3d", "mout_aclk_g3d", DIV_TOP2, 16, 3),
-       DIV(none, "dout_aclk300_jpeg", "mout_aclk300_jpeg", DIV_TOP2, 20, 3),
-       DIV_A(none, "dout_aclk300_disp1", "mout_aclk300_disp1",
+       DIV(0, "dout_aclk66", "mout_aclk66", DIV_TOP1, 8, 6),
+       DIV(0, "dout_aclk266", "mout_aclk266", DIV_TOP1, 20, 3),
+       DIV(0, "dout_aclk166", "mout_aclk166", DIV_TOP1, 24, 3),
+       DIV(0, "dout_aclk333", "mout_aclk333", DIV_TOP1, 28, 3),
+
+       DIV(0, "dout_aclk333_g2d", "mout_aclk333_g2d", DIV_TOP2, 8, 3),
+       DIV(0, "dout_aclk266_g2d", "mout_aclk266_g2d", DIV_TOP2, 12, 3),
+       DIV(0, "dout_aclk_g3d", "mout_aclk_g3d", DIV_TOP2, 16, 3),
+       DIV(0, "dout_aclk300_jpeg", "mout_aclk300_jpeg", DIV_TOP2, 20, 3),
+       DIV_A(0, "dout_aclk300_disp1", "mout_aclk300_disp1",
                        DIV_TOP2, 24, 3, "aclk300_disp1"),
-       DIV(none, "dout_aclk300_gscl", "mout_aclk300_gscl", DIV_TOP2, 28, 3),
+       DIV(0, "dout_aclk300_gscl", "mout_aclk300_gscl", DIV_TOP2, 28, 3),
 
        /* DISP1 Block */
-       DIV(none, "dout_fimd1", "mout_fimd1", DIV_DISP10, 0, 4),
-       DIV(none, "dout_mipi1", "mout_mipi1", DIV_DISP10, 16, 8),
-       DIV(none, "dout_dp1", "mout_dp1", DIV_DISP10, 24, 4),
-       DIV(dout_pixel, "dout_hdmi_pixel", "mout_pixel", DIV_DISP10, 28, 4),
+       DIV(0, "dout_fimd1", "mout_fimd1", DIV_DISP10, 0, 4),
+       DIV(0, "dout_mipi1", "mout_mipi1", DIV_DISP10, 16, 8),
+       DIV(0, "dout_dp1", "mout_dp1", DIV_DISP10, 24, 4),
+       DIV(CLK_DOUT_PIXEL, "dout_hdmi_pixel", "mout_pixel", DIV_DISP10, 28, 4),
 
        /* Audio Block */
-       DIV(none, "dout_maudio0", "mout_maudio0", DIV_MAU, 20, 4),
-       DIV(none, "dout_maupcm0", "dout_maudio0", DIV_MAU, 24, 8),
+       DIV(0, "dout_maudio0", "mout_maudio0", DIV_MAU, 20, 4),
+       DIV(0, "dout_maupcm0", "dout_maudio0", DIV_MAU, 24, 8),
 
        /* USB3.0 */
-       DIV(none, "dout_usbphy301", "mout_usbd301", DIV_FSYS0, 12, 4),
-       DIV(none, "dout_usbphy300", "mout_usbd300", DIV_FSYS0, 16, 4),
-       DIV(none, "dout_usbd301", "mout_usbd301", DIV_FSYS0, 20, 4),
-       DIV(none, "dout_usbd300", "mout_usbd300", DIV_FSYS0, 24, 4),
+       DIV(0, "dout_usbphy301", "mout_usbd301", DIV_FSYS0, 12, 4),
+       DIV(0, "dout_usbphy300", "mout_usbd300", DIV_FSYS0, 16, 4),
+       DIV(0, "dout_usbd301", "mout_usbd301", DIV_FSYS0, 20, 4),
+       DIV(0, "dout_usbd300", "mout_usbd300", DIV_FSYS0, 24, 4),
 
        /* MMC */
-       DIV(none, "dout_mmc0", "mout_mmc0", DIV_FSYS1, 0, 10),
-       DIV(none, "dout_mmc1", "mout_mmc1", DIV_FSYS1, 10, 10),
-       DIV(none, "dout_mmc2", "mout_mmc2", DIV_FSYS1, 20, 10),
+       DIV(0, "dout_mmc0", "mout_mmc0", DIV_FSYS1, 0, 10),
+       DIV(0, "dout_mmc1", "mout_mmc1", DIV_FSYS1, 10, 10),
+       DIV(0, "dout_mmc2", "mout_mmc2", DIV_FSYS1, 20, 10),
 
-       DIV(none, "dout_unipro", "mout_unipro", DIV_FSYS2, 24, 8),
+       DIV(0, "dout_unipro", "mout_unipro", DIV_FSYS2, 24, 8),
 
        /* UART and PWM */
-       DIV(none, "dout_uart0", "mout_uart0", DIV_PERIC0, 8, 4),
-       DIV(none, "dout_uart1", "mout_uart1", DIV_PERIC0, 12, 4),
-       DIV(none, "dout_uart2", "mout_uart2", DIV_PERIC0, 16, 4),
-       DIV(none, "dout_uart3", "mout_uart3", DIV_PERIC0, 20, 4),
-       DIV(none, "dout_pwm", "mout_pwm", DIV_PERIC0, 28, 4),
+       DIV(0, "dout_uart0", "mout_uart0", DIV_PERIC0, 8, 4),
+       DIV(0, "dout_uart1", "mout_uart1", DIV_PERIC0, 12, 4),
+       DIV(0, "dout_uart2", "mout_uart2", DIV_PERIC0, 16, 4),
+       DIV(0, "dout_uart3", "mout_uart3", DIV_PERIC0, 20, 4),
+       DIV(0, "dout_pwm", "mout_pwm", DIV_PERIC0, 28, 4),
 
        /* SPI */
-       DIV(none, "dout_spi0", "mout_spi0", DIV_PERIC1, 20, 4),
-       DIV(none, "dout_spi1", "mout_spi1", DIV_PERIC1, 24, 4),
-       DIV(none, "dout_spi2", "mout_spi2", DIV_PERIC1, 28, 4),
+       DIV(0, "dout_spi0", "mout_spi0", DIV_PERIC1, 20, 4),
+       DIV(0, "dout_spi1", "mout_spi1", DIV_PERIC1, 24, 4),
+       DIV(0, "dout_spi2", "mout_spi2", DIV_PERIC1, 28, 4),
 
        /* PCM */
-       DIV(none, "dout_pcm1", "dout_audio1", DIV_PERIC2, 16, 8),
-       DIV(none, "dout_pcm2", "dout_audio2", DIV_PERIC2, 24, 8),
+       DIV(0, "dout_pcm1", "dout_audio1", DIV_PERIC2, 16, 8),
+       DIV(0, "dout_pcm2", "dout_audio2", DIV_PERIC2, 24, 8),
 
        /* Audio - I2S */
-       DIV(none, "dout_i2s1", "dout_audio1", DIV_PERIC3, 6, 6),
-       DIV(none, "dout_i2s2", "dout_audio2", DIV_PERIC3, 12, 6),
-       DIV(none, "dout_audio0", "mout_audio0", DIV_PERIC3, 20, 4),
-       DIV(none, "dout_audio1", "mout_audio1", DIV_PERIC3, 24, 4),
-       DIV(none, "dout_audio2", "mout_audio2", DIV_PERIC3, 28, 4),
+       DIV(0, "dout_i2s1", "dout_audio1", DIV_PERIC3, 6, 6),
+       DIV(0, "dout_i2s2", "dout_audio2", DIV_PERIC3, 12, 6),
+       DIV(0, "dout_audio0", "mout_audio0", DIV_PERIC3, 20, 4),
+       DIV(0, "dout_audio1", "mout_audio1", DIV_PERIC3, 24, 4),
+       DIV(0, "dout_audio2", "mout_audio2", DIV_PERIC3, 28, 4),
 
        /* SPI Pre-Ratio */
-       DIV(none, "dout_pre_spi0", "dout_spi0", DIV_PERIC4, 8, 8),
-       DIV(none, "dout_pre_spi1", "dout_spi1", DIV_PERIC4, 16, 8),
-       DIV(none, "dout_pre_spi2", "dout_spi2", DIV_PERIC4, 24, 8),
+       DIV(0, "dout_pre_spi0", "dout_spi0", DIV_PERIC4, 8, 8),
+       DIV(0, "dout_pre_spi1", "dout_spi1", DIV_PERIC4, 16, 8),
+       DIV(0, "dout_pre_spi2", "dout_spi2", DIV_PERIC4, 24, 8),
 };
 
 static struct samsung_gate_clock exynos5420_gate_clks[] __initdata = {
        /* TODO: Re-verify the CG bits for all the gate clocks */
-       GATE_A(mct, "pclk_st", "aclk66_psgen", GATE_BUS_PERIS1, 2, 0, 0, "mct"),
+       GATE_A(CLK_MCT, "pclk_st", "aclk66_psgen", GATE_BUS_PERIS1, 2, 0, 0,
+               "mct"),
 
        GATE(0, "aclk200_fsys", "mout_user_aclk200_fsys",
                        GATE_BUS_FSYS0, 9, CLK_IGNORE_UNUSED, 0),
@@ -545,217 +505,227 @@ static struct samsung_gate_clock exynos5420_gate_clks[] __initdata = {
                        GATE_BUS_TOP, 15, CLK_IGNORE_UNUSED, 0),
 
        /* sclk */
-       GATE(sclk_uart0, "sclk_uart0", "dout_uart0",
+       GATE(CLK_SCLK_UART0, "sclk_uart0", "dout_uart0",
                GATE_TOP_SCLK_PERIC, 0, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart1, "sclk_uart1", "dout_uart1",
+       GATE(CLK_SCLK_UART1, "sclk_uart1", "dout_uart1",
                GATE_TOP_SCLK_PERIC, 1, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart2, "sclk_uart2", "dout_uart2",
+       GATE(CLK_SCLK_UART2, "sclk_uart2", "dout_uart2",
                GATE_TOP_SCLK_PERIC, 2, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_uart3, "sclk_uart3", "dout_uart3",
+       GATE(CLK_SCLK_UART3, "sclk_uart3", "dout_uart3",
                GATE_TOP_SCLK_PERIC, 3, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spi0, "sclk_spi0", "dout_pre_spi0",
+       GATE(CLK_SCLK_SPI0, "sclk_spi0", "dout_pre_spi0",
                GATE_TOP_SCLK_PERIC, 6, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spi1, "sclk_spi1", "dout_pre_spi1",
+       GATE(CLK_SCLK_SPI1, "sclk_spi1", "dout_pre_spi1",
                GATE_TOP_SCLK_PERIC, 7, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spi2, "sclk_spi2", "dout_pre_spi2",
+       GATE(CLK_SCLK_SPI2, "sclk_spi2", "dout_pre_spi2",
                GATE_TOP_SCLK_PERIC, 8, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_spdif, "sclk_spdif", "mout_spdif",
+       GATE(CLK_SCLK_SPDIF, "sclk_spdif", "mout_spdif",
                GATE_TOP_SCLK_PERIC, 9, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_pwm, "sclk_pwm", "dout_pwm",
+       GATE(CLK_SCLK_PWM, "sclk_pwm", "dout_pwm",
                GATE_TOP_SCLK_PERIC, 11, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_pcm1, "sclk_pcm1", "dout_pcm1",
+       GATE(CLK_SCLK_PCM1, "sclk_pcm1", "dout_pcm1",
                GATE_TOP_SCLK_PERIC, 15, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_pcm2, "sclk_pcm2", "dout_pcm2",
+       GATE(CLK_SCLK_PCM2, "sclk_pcm2", "dout_pcm2",
                GATE_TOP_SCLK_PERIC, 16, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_i2s1, "sclk_i2s1", "dout_i2s1",
+       GATE(CLK_SCLK_I2S1, "sclk_i2s1", "dout_i2s1",
                GATE_TOP_SCLK_PERIC, 17, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_i2s2, "sclk_i2s2", "dout_i2s2",
+       GATE(CLK_SCLK_I2S2, "sclk_i2s2", "dout_i2s2",
                GATE_TOP_SCLK_PERIC, 18, CLK_SET_RATE_PARENT, 0),
 
-       GATE(sclk_mmc0, "sclk_mmc0", "dout_mmc0",
+       GATE(CLK_SCLK_MMC0, "sclk_mmc0", "dout_mmc0",
                GATE_TOP_SCLK_FSYS, 0, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mmc1, "sclk_mmc1", "dout_mmc1",
+       GATE(CLK_SCLK_MMC1, "sclk_mmc1", "dout_mmc1",
                GATE_TOP_SCLK_FSYS, 1, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mmc2, "sclk_mmc2", "dout_mmc2",
+       GATE(CLK_SCLK_MMC2, "sclk_mmc2", "dout_mmc2",
                GATE_TOP_SCLK_FSYS, 2, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_usbphy301, "sclk_usbphy301", "dout_usbphy301",
+       GATE(CLK_SCLK_USBPHY301, "sclk_usbphy301", "dout_usbphy301",
                GATE_TOP_SCLK_FSYS, 7, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_usbphy300, "sclk_usbphy300", "dout_usbphy300",
+       GATE(CLK_SCLK_USBPHY300, "sclk_usbphy300", "dout_usbphy300",
                GATE_TOP_SCLK_FSYS, 8, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_usbd300, "sclk_usbd300", "dout_usbd300",
+       GATE(CLK_SCLK_USBD300, "sclk_usbd300", "dout_usbd300",
                GATE_TOP_SCLK_FSYS, 9, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_usbd301, "sclk_usbd301", "dout_usbd301",
+       GATE(CLK_SCLK_USBD301, "sclk_usbd301", "dout_usbd301",
                GATE_TOP_SCLK_FSYS, 10, CLK_SET_RATE_PARENT, 0),
 
-       GATE(sclk_usbd301, "sclk_unipro", "dout_unipro",
+       GATE(CLK_SCLK_USBD301, "sclk_unipro", "dout_unipro",
                SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0),
 
-       GATE(sclk_gscl_wa, "sclk_gscl_wa", "aclK333_432_gscl",
+       GATE(CLK_SCLK_GSCL_WA, "sclk_gscl_wa", "aclK333_432_gscl",
                GATE_TOP_SCLK_GSCL, 6, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_gscl_wb, "sclk_gscl_wb", "aclk333_432_gscl",
+       GATE(CLK_SCLK_GSCL_WB, "sclk_gscl_wb", "aclk333_432_gscl",
                GATE_TOP_SCLK_GSCL, 7, CLK_SET_RATE_PARENT, 0),
 
        /* Display */
-       GATE(sclk_fimd1, "sclk_fimd1", "dout_fimd1",
+       GATE(CLK_SCLK_FIMD1, "sclk_fimd1", "dout_fimd1",
                GATE_TOP_SCLK_DISP1, 0, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_mipi1, "sclk_mipi1", "dout_mipi1",
+       GATE(CLK_SCLK_MIPI1, "sclk_mipi1", "dout_mipi1",
                GATE_TOP_SCLK_DISP1, 3, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_hdmi, "sclk_hdmi", "mout_hdmi",
+       GATE(CLK_SCLK_HDMI, "sclk_hdmi", "mout_hdmi",
                GATE_TOP_SCLK_DISP1, 9, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_pixel, "sclk_pixel", "dout_hdmi_pixel",
+       GATE(CLK_SCLK_PIXEL, "sclk_pixel", "dout_hdmi_pixel",
                GATE_TOP_SCLK_DISP1, 10, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_dp1, "sclk_dp1", "dout_dp1",
+       GATE(CLK_SCLK_DP1, "sclk_dp1", "dout_dp1",
                GATE_TOP_SCLK_DISP1, 20, CLK_SET_RATE_PARENT, 0),
 
        /* Maudio Block */
-       GATE(sclk_maudio0, "sclk_maudio0", "dout_maudio0",
+       GATE(CLK_SCLK_MAUDIO0, "sclk_maudio0", "dout_maudio0",
                GATE_TOP_SCLK_MAU, 0, CLK_SET_RATE_PARENT, 0),
-       GATE(sclk_maupcm0, "sclk_maupcm0", "dout_maupcm0",
+       GATE(CLK_SCLK_MAUPCM0, "sclk_maupcm0", "dout_maupcm0",
                GATE_TOP_SCLK_MAU, 1, CLK_SET_RATE_PARENT, 0),
        /* FSYS */
-       GATE(tsi, "tsi", "aclk200_fsys", GATE_BUS_FSYS0, 0, 0, 0),
-       GATE(pdma0, "pdma0", "aclk200_fsys", GATE_BUS_FSYS0, 1, 0, 0),
-       GATE(pdma1, "pdma1", "aclk200_fsys", GATE_BUS_FSYS0, 2, 0, 0),
-       GATE(ufs, "ufs", "aclk200_fsys2", GATE_BUS_FSYS0, 3, 0, 0),
-       GATE(rtic, "rtic", "aclk200_fsys", GATE_BUS_FSYS0, 5, 0, 0),
-       GATE(mmc0, "mmc0", "aclk200_fsys2", GATE_BUS_FSYS0, 12, 0, 0),
-       GATE(mmc1, "mmc1", "aclk200_fsys2", GATE_BUS_FSYS0, 13, 0, 0),
-       GATE(mmc2, "mmc2", "aclk200_fsys2", GATE_BUS_FSYS0, 14, 0, 0),
-       GATE(sromc, "sromc", "aclk200_fsys2",
+       GATE(CLK_TSI, "tsi", "aclk200_fsys", GATE_BUS_FSYS0, 0, 0, 0),
+       GATE(CLK_PDMA0, "pdma0", "aclk200_fsys", GATE_BUS_FSYS0, 1, 0, 0),
+       GATE(CLK_PDMA1, "pdma1", "aclk200_fsys", GATE_BUS_FSYS0, 2, 0, 0),
+       GATE(CLK_UFS, "ufs", "aclk200_fsys2", GATE_BUS_FSYS0, 3, 0, 0),
+       GATE(CLK_RTIC, "rtic", "aclk200_fsys", GATE_BUS_FSYS0, 5, 0, 0),
+       GATE(CLK_MMC0, "mmc0", "aclk200_fsys2", GATE_BUS_FSYS0, 12, 0, 0),
+       GATE(CLK_MMC1, "mmc1", "aclk200_fsys2", GATE_BUS_FSYS0, 13, 0, 0),
+       GATE(CLK_MMC2, "mmc2", "aclk200_fsys2", GATE_BUS_FSYS0, 14, 0, 0),
+       GATE(CLK_SROMC, "sromc", "aclk200_fsys2",
                        GATE_BUS_FSYS0, 19, CLK_IGNORE_UNUSED, 0),
-       GATE(usbh20, "usbh20", "aclk200_fsys", GATE_BUS_FSYS0, 20, 0, 0),
-       GATE(usbd300, "usbd300", "aclk200_fsys", GATE_BUS_FSYS0, 21, 0, 0),
-       GATE(usbd301, "usbd301", "aclk200_fsys", GATE_BUS_FSYS0, 28, 0, 0),
+       GATE(CLK_USBH20, "usbh20", "aclk200_fsys", GATE_BUS_FSYS0, 20, 0, 0),
+       GATE(CLK_USBD300, "usbd300", "aclk200_fsys", GATE_BUS_FSYS0, 21, 0, 0),
+       GATE(CLK_USBD301, "usbd301", "aclk200_fsys", GATE_BUS_FSYS0, 28, 0, 0),
 
        /* UART */
-       GATE(uart0, "uart0", "aclk66_peric", GATE_BUS_PERIC, 4, 0, 0),
-       GATE(uart1, "uart1", "aclk66_peric", GATE_BUS_PERIC, 5, 0, 0),
-       GATE_A(uart2, "uart2", "aclk66_peric",
+       GATE(CLK_UART0, "uart0", "aclk66_peric", GATE_BUS_PERIC, 4, 0, 0),
+       GATE(CLK_UART1, "uart1", "aclk66_peric", GATE_BUS_PERIC, 5, 0, 0),
+       GATE_A(CLK_UART2, "uart2", "aclk66_peric",
                GATE_BUS_PERIC, 6, CLK_IGNORE_UNUSED, 0, "uart2"),
-       GATE(uart3, "uart3", "aclk66_peric", GATE_BUS_PERIC, 7, 0, 0),
+       GATE(CLK_UART3, "uart3", "aclk66_peric", GATE_BUS_PERIC, 7, 0, 0),
        /* I2C */
-       GATE(i2c0, "i2c0", "aclk66_peric", GATE_BUS_PERIC, 9, 0, 0),
-       GATE(i2c1, "i2c1", "aclk66_peric", GATE_BUS_PERIC, 10, 0, 0),
-       GATE(i2c2, "i2c2", "aclk66_peric", GATE_BUS_PERIC, 11, 0, 0),
-       GATE(i2c3, "i2c3", "aclk66_peric", GATE_BUS_PERIC, 12, 0, 0),
-       GATE(i2c4, "i2c4", "aclk66_peric", GATE_BUS_PERIC, 13, 0, 0),
-       GATE(i2c5, "i2c5", "aclk66_peric", GATE_BUS_PERIC, 14, 0, 0),
-       GATE(i2c6, "i2c6", "aclk66_peric", GATE_BUS_PERIC, 15, 0, 0),
-       GATE(i2c7, "i2c7", "aclk66_peric", GATE_BUS_PERIC, 16, 0, 0),
-       GATE(i2c_hdmi, "i2c_hdmi", "aclk66_peric", GATE_BUS_PERIC, 17, 0, 0),
-       GATE(tsadc, "tsadc", "aclk66_peric", GATE_BUS_PERIC, 18, 0, 0),
+       GATE(CLK_I2C0, "i2c0", "aclk66_peric", GATE_BUS_PERIC, 9, 0, 0),
+       GATE(CLK_I2C1, "i2c1", "aclk66_peric", GATE_BUS_PERIC, 10, 0, 0),
+       GATE(CLK_I2C2, "i2c2", "aclk66_peric", GATE_BUS_PERIC, 11, 0, 0),
+       GATE(CLK_I2C3, "i2c3", "aclk66_peric", GATE_BUS_PERIC, 12, 0, 0),
+       GATE(CLK_I2C4, "i2c4", "aclk66_peric", GATE_BUS_PERIC, 13, 0, 0),
+       GATE(CLK_I2C5, "i2c5", "aclk66_peric", GATE_BUS_PERIC, 14, 0, 0),
+       GATE(CLK_I2C6, "i2c6", "aclk66_peric", GATE_BUS_PERIC, 15, 0, 0),
+       GATE(CLK_I2C7, "i2c7", "aclk66_peric", GATE_BUS_PERIC, 16, 0, 0),
+       GATE(CLK_I2C_HDMI, "i2c_hdmi", "aclk66_peric", GATE_BUS_PERIC, 17, 0,
+               0),
+       GATE(CLK_TSADC, "tsadc", "aclk66_peric", GATE_BUS_PERIC, 18, 0, 0),
        /* SPI */
-       GATE(spi0, "spi0", "aclk66_peric", GATE_BUS_PERIC, 19, 0, 0),
-       GATE(spi1, "spi1", "aclk66_peric", GATE_BUS_PERIC, 20, 0, 0),
-       GATE(spi2, "spi2", "aclk66_peric", GATE_BUS_PERIC, 21, 0, 0),
-       GATE(keyif, "keyif", "aclk66_peric", GATE_BUS_PERIC, 22, 0, 0),
+       GATE(CLK_SPI0, "spi0", "aclk66_peric", GATE_BUS_PERIC, 19, 0, 0),
+       GATE(CLK_SPI1, "spi1", "aclk66_peric", GATE_BUS_PERIC, 20, 0, 0),
+       GATE(CLK_SPI2, "spi2", "aclk66_peric", GATE_BUS_PERIC, 21, 0, 0),
+       GATE(CLK_KEYIF, "keyif", "aclk66_peric", GATE_BUS_PERIC, 22, 0, 0),
        /* I2S */
-       GATE(i2s1, "i2s1", "aclk66_peric", GATE_BUS_PERIC, 23, 0, 0),
-       GATE(i2s2, "i2s2", "aclk66_peric", GATE_BUS_PERIC, 24, 0, 0),
+       GATE(CLK_I2S1, "i2s1", "aclk66_peric", GATE_BUS_PERIC, 23, 0, 0),
+       GATE(CLK_I2S2, "i2s2", "aclk66_peric", GATE_BUS_PERIC, 24, 0, 0),
        /* PCM */
-       GATE(pcm1, "pcm1", "aclk66_peric", GATE_BUS_PERIC, 25, 0, 0),
-       GATE(pcm2, "pcm2", "aclk66_peric", GATE_BUS_PERIC, 26, 0, 0),
+       GATE(CLK_PCM1, "pcm1", "aclk66_peric", GATE_BUS_PERIC, 25, 0, 0),
+       GATE(CLK_PCM2, "pcm2", "aclk66_peric", GATE_BUS_PERIC, 26, 0, 0),
        /* PWM */
-       GATE(pwm, "pwm", "aclk66_peric", GATE_BUS_PERIC, 27, 0, 0),
+       GATE(CLK_PWM, "pwm", "aclk66_peric", GATE_BUS_PERIC, 27, 0, 0),
        /* SPDIF */
-       GATE(spdif, "spdif", "aclk66_peric", GATE_BUS_PERIC, 29, 0, 0),
+       GATE(CLK_SPDIF, "spdif", "aclk66_peric", GATE_BUS_PERIC, 29, 0, 0),
 
-       GATE(i2c8, "i2c8", "aclk66_peric", GATE_BUS_PERIC1, 0, 0, 0),
-       GATE(i2c9, "i2c9", "aclk66_peric", GATE_BUS_PERIC1, 1, 0, 0),
-       GATE(i2c10, "i2c10", "aclk66_peric", GATE_BUS_PERIC1, 2, 0, 0),
+       GATE(CLK_I2C8, "i2c8", "aclk66_peric", GATE_BUS_PERIC1, 0, 0, 0),
+       GATE(CLK_I2C9, "i2c9", "aclk66_peric", GATE_BUS_PERIC1, 1, 0, 0),
+       GATE(CLK_I2C10, "i2c10", "aclk66_peric", GATE_BUS_PERIC1, 2, 0, 0),
 
-       GATE(chipid, "chipid", "aclk66_psgen",
+       GATE(CLK_CHIPID, "chipid", "aclk66_psgen",
                        GATE_BUS_PERIS0, 12, CLK_IGNORE_UNUSED, 0),
-       GATE(sysreg, "sysreg", "aclk66_psgen",
+       GATE(CLK_SYSREG, "sysreg", "aclk66_psgen",
                        GATE_BUS_PERIS0, 13, CLK_IGNORE_UNUSED, 0),
-       GATE(tzpc0, "tzpc0", "aclk66_psgen", GATE_BUS_PERIS0, 18, 0, 0),
-       GATE(tzpc1, "tzpc1", "aclk66_psgen", GATE_BUS_PERIS0, 19, 0, 0),
-       GATE(tzpc2, "tzpc2", "aclk66_psgen", GATE_BUS_PERIS0, 20, 0, 0),
-       GATE(tzpc3, "tzpc3", "aclk66_psgen", GATE_BUS_PERIS0, 21, 0, 0),
-       GATE(tzpc4, "tzpc4", "aclk66_psgen", GATE_BUS_PERIS0, 22, 0, 0),
-       GATE(tzpc5, "tzpc5", "aclk66_psgen", GATE_BUS_PERIS0, 23, 0, 0),
-       GATE(tzpc6, "tzpc6", "aclk66_psgen", GATE_BUS_PERIS0, 24, 0, 0),
-       GATE(tzpc7, "tzpc7", "aclk66_psgen", GATE_BUS_PERIS0, 25, 0, 0),
-       GATE(tzpc8, "tzpc8", "aclk66_psgen", GATE_BUS_PERIS0, 26, 0, 0),
-       GATE(tzpc9, "tzpc9", "aclk66_psgen", GATE_BUS_PERIS0, 27, 0, 0),
-
-       GATE(hdmi_cec, "hdmi_cec", "aclk66_psgen", GATE_BUS_PERIS1, 0, 0, 0),
-       GATE(seckey, "seckey", "aclk66_psgen", GATE_BUS_PERIS1, 1, 0, 0),
-       GATE(wdt, "wdt", "aclk66_psgen", GATE_BUS_PERIS1, 3, 0, 0),
-       GATE(rtc, "rtc", "aclk66_psgen", GATE_BUS_PERIS1, 4, 0, 0),
-       GATE(tmu, "tmu", "aclk66_psgen", GATE_BUS_PERIS1, 5, 0, 0),
-       GATE(tmu_gpu, "tmu_gpu", "aclk66_psgen", GATE_BUS_PERIS1, 6, 0, 0),
-
-       GATE(gscl0, "gscl0", "aclk300_gscl", GATE_IP_GSCL0, 0, 0, 0),
-       GATE(gscl1, "gscl1", "aclk300_gscl", GATE_IP_GSCL0, 1, 0, 0),
-       GATE(clk_3aa, "clk_3aa", "aclk300_gscl", GATE_IP_GSCL0, 4, 0, 0),
-
-       GATE(smmu_3aa, "smmu_3aa", "aclk333_432_gscl", GATE_IP_GSCL1, 2, 0, 0),
-       GATE(smmu_fimcl0, "smmu_fimcl0", "aclk333_432_gscl",
+       GATE(CLK_TZPC0, "tzpc0", "aclk66_psgen", GATE_BUS_PERIS0, 18, 0, 0),
+       GATE(CLK_TZPC1, "tzpc1", "aclk66_psgen", GATE_BUS_PERIS0, 19, 0, 0),
+       GATE(CLK_TZPC2, "tzpc2", "aclk66_psgen", GATE_BUS_PERIS0, 20, 0, 0),
+       GATE(CLK_TZPC3, "tzpc3", "aclk66_psgen", GATE_BUS_PERIS0, 21, 0, 0),
+       GATE(CLK_TZPC4, "tzpc4", "aclk66_psgen", GATE_BUS_PERIS0, 22, 0, 0),
+       GATE(CLK_TZPC5, "tzpc5", "aclk66_psgen", GATE_BUS_PERIS0, 23, 0, 0),
+       GATE(CLK_TZPC6, "tzpc6", "aclk66_psgen", GATE_BUS_PERIS0, 24, 0, 0),
+       GATE(CLK_TZPC7, "tzpc7", "aclk66_psgen", GATE_BUS_PERIS0, 25, 0, 0),
+       GATE(CLK_TZPC8, "tzpc8", "aclk66_psgen", GATE_BUS_PERIS0, 26, 0, 0),
+       GATE(CLK_TZPC9, "tzpc9", "aclk66_psgen", GATE_BUS_PERIS0, 27, 0, 0),
+
+       GATE(CLK_HDMI_CEC, "hdmi_cec", "aclk66_psgen", GATE_BUS_PERIS1, 0, 0,
+               0),
+       GATE(CLK_SECKEY, "seckey", "aclk66_psgen", GATE_BUS_PERIS1, 1, 0, 0),
+       GATE(CLK_WDT, "wdt", "aclk66_psgen", GATE_BUS_PERIS1, 3, 0, 0),
+       GATE(CLK_RTC, "rtc", "aclk66_psgen", GATE_BUS_PERIS1, 4, 0, 0),
+       GATE(CLK_TMU, "tmu", "aclk66_psgen", GATE_BUS_PERIS1, 5, 0, 0),
+       GATE(CLK_TMU_GPU, "tmu_gpu", "aclk66_psgen", GATE_BUS_PERIS1, 6, 0, 0),
+
+       GATE(CLK_GSCL0, "gscl0", "aclk300_gscl", GATE_IP_GSCL0, 0, 0, 0),
+       GATE(CLK_GSCL1, "gscl1", "aclk300_gscl", GATE_IP_GSCL0, 1, 0, 0),
+       GATE(CLK_CLK_3AA, "clk_3aa", "aclk300_gscl", GATE_IP_GSCL0, 4, 0, 0),
+
+       GATE(CLK_SMMU_3AA, "smmu_3aa", "aclk333_432_gscl", GATE_IP_GSCL1, 2, 0,
+               0),
+       GATE(CLK_SMMU_FIMCL0, "smmu_fimcl0", "aclk333_432_gscl",
                        GATE_IP_GSCL1, 3, 0, 0),
-       GATE(smmu_fimcl1, "smmu_fimcl1", "aclk333_432_gscl",
+       GATE(CLK_SMMU_FIMCL1, "smmu_fimcl1", "aclk333_432_gscl",
                        GATE_IP_GSCL1, 4, 0, 0),
-       GATE(smmu_gscl0, "smmu_gscl0", "aclk300_gscl", GATE_IP_GSCL1, 6, 0, 0),
-       GATE(smmu_gscl1, "smmu_gscl1", "aclk300_gscl", GATE_IP_GSCL1, 7, 0, 0),
-       GATE(gscl_wa, "gscl_wa", "aclk300_gscl", GATE_IP_GSCL1, 12, 0, 0),
-       GATE(gscl_wb, "gscl_wb", "aclk300_gscl", GATE_IP_GSCL1, 13, 0, 0),
-       GATE(smmu_fimcl3, "smmu_fimcl3,", "aclk333_432_gscl",
+       GATE(CLK_SMMU_GSCL0, "smmu_gscl0", "aclk300_gscl", GATE_IP_GSCL1, 6, 0,
+               0),
+       GATE(CLK_SMMU_GSCL1, "smmu_gscl1", "aclk300_gscl", GATE_IP_GSCL1, 7, 0,
+               0),
+       GATE(CLK_GSCL_WA, "gscl_wa", "aclk300_gscl", GATE_IP_GSCL1, 12, 0, 0),
+       GATE(CLK_GSCL_WB, "gscl_wb", "aclk300_gscl", GATE_IP_GSCL1, 13, 0, 0),
+       GATE(CLK_SMMU_FIMCL3, "smmu_fimcl3,", "aclk333_432_gscl",
                        GATE_IP_GSCL1, 16, 0, 0),
-       GATE(fimc_lite3, "fimc_lite3", "aclk333_432_gscl",
+       GATE(CLK_FIMC_LITE3, "fimc_lite3", "aclk333_432_gscl",
                        GATE_IP_GSCL1, 17, 0, 0),
 
-       GATE(fimd1, "fimd1", "aclk300_disp1", GATE_IP_DISP1, 0, 0, 0),
-       GATE(dsim1, "dsim1", "aclk200_disp1", GATE_IP_DISP1, 3, 0, 0),
-       GATE(dp1, "dp1", "aclk200_disp1", GATE_IP_DISP1, 4, 0, 0),
-       GATE(mixer, "mixer", "aclk166", GATE_IP_DISP1, 5, 0, 0),
-       GATE(hdmi, "hdmi", "aclk200_disp1", GATE_IP_DISP1, 6, 0, 0),
-       GATE(smmu_fimd1, "smmu_fimd1", "aclk300_disp1", GATE_IP_DISP1, 8, 0, 0),
-
-       GATE(mfc, "mfc", "aclk333", GATE_IP_MFC, 0, 0, 0),
-       GATE(smmu_mfcl, "smmu_mfcl", "aclk333", GATE_IP_MFC, 1, 0, 0),
-       GATE(smmu_mfcr, "smmu_mfcr", "aclk333", GATE_IP_MFC, 2, 0, 0),
-
-       GATE(g3d, "g3d", "aclkg3d", GATE_IP_G3D, 9, 0, 0),
-
-       GATE(rotator, "rotator", "aclk266", GATE_IP_GEN, 1, 0, 0),
-       GATE(jpeg, "jpeg", "aclk300_jpeg", GATE_IP_GEN, 2, 0, 0),
-       GATE(jpeg2, "jpeg2", "aclk300_jpeg", GATE_IP_GEN, 3, 0, 0),
-       GATE(mdma1, "mdma1", "aclk266", GATE_IP_GEN, 4, 0, 0),
-       GATE(smmu_rotator, "smmu_rotator", "aclk266", GATE_IP_GEN, 6, 0, 0),
-       GATE(smmu_jpeg, "smmu_jpeg", "aclk300_jpeg", GATE_IP_GEN, 7, 0, 0),
-       GATE(smmu_mdma1, "smmu_mdma1", "aclk266", GATE_IP_GEN, 9, 0, 0),
-
-       GATE(mscl0, "mscl0", "aclk400_mscl", GATE_IP_MSCL, 0, 0, 0),
-       GATE(mscl1, "mscl1", "aclk400_mscl", GATE_IP_MSCL, 1, 0, 0),
-       GATE(mscl2, "mscl2", "aclk400_mscl", GATE_IP_MSCL, 2, 0, 0),
-       GATE(smmu_mscl0, "smmu_mscl0", "aclk400_mscl", GATE_IP_MSCL, 8, 0, 0),
-       GATE(smmu_mscl1, "smmu_mscl1", "aclk400_mscl", GATE_IP_MSCL, 9, 0, 0),
-       GATE(smmu_mscl2, "smmu_mscl2", "aclk400_mscl", GATE_IP_MSCL, 10, 0, 0),
-       GATE(smmu_mixer, "smmu_mixer", "aclk200_disp1", GATE_IP_DISP1, 9, 0, 0),
+       GATE(CLK_FIMD1, "fimd1", "aclk300_disp1", GATE_IP_DISP1, 0, 0, 0),
+       GATE(CLK_DSIM1, "dsim1", "aclk200_disp1", GATE_IP_DISP1, 3, 0, 0),
+       GATE(CLK_DP1, "dp1", "aclk200_disp1", GATE_IP_DISP1, 4, 0, 0),
+       GATE(CLK_MIXER, "mixer", "aclk166", GATE_IP_DISP1, 5, 0, 0),
+       GATE(CLK_HDMI, "hdmi", "aclk200_disp1", GATE_IP_DISP1, 6, 0, 0),
+       GATE(CLK_SMMU_FIMD1, "smmu_fimd1", "aclk300_disp1", GATE_IP_DISP1, 8, 0,
+               0),
+
+       GATE(CLK_MFC, "mfc", "aclk333", GATE_IP_MFC, 0, 0, 0),
+       GATE(CLK_SMMU_MFCL, "smmu_mfcl", "aclk333", GATE_IP_MFC, 1, 0, 0),
+       GATE(CLK_SMMU_MFCR, "smmu_mfcr", "aclk333", GATE_IP_MFC, 2, 0, 0),
+
+       GATE(CLK_G3D, "g3d", "aclkg3d", GATE_IP_G3D, 9, 0, 0),
+
+       GATE(CLK_ROTATOR, "rotator", "aclk266", GATE_IP_GEN, 1, 0, 0),
+       GATE(CLK_JPEG, "jpeg", "aclk300_jpeg", GATE_IP_GEN, 2, 0, 0),
+       GATE(CLK_JPEG2, "jpeg2", "aclk300_jpeg", GATE_IP_GEN, 3, 0, 0),
+       GATE(CLK_MDMA1, "mdma1", "aclk266", GATE_IP_GEN, 4, 0, 0),
+       GATE(CLK_SMMU_ROTATOR, "smmu_rotator", "aclk266", GATE_IP_GEN, 6, 0, 0),
+       GATE(CLK_SMMU_JPEG, "smmu_jpeg", "aclk300_jpeg", GATE_IP_GEN, 7, 0, 0),
+       GATE(CLK_SMMU_MDMA1, "smmu_mdma1", "aclk266", GATE_IP_GEN, 9, 0, 0),
+
+       GATE(CLK_MSCL0, "mscl0", "aclk400_mscl", GATE_IP_MSCL, 0, 0, 0),
+       GATE(CLK_MSCL1, "mscl1", "aclk400_mscl", GATE_IP_MSCL, 1, 0, 0),
+       GATE(CLK_MSCL2, "mscl2", "aclk400_mscl", GATE_IP_MSCL, 2, 0, 0),
+       GATE(CLK_SMMU_MSCL0, "smmu_mscl0", "aclk400_mscl", GATE_IP_MSCL, 8, 0,
+               0),
+       GATE(CLK_SMMU_MSCL1, "smmu_mscl1", "aclk400_mscl", GATE_IP_MSCL, 9, 0,
+               0),
+       GATE(CLK_SMMU_MSCL2, "smmu_mscl2", "aclk400_mscl", GATE_IP_MSCL, 10, 0,
+               0),
+       GATE(CLK_SMMU_MIXER, "smmu_mixer", "aclk200_disp1", GATE_IP_DISP1, 9, 0,
+               0),
 };
 
 static struct samsung_pll_clock exynos5420_plls[nr_plls] __initdata = {
-       [apll] = PLL(pll_2550, fout_apll, "fout_apll", "fin_pll", APLL_LOCK,
+       [apll] = PLL(pll_2550, CLK_FOUT_APLL, "fout_apll", "fin_pll", APLL_LOCK,
                APLL_CON0, NULL),
-       [cpll] = PLL(pll_2550, fout_mpll, "fout_mpll", "fin_pll", MPLL_LOCK,
-               MPLL_CON0, NULL),
-       [dpll] = PLL(pll_2550, fout_dpll, "fout_dpll", "fin_pll", DPLL_LOCK,
+       [cpll] = PLL(pll_2550, CLK_FOUT_CPLL, "fout_cpll", "fin_pll", CPLL_LOCK,
+               CPLL_CON0, NULL),
+       [dpll] = PLL(pll_2550, CLK_FOUT_DPLL, "fout_dpll", "fin_pll", DPLL_LOCK,
                DPLL_CON0, NULL),
-       [epll] = PLL(pll_2650, fout_epll, "fout_epll", "fin_pll", EPLL_LOCK,
+       [epll] = PLL(pll_2650, CLK_FOUT_EPLL, "fout_epll", "fin_pll", EPLL_LOCK,
                EPLL_CON0, NULL),
-       [rpll] = PLL(pll_2650, fout_rpll, "fout_rpll", "fin_pll", RPLL_LOCK,
+       [rpll] = PLL(pll_2650, CLK_FOUT_RPLL, "fout_rpll", "fin_pll", RPLL_LOCK,
                RPLL_CON0, NULL),
-       [ipll] = PLL(pll_2550, fout_ipll, "fout_ipll", "fin_pll", IPLL_LOCK,
+       [ipll] = PLL(pll_2550, CLK_FOUT_IPLL, "fout_ipll", "fin_pll", IPLL_LOCK,
                IPLL_CON0, NULL),
-       [spll] = PLL(pll_2550, fout_spll, "fout_spll", "fin_pll", SPLL_LOCK,
+       [spll] = PLL(pll_2550, CLK_FOUT_SPLL, "fout_spll", "fin_pll", SPLL_LOCK,
                SPLL_CON0, NULL),
-       [vpll] = PLL(pll_2550, fout_vpll, "fout_vpll", "fin_pll", VPLL_LOCK,
+       [vpll] = PLL(pll_2550, CLK_FOUT_VPLL, "fout_vpll", "fin_pll", VPLL_LOCK,
                VPLL_CON0, NULL),
-       [mpll] = PLL(pll_2550, fout_mpll, "fout_mpll", "fin_pll", MPLL_LOCK,
+       [mpll] = PLL(pll_2550, CLK_FOUT_MPLL, "fout_mpll", "fin_pll", MPLL_LOCK,
                MPLL_CON0, NULL),
-       [bpll] = PLL(pll_2550, fout_bpll, "fout_bpll", "fin_pll", BPLL_LOCK,
+       [bpll] = PLL(pll_2550, CLK_FOUT_BPLL, "fout_bpll", "fin_pll", BPLL_LOCK,
                BPLL_CON0, NULL),
-       [kpll] = PLL(pll_2550, fout_kpll, "fout_kpll", "fin_pll", KPLL_LOCK,
+       [kpll] = PLL(pll_2550, CLK_FOUT_KPLL, "fout_kpll", "fin_pll", KPLL_LOCK,
                KPLL_CON0, NULL),
 };
 
@@ -777,7 +747,7 @@ static void __init exynos5420_clk_init(struct device_node *np)
                panic("%s: unable to determine soc\n", __func__);
        }
 
-       samsung_clk_init(np, reg_base, nr_clks,
+       samsung_clk_init(np, reg_base, CLK_NR_CLKS,
                        exynos5420_clk_regs, ARRAY_SIZE(exynos5420_clk_regs),
                        NULL, 0);
        samsung_clk_of_register_fixed_ext(exynos5420_fixed_rate_ext_clks,
index f8658945bfd2a7a1d51f2dabb1d761ac4d58eae0..cbc15b56891d75740cb149c03e91a28f10b09f60 100644 (file)
@@ -9,6 +9,7 @@
  * Common Clock Framework support for Exynos5440 SoC.
 */
 
+#include <dt-bindings/clock/exynos5440.h>
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/clk-provider.h>
 #define CPU_CLK_STATUS         0xfc
 #define MISC_DOUT1             0x558
 
-/*
- * Let each supported clock get a unique id. This id is used to lookup the clock
- * for device tree based platforms.
- */
-enum exynos5440_clks {
-       none, xtal, arm_clk,
-
-       spi_baud = 16, pb0_250, pr0_250, pr1_250, b_250, b_125, b_200, sata,
-       usb, gmac0, cs250, pb0_250_o, pr0_250_o, pr1_250_o, b_250_o, b_125_o,
-       b_200_o, sata_o, usb_o, gmac0_o, cs250_o,
-
-       nr_clks,
-};
-
 /* parent clock name list */
 PNAME(mout_armclk_p)   = { "cplla", "cpllb" };
 PNAME(mout_spi_p)      = { "div125", "div200" };
 
 /* fixed rate clocks generated outside the soc */
 static struct samsung_fixed_rate_clock exynos5440_fixed_rate_ext_clks[] __initdata = {
-       FRATE(none, "xtal", NULL, CLK_IS_ROOT, 0),
+       FRATE(0, "xtal", NULL, CLK_IS_ROOT, 0),
 };
 
 /* fixed rate clocks */
 static struct samsung_fixed_rate_clock exynos5440_fixed_rate_clks[] __initdata = {
-       FRATE(none, "ppll", NULL, CLK_IS_ROOT, 1000000000),
-       FRATE(none, "usb_phy0", NULL, CLK_IS_ROOT, 60000000),
-       FRATE(none, "usb_phy1", NULL, CLK_IS_ROOT, 60000000),
-       FRATE(none, "usb_ohci12", NULL, CLK_IS_ROOT, 12000000),
-       FRATE(none, "usb_ohci48", NULL, CLK_IS_ROOT, 48000000),
+       FRATE(0, "ppll", NULL, CLK_IS_ROOT, 1000000000),
+       FRATE(0, "usb_phy0", NULL, CLK_IS_ROOT, 60000000),
+       FRATE(0, "usb_phy1", NULL, CLK_IS_ROOT, 60000000),
+       FRATE(0, "usb_ohci12", NULL, CLK_IS_ROOT, 12000000),
+       FRATE(0, "usb_ohci48", NULL, CLK_IS_ROOT, 48000000),
 };
 
 /* fixed factor clocks */
 static struct samsung_fixed_factor_clock exynos5440_fixed_factor_clks[] __initdata = {
-       FFACTOR(none, "div250", "ppll", 1, 4, 0),
-       FFACTOR(none, "div200", "ppll", 1, 5, 0),
-       FFACTOR(none, "div125", "div250", 1, 2, 0),
+       FFACTOR(0, "div250", "ppll", 1, 4, 0),
+       FFACTOR(0, "div200", "ppll", 1, 5, 0),
+       FFACTOR(0, "div125", "div250", 1, 2, 0),
 };
 
 /* mux clocks */
 static struct samsung_mux_clock exynos5440_mux_clks[] __initdata = {
-       MUX(none, "mout_spi", mout_spi_p, MISC_DOUT1, 5, 1),
-       MUX_A(arm_clk, "arm_clk", mout_armclk_p,
+       MUX(0, "mout_spi", mout_spi_p, MISC_DOUT1, 5, 1),
+       MUX_A(CLK_ARM_CLK, "arm_clk", mout_armclk_p,
                        CPU_CLK_STATUS, 0, 1, "armclk"),
 };
 
 /* divider clocks */
 static struct samsung_div_clock exynos5440_div_clks[] __initdata = {
-       DIV(spi_baud, "div_spi", "mout_spi", MISC_DOUT1, 3, 2),
+       DIV(CLK_SPI_BAUD, "div_spi", "mout_spi", MISC_DOUT1, 3, 2),
 };
 
 /* gate clocks */
 static struct samsung_gate_clock exynos5440_gate_clks[] __initdata = {
-       GATE(pb0_250, "pb0_250", "div250", CLKEN_OV_VAL, 3, 0, 0),
-       GATE(pr0_250, "pr0_250", "div250", CLKEN_OV_VAL, 4, 0, 0),
-       GATE(pr1_250, "pr1_250", "div250", CLKEN_OV_VAL, 5, 0, 0),
-       GATE(b_250, "b_250", "div250", CLKEN_OV_VAL, 9, 0, 0),
-       GATE(b_125, "b_125", "div125", CLKEN_OV_VAL, 10, 0, 0),
-       GATE(b_200, "b_200", "div200", CLKEN_OV_VAL, 11, 0, 0),
-       GATE(sata, "sata", "div200", CLKEN_OV_VAL, 12, 0, 0),
-       GATE(usb, "usb", "div200", CLKEN_OV_VAL, 13, 0, 0),
-       GATE(gmac0, "gmac0", "div200", CLKEN_OV_VAL, 14, 0, 0),
-       GATE(cs250, "cs250", "div250", CLKEN_OV_VAL, 19, 0, 0),
-       GATE(pb0_250_o, "pb0_250_o", "pb0_250", CLKEN_OV_VAL, 3, 0, 0),
-       GATE(pr0_250_o, "pr0_250_o", "pr0_250", CLKEN_OV_VAL, 4, 0, 0),
-       GATE(pr1_250_o, "pr1_250_o", "pr1_250", CLKEN_OV_VAL, 5, 0, 0),
-       GATE(b_250_o, "b_250_o", "b_250", CLKEN_OV_VAL, 9, 0, 0),
-       GATE(b_125_o, "b_125_o", "b_125", CLKEN_OV_VAL, 10, 0, 0),
-       GATE(b_200_o, "b_200_o", "b_200", CLKEN_OV_VAL, 11, 0, 0),
-       GATE(sata_o, "sata_o", "sata", CLKEN_OV_VAL, 12, 0, 0),
-       GATE(usb_o, "usb_o", "usb", CLKEN_OV_VAL, 13, 0, 0),
-       GATE(gmac0_o, "gmac0_o", "gmac", CLKEN_OV_VAL, 14, 0, 0),
-       GATE(cs250_o, "cs250_o", "cs250", CLKEN_OV_VAL, 19, 0, 0),
+       GATE(CLK_PB0_250, "pb0_250", "div250", CLKEN_OV_VAL, 3, 0, 0),
+       GATE(CLK_PR0_250, "pr0_250", "div250", CLKEN_OV_VAL, 4, 0, 0),
+       GATE(CLK_PR1_250, "pr1_250", "div250", CLKEN_OV_VAL, 5, 0, 0),
+       GATE(CLK_B_250, "b_250", "div250", CLKEN_OV_VAL, 9, 0, 0),
+       GATE(CLK_B_125, "b_125", "div125", CLKEN_OV_VAL, 10, 0, 0),
+       GATE(CLK_B_200, "b_200", "div200", CLKEN_OV_VAL, 11, 0, 0),
+       GATE(CLK_SATA, "sata", "div200", CLKEN_OV_VAL, 12, 0, 0),
+       GATE(CLK_USB, "usb", "div200", CLKEN_OV_VAL, 13, 0, 0),
+       GATE(CLK_GMAC0, "gmac0", "div200", CLKEN_OV_VAL, 14, 0, 0),
+       GATE(CLK_CS250, "cs250", "div250", CLKEN_OV_VAL, 19, 0, 0),
+       GATE(CLK_PB0_250_O, "pb0_250_o", "pb0_250", CLKEN_OV_VAL, 3, 0, 0),
+       GATE(CLK_PR0_250_O, "pr0_250_o", "pr0_250", CLKEN_OV_VAL, 4, 0, 0),
+       GATE(CLK_PR1_250_O, "pr1_250_o", "pr1_250", CLKEN_OV_VAL, 5, 0, 0),
+       GATE(CLK_B_250_O, "b_250_o", "b_250", CLKEN_OV_VAL, 9, 0, 0),
+       GATE(CLK_B_125_O, "b_125_o", "b_125", CLKEN_OV_VAL, 10, 0, 0),
+       GATE(CLK_B_200_O, "b_200_o", "b_200", CLKEN_OV_VAL, 11, 0, 0),
+       GATE(CLK_SATA_O, "sata_o", "sata", CLKEN_OV_VAL, 12, 0, 0),
+       GATE(CLK_USB_O, "usb_o", "usb", CLKEN_OV_VAL, 13, 0, 0),
+       GATE(CLK_GMAC0_O, "gmac0_o", "gmac", CLKEN_OV_VAL, 14, 0, 0),
+       GATE(CLK_CS250_O, "cs250_o", "cs250", CLKEN_OV_VAL, 19, 0, 0),
 };
 
 static struct of_device_id ext_clk_match[] __initdata = {
@@ -114,7 +101,7 @@ static void __init exynos5440_clk_init(struct device_node *np)
                return;
        }
 
-       samsung_clk_init(np, reg_base, nr_clks, NULL, 0, NULL, 0);
+       samsung_clk_init(np, reg_base, CLK_NR_CLKS, NULL, 0, NULL, 0);
        samsung_clk_of_register_fixed_ext(exynos5440_fixed_rate_ext_clks,
                ARRAY_SIZE(exynos5440_fixed_rate_ext_clks), ext_clk_match);
 
diff --git a/drivers/clk/shmobile/Makefile b/drivers/clk/shmobile/Makefile
new file mode 100644 (file)
index 0000000..9ecef14
--- /dev/null
@@ -0,0 +1,7 @@
+obj-$(CONFIG_ARCH_EMEV2)               += clk-emev2.o
+obj-$(CONFIG_ARCH_R8A7790)             += clk-rcar-gen2.o
+obj-$(CONFIG_ARCH_R8A7791)             += clk-rcar-gen2.o
+obj-$(CONFIG_ARCH_SHMOBILE_MULTI)      += clk-div6.o
+obj-$(CONFIG_ARCH_SHMOBILE_MULTI)      += clk-mstp.o
+# for emply built-in.o
+obj-n  := dummy
diff --git a/drivers/clk/shmobile/clk-div6.c b/drivers/clk/shmobile/clk-div6.c
new file mode 100644 (file)
index 0000000..aac4756
--- /dev/null
@@ -0,0 +1,185 @@
+/*
+ * r8a7790 Common Clock Framework support
+ *
+ * Copyright (C) 2013  Renesas Solutions Corp.
+ *
+ * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+
+#define CPG_DIV6_CKSTP         BIT(8)
+#define CPG_DIV6_DIV(d)                ((d) & 0x3f)
+#define CPG_DIV6_DIV_MASK      0x3f
+
+/**
+ * struct div6_clock - MSTP gating clock
+ * @hw: handle between common and hardware-specific interfaces
+ * @reg: IO-remapped register
+ * @div: divisor value (1-64)
+ */
+struct div6_clock {
+       struct clk_hw hw;
+       void __iomem *reg;
+       unsigned int div;
+};
+
+#define to_div6_clock(_hw) container_of(_hw, struct div6_clock, hw)
+
+static int cpg_div6_clock_enable(struct clk_hw *hw)
+{
+       struct div6_clock *clock = to_div6_clock(hw);
+
+       clk_writel(CPG_DIV6_DIV(clock->div - 1), clock->reg);
+
+       return 0;
+}
+
+static void cpg_div6_clock_disable(struct clk_hw *hw)
+{
+       struct div6_clock *clock = to_div6_clock(hw);
+
+       /* DIV6 clocks require the divisor field to be non-zero when stopping
+        * the clock.
+        */
+       clk_writel(CPG_DIV6_CKSTP | CPG_DIV6_DIV(CPG_DIV6_DIV_MASK),
+                  clock->reg);
+}
+
+static int cpg_div6_clock_is_enabled(struct clk_hw *hw)
+{
+       struct div6_clock *clock = to_div6_clock(hw);
+
+       return !(clk_readl(clock->reg) & CPG_DIV6_CKSTP);
+}
+
+static unsigned long cpg_div6_clock_recalc_rate(struct clk_hw *hw,
+                                               unsigned long parent_rate)
+{
+       struct div6_clock *clock = to_div6_clock(hw);
+       unsigned int div = (clk_readl(clock->reg) & CPG_DIV6_DIV_MASK) + 1;
+
+       return parent_rate / div;
+}
+
+static unsigned int cpg_div6_clock_calc_div(unsigned long rate,
+                                           unsigned long parent_rate)
+{
+       unsigned int div;
+
+       div = DIV_ROUND_CLOSEST(parent_rate, rate);
+       return clamp_t(unsigned int, div, 1, 64);
+}
+
+static long cpg_div6_clock_round_rate(struct clk_hw *hw, unsigned long rate,
+                                     unsigned long *parent_rate)
+{
+       unsigned int div = cpg_div6_clock_calc_div(rate, *parent_rate);
+
+       return *parent_rate / div;
+}
+
+static int cpg_div6_clock_set_rate(struct clk_hw *hw, unsigned long rate,
+                                  unsigned long parent_rate)
+{
+       struct div6_clock *clock = to_div6_clock(hw);
+       unsigned int div = cpg_div6_clock_calc_div(rate, parent_rate);
+
+       clock->div = div;
+
+       /* Only program the new divisor if the clock isn't stopped. */
+       if (!(clk_readl(clock->reg) & CPG_DIV6_CKSTP))
+               clk_writel(CPG_DIV6_DIV(clock->div - 1), clock->reg);
+
+       return 0;
+}
+
+static const struct clk_ops cpg_div6_clock_ops = {
+       .enable = cpg_div6_clock_enable,
+       .disable = cpg_div6_clock_disable,
+       .is_enabled = cpg_div6_clock_is_enabled,
+       .recalc_rate = cpg_div6_clock_recalc_rate,
+       .round_rate = cpg_div6_clock_round_rate,
+       .set_rate = cpg_div6_clock_set_rate,
+};
+
+static void __init cpg_div6_clock_init(struct device_node *np)
+{
+       struct clk_init_data init;
+       struct div6_clock *clock;
+       const char *parent_name;
+       const char *name;
+       struct clk *clk;
+       int ret;
+
+       clock = kzalloc(sizeof(*clock), GFP_KERNEL);
+       if (!clock) {
+               pr_err("%s: failed to allocate %s DIV6 clock\n",
+                      __func__, np->name);
+               return;
+       }
+
+       /* Remap the clock register and read the divisor. Disabling the
+        * clock overwrites the divisor, so we need to cache its value for the
+        * enable operation.
+        */
+       clock->reg = of_iomap(np, 0);
+       if (clock->reg == NULL) {
+               pr_err("%s: failed to map %s DIV6 clock register\n",
+                      __func__, np->name);
+               goto error;
+       }
+
+       clock->div = (clk_readl(clock->reg) & CPG_DIV6_DIV_MASK) + 1;
+
+       /* Parse the DT properties. */
+       ret = of_property_read_string(np, "clock-output-names", &name);
+       if (ret < 0) {
+               pr_err("%s: failed to get %s DIV6 clock output name\n",
+                      __func__, np->name);
+               goto error;
+       }
+
+       parent_name = of_clk_get_parent_name(np, 0);
+       if (parent_name == NULL) {
+               pr_err("%s: failed to get %s DIV6 clock parent name\n",
+                      __func__, np->name);
+               goto error;
+       }
+
+       /* Register the clock. */
+       init.name = name;
+       init.ops = &cpg_div6_clock_ops;
+       init.flags = CLK_IS_BASIC;
+       init.parent_names = &parent_name;
+       init.num_parents = 1;
+
+       clock->hw.init = &init;
+
+       clk = clk_register(NULL, &clock->hw);
+       if (IS_ERR(clk)) {
+               pr_err("%s: failed to register %s DIV6 clock (%ld)\n",
+                      __func__, np->name, PTR_ERR(clk));
+               goto error;
+       }
+
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+
+       return;
+
+error:
+       if (clock->reg)
+               iounmap(clock->reg);
+       kfree(clock);
+}
+CLK_OF_DECLARE(cpg_div6_clk, "renesas,cpg-div6-clock", cpg_div6_clock_init);
diff --git a/drivers/clk/shmobile/clk-emev2.c b/drivers/clk/shmobile/clk-emev2.c
new file mode 100644 (file)
index 0000000..6c7c929
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * EMMA Mobile EV2 common clock framework support
+ *
+ * Copyright (C) 2013 Takashi Yoshii <takashi.yoshii.ze@renesas.com>
+ * Copyright (C) 2012 Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+
+/* EMEV2 SMU registers */
+#define USIAU0_RSTCTRL 0x094
+#define USIBU1_RSTCTRL 0x0ac
+#define USIBU2_RSTCTRL 0x0b0
+#define USIBU3_RSTCTRL 0x0b4
+#define STI_RSTCTRL 0x124
+#define STI_CLKSEL 0x688
+
+static DEFINE_SPINLOCK(lock);
+
+/* not pretty, but hey */
+void __iomem *smu_base;
+
+static void __init emev2_smu_write(unsigned long value, int offs)
+{
+       BUG_ON(!smu_base || (offs >= PAGE_SIZE));
+       writel_relaxed(value, smu_base + offs);
+}
+
+static const struct of_device_id smu_id[] __initconst = {
+       { .compatible = "renesas,emev2-smu", },
+       {},
+};
+
+static void __init emev2_smu_init(void)
+{
+       struct device_node *np;
+
+       np = of_find_matching_node(NULL, smu_id);
+       BUG_ON(!np);
+       smu_base = of_iomap(np, 0);
+       BUG_ON(!smu_base);
+       of_node_put(np);
+
+       /* setup STI timer to run on 32.768 kHz and deassert reset */
+       emev2_smu_write(0, STI_CLKSEL);
+       emev2_smu_write(1, STI_RSTCTRL);
+
+       /* deassert reset for UART0->UART3 */
+       emev2_smu_write(2, USIAU0_RSTCTRL);
+       emev2_smu_write(2, USIBU1_RSTCTRL);
+       emev2_smu_write(2, USIBU2_RSTCTRL);
+       emev2_smu_write(2, USIBU3_RSTCTRL);
+}
+
+static void __init emev2_smu_clkdiv_init(struct device_node *np)
+{
+       u32 reg[2];
+       struct clk *clk;
+       const char *parent_name = of_clk_get_parent_name(np, 0);
+       if (WARN_ON(of_property_read_u32_array(np, "reg", reg, 2)))
+               return;
+       if (!smu_base)
+               emev2_smu_init();
+       clk = clk_register_divider(NULL, np->name, parent_name, 0,
+                                  smu_base + reg[0], reg[1], 8, 0, &lock);
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+       clk_register_clkdev(clk, np->name, NULL);
+       pr_debug("## %s %s %p\n", __func__, np->name, clk);
+}
+CLK_OF_DECLARE(emev2_smu_clkdiv, "renesas,emev2-smu-clkdiv",
+               emev2_smu_clkdiv_init);
+
+static void __init emev2_smu_gclk_init(struct device_node *np)
+{
+       u32 reg[2];
+       struct clk *clk;
+       const char *parent_name = of_clk_get_parent_name(np, 0);
+       if (WARN_ON(of_property_read_u32_array(np, "reg", reg, 2)))
+               return;
+       if (!smu_base)
+               emev2_smu_init();
+       clk = clk_register_gate(NULL, np->name, parent_name, 0,
+                               smu_base + reg[0], reg[1], 0, &lock);
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+       clk_register_clkdev(clk, np->name, NULL);
+       pr_debug("## %s %s %p\n", __func__, np->name, clk);
+}
+CLK_OF_DECLARE(emev2_smu_gclk, "renesas,emev2-smu-gclk", emev2_smu_gclk_init);
diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
new file mode 100644 (file)
index 0000000..42d5912
--- /dev/null
@@ -0,0 +1,233 @@
+/*
+ * R-Car MSTP clocks
+ *
+ * Copyright (C) 2013 Ideas On Board SPRL
+ *
+ * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/spinlock.h>
+
+/*
+ * MSTP clocks. We can't use standard gate clocks as we need to poll on the
+ * status register when enabling the clock.
+ */
+
+#define MSTP_MAX_CLOCKS                32
+
+/**
+ * struct mstp_clock_group - MSTP gating clocks group
+ *
+ * @data: clocks in this group
+ * @smstpcr: module stop control register
+ * @mstpsr: module stop status register (optional)
+ * @lock: protects writes to SMSTPCR
+ */
+struct mstp_clock_group {
+       struct clk_onecell_data data;
+       void __iomem *smstpcr;
+       void __iomem *mstpsr;
+       spinlock_t lock;
+};
+
+/**
+ * struct mstp_clock - MSTP gating clock
+ * @hw: handle between common and hardware-specific interfaces
+ * @bit_index: control bit index
+ * @group: MSTP clocks group
+ */
+struct mstp_clock {
+       struct clk_hw hw;
+       u32 bit_index;
+       struct mstp_clock_group *group;
+};
+
+#define to_mstp_clock(_hw) container_of(_hw, struct mstp_clock, hw)
+
+static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
+{
+       struct mstp_clock *clock = to_mstp_clock(hw);
+       struct mstp_clock_group *group = clock->group;
+       u32 bitmask = BIT(clock->bit_index);
+       unsigned long flags;
+       unsigned int i;
+       u32 value;
+
+       spin_lock_irqsave(&group->lock, flags);
+
+       value = clk_readl(group->smstpcr);
+       if (enable)
+               value &= ~bitmask;
+       else
+               value |= bitmask;
+       clk_writel(value, group->smstpcr);
+
+       spin_unlock_irqrestore(&group->lock, flags);
+
+       if (!enable || !group->mstpsr)
+               return 0;
+
+       for (i = 1000; i > 0; --i) {
+               if (!(clk_readl(group->mstpsr) & bitmask))
+                       break;
+               cpu_relax();
+       }
+
+       if (!i) {
+               pr_err("%s: failed to enable %p[%d]\n", __func__,
+                      group->smstpcr, clock->bit_index);
+               return -ETIMEDOUT;
+       }
+
+       return 0;
+}
+
+static int cpg_mstp_clock_enable(struct clk_hw *hw)
+{
+       return cpg_mstp_clock_endisable(hw, true);
+}
+
+static void cpg_mstp_clock_disable(struct clk_hw *hw)
+{
+       cpg_mstp_clock_endisable(hw, false);
+}
+
+static int cpg_mstp_clock_is_enabled(struct clk_hw *hw)
+{
+       struct mstp_clock *clock = to_mstp_clock(hw);
+       struct mstp_clock_group *group = clock->group;
+       u32 value;
+
+       if (group->mstpsr)
+               value = clk_readl(group->mstpsr);
+       else
+               value = clk_readl(group->smstpcr);
+
+       return !!(value & BIT(clock->bit_index));
+}
+
+static const struct clk_ops cpg_mstp_clock_ops = {
+       .enable = cpg_mstp_clock_enable,
+       .disable = cpg_mstp_clock_disable,
+       .is_enabled = cpg_mstp_clock_is_enabled,
+};
+
+static struct clk * __init
+cpg_mstp_clock_register(const char *name, const char *parent_name,
+                       unsigned int index, struct mstp_clock_group *group)
+{
+       struct clk_init_data init;
+       struct mstp_clock *clock;
+       struct clk *clk;
+
+       clock = kzalloc(sizeof(*clock), GFP_KERNEL);
+       if (!clock) {
+               pr_err("%s: failed to allocate MSTP clock.\n", __func__);
+               return ERR_PTR(-ENOMEM);
+       }
+
+       init.name = name;
+       init.ops = &cpg_mstp_clock_ops;
+       init.flags = CLK_IS_BASIC;
+       init.parent_names = &parent_name;
+       init.num_parents = 1;
+
+       clock->bit_index = index;
+       clock->group = group;
+       clock->hw.init = &init;
+
+       clk = clk_register(NULL, &clock->hw);
+
+       if (IS_ERR(clk))
+               kfree(clock);
+
+       return clk;
+}
+
+static void __init cpg_mstp_clocks_init(struct device_node *np)
+{
+       struct mstp_clock_group *group;
+       struct clk **clks;
+       unsigned int i;
+
+       group = kzalloc(sizeof(*group), GFP_KERNEL);
+       clks = kmalloc(MSTP_MAX_CLOCKS * sizeof(*clks), GFP_KERNEL);
+       if (group == NULL || clks == NULL) {
+               kfree(group);
+               kfree(clks);
+               pr_err("%s: failed to allocate group\n", __func__);
+               return;
+       }
+
+       spin_lock_init(&group->lock);
+       group->data.clks = clks;
+
+       group->smstpcr = of_iomap(np, 0);
+       group->mstpsr = of_iomap(np, 1);
+
+       if (group->smstpcr == NULL) {
+               pr_err("%s: failed to remap SMSTPCR\n", __func__);
+               kfree(group);
+               kfree(clks);
+               return;
+       }
+
+       for (i = 0; i < MSTP_MAX_CLOCKS; ++i)
+               clks[i] = ERR_PTR(-ENOENT);
+
+       for (i = 0; i < MSTP_MAX_CLOCKS; ++i) {
+               const char *parent_name;
+               const char *name;
+               u32 clkidx;
+               int ret;
+
+               /* Skip clocks with no name. */
+               ret = of_property_read_string_index(np, "clock-output-names",
+                                                   i, &name);
+               if (ret < 0 || strlen(name) == 0)
+                       continue;
+
+               parent_name = of_clk_get_parent_name(np, i);
+               ret = of_property_read_u32_index(np, "renesas,clock-indices", i,
+                                                &clkidx);
+               if (parent_name == NULL || ret < 0)
+                       break;
+
+               if (clkidx >= MSTP_MAX_CLOCKS) {
+                       pr_err("%s: invalid clock %s %s index %u)\n",
+                              __func__, np->name, name, clkidx);
+                       continue;
+               }
+
+               clks[clkidx] = cpg_mstp_clock_register(name, parent_name,
+                                                      clkidx, group);
+               if (!IS_ERR(clks[clkidx])) {
+                       group->data.clk_num = max(group->data.clk_num,
+                                                 clkidx + 1);
+                       /*
+                        * Register a clkdev to let board code retrieve the
+                        * clock by name and register aliases for non-DT
+                        * devices.
+                        *
+                        * FIXME: Remove this when all devices that require a
+                        * clock will be instantiated from DT.
+                        */
+                       clk_register_clkdev(clks[clkidx], name, NULL);
+               } else {
+                       pr_err("%s: failed to register %s %s clock (%ld)\n",
+                              __func__, np->name, name, PTR_ERR(clks[clkidx]));
+               }
+       }
+
+       of_clk_add_provider(np, of_clk_src_onecell_get, &group->data);
+}
+CLK_OF_DECLARE(cpg_mstp_clks, "renesas,cpg-mstp-clocks", cpg_mstp_clocks_init);
diff --git a/drivers/clk/shmobile/clk-rcar-gen2.c b/drivers/clk/shmobile/clk-rcar-gen2.c
new file mode 100644 (file)
index 0000000..a59ec21
--- /dev/null
@@ -0,0 +1,298 @@
+/*
+ * rcar_gen2 Core CPG Clocks
+ *
+ * Copyright (C) 2013  Ideas On Board SPRL
+ *
+ * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/clk/shmobile.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/math64.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/spinlock.h>
+
+struct rcar_gen2_cpg {
+       struct clk_onecell_data data;
+       spinlock_t lock;
+       void __iomem *reg;
+};
+
+#define CPG_SDCKCR                     0x00000074
+#define CPG_PLL0CR                     0x000000d8
+#define CPG_FRQCRC                     0x000000e0
+#define CPG_FRQCRC_ZFC_MASK            (0x1f << 8)
+#define CPG_FRQCRC_ZFC_SHIFT           8
+
+/* -----------------------------------------------------------------------------
+ * Z Clock
+ *
+ * Traits of this clock:
+ * prepare - clk_prepare only ensures that parents are prepared
+ * enable - clk_enable only ensures that parents are enabled
+ * rate - rate is adjustable.  clk->rate = parent->rate * mult / 32
+ * parent - fixed parent.  No clk_set_parent support
+ */
+
+struct cpg_z_clk {
+       struct clk_hw hw;
+       void __iomem *reg;
+};
+
+#define to_z_clk(_hw)  container_of(_hw, struct cpg_z_clk, hw)
+
+static unsigned long cpg_z_clk_recalc_rate(struct clk_hw *hw,
+                                          unsigned long parent_rate)
+{
+       struct cpg_z_clk *zclk = to_z_clk(hw);
+       unsigned int mult;
+       unsigned int val;
+
+       val = (clk_readl(zclk->reg) & CPG_FRQCRC_ZFC_MASK)
+           >> CPG_FRQCRC_ZFC_SHIFT;
+       mult = 32 - val;
+
+       return div_u64((u64)parent_rate * mult, 32);
+}
+
+static long cpg_z_clk_round_rate(struct clk_hw *hw, unsigned long rate,
+                                unsigned long *parent_rate)
+{
+       unsigned long prate  = *parent_rate;
+       unsigned int mult;
+
+       if (!prate)
+               prate = 1;
+
+       mult = div_u64((u64)rate * 32, prate);
+       mult = clamp(mult, 1U, 32U);
+
+       return *parent_rate / 32 * mult;
+}
+
+static int cpg_z_clk_set_rate(struct clk_hw *hw, unsigned long rate,
+                             unsigned long parent_rate)
+{
+       struct cpg_z_clk *zclk = to_z_clk(hw);
+       unsigned int mult;
+       u32 val;
+
+       mult = div_u64((u64)rate * 32, parent_rate);
+       mult = clamp(mult, 1U, 32U);
+
+       val = clk_readl(zclk->reg);
+       val &= ~CPG_FRQCRC_ZFC_MASK;
+       val |= (32 - mult) << CPG_FRQCRC_ZFC_SHIFT;
+       clk_writel(val, zclk->reg);
+
+       return 0;
+}
+
+static const struct clk_ops cpg_z_clk_ops = {
+       .recalc_rate = cpg_z_clk_recalc_rate,
+       .round_rate = cpg_z_clk_round_rate,
+       .set_rate = cpg_z_clk_set_rate,
+};
+
+static struct clk * __init cpg_z_clk_register(struct rcar_gen2_cpg *cpg)
+{
+       static const char *parent_name = "pll0";
+       struct clk_init_data init;
+       struct cpg_z_clk *zclk;
+       struct clk *clk;
+
+       zclk = kzalloc(sizeof(*zclk), GFP_KERNEL);
+       if (!zclk)
+               return ERR_PTR(-ENOMEM);
+
+       init.name = "z";
+       init.ops = &cpg_z_clk_ops;
+       init.flags = 0;
+       init.parent_names = &parent_name;
+       init.num_parents = 1;
+
+       zclk->reg = cpg->reg + CPG_FRQCRC;
+       zclk->hw.init = &init;
+
+       clk = clk_register(NULL, &zclk->hw);
+       if (IS_ERR(clk))
+               kfree(zclk);
+
+       return clk;
+}
+
+/* -----------------------------------------------------------------------------
+ * CPG Clock Data
+ */
+
+/*
+ *   MD                EXTAL           PLL0    PLL1    PLL3
+ * 14 13 19    (MHz)           *1      *1
+ *---------------------------------------------------
+ * 0  0  0     15 x 1          x172/2  x208/2  x106
+ * 0  0  1     15 x 1          x172/2  x208/2  x88
+ * 0  1  0     20 x 1          x130/2  x156/2  x80
+ * 0  1  1     20 x 1          x130/2  x156/2  x66
+ * 1  0  0     26 / 2          x200/2  x240/2  x122
+ * 1  0  1     26 / 2          x200/2  x240/2  x102
+ * 1  1  0     30 / 2          x172/2  x208/2  x106
+ * 1  1  1     30 / 2          x172/2  x208/2  x88
+ *
+ * *1 :        Table 7.6 indicates VCO ouput (PLLx = VCO/2)
+ */
+#define CPG_PLL_CONFIG_INDEX(md)       ((((md) & BIT(14)) >> 12) | \
+                                        (((md) & BIT(13)) >> 12) | \
+                                        (((md) & BIT(19)) >> 19))
+struct cpg_pll_config {
+       unsigned int extal_div;
+       unsigned int pll1_mult;
+       unsigned int pll3_mult;
+};
+
+static const struct cpg_pll_config cpg_pll_configs[8] __initconst = {
+       { 1, 208, 106 }, { 1, 208,  88 }, { 1, 156,  80 }, { 1, 156,  66 },
+       { 2, 240, 122 }, { 2, 240, 102 }, { 2, 208, 106 }, { 2, 208,  88 },
+};
+
+/* SDHI divisors */
+static const struct clk_div_table cpg_sdh_div_table[] = {
+       {  0,  2 }, {  1,  3 }, {  2,  4 }, {  3,  6 },
+       {  4,  8 }, {  5, 12 }, {  6, 16 }, {  7, 18 },
+       {  8, 24 }, { 10, 36 }, { 11, 48 }, {  0,  0 },
+};
+
+static const struct clk_div_table cpg_sd01_div_table[] = {
+       {  5, 12 }, {  6, 16 }, {  7, 18 }, {  8, 24 },
+       { 10, 36 }, { 11, 48 }, { 12, 10 }, {  0,  0 },
+};
+
+/* -----------------------------------------------------------------------------
+ * Initialization
+ */
+
+static u32 cpg_mode __initdata;
+
+static struct clk * __init
+rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg,
+                            const struct cpg_pll_config *config,
+                            const char *name)
+{
+       const struct clk_div_table *table = NULL;
+       const char *parent_name = "main";
+       unsigned int shift;
+       unsigned int mult = 1;
+       unsigned int div = 1;
+
+       if (!strcmp(name, "main")) {
+               parent_name = of_clk_get_parent_name(np, 0);
+               div = config->extal_div;
+       } else if (!strcmp(name, "pll0")) {
+               /* PLL0 is a configurable multiplier clock. Register it as a
+                * fixed factor clock for now as there's no generic multiplier
+                * clock implementation and we currently have no need to change
+                * the multiplier value.
+                */
+               u32 value = clk_readl(cpg->reg + CPG_PLL0CR);
+               mult = ((value >> 24) & ((1 << 7) - 1)) + 1;
+       } else if (!strcmp(name, "pll1")) {
+               mult = config->pll1_mult / 2;
+       } else if (!strcmp(name, "pll3")) {
+               mult = config->pll3_mult;
+       } else if (!strcmp(name, "lb")) {
+               div = cpg_mode & BIT(18) ? 36 : 24;
+       } else if (!strcmp(name, "qspi")) {
+               div = (cpg_mode & (BIT(3) | BIT(2) | BIT(1))) == BIT(2)
+                   ? 16 : 20;
+       } else if (!strcmp(name, "sdh")) {
+               table = cpg_sdh_div_table;
+               shift = 8;
+       } else if (!strcmp(name, "sd0")) {
+               table = cpg_sd01_div_table;
+               shift = 4;
+       } else if (!strcmp(name, "sd1")) {
+               table = cpg_sd01_div_table;
+               shift = 0;
+       } else if (!strcmp(name, "z")) {
+               return cpg_z_clk_register(cpg);
+       } else {
+               return ERR_PTR(-EINVAL);
+       }
+
+       if (!table)
+               return clk_register_fixed_factor(NULL, name, parent_name, 0,
+                                                mult, div);
+       else
+               return clk_register_divider_table(NULL, name, parent_name, 0,
+                                                cpg->reg + CPG_SDCKCR, shift,
+                                                4, 0, table, &cpg->lock);
+}
+
+static void __init rcar_gen2_cpg_clocks_init(struct device_node *np)
+{
+       const struct cpg_pll_config *config;
+       struct rcar_gen2_cpg *cpg;
+       struct clk **clks;
+       unsigned int i;
+       int num_clks;
+
+       num_clks = of_property_count_strings(np, "clock-output-names");
+       if (num_clks < 0) {
+               pr_err("%s: failed to count clocks\n", __func__);
+               return;
+       }
+
+       cpg = kzalloc(sizeof(*cpg), GFP_KERNEL);
+       clks = kzalloc(num_clks * sizeof(*clks), GFP_KERNEL);
+       if (cpg == NULL || clks == NULL) {
+               /* We're leaking memory on purpose, there's no point in cleaning
+                * up as the system won't boot anyway.
+                */
+               pr_err("%s: failed to allocate cpg\n", __func__);
+               return;
+       }
+
+       spin_lock_init(&cpg->lock);
+
+       cpg->data.clks = clks;
+       cpg->data.clk_num = num_clks;
+
+       cpg->reg = of_iomap(np, 0);
+       if (WARN_ON(cpg->reg == NULL))
+               return;
+
+       config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)];
+
+       for (i = 0; i < num_clks; ++i) {
+               const char *name;
+               struct clk *clk;
+
+               of_property_read_string_index(np, "clock-output-names", i,
+                                             &name);
+
+               clk = rcar_gen2_cpg_register_clock(np, cpg, config, name);
+               if (IS_ERR(clk))
+                       pr_err("%s: failed to register %s %s clock (%ld)\n",
+                              __func__, np->name, name, PTR_ERR(clk));
+               else
+                       cpg->data.clks[i] = clk;
+       }
+
+       of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data);
+}
+CLK_OF_DECLARE(rcar_gen2_cpg_clks, "renesas,rcar-gen2-cpg-clocks",
+              rcar_gen2_cpg_clocks_init);
+
+void __init rcar_gen2_clocks_init(u32 mode)
+{
+       cpg_mode = mode;
+
+       of_clk_init(NULL);
+}
diff --git a/drivers/clk/sirf/Makefile b/drivers/clk/sirf/Makefile
new file mode 100644 (file)
index 0000000..36b8e20
--- /dev/null
@@ -0,0 +1,5 @@
+#
+# Makefile for sirf specific clk
+#
+
+obj-$(CONFIG_ARCH_SIRF) += clk-prima2.o clk-atlas6.o
diff --git a/drivers/clk/sirf/atlas6.h b/drivers/clk/sirf/atlas6.h
new file mode 100644 (file)
index 0000000..376217f
--- /dev/null
@@ -0,0 +1,31 @@
+#define SIRFSOC_CLKC_CLK_EN0    0x0000
+#define SIRFSOC_CLKC_CLK_EN1    0x0004
+#define SIRFSOC_CLKC_REF_CFG    0x0020
+#define SIRFSOC_CLKC_CPU_CFG    0x0024
+#define SIRFSOC_CLKC_MEM_CFG    0x0028
+#define SIRFSOC_CLKC_MEMDIV_CFG 0x002C
+#define SIRFSOC_CLKC_SYS_CFG    0x0030
+#define SIRFSOC_CLKC_IO_CFG     0x0034
+#define SIRFSOC_CLKC_DSP_CFG    0x0038
+#define SIRFSOC_CLKC_GFX_CFG    0x003c
+#define SIRFSOC_CLKC_MM_CFG     0x0040
+#define SIRFSOC_CLKC_GFX2D_CFG  0x0040
+#define SIRFSOC_CLKC_LCD_CFG    0x0044
+#define SIRFSOC_CLKC_MMC01_CFG  0x0048
+#define SIRFSOC_CLKC_MMC23_CFG  0x004C
+#define SIRFSOC_CLKC_MMC45_CFG  0x0050
+#define SIRFSOC_CLKC_NAND_CFG  0x0054
+#define SIRFSOC_CLKC_NANDDIV_CFG       0x0058
+#define SIRFSOC_CLKC_PLL1_CFG0  0x0080
+#define SIRFSOC_CLKC_PLL2_CFG0  0x0084
+#define SIRFSOC_CLKC_PLL3_CFG0  0x0088
+#define SIRFSOC_CLKC_PLL1_CFG1  0x008c
+#define SIRFSOC_CLKC_PLL2_CFG1  0x0090
+#define SIRFSOC_CLKC_PLL3_CFG1  0x0094
+#define SIRFSOC_CLKC_PLL1_CFG2  0x0098
+#define SIRFSOC_CLKC_PLL2_CFG2  0x009c
+#define SIRFSOC_CLKC_PLL3_CFG2  0x00A0
+#define SIRFSOC_USBPHY_PLL_CTRL 0x0008
+#define SIRFSOC_USBPHY_PLL_POWERDOWN  BIT(1)
+#define SIRFSOC_USBPHY_PLL_BYPASS     BIT(2)
+#define SIRFSOC_USBPHY_PLL_LOCK       BIT(3)
diff --git a/drivers/clk/sirf/clk-atlas6.c b/drivers/clk/sirf/clk-atlas6.c
new file mode 100644 (file)
index 0000000..f9f4a15
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Clock tree for CSR SiRFatlasVI
+ *
+ * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+#include <linux/module.h>
+#include <linux/bitops.h>
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+#include <linux/clk-provider.h>
+#include <linux/of_address.h>
+#include <linux/syscore_ops.h>
+
+#include "atlas6.h"
+#include "clk-common.c"
+
+static struct clk_dmn clk_mmc01 = {
+       .regofs = SIRFSOC_CLKC_MMC01_CFG,
+       .enable_bit = 59,
+       .hw = {
+               .init = &clk_mmc01_init,
+       },
+};
+
+static struct clk_dmn clk_mmc23 = {
+       .regofs = SIRFSOC_CLKC_MMC23_CFG,
+       .enable_bit = 60,
+       .hw = {
+               .init = &clk_mmc23_init,
+       },
+};
+
+static struct clk_dmn clk_mmc45 = {
+       .regofs = SIRFSOC_CLKC_MMC45_CFG,
+       .enable_bit = 61,
+       .hw = {
+               .init = &clk_mmc45_init,
+       },
+};
+
+static struct clk_init_data clk_nand_init = {
+       .name = "nand",
+       .ops = &dmn_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+};
+
+static struct clk_dmn clk_nand = {
+       .regofs = SIRFSOC_CLKC_NAND_CFG,
+       .enable_bit = 34,
+       .hw = {
+               .init = &clk_nand_init,
+       },
+};
+
+enum atlas6_clk_index {
+       /* 0    1     2      3      4      5      6       7         8      9 */
+       rtc,    osc,   pll1,  pll2,  pll3,  mem,   sys,   security, dsp,   gps,
+       mf,     io,    cpu,   uart0, uart1, uart2, tsc,   i2c0,     i2c1,  spi0,
+       spi1,   pwmc,  efuse, pulse, dmac0, dmac1, nand,  audio,    usp0,  usp1,
+       usp2,   vip,   gfx,   gfx2d,    lcd,   vpp,   mmc01, mmc23,    mmc45, usbpll,
+       usb0,  usb1,   cphif, maxclk,
+};
+
+static __initdata struct clk_hw *atlas6_clk_hw_array[maxclk] = {
+       NULL, /* dummy */
+       NULL,
+       &clk_pll1.hw,
+       &clk_pll2.hw,
+       &clk_pll3.hw,
+       &clk_mem.hw,
+       &clk_sys.hw,
+       &clk_security.hw,
+       &clk_dsp.hw,
+       &clk_gps.hw,
+       &clk_mf.hw,
+       &clk_io.hw,
+       &clk_cpu.hw,
+       &clk_uart0.hw,
+       &clk_uart1.hw,
+       &clk_uart2.hw,
+       &clk_tsc.hw,
+       &clk_i2c0.hw,
+       &clk_i2c1.hw,
+       &clk_spi0.hw,
+       &clk_spi1.hw,
+       &clk_pwmc.hw,
+       &clk_efuse.hw,
+       &clk_pulse.hw,
+       &clk_dmac0.hw,
+       &clk_dmac1.hw,
+       &clk_nand.hw,
+       &clk_audio.hw,
+       &clk_usp0.hw,
+       &clk_usp1.hw,
+       &clk_usp2.hw,
+       &clk_vip.hw,
+       &clk_gfx.hw,
+       &clk_gfx2d.hw,
+       &clk_lcd.hw,
+       &clk_vpp.hw,
+       &clk_mmc01.hw,
+       &clk_mmc23.hw,
+       &clk_mmc45.hw,
+       &usb_pll_clk_hw,
+       &clk_usb0.hw,
+       &clk_usb1.hw,
+       &clk_cphif.hw,
+};
+
+static struct clk *atlas6_clks[maxclk];
+
+static void __init atlas6_clk_init(struct device_node *np)
+{
+       struct device_node *rscnp;
+       int i;
+
+       rscnp = of_find_compatible_node(NULL, NULL, "sirf,prima2-rsc");
+       sirfsoc_rsc_vbase = of_iomap(rscnp, 0);
+       if (!sirfsoc_rsc_vbase)
+               panic("unable to map rsc registers\n");
+       of_node_put(rscnp);
+
+       sirfsoc_clk_vbase = of_iomap(np, 0);
+       if (!sirfsoc_clk_vbase)
+               panic("unable to map clkc registers\n");
+
+       /* These are always available (RTC and 26MHz OSC)*/
+       atlas6_clks[rtc] = clk_register_fixed_rate(NULL, "rtc", NULL,
+               CLK_IS_ROOT, 32768);
+       atlas6_clks[osc] = clk_register_fixed_rate(NULL, "osc", NULL,
+               CLK_IS_ROOT, 26000000);
+
+       for (i = pll1; i < maxclk; i++) {
+               atlas6_clks[i] = clk_register(NULL, atlas6_clk_hw_array[i]);
+               BUG_ON(!atlas6_clks[i]);
+       }
+       clk_register_clkdev(atlas6_clks[cpu], NULL, "cpu");
+       clk_register_clkdev(atlas6_clks[io],  NULL, "io");
+       clk_register_clkdev(atlas6_clks[mem],  NULL, "mem");
+       clk_register_clkdev(atlas6_clks[mem],  NULL, "osc");
+
+       clk_data.clks = atlas6_clks;
+       clk_data.clk_num = maxclk;
+
+       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+}
+CLK_OF_DECLARE(atlas6_clk, "sirf,atlas6-clkc", atlas6_clk_init);
diff --git a/drivers/clk/sirf/clk-common.c b/drivers/clk/sirf/clk-common.c
new file mode 100644 (file)
index 0000000..7dde6a8
--- /dev/null
@@ -0,0 +1,1031 @@
+/*
+ * common clks module for all SiRF SoCs
+ *
+ * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+#define KHZ     1000
+#define MHZ     (KHZ * KHZ)
+
+static void *sirfsoc_clk_vbase;
+static void *sirfsoc_rsc_vbase;
+static struct clk_onecell_data clk_data;
+
+/*
+ * SiRFprimaII clock controller
+ * - 2 oscillators: osc-26MHz, rtc-32.768KHz
+ * - 3 standard configurable plls: pll1, pll2 & pll3
+ * - 2 exclusive plls: usb phy pll and sata phy pll
+ * - 8 clock domains: cpu/cpudiv, mem/memdiv, sys/io, dsp, graphic, multimedia,
+ *     display and sdphy.
+ *     Each clock domain can select its own clock source from five clock sources,
+ *     X_XIN, X_XINW, PLL1, PLL2 and PLL3. The domain clock is used as the source
+ *     clock of the group clock.
+ *     - dsp domain: gps, mf
+ *     - io domain: dmac, nand, audio, uart, i2c, spi, usp, pwm, pulse
+ *     - sys domain: security
+ */
+
+struct clk_pll {
+       struct clk_hw hw;
+       unsigned short regofs;  /* register offset */
+};
+
+#define to_pllclk(_hw) container_of(_hw, struct clk_pll, hw)
+
+struct clk_dmn {
+       struct clk_hw hw;
+       signed char enable_bit; /* enable bit: 0 ~ 63 */
+       unsigned short regofs;  /* register offset */
+};
+
+#define to_dmnclk(_hw) container_of(_hw, struct clk_dmn, hw)
+
+struct clk_std {
+       struct clk_hw hw;
+       signed char enable_bit; /* enable bit: 0 ~ 63 */
+};
+
+#define to_stdclk(_hw) container_of(_hw, struct clk_std, hw)
+
+static int std_clk_is_enabled(struct clk_hw *hw);
+static int std_clk_enable(struct clk_hw *hw);
+static void std_clk_disable(struct clk_hw *hw);
+
+static inline unsigned long clkc_readl(unsigned reg)
+{
+       return readl(sirfsoc_clk_vbase + reg);
+}
+
+static inline void clkc_writel(u32 val, unsigned reg)
+{
+       writel(val, sirfsoc_clk_vbase + reg);
+}
+
+/*
+ * std pll
+ */
+
+static unsigned long pll_clk_recalc_rate(struct clk_hw *hw,
+       unsigned long parent_rate)
+{
+       unsigned long fin = parent_rate;
+       struct clk_pll *clk = to_pllclk(hw);
+       u32 regcfg2 = clk->regofs + SIRFSOC_CLKC_PLL1_CFG2 -
+               SIRFSOC_CLKC_PLL1_CFG0;
+
+       if (clkc_readl(regcfg2) & BIT(2)) {
+               /* pll bypass mode */
+               return fin;
+       } else {
+               /* fout = fin * nf / nr / od */
+               u32 cfg0 = clkc_readl(clk->regofs);
+               u32 nf = (cfg0 & (BIT(13) - 1)) + 1;
+               u32 nr = ((cfg0 >> 13) & (BIT(6) - 1)) + 1;
+               u32 od = ((cfg0 >> 19) & (BIT(4) - 1)) + 1;
+               WARN_ON(fin % MHZ);
+               return fin / MHZ * nf / nr / od * MHZ;
+       }
+}
+
+static long pll_clk_round_rate(struct clk_hw *hw, unsigned long rate,
+       unsigned long *parent_rate)
+{
+       unsigned long fin, nf, nr, od;
+       u64 dividend;
+
+       /*
+        * fout = fin * nf / (nr * od);
+        * set od = 1, nr = fin/MHz, so fout = nf * MHz
+        */
+       rate = rate - rate % MHZ;
+
+       nf = rate / MHZ;
+       if (nf > BIT(13))
+               nf = BIT(13);
+       if (nf < 1)
+               nf = 1;
+
+       fin = *parent_rate;
+
+       nr = fin / MHZ;
+       if (nr > BIT(6))
+               nr = BIT(6);
+       od = 1;
+
+       dividend = (u64)fin * nf;
+       do_div(dividend, nr * od);
+
+       return (long)dividend;
+}
+
+static int pll_clk_set_rate(struct clk_hw *hw, unsigned long rate,
+       unsigned long parent_rate)
+{
+       struct clk_pll *clk = to_pllclk(hw);
+       unsigned long fin, nf, nr, od, reg;
+
+       /*
+        * fout = fin * nf / (nr * od);
+        * set od = 1, nr = fin/MHz, so fout = nf * MHz
+        */
+
+       nf = rate / MHZ;
+       if (unlikely((rate % MHZ) || nf > BIT(13) || nf < 1))
+               return -EINVAL;
+
+       fin = parent_rate;
+       BUG_ON(fin < MHZ);
+
+       nr = fin / MHZ;
+       BUG_ON((fin % MHZ) || nr > BIT(6));
+
+       od = 1;
+
+       reg = (nf - 1) | ((nr - 1) << 13) | ((od - 1) << 19);
+       clkc_writel(reg, clk->regofs);
+
+       reg = clk->regofs + SIRFSOC_CLKC_PLL1_CFG1 - SIRFSOC_CLKC_PLL1_CFG0;
+       clkc_writel((nf >> 1) - 1, reg);
+
+       reg = clk->regofs + SIRFSOC_CLKC_PLL1_CFG2 - SIRFSOC_CLKC_PLL1_CFG0;
+       while (!(clkc_readl(reg) & BIT(6)))
+               cpu_relax();
+
+       return 0;
+}
+
+static long cpu_clk_round_rate(struct clk_hw *hw, unsigned long rate,
+       unsigned long *parent_rate)
+{
+       /*
+        * SiRF SoC has not cpu clock control,
+        * So bypass to it's parent pll.
+        */
+       struct clk *parent_clk = clk_get_parent(hw->clk);
+       struct clk *pll_parent_clk = clk_get_parent(parent_clk);
+       unsigned long pll_parent_rate = clk_get_rate(pll_parent_clk);
+       return pll_clk_round_rate(__clk_get_hw(parent_clk), rate, &pll_parent_rate);
+}
+
+static unsigned long cpu_clk_recalc_rate(struct clk_hw *hw,
+       unsigned long parent_rate)
+{
+       /*
+        * SiRF SoC has not cpu clock control,
+        * So return the parent pll rate.
+        */
+       struct clk *parent_clk = clk_get_parent(hw->clk);
+       return __clk_get_rate(parent_clk);
+}
+
+static struct clk_ops std_pll_ops = {
+       .recalc_rate = pll_clk_recalc_rate,
+       .round_rate = pll_clk_round_rate,
+       .set_rate = pll_clk_set_rate,
+};
+
+static const char *pll_clk_parents[] = {
+       "osc",
+};
+
+static struct clk_init_data clk_pll1_init = {
+       .name = "pll1",
+       .ops = &std_pll_ops,
+       .parent_names = pll_clk_parents,
+       .num_parents = ARRAY_SIZE(pll_clk_parents),
+};
+
+static struct clk_init_data clk_pll2_init = {
+       .name = "pll2",
+       .ops = &std_pll_ops,
+       .parent_names = pll_clk_parents,
+       .num_parents = ARRAY_SIZE(pll_clk_parents),
+};
+
+static struct clk_init_data clk_pll3_init = {
+       .name = "pll3",
+       .ops = &std_pll_ops,
+       .parent_names = pll_clk_parents,
+       .num_parents = ARRAY_SIZE(pll_clk_parents),
+};
+
+static struct clk_pll clk_pll1 = {
+       .regofs = SIRFSOC_CLKC_PLL1_CFG0,
+       .hw = {
+               .init = &clk_pll1_init,
+       },
+};
+
+static struct clk_pll clk_pll2 = {
+       .regofs = SIRFSOC_CLKC_PLL2_CFG0,
+       .hw = {
+               .init = &clk_pll2_init,
+       },
+};
+
+static struct clk_pll clk_pll3 = {
+       .regofs = SIRFSOC_CLKC_PLL3_CFG0,
+       .hw = {
+               .init = &clk_pll3_init,
+       },
+};
+
+/*
+ * usb uses specified pll
+ */
+
+static int usb_pll_clk_enable(struct clk_hw *hw)
+{
+       u32 reg = readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL);
+       reg &= ~(SIRFSOC_USBPHY_PLL_POWERDOWN | SIRFSOC_USBPHY_PLL_BYPASS);
+       writel(reg, sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL);
+       while (!(readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL) &
+                       SIRFSOC_USBPHY_PLL_LOCK))
+               cpu_relax();
+
+       return 0;
+}
+
+static void usb_pll_clk_disable(struct clk_hw *clk)
+{
+       u32 reg = readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL);
+       reg |= (SIRFSOC_USBPHY_PLL_POWERDOWN | SIRFSOC_USBPHY_PLL_BYPASS);
+       writel(reg, sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL);
+}
+
+static unsigned long usb_pll_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
+{
+       u32 reg = readl(sirfsoc_rsc_vbase + SIRFSOC_USBPHY_PLL_CTRL);
+       return (reg & SIRFSOC_USBPHY_PLL_BYPASS) ? parent_rate : 48*MHZ;
+}
+
+static struct clk_ops usb_pll_ops = {
+       .enable = usb_pll_clk_enable,
+       .disable = usb_pll_clk_disable,
+       .recalc_rate = usb_pll_clk_recalc_rate,
+};
+
+static struct clk_init_data clk_usb_pll_init = {
+       .name = "usb_pll",
+       .ops = &usb_pll_ops,
+       .parent_names = pll_clk_parents,
+       .num_parents = ARRAY_SIZE(pll_clk_parents),
+};
+
+static struct clk_hw usb_pll_clk_hw = {
+       .init = &clk_usb_pll_init,
+};
+
+/*
+ * clock domains - cpu, mem, sys/io, dsp, gfx
+ */
+
+static const char *dmn_clk_parents[] = {
+       "rtc",
+       "osc",
+       "pll1",
+       "pll2",
+       "pll3",
+};
+
+static u8 dmn_clk_get_parent(struct clk_hw *hw)
+{
+       struct clk_dmn *clk = to_dmnclk(hw);
+       u32 cfg = clkc_readl(clk->regofs);
+
+       /* parent of io domain can only be pll3 */
+       if (strcmp(hw->init->name, "io") == 0)
+               return 4;
+
+       WARN_ON((cfg & (BIT(3) - 1)) > 4);
+
+       return cfg & (BIT(3) - 1);
+}
+
+static int dmn_clk_set_parent(struct clk_hw *hw, u8 parent)
+{
+       struct clk_dmn *clk = to_dmnclk(hw);
+       u32 cfg = clkc_readl(clk->regofs);
+
+       /* parent of io domain can only be pll3 */
+       if (strcmp(hw->init->name, "io") == 0)
+               return -EINVAL;
+
+       cfg &= ~(BIT(3) - 1);
+       clkc_writel(cfg | parent, clk->regofs);
+       /* BIT(3) - switching status: 1 - busy, 0 - done */
+       while (clkc_readl(clk->regofs) & BIT(3))
+               cpu_relax();
+
+       return 0;
+}
+
+static unsigned long dmn_clk_recalc_rate(struct clk_hw *hw,
+       unsigned long parent_rate)
+
+{
+       unsigned long fin = parent_rate;
+       struct clk_dmn *clk = to_dmnclk(hw);
+
+       u32 cfg = clkc_readl(clk->regofs);
+
+       if (cfg & BIT(24)) {
+               /* fcd bypass mode */
+               return fin;
+       } else {
+               /*
+                * wait count: bit[19:16], hold count: bit[23:20]
+                */
+               u32 wait = (cfg >> 16) & (BIT(4) - 1);
+               u32 hold = (cfg >> 20) & (BIT(4) - 1);
+
+               return fin / (wait + hold + 2);
+       }
+}
+
+static long dmn_clk_round_rate(struct clk_hw *hw, unsigned long rate,
+       unsigned long *parent_rate)
+{
+       unsigned long fin;
+       unsigned ratio, wait, hold;
+       unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4;
+
+       fin = *parent_rate;
+       ratio = fin / rate;
+
+       if (ratio < 2)
+               ratio = 2;
+       if (ratio > BIT(bits + 1))
+               ratio = BIT(bits + 1);
+
+       wait = (ratio >> 1) - 1;
+       hold = ratio - wait - 2;
+
+       return fin / (wait + hold + 2);
+}
+
+static int dmn_clk_set_rate(struct clk_hw *hw, unsigned long rate,
+       unsigned long parent_rate)
+{
+       struct clk_dmn *clk = to_dmnclk(hw);
+       unsigned long fin;
+       unsigned ratio, wait, hold, reg;
+       unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4;
+
+       fin = parent_rate;
+       ratio = fin / rate;
+
+       if (unlikely(ratio < 2 || ratio > BIT(bits + 1)))
+               return -EINVAL;
+
+       WARN_ON(fin % rate);
+
+       wait = (ratio >> 1) - 1;
+       hold = ratio - wait - 2;
+
+       reg = clkc_readl(clk->regofs);
+       reg &= ~(((BIT(bits) - 1) << 16) | ((BIT(bits) - 1) << 20));
+       reg |= (wait << 16) | (hold << 20) | BIT(25);
+       clkc_writel(reg, clk->regofs);
+
+       /* waiting FCD been effective */
+       while (clkc_readl(clk->regofs) & BIT(25))
+               cpu_relax();
+
+       return 0;
+}
+
+static int cpu_clk_set_rate(struct clk_hw *hw, unsigned long rate,
+               unsigned long parent_rate)
+{
+       int ret1, ret2;
+       struct clk *cur_parent;
+
+       if (rate == clk_get_rate(clk_pll1.hw.clk)) {
+               ret1 = clk_set_parent(hw->clk, clk_pll1.hw.clk);
+               return ret1;
+       }
+
+       if (rate == clk_get_rate(clk_pll2.hw.clk)) {
+               ret1 = clk_set_parent(hw->clk, clk_pll2.hw.clk);
+               return ret1;
+       }
+
+       if (rate == clk_get_rate(clk_pll3.hw.clk)) {
+               ret1 = clk_set_parent(hw->clk, clk_pll3.hw.clk);
+               return ret1;
+       }
+
+       cur_parent = clk_get_parent(hw->clk);
+
+       /* switch to tmp pll before setting parent clock's rate */
+       if (cur_parent ==  clk_pll1.hw.clk) {
+               ret1 = clk_set_parent(hw->clk, clk_pll2.hw.clk);
+               BUG_ON(ret1);
+       }
+
+       ret2 = clk_set_rate(clk_pll1.hw.clk, rate);
+
+       ret1 = clk_set_parent(hw->clk, clk_pll1.hw.clk);
+
+       return ret2 ? ret2 : ret1;
+}
+
+static struct clk_ops msi_ops = {
+       .set_rate = dmn_clk_set_rate,
+       .round_rate = dmn_clk_round_rate,
+       .recalc_rate = dmn_clk_recalc_rate,
+       .set_parent = dmn_clk_set_parent,
+       .get_parent = dmn_clk_get_parent,
+};
+
+static struct clk_init_data clk_mem_init = {
+       .name = "mem",
+       .ops = &msi_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+};
+
+static struct clk_dmn clk_mem = {
+       .regofs = SIRFSOC_CLKC_MEM_CFG,
+       .hw = {
+               .init = &clk_mem_init,
+       },
+};
+
+static struct clk_init_data clk_sys_init = {
+       .name = "sys",
+       .ops = &msi_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+       .flags = CLK_SET_RATE_GATE,
+};
+
+static struct clk_dmn clk_sys = {
+       .regofs = SIRFSOC_CLKC_SYS_CFG,
+       .hw = {
+               .init = &clk_sys_init,
+       },
+};
+
+static struct clk_init_data clk_io_init = {
+       .name = "io",
+       .ops = &msi_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+};
+
+static struct clk_dmn clk_io = {
+       .regofs = SIRFSOC_CLKC_IO_CFG,
+       .hw = {
+               .init = &clk_io_init,
+       },
+};
+
+static struct clk_ops cpu_ops = {
+       .set_parent = dmn_clk_set_parent,
+       .get_parent = dmn_clk_get_parent,
+       .set_rate = cpu_clk_set_rate,
+       .round_rate = cpu_clk_round_rate,
+       .recalc_rate = cpu_clk_recalc_rate,
+};
+
+static struct clk_init_data clk_cpu_init = {
+       .name = "cpu",
+       .ops = &cpu_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+       .flags = CLK_SET_RATE_PARENT,
+};
+
+static struct clk_dmn clk_cpu = {
+       .regofs = SIRFSOC_CLKC_CPU_CFG,
+       .hw = {
+               .init = &clk_cpu_init,
+       },
+};
+
+static struct clk_ops dmn_ops = {
+       .is_enabled = std_clk_is_enabled,
+       .enable = std_clk_enable,
+       .disable = std_clk_disable,
+       .set_rate = dmn_clk_set_rate,
+       .round_rate = dmn_clk_round_rate,
+       .recalc_rate = dmn_clk_recalc_rate,
+       .set_parent = dmn_clk_set_parent,
+       .get_parent = dmn_clk_get_parent,
+};
+
+/* dsp, gfx, mm, lcd and vpp domain */
+
+static struct clk_init_data clk_dsp_init = {
+       .name = "dsp",
+       .ops = &dmn_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+};
+
+static struct clk_dmn clk_dsp = {
+       .regofs = SIRFSOC_CLKC_DSP_CFG,
+       .enable_bit = 0,
+       .hw = {
+               .init = &clk_dsp_init,
+       },
+};
+
+static struct clk_init_data clk_gfx_init = {
+       .name = "gfx",
+       .ops = &dmn_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+};
+
+static struct clk_dmn clk_gfx = {
+       .regofs = SIRFSOC_CLKC_GFX_CFG,
+       .enable_bit = 8,
+       .hw = {
+               .init = &clk_gfx_init,
+       },
+};
+
+static struct clk_init_data clk_mm_init = {
+       .name = "mm",
+       .ops = &dmn_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+};
+
+static struct clk_dmn clk_mm = {
+       .regofs = SIRFSOC_CLKC_MM_CFG,
+       .enable_bit = 9,
+       .hw = {
+               .init = &clk_mm_init,
+       },
+};
+
+/*
+ * for atlas6, gfx2d holds the bit of prima2's clk_mm
+ */
+#define clk_gfx2d clk_mm
+
+static struct clk_init_data clk_lcd_init = {
+       .name = "lcd",
+       .ops = &dmn_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+};
+
+static struct clk_dmn clk_lcd = {
+       .regofs = SIRFSOC_CLKC_LCD_CFG,
+       .enable_bit = 10,
+       .hw = {
+               .init = &clk_lcd_init,
+       },
+};
+
+static struct clk_init_data clk_vpp_init = {
+       .name = "vpp",
+       .ops = &dmn_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+};
+
+static struct clk_dmn clk_vpp = {
+       .regofs = SIRFSOC_CLKC_LCD_CFG,
+       .enable_bit = 11,
+       .hw = {
+               .init = &clk_vpp_init,
+       },
+};
+
+static struct clk_init_data clk_mmc01_init = {
+       .name = "mmc01",
+       .ops = &dmn_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+};
+
+static struct clk_init_data clk_mmc23_init = {
+       .name = "mmc23",
+       .ops = &dmn_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+};
+
+static struct clk_init_data clk_mmc45_init = {
+       .name = "mmc45",
+       .ops = &dmn_ops,
+       .parent_names = dmn_clk_parents,
+       .num_parents = ARRAY_SIZE(dmn_clk_parents),
+};
+
+/*
+ * peripheral controllers in io domain
+ */
+
+static int std_clk_is_enabled(struct clk_hw *hw)
+{
+       u32 reg;
+       int bit;
+       struct clk_std *clk = to_stdclk(hw);
+
+       bit = clk->enable_bit % 32;
+       reg = clk->enable_bit / 32;
+       reg = SIRFSOC_CLKC_CLK_EN0 + reg * sizeof(reg);
+
+       return !!(clkc_readl(reg) & BIT(bit));
+}
+
+static int std_clk_enable(struct clk_hw *hw)
+{
+       u32 val, reg;
+       int bit;
+       struct clk_std *clk = to_stdclk(hw);
+
+       BUG_ON(clk->enable_bit < 0 || clk->enable_bit > 63);
+
+       bit = clk->enable_bit % 32;
+       reg = clk->enable_bit / 32;
+       reg = SIRFSOC_CLKC_CLK_EN0 + reg * sizeof(reg);
+
+       val = clkc_readl(reg) | BIT(bit);
+       clkc_writel(val, reg);
+       return 0;
+}
+
+static void std_clk_disable(struct clk_hw *hw)
+{
+       u32 val, reg;
+       int bit;
+       struct clk_std *clk = to_stdclk(hw);
+
+       BUG_ON(clk->enable_bit < 0 || clk->enable_bit > 63);
+
+       bit = clk->enable_bit % 32;
+       reg = clk->enable_bit / 32;
+       reg = SIRFSOC_CLKC_CLK_EN0 + reg * sizeof(reg);
+
+       val = clkc_readl(reg) & ~BIT(bit);
+       clkc_writel(val, reg);
+}
+
+static const char *std_clk_io_parents[] = {
+       "io",
+};
+
+static struct clk_ops ios_ops = {
+       .is_enabled = std_clk_is_enabled,
+       .enable = std_clk_enable,
+       .disable = std_clk_disable,
+};
+
+static struct clk_init_data clk_cphif_init = {
+       .name = "cphif",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_cphif = {
+       .enable_bit = 20,
+       .hw = {
+               .init = &clk_cphif_init,
+       },
+};
+
+static struct clk_init_data clk_dmac0_init = {
+       .name = "dmac0",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_dmac0 = {
+       .enable_bit = 32,
+       .hw = {
+               .init = &clk_dmac0_init,
+       },
+};
+
+static struct clk_init_data clk_dmac1_init = {
+       .name = "dmac1",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_dmac1 = {
+       .enable_bit = 33,
+       .hw = {
+               .init = &clk_dmac1_init,
+       },
+};
+
+static struct clk_init_data clk_audio_init = {
+       .name = "audio",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_audio = {
+       .enable_bit = 35,
+       .hw = {
+               .init = &clk_audio_init,
+       },
+};
+
+static struct clk_init_data clk_uart0_init = {
+       .name = "uart0",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_uart0 = {
+       .enable_bit = 36,
+       .hw = {
+               .init = &clk_uart0_init,
+       },
+};
+
+static struct clk_init_data clk_uart1_init = {
+       .name = "uart1",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_uart1 = {
+       .enable_bit = 37,
+       .hw = {
+               .init = &clk_uart1_init,
+       },
+};
+
+static struct clk_init_data clk_uart2_init = {
+       .name = "uart2",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_uart2 = {
+       .enable_bit = 38,
+       .hw = {
+               .init = &clk_uart2_init,
+       },
+};
+
+static struct clk_init_data clk_usp0_init = {
+       .name = "usp0",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_usp0 = {
+       .enable_bit = 39,
+       .hw = {
+               .init = &clk_usp0_init,
+       },
+};
+
+static struct clk_init_data clk_usp1_init = {
+       .name = "usp1",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_usp1 = {
+       .enable_bit = 40,
+       .hw = {
+               .init = &clk_usp1_init,
+       },
+};
+
+static struct clk_init_data clk_usp2_init = {
+       .name = "usp2",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_usp2 = {
+       .enable_bit = 41,
+       .hw = {
+               .init = &clk_usp2_init,
+       },
+};
+
+static struct clk_init_data clk_vip_init = {
+       .name = "vip",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_vip = {
+       .enable_bit = 42,
+       .hw = {
+               .init = &clk_vip_init,
+       },
+};
+
+static struct clk_init_data clk_spi0_init = {
+       .name = "spi0",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_spi0 = {
+       .enable_bit = 43,
+       .hw = {
+               .init = &clk_spi0_init,
+       },
+};
+
+static struct clk_init_data clk_spi1_init = {
+       .name = "spi1",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_spi1 = {
+       .enable_bit = 44,
+       .hw = {
+               .init = &clk_spi1_init,
+       },
+};
+
+static struct clk_init_data clk_tsc_init = {
+       .name = "tsc",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_tsc = {
+       .enable_bit = 45,
+       .hw = {
+               .init = &clk_tsc_init,
+       },
+};
+
+static struct clk_init_data clk_i2c0_init = {
+       .name = "i2c0",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_i2c0 = {
+       .enable_bit = 46,
+       .hw = {
+               .init = &clk_i2c0_init,
+       },
+};
+
+static struct clk_init_data clk_i2c1_init = {
+       .name = "i2c1",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_i2c1 = {
+       .enable_bit = 47,
+       .hw = {
+               .init = &clk_i2c1_init,
+       },
+};
+
+static struct clk_init_data clk_pwmc_init = {
+       .name = "pwmc",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_pwmc = {
+       .enable_bit = 48,
+       .hw = {
+               .init = &clk_pwmc_init,
+       },
+};
+
+static struct clk_init_data clk_efuse_init = {
+       .name = "efuse",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_efuse = {
+       .enable_bit = 49,
+       .hw = {
+               .init = &clk_efuse_init,
+       },
+};
+
+static struct clk_init_data clk_pulse_init = {
+       .name = "pulse",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_pulse = {
+       .enable_bit = 50,
+       .hw = {
+               .init = &clk_pulse_init,
+       },
+};
+
+static const char *std_clk_dsp_parents[] = {
+       "dsp",
+};
+
+static struct clk_init_data clk_gps_init = {
+       .name = "gps",
+       .ops = &ios_ops,
+       .parent_names = std_clk_dsp_parents,
+       .num_parents = ARRAY_SIZE(std_clk_dsp_parents),
+};
+
+static struct clk_std clk_gps = {
+       .enable_bit = 1,
+       .hw = {
+               .init = &clk_gps_init,
+       },
+};
+
+static struct clk_init_data clk_mf_init = {
+       .name = "mf",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_mf = {
+       .enable_bit = 2,
+       .hw = {
+               .init = &clk_mf_init,
+       },
+};
+
+static const char *std_clk_sys_parents[] = {
+       "sys",
+};
+
+static struct clk_init_data clk_security_init = {
+       .name = "security",
+       .ops = &ios_ops,
+       .parent_names = std_clk_sys_parents,
+       .num_parents = ARRAY_SIZE(std_clk_sys_parents),
+};
+
+static struct clk_std clk_security = {
+       .enable_bit = 19,
+       .hw = {
+               .init = &clk_security_init,
+       },
+};
+
+static const char *std_clk_usb_parents[] = {
+       "usb_pll",
+};
+
+static struct clk_init_data clk_usb0_init = {
+       .name = "usb0",
+       .ops = &ios_ops,
+       .parent_names = std_clk_usb_parents,
+       .num_parents = ARRAY_SIZE(std_clk_usb_parents),
+};
+
+static struct clk_std clk_usb0 = {
+       .enable_bit = 16,
+       .hw = {
+               .init = &clk_usb0_init,
+       },
+};
+
+static struct clk_init_data clk_usb1_init = {
+       .name = "usb1",
+       .ops = &ios_ops,
+       .parent_names = std_clk_usb_parents,
+       .num_parents = ARRAY_SIZE(std_clk_usb_parents),
+};
+
+static struct clk_std clk_usb1 = {
+       .enable_bit = 17,
+       .hw = {
+               .init = &clk_usb1_init,
+       },
+};
diff --git a/drivers/clk/sirf/clk-prima2.c b/drivers/clk/sirf/clk-prima2.c
new file mode 100644 (file)
index 0000000..7adc5c7
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Clock tree for CSR SiRFprimaII
+ *
+ * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+#include <linux/module.h>
+#include <linux/bitops.h>
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+#include <linux/clk-provider.h>
+#include <linux/of_address.h>
+#include <linux/syscore_ops.h>
+
+#include "prima2.h"
+#include "clk-common.c"
+
+static struct clk_dmn clk_mmc01 = {
+       .regofs = SIRFSOC_CLKC_MMC_CFG,
+       .enable_bit = 59,
+       .hw = {
+               .init = &clk_mmc01_init,
+       },
+};
+
+static struct clk_dmn clk_mmc23 = {
+       .regofs = SIRFSOC_CLKC_MMC_CFG,
+       .enable_bit = 60,
+       .hw = {
+               .init = &clk_mmc23_init,
+       },
+};
+
+static struct clk_dmn clk_mmc45 = {
+       .regofs = SIRFSOC_CLKC_MMC_CFG,
+       .enable_bit = 61,
+       .hw = {
+               .init = &clk_mmc45_init,
+       },
+};
+
+static struct clk_init_data clk_nand_init = {
+       .name = "nand",
+       .ops = &ios_ops,
+       .parent_names = std_clk_io_parents,
+       .num_parents = ARRAY_SIZE(std_clk_io_parents),
+};
+
+static struct clk_std clk_nand = {
+       .enable_bit = 34,
+       .hw = {
+               .init = &clk_nand_init,
+       },
+};
+
+enum prima2_clk_index {
+       /* 0    1     2      3      4      5      6       7         8      9 */
+       rtc,    osc,   pll1,  pll2,  pll3,  mem,   sys,   security, dsp,   gps,
+       mf,     io,    cpu,   uart0, uart1, uart2, tsc,   i2c0,     i2c1,  spi0,
+       spi1,   pwmc,  efuse, pulse, dmac0, dmac1, nand,  audio,    usp0,  usp1,
+       usp2,   vip,   gfx,   mm,    lcd,   vpp,   mmc01, mmc23,    mmc45, usbpll,
+       usb0,  usb1,   cphif, maxclk,
+};
+
+static __initdata struct clk_hw *prima2_clk_hw_array[maxclk] = {
+       NULL, /* dummy */
+       NULL,
+       &clk_pll1.hw,
+       &clk_pll2.hw,
+       &clk_pll3.hw,
+       &clk_mem.hw,
+       &clk_sys.hw,
+       &clk_security.hw,
+       &clk_dsp.hw,
+       &clk_gps.hw,
+       &clk_mf.hw,
+       &clk_io.hw,
+       &clk_cpu.hw,
+       &clk_uart0.hw,
+       &clk_uart1.hw,
+       &clk_uart2.hw,
+       &clk_tsc.hw,
+       &clk_i2c0.hw,
+       &clk_i2c1.hw,
+       &clk_spi0.hw,
+       &clk_spi1.hw,
+       &clk_pwmc.hw,
+       &clk_efuse.hw,
+       &clk_pulse.hw,
+       &clk_dmac0.hw,
+       &clk_dmac1.hw,
+       &clk_nand.hw,
+       &clk_audio.hw,
+       &clk_usp0.hw,
+       &clk_usp1.hw,
+       &clk_usp2.hw,
+       &clk_vip.hw,
+       &clk_gfx.hw,
+       &clk_mm.hw,
+       &clk_lcd.hw,
+       &clk_vpp.hw,
+       &clk_mmc01.hw,
+       &clk_mmc23.hw,
+       &clk_mmc45.hw,
+       &usb_pll_clk_hw,
+       &clk_usb0.hw,
+       &clk_usb1.hw,
+       &clk_cphif.hw,
+};
+
+static struct clk *prima2_clks[maxclk];
+
+static void __init prima2_clk_init(struct device_node *np)
+{
+       struct device_node *rscnp;
+       int i;
+
+       rscnp = of_find_compatible_node(NULL, NULL, "sirf,prima2-rsc");
+       sirfsoc_rsc_vbase = of_iomap(rscnp, 0);
+       if (!sirfsoc_rsc_vbase)
+               panic("unable to map rsc registers\n");
+       of_node_put(rscnp);
+
+       sirfsoc_clk_vbase = of_iomap(np, 0);
+       if (!sirfsoc_clk_vbase)
+               panic("unable to map clkc registers\n");
+
+       /* These are always available (RTC and 26MHz OSC)*/
+       prima2_clks[rtc] = clk_register_fixed_rate(NULL, "rtc", NULL,
+               CLK_IS_ROOT, 32768);
+       prima2_clks[osc] = clk_register_fixed_rate(NULL, "osc", NULL,
+               CLK_IS_ROOT, 26000000);
+
+       for (i = pll1; i < maxclk; i++) {
+               prima2_clks[i] = clk_register(NULL, prima2_clk_hw_array[i]);
+               BUG_ON(!prima2_clks[i]);
+       }
+       clk_register_clkdev(prima2_clks[cpu], NULL, "cpu");
+       clk_register_clkdev(prima2_clks[io],  NULL, "io");
+       clk_register_clkdev(prima2_clks[mem],  NULL, "mem");
+       clk_register_clkdev(prima2_clks[mem],  NULL, "osc");
+
+       clk_data.clks = prima2_clks;
+       clk_data.clk_num = maxclk;
+
+       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+}
+CLK_OF_DECLARE(prima2_clk, "sirf,prima2-clkc", prima2_clk_init);
diff --git a/drivers/clk/sirf/prima2.h b/drivers/clk/sirf/prima2.h
new file mode 100644 (file)
index 0000000..01bc385
--- /dev/null
@@ -0,0 +1,25 @@
+#define SIRFSOC_CLKC_CLK_EN0    0x0000
+#define SIRFSOC_CLKC_CLK_EN1    0x0004
+#define SIRFSOC_CLKC_REF_CFG    0x0014
+#define SIRFSOC_CLKC_CPU_CFG    0x0018
+#define SIRFSOC_CLKC_MEM_CFG    0x001c
+#define SIRFSOC_CLKC_SYS_CFG    0x0020
+#define SIRFSOC_CLKC_IO_CFG     0x0024
+#define SIRFSOC_CLKC_DSP_CFG    0x0028
+#define SIRFSOC_CLKC_GFX_CFG    0x002c
+#define SIRFSOC_CLKC_MM_CFG     0x0030
+#define SIRFSOC_CLKC_LCD_CFG     0x0034
+#define SIRFSOC_CLKC_MMC_CFG    0x0038
+#define SIRFSOC_CLKC_PLL1_CFG0  0x0040
+#define SIRFSOC_CLKC_PLL2_CFG0  0x0044
+#define SIRFSOC_CLKC_PLL3_CFG0  0x0048
+#define SIRFSOC_CLKC_PLL1_CFG1  0x004c
+#define SIRFSOC_CLKC_PLL2_CFG1  0x0050
+#define SIRFSOC_CLKC_PLL3_CFG1  0x0054
+#define SIRFSOC_CLKC_PLL1_CFG2  0x0058
+#define SIRFSOC_CLKC_PLL2_CFG2  0x005c
+#define SIRFSOC_CLKC_PLL3_CFG2  0x0060
+#define SIRFSOC_USBPHY_PLL_CTRL 0x0008
+#define SIRFSOC_USBPHY_PLL_POWERDOWN  BIT(1)
+#define SIRFSOC_USBPHY_PLL_BYPASS     BIT(2)
+#define SIRFSOC_USBPHY_PLL_LOCK       BIT(3)
index 81dd31a686df9e467b7c111f9c808ee568139551..5983a26a8c5fabb04e36425e6eef74939dffbe56 100644 (file)
@@ -121,9 +121,7 @@ static __init struct clk *socfpga_clk_init(struct device_node *node,
        int rc;
        u32 fixed_div;
 
-       rc = of_property_read_u32(node, "reg", &reg);
-       if (WARN_ON(rc))
-               return NULL;
+       of_property_read_u32(node, "reg", &reg);
 
        socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL);
        if (WARN_ON(!socfpga_clk))
@@ -292,7 +290,7 @@ static void __init socfpga_gate_clk_init(struct device_node *node,
                socfpga_clk->shift = div_reg[1];
                socfpga_clk->width = div_reg[2];
        } else {
-               socfpga_clk->div_reg = 0;
+               socfpga_clk->div_reg = NULL;
        }
 
        of_property_read_string(node, "clock-output-names", &clk_name);
index 958aa3ad1d6023bbe39a70c594b8e45099ac1a8d..dffd4ce6c8b5513e8dd4fdadcc06a68cc3a209fe 100644 (file)
@@ -116,7 +116,7 @@ static int clk_frac_set_rate(struct clk_hw *hw, unsigned long drate,
        return 0;
 }
 
-struct clk_ops clk_frac_ops = {
+static struct clk_ops clk_frac_ops = {
        .recalc_rate = clk_frac_recalc_rate,
        .round_rate = clk_frac_round_rate,
        .set_rate = clk_frac_set_rate,
index 88523f91d9b703cc57b1272421fed39430b6f7a6..9e232644f07edfac55e29bb2f8d69185ea214357 100644 (file)
  * parent - fixed parent.  No clk_set_parent support
  */
 
-struct clk_factors {
-       struct clk_hw hw;
-       void __iomem *reg;
-       struct clk_factors_config *config;
-       void (*get_factors) (u32 *rate, u32 parent, u8 *n, u8 *k, u8 *m, u8 *p);
-       spinlock_t *lock;
-};
-
 #define to_clk_factors(_hw) container_of(_hw, struct clk_factors, hw)
 
-#define SETMASK(len, pos)              (((-1U) >> (31-len))  << (pos))
+#define SETMASK(len, pos)              (((1U << (len)) - 1) << (pos))
 #define CLRMASK(len, pos)              (~(SETMASK(len, pos)))
 #define FACTOR_GET(bit, len, reg)      (((reg) & SETMASK(len, bit)) >> (bit))
 
@@ -88,7 +80,7 @@ static long clk_factors_round_rate(struct clk_hw *hw, unsigned long rate,
 static int clk_factors_set_rate(struct clk_hw *hw, unsigned long rate,
                                unsigned long parent_rate)
 {
-       u8 n, k, m, p;
+       u8 n = 0, k = 0, m = 0, p = 0;
        u32 reg;
        struct clk_factors *factors = to_clk_factors(hw);
        struct clk_factors_config *config = factors->config;
@@ -120,61 +112,8 @@ static int clk_factors_set_rate(struct clk_hw *hw, unsigned long rate,
        return 0;
 }
 
-static const struct clk_ops clk_factors_ops = {
+const struct clk_ops clk_factors_ops = {
        .recalc_rate = clk_factors_recalc_rate,
        .round_rate = clk_factors_round_rate,
        .set_rate = clk_factors_set_rate,
 };
-
-/**
- * clk_register_factors - register a factors clock with
- * the clock framework
- * @dev: device registering this clock
- * @name: name of this clock
- * @parent_name: name of clock's parent
- * @flags: framework-specific flags
- * @reg: register address to adjust factors
- * @config: shift and width of factors n, k, m and p
- * @get_factors: function to calculate the factors for a given frequency
- * @lock: shared register lock for this clock
- */
-struct clk *clk_register_factors(struct device *dev, const char *name,
-                                const char *parent_name,
-                                unsigned long flags, void __iomem *reg,
-                                struct clk_factors_config *config,
-                                void (*get_factors)(u32 *rate, u32 parent,
-                                                    u8 *n, u8 *k, u8 *m, u8 *p),
-                                spinlock_t *lock)
-{
-       struct clk_factors *factors;
-       struct clk *clk;
-       struct clk_init_data init;
-
-       /* allocate the factors */
-       factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL);
-       if (!factors) {
-               pr_err("%s: could not allocate factors clk\n", __func__);
-               return ERR_PTR(-ENOMEM);
-       }
-
-       init.name = name;
-       init.ops = &clk_factors_ops;
-       init.flags = flags;
-       init.parent_names = (parent_name ? &parent_name : NULL);
-       init.num_parents = (parent_name ? 1 : 0);
-
-       /* struct clk_factors assignments */
-       factors->reg = reg;
-       factors->config = config;
-       factors->lock = lock;
-       factors->hw.init = &init;
-       factors->get_factors = get_factors;
-
-       /* register the clock */
-       clk = clk_register(dev, &factors->hw);
-
-       if (IS_ERR(clk))
-               kfree(factors);
-
-       return clk;
-}
index f49851cc43804d57cce6f8d7035965059500853d..02e1a43ebac7d99f3808307b416c5572ee0539b5 100644 (file)
@@ -17,11 +17,13 @@ struct clk_factors_config {
        u8 pwidth;
 };
 
-struct clk *clk_register_factors(struct device *dev, const char *name,
-                                const char *parent_name,
-                                unsigned long flags, void __iomem *reg,
-                                struct clk_factors_config *config,
-                                void (*get_factors) (u32 *rate, u32 parent_rate,
-                                                     u8 *n, u8 *k, u8 *m, u8 *p),
-                                spinlock_t *lock);
+struct clk_factors {
+       struct clk_hw hw;
+       void __iomem *reg;
+       struct clk_factors_config *config;
+       void (*get_factors) (u32 *rate, u32 parent, u8 *n, u8 *k, u8 *m, u8 *p);
+       spinlock_t *lock;
+};
+
+extern const struct clk_ops clk_factors_ops;
 #endif
index 9bbd035145409b9908ca25fecfd412d5e7345840..659e4ea31893a42bee5fb701d54fcbb34776ed67 100644 (file)
@@ -23,6 +23,9 @@
 
 static DEFINE_SPINLOCK(clk_lock);
 
+/* Maximum number of parents our clocks have */
+#define SUNXI_MAX_PARENTS      5
+
 /**
  * sun4i_osc_clk_setup() - Setup function for gatable oscillator
  */
@@ -37,18 +40,16 @@ static void __init sun4i_osc_clk_setup(struct device_node *node)
        const char *clk_name = node->name;
        u32 rate;
 
+       if (of_property_read_u32(node, "clock-frequency", &rate))
+               return;
+
        /* allocate fixed-rate and gate clock structs */
        fixed = kzalloc(sizeof(struct clk_fixed_rate), GFP_KERNEL);
        if (!fixed)
                return;
        gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL);
-       if (!gate) {
-               kfree(fixed);
-               return;
-       }
-
-       if (of_property_read_u32(node, "clock-frequency", &rate))
-               return;
+       if (!gate)
+               goto err_free_fixed;
 
        /* set up gate and fixed rate properties */
        gate->reg = of_iomap(node, 0);
@@ -63,10 +64,18 @@ static void __init sun4i_osc_clk_setup(struct device_node *node)
                        &gate->hw, &clk_gate_ops,
                        CLK_IS_ROOT);
 
-       if (!IS_ERR(clk)) {
-               of_clk_add_provider(node, of_clk_src_simple_get, clk);
-               clk_register_clkdev(clk, clk_name, NULL);
-       }
+       if (IS_ERR(clk))
+               goto err_free_gate;
+
+       of_clk_add_provider(node, of_clk_src_simple_get, clk);
+       clk_register_clkdev(clk, clk_name, NULL);
+
+       return;
+
+err_free_gate:
+       kfree(gate);
+err_free_fixed:
+       kfree(fixed);
 }
 CLK_OF_DECLARE(sun4i_osc, "allwinner,sun4i-osc-clk", sun4i_osc_clk_setup);
 
@@ -208,6 +217,40 @@ static void sun6i_a31_get_pll1_factors(u32 *freq, u32 parent_rate,
        }
 }
 
+/**
+ * sun4i_get_pll5_factors() - calculates n, k factors for PLL5
+ * PLL5 rate is calculated as follows
+ * rate = parent_rate * n * (k + 1)
+ * parent_rate is always 24Mhz
+ */
+
+static void sun4i_get_pll5_factors(u32 *freq, u32 parent_rate,
+                                  u8 *n, u8 *k, u8 *m, u8 *p)
+{
+       u8 div;
+
+       /* Normalize value to a parent_rate multiple (24M) */
+       div = *freq / parent_rate;
+       *freq = parent_rate * div;
+
+       /* we were called to round the frequency, we can now return */
+       if (n == NULL)
+               return;
+
+       if (div < 31)
+               *k = 0;
+       else if (div / 2 < 31)
+               *k = 1;
+       else if (div / 3 < 31)
+               *k = 2;
+       else
+               *k = 3;
+
+       *n = DIV_ROUND_UP(div, (*k+1));
+}
+
+
+
 /**
  * sun4i_get_apb1_factors() - calculates m, p factors for APB1
  * APB1 rate is calculated as follows
@@ -251,11 +294,97 @@ static void sun4i_get_apb1_factors(u32 *freq, u32 parent_rate,
 
 
 
+/**
+ * sun4i_get_mod0_factors() - calculates m, n factors for MOD0-style clocks
+ * MMC rate is calculated as follows
+ * rate = (parent_rate >> p) / (m + 1);
+ */
+
+static void sun4i_get_mod0_factors(u32 *freq, u32 parent_rate,
+                                  u8 *n, u8 *k, u8 *m, u8 *p)
+{
+       u8 div, calcm, calcp;
+
+       /* These clocks can only divide, so we will never be able to achieve
+        * frequencies higher than the parent frequency */
+       if (*freq > parent_rate)
+               *freq = parent_rate;
+
+       div = parent_rate / *freq;
+
+       if (div < 16)
+               calcp = 0;
+       else if (div / 2 < 16)
+               calcp = 1;
+       else if (div / 4 < 16)
+               calcp = 2;
+       else
+               calcp = 3;
+
+       calcm = DIV_ROUND_UP(div, 1 << calcp);
+
+       *freq = (parent_rate >> calcp) / calcm;
+
+       /* we were called to round the frequency, we can now return */
+       if (n == NULL)
+               return;
+
+       *m = calcm - 1;
+       *p = calcp;
+}
+
+
+
+/**
+ * sun7i_a20_get_out_factors() - calculates m, p factors for CLK_OUT_A/B
+ * CLK_OUT rate is calculated as follows
+ * rate = (parent_rate >> p) / (m + 1);
+ */
+
+static void sun7i_a20_get_out_factors(u32 *freq, u32 parent_rate,
+                                     u8 *n, u8 *k, u8 *m, u8 *p)
+{
+       u8 div, calcm, calcp;
+
+       /* These clocks can only divide, so we will never be able to achieve
+        * frequencies higher than the parent frequency */
+       if (*freq > parent_rate)
+               *freq = parent_rate;
+
+       div = parent_rate / *freq;
+
+       if (div < 32)
+               calcp = 0;
+       else if (div / 2 < 32)
+               calcp = 1;
+       else if (div / 4 < 32)
+               calcp = 2;
+       else
+               calcp = 3;
+
+       calcm = DIV_ROUND_UP(div, 1 << calcp);
+
+       *freq = (parent_rate >> calcp) / calcm;
+
+       /* we were called to round the frequency, we can now return */
+       if (n == NULL)
+               return;
+
+       *m = calcm - 1;
+       *p = calcp;
+}
+
+
+
 /**
  * sunxi_factors_clk_setup() - Setup function for factor clocks
  */
 
+#define SUNXI_FACTORS_MUX_MASK 0x3
+
 struct factors_data {
+       int enable;
+       int mux;
        struct clk_factors_config *table;
        void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p);
 };
@@ -280,6 +409,13 @@ static struct clk_factors_config sun6i_a31_pll1_config = {
        .mwidth = 2,
 };
 
+static struct clk_factors_config sun4i_pll5_config = {
+       .nshift = 8,
+       .nwidth = 5,
+       .kshift = 4,
+       .kwidth = 2,
+};
+
 static struct clk_factors_config sun4i_apb1_config = {
        .mshift = 0,
        .mwidth = 5,
@@ -287,40 +423,143 @@ static struct clk_factors_config sun4i_apb1_config = {
        .pwidth = 2,
 };
 
+/* user manual says "n" but it's really "p" */
+static struct clk_factors_config sun4i_mod0_config = {
+       .mshift = 0,
+       .mwidth = 4,
+       .pshift = 16,
+       .pwidth = 2,
+};
+
+/* user manual says "n" but it's really "p" */
+static struct clk_factors_config sun7i_a20_out_config = {
+       .mshift = 8,
+       .mwidth = 5,
+       .pshift = 20,
+       .pwidth = 2,
+};
+
 static const struct factors_data sun4i_pll1_data __initconst = {
+       .enable = 31,
        .table = &sun4i_pll1_config,
        .getter = sun4i_get_pll1_factors,
 };
 
 static const struct factors_data sun6i_a31_pll1_data __initconst = {
+       .enable = 31,
        .table = &sun6i_a31_pll1_config,
        .getter = sun6i_a31_get_pll1_factors,
 };
 
+static const struct factors_data sun4i_pll5_data __initconst = {
+       .enable = 31,
+       .table = &sun4i_pll5_config,
+       .getter = sun4i_get_pll5_factors,
+};
+
 static const struct factors_data sun4i_apb1_data __initconst = {
        .table = &sun4i_apb1_config,
        .getter = sun4i_get_apb1_factors,
 };
 
-static void __init sunxi_factors_clk_setup(struct device_node *node,
-                                          struct factors_data *data)
+static const struct factors_data sun4i_mod0_data __initconst = {
+       .enable = 31,
+       .mux = 24,
+       .table = &sun4i_mod0_config,
+       .getter = sun4i_get_mod0_factors,
+};
+
+static const struct factors_data sun7i_a20_out_data __initconst = {
+       .enable = 31,
+       .mux = 24,
+       .table = &sun7i_a20_out_config,
+       .getter = sun7i_a20_get_out_factors,
+};
+
+static struct clk * __init sunxi_factors_clk_setup(struct device_node *node,
+                                               const struct factors_data *data)
 {
        struct clk *clk;
+       struct clk_factors *factors;
+       struct clk_gate *gate = NULL;
+       struct clk_mux *mux = NULL;
+       struct clk_hw *gate_hw = NULL;
+       struct clk_hw *mux_hw = NULL;
        const char *clk_name = node->name;
-       const char *parent;
+       const char *parents[SUNXI_MAX_PARENTS];
        void *reg;
+       int i = 0;
 
        reg = of_iomap(node, 0);
 
-       parent = of_clk_get_parent_name(node, 0);
+       /* if we have a mux, we will have >1 parents */
+       while (i < SUNXI_MAX_PARENTS &&
+              (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
+               i++;
+
+       /* Nodes should be providing the name via clock-output-names
+        * but originally our dts didn't, and so we used node->name.
+        * The new, better nodes look like clk@deadbeef, so we pull the
+        * name just in this case */
+       if (!strcmp("clk", clk_name)) {
+               of_property_read_string_index(node, "clock-output-names",
+                                             0, &clk_name);
+       }
+
+       factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL);
+       if (!factors)
+               return NULL;
+
+       /* Add a gate if this factor clock can be gated */
+       if (data->enable) {
+               gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL);
+               if (!gate) {
+                       kfree(factors);
+                       return NULL;
+               }
+
+               /* set up gate properties */
+               gate->reg = reg;
+               gate->bit_idx = data->enable;
+               gate->lock = &clk_lock;
+               gate_hw = &gate->hw;
+       }
+
+       /* Add a mux if this factor clock can be muxed */
+       if (data->mux) {
+               mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL);
+               if (!mux) {
+                       kfree(factors);
+                       kfree(gate);
+                       return NULL;
+               }
+
+               /* set up gate properties */
+               mux->reg = reg;
+               mux->shift = data->mux;
+               mux->mask = SUNXI_FACTORS_MUX_MASK;
+               mux->lock = &clk_lock;
+               mux_hw = &mux->hw;
+       }
 
-       clk = clk_register_factors(NULL, clk_name, parent, 0, reg,
-                                  data->table, data->getter, &clk_lock);
+       /* set up factors properties */
+       factors->reg = reg;
+       factors->config = data->table;
+       factors->get_factors = data->getter;
+       factors->lock = &clk_lock;
+
+       clk = clk_register_composite(NULL, clk_name,
+                       parents, i,
+                       mux_hw, &clk_mux_ops,
+                       &factors->hw, &clk_factors_ops,
+                       gate_hw, &clk_gate_ops, 0);
 
        if (!IS_ERR(clk)) {
                of_clk_add_provider(node, of_clk_src_simple_get, clk);
                clk_register_clkdev(clk, clk_name, NULL);
        }
+
+       return clk;
 }
 
 
@@ -352,13 +591,14 @@ static void __init sunxi_mux_clk_setup(struct device_node *node,
 {
        struct clk *clk;
        const char *clk_name = node->name;
-       const char *parents[5];
+       const char *parents[SUNXI_MAX_PARENTS];
        void *reg;
        int i = 0;
 
        reg = of_iomap(node, 0);
 
-       while (i < 5 && (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
+       while (i < SUNXI_MAX_PARENTS &&
+              (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
                i++;
 
        clk = clk_register_mux(NULL, clk_name, parents, i,
@@ -555,11 +795,186 @@ static void __init sunxi_gates_clk_setup(struct device_node *node,
        of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
 }
 
+
+
+/**
+ * sunxi_divs_clk_setup() helper data
+ */
+
+#define SUNXI_DIVS_MAX_QTY     2
+#define SUNXI_DIVISOR_WIDTH    2
+
+struct divs_data {
+       const struct factors_data *factors; /* data for the factor clock */
+       struct {
+               u8 fixed; /* is it a fixed divisor? if not... */
+               struct clk_div_table *table; /* is it a table based divisor? */
+               u8 shift; /* otherwise it's a normal divisor with this shift */
+               u8 pow;   /* is it power-of-two based? */
+               u8 gate;  /* is it independently gateable? */
+       } div[SUNXI_DIVS_MAX_QTY];
+};
+
+static struct clk_div_table pll6_sata_tbl[] = {
+       { .val = 0, .div = 6, },
+       { .val = 1, .div = 12, },
+       { .val = 2, .div = 18, },
+       { .val = 3, .div = 24, },
+       { } /* sentinel */
+};
+
+static const struct divs_data pll5_divs_data __initconst = {
+       .factors = &sun4i_pll5_data,
+       .div = {
+               { .shift = 0, .pow = 0, }, /* M, DDR */
+               { .shift = 16, .pow = 1, }, /* P, other */
+       }
+};
+
+static const struct divs_data pll6_divs_data __initconst = {
+       .factors = &sun4i_pll5_data,
+       .div = {
+               { .shift = 0, .table = pll6_sata_tbl, .gate = 14 }, /* M, SATA */
+               { .fixed = 2 }, /* P, other */
+       }
+};
+
+/**
+ * sunxi_divs_clk_setup() - Setup function for leaf divisors on clocks
+ *
+ * These clocks look something like this
+ *            ________________________
+ *           |         ___divisor 1---|----> to consumer
+ * parent >--|  pll___/___divisor 2---|----> to consumer
+ *           |        \_______________|____> to consumer
+ *           |________________________|
+ */
+
+static void __init sunxi_divs_clk_setup(struct device_node *node,
+                                       struct divs_data *data)
+{
+       struct clk_onecell_data *clk_data;
+       const char *parent  = node->name;
+       const char *clk_name;
+       struct clk **clks, *pclk;
+       struct clk_hw *gate_hw, *rate_hw;
+       const struct clk_ops *rate_ops;
+       struct clk_gate *gate = NULL;
+       struct clk_fixed_factor *fix_factor;
+       struct clk_divider *divider;
+       void *reg;
+       int i = 0;
+       int flags, clkflags;
+
+       /* Set up factor clock that we will be dividing */
+       pclk = sunxi_factors_clk_setup(node, data->factors);
+
+       reg = of_iomap(node, 0);
+
+       clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL);
+       if (!clk_data)
+               return;
+
+       clks = kzalloc(SUNXI_DIVS_MAX_QTY * sizeof(struct clk *), GFP_KERNEL);
+       if (!clks)
+               goto free_clkdata;
+
+       clk_data->clks = clks;
+
+       /* It's not a good idea to have automatic reparenting changing
+        * our RAM clock! */
+       clkflags = !strcmp("pll5", parent) ? 0 : CLK_SET_RATE_PARENT;
+
+       for (i = 0; i < SUNXI_DIVS_MAX_QTY; i++) {
+               if (of_property_read_string_index(node, "clock-output-names",
+                                                 i, &clk_name) != 0)
+                       break;
+
+               gate_hw = NULL;
+               rate_hw = NULL;
+               rate_ops = NULL;
+
+               /* If this leaf clock can be gated, create a gate */
+               if (data->div[i].gate) {
+                       gate = kzalloc(sizeof(*gate), GFP_KERNEL);
+                       if (!gate)
+                               goto free_clks;
+
+                       gate->reg = reg;
+                       gate->bit_idx = data->div[i].gate;
+                       gate->lock = &clk_lock;
+
+                       gate_hw = &gate->hw;
+               }
+
+               /* Leaves can be fixed or configurable divisors */
+               if (data->div[i].fixed) {
+                       fix_factor = kzalloc(sizeof(*fix_factor), GFP_KERNEL);
+                       if (!fix_factor)
+                               goto free_gate;
+
+                       fix_factor->mult = 1;
+                       fix_factor->div = data->div[i].fixed;
+
+                       rate_hw = &fix_factor->hw;
+                       rate_ops = &clk_fixed_factor_ops;
+               } else {
+                       divider = kzalloc(sizeof(*divider), GFP_KERNEL);
+                       if (!divider)
+                               goto free_gate;
+
+                       flags = data->div[i].pow ? CLK_DIVIDER_POWER_OF_TWO : 0;
+
+                       divider->reg = reg;
+                       divider->shift = data->div[i].shift;
+                       divider->width = SUNXI_DIVISOR_WIDTH;
+                       divider->flags = flags;
+                       divider->lock = &clk_lock;
+                       divider->table = data->div[i].table;
+
+                       rate_hw = &divider->hw;
+                       rate_ops = &clk_divider_ops;
+               }
+
+               /* Wrap the (potential) gate and the divisor on a composite
+                * clock to unify them */
+               clks[i] = clk_register_composite(NULL, clk_name, &parent, 1,
+                                                NULL, NULL,
+                                                rate_hw, rate_ops,
+                                                gate_hw, &clk_gate_ops,
+                                                clkflags);
+
+               WARN_ON(IS_ERR(clk_data->clks[i]));
+               clk_register_clkdev(clks[i], clk_name, NULL);
+       }
+
+       /* The last clock available on the getter is the parent */
+       clks[i++] = pclk;
+
+       /* Adjust to the real max */
+       clk_data->clk_num = i;
+
+       of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
+
+       return;
+
+free_gate:
+       kfree(gate);
+free_clks:
+       kfree(clks);
+free_clkdata:
+       kfree(clk_data);
+}
+
+
+
 /* Matches for factors clocks */
 static const struct of_device_id clk_factors_match[] __initconst = {
        {.compatible = "allwinner,sun4i-pll1-clk", .data = &sun4i_pll1_data,},
        {.compatible = "allwinner,sun6i-a31-pll1-clk", .data = &sun6i_a31_pll1_data,},
        {.compatible = "allwinner,sun4i-apb1-clk", .data = &sun4i_apb1_data,},
+       {.compatible = "allwinner,sun4i-mod0-clk", .data = &sun4i_mod0_data,},
+       {.compatible = "allwinner,sun7i-a20-out-clk", .data = &sun7i_a20_out_data,},
        {}
 };
 
@@ -572,6 +987,13 @@ static const struct of_device_id clk_div_match[] __initconst = {
        {}
 };
 
+/* Matches for divided outputs */
+static const struct of_device_id clk_divs_match[] __initconst = {
+       {.compatible = "allwinner,sun4i-pll5-clk", .data = &pll5_divs_data,},
+       {.compatible = "allwinner,sun4i-pll6-clk", .data = &pll6_divs_data,},
+       {}
+};
+
 /* Matches for mux clocks */
 static const struct of_device_id clk_mux_match[] __initconst = {
        {.compatible = "allwinner,sun4i-cpu-clk", .data = &sun4i_cpu_mux_data,},
@@ -616,7 +1038,32 @@ static void __init of_sunxi_table_clock_setup(const struct of_device_id *clk_mat
        }
 }
 
-static void __init sunxi_init_clocks(struct device_node *np)
+/**
+ * System clock protection
+ *
+ * By enabling these critical clocks, we prevent their accidental gating
+ * by the framework
+ */
+static void __init sunxi_clock_protect(void)
+{
+       struct clk *clk;
+
+       /* memory bus clock - sun5i+ */
+       clk = clk_get(NULL, "mbus");
+       if (!IS_ERR(clk)) {
+               clk_prepare_enable(clk);
+               clk_put(clk);
+       }
+
+       /* DDR clock - sun4i+ */
+       clk = clk_get(NULL, "pll5_ddr");
+       if (!IS_ERR(clk)) {
+               clk_prepare_enable(clk);
+               clk_put(clk);
+       }
+}
+
+static void __init sunxi_init_clocks(void)
 {
        /* Register factor clocks */
        of_sunxi_table_clock_setup(clk_factors_match, sunxi_factors_clk_setup);
@@ -624,11 +1071,17 @@ static void __init sunxi_init_clocks(struct device_node *np)
        /* Register divider clocks */
        of_sunxi_table_clock_setup(clk_div_match, sunxi_divider_clk_setup);
 
+       /* Register divided output clocks */
+       of_sunxi_table_clock_setup(clk_divs_match, sunxi_divs_clk_setup);
+
        /* Register mux clocks */
        of_sunxi_table_clock_setup(clk_mux_match, sunxi_mux_clk_setup);
 
        /* Register gate clocks */
        of_sunxi_table_clock_setup(clk_gates_match, sunxi_gates_clk_setup);
+
+       /* Enable core system clocks */
+       sunxi_clock_protect();
 }
 CLK_OF_DECLARE(sun4i_a10_clk_init, "allwinner,sun4i-a10", sunxi_init_clocks);
 CLK_OF_DECLARE(sun5i_a10s_clk_init, "allwinner,sun5i-a10s", sunxi_init_clocks);
index f49fac2d193acf662856fc74e5acd1d668b2cc84..f7dfb72884a4e2d177261984023d7c20f9249a22 100644 (file)
@@ -6,7 +6,12 @@ obj-y                                  += clk-periph-gate.o
 obj-y                                  += clk-pll.o
 obj-y                                  += clk-pll-out.o
 obj-y                                  += clk-super.o
-
+obj-y                                  += clk-tegra-audio.o
+obj-y                                  += clk-tegra-periph.o
+obj-y                                  += clk-tegra-pmc.o
+obj-y                                  += clk-tegra-fixed.o
+obj-y                                  += clk-tegra-super-gen4.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)         += clk-tegra20.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)         += clk-tegra30.o
 obj-$(CONFIG_ARCH_TEGRA_114_SOC)       += clk-tegra114.o
+obj-$(CONFIG_ARCH_TEGRA_124_SOC)       += clk-tegra124.o
diff --git a/drivers/clk/tegra/clk-id.h b/drivers/clk/tegra/clk-id.h
new file mode 100644 (file)
index 0000000..cf0c323
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+ * This header provides IDs for clocks common between several Tegra SoCs
+ */
+#ifndef _TEGRA_CLK_ID_H
+#define _TEGRA_CLK_ID_H
+
+enum clk_id {
+       tegra_clk_actmon,
+       tegra_clk_adx,
+       tegra_clk_adx1,
+       tegra_clk_afi,
+       tegra_clk_amx,
+       tegra_clk_amx1,
+       tegra_clk_apbdma,
+       tegra_clk_apbif,
+       tegra_clk_audio0,
+       tegra_clk_audio0_2x,
+       tegra_clk_audio0_mux,
+       tegra_clk_audio1,
+       tegra_clk_audio1_2x,
+       tegra_clk_audio1_mux,
+       tegra_clk_audio2,
+       tegra_clk_audio2_2x,
+       tegra_clk_audio2_mux,
+       tegra_clk_audio3,
+       tegra_clk_audio3_2x,
+       tegra_clk_audio3_mux,
+       tegra_clk_audio4,
+       tegra_clk_audio4_2x,
+       tegra_clk_audio4_mux,
+       tegra_clk_blink,
+       tegra_clk_bsea,
+       tegra_clk_bsev,
+       tegra_clk_cclk_g,
+       tegra_clk_cclk_lp,
+       tegra_clk_cilab,
+       tegra_clk_cilcd,
+       tegra_clk_cile,
+       tegra_clk_clk_32k,
+       tegra_clk_clk72Mhz,
+       tegra_clk_clk_m,
+       tegra_clk_clk_m_div2,
+       tegra_clk_clk_m_div4,
+       tegra_clk_clk_out_1,
+       tegra_clk_clk_out_1_mux,
+       tegra_clk_clk_out_2,
+       tegra_clk_clk_out_2_mux,
+       tegra_clk_clk_out_3,
+       tegra_clk_clk_out_3_mux,
+       tegra_clk_cml0,
+       tegra_clk_cml1,
+       tegra_clk_csi,
+       tegra_clk_csite,
+       tegra_clk_csus,
+       tegra_clk_cve,
+       tegra_clk_dam0,
+       tegra_clk_dam1,
+       tegra_clk_dam2,
+       tegra_clk_d_audio,
+       tegra_clk_dds,
+       tegra_clk_dfll_ref,
+       tegra_clk_dfll_soc,
+       tegra_clk_disp1,
+       tegra_clk_disp2,
+       tegra_clk_dp2,
+       tegra_clk_dpaux,
+       tegra_clk_dsia,
+       tegra_clk_dsialp,
+       tegra_clk_dsia_mux,
+       tegra_clk_dsib,
+       tegra_clk_dsiblp,
+       tegra_clk_dsib_mux,
+       tegra_clk_dtv,
+       tegra_clk_emc,
+       tegra_clk_entropy,
+       tegra_clk_epp,
+       tegra_clk_epp_8,
+       tegra_clk_extern1,
+       tegra_clk_extern2,
+       tegra_clk_extern3,
+       tegra_clk_fuse,
+       tegra_clk_fuse_burn,
+       tegra_clk_gpu,
+       tegra_clk_gr2d,
+       tegra_clk_gr2d_8,
+       tegra_clk_gr3d,
+       tegra_clk_gr3d_8,
+       tegra_clk_hclk,
+       tegra_clk_hda,
+       tegra_clk_hda2codec_2x,
+       tegra_clk_hda2hdmi,
+       tegra_clk_hdmi,
+       tegra_clk_hdmi_audio,
+       tegra_clk_host1x,
+       tegra_clk_host1x_8,
+       tegra_clk_i2c1,
+       tegra_clk_i2c2,
+       tegra_clk_i2c3,
+       tegra_clk_i2c4,
+       tegra_clk_i2c5,
+       tegra_clk_i2c6,
+       tegra_clk_i2cslow,
+       tegra_clk_i2s0,
+       tegra_clk_i2s0_sync,
+       tegra_clk_i2s1,
+       tegra_clk_i2s1_sync,
+       tegra_clk_i2s2,
+       tegra_clk_i2s2_sync,
+       tegra_clk_i2s3,
+       tegra_clk_i2s3_sync,
+       tegra_clk_i2s4,
+       tegra_clk_i2s4_sync,
+       tegra_clk_isp,
+       tegra_clk_isp_8,
+       tegra_clk_ispb,
+       tegra_clk_kbc,
+       tegra_clk_kfuse,
+       tegra_clk_la,
+       tegra_clk_mipi,
+       tegra_clk_mipi_cal,
+       tegra_clk_mpe,
+       tegra_clk_mselect,
+       tegra_clk_msenc,
+       tegra_clk_ndflash,
+       tegra_clk_ndflash_8,
+       tegra_clk_ndspeed,
+       tegra_clk_ndspeed_8,
+       tegra_clk_nor,
+       tegra_clk_owr,
+       tegra_clk_pcie,
+       tegra_clk_pclk,
+       tegra_clk_pll_a,
+       tegra_clk_pll_a_out0,
+       tegra_clk_pll_c,
+       tegra_clk_pll_c2,
+       tegra_clk_pll_c3,
+       tegra_clk_pll_c4,
+       tegra_clk_pll_c_out1,
+       tegra_clk_pll_d,
+       tegra_clk_pll_d2,
+       tegra_clk_pll_d2_out0,
+       tegra_clk_pll_d_out0,
+       tegra_clk_pll_dp,
+       tegra_clk_pll_e_out0,
+       tegra_clk_pll_m,
+       tegra_clk_pll_m_out1,
+       tegra_clk_pll_p,
+       tegra_clk_pll_p_out1,
+       tegra_clk_pll_p_out2,
+       tegra_clk_pll_p_out2_int,
+       tegra_clk_pll_p_out3,
+       tegra_clk_pll_p_out4,
+       tegra_clk_pll_p_out5,
+       tegra_clk_pll_ref,
+       tegra_clk_pll_re_out,
+       tegra_clk_pll_re_vco,
+       tegra_clk_pll_u,
+       tegra_clk_pll_u_12m,
+       tegra_clk_pll_u_480m,
+       tegra_clk_pll_u_48m,
+       tegra_clk_pll_u_60m,
+       tegra_clk_pll_x,
+       tegra_clk_pll_x_out0,
+       tegra_clk_pwm,
+       tegra_clk_rtc,
+       tegra_clk_sata,
+       tegra_clk_sata_cold,
+       tegra_clk_sata_oob,
+       tegra_clk_sbc1,
+       tegra_clk_sbc1_8,
+       tegra_clk_sbc2,
+       tegra_clk_sbc2_8,
+       tegra_clk_sbc3,
+       tegra_clk_sbc3_8,
+       tegra_clk_sbc4,
+       tegra_clk_sbc4_8,
+       tegra_clk_sbc5,
+       tegra_clk_sbc5_8,
+       tegra_clk_sbc6,
+       tegra_clk_sbc6_8,
+       tegra_clk_sclk,
+       tegra_clk_sdmmc1,
+       tegra_clk_sdmmc2,
+       tegra_clk_sdmmc3,
+       tegra_clk_sdmmc4,
+       tegra_clk_se,
+       tegra_clk_soc_therm,
+       tegra_clk_sor0,
+       tegra_clk_sor0_lvds,
+       tegra_clk_spdif,
+       tegra_clk_spdif_2x,
+       tegra_clk_spdif_in,
+       tegra_clk_spdif_in_sync,
+       tegra_clk_spdif_mux,
+       tegra_clk_spdif_out,
+       tegra_clk_timer,
+       tegra_clk_trace,
+       tegra_clk_tsec,
+       tegra_clk_tsensor,
+       tegra_clk_tvdac,
+       tegra_clk_tvo,
+       tegra_clk_uarta,
+       tegra_clk_uartb,
+       tegra_clk_uartc,
+       tegra_clk_uartd,
+       tegra_clk_uarte,
+       tegra_clk_usb2,
+       tegra_clk_usb3,
+       tegra_clk_usbd,
+       tegra_clk_vcp,
+       tegra_clk_vde,
+       tegra_clk_vde_8,
+       tegra_clk_vfir,
+       tegra_clk_vi,
+       tegra_clk_vi_8,
+       tegra_clk_vi_9,
+       tegra_clk_vic03,
+       tegra_clk_vim2_clk,
+       tegra_clk_vimclk_sync,
+       tegra_clk_vi_sensor,
+       tegra_clk_vi_sensor2,
+       tegra_clk_vi_sensor_8,
+       tegra_clk_xusb_dev,
+       tegra_clk_xusb_dev_src,
+       tegra_clk_xusb_falcon_src,
+       tegra_clk_xusb_fs_src,
+       tegra_clk_xusb_host,
+       tegra_clk_xusb_host_src,
+       tegra_clk_xusb_hs_src,
+       tegra_clk_xusb_ss,
+       tegra_clk_xusb_ss_src,
+       tegra_clk_max,
+};
+
+#endif /* _TEGRA_CLK_ID_H */
index bafee9895a247905d56ebe94c6a972eb7527c1c8..507015314827b079577dd85e1bd8e8faab54d628 100644 (file)
@@ -36,8 +36,6 @@ static DEFINE_SPINLOCK(periph_ref_lock);
 
 #define read_rst(gate) \
        readl_relaxed(gate->clk_base + (gate->regs->rst_reg))
-#define write_rst_set(val, gate) \
-       writel_relaxed(val, gate->clk_base + (gate->regs->rst_set_reg))
 #define write_rst_clr(val, gate) \
        writel_relaxed(val, gate->clk_base + (gate->regs->rst_clr_reg))
 
@@ -123,26 +121,6 @@ static void clk_periph_disable(struct clk_hw *hw)
        spin_unlock_irqrestore(&periph_ref_lock, flags);
 }
 
-void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert)
-{
-       if (gate->flags & TEGRA_PERIPH_NO_RESET)
-               return;
-
-       if (assert) {
-               /*
-                * If peripheral is in the APB bus then read the APB bus to
-                * flush the write operation in apb bus. This will avoid the
-                * peripheral access after disabling clock
-                */
-               if (gate->flags & TEGRA_PERIPH_ON_APB)
-                       tegra_read_chipid();
-
-               write_rst_set(periph_clk_to_bit(gate), gate);
-       } else {
-               write_rst_clr(periph_clk_to_bit(gate), gate);
-       }
-}
-
 const struct clk_ops tegra_clk_periph_gate_ops = {
        .is_enabled = clk_periph_is_enabled,
        .enable = clk_periph_enable,
@@ -151,12 +129,16 @@ const struct clk_ops tegra_clk_periph_gate_ops = {
 
 struct clk *tegra_clk_register_periph_gate(const char *name,
                const char *parent_name, u8 gate_flags, void __iomem *clk_base,
-               unsigned long flags, int clk_num,
-               struct tegra_clk_periph_regs *pregs, int *enable_refcnt)
+               unsigned long flags, int clk_num, int *enable_refcnt)
 {
        struct tegra_clk_periph_gate *gate;
        struct clk *clk;
        struct clk_init_data init;
+       struct tegra_clk_periph_regs *pregs;
+
+       pregs = get_reg_bank(clk_num);
+       if (!pregs)
+               return ERR_PTR(-EINVAL);
 
        gate = kzalloc(sizeof(*gate), GFP_KERNEL);
        if (!gate) {
index b2309d37a9637b70cfc823ea3ada7dc32d99c88a..356e9b804421ee7a27ba8a9cba960c3263260a10 100644 (file)
@@ -111,46 +111,6 @@ static void clk_periph_disable(struct clk_hw *hw)
        gate_ops->disable(gate_hw);
 }
 
-void tegra_periph_reset_deassert(struct clk *c)
-{
-       struct clk_hw *hw = __clk_get_hw(c);
-       struct tegra_clk_periph *periph = to_clk_periph(hw);
-       struct tegra_clk_periph_gate *gate;
-
-       if (periph->magic != TEGRA_CLK_PERIPH_MAGIC) {
-               gate = to_clk_periph_gate(hw);
-               if (gate->magic != TEGRA_CLK_PERIPH_GATE_MAGIC) {
-                       WARN_ON(1);
-                       return;
-               }
-       } else {
-               gate = &periph->gate;
-       }
-
-       tegra_periph_reset(gate, 0);
-}
-EXPORT_SYMBOL(tegra_periph_reset_deassert);
-
-void tegra_periph_reset_assert(struct clk *c)
-{
-       struct clk_hw *hw = __clk_get_hw(c);
-       struct tegra_clk_periph *periph = to_clk_periph(hw);
-       struct tegra_clk_periph_gate *gate;
-
-       if (periph->magic != TEGRA_CLK_PERIPH_MAGIC) {
-               gate = to_clk_periph_gate(hw);
-               if (gate->magic != TEGRA_CLK_PERIPH_GATE_MAGIC) {
-                       WARN_ON(1);
-                       return;
-               }
-       } else {
-               gate = &periph->gate;
-       }
-
-       tegra_periph_reset(gate, 1);
-}
-EXPORT_SYMBOL(tegra_periph_reset_assert);
-
 const struct clk_ops tegra_clk_periph_ops = {
        .get_parent = clk_periph_get_parent,
        .set_parent = clk_periph_set_parent,
@@ -162,7 +122,7 @@ const struct clk_ops tegra_clk_periph_ops = {
        .disable = clk_periph_disable,
 };
 
-const struct clk_ops tegra_clk_periph_nodiv_ops = {
+static const struct clk_ops tegra_clk_periph_nodiv_ops = {
        .get_parent = clk_periph_get_parent,
        .set_parent = clk_periph_set_parent,
        .is_enabled = clk_periph_is_enabled,
@@ -170,27 +130,50 @@ const struct clk_ops tegra_clk_periph_nodiv_ops = {
        .disable = clk_periph_disable,
 };
 
+const struct clk_ops tegra_clk_periph_no_gate_ops = {
+       .get_parent = clk_periph_get_parent,
+       .set_parent = clk_periph_set_parent,
+       .recalc_rate = clk_periph_recalc_rate,
+       .round_rate = clk_periph_round_rate,
+       .set_rate = clk_periph_set_rate,
+};
+
 static struct clk *_tegra_clk_register_periph(const char *name,
                        const char **parent_names, int num_parents,
                        struct tegra_clk_periph *periph,
-                       void __iomem *clk_base, u32 offset, bool div,
+                       void __iomem *clk_base, u32 offset,
                        unsigned long flags)
 {
        struct clk *clk;
        struct clk_init_data init;
+       struct tegra_clk_periph_regs *bank;
+       bool div = !(periph->gate.flags & TEGRA_PERIPH_NO_DIV);
+
+       if (periph->gate.flags & TEGRA_PERIPH_NO_DIV) {
+               flags |= CLK_SET_RATE_PARENT;
+               init.ops = &tegra_clk_periph_nodiv_ops;
+       } else if (periph->gate.flags & TEGRA_PERIPH_NO_GATE)
+               init.ops = &tegra_clk_periph_no_gate_ops;
+       else
+               init.ops = &tegra_clk_periph_ops;
 
        init.name = name;
-       init.ops = div ? &tegra_clk_periph_ops : &tegra_clk_periph_nodiv_ops;
        init.flags = flags;
        init.parent_names = parent_names;
        init.num_parents = num_parents;
 
+       bank = get_reg_bank(periph->gate.clk_num);
+       if (!bank)
+               return ERR_PTR(-EINVAL);
+
        /* Data in .init is copied by clk_register(), so stack variable OK */
        periph->hw.init = &init;
        periph->magic = TEGRA_CLK_PERIPH_MAGIC;
        periph->mux.reg = clk_base + offset;
        periph->divider.reg = div ? (clk_base + offset) : NULL;
        periph->gate.clk_base = clk_base;
+       periph->gate.regs = bank;
+       periph->gate.enable_refcnt = periph_clk_enb_refcnt;
 
        clk = clk_register(NULL, &periph->hw);
        if (IS_ERR(clk))
@@ -209,7 +192,7 @@ struct clk *tegra_clk_register_periph(const char *name,
                u32 offset, unsigned long flags)
 {
        return _tegra_clk_register_periph(name, parent_names, num_parents,
-                       periph, clk_base, offset, true, flags);
+                       periph, clk_base, offset, flags);
 }
 
 struct clk *tegra_clk_register_periph_nodiv(const char *name,
@@ -217,6 +200,7 @@ struct clk *tegra_clk_register_periph_nodiv(const char *name,
                struct tegra_clk_periph *periph, void __iomem *clk_base,
                u32 offset)
 {
+       periph->gate.flags |= TEGRA_PERIPH_NO_DIV;
        return _tegra_clk_register_periph(name, parent_names, num_parents,
-                       periph, clk_base, offset, false, CLK_SET_RATE_PARENT);
+                       periph, clk_base, offset, CLK_SET_RATE_PARENT);
 }
index 197074a5775421371d8c17526a6799ea4212b202..0d20241e07704df196c72ef22510775d22f5bfde 100644 (file)
 #define PLLE_MISC_SETUP_VALUE (7 << PLLE_MISC_SETUP_BASE_SHIFT)
 
 #define PLLE_SS_CTRL 0x68
-#define PLLE_SS_DISABLE (7 << 10)
+#define PLLE_SS_CNTL_BYPASS_SS BIT(10)
+#define PLLE_SS_CNTL_INTERP_RESET BIT(11)
+#define PLLE_SS_CNTL_SSC_BYP BIT(12)
+#define PLLE_SS_CNTL_CENTER BIT(14)
+#define PLLE_SS_CNTL_INVERT BIT(15)
+#define PLLE_SS_DISABLE (PLLE_SS_CNTL_BYPASS_SS | PLLE_SS_CNTL_INTERP_RESET |\
+                               PLLE_SS_CNTL_SSC_BYP)
+#define PLLE_SS_MAX_MASK 0x1ff
+#define PLLE_SS_MAX_VAL 0x25
+#define PLLE_SS_INC_MASK (0xff << 16)
+#define PLLE_SS_INC_VAL (0x1 << 16)
+#define PLLE_SS_INCINTRV_MASK (0x3f << 24)
+#define PLLE_SS_INCINTRV_VAL (0x20 << 24)
+#define PLLE_SS_COEFFICIENTS_MASK \
+       (PLLE_SS_MAX_MASK | PLLE_SS_INC_MASK | PLLE_SS_INCINTRV_MASK)
+#define PLLE_SS_COEFFICIENTS_VAL \
+       (PLLE_SS_MAX_VAL | PLLE_SS_INC_VAL | PLLE_SS_INCINTRV_VAL)
 
 #define PLLE_AUX_PLLP_SEL      BIT(2)
 #define PLLE_AUX_ENABLE_SWCTL  BIT(4)
 #define PMC_SATA_PWRGT_PLLE_IDDQ_VALUE BIT(5)
 #define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL BIT(4)
 
+#define PLLSS_MISC_KCP         0
+#define PLLSS_MISC_KVCO                0
+#define PLLSS_MISC_SETUP       0
+#define PLLSS_EN_SDM           0
+#define PLLSS_EN_SSC           0
+#define PLLSS_EN_DITHER2       0
+#define PLLSS_EN_DITHER                1
+#define PLLSS_SDM_RESET                0
+#define PLLSS_CLAMP            0
+#define PLLSS_SDM_SSC_MAX      0
+#define PLLSS_SDM_SSC_MIN      0
+#define PLLSS_SDM_SSC_STEP     0
+#define PLLSS_SDM_DIN          0
+#define PLLSS_MISC_DEFAULT ((PLLSS_MISC_KCP << 25) | \
+                           (PLLSS_MISC_KVCO << 24) | \
+                           PLLSS_MISC_SETUP)
+#define PLLSS_CFG_DEFAULT ((PLLSS_EN_SDM << 31) | \
+                          (PLLSS_EN_SSC << 30) | \
+                          (PLLSS_EN_DITHER2 << 29) | \
+                          (PLLSS_EN_DITHER << 28) | \
+                          (PLLSS_SDM_RESET) << 27 | \
+                          (PLLSS_CLAMP << 22))
+#define PLLSS_CTRL1_DEFAULT \
+                       ((PLLSS_SDM_SSC_MAX << 16) | PLLSS_SDM_SSC_MIN)
+#define PLLSS_CTRL2_DEFAULT \
+                       ((PLLSS_SDM_SSC_STEP << 16) | PLLSS_SDM_DIN)
+#define PLLSS_LOCK_OVERRIDE    BIT(24)
+#define PLLSS_REF_SRC_SEL_SHIFT        25
+#define PLLSS_REF_SRC_SEL_MASK (3 << PLLSS_REF_SRC_SEL_SHIFT)
+
 #define pll_readl(offset, p) readl_relaxed(p->clk_base + offset)
 #define pll_readl_base(p) pll_readl(p->params->base_reg, p)
 #define pll_readl_misc(p) pll_readl(p->params->misc_reg, p)
 #define mask(w) ((1 << (w)) - 1)
 #define divm_mask(p) mask(p->params->div_nmp->divm_width)
 #define divn_mask(p) mask(p->params->div_nmp->divn_width)
-#define divp_mask(p) (p->flags & TEGRA_PLLU ? PLLU_POST_DIVP_MASK :    \
+#define divp_mask(p) (p->params->flags & TEGRA_PLLU ? PLLU_POST_DIVP_MASK :\
                      mask(p->params->div_nmp->divp_width))
 
 #define divm_max(p) (divm_mask(p))
@@ -154,10 +200,10 @@ static void clk_pll_enable_lock(struct tegra_clk_pll *pll)
 {
        u32 val;
 
-       if (!(pll->flags & TEGRA_PLL_USE_LOCK))
+       if (!(pll->params->flags & TEGRA_PLL_USE_LOCK))
                return;
 
-       if (!(pll->flags & TEGRA_PLL_HAS_LOCK_ENABLE))
+       if (!(pll->params->flags & TEGRA_PLL_HAS_LOCK_ENABLE))
                return;
 
        val = pll_readl_misc(pll);
@@ -171,13 +217,13 @@ static int clk_pll_wait_for_lock(struct tegra_clk_pll *pll)
        u32 val, lock_mask;
        void __iomem *lock_addr;
 
-       if (!(pll->flags & TEGRA_PLL_USE_LOCK)) {
+       if (!(pll->params->flags & TEGRA_PLL_USE_LOCK)) {
                udelay(pll->params->lock_delay);
                return 0;
        }
 
        lock_addr = pll->clk_base;
-       if (pll->flags & TEGRA_PLL_LOCK_MISC)
+       if (pll->params->flags & TEGRA_PLL_LOCK_MISC)
                lock_addr += pll->params->misc_reg;
        else
                lock_addr += pll->params->base_reg;
@@ -204,7 +250,7 @@ static int clk_pll_is_enabled(struct clk_hw *hw)
        struct tegra_clk_pll *pll = to_clk_pll(hw);
        u32 val;
 
-       if (pll->flags & TEGRA_PLLM) {
+       if (pll->params->flags & TEGRA_PLLM) {
                val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE);
                if (val & PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE)
                        return val & PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE ? 1 : 0;
@@ -223,12 +269,12 @@ static void _clk_pll_enable(struct clk_hw *hw)
        clk_pll_enable_lock(pll);
 
        val = pll_readl_base(pll);
-       if (pll->flags & TEGRA_PLL_BYPASS)
+       if (pll->params->flags & TEGRA_PLL_BYPASS)
                val &= ~PLL_BASE_BYPASS;
        val |= PLL_BASE_ENABLE;
        pll_writel_base(val, pll);
 
-       if (pll->flags & TEGRA_PLLM) {
+       if (pll->params->flags & TEGRA_PLLM) {
                val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE);
                val |= PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE;
                writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE);
@@ -241,12 +287,12 @@ static void _clk_pll_disable(struct clk_hw *hw)
        u32 val;
 
        val = pll_readl_base(pll);
-       if (pll->flags & TEGRA_PLL_BYPASS)
+       if (pll->params->flags & TEGRA_PLL_BYPASS)
                val &= ~PLL_BASE_BYPASS;
        val &= ~PLL_BASE_ENABLE;
        pll_writel_base(val, pll);
 
-       if (pll->flags & TEGRA_PLLM) {
+       if (pll->params->flags & TEGRA_PLLM) {
                val = readl_relaxed(pll->pmc + PMC_PLLP_WB0_OVERRIDE);
                val &= ~PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE;
                writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE);
@@ -326,7 +372,7 @@ static int _get_table_rate(struct clk_hw *hw,
        struct tegra_clk_pll *pll = to_clk_pll(hw);
        struct tegra_clk_pll_freq_table *sel;
 
-       for (sel = pll->freq_table; sel->input_rate != 0; sel++)
+       for (sel = pll->params->freq_table; sel->input_rate != 0; sel++)
                if (sel->input_rate == parent_rate &&
                    sel->output_rate == rate)
                        break;
@@ -389,12 +435,11 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
        if (cfg->m > divm_max(pll) || cfg->n > divn_max(pll) ||
            (1 << p_div) > divp_max(pll)
            || cfg->output_rate > pll->params->vco_max) {
-               pr_err("%s: Failed to set %s rate %lu\n",
-                      __func__, __clk_get_name(hw->clk), rate);
-               WARN_ON(1);
                return -EINVAL;
        }
 
+       cfg->output_rate >>= p_div;
+
        if (pll->params->pdiv_tohw) {
                ret = _p_div_to_hw(hw, 1 << p_div);
                if (ret < 0)
@@ -414,7 +459,7 @@ static void _update_pll_mnp(struct tegra_clk_pll *pll,
        struct tegra_clk_pll_params *params = pll->params;
        struct div_nmp *div_nmp = params->div_nmp;
 
-       if ((pll->flags & TEGRA_PLLM) &&
+       if ((params->flags & TEGRA_PLLM) &&
                (pll_override_readl(PMC_PLLP_WB0_OVERRIDE, pll) &
                        PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE)) {
                val = pll_override_readl(params->pmc_divp_reg, pll);
@@ -450,7 +495,7 @@ static void _get_pll_mnp(struct tegra_clk_pll *pll,
        struct tegra_clk_pll_params *params = pll->params;
        struct div_nmp *div_nmp = params->div_nmp;
 
-       if ((pll->flags & TEGRA_PLLM) &&
+       if ((params->flags & TEGRA_PLLM) &&
                (pll_override_readl(PMC_PLLP_WB0_OVERRIDE, pll) &
                        PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE)) {
                val = pll_override_readl(params->pmc_divp_reg, pll);
@@ -479,11 +524,11 @@ static void _update_pll_cpcon(struct tegra_clk_pll *pll,
        val &= ~(PLL_MISC_CPCON_MASK << PLL_MISC_CPCON_SHIFT);
        val |= cfg->cpcon << PLL_MISC_CPCON_SHIFT;
 
-       if (pll->flags & TEGRA_PLL_SET_LFCON) {
+       if (pll->params->flags & TEGRA_PLL_SET_LFCON) {
                val &= ~(PLL_MISC_LFCON_MASK << PLL_MISC_LFCON_SHIFT);
                if (cfg->n >= PLLDU_LFCON_SET_DIVN)
                        val |= 1 << PLL_MISC_LFCON_SHIFT;
-       } else if (pll->flags & TEGRA_PLL_SET_DCCON) {
+       } else if (pll->params->flags & TEGRA_PLL_SET_DCCON) {
                val &= ~(1 << PLL_MISC_DCCON_SHIFT);
                if (rate >= (pll->params->vco_max >> 1))
                        val |= 1 << PLL_MISC_DCCON_SHIFT;
@@ -505,7 +550,7 @@ static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
 
        _update_pll_mnp(pll, cfg);
 
-       if (pll->flags & TEGRA_PLL_HAS_CPCON)
+       if (pll->params->flags & TEGRA_PLL_HAS_CPCON)
                _update_pll_cpcon(pll, cfg, rate);
 
        if (state) {
@@ -524,11 +569,11 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
        unsigned long flags = 0;
        int ret = 0;
 
-       if (pll->flags & TEGRA_PLL_FIXED) {
-               if (rate != pll->fixed_rate) {
+       if (pll->params->flags & TEGRA_PLL_FIXED) {
+               if (rate != pll->params->fixed_rate) {
                        pr_err("%s: Can not change %s fixed rate %lu to %lu\n",
                                __func__, __clk_get_name(hw->clk),
-                               pll->fixed_rate, rate);
+                               pll->params->fixed_rate, rate);
                        return -EINVAL;
                }
                return 0;
@@ -536,6 +581,8 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
 
        if (_get_table_rate(hw, &cfg, rate, parent_rate) &&
            _calc_rate(hw, &cfg, rate, parent_rate)) {
+               pr_err("%s: Failed to set %s rate %lu\n", __func__,
+                      __clk_get_name(hw->clk), rate);
                WARN_ON(1);
                return -EINVAL;
        }
@@ -559,18 +606,16 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
        struct tegra_clk_pll *pll = to_clk_pll(hw);
        struct tegra_clk_pll_freq_table cfg;
 
-       if (pll->flags & TEGRA_PLL_FIXED)
-               return pll->fixed_rate;
+       if (pll->params->flags & TEGRA_PLL_FIXED)
+               return pll->params->fixed_rate;
 
        /* PLLM is used for memory; we do not change rate */
-       if (pll->flags & TEGRA_PLLM)
+       if (pll->params->flags & TEGRA_PLLM)
                return __clk_get_rate(hw->clk);
 
        if (_get_table_rate(hw, &cfg, rate, *prate) &&
-           _calc_rate(hw, &cfg, rate, *prate)) {
-               WARN_ON(1);
+           _calc_rate(hw, &cfg, rate, *prate))
                return -EINVAL;
-       }
 
        return cfg.output_rate;
 }
@@ -586,17 +631,19 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,
 
        val = pll_readl_base(pll);
 
-       if ((pll->flags & TEGRA_PLL_BYPASS) && (val & PLL_BASE_BYPASS))
+       if ((pll->params->flags & TEGRA_PLL_BYPASS) && (val & PLL_BASE_BYPASS))
                return parent_rate;
 
-       if ((pll->flags & TEGRA_PLL_FIXED) && !(val & PLL_BASE_OVERRIDE)) {
+       if ((pll->params->flags & TEGRA_PLL_FIXED) &&
+                       !(val & PLL_BASE_OVERRIDE)) {
                struct tegra_clk_pll_freq_table sel;
-               if (_get_table_rate(hw, &sel, pll->fixed_rate, parent_rate)) {
+               if (_get_table_rate(hw, &sel, pll->params->fixed_rate,
+                                       parent_rate)) {
                        pr_err("Clock %s has unknown fixed frequency\n",
                               __clk_get_name(hw->clk));
                        BUG();
                }
-               return pll->fixed_rate;
+               return pll->params->fixed_rate;
        }
 
        _get_pll_mnp(pll, &cfg);
@@ -664,7 +711,7 @@ static int clk_plle_enable(struct clk_hw *hw)
        u32 val;
        int err;
 
-       if (_get_table_rate(hw, &sel, pll->fixed_rate, input_rate))
+       if (_get_table_rate(hw, &sel, pll->params->fixed_rate, input_rate))
                return -EINVAL;
 
        clk_pll_disable(hw);
@@ -680,7 +727,7 @@ static int clk_plle_enable(struct clk_hw *hw)
                        return err;
        }
 
-       if (pll->flags & TEGRA_PLLE_CONFIGURE) {
+       if (pll->params->flags & TEGRA_PLLE_CONFIGURE) {
                /* configure dividers */
                val = pll_readl_base(pll);
                val &= ~(divm_mask(pll) | divn_mask(pll) | divp_mask(pll));
@@ -744,7 +791,7 @@ const struct clk_ops tegra_clk_plle_ops = {
        .enable = clk_plle_enable,
 };
 
-#ifdef CONFIG_ARCH_TEGRA_114_SOC
+#if defined(CONFIG_ARCH_TEGRA_114_SOC) || defined(CONFIG_ARCH_TEGRA_124_SOC)
 
 static int _pll_fixed_mdiv(struct tegra_clk_pll_params *pll_params,
                           unsigned long parent_rate)
@@ -755,6 +802,48 @@ static int _pll_fixed_mdiv(struct tegra_clk_pll_params *pll_params,
                return 1;
 }
 
+static unsigned long _clip_vco_min(unsigned long vco_min,
+                                  unsigned long parent_rate)
+{
+       return DIV_ROUND_UP(vco_min, parent_rate) * parent_rate;
+}
+
+static int _setup_dynamic_ramp(struct tegra_clk_pll_params *pll_params,
+                              void __iomem *clk_base,
+                              unsigned long parent_rate)
+{
+       u32 val;
+       u32 step_a, step_b;
+
+       switch (parent_rate) {
+       case 12000000:
+       case 13000000:
+       case 26000000:
+               step_a = 0x2B;
+               step_b = 0x0B;
+               break;
+       case 16800000:
+               step_a = 0x1A;
+               step_b = 0x09;
+               break;
+       case 19200000:
+               step_a = 0x12;
+               step_b = 0x08;
+               break;
+       default:
+               pr_err("%s: Unexpected reference rate %lu\n",
+                       __func__, parent_rate);
+               WARN_ON(1);
+               return -EINVAL;
+       }
+
+       val = step_a << pll_params->stepa_shift;
+       val |= step_b << pll_params->stepb_shift;
+       writel_relaxed(val, clk_base + pll_params->dyn_ramp_reg);
+
+       return 0;
+}
+
 static int clk_pll_iddq_enable(struct clk_hw *hw)
 {
        struct tegra_clk_pll *pll = to_clk_pll(hw);
@@ -1173,7 +1262,7 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw)
        unsigned long flags = 0;
        unsigned long input_rate = clk_get_rate(clk_get_parent(hw->clk));
 
-       if (_get_table_rate(hw, &sel, pll->fixed_rate, input_rate))
+       if (_get_table_rate(hw, &sel, pll->params->fixed_rate, input_rate))
                return -EINVAL;
 
        if (pll->lock)
@@ -1217,6 +1306,18 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw)
        if (ret < 0)
                goto out;
 
+       val = pll_readl(PLLE_SS_CTRL, pll);
+       val &= ~(PLLE_SS_CNTL_CENTER | PLLE_SS_CNTL_INVERT);
+       val &= ~PLLE_SS_COEFFICIENTS_MASK;
+       val |= PLLE_SS_COEFFICIENTS_VAL;
+       pll_writel(val, PLLE_SS_CTRL, pll);
+       val &= ~(PLLE_SS_CNTL_SSC_BYP | PLLE_SS_CNTL_BYPASS_SS);
+       pll_writel(val, PLLE_SS_CTRL, pll);
+       udelay(1);
+       val &= ~PLLE_SS_CNTL_INTERP_RESET;
+       pll_writel(val, PLLE_SS_CTRL, pll);
+       udelay(1);
+
        /* TODO: enable hw control of xusb brick pll */
 
 out:
@@ -1248,9 +1349,8 @@ static void clk_plle_tegra114_disable(struct clk_hw *hw)
 #endif
 
 static struct tegra_clk_pll *_tegra_init_pll(void __iomem *clk_base,
-               void __iomem *pmc, unsigned long fixed_rate,
-               struct tegra_clk_pll_params *pll_params, u32 pll_flags,
-               struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock)
+               void __iomem *pmc, struct tegra_clk_pll_params *pll_params,
+               spinlock_t *lock)
 {
        struct tegra_clk_pll *pll;
 
@@ -1261,10 +1361,7 @@ static struct tegra_clk_pll *_tegra_init_pll(void __iomem *clk_base,
        pll->clk_base = clk_base;
        pll->pmc = pmc;
 
-       pll->freq_table = freq_table;
        pll->params = pll_params;
-       pll->fixed_rate = fixed_rate;
-       pll->flags = pll_flags;
        pll->lock = lock;
 
        if (!pll_params->div_nmp)
@@ -1293,17 +1390,15 @@ static struct clk *_tegra_clk_register_pll(struct tegra_clk_pll *pll,
 
 struct clk *tegra_clk_register_pll(const char *name, const char *parent_name,
                void __iomem *clk_base, void __iomem *pmc,
-               unsigned long flags, unsigned long fixed_rate,
-               struct tegra_clk_pll_params *pll_params, u32 pll_flags,
-               struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock)
+               unsigned long flags, struct tegra_clk_pll_params *pll_params,
+               spinlock_t *lock)
 {
        struct tegra_clk_pll *pll;
        struct clk *clk;
 
-       pll_flags |= TEGRA_PLL_BYPASS;
-       pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
-       pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags,
-                             freq_table, lock);
+       pll_params->flags |= TEGRA_PLL_BYPASS;
+       pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
+       pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
        if (IS_ERR(pll))
                return ERR_CAST(pll);
 
@@ -1317,17 +1412,15 @@ struct clk *tegra_clk_register_pll(const char *name, const char *parent_name,
 
 struct clk *tegra_clk_register_plle(const char *name, const char *parent_name,
                void __iomem *clk_base, void __iomem *pmc,
-               unsigned long flags, unsigned long fixed_rate,
-               struct tegra_clk_pll_params *pll_params, u32 pll_flags,
-               struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock)
+               unsigned long flags, struct tegra_clk_pll_params *pll_params,
+               spinlock_t *lock)
 {
        struct tegra_clk_pll *pll;
        struct clk *clk;
 
-       pll_flags |= TEGRA_PLL_LOCK_MISC | TEGRA_PLL_BYPASS;
-       pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
-       pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags,
-                             freq_table, lock);
+       pll_params->flags |= TEGRA_PLL_LOCK_MISC | TEGRA_PLL_BYPASS;
+       pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
+       pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
        if (IS_ERR(pll))
                return ERR_CAST(pll);
 
@@ -1339,8 +1432,8 @@ struct clk *tegra_clk_register_plle(const char *name, const char *parent_name,
        return clk;
 }
 
-#ifdef CONFIG_ARCH_TEGRA_114_SOC
-const struct clk_ops tegra_clk_pllxc_ops = {
+#if defined(CONFIG_ARCH_TEGRA_114_SOC) || defined(CONFIG_ARCH_TEGRA_124_SOC)
+static const struct clk_ops tegra_clk_pllxc_ops = {
        .is_enabled = clk_pll_is_enabled,
        .enable = clk_pll_iddq_enable,
        .disable = clk_pll_iddq_disable,
@@ -1349,7 +1442,7 @@ const struct clk_ops tegra_clk_pllxc_ops = {
        .set_rate = clk_pllxc_set_rate,
 };
 
-const struct clk_ops tegra_clk_pllm_ops = {
+static const struct clk_ops tegra_clk_pllm_ops = {
        .is_enabled = clk_pll_is_enabled,
        .enable = clk_pll_iddq_enable,
        .disable = clk_pll_iddq_disable,
@@ -1358,7 +1451,7 @@ const struct clk_ops tegra_clk_pllm_ops = {
        .set_rate = clk_pllm_set_rate,
 };
 
-const struct clk_ops tegra_clk_pllc_ops = {
+static const struct clk_ops tegra_clk_pllc_ops = {
        .is_enabled = clk_pll_is_enabled,
        .enable = clk_pllc_enable,
        .disable = clk_pllc_disable,
@@ -1367,7 +1460,7 @@ const struct clk_ops tegra_clk_pllc_ops = {
        .set_rate = clk_pllc_set_rate,
 };
 
-const struct clk_ops tegra_clk_pllre_ops = {
+static const struct clk_ops tegra_clk_pllre_ops = {
        .is_enabled = clk_pll_is_enabled,
        .enable = clk_pll_iddq_enable,
        .disable = clk_pll_iddq_disable,
@@ -1376,7 +1469,7 @@ const struct clk_ops tegra_clk_pllre_ops = {
        .set_rate = clk_pllre_set_rate,
 };
 
-const struct clk_ops tegra_clk_plle_tegra114_ops = {
+static const struct clk_ops tegra_clk_plle_tegra114_ops = {
        .is_enabled =  clk_pll_is_enabled,
        .enable = clk_plle_tegra114_enable,
        .disable = clk_plle_tegra114_disable,
@@ -1386,21 +1479,46 @@ const struct clk_ops tegra_clk_plle_tegra114_ops = {
 
 struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name,
                          void __iomem *clk_base, void __iomem *pmc,
-                         unsigned long flags, unsigned long fixed_rate,
+                         unsigned long flags,
                          struct tegra_clk_pll_params *pll_params,
-                         u32 pll_flags,
-                         struct tegra_clk_pll_freq_table *freq_table,
                          spinlock_t *lock)
 {
        struct tegra_clk_pll *pll;
-       struct clk *clk;
+       struct clk *clk, *parent;
+       unsigned long parent_rate;
+       int err;
+       u32 val, val_iddq;
+
+       parent = __clk_lookup(parent_name);
+       if (!parent) {
+               WARN(1, "parent clk %s of %s must be registered first\n",
+                       name, parent_name);
+               return ERR_PTR(-EINVAL);
+       }
 
        if (!pll_params->pdiv_tohw)
                return ERR_PTR(-EINVAL);
 
-       pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
-       pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags,
-                             freq_table, lock);
+       parent_rate = __clk_get_rate(parent);
+
+       pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
+
+       err = _setup_dynamic_ramp(pll_params, clk_base, parent_rate);
+       if (err)
+               return ERR_PTR(err);
+
+       val = readl_relaxed(clk_base + pll_params->base_reg);
+       val_iddq = readl_relaxed(clk_base + pll_params->iddq_reg);
+
+       if (val & PLL_BASE_ENABLE)
+               WARN_ON(val_iddq & BIT(pll_params->iddq_bit_idx));
+       else {
+               val_iddq |= BIT(pll_params->iddq_bit_idx);
+               writel_relaxed(val_iddq, clk_base + pll_params->iddq_reg);
+       }
+
+       pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
+       pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
        if (IS_ERR(pll))
                return ERR_CAST(pll);
 
@@ -1414,19 +1532,19 @@ struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name,
 
 struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name,
                          void __iomem *clk_base, void __iomem *pmc,
-                         unsigned long flags, unsigned long fixed_rate,
+                         unsigned long flags,
                          struct tegra_clk_pll_params *pll_params,
-                         u32 pll_flags,
-                         struct tegra_clk_pll_freq_table *freq_table,
                          spinlock_t *lock, unsigned long parent_rate)
 {
        u32 val;
        struct tegra_clk_pll *pll;
        struct clk *clk;
 
-       pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE | TEGRA_PLL_LOCK_MISC;
-       pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags,
-                             freq_table, lock);
+       pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE | TEGRA_PLL_LOCK_MISC;
+
+       pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
+
+       pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
        if (IS_ERR(pll))
                return ERR_CAST(pll);
 
@@ -1461,23 +1579,32 @@ struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name,
 
 struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name,
                          void __iomem *clk_base, void __iomem *pmc,
-                         unsigned long flags, unsigned long fixed_rate,
+                         unsigned long flags,
                          struct tegra_clk_pll_params *pll_params,
-                         u32 pll_flags,
-                         struct tegra_clk_pll_freq_table *freq_table,
                          spinlock_t *lock)
 {
        struct tegra_clk_pll *pll;
-       struct clk *clk;
+       struct clk *clk, *parent;
+       unsigned long parent_rate;
 
        if (!pll_params->pdiv_tohw)
                return ERR_PTR(-EINVAL);
 
-       pll_flags |= TEGRA_PLL_BYPASS;
-       pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
-       pll_flags |= TEGRA_PLLM;
-       pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags,
-                             freq_table, lock);
+       parent = __clk_lookup(parent_name);
+       if (!parent) {
+               WARN(1, "parent clk %s of %s must be registered first\n",
+                       name, parent_name);
+               return ERR_PTR(-EINVAL);
+       }
+
+       parent_rate = __clk_get_rate(parent);
+
+       pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
+
+       pll_params->flags |= TEGRA_PLL_BYPASS;
+       pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
+       pll_params->flags |= TEGRA_PLLM;
+       pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
        if (IS_ERR(pll))
                return ERR_CAST(pll);
 
@@ -1491,10 +1618,8 @@ struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name,
 
 struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name,
                          void __iomem *clk_base, void __iomem *pmc,
-                         unsigned long flags, unsigned long fixed_rate,
+                         unsigned long flags,
                          struct tegra_clk_pll_params *pll_params,
-                         u32 pll_flags,
-                         struct tegra_clk_pll_freq_table *freq_table,
                          spinlock_t *lock)
 {
        struct clk *parent, *clk;
@@ -1507,20 +1632,21 @@ struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name,
                return ERR_PTR(-EINVAL);
 
        parent = __clk_lookup(parent_name);
-       if (IS_ERR(parent)) {
+       if (!parent) {
                WARN(1, "parent clk %s of %s must be registered first\n",
                        name, parent_name);
                return ERR_PTR(-EINVAL);
        }
 
-       pll_flags |= TEGRA_PLL_BYPASS;
-       pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags,
-                             freq_table, lock);
+       parent_rate = __clk_get_rate(parent);
+
+       pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
+
+       pll_params->flags |= TEGRA_PLL_BYPASS;
+       pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
        if (IS_ERR(pll))
                return ERR_CAST(pll);
 
-       parent_rate = __clk_get_rate(parent);
-
        /*
         * Most of PLLC register fields are shadowed, and can not be read
         * directly from PLL h/w. Hence, actual PLLC boot state is unknown.
@@ -1567,17 +1693,15 @@ struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name,
 struct clk *tegra_clk_register_plle_tegra114(const char *name,
                                const char *parent_name,
                                void __iomem *clk_base, unsigned long flags,
-                               unsigned long fixed_rate,
                                struct tegra_clk_pll_params *pll_params,
-                               struct tegra_clk_pll_freq_table *freq_table,
                                spinlock_t *lock)
 {
        struct tegra_clk_pll *pll;
        struct clk *clk;
        u32 val, val_aux;
 
-       pll = _tegra_init_pll(clk_base, NULL, fixed_rate, pll_params,
-                             TEGRA_PLL_HAS_LOCK_ENABLE, freq_table, lock);
+       pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
+       pll = _tegra_init_pll(clk_base, NULL, pll_params, lock);
        if (IS_ERR(pll))
                return ERR_CAST(pll);
 
@@ -1587,11 +1711,13 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name,
        val_aux = pll_readl(pll_params->aux_reg, pll);
 
        if (val & PLL_BASE_ENABLE) {
-               if (!(val_aux & PLLE_AUX_PLLRE_SEL))
+               if ((val_aux & PLLE_AUX_PLLRE_SEL) ||
+                       (val_aux & PLLE_AUX_PLLP_SEL))
                        WARN(1, "pll_e enabled with unsupported parent %s\n",
-                         (val & PLLE_AUX_PLLP_SEL) ? "pllp_out0" : "pll_ref");
+                         (val_aux & PLLE_AUX_PLLP_SEL) ? "pllp_out0" :
+                                       "pll_re_vco");
        } else {
-               val_aux |= PLLE_AUX_PLLRE_SEL;
+               val_aux &= ~(PLLE_AUX_PLLRE_SEL | PLLE_AUX_PLLP_SEL);
                pll_writel(val, pll_params->aux_reg, pll);
        }
 
@@ -1603,3 +1729,92 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name,
        return clk;
 }
 #endif
+
+#ifdef CONFIG_ARCH_TEGRA_124_SOC
+static const struct clk_ops tegra_clk_pllss_ops = {
+       .is_enabled = clk_pll_is_enabled,
+       .enable = clk_pll_iddq_enable,
+       .disable = clk_pll_iddq_disable,
+       .recalc_rate = clk_pll_recalc_rate,
+       .round_rate = clk_pll_ramp_round_rate,
+       .set_rate = clk_pllxc_set_rate,
+};
+
+struct clk *tegra_clk_register_pllss(const char *name, const char *parent_name,
+                               void __iomem *clk_base, unsigned long flags,
+                               struct tegra_clk_pll_params *pll_params,
+                               spinlock_t *lock)
+{
+       struct tegra_clk_pll *pll;
+       struct clk *clk, *parent;
+       struct tegra_clk_pll_freq_table cfg;
+       unsigned long parent_rate;
+       u32 val;
+       int i;
+
+       if (!pll_params->div_nmp)
+               return ERR_PTR(-EINVAL);
+
+       parent = __clk_lookup(parent_name);
+       if (!parent) {
+               WARN(1, "parent clk %s of %s must be registered first\n",
+                       name, parent_name);
+               return ERR_PTR(-EINVAL);
+       }
+
+       pll_params->flags = TEGRA_PLL_HAS_LOCK_ENABLE | TEGRA_PLL_USE_LOCK;
+       pll = _tegra_init_pll(clk_base, NULL, pll_params, lock);
+       if (IS_ERR(pll))
+               return ERR_CAST(pll);
+
+       val = pll_readl_base(pll);
+       val &= ~PLLSS_REF_SRC_SEL_MASK;
+       pll_writel_base(val, pll);
+
+       parent_rate = __clk_get_rate(parent);
+
+       pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
+
+       /* initialize PLL to minimum rate */
+
+       cfg.m = _pll_fixed_mdiv(pll_params, parent_rate);
+       cfg.n = cfg.m * pll_params->vco_min / parent_rate;
+
+       for (i = 0; pll_params->pdiv_tohw[i].pdiv; i++)
+               ;
+       if (!i) {
+               kfree(pll);
+               return ERR_PTR(-EINVAL);
+       }
+
+       cfg.p = pll_params->pdiv_tohw[i-1].hw_val;
+
+       _update_pll_mnp(pll, &cfg);
+
+       pll_writel_misc(PLLSS_MISC_DEFAULT, pll);
+       pll_writel(PLLSS_CFG_DEFAULT, pll_params->ext_misc_reg[0], pll);
+       pll_writel(PLLSS_CTRL1_DEFAULT, pll_params->ext_misc_reg[1], pll);
+       pll_writel(PLLSS_CTRL1_DEFAULT, pll_params->ext_misc_reg[2], pll);
+
+       val = pll_readl_base(pll);
+       if (val & PLL_BASE_ENABLE) {
+               if (val & BIT(pll_params->iddq_bit_idx)) {
+                       WARN(1, "%s is on but IDDQ set\n", name);
+                       kfree(pll);
+                       return ERR_PTR(-EINVAL);
+               }
+       } else
+               val |= BIT(pll_params->iddq_bit_idx);
+
+       val &= ~PLLSS_LOCK_OVERRIDE;
+       pll_writel_base(val, pll);
+
+       clk = _tegra_clk_register_pll(pll, name, parent_name, flags,
+                                       &tegra_clk_pllss_ops);
+
+       if (IS_ERR(clk))
+               kfree(pll);
+
+       return clk;
+}
+#endif
diff --git a/drivers/clk/tegra/clk-tegra-audio.c b/drivers/clk/tegra/clk-tegra-audio.c
new file mode 100644 (file)
index 0000000..5c38aab
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2012, 2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/clk/tegra.h>
+
+#include "clk.h"
+#include "clk-id.h"
+
+#define AUDIO_SYNC_CLK_I2S0 0x4a0
+#define AUDIO_SYNC_CLK_I2S1 0x4a4
+#define AUDIO_SYNC_CLK_I2S2 0x4a8
+#define AUDIO_SYNC_CLK_I2S3 0x4ac
+#define AUDIO_SYNC_CLK_I2S4 0x4b0
+#define AUDIO_SYNC_CLK_SPDIF 0x4b4
+
+#define AUDIO_SYNC_DOUBLER 0x49c
+
+#define PLLA_OUT 0xb4
+
+struct tegra_sync_source_initdata {
+       char            *name;
+       unsigned long   rate;
+       unsigned long   max_rate;
+       int             clk_id;
+};
+
+#define SYNC(_name) \
+       {\
+               .name           = #_name,\
+               .rate           = 24000000,\
+               .max_rate       = 24000000,\
+               .clk_id         = tegra_clk_ ## _name,\
+       }
+
+struct tegra_audio_clk_initdata {
+       char            *gate_name;
+       char            *mux_name;
+       u32             offset;
+       int             gate_clk_id;
+       int             mux_clk_id;
+};
+
+#define AUDIO(_name, _offset) \
+       {\
+               .gate_name      = #_name,\
+               .mux_name       = #_name"_mux",\
+               .offset         = _offset,\
+               .gate_clk_id    = tegra_clk_ ## _name,\
+               .mux_clk_id     = tegra_clk_ ## _name ## _mux,\
+       }
+
+struct tegra_audio2x_clk_initdata {
+       char            *parent;
+       char            *gate_name;
+       char            *name_2x;
+       char            *div_name;
+       int             clk_id;
+       int             clk_num;
+       u8              div_offset;
+};
+
+#define AUDIO2X(_name, _num, _offset) \
+       {\
+               .parent         = #_name,\
+               .gate_name      = #_name"_2x",\
+               .name_2x        = #_name"_doubler",\
+               .div_name       = #_name"_div",\
+               .clk_id         = tegra_clk_ ## _name ## _2x,\
+               .clk_num        = _num,\
+               .div_offset     = _offset,\
+       }
+
+static DEFINE_SPINLOCK(clk_doubler_lock);
+
+static const char *mux_audio_sync_clk[] = { "spdif_in_sync", "i2s0_sync",
+       "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync",
+};
+
+static struct tegra_sync_source_initdata sync_source_clks[] __initdata = {
+       SYNC(spdif_in_sync),
+       SYNC(i2s0_sync),
+       SYNC(i2s1_sync),
+       SYNC(i2s2_sync),
+       SYNC(i2s3_sync),
+       SYNC(i2s4_sync),
+       SYNC(vimclk_sync),
+};
+
+static struct tegra_audio_clk_initdata audio_clks[] = {
+       AUDIO(audio0, AUDIO_SYNC_CLK_I2S0),
+       AUDIO(audio1, AUDIO_SYNC_CLK_I2S1),
+       AUDIO(audio2, AUDIO_SYNC_CLK_I2S2),
+       AUDIO(audio3, AUDIO_SYNC_CLK_I2S3),
+       AUDIO(audio4, AUDIO_SYNC_CLK_I2S4),
+       AUDIO(spdif, AUDIO_SYNC_CLK_SPDIF),
+};
+
+static struct tegra_audio2x_clk_initdata audio2x_clks[] = {
+       AUDIO2X(audio0, 113, 24),
+       AUDIO2X(audio1, 114, 25),
+       AUDIO2X(audio2, 115, 26),
+       AUDIO2X(audio3, 116, 27),
+       AUDIO2X(audio4, 117, 28),
+       AUDIO2X(spdif, 118, 29),
+};
+
+void __init tegra_audio_clk_init(void __iomem *clk_base,
+                       void __iomem *pmc_base, struct tegra_clk *tegra_clks,
+                       struct tegra_clk_pll_params *pll_a_params)
+{
+       struct clk *clk;
+       struct clk **dt_clk;
+       int i;
+
+       /* PLLA */
+       dt_clk = tegra_lookup_dt_id(tegra_clk_pll_a, tegra_clks);
+       if (dt_clk) {
+               clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base,
+                               pmc_base, 0, pll_a_params, NULL);
+               *dt_clk = clk;
+       }
+
+       /* PLLA_OUT0 */
+       dt_clk = tegra_lookup_dt_id(tegra_clk_pll_a_out0, tegra_clks);
+       if (dt_clk) {
+               clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a",
+                               clk_base + PLLA_OUT, 0, TEGRA_DIVIDER_ROUND_UP,
+                               8, 8, 1, NULL);
+               clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div",
+                               clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED |
+                               CLK_SET_RATE_PARENT, 0, NULL);
+               *dt_clk = clk;
+       }
+
+       for (i = 0; i < ARRAY_SIZE(sync_source_clks); i++) {
+               struct tegra_sync_source_initdata *data;
+
+               data = &sync_source_clks[i];
+
+               dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks);
+               if (!dt_clk)
+                       continue;
+
+               clk = tegra_clk_register_sync_source(data->name,
+                                       data->rate, data->max_rate);
+               *dt_clk = clk;
+       }
+
+       for (i = 0; i < ARRAY_SIZE(audio_clks); i++) {
+               struct tegra_audio_clk_initdata *data;
+
+               data = &audio_clks[i];
+               dt_clk = tegra_lookup_dt_id(data->mux_clk_id, tegra_clks);
+
+               if (!dt_clk)
+                       continue;
+               clk = clk_register_mux(NULL, data->mux_name, mux_audio_sync_clk,
+                                       ARRAY_SIZE(mux_audio_sync_clk),
+                                       CLK_SET_RATE_NO_REPARENT,
+                                       clk_base + data->offset, 0, 3, 0,
+                                       NULL);
+               *dt_clk = clk;
+
+               dt_clk = tegra_lookup_dt_id(data->gate_clk_id, tegra_clks);
+               if (!dt_clk)
+                       continue;
+
+               clk = clk_register_gate(NULL, data->gate_name, data->mux_name,
+                                       0, clk_base + data->offset, 4,
+                                       CLK_GATE_SET_TO_DISABLE, NULL);
+               *dt_clk = clk;
+       }
+
+       for (i = 0; i < ARRAY_SIZE(audio2x_clks); i++) {
+               struct tegra_audio2x_clk_initdata *data;
+
+               data = &audio2x_clks[i];
+               dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks);
+               if (!dt_clk)
+                       continue;
+
+               clk = clk_register_fixed_factor(NULL, data->name_2x,
+                               data->parent, CLK_SET_RATE_PARENT, 2, 1);
+               clk = tegra_clk_register_divider(data->div_name,
+                               data->name_2x, clk_base + AUDIO_SYNC_DOUBLER,
+                               0, 0, data->div_offset, 1, 0,
+                               &clk_doubler_lock);
+               clk = tegra_clk_register_periph_gate(data->gate_name,
+                               data->div_name, TEGRA_PERIPH_NO_RESET,
+                               clk_base, CLK_SET_RATE_PARENT, data->clk_num,
+                               periph_clk_enb_refcnt);
+               *dt_clk = clk;
+       }
+}
+
diff --git a/drivers/clk/tegra/clk-tegra-fixed.c b/drivers/clk/tegra/clk-tegra-fixed.c
new file mode 100644 (file)
index 0000000..f3b7738
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2012, 2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/clk/tegra.h>
+
+#include "clk.h"
+#include "clk-id.h"
+
+#define OSC_CTRL                       0x50
+#define OSC_CTRL_OSC_FREQ_SHIFT                28
+#define OSC_CTRL_PLL_REF_DIV_SHIFT     26
+
+int __init tegra_osc_clk_init(void __iomem *clk_base,
+                               struct tegra_clk *tegra_clks,
+                               unsigned long *input_freqs, int num,
+                               unsigned long *osc_freq,
+                               unsigned long *pll_ref_freq)
+{
+       struct clk *clk;
+       struct clk **dt_clk;
+       u32 val, pll_ref_div;
+       unsigned osc_idx;
+
+       val = readl_relaxed(clk_base + OSC_CTRL);
+       osc_idx = val >> OSC_CTRL_OSC_FREQ_SHIFT;
+
+       if (osc_idx < num)
+               *osc_freq = input_freqs[osc_idx];
+       else
+               *osc_freq = 0;
+
+       if (!*osc_freq) {
+               WARN_ON(1);
+               return -EINVAL;
+       }
+
+       dt_clk = tegra_lookup_dt_id(tegra_clk_clk_m, tegra_clks);
+       if (!dt_clk)
+               return 0;
+
+       clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT,
+                                     *osc_freq);
+       *dt_clk = clk;
+
+       /* pll_ref */
+       val = (val >> OSC_CTRL_PLL_REF_DIV_SHIFT) & 3;
+       pll_ref_div = 1 << val;
+       dt_clk = tegra_lookup_dt_id(tegra_clk_pll_ref, tegra_clks);
+       if (!dt_clk)
+               return 0;
+
+       clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m",
+                                       0, 1, pll_ref_div);
+       *dt_clk = clk;
+
+       if (pll_ref_freq)
+               *pll_ref_freq = *osc_freq / pll_ref_div;
+
+       return 0;
+}
+
+void __init tegra_fixed_clk_init(struct tegra_clk *tegra_clks)
+{
+       struct clk *clk;
+       struct clk **dt_clk;
+
+       /* clk_32k */
+       dt_clk = tegra_lookup_dt_id(tegra_clk_clk_32k, tegra_clks);
+       if (dt_clk) {
+               clk = clk_register_fixed_rate(NULL, "clk_32k", NULL,
+                                       CLK_IS_ROOT, 32768);
+               *dt_clk = clk;
+       }
+
+       /* clk_m_div2 */
+       dt_clk = tegra_lookup_dt_id(tegra_clk_clk_m_div2, tegra_clks);
+       if (dt_clk) {
+               clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m",
+                                       CLK_SET_RATE_PARENT, 1, 2);
+               *dt_clk = clk;
+       }
+
+       /* clk_m_div4 */
+       dt_clk = tegra_lookup_dt_id(tegra_clk_clk_m_div4, tegra_clks);
+       if (dt_clk) {
+               clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m",
+                                       CLK_SET_RATE_PARENT, 1, 4);
+               *dt_clk = clk;
+       }
+}
+
diff --git a/drivers/clk/tegra/clk-tegra-periph.c b/drivers/clk/tegra/clk-tegra-periph.c
new file mode 100644 (file)
index 0000000..5c35885
--- /dev/null
@@ -0,0 +1,674 @@
+/*
+ * Copyright (c) 2012, 2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/clk/tegra.h>
+
+#include "clk.h"
+#include "clk-id.h"
+
+#define CLK_SOURCE_I2S0 0x1d8
+#define CLK_SOURCE_I2S1 0x100
+#define CLK_SOURCE_I2S2 0x104
+#define CLK_SOURCE_NDFLASH 0x160
+#define CLK_SOURCE_I2S3 0x3bc
+#define CLK_SOURCE_I2S4 0x3c0
+#define CLK_SOURCE_SPDIF_OUT 0x108
+#define CLK_SOURCE_SPDIF_IN 0x10c
+#define CLK_SOURCE_PWM 0x110
+#define CLK_SOURCE_ADX 0x638
+#define CLK_SOURCE_ADX1 0x670
+#define CLK_SOURCE_AMX 0x63c
+#define CLK_SOURCE_AMX1 0x674
+#define CLK_SOURCE_HDA 0x428
+#define CLK_SOURCE_HDA2CODEC_2X 0x3e4
+#define CLK_SOURCE_SBC1 0x134
+#define CLK_SOURCE_SBC2 0x118
+#define CLK_SOURCE_SBC3 0x11c
+#define CLK_SOURCE_SBC4 0x1b4
+#define CLK_SOURCE_SBC5 0x3c8
+#define CLK_SOURCE_SBC6 0x3cc
+#define CLK_SOURCE_SATA_OOB 0x420
+#define CLK_SOURCE_SATA 0x424
+#define CLK_SOURCE_NDSPEED 0x3f8
+#define CLK_SOURCE_VFIR 0x168
+#define CLK_SOURCE_SDMMC1 0x150
+#define CLK_SOURCE_SDMMC2 0x154
+#define CLK_SOURCE_SDMMC3 0x1bc
+#define CLK_SOURCE_SDMMC4 0x164
+#define CLK_SOURCE_CVE 0x140
+#define CLK_SOURCE_TVO 0x188
+#define CLK_SOURCE_TVDAC 0x194
+#define CLK_SOURCE_VDE 0x1c8
+#define CLK_SOURCE_CSITE 0x1d4
+#define CLK_SOURCE_LA 0x1f8
+#define CLK_SOURCE_TRACE 0x634
+#define CLK_SOURCE_OWR 0x1cc
+#define CLK_SOURCE_NOR 0x1d0
+#define CLK_SOURCE_MIPI 0x174
+#define CLK_SOURCE_I2C1 0x124
+#define CLK_SOURCE_I2C2 0x198
+#define CLK_SOURCE_I2C3 0x1b8
+#define CLK_SOURCE_I2C4 0x3c4
+#define CLK_SOURCE_I2C5 0x128
+#define CLK_SOURCE_I2C6 0x65c
+#define CLK_SOURCE_UARTA 0x178
+#define CLK_SOURCE_UARTB 0x17c
+#define CLK_SOURCE_UARTC 0x1a0
+#define CLK_SOURCE_UARTD 0x1c0
+#define CLK_SOURCE_UARTE 0x1c4
+#define CLK_SOURCE_3D 0x158
+#define CLK_SOURCE_2D 0x15c
+#define CLK_SOURCE_MPE 0x170
+#define CLK_SOURCE_UARTE 0x1c4
+#define CLK_SOURCE_VI_SENSOR 0x1a8
+#define CLK_SOURCE_VI 0x148
+#define CLK_SOURCE_EPP 0x16c
+#define CLK_SOURCE_MSENC 0x1f0
+#define CLK_SOURCE_TSEC 0x1f4
+#define CLK_SOURCE_HOST1X 0x180
+#define CLK_SOURCE_HDMI 0x18c
+#define CLK_SOURCE_DISP1 0x138
+#define CLK_SOURCE_DISP2 0x13c
+#define CLK_SOURCE_CILAB 0x614
+#define CLK_SOURCE_CILCD 0x618
+#define CLK_SOURCE_CILE 0x61c
+#define CLK_SOURCE_DSIALP 0x620
+#define CLK_SOURCE_DSIBLP 0x624
+#define CLK_SOURCE_TSENSOR 0x3b8
+#define CLK_SOURCE_D_AUDIO 0x3d0
+#define CLK_SOURCE_DAM0 0x3d8
+#define CLK_SOURCE_DAM1 0x3dc
+#define CLK_SOURCE_DAM2 0x3e0
+#define CLK_SOURCE_ACTMON 0x3e8
+#define CLK_SOURCE_EXTERN1 0x3ec
+#define CLK_SOURCE_EXTERN2 0x3f0
+#define CLK_SOURCE_EXTERN3 0x3f4
+#define CLK_SOURCE_I2CSLOW 0x3fc
+#define CLK_SOURCE_SE 0x42c
+#define CLK_SOURCE_MSELECT 0x3b4
+#define CLK_SOURCE_DFLL_REF 0x62c
+#define CLK_SOURCE_DFLL_SOC 0x630
+#define CLK_SOURCE_SOC_THERM 0x644
+#define CLK_SOURCE_XUSB_HOST_SRC 0x600
+#define CLK_SOURCE_XUSB_FALCON_SRC 0x604
+#define CLK_SOURCE_XUSB_FS_SRC 0x608
+#define CLK_SOURCE_XUSB_SS_SRC 0x610
+#define CLK_SOURCE_XUSB_DEV_SRC 0x60c
+#define CLK_SOURCE_ISP 0x144
+#define CLK_SOURCE_SOR0 0x414
+#define CLK_SOURCE_DPAUX 0x418
+#define CLK_SOURCE_SATA_OOB 0x420
+#define CLK_SOURCE_SATA 0x424
+#define CLK_SOURCE_ENTROPY 0x628
+#define CLK_SOURCE_VI_SENSOR2 0x658
+#define CLK_SOURCE_HDMI_AUDIO 0x668
+#define CLK_SOURCE_VIC03 0x678
+#define CLK_SOURCE_CLK72MHZ 0x66c
+
+#define MASK(x) (BIT(x) - 1)
+
+#define MUX(_name, _parents, _offset,  \
+                           _clk_num, _gate_flags, _clk_id)     \
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
+                       30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP, \
+                       _clk_num,  _gate_flags, _clk_id, _parents##_idx, 0,\
+                       NULL)
+
+#define MUX_FLAGS(_name, _parents, _offset,\
+                           _clk_num, _gate_flags, _clk_id, flags)\
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
+                       30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\
+                       _clk_num, _gate_flags, _clk_id, _parents##_idx, flags,\
+                       NULL)
+
+#define MUX8(_name, _parents, _offset, \
+                            _clk_num, _gate_flags, _clk_id)    \
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
+                       29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\
+                       _clk_num, _gate_flags, _clk_id, _parents##_idx, 0,\
+                       NULL)
+
+#define MUX8_NOGATE_LOCK(_name, _parents, _offset, _clk_id, _lock)     \
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,     \
+                             29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\
+                             0, TEGRA_PERIPH_NO_GATE, _clk_id,\
+                             _parents##_idx, 0, _lock)
+
+#define INT(_name, _parents, _offset,  \
+                           _clk_num, _gate_flags, _clk_id)     \
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
+                       30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \
+                       TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,\
+                       _clk_id, _parents##_idx, 0, NULL)
+
+#define INT_FLAGS(_name, _parents, _offset,\
+                           _clk_num, _gate_flags, _clk_id, flags)\
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
+                       30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \
+                       TEGRA_DIVIDER_ROUND_UP, _clk_num,  _gate_flags,\
+                       _clk_id, _parents##_idx, flags, NULL)
+
+#define INT8(_name, _parents, _offset,\
+                           _clk_num, _gate_flags, _clk_id)     \
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
+                       29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \
+                       TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,\
+                       _clk_id, _parents##_idx, 0, NULL)
+
+#define UART(_name, _parents, _offset,\
+                            _clk_num, _clk_id)                 \
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
+                       30, MASK(2), 0, 0, 16, 1, TEGRA_DIVIDER_UART| \
+                       TEGRA_DIVIDER_ROUND_UP, _clk_num, 0, _clk_id,\
+                       _parents##_idx, 0, NULL)
+
+#define I2C(_name, _parents, _offset,\
+                            _clk_num, _clk_id)                 \
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
+                       30, MASK(2), 0, 0, 16, 0, TEGRA_DIVIDER_ROUND_UP,\
+                       _clk_num, 0, _clk_id, _parents##_idx, 0, NULL)
+
+#define XUSB(_name, _parents, _offset, \
+                            _clk_num, _gate_flags, _clk_id)     \
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset, \
+                       29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT| \
+                       TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,\
+                       _clk_id, _parents##_idx, 0, NULL)
+
+#define AUDIO(_name, _offset,  _clk_num,\
+                                _gate_flags, _clk_id)          \
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, mux_d_audio_clk,       \
+                       _offset, 16, 0xE01F, 0, 0, 8, 1,                \
+                       TEGRA_DIVIDER_ROUND_UP, _clk_num, _gate_flags,  \
+                       _clk_id, mux_d_audio_clk_idx, 0, NULL)
+
+#define NODIV(_name, _parents, _offset, \
+                             _mux_shift, _mux_mask, _clk_num, \
+                             _gate_flags, _clk_id, _lock)              \
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
+                       _mux_shift, _mux_mask, 0, 0, 0, 0, 0,\
+                       _clk_num, (_gate_flags) | TEGRA_PERIPH_NO_DIV,\
+                       _clk_id, _parents##_idx, 0, _lock)
+
+#define GATE(_name, _parent_name,      \
+                            _clk_num, _gate_flags,  _clk_id, _flags)   \
+       {                                                               \
+               .name = _name,                                          \
+               .clk_id = _clk_id,                                      \
+               .p.parent_name = _parent_name,                          \
+               .periph = TEGRA_CLK_PERIPH(0, 0, 0, 0, 0, 0, 0,         \
+                               _clk_num, _gate_flags, 0, NULL),        \
+               .flags = _flags                                         \
+       }
+
+#define PLLP_BASE 0xa0
+#define PLLP_MISC 0xac
+#define PLLP_OUTA 0xa4
+#define PLLP_OUTB 0xa8
+#define PLLP_OUTC 0x67c
+
+#define PLL_BASE_LOCK BIT(27)
+#define PLL_MISC_LOCK_ENABLE 18
+
+static DEFINE_SPINLOCK(PLLP_OUTA_lock);
+static DEFINE_SPINLOCK(PLLP_OUTB_lock);
+static DEFINE_SPINLOCK(PLLP_OUTC_lock);
+static DEFINE_SPINLOCK(sor0_lock);
+
+#define MUX_I2S_SPDIF(_id)                                             \
+static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { "pll_a_out0", \
+                                                          #_id, "pll_p",\
+                                                          "clk_m"};
+MUX_I2S_SPDIF(audio0)
+MUX_I2S_SPDIF(audio1)
+MUX_I2S_SPDIF(audio2)
+MUX_I2S_SPDIF(audio3)
+MUX_I2S_SPDIF(audio4)
+MUX_I2S_SPDIF(audio)
+
+#define mux_pllaout0_audio0_2x_pllp_clkm_idx NULL
+#define mux_pllaout0_audio1_2x_pllp_clkm_idx NULL
+#define mux_pllaout0_audio2_2x_pllp_clkm_idx NULL
+#define mux_pllaout0_audio3_2x_pllp_clkm_idx NULL
+#define mux_pllaout0_audio4_2x_pllp_clkm_idx NULL
+#define mux_pllaout0_audio_2x_pllp_clkm_idx NULL
+
+static const char *mux_pllp_pllc_pllm_clkm[] = {
+       "pll_p", "pll_c", "pll_m", "clk_m"
+};
+#define mux_pllp_pllc_pllm_clkm_idx NULL
+
+static const char *mux_pllp_pllc_pllm[] = { "pll_p", "pll_c", "pll_m" };
+#define mux_pllp_pllc_pllm_idx NULL
+
+static const char *mux_pllp_pllc_clk32_clkm[] = {
+       "pll_p", "pll_c", "clk_32k", "clk_m"
+};
+#define mux_pllp_pllc_clk32_clkm_idx NULL
+
+static const char *mux_plla_pllc_pllp_clkm[] = {
+       "pll_a_out0", "pll_c", "pll_p", "clk_m"
+};
+#define mux_plla_pllc_pllp_clkm_idx mux_pllp_pllc_pllm_clkm_idx
+
+static const char *mux_pllp_pllc2_c_c3_pllm_clkm[] = {
+       "pll_p", "pll_c2", "pll_c", "pll_c3", "pll_m", "clk_m"
+};
+static u32 mux_pllp_pllc2_c_c3_pllm_clkm_idx[] = {
+       [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6,
+};
+
+static const char *mux_pllp_clkm[] = {
+       "pll_p", "clk_m"
+};
+static u32 mux_pllp_clkm_idx[] = {
+       [0] = 0, [1] = 3,
+};
+
+static const char *mux_pllm_pllc2_c_c3_pllp_plla[] = {
+       "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0"
+};
+#define mux_pllm_pllc2_c_c3_pllp_plla_idx mux_pllp_pllc2_c_c3_pllm_clkm_idx
+
+static const char *mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = {
+       "pll_p", "pll_m", "pll_d_out0", "pll_a_out0", "pll_c",
+       "pll_d2_out0", "clk_m"
+};
+#define mux_pllp_pllm_plld_plla_pllc_plld2_clkm_idx NULL
+
+static const char *mux_pllm_pllc_pllp_plla[] = {
+       "pll_m", "pll_c", "pll_p", "pll_a_out0"
+};
+#define mux_pllm_pllc_pllp_plla_idx mux_pllp_pllc_pllm_clkm_idx
+
+static const char *mux_pllp_pllc_clkm[] = {
+       "pll_p", "pll_c", "pll_m"
+};
+static u32 mux_pllp_pllc_clkm_idx[] = {
+       [0] = 0, [1] = 1, [2] = 3,
+};
+
+static const char *mux_pllp_pllc_clkm_clk32[] = {
+       "pll_p", "pll_c", "clk_m", "clk_32k"
+};
+#define mux_pllp_pllc_clkm_clk32_idx NULL
+
+static const char *mux_plla_clk32_pllp_clkm_plle[] = {
+       "pll_a_out0", "clk_32k", "pll_p", "clk_m", "pll_e_out0"
+};
+#define mux_plla_clk32_pllp_clkm_plle_idx NULL
+
+static const char *mux_clkm_pllp_pllc_pllre[] = {
+       "clk_m", "pll_p", "pll_c", "pll_re_out"
+};
+static u32 mux_clkm_pllp_pllc_pllre_idx[] = {
+       [0] = 0, [1] = 1, [2] = 3, [3] = 5,
+};
+
+static const char *mux_clkm_48M_pllp_480M[] = {
+       "clk_m", "pll_u_48M", "pll_p", "pll_u_480M"
+};
+#define mux_clkm_48M_pllp_480M_idx NULL
+
+static const char *mux_clkm_pllre_clk32_480M_pllc_ref[] = {
+       "clk_m", "pll_re_out", "clk_32k", "pll_u_480M", "pll_c", "pll_ref"
+};
+static u32 mux_clkm_pllre_clk32_480M_pllc_ref_idx[] = {
+       [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 4, [5] = 7,
+};
+
+static const char *mux_d_audio_clk[] = {
+       "pll_a_out0", "pll_p", "clk_m", "spdif_in_sync", "i2s0_sync",
+       "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync",
+};
+static u32 mux_d_audio_clk_idx[] = {
+       [0] = 0, [1] = 0x8000, [2] = 0xc000, [3] = 0xE000, [4] = 0xE001,
+       [5] = 0xE002, [6] = 0xE003, [7] = 0xE004, [8] = 0xE005, [9] = 0xE007,
+};
+
+static const char *mux_pllp_plld_pllc_clkm[] = {
+       "pll_p", "pll_d_out0", "pll_c", "clk_m"
+};
+#define mux_pllp_plld_pllc_clkm_idx NULL
+static const char *mux_pllm_pllc_pllp_plla_clkm_pllc4[] = {
+       "pll_m", "pll_c", "pll_p", "pll_a_out0", "clk_m", "pll_c4",
+};
+static u32 mux_pllm_pllc_pllp_plla_clkm_pllc4_idx[] = {
+       [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 6, [5] = 7,
+};
+
+static const char *mux_pllp_clkm1[] = {
+       "pll_p", "clk_m",
+};
+#define mux_pllp_clkm1_idx NULL
+
+static const char *mux_pllp3_pllc_clkm[] = {
+       "pll_p_out3", "pll_c", "pll_c2", "clk_m",
+};
+#define mux_pllp3_pllc_clkm_idx NULL
+
+static const char *mux_pllm_pllc_pllp_plla_pllc2_c3_clkm[] = {
+       "pll_m", "pll_c", "pll_p", "pll_a", "pll_c2", "pll_c3", "clk_m"
+};
+static u32 mux_pllm_pllc_pllp_plla_pllc2_c3_clkm_idx[] = {
+       [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6,
+};
+
+static const char *mux_pllm_pllc2_c_c3_pllp_plla_pllc4[] = {
+       "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0", "pll_c4",
+};
+static u32 mux_pllm_pllc2_c_c3_pllp_plla_pllc4_idx[] = {
+       [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, [6] = 7,
+};
+
+static const char *mux_clkm_plldp_sor0lvds[] = {
+       "clk_m", "pll_dp", "sor0_lvds",
+};
+#define mux_clkm_plldp_sor0lvds_idx NULL
+
+static struct tegra_periph_init_data periph_clks[] = {
+       AUDIO("d_audio", CLK_SOURCE_D_AUDIO, 106, TEGRA_PERIPH_ON_APB, tegra_clk_d_audio),
+       AUDIO("dam0", CLK_SOURCE_DAM0, 108, TEGRA_PERIPH_ON_APB, tegra_clk_dam0),
+       AUDIO("dam1", CLK_SOURCE_DAM1, 109, TEGRA_PERIPH_ON_APB, tegra_clk_dam1),
+       AUDIO("dam2", CLK_SOURCE_DAM2, 110, TEGRA_PERIPH_ON_APB, tegra_clk_dam2),
+       I2C("i2c1", mux_pllp_clkm, CLK_SOURCE_I2C1, 12, tegra_clk_i2c1),
+       I2C("i2c2", mux_pllp_clkm, CLK_SOURCE_I2C2, 54, tegra_clk_i2c2),
+       I2C("i2c3", mux_pllp_clkm, CLK_SOURCE_I2C3, 67, tegra_clk_i2c3),
+       I2C("i2c4", mux_pllp_clkm, CLK_SOURCE_I2C4, 103, tegra_clk_i2c4),
+       I2C("i2c5", mux_pllp_clkm, CLK_SOURCE_I2C5, 47, tegra_clk_i2c5),
+       INT("vde", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VDE, 61, 0, tegra_clk_vde),
+       INT("vi", mux_pllm_pllc_pllp_plla, CLK_SOURCE_VI, 20, 0, tegra_clk_vi),
+       INT("epp", mux_pllm_pllc_pllp_plla, CLK_SOURCE_EPP, 19, 0, tegra_clk_epp),
+       INT("host1x", mux_pllm_pllc_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x),
+       INT("mpe", mux_pllm_pllc_pllp_plla, CLK_SOURCE_MPE, 60, 0, tegra_clk_mpe),
+       INT("2d", mux_pllm_pllc_pllp_plla, CLK_SOURCE_2D, 21, 0, tegra_clk_gr2d),
+       INT("3d", mux_pllm_pllc_pllp_plla, CLK_SOURCE_3D, 24, 0, tegra_clk_gr3d),
+       INT8("vde", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_VDE, 61, 0, tegra_clk_vde_8),
+       INT8("vi", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI, 20, 0, tegra_clk_vi_8),
+       INT8("vi", mux_pllm_pllc2_c_c3_pllp_plla_pllc4, CLK_SOURCE_VI, 20, 0, tegra_clk_vi_9),
+       INT8("epp", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_EPP, 19, 0, tegra_clk_epp_8),
+       INT8("msenc", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_MSENC, 91, TEGRA_PERIPH_WAR_1005168, tegra_clk_msenc),
+       INT8("tsec", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_TSEC, 83, 0, tegra_clk_tsec),
+       INT8("host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_8),
+       INT8("se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se),
+       INT8("2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, 0, tegra_clk_gr2d_8),
+       INT8("3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, 0, tegra_clk_gr3d_8),
+       INT8("vic03", mux_pllm_pllc_pllp_plla_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03),
+       INT_FLAGS("mselect", mux_pllp_clkm, CLK_SOURCE_MSELECT, 99, 0, tegra_clk_mselect, CLK_IGNORE_UNUSED),
+       MUX("i2s0", mux_pllaout0_audio0_2x_pllp_clkm, CLK_SOURCE_I2S0, 30, TEGRA_PERIPH_ON_APB, tegra_clk_i2s0),
+       MUX("i2s1", mux_pllaout0_audio1_2x_pllp_clkm, CLK_SOURCE_I2S1, 11, TEGRA_PERIPH_ON_APB, tegra_clk_i2s1),
+       MUX("i2s2", mux_pllaout0_audio2_2x_pllp_clkm, CLK_SOURCE_I2S2, 18, TEGRA_PERIPH_ON_APB, tegra_clk_i2s2),
+       MUX("i2s3", mux_pllaout0_audio3_2x_pllp_clkm, CLK_SOURCE_I2S3, 101, TEGRA_PERIPH_ON_APB, tegra_clk_i2s3),
+       MUX("i2s4", mux_pllaout0_audio4_2x_pllp_clkm, CLK_SOURCE_I2S4, 102, TEGRA_PERIPH_ON_APB, tegra_clk_i2s4),
+       MUX("spdif_out", mux_pllaout0_audio_2x_pllp_clkm, CLK_SOURCE_SPDIF_OUT, 10, TEGRA_PERIPH_ON_APB, tegra_clk_spdif_out),
+       MUX("spdif_in", mux_pllp_pllc_pllm, CLK_SOURCE_SPDIF_IN, 10, TEGRA_PERIPH_ON_APB, tegra_clk_spdif_in),
+       MUX("pwm", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_PWM, 17, TEGRA_PERIPH_ON_APB, tegra_clk_pwm),
+       MUX("adx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX, 154, TEGRA_PERIPH_ON_APB, tegra_clk_adx),
+       MUX("amx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX, 153, TEGRA_PERIPH_ON_APB, tegra_clk_amx),
+       MUX("hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA, 125, TEGRA_PERIPH_ON_APB, tegra_clk_hda),
+       MUX("hda2codec_2x", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, TEGRA_PERIPH_ON_APB, tegra_clk_hda2codec_2x),
+       MUX("vfir", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VFIR, 7, TEGRA_PERIPH_ON_APB, tegra_clk_vfir),
+       MUX("sdmmc1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, 0, tegra_clk_sdmmc1),
+       MUX("sdmmc2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, 0, tegra_clk_sdmmc2),
+       MUX("sdmmc3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, 0, tegra_clk_sdmmc3),
+       MUX("sdmmc4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, 0, tegra_clk_sdmmc4),
+       MUX("la", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_LA, 76, TEGRA_PERIPH_ON_APB, tegra_clk_la),
+       MUX("trace", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_TRACE, 77, TEGRA_PERIPH_ON_APB, tegra_clk_trace),
+       MUX("owr", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_OWR, 71, TEGRA_PERIPH_ON_APB, tegra_clk_owr),
+       MUX("nor", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NOR, 42, 0, tegra_clk_nor),
+       MUX("mipi", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_MIPI, 50, TEGRA_PERIPH_ON_APB, tegra_clk_mipi),
+       MUX("vi_sensor", mux_pllm_pllc_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor),
+       MUX("cilab", mux_pllp_pllc_clkm, CLK_SOURCE_CILAB, 144, 0, tegra_clk_cilab),
+       MUX("cilcd", mux_pllp_pllc_clkm, CLK_SOURCE_CILCD, 145, 0, tegra_clk_cilcd),
+       MUX("cile", mux_pllp_pllc_clkm, CLK_SOURCE_CILE, 146, 0, tegra_clk_cile),
+       MUX("dsialp", mux_pllp_pllc_clkm, CLK_SOURCE_DSIALP, 147, 0, tegra_clk_dsialp),
+       MUX("dsiblp", mux_pllp_pllc_clkm, CLK_SOURCE_DSIBLP, 148, 0, tegra_clk_dsiblp),
+       MUX("tsensor", mux_pllp_pllc_clkm_clk32, CLK_SOURCE_TSENSOR, 100, TEGRA_PERIPH_ON_APB, tegra_clk_tsensor),
+       MUX("actmon", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_ACTMON, 119, 0, tegra_clk_actmon),
+       MUX("dfll_ref", mux_pllp_clkm, CLK_SOURCE_DFLL_REF, 155, TEGRA_PERIPH_ON_APB, tegra_clk_dfll_ref),
+       MUX("dfll_soc", mux_pllp_clkm, CLK_SOURCE_DFLL_SOC, 155, TEGRA_PERIPH_ON_APB, tegra_clk_dfll_soc),
+       MUX("i2cslow", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_I2CSLOW, 81, TEGRA_PERIPH_ON_APB, tegra_clk_i2cslow),
+       MUX("sbc1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1),
+       MUX("sbc2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2),
+       MUX("sbc3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3),
+       MUX("sbc4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC4, 68, TEGRA_PERIPH_ON_APB, tegra_clk_sbc4),
+       MUX("sbc5", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC5, 104, TEGRA_PERIPH_ON_APB, tegra_clk_sbc5),
+       MUX("sbc6", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC6, 105, TEGRA_PERIPH_ON_APB, tegra_clk_sbc6),
+       MUX("cve", mux_pllp_plld_pllc_clkm, CLK_SOURCE_CVE, 49, 0, tegra_clk_cve),
+       MUX("tvo", mux_pllp_plld_pllc_clkm, CLK_SOURCE_TVO, 49, 0, tegra_clk_tvo),
+       MUX("tvdac", mux_pllp_plld_pllc_clkm, CLK_SOURCE_TVDAC, 53, 0, tegra_clk_tvdac),
+       MUX("ndflash", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NDFLASH, 13, TEGRA_PERIPH_ON_APB, tegra_clk_ndflash),
+       MUX("ndspeed", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NDSPEED, 80, TEGRA_PERIPH_ON_APB, tegra_clk_ndspeed),
+       MUX("sata_oob", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SATA_OOB, 123, TEGRA_PERIPH_ON_APB, tegra_clk_sata_oob),
+       MUX("sata", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SATA, 124, TEGRA_PERIPH_ON_APB, tegra_clk_sata),
+       MUX("adx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX1, 180, TEGRA_PERIPH_ON_APB, tegra_clk_adx1),
+       MUX("amx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX1, 185, TEGRA_PERIPH_ON_APB, tegra_clk_amx1),
+       MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2),
+       MUX8("sbc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1_8),
+       MUX8("sbc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2_8),
+       MUX8("sbc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_8),
+       MUX8("sbc4", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC4, 68, TEGRA_PERIPH_ON_APB, tegra_clk_sbc4_8),
+       MUX8("sbc5", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC5, 104, TEGRA_PERIPH_ON_APB, tegra_clk_sbc5_8),
+       MUX8("sbc6", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC6, 105, TEGRA_PERIPH_ON_APB, tegra_clk_sbc6_8),
+       MUX8("ndflash", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDFLASH, 13, TEGRA_PERIPH_ON_APB, tegra_clk_ndflash_8),
+       MUX8("ndspeed", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDSPEED, 80, TEGRA_PERIPH_ON_APB, tegra_clk_ndspeed_8),
+       MUX8("hdmi", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_HDMI, 51, 0, tegra_clk_hdmi),
+       MUX8("extern1", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN1, 120, 0, tegra_clk_extern1),
+       MUX8("extern2", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, 0, tegra_clk_extern2),
+       MUX8("extern3", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, 0, tegra_clk_extern3),
+       MUX8("soc_therm", mux_pllm_pllc_pllp_plla, CLK_SOURCE_SOC_THERM, 78, TEGRA_PERIPH_ON_APB, tegra_clk_soc_therm),
+       MUX8("vi_sensor", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor_8),
+       MUX8("isp", mux_pllm_pllc_pllp_plla_clkm_pllc4, CLK_SOURCE_ISP, 23, TEGRA_PERIPH_ON_APB, tegra_clk_isp_8),
+       MUX8("entropy", mux_pllp_clkm1, CLK_SOURCE_ENTROPY, 149,  0, tegra_clk_entropy),
+       MUX8("hdmi_audio", mux_pllp3_pllc_clkm, CLK_SOURCE_HDMI_AUDIO, 176, TEGRA_PERIPH_NO_RESET, tegra_clk_hdmi_audio),
+       MUX8("clk72mhz", mux_pllp3_pllc_clkm, CLK_SOURCE_CLK72MHZ, 177, TEGRA_PERIPH_NO_RESET, tegra_clk_clk72Mhz),
+       MUX8_NOGATE_LOCK("sor0_lvds", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_SOR0, tegra_clk_sor0_lvds, &sor0_lock),
+       MUX_FLAGS("csite", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_CSITE, 73, TEGRA_PERIPH_ON_APB, tegra_clk_csite, CLK_IGNORE_UNUSED),
+       NODIV("disp1", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP1, 29, 7, 27, 0, tegra_clk_disp1, NULL),
+       NODIV("disp2", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP2, 29, 7, 26, 0, tegra_clk_disp2, NULL),
+       NODIV("sor0", mux_clkm_plldp_sor0lvds, CLK_SOURCE_SOR0, 14, 3, 182, 0, tegra_clk_sor0, &sor0_lock),
+       UART("uarta", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTA, 6, tegra_clk_uarta),
+       UART("uartb", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, tegra_clk_uartb),
+       UART("uartc", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, tegra_clk_uartc),
+       UART("uartd", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, tegra_clk_uartd),
+       UART("uarte", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTE, 65, tegra_clk_uarte),
+       XUSB("xusb_host_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_host_src),
+       XUSB("xusb_falcon_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src),
+       XUSB("xusb_fs_src", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_fs_src),
+       XUSB("xusb_ss_src", mux_clkm_pllre_clk32_480M_pllc_ref, CLK_SOURCE_XUSB_SS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_ss_src),
+       XUSB("xusb_dev_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_DEV_SRC, 95, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_dev_src),
+};
+
+static struct tegra_periph_init_data gate_clks[] = {
+       GATE("rtc", "clk_32k", 4, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_rtc, 0),
+       GATE("timer", "clk_m", 5, 0, tegra_clk_timer, 0),
+       GATE("isp", "clk_m", 23, 0, tegra_clk_isp, 0),
+       GATE("vcp", "clk_m", 29, 0, tegra_clk_vcp, 0),
+       GATE("apbdma", "clk_m", 34, 0, tegra_clk_apbdma, 0),
+       GATE("kbc", "clk_32k", 36, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_kbc, 0),
+       GATE("fuse", "clk_m", 39, TEGRA_PERIPH_ON_APB, tegra_clk_fuse, 0),
+       GATE("fuse_burn", "clk_m", 39, TEGRA_PERIPH_ON_APB, tegra_clk_fuse_burn, 0),
+       GATE("kfuse", "clk_m", 40, TEGRA_PERIPH_ON_APB, tegra_clk_kfuse, 0),
+       GATE("apbif", "clk_m", 107, TEGRA_PERIPH_ON_APB, tegra_clk_apbif, 0),
+       GATE("hda2hdmi", "clk_m", 128, TEGRA_PERIPH_ON_APB, tegra_clk_hda2hdmi, 0),
+       GATE("bsea", "clk_m", 62, 0, tegra_clk_bsea, 0),
+       GATE("bsev", "clk_m", 63, 0, tegra_clk_bsev, 0),
+       GATE("mipi-cal", "clk_m", 56, 0, tegra_clk_mipi_cal, 0),
+       GATE("usbd", "clk_m", 22, 0, tegra_clk_usbd, 0),
+       GATE("usb2", "clk_m", 58, 0, tegra_clk_usb2, 0),
+       GATE("usb3", "clk_m", 59, 0, tegra_clk_usb3, 0),
+       GATE("csi", "pll_p_out3", 52, 0, tegra_clk_csi, 0),
+       GATE("afi", "clk_m", 72, 0, tegra_clk_afi, 0),
+       GATE("csus", "clk_m", 92, TEGRA_PERIPH_NO_RESET, tegra_clk_csus, 0),
+       GATE("dds", "clk_m", 150, TEGRA_PERIPH_ON_APB, tegra_clk_dds, 0),
+       GATE("dp2", "clk_m", 152, TEGRA_PERIPH_ON_APB, tegra_clk_dp2, 0),
+       GATE("dtv", "clk_m", 79, TEGRA_PERIPH_ON_APB, tegra_clk_dtv, 0),
+       GATE("xusb_host", "xusb_host_src", 89, 0, tegra_clk_xusb_host, 0),
+       GATE("xusb_ss", "xusb_ss_src", 156, 0, tegra_clk_xusb_ss, 0),
+       GATE("xusb_dev", "xusb_dev_src", 95, 0, tegra_clk_xusb_dev, 0),
+       GATE("dsia", "dsia_mux", 48, 0, tegra_clk_dsia, 0),
+       GATE("dsib", "dsib_mux", 82, 0, tegra_clk_dsib, 0),
+       GATE("emc", "emc_mux", 57, 0, tegra_clk_emc, CLK_IGNORE_UNUSED),
+       GATE("sata_cold", "clk_m", 129, TEGRA_PERIPH_ON_APB, tegra_clk_sata_cold, 0),
+       GATE("ispb", "clk_m", 3, 0, tegra_clk_ispb, 0),
+       GATE("vim2_clk", "clk_m", 11, 0, tegra_clk_vim2_clk, 0),
+       GATE("pcie", "clk_m", 70, 0, tegra_clk_pcie, 0),
+       GATE("dpaux", "clk_m", 181, 0, tegra_clk_dpaux, 0),
+       GATE("gpu", "pll_ref", 184, 0, tegra_clk_gpu, 0),
+};
+
+struct pll_out_data {
+       char *div_name;
+       char *pll_out_name;
+       u32 offset;
+       int clk_id;
+       u8 div_shift;
+       u8 div_flags;
+       u8 rst_shift;
+       spinlock_t *lock;
+};
+
+#define PLL_OUT(_num, _offset, _div_shift, _div_flags, _rst_shift, _id) \
+       {\
+               .div_name = "pll_p_out" #_num "_div",\
+               .pll_out_name = "pll_p_out" #_num,\
+               .offset = _offset,\
+               .div_shift = _div_shift,\
+               .div_flags = _div_flags | TEGRA_DIVIDER_FIXED |\
+                                       TEGRA_DIVIDER_ROUND_UP,\
+               .rst_shift = _rst_shift,\
+               .clk_id = tegra_clk_ ## _id,\
+               .lock = &_offset ##_lock,\
+       }
+
+static struct pll_out_data pllp_out_clks[] = {
+       PLL_OUT(1, PLLP_OUTA, 8, 0, 0, pll_p_out1),
+       PLL_OUT(2, PLLP_OUTA, 24, 0, 16, pll_p_out2),
+       PLL_OUT(2, PLLP_OUTA, 24, TEGRA_DIVIDER_INT, 16, pll_p_out2_int),
+       PLL_OUT(3, PLLP_OUTB, 8, 0, 0, pll_p_out3),
+       PLL_OUT(4, PLLP_OUTB, 24, 0, 16, pll_p_out4),
+       PLL_OUT(5, PLLP_OUTC, 24, 0, 16, pll_p_out5),
+};
+
+static void __init periph_clk_init(void __iomem *clk_base,
+                               struct tegra_clk *tegra_clks)
+{
+       int i;
+       struct clk *clk;
+       struct clk **dt_clk;
+
+       for (i = 0; i < ARRAY_SIZE(periph_clks); i++) {
+               struct tegra_clk_periph_regs *bank;
+               struct tegra_periph_init_data *data;
+
+               data = periph_clks + i;
+
+               dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks);
+               if (!dt_clk)
+                       continue;
+
+               bank = get_reg_bank(data->periph.gate.clk_num);
+               if (!bank)
+                       continue;
+
+               data->periph.gate.regs = bank;
+               clk = tegra_clk_register_periph(data->name,
+                       data->p.parent_names, data->num_parents,
+                       &data->periph, clk_base, data->offset,
+                       data->flags);
+               *dt_clk = clk;
+       }
+}
+
+static void __init gate_clk_init(void __iomem *clk_base,
+                               struct tegra_clk *tegra_clks)
+{
+       int i;
+       struct clk *clk;
+       struct clk **dt_clk;
+
+       for (i = 0; i < ARRAY_SIZE(gate_clks); i++) {
+               struct tegra_periph_init_data *data;
+
+               data = gate_clks + i;
+
+               dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks);
+               if (!dt_clk)
+                       continue;
+
+               clk = tegra_clk_register_periph_gate(data->name,
+                               data->p.parent_name, data->periph.gate.flags,
+                               clk_base, data->flags,
+                               data->periph.gate.clk_num,
+                               periph_clk_enb_refcnt);
+               *dt_clk = clk;
+       }
+}
+
+static void __init init_pllp(void __iomem *clk_base, void __iomem *pmc_base,
+                               struct tegra_clk *tegra_clks,
+                               struct tegra_clk_pll_params *pll_params)
+{
+       struct clk *clk;
+       struct clk **dt_clk;
+       int i;
+
+       dt_clk = tegra_lookup_dt_id(tegra_clk_pll_p, tegra_clks);
+       if (dt_clk) {
+               /* PLLP */
+               clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base,
+                                       pmc_base, 0, pll_params, NULL);
+               clk_register_clkdev(clk, "pll_p", NULL);
+               *dt_clk = clk;
+       }
+
+       for (i = 0; i < ARRAY_SIZE(pllp_out_clks); i++) {
+               struct pll_out_data *data;
+
+               data = pllp_out_clks + i;
+
+               dt_clk = tegra_lookup_dt_id(data->clk_id, tegra_clks);
+               if (!dt_clk)
+                       continue;
+
+               clk = tegra_clk_register_divider(data->div_name, "pll_p",
+                               clk_base + data->offset, 0, data->div_flags,
+                               data->div_shift, 8, 1, data->lock);
+               clk = tegra_clk_register_pll_out(data->pll_out_name,
+                               data->div_name, clk_base + data->offset,
+                               data->rst_shift + 1, data->rst_shift,
+                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
+                               data->lock);
+               *dt_clk = clk;
+       }
+}
+
+void __init tegra_periph_clk_init(void __iomem *clk_base,
+                       void __iomem *pmc_base, struct tegra_clk *tegra_clks,
+                       struct tegra_clk_pll_params *pll_params)
+{
+       init_pllp(clk_base, pmc_base, tegra_clks, pll_params);
+       periph_clk_init(clk_base, tegra_clks);
+       gate_clk_init(clk_base, tegra_clks);
+}
diff --git a/drivers/clk/tegra/clk-tegra-pmc.c b/drivers/clk/tegra/clk-tegra-pmc.c
new file mode 100644 (file)
index 0000000..08b21c1
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2012, 2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/clk/tegra.h>
+
+#include "clk.h"
+#include "clk-id.h"
+
+#define PMC_CLK_OUT_CNTRL 0x1a8
+#define PMC_DPD_PADS_ORIDE 0x1c
+#define PMC_DPD_PADS_ORIDE_BLINK_ENB 20
+#define PMC_CTRL 0
+#define PMC_CTRL_BLINK_ENB 7
+#define PMC_BLINK_TIMER 0x40
+
+struct pmc_clk_init_data {
+       char *mux_name;
+       char *gate_name;
+       const char **parents;
+       int num_parents;
+       int mux_id;
+       int gate_id;
+       char *dev_name;
+       u8 mux_shift;
+       u8 gate_shift;
+};
+
+#define PMC_CLK(_num, _mux_shift, _gate_shift)\
+       {\
+               .mux_name = "clk_out_" #_num "_mux",\
+               .gate_name = "clk_out_" #_num,\
+               .parents = clk_out ##_num ##_parents,\
+               .num_parents = ARRAY_SIZE(clk_out ##_num ##_parents),\
+               .mux_id = tegra_clk_clk_out_ ##_num ##_mux,\
+               .gate_id = tegra_clk_clk_out_ ##_num,\
+               .dev_name = "extern" #_num,\
+               .mux_shift = _mux_shift,\
+               .gate_shift = _gate_shift,\
+       }
+
+static DEFINE_SPINLOCK(clk_out_lock);
+
+static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2",
+       "clk_m_div4", "extern1",
+};
+
+static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2",
+       "clk_m_div4", "extern2",
+};
+
+static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2",
+       "clk_m_div4", "extern3",
+};
+
+static struct pmc_clk_init_data pmc_clks[] = {
+       PMC_CLK(1, 6, 2),
+       PMC_CLK(2, 14, 10),
+       PMC_CLK(3, 22, 18),
+};
+
+void __init tegra_pmc_clk_init(void __iomem *pmc_base,
+                               struct tegra_clk *tegra_clks)
+{
+       struct clk *clk;
+       struct clk **dt_clk;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(pmc_clks); i++) {
+               struct pmc_clk_init_data *data;
+
+               data = pmc_clks + i;
+
+               dt_clk = tegra_lookup_dt_id(data->mux_id, tegra_clks);
+               if (!dt_clk)
+                       continue;
+
+               clk = clk_register_mux(NULL, data->mux_name, data->parents,
+                               data->num_parents, CLK_SET_RATE_NO_REPARENT,
+                               pmc_base + PMC_CLK_OUT_CNTRL, data->mux_shift,
+                               3, 0, &clk_out_lock);
+               *dt_clk = clk;
+
+
+               dt_clk = tegra_lookup_dt_id(data->gate_id, tegra_clks);
+               if (!dt_clk)
+                       continue;
+
+               clk = clk_register_gate(NULL, data->gate_name, data->mux_name,
+                                       0, pmc_base + PMC_CLK_OUT_CNTRL,
+                                       data->gate_shift, 0, &clk_out_lock);
+               *dt_clk = clk;
+               clk_register_clkdev(clk, data->dev_name, data->gate_name);
+       }
+
+       /* blink */
+       writel_relaxed(0, pmc_base + PMC_BLINK_TIMER);
+       clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0,
+                               pmc_base + PMC_DPD_PADS_ORIDE,
+                               PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL);
+
+       dt_clk = tegra_lookup_dt_id(tegra_clk_blink, tegra_clks);
+       if (!dt_clk)
+               return;
+
+       clk = clk_register_gate(NULL, "blink", "blink_override", 0,
+                               pmc_base + PMC_CTRL,
+                               PMC_CTRL_BLINK_ENB, 0, NULL);
+       clk_register_clkdev(clk, "blink", NULL);
+       *dt_clk = clk;
+}
+
diff --git a/drivers/clk/tegra/clk-tegra-super-gen4.c b/drivers/clk/tegra/clk-tegra-super-gen4.c
new file mode 100644 (file)
index 0000000..05dce4a
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2012, 2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/clk/tegra.h>
+
+#include "clk.h"
+#include "clk-id.h"
+
+#define PLLX_BASE 0xe0
+#define PLLX_MISC 0xe4
+#define PLLX_MISC2 0x514
+#define PLLX_MISC3 0x518
+
+#define CCLKG_BURST_POLICY 0x368
+#define CCLKLP_BURST_POLICY 0x370
+#define SCLK_BURST_POLICY 0x028
+#define SYSTEM_CLK_RATE 0x030
+
+static DEFINE_SPINLOCK(sysrate_lock);
+
+static const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4",
+                              "pll_p", "pll_p_out2", "unused",
+                              "clk_32k", "pll_m_out1" };
+
+static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m",
+                                       "pll_p", "pll_p_out4", "unused",
+                                       "unused", "pll_x" };
+
+static const char *cclk_lp_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m",
+                                        "pll_p", "pll_p_out4", "unused",
+                                        "unused", "pll_x", "pll_x_out0" };
+
+static void __init tegra_sclk_init(void __iomem *clk_base,
+                               struct tegra_clk *tegra_clks)
+{
+       struct clk *clk;
+       struct clk **dt_clk;
+
+       /* SCLK */
+       dt_clk = tegra_lookup_dt_id(tegra_clk_sclk, tegra_clks);
+       if (dt_clk) {
+               clk = tegra_clk_register_super_mux("sclk", sclk_parents,
+                                               ARRAY_SIZE(sclk_parents),
+                                               CLK_SET_RATE_PARENT,
+                                               clk_base + SCLK_BURST_POLICY,
+                                               0, 4, 0, 0, NULL);
+               *dt_clk = clk;
+       }
+
+       /* HCLK */
+       dt_clk = tegra_lookup_dt_id(tegra_clk_hclk, tegra_clks);
+       if (dt_clk) {
+               clk = clk_register_divider(NULL, "hclk_div", "sclk", 0,
+                                  clk_base + SYSTEM_CLK_RATE, 4, 2, 0,
+                                  &sysrate_lock);
+               clk = clk_register_gate(NULL, "hclk", "hclk_div",
+                               CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
+                               clk_base + SYSTEM_CLK_RATE,
+                               7, CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
+               *dt_clk = clk;
+       }
+
+       /* PCLK */
+       dt_clk = tegra_lookup_dt_id(tegra_clk_pclk, tegra_clks);
+       if (!dt_clk)
+               return;
+
+       clk = clk_register_divider(NULL, "pclk_div", "hclk", 0,
+                                  clk_base + SYSTEM_CLK_RATE, 0, 2, 0,
+                                  &sysrate_lock);
+       clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT |
+                               CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE,
+                               3, CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
+       *dt_clk = clk;
+}
+
+void __init tegra_super_clk_gen4_init(void __iomem *clk_base,
+                               void __iomem *pmc_base,
+                               struct tegra_clk *tegra_clks,
+                               struct tegra_clk_pll_params *params)
+{
+       struct clk *clk;
+       struct clk **dt_clk;
+
+       /* CCLKG */
+       dt_clk = tegra_lookup_dt_id(tegra_clk_cclk_g, tegra_clks);
+       if (dt_clk) {
+               clk = tegra_clk_register_super_mux("cclk_g", cclk_g_parents,
+                                       ARRAY_SIZE(cclk_g_parents),
+                                       CLK_SET_RATE_PARENT,
+                                       clk_base + CCLKG_BURST_POLICY,
+                                       0, 4, 0, 0, NULL);
+               *dt_clk = clk;
+       }
+
+       /* CCLKLP */
+       dt_clk = tegra_lookup_dt_id(tegra_clk_cclk_lp, tegra_clks);
+       if (dt_clk) {
+               clk = tegra_clk_register_super_mux("cclk_lp", cclk_lp_parents,
+                                       ARRAY_SIZE(cclk_lp_parents),
+                                       CLK_SET_RATE_PARENT,
+                                       clk_base + CCLKLP_BURST_POLICY,
+                                       0, 4, 8, 9, NULL);
+               *dt_clk = clk;
+       }
+
+       tegra_sclk_init(clk_base, tegra_clks);
+
+#if defined(CONFIG_ARCH_TEGRA_114_SOC) || defined(CONFIG_ARCH_TEGRA_124_SOC)
+       /* PLLX */
+       dt_clk = tegra_lookup_dt_id(tegra_clk_pll_x, tegra_clks);
+       if (!dt_clk)
+               return;
+
+       clk = tegra_clk_register_pllxc("pll_x", "pll_ref", clk_base,
+                       pmc_base, CLK_IGNORE_UNUSED, params, NULL);
+       *dt_clk = clk;
+
+       /* PLLX_OUT0 */
+
+       dt_clk = tegra_lookup_dt_id(tegra_clk_pll_x_out0, tegra_clks);
+       if (!dt_clk)
+               return;
+       clk = clk_register_fixed_factor(NULL, "pll_x_out0", "pll_x",
+                                       CLK_SET_RATE_PARENT, 1, 2);
+       *dt_clk = clk;
+#endif
+}
+
index 9467da7dee4918a60762700442d9685fc658ab3c..90d9d25f2228195308f328a9d7c05c1a5bbe5a40 100644 (file)
 #include <linux/delay.h>
 #include <linux/export.h>
 #include <linux/clk/tegra.h>
+#include <dt-bindings/clock/tegra114-car.h>
 
 #include "clk.h"
+#include "clk-id.h"
 
-#define RST_DEVICES_L                  0x004
-#define RST_DEVICES_H                  0x008
-#define RST_DEVICES_U                  0x00C
 #define RST_DFLL_DVCO                  0x2F4
-#define RST_DEVICES_V                  0x358
-#define RST_DEVICES_W                  0x35C
-#define RST_DEVICES_X                  0x28C
-#define RST_DEVICES_SET_L              0x300
-#define RST_DEVICES_CLR_L              0x304
-#define RST_DEVICES_SET_H              0x308
-#define RST_DEVICES_CLR_H              0x30c
-#define RST_DEVICES_SET_U              0x310
-#define RST_DEVICES_CLR_U              0x314
-#define RST_DEVICES_SET_V              0x430
-#define RST_DEVICES_CLR_V              0x434
-#define RST_DEVICES_SET_W              0x438
-#define RST_DEVICES_CLR_W              0x43c
 #define CPU_FINETRIM_SELECT            0x4d4   /* override default prop dlys */
 #define CPU_FINETRIM_DR                        0x4d8   /* rise->rise prop dly A */
 #define CPU_FINETRIM_R                 0x4e4   /* rise->rise prop dly inc A */
-#define RST_DEVICES_NUM                        5
 
 /* RST_DFLL_DVCO bitfields */
 #define DVFS_DFLL_RESET_SHIFT          0
 #define CPU_FINETRIM_R_FCPU_6_SHIFT    10              /* ftop */
 #define CPU_FINETRIM_R_FCPU_6_MASK     (0x3 << CPU_FINETRIM_R_FCPU_6_SHIFT)
 
-#define CLK_OUT_ENB_L                  0x010
-#define CLK_OUT_ENB_H                  0x014
-#define CLK_OUT_ENB_U                  0x018
-#define CLK_OUT_ENB_V                  0x360
-#define CLK_OUT_ENB_W                  0x364
-#define CLK_OUT_ENB_X                  0x280
-#define CLK_OUT_ENB_SET_L              0x320
-#define CLK_OUT_ENB_CLR_L              0x324
-#define CLK_OUT_ENB_SET_H              0x328
-#define CLK_OUT_ENB_CLR_H              0x32c
-#define CLK_OUT_ENB_SET_U              0x330
-#define CLK_OUT_ENB_CLR_U              0x334
-#define CLK_OUT_ENB_SET_V              0x440
-#define CLK_OUT_ENB_CLR_V              0x444
-#define CLK_OUT_ENB_SET_W              0x448
-#define CLK_OUT_ENB_CLR_W              0x44c
-#define CLK_OUT_ENB_SET_X              0x284
-#define CLK_OUT_ENB_CLR_X              0x288
-#define CLK_OUT_ENB_NUM                        6
+#define TEGRA114_CLK_PERIPH_BANKS      5
 
 #define PLLC_BASE 0x80
 #define PLLC_MISC2 0x88
 #define PLLE_AUX 0x48c
 #define PLLC_OUT 0x84
 #define PLLM_OUT 0x94
-#define PLLP_OUTA 0xa4
-#define PLLP_OUTB 0xa8
-#define PLLA_OUT 0xb4
-
-#define AUDIO_SYNC_CLK_I2S0 0x4a0
-#define AUDIO_SYNC_CLK_I2S1 0x4a4
-#define AUDIO_SYNC_CLK_I2S2 0x4a8
-#define AUDIO_SYNC_CLK_I2S3 0x4ac
-#define AUDIO_SYNC_CLK_I2S4 0x4b0
-#define AUDIO_SYNC_CLK_SPDIF 0x4b4
-
-#define AUDIO_SYNC_DOUBLER 0x49c
-
-#define PMC_CLK_OUT_CNTRL 0x1a8
-#define PMC_DPD_PADS_ORIDE 0x1c
-#define PMC_DPD_PADS_ORIDE_BLINK_ENB 20
-#define PMC_CTRL 0
-#define PMC_CTRL_BLINK_ENB 7
-#define PMC_BLINK_TIMER 0x40
 
 #define OSC_CTRL                       0x50
 #define OSC_CTRL_OSC_FREQ_SHIFT                28
 #define PLLXC_SW_MAX_P                 6
 
 #define CCLKG_BURST_POLICY 0x368
-#define CCLKLP_BURST_POLICY 0x370
-#define SCLK_BURST_POLICY 0x028
-#define SYSTEM_CLK_RATE 0x030
 
 #define UTMIP_PLL_CFG2 0x488
 #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6)
 #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE    BIT(1)
 #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL       BIT(0)
 
-#define CLK_SOURCE_I2S0 0x1d8
-#define CLK_SOURCE_I2S1 0x100
-#define CLK_SOURCE_I2S2 0x104
-#define CLK_SOURCE_NDFLASH 0x160
-#define CLK_SOURCE_I2S3 0x3bc
-#define CLK_SOURCE_I2S4 0x3c0
-#define CLK_SOURCE_SPDIF_OUT 0x108
-#define CLK_SOURCE_SPDIF_IN 0x10c
-#define CLK_SOURCE_PWM 0x110
-#define CLK_SOURCE_ADX 0x638
-#define CLK_SOURCE_AMX 0x63c
-#define CLK_SOURCE_HDA 0x428
-#define CLK_SOURCE_HDA2CODEC_2X 0x3e4
-#define CLK_SOURCE_SBC1 0x134
-#define CLK_SOURCE_SBC2 0x118
-#define CLK_SOURCE_SBC3 0x11c
-#define CLK_SOURCE_SBC4 0x1b4
-#define CLK_SOURCE_SBC5 0x3c8
-#define CLK_SOURCE_SBC6 0x3cc
-#define CLK_SOURCE_SATA_OOB 0x420
-#define CLK_SOURCE_SATA 0x424
-#define CLK_SOURCE_NDSPEED 0x3f8
-#define CLK_SOURCE_VFIR 0x168
-#define CLK_SOURCE_SDMMC1 0x150
-#define CLK_SOURCE_SDMMC2 0x154
-#define CLK_SOURCE_SDMMC3 0x1bc
-#define CLK_SOURCE_SDMMC4 0x164
-#define CLK_SOURCE_VDE 0x1c8
 #define CLK_SOURCE_CSITE 0x1d4
-#define CLK_SOURCE_LA 0x1f8
-#define CLK_SOURCE_TRACE 0x634
-#define CLK_SOURCE_OWR 0x1cc
-#define CLK_SOURCE_NOR 0x1d0
-#define CLK_SOURCE_MIPI 0x174
-#define CLK_SOURCE_I2C1 0x124
-#define CLK_SOURCE_I2C2 0x198
-#define CLK_SOURCE_I2C3 0x1b8
-#define CLK_SOURCE_I2C4 0x3c4
-#define CLK_SOURCE_I2C5 0x128
-#define CLK_SOURCE_UARTA 0x178
-#define CLK_SOURCE_UARTB 0x17c
-#define CLK_SOURCE_UARTC 0x1a0
-#define CLK_SOURCE_UARTD 0x1c0
-#define CLK_SOURCE_UARTE 0x1c4
-#define CLK_SOURCE_UARTA_DBG 0x178
-#define CLK_SOURCE_UARTB_DBG 0x17c
-#define CLK_SOURCE_UARTC_DBG 0x1a0
-#define CLK_SOURCE_UARTD_DBG 0x1c0
-#define CLK_SOURCE_UARTE_DBG 0x1c4
-#define CLK_SOURCE_3D 0x158
-#define CLK_SOURCE_2D 0x15c
-#define CLK_SOURCE_VI_SENSOR 0x1a8
-#define CLK_SOURCE_VI 0x148
-#define CLK_SOURCE_EPP 0x16c
-#define CLK_SOURCE_MSENC 0x1f0
-#define CLK_SOURCE_TSEC 0x1f4
-#define CLK_SOURCE_HOST1X 0x180
-#define CLK_SOURCE_HDMI 0x18c
-#define CLK_SOURCE_DISP1 0x138
-#define CLK_SOURCE_DISP2 0x13c
-#define CLK_SOURCE_CILAB 0x614
-#define CLK_SOURCE_CILCD 0x618
-#define CLK_SOURCE_CILE 0x61c
-#define CLK_SOURCE_DSIALP 0x620
-#define CLK_SOURCE_DSIBLP 0x624
-#define CLK_SOURCE_TSENSOR 0x3b8
-#define CLK_SOURCE_D_AUDIO 0x3d0
-#define CLK_SOURCE_DAM0 0x3d8
-#define CLK_SOURCE_DAM1 0x3dc
-#define CLK_SOURCE_DAM2 0x3e0
-#define CLK_SOURCE_ACTMON 0x3e8
-#define CLK_SOURCE_EXTERN1 0x3ec
-#define CLK_SOURCE_EXTERN2 0x3f0
-#define CLK_SOURCE_EXTERN3 0x3f4
-#define CLK_SOURCE_I2CSLOW 0x3fc
-#define CLK_SOURCE_SE 0x42c
-#define CLK_SOURCE_MSELECT 0x3b4
-#define CLK_SOURCE_DFLL_REF 0x62c
-#define CLK_SOURCE_DFLL_SOC 0x630
-#define CLK_SOURCE_SOC_THERM 0x644
-#define CLK_SOURCE_XUSB_HOST_SRC 0x600
-#define CLK_SOURCE_XUSB_FALCON_SRC 0x604
-#define CLK_SOURCE_XUSB_FS_SRC 0x608
 #define CLK_SOURCE_XUSB_SS_SRC 0x610
-#define CLK_SOURCE_XUSB_DEV_SRC 0x60c
 #define CLK_SOURCE_EMC 0x19c
 
 /* PLLM override registers */
@@ -298,19 +160,13 @@ static struct cpu_clk_suspend_context {
 } tegra114_cpu_clk_sctx;
 #endif
 
-static int periph_clk_enb_refcnt[CLK_OUT_ENB_NUM * 32];
-
 static void __iomem *clk_base;
 static void __iomem *pmc_base;
 
 static DEFINE_SPINLOCK(pll_d_lock);
 static DEFINE_SPINLOCK(pll_d2_lock);
 static DEFINE_SPINLOCK(pll_u_lock);
-static DEFINE_SPINLOCK(pll_div_lock);
 static DEFINE_SPINLOCK(pll_re_lock);
-static DEFINE_SPINLOCK(clk_doubler_lock);
-static DEFINE_SPINLOCK(clk_out_lock);
-static DEFINE_SPINLOCK(sysrate_lock);
 
 static struct div_nmp pllxc_nmp = {
        .divm_shift = 0,
@@ -370,6 +226,8 @@ static struct tegra_clk_pll_params pll_c_params = {
        .stepb_shift = 9,
        .pdiv_tohw = pllxc_p,
        .div_nmp = &pllxc_nmp,
+       .freq_table = pll_c_freq_table,
+       .flags = TEGRA_PLL_USE_LOCK,
 };
 
 static struct div_nmp pllcx_nmp = {
@@ -417,6 +275,8 @@ static struct tegra_clk_pll_params pll_c2_params = {
        .ext_misc_reg[0] = 0x4f0,
        .ext_misc_reg[1] = 0x4f4,
        .ext_misc_reg[2] = 0x4f8,
+       .freq_table = pll_cx_freq_table,
+       .flags = TEGRA_PLL_USE_LOCK,
 };
 
 static struct tegra_clk_pll_params pll_c3_params = {
@@ -437,6 +297,8 @@ static struct tegra_clk_pll_params pll_c3_params = {
        .ext_misc_reg[0] = 0x504,
        .ext_misc_reg[1] = 0x508,
        .ext_misc_reg[2] = 0x50c,
+       .freq_table = pll_cx_freq_table,
+       .flags = TEGRA_PLL_USE_LOCK,
 };
 
 static struct div_nmp pllm_nmp = {
@@ -483,6 +345,8 @@ static struct tegra_clk_pll_params pll_m_params = {
        .div_nmp = &pllm_nmp,
        .pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE,
        .pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE_2,
+       .freq_table = pll_m_freq_table,
+       .flags = TEGRA_PLL_USE_LOCK,
 };
 
 static struct div_nmp pllp_nmp = {
@@ -516,6 +380,9 @@ static struct tegra_clk_pll_params pll_p_params = {
        .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
        .lock_delay = 300,
        .div_nmp = &pllp_nmp,
+       .freq_table = pll_p_freq_table,
+       .flags = TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK,
+       .fixed_rate = 408000000,
 };
 
 static struct tegra_clk_pll_freq_table pll_a_freq_table[] = {
@@ -543,6 +410,8 @@ static struct tegra_clk_pll_params pll_a_params = {
        .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
        .lock_delay = 300,
        .div_nmp = &pllp_nmp,
+       .freq_table = pll_a_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
 };
 
 static struct tegra_clk_pll_freq_table pll_d_freq_table[] = {
@@ -579,6 +448,9 @@ static struct tegra_clk_pll_params pll_d_params = {
        .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
        .lock_delay = 1000,
        .div_nmp = &pllp_nmp,
+       .freq_table = pll_d_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
+                TEGRA_PLL_USE_LOCK,
 };
 
 static struct tegra_clk_pll_params pll_d2_params = {
@@ -594,6 +466,9 @@ static struct tegra_clk_pll_params pll_d2_params = {
        .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
        .lock_delay = 1000,
        .div_nmp = &pllp_nmp,
+       .freq_table = pll_d_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
+                TEGRA_PLL_USE_LOCK,
 };
 
 static struct pdiv_map pllu_p[] = {
@@ -634,6 +509,9 @@ static struct tegra_clk_pll_params pll_u_params = {
        .lock_delay = 1000,
        .pdiv_tohw = pllu_p,
        .div_nmp = &pllu_nmp,
+       .freq_table = pll_u_freq_table,
+       .flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
+                TEGRA_PLL_USE_LOCK,
 };
 
 static struct tegra_clk_pll_freq_table pll_x_freq_table[] = {
@@ -667,12 +545,15 @@ static struct tegra_clk_pll_params pll_x_params = {
        .stepb_shift = 24,
        .pdiv_tohw = pllxc_p,
        .div_nmp = &pllxc_nmp,
+       .freq_table = pll_x_freq_table,
+       .flags = TEGRA_PLL_USE_LOCK,
 };
 
 static struct tegra_clk_pll_freq_table pll_e_freq_table[] = {
        /* PLLE special case: use cpcon field to store cml divider value */
        {336000000, 100000000, 100, 21, 16, 11},
        {312000000, 100000000, 200, 26, 24, 13},
+       {12000000, 100000000, 200,  1,  24, 13},
        {0, 0, 0, 0, 0, 0},
 };
 
@@ -699,6 +580,9 @@ static struct tegra_clk_pll_params pll_e_params = {
        .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE,
        .lock_delay = 300,
        .div_nmp = &plle_nmp,
+       .freq_table = pll_e_freq_table,
+       .flags = TEGRA_PLL_FIXED,
+       .fixed_rate = 100000000,
 };
 
 static struct div_nmp pllre_nmp = {
@@ -725,53 +609,7 @@ static struct tegra_clk_pll_params pll_re_vco_params = {
        .iddq_reg = PLLRE_MISC,
        .iddq_bit_idx = PLLRE_IDDQ_BIT,
        .div_nmp = &pllre_nmp,
-};
-
-/* Peripheral clock registers */
-
-static struct tegra_clk_periph_regs periph_l_regs = {
-       .enb_reg = CLK_OUT_ENB_L,
-       .enb_set_reg = CLK_OUT_ENB_SET_L,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_L,
-       .rst_reg = RST_DEVICES_L,
-       .rst_set_reg = RST_DEVICES_SET_L,
-       .rst_clr_reg = RST_DEVICES_CLR_L,
-};
-
-static struct tegra_clk_periph_regs periph_h_regs = {
-       .enb_reg = CLK_OUT_ENB_H,
-       .enb_set_reg = CLK_OUT_ENB_SET_H,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_H,
-       .rst_reg = RST_DEVICES_H,
-       .rst_set_reg = RST_DEVICES_SET_H,
-       .rst_clr_reg = RST_DEVICES_CLR_H,
-};
-
-static struct tegra_clk_periph_regs periph_u_regs = {
-       .enb_reg = CLK_OUT_ENB_U,
-       .enb_set_reg = CLK_OUT_ENB_SET_U,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_U,
-       .rst_reg = RST_DEVICES_U,
-       .rst_set_reg = RST_DEVICES_SET_U,
-       .rst_clr_reg = RST_DEVICES_CLR_U,
-};
-
-static struct tegra_clk_periph_regs periph_v_regs = {
-       .enb_reg = CLK_OUT_ENB_V,
-       .enb_set_reg = CLK_OUT_ENB_SET_V,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_V,
-       .rst_reg = RST_DEVICES_V,
-       .rst_set_reg = RST_DEVICES_SET_V,
-       .rst_clr_reg = RST_DEVICES_CLR_V,
-};
-
-static struct tegra_clk_periph_regs periph_w_regs = {
-       .enb_reg = CLK_OUT_ENB_W,
-       .enb_set_reg = CLK_OUT_ENB_SET_W,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_W,
-       .rst_reg = RST_DEVICES_W,
-       .rst_set_reg = RST_DEVICES_SET_W,
-       .rst_clr_reg = RST_DEVICES_CLR_W,
+       .flags = TEGRA_PLL_USE_LOCK,
 };
 
 /* possible OSC frequencies in Hz */
@@ -787,120 +625,6 @@ static unsigned long tegra114_input_freq[] = {
 
 #define MASK(x) (BIT(x) - 1)
 
-#define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset,        \
-                           _clk_num, _regs, _gate_flags, _clk_id)      \
-       TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\
-                       30, MASK(2), 0, 0, 8, 1, 0, _regs, _clk_num,    \
-                       periph_clk_enb_refcnt, _gate_flags, _clk_id,    \
-                       _parents##_idx, 0)
-
-#define TEGRA_INIT_DATA_MUX_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\
-                           _clk_num, _regs, _gate_flags, _clk_id, flags)\
-       TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\
-                       30, MASK(2), 0, 0, 8, 1, 0, _regs, _clk_num,    \
-                       periph_clk_enb_refcnt, _gate_flags, _clk_id,    \
-                       _parents##_idx, flags)
-
-#define TEGRA_INIT_DATA_MUX8(_name, _con_id, _dev_id, _parents, _offset, \
-                            _clk_num, _regs, _gate_flags, _clk_id)     \
-       TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\
-                       29, MASK(3), 0, 0, 8, 1, 0, _regs, _clk_num,    \
-                       periph_clk_enb_refcnt, _gate_flags, _clk_id,    \
-                       _parents##_idx, 0)
-
-#define TEGRA_INIT_DATA_INT(_name, _con_id, _dev_id, _parents, _offset,        \
-                           _clk_num, _regs, _gate_flags, _clk_id)      \
-       TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\
-                       30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\
-                       _clk_num, periph_clk_enb_refcnt, _gate_flags,   \
-                       _clk_id, _parents##_idx, 0)
-
-#define TEGRA_INIT_DATA_INT_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\
-                           _clk_num, _regs, _gate_flags, _clk_id, flags)\
-       TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\
-                       30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\
-                       _clk_num, periph_clk_enb_refcnt, _gate_flags,   \
-                       _clk_id, _parents##_idx, flags)
-
-#define TEGRA_INIT_DATA_INT8(_name, _con_id, _dev_id, _parents, _offset,\
-                           _clk_num, _regs, _gate_flags, _clk_id)      \
-       TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\
-                       29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\
-                       _clk_num, periph_clk_enb_refcnt, _gate_flags,   \
-                       _clk_id, _parents##_idx, 0)
-
-#define TEGRA_INIT_DATA_UART(_name, _con_id, _dev_id, _parents, _offset,\
-                            _clk_num, _regs, _clk_id)                  \
-       TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\
-                       30, MASK(2), 0, 0, 16, 1, TEGRA_DIVIDER_UART, _regs,\
-                       _clk_num, periph_clk_enb_refcnt, 0, _clk_id,    \
-                       _parents##_idx, 0)
-
-#define TEGRA_INIT_DATA_I2C(_name, _con_id, _dev_id, _parents, _offset,\
-                            _clk_num, _regs, _clk_id)                  \
-       TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\
-                       30, MASK(2), 0, 0, 16, 0, 0, _regs, _clk_num,   \
-                       periph_clk_enb_refcnt, 0, _clk_id, _parents##_idx, 0)
-
-#define TEGRA_INIT_DATA_NODIV(_name, _con_id, _dev_id, _parents, _offset, \
-                             _mux_shift, _mux_mask, _clk_num, _regs,   \
-                             _gate_flags, _clk_id)                     \
-       TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\
-                       _mux_shift, _mux_mask, 0, 0, 0, 0, 0, _regs,    \
-                       _clk_num, periph_clk_enb_refcnt, _gate_flags,   \
-                       _clk_id, _parents##_idx, 0)
-
-#define TEGRA_INIT_DATA_XUSB(_name, _con_id, _dev_id, _parents, _offset, \
-                            _clk_num, _regs, _gate_flags, _clk_id)      \
-       TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset, \
-                       29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs, \
-                       _clk_num, periph_clk_enb_refcnt, _gate_flags,    \
-                       _clk_id, _parents##_idx, 0)
-
-#define TEGRA_INIT_DATA_AUDIO(_name, _con_id, _dev_id, _offset,  _clk_num,\
-                                _regs, _gate_flags, _clk_id)           \
-       TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, mux_d_audio_clk, \
-                       _offset, 16, 0xE01F, 0, 0, 8, 1, 0, _regs, _clk_num, \
-                       periph_clk_enb_refcnt, _gate_flags , _clk_id,   \
-                       mux_d_audio_clk_idx, 0)
-
-enum tegra114_clk {
-       rtc = 4, timer = 5, uarta = 6, sdmmc2 = 9, i2s1 = 11, i2c1 = 12,
-       ndflash = 13, sdmmc1 = 14, sdmmc4 = 15, pwm = 17, i2s2 = 18, epp = 19,
-       gr_2d = 21, usbd = 22, isp = 23, gr_3d = 24, disp2 = 26, disp1 = 27,
-       host1x = 28, vcp = 29, i2s0 = 30, apbdma = 34, kbc = 36, kfuse = 40,
-       sbc1 = 41, nor = 42, sbc2 = 44, sbc3 = 46, i2c5 = 47, dsia = 48,
-       mipi = 50, hdmi = 51, csi = 52, i2c2 = 54, uartc = 55, mipi_cal = 56,
-       emc, usb2, usb3, vde = 61, bsea = 62, bsev = 63, uartd = 65,
-       i2c3 = 67, sbc4 = 68, sdmmc3 = 69, owr = 71, csite = 73,
-       la = 76, trace = 77, soc_therm = 78, dtv = 79, ndspeed = 80,
-       i2cslow = 81, dsib = 82, tsec = 83, xusb_host = 89, msenc = 91,
-       csus = 92, mselect = 99, tsensor = 100, i2s3 = 101, i2s4 = 102,
-       i2c4 = 103, sbc5 = 104, sbc6 = 105, d_audio, apbif = 107, dam0, dam1,
-       dam2, hda2codec_2x = 111, audio0_2x = 113, audio1_2x, audio2_2x,
-       audio3_2x, audio4_2x, spdif_2x, actmon = 119, extern1 = 120,
-       extern2 = 121, extern3 = 122, hda = 125, se = 127, hda2hdmi = 128,
-       cilab = 144, cilcd = 145, cile = 146, dsialp = 147, dsiblp = 148,
-       dds = 150, dp2 = 152, amx = 153, adx = 154, xusb_ss = 156, uartb = 192,
-       vfir, spdif_in, spdif_out, vi, vi_sensor, fuse, fuse_burn, clk_32k,
-       clk_m, clk_m_div2, clk_m_div4, pll_ref, pll_c, pll_c_out1, pll_c2,
-       pll_c3, pll_m, pll_m_out1, pll_p, pll_p_out1, pll_p_out2, pll_p_out3,
-       pll_p_out4, pll_a, pll_a_out0, pll_d, pll_d_out0, pll_d2, pll_d2_out0,
-       pll_u, pll_u_480M, pll_u_60M, pll_u_48M, pll_u_12M, pll_x, pll_x_out0,
-       pll_re_vco, pll_re_out, pll_e_out0, spdif_in_sync, i2s0_sync,
-       i2s1_sync, i2s2_sync, i2s3_sync, i2s4_sync, vimclk_sync, audio0,
-       audio1, audio2, audio3, audio4, spdif, clk_out_1, clk_out_2, clk_out_3,
-       blink, xusb_host_src = 252, xusb_falcon_src, xusb_fs_src, xusb_ss_src,
-       xusb_dev_src, xusb_dev, xusb_hs_src, sclk, hclk, pclk, cclk_g, cclk_lp,
-       dfll_ref = 264, dfll_soc,
-
-       /* Mux clocks */
-
-       audio0_mux = 300, audio1_mux, audio2_mux, audio3_mux, audio4_mux,
-       spdif_mux, clk_out_1_mux, clk_out_2_mux, clk_out_3_mux, dsia_mux,
-       dsib_mux, clk_max,
-};
-
 struct utmi_clk_param {
        /* Oscillator Frequency in KHz */
        u32 osc_frequency;
@@ -934,122 +658,11 @@ static const struct utmi_clk_param utmi_parameters[] = {
 
 /* peripheral mux definitions */
 
-#define MUX_I2S_SPDIF(_id)                                             \
-static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { "pll_a_out0", \
-                                                          #_id, "pll_p",\
-                                                          "clk_m"};
-MUX_I2S_SPDIF(audio0)
-MUX_I2S_SPDIF(audio1)
-MUX_I2S_SPDIF(audio2)
-MUX_I2S_SPDIF(audio3)
-MUX_I2S_SPDIF(audio4)
-MUX_I2S_SPDIF(audio)
-
-#define mux_pllaout0_audio0_2x_pllp_clkm_idx NULL
-#define mux_pllaout0_audio1_2x_pllp_clkm_idx NULL
-#define mux_pllaout0_audio2_2x_pllp_clkm_idx NULL
-#define mux_pllaout0_audio3_2x_pllp_clkm_idx NULL
-#define mux_pllaout0_audio4_2x_pllp_clkm_idx NULL
-#define mux_pllaout0_audio_2x_pllp_clkm_idx NULL
-
-static const char *mux_pllp_pllc_pllm_clkm[] = {
-       "pll_p", "pll_c", "pll_m", "clk_m"
-};
-#define mux_pllp_pllc_pllm_clkm_idx NULL
-
-static const char *mux_pllp_pllc_pllm[] = { "pll_p", "pll_c", "pll_m" };
-#define mux_pllp_pllc_pllm_idx NULL
-
-static const char *mux_pllp_pllc_clk32_clkm[] = {
-       "pll_p", "pll_c", "clk_32k", "clk_m"
-};
-#define mux_pllp_pllc_clk32_clkm_idx NULL
-
-static const char *mux_plla_pllc_pllp_clkm[] = {
-       "pll_a_out0", "pll_c", "pll_p", "clk_m"
-};
-#define mux_plla_pllc_pllp_clkm_idx mux_pllp_pllc_pllm_clkm_idx
-
-static const char *mux_pllp_pllc2_c_c3_pllm_clkm[] = {
-       "pll_p", "pll_c2", "pll_c", "pll_c3", "pll_m", "clk_m"
-};
-static u32 mux_pllp_pllc2_c_c3_pllm_clkm_idx[] = {
-       [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6,
-};
-
-static const char *mux_pllp_clkm[] = {
-       "pll_p", "clk_m"
-};
-static u32 mux_pllp_clkm_idx[] = {
-       [0] = 0, [1] = 3,
-};
-
-static const char *mux_pllm_pllc2_c_c3_pllp_plla[] = {
-       "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0"
-};
-#define mux_pllm_pllc2_c_c3_pllp_plla_idx mux_pllp_pllc2_c_c3_pllm_clkm_idx
-
-static const char *mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = {
-       "pll_p", "pll_m", "pll_d_out0", "pll_a_out0", "pll_c",
-       "pll_d2_out0", "clk_m"
-};
-#define mux_pllp_pllm_plld_plla_pllc_plld2_clkm_idx NULL
-
-static const char *mux_pllm_pllc_pllp_plla[] = {
-       "pll_m", "pll_c", "pll_p", "pll_a_out0"
-};
-#define mux_pllm_pllc_pllp_plla_idx mux_pllp_pllc_pllm_clkm_idx
-
-static const char *mux_pllp_pllc_clkm[] = {
-       "pll_p", "pll_c", "pll_m"
-};
-static u32 mux_pllp_pllc_clkm_idx[] = {
-       [0] = 0, [1] = 1, [2] = 3,
-};
-
-static const char *mux_pllp_pllc_clkm_clk32[] = {
-       "pll_p", "pll_c", "clk_m", "clk_32k"
-};
-#define mux_pllp_pllc_clkm_clk32_idx NULL
-
-static const char *mux_plla_clk32_pllp_clkm_plle[] = {
-       "pll_a_out0", "clk_32k", "pll_p", "clk_m", "pll_e_out0"
-};
-#define mux_plla_clk32_pllp_clkm_plle_idx NULL
-
-static const char *mux_clkm_pllp_pllc_pllre[] = {
-       "clk_m", "pll_p", "pll_c", "pll_re_out"
-};
-static u32 mux_clkm_pllp_pllc_pllre_idx[] = {
-       [0] = 0, [1] = 1, [2] = 3, [3] = 5,
-};
-
-static const char *mux_clkm_48M_pllp_480M[] = {
-       "clk_m", "pll_u_48M", "pll_p", "pll_u_480M"
-};
-#define mux_clkm_48M_pllp_480M_idx NULL
-
-static const char *mux_clkm_pllre_clk32_480M_pllc_ref[] = {
-       "clk_m", "pll_re_out", "clk_32k", "pll_u_480M", "pll_c", "pll_ref"
-};
-static u32 mux_clkm_pllre_clk32_480M_pllc_ref_idx[] = {
-       [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 4, [5] = 7,
-};
-
 static const char *mux_plld_out0_plld2_out0[] = {
        "pll_d_out0", "pll_d2_out0",
 };
 #define mux_plld_out0_plld2_out0_idx NULL
 
-static const char *mux_d_audio_clk[] = {
-       "pll_a_out0", "pll_p", "clk_m", "spdif_in_sync", "i2s0_sync",
-       "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync",
-};
-static u32 mux_d_audio_clk_idx[] = {
-       [0] = 0, [1] = 0x8000, [2] = 0xc000, [3] = 0xE000, [4] = 0xE001,
-       [5] = 0xE002, [6] = 0xE003, [7] = 0xE004, [8] = 0xE005, [9] = 0xE007,
-};
-
 static const char *mux_pllmcp_clkm[] = {
        "pll_m_out0", "pll_c_out0", "pll_p_out0", "clk_m", "pll_m_ud",
 };
@@ -1064,8 +677,253 @@ static const struct clk_div_table pll_re_div_table[] = {
        { .val = 0, .div = 0 },
 };
 
-static struct clk *clks[clk_max];
-static struct clk_onecell_data clk_data;
+static struct tegra_clk tegra114_clks[tegra_clk_max] __initdata = {
+       [tegra_clk_rtc] = { .dt_id = TEGRA114_CLK_RTC, .present = true },
+       [tegra_clk_timer] = { .dt_id = TEGRA114_CLK_TIMER, .present = true },
+       [tegra_clk_uarta] = { .dt_id = TEGRA114_CLK_UARTA, .present = true },
+       [tegra_clk_uartd] = { .dt_id = TEGRA114_CLK_UARTD, .present = true },
+       [tegra_clk_sdmmc2] = { .dt_id = TEGRA114_CLK_SDMMC2, .present = true },
+       [tegra_clk_i2s1] = { .dt_id = TEGRA114_CLK_I2S1, .present = true },
+       [tegra_clk_i2c1] = { .dt_id = TEGRA114_CLK_I2C1, .present = true },
+       [tegra_clk_ndflash] = { .dt_id = TEGRA114_CLK_NDFLASH, .present = true },
+       [tegra_clk_sdmmc1] = { .dt_id = TEGRA114_CLK_SDMMC1, .present = true },
+       [tegra_clk_sdmmc4] = { .dt_id = TEGRA114_CLK_SDMMC4, .present = true },
+       [tegra_clk_pwm] = { .dt_id = TEGRA114_CLK_PWM, .present = true },
+       [tegra_clk_i2s0] = { .dt_id = TEGRA114_CLK_I2S0, .present = true },
+       [tegra_clk_i2s2] = { .dt_id = TEGRA114_CLK_I2S2, .present = true },
+       [tegra_clk_epp_8] = { .dt_id = TEGRA114_CLK_EPP, .present = true },
+       [tegra_clk_gr2d_8] = { .dt_id = TEGRA114_CLK_GR2D, .present = true },
+       [tegra_clk_usbd] = { .dt_id = TEGRA114_CLK_USBD, .present = true },
+       [tegra_clk_isp] = { .dt_id = TEGRA114_CLK_ISP, .present = true },
+       [tegra_clk_gr3d_8] = { .dt_id = TEGRA114_CLK_GR3D, .present = true },
+       [tegra_clk_disp2] = { .dt_id = TEGRA114_CLK_DISP2, .present = true },
+       [tegra_clk_disp1] = { .dt_id = TEGRA114_CLK_DISP1, .present = true },
+       [tegra_clk_host1x_8] = { .dt_id = TEGRA114_CLK_HOST1X, .present = true },
+       [tegra_clk_vcp] = { .dt_id = TEGRA114_CLK_VCP, .present = true },
+       [tegra_clk_apbdma] = { .dt_id = TEGRA114_CLK_APBDMA, .present = true },
+       [tegra_clk_kbc] = { .dt_id = TEGRA114_CLK_KBC, .present = true },
+       [tegra_clk_kfuse] = { .dt_id = TEGRA114_CLK_KFUSE, .present = true },
+       [tegra_clk_sbc1_8] = { .dt_id = TEGRA114_CLK_SBC1, .present = true },
+       [tegra_clk_nor] = { .dt_id = TEGRA114_CLK_NOR, .present = true },
+       [tegra_clk_sbc2_8] = { .dt_id = TEGRA114_CLK_SBC2, .present = true },
+       [tegra_clk_sbc3_8] = { .dt_id = TEGRA114_CLK_SBC3, .present = true },
+       [tegra_clk_i2c5] = { .dt_id = TEGRA114_CLK_I2C5, .present = true },
+       [tegra_clk_dsia] = { .dt_id = TEGRA114_CLK_DSIA, .present = true },
+       [tegra_clk_mipi] = { .dt_id = TEGRA114_CLK_MIPI, .present = true },
+       [tegra_clk_hdmi] = { .dt_id = TEGRA114_CLK_HDMI, .present = true },
+       [tegra_clk_csi] = { .dt_id = TEGRA114_CLK_CSI, .present = true },
+       [tegra_clk_i2c2] = { .dt_id = TEGRA114_CLK_I2C2, .present = true },
+       [tegra_clk_uartc] = { .dt_id = TEGRA114_CLK_UARTC, .present = true },
+       [tegra_clk_mipi_cal] = { .dt_id = TEGRA114_CLK_MIPI_CAL, .present = true },
+       [tegra_clk_emc] = { .dt_id = TEGRA114_CLK_EMC, .present = true },
+       [tegra_clk_usb2] = { .dt_id = TEGRA114_CLK_USB2, .present = true },
+       [tegra_clk_usb3] = { .dt_id = TEGRA114_CLK_USB3, .present = true },
+       [tegra_clk_vde_8] = { .dt_id = TEGRA114_CLK_VDE, .present = true },
+       [tegra_clk_bsea] = { .dt_id = TEGRA114_CLK_BSEA, .present = true },
+       [tegra_clk_bsev] = { .dt_id = TEGRA114_CLK_BSEV, .present = true },
+       [tegra_clk_i2c3] = { .dt_id = TEGRA114_CLK_I2C3, .present = true },
+       [tegra_clk_sbc4_8] = { .dt_id = TEGRA114_CLK_SBC4, .present = true },
+       [tegra_clk_sdmmc3] = { .dt_id = TEGRA114_CLK_SDMMC3, .present = true },
+       [tegra_clk_owr] = { .dt_id = TEGRA114_CLK_OWR, .present = true },
+       [tegra_clk_csite] = { .dt_id = TEGRA114_CLK_CSITE, .present = true },
+       [tegra_clk_la] = { .dt_id = TEGRA114_CLK_LA, .present = true },
+       [tegra_clk_trace] = { .dt_id = TEGRA114_CLK_TRACE, .present = true },
+       [tegra_clk_soc_therm] = { .dt_id = TEGRA114_CLK_SOC_THERM, .present = true },
+       [tegra_clk_dtv] = { .dt_id = TEGRA114_CLK_DTV, .present = true },
+       [tegra_clk_ndspeed] = { .dt_id = TEGRA114_CLK_NDSPEED, .present = true },
+       [tegra_clk_i2cslow] = { .dt_id = TEGRA114_CLK_I2CSLOW, .present = true },
+       [tegra_clk_dsib] = { .dt_id = TEGRA114_CLK_DSIB, .present = true },
+       [tegra_clk_tsec] = { .dt_id = TEGRA114_CLK_TSEC, .present = true },
+       [tegra_clk_xusb_host] = { .dt_id = TEGRA114_CLK_XUSB_HOST, .present = true },
+       [tegra_clk_msenc] = { .dt_id = TEGRA114_CLK_MSENC, .present = true },
+       [tegra_clk_csus] = { .dt_id = TEGRA114_CLK_CSUS, .present = true },
+       [tegra_clk_mselect] = { .dt_id = TEGRA114_CLK_MSELECT, .present = true },
+       [tegra_clk_tsensor] = { .dt_id = TEGRA114_CLK_TSENSOR, .present = true },
+       [tegra_clk_i2s3] = { .dt_id = TEGRA114_CLK_I2S3, .present = true },
+       [tegra_clk_i2s4] = { .dt_id = TEGRA114_CLK_I2S4, .present = true },
+       [tegra_clk_i2c4] = { .dt_id = TEGRA114_CLK_I2C4, .present = true },
+       [tegra_clk_sbc5_8] = { .dt_id = TEGRA114_CLK_SBC5, .present = true },
+       [tegra_clk_sbc6_8] = { .dt_id = TEGRA114_CLK_SBC6, .present = true },
+       [tegra_clk_d_audio] = { .dt_id = TEGRA114_CLK_D_AUDIO, .present = true },
+       [tegra_clk_apbif] = { .dt_id = TEGRA114_CLK_APBIF, .present = true },
+       [tegra_clk_dam0] = { .dt_id = TEGRA114_CLK_DAM0, .present = true },
+       [tegra_clk_dam1] = { .dt_id = TEGRA114_CLK_DAM1, .present = true },
+       [tegra_clk_dam2] = { .dt_id = TEGRA114_CLK_DAM2, .present = true },
+       [tegra_clk_hda2codec_2x] = { .dt_id = TEGRA114_CLK_HDA2CODEC_2X, .present = true },
+       [tegra_clk_audio0_2x] = { .dt_id = TEGRA114_CLK_AUDIO0_2X, .present = true },
+       [tegra_clk_audio1_2x] = { .dt_id = TEGRA114_CLK_AUDIO1_2X, .present = true },
+       [tegra_clk_audio2_2x] = { .dt_id = TEGRA114_CLK_AUDIO2_2X, .present = true },
+       [tegra_clk_audio3_2x] = { .dt_id = TEGRA114_CLK_AUDIO3_2X, .present = true },
+       [tegra_clk_audio4_2x] = { .dt_id = TEGRA114_CLK_AUDIO4_2X, .present = true },
+       [tegra_clk_spdif_2x] = { .dt_id = TEGRA114_CLK_SPDIF_2X, .present = true },
+       [tegra_clk_actmon] = { .dt_id = TEGRA114_CLK_ACTMON, .present = true },
+       [tegra_clk_extern1] = { .dt_id = TEGRA114_CLK_EXTERN1, .present = true },
+       [tegra_clk_extern2] = { .dt_id = TEGRA114_CLK_EXTERN2, .present = true },
+       [tegra_clk_extern3] = { .dt_id = TEGRA114_CLK_EXTERN3, .present = true },
+       [tegra_clk_hda] = { .dt_id = TEGRA114_CLK_HDA, .present = true },
+       [tegra_clk_se] = { .dt_id = TEGRA114_CLK_SE, .present = true },
+       [tegra_clk_hda2hdmi] = { .dt_id = TEGRA114_CLK_HDA2HDMI, .present = true },
+       [tegra_clk_cilab] = { .dt_id = TEGRA114_CLK_CILAB, .present = true },
+       [tegra_clk_cilcd] = { .dt_id = TEGRA114_CLK_CILCD, .present = true },
+       [tegra_clk_cile] = { .dt_id = TEGRA114_CLK_CILE, .present = true },
+       [tegra_clk_dsialp] = { .dt_id = TEGRA114_CLK_DSIALP, .present = true },
+       [tegra_clk_dsiblp] = { .dt_id = TEGRA114_CLK_DSIBLP, .present = true },
+       [tegra_clk_dds] = { .dt_id = TEGRA114_CLK_DDS, .present = true },
+       [tegra_clk_dp2] = { .dt_id = TEGRA114_CLK_DP2, .present = true },
+       [tegra_clk_amx] = { .dt_id = TEGRA114_CLK_AMX, .present = true },
+       [tegra_clk_adx] = { .dt_id = TEGRA114_CLK_ADX, .present = true },
+       [tegra_clk_xusb_ss] = { .dt_id = TEGRA114_CLK_XUSB_SS, .present = true },
+       [tegra_clk_uartb] = { .dt_id = TEGRA114_CLK_UARTB, .present = true },
+       [tegra_clk_vfir] = { .dt_id = TEGRA114_CLK_VFIR, .present = true },
+       [tegra_clk_spdif_in] = { .dt_id = TEGRA114_CLK_SPDIF_IN, .present = true },
+       [tegra_clk_spdif_out] = { .dt_id = TEGRA114_CLK_SPDIF_OUT, .present = true },
+       [tegra_clk_vi_8] = { .dt_id = TEGRA114_CLK_VI, .present = true },
+       [tegra_clk_vi_sensor_8] = { .dt_id = TEGRA114_CLK_VI_SENSOR, .present = true },
+       [tegra_clk_fuse] = { .dt_id = TEGRA114_CLK_FUSE, .present = true },
+       [tegra_clk_fuse_burn] = { .dt_id = TEGRA114_CLK_FUSE_BURN, .present = true },
+       [tegra_clk_clk_32k] = { .dt_id = TEGRA114_CLK_CLK_32K, .present = true },
+       [tegra_clk_clk_m] = { .dt_id = TEGRA114_CLK_CLK_M, .present = true },
+       [tegra_clk_clk_m_div2] = { .dt_id = TEGRA114_CLK_CLK_M_DIV2, .present = true },
+       [tegra_clk_clk_m_div4] = { .dt_id = TEGRA114_CLK_CLK_M_DIV4, .present = true },
+       [tegra_clk_pll_ref] = { .dt_id = TEGRA114_CLK_PLL_REF, .present = true },
+       [tegra_clk_pll_c] = { .dt_id = TEGRA114_CLK_PLL_C, .present = true },
+       [tegra_clk_pll_c_out1] = { .dt_id = TEGRA114_CLK_PLL_C_OUT1, .present = true },
+       [tegra_clk_pll_c2] = { .dt_id = TEGRA114_CLK_PLL_C2, .present = true },
+       [tegra_clk_pll_c3] = { .dt_id = TEGRA114_CLK_PLL_C3, .present = true },
+       [tegra_clk_pll_m] = { .dt_id = TEGRA114_CLK_PLL_M, .present = true },
+       [tegra_clk_pll_m_out1] = { .dt_id = TEGRA114_CLK_PLL_M_OUT1, .present = true },
+       [tegra_clk_pll_p] = { .dt_id = TEGRA114_CLK_PLL_P, .present = true },
+       [tegra_clk_pll_p_out1] = { .dt_id = TEGRA114_CLK_PLL_P_OUT1, .present = true },
+       [tegra_clk_pll_p_out2_int] = { .dt_id = TEGRA114_CLK_PLL_P_OUT2, .present = true },
+       [tegra_clk_pll_p_out3] = { .dt_id = TEGRA114_CLK_PLL_P_OUT3, .present = true },
+       [tegra_clk_pll_p_out4] = { .dt_id = TEGRA114_CLK_PLL_P_OUT4, .present = true },
+       [tegra_clk_pll_a] = { .dt_id = TEGRA114_CLK_PLL_A, .present = true },
+       [tegra_clk_pll_a_out0] = { .dt_id = TEGRA114_CLK_PLL_A_OUT0, .present = true },
+       [tegra_clk_pll_d] = { .dt_id = TEGRA114_CLK_PLL_D, .present = true },
+       [tegra_clk_pll_d_out0] = { .dt_id = TEGRA114_CLK_PLL_D_OUT0, .present = true },
+       [tegra_clk_pll_d2] = { .dt_id = TEGRA114_CLK_PLL_D2, .present = true },
+       [tegra_clk_pll_d2_out0] = { .dt_id = TEGRA114_CLK_PLL_D2_OUT0, .present = true },
+       [tegra_clk_pll_u] = { .dt_id = TEGRA114_CLK_PLL_U, .present = true },
+       [tegra_clk_pll_u_480m] = { .dt_id = TEGRA114_CLK_PLL_U_480M, .present = true },
+       [tegra_clk_pll_u_60m] = { .dt_id = TEGRA114_CLK_PLL_U_60M, .present = true },
+       [tegra_clk_pll_u_48m] = { .dt_id = TEGRA114_CLK_PLL_U_48M, .present = true },
+       [tegra_clk_pll_u_12m] = { .dt_id = TEGRA114_CLK_PLL_U_12M, .present = true },
+       [tegra_clk_pll_x] = { .dt_id = TEGRA114_CLK_PLL_X, .present = true },
+       [tegra_clk_pll_x_out0] = { .dt_id = TEGRA114_CLK_PLL_X_OUT0, .present = true },
+       [tegra_clk_pll_re_vco] = { .dt_id = TEGRA114_CLK_PLL_RE_VCO, .present = true },
+       [tegra_clk_pll_re_out] = { .dt_id = TEGRA114_CLK_PLL_RE_OUT, .present = true },
+       [tegra_clk_pll_e_out0] = { .dt_id = TEGRA114_CLK_PLL_E_OUT0, .present = true },
+       [tegra_clk_spdif_in_sync] = { .dt_id = TEGRA114_CLK_SPDIF_IN_SYNC, .present = true },
+       [tegra_clk_i2s0_sync] = { .dt_id = TEGRA114_CLK_I2S0_SYNC, .present = true },
+       [tegra_clk_i2s1_sync] = { .dt_id = TEGRA114_CLK_I2S1_SYNC, .present = true },
+       [tegra_clk_i2s2_sync] = { .dt_id = TEGRA114_CLK_I2S2_SYNC, .present = true },
+       [tegra_clk_i2s3_sync] = { .dt_id = TEGRA114_CLK_I2S3_SYNC, .present = true },
+       [tegra_clk_i2s4_sync] = { .dt_id = TEGRA114_CLK_I2S4_SYNC, .present = true },
+       [tegra_clk_vimclk_sync] = { .dt_id = TEGRA114_CLK_VIMCLK_SYNC, .present = true },
+       [tegra_clk_audio0] = { .dt_id = TEGRA114_CLK_AUDIO0, .present = true },
+       [tegra_clk_audio1] = { .dt_id = TEGRA114_CLK_AUDIO1, .present = true },
+       [tegra_clk_audio2] = { .dt_id = TEGRA114_CLK_AUDIO2, .present = true },
+       [tegra_clk_audio3] = { .dt_id = TEGRA114_CLK_AUDIO3, .present = true },
+       [tegra_clk_audio4] = { .dt_id = TEGRA114_CLK_AUDIO4, .present = true },
+       [tegra_clk_spdif] = { .dt_id = TEGRA114_CLK_SPDIF, .present = true },
+       [tegra_clk_clk_out_1] = { .dt_id = TEGRA114_CLK_CLK_OUT_1, .present = true },
+       [tegra_clk_clk_out_2] = { .dt_id = TEGRA114_CLK_CLK_OUT_2, .present = true },
+       [tegra_clk_clk_out_3] = { .dt_id = TEGRA114_CLK_CLK_OUT_3, .present = true },
+       [tegra_clk_blink] = { .dt_id = TEGRA114_CLK_BLINK, .present = true },
+       [tegra_clk_xusb_host_src] = { .dt_id = TEGRA114_CLK_XUSB_HOST_SRC, .present = true },
+       [tegra_clk_xusb_falcon_src] = { .dt_id = TEGRA114_CLK_XUSB_FALCON_SRC, .present = true },
+       [tegra_clk_xusb_fs_src] = { .dt_id = TEGRA114_CLK_XUSB_FS_SRC, .present = true },
+       [tegra_clk_xusb_ss_src] = { .dt_id = TEGRA114_CLK_XUSB_SS_SRC, .present = true },
+       [tegra_clk_xusb_dev_src] = { .dt_id = TEGRA114_CLK_XUSB_DEV_SRC, .present = true },
+       [tegra_clk_xusb_dev] = { .dt_id = TEGRA114_CLK_XUSB_DEV, .present = true },
+       [tegra_clk_xusb_hs_src] = { .dt_id = TEGRA114_CLK_XUSB_HS_SRC, .present = true },
+       [tegra_clk_sclk] = { .dt_id = TEGRA114_CLK_SCLK, .present = true },
+       [tegra_clk_hclk] = { .dt_id = TEGRA114_CLK_HCLK, .present = true },
+       [tegra_clk_pclk] = { .dt_id = TEGRA114_CLK_PCLK, .present = true },
+       [tegra_clk_cclk_g] = { .dt_id = TEGRA114_CLK_CCLK_G, .present = true },
+       [tegra_clk_cclk_lp] = { .dt_id = TEGRA114_CLK_CCLK_LP, .present = true },
+       [tegra_clk_dfll_ref] = { .dt_id = TEGRA114_CLK_DFLL_REF, .present = true },
+       [tegra_clk_dfll_soc] = { .dt_id = TEGRA114_CLK_DFLL_SOC, .present = true },
+       [tegra_clk_audio0_mux] = { .dt_id = TEGRA114_CLK_AUDIO0_MUX, .present = true },
+       [tegra_clk_audio1_mux] = { .dt_id = TEGRA114_CLK_AUDIO1_MUX, .present = true },
+       [tegra_clk_audio2_mux] = { .dt_id = TEGRA114_CLK_AUDIO2_MUX, .present = true },
+       [tegra_clk_audio3_mux] = { .dt_id = TEGRA114_CLK_AUDIO3_MUX, .present = true },
+       [tegra_clk_audio4_mux] = { .dt_id = TEGRA114_CLK_AUDIO4_MUX, .present = true },
+       [tegra_clk_spdif_mux] = { .dt_id = TEGRA114_CLK_SPDIF_MUX, .present = true },
+       [tegra_clk_clk_out_1_mux] = { .dt_id = TEGRA114_CLK_CLK_OUT_1_MUX, .present = true },
+       [tegra_clk_clk_out_2_mux] = { .dt_id = TEGRA114_CLK_CLK_OUT_2_MUX, .present = true },
+       [tegra_clk_clk_out_3_mux] = { .dt_id = TEGRA114_CLK_CLK_OUT_3_MUX, .present = true },
+       [tegra_clk_dsia_mux] = { .dt_id = TEGRA114_CLK_DSIA_MUX, .present = true },
+       [tegra_clk_dsib_mux] = { .dt_id = TEGRA114_CLK_DSIB_MUX, .present = true },
+};
+
+static struct tegra_devclk devclks[] __initdata = {
+       { .con_id = "clk_m", .dt_id = TEGRA114_CLK_CLK_M },
+       { .con_id = "pll_ref", .dt_id = TEGRA114_CLK_PLL_REF },
+       { .con_id = "clk_32k", .dt_id = TEGRA114_CLK_CLK_32K },
+       { .con_id = "clk_m_div2", .dt_id = TEGRA114_CLK_CLK_M_DIV2 },
+       { .con_id = "clk_m_div4", .dt_id = TEGRA114_CLK_CLK_M_DIV4 },
+       { .con_id = "pll_c", .dt_id = TEGRA114_CLK_PLL_C },
+       { .con_id = "pll_c_out1", .dt_id = TEGRA114_CLK_PLL_C_OUT1 },
+       { .con_id = "pll_c2", .dt_id = TEGRA114_CLK_PLL_C2 },
+       { .con_id = "pll_c3", .dt_id = TEGRA114_CLK_PLL_C3 },
+       { .con_id = "pll_p", .dt_id = TEGRA114_CLK_PLL_P },
+       { .con_id = "pll_p_out1", .dt_id = TEGRA114_CLK_PLL_P_OUT1 },
+       { .con_id = "pll_p_out2", .dt_id = TEGRA114_CLK_PLL_P_OUT2 },
+       { .con_id = "pll_p_out3", .dt_id = TEGRA114_CLK_PLL_P_OUT3 },
+       { .con_id = "pll_p_out4", .dt_id = TEGRA114_CLK_PLL_P_OUT4 },
+       { .con_id = "pll_m", .dt_id = TEGRA114_CLK_PLL_M },
+       { .con_id = "pll_m_out1", .dt_id = TEGRA114_CLK_PLL_M_OUT1 },
+       { .con_id = "pll_x", .dt_id = TEGRA114_CLK_PLL_X },
+       { .con_id = "pll_x_out0", .dt_id = TEGRA114_CLK_PLL_X_OUT0 },
+       { .con_id = "pll_u", .dt_id = TEGRA114_CLK_PLL_U },
+       { .con_id = "pll_u_480M", .dt_id = TEGRA114_CLK_PLL_U_480M },
+       { .con_id = "pll_u_60M", .dt_id = TEGRA114_CLK_PLL_U_60M },
+       { .con_id = "pll_u_48M", .dt_id = TEGRA114_CLK_PLL_U_48M },
+       { .con_id = "pll_u_12M", .dt_id = TEGRA114_CLK_PLL_U_12M },
+       { .con_id = "pll_d", .dt_id = TEGRA114_CLK_PLL_D },
+       { .con_id = "pll_d_out0", .dt_id = TEGRA114_CLK_PLL_D_OUT0 },
+       { .con_id = "pll_d2", .dt_id = TEGRA114_CLK_PLL_D2 },
+       { .con_id = "pll_d2_out0", .dt_id = TEGRA114_CLK_PLL_D2_OUT0 },
+       { .con_id = "pll_a", .dt_id = TEGRA114_CLK_PLL_A },
+       { .con_id = "pll_a_out0", .dt_id = TEGRA114_CLK_PLL_A_OUT0 },
+       { .con_id = "pll_re_vco", .dt_id = TEGRA114_CLK_PLL_RE_VCO },
+       { .con_id = "pll_re_out", .dt_id = TEGRA114_CLK_PLL_RE_OUT },
+       { .con_id = "pll_e_out0", .dt_id = TEGRA114_CLK_PLL_E_OUT0 },
+       { .con_id = "spdif_in_sync", .dt_id = TEGRA114_CLK_SPDIF_IN_SYNC },
+       { .con_id = "i2s0_sync", .dt_id = TEGRA114_CLK_I2S0_SYNC },
+       { .con_id = "i2s1_sync", .dt_id = TEGRA114_CLK_I2S1_SYNC },
+       { .con_id = "i2s2_sync", .dt_id = TEGRA114_CLK_I2S2_SYNC },
+       { .con_id = "i2s3_sync", .dt_id = TEGRA114_CLK_I2S3_SYNC },
+       { .con_id = "i2s4_sync", .dt_id = TEGRA114_CLK_I2S4_SYNC },
+       { .con_id = "vimclk_sync", .dt_id = TEGRA114_CLK_VIMCLK_SYNC },
+       { .con_id = "audio0", .dt_id = TEGRA114_CLK_AUDIO0 },
+       { .con_id = "audio1", .dt_id = TEGRA114_CLK_AUDIO1 },
+       { .con_id = "audio2", .dt_id = TEGRA114_CLK_AUDIO2 },
+       { .con_id = "audio3", .dt_id = TEGRA114_CLK_AUDIO3 },
+       { .con_id = "audio4", .dt_id = TEGRA114_CLK_AUDIO4 },
+       { .con_id = "spdif", .dt_id = TEGRA114_CLK_SPDIF },
+       { .con_id = "audio0_2x", .dt_id = TEGRA114_CLK_AUDIO0_2X },
+       { .con_id = "audio1_2x", .dt_id = TEGRA114_CLK_AUDIO1_2X },
+       { .con_id = "audio2_2x", .dt_id = TEGRA114_CLK_AUDIO2_2X },
+       { .con_id = "audio3_2x", .dt_id = TEGRA114_CLK_AUDIO3_2X },
+       { .con_id = "audio4_2x", .dt_id = TEGRA114_CLK_AUDIO4_2X },
+       { .con_id = "spdif_2x", .dt_id = TEGRA114_CLK_SPDIF_2X },
+       { .con_id = "extern1", .dev_id = "clk_out_1", .dt_id = TEGRA114_CLK_EXTERN1 },
+       { .con_id = "extern2", .dev_id = "clk_out_2", .dt_id = TEGRA114_CLK_EXTERN2 },
+       { .con_id = "extern3", .dev_id = "clk_out_3", .dt_id = TEGRA114_CLK_EXTERN3 },
+       { .con_id = "blink", .dt_id = TEGRA114_CLK_BLINK },
+       { .con_id = "cclk_g", .dt_id = TEGRA114_CLK_CCLK_G },
+       { .con_id = "cclk_lp", .dt_id = TEGRA114_CLK_CCLK_LP },
+       { .con_id = "sclk", .dt_id = TEGRA114_CLK_SCLK },
+       { .con_id = "hclk", .dt_id = TEGRA114_CLK_HCLK },
+       { .con_id = "pclk", .dt_id = TEGRA114_CLK_PCLK },
+       { .con_id = "fuse", .dt_id = TEGRA114_CLK_FUSE },
+       { .dev_id = "rtc-tegra", .dt_id = TEGRA114_CLK_RTC },
+       { .dev_id = "timer", .dt_id = TEGRA114_CLK_TIMER },
+};
+
+static struct clk **clks;
 
 static unsigned long osc_freq;
 static unsigned long pll_ref_freq;
@@ -1086,16 +944,14 @@ static int __init tegra114_osc_clk_init(void __iomem *clk_base)
        /* clk_m */
        clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT,
                                      osc_freq);
-       clk_register_clkdev(clk, "clk_m", NULL);
-       clks[clk_m] = clk;
+       clks[TEGRA114_CLK_CLK_M] = clk;
 
        /* pll_ref */
        val = (val >> OSC_CTRL_PLL_REF_DIV_SHIFT) & 3;
        pll_ref_div = 1 << val;
        clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m",
                                        CLK_SET_RATE_PARENT, 1, pll_ref_div);
-       clk_register_clkdev(clk, "pll_ref", NULL);
-       clks[pll_ref] = clk;
+       clks[TEGRA114_CLK_PLL_REF] = clk;
 
        pll_ref_freq = osc_freq / pll_ref_div;
 
@@ -1109,20 +965,17 @@ static void __init tegra114_fixed_clk_init(void __iomem *clk_base)
        /* clk_32k */
        clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT,
                                      32768);
-       clk_register_clkdev(clk, "clk_32k", NULL);
-       clks[clk_32k] = clk;
+       clks[TEGRA114_CLK_CLK_32K] = clk;
 
        /* clk_m_div2 */
        clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m",
                                        CLK_SET_RATE_PARENT, 1, 2);
-       clk_register_clkdev(clk, "clk_m_div2", NULL);
-       clks[clk_m_div2] = clk;
+       clks[TEGRA114_CLK_CLK_M_DIV2] = clk;
 
        /* clk_m_div4 */
        clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m",
                                        CLK_SET_RATE_PARENT, 1, 4);
-       clk_register_clkdev(clk, "clk_m_div4", NULL);
-       clks[clk_m_div4] = clk;
+       clks[TEGRA114_CLK_CLK_M_DIV4] = clk;
 
 }
 
@@ -1208,63 +1061,6 @@ static __init void tegra114_utmi_param_configure(void __iomem *clk_base)
        writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0);
 }
 
-static void __init _clip_vco_min(struct tegra_clk_pll_params *pll_params)
-{
-       pll_params->vco_min =
-               DIV_ROUND_UP(pll_params->vco_min, pll_ref_freq) * pll_ref_freq;
-}
-
-static int __init _setup_dynamic_ramp(struct tegra_clk_pll_params *pll_params,
-                                     void __iomem *clk_base)
-{
-       u32 val;
-       u32 step_a, step_b;
-
-       switch (pll_ref_freq) {
-       case 12000000:
-       case 13000000:
-       case 26000000:
-               step_a = 0x2B;
-               step_b = 0x0B;
-               break;
-       case 16800000:
-               step_a = 0x1A;
-               step_b = 0x09;
-               break;
-       case 19200000:
-               step_a = 0x12;
-               step_b = 0x08;
-               break;
-       default:
-               pr_err("%s: Unexpected reference rate %lu\n",
-                       __func__, pll_ref_freq);
-               WARN_ON(1);
-               return -EINVAL;
-       }
-
-       val = step_a << pll_params->stepa_shift;
-       val |= step_b << pll_params->stepb_shift;
-       writel_relaxed(val, clk_base + pll_params->dyn_ramp_reg);
-
-       return 0;
-}
-
-static void __init _init_iddq(struct tegra_clk_pll_params *pll_params,
-                             void __iomem *clk_base)
-{
-       u32 val, val_iddq;
-
-       val = readl_relaxed(clk_base + pll_params->base_reg);
-       val_iddq = readl_relaxed(clk_base + pll_params->iddq_reg);
-
-       if (val & BIT(30))
-               WARN_ON(val_iddq & BIT(pll_params->iddq_bit_idx));
-       else {
-               val_iddq |= BIT(pll_params->iddq_bit_idx);
-               writel_relaxed(val_iddq, clk_base + pll_params->iddq_reg);
-       }
-}
-
 static void __init tegra114_pll_init(void __iomem *clk_base,
                                     void __iomem *pmc)
 {
@@ -1272,104 +1068,34 @@ static void __init tegra114_pll_init(void __iomem *clk_base,
        struct clk *clk;
 
        /* PLLC */
-       _clip_vco_min(&pll_c_params);
-       if (_setup_dynamic_ramp(&pll_c_params, clk_base) >= 0) {
-               _init_iddq(&pll_c_params, clk_base);
-               clk = tegra_clk_register_pllxc("pll_c", "pll_ref", clk_base,
-                               pmc, 0, 0, &pll_c_params, TEGRA_PLL_USE_LOCK,
-                               pll_c_freq_table, NULL);
-               clk_register_clkdev(clk, "pll_c", NULL);
-               clks[pll_c] = clk;
-
-               /* PLLC_OUT1 */
-               clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c",
-                               clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP,
-                               8, 8, 1, NULL);
-               clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div",
-                                       clk_base + PLLC_OUT, 1, 0,
-                                       CLK_SET_RATE_PARENT, 0, NULL);
-               clk_register_clkdev(clk, "pll_c_out1", NULL);
-               clks[pll_c_out1] = clk;
-       }
+       clk = tegra_clk_register_pllxc("pll_c", "pll_ref", clk_base,
+                       pmc, 0, &pll_c_params, NULL);
+       clks[TEGRA114_CLK_PLL_C] = clk;
+
+       /* PLLC_OUT1 */
+       clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c",
+                       clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP,
+                       8, 8, 1, NULL);
+       clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div",
+                               clk_base + PLLC_OUT, 1, 0,
+                               CLK_SET_RATE_PARENT, 0, NULL);
+       clks[TEGRA114_CLK_PLL_C_OUT1] = clk;
 
        /* PLLC2 */
-       _clip_vco_min(&pll_c2_params);
-       clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0, 0,
-                            &pll_c2_params, TEGRA_PLL_USE_LOCK,
-                            pll_cx_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_c2", NULL);
-       clks[pll_c2] = clk;
+       clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0,
+                            &pll_c2_params, NULL);
+       clks[TEGRA114_CLK_PLL_C2] = clk;
 
        /* PLLC3 */
-       _clip_vco_min(&pll_c3_params);
-       clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0, 0,
-                            &pll_c3_params, TEGRA_PLL_USE_LOCK,
-                            pll_cx_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_c3", NULL);
-       clks[pll_c3] = clk;
-
-       /* PLLP */
-       clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base, pmc, 0,
-                           408000000, &pll_p_params,
-                           TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK,
-                           pll_p_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_p", NULL);
-       clks[pll_p] = clk;
-
-       /* PLLP_OUT1 */
-       clk = tegra_clk_register_divider("pll_p_out1_div", "pll_p",
-                               clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED |
-                               TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out1", "pll_p_out1_div",
-                               clk_base + PLLP_OUTA, 1, 0,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out1", NULL);
-       clks[pll_p_out1] = clk;
-
-       /* PLLP_OUT2 */
-       clk = tegra_clk_register_divider("pll_p_out2_div", "pll_p",
-                               clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED |
-                               TEGRA_DIVIDER_ROUND_UP | TEGRA_DIVIDER_INT, 24,
-                               8, 1, &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out2", "pll_p_out2_div",
-                               clk_base + PLLP_OUTA, 17, 16,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out2", NULL);
-       clks[pll_p_out2] = clk;
-
-       /* PLLP_OUT3 */
-       clk = tegra_clk_register_divider("pll_p_out3_div", "pll_p",
-                               clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED |
-                               TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out3", "pll_p_out3_div",
-                               clk_base + PLLP_OUTB, 1, 0,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out3", NULL);
-       clks[pll_p_out3] = clk;
-
-       /* PLLP_OUT4 */
-       clk = tegra_clk_register_divider("pll_p_out4_div", "pll_p",
-                               clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED |
-                               TEGRA_DIVIDER_ROUND_UP, 24, 8, 1,
-                               &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out4", "pll_p_out4_div",
-                               clk_base + PLLP_OUTB, 17, 16,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out4", NULL);
-       clks[pll_p_out4] = clk;
+       clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0,
+                            &pll_c3_params, NULL);
+       clks[TEGRA114_CLK_PLL_C3] = clk;
 
        /* PLLM */
-       _clip_vco_min(&pll_m_params);
        clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc,
-                            CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, 0,
-                            &pll_m_params, TEGRA_PLL_USE_LOCK,
-                            pll_m_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_m", NULL);
-       clks[pll_m] = clk;
+                            CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE,
+                            &pll_m_params, NULL);
+       clks[TEGRA114_CLK_PLL_M] = clk;
 
        /* PLLM_OUT1 */
        clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m",
@@ -1378,41 +1104,20 @@ static void __init tegra114_pll_init(void __iomem *clk_base,
        clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div",
                                clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED |
                                CLK_SET_RATE_PARENT, 0, NULL);
-       clk_register_clkdev(clk, "pll_m_out1", NULL);
-       clks[pll_m_out1] = clk;
+       clks[TEGRA114_CLK_PLL_M_OUT1] = clk;
 
        /* PLLM_UD */
        clk = clk_register_fixed_factor(NULL, "pll_m_ud", "pll_m",
                                        CLK_SET_RATE_PARENT, 1, 1);
 
-       /* PLLX */
-       _clip_vco_min(&pll_x_params);
-       if (_setup_dynamic_ramp(&pll_x_params, clk_base) >= 0) {
-               _init_iddq(&pll_x_params, clk_base);
-               clk = tegra_clk_register_pllxc("pll_x", "pll_ref", clk_base,
-                               pmc, CLK_IGNORE_UNUSED, 0, &pll_x_params,
-                               TEGRA_PLL_USE_LOCK, pll_x_freq_table, NULL);
-               clk_register_clkdev(clk, "pll_x", NULL);
-               clks[pll_x] = clk;
-       }
-
-       /* PLLX_OUT0 */
-       clk = clk_register_fixed_factor(NULL, "pll_x_out0", "pll_x",
-                                       CLK_SET_RATE_PARENT, 1, 2);
-       clk_register_clkdev(clk, "pll_x_out0", NULL);
-       clks[pll_x_out0] = clk;
-
        /* PLLU */
        val = readl(clk_base + pll_u_params.base_reg);
        val &= ~BIT(24); /* disable PLLU_OVERRIDE */
        writel(val, clk_base + pll_u_params.base_reg);
 
        clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0,
-                           0, &pll_u_params, TEGRA_PLLU |
-                           TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-                           TEGRA_PLL_USE_LOCK, pll_u_freq_table, &pll_u_lock);
-       clk_register_clkdev(clk, "pll_u", NULL);
-       clks[pll_u] = clk;
+                           &pll_u_params, &pll_u_lock);
+       clks[TEGRA114_CLK_PLL_U] = clk;
 
        tegra114_utmi_param_configure(clk_base);
 
@@ -1420,731 +1125,97 @@ static void __init tegra114_pll_init(void __iomem *clk_base,
        clk = clk_register_gate(NULL, "pll_u_480M", "pll_u",
                                CLK_SET_RATE_PARENT, clk_base + PLLU_BASE,
                                22, 0, &pll_u_lock);
-       clk_register_clkdev(clk, "pll_u_480M", NULL);
-       clks[pll_u_480M] = clk;
+       clks[TEGRA114_CLK_PLL_U_480M] = clk;
 
        /* PLLU_60M */
        clk = clk_register_fixed_factor(NULL, "pll_u_60M", "pll_u",
                                        CLK_SET_RATE_PARENT, 1, 8);
-       clk_register_clkdev(clk, "pll_u_60M", NULL);
-       clks[pll_u_60M] = clk;
+       clks[TEGRA114_CLK_PLL_U_60M] = clk;
 
        /* PLLU_48M */
        clk = clk_register_fixed_factor(NULL, "pll_u_48M", "pll_u",
                                        CLK_SET_RATE_PARENT, 1, 10);
-       clk_register_clkdev(clk, "pll_u_48M", NULL);
-       clks[pll_u_48M] = clk;
+       clks[TEGRA114_CLK_PLL_U_48M] = clk;
 
        /* PLLU_12M */
        clk = clk_register_fixed_factor(NULL, "pll_u_12M", "pll_u",
                                        CLK_SET_RATE_PARENT, 1, 40);
-       clk_register_clkdev(clk, "pll_u_12M", NULL);
-       clks[pll_u_12M] = clk;
+       clks[TEGRA114_CLK_PLL_U_12M] = clk;
 
        /* PLLD */
        clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0,
-                           0, &pll_d_params,
-                           TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-                           TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d_lock);
-       clk_register_clkdev(clk, "pll_d", NULL);
-       clks[pll_d] = clk;
+                           &pll_d_params, &pll_d_lock);
+       clks[TEGRA114_CLK_PLL_D] = clk;
 
        /* PLLD_OUT0 */
        clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d",
                                        CLK_SET_RATE_PARENT, 1, 2);
-       clk_register_clkdev(clk, "pll_d_out0", NULL);
-       clks[pll_d_out0] = clk;
+       clks[TEGRA114_CLK_PLL_D_OUT0] = clk;
 
        /* PLLD2 */
        clk = tegra_clk_register_pll("pll_d2", "pll_ref", clk_base, pmc, 0,
-                           0, &pll_d2_params,
-                           TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-                           TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d2_lock);
-       clk_register_clkdev(clk, "pll_d2", NULL);
-       clks[pll_d2] = clk;
+                           &pll_d2_params, &pll_d2_lock);
+       clks[TEGRA114_CLK_PLL_D2] = clk;
 
        /* PLLD2_OUT0 */
        clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2",
                                        CLK_SET_RATE_PARENT, 1, 2);
-       clk_register_clkdev(clk, "pll_d2_out0", NULL);
-       clks[pll_d2_out0] = clk;
-
-       /* PLLA */
-       clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, pmc, 0,
-                           0, &pll_a_params, TEGRA_PLL_HAS_CPCON |
-                           TEGRA_PLL_USE_LOCK, pll_a_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_a", NULL);
-       clks[pll_a] = clk;
-
-       /* PLLA_OUT0 */
-       clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a",
-                               clk_base + PLLA_OUT, 0, TEGRA_DIVIDER_ROUND_UP,
-                               8, 8, 1, NULL);
-       clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div",
-                               clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED |
-                               CLK_SET_RATE_PARENT, 0, NULL);
-       clk_register_clkdev(clk, "pll_a_out0", NULL);
-       clks[pll_a_out0] = clk;
+       clks[TEGRA114_CLK_PLL_D2_OUT0] = clk;
 
        /* PLLRE */
-       _clip_vco_min(&pll_re_vco_params);
        clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc,
-                            0, 0, &pll_re_vco_params, TEGRA_PLL_USE_LOCK,
-                            NULL, &pll_re_lock, pll_ref_freq);
-       clk_register_clkdev(clk, "pll_re_vco", NULL);
-       clks[pll_re_vco] = clk;
+                            0, &pll_re_vco_params, &pll_re_lock, pll_ref_freq);
+       clks[TEGRA114_CLK_PLL_RE_VCO] = clk;
 
        clk = clk_register_divider_table(NULL, "pll_re_out", "pll_re_vco", 0,
                                         clk_base + PLLRE_BASE, 16, 4, 0,
                                         pll_re_div_table, &pll_re_lock);
-       clk_register_clkdev(clk, "pll_re_out", NULL);
-       clks[pll_re_out] = clk;
+       clks[TEGRA114_CLK_PLL_RE_OUT] = clk;
 
        /* PLLE */
-       clk = tegra_clk_register_plle_tegra114("pll_e_out0", "pll_re_vco",
-                                     clk_base, 0, 100000000, &pll_e_params,
-                                     pll_e_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_e_out0", NULL);
-       clks[pll_e_out0] = clk;
-}
-
-static const char *mux_audio_sync_clk[] = { "spdif_in_sync", "i2s0_sync",
-       "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync",
-};
-
-static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2",
-       "clk_m_div4", "extern1",
-};
-
-static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2",
-       "clk_m_div4", "extern2",
-};
-
-static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2",
-       "clk_m_div4", "extern3",
-};
-
-static void __init tegra114_audio_clk_init(void __iomem *clk_base)
-{
-       struct clk *clk;
-
-       /* spdif_in_sync */
-       clk = tegra_clk_register_sync_source("spdif_in_sync", 24000000,
-                                            24000000);
-       clk_register_clkdev(clk, "spdif_in_sync", NULL);
-       clks[spdif_in_sync] = clk;
-
-       /* i2s0_sync */
-       clk = tegra_clk_register_sync_source("i2s0_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "i2s0_sync", NULL);
-       clks[i2s0_sync] = clk;
-
-       /* i2s1_sync */
-       clk = tegra_clk_register_sync_source("i2s1_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "i2s1_sync", NULL);
-       clks[i2s1_sync] = clk;
-
-       /* i2s2_sync */
-       clk = tegra_clk_register_sync_source("i2s2_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "i2s2_sync", NULL);
-       clks[i2s2_sync] = clk;
-
-       /* i2s3_sync */
-       clk = tegra_clk_register_sync_source("i2s3_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "i2s3_sync", NULL);
-       clks[i2s3_sync] = clk;
-
-       /* i2s4_sync */
-       clk = tegra_clk_register_sync_source("i2s4_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "i2s4_sync", NULL);
-       clks[i2s4_sync] = clk;
-
-       /* vimclk_sync */
-       clk = tegra_clk_register_sync_source("vimclk_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "vimclk_sync", NULL);
-       clks[vimclk_sync] = clk;
-
-       /* audio0 */
-       clk = clk_register_mux(NULL, "audio0_mux", mux_audio_sync_clk,
-                              ARRAY_SIZE(mux_audio_sync_clk),
-                              CLK_SET_RATE_NO_REPARENT,
-                              clk_base + AUDIO_SYNC_CLK_I2S0, 0, 3, 0,
-                              NULL);
-       clks[audio0_mux] = clk;
-       clk = clk_register_gate(NULL, "audio0", "audio0_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_I2S0, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "audio0", NULL);
-       clks[audio0] = clk;
-
-       /* audio1 */
-       clk = clk_register_mux(NULL, "audio1_mux", mux_audio_sync_clk,
-                              ARRAY_SIZE(mux_audio_sync_clk),
-                              CLK_SET_RATE_NO_REPARENT,
-                              clk_base + AUDIO_SYNC_CLK_I2S1, 0, 3, 0,
-                              NULL);
-       clks[audio1_mux] = clk;
-       clk = clk_register_gate(NULL, "audio1", "audio1_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_I2S1, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "audio1", NULL);
-       clks[audio1] = clk;
-
-       /* audio2 */
-       clk = clk_register_mux(NULL, "audio2_mux", mux_audio_sync_clk,
-                              ARRAY_SIZE(mux_audio_sync_clk),
-                              CLK_SET_RATE_NO_REPARENT,
-                              clk_base + AUDIO_SYNC_CLK_I2S2, 0, 3, 0,
-                              NULL);
-       clks[audio2_mux] = clk;
-       clk = clk_register_gate(NULL, "audio2", "audio2_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_I2S2, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "audio2", NULL);
-       clks[audio2] = clk;
-
-       /* audio3 */
-       clk = clk_register_mux(NULL, "audio3_mux", mux_audio_sync_clk,
-                              ARRAY_SIZE(mux_audio_sync_clk),
-                              CLK_SET_RATE_NO_REPARENT,
-                              clk_base + AUDIO_SYNC_CLK_I2S3, 0, 3, 0,
-                              NULL);
-       clks[audio3_mux] = clk;
-       clk = clk_register_gate(NULL, "audio3", "audio3_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_I2S3, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "audio3", NULL);
-       clks[audio3] = clk;
-
-       /* audio4 */
-       clk = clk_register_mux(NULL, "audio4_mux", mux_audio_sync_clk,
-                              ARRAY_SIZE(mux_audio_sync_clk),
-                              CLK_SET_RATE_NO_REPARENT,
-                              clk_base + AUDIO_SYNC_CLK_I2S4, 0, 3, 0,
-                              NULL);
-       clks[audio4_mux] = clk;
-       clk = clk_register_gate(NULL, "audio4", "audio4_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_I2S4, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "audio4", NULL);
-       clks[audio4] = clk;
-
-       /* spdif */
-       clk = clk_register_mux(NULL, "spdif_mux", mux_audio_sync_clk,
-                              ARRAY_SIZE(mux_audio_sync_clk),
-                              CLK_SET_RATE_NO_REPARENT,
-                              clk_base + AUDIO_SYNC_CLK_SPDIF, 0, 3, 0,
-                              NULL);
-       clks[spdif_mux] = clk;
-       clk = clk_register_gate(NULL, "spdif", "spdif_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_SPDIF, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "spdif", NULL);
-       clks[spdif] = clk;
-
-       /* audio0_2x */
-       clk = clk_register_fixed_factor(NULL, "audio0_doubler", "audio0",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("audio0_div", "audio0_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 24, 1,
-                               0, &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("audio0_2x", "audio0_div",
-                                 TEGRA_PERIPH_NO_RESET, clk_base,
-                                 CLK_SET_RATE_PARENT, 113, &periph_v_regs,
-                                 periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "audio0_2x", NULL);
-       clks[audio0_2x] = clk;
-
-       /* audio1_2x */
-       clk = clk_register_fixed_factor(NULL, "audio1_doubler", "audio1",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("audio1_div", "audio1_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 25, 1,
-                               0, &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("audio1_2x", "audio1_div",
-                                 TEGRA_PERIPH_NO_RESET, clk_base,
-                                 CLK_SET_RATE_PARENT, 114, &periph_v_regs,
-                                 periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "audio1_2x", NULL);
-       clks[audio1_2x] = clk;
-
-       /* audio2_2x */
-       clk = clk_register_fixed_factor(NULL, "audio2_doubler", "audio2",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("audio2_div", "audio2_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 26, 1,
-                               0, &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("audio2_2x", "audio2_div",
-                                 TEGRA_PERIPH_NO_RESET, clk_base,
-                                 CLK_SET_RATE_PARENT, 115, &periph_v_regs,
-                                 periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "audio2_2x", NULL);
-       clks[audio2_2x] = clk;
-
-       /* audio3_2x */
-       clk = clk_register_fixed_factor(NULL, "audio3_doubler", "audio3",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("audio3_div", "audio3_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 27, 1,
-                               0, &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("audio3_2x", "audio3_div",
-                                 TEGRA_PERIPH_NO_RESET, clk_base,
-                                 CLK_SET_RATE_PARENT, 116, &periph_v_regs,
-                                 periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "audio3_2x", NULL);
-       clks[audio3_2x] = clk;
-
-       /* audio4_2x */
-       clk = clk_register_fixed_factor(NULL, "audio4_doubler", "audio4",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("audio4_div", "audio4_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 28, 1,
-                               0, &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("audio4_2x", "audio4_div",
-                                 TEGRA_PERIPH_NO_RESET, clk_base,
-                                 CLK_SET_RATE_PARENT, 117, &periph_v_regs,
-                                 periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "audio4_2x", NULL);
-       clks[audio4_2x] = clk;
-
-       /* spdif_2x */
-       clk = clk_register_fixed_factor(NULL, "spdif_doubler", "spdif",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("spdif_div", "spdif_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 29, 1,
-                               0, &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("spdif_2x", "spdif_div",
-                                 TEGRA_PERIPH_NO_RESET, clk_base,
-                                 CLK_SET_RATE_PARENT, 118,
-                                 &periph_v_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "spdif_2x", NULL);
-       clks[spdif_2x] = clk;
-}
-
-static void __init tegra114_pmc_clk_init(void __iomem *pmc_base)
-{
-       struct clk *clk;
-
-       /* clk_out_1 */
-       clk = clk_register_mux(NULL, "clk_out_1_mux", clk_out1_parents,
-                              ARRAY_SIZE(clk_out1_parents),
-                              CLK_SET_RATE_NO_REPARENT,
-                              pmc_base + PMC_CLK_OUT_CNTRL, 6, 3, 0,
-                              &clk_out_lock);
-       clks[clk_out_1_mux] = clk;
-       clk = clk_register_gate(NULL, "clk_out_1", "clk_out_1_mux", 0,
-                               pmc_base + PMC_CLK_OUT_CNTRL, 2, 0,
-                               &clk_out_lock);
-       clk_register_clkdev(clk, "extern1", "clk_out_1");
-       clks[clk_out_1] = clk;
-
-       /* clk_out_2 */
-       clk = clk_register_mux(NULL, "clk_out_2_mux", clk_out2_parents,
-                              ARRAY_SIZE(clk_out2_parents),
-                              CLK_SET_RATE_NO_REPARENT,
-                              pmc_base + PMC_CLK_OUT_CNTRL, 14, 3, 0,
-                              &clk_out_lock);
-       clks[clk_out_2_mux] = clk;
-       clk = clk_register_gate(NULL, "clk_out_2", "clk_out_2_mux", 0,
-                               pmc_base + PMC_CLK_OUT_CNTRL, 10, 0,
-                               &clk_out_lock);
-       clk_register_clkdev(clk, "extern2", "clk_out_2");
-       clks[clk_out_2] = clk;
-
-       /* clk_out_3 */
-       clk = clk_register_mux(NULL, "clk_out_3_mux", clk_out3_parents,
-                              ARRAY_SIZE(clk_out3_parents),
-                              CLK_SET_RATE_NO_REPARENT,
-                              pmc_base + PMC_CLK_OUT_CNTRL, 22, 3, 0,
-                              &clk_out_lock);
-       clks[clk_out_3_mux] = clk;
-       clk = clk_register_gate(NULL, "clk_out_3", "clk_out_3_mux", 0,
-                               pmc_base + PMC_CLK_OUT_CNTRL, 18, 0,
-                               &clk_out_lock);
-       clk_register_clkdev(clk, "extern3", "clk_out_3");
-       clks[clk_out_3] = clk;
-
-       /* blink */
-       /* clear the blink timer register to directly output clk_32k */
-       writel_relaxed(0, pmc_base + PMC_BLINK_TIMER);
-       clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0,
-                               pmc_base + PMC_DPD_PADS_ORIDE,
-                               PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL);
-       clk = clk_register_gate(NULL, "blink", "blink_override", 0,
-                               pmc_base + PMC_CTRL,
-                               PMC_CTRL_BLINK_ENB, 0, NULL);
-       clk_register_clkdev(clk, "blink", NULL);
-       clks[blink] = clk;
-
+       clk = tegra_clk_register_plle_tegra114("pll_e_out0", "pll_ref",
+                                     clk_base, 0, &pll_e_params, NULL);
+       clks[TEGRA114_CLK_PLL_E_OUT0] = clk;
 }
 
-static const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4",
-                              "pll_p", "pll_p_out2", "unused",
-                              "clk_32k", "pll_m_out1" };
-
-static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m",
-                                       "pll_p", "pll_p_out4", "unused",
-                                       "unused", "pll_x" };
-
-static const char *cclk_lp_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m",
-                                        "pll_p", "pll_p_out4", "unused",
-                                        "unused", "pll_x", "pll_x_out0" };
-
-static void __init tegra114_super_clk_init(void __iomem *clk_base)
+static __init void tegra114_periph_clk_init(void __iomem *clk_base,
+                                           void __iomem *pmc_base)
 {
        struct clk *clk;
+       u32 val;
 
-       /* CCLKG */
-       clk = tegra_clk_register_super_mux("cclk_g", cclk_g_parents,
-                                       ARRAY_SIZE(cclk_g_parents),
-                                       CLK_SET_RATE_PARENT,
-                                       clk_base + CCLKG_BURST_POLICY,
-                                       0, 4, 0, 0, NULL);
-       clk_register_clkdev(clk, "cclk_g", NULL);
-       clks[cclk_g] = clk;
-
-       /* CCLKLP */
-       clk = tegra_clk_register_super_mux("cclk_lp", cclk_lp_parents,
-                                       ARRAY_SIZE(cclk_lp_parents),
-                                       CLK_SET_RATE_PARENT,
-                                       clk_base + CCLKLP_BURST_POLICY,
-                                       0, 4, 8, 9, NULL);
-       clk_register_clkdev(clk, "cclk_lp", NULL);
-       clks[cclk_lp] = clk;
-
-       /* SCLK */
-       clk = tegra_clk_register_super_mux("sclk", sclk_parents,
-                                       ARRAY_SIZE(sclk_parents),
-                                       CLK_SET_RATE_PARENT,
-                                       clk_base + SCLK_BURST_POLICY,
-                                       0, 4, 0, 0, NULL);
-       clk_register_clkdev(clk, "sclk", NULL);
-       clks[sclk] = clk;
-
-       /* HCLK */
-       clk = clk_register_divider(NULL, "hclk_div", "sclk", 0,
-                                  clk_base + SYSTEM_CLK_RATE, 4, 2, 0,
-                                  &sysrate_lock);
-       clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT |
-                               CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE,
-                               7, CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
-       clk_register_clkdev(clk, "hclk", NULL);
-       clks[hclk] = clk;
-
-       /* PCLK */
-       clk = clk_register_divider(NULL, "pclk_div", "hclk", 0,
-                                  clk_base + SYSTEM_CLK_RATE, 0, 2, 0,
-                                  &sysrate_lock);
-       clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT |
-                               CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE,
-                               3, CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
-       clk_register_clkdev(clk, "pclk", NULL);
-       clks[pclk] = clk;
-}
-
-static struct tegra_periph_init_data tegra_periph_clk_list[] = {
-       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),
-       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),
-       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),
-       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),
-       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),
-       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),
-       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),
-       TEGRA_INIT_DATA_MUX("pwm", NULL, "pwm", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_PWM, 17, &periph_l_regs, TEGRA_PERIPH_ON_APB, pwm),
-       TEGRA_INIT_DATA_MUX("adx", NULL, "adx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX, 154, &periph_w_regs, TEGRA_PERIPH_ON_APB, adx),
-       TEGRA_INIT_DATA_MUX("amx", NULL, "amx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX, 153, &periph_w_regs, TEGRA_PERIPH_ON_APB, amx),
-       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),
-       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),
-       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),
-       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),
-       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),
-       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),
-       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),
-       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),
-       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),
-       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),
-       TEGRA_INIT_DATA_MUX("vfir", NULL, "vfir", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VFIR, 7, &periph_l_regs, TEGRA_PERIPH_ON_APB, vfir),
-       TEGRA_INIT_DATA_MUX("sdmmc1", NULL, "sdhci-tegra.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, &periph_l_regs, 0, sdmmc1),
-       TEGRA_INIT_DATA_MUX("sdmmc2", NULL, "sdhci-tegra.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, &periph_l_regs, 0, sdmmc2),
-       TEGRA_INIT_DATA_MUX("sdmmc3", NULL, "sdhci-tegra.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, &periph_u_regs, 0, sdmmc3),
-       TEGRA_INIT_DATA_MUX("sdmmc4", NULL, "sdhci-tegra.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, &periph_l_regs, 0, sdmmc4),
-       TEGRA_INIT_DATA_INT("vde", NULL, "vde", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_VDE, 61, &periph_h_regs, 0, vde),
-       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),
-       TEGRA_INIT_DATA_MUX("la", NULL, "la", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_LA, 76, &periph_u_regs, TEGRA_PERIPH_ON_APB, la),
-       TEGRA_INIT_DATA_MUX("trace", NULL, "trace", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_TRACE, 77, &periph_u_regs, TEGRA_PERIPH_ON_APB, trace),
-       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),
-       TEGRA_INIT_DATA_MUX("nor", NULL, "tegra-nor", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NOR, 42, &periph_h_regs, 0, nor),
-       TEGRA_INIT_DATA_MUX("mipi", NULL, "mipi", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_MIPI, 50, &periph_h_regs, TEGRA_PERIPH_ON_APB, mipi),
-       TEGRA_INIT_DATA_I2C("i2c1", "div-clk", "tegra11-i2c.0", mux_pllp_clkm, CLK_SOURCE_I2C1, 12, &periph_l_regs, i2c1),
-       TEGRA_INIT_DATA_I2C("i2c2", "div-clk", "tegra11-i2c.1", mux_pllp_clkm, CLK_SOURCE_I2C2, 54, &periph_h_regs, i2c2),
-       TEGRA_INIT_DATA_I2C("i2c3", "div-clk", "tegra11-i2c.2", mux_pllp_clkm, CLK_SOURCE_I2C3, 67, &periph_u_regs, i2c3),
-       TEGRA_INIT_DATA_I2C("i2c4", "div-clk", "tegra11-i2c.3", mux_pllp_clkm, CLK_SOURCE_I2C4, 103, &periph_v_regs, i2c4),
-       TEGRA_INIT_DATA_I2C("i2c5", "div-clk", "tegra11-i2c.4", mux_pllp_clkm, CLK_SOURCE_I2C5, 47, &periph_h_regs, i2c5),
-       TEGRA_INIT_DATA_UART("uarta", NULL, "tegra_uart.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTA, 6, &periph_l_regs, uarta),
-       TEGRA_INIT_DATA_UART("uartb", NULL, "tegra_uart.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, &periph_l_regs, uartb),
-       TEGRA_INIT_DATA_UART("uartc", NULL, "tegra_uart.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, &periph_h_regs, uartc),
-       TEGRA_INIT_DATA_UART("uartd", NULL, "tegra_uart.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, &periph_u_regs, uartd),
-       TEGRA_INIT_DATA_INT("3d", NULL, "3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, &periph_l_regs, 0, gr_3d),
-       TEGRA_INIT_DATA_INT("2d", NULL, "2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, &periph_l_regs, 0, gr_2d),
-       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),
-       TEGRA_INIT_DATA_INT8("vi", "vi", "tegra_camera", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI, 20, &periph_l_regs, 0, vi),
-       TEGRA_INIT_DATA_INT8("epp", NULL, "epp", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_EPP, 19, &periph_l_regs, 0, epp),
-       TEGRA_INIT_DATA_INT8("msenc", NULL, "msenc", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_MSENC, 91, &periph_u_regs, TEGRA_PERIPH_WAR_1005168, msenc),
-       TEGRA_INIT_DATA_INT8("tsec", NULL, "tsec", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_TSEC, 83, &periph_u_regs, 0, tsec),
-       TEGRA_INIT_DATA_INT8("host1x", NULL, "host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, &periph_l_regs, 0, host1x),
-       TEGRA_INIT_DATA_MUX8("hdmi", NULL, "hdmi", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_HDMI, 51, &periph_h_regs, 0, hdmi),
-       TEGRA_INIT_DATA_MUX("cilab", "cilab", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILAB, 144, &periph_w_regs, 0, cilab),
-       TEGRA_INIT_DATA_MUX("cilcd", "cilcd", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILCD, 145, &periph_w_regs, 0, cilcd),
-       TEGRA_INIT_DATA_MUX("cile", "cile", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILE, 146, &periph_w_regs, 0, cile),
-       TEGRA_INIT_DATA_MUX("dsialp", "dsialp", "tegradc.0", mux_pllp_pllc_clkm, CLK_SOURCE_DSIALP, 147, &periph_w_regs, 0, dsialp),
-       TEGRA_INIT_DATA_MUX("dsiblp", "dsiblp", "tegradc.1", mux_pllp_pllc_clkm, CLK_SOURCE_DSIBLP, 148, &periph_w_regs, 0, dsiblp),
-       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),
-       TEGRA_INIT_DATA_MUX("actmon", NULL, "actmon", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_ACTMON, 119, &periph_v_regs, 0, actmon),
-       TEGRA_INIT_DATA_MUX8("extern1", NULL, "extern1", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN1, 120, &periph_v_regs, 0, extern1),
-       TEGRA_INIT_DATA_MUX8("extern2", NULL, "extern2", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, &periph_v_regs, 0, extern2),
-       TEGRA_INIT_DATA_MUX8("extern3", NULL, "extern3", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, &periph_v_regs, 0, extern3),
-       TEGRA_INIT_DATA_MUX("i2cslow", NULL, "i2cslow", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_I2CSLOW, 81, &periph_u_regs, TEGRA_PERIPH_ON_APB, i2cslow),
-       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),
-       TEGRA_INIT_DATA_INT_FLAGS("mselect", NULL, "mselect", mux_pllp_clkm, CLK_SOURCE_MSELECT, 99, &periph_v_regs, 0, mselect, CLK_IGNORE_UNUSED),
-       TEGRA_INIT_DATA_MUX("dfll_ref", "ref", "t114_dfll", mux_pllp_clkm, CLK_SOURCE_DFLL_REF, 155, &periph_w_regs, TEGRA_PERIPH_ON_APB, dfll_ref),
-       TEGRA_INIT_DATA_MUX("dfll_soc", "soc", "t114_dfll", mux_pllp_clkm, CLK_SOURCE_DFLL_SOC, 155, &periph_w_regs, TEGRA_PERIPH_ON_APB, dfll_soc),
-       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),
-       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),
-       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),
-       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),
-       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),
-       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),
-       TEGRA_INIT_DATA_AUDIO("d_audio", "d_audio", "tegra30-ahub", CLK_SOURCE_D_AUDIO, 106, &periph_v_regs, TEGRA_PERIPH_ON_APB, d_audio),
-       TEGRA_INIT_DATA_AUDIO("dam0", NULL, "tegra30-dam.0", CLK_SOURCE_DAM0, 108, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam0),
-       TEGRA_INIT_DATA_AUDIO("dam1", NULL, "tegra30-dam.1", CLK_SOURCE_DAM1, 109, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam1),
-       TEGRA_INIT_DATA_AUDIO("dam2", NULL, "tegra30-dam.2", CLK_SOURCE_DAM2, 110, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam2),
-};
-
-static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = {
-       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),
-       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),
-};
+       /* xusb_hs_src */
+       val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC);
+       val |= BIT(25); /* always select PLLU_60M */
+       writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC);
 
-static __init void tegra114_periph_clk_init(void __iomem *clk_base)
-{
-       struct tegra_periph_init_data *data;
-       struct clk *clk;
-       int i;
-       u32 val;
+       clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0,
+                                       1, 1);
+       clks[TEGRA114_CLK_XUSB_HS_SRC] = clk;
 
-       /* apbdma */
-       clk = tegra_clk_register_periph_gate("apbdma", "clk_m", 0, clk_base,
-                                 0, 34, &periph_h_regs,
-                                 periph_clk_enb_refcnt);
-       clks[apbdma] = clk;
-
-       /* rtc */
-       clk = tegra_clk_register_periph_gate("rtc", "clk_32k",
-                                   TEGRA_PERIPH_ON_APB |
-                                   TEGRA_PERIPH_NO_RESET, clk_base,
-                                   0, 4, &periph_l_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "rtc-tegra");
-       clks[rtc] = clk;
-
-       /* kbc */
-       clk = tegra_clk_register_periph_gate("kbc", "clk_32k",
-                                   TEGRA_PERIPH_ON_APB |
-                                   TEGRA_PERIPH_NO_RESET, clk_base,
-                                   0, 36, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clks[kbc] = clk;
-
-       /* timer */
-       clk = tegra_clk_register_periph_gate("timer", "clk_m", 0, clk_base,
-                                 0, 5, &periph_l_regs,
-                                 periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "timer");
-       clks[timer] = clk;
-
-       /* kfuse */
-       clk = tegra_clk_register_periph_gate("kfuse", "clk_m",
-                                 TEGRA_PERIPH_ON_APB, clk_base,  0, 40,
-                                 &periph_h_regs, periph_clk_enb_refcnt);
-       clks[kfuse] = clk;
-
-       /* fuse */
-       clk = tegra_clk_register_periph_gate("fuse", "clk_m",
-                                 TEGRA_PERIPH_ON_APB, clk_base,  0, 39,
-                                 &periph_h_regs, periph_clk_enb_refcnt);
-       clks[fuse] = clk;
-
-       /* fuse_burn */
-       clk = tegra_clk_register_periph_gate("fuse_burn", "clk_m",
-                                 TEGRA_PERIPH_ON_APB, clk_base,  0, 39,
-                                 &periph_h_regs, periph_clk_enb_refcnt);
-       clks[fuse_burn] = clk;
-
-       /* apbif */
-       clk = tegra_clk_register_periph_gate("apbif", "clk_m",
-                                 TEGRA_PERIPH_ON_APB, clk_base,  0, 107,
-                                 &periph_v_regs, periph_clk_enb_refcnt);
-       clks[apbif] = clk;
-
-       /* hda2hdmi */
-       clk = tegra_clk_register_periph_gate("hda2hdmi", "clk_m",
-                                   TEGRA_PERIPH_ON_APB, clk_base,  0, 128,
-                                   &periph_w_regs, periph_clk_enb_refcnt);
-       clks[hda2hdmi] = clk;
-
-       /* vcp */
-       clk = tegra_clk_register_periph_gate("vcp", "clk_m", 0, clk_base,  0,
-                                 29, &periph_l_regs,
-                                 periph_clk_enb_refcnt);
-       clks[vcp] = clk;
-
-       /* bsea */
-       clk = tegra_clk_register_periph_gate("bsea", "clk_m", 0, clk_base,
-                                 0, 62, &periph_h_regs,
-                                 periph_clk_enb_refcnt);
-       clks[bsea] = clk;
-
-       /* bsev */
-       clk = tegra_clk_register_periph_gate("bsev", "clk_m", 0, clk_base,
-                                 0, 63, &periph_h_regs,
-                                 periph_clk_enb_refcnt);
-       clks[bsev] = clk;
-
-       /* mipi-cal */
-       clk = tegra_clk_register_periph_gate("mipi-cal", "clk_m", 0, clk_base,
-                                  0, 56, &periph_h_regs,
-                                 periph_clk_enb_refcnt);
-       clks[mipi_cal] = clk;
-
-       /* usbd */
-       clk = tegra_clk_register_periph_gate("usbd", "clk_m", 0, clk_base,
-                                 0, 22, &periph_l_regs,
-                                 periph_clk_enb_refcnt);
-       clks[usbd] = clk;
-
-       /* usb2 */
-       clk = tegra_clk_register_periph_gate("usb2", "clk_m", 0, clk_base,
-                                 0, 58, &periph_h_regs,
-                                 periph_clk_enb_refcnt);
-       clks[usb2] = clk;
-
-       /* usb3 */
-       clk = tegra_clk_register_periph_gate("usb3", "clk_m", 0, clk_base,
-                                 0, 59, &periph_h_regs,
-                                 periph_clk_enb_refcnt);
-       clks[usb3] = clk;
-
-       /* csi */
-       clk = tegra_clk_register_periph_gate("csi", "pll_p_out3", 0, clk_base,
-                                  0, 52, &periph_h_regs,
-                                 periph_clk_enb_refcnt);
-       clks[csi] = clk;
-
-       /* isp */
-       clk = tegra_clk_register_periph_gate("isp", "clk_m", 0, clk_base, 0,
-                                 23, &periph_l_regs,
-                                 periph_clk_enb_refcnt);
-       clks[isp] = clk;
-
-       /* csus */
-       clk = tegra_clk_register_periph_gate("csus", "clk_m",
-                                 TEGRA_PERIPH_NO_RESET, clk_base, 0, 92,
-                                 &periph_u_regs, periph_clk_enb_refcnt);
-       clks[csus] = clk;
-
-       /* dds */
-       clk = tegra_clk_register_periph_gate("dds", "clk_m",
-                                 TEGRA_PERIPH_ON_APB, clk_base, 0, 150,
-                                 &periph_w_regs, periph_clk_enb_refcnt);
-       clks[dds] = clk;
-
-       /* dp2 */
-       clk = tegra_clk_register_periph_gate("dp2", "clk_m",
-                                 TEGRA_PERIPH_ON_APB, clk_base, 0, 152,
-                                 &periph_w_regs, periph_clk_enb_refcnt);
-       clks[dp2] = clk;
-
-       /* dtv */
-       clk = tegra_clk_register_periph_gate("dtv", "clk_m",
-                                   TEGRA_PERIPH_ON_APB, clk_base, 0, 79,
-                                   &periph_u_regs, periph_clk_enb_refcnt);
-       clks[dtv] = clk;
-
-       /* dsia */
+       /* dsia mux */
        clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0,
                               ARRAY_SIZE(mux_plld_out0_plld2_out0),
                               CLK_SET_RATE_NO_REPARENT,
                               clk_base + PLLD_BASE, 25, 1, 0, &pll_d_lock);
-       clks[dsia_mux] = clk;
-       clk = tegra_clk_register_periph_gate("dsia", "dsia_mux", 0, clk_base,
-                                   0, 48, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clks[dsia] = clk;
+       clks[TEGRA114_CLK_DSIA_MUX] = clk;
 
-       /* dsib */
+       /* dsib mux */
        clk = clk_register_mux(NULL, "dsib_mux", mux_plld_out0_plld2_out0,
                               ARRAY_SIZE(mux_plld_out0_plld2_out0),
                               CLK_SET_RATE_NO_REPARENT,
                               clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock);
-       clks[dsib_mux] = clk;
-       clk = tegra_clk_register_periph_gate("dsib", "dsib_mux", 0, clk_base,
-                                   0, 82, &periph_u_regs,
-                                   periph_clk_enb_refcnt);
-       clks[dsib] = clk;
+       clks[TEGRA114_CLK_DSIB_MUX] = clk;
 
-       /* xusb_hs_src */
-       val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC);
-       val |= BIT(25); /* always select PLLU_60M */
-       writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC);
-
-       clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0,
-                                       1, 1);
-       clks[xusb_hs_src] = clk;
-
-       /* xusb_host */
-       clk = tegra_clk_register_periph_gate("xusb_host", "xusb_host_src", 0,
-                                   clk_base, 0, 89, &periph_u_regs,
-                                   periph_clk_enb_refcnt);
-       clks[xusb_host] = clk;
-
-       /* xusb_ss */
-       clk = tegra_clk_register_periph_gate("xusb_ss", "xusb_ss_src", 0,
-                                   clk_base, 0, 156, &periph_w_regs,
-                                   periph_clk_enb_refcnt);
-       clks[xusb_host] = clk;
-
-       /* xusb_dev */
-       clk = tegra_clk_register_periph_gate("xusb_dev", "xusb_dev_src", 0,
-                                   clk_base, 0, 95, &periph_u_regs,
-                                   periph_clk_enb_refcnt);
-       clks[xusb_dev] = clk;
-
-       /* emc */
+       /* emc mux */
        clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm,
                               ARRAY_SIZE(mux_pllmcp_clkm),
                               CLK_SET_RATE_NO_REPARENT,
                               clk_base + CLK_SOURCE_EMC,
                               29, 3, 0, NULL);
-       clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base,
-                               CLK_IGNORE_UNUSED, 57, &periph_h_regs,
-                               periph_clk_enb_refcnt);
-       clks[emc] = clk;
-
-       for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) {
-               data = &tegra_periph_clk_list[i];
-               clk = tegra_clk_register_periph(data->name, data->parent_names,
-                               data->num_parents, &data->periph,
-                               clk_base, data->offset, data->flags);
-               clks[data->clk_id] = clk;
-       }
 
-       for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) {
-               data = &tegra_periph_nodiv_clk_list[i];
-               clk = tegra_clk_register_periph_nodiv(data->name,
-                               data->parent_names, data->num_parents,
-                               &data->periph, clk_base, data->offset);
-               clks[data->clk_id] = clk;
-       }
+       tegra_periph_clk_init(clk_base, pmc_base, tegra114_clks,
+                               &pll_p_params);
 }
 
 /* Tegra114 CPU clock and reset control functions */
@@ -2207,28 +1278,37 @@ static const struct of_device_id pmc_match[] __initconst = {
  * breaks
  */
 static struct tegra_clk_init_table init_table[] __initdata = {
-       {uarta, pll_p, 408000000, 0},
-       {uartb, pll_p, 408000000, 0},
-       {uartc, pll_p, 408000000, 0},
-       {uartd, pll_p, 408000000, 0},
-       {pll_a, clk_max, 564480000, 1},
-       {pll_a_out0, clk_max, 11289600, 1},
-       {extern1, pll_a_out0, 0, 1},
-       {clk_out_1_mux, extern1, 0, 1},
-       {clk_out_1, clk_max, 0, 1},
-       {i2s0, pll_a_out0, 11289600, 0},
-       {i2s1, pll_a_out0, 11289600, 0},
-       {i2s2, pll_a_out0, 11289600, 0},
-       {i2s3, pll_a_out0, 11289600, 0},
-       {i2s4, pll_a_out0, 11289600, 0},
-       {dfll_soc, pll_p, 51000000, 1},
-       {dfll_ref, pll_p, 51000000, 1},
-       {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */
+       {TEGRA114_CLK_UARTA, TEGRA114_CLK_PLL_P, 408000000, 0},
+       {TEGRA114_CLK_UARTB, TEGRA114_CLK_PLL_P, 408000000, 0},
+       {TEGRA114_CLK_UARTC, TEGRA114_CLK_PLL_P, 408000000, 0},
+       {TEGRA114_CLK_UARTD, TEGRA114_CLK_PLL_P, 408000000, 0},
+       {TEGRA114_CLK_PLL_A, TEGRA114_CLK_CLK_MAX, 564480000, 1},
+       {TEGRA114_CLK_PLL_A_OUT0, TEGRA114_CLK_CLK_MAX, 11289600, 1},
+       {TEGRA114_CLK_EXTERN1, TEGRA114_CLK_PLL_A_OUT0, 0, 1},
+       {TEGRA114_CLK_CLK_OUT_1_MUX, TEGRA114_CLK_EXTERN1, 0, 1},
+       {TEGRA114_CLK_CLK_OUT_1, TEGRA114_CLK_CLK_MAX, 0, 1},
+       {TEGRA114_CLK_I2S0, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA114_CLK_I2S1, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA114_CLK_I2S2, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA114_CLK_I2S3, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA114_CLK_I2S4, TEGRA114_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA114_CLK_HOST1X, TEGRA114_CLK_PLL_P, 136000000, 0},
+       {TEGRA114_CLK_DFLL_SOC, TEGRA114_CLK_PLL_P, 51000000, 1},
+       {TEGRA114_CLK_DFLL_REF, TEGRA114_CLK_PLL_P, 51000000, 1},
+       {TEGRA114_CLK_DISP1, TEGRA114_CLK_PLL_P, 0, 0},
+       {TEGRA114_CLK_DISP2, TEGRA114_CLK_PLL_P, 0, 0},
+       {TEGRA114_CLK_GR2D, TEGRA114_CLK_PLL_C2, 300000000, 0},
+       {TEGRA114_CLK_GR3D, TEGRA114_CLK_PLL_C2, 300000000, 0},
+       {TEGRA114_CLK_DSIALP, TEGRA114_CLK_PLL_P, 68000000, 0},
+       {TEGRA114_CLK_DSIBLP, TEGRA114_CLK_PLL_P, 68000000, 0},
+
+       /* This MUST be the last entry. */
+       {TEGRA114_CLK_CLK_MAX, TEGRA114_CLK_CLK_MAX, 0, 0},
 };
 
 static void __init tegra114_clock_apply_init_table(void)
 {
-       tegra_init_from_table(init_table, clks, clk_max);
+       tegra_init_from_table(init_table, clks, TEGRA114_CLK_CLK_MAX);
 }
 
 
@@ -2359,7 +1439,6 @@ EXPORT_SYMBOL(tegra114_clock_deassert_dfll_dvco_reset);
 static void __init tegra114_clock_init(struct device_node *np)
 {
        struct device_node *node;
-       int i;
 
        clk_base = of_iomap(np, 0);
        if (!clk_base) {
@@ -2381,29 +1460,24 @@ static void __init tegra114_clock_init(struct device_node *np)
                return;
        }
 
+       clks = tegra_clk_init(clk_base, TEGRA114_CLK_CLK_MAX,
+                               TEGRA114_CLK_PERIPH_BANKS);
+       if (!clks)
+               return;
+
        if (tegra114_osc_clk_init(clk_base) < 0)
                return;
 
        tegra114_fixed_clk_init(clk_base);
        tegra114_pll_init(clk_base, pmc_base);
-       tegra114_periph_clk_init(clk_base);
-       tegra114_audio_clk_init(clk_base);
-       tegra114_pmc_clk_init(pmc_base);
-       tegra114_super_clk_init(clk_base);
-
-       for (i = 0; i < ARRAY_SIZE(clks); i++) {
-               if (IS_ERR(clks[i])) {
-                       pr_err
-                           ("Tegra114 clk %d: register failed with %ld\n",
-                            i, PTR_ERR(clks[i]));
-               }
-               if (!clks[i])
-                       clks[i] = ERR_PTR(-EINVAL);
-       }
-
-       clk_data.clks = clks;
-       clk_data.clk_num = ARRAY_SIZE(clks);
-       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+       tegra114_periph_clk_init(clk_base, pmc_base);
+       tegra_audio_clk_init(clk_base, pmc_base, tegra114_clks, &pll_a_params);
+       tegra_pmc_clk_init(pmc_base, tegra114_clks);
+       tegra_super_clk_gen4_init(clk_base, pmc_base, tegra114_clks,
+                                       &pll_x_params);
+
+       tegra_add_of_provider(np);
+       tegra_register_devclks(devclks, ARRAY_SIZE(devclks));
 
        tegra_clk_apply_init_table = tegra114_clock_apply_init_table;
 
diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c
new file mode 100644 (file)
index 0000000..aff86b5
--- /dev/null
@@ -0,0 +1,1424 @@
+/*
+ * Copyright (c) 2012, 2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/clk/tegra.h>
+#include <dt-bindings/clock/tegra124-car.h>
+
+#include "clk.h"
+#include "clk-id.h"
+
+#define CLK_SOURCE_CSITE 0x1d4
+#define CLK_SOURCE_EMC 0x19c
+#define CLK_SOURCE_XUSB_SS_SRC 0x610
+
+#define PLLC_BASE 0x80
+#define PLLC_OUT 0x84
+#define PLLC_MISC2 0x88
+#define PLLC_MISC 0x8c
+#define PLLC2_BASE 0x4e8
+#define PLLC2_MISC 0x4ec
+#define PLLC3_BASE 0x4fc
+#define PLLC3_MISC 0x500
+#define PLLM_BASE 0x90
+#define PLLM_OUT 0x94
+#define PLLM_MISC 0x9c
+#define PLLP_BASE 0xa0
+#define PLLP_MISC 0xac
+#define PLLA_BASE 0xb0
+#define PLLA_MISC 0xbc
+#define PLLD_BASE 0xd0
+#define PLLD_MISC 0xdc
+#define PLLU_BASE 0xc0
+#define PLLU_MISC 0xcc
+#define PLLX_BASE 0xe0
+#define PLLX_MISC 0xe4
+#define PLLX_MISC2 0x514
+#define PLLX_MISC3 0x518
+#define PLLE_BASE 0xe8
+#define PLLE_MISC 0xec
+#define PLLD2_BASE 0x4b8
+#define PLLD2_MISC 0x4bc
+#define PLLE_AUX 0x48c
+#define PLLRE_BASE 0x4c4
+#define PLLRE_MISC 0x4c8
+#define PLLDP_BASE 0x590
+#define PLLDP_MISC 0x594
+#define PLLC4_BASE 0x5a4
+#define PLLC4_MISC 0x5a8
+
+#define PLLC_IDDQ_BIT 26
+#define PLLRE_IDDQ_BIT 16
+#define PLLSS_IDDQ_BIT 19
+
+#define PLL_BASE_LOCK BIT(27)
+#define PLLE_MISC_LOCK BIT(11)
+#define PLLRE_MISC_LOCK BIT(24)
+
+#define PLL_MISC_LOCK_ENABLE 18
+#define PLLC_MISC_LOCK_ENABLE 24
+#define PLLDU_MISC_LOCK_ENABLE 22
+#define PLLE_MISC_LOCK_ENABLE 9
+#define PLLRE_MISC_LOCK_ENABLE 30
+#define PLLSS_MISC_LOCK_ENABLE 30
+
+#define PLLXC_SW_MAX_P 6
+
+#define PMC_PLLM_WB0_OVERRIDE 0x1dc
+#define PMC_PLLM_WB0_OVERRIDE_2 0x2b0
+
+#define UTMIP_PLL_CFG2 0x488
+#define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6)
+#define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18)
+#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN BIT(0)
+#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN BIT(2)
+#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN BIT(4)
+
+#define UTMIP_PLL_CFG1 0x484
+#define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 6)
+#define UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(x) (((x) & 0xfff) << 0)
+#define UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP BIT(17)
+#define UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN BIT(16)
+#define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP BIT(15)
+#define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN BIT(14)
+#define UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN BIT(12)
+
+#define UTMIPLL_HW_PWRDN_CFG0                  0x52c
+#define UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE  BIT(25)
+#define UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE       BIT(24)
+#define UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET      BIT(6)
+#define UTMIPLL_HW_PWRDN_CFG0_SEQ_RESET_INPUT_VALUE    BIT(5)
+#define UTMIPLL_HW_PWRDN_CFG0_SEQ_IN_SWCTL     BIT(4)
+#define UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL BIT(2)
+#define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE    BIT(1)
+#define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL       BIT(0)
+
+/* Tegra CPU clock and reset control regs */
+#define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS    0x470
+
+#ifdef CONFIG_PM_SLEEP
+static struct cpu_clk_suspend_context {
+       u32 clk_csite_src;
+} tegra124_cpu_clk_sctx;
+#endif
+
+static void __iomem *clk_base;
+static void __iomem *pmc_base;
+
+static unsigned long osc_freq;
+static unsigned long pll_ref_freq;
+
+static DEFINE_SPINLOCK(pll_d_lock);
+static DEFINE_SPINLOCK(pll_d2_lock);
+static DEFINE_SPINLOCK(pll_e_lock);
+static DEFINE_SPINLOCK(pll_re_lock);
+static DEFINE_SPINLOCK(pll_u_lock);
+
+/* possible OSC frequencies in Hz */
+static unsigned long tegra124_input_freq[] = {
+       [0] = 13000000,
+       [1] = 16800000,
+       [4] = 19200000,
+       [5] = 38400000,
+       [8] = 12000000,
+       [9] = 48000000,
+       [12] = 260000000,
+};
+
+static const char *mux_plld_out0_plld2_out0[] = {
+       "pll_d_out0", "pll_d2_out0",
+};
+#define mux_plld_out0_plld2_out0_idx NULL
+
+static const char *mux_pllmcp_clkm[] = {
+       "pll_m", "pll_c", "pll_p", "clk_m", "pll_m_ud", "pll_c2", "pll_c3",
+};
+#define mux_pllmcp_clkm_idx NULL
+
+static struct div_nmp pllxc_nmp = {
+       .divm_shift = 0,
+       .divm_width = 8,
+       .divn_shift = 8,
+       .divn_width = 8,
+       .divp_shift = 20,
+       .divp_width = 4,
+};
+
+static struct pdiv_map pllxc_p[] = {
+       { .pdiv = 1, .hw_val = 0 },
+       { .pdiv = 2, .hw_val = 1 },
+       { .pdiv = 3, .hw_val = 2 },
+       { .pdiv = 4, .hw_val = 3 },
+       { .pdiv = 5, .hw_val = 4 },
+       { .pdiv = 6, .hw_val = 5 },
+       { .pdiv = 8, .hw_val = 6 },
+       { .pdiv = 10, .hw_val = 7 },
+       { .pdiv = 12, .hw_val = 8 },
+       { .pdiv = 16, .hw_val = 9 },
+       { .pdiv = 12, .hw_val = 10 },
+       { .pdiv = 16, .hw_val = 11 },
+       { .pdiv = 20, .hw_val = 12 },
+       { .pdiv = 24, .hw_val = 13 },
+       { .pdiv = 32, .hw_val = 14 },
+       { .pdiv = 0, .hw_val = 0 },
+};
+
+static struct tegra_clk_pll_freq_table pll_x_freq_table[] = {
+       /* 1 GHz */
+       {12000000, 1000000000, 83, 0, 1},       /* actual: 996.0 MHz */
+       {13000000, 1000000000, 76, 0, 1},       /* actual: 988.0 MHz */
+       {16800000, 1000000000, 59, 0, 1},       /* actual: 991.2 MHz */
+       {19200000, 1000000000, 52, 0, 1},       /* actual: 998.4 MHz */
+       {26000000, 1000000000, 76, 1, 1},       /* actual: 988.0 MHz */
+       {0, 0, 0, 0, 0, 0},
+};
+
+static struct tegra_clk_pll_params pll_x_params = {
+       .input_min = 12000000,
+       .input_max = 800000000,
+       .cf_min = 12000000,
+       .cf_max = 19200000,     /* s/w policy, h/w capability 50 MHz */
+       .vco_min = 700000000,
+       .vco_max = 3000000000UL,
+       .base_reg = PLLX_BASE,
+       .misc_reg = PLLX_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .iddq_reg = PLLX_MISC3,
+       .iddq_bit_idx = 3,
+       .max_p = 6,
+       .dyn_ramp_reg = PLLX_MISC2,
+       .stepa_shift = 16,
+       .stepb_shift = 24,
+       .pdiv_tohw = pllxc_p,
+       .div_nmp = &pllxc_nmp,
+       .freq_table = pll_x_freq_table,
+       .flags = TEGRA_PLL_USE_LOCK,
+};
+
+static struct tegra_clk_pll_freq_table pll_c_freq_table[] = {
+       { 12000000, 624000000, 104, 1, 2},
+       { 12000000, 600000000, 100, 1, 2},
+       { 13000000, 600000000,  92, 1, 2},      /* actual: 598.0 MHz */
+       { 16800000, 600000000,  71, 1, 2},      /* actual: 596.4 MHz */
+       { 19200000, 600000000,  62, 1, 2},      /* actual: 595.2 MHz */
+       { 26000000, 600000000,  92, 2, 2},      /* actual: 598.0 MHz */
+       { 0, 0, 0, 0, 0, 0 },
+};
+
+static struct tegra_clk_pll_params pll_c_params = {
+       .input_min = 12000000,
+       .input_max = 800000000,
+       .cf_min = 12000000,
+       .cf_max = 19200000,     /* s/w policy, h/w capability 50 MHz */
+       .vco_min = 600000000,
+       .vco_max = 1400000000,
+       .base_reg = PLLC_BASE,
+       .misc_reg = PLLC_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLLC_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .iddq_reg = PLLC_MISC,
+       .iddq_bit_idx = PLLC_IDDQ_BIT,
+       .max_p = PLLXC_SW_MAX_P,
+       .dyn_ramp_reg = PLLC_MISC2,
+       .stepa_shift = 17,
+       .stepb_shift = 9,
+       .pdiv_tohw = pllxc_p,
+       .div_nmp = &pllxc_nmp,
+       .freq_table = pll_c_freq_table,
+       .flags = TEGRA_PLL_USE_LOCK,
+};
+
+static struct div_nmp pllcx_nmp = {
+       .divm_shift = 0,
+       .divm_width = 2,
+       .divn_shift = 8,
+       .divn_width = 8,
+       .divp_shift = 20,
+       .divp_width = 3,
+};
+
+static struct pdiv_map pllc_p[] = {
+       { .pdiv = 1, .hw_val = 0 },
+       { .pdiv = 2, .hw_val = 1 },
+       { .pdiv = 3, .hw_val = 2 },
+       { .pdiv = 4, .hw_val = 3 },
+       { .pdiv = 6, .hw_val = 4 },
+       { .pdiv = 8, .hw_val = 5 },
+       { .pdiv = 12, .hw_val = 6 },
+       { .pdiv = 16, .hw_val = 7 },
+       { .pdiv = 0, .hw_val = 0 },
+};
+
+static struct tegra_clk_pll_freq_table pll_cx_freq_table[] = {
+       {12000000, 600000000, 100, 1, 2},
+       {13000000, 600000000, 92, 1, 2},        /* actual: 598.0 MHz */
+       {16800000, 600000000, 71, 1, 2},        /* actual: 596.4 MHz */
+       {19200000, 600000000, 62, 1, 2},        /* actual: 595.2 MHz */
+       {26000000, 600000000, 92, 2, 2},        /* actual: 598.0 MHz */
+       {0, 0, 0, 0, 0, 0},
+};
+
+static struct tegra_clk_pll_params pll_c2_params = {
+       .input_min = 12000000,
+       .input_max = 48000000,
+       .cf_min = 12000000,
+       .cf_max = 19200000,
+       .vco_min = 600000000,
+       .vco_max = 1200000000,
+       .base_reg = PLLC2_BASE,
+       .misc_reg = PLLC2_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .pdiv_tohw = pllc_p,
+       .div_nmp = &pllcx_nmp,
+       .max_p = 7,
+       .ext_misc_reg[0] = 0x4f0,
+       .ext_misc_reg[1] = 0x4f4,
+       .ext_misc_reg[2] = 0x4f8,
+       .freq_table = pll_cx_freq_table,
+       .flags = TEGRA_PLL_USE_LOCK,
+};
+
+static struct tegra_clk_pll_params pll_c3_params = {
+       .input_min = 12000000,
+       .input_max = 48000000,
+       .cf_min = 12000000,
+       .cf_max = 19200000,
+       .vco_min = 600000000,
+       .vco_max = 1200000000,
+       .base_reg = PLLC3_BASE,
+       .misc_reg = PLLC3_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .pdiv_tohw = pllc_p,
+       .div_nmp = &pllcx_nmp,
+       .max_p = 7,
+       .ext_misc_reg[0] = 0x504,
+       .ext_misc_reg[1] = 0x508,
+       .ext_misc_reg[2] = 0x50c,
+       .freq_table = pll_cx_freq_table,
+       .flags = TEGRA_PLL_USE_LOCK,
+};
+
+static struct div_nmp pllss_nmp = {
+       .divm_shift = 0,
+       .divm_width = 8,
+       .divn_shift = 8,
+       .divn_width = 8,
+       .divp_shift = 20,
+       .divp_width = 4,
+};
+
+static struct pdiv_map pll12g_ssd_esd_p[] = {
+       { .pdiv = 1, .hw_val = 0 },
+       { .pdiv = 2, .hw_val = 1 },
+       { .pdiv = 3, .hw_val = 2 },
+       { .pdiv = 4, .hw_val = 3 },
+       { .pdiv = 5, .hw_val = 4 },
+       { .pdiv = 6, .hw_val = 5 },
+       { .pdiv = 8, .hw_val = 6 },
+       { .pdiv = 10, .hw_val = 7 },
+       { .pdiv = 12, .hw_val = 8 },
+       { .pdiv = 16, .hw_val = 9 },
+       { .pdiv = 12, .hw_val = 10 },
+       { .pdiv = 16, .hw_val = 11 },
+       { .pdiv = 20, .hw_val = 12 },
+       { .pdiv = 24, .hw_val = 13 },
+       { .pdiv = 32, .hw_val = 14 },
+       { .pdiv = 0, .hw_val = 0 },
+};
+
+static struct tegra_clk_pll_freq_table pll_c4_freq_table[] = {
+       { 12000000, 600000000, 100, 1, 1},
+       { 13000000, 600000000,  92, 1, 1},      /* actual: 598.0 MHz */
+       { 16800000, 600000000,  71, 1, 1},      /* actual: 596.4 MHz */
+       { 19200000, 600000000,  62, 1, 1},      /* actual: 595.2 MHz */
+       { 26000000, 600000000,  92, 2, 1},      /* actual: 598.0 MHz */
+       { 0, 0, 0, 0, 0, 0 },
+};
+
+static struct tegra_clk_pll_params pll_c4_params = {
+       .input_min = 12000000,
+       .input_max = 1000000000,
+       .cf_min = 12000000,
+       .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */
+       .vco_min = 600000000,
+       .vco_max = 1200000000,
+       .base_reg = PLLC4_BASE,
+       .misc_reg = PLLC4_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLLSS_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .iddq_reg = PLLC4_BASE,
+       .iddq_bit_idx = PLLSS_IDDQ_BIT,
+       .pdiv_tohw = pll12g_ssd_esd_p,
+       .div_nmp = &pllss_nmp,
+       .ext_misc_reg[0] = 0x5ac,
+       .ext_misc_reg[1] = 0x5b0,
+       .ext_misc_reg[2] = 0x5b4,
+       .freq_table = pll_c4_freq_table,
+};
+
+static struct pdiv_map pllm_p[] = {
+       { .pdiv = 1, .hw_val = 0 },
+       { .pdiv = 2, .hw_val = 1 },
+       { .pdiv = 0, .hw_val = 0 },
+};
+
+static struct tegra_clk_pll_freq_table pll_m_freq_table[] = {
+       {12000000, 800000000, 66, 1, 1},        /* actual: 792.0 MHz */
+       {13000000, 800000000, 61, 1, 1},        /* actual: 793.0 MHz */
+       {16800000, 800000000, 47, 1, 1},        /* actual: 789.6 MHz */
+       {19200000, 800000000, 41, 1, 1},        /* actual: 787.2 MHz */
+       {26000000, 800000000, 61, 2, 1},        /* actual: 793.0 MHz */
+       {0, 0, 0, 0, 0, 0},
+};
+
+static struct div_nmp pllm_nmp = {
+       .divm_shift = 0,
+       .divm_width = 8,
+       .override_divm_shift = 0,
+       .divn_shift = 8,
+       .divn_width = 8,
+       .override_divn_shift = 8,
+       .divp_shift = 20,
+       .divp_width = 1,
+       .override_divp_shift = 27,
+};
+
+static struct tegra_clk_pll_params pll_m_params = {
+       .input_min = 12000000,
+       .input_max = 500000000,
+       .cf_min = 12000000,
+       .cf_max = 19200000,     /* s/w policy, h/w capability 50 MHz */
+       .vco_min = 400000000,
+       .vco_max = 1066000000,
+       .base_reg = PLLM_BASE,
+       .misc_reg = PLLM_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .max_p = 2,
+       .pdiv_tohw = pllm_p,
+       .div_nmp = &pllm_nmp,
+       .pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE,
+       .pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE_2,
+       .freq_table = pll_m_freq_table,
+       .flags = TEGRA_PLL_USE_LOCK,
+};
+
+static struct tegra_clk_pll_freq_table pll_e_freq_table[] = {
+       /* PLLE special case: use cpcon field to store cml divider value */
+       {336000000, 100000000, 100, 21, 16, 11},
+       {312000000, 100000000, 200, 26, 24, 13},
+       {13000000,  100000000, 200, 1,  26, 13},
+       {12000000,  100000000, 200, 1,  24, 13},
+       {0, 0, 0, 0, 0, 0},
+};
+
+static struct div_nmp plle_nmp = {
+       .divm_shift = 0,
+       .divm_width = 8,
+       .divn_shift = 8,
+       .divn_width = 8,
+       .divp_shift = 24,
+       .divp_width = 4,
+};
+
+static struct tegra_clk_pll_params pll_e_params = {
+       .input_min = 12000000,
+       .input_max = 1000000000,
+       .cf_min = 12000000,
+       .cf_max = 75000000,
+       .vco_min = 1600000000,
+       .vco_max = 2400000000U,
+       .base_reg = PLLE_BASE,
+       .misc_reg = PLLE_MISC,
+       .aux_reg = PLLE_AUX,
+       .lock_mask = PLLE_MISC_LOCK,
+       .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .div_nmp = &plle_nmp,
+       .freq_table = pll_e_freq_table,
+       .flags = TEGRA_PLL_FIXED,
+       .fixed_rate = 100000000,
+};
+
+static const struct clk_div_table pll_re_div_table[] = {
+       { .val = 0, .div = 1 },
+       { .val = 1, .div = 2 },
+       { .val = 2, .div = 3 },
+       { .val = 3, .div = 4 },
+       { .val = 4, .div = 5 },
+       { .val = 5, .div = 6 },
+       { .val = 0, .div = 0 },
+};
+
+static struct div_nmp pllre_nmp = {
+       .divm_shift = 0,
+       .divm_width = 8,
+       .divn_shift = 8,
+       .divn_width = 8,
+       .divp_shift = 16,
+       .divp_width = 4,
+};
+
+static struct tegra_clk_pll_params pll_re_vco_params = {
+       .input_min = 12000000,
+       .input_max = 1000000000,
+       .cf_min = 12000000,
+       .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */
+       .vco_min = 300000000,
+       .vco_max = 600000000,
+       .base_reg = PLLRE_BASE,
+       .misc_reg = PLLRE_MISC,
+       .lock_mask = PLLRE_MISC_LOCK,
+       .lock_enable_bit_idx = PLLRE_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .iddq_reg = PLLRE_MISC,
+       .iddq_bit_idx = PLLRE_IDDQ_BIT,
+       .div_nmp = &pllre_nmp,
+       .flags = TEGRA_PLL_USE_LOCK,
+};
+
+static struct div_nmp pllp_nmp = {
+       .divm_shift = 0,
+       .divm_width = 5,
+       .divn_shift = 8,
+       .divn_width = 10,
+       .divp_shift = 20,
+       .divp_width = 3,
+};
+
+static struct tegra_clk_pll_freq_table pll_p_freq_table[] = {
+       {12000000, 216000000, 432, 12, 1, 8},
+       {13000000, 216000000, 432, 13, 1, 8},
+       {16800000, 216000000, 360, 14, 1, 8},
+       {19200000, 216000000, 360, 16, 1, 8},
+       {26000000, 216000000, 432, 26, 1, 8},
+       {0, 0, 0, 0, 0, 0},
+};
+
+static struct tegra_clk_pll_params pll_p_params = {
+       .input_min = 2000000,
+       .input_max = 31000000,
+       .cf_min = 1000000,
+       .cf_max = 6000000,
+       .vco_min = 200000000,
+       .vco_max = 700000000,
+       .base_reg = PLLP_BASE,
+       .misc_reg = PLLP_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .div_nmp = &pllp_nmp,
+       .freq_table = pll_p_freq_table,
+       .fixed_rate = 408000000,
+       .flags = TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK,
+};
+
+static struct tegra_clk_pll_freq_table pll_a_freq_table[] = {
+       {9600000, 282240000, 147, 5, 0, 4},
+       {9600000, 368640000, 192, 5, 0, 4},
+       {9600000, 240000000, 200, 8, 0, 8},
+
+       {28800000, 282240000, 245, 25, 0, 8},
+       {28800000, 368640000, 320, 25, 0, 8},
+       {28800000, 240000000, 200, 24, 0, 8},
+       {0, 0, 0, 0, 0, 0},
+};
+
+static struct tegra_clk_pll_params pll_a_params = {
+       .input_min = 2000000,
+       .input_max = 31000000,
+       .cf_min = 1000000,
+       .cf_max = 6000000,
+       .vco_min = 200000000,
+       .vco_max = 700000000,
+       .base_reg = PLLA_BASE,
+       .misc_reg = PLLA_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .div_nmp = &pllp_nmp,
+       .freq_table = pll_a_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
+};
+
+static struct tegra_clk_pll_freq_table pll_d_freq_table[] = {
+       {12000000, 216000000, 864, 12, 4, 12},
+       {13000000, 216000000, 864, 13, 4, 12},
+       {16800000, 216000000, 720, 14, 4, 12},
+       {19200000, 216000000, 720, 16, 4, 12},
+       {26000000, 216000000, 864, 26, 4, 12},
+
+       {12000000, 594000000, 594, 12, 1, 12},
+       {13000000, 594000000, 594, 13, 1, 12},
+       {16800000, 594000000, 495, 14, 1, 12},
+       {19200000, 594000000, 495, 16, 1, 12},
+       {26000000, 594000000, 594, 26, 1, 12},
+
+       {12000000, 1000000000, 1000, 12, 1, 12},
+       {13000000, 1000000000, 1000, 13, 1, 12},
+       {19200000, 1000000000, 625, 12, 1, 12},
+       {26000000, 1000000000, 1000, 26, 1, 12},
+
+       {0, 0, 0, 0, 0, 0},
+};
+
+static struct tegra_clk_pll_params pll_d_params = {
+       .input_min = 2000000,
+       .input_max = 40000000,
+       .cf_min = 1000000,
+       .cf_max = 6000000,
+       .vco_min = 500000000,
+       .vco_max = 1000000000,
+       .base_reg = PLLD_BASE,
+       .misc_reg = PLLD_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
+       .lock_delay = 1000,
+       .div_nmp = &pllp_nmp,
+       .freq_table = pll_d_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
+                TEGRA_PLL_USE_LOCK,
+};
+
+static struct tegra_clk_pll_freq_table tegra124_pll_d2_freq_table[] = {
+       { 12000000, 148500000,  99, 1, 8},
+       { 12000000, 594000000,  99, 1, 1},
+       { 13000000, 594000000,  91, 1, 1},      /* actual: 591.5 MHz */
+       { 16800000, 594000000,  71, 1, 1},      /* actual: 596.4 MHz */
+       { 19200000, 594000000,  62, 1, 1},      /* actual: 595.2 MHz */
+       { 26000000, 594000000,  91, 2, 1},      /* actual: 591.5 MHz */
+       { 0, 0, 0, 0, 0, 0 },
+};
+
+static struct tegra_clk_pll_params tegra124_pll_d2_params = {
+       .input_min = 12000000,
+       .input_max = 1000000000,
+       .cf_min = 12000000,
+       .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */
+       .vco_min = 600000000,
+       .vco_max = 1200000000,
+       .base_reg = PLLD2_BASE,
+       .misc_reg = PLLD2_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLLSS_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .iddq_reg = PLLD2_BASE,
+       .iddq_bit_idx = PLLSS_IDDQ_BIT,
+       .pdiv_tohw = pll12g_ssd_esd_p,
+       .div_nmp = &pllss_nmp,
+       .ext_misc_reg[0] = 0x570,
+       .ext_misc_reg[1] = 0x574,
+       .ext_misc_reg[2] = 0x578,
+       .max_p = 15,
+       .freq_table = tegra124_pll_d2_freq_table,
+};
+
+static struct tegra_clk_pll_freq_table pll_dp_freq_table[] = {
+       { 12000000, 600000000, 100, 1, 1},
+       { 13000000, 600000000,  92, 1, 1},      /* actual: 598.0 MHz */
+       { 16800000, 600000000,  71, 1, 1},      /* actual: 596.4 MHz */
+       { 19200000, 600000000,  62, 1, 1},      /* actual: 595.2 MHz */
+       { 26000000, 600000000,  92, 2, 1},      /* actual: 598.0 MHz */
+       { 0, 0, 0, 0, 0, 0 },
+};
+
+static struct tegra_clk_pll_params pll_dp_params = {
+       .input_min = 12000000,
+       .input_max = 1000000000,
+       .cf_min = 12000000,
+       .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */
+       .vco_min = 600000000,
+       .vco_max = 1200000000,
+       .base_reg = PLLDP_BASE,
+       .misc_reg = PLLDP_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLLSS_MISC_LOCK_ENABLE,
+       .lock_delay = 300,
+       .iddq_reg = PLLDP_BASE,
+       .iddq_bit_idx = PLLSS_IDDQ_BIT,
+       .pdiv_tohw = pll12g_ssd_esd_p,
+       .div_nmp = &pllss_nmp,
+       .ext_misc_reg[0] = 0x598,
+       .ext_misc_reg[1] = 0x59c,
+       .ext_misc_reg[2] = 0x5a0,
+       .max_p = 5,
+       .freq_table = pll_dp_freq_table,
+};
+
+static struct pdiv_map pllu_p[] = {
+       { .pdiv = 1, .hw_val = 1 },
+       { .pdiv = 2, .hw_val = 0 },
+       { .pdiv = 0, .hw_val = 0 },
+};
+
+static struct div_nmp pllu_nmp = {
+       .divm_shift = 0,
+       .divm_width = 5,
+       .divn_shift = 8,
+       .divn_width = 10,
+       .divp_shift = 20,
+       .divp_width = 1,
+};
+
+static struct tegra_clk_pll_freq_table pll_u_freq_table[] = {
+       {12000000, 480000000, 960, 12, 2, 12},
+       {13000000, 480000000, 960, 13, 2, 12},
+       {16800000, 480000000, 400, 7, 2, 5},
+       {19200000, 480000000, 200, 4, 2, 3},
+       {26000000, 480000000, 960, 26, 2, 12},
+       {0, 0, 0, 0, 0, 0},
+};
+
+static struct tegra_clk_pll_params pll_u_params = {
+       .input_min = 2000000,
+       .input_max = 40000000,
+       .cf_min = 1000000,
+       .cf_max = 6000000,
+       .vco_min = 480000000,
+       .vco_max = 960000000,
+       .base_reg = PLLU_BASE,
+       .misc_reg = PLLU_MISC,
+       .lock_mask = PLL_BASE_LOCK,
+       .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
+       .lock_delay = 1000,
+       .pdiv_tohw = pllu_p,
+       .div_nmp = &pllu_nmp,
+       .freq_table = pll_u_freq_table,
+       .flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
+                TEGRA_PLL_USE_LOCK,
+};
+
+struct utmi_clk_param {
+       /* Oscillator Frequency in KHz */
+       u32 osc_frequency;
+       /* UTMIP PLL Enable Delay Count  */
+       u8 enable_delay_count;
+       /* UTMIP PLL Stable count */
+       u8 stable_count;
+       /*  UTMIP PLL Active delay count */
+       u8 active_delay_count;
+       /* UTMIP PLL Xtal frequency count */
+       u8 xtal_freq_count;
+};
+
+static const struct utmi_clk_param utmi_parameters[] = {
+       {.osc_frequency = 13000000, .enable_delay_count = 0x02,
+        .stable_count = 0x33, .active_delay_count = 0x05,
+        .xtal_freq_count = 0x7F},
+       {.osc_frequency = 19200000, .enable_delay_count = 0x03,
+        .stable_count = 0x4B, .active_delay_count = 0x06,
+        .xtal_freq_count = 0xBB},
+       {.osc_frequency = 12000000, .enable_delay_count = 0x02,
+        .stable_count = 0x2F, .active_delay_count = 0x04,
+        .xtal_freq_count = 0x76},
+       {.osc_frequency = 26000000, .enable_delay_count = 0x04,
+        .stable_count = 0x66, .active_delay_count = 0x09,
+        .xtal_freq_count = 0xFE},
+       {.osc_frequency = 16800000, .enable_delay_count = 0x03,
+        .stable_count = 0x41, .active_delay_count = 0x0A,
+        .xtal_freq_count = 0xA4},
+};
+
+static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = {
+       [tegra_clk_ispb] = { .dt_id = TEGRA124_CLK_ISPB, .present = true },
+       [tegra_clk_rtc] = { .dt_id = TEGRA124_CLK_RTC, .present = true },
+       [tegra_clk_timer] = { .dt_id = TEGRA124_CLK_TIMER, .present = true },
+       [tegra_clk_uarta] = { .dt_id = TEGRA124_CLK_UARTA, .present = true },
+       [tegra_clk_sdmmc2] = { .dt_id = TEGRA124_CLK_SDMMC2, .present = true },
+       [tegra_clk_i2s1] = { .dt_id = TEGRA124_CLK_I2S1, .present = true },
+       [tegra_clk_i2c1] = { .dt_id = TEGRA124_CLK_I2C1, .present = true },
+       [tegra_clk_ndflash] = { .dt_id = TEGRA124_CLK_NDFLASH, .present = true },
+       [tegra_clk_sdmmc1] = { .dt_id = TEGRA124_CLK_SDMMC1, .present = true },
+       [tegra_clk_sdmmc4] = { .dt_id = TEGRA124_CLK_SDMMC4, .present = true },
+       [tegra_clk_pwm] = { .dt_id = TEGRA124_CLK_PWM, .present = true },
+       [tegra_clk_i2s2] = { .dt_id = TEGRA124_CLK_I2S2, .present = true },
+       [tegra_clk_gr2d] = { .dt_id = TEGRA124_CLK_GR_2D, .present = true },
+       [tegra_clk_usbd] = { .dt_id = TEGRA124_CLK_USBD, .present = true },
+       [tegra_clk_isp_8] = { .dt_id = TEGRA124_CLK_ISP, .present = true },
+       [tegra_clk_gr3d] = { .dt_id = TEGRA124_CLK_GR_3D, .present = true },
+       [tegra_clk_disp2] = { .dt_id = TEGRA124_CLK_DISP2, .present = true },
+       [tegra_clk_disp1] = { .dt_id = TEGRA124_CLK_DISP1, .present = true },
+       [tegra_clk_host1x] = { .dt_id = TEGRA124_CLK_HOST1X, .present = true },
+       [tegra_clk_vcp] = { .dt_id = TEGRA124_CLK_VCP, .present = true },
+       [tegra_clk_i2s0] = { .dt_id = TEGRA124_CLK_I2S0, .present = true },
+       [tegra_clk_apbdma] = { .dt_id = TEGRA124_CLK_APBDMA, .present = true },
+       [tegra_clk_kbc] = { .dt_id = TEGRA124_CLK_KBC, .present = true },
+       [tegra_clk_kfuse] = { .dt_id = TEGRA124_CLK_KFUSE, .present = true },
+       [tegra_clk_sbc1] = { .dt_id = TEGRA124_CLK_SBC1, .present = true },
+       [tegra_clk_nor] = { .dt_id = TEGRA124_CLK_NOR, .present = true },
+       [tegra_clk_sbc2] = { .dt_id = TEGRA124_CLK_SBC2, .present = true },
+       [tegra_clk_sbc3] = { .dt_id = TEGRA124_CLK_SBC3, .present = true },
+       [tegra_clk_i2c5] = { .dt_id = TEGRA124_CLK_I2C5, .present = true },
+       [tegra_clk_dsia] = { .dt_id = TEGRA124_CLK_DSIA, .present = true },
+       [tegra_clk_mipi] = { .dt_id = TEGRA124_CLK_MIPI, .present = true },
+       [tegra_clk_hdmi] = { .dt_id = TEGRA124_CLK_HDMI, .present = true },
+       [tegra_clk_csi] = { .dt_id = TEGRA124_CLK_CSI, .present = true },
+       [tegra_clk_i2c2] = { .dt_id = TEGRA124_CLK_I2C2, .present = true },
+       [tegra_clk_uartc] = { .dt_id = TEGRA124_CLK_UARTC, .present = true },
+       [tegra_clk_mipi_cal] = { .dt_id = TEGRA124_CLK_MIPI_CAL, .present = true },
+       [tegra_clk_emc] = { .dt_id = TEGRA124_CLK_EMC, .present = true },
+       [tegra_clk_usb2] = { .dt_id = TEGRA124_CLK_USB2, .present = true },
+       [tegra_clk_usb3] = { .dt_id = TEGRA124_CLK_USB3, .present = true },
+       [tegra_clk_vde_8] = { .dt_id = TEGRA124_CLK_VDE, .present = true },
+       [tegra_clk_bsea] = { .dt_id = TEGRA124_CLK_BSEA, .present = true },
+       [tegra_clk_bsev] = { .dt_id = TEGRA124_CLK_BSEV, .present = true },
+       [tegra_clk_uartd] = { .dt_id = TEGRA124_CLK_UARTD, .present = true },
+       [tegra_clk_i2c3] = { .dt_id = TEGRA124_CLK_I2C3, .present = true },
+       [tegra_clk_sbc4] = { .dt_id = TEGRA124_CLK_SBC4, .present = true },
+       [tegra_clk_sdmmc3] = { .dt_id = TEGRA124_CLK_SDMMC3, .present = true },
+       [tegra_clk_pcie] = { .dt_id = TEGRA124_CLK_PCIE, .present = true },
+       [tegra_clk_owr] = { .dt_id = TEGRA124_CLK_OWR, .present = true },
+       [tegra_clk_afi] = { .dt_id = TEGRA124_CLK_AFI, .present = true },
+       [tegra_clk_csite] = { .dt_id = TEGRA124_CLK_CSITE, .present = true },
+       [tegra_clk_la] = { .dt_id = TEGRA124_CLK_LA, .present = true },
+       [tegra_clk_trace] = { .dt_id = TEGRA124_CLK_TRACE, .present = true },
+       [tegra_clk_soc_therm] = { .dt_id = TEGRA124_CLK_SOC_THERM, .present = true },
+       [tegra_clk_dtv] = { .dt_id = TEGRA124_CLK_DTV, .present = true },
+       [tegra_clk_ndspeed] = { .dt_id = TEGRA124_CLK_NDSPEED, .present = true },
+       [tegra_clk_i2cslow] = { .dt_id = TEGRA124_CLK_I2CSLOW, .present = true },
+       [tegra_clk_dsib] = { .dt_id = TEGRA124_CLK_DSIB, .present = true },
+       [tegra_clk_tsec] = { .dt_id = TEGRA124_CLK_TSEC, .present = true },
+       [tegra_clk_xusb_host] = { .dt_id = TEGRA124_CLK_XUSB_HOST, .present = true },
+       [tegra_clk_msenc] = { .dt_id = TEGRA124_CLK_MSENC, .present = true },
+       [tegra_clk_csus] = { .dt_id = TEGRA124_CLK_CSUS, .present = true },
+       [tegra_clk_mselect] = { .dt_id = TEGRA124_CLK_MSELECT, .present = true },
+       [tegra_clk_tsensor] = { .dt_id = TEGRA124_CLK_TSENSOR, .present = true },
+       [tegra_clk_i2s3] = { .dt_id = TEGRA124_CLK_I2S3, .present = true },
+       [tegra_clk_i2s4] = { .dt_id = TEGRA124_CLK_I2S4, .present = true },
+       [tegra_clk_i2c4] = { .dt_id = TEGRA124_CLK_I2C4, .present = true },
+       [tegra_clk_sbc5] = { .dt_id = TEGRA124_CLK_SBC5, .present = true },
+       [tegra_clk_sbc6] = { .dt_id = TEGRA124_CLK_SBC6, .present = true },
+       [tegra_clk_d_audio] = { .dt_id = TEGRA124_CLK_D_AUDIO, .present = true },
+       [tegra_clk_apbif] = { .dt_id = TEGRA124_CLK_APBIF, .present = true },
+       [tegra_clk_dam0] = { .dt_id = TEGRA124_CLK_DAM0, .present = true },
+       [tegra_clk_dam1] = { .dt_id = TEGRA124_CLK_DAM1, .present = true },
+       [tegra_clk_dam2] = { .dt_id = TEGRA124_CLK_DAM2, .present = true },
+       [tegra_clk_hda2codec_2x] = { .dt_id = TEGRA124_CLK_HDA2CODEC_2X, .present = true },
+       [tegra_clk_audio0_2x] = { .dt_id = TEGRA124_CLK_AUDIO0_2X, .present = true },
+       [tegra_clk_audio1_2x] = { .dt_id = TEGRA124_CLK_AUDIO1_2X, .present = true },
+       [tegra_clk_audio2_2x] = { .dt_id = TEGRA124_CLK_AUDIO2_2X, .present = true },
+       [tegra_clk_audio3_2x] = { .dt_id = TEGRA124_CLK_AUDIO3_2X, .present = true },
+       [tegra_clk_audio4_2x] = { .dt_id = TEGRA124_CLK_AUDIO4_2X, .present = true },
+       [tegra_clk_spdif_2x] = { .dt_id = TEGRA124_CLK_SPDIF_2X, .present = true },
+       [tegra_clk_actmon] = { .dt_id = TEGRA124_CLK_ACTMON, .present = true },
+       [tegra_clk_extern1] = { .dt_id = TEGRA124_CLK_EXTERN1, .present = true },
+       [tegra_clk_extern2] = { .dt_id = TEGRA124_CLK_EXTERN2, .present = true },
+       [tegra_clk_extern3] = { .dt_id = TEGRA124_CLK_EXTERN3, .present = true },
+       [tegra_clk_sata_oob] = { .dt_id = TEGRA124_CLK_SATA_OOB, .present = true },
+       [tegra_clk_sata] = { .dt_id = TEGRA124_CLK_SATA, .present = true },
+       [tegra_clk_hda] = { .dt_id = TEGRA124_CLK_HDA, .present = true },
+       [tegra_clk_se] = { .dt_id = TEGRA124_CLK_SE, .present = true },
+       [tegra_clk_hda2hdmi] = { .dt_id = TEGRA124_CLK_HDA2HDMI, .present = true },
+       [tegra_clk_sata_cold] = { .dt_id = TEGRA124_CLK_SATA_COLD, .present = true },
+       [tegra_clk_cilab] = { .dt_id = TEGRA124_CLK_CILAB, .present = true },
+       [tegra_clk_cilcd] = { .dt_id = TEGRA124_CLK_CILCD, .present = true },
+       [tegra_clk_cile] = { .dt_id = TEGRA124_CLK_CILE, .present = true },
+       [tegra_clk_dsialp] = { .dt_id = TEGRA124_CLK_DSIALP, .present = true },
+       [tegra_clk_dsiblp] = { .dt_id = TEGRA124_CLK_DSIBLP, .present = true },
+       [tegra_clk_entropy] = { .dt_id = TEGRA124_CLK_ENTROPY, .present = true },
+       [tegra_clk_dds] = { .dt_id = TEGRA124_CLK_DDS, .present = true },
+       [tegra_clk_dp2] = { .dt_id = TEGRA124_CLK_DP2, .present = true },
+       [tegra_clk_amx] = { .dt_id = TEGRA124_CLK_AMX, .present = true },
+       [tegra_clk_adx] = { .dt_id = TEGRA124_CLK_ADX, .present = true },
+       [tegra_clk_xusb_ss] = { .dt_id = TEGRA124_CLK_XUSB_SS, .present = true },
+       [tegra_clk_i2c6] = { .dt_id = TEGRA124_CLK_I2C6, .present = true },
+       [tegra_clk_vim2_clk] = { .dt_id = TEGRA124_CLK_VIM2_CLK, .present = true },
+       [tegra_clk_hdmi_audio] = { .dt_id = TEGRA124_CLK_HDMI_AUDIO, .present = true },
+       [tegra_clk_clk72Mhz] = { .dt_id = TEGRA124_CLK_CLK72MHZ, .present = true },
+       [tegra_clk_vic03] = { .dt_id = TEGRA124_CLK_VIC03, .present = true },
+       [tegra_clk_adx1] = { .dt_id = TEGRA124_CLK_ADX1, .present = true },
+       [tegra_clk_dpaux] = { .dt_id = TEGRA124_CLK_DPAUX, .present = true },
+       [tegra_clk_sor0] = { .dt_id = TEGRA124_CLK_SOR0, .present = true },
+       [tegra_clk_sor0_lvds] = { .dt_id = TEGRA124_CLK_SOR0_LVDS, .present = true },
+       [tegra_clk_gpu] = { .dt_id = TEGRA124_CLK_GPU, .present = true },
+       [tegra_clk_amx1] = { .dt_id = TEGRA124_CLK_AMX1, .present = true },
+       [tegra_clk_uartb] = { .dt_id = TEGRA124_CLK_UARTB, .present = true },
+       [tegra_clk_vfir] = { .dt_id = TEGRA124_CLK_VFIR, .present = true },
+       [tegra_clk_spdif_in] = { .dt_id = TEGRA124_CLK_SPDIF_IN, .present = true },
+       [tegra_clk_spdif_out] = { .dt_id = TEGRA124_CLK_SPDIF_OUT, .present = true },
+       [tegra_clk_vi_9] = { .dt_id = TEGRA124_CLK_VI, .present = true },
+       [tegra_clk_vi_sensor] = { .dt_id = TEGRA124_CLK_VI_SENSOR, .present = true },
+       [tegra_clk_fuse] = { .dt_id = TEGRA124_CLK_FUSE, .present = true },
+       [tegra_clk_fuse_burn] = { .dt_id = TEGRA124_CLK_FUSE_BURN, .present = true },
+       [tegra_clk_clk_32k] = { .dt_id = TEGRA124_CLK_CLK_32K, .present = true },
+       [tegra_clk_clk_m] = { .dt_id = TEGRA124_CLK_CLK_M, .present = true },
+       [tegra_clk_clk_m_div2] = { .dt_id = TEGRA124_CLK_CLK_M_DIV2, .present = true },
+       [tegra_clk_clk_m_div4] = { .dt_id = TEGRA124_CLK_CLK_M_DIV4, .present = true },
+       [tegra_clk_pll_ref] = { .dt_id = TEGRA124_CLK_PLL_REF, .present = true },
+       [tegra_clk_pll_c] = { .dt_id = TEGRA124_CLK_PLL_C, .present = true },
+       [tegra_clk_pll_c_out1] = { .dt_id = TEGRA124_CLK_PLL_C_OUT1, .present = true },
+       [tegra_clk_pll_c2] = { .dt_id = TEGRA124_CLK_PLL_C2, .present = true },
+       [tegra_clk_pll_c3] = { .dt_id = TEGRA124_CLK_PLL_C3, .present = true },
+       [tegra_clk_pll_m] = { .dt_id = TEGRA124_CLK_PLL_M, .present = true },
+       [tegra_clk_pll_m_out1] = { .dt_id = TEGRA124_CLK_PLL_M_OUT1, .present = true },
+       [tegra_clk_pll_p] = { .dt_id = TEGRA124_CLK_PLL_P, .present = true },
+       [tegra_clk_pll_p_out1] = { .dt_id = TEGRA124_CLK_PLL_P_OUT1, .present = true },
+       [tegra_clk_pll_p_out2] = { .dt_id = TEGRA124_CLK_PLL_P_OUT2, .present = true },
+       [tegra_clk_pll_p_out3] = { .dt_id = TEGRA124_CLK_PLL_P_OUT3, .present = true },
+       [tegra_clk_pll_p_out4] = { .dt_id = TEGRA124_CLK_PLL_P_OUT4, .present = true },
+       [tegra_clk_pll_a] = { .dt_id = TEGRA124_CLK_PLL_A, .present = true },
+       [tegra_clk_pll_a_out0] = { .dt_id = TEGRA124_CLK_PLL_A_OUT0, .present = true },
+       [tegra_clk_pll_d] = { .dt_id = TEGRA124_CLK_PLL_D, .present = true },
+       [tegra_clk_pll_d_out0] = { .dt_id = TEGRA124_CLK_PLL_D_OUT0, .present = true },
+       [tegra_clk_pll_d2] = { .dt_id = TEGRA124_CLK_PLL_D2, .present = true },
+       [tegra_clk_pll_d2_out0] = { .dt_id = TEGRA124_CLK_PLL_D2_OUT0, .present = true },
+       [tegra_clk_pll_u] = { .dt_id = TEGRA124_CLK_PLL_U, .present = true },
+       [tegra_clk_pll_u_480m] = { .dt_id = TEGRA124_CLK_PLL_U_480M, .present = true },
+       [tegra_clk_pll_u_60m] = { .dt_id = TEGRA124_CLK_PLL_U_60M, .present = true },
+       [tegra_clk_pll_u_48m] = { .dt_id = TEGRA124_CLK_PLL_U_48M, .present = true },
+       [tegra_clk_pll_u_12m] = { .dt_id = TEGRA124_CLK_PLL_U_12M, .present = true },
+       [tegra_clk_pll_x] = { .dt_id = TEGRA124_CLK_PLL_X, .present = true },
+       [tegra_clk_pll_x_out0] = { .dt_id = TEGRA124_CLK_PLL_X_OUT0, .present = true },
+       [tegra_clk_pll_re_vco] = { .dt_id = TEGRA124_CLK_PLL_RE_VCO, .present = true },
+       [tegra_clk_pll_re_out] = { .dt_id = TEGRA124_CLK_PLL_RE_OUT, .present = true },
+       [tegra_clk_spdif_in_sync] = { .dt_id = TEGRA124_CLK_SPDIF_IN_SYNC, .present = true },
+       [tegra_clk_i2s0_sync] = { .dt_id = TEGRA124_CLK_I2S0_SYNC, .present = true },
+       [tegra_clk_i2s1_sync] = { .dt_id = TEGRA124_CLK_I2S1_SYNC, .present = true },
+       [tegra_clk_i2s2_sync] = { .dt_id = TEGRA124_CLK_I2S2_SYNC, .present = true },
+       [tegra_clk_i2s3_sync] = { .dt_id = TEGRA124_CLK_I2S3_SYNC, .present = true },
+       [tegra_clk_i2s4_sync] = { .dt_id = TEGRA124_CLK_I2S4_SYNC, .present = true },
+       [tegra_clk_vimclk_sync] = { .dt_id = TEGRA124_CLK_VIMCLK_SYNC, .present = true },
+       [tegra_clk_audio0] = { .dt_id = TEGRA124_CLK_AUDIO0, .present = true },
+       [tegra_clk_audio1] = { .dt_id = TEGRA124_CLK_AUDIO1, .present = true },
+       [tegra_clk_audio2] = { .dt_id = TEGRA124_CLK_AUDIO2, .present = true },
+       [tegra_clk_audio3] = { .dt_id = TEGRA124_CLK_AUDIO3, .present = true },
+       [tegra_clk_audio4] = { .dt_id = TEGRA124_CLK_AUDIO4, .present = true },
+       [tegra_clk_spdif] = { .dt_id = TEGRA124_CLK_SPDIF, .present = true },
+       [tegra_clk_clk_out_1] = { .dt_id = TEGRA124_CLK_CLK_OUT_1, .present = true },
+       [tegra_clk_clk_out_2] = { .dt_id = TEGRA124_CLK_CLK_OUT_2, .present = true },
+       [tegra_clk_clk_out_3] = { .dt_id = TEGRA124_CLK_CLK_OUT_3, .present = true },
+       [tegra_clk_blink] = { .dt_id = TEGRA124_CLK_BLINK, .present = true },
+       [tegra_clk_xusb_host_src] = { .dt_id = TEGRA124_CLK_XUSB_HOST_SRC, .present = true },
+       [tegra_clk_xusb_falcon_src] = { .dt_id = TEGRA124_CLK_XUSB_FALCON_SRC, .present = true },
+       [tegra_clk_xusb_fs_src] = { .dt_id = TEGRA124_CLK_XUSB_FS_SRC, .present = true },
+       [tegra_clk_xusb_ss_src] = { .dt_id = TEGRA124_CLK_XUSB_SS_SRC, .present = true },
+       [tegra_clk_xusb_dev_src] = { .dt_id = TEGRA124_CLK_XUSB_DEV_SRC, .present = true },
+       [tegra_clk_xusb_dev] = { .dt_id = TEGRA124_CLK_XUSB_DEV, .present = true },
+       [tegra_clk_xusb_hs_src] = { .dt_id = TEGRA124_CLK_XUSB_HS_SRC, .present = true },
+       [tegra_clk_sclk] = { .dt_id = TEGRA124_CLK_SCLK, .present = true },
+       [tegra_clk_hclk] = { .dt_id = TEGRA124_CLK_HCLK, .present = true },
+       [tegra_clk_pclk] = { .dt_id = TEGRA124_CLK_PCLK, .present = true },
+       [tegra_clk_cclk_g] = { .dt_id = TEGRA124_CLK_CCLK_G, .present = true },
+       [tegra_clk_cclk_lp] = { .dt_id = TEGRA124_CLK_CCLK_LP, .present = true },
+       [tegra_clk_dfll_ref] = { .dt_id = TEGRA124_CLK_DFLL_REF, .present = true },
+       [tegra_clk_dfll_soc] = { .dt_id = TEGRA124_CLK_DFLL_SOC, .present = true },
+       [tegra_clk_vi_sensor2] = { .dt_id = TEGRA124_CLK_VI_SENSOR2, .present = true },
+       [tegra_clk_pll_p_out5] = { .dt_id = TEGRA124_CLK_PLL_P_OUT5, .present = true },
+       [tegra_clk_pll_c4] = { .dt_id = TEGRA124_CLK_PLL_C4, .present = true },
+       [tegra_clk_pll_dp] = { .dt_id = TEGRA124_CLK_PLL_DP, .present = true },
+       [tegra_clk_audio0_mux] = { .dt_id = TEGRA124_CLK_AUDIO0_MUX, .present = true },
+       [tegra_clk_audio1_mux] = { .dt_id = TEGRA124_CLK_AUDIO1_MUX, .present = true },
+       [tegra_clk_audio2_mux] = { .dt_id = TEGRA124_CLK_AUDIO2_MUX, .present = true },
+       [tegra_clk_audio3_mux] = { .dt_id = TEGRA124_CLK_AUDIO3_MUX, .present = true },
+       [tegra_clk_audio4_mux] = { .dt_id = TEGRA124_CLK_AUDIO4_MUX, .present = true },
+       [tegra_clk_spdif_mux] = { .dt_id = TEGRA124_CLK_SPDIF_MUX, .present = true },
+       [tegra_clk_clk_out_1_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_1_MUX, .present = true },
+       [tegra_clk_clk_out_2_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_2_MUX, .present = true },
+       [tegra_clk_clk_out_3_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_3_MUX, .present = true },
+       [tegra_clk_dsia_mux] = { .dt_id = TEGRA124_CLK_DSIA_MUX, .present = true },
+       [tegra_clk_dsib_mux] = { .dt_id = TEGRA124_CLK_DSIB_MUX, .present = true },
+       [tegra_clk_uarte] = { .dt_id = TEGRA124_CLK_UARTE, .present = true },
+};
+
+static struct tegra_devclk devclks[] __initdata = {
+       { .con_id = "clk_m", .dt_id = TEGRA124_CLK_CLK_M },
+       { .con_id = "pll_ref", .dt_id = TEGRA124_CLK_PLL_REF },
+       { .con_id = "clk_32k", .dt_id = TEGRA124_CLK_CLK_32K },
+       { .con_id = "clk_m_div2", .dt_id = TEGRA124_CLK_CLK_M_DIV2 },
+       { .con_id = "clk_m_div4", .dt_id = TEGRA124_CLK_CLK_M_DIV4 },
+       { .con_id = "pll_c", .dt_id = TEGRA124_CLK_PLL_C },
+       { .con_id = "pll_c_out1", .dt_id = TEGRA124_CLK_PLL_C_OUT1 },
+       { .con_id = "pll_c2", .dt_id = TEGRA124_CLK_PLL_C2 },
+       { .con_id = "pll_c3", .dt_id = TEGRA124_CLK_PLL_C3 },
+       { .con_id = "pll_p", .dt_id = TEGRA124_CLK_PLL_P },
+       { .con_id = "pll_p_out1", .dt_id = TEGRA124_CLK_PLL_P_OUT1 },
+       { .con_id = "pll_p_out2", .dt_id = TEGRA124_CLK_PLL_P_OUT2 },
+       { .con_id = "pll_p_out3", .dt_id = TEGRA124_CLK_PLL_P_OUT3 },
+       { .con_id = "pll_p_out4", .dt_id = TEGRA124_CLK_PLL_P_OUT4 },
+       { .con_id = "pll_m", .dt_id = TEGRA124_CLK_PLL_M },
+       { .con_id = "pll_m_out1", .dt_id = TEGRA124_CLK_PLL_M_OUT1 },
+       { .con_id = "pll_x", .dt_id = TEGRA124_CLK_PLL_X },
+       { .con_id = "pll_x_out0", .dt_id = TEGRA124_CLK_PLL_X_OUT0 },
+       { .con_id = "pll_u", .dt_id = TEGRA124_CLK_PLL_U },
+       { .con_id = "pll_u_480M", .dt_id = TEGRA124_CLK_PLL_U_480M },
+       { .con_id = "pll_u_60M", .dt_id = TEGRA124_CLK_PLL_U_60M },
+       { .con_id = "pll_u_48M", .dt_id = TEGRA124_CLK_PLL_U_48M },
+       { .con_id = "pll_u_12M", .dt_id = TEGRA124_CLK_PLL_U_12M },
+       { .con_id = "pll_d", .dt_id = TEGRA124_CLK_PLL_D },
+       { .con_id = "pll_d_out0", .dt_id = TEGRA124_CLK_PLL_D_OUT0 },
+       { .con_id = "pll_d2", .dt_id = TEGRA124_CLK_PLL_D2 },
+       { .con_id = "pll_d2_out0", .dt_id = TEGRA124_CLK_PLL_D2_OUT0 },
+       { .con_id = "pll_a", .dt_id = TEGRA124_CLK_PLL_A },
+       { .con_id = "pll_a_out0", .dt_id = TEGRA124_CLK_PLL_A_OUT0 },
+       { .con_id = "pll_re_vco", .dt_id = TEGRA124_CLK_PLL_RE_VCO },
+       { .con_id = "pll_re_out", .dt_id = TEGRA124_CLK_PLL_RE_OUT },
+       { .con_id = "spdif_in_sync", .dt_id = TEGRA124_CLK_SPDIF_IN_SYNC },
+       { .con_id = "i2s0_sync", .dt_id = TEGRA124_CLK_I2S0_SYNC },
+       { .con_id = "i2s1_sync", .dt_id = TEGRA124_CLK_I2S1_SYNC },
+       { .con_id = "i2s2_sync", .dt_id = TEGRA124_CLK_I2S2_SYNC },
+       { .con_id = "i2s3_sync", .dt_id = TEGRA124_CLK_I2S3_SYNC },
+       { .con_id = "i2s4_sync", .dt_id = TEGRA124_CLK_I2S4_SYNC },
+       { .con_id = "vimclk_sync", .dt_id = TEGRA124_CLK_VIMCLK_SYNC },
+       { .con_id = "audio0", .dt_id = TEGRA124_CLK_AUDIO0 },
+       { .con_id = "audio1", .dt_id = TEGRA124_CLK_AUDIO1 },
+       { .con_id = "audio2", .dt_id = TEGRA124_CLK_AUDIO2 },
+       { .con_id = "audio3", .dt_id = TEGRA124_CLK_AUDIO3 },
+       { .con_id = "audio4", .dt_id = TEGRA124_CLK_AUDIO4 },
+       { .con_id = "spdif", .dt_id = TEGRA124_CLK_SPDIF },
+       { .con_id = "audio0_2x", .dt_id = TEGRA124_CLK_AUDIO0_2X },
+       { .con_id = "audio1_2x", .dt_id = TEGRA124_CLK_AUDIO1_2X },
+       { .con_id = "audio2_2x", .dt_id = TEGRA124_CLK_AUDIO2_2X },
+       { .con_id = "audio3_2x", .dt_id = TEGRA124_CLK_AUDIO3_2X },
+       { .con_id = "audio4_2x", .dt_id = TEGRA124_CLK_AUDIO4_2X },
+       { .con_id = "spdif_2x", .dt_id = TEGRA124_CLK_SPDIF_2X },
+       { .con_id = "extern1", .dev_id = "clk_out_1", .dt_id = TEGRA124_CLK_EXTERN1 },
+       { .con_id = "extern2", .dev_id = "clk_out_2", .dt_id = TEGRA124_CLK_EXTERN2 },
+       { .con_id = "extern3", .dev_id = "clk_out_3", .dt_id = TEGRA124_CLK_EXTERN3 },
+       { .con_id = "blink", .dt_id = TEGRA124_CLK_BLINK },
+       { .con_id = "cclk_g", .dt_id = TEGRA124_CLK_CCLK_G },
+       { .con_id = "cclk_lp", .dt_id = TEGRA124_CLK_CCLK_LP },
+       { .con_id = "sclk", .dt_id = TEGRA124_CLK_SCLK },
+       { .con_id = "hclk", .dt_id = TEGRA124_CLK_HCLK },
+       { .con_id = "pclk", .dt_id = TEGRA124_CLK_PCLK },
+       { .con_id = "fuse", .dt_id = TEGRA124_CLK_FUSE },
+       { .dev_id = "rtc-tegra", .dt_id = TEGRA124_CLK_RTC },
+       { .dev_id = "timer", .dt_id = TEGRA124_CLK_TIMER },
+};
+
+static struct clk **clks;
+
+static void tegra124_utmi_param_configure(void __iomem *clk_base)
+{
+       u32 reg;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(utmi_parameters); i++) {
+               if (osc_freq == utmi_parameters[i].osc_frequency)
+                       break;
+       }
+
+       if (i >= ARRAY_SIZE(utmi_parameters)) {
+               pr_err("%s: Unexpected oscillator freq %lu\n", __func__,
+                      osc_freq);
+               return;
+       }
+
+       reg = readl_relaxed(clk_base + UTMIP_PLL_CFG2);
+
+       /* Program UTMIP PLL stable and active counts */
+       /* [FIXME] arclk_rst.h says WRONG! This should be 1ms -> 0x50 Check! */
+       reg &= ~UTMIP_PLL_CFG2_STABLE_COUNT(~0);
+       reg |= UTMIP_PLL_CFG2_STABLE_COUNT(utmi_parameters[i].stable_count);
+
+       reg &= ~UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(~0);
+
+       reg |= UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(utmi_parameters[i].
+                                           active_delay_count);
+
+       /* Remove power downs from UTMIP PLL control bits */
+       reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN;
+       reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN;
+       reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN;
+
+       writel_relaxed(reg, clk_base + UTMIP_PLL_CFG2);
+
+       /* Program UTMIP PLL delay and oscillator frequency counts */
+       reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1);
+       reg &= ~UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(~0);
+
+       reg |= UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(utmi_parameters[i].
+                                           enable_delay_count);
+
+       reg &= ~UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(~0);
+       reg |= UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(utmi_parameters[i].
+                                          xtal_freq_count);
+
+       /* Remove power downs from UTMIP PLL control bits */
+       reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN;
+       reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN;
+       reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP;
+       reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN;
+       writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1);
+
+       /* Setup HW control of UTMIPLL */
+       reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0);
+       reg |= UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET;
+       reg &= ~UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL;
+       reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE;
+       writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0);
+
+       reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1);
+       reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP;
+       reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN;
+       writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1);
+
+       udelay(1);
+
+       /* Setup SW override of UTMIPLL assuming USB2.0
+          ports are assigned to USB2 */
+       reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0);
+       reg |= UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL;
+       reg &= ~UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE;
+       writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0);
+
+       udelay(1);
+
+       /* Enable HW control UTMIPLL */
+       reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0);
+       reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE;
+       writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0);
+}
+
+static __init void tegra124_periph_clk_init(void __iomem *clk_base,
+                                           void __iomem *pmc_base)
+{
+       struct clk *clk;
+       u32 val;
+
+       /* xusb_hs_src */
+       val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC);
+       val |= BIT(25); /* always select PLLU_60M */
+       writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC);
+
+       clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0,
+                                       1, 1);
+       clks[TEGRA124_CLK_XUSB_HS_SRC] = clk;
+
+       /* dsia mux */
+       clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0,
+                              ARRAY_SIZE(mux_plld_out0_plld2_out0), 0,
+                              clk_base + PLLD_BASE, 25, 1, 0, &pll_d_lock);
+       clks[TEGRA124_CLK_DSIA_MUX] = clk;
+
+       /* dsib mux */
+       clk = clk_register_mux(NULL, "dsib_mux", mux_plld_out0_plld2_out0,
+                              ARRAY_SIZE(mux_plld_out0_plld2_out0), 0,
+                              clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock);
+       clks[TEGRA124_CLK_DSIB_MUX] = clk;
+
+       /* emc mux */
+       clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm,
+                              ARRAY_SIZE(mux_pllmcp_clkm), 0,
+                              clk_base + CLK_SOURCE_EMC,
+                              29, 3, 0, NULL);
+
+       /* cml0 */
+       clk = clk_register_gate(NULL, "cml0", "pll_e", 0, clk_base + PLLE_AUX,
+                               0, 0, &pll_e_lock);
+       clk_register_clkdev(clk, "cml0", NULL);
+       clks[TEGRA124_CLK_CML0] = clk;
+
+       /* cml1 */
+       clk = clk_register_gate(NULL, "cml1", "pll_e", 0, clk_base + PLLE_AUX,
+                               1, 0, &pll_e_lock);
+       clk_register_clkdev(clk, "cml1", NULL);
+       clks[TEGRA124_CLK_CML1] = clk;
+
+       tegra_periph_clk_init(clk_base, pmc_base, tegra124_clks, &pll_p_params);
+}
+
+static void __init tegra124_pll_init(void __iomem *clk_base,
+                                    void __iomem *pmc)
+{
+       u32 val;
+       struct clk *clk;
+
+       /* PLLC */
+       clk = tegra_clk_register_pllxc("pll_c", "pll_ref", clk_base,
+                       pmc, 0, &pll_c_params, NULL);
+       clk_register_clkdev(clk, "pll_c", NULL);
+       clks[TEGRA124_CLK_PLL_C] = clk;
+
+       /* PLLC_OUT1 */
+       clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c",
+                       clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP,
+                       8, 8, 1, NULL);
+       clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div",
+                               clk_base + PLLC_OUT, 1, 0,
+                               CLK_SET_RATE_PARENT, 0, NULL);
+       clk_register_clkdev(clk, "pll_c_out1", NULL);
+       clks[TEGRA124_CLK_PLL_C_OUT1] = clk;
+
+       /* PLLC2 */
+       clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0,
+                            &pll_c2_params, NULL);
+       clk_register_clkdev(clk, "pll_c2", NULL);
+       clks[TEGRA124_CLK_PLL_C2] = clk;
+
+       /* PLLC3 */
+       clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0,
+                            &pll_c3_params, NULL);
+       clk_register_clkdev(clk, "pll_c3", NULL);
+       clks[TEGRA124_CLK_PLL_C3] = clk;
+
+       /* PLLM */
+       clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc,
+                            CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE,
+                            &pll_m_params, NULL);
+       clk_register_clkdev(clk, "pll_m", NULL);
+       clks[TEGRA124_CLK_PLL_M] = clk;
+
+       /* PLLM_OUT1 */
+       clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m",
+                               clk_base + PLLM_OUT, 0, TEGRA_DIVIDER_ROUND_UP,
+                               8, 8, 1, NULL);
+       clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div",
+                               clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED |
+                               CLK_SET_RATE_PARENT, 0, NULL);
+       clk_register_clkdev(clk, "pll_m_out1", NULL);
+       clks[TEGRA124_CLK_PLL_M_OUT1] = clk;
+
+       /* PLLM_UD */
+       clk = clk_register_fixed_factor(NULL, "pll_m_ud", "pll_m",
+                                       CLK_SET_RATE_PARENT, 1, 1);
+
+       /* PLLU */
+       val = readl(clk_base + pll_u_params.base_reg);
+       val &= ~BIT(24); /* disable PLLU_OVERRIDE */
+       writel(val, clk_base + pll_u_params.base_reg);
+
+       clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0,
+                           &pll_u_params, &pll_u_lock);
+       clk_register_clkdev(clk, "pll_u", NULL);
+       clks[TEGRA124_CLK_PLL_U] = clk;
+
+       tegra124_utmi_param_configure(clk_base);
+
+       /* PLLU_480M */
+       clk = clk_register_gate(NULL, "pll_u_480M", "pll_u",
+                               CLK_SET_RATE_PARENT, clk_base + PLLU_BASE,
+                               22, 0, &pll_u_lock);
+       clk_register_clkdev(clk, "pll_u_480M", NULL);
+       clks[TEGRA124_CLK_PLL_U_480M] = clk;
+
+       /* PLLU_60M */
+       clk = clk_register_fixed_factor(NULL, "pll_u_60M", "pll_u",
+                                       CLK_SET_RATE_PARENT, 1, 8);
+       clk_register_clkdev(clk, "pll_u_60M", NULL);
+       clks[TEGRA124_CLK_PLL_U_60M] = clk;
+
+       /* PLLU_48M */
+       clk = clk_register_fixed_factor(NULL, "pll_u_48M", "pll_u",
+                                       CLK_SET_RATE_PARENT, 1, 10);
+       clk_register_clkdev(clk, "pll_u_48M", NULL);
+       clks[TEGRA124_CLK_PLL_U_48M] = clk;
+
+       /* PLLU_12M */
+       clk = clk_register_fixed_factor(NULL, "pll_u_12M", "pll_u",
+                                       CLK_SET_RATE_PARENT, 1, 40);
+       clk_register_clkdev(clk, "pll_u_12M", NULL);
+       clks[TEGRA124_CLK_PLL_U_12M] = clk;
+
+       /* PLLD */
+       clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0,
+                           &pll_d_params, &pll_d_lock);
+       clk_register_clkdev(clk, "pll_d", NULL);
+       clks[TEGRA124_CLK_PLL_D] = clk;
+
+       /* PLLD_OUT0 */
+       clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d",
+                                       CLK_SET_RATE_PARENT, 1, 2);
+       clk_register_clkdev(clk, "pll_d_out0", NULL);
+       clks[TEGRA124_CLK_PLL_D_OUT0] = clk;
+
+       /* PLLRE */
+       clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc,
+                            0, &pll_re_vco_params, &pll_re_lock, pll_ref_freq);
+       clk_register_clkdev(clk, "pll_re_vco", NULL);
+       clks[TEGRA124_CLK_PLL_RE_VCO] = clk;
+
+       clk = clk_register_divider_table(NULL, "pll_re_out", "pll_re_vco", 0,
+                                        clk_base + PLLRE_BASE, 16, 4, 0,
+                                        pll_re_div_table, &pll_re_lock);
+       clk_register_clkdev(clk, "pll_re_out", NULL);
+       clks[TEGRA124_CLK_PLL_RE_OUT] = clk;
+
+       /* PLLE */
+       clk = tegra_clk_register_plle_tegra114("pll_e", "pll_ref",
+                                     clk_base, 0, &pll_e_params, NULL);
+       clk_register_clkdev(clk, "pll_e", NULL);
+       clks[TEGRA124_CLK_PLL_E] = clk;
+
+       /* PLLC4 */
+       clk = tegra_clk_register_pllss("pll_c4", "pll_ref", clk_base, 0,
+                                       &pll_c4_params, NULL);
+       clk_register_clkdev(clk, "pll_c4", NULL);
+       clks[TEGRA124_CLK_PLL_C4] = clk;
+
+       /* PLLDP */
+       clk = tegra_clk_register_pllss("pll_dp", "pll_ref", clk_base, 0,
+                                       &pll_dp_params, NULL);
+       clk_register_clkdev(clk, "pll_dp", NULL);
+       clks[TEGRA124_CLK_PLL_DP] = clk;
+
+       /* PLLD2 */
+       clk = tegra_clk_register_pllss("pll_d2", "pll_ref", clk_base, 0,
+                                       &tegra124_pll_d2_params, NULL);
+       clk_register_clkdev(clk, "pll_d2", NULL);
+       clks[TEGRA124_CLK_PLL_D2] = clk;
+
+       /* PLLD2_OUT0 ?? */
+       clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2",
+                                       CLK_SET_RATE_PARENT, 1, 2);
+       clk_register_clkdev(clk, "pll_d2_out0", NULL);
+       clks[TEGRA124_CLK_PLL_D2_OUT0] = clk;
+
+}
+
+/* Tegra124 CPU clock and reset control functions */
+static void tegra124_wait_cpu_in_reset(u32 cpu)
+{
+       unsigned int reg;
+
+       do {
+               reg = readl(clk_base + CLK_RST_CONTROLLER_CPU_CMPLX_STATUS);
+               cpu_relax();
+       } while (!(reg & (1 << cpu)));  /* check CPU been reset or not */
+}
+
+static void tegra124_disable_cpu_clock(u32 cpu)
+{
+       /* flow controller would take care in the power sequence. */
+}
+
+#ifdef CONFIG_PM_SLEEP
+static void tegra124_cpu_clock_suspend(void)
+{
+       /* switch coresite to clk_m, save off original source */
+       tegra124_cpu_clk_sctx.clk_csite_src =
+                               readl(clk_base + CLK_SOURCE_CSITE);
+       writel(3 << 30, clk_base + CLK_SOURCE_CSITE);
+}
+
+static void tegra124_cpu_clock_resume(void)
+{
+       writel(tegra124_cpu_clk_sctx.clk_csite_src,
+                               clk_base + CLK_SOURCE_CSITE);
+}
+#endif
+
+static struct tegra_cpu_car_ops tegra124_cpu_car_ops = {
+       .wait_for_reset = tegra124_wait_cpu_in_reset,
+       .disable_clock  = tegra124_disable_cpu_clock,
+#ifdef CONFIG_PM_SLEEP
+       .suspend        = tegra124_cpu_clock_suspend,
+       .resume         = tegra124_cpu_clock_resume,
+#endif
+};
+
+static const struct of_device_id pmc_match[] __initconst = {
+       { .compatible = "nvidia,tegra124-pmc" },
+       {},
+};
+
+static struct tegra_clk_init_table init_table[] __initdata = {
+       {TEGRA124_CLK_UARTA, TEGRA124_CLK_PLL_P, 408000000, 0},
+       {TEGRA124_CLK_UARTB, TEGRA124_CLK_PLL_P, 408000000, 0},
+       {TEGRA124_CLK_UARTC, TEGRA124_CLK_PLL_P, 408000000, 0},
+       {TEGRA124_CLK_UARTD, TEGRA124_CLK_PLL_P, 408000000, 0},
+       {TEGRA124_CLK_PLL_A, TEGRA124_CLK_CLK_MAX, 564480000, 1},
+       {TEGRA124_CLK_PLL_A_OUT0, TEGRA124_CLK_CLK_MAX, 11289600, 1},
+       {TEGRA124_CLK_EXTERN1, TEGRA124_CLK_PLL_A_OUT0, 0, 1},
+       {TEGRA124_CLK_CLK_OUT_1_MUX, TEGRA124_CLK_EXTERN1, 0, 1},
+       {TEGRA124_CLK_CLK_OUT_1, TEGRA124_CLK_CLK_MAX, 0, 1},
+       {TEGRA124_CLK_I2S0, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA124_CLK_I2S1, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA124_CLK_I2S2, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA124_CLK_I2S3, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA124_CLK_I2S4, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA124_CLK_VDE, TEGRA124_CLK_PLL_P, 0, 0},
+       {TEGRA124_CLK_HOST1X, TEGRA124_CLK_PLL_P, 136000000, 1},
+       {TEGRA124_CLK_SCLK, TEGRA124_CLK_PLL_P_OUT2, 102000000, 1},
+       {TEGRA124_CLK_DFLL_SOC, TEGRA124_CLK_PLL_P, 51000000, 1},
+       {TEGRA124_CLK_DFLL_REF, TEGRA124_CLK_PLL_P, 51000000, 1},
+       {TEGRA124_CLK_PLL_C, TEGRA124_CLK_CLK_MAX, 768000000, 0},
+       {TEGRA124_CLK_PLL_C_OUT1, TEGRA124_CLK_CLK_MAX, 100000000, 0},
+       {TEGRA124_CLK_SBC4, TEGRA124_CLK_PLL_P, 12000000, 1},
+       {TEGRA124_CLK_TSEC, TEGRA124_CLK_PLL_C3, 0, 0},
+       {TEGRA124_CLK_MSENC, TEGRA124_CLK_PLL_C3, 0, 0},
+       /* This MUST be the last entry. */
+       {TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0},
+};
+
+static void __init tegra124_clock_apply_init_table(void)
+{
+       tegra_init_from_table(init_table, clks, TEGRA124_CLK_CLK_MAX);
+}
+
+static void __init tegra124_clock_init(struct device_node *np)
+{
+       struct device_node *node;
+
+       clk_base = of_iomap(np, 0);
+       if (!clk_base) {
+               pr_err("ioremap tegra124 CAR failed\n");
+               return;
+       }
+
+       node = of_find_matching_node(NULL, pmc_match);
+       if (!node) {
+               pr_err("Failed to find pmc node\n");
+               WARN_ON(1);
+               return;
+       }
+
+       pmc_base = of_iomap(node, 0);
+       if (!pmc_base) {
+               pr_err("Can't map pmc registers\n");
+               WARN_ON(1);
+               return;
+       }
+
+       clks = tegra_clk_init(clk_base, TEGRA124_CLK_CLK_MAX, 6);
+       if (!clks)
+               return;
+
+       if (tegra_osc_clk_init(clk_base, tegra124_clks, tegra124_input_freq,
+               ARRAY_SIZE(tegra124_input_freq), &osc_freq, &pll_ref_freq) < 0)
+               return;
+
+       tegra_fixed_clk_init(tegra124_clks);
+       tegra124_pll_init(clk_base, pmc_base);
+       tegra124_periph_clk_init(clk_base, pmc_base);
+       tegra_audio_clk_init(clk_base, pmc_base, tegra124_clks, &pll_a_params);
+       tegra_pmc_clk_init(pmc_base, tegra124_clks);
+
+       tegra_super_clk_gen4_init(clk_base, pmc_base, tegra124_clks,
+                                       &pll_x_params);
+       tegra_add_of_provider(np);
+       tegra_register_devclks(devclks, ARRAY_SIZE(devclks));
+
+       tegra_clk_apply_init_table = tegra124_clock_apply_init_table;
+
+       tegra_cpu_car_ops = &tegra124_cpu_car_ops;
+}
+CLK_OF_DECLARE(tegra124, "nvidia,tegra124-car", tegra124_clock_init);
index 056f649d0d8908b7f6de919a3ca7fc95c3d4e089..dbace152b2faa9e4f1699b8369d935683900df89 100644 (file)
 #include <linux/of_address.h>
 #include <linux/clk/tegra.h>
 #include <linux/delay.h>
+#include <dt-bindings/clock/tegra20-car.h>
 
 #include "clk.h"
-
-#define RST_DEVICES_L 0x004
-#define RST_DEVICES_H 0x008
-#define RST_DEVICES_U 0x00c
-#define RST_DEVICES_SET_L 0x300
-#define RST_DEVICES_CLR_L 0x304
-#define RST_DEVICES_SET_H 0x308
-#define RST_DEVICES_CLR_H 0x30c
-#define RST_DEVICES_SET_U 0x310
-#define RST_DEVICES_CLR_U 0x314
-#define RST_DEVICES_NUM 3
-
-#define CLK_OUT_ENB_L 0x010
-#define CLK_OUT_ENB_H 0x014
-#define CLK_OUT_ENB_U 0x018
-#define CLK_OUT_ENB_SET_L 0x320
-#define CLK_OUT_ENB_CLR_L 0x324
-#define CLK_OUT_ENB_SET_H 0x328
-#define CLK_OUT_ENB_CLR_H 0x32c
-#define CLK_OUT_ENB_SET_U 0x330
-#define CLK_OUT_ENB_CLR_U 0x334
-#define CLK_OUT_ENB_NUM 3
+#include "clk-id.h"
 
 #define OSC_CTRL 0x50
 #define OSC_CTRL_OSC_FREQ_MASK (3<<30)
@@ -67,6 +47,8 @@
 #define OSC_FREQ_DET_BUSY (1<<31)
 #define OSC_FREQ_DET_CNT_MASK 0xFFFF
 
+#define TEGRA20_CLK_PERIPH_BANKS       3
+
 #define PLLS_BASE 0xf0
 #define PLLS_MISC 0xf4
 #define PLLC_BASE 0x80
 
 #define CLK_SOURCE_I2S1 0x100
 #define CLK_SOURCE_I2S2 0x104
-#define CLK_SOURCE_SPDIF_OUT 0x108
-#define CLK_SOURCE_SPDIF_IN 0x10c
 #define CLK_SOURCE_PWM 0x110
 #define CLK_SOURCE_SPI 0x114
-#define CLK_SOURCE_SBC1 0x134
-#define CLK_SOURCE_SBC2 0x118
-#define CLK_SOURCE_SBC3 0x11c
-#define CLK_SOURCE_SBC4 0x1b4
 #define CLK_SOURCE_XIO 0x120
 #define CLK_SOURCE_TWC 0x12c
 #define CLK_SOURCE_IDE 0x144
-#define CLK_SOURCE_NDFLASH 0x160
-#define CLK_SOURCE_VFIR 0x168
-#define CLK_SOURCE_SDMMC1 0x150
-#define CLK_SOURCE_SDMMC2 0x154
-#define CLK_SOURCE_SDMMC3 0x1bc
-#define CLK_SOURCE_SDMMC4 0x164
-#define CLK_SOURCE_CVE 0x140
-#define CLK_SOURCE_TVO 0x188
-#define CLK_SOURCE_TVDAC 0x194
 #define CLK_SOURCE_HDMI 0x18c
 #define CLK_SOURCE_DISP1 0x138
 #define CLK_SOURCE_DISP2 0x13c
 #define CLK_SOURCE_CSITE 0x1d4
-#define CLK_SOURCE_LA 0x1f8
-#define CLK_SOURCE_OWR 0x1cc
-#define CLK_SOURCE_NOR 0x1d0
-#define CLK_SOURCE_MIPI 0x174
 #define CLK_SOURCE_I2C1 0x124
 #define CLK_SOURCE_I2C2 0x198
 #define CLK_SOURCE_I2C3 0x1b8
 #define CLK_SOURCE_UARTC 0x1a0
 #define CLK_SOURCE_UARTD 0x1c0
 #define CLK_SOURCE_UARTE 0x1c4
-#define CLK_SOURCE_3D 0x158
-#define CLK_SOURCE_2D 0x15c
-#define CLK_SOURCE_MPE 0x170
-#define CLK_SOURCE_EPP 0x16c
-#define CLK_SOURCE_HOST1X 0x180
-#define CLK_SOURCE_VDE 0x1c8
-#define CLK_SOURCE_VI 0x148
-#define CLK_SOURCE_VI_SENSOR 0x1a8
 #define CLK_SOURCE_EMC 0x19c
 
 #define AUDIO_SYNC_CLK 0x38
 
-#define PMC_CTRL 0x0
-#define PMC_CTRL_BLINK_ENB 7
-#define PMC_DPD_PADS_ORIDE 0x1c
-#define PMC_DPD_PADS_ORIDE_BLINK_ENB 20
-#define PMC_BLINK_TIMER 0x40
-
 /* Tegra CPU clock and reset control regs */
 #define TEGRA_CLK_RST_CONTROLLER_CLK_CPU_CMPLX         0x4c
 #define TEGRA_CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET     0x340
@@ -188,64 +137,32 @@ static struct cpu_clk_suspend_context {
 } tegra20_cpu_clk_sctx;
 #endif
 
-static int periph_clk_enb_refcnt[CLK_OUT_ENB_NUM * 32];
-
 static void __iomem *clk_base;
 static void __iomem *pmc_base;
 
-static DEFINE_SPINLOCK(pll_div_lock);
-static DEFINE_SPINLOCK(sysrate_lock);
-
-#define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset,        \
-                           _clk_num, _regs, _gate_flags, _clk_id)      \
-       TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset,     \
+#define TEGRA_INIT_DATA_MUX(_name, _parents, _offset,  \
+                           _clk_num, _gate_flags, _clk_id)     \
+       TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset,   \
                        30, 2, 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,      \
-                       _regs, _clk_num, periph_clk_enb_refcnt,         \
+                       _clk_num, \
                        _gate_flags, _clk_id)
 
-#define TEGRA_INIT_DATA_INT(_name, _con_id, _dev_id, _parents, _offset,        \
-                           _clk_num, _regs, _gate_flags, _clk_id)      \
-       TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset,     \
-                       30, 2, 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,    \
-                       _clk_num, periph_clk_enb_refcnt, _gate_flags,   \
-                       _clk_id)
-
-#define TEGRA_INIT_DATA_DIV16(_name, _con_id, _dev_id, _parents, _offset, \
-                             _clk_num, _regs, _gate_flags, _clk_id)    \
-       TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset,     \
-                       30, 2, 0, 0, 16, 0, TEGRA_DIVIDER_ROUND_UP, _regs, \
-                       _clk_num, periph_clk_enb_refcnt, _gate_flags,   \
+#define TEGRA_INIT_DATA_DIV16(_name, _parents, _offset, \
+                             _clk_num, _gate_flags, _clk_id)   \
+       TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset,   \
+                       30, 2, 0, 0, 16, 0, TEGRA_DIVIDER_ROUND_UP, \
+                       _clk_num, _gate_flags,  \
                        _clk_id)
 
-#define TEGRA_INIT_DATA_NODIV(_name, _con_id, _dev_id, _parents, _offset, \
-                             _mux_shift, _mux_width, _clk_num, _regs,  \
+#define TEGRA_INIT_DATA_NODIV(_name, _parents, _offset, \
+                             _mux_shift, _mux_width, _clk_num, \
                              _gate_flags, _clk_id)                     \
-       TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset,     \
-                       _mux_shift, _mux_width, 0, 0, 0, 0, 0, _regs,   \
-                       _clk_num, periph_clk_enb_refcnt, _gate_flags,   \
+       TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset,   \
+                       _mux_shift, _mux_width, 0, 0, 0, 0, 0, \
+                       _clk_num, _gate_flags,  \
                        _clk_id)
 
-/* IDs assigned here must be in sync with DT bindings definition
- * for Tegra20 clocks .
- */
-enum tegra20_clk {
-       cpu, ac97 = 3, rtc, timer, uarta, gpio = 8, sdmmc2, i2s1 = 11, i2c1,
-       ndflash, sdmmc1, sdmmc4, twc, pwm, i2s2, epp, gr2d = 21, usbd, isp,
-       gr3d, ide, disp2, disp1, host1x, vcp, cache2 = 31, mem, ahbdma, apbdma,
-       kbc = 36, stat_mon, pmc, fuse, kfuse, sbc1, nor, spi, sbc2, xio, sbc3,
-       dvc, dsi, mipi = 50, hdmi, csi, tvdac, i2c2, uartc, emc = 57, usb2,
-       usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3,
-       pex, owr, afi, csite, pcie_xclk, avpucq = 75, la, irama = 84, iramb,
-       iramc, iramd, cram2, audio_2x, clk_d, csus = 92, cdev2, cdev1,
-       uartb = 96, vfir, spdif_in, spdif_out, vi, vi_sensor, tvo, cve,
-       osc, clk_32k, clk_m, sclk, cclk, hclk, pclk, blink, pll_a, pll_a_out0,
-       pll_c, pll_c_out1, pll_d, pll_d_out0, pll_e, pll_m, pll_m_out1,
-       pll_p, pll_p_out1, pll_p_out2, pll_p_out3, pll_p_out4, pll_s, pll_u,
-       pll_x, cop, audio, pll_ref, twd, clk_max,
-};
-
-static struct clk *clks[clk_max];
-static struct clk_onecell_data clk_data;
+static struct clk **clks;
 
 static struct tegra_clk_pll_freq_table pll_c_freq_table[] = {
        { 12000000, 600000000, 600, 12, 0, 8 },
@@ -383,6 +300,8 @@ static struct tegra_clk_pll_params pll_c_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
        .lock_delay = 300,
+       .freq_table = pll_c_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON,
 };
 
 static struct tegra_clk_pll_params pll_m_params = {
@@ -397,6 +316,8 @@ static struct tegra_clk_pll_params pll_m_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
        .lock_delay = 300,
+       .freq_table = pll_m_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON,
 };
 
 static struct tegra_clk_pll_params pll_p_params = {
@@ -411,6 +332,9 @@ static struct tegra_clk_pll_params pll_p_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
        .lock_delay = 300,
+       .freq_table = pll_p_freq_table,
+       .flags = TEGRA_PLL_FIXED | TEGRA_PLL_HAS_CPCON,
+       .fixed_rate =  216000000,
 };
 
 static struct tegra_clk_pll_params pll_a_params = {
@@ -425,6 +349,8 @@ static struct tegra_clk_pll_params pll_a_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
        .lock_delay = 300,
+       .freq_table = pll_a_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON,
 };
 
 static struct tegra_clk_pll_params pll_d_params = {
@@ -439,6 +365,8 @@ static struct tegra_clk_pll_params pll_d_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
        .lock_delay = 1000,
+       .freq_table = pll_d_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON,
 };
 
 static struct pdiv_map pllu_p[] = {
@@ -460,6 +388,8 @@ static struct tegra_clk_pll_params pll_u_params = {
        .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
        .lock_delay = 1000,
        .pdiv_tohw = pllu_p,
+       .freq_table = pll_u_freq_table,
+       .flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON,
 };
 
 static struct tegra_clk_pll_params pll_x_params = {
@@ -474,6 +404,8 @@ static struct tegra_clk_pll_params pll_x_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
        .lock_delay = 300,
+       .freq_table = pll_x_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON,
 };
 
 static struct tegra_clk_pll_params pll_e_params = {
@@ -488,34 +420,160 @@ static struct tegra_clk_pll_params pll_e_params = {
        .lock_mask = PLLE_MISC_LOCK,
        .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE,
        .lock_delay = 0,
+       .freq_table = pll_e_freq_table,
+       .flags = TEGRA_PLL_FIXED,
+       .fixed_rate = 100000000,
 };
 
-/* Peripheral clock registers */
-static struct tegra_clk_periph_regs periph_l_regs = {
-       .enb_reg = CLK_OUT_ENB_L,
-       .enb_set_reg = CLK_OUT_ENB_SET_L,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_L,
-       .rst_reg = RST_DEVICES_L,
-       .rst_set_reg = RST_DEVICES_SET_L,
-       .rst_clr_reg = RST_DEVICES_CLR_L,
-};
-
-static struct tegra_clk_periph_regs periph_h_regs = {
-       .enb_reg = CLK_OUT_ENB_H,
-       .enb_set_reg = CLK_OUT_ENB_SET_H,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_H,
-       .rst_reg = RST_DEVICES_H,
-       .rst_set_reg = RST_DEVICES_SET_H,
-       .rst_clr_reg = RST_DEVICES_CLR_H,
+static struct tegra_devclk devclks[] __initdata = {
+       { .con_id = "pll_c", .dt_id = TEGRA20_CLK_PLL_C },
+       { .con_id = "pll_c_out1", .dt_id = TEGRA20_CLK_PLL_C_OUT1 },
+       { .con_id = "pll_p", .dt_id = TEGRA20_CLK_PLL_P },
+       { .con_id = "pll_p_out1", .dt_id = TEGRA20_CLK_PLL_P_OUT1 },
+       { .con_id = "pll_p_out2", .dt_id = TEGRA20_CLK_PLL_P_OUT2 },
+       { .con_id = "pll_p_out3", .dt_id = TEGRA20_CLK_PLL_P_OUT3 },
+       { .con_id = "pll_p_out4", .dt_id = TEGRA20_CLK_PLL_P_OUT4 },
+       { .con_id = "pll_m", .dt_id = TEGRA20_CLK_PLL_M },
+       { .con_id = "pll_m_out1", .dt_id = TEGRA20_CLK_PLL_M_OUT1 },
+       { .con_id = "pll_x", .dt_id = TEGRA20_CLK_PLL_X },
+       { .con_id = "pll_u", .dt_id = TEGRA20_CLK_PLL_U },
+       { .con_id = "pll_d", .dt_id = TEGRA20_CLK_PLL_D },
+       { .con_id = "pll_d_out0", .dt_id = TEGRA20_CLK_PLL_D_OUT0 },
+       { .con_id = "pll_a", .dt_id = TEGRA20_CLK_PLL_A },
+       { .con_id = "pll_a_out0", .dt_id = TEGRA20_CLK_PLL_A_OUT0 },
+       { .con_id = "pll_e", .dt_id = TEGRA20_CLK_PLL_E },
+       { .con_id = "cclk", .dt_id = TEGRA20_CLK_CCLK },
+       { .con_id = "sclk", .dt_id = TEGRA20_CLK_SCLK },
+       { .con_id = "hclk", .dt_id = TEGRA20_CLK_HCLK },
+       { .con_id = "pclk", .dt_id = TEGRA20_CLK_PCLK },
+       { .con_id = "fuse", .dt_id = TEGRA20_CLK_FUSE },
+       { .con_id = "twd", .dt_id = TEGRA20_CLK_TWD },
+       { .con_id = "audio", .dt_id = TEGRA20_CLK_AUDIO },
+       { .con_id = "audio_2x", .dt_id = TEGRA20_CLK_AUDIO_2X },
+       { .dev_id = "tegra20-ac97", .dt_id = TEGRA20_CLK_AC97 },
+       { .dev_id = "tegra-apbdma", .dt_id = TEGRA20_CLK_APBDMA },
+       { .dev_id = "rtc-tegra", .dt_id = TEGRA20_CLK_RTC },
+       { .dev_id = "timer", .dt_id = TEGRA20_CLK_TIMER },
+       { .dev_id = "tegra-kbc", .dt_id = TEGRA20_CLK_KBC },
+       { .con_id = "csus", .dev_id =  "tegra_camera", .dt_id = TEGRA20_CLK_CSUS },
+       { .con_id = "vcp", .dev_id = "tegra-avp", .dt_id = TEGRA20_CLK_VCP },
+       { .con_id = "bsea", .dev_id = "tegra-avp", .dt_id = TEGRA20_CLK_BSEA },
+       { .con_id = "bsev", .dev_id = "tegra-aes", .dt_id = TEGRA20_CLK_BSEV },
+       { .con_id = "emc", .dt_id = TEGRA20_CLK_EMC },
+       { .dev_id = "fsl-tegra-udc", .dt_id = TEGRA20_CLK_USBD },
+       { .dev_id = "tegra-ehci.1", .dt_id = TEGRA20_CLK_USB2 },
+       { .dev_id = "tegra-ehci.2", .dt_id = TEGRA20_CLK_USB3 },
+       { .dev_id = "dsi", .dt_id = TEGRA20_CLK_DSI },
+       { .con_id = "csi", .dev_id = "tegra_camera", .dt_id = TEGRA20_CLK_CSI },
+       { .con_id = "isp", .dev_id = "tegra_camera", .dt_id = TEGRA20_CLK_ISP },
+       { .con_id = "pex", .dt_id = TEGRA20_CLK_PEX },
+       { .con_id = "afi", .dt_id = TEGRA20_CLK_AFI },
+       { .con_id = "cdev1", .dt_id = TEGRA20_CLK_CDEV1 },
+       { .con_id = "cdev2", .dt_id = TEGRA20_CLK_CDEV2 },
+       { .con_id = "clk_32k", .dt_id = TEGRA20_CLK_CLK_32K },
+       { .con_id = "blink", .dt_id = TEGRA20_CLK_BLINK },
+       { .con_id = "clk_m", .dt_id = TEGRA20_CLK_CLK_M },
+       { .con_id = "pll_ref", .dt_id = TEGRA20_CLK_PLL_REF },
+       { .dev_id = "tegra20-i2s.0", .dt_id = TEGRA20_CLK_I2S1 },
+       { .dev_id = "tegra20-i2s.1", .dt_id = TEGRA20_CLK_I2S2 },
+       { .con_id = "spdif_out", .dev_id = "tegra20-spdif", .dt_id = TEGRA20_CLK_SPDIF_OUT },
+       { .con_id = "spdif_in", .dev_id = "tegra20-spdif", .dt_id = TEGRA20_CLK_SPDIF_IN },
+       { .dev_id = "spi_tegra.0", .dt_id = TEGRA20_CLK_SBC1 },
+       { .dev_id = "spi_tegra.1", .dt_id = TEGRA20_CLK_SBC2 },
+       { .dev_id = "spi_tegra.2", .dt_id = TEGRA20_CLK_SBC3 },
+       { .dev_id = "spi_tegra.3", .dt_id = TEGRA20_CLK_SBC4 },
+       { .dev_id = "spi", .dt_id = TEGRA20_CLK_SPI },
+       { .dev_id = "xio", .dt_id = TEGRA20_CLK_XIO },
+       { .dev_id = "twc", .dt_id = TEGRA20_CLK_TWC },
+       { .dev_id = "ide", .dt_id = TEGRA20_CLK_IDE },
+       { .dev_id = "tegra_nand", .dt_id = TEGRA20_CLK_NDFLASH },
+       { .dev_id = "vfir", .dt_id = TEGRA20_CLK_VFIR },
+       { .dev_id = "csite", .dt_id = TEGRA20_CLK_CSITE },
+       { .dev_id = "la", .dt_id = TEGRA20_CLK_LA },
+       { .dev_id = "tegra_w1", .dt_id = TEGRA20_CLK_OWR },
+       { .dev_id = "mipi", .dt_id = TEGRA20_CLK_MIPI },
+       { .dev_id = "vde", .dt_id = TEGRA20_CLK_VDE },
+       { .con_id = "vi", .dev_id =  "tegra_camera", .dt_id = TEGRA20_CLK_VI },
+       { .dev_id = "epp", .dt_id = TEGRA20_CLK_EPP },
+       { .dev_id = "mpe", .dt_id = TEGRA20_CLK_MPE },
+       { .dev_id = "host1x", .dt_id = TEGRA20_CLK_HOST1X },
+       { .dev_id = "3d", .dt_id = TEGRA20_CLK_GR3D },
+       { .dev_id = "2d", .dt_id = TEGRA20_CLK_GR2D },
+       { .dev_id = "tegra-nor", .dt_id = TEGRA20_CLK_NOR },
+       { .dev_id = "sdhci-tegra.0", .dt_id = TEGRA20_CLK_SDMMC1 },
+       { .dev_id = "sdhci-tegra.1", .dt_id = TEGRA20_CLK_SDMMC2 },
+       { .dev_id = "sdhci-tegra.2", .dt_id = TEGRA20_CLK_SDMMC3 },
+       { .dev_id = "sdhci-tegra.3", .dt_id = TEGRA20_CLK_SDMMC4 },
+       { .dev_id = "cve", .dt_id = TEGRA20_CLK_CVE },
+       { .dev_id = "tvo", .dt_id = TEGRA20_CLK_TVO },
+       { .dev_id = "tvdac", .dt_id = TEGRA20_CLK_TVDAC },
+       { .con_id = "vi_sensor", .dev_id = "tegra_camera", .dt_id = TEGRA20_CLK_VI_SENSOR },
+       { .dev_id = "hdmi", .dt_id = TEGRA20_CLK_HDMI },
+       { .con_id = "div-clk", .dev_id = "tegra-i2c.0", .dt_id = TEGRA20_CLK_I2C1 },
+       { .con_id = "div-clk", .dev_id = "tegra-i2c.1", .dt_id = TEGRA20_CLK_I2C2 },
+       { .con_id = "div-clk", .dev_id = "tegra-i2c.2", .dt_id = TEGRA20_CLK_I2C3 },
+       { .con_id = "div-clk", .dev_id = "tegra-i2c.3", .dt_id = TEGRA20_CLK_DVC },
+       { .dev_id = "tegra-pwm", .dt_id = TEGRA20_CLK_PWM },
+       { .dev_id = "tegra_uart.0", .dt_id = TEGRA20_CLK_UARTA },
+       { .dev_id = "tegra_uart.1", .dt_id = TEGRA20_CLK_UARTB },
+       { .dev_id = "tegra_uart.2", .dt_id = TEGRA20_CLK_UARTC },
+       { .dev_id = "tegra_uart.3", .dt_id = TEGRA20_CLK_UARTD },
+       { .dev_id = "tegra_uart.4", .dt_id = TEGRA20_CLK_UARTE },
+       { .dev_id = "tegradc.0", .dt_id = TEGRA20_CLK_DISP1 },
+       { .dev_id = "tegradc.1", .dt_id = TEGRA20_CLK_DISP2 },
 };
 
-static struct tegra_clk_periph_regs periph_u_regs = {
-       .enb_reg = CLK_OUT_ENB_U,
-       .enb_set_reg = CLK_OUT_ENB_SET_U,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_U,
-       .rst_reg = RST_DEVICES_U,
-       .rst_set_reg = RST_DEVICES_SET_U,
-       .rst_clr_reg = RST_DEVICES_CLR_U,
+static struct tegra_clk tegra20_clks[tegra_clk_max] __initdata = {
+       [tegra_clk_spdif_out] = { .dt_id = TEGRA20_CLK_SPDIF_OUT, .present = true },
+       [tegra_clk_spdif_in] = { .dt_id = TEGRA20_CLK_SPDIF_IN, .present = true },
+       [tegra_clk_sdmmc1] = { .dt_id = TEGRA20_CLK_SDMMC1, .present = true },
+       [tegra_clk_sdmmc2] = { .dt_id = TEGRA20_CLK_SDMMC2, .present = true },
+       [tegra_clk_sdmmc3] = { .dt_id = TEGRA20_CLK_SDMMC3, .present = true },
+       [tegra_clk_sdmmc4] = { .dt_id = TEGRA20_CLK_SDMMC4, .present = true },
+       [tegra_clk_la] = { .dt_id = TEGRA20_CLK_LA, .present = true },
+       [tegra_clk_csite] = { .dt_id = TEGRA20_CLK_CSITE, .present = true },
+       [tegra_clk_vfir] = { .dt_id = TEGRA20_CLK_VFIR, .present = true },
+       [tegra_clk_mipi] = { .dt_id = TEGRA20_CLK_MIPI, .present = true },
+       [tegra_clk_nor] = { .dt_id = TEGRA20_CLK_NOR, .present = true },
+       [tegra_clk_rtc] = { .dt_id = TEGRA20_CLK_RTC, .present = true },
+       [tegra_clk_timer] = { .dt_id = TEGRA20_CLK_TIMER, .present = true },
+       [tegra_clk_kbc] = { .dt_id = TEGRA20_CLK_KBC, .present = true },
+       [tegra_clk_csus] = { .dt_id = TEGRA20_CLK_CSUS, .present = true },
+       [tegra_clk_vcp] = { .dt_id = TEGRA20_CLK_VCP, .present = true },
+       [tegra_clk_bsea] = { .dt_id = TEGRA20_CLK_BSEA, .present = true },
+       [tegra_clk_bsev] = { .dt_id = TEGRA20_CLK_BSEV, .present = true },
+       [tegra_clk_usbd] = { .dt_id = TEGRA20_CLK_USBD, .present = true },
+       [tegra_clk_usb2] = { .dt_id = TEGRA20_CLK_USB2, .present = true },
+       [tegra_clk_usb3] = { .dt_id = TEGRA20_CLK_USB3, .present = true },
+       [tegra_clk_csi] = { .dt_id = TEGRA20_CLK_CSI, .present = true },
+       [tegra_clk_isp] = { .dt_id = TEGRA20_CLK_ISP, .present = true },
+       [tegra_clk_clk_32k] = { .dt_id = TEGRA20_CLK_CLK_32K, .present = true },
+       [tegra_clk_blink] = { .dt_id = TEGRA20_CLK_BLINK, .present = true },
+       [tegra_clk_hclk] = { .dt_id = TEGRA20_CLK_HCLK, .present = true },
+       [tegra_clk_pclk] = { .dt_id = TEGRA20_CLK_PCLK, .present = true },
+       [tegra_clk_pll_p_out1] = { .dt_id = TEGRA20_CLK_PLL_P_OUT1, .present = true },
+       [tegra_clk_pll_p_out2] = { .dt_id = TEGRA20_CLK_PLL_P_OUT2, .present = true },
+       [tegra_clk_pll_p_out3] = { .dt_id = TEGRA20_CLK_PLL_P_OUT3, .present = true },
+       [tegra_clk_pll_p_out4] = { .dt_id = TEGRA20_CLK_PLL_P_OUT4, .present = true },
+       [tegra_clk_pll_p] = { .dt_id = TEGRA20_CLK_PLL_P, .present = true },
+       [tegra_clk_owr] = { .dt_id = TEGRA20_CLK_OWR, .present = true },
+       [tegra_clk_sbc1] = { .dt_id = TEGRA20_CLK_SBC1, .present = true },
+       [tegra_clk_sbc2] = { .dt_id = TEGRA20_CLK_SBC2, .present = true },
+       [tegra_clk_sbc3] = { .dt_id = TEGRA20_CLK_SBC3, .present = true },
+       [tegra_clk_sbc4] = { .dt_id = TEGRA20_CLK_SBC4, .present = true },
+       [tegra_clk_vde] = { .dt_id = TEGRA20_CLK_VDE, .present = true },
+       [tegra_clk_vi] = { .dt_id = TEGRA20_CLK_VI, .present = true },
+       [tegra_clk_epp] = { .dt_id = TEGRA20_CLK_EPP, .present = true },
+       [tegra_clk_mpe] = { .dt_id = TEGRA20_CLK_MPE, .present = true },
+       [tegra_clk_host1x] = { .dt_id = TEGRA20_CLK_HOST1X, .present = true },
+       [tegra_clk_gr2d] = { .dt_id = TEGRA20_CLK_GR2D, .present = true },
+       [tegra_clk_gr3d] = { .dt_id = TEGRA20_CLK_GR3D, .present = true },
+       [tegra_clk_ndflash] = { .dt_id = TEGRA20_CLK_NDFLASH, .present = true },
+       [tegra_clk_cve] = { .dt_id = TEGRA20_CLK_CVE, .present = true },
+       [tegra_clk_tvo] = { .dt_id = TEGRA20_CLK_TVO, .present = true },
+       [tegra_clk_tvdac] = { .dt_id = TEGRA20_CLK_TVDAC, .present = true },
+       [tegra_clk_vi_sensor] = { .dt_id = TEGRA20_CLK_VI_SENSOR, .present = true },
+       [tegra_clk_afi] = { .dt_id = TEGRA20_CLK_AFI, .present = true },
 };
 
 static unsigned long tegra20_clk_measure_input_freq(void)
@@ -577,10 +635,8 @@ static void tegra20_pll_init(void)
 
        /* PLLC */
        clk = tegra_clk_register_pll("pll_c", "pll_ref", clk_base, NULL, 0,
-                           0, &pll_c_params, TEGRA_PLL_HAS_CPCON,
-                           pll_c_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_c", NULL);
-       clks[pll_c] = clk;
+                           &pll_c_params, NULL);
+       clks[TEGRA20_CLK_PLL_C] = clk;
 
        /* PLLC_OUT1 */
        clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c",
@@ -589,71 +645,13 @@ static void tegra20_pll_init(void)
        clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div",
                                clk_base + PLLC_OUT, 1, 0, CLK_SET_RATE_PARENT,
                                0, NULL);
-       clk_register_clkdev(clk, "pll_c_out1", NULL);
-       clks[pll_c_out1] = clk;
-
-       /* PLLP */
-       clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base, NULL, 0,
-                           216000000, &pll_p_params, TEGRA_PLL_FIXED |
-                           TEGRA_PLL_HAS_CPCON, pll_p_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_p", NULL);
-       clks[pll_p] = clk;
-
-       /* PLLP_OUT1 */
-       clk = tegra_clk_register_divider("pll_p_out1_div", "pll_p",
-                               clk_base + PLLP_OUTA, 0,
-                               TEGRA_DIVIDER_FIXED | TEGRA_DIVIDER_ROUND_UP,
-                               8, 8, 1, &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out1", "pll_p_out1_div",
-                               clk_base + PLLP_OUTA, 1, 0,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out1", NULL);
-       clks[pll_p_out1] = clk;
-
-       /* PLLP_OUT2 */
-       clk = tegra_clk_register_divider("pll_p_out2_div", "pll_p",
-                               clk_base + PLLP_OUTA, 0,
-                               TEGRA_DIVIDER_FIXED | TEGRA_DIVIDER_ROUND_UP,
-                               24, 8, 1, &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out2", "pll_p_out2_div",
-                               clk_base + PLLP_OUTA, 17, 16,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out2", NULL);
-       clks[pll_p_out2] = clk;
-
-       /* PLLP_OUT3 */
-       clk = tegra_clk_register_divider("pll_p_out3_div", "pll_p",
-                               clk_base + PLLP_OUTB, 0,
-                               TEGRA_DIVIDER_FIXED | TEGRA_DIVIDER_ROUND_UP,
-                               8, 8, 1, &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out3", "pll_p_out3_div",
-                               clk_base + PLLP_OUTB, 1, 0,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out3", NULL);
-       clks[pll_p_out3] = clk;
-
-       /* PLLP_OUT4 */
-       clk = tegra_clk_register_divider("pll_p_out4_div", "pll_p",
-                               clk_base + PLLP_OUTB, 0,
-                               TEGRA_DIVIDER_FIXED | TEGRA_DIVIDER_ROUND_UP,
-                               24, 8, 1, &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out4", "pll_p_out4_div",
-                               clk_base + PLLP_OUTB, 17, 16,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out4", NULL);
-       clks[pll_p_out4] = clk;
+       clks[TEGRA20_CLK_PLL_C_OUT1] = clk;
 
        /* PLLM */
        clk = tegra_clk_register_pll("pll_m", "pll_ref", clk_base, NULL,
-                           CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, 0,
-                           &pll_m_params, TEGRA_PLL_HAS_CPCON,
-                           pll_m_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_m", NULL);
-       clks[pll_m] = clk;
+                           CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE,
+                           &pll_m_params, NULL);
+       clks[TEGRA20_CLK_PLL_M] = clk;
 
        /* PLLM_OUT1 */
        clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m",
@@ -662,42 +660,32 @@ static void tegra20_pll_init(void)
        clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div",
                                clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED |
                                CLK_SET_RATE_PARENT, 0, NULL);
-       clk_register_clkdev(clk, "pll_m_out1", NULL);
-       clks[pll_m_out1] = clk;
+       clks[TEGRA20_CLK_PLL_M_OUT1] = clk;
 
        /* PLLX */
        clk = tegra_clk_register_pll("pll_x", "pll_ref", clk_base, NULL, 0,
-                           0, &pll_x_params, TEGRA_PLL_HAS_CPCON,
-                           pll_x_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_x", NULL);
-       clks[pll_x] = clk;
+                           &pll_x_params, NULL);
+       clks[TEGRA20_CLK_PLL_X] = clk;
 
        /* PLLU */
        clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, NULL, 0,
-                           0, &pll_u_params, TEGRA_PLLU | TEGRA_PLL_HAS_CPCON,
-                           pll_u_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_u", NULL);
-       clks[pll_u] = clk;
+                           &pll_u_params, NULL);
+       clks[TEGRA20_CLK_PLL_U] = clk;
 
        /* PLLD */
        clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, NULL, 0,
-                           0, &pll_d_params, TEGRA_PLL_HAS_CPCON,
-                           pll_d_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_d", NULL);
-       clks[pll_d] = clk;
+                           &pll_d_params, NULL);
+       clks[TEGRA20_CLK_PLL_D] = clk;
 
        /* PLLD_OUT0 */
        clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d",
                                        CLK_SET_RATE_PARENT, 1, 2);
-       clk_register_clkdev(clk, "pll_d_out0", NULL);
-       clks[pll_d_out0] = clk;
+       clks[TEGRA20_CLK_PLL_D_OUT0] = clk;
 
        /* PLLA */
        clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, NULL, 0,
-                           0, &pll_a_params, TEGRA_PLL_HAS_CPCON,
-                           pll_a_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_a", NULL);
-       clks[pll_a] = clk;
+                           &pll_a_params, NULL);
+       clks[TEGRA20_CLK_PLL_A] = clk;
 
        /* PLLA_OUT0 */
        clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a",
@@ -706,15 +694,12 @@ static void tegra20_pll_init(void)
        clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div",
                                clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED |
                                CLK_SET_RATE_PARENT, 0, NULL);
-       clk_register_clkdev(clk, "pll_a_out0", NULL);
-       clks[pll_a_out0] = clk;
+       clks[TEGRA20_CLK_PLL_A_OUT0] = clk;
 
        /* PLLE */
        clk = tegra_clk_register_plle("pll_e", "pll_ref", clk_base, pmc_base,
-                            0, 100000000, &pll_e_params,
-                            0, pll_e_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_e", NULL);
-       clks[pll_e] = clk;
+                            0, &pll_e_params, NULL);
+       clks[TEGRA20_CLK_PLL_E] = clk;
 }
 
 static const char *cclk_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m",
@@ -732,40 +717,17 @@ static void tegra20_super_clk_init(void)
        clk = tegra_clk_register_super_mux("cclk", cclk_parents,
                              ARRAY_SIZE(cclk_parents), CLK_SET_RATE_PARENT,
                              clk_base + CCLK_BURST_POLICY, 0, 4, 0, 0, NULL);
-       clk_register_clkdev(clk, "cclk", NULL);
-       clks[cclk] = clk;
+       clks[TEGRA20_CLK_CCLK] = clk;
 
        /* SCLK */
        clk = tegra_clk_register_super_mux("sclk", sclk_parents,
                              ARRAY_SIZE(sclk_parents), CLK_SET_RATE_PARENT,
                              clk_base + SCLK_BURST_POLICY, 0, 4, 0, 0, NULL);
-       clk_register_clkdev(clk, "sclk", NULL);
-       clks[sclk] = clk;
-
-       /* HCLK */
-       clk = clk_register_divider(NULL, "hclk_div", "sclk", 0,
-                                  clk_base + CLK_SYSTEM_RATE, 4, 2, 0,
-                                  &sysrate_lock);
-       clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT,
-                               clk_base + CLK_SYSTEM_RATE, 7,
-                               CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
-       clk_register_clkdev(clk, "hclk", NULL);
-       clks[hclk] = clk;
-
-       /* PCLK */
-       clk = clk_register_divider(NULL, "pclk_div", "hclk", 0,
-                                  clk_base + CLK_SYSTEM_RATE, 0, 2, 0,
-                                  &sysrate_lock);
-       clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT,
-                               clk_base + CLK_SYSTEM_RATE, 3,
-                               CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
-       clk_register_clkdev(clk, "pclk", NULL);
-       clks[pclk] = clk;
+       clks[TEGRA20_CLK_SCLK] = clk;
 
        /* twd */
        clk = clk_register_fixed_factor(NULL, "twd", "cclk", 0, 1, 4);
-       clk_register_clkdev(clk, "twd", NULL);
-       clks[twd] = clk;
+       clks[TEGRA20_CLK_TWD] = clk;
 }
 
 static const char *audio_parents[] = {"spdif_in", "i2s1", "i2s2", "unused",
@@ -784,18 +746,16 @@ static void __init tegra20_audio_clk_init(void)
        clk = clk_register_gate(NULL, "audio", "audio_mux", 0,
                                clk_base + AUDIO_SYNC_CLK, 4,
                                CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "audio", NULL);
-       clks[audio] = clk;
+       clks[TEGRA20_CLK_AUDIO] = clk;
 
        /* audio_2x */
        clk = clk_register_fixed_factor(NULL, "audio_doubler", "audio",
                                        CLK_SET_RATE_PARENT, 2, 1);
        clk = tegra_clk_register_periph_gate("audio_2x", "audio_doubler",
                                    TEGRA_PERIPH_NO_RESET, clk_base,
-                                   CLK_SET_RATE_PARENT, 89, &periph_u_regs,
+                                   CLK_SET_RATE_PARENT, 89,
                                    periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "audio_2x", NULL);
-       clks[audio_2x] = clk;
+       clks[TEGRA20_CLK_AUDIO_2X] = clk;
 
 }
 
@@ -803,68 +763,36 @@ static const char *i2s1_parents[] = {"pll_a_out0", "audio_2x", "pll_p",
                                     "clk_m"};
 static const char *i2s2_parents[] = {"pll_a_out0", "audio_2x", "pll_p",
                                     "clk_m"};
-static const char *spdif_out_parents[] = {"pll_a_out0", "audio_2x", "pll_p",
-                                         "clk_m"};
-static const char *spdif_in_parents[] = {"pll_p", "pll_c", "pll_m"};
 static const char *pwm_parents[] = {"pll_p", "pll_c", "audio", "clk_m",
                                    "clk_32k"};
 static const char *mux_pllpcm_clkm[] = {"pll_p", "pll_c", "pll_m", "clk_m"};
-static const char *mux_pllmcpa[] = {"pll_m", "pll_c", "pll_c", "pll_a"};
 static const char *mux_pllpdc_clkm[] = {"pll_p", "pll_d_out0", "pll_c",
                                        "clk_m"};
 static const char *mux_pllmcp_clkm[] = {"pll_m", "pll_c", "pll_p", "clk_m"};
 
 static struct tegra_periph_init_data tegra_periph_clk_list[] = {
-       TEGRA_INIT_DATA_MUX("i2s1",     NULL,           "tegra20-i2s.0", i2s1_parents,      CLK_SOURCE_I2S1,      11,   &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s1),
-       TEGRA_INIT_DATA_MUX("i2s2",     NULL,           "tegra20-i2s.1", i2s2_parents,      CLK_SOURCE_I2S2,      18,   &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s2),
-       TEGRA_INIT_DATA_MUX("spdif_out", "spdif_out",   "tegra20-spdif", spdif_out_parents, CLK_SOURCE_SPDIF_OUT, 10,   &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_out),
-       TEGRA_INIT_DATA_MUX("spdif_in", "spdif_in",     "tegra20-spdif", spdif_in_parents,  CLK_SOURCE_SPDIF_IN,  10,   &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_in),
-       TEGRA_INIT_DATA_MUX("sbc1",     NULL,           "spi_tegra.0",   mux_pllpcm_clkm,   CLK_SOURCE_SBC1,      41,   &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc1),
-       TEGRA_INIT_DATA_MUX("sbc2",     NULL,           "spi_tegra.1",   mux_pllpcm_clkm,   CLK_SOURCE_SBC2,      44,   &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc2),
-       TEGRA_INIT_DATA_MUX("sbc3",     NULL,           "spi_tegra.2",   mux_pllpcm_clkm,   CLK_SOURCE_SBC3,      46,   &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc3),
-       TEGRA_INIT_DATA_MUX("sbc4",     NULL,           "spi_tegra.3",   mux_pllpcm_clkm,   CLK_SOURCE_SBC4,      68,   &periph_u_regs, TEGRA_PERIPH_ON_APB, sbc4),
-       TEGRA_INIT_DATA_MUX("spi",      NULL,           "spi",           mux_pllpcm_clkm,   CLK_SOURCE_SPI,       43,   &periph_h_regs, TEGRA_PERIPH_ON_APB, spi),
-       TEGRA_INIT_DATA_MUX("xio",      NULL,           "xio",           mux_pllpcm_clkm,   CLK_SOURCE_XIO,       45,   &periph_h_regs, 0, xio),
-       TEGRA_INIT_DATA_MUX("twc",      NULL,           "twc",           mux_pllpcm_clkm,   CLK_SOURCE_TWC,       16,   &periph_l_regs, TEGRA_PERIPH_ON_APB, twc),
-       TEGRA_INIT_DATA_MUX("ide",      NULL,           "ide",           mux_pllpcm_clkm,   CLK_SOURCE_XIO,       25,   &periph_l_regs, 0, ide),
-       TEGRA_INIT_DATA_MUX("ndflash",  NULL,           "tegra_nand",    mux_pllpcm_clkm,   CLK_SOURCE_NDFLASH,   13,   &periph_l_regs, 0, ndflash),
-       TEGRA_INIT_DATA_MUX("vfir",     NULL,           "vfir",          mux_pllpcm_clkm,   CLK_SOURCE_VFIR,      7,    &periph_l_regs, TEGRA_PERIPH_ON_APB, vfir),
-       TEGRA_INIT_DATA_MUX("csite",    NULL,           "csite",         mux_pllpcm_clkm,   CLK_SOURCE_CSITE,     73,   &periph_u_regs, 0, csite),
-       TEGRA_INIT_DATA_MUX("la",       NULL,           "la",            mux_pllpcm_clkm,   CLK_SOURCE_LA,        76,   &periph_u_regs, 0, la),
-       TEGRA_INIT_DATA_MUX("owr",      NULL,           "tegra_w1",      mux_pllpcm_clkm,   CLK_SOURCE_OWR,       71,   &periph_u_regs, TEGRA_PERIPH_ON_APB, owr),
-       TEGRA_INIT_DATA_MUX("mipi",     NULL,           "mipi",          mux_pllpcm_clkm,   CLK_SOURCE_MIPI,      50,   &periph_h_regs, TEGRA_PERIPH_ON_APB, mipi),
-       TEGRA_INIT_DATA_MUX("vde",      NULL,           "vde",           mux_pllpcm_clkm,   CLK_SOURCE_VDE,       61,   &periph_h_regs, 0, vde),
-       TEGRA_INIT_DATA_MUX("vi",       "vi",           "tegra_camera",  mux_pllmcpa,       CLK_SOURCE_VI,        20,   &periph_l_regs, 0, vi),
-       TEGRA_INIT_DATA_MUX("epp",      NULL,           "epp",           mux_pllmcpa,       CLK_SOURCE_EPP,       19,   &periph_l_regs, 0, epp),
-       TEGRA_INIT_DATA_MUX("mpe",      NULL,           "mpe",           mux_pllmcpa,       CLK_SOURCE_MPE,       60,   &periph_h_regs, 0, mpe),
-       TEGRA_INIT_DATA_MUX("host1x",   NULL,           "host1x",        mux_pllmcpa,       CLK_SOURCE_HOST1X,    28,   &periph_l_regs, 0, host1x),
-       TEGRA_INIT_DATA_MUX("3d",       NULL,           "3d",            mux_pllmcpa,       CLK_SOURCE_3D,        24,   &periph_l_regs, TEGRA_PERIPH_MANUAL_RESET, gr3d),
-       TEGRA_INIT_DATA_MUX("2d",       NULL,           "2d",            mux_pllmcpa,       CLK_SOURCE_2D,        21,   &periph_l_regs, 0, gr2d),
-       TEGRA_INIT_DATA_MUX("nor",      NULL,           "tegra-nor",     mux_pllpcm_clkm,   CLK_SOURCE_NOR,       42,   &periph_h_regs, 0, nor),
-       TEGRA_INIT_DATA_MUX("sdmmc1",   NULL,           "sdhci-tegra.0", mux_pllpcm_clkm,   CLK_SOURCE_SDMMC1,    14,   &periph_l_regs, 0, sdmmc1),
-       TEGRA_INIT_DATA_MUX("sdmmc2",   NULL,           "sdhci-tegra.1", mux_pllpcm_clkm,   CLK_SOURCE_SDMMC2,    9,    &periph_l_regs, 0, sdmmc2),
-       TEGRA_INIT_DATA_MUX("sdmmc3",   NULL,           "sdhci-tegra.2", mux_pllpcm_clkm,   CLK_SOURCE_SDMMC3,    69,   &periph_u_regs, 0, sdmmc3),
-       TEGRA_INIT_DATA_MUX("sdmmc4",   NULL,           "sdhci-tegra.3", mux_pllpcm_clkm,   CLK_SOURCE_SDMMC4,    15,   &periph_l_regs, 0, sdmmc4),
-       TEGRA_INIT_DATA_MUX("cve",      NULL,           "cve",           mux_pllpdc_clkm,   CLK_SOURCE_CVE,       49,   &periph_h_regs, 0, cve),
-       TEGRA_INIT_DATA_MUX("tvo",      NULL,           "tvo",           mux_pllpdc_clkm,   CLK_SOURCE_TVO,       49,   &periph_h_regs, 0, tvo),
-       TEGRA_INIT_DATA_MUX("tvdac",    NULL,           "tvdac",         mux_pllpdc_clkm,   CLK_SOURCE_TVDAC,     53,   &periph_h_regs, 0, tvdac),
-       TEGRA_INIT_DATA_MUX("vi_sensor", "vi_sensor",   "tegra_camera",  mux_pllmcpa,       CLK_SOURCE_VI_SENSOR, 20,   &periph_l_regs, TEGRA_PERIPH_NO_RESET, vi_sensor),
-       TEGRA_INIT_DATA_DIV16("i2c1",   "div-clk",      "tegra-i2c.0",   mux_pllpcm_clkm,   CLK_SOURCE_I2C1,      12,   &periph_l_regs, TEGRA_PERIPH_ON_APB, i2c1),
-       TEGRA_INIT_DATA_DIV16("i2c2",   "div-clk",      "tegra-i2c.1",   mux_pllpcm_clkm,   CLK_SOURCE_I2C2,      54,   &periph_h_regs, TEGRA_PERIPH_ON_APB, i2c2),
-       TEGRA_INIT_DATA_DIV16("i2c3",   "div-clk",      "tegra-i2c.2",   mux_pllpcm_clkm,   CLK_SOURCE_I2C3,      67,   &periph_u_regs, TEGRA_PERIPH_ON_APB, i2c3),
-       TEGRA_INIT_DATA_DIV16("dvc",    "div-clk",      "tegra-i2c.3",   mux_pllpcm_clkm,   CLK_SOURCE_DVC,       47,   &periph_h_regs, TEGRA_PERIPH_ON_APB, dvc),
-       TEGRA_INIT_DATA_MUX("hdmi",     NULL,           "hdmi",          mux_pllpdc_clkm,   CLK_SOURCE_HDMI,      51,   &periph_h_regs, 0, hdmi),
-       TEGRA_INIT_DATA("pwm",          NULL,           "tegra-pwm",     pwm_parents,       CLK_SOURCE_PWM,       28, 3, 0, 0, 8, 1, 0, &periph_l_regs, 17, periph_clk_enb_refcnt, TEGRA_PERIPH_ON_APB, pwm),
+       TEGRA_INIT_DATA_MUX("i2s1", i2s1_parents,     CLK_SOURCE_I2S1,   11, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_I2S1),
+       TEGRA_INIT_DATA_MUX("i2s2", i2s2_parents,     CLK_SOURCE_I2S2,   18, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_I2S2),
+       TEGRA_INIT_DATA_MUX("spi",   mux_pllpcm_clkm,   CLK_SOURCE_SPI,   43, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_SPI),
+       TEGRA_INIT_DATA_MUX("xio",   mux_pllpcm_clkm,   CLK_SOURCE_XIO,   45, 0, TEGRA20_CLK_XIO),
+       TEGRA_INIT_DATA_MUX("twc",   mux_pllpcm_clkm,   CLK_SOURCE_TWC,   16, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_TWC),
+       TEGRA_INIT_DATA_MUX("ide",   mux_pllpcm_clkm,   CLK_SOURCE_XIO,   25, 0, TEGRA20_CLK_IDE),
+       TEGRA_INIT_DATA_DIV16("dvc", mux_pllpcm_clkm,   CLK_SOURCE_DVC,   47, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_DVC),
+       TEGRA_INIT_DATA_DIV16("i2c1", mux_pllpcm_clkm,   CLK_SOURCE_I2C1,   12, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_I2C1),
+       TEGRA_INIT_DATA_DIV16("i2c2", mux_pllpcm_clkm,   CLK_SOURCE_I2C2,   54, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_I2C2),
+       TEGRA_INIT_DATA_DIV16("i2c3", mux_pllpcm_clkm,   CLK_SOURCE_I2C3,   67, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_I2C3),
+       TEGRA_INIT_DATA_MUX("hdmi", mux_pllpdc_clkm,   CLK_SOURCE_HDMI,   51, 0, TEGRA20_CLK_HDMI),
+       TEGRA_INIT_DATA("pwm", NULL, NULL, pwm_parents,     CLK_SOURCE_PWM,   28, 3, 0, 0, 8, 1, 0, 17, TEGRA_PERIPH_ON_APB, TEGRA20_CLK_PWM),
 };
 
 static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = {
-       TEGRA_INIT_DATA_NODIV("uarta",  NULL, "tegra_uart.0", mux_pllpcm_clkm, CLK_SOURCE_UARTA, 30, 2, 6,  &periph_l_regs, TEGRA_PERIPH_ON_APB, uarta),
-       TEGRA_INIT_DATA_NODIV("uartb",  NULL, "tegra_uart.1", mux_pllpcm_clkm, CLK_SOURCE_UARTB, 30, 2, 7,  &periph_l_regs, TEGRA_PERIPH_ON_APB, uartb),
-       TEGRA_INIT_DATA_NODIV("uartc",  NULL, "tegra_uart.2", mux_pllpcm_clkm, CLK_SOURCE_UARTC, 30, 2, 55, &periph_h_regs, TEGRA_PERIPH_ON_APB, uartc),
-       TEGRA_INIT_DATA_NODIV("uartd",  NULL, "tegra_uart.3", mux_pllpcm_clkm, CLK_SOURCE_UARTD, 30, 2, 65, &periph_u_regs, TEGRA_PERIPH_ON_APB, uartd),
-       TEGRA_INIT_DATA_NODIV("uarte",  NULL, "tegra_uart.4", mux_pllpcm_clkm, CLK_SOURCE_UARTE, 30, 2, 66, &periph_u_regs, TEGRA_PERIPH_ON_APB, uarte),
-       TEGRA_INIT_DATA_NODIV("disp1",  NULL, "tegradc.0",    mux_pllpdc_clkm, CLK_SOURCE_DISP1, 30, 2, 27, &periph_l_regs, 0, disp1),
-       TEGRA_INIT_DATA_NODIV("disp2",  NULL, "tegradc.1",    mux_pllpdc_clkm, CLK_SOURCE_DISP2, 30, 2, 26, &periph_l_regs, 0, disp2),
+       TEGRA_INIT_DATA_NODIV("uarta",  mux_pllpcm_clkm, CLK_SOURCE_UARTA, 30, 2, 6,   TEGRA_PERIPH_ON_APB, TEGRA20_CLK_UARTA),
+       TEGRA_INIT_DATA_NODIV("uartb",  mux_pllpcm_clkm, CLK_SOURCE_UARTB, 30, 2, 7,   TEGRA_PERIPH_ON_APB, TEGRA20_CLK_UARTB),
+       TEGRA_INIT_DATA_NODIV("uartc",  mux_pllpcm_clkm, CLK_SOURCE_UARTC, 30, 2, 55,  TEGRA_PERIPH_ON_APB, TEGRA20_CLK_UARTC),
+       TEGRA_INIT_DATA_NODIV("uartd",  mux_pllpcm_clkm, CLK_SOURCE_UARTD, 30, 2, 65,  TEGRA_PERIPH_ON_APB, TEGRA20_CLK_UARTD),
+       TEGRA_INIT_DATA_NODIV("uarte",  mux_pllpcm_clkm, CLK_SOURCE_UARTE, 30, 2, 66,  TEGRA_PERIPH_ON_APB, TEGRA20_CLK_UARTE),
+       TEGRA_INIT_DATA_NODIV("disp1",  mux_pllpdc_clkm, CLK_SOURCE_DISP1, 30, 2, 27,  0, TEGRA20_CLK_DISP1),
+       TEGRA_INIT_DATA_NODIV("disp2",  mux_pllpdc_clkm, CLK_SOURCE_DISP2, 30, 2, 26,  0, TEGRA20_CLK_DISP2),
 };
 
 static void __init tegra20_periph_clk_init(void)
@@ -876,69 +804,13 @@ static void __init tegra20_periph_clk_init(void)
        /* ac97 */
        clk = tegra_clk_register_periph_gate("ac97", "pll_a_out0",
                                    TEGRA_PERIPH_ON_APB,
-                                   clk_base, 0, 3, &periph_l_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "tegra20-ac97");
-       clks[ac97] = clk;
+                                   clk_base, 0, 3, periph_clk_enb_refcnt);
+       clks[TEGRA20_CLK_AC97] = clk;
 
        /* apbdma */
        clk = tegra_clk_register_periph_gate("apbdma", "pclk", 0, clk_base,
-                                   0, 34, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "tegra-apbdma");
-       clks[apbdma] = clk;
-
-       /* rtc */
-       clk = tegra_clk_register_periph_gate("rtc", "clk_32k",
-                                   TEGRA_PERIPH_NO_RESET,
-                                   clk_base, 0, 4, &periph_l_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "rtc-tegra");
-       clks[rtc] = clk;
-
-       /* timer */
-       clk = tegra_clk_register_periph_gate("timer", "clk_m", 0, clk_base,
-                                   0, 5, &periph_l_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "timer");
-       clks[timer] = clk;
-
-       /* kbc */
-       clk = tegra_clk_register_periph_gate("kbc", "clk_32k",
-                                   TEGRA_PERIPH_NO_RESET | TEGRA_PERIPH_ON_APB,
-                                   clk_base, 0, 36, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "tegra-kbc");
-       clks[kbc] = clk;
-
-       /* csus */
-       clk = tegra_clk_register_periph_gate("csus", "clk_m",
-                                   TEGRA_PERIPH_NO_RESET,
-                                   clk_base, 0, 92, &periph_u_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "csus", "tengra_camera");
-       clks[csus] = clk;
-
-       /* vcp */
-       clk = tegra_clk_register_periph_gate("vcp", "clk_m", 0,
-                                   clk_base, 0, 29, &periph_l_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "vcp", "tegra-avp");
-       clks[vcp] = clk;
-
-       /* bsea */
-       clk = tegra_clk_register_periph_gate("bsea", "clk_m", 0,
-                                   clk_base, 0, 62, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "bsea", "tegra-avp");
-       clks[bsea] = clk;
-
-       /* bsev */
-       clk = tegra_clk_register_periph_gate("bsev", "clk_m", 0,
-                                   clk_base, 0, 63, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "bsev", "tegra-aes");
-       clks[bsev] = clk;
+                                   0, 34, periph_clk_enb_refcnt);
+       clks[TEGRA20_CLK_APBDMA] = clk;
 
        /* emc */
        clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm,
@@ -947,130 +819,52 @@ static void __init tegra20_periph_clk_init(void)
                               clk_base + CLK_SOURCE_EMC,
                               30, 2, 0, NULL);
        clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base, 0,
-                                   57, &periph_h_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "emc", NULL);
-       clks[emc] = clk;
-
-       /* usbd */
-       clk = tegra_clk_register_periph_gate("usbd", "clk_m", 0, clk_base, 0,
-                                   22, &periph_l_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "fsl-tegra-udc");
-       clks[usbd] = clk;
-
-       /* usb2 */
-       clk = tegra_clk_register_periph_gate("usb2", "clk_m", 0, clk_base, 0,
-                                   58, &periph_h_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "tegra-ehci.1");
-       clks[usb2] = clk;
-
-       /* usb3 */
-       clk = tegra_clk_register_periph_gate("usb3", "clk_m", 0, clk_base, 0,
-                                   59, &periph_h_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "tegra-ehci.2");
-       clks[usb3] = clk;
+                                   57, periph_clk_enb_refcnt);
+       clks[TEGRA20_CLK_EMC] = clk;
 
        /* dsi */
        clk = tegra_clk_register_periph_gate("dsi", "pll_d", 0, clk_base, 0,
-                                   48, &periph_h_regs, periph_clk_enb_refcnt);
+                                   48, periph_clk_enb_refcnt);
        clk_register_clkdev(clk, NULL, "dsi");
-       clks[dsi] = clk;
-
-       /* csi */
-       clk = tegra_clk_register_periph_gate("csi", "pll_p_out3", 0, clk_base,
-                                   0, 52, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "csi", "tegra_camera");
-       clks[csi] = clk;
-
-       /* isp */
-       clk = tegra_clk_register_periph_gate("isp", "clk_m", 0, clk_base, 0, 23,
-                                   &periph_l_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "isp", "tegra_camera");
-       clks[isp] = clk;
+       clks[TEGRA20_CLK_DSI] = clk;
 
        /* pex */
        clk = tegra_clk_register_periph_gate("pex", "clk_m", 0, clk_base, 0, 70,
-                                   &periph_u_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "pex", NULL);
-       clks[pex] = clk;
-
-       /* afi */
-       clk = tegra_clk_register_periph_gate("afi", "clk_m", 0, clk_base, 0, 72,
-                                   &periph_u_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "afi", NULL);
-       clks[afi] = clk;
-
-       /* pcie_xclk */
-       clk = tegra_clk_register_periph_gate("pcie_xclk", "clk_m", 0, clk_base,
-                                   0, 74, &periph_u_regs,
                                    periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "pcie_xclk", NULL);
-       clks[pcie_xclk] = clk;
+       clks[TEGRA20_CLK_PEX] = clk;
 
        /* cdev1 */
        clk = clk_register_fixed_rate(NULL, "cdev1_fixed", NULL, CLK_IS_ROOT,
                                      26000000);
        clk = tegra_clk_register_periph_gate("cdev1", "cdev1_fixed", 0,
-                                   clk_base, 0, 94, &periph_u_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "cdev1", NULL);
-       clks[cdev1] = clk;
+                                   clk_base, 0, 94, periph_clk_enb_refcnt);
+       clks[TEGRA20_CLK_CDEV1] = clk;
 
        /* cdev2 */
        clk = clk_register_fixed_rate(NULL, "cdev2_fixed", NULL, CLK_IS_ROOT,
                                      26000000);
        clk = tegra_clk_register_periph_gate("cdev2", "cdev2_fixed", 0,
-                                   clk_base, 0, 93, &periph_u_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "cdev2", NULL);
-       clks[cdev2] = clk;
+                                   clk_base, 0, 93, periph_clk_enb_refcnt);
+       clks[TEGRA20_CLK_CDEV2] = clk;
 
        for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) {
                data = &tegra_periph_clk_list[i];
-               clk = tegra_clk_register_periph(data->name, data->parent_names,
+               clk = tegra_clk_register_periph(data->name, data->p.parent_names,
                                data->num_parents, &data->periph,
                                clk_base, data->offset, data->flags);
-               clk_register_clkdev(clk, data->con_id, data->dev_id);
                clks[data->clk_id] = clk;
        }
 
        for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) {
                data = &tegra_periph_nodiv_clk_list[i];
                clk = tegra_clk_register_periph_nodiv(data->name,
-                                       data->parent_names,
+                                       data->p.parent_names,
                                        data->num_parents, &data->periph,
                                        clk_base, data->offset);
-               clk_register_clkdev(clk, data->con_id, data->dev_id);
                clks[data->clk_id] = clk;
        }
-}
-
-
-static void __init tegra20_fixed_clk_init(void)
-{
-       struct clk *clk;
-
-       /* clk_32k */
-       clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT,
-                                     32768);
-       clk_register_clkdev(clk, "clk_32k", NULL);
-       clks[clk_32k] = clk;
-}
-
-static void __init tegra20_pmc_clk_init(void)
-{
-       struct clk *clk;
 
-       /* blink */
-       writel_relaxed(0, pmc_base + PMC_BLINK_TIMER);
-       clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0,
-                               pmc_base + PMC_DPD_PADS_ORIDE,
-                               PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL);
-       clk = clk_register_gate(NULL, "blink", "blink_override", 0,
-                               pmc_base + PMC_CTRL,
-                               PMC_CTRL_BLINK_ENB, 0, NULL);
-       clk_register_clkdev(clk, "blink", NULL);
-       clks[blink] = clk;
+       tegra_periph_clk_init(clk_base, pmc_base, tegra20_clks, &pll_p_params);
 }
 
 static void __init tegra20_osc_clk_init(void)
@@ -1084,15 +878,13 @@ static void __init tegra20_osc_clk_init(void)
        /* clk_m */
        clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT |
                                      CLK_IGNORE_UNUSED, input_freq);
-       clk_register_clkdev(clk, "clk_m", NULL);
-       clks[clk_m] = clk;
+       clks[TEGRA20_CLK_CLK_M] = clk;
 
        /* pll_ref */
        pll_ref_div = tegra20_get_pll_ref_div();
        clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m",
                                        CLK_SET_RATE_PARENT, 1, pll_ref_div);
-       clk_register_clkdev(clk, "pll_ref", NULL);
-       clks[pll_ref] = clk;
+       clks[TEGRA20_CLK_PLL_REF] = clk;
 }
 
 /* Tegra20 CPU clock and reset control functions */
@@ -1226,49 +1018,49 @@ static struct tegra_cpu_car_ops tegra20_cpu_car_ops = {
 };
 
 static struct tegra_clk_init_table init_table[] __initdata = {
-       {pll_p, clk_max, 216000000, 1},
-       {pll_p_out1, clk_max, 28800000, 1},
-       {pll_p_out2, clk_max, 48000000, 1},
-       {pll_p_out3, clk_max, 72000000, 1},
-       {pll_p_out4, clk_max, 24000000, 1},
-       {pll_c, clk_max, 600000000, 1},
-       {pll_c_out1, clk_max, 120000000, 1},
-       {sclk, pll_c_out1, 0, 1},
-       {hclk, clk_max, 0, 1},
-       {pclk, clk_max, 60000000, 1},
-       {csite, clk_max, 0, 1},
-       {emc, clk_max, 0, 1},
-       {cclk, clk_max, 0, 1},
-       {uarta, pll_p, 0, 0},
-       {uartb, pll_p, 0, 0},
-       {uartc, pll_p, 0, 0},
-       {uartd, pll_p, 0, 0},
-       {uarte, pll_p, 0, 0},
-       {pll_a, clk_max, 56448000, 1},
-       {pll_a_out0, clk_max, 11289600, 1},
-       {cdev1, clk_max, 0, 1},
-       {blink, clk_max, 32768, 1},
-       {i2s1, pll_a_out0, 11289600, 0},
-       {i2s2, pll_a_out0, 11289600, 0},
-       {sdmmc1, pll_p, 48000000, 0},
-       {sdmmc3, pll_p, 48000000, 0},
-       {sdmmc4, pll_p, 48000000, 0},
-       {spi, pll_p, 20000000, 0},
-       {sbc1, pll_p, 100000000, 0},
-       {sbc2, pll_p, 100000000, 0},
-       {sbc3, pll_p, 100000000, 0},
-       {sbc4, pll_p, 100000000, 0},
-       {host1x, pll_c, 150000000, 0},
-       {disp1, pll_p, 600000000, 0},
-       {disp2, pll_p, 600000000, 0},
-       {gr2d, pll_c, 300000000, 0},
-       {gr3d, pll_c, 300000000, 0},
-       {clk_max, clk_max, 0, 0}, /* This MUST be the last entry */
+       {TEGRA20_CLK_PLL_P, TEGRA20_CLK_CLK_MAX, 216000000, 1},
+       {TEGRA20_CLK_PLL_P_OUT1, TEGRA20_CLK_CLK_MAX, 28800000, 1},
+       {TEGRA20_CLK_PLL_P_OUT2, TEGRA20_CLK_CLK_MAX, 48000000, 1},
+       {TEGRA20_CLK_PLL_P_OUT3, TEGRA20_CLK_CLK_MAX, 72000000, 1},
+       {TEGRA20_CLK_PLL_P_OUT4, TEGRA20_CLK_CLK_MAX, 24000000, 1},
+       {TEGRA20_CLK_PLL_C, TEGRA20_CLK_CLK_MAX, 600000000, 1},
+       {TEGRA20_CLK_PLL_C_OUT1, TEGRA20_CLK_CLK_MAX, 120000000, 1},
+       {TEGRA20_CLK_SCLK, TEGRA20_CLK_PLL_C_OUT1, 0, 1},
+       {TEGRA20_CLK_HCLK, TEGRA20_CLK_CLK_MAX, 0, 1},
+       {TEGRA20_CLK_PCLK, TEGRA20_CLK_CLK_MAX, 60000000, 1},
+       {TEGRA20_CLK_CSITE, TEGRA20_CLK_CLK_MAX, 0, 1},
+       {TEGRA20_CLK_EMC, TEGRA20_CLK_CLK_MAX, 0, 1},
+       {TEGRA20_CLK_CCLK, TEGRA20_CLK_CLK_MAX, 0, 1},
+       {TEGRA20_CLK_UARTA, TEGRA20_CLK_PLL_P, 0, 0},
+       {TEGRA20_CLK_UARTB, TEGRA20_CLK_PLL_P, 0, 0},
+       {TEGRA20_CLK_UARTC, TEGRA20_CLK_PLL_P, 0, 0},
+       {TEGRA20_CLK_UARTD, TEGRA20_CLK_PLL_P, 0, 0},
+       {TEGRA20_CLK_UARTE, TEGRA20_CLK_PLL_P, 0, 0},
+       {TEGRA20_CLK_PLL_A, TEGRA20_CLK_CLK_MAX, 56448000, 1},
+       {TEGRA20_CLK_PLL_A_OUT0, TEGRA20_CLK_CLK_MAX, 11289600, 1},
+       {TEGRA20_CLK_CDEV1, TEGRA20_CLK_CLK_MAX, 0, 1},
+       {TEGRA20_CLK_BLINK, TEGRA20_CLK_CLK_MAX, 32768, 1},
+       {TEGRA20_CLK_I2S1, TEGRA20_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA20_CLK_I2S2, TEGRA20_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA20_CLK_SDMMC1, TEGRA20_CLK_PLL_P, 48000000, 0},
+       {TEGRA20_CLK_SDMMC3, TEGRA20_CLK_PLL_P, 48000000, 0},
+       {TEGRA20_CLK_SDMMC4, TEGRA20_CLK_PLL_P, 48000000, 0},
+       {TEGRA20_CLK_SPI, TEGRA20_CLK_PLL_P, 20000000, 0},
+       {TEGRA20_CLK_SBC1, TEGRA20_CLK_PLL_P, 100000000, 0},
+       {TEGRA20_CLK_SBC2, TEGRA20_CLK_PLL_P, 100000000, 0},
+       {TEGRA20_CLK_SBC3, TEGRA20_CLK_PLL_P, 100000000, 0},
+       {TEGRA20_CLK_SBC4, TEGRA20_CLK_PLL_P, 100000000, 0},
+       {TEGRA20_CLK_HOST1X, TEGRA20_CLK_PLL_C, 150000000, 0},
+       {TEGRA20_CLK_DISP1, TEGRA20_CLK_PLL_P, 600000000, 0},
+       {TEGRA20_CLK_DISP2, TEGRA20_CLK_PLL_P, 600000000, 0},
+       {TEGRA20_CLK_GR2D, TEGRA20_CLK_PLL_C, 300000000, 0},
+       {TEGRA20_CLK_GR3D, TEGRA20_CLK_PLL_C, 300000000, 0},
+       {TEGRA20_CLK_CLK_MAX, TEGRA20_CLK_CLK_MAX, 0, 0}, /* This MUST be the last entry */
 };
 
 static void __init tegra20_clock_apply_init_table(void)
 {
-       tegra_init_from_table(init_table, clks, clk_max);
+       tegra_init_from_table(init_table, clks, TEGRA20_CLK_CLK_MAX);
 }
 
 /*
@@ -1277,11 +1069,11 @@ static void __init tegra20_clock_apply_init_table(void)
  * table under two names.
  */
 static struct tegra_clk_duplicate tegra_clk_duplicates[] = {
-       TEGRA_CLK_DUPLICATE(usbd,   "utmip-pad",    NULL),
-       TEGRA_CLK_DUPLICATE(usbd,   "tegra-ehci.0", NULL),
-       TEGRA_CLK_DUPLICATE(usbd,   "tegra-otg",    NULL),
-       TEGRA_CLK_DUPLICATE(cclk,   NULL,           "cpu"),
-       TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* Must be the last entry */
+       TEGRA_CLK_DUPLICATE(TEGRA20_CLK_USBD,   "utmip-pad",    NULL),
+       TEGRA_CLK_DUPLICATE(TEGRA20_CLK_USBD,   "tegra-ehci.0", NULL),
+       TEGRA_CLK_DUPLICATE(TEGRA20_CLK_USBD,   "tegra-otg",    NULL),
+       TEGRA_CLK_DUPLICATE(TEGRA20_CLK_CCLK,   NULL,           "cpu"),
+       TEGRA_CLK_DUPLICATE(TEGRA20_CLK_CLK_MAX, NULL, NULL), /* Must be the last entry */
 };
 
 static const struct of_device_id pmc_match[] __initconst = {
@@ -1291,7 +1083,6 @@ static const struct of_device_id pmc_match[] __initconst = {
 
 static void __init tegra20_clock_init(struct device_node *np)
 {
-       int i;
        struct device_node *node;
 
        clk_base = of_iomap(np, 0);
@@ -1312,30 +1103,24 @@ static void __init tegra20_clock_init(struct device_node *np)
                BUG();
        }
 
+       clks = tegra_clk_init(clk_base, TEGRA20_CLK_CLK_MAX,
+                               TEGRA20_CLK_PERIPH_BANKS);
+       if (!clks)
+               return;
+
        tegra20_osc_clk_init();
-       tegra20_pmc_clk_init();
-       tegra20_fixed_clk_init();
+       tegra_fixed_clk_init(tegra20_clks);
        tegra20_pll_init();
        tegra20_super_clk_init();
+       tegra_super_clk_gen4_init(clk_base, pmc_base, tegra20_clks, NULL);
        tegra20_periph_clk_init();
        tegra20_audio_clk_init();
+       tegra_pmc_clk_init(pmc_base, tegra20_clks);
 
+       tegra_init_dup_clks(tegra_clk_duplicates, clks, TEGRA20_CLK_CLK_MAX);
 
-       for (i = 0; i < ARRAY_SIZE(clks); i++) {
-               if (IS_ERR(clks[i])) {
-                       pr_err("Tegra20 clk %d: register failed with %ld\n",
-                              i, PTR_ERR(clks[i]));
-                       BUG();
-               }
-               if (!clks[i])
-                       clks[i] = ERR_PTR(-EINVAL);
-       }
-
-       tegra_init_dup_clks(tegra_clk_duplicates, clks, clk_max);
-
-       clk_data.clks = clks;
-       clk_data.clk_num = ARRAY_SIZE(clks);
-       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+       tegra_add_of_provider(np);
+       tegra_register_devclks(devclks, ARRAY_SIZE(devclks));
 
        tegra_clk_apply_init_table = tegra20_clock_apply_init_table;
 
index dbe7c8003c5c4392244b7161e5b7771634e7e8c3..8b10c38b6e3c677a19be8253ca11629a3a145445 100644 (file)
 #include <linux/of_address.h>
 #include <linux/clk/tegra.h>
 #include <linux/tegra-powergate.h>
-
+#include <dt-bindings/clock/tegra30-car.h>
 #include "clk.h"
-
-#define RST_DEVICES_L 0x004
-#define RST_DEVICES_H 0x008
-#define RST_DEVICES_U 0x00c
-#define RST_DEVICES_V 0x358
-#define RST_DEVICES_W 0x35c
-#define RST_DEVICES_SET_L 0x300
-#define RST_DEVICES_CLR_L 0x304
-#define RST_DEVICES_SET_H 0x308
-#define RST_DEVICES_CLR_H 0x30c
-#define RST_DEVICES_SET_U 0x310
-#define RST_DEVICES_CLR_U 0x314
-#define RST_DEVICES_SET_V 0x430
-#define RST_DEVICES_CLR_V 0x434
-#define RST_DEVICES_SET_W 0x438
-#define RST_DEVICES_CLR_W 0x43c
-#define RST_DEVICES_NUM 5
-
-#define CLK_OUT_ENB_L 0x010
-#define CLK_OUT_ENB_H 0x014
-#define CLK_OUT_ENB_U 0x018
-#define CLK_OUT_ENB_V 0x360
-#define CLK_OUT_ENB_W 0x364
-#define CLK_OUT_ENB_SET_L 0x320
-#define CLK_OUT_ENB_CLR_L 0x324
-#define CLK_OUT_ENB_SET_H 0x328
-#define CLK_OUT_ENB_CLR_H 0x32c
-#define CLK_OUT_ENB_SET_U 0x330
-#define CLK_OUT_ENB_CLR_U 0x334
-#define CLK_OUT_ENB_SET_V 0x440
-#define CLK_OUT_ENB_CLR_V 0x444
-#define CLK_OUT_ENB_SET_W 0x448
-#define CLK_OUT_ENB_CLR_W 0x44c
-#define CLK_OUT_ENB_NUM 5
+#include "clk-id.h"
 
 #define OSC_CTRL                       0x50
 #define OSC_CTRL_OSC_FREQ_MASK         (0xF<<28)
@@ -92,6 +59,8 @@
 
 #define SYSTEM_CLK_RATE 0x030
 
+#define TEGRA30_CLK_PERIPH_BANKS       5
+
 #define PLLC_BASE 0x80
 #define PLLC_MISC 0x8c
 #define PLLM_BASE 0x90
 #define AUDIO_SYNC_CLK_I2S4 0x4b0
 #define AUDIO_SYNC_CLK_SPDIF 0x4b4
 
-#define PMC_CLK_OUT_CNTRL 0x1a8
-
-#define CLK_SOURCE_I2S0 0x1d8
-#define CLK_SOURCE_I2S1 0x100
-#define CLK_SOURCE_I2S2 0x104
-#define CLK_SOURCE_I2S3 0x3bc
-#define CLK_SOURCE_I2S4 0x3c0
 #define CLK_SOURCE_SPDIF_OUT 0x108
-#define CLK_SOURCE_SPDIF_IN 0x10c
 #define CLK_SOURCE_PWM 0x110
 #define CLK_SOURCE_D_AUDIO 0x3d0
 #define CLK_SOURCE_DAM0 0x3d8
 #define CLK_SOURCE_DAM1 0x3dc
 #define CLK_SOURCE_DAM2 0x3e0
-#define CLK_SOURCE_HDA 0x428
-#define CLK_SOURCE_HDA2CODEC_2X 0x3e4
-#define CLK_SOURCE_SBC1 0x134
-#define CLK_SOURCE_SBC2 0x118
-#define CLK_SOURCE_SBC3 0x11c
-#define CLK_SOURCE_SBC4 0x1b4
-#define CLK_SOURCE_SBC5 0x3c8
-#define CLK_SOURCE_SBC6 0x3cc
-#define CLK_SOURCE_SATA_OOB 0x420
-#define CLK_SOURCE_SATA 0x424
-#define CLK_SOURCE_NDFLASH 0x160
-#define CLK_SOURCE_NDSPEED 0x3f8
-#define CLK_SOURCE_VFIR 0x168
-#define CLK_SOURCE_SDMMC1 0x150
-#define CLK_SOURCE_SDMMC2 0x154
-#define CLK_SOURCE_SDMMC3 0x1bc
-#define CLK_SOURCE_SDMMC4 0x164
-#define CLK_SOURCE_VDE 0x1c8
-#define CLK_SOURCE_CSITE 0x1d4
-#define CLK_SOURCE_LA 0x1f8
-#define CLK_SOURCE_OWR 0x1cc
-#define CLK_SOURCE_NOR 0x1d0
-#define CLK_SOURCE_MIPI 0x174
-#define CLK_SOURCE_I2C1 0x124
-#define CLK_SOURCE_I2C2 0x198
-#define CLK_SOURCE_I2C3 0x1b8
-#define CLK_SOURCE_I2C4 0x3c4
-#define CLK_SOURCE_I2C5 0x128
-#define CLK_SOURCE_UARTA 0x178
-#define CLK_SOURCE_UARTB 0x17c
-#define CLK_SOURCE_UARTC 0x1a0
-#define CLK_SOURCE_UARTD 0x1c0
-#define CLK_SOURCE_UARTE 0x1c4
-#define CLK_SOURCE_VI 0x148
-#define CLK_SOURCE_VI_SENSOR 0x1a8
-#define CLK_SOURCE_3D 0x158
 #define CLK_SOURCE_3D2 0x3b0
 #define CLK_SOURCE_2D 0x15c
-#define CLK_SOURCE_EPP 0x16c
-#define CLK_SOURCE_MPE 0x170
-#define CLK_SOURCE_HOST1X 0x180
-#define CLK_SOURCE_CVE 0x140
-#define CLK_SOURCE_TVO 0x188
-#define CLK_SOURCE_DTV 0x1dc
 #define CLK_SOURCE_HDMI 0x18c
-#define CLK_SOURCE_TVDAC 0x194
-#define CLK_SOURCE_DISP1 0x138
-#define CLK_SOURCE_DISP2 0x13c
 #define CLK_SOURCE_DSIB 0xd0
-#define CLK_SOURCE_TSENSOR 0x3b8
-#define CLK_SOURCE_ACTMON 0x3e8
-#define CLK_SOURCE_EXTERN1 0x3ec
-#define CLK_SOURCE_EXTERN2 0x3f0
-#define CLK_SOURCE_EXTERN3 0x3f4
-#define CLK_SOURCE_I2CSLOW 0x3fc
 #define CLK_SOURCE_SE 0x42c
-#define CLK_SOURCE_MSELECT 0x3b4
 #define CLK_SOURCE_EMC 0x19c
 
 #define AUDIO_SYNC_DOUBLER 0x49c
 
-#define PMC_CTRL 0
-#define PMC_CTRL_BLINK_ENB 7
-
-#define PMC_DPD_PADS_ORIDE 0x1c
-#define PMC_DPD_PADS_ORIDE_BLINK_ENB 20
-#define PMC_BLINK_TIMER 0x40
-
 #define UTMIP_PLL_CFG2 0x488
 #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6)
 #define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18)
@@ -266,89 +168,41 @@ static struct cpu_clk_suspend_context {
 } tegra30_cpu_clk_sctx;
 #endif
 
-static int periph_clk_enb_refcnt[CLK_OUT_ENB_NUM * 32];
-
 static void __iomem *clk_base;
 static void __iomem *pmc_base;
 static unsigned long input_freq;
 
-static DEFINE_SPINLOCK(clk_doubler_lock);
-static DEFINE_SPINLOCK(clk_out_lock);
-static DEFINE_SPINLOCK(pll_div_lock);
 static DEFINE_SPINLOCK(cml_lock);
 static DEFINE_SPINLOCK(pll_d_lock);
-static DEFINE_SPINLOCK(sysrate_lock);
-
-#define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset,        \
-                           _clk_num, _regs, _gate_flags, _clk_id)      \
-       TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset,     \
-                       30, 2, 0, 0, 8, 1, 0, _regs, _clk_num,          \
-                       periph_clk_enb_refcnt, _gate_flags, _clk_id)
-
-#define TEGRA_INIT_DATA_DIV16(_name, _con_id, _dev_id, _parents, _offset, \
-                           _clk_num, _regs, _gate_flags, _clk_id)      \
-       TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset,     \
-                       30, 2, 0, 0, 16, 0, TEGRA_DIVIDER_ROUND_UP,     \
-                       _regs, _clk_num, periph_clk_enb_refcnt,         \
-                       _gate_flags, _clk_id)
-
-#define TEGRA_INIT_DATA_MUX8(_name, _con_id, _dev_id, _parents, _offset, \
-                            _clk_num, _regs, _gate_flags, _clk_id)     \
-       TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset,     \
-                       29, 3, 0, 0, 8, 1, 0, _regs, _clk_num,          \
-                       periph_clk_enb_refcnt, _gate_flags, _clk_id)
-
-#define TEGRA_INIT_DATA_INT(_name, _con_id, _dev_id, _parents, _offset,        \
-                           _clk_num, _regs, _gate_flags, _clk_id)      \
-       TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset,     \
-                       30, 2, 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,    \
-                       _clk_num, periph_clk_enb_refcnt, _gate_flags,   \
-                       _clk_id)
 
-#define TEGRA_INIT_DATA_UART(_name, _con_id, _dev_id, _parents, _offset,\
-                            _clk_num, _regs, _clk_id)                  \
-       TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset,     \
-                       30, 2, 0, 0, 16, 1, TEGRA_DIVIDER_UART, _regs,  \
-                       _clk_num, periph_clk_enb_refcnt, 0, _clk_id)
+#define TEGRA_INIT_DATA_MUX(_name, _parents, _offset,  \
+                           _clk_num, _gate_flags, _clk_id)     \
+       TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset,   \
+                       30, 2, 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP, \
+                       _clk_num, _gate_flags, _clk_id)
+
+#define TEGRA_INIT_DATA_MUX8(_name, _parents, _offset, \
+                            _clk_num, _gate_flags, _clk_id)    \
+       TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset,   \
+                       29, 3, 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP, \
+                       _clk_num, _gate_flags, _clk_id)
+
+#define TEGRA_INIT_DATA_INT(_name, _parents, _offset,  \
+                           _clk_num, _gate_flags, _clk_id)     \
+       TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset,   \
+                       30, 2, 0, 0, 8, 1, TEGRA_DIVIDER_INT |          \
+                       TEGRA_DIVIDER_ROUND_UP, _clk_num,       \
+                       _gate_flags, _clk_id)
 
-#define TEGRA_INIT_DATA_NODIV(_name, _con_id, _dev_id, _parents, _offset, \
-                             _mux_shift, _mux_width, _clk_num, _regs,  \
+#define TEGRA_INIT_DATA_NODIV(_name, _parents, _offset, \
+                             _mux_shift, _mux_width, _clk_num, \
                              _gate_flags, _clk_id)                     \
-       TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parents, _offset,     \
-                       _mux_shift, _mux_width, 0, 0, 0, 0, 0, _regs,   \
-                       _clk_num, periph_clk_enb_refcnt, _gate_flags,   \
+       TEGRA_INIT_DATA(_name, NULL, NULL, _parents, _offset,   \
+                       _mux_shift, _mux_width, 0, 0, 0, 0, 0,\
+                       _clk_num, _gate_flags,  \
                        _clk_id)
 
-/*
- * IDs assigned here must be in sync with DT bindings definition
- * for Tegra30 clocks.
- */
-enum tegra30_clk {
-       cpu, rtc = 4, timer, uarta, gpio = 8, sdmmc2, i2s1 = 11, i2c1, ndflash,
-       sdmmc1, sdmmc4, pwm = 17, i2s2, epp, gr2d = 21, usbd, isp, gr3d,
-       disp2 = 26, disp1, host1x, vcp, i2s0, cop_cache, mc, ahbdma, apbdma,
-       kbc = 36, statmon, pmc, kfuse = 40, sbc1, nor, sbc2 = 44, sbc3 = 46,
-       i2c5, dsia, mipi = 50, hdmi, csi, tvdac, i2c2, uartc, emc = 57, usb2,
-       usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3,
-       pcie, owr, afi, csite, pciex, avpucq, la, dtv = 79, ndspeed, i2cslow,
-       dsib, irama = 84, iramb, iramc, iramd, cram2, audio_2x = 90, csus = 92,
-       cdev2, cdev1, cpu_g = 96, cpu_lp, gr3d2, mselect, tsensor, i2s3, i2s4,
-       i2c4, sbc5, sbc6, d_audio, apbif, dam0, dam1, dam2, hda2codec_2x,
-       atomics, audio0_2x, audio1_2x, audio2_2x, audio3_2x, audio4_2x,
-       spdif_2x, actmon, extern1, extern2, extern3, sata_oob, sata, hda,
-       se = 127, hda2hdmi, sata_cold, uartb = 160, vfir, spdif_in, spdif_out,
-       vi, vi_sensor, fuse, fuse_burn, cve, tvo, clk_32k, clk_m, clk_m_div2,
-       clk_m_div4, pll_ref, pll_c, pll_c_out1, pll_m, pll_m_out1, pll_p,
-       pll_p_out1, pll_p_out2, pll_p_out3, pll_p_out4, pll_a, pll_a_out0,
-       pll_d, pll_d_out0, pll_d2, pll_d2_out0, pll_u, pll_x, pll_x_out0, pll_e,
-       spdif_in_sync, i2s0_sync, i2s1_sync, i2s2_sync, i2s3_sync, i2s4_sync,
-       vimclk_sync, audio0, audio1, audio2, audio3, audio4, spdif, clk_out_1,
-       clk_out_2, clk_out_3, sclk, blink, cclk_g, cclk_lp, twd, cml0, cml1,
-       hclk, pclk, clk_out_1_mux = 300, clk_max
-};
-
-static struct clk *clks[clk_max];
-static struct clk_onecell_data clk_data;
+static struct clk **clks;
 
 /*
  * Structure defining the fields for USB UTMI clocks Parameters.
@@ -564,6 +418,8 @@ static struct tegra_clk_pll_params pll_c_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
        .lock_delay = 300,
+       .freq_table = pll_c_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
 };
 
 static struct div_nmp pllm_nmp = {
@@ -593,6 +449,9 @@ static struct tegra_clk_pll_params pll_m_params = {
        .div_nmp = &pllm_nmp,
        .pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE,
        .pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE,
+       .freq_table = pll_m_freq_table,
+       .flags = TEGRA_PLLM | TEGRA_PLL_HAS_CPCON |
+                TEGRA_PLL_SET_DCCON | TEGRA_PLL_USE_LOCK,
 };
 
 static struct tegra_clk_pll_params pll_p_params = {
@@ -607,6 +466,9 @@ static struct tegra_clk_pll_params pll_p_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
        .lock_delay = 300,
+       .freq_table = pll_p_freq_table,
+       .flags = TEGRA_PLL_FIXED | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
+       .fixed_rate = 408000000,
 };
 
 static struct tegra_clk_pll_params pll_a_params = {
@@ -621,6 +483,8 @@ static struct tegra_clk_pll_params pll_a_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
        .lock_delay = 300,
+       .freq_table = pll_a_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
 };
 
 static struct tegra_clk_pll_params pll_d_params = {
@@ -635,6 +499,10 @@ static struct tegra_clk_pll_params pll_d_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
        .lock_delay = 1000,
+       .freq_table = pll_d_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
+                TEGRA_PLL_USE_LOCK,
+
 };
 
 static struct tegra_clk_pll_params pll_d2_params = {
@@ -649,6 +517,9 @@ static struct tegra_clk_pll_params pll_d2_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
        .lock_delay = 1000,
+       .freq_table = pll_d_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
+                TEGRA_PLL_USE_LOCK,
 };
 
 static struct tegra_clk_pll_params pll_u_params = {
@@ -664,6 +535,8 @@ static struct tegra_clk_pll_params pll_u_params = {
        .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
        .lock_delay = 1000,
        .pdiv_tohw = pllu_p,
+       .freq_table = pll_u_freq_table,
+       .flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON,
 };
 
 static struct tegra_clk_pll_params pll_x_params = {
@@ -678,6 +551,9 @@ static struct tegra_clk_pll_params pll_x_params = {
        .lock_mask = PLL_BASE_LOCK,
        .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
        .lock_delay = 300,
+       .freq_table = pll_x_freq_table,
+       .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_DCCON |
+                TEGRA_PLL_USE_LOCK,
 };
 
 static struct tegra_clk_pll_params pll_e_params = {
@@ -692,116 +568,299 @@ static struct tegra_clk_pll_params pll_e_params = {
        .lock_mask = PLLE_MISC_LOCK,
        .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE,
        .lock_delay = 300,
+       .freq_table = pll_e_freq_table,
+       .flags = TEGRA_PLLE_CONFIGURE | TEGRA_PLL_FIXED,
+       .fixed_rate = 100000000,
 };
 
-/* Peripheral clock registers */
-static struct tegra_clk_periph_regs periph_l_regs = {
-       .enb_reg = CLK_OUT_ENB_L,
-       .enb_set_reg = CLK_OUT_ENB_SET_L,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_L,
-       .rst_reg = RST_DEVICES_L,
-       .rst_set_reg = RST_DEVICES_SET_L,
-       .rst_clr_reg = RST_DEVICES_CLR_L,
+static unsigned long tegra30_input_freq[] = {
+       [0] = 13000000,
+       [1] = 16800000,
+       [4] = 19200000,
+       [5] = 38400000,
+       [8] = 12000000,
+       [9] = 48000000,
+       [12] = 260000000,
 };
 
-static struct tegra_clk_periph_regs periph_h_regs = {
-       .enb_reg = CLK_OUT_ENB_H,
-       .enb_set_reg = CLK_OUT_ENB_SET_H,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_H,
-       .rst_reg = RST_DEVICES_H,
-       .rst_set_reg = RST_DEVICES_SET_H,
-       .rst_clr_reg = RST_DEVICES_CLR_H,
+static struct tegra_devclk devclks[] __initdata = {
+       { .con_id = "pll_c", .dt_id = TEGRA30_CLK_PLL_C },
+       { .con_id = "pll_c_out1", .dt_id = TEGRA30_CLK_PLL_C_OUT1 },
+       { .con_id = "pll_p", .dt_id = TEGRA30_CLK_PLL_P },
+       { .con_id = "pll_p_out1", .dt_id = TEGRA30_CLK_PLL_P_OUT1 },
+       { .con_id = "pll_p_out2", .dt_id = TEGRA30_CLK_PLL_P_OUT2 },
+       { .con_id = "pll_p_out3", .dt_id = TEGRA30_CLK_PLL_P_OUT3 },
+       { .con_id = "pll_p_out4", .dt_id = TEGRA30_CLK_PLL_P_OUT4 },
+       { .con_id = "pll_m", .dt_id = TEGRA30_CLK_PLL_M },
+       { .con_id = "pll_m_out1", .dt_id = TEGRA30_CLK_PLL_M_OUT1 },
+       { .con_id = "pll_x", .dt_id = TEGRA30_CLK_PLL_X },
+       { .con_id = "pll_x_out0", .dt_id = TEGRA30_CLK_PLL_X_OUT0 },
+       { .con_id = "pll_u", .dt_id = TEGRA30_CLK_PLL_U },
+       { .con_id = "pll_d", .dt_id = TEGRA30_CLK_PLL_D },
+       { .con_id = "pll_d_out0", .dt_id = TEGRA30_CLK_PLL_D_OUT0 },
+       { .con_id = "pll_d2", .dt_id = TEGRA30_CLK_PLL_D2 },
+       { .con_id = "pll_d2_out0", .dt_id = TEGRA30_CLK_PLL_D2_OUT0 },
+       { .con_id = "pll_a", .dt_id = TEGRA30_CLK_PLL_A },
+       { .con_id = "pll_a_out0", .dt_id = TEGRA30_CLK_PLL_A_OUT0 },
+       { .con_id = "pll_e", .dt_id = TEGRA30_CLK_PLL_E },
+       { .con_id = "spdif_in_sync", .dt_id = TEGRA30_CLK_SPDIF_IN_SYNC },
+       { .con_id = "i2s0_sync", .dt_id = TEGRA30_CLK_I2S0_SYNC },
+       { .con_id = "i2s1_sync", .dt_id = TEGRA30_CLK_I2S1_SYNC },
+       { .con_id = "i2s2_sync", .dt_id = TEGRA30_CLK_I2S2_SYNC },
+       { .con_id = "i2s3_sync", .dt_id = TEGRA30_CLK_I2S3_SYNC },
+       { .con_id = "i2s4_sync", .dt_id = TEGRA30_CLK_I2S4_SYNC },
+       { .con_id = "vimclk_sync", .dt_id = TEGRA30_CLK_VIMCLK_SYNC },
+       { .con_id = "audio0", .dt_id = TEGRA30_CLK_AUDIO0 },
+       { .con_id = "audio1", .dt_id = TEGRA30_CLK_AUDIO1 },
+       { .con_id = "audio2", .dt_id = TEGRA30_CLK_AUDIO2 },
+       { .con_id = "audio3", .dt_id = TEGRA30_CLK_AUDIO3 },
+       { .con_id = "audio4", .dt_id = TEGRA30_CLK_AUDIO4 },
+       { .con_id = "spdif", .dt_id = TEGRA30_CLK_SPDIF },
+       { .con_id = "audio0_2x", .dt_id = TEGRA30_CLK_AUDIO0_2X },
+       { .con_id = "audio1_2x", .dt_id = TEGRA30_CLK_AUDIO1_2X },
+       { .con_id = "audio2_2x", .dt_id = TEGRA30_CLK_AUDIO2_2X },
+       { .con_id = "audio3_2x", .dt_id = TEGRA30_CLK_AUDIO3_2X },
+       { .con_id = "audio4_2x", .dt_id = TEGRA30_CLK_AUDIO4_2X },
+       { .con_id = "spdif_2x", .dt_id = TEGRA30_CLK_SPDIF_2X },
+       { .con_id = "extern1", .dev_id = "clk_out_1", .dt_id = TEGRA30_CLK_EXTERN1 },
+       { .con_id = "extern2", .dev_id = "clk_out_2", .dt_id = TEGRA30_CLK_EXTERN2 },
+       { .con_id = "extern3", .dev_id = "clk_out_3", .dt_id = TEGRA30_CLK_EXTERN3 },
+       { .con_id = "blink", .dt_id = TEGRA30_CLK_BLINK },
+       { .con_id = "cclk_g", .dt_id = TEGRA30_CLK_CCLK_G },
+       { .con_id = "cclk_lp", .dt_id = TEGRA30_CLK_CCLK_LP },
+       { .con_id = "sclk", .dt_id = TEGRA30_CLK_SCLK },
+       { .con_id = "hclk", .dt_id = TEGRA30_CLK_HCLK },
+       { .con_id = "pclk", .dt_id = TEGRA30_CLK_PCLK },
+       { .con_id = "twd", .dt_id = TEGRA30_CLK_TWD },
+       { .con_id = "emc", .dt_id = TEGRA30_CLK_EMC },
+       { .con_id = "clk_32k", .dt_id = TEGRA30_CLK_CLK_32K },
+       { .con_id = "clk_m_div2", .dt_id = TEGRA30_CLK_CLK_M_DIV2 },
+       { .con_id = "clk_m_div4", .dt_id = TEGRA30_CLK_CLK_M_DIV4 },
+       { .con_id = "cml0", .dt_id = TEGRA30_CLK_CML0 },
+       { .con_id = "cml1", .dt_id = TEGRA30_CLK_CML1 },
+       { .con_id = "clk_m", .dt_id = TEGRA30_CLK_CLK_M },
+       { .con_id = "pll_ref", .dt_id = TEGRA30_CLK_PLL_REF },
+       { .con_id = "csus", .dev_id = "tengra_camera", .dt_id = TEGRA30_CLK_CSUS },
+       { .con_id = "vcp", .dev_id = "tegra-avp", .dt_id = TEGRA30_CLK_VCP },
+       { .con_id = "bsea", .dev_id = "tegra-avp", .dt_id = TEGRA30_CLK_BSEA },
+       { .con_id = "bsev", .dev_id = "tegra-aes", .dt_id = TEGRA30_CLK_BSEV },
+       { .con_id = "dsia", .dev_id = "tegradc.0", .dt_id = TEGRA30_CLK_DSIA },
+       { .con_id = "csi", .dev_id = "tegra_camera", .dt_id = TEGRA30_CLK_CSI },
+       { .con_id = "isp", .dev_id = "tegra_camera", .dt_id = TEGRA30_CLK_ISP },
+       { .con_id = "pcie", .dev_id = "tegra-pcie", .dt_id = TEGRA30_CLK_PCIE },
+       { .con_id = "afi", .dev_id = "tegra-pcie", .dt_id = TEGRA30_CLK_AFI },
+       { .con_id = "fuse", .dt_id = TEGRA30_CLK_FUSE },
+       { .con_id = "fuse_burn", .dev_id = "fuse-tegra", .dt_id = TEGRA30_CLK_FUSE_BURN },
+       { .con_id = "apbif", .dev_id = "tegra30-ahub", .dt_id = TEGRA30_CLK_APBIF },
+       { .con_id = "hda2hdmi", .dev_id = "tegra30-hda", .dt_id = TEGRA30_CLK_HDA2HDMI },
+       { .dev_id =  "tegra-apbdma", .dt_id = TEGRA30_CLK_APBDMA },
+       { .dev_id =  "rtc-tegra", .dt_id = TEGRA30_CLK_RTC },
+       { .dev_id =  "timer", .dt_id = TEGRA30_CLK_TIMER },
+       { .dev_id =  "tegra-kbc", .dt_id = TEGRA30_CLK_KBC },
+       { .dev_id =  "fsl-tegra-udc", .dt_id = TEGRA30_CLK_USBD },
+       { .dev_id =  "tegra-ehci.1", .dt_id = TEGRA30_CLK_USB2 },
+       { .dev_id =  "tegra-ehci.2", .dt_id = TEGRA30_CLK_USB2 },
+       { .dev_id =  "kfuse-tegra", .dt_id = TEGRA30_CLK_KFUSE },
+       { .dev_id =  "tegra_sata_cold", .dt_id = TEGRA30_CLK_SATA_COLD },
+       { .dev_id =  "dtv", .dt_id = TEGRA30_CLK_DTV },
+       { .dev_id = "tegra30-i2s.0", .dt_id = TEGRA30_CLK_I2S0 },
+       { .dev_id = "tegra30-i2s.1", .dt_id = TEGRA30_CLK_I2S1 },
+       { .dev_id = "tegra30-i2s.2", .dt_id = TEGRA30_CLK_I2S2 },
+       { .dev_id = "tegra30-i2s.3", .dt_id = TEGRA30_CLK_I2S3 },
+       { .dev_id = "tegra30-i2s.4", .dt_id = TEGRA30_CLK_I2S4 },
+       { .con_id = "spdif_out", .dev_id = "tegra30-spdif", .dt_id = TEGRA30_CLK_SPDIF_OUT },
+       { .con_id = "spdif_in", .dev_id = "tegra30-spdif", .dt_id = TEGRA30_CLK_SPDIF_IN },
+       { .con_id = "d_audio", .dev_id = "tegra30-ahub", .dt_id = TEGRA30_CLK_D_AUDIO },
+       { .dev_id = "tegra30-dam.0", .dt_id = TEGRA30_CLK_DAM0 },
+       { .dev_id = "tegra30-dam.1", .dt_id = TEGRA30_CLK_DAM1 },
+       { .dev_id = "tegra30-dam.2", .dt_id = TEGRA30_CLK_DAM2 },
+       { .con_id = "hda", .dev_id = "tegra30-hda", .dt_id = TEGRA30_CLK_HDA },
+       { .con_id = "hda2codec", .dev_id = "tegra30-hda", .dt_id = TEGRA30_CLK_HDA2CODEC_2X },
+       { .dev_id = "spi_tegra.0", .dt_id = TEGRA30_CLK_SBC1 },
+       { .dev_id = "spi_tegra.1", .dt_id = TEGRA30_CLK_SBC2 },
+       { .dev_id = "spi_tegra.2", .dt_id = TEGRA30_CLK_SBC3 },
+       { .dev_id = "spi_tegra.3", .dt_id = TEGRA30_CLK_SBC4 },
+       { .dev_id = "spi_tegra.4", .dt_id = TEGRA30_CLK_SBC5 },
+       { .dev_id = "spi_tegra.5", .dt_id = TEGRA30_CLK_SBC6 },
+       { .dev_id = "tegra_sata_oob", .dt_id = TEGRA30_CLK_SATA_OOB },
+       { .dev_id = "tegra_sata", .dt_id = TEGRA30_CLK_SATA },
+       { .dev_id = "tegra_nand", .dt_id = TEGRA30_CLK_NDFLASH },
+       { .dev_id = "tegra_nand_speed", .dt_id = TEGRA30_CLK_NDSPEED },
+       { .dev_id = "vfir", .dt_id = TEGRA30_CLK_VFIR },
+       { .dev_id = "csite", .dt_id = TEGRA30_CLK_CSITE },
+       { .dev_id = "la", .dt_id = TEGRA30_CLK_LA },
+       { .dev_id = "tegra_w1", .dt_id = TEGRA30_CLK_OWR },
+       { .dev_id = "mipi", .dt_id = TEGRA30_CLK_MIPI },
+       { .dev_id = "tegra-tsensor", .dt_id = TEGRA30_CLK_TSENSOR },
+       { .dev_id = "i2cslow", .dt_id = TEGRA30_CLK_I2CSLOW },
+       { .dev_id = "vde", .dt_id = TEGRA30_CLK_VDE },
+       { .con_id = "vi", .dev_id = "tegra_camera", .dt_id = TEGRA30_CLK_VI },
+       { .dev_id = "epp", .dt_id = TEGRA30_CLK_EPP },
+       { .dev_id = "mpe", .dt_id = TEGRA30_CLK_MPE },
+       { .dev_id = "host1x", .dt_id = TEGRA30_CLK_HOST1X },
+       { .dev_id = "3d", .dt_id = TEGRA30_CLK_GR3D },
+       { .dev_id = "3d2", .dt_id = TEGRA30_CLK_GR3D2 },
+       { .dev_id = "2d", .dt_id = TEGRA30_CLK_GR2D },
+       { .dev_id = "se", .dt_id = TEGRA30_CLK_SE },
+       { .dev_id = "mselect", .dt_id = TEGRA30_CLK_MSELECT },
+       { .dev_id = "tegra-nor", .dt_id = TEGRA30_CLK_NOR },
+       { .dev_id = "sdhci-tegra.0", .dt_id = TEGRA30_CLK_SDMMC1 },
+       { .dev_id = "sdhci-tegra.1", .dt_id = TEGRA30_CLK_SDMMC2 },
+       { .dev_id = "sdhci-tegra.2", .dt_id = TEGRA30_CLK_SDMMC3 },
+       { .dev_id = "sdhci-tegra.3", .dt_id = TEGRA30_CLK_SDMMC4 },
+       { .dev_id = "cve", .dt_id = TEGRA30_CLK_CVE },
+       { .dev_id = "tvo", .dt_id = TEGRA30_CLK_TVO },
+       { .dev_id = "tvdac", .dt_id = TEGRA30_CLK_TVDAC },
+       { .dev_id = "actmon", .dt_id = TEGRA30_CLK_ACTMON },
+       { .con_id = "vi_sensor", .dev_id = "tegra_camera", .dt_id = TEGRA30_CLK_VI_SENSOR },
+       { .con_id = "div-clk", .dev_id = "tegra-i2c.0", .dt_id = TEGRA30_CLK_I2C1 },
+       { .con_id = "div-clk", .dev_id = "tegra-i2c.1", .dt_id = TEGRA30_CLK_I2C2 },
+       { .con_id = "div-clk", .dev_id = "tegra-i2c.2", .dt_id = TEGRA30_CLK_I2C3 },
+       { .con_id = "div-clk", .dev_id = "tegra-i2c.3", .dt_id = TEGRA30_CLK_I2C4 },
+       { .con_id = "div-clk", .dev_id = "tegra-i2c.4", .dt_id = TEGRA30_CLK_I2C5 },
+       { .dev_id = "tegra_uart.0", .dt_id = TEGRA30_CLK_UARTA },
+       { .dev_id = "tegra_uart.1", .dt_id = TEGRA30_CLK_UARTB },
+       { .dev_id = "tegra_uart.2", .dt_id = TEGRA30_CLK_UARTC },
+       { .dev_id = "tegra_uart.3", .dt_id = TEGRA30_CLK_UARTD },
+       { .dev_id = "tegra_uart.4", .dt_id = TEGRA30_CLK_UARTE },
+       { .dev_id = "hdmi", .dt_id = TEGRA30_CLK_HDMI },
+       { .dev_id = "extern1", .dt_id = TEGRA30_CLK_EXTERN1 },
+       { .dev_id = "extern2", .dt_id = TEGRA30_CLK_EXTERN2 },
+       { .dev_id = "extern3", .dt_id = TEGRA30_CLK_EXTERN3 },
+       { .dev_id = "pwm", .dt_id = TEGRA30_CLK_PWM },
+       { .dev_id = "tegradc.0", .dt_id = TEGRA30_CLK_DISP1 },
+       { .dev_id = "tegradc.1", .dt_id = TEGRA30_CLK_DISP2 },
+       { .dev_id = "tegradc.1", .dt_id = TEGRA30_CLK_DSIB },
 };
 
-static struct tegra_clk_periph_regs periph_u_regs = {
-       .enb_reg = CLK_OUT_ENB_U,
-       .enb_set_reg = CLK_OUT_ENB_SET_U,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_U,
-       .rst_reg = RST_DEVICES_U,
-       .rst_set_reg = RST_DEVICES_SET_U,
-       .rst_clr_reg = RST_DEVICES_CLR_U,
-};
+static struct tegra_clk tegra30_clks[tegra_clk_max] __initdata = {
+       [tegra_clk_clk_32k] = { .dt_id = TEGRA30_CLK_CLK_32K, .present = true },
+       [tegra_clk_clk_m] = { .dt_id = TEGRA30_CLK_CLK_M, .present = true },
+       [tegra_clk_clk_m_div2] = { .dt_id = TEGRA30_CLK_CLK_M_DIV2, .present = true },
+       [tegra_clk_clk_m_div4] = { .dt_id = TEGRA30_CLK_CLK_M_DIV4, .present = true },
+       [tegra_clk_pll_ref] = { .dt_id = TEGRA30_CLK_PLL_REF, .present = true },
+       [tegra_clk_spdif_in_sync] = { .dt_id = TEGRA30_CLK_SPDIF_IN_SYNC, .present = true },
+       [tegra_clk_i2s0_sync] = { .dt_id = TEGRA30_CLK_I2S0_SYNC, .present = true },
+       [tegra_clk_i2s1_sync] = { .dt_id = TEGRA30_CLK_I2S1_SYNC, .present = true },
+       [tegra_clk_i2s2_sync] = { .dt_id = TEGRA30_CLK_I2S2_SYNC, .present = true },
+       [tegra_clk_i2s3_sync] = { .dt_id = TEGRA30_CLK_I2S3_SYNC, .present = true },
+       [tegra_clk_i2s4_sync] = { .dt_id = TEGRA30_CLK_I2S4_SYNC, .present = true },
+       [tegra_clk_vimclk_sync] = { .dt_id = TEGRA30_CLK_VIMCLK_SYNC, .present = true },
+       [tegra_clk_audio0] = { .dt_id = TEGRA30_CLK_AUDIO0, .present = true },
+       [tegra_clk_audio1] = { .dt_id = TEGRA30_CLK_AUDIO1, .present = true },
+       [tegra_clk_audio2] = { .dt_id = TEGRA30_CLK_AUDIO2, .present = true },
+       [tegra_clk_audio3] = { .dt_id = TEGRA30_CLK_AUDIO3, .present = true },
+       [tegra_clk_audio4] = { .dt_id = TEGRA30_CLK_AUDIO4, .present = true },
+       [tegra_clk_spdif] = { .dt_id = TEGRA30_CLK_SPDIF, .present = true },
+       [tegra_clk_audio0_mux] = { .dt_id = TEGRA30_CLK_AUDIO0_MUX, .present = true },
+       [tegra_clk_audio1_mux] = { .dt_id = TEGRA30_CLK_AUDIO1_MUX, .present = true },
+       [tegra_clk_audio2_mux] = { .dt_id = TEGRA30_CLK_AUDIO2_MUX, .present = true },
+       [tegra_clk_audio3_mux] = { .dt_id = TEGRA30_CLK_AUDIO3_MUX, .present = true },
+       [tegra_clk_audio4_mux] = { .dt_id = TEGRA30_CLK_AUDIO4_MUX, .present = true },
+       [tegra_clk_spdif_mux] = { .dt_id = TEGRA30_CLK_SPDIF_MUX, .present = true },
+       [tegra_clk_audio0_2x] = { .dt_id = TEGRA30_CLK_AUDIO0_2X, .present = true },
+       [tegra_clk_audio1_2x] = { .dt_id = TEGRA30_CLK_AUDIO1_2X, .present = true },
+       [tegra_clk_audio2_2x] = { .dt_id = TEGRA30_CLK_AUDIO2_2X, .present = true },
+       [tegra_clk_audio3_2x] = { .dt_id = TEGRA30_CLK_AUDIO3_2X, .present = true },
+       [tegra_clk_audio4_2x] = { .dt_id = TEGRA30_CLK_AUDIO4_2X, .present = true },
+       [tegra_clk_spdif_2x] = { .dt_id = TEGRA30_CLK_SPDIF_2X, .present = true },
+       [tegra_clk_clk_out_1] = { .dt_id = TEGRA30_CLK_CLK_OUT_1, .present = true },
+       [tegra_clk_clk_out_2] = { .dt_id = TEGRA30_CLK_CLK_OUT_2, .present = true },
+       [tegra_clk_clk_out_3] = { .dt_id = TEGRA30_CLK_CLK_OUT_3, .present = true },
+       [tegra_clk_blink] = { .dt_id = TEGRA30_CLK_BLINK, .present = true },
+       [tegra_clk_clk_out_1_mux] = { .dt_id = TEGRA30_CLK_CLK_OUT_1_MUX, .present = true },
+       [tegra_clk_clk_out_2_mux] = { .dt_id = TEGRA30_CLK_CLK_OUT_2_MUX, .present = true },
+       [tegra_clk_clk_out_3_mux] = { .dt_id = TEGRA30_CLK_CLK_OUT_3_MUX, .present = true },
+       [tegra_clk_hclk] = { .dt_id = TEGRA30_CLK_HCLK, .present = true },
+       [tegra_clk_pclk] = { .dt_id = TEGRA30_CLK_PCLK, .present = true },
+       [tegra_clk_i2s0] = { .dt_id = TEGRA30_CLK_I2S0, .present = true },
+       [tegra_clk_i2s1] = { .dt_id = TEGRA30_CLK_I2S1, .present = true },
+       [tegra_clk_i2s2] = { .dt_id = TEGRA30_CLK_I2S2, .present = true },
+       [tegra_clk_i2s3] = { .dt_id = TEGRA30_CLK_I2S3, .present = true },
+       [tegra_clk_i2s4] = { .dt_id = TEGRA30_CLK_I2S4, .present = true },
+       [tegra_clk_spdif_in] = { .dt_id = TEGRA30_CLK_SPDIF_IN, .present = true },
+       [tegra_clk_hda] = { .dt_id = TEGRA30_CLK_HDA, .present = true },
+       [tegra_clk_hda2codec_2x] = { .dt_id = TEGRA30_CLK_HDA2CODEC_2X, .present = true },
+       [tegra_clk_sbc1] = { .dt_id = TEGRA30_CLK_SBC1, .present = true },
+       [tegra_clk_sbc2] = { .dt_id = TEGRA30_CLK_SBC2, .present = true },
+       [tegra_clk_sbc3] = { .dt_id = TEGRA30_CLK_SBC3, .present = true },
+       [tegra_clk_sbc4] = { .dt_id = TEGRA30_CLK_SBC4, .present = true },
+       [tegra_clk_sbc5] = { .dt_id = TEGRA30_CLK_SBC5, .present = true },
+       [tegra_clk_sbc6] = { .dt_id = TEGRA30_CLK_SBC6, .present = true },
+       [tegra_clk_ndflash] = { .dt_id = TEGRA30_CLK_NDFLASH, .present = true },
+       [tegra_clk_ndspeed] = { .dt_id = TEGRA30_CLK_NDSPEED, .present = true },
+       [tegra_clk_vfir] = { .dt_id = TEGRA30_CLK_VFIR, .present = true },
+       [tegra_clk_la] = { .dt_id = TEGRA30_CLK_LA, .present = true },
+       [tegra_clk_csite] = { .dt_id = TEGRA30_CLK_CSITE, .present = true },
+       [tegra_clk_owr] = { .dt_id = TEGRA30_CLK_OWR, .present = true },
+       [tegra_clk_mipi] = { .dt_id = TEGRA30_CLK_MIPI, .present = true },
+       [tegra_clk_tsensor] = { .dt_id = TEGRA30_CLK_TSENSOR, .present = true },
+       [tegra_clk_i2cslow] = { .dt_id = TEGRA30_CLK_I2CSLOW, .present = true },
+       [tegra_clk_vde] = { .dt_id = TEGRA30_CLK_VDE, .present = true },
+       [tegra_clk_vi] = { .dt_id = TEGRA30_CLK_VI, .present = true },
+       [tegra_clk_epp] = { .dt_id = TEGRA30_CLK_EPP, .present = true },
+       [tegra_clk_mpe] = { .dt_id = TEGRA30_CLK_MPE, .present = true },
+       [tegra_clk_host1x] = { .dt_id = TEGRA30_CLK_HOST1X, .present = true },
+       [tegra_clk_gr2d] = { .dt_id = TEGRA30_CLK_GR2D, .present = true },
+       [tegra_clk_gr3d] = { .dt_id = TEGRA30_CLK_GR3D, .present = true },
+       [tegra_clk_mselect] = { .dt_id = TEGRA30_CLK_MSELECT, .present = true },
+       [tegra_clk_nor] = { .dt_id = TEGRA30_CLK_NOR, .present = true },
+       [tegra_clk_sdmmc1] = { .dt_id = TEGRA30_CLK_SDMMC1, .present = true },
+       [tegra_clk_sdmmc2] = { .dt_id = TEGRA30_CLK_SDMMC2, .present = true },
+       [tegra_clk_sdmmc3] = { .dt_id = TEGRA30_CLK_SDMMC3, .present = true },
+       [tegra_clk_sdmmc4] = { .dt_id = TEGRA30_CLK_SDMMC4, .present = true },
+       [tegra_clk_cve] = { .dt_id = TEGRA30_CLK_CVE, .present = true },
+       [tegra_clk_tvo] = { .dt_id = TEGRA30_CLK_TVO, .present = true },
+       [tegra_clk_tvdac] = { .dt_id = TEGRA30_CLK_TVDAC, .present = true },
+       [tegra_clk_actmon] = { .dt_id = TEGRA30_CLK_ACTMON, .present = true },
+       [tegra_clk_vi_sensor] = { .dt_id = TEGRA30_CLK_VI_SENSOR, .present = true },
+       [tegra_clk_i2c1] = { .dt_id = TEGRA30_CLK_I2C1, .present = true },
+       [tegra_clk_i2c2] = { .dt_id = TEGRA30_CLK_I2C2, .present = true },
+       [tegra_clk_i2c3] = { .dt_id = TEGRA30_CLK_I2C3, .present = true },
+       [tegra_clk_i2c4] = { .dt_id = TEGRA30_CLK_I2C4, .present = true },
+       [tegra_clk_i2c5] = { .dt_id = TEGRA30_CLK_I2C5, .present = true },
+       [tegra_clk_uarta] = { .dt_id = TEGRA30_CLK_UARTA, .present = true },
+       [tegra_clk_uartb] = { .dt_id = TEGRA30_CLK_UARTB, .present = true },
+       [tegra_clk_uartc] = { .dt_id = TEGRA30_CLK_UARTC, .present = true },
+       [tegra_clk_uartd] = { .dt_id = TEGRA30_CLK_UARTD, .present = true },
+       [tegra_clk_uarte] = { .dt_id = TEGRA30_CLK_UARTE, .present = true },
+       [tegra_clk_extern1] = { .dt_id = TEGRA30_CLK_EXTERN1, .present = true },
+       [tegra_clk_extern2] = { .dt_id = TEGRA30_CLK_EXTERN2, .present = true },
+       [tegra_clk_extern3] = { .dt_id = TEGRA30_CLK_EXTERN3, .present = true },
+       [tegra_clk_disp1] = { .dt_id = TEGRA30_CLK_DISP1, .present = true },
+       [tegra_clk_disp2] = { .dt_id = TEGRA30_CLK_DISP2, .present = true },
+       [tegra_clk_apbdma] = { .dt_id = TEGRA30_CLK_APBDMA, .present = true },
+       [tegra_clk_rtc] = { .dt_id = TEGRA30_CLK_RTC, .present = true },
+       [tegra_clk_timer] = { .dt_id = TEGRA30_CLK_TIMER, .present = true },
+       [tegra_clk_kbc] = { .dt_id = TEGRA30_CLK_KBC, .present = true },
+       [tegra_clk_csus] = { .dt_id = TEGRA30_CLK_CSUS, .present = true },
+       [tegra_clk_vcp] = { .dt_id = TEGRA30_CLK_VCP, .present = true },
+       [tegra_clk_bsea] = { .dt_id = TEGRA30_CLK_BSEA, .present = true },
+       [tegra_clk_bsev] = { .dt_id = TEGRA30_CLK_BSEV, .present = true },
+       [tegra_clk_usbd] = { .dt_id = TEGRA30_CLK_USBD, .present = true },
+       [tegra_clk_usb2] = { .dt_id = TEGRA30_CLK_USB2, .present = true },
+       [tegra_clk_usb3] = { .dt_id = TEGRA30_CLK_USB3, .present = true },
+       [tegra_clk_csi] = { .dt_id = TEGRA30_CLK_CSI, .present = true },
+       [tegra_clk_isp] = { .dt_id = TEGRA30_CLK_ISP, .present = true },
+       [tegra_clk_kfuse] = { .dt_id = TEGRA30_CLK_KFUSE, .present = true },
+       [tegra_clk_fuse] = { .dt_id = TEGRA30_CLK_FUSE, .present = true },
+       [tegra_clk_fuse_burn] = { .dt_id = TEGRA30_CLK_FUSE_BURN, .present = true },
+       [tegra_clk_apbif] = { .dt_id = TEGRA30_CLK_APBIF, .present = true },
+       [tegra_clk_hda2hdmi] = { .dt_id = TEGRA30_CLK_HDA2HDMI, .present = true },
+       [tegra_clk_sata_cold] = { .dt_id = TEGRA30_CLK_SATA_COLD, .present = true },
+       [tegra_clk_sata_oob] = { .dt_id = TEGRA30_CLK_SATA_OOB, .present = true },
+       [tegra_clk_sata] = { .dt_id = TEGRA30_CLK_SATA, .present = true },
+       [tegra_clk_dtv] = { .dt_id = TEGRA30_CLK_DTV, .present = true },
+       [tegra_clk_pll_p] = { .dt_id = TEGRA30_CLK_PLL_P, .present = true },
+       [tegra_clk_pll_p_out1] = { .dt_id = TEGRA30_CLK_PLL_P_OUT1, .present = true },
+       [tegra_clk_pll_p_out2] = { .dt_id = TEGRA30_CLK_PLL_P_OUT2, .present = true },
+       [tegra_clk_pll_p_out3] = { .dt_id = TEGRA30_CLK_PLL_P_OUT3, .present = true },
+       [tegra_clk_pll_p_out4] = { .dt_id = TEGRA30_CLK_PLL_P_OUT4, .present = true },
+       [tegra_clk_pll_a] = { .dt_id = TEGRA30_CLK_PLL_A, .present = true },
+       [tegra_clk_pll_a_out0] = { .dt_id = TEGRA30_CLK_PLL_A_OUT0, .present = true },
 
-static struct tegra_clk_periph_regs periph_v_regs = {
-       .enb_reg = CLK_OUT_ENB_V,
-       .enb_set_reg = CLK_OUT_ENB_SET_V,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_V,
-       .rst_reg = RST_DEVICES_V,
-       .rst_set_reg = RST_DEVICES_SET_V,
-       .rst_clr_reg = RST_DEVICES_CLR_V,
 };
 
-static struct tegra_clk_periph_regs periph_w_regs = {
-       .enb_reg = CLK_OUT_ENB_W,
-       .enb_set_reg = CLK_OUT_ENB_SET_W,
-       .enb_clr_reg = CLK_OUT_ENB_CLR_W,
-       .rst_reg = RST_DEVICES_W,
-       .rst_set_reg = RST_DEVICES_SET_W,
-       .rst_clr_reg = RST_DEVICES_CLR_W,
-};
-
-static void tegra30_clk_measure_input_freq(void)
-{
-       u32 osc_ctrl = readl_relaxed(clk_base + OSC_CTRL);
-       u32 auto_clk_control = osc_ctrl & OSC_CTRL_OSC_FREQ_MASK;
-       u32 pll_ref_div = osc_ctrl & OSC_CTRL_PLL_REF_DIV_MASK;
-
-       switch (auto_clk_control) {
-       case OSC_CTRL_OSC_FREQ_12MHZ:
-               BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1);
-               input_freq = 12000000;
-               break;
-       case OSC_CTRL_OSC_FREQ_13MHZ:
-               BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1);
-               input_freq = 13000000;
-               break;
-       case OSC_CTRL_OSC_FREQ_19_2MHZ:
-               BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1);
-               input_freq = 19200000;
-               break;
-       case OSC_CTRL_OSC_FREQ_26MHZ:
-               BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1);
-               input_freq = 26000000;
-               break;
-       case OSC_CTRL_OSC_FREQ_16_8MHZ:
-               BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_1);
-               input_freq = 16800000;
-               break;
-       case OSC_CTRL_OSC_FREQ_38_4MHZ:
-               BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_2);
-               input_freq = 38400000;
-               break;
-       case OSC_CTRL_OSC_FREQ_48MHZ:
-               BUG_ON(pll_ref_div != OSC_CTRL_PLL_REF_DIV_4);
-               input_freq = 48000000;
-               break;
-       default:
-               pr_err("Unexpected auto clock control value %d",
-                       auto_clk_control);
-               BUG();
-               return;
-       }
-}
-
-static unsigned int tegra30_get_pll_ref_div(void)
-{
-       u32 pll_ref_div = readl_relaxed(clk_base + OSC_CTRL) &
-                                       OSC_CTRL_PLL_REF_DIV_MASK;
-
-       switch (pll_ref_div) {
-       case OSC_CTRL_PLL_REF_DIV_1:
-               return 1;
-       case OSC_CTRL_PLL_REF_DIV_2:
-               return 2;
-       case OSC_CTRL_PLL_REF_DIV_4:
-               return 4;
-       default:
-               pr_err("Invalid pll ref divider %d", pll_ref_div);
-               BUG();
-       }
-       return 0;
-}
-
 static void tegra30_utmi_param_configure(void)
 {
        u32 reg;
@@ -863,11 +922,8 @@ static void __init tegra30_pll_init(void)
 
        /* PLLC */
        clk = tegra_clk_register_pll("pll_c", "pll_ref", clk_base, pmc_base, 0,
-                           0, &pll_c_params,
-                           TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
-                           pll_c_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_c", NULL);
-       clks[pll_c] = clk;
+                               &pll_c_params, NULL);
+       clks[TEGRA30_CLK_PLL_C] = clk;
 
        /* PLLC_OUT1 */
        clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c",
@@ -876,73 +932,13 @@ static void __init tegra30_pll_init(void)
        clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div",
                                clk_base + PLLC_OUT, 1, 0, CLK_SET_RATE_PARENT,
                                0, NULL);
-       clk_register_clkdev(clk, "pll_c_out1", NULL);
-       clks[pll_c_out1] = clk;
-
-       /* PLLP */
-       clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base, pmc_base, 0,
-                           408000000, &pll_p_params,
-                           TEGRA_PLL_FIXED | TEGRA_PLL_HAS_CPCON |
-                           TEGRA_PLL_USE_LOCK, pll_p_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_p", NULL);
-       clks[pll_p] = clk;
-
-       /* PLLP_OUT1 */
-       clk = tegra_clk_register_divider("pll_p_out1_div", "pll_p",
-                               clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED |
-                               TEGRA_DIVIDER_ROUND_UP, 8, 8, 1,
-                               &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out1", "pll_p_out1_div",
-                               clk_base + PLLP_OUTA, 1, 0,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out1", NULL);
-       clks[pll_p_out1] = clk;
-
-       /* PLLP_OUT2 */
-       clk = tegra_clk_register_divider("pll_p_out2_div", "pll_p",
-                               clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED |
-                               TEGRA_DIVIDER_ROUND_UP, 24, 8, 1,
-                               &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out2", "pll_p_out2_div",
-                               clk_base + PLLP_OUTA, 17, 16,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out2", NULL);
-       clks[pll_p_out2] = clk;
-
-       /* PLLP_OUT3 */
-       clk = tegra_clk_register_divider("pll_p_out3_div", "pll_p",
-                               clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED |
-                               TEGRA_DIVIDER_ROUND_UP, 8, 8, 1,
-                               &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out3", "pll_p_out3_div",
-                               clk_base + PLLP_OUTB, 1, 0,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out3", NULL);
-       clks[pll_p_out3] = clk;
-
-       /* PLLP_OUT4 */
-       clk = tegra_clk_register_divider("pll_p_out4_div", "pll_p",
-                               clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED |
-                               TEGRA_DIVIDER_ROUND_UP, 24, 8, 1,
-                               &pll_div_lock);
-       clk = tegra_clk_register_pll_out("pll_p_out4", "pll_p_out4_div",
-                               clk_base + PLLP_OUTB, 17, 16,
-                               CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0,
-                               &pll_div_lock);
-       clk_register_clkdev(clk, "pll_p_out4", NULL);
-       clks[pll_p_out4] = clk;
+       clks[TEGRA30_CLK_PLL_C_OUT1] = clk;
 
        /* PLLM */
        clk = tegra_clk_register_pll("pll_m", "pll_ref", clk_base, pmc_base,
-                           CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, 0,
-                           &pll_m_params, TEGRA_PLLM | TEGRA_PLL_HAS_CPCON |
-                           TEGRA_PLL_SET_DCCON | TEGRA_PLL_USE_LOCK,
-                           pll_m_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_m", NULL);
-       clks[pll_m] = clk;
+                           CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE,
+                           &pll_m_params, NULL);
+       clks[TEGRA30_CLK_PLL_M] = clk;
 
        /* PLLM_OUT1 */
        clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m",
@@ -951,78 +947,44 @@ static void __init tegra30_pll_init(void)
        clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div",
                                clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED |
                                CLK_SET_RATE_PARENT, 0, NULL);
-       clk_register_clkdev(clk, "pll_m_out1", NULL);
-       clks[pll_m_out1] = clk;
+       clks[TEGRA30_CLK_PLL_M_OUT1] = clk;
 
        /* PLLX */
        clk = tegra_clk_register_pll("pll_x", "pll_ref", clk_base, pmc_base, 0,
-                           0, &pll_x_params, TEGRA_PLL_HAS_CPCON |
-                           TEGRA_PLL_SET_DCCON | TEGRA_PLL_USE_LOCK,
-                           pll_x_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_x", NULL);
-       clks[pll_x] = clk;
+                           &pll_x_params, NULL);
+       clks[TEGRA30_CLK_PLL_X] = clk;
 
        /* PLLX_OUT0 */
        clk = clk_register_fixed_factor(NULL, "pll_x_out0", "pll_x",
                                        CLK_SET_RATE_PARENT, 1, 2);
-       clk_register_clkdev(clk, "pll_x_out0", NULL);
-       clks[pll_x_out0] = clk;
+       clks[TEGRA30_CLK_PLL_X_OUT0] = clk;
 
        /* PLLU */
        clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc_base, 0,
-                           0, &pll_u_params, TEGRA_PLLU | TEGRA_PLL_HAS_CPCON |
-                           TEGRA_PLL_SET_LFCON,
-                           pll_u_freq_table,
-                           NULL);
-       clk_register_clkdev(clk, "pll_u", NULL);
-       clks[pll_u] = clk;
+                           &pll_u_params, NULL);
+       clks[TEGRA30_CLK_PLL_U] = clk;
 
        tegra30_utmi_param_configure();
 
        /* PLLD */
        clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc_base, 0,
-                           0, &pll_d_params, TEGRA_PLL_HAS_CPCON |
-                           TEGRA_PLL_SET_LFCON | TEGRA_PLL_USE_LOCK,
-                           pll_d_freq_table, &pll_d_lock);
-       clk_register_clkdev(clk, "pll_d", NULL);
-       clks[pll_d] = clk;
+                           &pll_d_params, &pll_d_lock);
+       clks[TEGRA30_CLK_PLL_D] = clk;
 
        /* PLLD_OUT0 */
        clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d",
                                        CLK_SET_RATE_PARENT, 1, 2);
-       clk_register_clkdev(clk, "pll_d_out0", NULL);
-       clks[pll_d_out0] = clk;
+       clks[TEGRA30_CLK_PLL_D_OUT0] = clk;
 
        /* PLLD2 */
        clk = tegra_clk_register_pll("pll_d2", "pll_ref", clk_base, pmc_base, 0,
-                           0, &pll_d2_params, TEGRA_PLL_HAS_CPCON |
-                           TEGRA_PLL_SET_LFCON | TEGRA_PLL_USE_LOCK,
-                           pll_d_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_d2", NULL);
-       clks[pll_d2] = clk;
+                           &pll_d2_params, NULL);
+       clks[TEGRA30_CLK_PLL_D2] = clk;
 
        /* PLLD2_OUT0 */
        clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2",
                                        CLK_SET_RATE_PARENT, 1, 2);
-       clk_register_clkdev(clk, "pll_d2_out0", NULL);
-       clks[pll_d2_out0] = clk;
-
-       /* PLLA */
-       clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, pmc_base,
-                           0, 0, &pll_a_params, TEGRA_PLL_HAS_CPCON |
-                           TEGRA_PLL_USE_LOCK, pll_a_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_a", NULL);
-       clks[pll_a] = clk;
-
-       /* PLLA_OUT0 */
-       clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a",
-                               clk_base + PLLA_OUT, 0, TEGRA_DIVIDER_ROUND_UP,
-                               8, 8, 1, NULL);
-       clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div",
-                               clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED |
-                               CLK_SET_RATE_PARENT, 0, NULL);
-       clk_register_clkdev(clk, "pll_a_out0", NULL);
-       clks[pll_a_out0] = clk;
+       clks[TEGRA30_CLK_PLL_D2_OUT0] = clk;
 
        /* PLLE */
        clk = clk_register_mux(NULL, "pll_e_mux", pll_e_parents,
@@ -1030,258 +992,8 @@ static void __init tegra30_pll_init(void)
                               CLK_SET_RATE_NO_REPARENT,
                               clk_base + PLLE_AUX, 2, 1, 0, NULL);
        clk = tegra_clk_register_plle("pll_e", "pll_e_mux", clk_base, pmc_base,
-                            CLK_GET_RATE_NOCACHE, 100000000, &pll_e_params,
-                            TEGRA_PLLE_CONFIGURE, pll_e_freq_table, NULL);
-       clk_register_clkdev(clk, "pll_e", NULL);
-       clks[pll_e] = clk;
-}
-
-static const char *mux_audio_sync_clk[] = { "spdif_in_sync", "i2s0_sync",
-       "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync",};
-static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2",
-                                         "clk_m_div4", "extern1", };
-static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2",
-                                         "clk_m_div4", "extern2", };
-static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2",
-                                         "clk_m_div4", "extern3", };
-
-static void __init tegra30_audio_clk_init(void)
-{
-       struct clk *clk;
-
-       /* spdif_in_sync */
-       clk = tegra_clk_register_sync_source("spdif_in_sync", 24000000,
-                                            24000000);
-       clk_register_clkdev(clk, "spdif_in_sync", NULL);
-       clks[spdif_in_sync] = clk;
-
-       /* i2s0_sync */
-       clk = tegra_clk_register_sync_source("i2s0_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "i2s0_sync", NULL);
-       clks[i2s0_sync] = clk;
-
-       /* i2s1_sync */
-       clk = tegra_clk_register_sync_source("i2s1_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "i2s1_sync", NULL);
-       clks[i2s1_sync] = clk;
-
-       /* i2s2_sync */
-       clk = tegra_clk_register_sync_source("i2s2_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "i2s2_sync", NULL);
-       clks[i2s2_sync] = clk;
-
-       /* i2s3_sync */
-       clk = tegra_clk_register_sync_source("i2s3_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "i2s3_sync", NULL);
-       clks[i2s3_sync] = clk;
-
-       /* i2s4_sync */
-       clk = tegra_clk_register_sync_source("i2s4_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "i2s4_sync", NULL);
-       clks[i2s4_sync] = clk;
-
-       /* vimclk_sync */
-       clk = tegra_clk_register_sync_source("vimclk_sync", 24000000, 24000000);
-       clk_register_clkdev(clk, "vimclk_sync", NULL);
-       clks[vimclk_sync] = clk;
-
-       /* audio0 */
-       clk = clk_register_mux(NULL, "audio0_mux", mux_audio_sync_clk,
-                               ARRAY_SIZE(mux_audio_sync_clk),
-                               CLK_SET_RATE_NO_REPARENT,
-                               clk_base + AUDIO_SYNC_CLK_I2S0, 0, 3, 0, NULL);
-       clk = clk_register_gate(NULL, "audio0", "audio0_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_I2S0, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "audio0", NULL);
-       clks[audio0] = clk;
-
-       /* audio1 */
-       clk = clk_register_mux(NULL, "audio1_mux", mux_audio_sync_clk,
-                               ARRAY_SIZE(mux_audio_sync_clk),
-                               CLK_SET_RATE_NO_REPARENT,
-                               clk_base + AUDIO_SYNC_CLK_I2S1, 0, 3, 0, NULL);
-       clk = clk_register_gate(NULL, "audio1", "audio1_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_I2S1, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "audio1", NULL);
-       clks[audio1] = clk;
-
-       /* audio2 */
-       clk = clk_register_mux(NULL, "audio2_mux", mux_audio_sync_clk,
-                               ARRAY_SIZE(mux_audio_sync_clk),
-                               CLK_SET_RATE_NO_REPARENT,
-                               clk_base + AUDIO_SYNC_CLK_I2S2, 0, 3, 0, NULL);
-       clk = clk_register_gate(NULL, "audio2", "audio2_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_I2S2, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "audio2", NULL);
-       clks[audio2] = clk;
-
-       /* audio3 */
-       clk = clk_register_mux(NULL, "audio3_mux", mux_audio_sync_clk,
-                               ARRAY_SIZE(mux_audio_sync_clk),
-                               CLK_SET_RATE_NO_REPARENT,
-                               clk_base + AUDIO_SYNC_CLK_I2S3, 0, 3, 0, NULL);
-       clk = clk_register_gate(NULL, "audio3", "audio3_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_I2S3, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "audio3", NULL);
-       clks[audio3] = clk;
-
-       /* audio4 */
-       clk = clk_register_mux(NULL, "audio4_mux", mux_audio_sync_clk,
-                               ARRAY_SIZE(mux_audio_sync_clk),
-                               CLK_SET_RATE_NO_REPARENT,
-                               clk_base + AUDIO_SYNC_CLK_I2S4, 0, 3, 0, NULL);
-       clk = clk_register_gate(NULL, "audio4", "audio4_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_I2S4, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "audio4", NULL);
-       clks[audio4] = clk;
-
-       /* spdif */
-       clk = clk_register_mux(NULL, "spdif_mux", mux_audio_sync_clk,
-                               ARRAY_SIZE(mux_audio_sync_clk),
-                               CLK_SET_RATE_NO_REPARENT,
-                               clk_base + AUDIO_SYNC_CLK_SPDIF, 0, 3, 0, NULL);
-       clk = clk_register_gate(NULL, "spdif", "spdif_mux", 0,
-                               clk_base + AUDIO_SYNC_CLK_SPDIF, 4,
-                               CLK_GATE_SET_TO_DISABLE, NULL);
-       clk_register_clkdev(clk, "spdif", NULL);
-       clks[spdif] = clk;
-
-       /* audio0_2x */
-       clk = clk_register_fixed_factor(NULL, "audio0_doubler", "audio0",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("audio0_div", "audio0_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 24, 1, 0,
-                               &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("audio0_2x", "audio0_div",
-                                   TEGRA_PERIPH_NO_RESET, clk_base,
-                                   CLK_SET_RATE_PARENT, 113, &periph_v_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "audio0_2x", NULL);
-       clks[audio0_2x] = clk;
-
-       /* audio1_2x */
-       clk = clk_register_fixed_factor(NULL, "audio1_doubler", "audio1",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("audio1_div", "audio1_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 25, 1, 0,
-                               &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("audio1_2x", "audio1_div",
-                                   TEGRA_PERIPH_NO_RESET, clk_base,
-                                   CLK_SET_RATE_PARENT, 114, &periph_v_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "audio1_2x", NULL);
-       clks[audio1_2x] = clk;
-
-       /* audio2_2x */
-       clk = clk_register_fixed_factor(NULL, "audio2_doubler", "audio2",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("audio2_div", "audio2_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 26, 1, 0,
-                               &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("audio2_2x", "audio2_div",
-                                   TEGRA_PERIPH_NO_RESET, clk_base,
-                                   CLK_SET_RATE_PARENT, 115, &periph_v_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "audio2_2x", NULL);
-       clks[audio2_2x] = clk;
-
-       /* audio3_2x */
-       clk = clk_register_fixed_factor(NULL, "audio3_doubler", "audio3",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("audio3_div", "audio3_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 27, 1, 0,
-                               &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("audio3_2x", "audio3_div",
-                                   TEGRA_PERIPH_NO_RESET, clk_base,
-                                   CLK_SET_RATE_PARENT, 116, &periph_v_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "audio3_2x", NULL);
-       clks[audio3_2x] = clk;
-
-       /* audio4_2x */
-       clk = clk_register_fixed_factor(NULL, "audio4_doubler", "audio4",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("audio4_div", "audio4_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 28, 1, 0,
-                               &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("audio4_2x", "audio4_div",
-                                   TEGRA_PERIPH_NO_RESET, clk_base,
-                                   CLK_SET_RATE_PARENT, 117, &periph_v_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "audio4_2x", NULL);
-       clks[audio4_2x] = clk;
-
-       /* spdif_2x */
-       clk = clk_register_fixed_factor(NULL, "spdif_doubler", "spdif",
-                                       CLK_SET_RATE_PARENT, 2, 1);
-       clk = tegra_clk_register_divider("spdif_div", "spdif_doubler",
-                               clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 29, 1, 0,
-                               &clk_doubler_lock);
-       clk = tegra_clk_register_periph_gate("spdif_2x", "spdif_div",
-                                   TEGRA_PERIPH_NO_RESET, clk_base,
-                                   CLK_SET_RATE_PARENT, 118, &periph_v_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "spdif_2x", NULL);
-       clks[spdif_2x] = clk;
-}
-
-static void __init tegra30_pmc_clk_init(void)
-{
-       struct clk *clk;
-
-       /* clk_out_1 */
-       clk = clk_register_mux(NULL, "clk_out_1_mux", clk_out1_parents,
-                              ARRAY_SIZE(clk_out1_parents),
-                              CLK_SET_RATE_NO_REPARENT,
-                              pmc_base + PMC_CLK_OUT_CNTRL, 6, 3, 0,
-                              &clk_out_lock);
-       clks[clk_out_1_mux] = clk;
-       clk = clk_register_gate(NULL, "clk_out_1", "clk_out_1_mux", 0,
-                               pmc_base + PMC_CLK_OUT_CNTRL, 2, 0,
-                               &clk_out_lock);
-       clk_register_clkdev(clk, "extern1", "clk_out_1");
-       clks[clk_out_1] = clk;
-
-       /* clk_out_2 */
-       clk = clk_register_mux(NULL, "clk_out_2_mux", clk_out2_parents,
-                              ARRAY_SIZE(clk_out2_parents),
-                              CLK_SET_RATE_NO_REPARENT,
-                              pmc_base + PMC_CLK_OUT_CNTRL, 14, 3, 0,
-                              &clk_out_lock);
-       clk = clk_register_gate(NULL, "clk_out_2", "clk_out_2_mux", 0,
-                               pmc_base + PMC_CLK_OUT_CNTRL, 10, 0,
-                               &clk_out_lock);
-       clk_register_clkdev(clk, "extern2", "clk_out_2");
-       clks[clk_out_2] = clk;
-
-       /* clk_out_3 */
-       clk = clk_register_mux(NULL, "clk_out_3_mux", clk_out3_parents,
-                              ARRAY_SIZE(clk_out3_parents),
-                              CLK_SET_RATE_NO_REPARENT,
-                              pmc_base + PMC_CLK_OUT_CNTRL, 22, 3, 0,
-                              &clk_out_lock);
-       clk = clk_register_gate(NULL, "clk_out_3", "clk_out_3_mux", 0,
-                               pmc_base + PMC_CLK_OUT_CNTRL, 18, 0,
-                               &clk_out_lock);
-       clk_register_clkdev(clk, "extern3", "clk_out_3");
-       clks[clk_out_3] = clk;
-
-       /* blink */
-       writel_relaxed(0, pmc_base + PMC_BLINK_TIMER);
-       clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0,
-                               pmc_base + PMC_DPD_PADS_ORIDE,
-                               PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL);
-       clk = clk_register_gate(NULL, "blink", "blink_override", 0,
-                               pmc_base + PMC_CTRL,
-                               PMC_CTRL_BLINK_ENB, 0, NULL);
-       clk_register_clkdev(clk, "blink", NULL);
-       clks[blink] = clk;
-
+                            CLK_GET_RATE_NOCACHE, &pll_e_params, NULL);
+       clks[TEGRA30_CLK_PLL_E] = clk;
 }
 
 static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m",
@@ -1332,8 +1044,7 @@ static void __init tegra30_super_clk_init(void)
                                  CLK_SET_RATE_PARENT,
                                  clk_base + CCLKG_BURST_POLICY,
                                  0, 4, 0, 0, NULL);
-       clk_register_clkdev(clk, "cclk_g", NULL);
-       clks[cclk_g] = clk;
+       clks[TEGRA30_CLK_CCLK_G] = clk;
 
        /*
         * Clock input to cclk_lp divided from pll_p using
@@ -1369,8 +1080,7 @@ static void __init tegra30_super_clk_init(void)
                                  clk_base + CCLKLP_BURST_POLICY,
                                  TEGRA_DIVIDER_2, 4, 8, 9,
                              NULL);
-       clk_register_clkdev(clk, "cclk_lp", NULL);
-       clks[cclk_lp] = clk;
+       clks[TEGRA30_CLK_CCLK_LP] = clk;
 
        /* SCLK */
        clk = tegra_clk_register_super_mux("sclk", sclk_parents,
@@ -1378,142 +1088,44 @@ static void __init tegra30_super_clk_init(void)
                                  CLK_SET_RATE_PARENT,
                                  clk_base + SCLK_BURST_POLICY,
                                  0, 4, 0, 0, NULL);
-       clk_register_clkdev(clk, "sclk", NULL);
-       clks[sclk] = clk;
-
-       /* HCLK */
-       clk = clk_register_divider(NULL, "hclk_div", "sclk", 0,
-                                  clk_base + SYSTEM_CLK_RATE, 4, 2, 0,
-                                  &sysrate_lock);
-       clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT,
-                               clk_base + SYSTEM_CLK_RATE, 7,
-                               CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
-       clk_register_clkdev(clk, "hclk", NULL);
-       clks[hclk] = clk;
-
-       /* PCLK */
-       clk = clk_register_divider(NULL, "pclk_div", "hclk", 0,
-                                  clk_base + SYSTEM_CLK_RATE, 0, 2, 0,
-                                  &sysrate_lock);
-       clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT,
-                               clk_base + SYSTEM_CLK_RATE, 3,
-                               CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
-       clk_register_clkdev(clk, "pclk", NULL);
-       clks[pclk] = clk;
+       clks[TEGRA30_CLK_SCLK] = clk;
 
        /* twd */
        clk = clk_register_fixed_factor(NULL, "twd", "cclk_g",
                                        CLK_SET_RATE_PARENT, 1, 2);
-       clk_register_clkdev(clk, "twd", NULL);
-       clks[twd] = clk;
+       clks[TEGRA30_CLK_TWD] = clk;
+
+       tegra_super_clk_gen4_init(clk_base, pmc_base, tegra30_clks, NULL);
 }
 
 static const char *mux_pllacp_clkm[] = { "pll_a_out0", "unused", "pll_p",
                                         "clk_m" };
 static const char *mux_pllpcm_clkm[] = { "pll_p", "pll_c", "pll_m", "clk_m" };
 static const char *mux_pllmcp_clkm[] = { "pll_m", "pll_c", "pll_p", "clk_m" };
-static const char *i2s0_parents[] = { "pll_a_out0", "audio0_2x", "pll_p",
-                                     "clk_m" };
-static const char *i2s1_parents[] = { "pll_a_out0", "audio1_2x", "pll_p",
-                                     "clk_m" };
-static const char *i2s2_parents[] = { "pll_a_out0", "audio2_2x", "pll_p",
-                                     "clk_m" };
-static const char *i2s3_parents[] = { "pll_a_out0", "audio3_2x", "pll_p",
-                                     "clk_m" };
-static const char *i2s4_parents[] = { "pll_a_out0", "audio4_2x", "pll_p",
-                                     "clk_m" };
 static const char *spdif_out_parents[] = { "pll_a_out0", "spdif_2x", "pll_p",
                                           "clk_m" };
-static const char *spdif_in_parents[] = { "pll_p", "pll_c", "pll_m" };
-static const char *mux_pllpc_clk32k_clkm[] = { "pll_p", "pll_c", "clk_32k",
-                                              "clk_m" };
-static const char *mux_pllpc_clkm_clk32k[] = { "pll_p", "pll_c", "clk_m",
-                                              "clk_32k" };
 static const char *mux_pllmcpa[] = { "pll_m", "pll_c", "pll_p", "pll_a_out0" };
-static const char *mux_pllpdc_clkm[] = { "pll_p", "pll_d_out0", "pll_c",
-                                        "clk_m" };
-static const char *mux_pllp_clkm[] = { "pll_p", "unused", "unused", "clk_m" };
 static const char *mux_pllpmdacd2_clkm[] = { "pll_p", "pll_m", "pll_d_out0",
                                             "pll_a_out0", "pll_c",
                                             "pll_d2_out0", "clk_m" };
-static const char *mux_plla_clk32k_pllp_clkm_plle[] = { "pll_a_out0",
-                                                       "clk_32k", "pll_p",
-                                                       "clk_m", "pll_e" };
 static const char *mux_plld_out0_plld2_out0[] = { "pll_d_out0",
                                                  "pll_d2_out0" };
+static const char *pwm_parents[] = { "pll_p", "pll_c", "clk_32k", "clk_m" };
 
 static struct tegra_periph_init_data tegra_periph_clk_list[] = {
-       TEGRA_INIT_DATA_MUX("i2s0",     NULL,           "tegra30-i2s.0",        i2s0_parents,           CLK_SOURCE_I2S0,        30,     &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s0),
-       TEGRA_INIT_DATA_MUX("i2s1",     NULL,           "tegra30-i2s.1",        i2s1_parents,           CLK_SOURCE_I2S1,        11,     &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s1),
-       TEGRA_INIT_DATA_MUX("i2s2",     NULL,           "tegra30-i2s.2",        i2s2_parents,           CLK_SOURCE_I2S2,        18,     &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s2),
-       TEGRA_INIT_DATA_MUX("i2s3",     NULL,           "tegra30-i2s.3",        i2s3_parents,           CLK_SOURCE_I2S3,        101,    &periph_v_regs, TEGRA_PERIPH_ON_APB, i2s3),
-       TEGRA_INIT_DATA_MUX("i2s4",     NULL,           "tegra30-i2s.4",        i2s4_parents,           CLK_SOURCE_I2S4,        102,    &periph_v_regs, TEGRA_PERIPH_ON_APB, i2s4),
-       TEGRA_INIT_DATA_MUX("spdif_out", "spdif_out",   "tegra30-spdif",        spdif_out_parents,      CLK_SOURCE_SPDIF_OUT,   10,     &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_out),
-       TEGRA_INIT_DATA_MUX("spdif_in", "spdif_in",     "tegra30-spdif",        spdif_in_parents,       CLK_SOURCE_SPDIF_IN,    10,     &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_in),
-       TEGRA_INIT_DATA_MUX("d_audio",  "d_audio",      "tegra30-ahub",         mux_pllacp_clkm,        CLK_SOURCE_D_AUDIO,     106,    &periph_v_regs, 0, d_audio),
-       TEGRA_INIT_DATA_MUX("dam0",     NULL,           "tegra30-dam.0",        mux_pllacp_clkm,        CLK_SOURCE_DAM0,        108,    &periph_v_regs, 0, dam0),
-       TEGRA_INIT_DATA_MUX("dam1",     NULL,           "tegra30-dam.1",        mux_pllacp_clkm,        CLK_SOURCE_DAM1,        109,    &periph_v_regs, 0, dam1),
-       TEGRA_INIT_DATA_MUX("dam2",     NULL,           "tegra30-dam.2",        mux_pllacp_clkm,        CLK_SOURCE_DAM2,        110,    &periph_v_regs, 0, dam2),
-       TEGRA_INIT_DATA_MUX("hda",      "hda",          "tegra30-hda",          mux_pllpcm_clkm,        CLK_SOURCE_HDA,         125,    &periph_v_regs, 0, hda),
-       TEGRA_INIT_DATA_MUX("hda2codec_2x", "hda2codec", "tegra30-hda",         mux_pllpcm_clkm,        CLK_SOURCE_HDA2CODEC_2X, 111,   &periph_v_regs, 0, hda2codec_2x),
-       TEGRA_INIT_DATA_MUX("sbc1",     NULL,           "spi_tegra.0",          mux_pllpcm_clkm,        CLK_SOURCE_SBC1,        41,     &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc1),
-       TEGRA_INIT_DATA_MUX("sbc2",     NULL,           "spi_tegra.1",          mux_pllpcm_clkm,        CLK_SOURCE_SBC2,        44,     &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc2),
-       TEGRA_INIT_DATA_MUX("sbc3",     NULL,           "spi_tegra.2",          mux_pllpcm_clkm,        CLK_SOURCE_SBC3,        46,     &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc3),
-       TEGRA_INIT_DATA_MUX("sbc4",     NULL,           "spi_tegra.3",          mux_pllpcm_clkm,        CLK_SOURCE_SBC4,        68,     &periph_u_regs, TEGRA_PERIPH_ON_APB, sbc4),
-       TEGRA_INIT_DATA_MUX("sbc5",     NULL,           "spi_tegra.4",          mux_pllpcm_clkm,        CLK_SOURCE_SBC5,        104,    &periph_v_regs, TEGRA_PERIPH_ON_APB, sbc5),
-       TEGRA_INIT_DATA_MUX("sbc6",     NULL,           "spi_tegra.5",          mux_pllpcm_clkm,        CLK_SOURCE_SBC6,        105,    &periph_v_regs, TEGRA_PERIPH_ON_APB, sbc6),
-       TEGRA_INIT_DATA_MUX("sata_oob", NULL,           "tegra_sata_oob",       mux_pllpcm_clkm,        CLK_SOURCE_SATA_OOB,    123,    &periph_v_regs, TEGRA_PERIPH_ON_APB, sata_oob),
-       TEGRA_INIT_DATA_MUX("sata",     NULL,           "tegra_sata",           mux_pllpcm_clkm,        CLK_SOURCE_SATA,        124,    &periph_v_regs, TEGRA_PERIPH_ON_APB, sata),
-       TEGRA_INIT_DATA_MUX("ndflash",  NULL,           "tegra_nand",           mux_pllpcm_clkm,        CLK_SOURCE_NDFLASH,     13,     &periph_l_regs, TEGRA_PERIPH_ON_APB, ndflash),
-       TEGRA_INIT_DATA_MUX("ndspeed",  NULL,           "tegra_nand_speed",     mux_pllpcm_clkm,        CLK_SOURCE_NDSPEED,     80,     &periph_u_regs, TEGRA_PERIPH_ON_APB, ndspeed),
-       TEGRA_INIT_DATA_MUX("vfir",     NULL,           "vfir",                 mux_pllpcm_clkm,        CLK_SOURCE_VFIR,        7,      &periph_l_regs, TEGRA_PERIPH_ON_APB, vfir),
-       TEGRA_INIT_DATA_MUX("csite",    NULL,           "csite",                mux_pllpcm_clkm,        CLK_SOURCE_CSITE,       73,     &periph_u_regs, TEGRA_PERIPH_ON_APB, csite),
-       TEGRA_INIT_DATA_MUX("la",       NULL,           "la",                   mux_pllpcm_clkm,        CLK_SOURCE_LA,          76,     &periph_u_regs, TEGRA_PERIPH_ON_APB, la),
-       TEGRA_INIT_DATA_MUX("owr",      NULL,           "tegra_w1",             mux_pllpcm_clkm,        CLK_SOURCE_OWR,         71,     &periph_u_regs, TEGRA_PERIPH_ON_APB, owr),
-       TEGRA_INIT_DATA_MUX("mipi",     NULL,           "mipi",                 mux_pllpcm_clkm,        CLK_SOURCE_MIPI,        50,     &periph_h_regs, TEGRA_PERIPH_ON_APB, mipi),
-       TEGRA_INIT_DATA_MUX("tsensor",  NULL,           "tegra-tsensor",        mux_pllpc_clkm_clk32k,  CLK_SOURCE_TSENSOR,     100,    &periph_v_regs, TEGRA_PERIPH_ON_APB, tsensor),
-       TEGRA_INIT_DATA_MUX("i2cslow",  NULL,           "i2cslow",              mux_pllpc_clk32k_clkm,  CLK_SOURCE_I2CSLOW,     81,     &periph_u_regs, TEGRA_PERIPH_ON_APB, i2cslow),
-       TEGRA_INIT_DATA_INT("vde",      NULL,           "vde",                  mux_pllpcm_clkm,        CLK_SOURCE_VDE,         61,     &periph_h_regs, 0, vde),
-       TEGRA_INIT_DATA_INT("vi",       "vi",           "tegra_camera",         mux_pllmcpa,            CLK_SOURCE_VI,          20,     &periph_l_regs, 0, vi),
-       TEGRA_INIT_DATA_INT("epp",      NULL,           "epp",                  mux_pllmcpa,            CLK_SOURCE_EPP,         19,     &periph_l_regs, 0, epp),
-       TEGRA_INIT_DATA_INT("mpe",      NULL,           "mpe",                  mux_pllmcpa,            CLK_SOURCE_MPE,         60,     &periph_h_regs, 0, mpe),
-       TEGRA_INIT_DATA_INT("host1x",   NULL,           "host1x",               mux_pllmcpa,            CLK_SOURCE_HOST1X,      28,     &periph_l_regs, 0, host1x),
-       TEGRA_INIT_DATA_INT("3d",       NULL,           "3d",                   mux_pllmcpa,            CLK_SOURCE_3D,          24,     &periph_l_regs, TEGRA_PERIPH_MANUAL_RESET, gr3d),
-       TEGRA_INIT_DATA_INT("3d2",      NULL,           "3d2",                  mux_pllmcpa,            CLK_SOURCE_3D2,         98,     &periph_v_regs, TEGRA_PERIPH_MANUAL_RESET, gr3d2),
-       TEGRA_INIT_DATA_INT("2d",       NULL,           "2d",                   mux_pllmcpa,            CLK_SOURCE_2D,          21,     &periph_l_regs, 0, gr2d),
-       TEGRA_INIT_DATA_INT("se",       NULL,           "se",                   mux_pllpcm_clkm,        CLK_SOURCE_SE,          127,    &periph_v_regs, 0, se),
-       TEGRA_INIT_DATA_MUX("mselect",  NULL,           "mselect",              mux_pllp_clkm,          CLK_SOURCE_MSELECT,     99,     &periph_v_regs, 0, mselect),
-       TEGRA_INIT_DATA_MUX("nor",      NULL,           "tegra-nor",            mux_pllpcm_clkm,        CLK_SOURCE_NOR,         42,     &periph_h_regs, 0, nor),
-       TEGRA_INIT_DATA_MUX("sdmmc1",   NULL,           "sdhci-tegra.0",        mux_pllpcm_clkm,        CLK_SOURCE_SDMMC1,      14,     &periph_l_regs, 0, sdmmc1),
-       TEGRA_INIT_DATA_MUX("sdmmc2",   NULL,           "sdhci-tegra.1",        mux_pllpcm_clkm,        CLK_SOURCE_SDMMC2,      9,      &periph_l_regs, 0, sdmmc2),
-       TEGRA_INIT_DATA_MUX("sdmmc3",   NULL,           "sdhci-tegra.2",        mux_pllpcm_clkm,        CLK_SOURCE_SDMMC3,      69,     &periph_u_regs, 0, sdmmc3),
-       TEGRA_INIT_DATA_MUX("sdmmc4",   NULL,           "sdhci-tegra.3",        mux_pllpcm_clkm,        CLK_SOURCE_SDMMC4,      15,     &periph_l_regs, 0, sdmmc4),
-       TEGRA_INIT_DATA_MUX("cve",      NULL,           "cve",                  mux_pllpdc_clkm,        CLK_SOURCE_CVE,         49,     &periph_h_regs, 0, cve),
-       TEGRA_INIT_DATA_MUX("tvo",      NULL,           "tvo",                  mux_pllpdc_clkm,        CLK_SOURCE_TVO,         49,     &periph_h_regs, 0, tvo),
-       TEGRA_INIT_DATA_MUX("tvdac",    NULL,           "tvdac",                mux_pllpdc_clkm,        CLK_SOURCE_TVDAC,       53,     &periph_h_regs, 0, tvdac),
-       TEGRA_INIT_DATA_MUX("actmon",   NULL,           "actmon",               mux_pllpc_clk32k_clkm,  CLK_SOURCE_ACTMON,      119,    &periph_v_regs, 0, actmon),
-       TEGRA_INIT_DATA_MUX("vi_sensor", "vi_sensor",   "tegra_camera",         mux_pllmcpa,            CLK_SOURCE_VI_SENSOR,   20,     &periph_l_regs, TEGRA_PERIPH_NO_RESET, vi_sensor),
-       TEGRA_INIT_DATA_DIV16("i2c1",   "div-clk",      "tegra-i2c.0",          mux_pllp_clkm,          CLK_SOURCE_I2C1,        12,     &periph_l_regs, TEGRA_PERIPH_ON_APB, i2c1),
-       TEGRA_INIT_DATA_DIV16("i2c2",   "div-clk",      "tegra-i2c.1",          mux_pllp_clkm,          CLK_SOURCE_I2C2,        54,     &periph_h_regs, TEGRA_PERIPH_ON_APB, i2c2),
-       TEGRA_INIT_DATA_DIV16("i2c3",   "div-clk",      "tegra-i2c.2",          mux_pllp_clkm,          CLK_SOURCE_I2C3,        67,     &periph_u_regs, TEGRA_PERIPH_ON_APB, i2c3),
-       TEGRA_INIT_DATA_DIV16("i2c4",   "div-clk",      "tegra-i2c.3",          mux_pllp_clkm,          CLK_SOURCE_I2C4,        103,    &periph_v_regs, TEGRA_PERIPH_ON_APB, i2c4),
-       TEGRA_INIT_DATA_DIV16("i2c5",   "div-clk",      "tegra-i2c.4",          mux_pllp_clkm,          CLK_SOURCE_I2C5,        47,     &periph_h_regs, TEGRA_PERIPH_ON_APB, i2c5),
-       TEGRA_INIT_DATA_UART("uarta",   NULL,           "tegra_uart.0",         mux_pllpcm_clkm,        CLK_SOURCE_UARTA,       6,      &periph_l_regs, uarta),
-       TEGRA_INIT_DATA_UART("uartb",   NULL,           "tegra_uart.1",         mux_pllpcm_clkm,        CLK_SOURCE_UARTB,       7,      &periph_l_regs, uartb),
-       TEGRA_INIT_DATA_UART("uartc",   NULL,           "tegra_uart.2",         mux_pllpcm_clkm,        CLK_SOURCE_UARTC,       55,     &periph_h_regs, uartc),
-       TEGRA_INIT_DATA_UART("uartd",   NULL,           "tegra_uart.3",         mux_pllpcm_clkm,        CLK_SOURCE_UARTD,       65,     &periph_u_regs, uartd),
-       TEGRA_INIT_DATA_UART("uarte",   NULL,           "tegra_uart.4",         mux_pllpcm_clkm,        CLK_SOURCE_UARTE,       66,     &periph_u_regs, uarte),
-       TEGRA_INIT_DATA_MUX8("hdmi",    NULL,           "hdmi",                 mux_pllpmdacd2_clkm,    CLK_SOURCE_HDMI,        51,     &periph_h_regs, 0, hdmi),
-       TEGRA_INIT_DATA_MUX8("extern1", NULL,           "extern1",              mux_plla_clk32k_pllp_clkm_plle, CLK_SOURCE_EXTERN1,     120,    &periph_v_regs, 0, extern1),
-       TEGRA_INIT_DATA_MUX8("extern2", NULL,           "extern2",              mux_plla_clk32k_pllp_clkm_plle, CLK_SOURCE_EXTERN2,     121,    &periph_v_regs, 0, extern2),
-       TEGRA_INIT_DATA_MUX8("extern3", NULL,           "extern3",              mux_plla_clk32k_pllp_clkm_plle, CLK_SOURCE_EXTERN3,     122,    &periph_v_regs, 0, extern3),
-       TEGRA_INIT_DATA("pwm",          NULL,           "pwm",                  mux_pllpc_clk32k_clkm,  CLK_SOURCE_PWM,         28, 2, 0, 0, 8, 1, 0, &periph_l_regs, 17, periph_clk_enb_refcnt, 0, pwm),
+       TEGRA_INIT_DATA_MUX("spdif_out", spdif_out_parents, CLK_SOURCE_SPDIF_OUT, 10, TEGRA_PERIPH_ON_APB, TEGRA30_CLK_SPDIF_OUT),
+       TEGRA_INIT_DATA_MUX("d_audio", mux_pllacp_clkm, CLK_SOURCE_D_AUDIO, 106, 0, TEGRA30_CLK_D_AUDIO),
+       TEGRA_INIT_DATA_MUX("dam0", mux_pllacp_clkm, CLK_SOURCE_DAM0, 108, 0, TEGRA30_CLK_DAM0),
+       TEGRA_INIT_DATA_MUX("dam1", mux_pllacp_clkm, CLK_SOURCE_DAM1, 109, 0, TEGRA30_CLK_DAM1),
+       TEGRA_INIT_DATA_MUX("dam2", mux_pllacp_clkm, CLK_SOURCE_DAM2, 110, 0, TEGRA30_CLK_DAM2),
+       TEGRA_INIT_DATA_INT("3d2", mux_pllmcpa, CLK_SOURCE_3D2, 98, TEGRA_PERIPH_MANUAL_RESET, TEGRA30_CLK_GR3D2),
+       TEGRA_INIT_DATA_INT("se", mux_pllpcm_clkm, CLK_SOURCE_SE, 127, 0, TEGRA30_CLK_SE),
+       TEGRA_INIT_DATA_MUX8("hdmi", mux_pllpmdacd2_clkm, CLK_SOURCE_HDMI, 51, 0, TEGRA30_CLK_HDMI),
+       TEGRA_INIT_DATA("pwm", NULL, NULL, pwm_parents, CLK_SOURCE_PWM, 28, 2, 0, 0, 8, 1, 0, 17, TEGRA_PERIPH_ON_APB, TEGRA30_CLK_PWM),
 };
 
 static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = {
-       TEGRA_INIT_DATA_NODIV("disp1",  NULL, "tegradc.0", mux_pllpmdacd2_clkm,      CLK_SOURCE_DISP1,  29, 3, 27, &periph_l_regs, 0, disp1),
-       TEGRA_INIT_DATA_NODIV("disp2",  NULL, "tegradc.1", mux_pllpmdacd2_clkm,      CLK_SOURCE_DISP2,  29, 3, 26, &periph_l_regs, 0, disp2),
-       TEGRA_INIT_DATA_NODIV("dsib",   NULL, "tegradc.1", mux_plld_out0_plld2_out0, CLK_SOURCE_DSIB,   25, 1, 82, &periph_u_regs, 0, dsib),
+       TEGRA_INIT_DATA_NODIV("dsib", mux_plld_out0_plld2_out0, CLK_SOURCE_DSIB, 25, 1, 82, 0, TEGRA30_CLK_DSIB),
 };
 
 static void __init tegra30_periph_clk_init(void)
@@ -1522,170 +1134,20 @@ static void __init tegra30_periph_clk_init(void)
        struct clk *clk;
        int i;
 
-       /* apbdma */
-       clk = tegra_clk_register_periph_gate("apbdma", "clk_m", 0, clk_base, 0, 34,
-                                   &periph_h_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "tegra-apbdma");
-       clks[apbdma] = clk;
-
-       /* rtc */
-       clk = tegra_clk_register_periph_gate("rtc", "clk_32k",
-                                   TEGRA_PERIPH_NO_RESET | TEGRA_PERIPH_ON_APB,
-                                   clk_base, 0, 4, &periph_l_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "rtc-tegra");
-       clks[rtc] = clk;
-
-       /* timer */
-       clk = tegra_clk_register_periph_gate("timer", "clk_m", 0, clk_base, 0,
-                                   5, &periph_l_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "timer");
-       clks[timer] = clk;
-
-       /* kbc */
-       clk = tegra_clk_register_periph_gate("kbc", "clk_32k",
-                                   TEGRA_PERIPH_NO_RESET | TEGRA_PERIPH_ON_APB,
-                                   clk_base, 0, 36, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "tegra-kbc");
-       clks[kbc] = clk;
-
-       /* csus */
-       clk = tegra_clk_register_periph_gate("csus", "clk_m",
-                                   TEGRA_PERIPH_NO_RESET | TEGRA_PERIPH_ON_APB,
-                                   clk_base, 0, 92, &periph_u_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "csus", "tengra_camera");
-       clks[csus] = clk;
-
-       /* vcp */
-       clk = tegra_clk_register_periph_gate("vcp", "clk_m", 0, clk_base, 0, 29,
-                                   &periph_l_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "vcp", "tegra-avp");
-       clks[vcp] = clk;
-
-       /* bsea */
-       clk = tegra_clk_register_periph_gate("bsea", "clk_m", 0, clk_base, 0,
-                                   62, &periph_h_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "bsea", "tegra-avp");
-       clks[bsea] = clk;
-
-       /* bsev */
-       clk = tegra_clk_register_periph_gate("bsev", "clk_m", 0, clk_base, 0,
-                                   63, &periph_h_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "bsev", "tegra-aes");
-       clks[bsev] = clk;
-
-       /* usbd */
-       clk = tegra_clk_register_periph_gate("usbd", "clk_m", 0, clk_base, 0,
-                                   22, &periph_l_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "fsl-tegra-udc");
-       clks[usbd] = clk;
-
-       /* usb2 */
-       clk = tegra_clk_register_periph_gate("usb2", "clk_m", 0, clk_base, 0,
-                                   58, &periph_h_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "tegra-ehci.1");
-       clks[usb2] = clk;
-
-       /* usb3 */
-       clk = tegra_clk_register_periph_gate("usb3", "clk_m", 0, clk_base, 0,
-                                   59, &periph_h_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "tegra-ehci.2");
-       clks[usb3] = clk;
-
        /* dsia */
        clk = tegra_clk_register_periph_gate("dsia", "pll_d_out0", 0, clk_base,
-                                   0, 48, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "dsia", "tegradc.0");
-       clks[dsia] = clk;
-
-       /* csi */
-       clk = tegra_clk_register_periph_gate("csi", "pll_p_out3", 0, clk_base,
-                                   0, 52, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "csi", "tegra_camera");
-       clks[csi] = clk;
-
-       /* isp */
-       clk = tegra_clk_register_periph_gate("isp", "clk_m", 0, clk_base, 0, 23,
-                                   &periph_l_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "isp", "tegra_camera");
-       clks[isp] = clk;
+                                   0, 48, periph_clk_enb_refcnt);
+       clks[TEGRA30_CLK_DSIA] = clk;
 
        /* pcie */
        clk = tegra_clk_register_periph_gate("pcie", "clk_m", 0, clk_base, 0,
-                                   70, &periph_u_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "pcie", "tegra-pcie");
-       clks[pcie] = clk;
+                                   70, periph_clk_enb_refcnt);
+       clks[TEGRA30_CLK_PCIE] = clk;
 
        /* afi */
        clk = tegra_clk_register_periph_gate("afi", "clk_m", 0, clk_base, 0, 72,
-                                   &periph_u_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "afi", "tegra-pcie");
-       clks[afi] = clk;
-
-       /* pciex */
-       clk = tegra_clk_register_periph_gate("pciex", "pll_e", 0, clk_base, 0,
-                                   74, &periph_u_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "pciex", "tegra-pcie");
-       clks[pciex] = clk;
-
-       /* kfuse */
-       clk = tegra_clk_register_periph_gate("kfuse", "clk_m",
-                                   TEGRA_PERIPH_ON_APB,
-                                   clk_base, 0, 40, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "kfuse-tegra");
-       clks[kfuse] = clk;
-
-       /* fuse */
-       clk = tegra_clk_register_periph_gate("fuse", "clk_m",
-                                   TEGRA_PERIPH_ON_APB,
-                                   clk_base, 0, 39, &periph_h_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "fuse", "fuse-tegra");
-       clks[fuse] = clk;
-
-       /* fuse_burn */
-       clk = tegra_clk_register_periph_gate("fuse_burn", "clk_m",
-                                   TEGRA_PERIPH_ON_APB,
-                                   clk_base, 0, 39, &periph_h_regs,
                                    periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "fuse_burn", "fuse-tegra");
-       clks[fuse_burn] = clk;
-
-       /* apbif */
-       clk = tegra_clk_register_periph_gate("apbif", "clk_m", 0,
-                                   clk_base, 0, 107, &periph_v_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "apbif", "tegra30-ahub");
-       clks[apbif] = clk;
-
-       /* hda2hdmi */
-       clk = tegra_clk_register_periph_gate("hda2hdmi", "clk_m",
-                                   TEGRA_PERIPH_ON_APB,
-                                   clk_base, 0, 128, &periph_w_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "hda2hdmi", "tegra30-hda");
-       clks[hda2hdmi] = clk;
-
-       /* sata_cold */
-       clk = tegra_clk_register_periph_gate("sata_cold", "clk_m",
-                                   TEGRA_PERIPH_ON_APB,
-                                   clk_base, 0, 129, &periph_w_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "tegra_sata_cold");
-       clks[sata_cold] = clk;
-
-       /* dtv */
-       clk = tegra_clk_register_periph_gate("dtv", "clk_m",
-                                   TEGRA_PERIPH_ON_APB,
-                                   clk_base, 0, 79, &periph_u_regs,
-                                   periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, NULL, "dtv");
-       clks[dtv] = clk;
+       clks[TEGRA30_CLK_AFI] = clk;
 
        /* emc */
        clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm,
@@ -1694,84 +1156,37 @@ static void __init tegra30_periph_clk_init(void)
                               clk_base + CLK_SOURCE_EMC,
                               30, 2, 0, NULL);
        clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base, 0,
-                                   57, &periph_h_regs, periph_clk_enb_refcnt);
-       clk_register_clkdev(clk, "emc", NULL);
-       clks[emc] = clk;
+                                   57, periph_clk_enb_refcnt);
+       clks[TEGRA30_CLK_EMC] = clk;
+
+       /* cml0 */
+       clk = clk_register_gate(NULL, "cml0", "pll_e", 0, clk_base + PLLE_AUX,
+                               0, 0, &cml_lock);
+       clks[TEGRA30_CLK_CML0] = clk;
+
+       /* cml1 */
+       clk = clk_register_gate(NULL, "cml1", "pll_e", 0, clk_base + PLLE_AUX,
+                               1, 0, &cml_lock);
+       clks[TEGRA30_CLK_CML1] = clk;
 
        for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) {
                data = &tegra_periph_clk_list[i];
-               clk = tegra_clk_register_periph(data->name, data->parent_names,
+               clk = tegra_clk_register_periph(data->name, data->p.parent_names,
                                data->num_parents, &data->periph,
                                clk_base, data->offset, data->flags);
-               clk_register_clkdev(clk, data->con_id, data->dev_id);
                clks[data->clk_id] = clk;
        }
 
        for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) {
                data = &tegra_periph_nodiv_clk_list[i];
                clk = tegra_clk_register_periph_nodiv(data->name,
-                                       data->parent_names,
+                                       data->p.parent_names,
                                        data->num_parents, &data->periph,
                                        clk_base, data->offset);
-               clk_register_clkdev(clk, data->con_id, data->dev_id);
                clks[data->clk_id] = clk;
        }
-}
-
-static void __init tegra30_fixed_clk_init(void)
-{
-       struct clk *clk;
-
-       /* clk_32k */
-       clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT,
-                               32768);
-       clk_register_clkdev(clk, "clk_32k", NULL);
-       clks[clk_32k] = clk;
 
-       /* clk_m_div2 */
-       clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m",
-                               CLK_SET_RATE_PARENT, 1, 2);
-       clk_register_clkdev(clk, "clk_m_div2", NULL);
-       clks[clk_m_div2] = clk;
-
-       /* clk_m_div4 */
-       clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m",
-                               CLK_SET_RATE_PARENT, 1, 4);
-       clk_register_clkdev(clk, "clk_m_div4", NULL);
-       clks[clk_m_div4] = clk;
-
-       /* cml0 */
-       clk = clk_register_gate(NULL, "cml0", "pll_e", 0, clk_base + PLLE_AUX,
-                               0, 0, &cml_lock);
-       clk_register_clkdev(clk, "cml0", NULL);
-       clks[cml0] = clk;
-
-       /* cml1 */
-       clk = clk_register_gate(NULL, "cml1", "pll_e", 0, clk_base + PLLE_AUX,
-                               1, 0, &cml_lock);
-       clk_register_clkdev(clk, "cml1", NULL);
-       clks[cml1] = clk;
-}
-
-static void __init tegra30_osc_clk_init(void)
-{
-       struct clk *clk;
-       unsigned int pll_ref_div;
-
-       tegra30_clk_measure_input_freq();
-
-       /* clk_m */
-       clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT,
-                               input_freq);
-       clk_register_clkdev(clk, "clk_m", NULL);
-       clks[clk_m] = clk;
-
-       /* pll_ref */
-       pll_ref_div = tegra30_get_pll_ref_div();
-       clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m",
-                               CLK_SET_RATE_PARENT, 1, pll_ref_div);
-       clk_register_clkdev(clk, "pll_ref", NULL);
-       clks[pll_ref] = clk;
+       tegra_periph_clk_init(clk_base, pmc_base, tegra30_clks, &pll_p_params);
 }
 
 /* Tegra30 CPU clock and reset control functions */
@@ -1913,48 +1328,49 @@ static struct tegra_cpu_car_ops tegra30_cpu_car_ops = {
 };
 
 static struct tegra_clk_init_table init_table[] __initdata = {
-       {uarta, pll_p, 408000000, 0},
-       {uartb, pll_p, 408000000, 0},
-       {uartc, pll_p, 408000000, 0},
-       {uartd, pll_p, 408000000, 0},
-       {uarte, pll_p, 408000000, 0},
-       {pll_a, clk_max, 564480000, 1},
-       {pll_a_out0, clk_max, 11289600, 1},
-       {extern1, pll_a_out0, 0, 1},
-       {clk_out_1_mux, extern1, 0, 0},
-       {clk_out_1, clk_max, 0, 1},
-       {blink, clk_max, 0, 1},
-       {i2s0, pll_a_out0, 11289600, 0},
-       {i2s1, pll_a_out0, 11289600, 0},
-       {i2s2, pll_a_out0, 11289600, 0},
-       {i2s3, pll_a_out0, 11289600, 0},
-       {i2s4, pll_a_out0, 11289600, 0},
-       {sdmmc1, pll_p, 48000000, 0},
-       {sdmmc2, pll_p, 48000000, 0},
-       {sdmmc3, pll_p, 48000000, 0},
-       {pll_m, clk_max, 0, 1},
-       {pclk, clk_max, 0, 1},
-       {csite, clk_max, 0, 1},
-       {emc, clk_max, 0, 1},
-       {mselect, clk_max, 0, 1},
-       {sbc1, pll_p, 100000000, 0},
-       {sbc2, pll_p, 100000000, 0},
-       {sbc3, pll_p, 100000000, 0},
-       {sbc4, pll_p, 100000000, 0},
-       {sbc5, pll_p, 100000000, 0},
-       {sbc6, pll_p, 100000000, 0},
-       {host1x, pll_c, 150000000, 0},
-       {disp1, pll_p, 600000000, 0},
-       {disp2, pll_p, 600000000, 0},
-       {twd, clk_max, 0, 1},
-       {gr2d, pll_c, 300000000, 0},
-       {gr3d, pll_c, 300000000, 0},
-       {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */
+       {TEGRA30_CLK_UARTA, TEGRA30_CLK_PLL_P, 408000000, 0},
+       {TEGRA30_CLK_UARTB, TEGRA30_CLK_PLL_P, 408000000, 0},
+       {TEGRA30_CLK_UARTC, TEGRA30_CLK_PLL_P, 408000000, 0},
+       {TEGRA30_CLK_UARTD, TEGRA30_CLK_PLL_P, 408000000, 0},
+       {TEGRA30_CLK_UARTE, TEGRA30_CLK_PLL_P, 408000000, 0},
+       {TEGRA30_CLK_PLL_A, TEGRA30_CLK_CLK_MAX, 564480000, 1},
+       {TEGRA30_CLK_PLL_A_OUT0, TEGRA30_CLK_CLK_MAX, 11289600, 1},
+       {TEGRA30_CLK_EXTERN1, TEGRA30_CLK_PLL_A_OUT0, 0, 1},
+       {TEGRA30_CLK_CLK_OUT_1_MUX, TEGRA30_CLK_EXTERN1, 0, 0},
+       {TEGRA30_CLK_CLK_OUT_1, TEGRA30_CLK_CLK_MAX, 0, 1},
+       {TEGRA30_CLK_BLINK, TEGRA30_CLK_CLK_MAX, 0, 1},
+       {TEGRA30_CLK_I2S0, TEGRA30_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA30_CLK_I2S1, TEGRA30_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA30_CLK_I2S2, TEGRA30_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA30_CLK_I2S3, TEGRA30_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA30_CLK_I2S4, TEGRA30_CLK_PLL_A_OUT0, 11289600, 0},
+       {TEGRA30_CLK_SDMMC1, TEGRA30_CLK_PLL_P, 48000000, 0},
+       {TEGRA30_CLK_SDMMC2, TEGRA30_CLK_PLL_P, 48000000, 0},
+       {TEGRA30_CLK_SDMMC3, TEGRA30_CLK_PLL_P, 48000000, 0},
+       {TEGRA30_CLK_PLL_M, TEGRA30_CLK_CLK_MAX, 0, 1},
+       {TEGRA30_CLK_PCLK, TEGRA30_CLK_CLK_MAX, 0, 1},
+       {TEGRA30_CLK_CSITE, TEGRA30_CLK_CLK_MAX, 0, 1},
+       {TEGRA30_CLK_EMC, TEGRA30_CLK_CLK_MAX, 0, 1},
+       {TEGRA30_CLK_MSELECT, TEGRA30_CLK_CLK_MAX, 0, 1},
+       {TEGRA30_CLK_SBC1, TEGRA30_CLK_PLL_P, 100000000, 0},
+       {TEGRA30_CLK_SBC2, TEGRA30_CLK_PLL_P, 100000000, 0},
+       {TEGRA30_CLK_SBC3, TEGRA30_CLK_PLL_P, 100000000, 0},
+       {TEGRA30_CLK_SBC4, TEGRA30_CLK_PLL_P, 100000000, 0},
+       {TEGRA30_CLK_SBC5, TEGRA30_CLK_PLL_P, 100000000, 0},
+       {TEGRA30_CLK_SBC6, TEGRA30_CLK_PLL_P, 100000000, 0},
+       {TEGRA30_CLK_HOST1X, TEGRA30_CLK_PLL_C, 150000000, 0},
+       {TEGRA30_CLK_DISP1, TEGRA30_CLK_PLL_P, 600000000, 0},
+       {TEGRA30_CLK_DISP2, TEGRA30_CLK_PLL_P, 600000000, 0},
+       {TEGRA30_CLK_TWD, TEGRA30_CLK_CLK_MAX, 0, 1},
+       {TEGRA30_CLK_GR2D, TEGRA30_CLK_PLL_C, 300000000, 0},
+       {TEGRA30_CLK_GR3D, TEGRA30_CLK_PLL_C, 300000000, 0},
+       {TEGRA30_CLK_GR3D2, TEGRA30_CLK_PLL_C, 300000000, 0},
+       {TEGRA30_CLK_CLK_MAX, TEGRA30_CLK_CLK_MAX, 0, 0}, /* This MUST be the last entry. */
 };
 
 static void __init tegra30_clock_apply_init_table(void)
 {
-       tegra_init_from_table(init_table, clks, clk_max);
+       tegra_init_from_table(init_table, clks, TEGRA30_CLK_CLK_MAX);
 }
 
 /*
@@ -1963,19 +1379,18 @@ static void __init tegra30_clock_apply_init_table(void)
  * table under two names.
  */
 static struct tegra_clk_duplicate tegra_clk_duplicates[] = {
-       TEGRA_CLK_DUPLICATE(usbd, "utmip-pad", NULL),
-       TEGRA_CLK_DUPLICATE(usbd, "tegra-ehci.0", NULL),
-       TEGRA_CLK_DUPLICATE(usbd, "tegra-otg", NULL),
-       TEGRA_CLK_DUPLICATE(bsev, "tegra-avp", "bsev"),
-       TEGRA_CLK_DUPLICATE(bsev, "nvavp", "bsev"),
-       TEGRA_CLK_DUPLICATE(vde, "tegra-aes", "vde"),
-       TEGRA_CLK_DUPLICATE(bsea, "tegra-aes", "bsea"),
-       TEGRA_CLK_DUPLICATE(bsea, "nvavp", "bsea"),
-       TEGRA_CLK_DUPLICATE(cml1, "tegra_sata_cml", NULL),
-       TEGRA_CLK_DUPLICATE(cml0, "tegra_pcie", "cml"),
-       TEGRA_CLK_DUPLICATE(pciex, "tegra_pcie", "pciex"),
-       TEGRA_CLK_DUPLICATE(vcp, "nvavp", "vcp"),
-       TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* MUST be the last entry */
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_USBD, "utmip-pad", NULL),
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_USBD, "tegra-ehci.0", NULL),
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_USBD, "tegra-otg", NULL),
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_BSEV, "tegra-avp", "bsev"),
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_BSEV, "nvavp", "bsev"),
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_VDE, "tegra-aes", "vde"),
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_BSEA, "tegra-aes", "bsea"),
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_BSEA, "nvavp", "bsea"),
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_CML1, "tegra_sata_cml", NULL),
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_CML0, "tegra_pcie", "cml"),
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_VCP, "nvavp", "vcp"),
+       TEGRA_CLK_DUPLICATE(TEGRA30_CLK_CLK_MAX, NULL, NULL), /* MUST be the last entry */
 };
 
 static const struct of_device_id pmc_match[] __initconst = {
@@ -1986,7 +1401,6 @@ static const struct of_device_id pmc_match[] __initconst = {
 static void __init tegra30_clock_init(struct device_node *np)
 {
        struct device_node *node;
-       int i;
 
        clk_base = of_iomap(np, 0);
        if (!clk_base) {
@@ -2006,29 +1420,27 @@ static void __init tegra30_clock_init(struct device_node *np)
                BUG();
        }
 
-       tegra30_osc_clk_init();
-       tegra30_fixed_clk_init();
+       clks = tegra_clk_init(clk_base, TEGRA30_CLK_CLK_MAX,
+                               TEGRA30_CLK_PERIPH_BANKS);
+       if (!clks)
+               return;
+
+       if (tegra_osc_clk_init(clk_base, tegra30_clks, tegra30_input_freq,
+               ARRAY_SIZE(tegra30_input_freq), &input_freq, NULL) < 0)
+               return;
+
+
+       tegra_fixed_clk_init(tegra30_clks);
        tegra30_pll_init();
        tegra30_super_clk_init();
        tegra30_periph_clk_init();
-       tegra30_audio_clk_init();
-       tegra30_pmc_clk_init();
-
-       for (i = 0; i < ARRAY_SIZE(clks); i++) {
-               if (IS_ERR(clks[i])) {
-                       pr_err("Tegra30 clk %d: register failed with %ld\n",
-                              i, PTR_ERR(clks[i]));
-                       BUG();
-               }
-               if (!clks[i])
-                       clks[i] = ERR_PTR(-EINVAL);
-       }
+       tegra_audio_clk_init(clk_base, pmc_base, tegra30_clks, &pll_a_params);
+       tegra_pmc_clk_init(pmc_base, tegra30_clks);
 
-       tegra_init_dup_clks(tegra_clk_duplicates, clks, clk_max);
+       tegra_init_dup_clks(tegra_clk_duplicates, clks, TEGRA30_CLK_CLK_MAX);
 
-       clk_data.clks = clks;
-       clk_data.clk_num = ARRAY_SIZE(clks);
-       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+       tegra_add_of_provider(np);
+       tegra_register_devclks(devclks, ARRAY_SIZE(devclks));
 
        tegra_clk_apply_init_table = tegra30_clock_apply_init_table;
 
index 86581ac1fd6985ffcae150aa0737521c3edbd5a5..c0a7d77235105472d225d6f528c81e675866fd3c 100644 (file)
 #include <linux/clk-provider.h>
 #include <linux/of.h>
 #include <linux/clk/tegra.h>
+#include <linux/reset-controller.h>
+#include <linux/tegra-soc.h>
 
 #include "clk.h"
 
+#define CLK_OUT_ENB_L                  0x010
+#define CLK_OUT_ENB_H                  0x014
+#define CLK_OUT_ENB_U                  0x018
+#define CLK_OUT_ENB_V                  0x360
+#define CLK_OUT_ENB_W                  0x364
+#define CLK_OUT_ENB_X                  0x280
+#define CLK_OUT_ENB_SET_L              0x320
+#define CLK_OUT_ENB_CLR_L              0x324
+#define CLK_OUT_ENB_SET_H              0x328
+#define CLK_OUT_ENB_CLR_H              0x32c
+#define CLK_OUT_ENB_SET_U              0x330
+#define CLK_OUT_ENB_CLR_U              0x334
+#define CLK_OUT_ENB_SET_V              0x440
+#define CLK_OUT_ENB_CLR_V              0x444
+#define CLK_OUT_ENB_SET_W              0x448
+#define CLK_OUT_ENB_CLR_W              0x44c
+#define CLK_OUT_ENB_SET_X              0x284
+#define CLK_OUT_ENB_CLR_X              0x288
+
+#define RST_DEVICES_L                  0x004
+#define RST_DEVICES_H                  0x008
+#define RST_DEVICES_U                  0x00C
+#define RST_DFLL_DVCO                  0x2F4
+#define RST_DEVICES_V                  0x358
+#define RST_DEVICES_W                  0x35C
+#define RST_DEVICES_X                  0x28C
+#define RST_DEVICES_SET_L              0x300
+#define RST_DEVICES_CLR_L              0x304
+#define RST_DEVICES_SET_H              0x308
+#define RST_DEVICES_CLR_H              0x30c
+#define RST_DEVICES_SET_U              0x310
+#define RST_DEVICES_CLR_U              0x314
+#define RST_DEVICES_SET_V              0x430
+#define RST_DEVICES_CLR_V              0x434
+#define RST_DEVICES_SET_W              0x438
+#define RST_DEVICES_CLR_W              0x43c
+#define RST_DEVICES_SET_X              0x290
+#define RST_DEVICES_CLR_X              0x294
+
 /* Global data of Tegra CPU CAR ops */
 static struct tegra_cpu_car_ops dummy_car_ops;
 struct tegra_cpu_car_ops *tegra_cpu_car_ops = &dummy_car_ops;
 
+int *periph_clk_enb_refcnt;
+static int periph_banks;
+static struct clk **clks;
+static int clk_num;
+static struct clk_onecell_data clk_data;
+
+static struct tegra_clk_periph_regs periph_regs[] = {
+       [0] = {
+               .enb_reg = CLK_OUT_ENB_L,
+               .enb_set_reg = CLK_OUT_ENB_SET_L,
+               .enb_clr_reg = CLK_OUT_ENB_CLR_L,
+               .rst_reg = RST_DEVICES_L,
+               .rst_set_reg = RST_DEVICES_SET_L,
+               .rst_clr_reg = RST_DEVICES_CLR_L,
+       },
+       [1] = {
+               .enb_reg = CLK_OUT_ENB_H,
+               .enb_set_reg = CLK_OUT_ENB_SET_H,
+               .enb_clr_reg = CLK_OUT_ENB_CLR_H,
+               .rst_reg = RST_DEVICES_H,
+               .rst_set_reg = RST_DEVICES_SET_H,
+               .rst_clr_reg = RST_DEVICES_CLR_H,
+       },
+       [2] = {
+               .enb_reg = CLK_OUT_ENB_U,
+               .enb_set_reg = CLK_OUT_ENB_SET_U,
+               .enb_clr_reg = CLK_OUT_ENB_CLR_U,
+               .rst_reg = RST_DEVICES_U,
+               .rst_set_reg = RST_DEVICES_SET_U,
+               .rst_clr_reg = RST_DEVICES_CLR_U,
+       },
+       [3] = {
+               .enb_reg = CLK_OUT_ENB_V,
+               .enb_set_reg = CLK_OUT_ENB_SET_V,
+               .enb_clr_reg = CLK_OUT_ENB_CLR_V,
+               .rst_reg = RST_DEVICES_V,
+               .rst_set_reg = RST_DEVICES_SET_V,
+               .rst_clr_reg = RST_DEVICES_CLR_V,
+       },
+       [4] = {
+               .enb_reg = CLK_OUT_ENB_W,
+               .enb_set_reg = CLK_OUT_ENB_SET_W,
+               .enb_clr_reg = CLK_OUT_ENB_CLR_W,
+               .rst_reg = RST_DEVICES_W,
+               .rst_set_reg = RST_DEVICES_SET_W,
+               .rst_clr_reg = RST_DEVICES_CLR_W,
+       },
+       [5] = {
+               .enb_reg = CLK_OUT_ENB_X,
+               .enb_set_reg = CLK_OUT_ENB_SET_X,
+               .enb_clr_reg = CLK_OUT_ENB_CLR_X,
+               .rst_reg = RST_DEVICES_X,
+               .rst_set_reg = RST_DEVICES_SET_X,
+               .rst_clr_reg = RST_DEVICES_CLR_X,
+       },
+};
+
+static void __iomem *clk_base;
+
+static int tegra_clk_rst_assert(struct reset_controller_dev *rcdev,
+               unsigned long id)
+{
+       /*
+        * If peripheral is on the APB bus then we must read the APB bus to
+        * flush the write operation in apb bus. This will avoid peripheral
+        * access after disabling clock. Since the reset driver has no
+        * knowledge of which reset IDs represent which devices, simply do
+        * this all the time.
+        */
+       tegra_read_chipid();
+
+       writel_relaxed(BIT(id % 32),
+                       clk_base + periph_regs[id / 32].rst_set_reg);
+
+       return 0;
+}
+
+static int tegra_clk_rst_deassert(struct reset_controller_dev *rcdev,
+               unsigned long id)
+{
+       writel_relaxed(BIT(id % 32),
+                       clk_base + periph_regs[id / 32].rst_clr_reg);
+
+       return 0;
+}
+
+struct tegra_clk_periph_regs *get_reg_bank(int clkid)
+{
+       int reg_bank = clkid / 32;
+
+       if (reg_bank < periph_banks)
+               return &periph_regs[reg_bank];
+       else {
+               WARN_ON(1);
+               return NULL;
+       }
+}
+
+struct clk ** __init tegra_clk_init(void __iomem *regs, int num, int banks)
+{
+       clk_base = regs;
+
+       if (WARN_ON(banks > ARRAY_SIZE(periph_regs)))
+               return NULL;
+
+       periph_clk_enb_refcnt = kzalloc(32 * banks *
+                               sizeof(*periph_clk_enb_refcnt), GFP_KERNEL);
+       if (!periph_clk_enb_refcnt)
+               return NULL;
+
+       periph_banks = banks;
+
+       clks = kzalloc(num * sizeof(struct clk *), GFP_KERNEL);
+       if (!clks)
+               kfree(periph_clk_enb_refcnt);
+
+       clk_num = num;
+
+       return clks;
+}
+
 void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list,
                                struct clk *clks[], int clk_max)
 {
@@ -74,6 +236,58 @@ void __init tegra_init_from_table(struct tegra_clk_init_table *tbl,
        }
 }
 
+static struct reset_control_ops rst_ops = {
+       .assert = tegra_clk_rst_assert,
+       .deassert = tegra_clk_rst_deassert,
+};
+
+static struct reset_controller_dev rst_ctlr = {
+       .ops = &rst_ops,
+       .owner = THIS_MODULE,
+       .of_reset_n_cells = 1,
+};
+
+void __init tegra_add_of_provider(struct device_node *np)
+{
+       int i;
+
+       for (i = 0; i < clk_num; i++) {
+               if (IS_ERR(clks[i])) {
+                       pr_err
+                           ("Tegra clk %d: register failed with %ld\n",
+                            i, PTR_ERR(clks[i]));
+               }
+               if (!clks[i])
+                       clks[i] = ERR_PTR(-EINVAL);
+       }
+
+       clk_data.clks = clks;
+       clk_data.clk_num = clk_num;
+       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+
+       rst_ctlr.of_node = np;
+       rst_ctlr.nr_resets = clk_num * 32;
+       reset_controller_register(&rst_ctlr);
+}
+
+void __init tegra_register_devclks(struct tegra_devclk *dev_clks, int num)
+{
+       int i;
+
+       for (i = 0; i < num; i++, dev_clks++)
+               clk_register_clkdev(clks[dev_clks->dt_id], dev_clks->con_id,
+                               dev_clks->dev_id);
+}
+
+struct clk ** __init tegra_lookup_dt_id(int clk_id,
+                                       struct tegra_clk *tegra_clk)
+{
+       if (tegra_clk[clk_id].present)
+               return &clks[tegra_clk[clk_id].dt_id];
+       else
+               return NULL;
+}
+
 tegra_clk_apply_init_table_func tegra_clk_apply_init_table;
 
 void __init tegra_clocks_apply_init_table(void)
index 07cfacd91686b949f75bedeb6cc0bcb4c0ff0c54..16ec8d6bb87f287724ff53a362b8c39de2880193 100644 (file)
@@ -37,6 +37,8 @@ struct tegra_clk_sync_source {
        container_of(_hw, struct tegra_clk_sync_source, hw)
 
 extern const struct clk_ops tegra_clk_sync_source_ops;
+extern int *periph_clk_enb_refcnt;
+
 struct clk *tegra_clk_register_sync_source(const char *name,
                unsigned long fixed_rate, unsigned long max_rate);
 
@@ -188,12 +190,15 @@ struct tegra_clk_pll_params {
        u32             ext_misc_reg[3];
        u32             pmc_divnm_reg;
        u32             pmc_divp_reg;
+       u32             flags;
        int             stepa_shift;
        int             stepb_shift;
        int             lock_delay;
        int             max_p;
        struct pdiv_map *pdiv_tohw;
        struct div_nmp  *div_nmp;
+       struct tegra_clk_pll_freq_table *freq_table;
+       unsigned long   fixed_rate;
 };
 
 /**
@@ -233,10 +238,7 @@ struct tegra_clk_pll {
        struct clk_hw   hw;
        void __iomem    *clk_base;
        void __iomem    *pmc;
-       u32             flags;
-       unsigned long   fixed_rate;
        spinlock_t      *lock;
-       struct tegra_clk_pll_freq_table *freq_table;
        struct tegra_clk_pll_params     *params;
 };
 
@@ -258,56 +260,49 @@ extern const struct clk_ops tegra_clk_pll_ops;
 extern const struct clk_ops tegra_clk_plle_ops;
 struct clk *tegra_clk_register_pll(const char *name, const char *parent_name,
                void __iomem *clk_base, void __iomem *pmc,
-               unsigned long flags, unsigned long fixed_rate,
-               struct tegra_clk_pll_params *pll_params, u32 pll_flags,
-               struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock);
+               unsigned long flags, struct tegra_clk_pll_params *pll_params,
+               spinlock_t *lock);
 
 struct clk *tegra_clk_register_plle(const char *name, const char *parent_name,
                void __iomem *clk_base, void __iomem *pmc,
-               unsigned long flags, unsigned long fixed_rate,
-               struct tegra_clk_pll_params *pll_params, u32 pll_flags,
-               struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock);
+               unsigned long flags, struct tegra_clk_pll_params *pll_params,
+               spinlock_t *lock);
 
 struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name,
                            void __iomem *clk_base, void __iomem *pmc,
-                           unsigned long flags, unsigned long fixed_rate,
+                           unsigned long flags,
                            struct tegra_clk_pll_params *pll_params,
-                           u32 pll_flags,
-                           struct tegra_clk_pll_freq_table *freq_table,
                            spinlock_t *lock);
 
 struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name,
                           void __iomem *clk_base, void __iomem *pmc,
-                          unsigned long flags, unsigned long fixed_rate,
+                          unsigned long flags,
                           struct tegra_clk_pll_params *pll_params,
-                          u32 pll_flags,
-                          struct tegra_clk_pll_freq_table *freq_table,
                           spinlock_t *lock);
 
 struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name,
                           void __iomem *clk_base, void __iomem *pmc,
-                          unsigned long flags, unsigned long fixed_rate,
+                          unsigned long flags,
                           struct tegra_clk_pll_params *pll_params,
-                          u32 pll_flags,
-                          struct tegra_clk_pll_freq_table *freq_table,
                           spinlock_t *lock);
 
 struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name,
                           void __iomem *clk_base, void __iomem *pmc,
-                          unsigned long flags, unsigned long fixed_rate,
+                          unsigned long flags,
                           struct tegra_clk_pll_params *pll_params,
-                          u32 pll_flags,
-                          struct tegra_clk_pll_freq_table *freq_table,
                           spinlock_t *lock, unsigned long parent_rate);
 
 struct clk *tegra_clk_register_plle_tegra114(const char *name,
                                const char *parent_name,
                                void __iomem *clk_base, unsigned long flags,
-                               unsigned long fixed_rate,
                                struct tegra_clk_pll_params *pll_params,
-                               struct tegra_clk_pll_freq_table *freq_table,
                                spinlock_t *lock);
 
+struct clk *tegra_clk_register_pllss(const char *name, const char *parent_name,
+                          void __iomem *clk_base, unsigned long flags,
+                          struct tegra_clk_pll_params *pll_params,
+                          spinlock_t *lock);
+
 /**
  * struct tegra_clk_pll_out - PLL divider down clock
  *
@@ -395,13 +390,13 @@ struct tegra_clk_periph_gate {
 #define TEGRA_PERIPH_MANUAL_RESET BIT(1)
 #define TEGRA_PERIPH_ON_APB BIT(2)
 #define TEGRA_PERIPH_WAR_1005168 BIT(3)
+#define TEGRA_PERIPH_NO_DIV BIT(4)
+#define TEGRA_PERIPH_NO_GATE BIT(5)
 
-void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert);
 extern const struct clk_ops tegra_clk_periph_gate_ops;
 struct clk *tegra_clk_register_periph_gate(const char *name,
                const char *parent_name, u8 gate_flags, void __iomem *clk_base,
-               unsigned long flags, int clk_num,
-               struct tegra_clk_periph_regs *pregs, int *enable_refcnt);
+               unsigned long flags, int clk_num, int *enable_refcnt);
 
 /**
  * struct clk-periph - peripheral clock
@@ -443,26 +438,26 @@ struct clk *tegra_clk_register_periph_nodiv(const char *name,
 
 #define TEGRA_CLK_PERIPH(_mux_shift, _mux_mask, _mux_flags,            \
                         _div_shift, _div_width, _div_frac_width,       \
-                        _div_flags, _clk_num, _enb_refcnt, _regs,      \
-                        _gate_flags, _table)                           \
+                        _div_flags, _clk_num,\
+                        _gate_flags, _table, _lock)                    \
        {                                                               \
                .mux = {                                                \
                        .flags = _mux_flags,                            \
                        .shift = _mux_shift,                            \
                        .mask = _mux_mask,                              \
                        .table = _table,                                \
+                       .lock = _lock,                                  \
                },                                                      \
                .divider = {                                            \
                        .flags = _div_flags,                            \
                        .shift = _div_shift,                            \
                        .width = _div_width,                            \
                        .frac_width = _div_frac_width,                  \
+                       .lock = _lock,                                  \
                },                                                      \
                .gate = {                                               \
                        .flags = _gate_flags,                           \
                        .clk_num = _clk_num,                            \
-                       .enable_refcnt = _enb_refcnt,                   \
-                       .regs = _regs,                                  \
                },                                                      \
                .mux_ops = &clk_mux_ops,                                \
                .div_ops = &tegra_clk_frac_div_ops,                     \
@@ -472,7 +467,10 @@ struct clk *tegra_clk_register_periph_nodiv(const char *name,
 struct tegra_periph_init_data {
        const char *name;
        int clk_id;
-       const char **parent_names;
+       union {
+               const char **parent_names;
+               const char *parent_name;
+       } p;
        int num_parents;
        struct tegra_clk_periph periph;
        u32 offset;
@@ -483,20 +481,19 @@ struct tegra_periph_init_data {
 
 #define TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\
                        _mux_shift, _mux_mask, _mux_flags, _div_shift,  \
-                       _div_width, _div_frac_width, _div_flags, _regs, \
-                       _clk_num, _enb_refcnt, _gate_flags, _clk_id, _table,\
-                       _flags) \
+                       _div_width, _div_frac_width, _div_flags,        \
+                       _clk_num, _gate_flags, _clk_id, _table,         \
+                       _flags, _lock) \
        {                                                               \
                .name = _name,                                          \
                .clk_id = _clk_id,                                      \
-               .parent_names = _parent_names,                          \
+               .p.parent_names = _parent_names,                        \
                .num_parents = ARRAY_SIZE(_parent_names),               \
                .periph = TEGRA_CLK_PERIPH(_mux_shift, _mux_mask,       \
                                           _mux_flags, _div_shift,      \
                                           _div_width, _div_frac_width, \
                                           _div_flags, _clk_num,        \
-                                          _enb_refcnt, _regs,          \
-                                          _gate_flags, _table),        \
+                                          _gate_flags, _table, _lock), \
                .offset = _offset,                                      \
                .con_id = _con_id,                                      \
                .dev_id = _dev_id,                                      \
@@ -505,13 +502,13 @@ struct tegra_periph_init_data {
 
 #define TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parent_names, _offset,\
                        _mux_shift, _mux_width, _mux_flags, _div_shift, \
-                       _div_width, _div_frac_width, _div_flags, _regs, \
-                       _clk_num, _enb_refcnt, _gate_flags, _clk_id)    \
+                       _div_width, _div_frac_width, _div_flags, \
+                       _clk_num, _gate_flags, _clk_id) \
        TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\
                        _mux_shift, BIT(_mux_width) - 1, _mux_flags,    \
                        _div_shift, _div_width, _div_frac_width, _div_flags, \
-                       _regs, _clk_num, _enb_refcnt, _gate_flags, _clk_id,\
-                       NULL, 0)
+                       _clk_num, _gate_flags, _clk_id,\
+                       NULL, 0, NULL)
 
 /**
  * struct clk_super_mux - super clock
@@ -581,12 +578,49 @@ struct tegra_clk_duplicate {
                },                              \
        }
 
+struct tegra_clk {
+       int                     dt_id;
+       bool                    present;
+};
+
+struct tegra_devclk {
+       int             dt_id;
+       char            *dev_id;
+       char            *con_id;
+};
+
 void tegra_init_from_table(struct tegra_clk_init_table *tbl,
                struct clk *clks[], int clk_max);
 
 void tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list,
                struct clk *clks[], int clk_max);
 
+struct tegra_clk_periph_regs *get_reg_bank(int clkid);
+struct clk **tegra_clk_init(void __iomem *clk_base, int num, int periph_banks);
+
+struct clk **tegra_lookup_dt_id(int clk_id, struct tegra_clk *tegra_clk);
+
+void tegra_add_of_provider(struct device_node *np);
+void tegra_register_devclks(struct tegra_devclk *dev_clks, int num);
+
+void tegra_audio_clk_init(void __iomem *clk_base,
+                       void __iomem *pmc_base, struct tegra_clk *tegra_clks,
+                       struct tegra_clk_pll_params *pll_params);
+
+void tegra_periph_clk_init(void __iomem *clk_base, void __iomem *pmc_base,
+                       struct tegra_clk *tegra_clks,
+                       struct tegra_clk_pll_params *pll_params);
+
+void tegra_pmc_clk_init(void __iomem *pmc_base, struct tegra_clk *tegra_clks);
+void tegra_fixed_clk_init(struct tegra_clk *tegra_clks);
+int tegra_osc_clk_init(void __iomem *clk_base, struct tegra_clk *tegra_clks,
+                               unsigned long *input_freqs, int num,
+                               unsigned long *osc_freq,
+                               unsigned long *pll_ref_freq);
+void tegra_super_clk_gen4_init(void __iomem *clk_base,
+                       void __iomem *pmc_base, struct tegra_clk *tegra_clks,
+                       struct tegra_clk_pll_params *pll_params);
+
 void tegra114_clock_tune_cpu_trimmers_high(void);
 void tegra114_clock_tune_cpu_trimmers_low(void);
 void tegra114_clock_tune_cpu_trimmers_init(void);
index 293a28854417374ee6fe3047be1637934eb343a9..e2d63bc47436d1ee51014a24dc21ebcc1131ca51 100644 (file)
@@ -36,7 +36,7 @@ static int clk_prcmu_prepare(struct clk_hw *hw)
        if (!ret)
                clk->is_prepared = 1;
 
-       return ret;;
+       return ret;
 }
 
 static void clk_prcmu_unprepare(struct clk_hw *hw)
index f5e4c21b301f6438c32d3552cae4bb9aef9d2a44..8cbfcf88fae3ed6eaabe1a7af8dd1d1c7fd33d27 100644 (file)
@@ -119,6 +119,7 @@ static const struct clk_ops icst_ops = {
 
 struct clk *icst_clk_register(struct device *dev,
                        const struct clk_icst_desc *desc,
+                       const char *name,
                        void __iomem *base)
 {
        struct clk *clk;
@@ -130,7 +131,7 @@ struct clk *icst_clk_register(struct device *dev,
                pr_err("could not allocate ICST clock!\n");
                return ERR_PTR(-ENOMEM);
        }
-       init.name = "icst";
+       init.name = name;
        init.ops = &icst_ops;
        init.flags = CLK_IS_ROOT;
        init.parent_names = NULL;
index dad51b6ffd0085f72bf7292437d5bedb35fe77df..be99dd0da7850ee7c35ce2c09e871fb71bb355a8 100644 (file)
@@ -15,4 +15,5 @@ struct clk_icst_desc {
 
 struct clk *icst_clk_register(struct device *dev,
                              const struct clk_icst_desc *desc,
+                             const char *name,
                              void __iomem *base);
index 369139af2a3bfd056dee2c934827b9914b7dc686..844f8d711a1271ab85265d373e530919807081c7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Clock driver for the ARM Integrator/IM-PD1 board
- * Copyright (C) 2012 Linus Walleij
+ * Copyright (C) 2012-2013 Linus Walleij
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
 #include "clk-icst.h"
 
 struct impd1_clk {
-       struct clk *vcoclk;
+       char *vco1name;
+       struct clk *vco1clk;
+       char *vco2name;
+       struct clk *vco2clk;
+       struct clk *mmciclk;
+       char *uartname;
        struct clk *uartclk;
-       struct clk_lookup *clks[3];
+       char *spiname;
+       struct clk *spiclk;
+       char *scname;
+       struct clk *scclk;
+       struct clk_lookup *clks[6];
 };
 
+/* One entry for each connected IM-PD1 LM */
 static struct impd1_clk impd1_clks[4];
 
 /*
- * There are two VCO's on the IM-PD1 but only one is used by the
- * kernel, that is why we are only implementing the control of
- * IMPD1_OSC1 here.
+ * There are two VCO's on the IM-PD1
  */
 
-static const struct icst_params impd1_vco_params = {
+static const struct icst_params impd1_vco1_params = {
        .ref            = 24000000,     /* 24 MHz */
        .vco_max        = ICST525_VCO_MAX_3V,
        .vco_min        = ICST525_VCO_MIN,
@@ -44,11 +52,29 @@ static const struct icst_params impd1_vco_params = {
 };
 
 static const struct clk_icst_desc impd1_icst1_desc = {
-       .params = &impd1_vco_params,
+       .params = &impd1_vco1_params,
        .vco_offset = IMPD1_OSC1,
        .lock_offset = IMPD1_LOCK,
 };
 
+static const struct icst_params impd1_vco2_params = {
+       .ref            = 24000000,     /* 24 MHz */
+       .vco_max        = ICST525_VCO_MAX_3V,
+       .vco_min        = ICST525_VCO_MIN,
+       .vd_min         = 12,
+       .vd_max         = 519,
+       .rd_min         = 3,
+       .rd_max         = 120,
+       .s2div          = icst525_s2div,
+       .idx2s          = icst525_idx2s,
+};
+
+static const struct clk_icst_desc impd1_icst2_desc = {
+       .params = &impd1_vco2_params,
+       .vco_offset = IMPD1_OSC2,
+       .lock_offset = IMPD1_LOCK,
+};
+
 /**
  * integrator_impd1_clk_init() - set up the integrator clock tree
  * @base: base address of the logic module (LM)
@@ -66,16 +92,39 @@ void integrator_impd1_clk_init(void __iomem *base, unsigned int id)
        }
        imc = &impd1_clks[id];
 
-       clk = icst_clk_register(NULL, &impd1_icst1_desc, base);
-       imc->vcoclk = clk;
+       imc->vco1name = kasprintf(GFP_KERNEL, "lm%x-vco1", id);
+       clk = icst_clk_register(NULL, &impd1_icst1_desc, imc->vco1name, base);
+       imc->vco1clk = clk;
        imc->clks[0] = clkdev_alloc(clk, NULL, "lm%x:01000", id);
 
-       /* UART reference clock */
-       clk = clk_register_fixed_rate(NULL, "uartclk", NULL, CLK_IS_ROOT,
-                               14745600);
+       /* VCO2 is also called "CLK2" */
+       imc->vco2name = kasprintf(GFP_KERNEL, "lm%x-vco2", id);
+       clk = icst_clk_register(NULL, &impd1_icst2_desc, imc->vco2name, base);
+       imc->vco2clk = clk;
+
+       /* MMCI uses CLK2 right off */
+       imc->clks[1] = clkdev_alloc(clk, NULL, "lm%x:00700", id);
+
+       /* UART reference clock divides CLK2 by a fixed factor 4 */
+       imc->uartname = kasprintf(GFP_KERNEL, "lm%x-uartclk", id);
+       clk = clk_register_fixed_factor(NULL, imc->uartname, imc->vco2name,
+                                  CLK_IGNORE_UNUSED, 1, 4);
        imc->uartclk = clk;
-       imc->clks[1] = clkdev_alloc(clk, NULL, "lm%x:00100", id);
-       imc->clks[2] = clkdev_alloc(clk, NULL, "lm%x:00200", id);
+       imc->clks[2] = clkdev_alloc(clk, NULL, "lm%x:00100", id);
+       imc->clks[3] = clkdev_alloc(clk, NULL, "lm%x:00200", id);
+
+       /* SPI PL022 clock divides CLK2 by a fixed factor 64 */
+       imc->spiname = kasprintf(GFP_KERNEL, "lm%x-spiclk", id);
+       clk = clk_register_fixed_factor(NULL, imc->spiname, imc->vco2name,
+                                  CLK_IGNORE_UNUSED, 1, 64);
+       imc->clks[4] = clkdev_alloc(clk, NULL, "lm%x:00300", id);
+
+       /* Smart Card clock divides CLK2 by a fixed factor 4 */
+       imc->scname = kasprintf(GFP_KERNEL, "lm%x-scclk", id);
+       clk = clk_register_fixed_factor(NULL, imc->scname, imc->vco2name,
+                                  CLK_IGNORE_UNUSED, 1, 4);
+       imc->scclk = clk;
+       imc->clks[5] = clkdev_alloc(clk, NULL, "lm%x:00600", id);
 
        for (i = 0; i < ARRAY_SIZE(imc->clks); i++)
                clkdev_add(imc->clks[i]);
@@ -92,6 +141,13 @@ void integrator_impd1_clk_exit(unsigned int id)
 
        for (i = 0; i < ARRAY_SIZE(imc->clks); i++)
                clkdev_drop(imc->clks[i]);
+       clk_unregister(imc->spiclk);
        clk_unregister(imc->uartclk);
-       clk_unregister(imc->vcoclk);
+       clk_unregister(imc->vco2clk);
+       clk_unregister(imc->vco1clk);
+       kfree(imc->scname);
+       kfree(imc->spiname);
+       kfree(imc->uartname);
+       kfree(imc->vco2name);
+       kfree(imc->vco1name);
 }
index 08593b4ee2c9d17d11ea3fa7754929a158364570..bda8967e09c25efb24c586892ba85cad89945e67 100644 (file)
@@ -78,7 +78,7 @@ void __init integrator_clk_init(bool is_cp)
        clk_register_clkdev(clk, NULL, "sp804");
 
        /* ICST VCO clock used on the Integrator/CP CLCD */
-       clk = icst_clk_register(NULL, &cp_icst_desc,
+       clk = icst_clk_register(NULL, &cp_icst_desc, "icst",
                                __io_address(INTEGRATOR_HDR_BASE));
        clk_register_clkdev(clk, NULL, "clcd");
 }
index cda07e70a408fae371a1ef26988085fe3ccb7ebf..747e7b31117cb6c0dd84eaa6a984e512f8ac406b 100644 (file)
@@ -84,9 +84,11 @@ void __init realview_clk_init(void __iomem *sysbase, bool is_pb1176)
 
        /* ICST VCO clock */
        if (is_pb1176)
-               clk = icst_clk_register(NULL, &realview_osc0_desc, sysbase);
+               clk = icst_clk_register(NULL, &realview_osc0_desc,
+                                       "osc0", sysbase);
        else
-               clk = icst_clk_register(NULL, &realview_osc4_desc, sysbase);
+               clk = icst_clk_register(NULL, &realview_osc4_desc,
+                                       "osc4", sysbase);
 
        clk_register_clkdev(clk, NULL, "dev:clcd");
        clk_register_clkdev(clk, NULL, "issp:clcd");
index bf9b15a585e188656a38ebeec0d187ff3d56937e..c6e86a9a2aa3da2313711ac0c1bc6a46032cde6c 100644 (file)
@@ -123,7 +123,7 @@ static const struct clk_ops clk_sp810_timerclken_ops = {
        .set_parent = clk_sp810_timerclken_set_parent,
 };
 
-struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec,
+static struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec,
                void *data)
 {
        struct clk_sp810 *sp810 = data;
index 10772aa72e4e662e678688cac3225a85f41bb4e4..09dd0173ea0ae616dc4395f2b76724740310522c 100644 (file)
@@ -102,9 +102,10 @@ static const char *swdt_ext_clk_input_names[] __initdata = {"swdt_ext_clk"};
 
 static void __init zynq_clk_register_fclk(enum zynq_clk fclk,
                const char *clk_name, void __iomem *fclk_ctrl_reg,
-               const char **parents)
+               const char **parents, int enable)
 {
        struct clk *clk;
+       u32 enable_reg;
        char *mux_name;
        char *div0_name;
        char *div1_name;
@@ -147,6 +148,12 @@ static void __init zynq_clk_register_fclk(enum zynq_clk fclk,
        clks[fclk] = clk_register_gate(NULL, clk_name,
                        div1_name, CLK_SET_RATE_PARENT, fclk_gate_reg,
                        0, CLK_GATE_SET_TO_DISABLE, fclk_gate_lock);
+       enable_reg = readl(fclk_gate_reg) & 1;
+       if (enable && !enable_reg) {
+               if (clk_prepare_enable(clks[fclk]))
+                       pr_warn("%s: FCLK%u enable failed\n", __func__,
+                                       fclk - fclk0);
+       }
        kfree(mux_name);
        kfree(div0_name);
        kfree(div1_name);
@@ -213,6 +220,7 @@ static void __init zynq_clk_setup(struct device_node *np)
        int ret;
        struct clk *clk;
        char *clk_name;
+       unsigned int fclk_enable = 0;
        const char *clk_output_name[clk_max];
        const char *cpu_parents[4];
        const char *periph_parents[4];
@@ -238,6 +246,8 @@ static void __init zynq_clk_setup(struct device_node *np)
        periph_parents[2] = clk_output_name[armpll];
        periph_parents[3] = clk_output_name[ddrpll];
 
+       of_property_read_u32(np, "fclk-enable", &fclk_enable);
+
        /* ps_clk */
        ret = of_property_read_u32(np, "ps-clk-frequency", &tmp);
        if (ret) {
@@ -340,10 +350,12 @@ static void __init zynq_clk_setup(struct device_node *np)
        clk_prepare_enable(clks[dci]);
 
        /* Peripheral clocks */
-       for (i = fclk0; i <= fclk3; i++)
+       for (i = fclk0; i <= fclk3; i++) {
+               int enable = !!(fclk_enable & BIT(i - fclk0));
                zynq_clk_register_fclk(i, clk_output_name[i],
                                SLCR_FPGA0_CLK_CTRL + 0x10 * (i - fclk0),
-                               periph_parents);
+                               periph_parents, enable);
+       }
 
        zynq_clk_register_periph_clk(lqspi, 0, clk_output_name[lqspi], NULL,
                        SLCR_LQSPI_CLK_CTRL, periph_parents, 0);
index 358358d87b6dc4f9fe384c9af5158ab43ab3f8ea..c7ca50a9c232bdcc246fbce2508f71ff6dbcab97 100644 (file)
@@ -26,7 +26,7 @@ obj-$(CONFIG_SUN5I_HSTIMER)   += timer-sun5i.o
 obj-$(CONFIG_ARCH_TEGRA)       += tegra20_timer.o
 obj-$(CONFIG_VT8500_TIMER)     += vt8500_timer.o
 obj-$(CONFIG_ARCH_NSPIRE)      += zevio-timer.o
-obj-$(CONFIG_ARCH_BCM)         += bcm_kona_timer.o
+obj-$(CONFIG_ARCH_BCM_MOBILE)  += bcm_kona_timer.o
 obj-$(CONFIG_CADENCE_TTC_TIMER)        += cadence_ttc_timer.o
 obj-$(CONFIG_CLKSRC_EFM32)     += time-efm32.o
 obj-$(CONFIG_CLKSRC_EXYNOS_MCT)        += exynos_mct.o
index 62b0de6a18370fade34eca20205557bd5871cc3a..48f76bc05da0d8fb5b5515cd6c919a9cf3c373f6 100644 (file)
@@ -71,6 +71,10 @@ enum {
        MCT_L1_IRQ,
        MCT_L2_IRQ,
        MCT_L3_IRQ,
+       MCT_L4_IRQ,
+       MCT_L5_IRQ,
+       MCT_L6_IRQ,
+       MCT_L7_IRQ,
        MCT_NR_IRQS,
 };
 
index 152a3f3875eeab3223a68f4cddc509e5b378a515..a709cfa49d853bf79c6159d276c9c063ad1bed4b 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/jiffies.h>
 #include <linux/delay.h>
 #include <linux/err.h>
-#include <linux/platform_data/clocksource-nomadik-mtu.h>
 #include <linux/sched_clock.h>
 #include <asm/mach/time.h>
 
@@ -103,7 +102,7 @@ static int nmdk_clkevt_next(unsigned long evt, struct clock_event_device *ev)
        return 0;
 }
 
-void nmdk_clkevt_reset(void)
+static void nmdk_clkevt_reset(void)
 {
        if (clkevt_periodic) {
                /* Timer: configure load and background-load, and fire it up */
@@ -144,7 +143,7 @@ static void nmdk_clkevt_mode(enum clock_event_mode mode,
        }
 }
 
-void nmdk_clksrc_reset(void)
+static void nmdk_clksrc_reset(void)
 {
        /* Disable */
        writel(0, mtu_base + MTU_CR(0));
@@ -192,8 +191,8 @@ static struct irqaction nmdk_timer_irq = {
        .dev_id         = &nmdk_clkevt,
 };
 
-static void __init __nmdk_timer_init(void __iomem *base, int irq,
-                                    struct clk *pclk, struct clk *clk)
+static void __init nmdk_timer_init(void __iomem *base, int irq,
+                                  struct clk *pclk, struct clk *clk)
 {
        unsigned long rate;
 
@@ -245,18 +244,6 @@ static void __init __nmdk_timer_init(void __iomem *base, int irq,
        register_current_timer_delay(&mtu_delay_timer);
 }
 
-void __init nmdk_timer_init(void __iomem *base, int irq)
-{
-       struct clk *clk0, *pclk0;
-
-       pclk0 = clk_get_sys("mtu0", "apb_pclk");
-       BUG_ON(IS_ERR(pclk0));
-       clk0 = clk_get_sys("mtu0", NULL);
-       BUG_ON(IS_ERR(clk0));
-
-       __nmdk_timer_init(base, irq, pclk0, clk0);
-}
-
 static void __init nmdk_timer_of_init(struct device_node *node)
 {
        struct clk *pclk;
@@ -280,7 +267,7 @@ static void __init nmdk_timer_of_init(struct device_node *node)
        if (irq <= 0)
                panic("Can't parse IRQ");
 
-       __nmdk_timer_init(base, irq, pclk, clk);
+       nmdk_timer_init(base, irq, pclk, clk);
 }
 CLOCKSOURCE_OF_DECLARE(nomadik_mtu, "st,nomadik-mtu",
                       nmdk_timer_of_init);
index 7f25cee8cec275692ee685a8b9bbccaf501b6a09..3ddade8a51251e31a2091642aa9e6c4d76e3f398 100644 (file)
@@ -67,3 +67,25 @@ static inline int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
        return -EOPNOTSUPP;
 }
 #endif
+
+#include <plat/cpu.h>
+#include <mach/map.h>
+
+#define EXYNOS4_CLKSRC_CPU                     (S5P_VA_CMU + 0x14200)
+#define EXYNOS4_CLKMUX_STATCPU                 (S5P_VA_CMU + 0x14400)
+
+#define EXYNOS4_CLKDIV_CPU                     (S5P_VA_CMU + 0x14500)
+#define EXYNOS4_CLKDIV_CPU1                    (S5P_VA_CMU + 0x14504)
+#define EXYNOS4_CLKDIV_STATCPU                 (S5P_VA_CMU + 0x14600)
+#define EXYNOS4_CLKDIV_STATCPU1                        (S5P_VA_CMU + 0x14604)
+
+#define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT       (16)
+#define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK    (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)
+
+#define EXYNOS5_APLL_LOCK                      (S5P_VA_CMU + 0x00000)
+#define EXYNOS5_APLL_CON0                      (S5P_VA_CMU + 0x00100)
+#define EXYNOS5_CLKMUX_STATCPU                 (S5P_VA_CMU + 0x00400)
+#define EXYNOS5_CLKDIV_CPU0                    (S5P_VA_CMU + 0x00500)
+#define EXYNOS5_CLKDIV_CPU1                    (S5P_VA_CMU + 0x00504)
+#define EXYNOS5_CLKDIV_STATCPU0                        (S5P_VA_CMU + 0x00600)
+#define EXYNOS5_CLKDIV_STATCPU1                        (S5P_VA_CMU + 0x00604)
index dfd1643b0b2ff86f229b8e8726fee437c3e1e618..40d84c43d8f46cf31ad8f68fd007bf5777df6575 100644 (file)
@@ -17,8 +17,6 @@
 #include <linux/slab.h>
 #include <linux/cpufreq.h>
 
-#include <mach/regs-clock.h>
-
 #include "exynos-cpufreq.h"
 
 static struct clk *cpu_clk;
index efad5e657f6f95d9729b33469b2a3f018eaa798c..869e48297e28db8a8e0ee190281213fef1e54f10 100644 (file)
@@ -17,8 +17,6 @@
 #include <linux/slab.h>
 #include <linux/cpufreq.h>
 
-#include <mach/regs-clock.h>
-
 #include "exynos-cpufreq.h"
 
 static struct clk *cpu_clk;
index 8feda86fe42c5b5b86c5ac53b02c4d47216fd101..5ee2ce1ad424a96a62e731126b2b59b543b535f1 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/cpufreq.h>
 
 #include <mach/map.h>
-#include <mach/regs-clock.h>
 
 #include "exynos-cpufreq.h"
 
index f4fd837bcb82a82530485f1f54a55dc75e362fdf..13857f5d28f782029c92772a46931de23b7c790e 100644 (file)
@@ -289,16 +289,6 @@ config CRYPTO_DEV_SAHARA
          This option enables support for the SAHARA HW crypto accelerator
          found in some Freescale i.MX chips.
 
-config CRYPTO_DEV_DCP
-       tristate "Support for the DCP engine"
-       depends on ARCH_MXS && OF
-       select CRYPTO_BLKCIPHER
-       select CRYPTO_AES
-       select CRYPTO_CBC
-       help
-         This options enables support for the hardware crypto-acceleration
-         capabilities of the DCP co-processor
-
 config CRYPTO_DEV_S5P
        tristate "Support for Samsung S5PV210 crypto accelerator"
        depends on ARCH_S5PV210
@@ -399,4 +389,33 @@ config CRYPTO_DEV_ATMEL_SHA
          To compile this driver as a module, choose M here: the module
          will be called atmel-sha.
 
+config CRYPTO_DEV_CCP
+       bool "Support for AMD Cryptographic Coprocessor"
+       depends on X86 && PCI
+       default n
+       help
+         The AMD Cryptographic Coprocessor provides hardware support
+         for encryption, hashing and related operations.
+
+if CRYPTO_DEV_CCP
+       source "drivers/crypto/ccp/Kconfig"
+endif
+
+config CRYPTO_DEV_MXS_DCP
+       tristate "Support for Freescale MXS DCP"
+       depends on ARCH_MXS
+       select CRYPTO_SHA1
+       select CRYPTO_SHA256
+       select CRYPTO_CBC
+       select CRYPTO_ECB
+       select CRYPTO_AES
+       select CRYPTO_BLKCIPHER
+       select CRYPTO_ALGAPI
+       help
+         The Freescale i.MX23/i.MX28 has SHA1/SHA256 and AES128 CBC/ECB
+         co-processor on the die.
+
+         To compile this driver as a module, choose M here: the module
+         will be called mxs-dcp.
+
 endif # CRYPTO_HW
index b4946ddd25505ad454960616f792de2e9e71e1ca..0bc6aa0a54d78090fd1b2484e7fe89d01028ae10 100644 (file)
@@ -1,24 +1,25 @@
-obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o
-obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o
+obj-$(CONFIG_CRYPTO_DEV_ATMEL_AES) += atmel-aes.o
+obj-$(CONFIG_CRYPTO_DEV_ATMEL_SHA) += atmel-sha.o
+obj-$(CONFIG_CRYPTO_DEV_ATMEL_TDES) += atmel-tdes.o
+obj-$(CONFIG_CRYPTO_DEV_BFIN_CRC) += bfin_crc.o
+obj-$(CONFIG_CRYPTO_DEV_CCP) += ccp/
+obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM) += caam/
 obj-$(CONFIG_CRYPTO_DEV_GEODE) += geode-aes.o
-obj-$(CONFIG_CRYPTO_DEV_NIAGARA2) += n2_crypto.o
-n2_crypto-y := n2_core.o n2_asm.o
 obj-$(CONFIG_CRYPTO_DEV_HIFN_795X) += hifn_795x.o
-obj-$(CONFIG_CRYPTO_DEV_MV_CESA) += mv_cesa.o
-obj-$(CONFIG_CRYPTO_DEV_TALITOS) += talitos.o
-obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM) += caam/
 obj-$(CONFIG_CRYPTO_DEV_IXP4XX) += ixp4xx_crypto.o
-obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += amcc/
-obj-$(CONFIG_CRYPTO_DEV_OMAP_SHAM) += omap-sham.o
+obj-$(CONFIG_CRYPTO_DEV_MV_CESA) += mv_cesa.o
+obj-$(CONFIG_CRYPTO_DEV_MXS_DCP) += mxs-dcp.o
+obj-$(CONFIG_CRYPTO_DEV_NIAGARA2) += n2_crypto.o
+n2_crypto-y := n2_core.o n2_asm.o
+obj-$(CONFIG_CRYPTO_DEV_NX) += nx/
 obj-$(CONFIG_CRYPTO_DEV_OMAP_AES) += omap-aes.o
+obj-$(CONFIG_CRYPTO_DEV_OMAP_SHAM) += omap-sham.o
+obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o
+obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o
 obj-$(CONFIG_CRYPTO_DEV_PICOXCELL) += picoxcell_crypto.o
-obj-$(CONFIG_CRYPTO_DEV_SAHARA) += sahara.o
-obj-$(CONFIG_CRYPTO_DEV_DCP) += dcp.o
+obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += amcc/
 obj-$(CONFIG_CRYPTO_DEV_S5P) += s5p-sss.o
+obj-$(CONFIG_CRYPTO_DEV_SAHARA) += sahara.o
+obj-$(CONFIG_CRYPTO_DEV_TALITOS) += talitos.o
 obj-$(CONFIG_CRYPTO_DEV_TEGRA_AES) += tegra-aes.o
 obj-$(CONFIG_CRYPTO_DEV_UX500) += ux500/
-obj-$(CONFIG_CRYPTO_DEV_BFIN_CRC) += bfin_crc.o
-obj-$(CONFIG_CRYPTO_DEV_NX) += nx/
-obj-$(CONFIG_CRYPTO_DEV_ATMEL_AES) += atmel-aes.o
-obj-$(CONFIG_CRYPTO_DEV_ATMEL_TDES) += atmel-tdes.o
-obj-$(CONFIG_CRYPTO_DEV_ATMEL_SHA) += atmel-sha.o
index efaf6302405fde5a25c27072684c5c4589af0d1c..37f9cc98ba171db75c07c24975e74819c4e272cb 100644 (file)
@@ -724,7 +724,6 @@ static void crypto4xx_stop_all(struct crypto4xx_core_device *core_dev)
        crypto4xx_destroy_pdr(core_dev->dev);
        crypto4xx_destroy_gdr(core_dev->dev);
        crypto4xx_destroy_sdr(core_dev->dev);
-       dev_set_drvdata(core_dev->device, NULL);
        iounmap(core_dev->dev->ce_base);
        kfree(core_dev->dev);
        kfree(core_dev);
index c1efd910d97b0a663a06d8f5c50fa75bfdda878b..d7c9e317423cb2910e808571584ef3c4cd0bd84e 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/irq.h>
 #include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
+#include <linux/of_device.h>
 #include <linux/delay.h>
 #include <linux/crypto.h>
 #include <linux/cryptohash.h>
@@ -39,6 +40,7 @@
 #include <crypto/hash.h>
 #include <crypto/internal/hash.h>
 #include <linux/platform_data/crypto-atmel.h>
+#include <dt-bindings/dma/at91.h>
 #include "atmel-aes-regs.h"
 
 #define CFB8_BLOCK_SIZE                1
@@ -747,59 +749,50 @@ static int atmel_aes_dma_init(struct atmel_aes_dev *dd,
        struct crypto_platform_data *pdata)
 {
        int err = -ENOMEM;
-       dma_cap_mask_t mask_in, mask_out;
+       dma_cap_mask_t mask;
+
+       dma_cap_zero(mask);
+       dma_cap_set(DMA_SLAVE, mask);
+
+       /* Try to grab 2 DMA channels */
+       dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask,
+                       atmel_aes_filter, &pdata->dma_slave->rxdata, dd->dev, "tx");
+       if (!dd->dma_lch_in.chan)
+               goto err_dma_in;
+
+       dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
+       dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
+               AES_IDATAR(0);
+       dd->dma_lch_in.dma_conf.src_maxburst = dd->caps.max_burst_size;
+       dd->dma_lch_in.dma_conf.src_addr_width =
+               DMA_SLAVE_BUSWIDTH_4_BYTES;
+       dd->dma_lch_in.dma_conf.dst_maxburst = dd->caps.max_burst_size;
+       dd->dma_lch_in.dma_conf.dst_addr_width =
+               DMA_SLAVE_BUSWIDTH_4_BYTES;
+       dd->dma_lch_in.dma_conf.device_fc = false;
+
+       dd->dma_lch_out.chan = dma_request_slave_channel_compat(mask,
+                       atmel_aes_filter, &pdata->dma_slave->txdata, dd->dev, "rx");
+       if (!dd->dma_lch_out.chan)
+               goto err_dma_out;
+
+       dd->dma_lch_out.dma_conf.direction = DMA_DEV_TO_MEM;
+       dd->dma_lch_out.dma_conf.src_addr = dd->phys_base +
+               AES_ODATAR(0);
+       dd->dma_lch_out.dma_conf.src_maxburst = dd->caps.max_burst_size;
+       dd->dma_lch_out.dma_conf.src_addr_width =
+               DMA_SLAVE_BUSWIDTH_4_BYTES;
+       dd->dma_lch_out.dma_conf.dst_maxburst = dd->caps.max_burst_size;
+       dd->dma_lch_out.dma_conf.dst_addr_width =
+               DMA_SLAVE_BUSWIDTH_4_BYTES;
+       dd->dma_lch_out.dma_conf.device_fc = false;
 
-       if (pdata && pdata->dma_slave->txdata.dma_dev &&
-               pdata->dma_slave->rxdata.dma_dev) {
-
-               /* Try to grab 2 DMA channels */
-               dma_cap_zero(mask_in);
-               dma_cap_set(DMA_SLAVE, mask_in);
-
-               dd->dma_lch_in.chan = dma_request_channel(mask_in,
-                               atmel_aes_filter, &pdata->dma_slave->rxdata);
-
-               if (!dd->dma_lch_in.chan)
-                       goto err_dma_in;
-
-               dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
-               dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
-                       AES_IDATAR(0);
-               dd->dma_lch_in.dma_conf.src_maxburst = dd->caps.max_burst_size;
-               dd->dma_lch_in.dma_conf.src_addr_width =
-                       DMA_SLAVE_BUSWIDTH_4_BYTES;
-               dd->dma_lch_in.dma_conf.dst_maxburst = dd->caps.max_burst_size;
-               dd->dma_lch_in.dma_conf.dst_addr_width =
-                       DMA_SLAVE_BUSWIDTH_4_BYTES;
-               dd->dma_lch_in.dma_conf.device_fc = false;
-
-               dma_cap_zero(mask_out);
-               dma_cap_set(DMA_SLAVE, mask_out);
-               dd->dma_lch_out.chan = dma_request_channel(mask_out,
-                               atmel_aes_filter, &pdata->dma_slave->txdata);
-
-               if (!dd->dma_lch_out.chan)
-                       goto err_dma_out;
-
-               dd->dma_lch_out.dma_conf.direction = DMA_DEV_TO_MEM;
-               dd->dma_lch_out.dma_conf.src_addr = dd->phys_base +
-                       AES_ODATAR(0);
-               dd->dma_lch_out.dma_conf.src_maxburst = dd->caps.max_burst_size;
-               dd->dma_lch_out.dma_conf.src_addr_width =
-                       DMA_SLAVE_BUSWIDTH_4_BYTES;
-               dd->dma_lch_out.dma_conf.dst_maxburst = dd->caps.max_burst_size;
-               dd->dma_lch_out.dma_conf.dst_addr_width =
-                       DMA_SLAVE_BUSWIDTH_4_BYTES;
-               dd->dma_lch_out.dma_conf.device_fc = false;
-
-               return 0;
-       } else {
-               return -ENODEV;
-       }
+       return 0;
 
 err_dma_out:
        dma_release_channel(dd->dma_lch_in.chan);
 err_dma_in:
+       dev_warn(dd->dev, "no DMA channel available\n");
        return err;
 }
 
@@ -1261,6 +1254,47 @@ static void atmel_aes_get_cap(struct atmel_aes_dev *dd)
        }
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_aes_dt_ids[] = {
+       { .compatible = "atmel,at91sam9g46-aes" },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, atmel_aes_dt_ids);
+
+static struct crypto_platform_data *atmel_aes_of_init(struct platform_device *pdev)
+{
+       struct device_node *np = pdev->dev.of_node;
+       struct crypto_platform_data *pdata;
+
+       if (!np) {
+               dev_err(&pdev->dev, "device node not found\n");
+               return ERR_PTR(-EINVAL);
+       }
+
+       pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+       if (!pdata) {
+               dev_err(&pdev->dev, "could not allocate memory for pdata\n");
+               return ERR_PTR(-ENOMEM);
+       }
+
+       pdata->dma_slave = devm_kzalloc(&pdev->dev,
+                                       sizeof(*(pdata->dma_slave)),
+                                       GFP_KERNEL);
+       if (!pdata->dma_slave) {
+               dev_err(&pdev->dev, "could not allocate memory for dma_slave\n");
+               devm_kfree(&pdev->dev, pdata);
+               return ERR_PTR(-ENOMEM);
+       }
+
+       return pdata;
+}
+#else
+static inline struct crypto_platform_data *atmel_aes_of_init(struct platform_device *pdev)
+{
+       return ERR_PTR(-EINVAL);
+}
+#endif
+
 static int atmel_aes_probe(struct platform_device *pdev)
 {
        struct atmel_aes_dev *aes_dd;
@@ -1272,6 +1306,14 @@ static int atmel_aes_probe(struct platform_device *pdev)
 
        pdata = pdev->dev.platform_data;
        if (!pdata) {
+               pdata = atmel_aes_of_init(pdev);
+               if (IS_ERR(pdata)) {
+                       err = PTR_ERR(pdata);
+                       goto aes_dd_err;
+               }
+       }
+
+       if (!pdata->dma_slave) {
                err = -ENXIO;
                goto aes_dd_err;
        }
@@ -1358,7 +1400,9 @@ static int atmel_aes_probe(struct platform_device *pdev)
        if (err)
                goto err_algs;
 
-       dev_info(dev, "Atmel AES\n");
+       dev_info(dev, "Atmel AES - Using %s, %s for DMA transfers\n",
+                       dma_chan_name(aes_dd->dma_lch_in.chan),
+                       dma_chan_name(aes_dd->dma_lch_out.chan));
 
        return 0;
 
@@ -1424,6 +1468,7 @@ static struct platform_driver atmel_aes_driver = {
        .driver         = {
                .name   = "atmel_aes",
                .owner  = THIS_MODULE,
+               .of_match_table = of_match_ptr(atmel_aes_dt_ids),
        },
 };
 
index eaed8bf183bc51e81aeb49d4727301abe8a028d8..0618be06b9fb2402fb6b2ed6238e8d910ef19d9a 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/irq.h>
 #include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
+#include <linux/of_device.h>
 #include <linux/delay.h>
 #include <linux/crypto.h>
 #include <linux/cryptohash.h>
@@ -1263,32 +1264,29 @@ static int atmel_sha_dma_init(struct atmel_sha_dev *dd,
        int err = -ENOMEM;
        dma_cap_mask_t mask_in;
 
-       if (pdata && pdata->dma_slave->rxdata.dma_dev) {
-               /* Try to grab DMA channel */
-               dma_cap_zero(mask_in);
-               dma_cap_set(DMA_SLAVE, mask_in);
+       /* Try to grab DMA channel */
+       dma_cap_zero(mask_in);
+       dma_cap_set(DMA_SLAVE, mask_in);
 
-               dd->dma_lch_in.chan = dma_request_channel(mask_in,
-                               atmel_sha_filter, &pdata->dma_slave->rxdata);
-
-               if (!dd->dma_lch_in.chan)
-                       return err;
-
-               dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
-               dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
-                       SHA_REG_DIN(0);
-               dd->dma_lch_in.dma_conf.src_maxburst = 1;
-               dd->dma_lch_in.dma_conf.src_addr_width =
-                       DMA_SLAVE_BUSWIDTH_4_BYTES;
-               dd->dma_lch_in.dma_conf.dst_maxburst = 1;
-               dd->dma_lch_in.dma_conf.dst_addr_width =
-                       DMA_SLAVE_BUSWIDTH_4_BYTES;
-               dd->dma_lch_in.dma_conf.device_fc = false;
-
-               return 0;
+       dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask_in,
+                       atmel_sha_filter, &pdata->dma_slave->rxdata, dd->dev, "tx");
+       if (!dd->dma_lch_in.chan) {
+               dev_warn(dd->dev, "no DMA channel available\n");
+               return err;
        }
 
-       return -ENODEV;
+       dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
+       dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
+               SHA_REG_DIN(0);
+       dd->dma_lch_in.dma_conf.src_maxburst = 1;
+       dd->dma_lch_in.dma_conf.src_addr_width =
+               DMA_SLAVE_BUSWIDTH_4_BYTES;
+       dd->dma_lch_in.dma_conf.dst_maxburst = 1;
+       dd->dma_lch_in.dma_conf.dst_addr_width =
+               DMA_SLAVE_BUSWIDTH_4_BYTES;
+       dd->dma_lch_in.dma_conf.device_fc = false;
+
+       return 0;
 }
 
 static void atmel_sha_dma_cleanup(struct atmel_sha_dev *dd)
@@ -1326,6 +1324,48 @@ static void atmel_sha_get_cap(struct atmel_sha_dev *dd)
        }
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_sha_dt_ids[] = {
+       { .compatible = "atmel,at91sam9g46-sha" },
+       { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_sha_dt_ids);
+
+static struct crypto_platform_data *atmel_sha_of_init(struct platform_device *pdev)
+{
+       struct device_node *np = pdev->dev.of_node;
+       struct crypto_platform_data *pdata;
+
+       if (!np) {
+               dev_err(&pdev->dev, "device node not found\n");
+               return ERR_PTR(-EINVAL);
+       }
+
+       pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+       if (!pdata) {
+               dev_err(&pdev->dev, "could not allocate memory for pdata\n");
+               return ERR_PTR(-ENOMEM);
+       }
+
+       pdata->dma_slave = devm_kzalloc(&pdev->dev,
+                                       sizeof(*(pdata->dma_slave)),
+                                       GFP_KERNEL);
+       if (!pdata->dma_slave) {
+               dev_err(&pdev->dev, "could not allocate memory for dma_slave\n");
+               devm_kfree(&pdev->dev, pdata);
+               return ERR_PTR(-ENOMEM);
+       }
+
+       return pdata;
+}
+#else /* CONFIG_OF */
+static inline struct crypto_platform_data *atmel_sha_of_init(struct platform_device *dev)
+{
+       return ERR_PTR(-EINVAL);
+}
+#endif
+
 static int atmel_sha_probe(struct platform_device *pdev)
 {
        struct atmel_sha_dev *sha_dd;
@@ -1402,13 +1442,23 @@ static int atmel_sha_probe(struct platform_device *pdev)
        if (sha_dd->caps.has_dma) {
                pdata = pdev->dev.platform_data;
                if (!pdata) {
-                       dev_err(&pdev->dev, "platform data not available\n");
+                       pdata = atmel_sha_of_init(pdev);
+                       if (IS_ERR(pdata)) {
+                               dev_err(&pdev->dev, "platform data not available\n");
+                               err = PTR_ERR(pdata);
+                               goto err_pdata;
+                       }
+               }
+               if (!pdata->dma_slave) {
                        err = -ENXIO;
                        goto err_pdata;
                }
                err = atmel_sha_dma_init(sha_dd, pdata);
                if (err)
                        goto err_sha_dma;
+
+               dev_info(dev, "using %s for DMA transfers\n",
+                               dma_chan_name(sha_dd->dma_lch_in.chan));
        }
 
        spin_lock(&atmel_sha.lock);
@@ -1419,7 +1469,9 @@ static int atmel_sha_probe(struct platform_device *pdev)
        if (err)
                goto err_algs;
 
-       dev_info(dev, "Atmel SHA1/SHA256\n");
+       dev_info(dev, "Atmel SHA1/SHA256%s%s\n",
+                       sha_dd->caps.has_sha224 ? "/SHA224" : "",
+                       sha_dd->caps.has_sha_384_512 ? "/SHA384/SHA512" : "");
 
        return 0;
 
@@ -1483,6 +1535,7 @@ static struct platform_driver atmel_sha_driver = {
        .driver         = {
                .name   = "atmel_sha",
                .owner  = THIS_MODULE,
+               .of_match_table = of_match_ptr(atmel_sha_dt_ids),
        },
 };
 
index 4a99564a08e68d6577be82f42d3eb4762281235c..6cde5b530c69f6fb487d53b055efcd6797495211 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/irq.h>
 #include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
+#include <linux/of_device.h>
 #include <linux/delay.h>
 #include <linux/crypto.h>
 #include <linux/cryptohash.h>
@@ -716,59 +717,50 @@ static int atmel_tdes_dma_init(struct atmel_tdes_dev *dd,
                        struct crypto_platform_data *pdata)
 {
        int err = -ENOMEM;
-       dma_cap_mask_t mask_in, mask_out;
+       dma_cap_mask_t mask;
+
+       dma_cap_zero(mask);
+       dma_cap_set(DMA_SLAVE, mask);
+
+       /* Try to grab 2 DMA channels */
+       dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask,
+                       atmel_tdes_filter, &pdata->dma_slave->rxdata, dd->dev, "tx");
+       if (!dd->dma_lch_in.chan)
+               goto err_dma_in;
+
+       dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
+       dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
+               TDES_IDATA1R;
+       dd->dma_lch_in.dma_conf.src_maxburst = 1;
+       dd->dma_lch_in.dma_conf.src_addr_width =
+               DMA_SLAVE_BUSWIDTH_4_BYTES;
+       dd->dma_lch_in.dma_conf.dst_maxburst = 1;
+       dd->dma_lch_in.dma_conf.dst_addr_width =
+               DMA_SLAVE_BUSWIDTH_4_BYTES;
+       dd->dma_lch_in.dma_conf.device_fc = false;
+
+       dd->dma_lch_out.chan = dma_request_slave_channel_compat(mask,
+                       atmel_tdes_filter, &pdata->dma_slave->txdata, dd->dev, "rx");
+       if (!dd->dma_lch_out.chan)
+               goto err_dma_out;
+
+       dd->dma_lch_out.dma_conf.direction = DMA_DEV_TO_MEM;
+       dd->dma_lch_out.dma_conf.src_addr = dd->phys_base +
+               TDES_ODATA1R;
+       dd->dma_lch_out.dma_conf.src_maxburst = 1;
+       dd->dma_lch_out.dma_conf.src_addr_width =
+               DMA_SLAVE_BUSWIDTH_4_BYTES;
+       dd->dma_lch_out.dma_conf.dst_maxburst = 1;
+       dd->dma_lch_out.dma_conf.dst_addr_width =
+               DMA_SLAVE_BUSWIDTH_4_BYTES;
+       dd->dma_lch_out.dma_conf.device_fc = false;
 
-       if (pdata && pdata->dma_slave->txdata.dma_dev &&
-               pdata->dma_slave->rxdata.dma_dev) {
-
-               /* Try to grab 2 DMA channels */
-               dma_cap_zero(mask_in);
-               dma_cap_set(DMA_SLAVE, mask_in);
-
-               dd->dma_lch_in.chan = dma_request_channel(mask_in,
-                               atmel_tdes_filter, &pdata->dma_slave->rxdata);
-
-               if (!dd->dma_lch_in.chan)
-                       goto err_dma_in;
-
-               dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV;
-               dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base +
-                       TDES_IDATA1R;
-               dd->dma_lch_in.dma_conf.src_maxburst = 1;
-               dd->dma_lch_in.dma_conf.src_addr_width =
-                       DMA_SLAVE_BUSWIDTH_4_BYTES;
-               dd->dma_lch_in.dma_conf.dst_maxburst = 1;
-               dd->dma_lch_in.dma_conf.dst_addr_width =
-                       DMA_SLAVE_BUSWIDTH_4_BYTES;
-               dd->dma_lch_in.dma_conf.device_fc = false;
-
-               dma_cap_zero(mask_out);
-               dma_cap_set(DMA_SLAVE, mask_out);
-               dd->dma_lch_out.chan = dma_request_channel(mask_out,
-                               atmel_tdes_filter, &pdata->dma_slave->txdata);
-
-               if (!dd->dma_lch_out.chan)
-                       goto err_dma_out;
-
-               dd->dma_lch_out.dma_conf.direction = DMA_DEV_TO_MEM;
-               dd->dma_lch_out.dma_conf.src_addr = dd->phys_base +
-                       TDES_ODATA1R;
-               dd->dma_lch_out.dma_conf.src_maxburst = 1;
-               dd->dma_lch_out.dma_conf.src_addr_width =
-                       DMA_SLAVE_BUSWIDTH_4_BYTES;
-               dd->dma_lch_out.dma_conf.dst_maxburst = 1;
-               dd->dma_lch_out.dma_conf.dst_addr_width =
-                       DMA_SLAVE_BUSWIDTH_4_BYTES;
-               dd->dma_lch_out.dma_conf.device_fc = false;
-
-               return 0;
-       } else {
-               return -ENODEV;
-       }
+       return 0;
 
 err_dma_out:
        dma_release_channel(dd->dma_lch_in.chan);
 err_dma_in:
+       dev_warn(dd->dev, "no DMA channel available\n");
        return err;
 }
 
@@ -1317,6 +1309,47 @@ static void atmel_tdes_get_cap(struct atmel_tdes_dev *dd)
        }
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_tdes_dt_ids[] = {
+       { .compatible = "atmel,at91sam9g46-tdes" },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, atmel_tdes_dt_ids);
+
+static struct crypto_platform_data *atmel_tdes_of_init(struct platform_device *pdev)
+{
+       struct device_node *np = pdev->dev.of_node;
+       struct crypto_platform_data *pdata;
+
+       if (!np) {
+               dev_err(&pdev->dev, "device node not found\n");
+               return ERR_PTR(-EINVAL);
+       }
+
+       pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+       if (!pdata) {
+               dev_err(&pdev->dev, "could not allocate memory for pdata\n");
+               return ERR_PTR(-ENOMEM);
+       }
+
+       pdata->dma_slave = devm_kzalloc(&pdev->dev,
+                                       sizeof(*(pdata->dma_slave)),
+                                       GFP_KERNEL);
+       if (!pdata->dma_slave) {
+               dev_err(&pdev->dev, "could not allocate memory for dma_slave\n");
+               devm_kfree(&pdev->dev, pdata);
+               return ERR_PTR(-ENOMEM);
+       }
+
+       return pdata;
+}
+#else /* CONFIG_OF */
+static inline struct crypto_platform_data *atmel_tdes_of_init(struct platform_device *pdev)
+{
+       return ERR_PTR(-EINVAL);
+}
+#endif
+
 static int atmel_tdes_probe(struct platform_device *pdev)
 {
        struct atmel_tdes_dev *tdes_dd;
@@ -1399,13 +1432,24 @@ static int atmel_tdes_probe(struct platform_device *pdev)
        if (tdes_dd->caps.has_dma) {
                pdata = pdev->dev.platform_data;
                if (!pdata) {
-                       dev_err(&pdev->dev, "platform data not available\n");
+                       pdata = atmel_tdes_of_init(pdev);
+                       if (IS_ERR(pdata)) {
+                               dev_err(&pdev->dev, "platform data not available\n");
+                               err = PTR_ERR(pdata);
+                               goto err_pdata;
+                       }
+               }
+               if (!pdata->dma_slave) {
                        err = -ENXIO;
                        goto err_pdata;
                }
                err = atmel_tdes_dma_init(tdes_dd, pdata);
                if (err)
                        goto err_tdes_dma;
+
+               dev_info(dev, "using %s, %s for DMA transfers\n",
+                               dma_chan_name(tdes_dd->dma_lch_in.chan),
+                               dma_chan_name(tdes_dd->dma_lch_out.chan));
        }
 
        spin_lock(&atmel_tdes.lock);
@@ -1487,6 +1531,7 @@ static struct platform_driver atmel_tdes_driver = {
        .driver         = {
                .name   = "atmel_tdes",
                .owner  = THIS_MODULE,
+               .of_match_table = of_match_ptr(atmel_tdes_dt_ids),
        },
 };
 
index 4cf5dec826e1e283aa8b5991cd1a4b80a0dbdba6..b71f2fd749df02de9a1f06a5c444ec33d4d72b11 100644 (file)
@@ -467,24 +467,10 @@ static int aead_setkey(struct crypto_aead *aead,
        static const u8 mdpadlen[] = { 16, 20, 32, 32, 64, 64 };
        struct caam_ctx *ctx = crypto_aead_ctx(aead);
        struct device *jrdev = ctx->jrdev;
-       struct rtattr *rta = (void *)key;
-       struct crypto_authenc_key_param *param;
-       unsigned int authkeylen;
-       unsigned int enckeylen;
+       struct crypto_authenc_keys keys;
        int ret = 0;
 
-       param = RTA_DATA(rta);
-       enckeylen = be32_to_cpu(param->enckeylen);
-
-       key += RTA_ALIGN(rta->rta_len);
-       keylen -= RTA_ALIGN(rta->rta_len);
-
-       if (keylen < enckeylen)
-               goto badkey;
-
-       authkeylen = keylen - enckeylen;
-
-       if (keylen > CAAM_MAX_KEY_SIZE)
+       if (crypto_authenc_extractkeys(&keys, key, keylen) != 0)
                goto badkey;
 
        /* Pick class 2 key length from algorithm submask */
@@ -492,25 +478,29 @@ static int aead_setkey(struct crypto_aead *aead,
                                      OP_ALG_ALGSEL_SHIFT] * 2;
        ctx->split_key_pad_len = ALIGN(ctx->split_key_len, 16);
 
+       if (ctx->split_key_pad_len + keys.enckeylen > CAAM_MAX_KEY_SIZE)
+               goto badkey;
+
 #ifdef DEBUG
        printk(KERN_ERR "keylen %d enckeylen %d authkeylen %d\n",
-              keylen, enckeylen, authkeylen);
+              keys.authkeylen + keys.enckeylen, keys.enckeylen,
+              keys.authkeylen);
        printk(KERN_ERR "split_key_len %d split_key_pad_len %d\n",
               ctx->split_key_len, ctx->split_key_pad_len);
        print_hex_dump(KERN_ERR, "key in @"__stringify(__LINE__)": ",
                       DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
 #endif
 
-       ret = gen_split_aead_key(ctx, keyauthkeylen);
+       ret = gen_split_aead_key(ctx, keys.authkey, keys.authkeylen);
        if (ret) {
                goto badkey;
        }
 
        /* postpend encryption key to auth split key */
-       memcpy(ctx->key + ctx->split_key_pad_len, key + authkeylen, enckeylen);
+       memcpy(ctx->key + ctx->split_key_pad_len, keys.enckey, keys.enckeylen);
 
        ctx->key_dma = dma_map_single(jrdev, ctx->key, ctx->split_key_pad_len +
-                                      enckeylen, DMA_TO_DEVICE);
+                                     keys.enckeylen, DMA_TO_DEVICE);
        if (dma_mapping_error(jrdev, ctx->key_dma)) {
                dev_err(jrdev, "unable to map key i/o memory\n");
                return -ENOMEM;
@@ -518,15 +508,15 @@ static int aead_setkey(struct crypto_aead *aead,
 #ifdef DEBUG
        print_hex_dump(KERN_ERR, "ctx.key@"__stringify(__LINE__)": ",
                       DUMP_PREFIX_ADDRESS, 16, 4, ctx->key,
-                      ctx->split_key_pad_len + enckeylen, 1);
+                      ctx->split_key_pad_len + keys.enckeylen, 1);
 #endif
 
-       ctx->enckeylen = enckeylen;
+       ctx->enckeylen = keys.enckeylen;
 
        ret = aead_set_sh_desc(aead);
        if (ret) {
                dma_unmap_single(jrdev, ctx->key_dma, ctx->split_key_pad_len +
-                                enckeylen, DMA_TO_DEVICE);
+                                keys.enckeylen, DMA_TO_DEVICE);
        }
 
        return ret;
diff --git a/drivers/crypto/ccp/Kconfig b/drivers/crypto/ccp/Kconfig
new file mode 100644 (file)
index 0000000..7639ffc
--- /dev/null
@@ -0,0 +1,24 @@
+config CRYPTO_DEV_CCP_DD
+       tristate "Cryptographic Coprocessor device driver"
+       depends on CRYPTO_DEV_CCP
+       default m
+       select HW_RANDOM
+       help
+         Provides the interface to use the AMD Cryptographic Coprocessor
+         which can be used to accelerate or offload encryption operations
+         such as SHA, AES and more. If you choose 'M' here, this module
+         will be called ccp.
+
+config CRYPTO_DEV_CCP_CRYPTO
+       tristate "Encryption and hashing acceleration support"
+       depends on CRYPTO_DEV_CCP_DD
+       default m
+       select CRYPTO_ALGAPI
+       select CRYPTO_HASH
+       select CRYPTO_BLKCIPHER
+       select CRYPTO_AUTHENC
+       help
+         Support for using the cryptographic API with the AMD Cryptographic
+         Coprocessor. This module supports acceleration and offload of SHA
+         and AES algorithms.  If you choose 'M' here, this module will be
+         called ccp_crypto.
diff --git a/drivers/crypto/ccp/Makefile b/drivers/crypto/ccp/Makefile
new file mode 100644 (file)
index 0000000..d3505a0
--- /dev/null
@@ -0,0 +1,10 @@
+obj-$(CONFIG_CRYPTO_DEV_CCP_DD) += ccp.o
+ccp-objs := ccp-dev.o ccp-ops.o
+ccp-objs += ccp-pci.o
+
+obj-$(CONFIG_CRYPTO_DEV_CCP_CRYPTO) += ccp-crypto.o
+ccp-crypto-objs := ccp-crypto-main.o \
+                  ccp-crypto-aes.o \
+                  ccp-crypto-aes-cmac.o \
+                  ccp-crypto-aes-xts.o \
+                  ccp-crypto-sha.o
diff --git a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
new file mode 100644 (file)
index 0000000..8e162ad
--- /dev/null
@@ -0,0 +1,365 @@
+/*
+ * AMD Cryptographic Coprocessor (CCP) AES CMAC crypto API support
+ *
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Tom Lendacky <thomas.lendacky@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/delay.h>
+#include <linux/scatterlist.h>
+#include <linux/crypto.h>
+#include <crypto/algapi.h>
+#include <crypto/aes.h>
+#include <crypto/hash.h>
+#include <crypto/internal/hash.h>
+#include <crypto/scatterwalk.h>
+
+#include "ccp-crypto.h"
+
+
+static int ccp_aes_cmac_complete(struct crypto_async_request *async_req,
+                                int ret)
+{
+       struct ahash_request *req = ahash_request_cast(async_req);
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
+       struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req);
+       unsigned int digest_size = crypto_ahash_digestsize(tfm);
+
+       if (ret)
+               goto e_free;
+
+       if (rctx->hash_rem) {
+               /* Save remaining data to buffer */
+               unsigned int offset = rctx->nbytes - rctx->hash_rem;
+               scatterwalk_map_and_copy(rctx->buf, rctx->src,
+                                        offset, rctx->hash_rem, 0);
+               rctx->buf_count = rctx->hash_rem;
+       } else
+               rctx->buf_count = 0;
+
+       /* Update result area if supplied */
+       if (req->result)
+               memcpy(req->result, rctx->iv, digest_size);
+
+e_free:
+       sg_free_table(&rctx->data_sg);
+
+       return ret;
+}
+
+static int ccp_do_cmac_update(struct ahash_request *req, unsigned int nbytes,
+                             unsigned int final)
+{
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
+       struct ccp_ctx *ctx = crypto_ahash_ctx(tfm);
+       struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req);
+       struct scatterlist *sg, *cmac_key_sg = NULL;
+       unsigned int block_size =
+               crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
+       unsigned int need_pad, sg_count;
+       gfp_t gfp;
+       u64 len;
+       int ret;
+
+       if (!ctx->u.aes.key_len)
+               return -EINVAL;
+
+       if (nbytes)
+               rctx->null_msg = 0;
+
+       len = (u64)rctx->buf_count + (u64)nbytes;
+
+       if (!final && (len <= block_size)) {
+               scatterwalk_map_and_copy(rctx->buf + rctx->buf_count, req->src,
+                                        0, nbytes, 0);
+               rctx->buf_count += nbytes;
+
+               return 0;
+       }
+
+       rctx->src = req->src;
+       rctx->nbytes = nbytes;
+
+       rctx->final = final;
+       rctx->hash_rem = final ? 0 : len & (block_size - 1);
+       rctx->hash_cnt = len - rctx->hash_rem;
+       if (!final && !rctx->hash_rem) {
+               /* CCP can't do zero length final, so keep some data around */
+               rctx->hash_cnt -= block_size;
+               rctx->hash_rem = block_size;
+       }
+
+       if (final && (rctx->null_msg || (len & (block_size - 1))))
+               need_pad = 1;
+       else
+               need_pad = 0;
+
+       sg_init_one(&rctx->iv_sg, rctx->iv, sizeof(rctx->iv));
+
+       /* Build the data scatterlist table - allocate enough entries for all
+        * possible data pieces (buffer, input data, padding)
+        */
+       sg_count = (nbytes) ? sg_nents(req->src) + 2 : 2;
+       gfp = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ?
+               GFP_KERNEL : GFP_ATOMIC;
+       ret = sg_alloc_table(&rctx->data_sg, sg_count, gfp);
+       if (ret)
+               return ret;
+
+       sg = NULL;
+       if (rctx->buf_count) {
+               sg_init_one(&rctx->buf_sg, rctx->buf, rctx->buf_count);
+               sg = ccp_crypto_sg_table_add(&rctx->data_sg, &rctx->buf_sg);
+       }
+
+       if (nbytes)
+               sg = ccp_crypto_sg_table_add(&rctx->data_sg, req->src);
+
+       if (need_pad) {
+               int pad_length = block_size - (len & (block_size - 1));
+
+               rctx->hash_cnt += pad_length;
+
+               memset(rctx->pad, 0, sizeof(rctx->pad));
+               rctx->pad[0] = 0x80;
+               sg_init_one(&rctx->pad_sg, rctx->pad, pad_length);
+               sg = ccp_crypto_sg_table_add(&rctx->data_sg, &rctx->pad_sg);
+       }
+       if (sg) {
+               sg_mark_end(sg);
+               sg = rctx->data_sg.sgl;
+       }
+
+       /* Initialize the K1/K2 scatterlist */
+       if (final)
+               cmac_key_sg = (need_pad) ? &ctx->u.aes.k2_sg
+                                        : &ctx->u.aes.k1_sg;
+
+       memset(&rctx->cmd, 0, sizeof(rctx->cmd));
+       INIT_LIST_HEAD(&rctx->cmd.entry);
+       rctx->cmd.engine = CCP_ENGINE_AES;
+       rctx->cmd.u.aes.type = ctx->u.aes.type;
+       rctx->cmd.u.aes.mode = ctx->u.aes.mode;
+       rctx->cmd.u.aes.action = CCP_AES_ACTION_ENCRYPT;
+       rctx->cmd.u.aes.key = &ctx->u.aes.key_sg;
+       rctx->cmd.u.aes.key_len = ctx->u.aes.key_len;
+       rctx->cmd.u.aes.iv = &rctx->iv_sg;
+       rctx->cmd.u.aes.iv_len = AES_BLOCK_SIZE;
+       rctx->cmd.u.aes.src = sg;
+       rctx->cmd.u.aes.src_len = rctx->hash_cnt;
+       rctx->cmd.u.aes.dst = NULL;
+       rctx->cmd.u.aes.cmac_key = cmac_key_sg;
+       rctx->cmd.u.aes.cmac_key_len = ctx->u.aes.kn_len;
+       rctx->cmd.u.aes.cmac_final = final;
+
+       ret = ccp_crypto_enqueue_request(&req->base, &rctx->cmd);
+
+       return ret;
+}
+
+static int ccp_aes_cmac_init(struct ahash_request *req)
+{
+       struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req);
+
+       memset(rctx, 0, sizeof(*rctx));
+
+       rctx->null_msg = 1;
+
+       return 0;
+}
+
+static int ccp_aes_cmac_update(struct ahash_request *req)
+{
+       return ccp_do_cmac_update(req, req->nbytes, 0);
+}
+
+static int ccp_aes_cmac_final(struct ahash_request *req)
+{
+       return ccp_do_cmac_update(req, 0, 1);
+}
+
+static int ccp_aes_cmac_finup(struct ahash_request *req)
+{
+       return ccp_do_cmac_update(req, req->nbytes, 1);
+}
+
+static int ccp_aes_cmac_digest(struct ahash_request *req)
+{
+       int ret;
+
+       ret = ccp_aes_cmac_init(req);
+       if (ret)
+               return ret;
+
+       return ccp_aes_cmac_finup(req);
+}
+
+static int ccp_aes_cmac_setkey(struct crypto_ahash *tfm, const u8 *key,
+                          unsigned int key_len)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(crypto_ahash_tfm(tfm));
+       struct ccp_crypto_ahash_alg *alg =
+               ccp_crypto_ahash_alg(crypto_ahash_tfm(tfm));
+       u64 k0_hi, k0_lo, k1_hi, k1_lo, k2_hi, k2_lo;
+       u64 rb_hi = 0x00, rb_lo = 0x87;
+       __be64 *gk;
+       int ret;
+
+       switch (key_len) {
+       case AES_KEYSIZE_128:
+               ctx->u.aes.type = CCP_AES_TYPE_128;
+               break;
+       case AES_KEYSIZE_192:
+               ctx->u.aes.type = CCP_AES_TYPE_192;
+               break;
+       case AES_KEYSIZE_256:
+               ctx->u.aes.type = CCP_AES_TYPE_256;
+               break;
+       default:
+               crypto_ahash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
+               return -EINVAL;
+       }
+       ctx->u.aes.mode = alg->mode;
+
+       /* Set to zero until complete */
+       ctx->u.aes.key_len = 0;
+
+       /* Set the key for the AES cipher used to generate the keys */
+       ret = crypto_cipher_setkey(ctx->u.aes.tfm_cipher, key, key_len);
+       if (ret)
+               return ret;
+
+       /* Encrypt a block of zeroes - use key area in context */
+       memset(ctx->u.aes.key, 0, sizeof(ctx->u.aes.key));
+       crypto_cipher_encrypt_one(ctx->u.aes.tfm_cipher, ctx->u.aes.key,
+                                 ctx->u.aes.key);
+
+       /* Generate K1 and K2 */
+       k0_hi = be64_to_cpu(*((__be64 *)ctx->u.aes.key));
+       k0_lo = be64_to_cpu(*((__be64 *)ctx->u.aes.key + 1));
+
+       k1_hi = (k0_hi << 1) | (k0_lo >> 63);
+       k1_lo = k0_lo << 1;
+       if (ctx->u.aes.key[0] & 0x80) {
+               k1_hi ^= rb_hi;
+               k1_lo ^= rb_lo;
+       }
+       gk = (__be64 *)ctx->u.aes.k1;
+       *gk = cpu_to_be64(k1_hi);
+       gk++;
+       *gk = cpu_to_be64(k1_lo);
+
+       k2_hi = (k1_hi << 1) | (k1_lo >> 63);
+       k2_lo = k1_lo << 1;
+       if (ctx->u.aes.k1[0] & 0x80) {
+               k2_hi ^= rb_hi;
+               k2_lo ^= rb_lo;
+       }
+       gk = (__be64 *)ctx->u.aes.k2;
+       *gk = cpu_to_be64(k2_hi);
+       gk++;
+       *gk = cpu_to_be64(k2_lo);
+
+       ctx->u.aes.kn_len = sizeof(ctx->u.aes.k1);
+       sg_init_one(&ctx->u.aes.k1_sg, ctx->u.aes.k1, sizeof(ctx->u.aes.k1));
+       sg_init_one(&ctx->u.aes.k2_sg, ctx->u.aes.k2, sizeof(ctx->u.aes.k2));
+
+       /* Save the supplied key */
+       memset(ctx->u.aes.key, 0, sizeof(ctx->u.aes.key));
+       memcpy(ctx->u.aes.key, key, key_len);
+       ctx->u.aes.key_len = key_len;
+       sg_init_one(&ctx->u.aes.key_sg, ctx->u.aes.key, key_len);
+
+       return ret;
+}
+
+static int ccp_aes_cmac_cra_init(struct crypto_tfm *tfm)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(tfm);
+       struct crypto_ahash *ahash = __crypto_ahash_cast(tfm);
+       struct crypto_cipher *cipher_tfm;
+
+       ctx->complete = ccp_aes_cmac_complete;
+       ctx->u.aes.key_len = 0;
+
+       crypto_ahash_set_reqsize(ahash, sizeof(struct ccp_aes_cmac_req_ctx));
+
+       cipher_tfm = crypto_alloc_cipher("aes", 0,
+                       CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK);
+       if (IS_ERR(cipher_tfm)) {
+               pr_warn("could not load aes cipher driver\n");
+               return PTR_ERR(cipher_tfm);
+       }
+       ctx->u.aes.tfm_cipher = cipher_tfm;
+
+       return 0;
+}
+
+static void ccp_aes_cmac_cra_exit(struct crypto_tfm *tfm)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       if (ctx->u.aes.tfm_cipher)
+               crypto_free_cipher(ctx->u.aes.tfm_cipher);
+       ctx->u.aes.tfm_cipher = NULL;
+}
+
+int ccp_register_aes_cmac_algs(struct list_head *head)
+{
+       struct ccp_crypto_ahash_alg *ccp_alg;
+       struct ahash_alg *alg;
+       struct hash_alg_common *halg;
+       struct crypto_alg *base;
+       int ret;
+
+       ccp_alg = kzalloc(sizeof(*ccp_alg), GFP_KERNEL);
+       if (!ccp_alg)
+               return -ENOMEM;
+
+       INIT_LIST_HEAD(&ccp_alg->entry);
+       ccp_alg->mode = CCP_AES_MODE_CMAC;
+
+       alg = &ccp_alg->alg;
+       alg->init = ccp_aes_cmac_init;
+       alg->update = ccp_aes_cmac_update;
+       alg->final = ccp_aes_cmac_final;
+       alg->finup = ccp_aes_cmac_finup;
+       alg->digest = ccp_aes_cmac_digest;
+       alg->setkey = ccp_aes_cmac_setkey;
+
+       halg = &alg->halg;
+       halg->digestsize = AES_BLOCK_SIZE;
+
+       base = &halg->base;
+       snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "cmac(aes)");
+       snprintf(base->cra_driver_name, CRYPTO_MAX_ALG_NAME, "cmac-aes-ccp");
+       base->cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC |
+                         CRYPTO_ALG_KERN_DRIVER_ONLY |
+                         CRYPTO_ALG_NEED_FALLBACK;
+       base->cra_blocksize = AES_BLOCK_SIZE;
+       base->cra_ctxsize = sizeof(struct ccp_ctx);
+       base->cra_priority = CCP_CRA_PRIORITY;
+       base->cra_type = &crypto_ahash_type;
+       base->cra_init = ccp_aes_cmac_cra_init;
+       base->cra_exit = ccp_aes_cmac_cra_exit;
+       base->cra_module = THIS_MODULE;
+
+       ret = crypto_register_ahash(alg);
+       if (ret) {
+               pr_err("%s ahash algorithm registration error (%d)\n",
+                       base->cra_name, ret);
+               kfree(ccp_alg);
+               return ret;
+       }
+
+       list_add(&ccp_alg->entry, head);
+
+       return 0;
+}
diff --git a/drivers/crypto/ccp/ccp-crypto-aes-xts.c b/drivers/crypto/ccp/ccp-crypto-aes-xts.c
new file mode 100644 (file)
index 0000000..0237ab5
--- /dev/null
@@ -0,0 +1,279 @@
+/*
+ * AMD Cryptographic Coprocessor (CCP) AES XTS crypto API support
+ *
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Tom Lendacky <thomas.lendacky@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/delay.h>
+#include <linux/scatterlist.h>
+#include <linux/crypto.h>
+#include <crypto/algapi.h>
+#include <crypto/aes.h>
+#include <crypto/scatterwalk.h>
+
+#include "ccp-crypto.h"
+
+
+struct ccp_aes_xts_def {
+       const char *name;
+       const char *drv_name;
+};
+
+static struct ccp_aes_xts_def aes_xts_algs[] = {
+       {
+               .name           = "xts(aes)",
+               .drv_name       = "xts-aes-ccp",
+       },
+};
+
+struct ccp_unit_size_map {
+       unsigned int size;
+       u32 value;
+};
+
+static struct ccp_unit_size_map unit_size_map[] = {
+       {
+               .size   = 4096,
+               .value  = CCP_XTS_AES_UNIT_SIZE_4096,
+       },
+       {
+               .size   = 2048,
+               .value  = CCP_XTS_AES_UNIT_SIZE_2048,
+       },
+       {
+               .size   = 1024,
+               .value  = CCP_XTS_AES_UNIT_SIZE_1024,
+       },
+       {
+               .size   = 512,
+               .value  = CCP_XTS_AES_UNIT_SIZE_512,
+       },
+       {
+               .size   = 256,
+               .value  = CCP_XTS_AES_UNIT_SIZE__LAST,
+       },
+       {
+               .size   = 128,
+               .value  = CCP_XTS_AES_UNIT_SIZE__LAST,
+       },
+       {
+               .size   = 64,
+               .value  = CCP_XTS_AES_UNIT_SIZE__LAST,
+       },
+       {
+               .size   = 32,
+               .value  = CCP_XTS_AES_UNIT_SIZE__LAST,
+       },
+       {
+               .size   = 16,
+               .value  = CCP_XTS_AES_UNIT_SIZE_16,
+       },
+       {
+               .size   = 1,
+               .value  = CCP_XTS_AES_UNIT_SIZE__LAST,
+       },
+};
+
+static int ccp_aes_xts_complete(struct crypto_async_request *async_req, int ret)
+{
+       struct ablkcipher_request *req = ablkcipher_request_cast(async_req);
+       struct ccp_aes_req_ctx *rctx = ablkcipher_request_ctx(req);
+
+       if (ret)
+               return ret;
+
+       memcpy(req->info, rctx->iv, AES_BLOCK_SIZE);
+
+       return 0;
+}
+
+static int ccp_aes_xts_setkey(struct crypto_ablkcipher *tfm, const u8 *key,
+                             unsigned int key_len)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(crypto_ablkcipher_tfm(tfm));
+
+       /* Only support 128-bit AES key with a 128-bit Tweak key,
+        * otherwise use the fallback
+        */
+       switch (key_len) {
+       case AES_KEYSIZE_128 * 2:
+               memcpy(ctx->u.aes.key, key, key_len);
+               break;
+       }
+       ctx->u.aes.key_len = key_len / 2;
+       sg_init_one(&ctx->u.aes.key_sg, ctx->u.aes.key, key_len);
+
+       return crypto_ablkcipher_setkey(ctx->u.aes.tfm_ablkcipher, key,
+                                       key_len);
+}
+
+static int ccp_aes_xts_crypt(struct ablkcipher_request *req,
+                            unsigned int encrypt)
+{
+       struct crypto_tfm *tfm =
+               crypto_ablkcipher_tfm(crypto_ablkcipher_reqtfm(req));
+       struct ccp_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
+       struct ccp_aes_req_ctx *rctx = ablkcipher_request_ctx(req);
+       unsigned int unit;
+       int ret;
+
+       if (!ctx->u.aes.key_len)
+               return -EINVAL;
+
+       if (req->nbytes & (AES_BLOCK_SIZE - 1))
+               return -EINVAL;
+
+       if (!req->info)
+               return -EINVAL;
+
+       for (unit = 0; unit < ARRAY_SIZE(unit_size_map); unit++)
+               if (!(req->nbytes & (unit_size_map[unit].size - 1)))
+                       break;
+
+       if ((unit_size_map[unit].value == CCP_XTS_AES_UNIT_SIZE__LAST) ||
+           (ctx->u.aes.key_len != AES_KEYSIZE_128)) {
+               /* Use the fallback to process the request for any
+                * unsupported unit sizes or key sizes
+                */
+               ablkcipher_request_set_tfm(req, ctx->u.aes.tfm_ablkcipher);
+               ret = (encrypt) ? crypto_ablkcipher_encrypt(req) :
+                                 crypto_ablkcipher_decrypt(req);
+               ablkcipher_request_set_tfm(req, __crypto_ablkcipher_cast(tfm));
+
+               return ret;
+       }
+
+       memcpy(rctx->iv, req->info, AES_BLOCK_SIZE);
+       sg_init_one(&rctx->iv_sg, rctx->iv, AES_BLOCK_SIZE);
+
+       memset(&rctx->cmd, 0, sizeof(rctx->cmd));
+       INIT_LIST_HEAD(&rctx->cmd.entry);
+       rctx->cmd.engine = CCP_ENGINE_XTS_AES_128;
+       rctx->cmd.u.xts.action = (encrypt) ? CCP_AES_ACTION_ENCRYPT
+                                          : CCP_AES_ACTION_DECRYPT;
+       rctx->cmd.u.xts.unit_size = unit_size_map[unit].value;
+       rctx->cmd.u.xts.key = &ctx->u.aes.key_sg;
+       rctx->cmd.u.xts.key_len = ctx->u.aes.key_len;
+       rctx->cmd.u.xts.iv = &rctx->iv_sg;
+       rctx->cmd.u.xts.iv_len = AES_BLOCK_SIZE;
+       rctx->cmd.u.xts.src = req->src;
+       rctx->cmd.u.xts.src_len = req->nbytes;
+       rctx->cmd.u.xts.dst = req->dst;
+
+       ret = ccp_crypto_enqueue_request(&req->base, &rctx->cmd);
+
+       return ret;
+}
+
+static int ccp_aes_xts_encrypt(struct ablkcipher_request *req)
+{
+       return ccp_aes_xts_crypt(req, 1);
+}
+
+static int ccp_aes_xts_decrypt(struct ablkcipher_request *req)
+{
+       return ccp_aes_xts_crypt(req, 0);
+}
+
+static int ccp_aes_xts_cra_init(struct crypto_tfm *tfm)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(tfm);
+       struct crypto_ablkcipher *fallback_tfm;
+
+       ctx->complete = ccp_aes_xts_complete;
+       ctx->u.aes.key_len = 0;
+
+       fallback_tfm = crypto_alloc_ablkcipher(tfm->__crt_alg->cra_name, 0,
+                                              CRYPTO_ALG_ASYNC |
+                                              CRYPTO_ALG_NEED_FALLBACK);
+       if (IS_ERR(fallback_tfm)) {
+               pr_warn("could not load fallback driver %s\n",
+                       tfm->__crt_alg->cra_name);
+               return PTR_ERR(fallback_tfm);
+       }
+       ctx->u.aes.tfm_ablkcipher = fallback_tfm;
+
+       tfm->crt_ablkcipher.reqsize = sizeof(struct ccp_aes_req_ctx) +
+                                     fallback_tfm->base.crt_ablkcipher.reqsize;
+
+       return 0;
+}
+
+static void ccp_aes_xts_cra_exit(struct crypto_tfm *tfm)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       if (ctx->u.aes.tfm_ablkcipher)
+               crypto_free_ablkcipher(ctx->u.aes.tfm_ablkcipher);
+       ctx->u.aes.tfm_ablkcipher = NULL;
+}
+
+
+static int ccp_register_aes_xts_alg(struct list_head *head,
+                                   const struct ccp_aes_xts_def *def)
+{
+       struct ccp_crypto_ablkcipher_alg *ccp_alg;
+       struct crypto_alg *alg;
+       int ret;
+
+       ccp_alg = kzalloc(sizeof(*ccp_alg), GFP_KERNEL);
+       if (!ccp_alg)
+               return -ENOMEM;
+
+       INIT_LIST_HEAD(&ccp_alg->entry);
+
+       alg = &ccp_alg->alg;
+
+       snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name);
+       snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
+                def->drv_name);
+       alg->cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC |
+                        CRYPTO_ALG_KERN_DRIVER_ONLY |
+                        CRYPTO_ALG_NEED_FALLBACK;
+       alg->cra_blocksize = AES_BLOCK_SIZE;
+       alg->cra_ctxsize = sizeof(struct ccp_ctx);
+       alg->cra_priority = CCP_CRA_PRIORITY;
+       alg->cra_type = &crypto_ablkcipher_type;
+       alg->cra_ablkcipher.setkey = ccp_aes_xts_setkey;
+       alg->cra_ablkcipher.encrypt = ccp_aes_xts_encrypt;
+       alg->cra_ablkcipher.decrypt = ccp_aes_xts_decrypt;
+       alg->cra_ablkcipher.min_keysize = AES_MIN_KEY_SIZE * 2;
+       alg->cra_ablkcipher.max_keysize = AES_MAX_KEY_SIZE * 2;
+       alg->cra_ablkcipher.ivsize = AES_BLOCK_SIZE;
+       alg->cra_init = ccp_aes_xts_cra_init;
+       alg->cra_exit = ccp_aes_xts_cra_exit;
+       alg->cra_module = THIS_MODULE;
+
+       ret = crypto_register_alg(alg);
+       if (ret) {
+               pr_err("%s ablkcipher algorithm registration error (%d)\n",
+                       alg->cra_name, ret);
+               kfree(ccp_alg);
+               return ret;
+       }
+
+       list_add(&ccp_alg->entry, head);
+
+       return 0;
+}
+
+int ccp_register_aes_xts_algs(struct list_head *head)
+{
+       int i, ret;
+
+       for (i = 0; i < ARRAY_SIZE(aes_xts_algs); i++) {
+               ret = ccp_register_aes_xts_alg(head, &aes_xts_algs[i]);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
diff --git a/drivers/crypto/ccp/ccp-crypto-aes.c b/drivers/crypto/ccp/ccp-crypto-aes.c
new file mode 100644 (file)
index 0000000..e46490d
--- /dev/null
@@ -0,0 +1,369 @@
+/*
+ * AMD Cryptographic Coprocessor (CCP) AES crypto API support
+ *
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Tom Lendacky <thomas.lendacky@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/delay.h>
+#include <linux/scatterlist.h>
+#include <linux/crypto.h>
+#include <crypto/algapi.h>
+#include <crypto/aes.h>
+#include <crypto/ctr.h>
+#include <crypto/scatterwalk.h>
+
+#include "ccp-crypto.h"
+
+
+static int ccp_aes_complete(struct crypto_async_request *async_req, int ret)
+{
+       struct ablkcipher_request *req = ablkcipher_request_cast(async_req);
+       struct ccp_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
+       struct ccp_aes_req_ctx *rctx = ablkcipher_request_ctx(req);
+
+       if (ret)
+               return ret;
+
+       if (ctx->u.aes.mode != CCP_AES_MODE_ECB)
+               memcpy(req->info, rctx->iv, AES_BLOCK_SIZE);
+
+       return 0;
+}
+
+static int ccp_aes_setkey(struct crypto_ablkcipher *tfm, const u8 *key,
+                         unsigned int key_len)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(crypto_ablkcipher_tfm(tfm));
+       struct ccp_crypto_ablkcipher_alg *alg =
+               ccp_crypto_ablkcipher_alg(crypto_ablkcipher_tfm(tfm));
+
+       switch (key_len) {
+       case AES_KEYSIZE_128:
+               ctx->u.aes.type = CCP_AES_TYPE_128;
+               break;
+       case AES_KEYSIZE_192:
+               ctx->u.aes.type = CCP_AES_TYPE_192;
+               break;
+       case AES_KEYSIZE_256:
+               ctx->u.aes.type = CCP_AES_TYPE_256;
+               break;
+       default:
+               crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
+               return -EINVAL;
+       }
+       ctx->u.aes.mode = alg->mode;
+       ctx->u.aes.key_len = key_len;
+
+       memcpy(ctx->u.aes.key, key, key_len);
+       sg_init_one(&ctx->u.aes.key_sg, ctx->u.aes.key, key_len);
+
+       return 0;
+}
+
+static int ccp_aes_crypt(struct ablkcipher_request *req, bool encrypt)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
+       struct ccp_aes_req_ctx *rctx = ablkcipher_request_ctx(req);
+       struct scatterlist *iv_sg = NULL;
+       unsigned int iv_len = 0;
+       int ret;
+
+       if (!ctx->u.aes.key_len)
+               return -EINVAL;
+
+       if (((ctx->u.aes.mode == CCP_AES_MODE_ECB) ||
+            (ctx->u.aes.mode == CCP_AES_MODE_CBC) ||
+            (ctx->u.aes.mode == CCP_AES_MODE_CFB)) &&
+           (req->nbytes & (AES_BLOCK_SIZE - 1)))
+               return -EINVAL;
+
+       if (ctx->u.aes.mode != CCP_AES_MODE_ECB) {
+               if (!req->info)
+                       return -EINVAL;
+
+               memcpy(rctx->iv, req->info, AES_BLOCK_SIZE);
+               iv_sg = &rctx->iv_sg;
+               iv_len = AES_BLOCK_SIZE;
+               sg_init_one(iv_sg, rctx->iv, iv_len);
+       }
+
+       memset(&rctx->cmd, 0, sizeof(rctx->cmd));
+       INIT_LIST_HEAD(&rctx->cmd.entry);
+       rctx->cmd.engine = CCP_ENGINE_AES;
+       rctx->cmd.u.aes.type = ctx->u.aes.type;
+       rctx->cmd.u.aes.mode = ctx->u.aes.mode;
+       rctx->cmd.u.aes.action =
+               (encrypt) ? CCP_AES_ACTION_ENCRYPT : CCP_AES_ACTION_DECRYPT;
+       rctx->cmd.u.aes.key = &ctx->u.aes.key_sg;
+       rctx->cmd.u.aes.key_len = ctx->u.aes.key_len;
+       rctx->cmd.u.aes.iv = iv_sg;
+       rctx->cmd.u.aes.iv_len = iv_len;
+       rctx->cmd.u.aes.src = req->src;
+       rctx->cmd.u.aes.src_len = req->nbytes;
+       rctx->cmd.u.aes.dst = req->dst;
+
+       ret = ccp_crypto_enqueue_request(&req->base, &rctx->cmd);
+
+       return ret;
+}
+
+static int ccp_aes_encrypt(struct ablkcipher_request *req)
+{
+       return ccp_aes_crypt(req, true);
+}
+
+static int ccp_aes_decrypt(struct ablkcipher_request *req)
+{
+       return ccp_aes_crypt(req, false);
+}
+
+static int ccp_aes_cra_init(struct crypto_tfm *tfm)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       ctx->complete = ccp_aes_complete;
+       ctx->u.aes.key_len = 0;
+
+       tfm->crt_ablkcipher.reqsize = sizeof(struct ccp_aes_req_ctx);
+
+       return 0;
+}
+
+static void ccp_aes_cra_exit(struct crypto_tfm *tfm)
+{
+}
+
+static int ccp_aes_rfc3686_complete(struct crypto_async_request *async_req,
+                                   int ret)
+{
+       struct ablkcipher_request *req = ablkcipher_request_cast(async_req);
+       struct ccp_aes_req_ctx *rctx = ablkcipher_request_ctx(req);
+
+       /* Restore the original pointer */
+       req->info = rctx->rfc3686_info;
+
+       return ccp_aes_complete(async_req, ret);
+}
+
+static int ccp_aes_rfc3686_setkey(struct crypto_ablkcipher *tfm, const u8 *key,
+                                 unsigned int key_len)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(crypto_ablkcipher_tfm(tfm));
+
+       if (key_len < CTR_RFC3686_NONCE_SIZE)
+               return -EINVAL;
+
+       key_len -= CTR_RFC3686_NONCE_SIZE;
+       memcpy(ctx->u.aes.nonce, key + key_len, CTR_RFC3686_NONCE_SIZE);
+
+       return ccp_aes_setkey(tfm, key, key_len);
+}
+
+static int ccp_aes_rfc3686_crypt(struct ablkcipher_request *req, bool encrypt)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
+       struct ccp_aes_req_ctx *rctx = ablkcipher_request_ctx(req);
+       u8 *iv;
+
+       /* Initialize the CTR block */
+       iv = rctx->rfc3686_iv;
+       memcpy(iv, ctx->u.aes.nonce, CTR_RFC3686_NONCE_SIZE);
+
+       iv += CTR_RFC3686_NONCE_SIZE;
+       memcpy(iv, req->info, CTR_RFC3686_IV_SIZE);
+
+       iv += CTR_RFC3686_IV_SIZE;
+       *(__be32 *)iv = cpu_to_be32(1);
+
+       /* Point to the new IV */
+       rctx->rfc3686_info = req->info;
+       req->info = rctx->rfc3686_iv;
+
+       return ccp_aes_crypt(req, encrypt);
+}
+
+static int ccp_aes_rfc3686_encrypt(struct ablkcipher_request *req)
+{
+       return ccp_aes_rfc3686_crypt(req, true);
+}
+
+static int ccp_aes_rfc3686_decrypt(struct ablkcipher_request *req)
+{
+       return ccp_aes_rfc3686_crypt(req, false);
+}
+
+static int ccp_aes_rfc3686_cra_init(struct crypto_tfm *tfm)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       ctx->complete = ccp_aes_rfc3686_complete;
+       ctx->u.aes.key_len = 0;
+
+       tfm->crt_ablkcipher.reqsize = sizeof(struct ccp_aes_req_ctx);
+
+       return 0;
+}
+
+static void ccp_aes_rfc3686_cra_exit(struct crypto_tfm *tfm)
+{
+}
+
+static struct crypto_alg ccp_aes_defaults = {
+       .cra_flags      = CRYPTO_ALG_TYPE_ABLKCIPHER |
+                         CRYPTO_ALG_ASYNC |
+                         CRYPTO_ALG_KERN_DRIVER_ONLY |
+                         CRYPTO_ALG_NEED_FALLBACK,
+       .cra_blocksize  = AES_BLOCK_SIZE,
+       .cra_ctxsize    = sizeof(struct ccp_ctx),
+       .cra_priority   = CCP_CRA_PRIORITY,
+       .cra_type       = &crypto_ablkcipher_type,
+       .cra_init       = ccp_aes_cra_init,
+       .cra_exit       = ccp_aes_cra_exit,
+       .cra_module     = THIS_MODULE,
+       .cra_ablkcipher = {
+               .setkey         = ccp_aes_setkey,
+               .encrypt        = ccp_aes_encrypt,
+               .decrypt        = ccp_aes_decrypt,
+               .min_keysize    = AES_MIN_KEY_SIZE,
+               .max_keysize    = AES_MAX_KEY_SIZE,
+       },
+};
+
+static struct crypto_alg ccp_aes_rfc3686_defaults = {
+       .cra_flags      = CRYPTO_ALG_TYPE_ABLKCIPHER |
+                          CRYPTO_ALG_ASYNC |
+                          CRYPTO_ALG_KERN_DRIVER_ONLY |
+                          CRYPTO_ALG_NEED_FALLBACK,
+       .cra_blocksize  = CTR_RFC3686_BLOCK_SIZE,
+       .cra_ctxsize    = sizeof(struct ccp_ctx),
+       .cra_priority   = CCP_CRA_PRIORITY,
+       .cra_type       = &crypto_ablkcipher_type,
+       .cra_init       = ccp_aes_rfc3686_cra_init,
+       .cra_exit       = ccp_aes_rfc3686_cra_exit,
+       .cra_module     = THIS_MODULE,
+       .cra_ablkcipher = {
+               .setkey         = ccp_aes_rfc3686_setkey,
+               .encrypt        = ccp_aes_rfc3686_encrypt,
+               .decrypt        = ccp_aes_rfc3686_decrypt,
+               .min_keysize    = AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE,
+               .max_keysize    = AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE,
+       },
+};
+
+struct ccp_aes_def {
+       enum ccp_aes_mode mode;
+       const char *name;
+       const char *driver_name;
+       unsigned int blocksize;
+       unsigned int ivsize;
+       struct crypto_alg *alg_defaults;
+};
+
+static struct ccp_aes_def aes_algs[] = {
+       {
+               .mode           = CCP_AES_MODE_ECB,
+               .name           = "ecb(aes)",
+               .driver_name    = "ecb-aes-ccp",
+               .blocksize      = AES_BLOCK_SIZE,
+               .ivsize         = 0,
+               .alg_defaults   = &ccp_aes_defaults,
+       },
+       {
+               .mode           = CCP_AES_MODE_CBC,
+               .name           = "cbc(aes)",
+               .driver_name    = "cbc-aes-ccp",
+               .blocksize      = AES_BLOCK_SIZE,
+               .ivsize         = AES_BLOCK_SIZE,
+               .alg_defaults   = &ccp_aes_defaults,
+       },
+       {
+               .mode           = CCP_AES_MODE_CFB,
+               .name           = "cfb(aes)",
+               .driver_name    = "cfb-aes-ccp",
+               .blocksize      = AES_BLOCK_SIZE,
+               .ivsize         = AES_BLOCK_SIZE,
+               .alg_defaults   = &ccp_aes_defaults,
+       },
+       {
+               .mode           = CCP_AES_MODE_OFB,
+               .name           = "ofb(aes)",
+               .driver_name    = "ofb-aes-ccp",
+               .blocksize      = 1,
+               .ivsize         = AES_BLOCK_SIZE,
+               .alg_defaults   = &ccp_aes_defaults,
+       },
+       {
+               .mode           = CCP_AES_MODE_CTR,
+               .name           = "ctr(aes)",
+               .driver_name    = "ctr-aes-ccp",
+               .blocksize      = 1,
+               .ivsize         = AES_BLOCK_SIZE,
+               .alg_defaults   = &ccp_aes_defaults,
+       },
+       {
+               .mode           = CCP_AES_MODE_CTR,
+               .name           = "rfc3686(ctr(aes))",
+               .driver_name    = "rfc3686-ctr-aes-ccp",
+               .blocksize      = 1,
+               .ivsize         = CTR_RFC3686_IV_SIZE,
+               .alg_defaults   = &ccp_aes_rfc3686_defaults,
+       },
+};
+
+static int ccp_register_aes_alg(struct list_head *head,
+                               const struct ccp_aes_def *def)
+{
+       struct ccp_crypto_ablkcipher_alg *ccp_alg;
+       struct crypto_alg *alg;
+       int ret;
+
+       ccp_alg = kzalloc(sizeof(*ccp_alg), GFP_KERNEL);
+       if (!ccp_alg)
+               return -ENOMEM;
+
+       INIT_LIST_HEAD(&ccp_alg->entry);
+
+       ccp_alg->mode = def->mode;
+
+       /* Copy the defaults and override as necessary */
+       alg = &ccp_alg->alg;
+       *alg = *def->alg_defaults;
+       snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name);
+       snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
+                def->driver_name);
+       alg->cra_blocksize = def->blocksize;
+       alg->cra_ablkcipher.ivsize = def->ivsize;
+
+       ret = crypto_register_alg(alg);
+       if (ret) {
+               pr_err("%s ablkcipher algorithm registration error (%d)\n",
+                       alg->cra_name, ret);
+               kfree(ccp_alg);
+               return ret;
+       }
+
+       list_add(&ccp_alg->entry, head);
+
+       return 0;
+}
+
+int ccp_register_aes_algs(struct list_head *head)
+{
+       int i, ret;
+
+       for (i = 0; i < ARRAY_SIZE(aes_algs); i++) {
+               ret = ccp_register_aes_alg(head, &aes_algs[i]);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
diff --git a/drivers/crypto/ccp/ccp-crypto-main.c b/drivers/crypto/ccp/ccp-crypto-main.c
new file mode 100644 (file)
index 0000000..2636f04
--- /dev/null
@@ -0,0 +1,432 @@
+/*
+ * AMD Cryptographic Coprocessor (CCP) crypto API support
+ *
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Tom Lendacky <thomas.lendacky@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/ccp.h>
+#include <linux/scatterlist.h>
+#include <crypto/internal/hash.h>
+
+#include "ccp-crypto.h"
+
+MODULE_AUTHOR("Tom Lendacky <thomas.lendacky@amd.com>");
+MODULE_LICENSE("GPL");
+MODULE_VERSION("1.0.0");
+MODULE_DESCRIPTION("AMD Cryptographic Coprocessor crypto API support");
+
+
+/* List heads for the supported algorithms */
+static LIST_HEAD(hash_algs);
+static LIST_HEAD(cipher_algs);
+
+/* For any tfm, requests for that tfm on the same CPU must be returned
+ * in the order received.  With multiple queues available, the CCP can
+ * process more than one cmd at a time.  Therefore we must maintain
+ * a cmd list to insure the proper ordering of requests on a given tfm/cpu
+ * combination.
+ */
+struct ccp_crypto_cpu_queue {
+       struct list_head cmds;
+       struct list_head *backlog;
+       unsigned int cmd_count;
+};
+#define CCP_CRYPTO_MAX_QLEN    50
+
+struct ccp_crypto_percpu_queue {
+       struct ccp_crypto_cpu_queue __percpu *cpu_queue;
+};
+static struct ccp_crypto_percpu_queue req_queue;
+
+struct ccp_crypto_cmd {
+       struct list_head entry;
+
+       struct ccp_cmd *cmd;
+
+       /* Save the crypto_tfm and crypto_async_request addresses
+        * separately to avoid any reference to a possibly invalid
+        * crypto_async_request structure after invoking the request
+        * callback
+        */
+       struct crypto_async_request *req;
+       struct crypto_tfm *tfm;
+
+       /* Used for held command processing to determine state */
+       int ret;
+
+       int cpu;
+};
+
+struct ccp_crypto_cpu {
+       struct work_struct work;
+       struct completion completion;
+       struct ccp_crypto_cmd *crypto_cmd;
+       int err;
+};
+
+
+static inline bool ccp_crypto_success(int err)
+{
+       if (err && (err != -EINPROGRESS) && (err != -EBUSY))
+               return false;
+
+       return true;
+}
+
+/*
+ * ccp_crypto_cmd_complete must be called while running on the appropriate
+ * cpu and the caller must have done a get_cpu to disable preemption
+ */
+static struct ccp_crypto_cmd *ccp_crypto_cmd_complete(
+       struct ccp_crypto_cmd *crypto_cmd, struct ccp_crypto_cmd **backlog)
+{
+       struct ccp_crypto_cpu_queue *cpu_queue;
+       struct ccp_crypto_cmd *held = NULL, *tmp;
+
+       *backlog = NULL;
+
+       cpu_queue = this_cpu_ptr(req_queue.cpu_queue);
+
+       /* Held cmds will be after the current cmd in the queue so start
+        * searching for a cmd with a matching tfm for submission.
+        */
+       tmp = crypto_cmd;
+       list_for_each_entry_continue(tmp, &cpu_queue->cmds, entry) {
+               if (crypto_cmd->tfm != tmp->tfm)
+                       continue;
+               held = tmp;
+               break;
+       }
+
+       /* Process the backlog:
+        *   Because cmds can be executed from any point in the cmd list
+        *   special precautions have to be taken when handling the backlog.
+        */
+       if (cpu_queue->backlog != &cpu_queue->cmds) {
+               /* Skip over this cmd if it is the next backlog cmd */
+               if (cpu_queue->backlog == &crypto_cmd->entry)
+                       cpu_queue->backlog = crypto_cmd->entry.next;
+
+               *backlog = container_of(cpu_queue->backlog,
+                                       struct ccp_crypto_cmd, entry);
+               cpu_queue->backlog = cpu_queue->backlog->next;
+
+               /* Skip over this cmd if it is now the next backlog cmd */
+               if (cpu_queue->backlog == &crypto_cmd->entry)
+                       cpu_queue->backlog = crypto_cmd->entry.next;
+       }
+
+       /* Remove the cmd entry from the list of cmds */
+       cpu_queue->cmd_count--;
+       list_del(&crypto_cmd->entry);
+
+       return held;
+}
+
+static void ccp_crypto_complete_on_cpu(struct work_struct *work)
+{
+       struct ccp_crypto_cpu *cpu_work =
+               container_of(work, struct ccp_crypto_cpu, work);
+       struct ccp_crypto_cmd *crypto_cmd = cpu_work->crypto_cmd;
+       struct ccp_crypto_cmd *held, *next, *backlog;
+       struct crypto_async_request *req = crypto_cmd->req;
+       struct ccp_ctx *ctx = crypto_tfm_ctx(req->tfm);
+       int cpu, ret;
+
+       cpu = get_cpu();
+
+       if (cpu_work->err == -EINPROGRESS) {
+               /* Only propogate the -EINPROGRESS if necessary */
+               if (crypto_cmd->ret == -EBUSY) {
+                       crypto_cmd->ret = -EINPROGRESS;
+                       req->complete(req, -EINPROGRESS);
+               }
+
+               goto e_cpu;
+       }
+
+       /* Operation has completed - update the queue before invoking
+        * the completion callbacks and retrieve the next cmd (cmd with
+        * a matching tfm) that can be submitted to the CCP.
+        */
+       held = ccp_crypto_cmd_complete(crypto_cmd, &backlog);
+       if (backlog) {
+               backlog->ret = -EINPROGRESS;
+               backlog->req->complete(backlog->req, -EINPROGRESS);
+       }
+
+       /* Transition the state from -EBUSY to -EINPROGRESS first */
+       if (crypto_cmd->ret == -EBUSY)
+               req->complete(req, -EINPROGRESS);
+
+       /* Completion callbacks */
+       ret = cpu_work->err;
+       if (ctx->complete)
+               ret = ctx->complete(req, ret);
+       req->complete(req, ret);
+
+       /* Submit the next cmd */
+       while (held) {
+               ret = ccp_enqueue_cmd(held->cmd);
+               if (ccp_crypto_success(ret))
+                       break;
+
+               /* Error occurred, report it and get the next entry */
+               held->req->complete(held->req, ret);
+
+               next = ccp_crypto_cmd_complete(held, &backlog);
+               if (backlog) {
+                       backlog->ret = -EINPROGRESS;
+                       backlog->req->complete(backlog->req, -EINPROGRESS);
+               }
+
+               kfree(held);
+               held = next;
+       }
+
+       kfree(crypto_cmd);
+
+e_cpu:
+       put_cpu();
+
+       complete(&cpu_work->completion);
+}
+
+static void ccp_crypto_complete(void *data, int err)
+{
+       struct ccp_crypto_cmd *crypto_cmd = data;
+       struct ccp_crypto_cpu cpu_work;
+
+       INIT_WORK(&cpu_work.work, ccp_crypto_complete_on_cpu);
+       init_completion(&cpu_work.completion);
+       cpu_work.crypto_cmd = crypto_cmd;
+       cpu_work.err = err;
+
+       schedule_work_on(crypto_cmd->cpu, &cpu_work.work);
+
+       /* Keep the completion call synchronous */
+       wait_for_completion(&cpu_work.completion);
+}
+
+static int ccp_crypto_enqueue_cmd(struct ccp_crypto_cmd *crypto_cmd)
+{
+       struct ccp_crypto_cpu_queue *cpu_queue;
+       struct ccp_crypto_cmd *active = NULL, *tmp;
+       int cpu, ret;
+
+       cpu = get_cpu();
+       crypto_cmd->cpu = cpu;
+
+       cpu_queue = this_cpu_ptr(req_queue.cpu_queue);
+
+       /* Check if the cmd can/should be queued */
+       if (cpu_queue->cmd_count >= CCP_CRYPTO_MAX_QLEN) {
+               ret = -EBUSY;
+               if (!(crypto_cmd->cmd->flags & CCP_CMD_MAY_BACKLOG))
+                       goto e_cpu;
+       }
+
+       /* Look for an entry with the same tfm.  If there is a cmd
+        * with the same tfm in the list for this cpu then the current
+        * cmd cannot be submitted to the CCP yet.
+        */
+       list_for_each_entry(tmp, &cpu_queue->cmds, entry) {
+               if (crypto_cmd->tfm != tmp->tfm)
+                       continue;
+               active = tmp;
+               break;
+       }
+
+       ret = -EINPROGRESS;
+       if (!active) {
+               ret = ccp_enqueue_cmd(crypto_cmd->cmd);
+               if (!ccp_crypto_success(ret))
+                       goto e_cpu;
+       }
+
+       if (cpu_queue->cmd_count >= CCP_CRYPTO_MAX_QLEN) {
+               ret = -EBUSY;
+               if (cpu_queue->backlog == &cpu_queue->cmds)
+                       cpu_queue->backlog = &crypto_cmd->entry;
+       }
+       crypto_cmd->ret = ret;
+
+       cpu_queue->cmd_count++;
+       list_add_tail(&crypto_cmd->entry, &cpu_queue->cmds);
+
+e_cpu:
+       put_cpu();
+
+       return ret;
+}
+
+/**
+ * ccp_crypto_enqueue_request - queue an crypto async request for processing
+ *                             by the CCP
+ *
+ * @req: crypto_async_request struct to be processed
+ * @cmd: ccp_cmd struct to be sent to the CCP
+ */
+int ccp_crypto_enqueue_request(struct crypto_async_request *req,
+                              struct ccp_cmd *cmd)
+{
+       struct ccp_crypto_cmd *crypto_cmd;
+       gfp_t gfp;
+       int ret;
+
+       gfp = req->flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : GFP_ATOMIC;
+
+       crypto_cmd = kzalloc(sizeof(*crypto_cmd), gfp);
+       if (!crypto_cmd)
+               return -ENOMEM;
+
+       /* The tfm pointer must be saved and not referenced from the
+        * crypto_async_request (req) pointer because it is used after
+        * completion callback for the request and the req pointer
+        * might not be valid anymore.
+        */
+       crypto_cmd->cmd = cmd;
+       crypto_cmd->req = req;
+       crypto_cmd->tfm = req->tfm;
+
+       cmd->callback = ccp_crypto_complete;
+       cmd->data = crypto_cmd;
+
+       if (req->flags & CRYPTO_TFM_REQ_MAY_BACKLOG)
+               cmd->flags |= CCP_CMD_MAY_BACKLOG;
+       else
+               cmd->flags &= ~CCP_CMD_MAY_BACKLOG;
+
+       ret = ccp_crypto_enqueue_cmd(crypto_cmd);
+       if (!ccp_crypto_success(ret))
+               kfree(crypto_cmd);
+
+       return ret;
+}
+
+struct scatterlist *ccp_crypto_sg_table_add(struct sg_table *table,
+                                           struct scatterlist *sg_add)
+{
+       struct scatterlist *sg, *sg_last = NULL;
+
+       for (sg = table->sgl; sg; sg = sg_next(sg))
+               if (!sg_page(sg))
+                       break;
+       BUG_ON(!sg);
+
+       for (; sg && sg_add; sg = sg_next(sg), sg_add = sg_next(sg_add)) {
+               sg_set_page(sg, sg_page(sg_add), sg_add->length,
+                           sg_add->offset);
+               sg_last = sg;
+       }
+       BUG_ON(sg_add);
+
+       return sg_last;
+}
+
+static int ccp_register_algs(void)
+{
+       int ret;
+
+       ret = ccp_register_aes_algs(&cipher_algs);
+       if (ret)
+               return ret;
+
+       ret = ccp_register_aes_cmac_algs(&hash_algs);
+       if (ret)
+               return ret;
+
+       ret = ccp_register_aes_xts_algs(&cipher_algs);
+       if (ret)
+               return ret;
+
+       ret = ccp_register_sha_algs(&hash_algs);
+       if (ret)
+               return ret;
+
+       return 0;
+}
+
+static void ccp_unregister_algs(void)
+{
+       struct ccp_crypto_ahash_alg *ahash_alg, *ahash_tmp;
+       struct ccp_crypto_ablkcipher_alg *ablk_alg, *ablk_tmp;
+
+       list_for_each_entry_safe(ahash_alg, ahash_tmp, &hash_algs, entry) {
+               crypto_unregister_ahash(&ahash_alg->alg);
+               list_del(&ahash_alg->entry);
+               kfree(ahash_alg);
+       }
+
+       list_for_each_entry_safe(ablk_alg, ablk_tmp, &cipher_algs, entry) {
+               crypto_unregister_alg(&ablk_alg->alg);
+               list_del(&ablk_alg->entry);
+               kfree(ablk_alg);
+       }
+}
+
+static int ccp_init_queues(void)
+{
+       struct ccp_crypto_cpu_queue *cpu_queue;
+       int cpu;
+
+       req_queue.cpu_queue = alloc_percpu(struct ccp_crypto_cpu_queue);
+       if (!req_queue.cpu_queue)
+               return -ENOMEM;
+
+       for_each_possible_cpu(cpu) {
+               cpu_queue = per_cpu_ptr(req_queue.cpu_queue, cpu);
+               INIT_LIST_HEAD(&cpu_queue->cmds);
+               cpu_queue->backlog = &cpu_queue->cmds;
+               cpu_queue->cmd_count = 0;
+       }
+
+       return 0;
+}
+
+static void ccp_fini_queue(void)
+{
+       struct ccp_crypto_cpu_queue *cpu_queue;
+       int cpu;
+
+       for_each_possible_cpu(cpu) {
+               cpu_queue = per_cpu_ptr(req_queue.cpu_queue, cpu);
+               BUG_ON(!list_empty(&cpu_queue->cmds));
+       }
+       free_percpu(req_queue.cpu_queue);
+}
+
+static int ccp_crypto_init(void)
+{
+       int ret;
+
+       ret = ccp_init_queues();
+       if (ret)
+               return ret;
+
+       ret = ccp_register_algs();
+       if (ret) {
+               ccp_unregister_algs();
+               ccp_fini_queue();
+       }
+
+       return ret;
+}
+
+static void ccp_crypto_exit(void)
+{
+       ccp_unregister_algs();
+       ccp_fini_queue();
+}
+
+module_init(ccp_crypto_init);
+module_exit(ccp_crypto_exit);
diff --git a/drivers/crypto/ccp/ccp-crypto-sha.c b/drivers/crypto/ccp/ccp-crypto-sha.c
new file mode 100644 (file)
index 0000000..3867290
--- /dev/null
@@ -0,0 +1,517 @@
+/*
+ * AMD Cryptographic Coprocessor (CCP) SHA crypto API support
+ *
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Tom Lendacky <thomas.lendacky@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/delay.h>
+#include <linux/scatterlist.h>
+#include <linux/crypto.h>
+#include <crypto/algapi.h>
+#include <crypto/hash.h>
+#include <crypto/internal/hash.h>
+#include <crypto/sha.h>
+#include <crypto/scatterwalk.h>
+
+#include "ccp-crypto.h"
+
+
+struct ccp_sha_result {
+       struct completion completion;
+       int err;
+};
+
+static void ccp_sync_hash_complete(struct crypto_async_request *req, int err)
+{
+       struct ccp_sha_result *result = req->data;
+
+       if (err == -EINPROGRESS)
+               return;
+
+       result->err = err;
+       complete(&result->completion);
+}
+
+static int ccp_sync_hash(struct crypto_ahash *tfm, u8 *buf,
+                        struct scatterlist *sg, unsigned int len)
+{
+       struct ccp_sha_result result;
+       struct ahash_request *req;
+       int ret;
+
+       init_completion(&result.completion);
+
+       req = ahash_request_alloc(tfm, GFP_KERNEL);
+       if (!req)
+               return -ENOMEM;
+
+       ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
+                                  ccp_sync_hash_complete, &result);
+       ahash_request_set_crypt(req, sg, buf, len);
+
+       ret = crypto_ahash_digest(req);
+       if ((ret == -EINPROGRESS) || (ret == -EBUSY)) {
+               ret = wait_for_completion_interruptible(&result.completion);
+               if (!ret)
+                       ret = result.err;
+       }
+
+       ahash_request_free(req);
+
+       return ret;
+}
+
+static int ccp_sha_finish_hmac(struct crypto_async_request *async_req)
+{
+       struct ahash_request *req = ahash_request_cast(async_req);
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
+       struct ccp_ctx *ctx = crypto_ahash_ctx(tfm);
+       struct ccp_sha_req_ctx *rctx = ahash_request_ctx(req);
+       struct scatterlist sg[2];
+       unsigned int block_size =
+               crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
+       unsigned int digest_size = crypto_ahash_digestsize(tfm);
+
+       sg_init_table(sg, ARRAY_SIZE(sg));
+       sg_set_buf(&sg[0], ctx->u.sha.opad, block_size);
+       sg_set_buf(&sg[1], rctx->ctx, digest_size);
+
+       return ccp_sync_hash(ctx->u.sha.hmac_tfm, req->result, sg,
+                            block_size + digest_size);
+}
+
+static int ccp_sha_complete(struct crypto_async_request *async_req, int ret)
+{
+       struct ahash_request *req = ahash_request_cast(async_req);
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
+       struct ccp_ctx *ctx = crypto_ahash_ctx(tfm);
+       struct ccp_sha_req_ctx *rctx = ahash_request_ctx(req);
+       unsigned int digest_size = crypto_ahash_digestsize(tfm);
+
+       if (ret)
+               goto e_free;
+
+       if (rctx->hash_rem) {
+               /* Save remaining data to buffer */
+               unsigned int offset = rctx->nbytes - rctx->hash_rem;
+               scatterwalk_map_and_copy(rctx->buf, rctx->src,
+                                        offset, rctx->hash_rem, 0);
+               rctx->buf_count = rctx->hash_rem;
+       } else
+               rctx->buf_count = 0;
+
+       /* Update result area if supplied */
+       if (req->result)
+               memcpy(req->result, rctx->ctx, digest_size);
+
+       /* If we're doing an HMAC, we need to perform that on the final op */
+       if (rctx->final && ctx->u.sha.key_len)
+               ret = ccp_sha_finish_hmac(async_req);
+
+e_free:
+       sg_free_table(&rctx->data_sg);
+
+       return ret;
+}
+
+static int ccp_do_sha_update(struct ahash_request *req, unsigned int nbytes,
+                            unsigned int final)
+{
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
+       struct ccp_sha_req_ctx *rctx = ahash_request_ctx(req);
+       struct scatterlist *sg;
+       unsigned int block_size =
+               crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
+       unsigned int sg_count;
+       gfp_t gfp;
+       u64 len;
+       int ret;
+
+       len = (u64)rctx->buf_count + (u64)nbytes;
+
+       if (!final && (len <= block_size)) {
+               scatterwalk_map_and_copy(rctx->buf + rctx->buf_count, req->src,
+                                        0, nbytes, 0);
+               rctx->buf_count += nbytes;
+
+               return 0;
+       }
+
+       rctx->src = req->src;
+       rctx->nbytes = nbytes;
+
+       rctx->final = final;
+       rctx->hash_rem = final ? 0 : len & (block_size - 1);
+       rctx->hash_cnt = len - rctx->hash_rem;
+       if (!final && !rctx->hash_rem) {
+               /* CCP can't do zero length final, so keep some data around */
+               rctx->hash_cnt -= block_size;
+               rctx->hash_rem = block_size;
+       }
+
+       /* Initialize the context scatterlist */
+       sg_init_one(&rctx->ctx_sg, rctx->ctx, sizeof(rctx->ctx));
+
+       sg = NULL;
+       if (rctx->buf_count && nbytes) {
+               /* Build the data scatterlist table - allocate enough entries
+                * for both data pieces (buffer and input data)
+                */
+               gfp = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ?
+                       GFP_KERNEL : GFP_ATOMIC;
+               sg_count = sg_nents(req->src) + 1;
+               ret = sg_alloc_table(&rctx->data_sg, sg_count, gfp);
+               if (ret)
+                       return ret;
+
+               sg_init_one(&rctx->buf_sg, rctx->buf, rctx->buf_count);
+               sg = ccp_crypto_sg_table_add(&rctx->data_sg, &rctx->buf_sg);
+               sg = ccp_crypto_sg_table_add(&rctx->data_sg, req->src);
+               sg_mark_end(sg);
+
+               sg = rctx->data_sg.sgl;
+       } else if (rctx->buf_count) {
+               sg_init_one(&rctx->buf_sg, rctx->buf, rctx->buf_count);
+
+               sg = &rctx->buf_sg;
+       } else if (nbytes) {
+               sg = req->src;
+       }
+
+       rctx->msg_bits += (rctx->hash_cnt << 3);        /* Total in bits */
+
+       memset(&rctx->cmd, 0, sizeof(rctx->cmd));
+       INIT_LIST_HEAD(&rctx->cmd.entry);
+       rctx->cmd.engine = CCP_ENGINE_SHA;
+       rctx->cmd.u.sha.type = rctx->type;
+       rctx->cmd.u.sha.ctx = &rctx->ctx_sg;
+       rctx->cmd.u.sha.ctx_len = sizeof(rctx->ctx);
+       rctx->cmd.u.sha.src = sg;
+       rctx->cmd.u.sha.src_len = rctx->hash_cnt;
+       rctx->cmd.u.sha.final = rctx->final;
+       rctx->cmd.u.sha.msg_bits = rctx->msg_bits;
+
+       rctx->first = 0;
+
+       ret = ccp_crypto_enqueue_request(&req->base, &rctx->cmd);
+
+       return ret;
+}
+
+static int ccp_sha_init(struct ahash_request *req)
+{
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
+       struct ccp_ctx *ctx = crypto_ahash_ctx(tfm);
+       struct ccp_sha_req_ctx *rctx = ahash_request_ctx(req);
+       struct ccp_crypto_ahash_alg *alg =
+               ccp_crypto_ahash_alg(crypto_ahash_tfm(tfm));
+       unsigned int block_size =
+               crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
+
+       memset(rctx, 0, sizeof(*rctx));
+
+       memcpy(rctx->ctx, alg->init, sizeof(rctx->ctx));
+       rctx->type = alg->type;
+       rctx->first = 1;
+
+       if (ctx->u.sha.key_len) {
+               /* Buffer the HMAC key for first update */
+               memcpy(rctx->buf, ctx->u.sha.ipad, block_size);
+               rctx->buf_count = block_size;
+       }
+
+       return 0;
+}
+
+static int ccp_sha_update(struct ahash_request *req)
+{
+       return ccp_do_sha_update(req, req->nbytes, 0);
+}
+
+static int ccp_sha_final(struct ahash_request *req)
+{
+       return ccp_do_sha_update(req, 0, 1);
+}
+
+static int ccp_sha_finup(struct ahash_request *req)
+{
+       return ccp_do_sha_update(req, req->nbytes, 1);
+}
+
+static int ccp_sha_digest(struct ahash_request *req)
+{
+       int ret;
+
+       ret = ccp_sha_init(req);
+       if (ret)
+               return ret;
+
+       return ccp_sha_finup(req);
+}
+
+static int ccp_sha_setkey(struct crypto_ahash *tfm, const u8 *key,
+                         unsigned int key_len)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(crypto_ahash_tfm(tfm));
+       struct scatterlist sg;
+       unsigned int block_size =
+               crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
+       unsigned int digest_size = crypto_ahash_digestsize(tfm);
+       int i, ret;
+
+       /* Set to zero until complete */
+       ctx->u.sha.key_len = 0;
+
+       /* Clear key area to provide zero padding for keys smaller
+        * than the block size
+        */
+       memset(ctx->u.sha.key, 0, sizeof(ctx->u.sha.key));
+
+       if (key_len > block_size) {
+               /* Must hash the input key */
+               sg_init_one(&sg, key, key_len);
+               ret = ccp_sync_hash(tfm, ctx->u.sha.key, &sg, key_len);
+               if (ret) {
+                       crypto_ahash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
+                       return -EINVAL;
+               }
+
+               key_len = digest_size;
+       } else
+               memcpy(ctx->u.sha.key, key, key_len);
+
+       for (i = 0; i < block_size; i++) {
+               ctx->u.sha.ipad[i] = ctx->u.sha.key[i] ^ 0x36;
+               ctx->u.sha.opad[i] = ctx->u.sha.key[i] ^ 0x5c;
+       }
+
+       ctx->u.sha.key_len = key_len;
+
+       return 0;
+}
+
+static int ccp_sha_cra_init(struct crypto_tfm *tfm)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(tfm);
+       struct crypto_ahash *ahash = __crypto_ahash_cast(tfm);
+
+       ctx->complete = ccp_sha_complete;
+       ctx->u.sha.key_len = 0;
+
+       crypto_ahash_set_reqsize(ahash, sizeof(struct ccp_sha_req_ctx));
+
+       return 0;
+}
+
+static void ccp_sha_cra_exit(struct crypto_tfm *tfm)
+{
+}
+
+static int ccp_hmac_sha_cra_init(struct crypto_tfm *tfm)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(tfm);
+       struct ccp_crypto_ahash_alg *alg = ccp_crypto_ahash_alg(tfm);
+       struct crypto_ahash *hmac_tfm;
+
+       hmac_tfm = crypto_alloc_ahash(alg->child_alg,
+                                     CRYPTO_ALG_TYPE_AHASH, 0);
+       if (IS_ERR(hmac_tfm)) {
+               pr_warn("could not load driver %s need for HMAC support\n",
+                       alg->child_alg);
+               return PTR_ERR(hmac_tfm);
+       }
+
+       ctx->u.sha.hmac_tfm = hmac_tfm;
+
+       return ccp_sha_cra_init(tfm);
+}
+
+static void ccp_hmac_sha_cra_exit(struct crypto_tfm *tfm)
+{
+       struct ccp_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       if (ctx->u.sha.hmac_tfm)
+               crypto_free_ahash(ctx->u.sha.hmac_tfm);
+
+       ccp_sha_cra_exit(tfm);
+}
+
+static const __be32 sha1_init[CCP_SHA_CTXSIZE / sizeof(__be32)] = {
+       cpu_to_be32(SHA1_H0), cpu_to_be32(SHA1_H1),
+       cpu_to_be32(SHA1_H2), cpu_to_be32(SHA1_H3),
+       cpu_to_be32(SHA1_H4), 0, 0, 0,
+};
+
+static const __be32 sha224_init[CCP_SHA_CTXSIZE / sizeof(__be32)] = {
+       cpu_to_be32(SHA224_H0), cpu_to_be32(SHA224_H1),
+       cpu_to_be32(SHA224_H2), cpu_to_be32(SHA224_H3),
+       cpu_to_be32(SHA224_H4), cpu_to_be32(SHA224_H5),
+       cpu_to_be32(SHA224_H6), cpu_to_be32(SHA224_H7),
+};
+
+static const __be32 sha256_init[CCP_SHA_CTXSIZE / sizeof(__be32)] = {
+       cpu_to_be32(SHA256_H0), cpu_to_be32(SHA256_H1),
+       cpu_to_be32(SHA256_H2), cpu_to_be32(SHA256_H3),
+       cpu_to_be32(SHA256_H4), cpu_to_be32(SHA256_H5),
+       cpu_to_be32(SHA256_H6), cpu_to_be32(SHA256_H7),
+};
+
+struct ccp_sha_def {
+       const char *name;
+       const char *drv_name;
+       const __be32 *init;
+       enum ccp_sha_type type;
+       u32 digest_size;
+       u32 block_size;
+};
+
+static struct ccp_sha_def sha_algs[] = {
+       {
+               .name           = "sha1",
+               .drv_name       = "sha1-ccp",
+               .init           = sha1_init,
+               .type           = CCP_SHA_TYPE_1,
+               .digest_size    = SHA1_DIGEST_SIZE,
+               .block_size     = SHA1_BLOCK_SIZE,
+       },
+       {
+               .name           = "sha224",
+               .drv_name       = "sha224-ccp",
+               .init           = sha224_init,
+               .type           = CCP_SHA_TYPE_224,
+               .digest_size    = SHA224_DIGEST_SIZE,
+               .block_size     = SHA224_BLOCK_SIZE,
+       },
+       {
+               .name           = "sha256",
+               .drv_name       = "sha256-ccp",
+               .init           = sha256_init,
+               .type           = CCP_SHA_TYPE_256,
+               .digest_size    = SHA256_DIGEST_SIZE,
+               .block_size     = SHA256_BLOCK_SIZE,
+       },
+};
+
+static int ccp_register_hmac_alg(struct list_head *head,
+                                const struct ccp_sha_def *def,
+                                const struct ccp_crypto_ahash_alg *base_alg)
+{
+       struct ccp_crypto_ahash_alg *ccp_alg;
+       struct ahash_alg *alg;
+       struct hash_alg_common *halg;
+       struct crypto_alg *base;
+       int ret;
+
+       ccp_alg = kzalloc(sizeof(*ccp_alg), GFP_KERNEL);
+       if (!ccp_alg)
+               return -ENOMEM;
+
+       /* Copy the base algorithm and only change what's necessary */
+       *ccp_alg = *base_alg;
+       INIT_LIST_HEAD(&ccp_alg->entry);
+
+       strncpy(ccp_alg->child_alg, def->name, CRYPTO_MAX_ALG_NAME);
+
+       alg = &ccp_alg->alg;
+       alg->setkey = ccp_sha_setkey;
+
+       halg = &alg->halg;
+
+       base = &halg->base;
+       snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "hmac(%s)", def->name);
+       snprintf(base->cra_driver_name, CRYPTO_MAX_ALG_NAME, "hmac-%s",
+                def->drv_name);
+       base->cra_init = ccp_hmac_sha_cra_init;
+       base->cra_exit = ccp_hmac_sha_cra_exit;
+
+       ret = crypto_register_ahash(alg);
+       if (ret) {
+               pr_err("%s ahash algorithm registration error (%d)\n",
+                       base->cra_name, ret);
+               kfree(ccp_alg);
+               return ret;
+       }
+
+       list_add(&ccp_alg->entry, head);
+
+       return ret;
+}
+
+static int ccp_register_sha_alg(struct list_head *head,
+                               const struct ccp_sha_def *def)
+{
+       struct ccp_crypto_ahash_alg *ccp_alg;
+       struct ahash_alg *alg;
+       struct hash_alg_common *halg;
+       struct crypto_alg *base;
+       int ret;
+
+       ccp_alg = kzalloc(sizeof(*ccp_alg), GFP_KERNEL);
+       if (!ccp_alg)
+               return -ENOMEM;
+
+       INIT_LIST_HEAD(&ccp_alg->entry);
+
+       ccp_alg->init = def->init;
+       ccp_alg->type = def->type;
+
+       alg = &ccp_alg->alg;
+       alg->init = ccp_sha_init;
+       alg->update = ccp_sha_update;
+       alg->final = ccp_sha_final;
+       alg->finup = ccp_sha_finup;
+       alg->digest = ccp_sha_digest;
+
+       halg = &alg->halg;
+       halg->digestsize = def->digest_size;
+
+       base = &halg->base;
+       snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name);
+       snprintf(base->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
+                def->drv_name);
+       base->cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC |
+                         CRYPTO_ALG_KERN_DRIVER_ONLY |
+                         CRYPTO_ALG_NEED_FALLBACK;
+       base->cra_blocksize = def->block_size;
+       base->cra_ctxsize = sizeof(struct ccp_ctx);
+       base->cra_priority = CCP_CRA_PRIORITY;
+       base->cra_type = &crypto_ahash_type;
+       base->cra_init = ccp_sha_cra_init;
+       base->cra_exit = ccp_sha_cra_exit;
+       base->cra_module = THIS_MODULE;
+
+       ret = crypto_register_ahash(alg);
+       if (ret) {
+               pr_err("%s ahash algorithm registration error (%d)\n",
+                       base->cra_name, ret);
+               kfree(ccp_alg);
+               return ret;
+       }
+
+       list_add(&ccp_alg->entry, head);
+
+       ret = ccp_register_hmac_alg(head, def, ccp_alg);
+
+       return ret;
+}
+
+int ccp_register_sha_algs(struct list_head *head)
+{
+       int i, ret;
+
+       for (i = 0; i < ARRAY_SIZE(sha_algs); i++) {
+               ret = ccp_register_sha_alg(head, &sha_algs[i]);
+               if (ret)
+                       return ret;
+       }
+
+       return 0;
+}
diff --git a/drivers/crypto/ccp/ccp-crypto.h b/drivers/crypto/ccp/ccp-crypto.h
new file mode 100644 (file)
index 0000000..b222231
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * AMD Cryptographic Coprocessor (CCP) crypto API support
+ *
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Tom Lendacky <thomas.lendacky@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __CCP_CRYPTO_H__
+#define __CCP_CRYPTO_H__
+
+
+#include <linux/list.h>
+#include <linux/wait.h>
+#include <linux/pci.h>
+#include <linux/ccp.h>
+#include <linux/crypto.h>
+#include <crypto/algapi.h>
+#include <crypto/aes.h>
+#include <crypto/ctr.h>
+#include <crypto/hash.h>
+#include <crypto/sha.h>
+
+
+#define CCP_CRA_PRIORITY       300
+
+struct ccp_crypto_ablkcipher_alg {
+       struct list_head entry;
+
+       u32 mode;
+
+       struct crypto_alg alg;
+};
+
+struct ccp_crypto_ahash_alg {
+       struct list_head entry;
+
+       const __be32 *init;
+       u32 type;
+       u32 mode;
+
+       /* Child algorithm used for HMAC, CMAC, etc */
+       char child_alg[CRYPTO_MAX_ALG_NAME];
+
+       struct ahash_alg alg;
+};
+
+static inline struct ccp_crypto_ablkcipher_alg *
+       ccp_crypto_ablkcipher_alg(struct crypto_tfm *tfm)
+{
+       struct crypto_alg *alg = tfm->__crt_alg;
+
+       return container_of(alg, struct ccp_crypto_ablkcipher_alg, alg);
+}
+
+static inline struct ccp_crypto_ahash_alg *
+       ccp_crypto_ahash_alg(struct crypto_tfm *tfm)
+{
+       struct crypto_alg *alg = tfm->__crt_alg;
+       struct ahash_alg *ahash_alg;
+
+       ahash_alg = container_of(alg, struct ahash_alg, halg.base);
+
+       return container_of(ahash_alg, struct ccp_crypto_ahash_alg, alg);
+}
+
+
+/***** AES related defines *****/
+struct ccp_aes_ctx {
+       /* Fallback cipher for XTS with unsupported unit sizes */
+       struct crypto_ablkcipher *tfm_ablkcipher;
+
+       /* Cipher used to generate CMAC K1/K2 keys */
+       struct crypto_cipher *tfm_cipher;
+
+       enum ccp_engine engine;
+       enum ccp_aes_type type;
+       enum ccp_aes_mode mode;
+
+       struct scatterlist key_sg;
+       unsigned int key_len;
+       u8 key[AES_MAX_KEY_SIZE];
+
+       u8 nonce[CTR_RFC3686_NONCE_SIZE];
+
+       /* CMAC key structures */
+       struct scatterlist k1_sg;
+       struct scatterlist k2_sg;
+       unsigned int kn_len;
+       u8 k1[AES_BLOCK_SIZE];
+       u8 k2[AES_BLOCK_SIZE];
+};
+
+struct ccp_aes_req_ctx {
+       struct scatterlist iv_sg;
+       u8 iv[AES_BLOCK_SIZE];
+
+       /* Fields used for RFC3686 requests */
+       u8 *rfc3686_info;
+       u8 rfc3686_iv[AES_BLOCK_SIZE];
+
+       struct ccp_cmd cmd;
+};
+
+struct ccp_aes_cmac_req_ctx {
+       unsigned int null_msg;
+       unsigned int final;
+
+       struct scatterlist *src;
+       unsigned int nbytes;
+
+       u64 hash_cnt;
+       unsigned int hash_rem;
+
+       struct sg_table data_sg;
+
+       struct scatterlist iv_sg;
+       u8 iv[AES_BLOCK_SIZE];
+
+       struct scatterlist buf_sg;
+       unsigned int buf_count;
+       u8 buf[AES_BLOCK_SIZE];
+
+       struct scatterlist pad_sg;
+       unsigned int pad_count;
+       u8 pad[AES_BLOCK_SIZE];
+
+       struct ccp_cmd cmd;
+};
+
+/***** SHA related defines *****/
+#define MAX_SHA_CONTEXT_SIZE   SHA256_DIGEST_SIZE
+#define MAX_SHA_BLOCK_SIZE     SHA256_BLOCK_SIZE
+
+struct ccp_sha_ctx {
+       unsigned int key_len;
+       u8 key[MAX_SHA_BLOCK_SIZE];
+       u8 ipad[MAX_SHA_BLOCK_SIZE];
+       u8 opad[MAX_SHA_BLOCK_SIZE];
+       struct crypto_ahash *hmac_tfm;
+};
+
+struct ccp_sha_req_ctx {
+       enum ccp_sha_type type;
+
+       u64 msg_bits;
+
+       unsigned int first;
+       unsigned int final;
+
+       struct scatterlist *src;
+       unsigned int nbytes;
+
+       u64 hash_cnt;
+       unsigned int hash_rem;
+
+       struct sg_table data_sg;
+
+       struct scatterlist ctx_sg;
+       u8 ctx[MAX_SHA_CONTEXT_SIZE];
+
+       struct scatterlist buf_sg;
+       unsigned int buf_count;
+       u8 buf[MAX_SHA_BLOCK_SIZE];
+
+       /* HMAC support field */
+       struct scatterlist pad_sg;
+
+       /* CCP driver command */
+       struct ccp_cmd cmd;
+};
+
+/***** Common Context Structure *****/
+struct ccp_ctx {
+       int (*complete)(struct crypto_async_request *req, int ret);
+
+       union {
+               struct ccp_aes_ctx aes;
+               struct ccp_sha_ctx sha;
+       } u;
+};
+
+int ccp_crypto_enqueue_request(struct crypto_async_request *req,
+                              struct ccp_cmd *cmd);
+struct scatterlist *ccp_crypto_sg_table_add(struct sg_table *table,
+                                           struct scatterlist *sg_add);
+
+int ccp_register_aes_algs(struct list_head *head);
+int ccp_register_aes_cmac_algs(struct list_head *head);
+int ccp_register_aes_xts_algs(struct list_head *head);
+int ccp_register_sha_algs(struct list_head *head);
+
+#endif
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
new file mode 100644 (file)
index 0000000..c3bc212
--- /dev/null
@@ -0,0 +1,595 @@
+/*
+ * AMD Cryptographic Coprocessor (CCP) driver
+ *
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Tom Lendacky <thomas.lendacky@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/kthread.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/spinlock.h>
+#include <linux/mutex.h>
+#include <linux/delay.h>
+#include <linux/hw_random.h>
+#include <linux/cpu.h>
+#include <asm/cpu_device_id.h>
+#include <linux/ccp.h>
+
+#include "ccp-dev.h"
+
+MODULE_AUTHOR("Tom Lendacky <thomas.lendacky@amd.com>");
+MODULE_LICENSE("GPL");
+MODULE_VERSION("1.0.0");
+MODULE_DESCRIPTION("AMD Cryptographic Coprocessor driver");
+
+
+static struct ccp_device *ccp_dev;
+static inline struct ccp_device *ccp_get_device(void)
+{
+       return ccp_dev;
+}
+
+static inline void ccp_add_device(struct ccp_device *ccp)
+{
+       ccp_dev = ccp;
+}
+
+static inline void ccp_del_device(struct ccp_device *ccp)
+{
+       ccp_dev = NULL;
+}
+
+/**
+ * ccp_enqueue_cmd - queue an operation for processing by the CCP
+ *
+ * @cmd: ccp_cmd struct to be processed
+ *
+ * Queue a cmd to be processed by the CCP. If queueing the cmd
+ * would exceed the defined length of the cmd queue the cmd will
+ * only be queued if the CCP_CMD_MAY_BACKLOG flag is set and will
+ * result in a return code of -EBUSY.
+ *
+ * The callback routine specified in the ccp_cmd struct will be
+ * called to notify the caller of completion (if the cmd was not
+ * backlogged) or advancement out of the backlog. If the cmd has
+ * advanced out of the backlog the "err" value of the callback
+ * will be -EINPROGRESS. Any other "err" value during callback is
+ * the result of the operation.
+ *
+ * The cmd has been successfully queued if:
+ *   the return code is -EINPROGRESS or
+ *   the return code is -EBUSY and CCP_CMD_MAY_BACKLOG flag is set
+ */
+int ccp_enqueue_cmd(struct ccp_cmd *cmd)
+{
+       struct ccp_device *ccp = ccp_get_device();
+       unsigned long flags;
+       unsigned int i;
+       int ret;
+
+       if (!ccp)
+               return -ENODEV;
+
+       /* Caller must supply a callback routine */
+       if (!cmd->callback)
+               return -EINVAL;
+
+       cmd->ccp = ccp;
+
+       spin_lock_irqsave(&ccp->cmd_lock, flags);
+
+       i = ccp->cmd_q_count;
+
+       if (ccp->cmd_count >= MAX_CMD_QLEN) {
+               ret = -EBUSY;
+               if (cmd->flags & CCP_CMD_MAY_BACKLOG)
+                       list_add_tail(&cmd->entry, &ccp->backlog);
+       } else {
+               ret = -EINPROGRESS;
+               ccp->cmd_count++;
+               list_add_tail(&cmd->entry, &ccp->cmd);
+
+               /* Find an idle queue */
+               if (!ccp->suspending) {
+                       for (i = 0; i < ccp->cmd_q_count; i++) {
+                               if (ccp->cmd_q[i].active)
+                                       continue;
+
+                               break;
+                       }
+               }
+       }
+
+       spin_unlock_irqrestore(&ccp->cmd_lock, flags);
+
+       /* If we found an idle queue, wake it up */
+       if (i < ccp->cmd_q_count)
+               wake_up_process(ccp->cmd_q[i].kthread);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(ccp_enqueue_cmd);
+
+static void ccp_do_cmd_backlog(struct work_struct *work)
+{
+       struct ccp_cmd *cmd = container_of(work, struct ccp_cmd, work);
+       struct ccp_device *ccp = cmd->ccp;
+       unsigned long flags;
+       unsigned int i;
+
+       cmd->callback(cmd->data, -EINPROGRESS);
+
+       spin_lock_irqsave(&ccp->cmd_lock, flags);
+
+       ccp->cmd_count++;
+       list_add_tail(&cmd->entry, &ccp->cmd);
+
+       /* Find an idle queue */
+       for (i = 0; i < ccp->cmd_q_count; i++) {
+               if (ccp->cmd_q[i].active)
+                       continue;
+
+               break;
+       }
+
+       spin_unlock_irqrestore(&ccp->cmd_lock, flags);
+
+       /* If we found an idle queue, wake it up */
+       if (i < ccp->cmd_q_count)
+               wake_up_process(ccp->cmd_q[i].kthread);
+}
+
+static struct ccp_cmd *ccp_dequeue_cmd(struct ccp_cmd_queue *cmd_q)
+{
+       struct ccp_device *ccp = cmd_q->ccp;
+       struct ccp_cmd *cmd = NULL;
+       struct ccp_cmd *backlog = NULL;
+       unsigned long flags;
+
+       spin_lock_irqsave(&ccp->cmd_lock, flags);
+
+       cmd_q->active = 0;
+
+       if (ccp->suspending) {
+               cmd_q->suspended = 1;
+
+               spin_unlock_irqrestore(&ccp->cmd_lock, flags);
+               wake_up_interruptible(&ccp->suspend_queue);
+
+               return NULL;
+       }
+
+       if (ccp->cmd_count) {
+               cmd_q->active = 1;
+
+               cmd = list_first_entry(&ccp->cmd, struct ccp_cmd, entry);
+               list_del(&cmd->entry);
+
+               ccp->cmd_count--;
+       }
+
+       if (!list_empty(&ccp->backlog)) {
+               backlog = list_first_entry(&ccp->backlog, struct ccp_cmd,
+                                          entry);
+               list_del(&backlog->entry);
+       }
+
+       spin_unlock_irqrestore(&ccp->cmd_lock, flags);
+
+       if (backlog) {
+               INIT_WORK(&backlog->work, ccp_do_cmd_backlog);
+               schedule_work(&backlog->work);
+       }
+
+       return cmd;
+}
+
+static void ccp_do_cmd_complete(struct work_struct *work)
+{
+       struct ccp_cmd *cmd = container_of(work, struct ccp_cmd, work);
+
+       cmd->callback(cmd->data, cmd->ret);
+}
+
+static int ccp_cmd_queue_thread(void *data)
+{
+       struct ccp_cmd_queue *cmd_q = (struct ccp_cmd_queue *)data;
+       struct ccp_cmd *cmd;
+
+       set_current_state(TASK_INTERRUPTIBLE);
+       while (!kthread_should_stop()) {
+               schedule();
+
+               set_current_state(TASK_INTERRUPTIBLE);
+
+               cmd = ccp_dequeue_cmd(cmd_q);
+               if (!cmd)
+                       continue;
+
+               __set_current_state(TASK_RUNNING);
+
+               /* Execute the command */
+               cmd->ret = ccp_run_cmd(cmd_q, cmd);
+
+               /* Schedule the completion callback */
+               INIT_WORK(&cmd->work, ccp_do_cmd_complete);
+               schedule_work(&cmd->work);
+       }
+
+       __set_current_state(TASK_RUNNING);
+
+       return 0;
+}
+
+static int ccp_trng_read(struct hwrng *rng, void *data, size_t max, bool wait)
+{
+       struct ccp_device *ccp = container_of(rng, struct ccp_device, hwrng);
+       u32 trng_value;
+       int len = min_t(int, sizeof(trng_value), max);
+
+       /*
+        * Locking is provided by the caller so we can update device
+        * hwrng-related fields safely
+        */
+       trng_value = ioread32(ccp->io_regs + TRNG_OUT_REG);
+       if (!trng_value) {
+               /* Zero is returned if not data is available or if a
+                * bad-entropy error is present. Assume an error if
+                * we exceed TRNG_RETRIES reads of zero.
+                */
+               if (ccp->hwrng_retries++ > TRNG_RETRIES)
+                       return -EIO;
+
+               return 0;
+       }
+
+       /* Reset the counter and save the rng value */
+       ccp->hwrng_retries = 0;
+       memcpy(data, &trng_value, len);
+
+       return len;
+}
+
+/**
+ * ccp_alloc_struct - allocate and initialize the ccp_device struct
+ *
+ * @dev: device struct of the CCP
+ */
+struct ccp_device *ccp_alloc_struct(struct device *dev)
+{
+       struct ccp_device *ccp;
+
+       ccp = kzalloc(sizeof(*ccp), GFP_KERNEL);
+       if (ccp == NULL) {
+               dev_err(dev, "unable to allocate device struct\n");
+               return NULL;
+       }
+       ccp->dev = dev;
+
+       INIT_LIST_HEAD(&ccp->cmd);
+       INIT_LIST_HEAD(&ccp->backlog);
+
+       spin_lock_init(&ccp->cmd_lock);
+       mutex_init(&ccp->req_mutex);
+       mutex_init(&ccp->ksb_mutex);
+       ccp->ksb_count = KSB_COUNT;
+       ccp->ksb_start = 0;
+
+       return ccp;
+}
+
+/**
+ * ccp_init - initialize the CCP device
+ *
+ * @ccp: ccp_device struct
+ */
+int ccp_init(struct ccp_device *ccp)
+{
+       struct device *dev = ccp->dev;
+       struct ccp_cmd_queue *cmd_q;
+       struct dma_pool *dma_pool;
+       char dma_pool_name[MAX_DMAPOOL_NAME_LEN];
+       unsigned int qmr, qim, i;
+       int ret;
+
+       /* Find available queues */
+       qim = 0;
+       qmr = ioread32(ccp->io_regs + Q_MASK_REG);
+       for (i = 0; i < MAX_HW_QUEUES; i++) {
+               if (!(qmr & (1 << i)))
+                       continue;
+
+               /* Allocate a dma pool for this queue */
+               snprintf(dma_pool_name, sizeof(dma_pool_name), "ccp_q%d", i);
+               dma_pool = dma_pool_create(dma_pool_name, dev,
+                                          CCP_DMAPOOL_MAX_SIZE,
+                                          CCP_DMAPOOL_ALIGN, 0);
+               if (!dma_pool) {
+                       dev_err(dev, "unable to allocate dma pool\n");
+                       ret = -ENOMEM;
+                       goto e_pool;
+               }
+
+               cmd_q = &ccp->cmd_q[ccp->cmd_q_count];
+               ccp->cmd_q_count++;
+
+               cmd_q->ccp = ccp;
+               cmd_q->id = i;
+               cmd_q->dma_pool = dma_pool;
+
+               /* Reserve 2 KSB regions for the queue */
+               cmd_q->ksb_key = KSB_START + ccp->ksb_start++;
+               cmd_q->ksb_ctx = KSB_START + ccp->ksb_start++;
+               ccp->ksb_count -= 2;
+
+               /* Preset some register values and masks that are queue
+                * number dependent
+                */
+               cmd_q->reg_status = ccp->io_regs + CMD_Q_STATUS_BASE +
+                                   (CMD_Q_STATUS_INCR * i);
+               cmd_q->reg_int_status = ccp->io_regs + CMD_Q_INT_STATUS_BASE +
+                                       (CMD_Q_STATUS_INCR * i);
+               cmd_q->int_ok = 1 << (i * 2);
+               cmd_q->int_err = 1 << ((i * 2) + 1);
+
+               cmd_q->free_slots = CMD_Q_DEPTH(ioread32(cmd_q->reg_status));
+
+               init_waitqueue_head(&cmd_q->int_queue);
+
+               /* Build queue interrupt mask (two interrupts per queue) */
+               qim |= cmd_q->int_ok | cmd_q->int_err;
+
+               dev_dbg(dev, "queue #%u available\n", i);
+       }
+       if (ccp->cmd_q_count == 0) {
+               dev_notice(dev, "no command queues available\n");
+               ret = -EIO;
+               goto e_pool;
+       }
+       dev_notice(dev, "%u command queues available\n", ccp->cmd_q_count);
+
+       /* Disable and clear interrupts until ready */
+       iowrite32(0x00, ccp->io_regs + IRQ_MASK_REG);
+       for (i = 0; i < ccp->cmd_q_count; i++) {
+               cmd_q = &ccp->cmd_q[i];
+
+               ioread32(cmd_q->reg_int_status);
+               ioread32(cmd_q->reg_status);
+       }
+       iowrite32(qim, ccp->io_regs + IRQ_STATUS_REG);
+
+       /* Request an irq */
+       ret = ccp->get_irq(ccp);
+       if (ret) {
+               dev_err(dev, "unable to allocate an IRQ\n");
+               goto e_pool;
+       }
+
+       /* Initialize the queues used to wait for KSB space and suspend */
+       init_waitqueue_head(&ccp->ksb_queue);
+       init_waitqueue_head(&ccp->suspend_queue);
+
+       /* Create a kthread for each queue */
+       for (i = 0; i < ccp->cmd_q_count; i++) {
+               struct task_struct *kthread;
+
+               cmd_q = &ccp->cmd_q[i];
+
+               kthread = kthread_create(ccp_cmd_queue_thread, cmd_q,
+                                        "ccp-q%u", cmd_q->id);
+               if (IS_ERR(kthread)) {
+                       dev_err(dev, "error creating queue thread (%ld)\n",
+                               PTR_ERR(kthread));
+                       ret = PTR_ERR(kthread);
+                       goto e_kthread;
+               }
+
+               cmd_q->kthread = kthread;
+               wake_up_process(kthread);
+       }
+
+       /* Register the RNG */
+       ccp->hwrng.name = "ccp-rng";
+       ccp->hwrng.read = ccp_trng_read;
+       ret = hwrng_register(&ccp->hwrng);
+       if (ret) {
+               dev_err(dev, "error registering hwrng (%d)\n", ret);
+               goto e_kthread;
+       }
+
+       /* Make the device struct available before enabling interrupts */
+       ccp_add_device(ccp);
+
+       /* Enable interrupts */
+       iowrite32(qim, ccp->io_regs + IRQ_MASK_REG);
+
+       return 0;
+
+e_kthread:
+       for (i = 0; i < ccp->cmd_q_count; i++)
+               if (ccp->cmd_q[i].kthread)
+                       kthread_stop(ccp->cmd_q[i].kthread);
+
+       ccp->free_irq(ccp);
+
+e_pool:
+       for (i = 0; i < ccp->cmd_q_count; i++)
+               dma_pool_destroy(ccp->cmd_q[i].dma_pool);
+
+       return ret;
+}
+
+/**
+ * ccp_destroy - tear down the CCP device
+ *
+ * @ccp: ccp_device struct
+ */
+void ccp_destroy(struct ccp_device *ccp)
+{
+       struct ccp_cmd_queue *cmd_q;
+       struct ccp_cmd *cmd;
+       unsigned int qim, i;
+
+       /* Remove general access to the device struct */
+       ccp_del_device(ccp);
+
+       /* Unregister the RNG */
+       hwrng_unregister(&ccp->hwrng);
+
+       /* Stop the queue kthreads */
+       for (i = 0; i < ccp->cmd_q_count; i++)
+               if (ccp->cmd_q[i].kthread)
+                       kthread_stop(ccp->cmd_q[i].kthread);
+
+       /* Build queue interrupt mask (two interrupt masks per queue) */
+       qim = 0;
+       for (i = 0; i < ccp->cmd_q_count; i++) {
+               cmd_q = &ccp->cmd_q[i];
+               qim |= cmd_q->int_ok | cmd_q->int_err;
+       }
+
+       /* Disable and clear interrupts */
+       iowrite32(0x00, ccp->io_regs + IRQ_MASK_REG);
+       for (i = 0; i < ccp->cmd_q_count; i++) {
+               cmd_q = &ccp->cmd_q[i];
+
+               ioread32(cmd_q->reg_int_status);
+               ioread32(cmd_q->reg_status);
+       }
+       iowrite32(qim, ccp->io_regs + IRQ_STATUS_REG);
+
+       ccp->free_irq(ccp);
+
+       for (i = 0; i < ccp->cmd_q_count; i++)
+               dma_pool_destroy(ccp->cmd_q[i].dma_pool);
+
+       /* Flush the cmd and backlog queue */
+       while (!list_empty(&ccp->cmd)) {
+               /* Invoke the callback directly with an error code */
+               cmd = list_first_entry(&ccp->cmd, struct ccp_cmd, entry);
+               list_del(&cmd->entry);
+               cmd->callback(cmd->data, -ENODEV);
+       }
+       while (!list_empty(&ccp->backlog)) {
+               /* Invoke the callback directly with an error code */
+               cmd = list_first_entry(&ccp->backlog, struct ccp_cmd, entry);
+               list_del(&cmd->entry);
+               cmd->callback(cmd->data, -ENODEV);
+       }
+}
+
+/**
+ * ccp_irq_handler - handle interrupts generated by the CCP device
+ *
+ * @irq: the irq associated with the interrupt
+ * @data: the data value supplied when the irq was created
+ */
+irqreturn_t ccp_irq_handler(int irq, void *data)
+{
+       struct device *dev = data;
+       struct ccp_device *ccp = dev_get_drvdata(dev);
+       struct ccp_cmd_queue *cmd_q;
+       u32 q_int, status;
+       unsigned int i;
+
+       status = ioread32(ccp->io_regs + IRQ_STATUS_REG);
+
+       for (i = 0; i < ccp->cmd_q_count; i++) {
+               cmd_q = &ccp->cmd_q[i];
+
+               q_int = status & (cmd_q->int_ok | cmd_q->int_err);
+               if (q_int) {
+                       cmd_q->int_status = status;
+                       cmd_q->q_status = ioread32(cmd_q->reg_status);
+                       cmd_q->q_int_status = ioread32(cmd_q->reg_int_status);
+
+                       /* On error, only save the first error value */
+                       if ((q_int & cmd_q->int_err) && !cmd_q->cmd_error)
+                               cmd_q->cmd_error = CMD_Q_ERROR(cmd_q->q_status);
+
+                       cmd_q->int_rcvd = 1;
+
+                       /* Acknowledge the interrupt and wake the kthread */
+                       iowrite32(q_int, ccp->io_regs + IRQ_STATUS_REG);
+                       wake_up_interruptible(&cmd_q->int_queue);
+               }
+       }
+
+       return IRQ_HANDLED;
+}
+
+#ifdef CONFIG_PM
+bool ccp_queues_suspended(struct ccp_device *ccp)
+{
+       unsigned int suspended = 0;
+       unsigned long flags;
+       unsigned int i;
+
+       spin_lock_irqsave(&ccp->cmd_lock, flags);
+
+       for (i = 0; i < ccp->cmd_q_count; i++)
+               if (ccp->cmd_q[i].suspended)
+                       suspended++;
+
+       spin_unlock_irqrestore(&ccp->cmd_lock, flags);
+
+       return ccp->cmd_q_count == suspended;
+}
+#endif
+
+static const struct x86_cpu_id ccp_support[] = {
+       { X86_VENDOR_AMD, 22, },
+};
+
+static int __init ccp_mod_init(void)
+{
+       struct cpuinfo_x86 *cpuinfo = &boot_cpu_data;
+       int ret;
+
+       if (!x86_match_cpu(ccp_support))
+               return -ENODEV;
+
+       switch (cpuinfo->x86) {
+       case 22:
+               if ((cpuinfo->x86_model < 48) || (cpuinfo->x86_model > 63))
+                       return -ENODEV;
+
+               ret = ccp_pci_init();
+               if (ret)
+                       return ret;
+
+               /* Don't leave the driver loaded if init failed */
+               if (!ccp_get_device()) {
+                       ccp_pci_exit();
+                       return -ENODEV;
+               }
+
+               return 0;
+
+               break;
+       }
+
+       return -ENODEV;
+}
+
+static void __exit ccp_mod_exit(void)
+{
+       struct cpuinfo_x86 *cpuinfo = &boot_cpu_data;
+
+       switch (cpuinfo->x86) {
+       case 22:
+               ccp_pci_exit();
+               break;
+       }
+}
+
+module_init(ccp_mod_init);
+module_exit(ccp_mod_exit);
diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h
new file mode 100644 (file)
index 0000000..7ec536e
--- /dev/null
@@ -0,0 +1,272 @@
+/*
+ * AMD Cryptographic Coprocessor (CCP) driver
+ *
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Tom Lendacky <thomas.lendacky@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __CCP_DEV_H__
+#define __CCP_DEV_H__
+
+#include <linux/device.h>
+#include <linux/pci.h>
+#include <linux/spinlock.h>
+#include <linux/mutex.h>
+#include <linux/list.h>
+#include <linux/wait.h>
+#include <linux/dmapool.h>
+#include <linux/hw_random.h>
+
+
+#define IO_OFFSET                      0x20000
+
+#define MAX_DMAPOOL_NAME_LEN           32
+
+#define MAX_HW_QUEUES                  5
+#define MAX_CMD_QLEN                   100
+
+#define TRNG_RETRIES                   10
+
+
+/****** Register Mappings ******/
+#define Q_MASK_REG                     0x000
+#define TRNG_OUT_REG                   0x00c
+#define IRQ_MASK_REG                   0x040
+#define IRQ_STATUS_REG                 0x200
+
+#define DEL_CMD_Q_JOB                  0x124
+#define DEL_Q_ACTIVE                   0x00000200
+#define DEL_Q_ID_SHIFT                 6
+
+#define CMD_REQ0                       0x180
+#define CMD_REQ_INCR                   0x04
+
+#define CMD_Q_STATUS_BASE              0x210
+#define CMD_Q_INT_STATUS_BASE          0x214
+#define CMD_Q_STATUS_INCR              0x20
+
+#define CMD_Q_CACHE                    0x228
+#define CMD_Q_CACHE_INC                        0x20
+
+#define CMD_Q_ERROR(__qs)              ((__qs) & 0x0000003f);
+#define CMD_Q_DEPTH(__qs)              (((__qs) >> 12) & 0x0000000f);
+
+/****** REQ0 Related Values ******/
+#define REQ0_WAIT_FOR_WRITE            0x00000004
+#define REQ0_INT_ON_COMPLETE           0x00000002
+#define REQ0_STOP_ON_COMPLETE          0x00000001
+
+#define REQ0_CMD_Q_SHIFT               9
+#define REQ0_JOBID_SHIFT               3
+
+/****** REQ1 Related Values ******/
+#define REQ1_PROTECT_SHIFT             27
+#define REQ1_ENGINE_SHIFT              23
+#define REQ1_KEY_KSB_SHIFT             2
+
+#define REQ1_EOM                       0x00000002
+#define REQ1_INIT                      0x00000001
+
+/* AES Related Values */
+#define REQ1_AES_TYPE_SHIFT            21
+#define REQ1_AES_MODE_SHIFT            18
+#define REQ1_AES_ACTION_SHIFT          17
+#define REQ1_AES_CFB_SIZE_SHIFT                10
+
+/* XTS-AES Related Values */
+#define REQ1_XTS_AES_SIZE_SHIFT                10
+
+/* SHA Related Values */
+#define REQ1_SHA_TYPE_SHIFT            21
+
+/* RSA Related Values */
+#define REQ1_RSA_MOD_SIZE_SHIFT                10
+
+/* Pass-Through Related Values */
+#define REQ1_PT_BW_SHIFT               12
+#define REQ1_PT_BS_SHIFT               10
+
+/* ECC Related Values */
+#define REQ1_ECC_AFFINE_CONVERT                0x00200000
+#define REQ1_ECC_FUNCTION_SHIFT                18
+
+/****** REQ4 Related Values ******/
+#define REQ4_KSB_SHIFT                 18
+#define REQ4_MEMTYPE_SHIFT             16
+
+/****** REQ6 Related Values ******/
+#define REQ6_MEMTYPE_SHIFT             16
+
+
+/****** Key Storage Block ******/
+#define KSB_START                      77
+#define KSB_END                                127
+#define KSB_COUNT                      (KSB_END - KSB_START + 1)
+#define CCP_KSB_BITS                   256
+#define CCP_KSB_BYTES                  32
+
+#define CCP_JOBID_MASK                 0x0000003f
+
+#define CCP_DMAPOOL_MAX_SIZE           64
+#define CCP_DMAPOOL_ALIGN              (1 << 5)
+
+#define CCP_REVERSE_BUF_SIZE           64
+
+#define CCP_AES_KEY_KSB_COUNT          1
+#define CCP_AES_CTX_KSB_COUNT          1
+
+#define CCP_XTS_AES_KEY_KSB_COUNT      1
+#define CCP_XTS_AES_CTX_KSB_COUNT      1
+
+#define CCP_SHA_KSB_COUNT              1
+
+#define CCP_RSA_MAX_WIDTH              4096
+
+#define CCP_PASSTHRU_BLOCKSIZE         256
+#define CCP_PASSTHRU_MASKSIZE          32
+#define CCP_PASSTHRU_KSB_COUNT         1
+
+#define CCP_ECC_MODULUS_BYTES          48      /* 384-bits */
+#define CCP_ECC_MAX_OPERANDS           6
+#define CCP_ECC_MAX_OUTPUTS            3
+#define CCP_ECC_SRC_BUF_SIZE           448
+#define CCP_ECC_DST_BUF_SIZE           192
+#define CCP_ECC_OPERAND_SIZE           64
+#define CCP_ECC_OUTPUT_SIZE            64
+#define CCP_ECC_RESULT_OFFSET          60
+#define CCP_ECC_RESULT_SUCCESS         0x0001
+
+
+struct ccp_device;
+struct ccp_cmd;
+
+struct ccp_cmd_queue {
+       struct ccp_device *ccp;
+
+       /* Queue identifier */
+       u32 id;
+
+       /* Queue dma pool */
+       struct dma_pool *dma_pool;
+
+       /* Queue reserved KSB regions */
+       u32 ksb_key;
+       u32 ksb_ctx;
+
+       /* Queue processing thread */
+       struct task_struct *kthread;
+       unsigned int active;
+       unsigned int suspended;
+
+       /* Number of free command slots available */
+       unsigned int free_slots;
+
+       /* Interrupt masks */
+       u32 int_ok;
+       u32 int_err;
+
+       /* Register addresses for queue */
+       void __iomem *reg_status;
+       void __iomem *reg_int_status;
+
+       /* Status values from job */
+       u32 int_status;
+       u32 q_status;
+       u32 q_int_status;
+       u32 cmd_error;
+
+       /* Interrupt wait queue */
+       wait_queue_head_t int_queue;
+       unsigned int int_rcvd;
+} ____cacheline_aligned;
+
+struct ccp_device {
+       struct device *dev;
+
+       /*
+        * Bus specific device information
+        */
+       void *dev_specific;
+       int (*get_irq)(struct ccp_device *ccp);
+       void (*free_irq)(struct ccp_device *ccp);
+
+       /*
+        * I/O area used for device communication. The register mapping
+        * starts at an offset into the mapped bar.
+        *   The CMD_REQx registers and the Delete_Cmd_Queue_Job register
+        *   need to be protected while a command queue thread is accessing
+        *   them.
+        */
+       struct mutex req_mutex ____cacheline_aligned;
+       void __iomem *io_map;
+       void __iomem *io_regs;
+
+       /*
+        * Master lists that all cmds are queued on. Because there can be
+        * more than one CCP command queue that can process a cmd a separate
+        * backlog list is neeeded so that the backlog completion call
+        * completes before the cmd is available for execution.
+        */
+       spinlock_t cmd_lock ____cacheline_aligned;
+       unsigned int cmd_count;
+       struct list_head cmd;
+       struct list_head backlog;
+
+       /*
+        * The command queues. These represent the queues available on the
+        * CCP that are available for processing cmds
+        */
+       struct ccp_cmd_queue cmd_q[MAX_HW_QUEUES];
+       unsigned int cmd_q_count;
+
+       /*
+        * Support for the CCP True RNG
+        */
+       struct hwrng hwrng;
+       unsigned int hwrng_retries;
+
+       /*
+        * A counter used to generate job-ids for cmds submitted to the CCP
+        */
+       atomic_t current_id ____cacheline_aligned;
+
+       /*
+        * The CCP uses key storage blocks (KSB) to maintain context for certain
+        * operations. To prevent multiple cmds from using the same KSB range
+        * a command queue reserves a KSB range for the duration of the cmd.
+        * Each queue, will however, reserve 2 KSB blocks for operations that
+        * only require single KSB entries (eg. AES context/iv and key) in order
+        * to avoid allocation contention.  This will reserve at most 10 KSB
+        * entries, leaving 40 KSB entries available for dynamic allocation.
+        */
+       struct mutex ksb_mutex ____cacheline_aligned;
+       DECLARE_BITMAP(ksb, KSB_COUNT);
+       wait_queue_head_t ksb_queue;
+       unsigned int ksb_avail;
+       unsigned int ksb_count;
+       u32 ksb_start;
+
+       /* Suspend support */
+       unsigned int suspending;
+       wait_queue_head_t suspend_queue;
+};
+
+
+int ccp_pci_init(void);
+void ccp_pci_exit(void);
+
+struct ccp_device *ccp_alloc_struct(struct device *dev);
+int ccp_init(struct ccp_device *ccp);
+void ccp_destroy(struct ccp_device *ccp);
+bool ccp_queues_suspended(struct ccp_device *ccp);
+
+irqreturn_t ccp_irq_handler(int irq, void *data);
+
+int ccp_run_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd);
+
+#endif
diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
new file mode 100644 (file)
index 0000000..71ed3ad
--- /dev/null
@@ -0,0 +1,2024 @@
+/*
+ * AMD Cryptographic Coprocessor (CCP) driver
+ *
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Tom Lendacky <thomas.lendacky@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <linux/kthread.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/spinlock.h>
+#include <linux/mutex.h>
+#include <linux/delay.h>
+#include <linux/ccp.h>
+#include <linux/scatterlist.h>
+#include <crypto/scatterwalk.h>
+
+#include "ccp-dev.h"
+
+
+enum ccp_memtype {
+       CCP_MEMTYPE_SYSTEM = 0,
+       CCP_MEMTYPE_KSB,
+       CCP_MEMTYPE_LOCAL,
+       CCP_MEMTYPE__LAST,
+};
+
+struct ccp_dma_info {
+       dma_addr_t address;
+       unsigned int offset;
+       unsigned int length;
+       enum dma_data_direction dir;
+};
+
+struct ccp_dm_workarea {
+       struct device *dev;
+       struct dma_pool *dma_pool;
+       unsigned int length;
+
+       u8 *address;
+       struct ccp_dma_info dma;
+};
+
+struct ccp_sg_workarea {
+       struct scatterlist *sg;
+       unsigned int nents;
+       unsigned int length;
+
+       struct scatterlist *dma_sg;
+       struct device *dma_dev;
+       unsigned int dma_count;
+       enum dma_data_direction dma_dir;
+
+       unsigned int sg_used;
+
+       u64 bytes_left;
+};
+
+struct ccp_data {
+       struct ccp_sg_workarea sg_wa;
+       struct ccp_dm_workarea dm_wa;
+};
+
+struct ccp_mem {
+       enum ccp_memtype type;
+       union {
+               struct ccp_dma_info dma;
+               u32 ksb;
+       } u;
+};
+
+struct ccp_aes_op {
+       enum ccp_aes_type type;
+       enum ccp_aes_mode mode;
+       enum ccp_aes_action action;
+};
+
+struct ccp_xts_aes_op {
+       enum ccp_aes_action action;
+       enum ccp_xts_aes_unit_size unit_size;
+};
+
+struct ccp_sha_op {
+       enum ccp_sha_type type;
+       u64 msg_bits;
+};
+
+struct ccp_rsa_op {
+       u32 mod_size;
+       u32 input_len;
+};
+
+struct ccp_passthru_op {
+       enum ccp_passthru_bitwise bit_mod;
+       enum ccp_passthru_byteswap byte_swap;
+};
+
+struct ccp_ecc_op {
+       enum ccp_ecc_function function;
+};
+
+struct ccp_op {
+       struct ccp_cmd_queue *cmd_q;
+
+       u32 jobid;
+       u32 ioc;
+       u32 soc;
+       u32 ksb_key;
+       u32 ksb_ctx;
+       u32 init;
+       u32 eom;
+
+       struct ccp_mem src;
+       struct ccp_mem dst;
+
+       union {
+               struct ccp_aes_op aes;
+               struct ccp_xts_aes_op xts;
+               struct ccp_sha_op sha;
+               struct ccp_rsa_op rsa;
+               struct ccp_passthru_op passthru;
+               struct ccp_ecc_op ecc;
+       } u;
+};
+
+/* The CCP cannot perform zero-length sha operations so the caller
+ * is required to buffer data for the final operation.  However, a
+ * sha operation for a message with a total length of zero is valid
+ * so known values are required to supply the result.
+ */
+static const u8 ccp_sha1_zero[CCP_SHA_CTXSIZE] = {
+       0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d,
+       0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90,
+       0xaf, 0xd8, 0x07, 0x09, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+static const u8 ccp_sha224_zero[CCP_SHA_CTXSIZE] = {
+       0xd1, 0x4a, 0x02, 0x8c, 0x2a, 0x3a, 0x2b, 0xc9,
+       0x47, 0x61, 0x02, 0xbb, 0x28, 0x82, 0x34, 0xc4,
+       0x15, 0xa2, 0xb0, 0x1f, 0x82, 0x8e, 0xa6, 0x2a,
+       0xc5, 0xb3, 0xe4, 0x2f, 0x00, 0x00, 0x00, 0x00,
+};
+
+static const u8 ccp_sha256_zero[CCP_SHA_CTXSIZE] = {
+       0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14,
+       0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24,
+       0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c,
+       0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55,
+};
+
+static u32 ccp_addr_lo(struct ccp_dma_info *info)
+{
+       return lower_32_bits(info->address + info->offset);
+}
+
+static u32 ccp_addr_hi(struct ccp_dma_info *info)
+{
+       return upper_32_bits(info->address + info->offset) & 0x0000ffff;
+}
+
+static int ccp_do_cmd(struct ccp_op *op, u32 *cr, unsigned int cr_count)
+{
+       struct ccp_cmd_queue *cmd_q = op->cmd_q;
+       struct ccp_device *ccp = cmd_q->ccp;
+       void __iomem *cr_addr;
+       u32 cr0, cmd;
+       unsigned int i;
+       int ret = 0;
+
+       /* We could read a status register to see how many free slots
+        * are actually available, but reading that register resets it
+        * and you could lose some error information.
+        */
+       cmd_q->free_slots--;
+
+       cr0 = (cmd_q->id << REQ0_CMD_Q_SHIFT)
+             | (op->jobid << REQ0_JOBID_SHIFT)
+             | REQ0_WAIT_FOR_WRITE;
+
+       if (op->soc)
+               cr0 |= REQ0_STOP_ON_COMPLETE
+                      | REQ0_INT_ON_COMPLETE;
+
+       if (op->ioc || !cmd_q->free_slots)
+               cr0 |= REQ0_INT_ON_COMPLETE;
+
+       /* Start at CMD_REQ1 */
+       cr_addr = ccp->io_regs + CMD_REQ0 + CMD_REQ_INCR;
+
+       mutex_lock(&ccp->req_mutex);
+
+       /* Write CMD_REQ1 through CMD_REQx first */
+       for (i = 0; i < cr_count; i++, cr_addr += CMD_REQ_INCR)
+               iowrite32(*(cr + i), cr_addr);
+
+       /* Tell the CCP to start */
+       wmb();
+       iowrite32(cr0, ccp->io_regs + CMD_REQ0);
+
+       mutex_unlock(&ccp->req_mutex);
+
+       if (cr0 & REQ0_INT_ON_COMPLETE) {
+               /* Wait for the job to complete */
+               ret = wait_event_interruptible(cmd_q->int_queue,
+                                              cmd_q->int_rcvd);
+               if (ret || cmd_q->cmd_error) {
+                       /* On error delete all related jobs from the queue */
+                       cmd = (cmd_q->id << DEL_Q_ID_SHIFT)
+                             | op->jobid;
+
+                       iowrite32(cmd, ccp->io_regs + DEL_CMD_Q_JOB);
+
+                       if (!ret)
+                               ret = -EIO;
+               } else if (op->soc) {
+                       /* Delete just head job from the queue on SoC */
+                       cmd = DEL_Q_ACTIVE
+                             | (cmd_q->id << DEL_Q_ID_SHIFT)
+                             | op->jobid;
+
+                       iowrite32(cmd, ccp->io_regs + DEL_CMD_Q_JOB);
+               }
+
+               cmd_q->free_slots = CMD_Q_DEPTH(cmd_q->q_status);
+
+               cmd_q->int_rcvd = 0;
+       }
+
+       return ret;
+}
+
+static int ccp_perform_aes(struct ccp_op *op)
+{
+       u32 cr[6];
+
+       /* Fill out the register contents for REQ1 through REQ6 */
+       cr[0] = (CCP_ENGINE_AES << REQ1_ENGINE_SHIFT)
+               | (op->u.aes.type << REQ1_AES_TYPE_SHIFT)
+               | (op->u.aes.mode << REQ1_AES_MODE_SHIFT)
+               | (op->u.aes.action << REQ1_AES_ACTION_SHIFT)
+               | (op->ksb_key << REQ1_KEY_KSB_SHIFT);
+       cr[1] = op->src.u.dma.length - 1;
+       cr[2] = ccp_addr_lo(&op->src.u.dma);
+       cr[3] = (op->ksb_ctx << REQ4_KSB_SHIFT)
+               | (CCP_MEMTYPE_SYSTEM << REQ4_MEMTYPE_SHIFT)
+               | ccp_addr_hi(&op->src.u.dma);
+       cr[4] = ccp_addr_lo(&op->dst.u.dma);
+       cr[5] = (CCP_MEMTYPE_SYSTEM << REQ6_MEMTYPE_SHIFT)
+               | ccp_addr_hi(&op->dst.u.dma);
+
+       if (op->u.aes.mode == CCP_AES_MODE_CFB)
+               cr[0] |= ((0x7f) << REQ1_AES_CFB_SIZE_SHIFT);
+
+       if (op->eom)
+               cr[0] |= REQ1_EOM;
+
+       if (op->init)
+               cr[0] |= REQ1_INIT;
+
+       return ccp_do_cmd(op, cr, ARRAY_SIZE(cr));
+}
+
+static int ccp_perform_xts_aes(struct ccp_op *op)
+{
+       u32 cr[6];
+
+       /* Fill out the register contents for REQ1 through REQ6 */
+       cr[0] = (CCP_ENGINE_XTS_AES_128 << REQ1_ENGINE_SHIFT)
+               | (op->u.xts.action << REQ1_AES_ACTION_SHIFT)
+               | (op->u.xts.unit_size << REQ1_XTS_AES_SIZE_SHIFT)
+               | (op->ksb_key << REQ1_KEY_KSB_SHIFT);
+       cr[1] = op->src.u.dma.length - 1;
+       cr[2] = ccp_addr_lo(&op->src.u.dma);
+       cr[3] = (op->ksb_ctx << REQ4_KSB_SHIFT)
+               | (CCP_MEMTYPE_SYSTEM << REQ4_MEMTYPE_SHIFT)
+               | ccp_addr_hi(&op->src.u.dma);
+       cr[4] = ccp_addr_lo(&op->dst.u.dma);
+       cr[5] = (CCP_MEMTYPE_SYSTEM << REQ6_MEMTYPE_SHIFT)
+               | ccp_addr_hi(&op->dst.u.dma);
+
+       if (op->eom)
+               cr[0] |= REQ1_EOM;
+
+       if (op->init)
+               cr[0] |= REQ1_INIT;
+
+       return ccp_do_cmd(op, cr, ARRAY_SIZE(cr));
+}
+
+static int ccp_perform_sha(struct ccp_op *op)
+{
+       u32 cr[6];
+
+       /* Fill out the register contents for REQ1 through REQ6 */
+       cr[0] = (CCP_ENGINE_SHA << REQ1_ENGINE_SHIFT)
+               | (op->u.sha.type << REQ1_SHA_TYPE_SHIFT)
+               | REQ1_INIT;
+       cr[1] = op->src.u.dma.length - 1;
+       cr[2] = ccp_addr_lo(&op->src.u.dma);
+       cr[3] = (op->ksb_ctx << REQ4_KSB_SHIFT)
+               | (CCP_MEMTYPE_SYSTEM << REQ4_MEMTYPE_SHIFT)
+               | ccp_addr_hi(&op->src.u.dma);
+
+       if (op->eom) {
+               cr[0] |= REQ1_EOM;
+               cr[4] = lower_32_bits(op->u.sha.msg_bits);
+               cr[5] = upper_32_bits(op->u.sha.msg_bits);
+       } else {
+               cr[4] = 0;
+               cr[5] = 0;
+       }
+
+       return ccp_do_cmd(op, cr, ARRAY_SIZE(cr));
+}
+
+static int ccp_perform_rsa(struct ccp_op *op)
+{
+       u32 cr[6];
+
+       /* Fill out the register contents for REQ1 through REQ6 */
+       cr[0] = (CCP_ENGINE_RSA << REQ1_ENGINE_SHIFT)
+               | (op->u.rsa.mod_size << REQ1_RSA_MOD_SIZE_SHIFT)
+               | (op->ksb_key << REQ1_KEY_KSB_SHIFT)
+               | REQ1_EOM;
+       cr[1] = op->u.rsa.input_len - 1;
+       cr[2] = ccp_addr_lo(&op->src.u.dma);
+       cr[3] = (op->ksb_ctx << REQ4_KSB_SHIFT)
+               | (CCP_MEMTYPE_SYSTEM << REQ4_MEMTYPE_SHIFT)
+               | ccp_addr_hi(&op->src.u.dma);
+       cr[4] = ccp_addr_lo(&op->dst.u.dma);
+       cr[5] = (CCP_MEMTYPE_SYSTEM << REQ6_MEMTYPE_SHIFT)
+               | ccp_addr_hi(&op->dst.u.dma);
+
+       return ccp_do_cmd(op, cr, ARRAY_SIZE(cr));
+}
+
+static int ccp_perform_passthru(struct ccp_op *op)
+{
+       u32 cr[6];
+
+       /* Fill out the register contents for REQ1 through REQ6 */
+       cr[0] = (CCP_ENGINE_PASSTHRU << REQ1_ENGINE_SHIFT)
+               | (op->u.passthru.bit_mod << REQ1_PT_BW_SHIFT)
+               | (op->u.passthru.byte_swap << REQ1_PT_BS_SHIFT);
+
+       if (op->src.type == CCP_MEMTYPE_SYSTEM)
+               cr[1] = op->src.u.dma.length - 1;
+       else
+               cr[1] = op->dst.u.dma.length - 1;
+
+       if (op->src.type == CCP_MEMTYPE_SYSTEM) {
+               cr[2] = ccp_addr_lo(&op->src.u.dma);
+               cr[3] = (CCP_MEMTYPE_SYSTEM << REQ4_MEMTYPE_SHIFT)
+                       | ccp_addr_hi(&op->src.u.dma);
+
+               if (op->u.passthru.bit_mod != CCP_PASSTHRU_BITWISE_NOOP)
+                       cr[3] |= (op->ksb_key << REQ4_KSB_SHIFT);
+       } else {
+               cr[2] = op->src.u.ksb * CCP_KSB_BYTES;
+               cr[3] = (CCP_MEMTYPE_KSB << REQ4_MEMTYPE_SHIFT);
+       }
+
+       if (op->dst.type == CCP_MEMTYPE_SYSTEM) {
+               cr[4] = ccp_addr_lo(&op->dst.u.dma);
+               cr[5] = (CCP_MEMTYPE_SYSTEM << REQ6_MEMTYPE_SHIFT)
+                       | ccp_addr_hi(&op->dst.u.dma);
+       } else {
+               cr[4] = op->dst.u.ksb * CCP_KSB_BYTES;
+               cr[5] = (CCP_MEMTYPE_KSB << REQ6_MEMTYPE_SHIFT);
+       }
+
+       if (op->eom)
+               cr[0] |= REQ1_EOM;
+
+       return ccp_do_cmd(op, cr, ARRAY_SIZE(cr));
+}
+
+static int ccp_perform_ecc(struct ccp_op *op)
+{
+       u32 cr[6];
+
+       /* Fill out the register contents for REQ1 through REQ6 */
+       cr[0] = REQ1_ECC_AFFINE_CONVERT
+               | (CCP_ENGINE_ECC << REQ1_ENGINE_SHIFT)
+               | (op->u.ecc.function << REQ1_ECC_FUNCTION_SHIFT)
+               | REQ1_EOM;
+       cr[1] = op->src.u.dma.length - 1;
+       cr[2] = ccp_addr_lo(&op->src.u.dma);
+       cr[3] = (CCP_MEMTYPE_SYSTEM << REQ4_MEMTYPE_SHIFT)
+               | ccp_addr_hi(&op->src.u.dma);
+       cr[4] = ccp_addr_lo(&op->dst.u.dma);
+       cr[5] = (CCP_MEMTYPE_SYSTEM << REQ6_MEMTYPE_SHIFT)
+               | ccp_addr_hi(&op->dst.u.dma);
+
+       return ccp_do_cmd(op, cr, ARRAY_SIZE(cr));
+}
+
+static u32 ccp_alloc_ksb(struct ccp_device *ccp, unsigned int count)
+{
+       int start;
+
+       for (;;) {
+               mutex_lock(&ccp->ksb_mutex);
+
+               start = (u32)bitmap_find_next_zero_area(ccp->ksb,
+                                                       ccp->ksb_count,
+                                                       ccp->ksb_start,
+                                                       count, 0);
+               if (start <= ccp->ksb_count) {
+                       bitmap_set(ccp->ksb, start, count);
+
+                       mutex_unlock(&ccp->ksb_mutex);
+                       break;
+               }
+
+               ccp->ksb_avail = 0;
+
+               mutex_unlock(&ccp->ksb_mutex);
+
+               /* Wait for KSB entries to become available */
+               if (wait_event_interruptible(ccp->ksb_queue, ccp->ksb_avail))
+                       return 0;
+       }
+
+       return KSB_START + start;
+}
+
+static void ccp_free_ksb(struct ccp_device *ccp, unsigned int start,
+                        unsigned int count)
+{
+       if (!start)
+               return;
+
+       mutex_lock(&ccp->ksb_mutex);
+
+       bitmap_clear(ccp->ksb, start - KSB_START, count);
+
+       ccp->ksb_avail = 1;
+
+       mutex_unlock(&ccp->ksb_mutex);
+
+       wake_up_interruptible_all(&ccp->ksb_queue);
+}
+
+static u32 ccp_gen_jobid(struct ccp_device *ccp)
+{
+       return atomic_inc_return(&ccp->current_id) & CCP_JOBID_MASK;
+}
+
+static void ccp_sg_free(struct ccp_sg_workarea *wa)
+{
+       if (wa->dma_count)
+               dma_unmap_sg(wa->dma_dev, wa->dma_sg, wa->nents, wa->dma_dir);
+
+       wa->dma_count = 0;
+}
+
+static int ccp_init_sg_workarea(struct ccp_sg_workarea *wa, struct device *dev,
+                               struct scatterlist *sg, u64 len,
+                               enum dma_data_direction dma_dir)
+{
+       memset(wa, 0, sizeof(*wa));
+
+       wa->sg = sg;
+       if (!sg)
+               return 0;
+
+       wa->nents = sg_nents(sg);
+       wa->length = sg->length;
+       wa->bytes_left = len;
+       wa->sg_used = 0;
+
+       if (len == 0)
+               return 0;
+
+       if (dma_dir == DMA_NONE)
+               return 0;
+
+       wa->dma_sg = sg;
+       wa->dma_dev = dev;
+       wa->dma_dir = dma_dir;
+       wa->dma_count = dma_map_sg(dev, sg, wa->nents, dma_dir);
+       if (!wa->dma_count)
+               return -ENOMEM;
+
+
+       return 0;
+}
+
+static void ccp_update_sg_workarea(struct ccp_sg_workarea *wa, unsigned int len)
+{
+       unsigned int nbytes = min_t(u64, len, wa->bytes_left);
+
+       if (!wa->sg)
+               return;
+
+       wa->sg_used += nbytes;
+       wa->bytes_left -= nbytes;
+       if (wa->sg_used == wa->sg->length) {
+               wa->sg = sg_next(wa->sg);
+               wa->sg_used = 0;
+       }
+}
+
+static void ccp_dm_free(struct ccp_dm_workarea *wa)
+{
+       if (wa->length <= CCP_DMAPOOL_MAX_SIZE) {
+               if (wa->address)
+                       dma_pool_free(wa->dma_pool, wa->address,
+                                     wa->dma.address);
+       } else {
+               if (wa->dma.address)
+                       dma_unmap_single(wa->dev, wa->dma.address, wa->length,
+                                        wa->dma.dir);
+               kfree(wa->address);
+       }
+
+       wa->address = NULL;
+       wa->dma.address = 0;
+}
+
+static int ccp_init_dm_workarea(struct ccp_dm_workarea *wa,
+                               struct ccp_cmd_queue *cmd_q,
+                               unsigned int len,
+                               enum dma_data_direction dir)
+{
+       memset(wa, 0, sizeof(*wa));
+
+       if (!len)
+               return 0;
+
+       wa->dev = cmd_q->ccp->dev;
+       wa->length = len;
+
+       if (len <= CCP_DMAPOOL_MAX_SIZE) {
+               wa->dma_pool = cmd_q->dma_pool;
+
+               wa->address = dma_pool_alloc(wa->dma_pool, GFP_KERNEL,
+                                            &wa->dma.address);
+               if (!wa->address)
+                       return -ENOMEM;
+
+               wa->dma.length = CCP_DMAPOOL_MAX_SIZE;
+
+               memset(wa->address, 0, CCP_DMAPOOL_MAX_SIZE);
+       } else {
+               wa->address = kzalloc(len, GFP_KERNEL);
+               if (!wa->address)
+                       return -ENOMEM;
+
+               wa->dma.address = dma_map_single(wa->dev, wa->address, len,
+                                                dir);
+               if (!wa->dma.address)
+                       return -ENOMEM;
+
+               wa->dma.length = len;
+       }
+       wa->dma.dir = dir;
+
+       return 0;
+}
+
+static void ccp_set_dm_area(struct ccp_dm_workarea *wa, unsigned int wa_offset,
+                           struct scatterlist *sg, unsigned int sg_offset,
+                           unsigned int len)
+{
+       WARN_ON(!wa->address);
+
+       scatterwalk_map_and_copy(wa->address + wa_offset, sg, sg_offset, len,
+                                0);
+}
+
+static void ccp_get_dm_area(struct ccp_dm_workarea *wa, unsigned int wa_offset,
+                           struct scatterlist *sg, unsigned int sg_offset,
+                           unsigned int len)
+{
+       WARN_ON(!wa->address);
+
+       scatterwalk_map_and_copy(wa->address + wa_offset, sg, sg_offset, len,
+                                1);
+}
+
+static void ccp_reverse_set_dm_area(struct ccp_dm_workarea *wa,
+                                   struct scatterlist *sg,
+                                   unsigned int len, unsigned int se_len,
+                                   bool sign_extend)
+{
+       unsigned int nbytes, sg_offset, dm_offset, ksb_len, i;
+       u8 buffer[CCP_REVERSE_BUF_SIZE];
+
+       BUG_ON(se_len > sizeof(buffer));
+
+       sg_offset = len;
+       dm_offset = 0;
+       nbytes = len;
+       while (nbytes) {
+               ksb_len = min_t(unsigned int, nbytes, se_len);
+               sg_offset -= ksb_len;
+
+               scatterwalk_map_and_copy(buffer, sg, sg_offset, ksb_len, 0);
+               for (i = 0; i < ksb_len; i++)
+                       wa->address[dm_offset + i] = buffer[ksb_len - i - 1];
+
+               dm_offset += ksb_len;
+               nbytes -= ksb_len;
+
+               if ((ksb_len != se_len) && sign_extend) {
+                       /* Must sign-extend to nearest sign-extend length */
+                       if (wa->address[dm_offset - 1] & 0x80)
+                               memset(wa->address + dm_offset, 0xff,
+                                      se_len - ksb_len);
+               }
+       }
+}
+
+static void ccp_reverse_get_dm_area(struct ccp_dm_workarea *wa,
+                                   struct scatterlist *sg,
+                                   unsigned int len)
+{
+       unsigned int nbytes, sg_offset, dm_offset, ksb_len, i;
+       u8 buffer[CCP_REVERSE_BUF_SIZE];
+
+       sg_offset = 0;
+       dm_offset = len;
+       nbytes = len;
+       while (nbytes) {
+               ksb_len = min_t(unsigned int, nbytes, sizeof(buffer));
+               dm_offset -= ksb_len;
+
+               for (i = 0; i < ksb_len; i++)
+                       buffer[ksb_len - i - 1] = wa->address[dm_offset + i];
+               scatterwalk_map_and_copy(buffer, sg, sg_offset, ksb_len, 1);
+
+               sg_offset += ksb_len;
+               nbytes -= ksb_len;
+       }
+}
+
+static void ccp_free_data(struct ccp_data *data, struct ccp_cmd_queue *cmd_q)
+{
+       ccp_dm_free(&data->dm_wa);
+       ccp_sg_free(&data->sg_wa);
+}
+
+static int ccp_init_data(struct ccp_data *data, struct ccp_cmd_queue *cmd_q,
+                        struct scatterlist *sg, u64 sg_len,
+                        unsigned int dm_len,
+                        enum dma_data_direction dir)
+{
+       int ret;
+
+       memset(data, 0, sizeof(*data));
+
+       ret = ccp_init_sg_workarea(&data->sg_wa, cmd_q->ccp->dev, sg, sg_len,
+                                  dir);
+       if (ret)
+               goto e_err;
+
+       ret = ccp_init_dm_workarea(&data->dm_wa, cmd_q, dm_len, dir);
+       if (ret)
+               goto e_err;
+
+       return 0;
+
+e_err:
+       ccp_free_data(data, cmd_q);
+
+       return ret;
+}
+
+static unsigned int ccp_queue_buf(struct ccp_data *data, unsigned int from)
+{
+       struct ccp_sg_workarea *sg_wa = &data->sg_wa;
+       struct ccp_dm_workarea *dm_wa = &data->dm_wa;
+       unsigned int buf_count, nbytes;
+
+       /* Clear the buffer if setting it */
+       if (!from)
+               memset(dm_wa->address, 0, dm_wa->length);
+
+       if (!sg_wa->sg)
+               return 0;
+
+       /* Perform the copy operation
+        *   nbytes will always be <= UINT_MAX because dm_wa->length is
+        *   an unsigned int
+        */
+       nbytes = min_t(u64, sg_wa->bytes_left, dm_wa->length);
+       scatterwalk_map_and_copy(dm_wa->address, sg_wa->sg, sg_wa->sg_used,
+                                nbytes, from);
+
+       /* Update the structures and generate the count */
+       buf_count = 0;
+       while (sg_wa->bytes_left && (buf_count < dm_wa->length)) {
+               nbytes = min(sg_wa->sg->length - sg_wa->sg_used,
+                            dm_wa->length - buf_count);
+               nbytes = min_t(u64, sg_wa->bytes_left, nbytes);
+
+               buf_count += nbytes;
+               ccp_update_sg_workarea(sg_wa, nbytes);
+       }
+
+       return buf_count;
+}
+
+static unsigned int ccp_fill_queue_buf(struct ccp_data *data)
+{
+       return ccp_queue_buf(data, 0);
+}
+
+static unsigned int ccp_empty_queue_buf(struct ccp_data *data)
+{
+       return ccp_queue_buf(data, 1);
+}
+
+static void ccp_prepare_data(struct ccp_data *src, struct ccp_data *dst,
+                            struct ccp_op *op, unsigned int block_size,
+                            bool blocksize_op)
+{
+       unsigned int sg_src_len, sg_dst_len, op_len;
+
+       /* The CCP can only DMA from/to one address each per operation. This
+        * requires that we find the smallest DMA area between the source
+        * and destination. The resulting len values will always be <= UINT_MAX
+        * because the dma length is an unsigned int.
+        */
+       sg_src_len = sg_dma_len(src->sg_wa.sg) - src->sg_wa.sg_used;
+       sg_src_len = min_t(u64, src->sg_wa.bytes_left, sg_src_len);
+
+       if (dst) {
+               sg_dst_len = sg_dma_len(dst->sg_wa.sg) - dst->sg_wa.sg_used;
+               sg_dst_len = min_t(u64, src->sg_wa.bytes_left, sg_dst_len);
+               op_len = min(sg_src_len, sg_dst_len);
+       } else
+               op_len = sg_src_len;
+
+       /* The data operation length will be at least block_size in length
+        * or the smaller of available sg room remaining for the source or
+        * the destination
+        */
+       op_len = max(op_len, block_size);
+
+       /* Unless we have to buffer data, there's no reason to wait */
+       op->soc = 0;
+
+       if (sg_src_len < block_size) {
+               /* Not enough data in the sg element, so it
+                * needs to be buffered into a blocksize chunk
+                */
+               int cp_len = ccp_fill_queue_buf(src);
+
+               op->soc = 1;
+               op->src.u.dma.address = src->dm_wa.dma.address;
+               op->src.u.dma.offset = 0;
+               op->src.u.dma.length = (blocksize_op) ? block_size : cp_len;
+       } else {
+               /* Enough data in the sg element, but we need to
+                * adjust for any previously copied data
+                */
+               op->src.u.dma.address = sg_dma_address(src->sg_wa.sg);
+               op->src.u.dma.offset = src->sg_wa.sg_used;
+               op->src.u.dma.length = op_len & ~(block_size - 1);
+
+               ccp_update_sg_workarea(&src->sg_wa, op->src.u.dma.length);
+       }
+
+       if (dst) {
+               if (sg_dst_len < block_size) {
+                       /* Not enough room in the sg element or we're on the
+                        * last piece of data (when using padding), so the
+                        * output needs to be buffered into a blocksize chunk
+                        */
+                       op->soc = 1;
+                       op->dst.u.dma.address = dst->dm_wa.dma.address;
+                       op->dst.u.dma.offset = 0;
+                       op->dst.u.dma.length = op->src.u.dma.length;
+               } else {
+                       /* Enough room in the sg element, but we need to
+                        * adjust for any previously used area
+                        */
+                       op->dst.u.dma.address = sg_dma_address(dst->sg_wa.sg);
+                       op->dst.u.dma.offset = dst->sg_wa.sg_used;
+                       op->dst.u.dma.length = op->src.u.dma.length;
+               }
+       }
+}
+
+static void ccp_process_data(struct ccp_data *src, struct ccp_data *dst,
+                            struct ccp_op *op)
+{
+       op->init = 0;
+
+       if (dst) {
+               if (op->dst.u.dma.address == dst->dm_wa.dma.address)
+                       ccp_empty_queue_buf(dst);
+               else
+                       ccp_update_sg_workarea(&dst->sg_wa,
+                                              op->dst.u.dma.length);
+       }
+}
+
+static int ccp_copy_to_from_ksb(struct ccp_cmd_queue *cmd_q,
+                               struct ccp_dm_workarea *wa, u32 jobid, u32 ksb,
+                               u32 byte_swap, bool from)
+{
+       struct ccp_op op;
+
+       memset(&op, 0, sizeof(op));
+
+       op.cmd_q = cmd_q;
+       op.jobid = jobid;
+       op.eom = 1;
+
+       if (from) {
+               op.soc = 1;
+               op.src.type = CCP_MEMTYPE_KSB;
+               op.src.u.ksb = ksb;
+               op.dst.type = CCP_MEMTYPE_SYSTEM;
+               op.dst.u.dma.address = wa->dma.address;
+               op.dst.u.dma.length = wa->length;
+       } else {
+               op.src.type = CCP_MEMTYPE_SYSTEM;
+               op.src.u.dma.address = wa->dma.address;
+               op.src.u.dma.length = wa->length;
+               op.dst.type = CCP_MEMTYPE_KSB;
+               op.dst.u.ksb = ksb;
+       }
+
+       op.u.passthru.byte_swap = byte_swap;
+
+       return ccp_perform_passthru(&op);
+}
+
+static int ccp_copy_to_ksb(struct ccp_cmd_queue *cmd_q,
+                          struct ccp_dm_workarea *wa, u32 jobid, u32 ksb,
+                          u32 byte_swap)
+{
+       return ccp_copy_to_from_ksb(cmd_q, wa, jobid, ksb, byte_swap, false);
+}
+
+static int ccp_copy_from_ksb(struct ccp_cmd_queue *cmd_q,
+                            struct ccp_dm_workarea *wa, u32 jobid, u32 ksb,
+                            u32 byte_swap)
+{
+       return ccp_copy_to_from_ksb(cmd_q, wa, jobid, ksb, byte_swap, true);
+}
+
+static int ccp_run_aes_cmac_cmd(struct ccp_cmd_queue *cmd_q,
+                               struct ccp_cmd *cmd)
+{
+       struct ccp_aes_engine *aes = &cmd->u.aes;
+       struct ccp_dm_workarea key, ctx;
+       struct ccp_data src;
+       struct ccp_op op;
+       unsigned int dm_offset;
+       int ret;
+
+       if (!((aes->key_len == AES_KEYSIZE_128) ||
+             (aes->key_len == AES_KEYSIZE_192) ||
+             (aes->key_len == AES_KEYSIZE_256)))
+               return -EINVAL;
+
+       if (aes->src_len & (AES_BLOCK_SIZE - 1))
+               return -EINVAL;
+
+       if (aes->iv_len != AES_BLOCK_SIZE)
+               return -EINVAL;
+
+       if (!aes->key || !aes->iv || !aes->src)
+               return -EINVAL;
+
+       if (aes->cmac_final) {
+               if (aes->cmac_key_len != AES_BLOCK_SIZE)
+                       return -EINVAL;
+
+               if (!aes->cmac_key)
+                       return -EINVAL;
+       }
+
+       BUILD_BUG_ON(CCP_AES_KEY_KSB_COUNT != 1);
+       BUILD_BUG_ON(CCP_AES_CTX_KSB_COUNT != 1);
+
+       ret = -EIO;
+       memset(&op, 0, sizeof(op));
+       op.cmd_q = cmd_q;
+       op.jobid = ccp_gen_jobid(cmd_q->ccp);
+       op.ksb_key = cmd_q->ksb_key;
+       op.ksb_ctx = cmd_q->ksb_ctx;
+       op.init = 1;
+       op.u.aes.type = aes->type;
+       op.u.aes.mode = aes->mode;
+       op.u.aes.action = aes->action;
+
+       /* All supported key sizes fit in a single (32-byte) KSB entry
+        * and must be in little endian format. Use the 256-bit byte
+        * swap passthru option to convert from big endian to little
+        * endian.
+        */
+       ret = ccp_init_dm_workarea(&key, cmd_q,
+                                  CCP_AES_KEY_KSB_COUNT * CCP_KSB_BYTES,
+                                  DMA_TO_DEVICE);
+       if (ret)
+               return ret;
+
+       dm_offset = CCP_KSB_BYTES - aes->key_len;
+       ccp_set_dm_area(&key, dm_offset, aes->key, 0, aes->key_len);
+       ret = ccp_copy_to_ksb(cmd_q, &key, op.jobid, op.ksb_key,
+                             CCP_PASSTHRU_BYTESWAP_256BIT);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_key;
+       }
+
+       /* The AES context fits in a single (32-byte) KSB entry and
+        * must be in little endian format. Use the 256-bit byte swap
+        * passthru option to convert from big endian to little endian.
+        */
+       ret = ccp_init_dm_workarea(&ctx, cmd_q,
+                                  CCP_AES_CTX_KSB_COUNT * CCP_KSB_BYTES,
+                                  DMA_BIDIRECTIONAL);
+       if (ret)
+               goto e_key;
+
+       dm_offset = CCP_KSB_BYTES - AES_BLOCK_SIZE;
+       ccp_set_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len);
+       ret = ccp_copy_to_ksb(cmd_q, &ctx, op.jobid, op.ksb_ctx,
+                             CCP_PASSTHRU_BYTESWAP_256BIT);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_ctx;
+       }
+
+       /* Send data to the CCP AES engine */
+       ret = ccp_init_data(&src, cmd_q, aes->src, aes->src_len,
+                           AES_BLOCK_SIZE, DMA_TO_DEVICE);
+       if (ret)
+               goto e_ctx;
+
+       while (src.sg_wa.bytes_left) {
+               ccp_prepare_data(&src, NULL, &op, AES_BLOCK_SIZE, true);
+               if (aes->cmac_final && !src.sg_wa.bytes_left) {
+                       op.eom = 1;
+
+                       /* Push the K1/K2 key to the CCP now */
+                       ret = ccp_copy_from_ksb(cmd_q, &ctx, op.jobid,
+                                               op.ksb_ctx,
+                                               CCP_PASSTHRU_BYTESWAP_256BIT);
+                       if (ret) {
+                               cmd->engine_error = cmd_q->cmd_error;
+                               goto e_src;
+                       }
+
+                       ccp_set_dm_area(&ctx, 0, aes->cmac_key, 0,
+                                       aes->cmac_key_len);
+                       ret = ccp_copy_to_ksb(cmd_q, &ctx, op.jobid, op.ksb_ctx,
+                                             CCP_PASSTHRU_BYTESWAP_256BIT);
+                       if (ret) {
+                               cmd->engine_error = cmd_q->cmd_error;
+                               goto e_src;
+                       }
+               }
+
+               ret = ccp_perform_aes(&op);
+               if (ret) {
+                       cmd->engine_error = cmd_q->cmd_error;
+                       goto e_src;
+               }
+
+               ccp_process_data(&src, NULL, &op);
+       }
+
+       /* Retrieve the AES context - convert from LE to BE using
+        * 32-byte (256-bit) byteswapping
+        */
+       ret = ccp_copy_from_ksb(cmd_q, &ctx, op.jobid, op.ksb_ctx,
+                               CCP_PASSTHRU_BYTESWAP_256BIT);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_src;
+       }
+
+       /* ...but we only need AES_BLOCK_SIZE bytes */
+       dm_offset = CCP_KSB_BYTES - AES_BLOCK_SIZE;
+       ccp_get_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len);
+
+e_src:
+       ccp_free_data(&src, cmd_q);
+
+e_ctx:
+       ccp_dm_free(&ctx);
+
+e_key:
+       ccp_dm_free(&key);
+
+       return ret;
+}
+
+static int ccp_run_aes_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
+{
+       struct ccp_aes_engine *aes = &cmd->u.aes;
+       struct ccp_dm_workarea key, ctx;
+       struct ccp_data src, dst;
+       struct ccp_op op;
+       unsigned int dm_offset;
+       bool in_place = false;
+       int ret;
+
+       if (aes->mode == CCP_AES_MODE_CMAC)
+               return ccp_run_aes_cmac_cmd(cmd_q, cmd);
+
+       if (!((aes->key_len == AES_KEYSIZE_128) ||
+             (aes->key_len == AES_KEYSIZE_192) ||
+             (aes->key_len == AES_KEYSIZE_256)))
+               return -EINVAL;
+
+       if (((aes->mode == CCP_AES_MODE_ECB) ||
+            (aes->mode == CCP_AES_MODE_CBC) ||
+            (aes->mode == CCP_AES_MODE_CFB)) &&
+           (aes->src_len & (AES_BLOCK_SIZE - 1)))
+               return -EINVAL;
+
+       if (!aes->key || !aes->src || !aes->dst)
+               return -EINVAL;
+
+       if (aes->mode != CCP_AES_MODE_ECB) {
+               if (aes->iv_len != AES_BLOCK_SIZE)
+                       return -EINVAL;
+
+               if (!aes->iv)
+                       return -EINVAL;
+       }
+
+       BUILD_BUG_ON(CCP_AES_KEY_KSB_COUNT != 1);
+       BUILD_BUG_ON(CCP_AES_CTX_KSB_COUNT != 1);
+
+       ret = -EIO;
+       memset(&op, 0, sizeof(op));
+       op.cmd_q = cmd_q;
+       op.jobid = ccp_gen_jobid(cmd_q->ccp);
+       op.ksb_key = cmd_q->ksb_key;
+       op.ksb_ctx = cmd_q->ksb_ctx;
+       op.init = (aes->mode == CCP_AES_MODE_ECB) ? 0 : 1;
+       op.u.aes.type = aes->type;
+       op.u.aes.mode = aes->mode;
+       op.u.aes.action = aes->action;
+
+       /* All supported key sizes fit in a single (32-byte) KSB entry
+        * and must be in little endian format. Use the 256-bit byte
+        * swap passthru option to convert from big endian to little
+        * endian.
+        */
+       ret = ccp_init_dm_workarea(&key, cmd_q,
+                                  CCP_AES_KEY_KSB_COUNT * CCP_KSB_BYTES,
+                                  DMA_TO_DEVICE);
+       if (ret)
+               return ret;
+
+       dm_offset = CCP_KSB_BYTES - aes->key_len;
+       ccp_set_dm_area(&key, dm_offset, aes->key, 0, aes->key_len);
+       ret = ccp_copy_to_ksb(cmd_q, &key, op.jobid, op.ksb_key,
+                             CCP_PASSTHRU_BYTESWAP_256BIT);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_key;
+       }
+
+       /* The AES context fits in a single (32-byte) KSB entry and
+        * must be in little endian format. Use the 256-bit byte swap
+        * passthru option to convert from big endian to little endian.
+        */
+       ret = ccp_init_dm_workarea(&ctx, cmd_q,
+                                  CCP_AES_CTX_KSB_COUNT * CCP_KSB_BYTES,
+                                  DMA_BIDIRECTIONAL);
+       if (ret)
+               goto e_key;
+
+       if (aes->mode != CCP_AES_MODE_ECB) {
+               /* Load the AES context - conver to LE */
+               dm_offset = CCP_KSB_BYTES - AES_BLOCK_SIZE;
+               ccp_set_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len);
+               ret = ccp_copy_to_ksb(cmd_q, &ctx, op.jobid, op.ksb_ctx,
+                                     CCP_PASSTHRU_BYTESWAP_256BIT);
+               if (ret) {
+                       cmd->engine_error = cmd_q->cmd_error;
+                       goto e_ctx;
+               }
+       }
+
+       /* Prepare the input and output data workareas. For in-place
+        * operations we need to set the dma direction to BIDIRECTIONAL
+        * and copy the src workarea to the dst workarea.
+        */
+       if (sg_virt(aes->src) == sg_virt(aes->dst))
+               in_place = true;
+
+       ret = ccp_init_data(&src, cmd_q, aes->src, aes->src_len,
+                           AES_BLOCK_SIZE,
+                           in_place ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE);
+       if (ret)
+               goto e_ctx;
+
+       if (in_place)
+               dst = src;
+       else {
+               ret = ccp_init_data(&dst, cmd_q, aes->dst, aes->src_len,
+                                   AES_BLOCK_SIZE, DMA_FROM_DEVICE);
+               if (ret)
+                       goto e_src;
+       }
+
+       /* Send data to the CCP AES engine */
+       while (src.sg_wa.bytes_left) {
+               ccp_prepare_data(&src, &dst, &op, AES_BLOCK_SIZE, true);
+               if (!src.sg_wa.bytes_left) {
+                       op.eom = 1;
+
+                       /* Since we don't retrieve the AES context in ECB
+                        * mode we have to wait for the operation to complete
+                        * on the last piece of data
+                        */
+                       if (aes->mode == CCP_AES_MODE_ECB)
+                               op.soc = 1;
+               }
+
+               ret = ccp_perform_aes(&op);
+               if (ret) {
+                       cmd->engine_error = cmd_q->cmd_error;
+                       goto e_dst;
+               }
+
+               ccp_process_data(&src, &dst, &op);
+       }
+
+       if (aes->mode != CCP_AES_MODE_ECB) {
+               /* Retrieve the AES context - convert from LE to BE using
+                * 32-byte (256-bit) byteswapping
+                */
+               ret = ccp_copy_from_ksb(cmd_q, &ctx, op.jobid, op.ksb_ctx,
+                                       CCP_PASSTHRU_BYTESWAP_256BIT);
+               if (ret) {
+                       cmd->engine_error = cmd_q->cmd_error;
+                       goto e_dst;
+               }
+
+               /* ...but we only need AES_BLOCK_SIZE bytes */
+               dm_offset = CCP_KSB_BYTES - AES_BLOCK_SIZE;
+               ccp_get_dm_area(&ctx, dm_offset, aes->iv, 0, aes->iv_len);
+       }
+
+e_dst:
+       if (!in_place)
+               ccp_free_data(&dst, cmd_q);
+
+e_src:
+       ccp_free_data(&src, cmd_q);
+
+e_ctx:
+       ccp_dm_free(&ctx);
+
+e_key:
+       ccp_dm_free(&key);
+
+       return ret;
+}
+
+static int ccp_run_xts_aes_cmd(struct ccp_cmd_queue *cmd_q,
+                              struct ccp_cmd *cmd)
+{
+       struct ccp_xts_aes_engine *xts = &cmd->u.xts;
+       struct ccp_dm_workarea key, ctx;
+       struct ccp_data src, dst;
+       struct ccp_op op;
+       unsigned int unit_size, dm_offset;
+       bool in_place = false;
+       int ret;
+
+       switch (xts->unit_size) {
+       case CCP_XTS_AES_UNIT_SIZE_16:
+               unit_size = 16;
+               break;
+       case CCP_XTS_AES_UNIT_SIZE_512:
+               unit_size = 512;
+               break;
+       case CCP_XTS_AES_UNIT_SIZE_1024:
+               unit_size = 1024;
+               break;
+       case CCP_XTS_AES_UNIT_SIZE_2048:
+               unit_size = 2048;
+               break;
+       case CCP_XTS_AES_UNIT_SIZE_4096:
+               unit_size = 4096;
+               break;
+
+       default:
+               return -EINVAL;
+       }
+
+       if (xts->key_len != AES_KEYSIZE_128)
+               return -EINVAL;
+
+       if (!xts->final && (xts->src_len & (AES_BLOCK_SIZE - 1)))
+               return -EINVAL;
+
+       if (xts->iv_len != AES_BLOCK_SIZE)
+               return -EINVAL;
+
+       if (!xts->key || !xts->iv || !xts->src || !xts->dst)
+               return -EINVAL;
+
+       BUILD_BUG_ON(CCP_XTS_AES_KEY_KSB_COUNT != 1);
+       BUILD_BUG_ON(CCP_XTS_AES_CTX_KSB_COUNT != 1);
+
+       ret = -EIO;
+       memset(&op, 0, sizeof(op));
+       op.cmd_q = cmd_q;
+       op.jobid = ccp_gen_jobid(cmd_q->ccp);
+       op.ksb_key = cmd_q->ksb_key;
+       op.ksb_ctx = cmd_q->ksb_ctx;
+       op.init = 1;
+       op.u.xts.action = xts->action;
+       op.u.xts.unit_size = xts->unit_size;
+
+       /* All supported key sizes fit in a single (32-byte) KSB entry
+        * and must be in little endian format. Use the 256-bit byte
+        * swap passthru option to convert from big endian to little
+        * endian.
+        */
+       ret = ccp_init_dm_workarea(&key, cmd_q,
+                                  CCP_XTS_AES_KEY_KSB_COUNT * CCP_KSB_BYTES,
+                                  DMA_TO_DEVICE);
+       if (ret)
+               return ret;
+
+       dm_offset = CCP_KSB_BYTES - AES_KEYSIZE_128;
+       ccp_set_dm_area(&key, dm_offset, xts->key, 0, xts->key_len);
+       ccp_set_dm_area(&key, 0, xts->key, dm_offset, xts->key_len);
+       ret = ccp_copy_to_ksb(cmd_q, &key, op.jobid, op.ksb_key,
+                             CCP_PASSTHRU_BYTESWAP_256BIT);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_key;
+       }
+
+       /* The AES context fits in a single (32-byte) KSB entry and
+        * for XTS is already in little endian format so no byte swapping
+        * is needed.
+        */
+       ret = ccp_init_dm_workarea(&ctx, cmd_q,
+                                  CCP_XTS_AES_CTX_KSB_COUNT * CCP_KSB_BYTES,
+                                  DMA_BIDIRECTIONAL);
+       if (ret)
+               goto e_key;
+
+       ccp_set_dm_area(&ctx, 0, xts->iv, 0, xts->iv_len);
+       ret = ccp_copy_to_ksb(cmd_q, &ctx, op.jobid, op.ksb_ctx,
+                             CCP_PASSTHRU_BYTESWAP_NOOP);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_ctx;
+       }
+
+       /* Prepare the input and output data workareas. For in-place
+        * operations we need to set the dma direction to BIDIRECTIONAL
+        * and copy the src workarea to the dst workarea.
+        */
+       if (sg_virt(xts->src) == sg_virt(xts->dst))
+               in_place = true;
+
+       ret = ccp_init_data(&src, cmd_q, xts->src, xts->src_len,
+                           unit_size,
+                           in_place ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE);
+       if (ret)
+               goto e_ctx;
+
+       if (in_place)
+               dst = src;
+       else {
+               ret = ccp_init_data(&dst, cmd_q, xts->dst, xts->src_len,
+                                   unit_size, DMA_FROM_DEVICE);
+               if (ret)
+                       goto e_src;
+       }
+
+       /* Send data to the CCP AES engine */
+       while (src.sg_wa.bytes_left) {
+               ccp_prepare_data(&src, &dst, &op, unit_size, true);
+               if (!src.sg_wa.bytes_left)
+                       op.eom = 1;
+
+               ret = ccp_perform_xts_aes(&op);
+               if (ret) {
+                       cmd->engine_error = cmd_q->cmd_error;
+                       goto e_dst;
+               }
+
+               ccp_process_data(&src, &dst, &op);
+       }
+
+       /* Retrieve the AES context - convert from LE to BE using
+        * 32-byte (256-bit) byteswapping
+        */
+       ret = ccp_copy_from_ksb(cmd_q, &ctx, op.jobid, op.ksb_ctx,
+                               CCP_PASSTHRU_BYTESWAP_256BIT);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_dst;
+       }
+
+       /* ...but we only need AES_BLOCK_SIZE bytes */
+       dm_offset = CCP_KSB_BYTES - AES_BLOCK_SIZE;
+       ccp_get_dm_area(&ctx, dm_offset, xts->iv, 0, xts->iv_len);
+
+e_dst:
+       if (!in_place)
+               ccp_free_data(&dst, cmd_q);
+
+e_src:
+       ccp_free_data(&src, cmd_q);
+
+e_ctx:
+       ccp_dm_free(&ctx);
+
+e_key:
+       ccp_dm_free(&key);
+
+       return ret;
+}
+
+static int ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
+{
+       struct ccp_sha_engine *sha = &cmd->u.sha;
+       struct ccp_dm_workarea ctx;
+       struct ccp_data src;
+       struct ccp_op op;
+       int ret;
+
+       if (sha->ctx_len != CCP_SHA_CTXSIZE)
+               return -EINVAL;
+
+       if (!sha->ctx)
+               return -EINVAL;
+
+       if (!sha->final && (sha->src_len & (CCP_SHA_BLOCKSIZE - 1)))
+               return -EINVAL;
+
+       if (!sha->src_len) {
+               const u8 *sha_zero;
+
+               /* Not final, just return */
+               if (!sha->final)
+                       return 0;
+
+               /* CCP can't do a zero length sha operation so the caller
+                * must buffer the data.
+                */
+               if (sha->msg_bits)
+                       return -EINVAL;
+
+               /* A sha operation for a message with a total length of zero,
+                * return known result.
+                */
+               switch (sha->type) {
+               case CCP_SHA_TYPE_1:
+                       sha_zero = ccp_sha1_zero;
+                       break;
+               case CCP_SHA_TYPE_224:
+                       sha_zero = ccp_sha224_zero;
+                       break;
+               case CCP_SHA_TYPE_256:
+                       sha_zero = ccp_sha256_zero;
+                       break;
+               default:
+                       return -EINVAL;
+               }
+
+               scatterwalk_map_and_copy((void *)sha_zero, sha->ctx, 0,
+                                        sha->ctx_len, 1);
+
+               return 0;
+       }
+
+       if (!sha->src)
+               return -EINVAL;
+
+       BUILD_BUG_ON(CCP_SHA_KSB_COUNT != 1);
+
+       memset(&op, 0, sizeof(op));
+       op.cmd_q = cmd_q;
+       op.jobid = ccp_gen_jobid(cmd_q->ccp);
+       op.ksb_ctx = cmd_q->ksb_ctx;
+       op.u.sha.type = sha->type;
+       op.u.sha.msg_bits = sha->msg_bits;
+
+       /* The SHA context fits in a single (32-byte) KSB entry and
+        * must be in little endian format. Use the 256-bit byte swap
+        * passthru option to convert from big endian to little endian.
+        */
+       ret = ccp_init_dm_workarea(&ctx, cmd_q,
+                                  CCP_SHA_KSB_COUNT * CCP_KSB_BYTES,
+                                  DMA_BIDIRECTIONAL);
+       if (ret)
+               return ret;
+
+       ccp_set_dm_area(&ctx, 0, sha->ctx, 0, sha->ctx_len);
+       ret = ccp_copy_to_ksb(cmd_q, &ctx, op.jobid, op.ksb_ctx,
+                             CCP_PASSTHRU_BYTESWAP_256BIT);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_ctx;
+       }
+
+       /* Send data to the CCP SHA engine */
+       ret = ccp_init_data(&src, cmd_q, sha->src, sha->src_len,
+                           CCP_SHA_BLOCKSIZE, DMA_TO_DEVICE);
+       if (ret)
+               goto e_ctx;
+
+       while (src.sg_wa.bytes_left) {
+               ccp_prepare_data(&src, NULL, &op, CCP_SHA_BLOCKSIZE, false);
+               if (sha->final && !src.sg_wa.bytes_left)
+                       op.eom = 1;
+
+               ret = ccp_perform_sha(&op);
+               if (ret) {
+                       cmd->engine_error = cmd_q->cmd_error;
+                       goto e_data;
+               }
+
+               ccp_process_data(&src, NULL, &op);
+       }
+
+       /* Retrieve the SHA context - convert from LE to BE using
+        * 32-byte (256-bit) byteswapping to BE
+        */
+       ret = ccp_copy_from_ksb(cmd_q, &ctx, op.jobid, op.ksb_ctx,
+                               CCP_PASSTHRU_BYTESWAP_256BIT);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_data;
+       }
+
+       ccp_get_dm_area(&ctx, 0, sha->ctx, 0, sha->ctx_len);
+
+e_data:
+       ccp_free_data(&src, cmd_q);
+
+e_ctx:
+       ccp_dm_free(&ctx);
+
+       return ret;
+}
+
+static int ccp_run_rsa_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
+{
+       struct ccp_rsa_engine *rsa = &cmd->u.rsa;
+       struct ccp_dm_workarea exp, src;
+       struct ccp_data dst;
+       struct ccp_op op;
+       unsigned int ksb_count, i_len, o_len;
+       int ret;
+
+       if (rsa->key_size > CCP_RSA_MAX_WIDTH)
+               return -EINVAL;
+
+       if (!rsa->exp || !rsa->mod || !rsa->src || !rsa->dst)
+               return -EINVAL;
+
+       /* The RSA modulus must precede the message being acted upon, so
+        * it must be copied to a DMA area where the message and the
+        * modulus can be concatenated.  Therefore the input buffer
+        * length required is twice the output buffer length (which
+        * must be a multiple of 256-bits).
+        */
+       o_len = ((rsa->key_size + 255) / 256) * 32;
+       i_len = o_len * 2;
+
+       ksb_count = o_len / CCP_KSB_BYTES;
+
+       memset(&op, 0, sizeof(op));
+       op.cmd_q = cmd_q;
+       op.jobid = ccp_gen_jobid(cmd_q->ccp);
+       op.ksb_key = ccp_alloc_ksb(cmd_q->ccp, ksb_count);
+       if (!op.ksb_key)
+               return -EIO;
+
+       /* The RSA exponent may span multiple (32-byte) KSB entries and must
+        * be in little endian format. Reverse copy each 32-byte chunk
+        * of the exponent (En chunk to E0 chunk, E(n-1) chunk to E1 chunk)
+        * and each byte within that chunk and do not perform any byte swap
+        * operations on the passthru operation.
+        */
+       ret = ccp_init_dm_workarea(&exp, cmd_q, o_len, DMA_TO_DEVICE);
+       if (ret)
+               goto e_ksb;
+
+       ccp_reverse_set_dm_area(&exp, rsa->exp, rsa->exp_len, CCP_KSB_BYTES,
+                               true);
+       ret = ccp_copy_to_ksb(cmd_q, &exp, op.jobid, op.ksb_key,
+                             CCP_PASSTHRU_BYTESWAP_NOOP);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_exp;
+       }
+
+       /* Concatenate the modulus and the message. Both the modulus and
+        * the operands must be in little endian format.  Since the input
+        * is in big endian format it must be converted.
+        */
+       ret = ccp_init_dm_workarea(&src, cmd_q, i_len, DMA_TO_DEVICE);
+       if (ret)
+               goto e_exp;
+
+       ccp_reverse_set_dm_area(&src, rsa->mod, rsa->mod_len, CCP_KSB_BYTES,
+                               true);
+       src.address += o_len;   /* Adjust the address for the copy operation */
+       ccp_reverse_set_dm_area(&src, rsa->src, rsa->src_len, CCP_KSB_BYTES,
+                               true);
+       src.address -= o_len;   /* Reset the address to original value */
+
+       /* Prepare the output area for the operation */
+       ret = ccp_init_data(&dst, cmd_q, rsa->dst, rsa->mod_len,
+                           o_len, DMA_FROM_DEVICE);
+       if (ret)
+               goto e_src;
+
+       op.soc = 1;
+       op.src.u.dma.address = src.dma.address;
+       op.src.u.dma.offset = 0;
+       op.src.u.dma.length = i_len;
+       op.dst.u.dma.address = dst.dm_wa.dma.address;
+       op.dst.u.dma.offset = 0;
+       op.dst.u.dma.length = o_len;
+
+       op.u.rsa.mod_size = rsa->key_size;
+       op.u.rsa.input_len = i_len;
+
+       ret = ccp_perform_rsa(&op);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_dst;
+       }
+
+       ccp_reverse_get_dm_area(&dst.dm_wa, rsa->dst, rsa->mod_len);
+
+e_dst:
+       ccp_free_data(&dst, cmd_q);
+
+e_src:
+       ccp_dm_free(&src);
+
+e_exp:
+       ccp_dm_free(&exp);
+
+e_ksb:
+       ccp_free_ksb(cmd_q->ccp, op.ksb_key, ksb_count);
+
+       return ret;
+}
+
+static int ccp_run_passthru_cmd(struct ccp_cmd_queue *cmd_q,
+                               struct ccp_cmd *cmd)
+{
+       struct ccp_passthru_engine *pt = &cmd->u.passthru;
+       struct ccp_dm_workarea mask;
+       struct ccp_data src, dst;
+       struct ccp_op op;
+       bool in_place = false;
+       unsigned int i;
+       int ret;
+
+       if (!pt->final && (pt->src_len & (CCP_PASSTHRU_BLOCKSIZE - 1)))
+               return -EINVAL;
+
+       if (!pt->src || !pt->dst)
+               return -EINVAL;
+
+       if (pt->bit_mod != CCP_PASSTHRU_BITWISE_NOOP) {
+               if (pt->mask_len != CCP_PASSTHRU_MASKSIZE)
+                       return -EINVAL;
+               if (!pt->mask)
+                       return -EINVAL;
+       }
+
+       BUILD_BUG_ON(CCP_PASSTHRU_KSB_COUNT != 1);
+
+       memset(&op, 0, sizeof(op));
+       op.cmd_q = cmd_q;
+       op.jobid = ccp_gen_jobid(cmd_q->ccp);
+
+       if (pt->bit_mod != CCP_PASSTHRU_BITWISE_NOOP) {
+               /* Load the mask */
+               op.ksb_key = cmd_q->ksb_key;
+
+               ret = ccp_init_dm_workarea(&mask, cmd_q,
+                                          CCP_PASSTHRU_KSB_COUNT *
+                                          CCP_KSB_BYTES,
+                                          DMA_TO_DEVICE);
+               if (ret)
+                       return ret;
+
+               ccp_set_dm_area(&mask, 0, pt->mask, 0, pt->mask_len);
+               ret = ccp_copy_to_ksb(cmd_q, &mask, op.jobid, op.ksb_key,
+                                     CCP_PASSTHRU_BYTESWAP_NOOP);
+               if (ret) {
+                       cmd->engine_error = cmd_q->cmd_error;
+                       goto e_mask;
+               }
+       }
+
+       /* Prepare the input and output data workareas. For in-place
+        * operations we need to set the dma direction to BIDIRECTIONAL
+        * and copy the src workarea to the dst workarea.
+        */
+       if (sg_virt(pt->src) == sg_virt(pt->dst))
+               in_place = true;
+
+       ret = ccp_init_data(&src, cmd_q, pt->src, pt->src_len,
+                           CCP_PASSTHRU_MASKSIZE,
+                           in_place ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE);
+       if (ret)
+               goto e_mask;
+
+       if (in_place)
+               dst = src;
+       else {
+               ret = ccp_init_data(&dst, cmd_q, pt->dst, pt->src_len,
+                                   CCP_PASSTHRU_MASKSIZE, DMA_FROM_DEVICE);
+               if (ret)
+                       goto e_src;
+       }
+
+       /* Send data to the CCP Passthru engine
+        *   Because the CCP engine works on a single source and destination
+        *   dma address at a time, each entry in the source scatterlist
+        *   (after the dma_map_sg call) must be less than or equal to the
+        *   (remaining) length in the destination scatterlist entry and the
+        *   length must be a multiple of CCP_PASSTHRU_BLOCKSIZE
+        */
+       dst.sg_wa.sg_used = 0;
+       for (i = 1; i <= src.sg_wa.dma_count; i++) {
+               if (!dst.sg_wa.sg ||
+                   (dst.sg_wa.sg->length < src.sg_wa.sg->length)) {
+                       ret = -EINVAL;
+                       goto e_dst;
+               }
+
+               if (i == src.sg_wa.dma_count) {
+                       op.eom = 1;
+                       op.soc = 1;
+               }
+
+               op.src.type = CCP_MEMTYPE_SYSTEM;
+               op.src.u.dma.address = sg_dma_address(src.sg_wa.sg);
+               op.src.u.dma.offset = 0;
+               op.src.u.dma.length = sg_dma_len(src.sg_wa.sg);
+
+               op.dst.type = CCP_MEMTYPE_SYSTEM;
+               op.dst.u.dma.address = sg_dma_address(dst.sg_wa.sg);
+               op.src.u.dma.offset = dst.sg_wa.sg_used;
+               op.src.u.dma.length = op.src.u.dma.length;
+
+               ret = ccp_perform_passthru(&op);
+               if (ret) {
+                       cmd->engine_error = cmd_q->cmd_error;
+                       goto e_dst;
+               }
+
+               dst.sg_wa.sg_used += src.sg_wa.sg->length;
+               if (dst.sg_wa.sg_used == dst.sg_wa.sg->length) {
+                       dst.sg_wa.sg = sg_next(dst.sg_wa.sg);
+                       dst.sg_wa.sg_used = 0;
+               }
+               src.sg_wa.sg = sg_next(src.sg_wa.sg);
+       }
+
+e_dst:
+       if (!in_place)
+               ccp_free_data(&dst, cmd_q);
+
+e_src:
+       ccp_free_data(&src, cmd_q);
+
+e_mask:
+       if (pt->bit_mod != CCP_PASSTHRU_BITWISE_NOOP)
+               ccp_dm_free(&mask);
+
+       return ret;
+}
+
+static int ccp_run_ecc_mm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
+{
+       struct ccp_ecc_engine *ecc = &cmd->u.ecc;
+       struct ccp_dm_workarea src, dst;
+       struct ccp_op op;
+       int ret;
+       u8 *save;
+
+       if (!ecc->u.mm.operand_1 ||
+           (ecc->u.mm.operand_1_len > CCP_ECC_MODULUS_BYTES))
+               return -EINVAL;
+
+       if (ecc->function != CCP_ECC_FUNCTION_MINV_384BIT)
+               if (!ecc->u.mm.operand_2 ||
+                   (ecc->u.mm.operand_2_len > CCP_ECC_MODULUS_BYTES))
+                       return -EINVAL;
+
+       if (!ecc->u.mm.result ||
+           (ecc->u.mm.result_len < CCP_ECC_MODULUS_BYTES))
+               return -EINVAL;
+
+       memset(&op, 0, sizeof(op));
+       op.cmd_q = cmd_q;
+       op.jobid = ccp_gen_jobid(cmd_q->ccp);
+
+       /* Concatenate the modulus and the operands. Both the modulus and
+        * the operands must be in little endian format.  Since the input
+        * is in big endian format it must be converted and placed in a
+        * fixed length buffer.
+        */
+       ret = ccp_init_dm_workarea(&src, cmd_q, CCP_ECC_SRC_BUF_SIZE,
+                                  DMA_TO_DEVICE);
+       if (ret)
+               return ret;
+
+       /* Save the workarea address since it is updated in order to perform
+        * the concatenation
+        */
+       save = src.address;
+
+       /* Copy the ECC modulus */
+       ccp_reverse_set_dm_area(&src, ecc->mod, ecc->mod_len,
+                               CCP_ECC_OPERAND_SIZE, true);
+       src.address += CCP_ECC_OPERAND_SIZE;
+
+       /* Copy the first operand */
+       ccp_reverse_set_dm_area(&src, ecc->u.mm.operand_1,
+                               ecc->u.mm.operand_1_len,
+                               CCP_ECC_OPERAND_SIZE, true);
+       src.address += CCP_ECC_OPERAND_SIZE;
+
+       if (ecc->function != CCP_ECC_FUNCTION_MINV_384BIT) {
+               /* Copy the second operand */
+               ccp_reverse_set_dm_area(&src, ecc->u.mm.operand_2,
+                                       ecc->u.mm.operand_2_len,
+                                       CCP_ECC_OPERAND_SIZE, true);
+               src.address += CCP_ECC_OPERAND_SIZE;
+       }
+
+       /* Restore the workarea address */
+       src.address = save;
+
+       /* Prepare the output area for the operation */
+       ret = ccp_init_dm_workarea(&dst, cmd_q, CCP_ECC_DST_BUF_SIZE,
+                                  DMA_FROM_DEVICE);
+       if (ret)
+               goto e_src;
+
+       op.soc = 1;
+       op.src.u.dma.address = src.dma.address;
+       op.src.u.dma.offset = 0;
+       op.src.u.dma.length = src.length;
+       op.dst.u.dma.address = dst.dma.address;
+       op.dst.u.dma.offset = 0;
+       op.dst.u.dma.length = dst.length;
+
+       op.u.ecc.function = cmd->u.ecc.function;
+
+       ret = ccp_perform_ecc(&op);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_dst;
+       }
+
+       ecc->ecc_result = le16_to_cpup(
+               (const __le16 *)(dst.address + CCP_ECC_RESULT_OFFSET));
+       if (!(ecc->ecc_result & CCP_ECC_RESULT_SUCCESS)) {
+               ret = -EIO;
+               goto e_dst;
+       }
+
+       /* Save the ECC result */
+       ccp_reverse_get_dm_area(&dst, ecc->u.mm.result, CCP_ECC_MODULUS_BYTES);
+
+e_dst:
+       ccp_dm_free(&dst);
+
+e_src:
+       ccp_dm_free(&src);
+
+       return ret;
+}
+
+static int ccp_run_ecc_pm_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
+{
+       struct ccp_ecc_engine *ecc = &cmd->u.ecc;
+       struct ccp_dm_workarea src, dst;
+       struct ccp_op op;
+       int ret;
+       u8 *save;
+
+       if (!ecc->u.pm.point_1.x ||
+           (ecc->u.pm.point_1.x_len > CCP_ECC_MODULUS_BYTES) ||
+           !ecc->u.pm.point_1.y ||
+           (ecc->u.pm.point_1.y_len > CCP_ECC_MODULUS_BYTES))
+               return -EINVAL;
+
+       if (ecc->function == CCP_ECC_FUNCTION_PADD_384BIT) {
+               if (!ecc->u.pm.point_2.x ||
+                   (ecc->u.pm.point_2.x_len > CCP_ECC_MODULUS_BYTES) ||
+                   !ecc->u.pm.point_2.y ||
+                   (ecc->u.pm.point_2.y_len > CCP_ECC_MODULUS_BYTES))
+                       return -EINVAL;
+       } else {
+               if (!ecc->u.pm.domain_a ||
+                   (ecc->u.pm.domain_a_len > CCP_ECC_MODULUS_BYTES))
+                       return -EINVAL;
+
+               if (ecc->function == CCP_ECC_FUNCTION_PMUL_384BIT)
+                       if (!ecc->u.pm.scalar ||
+                           (ecc->u.pm.scalar_len > CCP_ECC_MODULUS_BYTES))
+                               return -EINVAL;
+       }
+
+       if (!ecc->u.pm.result.x ||
+           (ecc->u.pm.result.x_len < CCP_ECC_MODULUS_BYTES) ||
+           !ecc->u.pm.result.y ||
+           (ecc->u.pm.result.y_len < CCP_ECC_MODULUS_BYTES))
+               return -EINVAL;
+
+       memset(&op, 0, sizeof(op));
+       op.cmd_q = cmd_q;
+       op.jobid = ccp_gen_jobid(cmd_q->ccp);
+
+       /* Concatenate the modulus and the operands. Both the modulus and
+        * the operands must be in little endian format.  Since the input
+        * is in big endian format it must be converted and placed in a
+        * fixed length buffer.
+        */
+       ret = ccp_init_dm_workarea(&src, cmd_q, CCP_ECC_SRC_BUF_SIZE,
+                                  DMA_TO_DEVICE);
+       if (ret)
+               return ret;
+
+       /* Save the workarea address since it is updated in order to perform
+        * the concatenation
+        */
+       save = src.address;
+
+       /* Copy the ECC modulus */
+       ccp_reverse_set_dm_area(&src, ecc->mod, ecc->mod_len,
+                               CCP_ECC_OPERAND_SIZE, true);
+       src.address += CCP_ECC_OPERAND_SIZE;
+
+       /* Copy the first point X and Y coordinate */
+       ccp_reverse_set_dm_area(&src, ecc->u.pm.point_1.x,
+                               ecc->u.pm.point_1.x_len,
+                               CCP_ECC_OPERAND_SIZE, true);
+       src.address += CCP_ECC_OPERAND_SIZE;
+       ccp_reverse_set_dm_area(&src, ecc->u.pm.point_1.y,
+                               ecc->u.pm.point_1.y_len,
+                               CCP_ECC_OPERAND_SIZE, true);
+       src.address += CCP_ECC_OPERAND_SIZE;
+
+       /* Set the first point Z coordianate to 1 */
+       *(src.address) = 0x01;
+       src.address += CCP_ECC_OPERAND_SIZE;
+
+       if (ecc->function == CCP_ECC_FUNCTION_PADD_384BIT) {
+               /* Copy the second point X and Y coordinate */
+               ccp_reverse_set_dm_area(&src, ecc->u.pm.point_2.x,
+                                       ecc->u.pm.point_2.x_len,
+                                       CCP_ECC_OPERAND_SIZE, true);
+               src.address += CCP_ECC_OPERAND_SIZE;
+               ccp_reverse_set_dm_area(&src, ecc->u.pm.point_2.y,
+                                       ecc->u.pm.point_2.y_len,
+                                       CCP_ECC_OPERAND_SIZE, true);
+               src.address += CCP_ECC_OPERAND_SIZE;
+
+               /* Set the second point Z coordianate to 1 */
+               *(src.address) = 0x01;
+               src.address += CCP_ECC_OPERAND_SIZE;
+       } else {
+               /* Copy the Domain "a" parameter */
+               ccp_reverse_set_dm_area(&src, ecc->u.pm.domain_a,
+                                       ecc->u.pm.domain_a_len,
+                                       CCP_ECC_OPERAND_SIZE, true);
+               src.address += CCP_ECC_OPERAND_SIZE;
+
+               if (ecc->function == CCP_ECC_FUNCTION_PMUL_384BIT) {
+                       /* Copy the scalar value */
+                       ccp_reverse_set_dm_area(&src, ecc->u.pm.scalar,
+                                               ecc->u.pm.scalar_len,
+                                               CCP_ECC_OPERAND_SIZE, true);
+                       src.address += CCP_ECC_OPERAND_SIZE;
+               }
+       }
+
+       /* Restore the workarea address */
+       src.address = save;
+
+       /* Prepare the output area for the operation */
+       ret = ccp_init_dm_workarea(&dst, cmd_q, CCP_ECC_DST_BUF_SIZE,
+                                  DMA_FROM_DEVICE);
+       if (ret)
+               goto e_src;
+
+       op.soc = 1;
+       op.src.u.dma.address = src.dma.address;
+       op.src.u.dma.offset = 0;
+       op.src.u.dma.length = src.length;
+       op.dst.u.dma.address = dst.dma.address;
+       op.dst.u.dma.offset = 0;
+       op.dst.u.dma.length = dst.length;
+
+       op.u.ecc.function = cmd->u.ecc.function;
+
+       ret = ccp_perform_ecc(&op);
+       if (ret) {
+               cmd->engine_error = cmd_q->cmd_error;
+               goto e_dst;
+       }
+
+       ecc->ecc_result = le16_to_cpup(
+               (const __le16 *)(dst.address + CCP_ECC_RESULT_OFFSET));
+       if (!(ecc->ecc_result & CCP_ECC_RESULT_SUCCESS)) {
+               ret = -EIO;
+               goto e_dst;
+       }
+
+       /* Save the workarea address since it is updated as we walk through
+        * to copy the point math result
+        */
+       save = dst.address;
+
+       /* Save the ECC result X and Y coordinates */
+       ccp_reverse_get_dm_area(&dst, ecc->u.pm.result.x,
+                               CCP_ECC_MODULUS_BYTES);
+       dst.address += CCP_ECC_OUTPUT_SIZE;
+       ccp_reverse_get_dm_area(&dst, ecc->u.pm.result.y,
+                               CCP_ECC_MODULUS_BYTES);
+       dst.address += CCP_ECC_OUTPUT_SIZE;
+
+       /* Restore the workarea address */
+       dst.address = save;
+
+e_dst:
+       ccp_dm_free(&dst);
+
+e_src:
+       ccp_dm_free(&src);
+
+       return ret;
+}
+
+static int ccp_run_ecc_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
+{
+       struct ccp_ecc_engine *ecc = &cmd->u.ecc;
+
+       ecc->ecc_result = 0;
+
+       if (!ecc->mod ||
+           (ecc->mod_len > CCP_ECC_MODULUS_BYTES))
+               return -EINVAL;
+
+       switch (ecc->function) {
+       case CCP_ECC_FUNCTION_MMUL_384BIT:
+       case CCP_ECC_FUNCTION_MADD_384BIT:
+       case CCP_ECC_FUNCTION_MINV_384BIT:
+               return ccp_run_ecc_mm_cmd(cmd_q, cmd);
+
+       case CCP_ECC_FUNCTION_PADD_384BIT:
+       case CCP_ECC_FUNCTION_PMUL_384BIT:
+       case CCP_ECC_FUNCTION_PDBL_384BIT:
+               return ccp_run_ecc_pm_cmd(cmd_q, cmd);
+
+       default:
+               return -EINVAL;
+       }
+}
+
+int ccp_run_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
+{
+       int ret;
+
+       cmd->engine_error = 0;
+       cmd_q->cmd_error = 0;
+       cmd_q->int_rcvd = 0;
+       cmd_q->free_slots = CMD_Q_DEPTH(ioread32(cmd_q->reg_status));
+
+       switch (cmd->engine) {
+       case CCP_ENGINE_AES:
+               ret = ccp_run_aes_cmd(cmd_q, cmd);
+               break;
+       case CCP_ENGINE_XTS_AES_128:
+               ret = ccp_run_xts_aes_cmd(cmd_q, cmd);
+               break;
+       case CCP_ENGINE_SHA:
+               ret = ccp_run_sha_cmd(cmd_q, cmd);
+               break;
+       case CCP_ENGINE_RSA:
+               ret = ccp_run_rsa_cmd(cmd_q, cmd);
+               break;
+       case CCP_ENGINE_PASSTHRU:
+               ret = ccp_run_passthru_cmd(cmd_q, cmd);
+               break;
+       case CCP_ENGINE_ECC:
+               ret = ccp_run_ecc_cmd(cmd_q, cmd);
+               break;
+       default:
+               ret = -EINVAL;
+       }
+
+       return ret;
+}
diff --git a/drivers/crypto/ccp/ccp-pci.c b/drivers/crypto/ccp/ccp-pci.c
new file mode 100644 (file)
index 0000000..93319f9
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ * AMD Cryptographic Coprocessor (CCP) driver
+ *
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Tom Lendacky <thomas.lendacky@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <linux/kthread.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/spinlock.h>
+#include <linux/delay.h>
+#include <linux/ccp.h>
+
+#include "ccp-dev.h"
+
+#define IO_BAR                         2
+#define MSIX_VECTORS                   2
+
+struct ccp_msix {
+       u32 vector;
+       char name[16];
+};
+
+struct ccp_pci {
+       int msix_count;
+       struct ccp_msix msix[MSIX_VECTORS];
+};
+
+static int ccp_get_msix_irqs(struct ccp_device *ccp)
+{
+       struct ccp_pci *ccp_pci = ccp->dev_specific;
+       struct device *dev = ccp->dev;
+       struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+       struct msix_entry msix_entry[MSIX_VECTORS];
+       unsigned int name_len = sizeof(ccp_pci->msix[0].name) - 1;
+       int v, ret;
+
+       for (v = 0; v < ARRAY_SIZE(msix_entry); v++)
+               msix_entry[v].entry = v;
+
+       while ((ret = pci_enable_msix(pdev, msix_entry, v)) > 0)
+               v = ret;
+       if (ret)
+               return ret;
+
+       ccp_pci->msix_count = v;
+       for (v = 0; v < ccp_pci->msix_count; v++) {
+               /* Set the interrupt names and request the irqs */
+               snprintf(ccp_pci->msix[v].name, name_len, "ccp-%u", v);
+               ccp_pci->msix[v].vector = msix_entry[v].vector;
+               ret = request_irq(ccp_pci->msix[v].vector, ccp_irq_handler,
+                                 0, ccp_pci->msix[v].name, dev);
+               if (ret) {
+                       dev_notice(dev, "unable to allocate MSI-X IRQ (%d)\n",
+                                  ret);
+                       goto e_irq;
+               }
+       }
+
+       return 0;
+
+e_irq:
+       while (v--)
+               free_irq(ccp_pci->msix[v].vector, dev);
+
+       pci_disable_msix(pdev);
+
+       ccp_pci->msix_count = 0;
+
+       return ret;
+}
+
+static int ccp_get_msi_irq(struct ccp_device *ccp)
+{
+       struct device *dev = ccp->dev;
+       struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+       int ret;
+
+       ret = pci_enable_msi(pdev);
+       if (ret)
+               return ret;
+
+       ret = request_irq(pdev->irq, ccp_irq_handler, 0, "ccp", dev);
+       if (ret) {
+               dev_notice(dev, "unable to allocate MSI IRQ (%d)\n", ret);
+               goto e_msi;
+       }
+
+       return 0;
+
+e_msi:
+       pci_disable_msi(pdev);
+
+       return ret;
+}
+
+static int ccp_get_irqs(struct ccp_device *ccp)
+{
+       struct device *dev = ccp->dev;
+       int ret;
+
+       ret = ccp_get_msix_irqs(ccp);
+       if (!ret)
+               return 0;
+
+       /* Couldn't get MSI-X vectors, try MSI */
+       dev_notice(dev, "could not enable MSI-X (%d), trying MSI\n", ret);
+       ret = ccp_get_msi_irq(ccp);
+       if (!ret)
+               return 0;
+
+       /* Couldn't get MSI interrupt */
+       dev_notice(dev, "could not enable MSI (%d)\n", ret);
+
+       return ret;
+}
+
+static void ccp_free_irqs(struct ccp_device *ccp)
+{
+       struct ccp_pci *ccp_pci = ccp->dev_specific;
+       struct device *dev = ccp->dev;
+       struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+
+       if (ccp_pci->msix_count) {
+               while (ccp_pci->msix_count--)
+                       free_irq(ccp_pci->msix[ccp_pci->msix_count].vector,
+                                dev);
+               pci_disable_msix(pdev);
+       } else {
+               free_irq(pdev->irq, dev);
+               pci_disable_msi(pdev);
+       }
+}
+
+static int ccp_find_mmio_area(struct ccp_device *ccp)
+{
+       struct device *dev = ccp->dev;
+       struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+       resource_size_t io_len;
+       unsigned long io_flags;
+       int bar;
+
+       io_flags = pci_resource_flags(pdev, IO_BAR);
+       io_len = pci_resource_len(pdev, IO_BAR);
+       if ((io_flags & IORESOURCE_MEM) && (io_len >= (IO_OFFSET + 0x800)))
+               return IO_BAR;
+
+       for (bar = 0; bar < PCI_STD_RESOURCE_END; bar++) {
+               io_flags = pci_resource_flags(pdev, bar);
+               io_len = pci_resource_len(pdev, bar);
+               if ((io_flags & IORESOURCE_MEM) &&
+                   (io_len >= (IO_OFFSET + 0x800)))
+                       return bar;
+       }
+
+       return -EIO;
+}
+
+static int ccp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+       struct ccp_device *ccp;
+       struct ccp_pci *ccp_pci;
+       struct device *dev = &pdev->dev;
+       unsigned int bar;
+       int ret;
+
+       ret = -ENOMEM;
+       ccp = ccp_alloc_struct(dev);
+       if (!ccp)
+               goto e_err;
+
+       ccp_pci = kzalloc(sizeof(*ccp_pci), GFP_KERNEL);
+       if (!ccp_pci) {
+               ret = -ENOMEM;
+               goto e_free1;
+       }
+       ccp->dev_specific = ccp_pci;
+       ccp->get_irq = ccp_get_irqs;
+       ccp->free_irq = ccp_free_irqs;
+
+       ret = pci_request_regions(pdev, "ccp");
+       if (ret) {
+               dev_err(dev, "pci_request_regions failed (%d)\n", ret);
+               goto e_free2;
+       }
+
+       ret = pci_enable_device(pdev);
+       if (ret) {
+               dev_err(dev, "pci_enable_device failed (%d)\n", ret);
+               goto e_regions;
+       }
+
+       pci_set_master(pdev);
+
+       ret = ccp_find_mmio_area(ccp);
+       if (ret < 0)
+               goto e_device;
+       bar = ret;
+
+       ret = -EIO;
+       ccp->io_map = pci_iomap(pdev, bar, 0);
+       if (ccp->io_map == NULL) {
+               dev_err(dev, "pci_iomap failed\n");
+               goto e_device;
+       }
+       ccp->io_regs = ccp->io_map + IO_OFFSET;
+
+       ret = dma_set_mask(dev, DMA_BIT_MASK(48));
+       if (ret == 0) {
+               ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(48));
+               if (ret) {
+                       dev_err(dev,
+                               "pci_set_consistent_dma_mask failed (%d)\n",
+                               ret);
+                       goto e_bar0;
+               }
+       } else {
+               ret = dma_set_mask(dev, DMA_BIT_MASK(32));
+               if (ret) {
+                       dev_err(dev, "pci_set_dma_mask failed (%d)\n", ret);
+                       goto e_bar0;
+               }
+       }
+
+       dev_set_drvdata(dev, ccp);
+
+       ret = ccp_init(ccp);
+       if (ret)
+               goto e_bar0;
+
+       dev_notice(dev, "enabled\n");
+
+       return 0;
+
+e_bar0:
+       pci_iounmap(pdev, ccp->io_map);
+
+e_device:
+       pci_disable_device(pdev);
+
+e_regions:
+       pci_release_regions(pdev);
+
+e_free2:
+       kfree(ccp_pci);
+
+e_free1:
+       kfree(ccp);
+
+e_err:
+       dev_notice(dev, "initialization failed\n");
+       return ret;
+}
+
+static void ccp_pci_remove(struct pci_dev *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct ccp_device *ccp = dev_get_drvdata(dev);
+
+       if (!ccp)
+               return;
+
+       ccp_destroy(ccp);
+
+       pci_iounmap(pdev, ccp->io_map);
+
+       pci_disable_device(pdev);
+
+       pci_release_regions(pdev);
+
+       kfree(ccp);
+
+       dev_notice(dev, "disabled\n");
+}
+
+#ifdef CONFIG_PM
+static int ccp_pci_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+       struct device *dev = &pdev->dev;
+       struct ccp_device *ccp = dev_get_drvdata(dev);
+       unsigned long flags;
+       unsigned int i;
+
+       spin_lock_irqsave(&ccp->cmd_lock, flags);
+
+       ccp->suspending = 1;
+
+       /* Wake all the queue kthreads to prepare for suspend */
+       for (i = 0; i < ccp->cmd_q_count; i++)
+               wake_up_process(ccp->cmd_q[i].kthread);
+
+       spin_unlock_irqrestore(&ccp->cmd_lock, flags);
+
+       /* Wait for all queue kthreads to say they're done */
+       while (!ccp_queues_suspended(ccp))
+               wait_event_interruptible(ccp->suspend_queue,
+                                        ccp_queues_suspended(ccp));
+
+       return 0;
+}
+
+static int ccp_pci_resume(struct pci_dev *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct ccp_device *ccp = dev_get_drvdata(dev);
+       unsigned long flags;
+       unsigned int i;
+
+       spin_lock_irqsave(&ccp->cmd_lock, flags);
+
+       ccp->suspending = 0;
+
+       /* Wake up all the kthreads */
+       for (i = 0; i < ccp->cmd_q_count; i++) {
+               ccp->cmd_q[i].suspended = 0;
+               wake_up_process(ccp->cmd_q[i].kthread);
+       }
+
+       spin_unlock_irqrestore(&ccp->cmd_lock, flags);
+
+       return 0;
+}
+#endif
+
+static DEFINE_PCI_DEVICE_TABLE(ccp_pci_table) = {
+       { PCI_VDEVICE(AMD, 0x1537), },
+       /* Last entry must be zero */
+       { 0, }
+};
+MODULE_DEVICE_TABLE(pci, ccp_pci_table);
+
+static struct pci_driver ccp_pci_driver = {
+       .name = "AMD Cryptographic Coprocessor",
+       .id_table = ccp_pci_table,
+       .probe = ccp_pci_probe,
+       .remove = ccp_pci_remove,
+#ifdef CONFIG_PM
+       .suspend = ccp_pci_suspend,
+       .resume = ccp_pci_resume,
+#endif
+};
+
+int ccp_pci_init(void)
+{
+       return pci_register_driver(&ccp_pci_driver);
+}
+
+void ccp_pci_exit(void)
+{
+       pci_unregister_driver(&ccp_pci_driver);
+}
diff --git a/drivers/crypto/dcp.c b/drivers/crypto/dcp.c
deleted file mode 100644 (file)
index 247ab80..0000000
+++ /dev/null
@@ -1,903 +0,0 @@
-/*
- * Cryptographic API.
- *
- * Support for DCP cryptographic accelerator.
- *
- * Copyright (c) 2013
- * Author: Tobias Rauter <tobias.rauter@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- * Based on tegra-aes.c, dcp.c (from freescale SDK) and sahara.c
- */
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/io.h>
-#include <linux/mutex.h>
-#include <linux/interrupt.h>
-#include <linux/completion.h>
-#include <linux/workqueue.h>
-#include <linux/delay.h>
-#include <linux/crypto.h>
-#include <linux/miscdevice.h>
-
-#include <crypto/scatterwalk.h>
-#include <crypto/aes.h>
-
-
-/* IOCTL for DCP OTP Key AES - taken from Freescale's SDK*/
-#define DBS_IOCTL_BASE   'd'
-#define DBS_ENC        _IOW(DBS_IOCTL_BASE, 0x00, uint8_t[16])
-#define DBS_DEC _IOW(DBS_IOCTL_BASE, 0x01, uint8_t[16])
-
-/* DCP channel used for AES */
-#define USED_CHANNEL 1
-/* Ring Buffers' maximum size */
-#define DCP_MAX_PKG 20
-
-/* Control Register */
-#define DCP_REG_CTRL 0x000
-#define DCP_CTRL_SFRST (1<<31)
-#define DCP_CTRL_CLKGATE (1<<30)
-#define DCP_CTRL_CRYPTO_PRESENT (1<<29)
-#define DCP_CTRL_SHA_PRESENT (1<<28)
-#define DCP_CTRL_GATHER_RES_WRITE (1<<23)
-#define DCP_CTRL_ENABLE_CONTEXT_CACHE (1<<22)
-#define DCP_CTRL_ENABLE_CONTEXT_SWITCH (1<<21)
-#define DCP_CTRL_CH_IRQ_E_0 0x01
-#define DCP_CTRL_CH_IRQ_E_1 0x02
-#define DCP_CTRL_CH_IRQ_E_2 0x04
-#define DCP_CTRL_CH_IRQ_E_3 0x08
-
-/* Status register */
-#define DCP_REG_STAT 0x010
-#define DCP_STAT_OTP_KEY_READY (1<<28)
-#define DCP_STAT_CUR_CHANNEL(stat) ((stat>>24)&0x0F)
-#define DCP_STAT_READY_CHANNEL(stat) ((stat>>16)&0x0F)
-#define DCP_STAT_IRQ(stat) (stat&0x0F)
-#define DCP_STAT_CHAN_0 (0x01)
-#define DCP_STAT_CHAN_1 (0x02)
-#define DCP_STAT_CHAN_2 (0x04)
-#define DCP_STAT_CHAN_3 (0x08)
-
-/* Channel Control Register */
-#define DCP_REG_CHAN_CTRL 0x020
-#define DCP_CHAN_CTRL_CH0_IRQ_MERGED (1<<16)
-#define DCP_CHAN_CTRL_HIGH_PRIO_0 (0x0100)
-#define DCP_CHAN_CTRL_HIGH_PRIO_1 (0x0200)
-#define DCP_CHAN_CTRL_HIGH_PRIO_2 (0x0400)
-#define DCP_CHAN_CTRL_HIGH_PRIO_3 (0x0800)
-#define DCP_CHAN_CTRL_ENABLE_0 (0x01)
-#define DCP_CHAN_CTRL_ENABLE_1 (0x02)
-#define DCP_CHAN_CTRL_ENABLE_2 (0x04)
-#define DCP_CHAN_CTRL_ENABLE_3 (0x08)
-
-/*
- * Channel Registers:
- * The DCP has 4 channels. Each of this channels
- * has 4 registers (command pointer, semaphore, status and options).
- * The address of register REG of channel CHAN is obtained by
- * dcp_chan_reg(REG, CHAN)
- */
-#define DCP_REG_CHAN_PTR       0x00000100
-#define DCP_REG_CHAN_SEMA      0x00000110
-#define DCP_REG_CHAN_STAT      0x00000120
-#define DCP_REG_CHAN_OPT       0x00000130
-
-#define DCP_CHAN_STAT_NEXT_CHAIN_IS_0  0x010000
-#define DCP_CHAN_STAT_NO_CHAIN         0x020000
-#define DCP_CHAN_STAT_CONTEXT_ERROR    0x030000
-#define DCP_CHAN_STAT_PAYLOAD_ERROR    0x040000
-#define DCP_CHAN_STAT_INVALID_MODE     0x050000
-#define DCP_CHAN_STAT_PAGEFAULT                0x40
-#define DCP_CHAN_STAT_DST              0x20
-#define DCP_CHAN_STAT_SRC              0x10
-#define DCP_CHAN_STAT_PACKET           0x08
-#define DCP_CHAN_STAT_SETUP            0x04
-#define DCP_CHAN_STAT_MISMATCH         0x02
-
-/* hw packet control*/
-
-#define DCP_PKT_PAYLOAD_KEY    (1<<11)
-#define DCP_PKT_OTP_KEY                (1<<10)
-#define DCP_PKT_CIPHER_INIT    (1<<9)
-#define DCP_PKG_CIPHER_ENCRYPT (1<<8)
-#define DCP_PKT_CIPHER_ENABLE  (1<<5)
-#define DCP_PKT_DECR_SEM       (1<<1)
-#define DCP_PKT_CHAIN          (1<<2)
-#define DCP_PKT_IRQ            1
-
-#define DCP_PKT_MODE_CBC       (1<<4)
-#define DCP_PKT_KEYSELECT_OTP  (0xFF<<8)
-
-/* cipher flags */
-#define DCP_ENC                0x0001
-#define DCP_DEC                0x0002
-#define DCP_ECB                0x0004
-#define DCP_CBC                0x0008
-#define DCP_CBC_INIT   0x0010
-#define DCP_NEW_KEY    0x0040
-#define DCP_OTP_KEY    0x0080
-#define DCP_AES                0x1000
-
-/* DCP Flags */
-#define DCP_FLAG_BUSY  0x01
-#define DCP_FLAG_PRODUCING     0x02
-
-/* clock defines */
-#define CLOCK_ON       1
-#define CLOCK_OFF      0
-
-struct dcp_dev_req_ctx {
-       int mode;
-};
-
-struct dcp_op {
-       unsigned int            flags;
-       u8                      key[AES_KEYSIZE_128];
-       int                     keylen;
-
-       struct ablkcipher_request       *req;
-       struct crypto_ablkcipher        *fallback;
-
-       uint32_t stat;
-       uint32_t pkt1;
-       uint32_t pkt2;
-       struct ablkcipher_walk walk;
-};
-
-struct dcp_dev {
-       struct device *dev;
-       void __iomem *dcp_regs_base;
-
-       int dcp_vmi_irq;
-       int dcp_irq;
-
-       spinlock_t queue_lock;
-       struct crypto_queue queue;
-
-       uint32_t pkt_produced;
-       uint32_t pkt_consumed;
-
-       struct dcp_hw_packet *hw_pkg[DCP_MAX_PKG];
-       dma_addr_t hw_phys_pkg;
-
-       /* [KEY][IV] Both with 16 Bytes */
-       u8 *payload_base;
-       dma_addr_t payload_base_dma;
-
-
-       struct tasklet_struct   done_task;
-       struct tasklet_struct   queue_task;
-       struct timer_list       watchdog;
-
-       unsigned long           flags;
-
-       struct dcp_op *ctx;
-
-       struct miscdevice dcp_bootstream_misc;
-};
-
-struct dcp_hw_packet {
-       uint32_t next;
-       uint32_t pkt1;
-       uint32_t pkt2;
-       uint32_t src;
-       uint32_t dst;
-       uint32_t size;
-       uint32_t payload;
-       uint32_t stat;
-};
-
-static struct dcp_dev *global_dev;
-
-static inline u32 dcp_chan_reg(u32 reg, int chan)
-{
-       return reg + (chan) * 0x40;
-}
-
-static inline void dcp_write(struct dcp_dev *dev, u32 data, u32 reg)
-{
-       writel(data, dev->dcp_regs_base + reg);
-}
-
-static inline void dcp_set(struct dcp_dev *dev, u32 data, u32 reg)
-{
-       writel(data, dev->dcp_regs_base + (reg | 0x04));
-}
-
-static inline void dcp_clear(struct dcp_dev *dev, u32 data, u32 reg)
-{
-       writel(data, dev->dcp_regs_base + (reg | 0x08));
-}
-
-static inline void dcp_toggle(struct dcp_dev *dev, u32 data, u32 reg)
-{
-       writel(data, dev->dcp_regs_base + (reg | 0x0C));
-}
-
-static inline unsigned int dcp_read(struct dcp_dev *dev, u32 reg)
-{
-       return readl(dev->dcp_regs_base + reg);
-}
-
-static void dcp_dma_unmap(struct dcp_dev *dev, struct dcp_hw_packet *pkt)
-{
-       dma_unmap_page(dev->dev, pkt->src, pkt->size, DMA_TO_DEVICE);
-       dma_unmap_page(dev->dev, pkt->dst, pkt->size, DMA_FROM_DEVICE);
-       dev_dbg(dev->dev, "unmap packet %x", (unsigned int) pkt);
-}
-
-static int dcp_dma_map(struct dcp_dev *dev,
-       struct ablkcipher_walk *walk, struct dcp_hw_packet *pkt)
-{
-       dev_dbg(dev->dev, "map packet %x", (unsigned int) pkt);
-       /* align to length = 16 */
-       pkt->size = walk->nbytes - (walk->nbytes % 16);
-
-       pkt->src = dma_map_page(dev->dev, walk->src.page, walk->src.offset,
-               pkt->size, DMA_TO_DEVICE);
-
-       if (pkt->src == 0) {
-               dev_err(dev->dev, "Unable to map src");
-               return -ENOMEM;
-       }
-
-       pkt->dst = dma_map_page(dev->dev, walk->dst.page, walk->dst.offset,
-               pkt->size, DMA_FROM_DEVICE);
-
-       if (pkt->dst == 0) {
-               dev_err(dev->dev, "Unable to map dst");
-               dma_unmap_page(dev->dev, pkt->src, pkt->size, DMA_TO_DEVICE);
-               return -ENOMEM;
-       }
-
-       return 0;
-}
-
-static void dcp_op_one(struct dcp_dev *dev, struct dcp_hw_packet *pkt,
-                       uint8_t last)
-{
-       struct dcp_op *ctx = dev->ctx;
-       pkt->pkt1 = ctx->pkt1;
-       pkt->pkt2 = ctx->pkt2;
-
-       pkt->payload = (u32) dev->payload_base_dma;
-       pkt->stat = 0;
-
-       if (ctx->flags & DCP_CBC_INIT) {
-               pkt->pkt1 |= DCP_PKT_CIPHER_INIT;
-               ctx->flags &= ~DCP_CBC_INIT;
-       }
-
-       mod_timer(&dev->watchdog, jiffies + msecs_to_jiffies(500));
-       pkt->pkt1 |= DCP_PKT_IRQ;
-       if (!last)
-               pkt->pkt1 |= DCP_PKT_CHAIN;
-
-       dev->pkt_produced++;
-
-       dcp_write(dev, 1,
-               dcp_chan_reg(DCP_REG_CHAN_SEMA, USED_CHANNEL));
-}
-
-static void dcp_op_proceed(struct dcp_dev *dev)
-{
-       struct dcp_op *ctx = dev->ctx;
-       struct dcp_hw_packet *pkt;
-
-       while (ctx->walk.nbytes) {
-               int err = 0;
-
-               pkt = dev->hw_pkg[dev->pkt_produced % DCP_MAX_PKG];
-               err = dcp_dma_map(dev, &ctx->walk, pkt);
-               if (err) {
-                       dev->ctx->stat |= err;
-                       /* start timer to wait for already set up calls */
-                       mod_timer(&dev->watchdog,
-                               jiffies + msecs_to_jiffies(500));
-                       break;
-               }
-
-
-               err = ctx->walk.nbytes - pkt->size;
-               ablkcipher_walk_done(dev->ctx->req, &dev->ctx->walk, err);
-
-               dcp_op_one(dev, pkt, ctx->walk.nbytes == 0);
-               /* we have to wait if no space is left in buffer */
-               if (dev->pkt_produced - dev->pkt_consumed == DCP_MAX_PKG)
-                       break;
-       }
-       clear_bit(DCP_FLAG_PRODUCING, &dev->flags);
-}
-
-static void dcp_op_start(struct dcp_dev *dev, uint8_t use_walk)
-{
-       struct dcp_op *ctx = dev->ctx;
-
-       if (ctx->flags & DCP_NEW_KEY) {
-               memcpy(dev->payload_base, ctx->key, ctx->keylen);
-               ctx->flags &= ~DCP_NEW_KEY;
-       }
-
-       ctx->pkt1 = 0;
-       ctx->pkt1 |= DCP_PKT_CIPHER_ENABLE;
-       ctx->pkt1 |= DCP_PKT_DECR_SEM;
-
-       if (ctx->flags & DCP_OTP_KEY)
-               ctx->pkt1 |= DCP_PKT_OTP_KEY;
-       else
-               ctx->pkt1 |= DCP_PKT_PAYLOAD_KEY;
-
-       if (ctx->flags & DCP_ENC)
-               ctx->pkt1 |= DCP_PKG_CIPHER_ENCRYPT;
-
-       ctx->pkt2 = 0;
-       if (ctx->flags & DCP_CBC)
-               ctx->pkt2 |= DCP_PKT_MODE_CBC;
-
-       dev->pkt_produced = 0;
-       dev->pkt_consumed = 0;
-
-       ctx->stat = 0;
-       dcp_clear(dev, -1, dcp_chan_reg(DCP_REG_CHAN_STAT, USED_CHANNEL));
-       dcp_write(dev, (u32) dev->hw_phys_pkg,
-               dcp_chan_reg(DCP_REG_CHAN_PTR, USED_CHANNEL));
-
-       set_bit(DCP_FLAG_PRODUCING, &dev->flags);
-
-       if (use_walk) {
-               ablkcipher_walk_init(&ctx->walk, ctx->req->dst,
-                               ctx->req->src, ctx->req->nbytes);
-               ablkcipher_walk_phys(ctx->req, &ctx->walk);
-               dcp_op_proceed(dev);
-       } else {
-               dcp_op_one(dev, dev->hw_pkg[0], 1);
-               clear_bit(DCP_FLAG_PRODUCING, &dev->flags);
-       }
-}
-
-static void dcp_done_task(unsigned long data)
-{
-       struct dcp_dev *dev = (struct dcp_dev *)data;
-       struct dcp_hw_packet *last_packet;
-       int fin;
-       fin = 0;
-
-       for (last_packet = dev->hw_pkg[(dev->pkt_consumed) % DCP_MAX_PKG];
-               last_packet->stat == 1;
-               last_packet =
-                       dev->hw_pkg[++(dev->pkt_consumed) % DCP_MAX_PKG]) {
-
-               dcp_dma_unmap(dev, last_packet);
-               last_packet->stat = 0;
-               fin++;
-       }
-       /* the last call of this function already consumed this IRQ's packet */
-       if (fin == 0)
-               return;
-
-       dev_dbg(dev->dev,
-               "Packet(s) done with status %x; finished: %d, produced:%d, complete consumed: %d",
-               dev->ctx->stat, fin, dev->pkt_produced, dev->pkt_consumed);
-
-       last_packet = dev->hw_pkg[(dev->pkt_consumed - 1) % DCP_MAX_PKG];
-       if (!dev->ctx->stat && last_packet->pkt1 & DCP_PKT_CHAIN) {
-               if (!test_and_set_bit(DCP_FLAG_PRODUCING, &dev->flags))
-                       dcp_op_proceed(dev);
-               return;
-       }
-
-       while (unlikely(dev->pkt_consumed < dev->pkt_produced)) {
-               dcp_dma_unmap(dev,
-                       dev->hw_pkg[dev->pkt_consumed++ % DCP_MAX_PKG]);
-       }
-
-       if (dev->ctx->flags & DCP_OTP_KEY) {
-               /* we used the miscdevice, no walk to finish */
-               clear_bit(DCP_FLAG_BUSY, &dev->flags);
-               return;
-       }
-
-       ablkcipher_walk_complete(&dev->ctx->walk);
-       dev->ctx->req->base.complete(&dev->ctx->req->base,
-                       dev->ctx->stat);
-       dev->ctx->req = NULL;
-       /* in case there are other requests in the queue */
-       tasklet_schedule(&dev->queue_task);
-}
-
-static void dcp_watchdog(unsigned long data)
-{
-       struct dcp_dev *dev = (struct dcp_dev *)data;
-       dev->ctx->stat |= dcp_read(dev,
-                       dcp_chan_reg(DCP_REG_CHAN_STAT, USED_CHANNEL));
-
-       dev_err(dev->dev, "Timeout, Channel status: %x", dev->ctx->stat);
-
-       if (!dev->ctx->stat)
-               dev->ctx->stat = -ETIMEDOUT;
-
-       dcp_done_task(data);
-}
-
-
-static irqreturn_t dcp_common_irq(int irq, void *context)
-{
-       u32 msk;
-       struct dcp_dev *dev = (struct dcp_dev *) context;
-
-       del_timer(&dev->watchdog);
-
-       msk = DCP_STAT_IRQ(dcp_read(dev, DCP_REG_STAT));
-       dcp_clear(dev, msk, DCP_REG_STAT);
-       if (msk == 0)
-               return IRQ_NONE;
-
-       dev->ctx->stat |= dcp_read(dev,
-                       dcp_chan_reg(DCP_REG_CHAN_STAT, USED_CHANNEL));
-
-       if (msk & DCP_STAT_CHAN_1)
-               tasklet_schedule(&dev->done_task);
-
-       return IRQ_HANDLED;
-}
-
-static irqreturn_t dcp_vmi_irq(int irq, void *context)
-{
-       return dcp_common_irq(irq, context);
-}
-
-static irqreturn_t dcp_irq(int irq, void *context)
-{
-       return dcp_common_irq(irq, context);
-}
-
-static void dcp_crypt(struct dcp_dev *dev, struct dcp_op *ctx)
-{
-       dev->ctx = ctx;
-
-       if ((ctx->flags & DCP_CBC) && ctx->req->info) {
-               ctx->flags |= DCP_CBC_INIT;
-               memcpy(dev->payload_base + AES_KEYSIZE_128,
-                       ctx->req->info, AES_KEYSIZE_128);
-       }
-
-       dcp_op_start(dev, 1);
-}
-
-static void dcp_queue_task(unsigned long data)
-{
-       struct dcp_dev *dev = (struct dcp_dev *) data;
-       struct crypto_async_request *async_req, *backlog;
-       struct crypto_ablkcipher *tfm;
-       struct dcp_op *ctx;
-       struct dcp_dev_req_ctx *rctx;
-       struct ablkcipher_request *req;
-       unsigned long flags;
-
-       spin_lock_irqsave(&dev->queue_lock, flags);
-
-       backlog = crypto_get_backlog(&dev->queue);
-       async_req = crypto_dequeue_request(&dev->queue);
-
-       spin_unlock_irqrestore(&dev->queue_lock, flags);
-
-       if (!async_req)
-               goto ret_nothing_done;
-
-       if (backlog)
-               backlog->complete(backlog, -EINPROGRESS);
-
-       req = ablkcipher_request_cast(async_req);
-       tfm = crypto_ablkcipher_reqtfm(req);
-       rctx = ablkcipher_request_ctx(req);
-       ctx = crypto_ablkcipher_ctx(tfm);
-
-       if (!req->src || !req->dst)
-               goto ret_nothing_done;
-
-       ctx->flags |= rctx->mode;
-       ctx->req = req;
-
-       dcp_crypt(dev, ctx);
-
-       return;
-
-ret_nothing_done:
-       clear_bit(DCP_FLAG_BUSY, &dev->flags);
-}
-
-
-static int dcp_cra_init(struct crypto_tfm *tfm)
-{
-       const char *name = tfm->__crt_alg->cra_name;
-       struct dcp_op *ctx = crypto_tfm_ctx(tfm);
-
-       tfm->crt_ablkcipher.reqsize = sizeof(struct dcp_dev_req_ctx);
-
-       ctx->fallback = crypto_alloc_ablkcipher(name, 0,
-                               CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK);
-
-       if (IS_ERR(ctx->fallback)) {
-               dev_err(global_dev->dev, "Error allocating fallback algo %s\n",
-                       name);
-               return PTR_ERR(ctx->fallback);
-       }
-
-       return 0;
-}
-
-static void dcp_cra_exit(struct crypto_tfm *tfm)
-{
-       struct dcp_op *ctx = crypto_tfm_ctx(tfm);
-
-       if (ctx->fallback)
-               crypto_free_ablkcipher(ctx->fallback);
-
-       ctx->fallback = NULL;
-}
-
-/* async interface */
-static int dcp_aes_setkey(struct crypto_ablkcipher *tfm, const u8 *key,
-               unsigned int len)
-{
-       struct dcp_op *ctx = crypto_ablkcipher_ctx(tfm);
-       unsigned int ret = 0;
-       ctx->keylen = len;
-       ctx->flags = 0;
-       if (len == AES_KEYSIZE_128) {
-               if (memcmp(ctx->key, key, AES_KEYSIZE_128)) {
-                       memcpy(ctx->key, key, len);
-                       ctx->flags |= DCP_NEW_KEY;
-               }
-               return 0;
-       }
-
-       ctx->fallback->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK;
-       ctx->fallback->base.crt_flags |=
-               (tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK);
-
-       ret = crypto_ablkcipher_setkey(ctx->fallback, key, len);
-       if (ret) {
-               struct crypto_tfm *tfm_aux = crypto_ablkcipher_tfm(tfm);
-
-               tfm_aux->crt_flags &= ~CRYPTO_TFM_RES_MASK;
-               tfm_aux->crt_flags |=
-                       (ctx->fallback->base.crt_flags & CRYPTO_TFM_RES_MASK);
-       }
-       return ret;
-}
-
-static int dcp_aes_cbc_crypt(struct ablkcipher_request *req, int mode)
-{
-       struct dcp_dev_req_ctx *rctx = ablkcipher_request_ctx(req);
-       struct dcp_dev *dev = global_dev;
-       unsigned long flags;
-       int err = 0;
-
-       if (!IS_ALIGNED(req->nbytes, AES_BLOCK_SIZE))
-               return -EINVAL;
-
-       rctx->mode = mode;
-
-       spin_lock_irqsave(&dev->queue_lock, flags);
-       err = ablkcipher_enqueue_request(&dev->queue, req);
-       spin_unlock_irqrestore(&dev->queue_lock, flags);
-
-       flags = test_and_set_bit(DCP_FLAG_BUSY, &dev->flags);
-
-       if (!(flags & DCP_FLAG_BUSY))
-               tasklet_schedule(&dev->queue_task);
-
-       return err;
-}
-
-static int dcp_aes_cbc_encrypt(struct ablkcipher_request *req)
-{
-       struct crypto_tfm *tfm =
-               crypto_ablkcipher_tfm(crypto_ablkcipher_reqtfm(req));
-       struct dcp_op *ctx = crypto_ablkcipher_ctx(
-               crypto_ablkcipher_reqtfm(req));
-
-       if (unlikely(ctx->keylen != AES_KEYSIZE_128)) {
-               int err = 0;
-               ablkcipher_request_set_tfm(req, ctx->fallback);
-               err = crypto_ablkcipher_encrypt(req);
-               ablkcipher_request_set_tfm(req, __crypto_ablkcipher_cast(tfm));
-               return err;
-       }
-
-       return dcp_aes_cbc_crypt(req, DCP_AES | DCP_ENC | DCP_CBC);
-}
-
-static int dcp_aes_cbc_decrypt(struct ablkcipher_request *req)
-{
-       struct crypto_tfm *tfm =
-               crypto_ablkcipher_tfm(crypto_ablkcipher_reqtfm(req));
-       struct dcp_op *ctx = crypto_ablkcipher_ctx(
-               crypto_ablkcipher_reqtfm(req));
-
-       if (unlikely(ctx->keylen != AES_KEYSIZE_128)) {
-               int err = 0;
-               ablkcipher_request_set_tfm(req, ctx->fallback);
-               err = crypto_ablkcipher_decrypt(req);
-               ablkcipher_request_set_tfm(req, __crypto_ablkcipher_cast(tfm));
-               return err;
-       }
-       return dcp_aes_cbc_crypt(req, DCP_AES | DCP_DEC | DCP_CBC);
-}
-
-static struct crypto_alg algs[] = {
-       {
-               .cra_name = "cbc(aes)",
-               .cra_driver_name = "dcp-cbc-aes",
-               .cra_alignmask = 3,
-               .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC |
-                         CRYPTO_ALG_NEED_FALLBACK,
-               .cra_blocksize = AES_KEYSIZE_128,
-               .cra_type = &crypto_ablkcipher_type,
-               .cra_priority = 300,
-               .cra_u.ablkcipher = {
-                       .min_keysize =  AES_KEYSIZE_128,
-                       .max_keysize = AES_KEYSIZE_128,
-                       .setkey = dcp_aes_setkey,
-                       .encrypt = dcp_aes_cbc_encrypt,
-                       .decrypt = dcp_aes_cbc_decrypt,
-                       .ivsize = AES_KEYSIZE_128,
-               }
-
-       },
-};
-
-/* DCP bootstream verification interface: uses OTP key for crypto */
-static int dcp_bootstream_open(struct inode *inode, struct file *file)
-{
-       file->private_data = container_of((file->private_data),
-                       struct dcp_dev, dcp_bootstream_misc);
-       return 0;
-}
-
-static long dcp_bootstream_ioctl(struct file *file,
-                                        unsigned int cmd, unsigned long arg)
-{
-       struct dcp_dev *dev = (struct dcp_dev *) file->private_data;
-       void __user *argp = (void __user *)arg;
-       int ret;
-
-       if (dev == NULL)
-               return -EBADF;
-
-       if (cmd != DBS_ENC && cmd != DBS_DEC)
-               return -EINVAL;
-
-       if (copy_from_user(dev->payload_base, argp, 16))
-               return -EFAULT;
-
-       if (test_and_set_bit(DCP_FLAG_BUSY, &dev->flags))
-               return -EAGAIN;
-
-       dev->ctx = kzalloc(sizeof(struct dcp_op), GFP_KERNEL);
-       if (!dev->ctx) {
-               dev_err(dev->dev,
-                       "cannot allocate context for OTP crypto");
-               clear_bit(DCP_FLAG_BUSY, &dev->flags);
-               return -ENOMEM;
-       }
-
-       dev->ctx->flags = DCP_AES | DCP_ECB | DCP_OTP_KEY | DCP_CBC_INIT;
-       dev->ctx->flags |= (cmd == DBS_ENC) ? DCP_ENC : DCP_DEC;
-       dev->hw_pkg[0]->src = dev->payload_base_dma;
-       dev->hw_pkg[0]->dst = dev->payload_base_dma;
-       dev->hw_pkg[0]->size = 16;
-
-       dcp_op_start(dev, 0);
-
-       while (test_bit(DCP_FLAG_BUSY, &dev->flags))
-               cpu_relax();
-
-       ret = dev->ctx->stat;
-       if (!ret && copy_to_user(argp, dev->payload_base, 16))
-               ret =  -EFAULT;
-
-       kfree(dev->ctx);
-
-       return ret;
-}
-
-static const struct file_operations dcp_bootstream_fops = {
-       .owner =                THIS_MODULE,
-       .unlocked_ioctl =       dcp_bootstream_ioctl,
-       .open =                 dcp_bootstream_open,
-};
-
-static int dcp_probe(struct platform_device *pdev)
-{
-       struct dcp_dev *dev = NULL;
-       struct resource *r;
-       int i, ret, j;
-
-       dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
-       if (!dev)
-               return -ENOMEM;
-
-       global_dev = dev;
-       dev->dev = &pdev->dev;
-
-       platform_set_drvdata(pdev, dev);
-
-       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       dev->dcp_regs_base = devm_ioremap_resource(&pdev->dev, r);
-       if (IS_ERR(dev->dcp_regs_base))
-               return PTR_ERR(dev->dcp_regs_base);
-
-       dcp_set(dev, DCP_CTRL_SFRST, DCP_REG_CTRL);
-       udelay(10);
-       dcp_clear(dev, DCP_CTRL_SFRST | DCP_CTRL_CLKGATE, DCP_REG_CTRL);
-
-       dcp_write(dev, DCP_CTRL_GATHER_RES_WRITE |
-               DCP_CTRL_ENABLE_CONTEXT_CACHE | DCP_CTRL_CH_IRQ_E_1,
-               DCP_REG_CTRL);
-
-       dcp_write(dev, DCP_CHAN_CTRL_ENABLE_1, DCP_REG_CHAN_CTRL);
-
-       for (i = 0; i < 4; i++)
-               dcp_clear(dev, -1, dcp_chan_reg(DCP_REG_CHAN_STAT, i));
-
-       dcp_clear(dev, -1, DCP_REG_STAT);
-
-
-       r = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-       if (!r) {
-               dev_err(&pdev->dev, "can't get IRQ resource (0)\n");
-               return -EIO;
-       }
-       dev->dcp_vmi_irq = r->start;
-       ret = devm_request_irq(&pdev->dev, dev->dcp_vmi_irq, dcp_vmi_irq, 0,
-                              "dcp", dev);
-       if (ret != 0) {
-               dev_err(&pdev->dev, "can't request_irq (0)\n");
-               return -EIO;
-       }
-
-       r = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
-       if (!r) {
-               dev_err(&pdev->dev, "can't get IRQ resource (1)\n");
-               return -EIO;
-       }
-       dev->dcp_irq = r->start;
-       ret = devm_request_irq(&pdev->dev, dev->dcp_irq, dcp_irq, 0, "dcp",
-                              dev);
-       if (ret != 0) {
-               dev_err(&pdev->dev, "can't request_irq (1)\n");
-               return -EIO;
-       }
-
-       dev->hw_pkg[0] = dma_alloc_coherent(&pdev->dev,
-                       DCP_MAX_PKG * sizeof(struct dcp_hw_packet),
-                       &dev->hw_phys_pkg,
-                       GFP_KERNEL);
-       if (!dev->hw_pkg[0]) {
-               dev_err(&pdev->dev, "Could not allocate hw descriptors\n");
-               return -ENOMEM;
-       }
-
-       for (i = 1; i < DCP_MAX_PKG; i++) {
-               dev->hw_pkg[i - 1]->next = dev->hw_phys_pkg
-                               + i * sizeof(struct dcp_hw_packet);
-               dev->hw_pkg[i] = dev->hw_pkg[i - 1] + 1;
-       }
-       dev->hw_pkg[i - 1]->next = dev->hw_phys_pkg;
-
-
-       dev->payload_base = dma_alloc_coherent(&pdev->dev, 2 * AES_KEYSIZE_128,
-                       &dev->payload_base_dma, GFP_KERNEL);
-       if (!dev->payload_base) {
-               dev_err(&pdev->dev, "Could not allocate memory for key\n");
-               ret = -ENOMEM;
-               goto err_free_hw_packet;
-       }
-       tasklet_init(&dev->queue_task, dcp_queue_task,
-               (unsigned long) dev);
-       tasklet_init(&dev->done_task, dcp_done_task,
-               (unsigned long) dev);
-       spin_lock_init(&dev->queue_lock);
-
-       crypto_init_queue(&dev->queue, 10);
-
-       init_timer(&dev->watchdog);
-       dev->watchdog.function = &dcp_watchdog;
-       dev->watchdog.data = (unsigned long)dev;
-
-       dev->dcp_bootstream_misc.minor = MISC_DYNAMIC_MINOR,
-       dev->dcp_bootstream_misc.name = "dcpboot",
-       dev->dcp_bootstream_misc.fops = &dcp_bootstream_fops,
-       ret = misc_register(&dev->dcp_bootstream_misc);
-       if (ret != 0) {
-               dev_err(dev->dev, "Unable to register misc device\n");
-               goto err_free_key_iv;
-       }
-
-       for (i = 0; i < ARRAY_SIZE(algs); i++) {
-               algs[i].cra_priority = 300;
-               algs[i].cra_ctxsize = sizeof(struct dcp_op);
-               algs[i].cra_module = THIS_MODULE;
-               algs[i].cra_init = dcp_cra_init;
-               algs[i].cra_exit = dcp_cra_exit;
-               if (crypto_register_alg(&algs[i])) {
-                       dev_err(&pdev->dev, "register algorithm failed\n");
-                       ret = -ENOMEM;
-                       goto err_unregister;
-               }
-       }
-       dev_notice(&pdev->dev, "DCP crypto enabled.!\n");
-
-       return 0;
-
-err_unregister:
-       for (j = 0; j < i; j++)
-               crypto_unregister_alg(&algs[j]);
-err_free_key_iv:
-       tasklet_kill(&dev->done_task);
-       tasklet_kill(&dev->queue_task);
-       dma_free_coherent(&pdev->dev, 2 * AES_KEYSIZE_128, dev->payload_base,
-                       dev->payload_base_dma);
-err_free_hw_packet:
-       dma_free_coherent(&pdev->dev, DCP_MAX_PKG *
-               sizeof(struct dcp_hw_packet), dev->hw_pkg[0],
-               dev->hw_phys_pkg);
-
-       return ret;
-}
-
-static int dcp_remove(struct platform_device *pdev)
-{
-       struct dcp_dev *dev;
-       int j;
-       dev = platform_get_drvdata(pdev);
-
-       misc_deregister(&dev->dcp_bootstream_misc);
-
-       for (j = 0; j < ARRAY_SIZE(algs); j++)
-               crypto_unregister_alg(&algs[j]);
-
-       tasklet_kill(&dev->done_task);
-       tasklet_kill(&dev->queue_task);
-
-       dma_free_coherent(&pdev->dev, 2 * AES_KEYSIZE_128, dev->payload_base,
-                       dev->payload_base_dma);
-
-       dma_free_coherent(&pdev->dev,
-                       DCP_MAX_PKG * sizeof(struct dcp_hw_packet),
-                       dev->hw_pkg[0], dev->hw_phys_pkg);
-
-       return 0;
-}
-
-static struct of_device_id fs_dcp_of_match[] = {
-       {       .compatible = "fsl-dcp"},
-       {},
-};
-
-static struct platform_driver fs_dcp_driver = {
-       .probe = dcp_probe,
-       .remove = dcp_remove,
-       .driver = {
-               .name = "fsl-dcp",
-               .owner = THIS_MODULE,
-               .of_match_table = fs_dcp_of_match
-       }
-};
-
-module_platform_driver(fs_dcp_driver);
-
-
-MODULE_AUTHOR("Tobias Rauter <tobias.rauter@gmail.com>");
-MODULE_DESCRIPTION("Freescale DCP Crypto Driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
new file mode 100644 (file)
index 0000000..a6db7fa
--- /dev/null
@@ -0,0 +1,1100 @@
+/*
+ * Freescale i.MX23/i.MX28 Data Co-Processor driver
+ *
+ * Copyright (C) 2013 Marek Vasut <marex@denx.de>
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/crypto.h>
+#include <linux/dma-mapping.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/kthread.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/stmp_device.h>
+
+#include <crypto/aes.h>
+#include <crypto/sha.h>
+#include <crypto/internal/hash.h>
+
+#define DCP_MAX_CHANS  4
+#define DCP_BUF_SZ     PAGE_SIZE
+
+/* DCP DMA descriptor. */
+struct dcp_dma_desc {
+       uint32_t        next_cmd_addr;
+       uint32_t        control0;
+       uint32_t        control1;
+       uint32_t        source;
+       uint32_t        destination;
+       uint32_t        size;
+       uint32_t        payload;
+       uint32_t        status;
+};
+
+/* Coherent aligned block for bounce buffering. */
+struct dcp_coherent_block {
+       uint8_t                 aes_in_buf[DCP_BUF_SZ];
+       uint8_t                 aes_out_buf[DCP_BUF_SZ];
+       uint8_t                 sha_in_buf[DCP_BUF_SZ];
+
+       uint8_t                 aes_key[2 * AES_KEYSIZE_128];
+       uint8_t                 sha_digest[SHA256_DIGEST_SIZE];
+
+       struct dcp_dma_desc     desc[DCP_MAX_CHANS];
+};
+
+struct dcp {
+       struct device                   *dev;
+       void __iomem                    *base;
+
+       uint32_t                        caps;
+
+       struct dcp_coherent_block       *coh;
+
+       struct completion               completion[DCP_MAX_CHANS];
+       struct mutex                    mutex[DCP_MAX_CHANS];
+       struct task_struct              *thread[DCP_MAX_CHANS];
+       struct crypto_queue             queue[DCP_MAX_CHANS];
+};
+
+enum dcp_chan {
+       DCP_CHAN_HASH_SHA       = 0,
+       DCP_CHAN_CRYPTO         = 2,
+};
+
+struct dcp_async_ctx {
+       /* Common context */
+       enum dcp_chan   chan;
+       uint32_t        fill;
+
+       /* SHA Hash-specific context */
+       struct mutex                    mutex;
+       uint32_t                        alg;
+       unsigned int                    hot:1;
+
+       /* Crypto-specific context */
+       unsigned int                    enc:1;
+       unsigned int                    ecb:1;
+       struct crypto_ablkcipher        *fallback;
+       unsigned int                    key_len;
+       uint8_t                         key[AES_KEYSIZE_128];
+};
+
+struct dcp_sha_req_ctx {
+       unsigned int    init:1;
+       unsigned int    fini:1;
+};
+
+/*
+ * There can even be only one instance of the MXS DCP due to the
+ * design of Linux Crypto API.
+ */
+static struct dcp *global_sdcp;
+static DEFINE_MUTEX(global_mutex);
+
+/* DCP register layout. */
+#define MXS_DCP_CTRL                           0x00
+#define MXS_DCP_CTRL_GATHER_RESIDUAL_WRITES    (1 << 23)
+#define MXS_DCP_CTRL_ENABLE_CONTEXT_CACHING    (1 << 22)
+
+#define MXS_DCP_STAT                           0x10
+#define MXS_DCP_STAT_CLR                       0x18
+#define MXS_DCP_STAT_IRQ_MASK                  0xf
+
+#define MXS_DCP_CHANNELCTRL                    0x20
+#define MXS_DCP_CHANNELCTRL_ENABLE_CHANNEL_MASK        0xff
+
+#define MXS_DCP_CAPABILITY1                    0x40
+#define MXS_DCP_CAPABILITY1_SHA256             (4 << 16)
+#define MXS_DCP_CAPABILITY1_SHA1               (1 << 16)
+#define MXS_DCP_CAPABILITY1_AES128             (1 << 0)
+
+#define MXS_DCP_CONTEXT                                0x50
+
+#define MXS_DCP_CH_N_CMDPTR(n)                 (0x100 + ((n) * 0x40))
+
+#define MXS_DCP_CH_N_SEMA(n)                   (0x110 + ((n) * 0x40))
+
+#define MXS_DCP_CH_N_STAT(n)                   (0x120 + ((n) * 0x40))
+#define MXS_DCP_CH_N_STAT_CLR(n)               (0x128 + ((n) * 0x40))
+
+/* DMA descriptor bits. */
+#define MXS_DCP_CONTROL0_HASH_TERM             (1 << 13)
+#define MXS_DCP_CONTROL0_HASH_INIT             (1 << 12)
+#define MXS_DCP_CONTROL0_PAYLOAD_KEY           (1 << 11)
+#define MXS_DCP_CONTROL0_CIPHER_ENCRYPT                (1 << 8)
+#define MXS_DCP_CONTROL0_CIPHER_INIT           (1 << 9)
+#define MXS_DCP_CONTROL0_ENABLE_HASH           (1 << 6)
+#define MXS_DCP_CONTROL0_ENABLE_CIPHER         (1 << 5)
+#define MXS_DCP_CONTROL0_DECR_SEMAPHORE                (1 << 1)
+#define MXS_DCP_CONTROL0_INTERRUPT             (1 << 0)
+
+#define MXS_DCP_CONTROL1_HASH_SELECT_SHA256    (2 << 16)
+#define MXS_DCP_CONTROL1_HASH_SELECT_SHA1      (0 << 16)
+#define MXS_DCP_CONTROL1_CIPHER_MODE_CBC       (1 << 4)
+#define MXS_DCP_CONTROL1_CIPHER_MODE_ECB       (0 << 4)
+#define MXS_DCP_CONTROL1_CIPHER_SELECT_AES128  (0 << 0)
+
+static int mxs_dcp_start_dma(struct dcp_async_ctx *actx)
+{
+       struct dcp *sdcp = global_sdcp;
+       const int chan = actx->chan;
+       uint32_t stat;
+       int ret;
+       struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
+
+       dma_addr_t desc_phys = dma_map_single(sdcp->dev, desc, sizeof(*desc),
+                                             DMA_TO_DEVICE);
+
+       reinit_completion(&sdcp->completion[chan]);
+
+       /* Clear status register. */
+       writel(0xffffffff, sdcp->base + MXS_DCP_CH_N_STAT_CLR(chan));
+
+       /* Load the DMA descriptor. */
+       writel(desc_phys, sdcp->base + MXS_DCP_CH_N_CMDPTR(chan));
+
+       /* Increment the semaphore to start the DMA transfer. */
+       writel(1, sdcp->base + MXS_DCP_CH_N_SEMA(chan));
+
+       ret = wait_for_completion_timeout(&sdcp->completion[chan],
+                                         msecs_to_jiffies(1000));
+       if (!ret) {
+               dev_err(sdcp->dev, "Channel %i timeout (DCP_STAT=0x%08x)\n",
+                       chan, readl(sdcp->base + MXS_DCP_STAT));
+               return -ETIMEDOUT;
+       }
+
+       stat = readl(sdcp->base + MXS_DCP_CH_N_STAT(chan));
+       if (stat & 0xff) {
+               dev_err(sdcp->dev, "Channel %i error (CH_STAT=0x%08x)\n",
+                       chan, stat);
+               return -EINVAL;
+       }
+
+       dma_unmap_single(sdcp->dev, desc_phys, sizeof(*desc), DMA_TO_DEVICE);
+
+       return 0;
+}
+
+/*
+ * Encryption (AES128)
+ */
+static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, int init)
+{
+       struct dcp *sdcp = global_sdcp;
+       struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
+       int ret;
+
+       dma_addr_t key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key,
+                                            2 * AES_KEYSIZE_128,
+                                            DMA_TO_DEVICE);
+       dma_addr_t src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf,
+                                            DCP_BUF_SZ, DMA_TO_DEVICE);
+       dma_addr_t dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf,
+                                            DCP_BUF_SZ, DMA_FROM_DEVICE);
+
+       /* Fill in the DMA descriptor. */
+       desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE |
+                   MXS_DCP_CONTROL0_INTERRUPT |
+                   MXS_DCP_CONTROL0_ENABLE_CIPHER;
+
+       /* Payload contains the key. */
+       desc->control0 |= MXS_DCP_CONTROL0_PAYLOAD_KEY;
+
+       if (actx->enc)
+               desc->control0 |= MXS_DCP_CONTROL0_CIPHER_ENCRYPT;
+       if (init)
+               desc->control0 |= MXS_DCP_CONTROL0_CIPHER_INIT;
+
+       desc->control1 = MXS_DCP_CONTROL1_CIPHER_SELECT_AES128;
+
+       if (actx->ecb)
+               desc->control1 |= MXS_DCP_CONTROL1_CIPHER_MODE_ECB;
+       else
+               desc->control1 |= MXS_DCP_CONTROL1_CIPHER_MODE_CBC;
+
+       desc->next_cmd_addr = 0;
+       desc->source = src_phys;
+       desc->destination = dst_phys;
+       desc->size = actx->fill;
+       desc->payload = key_phys;
+       desc->status = 0;
+
+       ret = mxs_dcp_start_dma(actx);
+
+       dma_unmap_single(sdcp->dev, key_phys, 2 * AES_KEYSIZE_128,
+                        DMA_TO_DEVICE);
+       dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
+       dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE);
+
+       return ret;
+}
+
+static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq)
+{
+       struct dcp *sdcp = global_sdcp;
+
+       struct ablkcipher_request *req = ablkcipher_request_cast(arq);
+       struct dcp_async_ctx *actx = crypto_tfm_ctx(arq->tfm);
+
+       struct scatterlist *dst = req->dst;
+       struct scatterlist *src = req->src;
+       const int nents = sg_nents(req->src);
+
+       const int out_off = DCP_BUF_SZ;
+       uint8_t *in_buf = sdcp->coh->aes_in_buf;
+       uint8_t *out_buf = sdcp->coh->aes_out_buf;
+
+       uint8_t *out_tmp, *src_buf, *dst_buf = NULL;
+       uint32_t dst_off = 0;
+
+       uint8_t *key = sdcp->coh->aes_key;
+
+       int ret = 0;
+       int split = 0;
+       unsigned int i, len, clen, rem = 0;
+       int init = 0;
+
+       actx->fill = 0;
+
+       /* Copy the key from the temporary location. */
+       memcpy(key, actx->key, actx->key_len);
+
+       if (!actx->ecb) {
+               /* Copy the CBC IV just past the key. */
+               memcpy(key + AES_KEYSIZE_128, req->info, AES_KEYSIZE_128);
+               /* CBC needs the INIT set. */
+               init = 1;
+       } else {
+               memset(key + AES_KEYSIZE_128, 0, AES_KEYSIZE_128);
+       }
+
+       for_each_sg(req->src, src, nents, i) {
+               src_buf = sg_virt(src);
+               len = sg_dma_len(src);
+
+               do {
+                       if (actx->fill + len > out_off)
+                               clen = out_off - actx->fill;
+                       else
+                               clen = len;
+
+                       memcpy(in_buf + actx->fill, src_buf, clen);
+                       len -= clen;
+                       src_buf += clen;
+                       actx->fill += clen;
+
+                       /*
+                        * If we filled the buffer or this is the last SG,
+                        * submit the buffer.
+                        */
+                       if (actx->fill == out_off || sg_is_last(src)) {
+                               ret = mxs_dcp_run_aes(actx, init);
+                               if (ret)
+                                       return ret;
+                               init = 0;
+
+                               out_tmp = out_buf;
+                               while (dst && actx->fill) {
+                                       if (!split) {
+                                               dst_buf = sg_virt(dst);
+                                               dst_off = 0;
+                                       }
+                                       rem = min(sg_dma_len(dst) - dst_off,
+                                                 actx->fill);
+
+                                       memcpy(dst_buf + dst_off, out_tmp, rem);
+                                       out_tmp += rem;
+                                       dst_off += rem;
+                                       actx->fill -= rem;
+
+                                       if (dst_off == sg_dma_len(dst)) {
+                                               dst = sg_next(dst);
+                                               split = 0;
+                                       } else {
+                                               split = 1;
+                                       }
+                               }
+                       }
+               } while (len);
+       }
+
+       return ret;
+}
+
+static int dcp_chan_thread_aes(void *data)
+{
+       struct dcp *sdcp = global_sdcp;
+       const int chan = DCP_CHAN_CRYPTO;
+
+       struct crypto_async_request *backlog;
+       struct crypto_async_request *arq;
+
+       int ret;
+
+       do {
+               __set_current_state(TASK_INTERRUPTIBLE);
+
+               mutex_lock(&sdcp->mutex[chan]);
+               backlog = crypto_get_backlog(&sdcp->queue[chan]);
+               arq = crypto_dequeue_request(&sdcp->queue[chan]);
+               mutex_unlock(&sdcp->mutex[chan]);
+
+               if (backlog)
+                       backlog->complete(backlog, -EINPROGRESS);
+
+               if (arq) {
+                       ret = mxs_dcp_aes_block_crypt(arq);
+                       arq->complete(arq, ret);
+                       continue;
+               }
+
+               schedule();
+       } while (!kthread_should_stop());
+
+       return 0;
+}
+
+static int mxs_dcp_block_fallback(struct ablkcipher_request *req, int enc)
+{
+       struct crypto_tfm *tfm =
+               crypto_ablkcipher_tfm(crypto_ablkcipher_reqtfm(req));
+       struct dcp_async_ctx *ctx = crypto_ablkcipher_ctx(
+               crypto_ablkcipher_reqtfm(req));
+       int ret;
+
+       ablkcipher_request_set_tfm(req, ctx->fallback);
+
+       if (enc)
+               ret = crypto_ablkcipher_encrypt(req);
+       else
+               ret = crypto_ablkcipher_decrypt(req);
+
+       ablkcipher_request_set_tfm(req, __crypto_ablkcipher_cast(tfm));
+
+       return ret;
+}
+
+static int mxs_dcp_aes_enqueue(struct ablkcipher_request *req, int enc, int ecb)
+{
+       struct dcp *sdcp = global_sdcp;
+       struct crypto_async_request *arq = &req->base;
+       struct dcp_async_ctx *actx = crypto_tfm_ctx(arq->tfm);
+       int ret;
+
+       if (unlikely(actx->key_len != AES_KEYSIZE_128))
+               return mxs_dcp_block_fallback(req, enc);
+
+       actx->enc = enc;
+       actx->ecb = ecb;
+       actx->chan = DCP_CHAN_CRYPTO;
+
+       mutex_lock(&sdcp->mutex[actx->chan]);
+       ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
+       mutex_unlock(&sdcp->mutex[actx->chan]);
+
+       wake_up_process(sdcp->thread[actx->chan]);
+
+       return -EINPROGRESS;
+}
+
+static int mxs_dcp_aes_ecb_decrypt(struct ablkcipher_request *req)
+{
+       return mxs_dcp_aes_enqueue(req, 0, 1);
+}
+
+static int mxs_dcp_aes_ecb_encrypt(struct ablkcipher_request *req)
+{
+       return mxs_dcp_aes_enqueue(req, 1, 1);
+}
+
+static int mxs_dcp_aes_cbc_decrypt(struct ablkcipher_request *req)
+{
+       return mxs_dcp_aes_enqueue(req, 0, 0);
+}
+
+static int mxs_dcp_aes_cbc_encrypt(struct ablkcipher_request *req)
+{
+       return mxs_dcp_aes_enqueue(req, 1, 0);
+}
+
+static int mxs_dcp_aes_setkey(struct crypto_ablkcipher *tfm, const u8 *key,
+                             unsigned int len)
+{
+       struct dcp_async_ctx *actx = crypto_ablkcipher_ctx(tfm);
+       unsigned int ret;
+
+       /*
+        * AES 128 is supposed by the hardware, store key into temporary
+        * buffer and exit. We must use the temporary buffer here, since
+        * there can still be an operation in progress.
+        */
+       actx->key_len = len;
+       if (len == AES_KEYSIZE_128) {
+               memcpy(actx->key, key, len);
+               return 0;
+       }
+
+       /* Check if the key size is supported by kernel at all. */
+       if (len != AES_KEYSIZE_192 && len != AES_KEYSIZE_256) {
+               tfm->base.crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
+               return -EINVAL;
+       }
+
+       /*
+        * If the requested AES key size is not supported by the hardware,
+        * but is supported by in-kernel software implementation, we use
+        * software fallback.
+        */
+       actx->fallback->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK;
+       actx->fallback->base.crt_flags |=
+               tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK;
+
+       ret = crypto_ablkcipher_setkey(actx->fallback, key, len);
+       if (!ret)
+               return 0;
+
+       tfm->base.crt_flags &= ~CRYPTO_TFM_RES_MASK;
+       tfm->base.crt_flags |=
+               actx->fallback->base.crt_flags & CRYPTO_TFM_RES_MASK;
+
+       return ret;
+}
+
+static int mxs_dcp_aes_fallback_init(struct crypto_tfm *tfm)
+{
+       const char *name = tfm->__crt_alg->cra_name;
+       const uint32_t flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK;
+       struct dcp_async_ctx *actx = crypto_tfm_ctx(tfm);
+       struct crypto_ablkcipher *blk;
+
+       blk = crypto_alloc_ablkcipher(name, 0, flags);
+       if (IS_ERR(blk))
+               return PTR_ERR(blk);
+
+       actx->fallback = blk;
+       tfm->crt_ablkcipher.reqsize = sizeof(struct dcp_async_ctx);
+       return 0;
+}
+
+static void mxs_dcp_aes_fallback_exit(struct crypto_tfm *tfm)
+{
+       struct dcp_async_ctx *actx = crypto_tfm_ctx(tfm);
+
+       crypto_free_ablkcipher(actx->fallback);
+       actx->fallback = NULL;
+}
+
+/*
+ * Hashing (SHA1/SHA256)
+ */
+static int mxs_dcp_run_sha(struct ahash_request *req)
+{
+       struct dcp *sdcp = global_sdcp;
+       int ret;
+
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
+       struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
+       struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
+
+       struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
+       dma_addr_t digest_phys = dma_map_single(sdcp->dev,
+                                               sdcp->coh->sha_digest,
+                                               SHA256_DIGEST_SIZE,
+                                               DMA_FROM_DEVICE);
+
+       dma_addr_t buf_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_in_buf,
+                                            DCP_BUF_SZ, DMA_TO_DEVICE);
+
+       /* Fill in the DMA descriptor. */
+       desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE |
+                   MXS_DCP_CONTROL0_INTERRUPT |
+                   MXS_DCP_CONTROL0_ENABLE_HASH;
+       if (rctx->init)
+               desc->control0 |= MXS_DCP_CONTROL0_HASH_INIT;
+
+       desc->control1 = actx->alg;
+       desc->next_cmd_addr = 0;
+       desc->source = buf_phys;
+       desc->destination = 0;
+       desc->size = actx->fill;
+       desc->payload = 0;
+       desc->status = 0;
+
+       /* Set HASH_TERM bit for last transfer block. */
+       if (rctx->fini) {
+               desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM;
+               desc->payload = digest_phys;
+       }
+
+       ret = mxs_dcp_start_dma(actx);
+
+       dma_unmap_single(sdcp->dev, digest_phys, SHA256_DIGEST_SIZE,
+                        DMA_FROM_DEVICE);
+       dma_unmap_single(sdcp->dev, buf_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
+
+       return ret;
+}
+
+static int dcp_sha_req_to_buf(struct crypto_async_request *arq)
+{
+       struct dcp *sdcp = global_sdcp;
+
+       struct ahash_request *req = ahash_request_cast(arq);
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
+       struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
+       struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
+       struct hash_alg_common *halg = crypto_hash_alg_common(tfm);
+       const int nents = sg_nents(req->src);
+
+       uint8_t *digest = sdcp->coh->sha_digest;
+       uint8_t *in_buf = sdcp->coh->sha_in_buf;
+
+       uint8_t *src_buf;
+
+       struct scatterlist *src;
+
+       unsigned int i, len, clen;
+       int ret;
+
+       int fin = rctx->fini;
+       if (fin)
+               rctx->fini = 0;
+
+       for_each_sg(req->src, src, nents, i) {
+               src_buf = sg_virt(src);
+               len = sg_dma_len(src);
+
+               do {
+                       if (actx->fill + len > DCP_BUF_SZ)
+                               clen = DCP_BUF_SZ - actx->fill;
+                       else
+                               clen = len;
+
+                       memcpy(in_buf + actx->fill, src_buf, clen);
+                       len -= clen;
+                       src_buf += clen;
+                       actx->fill += clen;
+
+                       /*
+                        * If we filled the buffer and still have some
+                        * more data, submit the buffer.
+                        */
+                       if (len && actx->fill == DCP_BUF_SZ) {
+                               ret = mxs_dcp_run_sha(req);
+                               if (ret)
+                                       return ret;
+                               actx->fill = 0;
+                               rctx->init = 0;
+                       }
+               } while (len);
+       }
+
+       if (fin) {
+               rctx->fini = 1;
+
+               /* Submit whatever is left. */
+               ret = mxs_dcp_run_sha(req);
+               if (ret || !req->result)
+                       return ret;
+               actx->fill = 0;
+
+               /* For some reason, the result is flipped. */
+               for (i = 0; i < halg->digestsize; i++)
+                       req->result[i] = digest[halg->digestsize - i - 1];
+       }
+
+       return 0;
+}
+
+static int dcp_chan_thread_sha(void *data)
+{
+       struct dcp *sdcp = global_sdcp;
+       const int chan = DCP_CHAN_HASH_SHA;
+
+       struct crypto_async_request *backlog;
+       struct crypto_async_request *arq;
+
+       struct dcp_sha_req_ctx *rctx;
+
+       struct ahash_request *req;
+       int ret, fini;
+
+       do {
+               __set_current_state(TASK_INTERRUPTIBLE);
+
+               mutex_lock(&sdcp->mutex[chan]);
+               backlog = crypto_get_backlog(&sdcp->queue[chan]);
+               arq = crypto_dequeue_request(&sdcp->queue[chan]);
+               mutex_unlock(&sdcp->mutex[chan]);
+
+               if (backlog)
+                       backlog->complete(backlog, -EINPROGRESS);
+
+               if (arq) {
+                       req = ahash_request_cast(arq);
+                       rctx = ahash_request_ctx(req);
+
+                       ret = dcp_sha_req_to_buf(arq);
+                       fini = rctx->fini;
+                       arq->complete(arq, ret);
+                       if (!fini)
+                               continue;
+               }
+
+               schedule();
+       } while (!kthread_should_stop());
+
+       return 0;
+}
+
+static int dcp_sha_init(struct ahash_request *req)
+{
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
+       struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
+
+       struct hash_alg_common *halg = crypto_hash_alg_common(tfm);
+
+       /*
+        * Start hashing session. The code below only inits the
+        * hashing session context, nothing more.
+        */
+       memset(actx, 0, sizeof(*actx));
+
+       if (strcmp(halg->base.cra_name, "sha1") == 0)
+               actx->alg = MXS_DCP_CONTROL1_HASH_SELECT_SHA1;
+       else
+               actx->alg = MXS_DCP_CONTROL1_HASH_SELECT_SHA256;
+
+       actx->fill = 0;
+       actx->hot = 0;
+       actx->chan = DCP_CHAN_HASH_SHA;
+
+       mutex_init(&actx->mutex);
+
+       return 0;
+}
+
+static int dcp_sha_update_fx(struct ahash_request *req, int fini)
+{
+       struct dcp *sdcp = global_sdcp;
+
+       struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req);
+       struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
+       struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm);
+
+       int ret;
+
+       /*
+        * Ignore requests that have no data in them and are not
+        * the trailing requests in the stream of requests.
+        */
+       if (!req->nbytes && !fini)
+               return 0;
+
+       mutex_lock(&actx->mutex);
+
+       rctx->fini = fini;
+
+       if (!actx->hot) {
+               actx->hot = 1;
+               rctx->init = 1;
+       }
+
+       mutex_lock(&sdcp->mutex[actx->chan]);
+       ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
+       mutex_unlock(&sdcp->mutex[actx->chan]);
+
+       wake_up_process(sdcp->thread[actx->chan]);
+       mutex_unlock(&actx->mutex);
+
+       return -EINPROGRESS;
+}
+
+static int dcp_sha_update(struct ahash_request *req)
+{
+       return dcp_sha_update_fx(req, 0);
+}
+
+static int dcp_sha_final(struct ahash_request *req)
+{
+       ahash_request_set_crypt(req, NULL, req->result, 0);
+       req->nbytes = 0;
+       return dcp_sha_update_fx(req, 1);
+}
+
+static int dcp_sha_finup(struct ahash_request *req)
+{
+       return dcp_sha_update_fx(req, 1);
+}
+
+static int dcp_sha_digest(struct ahash_request *req)
+{
+       int ret;
+
+       ret = dcp_sha_init(req);
+       if (ret)
+               return ret;
+
+       return dcp_sha_finup(req);
+}
+
+static int dcp_sha_cra_init(struct crypto_tfm *tfm)
+{
+       crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
+                                sizeof(struct dcp_sha_req_ctx));
+       return 0;
+}
+
+static void dcp_sha_cra_exit(struct crypto_tfm *tfm)
+{
+}
+
+/* AES 128 ECB and AES 128 CBC */
+static struct crypto_alg dcp_aes_algs[] = {
+       {
+               .cra_name               = "ecb(aes)",
+               .cra_driver_name        = "ecb-aes-dcp",
+               .cra_priority           = 400,
+               .cra_alignmask          = 15,
+               .cra_flags              = CRYPTO_ALG_TYPE_ABLKCIPHER |
+                                         CRYPTO_ALG_ASYNC |
+                                         CRYPTO_ALG_NEED_FALLBACK,
+               .cra_init               = mxs_dcp_aes_fallback_init,
+               .cra_exit               = mxs_dcp_aes_fallback_exit,
+               .cra_blocksize          = AES_BLOCK_SIZE,
+               .cra_ctxsize            = sizeof(struct dcp_async_ctx),
+               .cra_type               = &crypto_ablkcipher_type,
+               .cra_module             = THIS_MODULE,
+               .cra_u  = {
+                       .ablkcipher = {
+                               .min_keysize    = AES_MIN_KEY_SIZE,
+                               .max_keysize    = AES_MAX_KEY_SIZE,
+                               .setkey         = mxs_dcp_aes_setkey,
+                               .encrypt        = mxs_dcp_aes_ecb_encrypt,
+                               .decrypt        = mxs_dcp_aes_ecb_decrypt
+                       },
+               },
+       }, {
+               .cra_name               = "cbc(aes)",
+               .cra_driver_name        = "cbc-aes-dcp",
+               .cra_priority           = 400,
+               .cra_alignmask          = 15,
+               .cra_flags              = CRYPTO_ALG_TYPE_ABLKCIPHER |
+                                         CRYPTO_ALG_ASYNC |
+                                         CRYPTO_ALG_NEED_FALLBACK,
+               .cra_init               = mxs_dcp_aes_fallback_init,
+               .cra_exit               = mxs_dcp_aes_fallback_exit,
+               .cra_blocksize          = AES_BLOCK_SIZE,
+               .cra_ctxsize            = sizeof(struct dcp_async_ctx),
+               .cra_type               = &crypto_ablkcipher_type,
+               .cra_module             = THIS_MODULE,
+               .cra_u = {
+                       .ablkcipher = {
+                               .min_keysize    = AES_MIN_KEY_SIZE,
+                               .max_keysize    = AES_MAX_KEY_SIZE,
+                               .setkey         = mxs_dcp_aes_setkey,
+                               .encrypt        = mxs_dcp_aes_cbc_encrypt,
+                               .decrypt        = mxs_dcp_aes_cbc_decrypt,
+                               .ivsize         = AES_BLOCK_SIZE,
+                       },
+               },
+       },
+};
+
+/* SHA1 */
+static struct ahash_alg dcp_sha1_alg = {
+       .init   = dcp_sha_init,
+       .update = dcp_sha_update,
+       .final  = dcp_sha_final,
+       .finup  = dcp_sha_finup,
+       .digest = dcp_sha_digest,
+       .halg   = {
+               .digestsize     = SHA1_DIGEST_SIZE,
+               .base           = {
+                       .cra_name               = "sha1",
+                       .cra_driver_name        = "sha1-dcp",
+                       .cra_priority           = 400,
+                       .cra_alignmask          = 63,
+                       .cra_flags              = CRYPTO_ALG_ASYNC,
+                       .cra_blocksize          = SHA1_BLOCK_SIZE,
+                       .cra_ctxsize            = sizeof(struct dcp_async_ctx),
+                       .cra_module             = THIS_MODULE,
+                       .cra_init               = dcp_sha_cra_init,
+                       .cra_exit               = dcp_sha_cra_exit,
+               },
+       },
+};
+
+/* SHA256 */
+static struct ahash_alg dcp_sha256_alg = {
+       .init   = dcp_sha_init,
+       .update = dcp_sha_update,
+       .final  = dcp_sha_final,
+       .finup  = dcp_sha_finup,
+       .digest = dcp_sha_digest,
+       .halg   = {
+               .digestsize     = SHA256_DIGEST_SIZE,
+               .base           = {
+                       .cra_name               = "sha256",
+                       .cra_driver_name        = "sha256-dcp",
+                       .cra_priority           = 400,
+                       .cra_alignmask          = 63,
+                       .cra_flags              = CRYPTO_ALG_ASYNC,
+                       .cra_blocksize          = SHA256_BLOCK_SIZE,
+                       .cra_ctxsize            = sizeof(struct dcp_async_ctx),
+                       .cra_module             = THIS_MODULE,
+                       .cra_init               = dcp_sha_cra_init,
+                       .cra_exit               = dcp_sha_cra_exit,
+               },
+       },
+};
+
+static irqreturn_t mxs_dcp_irq(int irq, void *context)
+{
+       struct dcp *sdcp = context;
+       uint32_t stat;
+       int i;
+
+       stat = readl(sdcp->base + MXS_DCP_STAT);
+       stat &= MXS_DCP_STAT_IRQ_MASK;
+       if (!stat)
+               return IRQ_NONE;
+
+       /* Clear the interrupts. */
+       writel(stat, sdcp->base + MXS_DCP_STAT_CLR);
+
+       /* Complete the DMA requests that finished. */
+       for (i = 0; i < DCP_MAX_CHANS; i++)
+               if (stat & (1 << i))
+                       complete(&sdcp->completion[i]);
+
+       return IRQ_HANDLED;
+}
+
+static int mxs_dcp_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct dcp *sdcp = NULL;
+       int i, ret;
+
+       struct resource *iores;
+       int dcp_vmi_irq, dcp_irq;
+
+       mutex_lock(&global_mutex);
+       if (global_sdcp) {
+               dev_err(dev, "Only one DCP instance allowed!\n");
+               ret = -ENODEV;
+               goto err_mutex;
+       }
+
+       iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       dcp_vmi_irq = platform_get_irq(pdev, 0);
+       dcp_irq = platform_get_irq(pdev, 1);
+       if (dcp_vmi_irq < 0 || dcp_irq < 0) {
+               ret = -EINVAL;
+               goto err_mutex;
+       }
+
+       sdcp = devm_kzalloc(dev, sizeof(*sdcp), GFP_KERNEL);
+       if (!sdcp) {
+               ret = -ENOMEM;
+               goto err_mutex;
+       }
+
+       sdcp->dev = dev;
+       sdcp->base = devm_ioremap_resource(dev, iores);
+       if (IS_ERR(sdcp->base)) {
+               ret = PTR_ERR(sdcp->base);
+               goto err_mutex;
+       }
+
+       ret = devm_request_irq(dev, dcp_vmi_irq, mxs_dcp_irq, 0,
+                              "dcp-vmi-irq", sdcp);
+       if (ret) {
+               dev_err(dev, "Failed to claim DCP VMI IRQ!\n");
+               goto err_mutex;
+       }
+
+       ret = devm_request_irq(dev, dcp_irq, mxs_dcp_irq, 0,
+                              "dcp-irq", sdcp);
+       if (ret) {
+               dev_err(dev, "Failed to claim DCP IRQ!\n");
+               goto err_mutex;
+       }
+
+       /* Allocate coherent helper block. */
+       sdcp->coh = kzalloc(sizeof(struct dcp_coherent_block), GFP_KERNEL);
+       if (!sdcp->coh) {
+               dev_err(dev, "Error allocating coherent block\n");
+               ret = -ENOMEM;
+               goto err_mutex;
+       }
+
+       /* Restart the DCP block. */
+       stmp_reset_block(sdcp->base);
+
+       /* Initialize control register. */
+       writel(MXS_DCP_CTRL_GATHER_RESIDUAL_WRITES |
+              MXS_DCP_CTRL_ENABLE_CONTEXT_CACHING | 0xf,
+              sdcp->base + MXS_DCP_CTRL);
+
+       /* Enable all DCP DMA channels. */
+       writel(MXS_DCP_CHANNELCTRL_ENABLE_CHANNEL_MASK,
+              sdcp->base + MXS_DCP_CHANNELCTRL);
+
+       /*
+        * We do not enable context switching. Give the context buffer a
+        * pointer to an illegal address so if context switching is
+        * inadvertantly enabled, the DCP will return an error instead of
+        * trashing good memory. The DCP DMA cannot access ROM, so any ROM
+        * address will do.
+        */
+       writel(0xffff0000, sdcp->base + MXS_DCP_CONTEXT);
+       for (i = 0; i < DCP_MAX_CHANS; i++)
+               writel(0xffffffff, sdcp->base + MXS_DCP_CH_N_STAT_CLR(i));
+       writel(0xffffffff, sdcp->base + MXS_DCP_STAT_CLR);
+
+       global_sdcp = sdcp;
+
+       platform_set_drvdata(pdev, sdcp);
+
+       for (i = 0; i < DCP_MAX_CHANS; i++) {
+               mutex_init(&sdcp->mutex[i]);
+               init_completion(&sdcp->completion[i]);
+               crypto_init_queue(&sdcp->queue[i], 50);
+       }
+
+       /* Create the SHA and AES handler threads. */
+       sdcp->thread[DCP_CHAN_HASH_SHA] = kthread_run(dcp_chan_thread_sha,
+                                                     NULL, "mxs_dcp_chan/sha");
+       if (IS_ERR(sdcp->thread[DCP_CHAN_HASH_SHA])) {
+               dev_err(dev, "Error starting SHA thread!\n");
+               ret = PTR_ERR(sdcp->thread[DCP_CHAN_HASH_SHA]);
+               goto err_free_coherent;
+       }
+
+       sdcp->thread[DCP_CHAN_CRYPTO] = kthread_run(dcp_chan_thread_aes,
+                                                   NULL, "mxs_dcp_chan/aes");
+       if (IS_ERR(sdcp->thread[DCP_CHAN_CRYPTO])) {
+               dev_err(dev, "Error starting SHA thread!\n");
+               ret = PTR_ERR(sdcp->thread[DCP_CHAN_CRYPTO]);
+               goto err_destroy_sha_thread;
+       }
+
+       /* Register the various crypto algorithms. */
+       sdcp->caps = readl(sdcp->base + MXS_DCP_CAPABILITY1);
+
+       if (sdcp->caps & MXS_DCP_CAPABILITY1_AES128) {
+               ret = crypto_register_algs(dcp_aes_algs,
+                                          ARRAY_SIZE(dcp_aes_algs));
+               if (ret) {
+                       /* Failed to register algorithm. */
+                       dev_err(dev, "Failed to register AES crypto!\n");
+                       goto err_destroy_aes_thread;
+               }
+       }
+
+       if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA1) {
+               ret = crypto_register_ahash(&dcp_sha1_alg);
+               if (ret) {
+                       dev_err(dev, "Failed to register %s hash!\n",
+                               dcp_sha1_alg.halg.base.cra_name);
+                       goto err_unregister_aes;
+               }
+       }
+
+       if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA256) {
+               ret = crypto_register_ahash(&dcp_sha256_alg);
+               if (ret) {
+                       dev_err(dev, "Failed to register %s hash!\n",
+                               dcp_sha256_alg.halg.base.cra_name);
+                       goto err_unregister_sha1;
+               }
+       }
+
+       return 0;
+
+err_unregister_sha1:
+       if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA1)
+               crypto_unregister_ahash(&dcp_sha1_alg);
+
+err_unregister_aes:
+       if (sdcp->caps & MXS_DCP_CAPABILITY1_AES128)
+               crypto_unregister_algs(dcp_aes_algs, ARRAY_SIZE(dcp_aes_algs));
+
+err_destroy_aes_thread:
+       kthread_stop(sdcp->thread[DCP_CHAN_CRYPTO]);
+
+err_destroy_sha_thread:
+       kthread_stop(sdcp->thread[DCP_CHAN_HASH_SHA]);
+
+err_free_coherent:
+       kfree(sdcp->coh);
+err_mutex:
+       mutex_unlock(&global_mutex);
+       return ret;
+}
+
+static int mxs_dcp_remove(struct platform_device *pdev)
+{
+       struct dcp *sdcp = platform_get_drvdata(pdev);
+
+       kfree(sdcp->coh);
+
+       if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA256)
+               crypto_unregister_ahash(&dcp_sha256_alg);
+
+       if (sdcp->caps & MXS_DCP_CAPABILITY1_SHA1)
+               crypto_unregister_ahash(&dcp_sha1_alg);
+
+       if (sdcp->caps & MXS_DCP_CAPABILITY1_AES128)
+               crypto_unregister_algs(dcp_aes_algs, ARRAY_SIZE(dcp_aes_algs));
+
+       kthread_stop(sdcp->thread[DCP_CHAN_HASH_SHA]);
+       kthread_stop(sdcp->thread[DCP_CHAN_CRYPTO]);
+
+       platform_set_drvdata(pdev, NULL);
+
+       mutex_lock(&global_mutex);
+       global_sdcp = NULL;
+       mutex_unlock(&global_mutex);
+
+       return 0;
+}
+
+static const struct of_device_id mxs_dcp_dt_ids[] = {
+       { .compatible = "fsl,imx23-dcp", .data = NULL, },
+       { .compatible = "fsl,imx28-dcp", .data = NULL, },
+       { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, mxs_dcp_dt_ids);
+
+static struct platform_driver mxs_dcp_driver = {
+       .probe  = mxs_dcp_probe,
+       .remove = mxs_dcp_remove,
+       .driver = {
+               .name           = "mxs-dcp",
+               .owner          = THIS_MODULE,
+               .of_match_table = mxs_dcp_dt_ids,
+       },
+};
+
+module_platform_driver(mxs_dcp_driver);
+
+MODULE_AUTHOR("Marek Vasut <marex@denx.de>");
+MODULE_DESCRIPTION("Freescale MXS DCP Driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:mxs-dcp");
index a9ccbf14096e3c03a9c193042baddc6d5b0e4925..dde41f1df6080a0e067a35d5dad2302c0ba6eb98 100644 (file)
@@ -784,6 +784,7 @@ static int omap_aes_ctr_decrypt(struct ablkcipher_request *req)
 static int omap_aes_cra_init(struct crypto_tfm *tfm)
 {
        struct omap_aes_dev *dd = NULL;
+       int err;
 
        /* Find AES device, currently picks the first device */
        spin_lock_bh(&list_lock);
@@ -792,7 +793,13 @@ static int omap_aes_cra_init(struct crypto_tfm *tfm)
        }
        spin_unlock_bh(&list_lock);
 
-       pm_runtime_get_sync(dd->dev);
+       err = pm_runtime_get_sync(dd->dev);
+       if (err < 0) {
+               dev_err(dd->dev, "%s: failed to get_sync(%d)\n",
+                       __func__, err);
+               return err;
+       }
+
        tfm->crt_ablkcipher.reqsize = sizeof(struct omap_aes_reqctx);
 
        return 0;
@@ -1182,7 +1189,12 @@ static int omap_aes_probe(struct platform_device *pdev)
        dd->phys_base = res.start;
 
        pm_runtime_enable(dev);
-       pm_runtime_get_sync(dev);
+       err = pm_runtime_get_sync(dev);
+       if (err < 0) {
+               dev_err(dev, "%s: failed to get_sync(%d)\n",
+                       __func__, err);
+               goto err_res;
+       }
 
        omap_aes_dma_stop(dd);
 
index e45aaaf0db3069d5c99cef88664dfdc62a87d434..a727a6a5965370e8f6f09507f8e0747d939ddd1d 100644 (file)
@@ -789,10 +789,13 @@ static int omap_sham_update_cpu(struct omap_sham_dev *dd)
        dev_dbg(dd->dev, "cpu: bufcnt: %u, digcnt: %d, final: %d\n",
                ctx->bufcnt, ctx->digcnt, final);
 
-       bufcnt = ctx->bufcnt;
-       ctx->bufcnt = 0;
+       if (final || (ctx->bufcnt == ctx->buflen && ctx->total)) {
+               bufcnt = ctx->bufcnt;
+               ctx->bufcnt = 0;
+               return omap_sham_xmit_cpu(dd, ctx->buffer, bufcnt, final);
+       }
 
-       return omap_sham_xmit_cpu(dd, ctx->buffer, bufcnt, final);
+       return 0;
 }
 
 static int omap_sham_update_dma_stop(struct omap_sham_dev *dd)
@@ -1103,6 +1106,9 @@ static int omap_sham_update(struct ahash_request *req)
                return 0;
        }
 
+       if (dd->polling_mode)
+               ctx->flags |= BIT(FLAGS_CPU);
+
        return omap_sham_enqueue(req, OP_UPDATE);
 }
 
@@ -1970,7 +1976,8 @@ err_algs:
                        crypto_unregister_ahash(
                                        &dd->pdata->algs_info[i].algs_list[j]);
        pm_runtime_disable(dev);
-       dma_release_channel(dd->dma_lch);
+       if (dd->dma_lch)
+               dma_release_channel(dd->dma_lch);
 data_err:
        dev_err(dev, "initialization failed.\n");
 
@@ -1994,7 +2001,9 @@ static int omap_sham_remove(struct platform_device *pdev)
                                        &dd->pdata->algs_info[i].algs_list[j]);
        tasklet_kill(&dd->done_task);
        pm_runtime_disable(&pdev->dev);
-       dma_release_channel(dd->dma_lch);
+
+       if (dd->dma_lch)
+               dma_release_channel(dd->dma_lch);
 
        return 0;
 }
index b44f4ddc565c3bb7cd32b84c08a0b286543681e5..5967667e1a8f19c763445183bc2c4dc6cdde71a7 100644 (file)
@@ -338,20 +338,29 @@ DEF_TALITOS_DONE(ch1_3, TALITOS_ISR_CH_1_3_DONE)
 static u32 current_desc_hdr(struct device *dev, int ch)
 {
        struct talitos_private *priv = dev_get_drvdata(dev);
-       int tail = priv->chan[ch].tail;
+       int tail, iter;
        dma_addr_t cur_desc;
 
-       cur_desc = in_be32(priv->chan[ch].reg + TALITOS_CDPR_LO);
+       cur_desc = ((u64)in_be32(priv->chan[ch].reg + TALITOS_CDPR)) << 32;
+       cur_desc |= in_be32(priv->chan[ch].reg + TALITOS_CDPR_LO);
 
-       while (priv->chan[ch].fifo[tail].dma_desc != cur_desc) {
-               tail = (tail + 1) & (priv->fifo_len - 1);
-               if (tail == priv->chan[ch].tail) {
+       if (!cur_desc) {
+               dev_err(dev, "CDPR is NULL, giving up search for offending descriptor\n");
+               return 0;
+       }
+
+       tail = priv->chan[ch].tail;
+
+       iter = tail;
+       while (priv->chan[ch].fifo[iter].dma_desc != cur_desc) {
+               iter = (iter + 1) & (priv->fifo_len - 1);
+               if (iter == tail) {
                        dev_err(dev, "couldn't locate current descriptor\n");
                        return 0;
                }
        }
 
-       return priv->chan[ch].fifo[tail].desc->hdr;
+       return priv->chan[ch].fifo[iter].desc->hdr;
 }
 
 /*
@@ -2486,8 +2495,6 @@ static int talitos_remove(struct platform_device *ofdev)
 
        iounmap(priv->reg);
 
-       dev_set_drvdata(dev, NULL);
-
        kfree(priv);
 
        return 0;
index bbbfe6853b18b96b6e6fbcba1707b9d89553a4de..e07b0c68c71523db4ce74c24897a88b21fbc7911 100644 (file)
@@ -30,9 +30,9 @@
 extern unsigned int exynos_result_of_asv;
 #endif
 
-#include <mach/regs-clock.h>
+#include <mach/map.h>
 
-#include <plat/map-s5p.h>
+#include "exynos4_bus.h"
 
 #define MAX_SAFEVOLT   1200000 /* 1.2V */
 
diff --git a/drivers/devfreq/exynos/exynos4_bus.h b/drivers/devfreq/exynos/exynos4_bus.h
new file mode 100644 (file)
index 0000000..94c73c1
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com/
+ *
+ * EXYNOS4 BUS header
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __DEVFREQ_EXYNOS4_BUS_H
+#define __DEVFREQ_EXYNOS4_BUS_H __FILE__
+
+#include <mach/map.h>
+
+#define EXYNOS4_CLKDIV_LEFTBUS                 (S5P_VA_CMU + 0x04500)
+#define EXYNOS4_CLKDIV_STAT_LEFTBUS            (S5P_VA_CMU + 0x04600)
+
+#define EXYNOS4_CLKDIV_RIGHTBUS                        (S5P_VA_CMU + 0x08500)
+#define EXYNOS4_CLKDIV_STAT_RIGHTBUS           (S5P_VA_CMU + 0x08600)
+
+#define EXYNOS4_CLKDIV_TOP                     (S5P_VA_CMU + 0x0C510)
+#define EXYNOS4_CLKDIV_CAM                     (S5P_VA_CMU + 0x0C520)
+#define EXYNOS4_CLKDIV_MFC                     (S5P_VA_CMU + 0x0C528)
+
+#define EXYNOS4_CLKDIV_STAT_TOP                        (S5P_VA_CMU + 0x0C610)
+#define EXYNOS4_CLKDIV_STAT_MFC                        (S5P_VA_CMU + 0x0C628)
+
+#define EXYNOS4210_CLKGATE_IP_IMAGE            (S5P_VA_CMU + 0x0C930)
+#define EXYNOS4212_CLKGATE_IP_IMAGE            (S5P_VA_CMU + 0x04930)
+
+#define EXYNOS4_CLKDIV_DMC0                    (S5P_VA_CMU + 0x10500)
+#define EXYNOS4_CLKDIV_DMC1                    (S5P_VA_CMU + 0x10504)
+#define EXYNOS4_CLKDIV_STAT_DMC0               (S5P_VA_CMU + 0x10600)
+#define EXYNOS4_CLKDIV_STAT_DMC1               (S5P_VA_CMU + 0x10604)
+
+#define EXYNOS4_DMC_PAUSE_CTRL                 (S5P_VA_CMU + 0x11094)
+#define EXYNOS4_DMC_PAUSE_ENABLE               (1 << 0)
+
+#define EXYNOS4_CLKDIV_DMC0_ACP_SHIFT          (0)
+#define EXYNOS4_CLKDIV_DMC0_ACP_MASK           (0x7 << EXYNOS4_CLKDIV_DMC0_ACP_SHIFT)
+#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT      (4)
+#define EXYNOS4_CLKDIV_DMC0_ACPPCLK_MASK       (0x7 << EXYNOS4_CLKDIV_DMC0_ACPPCLK_SHIFT)
+#define EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT         (8)
+#define EXYNOS4_CLKDIV_DMC0_DPHY_MASK          (0x7 << EXYNOS4_CLKDIV_DMC0_DPHY_SHIFT)
+#define EXYNOS4_CLKDIV_DMC0_DMC_SHIFT          (12)
+#define EXYNOS4_CLKDIV_DMC0_DMC_MASK           (0x7 << EXYNOS4_CLKDIV_DMC0_DMC_SHIFT)
+#define EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT         (16)
+#define EXYNOS4_CLKDIV_DMC0_DMCD_MASK          (0x7 << EXYNOS4_CLKDIV_DMC0_DMCD_SHIFT)
+#define EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT         (20)
+#define EXYNOS4_CLKDIV_DMC0_DMCP_MASK          (0x7 << EXYNOS4_CLKDIV_DMC0_DMCP_SHIFT)
+#define EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT                (24)
+#define EXYNOS4_CLKDIV_DMC0_COPY2_MASK         (0x7 << EXYNOS4_CLKDIV_DMC0_COPY2_SHIFT)
+#define EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT       (28)
+#define EXYNOS4_CLKDIV_DMC0_CORETI_MASK                (0x7 << EXYNOS4_CLKDIV_DMC0_CORETI_SHIFT)
+
+#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT      (0)
+#define EXYNOS4_CLKDIV_DMC1_G2D_ACP_MASK       (0xf << EXYNOS4_CLKDIV_DMC1_G2D_ACP_SHIFT)
+#define EXYNOS4_CLKDIV_DMC1_C2C_SHIFT          (4)
+#define EXYNOS4_CLKDIV_DMC1_C2C_MASK           (0x7 << EXYNOS4_CLKDIV_DMC1_C2C_SHIFT)
+#define EXYNOS4_CLKDIV_DMC1_PWI_SHIFT          (8)
+#define EXYNOS4_CLKDIV_DMC1_PWI_MASK           (0xf << EXYNOS4_CLKDIV_DMC1_PWI_SHIFT)
+#define EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT      (12)
+#define EXYNOS4_CLKDIV_DMC1_C2CACLK_MASK       (0x7 << EXYNOS4_CLKDIV_DMC1_C2CACLK_SHIFT)
+#define EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT                (16)
+#define EXYNOS4_CLKDIV_DMC1_DVSEM_MASK         (0x7f << EXYNOS4_CLKDIV_DMC1_DVSEM_SHIFT)
+#define EXYNOS4_CLKDIV_DMC1_DPM_SHIFT          (24)
+#define EXYNOS4_CLKDIV_DMC1_DPM_MASK           (0x7f << EXYNOS4_CLKDIV_DMC1_DPM_SHIFT)
+
+#define EXYNOS4_CLKDIV_MFC_SHIFT               (0)
+#define EXYNOS4_CLKDIV_MFC_MASK                        (0x7 << EXYNOS4_CLKDIV_MFC_SHIFT)
+
+#define EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT       (0)
+#define EXYNOS4_CLKDIV_TOP_ACLK200_MASK                (0x7 << EXYNOS4_CLKDIV_TOP_ACLK200_SHIFT)
+#define EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT       (4)
+#define EXYNOS4_CLKDIV_TOP_ACLK100_MASK                (0xF << EXYNOS4_CLKDIV_TOP_ACLK100_SHIFT)
+#define EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT       (8)
+#define EXYNOS4_CLKDIV_TOP_ACLK160_MASK                (0x7 << EXYNOS4_CLKDIV_TOP_ACLK160_SHIFT)
+#define EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT       (12)
+#define EXYNOS4_CLKDIV_TOP_ACLK133_MASK                (0x7 << EXYNOS4_CLKDIV_TOP_ACLK133_SHIFT)
+#define EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT       (16)
+#define EXYNOS4_CLKDIV_TOP_ONENAND_MASK                (0x7 << EXYNOS4_CLKDIV_TOP_ONENAND_SHIFT)
+#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT   (20)
+#define EXYNOS4_CLKDIV_TOP_ACLK266_GPS_MASK    (0x7 << EXYNOS4_CLKDIV_TOP_ACLK266_GPS_SHIFT)
+#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT        (24)
+#define EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_MASK (0x7 << EXYNOS4_CLKDIV_TOP_ACLK400_MCUISP_SHIFT)
+
+#define EXYNOS4_CLKDIV_BUS_GDLR_SHIFT          (0)
+#define EXYNOS4_CLKDIV_BUS_GDLR_MASK           (0x7 << EXYNOS4_CLKDIV_BUS_GDLR_SHIFT)
+#define EXYNOS4_CLKDIV_BUS_GPLR_SHIFT          (4)
+#define EXYNOS4_CLKDIV_BUS_GPLR_MASK           (0x7 << EXYNOS4_CLKDIV_BUS_GPLR_SHIFT)
+
+#define EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT         (0)
+#define EXYNOS4_CLKDIV_CAM_FIMC0_MASK          (0xf << EXYNOS4_CLKDIV_CAM_FIMC0_SHIFT)
+#define EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT         (4)
+#define EXYNOS4_CLKDIV_CAM_FIMC1_MASK          (0xf << EXYNOS4_CLKDIV_CAM_FIMC1_SHIFT)
+#define EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT         (8)
+#define EXYNOS4_CLKDIV_CAM_FIMC2_MASK          (0xf << EXYNOS4_CLKDIV_CAM_FIMC2_SHIFT)
+#define EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT         (12)
+#define EXYNOS4_CLKDIV_CAM_FIMC3_MASK          (0xf << EXYNOS4_CLKDIV_CAM_FIMC3_SHIFT)
+
+#define EXYNOS4_CLKDIV_CAM1                    (S5P_VA_CMU + 0x0C568)
+
+#define EXYNOS4_CLKDIV_STAT_CAM1               (S5P_VA_CMU + 0x0C668)
+
+#define EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT         (0)
+#define EXYNOS4_CLKDIV_CAM1_JPEG_MASK          (0xf << EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT)
+
+#endif /* __DEVFREQ_EXYNOS4_BUS_H */
index c823daaf90430bb501ff9bc168e88adbcecf87ef..c10eb89a3c1bdd388da699f3ac4f8e00c92cc63b 100644 (file)
@@ -292,9 +292,11 @@ config MMP_TDMA
        bool "MMP Two-Channel DMA support"
        depends on ARCH_MMP
        select DMA_ENGINE
+       select MMP_SRAM
        help
          Support the MMP Two-Channel DMA engine.
          This engine used for MMP Audio DMA and pxa910 SQU.
+         It needs sram driver under mach-mmp.
 
          Say Y here if you enabled MMP ADMA, otherwise say N.
 
index 92caad629d996cec8415b5d96dfc10605b127195..ed610b4975186b8e389de7360d4d3c8e6f5785e3 100644 (file)
@@ -535,6 +535,34 @@ struct dma_chan *dma_get_slave_channel(struct dma_chan *chan)
 }
 EXPORT_SYMBOL_GPL(dma_get_slave_channel);
 
+struct dma_chan *dma_get_any_slave_channel(struct dma_device *device)
+{
+       dma_cap_mask_t mask;
+       struct dma_chan *chan;
+       int err;
+
+       dma_cap_zero(mask);
+       dma_cap_set(DMA_SLAVE, mask);
+
+       /* lock against __dma_request_channel */
+       mutex_lock(&dma_list_mutex);
+
+       chan = private_candidate(&mask, device, NULL, NULL);
+       if (chan) {
+               err = dma_chan_get(chan);
+               if (err) {
+                       pr_debug("%s: failed to get %s: (%d)\n",
+                               __func__, dma_chan_name(chan), err);
+                       chan = NULL;
+               }
+       }
+
+       mutex_unlock(&dma_list_mutex);
+
+       return chan;
+}
+EXPORT_SYMBOL_GPL(dma_get_any_slave_channel);
+
 /**
  * __dma_request_channel - try to allocate an exclusive channel
  * @mask: capabilities that the channel must satisfy
index 8869500ab92b84a4b93f4111f8936e6722d4911c..c6a01ea8bc591c289777d2ab837ef48887cf64d1 100644 (file)
@@ -893,33 +893,17 @@ static struct dma_chan *mmp_pdma_dma_xlate(struct of_phandle_args *dma_spec,
                                           struct of_dma *ofdma)
 {
        struct mmp_pdma_device *d = ofdma->of_dma_data;
-       struct dma_chan *chan, *candidate;
+       struct dma_chan *chan;
+       struct mmp_pdma_chan *c;
 
-retry:
-       candidate = NULL;
-
-       /* walk the list of channels registered with the current instance and
-        * find one that is currently unused */
-       list_for_each_entry(chan, &d->device.channels, device_node)
-               if (chan->client_count == 0) {
-                       candidate = chan;
-                       break;
-               }
-
-       if (!candidate)
+       chan = dma_get_any_slave_channel(&d->device);
+       if (!chan)
                return NULL;
 
-       /* dma_get_slave_channel will return NULL if we lost a race between
-        * the lookup and the reservation */
-       chan = dma_get_slave_channel(candidate);
-
-       if (chan) {
-               struct mmp_pdma_chan *c = to_mmp_pdma_chan(chan);
-               c->drcmr = dma_spec->args[0];
-               return chan;
-       }
+       c = to_mmp_pdma_chan(chan);
+       c->drcmr = dma_spec->args[0];
 
-       goto retry;
+       return chan;
 }
 
 static int mmp_pdma_probe(struct platform_device *op)
index b8c031b7de4e045d22cfa0e7d495380bc94ed75f..00a2de957b234da060fe5e03592b171f50fa53d1 100644 (file)
@@ -2409,6 +2409,7 @@ static void d40_set_prio_realtime(struct d40_chan *d40c)
 #define D40_DT_FLAGS_DIR(flags)        ((flags >> 1) & 0x1)
 #define D40_DT_FLAGS_BIG_ENDIAN(flags) ((flags >> 2) & 0x1)
 #define D40_DT_FLAGS_FIXED_CHAN(flags) ((flags >> 3) & 0x1)
+#define D40_DT_FLAGS_HIGH_PRIO(flags)  ((flags >> 4) & 0x1)
 
 static struct dma_chan *d40_xlate(struct of_phandle_args *dma_spec,
                                  struct of_dma *ofdma)
@@ -2446,6 +2447,9 @@ static struct dma_chan *d40_xlate(struct of_phandle_args *dma_spec,
                cfg.use_fixed_channel = true;
        }
 
+       if (D40_DT_FLAGS_HIGH_PRIO(flags))
+               cfg.high_priority = true;
+
        return dma_request_channel(cap, stedma40_filter, &cfg);
 }
 
index 73654e33f13b98c66ebce532646056ecdce79c61..d11bb3620f2783115b7a91058a297dfbf657033d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * DMA driver for Nvidia's Tegra20 APB DMA controller.
  *
- * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2012-2013, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/of_dma.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
+#include <linux/reset.h>
 #include <linux/slab.h>
-#include <linux/clk/tegra.h>
 
 #include "dmaengine.h"
 
@@ -199,6 +200,7 @@ struct tegra_dma_channel {
        void                    *callback_param;
 
        /* Channel-slave specific configuration */
+       unsigned int slave_id;
        struct dma_slave_config dma_sconfig;
        struct tegra_dma_channel_regs   channel_reg;
 };
@@ -208,6 +210,7 @@ struct tegra_dma {
        struct dma_device               dma_dev;
        struct device                   *dev;
        struct clk                      *dma_clk;
+       struct reset_control            *rst;
        spinlock_t                      global_lock;
        void __iomem                    *base_addr;
        const struct tegra_dma_chip_data *chip_data;
@@ -339,6 +342,8 @@ static int tegra_dma_slave_config(struct dma_chan *dc,
        }
 
        memcpy(&tdc->dma_sconfig, sconfig, sizeof(*sconfig));
+       if (!tdc->slave_id)
+               tdc->slave_id = sconfig->slave_id;
        tdc->config_init = true;
        return 0;
 }
@@ -941,7 +946,7 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg(
        ahb_seq |= TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32;
 
        csr |= TEGRA_APBDMA_CSR_ONCE | TEGRA_APBDMA_CSR_FLOW;
-       csr |= tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
+       csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
        if (flags & DMA_PREP_INTERRUPT)
                csr |= TEGRA_APBDMA_CSR_IE_EOC;
 
@@ -1085,7 +1090,7 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
        csr |= TEGRA_APBDMA_CSR_FLOW;
        if (flags & DMA_PREP_INTERRUPT)
                csr |= TEGRA_APBDMA_CSR_IE_EOC;
-       csr |= tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
+       csr |= tdc->slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
 
        apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;
 
@@ -1205,6 +1210,25 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc)
                kfree(sg_req);
        }
        clk_disable_unprepare(tdma->dma_clk);
+
+       tdc->slave_id = 0;
+}
+
+static struct dma_chan *tegra_dma_of_xlate(struct of_phandle_args *dma_spec,
+                                          struct of_dma *ofdma)
+{
+       struct tegra_dma *tdma = ofdma->of_dma_data;
+       struct dma_chan *chan;
+       struct tegra_dma_channel *tdc;
+
+       chan = dma_get_any_slave_channel(&tdma->dma_dev);
+       if (!chan)
+               return NULL;
+
+       tdc = to_tegra_dma_chan(chan);
+       tdc->slave_id = dma_spec->args[0];
+
+       return chan;
 }
 
 /* Tegra20 specific DMA controller information */
@@ -1282,6 +1306,12 @@ static int tegra_dma_probe(struct platform_device *pdev)
                return PTR_ERR(tdma->dma_clk);
        }
 
+       tdma->rst = devm_reset_control_get(&pdev->dev, "dma");
+       if (IS_ERR(tdma->rst)) {
+               dev_err(&pdev->dev, "Error: Missing reset\n");
+               return PTR_ERR(tdma->rst);
+       }
+
        spin_lock_init(&tdma->global_lock);
 
        pm_runtime_enable(&pdev->dev);
@@ -1302,9 +1332,9 @@ static int tegra_dma_probe(struct platform_device *pdev)
        }
 
        /* Reset DMA controller */
-       tegra_periph_reset_assert(tdma->dma_clk);
+       reset_control_assert(tdma->rst);
        udelay(2);
-       tegra_periph_reset_deassert(tdma->dma_clk);
+       reset_control_deassert(tdma->rst);
 
        /* Enable global DMA registers */
        tdma_write(tdma, TEGRA_APBDMA_GENERAL, TEGRA_APBDMA_GENERAL_ENABLE);
@@ -1376,10 +1406,20 @@ static int tegra_dma_probe(struct platform_device *pdev)
                goto err_irq;
        }
 
+       ret = of_dma_controller_register(pdev->dev.of_node,
+                                        tegra_dma_of_xlate, tdma);
+       if (ret < 0) {
+               dev_err(&pdev->dev,
+                       "Tegra20 APB DMA OF registration failed %d\n", ret);
+               goto err_unregister_dma_dev;
+       }
+
        dev_info(&pdev->dev, "Tegra20 APB DMA driver register %d channels\n",
                        cdata->nr_channels);
        return 0;
 
+err_unregister_dma_dev:
+       dma_async_device_unregister(&tdma->dma_dev);
 err_irq:
        while (--i >= 0) {
                struct tegra_dma_channel *tdc = &tdma->channels[i];
index 50cc557abe414799bfc0eca354852d6e6027793c..697338772b64802fae727a8b6788756e28d15939 100644 (file)
@@ -115,6 +115,13 @@ config GPIO_CLPS711X
        help
          Say yes here to support GPIO on CLPS711X SoCs.
 
+config GPIO_DAVINCI
+       bool "TI Davinci/Keystone GPIO support"
+       default y if ARCH_DAVINCI
+       depends on ARM && (ARCH_DAVINCI || ARCH_KEYSTONE)
+       help
+         Say yes here to enable GPIO support for TI Davinci/Keystone SoCs.
+
 config GPIO_GENERIC_PLATFORM
        tristate "Generic memory-mapped GPIO controller support (MMIO platform device)"
        select GPIO_GENERIC
index 0248471402e486d7cb3afc00724f27cc3bcea638..5d50179ece160e6576b79555cd3dde7cf4996148 100644 (file)
@@ -22,7 +22,7 @@ obj-$(CONFIG_GPIO_CLPS711X)   += gpio-clps711x.o
 obj-$(CONFIG_GPIO_CS5535)      += gpio-cs5535.o
 obj-$(CONFIG_GPIO_DA9052)      += gpio-da9052.o
 obj-$(CONFIG_GPIO_DA9055)      += gpio-da9055.o
-obj-$(CONFIG_ARCH_DAVINCI)     += gpio-davinci.o
+obj-$(CONFIG_GPIO_DAVINCI)     += gpio-davinci.o
 obj-$(CONFIG_GPIO_EM)          += gpio-em.o
 obj-$(CONFIG_GPIO_EP93XX)      += gpio-ep93xx.o
 obj-$(CONFIG_GPIO_F7188X)      += gpio-f7188x.o
index 84be70157ad6b6e9809bd007c422e223c359d429..7629b4f12b7fd8fbeba71bc72e8768f6a41936f6 100644 (file)
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/gpio-davinci.h>
+#include <linux/irqchip/chained_irq.h>
 
 struct davinci_gpio_regs {
        u32     dir;
@@ -82,14 +87,14 @@ static inline int __davinci_direction(struct gpio_chip *chip,
        u32 mask = 1 << offset;
 
        spin_lock_irqsave(&d->lock, flags);
-       temp = __raw_readl(&g->dir);
+       temp = readl_relaxed(&g->dir);
        if (out) {
                temp &= ~mask;
-               __raw_writel(mask, value ? &g->set_data : &g->clr_data);
+               writel_relaxed(mask, value ? &g->set_data : &g->clr_data);
        } else {
                temp |= mask;
        }
-       __raw_writel(temp, &g->dir);
+       writel_relaxed(temp, &g->dir);
        spin_unlock_irqrestore(&d->lock, flags);
 
        return 0;
@@ -118,7 +123,7 @@ static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset)
        struct davinci_gpio_controller *d = chip2controller(chip);
        struct davinci_gpio_regs __iomem *g = d->regs;
 
-       return (1 << offset) & __raw_readl(&g->in_data);
+       return (1 << offset) & readl_relaxed(&g->in_data);
 }
 
 /*
@@ -130,7 +135,41 @@ davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
        struct davinci_gpio_controller *d = chip2controller(chip);
        struct davinci_gpio_regs __iomem *g = d->regs;
 
-       __raw_writel((1 << offset), value ? &g->set_data : &g->clr_data);
+       writel_relaxed((1 << offset), value ? &g->set_data : &g->clr_data);
+}
+
+static struct davinci_gpio_platform_data *
+davinci_gpio_get_pdata(struct platform_device *pdev)
+{
+       struct device_node *dn = pdev->dev.of_node;
+       struct davinci_gpio_platform_data *pdata;
+       int ret;
+       u32 val;
+
+       if (!IS_ENABLED(CONFIG_OF) || !pdev->dev.of_node)
+               return pdev->dev.platform_data;
+
+       pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+       if (!pdata)
+               return NULL;
+
+       ret = of_property_read_u32(dn, "ti,ngpio", &val);
+       if (ret)
+               goto of_err;
+
+       pdata->ngpio = val;
+
+       ret = of_property_read_u32(dn, "ti,davinci-gpio-unbanked", &val);
+       if (ret)
+               goto of_err;
+
+       pdata->gpio_unbanked = val;
+
+       return pdata;
+
+of_err:
+       dev_err(&pdev->dev, "Populating pdata from DT failed: err %d\n", ret);
+       return NULL;
 }
 
 static int davinci_gpio_probe(struct platform_device *pdev)
@@ -143,12 +182,14 @@ static int davinci_gpio_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct resource *res;
 
-       pdata = dev->platform_data;
+       pdata = davinci_gpio_get_pdata(pdev);
        if (!pdata) {
                dev_err(dev, "No platform data found\n");
                return -EINVAL;
        }
 
+       dev->platform_data = pdata;
+
        /*
         * The gpio banks conceptually expose a segmented bitmap,
         * and "ngpio" is one more than the largest zero-based
@@ -160,8 +201,8 @@ static int davinci_gpio_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       if (WARN_ON(DAVINCI_N_GPIO < ngpio))
-               ngpio = DAVINCI_N_GPIO;
+       if (WARN_ON(ARCH_NR_GPIOS < ngpio))
+               ngpio = ARCH_NR_GPIOS;
 
        chips = devm_kzalloc(dev,
                             ngpio * sizeof(struct davinci_gpio_controller),
@@ -194,6 +235,9 @@ static int davinci_gpio_probe(struct platform_device *pdev)
                if (chips[i].chip.ngpio > 32)
                        chips[i].chip.ngpio = 32;
 
+#ifdef CONFIG_OF_GPIO
+               chips[i].chip.of_node = dev->of_node;
+#endif
                spin_lock_init(&chips[i].lock);
 
                regs = gpio2regs(base);
@@ -227,8 +271,8 @@ static void gpio_irq_disable(struct irq_data *d)
        struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
        u32 mask = (u32) irq_data_get_irq_handler_data(d);
 
-       __raw_writel(mask, &g->clr_falling);
-       __raw_writel(mask, &g->clr_rising);
+       writel_relaxed(mask, &g->clr_falling);
+       writel_relaxed(mask, &g->clr_rising);
 }
 
 static void gpio_irq_enable(struct irq_data *d)
@@ -242,9 +286,9 @@ static void gpio_irq_enable(struct irq_data *d)
                status = IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
 
        if (status & IRQ_TYPE_EDGE_FALLING)
-               __raw_writel(mask, &g->set_falling);
+               writel_relaxed(mask, &g->set_falling);
        if (status & IRQ_TYPE_EDGE_RISING)
-               __raw_writel(mask, &g->set_rising);
+               writel_relaxed(mask, &g->set_rising);
 }
 
 static int gpio_irq_type(struct irq_data *d, unsigned trigger)
@@ -278,34 +322,28 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
                mask <<= 16;
 
        /* temporarily mask (level sensitive) parent IRQ */
-       desc->irq_data.chip->irq_mask(&desc->irq_data);
-       desc->irq_data.chip->irq_ack(&desc->irq_data);
+       chained_irq_enter(irq_desc_get_chip(desc), desc);
        while (1) {
                u32             status;
-               int             n;
-               int             res;
+               int             bit;
 
                /* ack any irqs */
-               status = __raw_readl(&g->intstat) & mask;
+               status = readl_relaxed(&g->intstat) & mask;
                if (!status)
                        break;
-               __raw_writel(status, &g->intstat);
+               writel_relaxed(status, &g->intstat);
 
                /* now demux them to the right lowlevel handler */
-               n = d->irq_base;
-               if (irq & 1) {
-                       n += 16;
-                       status >>= 16;
-               }
 
                while (status) {
-                       res = ffs(status);
-                       n += res;
-                       generic_handle_irq(n - 1);
-                       status >>= res;
+                       bit = __ffs(status);
+                       status &= ~BIT(bit);
+                       generic_handle_irq(
+                               irq_find_mapping(d->irq_domain,
+                                                d->chip.base + bit));
                }
        }
-       desc->irq_data.chip->irq_unmask(&desc->irq_data);
+       chained_irq_exit(irq_desc_get_chip(desc), desc);
        /* now it may re-trigger */
 }
 
@@ -313,10 +351,10 @@ static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset)
 {
        struct davinci_gpio_controller *d = chip2controller(chip);
 
-       if (d->irq_base >= 0)
-               return d->irq_base + offset;
+       if (d->irq_domain)
+               return irq_create_mapping(d->irq_domain, d->chip.base + offset);
        else
-               return -ENODEV;
+               return -ENXIO;
 }
 
 static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
@@ -346,14 +384,35 @@ static int gpio_irq_type_unbanked(struct irq_data *data, unsigned trigger)
        if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
                return -EINVAL;
 
-       __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING)
+       writel_relaxed(mask, (trigger & IRQ_TYPE_EDGE_FALLING)
                     ? &g->set_falling : &g->clr_falling);
-       __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING)
+       writel_relaxed(mask, (trigger & IRQ_TYPE_EDGE_RISING)
                     ? &g->set_rising : &g->clr_rising);
 
        return 0;
 }
 
+static int
+davinci_gpio_irq_map(struct irq_domain *d, unsigned int irq,
+                    irq_hw_number_t hw)
+{
+       struct davinci_gpio_regs __iomem *g = gpio2regs(hw);
+
+       irq_set_chip_and_handler_name(irq, &gpio_irqchip, handle_simple_irq,
+                               "davinci_gpio");
+       irq_set_irq_type(irq, IRQ_TYPE_NONE);
+       irq_set_chip_data(irq, (__force void *)g);
+       irq_set_handler_data(irq, (void *)__gpio_mask(hw));
+       set_irq_flags(irq, IRQF_VALID);
+
+       return 0;
+}
+
+static const struct irq_domain_ops davinci_gpio_irq_ops = {
+       .map = davinci_gpio_irq_map,
+       .xlate = irq_domain_xlate_onetwocell,
+};
+
 /*
  * NOTE:  for suspend/resume, probably best to make a platform_device with
  * suspend_late/resume_resume calls hooking into results of the set_wake()
@@ -373,6 +432,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
        struct davinci_gpio_controller *chips = platform_get_drvdata(pdev);
        struct davinci_gpio_platform_data *pdata = dev->platform_data;
        struct davinci_gpio_regs __iomem *g;
+       struct irq_domain       *irq_domain = NULL;
 
        ngpio = pdata->ngpio;
        res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -396,6 +456,22 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
        }
        clk_prepare_enable(clk);
 
+       if (!pdata->gpio_unbanked) {
+               irq = irq_alloc_descs(-1, 0, ngpio, 0);
+               if (irq < 0) {
+                       dev_err(dev, "Couldn't allocate IRQ numbers\n");
+                       return irq;
+               }
+
+               irq_domain = irq_domain_add_legacy(NULL, ngpio, irq, 0,
+                                                       &davinci_gpio_irq_ops,
+                                                       chips);
+               if (!irq_domain) {
+                       dev_err(dev, "Couldn't register an IRQ domain\n");
+                       return -ENODEV;
+               }
+       }
+
        /*
         * Arrange gpio_to_irq() support, handling either direct IRQs or
         * banked IRQs.  Having GPIOs in the first GPIO bank use direct
@@ -404,9 +480,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
         */
        for (gpio = 0, bank = 0; gpio < ngpio; bank++, gpio += 32) {
                chips[bank].chip.to_irq = gpio_to_irq_banked;
-               chips[bank].irq_base = pdata->gpio_unbanked
-                       ? -EINVAL
-                       : (pdata->intc_irq_num + gpio);
+               chips[bank].irq_domain = irq_domain;
        }
 
        /*
@@ -432,8 +506,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
 
                /* default trigger: both edges */
                g = gpio2regs(0);
-               __raw_writel(~0, &g->set_falling);
-               __raw_writel(~0, &g->set_rising);
+               writel_relaxed(~0, &g->set_falling);
+               writel_relaxed(~0, &g->set_rising);
 
                /* set the direct IRQs up to use that irqchip */
                for (gpio = 0; gpio < pdata->gpio_unbanked; gpio++, irq++) {
@@ -449,15 +523,11 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
         * Or, AINTC can handle IRQs for banks of 16 GPIO IRQs, which we
         * then chain through our own handler.
         */
-       for (gpio = 0, irq = gpio_to_irq(0), bank = 0;
-                       gpio < ngpio;
-                       bank++, bank_irq++) {
-               unsigned                i;
-
+       for (gpio = 0, bank = 0; gpio < ngpio; bank++, bank_irq++, gpio += 16) {
                /* disabled by default, enabled only as needed */
                g = gpio2regs(gpio);
-               __raw_writel(~0, &g->clr_falling);
-               __raw_writel(~0, &g->clr_rising);
+               writel_relaxed(~0, &g->clr_falling);
+               writel_relaxed(~0, &g->clr_rising);
 
                /* set up all irqs in this bank */
                irq_set_chained_handler(bank_irq, gpio_irq_handler);
@@ -469,14 +539,6 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
                 */
                irq_set_handler_data(bank_irq, &chips[gpio / 32]);
 
-               for (i = 0; i < 16 && gpio < ngpio; i++, irq++, gpio++) {
-                       irq_set_chip(irq, &gpio_irqchip);
-                       irq_set_chip_data(irq, (__force void *)g);
-                       irq_set_handler_data(irq, (void *)__gpio_mask(gpio));
-                       irq_set_handler(irq, handle_simple_irq);
-                       set_irq_flags(irq, IRQF_VALID);
-               }
-
                binten |= BIT(bank);
        }
 
@@ -485,18 +547,25 @@ done:
         * BINTEN -- per-bank interrupt enable. genirq would also let these
         * bits be set/cleared dynamically.
         */
-       __raw_writel(binten, gpio_base + BINTEN);
-
-       printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0));
+       writel_relaxed(binten, gpio_base + BINTEN);
 
        return 0;
 }
 
+#if IS_ENABLED(CONFIG_OF)
+static const struct of_device_id davinci_gpio_ids[] = {
+       { .compatible = "ti,dm6441-gpio", },
+       { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, davinci_gpio_ids);
+#endif
+
 static struct platform_driver davinci_gpio_driver = {
        .probe          = davinci_gpio_probe,
        .driver         = {
-               .name   = "davinci_gpio",
-               .owner  = THIS_MODULE,
+               .name           = "davinci_gpio",
+               .owner          = THIS_MODULE,
+               .of_match_table = of_match_ptr(davinci_gpio_ids),
        },
 };
 
index 8961ba6a34b879246e9b90defc1b129c2ebeea0f..8db9b3bce001fd5dd15e4de157a09d1f9b242ff4 100644 (file)
@@ -2,6 +2,7 @@ config DRM_TEGRA
        bool "NVIDIA Tegra DRM"
        depends on ARCH_TEGRA || ARCH_MULTIPLATFORM
        depends on DRM
+       depends on RESET_CONTROLLER
        select TEGRA_HOST1X
        select DRM_KMS_HELPER
        select DRM_KMS_FB_HELPER
index ae1cb31ead7e4256c32f6ea045395347780a25a8..cd7f1e499616891347485bcf6d3da86d6a05ab56 100644 (file)
@@ -8,8 +8,8 @@
  */
 
 #include <linux/clk.h>
-#include <linux/clk/tegra.h>
 #include <linux/debugfs.h>
+#include <linux/reset.h>
 
 #include "dc.h"
 #include "drm.h"
@@ -712,7 +712,7 @@ static void tegra_crtc_prepare(struct drm_crtc *crtc)
        unsigned long value;
 
        /* hardware initialization */
-       tegra_periph_reset_deassert(dc->clk);
+       reset_control_deassert(dc->rst);
        usleep_range(10000, 20000);
 
        if (dc->pipe)
@@ -1187,6 +1187,12 @@ static int tegra_dc_probe(struct platform_device *pdev)
                return PTR_ERR(dc->clk);
        }
 
+       dc->rst = devm_reset_control_get(&pdev->dev, "dc");
+       if (IS_ERR(dc->rst)) {
+               dev_err(&pdev->dev, "failed to get reset\n");
+               return PTR_ERR(dc->rst);
+       }
+
        err = clk_prepare_enable(dc->clk);
        if (err < 0)
                return err;
index 7da0b923131f05ca5f67fb8113f2fd9754023a15..266aae08a3bd394fff2d9e41e902d2c9e899bba9 100644 (file)
@@ -19,6 +19,8 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_fixed.h>
 
+struct reset_control;
+
 struct tegra_fb {
        struct drm_framebuffer base;
        struct tegra_bo **planes;
@@ -93,6 +95,7 @@ struct tegra_dc {
        int pipe;
 
        struct clk *clk;
+       struct reset_control *rst;
        void __iomem *regs;
        int irq;
 
index 4cec8f526af7036efac83c439599b1093ee4c94c..0cbb24b1ae04feef3e3bd602936c0e469715527e 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/host1x.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/reset.h>
 #include <linux/tegra-powergate.h>
 
 #include "drm.h"
@@ -22,6 +23,8 @@ struct gr3d {
        struct host1x_channel *channel;
        struct clk *clk_secondary;
        struct clk *clk;
+       struct reset_control *rst_secondary;
+       struct reset_control *rst;
 
        DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS);
 };
@@ -255,15 +258,29 @@ static int gr3d_probe(struct platform_device *pdev)
                return PTR_ERR(gr3d->clk);
        }
 
+       gr3d->rst = devm_reset_control_get(&pdev->dev, "3d");
+       if (IS_ERR(gr3d->rst)) {
+               dev_err(&pdev->dev, "cannot get reset\n");
+               return PTR_ERR(gr3d->rst);
+       }
+
        if (of_device_is_compatible(np, "nvidia,tegra30-gr3d")) {
                gr3d->clk_secondary = devm_clk_get(&pdev->dev, "3d2");
                if (IS_ERR(gr3d->clk)) {
                        dev_err(&pdev->dev, "cannot get secondary clock\n");
                        return PTR_ERR(gr3d->clk);
                }
+
+               gr3d->rst_secondary = devm_reset_control_get(&pdev->dev,
+                                                               "3d2");
+               if (IS_ERR(gr3d->rst_secondary)) {
+                       dev_err(&pdev->dev, "cannot get secondary reset\n");
+                       return PTR_ERR(gr3d->rst_secondary);
+               }
        }
 
-       err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D, gr3d->clk);
+       err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D, gr3d->clk,
+                                               gr3d->rst);
        if (err < 0) {
                dev_err(&pdev->dev, "failed to power up 3D unit\n");
                return err;
@@ -271,7 +288,8 @@ static int gr3d_probe(struct platform_device *pdev)
 
        if (gr3d->clk_secondary) {
                err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D1,
-                                                       gr3d->clk_secondary);
+                                                       gr3d->clk_secondary,
+                                                       gr3d->rst_secondary);
                if (err < 0) {
                        dev_err(&pdev->dev,
                                "failed to power up secondary 3D unit\n");
index 0cd9bc2056e8c6bfe12cd15c5722c6f18d087e78..7f6253ea5cb5ea264319e98800b6d3783e1becb3 100644 (file)
@@ -8,10 +8,10 @@
  */
 
 #include <linux/clk.h>
-#include <linux/clk/tegra.h>
 #include <linux/debugfs.h>
 #include <linux/hdmi.h>
 #include <linux/regulator/consumer.h>
+#include <linux/reset.h>
 
 #include "hdmi.h"
 #include "drm.h"
@@ -49,6 +49,7 @@ struct tegra_hdmi {
 
        struct clk *clk_parent;
        struct clk *clk;
+       struct reset_control *rst;
 
        const struct tegra_hdmi_config *config;
 
@@ -731,9 +732,9 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
                return err;
        }
 
-       tegra_periph_reset_assert(hdmi->clk);
+       reset_control_assert(hdmi->rst);
        usleep_range(1000, 2000);
-       tegra_periph_reset_deassert(hdmi->clk);
+       reset_control_deassert(hdmi->rst);
 
        tegra_dc_writel(dc, VSYNC_H_POSITION(1),
                        DC_DISP_DISP_TIMING_OPTIONS);
@@ -912,7 +913,7 @@ static int tegra_output_hdmi_disable(struct tegra_output *output)
 {
        struct tegra_hdmi *hdmi = to_hdmi(output);
 
-       tegra_periph_reset_assert(hdmi->clk);
+       reset_control_assert(hdmi->rst);
        clk_disable(hdmi->clk);
        regulator_disable(hdmi->pll);
 
@@ -1338,6 +1339,12 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
                return PTR_ERR(hdmi->clk);
        }
 
+       hdmi->rst = devm_reset_control_get(&pdev->dev, "hdmi");
+       if (IS_ERR(hdmi->rst)) {
+               dev_err(&pdev->dev, "failed to get reset\n");
+               return PTR_ERR(hdmi->rst);
+       }
+
        err = clk_prepare(hdmi->clk);
        if (err < 0)
                return err;
index 8be7e42aa4de88ba3f00ef2275455b27fa5cdf96..b8c5187b9ee0da912b3a872b828705891a0146a4 100644 (file)
@@ -692,6 +692,7 @@ static const struct of_device_id mv64xxx_i2c_of_match_table[] = {
        { .compatible = "allwinner,sun4i-i2c", .data = &mv64xxx_i2c_regs_sun4i},
        { .compatible = "marvell,mv64xxx-i2c", .data = &mv64xxx_i2c_regs_mv64xxx},
        { .compatible = "marvell,mv78230-i2c", .data = &mv64xxx_i2c_regs_mv64xxx},
+       { .compatible = "marvell,mv78230-a0-i2c", .data = &mv64xxx_i2c_regs_mv64xxx},
        {}
 };
 MODULE_DEVICE_TABLE(of, mv64xxx_i2c_of_match_table);
@@ -783,6 +784,10 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
                drv_data->errata_delay = true;
        }
 
+       if (of_device_is_compatible(np, "marvell,mv78230-a0-i2c")) {
+               drv_data->offload_enabled = false;
+               drv_data->errata_delay = true;
+       }
 out:
        return rc;
 #endif
index e661edee4d0cf0d92b7ab5e6899d1993bb264799..9704537aee3cd1921233339340c084365ed958bb 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/slab.h>
 #include <linux/of_device.h>
 #include <linux/module.h>
-#include <linux/clk/tegra.h>
+#include <linux/reset.h>
 
 #include <asm/unaligned.h>
 
@@ -160,6 +160,7 @@ struct tegra_i2c_dev {
        struct i2c_adapter adapter;
        struct clk *div_clk;
        struct clk *fast_clk;
+       struct reset_control *rst;
        void __iomem *base;
        int cont_id;
        int irq;
@@ -415,9 +416,9 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
                return err;
        }
 
-       tegra_periph_reset_assert(i2c_dev->div_clk);
+       reset_control_assert(i2c_dev->rst);
        udelay(2);
-       tegra_periph_reset_deassert(i2c_dev->div_clk);
+       reset_control_deassert(i2c_dev->rst);
 
        if (i2c_dev->is_dvc)
                tegra_dvc_init(i2c_dev);
@@ -743,6 +744,12 @@ static int tegra_i2c_probe(struct platform_device *pdev)
        i2c_dev->cont_id = pdev->id;
        i2c_dev->dev = &pdev->dev;
 
+       i2c_dev->rst = devm_reset_control_get(&pdev->dev, "i2c");
+       if (IS_ERR(i2c_dev->rst)) {
+               dev_err(&pdev->dev, "missing controller reset");
+               return PTR_ERR(i2c_dev->rst);
+       }
+
        ret = of_property_read_u32(i2c_dev->dev->of_node, "clock-frequency",
                                        &i2c_dev->bus_clk_rate);
        if (ret)
index 8508879f6fafd2663d393cb6afad9f00340b341c..9757a58bc8978c3f81b50c2cafbe1438940a6b5e 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/clk.h>
 #include <linux/slab.h>
 #include <linux/input/matrix_keypad.h>
-#include <linux/clk/tegra.h>
+#include <linux/reset.h>
 #include <linux/err.h>
 
 #define KBC_MAX_KPENT  8
@@ -116,6 +116,7 @@ struct tegra_kbc {
        u32 wakeup_key;
        struct timer_list timer;
        struct clk *clk;
+       struct reset_control *rst;
        const struct tegra_kbc_hw_support *hw_support;
        int max_keys;
        int num_rows_and_columns;
@@ -373,9 +374,9 @@ static int tegra_kbc_start(struct tegra_kbc *kbc)
        clk_prepare_enable(kbc->clk);
 
        /* Reset the KBC controller to clear all previous status.*/
-       tegra_periph_reset_assert(kbc->clk);
+       reset_control_assert(kbc->rst);
        udelay(100);
-       tegra_periph_reset_deassert(kbc->clk);
+       reset_control_assert(kbc->rst);
        udelay(100);
 
        tegra_kbc_config_pins(kbc);
@@ -663,6 +664,12 @@ static int tegra_kbc_probe(struct platform_device *pdev)
                return PTR_ERR(kbc->clk);
        }
 
+       kbc->rst = devm_reset_control_get(&pdev->dev, "kbc");
+       if (IS_ERR(kbc->rst)) {
+               dev_err(&pdev->dev, "failed to get keyboard reset\n");
+               return PTR_ERR(kbc->rst);
+       }
+
        /*
         * The time delay between two consecutive reads of the FIFO is
         * the sum of the repeat time and the time taken for scanning
index 4e2fd44865e1cad4819db1a7f959912a76adaabf..b7c206db0df86fd34053f644b07e8b92abf2c4c0 100644 (file)
@@ -167,8 +167,6 @@ static int amba_kmi_remove(struct amba_device *dev)
 {
        struct amba_kmi_port *kmi = amba_get_drvdata(dev);
 
-       amba_set_drvdata(dev, NULL);
-
        serio_unregister_port(kmi->io);
        clk_put(kmi->clk);
        iounmap(kmi->base);
index 3792a1aa52b88d3439cdc66195230cc1b20f0f2a..940638ddc982de3f622ecb2976a748dfc4d19d96 100644 (file)
@@ -30,6 +30,10 @@ config ARM_VIC_NR
          The maximum number of VICs available in the system, for
          power management.
 
+config DW_APB_ICTL
+       bool
+       select IRQ_DOMAIN
+
 config IMGPDC_IRQ
        bool
        select GENERIC_IRQ_CHIP
index c60b9010b152cf4980336eac485daa8bceec9412..6427323af4c3f5f57c63b6e413eaca0349803e6a 100644 (file)
@@ -6,6 +6,7 @@ obj-$(CONFIG_ARCH_MMP)                  += irq-mmp.o
 obj-$(CONFIG_ARCH_MVEBU)               += irq-armada-370-xp.o
 obj-$(CONFIG_ARCH_MXS)                 += irq-mxs.o
 obj-$(CONFIG_ARCH_S3C24XX)             += irq-s3c24xx.o
+obj-$(CONFIG_DW_APB_ICTL)              += irq-dw-apb-ictl.o
 obj-$(CONFIG_METAG)                    += irq-metag-ext.o
 obj-$(CONFIG_METAG_PERFCOUNTER_IRQS)   += irq-metag.o
 obj-$(CONFIG_ARCH_MOXART)              += irq-moxart.o
index 868ed40cb6bf070ba5b6b5a4156cda73f54fa9fa..40e6440348ff5d9ace76ff17510bbf40ae648415 100644 (file)
@@ -171,8 +171,7 @@ static struct irq_domain_ops combiner_irq_domain_ops = {
 
 static void __init combiner_init(void __iomem *combiner_base,
                                 struct device_node *np,
-                                unsigned int max_nr,
-                                int irq_base)
+                                unsigned int max_nr)
 {
        int i, irq;
        unsigned int nr_irq;
@@ -186,7 +185,7 @@ static void __init combiner_init(void __iomem *combiner_base,
                return;
        }
 
-       combiner_irq_domain = irq_domain_add_simple(np, nr_irq, irq_base,
+       combiner_irq_domain = irq_domain_add_linear(np, nr_irq,
                                &combiner_irq_domain_ops, combiner_data);
        if (WARN_ON(!combiner_irq_domain)) {
                pr_warning("%s: irq domain init failed\n", __func__);
@@ -207,7 +206,6 @@ static int __init combiner_of_init(struct device_node *np,
 {
        void __iomem *combiner_base;
        unsigned int max_nr = 20;
-       int irq_base = -1;
 
        combiner_base = of_iomap(np, 0);
        if (!combiner_base) {
@@ -221,14 +219,7 @@ static int __init combiner_of_init(struct device_node *np,
                        __func__, max_nr);
        }
 
-       /* 
-        * FIXME: This is a hardwired COMBINER_IRQ(0,0). Once all devices
-        * get their IRQ from DT, remove this in order to get dynamic
-        * allocation.
-        */
-       irq_base = 160;
-
-       combiner_init(combiner_base, np, max_nr, irq_base);
+       combiner_init(combiner_base, np, max_nr);
 
        return 0;
 }
diff --git a/drivers/irqchip/irq-dw-apb-ictl.c b/drivers/irqchip/irq-dw-apb-ictl.c
new file mode 100644 (file)
index 0000000..31e231e
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * Synopsys DW APB ICTL irqchip driver.
+ *
+ * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ *  (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+#include "irqchip.h"
+
+#define APB_INT_ENABLE_L       0x00
+#define APB_INT_ENABLE_H       0x04
+#define APB_INT_MASK_L         0x08
+#define APB_INT_MASK_H         0x0c
+#define APB_INT_FINALSTATUS_L  0x30
+#define APB_INT_FINALSTATUS_H  0x34
+
+static void dw_apb_ictl_handler(unsigned int irq, struct irq_desc *desc)
+{
+       struct irq_chip *chip = irq_get_chip(irq);
+       struct irq_chip_generic *gc = irq_get_handler_data(irq);
+       struct irq_domain *d = gc->private;
+       u32 stat;
+       int n;
+
+       chained_irq_enter(chip, desc);
+
+       for (n = 0; n < gc->num_ct; n++) {
+               stat = readl_relaxed(gc->reg_base +
+                                    APB_INT_FINALSTATUS_L + 4 * n);
+               while (stat) {
+                       u32 hwirq = ffs(stat) - 1;
+                       generic_handle_irq(irq_find_mapping(d,
+                                           gc->irq_base + hwirq + 32 * n));
+                       stat &= ~(1 << hwirq);
+               }
+       }
+
+       chained_irq_exit(chip, desc);
+}
+
+static int __init dw_apb_ictl_init(struct device_node *np,
+                                  struct device_node *parent)
+{
+       unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
+       struct resource r;
+       struct irq_domain *domain;
+       struct irq_chip_generic *gc;
+       void __iomem *iobase;
+       int ret, nrirqs, irq;
+       u32 reg;
+
+       /* Map the parent interrupt for the chained handler */
+       irq = irq_of_parse_and_map(np, 0);
+       if (irq <= 0) {
+               pr_err("%s: unable to parse irq\n", np->full_name);
+               return -EINVAL;
+       }
+
+       ret = of_address_to_resource(np, 0, &r);
+       if (ret) {
+               pr_err("%s: unable to get resource\n", np->full_name);
+               return ret;
+       }
+
+       if (!request_mem_region(r.start, resource_size(&r), np->full_name)) {
+               pr_err("%s: unable to request mem region\n", np->full_name);
+               return -ENOMEM;
+       }
+
+       iobase = ioremap(r.start, resource_size(&r));
+       if (!iobase) {
+               pr_err("%s: unable to map resource\n", np->full_name);
+               ret = -ENOMEM;
+               goto err_release;
+       }
+
+       /*
+        * DW IP can be configured to allow 2-64 irqs. We can determine
+        * the number of irqs supported by writing into enable register
+        * and look for bits not set, as corresponding flip-flops will
+        * have been removed by sythesis tool.
+        */
+
+       /* mask and enable all interrupts */
+       writel(~0, iobase + APB_INT_MASK_L);
+       writel(~0, iobase + APB_INT_MASK_H);
+       writel(~0, iobase + APB_INT_ENABLE_L);
+       writel(~0, iobase + APB_INT_ENABLE_H);
+
+       reg = readl(iobase + APB_INT_ENABLE_H);
+       if (reg)
+               nrirqs = 32 + fls(reg);
+       else
+               nrirqs = fls(readl(iobase + APB_INT_ENABLE_L));
+
+       domain = irq_domain_add_linear(np, nrirqs,
+                                      &irq_generic_chip_ops, NULL);
+       if (!domain) {
+               pr_err("%s: unable to add irq domain\n", np->full_name);
+               ret = -ENOMEM;
+               goto err_unmap;
+       }
+
+       ret = irq_alloc_domain_generic_chips(domain, 32, (nrirqs > 32) ? 2 : 1,
+                                            np->name, handle_level_irq, clr, 0,
+                                            IRQ_GC_INIT_MASK_CACHE);
+       if (ret) {
+               pr_err("%s: unable to alloc irq domain gc\n", np->full_name);
+               goto err_unmap;
+       }
+
+       gc = irq_get_domain_generic_chip(domain, 0);
+       gc->private = domain;
+       gc->reg_base = iobase;
+
+       gc->chip_types[0].regs.mask = APB_INT_MASK_L;
+       gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
+       gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
+
+       if (nrirqs > 32) {
+               gc->chip_types[1].regs.mask = APB_INT_MASK_H;
+               gc->chip_types[1].chip.irq_mask = irq_gc_mask_set_bit;
+               gc->chip_types[1].chip.irq_unmask = irq_gc_mask_clr_bit;
+       }
+
+       irq_set_handler_data(irq, gc);
+       irq_set_chained_handler(irq, dw_apb_ictl_handler);
+
+       return 0;
+
+err_unmap:
+       iounmap(iobase);
+err_release:
+       release_mem_region(r.start, resource_size(&r));
+       return ret;
+}
+IRQCHIP_DECLARE(dw_apb_ictl,
+               "snps,dw-apb-ictl", dw_apb_ictl_init);
index 2f404ba61c6c23f0b3ea8a15f6bd4154c4e2578c..8777065012a58282b73be989930748f1f7a5f02a 100644 (file)
@@ -81,15 +81,12 @@ static void irqc_irq_disable(struct irq_data *d)
        iowrite32(BIT(hw_irq), p->cpu_int_base + IRQC_EN_STS);
 }
 
-#define INTC_IRQ_SENSE_VALID 0x10
-#define INTC_IRQ_SENSE(x) (x + INTC_IRQ_SENSE_VALID)
-
 static unsigned char irqc_sense[IRQ_TYPE_SENSE_MASK + 1] = {
-       [IRQ_TYPE_LEVEL_LOW] = INTC_IRQ_SENSE(0x01),
-       [IRQ_TYPE_LEVEL_HIGH] = INTC_IRQ_SENSE(0x02),
-       [IRQ_TYPE_EDGE_FALLING] = INTC_IRQ_SENSE(0x04), /* Synchronous */
-       [IRQ_TYPE_EDGE_RISING] = INTC_IRQ_SENSE(0x08), /* Synchronous */
-       [IRQ_TYPE_EDGE_BOTH] = INTC_IRQ_SENSE(0x0c),  /* Synchronous */
+       [IRQ_TYPE_LEVEL_LOW]    = 0x01,
+       [IRQ_TYPE_LEVEL_HIGH]   = 0x02,
+       [IRQ_TYPE_EDGE_FALLING] = 0x04, /* Synchronous */
+       [IRQ_TYPE_EDGE_RISING]  = 0x08, /* Synchronous */
+       [IRQ_TYPE_EDGE_BOTH]    = 0x0c, /* Synchronous */
 };
 
 static int irqc_irq_set_type(struct irq_data *d, unsigned int type)
@@ -101,12 +98,12 @@ static int irqc_irq_set_type(struct irq_data *d, unsigned int type)
 
        irqc_dbg(&p->irq[hw_irq], "sense");
 
-       if (!(value & INTC_IRQ_SENSE_VALID))
+       if (!value)
                return -EINVAL;
 
        tmp = ioread32(p->iomem + IRQC_CONFIG(hw_irq));
        tmp &= ~0x3f;
-       tmp |= value ^ INTC_IRQ_SENSE_VALID;
+       tmp |= value;
        iowrite32(tmp, p->iomem + IRQC_CONFIG(hw_irq));
        return 0;
 }
@@ -212,10 +209,8 @@ static int irqc_probe(struct platform_device *pdev)
        irq_chip->name = name;
        irq_chip->irq_mask = irqc_irq_disable;
        irq_chip->irq_unmask = irqc_irq_enable;
-       irq_chip->irq_enable = irqc_irq_enable;
-       irq_chip->irq_disable = irqc_irq_disable;
        irq_chip->irq_set_type = irqc_irq_set_type;
-       irq_chip->flags = IRQCHIP_SKIP_SET_WAKE;
+       irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND;
 
        p->irq_domain = irq_domain_add_simple(pdev->dev.of_node,
                                              p->number_of_irqs,
index 4851afae38dcbb73f2d982a2d5e8666d657cccd2..3a070c587ed969f426bbaa2d4141a395e1f92424 100644 (file)
@@ -34,9 +34,10 @@ sirfsoc_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
        struct irq_chip_type *ct;
        int ret;
        unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
+       unsigned int set = IRQ_LEVEL;
 
        ret = irq_alloc_domain_generic_chips(sirfsoc_irqdomain, num, 1, "irq_sirfsoc",
-               handle_level_irq, clr, 0, IRQ_GC_INIT_MASK_CACHE);
+               handle_level_irq, clr, set, IRQ_GC_INIT_MASK_CACHE);
 
        gc = irq_get_domain_generic_chip(sirfsoc_irqdomain, irq_start);
        gc->reg_base = base;
index 47a52ab580d863ba2266d26f228befc2695218f1..3ae2bb8d9cf22e04cc967468823133f952e5c4ea 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/of_irq.h>
 
 #include <asm/exception.h>
 #include <asm/mach/irq.h>
@@ -167,8 +168,12 @@ void __init fpga_irq_init(void __iomem *base, const char *name, int irq_start,
                        f->used_irqs++;
                }
 
-       pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n",
+       pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs",
                fpga_irq_id, name, base, f->used_irqs);
+       if (parent_irq != -1)
+               pr_cont(", parent IRQ: %d\n", parent_irq);
+       else
+               pr_cont("\n");
 
        fpga_irq_id++;
 }
@@ -180,6 +185,7 @@ int __init fpga_irq_of_init(struct device_node *node,
        void __iomem *base;
        u32 clear_mask;
        u32 valid_mask;
+       int parent_irq;
 
        if (WARN_ON(!node))
                return -ENODEV;
@@ -193,7 +199,12 @@ int __init fpga_irq_of_init(struct device_node *node,
        if (of_property_read_u32(node, "valid-mask", &valid_mask))
                valid_mask = 0;
 
-       fpga_irq_init(base, node->name, 0, -1, valid_mask, node);
+       /* Some chips are cascaded from a parent IRQ */
+       parent_irq = irq_of_parse_and_map(node, 0);
+       if (!parent_irq)
+               parent_irq = -1;
+
+       fpga_irq_init(base, node->name, 0, parent_irq, valid_mask, node);
 
        writel(clear_mask, base + IRQ_ENABLE_CLEAR);
        writel(clear_mask, base + FIQ_ENABLE_CLEAR);
index 561bce8ffb1b57c87dd1b45bbae6cbf7c2b479c1..fdbdeae3900dd0bb92ea10184239d9bd6c004074 100644 (file)
@@ -290,9 +290,11 @@ static int isp_xclk_init(struct isp_device *isp)
        struct clk_init_data init;
        unsigned int i;
 
+       for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i)
+               isp->xclks[i].clk = ERR_PTR(-EINVAL);
+
        for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) {
                struct isp_xclk *xclk = &isp->xclks[i];
-               struct clk *clk;
 
                xclk->isp = isp;
                xclk->id = i == 0 ? ISP_XCLK_A : ISP_XCLK_B;
@@ -305,10 +307,15 @@ static int isp_xclk_init(struct isp_device *isp)
                init.num_parents = 1;
 
                xclk->hw.init = &init;
-
-               clk = devm_clk_register(isp->dev, &xclk->hw);
-               if (IS_ERR(clk))
-                       return PTR_ERR(clk);
+               /*
+                * The first argument is NULL in order to avoid circular
+                * reference, as this driver takes reference on the
+                * sensor subdevice modules and the sensors would take
+                * reference on this module through clk_get().
+                */
+               xclk->clk = clk_register(NULL, &xclk->hw);
+               if (IS_ERR(xclk->clk))
+                       return PTR_ERR(xclk->clk);
 
                if (pdata->xclks[i].con_id == NULL &&
                    pdata->xclks[i].dev_id == NULL)
@@ -320,7 +327,7 @@ static int isp_xclk_init(struct isp_device *isp)
 
                xclk->lookup->con_id = pdata->xclks[i].con_id;
                xclk->lookup->dev_id = pdata->xclks[i].dev_id;
-               xclk->lookup->clk = clk;
+               xclk->lookup->clk = xclk->clk;
 
                clkdev_add(xclk->lookup);
        }
@@ -335,6 +342,9 @@ static void isp_xclk_cleanup(struct isp_device *isp)
        for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) {
                struct isp_xclk *xclk = &isp->xclks[i];
 
+               if (!IS_ERR(xclk->clk))
+                       clk_unregister(xclk->clk);
+
                if (xclk->lookup)
                        clkdev_drop(xclk->lookup);
        }
index ce65d3ae1aa7b8070f5161bad3caf9d4581b1cb9..d1e857e41731cf3b5c807ff0416ef117ee152ae5 100644 (file)
@@ -135,6 +135,7 @@ struct isp_xclk {
        struct isp_device *isp;
        struct clk_hw hw;
        struct clk_lookup *lookup;
+       struct clk *clk;
        enum isp_xclk_id id;
 
        spinlock_t lock;        /* Protects enabled and divider */
index 7fc5099e44b2ccf6c4b4164f37d1343d177e7d5e..4e8ca9d5570f80b40fc1c174521a0812c1c8a367 100644 (file)
@@ -324,7 +324,7 @@ config MMC_ATMELMCI
 
 config MMC_MSM
        tristate "Qualcomm SDCC Controller Support"
-       depends on MMC && ARCH_MSM
+       depends on MMC && (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50)
        help
          This provides support for the SD/MMC cell found in the
          MSM and QSD SOCs from Qualcomm. The controller also has
index f32057972dd77fe9a7487f74aa2ab727c2126db6..b931226365317b6b64ed2462c1beeb25b7857d16 100644 (file)
@@ -1683,8 +1683,6 @@ static int mmci_remove(struct amba_device *dev)
 {
        struct mmc_host *mmc = amba_get_drvdata(dev);
 
-       amba_set_drvdata(dev, NULL);
-
        if (mmc) {
                struct mmci_host *host = mmc_priv(mmc);
 
index b8ba2f794559c65fba1aed5b6eebfd82f4c364b5..330f7e3a32dd9f3694a09844106b551751235296 100644 (file)
@@ -25,7 +25,6 @@
  */
 
 #include <linux/clk.h>
-#include <linux/clk/tegra.h>
 #include <linux/delay.h>
 #include <linux/export.h>
 #include <linux/interrupt.h>
@@ -39,6 +38,7 @@
 #include <linux/of_platform.h>
 #include <linux/pci.h>
 #include <linux/platform_device.h>
+#include <linux/reset.h>
 #include <linux/sizes.h>
 #include <linux/slab.h>
 #include <linux/tegra-cpuidle.h>
@@ -259,10 +259,13 @@ struct tegra_pcie {
 
        struct clk *pex_clk;
        struct clk *afi_clk;
-       struct clk *pcie_xclk;
        struct clk *pll_e;
        struct clk *cml_clk;
 
+       struct reset_control *pex_rst;
+       struct reset_control *afi_rst;
+       struct reset_control *pcie_xrst;
+
        struct tegra_msi msi;
 
        struct list_head ports;
@@ -858,7 +861,7 @@ static int tegra_pcie_enable_controller(struct tegra_pcie *pcie)
        pads_writel(pcie, value, PADS_CTL);
 
        /* take the PCIe interface module out of reset */
-       tegra_periph_reset_deassert(pcie->pcie_xclk);
+       reset_control_deassert(pcie->pcie_xrst);
 
        /* finally enable PCIe */
        value = afi_readl(pcie, AFI_CONFIGURATION);
@@ -891,9 +894,9 @@ static void tegra_pcie_power_off(struct tegra_pcie *pcie)
 
        /* TODO: disable and unprepare clocks? */
 
-       tegra_periph_reset_assert(pcie->pcie_xclk);
-       tegra_periph_reset_assert(pcie->afi_clk);
-       tegra_periph_reset_assert(pcie->pex_clk);
+       reset_control_assert(pcie->pcie_xrst);
+       reset_control_assert(pcie->afi_rst);
+       reset_control_assert(pcie->pex_rst);
 
        tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
 
@@ -921,9 +924,9 @@ static int tegra_pcie_power_on(struct tegra_pcie *pcie)
        const struct tegra_pcie_soc_data *soc = pcie->soc_data;
        int err;
 
-       tegra_periph_reset_assert(pcie->pcie_xclk);
-       tegra_periph_reset_assert(pcie->afi_clk);
-       tegra_periph_reset_assert(pcie->pex_clk);
+       reset_control_assert(pcie->pcie_xrst);
+       reset_control_assert(pcie->afi_rst);
+       reset_control_assert(pcie->pex_rst);
 
        tegra_powergate_power_off(TEGRA_POWERGATE_PCIE);
 
@@ -952,13 +955,14 @@ static int tegra_pcie_power_on(struct tegra_pcie *pcie)
        }
 
        err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_PCIE,
-                                               pcie->pex_clk);
+                                               pcie->pex_clk,
+                                               pcie->pex_rst);
        if (err) {
                dev_err(pcie->dev, "powerup sequence failed: %d\n", err);
                return err;
        }
 
-       tegra_periph_reset_deassert(pcie->afi_clk);
+       reset_control_deassert(pcie->afi_rst);
 
        err = clk_prepare_enable(pcie->afi_clk);
        if (err < 0) {
@@ -996,10 +1000,6 @@ static int tegra_pcie_clocks_get(struct tegra_pcie *pcie)
        if (IS_ERR(pcie->afi_clk))
                return PTR_ERR(pcie->afi_clk);
 
-       pcie->pcie_xclk = devm_clk_get(pcie->dev, "pcie_xclk");
-       if (IS_ERR(pcie->pcie_xclk))
-               return PTR_ERR(pcie->pcie_xclk);
-
        pcie->pll_e = devm_clk_get(pcie->dev, "pll_e");
        if (IS_ERR(pcie->pll_e))
                return PTR_ERR(pcie->pll_e);
@@ -1013,6 +1013,23 @@ static int tegra_pcie_clocks_get(struct tegra_pcie *pcie)
        return 0;
 }
 
+static int tegra_pcie_resets_get(struct tegra_pcie *pcie)
+{
+       pcie->pex_rst = devm_reset_control_get(pcie->dev, "pex");
+       if (IS_ERR(pcie->pex_rst))
+               return PTR_ERR(pcie->pex_rst);
+
+       pcie->afi_rst = devm_reset_control_get(pcie->dev, "afi");
+       if (IS_ERR(pcie->afi_rst))
+               return PTR_ERR(pcie->afi_rst);
+
+       pcie->pcie_xrst = devm_reset_control_get(pcie->dev, "pcie_x");
+       if (IS_ERR(pcie->pcie_xrst))
+               return PTR_ERR(pcie->pcie_xrst);
+
+       return 0;
+}
+
 static int tegra_pcie_get_resources(struct tegra_pcie *pcie)
 {
        struct platform_device *pdev = to_platform_device(pcie->dev);
@@ -1025,6 +1042,12 @@ static int tegra_pcie_get_resources(struct tegra_pcie *pcie)
                return err;
        }
 
+       err = tegra_pcie_resets_get(pcie);
+       if (err) {
+               dev_err(&pdev->dev, "failed to get resets: %d\n", err);
+               return err;
+       }
+
        err = tegra_pcie_power_on(pcie);
        if (err) {
                dev_err(&pdev->dev, "failed to power up: %d\n", err);
index cd2b1a1c927579ad25e60924a866c302641105a1..53a11114927fc2278456444dc22ae6ac8f1af964 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2008,2009 STMicroelectronics
  * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it>
  *   Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com>
- * Copyright (C) 2011 Linus Walleij <linus.walleij@linaro.org>
+ * Copyright (C) 2011-2013 Linus Walleij <linus.walleij@linaro.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -33,7 +33,6 @@
 #include <linux/pinctrl/pinconf.h>
 /* Since we request GPIOs from ourself */
 #include <linux/pinctrl/consumer.h>
-#include <linux/platform_data/pinctrl-nomadik.h>
 #include "pinctrl-nomadik.h"
 #include "core.h"
 
  * Symbols in this file are called "nmk_gpio" for "nomadik gpio"
  */
 
+/*
+ * pin configurations are represented by 32-bit integers:
+ *
+ *     bit  0.. 8 - Pin Number (512 Pins Maximum)
+ *     bit  9..10 - Alternate Function Selection
+ *     bit 11..12 - Pull up/down state
+ *     bit     13 - Sleep mode behaviour
+ *     bit     14 - Direction
+ *     bit     15 - Value (if output)
+ *     bit 16..18 - SLPM pull up/down state
+ *     bit 19..20 - SLPM direction
+ *     bit 21..22 - SLPM Value (if output)
+ *     bit 23..25 - PDIS value (if input)
+ *     bit     26 - Gpio mode
+ *     bit     27 - Sleep mode
+ *
+ * to facilitate the definition, the following macros are provided
+ *
+ * PIN_CFG_DEFAULT - default config (0):
+ *                  pull up/down = disabled
+ *                  sleep mode = input/wakeup
+ *                  direction = input
+ *                  value = low
+ *                  SLPM direction = same as normal
+ *                  SLPM pull = same as normal
+ *                  SLPM value = same as normal
+ *
+ * PIN_CFG        - default config with alternate function
+ */
+
+typedef unsigned long pin_cfg_t;
+
+#define PIN_NUM_MASK           0x1ff
+#define PIN_NUM(x)             ((x) & PIN_NUM_MASK)
+
+#define PIN_ALT_SHIFT          9
+#define PIN_ALT_MASK           (0x3 << PIN_ALT_SHIFT)
+#define PIN_ALT(x)             (((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT)
+#define PIN_GPIO               (NMK_GPIO_ALT_GPIO << PIN_ALT_SHIFT)
+#define PIN_ALT_A              (NMK_GPIO_ALT_A << PIN_ALT_SHIFT)
+#define PIN_ALT_B              (NMK_GPIO_ALT_B << PIN_ALT_SHIFT)
+#define PIN_ALT_C              (NMK_GPIO_ALT_C << PIN_ALT_SHIFT)
+
+#define PIN_PULL_SHIFT         11
+#define PIN_PULL_MASK          (0x3 << PIN_PULL_SHIFT)
+#define PIN_PULL(x)            (((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT)
+#define PIN_PULL_NONE          (NMK_GPIO_PULL_NONE << PIN_PULL_SHIFT)
+#define PIN_PULL_UP            (NMK_GPIO_PULL_UP << PIN_PULL_SHIFT)
+#define PIN_PULL_DOWN          (NMK_GPIO_PULL_DOWN << PIN_PULL_SHIFT)
+
+#define PIN_SLPM_SHIFT         13
+#define PIN_SLPM_MASK          (0x1 << PIN_SLPM_SHIFT)
+#define PIN_SLPM(x)            (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT)
+#define PIN_SLPM_MAKE_INPUT    (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT)
+#define PIN_SLPM_NOCHANGE      (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT)
+/* These two replace the above in DB8500v2+ */
+#define PIN_SLPM_WAKEUP_ENABLE (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT)
+#define PIN_SLPM_WAKEUP_DISABLE        (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT)
+#define PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP PIN_SLPM_WAKEUP_DISABLE
+
+#define PIN_SLPM_GPIO  PIN_SLPM_WAKEUP_ENABLE /* In SLPM, pin is a gpio */
+#define PIN_SLPM_ALTFUNC PIN_SLPM_WAKEUP_DISABLE /* In SLPM, pin is altfunc */
+
+#define PIN_DIR_SHIFT          14
+#define PIN_DIR_MASK           (0x1 << PIN_DIR_SHIFT)
+#define PIN_DIR(x)             (((x) & PIN_DIR_MASK) >> PIN_DIR_SHIFT)
+#define PIN_DIR_INPUT          (0 << PIN_DIR_SHIFT)
+#define PIN_DIR_OUTPUT         (1 << PIN_DIR_SHIFT)
+
+#define PIN_VAL_SHIFT          15
+#define PIN_VAL_MASK           (0x1 << PIN_VAL_SHIFT)
+#define PIN_VAL(x)             (((x) & PIN_VAL_MASK) >> PIN_VAL_SHIFT)
+#define PIN_VAL_LOW            (0 << PIN_VAL_SHIFT)
+#define PIN_VAL_HIGH           (1 << PIN_VAL_SHIFT)
+
+#define PIN_SLPM_PULL_SHIFT    16
+#define PIN_SLPM_PULL_MASK     (0x7 << PIN_SLPM_PULL_SHIFT)
+#define PIN_SLPM_PULL(x)       \
+       (((x) & PIN_SLPM_PULL_MASK) >> PIN_SLPM_PULL_SHIFT)
+#define PIN_SLPM_PULL_NONE     \
+       ((1 + NMK_GPIO_PULL_NONE) << PIN_SLPM_PULL_SHIFT)
+#define PIN_SLPM_PULL_UP       \
+       ((1 + NMK_GPIO_PULL_UP) << PIN_SLPM_PULL_SHIFT)
+#define PIN_SLPM_PULL_DOWN     \
+       ((1 + NMK_GPIO_PULL_DOWN) << PIN_SLPM_PULL_SHIFT)
+
+#define PIN_SLPM_DIR_SHIFT     19
+#define PIN_SLPM_DIR_MASK      (0x3 << PIN_SLPM_DIR_SHIFT)
+#define PIN_SLPM_DIR(x)                \
+       (((x) & PIN_SLPM_DIR_MASK) >> PIN_SLPM_DIR_SHIFT)
+#define PIN_SLPM_DIR_INPUT     ((1 + 0) << PIN_SLPM_DIR_SHIFT)
+#define PIN_SLPM_DIR_OUTPUT    ((1 + 1) << PIN_SLPM_DIR_SHIFT)
+
+#define PIN_SLPM_VAL_SHIFT     21
+#define PIN_SLPM_VAL_MASK      (0x3 << PIN_SLPM_VAL_SHIFT)
+#define PIN_SLPM_VAL(x)                \
+       (((x) & PIN_SLPM_VAL_MASK) >> PIN_SLPM_VAL_SHIFT)
+#define PIN_SLPM_VAL_LOW       ((1 + 0) << PIN_SLPM_VAL_SHIFT)
+#define PIN_SLPM_VAL_HIGH      ((1 + 1) << PIN_SLPM_VAL_SHIFT)
+
+#define PIN_SLPM_PDIS_SHIFT            23
+#define PIN_SLPM_PDIS_MASK             (0x3 << PIN_SLPM_PDIS_SHIFT)
+#define PIN_SLPM_PDIS(x)       \
+       (((x) & PIN_SLPM_PDIS_MASK) >> PIN_SLPM_PDIS_SHIFT)
+#define PIN_SLPM_PDIS_NO_CHANGE                (0 << PIN_SLPM_PDIS_SHIFT)
+#define PIN_SLPM_PDIS_DISABLED         (1 << PIN_SLPM_PDIS_SHIFT)
+#define PIN_SLPM_PDIS_ENABLED          (2 << PIN_SLPM_PDIS_SHIFT)
+
+#define PIN_LOWEMI_SHIFT       25
+#define PIN_LOWEMI_MASK                (0x1 << PIN_LOWEMI_SHIFT)
+#define PIN_LOWEMI(x)          (((x) & PIN_LOWEMI_MASK) >> PIN_LOWEMI_SHIFT)
+#define PIN_LOWEMI_DISABLED    (0 << PIN_LOWEMI_SHIFT)
+#define PIN_LOWEMI_ENABLED     (1 << PIN_LOWEMI_SHIFT)
+
+#define PIN_GPIOMODE_SHIFT     26
+#define PIN_GPIOMODE_MASK      (0x1 << PIN_GPIOMODE_SHIFT)
+#define PIN_GPIOMODE(x)                (((x) & PIN_GPIOMODE_MASK) >> PIN_GPIOMODE_SHIFT)
+#define PIN_GPIOMODE_DISABLED  (0 << PIN_GPIOMODE_SHIFT)
+#define PIN_GPIOMODE_ENABLED   (1 << PIN_GPIOMODE_SHIFT)
+
+#define PIN_SLEEPMODE_SHIFT    27
+#define PIN_SLEEPMODE_MASK     (0x1 << PIN_SLEEPMODE_SHIFT)
+#define PIN_SLEEPMODE(x)       (((x) & PIN_SLEEPMODE_MASK) >> PIN_SLEEPMODE_SHIFT)
+#define PIN_SLEEPMODE_DISABLED (0 << PIN_SLEEPMODE_SHIFT)
+#define PIN_SLEEPMODE_ENABLED  (1 << PIN_SLEEPMODE_SHIFT)
+
+
+/* Shortcuts.  Use these instead of separate DIR, PULL, and VAL.  */
+#define PIN_INPUT_PULLDOWN     (PIN_DIR_INPUT | PIN_PULL_DOWN)
+#define PIN_INPUT_PULLUP       (PIN_DIR_INPUT | PIN_PULL_UP)
+#define PIN_INPUT_NOPULL       (PIN_DIR_INPUT | PIN_PULL_NONE)
+#define PIN_OUTPUT_LOW         (PIN_DIR_OUTPUT | PIN_VAL_LOW)
+#define PIN_OUTPUT_HIGH                (PIN_DIR_OUTPUT | PIN_VAL_HIGH)
+
+#define PIN_SLPM_INPUT_PULLDOWN        (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_DOWN)
+#define PIN_SLPM_INPUT_PULLUP  (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_UP)
+#define PIN_SLPM_INPUT_NOPULL  (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_NONE)
+#define PIN_SLPM_OUTPUT_LOW    (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_LOW)
+#define PIN_SLPM_OUTPUT_HIGH   (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_HIGH)
+
+#define PIN_CFG_DEFAULT                (0)
+
+#define PIN_CFG(num, alt)              \
+       (PIN_CFG_DEFAULT |\
+        (PIN_NUM(num) | PIN_##alt))
+
+#define PIN_CFG_INPUT(num, alt, pull)          \
+       (PIN_CFG_DEFAULT |\
+        (PIN_NUM(num) | PIN_##alt | PIN_INPUT_##pull))
+
+#define PIN_CFG_OUTPUT(num, alt, val)          \
+       (PIN_CFG_DEFAULT |\
+        (PIN_NUM(num) | PIN_##alt | PIN_OUTPUT_##val))
+
+/*
+ * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
+ * the "gpio" namespace for generic and cross-machine functions
+ */
+
+#define GPIO_BLOCK_SHIFT 5
+#define NMK_GPIO_PER_CHIP (1 << GPIO_BLOCK_SHIFT)
+
+/* Register in the logic block */
+#define NMK_GPIO_DAT   0x00
+#define NMK_GPIO_DATS  0x04
+#define NMK_GPIO_DATC  0x08
+#define NMK_GPIO_PDIS  0x0c
+#define NMK_GPIO_DIR   0x10
+#define NMK_GPIO_DIRS  0x14
+#define NMK_GPIO_DIRC  0x18
+#define NMK_GPIO_SLPC  0x1c
+#define NMK_GPIO_AFSLA 0x20
+#define NMK_GPIO_AFSLB 0x24
+#define NMK_GPIO_LOWEMI        0x28
+
+#define NMK_GPIO_RIMSC 0x40
+#define NMK_GPIO_FIMSC 0x44
+#define NMK_GPIO_IS    0x48
+#define NMK_GPIO_IC    0x4c
+#define NMK_GPIO_RWIMSC        0x50
+#define NMK_GPIO_FWIMSC        0x54
+#define NMK_GPIO_WKS   0x58
+/* These appear in DB8540 and later ASICs */
+#define NMK_GPIO_EDGELEVEL 0x5C
+#define NMK_GPIO_LEVEL 0x60
+
+
+/* Pull up/down values */
+enum nmk_gpio_pull {
+       NMK_GPIO_PULL_NONE,
+       NMK_GPIO_PULL_UP,
+       NMK_GPIO_PULL_DOWN,
+};
+
+/* Sleep mode */
+enum nmk_gpio_slpm {
+       NMK_GPIO_SLPM_INPUT,
+       NMK_GPIO_SLPM_WAKEUP_ENABLE = NMK_GPIO_SLPM_INPUT,
+       NMK_GPIO_SLPM_NOCHANGE,
+       NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE,
+};
+
+/*
+ * Platform data to register a block: only the initial gpio/irq number.
+ */
+struct nmk_gpio_platform_data {
+       char *name;
+       int first_gpio;
+       int first_irq;
+       int num_gpio;
+       u32 (*get_secondary_status)(unsigned int bank);
+       void (*set_ioforce)(bool enable);
+       bool supports_sleepmode;
+};
+
 struct nmk_gpio_chip {
        struct gpio_chip chip;
        struct irq_domain *domain;
@@ -1026,7 +1240,7 @@ static const struct irq_domain_ops nmk_gpio_irq_simple_ops = {
 
 static int nmk_gpio_probe(struct platform_device *dev)
 {
-       struct nmk_gpio_platform_data *pdata = dev->dev.platform_data;
+       struct nmk_gpio_platform_data *pdata;
        struct device_node *np = dev->dev.of_node;
        struct nmk_gpio_chip *nmk_chip;
        struct gpio_chip *chip;
@@ -1034,32 +1248,24 @@ static int nmk_gpio_probe(struct platform_device *dev)
        struct clk *clk;
        int secondary_irq;
        void __iomem *base;
-       int irq_start = 0;
        int irq;
        int ret;
 
-       if (!pdata && !np) {
-               dev_err(&dev->dev, "No platform data or device tree found\n");
-               return -ENODEV;
-       }
-
-       if (np) {
-               pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL);
-               if (!pdata)
-                       return -ENOMEM;
-
-               if (of_get_property(np, "st,supports-sleepmode", NULL))
-                       pdata->supports_sleepmode = true;
+       pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL);
+       if (!pdata)
+               return -ENOMEM;
 
-               if (of_property_read_u32(np, "gpio-bank", &dev->id)) {
-                       dev_err(&dev->dev, "gpio-bank property not found\n");
-                       return -EINVAL;
-               }
+       if (of_get_property(np, "st,supports-sleepmode", NULL))
+               pdata->supports_sleepmode = true;
 
-               pdata->first_gpio = dev->id * NMK_GPIO_PER_CHIP;
-               pdata->num_gpio   = NMK_GPIO_PER_CHIP;
+       if (of_property_read_u32(np, "gpio-bank", &dev->id)) {
+               dev_err(&dev->dev, "gpio-bank property not found\n");
+               return -EINVAL;
        }
 
+       pdata->first_gpio = dev->id * NMK_GPIO_PER_CHIP;
+       pdata->num_gpio = NMK_GPIO_PER_CHIP;
+
        irq = platform_get_irq(dev, 0);
        if (irq < 0)
                return irq;
@@ -1107,10 +1313,7 @@ static int nmk_gpio_probe(struct platform_device *dev)
        clk_enable(nmk_chip->clk);
        nmk_chip->lowemi = readl_relaxed(nmk_chip->addr + NMK_GPIO_LOWEMI);
        clk_disable(nmk_chip->clk);
-
-#ifdef CONFIG_OF_GPIO
        chip->of_node = np;
-#endif
 
        ret = gpiochip_add(&nmk_chip->chip);
        if (ret)
@@ -1122,10 +1325,8 @@ static int nmk_gpio_probe(struct platform_device *dev)
 
        platform_set_drvdata(dev, nmk_chip);
 
-       if (!np)
-               irq_start = pdata->first_irq;
        nmk_chip->domain = irq_domain_add_simple(np,
-                               NMK_GPIO_PER_CHIP, irq_start,
+                               NMK_GPIO_PER_CHIP, 0,
                                &nmk_gpio_irq_simple_ops, nmk_chip);
        if (!nmk_chip->domain) {
                dev_err(&dev->dev, "failed to create irqdomain\n");
@@ -1858,11 +2059,10 @@ static int nmk_pinctrl_resume(struct platform_device *pdev)
 
 static int nmk_pinctrl_probe(struct platform_device *pdev)
 {
-       const struct platform_device_id *platid = platform_get_device_id(pdev);
+       const struct of_device_id *match;
        struct device_node *np = pdev->dev.of_node;
        struct device_node *prcm_np;
        struct nmk_pinctrl *npct;
-       struct resource *res;
        unsigned int version = 0;
        int i;
 
@@ -1870,16 +2070,10 @@ static int nmk_pinctrl_probe(struct platform_device *pdev)
        if (!npct)
                return -ENOMEM;
 
-       if (platid)
-               version = platid->driver_data;
-       else if (np) {
-               const struct of_device_id *match;
-
-               match = of_match_device(nmk_pinctrl_match, &pdev->dev);
-               if (!match)
-                       return -ENODEV;
-               version = (unsigned int) match->data;
-       }
+       match = of_match_device(nmk_pinctrl_match, &pdev->dev);
+       if (!match)
+               return -ENODEV;
+       version = (unsigned int) match->data;
 
        /* Poke in other ASIC variants here */
        if (version == PINCTRL_NMK_STN8815)
@@ -1889,17 +2083,9 @@ static int nmk_pinctrl_probe(struct platform_device *pdev)
        if (version == PINCTRL_NMK_DB8540)
                nmk_pinctrl_db8540_init(&npct->soc);
 
-       if (np) {
-               prcm_np = of_parse_phandle(np, "prcm", 0);
-               if (prcm_np)
-                       npct->prcm_base = of_iomap(prcm_np, 0);
-       }
-
-       /* Allow platform passed information to over-write DT. */
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (res)
-               npct->prcm_base = devm_ioremap(&pdev->dev, res->start,
-                                              resource_size(res));
+       prcm_np = of_parse_phandle(np, "prcm", 0);
+       if (prcm_np)
+               npct->prcm_base = of_iomap(prcm_np, 0);
        if (!npct->prcm_base) {
                if (version == PINCTRL_NMK_STN8815) {
                        dev_info(&pdev->dev,
@@ -1958,13 +2144,6 @@ static struct platform_driver nmk_gpio_driver = {
        .probe = nmk_gpio_probe,
 };
 
-static const struct platform_device_id nmk_pinctrl_id[] = {
-       { "pinctrl-stn8815", PINCTRL_NMK_STN8815 },
-       { "pinctrl-db8500", PINCTRL_NMK_DB8500 },
-       { "pinctrl-db8540", PINCTRL_NMK_DB8540 },
-       { }
-};
-
 static struct platform_driver nmk_pinctrl_driver = {
        .driver = {
                .owner = THIS_MODULE,
@@ -1972,7 +2151,6 @@ static struct platform_driver nmk_pinctrl_driver = {
                .of_match_table = nmk_pinctrl_match,
        },
        .probe = nmk_pinctrl_probe,
-       .id_table = nmk_pinctrl_id,
 #ifdef CONFIG_PM
        .suspend = nmk_pinctrl_suspend,
        .resume = nmk_pinctrl_resume,
index bcd4191e10ea8ced278c469799d521e4a82dee65..d8215f1e70c747c61df871f6a4181c52852d6dfc 100644 (file)
@@ -1,13 +1,23 @@
 #ifndef PINCTRL_PINCTRL_NOMADIK_H
 #define PINCTRL_PINCTRL_NOMADIK_H
 
-#include <linux/platform_data/pinctrl-nomadik.h>
-
 /* Package definitions */
 #define PINCTRL_NMK_STN8815    0
 #define PINCTRL_NMK_DB8500     1
 #define PINCTRL_NMK_DB8540     2
 
+/* Alternate functions: function C is set in hw by setting both A and B */
+#define NMK_GPIO_ALT_GPIO      0
+#define NMK_GPIO_ALT_A 1
+#define NMK_GPIO_ALT_B 2
+#define NMK_GPIO_ALT_C (NMK_GPIO_ALT_A | NMK_GPIO_ALT_B)
+
+#define NMK_GPIO_ALT_CX_SHIFT 2
+#define NMK_GPIO_ALT_C1        ((1<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
+#define NMK_GPIO_ALT_C2        ((2<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
+#define NMK_GPIO_ALT_C3        ((3<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
+#define NMK_GPIO_ALT_C4        ((4<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
+
 #define PRCM_GPIOCR_ALTCX(pin_num,\
        altc1_used, altc1_ri, altc1_cb,\
        altc2_used, altc2_ri, altc2_cb,\
index 1e2d83f2b9957039a5dfc4416afcc6472d6c98ed..cc29832c96388c6004764f7a609b65eba55beee2 100644 (file)
@@ -1 +1,2 @@
 obj-$(CONFIG_RESET_CONTROLLER) += core.o
+obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
diff --git a/drivers/reset/reset-sunxi.c b/drivers/reset/reset-sunxi.c
new file mode 100644 (file)
index 0000000..695bd34
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * Allwinner SoCs Reset Controller driver
+ *
+ * Copyright 2013 Maxime Ripard
+ *
+ * Maxime Ripard <maxime.ripard@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/reset-controller.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+
+struct sunxi_reset_data {
+       spinlock_t                      lock;
+       void __iomem                    *membase;
+       struct reset_controller_dev     rcdev;
+};
+
+static int sunxi_reset_assert(struct reset_controller_dev *rcdev,
+                             unsigned long id)
+{
+       struct sunxi_reset_data *data = container_of(rcdev,
+                                                    struct sunxi_reset_data,
+                                                    rcdev);
+       int bank = id / BITS_PER_LONG;
+       int offset = id % BITS_PER_LONG;
+       unsigned long flags;
+       u32 reg;
+
+       spin_lock_irqsave(&data->lock, flags);
+
+       reg = readl(data->membase + (bank * 4));
+       writel(reg & ~BIT(offset), data->membase + (bank * 4));
+
+       spin_unlock_irqrestore(&data->lock, flags);
+
+       return 0;
+}
+
+static int sunxi_reset_deassert(struct reset_controller_dev *rcdev,
+                               unsigned long id)
+{
+       struct sunxi_reset_data *data = container_of(rcdev,
+                                                    struct sunxi_reset_data,
+                                                    rcdev);
+       int bank = id / BITS_PER_LONG;
+       int offset = id % BITS_PER_LONG;
+       unsigned long flags;
+       u32 reg;
+
+       spin_lock_irqsave(&data->lock, flags);
+
+       reg = readl(data->membase + (bank * 4));
+       writel(reg | BIT(offset), data->membase + (bank * 4));
+
+       spin_unlock_irqrestore(&data->lock, flags);
+
+       return 0;
+}
+
+static struct reset_control_ops sunxi_reset_ops = {
+       .assert         = sunxi_reset_assert,
+       .deassert       = sunxi_reset_deassert,
+};
+
+static int sunxi_reset_init(struct device_node *np)
+{
+       struct sunxi_reset_data *data;
+       struct resource res;
+       resource_size_t size;
+       int ret;
+
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       ret = of_address_to_resource(np, 0, &res);
+       if (ret)
+               goto err_alloc;
+
+       size = resource_size(&res);
+       if (!request_mem_region(res.start, size, np->name)) {
+               ret = -EBUSY;
+               goto err_alloc;
+       }
+
+       data->membase = ioremap(res.start, size);
+       if (!data->membase) {
+               ret = -ENOMEM;
+               goto err_alloc;
+       }
+
+       data->rcdev.owner = THIS_MODULE;
+       data->rcdev.nr_resets = size * 32;
+       data->rcdev.ops = &sunxi_reset_ops;
+       data->rcdev.of_node = np;
+       reset_controller_register(&data->rcdev);
+
+       return 0;
+
+err_alloc:
+       kfree(data);
+       return ret;
+};
+
+/*
+ * These are the reset controller we need to initialize early on in
+ * our system, before we can even think of using a regular device
+ * driver for it.
+ */
+static const struct of_device_id sunxi_early_reset_dt_ids[] __initdata = {
+       { .compatible = "allwinner,sun6i-a31-ahb1-reset", },
+       { /* sentinel */ },
+};
+
+void __init sun6i_reset_init(void)
+{
+       struct device_node *np;
+
+       for_each_matching_node(np, sunxi_early_reset_dt_ids)
+               sunxi_reset_init(np);
+}
+
+/*
+ * And these are the controllers we can register through the regular
+ * device model.
+ */
+static const struct of_device_id sunxi_reset_dt_ids[] = {
+        { .compatible = "allwinner,sun6i-a31-clock-reset", },
+        { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, sunxi_reset_dt_ids);
+
+static int sunxi_reset_probe(struct platform_device *pdev)
+{
+       return sunxi_reset_init(pdev->dev.of_node);
+}
+
+static int sunxi_reset_remove(struct platform_device *pdev)
+{
+       struct sunxi_reset_data *data = platform_get_drvdata(pdev);
+
+       reset_controller_unregister(&data->rcdev);
+       iounmap(data->membase);
+       kfree(data);
+
+       return 0;
+}
+
+static struct platform_driver sunxi_reset_driver = {
+       .probe  = sunxi_reset_probe,
+       .remove = sunxi_reset_remove,
+       .driver = {
+               .name           = "sunxi-reset",
+               .owner          = THIS_MODULE,
+               .of_match_table = sunxi_reset_dt_ids,
+       },
+};
+module_platform_driver(sunxi_reset_driver);
+
+MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com");
+MODULE_DESCRIPTION("Allwinner SoCs Reset Controller Driver");
+MODULE_LICENSE("GPL");
index 609b069a278c9d0f74886d8c06c8b63f2f91ebc2..db933decc39ce39ec26d9df0da4212d61fe3635d 100644 (file)
@@ -315,6 +315,17 @@ config RTC_DRV_ISL12022
          This driver can also be built as a module. If so, the module
          will be called rtc-isl12022.
 
+config RTC_DRV_ISL12057
+       depends on I2C
+       select REGMAP_I2C
+       tristate "Intersil ISL12057"
+       help
+         If you say yes here you get support for the Intersil ISL12057
+         I2C RTC chip.
+
+         This driver can also be built as a module. If so, the module
+         will be called rtc-isl12057.
+
 config RTC_DRV_X1205
        tristate "Xicor/Intersil X1205"
        help
@@ -1115,6 +1126,13 @@ config RTC_DRV_SUN4V
          If you say Y here you will get support for the Hypervisor
          based RTC on SUN4V systems.
 
+config RTC_DRV_SUNXI
+       tristate "Allwinner sun4i/sun7i RTC"
+       depends on ARCH_SUNXI
+       help
+         If you say Y here you will get support for the RTC found on
+         Allwinner A10/A20.
+
 config RTC_DRV_STARFIRE
        bool "Starfire RTC"
        depends on SPARC64
index 913c5bed0154b8dabfb0a98324a2f97b03d61aaa..b427bf7dd20d9330b83c14bbc47caa7f4b5e741f 100644 (file)
@@ -59,6 +59,7 @@ obj-$(CONFIG_RTC_DRV_HYM8563) += rtc-hym8563.o
 obj-$(CONFIG_RTC_DRV_IMXDI)    += rtc-imxdi.o
 obj-$(CONFIG_RTC_DRV_ISL1208)  += rtc-isl1208.o
 obj-$(CONFIG_RTC_DRV_ISL12022) += rtc-isl12022.o
+obj-$(CONFIG_RTC_DRV_ISL12057) += rtc-isl12057.o
 obj-$(CONFIG_RTC_DRV_JZ4740)   += rtc-jz4740.o
 obj-$(CONFIG_RTC_DRV_LP8788)   += rtc-lp8788.o
 obj-$(CONFIG_RTC_DRV_LPC32XX)  += rtc-lpc32xx.o
@@ -118,6 +119,7 @@ obj-$(CONFIG_RTC_DRV_STARFIRE)      += rtc-starfire.o
 obj-$(CONFIG_RTC_DRV_STK17TA8) += rtc-stk17ta8.o
 obj-$(CONFIG_RTC_DRV_STMP)     += rtc-stmp3xxx.o
 obj-$(CONFIG_RTC_DRV_SUN4V)    += rtc-sun4v.o
+obj-$(CONFIG_RTC_DRV_SUNXI)    += rtc-sunxi.o
 obj-$(CONFIG_RTC_DRV_TEGRA)    += rtc-tegra.o
 obj-$(CONFIG_RTC_DRV_TEST)     += rtc-test.o
 obj-$(CONFIG_RTC_DRV_TILE)     += rtc-tile.o
diff --git a/drivers/rtc/rtc-isl12057.c b/drivers/rtc/rtc-isl12057.c
new file mode 100644 (file)
index 0000000..7854a65
--- /dev/null
@@ -0,0 +1,310 @@
+/*
+ * rtc-isl12057 - Driver for Intersil ISL12057 I2C Real Time Clock
+ *
+ * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
+ *
+ * This work is largely based on Intersil ISL1208 driver developed by
+ * Hebert Valerio Riedel <hvr@gnu.org>.
+ *
+ * Detailed datasheet on which this development is based is available here:
+ *
+ *  http://natisbad.org/NAS2/refs/ISL12057.pdf
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/rtc.h>
+#include <linux/i2c.h>
+#include <linux/bcd.h>
+#include <linux/rtc.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+
+#define DRV_NAME "rtc-isl12057"
+
+/* RTC section */
+#define ISL12057_REG_RTC_SC    0x00    /* Seconds */
+#define ISL12057_REG_RTC_MN    0x01    /* Minutes */
+#define ISL12057_REG_RTC_HR    0x02    /* Hours */
+#define ISL12057_REG_RTC_HR_PM BIT(5)  /* AM/PM bit in 12h format */
+#define ISL12057_REG_RTC_HR_MIL BIT(6) /* 24h/12h format */
+#define ISL12057_REG_RTC_DW    0x03    /* Day of the Week */
+#define ISL12057_REG_RTC_DT    0x04    /* Date */
+#define ISL12057_REG_RTC_MO    0x05    /* Month */
+#define ISL12057_REG_RTC_YR    0x06    /* Year */
+#define ISL12057_RTC_SEC_LEN   7
+
+/* Alarm 1 section */
+#define ISL12057_REG_A1_SC     0x07    /* Alarm 1 Seconds */
+#define ISL12057_REG_A1_MN     0x08    /* Alarm 1 Minutes */
+#define ISL12057_REG_A1_HR     0x09    /* Alarm 1 Hours */
+#define ISL12057_REG_A1_HR_PM  BIT(5)  /* AM/PM bit in 12h format */
+#define ISL12057_REG_A1_HR_MIL BIT(6)  /* 24h/12h format */
+#define ISL12057_REG_A1_DWDT   0x0A    /* Alarm 1 Date / Day of the week */
+#define ISL12057_REG_A1_DWDT_B BIT(6)  /* DW / DT selection bit */
+#define ISL12057_A1_SEC_LEN    4
+
+/* Alarm 2 section */
+#define ISL12057_REG_A2_MN     0x0B    /* Alarm 2 Minutes */
+#define ISL12057_REG_A2_HR     0x0C    /* Alarm 2 Hours */
+#define ISL12057_REG_A2_DWDT   0x0D    /* Alarm 2 Date / Day of the week */
+#define ISL12057_A2_SEC_LEN    3
+
+/* Control/Status registers */
+#define ISL12057_REG_INT       0x0E
+#define ISL12057_REG_INT_A1IE  BIT(0)  /* Alarm 1 interrupt enable bit */
+#define ISL12057_REG_INT_A2IE  BIT(1)  /* Alarm 2 interrupt enable bit */
+#define ISL12057_REG_INT_INTCN BIT(2)  /* Interrupt control enable bit */
+#define ISL12057_REG_INT_RS1   BIT(3)  /* Freq out control bit 1 */
+#define ISL12057_REG_INT_RS2   BIT(4)  /* Freq out control bit 2 */
+#define ISL12057_REG_INT_EOSC  BIT(7)  /* Oscillator enable bit */
+
+#define ISL12057_REG_SR                0x0F
+#define ISL12057_REG_SR_A1F    BIT(0)  /* Alarm 1 interrupt bit */
+#define ISL12057_REG_SR_A2F    BIT(1)  /* Alarm 2 interrupt bit */
+#define ISL12057_REG_SR_OSF    BIT(7)  /* Oscillator failure bit */
+
+/* Register memory map length */
+#define ISL12057_MEM_MAP_LEN   0x10
+
+struct isl12057_rtc_data {
+       struct regmap *regmap;
+       struct mutex lock;
+};
+
+static void isl12057_rtc_regs_to_tm(struct rtc_time *tm, u8 *regs)
+{
+       tm->tm_sec = bcd2bin(regs[ISL12057_REG_RTC_SC]);
+       tm->tm_min = bcd2bin(regs[ISL12057_REG_RTC_MN]);
+
+       if (regs[ISL12057_REG_RTC_HR] & ISL12057_REG_RTC_HR_MIL) { /* AM/PM */
+               tm->tm_hour = bcd2bin(regs[ISL12057_REG_RTC_HR] & 0x0f);
+               if (regs[ISL12057_REG_RTC_HR] & ISL12057_REG_RTC_HR_PM)
+                       tm->tm_hour += 12;
+       } else {                                            /* 24 hour mode */
+               tm->tm_hour = bcd2bin(regs[ISL12057_REG_RTC_HR] & 0x3f);
+       }
+
+       tm->tm_mday = bcd2bin(regs[ISL12057_REG_RTC_DT]);
+       tm->tm_wday = bcd2bin(regs[ISL12057_REG_RTC_DW]) - 1; /* starts at 1 */
+       tm->tm_mon  = bcd2bin(regs[ISL12057_REG_RTC_MO]) - 1; /* starts at 1 */
+       tm->tm_year = bcd2bin(regs[ISL12057_REG_RTC_YR]) + 100;
+}
+
+static int isl12057_rtc_tm_to_regs(u8 *regs, struct rtc_time *tm)
+{
+       /*
+        * The clock has an 8 bit wide bcd-coded register for the year.
+        * tm_year is an offset from 1900 and we are interested in the
+        * 2000-2099 range, so any value less than 100 is invalid.
+        */
+       if (tm->tm_year < 100)
+               return -EINVAL;
+
+       regs[ISL12057_REG_RTC_SC] = bin2bcd(tm->tm_sec);
+       regs[ISL12057_REG_RTC_MN] = bin2bcd(tm->tm_min);
+       regs[ISL12057_REG_RTC_HR] = bin2bcd(tm->tm_hour); /* 24-hour format */
+       regs[ISL12057_REG_RTC_DT] = bin2bcd(tm->tm_mday);
+       regs[ISL12057_REG_RTC_MO] = bin2bcd(tm->tm_mon + 1);
+       regs[ISL12057_REG_RTC_YR] = bin2bcd(tm->tm_year - 100);
+       regs[ISL12057_REG_RTC_DW] = bin2bcd(tm->tm_wday + 1);
+
+       return 0;
+}
+
+/*
+ * Try and match register bits w/ fixed null values to see whether we
+ * are dealing with an ISL12057. Note: this function is called early
+ * during init and hence does need mutex protection.
+ */
+static int isl12057_i2c_validate_chip(struct regmap *regmap)
+{
+       u8 regs[ISL12057_MEM_MAP_LEN];
+       static const u8 mask[ISL12057_MEM_MAP_LEN] = { 0x80, 0x80, 0x80, 0xf8,
+                                                      0xc0, 0x60, 0x00, 0x00,
+                                                      0x00, 0x00, 0x00, 0x00,
+                                                      0x00, 0x00, 0x60, 0x7c };
+       int ret, i;
+
+       ret = regmap_bulk_read(regmap, 0, regs, ISL12057_MEM_MAP_LEN);
+       if (ret)
+               return ret;
+
+       for (i = 0; i < ISL12057_MEM_MAP_LEN; ++i) {
+               if (regs[i] & mask[i])  /* check if bits are cleared */
+                       return -ENODEV;
+       }
+
+       return 0;
+}
+
+static int isl12057_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+       struct isl12057_rtc_data *data = dev_get_drvdata(dev);
+       u8 regs[ISL12057_RTC_SEC_LEN];
+       int ret;
+
+       mutex_lock(&data->lock);
+       ret = regmap_bulk_read(data->regmap, ISL12057_REG_RTC_SC, regs,
+                              ISL12057_RTC_SEC_LEN);
+       mutex_unlock(&data->lock);
+
+       if (ret) {
+               dev_err(dev, "%s: RTC read failed\n", __func__);
+               return ret;
+       }
+
+       isl12057_rtc_regs_to_tm(tm, regs);
+
+       return rtc_valid_tm(tm);
+}
+
+static int isl12057_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+       struct isl12057_rtc_data *data = dev_get_drvdata(dev);
+       u8 regs[ISL12057_RTC_SEC_LEN];
+       int ret;
+
+       ret = isl12057_rtc_tm_to_regs(regs, tm);
+       if (ret)
+               return ret;
+
+       mutex_lock(&data->lock);
+       ret = regmap_bulk_write(data->regmap, ISL12057_REG_RTC_SC, regs,
+                               ISL12057_RTC_SEC_LEN);
+       mutex_unlock(&data->lock);
+
+       if (ret)
+               dev_err(dev, "%s: RTC write failed\n", __func__);
+
+       return ret;
+}
+
+/*
+ * Check current RTC status and enable/disable what needs to be. Return 0 if
+ * everything went ok and a negative value upon error. Note: this function
+ * is called early during init and hence does need mutex protection.
+ */
+static int isl12057_check_rtc_status(struct device *dev, struct regmap *regmap)
+{
+       int ret;
+
+       /* Enable oscillator if not already running */
+       ret = regmap_update_bits(regmap, ISL12057_REG_INT,
+                                ISL12057_REG_INT_EOSC, 0);
+       if (ret < 0) {
+               dev_err(dev, "Unable to enable oscillator\n");
+               return ret;
+       }
+
+       /* Clear oscillator failure bit if needed */
+       ret = regmap_update_bits(regmap, ISL12057_REG_SR,
+                                ISL12057_REG_SR_OSF, 0);
+       if (ret < 0) {
+               dev_err(dev, "Unable to clear oscillator failure bit\n");
+               return ret;
+       }
+
+       /* Clear alarm bit if needed */
+       ret = regmap_update_bits(regmap, ISL12057_REG_SR,
+                                ISL12057_REG_SR_A1F, 0);
+       if (ret < 0) {
+               dev_err(dev, "Unable to clear alarm bit\n");
+               return ret;
+       }
+
+       return 0;
+}
+
+static const struct rtc_class_ops rtc_ops = {
+       .read_time = isl12057_rtc_read_time,
+       .set_time = isl12057_rtc_set_time,
+};
+
+static struct regmap_config isl12057_rtc_regmap_config = {
+       .reg_bits = 8,
+       .val_bits = 8,
+};
+
+static int isl12057_probe(struct i2c_client *client,
+                         const struct i2c_device_id *id)
+{
+       struct device *dev = &client->dev;
+       struct isl12057_rtc_data *data;
+       struct rtc_device *rtc;
+       struct regmap *regmap;
+       int ret;
+
+       if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C |
+                                    I2C_FUNC_SMBUS_BYTE_DATA |
+                                    I2C_FUNC_SMBUS_I2C_BLOCK))
+               return -ENODEV;
+
+       regmap = devm_regmap_init_i2c(client, &isl12057_rtc_regmap_config);
+       if (IS_ERR(regmap)) {
+               ret = PTR_ERR(regmap);
+               dev_err(dev, "regmap allocation failed: %d\n", ret);
+               return ret;
+       }
+
+       ret = isl12057_i2c_validate_chip(regmap);
+       if (ret)
+               return ret;
+
+       ret = isl12057_check_rtc_status(dev, regmap);
+       if (ret)
+               return ret;
+
+       data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       mutex_init(&data->lock);
+       data->regmap = regmap;
+       dev_set_drvdata(dev, data);
+
+       rtc = devm_rtc_device_register(dev, DRV_NAME, &rtc_ops, THIS_MODULE);
+       if (IS_ERR(rtc))
+               return PTR_ERR(rtc);
+
+       return 0;
+}
+
+#ifdef CONFIG_OF
+static struct of_device_id isl12057_dt_match[] = {
+       { .compatible = "isl,isl12057" },
+       { },
+};
+#endif
+
+static const struct i2c_device_id isl12057_id[] = {
+       { "isl12057", 0 },
+       { }
+};
+MODULE_DEVICE_TABLE(i2c, isl12057_id);
+
+static struct i2c_driver isl12057_driver = {
+       .driver = {
+               .name = DRV_NAME,
+               .owner = THIS_MODULE,
+               .of_match_table = of_match_ptr(isl12057_dt_match),
+       },
+       .probe    = isl12057_probe,
+       .id_table = isl12057_id,
+};
+module_i2c_driver(isl12057_driver);
+
+MODULE_AUTHOR("Arnaud EBALARD <arno@natisbad.org>");
+MODULE_DESCRIPTION("Intersil ISL12057 RTC driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/rtc/rtc-sunxi.c b/drivers/rtc/rtc-sunxi.c
new file mode 100644 (file)
index 0000000..68a3528
--- /dev/null
@@ -0,0 +1,523 @@
+/*
+ * An RTC driver for Allwinner A10/A20
+ *
+ * Copyright (c) 2013, Carlo Caione <carlo.caione@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/rtc.h>
+#include <linux/types.h>
+
+#define SUNXI_LOSC_CTRL                                0x0000
+#define SUNXI_LOSC_CTRL_RTC_HMS_ACC            BIT(8)
+#define SUNXI_LOSC_CTRL_RTC_YMD_ACC            BIT(7)
+
+#define SUNXI_RTC_YMD                          0x0004
+
+#define SUNXI_RTC_HMS                          0x0008
+
+#define SUNXI_ALRM_DHMS                                0x000c
+
+#define SUNXI_ALRM_EN                          0x0014
+#define SUNXI_ALRM_EN_CNT_EN                   BIT(8)
+
+#define SUNXI_ALRM_IRQ_EN                      0x0018
+#define SUNXI_ALRM_IRQ_EN_CNT_IRQ_EN           BIT(0)
+
+#define SUNXI_ALRM_IRQ_STA                     0x001c
+#define SUNXI_ALRM_IRQ_STA_CNT_IRQ_PEND                BIT(0)
+
+#define SUNXI_MASK_DH                          0x0000001f
+#define SUNXI_MASK_SM                          0x0000003f
+#define SUNXI_MASK_M                           0x0000000f
+#define SUNXI_MASK_LY                          0x00000001
+#define SUNXI_MASK_D                           0x00000ffe
+#define SUNXI_MASK_M                           0x0000000f
+
+#define SUNXI_GET(x, mask, shift)              (((x) & ((mask) << (shift))) \
+                                                       >> (shift))
+
+#define SUNXI_SET(x, mask, shift)              (((x) & (mask)) << (shift))
+
+/*
+ * Get date values
+ */
+#define SUNXI_DATE_GET_DAY_VALUE(x)            SUNXI_GET(x, SUNXI_MASK_DH, 0)
+#define SUNXI_DATE_GET_MON_VALUE(x)            SUNXI_GET(x, SUNXI_MASK_M, 8)
+#define SUNXI_DATE_GET_YEAR_VALUE(x, mask)     SUNXI_GET(x, mask, 16)
+
+/*
+ * Get time values
+ */
+#define SUNXI_TIME_GET_SEC_VALUE(x)            SUNXI_GET(x, SUNXI_MASK_SM, 0)
+#define SUNXI_TIME_GET_MIN_VALUE(x)            SUNXI_GET(x, SUNXI_MASK_SM, 8)
+#define SUNXI_TIME_GET_HOUR_VALUE(x)           SUNXI_GET(x, SUNXI_MASK_DH, 16)
+
+/*
+ * Get alarm values
+ */
+#define SUNXI_ALRM_GET_SEC_VALUE(x)            SUNXI_GET(x, SUNXI_MASK_SM, 0)
+#define SUNXI_ALRM_GET_MIN_VALUE(x)            SUNXI_GET(x, SUNXI_MASK_SM, 8)
+#define SUNXI_ALRM_GET_HOUR_VALUE(x)           SUNXI_GET(x, SUNXI_MASK_DH, 16)
+
+/*
+ * Set date values
+ */
+#define SUNXI_DATE_SET_DAY_VALUE(x)            SUNXI_DATE_GET_DAY_VALUE(x)
+#define SUNXI_DATE_SET_MON_VALUE(x)            SUNXI_SET(x, SUNXI_MASK_M, 8)
+#define SUNXI_DATE_SET_YEAR_VALUE(x, mask)     SUNXI_SET(x, mask, 16)
+#define SUNXI_LEAP_SET_VALUE(x, shift)         SUNXI_SET(x, SUNXI_MASK_LY, shift)
+
+/*
+ * Set time values
+ */
+#define SUNXI_TIME_SET_SEC_VALUE(x)            SUNXI_TIME_GET_SEC_VALUE(x)
+#define SUNXI_TIME_SET_MIN_VALUE(x)            SUNXI_SET(x, SUNXI_MASK_SM, 8)
+#define SUNXI_TIME_SET_HOUR_VALUE(x)           SUNXI_SET(x, SUNXI_MASK_DH, 16)
+
+/*
+ * Set alarm values
+ */
+#define SUNXI_ALRM_SET_SEC_VALUE(x)            SUNXI_ALRM_GET_SEC_VALUE(x)
+#define SUNXI_ALRM_SET_MIN_VALUE(x)            SUNXI_SET(x, SUNXI_MASK_SM, 8)
+#define SUNXI_ALRM_SET_HOUR_VALUE(x)           SUNXI_SET(x, SUNXI_MASK_DH, 16)
+#define SUNXI_ALRM_SET_DAY_VALUE(x)            SUNXI_SET(x, SUNXI_MASK_D, 21)
+
+/*
+ * Time unit conversions
+ */
+#define SEC_IN_MIN                             60
+#define SEC_IN_HOUR                            (60 * SEC_IN_MIN)
+#define SEC_IN_DAY                             (24 * SEC_IN_HOUR)
+
+/*
+ * The year parameter passed to the driver is usually an offset relative to
+ * the year 1900. This macro is used to convert this offset to another one
+ * relative to the minimum year allowed by the hardware.
+ */
+#define SUNXI_YEAR_OFF(x)                      ((x)->min - 1900)
+
+/*
+ * min and max year are arbitrary set considering the limited range of the
+ * hardware register field
+ */
+struct sunxi_rtc_data_year {
+       unsigned int min;               /* min year allowed */
+       unsigned int max;               /* max year allowed */
+       unsigned int mask;              /* mask for the year field */
+       unsigned char leap_shift;       /* bit shift to get the leap year */
+};
+
+static struct sunxi_rtc_data_year data_year_param[] = {
+       [0] = {
+               .min            = 2010,
+               .max            = 2073,
+               .mask           = 0x3f,
+               .leap_shift     = 22,
+       },
+       [1] = {
+               .min            = 1970,
+               .max            = 2225,
+               .mask           = 0xff,
+               .leap_shift     = 24,
+       },
+};
+
+struct sunxi_rtc_dev {
+       struct rtc_device *rtc;
+       struct device *dev;
+       struct sunxi_rtc_data_year *data_year;
+       void __iomem *base;
+       int irq;
+};
+
+static irqreturn_t sunxi_rtc_alarmirq(int irq, void *id)
+{
+       struct sunxi_rtc_dev *chip = (struct sunxi_rtc_dev *) id;
+       u32 val;
+
+       val = readl(chip->base + SUNXI_ALRM_IRQ_STA);
+
+       if (val & SUNXI_ALRM_IRQ_STA_CNT_IRQ_PEND) {
+               val |= SUNXI_ALRM_IRQ_STA_CNT_IRQ_PEND;
+               writel(val, chip->base + SUNXI_ALRM_IRQ_STA);
+
+               rtc_update_irq(chip->rtc, 1, RTC_AF | RTC_IRQF);
+
+               return IRQ_HANDLED;
+       }
+
+       return IRQ_NONE;
+}
+
+static void sunxi_rtc_setaie(int to, struct sunxi_rtc_dev *chip)
+{
+       u32 alrm_val = 0;
+       u32 alrm_irq_val = 0;
+
+       if (to) {
+               alrm_val = readl(chip->base + SUNXI_ALRM_EN);
+               alrm_val |= SUNXI_ALRM_EN_CNT_EN;
+
+               alrm_irq_val = readl(chip->base + SUNXI_ALRM_IRQ_EN);
+               alrm_irq_val |= SUNXI_ALRM_IRQ_EN_CNT_IRQ_EN;
+       } else {
+               writel(SUNXI_ALRM_IRQ_STA_CNT_IRQ_PEND,
+                               chip->base + SUNXI_ALRM_IRQ_STA);
+       }
+
+       writel(alrm_val, chip->base + SUNXI_ALRM_EN);
+       writel(alrm_irq_val, chip->base + SUNXI_ALRM_IRQ_EN);
+}
+
+static int sunxi_rtc_getalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
+{
+       struct sunxi_rtc_dev *chip = dev_get_drvdata(dev);
+       struct rtc_time *alrm_tm = &wkalrm->time;
+       u32 alrm;
+       u32 alrm_en;
+       u32 date;
+
+       alrm = readl(chip->base + SUNXI_ALRM_DHMS);
+       date = readl(chip->base + SUNXI_RTC_YMD);
+
+       alrm_tm->tm_sec = SUNXI_ALRM_GET_SEC_VALUE(alrm);
+       alrm_tm->tm_min = SUNXI_ALRM_GET_MIN_VALUE(alrm);
+       alrm_tm->tm_hour = SUNXI_ALRM_GET_HOUR_VALUE(alrm);
+
+       alrm_tm->tm_mday = SUNXI_DATE_GET_DAY_VALUE(date);
+       alrm_tm->tm_mon = SUNXI_DATE_GET_MON_VALUE(date);
+       alrm_tm->tm_year = SUNXI_DATE_GET_YEAR_VALUE(date,
+                       chip->data_year->mask);
+
+       alrm_tm->tm_mon -= 1;
+
+       /*
+        * switch from (data_year->min)-relative offset to
+        * a (1900)-relative one
+        */
+       alrm_tm->tm_year += SUNXI_YEAR_OFF(chip->data_year);
+
+       alrm_en = readl(chip->base + SUNXI_ALRM_IRQ_EN);
+       if (alrm_en & SUNXI_ALRM_EN_CNT_EN)
+               wkalrm->enabled = 1;
+
+       return 0;
+}
+
+static int sunxi_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
+{
+       struct sunxi_rtc_dev *chip = dev_get_drvdata(dev);
+       u32 date, time;
+
+       /*
+        * read again in case it changes
+        */
+       do {
+               date = readl(chip->base + SUNXI_RTC_YMD);
+               time = readl(chip->base + SUNXI_RTC_HMS);
+       } while ((date != readl(chip->base + SUNXI_RTC_YMD)) ||
+                (time != readl(chip->base + SUNXI_RTC_HMS)));
+
+       rtc_tm->tm_sec  = SUNXI_TIME_GET_SEC_VALUE(time);
+       rtc_tm->tm_min  = SUNXI_TIME_GET_MIN_VALUE(time);
+       rtc_tm->tm_hour = SUNXI_TIME_GET_HOUR_VALUE(time);
+
+       rtc_tm->tm_mday = SUNXI_DATE_GET_DAY_VALUE(date);
+       rtc_tm->tm_mon  = SUNXI_DATE_GET_MON_VALUE(date);
+       rtc_tm->tm_year = SUNXI_DATE_GET_YEAR_VALUE(date,
+                                       chip->data_year->mask);
+
+       rtc_tm->tm_mon  -= 1;
+
+       /*
+        * switch from (data_year->min)-relative offset to
+        * a (1900)-relative one
+        */
+       rtc_tm->tm_year += SUNXI_YEAR_OFF(chip->data_year);
+
+       return rtc_valid_tm(rtc_tm);
+}
+
+static int sunxi_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
+{
+       struct sunxi_rtc_dev *chip = dev_get_drvdata(dev);
+       struct rtc_time *alrm_tm = &wkalrm->time;
+       struct rtc_time tm_now;
+       u32 alrm = 0;
+       unsigned long time_now = 0;
+       unsigned long time_set = 0;
+       unsigned long time_gap = 0;
+       unsigned long time_gap_day = 0;
+       unsigned long time_gap_hour = 0;
+       unsigned long time_gap_min = 0;
+       int ret = 0;
+
+       ret = sunxi_rtc_gettime(dev, &tm_now);
+       if (ret < 0) {
+               dev_err(dev, "Error in getting time\n");
+               return -EINVAL;
+       }
+
+       rtc_tm_to_time(alrm_tm, &time_set);
+       rtc_tm_to_time(&tm_now, &time_now);
+       if (time_set <= time_now) {
+               dev_err(dev, "Date to set in the past\n");
+               return -EINVAL;
+       }
+
+       time_gap = time_set - time_now;
+       time_gap_day = time_gap / SEC_IN_DAY;
+       time_gap -= time_gap_day * SEC_IN_DAY;
+       time_gap_hour = time_gap / SEC_IN_HOUR;
+       time_gap -= time_gap_hour * SEC_IN_HOUR;
+       time_gap_min = time_gap / SEC_IN_MIN;
+       time_gap -= time_gap_min * SEC_IN_MIN;
+
+       if (time_gap_day > 255) {
+               dev_err(dev, "Day must be in the range 0 - 255\n");
+               return -EINVAL;
+       }
+
+       sunxi_rtc_setaie(0, chip);
+       writel(0, chip->base + SUNXI_ALRM_DHMS);
+       usleep_range(100, 300);
+
+       alrm = SUNXI_ALRM_SET_SEC_VALUE(time_gap) |
+               SUNXI_ALRM_SET_MIN_VALUE(time_gap_min) |
+               SUNXI_ALRM_SET_HOUR_VALUE(time_gap_hour) |
+               SUNXI_ALRM_SET_DAY_VALUE(time_gap_day);
+       writel(alrm, chip->base + SUNXI_ALRM_DHMS);
+
+       writel(0, chip->base + SUNXI_ALRM_IRQ_EN);
+       writel(SUNXI_ALRM_IRQ_EN_CNT_IRQ_EN, chip->base + SUNXI_ALRM_IRQ_EN);
+
+       sunxi_rtc_setaie(wkalrm->enabled, chip);
+
+       return 0;
+}
+
+static int sunxi_rtc_wait(struct sunxi_rtc_dev *chip, int offset,
+                         unsigned int mask, unsigned int ms_timeout)
+{
+       const unsigned long timeout = jiffies + msecs_to_jiffies(ms_timeout);
+       u32 reg;
+
+       do {
+               reg = readl(chip->base + offset);
+               reg &= mask;
+
+               if (reg == mask)
+                       return 0;
+
+       } while (time_before(jiffies, timeout));
+
+       return -ETIMEDOUT;
+}
+
+static int sunxi_rtc_settime(struct device *dev, struct rtc_time *rtc_tm)
+{
+       struct sunxi_rtc_dev *chip = dev_get_drvdata(dev);
+       u32 date = 0;
+       u32 time = 0;
+       int year;
+
+       /*
+        * the input rtc_tm->tm_year is the offset relative to 1900. We use
+        * the SUNXI_YEAR_OFF macro to rebase it with respect to the min year
+        * allowed by the hardware
+        */
+
+       year = rtc_tm->tm_year + 1900;
+       if (year < chip->data_year->min || year > chip->data_year->max) {
+               dev_err(dev, "rtc only supports year in range %d - %d\n",
+                               chip->data_year->min, chip->data_year->max);
+               return -EINVAL;
+       }
+
+       rtc_tm->tm_year -= SUNXI_YEAR_OFF(chip->data_year);
+       rtc_tm->tm_mon += 1;
+
+       date = SUNXI_DATE_SET_DAY_VALUE(rtc_tm->tm_mday) |
+               SUNXI_DATE_SET_MON_VALUE(rtc_tm->tm_mon)  |
+               SUNXI_DATE_SET_YEAR_VALUE(rtc_tm->tm_year,
+                               chip->data_year->mask);
+
+       if (is_leap_year(year))
+               date |= SUNXI_LEAP_SET_VALUE(1, chip->data_year->leap_shift);
+
+       time = SUNXI_TIME_SET_SEC_VALUE(rtc_tm->tm_sec)  |
+               SUNXI_TIME_SET_MIN_VALUE(rtc_tm->tm_min)  |
+               SUNXI_TIME_SET_HOUR_VALUE(rtc_tm->tm_hour);
+
+       writel(0, chip->base + SUNXI_RTC_HMS);
+       writel(0, chip->base + SUNXI_RTC_YMD);
+
+       writel(time, chip->base + SUNXI_RTC_HMS);
+
+       /*
+        * After writing the RTC HH-MM-SS register, the
+        * SUNXI_LOSC_CTRL_RTC_HMS_ACC bit is set and it will not
+        * be cleared until the real writing operation is finished
+        */
+
+       if (sunxi_rtc_wait(chip, SUNXI_LOSC_CTRL,
+                               SUNXI_LOSC_CTRL_RTC_HMS_ACC, 50)) {
+               dev_err(dev, "Failed to set rtc time.\n");
+               return -1;
+       }
+
+       writel(date, chip->base + SUNXI_RTC_YMD);
+
+       /*
+        * After writing the RTC YY-MM-DD register, the
+        * SUNXI_LOSC_CTRL_RTC_YMD_ACC bit is set and it will not
+        * be cleared until the real writing operation is finished
+        */
+
+       if (sunxi_rtc_wait(chip, SUNXI_LOSC_CTRL,
+                               SUNXI_LOSC_CTRL_RTC_YMD_ACC, 50)) {
+               dev_err(dev, "Failed to set rtc time.\n");
+               return -1;
+       }
+
+       return 0;
+}
+
+static int sunxi_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
+{
+       struct sunxi_rtc_dev *chip = dev_get_drvdata(dev);
+
+       if (!enabled)
+               sunxi_rtc_setaie(enabled, chip);
+
+       return 0;
+}
+
+static const struct rtc_class_ops sunxi_rtc_ops = {
+       .read_time              = sunxi_rtc_gettime,
+       .set_time               = sunxi_rtc_settime,
+       .read_alarm             = sunxi_rtc_getalarm,
+       .set_alarm              = sunxi_rtc_setalarm,
+       .alarm_irq_enable       = sunxi_rtc_alarm_irq_enable
+};
+
+static const struct of_device_id sunxi_rtc_dt_ids[] = {
+       { .compatible = "allwinner,sun4i-rtc", .data = &data_year_param[0] },
+       { .compatible = "allwinner,sun7i-a20-rtc", .data = &data_year_param[1] },
+       { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, sunxi_rtc_dt_ids);
+
+static int sunxi_rtc_probe(struct platform_device *pdev)
+{
+       struct sunxi_rtc_dev *chip;
+       struct resource *res;
+       const struct of_device_id *of_id;
+       int ret;
+
+       chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
+       if (!chip)
+               return -ENOMEM;
+
+       platform_set_drvdata(pdev, chip);
+       chip->dev = &pdev->dev;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       chip->base = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(chip->base))
+               return PTR_ERR(chip->base);
+
+       chip->irq = platform_get_irq(pdev, 0);
+       if (chip->irq < 0) {
+               dev_err(&pdev->dev, "No IRQ resource\n");
+               return chip->irq;
+       }
+       ret = devm_request_irq(&pdev->dev, chip->irq, sunxi_rtc_alarmirq,
+                       0, dev_name(&pdev->dev), chip);
+       if (ret) {
+               dev_err(&pdev->dev, "Could not request IRQ\n");
+               return ret;
+       }
+
+       of_id = of_match_device(sunxi_rtc_dt_ids, &pdev->dev);
+       if (!of_id) {
+               dev_err(&pdev->dev, "Unable to setup RTC data\n");
+               return -ENODEV;
+       }
+       chip->data_year = (struct sunxi_rtc_data_year *) of_id->data;
+
+       /* clear the alarm count value */
+       writel(0, chip->base + SUNXI_ALRM_DHMS);
+
+       /* disable alarm, not generate irq pending */
+       writel(0, chip->base + SUNXI_ALRM_EN);
+
+       /* disable alarm week/cnt irq, unset to cpu */
+       writel(0, chip->base + SUNXI_ALRM_IRQ_EN);
+
+       /* clear alarm week/cnt irq pending */
+       writel(SUNXI_ALRM_IRQ_STA_CNT_IRQ_PEND, chip->base +
+                       SUNXI_ALRM_IRQ_STA);
+
+       chip->rtc = rtc_device_register("rtc-sunxi", &pdev->dev,
+                       &sunxi_rtc_ops, THIS_MODULE);
+       if (IS_ERR(chip->rtc)) {
+               dev_err(&pdev->dev, "unable to register device\n");
+               return PTR_ERR(chip->rtc);
+       }
+
+       dev_info(&pdev->dev, "RTC enabled\n");
+
+       return 0;
+}
+
+static int sunxi_rtc_remove(struct platform_device *pdev)
+{
+       struct sunxi_rtc_dev *chip = platform_get_drvdata(pdev);
+
+       rtc_device_unregister(chip->rtc);
+
+       return 0;
+}
+
+static struct platform_driver sunxi_rtc_driver = {
+       .probe          = sunxi_rtc_probe,
+       .remove         = sunxi_rtc_remove,
+       .driver         = {
+               .name           = "sunxi-rtc",
+               .owner          = THIS_MODULE,
+               .of_match_table = sunxi_rtc_dt_ids,
+       },
+};
+
+module_platform_driver(sunxi_rtc_driver);
+
+MODULE_DESCRIPTION("sunxi RTC driver");
+MODULE_AUTHOR("Carlo Caione <carlo.caione@gmail.com>");
+MODULE_LICENSE("GPL");
index e2dd2fbec5ee869f014db05a2fe8b3b616ac9d75..385602f77cadf74a0b69c7d8cda1394cb71eba73 100644 (file)
@@ -448,6 +448,7 @@ config SPI_MXS
 config SPI_TEGRA114
        tristate "NVIDIA Tegra114 SPI Controller"
        depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
+       depends on RESET_CONTROLLER
        help
          SPI driver for NVIDIA Tegra114 SPI Controller interface. This controller
          is different than the older SoCs SPI controller and also register interface
@@ -456,6 +457,7 @@ config SPI_TEGRA114
 config SPI_TEGRA20_SFLASH
        tristate "Nvidia Tegra20 Serial flash Controller"
        depends on ARCH_TEGRA || COMPILE_TEST
+       depends on RESET_CONTROLLER
        help
          SPI driver for Nvidia Tegra20 Serial flash Controller interface.
          The main usecase of this controller is to use spi flash as boot
@@ -464,6 +466,7 @@ config SPI_TEGRA20_SFLASH
 config SPI_TEGRA20_SLINK
        tristate "Nvidia Tegra20/Tegra30 SLINK Controller"
        depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
+       depends on RESET_CONTROLLER
        help
          SPI driver for Nvidia Tegra20/Tegra30 SLINK Controller interface.
 
index aaecfb3ebf580bd9f746458b26175da61f1bc994..c8604981a05840cf04b790b358807f5fb0add2ee 100644 (file)
@@ -17,7 +17,6 @@
  */
 
 #include <linux/clk.h>
-#include <linux/clk/tegra.h>
 #include <linux/completion.h>
 #include <linux/delay.h>
 #include <linux/dmaengine.h>
@@ -34,6 +33,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/reset.h>
 #include <linux/spi/spi.h>
 
 #define SPI_COMMAND1                           0x000
@@ -174,10 +174,10 @@ struct tegra_spi_data {
        spinlock_t                              lock;
 
        struct clk                              *clk;
+       struct reset_control                    *rst;
        void __iomem                            *base;
        phys_addr_t                             phys;
        unsigned                                irq;
-       int                                     dma_req_sel;
        u32                                     spi_max_frequency;
        u32                                     cur_speed;
 
@@ -600,15 +600,15 @@ static int tegra_spi_init_dma_param(struct tegra_spi_data *tspi,
        dma_addr_t dma_phys;
        int ret;
        struct dma_slave_config dma_sconfig;
-       dma_cap_mask_t mask;
 
-       dma_cap_zero(mask);
-       dma_cap_set(DMA_SLAVE, mask);
-       dma_chan = dma_request_channel(mask, NULL, NULL);
-       if (!dma_chan) {
-               dev_err(tspi->dev,
-                       "Dma channel is not available, will try later\n");
-               return -EPROBE_DEFER;
+       dma_chan = dma_request_slave_channel_reason(tspi->dev,
+                                       dma_to_memory ? "rx" : "tx");
+       if (IS_ERR(dma_chan)) {
+               ret = PTR_ERR(dma_chan);
+               if (ret != -EPROBE_DEFER)
+                       dev_err(tspi->dev,
+                               "Dma channel is not available: %d\n", ret);
+               return ret;
        }
 
        dma_buf = dma_alloc_coherent(tspi->dev, tspi->dma_buf_size,
@@ -619,7 +619,6 @@ static int tegra_spi_init_dma_param(struct tegra_spi_data *tspi,
                return -ENOMEM;
        }
 
-       dma_sconfig.slave_id = tspi->dma_req_sel;
        if (dma_to_memory) {
                dma_sconfig.src_addr = tspi->phys + SPI_RX_FIFO;
                dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
@@ -918,9 +917,9 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_spi_data *tspi)
                        tspi->status_reg);
                dev_err(tspi->dev, "CpuXfer 0x%08x:0x%08x\n",
                        tspi->command1_reg, tspi->dma_control_reg);
-               tegra_periph_reset_assert(tspi->clk);
+               reset_control_assert(tspi->rst);
                udelay(2);
-               tegra_periph_reset_deassert(tspi->clk);
+               reset_control_deassert(tspi->rst);
                complete(&tspi->xfer_completion);
                goto exit;
        }
@@ -990,9 +989,9 @@ static irqreturn_t handle_dma_based_xfer(struct tegra_spi_data *tspi)
                        tspi->status_reg);
                dev_err(tspi->dev, "DmaXfer 0x%08x:0x%08x\n",
                        tspi->command1_reg, tspi->dma_control_reg);
-               tegra_periph_reset_assert(tspi->clk);
+               reset_control_assert(tspi->rst);
                udelay(2);
-               tegra_periph_reset_deassert(tspi->clk);
+               reset_control_deassert(tspi->rst);
                complete(&tspi->xfer_completion);
                spin_unlock_irqrestore(&tspi->lock, flags);
                return IRQ_HANDLED;
@@ -1054,11 +1053,6 @@ static void tegra_spi_parse_dt(struct platform_device *pdev,
        struct tegra_spi_data *tspi)
 {
        struct device_node *np = pdev->dev.of_node;
-       u32 of_dma[2];
-
-       if (of_property_read_u32_array(np, "nvidia,dma-request-selector",
-                               of_dma, 2) >= 0)
-               tspi->dma_req_sel = of_dma[1];
 
        if (of_property_read_u32(np, "spi-max-frequency",
                                &tspi->spi_max_frequency))
@@ -1127,25 +1121,25 @@ static int tegra_spi_probe(struct platform_device *pdev)
                goto exit_free_irq;
        }
 
+       tspi->rst = devm_reset_control_get(&pdev->dev, "spi");
+       if (IS_ERR(tspi->rst)) {
+               dev_err(&pdev->dev, "can not get reset\n");
+               ret = PTR_ERR(tspi->rst);
+               goto exit_free_irq;
+       }
+
        tspi->max_buf_size = SPI_FIFO_DEPTH << 2;
        tspi->dma_buf_size = DEFAULT_SPI_DMA_BUF_LEN;
 
-       if (tspi->dma_req_sel) {
-               ret = tegra_spi_init_dma_param(tspi, true);
-               if (ret < 0) {
-                       dev_err(&pdev->dev, "RxDma Init failed, err %d\n", ret);
-                       goto exit_free_irq;
-               }
-
-               ret = tegra_spi_init_dma_param(tspi, false);
-               if (ret < 0) {
-                       dev_err(&pdev->dev, "TxDma Init failed, err %d\n", ret);
-                       goto exit_rx_dma_free;
-               }
-               tspi->max_buf_size = tspi->dma_buf_size;
-               init_completion(&tspi->tx_dma_complete);
-               init_completion(&tspi->rx_dma_complete);
-       }
+       ret = tegra_spi_init_dma_param(tspi, true);
+       if (ret < 0)
+               goto exit_free_irq;
+       ret = tegra_spi_init_dma_param(tspi, false);
+       if (ret < 0)
+               goto exit_rx_dma_free;
+       tspi->max_buf_size = tspi->dma_buf_size;
+       init_completion(&tspi->tx_dma_complete);
+       init_completion(&tspi->rx_dma_complete);
 
        init_completion(&tspi->xfer_completion);
 
index 4dc8e8129459b3eaa4bb18744e33dcbd578b0da2..e6f382b338184b4cb98b5a1b40bd0964a3ff463d 100644 (file)
@@ -32,8 +32,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/reset.h>
 #include <linux/spi/spi.h>
-#include <linux/clk/tegra.h>
 
 #define SPI_COMMAND                            0x000
 #define SPI_GO                                 BIT(30)
@@ -118,6 +118,7 @@ struct tegra_sflash_data {
        spinlock_t                              lock;
 
        struct clk                              *clk;
+       struct reset_control                    *rst;
        void __iomem                            *base;
        unsigned                                irq;
        u32                                     spi_max_frequency;
@@ -389,9 +390,9 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_sflash_data *tsd)
                dev_err(tsd->dev,
                        "CpuXfer 0x%08x:0x%08x\n", tsd->command_reg,
                                tsd->dma_control_reg);
-               tegra_periph_reset_assert(tsd->clk);
+               reset_control_assert(tsd->rst);
                udelay(2);
-               tegra_periph_reset_deassert(tsd->clk);
+               reset_control_deassert(tsd->rst);
                complete(&tsd->xfer_completion);
                goto exit;
        }
@@ -505,6 +506,13 @@ static int tegra_sflash_probe(struct platform_device *pdev)
                goto exit_free_irq;
        }
 
+       tsd->rst = devm_reset_control_get(&pdev->dev, "spi");
+       if (IS_ERR(tsd->rst)) {
+               dev_err(&pdev->dev, "can not get reset\n");
+               ret = PTR_ERR(tsd->rst);
+               goto exit_free_irq;
+       }
+
        init_completion(&tsd->xfer_completion);
        pm_runtime_enable(&pdev->dev);
        if (!pm_runtime_enabled(&pdev->dev)) {
@@ -520,9 +528,9 @@ static int tegra_sflash_probe(struct platform_device *pdev)
        }
 
        /* Reset controller */
-       tegra_periph_reset_assert(tsd->clk);
+       reset_control_assert(tsd->rst);
        udelay(2);
-       tegra_periph_reset_deassert(tsd->clk);
+       reset_control_deassert(tsd->rst);
 
        tsd->def_command_reg  = SPI_M_S | SPI_CS_SW;
        tegra_sflash_writel(tsd, tsd->def_command_reg, SPI_COMMAND);
index e66715ba37ed680811d7a53eb08e1b66979994c7..a728bb82090fa5a956b68eca4f5c613c346a2a5f 100644 (file)
@@ -33,8 +33,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/reset.h>
 #include <linux/spi/spi.h>
-#include <linux/clk/tegra.h>
 
 #define SLINK_COMMAND                  0x000
 #define SLINK_BIT_LENGTH(x)            (((x) & 0x1f) << 0)
@@ -167,10 +167,10 @@ struct tegra_slink_data {
        spinlock_t                              lock;
 
        struct clk                              *clk;
+       struct reset_control                    *rst;
        void __iomem                            *base;
        phys_addr_t                             phys;
        unsigned                                irq;
-       int                                     dma_req_sel;
        u32                                     spi_max_frequency;
        u32                                     cur_speed;
 
@@ -629,15 +629,15 @@ static int tegra_slink_init_dma_param(struct tegra_slink_data *tspi,
        dma_addr_t dma_phys;
        int ret;
        struct dma_slave_config dma_sconfig;
-       dma_cap_mask_t mask;
 
-       dma_cap_zero(mask);
-       dma_cap_set(DMA_SLAVE, mask);
-       dma_chan = dma_request_channel(mask, NULL, NULL);
-       if (!dma_chan) {
-               dev_err(tspi->dev,
-                       "Dma channel is not available, will try later\n");
-               return -EPROBE_DEFER;
+       dma_chan = dma_request_slave_channel_reason(tspi->dev,
+                                               dma_to_memory ? "rx" : "tx");
+       if (IS_ERR(dma_chan)) {
+               ret = PTR_ERR(dma_chan);
+               if (ret != -EPROBE_DEFER)
+                       dev_err(tspi->dev,
+                               "Dma channel is not available: %d\n", ret);
+               return ret;
        }
 
        dma_buf = dma_alloc_coherent(tspi->dev, tspi->dma_buf_size,
@@ -648,7 +648,6 @@ static int tegra_slink_init_dma_param(struct tegra_slink_data *tspi,
                return -ENOMEM;
        }
 
-       dma_sconfig.slave_id = tspi->dma_req_sel;
        if (dma_to_memory) {
                dma_sconfig.src_addr = tspi->phys + SLINK_RX_FIFO;
                dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
@@ -884,9 +883,9 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_slink_data *tspi)
                dev_err(tspi->dev,
                        "CpuXfer 0x%08x:0x%08x:0x%08x\n", tspi->command_reg,
                                tspi->command2_reg, tspi->dma_control_reg);
-               tegra_periph_reset_assert(tspi->clk);
+               reset_control_assert(tspi->rst);
                udelay(2);
-               tegra_periph_reset_deassert(tspi->clk);
+               reset_control_deassert(tspi->rst);
                complete(&tspi->xfer_completion);
                goto exit;
        }
@@ -957,9 +956,9 @@ static irqreturn_t handle_dma_based_xfer(struct tegra_slink_data *tspi)
                dev_err(tspi->dev,
                        "DmaXfer 0x%08x:0x%08x:0x%08x\n", tspi->command_reg,
                                tspi->command2_reg, tspi->dma_control_reg);
-               tegra_periph_reset_assert(tspi->clk);
+               reset_control_assert(tspi->rst);
                udelay(2);
-               tegra_periph_reset_deassert(tspi->clk);
+               reset_control_assert(tspi->rst);
                complete(&tspi->xfer_completion);
                spin_unlock_irqrestore(&tspi->lock, flags);
                return IRQ_HANDLED;
@@ -1020,11 +1019,6 @@ static irqreturn_t tegra_slink_isr(int irq, void *context_data)
 static void tegra_slink_parse_dt(struct tegra_slink_data *tspi)
 {
        struct device_node *np = tspi->dev->of_node;
-       u32 of_dma[2];
-
-       if (of_property_read_u32_array(np, "nvidia,dma-request-selector",
-                               of_dma, 2) >= 0)
-               tspi->dma_req_sel = of_dma[1];
 
        if (of_property_read_u32(np, "spi-max-frequency",
                                        &tspi->spi_max_frequency))
@@ -1118,25 +1112,25 @@ static int tegra_slink_probe(struct platform_device *pdev)
                goto exit_free_irq;
        }
 
+       tspi->rst = devm_reset_control_get(&pdev->dev, "spi");
+       if (IS_ERR(tspi->rst)) {
+               dev_err(&pdev->dev, "can not get reset\n");
+               ret = PTR_ERR(tspi->rst);
+               goto exit_free_irq;
+       }
+
        tspi->max_buf_size = SLINK_FIFO_DEPTH << 2;
        tspi->dma_buf_size = DEFAULT_SPI_DMA_BUF_LEN;
 
-       if (tspi->dma_req_sel) {
-               ret = tegra_slink_init_dma_param(tspi, true);
-               if (ret < 0) {
-                       dev_err(&pdev->dev, "RxDma Init failed, err %d\n", ret);
-                       goto exit_free_irq;
-               }
-
-               ret = tegra_slink_init_dma_param(tspi, false);
-               if (ret < 0) {
-                       dev_err(&pdev->dev, "TxDma Init failed, err %d\n", ret);
-                       goto exit_rx_dma_free;
-               }
-               tspi->max_buf_size = tspi->dma_buf_size;
-               init_completion(&tspi->tx_dma_complete);
-               init_completion(&tspi->rx_dma_complete);
-       }
+       ret = tegra_slink_init_dma_param(tspi, true);
+       if (ret < 0)
+               goto exit_free_irq;
+       ret = tegra_slink_init_dma_param(tspi, false);
+       if (ret < 0)
+               goto exit_rx_dma_free;
+       tspi->max_buf_size = tspi->dma_buf_size;
+       init_completion(&tspi->tx_dma_complete);
+       init_completion(&tspi->rx_dma_complete);
 
        init_completion(&tspi->xfer_completion);
 
index bb152201e93d2292835571c838c01ebf58805ed1..3ee0b1887a5474c1d0d763f0e37e34278fbb1adc 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
-#include <linux/clk/tegra.h>
 
 #include "nvec.h"
 
@@ -734,9 +733,9 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)
 
        clk_prepare_enable(nvec->i2c_clk);
 
-       tegra_periph_reset_assert(nvec->i2c_clk);
+       reset_control_assert(nvec->rst);
        udelay(2);
-       tegra_periph_reset_deassert(nvec->i2c_clk);
+       reset_control_deassert(nvec->rst);
 
        val = I2C_CNFG_NEW_MASTER_SFM | I2C_CNFG_PACKET_MODE_EN |
            (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT);
@@ -837,6 +836,12 @@ static int tegra_nvec_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
+       nvec->rst = devm_reset_control_get(&pdev->dev, "i2c");
+       if (IS_ERR(nvec->rst)) {
+               dev_err(nvec->dev, "failed to get controller reset\n");
+               return PTR_ERR(nvec->rst);
+       }
+
        nvec->base = base;
        nvec->irq = res->start;
        nvec->i2c_clk = i2c_clk;
index e880518935fb016bbf15ef8495c64527489be8ef..e271375053faa01729e1a91f096a4491e148dba0 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/list.h>
 #include <linux/mutex.h>
 #include <linux/notifier.h>
+#include <linux/reset.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
 
@@ -109,7 +110,8 @@ struct nvec_msg {
  * @irq: The IRQ of the I2C device
  * @i2c_addr: The address of the I2C slave
  * @base: The base of the memory mapped region of the I2C device
- * @clk: The clock of the I2C device
+ * @i2c_clk: The clock of the I2C device
+ * @rst: The reset of the I2C device
  * @notifier_list: Notifiers to be called on received messages, see
  *                 nvec_register_notifier()
  * @rx_data: Received messages that have to be processed
@@ -139,6 +141,7 @@ struct nvec_chip {
        int i2c_addr;
        void __iomem *base;
        struct clk *i2c_clk;
+       struct reset_control *rst;
        struct atomic_notifier_head notifier_list;
        struct list_head rx_data, tx_data;
        struct notifier_block nvec_status_notifier;
index 441ada489874e33c62096e3dd17295b6d2975ce5..a3815eaed42169171b7c878de8202e952b7e192f 100644 (file)
@@ -1034,7 +1034,7 @@ config SERIAL_MSM_CONSOLE
 
 config SERIAL_MSM_HS
        tristate "MSM UART High Speed: Serial Driver"
-       depends on ARCH_MSM
+       depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50
        select SERIAL_CORE
        help
          If you have a machine based on MSM family of SoCs, you
index dfe79ccc4fb3c66f473604c2ac867b181e6e7e00..d5c2a287b7e760728d0c38e58d08fb2361c670ee 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/of_device.h>
 #include <linux/pagemap.h>
 #include <linux/platform_device.h>
+#include <linux/reset.h>
 #include <linux/serial.h>
 #include <linux/serial_8250.h>
 #include <linux/serial_core.h>
@@ -44,8 +45,6 @@
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
 
-#include <linux/clk/tegra.h>
-
 #define TEGRA_UART_TYPE                                "TEGRA_UART"
 #define TX_EMPTY_STATUS                                (UART_LSR_TEMT | UART_LSR_THRE)
 #define BYTES_TO_ALIGN(x)                      ((unsigned long)(x) & 0x3)
@@ -103,6 +102,7 @@ struct tegra_uart_port {
        const struct tegra_uart_chip_data       *cdata;
 
        struct clk                              *uart_clk;
+       struct reset_control                    *rst;
        unsigned int                            current_baud;
 
        /* Register shadow */
@@ -120,7 +120,6 @@ struct tegra_uart_port {
        bool                                    rx_timeout;
        int                                     rx_in_progress;
        int                                     symb_bit;
-       int                                     dma_req_sel;
 
        struct dma_chan                         *rx_dma_chan;
        struct dma_chan                         *tx_dma_chan;
@@ -832,9 +831,9 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
        clk_prepare_enable(tup->uart_clk);
 
        /* Reset the UART controller to clear all previous status.*/
-       tegra_periph_reset_assert(tup->uart_clk);
+       reset_control_assert(tup->rst);
        udelay(10);
-       tegra_periph_reset_deassert(tup->uart_clk);
+       reset_control_deassert(tup->rst);
 
        tup->rx_in_progress = 0;
        tup->tx_in_progress = 0;
@@ -910,15 +909,14 @@ static int tegra_uart_dma_channel_allocate(struct tegra_uart_port *tup,
        dma_addr_t dma_phys;
        int ret;
        struct dma_slave_config dma_sconfig;
-       dma_cap_mask_t mask;
 
-       dma_cap_zero(mask);
-       dma_cap_set(DMA_SLAVE, mask);
-       dma_chan = dma_request_channel(mask, NULL, NULL);
-       if (!dma_chan) {
+       dma_chan = dma_request_slave_channel_reason(tup->uport.dev,
+                                               dma_to_memory ? "rx" : "tx");
+       if (IS_ERR(dma_chan)) {
+               ret = PTR_ERR(dma_chan);
                dev_err(tup->uport.dev,
-                       "Dma channel is not available, will try later\n");
-               return -EPROBE_DEFER;
+                       "DMA channel alloc failed: %d\n", ret);
+               return ret;
        }
 
        if (dma_to_memory) {
@@ -938,7 +936,6 @@ static int tegra_uart_dma_channel_allocate(struct tegra_uart_port *tup,
                dma_buf = tup->uport.state->xmit.buf;
        }
 
-       dma_sconfig.slave_id = tup->dma_req_sel;
        if (dma_to_memory) {
                dma_sconfig.src_addr = tup->uport.mapbase;
                dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
@@ -1222,17 +1219,8 @@ static int tegra_uart_parse_dt(struct platform_device *pdev,
        struct tegra_uart_port *tup)
 {
        struct device_node *np = pdev->dev.of_node;
-       u32 of_dma[2];
        int port;
 
-       if (of_property_read_u32_array(np, "nvidia,dma-request-selector",
-                               of_dma, 2) >= 0) {
-               tup->dma_req_sel = of_dma[1];
-       } else {
-               dev_err(&pdev->dev, "missing dma requestor in device tree\n");
-               return -EINVAL;
-       }
-
        port = of_alias_get_id(np, "serial");
        if (port < 0) {
                dev_err(&pdev->dev, "failed to get alias id, errno %d\n", port);
@@ -1320,6 +1308,12 @@ static int tegra_uart_probe(struct platform_device *pdev)
                return PTR_ERR(tup->uart_clk);
        }
 
+       tup->rst = devm_reset_control_get(&pdev->dev, "serial");
+       if (IS_ERR(tup->rst)) {
+               dev_err(&pdev->dev, "Couldn't get the reset\n");
+               return PTR_ERR(tup->rst);
+       }
+
        u->iotype = UPIO_MEM32;
        u->irq = platform_get_irq(pdev, 0);
        u->regshift = 2;
index 7d8103cd3e2ec56eacbb5a5d3f3f332597e190ff..be33d2b0613bb95a51092b1173c9d1291082a211 100644 (file)
 
 #undef DEBUG
 
-#include <linux/module.h>
+#include <linux/clk.h>
+#include <linux/console.h>
+#include <linux/ctype.h>
+#include <linux/cpufreq.h>
+#include <linux/delay.h>
+#include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
+#include <linux/err.h>
 #include <linux/errno.h>
-#include <linux/sh_dma.h>
-#include <linux/timer.h>
+#include <linux/init.h>
 #include <linux/interrupt.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/serial.h>
-#include <linux/major.h>
-#include <linux/string.h>
-#include <linux/sysrq.h>
 #include <linux/ioport.h>
+#include <linux/major.h>
+#include <linux/module.h>
 #include <linux/mm.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/console.h>
-#include <linux/platform_device.h>
-#include <linux/serial_sci.h>
 #include <linux/notifier.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
-#include <linux/cpufreq.h>
-#include <linux/clk.h>
-#include <linux/ctype.h>
-#include <linux/err.h>
-#include <linux/dmaengine.h>
-#include <linux/dma-mapping.h>
 #include <linux/scatterlist.h>
+#include <linux/serial.h>
+#include <linux/serial_sci.h>
+#include <linux/sh_dma.h>
 #include <linux/slab.h>
-#include <linux/gpio.h>
+#include <linux/string.h>
+#include <linux/sysrq.h>
+#include <linux/timer.h>
+#include <linux/tty.h>
+#include <linux/tty_flip.h>
 
 #ifdef CONFIG_SUPERH
 #include <asm/sh_bios.h>
 
 #include "sh-sci.h"
 
+/* Offsets into the sci_port->irqs array */
+enum {
+       SCIx_ERI_IRQ,
+       SCIx_RXI_IRQ,
+       SCIx_TXI_IRQ,
+       SCIx_BRI_IRQ,
+       SCIx_NR_IRQS,
+
+       SCIx_MUX_IRQ = SCIx_NR_IRQS,    /* special case */
+};
+
+#define SCIx_IRQ_IS_MUXED(port)                        \
+       ((port)->irqs[SCIx_ERI_IRQ] ==  \
+        (port)->irqs[SCIx_RXI_IRQ]) || \
+       ((port)->irqs[SCIx_ERI_IRQ] &&  \
+        ((port)->irqs[SCIx_RXI_IRQ] < 0))
+
 struct sci_port {
        struct uart_port        port;
 
        /* Platform configuration */
        struct plat_sci_port    *cfg;
+       int                     overrun_bit;
+       unsigned int            error_mask;
+       unsigned int            sampling_rate;
+
 
        /* Break timer */
        struct timer_list       break_timer;
@@ -74,8 +95,8 @@ struct sci_port {
        /* Function clock */
        struct clk              *fclk;
 
+       int                     irqs[SCIx_NR_IRQS];
        char                    *irqstr[SCIx_NR_IRQS];
-       char                    *gpiostr[SCIx_NR_FNS];
 
        struct dma_chan                 *chan_tx;
        struct dma_chan                 *chan_rx;
@@ -421,9 +442,9 @@ static void sci_port_enable(struct sci_port *sci_port)
 
        pm_runtime_get_sync(sci_port->port.dev);
 
-       clk_enable(sci_port->iclk);
+       clk_prepare_enable(sci_port->iclk);
        sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
-       clk_enable(sci_port->fclk);
+       clk_prepare_enable(sci_port->fclk);
 }
 
 static void sci_port_disable(struct sci_port *sci_port)
@@ -431,8 +452,16 @@ static void sci_port_disable(struct sci_port *sci_port)
        if (!sci_port->port.dev)
                return;
 
-       clk_disable(sci_port->fclk);
-       clk_disable(sci_port->iclk);
+       /* Cancel the break timer to ensure that the timer handler will not try
+        * to access the hardware with clocks and power disabled. Reset the
+        * break flag to make the break debouncing state machine ready for the
+        * next break.
+        */
+       del_timer_sync(&sci_port->break_timer);
+       sci_port->break_flag = 0;
+
+       clk_disable_unprepare(sci_port->fclk);
+       clk_disable_unprepare(sci_port->iclk);
 
        pm_runtime_put_sync(sci_port->port.dev);
 }
@@ -557,7 +586,7 @@ static inline int sci_rxd_in(struct uart_port *port)
                return 1;
 
        /* Cast for ARM damage */
-       return !!__raw_readb((void __iomem *)s->cfg->port_reg);
+       return !!__raw_readb((void __iomem *)(uintptr_t)s->cfg->port_reg);
 }
 
 /* ********************************************************************** *
@@ -733,8 +762,6 @@ static void sci_break_timer(unsigned long data)
 {
        struct sci_port *port = (struct sci_port *)data;
 
-       sci_port_enable(port);
-
        if (sci_rxd_in(&port->port) == 0) {
                port->break_flag = 1;
                sci_schedule_break_timer(port);
@@ -744,8 +771,6 @@ static void sci_break_timer(unsigned long data)
                sci_schedule_break_timer(port);
        } else
                port->break_flag = 0;
-
-       sci_port_disable(port);
 }
 
 static int sci_handle_errors(struct uart_port *port)
@@ -755,19 +780,15 @@ static int sci_handle_errors(struct uart_port *port)
        struct tty_port *tport = &port->state->port;
        struct sci_port *s = to_sci_port(port);
 
-       /*
-        * Handle overruns, if supported.
-        */
-       if (s->cfg->overrun_bit != SCIx_NOT_SUPPORTED) {
-               if (status & (1 << s->cfg->overrun_bit)) {
-                       port->icount.overrun++;
+       /* Handle overruns */
+       if (status & (1 << s->overrun_bit)) {
+               port->icount.overrun++;
 
-                       /* overrun error */
-                       if (tty_insert_flip_char(tport, 0, TTY_OVERRUN))
-                               copied++;
+               /* overrun error */
+               if (tty_insert_flip_char(tport, 0, TTY_OVERRUN))
+                       copied++;
 
-                       dev_notice(port->dev, "overrun error");
-               }
+               dev_notice(port->dev, "overrun error");
        }
 
        if (status & SCxSR_FER(port)) {
@@ -829,7 +850,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port)
        if (!reg->size)
                return 0;
 
-       if ((serial_port_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) {
+       if ((serial_port_in(port, SCLSR) & (1 << s->overrun_bit))) {
                serial_port_out(port, SCLSR, 0);
 
                port->icount.overrun++;
@@ -1075,19 +1096,19 @@ static int sci_request_irq(struct sci_port *port)
 
        for (i = j = 0; i < SCIx_NR_IRQS; i++, j++) {
                struct sci_irq_desc *desc;
-               unsigned int irq;
+               int irq;
 
                if (SCIx_IRQ_IS_MUXED(port)) {
                        i = SCIx_MUX_IRQ;
                        irq = up->irq;
                } else {
-                       irq = port->cfg->irqs[i];
+                       irq = port->irqs[i];
 
                        /*
                         * Certain port types won't support all of the
                         * available interrupt sources.
                         */
-                       if (unlikely(!irq))
+                       if (unlikely(irq < 0))
                                continue;
                }
 
@@ -1112,7 +1133,7 @@ static int sci_request_irq(struct sci_port *port)
 
 out_noirq:
        while (--i >= 0)
-               free_irq(port->cfg->irqs[i], port);
+               free_irq(port->irqs[i], port);
 
 out_nomem:
        while (--j >= 0)
@@ -1130,16 +1151,16 @@ static void sci_free_irq(struct sci_port *port)
         * IRQ first.
         */
        for (i = 0; i < SCIx_NR_IRQS; i++) {
-               unsigned int irq = port->cfg->irqs[i];
+               int irq = port->irqs[i];
 
                /*
                 * Certain port types won't support all of the available
                 * interrupt sources.
                 */
-               if (unlikely(!irq))
+               if (unlikely(irq < 0))
                        continue;
 
-               free_irq(port->cfg->irqs[i], port);
+               free_irq(port->irqs[i], port);
                kfree(port->irqstr[i]);
 
                if (SCIx_IRQ_IS_MUXED(port)) {
@@ -1149,67 +1170,6 @@ static void sci_free_irq(struct sci_port *port)
        }
 }
 
-static const char *sci_gpio_names[SCIx_NR_FNS] = {
-       "sck", "rxd", "txd", "cts", "rts",
-};
-
-static const char *sci_gpio_str(unsigned int index)
-{
-       return sci_gpio_names[index];
-}
-
-static void sci_init_gpios(struct sci_port *port)
-{
-       struct uart_port *up = &port->port;
-       int i;
-
-       if (!port->cfg)
-               return;
-
-       for (i = 0; i < SCIx_NR_FNS; i++) {
-               const char *desc;
-               int ret;
-
-               if (!port->cfg->gpios[i])
-                       continue;
-
-               desc = sci_gpio_str(i);
-
-               port->gpiostr[i] = kasprintf(GFP_KERNEL, "%s:%s",
-                                            dev_name(up->dev), desc);
-
-               /*
-                * If we've failed the allocation, we can still continue
-                * on with a NULL string.
-                */
-               if (!port->gpiostr[i])
-                       dev_notice(up->dev, "%s string allocation failure\n",
-                                  desc);
-
-               ret = gpio_request(port->cfg->gpios[i], port->gpiostr[i]);
-               if (unlikely(ret != 0)) {
-                       dev_notice(up->dev, "failed %s gpio request\n", desc);
-
-                       /*
-                        * If we can't get the GPIO for whatever reason,
-                        * no point in keeping the verbose string around.
-                        */
-                       kfree(port->gpiostr[i]);
-               }
-       }
-}
-
-static void sci_free_gpios(struct sci_port *port)
-{
-       int i;
-
-       for (i = 0; i < SCIx_NR_FNS; i++)
-               if (port->cfg->gpios[i]) {
-                       gpio_free(port->cfg->gpios[i]);
-                       kfree(port->gpiostr[i]);
-               }
-}
-
 static unsigned int sci_tx_empty(struct uart_port *port)
 {
        unsigned short status = serial_port_in(port, SCxSR);
@@ -1309,7 +1269,7 @@ static int sci_dma_rx_push(struct sci_port *s, size_t count)
        }
 
        if (room < count)
-               dev_warn(port->dev, "Rx overrun: dropping %u bytes\n",
+               dev_warn(port->dev, "Rx overrun: dropping %zu bytes\n",
                         count - room);
        if (!room)
                return room;
@@ -1442,7 +1402,7 @@ static void work_fn_rx(struct work_struct *work)
                int count;
 
                chan->device->device_control(chan, DMA_TERMINATE_ALL, 0);
-               dev_dbg(port->dev, "Read %u bytes with cookie %d\n",
+               dev_dbg(port->dev, "Read %zu bytes with cookie %d\n",
                        sh_desc->partial, sh_desc->cookie);
 
                spin_lock_irqsave(&port->lock, flags);
@@ -1655,7 +1615,7 @@ static void rx_timer_fn(unsigned long arg)
 
        if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
                scr &= ~0x4000;
-               enable_irq(s->cfg->irqs[1]);
+               enable_irq(s->irqs[SCIx_RXI_IRQ]);
        }
        serial_port_out(port, SCSCR, scr | SCSCR_RIE);
        dev_dbg(port->dev, "DMA Rx timed out\n");
@@ -1691,16 +1651,17 @@ static void sci_request_dma(struct uart_port *port)
                s->chan_tx = chan;
                sg_init_table(&s->sg_tx, 1);
                /* UART circular tx buffer is an aligned page. */
-               BUG_ON((int)port->state->xmit.buf & ~PAGE_MASK);
+               BUG_ON((uintptr_t)port->state->xmit.buf & ~PAGE_MASK);
                sg_set_page(&s->sg_tx, virt_to_page(port->state->xmit.buf),
-                           UART_XMIT_SIZE, (int)port->state->xmit.buf & ~PAGE_MASK);
+                           UART_XMIT_SIZE,
+                           (uintptr_t)port->state->xmit.buf & ~PAGE_MASK);
                nent = dma_map_sg(port->dev, &s->sg_tx, 1, DMA_TO_DEVICE);
                if (!nent)
                        sci_tx_dma_release(s, false);
                else
-                       dev_dbg(port->dev, "%s: mapped %d@%p to %x\n", __func__,
-                               sg_dma_len(&s->sg_tx),
-                               port->state->xmit.buf, sg_dma_address(&s->sg_tx));
+                       dev_dbg(port->dev, "%s: mapped %d@%p to %pad\n", __func__,
+                               sg_dma_len(&s->sg_tx), port->state->xmit.buf,
+                               &sg_dma_address(&s->sg_tx));
 
                s->sg_len_tx = nent;
 
@@ -1740,7 +1701,7 @@ static void sci_request_dma(struct uart_port *port)
 
                        sg_init_table(sg, 1);
                        sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx,
-                                   (int)buf[i] & ~PAGE_MASK);
+                                   (uintptr_t)buf[i] & ~PAGE_MASK);
                        sg_dma_address(sg) = dma[i];
                }
 
@@ -1808,21 +1769,11 @@ static void sci_shutdown(struct uart_port *port)
        sci_free_irq(s);
 }
 
-static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps,
+static unsigned int sci_scbrr_calc(struct sci_port *s, unsigned int bps,
                                   unsigned long freq)
 {
-       switch (algo_id) {
-       case SCBRR_ALGO_1:
-               return ((freq + 16 * bps) / (16 * bps) - 1);
-       case SCBRR_ALGO_2:
-               return ((freq + 16 * bps) / (32 * bps) - 1);
-       case SCBRR_ALGO_3:
-               return (((freq * 2) + 16 * bps) / (16 * bps) - 1);
-       case SCBRR_ALGO_4:
-               return (((freq * 2) + 16 * bps) / (32 * bps) - 1);
-       case SCBRR_ALGO_5:
-               return (((freq * 1000 / 32) / bps) - 1);
-       }
+       if (s->sampling_rate)
+               return DIV_ROUND_CLOSEST(freq, s->sampling_rate * bps) - 1;
 
        /* Warn, but use a safe default */
        WARN_ON(1);
@@ -1903,12 +1854,11 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
 
        baud = uart_get_baud_rate(port, termios, old, 0, max_baud);
        if (likely(baud && port->uartclk)) {
-               if (s->cfg->scbrr_algo_id == SCBRR_ALGO_6) {
+               if (s->cfg->type == PORT_HSCIF) {
                        sci_baud_calc_hscif(baud, port->uartclk, &t, &srr,
                                            &cks);
                } else {
-                       t = sci_scbrr_calc(s->cfg->scbrr_algo_id, baud,
-                                          port->uartclk);
+                       t = sci_scbrr_calc(s, baud, port->uartclk);
                        for (cks = 0; t >= 256 && cks <= 3; cks++)
                                t >>= 2;
                }
@@ -2115,10 +2065,6 @@ static void sci_config_port(struct uart_port *port, int flags)
 
 static int sci_verify_port(struct uart_port *port, struct serial_struct *ser)
 {
-       struct sci_port *s = to_sci_port(port);
-
-       if (ser->irq != s->cfg->irqs[SCIx_TXI_IRQ] || ser->irq > nr_irqs)
-               return -EINVAL;
        if (ser->baud_base < 2400)
                /* No paper tape reader for Mitch.. */
                return -EINVAL;
@@ -2151,11 +2097,13 @@ static struct uart_ops sci_uart_ops = {
 };
 
 static int sci_init_single(struct platform_device *dev,
-                                    struct sci_port *sci_port,
-                                    unsigned int index,
-                                    struct plat_sci_port *p)
+                          struct sci_port *sci_port, unsigned int index,
+                          struct plat_sci_port *p, bool early)
 {
        struct uart_port *port = &sci_port->port;
+       const struct resource *res;
+       unsigned int sampling_rate;
+       unsigned int i;
        int ret;
 
        sci_port->cfg   = p;
@@ -2164,31 +2112,76 @@ static int sci_init_single(struct platform_device *dev,
        port->iotype    = UPIO_MEM;
        port->line      = index;
 
+       res = platform_get_resource(dev, IORESOURCE_MEM, 0);
+       if (res == NULL)
+               return -ENOMEM;
+
+       port->mapbase = res->start;
+
+       for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i)
+               sci_port->irqs[i] = platform_get_irq(dev, i);
+
+       /* The SCI generates several interrupts. They can be muxed together or
+        * connected to different interrupt lines. In the muxed case only one
+        * interrupt resource is specified. In the non-muxed case three or four
+        * interrupt resources are specified, as the BRI interrupt is optional.
+        */
+       if (sci_port->irqs[0] < 0)
+               return -ENXIO;
+
+       if (sci_port->irqs[1] < 0) {
+               sci_port->irqs[1] = sci_port->irqs[0];
+               sci_port->irqs[2] = sci_port->irqs[0];
+               sci_port->irqs[3] = sci_port->irqs[0];
+       }
+
+       if (p->regtype == SCIx_PROBE_REGTYPE) {
+               ret = sci_probe_regmap(p);
+               if (unlikely(ret))
+                       return ret;
+       }
+
        switch (p->type) {
        case PORT_SCIFB:
                port->fifosize = 256;
+               sci_port->overrun_bit = 9;
+               sampling_rate = 16;
                break;
        case PORT_HSCIF:
                port->fifosize = 128;
+               sampling_rate = 0;
+               sci_port->overrun_bit = 0;
                break;
        case PORT_SCIFA:
                port->fifosize = 64;
+               sci_port->overrun_bit = 9;
+               sampling_rate = 16;
                break;
        case PORT_SCIF:
                port->fifosize = 16;
+               if (p->regtype == SCIx_SH7705_SCIF_REGTYPE) {
+                       sci_port->overrun_bit = 9;
+                       sampling_rate = 16;
+               } else {
+                       sci_port->overrun_bit = 0;
+                       sampling_rate = 32;
+               }
                break;
        default:
                port->fifosize = 1;
+               sci_port->overrun_bit = 5;
+               sampling_rate = 32;
                break;
        }
 
-       if (p->regtype == SCIx_PROBE_REGTYPE) {
-               ret = sci_probe_regmap(p);
-               if (unlikely(ret))
-                       return ret;
-       }
+       /* SCIFA on sh7723 and sh7724 need a custom sampling rate that doesn't
+        * match the SoC datasheet, this should be investigated. Let platform
+        * data override the sampling rate for now.
+        */
+       sci_port->sampling_rate = p->sampling_rate ? p->sampling_rate
+                               : sampling_rate;
 
-       if (dev) {
+       if (!early) {
                sci_port->iclk = clk_get(&dev->dev, "sci_ick");
                if (IS_ERR(sci_port->iclk)) {
                        sci_port->iclk = clk_get(&dev->dev, "peripheral_clk");
@@ -2208,8 +2201,6 @@ static int sci_init_single(struct platform_device *dev,
 
                port->dev = &dev->dev;
 
-               sci_init_gpios(sci_port);
-
                pm_runtime_enable(&dev->dev);
        }
 
@@ -2220,32 +2211,22 @@ static int sci_init_single(struct platform_device *dev,
        /*
         * Establish some sensible defaults for the error detection.
         */
-       if (!p->error_mask)
-               p->error_mask = (p->type == PORT_SCI) ?
+       sci_port->error_mask = (p->type == PORT_SCI) ?
                        SCI_DEFAULT_ERROR_MASK : SCIF_DEFAULT_ERROR_MASK;
 
        /*
         * Establish sensible defaults for the overrun detection, unless
         * the part has explicitly disabled support for it.
         */
-       if (p->overrun_bit != SCIx_NOT_SUPPORTED) {
-               if (p->type == PORT_SCI)
-                       p->overrun_bit = 5;
-               else if (p->scbrr_algo_id == SCBRR_ALGO_4)
-                       p->overrun_bit = 9;
-               else
-                       p->overrun_bit = 0;
 
-               /*
-                * Make the error mask inclusive of overrun detection, if
-                * supported.
-                */
-               p->error_mask |= (1 << p->overrun_bit);
-       }
+       /*
+        * Make the error mask inclusive of overrun detection, if
+        * supported.
+        */
+       sci_port->error_mask |= 1 << sci_port->overrun_bit;
 
-       port->mapbase           = p->mapbase;
        port->type              = p->type;
-       port->flags             = p->flags;
+       port->flags             = UPF_FIXED_PORT | p->flags;
        port->regshift          = p->regshift;
 
        /*
@@ -2255,7 +2236,7 @@ static int sci_init_single(struct platform_device *dev,
         *
         * For the muxed case there's nothing more to do.
         */
-       port->irq               = p->irqs[SCIx_RXI_IRQ];
+       port->irq               = sci_port->irqs[SCIx_RXI_IRQ];
        port->irqflags          = 0;
 
        port->serial_in         = sci_serial_in;
@@ -2270,8 +2251,6 @@ static int sci_init_single(struct platform_device *dev,
 
 static void sci_cleanup_single(struct sci_port *port)
 {
-       sci_free_gpios(port);
-
        clk_put(port->iclk);
        clk_put(port->fclk);
 
@@ -2387,7 +2366,7 @@ static int sci_probe_earlyprintk(struct platform_device *pdev)
 
        early_serial_console.index = pdev->id;
 
-       sci_init_single(NULL, &sci_ports[pdev->id], pdev->id, cfg);
+       sci_init_single(pdev, &sci_ports[pdev->id], pdev->id, cfg, true);
 
        serial_console_setup(&early_serial_console, early_serial_buf);
 
@@ -2437,6 +2416,83 @@ static int sci_remove(struct platform_device *dev)
        return 0;
 }
 
+struct sci_port_info {
+       unsigned int type;
+       unsigned int regtype;
+};
+
+static const struct of_device_id of_sci_match[] = {
+       {
+               .compatible = "renesas,scif",
+               .data = (void *)&(const struct sci_port_info) {
+                       .type = PORT_SCIF,
+                       .regtype = SCIx_SH4_SCIF_REGTYPE,
+               },
+       }, {
+               .compatible = "renesas,scifa",
+               .data = (void *)&(const struct sci_port_info) {
+                       .type = PORT_SCIFA,
+                       .regtype = SCIx_SCIFA_REGTYPE,
+               },
+       }, {
+               .compatible = "renesas,scifb",
+               .data = (void *)&(const struct sci_port_info) {
+                       .type = PORT_SCIFB,
+                       .regtype = SCIx_SCIFB_REGTYPE,
+               },
+       }, {
+               .compatible = "renesas,hscif",
+               .data = (void *)&(const struct sci_port_info) {
+                       .type = PORT_HSCIF,
+                       .regtype = SCIx_HSCIF_REGTYPE,
+               },
+       }, {
+               /* Terminator */
+       },
+};
+MODULE_DEVICE_TABLE(of, of_sci_match);
+
+static struct plat_sci_port *
+sci_parse_dt(struct platform_device *pdev, unsigned int *dev_id)
+{
+       struct device_node *np = pdev->dev.of_node;
+       const struct of_device_id *match;
+       const struct sci_port_info *info;
+       struct plat_sci_port *p;
+       int id;
+
+       if (!IS_ENABLED(CONFIG_OF) || !np)
+               return NULL;
+
+       match = of_match_node(of_sci_match, pdev->dev.of_node);
+       if (!match)
+               return NULL;
+
+       info = match->data;
+
+       p = devm_kzalloc(&pdev->dev, sizeof(struct plat_sci_port), GFP_KERNEL);
+       if (!p) {
+               dev_err(&pdev->dev, "failed to allocate DT config data\n");
+               return NULL;
+       }
+
+       /* Get the line number for the aliases node. */
+       id = of_alias_get_id(np, "serial");
+       if (id < 0) {
+               dev_err(&pdev->dev, "failed to get alias id (%d)\n", id);
+               return NULL;
+       }
+
+       *dev_id = id;
+
+       p->flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
+       p->type = info->type;
+       p->regtype = info->regtype;
+       p->scscr = SCSCR_RE | SCSCR_TE;
+
+       return p;
+}
+
 static int sci_probe_single(struct platform_device *dev,
                                      unsigned int index,
                                      struct plat_sci_port *p,
@@ -2454,7 +2510,7 @@ static int sci_probe_single(struct platform_device *dev,
                return -EINVAL;
        }
 
-       ret = sci_init_single(dev, sciport, index, p);
+       ret = sci_init_single(dev, sciport, index, p, false);
        if (ret)
                return ret;
 
@@ -2469,8 +2525,9 @@ static int sci_probe_single(struct platform_device *dev,
 
 static int sci_probe(struct platform_device *dev)
 {
-       struct plat_sci_port *p = dev_get_platdata(&dev->dev);
-       struct sci_port *sp = &sci_ports[dev->id];
+       struct plat_sci_port *p;
+       struct sci_port *sp;
+       unsigned int dev_id;
        int ret;
 
        /*
@@ -2481,9 +2538,24 @@ static int sci_probe(struct platform_device *dev)
        if (is_early_platform_device(dev))
                return sci_probe_earlyprintk(dev);
 
+       if (dev->dev.of_node) {
+               p = sci_parse_dt(dev, &dev_id);
+               if (p == NULL)
+                       return -EINVAL;
+       } else {
+               p = dev->dev.platform_data;
+               if (p == NULL) {
+                       dev_err(&dev->dev, "no platform data supplied\n");
+                       return -EINVAL;
+               }
+
+               dev_id = dev->id;
+       }
+
+       sp = &sci_ports[dev_id];
        platform_set_drvdata(dev, sp);
 
-       ret = sci_probe_single(dev, dev->id, p, sp);
+       ret = sci_probe_single(dev, dev_id, p, sp);
        if (ret)
                return ret;
 
@@ -2535,6 +2607,7 @@ static struct platform_driver sci_driver = {
                .name   = "sh-sci",
                .owner  = THIS_MODULE,
                .pm     = &sci_dev_pm_ops,
+               .of_match_table = of_match_ptr(of_sci_match),
        },
 };
 
index 5aca7364634c10f35c6dcb88d2ff100f9f3c84be..d5db81a0a4303fda5c5fd4d5041eff822202c3da 100644 (file)
@@ -9,7 +9,7 @@
 #define SCxSR_PER(port)                (((port)->type == PORT_SCI) ? SCI_PER    : SCIF_PER)
 #define SCxSR_BRK(port)                (((port)->type == PORT_SCI) ? 0x00       : SCIF_BRK)
 
-#define SCxSR_ERRORS(port)     (to_sci_port(port)->cfg->error_mask)
+#define SCxSR_ERRORS(port)     (to_sci_port(port)->error_mask)
 
 #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
     defined(CONFIG_CPU_SUBTYPE_SH7720) || \
index a4fdce74f883e4f5868f3efb975ec51347ef2c47..b0e540137e398cf0ae2ef643949bf1250cc02399 100644 (file)
@@ -67,7 +67,7 @@ static void tty_audit_log(const char *description, int major, int minor,
        struct task_struct *tsk = current;
        uid_t uid = from_kuid(&init_user_ns, task_uid(tsk));
        uid_t loginuid = from_kuid(&init_user_ns, audit_get_loginuid(tsk));
-       u32 sessionid = audit_get_sessionid(tsk);
+       unsigned int sessionid = audit_get_sessionid(tsk);
 
        ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY);
        if (ab) {
index 38bf67b1a97d03bbe2de7e4c4074fd5b3609ce3e..52771d4c44bc96c7974fd50e82f4256d02bc9dc2 100644 (file)
@@ -326,7 +326,7 @@ static int vbus_is_present(struct usba_udc *udc)
 
 #if defined(CONFIG_ARCH_AT91SAM9RL)
 
-#include <mach/at91_pmc.h>
+#include <linux/clk/at91_pmc.h>
 
 static void toggle_bias(int is_on)
 {
index a8f4471dae7b8d48875696ad94a528a17639e788..af28b748e87a01d840b12b3084ea063665c48485 100644 (file)
@@ -17,7 +17,6 @@
  */
 
 #include <linux/clk.h>
-#include <linux/clk/tegra.h>
 #include <linux/dma-mapping.h>
 #include <linux/err.h>
 #include <linux/gpio.h>
@@ -29,6 +28,7 @@
 #include <linux/of_gpio.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/reset.h>
 #include <linux/slab.h>
 #include <linux/usb/ehci_def.h>
 #include <linux/usb/tegra_usb_phy.h>
@@ -62,6 +62,7 @@ static int (*orig_hub_control)(struct usb_hcd *hcd,
 struct tegra_ehci_hcd {
        struct tegra_usb_phy *phy;
        struct clk *clk;
+       struct reset_control *rst;
        int port_resuming;
        bool needs_double_reset;
        enum tegra_usb_phy_port_speed port_speed;
@@ -385,13 +386,20 @@ static int tegra_ehci_probe(struct platform_device *pdev)
                goto cleanup_hcd_create;
        }
 
+       tegra->rst = devm_reset_control_get(&pdev->dev, "usb");
+       if (IS_ERR(tegra->rst)) {
+               dev_err(&pdev->dev, "Can't get ehci reset\n");
+               err = PTR_ERR(tegra->rst);
+               goto cleanup_hcd_create;
+       }
+
        err = clk_prepare_enable(tegra->clk);
        if (err)
                goto cleanup_hcd_create;
 
-       tegra_periph_reset_assert(tegra->clk);
+       reset_control_assert(tegra->rst);
        udelay(1);
-       tegra_periph_reset_deassert(tegra->clk);
+       reset_control_deassert(tegra->rst);
 
        u_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0);
        if (IS_ERR(u_phy)) {
index c6c325e4d80d8aa9d387ef32a64cb51ece7bffdd..110b4b9ebeaa1f047056b29faf6f76d9a0808ff9 100644 (file)
@@ -94,7 +94,7 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597)
        int i = 0;
 
        if (r8a66597->pdata->on_chip) {
-               clk_enable(r8a66597->clk);
+               clk_prepare_enable(r8a66597->clk);
                do {
                        r8a66597_write(r8a66597, SCKE, SYSCFG0);
                        tmp = r8a66597_read(r8a66597, SYSCFG0);
@@ -138,7 +138,7 @@ static void r8a66597_clock_disable(struct r8a66597 *r8a66597)
        udelay(1);
 
        if (r8a66597->pdata->on_chip) {
-               clk_disable(r8a66597->clk);
+               clk_disable_unprepare(r8a66597->clk);
        } else {
                r8a66597_bclr(r8a66597, PLLC, SYSCFG0);
                r8a66597_bclr(r8a66597, XCKE, SYSCFG0);
index 37752832b770d5c6bd16aaf21e6e0c8e4ed11bd9..8546c8dccd51b003fc9aba3038184cd2d0eedbea 100644 (file)
@@ -40,8 +40,6 @@
 #include <linux/usb/msm_hsusb_hw.h>
 #include <linux/regulator/consumer.h>
 
-#include <mach/clk.h>
-
 #define MSM_USB_BASE   (motg->regs)
 #define DRIVER_NAME    "msm_otg"
 
@@ -308,33 +306,30 @@ static void ulpi_init(struct msm_otg *motg)
 
 static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)
 {
-       int ret;
+       int ret = 0;
+
+       if (!motg->pdata->link_clk_reset)
+               return ret;
+
+       ret = motg->pdata->link_clk_reset(motg->clk, assert);
+       if (ret)
+               dev_err(motg->phy.dev, "usb link clk reset %s failed\n",
+                       assert ? "assert" : "deassert");
 
-       if (assert) {
-               ret = clk_reset(motg->clk, CLK_RESET_ASSERT);
-               if (ret)
-                       dev_err(motg->phy.dev, "usb hs_clk assert failed\n");
-       } else {
-               ret = clk_reset(motg->clk, CLK_RESET_DEASSERT);
-               if (ret)
-                       dev_err(motg->phy.dev, "usb hs_clk deassert failed\n");
-       }
        return ret;
 }
 
 static int msm_otg_phy_clk_reset(struct msm_otg *motg)
 {
-       int ret;
+       int ret = 0;
 
-       ret = clk_reset(motg->phy_reset_clk, CLK_RESET_ASSERT);
-       if (ret) {
-               dev_err(motg->phy.dev, "usb phy clk assert failed\n");
+       if (!motg->pdata->phy_clk_reset)
                return ret;
-       }
-       usleep_range(10000, 12000);
-       ret = clk_reset(motg->phy_reset_clk, CLK_RESET_DEASSERT);
+
+       ret = motg->pdata->phy_clk_reset(motg->phy_reset_clk);
        if (ret)
-               dev_err(motg->phy.dev, "usb phy clk deassert failed\n");
+               dev_err(motg->phy.dev, "usb phy clk reset failed\n");
+
        return ret;
 }
 
index dd625cca1ae5669d4e513a8611736c1b82d33a62..12591f6596efe54a2d9f58b3cf26547867440685 100644 (file)
@@ -247,7 +247,7 @@ MODULE_DEVICE_TABLE(of, davinci_wdt_of_match);
 
 static struct platform_driver platform_wdt_driver = {
        .driver = {
-               .name = "watchdog",
+               .name = "davinci-wdt",
                .owner  = THIS_MODULE,
                .of_match_table = davinci_wdt_of_match,
        },
@@ -267,4 +267,4 @@ MODULE_PARM_DESC(heartbeat,
                 __MODULE_STRING(DEFAULT_HEARTBEAT));
 
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:watchdog");
+MODULE_ALIAS("platform:davinci-wdt");
index 89b73e5d0fd0ca626f7b99e5236f20247553ceaf..a1865537339b011b1e31506da53f7cacdf5757c2 100644 (file)
@@ -4,9 +4,11 @@ __NR_chmod,
 __NR_fchmod,
 #ifdef __NR_chown
 __NR_chown,
-__NR_fchown,
 __NR_lchown,
 #endif
+#ifdef __NR_fchown
+__NR_fchown,
+#endif
 __NR_setxattr,
 __NR_lsetxattr,
 __NR_fsetxattr,
index e7020c57b13b8014ba8c28800e8b66dc9ea37cdb..274575d7129fc6b499c2c0ccbb4aad62af5a013a 100644 (file)
@@ -10,6 +10,12 @@ __NR_truncate,
 #ifdef __NR_truncate64
 __NR_truncate64,
 #endif
+#ifdef __NR_ftruncate
+__NR_ftruncate,
+#endif
+#ifdef __NR_ftruncate64
+__NR_ftruncate64,
+#endif
 #ifdef __NR_bind
 __NR_bind,             /* bind can affect fs object only in one way... */
 #endif
diff --git a/include/dt-bindings/clk/at91.h b/include/dt-bindings/clk/at91.h
new file mode 100644 (file)
index 0000000..0b4cb99
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * This header provides constants for AT91 pmc status.
+ *
+ * The constants defined in this header are being used in dts.
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+#ifndef _DT_BINDINGS_CLK_AT91_H
+#define _DT_BINDINGS_CLK_AT91_H
+
+#define AT91_PMC_MOSCS         0               /* MOSCS Flag */
+#define AT91_PMC_LOCKA         1               /* PLLA Lock */
+#define AT91_PMC_LOCKB         2               /* PLLB Lock */
+#define AT91_PMC_MCKRDY                3               /* Master Clock */
+#define AT91_PMC_LOCKU         6               /* UPLL Lock */
+#define AT91_PMC_PCKRDY(id)    (8 + (id))      /* Programmable Clock */
+#define AT91_PMC_MOSCSELS      16              /* Main Oscillator Selection */
+#define AT91_PMC_MOSCRCS       17              /* Main On-Chip RC */
+#define AT91_PMC_CFDEV         18              /* Clock Failure Detector Event */
+
+#endif
index 8279f427c60f650d6f89486fdd2e72b3f3696178..0ae6f5a75d2a5abcffbfbef0ebbbc20e906f8ff2 100644 (file)
@@ -19,7 +19,8 @@
 #define EXYNOS_SCLK_I2S        7
 #define EXYNOS_PCM_BUS         8
 #define EXYNOS_SCLK_PCM        9
+#define EXYNOS_ADMA            10
 
-#define EXYNOS_AUDSS_MAX_CLKS  10
+#define EXYNOS_AUDSS_MAX_CLKS  11
 
 #endif
diff --git a/include/dt-bindings/clock/exynos4.h b/include/dt-bindings/clock/exynos4.h
new file mode 100644 (file)
index 0000000..75aff33
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Andrzej Haja <a.hajda@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Device Tree binding constants for Exynos4 clock controller.
+*/
+
+#ifndef _DT_BINDINGS_CLOCK_EXYNOS_4_H
+#define _DT_BINDINGS_CLOCK_EXYNOS_4_H
+
+/* core clocks */
+#define CLK_XXTI               1
+#define CLK_XUSBXTI            2
+#define CLK_FIN_PLL            3
+#define CLK_FOUT_APLL          4
+#define CLK_FOUT_MPLL          5
+#define CLK_FOUT_EPLL          6
+#define CLK_FOUT_VPLL          7
+#define CLK_SCLK_APLL          8
+#define CLK_SCLK_MPLL          9
+#define CLK_SCLK_EPLL          10
+#define CLK_SCLK_VPLL          11
+#define CLK_ARM_CLK            12
+#define CLK_ACLK200            13
+#define CLK_ACLK100            14
+#define CLK_ACLK160            15
+#define CLK_ACLK133            16
+#define CLK_MOUT_MPLL_USER_T   17 /* Exynos4x12 only */
+#define CLK_MOUT_MPLL_USER_C   18 /* Exynos4x12 only */
+#define CLK_MOUT_CORE          19
+#define CLK_MOUT_APLL          20
+
+/* gate for special clocks (sclk) */
+#define CLK_SCLK_FIMC0         128
+#define CLK_SCLK_FIMC1         129
+#define CLK_SCLK_FIMC2         130
+#define CLK_SCLK_FIMC3         131
+#define CLK_SCLK_CAM0          132
+#define CLK_SCLK_CAM1          133
+#define CLK_SCLK_CSIS0         134
+#define CLK_SCLK_CSIS1         135
+#define CLK_SCLK_HDMI          136
+#define CLK_SCLK_MIXER         137
+#define CLK_SCLK_DAC           138
+#define CLK_SCLK_PIXEL         139
+#define CLK_SCLK_FIMD0         140
+#define CLK_SCLK_MDNIE0                141 /* Exynos4412 only */
+#define CLK_SCLK_MDNIE_PWM0    142
+#define CLK_SCLK_MIPI0         143
+#define CLK_SCLK_AUDIO0                144
+#define CLK_SCLK_MMC0          145
+#define CLK_SCLK_MMC1          146
+#define CLK_SCLK_MMC2          147
+#define CLK_SCLK_MMC3          148
+#define CLK_SCLK_MMC4          149
+#define CLK_SCLK_SATA          150 /* Exynos4210 only */
+#define CLK_SCLK_UART0         151
+#define CLK_SCLK_UART1         152
+#define CLK_SCLK_UART2         153
+#define CLK_SCLK_UART3         154
+#define CLK_SCLK_UART4         155
+#define CLK_SCLK_AUDIO1                156
+#define CLK_SCLK_AUDIO2                157
+#define CLK_SCLK_SPDIF         158
+#define CLK_SCLK_SPI0          159
+#define CLK_SCLK_SPI1          160
+#define CLK_SCLK_SPI2          161
+#define CLK_SCLK_SLIMBUS       162
+#define CLK_SCLK_FIMD1         163 /* Exynos4210 only */
+#define CLK_SCLK_MIPI1         164 /* Exynos4210 only */
+#define CLK_SCLK_PCM1          165
+#define CLK_SCLK_PCM2          166
+#define CLK_SCLK_I2S1          167
+#define CLK_SCLK_I2S2          168
+#define CLK_SCLK_MIPIHSI       169 /* Exynos4412 only */
+#define CLK_SCLK_MFC           170
+#define CLK_SCLK_PCM0          171
+#define CLK_SCLK_G3D           172
+#define CLK_SCLK_PWM_ISP       173 /* Exynos4x12 only */
+#define CLK_SCLK_SPI0_ISP      174 /* Exynos4x12 only */
+#define CLK_SCLK_SPI1_ISP      175 /* Exynos4x12 only */
+#define CLK_SCLK_UART_ISP      176 /* Exynos4x12 only */
+#define CLK_SCLK_FIMG2D                177
+
+/* gate clocks */
+#define CLK_FIMC0              256
+#define CLK_FIMC1              257
+#define CLK_FIMC2              258
+#define CLK_FIMC3              259
+#define CLK_CSIS0              260
+#define CLK_CSIS1              261
+#define CLK_JPEG               262
+#define CLK_SMMU_FIMC0         263
+#define CLK_SMMU_FIMC1         264
+#define CLK_SMMU_FIMC2         265
+#define CLK_SMMU_FIMC3         266
+#define CLK_SMMU_JPEG          267
+#define CLK_VP                 268
+#define CLK_MIXER              269
+#define CLK_TVENC              270 /* Exynos4210 only */
+#define CLK_HDMI               271
+#define CLK_SMMU_TV            272
+#define CLK_MFC                        273
+#define CLK_SMMU_MFCL          274
+#define CLK_SMMU_MFCR          275
+#define CLK_G3D                        276
+#define CLK_G2D                        277
+#define CLK_ROTATOR            278 /* Exynos4210 only */
+#define CLK_MDMA               279 /* Exynos4210 only */
+#define CLK_SMMU_G2D           280 /* Exynos4210 only */
+#define CLK_SMMU_ROTATOR       281 /* Exynos4210 only */
+#define CLK_SMMU_MDMA          282 /* Exynos4210 only */
+#define CLK_FIMD0              283
+#define CLK_MIE0               284
+#define CLK_MDNIE0             285 /* Exynos4412 only */
+#define CLK_DSIM0              286
+#define CLK_SMMU_FIMD0         287
+#define CLK_FIMD1              288 /* Exynos4210 only */
+#define CLK_MIE1               289 /* Exynos4210 only */
+#define CLK_DSIM1              290 /* Exynos4210 only */
+#define CLK_SMMU_FIMD1         291 /* Exynos4210 only */
+#define CLK_PDMA0              292
+#define CLK_PDMA1              293
+#define CLK_PCIE_PHY           294
+#define CLK_SATA_PHY           295 /* Exynos4210 only */
+#define CLK_TSI                        296
+#define CLK_SDMMC0             297
+#define CLK_SDMMC1             298
+#define CLK_SDMMC2             299
+#define CLK_SDMMC3             300
+#define CLK_SDMMC4             301
+#define CLK_SATA               302 /* Exynos4210 only */
+#define CLK_SROMC              303
+#define CLK_USB_HOST           304
+#define CLK_USB_DEVICE         305
+#define CLK_PCIE               306
+#define CLK_ONENAND            307
+#define CLK_NFCON              308
+#define CLK_SMMU_PCIE          309
+#define CLK_GPS                        310
+#define CLK_SMMU_GPS           311
+#define CLK_UART0              312
+#define CLK_UART1              313
+#define CLK_UART2              314
+#define CLK_UART3              315
+#define CLK_UART4              316
+#define CLK_I2C0               317
+#define CLK_I2C1               318
+#define CLK_I2C2               319
+#define CLK_I2C3               320
+#define CLK_I2C4               321
+#define CLK_I2C5               322
+#define CLK_I2C6               323
+#define CLK_I2C7               324
+#define CLK_I2C_HDMI           325
+#define CLK_TSADC              326
+#define CLK_SPI0               327
+#define CLK_SPI1               328
+#define CLK_SPI2               329
+#define CLK_I2S1               330
+#define CLK_I2S2               331
+#define CLK_PCM0               332
+#define CLK_I2S0               333
+#define CLK_PCM1               334
+#define CLK_PCM2               335
+#define CLK_PWM                        336
+#define CLK_SLIMBUS            337
+#define CLK_SPDIF              338
+#define CLK_AC97               339
+#define CLK_MODEMIF            340
+#define CLK_CHIPID             341
+#define CLK_SYSREG             342
+#define CLK_HDMI_CEC           343
+#define CLK_MCT                        344
+#define CLK_WDT                        345
+#define CLK_RTC                        346
+#define CLK_KEYIF              347
+#define CLK_AUDSS              348
+#define CLK_MIPI_HSI           349 /* Exynos4210 only */
+#define CLK_MDMA2              350 /* Exynos4210 only */
+#define CLK_PIXELASYNCM0       351
+#define CLK_PIXELASYNCM1       352
+#define CLK_FIMC_LITE0         353 /* Exynos4x12 only */
+#define CLK_FIMC_LITE1         354 /* Exynos4x12 only */
+#define CLK_PPMUISPX           355 /* Exynos4x12 only */
+#define CLK_PPMUISPMX          356 /* Exynos4x12 only */
+#define CLK_FIMC_ISP           357 /* Exynos4x12 only */
+#define CLK_FIMC_DRC           358 /* Exynos4x12 only */
+#define CLK_FIMC_FD            359 /* Exynos4x12 only */
+#define CLK_MCUISP             360 /* Exynos4x12 only */
+#define CLK_GICISP             361 /* Exynos4x12 only */
+#define CLK_SMMU_ISP           362 /* Exynos4x12 only */
+#define CLK_SMMU_DRC           363 /* Exynos4x12 only */
+#define CLK_SMMU_FD            364 /* Exynos4x12 only */
+#define CLK_SMMU_LITE0         365 /* Exynos4x12 only */
+#define CLK_SMMU_LITE1         366 /* Exynos4x12 only */
+#define CLK_MCUCTL_ISP         367 /* Exynos4x12 only */
+#define CLK_MPWM_ISP           368 /* Exynos4x12 only */
+#define CLK_I2C0_ISP           369 /* Exynos4x12 only */
+#define CLK_I2C1_ISP           370 /* Exynos4x12 only */
+#define CLK_MTCADC_ISP         371 /* Exynos4x12 only */
+#define CLK_PWM_ISP            372 /* Exynos4x12 only */
+#define CLK_WDT_ISP            373 /* Exynos4x12 only */
+#define CLK_UART_ISP           374 /* Exynos4x12 only */
+#define CLK_ASYNCAXIM          375 /* Exynos4x12 only */
+#define CLK_SMMU_ISPCX         376 /* Exynos4x12 only */
+#define CLK_SPI0_ISP           377 /* Exynos4x12 only */
+#define CLK_SPI1_ISP           378 /* Exynos4x12 only */
+#define CLK_PWM_ISP_SCLK       379 /* Exynos4x12 only */
+#define CLK_SPI0_ISP_SCLK      380 /* Exynos4x12 only */
+#define CLK_SPI1_ISP_SCLK      381 /* Exynos4x12 only */
+#define CLK_UART_ISP_SCLK      382 /* Exynos4x12 only */
+#define CLK_TMU_APBIF          383
+
+/* mux clocks */
+#define CLK_MOUT_FIMC0         384
+#define CLK_MOUT_FIMC1         385
+#define CLK_MOUT_FIMC2         386
+#define CLK_MOUT_FIMC3         387
+#define CLK_MOUT_CAM0          388
+#define CLK_MOUT_CAM1          389
+#define CLK_MOUT_CSIS0         390
+#define CLK_MOUT_CSIS1         391
+#define CLK_MOUT_G3D0          392
+#define CLK_MOUT_G3D1          393
+#define CLK_MOUT_G3D           394
+#define CLK_ACLK400_MCUISP     395 /* Exynos4x12 only */
+
+/* div clocks */
+#define CLK_DIV_ISP0           450 /* Exynos4x12 only */
+#define CLK_DIV_ISP1           451 /* Exynos4x12 only */
+#define CLK_DIV_MCUISP0                452 /* Exynos4x12 only */
+#define CLK_DIV_MCUISP1                453 /* Exynos4x12 only */
+#define CLK_DIV_ACLK200                454 /* Exynos4x12 only */
+#define CLK_DIV_ACLK400_MCUISP 455 /* Exynos4x12 only */
+
+/* must be greater than maximal clock id */
+#define CLK_NR_CLKS            456
+
+#endif /* _DT_BINDINGS_CLOCK_EXYNOS_4_H */
diff --git a/include/dt-bindings/clock/exynos5250.h b/include/dt-bindings/clock/exynos5250.h
new file mode 100644 (file)
index 0000000..922f2dc
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Andrzej Haja <a.hajda@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Device Tree binding constants for Exynos5250 clock controller.
+*/
+
+#ifndef _DT_BINDINGS_CLOCK_EXYNOS_5250_H
+#define _DT_BINDINGS_CLOCK_EXYNOS_5250_H
+
+/* core clocks */
+#define CLK_FIN_PLL            1
+#define CLK_FOUT_APLL          2
+#define CLK_FOUT_MPLL          3
+#define CLK_FOUT_BPLL          4
+#define CLK_FOUT_GPLL          5
+#define CLK_FOUT_CPLL          6
+#define CLK_FOUT_EPLL          7
+#define CLK_FOUT_VPLL          8
+
+/* gate for special clocks (sclk) */
+#define CLK_SCLK_CAM_BAYER     128
+#define CLK_SCLK_CAM0          129
+#define CLK_SCLK_CAM1          130
+#define CLK_SCLK_GSCL_WA       131
+#define CLK_SCLK_GSCL_WB       132
+#define CLK_SCLK_FIMD1         133
+#define CLK_SCLK_MIPI1         134
+#define CLK_SCLK_DP            135
+#define CLK_SCLK_HDMI          136
+#define CLK_SCLK_PIXEL         137
+#define CLK_SCLK_AUDIO0                138
+#define CLK_SCLK_MMC0          139
+#define CLK_SCLK_MMC1          140
+#define CLK_SCLK_MMC2          141
+#define CLK_SCLK_MMC3          142
+#define CLK_SCLK_SATA          143
+#define CLK_SCLK_USB3          144
+#define CLK_SCLK_JPEG          145
+#define CLK_SCLK_UART0         146
+#define CLK_SCLK_UART1         147
+#define CLK_SCLK_UART2         148
+#define CLK_SCLK_UART3         149
+#define CLK_SCLK_PWM           150
+#define CLK_SCLK_AUDIO1                151
+#define CLK_SCLK_AUDIO2                152
+#define CLK_SCLK_SPDIF         153
+#define CLK_SCLK_SPI0          154
+#define CLK_SCLK_SPI1          155
+#define CLK_SCLK_SPI2          156
+#define CLK_DIV_I2S1           157
+#define CLK_DIV_I2S2           158
+#define CLK_SCLK_HDMIPHY       159
+#define CLK_DIV_PCM0           160
+
+/* gate clocks */
+#define CLK_GSCL0              256
+#define CLK_GSCL1              257
+#define CLK_GSCL2              258
+#define CLK_GSCL3              259
+#define CLK_GSCL_WA            260
+#define CLK_GSCL_WB            261
+#define CLK_SMMU_GSCL0         262
+#define CLK_SMMU_GSCL1         263
+#define CLK_SMMU_GSCL2         264
+#define CLK_SMMU_GSCL3         265
+#define CLK_MFC                        266
+#define CLK_SMMU_MFCL          267
+#define CLK_SMMU_MFCR          268
+#define CLK_ROTATOR            269
+#define CLK_JPEG               270
+#define CLK_MDMA1              271
+#define CLK_SMMU_ROTATOR       272
+#define CLK_SMMU_JPEG          273
+#define CLK_SMMU_MDMA1         274
+#define CLK_PDMA0              275
+#define CLK_PDMA1              276
+#define CLK_SATA               277
+#define CLK_USBOTG             278
+#define CLK_MIPI_HSI           279
+#define CLK_SDMMC0             280
+#define CLK_SDMMC1             281
+#define CLK_SDMMC2             282
+#define CLK_SDMMC3             283
+#define CLK_SROMC              284
+#define CLK_USB2               285
+#define CLK_USB3               286
+#define CLK_SATA_PHYCTRL       287
+#define CLK_SATA_PHYI2C                288
+#define CLK_UART0              289
+#define CLK_UART1              290
+#define CLK_UART2              291
+#define CLK_UART3              292
+#define CLK_UART4              293
+#define CLK_I2C0               294
+#define CLK_I2C1               295
+#define CLK_I2C2               296
+#define CLK_I2C3               297
+#define CLK_I2C4               298
+#define CLK_I2C5               299
+#define CLK_I2C6               300
+#define CLK_I2C7               301
+#define CLK_I2C_HDMI           302
+#define CLK_ADC                        303
+#define CLK_SPI0               304
+#define CLK_SPI1               305
+#define CLK_SPI2               306
+#define CLK_I2S1               307
+#define CLK_I2S2               308
+#define CLK_PCM1               309
+#define CLK_PCM2               310
+#define CLK_PWM                        311
+#define CLK_SPDIF              312
+#define CLK_AC97               313
+#define CLK_HSI2C0             314
+#define CLK_HSI2C1             315
+#define CLK_HSI2C2             316
+#define CLK_HSI2C3             317
+#define CLK_CHIPID             318
+#define CLK_SYSREG             319
+#define CLK_PMU                        320
+#define CLK_CMU_TOP            321
+#define CLK_CMU_CORE           322
+#define CLK_CMU_MEM            323
+#define CLK_TZPC0              324
+#define CLK_TZPC1              325
+#define CLK_TZPC2              326
+#define CLK_TZPC3              327
+#define CLK_TZPC4              328
+#define CLK_TZPC5              329
+#define CLK_TZPC6              330
+#define CLK_TZPC7              331
+#define CLK_TZPC8              332
+#define CLK_TZPC9              333
+#define CLK_HDMI_CEC           334
+#define CLK_MCT                        335
+#define CLK_WDT                        336
+#define CLK_RTC                        337
+#define CLK_TMU                        338
+#define CLK_FIMD1              339
+#define CLK_MIE1               340
+#define CLK_DSIM0              341
+#define CLK_DP                 342
+#define CLK_MIXER              343
+#define CLK_HDMI               344
+#define CLK_G2D                        345
+#define CLK_MDMA0              346
+#define CLK_SMMU_MDMA0         347
+
+/* mux clocks */
+#define CLK_MOUT_HDMI          1024
+
+/* must be greater than maximal clock id */
+#define CLK_NR_CLKS            1025
+
+#endif /* _DT_BINDINGS_CLOCK_EXYNOS_5250_H */
diff --git a/include/dt-bindings/clock/exynos5420.h b/include/dt-bindings/clock/exynos5420.h
new file mode 100644 (file)
index 0000000..5eefd88
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Andrzej Haja <a.hajda@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Device Tree binding constants for Exynos5420 clock controller.
+*/
+
+#ifndef _DT_BINDINGS_CLOCK_EXYNOS_5420_H
+#define _DT_BINDINGS_CLOCK_EXYNOS_5420_H
+
+/* core clocks */
+#define CLK_FIN_PLL            1
+#define CLK_FOUT_APLL          2
+#define CLK_FOUT_CPLL          3
+#define CLK_FOUT_DPLL          4
+#define CLK_FOUT_EPLL          5
+#define CLK_FOUT_RPLL          6
+#define CLK_FOUT_IPLL          7
+#define CLK_FOUT_SPLL          8
+#define CLK_FOUT_VPLL          9
+#define CLK_FOUT_MPLL          10
+#define CLK_FOUT_BPLL          11
+#define CLK_FOUT_KPLL          12
+
+/* gate for special clocks (sclk) */
+#define CLK_SCLK_UART0         128
+#define CLK_SCLK_UART1         129
+#define CLK_SCLK_UART2         130
+#define CLK_SCLK_UART3         131
+#define CLK_SCLK_MMC0          132
+#define CLK_SCLK_MMC1          133
+#define CLK_SCLK_MMC2          134
+#define CLK_SCLK_SPI0          135
+#define CLK_SCLK_SPI1          136
+#define CLK_SCLK_SPI2          137
+#define CLK_SCLK_I2S1          138
+#define CLK_SCLK_I2S2          139
+#define CLK_SCLK_PCM1          140
+#define CLK_SCLK_PCM2          141
+#define CLK_SCLK_SPDIF         142
+#define CLK_SCLK_HDMI          143
+#define CLK_SCLK_PIXEL         144
+#define CLK_SCLK_DP1           145
+#define CLK_SCLK_MIPI1         146
+#define CLK_SCLK_FIMD1         147
+#define CLK_SCLK_MAUDIO0       148
+#define CLK_SCLK_MAUPCM0       149
+#define CLK_SCLK_USBD300       150
+#define CLK_SCLK_USBD301       151
+#define CLK_SCLK_USBPHY300     152
+#define CLK_SCLK_USBPHY301     153
+#define CLK_SCLK_UNIPRO                154
+#define CLK_SCLK_PWM           155
+#define CLK_SCLK_GSCL_WA       156
+#define CLK_SCLK_GSCL_WB       157
+#define CLK_SCLK_HDMIPHY       158
+
+/* gate clocks */
+#define CLK_ACLK66_PERIC       256
+#define CLK_UART0              257
+#define CLK_UART1              258
+#define CLK_UART2              259
+#define CLK_UART3              260
+#define CLK_I2C0               261
+#define CLK_I2C1               262
+#define CLK_I2C2               263
+#define CLK_I2C3               264
+#define CLK_I2C4               265
+#define CLK_I2C5               266
+#define CLK_I2C6               267
+#define CLK_I2C7               268
+#define CLK_I2C_HDMI           269
+#define CLK_TSADC              270
+#define CLK_SPI0               271
+#define CLK_SPI1               272
+#define CLK_SPI2               273
+#define CLK_KEYIF              274
+#define CLK_I2S1               275
+#define CLK_I2S2               276
+#define CLK_PCM1               277
+#define CLK_PCM2               278
+#define CLK_PWM                        279
+#define CLK_SPDIF              280
+#define CLK_I2C8               281
+#define CLK_I2C9               282
+#define CLK_I2C10              283
+#define CLK_ACLK66_PSGEN       300
+#define CLK_CHIPID             301
+#define CLK_SYSREG             302
+#define CLK_TZPC0              303
+#define CLK_TZPC1              304
+#define CLK_TZPC2              305
+#define CLK_TZPC3              306
+#define CLK_TZPC4              307
+#define CLK_TZPC5              308
+#define CLK_TZPC6              309
+#define CLK_TZPC7              310
+#define CLK_TZPC8              311
+#define CLK_TZPC9              312
+#define CLK_HDMI_CEC           313
+#define CLK_SECKEY             314
+#define CLK_MCT                        315
+#define CLK_WDT                        316
+#define CLK_RTC                        317
+#define CLK_TMU                        318
+#define CLK_TMU_GPU            319
+#define CLK_PCLK66_GPIO                330
+#define CLK_ACLK200_FSYS2      350
+#define CLK_MMC0               351
+#define CLK_MMC1               352
+#define CLK_MMC2               353
+#define CLK_SROMC              354
+#define CLK_UFS                        355
+#define CLK_ACLK200_FSYS       360
+#define CLK_TSI                        361
+#define CLK_PDMA0              362
+#define CLK_PDMA1              363
+#define CLK_RTIC               364
+#define CLK_USBH20             365
+#define CLK_USBD300            366
+#define CLK_USBD301            367
+#define CLK_ACLK400_MSCL       380
+#define CLK_MSCL0              381
+#define CLK_MSCL1              382
+#define CLK_MSCL2              383
+#define CLK_SMMU_MSCL0         384
+#define CLK_SMMU_MSCL1         385
+#define CLK_SMMU_MSCL2         386
+#define CLK_ACLK333            400
+#define CLK_MFC                        401
+#define CLK_SMMU_MFCL          402
+#define CLK_SMMU_MFCR          403
+#define CLK_ACLK200_DISP1      410
+#define CLK_DSIM1              411
+#define CLK_DP1                        412
+#define CLK_HDMI               413
+#define CLK_ACLK300_DISP1      420
+#define CLK_FIMD1              421
+#define CLK_SMMU_FIMD1         422
+#define CLK_ACLK166            430
+#define CLK_MIXER              431
+#define CLK_ACLK266            440
+#define CLK_ROTATOR            441
+#define CLK_MDMA1              442
+#define CLK_SMMU_ROTATOR       443
+#define CLK_SMMU_MDMA1         444
+#define CLK_ACLK300_JPEG       450
+#define CLK_JPEG               451
+#define CLK_JPEG2              452
+#define CLK_SMMU_JPEG          453
+#define CLK_ACLK300_GSCL       460
+#define CLK_SMMU_GSCL0         461
+#define CLK_SMMU_GSCL1         462
+#define CLK_GSCL_WA            463
+#define CLK_GSCL_WB            464
+#define CLK_GSCL0              465
+#define CLK_GSCL1              466
+#define CLK_CLK_3AA            467
+#define CLK_ACLK266_G2D                470
+#define CLK_SSS                        471
+#define CLK_SLIM_SSS           472
+#define CLK_MDMA0              473
+#define CLK_ACLK333_G2D                480
+#define CLK_G2D                        481
+#define CLK_ACLK333_432_GSCL   490
+#define CLK_SMMU_3AA           491
+#define CLK_SMMU_FIMCL0                492
+#define CLK_SMMU_FIMCL1                493
+#define CLK_SMMU_FIMCL3                494
+#define CLK_FIMC_LITE3         495
+#define CLK_ACLK_G3D           500
+#define CLK_G3D                        501
+#define CLK_SMMU_MIXER         502
+
+/* mux clocks */
+#define CLK_MOUT_HDMI          640
+
+/* divider clocks */
+#define CLK_DOUT_PIXEL         768
+
+/* must be greater than maximal clock id */
+#define CLK_NR_CLKS            769
+
+#endif /* _DT_BINDINGS_CLOCK_EXYNOS_5420_H */
diff --git a/include/dt-bindings/clock/exynos5440.h b/include/dt-bindings/clock/exynos5440.h
new file mode 100644 (file)
index 0000000..70cd850
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Andrzej Haja <a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Device Tree binding constants for Exynos5440 clock controller.
+*/
+
+#ifndef _DT_BINDINGS_CLOCK_EXYNOS_5440_H
+#define _DT_BINDINGS_CLOCK_EXYNOS_5440_H
+
+#define CLK_XTAL               1
+#define CLK_ARM_CLK            2
+#define CLK_SPI_BAUD           16
+#define CLK_PB0_250            17
+#define CLK_PR0_250            18
+#define CLK_PR1_250            19
+#define CLK_B_250              20
+#define CLK_B_125              21
+#define CLK_B_200              22
+#define CLK_SATA               23
+#define CLK_USB                        24
+#define CLK_GMAC0              25
+#define CLK_CS250              26
+#define CLK_PB0_250_O          27
+#define CLK_PR0_250_O          28
+#define CLK_PR1_250_O          29
+#define CLK_B_250_O            30
+#define CLK_B_125_O            31
+#define CLK_B_200_O            32
+#define CLK_SATA_O             33
+#define CLK_USB_O              34
+#define CLK_GMAC0_O            35
+#define CLK_CS250_O            36
+
+/* must be greater than maximal clock id */
+#define CLK_NR_CLKS            37
+
+#endif /* _DT_BINDINGS_CLOCK_EXYNOS_5440_H */
diff --git a/include/dt-bindings/clock/hi3620-clock.h b/include/dt-bindings/clock/hi3620-clock.h
new file mode 100644 (file)
index 0000000..6eaa6a4
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2012-2013 Hisilicon Limited.
+ * Copyright (c) 2012-2013 Linaro Limited.
+ *
+ * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
+ *        Xin Li <li.xin@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifndef __DTS_HI3620_CLOCK_H
+#define __DTS_HI3620_CLOCK_H
+
+#define HI3620_NONE_CLOCK      0
+
+/* fixed rate & fixed factor clocks */
+#define HI3620_OSC32K          1
+#define HI3620_OSC26M          2
+#define HI3620_PCLK            3
+#define HI3620_PLL_ARM0                4
+#define HI3620_PLL_ARM1                5
+#define HI3620_PLL_PERI                6
+#define HI3620_PLL_USB         7
+#define HI3620_PLL_HDMI                8
+#define HI3620_PLL_GPU         9
+#define HI3620_RCLK_TCXO       10
+#define HI3620_RCLK_CFGAXI     11
+#define HI3620_RCLK_PICO       12
+
+/* mux clocks */
+#define HI3620_TIMER0_MUX      32
+#define HI3620_TIMER1_MUX      33
+#define HI3620_TIMER2_MUX      34
+#define HI3620_TIMER3_MUX      35
+#define HI3620_TIMER4_MUX      36
+#define HI3620_TIMER5_MUX      37
+#define HI3620_TIMER6_MUX      38
+#define HI3620_TIMER7_MUX      39
+#define HI3620_TIMER8_MUX      40
+#define HI3620_TIMER9_MUX      41
+#define HI3620_UART0_MUX       42
+#define HI3620_UART1_MUX       43
+#define HI3620_UART2_MUX       44
+#define HI3620_UART3_MUX       45
+#define HI3620_UART4_MUX       46
+#define HI3620_SPI0_MUX                47
+#define HI3620_SPI1_MUX                48
+#define HI3620_SPI2_MUX                49
+#define HI3620_SAXI_MUX                50
+#define HI3620_PWM0_MUX                51
+#define HI3620_PWM1_MUX                52
+#define HI3620_SD_MUX          53
+#define HI3620_MMC1_MUX                54
+#define HI3620_MMC1_MUX2       55
+#define HI3620_G2D_MUX         56
+#define HI3620_VENC_MUX                57
+#define HI3620_VDEC_MUX                58
+#define HI3620_VPP_MUX         59
+#define HI3620_EDC0_MUX                60
+#define HI3620_LDI0_MUX                61
+#define HI3620_EDC1_MUX                62
+#define HI3620_LDI1_MUX                63
+#define HI3620_RCLK_HSIC       64
+#define HI3620_MMC2_MUX                65
+#define HI3620_MMC3_MUX                66
+
+/* divider clocks */
+#define HI3620_SHAREAXI_DIV    128
+#define HI3620_CFGAXI_DIV      129
+#define HI3620_SD_DIV          130
+#define HI3620_MMC1_DIV                131
+#define HI3620_HSIC_DIV                132
+#define HI3620_MMC2_DIV                133
+#define HI3620_MMC3_DIV                134
+
+/* gate clocks */
+#define HI3620_TIMERCLK01      160
+#define HI3620_TIMER_RCLK01    161
+#define HI3620_TIMERCLK23      162
+#define HI3620_TIMER_RCLK23    163
+#define HI3620_TIMERCLK45      164
+#define HI3620_TIMERCLK67      165
+#define HI3620_TIMERCLK89      166
+#define HI3620_RTCCLK          167
+#define HI3620_KPC_CLK         168
+#define HI3620_GPIOCLK0                169
+#define HI3620_GPIOCLK1                170
+#define HI3620_GPIOCLK2                171
+#define HI3620_GPIOCLK3                172
+#define HI3620_GPIOCLK4                173
+#define HI3620_GPIOCLK5                174
+#define HI3620_GPIOCLK6                175
+#define HI3620_GPIOCLK7                176
+#define HI3620_GPIOCLK8                177
+#define HI3620_GPIOCLK9                178
+#define HI3620_GPIOCLK10       179
+#define HI3620_GPIOCLK11       180
+#define HI3620_GPIOCLK12       181
+#define HI3620_GPIOCLK13       182
+#define HI3620_GPIOCLK14       183
+#define HI3620_GPIOCLK15       184
+#define HI3620_GPIOCLK16       185
+#define HI3620_GPIOCLK17       186
+#define HI3620_GPIOCLK18       187
+#define HI3620_GPIOCLK19       188
+#define HI3620_GPIOCLK20       189
+#define HI3620_GPIOCLK21       190
+#define HI3620_DPHY0_CLK       191
+#define HI3620_DPHY1_CLK       192
+#define HI3620_DPHY2_CLK       193
+#define HI3620_USBPHY_CLK      194
+#define HI3620_ACP_CLK         195
+#define HI3620_PWMCLK0         196
+#define HI3620_PWMCLK1         197
+#define HI3620_UARTCLK0                198
+#define HI3620_UARTCLK1                199
+#define HI3620_UARTCLK2                200
+#define HI3620_UARTCLK3                201
+#define HI3620_UARTCLK4                202
+#define HI3620_SPICLK0         203
+#define HI3620_SPICLK1         204
+#define HI3620_SPICLK2         205
+#define HI3620_I2CCLK0         206
+#define HI3620_I2CCLK1         207
+#define HI3620_I2CCLK2         208
+#define HI3620_I2CCLK3         209
+#define HI3620_SCI_CLK         210
+#define HI3620_DDRC_PER_CLK    211
+#define HI3620_DMAC_CLK                212
+#define HI3620_USB2DVC_CLK     213
+#define HI3620_SD_CLK          214
+#define HI3620_MMC_CLK1                215
+#define HI3620_MMC_CLK2                216
+#define HI3620_MMC_CLK3                217
+#define HI3620_MCU_CLK         218
+
+#define HI3620_NR_CLKS         219
+
+#endif /* __DTS_HI3620_CLOCK_H */
diff --git a/include/dt-bindings/clock/imx5-clock.h b/include/dt-bindings/clock/imx5-clock.h
new file mode 100644 (file)
index 0000000..5f2667e
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2013 Lucas Stach, Pengutronix <l.stach@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_IMX5_H
+#define __DT_BINDINGS_CLOCK_IMX5_H
+
+#define IMX5_CLK_DUMMY                 0
+#define IMX5_CLK_CKIL                  1
+#define IMX5_CLK_OSC                   2
+#define IMX5_CLK_CKIH1                 3
+#define IMX5_CLK_CKIH2                 4
+#define IMX5_CLK_AHB                   5
+#define IMX5_CLK_IPG                   6
+#define IMX5_CLK_AXI_A                 7
+#define IMX5_CLK_AXI_B                 8
+#define IMX5_CLK_UART_PRED             9
+#define IMX5_CLK_UART_ROOT             10
+#define IMX5_CLK_ESDHC_A_PRED          11
+#define IMX5_CLK_ESDHC_B_PRED          12
+#define IMX5_CLK_ESDHC_C_SEL           13
+#define IMX5_CLK_ESDHC_D_SEL           14
+#define IMX5_CLK_EMI_SEL               15
+#define IMX5_CLK_EMI_SLOW_PODF         16
+#define IMX5_CLK_NFC_PODF              17
+#define IMX5_CLK_ECSPI_PRED            18
+#define IMX5_CLK_ECSPI_PODF            19
+#define IMX5_CLK_USBOH3_PRED           20
+#define IMX5_CLK_USBOH3_PODF           21
+#define IMX5_CLK_USB_PHY_PRED          22
+#define IMX5_CLK_USB_PHY_PODF          23
+#define IMX5_CLK_CPU_PODF              24
+#define IMX5_CLK_DI_PRED               25
+#define IMX5_CLK_TVE_SEL               27
+#define IMX5_CLK_UART1_IPG_GATE                28
+#define IMX5_CLK_UART1_PER_GATE                29
+#define IMX5_CLK_UART2_IPG_GATE                30
+#define IMX5_CLK_UART2_PER_GATE                31
+#define IMX5_CLK_UART3_IPG_GATE                32
+#define IMX5_CLK_UART3_PER_GATE                33
+#define IMX5_CLK_I2C1_GATE             34
+#define IMX5_CLK_I2C2_GATE             35
+#define IMX5_CLK_GPT_IPG_GATE          36
+#define IMX5_CLK_PWM1_IPG_GATE         37
+#define IMX5_CLK_PWM1_HF_GATE          38
+#define IMX5_CLK_PWM2_IPG_GATE         39
+#define IMX5_CLK_PWM2_HF_GATE          40
+#define IMX5_CLK_GPT_HF_GATE           41
+#define IMX5_CLK_FEC_GATE              42
+#define IMX5_CLK_USBOH3_PER_GATE       43
+#define IMX5_CLK_ESDHC1_IPG_GATE       44
+#define IMX5_CLK_ESDHC2_IPG_GATE       45
+#define IMX5_CLK_ESDHC3_IPG_GATE       46
+#define IMX5_CLK_ESDHC4_IPG_GATE       47
+#define IMX5_CLK_SSI1_IPG_GATE         48
+#define IMX5_CLK_SSI2_IPG_GATE         49
+#define IMX5_CLK_SSI3_IPG_GATE         50
+#define IMX5_CLK_ECSPI1_IPG_GATE       51
+#define IMX5_CLK_ECSPI1_PER_GATE       52
+#define IMX5_CLK_ECSPI2_IPG_GATE       53
+#define IMX5_CLK_ECSPI2_PER_GATE       54
+#define IMX5_CLK_CSPI_IPG_GATE         55
+#define IMX5_CLK_SDMA_GATE             56
+#define IMX5_CLK_EMI_SLOW_GATE         57
+#define IMX5_CLK_IPU_SEL               58
+#define IMX5_CLK_IPU_GATE              59
+#define IMX5_CLK_NFC_GATE              60
+#define IMX5_CLK_IPU_DI1_GATE          61
+#define IMX5_CLK_VPU_SEL               62
+#define IMX5_CLK_VPU_GATE              63
+#define IMX5_CLK_VPU_REFERENCE_GATE    64
+#define IMX5_CLK_UART4_IPG_GATE                65
+#define IMX5_CLK_UART4_PER_GATE                66
+#define IMX5_CLK_UART5_IPG_GATE                67
+#define IMX5_CLK_UART5_PER_GATE                68
+#define IMX5_CLK_TVE_GATE              69
+#define IMX5_CLK_TVE_PRED              70
+#define IMX5_CLK_ESDHC1_PER_GATE       71
+#define IMX5_CLK_ESDHC2_PER_GATE       72
+#define IMX5_CLK_ESDHC3_PER_GATE       73
+#define IMX5_CLK_ESDHC4_PER_GATE       74
+#define IMX5_CLK_USB_PHY_GATE          75
+#define IMX5_CLK_HSI2C_GATE            76
+#define IMX5_CLK_MIPI_HSC1_GATE                77
+#define IMX5_CLK_MIPI_HSC2_GATE                78
+#define IMX5_CLK_MIPI_ESC_GATE         79
+#define IMX5_CLK_MIPI_HSP_GATE         80
+#define IMX5_CLK_LDB_DI1_DIV_3_5       81
+#define IMX5_CLK_LDB_DI1_DIV           82
+#define IMX5_CLK_LDB_DI0_DIV_3_5       83
+#define IMX5_CLK_LDB_DI0_DIV           84
+#define IMX5_CLK_LDB_DI1_GATE          85
+#define IMX5_CLK_CAN2_SERIAL_GATE      86
+#define IMX5_CLK_CAN2_IPG_GATE         87
+#define IMX5_CLK_I2C3_GATE             88
+#define IMX5_CLK_LP_APM                        89
+#define IMX5_CLK_PERIPH_APM            90
+#define IMX5_CLK_MAIN_BUS              91
+#define IMX5_CLK_AHB_MAX               92
+#define IMX5_CLK_AIPS_TZ1              93
+#define IMX5_CLK_AIPS_TZ2              94
+#define IMX5_CLK_TMAX1                 95
+#define IMX5_CLK_TMAX2                 96
+#define IMX5_CLK_TMAX3                 97
+#define IMX5_CLK_SPBA                  98
+#define IMX5_CLK_UART_SEL              99
+#define IMX5_CLK_ESDHC_A_SEL           100
+#define IMX5_CLK_ESDHC_B_SEL           101
+#define IMX5_CLK_ESDHC_A_PODF          102
+#define IMX5_CLK_ESDHC_B_PODF          103
+#define IMX5_CLK_ECSPI_SEL             104
+#define IMX5_CLK_USBOH3_SEL            105
+#define IMX5_CLK_USB_PHY_SEL           106
+#define IMX5_CLK_IIM_GATE              107
+#define IMX5_CLK_USBOH3_GATE           108
+#define IMX5_CLK_EMI_FAST_GATE         109
+#define IMX5_CLK_IPU_DI0_GATE          110
+#define IMX5_CLK_GPC_DVFS              111
+#define IMX5_CLK_PLL1_SW               112
+#define IMX5_CLK_PLL2_SW               113
+#define IMX5_CLK_PLL3_SW               114
+#define IMX5_CLK_IPU_DI0_SEL           115
+#define IMX5_CLK_IPU_DI1_SEL           116
+#define IMX5_CLK_TVE_EXT_SEL           117
+#define IMX5_CLK_MX51_MIPI             118
+#define IMX5_CLK_PLL4_SW               119
+#define IMX5_CLK_LDB_DI1_SEL           120
+#define IMX5_CLK_DI_PLL4_PODF          121
+#define IMX5_CLK_LDB_DI0_SEL           122
+#define IMX5_CLK_LDB_DI0_GATE          123
+#define IMX5_CLK_USB_PHY1_GATE         124
+#define IMX5_CLK_USB_PHY2_GATE         125
+#define IMX5_CLK_PER_LP_APM            126
+#define IMX5_CLK_PER_PRED1             127
+#define IMX5_CLK_PER_PRED2             128
+#define IMX5_CLK_PER_PODF              129
+#define IMX5_CLK_PER_ROOT              130
+#define IMX5_CLK_SSI_APM               131
+#define IMX5_CLK_SSI1_ROOT_SEL         132
+#define IMX5_CLK_SSI2_ROOT_SEL         133
+#define IMX5_CLK_SSI3_ROOT_SEL         134
+#define IMX5_CLK_SSI_EXT1_SEL          135
+#define IMX5_CLK_SSI_EXT2_SEL          136
+#define IMX5_CLK_SSI_EXT1_COM_SEL      137
+#define IMX5_CLK_SSI_EXT2_COM_SEL      138
+#define IMX5_CLK_SSI1_ROOT_PRED                139
+#define IMX5_CLK_SSI1_ROOT_PODF                140
+#define IMX5_CLK_SSI2_ROOT_PRED                141
+#define IMX5_CLK_SSI2_ROOT_PODF                142
+#define IMX5_CLK_SSI_EXT1_PRED         143
+#define IMX5_CLK_SSI_EXT1_PODF         144
+#define IMX5_CLK_SSI_EXT2_PRED         145
+#define IMX5_CLK_SSI_EXT2_PODF         146
+#define IMX5_CLK_SSI1_ROOT_GATE                147
+#define IMX5_CLK_SSI2_ROOT_GATE                148
+#define IMX5_CLK_SSI3_ROOT_GATE                149
+#define IMX5_CLK_SSI_EXT1_GATE         150
+#define IMX5_CLK_SSI_EXT2_GATE         151
+#define IMX5_CLK_EPIT1_IPG_GATE                152
+#define IMX5_CLK_EPIT1_HF_GATE         153
+#define IMX5_CLK_EPIT2_IPG_GATE                154
+#define IMX5_CLK_EPIT2_HF_GATE         155
+#define IMX5_CLK_CAN_SEL               156
+#define IMX5_CLK_CAN1_SERIAL_GATE      157
+#define IMX5_CLK_CAN1_IPG_GATE         158
+#define IMX5_CLK_OWIRE_GATE            159
+#define IMX5_CLK_GPU3D_SEL             160
+#define IMX5_CLK_GPU2D_SEL             161
+#define IMX5_CLK_GPU3D_GATE            162
+#define IMX5_CLK_GPU2D_GATE            163
+#define IMX5_CLK_GARB_GATE             164
+#define IMX5_CLK_CKO1_SEL              165
+#define IMX5_CLK_CKO1_PODF             166
+#define IMX5_CLK_CKO1                  167
+#define IMX5_CLK_CKO2_SEL              168
+#define IMX5_CLK_CKO2_PODF             169
+#define IMX5_CLK_CKO2                  170
+#define IMX5_CLK_SRTC_GATE             171
+#define IMX5_CLK_PATA_GATE             172
+#define IMX5_CLK_SATA_GATE             173
+#define IMX5_CLK_SPDIF_XTAL_SEL                174
+#define IMX5_CLK_SPDIF0_SEL            175
+#define IMX5_CLK_SPDIF1_SEL            176
+#define IMX5_CLK_SPDIF0_PRED           177
+#define IMX5_CLK_SPDIF0_PODF           178
+#define IMX5_CLK_SPDIF1_PRED           179
+#define IMX5_CLK_SPDIF1_PODF           180
+#define IMX5_CLK_SPDIF0_COM_SEL                181
+#define IMX5_CLK_SPDIF1_COM_SEL                182
+#define IMX5_CLK_SPDIF0_GATE           183
+#define IMX5_CLK_SPDIF1_GATE           184
+#define IMX5_CLK_SPDIF_IPG_GATE                185
+#define IMX5_CLK_OCRAM                 186
+#define IMX5_CLK_SAHARA_IPG_GATE       187
+#define IMX5_CLK_SATA_REF              188
+#define IMX5_CLK_END                   189
+
+#endif /* __DT_BINDINGS_CLOCK_IMX5_H */
index 7fcdf90879f25b23e9dadd28399dd7e8112022e9..7cf5c996933650295ef37285183173dd2172a8a2 100644 (file)
 #define IMX6SL_CLK_USDHC2              130
 #define IMX6SL_CLK_USDHC3              131
 #define IMX6SL_CLK_USDHC4              132
-#define IMX6SL_CLK_CLK_END             133
+#define IMX6SL_CLK_PLL4_AUDIO_DIV      133
+#define IMX6SL_CLK_SPBA                        134
+#define IMX6SL_CLK_END                 135
 
 #endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */
diff --git a/include/dt-bindings/clock/qcom,gcc-msm8660.h b/include/dt-bindings/clock/qcom,gcc-msm8660.h
new file mode 100644 (file)
index 0000000..67665f6
--- /dev/null
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_CLK_MSM_GCC_8660_H
+#define _DT_BINDINGS_CLK_MSM_GCC_8660_H
+
+#define AFAB_CLK_SRC                           0
+#define AFAB_CORE_CLK                          1
+#define SCSS_A_CLK                             2
+#define SCSS_H_CLK                             3
+#define SCSS_XO_SRC_CLK                                4
+#define AFAB_EBI1_CH0_A_CLK                    5
+#define AFAB_EBI1_CH1_A_CLK                    6
+#define AFAB_AXI_S0_FCLK                       7
+#define AFAB_AXI_S1_FCLK                       8
+#define AFAB_AXI_S2_FCLK                       9
+#define AFAB_AXI_S3_FCLK                       10
+#define AFAB_AXI_S4_FCLK                       11
+#define SFAB_CORE_CLK                          12
+#define SFAB_AXI_S0_FCLK                       13
+#define SFAB_AXI_S1_FCLK                       14
+#define SFAB_AXI_S2_FCLK                       15
+#define SFAB_AXI_S3_FCLK                       16
+#define SFAB_AXI_S4_FCLK                       17
+#define SFAB_AHB_S0_FCLK                       18
+#define SFAB_AHB_S1_FCLK                       19
+#define SFAB_AHB_S2_FCLK                       20
+#define SFAB_AHB_S3_FCLK                       21
+#define SFAB_AHB_S4_FCLK                       22
+#define SFAB_AHB_S5_FCLK                       23
+#define SFAB_AHB_S6_FCLK                       24
+#define SFAB_ADM0_M0_A_CLK                     25
+#define SFAB_ADM0_M1_A_CLK                     26
+#define SFAB_ADM0_M2_A_CLK                     27
+#define ADM0_CLK                               28
+#define ADM0_PBUS_CLK                          29
+#define SFAB_ADM1_M0_A_CLK                     30
+#define SFAB_ADM1_M1_A_CLK                     31
+#define SFAB_ADM1_M2_A_CLK                     32
+#define MMFAB_ADM1_M3_A_CLK                    33
+#define ADM1_CLK                               34
+#define ADM1_PBUS_CLK                          35
+#define IMEM0_A_CLK                            36
+#define MAHB0_CLK                              37
+#define SFAB_LPASS_Q6_A_CLK                    38
+#define SFAB_AFAB_M_A_CLK                      39
+#define AFAB_SFAB_M0_A_CLK                     40
+#define AFAB_SFAB_M1_A_CLK                     41
+#define DFAB_CLK_SRC                           42
+#define DFAB_CLK                               43
+#define DFAB_CORE_CLK                          44
+#define SFAB_DFAB_M_A_CLK                      45
+#define DFAB_SFAB_M_A_CLK                      46
+#define DFAB_SWAY0_H_CLK                       47
+#define DFAB_SWAY1_H_CLK                       48
+#define DFAB_ARB0_H_CLK                                49
+#define DFAB_ARB1_H_CLK                                50
+#define PPSS_H_CLK                             51
+#define PPSS_PROC_CLK                          52
+#define PPSS_TIMER0_CLK                                53
+#define PPSS_TIMER1_CLK                                54
+#define PMEM_A_CLK                             55
+#define DMA_BAM_H_CLK                          56
+#define SIC_H_CLK                              57
+#define SPS_TIC_H_CLK                          58
+#define SLIMBUS_H_CLK                          59
+#define SLIMBUS_XO_SRC_CLK                     60
+#define CFPB_2X_CLK_SRC                                61
+#define CFPB_CLK                               62
+#define CFPB0_H_CLK                            63
+#define CFPB1_H_CLK                            64
+#define CFPB2_H_CLK                            65
+#define EBI2_2X_CLK                            66
+#define EBI2_CLK                               67
+#define SFAB_CFPB_M_H_CLK                      68
+#define CFPB_MASTER_H_CLK                      69
+#define SFAB_CFPB_S_HCLK                       70
+#define CFPB_SPLITTER_H_CLK                    71
+#define TSIF_H_CLK                             72
+#define TSIF_INACTIVITY_TIMERS_CLK             73
+#define TSIF_REF_SRC                           74
+#define TSIF_REF_CLK                           75
+#define CE1_H_CLK                              76
+#define CE2_H_CLK                              77
+#define SFPB_H_CLK_SRC                         78
+#define SFPB_H_CLK                             79
+#define SFAB_SFPB_M_H_CLK                      80
+#define SFAB_SFPB_S_H_CLK                      81
+#define RPM_PROC_CLK                           82
+#define RPM_BUS_H_CLK                          83
+#define RPM_SLEEP_CLK                          84
+#define RPM_TIMER_CLK                          85
+#define MODEM_AHB1_H_CLK                       86
+#define MODEM_AHB2_H_CLK                       87
+#define RPM_MSG_RAM_H_CLK                      88
+#define SC_H_CLK                               89
+#define SC_A_CLK                               90
+#define PMIC_ARB0_H_CLK                                91
+#define PMIC_ARB1_H_CLK                                92
+#define PMIC_SSBI2_SRC                         93
+#define PMIC_SSBI2_CLK                         94
+#define SDC1_H_CLK                             95
+#define SDC2_H_CLK                             96
+#define SDC3_H_CLK                             97
+#define SDC4_H_CLK                             98
+#define SDC5_H_CLK                             99
+#define SDC1_SRC                               100
+#define SDC2_SRC                               101
+#define SDC3_SRC                               102
+#define SDC4_SRC                               103
+#define SDC5_SRC                               104
+#define SDC1_CLK                               105
+#define SDC2_CLK                               106
+#define SDC3_CLK                               107
+#define SDC4_CLK                               108
+#define SDC5_CLK                               109
+#define USB_HS1_H_CLK                          110
+#define USB_HS1_XCVR_SRC                       111
+#define USB_HS1_XCVR_CLK                       112
+#define USB_HS2_H_CLK                          113
+#define USB_HS2_XCVR_SRC                       114
+#define USB_HS2_XCVR_CLK                       115
+#define USB_FS1_H_CLK                          116
+#define USB_FS1_XCVR_FS_SRC                    117
+#define USB_FS1_XCVR_FS_CLK                    118
+#define USB_FS1_SYSTEM_CLK                     119
+#define USB_FS2_H_CLK                          120
+#define USB_FS2_XCVR_FS_SRC                    121
+#define USB_FS2_XCVR_FS_CLK                    122
+#define USB_FS2_SYSTEM_CLK                     123
+#define GSBI_COMMON_SIM_SRC                    124
+#define GSBI1_H_CLK                            125
+#define GSBI2_H_CLK                            126
+#define GSBI3_H_CLK                            127
+#define GSBI4_H_CLK                            128
+#define GSBI5_H_CLK                            129
+#define GSBI6_H_CLK                            130
+#define GSBI7_H_CLK                            131
+#define GSBI8_H_CLK                            132
+#define GSBI9_H_CLK                            133
+#define GSBI10_H_CLK                           134
+#define GSBI11_H_CLK                           135
+#define GSBI12_H_CLK                           136
+#define GSBI1_UART_SRC                         137
+#define GSBI1_UART_CLK                         138
+#define GSBI2_UART_SRC                         139
+#define GSBI2_UART_CLK                         140
+#define GSBI3_UART_SRC                         141
+#define GSBI3_UART_CLK                         142
+#define GSBI4_UART_SRC                         143
+#define GSBI4_UART_CLK                         144
+#define GSBI5_UART_SRC                         145
+#define GSBI5_UART_CLK                         146
+#define GSBI6_UART_SRC                         147
+#define GSBI6_UART_CLK                         148
+#define GSBI7_UART_SRC                         149
+#define GSBI7_UART_CLK                         150
+#define GSBI8_UART_SRC                         151
+#define GSBI8_UART_CLK                         152
+#define GSBI9_UART_SRC                         153
+#define GSBI9_UART_CLK                         154
+#define GSBI10_UART_SRC                                155
+#define GSBI10_UART_CLK                                156
+#define GSBI11_UART_SRC                                157
+#define GSBI11_UART_CLK                                158
+#define GSBI12_UART_SRC                                159
+#define GSBI12_UART_CLK                                160
+#define GSBI1_QUP_SRC                          161
+#define GSBI1_QUP_CLK                          162
+#define GSBI2_QUP_SRC                          163
+#define GSBI2_QUP_CLK                          164
+#define GSBI3_QUP_SRC                          165
+#define GSBI3_QUP_CLK                          166
+#define GSBI4_QUP_SRC                          167
+#define GSBI4_QUP_CLK                          168
+#define GSBI5_QUP_SRC                          169
+#define GSBI5_QUP_CLK                          170
+#define GSBI6_QUP_SRC                          171
+#define GSBI6_QUP_CLK                          172
+#define GSBI7_QUP_SRC                          173
+#define GSBI7_QUP_CLK                          174
+#define GSBI8_QUP_SRC                          175
+#define GSBI8_QUP_CLK                          176
+#define GSBI9_QUP_SRC                          177
+#define GSBI9_QUP_CLK                          178
+#define GSBI10_QUP_SRC                         179
+#define GSBI10_QUP_CLK                         180
+#define GSBI11_QUP_SRC                         181
+#define GSBI11_QUP_CLK                         182
+#define GSBI12_QUP_SRC                         183
+#define GSBI12_QUP_CLK                         184
+#define GSBI1_SIM_CLK                          185
+#define GSBI2_SIM_CLK                          186
+#define GSBI3_SIM_CLK                          187
+#define GSBI4_SIM_CLK                          188
+#define GSBI5_SIM_CLK                          189
+#define GSBI6_SIM_CLK                          190
+#define GSBI7_SIM_CLK                          191
+#define GSBI8_SIM_CLK                          192
+#define GSBI9_SIM_CLK                          193
+#define GSBI10_SIM_CLK                         194
+#define GSBI11_SIM_CLK                         195
+#define GSBI12_SIM_CLK                         196
+#define SPDM_CFG_H_CLK                         197
+#define SPDM_MSTR_H_CLK                                198
+#define SPDM_FF_CLK_SRC                                199
+#define SPDM_FF_CLK                            200
+#define SEC_CTRL_CLK                           201
+#define SEC_CTRL_ACC_CLK_SRC                   202
+#define SEC_CTRL_ACC_CLK                       203
+#define TLMM_H_CLK                             204
+#define TLMM_CLK                               205
+#define MARM_CLK_SRC                           206
+#define MARM_CLK                               207
+#define MAHB1_SRC                              208
+#define MAHB1_CLK                              209
+#define SFAB_MSS_S_H_CLK                       210
+#define MAHB2_SRC                              211
+#define MAHB2_CLK                              212
+#define MSS_MODEM_CLK_SRC                      213
+#define MSS_MODEM_CXO_CLK                      214
+#define MSS_SLP_CLK                            215
+#define MSS_SYS_REF_CLK                                216
+#define TSSC_CLK_SRC                           217
+#define TSSC_CLK                               218
+#define PDM_SRC                                        219
+#define PDM_CLK                                        220
+#define GP0_SRC                                        221
+#define GP0_CLK                                        222
+#define GP1_SRC                                        223
+#define GP1_CLK                                        224
+#define GP2_SRC                                        225
+#define GP2_CLK                                        226
+#define PMEM_CLK                               227
+#define MPM_CLK                                        228
+#define EBI1_ASFAB_SRC                         229
+#define EBI1_CLK_SRC                           230
+#define EBI1_CH0_CLK                           231
+#define EBI1_CH1_CLK                           232
+#define SFAB_SMPSS_S_H_CLK                     233
+#define PRNG_SRC                               234
+#define PRNG_CLK                               235
+#define PXO_SRC                                        236
+#define LPASS_CXO_CLK                          237
+#define LPASS_PXO_CLK                          238
+#define SPDM_CY_PORT0_CLK                      239
+#define SPDM_CY_PORT1_CLK                      240
+#define SPDM_CY_PORT2_CLK                      241
+#define SPDM_CY_PORT3_CLK                      242
+#define SPDM_CY_PORT4_CLK                      243
+#define SPDM_CY_PORT5_CLK                      244
+#define SPDM_CY_PORT6_CLK                      245
+#define SPDM_CY_PORT7_CLK                      246
+#define PLL0                                   247
+#define PLL0_VOTE                              248
+#define PLL5                                   249
+#define PLL6                                   250
+#define PLL6_VOTE                              251
+#define PLL8                                   252
+#define PLL8_VOTE                              253
+#define PLL9                                   254
+#define PLL10                                  255
+#define PLL11                                  256
+#define PLL12                                  257
+
+#endif
diff --git a/include/dt-bindings/clock/qcom,gcc-msm8960.h b/include/dt-bindings/clock/qcom,gcc-msm8960.h
new file mode 100644 (file)
index 0000000..03bbf49
--- /dev/null
@@ -0,0 +1,313 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_CLK_MSM_GCC_8960_H
+#define _DT_BINDINGS_CLK_MSM_GCC_8960_H
+
+#define AFAB_CLK_SRC                           0
+#define AFAB_CORE_CLK                          1
+#define SFAB_MSS_Q6_SW_A_CLK                   2
+#define SFAB_MSS_Q6_FW_A_CLK                   3
+#define QDSS_STM_CLK                           4
+#define SCSS_A_CLK                             5
+#define SCSS_H_CLK                             6
+#define SCSS_XO_SRC_CLK                                7
+#define AFAB_EBI1_CH0_A_CLK                    8
+#define AFAB_EBI1_CH1_A_CLK                    9
+#define AFAB_AXI_S0_FCLK                       10
+#define AFAB_AXI_S1_FCLK                       11
+#define AFAB_AXI_S2_FCLK                       12
+#define AFAB_AXI_S3_FCLK                       13
+#define AFAB_AXI_S4_FCLK                       14
+#define SFAB_CORE_CLK                          15
+#define SFAB_AXI_S0_FCLK                       16
+#define SFAB_AXI_S1_FCLK                       17
+#define SFAB_AXI_S2_FCLK                       18
+#define SFAB_AXI_S3_FCLK                       19
+#define SFAB_AXI_S4_FCLK                       20
+#define SFAB_AHB_S0_FCLK                       21
+#define SFAB_AHB_S1_FCLK                       22
+#define SFAB_AHB_S2_FCLK                       23
+#define SFAB_AHB_S3_FCLK                       24
+#define SFAB_AHB_S4_FCLK                       25
+#define SFAB_AHB_S5_FCLK                       26
+#define SFAB_AHB_S6_FCLK                       27
+#define SFAB_AHB_S7_FCLK                       28
+#define QDSS_AT_CLK_SRC                                29
+#define QDSS_AT_CLK                            30
+#define QDSS_TRACECLKIN_CLK_SRC                        31
+#define QDSS_TRACECLKIN_CLK                    32
+#define QDSS_TSCTR_CLK_SRC                     33
+#define QDSS_TSCTR_CLK                         34
+#define SFAB_ADM0_M0_A_CLK                     35
+#define SFAB_ADM0_M1_A_CLK                     36
+#define SFAB_ADM0_M2_A_CLK                     37
+#define ADM0_CLK                               38
+#define ADM0_PBUS_CLK                          39
+#define MSS_XPU_CLK                            40
+#define IMEM0_A_CLK                            41
+#define QDSS_H_CLK                             42
+#define PCIE_A_CLK                             43
+#define PCIE_AUX_CLK                           44
+#define PCIE_PHY_REF_CLK                       45
+#define PCIE_H_CLK                             46
+#define SFAB_CLK_SRC                           47
+#define MAHB0_CLK                              48
+#define Q6SW_CLK_SRC                           49
+#define Q6SW_CLK                               50
+#define Q6FW_CLK_SRC                           51
+#define Q6FW_CLK                               52
+#define SFAB_MSS_M_A_CLK                       53
+#define SFAB_USB3_M_A_CLK                      54
+#define SFAB_LPASS_Q6_A_CLK                    55
+#define SFAB_AFAB_M_A_CLK                      56
+#define AFAB_SFAB_M0_A_CLK                     57
+#define AFAB_SFAB_M1_A_CLK                     58
+#define SFAB_SATA_S_H_CLK                      59
+#define DFAB_CLK_SRC                           60
+#define DFAB_CLK                               61
+#define SFAB_DFAB_M_A_CLK                      62
+#define DFAB_SFAB_M_A_CLK                      63
+#define DFAB_SWAY0_H_CLK                       64
+#define DFAB_SWAY1_H_CLK                       65
+#define DFAB_ARB0_H_CLK                                66
+#define DFAB_ARB1_H_CLK                                67
+#define PPSS_H_CLK                             68
+#define PPSS_PROC_CLK                          69
+#define PPSS_TIMER0_CLK                                70
+#define PPSS_TIMER1_CLK                                71
+#define PMEM_A_CLK                             72
+#define DMA_BAM_H_CLK                          73
+#define SIC_H_CLK                              74
+#define SPS_TIC_H_CLK                          75
+#define SLIMBUS_H_CLK                          76
+#define SLIMBUS_XO_SRC_CLK                     77
+#define CFPB_2X_CLK_SRC                                78
+#define CFPB_CLK                               79
+#define CFPB0_H_CLK                            80
+#define CFPB1_H_CLK                            81
+#define CFPB2_H_CLK                            82
+#define SFAB_CFPB_M_H_CLK                      83
+#define CFPB_MASTER_H_CLK                      84
+#define SFAB_CFPB_S_HCLK                       85
+#define CFPB_SPLITTER_H_CLK                    86
+#define TSIF_H_CLK                             87
+#define TSIF_INACTIVITY_TIMERS_CLK             88
+#define TSIF_REF_SRC                           89
+#define TSIF_REF_CLK                           90
+#define CE1_H_CLK                              91
+#define CE1_CORE_CLK                           92
+#define CE1_SLEEP_CLK                          93
+#define CE2_H_CLK                              94
+#define CE2_CORE_CLK                           95
+#define CE2_SLEEP_CLK                          96
+#define SFPB_H_CLK_SRC                         97
+#define SFPB_H_CLK                             98
+#define SFAB_SFPB_M_H_CLK                      99
+#define SFAB_SFPB_S_H_CLK                      100
+#define RPM_PROC_CLK                           101
+#define RPM_BUS_H_CLK                          102
+#define RPM_SLEEP_CLK                          103
+#define RPM_TIMER_CLK                          104
+#define RPM_MSG_RAM_H_CLK                      105
+#define PMIC_ARB0_H_CLK                                106
+#define PMIC_ARB1_H_CLK                                107
+#define PMIC_SSBI2_SRC                         108
+#define PMIC_SSBI2_CLK                         109
+#define SDC1_H_CLK                             110
+#define SDC2_H_CLK                             111
+#define SDC3_H_CLK                             112
+#define SDC4_H_CLK                             113
+#define SDC5_H_CLK                             114
+#define SDC1_SRC                               115
+#define SDC2_SRC                               116
+#define SDC3_SRC                               117
+#define SDC4_SRC                               118
+#define SDC5_SRC                               119
+#define SDC1_CLK                               120
+#define SDC2_CLK                               121
+#define SDC3_CLK                               122
+#define SDC4_CLK                               123
+#define SDC5_CLK                               124
+#define DFAB_A2_H_CLK                          125
+#define USB_HS1_H_CLK                          126
+#define USB_HS1_XCVR_SRC                       127
+#define USB_HS1_XCVR_CLK                       128
+#define USB_HSIC_H_CLK                         129
+#define USB_HSIC_XCVR_FS_SRC                   130
+#define USB_HSIC_XCVR_FS_CLK                   131
+#define USB_HSIC_SYSTEM_CLK_SRC                        132
+#define USB_HSIC_SYSTEM_CLK                    133
+#define CFPB0_C0_H_CLK                         134
+#define CFPB0_C1_H_CLK                         135
+#define CFPB0_D0_H_CLK                         136
+#define CFPB0_D1_H_CLK                         137
+#define USB_FS1_H_CLK                          138
+#define USB_FS1_XCVR_FS_SRC                    139
+#define USB_FS1_XCVR_FS_CLK                    140
+#define USB_FS1_SYSTEM_CLK                     141
+#define USB_FS2_H_CLK                          142
+#define USB_FS2_XCVR_FS_SRC                    143
+#define USB_FS2_XCVR_FS_CLK                    144
+#define USB_FS2_SYSTEM_CLK                     145
+#define GSBI_COMMON_SIM_SRC                    146
+#define GSBI1_H_CLK                            147
+#define GSBI2_H_CLK                            148
+#define GSBI3_H_CLK                            149
+#define GSBI4_H_CLK                            150
+#define GSBI5_H_CLK                            151
+#define GSBI6_H_CLK                            152
+#define GSBI7_H_CLK                            153
+#define GSBI8_H_CLK                            154
+#define GSBI9_H_CLK                            155
+#define GSBI10_H_CLK                           156
+#define GSBI11_H_CLK                           157
+#define GSBI12_H_CLK                           158
+#define GSBI1_UART_SRC                         159
+#define GSBI1_UART_CLK                         160
+#define GSBI2_UART_SRC                         161
+#define GSBI2_UART_CLK                         162
+#define GSBI3_UART_SRC                         163
+#define GSBI3_UART_CLK                         164
+#define GSBI4_UART_SRC                         165
+#define GSBI4_UART_CLK                         166
+#define GSBI5_UART_SRC                         167
+#define GSBI5_UART_CLK                         168
+#define GSBI6_UART_SRC                         169
+#define GSBI6_UART_CLK                         170
+#define GSBI7_UART_SRC                         171
+#define GSBI7_UART_CLK                         172
+#define GSBI8_UART_SRC                         173
+#define GSBI8_UART_CLK                         174
+#define GSBI9_UART_SRC                         175
+#define GSBI9_UART_CLK                         176
+#define GSBI10_UART_SRC                                177
+#define GSBI10_UART_CLK                                178
+#define GSBI11_UART_SRC                                179
+#define GSBI11_UART_CLK                                180
+#define GSBI12_UART_SRC                                181
+#define GSBI12_UART_CLK                                182
+#define GSBI1_QUP_SRC                          183
+#define GSBI1_QUP_CLK                          184
+#define GSBI2_QUP_SRC                          185
+#define GSBI2_QUP_CLK                          186
+#define GSBI3_QUP_SRC                          187
+#define GSBI3_QUP_CLK                          188
+#define GSBI4_QUP_SRC                          189
+#define GSBI4_QUP_CLK                          190
+#define GSBI5_QUP_SRC                          191
+#define GSBI5_QUP_CLK                          192
+#define GSBI6_QUP_SRC                          193
+#define GSBI6_QUP_CLK                          194
+#define GSBI7_QUP_SRC                          195
+#define GSBI7_QUP_CLK                          196
+#define GSBI8_QUP_SRC                          197
+#define GSBI8_QUP_CLK                          198
+#define GSBI9_QUP_SRC                          199
+#define GSBI9_QUP_CLK                          200
+#define GSBI10_QUP_SRC                         201
+#define GSBI10_QUP_CLK                         202
+#define GSBI11_QUP_SRC                         203
+#define GSBI11_QUP_CLK                         204
+#define GSBI12_QUP_SRC                         205
+#define GSBI12_QUP_CLK                         206
+#define GSBI1_SIM_CLK                          207
+#define GSBI2_SIM_CLK                          208
+#define GSBI3_SIM_CLK                          209
+#define GSBI4_SIM_CLK                          210
+#define GSBI5_SIM_CLK                          211
+#define GSBI6_SIM_CLK                          212
+#define GSBI7_SIM_CLK                          213
+#define GSBI8_SIM_CLK                          214
+#define GSBI9_SIM_CLK                          215
+#define GSBI10_SIM_CLK                         216
+#define GSBI11_SIM_CLK                         217
+#define GSBI12_SIM_CLK                         218
+#define USB_HSIC_HSIC_CLK_SRC                  219
+#define USB_HSIC_HSIC_CLK                      220
+#define USB_HSIC_HSIO_CAL_CLK                  221
+#define SPDM_CFG_H_CLK                         222
+#define SPDM_MSTR_H_CLK                                223
+#define SPDM_FF_CLK_SRC                                224
+#define SPDM_FF_CLK                            225
+#define SEC_CTRL_CLK                           226
+#define SEC_CTRL_ACC_CLK_SRC                   227
+#define SEC_CTRL_ACC_CLK                       228
+#define TLMM_H_CLK                             229
+#define TLMM_CLK                               230
+#define SFAB_MSS_S_H_CLK                       231
+#define MSS_SLP_CLK                            232
+#define MSS_Q6SW_JTAG_CLK                      233
+#define MSS_Q6FW_JTAG_CLK                      234
+#define MSS_S_H_CLK                            235
+#define MSS_CXO_SRC_CLK                                236
+#define SATA_H_CLK                             237
+#define SATA_SRC_CLK                           238
+#define SATA_RXOOB_CLK                         239
+#define SATA_PMALIVE_CLK                       240
+#define SATA_PHY_REF_CLK                       241
+#define TSSC_CLK_SRC                           242
+#define TSSC_CLK                               243
+#define PDM_SRC                                        244
+#define PDM_CLK                                        245
+#define GP0_SRC                                        246
+#define GP0_CLK                                        247
+#define GP1_SRC                                        248
+#define GP1_CLK                                        249
+#define GP2_SRC                                        250
+#define GP2_CLK                                        251
+#define MPM_CLK                                        252
+#define EBI1_CLK_SRC                           253
+#define EBI1_CH0_CLK                           254
+#define EBI1_CH1_CLK                           255
+#define EBI1_2X_CLK                            256
+#define EBI1_CH0_DQ_CLK                                257
+#define EBI1_CH1_DQ_CLK                                258
+#define EBI1_CH0_CA_CLK                                259
+#define EBI1_CH1_CA_CLK                                260
+#define EBI1_XO_CLK                            261
+#define SFAB_SMPSS_S_H_CLK                     262
+#define PRNG_SRC                               263
+#define PRNG_CLK                               264
+#define PXO_SRC                                        265
+#define LPASS_CXO_CLK                          266
+#define LPASS_PXO_CLK                          267
+#define SPDM_CY_PORT0_CLK                      268
+#define SPDM_CY_PORT1_CLK                      269
+#define SPDM_CY_PORT2_CLK                      270
+#define SPDM_CY_PORT3_CLK                      271
+#define SPDM_CY_PORT4_CLK                      272
+#define SPDM_CY_PORT5_CLK                      273
+#define SPDM_CY_PORT6_CLK                      274
+#define SPDM_CY_PORT7_CLK                      275
+#define PLL0                                   276
+#define PLL0_VOTE                              277
+#define PLL3                                   278
+#define PLL3_VOTE                              279
+#define PLL4_VOTE                              280
+#define PLL5                                   281
+#define PLL5_VOTE                              282
+#define PLL6                                   283
+#define PLL6_VOTE                              284
+#define PLL7_VOTE                              285
+#define PLL8                                   286
+#define PLL8_VOTE                              287
+#define PLL9                                   288
+#define PLL10                                  289
+#define PLL11                                  290
+#define PLL12                                  291
+#define PLL13                                  292
+#define PLL14                                  293
+#define PLL14_VOTE                             294
+
+#endif
diff --git a/include/dt-bindings/clock/qcom,gcc-msm8974.h b/include/dt-bindings/clock/qcom,gcc-msm8974.h
new file mode 100644 (file)
index 0000000..223ca17
--- /dev/null
@@ -0,0 +1,320 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_CLK_MSM_GCC_8974_H
+#define _DT_BINDINGS_CLK_MSM_GCC_8974_H
+
+#define GPLL0                                                  0
+#define GPLL0_VOTE                                             1
+#define CONFIG_NOC_CLK_SRC                                     2
+#define GPLL2                                                  3
+#define GPLL2_VOTE                                             4
+#define GPLL3                                                  5
+#define GPLL3_VOTE                                             6
+#define PERIPH_NOC_CLK_SRC                                     7
+#define BLSP_UART_SIM_CLK_SRC                                  8
+#define QDSS_TSCTR_CLK_SRC                                     9
+#define BIMC_DDR_CLK_SRC                                       10
+#define SYSTEM_NOC_CLK_SRC                                     11
+#define GPLL1                                                  12
+#define GPLL1_VOTE                                             13
+#define RPM_CLK_SRC                                            14
+#define GCC_BIMC_CLK                                           15
+#define BIMC_DDR_CPLL0_ROOT_CLK_SRC                            16
+#define KPSS_AHB_CLK_SRC                                       17
+#define QDSS_AT_CLK_SRC                                                18
+#define USB30_MASTER_CLK_SRC                                   19
+#define BIMC_DDR_CPLL1_ROOT_CLK_SRC                            20
+#define QDSS_STM_CLK_SRC                                       21
+#define ACC_CLK_SRC                                            22
+#define SEC_CTRL_CLK_SRC                                       23
+#define BLSP1_QUP1_I2C_APPS_CLK_SRC                            24
+#define BLSP1_QUP1_SPI_APPS_CLK_SRC                            25
+#define BLSP1_QUP2_I2C_APPS_CLK_SRC                            26
+#define BLSP1_QUP2_SPI_APPS_CLK_SRC                            27
+#define BLSP1_QUP3_I2C_APPS_CLK_SRC                            28
+#define BLSP1_QUP3_SPI_APPS_CLK_SRC                            29
+#define BLSP1_QUP4_I2C_APPS_CLK_SRC                            30
+#define BLSP1_QUP4_SPI_APPS_CLK_SRC                            31
+#define BLSP1_QUP5_I2C_APPS_CLK_SRC                            32
+#define BLSP1_QUP5_SPI_APPS_CLK_SRC                            33
+#define BLSP1_QUP6_I2C_APPS_CLK_SRC                            34
+#define BLSP1_QUP6_SPI_APPS_CLK_SRC                            35
+#define BLSP1_UART1_APPS_CLK_SRC                               36
+#define BLSP1_UART2_APPS_CLK_SRC                               37
+#define BLSP1_UART3_APPS_CLK_SRC                               38
+#define BLSP1_UART4_APPS_CLK_SRC                               39
+#define BLSP1_UART5_APPS_CLK_SRC                               40
+#define BLSP1_UART6_APPS_CLK_SRC                               41
+#define BLSP2_QUP1_I2C_APPS_CLK_SRC                            42
+#define BLSP2_QUP1_SPI_APPS_CLK_SRC                            43
+#define BLSP2_QUP2_I2C_APPS_CLK_SRC                            44
+#define BLSP2_QUP2_SPI_APPS_CLK_SRC                            45
+#define BLSP2_QUP3_I2C_APPS_CLK_SRC                            46
+#define BLSP2_QUP3_SPI_APPS_CLK_SRC                            47
+#define BLSP2_QUP4_I2C_APPS_CLK_SRC                            48
+#define BLSP2_QUP4_SPI_APPS_CLK_SRC                            49
+#define BLSP2_QUP5_I2C_APPS_CLK_SRC                            50
+#define BLSP2_QUP5_SPI_APPS_CLK_SRC                            51
+#define BLSP2_QUP6_I2C_APPS_CLK_SRC                            52
+#define BLSP2_QUP6_SPI_APPS_CLK_SRC                            53
+#define BLSP2_UART1_APPS_CLK_SRC                               54
+#define BLSP2_UART2_APPS_CLK_SRC                               55
+#define BLSP2_UART3_APPS_CLK_SRC                               56
+#define BLSP2_UART4_APPS_CLK_SRC                               57
+#define BLSP2_UART5_APPS_CLK_SRC                               58
+#define BLSP2_UART6_APPS_CLK_SRC                               59
+#define CE1_CLK_SRC                                            60
+#define CE2_CLK_SRC                                            61
+#define GP1_CLK_SRC                                            62
+#define GP2_CLK_SRC                                            63
+#define GP3_CLK_SRC                                            64
+#define PDM2_CLK_SRC                                           65
+#define QDSS_TRACECLKIN_CLK_SRC                                        66
+#define RBCPR_CLK_SRC                                          67
+#define SDCC1_APPS_CLK_SRC                                     68
+#define SDCC2_APPS_CLK_SRC                                     69
+#define SDCC3_APPS_CLK_SRC                                     70
+#define SDCC4_APPS_CLK_SRC                                     71
+#define SPMI_AHB_CLK_SRC                                       72
+#define SPMI_SER_CLK_SRC                                       73
+#define TSIF_REF_CLK_SRC                                       74
+#define USB30_MOCK_UTMI_CLK_SRC                                        75
+#define USB_HS_SYSTEM_CLK_SRC                                  76
+#define USB_HSIC_CLK_SRC                                       77
+#define USB_HSIC_IO_CAL_CLK_SRC                                        78
+#define USB_HSIC_SYSTEM_CLK_SRC                                        79
+#define GCC_BAM_DMA_AHB_CLK                                    80
+#define GCC_BAM_DMA_INACTIVITY_TIMERS_CLK                      81
+#define GCC_BIMC_CFG_AHB_CLK                                   82
+#define GCC_BIMC_KPSS_AXI_CLK                                  83
+#define GCC_BIMC_SLEEP_CLK                                     84
+#define GCC_BIMC_SYSNOC_AXI_CLK                                        85
+#define GCC_BIMC_XO_CLK                                                86
+#define GCC_BLSP1_AHB_CLK                                      87
+#define GCC_BLSP1_SLEEP_CLK                                    88
+#define GCC_BLSP1_QUP1_I2C_APPS_CLK                            89
+#define GCC_BLSP1_QUP1_SPI_APPS_CLK                            90
+#define GCC_BLSP1_QUP2_I2C_APPS_CLK                            91
+#define GCC_BLSP1_QUP2_SPI_APPS_CLK                            92
+#define GCC_BLSP1_QUP3_I2C_APPS_CLK                            93
+#define GCC_BLSP1_QUP3_SPI_APPS_CLK                            94
+#define GCC_BLSP1_QUP4_I2C_APPS_CLK                            95
+#define GCC_BLSP1_QUP4_SPI_APPS_CLK                            96
+#define GCC_BLSP1_QUP5_I2C_APPS_CLK                            97
+#define GCC_BLSP1_QUP5_SPI_APPS_CLK                            98
+#define GCC_BLSP1_QUP6_I2C_APPS_CLK                            99
+#define GCC_BLSP1_QUP6_SPI_APPS_CLK                            100
+#define GCC_BLSP1_UART1_APPS_CLK                               101
+#define GCC_BLSP1_UART1_SIM_CLK                                        102
+#define GCC_BLSP1_UART2_APPS_CLK                               103
+#define GCC_BLSP1_UART2_SIM_CLK                                        104
+#define GCC_BLSP1_UART3_APPS_CLK                               105
+#define GCC_BLSP1_UART3_SIM_CLK                                        106
+#define GCC_BLSP1_UART4_APPS_CLK                               107
+#define GCC_BLSP1_UART4_SIM_CLK                                        108
+#define GCC_BLSP1_UART5_APPS_CLK                               109
+#define GCC_BLSP1_UART5_SIM_CLK                                        110
+#define GCC_BLSP1_UART6_APPS_CLK                               111
+#define GCC_BLSP1_UART6_SIM_CLK                                        112
+#define GCC_BLSP2_AHB_CLK                                      113
+#define GCC_BLSP2_SLEEP_CLK                                    114
+#define GCC_BLSP2_QUP1_I2C_APPS_CLK                            115
+#define GCC_BLSP2_QUP1_SPI_APPS_CLK                            116
+#define GCC_BLSP2_QUP2_I2C_APPS_CLK                            117
+#define GCC_BLSP2_QUP2_SPI_APPS_CLK                            118
+#define GCC_BLSP2_QUP3_I2C_APPS_CLK                            119
+#define GCC_BLSP2_QUP3_SPI_APPS_CLK                            120
+#define GCC_BLSP2_QUP4_I2C_APPS_CLK                            121
+#define GCC_BLSP2_QUP4_SPI_APPS_CLK                            122
+#define GCC_BLSP2_QUP5_I2C_APPS_CLK                            123
+#define GCC_BLSP2_QUP5_SPI_APPS_CLK                            124
+#define GCC_BLSP2_QUP6_I2C_APPS_CLK                            125
+#define GCC_BLSP2_QUP6_SPI_APPS_CLK                            126
+#define GCC_BLSP2_UART1_APPS_CLK                               127
+#define GCC_BLSP2_UART1_SIM_CLK                                        128
+#define GCC_BLSP2_UART2_APPS_CLK                               129
+#define GCC_BLSP2_UART2_SIM_CLK                                        130
+#define GCC_BLSP2_UART3_APPS_CLK                               131
+#define GCC_BLSP2_UART3_SIM_CLK                                        132
+#define GCC_BLSP2_UART4_APPS_CLK                               133
+#define GCC_BLSP2_UART4_SIM_CLK                                        134
+#define GCC_BLSP2_UART5_APPS_CLK                               135
+#define GCC_BLSP2_UART5_SIM_CLK                                        136
+#define GCC_BLSP2_UART6_APPS_CLK                               137
+#define GCC_BLSP2_UART6_SIM_CLK                                        138
+#define GCC_BOOT_ROM_AHB_CLK                                   139
+#define GCC_CE1_AHB_CLK                                                140
+#define GCC_CE1_AXI_CLK                                                141
+#define GCC_CE1_CLK                                            142
+#define GCC_CE2_AHB_CLK                                                143
+#define GCC_CE2_AXI_CLK                                                144
+#define GCC_CE2_CLK                                            145
+#define GCC_CNOC_BUS_TIMEOUT0_AHB_CLK                          146
+#define GCC_CNOC_BUS_TIMEOUT1_AHB_CLK                          147
+#define GCC_CNOC_BUS_TIMEOUT2_AHB_CLK                          148
+#define GCC_CNOC_BUS_TIMEOUT3_AHB_CLK                          149
+#define GCC_CNOC_BUS_TIMEOUT4_AHB_CLK                          150
+#define GCC_CNOC_BUS_TIMEOUT5_AHB_CLK                          151
+#define GCC_CNOC_BUS_TIMEOUT6_AHB_CLK                          152
+#define GCC_CFG_NOC_AHB_CLK                                    153
+#define GCC_CFG_NOC_DDR_CFG_CLK                                        154
+#define GCC_CFG_NOC_RPM_AHB_CLK                                        155
+#define GCC_BIMC_DDR_CPLL0_CLK                                 156
+#define GCC_BIMC_DDR_CPLL1_CLK                                 157
+#define GCC_DDR_DIM_CFG_CLK                                    158
+#define GCC_DDR_DIM_SLEEP_CLK                                  159
+#define GCC_DEHR_CLK                                           160
+#define GCC_AHB_CLK                                            161
+#define GCC_IM_SLEEP_CLK                                       162
+#define GCC_XO_CLK                                             163
+#define GCC_XO_DIV4_CLK                                                164
+#define GCC_GP1_CLK                                            165
+#define GCC_GP2_CLK                                            166
+#define GCC_GP3_CLK                                            167
+#define GCC_IMEM_AXI_CLK                                       168
+#define GCC_IMEM_CFG_AHB_CLK                                   169
+#define GCC_KPSS_AHB_CLK                                       170
+#define GCC_KPSS_AXI_CLK                                       171
+#define GCC_LPASS_Q6_AXI_CLK                                   172
+#define GCC_MMSS_NOC_AT_CLK                                    173
+#define GCC_MMSS_NOC_CFG_AHB_CLK                               174
+#define GCC_OCMEM_NOC_CFG_AHB_CLK                              175
+#define GCC_OCMEM_SYS_NOC_AXI_CLK                              176
+#define GCC_MPM_AHB_CLK                                                177
+#define GCC_MSG_RAM_AHB_CLK                                    178
+#define GCC_MSS_CFG_AHB_CLK                                    179
+#define GCC_MSS_Q6_BIMC_AXI_CLK                                        180
+#define GCC_NOC_CONF_XPU_AHB_CLK                               181
+#define GCC_PDM2_CLK                                           182
+#define GCC_PDM_AHB_CLK                                                183
+#define GCC_PDM_XO4_CLK                                                184
+#define GCC_PERIPH_NOC_AHB_CLK                                 185
+#define GCC_PERIPH_NOC_AT_CLK                                  186
+#define GCC_PERIPH_NOC_CFG_AHB_CLK                             187
+#define GCC_PERIPH_NOC_MPU_CFG_AHB_CLK                         188
+#define GCC_PERIPH_XPU_AHB_CLK                                 189
+#define GCC_PNOC_BUS_TIMEOUT0_AHB_CLK                          190
+#define GCC_PNOC_BUS_TIMEOUT1_AHB_CLK                          191
+#define GCC_PNOC_BUS_TIMEOUT2_AHB_CLK                          192
+#define GCC_PNOC_BUS_TIMEOUT3_AHB_CLK                          193
+#define GCC_PNOC_BUS_TIMEOUT4_AHB_CLK                          194
+#define GCC_PRNG_AHB_CLK                                       195
+#define GCC_QDSS_AT_CLK                                                196
+#define GCC_QDSS_CFG_AHB_CLK                                   197
+#define GCC_QDSS_DAP_AHB_CLK                                   198
+#define GCC_QDSS_DAP_CLK                                       199
+#define GCC_QDSS_ETR_USB_CLK                                   200
+#define GCC_QDSS_STM_CLK                                       201
+#define GCC_QDSS_TRACECLKIN_CLK                                        202
+#define GCC_QDSS_TSCTR_DIV16_CLK                               203
+#define GCC_QDSS_TSCTR_DIV2_CLK                                        204
+#define GCC_QDSS_TSCTR_DIV3_CLK                                        205
+#define GCC_QDSS_TSCTR_DIV4_CLK                                        206
+#define GCC_QDSS_TSCTR_DIV8_CLK                                        207
+#define GCC_QDSS_RBCPR_XPU_AHB_CLK                             208
+#define GCC_RBCPR_AHB_CLK                                      209
+#define GCC_RBCPR_CLK                                          210
+#define GCC_RPM_BUS_AHB_CLK                                    211
+#define GCC_RPM_PROC_HCLK                                      212
+#define GCC_RPM_SLEEP_CLK                                      213
+#define GCC_RPM_TIMER_CLK                                      214
+#define GCC_SDCC1_AHB_CLK                                      215
+#define GCC_SDCC1_APPS_CLK                                     216
+#define GCC_SDCC1_INACTIVITY_TIMERS_CLK                                217
+#define GCC_SDCC2_AHB_CLK                                      218
+#define GCC_SDCC2_APPS_CLK                                     219
+#define GCC_SDCC2_INACTIVITY_TIMERS_CLK                                220
+#define GCC_SDCC3_AHB_CLK                                      221
+#define GCC_SDCC3_APPS_CLK                                     222
+#define GCC_SDCC3_INACTIVITY_TIMERS_CLK                                223
+#define GCC_SDCC4_AHB_CLK                                      224
+#define GCC_SDCC4_APPS_CLK                                     225
+#define GCC_SDCC4_INACTIVITY_TIMERS_CLK                                226
+#define GCC_SEC_CTRL_ACC_CLK                                   227
+#define GCC_SEC_CTRL_AHB_CLK                                   228
+#define GCC_SEC_CTRL_BOOT_ROM_PATCH_CLK                                229
+#define GCC_SEC_CTRL_CLK                                       230
+#define GCC_SEC_CTRL_SENSE_CLK                                 231
+#define GCC_SNOC_BUS_TIMEOUT0_AHB_CLK                          232
+#define GCC_SNOC_BUS_TIMEOUT2_AHB_CLK                          233
+#define GCC_SPDM_BIMC_CY_CLK                                   234
+#define GCC_SPDM_CFG_AHB_CLK                                   235
+#define GCC_SPDM_DEBUG_CY_CLK                                  236
+#define GCC_SPDM_FF_CLK                                                237
+#define GCC_SPDM_MSTR_AHB_CLK                                  238
+#define GCC_SPDM_PNOC_CY_CLK                                   239
+#define GCC_SPDM_RPM_CY_CLK                                    240
+#define GCC_SPDM_SNOC_CY_CLK                                   241
+#define GCC_SPMI_AHB_CLK                                       242
+#define GCC_SPMI_CNOC_AHB_CLK                                  243
+#define GCC_SPMI_SER_CLK                                       244
+#define GCC_SNOC_CNOC_AHB_CLK                                  245
+#define GCC_SNOC_PNOC_AHB_CLK                                  246
+#define GCC_SYS_NOC_AT_CLK                                     247
+#define GCC_SYS_NOC_AXI_CLK                                    248
+#define GCC_SYS_NOC_KPSS_AHB_CLK                               249
+#define GCC_SYS_NOC_QDSS_STM_AXI_CLK                           250
+#define GCC_SYS_NOC_USB3_AXI_CLK                               251
+#define GCC_TCSR_AHB_CLK                                       252
+#define GCC_TLMM_AHB_CLK                                       253
+#define GCC_TLMM_CLK                                           254
+#define GCC_TSIF_AHB_CLK                                       255
+#define GCC_TSIF_INACTIVITY_TIMERS_CLK                         256
+#define GCC_TSIF_REF_CLK                                       257
+#define GCC_USB2A_PHY_SLEEP_CLK                                        258
+#define GCC_USB2B_PHY_SLEEP_CLK                                        259
+#define GCC_USB30_MASTER_CLK                                   260
+#define GCC_USB30_MOCK_UTMI_CLK                                        261
+#define GCC_USB30_SLEEP_CLK                                    262
+#define GCC_USB_HS_AHB_CLK                                     263
+#define GCC_USB_HS_INACTIVITY_TIMERS_CLK                       264
+#define GCC_USB_HS_SYSTEM_CLK                                  265
+#define GCC_USB_HSIC_AHB_CLK                                   266
+#define GCC_USB_HSIC_CLK                                       267
+#define GCC_USB_HSIC_IO_CAL_CLK                                        268
+#define GCC_USB_HSIC_IO_CAL_SLEEP_CLK                          269
+#define GCC_USB_HSIC_SYSTEM_CLK                                        270
+#define GCC_WCSS_GPLL1_CLK_SRC                                 271
+#define GCC_MMSS_GPLL0_CLK_SRC                                 272
+#define GCC_LPASS_GPLL0_CLK_SRC                                        273
+#define GCC_WCSS_GPLL1_CLK_SRC_SLEEP_ENA                       274
+#define GCC_MMSS_GPLL0_CLK_SRC_SLEEP_ENA                       275
+#define GCC_LPASS_GPLL0_CLK_SRC_SLEEP_ENA                      276
+#define GCC_IMEM_AXI_CLK_SLEEP_ENA                             277
+#define GCC_SYS_NOC_KPSS_AHB_CLK_SLEEP_ENA                     278
+#define GCC_BIMC_KPSS_AXI_CLK_SLEEP_ENA                                279
+#define GCC_KPSS_AHB_CLK_SLEEP_ENA                             280
+#define GCC_KPSS_AXI_CLK_SLEEP_ENA                             281
+#define GCC_MPM_AHB_CLK_SLEEP_ENA                              282
+#define GCC_OCMEM_SYS_NOC_AXI_CLK_SLEEP_ENA                    283
+#define GCC_BLSP1_AHB_CLK_SLEEP_ENA                            284
+#define GCC_BLSP1_SLEEP_CLK_SLEEP_ENA                          285
+#define GCC_BLSP2_AHB_CLK_SLEEP_ENA                            286
+#define GCC_BLSP2_SLEEP_CLK_SLEEP_ENA                          287
+#define GCC_PRNG_AHB_CLK_SLEEP_ENA                             288
+#define GCC_BAM_DMA_AHB_CLK_SLEEP_ENA                          289
+#define GCC_BAM_DMA_INACTIVITY_TIMERS_CLK_SLEEP_ENA            290
+#define GCC_BOOT_ROM_AHB_CLK_SLEEP_ENA                         291
+#define GCC_MSG_RAM_AHB_CLK_SLEEP_ENA                          292
+#define GCC_TLMM_AHB_CLK_SLEEP_ENA                             293
+#define GCC_TLMM_CLK_SLEEP_ENA                                 294
+#define GCC_SPMI_CNOC_AHB_CLK_SLEEP_ENA                                295
+#define GCC_CE1_CLK_SLEEP_ENA                                  296
+#define GCC_CE1_AXI_CLK_SLEEP_ENA                              297
+#define GCC_CE1_AHB_CLK_SLEEP_ENA                              298
+#define GCC_CE2_CLK_SLEEP_ENA                                  299
+#define GCC_CE2_AXI_CLK_SLEEP_ENA                              300
+#define GCC_CE2_AHB_CLK_SLEEP_ENA                              301
+
+#endif
diff --git a/include/dt-bindings/clock/qcom,mmcc-msm8960.h b/include/dt-bindings/clock/qcom,mmcc-msm8960.h
new file mode 100644 (file)
index 0000000..5868ef1
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_CLK_MSM_MMCC_8960_H
+#define _DT_BINDINGS_CLK_MSM_MMCC_8960_H
+
+#define MMSS_AHB_SRC                                   0
+#define FAB_AHB_CLK                                    1
+#define APU_AHB_CLK                                    2
+#define TV_ENC_AHB_CLK                                 3
+#define AMP_AHB_CLK                                    4
+#define DSI2_S_AHB_CLK                                 5
+#define JPEGD_AHB_CLK                                  6
+#define GFX2D0_AHB_CLK                                 7
+#define DSI_S_AHB_CLK                                  8
+#define DSI2_M_AHB_CLK                                 9
+#define VPE_AHB_CLK                                    10
+#define SMMU_AHB_CLK                                   11
+#define HDMI_M_AHB_CLK                                 12
+#define VFE_AHB_CLK                                    13
+#define ROT_AHB_CLK                                    14
+#define VCODEC_AHB_CLK                                 15
+#define MDP_AHB_CLK                                    16
+#define DSI_M_AHB_CLK                                  17
+#define CSI_AHB_CLK                                    18
+#define MMSS_IMEM_AHB_CLK                              19
+#define IJPEG_AHB_CLK                                  20
+#define HDMI_S_AHB_CLK                                 21
+#define GFX3D_AHB_CLK                                  22
+#define GFX2D1_AHB_CLK                                 23
+#define MMSS_FPB_CLK                                   24
+#define MMSS_AXI_SRC                                   25
+#define MMSS_FAB_CORE                                  26
+#define FAB_MSP_AXI_CLK                                        27
+#define JPEGD_AXI_CLK                                  28
+#define GMEM_AXI_CLK                                   29
+#define MDP_AXI_CLK                                    30
+#define MMSS_IMEM_AXI_CLK                              31
+#define IJPEG_AXI_CLK                                  32
+#define GFX3D_AXI_CLK                                  33
+#define VCODEC_AXI_CLK                                 34
+#define VFE_AXI_CLK                                    35
+#define VPE_AXI_CLK                                    36
+#define ROT_AXI_CLK                                    37
+#define VCODEC_AXI_A_CLK                               38
+#define VCODEC_AXI_B_CLK                               39
+#define MM_AXI_S3_FCLK                                 40
+#define MM_AXI_S2_FCLK                                 41
+#define MM_AXI_S1_FCLK                                 42
+#define MM_AXI_S0_FCLK                                 43
+#define MM_AXI_S2_CLK                                  44
+#define MM_AXI_S1_CLK                                  45
+#define MM_AXI_S0_CLK                                  46
+#define CSI0_SRC                                       47
+#define CSI0_CLK                                       48
+#define CSI0_PHY_CLK                                   49
+#define CSI1_SRC                                       50
+#define CSI1_CLK                                       51
+#define CSI1_PHY_CLK                                   52
+#define CSI2_SRC                                       53
+#define CSI2_CLK                                       54
+#define CSI2_PHY_CLK                                   55
+#define DSI_SRC                                                56
+#define DSI_CLK                                                57
+#define CSI_PIX_CLK                                    58
+#define CSI_RDI_CLK                                    59
+#define MDP_VSYNC_CLK                                  60
+#define HDMI_DIV_CLK                                   61
+#define HDMI_APP_CLK                                   62
+#define CSI_PIX1_CLK                                   63
+#define CSI_RDI2_CLK                                   64
+#define CSI_RDI1_CLK                                   65
+#define GFX2D0_SRC                                     66
+#define GFX2D0_CLK                                     67
+#define GFX2D1_SRC                                     68
+#define GFX2D1_CLK                                     69
+#define GFX3D_SRC                                      70
+#define GFX3D_CLK                                      71
+#define IJPEG_SRC                                      72
+#define IJPEG_CLK                                      73
+#define JPEGD_SRC                                      74
+#define JPEGD_CLK                                      75
+#define MDP_SRC                                                76
+#define MDP_CLK                                                77
+#define MDP_LUT_CLK                                    78
+#define DSI2_PIXEL_SRC                                 79
+#define DSI2_PIXEL_CLK                                 80
+#define DSI2_SRC                                       81
+#define DSI2_CLK                                       82
+#define DSI1_BYTE_SRC                                  83
+#define DSI1_BYTE_CLK                                  84
+#define DSI2_BYTE_SRC                                  85
+#define DSI2_BYTE_CLK                                  86
+#define DSI1_ESC_SRC                                   87
+#define DSI1_ESC_CLK                                   88
+#define DSI2_ESC_SRC                                   89
+#define DSI2_ESC_CLK                                   90
+#define ROT_SRC                                                91
+#define ROT_CLK                                                92
+#define TV_ENC_CLK                                     93
+#define TV_DAC_CLK                                     94
+#define HDMI_TV_CLK                                    95
+#define MDP_TV_CLK                                     96
+#define TV_SRC                                         97
+#define VCODEC_SRC                                     98
+#define VCODEC_CLK                                     99
+#define VFE_SRC                                                100
+#define VFE_CLK                                                101
+#define VFE_CSI_CLK                                    102
+#define VPE_SRC                                                103
+#define VPE_CLK                                                104
+#define DSI_PIXEL_SRC                                  105
+#define DSI_PIXEL_CLK                                  106
+#define CAMCLK0_SRC                                    107
+#define CAMCLK0_CLK                                    108
+#define CAMCLK1_SRC                                    109
+#define CAMCLK1_CLK                                    110
+#define CAMCLK2_SRC                                    111
+#define CAMCLK2_CLK                                    112
+#define CSIPHYTIMER_SRC                                        113
+#define CSIPHY2_TIMER_CLK                              114
+#define CSIPHY1_TIMER_CLK                              115
+#define CSIPHY0_TIMER_CLK                              116
+#define PLL1                                           117
+#define PLL2                                           118
+
+#endif
diff --git a/include/dt-bindings/clock/qcom,mmcc-msm8974.h b/include/dt-bindings/clock/qcom,mmcc-msm8974.h
new file mode 100644 (file)
index 0000000..04d318d
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_CLK_MSM_MMCC_8974_H
+#define _DT_BINDINGS_CLK_MSM_MMCC_8974_H
+
+#define MMSS_AHB_CLK_SRC                               0
+#define MMSS_AXI_CLK_SRC                               1
+#define MMPLL0                                         2
+#define MMPLL0_VOTE                                    3
+#define MMPLL1                                         4
+#define MMPLL1_VOTE                                    5
+#define MMPLL2                                         6
+#define MMPLL3                                         7
+#define CSI0_CLK_SRC                                   8
+#define CSI1_CLK_SRC                                   9
+#define CSI2_CLK_SRC                                   10
+#define CSI3_CLK_SRC                                   11
+#define VFE0_CLK_SRC                                   12
+#define VFE1_CLK_SRC                                   13
+#define MDP_CLK_SRC                                    14
+#define GFX3D_CLK_SRC                                  15
+#define JPEG0_CLK_SRC                                  16
+#define JPEG1_CLK_SRC                                  17
+#define JPEG2_CLK_SRC                                  18
+#define PCLK0_CLK_SRC                                  19
+#define PCLK1_CLK_SRC                                  20
+#define VCODEC0_CLK_SRC                                        21
+#define CCI_CLK_SRC                                    22
+#define CAMSS_GP0_CLK_SRC                              23
+#define CAMSS_GP1_CLK_SRC                              24
+#define MCLK0_CLK_SRC                                  25
+#define MCLK1_CLK_SRC                                  26
+#define MCLK2_CLK_SRC                                  27
+#define MCLK3_CLK_SRC                                  28
+#define CSI0PHYTIMER_CLK_SRC                           29
+#define CSI1PHYTIMER_CLK_SRC                           30
+#define CSI2PHYTIMER_CLK_SRC                           31
+#define CPP_CLK_SRC                                    32
+#define BYTE0_CLK_SRC                                  33
+#define BYTE1_CLK_SRC                                  34
+#define EDPAUX_CLK_SRC                                 35
+#define EDPLINK_CLK_SRC                                        36
+#define EDPPIXEL_CLK_SRC                               37
+#define ESC0_CLK_SRC                                   38
+#define ESC1_CLK_SRC                                   39
+#define EXTPCLK_CLK_SRC                                        40
+#define HDMI_CLK_SRC                                   41
+#define VSYNC_CLK_SRC                                  42
+#define RBCPR_CLK_SRC                                  43
+#define CAMSS_CCI_CCI_AHB_CLK                          44
+#define CAMSS_CCI_CCI_CLK                              45
+#define CAMSS_CSI0_AHB_CLK                             46
+#define CAMSS_CSI0_CLK                                 47
+#define CAMSS_CSI0PHY_CLK                              48
+#define CAMSS_CSI0PIX_CLK                              49
+#define CAMSS_CSI0RDI_CLK                              50
+#define CAMSS_CSI1_AHB_CLK                             51
+#define CAMSS_CSI1_CLK                                 52
+#define CAMSS_CSI1PHY_CLK                              53
+#define CAMSS_CSI1PIX_CLK                              54
+#define CAMSS_CSI1RDI_CLK                              55
+#define CAMSS_CSI2_AHB_CLK                             56
+#define CAMSS_CSI2_CLK                                 57
+#define CAMSS_CSI2PHY_CLK                              58
+#define CAMSS_CSI2PIX_CLK                              59
+#define CAMSS_CSI2RDI_CLK                              60
+#define CAMSS_CSI3_AHB_CLK                             61
+#define CAMSS_CSI3_CLK                                 62
+#define CAMSS_CSI3PHY_CLK                              63
+#define CAMSS_CSI3PIX_CLK                              64
+#define CAMSS_CSI3RDI_CLK                              65
+#define CAMSS_CSI_VFE0_CLK                             66
+#define CAMSS_CSI_VFE1_CLK                             67
+#define CAMSS_GP0_CLK                                  68
+#define CAMSS_GP1_CLK                                  69
+#define CAMSS_ISPIF_AHB_CLK                            70
+#define CAMSS_JPEG_JPEG0_CLK                           71
+#define CAMSS_JPEG_JPEG1_CLK                           72
+#define CAMSS_JPEG_JPEG2_CLK                           73
+#define CAMSS_JPEG_JPEG_AHB_CLK                                74
+#define CAMSS_JPEG_JPEG_AXI_CLK                                75
+#define CAMSS_JPEG_JPEG_OCMEMNOC_CLK                   76
+#define CAMSS_MCLK0_CLK                                        77
+#define CAMSS_MCLK1_CLK                                        78
+#define CAMSS_MCLK2_CLK                                        79
+#define CAMSS_MCLK3_CLK                                        80
+#define CAMSS_MICRO_AHB_CLK                            81
+#define CAMSS_PHY0_CSI0PHYTIMER_CLK                    82
+#define CAMSS_PHY1_CSI1PHYTIMER_CLK                    83
+#define CAMSS_PHY2_CSI2PHYTIMER_CLK                    84
+#define CAMSS_TOP_AHB_CLK                              85
+#define CAMSS_VFE_CPP_AHB_CLK                          86
+#define CAMSS_VFE_CPP_CLK                              87
+#define CAMSS_VFE_VFE0_CLK                             88
+#define CAMSS_VFE_VFE1_CLK                             89
+#define CAMSS_VFE_VFE_AHB_CLK                          90
+#define CAMSS_VFE_VFE_AXI_CLK                          91
+#define CAMSS_VFE_VFE_OCMEMNOC_CLK                     92
+#define MDSS_AHB_CLK                                   93
+#define MDSS_AXI_CLK                                   94
+#define MDSS_BYTE0_CLK                                 95
+#define MDSS_BYTE1_CLK                                 96
+#define MDSS_EDPAUX_CLK                                        97
+#define MDSS_EDPLINK_CLK                               98
+#define MDSS_EDPPIXEL_CLK                              99
+#define MDSS_ESC0_CLK                                  100
+#define MDSS_ESC1_CLK                                  101
+#define MDSS_EXTPCLK_CLK                               102
+#define MDSS_HDMI_AHB_CLK                              103
+#define MDSS_HDMI_CLK                                  104
+#define MDSS_MDP_CLK                                   105
+#define MDSS_MDP_LUT_CLK                               106
+#define MDSS_PCLK0_CLK                                 107
+#define MDSS_PCLK1_CLK                                 108
+#define MDSS_VSYNC_CLK                                 109
+#define MMSS_MISC_AHB_CLK                              110
+#define MMSS_MMSSNOC_AHB_CLK                           111
+#define MMSS_MMSSNOC_BTO_AHB_CLK                       112
+#define MMSS_MMSSNOC_AXI_CLK                           113
+#define MMSS_S0_AXI_CLK                                        114
+#define OCMEMCX_AHB_CLK                                        115
+#define OCMEMCX_OCMEMNOC_CLK                           116
+#define OXILI_OCMEMGX_CLK                              117
+#define OCMEMNOC_CLK                                   118
+#define OXILI_GFX3D_CLK                                        119
+#define OXILICX_AHB_CLK                                        120
+#define OXILICX_AXI_CLK                                        121
+#define VENUS0_AHB_CLK                                 122
+#define VENUS0_AXI_CLK                                 123
+#define VENUS0_OCMEMNOC_CLK                            124
+#define VENUS0_VCODEC0_CLK                             125
+#define OCMEMNOC_CLK_SRC                               126
+#define SPDM_JPEG0                                     127
+#define SPDM_JPEG1                                     128
+#define SPDM_MDP                                       129
+#define SPDM_AXI                                       130
+#define SPDM_VCODEC0                                   131
+#define SPDM_VFE0                                      132
+#define SPDM_VFE1                                      133
+#define SPDM_JPEG2                                     134
+#define SPDM_PCLK1                                     135
+#define SPDM_GFX3D                                     136
+#define SPDM_AHB                                       137
+#define SPDM_PCLK0                                     138
+#define SPDM_OCMEMNOC                                  139
+#define SPDM_CSI0                                      140
+#define SPDM_RM_AXI                                    141
+#define SPDM_RM_OCMEMNOC                               142
+
+#endif
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
new file mode 100644 (file)
index 0000000..859e9be
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2013 Ideas On Board SPRL
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_R8A7790_H__
+#define __DT_BINDINGS_CLOCK_R8A7790_H__
+
+/* CPG */
+#define R8A7790_CLK_MAIN               0
+#define R8A7790_CLK_PLL0               1
+#define R8A7790_CLK_PLL1               2
+#define R8A7790_CLK_PLL3               3
+#define R8A7790_CLK_LB                 4
+#define R8A7790_CLK_QSPI               5
+#define R8A7790_CLK_SDH                        6
+#define R8A7790_CLK_SD0                        7
+#define R8A7790_CLK_SD1                        8
+#define R8A7790_CLK_Z                  9
+
+/* MSTP0 */
+#define R8A7790_CLK_MSIOF0             0
+
+/* MSTP1 */
+#define R8A7790_CLK_TMU1               11
+#define R8A7790_CLK_TMU3               21
+#define R8A7790_CLK_TMU2               22
+#define R8A7790_CLK_CMT0               24
+#define R8A7790_CLK_TMU0               25
+#define R8A7790_CLK_VSP1_DU1           27
+#define R8A7790_CLK_VSP1_DU0           28
+#define R8A7790_CLK_VSP1_RT            30
+#define R8A7790_CLK_VSP1_SY            31
+
+/* MSTP2 */
+#define R8A7790_CLK_SCIFA2             2
+#define R8A7790_CLK_SCIFA1             3
+#define R8A7790_CLK_SCIFA0             4
+#define R8A7790_CLK_MSIOF2             5
+#define R8A7790_CLK_SCIFB0             6
+#define R8A7790_CLK_SCIFB1             7
+#define R8A7790_CLK_MSIOF1             8
+#define R8A7790_CLK_MSIOF3             15
+#define R8A7790_CLK_SCIFB2             16
+#define R8A7790_CLK_SYS_DMAC0          18
+#define R8A7790_CLK_SYS_DMAC1          19
+
+/* MSTP3 */
+#define R8A7790_CLK_TPU0               4
+#define R8A7790_CLK_MMCIF1             5
+#define R8A7790_CLK_SDHI3              11
+#define R8A7790_CLK_SDHI2              12
+#define R8A7790_CLK_SDHI1              13
+#define R8A7790_CLK_SDHI0              14
+#define R8A7790_CLK_MMCIF0             15
+#define R8A7790_CLK_SSUSB              28
+#define R8A7790_CLK_CMT1               29
+#define R8A7790_CLK_USBDMAC0           30
+#define R8A7790_CLK_USBDMAC1           31
+
+/* MSTP5 */
+#define R8A7790_CLK_THERMAL            22
+#define R8A7790_CLK_PWM                        23
+
+/* MSTP7 */
+#define R8A7790_CLK_EHCI               3
+#define R8A7790_CLK_HSUSB              4
+#define R8A7790_CLK_HSCIF1             16
+#define R8A7790_CLK_HSCIF0             17
+#define R8A7790_CLK_SCIF1              20
+#define R8A7790_CLK_SCIF0              21
+#define R8A7790_CLK_DU2                        22
+#define R8A7790_CLK_DU1                        23
+#define R8A7790_CLK_DU0                        24
+#define R8A7790_CLK_LVDS1              25
+#define R8A7790_CLK_LVDS0              26
+
+/* MSTP8 */
+#define R8A7790_CLK_VIN3               8
+#define R8A7790_CLK_VIN2               9
+#define R8A7790_CLK_VIN1               10
+#define R8A7790_CLK_VIN0               11
+#define R8A7790_CLK_ETHER              13
+#define R8A7790_CLK_SATA1              14
+#define R8A7790_CLK_SATA0              15
+
+/* MSTP9 */
+#define R8A7790_CLK_GPIO5              7
+#define R8A7790_CLK_GPIO4              8
+#define R8A7790_CLK_GPIO3              9
+#define R8A7790_CLK_GPIO2              10
+#define R8A7790_CLK_GPIO1              11
+#define R8A7790_CLK_GPIO0              12
+#define R8A7790_CLK_RCAN1              15
+#define R8A7790_CLK_RCAN0              16
+#define R8A7790_CLK_QSPI_MOD           17
+#define R8A7790_CLK_IICDVFS            26
+#define R8A7790_CLK_I2C3               28
+#define R8A7790_CLK_I2C2               29
+#define R8A7790_CLK_I2C1               30
+#define R8A7790_CLK_I2C0               31
+
+#endif /* __DT_BINDINGS_CLOCK_R8A7790_H__ */
diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
new file mode 100644 (file)
index 0000000..30f82f2
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 Ideas On Board SPRL
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_R8A7791_H__
+#define __DT_BINDINGS_CLOCK_R8A7791_H__
+
+/* CPG */
+#define R8A7791_CLK_MAIN               0
+#define R8A7791_CLK_PLL0               1
+#define R8A7791_CLK_PLL1               2
+#define R8A7791_CLK_PLL3               3
+#define R8A7791_CLK_LB                 4
+#define R8A7791_CLK_QSPI               5
+#define R8A7791_CLK_SDH                        6
+#define R8A7791_CLK_SD0                        7
+#define R8A7791_CLK_Z                  8
+
+/* MSTP0 */
+#define R8A7791_CLK_MSIOF0             0
+
+/* MSTP1 */
+#define R8A7791_CLK_TMU1               11
+#define R8A7791_CLK_TMU3               21
+#define R8A7791_CLK_TMU2               22
+#define R8A7791_CLK_CMT0               24
+#define R8A7791_CLK_TMU0               25
+#define R8A7791_CLK_VSP1_DU1           27
+#define R8A7791_CLK_VSP1_DU0           28
+#define R8A7791_CLK_VSP1_SY            31
+
+/* MSTP2 */
+#define R8A7791_CLK_SCIFA2             2
+#define R8A7791_CLK_SCIFA1             3
+#define R8A7791_CLK_SCIFA0             4
+#define R8A7791_CLK_MSIOF2             5
+#define R8A7791_CLK_SCIFB0             6
+#define R8A7791_CLK_SCIFB1             7
+#define R8A7791_CLK_MSIOF1             8
+#define R8A7791_CLK_SCIFB2             16
+#define R8A7791_CLK_DMAC               18
+
+/* MSTP3 */
+#define R8A7791_CLK_TPU0               4
+#define R8A7791_CLK_SDHI2              11
+#define R8A7791_CLK_SDHI1              12
+#define R8A7791_CLK_SDHI0              14
+#define R8A7791_CLK_MMCIF0             15
+#define R8A7791_CLK_SSUSB              28
+#define R8A7791_CLK_CMT1               29
+#define R8A7791_CLK_USBDMAC0           30
+#define R8A7791_CLK_USBDMAC1           31
+
+/* MSTP5 */
+#define R8A7791_CLK_THERMAL            22
+#define R8A7791_CLK_PWM                        23
+
+/* MSTP7 */
+#define R8A7791_CLK_HSUSB              4
+#define R8A7791_CLK_HSCIF2             13
+#define R8A7791_CLK_SCIF5              14
+#define R8A7791_CLK_SCIF4              15
+#define R8A7791_CLK_HSCIF1             16
+#define R8A7791_CLK_HSCIF0             17
+#define R8A7791_CLK_SCIF3              18
+#define R8A7791_CLK_SCIF2              19
+#define R8A7791_CLK_SCIF1              20
+#define R8A7791_CLK_SCIF0              21
+#define R8A7791_CLK_DU1                        23
+#define R8A7791_CLK_DU0                        24
+#define R8A7791_CLK_LVDS0              26
+
+/* MSTP8 */
+#define R8A7791_CLK_VIN2               9
+#define R8A7791_CLK_VIN1               10
+#define R8A7791_CLK_VIN0               11
+#define R8A7791_CLK_ETHER              13
+#define R8A7791_CLK_SATA1              14
+#define R8A7791_CLK_SATA0              15
+
+/* MSTP9 */
+#define R8A7791_CLK_GPIO7              4
+#define R8A7791_CLK_GPIO6              5
+#define R8A7791_CLK_GPIO5              7
+#define R8A7791_CLK_GPIO4              8
+#define R8A7791_CLK_GPIO3              9
+#define R8A7791_CLK_GPIO2              10
+#define R8A7791_CLK_GPIO1              11
+#define R8A7791_CLK_GPIO0              12
+#define R8A7791_CLK_RCAN1              15
+#define R8A7791_CLK_RCAN0              16
+#define R8A7791_CLK_QSPI_MOD           17
+#define R8A7791_CLK_I2C5               25
+#define R8A7791_CLK_IICDVFS            26
+#define R8A7791_CLK_I2C4               27
+#define R8A7791_CLK_I2C3               28
+#define R8A7791_CLK_I2C2               29
+#define R8A7791_CLK_I2C1               30
+#define R8A7791_CLK_I2C0               31
+
+/* MSTP11 */
+#define R8A7791_CLK_SCIFA3             6
+#define R8A7791_CLK_SCIFA4             7
+#define R8A7791_CLK_SCIFA5             8
+
+#endif /* __DT_BINDINGS_CLOCK_R8A7791_H__ */
index 614aec4179029fbbcd62407483899590d15c6c49..6d0d8d8ef31ec9cb85b7bb9ec722a052a2eff019 100644 (file)
 #define TEGRA114_CLK_I2S2 18
 #define TEGRA114_CLK_EPP 19
 /* 20 (register bit affects vi and vi_sensor) */
-#define TEGRA114_CLK_GR_2D 21
+#define TEGRA114_CLK_GR2D 21
 #define TEGRA114_CLK_USBD 22
 #define TEGRA114_CLK_ISP 23
-#define TEGRA114_CLK_GR_3D 24
+#define TEGRA114_CLK_GR3D 24
 /* 25 */
 #define TEGRA114_CLK_DISP2 26
 #define TEGRA114_CLK_DISP1 27
 #define TEGRA114_CLK_PCLK 261
 #define TEGRA114_CLK_CCLK_G 262
 #define TEGRA114_CLK_CCLK_LP 263
-/* 264 */
-/* 265 */
+#define TEGRA114_CLK_DFLL_REF 264
+#define TEGRA114_CLK_DFLL_SOC 265
 /* 266 */
 /* 267 */
 /* 268 */
diff --git a/include/dt-bindings/clock/tegra124-car.h b/include/dt-bindings/clock/tegra124-car.h
new file mode 100644 (file)
index 0000000..a1116a3
--- /dev/null
@@ -0,0 +1,341 @@
+/*
+ * This header provides constants for binding nvidia,tegra124-car.
+ *
+ * The first 192 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB
+ * registers. These IDs often match those in the CAR's RST_DEVICES registers,
+ * but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In
+ * this case, those clocks are assigned IDs above 185 in order to highlight
+ * this issue. Implementations that interpret these clock IDs as bit values
+ * within the CLK_OUT_ENB or RST_DEVICES registers should be careful to
+ * explicitly handle these special cases.
+ *
+ * The balance of the clocks controlled by the CAR are assigned IDs of 185 and
+ * above.
+ */
+
+#ifndef _DT_BINDINGS_CLOCK_TEGRA124_CAR_H
+#define _DT_BINDINGS_CLOCK_TEGRA124_CAR_H
+
+/* 0 */
+/* 1 */
+/* 2 */
+#define TEGRA124_CLK_ISPB 3
+#define TEGRA124_CLK_RTC 4
+#define TEGRA124_CLK_TIMER 5
+#define TEGRA124_CLK_UARTA 6
+/* 7 (register bit affects uartb and vfir) */
+/* 8 */
+#define TEGRA124_CLK_SDMMC2 9
+/* 10 (register bit affects spdif_in and spdif_out) */
+#define TEGRA124_CLK_I2S1 11
+#define TEGRA124_CLK_I2C1 12
+#define TEGRA124_CLK_NDFLASH 13
+#define TEGRA124_CLK_SDMMC1 14
+#define TEGRA124_CLK_SDMMC4 15
+/* 16 */
+#define TEGRA124_CLK_PWM 17
+#define TEGRA124_CLK_I2S2 18
+/* 20 (register bit affects vi and vi_sensor) */
+#define TEGRA124_CLK_GR_2D 21
+#define TEGRA124_CLK_USBD 22
+#define TEGRA124_CLK_ISP 23
+#define TEGRA124_CLK_GR_3D 24
+/* 25 */
+#define TEGRA124_CLK_DISP2 26
+#define TEGRA124_CLK_DISP1 27
+#define TEGRA124_CLK_HOST1X 28
+#define TEGRA124_CLK_VCP 29
+#define TEGRA124_CLK_I2S0 30
+/* 31 */
+
+/* 32 */
+/* 33 */
+#define TEGRA124_CLK_APBDMA 34
+/* 35 */
+#define TEGRA124_CLK_KBC 36
+/* 37 */
+/* 38 */
+/* 39 (register bit affects fuse and fuse_burn) */
+#define TEGRA124_CLK_KFUSE 40
+#define TEGRA124_CLK_SBC1 41
+#define TEGRA124_CLK_NOR 42
+/* 43 */
+#define TEGRA124_CLK_SBC2 44
+/* 45 */
+#define TEGRA124_CLK_SBC3 46
+#define TEGRA124_CLK_I2C5 47
+#define TEGRA124_CLK_DSIA 48
+/* 49 */
+#define TEGRA124_CLK_MIPI 50
+#define TEGRA124_CLK_HDMI 51
+#define TEGRA124_CLK_CSI 52
+/* 53 */
+#define TEGRA124_CLK_I2C2 54
+#define TEGRA124_CLK_UARTC 55
+#define TEGRA124_CLK_MIPI_CAL 56
+#define TEGRA124_CLK_EMC 57
+#define TEGRA124_CLK_USB2 58
+#define TEGRA124_CLK_USB3 59
+/* 60 */
+#define TEGRA124_CLK_VDE 61
+#define TEGRA124_CLK_BSEA 62
+#define TEGRA124_CLK_BSEV 63
+
+/* 64 */
+#define TEGRA124_CLK_UARTD 65
+#define TEGRA124_CLK_UARTE 66
+#define TEGRA124_CLK_I2C3 67
+#define TEGRA124_CLK_SBC4 68
+#define TEGRA124_CLK_SDMMC3 69
+#define TEGRA124_CLK_PCIE 70
+#define TEGRA124_CLK_OWR 71
+#define TEGRA124_CLK_AFI 72
+#define TEGRA124_CLK_CSITE 73
+/* 74 */
+/* 75 */
+#define TEGRA124_CLK_LA 76
+#define TEGRA124_CLK_TRACE 77
+#define TEGRA124_CLK_SOC_THERM 78
+#define TEGRA124_CLK_DTV 79
+#define TEGRA124_CLK_NDSPEED 80
+#define TEGRA124_CLK_I2CSLOW 81
+#define TEGRA124_CLK_DSIB 82
+#define TEGRA124_CLK_TSEC 83
+/* 84 */
+/* 85 */
+/* 86 */
+/* 87 */
+/* 88 */
+#define TEGRA124_CLK_XUSB_HOST 89
+/* 90 */
+#define TEGRA124_CLK_MSENC 91
+#define TEGRA124_CLK_CSUS 92
+/* 93 */
+/* 94 */
+/* 95 (bit affects xusb_dev and xusb_dev_src) */
+
+/* 96 */
+/* 97 */
+/* 98 */
+#define TEGRA124_CLK_MSELECT 99
+#define TEGRA124_CLK_TSENSOR 100
+#define TEGRA124_CLK_I2S3 101
+#define TEGRA124_CLK_I2S4 102
+#define TEGRA124_CLK_I2C4 103
+#define TEGRA124_CLK_SBC5 104
+#define TEGRA124_CLK_SBC6 105
+#define TEGRA124_CLK_D_AUDIO 106
+#define TEGRA124_CLK_APBIF 107
+#define TEGRA124_CLK_DAM0 108
+#define TEGRA124_CLK_DAM1 109
+#define TEGRA124_CLK_DAM2 110
+#define TEGRA124_CLK_HDA2CODEC_2X 111
+/* 112 */
+#define TEGRA124_CLK_AUDIO0_2X 113
+#define TEGRA124_CLK_AUDIO1_2X 114
+#define TEGRA124_CLK_AUDIO2_2X 115
+#define TEGRA124_CLK_AUDIO3_2X 116
+#define TEGRA124_CLK_AUDIO4_2X 117
+#define TEGRA124_CLK_SPDIF_2X 118
+#define TEGRA124_CLK_ACTMON 119
+#define TEGRA124_CLK_EXTERN1 120
+#define TEGRA124_CLK_EXTERN2 121
+#define TEGRA124_CLK_EXTERN3 122
+#define TEGRA124_CLK_SATA_OOB 123
+#define TEGRA124_CLK_SATA 124
+#define TEGRA124_CLK_HDA 125
+/* 126 */
+#define TEGRA124_CLK_SE 127
+
+#define TEGRA124_CLK_HDA2HDMI 128
+#define TEGRA124_CLK_SATA_COLD 129
+/* 130 */
+/* 131 */
+/* 132 */
+/* 133 */
+/* 134 */
+/* 135 */
+/* 136 */
+/* 137 */
+/* 138 */
+/* 139 */
+/* 140 */
+/* 141 */
+/* 142 */
+/* 143 (bit affects xusb_falcon_src, xusb_fs_src, */
+/*      xusb_host_src and xusb_ss_src) */
+#define TEGRA124_CLK_CILAB 144
+#define TEGRA124_CLK_CILCD 145
+#define TEGRA124_CLK_CILE 146
+#define TEGRA124_CLK_DSIALP 147
+#define TEGRA124_CLK_DSIBLP 148
+#define TEGRA124_CLK_ENTROPY 149
+#define TEGRA124_CLK_DDS 150
+/* 151 */
+#define TEGRA124_CLK_DP2 152
+#define TEGRA124_CLK_AMX 153
+#define TEGRA124_CLK_ADX 154
+/* 155 (bit affects dfll_ref and dfll_soc) */
+#define TEGRA124_CLK_XUSB_SS 156
+/* 157 */
+/* 158 */
+/* 159 */
+
+/* 160 */
+/* 161 */
+/* 162 */
+/* 163 */
+/* 164 */
+/* 165 */
+#define TEGRA124_CLK_I2C6 166
+/* 167 */
+/* 168 */
+/* 169 */
+/* 170 */
+#define TEGRA124_CLK_VIM2_CLK 171
+/* 172 */
+/* 173 */
+/* 174 */
+/* 175 */
+#define TEGRA124_CLK_HDMI_AUDIO 176
+#define TEGRA124_CLK_CLK72MHZ 177
+#define TEGRA124_CLK_VIC03 178
+/* 179 */
+#define TEGRA124_CLK_ADX1 180
+#define TEGRA124_CLK_DPAUX 181
+#define TEGRA124_CLK_SOR0 182
+/* 183 */
+#define TEGRA124_CLK_GPU 184
+#define TEGRA124_CLK_AMX1 185
+/* 186 */
+/* 187 */
+/* 188 */
+/* 189 */
+/* 190 */
+/* 191 */
+#define TEGRA124_CLK_UARTB 192
+#define TEGRA124_CLK_VFIR 193
+#define TEGRA124_CLK_SPDIF_IN 194
+#define TEGRA124_CLK_SPDIF_OUT 195
+#define TEGRA124_CLK_VI 196
+#define TEGRA124_CLK_VI_SENSOR 197
+#define TEGRA124_CLK_FUSE 198
+#define TEGRA124_CLK_FUSE_BURN 199
+#define TEGRA124_CLK_CLK_32K 200
+#define TEGRA124_CLK_CLK_M 201
+#define TEGRA124_CLK_CLK_M_DIV2 202
+#define TEGRA124_CLK_CLK_M_DIV4 203
+#define TEGRA124_CLK_PLL_REF 204
+#define TEGRA124_CLK_PLL_C 205
+#define TEGRA124_CLK_PLL_C_OUT1 206
+#define TEGRA124_CLK_PLL_C2 207
+#define TEGRA124_CLK_PLL_C3 208
+#define TEGRA124_CLK_PLL_M 209
+#define TEGRA124_CLK_PLL_M_OUT1 210
+#define TEGRA124_CLK_PLL_P 211
+#define TEGRA124_CLK_PLL_P_OUT1 212
+#define TEGRA124_CLK_PLL_P_OUT2 213
+#define TEGRA124_CLK_PLL_P_OUT3 214
+#define TEGRA124_CLK_PLL_P_OUT4 215
+#define TEGRA124_CLK_PLL_A 216
+#define TEGRA124_CLK_PLL_A_OUT0 217
+#define TEGRA124_CLK_PLL_D 218
+#define TEGRA124_CLK_PLL_D_OUT0 219
+#define TEGRA124_CLK_PLL_D2 220
+#define TEGRA124_CLK_PLL_D2_OUT0 221
+#define TEGRA124_CLK_PLL_U 222
+#define TEGRA124_CLK_PLL_U_480M 223
+
+#define TEGRA124_CLK_PLL_U_60M 224
+#define TEGRA124_CLK_PLL_U_48M 225
+#define TEGRA124_CLK_PLL_U_12M 226
+#define TEGRA124_CLK_PLL_X 227
+#define TEGRA124_CLK_PLL_X_OUT0 228
+#define TEGRA124_CLK_PLL_RE_VCO 229
+#define TEGRA124_CLK_PLL_RE_OUT 230
+#define TEGRA124_CLK_PLL_E 231
+#define TEGRA124_CLK_SPDIF_IN_SYNC 232
+#define TEGRA124_CLK_I2S0_SYNC 233
+#define TEGRA124_CLK_I2S1_SYNC 234
+#define TEGRA124_CLK_I2S2_SYNC 235
+#define TEGRA124_CLK_I2S3_SYNC 236
+#define TEGRA124_CLK_I2S4_SYNC 237
+#define TEGRA124_CLK_VIMCLK_SYNC 238
+#define TEGRA124_CLK_AUDIO0 239
+#define TEGRA124_CLK_AUDIO1 240
+#define TEGRA124_CLK_AUDIO2 241
+#define TEGRA124_CLK_AUDIO3 242
+#define TEGRA124_CLK_AUDIO4 243
+#define TEGRA124_CLK_SPDIF 244
+#define TEGRA124_CLK_CLK_OUT_1 245
+#define TEGRA124_CLK_CLK_OUT_2 246
+#define TEGRA124_CLK_CLK_OUT_3 247
+#define TEGRA124_CLK_BLINK 248
+/* 249 */
+/* 250 */
+/* 251 */
+#define TEGRA124_CLK_XUSB_HOST_SRC 252
+#define TEGRA124_CLK_XUSB_FALCON_SRC 253
+#define TEGRA124_CLK_XUSB_FS_SRC 254
+#define TEGRA124_CLK_XUSB_SS_SRC 255
+
+#define TEGRA124_CLK_XUSB_DEV_SRC 256
+#define TEGRA124_CLK_XUSB_DEV 257
+#define TEGRA124_CLK_XUSB_HS_SRC 258
+#define TEGRA124_CLK_SCLK 259
+#define TEGRA124_CLK_HCLK 260
+#define TEGRA124_CLK_PCLK 261
+#define TEGRA124_CLK_CCLK_G 262
+#define TEGRA124_CLK_CCLK_LP 263
+#define TEGRA124_CLK_DFLL_REF 264
+#define TEGRA124_CLK_DFLL_SOC 265
+#define TEGRA124_CLK_VI_SENSOR2 266
+#define TEGRA124_CLK_PLL_P_OUT5 267
+#define TEGRA124_CLK_CML0 268
+#define TEGRA124_CLK_CML1 269
+#define TEGRA124_CLK_PLL_C4 270
+#define TEGRA124_CLK_PLL_DP 271
+#define TEGRA124_CLK_PLL_E_MUX 272
+/* 273 */
+/* 274 */
+/* 275 */
+/* 276 */
+/* 277 */
+/* 278 */
+/* 279 */
+/* 280 */
+/* 281 */
+/* 282 */
+/* 283 */
+/* 284 */
+/* 285 */
+/* 286 */
+/* 287 */
+
+/* 288 */
+/* 289 */
+/* 290 */
+/* 291 */
+/* 292 */
+/* 293 */
+/* 294 */
+/* 295 */
+/* 296 */
+/* 297 */
+/* 298 */
+/* 299 */
+#define TEGRA124_CLK_AUDIO0_MUX 300
+#define TEGRA124_CLK_AUDIO1_MUX 301
+#define TEGRA124_CLK_AUDIO2_MUX 302
+#define TEGRA124_CLK_AUDIO3_MUX 303
+#define TEGRA124_CLK_AUDIO4_MUX 304
+#define TEGRA124_CLK_SPDIF_MUX 305
+#define TEGRA124_CLK_CLK_OUT_1_MUX 306
+#define TEGRA124_CLK_CLK_OUT_2_MUX 307
+#define TEGRA124_CLK_CLK_OUT_3_MUX 308
+#define TEGRA124_CLK_DSIA_MUX 309
+#define TEGRA124_CLK_DSIB_MUX 310
+#define TEGRA124_CLK_SOR0_LVDS 311
+#define TEGRA124_CLK_CLK_MAX 312
+
+#endif /* _DT_BINDINGS_CLOCK_TEGRA124_CAR_H */
index a1ae9a8fdd6c5bbb5bd0472d65791b650b660a6c..9406207cfac8715b2545a8e77ae8bc7866e838fb 100644 (file)
@@ -92,7 +92,7 @@
 #define TEGRA20_CLK_OWR 71
 #define TEGRA20_CLK_AFI 72
 #define TEGRA20_CLK_CSITE 73
-#define TEGRA20_CLK_PCIE_XCLK 74
+/* 74 */
 #define TEGRA20_CLK_AVPUCQ 75
 #define TEGRA20_CLK_LA 76
 /* 77 */
index e40fae8f9a8d7f7634330d87918ede31a3a3c78d..889e49ba0aa3de3f3b83ad27b1d0f4b12521a05a 100644 (file)
@@ -92,7 +92,7 @@
 #define TEGRA30_CLK_OWR 71
 #define TEGRA30_CLK_AFI 72
 #define TEGRA30_CLK_CSITE 73
-#define TEGRA30_CLK_PCIEX 74
+/* 74 */
 #define TEGRA30_CLK_AVPUCQ 75
 #define TEGRA30_CLK_LA 76
 /* 77 */
 /* 298 */
 /* 299 */
 #define TEGRA30_CLK_CLK_OUT_1_MUX 300
-#define TEGRA30_CLK_CLK_MAX 301
+#define TEGRA30_CLK_CLK_OUT_2_MUX 301
+#define TEGRA30_CLK_CLK_OUT_3_MUX 302
+#define TEGRA30_CLK_AUDIO0_MUX 303
+#define TEGRA30_CLK_AUDIO1_MUX 304
+#define TEGRA30_CLK_AUDIO2_MUX 305
+#define TEGRA30_CLK_AUDIO3_MUX 306
+#define TEGRA30_CLK_AUDIO4_MUX 307
+#define TEGRA30_CLK_SPDIF_MUX 308
+#define TEGRA30_CLK_CLK_MAX 309
 
 #endif /* _DT_BINDINGS_CLOCK_TEGRA30_CAR_H */
index 4aa2b48cd15183e457a3eb96288dca81039cef37..a91602951d3d3c018218c37889b7ae9338191948 100644 (file)
 #define VF610_CLK_GPU2D                        147
 #define VF610_CLK_ENET0                        148
 #define VF610_CLK_ENET1                        149
-#define VF610_CLK_END                  150
+#define VF610_CLK_DMAMUX0              150
+#define VF610_CLK_DMAMUX1              151
+#define VF610_CLK_DMAMUX2              152
+#define VF610_CLK_DMAMUX3              153
+#define VF610_CLK_END                  154
 
 #endif /* __DT_BINDINGS_CLOCK_VF610_H */
index 4d179c00f081f8e5a137a6562b8fb7c8e9b0faaf..197dc28b676ef8a53641eee4f0735e1231728765 100644 (file)
@@ -43,6 +43,7 @@
 #define TEGRA_GPIO_BANK_ID_CC 28
 #define TEGRA_GPIO_BANK_ID_DD 29
 #define TEGRA_GPIO_BANK_ID_EE 30
+#define TEGRA_GPIO_BANK_ID_FF 31
 
 #define TEGRA_GPIO(bank, offset) \
        ((TEGRA_GPIO_BANK_ID_##bank * 8) + offset)
index bed35e36fd2748515ed75f47c9d642462223c852..b04528cd033cb3d96d6776561cda327a0ff33966 100644 (file)
 #define PIN_OFF_INPUT_PULLDOWN (OFF_EN | OFF_PULL_EN)
 #define PIN_OFF_WAKEUPENABLE   WAKEUP_EN
 
+/*
+ * Macros to allow using the absolute physical address instead of the
+ * padconf registers instead of the offset from padconf base.
+ */
+#define OMAP_IOPAD_OFFSET(pa, offset)  (((pa) & 0xffff) - (offset))
+
+#define OMAP2420_CORE_IOPAD(pa, val)   OMAP_IOPAD_OFFSET((pa), 0x0030) (val)
+#define OMAP2430_CORE_IOPAD(pa, val)   OMAP_IOPAD_OFFSET((pa), 0x2030) (val)
+#define OMAP3_CORE1_IOPAD(pa, val)     OMAP_IOPAD_OFFSET((pa), 0x2030) (val)
+#define OMAP3430_CORE2_IOPAD(pa, val)  OMAP_IOPAD_OFFSET((pa), 0x25d8) (val)
+#define OMAP3630_CORE2_IOPAD(pa, val)  OMAP_IOPAD_OFFSET((pa), 0x25a0) (val)
+#define OMAP3_WKUP_IOPAD(pa, val)      OMAP_IOPAD_OFFSET((pa), 0x2a00) (val)
+#define AM33XX_IOPAD(pa, val)          OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
+#define OMAP4_CORE_IOPAD(pa, val)      OMAP_IOPAD_OFFSET((pa), 0x0040) (val)
+#define OMAP4_WKUP_IOPAD(pa, val)      OMAP_IOPAD_OFFSET((pa), 0xe040) (val)
+#define AM4372_IOPAD(pa, val)          OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
+#define OMAP5_CORE_IOPAD(pa, val)      OMAP_IOPAD_OFFSET((pa), 0x2840) (val)
+#define OMAP5_WKUP_IOPAD(pa, val)      OMAP_IOPAD_OFFSET((pa), 0xc840) (val)
+#define DRA7XX_CORE_IOPAD(pa, val)     OMAP_IOPAD_OFFSET((pa), 0x3400) (val)
+
 #endif
 
diff --git a/include/dt-bindings/pinctrl/pinctrl-tegra.h b/include/dt-bindings/pinctrl/pinctrl-tegra.h
new file mode 100644 (file)
index 0000000..ebafa49
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * This header provides constants for Tegra pinctrl bindings.
+ *
+ * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * Author: Laxman Dewangan <ldewangan@nvidia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#ifndef _DT_BINDINGS_PINCTRL_TEGRA_H
+#define _DT_BINDINGS_PINCTRL_TEGRA_H
+
+/*
+ * Enable/disable for diffeent dt properties. This is applicable for
+ * properties nvidia,enable-input, nvidia,tristate, nvidia,open-drain,
+ * nvidia,lock, nvidia,rcv-sel, nvidia,high-speed-mode, nvidia,schmitt.
+ */
+#define TEGRA_PIN_DISABLE                              0
+#define TEGRA_PIN_ENABLE                               1
+
+#define TEGRA_PIN_PULL_NONE                            0
+#define TEGRA_PIN_PULL_DOWN                            1
+#define TEGRA_PIN_PULL_UP                              2
+
+/* Low power mode driver */
+#define TEGRA_PIN_LP_DRIVE_DIV_8                       0
+#define TEGRA_PIN_LP_DRIVE_DIV_4                       1
+#define TEGRA_PIN_LP_DRIVE_DIV_2                       2
+#define TEGRA_PIN_LP_DRIVE_DIV_1                       3
+
+/* Rising/Falling slew rate */
+#define TEGRA_PIN_SLEW_RATE_FASTEST                    0
+#define TEGRA_PIN_SLEW_RATE_FAST                       1
+#define TEGRA_PIN_SLEW_RATE_SLOW                       2
+#define TEGRA_PIN_SLEW_RATE_SLOWEST                    3
+
+#endif
diff --git a/include/dt-bindings/reset/qcom,gcc-msm8660.h b/include/dt-bindings/reset/qcom,gcc-msm8660.h
new file mode 100644 (file)
index 0000000..a83282f
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_RESET_MSM_GCC_8660_H
+#define _DT_BINDINGS_RESET_MSM_GCC_8660_H
+
+#define AFAB_CORE_RESET                                        0
+#define SCSS_SYS_RESET                                 1
+#define SCSS_SYS_POR_RESET                             2
+#define AFAB_SMPSS_S_RESET                             3
+#define AFAB_SMPSS_M1_RESET                            4
+#define AFAB_SMPSS_M0_RESET                            5
+#define AFAB_EBI1_S_RESET                              6
+#define SFAB_CORE_RESET                                        7
+#define SFAB_ADM0_M0_RESET                             8
+#define SFAB_ADM0_M1_RESET                             9
+#define SFAB_ADM0_M2_RESET                             10
+#define ADM0_C2_RESET                                  11
+#define ADM0_C1_RESET                                  12
+#define ADM0_C0_RESET                                  13
+#define ADM0_PBUS_RESET                                        14
+#define ADM0_RESET                                     15
+#define SFAB_ADM1_M0_RESET                             16
+#define SFAB_ADM1_M1_RESET                             17
+#define SFAB_ADM1_M2_RESET                             18
+#define MMFAB_ADM1_M3_RESET                            19
+#define ADM1_C3_RESET                                  20
+#define ADM1_C2_RESET                                  21
+#define ADM1_C1_RESET                                  22
+#define ADM1_C0_RESET                                  23
+#define ADM1_PBUS_RESET                                        24
+#define ADM1_RESET                                     25
+#define IMEM0_RESET                                    26
+#define SFAB_LPASS_Q6_RESET                            27
+#define SFAB_AFAB_M_RESET                              28
+#define AFAB_SFAB_M0_RESET                             29
+#define AFAB_SFAB_M1_RESET                             30
+#define DFAB_CORE_RESET                                        31
+#define SFAB_DFAB_M_RESET                              32
+#define DFAB_SFAB_M_RESET                              33
+#define DFAB_SWAY0_RESET                               34
+#define DFAB_SWAY1_RESET                               35
+#define DFAB_ARB0_RESET                                        36
+#define DFAB_ARB1_RESET                                        37
+#define PPSS_PROC_RESET                                        38
+#define PPSS_RESET                                     39
+#define PMEM_RESET                                     40
+#define DMA_BAM_RESET                                  41
+#define SIC_RESET                                      42
+#define SPS_TIC_RESET                                  43
+#define CFBP0_RESET                                    44
+#define CFBP1_RESET                                    45
+#define CFBP2_RESET                                    46
+#define EBI2_RESET                                     47
+#define SFAB_CFPB_M_RESET                              48
+#define CFPB_MASTER_RESET                              49
+#define SFAB_CFPB_S_RESET                              50
+#define CFPB_SPLITTER_RESET                            51
+#define TSIF_RESET                                     52
+#define CE1_RESET                                      53
+#define CE2_RESET                                      54
+#define SFAB_SFPB_M_RESET                              55
+#define SFAB_SFPB_S_RESET                              56
+#define RPM_PROC_RESET                                 57
+#define RPM_BUS_RESET                                  58
+#define RPM_MSG_RAM_RESET                              59
+#define PMIC_ARB0_RESET                                        60
+#define PMIC_ARB1_RESET                                        61
+#define PMIC_SSBI2_RESET                               62
+#define SDC1_RESET                                     63
+#define SDC2_RESET                                     64
+#define SDC3_RESET                                     65
+#define SDC4_RESET                                     66
+#define SDC5_RESET                                     67
+#define USB_HS1_RESET                                  68
+#define USB_HS2_XCVR_RESET                             69
+#define USB_HS2_RESET                                  70
+#define USB_FS1_XCVR_RESET                             71
+#define USB_FS1_RESET                                  72
+#define USB_FS2_XCVR_RESET                             73
+#define USB_FS2_RESET                                  74
+#define GSBI1_RESET                                    75
+#define GSBI2_RESET                                    76
+#define GSBI3_RESET                                    77
+#define GSBI4_RESET                                    78
+#define GSBI5_RESET                                    79
+#define GSBI6_RESET                                    80
+#define GSBI7_RESET                                    81
+#define GSBI8_RESET                                    82
+#define GSBI9_RESET                                    83
+#define GSBI10_RESET                                   84
+#define GSBI11_RESET                                   85
+#define GSBI12_RESET                                   86
+#define SPDM_RESET                                     87
+#define SEC_CTRL_RESET                                 88
+#define TLMM_H_RESET                                   89
+#define TLMM_RESET                                     90
+#define MARRM_PWRON_RESET                              91
+#define MARM_RESET                                     92
+#define MAHB1_RESET                                    93
+#define SFAB_MSS_S_RESET                               94
+#define MAHB2_RESET                                    95
+#define MODEM_SW_AHB_RESET                             96
+#define MODEM_RESET                                    97
+#define SFAB_MSS_MDM1_RESET                            98
+#define SFAB_MSS_MDM0_RESET                            99
+#define MSS_SLP_RESET                                  100
+#define MSS_MARM_SAW_RESET                             101
+#define MSS_WDOG_RESET                                 102
+#define TSSC_RESET                                     103
+#define PDM_RESET                                      104
+#define SCSS_CORE0_RESET                               105
+#define SCSS_CORE0_POR_RESET                           106
+#define SCSS_CORE1_RESET                               107
+#define SCSS_CORE1_POR_RESET                           108
+#define MPM_RESET                                      109
+#define EBI1_1X_DIV_RESET                              110
+#define EBI1_RESET                                     111
+#define SFAB_SMPSS_S_RESET                             112
+#define USB_PHY0_RESET                                 113
+#define USB_PHY1_RESET                                 114
+#define PRNG_RESET                                     115
+
+#endif
diff --git a/include/dt-bindings/reset/qcom,gcc-msm8960.h b/include/dt-bindings/reset/qcom,gcc-msm8960.h
new file mode 100644 (file)
index 0000000..a840e68
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_RESET_MSM_GCC_8960_H
+#define _DT_BINDINGS_RESET_MSM_GCC_8960_H
+
+#define SFAB_MSS_Q6_SW_RESET                           0
+#define SFAB_MSS_Q6_FW_RESET                           1
+#define QDSS_STM_RESET                                 2
+#define AFAB_SMPSS_S_RESET                             3
+#define AFAB_SMPSS_M1_RESET                            4
+#define AFAB_SMPSS_M0_RESET                            5
+#define AFAB_EBI1_CH0_RESET                            6
+#define AFAB_EBI1_CH1_RESET                            7
+#define SFAB_ADM0_M0_RESET                             8
+#define SFAB_ADM0_M1_RESET                             9
+#define SFAB_ADM0_M2_RESET                             10
+#define ADM0_C2_RESET                                  11
+#define ADM0_C1_RESET                                  12
+#define ADM0_C0_RESET                                  13
+#define ADM0_PBUS_RESET                                        14
+#define ADM0_RESET                                     15
+#define QDSS_CLKS_SW_RESET                             16
+#define QDSS_POR_RESET                                 17
+#define QDSS_TSCTR_RESET                               18
+#define QDSS_HRESET_RESET                              19
+#define QDSS_AXI_RESET                                 20
+#define QDSS_DBG_RESET                                 21
+#define PCIE_A_RESET                                   22
+#define PCIE_AUX_RESET                                 23
+#define PCIE_H_RESET                                   24
+#define SFAB_PCIE_M_RESET                              25
+#define SFAB_PCIE_S_RESET                              26
+#define SFAB_MSS_M_RESET                               27
+#define SFAB_USB3_M_RESET                              28
+#define SFAB_RIVA_M_RESET                              29
+#define SFAB_LPASS_RESET                               30
+#define SFAB_AFAB_M_RESET                              31
+#define AFAB_SFAB_M0_RESET                             32
+#define AFAB_SFAB_M1_RESET                             33
+#define SFAB_SATA_S_RESET                              34
+#define SFAB_DFAB_M_RESET                              35
+#define DFAB_SFAB_M_RESET                              36
+#define DFAB_SWAY0_RESET                               37
+#define DFAB_SWAY1_RESET                               38
+#define DFAB_ARB0_RESET                                        39
+#define DFAB_ARB1_RESET                                        40
+#define PPSS_PROC_RESET                                        41
+#define PPSS_RESET                                     42
+#define DMA_BAM_RESET                                  43
+#define SIC_TIC_RESET                                  44
+#define SLIMBUS_H_RESET                                        45
+#define SFAB_CFPB_M_RESET                              46
+#define SFAB_CFPB_S_RESET                              47
+#define TSIF_H_RESET                                   48
+#define CE1_H_RESET                                    49
+#define CE1_CORE_RESET                                 50
+#define CE1_SLEEP_RESET                                        51
+#define CE2_H_RESET                                    52
+#define CE2_CORE_RESET                                 53
+#define SFAB_SFPB_M_RESET                              54
+#define SFAB_SFPB_S_RESET                              55
+#define RPM_PROC_RESET                                 56
+#define PMIC_SSBI2_RESET                               57
+#define SDC1_RESET                                     58
+#define SDC2_RESET                                     59
+#define SDC3_RESET                                     60
+#define SDC4_RESET                                     61
+#define SDC5_RESET                                     62
+#define DFAB_A2_RESET                                  63
+#define USB_HS1_RESET                                  64
+#define USB_HSIC_RESET                                 65
+#define USB_FS1_XCVR_RESET                             66
+#define USB_FS1_RESET                                  67
+#define USB_FS2_XCVR_RESET                             68
+#define USB_FS2_RESET                                  69
+#define GSBI1_RESET                                    70
+#define GSBI2_RESET                                    71
+#define GSBI3_RESET                                    72
+#define GSBI4_RESET                                    73
+#define GSBI5_RESET                                    74
+#define GSBI6_RESET                                    75
+#define GSBI7_RESET                                    76
+#define GSBI8_RESET                                    77
+#define GSBI9_RESET                                    78
+#define GSBI10_RESET                                   79
+#define GSBI11_RESET                                   80
+#define GSBI12_RESET                                   81
+#define SPDM_RESET                                     82
+#define TLMM_H_RESET                                   83
+#define SFAB_MSS_S_RESET                               84
+#define MSS_SLP_RESET                                  85
+#define MSS_Q6SW_JTAG_RESET                            86
+#define MSS_Q6FW_JTAG_RESET                            87
+#define MSS_RESET                                      88
+#define SATA_H_RESET                                   89
+#define SATA_RXOOB_RESE                                        90
+#define SATA_PMALIVE_RESET                             91
+#define SATA_SFAB_M_RESET                              92
+#define TSSC_RESET                                     93
+#define PDM_RESET                                      94
+#define MPM_H_RESET                                    95
+#define MPM_RESET                                      96
+#define SFAB_SMPSS_S_RESET                             97
+#define PRNG_RESET                                     98
+#define RIVA_RESET                                     99
+
+#endif
diff --git a/include/dt-bindings/reset/qcom,gcc-msm8974.h b/include/dt-bindings/reset/qcom,gcc-msm8974.h
new file mode 100644 (file)
index 0000000..9bdf543
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_RESET_MSM_GCC_8974_H
+#define _DT_BINDINGS_RESET_MSM_GCC_8974_H
+
+#define GCC_SYSTEM_NOC_BCR                     0
+#define GCC_CONFIG_NOC_BCR                     1
+#define GCC_PERIPH_NOC_BCR                     2
+#define GCC_IMEM_BCR                           3
+#define GCC_MMSS_BCR                           4
+#define GCC_QDSS_BCR                           5
+#define GCC_USB_30_BCR                         6
+#define GCC_USB3_PHY_BCR                       7
+#define GCC_USB_HS_HSIC_BCR                    8
+#define GCC_USB_HS_BCR                         9
+#define GCC_USB2A_PHY_BCR                      10
+#define GCC_USB2B_PHY_BCR                      11
+#define GCC_SDCC1_BCR                          12
+#define GCC_SDCC2_BCR                          13
+#define GCC_SDCC3_BCR                          14
+#define GCC_SDCC4_BCR                          15
+#define GCC_BLSP1_BCR                          16
+#define GCC_BLSP1_QUP1_BCR                     17
+#define GCC_BLSP1_UART1_BCR                    18
+#define GCC_BLSP1_QUP2_BCR                     19
+#define GCC_BLSP1_UART2_BCR                    20
+#define GCC_BLSP1_QUP3_BCR                     21
+#define GCC_BLSP1_UART3_BCR                    22
+#define GCC_BLSP1_QUP4_BCR                     23
+#define GCC_BLSP1_UART4_BCR                    24
+#define GCC_BLSP1_QUP5_BCR                     25
+#define GCC_BLSP1_UART5_BCR                    26
+#define GCC_BLSP1_QUP6_BCR                     27
+#define GCC_BLSP1_UART6_BCR                    28
+#define GCC_BLSP2_BCR                          29
+#define GCC_BLSP2_QUP1_BCR                     30
+#define GCC_BLSP2_UART1_BCR                    31
+#define GCC_BLSP2_QUP2_BCR                     32
+#define GCC_BLSP2_UART2_BCR                    33
+#define GCC_BLSP2_QUP3_BCR                     34
+#define GCC_BLSP2_UART3_BCR                    35
+#define GCC_BLSP2_QUP4_BCR                     36
+#define GCC_BLSP2_UART4_BCR                    37
+#define GCC_BLSP2_QUP5_BCR                     38
+#define GCC_BLSP2_UART5_BCR                    39
+#define GCC_BLSP2_QUP6_BCR                     40
+#define GCC_BLSP2_UART6_BCR                    41
+#define GCC_PDM_BCR                            42
+#define GCC_BAM_DMA_BCR                                43
+#define GCC_TSIF_BCR                           44
+#define GCC_TCSR_BCR                           45
+#define GCC_BOOT_ROM_BCR                       46
+#define GCC_MSG_RAM_BCR                                47
+#define GCC_TLMM_BCR                           48
+#define GCC_MPM_BCR                            49
+#define GCC_SEC_CTRL_BCR                       50
+#define GCC_SPMI_BCR                           51
+#define GCC_SPDM_BCR                           52
+#define GCC_CE1_BCR                            53
+#define GCC_CE2_BCR                            54
+#define GCC_BIMC_BCR                           55
+#define GCC_MPM_NON_AHB_RESET                  56
+#define GCC_MPM_AHB_RESET                      57
+#define GCC_SNOC_BUS_TIMEOUT0_BCR              58
+#define GCC_SNOC_BUS_TIMEOUT2_BCR              59
+#define GCC_PNOC_BUS_TIMEOUT0_BCR              60
+#define GCC_PNOC_BUS_TIMEOUT1_BCR              61
+#define GCC_PNOC_BUS_TIMEOUT2_BCR              62
+#define GCC_PNOC_BUS_TIMEOUT3_BCR              63
+#define GCC_PNOC_BUS_TIMEOUT4_BCR              64
+#define GCC_CNOC_BUS_TIMEOUT0_BCR              65
+#define GCC_CNOC_BUS_TIMEOUT1_BCR              66
+#define GCC_CNOC_BUS_TIMEOUT2_BCR              67
+#define GCC_CNOC_BUS_TIMEOUT3_BCR              68
+#define GCC_CNOC_BUS_TIMEOUT4_BCR              69
+#define GCC_CNOC_BUS_TIMEOUT5_BCR              70
+#define GCC_CNOC_BUS_TIMEOUT6_BCR              71
+#define GCC_DEHR_BCR                           72
+#define GCC_RBCPR_BCR                          73
+#define GCC_MSS_RESTART                                74
+#define GCC_LPASS_RESTART                      75
+#define GCC_WCSS_RESTART                       76
+#define GCC_VENUS_RESTART                      77
+
+#endif
diff --git a/include/dt-bindings/reset/qcom,mmcc-msm8960.h b/include/dt-bindings/reset/qcom,mmcc-msm8960.h
new file mode 100644 (file)
index 0000000..ba36ec6
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_RESET_MSM_MMCC_8960_H
+#define _DT_BINDINGS_RESET_MSM_MMCC_8960_H
+
+#define VPE_AXI_RESET                                  0
+#define IJPEG_AXI_RESET                                        1
+#define MPD_AXI_RESET                                  2
+#define VFE_AXI_RESET                                  3
+#define SP_AXI_RESET                                   4
+#define VCODEC_AXI_RESET                               5
+#define ROT_AXI_RESET                                  6
+#define VCODEC_AXI_A_RESET                             7
+#define VCODEC_AXI_B_RESET                             8
+#define FAB_S3_AXI_RESET                               9
+#define FAB_S2_AXI_RESET                               10
+#define FAB_S1_AXI_RESET                               11
+#define FAB_S0_AXI_RESET                               12
+#define SMMU_GFX3D_ABH_RESET                           13
+#define SMMU_VPE_AHB_RESET                             14
+#define SMMU_VFE_AHB_RESET                             15
+#define SMMU_ROT_AHB_RESET                             16
+#define SMMU_VCODEC_B_AHB_RESET                                17
+#define SMMU_VCODEC_A_AHB_RESET                                18
+#define SMMU_MDP1_AHB_RESET                            19
+#define SMMU_MDP0_AHB_RESET                            20
+#define SMMU_JPEGD_AHB_RESET                           21
+#define SMMU_IJPEG_AHB_RESET                           22
+#define SMMU_GFX2D0_AHB_RESET                          23
+#define SMMU_GFX2D1_AHB_RESET                          24
+#define APU_AHB_RESET                                  25
+#define CSI_AHB_RESET                                  26
+#define TV_ENC_AHB_RESET                               27
+#define VPE_AHB_RESET                                  28
+#define FABRIC_AHB_RESET                               29
+#define GFX2D0_AHB_RESET                               30
+#define GFX2D1_AHB_RESET                               31
+#define GFX3D_AHB_RESET                                        32
+#define HDMI_AHB_RESET                                 33
+#define MSSS_IMEM_AHB_RESET                            34
+#define IJPEG_AHB_RESET                                        35
+#define DSI_M_AHB_RESET                                        36
+#define DSI_S_AHB_RESET                                        37
+#define JPEGD_AHB_RESET                                        38
+#define MDP_AHB_RESET                                  39
+#define ROT_AHB_RESET                                  40
+#define VCODEC_AHB_RESET                               41
+#define VFE_AHB_RESET                                  42
+#define DSI2_M_AHB_RESET                               43
+#define DSI2_S_AHB_RESET                               44
+#define CSIPHY2_RESET                                  45
+#define CSI_PIX1_RESET                                 46
+#define CSIPHY0_RESET                                  47
+#define CSIPHY1_RESET                                  48
+#define DSI2_RESET                                     49
+#define VFE_CSI_RESET                                  50
+#define MDP_RESET                                      51
+#define AMP_RESET                                      52
+#define JPEGD_RESET                                    53
+#define CSI1_RESET                                     54
+#define VPE_RESET                                      55
+#define MMSS_FABRIC_RESET                              56
+#define VFE_RESET                                      57
+#define GFX2D0_RESET                                   58
+#define GFX2D1_RESET                                   59
+#define GFX3D_RESET                                    60
+#define HDMI_RESET                                     61
+#define MMSS_IMEM_RESET                                        62
+#define IJPEG_RESET                                    63
+#define CSI0_RESET                                     64
+#define DSI_RESET                                      65
+#define VCODEC_RESET                                   66
+#define MDP_TV_RESET                                   67
+#define MDP_VSYNC_RESET                                        68
+#define ROT_RESET                                      69
+#define TV_HDMI_RESET                                  70
+#define TV_ENC_RESET                                   71
+#define CSI2_RESET                                     72
+#define CSI_RDI1_RESET                                 73
+#define CSI_RDI2_RESET                                 74
+
+#endif
diff --git a/include/dt-bindings/reset/qcom,mmcc-msm8974.h b/include/dt-bindings/reset/qcom,mmcc-msm8974.h
new file mode 100644 (file)
index 0000000..da3ec37
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_RESET_MSM_MMCC_8974_H
+#define _DT_BINDINGS_RESET_MSM_MMCC_8974_H
+
+#define SPDM_RESET                     0
+#define SPDM_RM_RESET                  1
+#define VENUS0_RESET                   2
+#define MDSS_RESET                     3
+#define CAMSS_PHY0_RESET               4
+#define CAMSS_PHY1_RESET               5
+#define CAMSS_PHY2_RESET               6
+#define CAMSS_CSI0_RESET               7
+#define CAMSS_CSI0PHY_RESET            8
+#define CAMSS_CSI0RDI_RESET            9
+#define CAMSS_CSI0PIX_RESET            10
+#define CAMSS_CSI1_RESET               11
+#define CAMSS_CSI1PHY_RESET            12
+#define CAMSS_CSI1RDI_RESET            13
+#define CAMSS_CSI1PIX_RESET            14
+#define CAMSS_CSI2_RESET               15
+#define CAMSS_CSI2PHY_RESET            16
+#define CAMSS_CSI2RDI_RESET            17
+#define CAMSS_CSI2PIX_RESET            18
+#define CAMSS_CSI3_RESET               19
+#define CAMSS_CSI3PHY_RESET            20
+#define CAMSS_CSI3RDI_RESET            21
+#define CAMSS_CSI3PIX_RESET            22
+#define CAMSS_ISPIF_RESET              23
+#define CAMSS_CCI_RESET                        24
+#define CAMSS_MCLK0_RESET              25
+#define CAMSS_MCLK1_RESET              26
+#define CAMSS_MCLK2_RESET              27
+#define CAMSS_MCLK3_RESET              28
+#define CAMSS_GP0_RESET                        29
+#define CAMSS_GP1_RESET                        30
+#define CAMSS_TOP_RESET                        31
+#define CAMSS_MICRO_RESET              32
+#define CAMSS_JPEG_RESET               33
+#define CAMSS_VFE_RESET                        34
+#define CAMSS_CSI_VFE0_RESET           35
+#define CAMSS_CSI_VFE1_RESET           36
+#define OXILI_RESET                    37
+#define OXILICX_RESET                  38
+#define OCMEMCX_RESET                  39
+#define MMSS_RBCRP_RESET               40
+#define MMSSNOCAHB_RESET               41
+#define MMSSNOCAXI_RESET               42
+#define OCMEMNOC_RESET                 43
+
+#endif
index a40641954c296c3042c0e34f5c1ff170aee5cfa5..aa865a9a4c4f862b4aa693ed9918399b338e7696 100644 (file)
@@ -137,7 +137,7 @@ static inline void audit_syscall_exit(void *pt_regs)
 {
        if (unlikely(current->audit_context)) {
                int success = is_syscall_success(pt_regs);
-               int return_code = regs_return_value(pt_regs);
+               long return_code = regs_return_value(pt_regs);
 
                __audit_syscall_exit(success, return_code);
        }
@@ -202,7 +202,7 @@ static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
        return tsk->loginuid;
 }
 
-static inline int audit_get_sessionid(struct task_struct *tsk)
+static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
 {
        return tsk->sessionid;
 }
@@ -220,7 +220,7 @@ extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
 extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
                                  const struct cred *new,
                                  const struct cred *old);
-extern void __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old);
+extern void __audit_log_capset(const struct cred *new, const struct cred *old);
 extern void __audit_mmap_fd(int fd, int flags);
 
 static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
@@ -285,11 +285,11 @@ static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
        return 0;
 }
 
-static inline void audit_log_capset(pid_t pid, const struct cred *new,
+static inline void audit_log_capset(const struct cred *new,
                                   const struct cred *old)
 {
        if (unlikely(!audit_dummy_context()))
-               __audit_log_capset(pid, new, old);
+               __audit_log_capset(new, old);
 }
 
 static inline void audit_mmap_fd(int fd, int flags)
@@ -359,7 +359,7 @@ static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
 {
        return INVALID_UID;
 }
-static inline int audit_get_sessionid(struct task_struct *tsk)
+static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
 {
        return -1;
 }
@@ -397,8 +397,8 @@ static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
 {
        return 0;
 }
-static inline void audit_log_capset(pid_t pid, const struct cred *new,
-                                  const struct cred *old)
+static inline void audit_log_capset(const struct cred *new,
+                                   const struct cred *old)
 { }
 static inline void audit_mmap_fd(int fd, int flags)
 { }
@@ -461,9 +461,11 @@ extern int             audit_update_lsm_rules(void);
                                /* Private API (for audit.c only) */
 extern int audit_filter_user(int type);
 extern int audit_filter_type(int type);
-extern int  audit_receive_filter(int type, int pid, int seq,
+extern int audit_rule_change(int type, __u32 portid, int seq,
                                void *data, size_t datasz);
-extern int audit_enabled;
+extern int audit_list_rules_send(__u32 portid, int seq);
+
+extern u32 audit_enabled;
 #else /* CONFIG_AUDIT */
 static inline __printf(4, 5)
 void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
diff --git a/include/linux/ccp.h b/include/linux/ccp.h
new file mode 100644 (file)
index 0000000..b941ab9
--- /dev/null
@@ -0,0 +1,537 @@
+/*
+ * AMD Cryptographic Coprocessor (CCP) driver
+ *
+ * Copyright (C) 2013 Advanced Micro Devices, Inc.
+ *
+ * Author: Tom Lendacky <thomas.lendacky@amd.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __CPP_H__
+#define __CPP_H__
+
+#include <linux/scatterlist.h>
+#include <linux/workqueue.h>
+#include <linux/list.h>
+#include <crypto/aes.h>
+#include <crypto/sha.h>
+
+
+struct ccp_device;
+struct ccp_cmd;
+
+#if defined(CONFIG_CRYPTO_DEV_CCP_DD) || \
+       defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE)
+
+/**
+ * ccp_enqueue_cmd - queue an operation for processing by the CCP
+ *
+ * @cmd: ccp_cmd struct to be processed
+ *
+ * Refer to the ccp_cmd struct below for required fields.
+ *
+ * Queue a cmd to be processed by the CCP. If queueing the cmd
+ * would exceed the defined length of the cmd queue the cmd will
+ * only be queued if the CCP_CMD_MAY_BACKLOG flag is set and will
+ * result in a return code of -EBUSY.
+ *
+ * The callback routine specified in the ccp_cmd struct will be
+ * called to notify the caller of completion (if the cmd was not
+ * backlogged) or advancement out of the backlog. If the cmd has
+ * advanced out of the backlog the "err" value of the callback
+ * will be -EINPROGRESS. Any other "err" value during callback is
+ * the result of the operation.
+ *
+ * The cmd has been successfully queued if:
+ *   the return code is -EINPROGRESS or
+ *   the return code is -EBUSY and CCP_CMD_MAY_BACKLOG flag is set
+ */
+int ccp_enqueue_cmd(struct ccp_cmd *cmd);
+
+#else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */
+
+static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd)
+{
+       return -ENODEV;
+}
+
+#endif /* CONFIG_CRYPTO_DEV_CCP_DD */
+
+
+/***** AES engine *****/
+/**
+ * ccp_aes_type - AES key size
+ *
+ * @CCP_AES_TYPE_128: 128-bit key
+ * @CCP_AES_TYPE_192: 192-bit key
+ * @CCP_AES_TYPE_256: 256-bit key
+ */
+enum ccp_aes_type {
+       CCP_AES_TYPE_128 = 0,
+       CCP_AES_TYPE_192,
+       CCP_AES_TYPE_256,
+       CCP_AES_TYPE__LAST,
+};
+
+/**
+ * ccp_aes_mode - AES operation mode
+ *
+ * @CCP_AES_MODE_ECB: ECB mode
+ * @CCP_AES_MODE_CBC: CBC mode
+ * @CCP_AES_MODE_OFB: OFB mode
+ * @CCP_AES_MODE_CFB: CFB mode
+ * @CCP_AES_MODE_CTR: CTR mode
+ * @CCP_AES_MODE_CMAC: CMAC mode
+ */
+enum ccp_aes_mode {
+       CCP_AES_MODE_ECB = 0,
+       CCP_AES_MODE_CBC,
+       CCP_AES_MODE_OFB,
+       CCP_AES_MODE_CFB,
+       CCP_AES_MODE_CTR,
+       CCP_AES_MODE_CMAC,
+       CCP_AES_MODE__LAST,
+};
+
+/**
+ * ccp_aes_mode - AES operation mode
+ *
+ * @CCP_AES_ACTION_DECRYPT: AES decrypt operation
+ * @CCP_AES_ACTION_ENCRYPT: AES encrypt operation
+ */
+enum ccp_aes_action {
+       CCP_AES_ACTION_DECRYPT = 0,
+       CCP_AES_ACTION_ENCRYPT,
+       CCP_AES_ACTION__LAST,
+};
+
+/**
+ * struct ccp_aes_engine - CCP AES operation
+ * @type: AES operation key size
+ * @mode: AES operation mode
+ * @action: AES operation (decrypt/encrypt)
+ * @key: key to be used for this AES operation
+ * @key_len: length in bytes of key
+ * @iv: IV to be used for this AES operation
+ * @iv_len: length in bytes of iv
+ * @src: data to be used for this operation
+ * @dst: data produced by this operation
+ * @src_len: length in bytes of data used for this operation
+ * @cmac_final: indicates final operation when running in CMAC mode
+ * @cmac_key: K1/K2 key used in final CMAC operation
+ * @cmac_key_len: length in bytes of cmac_key
+ *
+ * Variables required to be set when calling ccp_enqueue_cmd():
+ *   - type, mode, action, key, key_len, src, dst, src_len
+ *   - iv, iv_len for any mode other than ECB
+ *   - cmac_final for CMAC mode
+ *   - cmac_key, cmac_key_len for CMAC mode if cmac_final is non-zero
+ *
+ * The iv variable is used as both input and output. On completion of the
+ * AES operation the new IV overwrites the old IV.
+ */
+struct ccp_aes_engine {
+       enum ccp_aes_type type;
+       enum ccp_aes_mode mode;
+       enum ccp_aes_action action;
+
+       struct scatterlist *key;
+       u32 key_len;            /* In bytes */
+
+       struct scatterlist *iv;
+       u32 iv_len;             /* In bytes */
+
+       struct scatterlist *src, *dst;
+       u64 src_len;            /* In bytes */
+
+       u32 cmac_final;         /* Indicates final cmac cmd */
+       struct scatterlist *cmac_key;   /* K1/K2 cmac key required for
+                                        * final cmac cmd */
+       u32 cmac_key_len;       /* In bytes */
+};
+
+/***** XTS-AES engine *****/
+/**
+ * ccp_xts_aes_unit_size - XTS unit size
+ *
+ * @CCP_XTS_AES_UNIT_SIZE_16: Unit size of 16 bytes
+ * @CCP_XTS_AES_UNIT_SIZE_512: Unit size of 512 bytes
+ * @CCP_XTS_AES_UNIT_SIZE_1024: Unit size of 1024 bytes
+ * @CCP_XTS_AES_UNIT_SIZE_2048: Unit size of 2048 bytes
+ * @CCP_XTS_AES_UNIT_SIZE_4096: Unit size of 4096 bytes
+ */
+enum ccp_xts_aes_unit_size {
+       CCP_XTS_AES_UNIT_SIZE_16 = 0,
+       CCP_XTS_AES_UNIT_SIZE_512,
+       CCP_XTS_AES_UNIT_SIZE_1024,
+       CCP_XTS_AES_UNIT_SIZE_2048,
+       CCP_XTS_AES_UNIT_SIZE_4096,
+       CCP_XTS_AES_UNIT_SIZE__LAST,
+};
+
+/**
+ * struct ccp_xts_aes_engine - CCP XTS AES operation
+ * @action: AES operation (decrypt/encrypt)
+ * @unit_size: unit size of the XTS operation
+ * @key: key to be used for this XTS AES operation
+ * @key_len: length in bytes of key
+ * @iv: IV to be used for this XTS AES operation
+ * @iv_len: length in bytes of iv
+ * @src: data to be used for this operation
+ * @dst: data produced by this operation
+ * @src_len: length in bytes of data used for this operation
+ * @final: indicates final XTS operation
+ *
+ * Variables required to be set when calling ccp_enqueue_cmd():
+ *   - action, unit_size, key, key_len, iv, iv_len, src, dst, src_len, final
+ *
+ * The iv variable is used as both input and output. On completion of the
+ * AES operation the new IV overwrites the old IV.
+ */
+struct ccp_xts_aes_engine {
+       enum ccp_aes_action action;
+       enum ccp_xts_aes_unit_size unit_size;
+
+       struct scatterlist *key;
+       u32 key_len;            /* In bytes */
+
+       struct scatterlist *iv;
+       u32 iv_len;             /* In bytes */
+
+       struct scatterlist *src, *dst;
+       u64 src_len;            /* In bytes */
+
+       u32 final;
+};
+
+/***** SHA engine *****/
+#define CCP_SHA_BLOCKSIZE               SHA256_BLOCK_SIZE
+#define CCP_SHA_CTXSIZE                 SHA256_DIGEST_SIZE
+
+/**
+ * ccp_sha_type - type of SHA operation
+ *
+ * @CCP_SHA_TYPE_1: SHA-1 operation
+ * @CCP_SHA_TYPE_224: SHA-224 operation
+ * @CCP_SHA_TYPE_256: SHA-256 operation
+ */
+enum ccp_sha_type {
+       CCP_SHA_TYPE_1 = 1,
+       CCP_SHA_TYPE_224,
+       CCP_SHA_TYPE_256,
+       CCP_SHA_TYPE__LAST,
+};
+
+/**
+ * struct ccp_sha_engine - CCP SHA operation
+ * @type: Type of SHA operation
+ * @ctx: current hash value
+ * @ctx_len: length in bytes of hash value
+ * @src: data to be used for this operation
+ * @src_len: length in bytes of data used for this operation
+ * @final: indicates final SHA operation
+ * @msg_bits: total length of the message in bits used in final SHA operation
+ *
+ * Variables required to be set when calling ccp_enqueue_cmd():
+ *   - type, ctx, ctx_len, src, src_len, final
+ *   - msg_bits if final is non-zero
+ *
+ * The ctx variable is used as both input and output. On completion of the
+ * SHA operation the new hash value overwrites the old hash value.
+ */
+struct ccp_sha_engine {
+       enum ccp_sha_type type;
+
+       struct scatterlist *ctx;
+       u32 ctx_len;            /* In bytes */
+
+       struct scatterlist *src;
+       u64 src_len;            /* In bytes */
+
+       u32 final;              /* Indicates final sha cmd */
+       u64 msg_bits;           /* Message length in bits required for
+                                * final sha cmd */
+};
+
+/***** RSA engine *****/
+/**
+ * struct ccp_rsa_engine - CCP RSA operation
+ * @key_size: length in bits of RSA key
+ * @exp: RSA exponent
+ * @exp_len: length in bytes of exponent
+ * @mod: RSA modulus
+ * @mod_len: length in bytes of modulus
+ * @src: data to be used for this operation
+ * @dst: data produced by this operation
+ * @src_len: length in bytes of data used for this operation
+ *
+ * Variables required to be set when calling ccp_enqueue_cmd():
+ *   - key_size, exp, exp_len, mod, mod_len, src, dst, src_len
+ */
+struct ccp_rsa_engine {
+       u32 key_size;           /* In bits */
+
+       struct scatterlist *exp;
+       u32 exp_len;            /* In bytes */
+
+       struct scatterlist *mod;
+       u32 mod_len;            /* In bytes */
+
+       struct scatterlist *src, *dst;
+       u32 src_len;            /* In bytes */
+};
+
+/***** Passthru engine *****/
+/**
+ * ccp_passthru_bitwise - type of bitwise passthru operation
+ *
+ * @CCP_PASSTHRU_BITWISE_NOOP: no bitwise operation performed
+ * @CCP_PASSTHRU_BITWISE_AND: perform bitwise AND of src with mask
+ * @CCP_PASSTHRU_BITWISE_OR: perform bitwise OR of src with mask
+ * @CCP_PASSTHRU_BITWISE_XOR: perform bitwise XOR of src with mask
+ * @CCP_PASSTHRU_BITWISE_MASK: overwrite with mask
+ */
+enum ccp_passthru_bitwise {
+       CCP_PASSTHRU_BITWISE_NOOP = 0,
+       CCP_PASSTHRU_BITWISE_AND,
+       CCP_PASSTHRU_BITWISE_OR,
+       CCP_PASSTHRU_BITWISE_XOR,
+       CCP_PASSTHRU_BITWISE_MASK,
+       CCP_PASSTHRU_BITWISE__LAST,
+};
+
+/**
+ * ccp_passthru_byteswap - type of byteswap passthru operation
+ *
+ * @CCP_PASSTHRU_BYTESWAP_NOOP: no byte swapping performed
+ * @CCP_PASSTHRU_BYTESWAP_32BIT: swap bytes within 32-bit words
+ * @CCP_PASSTHRU_BYTESWAP_256BIT: swap bytes within 256-bit words
+ */
+enum ccp_passthru_byteswap {
+       CCP_PASSTHRU_BYTESWAP_NOOP = 0,
+       CCP_PASSTHRU_BYTESWAP_32BIT,
+       CCP_PASSTHRU_BYTESWAP_256BIT,
+       CCP_PASSTHRU_BYTESWAP__LAST,
+};
+
+/**
+ * struct ccp_passthru_engine - CCP pass-through operation
+ * @bit_mod: bitwise operation to perform
+ * @byte_swap: byteswap operation to perform
+ * @mask: mask to be applied to data
+ * @mask_len: length in bytes of mask
+ * @src: data to be used for this operation
+ * @dst: data produced by this operation
+ * @src_len: length in bytes of data used for this operation
+ * @final: indicate final pass-through operation
+ *
+ * Variables required to be set when calling ccp_enqueue_cmd():
+ *   - bit_mod, byte_swap, src, dst, src_len
+ *   - mask, mask_len if bit_mod is not CCP_PASSTHRU_BITWISE_NOOP
+ */
+struct ccp_passthru_engine {
+       enum ccp_passthru_bitwise bit_mod;
+       enum ccp_passthru_byteswap byte_swap;
+
+       struct scatterlist *mask;
+       u32 mask_len;           /* In bytes */
+
+       struct scatterlist *src, *dst;
+       u64 src_len;            /* In bytes */
+
+       u32 final;
+};
+
+/***** ECC engine *****/
+#define CCP_ECC_MODULUS_BYTES  48      /* 384-bits */
+#define CCP_ECC_MAX_OPERANDS   6
+#define CCP_ECC_MAX_OUTPUTS    3
+
+/**
+ * ccp_ecc_function - type of ECC function
+ *
+ * @CCP_ECC_FUNCTION_MMUL_384BIT: 384-bit modular multiplication
+ * @CCP_ECC_FUNCTION_MADD_384BIT: 384-bit modular addition
+ * @CCP_ECC_FUNCTION_MINV_384BIT: 384-bit multiplicative inverse
+ * @CCP_ECC_FUNCTION_PADD_384BIT: 384-bit point addition
+ * @CCP_ECC_FUNCTION_PMUL_384BIT: 384-bit point multiplication
+ * @CCP_ECC_FUNCTION_PDBL_384BIT: 384-bit point doubling
+ */
+enum ccp_ecc_function {
+       CCP_ECC_FUNCTION_MMUL_384BIT = 0,
+       CCP_ECC_FUNCTION_MADD_384BIT,
+       CCP_ECC_FUNCTION_MINV_384BIT,
+       CCP_ECC_FUNCTION_PADD_384BIT,
+       CCP_ECC_FUNCTION_PMUL_384BIT,
+       CCP_ECC_FUNCTION_PDBL_384BIT,
+};
+
+/**
+ * struct ccp_ecc_modular_math - CCP ECC modular math parameters
+ * @operand_1: first operand for the modular math operation
+ * @operand_1_len: length of the first operand
+ * @operand_2: second operand for the modular math operation
+ *            (not used for CCP_ECC_FUNCTION_MINV_384BIT)
+ * @operand_2_len: length of the second operand
+ *            (not used for CCP_ECC_FUNCTION_MINV_384BIT)
+ * @result: result of the modular math operation
+ * @result_len: length of the supplied result buffer
+ */
+struct ccp_ecc_modular_math {
+       struct scatterlist *operand_1;
+       unsigned int operand_1_len;     /* In bytes */
+
+       struct scatterlist *operand_2;
+       unsigned int operand_2_len;     /* In bytes */
+
+       struct scatterlist *result;
+       unsigned int result_len;        /* In bytes */
+};
+
+/**
+ * struct ccp_ecc_point - CCP ECC point definition
+ * @x: the x coordinate of the ECC point
+ * @x_len: the length of the x coordinate
+ * @y: the y coordinate of the ECC point
+ * @y_len: the length of the y coordinate
+ */
+struct ccp_ecc_point {
+       struct scatterlist *x;
+       unsigned int x_len;     /* In bytes */
+
+       struct scatterlist *y;
+       unsigned int y_len;     /* In bytes */
+};
+
+/**
+ * struct ccp_ecc_point_math - CCP ECC point math parameters
+ * @point_1: the first point of the ECC point math operation
+ * @point_2: the second point of the ECC point math operation
+ *          (only used for CCP_ECC_FUNCTION_PADD_384BIT)
+ * @domain_a: the a parameter of the ECC curve
+ * @domain_a_len: the length of the a parameter
+ * @scalar: the scalar parameter for the point match operation
+ *         (only used for CCP_ECC_FUNCTION_PMUL_384BIT)
+ * @scalar_len: the length of the scalar parameter
+ *             (only used for CCP_ECC_FUNCTION_PMUL_384BIT)
+ * @result: the point resulting from the point math operation
+ */
+struct ccp_ecc_point_math {
+       struct ccp_ecc_point point_1;
+       struct ccp_ecc_point point_2;
+
+       struct scatterlist *domain_a;
+       unsigned int domain_a_len;      /* In bytes */
+
+       struct scatterlist *scalar;
+       unsigned int scalar_len;        /* In bytes */
+
+       struct ccp_ecc_point result;
+};
+
+/**
+ * struct ccp_ecc_engine - CCP ECC operation
+ * @function: ECC function to perform
+ * @mod: ECC modulus
+ * @mod_len: length in bytes of modulus
+ * @mm: module math parameters
+ * @pm: point math parameters
+ * @ecc_result: result of the ECC operation
+ *
+ * Variables required to be set when calling ccp_enqueue_cmd():
+ *   - function, mod, mod_len
+ *   - operand, operand_len, operand_count, output, output_len, output_count
+ *   - ecc_result
+ */
+struct ccp_ecc_engine {
+       enum ccp_ecc_function function;
+
+       struct scatterlist *mod;
+       u32 mod_len;            /* In bytes */
+
+       union {
+               struct ccp_ecc_modular_math mm;
+               struct ccp_ecc_point_math pm;
+       } u;
+
+       u16 ecc_result;
+};
+
+
+/**
+ * ccp_engine - CCP operation identifiers
+ *
+ * @CCP_ENGINE_AES: AES operation
+ * @CCP_ENGINE_XTS_AES: 128-bit XTS AES operation
+ * @CCP_ENGINE_RSVD1: unused
+ * @CCP_ENGINE_SHA: SHA operation
+ * @CCP_ENGINE_RSA: RSA operation
+ * @CCP_ENGINE_PASSTHRU: pass-through operation
+ * @CCP_ENGINE_ZLIB_DECOMPRESS: unused
+ * @CCP_ENGINE_ECC: ECC operation
+ */
+enum ccp_engine {
+       CCP_ENGINE_AES = 0,
+       CCP_ENGINE_XTS_AES_128,
+       CCP_ENGINE_RSVD1,
+       CCP_ENGINE_SHA,
+       CCP_ENGINE_RSA,
+       CCP_ENGINE_PASSTHRU,
+       CCP_ENGINE_ZLIB_DECOMPRESS,
+       CCP_ENGINE_ECC,
+       CCP_ENGINE__LAST,
+};
+
+/* Flag values for flags member of ccp_cmd */
+#define CCP_CMD_MAY_BACKLOG    0x00000001
+
+/**
+ * struct ccp_cmd - CPP operation request
+ * @entry: list element (ccp driver use only)
+ * @work: work element used for callbacks (ccp driver use only)
+ * @ccp: CCP device to be run on (ccp driver use only)
+ * @ret: operation return code (ccp driver use only)
+ * @flags: cmd processing flags
+ * @engine: CCP operation to perform
+ * @engine_error: CCP engine return code
+ * @u: engine specific structures, refer to specific engine struct below
+ * @callback: operation completion callback function
+ * @data: parameter value to be supplied to the callback function
+ *
+ * Variables required to be set when calling ccp_enqueue_cmd():
+ *   - engine, callback
+ *   - See the operation structures below for what is required for each
+ *     operation.
+ */
+struct ccp_cmd {
+       /* The list_head, work_struct, ccp and ret variables are for use
+        * by the CCP driver only.
+        */
+       struct list_head entry;
+       struct work_struct work;
+       struct ccp_device *ccp;
+       int ret;
+
+       u32 flags;
+
+       enum ccp_engine engine;
+       u32 engine_error;
+
+       union {
+               struct ccp_aes_engine aes;
+               struct ccp_xts_aes_engine xts;
+               struct ccp_sha_engine sha;
+               struct ccp_rsa_engine rsa;
+               struct ccp_passthru_engine passthru;
+               struct ccp_ecc_engine ecc;
+       } u;
+
+       /* Completion callback support */
+       void (*callback)(void *data, int err);
+       void *data;
+};
+
+#endif
index 8138c94409f3f3d1253c2b83e62c3f131ff70d84..efbf70b9fd847f01fb5b623210ad60ee5dc54bdf 100644 (file)
@@ -12,6 +12,7 @@
 #define __LINUX_CLK_PRIVATE_H
 
 #include <linux/clk-provider.h>
+#include <linux/kref.h>
 #include <linux/list.h>
 
 /*
 
 #ifdef CONFIG_COMMON_CLK
 
+struct module;
+
 struct clk {
        const char              *name;
        const struct clk_ops    *ops;
        struct clk_hw           *hw;
+       struct module           *owner;
        struct clk              *parent;
        const char              **parent_names;
        struct clk              **parents;
@@ -41,12 +45,14 @@ struct clk {
        unsigned long           flags;
        unsigned int            enable_count;
        unsigned int            prepare_count;
+       unsigned long           accuracy;
        struct hlist_head       children;
        struct hlist_node       child_node;
        unsigned int            notifier_count;
-#ifdef CONFIG_COMMON_CLK_DEBUG
+#ifdef CONFIG_DEBUG_FS
        struct dentry           *dentry;
 #endif
+       struct kref             ref;
 };
 
 /*
index 7e59253b86036b5d897a7b8e741c0ea3f5e4fdf4..999b28ba38f7270608452cfff436a4e52b22a918 100644 (file)
@@ -29,6 +29,7 @@
 #define CLK_IS_BASIC           BIT(5) /* Basic clk, can't do a to_clk_foo() */
 #define CLK_GET_RATE_NOCACHE   BIT(6) /* do not use the cached clk rate */
 #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */
+#define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */
 
 struct clk_hw;
 
@@ -108,6 +109,25 @@ struct clk_hw;
  *             which is likely helpful for most .set_rate implementation.
  *             Returns 0 on success, -EERROR otherwise.
  *
+ * @recalc_accuracy: Recalculate the accuracy of this clock. The clock accuracy
+ *             is expressed in ppb (parts per billion). The parent accuracy is
+ *             an input parameter.
+ *             Returns the calculated accuracy.  Optional - if this op is not
+ *             set then clock accuracy will be initialized to parent accuracy
+ *             or 0 (perfect clock) if clock has no parent.
+ *
+ * @set_rate_and_parent: Change the rate and the parent of this clock. The
+ *             requested rate is specified by the second argument, which
+ *             should typically be the return of .round_rate call.  The
+ *             third argument gives the parent rate which is likely helpful
+ *             for most .set_rate_and_parent implementation. The fourth
+ *             argument gives the parent index. This callback is optional (and
+ *             unnecessary) for clocks with 0 or 1 parents as well as
+ *             for clocks that can tolerate switching the rate and the parent
+ *             separately via calls to .set_parent and .set_rate.
+ *             Returns 0 on success, -EERROR otherwise.
+ *
+ *
  * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow
  * implementations to split any work between atomic (enable) and sleepable
  * (prepare) contexts.  If enabling a clock requires code that might sleep,
@@ -139,6 +159,11 @@ struct clk_ops {
        u8              (*get_parent)(struct clk_hw *hw);
        int             (*set_rate)(struct clk_hw *hw, unsigned long,
                                    unsigned long);
+       int             (*set_rate_and_parent)(struct clk_hw *hw,
+                                   unsigned long rate,
+                                   unsigned long parent_rate, u8 index);
+       unsigned long   (*recalc_accuracy)(struct clk_hw *hw,
+                                          unsigned long parent_accuracy);
        void            (*init)(struct clk_hw *hw);
 };
 
@@ -194,6 +219,7 @@ struct clk_hw {
 struct clk_fixed_rate {
        struct          clk_hw hw;
        unsigned long   fixed_rate;
+       unsigned long   fixed_accuracy;
        u8              flags;
 };
 
@@ -201,6 +227,9 @@ extern const struct clk_ops clk_fixed_rate_ops;
 struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
                const char *parent_name, unsigned long flags,
                unsigned long fixed_rate);
+struct clk *clk_register_fixed_rate_with_accuracy(struct device *dev,
+               const char *name, const char *parent_name, unsigned long flags,
+               unsigned long fixed_rate, unsigned long fixed_accuracy);
 
 void of_fixed_clk_setup(struct device_node *np);
 
@@ -433,6 +462,7 @@ struct clk *clk_get_parent_by_index(struct clk *clk, u8 index);
 unsigned int __clk_get_enable_count(struct clk *clk);
 unsigned int __clk_get_prepare_count(struct clk *clk);
 unsigned long __clk_get_rate(struct clk *clk);
+unsigned long __clk_get_accuracy(struct clk *clk);
 unsigned long __clk_get_flags(struct clk *clk);
 bool __clk_is_prepared(struct clk *clk);
 bool __clk_is_enabled(struct clk *clk);
index 9a6d04524b1a3f85fd01a4783bb21fbaca6bd3c1..0dd91148165e4e7df78beb5582b89910c1615f26 100644 (file)
@@ -82,6 +82,23 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
 
 int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
 
+/**
+ * clk_get_accuracy - obtain the clock accuracy in ppb (parts per billion)
+ *                   for a clock source.
+ * @clk: clock source
+ *
+ * This gets the clock source accuracy expressed in ppb.
+ * A perfect clock returns 0.
+ */
+long clk_get_accuracy(struct clk *clk);
+
+#else
+
+static inline long clk_get_accuracy(struct clk *clk)
+{
+       return -ENOTSUPP;
+}
+
 #endif
 
 /**
diff --git a/include/linux/clk/at91_pmc.h b/include/linux/clk/at91_pmc.h
new file mode 100644 (file)
index 0000000..a6911eb
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ * include/linux/clk/at91_pmc.h
+ *
+ * Copyright (C) 2005 Ivan Kokshaysky
+ * Copyright (C) SAN People
+ *
+ * Power Management Controller (PMC) - System peripherals registers.
+ * Based on AT91RM9200 datasheet revision E.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef AT91_PMC_H
+#define AT91_PMC_H
+
+#ifndef __ASSEMBLY__
+extern void __iomem *at91_pmc_base;
+
+#define at91_pmc_read(field) \
+       __raw_readl(at91_pmc_base + field)
+
+#define at91_pmc_write(field, value) \
+       __raw_writel(value, at91_pmc_base + field)
+#else
+.extern at91_pmc_base
+#endif
+
+#define        AT91_PMC_SCER           0x00                    /* System Clock Enable Register */
+#define        AT91_PMC_SCDR           0x04                    /* System Clock Disable Register */
+
+#define        AT91_PMC_SCSR           0x08                    /* System Clock Status Register */
+#define                AT91_PMC_PCK            (1 <<  0)               /* Processor Clock */
+#define                AT91RM9200_PMC_UDP      (1 <<  1)               /* USB Devcice Port Clock [AT91RM9200 only] */
+#define                AT91RM9200_PMC_MCKUDP   (1 <<  2)               /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */
+#define                AT91RM9200_PMC_UHP      (1 <<  4)               /* USB Host Port Clock [AT91RM9200 only] */
+#define                AT91SAM926x_PMC_UHP     (1 <<  6)               /* USB Host Port Clock [AT91SAM926x only] */
+#define                AT91SAM926x_PMC_UDP     (1 <<  7)               /* USB Devcice Port Clock [AT91SAM926x only] */
+#define                AT91_PMC_PCK0           (1 <<  8)               /* Programmable Clock 0 */
+#define                AT91_PMC_PCK1           (1 <<  9)               /* Programmable Clock 1 */
+#define                AT91_PMC_PCK2           (1 << 10)               /* Programmable Clock 2 */
+#define                AT91_PMC_PCK3           (1 << 11)               /* Programmable Clock 3 */
+#define                AT91_PMC_PCK4           (1 << 12)               /* Programmable Clock 4 [AT572D940HF only] */
+#define                AT91_PMC_HCK0           (1 << 16)               /* AHB Clock (USB host) [AT91SAM9261 only] */
+#define                AT91_PMC_HCK1           (1 << 17)               /* AHB Clock (LCD) [AT91SAM9261 only] */
+
+#define        AT91_PMC_PCER           0x10                    /* Peripheral Clock Enable Register */
+#define        AT91_PMC_PCDR           0x14                    /* Peripheral Clock Disable Register */
+#define        AT91_PMC_PCSR           0x18                    /* Peripheral Clock Status Register */
+
+#define        AT91_CKGR_UCKR          0x1C                    /* UTMI Clock Register [some SAM9] */
+#define                AT91_PMC_UPLLEN         (1   << 16)             /* UTMI PLL Enable */
+#define                AT91_PMC_UPLLCOUNT      (0xf << 20)             /* UTMI PLL Start-up Time */
+#define                AT91_PMC_BIASEN         (1   << 24)             /* UTMI BIAS Enable */
+#define                AT91_PMC_BIASCOUNT      (0xf << 28)             /* UTMI BIAS Start-up Time */
+
+#define        AT91_CKGR_MOR           0x20                    /* Main Oscillator Register [not on SAM9RL] */
+#define                AT91_PMC_MOSCEN         (1    <<  0)            /* Main Oscillator Enable */
+#define                AT91_PMC_OSCBYPASS      (1    <<  1)            /* Oscillator Bypass */
+#define                AT91_PMC_MOSCRCEN       (1    <<  3)            /* Main On-Chip RC Oscillator Enable [some SAM9] */
+#define                AT91_PMC_OSCOUNT        (0xff <<  8)            /* Main Oscillator Start-up Time */
+#define                AT91_PMC_KEY            (0x37 << 16)            /* MOR Writing Key */
+#define                AT91_PMC_MOSCSEL        (1    << 24)            /* Main Oscillator Selection [some SAM9] */
+#define                AT91_PMC_CFDEN          (1    << 25)            /* Clock Failure Detector Enable [some SAM9] */
+
+#define        AT91_CKGR_MCFR          0x24                    /* Main Clock Frequency Register */
+#define                AT91_PMC_MAINF          (0xffff <<  0)          /* Main Clock Frequency */
+#define                AT91_PMC_MAINRDY        (1      << 16)          /* Main Clock Ready */
+
+#define        AT91_CKGR_PLLAR         0x28                    /* PLL A Register */
+#define        AT91_CKGR_PLLBR         0x2c                    /* PLL B Register */
+#define                AT91_PMC_DIV            (0xff  <<  0)           /* Divider */
+#define                AT91_PMC_PLLCOUNT       (0x3f  <<  8)           /* PLL Counter */
+#define                AT91_PMC_OUT            (3     << 14)           /* PLL Clock Frequency Range */
+#define                AT91_PMC_MUL            (0x7ff << 16)           /* PLL Multiplier */
+#define                AT91_PMC_MUL_GET(n)     ((n) >> 16 & 0x7ff)
+#define                AT91_PMC3_MUL           (0x7f  << 18)           /* PLL Multiplier [SAMA5 only] */
+#define                AT91_PMC3_MUL_GET(n)    ((n) >> 18 & 0x7f)
+#define                AT91_PMC_USBDIV         (3     << 28)           /* USB Divisor (PLLB only) */
+#define                        AT91_PMC_USBDIV_1               (0 << 28)
+#define                        AT91_PMC_USBDIV_2               (1 << 28)
+#define                        AT91_PMC_USBDIV_4               (2 << 28)
+#define                AT91_PMC_USB96M         (1     << 28)           /* Divider by 2 Enable (PLLB only) */
+
+#define        AT91_PMC_MCKR           0x30                    /* Master Clock Register */
+#define                AT91_PMC_CSS            (3 <<  0)               /* Master Clock Selection */
+#define                        AT91_PMC_CSS_SLOW               (0 << 0)
+#define                        AT91_PMC_CSS_MAIN               (1 << 0)
+#define                        AT91_PMC_CSS_PLLA               (2 << 0)
+#define                        AT91_PMC_CSS_PLLB               (3 << 0)
+#define                        AT91_PMC_CSS_UPLL               (3 << 0)        /* [some SAM9 only] */
+#define                PMC_PRES_OFFSET         2
+#define                AT91_PMC_PRES           (7 <<  PMC_PRES_OFFSET)         /* Master Clock Prescaler */
+#define                        AT91_PMC_PRES_1                 (0 << PMC_PRES_OFFSET)
+#define                        AT91_PMC_PRES_2                 (1 << PMC_PRES_OFFSET)
+#define                        AT91_PMC_PRES_4                 (2 << PMC_PRES_OFFSET)
+#define                        AT91_PMC_PRES_8                 (3 << PMC_PRES_OFFSET)
+#define                        AT91_PMC_PRES_16                (4 << PMC_PRES_OFFSET)
+#define                        AT91_PMC_PRES_32                (5 << PMC_PRES_OFFSET)
+#define                        AT91_PMC_PRES_64                (6 << PMC_PRES_OFFSET)
+#define                PMC_ALT_PRES_OFFSET     4
+#define                AT91_PMC_ALT_PRES       (7 <<  PMC_ALT_PRES_OFFSET)             /* Master Clock Prescaler [alternate location] */
+#define                        AT91_PMC_ALT_PRES_1             (0 << PMC_ALT_PRES_OFFSET)
+#define                        AT91_PMC_ALT_PRES_2             (1 << PMC_ALT_PRES_OFFSET)
+#define                        AT91_PMC_ALT_PRES_4             (2 << PMC_ALT_PRES_OFFSET)
+#define                        AT91_PMC_ALT_PRES_8             (3 << PMC_ALT_PRES_OFFSET)
+#define                        AT91_PMC_ALT_PRES_16            (4 << PMC_ALT_PRES_OFFSET)
+#define                        AT91_PMC_ALT_PRES_32            (5 << PMC_ALT_PRES_OFFSET)
+#define                        AT91_PMC_ALT_PRES_64            (6 << PMC_ALT_PRES_OFFSET)
+#define                AT91_PMC_MDIV           (3 <<  8)               /* Master Clock Division */
+#define                        AT91RM9200_PMC_MDIV_1           (0 << 8)        /* [AT91RM9200 only] */
+#define                        AT91RM9200_PMC_MDIV_2           (1 << 8)
+#define                        AT91RM9200_PMC_MDIV_3           (2 << 8)
+#define                        AT91RM9200_PMC_MDIV_4           (3 << 8)
+#define                        AT91SAM9_PMC_MDIV_1             (0 << 8)        /* [SAM9 only] */
+#define                        AT91SAM9_PMC_MDIV_2             (1 << 8)
+#define                        AT91SAM9_PMC_MDIV_4             (2 << 8)
+#define                        AT91SAM9_PMC_MDIV_6             (3 << 8)        /* [some SAM9 only] */
+#define                        AT91SAM9_PMC_MDIV_3             (3 << 8)        /* [some SAM9 only] */
+#define                AT91_PMC_PDIV           (1 << 12)               /* Processor Clock Division [some SAM9 only] */
+#define                        AT91_PMC_PDIV_1                 (0 << 12)
+#define                        AT91_PMC_PDIV_2                 (1 << 12)
+#define                AT91_PMC_PLLADIV2       (1 << 12)               /* PLLA divisor by 2 [some SAM9 only] */
+#define                        AT91_PMC_PLLADIV2_OFF           (0 << 12)
+#define                        AT91_PMC_PLLADIV2_ON            (1 << 12)
+
+#define        AT91_PMC_USB            0x38                    /* USB Clock Register [some SAM9 only] */
+#define                AT91_PMC_USBS           (0x1 <<  0)             /* USB OHCI Input clock selection */
+#define                        AT91_PMC_USBS_PLLA              (0 << 0)
+#define                        AT91_PMC_USBS_UPLL              (1 << 0)
+#define                        AT91_PMC_USBS_PLLB              (1 << 0)        /* [AT91SAMN12 only] */
+#define                AT91_PMC_OHCIUSBDIV     (0xF <<  8)             /* Divider for USB OHCI Clock */
+#define                        AT91_PMC_OHCIUSBDIV_1   (0x0 <<  8)
+#define                        AT91_PMC_OHCIUSBDIV_2   (0x1 <<  8)
+
+#define        AT91_PMC_SMD            0x3c                    /* Soft Modem Clock Register [some SAM9 only] */
+#define                AT91_PMC_SMDS           (0x1  <<  0)            /* SMD input clock selection */
+#define                AT91_PMC_SMD_DIV        (0x1f <<  8)            /* SMD input clock divider */
+#define                AT91_PMC_SMDDIV(n)      (((n) <<  8) & AT91_PMC_SMD_DIV)
+
+#define        AT91_PMC_PCKR(n)        (0x40 + ((n) * 4))      /* Programmable Clock 0-N Registers */
+#define                AT91_PMC_ALT_PCKR_CSS   (0x7 <<  0)             /* Programmable Clock Source Selection [alternate length] */
+#define                        AT91_PMC_CSS_MASTER             (4 << 0)        /* [some SAM9 only] */
+#define                AT91_PMC_CSSMCK         (0x1 <<  8)             /* CSS or Master Clock Selection */
+#define                        AT91_PMC_CSSMCK_CSS             (0 << 8)
+#define                        AT91_PMC_CSSMCK_MCK             (1 << 8)
+
+#define        AT91_PMC_IER            0x60                    /* Interrupt Enable Register */
+#define        AT91_PMC_IDR            0x64                    /* Interrupt Disable Register */
+#define        AT91_PMC_SR             0x68                    /* Status Register */
+#define                AT91_PMC_MOSCS          (1 <<  0)               /* MOSCS Flag */
+#define                AT91_PMC_LOCKA          (1 <<  1)               /* PLLA Lock */
+#define                AT91_PMC_LOCKB          (1 <<  2)               /* PLLB Lock */
+#define                AT91_PMC_MCKRDY         (1 <<  3)               /* Master Clock */
+#define                AT91_PMC_LOCKU          (1 <<  6)               /* UPLL Lock [some SAM9] */
+#define                AT91_PMC_PCK0RDY        (1 <<  8)               /* Programmable Clock 0 */
+#define                AT91_PMC_PCK1RDY        (1 <<  9)               /* Programmable Clock 1 */
+#define                AT91_PMC_PCK2RDY        (1 << 10)               /* Programmable Clock 2 */
+#define                AT91_PMC_PCK3RDY        (1 << 11)               /* Programmable Clock 3 */
+#define                AT91_PMC_MOSCSELS       (1 << 16)               /* Main Oscillator Selection [some SAM9] */
+#define                AT91_PMC_MOSCRCS        (1 << 17)               /* Main On-Chip RC [some SAM9] */
+#define                AT91_PMC_CFDEV          (1 << 18)               /* Clock Failure Detector Event [some SAM9] */
+#define        AT91_PMC_IMR            0x6c                    /* Interrupt Mask Register */
+
+#define AT91_PMC_PLLICPR       0x80                    /* PLL Charge Pump Current Register */
+
+#define AT91_PMC_PROT          0xe4                    /* Write Protect Mode Register [some SAM9] */
+#define                AT91_PMC_WPEN           (0x1  <<  0)            /* Write Protect Enable */
+#define                AT91_PMC_WPKEY          (0xffffff << 8)         /* Write Protect Key */
+#define                AT91_PMC_PROTKEY        (0x504d43 << 8)         /* Activation Code */
+
+#define AT91_PMC_WPSR          0xe8                    /* Write Protect Status Register [some SAM9] */
+#define                AT91_PMC_WPVS           (0x1  <<  0)            /* Write Protect Violation Status */
+#define                AT91_PMC_WPVSRC         (0xffff  <<  8)         /* Write Protect Violation Source */
+
+#define AT91_PMC_PCER1         0x100                   /* Peripheral Clock Enable Register 1 [SAMA5 only]*/
+#define AT91_PMC_PCDR1         0x104                   /* Peripheral Clock Enable Register 1 */
+#define AT91_PMC_PCSR1         0x108                   /* Peripheral Clock Enable Register 1 */
+
+#define AT91_PMC_PCR           0x10c                   /* Peripheral Control Register [some SAM9 and SAMA5] */
+#define                AT91_PMC_PCR_PID        (0x3f  <<  0)           /* Peripheral ID */
+#define                AT91_PMC_PCR_CMD        (0x1  <<  12)           /* Command (read=0, write=1) */
+#define                AT91_PMC_PCR_DIV(n)     ((n)  <<  16)           /* Divisor Value */
+#define                        AT91_PMC_PCR_DIV0       0x0                     /* Peripheral clock is MCK */
+#define                        AT91_PMC_PCR_DIV2       0x1                     /* Peripheral clock is MCK/2 */
+#define                        AT91_PMC_PCR_DIV4       0x2                     /* Peripheral clock is MCK/4 */
+#define                        AT91_PMC_PCR_DIV8       0x3                     /* Peripheral clock is MCK/8 */
+#define                AT91_PMC_PCR_EN         (0x1  <<  28)           /* Enable */
+
+#endif
diff --git a/include/linux/clk/shmobile.h b/include/linux/clk/shmobile.h
new file mode 100644 (file)
index 0000000..f9bf080
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2013 Ideas On Board SPRL
+ *
+ * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __LINUX_CLK_SHMOBILE_H_
+#define __LINUX_CLK_SHMOBILE_H_
+
+#include <linux/types.h>
+
+void rcar_gen2_clocks_init(u32 mode);
+
+#endif
index 23a0ceee831fc4ca2e5a93abfaa951ce3fff0048..3ca9fca827a2f1299ed7eea5ca9ec908e57f2fc8 100644 (file)
@@ -120,13 +120,6 @@ static inline void tegra_cpu_clock_resume(void)
 }
 #endif
 
-#ifdef CONFIG_ARCH_TEGRA
-void tegra_periph_reset_deassert(struct clk *c);
-void tegra_periph_reset_assert(struct clk *c);
-#else
-static inline void tegra_periph_reset_deassert(struct clk *c) {}
-static inline void tegra_periph_reset_assert(struct clk *c) {}
-#endif
 void tegra_clocks_apply_init_table(void);
 
 #endif /* __LINUX_CLK_TEGRA_H_ */
index a6a6f603103be9903caf75180b71f3499a48d047..94bad77eeb4a19d4fbfeef6461a103f5b7e9dbcc 100644 (file)
@@ -43,4 +43,9 @@ int clk_add_alias(const char *, const char *, char *, struct device *);
 int clk_register_clkdev(struct clk *, const char *, const char *, ...);
 int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t);
 
+#ifdef CONFIG_COMMON_CLK
+int __clk_get(struct clk *clk);
+void __clk_put(struct clk *clk);
+#endif
+
 #endif
index 24545cd90a252b8dea0a9eec462b97a03b86adaa..02ae99e8e6d38a49ba59e76ecb722fce64376a51 100644 (file)
@@ -37,6 +37,9 @@
     __asm__ ("" : "=r"(__ptr) : "0"(ptr));             \
     (typeof(ptr)) (__ptr + (off)); })
 
+/* Make the optimizer believe the variable can be manipulated arbitrarily. */
+#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var))
+
 #ifdef __CHECKER__
 #define __must_be_array(arr) 0
 #else
index dc1bd3dcf11fd6b72f93c5d3d9b674957bb705a0..5529c52394219a25f274143aaab152bed8b4e157 100644 (file)
@@ -15,6 +15,7 @@
  */
 #undef barrier
 #undef RELOC_HIDE
+#undef OPTIMIZER_HIDE_VAR
 
 #define barrier() __memory_barrier()
 
      __ptr = (unsigned long) (ptr);                            \
     (typeof(ptr)) (__ptr + (off)); })
 
+/* This should act as an optimization barrier on var.
+ * Given that this compiler does not have inline assembly, a compiler barrier
+ * is the best we can do.
+ */
+#define OPTIMIZER_HIDE_VAR(var) barrier()
+
 /* Intel ECC compiler doesn't support __builtin_types_compatible_p() */
 #define __must_be_array(a) 0
 
index fe7a686dfd8dc3b87dcc35d0bdd3e50a47324014..2472740d7ab2201f58d68ce864448b3def30cdaf 100644 (file)
@@ -170,6 +170,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
     (typeof(ptr)) (__ptr + (off)); })
 #endif
 
+#ifndef OPTIMIZER_HIDE_VAR
+#define OPTIMIZER_HIDE_VAR(var) barrier()
+#endif
+
 /* Not-quite-unique ID. */
 #ifndef __UNIQUE_ID
 # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)
index ba5f96db07540dc2897399d98a1b7085cc16a63a..6fd9390ccf91ab541f4aba92ac80da639bdf58ad 100644 (file)
@@ -1115,6 +1115,7 @@ int dma_async_device_register(struct dma_device *device);
 void dma_async_device_unregister(struct dma_device *device);
 void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
 struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
+struct dma_chan *dma_get_any_slave_channel(struct dma_device *device);
 struct dma_chan *net_dma_find_channel(void);
 #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
 #define dma_request_slave_channel_compat(mask, x, y, dev, name) \
index 1516a8ff8f92bbfb6238b90b133ff84e1cc29035..6df7f9fe0d014faab41d122c41765ef69bf7ee59 100644 (file)
@@ -97,7 +97,7 @@ extern struct group_info init_groups;
 #ifdef CONFIG_AUDITSYSCALL
 #define INIT_IDS \
        .loginuid = INVALID_UID, \
-       .sessionid = -1,
+       .sessionid = (unsigned int)-1,
 #else
 #define INIT_IDS
 #endif
diff --git a/include/linux/platform_data/clocksource-nomadik-mtu.h b/include/linux/platform_data/clocksource-nomadik-mtu.h
deleted file mode 100644 (file)
index 8008897..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __PLAT_MTU_H
-#define __PLAT_MTU_H
-
-void nmdk_timer_init(void __iomem *base, int irq);
-void nmdk_clkevt_reset(void);
-void nmdk_clksrc_reset(void);
-
-#endif /* __PLAT_MTU_H */
-
index 6efd202645858763339d0cffae47be4ec53dff5e..fbe2f7535741754a705ee042aa218c8cce9de152 100644 (file)
@@ -28,13 +28,12 @@ enum davinci_gpio_type {
 struct davinci_gpio_platform_data {
        u32     ngpio;
        u32     gpio_unbanked;
-       u32     intc_irq_num;
 };
 
 
 struct davinci_gpio_controller {
        struct gpio_chip        chip;
-       int                     irq_base;
+       struct irq_domain       *irq_domain;
        /* Serialize access to GPIO registers */
        spinlock_t              lock;
        void __iomem            *regs;
diff --git a/include/linux/platform_data/pinctrl-nomadik.h b/include/linux/platform_data/pinctrl-nomadik.h
deleted file mode 100644 (file)
index abf5bed..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Structures and registers for GPIO access in the Nomadik SoC
- *
- * Copyright (C) 2008 STMicroelectronics
- *     Author: Prafulla WADASKAR <prafulla.wadaskar@st.com>
- * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef __PLAT_NOMADIK_GPIO
-#define __PLAT_NOMADIK_GPIO
-
-/*
- * pin configurations are represented by 32-bit integers:
- *
- *     bit  0.. 8 - Pin Number (512 Pins Maximum)
- *     bit  9..10 - Alternate Function Selection
- *     bit 11..12 - Pull up/down state
- *     bit     13 - Sleep mode behaviour
- *     bit     14 - Direction
- *     bit     15 - Value (if output)
- *     bit 16..18 - SLPM pull up/down state
- *     bit 19..20 - SLPM direction
- *     bit 21..22 - SLPM Value (if output)
- *     bit 23..25 - PDIS value (if input)
- *     bit     26 - Gpio mode
- *     bit     27 - Sleep mode
- *
- * to facilitate the definition, the following macros are provided
- *
- * PIN_CFG_DEFAULT - default config (0):
- *                  pull up/down = disabled
- *                  sleep mode = input/wakeup
- *                  direction = input
- *                  value = low
- *                  SLPM direction = same as normal
- *                  SLPM pull = same as normal
- *                  SLPM value = same as normal
- *
- * PIN_CFG        - default config with alternate function
- */
-
-typedef unsigned long pin_cfg_t;
-
-#define PIN_NUM_MASK           0x1ff
-#define PIN_NUM(x)             ((x) & PIN_NUM_MASK)
-
-#define PIN_ALT_SHIFT          9
-#define PIN_ALT_MASK           (0x3 << PIN_ALT_SHIFT)
-#define PIN_ALT(x)             (((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT)
-#define PIN_GPIO               (NMK_GPIO_ALT_GPIO << PIN_ALT_SHIFT)
-#define PIN_ALT_A              (NMK_GPIO_ALT_A << PIN_ALT_SHIFT)
-#define PIN_ALT_B              (NMK_GPIO_ALT_B << PIN_ALT_SHIFT)
-#define PIN_ALT_C              (NMK_GPIO_ALT_C << PIN_ALT_SHIFT)
-
-#define PIN_PULL_SHIFT         11
-#define PIN_PULL_MASK          (0x3 << PIN_PULL_SHIFT)
-#define PIN_PULL(x)            (((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT)
-#define PIN_PULL_NONE          (NMK_GPIO_PULL_NONE << PIN_PULL_SHIFT)
-#define PIN_PULL_UP            (NMK_GPIO_PULL_UP << PIN_PULL_SHIFT)
-#define PIN_PULL_DOWN          (NMK_GPIO_PULL_DOWN << PIN_PULL_SHIFT)
-
-#define PIN_SLPM_SHIFT         13
-#define PIN_SLPM_MASK          (0x1 << PIN_SLPM_SHIFT)
-#define PIN_SLPM(x)            (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT)
-#define PIN_SLPM_MAKE_INPUT    (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT)
-#define PIN_SLPM_NOCHANGE      (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT)
-/* These two replace the above in DB8500v2+ */
-#define PIN_SLPM_WAKEUP_ENABLE (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT)
-#define PIN_SLPM_WAKEUP_DISABLE        (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT)
-#define PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP PIN_SLPM_WAKEUP_DISABLE
-
-#define PIN_SLPM_GPIO  PIN_SLPM_WAKEUP_ENABLE /* In SLPM, pin is a gpio */
-#define PIN_SLPM_ALTFUNC PIN_SLPM_WAKEUP_DISABLE /* In SLPM, pin is altfunc */
-
-#define PIN_DIR_SHIFT          14
-#define PIN_DIR_MASK           (0x1 << PIN_DIR_SHIFT)
-#define PIN_DIR(x)             (((x) & PIN_DIR_MASK) >> PIN_DIR_SHIFT)
-#define PIN_DIR_INPUT          (0 << PIN_DIR_SHIFT)
-#define PIN_DIR_OUTPUT         (1 << PIN_DIR_SHIFT)
-
-#define PIN_VAL_SHIFT          15
-#define PIN_VAL_MASK           (0x1 << PIN_VAL_SHIFT)
-#define PIN_VAL(x)             (((x) & PIN_VAL_MASK) >> PIN_VAL_SHIFT)
-#define PIN_VAL_LOW            (0 << PIN_VAL_SHIFT)
-#define PIN_VAL_HIGH           (1 << PIN_VAL_SHIFT)
-
-#define PIN_SLPM_PULL_SHIFT    16
-#define PIN_SLPM_PULL_MASK     (0x7 << PIN_SLPM_PULL_SHIFT)
-#define PIN_SLPM_PULL(x)       \
-       (((x) & PIN_SLPM_PULL_MASK) >> PIN_SLPM_PULL_SHIFT)
-#define PIN_SLPM_PULL_NONE     \
-       ((1 + NMK_GPIO_PULL_NONE) << PIN_SLPM_PULL_SHIFT)
-#define PIN_SLPM_PULL_UP       \
-       ((1 + NMK_GPIO_PULL_UP) << PIN_SLPM_PULL_SHIFT)
-#define PIN_SLPM_PULL_DOWN     \
-       ((1 + NMK_GPIO_PULL_DOWN) << PIN_SLPM_PULL_SHIFT)
-
-#define PIN_SLPM_DIR_SHIFT     19
-#define PIN_SLPM_DIR_MASK      (0x3 << PIN_SLPM_DIR_SHIFT)
-#define PIN_SLPM_DIR(x)                \
-       (((x) & PIN_SLPM_DIR_MASK) >> PIN_SLPM_DIR_SHIFT)
-#define PIN_SLPM_DIR_INPUT     ((1 + 0) << PIN_SLPM_DIR_SHIFT)
-#define PIN_SLPM_DIR_OUTPUT    ((1 + 1) << PIN_SLPM_DIR_SHIFT)
-
-#define PIN_SLPM_VAL_SHIFT     21
-#define PIN_SLPM_VAL_MASK      (0x3 << PIN_SLPM_VAL_SHIFT)
-#define PIN_SLPM_VAL(x)                \
-       (((x) & PIN_SLPM_VAL_MASK) >> PIN_SLPM_VAL_SHIFT)
-#define PIN_SLPM_VAL_LOW       ((1 + 0) << PIN_SLPM_VAL_SHIFT)
-#define PIN_SLPM_VAL_HIGH      ((1 + 1) << PIN_SLPM_VAL_SHIFT)
-
-#define PIN_SLPM_PDIS_SHIFT            23
-#define PIN_SLPM_PDIS_MASK             (0x3 << PIN_SLPM_PDIS_SHIFT)
-#define PIN_SLPM_PDIS(x)       \
-       (((x) & PIN_SLPM_PDIS_MASK) >> PIN_SLPM_PDIS_SHIFT)
-#define PIN_SLPM_PDIS_NO_CHANGE                (0 << PIN_SLPM_PDIS_SHIFT)
-#define PIN_SLPM_PDIS_DISABLED         (1 << PIN_SLPM_PDIS_SHIFT)
-#define PIN_SLPM_PDIS_ENABLED          (2 << PIN_SLPM_PDIS_SHIFT)
-
-#define PIN_LOWEMI_SHIFT       25
-#define PIN_LOWEMI_MASK                (0x1 << PIN_LOWEMI_SHIFT)
-#define PIN_LOWEMI(x)          (((x) & PIN_LOWEMI_MASK) >> PIN_LOWEMI_SHIFT)
-#define PIN_LOWEMI_DISABLED    (0 << PIN_LOWEMI_SHIFT)
-#define PIN_LOWEMI_ENABLED     (1 << PIN_LOWEMI_SHIFT)
-
-#define PIN_GPIOMODE_SHIFT     26
-#define PIN_GPIOMODE_MASK      (0x1 << PIN_GPIOMODE_SHIFT)
-#define PIN_GPIOMODE(x)                (((x) & PIN_GPIOMODE_MASK) >> PIN_GPIOMODE_SHIFT)
-#define PIN_GPIOMODE_DISABLED  (0 << PIN_GPIOMODE_SHIFT)
-#define PIN_GPIOMODE_ENABLED   (1 << PIN_GPIOMODE_SHIFT)
-
-#define PIN_SLEEPMODE_SHIFT    27
-#define PIN_SLEEPMODE_MASK     (0x1 << PIN_SLEEPMODE_SHIFT)
-#define PIN_SLEEPMODE(x)       (((x) & PIN_SLEEPMODE_MASK) >> PIN_SLEEPMODE_SHIFT)
-#define PIN_SLEEPMODE_DISABLED (0 << PIN_SLEEPMODE_SHIFT)
-#define PIN_SLEEPMODE_ENABLED  (1 << PIN_SLEEPMODE_SHIFT)
-
-
-/* Shortcuts.  Use these instead of separate DIR, PULL, and VAL.  */
-#define PIN_INPUT_PULLDOWN     (PIN_DIR_INPUT | PIN_PULL_DOWN)
-#define PIN_INPUT_PULLUP       (PIN_DIR_INPUT | PIN_PULL_UP)
-#define PIN_INPUT_NOPULL       (PIN_DIR_INPUT | PIN_PULL_NONE)
-#define PIN_OUTPUT_LOW         (PIN_DIR_OUTPUT | PIN_VAL_LOW)
-#define PIN_OUTPUT_HIGH                (PIN_DIR_OUTPUT | PIN_VAL_HIGH)
-
-#define PIN_SLPM_INPUT_PULLDOWN        (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_DOWN)
-#define PIN_SLPM_INPUT_PULLUP  (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_UP)
-#define PIN_SLPM_INPUT_NOPULL  (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_NONE)
-#define PIN_SLPM_OUTPUT_LOW    (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_LOW)
-#define PIN_SLPM_OUTPUT_HIGH   (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_HIGH)
-
-#define PIN_CFG_DEFAULT                (0)
-
-#define PIN_CFG(num, alt)              \
-       (PIN_CFG_DEFAULT |\
-        (PIN_NUM(num) | PIN_##alt))
-
-#define PIN_CFG_INPUT(num, alt, pull)          \
-       (PIN_CFG_DEFAULT |\
-        (PIN_NUM(num) | PIN_##alt | PIN_INPUT_##pull))
-
-#define PIN_CFG_OUTPUT(num, alt, val)          \
-       (PIN_CFG_DEFAULT |\
-        (PIN_NUM(num) | PIN_##alt | PIN_OUTPUT_##val))
-
-/*
- * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
- * the "gpio" namespace for generic and cross-machine functions
- */
-
-#define GPIO_BLOCK_SHIFT 5
-#define NMK_GPIO_PER_CHIP (1 << GPIO_BLOCK_SHIFT)
-
-/* Register in the logic block */
-#define NMK_GPIO_DAT   0x00
-#define NMK_GPIO_DATS  0x04
-#define NMK_GPIO_DATC  0x08
-#define NMK_GPIO_PDIS  0x0c
-#define NMK_GPIO_DIR   0x10
-#define NMK_GPIO_DIRS  0x14
-#define NMK_GPIO_DIRC  0x18
-#define NMK_GPIO_SLPC  0x1c
-#define NMK_GPIO_AFSLA 0x20
-#define NMK_GPIO_AFSLB 0x24
-#define NMK_GPIO_LOWEMI        0x28
-
-#define NMK_GPIO_RIMSC 0x40
-#define NMK_GPIO_FIMSC 0x44
-#define NMK_GPIO_IS    0x48
-#define NMK_GPIO_IC    0x4c
-#define NMK_GPIO_RWIMSC        0x50
-#define NMK_GPIO_FWIMSC        0x54
-#define NMK_GPIO_WKS   0x58
-/* These appear in DB8540 and later ASICs */
-#define NMK_GPIO_EDGELEVEL 0x5C
-#define NMK_GPIO_LEVEL 0x60
-
-/* Alternate functions: function C is set in hw by setting both A and B */
-#define NMK_GPIO_ALT_GPIO      0
-#define NMK_GPIO_ALT_A 1
-#define NMK_GPIO_ALT_B 2
-#define NMK_GPIO_ALT_C (NMK_GPIO_ALT_A | NMK_GPIO_ALT_B)
-
-#define NMK_GPIO_ALT_CX_SHIFT 2
-#define NMK_GPIO_ALT_C1        ((1<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
-#define NMK_GPIO_ALT_C2        ((2<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
-#define NMK_GPIO_ALT_C3        ((3<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
-#define NMK_GPIO_ALT_C4        ((4<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
-
-/* Pull up/down values */
-enum nmk_gpio_pull {
-       NMK_GPIO_PULL_NONE,
-       NMK_GPIO_PULL_UP,
-       NMK_GPIO_PULL_DOWN,
-};
-
-/* Sleep mode */
-enum nmk_gpio_slpm {
-       NMK_GPIO_SLPM_INPUT,
-       NMK_GPIO_SLPM_WAKEUP_ENABLE = NMK_GPIO_SLPM_INPUT,
-       NMK_GPIO_SLPM_NOCHANGE,
-       NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE,
-};
-
-/*
- * Platform data to register a block: only the initial gpio/irq number.
- */
-struct nmk_gpio_platform_data {
-       char *name;
-       int first_gpio;
-       int first_irq;
-       int num_gpio;
-       u32 (*get_secondary_status)(unsigned int bank);
-       void (*set_ioforce)(bool enable);
-       bool supports_sleepmode;
-};
-
-#endif /* __PLAT_NOMADIK_GPIO */
index 2f61311ae3e0d8cd83c826f9e23c8034e0a96ce0..41a4695fde08ca9414f6c541aaa16077b215d3d2 100644 (file)
@@ -21,6 +21,7 @@ struct reset_control_ops {
 
 struct module;
 struct device_node;
+struct of_phandle_args;
 
 /**
  * struct reset_controller_dev - reset controller entity that might
index 50fe651da965933f416b3cc6a5a0080942ac107e..22b3640c9424d60f592388b1698704791f348150 100644 (file)
 
 #define SCIx_NOT_SUPPORTED     (-1)
 
-enum {
-       SCBRR_ALGO_1,           /* ((clk + 16 * bps) / (16 * bps) - 1) */
-       SCBRR_ALGO_2,           /* ((clk + 16 * bps) / (32 * bps) - 1) */
-       SCBRR_ALGO_3,           /* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */
-       SCBRR_ALGO_4,           /* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */
-       SCBRR_ALGO_5,           /* (((clk * 1000 / 32) / bps) - 1) */
-       SCBRR_ALGO_6,           /* HSCIF variable sample rate algorithm */
-};
-
 #define SCSCR_TIE      (1 << 7)
 #define SCSCR_RIE      (1 << 6)
 #define SCSCR_TE       (1 << 5)
@@ -59,28 +50,6 @@ enum {
 /* HSSRR HSCIF */
 #define HSCIF_SRE      0x8000
 
-/* Offsets into the sci_port->irqs array */
-enum {
-       SCIx_ERI_IRQ,
-       SCIx_RXI_IRQ,
-       SCIx_TXI_IRQ,
-       SCIx_BRI_IRQ,
-       SCIx_NR_IRQS,
-
-       SCIx_MUX_IRQ = SCIx_NR_IRQS,    /* special case */
-};
-
-/* Offsets into the sci_port->gpios array */
-enum {
-       SCIx_SCK,
-       SCIx_RXD,
-       SCIx_TXD,
-       SCIx_CTS,
-       SCIx_RTS,
-
-       SCIx_NR_FNS,
-};
-
 enum {
        SCIx_PROBE_REGTYPE,
 
@@ -99,19 +68,6 @@ enum {
        SCIx_NR_REGTYPES,
 };
 
-#define SCIx_IRQ_MUXED(irq)            \
-{                                      \
-       [SCIx_ERI_IRQ]  = (irq),        \
-       [SCIx_RXI_IRQ]  = (irq),        \
-       [SCIx_TXI_IRQ]  = (irq),        \
-       [SCIx_BRI_IRQ]  = (irq),        \
-}
-
-#define SCIx_IRQ_IS_MUXED(port)                        \
-       ((port)->cfg->irqs[SCIx_ERI_IRQ] ==     \
-        (port)->cfg->irqs[SCIx_RXI_IRQ]) ||    \
-       ((port)->cfg->irqs[SCIx_ERI_IRQ] &&     \
-        !(port)->cfg->irqs[SCIx_RXI_IRQ])
 /*
  * SCI register subset common for all port types.
  * Not all registers will exist on all parts.
@@ -140,22 +96,16 @@ struct plat_sci_port_ops {
  * Platform device specific platform_data struct
  */
 struct plat_sci_port {
-       unsigned long   mapbase;                /* resource base */
-       unsigned int    irqs[SCIx_NR_IRQS];     /* ERI, RXI, TXI, BRI */
-       unsigned int    gpios[SCIx_NR_FNS];     /* SCK, RXD, TXD, CTS, RTS */
        unsigned int    type;                   /* SCI / SCIF / IRDA / HSCIF */
        upf_t           flags;                  /* UPF_* flags */
        unsigned long   capabilities;           /* Port features/capabilities */
 
-       unsigned int    scbrr_algo_id;          /* SCBRR calculation algo */
+       unsigned int    sampling_rate;
        unsigned int    scscr;                  /* SCSCR initialization */
 
        /*
         * Platform overrides if necessary, defaults otherwise.
         */
-       int             overrun_bit;
-       unsigned int    error_mask;
-
        int             port_reg;
        unsigned char   regshift;
        unsigned char   regtype;
index fd4498329c7c509b3614ad820c7c717d976afa2f..46f0a07812b46ab135836d1d13e6d8c86a50168b 100644 (file)
@@ -19,6 +19,7 @@
 #define _MACH_TEGRA_POWERGATE_H_
 
 struct clk;
+struct reset_control;
 
 #define TEGRA_POWERGATE_CPU    0
 #define TEGRA_POWERGATE_3D     1
@@ -37,14 +38,49 @@ struct clk;
 #define TEGRA_POWERGATE_CPU0   14
 #define TEGRA_POWERGATE_C0NC   15
 #define TEGRA_POWERGATE_C1NC   16
+#define TEGRA_POWERGATE_SOR    17
 #define TEGRA_POWERGATE_DIS    18
 #define TEGRA_POWERGATE_DISB   19
 #define TEGRA_POWERGATE_XUSBA  20
 #define TEGRA_POWERGATE_XUSBB  21
 #define TEGRA_POWERGATE_XUSBC  22
+#define TEGRA_POWERGATE_VIC    23
+#define TEGRA_POWERGATE_IRAM   24
 
 #define TEGRA_POWERGATE_3D0    TEGRA_POWERGATE_3D
 
+#define TEGRA_IO_RAIL_CSIA     0
+#define TEGRA_IO_RAIL_CSIB     1
+#define TEGRA_IO_RAIL_DSI      2
+#define TEGRA_IO_RAIL_MIPI_BIAS        3
+#define TEGRA_IO_RAIL_PEX_BIAS 4
+#define TEGRA_IO_RAIL_PEX_CLK1 5
+#define TEGRA_IO_RAIL_PEX_CLK2 6
+#define TEGRA_IO_RAIL_USB0     9
+#define TEGRA_IO_RAIL_USB1     10
+#define TEGRA_IO_RAIL_USB2     11
+#define TEGRA_IO_RAIL_USB_BIAS 12
+#define TEGRA_IO_RAIL_NAND     13
+#define TEGRA_IO_RAIL_UART     14
+#define TEGRA_IO_RAIL_BB       15
+#define TEGRA_IO_RAIL_AUDIO    17
+#define TEGRA_IO_RAIL_HSIC     19
+#define TEGRA_IO_RAIL_COMP     22
+#define TEGRA_IO_RAIL_HDMI     28
+#define TEGRA_IO_RAIL_PEX_CNTRL        32
+#define TEGRA_IO_RAIL_SDMMC1   33
+#define TEGRA_IO_RAIL_SDMMC3   34
+#define TEGRA_IO_RAIL_SDMMC4   35
+#define TEGRA_IO_RAIL_CAM      36
+#define TEGRA_IO_RAIL_RES      37
+#define TEGRA_IO_RAIL_HV       38
+#define TEGRA_IO_RAIL_DSIB     39
+#define TEGRA_IO_RAIL_DSIC     40
+#define TEGRA_IO_RAIL_DSID     41
+#define TEGRA_IO_RAIL_CSIE     44
+#define TEGRA_IO_RAIL_LVDS     57
+#define TEGRA_IO_RAIL_SYS_DDC  58
+
 #ifdef CONFIG_ARCH_TEGRA
 int tegra_powergate_is_powered(int id);
 int tegra_powergate_power_on(int id);
@@ -52,7 +88,11 @@ int tegra_powergate_power_off(int id);
 int tegra_powergate_remove_clamping(int id);
 
 /* Must be called with clk disabled, and returns with clk enabled */
-int tegra_powergate_sequence_power_up(int id, struct clk *clk);
+int tegra_powergate_sequence_power_up(int id, struct clk *clk,
+                                     struct reset_control *rst);
+
+int tegra_io_rail_power_on(int id);
+int tegra_io_rail_power_off(int id);
 #else
 static inline int tegra_powergate_is_powered(int id)
 {
@@ -74,7 +114,18 @@ static inline int tegra_powergate_remove_clamping(int id)
        return -ENOSYS;
 }
 
-static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk)
+static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk,
+                                                   struct reset_control *rst)
+{
+       return -ENOSYS;
+}
+
+static inline int tegra_io_rail_power_on(int id)
+{
+       return -ENOSYS;
+}
+
+static inline int tegra_io_rail_power_off(int id)
 {
        return -ENOSYS;
 }
index 22a396c13f3a2976cce483670ba3f69a4d96a028..32754835a39ba87743ea1c81419a110d82c1ebf7 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <linux/types.h>
 #include <linux/usb/otg.h>
+#include <linux/clk.h>
 
 /**
  * Supported USB modes
@@ -135,6 +136,8 @@ struct msm_otg_platform_data {
        enum msm_usb_phy_type phy_type;
        void (*setup_gpio)(enum usb_otg_state state);
        char *pclk_src_name;
+       int (*link_clk_reset)(struct clk *link_clk, bool assert);
+       int (*phy_clk_reset)(struct clk *phy_clk);
 };
 
 /**
index 2c95d55f79149173d3a1f5f27bb1213dd24a323b..97e6dcaf12bb4860124336c7a3081d82389ac773 100644 (file)
@@ -111,7 +111,7 @@ struct cipso_v4_doi;
 struct netlbl_audit {
        u32 secid;
        kuid_t loginuid;
-       u32 sessionid;
+       unsigned int sessionid;
 };
 
 /*
index 6b82fdf4ba716898ea53fb0cf2e66690a66d1479..1d535f4d3873a67a811174f0d4df34494da250e8 100644 (file)
@@ -681,7 +681,7 @@ struct xfrm_spi_skb_cb {
 struct xfrm_audit {
        u32     secid;
        kuid_t  loginuid;
-       u32     sessionid;
+       unsigned int sessionid;
 };
 
 #ifdef CONFIG_AUDITSYSCALL
@@ -699,7 +699,7 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op)
        return audit_buf;
 }
 
-static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid,
+static inline void xfrm_audit_helper_usrinfo(kuid_t auid, unsigned int ses, u32 secid,
                                             struct audit_buffer *audit_buf)
 {
        char *secctx;
@@ -716,13 +716,13 @@ static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid,
 }
 
 void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, kuid_t auid,
-                          u32 ses, u32 secid);
+                          unsigned int ses, u32 secid);
 void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, kuid_t auid,
-                             u32 ses, u32 secid);
+                             unsigned int ses, u32 secid);
 void xfrm_audit_state_add(struct xfrm_state *x, int result, kuid_t auid,
-                         u32 ses, u32 secid);
+                         unsigned int ses, u32 secid);
 void xfrm_audit_state_delete(struct xfrm_state *x, int result, kuid_t auid,
-                            u32 ses, u32 secid);
+                            unsigned int ses, u32 secid);
 void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
                                      struct sk_buff *skb);
 void xfrm_audit_state_replay(struct xfrm_state *x, struct sk_buff *skb,
@@ -735,22 +735,22 @@ void xfrm_audit_state_icvfail(struct xfrm_state *x, struct sk_buff *skb,
 #else
 
 static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
-                                 kuid_t auid, u32 ses, u32 secid)
+                                 kuid_t auid, unsigned int ses, u32 secid)
 {
 }
 
 static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
-                                 kuid_t auid, u32 ses, u32 secid)
+                                 kuid_t auid, unsigned int ses, u32 secid)
 {
 }
 
 static inline void xfrm_audit_state_add(struct xfrm_state *x, int result,
-                                kuid_t auid, u32 ses, u32 secid)
+                                kuid_t auid, unsigned int ses, u32 secid)
 {
 }
 
 static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result,
-                                   kuid_t auid, u32 ses, u32 secid)
+                                   kuid_t auid, unsigned int ses, u32 secid)
 {
 }
 
index e147498abe5090ac348a2e9497d18e4bd10bd9d2..6add6ccc811e508766e1656164ea9ee09dc50aeb 100644 (file)
@@ -34,7 +34,6 @@
  * B : SSI direction
  */
 #define RSND_SSI_CLK_PIN_SHARE         (1 << 31)
-#define RSND_SSI_CLK_FROM_ADG          (1 << 30) /* clock parent is master */
 #define RSND_SSI_SYNC                  (1 << 29) /* SSI34_sync etc */
 
 #define RSND_SSI_PLAY                  (1 << 24)
index 44b05a09f1933a1c293a2174eb58d4db7b473b80..2d48fe1274ca52b4c94969b2bc9d46e6a6ffe48f 100644 (file)
@@ -319,6 +319,12 @@ enum {
 #define AUDIT_STATUS_PID               0x0004
 #define AUDIT_STATUS_RATE_LIMIT                0x0008
 #define AUDIT_STATUS_BACKLOG_LIMIT     0x0010
+#define AUDIT_STATUS_BACKLOG_WAIT_TIME 0x0020
+
+#define AUDIT_VERSION_BACKLOG_LIMIT    1
+#define AUDIT_VERSION_BACKLOG_WAIT_TIME        2
+#define AUDIT_VERSION_LATEST AUDIT_VERSION_BACKLOG_WAIT_TIME
+
                                /* Failure-to-log actions */
 #define AUDIT_FAIL_SILENT      0
 #define AUDIT_FAIL_PRINTK      1
@@ -375,6 +381,8 @@ struct audit_status {
        __u32           backlog_limit;  /* waiting messages limit */
        __u32           lost;           /* messages lost */
        __u32           backlog;        /* messages waiting in queue */
+       __u32           version;        /* audit api version number */
+       __u32           backlog_wait_time;/* message queue wait timeout */
 };
 
 struct audit_features {
index 906ae5a0233a1011d558ff47c548808517ef9a03..34c5a2310fbf9545eeff2e3fa803c8a361031bb3 100644 (file)
@@ -41,6 +41,8 @@
  * Example user-space utilities: http://people.redhat.com/sgrubb/audit/
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/init.h>
 #include <asm/types.h>
 #include <linux/atomic.h>
@@ -63,6 +65,7 @@
 #include <linux/freezer.h>
 #include <linux/tty.h>
 #include <linux/pid_namespace.h>
+#include <net/netns/generic.h>
 
 #include "audit.h"
 
@@ -76,16 +79,16 @@ static int  audit_initialized;
 #define AUDIT_OFF      0
 #define AUDIT_ON       1
 #define AUDIT_LOCKED   2
-int            audit_enabled;
-int            audit_ever_enabled;
+u32            audit_enabled;
+u32            audit_ever_enabled;
 
 EXPORT_SYMBOL_GPL(audit_enabled);
 
 /* Default state when kernel boots without any parameters. */
-static int     audit_default;
+static u32     audit_default;
 
 /* If auditing cannot proceed, audit_failure selects what happens. */
-static int     audit_failure = AUDIT_FAIL_PRINTK;
+static u32     audit_failure = AUDIT_FAIL_PRINTK;
 
 /*
  * If audit records are to be written to the netlink socket, audit_pid
@@ -93,17 +96,19 @@ static int  audit_failure = AUDIT_FAIL_PRINTK;
  * the portid to use to send netlink messages to that process.
  */
 int            audit_pid;
-static int     audit_nlk_portid;
+static __u32   audit_nlk_portid;
 
 /* If audit_rate_limit is non-zero, limit the rate of sending audit records
  * to that number per second.  This prevents DoS attacks, but results in
  * audit records being dropped. */
-static int     audit_rate_limit;
+static u32     audit_rate_limit;
 
-/* Number of outstanding audit_buffers allowed. */
-static int     audit_backlog_limit = 64;
-static int     audit_backlog_wait_time = 60 * HZ;
-static int     audit_backlog_wait_overflow = 0;
+/* Number of outstanding audit_buffers allowed.
+ * When set to zero, this means unlimited. */
+static u32     audit_backlog_limit = 64;
+#define AUDIT_BACKLOG_WAIT_TIME (60 * HZ)
+static u32     audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME;
+static u32     audit_backlog_wait_overflow = 0;
 
 /* The identity of the user shutting down the audit system. */
 kuid_t         audit_sig_uid = INVALID_UID;
@@ -121,6 +126,7 @@ static atomic_t    audit_lost = ATOMIC_INIT(0);
 
 /* The netlink socket. */
 static struct sock *audit_sock;
+int audit_net_id;
 
 /* Hash for inode-based rules */
 struct list_head audit_inode_hash[AUDIT_INODE_BUCKETS];
@@ -175,27 +181,27 @@ struct audit_buffer {
 };
 
 struct audit_reply {
-       int pid;
+       __u32 portid;
+       pid_t pid;
        struct sk_buff *skb;
 };
 
-static void audit_set_pid(struct audit_buffer *ab, pid_t pid)
+static void audit_set_portid(struct audit_buffer *ab, __u32 portid)
 {
        if (ab) {
                struct nlmsghdr *nlh = nlmsg_hdr(ab->skb);
-               nlh->nlmsg_pid = pid;
+               nlh->nlmsg_pid = portid;
        }
 }
 
 void audit_panic(const char *message)
 {
-       switch (audit_failure)
-       {
+       switch (audit_failure) {
        case AUDIT_FAIL_SILENT:
                break;
        case AUDIT_FAIL_PRINTK:
                if (printk_ratelimit())
-                       printk(KERN_ERR "audit: %s\n", message);
+                       pr_err("%s\n", message);
                break;
        case AUDIT_FAIL_PANIC:
                /* test audit_pid since printk is always losey, why bother? */
@@ -266,9 +272,7 @@ void audit_log_lost(const char *message)
 
        if (print) {
                if (printk_ratelimit())
-                       printk(KERN_WARNING
-                               "audit: audit_lost=%d audit_rate_limit=%d "
-                               "audit_backlog_limit=%d\n",
+                       pr_warn("audit_lost=%u audit_rate_limit=%u audit_backlog_limit=%u\n",
                                atomic_read(&audit_lost),
                                audit_rate_limit,
                                audit_backlog_limit);
@@ -276,7 +280,7 @@ void audit_log_lost(const char *message)
        }
 }
 
-static int audit_log_config_change(char *function_name, int new, int old,
+static int audit_log_config_change(char *function_name, u32 new, u32 old,
                                   int allow_changes)
 {
        struct audit_buffer *ab;
@@ -285,7 +289,7 @@ static int audit_log_config_change(char *function_name, int new, int old,
        ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
        if (unlikely(!ab))
                return rc;
-       audit_log_format(ab, "%s=%d old=%d", function_name, new, old);
+       audit_log_format(ab, "%s=%u old=%u", function_name, new, old);
        audit_log_session_info(ab);
        rc = audit_log_task_context(ab);
        if (rc)
@@ -295,9 +299,10 @@ static int audit_log_config_change(char *function_name, int new, int old,
        return rc;
 }
 
-static int audit_do_config_change(char *function_name, int *to_change, int new)
+static int audit_do_config_change(char *function_name, u32 *to_change, u32 new)
 {
-       int allow_changes, rc = 0, old = *to_change;
+       int allow_changes, rc = 0;
+       u32 old = *to_change;
 
        /* check if we are locked */
        if (audit_enabled == AUDIT_LOCKED)
@@ -320,17 +325,23 @@ static int audit_do_config_change(char *function_name, int *to_change, int new)
        return rc;
 }
 
-static int audit_set_rate_limit(int limit)
+static int audit_set_rate_limit(u32 limit)
 {
        return audit_do_config_change("audit_rate_limit", &audit_rate_limit, limit);
 }
 
-static int audit_set_backlog_limit(int limit)
+static int audit_set_backlog_limit(u32 limit)
 {
        return audit_do_config_change("audit_backlog_limit", &audit_backlog_limit, limit);
 }
 
-static int audit_set_enabled(int state)
+static int audit_set_backlog_wait_time(u32 timeout)
+{
+       return audit_do_config_change("audit_backlog_wait_time",
+                                     &audit_backlog_wait_time, timeout);
+}
+
+static int audit_set_enabled(u32 state)
 {
        int rc;
        if (state < AUDIT_OFF || state > AUDIT_LOCKED)
@@ -343,7 +354,7 @@ static int audit_set_enabled(int state)
        return rc;
 }
 
-static int audit_set_failure(int state)
+static int audit_set_failure(u32 state)
 {
        if (state != AUDIT_FAIL_SILENT
            && state != AUDIT_FAIL_PRINTK
@@ -365,7 +376,8 @@ static int audit_set_failure(int state)
 static void audit_hold_skb(struct sk_buff *skb)
 {
        if (audit_default &&
-           skb_queue_len(&audit_skb_hold_queue) < audit_backlog_limit)
+           (!audit_backlog_limit ||
+            skb_queue_len(&audit_skb_hold_queue) < audit_backlog_limit))
                skb_queue_tail(&audit_skb_hold_queue, skb);
        else
                kfree_skb(skb);
@@ -382,7 +394,7 @@ static void audit_printk_skb(struct sk_buff *skb)
 
        if (nlh->nlmsg_type != AUDIT_EOE) {
                if (printk_ratelimit())
-                       printk(KERN_NOTICE "type=%d %s\n", nlh->nlmsg_type, data);
+                       pr_notice("type=%d %s\n", nlh->nlmsg_type, data);
                else
                        audit_log_lost("printk limit exceeded\n");
        }
@@ -398,9 +410,12 @@ static void kauditd_send_skb(struct sk_buff *skb)
        err = netlink_unicast(audit_sock, skb, audit_nlk_portid, 0);
        if (err < 0) {
                BUG_ON(err != -ECONNREFUSED); /* Shouldn't happen */
-               printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid);
-               audit_log_lost("auditd disappeared\n");
-               audit_pid = 0;
+               if (audit_pid) {
+                       pr_err("*NO* daemon at audit_pid=%d\n", audit_pid);
+                       audit_log_lost("auditd disappeared\n");
+                       audit_pid = 0;
+                       audit_sock = NULL;
+               }
                /* we might get lucky and get this in the next auditd */
                audit_hold_skb(skb);
        } else
@@ -457,8 +472,10 @@ static int kauditd_thread(void *dummy)
                flush_hold_queue();
 
                skb = skb_dequeue(&audit_skb_queue);
-               wake_up(&audit_backlog_wait);
+
                if (skb) {
+                       if (skb_queue_len(&audit_skb_queue) <= audit_backlog_limit)
+                               wake_up(&audit_backlog_wait);
                        if (audit_pid)
                                kauditd_send_skb(skb);
                        else
@@ -482,22 +499,23 @@ static int kauditd_thread(void *dummy)
 int audit_send_list(void *_dest)
 {
        struct audit_netlink_list *dest = _dest;
-       int pid = dest->pid;
        struct sk_buff *skb;
+       struct net *net = get_net_ns_by_pid(dest->pid);
+       struct audit_net *aunet = net_generic(net, audit_net_id);
 
        /* wait for parent to finish and send an ACK */
        mutex_lock(&audit_cmd_mutex);
        mutex_unlock(&audit_cmd_mutex);
 
        while ((skb = __skb_dequeue(&dest->q)) != NULL)
-               netlink_unicast(audit_sock, skb, pid, 0);
+               netlink_unicast(aunet->nlsk, skb, dest->portid, 0);
 
        kfree(dest);
 
        return 0;
 }
 
-struct sk_buff *audit_make_reply(int pid, int seq, int type, int done,
+struct sk_buff *audit_make_reply(__u32 portid, int seq, int type, int done,
                                 int multi, const void *payload, int size)
 {
        struct sk_buff  *skb;
@@ -510,7 +528,7 @@ struct sk_buff *audit_make_reply(int pid, int seq, int type, int done,
        if (!skb)
                return NULL;
 
-       nlh     = nlmsg_put(skb, pid, seq, t, size, flags);
+       nlh     = nlmsg_put(skb, portid, seq, t, size, flags);
        if (!nlh)
                goto out_kfree_skb;
        data = nlmsg_data(nlh);
@@ -525,19 +543,21 @@ out_kfree_skb:
 static int audit_send_reply_thread(void *arg)
 {
        struct audit_reply *reply = (struct audit_reply *)arg;
+       struct net *net = get_net_ns_by_pid(reply->pid);
+       struct audit_net *aunet = net_generic(net, audit_net_id);
 
        mutex_lock(&audit_cmd_mutex);
        mutex_unlock(&audit_cmd_mutex);
 
        /* Ignore failure. It'll only happen if the sender goes away,
           because our timeout is set to infinite. */
-       netlink_unicast(audit_sock, reply->skb, reply->pid, 0);
+       netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0);
        kfree(reply);
        return 0;
 }
 /**
  * audit_send_reply - send an audit reply message via netlink
- * @pid: process id to send reply to
+ * @portid: netlink port to which to send reply
  * @seq: sequence number
  * @type: audit message type
  * @done: done (last) flag
@@ -545,11 +565,11 @@ static int audit_send_reply_thread(void *arg)
  * @payload: payload data
  * @size: payload size
  *
- * Allocates an skb, builds the netlink message, and sends it to the pid.
+ * Allocates an skb, builds the netlink message, and sends it to the port id.
  * No failure notifications.
  */
-static void audit_send_reply(int pid, int seq, int type, int done, int multi,
-                            const void *payload, int size)
+static void audit_send_reply(__u32 portid, int seq, int type, int done,
+                            int multi, const void *payload, int size)
 {
        struct sk_buff *skb;
        struct task_struct *tsk;
@@ -559,11 +579,12 @@ static void audit_send_reply(int pid, int seq, int type, int done, int multi,
        if (!reply)
                return;
 
-       skb = audit_make_reply(pid, seq, type, done, multi, payload, size);
+       skb = audit_make_reply(portid, seq, type, done, multi, payload, size);
        if (!skb)
                goto out;
 
-       reply->pid = pid;
+       reply->portid = portid;
+       reply->pid = task_pid_vnr(current);
        reply->skb = skb;
 
        tsk = kthread_run(audit_send_reply_thread, reply, "audit_send_reply");
@@ -663,8 +684,12 @@ static void audit_log_feature_change(int which, u32 old_feature, u32 new_feature
 {
        struct audit_buffer *ab;
 
+       if (audit_enabled == AUDIT_OFF)
+               return;
+
        ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_FEATURE_CHANGE);
-       audit_log_format(ab, "feature=%s new=%d old=%d old_lock=%d new_lock=%d res=%d",
+       audit_log_task_info(ab, current);
+       audit_log_format(ab, "feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d",
                         audit_feature_names[which], !!old_feature, !!new_feature,
                         !!old_lock, !!new_lock, res);
        audit_log_end(ab);
@@ -694,7 +719,7 @@ static int audit_set_feature(struct sk_buff *skb)
                old_lock = af.lock & feature;
 
                /* are we changing a locked feature? */
-               if ((af.lock & feature) && (new_feature != old_feature)) {
+               if (old_lock && (new_feature != old_feature)) {
                        audit_log_feature_change(i, old_feature, new_feature,
                                                 old_lock, new_lock, 0);
                        return -EPERM;
@@ -732,7 +757,6 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 {
        u32                     seq;
        void                    *data;
-       struct audit_status     *status_get, status_set;
        int                     err;
        struct audit_buffer     *ab;
        u16                     msg_type = nlh->nlmsg_type;
@@ -758,48 +782,70 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
        data = nlmsg_data(nlh);
 
        switch (msg_type) {
-       case AUDIT_GET:
-               memset(&status_set, 0, sizeof(status_set));
-               status_set.enabled       = audit_enabled;
-               status_set.failure       = audit_failure;
-               status_set.pid           = audit_pid;
-               status_set.rate_limit    = audit_rate_limit;
-               status_set.backlog_limit = audit_backlog_limit;
-               status_set.lost          = atomic_read(&audit_lost);
-               status_set.backlog       = skb_queue_len(&audit_skb_queue);
+       case AUDIT_GET: {
+               struct audit_status     s;
+               memset(&s, 0, sizeof(s));
+               s.enabled               = audit_enabled;
+               s.failure               = audit_failure;
+               s.pid                   = audit_pid;
+               s.rate_limit            = audit_rate_limit;
+               s.backlog_limit         = audit_backlog_limit;
+               s.lost                  = atomic_read(&audit_lost);
+               s.backlog               = skb_queue_len(&audit_skb_queue);
+               s.version               = AUDIT_VERSION_LATEST;
+               s.backlog_wait_time     = audit_backlog_wait_time;
                audit_send_reply(NETLINK_CB(skb).portid, seq, AUDIT_GET, 0, 0,
-                                &status_set, sizeof(status_set));
+                                &s, sizeof(s));
                break;
-       case AUDIT_SET:
-               if (nlmsg_len(nlh) < sizeof(struct audit_status))
-                       return -EINVAL;
-               status_get   = (struct audit_status *)data;
-               if (status_get->mask & AUDIT_STATUS_ENABLED) {
-                       err = audit_set_enabled(status_get->enabled);
+       }
+       case AUDIT_SET: {
+               struct audit_status     s;
+               memset(&s, 0, sizeof(s));
+               /* guard against past and future API changes */
+               memcpy(&s, data, min_t(size_t, sizeof(s), nlmsg_len(nlh)));
+               if (s.mask & AUDIT_STATUS_ENABLED) {
+                       err = audit_set_enabled(s.enabled);
                        if (err < 0)
                                return err;
                }
-               if (status_get->mask & AUDIT_STATUS_FAILURE) {
-                       err = audit_set_failure(status_get->failure);
+               if (s.mask & AUDIT_STATUS_FAILURE) {
+                       err = audit_set_failure(s.failure);
                        if (err < 0)
                                return err;
                }
-               if (status_get->mask & AUDIT_STATUS_PID) {
-                       int new_pid = status_get->pid;
+               if (s.mask & AUDIT_STATUS_PID) {
+                       int new_pid = s.pid;
 
+                       if ((!new_pid) && (task_tgid_vnr(current) != audit_pid))
+                               return -EACCES;
                        if (audit_enabled != AUDIT_OFF)
                                audit_log_config_change("audit_pid", new_pid, audit_pid, 1);
                        audit_pid = new_pid;
                        audit_nlk_portid = NETLINK_CB(skb).portid;
+                       audit_sock = skb->sk;
                }
-               if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) {
-                       err = audit_set_rate_limit(status_get->rate_limit);
+               if (s.mask & AUDIT_STATUS_RATE_LIMIT) {
+                       err = audit_set_rate_limit(s.rate_limit);
+                       if (err < 0)
+                               return err;
+               }
+               if (s.mask & AUDIT_STATUS_BACKLOG_LIMIT) {
+                       err = audit_set_backlog_limit(s.backlog_limit);
+                       if (err < 0)
+                               return err;
+               }
+               if (s.mask & AUDIT_STATUS_BACKLOG_WAIT_TIME) {
+                       if (sizeof(s) > (size_t)nlh->nlmsg_len)
+                               return -EINVAL;
+                       if (s.backlog_wait_time < 0 ||
+                           s.backlog_wait_time > 10*AUDIT_BACKLOG_WAIT_TIME)
+                               return -EINVAL;
+                       err = audit_set_backlog_wait_time(s.backlog_wait_time);
                        if (err < 0)
                                return err;
                }
-               if (status_get->mask & AUDIT_STATUS_BACKLOG_LIMIT)
-                       err = audit_set_backlog_limit(status_get->backlog_limit);
                break;
+       }
        case AUDIT_GET_FEATURE:
                err = audit_get_feature(skb);
                if (err)
@@ -817,13 +863,14 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                        return 0;
 
                err = audit_filter_user(msg_type);
-               if (err == 1) {
+               if (err == 1) { /* match or error */
                        err = 0;
                        if (msg_type == AUDIT_USER_TTY) {
                                err = tty_audit_push_current();
                                if (err)
                                        break;
                        }
+                       mutex_unlock(&audit_cmd_mutex);
                        audit_log_common_recv_msg(&ab, msg_type);
                        if (msg_type != AUDIT_USER_TTY)
                                audit_log_format(ab, " msg='%.*s'",
@@ -839,8 +886,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                                        size--;
                                audit_log_n_untrustedstring(ab, data, size);
                        }
-                       audit_set_pid(ab, NETLINK_CB(skb).portid);
+                       audit_set_portid(ab, NETLINK_CB(skb).portid);
                        audit_log_end(ab);
+                       mutex_lock(&audit_cmd_mutex);
                }
                break;
        case AUDIT_ADD_RULE:
@@ -853,11 +901,12 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                        audit_log_end(ab);
                        return -EPERM;
                }
-               /* fallthrough */
-       case AUDIT_LIST_RULES:
-               err = audit_receive_filter(msg_type, NETLINK_CB(skb).portid,
+               err = audit_rule_change(msg_type, NETLINK_CB(skb).portid,
                                           seq, data, nlmsg_len(nlh));
                break;
+       case AUDIT_LIST_RULES:
+               err = audit_list_rules_send(NETLINK_CB(skb).portid, seq);
+               break;
        case AUDIT_TRIM:
                audit_trim_trees();
                audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE);
@@ -939,20 +988,33 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
                break;
        }
        case AUDIT_TTY_SET: {
-               struct audit_tty_status s;
+               struct audit_tty_status s, old;
                struct task_struct *tsk = current;
+               struct audit_buffer     *ab;
 
                memset(&s, 0, sizeof(s));
                /* guard against past and future API changes */
                memcpy(&s, data, min_t(size_t, sizeof(s), nlmsg_len(nlh)));
+               /* check if new data is valid */
                if ((s.enabled != 0 && s.enabled != 1) ||
                    (s.log_passwd != 0 && s.log_passwd != 1))
-                       return -EINVAL;
+                       err = -EINVAL;
 
                spin_lock(&tsk->sighand->siglock);
-               tsk->signal->audit_tty = s.enabled;
-               tsk->signal->audit_tty_log_passwd = s.log_passwd;
+               old.enabled = tsk->signal->audit_tty;
+               old.log_passwd = tsk->signal->audit_tty_log_passwd;
+               if (!err) {
+                       tsk->signal->audit_tty = s.enabled;
+                       tsk->signal->audit_tty_log_passwd = s.log_passwd;
+               }
                spin_unlock(&tsk->sighand->siglock);
+
+               audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE);
+               audit_log_format(ab, " op=tty_set old-enabled=%d new-enabled=%d"
+                                " old-log_passwd=%d new-log_passwd=%d res=%d",
+                                old.enabled, s.enabled, old.log_passwd,
+                                s.log_passwd, !err);
+               audit_log_end(ab);
                break;
        }
        default:
@@ -998,24 +1060,55 @@ static void audit_receive(struct sk_buff  *skb)
        mutex_unlock(&audit_cmd_mutex);
 }
 
-/* Initialize audit support at boot time. */
-static int __init audit_init(void)
+static int __net_init audit_net_init(struct net *net)
 {
-       int i;
        struct netlink_kernel_cfg cfg = {
                .input  = audit_receive,
        };
 
+       struct audit_net *aunet = net_generic(net, audit_net_id);
+
+       aunet->nlsk = netlink_kernel_create(net, NETLINK_AUDIT, &cfg);
+       if (aunet->nlsk == NULL) {
+               audit_panic("cannot initialize netlink socket in namespace");
+               return -ENOMEM;
+       }
+       aunet->nlsk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
+       return 0;
+}
+
+static void __net_exit audit_net_exit(struct net *net)
+{
+       struct audit_net *aunet = net_generic(net, audit_net_id);
+       struct sock *sock = aunet->nlsk;
+       if (sock == audit_sock) {
+               audit_pid = 0;
+               audit_sock = NULL;
+       }
+
+       rcu_assign_pointer(aunet->nlsk, NULL);
+       synchronize_net();
+       netlink_kernel_release(sock);
+}
+
+static struct pernet_operations audit_net_ops __net_initdata = {
+       .init = audit_net_init,
+       .exit = audit_net_exit,
+       .id = &audit_net_id,
+       .size = sizeof(struct audit_net),
+};
+
+/* Initialize audit support at boot time. */
+static int __init audit_init(void)
+{
+       int i;
+
        if (audit_initialized == AUDIT_DISABLED)
                return 0;
 
-       printk(KERN_INFO "audit: initializing netlink socket (%s)\n",
-              audit_default ? "enabled" : "disabled");
-       audit_sock = netlink_kernel_create(&init_net, NETLINK_AUDIT, &cfg);
-       if (!audit_sock)
-               audit_panic("cannot initialize netlink socket");
-       else
-               audit_sock->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
+       pr_info("initializing netlink subsys (%s)\n",
+               audit_default ? "enabled" : "disabled");
+       register_pernet_subsys(&audit_net_ops);
 
        skb_queue_head_init(&audit_skb_queue);
        skb_queue_head_init(&audit_skb_hold_queue);
@@ -1039,22 +1132,32 @@ static int __init audit_enable(char *str)
        if (!audit_default)
                audit_initialized = AUDIT_DISABLED;
 
-       printk(KERN_INFO "audit: %s", audit_default ? "enabled" : "disabled");
+       pr_info("%s\n", audit_default ?
+               "enabled (after initialization)" : "disabled (until reboot)");
 
-       if (audit_initialized == AUDIT_INITIALIZED) {
-               audit_enabled = audit_default;
-               audit_ever_enabled |= !!audit_default;
-       } else if (audit_initialized == AUDIT_UNINITIALIZED) {
-               printk(" (after initialization)");
-       } else {
-               printk(" (until reboot)");
+       return 1;
+}
+__setup("audit=", audit_enable);
+
+/* Process kernel command-line parameter at boot time.
+ * audit_backlog_limit=<n> */
+static int __init audit_backlog_limit_set(char *str)
+{
+       u32 audit_backlog_limit_arg;
+
+       pr_info("audit_backlog_limit: ");
+       if (kstrtouint(str, 0, &audit_backlog_limit_arg)) {
+               pr_cont("using default of %u, unable to parse %s\n",
+                       audit_backlog_limit, str);
+               return 1;
        }
-       printk("\n");
+
+       audit_backlog_limit = audit_backlog_limit_arg;
+       pr_cont("%d\n", audit_backlog_limit);
 
        return 1;
 }
-
-__setup("audit=", audit_enable);
+__setup("audit_backlog_limit=", audit_backlog_limit_set);
 
 static void audit_buffer_free(struct audit_buffer *ab)
 {
@@ -1165,18 +1268,20 @@ static inline void audit_get_stamp(struct audit_context *ctx,
 /*
  * Wait for auditd to drain the queue a little
  */
-static void wait_for_auditd(unsigned long sleep_time)
+static long wait_for_auditd(long sleep_time)
 {
        DECLARE_WAITQUEUE(wait, current);
        set_current_state(TASK_UNINTERRUPTIBLE);
-       add_wait_queue(&audit_backlog_wait, &wait);
+       add_wait_queue_exclusive(&audit_backlog_wait, &wait);
 
        if (audit_backlog_limit &&
            skb_queue_len(&audit_skb_queue) > audit_backlog_limit)
-               schedule_timeout(sleep_time);
+               sleep_time = schedule_timeout(sleep_time);
 
        __set_current_state(TASK_RUNNING);
        remove_wait_queue(&audit_backlog_wait, &wait);
+
+       return sleep_time;
 }
 
 /**
@@ -1200,7 +1305,8 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
        struct audit_buffer     *ab     = NULL;
        struct timespec         t;
        unsigned int            uninitialized_var(serial);
-       int reserve;
+       int reserve = 5; /* Allow atomic callers to go up to five
+                           entries over the normal backlog limit */
        unsigned long timeout_start = jiffies;
 
        if (audit_initialized != AUDIT_INITIALIZED)
@@ -1209,36 +1315,37 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
        if (unlikely(audit_filter_type(type)))
                return NULL;
 
-       if (gfp_mask & __GFP_WAIT)
-               reserve = 0;
-       else
-               reserve = 5; /* Allow atomic callers to go up to five
-                               entries over the normal backlog limit */
+       if (gfp_mask & __GFP_WAIT) {
+               if (audit_pid && audit_pid == current->pid)
+                       gfp_mask &= ~__GFP_WAIT;
+               else
+                       reserve = 0;
+       }
 
        while (audit_backlog_limit
               && skb_queue_len(&audit_skb_queue) > audit_backlog_limit + reserve) {
                if (gfp_mask & __GFP_WAIT && audit_backlog_wait_time) {
-                       unsigned long sleep_time;
+                       long sleep_time;
 
-                       sleep_time = timeout_start + audit_backlog_wait_time -
-                                       jiffies;
-                       if ((long)sleep_time > 0) {
-                               wait_for_auditd(sleep_time);
-                               continue;
+                       sleep_time = timeout_start + audit_backlog_wait_time - jiffies;
+                       if (sleep_time > 0) {
+                               sleep_time = wait_for_auditd(sleep_time);
+                               if (sleep_time > 0)
+                                       continue;
                        }
                }
                if (audit_rate_check() && printk_ratelimit())
-                       printk(KERN_WARNING
-                              "audit: audit_backlog=%d > "
-                              "audit_backlog_limit=%d\n",
-                              skb_queue_len(&audit_skb_queue),
-                              audit_backlog_limit);
+                       pr_warn("audit_backlog=%d > audit_backlog_limit=%d\n",
+                               skb_queue_len(&audit_skb_queue),
+                               audit_backlog_limit);
                audit_log_lost("backlog limit exceeded");
                audit_backlog_wait_time = audit_backlog_wait_overflow;
                wake_up(&audit_backlog_wait);
                return NULL;
        }
 
+       audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME;
+
        ab = audit_buffer_alloc(ctx, gfp_mask, type);
        if (!ab) {
                audit_log_lost("out of memory in audit_log_start");
@@ -1356,7 +1463,6 @@ void audit_log_n_hex(struct audit_buffer *ab, const unsigned char *buf,
        int i, avail, new_len;
        unsigned char *ptr;
        struct sk_buff *skb;
-       static const unsigned char *hex = "0123456789ABCDEF";
 
        if (!ab)
                return;
@@ -1374,10 +1480,8 @@ void audit_log_n_hex(struct audit_buffer *ab, const unsigned char *buf,
        }
 
        ptr = skb_tail_pointer(skb);
-       for (i=0; i<len; i++) {
-               *ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */
-               *ptr++ = hex[buf[i] & 0x0F];      /* Lower nibble */
-       }
+       for (i = 0; i < len; i++)
+               ptr = hex_byte_pack_upper(ptr, buf[i]);
        *ptr = 0;
        skb_put(skb, len << 1); /* new string is twice the old string */
 }
@@ -1491,7 +1595,7 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix,
 
 void audit_log_session_info(struct audit_buffer *ab)
 {
-       u32 sessionid = audit_get_sessionid(current);
+       unsigned int sessionid = audit_get_sessionid(current);
        uid_t auid = from_kuid(&init_user_ns, audit_get_loginuid(current));
 
        audit_log_format(ab, " auid=%u ses=%u", auid, sessionid);
@@ -1716,7 +1820,7 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
        audit_log_format(ab,
                         " ppid=%ld pid=%d auid=%u uid=%u gid=%u"
                         " euid=%u suid=%u fsuid=%u"
-                        " egid=%u sgid=%u fsgid=%u ses=%u tty=%s",
+                        " egid=%u sgid=%u fsgid=%u tty=%s ses=%u",
                         sys_getppid(),
                         tsk->pid,
                         from_kuid(&init_user_ns, audit_get_loginuid(tsk)),
@@ -1728,7 +1832,7 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
                         from_kgid(&init_user_ns, cred->egid),
                         from_kgid(&init_user_ns, cred->sgid),
                         from_kgid(&init_user_ns, cred->fsgid),
-                        audit_get_sessionid(tsk), tty);
+                        tty, audit_get_sessionid(tsk));
 
        get_task_comm(name, tsk);
        audit_log_format(ab, " comm=");
@@ -1739,7 +1843,8 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
                if (mm->exe_file)
                        audit_log_d_path(ab, " exe=", &mm->exe_file->f_path);
                up_read(&mm->mmap_sem);
-       }
+       } else
+               audit_log_format(ab, " exe=(null)");
        audit_log_task_context(ab);
 }
 EXPORT_SYMBOL(audit_log_task_info);
index b779642b29af9401fd15246816c376ec86e4fcab..57cc64d67718903eebeab175030348df648b4f17 100644 (file)
@@ -209,7 +209,7 @@ struct audit_context {
 #endif
 };
 
-extern int audit_ever_enabled;
+extern u32 audit_ever_enabled;
 
 extern void audit_copy_inode(struct audit_names *name,
                             const struct dentry *dentry,
@@ -240,18 +240,23 @@ extern int audit_uid_comparator(kuid_t left, u32 op, kuid_t right);
 extern int audit_gid_comparator(kgid_t left, u32 op, kgid_t right);
 extern int parent_len(const char *path);
 extern int audit_compare_dname_path(const char *dname, const char *path, int plen);
-extern struct sk_buff *            audit_make_reply(int pid, int seq, int type,
-                                            int done, int multi,
-                                            const void *payload, int size);
+extern struct sk_buff *audit_make_reply(__u32 portid, int seq, int type,
+                                       int done, int multi,
+                                       const void *payload, int size);
 extern void                audit_panic(const char *message);
 
 struct audit_netlink_list {
-       int pid;
+       __u32 portid;
+       pid_t pid;
        struct sk_buff_head q;
 };
 
 int audit_send_list(void *);
 
+struct audit_net {
+       struct sock *nlsk;
+};
+
 extern int selinux_audit_rule_update(void);
 
 extern struct mutex audit_filter_mutex;
index 51f3fd4c1ed3a71dd1b8cd95e6645221150f5047..14a78cca384edb9cf8f36dc3f7fb5340c267c623 100644 (file)
@@ -972,7 +972,7 @@ out:
 }
 
 /* List rules using struct audit_rule_data. */
-static void audit_list_rules(int pid, int seq, struct sk_buff_head *q)
+static void audit_list_rules(__u32 portid, int seq, struct sk_buff_head *q)
 {
        struct sk_buff *skb;
        struct audit_krule *r;
@@ -987,14 +987,15 @@ static void audit_list_rules(int pid, int seq, struct sk_buff_head *q)
                        data = audit_krule_to_data(r);
                        if (unlikely(!data))
                                break;
-                       skb = audit_make_reply(pid, seq, AUDIT_LIST_RULES, 0, 1,
-                                        data, sizeof(*data) + data->buflen);
+                       skb = audit_make_reply(portid, seq, AUDIT_LIST_RULES,
+                                              0, 1, data,
+                                              sizeof(*data) + data->buflen);
                        if (skb)
                                skb_queue_tail(q, skb);
                        kfree(data);
                }
        }
-       skb = audit_make_reply(pid, seq, AUDIT_LIST_RULES, 1, 1, NULL, 0);
+       skb = audit_make_reply(portid, seq, AUDIT_LIST_RULES, 1, 1, NULL, 0);
        if (skb)
                skb_queue_tail(q, skb);
 }
@@ -1004,7 +1005,7 @@ static void audit_log_rule_change(char *action, struct audit_krule *rule, int re
 {
        struct audit_buffer *ab;
        uid_t loginuid = from_kuid(&init_user_ns, audit_get_loginuid(current));
-       u32 sessionid = audit_get_sessionid(current);
+       unsigned int sessionid = audit_get_sessionid(current);
 
        if (!audit_enabled)
                return;
@@ -1022,45 +1023,20 @@ static void audit_log_rule_change(char *action, struct audit_krule *rule, int re
 }
 
 /**
- * audit_receive_filter - apply all rules to the specified message type
+ * audit_rule_change - apply all rules to the specified message type
  * @type: audit message type
- * @pid: target pid for netlink audit messages
+ * @portid: target port id for netlink audit messages
  * @seq: netlink audit message sequence (serial) number
  * @data: payload data
  * @datasz: size of payload data
  */
-int audit_receive_filter(int type, int pid, int seq, void *data, size_t datasz)
+int audit_rule_change(int type, __u32 portid, int seq, void *data,
+                       size_t datasz)
 {
-       struct task_struct *tsk;
-       struct audit_netlink_list *dest;
        int err = 0;
        struct audit_entry *entry;
 
        switch (type) {
-       case AUDIT_LIST_RULES:
-               /* We can't just spew out the rules here because we might fill
-                * the available socket buffer space and deadlock waiting for
-                * auditctl to read from it... which isn't ever going to
-                * happen if we're actually running in the context of auditctl
-                * trying to _send_ the stuff */
-
-               dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL);
-               if (!dest)
-                       return -ENOMEM;
-               dest->pid = pid;
-               skb_queue_head_init(&dest->q);
-
-               mutex_lock(&audit_filter_mutex);
-               audit_list_rules(pid, seq, &dest->q);
-               mutex_unlock(&audit_filter_mutex);
-
-               tsk = kthread_run(audit_send_list, dest, "audit_send_list");
-               if (IS_ERR(tsk)) {
-                       skb_queue_purge(&dest->q);
-                       kfree(dest);
-                       err = PTR_ERR(tsk);
-               }
-               break;
        case AUDIT_ADD_RULE:
                entry = audit_data_to_entry(data, datasz);
                if (IS_ERR(entry))
@@ -1087,6 +1063,44 @@ int audit_receive_filter(int type, int pid, int seq, void *data, size_t datasz)
        return err;
 }
 
+/**
+ * audit_list_rules_send - list the audit rules
+ * @portid: target portid for netlink audit messages
+ * @seq: netlink audit message sequence (serial) number
+ */
+int audit_list_rules_send(__u32 portid, int seq)
+{
+       struct task_struct *tsk;
+       struct audit_netlink_list *dest;
+       int err = 0;
+
+       /* We can't just spew out the rules here because we might fill
+        * the available socket buffer space and deadlock waiting for
+        * auditctl to read from it... which isn't ever going to
+        * happen if we're actually running in the context of auditctl
+        * trying to _send_ the stuff */
+
+       dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL);
+       if (!dest)
+               return -ENOMEM;
+       dest->portid = portid;
+       dest->pid = task_pid_vnr(current);
+       skb_queue_head_init(&dest->q);
+
+       mutex_lock(&audit_filter_mutex);
+       audit_list_rules(portid, seq, &dest->q);
+       mutex_unlock(&audit_filter_mutex);
+
+       tsk = kthread_run(audit_send_list, dest, "audit_send_list");
+       if (IS_ERR(tsk)) {
+               skb_queue_purge(&dest->q);
+               kfree(dest);
+               err = PTR_ERR(tsk);
+       }
+
+       return err;
+}
+
 int audit_comparator(u32 left, u32 op, u32 right)
 {
        switch (op) {
@@ -1276,19 +1290,22 @@ int audit_filter_user(int type)
 {
        enum audit_state state = AUDIT_DISABLED;
        struct audit_entry *e;
-       int ret = 1;
+       int rc, ret;
+
+       ret = 1; /* Audit by default */
 
        rcu_read_lock();
        list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_USER], list) {
-               if (audit_filter_user_rules(&e->rule, type, &state)) {
-                       if (state == AUDIT_DISABLED)
+               rc = audit_filter_user_rules(&e->rule, type, &state);
+               if (rc) {
+                       if (rc > 0 && state == AUDIT_DISABLED)
                                ret = 0;
                        break;
                }
        }
        rcu_read_unlock();
 
-       return ret; /* Audit by default */
+       return ret;
 }
 
 int audit_filter_type(int type)
index 90594c9f755213232e5282899c8547cd5c61c823..10176cd5956a7ccd9c3f34093bca928a0f5b0323 100644 (file)
@@ -1969,18 +1969,24 @@ static void audit_log_set_loginuid(kuid_t koldloginuid, kuid_t kloginuid,
                                   int rc)
 {
        struct audit_buffer *ab;
-       uid_t uid, ologinuid, nloginuid;
+       uid_t uid, oldloginuid, loginuid;
+
+       if (!audit_enabled)
+               return;
 
        uid = from_kuid(&init_user_ns, task_uid(current));
-       ologinuid = from_kuid(&init_user_ns, koldloginuid);
-       nloginuid = from_kuid(&init_user_ns, kloginuid),
+       oldloginuid = from_kuid(&init_user_ns, koldloginuid);
+       loginuid = from_kuid(&init_user_ns, kloginuid),
 
        ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_LOGIN);
        if (!ab)
                return;
-       audit_log_format(ab, "pid=%d uid=%u old auid=%u new auid=%u old "
-                        "ses=%u new ses=%u res=%d", current->pid, uid, ologinuid,
-                        nloginuid, oldsessionid, sessionid, !rc);
+       audit_log_format(ab, "pid=%d uid=%u"
+                        " old-auid=%u new-auid=%u old-ses=%u new-ses=%u"
+                        " res=%d",
+                        current->pid, uid,
+                        oldloginuid, loginuid, oldsessionid, sessionid,
+                        !rc);
        audit_log_end(ab);
 }
 
@@ -2008,7 +2014,7 @@ int audit_set_loginuid(kuid_t loginuid)
 
        /* are we setting or clearing? */
        if (uid_valid(loginuid))
-               sessionid = atomic_inc_return(&session_id);
+               sessionid = (unsigned int)atomic_inc_return(&session_id);
 
        task->sessionid = sessionid;
        task->loginuid = loginuid;
@@ -2321,18 +2327,16 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
 
 /**
  * __audit_log_capset - store information about the arguments to the capset syscall
- * @pid: target pid of the capset call
  * @new: the new credentials
  * @old: the old (current) credentials
  *
  * Record the aguments userspace sent to sys_capset for later printing by the
  * audit system if applicable
  */
-void __audit_log_capset(pid_t pid,
-                      const struct cred *new, const struct cred *old)
+void __audit_log_capset(const struct cred *new, const struct cred *old)
 {
        struct audit_context *context = current->audit_context;
-       context->capset.pid = pid;
+       context->capset.pid = task_pid_nr(current);
        context->capset.cap.effective   = new->cap_effective;
        context->capset.cap.inheritable = new->cap_effective;
        context->capset.cap.permitted   = new->cap_permitted;
@@ -2352,6 +2356,7 @@ static void audit_log_task(struct audit_buffer *ab)
        kuid_t auid, uid;
        kgid_t gid;
        unsigned int sessionid;
+       struct mm_struct *mm = current->mm;
 
        auid = audit_get_loginuid(current);
        sessionid = audit_get_sessionid(current);
@@ -2365,15 +2370,15 @@ static void audit_log_task(struct audit_buffer *ab)
        audit_log_task_context(ab);
        audit_log_format(ab, " pid=%d comm=", current->pid);
        audit_log_untrustedstring(ab, current->comm);
+       if (mm) {
+               down_read(&mm->mmap_sem);
+               if (mm->exe_file)
+                       audit_log_d_path(ab, " exe=", &mm->exe_file->f_path);
+               up_read(&mm->mmap_sem);
+       } else
+               audit_log_format(ab, " exe=(null)");
 }
 
-static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr)
-{
-       audit_log_task(ab);
-       audit_log_format(ab, " reason=");
-       audit_log_string(ab, reason);
-       audit_log_format(ab, " sig=%ld", signr);
-}
 /**
  * audit_core_dumps - record information about processes that end abnormally
  * @signr: signal value
@@ -2394,7 +2399,8 @@ void audit_core_dumps(long signr)
        ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
        if (unlikely(!ab))
                return;
-       audit_log_abend(ab, "memory violation", signr);
+       audit_log_task(ab);
+       audit_log_format(ab, " sig=%ld", signr);
        audit_log_end(ab);
 }
 
index 4e66bf9275b03edf3c62e0e350afc5248f2b00b8..34019c57888d4d093956b81963b557abd95103e9 100644 (file)
@@ -277,7 +277,7 @@ SYSCALL_DEFINE2(capset, cap_user_header_t, header, const cap_user_data_t, data)
        if (ret < 0)
                goto error;
 
-       audit_log_capset(pid, new, current_cred());
+       audit_log_capset(new, current_cred());
 
        return commit_creds(new);
 
index 2abd25d79cc87bfc171f491c595d500e161f2de3..161402f0b517c9f483f166585bd61d61bac2e3f3 100644 (file)
@@ -112,7 +112,7 @@ int padata_do_parallel(struct padata_instance *pinst,
 
        rcu_read_lock_bh();
 
-       pd = rcu_dereference(pinst->pd);
+       pd = rcu_dereference_bh(pinst->pd);
 
        err = -EINVAL;
        if (!(pinst->flags & PADATA_INIT) || pinst->flags & PADATA_INVALID)
index 9a91f7431c411b706810a40bccc3167617c74aec..0d49945d0b9eed2910d39a3485c3ad0c79166d87 100644 (file)
@@ -2906,12 +2906,12 @@ static void xfrm_policy_fini(struct net *net)
        flush_work(&net->xfrm.policy_hash_work);
 #ifdef CONFIG_XFRM_SUB_POLICY
        audit_info.loginuid = INVALID_UID;
-       audit_info.sessionid = -1;
+       audit_info.sessionid = (unsigned int)-1;
        audit_info.secid = 0;
        xfrm_policy_flush(net, XFRM_POLICY_TYPE_SUB, &audit_info);
 #endif
        audit_info.loginuid = INVALID_UID;
-       audit_info.sessionid = -1;
+       audit_info.sessionid = (unsigned int)-1;
        audit_info.secid = 0;
        xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, &audit_info);
 
@@ -3017,7 +3017,7 @@ static void xfrm_audit_common_policyinfo(struct xfrm_policy *xp,
 }
 
 void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
-                          kuid_t auid, u32 sessionid, u32 secid)
+                          kuid_t auid, unsigned int sessionid, u32 secid)
 {
        struct audit_buffer *audit_buf;
 
@@ -3032,7 +3032,7 @@ void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
 EXPORT_SYMBOL_GPL(xfrm_audit_policy_add);
 
 void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
-                             kuid_t auid, u32 sessionid, u32 secid)
+                             kuid_t auid, unsigned int sessionid, u32 secid)
 {
        struct audit_buffer *audit_buf;
 
index 68c2f357a18389d9debc35401afe1295c4341959..8ed9d0dd45664ef2c414bbf2ea5f0f0a4bf71ef8 100644 (file)
@@ -2043,7 +2043,7 @@ void xfrm_state_fini(struct net *net)
 
        flush_work(&net->xfrm.state_hash_work);
        audit_info.loginuid = INVALID_UID;
-       audit_info.sessionid = -1;
+       audit_info.sessionid = (unsigned int)-1;
        audit_info.secid = 0;
        xfrm_state_flush(net, IPSEC_PROTO_ANY, &audit_info);
        flush_work(&net->xfrm.state_gc_work);
@@ -2109,7 +2109,7 @@ static void xfrm_audit_helper_pktinfo(struct sk_buff *skb, u16 family,
 }
 
 void xfrm_audit_state_add(struct xfrm_state *x, int result,
-                         kuid_t auid, u32 sessionid, u32 secid)
+                         kuid_t auid, unsigned int sessionid, u32 secid)
 {
        struct audit_buffer *audit_buf;
 
@@ -2124,7 +2124,7 @@ void xfrm_audit_state_add(struct xfrm_state *x, int result,
 EXPORT_SYMBOL_GPL(xfrm_audit_state_add);
 
 void xfrm_audit_state_delete(struct xfrm_state *x, int result,
-                            kuid_t auid, u32 sessionid, u32 secid)
+                            kuid_t auid, unsigned int sessionid, u32 secid)
 {
        struct audit_buffer *audit_buf;
 
index f964d4c00ffb53457aa46b24f0225249c1d46b7c..ec97e13743e6ec32ff7e2a9a77a7056ebb8874b8 100644 (file)
@@ -600,7 +600,7 @@ static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
        int err;
        struct km_event c;
        kuid_t loginuid = audit_get_loginuid(current);
-       u32 sessionid = audit_get_sessionid(current);
+       unsigned int sessionid = audit_get_sessionid(current);
        u32 sid;
 
        err = verify_newsa_info(p, attrs);
@@ -679,7 +679,7 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
        struct km_event c;
        struct xfrm_usersa_id *p = nlmsg_data(nlh);
        kuid_t loginuid = audit_get_loginuid(current);
-       u32 sessionid = audit_get_sessionid(current);
+       unsigned int sessionid = audit_get_sessionid(current);
        u32 sid;
 
        x = xfrm_user_state_lookup(net, p, attrs, &err);
@@ -1405,7 +1405,7 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
        int err;
        int excl;
        kuid_t loginuid = audit_get_loginuid(current);
-       u32 sessionid = audit_get_sessionid(current);
+       unsigned int sessionid = audit_get_sessionid(current);
        u32 sid;
 
        err = verify_newpolicy_info(p);
@@ -1663,7 +1663,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
                }
        } else {
                kuid_t loginuid = audit_get_loginuid(current);
-               u32 sessionid = audit_get_sessionid(current);
+               unsigned int sessionid = audit_get_sessionid(current);
                u32 sid;
 
                security_task_getsecid(current, &sid);
@@ -1959,7 +1959,7 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
        err = 0;
        if (up->hard) {
                kuid_t loginuid = audit_get_loginuid(current);
-               u32 sessionid = audit_get_sessionid(current);
+               unsigned int sessionid = audit_get_sessionid(current);
                u32 sid;
 
                security_task_getsecid(current, &sid);
@@ -2002,7 +2002,7 @@ static int xfrm_add_sa_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
 
        if (ue->hard) {
                kuid_t loginuid = audit_get_loginuid(current);
-               u32 sessionid = audit_get_sessionid(current);
+               unsigned int sessionid = audit_get_sessionid(current);
                u32 sid;
 
                security_task_getsecid(current, &sid);
index fc5a63a05a1ccfea8092f5a95fda162e6239787f..c93c21127f0cc5b6bc55c2930fdfe2441dc2a19c 100644 (file)
@@ -2948,25 +2948,21 @@ int selinux_audit_rule_match(u32 sid, u32 field, u32 op, void *vrule,
        struct selinux_audit_rule *rule = vrule;
        int match = 0;
 
-       if (!rule) {
-               audit_log(actx, GFP_ATOMIC, AUDIT_SELINUX_ERR,
-                         "selinux_audit_rule_match: missing rule\n");
+       if (unlikely(!rule)) {
+               WARN_ONCE(1, "selinux_audit_rule_match: missing rule\n");
                return -ENOENT;
        }
 
        read_lock(&policy_rwlock);
 
        if (rule->au_seqno < latest_granting) {
-               audit_log(actx, GFP_ATOMIC, AUDIT_SELINUX_ERR,
-                         "selinux_audit_rule_match: stale rule\n");
                match = -ESTALE;
                goto out;
        }
 
        ctxt = sidtab_search(&sidtab, sid);
-       if (!ctxt) {
-               audit_log(actx, GFP_ATOMIC, AUDIT_SELINUX_ERR,
-                         "selinux_audit_rule_match: unrecognized SID %d\n",
+       if (unlikely(!ctxt)) {
+               WARN_ONCE(1, "selinux_audit_rule_match: unrecognized SID %d\n",
                          sid);
                match = -ENOENT;
                goto out;
index d814e35987be93b9a643b630f681decd25d0af33..14f52be78c75e279f2bad288c66513a016a1ec3c 100644 (file)
@@ -3616,9 +3616,8 @@ static int smack_audit_rule_match(u32 secid, u32 field, u32 op, void *vrule,
        struct smack_known *skp;
        char *rule = vrule;
 
-       if (!rule) {
-               audit_log(actx, GFP_ATOMIC, AUDIT_SELINUX_ERR,
-                         "Smack: missing rule\n");
+       if (unlikely(!rule)) {
+               WARN_ONCE(1, "Smack: missing rule\n");
                return -ENOENT;
        }
 
index e48d38a1b95c6d6b13d3eef9bb09efed5d970964..e634eb78ed03be1c76e2782c1215fd84f208e4da 100644 (file)
@@ -25,7 +25,7 @@ config SND_ATMEL_SOC_SSC
 
 config SND_AT91_SOC_SAM9G20_WM8731
        tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board"
-       depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC && AT91_PROGRAMMABLE_CLOCKS
+       depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC
        select SND_ATMEL_SOC_PDC
        select SND_ATMEL_SOC_SSC
        select SND_SOC_WM8731
index 65a85f542521563627be1fe02b4c22c6bfdea194..9f9c1856f822588b60843765cb4e57ec1eef9176 100644 (file)
@@ -1,6 +1,8 @@
 config SND_SOC_TEGRA
        tristate "SoC Audio for the Tegra System-on-Chip"
        depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
+       depends on COMMON_CLK
+       depends on RESET_CONTROLLER
        select REGMAP_MMIO
        select SND_SOC_GENERIC_DMAENGINE_PCM
        help
index 088518d7694ae95d09ebf795d1dc7cdd33fc9a64..cf5e1cfe818d9b6a8c4f980e4d5c9f23dacbe2c6 100644 (file)
@@ -313,7 +313,6 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
 {
        struct tegra20_ac97 *ac97;
        struct resource *mem;
-       u32 of_dma[2];
        void __iomem *regs;
        int ret = 0;
 
@@ -348,14 +347,6 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
                goto err_clk_put;
        }
 
-       if (of_property_read_u32_array(pdev->dev.of_node,
-                                      "nvidia,dma-request-selector",
-                                      of_dma, 2) < 0) {
-               dev_err(&pdev->dev, "No DMA resource\n");
-               ret = -ENODEV;
-               goto err_clk_put;
-       }
-
        ac97->reset_gpio = of_get_named_gpio(pdev->dev.of_node,
                                             "nvidia,codec-reset-gpio", 0);
        if (gpio_is_valid(ac97->reset_gpio)) {
@@ -380,12 +371,10 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev)
        ac97->capture_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_RX1;
        ac97->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
        ac97->capture_dma_data.maxburst = 4;
-       ac97->capture_dma_data.slave_id = of_dma[1];
 
        ac97->playback_dma_data.addr = mem->start + TEGRA20_AC97_FIFO_TX1;
        ac97->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
        ac97->playback_dma_data.maxburst = 4;
-       ac97->playback_dma_data.slave_id = of_dma[1];
 
        ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev);
        if (ret)
index 8c819f8114708f7a94e33929a04ebecbdf3e2ffc..42c1f6bfaf2e5bb2a4f2df89269be672b26e377c 100644 (file)
@@ -339,9 +339,7 @@ static const struct regmap_config tegra20_i2s_regmap_config = {
 static int tegra20_i2s_platform_probe(struct platform_device *pdev)
 {
        struct tegra20_i2s *i2s;
-       struct resource *mem, *memregion, *dmareq;
-       u32 of_dma[2];
-       u32 dma_ch;
+       struct resource *mem, *memregion;
        void __iomem *regs;
        int ret;
 
@@ -370,20 +368,6 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev)
                goto err_clk_put;
        }
 
-       dmareq = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-       if (!dmareq) {
-               if (of_property_read_u32_array(pdev->dev.of_node,
-                                       "nvidia,dma-request-selector",
-                                       of_dma, 2) < 0) {
-                       dev_err(&pdev->dev, "No DMA resource\n");
-                       ret = -ENODEV;
-                       goto err_clk_put;
-               }
-               dma_ch = of_dma[1];
-       } else {
-               dma_ch = dmareq->start;
-       }
-
        memregion = devm_request_mem_region(&pdev->dev, mem->start,
                                            resource_size(mem), DRV_NAME);
        if (!memregion) {
@@ -410,12 +394,10 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev)
        i2s->capture_dma_data.addr = mem->start + TEGRA20_I2S_FIFO2;
        i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
        i2s->capture_dma_data.maxburst = 4;
-       i2s->capture_dma_data.slave_id = dma_ch;
 
        i2s->playback_dma_data.addr = mem->start + TEGRA20_I2S_FIFO1;
        i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
        i2s->playback_dma_data.maxburst = 4;
-       i2s->playback_dma_data.slave_id = dma_ch;
 
        pm_runtime_enable(&pdev->dev);
        if (!pm_runtime_enabled(&pdev->dev)) {
index 31154338c1eb742da6a1342310d81fddb1f9ecd4..d6f4c9940e0c64fee63b1e447ba11b40a5cfc2d1 100644 (file)
@@ -24,8 +24,8 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
+#include <linux/reset.h>
 #include <linux/slab.h>
-#include <linux/clk/tegra.h>
 #include <sound/soc.h>
 #include "tegra30_ahub.h"
 
@@ -95,8 +95,8 @@ static int tegra30_ahub_runtime_resume(struct device *dev)
 }
 
 int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
-                                 dma_addr_t *fiforeg,
-                                 unsigned int *reqsel)
+                                 char *dmachan, int dmachan_len,
+                                 dma_addr_t *fiforeg)
 {
        int channel;
        u32 reg, val;
@@ -110,9 +110,11 @@ int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
        __set_bit(channel, ahub->rx_usage);
 
        *rxcif = TEGRA30_AHUB_RXCIF_APBIF_RX0 + channel;
+       snprintf(dmachan, dmachan_len, "rx%d", channel);
        *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_RXFIFO +
                   (channel * TEGRA30_AHUB_CHANNEL_RXFIFO_STRIDE);
-       *reqsel = ahub->dma_sel + channel;
+
+       pm_runtime_get_sync(ahub->dev);
 
        reg = TEGRA30_AHUB_CHANNEL_CTRL +
              (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
@@ -140,6 +142,8 @@ int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
              (channel * TEGRA30_AHUB_CIF_RX_CTRL_STRIDE);
        ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf);
 
+       pm_runtime_put(ahub->dev);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(tegra30_ahub_allocate_rx_fifo);
@@ -149,12 +153,16 @@ int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif)
        int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0;
        int reg, val;
 
+       pm_runtime_get_sync(ahub->dev);
+
        reg = TEGRA30_AHUB_CHANNEL_CTRL +
              (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
        val = tegra30_apbif_read(reg);
        val |= TEGRA30_AHUB_CHANNEL_CTRL_RX_EN;
        tegra30_apbif_write(reg, val);
 
+       pm_runtime_put(ahub->dev);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(tegra30_ahub_enable_rx_fifo);
@@ -164,12 +172,16 @@ int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif)
        int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0;
        int reg, val;
 
+       pm_runtime_get_sync(ahub->dev);
+
        reg = TEGRA30_AHUB_CHANNEL_CTRL +
              (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
        val = tegra30_apbif_read(reg);
        val &= ~TEGRA30_AHUB_CHANNEL_CTRL_RX_EN;
        tegra30_apbif_write(reg, val);
 
+       pm_runtime_put(ahub->dev);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(tegra30_ahub_disable_rx_fifo);
@@ -185,8 +197,8 @@ int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif)
 EXPORT_SYMBOL_GPL(tegra30_ahub_free_rx_fifo);
 
 int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
-                                 dma_addr_t *fiforeg,
-                                 unsigned int *reqsel)
+                                 char *dmachan, int dmachan_len,
+                                 dma_addr_t *fiforeg)
 {
        int channel;
        u32 reg, val;
@@ -200,9 +212,11 @@ int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
        __set_bit(channel, ahub->tx_usage);
 
        *txcif = TEGRA30_AHUB_TXCIF_APBIF_TX0 + channel;
+       snprintf(dmachan, dmachan_len, "tx%d", channel);
        *fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_TXFIFO +
                   (channel * TEGRA30_AHUB_CHANNEL_TXFIFO_STRIDE);
-       *reqsel = ahub->dma_sel + channel;
+
+       pm_runtime_get_sync(ahub->dev);
 
        reg = TEGRA30_AHUB_CHANNEL_CTRL +
              (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
@@ -230,6 +244,8 @@ int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
              (channel * TEGRA30_AHUB_CIF_TX_CTRL_STRIDE);
        ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf);
 
+       pm_runtime_put(ahub->dev);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(tegra30_ahub_allocate_tx_fifo);
@@ -239,12 +255,16 @@ int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif)
        int channel = txcif - TEGRA30_AHUB_TXCIF_APBIF_TX0;
        int reg, val;
 
+       pm_runtime_get_sync(ahub->dev);
+
        reg = TEGRA30_AHUB_CHANNEL_CTRL +
              (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
        val = tegra30_apbif_read(reg);
        val |= TEGRA30_AHUB_CHANNEL_CTRL_TX_EN;
        tegra30_apbif_write(reg, val);
 
+       pm_runtime_put(ahub->dev);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(tegra30_ahub_enable_tx_fifo);
@@ -254,12 +274,16 @@ int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif)
        int channel = txcif - TEGRA30_AHUB_TXCIF_APBIF_TX0;
        int reg, val;
 
+       pm_runtime_get_sync(ahub->dev);
+
        reg = TEGRA30_AHUB_CHANNEL_CTRL +
              (channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
        val = tegra30_apbif_read(reg);
        val &= ~TEGRA30_AHUB_CHANNEL_CTRL_TX_EN;
        tegra30_apbif_write(reg, val);
 
+       pm_runtime_put(ahub->dev);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(tegra30_ahub_disable_tx_fifo);
@@ -280,10 +304,14 @@ int tegra30_ahub_set_rx_cif_source(enum tegra30_ahub_rxcif rxcif,
        int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0;
        int reg;
 
+       pm_runtime_get_sync(ahub->dev);
+
        reg = TEGRA30_AHUB_AUDIO_RX +
              (channel * TEGRA30_AHUB_AUDIO_RX_STRIDE);
        tegra30_audio_write(reg, 1 << txcif);
 
+       pm_runtime_put(ahub->dev);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(tegra30_ahub_set_rx_cif_source);
@@ -293,35 +321,51 @@ int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif)
        int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0;
        int reg;
 
+       pm_runtime_get_sync(ahub->dev);
+
        reg = TEGRA30_AHUB_AUDIO_RX +
              (channel * TEGRA30_AHUB_AUDIO_RX_STRIDE);
        tegra30_audio_write(reg, 0);
 
+       pm_runtime_put(ahub->dev);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source);
 
-#define CLK_LIST_MASK_TEGRA30  BIT(0)
-#define CLK_LIST_MASK_TEGRA114 BIT(1)
+#define MOD_LIST_MASK_TEGRA30  BIT(0)
+#define MOD_LIST_MASK_TEGRA114 BIT(1)
+#define MOD_LIST_MASK_TEGRA124 BIT(2)
 
-#define CLK_LIST_MASK_TEGRA30_OR_LATER \
-               (CLK_LIST_MASK_TEGRA30 | CLK_LIST_MASK_TEGRA114)
+#define MOD_LIST_MASK_TEGRA30_OR_LATER \
+               (MOD_LIST_MASK_TEGRA30 | MOD_LIST_MASK_TEGRA114 | \
+                       MOD_LIST_MASK_TEGRA124)
+#define MOD_LIST_MASK_TEGRA114_OR_LATER \
+               (MOD_LIST_MASK_TEGRA114 | MOD_LIST_MASK_TEGRA124)
 
 static const struct {
-       const char *clk_name;
-       u32 clk_list_mask;
-} configlink_clocks[] = {
-       { "i2s0", CLK_LIST_MASK_TEGRA30_OR_LATER },
-       { "i2s1", CLK_LIST_MASK_TEGRA30_OR_LATER },
-       { "i2s2", CLK_LIST_MASK_TEGRA30_OR_LATER },
-       { "i2s3", CLK_LIST_MASK_TEGRA30_OR_LATER },
-       { "i2s4", CLK_LIST_MASK_TEGRA30_OR_LATER },
-       { "dam0", CLK_LIST_MASK_TEGRA30_OR_LATER },
-       { "dam1", CLK_LIST_MASK_TEGRA30_OR_LATER },
-       { "dam2", CLK_LIST_MASK_TEGRA30_OR_LATER },
-       { "spdif_in", CLK_LIST_MASK_TEGRA30_OR_LATER },
-       { "amx", CLK_LIST_MASK_TEGRA114 },
-       { "adx", CLK_LIST_MASK_TEGRA114 },
+       const char *rst_name;
+       u32 mod_list_mask;
+} configlink_mods[] = {
+       { "i2s0", MOD_LIST_MASK_TEGRA30_OR_LATER },
+       { "i2s1", MOD_LIST_MASK_TEGRA30_OR_LATER },
+       { "i2s2", MOD_LIST_MASK_TEGRA30_OR_LATER },
+       { "i2s3", MOD_LIST_MASK_TEGRA30_OR_LATER },
+       { "i2s4", MOD_LIST_MASK_TEGRA30_OR_LATER },
+       { "dam0", MOD_LIST_MASK_TEGRA30_OR_LATER },
+       { "dam1", MOD_LIST_MASK_TEGRA30_OR_LATER },
+       { "dam2", MOD_LIST_MASK_TEGRA30_OR_LATER },
+       { "spdif", MOD_LIST_MASK_TEGRA30_OR_LATER },
+       { "amx", MOD_LIST_MASK_TEGRA114_OR_LATER },
+       { "adx", MOD_LIST_MASK_TEGRA114_OR_LATER },
+       { "amx1", MOD_LIST_MASK_TEGRA124 },
+       { "adx1", MOD_LIST_MASK_TEGRA124 },
+       { "afc0", MOD_LIST_MASK_TEGRA124 },
+       { "afc1", MOD_LIST_MASK_TEGRA124 },
+       { "afc2", MOD_LIST_MASK_TEGRA124 },
+       { "afc3", MOD_LIST_MASK_TEGRA124 },
+       { "afc4", MOD_LIST_MASK_TEGRA124 },
+       { "afc5", MOD_LIST_MASK_TEGRA124 },
 };
 
 #define LAST_REG(name) \
@@ -450,17 +494,17 @@ static const struct regmap_config tegra30_ahub_ahub_regmap_config = {
 };
 
 static struct tegra30_ahub_soc_data soc_data_tegra30 = {
-       .clk_list_mask = CLK_LIST_MASK_TEGRA30,
+       .mod_list_mask = MOD_LIST_MASK_TEGRA30,
        .set_audio_cif = tegra30_ahub_set_cif,
 };
 
 static struct tegra30_ahub_soc_data soc_data_tegra114 = {
-       .clk_list_mask = CLK_LIST_MASK_TEGRA114,
+       .mod_list_mask = MOD_LIST_MASK_TEGRA114,
        .set_audio_cif = tegra30_ahub_set_cif,
 };
 
 static struct tegra30_ahub_soc_data soc_data_tegra124 = {
-       .clk_list_mask = CLK_LIST_MASK_TEGRA114,
+       .mod_list_mask = MOD_LIST_MASK_TEGRA124,
        .set_audio_cif = tegra124_ahub_set_cif,
 };
 
@@ -475,10 +519,9 @@ static int tegra30_ahub_probe(struct platform_device *pdev)
 {
        const struct of_device_id *match;
        const struct tegra30_ahub_soc_data *soc_data;
-       struct clk *clk;
+       struct reset_control *rst;
        int i;
        struct resource *res0, *res1, *region;
-       u32 of_dma[2];
        void __iomem *regs_apbif, *regs_ahub;
        int ret = 0;
 
@@ -495,19 +538,24 @@ static int tegra30_ahub_probe(struct platform_device *pdev)
         * operate correctly, all devices on this bus must be out of reset.
         * Ensure that here.
         */
-       for (i = 0; i < ARRAY_SIZE(configlink_clocks); i++) {
-               if (!(configlink_clocks[i].clk_list_mask &
-                                       soc_data->clk_list_mask))
+       for (i = 0; i < ARRAY_SIZE(configlink_mods); i++) {
+               if (!(configlink_mods[i].mod_list_mask &
+                                       soc_data->mod_list_mask))
                        continue;
-               clk = clk_get(&pdev->dev, configlink_clocks[i].clk_name);
-               if (IS_ERR(clk)) {
-                       dev_err(&pdev->dev, "Can't get clock %s\n",
-                               configlink_clocks[i].clk_name);
-                       ret = PTR_ERR(clk);
+
+               rst = reset_control_get(&pdev->dev,
+                                       configlink_mods[i].rst_name);
+               if (IS_ERR(rst)) {
+                       dev_err(&pdev->dev, "Can't get reset %s\n",
+                               configlink_mods[i].rst_name);
+                       ret = PTR_ERR(rst);
                        goto err;
                }
-               tegra_periph_reset_deassert(clk);
-               clk_put(clk);
+
+               ret = reset_control_deassert(rst);
+               reset_control_put(rst);
+               if (ret)
+                       goto err;
        }
 
        ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub),
@@ -536,16 +584,6 @@ static int tegra30_ahub_probe(struct platform_device *pdev)
                goto err_clk_put_d_audio;
        }
 
-       if (of_property_read_u32_array(pdev->dev.of_node,
-                               "nvidia,dma-request-selector",
-                               of_dma, 2) < 0) {
-               dev_err(&pdev->dev,
-                       "Missing property nvidia,dma-request-selector\n");
-               ret = -ENODEV;
-               goto err_clk_put_d_audio;
-       }
-       ahub->dma_sel = of_dma[1];
-
        res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!res0) {
                dev_err(&pdev->dev, "No apbif memory resource\n");
index d67321d90faa1f5e828e0bca0a5ccc331539f47b..fd7ba75ed814733ccfcb7e1e837b9132b0329ffd 100644 (file)
@@ -465,15 +465,15 @@ enum tegra30_ahub_rxcif {
 };
 
 extern int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
-                                        dma_addr_t *fiforeg,
-                                        unsigned int *reqsel);
+                                        char *dmachan, int dmachan_len,
+                                        dma_addr_t *fiforeg);
 extern int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
 extern int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
 extern int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif);
 
 extern int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
-                                        dma_addr_t *fiforeg,
-                                        unsigned int *reqsel);
+                                        char *dmachan, int dmachan_len,
+                                        dma_addr_t *fiforeg);
 extern int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif);
 extern int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif);
 extern int tegra30_ahub_free_tx_fifo(enum tegra30_ahub_txcif txcif);
@@ -502,7 +502,7 @@ void tegra124_ahub_set_cif(struct regmap *regmap, unsigned int reg,
                           struct tegra30_ahub_cif_conf *conf);
 
 struct tegra30_ahub_soc_data {
-       u32 clk_list_mask;
+       u32 mod_list_mask;
        void (*set_audio_cif)(struct regmap *regmap,
                              unsigned int reg,
                              struct tegra30_ahub_cif_conf *conf);
@@ -524,7 +524,6 @@ struct tegra30_ahub {
        struct device *dev;
        struct clk *clk_d_audio;
        struct clk *clk_apbif;
-       int dma_sel;
        resource_size_t apbif_addr;
        struct regmap *regmap_apbif;
        struct regmap *regmap_ahub;
index 02247fee1cf7e1450fb4bbcdf2e58cf5ee76c7e8..49ad9366add86b008823f6091315d74d78f13aeb 100644 (file)
@@ -73,47 +73,6 @@ static int tegra30_i2s_runtime_resume(struct device *dev)
        return 0;
 }
 
-static int tegra30_i2s_startup(struct snd_pcm_substream *substream,
-                       struct snd_soc_dai *dai)
-{
-       struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai);
-       int ret;
-
-       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-               ret = tegra30_ahub_allocate_tx_fifo(&i2s->playback_fifo_cif,
-                                       &i2s->playback_dma_data.addr,
-                                       &i2s->playback_dma_data.slave_id);
-               i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
-               i2s->playback_dma_data.maxburst = 4;
-               tegra30_ahub_set_rx_cif_source(i2s->playback_i2s_cif,
-                                              i2s->playback_fifo_cif);
-       } else {
-               ret = tegra30_ahub_allocate_rx_fifo(&i2s->capture_fifo_cif,
-                                       &i2s->capture_dma_data.addr,
-                                       &i2s->capture_dma_data.slave_id);
-               i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
-               i2s->capture_dma_data.maxburst = 4;
-               tegra30_ahub_set_rx_cif_source(i2s->capture_fifo_cif,
-                                              i2s->capture_i2s_cif);
-       }
-
-       return ret;
-}
-
-static void tegra30_i2s_shutdown(struct snd_pcm_substream *substream,
-                       struct snd_soc_dai *dai)
-{
-       struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai);
-
-       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-               tegra30_ahub_unset_rx_cif_source(i2s->playback_i2s_cif);
-               tegra30_ahub_free_tx_fifo(i2s->playback_fifo_cif);
-       } else {
-               tegra30_ahub_unset_rx_cif_source(i2s->capture_fifo_cif);
-               tegra30_ahub_free_rx_fifo(i2s->capture_fifo_cif);
-       }
-}
-
 static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai,
                                unsigned int fmt)
 {
@@ -317,8 +276,6 @@ static int tegra30_i2s_probe(struct snd_soc_dai *dai)
 }
 
 static struct snd_soc_dai_ops tegra30_i2s_dai_ops = {
-       .startup        = tegra30_i2s_startup,
-       .shutdown       = tegra30_i2s_shutdown,
        .set_fmt        = tegra30_i2s_set_fmt,
        .hw_params      = tegra30_i2s_hw_params,
        .trigger        = tegra30_i2s_trigger,
@@ -499,15 +456,51 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev)
                        goto err_pm_disable;
        }
 
+       i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+       i2s->playback_dma_data.maxburst = 4;
+       ret = tegra30_ahub_allocate_tx_fifo(&i2s->playback_fifo_cif,
+                                           i2s->playback_dma_chan,
+                                           sizeof(i2s->playback_dma_chan),
+                                           &i2s->playback_dma_data.addr);
+       if (ret) {
+               dev_err(&pdev->dev, "Could not alloc TX FIFO: %d\n", ret);
+               goto err_suspend;
+       }
+       ret = tegra30_ahub_set_rx_cif_source(i2s->playback_i2s_cif,
+                                            i2s->playback_fifo_cif);
+       if (ret) {
+               dev_err(&pdev->dev, "Could not route TX FIFO: %d\n", ret);
+               goto err_free_tx_fifo;
+       }
+
+       i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+       i2s->capture_dma_data.maxburst = 4;
+       ret = tegra30_ahub_allocate_rx_fifo(&i2s->capture_fifo_cif,
+                                           i2s->capture_dma_chan,
+                                           sizeof(i2s->capture_dma_chan),
+                                           &i2s->capture_dma_data.addr);
+       if (ret) {
+               dev_err(&pdev->dev, "Could not alloc RX FIFO: %d\n", ret);
+               goto err_unroute_tx_fifo;
+       }
+       ret = tegra30_ahub_set_rx_cif_source(i2s->capture_fifo_cif,
+                                            i2s->capture_i2s_cif);
+       if (ret) {
+               dev_err(&pdev->dev, "Could not route TX FIFO: %d\n", ret);
+               goto err_free_rx_fifo;
+       }
+
        ret = snd_soc_register_component(&pdev->dev, &tegra30_i2s_component,
                                   &i2s->dai, 1);
        if (ret) {
                dev_err(&pdev->dev, "Could not register DAI: %d\n", ret);
                ret = -ENOMEM;
-               goto err_suspend;
+               goto err_unroute_rx_fifo;
        }
 
-       ret = tegra_pcm_platform_register(&pdev->dev);
+       ret = tegra_pcm_platform_register_with_chan_names(&pdev->dev,
+                               &i2s->dma_config, i2s->playback_dma_chan,
+                               i2s->capture_dma_chan);
        if (ret) {
                dev_err(&pdev->dev, "Could not register PCM: %d\n", ret);
                goto err_unregister_component;
@@ -517,6 +510,14 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev)
 
 err_unregister_component:
        snd_soc_unregister_component(&pdev->dev);
+err_unroute_rx_fifo:
+       tegra30_ahub_unset_rx_cif_source(i2s->capture_fifo_cif);
+err_free_rx_fifo:
+       tegra30_ahub_free_rx_fifo(i2s->capture_fifo_cif);
+err_unroute_tx_fifo:
+       tegra30_ahub_unset_rx_cif_source(i2s->playback_i2s_cif);
+err_free_tx_fifo:
+       tegra30_ahub_free_tx_fifo(i2s->playback_fifo_cif);
 err_suspend:
        if (!pm_runtime_status_suspended(&pdev->dev))
                tegra30_i2s_runtime_suspend(&pdev->dev);
@@ -539,6 +540,12 @@ static int tegra30_i2s_platform_remove(struct platform_device *pdev)
        tegra_pcm_platform_unregister(&pdev->dev);
        snd_soc_unregister_component(&pdev->dev);
 
+       tegra30_ahub_unset_rx_cif_source(i2s->capture_fifo_cif);
+       tegra30_ahub_free_rx_fifo(i2s->capture_fifo_cif);
+
+       tegra30_ahub_unset_rx_cif_source(i2s->playback_i2s_cif);
+       tegra30_ahub_free_tx_fifo(i2s->playback_fifo_cif);
+
        clk_put(i2s->clk_i2s);
 
        return 0;
index 4d0b0a30dbfb341c8a2a93b00485f2d3fb826f18..774fc6ad202697efaa7d3417d1fc48612934b59f 100644 (file)
@@ -238,11 +238,14 @@ struct tegra30_i2s {
        struct clk *clk_i2s;
        enum tegra30_ahub_txcif capture_i2s_cif;
        enum tegra30_ahub_rxcif capture_fifo_cif;
+       char capture_dma_chan[8];
        struct snd_dmaengine_dai_dma_data capture_dma_data;
        enum tegra30_ahub_rxcif playback_i2s_cif;
        enum tegra30_ahub_txcif playback_fifo_cif;
+       char playback_dma_chan[8];
        struct snd_dmaengine_dai_dma_data playback_dma_data;
        struct regmap *regmap;
+       struct snd_dmaengine_pcm_config dma_config;
 };
 
 #endif
index c09ffd18791b9de9b13713dc068ee5cb4d75e42d..93caed500565662450da8379dd640f268315860d 100644 (file)
@@ -58,12 +58,23 @@ static const struct snd_dmaengine_pcm_config tegra_dmaengine_pcm_config = {
 
 int tegra_pcm_platform_register(struct device *dev)
 {
-       return snd_dmaengine_pcm_register(dev, &tegra_dmaengine_pcm_config,
-                       SND_DMAENGINE_PCM_FLAG_NO_DT |
-                       SND_DMAENGINE_PCM_FLAG_COMPAT);
+       return snd_dmaengine_pcm_register(dev, &tegra_dmaengine_pcm_config, 0);
 }
 EXPORT_SYMBOL_GPL(tegra_pcm_platform_register);
 
+int tegra_pcm_platform_register_with_chan_names(struct device *dev,
+                               struct snd_dmaengine_pcm_config *config,
+                               char *txdmachan, char *rxdmachan)
+{
+       *config = tegra_dmaengine_pcm_config;
+       config->dma_dev = dev->parent;
+       config->chan_names[0] = txdmachan;
+       config->chan_names[1] = rxdmachan;
+
+       return snd_dmaengine_pcm_register(dev, config, 0);
+}
+EXPORT_SYMBOL_GPL(tegra_pcm_platform_register_with_chan_names);
+
 void tegra_pcm_platform_unregister(struct device *dev)
 {
        return snd_dmaengine_pcm_unregister(dev);
index 68ad901714a9d5ca6a95f71a8227ecbdf763ff09..7883dec748a316cfc445c87832323c185d70bcd2 100644 (file)
 #ifndef __TEGRA_PCM_H__
 #define __TEGRA_PCM_H__
 
+struct snd_dmaengine_pcm_config;
+
 int tegra_pcm_platform_register(struct device *dev);
+int tegra_pcm_platform_register_with_chan_names(struct device *dev,
+                               struct snd_dmaengine_pcm_config *config,
+                               char *txdmachan, char *rxdmachan);
 void tegra_pcm_platform_unregister(struct device *dev);
 
 #endif