]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'dmaengine/next'
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 10 Dec 2013 00:22:23 +0000 (11:22 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 10 Dec 2013 00:22:23 +0000 (11:22 +1100)
1324 files changed:
CREDITS
Documentation/DocBook/media/v4l/media-ioc-enum-links.xml
Documentation/DocBook/media/v4l/vidioc-expbuf.xml
Documentation/acpi/namespace.txt
Documentation/devicetree/bindings/ata/sata_rcar.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/at91-clock.txt [new file with mode: 0644]
Documentation/devicetree/bindings/clock/imx5-clock.txt
Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
Documentation/devicetree/bindings/dma/ste-dma40.txt
Documentation/devicetree/bindings/interrupt-controller/marvell,dove-pmu-intc.txt [new file with mode: 0644]
Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
Documentation/devicetree/bindings/net/davinci_emac.txt
Documentation/devicetree/bindings/pinctrl/fsl,imx27-pinctrl.txt
Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt [new file with mode: 0644]
Documentation/devicetree/bindings/vendor-prefixes.txt
Documentation/hwmon/it87
Documentation/kmsg/s390/zcrypt [new file with mode: 0644]
Documentation/mic/mpssd/mpssd.c
Documentation/video4linux/omap4_camera.txt [new file with mode: 0644]
Documentation/zorro.txt
MAINTAINERS
arch/arc/Kconfig
arch/arc/include/asm/smp.h
arch/arc/include/uapi/asm/unistd.h
arch/arc/kernel/perf_event.c
arch/arc/kernel/smp.c
arch/arc/plat-arcfpga/smp.c
arch/arm/Kconfig
arch/arm/Kconfig.debug
arch/arm/Makefile
arch/arm/arm-soc-for-next-contents.txt [new file with mode: 0644]
arch/arm/boot/compressed/Makefile
arch/arm/boot/dts/Makefile
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-xp.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/bcm2835-rpi-b.dts
arch/arm/boot/dts/bcm2835.dtsi
arch/arm/boot/dts/cros5250-common.dtsi
arch/arm/boot/dts/dove-cubox.dts
arch/arm/boot/dts/dove.dtsi
arch/arm/boot/dts/emev2-kzm9d.dts
arch/arm/boot/dts/emev2.dtsi
arch/arm/boot/dts/exynos5.dtsi
arch/arm/boot/dts/exynos5250-arndale.dts
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-smdk5420.dts
arch/arm/boot/dts/exynos5420.dtsi
arch/arm/boot/dts/imx23-evk.dts
arch/arm/boot/dts/imx23-olinuxino.dts
arch/arm/boot/dts/imx23-stmp378x_devb.dts
arch/arm/boot/dts/imx25-eukrea-cpuimx25.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts [new file with mode: 0644]
arch/arm/boot/dts/imx25-pinfunc.h [new file with mode: 0644]
arch/arm/boot/dts/imx25-pingrp.h [new file with mode: 0644]
arch/arm/boot/dts/imx25.dtsi
arch/arm/boot/dts/imx27-apf27.dts
arch/arm/boot/dts/imx27-apf27dev.dts
arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts
arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi [moved from arch/arm/boot/dts/imx27-phytec-phycore-som.dts with 77% similarity]
arch/arm/boot/dts/imx27-pinfunc.h [new file with mode: 0644]
arch/arm/boot/dts/imx27-pingrp.h [new file with mode: 0644]
arch/arm/boot/dts/imx27.dtsi
arch/arm/boot/dts/imx28-apf28dev.dts
arch/arm/boot/dts/imx28-apx4devkit.dts
arch/arm/boot/dts/imx28-cfa10036.dts
arch/arm/boot/dts/imx28-cfa10037.dts
arch/arm/boot/dts/imx28-cfa10049.dts
arch/arm/boot/dts/imx28-cfa10057.dts
arch/arm/boot/dts/imx28-cfa10058.dts
arch/arm/boot/dts/imx28-duckbill.dts [new file with mode: 0644]
arch/arm/boot/dts/imx28-eukrea-mbmx283lc.dts [new file with mode: 0644]
arch/arm/boot/dts/imx28-eukrea-mbmx287lc.dts [new file with mode: 0644]
arch/arm/boot/dts/imx28-eukrea-mbmx28lc.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx28-evk.dts
arch/arm/boot/dts/imx28-m28cu3.dts
arch/arm/boot/dts/imx28-m28evk.dts
arch/arm/boot/dts/imx28-sps1.dts
arch/arm/boot/dts/imx28-tx28.dts
arch/arm/boot/dts/imx28.dtsi
arch/arm/boot/dts/imx50-evk.dts [new file with mode: 0644]
arch/arm/boot/dts/imx50-pinfunc.h [new file with mode: 0644]
arch/arm/boot/dts/imx50-pingrp.h [new file with mode: 0644]
arch/arm/boot/dts/imx50.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx51-apf51.dts
arch/arm/boot/dts/imx51-apf51dev.dts
arch/arm/boot/dts/imx51-babbage.dts
arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts [new file with mode: 0644]
arch/arm/boot/dts/imx51-pingrp.h [new file with mode: 0644]
arch/arm/boot/dts/imx51.dtsi
arch/arm/boot/dts/imx53-ard.dts
arch/arm/boot/dts/imx53-evk.dts
arch/arm/boot/dts/imx53-m53evk.dts
arch/arm/boot/dts/imx53-mba53.dts
arch/arm/boot/dts/imx53-pingrp.h [new file with mode: 0644]
arch/arm/boot/dts/imx53-qsb.dts
arch/arm/boot/dts/imx53-smd.dts
arch/arm/boot/dts/imx53-tqma53.dtsi
arch/arm/boot/dts/imx53-tx53.dtsi
arch/arm/boot/dts/imx53-voipac-bsb.dts [new file with mode: 0644]
arch/arm/boot/dts/imx53-voipac-dmm-668.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx53.dtsi
arch/arm/boot/dts/imx6dl-gw51xx.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6dl-gw52xx.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6dl-gw53xx.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6dl-gw54xx.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6dl-pinfunc.h
arch/arm/boot/dts/imx6dl.dtsi
arch/arm/boot/dts/imx6q-arm2.dts
arch/arm/boot/dts/imx6q-cm-fx6.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6q-gw51xx.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6q-gw52xx.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6q-gw53xx.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6q-gw5400-a.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6q-gw54xx.dts [new file with mode: 0644]
arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
arch/arm/boot/dts/imx6q-pinfunc.h
arch/arm/boot/dts/imx6q-sabrelite.dts
arch/arm/boot/dts/imx6q-sbc6x.dts
arch/arm/boot/dts/imx6q-udoo.dts
arch/arm/boot/dts/imx6q.dtsi
arch/arm/boot/dts/imx6qdl-gw51xx.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6qdl-gw52xx.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6qdl-gw53xx.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6qdl-gw54xx.dtsi [new file with mode: 0644]
arch/arm/boot/dts/imx6qdl-pingrp.h [new file with mode: 0644]
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
arch/arm/boot/dts/imx6qdl-sabresd.dtsi
arch/arm/boot/dts/imx6qdl-wandboard.dtsi
arch/arm/boot/dts/imx6qdl.dtsi
arch/arm/boot/dts/imx6sl-evk.dts
arch/arm/boot/dts/imx6sl-pingrp.h [new file with mode: 0644]
arch/arm/boot/dts/imx6sl.dtsi
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-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/orion5x-lacie-ethernet-disk-mini-v2.dts
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
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/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/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/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-snowball.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/common/timer-sp.c
arch/arm/configs/ape6evm_defconfig
arch/arm/configs/armadillo800eva_defconfig
arch/arm/configs/bcm2835_defconfig
arch/arm/configs/bockw_defconfig
arch/arm/configs/exynos_defconfig
arch/arm/configs/genmai_defconfig [new file with mode: 0644]
arch/arm/configs/imx_v4_v5_defconfig
arch/arm/configs/imx_v6_v7_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/multi_v7_defconfig
arch/arm/configs/mvebu_defconfig
arch/arm/include/asm/cacheflush.h
arch/arm/include/asm/io.h
arch/arm/include/asm/mach/map.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/xen/page.h
arch/arm/include/debug/imx-uart.h
arch/arm/include/debug/tegra.S
arch/arm/kernel/entry-v7m.S
arch/arm/kernel/etm.c
arch/arm/kernel/tcm.c
arch/arm/kernel/traps.c
arch/arm/lib/backtrace.S
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/clock.c
arch/arm/mach-at91/generic.h
arch/arm/mach-at91/pm.c
arch/arm/mach-at91/pm_slowclock.S
arch/arm/mach-at91/sama5d3.c
arch/arm/mach-at91/setup.c
arch/arm/mach-bcm2835/Kconfig
arch/arm/mach-clps711x/common.c
arch/arm/mach-davinci/devices-da8xx.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-ep93xx/Kconfig
arch/arm/mach-ep93xx/core.c
arch/arm/mach-ep93xx/include/mach/platform.h
arch/arm/mach-highbank/highbank.c
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/avic.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-pllv1.c
arch/arm/mach-imx/clk-vf610.c
arch/arm/mach-imx/common.h
arch/arm/mach-imx/irq-common.h
arch/arm/mach-imx/mach-imx50.c [new file with mode: 0644]
arch/arm/mach-imx/mach-imx6q.c
arch/arm/mach-imx/mm-imx5.c
arch/arm/mach-imx/time.c
arch/arm/mach-integrator/integrator_ap.c
arch/arm/mach-ixp4xx/common.c
arch/arm/mach-kirkwood/board-dt.c
arch/arm/mach-mmp/time.c
arch/arm/mach-msm/timer.c
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/platsmp.c
arch/arm/mach-mvebu/pmsu.c
arch/arm/mach-mvebu/system-controller.c
arch/arm/mach-mxs/mach-mxs.c
arch/arm/mach-omap1/time.c
arch/arm/mach-omap2/io.c
arch/arm/mach-omap2/omap4-common.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-pxa/time.c
arch/arm/mach-s3c64xx/Kconfig
arch/arm/mach-s3c64xx/Makefile
arch/arm/mach-s3c64xx/common.h
arch/arm/mach-s3c64xx/dma.c [deleted file]
arch/arm/mach-s3c64xx/include/mach/dma.h
arch/arm/mach-s3c64xx/pl080.c [new file with mode: 0644]
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-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/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-r8a7779.c
arch/arm/mach-shmobile/setup-r8a7790.c
arch/arm/mach-shmobile/setup-r8a7791.c
arch/arm/mach-shmobile/setup-sh73a0.c
arch/arm/mach-tegra/fuse.c
arch/arm/mach-tegra/iomap.h
arch/arm/mach-tegra/tegra.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-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/setup.h
arch/arm/mach-ux500/timer.c
arch/arm/mm/Makefile
arch/arm/mm/cache-v7.S
arch/arm/mm/dma-mapping.c
arch/arm/mm/dump.c [new file with mode: 0644]
arch/arm/mm/ioremap.c
arch/arm/mm/mmu.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-samsung/devs.c
arch/arm/plat-samsung/dma-ops.c
arch/arm/plat-samsung/include/plat/uncompress.h
arch/arm/plat-samsung/s5p-irq-eint.c
arch/arm/plat-versatile/sched-clock.c
arch/arm64/Kconfig
arch/arm64/include/asm/io.h
arch/arm64/include/asm/pgtable-hwdef.h
arch/arm64/kernel/head.S
arch/arm64/mm/proc.S
arch/c6x/include/asm/cache.h
arch/ia64/hp/common/aml_nfw.c
arch/m68k/Kconfig
arch/m68k/amiga/chipram.c
arch/m68k/amiga/config.c
arch/m68k/amiga/platform.c
arch/m68k/apollo/config.c
arch/m68k/atari/config.c
arch/m68k/atari/debug.c
arch/m68k/bvme6000/config.c
arch/m68k/configs/amiga_defconfig
arch/m68k/configs/apollo_defconfig
arch/m68k/configs/atari_defconfig
arch/m68k/configs/bvme6000_defconfig
arch/m68k/configs/hp300_defconfig
arch/m68k/configs/m5208evb_defconfig
arch/m68k/configs/m5249evb_defconfig
arch/m68k/configs/m5272c3_defconfig
arch/m68k/configs/m5275evb_defconfig
arch/m68k/configs/m5307c3_defconfig
arch/m68k/configs/m5407c3_defconfig
arch/m68k/configs/mac_defconfig
arch/m68k/configs/multi_defconfig
arch/m68k/configs/mvme147_defconfig
arch/m68k/configs/mvme16x_defconfig
arch/m68k/configs/q40_defconfig
arch/m68k/configs/sun3_defconfig
arch/m68k/configs/sun3x_defconfig
arch/m68k/emu/natfeat.c
arch/m68k/hp300/config.c
arch/m68k/include/asm/amigahw.h
arch/m68k/include/asm/apollohw.h
arch/m68k/include/asm/atarihw.h
arch/m68k/include/asm/bootinfo.h
arch/m68k/include/asm/hp300hw.h
arch/m68k/include/asm/kexec.h [new file with mode: 0644]
arch/m68k/include/asm/macintosh.h
arch/m68k/include/asm/mc146818rtc.h
arch/m68k/include/asm/mvme16xhw.h
arch/m68k/include/asm/setup.h
arch/m68k/include/asm/timex.h
arch/m68k/include/uapi/asm/Kbuild
arch/m68k/include/uapi/asm/bootinfo-amiga.h [new file with mode: 0644]
arch/m68k/include/uapi/asm/bootinfo-apollo.h [new file with mode: 0644]
arch/m68k/include/uapi/asm/bootinfo-atari.h [new file with mode: 0644]
arch/m68k/include/uapi/asm/bootinfo-hp300.h [new file with mode: 0644]
arch/m68k/include/uapi/asm/bootinfo-mac.h [new file with mode: 0644]
arch/m68k/include/uapi/asm/bootinfo-q40.h [new file with mode: 0644]
arch/m68k/include/uapi/asm/bootinfo-vme.h [new file with mode: 0644]
arch/m68k/include/uapi/asm/bootinfo.h [new file with mode: 0644]
arch/m68k/include/uapi/asm/setup.h
arch/m68k/kernel/Makefile
arch/m68k/kernel/asm-offsets.c
arch/m68k/kernel/bootinfo_proc.c [new file with mode: 0644]
arch/m68k/kernel/head.S
arch/m68k/kernel/machine_kexec.c [new file with mode: 0644]
arch/m68k/kernel/relocate_kernel.S [new file with mode: 0644]
arch/m68k/kernel/setup_mm.c
arch/m68k/kernel/time.c
arch/m68k/mac/config.c
arch/m68k/mac/iop.c
arch/m68k/mac/misc.c
arch/m68k/mac/oss.c
arch/m68k/mac/psc.c
arch/m68k/mac/via.c
arch/m68k/mm/init.c
arch/m68k/mm/motorola.c
arch/m68k/mvme147/config.c
arch/m68k/mvme16x/config.c
arch/m68k/q40/config.c
arch/m68k/sun3/dvma.c
arch/m68k/sun3/mmu_emu.c
arch/m68k/sun3/sun3dvma.c
arch/m68k/sun3x/prom.c
arch/metag/include/asm/smp.h
arch/metag/kernel/dma.c
arch/metag/kernel/smp.c
arch/microblaze/Makefile
arch/microblaze/include/asm/sections.h
arch/microblaze/kernel/setup.c
arch/mips/lasat/picvue_proc.c
arch/openrisc/kernel/entry.S
arch/openrisc/kernel/signal.c
arch/powerpc/Kconfig
arch/powerpc/boot/.gitignore
arch/powerpc/boot/dts/ac14xx.dts
arch/powerpc/boot/dts/kilauea.dts
arch/powerpc/boot/dts/mpc5121.dtsi
arch/powerpc/boot/dts/virtex440-ml507.dts
arch/powerpc/include/asm/bitops.h
arch/powerpc/include/asm/cache.h
arch/powerpc/include/asm/clk_interface.h [deleted file]
arch/powerpc/include/asm/code-patching.h
arch/powerpc/include/asm/cputable.h
arch/powerpc/include/asm/exception-64s.h
arch/powerpc/include/asm/hardirq.h
arch/powerpc/include/asm/io.h
arch/powerpc/include/asm/iommu.h
arch/powerpc/include/asm/lppaca.h
arch/powerpc/include/asm/mce.h [new file with mode: 0644]
arch/powerpc/include/asm/opal.h
arch/powerpc/include/asm/paca.h
arch/powerpc/include/asm/pgtable.h
arch/powerpc/include/asm/pte-hash64.h
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/clock.c [deleted file]
arch/powerpc/kernel/cpu_setup_power.S
arch/powerpc/kernel/cputable.c
arch/powerpc/kernel/eeh.c
arch/powerpc/kernel/eeh_driver.c
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/exceptions-64s.S
arch/powerpc/kernel/idle_power7.S
arch/powerpc/kernel/iommu.c
arch/powerpc/kernel/irq.c
arch/powerpc/kernel/mce.c [new file with mode: 0644]
arch/powerpc/kernel/mce_power.c [new file with mode: 0644]
arch/powerpc/kernel/misc_32.S
arch/powerpc/kernel/misc_64.S
arch/powerpc/kernel/paca.c
arch/powerpc/kernel/setup_64.c
arch/powerpc/kernel/smp.c
arch/powerpc/kernel/sysfs.c
arch/powerpc/kernel/time.c
arch/powerpc/kernel/traps.c
arch/powerpc/kvm/book3s_hv_ras.c
arch/powerpc/lib/code-patching.c
arch/powerpc/mm/hash_low_64.S
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/hugepage-hash64.c
arch/powerpc/mm/hugetlbpage-hash64.c
arch/powerpc/mm/pgtable.c
arch/powerpc/mm/pgtable_64.c
arch/powerpc/mm/tlb_nohash.c
arch/powerpc/platforms/512x/Kconfig
arch/powerpc/platforms/512x/Makefile
arch/powerpc/platforms/512x/clock-commonclk.c [new file with mode: 0644]
arch/powerpc/platforms/512x/clock.c [deleted file]
arch/powerpc/platforms/512x/mpc512x_shared.c
arch/powerpc/platforms/52xx/Kconfig
arch/powerpc/platforms/Kconfig.cputype
arch/powerpc/platforms/cell/beat_htab.c
arch/powerpc/platforms/powernv/Kconfig
arch/powerpc/platforms/powernv/Makefile
arch/powerpc/platforms/powernv/eeh-ioda.c
arch/powerpc/platforms/powernv/opal-flash.c
arch/powerpc/platforms/powernv/opal-memory-errors.c [new file with mode: 0644]
arch/powerpc/platforms/powernv/opal-rtc.c
arch/powerpc/platforms/powernv/opal-wrappers.S
arch/powerpc/platforms/powernv/opal.c
arch/powerpc/platforms/powernv/pci-ioda.c
arch/powerpc/platforms/powernv/pci-p5ioc2.c
arch/powerpc/platforms/powernv/pci.c
arch/powerpc/platforms/powernv/pci.h
arch/powerpc/platforms/ps3/spu.c
arch/powerpc/platforms/pseries/Kconfig
arch/powerpc/platforms/pseries/iommu.c
arch/powerpc/platforms/pseries/lpar.c
arch/powerpc/sysdev/Kconfig
arch/powerpc/sysdev/fsl_pci.c
arch/powerpc/xmon/xmon.c
arch/s390/Kconfig
arch/s390/include/asm/sclp.h
arch/s390/include/uapi/asm/zcrypt.h
arch/s390/kernel/asm-offsets.c
arch/s390/kernel/vdso.c
arch/s390/kernel/vdso32/clock_gettime.S
arch/s390/kernel/vdso64/clock_getres.S
arch/s390/kernel/vdso64/clock_gettime.S
arch/sh/include/asm/hw_breakpoint.h
arch/sh/include/cpu-common/cpu/ubc.h [new file with mode: 0644]
arch/sh/include/cpu-sh2a/cpu/ubc.h [new file with mode: 0644]
arch/sh/kernel/cpu/sh2a/Makefile
arch/sh/kernel/cpu/sh2a/ubc.c [new file with mode: 0644]
arch/sh/kernel/hw_breakpoint.c
arch/sparc/kernel/kgdb_64.c
arch/x86/kernel/apic/apic_flat_64.c
arch/x86/kernel/apic/io_apic.c
arch/x86/pci/mmconfig_32.c
arch/x86/platform/olpc/olpc-xo15-sci.c
arch/xtensa/Kconfig
arch/xtensa/boot/dts/xtfpga.dtsi
arch/xtensa/include/asm/Kbuild
arch/xtensa/include/asm/barrier.h
arch/xtensa/include/asm/bitops.h
arch/xtensa/include/asm/cacheflush.h
arch/xtensa/include/asm/delay.h
arch/xtensa/include/asm/ftrace.h
arch/xtensa/include/asm/futex.h [new file with mode: 0644]
arch/xtensa/include/asm/irq.h
arch/xtensa/include/asm/mmu.h
arch/xtensa/include/asm/mmu_context.h
arch/xtensa/include/asm/mxregs.h [new file with mode: 0644]
arch/xtensa/include/asm/processor.h
arch/xtensa/include/asm/ptrace.h
arch/xtensa/include/asm/smp.h
arch/xtensa/include/asm/spinlock.h
arch/xtensa/include/asm/spinlock_types.h [new file with mode: 0644]
arch/xtensa/include/asm/timex.h
arch/xtensa/include/asm/tlbflush.h
arch/xtensa/include/asm/traps.h
arch/xtensa/include/asm/vectors.h
arch/xtensa/kernel/Makefile
arch/xtensa/kernel/head.S
arch/xtensa/kernel/irq.c
arch/xtensa/kernel/mxhead.S [new file with mode: 0644]
arch/xtensa/kernel/setup.c
arch/xtensa/kernel/smp.c [new file with mode: 0644]
arch/xtensa/kernel/time.c
arch/xtensa/kernel/traps.c
arch/xtensa/kernel/vmlinux.lds.S
arch/xtensa/mm/cache.c
arch/xtensa/mm/fault.c
arch/xtensa/mm/misc.S
arch/xtensa/mm/mmu.c
arch/xtensa/mm/tlb.c
arch/xtensa/platforms/iss/network.c
arch/xtensa/platforms/xtfpga/include/platform/hardware.h
arch/xtensa/variants/s6000/include/variant/irq.h
drivers/Makefile
drivers/acpi/ac.c
drivers/acpi/acpi_extlog.c
drivers/acpi/acpi_lpss.c
drivers/acpi/acpi_memhotplug.c
drivers/acpi/acpi_pad.c
drivers/acpi/acpi_processor.c
drivers/acpi/apei/einj.c
drivers/acpi/battery.c
drivers/acpi/blacklist.c
drivers/acpi/bus.c
drivers/acpi/button.c
drivers/acpi/container.c
drivers/acpi/custom_method.c
drivers/acpi/debugfs.c
drivers/acpi/device_pm.c
drivers/acpi/dock.c
drivers/acpi/ec.c
drivers/acpi/event.c
drivers/acpi/fan.c
drivers/acpi/glue.c
drivers/acpi/hed.c
drivers/acpi/internal.h
drivers/acpi/numa.c
drivers/acpi/osl.c
drivers/acpi/pci_irq.c
drivers/acpi/pci_link.c
drivers/acpi/pci_root.c
drivers/acpi/power.c
drivers/acpi/proc.c
drivers/acpi/processor_core.c
drivers/acpi/processor_idle.c
drivers/acpi/processor_perflib.c
drivers/acpi/processor_thermal.c
drivers/acpi/processor_throttling.c
drivers/acpi/sbshc.c
drivers/acpi/scan.c
drivers/acpi/sleep.c
drivers/acpi/sysfs.c
drivers/acpi/thermal.c
drivers/acpi/utils.c
drivers/acpi/video.c
drivers/acpi/wakeup.c
drivers/ata/ahci.c
drivers/ata/ahci_imx.c
drivers/ata/ata_generic.c
drivers/ata/libata-acpi.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/pata_acpi.c
drivers/ata/sata_rcar.c
drivers/base/power/main.c
drivers/block/z2ram.c
drivers/bus/mvebu-mbus.c
drivers/char/hpet.c
drivers/char/i8k.c
drivers/char/tpm/tpm_acpi.c
drivers/char/tpm/tpm_ppi.c
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/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/samsung/clk-s3c64xx.c
drivers/clocksource/exynos_mct.c
drivers/clocksource/nomadik-mtu.c
drivers/cpufreq/cpufreq-cpu0.c
drivers/cpufreq/cpufreq.c
drivers/cpufreq/spear-cpufreq.c
drivers/dma/amba-pl08x.c
drivers/dma/imx-sdma.c
drivers/dma/mmp_pdma.c
drivers/dma/mmp_tdma.c
drivers/dma/pl330.c
drivers/dma/s3c24xx-dma.c
drivers/dma/sh/rcar-hpbdma.c
drivers/dma/ste_dma40.c
drivers/extcon/extcon-arizona.c
drivers/extcon/extcon-class.c
drivers/gpio/gpio-davinci.c
drivers/gpu/drm/drm_edid.c
drivers/gpu/drm/exynos/exynos_drm_drv.c
drivers/gpu/drm/exynos/exynos_drm_fimd.c
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_context.c
drivers/gpu/drm/i915/i915_gem_dmabuf.c
drivers/gpu/drm/i915/i915_gem_execbuffer.c
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_acpi.c
drivers/gpu/drm/i915/intel_ddi.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_pm.c
drivers/gpu/drm/nouveau/Makefile
drivers/gpu/drm/nouveau/core/engine/device/nv50.c
drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c
drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c
drivers/gpu/drm/nouveau/core/engine/software/nv50.c
drivers/gpu/drm/nouveau/core/include/subdev/clock.h
drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c
drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/dispnv04/overlay.c
drivers/gpu/drm/nouveau/nouveau_acpi.c
drivers/gpu/drm/nouveau/nouveau_display.c
drivers/gpu/drm/nouveau/nv50_display.c
drivers/gpu/drm/radeon/atombios_i2c.c
drivers/gpu/drm/radeon/dce6_afmt.c
drivers/gpu/drm/radeon/ni_dpm.c
drivers/gpu/drm/radeon/r600_hdmi.c
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_acpi.c
drivers/gpu/drm/radeon/radeon_atombios.c
drivers/gpu/drm/radeon/radeon_cs.c
drivers/gpu/drm/radeon/radeon_drv.h
drivers/gpu/drm/radeon/radeon_gart.c
drivers/gpu/drm/radeon/radeon_pm.c
drivers/gpu/drm/radeon/radeon_trace.h
drivers/gpu/drm/radeon/reg_srcs/cayman
drivers/gpu/drm/radeon/reg_srcs/evergreen
drivers/gpu/drm/radeon/si.c
drivers/gpu/drm/tegra/drm.c
drivers/gpu/drm/tegra/drm.h
drivers/gpu/drm/tegra/fb.c
drivers/gpu/drm/tegra/rgb.c
drivers/gpu/drm/udl/udl_gem.c
drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
drivers/gpu/host1x/bus.c
drivers/gpu/host1x/hw/cdma_hw.c
drivers/gpu/host1x/hw/debug_hw.c
drivers/hid/Kconfig
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/hid/hid-lg.c
drivers/hid/hid-multitouch.c
drivers/hid/hid-sensor-hub.c
drivers/hid/hid-sony.c
drivers/hid/i2c-hid/i2c-hid.c
drivers/hid/usbhid/hid-quirks.c
drivers/hid/usbhid/usbkbd.c
drivers/hv/vmbus_drv.c
drivers/hwmon/Kconfig
drivers/hwmon/acpi_power_meter.c
drivers/hwmon/asus_atk0110.c
drivers/hwmon/fam15h_power.c
drivers/hwmon/it87.c
drivers/hwmon/k10temp.c
drivers/hwmon/k8temp.c
drivers/hwmon/lm78.c
drivers/hwmon/lm90.c
drivers/hwmon/sis5595.c
drivers/hwmon/via686a.c
drivers/hwmon/vt8231.c
drivers/hwmon/w83l786ng.c
drivers/ide/buddha.c
drivers/ide/ide-acpi.c
drivers/iio/common/hid-sensors/Kconfig
drivers/iio/common/hid-sensors/hid-sensor-trigger.c
drivers/iio/light/Kconfig
drivers/input/keyboard/adp5588-keys.c
drivers/input/keyboard/adp5589-keys.c
drivers/input/keyboard/bf54x-keys.c
drivers/input/misc/atlas_btns.c
drivers/input/misc/pcf8574_keypad.c
drivers/input/mouse/alps.c
drivers/input/mouse/alps.h
drivers/input/mouse/elantech.c
drivers/input/serio/ambakmi.c
drivers/input/touchscreen/sur40.c
drivers/input/touchscreen/usbtouchscreen.c
drivers/iommu/amd_iommu_init.c
drivers/iommu/arm-smmu.c
drivers/iommu/intel_irq_remapping.c
drivers/irqchip/Kconfig
drivers/irqchip/Makefile
drivers/irqchip/exynos-combiner.c
drivers/irqchip/irq-dove.c [new file with mode: 0644]
drivers/irqchip/irq-renesas-intc-irqpin.c
drivers/irqchip/irq-xtensa-mx.c [new file with mode: 0644]
drivers/irqchip/irq-xtensa-pic.c [new file with mode: 0644]
drivers/macintosh/Kconfig
drivers/macintosh/windfarm_lm75_sensor.c
drivers/macintosh/windfarm_max6690_sensor.c
drivers/media/common/siano/smscoreapi.h
drivers/media/common/siano/smsdvb.h
drivers/media/dvb-core/dvb_demux.c
drivers/media/dvb-frontends/af9033.c
drivers/media/dvb-frontends/cxd2820r_c.c
drivers/media/dvb-frontends/dib8000.c
drivers/media/dvb-frontends/drxk_hard.c
drivers/media/dvb-frontends/rtl2830.c
drivers/media/i2c/adv7183_regs.h
drivers/media/i2c/adv7604.c
drivers/media/i2c/adv7842.c
drivers/media/i2c/ir-kbd-i2c.c
drivers/media/i2c/m5mols/m5mols_controls.c
drivers/media/i2c/mt9p031.c
drivers/media/i2c/s5c73m3/s5c73m3-core.c
drivers/media/i2c/s5c73m3/s5c73m3.h
drivers/media/i2c/saa7115.c
drivers/media/i2c/soc_camera/ov5642.c
drivers/media/i2c/ths7303.c
drivers/media/i2c/wm8775.c
drivers/media/media-entity.c
drivers/media/pci/bt8xx/bttv-driver.c
drivers/media/pci/cx18/cx18-driver.h
drivers/media/pci/cx23885/cx23885-417.c
drivers/media/pci/pluto2/pluto2.c
drivers/media/pci/saa7164/saa7164-core.c
drivers/media/platform/coda.c
drivers/media/platform/exynos4-is/fimc-core.c
drivers/media/platform/exynos4-is/fimc-core.h
drivers/media/platform/exynos4-is/fimc-is-regs.c
drivers/media/platform/exynos4-is/fimc-is-regs.h
drivers/media/platform/exynos4-is/fimc-lite-reg.c
drivers/media/platform/exynos4-is/fimc-m2m.c
drivers/media/platform/exynos4-is/media-dev.c
drivers/media/platform/exynos4-is/mipi-csis.c
drivers/media/platform/fsl-viu.c
drivers/media/platform/marvell-ccic/mmp-driver.c
drivers/media/platform/mem2mem_testdev.c
drivers/media/platform/omap3isp/isp.c
drivers/media/platform/omap3isp/ispccdc.c
drivers/media/platform/omap3isp/ispccp2.c
drivers/media/platform/omap3isp/ispcsi2.c
drivers/media/platform/omap3isp/isppreview.c
drivers/media/platform/omap3isp/ispresizer.c
drivers/media/platform/omap3isp/ispstat.c
drivers/media/platform/omap3isp/ispvideo.c
drivers/media/platform/s5p-g2d/g2d.c
drivers/media/platform/s5p-g2d/g2d.h
drivers/media/platform/s5p-jpeg/jpeg-core.c
drivers/media/platform/s5p-jpeg/jpeg-core.h
drivers/media/platform/s5p-mfc/regs-mfc.h
drivers/media/platform/s5p-mfc/s5p_mfc.c
drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
drivers/media/platform/s5p-tv/mixer.h
drivers/media/platform/s5p-tv/mixer_drv.c
drivers/media/platform/s5p-tv/mixer_video.c
drivers/media/platform/s5p-tv/sdo_drv.c
drivers/media/platform/soc_camera/omap1_camera.c
drivers/media/platform/vivi.c
drivers/media/platform/vsp1/vsp1_drv.c
drivers/media/platform/vsp1/vsp1_video.c
drivers/media/radio/radio-shark.c
drivers/media/radio/radio-shark2.c
drivers/media/radio/radio-si476x.c
drivers/media/radio/radio-tea5764.c
drivers/media/radio/tef6862.c
drivers/media/rc/imon.c
drivers/media/rc/redrat3.c
drivers/media/tuners/mt2063.c
drivers/media/tuners/tuner-xc2028-types.h
drivers/media/usb/cx231xx/cx231xx-cards.c
drivers/media/usb/dvb-usb-v2/af9035.c
drivers/media/usb/dvb-usb-v2/mxl111sf.c
drivers/media/usb/dvb-usb/technisat-usb2.c
drivers/media/usb/em28xx/em28xx-video.c
drivers/media/usb/gspca/gl860/gl860.c
drivers/media/usb/gspca/pac207.c
drivers/media/usb/gspca/pac7302.c
drivers/media/usb/gspca/stk1135.c
drivers/media/usb/gspca/stv0680.c
drivers/media/usb/gspca/sunplus.c
drivers/media/usb/gspca/zc3xx.c
drivers/media/usb/pwc/pwc-if.c
drivers/media/usb/usbtv/usbtv.c
drivers/media/usb/uvc/uvc_video.c
drivers/media/v4l2-core/v4l2-ctrls.c
drivers/media/v4l2-core/v4l2-mem2mem.c
drivers/media/v4l2-core/videobuf2-core.c
drivers/media/v4l2-core/videobuf2-dma-contig.c
drivers/mfd/Kconfig
drivers/mfd/lpc_ich.c
drivers/mfd/ti-ssp.c
drivers/misc/mei/hw-me-regs.h
drivers/misc/mei/pci-me.c
drivers/misc/mic/card/mic_virtio.c
drivers/misc/mic/card/mic_virtio.h
drivers/misc/mic/host/mic_boot.c
drivers/misc/mic/host/mic_virtio.c
drivers/misc/mic/host/mic_x100.c
drivers/mmc/core/sdio_bus.c
drivers/mmc/host/mmci.c
drivers/mtd/maps/pxa2xx-flash.c
drivers/mtd/nand/mpc5121_nfc.c
drivers/net/bonding/bond_main.c
drivers/net/bonding/bond_sysfs.c
drivers/net/can/mscan/mpc5xxx_can.c
drivers/net/ethernet/8390/hydra.c
drivers/net/ethernet/8390/zorro8390.c
drivers/net/ethernet/amd/a2065.c
drivers/net/ethernet/amd/ariadne.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/sge.c
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
drivers/net/ethernet/chelsio/cxgb4vf/sge.c
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
drivers/net/ethernet/emulex/benet/be_hw.h
drivers/net/ethernet/emulex/benet/be_main.c
drivers/net/ethernet/freescale/fec_main.c
drivers/net/ethernet/ibm/ehea/ehea_main.c
drivers/net/ethernet/marvell/mvneta.c
drivers/net/ethernet/mellanox/mlx4/main.c
drivers/net/ethernet/natsemi/macsonic.c
drivers/net/ethernet/nvidia/forcedeth.c
drivers/net/ethernet/qlogic/qlge/qlge.h
drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c
drivers/net/ethernet/qlogic/qlge/qlge_main.c
drivers/net/ethernet/tehuti/tehuti.c
drivers/net/ethernet/ti/cpsw.c
drivers/net/ethernet/ti/davinci_emac.c
drivers/net/ethernet/xilinx/ll_temac_main.c
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
drivers/net/macvtap.c
drivers/net/tun.c
drivers/net/virtio_net.c
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/xmit.c
drivers/net/wireless/ath/wcn36xx/smd.c
drivers/net/wireless/brcm80211/Kconfig
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
drivers/net/wireless/iwlwifi/iwl-7000.c
drivers/net/wireless/iwlwifi/iwl-config.h
drivers/net/wireless/iwlwifi/iwl-csr.h
drivers/net/wireless/iwlwifi/mvm/bt-coex.c
drivers/net/wireless/iwlwifi/mvm/d3.c
drivers/net/wireless/iwlwifi/mvm/debugfs.c
drivers/net/wireless/iwlwifi/mvm/time-event.c
drivers/net/wireless/iwlwifi/pcie/drv.c
drivers/net/wireless/iwlwifi/pcie/internal.h
drivers/net/wireless/iwlwifi/pcie/rx.c
drivers/net/wireless/iwlwifi/pcie/trans.c
drivers/net/wireless/iwlwifi/pcie/tx.c
drivers/net/wireless/mac80211_hwsim.c
drivers/net/wireless/mwifiex/sta_ioctl.c
drivers/net/xen-netback/interface.c
drivers/net/xen-netback/netback.c
drivers/parport/parport_mfc3.c
drivers/pci/host/pci-mvebu.c
drivers/pci/hotplug/acpiphp_glue.c
drivers/pci/hotplug/acpiphp_ibm.c
drivers/pci/hotplug/pciehp.h
drivers/pci/ioapic.c
drivers/pci/pci-acpi.c
drivers/pci/pci-driver.c
drivers/pci/pci-label.c
drivers/pci/pci.c
drivers/pci/remove.c
drivers/pinctrl/Kconfig
drivers/pinctrl/pinctrl-baytrail.c
drivers/pinctrl/pinctrl-imx1-core.c
drivers/pinctrl/pinctrl-nomadik.c
drivers/pinctrl/pinctrl-nomadik.h
drivers/pinctrl/sh-pfc/pfc-r8a7791.c
drivers/platform/x86/acer-wmi.c
drivers/platform/x86/asus-laptop.c
drivers/platform/x86/asus-wmi.c
drivers/platform/x86/classmate-laptop.c
drivers/platform/x86/dell-wmi-aio.c
drivers/platform/x86/dell-wmi.c
drivers/platform/x86/eeepc-laptop.c
drivers/platform/x86/eeepc-wmi.c
drivers/platform/x86/hp_accel.c
drivers/platform/x86/ideapad-laptop.c
drivers/platform/x86/intel-rst.c
drivers/platform/x86/intel-smartconnect.c
drivers/platform/x86/intel_menlow.c
drivers/platform/x86/intel_oaktrail.c
drivers/platform/x86/mxm-wmi.c
drivers/platform/x86/panasonic-laptop.c
drivers/platform/x86/pvpanic.c
drivers/platform/x86/samsung-q10.c
drivers/platform/x86/sony-laptop.c
drivers/platform/x86/tc1100-wmi.c
drivers/platform/x86/thinkpad_acpi.c
drivers/platform/x86/toshiba_acpi.c
drivers/platform/x86/toshiba_bluetooth.c
drivers/platform/x86/wmi.c
drivers/platform/x86/xo15-ebook.c
drivers/pnp/pnpacpi/core.c
drivers/pnp/pnpacpi/pnpacpi.h
drivers/s390/block/dasd_genhd.c
drivers/s390/char/sclp_early.c
drivers/s390/cio/blacklist.c
drivers/s390/cio/chsc.c
drivers/s390/cio/css.c
drivers/s390/cio/css.h
drivers/s390/crypto/ap_bus.c
drivers/s390/crypto/ap_bus.h
drivers/s390/crypto/zcrypt_api.c
drivers/s390/crypto/zcrypt_api.h
drivers/s390/crypto/zcrypt_cex4.c
drivers/s390/crypto/zcrypt_error.h
drivers/s390/crypto/zcrypt_msgtype50.c
drivers/s390/crypto/zcrypt_msgtype6.c
drivers/s390/crypto/zcrypt_msgtype6.h
drivers/s390/crypto/zcrypt_pcica.c
drivers/s390/crypto/zcrypt_pcicc.c
drivers/scsi/a2091.c
drivers/scsi/a3000.c
drivers/scsi/a4000t.c
drivers/scsi/gvp11.c
drivers/scsi/zorro7xx.c
drivers/sfi/sfi_acpi.c
drivers/spi/Kconfig
drivers/spi/spi-mpc512x-psc.c
drivers/staging/media/Kconfig
drivers/staging/media/Makefile
drivers/staging/media/omap4iss/Kconfig [new file with mode: 0644]
drivers/staging/media/omap4iss/Makefile [new file with mode: 0644]
drivers/staging/media/omap4iss/TODO [new file with mode: 0644]
drivers/staging/media/omap4iss/iss.c [new file with mode: 0644]
drivers/staging/media/omap4iss/iss.h [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_csi2.c [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_csi2.h [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_csiphy.c [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_csiphy.h [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_ipipe.c [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_ipipe.h [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_ipipeif.c [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_ipipeif.h [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_regs.h [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_resizer.c [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_resizer.h [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_video.c [new file with mode: 0644]
drivers/staging/media/omap4iss/iss_video.h [new file with mode: 0644]
drivers/staging/quickstart/quickstart.c
drivers/staging/tidspbridge/rmgr/drv_interface.c
drivers/tty/n_tty.c
drivers/tty/serial/mpc52xx_uart.c
drivers/tty/serial/sh-sci.c
drivers/usb/chipidea/core.c
drivers/usb/chipidea/host.c
drivers/usb/chipidea/udc.c
drivers/usb/class/cdc-acm.c
drivers/usb/class/cdc-wdm.c
drivers/usb/core/hub.c
drivers/usb/core/usb-acpi.c
drivers/usb/dwc3/core.c
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c
drivers/usb/gadget/Kconfig
drivers/usb/gadget/atmel_usba_udc.c
drivers/usb/gadget/composite.c
drivers/usb/gadget/f_fs.c
drivers/usb/gadget/f_mass_storage.c
drivers/usb/gadget/pxa25x_udc.c
drivers/usb/gadget/s3c-hsotg.c
drivers/usb/gadget/storage_common.h
drivers/usb/gadget/tcm_usb_gadget.c
drivers/usb/gadget/zero.c
drivers/usb/host/fsl-mph-dr-of.c
drivers/usb/host/ohci-pxa27x.c
drivers/usb/host/r8a66597-hcd.c
drivers/usb/host/xhci-ring.c
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_cppi41.c
drivers/usb/musb/musb_gadget.c
drivers/usb/phy/phy-am335x.c
drivers/usb/phy/phy-generic.c
drivers/usb/phy/phy-generic.h
drivers/usb/phy/phy-mxs-usb.c
drivers/usb/phy/phy-rcar-gen2-usb.c
drivers/usb/phy/phy-tegra-usb.c
drivers/usb/phy/phy-twl6030-usb.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/generic.c
drivers/usb/serial/mos7840.c
drivers/usb/serial/option.c
drivers/usb/serial/pl2303.c
drivers/usb/serial/spcp8x5.c
drivers/usb/serial/zte_ev.c
drivers/usb/wusbcore/devconnect.c
drivers/usb/wusbcore/security.c
drivers/usb/wusbcore/wusbhc.h
drivers/video/amifb.c
drivers/video/cirrusfb.c
drivers/video/macfb.c
drivers/video/valkyriefb.c
drivers/virtio/virtio_balloon.c
drivers/xen/xen-acpi-cpuhotplug.c
drivers/xen/xen-acpi-memhotplug.c
drivers/xen/xen-acpi-pad.c
drivers/xen/xen-acpi-processor.c
drivers/zorro/Makefile
drivers/zorro/names.c
drivers/zorro/proc.c
drivers/zorro/zorro-driver.c
drivers/zorro/zorro-sysfs.c
drivers/zorro/zorro.c
drivers/zorro/zorro.h
fs/9p/cache.c
fs/9p/vfs_file.c
fs/9p/vfs_inode.c
fs/9p/vfs_inode_dotl.c
fs/9p/xattr.c
fs/attr.c
fs/btrfs/inode.c
fs/ceph/file.c
fs/ceph/inode.c
fs/ceph/super.c
fs/ceph/super.h
fs/cifs/cifsproto.h
fs/cifs/cifssmb.c
fs/cifs/inode.c
fs/cifs/link.c
fs/ext2/super.c
fs/ext4/ext4_jbd2.c
fs/ext4/extents.c
fs/ext4/inode.c
fs/ext4/mballoc.c
fs/ext4/super.c
fs/f2fs/checkpoint.c
fs/f2fs/data.c
fs/f2fs/debug.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/gc.c
fs/f2fs/node.c
fs/f2fs/recovery.c
fs/f2fs/segment.c
fs/f2fs/segment.h
fs/f2fs/super.c
fs/fscache/page.c
fs/gfs2/aops.c
fs/gfs2/glops.c
fs/gfs2/incore.h
fs/gfs2/lops.c
fs/gfs2/meta_io.c
fs/gfs2/ops_fstype.c
fs/gfs2/quota.c
fs/gfs2/rgrp.c
fs/jbd2/journal.c
fs/jbd2/recovery.c
fs/jbd2/transaction.c
fs/logfs/dev_mtd.c
fs/logfs/super.c
fs/nfs/nfs4client.c
fs/nfs/nfs4xdr.c
fs/sysfs/file.c
fs/xfs/xfs_buf.c
fs/xfs/xfs_dir2_node.c
fs/xfs/xfs_discard.c
fs/xfs/xfs_fsops.c
fs/xfs/xfs_ioctl.c
fs/xfs/xfs_ioctl32.c
fs/xfs/xfs_iops.c
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_qm.c
fs/xfs/xfs_qm.h
fs/xfs/xfs_qm_syscalls.c
fs/xfs/xfs_quota_priv.h [deleted file]
fs/xfs/xfs_trans_dquot.c
fs/xfs/xfs_vnode.h
include/acpi/acpi_bus.h
include/acpi/acpi_drivers.h
include/crypto/scatterwalk.h
include/dt-bindings/clk/at91.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/mpc512x-clock.h [new file with mode: 0644]
include/dt-bindings/clock/vf610-clock.h
include/dt-bindings/gpio/tegra-gpio.h
include/linux/acpi.h
include/linux/acpi_io.h
include/linux/clk-provider.h
include/linux/clk/at91_pmc.h [moved from arch/arm/mach-at91/include/mach/at91_pmc.h with 98% similarity]
include/linux/cpufreq.h
include/linux/f2fs_fs.h
include/linux/hid-sensor-hub.h
include/linux/hid-sensor-ids.h
include/linux/ide.h
include/linux/ipv6.h
include/linux/irqchip/xtensa-mx.h [new file with mode: 0644]
include/linux/irqchip/xtensa-pic.h [new file with mode: 0644]
include/linux/iscsi_ibft.h
include/linux/kexec.h
include/linux/mm.h
include/linux/pci.h
include/linux/pci_hotplug.h
include/linux/platform_data/clocksource-nomadik-mtu.h [deleted file]
include/linux/platform_data/dma-imx-sdma.h
include/linux/platform_data/dma-imx.h
include/linux/platform_data/pinctrl-nomadik.h [deleted file]
include/linux/serial_sci.h
include/linux/sfi_acpi.h
include/linux/skbuff.h
include/linux/sunrpc/rpc_pipe_fs.h
include/linux/tboot.h
include/linux/usb.h
include/linux/usb/wusb.h
include/linux/zorro.h
include/media/omap4iss.h [new file with mode: 0644]
include/media/v4l2-fh.h
include/media/v4l2-mem2mem.h
include/media/videobuf2-core.h
include/net/ipv6.h
include/net/sock.h
include/trace/events/f2fs.h
include/uapi/linux/Kbuild
include/uapi/linux/input.h
include/uapi/linux/kexec.h
include/uapi/linux/media.h
include/uapi/linux/mic_common.h
include/uapi/linux/zorro.h [new file with mode: 0644]
include/uapi/linux/zorro_ids.h [moved from include/linux/zorro_ids.h with 100% similarity]
kernel/kexec.c
kernel/power/hibernate.c
kernel/workqueue.c
mm/mempolicy.c
net/9p/client.c
net/9p/trans_fd.c
net/9p/trans_virtio.c
net/bridge/br_private.h
net/bridge/br_stp_bpdu.c
net/core/skbuff.c
net/ipv4/tcp_memcontrol.c
net/ipv6/addrconf.c
net/ipv6/ndisc.c
net/ipv6/route.c
net/mac80211/cfg.c
net/mac80211/ibss.c
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/main.c
net/mac80211/mesh.c
net/mac80211/mlme.c
net/mac80211/rc80211_minstrel_ht.c
net/mac80211/rx.c
net/mac80211/scan.c
net/mac80211/spectmgmt.c
net/mac80211/util.c
net/rds/ib_send.c
net/sched/act_api.c
net/sched/act_csum.c
net/sched/act_gact.c
net/sched/act_ipt.c
net/sched/act_mirred.c
net/sched/act_nat.c
net/sched/act_pedit.c
net/sched/act_police.c
net/sched/act_simple.c
net/sched/act_skbedit.c
net/sctp/transport.c
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/netns.h
net/sunrpc/rpc_pipe.c
net/sunrpc/sunrpc_syms.c
net/wireless/core.c
net/wireless/ibss.c
net/wireless/nl80211.c
scripts/package/builddeb
scripts/sortextable.c
sound/pci/hda/patch_conexant.c
sound/pci/hda/patch_realtek.c
sound/soc/fsl/fsl_ssi.c
sound/usb/mixer_quirks.c
tools/power/cpupower/debug/kernel/cpufreq-test_tsc.c
tools/power/x86/turbostat/turbostat.c
tools/usb/Makefile

diff --git a/CREDITS b/CREDITS
index 4fc997d58ab2640a4b94fdcb1f363935f8a13395..4c7738f493570eb9d0c70e6db67c527bcbe6e691 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -655,6 +655,11 @@ S: Stanford University
 S: Stanford, California 94305
 S: USA
 
+N: Carlos Chinea
+E: carlos.chinea@nokia.com
+E: cch.devel@gmail.com
+D: Author of HSI Subsystem
+
 N: Randolph Chung
 E: tausq@debian.org
 D: Linux/PA-RISC hacker
index 355df43badc5d7dc34123f829bed0ef028c4539a..cf8548556c7dcb0d28cef102ae5cba261b122899 100644 (file)
            <entry>Output pad, relative to the entity. Output pads source data
            and are origins of links.</entry>
          </row>
+         <row>
+           <entry><constant>MEDIA_PAD_FL_MUST_CONNECT</constant></entry>
+           <entry>If this flag is set and the pad is linked to any other
+           pad, then at least one of those links must be enabled for the
+           entity to be able to stream. There could be temporary reasons
+           (e.g. device configuration dependent) for the pad to need
+           enabled links even when this flag isn't set; the absence of the
+           flag doesn't imply there is none.</entry>
+         </row>
        </tbody>
       </tgroup>
     </table>
index e287c8fc803b437ce34550ba88777183f66ca0cc..4165e7bfa4ff7560c0283213e53a54b1575ab2e8 100644 (file)
@@ -73,7 +73,8 @@ range from zero to the maximal number of valid planes for the currently active
 format. For the single-planar API, applications must set <structfield> plane
 </structfield> to zero.  Additional flags may be posted in the <structfield>
 flags </structfield> field.  Refer to a manual for open() for details.
-Currently only O_CLOEXEC is supported.  All other fields must be set to zero.
+Currently only O_CLOEXEC, O_RDONLY, O_WRONLY, and O_RDWR are supported.  All
+other fields must be set to zero.
 In the case of multi-planar API, every plane is exported separately using
 multiple <constant> VIDIOC_EXPBUF </constant> calls. </para>
 
@@ -170,8 +171,9 @@ multi-planar API. Otherwise this value must be set to zero. </entry>
            <entry>__u32</entry>
            <entry><structfield>flags</structfield></entry>
            <entry>Flags for the newly created file, currently only <constant>
-O_CLOEXEC </constant> is supported, refer to the manual of open() for more
-details.</entry>
+O_CLOEXEC </constant>, <constant>O_RDONLY</constant>, <constant>O_WRONLY
+</constant>, and <constant>O_RDWR</constant> are supported, refer to the manual
+of open() for more details.</entry>
          </row>
          <row>
            <entry>__s32</entry>
index 260f6a3661faff625aabda6bc3dc6ba9eda84012..1860cb3865c6b26474a2d07d3944a9858a9f07c6 100644 (file)
@@ -235,10 +235,6 @@ Wysocki <rafael.j.wysocki@intel.com>.
       named object's type in the second column).  In that case the object's
       directory in sysfs will contain the 'path' attribute whose value is
       the full path to the node from the namespace root.
-      struct acpi_device objects are created for the ACPI namespace nodes
-      whose _STA control methods return PRESENT or FUNCTIONING.  The power
-      resource nodes or nodes without _STA are assumed to be both PRESENT
-      and FUNCTIONING.
    F:
       The struct acpi_device object is created for a fixed hardware
       feature (as indicated by the fixed feature flag's name in the second
@@ -340,7 +336,7 @@ Wysocki <rafael.j.wysocki@intel.com>.
      | +-------------+-------+----------------+
      |   |
      |   | +- - - - - - - +- - - - - - +- - - - - - - -+
-     |   +-| PNP0C0D:00 | \_SB_.LID0 | acpi:PNP0C0D: |
+     |   +-| PNP0C0D:00 | \_SB_.LID0 | acpi:PNP0C0D: |
      |   | +- - - - - - - +- - - - - - +- - - - - - - -+
      |   |
      |   | +------------+------------+-----------------------+
@@ -390,6 +386,3 @@ Wysocki <rafael.j.wysocki@intel.com>.
             attribute (as described earlier in this document).
    NOTE: N/A indicates the device object does not have the 'path' or the
          'modalias' attribute.
-   NOTE: The PNP0C0D device listed above is highlighted (marked by "*")
-         to indicate it will be created only when its _STA methods return
-         PRESENT or FUNCTIONING.
diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
new file mode 100644 (file)
index 0000000..1e61113
--- /dev/null
@@ -0,0 +1,18 @@
+* Renesas R-Car SATA
+
+Required properties:
+- compatible           : should contain one of the following:
+                         - "renesas,sata-r8a7779" for R-Car H1
+                         - "renesas,sata-r8a7790" for R-Car H2
+                         - "renesas,sata-r8a7791" for R-Car M2
+- reg                  : address and length of the SATA registers;
+- interrupts           : must consist of one interrupt specifier.
+
+Example:
+
+sata: sata@fc600000 {
+       compatible = "renesas,sata-r8a7779";
+       reg = <0xfc600000 0x2000>;
+       interrupt-parent = <&gic>;
+       interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
+};
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 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 4fa814d3832124adb80f29ee777849739acbb7e4..68b83ecc385007216d391f1a0edf06527dad5fb9 100644 (file)
@@ -42,6 +42,7 @@ The full ID of peripheral types can be found below.
        19      IPU Memory
        20      ASRC
        21      ESAI
+       22      SSI Dual FIFO   (needs firmware ver >= 2)
 
 The third cell specifies the transfer priority as below.
 
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:
 
diff --git a/Documentation/devicetree/bindings/interrupt-controller/marvell,dove-pmu-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/marvell,dove-pmu-intc.txt
new file mode 100644 (file)
index 0000000..1feb582
--- /dev/null
@@ -0,0 +1,17 @@
+Marvell Dove Power Management Unit interrupt controller
+
+Required properties:
+- compatible: shall be "marvell,dove-pmu-intc"
+- reg: base address of PMU interrupt registers starting with CAUSE register
+- interrupts: PMU interrupt of the main interrupt controller
+- interrupt-controller: identifies the node as an interrupt controller
+- #interrupt-cells: number of cells to encode an interrupt source, shall be 1
+
+Example:
+       pmu_intc: pmu-interrupt-ctrl@d0050 {
+               compatible = "marvell,dove-pmu-intc";
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               reg = <0xd0050 0x8>;
+               interrupts = <33>;
+       };
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 48b259e29e873f71f3ccfd0a6877bffa609ebd39..bad381faf036e936d9d99a6baff5d1e053cc2cdd 100644 (file)
@@ -4,7 +4,7 @@ This file provides information, what the device node
 for the davinci_emac interface contains.
 
 Required properties:
-- compatible: "ti,davinci-dm6467-emac";
+- compatible: "ti,davinci-dm6467-emac" or "ti,am3517-emac"
 - reg: Offset and length of the register set for the device
 - ti,davinci-ctrl-reg-offset: offset to control register
 - ti,davinci-ctrl-mod-reg-offset: offset to control module register
index 353eca0efbf83a3469542af53811e3c20255bcfe..d1706ea8257230121f2843bd7684faccd160198b 100644 (file)
@@ -52,12 +52,25 @@ Required properties for pin configuration node:
   CONFIG can be 0 or 1, meaning Pullup disable/enable.
 
 
+The iomux controller has gpio child nodes which are embedded in the iomux
+control registers. They have to be defined as child nodes of the iomux device
+node. If gpio subnodes are defined "#address-cells", "#size-cells" and "ranges"
+properties for the iomux device node are required.
 
 Example:
 
 iomuxc: iomuxc@10015000 {
        compatible = "fsl,imx27-iomuxc";
        reg = <0x10015000 0x600>;
+       #address-cells = <1>;
+       #size-cells = <1>;
+       ranges;
+
+       gpio1: gpio@10015000 {
+               ...
+       };
+
+       ...
 
        uart {
                pinctrl_uart1: uart-1 {
@@ -83,6 +96,15 @@ The above example using macros:
 iomuxc: iomuxc@10015000 {
        compatible = "fsl,imx27-iomuxc";
        reg = <0x10015000 0x600>;
+       #address-cells = <1>;
+       #size-cells = <1>;
+       ranges;
+
+       gpio1: gpio@10015000 {
+               ...
+       };
+
+       ...
 
        uart {
                pinctrl_uart1: uart-1 {
diff --git a/Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt b/Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt
new file mode 100644 (file)
index 0000000..6ad1adf
--- /dev/null
@@ -0,0 +1,53 @@
+* Renesas SH-Mobile Serial Communication Interface
+
+Required properties:
+- compatible : Should be "renesas,sci-<port type>-uart", where <port type> may be
+  SCI, SCIF, IRDA, SCIFA or SCIFB.
+- reg : Address and length of the register set for the device
+- interrupts : Should contain the following IRQs: ERI, RXI, TXI and BRI.
+- cell-index : The device id.
+- renesas,scscr : Should contain a bitfield used by the Serial Control Register.
+  b7 = SCSCR_TIE
+  b6 = SCSCR_RIE
+  b5 = SCSCR_TE
+  b4 = SCSCR_RE
+  b3 = SCSCR_REIE
+  b2 = SCSCR_TOIE
+  b1 = SCSCR_CKE1
+  b0 = SCSCR_CKE0
+- renesas,scbrr-algo-id : Algorithm ID for the Bit Rate Register
+  1 = SCBRR_ALGO_1 ((clk + 16 * bps) / (16 * bps) - 1)
+  2 = SCBRR_ALGO_2 ((clk + 16 * bps) / (32 * bps) - 1)
+  3 = SCBRR_ALGO_3 (((clk * 2) + 16 * bps) / (16 * bps) - 1)
+  4 = SCBRR_ALGO_4 (((clk * 2) + 16 * bps) / (32 * bps) - 1)
+  5 = SCBRR_ALGO_5 (((clk * 1000 / 32) / bps) - 1)
+
+Optional properties:
+- renesas,autoconf : Set if device is capable of auto configuration
+- renesas,regtype : Overwrite the register layout. In most cases you can rely
+  on auto-probing (omit this property or set to 0) but some legacy devices
+  use a non-default register layout. Possible layouts are
+  0 = SCIx_PROBE_REGTYPE (default)
+  1 = SCIx_SCI_REGTYPE
+  2 = SCIx_IRDA_REGTYPE
+  3 = SCIx_SCIFA_REGTYPE
+  4 = SCIx_SCIFB_REGTYPE
+  5 = SCIx_SH2_SCIF_FIFODATA_REGTYPE
+  6 = SCIx_SH3_SCIF_REGTYPE
+  7 = SCIx_SH4_SCIF_REGTYPE
+  8 = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE
+  9 = SCIx_SH4_SCIF_FIFODATA_REGTYPE
+ 10 = SCIx_SH7705_SCIF_REGTYPE
+
+
+Example:
+       sci@0xe6c50000 {
+               compatible = "renesas,sci-SCIFA-uart";
+               interrupt-parent = <&intca>;
+               reg = <0xe6c50000 0x100>;
+               interrupts = <0x0c20>, <0x0c20>, <0x0c20>, <0x0c20>;
+               cell-index = <1>;
+               renesas,scscr = <0x30>;
+               renesas,scbrr-algo-id = <4>;
+               renesas,autoconf;
+       };
index edbb8d88c85e90e3e1760ef3d6f25e98d96e3e37..545e5b650285e71dc60f007119d0db1183abb576 100644 (file)
@@ -26,9 +26,11 @@ cortina      Cortina Systems, Inc.
 dallas Maxim Integrated Products (formerly Dallas Semiconductor)
 davicom        DAVICOM Semiconductor, Inc.
 denx   Denx Software Engineering
+dmo    Data Modul AG
 emmicro        EM Microelectronic
 epson  Seiko Epson Corp.
 est    ESTeem Wireless Modems
+eukrea  Eukréa Electromatique
 fsl    Freescale Semiconductor
 GEFanuc        GE Fanuc Intelligent Platforms Embedded Systems, Inc.
 gef    GE Fanuc Intelligent Platforms Embedded Systems, Inc.
@@ -77,6 +79,7 @@ toshiba       Toshiba Corporation
 toumaz Toumaz
 v3     V3 Semiconductor
 via    VIA Technologies, Inc.
+voipac Voipac Technologies s.r.o.
 winbond Winbond Electronics corp.
 wlf    Wolfson Microelectronics
 wm     Wondermedia Technologies, Inc.
index c263740f0cba83b5c3f17e95ecae83326da06458..0f5bba9aa02d47f49e8773623e3ae2c54f6c7957 100644 (file)
@@ -2,6 +2,10 @@ Kernel driver it87
 ==================
 
 Supported chips:
+  * IT8603E
+    Prefix: 'it8603'
+    Addresses scanned: from Super I/O config space (8 I/O ports)
+    Datasheet: Not publicly available
   * IT8705F
     Prefix: 'it87'
     Addresses scanned: from Super I/O config space (8 I/O ports)
@@ -90,7 +94,7 @@ motherboard models.
 Description
 -----------
 
-This driver implements support for the IT8705F, IT8712F, IT8716F,
+This driver implements support for the IT8603E, IT8705F, IT8712F, IT8716F,
 IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E, IT8771E, IT8772E,
 IT8782F, IT8783E/F, and SiS950 chips.
 
@@ -129,6 +133,10 @@ to userspace applications.
 The IT8728F, IT8771E, and IT8772E are considered compatible with the IT8721F,
 until a datasheet becomes available (hopefully.)
 
+The IT8603E is a custom design, hardware monitoring part is similar to
+IT8728F. It only supports 16-bit fan mode, the full speed mode of the
+fan is not supported (value 0 of pwmX_enable).
+
 Temperatures are measured in degrees Celsius. An alarm is triggered once
 when the Overtemperature Shutdown limit is crossed.
 
@@ -145,13 +153,16 @@ alarm is triggered if the voltage has crossed a programmable minimum or
 maximum limit. Note that minimum in this case always means 'closest to
 zero'; this is important for negative voltage measurements. All voltage
 inputs can measure voltages between 0 and 4.08 volts, with a resolution of
-0.016 volt (except IT8721F/IT8758E and IT8728F: 0.012 volt.) The battery
-voltage in8 does not have limit registers.
-
-On the IT8721F/IT8758E, IT8782F, and IT8783E/F, some voltage inputs are
-internal and scaled inside the chip (in7 (optional for IT8782F and IT8783E/F),
-in8 and optionally in3). The driver handles this transparently so user-space
-doesn't have to care.
+0.016 volt (except IT8603E, IT8721F/IT8758E and IT8728F: 0.012 volt.) The
+battery voltage in8 does not have limit registers.
+
+On the IT8603E, IT8721F/IT8758E, IT8782F, and IT8783E/F, some voltage inputs
+are internal and scaled inside the chip:
+* in3 (optional)
+* in7 (optional for IT8782F and IT8783E/F)
+* in8 (always)
+* in9 (relevant for IT8603E only)
+The driver handles this transparently so user-space doesn't have to care.
 
 The VID lines (IT8712F/IT8716F/IT8718F/IT8720F) encode the core voltage value:
 the voltage level your processor should work with. This is hardcoded by
diff --git a/Documentation/kmsg/s390/zcrypt b/Documentation/kmsg/s390/zcrypt
new file mode 100644 (file)
index 0000000..7fb2087
--- /dev/null
@@ -0,0 +1,20 @@
+/*?
+ * Text: "Cryptographic device %x failed and was set offline\n"
+ * Severity: Error
+ * Parameter:
+ *   @1: device index
+ * Description:
+ * A cryptographic device failed to process a cryptographic request.
+ * The cryptographic device driver could not correct the error and
+ * set the device offline. The application that issued the
+ * request received an indication that the request has failed.
+ * User action:
+ * Use the lszcrypt command to confirm that the cryptographic
+ * hardware is still configured to your LPAR or z/VM guest virtual
+ * machine. If the device is available to your Linux instance the
+ * command output contains a line that begins with 'card<device index>',
+ * where <device index> is the two-digit decimal number in the message text.
+ * After ensuring that the device is available, use the chzcrypt command to
+ * set it online again.
+ * If the error persists, contact your support organization.
+ */
index 0c980ad40b17be5c34a271c87c7983e112620d6b..4d17487d5ad9e5b4f10008c6b817636fcae53494 100644 (file)
@@ -313,7 +313,7 @@ static struct mic_device_desc *get_device_desc(struct mic_info *mic, int type)
        int i;
        void *dp = get_dp(mic, type);
 
-       for (i = mic_aligned_size(struct mic_bootparam); i < PAGE_SIZE;
+       for (i = sizeof(struct mic_bootparam); i < PAGE_SIZE;
                i += mic_total_desc_size(d)) {
                d = dp + i;
 
@@ -445,8 +445,8 @@ init_vr(struct mic_info *mic, int fd, int type,
                __func__, mic->name, vr0->va, vr0->info, vr_size,
                vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN));
        mpsslog("magic 0x%x expected 0x%x\n",
-               vr0->info->magic, MIC_MAGIC + type);
-       assert(vr0->info->magic == MIC_MAGIC + type);
+               le32toh(vr0->info->magic), MIC_MAGIC + type);
+       assert(le32toh(vr0->info->magic) == MIC_MAGIC + type);
        if (vr1) {
                vr1->va = (struct mic_vring *)
                        &va[MIC_DEVICE_PAGE_END + vr_size];
@@ -458,8 +458,8 @@ init_vr(struct mic_info *mic, int fd, int type,
                        __func__, mic->name, vr1->va, vr1->info, vr_size,
                        vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN));
                mpsslog("magic 0x%x expected 0x%x\n",
-                       vr1->info->magic, MIC_MAGIC + type + 1);
-               assert(vr1->info->magic == MIC_MAGIC + type + 1);
+                       le32toh(vr1->info->magic), MIC_MAGIC + type + 1);
+               assert(le32toh(vr1->info->magic) == MIC_MAGIC + type + 1);
        }
 done:
        return va;
@@ -520,7 +520,7 @@ static void *
 virtio_net(void *arg)
 {
        static __u8 vnet_hdr[2][sizeof(struct virtio_net_hdr)];
-       static __u8 vnet_buf[2][MAX_NET_PKT_SIZE] __aligned(64);
+       static __u8 vnet_buf[2][MAX_NET_PKT_SIZE] __attribute__ ((aligned(64)));
        struct iovec vnet_iov[2][2] = {
                { { .iov_base = vnet_hdr[0], .iov_len = sizeof(vnet_hdr[0]) },
                  { .iov_base = vnet_buf[0], .iov_len = sizeof(vnet_buf[0]) } },
@@ -1412,6 +1412,12 @@ mic_config(void *arg)
        }
 
        do {
+               ret = lseek(fd, 0, SEEK_SET);
+               if (ret < 0) {
+                       mpsslog("%s: Failed to seek to file start '%s': %s\n",
+                               mic->name, pathname, strerror(errno));
+                       goto close_error1;
+               }
                ret = read(fd, value, sizeof(value));
                if (ret < 0) {
                        mpsslog("%s: Failed to read sysfs entry '%s': %s\n",
diff --git a/Documentation/video4linux/omap4_camera.txt b/Documentation/video4linux/omap4_camera.txt
new file mode 100644 (file)
index 0000000..25d9b40
--- /dev/null
@@ -0,0 +1,60 @@
+                              OMAP4 ISS Driver
+                              ================
+
+Introduction
+------------
+
+The OMAP44XX family of chips contains the Imaging SubSystem (a.k.a. ISS),
+Which contains several components that can be categorized in 3 big groups:
+
+- Interfaces (2 Interfaces: CSI2-A & CSI2-B/CCP2)
+- ISP (Image Signal Processor)
+- SIMCOP (Still Image Coprocessor)
+
+For more information, please look in [1] for latest version of:
+       "OMAP4430 Multimedia Device Silicon Revision 2.x"
+
+As of Revision AB, the ISS is described in detail in section 8.
+
+This driver is supporting _only_ the CSI2-A/B interfaces for now.
+
+It makes use of the Media Controller framework [2], and inherited most of the
+code from OMAP3 ISP driver (found under drivers/media/platform/omap3isp/*),
+except that it doesn't need an IOMMU now for ISS buffers memory mapping.
+
+Supports usage of MMAP buffers only (for now).
+
+Tested platforms
+----------------
+
+- OMAP4430SDP, w/ ES2.1 GP & SEVM4430-CAM-V1-0 (Contains IMX060 & OV5640, in
+  which only the last one is supported, outputting YUV422 frames).
+
+- TI Blaze MDP, w/ OMAP4430 ES2.2 EMU (Contains 1 IMX060 & 2 OV5650 sensors, in
+  which only the OV5650 are supported, outputting RAW10 frames).
+
+- PandaBoard, Rev. A2, w/ OMAP4430 ES2.1 GP & OV adapter board, tested with
+  following sensors:
+  * OV5640
+  * OV5650
+
+- Tested on mainline kernel:
+
+       http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary
+
+  Tag: v3.3 (commit c16fa4f2ad19908a47c63d8fa436a1178438c7e7)
+
+File list
+---------
+drivers/staging/media/omap4iss/
+include/media/omap4iss.h
+
+References
+----------
+
+[1] http://focus.ti.com/general/docs/wtbu/wtbudocumentcenter.tsp?navigationId=12037&templateId=6123#62
+[2] http://lwn.net/Articles/420485/
+[3] http://www.spinics.net/lists/linux-media/msg44370.html
+--
+Author: Sergio Aguirre <sergio.a.aguirre@gmail.com>
+Copyright (C) 2012, Texas Instruments
index d5829d14774a676e3f2ae93602756f2f2df8c4cb..90a64d52bea2f33464f86e4dc93954b2bc105f50 100644 (file)
@@ -95,8 +95,9 @@ The treatment of these regions depends on the type of Zorro space:
 -------------
 
 linux/include/linux/zorro.h
-linux/include/asm-{m68k,ppc}/zorro.h
-linux/include/linux/zorro_ids.h
+linux/include/uapi/linux/zorro.h
+linux/include/uapi/linux/zorro_ids.h
+linux/arch/m68k/include/asm/zorro.h
 linux/drivers/zorro
 /proc/bus/zorro
 
index 13c15c83a46ef6ac1405d6f995eed17ce18c21d0..40d490a50e858eb42dfef3b7807f1392fb35df1a 100644 (file)
@@ -2138,7 +2138,8 @@ S:        Maintained
 F:     Documentation/zh_CN/
 
 CHIPIDEA USB HIGH SPEED DUAL ROLE CONTROLLER
-M:     Alexander Shishkin <alexander.shishkin@linux.intel.com>
+M:     Peter Chen <Peter.Chen@freescale.com>
+T:     git://github.com/hzpeterchen/linux-usb.git
 L:     linux-usb@vger.kernel.org
 S:     Maintained
 F:     drivers/usb/chipidea/
@@ -4044,6 +4045,14 @@ W:       http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi
 S:     Maintained
 F:     fs/hpfs/
 
+HSI SUBSYSTEM
+M:     Sebastian Reichel <sre@debian.org>
+S:     Maintained
+F:     Documentation/ABI/testing/sysfs-bus-hsi
+F:     drivers/hsi/
+F:     include/linux/hsi/
+F:     include/uapi/linux/hsi/
+
 HSO 3G MODEM DRIVER
 M:     Jan Dumon <j.dumon@option.com>
 W:     http://www.pharscape.org
@@ -4462,10 +4471,8 @@ M:       Bruce Allan <bruce.w.allan@intel.com>
 M:     Carolyn Wyborny <carolyn.wyborny@intel.com>
 M:     Don Skidmore <donald.c.skidmore@intel.com>
 M:     Greg Rose <gregory.v.rose@intel.com>
-M:     Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
 M:     Alex Duyck <alexander.h.duyck@intel.com>
 M:     John Ronciak <john.ronciak@intel.com>
-M:     Tushar Dave <tushar.n.dave@intel.com>
 L:     e1000-devel@lists.sourceforge.net
 W:     http://www.intel.com/support/feedback.htm
 W:     http://e1000.sourceforge.net/
index 2ee0c9bfd0325537a5d9299649abac4992b722f5..9063ae6553ccb7a0a220b8db667ac770627addbf 100644 (file)
@@ -8,6 +8,7 @@
 
 config ARC
        def_bool y
+       select BUILDTIME_EXTABLE_SORT
        select CLONE_BACKWARDS
        # ARC Busybox based initramfs absolutely relies on DEVTMPFS for /dev
        select DEVTMPFS if !INITRAMFS_SOURCE=""
index eefc29f08cdbe4ba0ea3f4b12d8f1234d59c0527..5d06eee43ea9a18ddd8876ac66c7c6d5fed29ec6 100644 (file)
@@ -46,14 +46,14 @@ extern int smp_ipi_irq_setup(int cpu, int irq);
  *
  * @info:              SoC SMP specific info for /proc/cpuinfo etc
  * @cpu_kick:          For Master to kickstart a cpu (optionally at a PC)
- * @ipi_send:          To send IPI to a @cpumask
- * @ips_clear:         To clear IPI received by @cpu at @irq
+ * @ipi_send:          To send IPI to a @cpu
+ * @ips_clear:         To clear IPI received at @irq
  */
 struct plat_smp_ops {
        const char      *info;
        void            (*cpu_kick)(int cpu, unsigned long pc);
-       void            (*ipi_send)(void *callmap);
-       void            (*ipi_clear)(int cpu, int irq);
+       void            (*ipi_send)(int cpu);
+       void            (*ipi_clear)(int irq);
 };
 
 /* TBD: stop exporting it for direct population by platform */
index 6f30484f34b78c5fa5052e68bbcbd3b4280a193f..68125dd766c68feeb9de6715c9d1694ed24e5491 100644 (file)
@@ -8,6 +8,9 @@
 
 /******** no-legacy-syscalls-ABI *******/
 
+#ifndef _UAPI_ASM_ARC_UNISTD_H
+#define _UAPI_ASM_ARC_UNISTD_H
+
 #define __ARCH_WANT_SYS_EXECVE
 #define __ARCH_WANT_SYS_CLONE
 #define __ARCH_WANT_SYS_VFORK
@@ -32,3 +35,5 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls)
 /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
 #define __NR_sysfs             (__NR_arch_specific_syscall + 3)
 __SYSCALL(__NR_sysfs, sys_sysfs)
+
+#endif
index e46d81f709797a868b7cc68cc81ef71277a0f070..63177e4cb66d0d3a323b3e53081d4caaf2550ac0 100644 (file)
@@ -79,9 +79,9 @@ static int arc_pmu_cache_event(u64 config)
        cache_result    = (config >> 16) & 0xff;
        if (cache_type >= PERF_COUNT_HW_CACHE_MAX)
                return -EINVAL;
-       if (cache_type >= PERF_COUNT_HW_CACHE_OP_MAX)
+       if (cache_op >= PERF_COUNT_HW_CACHE_OP_MAX)
                return -EINVAL;
-       if (cache_type >= PERF_COUNT_HW_CACHE_RESULT_MAX)
+       if (cache_result >= PERF_COUNT_HW_CACHE_RESULT_MAX)
                return -EINVAL;
 
        ret = arc_pmu_cache_map[cache_type][cache_op][cache_result];
index c2f9ebbc38f61f819a0194fcc08de77ebdb5beb4..40859e5619f914115ba010641094aa3a3ca5a8b3 100644 (file)
@@ -197,51 +197,65 @@ int __init setup_profiling_timer(unsigned int multiplier)
 /*              Inter Processor Interrupt Handling                           */
 /*****************************************************************************/
 
-/*
- * structures for inter-processor calls
- * A Collection of single bit ipi messages
- *
- */
-
-/*
- * TODO_rajesh investigate tlb message types.
- * IPI Timer not needed because each ARC has an individual Interrupting Timer
- */
 enum ipi_msg_type {
-       IPI_NOP = 0,
+       IPI_EMPTY = 0,
        IPI_RESCHEDULE = 1,
        IPI_CALL_FUNC,
-       IPI_CPU_STOP
+       IPI_CPU_STOP,
 };
 
-struct ipi_data {
-       unsigned long bits;
-};
+/*
+ * In arches with IRQ for each msg type (above), receiver can use IRQ-id  to
+ * figure out what msg was sent. For those which don't (ARC has dedicated IPI
+ * IRQ), the msg-type needs to be conveyed via per-cpu data
+ */
 
-static DEFINE_PER_CPU(struct ipi_data, ipi_data);
+static DEFINE_PER_CPU(unsigned long, ipi_data);
 
-static void ipi_send_msg(const struct cpumask *callmap, enum ipi_msg_type msg)
+static void ipi_send_msg_one(int cpu, enum ipi_msg_type msg)
 {
+       unsigned long __percpu *ipi_data_ptr = per_cpu_ptr(&ipi_data, cpu);
+       unsigned long old, new;
        unsigned long flags;
-       unsigned int cpu;
+
+       pr_debug("%d Sending msg [%d] to %d\n", smp_processor_id(), msg, cpu);
 
        local_irq_save(flags);
 
-       for_each_cpu(cpu, callmap) {
-               struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
-               set_bit(msg, &ipi->bits);
-       }
+       /*
+        * Atomically write new msg bit (in case others are writing too),
+        * and read back old value
+        */
+       do {
+               new = old = *ipi_data_ptr;
+               new |= 1U << msg;
+       } while (cmpxchg(ipi_data_ptr, old, new) != old);
 
-       /* Call the platform specific cross-CPU call function  */
-       if (plat_smp_ops.ipi_send)
-               plat_smp_ops.ipi_send((void *)callmap);
+       /*
+        * Call the platform specific IPI kick function, but avoid if possible:
+        * Only do so if there's no pending msg from other concurrent sender(s).
+        * Otherwise, recevier will see this msg as well when it takes the
+        * IPI corresponding to that msg. This is true, even if it is already in
+        * IPI handler, because !@old means it has not yet dequeued the msg(s)
+        * so @new msg can be a free-loader
+        */
+       if (plat_smp_ops.ipi_send && !old)
+               plat_smp_ops.ipi_send(cpu);
 
        local_irq_restore(flags);
 }
 
+static void ipi_send_msg(const struct cpumask *callmap, enum ipi_msg_type msg)
+{
+       unsigned int cpu;
+
+       for_each_cpu(cpu, callmap)
+               ipi_send_msg_one(cpu, msg);
+}
+
 void smp_send_reschedule(int cpu)
 {
-       ipi_send_msg(cpumask_of(cpu), IPI_RESCHEDULE);
+       ipi_send_msg_one(cpu, IPI_RESCHEDULE);
 }
 
 void smp_send_stop(void)
@@ -254,7 +268,7 @@ void smp_send_stop(void)
 
 void arch_send_call_function_single_ipi(int cpu)
 {
-       ipi_send_msg(cpumask_of(cpu), IPI_CALL_FUNC);
+       ipi_send_msg_one(cpu, IPI_CALL_FUNC);
 }
 
 void arch_send_call_function_ipi_mask(const struct cpumask *mask)
@@ -265,33 +279,29 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
 /*
  * ipi_cpu_stop - handle IPI from smp_send_stop()
  */
-static void ipi_cpu_stop(unsigned int cpu)
+static void ipi_cpu_stop(void)
 {
        machine_halt();
 }
 
-static inline void __do_IPI(unsigned long *ops, struct ipi_data *ipi, int cpu)
+static inline void __do_IPI(unsigned long msg)
 {
-       unsigned long msg = 0;
+       switch (msg) {
+       case IPI_RESCHEDULE:
+               scheduler_ipi();
+               break;
 
-       do {
-               msg = find_next_bit(ops, BITS_PER_LONG, msg+1);
+       case IPI_CALL_FUNC:
+               generic_smp_call_function_interrupt();
+               break;
 
-               switch (msg) {
-               case IPI_RESCHEDULE:
-                       scheduler_ipi();
-                       break;
-
-               case IPI_CALL_FUNC:
-                       generic_smp_call_function_interrupt();
-                       break;
-
-               case IPI_CPU_STOP:
-                       ipi_cpu_stop(cpu);
-                       break;
-               }
-       } while (msg < BITS_PER_LONG);
+       case IPI_CPU_STOP:
+               ipi_cpu_stop();
+               break;
 
+       default:
+               pr_warn("IPI with unexpected msg %ld\n", msg);
+       }
 }
 
 /*
@@ -300,19 +310,25 @@ static inline void __do_IPI(unsigned long *ops, struct ipi_data *ipi, int cpu)
  */
 irqreturn_t do_IPI(int irq, void *dev_id)
 {
-       int cpu = smp_processor_id();
-       struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
-       unsigned long ops;
+       unsigned long pending;
+
+       pr_debug("IPI [%ld] received on cpu %d\n",
+                *this_cpu_ptr(&ipi_data), smp_processor_id());
 
        if (plat_smp_ops.ipi_clear)
-               plat_smp_ops.ipi_clear(cpu, irq);
+               plat_smp_ops.ipi_clear(irq);
 
        /*
-        * XXX: is this loop really needed
-        * And do we need to move ipi_clean inside
+        * "dequeue" the msg corresponding to this IPI (and possibly other
+        * piggybacked msg from elided IPIs: see ipi_send_msg_one() above)
         */
-       while ((ops = xchg(&ipi->bits, 0)) != 0)
-               __do_IPI(&ops, ipi, cpu);
+       pending = xchg(this_cpu_ptr(&ipi_data), 0);
+
+       do {
+               unsigned long msg = __ffs(pending);
+               __do_IPI(msg);
+               pending &= ~(1U << msg);
+       } while (pending);
 
        return IRQ_HANDLED;
 }
index 91b55349a5f8a9d82a9f59de19aaf8ee68b1a706..8a12741f5f7ab79668212259036fe0c2872bb037 100644 (file)
@@ -88,18 +88,14 @@ void iss_model_init_smp(unsigned int cpu)
        smp_ipi_irq_setup(cpu, IDU_INTERRUPT_0 + cpu);
 }
 
-static void iss_model_ipi_send(void *arg)
+static void iss_model_ipi_send(int cpu)
 {
-       struct cpumask *callmap = arg;
-       unsigned int cpu;
-
-       for_each_cpu(cpu, callmap)
-               idu_irq_assert(cpu);
+       idu_irq_assert(cpu);
 }
 
-static void iss_model_ipi_clear(int cpu, int irq)
+static void iss_model_ipi_clear(int irq)
 {
-       idu_irq_clear(IDU_INTERRUPT_0 + cpu);
+       idu_irq_clear(IDU_INTERRUPT_0 + smp_processor_id());
 }
 
 void iss_model_init_early_smp(void)
index c1f1a7eee953de4378b1f74bd4907c969f96dceb..91145080ee4da9d8d86e1ec88d11da561c33f11b 100644 (file)
@@ -644,8 +644,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 SH-Mobile / R-Mobile (non-multiplatform)"
+       select ARCH_SHMOBILE
        select ARM_PATCH_PHYS_VIRT
        select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
@@ -660,7 +661,8 @@ 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's SH-Mobile and R-Mobile ARM platforms using
+         a non-multiplatform kernel.
 
 config ARCH_RPC
        bool "RiscPC"
@@ -723,11 +725,13 @@ config ARCH_S3C64XX
        bool "Samsung S3C64XX"
        select ARCH_HAS_CPUFREQ
        select ARCH_REQUIRE_GPIOLIB
+       select ARM_AMBA
        select ARM_VIC
        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
@@ -1611,7 +1615,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
@@ -1796,8 +1800,8 @@ 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 "11"
index 5765abf5ce84576d8de31df83d709160905d7b19..9d7e057618bd4f78a50ae356f9e7f6999e3a5018 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
@@ -255,6 +267,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 +916,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 +951,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 || \
@@ -1150,4 +1171,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 c99b1086d83dfa8c0c407bab392ff5bb12927ab5..1edf8ebd8494967d8466c79ecbb79cfcc266e3b7 100644 (file)
@@ -190,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
diff --git a/arch/arm/arm-soc-for-next-contents.txt b/arch/arm/arm-soc-for-next-contents.txt
new file mode 100644 (file)
index 0000000..81e6e46
--- /dev/null
@@ -0,0 +1,39 @@
+Contents of arm-soc branches contained in for-next
+
+
+next/cleanup
+       renesas/cleanup
+               git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-cleanup-for-v3.14
+       mvebu/soc
+               git://git.infradead.org/linux-mvebu.git tags/mvebu-soc-3.14
+       at91/sama5-ccf
+               git://github.com/at91linux/linux-at91.git tags/at91-cleanup
+
+next/soc
+       patches
+               ARM: ep93xx: remove deprecated IRQF_DISABLED
+               ARM: ep93xx: use soc bus
+       soc/sched_clock
+               local branch: rebased onto tip/timers-core-for-linus for dependencies
+
+next/dt
+       ux500/dt
+               git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson tags/ux500-devicetree-v3.14-1
+       mvebu/dt
+               git://git.infradead.org/linux-mvebu.git tags/mvebu-dt-3.14
+       sti/dt
+               http://git.stlinux.com/devel/kernel/linux-sti.git tags/DT-for-v3.14-part-1
+
+next/boards
+       renesas/defconfig
+               git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-defconfig-for-v3.14
+       mvebu/defconfig
+               git://git.infradead.org/linux-mvebu.git tags/mvebu-defconfig-3.14
+       patch
+               ARM: multi_v7_defconfig: Fix STi support
+
+next/drivers
+       mvebu/drivers
+               git://git.infradead.org/linux-mvebu.git tags/mvebu-drivers-3.14
+       samsung/s3c64xx-dmaengine
+               git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc.git tags/s3c64xx-dmaengine
index e7190bb5998e149906a4763e815712953c7421f5..f54d5a25c7ee1c0b7803c94179bc5c30f7d7d66b 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
 
index d57c1a65b24f981fb25c62aa58c73c1fedd84ab8..88ca947f3a9fb586079983b98ea3cd1252821d92 100644 (file)
@@ -90,6 +90,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.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 \
@@ -114,32 +115,47 @@ 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) += \
+       imx25-eukrea-mbimxsd25-baseboard.dtb \
        imx25-karo-tx25.dtb \
        imx25-pdk.dtb \
        imx27-apf27.dtb \
        imx27-apf27dev.dtb \
        imx27-pdk.dtb \
-       imx27-phytec-phycore-som.dtb \
        imx27-phytec-phycore-rdk.dtb \
        imx27-phytec-phycard-s-som.dtb \
        imx27-phytec-phycard-s-rdk.dtb \
        imx31-bug.dtb \
+       imx50-evk.dtb \
        imx51-apf51.dtb \
        imx51-apf51dev.dtb \
        imx51-babbage.dtb \
+       imx51-eukrea-mbimxsd51-baseboard.dtb \
        imx53-ard.dtb \
        imx53-evk.dtb \
        imx53-m53evk.dtb \
        imx53-mba53.dtb \
        imx53-qsb.dtb \
        imx53-smd.dtb \
+       imx53-voipac-bsb.dtb \
+       imx6dl-gw51xx.dtb \
+       imx6dl-gw52xx.dtb \
+       imx6dl-gw53xx.dtb \
+       imx6dl-gw54xx.dtb \
        imx6dl-sabreauto.dtb \
        imx6dl-sabresd.dtb \
        imx6dl-wandboard.dtb \
        imx6q-arm2.dtb \
+       imx6q-cm-fx6.dtb \
+       imx6q-dmo-edmqmx6.dtb \
+       imx6q-gw51xx.dtb \
+       imx6q-gw52xx.dtb \
+       imx6q-gw53xx.dtb \
+       imx6q-gw5400-a.dtb \
+       imx6q-gw54xx.dtb \
        imx6q-phytec-pbab01.dtb \
        imx6q-sabreauto.dtb \
        imx6q-sabrelite.dtb \
@@ -163,6 +179,9 @@ dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
        imx28-cfa10056.dtb \
        imx28-cfa10057.dtb \
        imx28-cfa10058.dtb \
+       imx28-duckbill.dtb \
+       imx28-eukrea-mbmx283lc.dtb \
+       imx28-eukrea-mbmx287lc.dtb \
        imx28-evk.dtb \
        imx28-m28cu3.dtb \
        imx28-m28evk.dtb \
@@ -216,8 +235,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 \
@@ -225,6 +245,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
        r8a7779-marzen.dtb \
        r8a7779-marzen-reference.dtb \
        r8a7791-koelsch.dtb \
+       r8a7791-koelsch-reference.dtb \
        r8a7790-lager.dtb \
        r8a7790-lager-reference.dtb \
        sh73a0-kzm9g.dtb \
@@ -232,7 +253,9 @@ dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.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-reference.dtb
 dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \
        socfpga_cyclone5_socdk.dtb \
        socfpga_cyclone5_sockit.dtb \
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..6a7383f24c7caba8e629d940c3c74ddd58c9a0d6 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>;
                                };
                        };
                                        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..272e2e2fc58fff00c7bb084508ed8c08fc0b3dde 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>;
                                };
                        };
                                        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 7f10f627ae5b72b7f560732c6e8d5bb35b943e69..45839e53538e9c05e4005603c586abd650a3c744 100644 (file)
                                status = "disabled";
                        };
 
+                       nand@d0000 {
+                               compatible = "marvell,armada370-nand";
+                               reg = <0xd0000 0x54>;
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               interrupts = <113>;
+                               clocks = <&coredivclk 0>;
+                               status = "disabled";
+                       };
                };
        };
 
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..f048b4e
--- /dev/null
@@ -0,0 +1,322 @@
+/*
+ * 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";
+
+                               /* 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 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 {
index 9b186ac06c8ba2fbeff30f9bd58f6ca797e1b05d..42cef0a8ce95e31ada8a27a72cfc8edf965244ee 100644 (file)
                };
        };
 
-       dwmmc0@12200000 {
+       mmc@12200000 {
                num-slots = <1>;
                supports-highspeed;
                broken-cd;
                };
        };
 
-       dwmmc1@12210000 {
+       mmc@12210000 {
                status = "disabled";
        };
 
-       dwmmc2@12220000 {
+       mmc@12220000 {
                num-slots = <1>;
                supports-highspeed;
                fifo-depth = <0x80>;
                };
        };
 
-       dwmmc3@12230000 {
+       mmc@12230000 {
                num-slots = <1>;
                supports-highspeed;
                broken-cd;
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..db24b41a5264072dc74d39d2497b1be72e8a2d93 100644 (file)
                                marvell,#interrupts = <5>;
                        };
 
+                       pmu_intc: pmu-interrupt-ctrl@d0050 {
+                               compatible = "marvell,dove-pmu-intc";
+                               interrupt-controller;
+                               #interrupt-cells = <1>;
+                               reg = <0xd0050 0x8>;
+                               interrupts = <33>;
+                               marvell,#interrupts = <7>;
+                       };
+
                        core_clk: core-clocks@d0214 {
                                compatible = "marvell,dove-core-clock";
                                reg = <0xd0214 0x4>;
                        rtc: real-time-clock@d8500 {
                                compatible = "marvell,orion-rtc";
                                reg = <0xd8500 0x20>;
+                               interrupt-parent = <&pmu_intc>;
+                               interrupts = <5>;
                        };
 
                        crypto: crypto-engine@30000 {
                                status = "disabled";
 
                                ethphy: ethernet-phy {
-                                       device-type = "ethernet-phy";
+                                       device_type = "ethernet-phy";
                                        /* set phy address in board file */
                                };
                        };
index 861aa7d6fc7dbc480c0b9d6b185d6a291d38fcd2..baaa66cc39bfb4a4e2faabf2edc273778006faa2 100644 (file)
@@ -9,7 +9,9 @@
  */
 /dts-v1/;
 
-/include/ "emev2.dtsi"
+#include "emev2.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 
 / {
        model = "EMEV2 KZM9D Board";
                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..256c2f8b9d0a859ce11d6e10f2f30d1ae2ecbc7c 100644 (file)
@@ -8,7 +8,7 @@
  * kind, whether express or implied.
  */
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
        compatible = "renesas,emev2";
                             <0 121 4>;
        };
 
+       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>;
+               clocks = <&sti_sclk>;
+               clock-names = "sclk";
        };
 
        uart@e1020000 {
                compatible = "renesas,em-uart";
                reg = <0xe1020000 0x38>;
                interrupts = <0 8 0>;
+               clocks = <&usia_u0_sclk>;
+               clock-names = "sclk";
        };
 
        uart@e1030000 {
                compatible = "renesas,em-uart";
                reg = <0xe1030000 0x38>;
                interrupts = <0 9 0>;
+               clocks = <&usib_u1_sclk>;
+               clock-names = "sclk";
        };
 
        uart@e1040000 {
                compatible = "renesas,em-uart";
                reg = <0xe1040000 0x38>;
                interrupts = <0 10 0>;
+               clocks = <&usib_u2_sclk>;
+               clock-names = "sclk";
        };
 
        uart@e1050000 {
                compatible = "renesas,em-uart";
                reg = <0xe1050000 0x38>;
                interrupts = <0 11 0>;
+               clocks = <&usib_u3_sclk>;
+               clock-names = "sclk";
        };
 
        gpio0: gpio@e0050000 {
index 074739d39e2db04490c3575fbb2131519f6cf53d..e52b038a7a1171ac1559b86b5d3a18cdfb144ff8 100644 (file)
                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..b77a37ec81c25b89affa2f90d8ef7007b0d4072a 100644 (file)
                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";
        };
index f86d56760a45a0f42692f5636376c899f81edbc3..13746dfb20aae1307f4ec9ef7636d89a83cb173a 100644 (file)
                };
        };
 
-       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";
        };
index fd711e245e8d311f392bedfed7bb48dee4d4b7e6..a9395c426db44a7ddaeefd3b56040928a8f06e2f 100644 (file)
         * On Snow we've got SIP WiFi and so can keep drive strengths low to
         * reduce EMI.
         */
-       dwmmc3@12230000 {
+       mmc@12230000 {
                slot@0 {
                        pinctrl-names = "default";
                        pinctrl-0 = <&sd3_clk &sd3_cmd &sd3_bus4>;
index 9db5047812f3d6c05a36643abbea0e1fb33e8195..b98ffc3a5fe289514a661cd5b5b7099c1c044be5 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;
                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 {
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..b1fa334ec6d71c4031a3e691226e80935b900f9d 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;
@@ -31,6 +34,8 @@
                i2c1 = &i2c_1;
                i2c2 = &i2c_2;
                i2c3 = &i2c_3;
+               gsc0 = &gsc_0;
+               gsc1 = &gsc_1;
        };
 
        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 {
                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>;
                };
        };
 
                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>;
+       };
 };
index 1f026adefd451e594628d1855acf949f9cd7d7cf..a33f66c11b73edbf3671f02017e7780704c36b05 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_vddio_sd0: vddio-sd0 {
+               reg_vddio_sd0: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "vddio-sd0";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        gpio = <&gpio1 29 0>;
                };
 
-               reg_lcd_3v3: lcd-3v3 {
+               reg_lcd_3v3: regulator@1 {
                        compatible = "regulator-fixed";
+                       reg = <1>;
                        regulator-name = "lcd-3v3";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
index 526bfdbd87f9f84f08747c6c045c059a657d2cbc..7e6eef2488e807c12c36aaebfd3e64b076f7622f 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_usb0_vbus: usb0_vbus {
+               reg_usb0_vbus: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "usb0_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
index cb64e2b191ea1ae48098c1c79ced4afe6f57b521..455169e99d49b5ad5388e8122012f3f6f6e27f72 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_vddio_sd0: vddio-sd0 {
+               reg_vddio_sd0: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "vddio-sd0";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
diff --git a/arch/arm/boot/dts/imx25-eukrea-cpuimx25.dtsi b/arch/arm/boot/dts/imx25-eukrea-cpuimx25.dtsi
new file mode 100644 (file)
index 0000000..8abd45a
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.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 "imx25.dtsi"
+
+/ {
+       model = "Eukrea CPUIMX25";
+       compatible = "eukrea,cpuimx25", "fsl,imx25";
+
+       memory {
+               reg = <0x80000000 0x4000000>; /* 64M */
+       };
+};
+
+&fec {
+       phy-mode = "rmii";
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec>;
+       status = "okay";
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       pcf8563@51 {
+               compatible = "nxp,pcf8563";
+               reg = <0x51>;
+       };
+};
+
+&iomuxc {
+       imx25-eukrea-cpuimx25 {
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <MX25_FEC_PINGRP1>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX25_I2C1_PINGRP1>;
+               };
+       };
+};
+
+&nfc {
+       nand-bus-width = <8>;
+       nand-ecc-mode = "hw";
+       nand-on-flash-bbt;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts
new file mode 100644 (file)
index 0000000..3570f88
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.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.
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include "imx25-eukrea-cpuimx25.dtsi"
+
+/ {
+       model = "Eukrea MBIMXSD25";
+       compatible = "eukrea,mbimxsd25-baseboard", "eukrea,cpuimx25", "fsl,imx25";
+
+       gpio_keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpiokeys>;
+
+               bp1 {
+                       label = "BP1";
+                       gpios = <&gpio3 18 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_MISC>;
+                       gpio-key,wakeup;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpioled>;
+
+               led1 {
+                       label = "led1";
+                       gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
+};
+
+&esdhc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_esdhc1>;
+       cd-gpios = <&gpio1 20>;
+       status = "okay";
+};
+
+&i2c1 {
+       tlv320aic23: codec@1a {
+               compatible = "ti,tlv320aic23";
+               reg = <0x1a>;
+       };
+};
+
+&iomuxc {
+       imx25-eukrea-mbimxsd25-baseboard {
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX25_AUDMUX_PINGRP1>;
+               };
+
+               pinctrl_esdhc1: esdhc1grp {
+                       fsl,pins = <MX25_ESDHC1_PINGRP1>;
+               };
+
+               pinctrl_gpiokeys: gpiokeysgrp {
+                       fsl,pins = <MX25_PAD_VSTBY_ACK__GPIO_3_18 0x80000000>;
+               };
+
+               pinctrl_gpioled: gpioledgrp {
+                       fsl,pins = <MX25_PAD_POWER_FAIL__GPIO_3_19 0x80000000>;
+               };
+
+               pinctrl_lcdc: lcdcgrp {
+                       fsl,pins = <MX25_LCDC_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX25_UART1_PINGRP1>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX25_UART2_PINGRP1>;
+               };
+       };
+};
+
+&ssi1 {
+       fsl,mode = "i2s-slave";
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       fsl,uart-has-rtscts;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       fsl,uart-has-rtscts;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx25-pinfunc.h b/arch/arm/boot/dts/imx25-pinfunc.h
new file mode 100644 (file)
index 0000000..9238a95
--- /dev/null
@@ -0,0 +1,494 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.com>
+ * Based on imx35-pinfunc.h in the same directory Which is:
+ * Copyright 2013 Freescale Semiconductor, 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.
+ *
+ */
+
+#ifndef __DTS_IMX25_PINFUNC_H
+#define __DTS_IMX25_PINFUNC_H
+
+/*
+ * The pin function ID is a tuple of
+ * <mux_reg conf_reg input_reg mux_mode input_val>
+ */
+
+#define MX25_PAD_A10__A10                      0x008 0x000 0x000 0x00 0x000
+#define MX25_PAD_A10__GPIO_4_0                 0x008 0x000 0x000 0x05 0x000
+
+#define MX25_PAD_A13__A13                      0x00c 0x22C 0x000 0x00 0x000
+#define MX25_PAD_A13__GPIO_4_1                 0x00c 0x22C 0x000 0x05 0x000
+
+#define MX25_PAD_A14__A14                      0x010 0x230 0x000 0x10 0x000
+#define MX25_PAD_A14__GPIO_2_0                 0x010 0x230 0x000 0x15 0x000
+
+#define MX25_PAD_A15__A15                      0x014 0x234 0x000 0x10 0x000
+#define MX25_PAD_A15__GPIO_2_1                 0x014 0x234 0x000 0x15 0x000
+
+#define MX25_PAD_A16__A16                      0x018 0x000 0x000 0x10 0x000
+#define MX25_PAD_A16__GPIO_2_2                 0x018 0x000 0x000 0x15 0x000
+
+#define MX25_PAD_A17__A17                      0x01c 0x238 0x000 0x10 0x000
+#define MX25_PAD_A17__GPIO_2_3                 0x01c 0x238 0x000 0x15 0x000
+
+#define MX25_PAD_A18__A18                      0x020 0x23c 0x000 0x10 0x000
+#define MX25_PAD_A18__GPIO_2_4                 0x020 0x23c 0x000 0x15 0x000
+#define MX25_PAD_A18__FEC_COL                  0x020 0x23c 0x504 0x17 0x000
+
+#define MX25_PAD_A19__A19                      0x024 0x240 0x000 0x10 0x000
+#define MX25_PAD_A19__FEC_RX_ER                        0x024 0x240 0x518 0x17 0x000
+#define MX25_PAD_A19__GPIO_2_5                 0x024 0x240 0x000 0x15 0x000
+
+#define MX25_PAD_A20__A20                      0x028 0x244 0x000 0x10 0x000
+#define MX25_PAD_A20__GPIO_2_6                 0x028 0x244 0x000 0x15 0x000
+#define MX25_PAD_A20__FEC_RDATA2               0x028 0x244 0x50c 0x17 0x000
+
+#define MX25_PAD_A21__A21                      0x02c 0x248 0x000 0x10 0x000
+#define MX25_PAD_A21__GPIO_2_7                 0x02c 0x248 0x000 0x15 0x000
+#define MX25_PAD_A21__FEC_RDATA3               0x02c 0x248 0x510 0x17 0x000
+
+#define MX25_PAD_A22__A22                      0x030 0x000 0x000 0x10 0x000
+#define MX25_PAD_A22__GPIO_2_8                 0x030 0x000 0x000 0x15 0x000
+
+#define MX25_PAD_A23__A23                      0x034 0x24c 0x000 0x10 0x000
+#define MX25_PAD_A23__GPIO_2_9                 0x034 0x24c 0x000 0x15 0x000
+
+#define MX25_PAD_A24__A24                      0x038 0x250 0x000 0x10 0x000
+#define MX25_PAD_A24__GPIO_2_10                        0x038 0x250 0x000 0x15 0x000
+#define MX25_PAD_A24__FEC_RX_CLK               0x038 0x250 0x514 0x17 0x000
+
+#define MX25_PAD_A25__A25                      0x03c 0x254 0x000 0x10 0x000
+#define MX25_PAD_A25__GPIO_2_11                        0x03c 0x254 0x000 0x15 0x000
+#define MX25_PAD_A25__FEC_CRS                  0x03c 0x254 0x508 0x17 0x000
+
+#define MX25_PAD_EB0__EB0                      0x040 0x258 0x000 0x10 0x000
+#define MX25_PAD_EB0__AUD4_TXD                 0x040 0x258 0x464 0x14 0x000
+#define MX25_PAD_EB0__GPIO_2_12                        0x040 0x258 0x000 0x15 0x000
+
+#define MX25_PAD_EB1__EB1                      0x044 0x25c 0x000 0x10 0x000
+#define MX25_PAD_EB1__AUD4_RXD                 0x044 0x25c 0x460 0x14 0x000
+#define MX25_PAD_EB1__GPIO_2_13                        0x044 0x25c 0x000 0x15 0x000
+
+#define MX25_PAD_OE__OE                                0x048 0x260 0x000 0x10 0x000
+#define MX25_PAD_OE__AUD4_TXC                  0x048 0x260 0x000 0x14 0x000
+#define MX25_PAD_OE__GPIO_2_14                 0x048 0x260 0x000 0x15 0x000
+
+#define MX25_PAD_CS0__CS0                      0x04c 0x000 0x000 0x00 0x000
+#define MX25_PAD_CS0__GPIO_4_2                 0x04c 0x000 0x000 0x05 0x000
+
+#define MX25_PAD_CS1__CS1                      0x050 0x000 0x000 0x00 0x000
+#define MX25_PAD_CS1__NF_CE3                   0x050 0x000 0x000 0x01 0x000
+#define MX25_PAD_CS1__GPIO_4_3                 0x050 0x000 0x000 0x05 0x000
+
+#define MX25_PAD_CS4__CS4                      0x054 0x264 0x000 0x10 0x000
+#define MX25_PAD_CS4__NF_CE1                   0x054 0x264 0x000 0x01 0x000
+#define MX25_PAD_CS4__UART5_CTS                        0x054 0x264 0x000 0x13 0x000
+#define MX25_PAD_CS4__GPIO_3_20                        0x054 0x264 0x000 0x15 0x000
+
+#define MX25_PAD_CS5__CS5                      0x058 0x268 0x000 0x10 0x000
+#define MX25_PAD_CS5__NF_CE2                   0x058 0x268 0x000 0x01 0x000
+#define MX25_PAD_CS5__UART5_RTS                        0x058 0x268 0x574 0x13 0x000
+#define MX25_PAD_CS5__GPIO_3_21                        0x058 0x268 0x000 0x15 0x000
+
+#define MX25_PAD_NF_CE0__NF_CE0                        0x05c 0x26c 0x000 0x10 0x000
+#define MX25_PAD_NF_CE0__GPIO_3_22             0x05c 0x26c 0x000 0x15 0x000
+
+#define MX25_PAD_ECB__ECB                      0x060 0x270 0x000 0x10 0x000
+#define MX25_PAD_ECB__UART5_TXD_MUX            0x060 0x270 0x000 0x13 0x000
+#define MX25_PAD_ECB__GPIO_3_23                        0x060 0x270 0x000 0x15 0x000
+
+#define MX25_PAD_LBA__LBA                      0x064 0x274 0x000 0x10 0x000
+#define MX25_PAD_LBA__UART5_RXD_MUX            0x064 0x274 0x578 0x13 0x000
+#define MX25_PAD_LBA__GPIO_3_24                        0x064 0x274 0x000 0x15 0x000
+
+#define MX25_PAD_BCLK__BCLK                    0x068 0x000 0x000 0x00 0x000
+#define MX25_PAD_BCLK__GPIO_4_4                        0x068 0x000 0x000 0x05 0x000
+
+#define MX25_PAD_RW__RW                                0x06c 0x278 0x000 0x10 0x000
+#define MX25_PAD_RW__AUD4_TXFS                 0x06c 0x278 0x474 0x14 0x000
+#define MX25_PAD_RW__GPIO_3_25                 0x06c 0x278 0x000 0x15 0x000
+
+#define MX25_PAD_NFWE_B__NFWE_B                        0x070 0x000 0x000 0x10 0x000
+#define MX25_PAD_NFWE_B__GPIO_3_26             0x070 0x000 0x000 0x15 0x000
+
+#define MX25_PAD_NFRE_B__NFRE_B                        0x074 0x000 0x000 0x10 0x000
+#define MX25_PAD_NFRE_B__GPIO_3_27             0x074 0x000 0x000 0x15 0x000
+
+#define MX25_PAD_NFALE__NFALE                  0x078 0x000 0x000 0x10 0x000
+#define MX25_PAD_NFALE__GPIO_3_28              0x078 0x000 0x000 0x15 0x000
+
+#define MX25_PAD_NFCLE__NFCLE                  0x07c 0x000 0x000 0x10 0x000
+#define MX25_PAD_NFCLE__GPIO_3_29              0x07c 0x000 0x000 0x15 0x000
+
+#define MX25_PAD_NFWP_B__NFWP_B                        0x080 0x000 0x000 0x10 0x000
+#define MX25_PAD_NFWP_B__GPIO_3_30             0x080 0x000 0x000 0x15 0x000
+
+#define MX25_PAD_NFRB__NFRB                    0x084 0x27c 0x000 0x10 0x000
+#define MX25_PAD_NFRB__GPIO_3_31               0x084 0x27c 0x000 0x15 0x000
+
+#define MX25_PAD_D15__D15                      0x088 0x280 0x000 0x00 0x000
+#define MX25_PAD_D15__LD16                     0x088 0x280 0x000 0x01 0x000
+#define MX25_PAD_D15__GPIO_4_5                 0x088 0x280 0x000 0x05 0x000
+
+#define MX25_PAD_D14__D14                      0x08c 0x284 0x000 0x00 0x000
+#define MX25_PAD_D14__LD17                     0x08c 0x284 0x000 0x01 0x000
+#define MX25_PAD_D14__GPIO_4_6                 0x08c 0x284 0x000 0x05 0x000
+
+#define MX25_PAD_D13__D13                      0x090 0x288 0x000 0x00 0x000
+#define MX25_PAD_D13__LD18                     0x090 0x288 0x000 0x01 0x000
+#define MX25_PAD_D13__GPIO_4_7                 0x090 0x288 0x000 0x05 0x000
+
+#define MX25_PAD_D12__D12                      0x094 0x28c 0x000 0x00 0x000
+#define MX25_PAD_D12__GPIO_4_8                 0x094 0x28c 0x000 0x05 0x000
+
+#define MX25_PAD_D11__D11                      0x098 0x290 0x000 0x00 0x000
+#define MX25_PAD_D11__GPIO_4_9                 0x098 0x290 0x000 0x05 0x000
+
+#define MX25_PAD_D10__D10                      0x09c 0x294 0x000 0x00 0x000
+#define MX25_PAD_D10__GPIO_4_10                        0x09c 0x294 0x000 0x05 0x000
+#define MX25_PAD_D10__USBOTG_OC                        0x09c 0x294 0x57c 0x06 0x000
+
+#define MX25_PAD_D9__D9                                0x0a0 0x298 0x000 0x00 0x000
+#define MX25_PAD_D9__GPIO_4_11                 0x0a0 0x298 0x000 0x05 0x000
+#define MX25_PAD_D9__USBH2_PWR                 0x0a0 0x298 0x000 0x06 0x000
+
+#define MX25_PAD_D8__D8                                0x0a4 0x29c 0x000 0x00 0x000
+#define MX25_PAD_D8__GPIO_4_12                 0x0a4 0x29c 0x000 0x05 0x000
+#define MX25_PAD_D8__USBH2_OC                  0x0a4 0x29c 0x580 0x06 0x000
+
+#define MX25_PAD_D7__D7                                0x0a8 0x2a0 0x000 0x00 0x000
+#define MX25_PAD_D7__GPIO_4_13                 0x0a8 0x2a0 0x000 0x05 0x000
+
+#define MX25_PAD_D6__D6                                0x0ac 0x2a4 0x000 0x00 0x000
+#define MX25_PAD_D6__GPIO_4_14                 0x0ac 0x2a4 0x000 0x05 0x000
+
+#define MX25_PAD_D5__D5                                0x0b0 0x2a8 0x000 0x00 0x000
+#define MX25_PAD_D5__GPIO_4_15                 0x0b0 0x2a8 0x000 0x05 0x000
+
+#define MX25_PAD_D4__D4                                0x0b4 0x2ac 0x000 0x00 0x000
+#define MX25_PAD_D4__GPIO_4_16                 0x0b4 0x2ac 0x000 0x05 0x000
+
+#define MX25_PAD_D3__D3                                0x0b8 0x2b0 0x000 0x00 0x000
+#define MX25_PAD_D3__GPIO_4_17                 0x0b8 0x2b0 0x000 0x05 0x000
+
+#define MX25_PAD_D2__D2                                0x0bc 0x2b4 0x000 0x00 0x000
+#define MX25_PAD_D2__GPIO_4_18                 0x0bc 0x2b4 0x000 0x05 0x000
+
+#define MX25_PAD_D1__D1                                0x0c0 0x2b8 0x000 0x00 0x000
+#define MX25_PAD_D1__GPIO_4_19                 0x0c0 0x2b8 0x000 0x05 0x000
+
+#define MX25_PAD_D0__D0                                0x0c4 0x2bc 0x000 0x00 0x000
+#define MX25_PAD_D0__GPIO_4_20                 0x0c4 0x2bc 0x000 0x05 0x000
+
+#define MX25_PAD_LD0__LD0                      0x0c8 0x2c0 0x000 0x10 0x000
+#define MX25_PAD_LD0__CSI_D0                   0x0c8 0x2c0 0x488 0x12 0x000
+#define MX25_PAD_LD0__GPIO_2_15                        0x0c8 0x2c0 0x000 0x15 0x000
+
+#define MX25_PAD_LD1__LD1                      0x0cc 0x2c4 0x000 0x10 0x000
+#define MX25_PAD_LD1__CSI_D1                   0x0cc 0x2c4 0x48c 0x12 0x000
+#define MX25_PAD_LD1__GPIO_2_16                        0x0cc 0x2c4 0x000 0x15 0x000
+
+#define MX25_PAD_LD2__LD2                      0x0d0 0x2c8 0x000 0x10 0x000
+#define MX25_PAD_LD2__GPIO_2_17                        0x0d0 0x2c8 0x000 0x15 0x000
+
+#define MX25_PAD_LD3__LD3                      0x0d4 0x2cc 0x000 0x10 0x000
+#define MX25_PAD_LD3__GPIO_2_18                        0x0d4 0x2cc 0x000 0x15 0x000
+
+#define MX25_PAD_LD4__LD4                      0x0d8 0x2d0 0x000 0x10 0x000
+#define MX25_PAD_LD4__GPIO_2_19                        0x0d8 0x2d0 0x000 0x15 0x000
+
+#define MX25_PAD_LD5__LD5                      0x0dc 0x2d4 0x000 0x10 0x000
+#define MX25_PAD_LD5__GPIO_1_19                        0x0dc 0x2d4 0x000 0x15 0x000
+
+#define MX25_PAD_LD6__LD6                      0x0e0 0x2d8 0x000 0x10 0x000
+#define MX25_PAD_LD6__GPIO_1_20                        0x0e0 0x2d8 0x000 0x15 0x000
+
+#define MX25_PAD_LD7__LD7                      0x0e4 0x2dc 0x000 0x10 0x000
+#define MX25_PAD_LD7__GPIO_1_21                        0x0e4 0x2dc 0x000 0x15 0x000
+
+#define MX25_PAD_LD8__LD8                      0x0e8 0x2e0 0x000 0x10 0x000
+#define MX25_PAD_LD8__FEC_TX_ERR               0x0e8 0x2e0 0x000 0x15 0x000
+
+#define MX25_PAD_LD9__LD9                      0x0ec 0x2e4 0x000 0x10 0x000
+#define MX25_PAD_LD9__FEC_COL                  0x0ec 0x2e4 0x504 0x15 0x001
+
+#define MX25_PAD_LD10__LD10                    0x0f0 0x2e8 0x000 0x10 0x000
+#define MX25_PAD_LD10__FEC_RX_ER               0x0f0 0x2e8 0x518 0x15 0x001
+
+#define MX25_PAD_LD11__LD11                    0x0f4 0x2ec 0x000 0x10 0x000
+#define MX25_PAD_LD11__FEC_RDATA2              0x0f4 0x2ec 0x50c 0x15 0x001
+
+#define MX25_PAD_LD12__LD12                    0x0f8 0x2f0 0x000 0x10 0x000
+#define MX25_PAD_LD12__FEC_RDATA3              0x0f8 0x2f0 0x510 0x15 0x001
+
+#define MX25_PAD_LD13__LD13                    0x0fc 0x2f4 0x000 0x10 0x000
+#define MX25_PAD_LD13__FEC_TDATA2              0x0fc 0x2f4 0x000 0x15 0x000
+
+#define MX25_PAD_LD14__LD14                    0x100 0x2f8 0x000 0x10 0x000
+#define MX25_PAD_LD14__FEC_TDATA3              0x100 0x2f8 0x000 0x15 0x000
+
+#define MX25_PAD_LD15__LD15                    0x104 0x2fc 0x000 0x10 0x000
+#define MX25_PAD_LD15__FEC_RX_CLK              0x104 0x2fc 0x514 0x15 0x001
+
+#define MX25_PAD_HSYNC__HSYNC                  0x108 0x300 0x000 0x10 0x000
+#define MX25_PAD_HSYNC__GPIO_1_22              0x108 0x300 0x000 0x15 0x000
+
+#define MX25_PAD_VSYNC__VSYNC                  0x10c 0x304 0x000 0x10 0x000
+#define MX25_PAD_VSYNC__GPIO_1_23              0x10c 0x304 0x000 0x15 0x000
+
+#define MX25_PAD_LSCLK__LSCLK                  0x110 0x308 0x000 0x10 0x000
+#define MX25_PAD_LSCLK__GPIO_1_24              0x110 0x308 0x000 0x15 0x000
+
+#define MX25_PAD_OE_ACD__OE_ACD                        0x114 0x30c 0x000 0x10 0x000
+#define MX25_PAD_OE_ACD__GPIO_1_25             0x114 0x30c 0x000 0x15 0x000
+
+#define MX25_PAD_CONTRAST__CONTRAST            0x118 0x310 0x000 0x10 0x000
+#define MX25_PAD_CONTRAST__PWM4_PWMO           0x118 0x310 0x000 0x14 0x000
+#define MX25_PAD_CONTRAST__FEC_CRS             0x118 0x310 0x508 0x15 0x001
+
+#define MX25_PAD_PWM__PWM                      0x11c 0x314 0x000 0x10 0x000
+#define MX25_PAD_PWM__GPIO_1_26                        0x11c 0x314 0x000 0x15 0x000
+#define MX25_PAD_PWM__USBH2_OC                 0x11c 0x314 0x580 0x16 0x001
+
+#define MX25_PAD_CSI_D2__CSI_D2                        0x120 0x318 0x000 0x10 0x000
+#define MX25_PAD_CSI_D2__UART5_RXD_MUX         0x120 0x318 0x578 0x11 0x001
+#define MX25_PAD_CSI_D2__GPIO_1_27             0x120 0x318 0x000 0x15 0x000
+#define MX25_PAD_CSI_D2__CSPI3_MOSI            0x120 0x318 0x000 0x17 0x000
+
+#define MX25_PAD_CSI_D3__CSI_D3                        0x124 0x31c 0x000 0x10 0x000
+#define MX25_PAD_CSI_D3__GPIO_1_28             0x124 0x31c 0x000 0x15 0x000
+#define MX25_PAD_CSI_D3__CSPI3_MISO            0x124 0x31c 0x4b4 0x17 0x001
+
+#define MX25_PAD_CSI_D4__CSI_D4                        0x128 0x320 0x000 0x10 0x000
+#define MX25_PAD_CSI_D4__UART5_RTS             0x128 0x320 0x574 0x11 0x001
+#define MX25_PAD_CSI_D4__GPIO_1_29             0x128 0x320 0x000 0x15 0x000
+#define MX25_PAD_CSI_D4__CSPI3_SCLK            0x128 0x320 0x000 0x17 0x000
+
+#define MX25_PAD_CSI_D5__CSI_D5                        0x12c 0x324 0x000 0x10 0x000
+#define MX25_PAD_CSI_D5__GPIO_1_30             0x12c 0x324 0x000 0x15 0x000
+#define MX25_PAD_CSI_D5__CSPI3_RDY             0x12c 0x324 0x000 0x17 0x000
+
+#define MX25_PAD_CSI_D6__CSI_D6                        0x130 0x328 0x000 0x10 0x000
+#define MX25_PAD_CSI_D6__GPIO_1_31             0x130 0x328 0x000 0x15 0x000
+
+#define MX25_PAD_CSI_D7__CSI_D7                        0x134 0x32c 0x000 0x10 0x000
+#define MX25_PAD_CSI_D7__GPIO_1_6              0x134 0x32c 0x000 0x15 0x000
+
+#define MX25_PAD_CSI_D8__CSI_D8                        0x138 0x330 0x000 0x10 0x000
+#define MX25_PAD_CSI_D8__GPIO_1_7              0x138 0x330 0x000 0x15 0x000
+
+#define MX25_PAD_CSI_D9__CSI_D9                        0x13c 0x334 0x000 0x10 0x000
+#define MX25_PAD_CSI_D9__GPIO_4_21             0x13c 0x334 0x000 0x15 0x000
+
+#define MX25_PAD_CSI_MCLK__CSI_MCLK            0x140 0x338 0x000 0x10 0x000
+#define MX25_PAD_CSI_MCLK__GPIO_1_8            0x140 0x338 0x000 0x15 0x000
+
+#define MX25_PAD_CSI_VSYNC__CSI_VSYNC          0x144 0x33c 0x000 0x10 0x000
+#define MX25_PAD_CSI_VSYNC__GPIO_1_9           0x144 0x33c 0x000 0x15 0x000
+
+#define MX25_PAD_CSI_HSYNC__CSI_HSYNC          0x148 0x340 0x000 0x10 0x000
+#define MX25_PAD_CSI_HSYNC__GPIO_1_10          0x148 0x340 0x000 0x15 0x000
+
+#define MX25_PAD_CSI_PIXCLK__CSI_PIXCLK                0x14c 0x344 0x000 0x10 0x000
+#define MX25_PAD_CSI_PIXCLK__GPIO_1_11         0x14c 0x344 0x000 0x15 0x000
+
+#define MX25_PAD_I2C1_CLK__I2C1_CLK            0x150 0x348 0x000 0x10 0x000
+#define MX25_PAD_I2C1_CLK__GPIO_1_12           0x150 0x348 0x000 0x15 0x000
+
+#define MX25_PAD_I2C1_DAT__I2C1_DAT            0x154 0x34c 0x000 0x10 0x000
+#define MX25_PAD_I2C1_DAT__GPIO_1_13           0x154 0x34c 0x000 0x15 0x000
+
+#define MX25_PAD_CSPI1_MOSI__CSPI1_MOSI                0x158 0x350 0x000 0x10 0x000
+#define MX25_PAD_CSPI1_MOSI__GPIO_1_14         0x158 0x350 0x000 0x15 0x000
+
+#define MX25_PAD_CSPI1_MISO__CSPI1_MISO                0x15c 0x354 0x000 0x10 0x000
+#define MX25_PAD_CSPI1_MISO__GPIO_1_15         0x15c 0x354 0x000 0x15 0x000
+
+#define MX25_PAD_CSPI1_SS0__CSPI1_SS0          0x160 0x358 0x000 0x10 0x000
+#define MX25_PAD_CSPI1_SS0__GPIO_1_16          0x160 0x358 0x000 0x15 0x000
+
+#define MX25_PAD_CSPI1_SS1__CSPI1_SS1          0x164 0x35c 0x000 0x10 0x000
+#define MX25_PAD_CSPI1_SS1__GPIO_1_17          0x164 0x35c 0x000 0x15 0x000
+
+#define MX25_PAD_CSPI1_SCLK__CSPI1_SCLK                0x168 0x360 0x000 0x10 0x000
+#define MX25_PAD_CSPI1_SCLK__GPIO_1_18         0x168 0x360 0x000 0x15 0x000
+
+#define MX25_PAD_CSPI1_RDY__CSPI1_RDY          0x16c 0x364 0x000 0x10 0x000
+#define MX25_PAD_CSPI1_RDY__GPIO_2_22          0x16c 0x364 0x000 0x15 0x000
+
+#define MX25_PAD_UART1_RXD__UART1_RXD          0x170 0x368 0x000 0x10 0x000
+#define MX25_PAD_UART1_RXD__GPIO_4_22          0x170 0x368 0x000 0x15 0x000
+
+#define MX25_PAD_UART1_TXD__UART1_TXD          0x174 0x36c 0x000 0x10 0x000
+#define MX25_PAD_UART1_TXD__GPIO_4_23          0x174 0x36c 0x000 0x15 0x000
+
+#define MX25_PAD_UART1_RTS__UART1_RTS          0x178 0x370 0x000 0x10 0x000
+#define MX25_PAD_UART1_RTS__CSI_D0             0x178 0x370 0x488 0x11 0x001
+#define MX25_PAD_UART1_RTS__GPIO_4_24          0x178 0x370 0x000 0x15 0x000
+
+#define MX25_PAD_UART1_CTS__UART1_CTS          0x17c 0x374 0x000 0x10 0x000
+#define MX25_PAD_UART1_CTS__CSI_D1             0x17c 0x374 0x48c 0x11 0x001
+#define MX25_PAD_UART1_CTS__GPIO_4_25          0x17c 0x374 0x000 0x15 0x000
+
+#define MX25_PAD_UART2_RXD__UART2_RXD          0x180 0x378 0x000 0x10 0x000
+#define MX25_PAD_UART2_RXD__GPIO_4_26          0x180 0x378 0x000 0x15 0x000
+
+#define MX25_PAD_UART2_TXD__UART2_TXD          0x184 0x37c 0x000 0x10 0x000
+#define MX25_PAD_UART2_TXD__GPIO_4_27          0x184 0x37c 0x000 0x15 0x000
+
+#define MX25_PAD_UART2_RTS__UART2_RTS          0x188 0x380 0x000 0x10 0x000
+#define MX25_PAD_UART2_RTS__FEC_COL            0x188 0x380 0x504 0x12 0x002
+#define MX25_PAD_UART2_RTS__GPIO_4_28          0x188 0x380 0x000 0x15 0x000
+
+#define MX25_PAD_UART2_CTS__FEC_RX_ER          0x18c 0x384 0x518 0x12 0x002
+#define MX25_PAD_UART2_CTS__UART2_CTS          0x18c 0x384 0x000 0x10 0x000
+#define MX25_PAD_UART2_CTS__GPIO_4_29          0x18c 0x384 0x000 0x15 0x000
+
+#define MX25_PAD_SD1_CMD__SD1_CMD              0x190 0x388 0x000 0x10 0x000
+#define MX25_PAD_SD1_CMD__FEC_RDATA2           0x190 0x388 0x50c 0x12 0x002
+#define MX25_PAD_SD1_CMD__GPIO_2_23            0x190 0x388 0x000 0x15 0x000
+
+#define MX25_PAD_SD1_CLK__SD1_CLK              0x194 0x38c 0x000 0x10 0x000
+#define MX25_PAD_SD1_CLK__FEC_RDATA3           0x194 0x38c 0x510 0x12 0x002
+#define MX25_PAD_SD1_CLK__GPIO_2_24            0x194 0x38c 0x000 0x15 0x000
+
+#define MX25_PAD_SD1_DATA0__SD1_DATA0          0x198 0x390 0x000 0x10 0x000
+#define MX25_PAD_SD1_DATA0__GPIO_2_25          0x198 0x390 0x000 0x15 0x000
+
+#define MX25_PAD_SD1_DATA1__SD1_DATA1          0x19c 0x394 0x000 0x10 0x000
+#define MX25_PAD_SD1_DATA1__AUD7_RXD           0x19c 0x394 0x478 0x13 0x000
+#define MX25_PAD_SD1_DATA1__GPIO_2_26          0x19c 0x394 0x000 0x15 0x000
+
+#define MX25_PAD_SD1_DATA2__SD1_DATA2          0x1a0 0x398 0x000 0x10 0x000
+#define MX25_PAD_SD1_DATA2__FEC_RX_CLK         0x1a0 0x398 0x514 0x15 0x002
+#define MX25_PAD_SD1_DATA2__GPIO_2_27          0x1a0 0x398 0x000 0x15 0x000
+
+#define MX25_PAD_SD1_DATA3__SD1_DATA3          0x1a4 0x39c 0x000 0x10 0x000
+#define MX25_PAD_SD1_DATA3__FEC_CRS            0x1a4 0x39c 0x508 0x10 0x002
+#define MX25_PAD_SD1_DATA3__GPIO_2_28          0x1a4 0x39c 0x000 0x15 0x000
+
+#define MX25_PAD_KPP_ROW0__KPP_ROW0            0x1a8 0x3a0 0x000 0x10 0x000
+#define MX25_PAD_KPP_ROW0__GPIO_2_29           0x1a8 0x3a0 0x000 0x15 0x000
+
+#define MX25_PAD_KPP_ROW1__KPP_ROW1            0x1ac 0x3a4 0x000 0x10 0x000
+#define MX25_PAD_KPP_ROW1__GPIO_2_30           0x1ac 0x3a4 0x000 0x15 0x000
+
+#define MX25_PAD_KPP_ROW2__KPP_ROW2            0x1b0 0x3a8 0x000 0x10 0x000
+#define MX25_PAD_KPP_ROW2__CSI_D0              0x1b0 0x3a8 0x488 0x13 0x002
+#define MX25_PAD_KPP_ROW2__GPIO_2_31           0x1b0 0x3a8 0x000 0x15 0x000
+
+#define MX25_PAD_KPP_ROW3__KPP_ROW3            0x1b4 0x3ac 0x000 0x10 0x000
+#define MX25_PAD_KPP_ROW3__CSI_LD1             0x1b4 0x3ac 0x48c 0x13 0x002
+#define MX25_PAD_KPP_ROW3__GPIO_3_0            0x1b4 0x3ac 0x000 0x15 0x000
+
+#define MX25_PAD_KPP_COL0__KPP_COL0            0x1b8 0x3b0 0x000 0x10 0x000
+#define MX25_PAD_KPP_COL0__UART4_RXD_MUX       0x1b8 0x3b0 0x570 0x11 0x001
+#define MX25_PAD_KPP_COL0__AUD5_TXD            0x1b8 0x3b0 0x000 0x12 0x000
+#define MX25_PAD_KPP_COL0__GPIO_3_1            0x1b8 0x3b0 0x000 0x15 0x000
+
+#define MX25_PAD_KPP_COL1__KPP_COL1            0x1bc 0x3b4 0x000 0x10 0x000
+#define MX25_PAD_KPP_COL1__UART4_TXD_MUX       0x1bc 0x3b4 0x000 0x11 0x000
+#define MX25_PAD_KPP_COL1__AUD5_RXD            0x1bc 0x3b4 0x000 0x12 0x000
+#define MX25_PAD_KPP_COL1__GPIO_3_2            0x1bc 0x3b4 0x000 0x15 0x000
+
+#define MX25_PAD_KPP_COL2__KPP_COL2            0x1c0 0x3b8 0x000 0x10 0x000
+#define MX25_PAD_KPP_COL2__UART4_RTS           0x1c0 0x3b8 0x000 0x11 0x000
+#define MX25_PAD_KPP_COL2__AUD5_TXC            0x1c0 0x3b8 0x000 0x12 0x000
+#define MX25_PAD_KPP_COL2__GPIO_3_3            0x1c0 0x3b8 0x000 0x15 0x000
+
+#define MX25_PAD_KPP_COL3__KPP_COL3            0x1c4 0x3bc 0x000 0x10 0x000
+#define MX25_PAD_KPP_COL3__UART4_CTS           0x1c4 0x3bc 0x000 0x11 0x000
+#define MX25_PAD_KPP_COL3__AUD5_TXFS           0x1c4 0x3bc 0x000 0x12 0x000
+#define MX25_PAD_KPP_COL3__GPIO_3_4            0x1c4 0x3bc 0x000 0x15 0x000
+
+#define MX25_PAD_FEC_MDC__FEC_MDC              0x1c8 0x3c0 0x000 0x10 0x000
+#define MX25_PAD_FEC_MDC__AUD4_TXD             0x1c8 0x3c0 0x464 0x12 0x001
+#define MX25_PAD_FEC_MDC__GPIO_3_5             0x1c8 0x3c0 0x000 0x15 0x000
+
+#define MX25_PAD_FEC_MDIO__FEC_MDIO            0x1cc 0x3c4 0x000 0x10 0x000
+#define MX25_PAD_FEC_MDIO__AUD4_RXD            0x1cc 0x3c4 0x460 0x12 0x001
+#define MX25_PAD_FEC_MDIO__GPIO_3_6            0x1cc 0x3c4 0x000 0x15 0x000
+
+#define MX25_PAD_FEC_TDATA0__FEC_TDATA0                0x1d0 0x3c8 0x000 0x10 0x000
+#define MX25_PAD_FEC_TDATA0__GPIO_3_7          0x1d0 0x3c8 0x000 0x15 0x000
+
+#define MX25_PAD_FEC_TDATA1__FEC_TDATA1                0x1d4 0x3cc 0x000 0x10 0x000
+#define MX25_PAD_FEC_TDATA1__AUD4_TXFS         0x1d4 0x3cc 0x474 0x12 0x001
+#define MX25_PAD_FEC_TDATA1__GPIO_3_8          0x1d4 0x3cc 0x000 0x15 0x000
+
+#define MX25_PAD_FEC_TX_EN__FEC_TX_EN          0x1d8 0x3d0 0x000 0x10 0x000
+#define MX25_PAD_FEC_TX_EN__GPIO_3_9           0x1d8 0x3d0 0x000 0x15 0x000
+
+#define MX25_PAD_FEC_RDATA0__FEC_RDATA0                0x1dc 0x3d4 0x000 0x10 0x000
+#define MX25_PAD_FEC_RDATA0__GPIO_3_10         0x1dc 0x3d4 0x000 0x15 0x000
+
+#define MX25_PAD_FEC_RDATA1__FEC_RDATA1                0x1e0 0x3d8 0x000 0x10 0x000
+#define MX25_PAD_FEC_RDATA1__GPIO_3_11         0x1e0 0x3d8 0x000 0x15 0x000
+
+#define MX25_PAD_FEC_RX_DV__FEC_RX_DV          0x1e4 0x3dc 0x000 0x10 0x000
+#define MX25_PAD_FEC_RX_DV__CAN2_RX            0x1e4 0x3dc 0x484 0x14 0x000
+#define MX25_PAD_FEC_RX_DV__GPIO_3_12          0x1e4 0x3dc 0x000 0x15 0x000
+
+#define MX25_PAD_FEC_TX_CLK__FEC_TX_CLK                0x1e8 0x3e0 0x000 0x10 0x000
+#define MX25_PAD_FEC_TX_CLK__GPIO_3_13         0x1e8 0x3e0 0x000 0x15 0x000
+
+#define MX25_PAD_RTCK__RTCK                    0x1ec 0x3e4 0x000 0x10 0x000
+#define MX25_PAD_RTCK__OWIRE                   0x1ec 0x3e4 0x000 0x11 0x000
+#define MX25_PAD_RTCK__GPIO_3_14               0x1ec 0x3e4 0x000 0x15 0x000
+
+#define MX25_PAD_DE_B__DE_B                    0x1f0 0x3ec 0x000 0x10 0x000
+#define MX25_PAD_DE_B__GPIO_2_20               0x1f0 0x3ec 0x000 0x15 0x000
+
+#define MX25_PAD_TDO__TDO                      0x000 0x3e8 0x000 0x00 0x000
+
+#define MX25_PAD_GPIO_A__GPIO_A                        0x1f4 0x3f0 0x000 0x10 0x000
+#define MX25_PAD_GPIO_A__CAN1_TX               0x1f4 0x3f0 0x000 0x16 0x000
+#define MX25_PAD_GPIO_A__USBOTG_PWR            0x1f4 0x3f0 0x000 0x12 0x000
+
+#define MX25_PAD_GPIO_B__GPIO_B                        0x1f8 0x3f4 0x000 0x10 0x000
+#define MX25_PAD_GPIO_B__CAN1_RX               0x1f8 0x3f4 0x480 0x16 0x001
+#define MX25_PAD_GPIO_B__USBOTG_OC             0x1f8 0x3f4 0x57c 0x12 0x001
+
+#define MX25_PAD_GPIO_C__GPIO_C                        0x1fc 0x3f8 0x000 0x10 0x000
+#define MX25_PAD_GPIO_C__CAN2_TX               0x1fc 0x3f8 0x000 0x16 0x000
+
+#define MX25_PAD_GPIO_D__GPIO_D                        0x200 0x3fc 0x000 0x10 0x000
+#define MX25_PAD_GPIO_E__LD16                  0x204 0x400 0x000 0x02 0x000
+#define MX25_PAD_GPIO_D__CAN2_RX               0x200 0x3fc 0x484 0x16 0x001
+
+#define MX25_PAD_GPIO_E__GPIO_E                        0x204 0x400 0x000 0x10 0x000
+#define MX25_PAD_GPIO_F__LD17                  0x208 0x404 0x000 0x02 0x000
+#define MX25_PAD_GPIO_E__AUD7_TXD              0x204 0x400 0x000 0x14 0x000
+
+#define MX25_PAD_GPIO_F__GPIO_F                        0x208 0x404 0x000 0x10 0x000
+#define MX25_PAD_GPIO_F__AUD7_TXC              0x208 0x404 0x000 0x14 0x000
+
+#define MX25_PAD_EXT_ARMCLK__EXT_ARMCLK                0x20c 0x000 0x000 0x10 0x000
+#define MX25_PAD_EXT_ARMCLK__GPIO_3_15         0x20c 0x000 0x000 0x15 0x000
+
+#define MX25_PAD_UPLL_BYPCLK__UPLL_BYPCLK      0x210 0x000 0x000 0x10 0x000
+#define MX25_PAD_UPLL_BYPCLK__GPIO_3_16                0x210 0x000 0x000 0x15 0x000
+
+#define MX25_PAD_VSTBY_REQ__VSTBY_REQ          0x214 0x408 0x000 0x10 0x000
+#define MX25_PAD_VSTBY_REQ__AUD7_TXFS          0x214 0x408 0x000 0x14 0x000
+#define MX25_PAD_VSTBY_REQ__GPIO_3_17          0x214 0x408 0x000 0x15 0x000
+#define MX25_PAD_VSTBY_ACK__VSTBY_ACK          0x218 0x40c 0x000 0x10 0x000
+#define MX25_PAD_VSTBY_ACK__GPIO_3_18          0x218 0x40c 0x000 0x15 0x000
+
+#define MX25_PAD_POWER_FAIL__POWER_FAIL                0x21c 0x410 0x000 0x10 0x000
+#define MX25_PAD_POWER_FAIL__AUD7_RXD          0x21c 0x410 0x478 0x14 0x001
+#define MX25_PAD_POWER_FAIL__GPIO_3_19         0x21c 0x410 0x000 0x15 0x000
+
+#define MX25_PAD_CLKO__CLKO                    0x220 0x414 0x000 0x10 0x000
+#define MX25_PAD_CLKO__GPIO_2_21               0x220 0x414 0x000 0x15 0x000
+
+#define MX25_PAD_BOOT_MODE0__BOOT_MODE0                0x224 0x000 0x000 0x00 0x000
+#define MX25_PAD_BOOT_MODE0__GPIO_4_30         0x224 0x000 0x000 0x05 0x000
+#define MX25_PAD_BOOT_MODE1__BOOT_MODE1                0x228 0x000 0x000 0x00 0x000
+#define MX25_PAD_BOOT_MODE1__GPIO_4_31         0x228 0x000 0x000 0x05 0x000
+
+#endif /* __DTS_IMX25_PINFUNC_H */
diff --git a/arch/arm/boot/dts/imx25-pingrp.h b/arch/arm/boot/dts/imx25-pingrp.h
new file mode 100644 (file)
index 0000000..4a35a63
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.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 __DTS_IMX25_PINGRP_H
+#define __DTS_IMX25_PINGRP_H
+
+#include "imx25-pinfunc.h"
+
+#define MX25_AUDMUX_PINGRP1 \
+       MX25_PAD_KPP_COL3__AUD5_TXFS                    0xe0 \
+       MX25_PAD_KPP_COL2__AUD5_TXC                     0xe0 \
+       MX25_PAD_KPP_COL1__AUD5_RXD                     0xe0 \
+       MX25_PAD_KPP_COL0__AUD5_TXD                     0xe0
+
+#define MX25_ESDHC1_PINGRP1 \
+       MX25_PAD_SD1_CMD__SD1_CMD                       0x400000c0 \
+       MX25_PAD_SD1_CLK__SD1_CLK                       0x400000c0 \
+       MX25_PAD_SD1_DATA0__SD1_DATA0                   0x400000c0 \
+       MX25_PAD_SD1_DATA1__SD1_DATA1                   0x400000c0 \
+       MX25_PAD_SD1_DATA2__SD1_DATA2                   0x400000c0 \
+       MX25_PAD_SD1_DATA3__SD1_DATA3                   0x400000c0
+
+#define MX25_FEC_PINGRP1 \
+       MX25_PAD_FEC_MDC__FEC_MDC                       0x80000000 \
+       MX25_PAD_FEC_MDIO__FEC_MDIO                     0x400001e0 \
+       MX25_PAD_FEC_TDATA0__FEC_TDATA0                 0x80000000 \
+       MX25_PAD_FEC_TDATA1__FEC_TDATA1                 0x80000000 \
+       MX25_PAD_FEC_TX_EN__FEC_TX_EN                   0x80000000 \
+       MX25_PAD_FEC_RDATA0__FEC_RDATA0                 0x80000000 \
+       MX25_PAD_FEC_RDATA1__FEC_RDATA1                 0x80000000 \
+       MX25_PAD_FEC_RX_DV__FEC_RX_DV                   0x80000000 \
+       MX25_PAD_FEC_TX_CLK__FEC_TX_CLK                 0x1c0
+
+#define MX25_I2C1_PINGRP1 \
+       MX25_PAD_I2C1_CLK__I2C1_CLK                     0x80000000 \
+       MX25_PAD_I2C1_DAT__I2C1_DAT                     0x80000000
+
+#define MX25_LCDC_PINGRP1 \
+       MX25_PAD_LD0__LD0                               0x1 \
+       MX25_PAD_LD1__LD1                               0x1 \
+       MX25_PAD_LD2__LD2                               0x1 \
+       MX25_PAD_LD3__LD3                               0x1 \
+       MX25_PAD_LD4__LD4                               0x1 \
+       MX25_PAD_LD5__LD5                               0x1 \
+       MX25_PAD_LD6__LD6                               0x1 \
+       MX25_PAD_LD7__LD7                               0x1 \
+       MX25_PAD_LD8__LD8                               0x1 \
+       MX25_PAD_LD9__LD9                               0x1 \
+       MX25_PAD_LD10__LD10                             0x1 \
+       MX25_PAD_LD11__LD11                             0x1 \
+       MX25_PAD_LD12__LD12                             0x1 \
+       MX25_PAD_LD13__LD13                             0x1 \
+       MX25_PAD_LD14__LD14                             0x1 \
+       MX25_PAD_LD15__LD15                             0x1 \
+       MX25_PAD_GPIO_E__LD16                           0x1 \
+       MX25_PAD_GPIO_F__LD17                           0x1 \
+       MX25_PAD_HSYNC__HSYNC                           0x80000000 \
+       MX25_PAD_VSYNC__VSYNC                           0x80000000 \
+       MX25_PAD_LSCLK__LSCLK                           0x80000000 \
+       MX25_PAD_OE_ACD__OE_ACD                         0x80000000 \
+       MX25_PAD_CONTRAST__CONTRAST                     0x80000000
+
+#define MX25_UART1_PINGRP1 \
+       MX25_PAD_UART1_RTS__UART1_RTS                   0xe0 \
+       MX25_PAD_UART1_CTS__UART1_CTS                   0xe0 \
+       MX25_PAD_UART1_TXD__UART1_TXD                   0x80000000 \
+       MX25_PAD_UART1_RXD__UART1_RXD                   0xc0
+
+#define MX25_UART2_PINGRP1 \
+       MX25_PAD_UART2_RXD__UART2_RXD                   0x80000000 \
+       MX25_PAD_UART2_TXD__UART2_TXD                   0x80000000 \
+       MX25_PAD_UART2_RTS__UART2_RTS                   0x80000000 \
+       MX25_PAD_UART2_CTS__UART2_CTS                   0x80000000
+
+#endif /* __DTS_IMX25_PINGRP_H */
index 737ed5da8f715fec5180c60a6bdd33e9c6fefc9a..9e9e3b8a690b913cf46ba8edda925561847f8a29 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include "skeleton.dtsi"
+#include "imx25-pingrp.h"
 
 / {
        aliases {
                                status = "disabled";
                        };
 
-                       iomuxc@43fac000{
+                       iomuxc: iomuxc@43fac000 {
                                compatible = "fsl,imx25-iomuxc";
                                reg = <0x43fac000 0x4000>;
                        };
 
-                       audmux@43fb0000 {
+                       audmux: audmux@43fb0000 {
                                compatible = "fsl,imx25-audmux", "fsl,imx31-audmux";
                                reg = <0x43fb0000 0x4000>;
                                status = "disabled";
                                compatible = "fsl,imx25-ssi", "fsl,imx21-ssi";
                                reg = <0x50014000 0x4000>;
                                interrupts = <11>;
+                               clocks = <&clks 118>;
+                               clock-names = "ipg";
+                               dmas = <&sdma 24 1 0>,
+                                      <&sdma 25 1 0>;
+                               dma-names = "rx", "tx";
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx25-ssi", "fsl,imx21-ssi";
                                reg = <0x50034000 0x4000>;
                                interrupts = <12>;
+                               clocks = <&clks 117>;
+                               clock-names = "ipg";
+                               dmas = <&sdma 28 1 0>,
+                                      <&sdma 29 1 0>;
+                               dma-names = "rx", "tx";
                                status = "disabled";
                        };
 
                                #interrupt-cells = <2>;
                        };
 
-                       sdma@53fd4000 {
+                       sdma: sdma@53fd4000 {
                                compatible = "fsl,imx25-sdma", "fsl,imx35-sdma";
                                reg = <0x53fd4000 0x4000>;
                                clocks = <&clks 112>, <&clks 68>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                interrupts = <34>;
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx25.bin";
                        };
 
                        wdog@53fdc000 {
index ba4c6df08ece2ec6e4cd0ce05437b61ffe407b2d..8bc75c70ec10128caa38ed6b1cdbdf4a9ae90964 100644 (file)
        };
 };
 
+&iomuxc {
+       imx27-apf27 {
+               pinctrl_fec1: fec1grp {
+                       fsl,pins = <MX27_FEC1_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX27_UART1_PINGRP1>;
+               };
+       };
+};
+
 &uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
        status = "okay";
 };
 
 &fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec1>;
        status = "okay";
 };
 
index 47c8c26012e4d24661124f15ff8396f428136797..2555d80d1750b21733335010558002c8d1d2222b 100644 (file)
                bits-per-pixel = <16>;  /* non-standard but required */
                fsl,pcr = <0xfae80083>; /* non-standard but required */
                display-timings {
-                       timing0: 640x480 {
+                       timing0: 800x480 {
                                clock-frequency = <33000033>;
                                hactive = <800>;
-                               vactive = <640>;
+                               vactive = <480>;
                                hback-porch = <96>;
                                hfront-porch = <96>;
                                vback-porch = <20>;
 
        gpio-keys {
                compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_keys>;
 
                user-key {
                        label = "user";
-                       gpios = <&gpio6 13 0>;
+                       gpios = <&gpio6 13 GPIO_ACTIVE_HIGH>;
                        linux,code = <276>; /* BTN_EXTRA */
                };
        };
 
        leds {
                compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
 
                user {
                        label = "Heartbeat";
-                       gpios = <&gpio6 14 0>;
+                       gpios = <&gpio6 14 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
                };
        };
 
 &cspi1 {
        fsl,spi-num-chipselects = <1>;
-       cs-gpios = <&gpio4 28 1>;
+       cs-gpios = <&gpio4 28 GPIO_ACTIVE_LOW>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_cspi1 &pinctrl_cspi1_cs>;
        status = "okay";
 };
 
 &cspi2 {
        fsl,spi-num-chipselects = <3>;
-       cs-gpios = <&gpio4 21 1>, <&gpio4 27 1>,
-                       <&gpio2 17 1>;
+       cs-gpios = <&gpio4 21 GPIO_ACTIVE_LOW>,
+                  <&gpio4 27 GPIO_ACTIVE_LOW>,
+                  <&gpio2 17 GPIO_ACTIVE_LOW>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_cspi2 &pinctrl_cspi2_cs>;
        status = "okay";
 };
 
 &fb {
        display = <&display>;
        fsl,dmacr = <0x00020010>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_imxfb1>;
        status = "okay";
 };
 
 &i2c1 {
        clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
        status = "okay";
 
        rtc@68 {
 };
 
 &i2c2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
        status = "okay";
 };
+
+&iomuxc {
+       imx27-apf27dev {
+               pinctrl_cspi1: cspi1grp {
+                       fsl,pins = <MX27_CSPI1_PINGRP1>;
+               };
+
+               pinctrl_cspi1_cs: cspi1csgrp {
+                       fsl,pins = <MX27_PAD_CSPI1_SS0__GPIO4_28 0x0>;
+               };
+
+               pinctrl_cspi2: cspi2grp {
+                       fsl,pins = <MX27_CSPI2_PINGRP1>;
+               };
+
+               pinctrl_cspi2_cs: cspi2csgrp {
+                       fsl,pins = <
+                               MX27_PAD_CSI_D5__GPIO2_17 0x0
+                               MX27_PAD_CSPI2_SS0__GPIO4_21 0x0
+                               MX27_PAD_CSPI1_SS1__GPIO4_27 0x0
+                       >;
+               };
+
+               pinctrl_gpio_leds: gpioledsgrp {
+                       fsl,pins = <MX27_PAD_PC_VS1__GPIO6_14 0x0>;
+               };
+
+               pinctrl_gpio_keys: gpiokeysgrp {
+                       fsl,pins = <MX27_PAD_PC_VS2__GPIO6_13 0x0>;
+               };
+
+               pinctrl_imxfb1: imxfbgrp {
+                       fsl,pins = <MX27_FB_PINGRP1>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX27_I2C1_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX27_I2C2_PINGRP1>;
+               };
+
+               pinctrl_pwm: pwmgrp {
+                       fsl,pins = <MX27_PWM_PINGRP1>;
+               };
+
+               pinctrl_sdhc2: sdhc2grp {
+                       fsl,pins = <MX27_SDHC2_PINGRP1>;
+               };
+
+               pinctrl_sdhc2_cd: sdhc2cdgrp {
+                       fsl,pins = <MX27_PAD_TOUT__GPIO3_14 0x0>;
+               };
+       };
+};
+
+&sdhci2 {
+       bus-width = <4>;
+       cd-gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sdhc2 &pinctrl_sdhc2_cd>;
+       status = "okay";
+};
+
+&pwm {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm>;
+};
index 5a31c776513f5705e94a5f1a5f306740e898c201..0d65023968cc56d2f2242c60e897ab2cfeae512d 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_3v3: 3v3 {
+               reg_3v3: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "3V3";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
@@ -54,6 +57,8 @@
 };
 
 &i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
        status = "okay";
 
        rtc@51 {
        };
 };
 
+&iomuxc {
+       imx27-phycard-s-rdk {
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX27_I2C2_PINGRP1>;
+               };
+
+               pinctrl_owire1: owire1grp {
+                       fsl,pins = <MX27_OWIRE1_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <
+                               MX27_UART1_PINGRP1
+                               MX27_UART1_RTSCTS_PINGRP1
+                       >;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <
+                               MX27_UART2_PINGRP1
+                               MX27_UART2_RTSCTS_PINGRP1
+                       >;
+               };
+
+               pinctrl_uart3: uart3grp {
+                       fsl,pins = <
+                               MX27_UART3_PINGRP1
+                               MX27_UART3_RTSCTS_PINGRP1
+                       >;
+               };
+       };
+};
+
 &owire {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_owire1>;
        status = "okay";
 };
 
 &sdhci2 {
-       cd-gpios = <&gpio3 29 0>;
+       cd-gpios = <&gpio3 29 GPIO_ACTIVE_HIGH>;
        status = "okay";
 };
 
 &uart1 {
        fsl,uart-has-rtscts;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
        status = "okay";
 };
 
 &uart2 {
        fsl,uart-has-rtscts;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
        status = "okay";
 };
 
 &uart3 {
        fsl,uart-has-rtscts;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
        status = "okay";
 };
index c8d57d1d074362e14c91113cc8cbf42079724ffe..db8c09511f571260a6b9909832400bfc8e018fbe 100644 (file)
 
 &cspi1 {
        fsl,spi-num-chipselects = <2>;
-       cs-gpios = <&gpio4 28 0>,
-               <&gpio4 27 0>;
+       cs-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>,
+                  <&gpio4 27 GPIO_ACTIVE_HIGH>;
        status = "okay";
 };
 
+&iomuxc {
+       imx27-phycard-s-som {
+               pinctrl_fec1: fec1grp {
+                       fsl,pins = <MX27_FEC1_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX27_I2C2_PINGRP1>;
+               };
+       };
+};
+
 &fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec1>;
        status = "okay";
 };
 
 &i2c2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
        status = "okay";
 
        at24@52 {
index 0fc6551786c6817216045c8ddfc86a6c5790d58e..7ada054c82e6f27e2c8a24e95df051b1e2d50632 100644 (file)
@@ -7,7 +7,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 
-#include "imx27-phytec-phycore-som.dts"
+#include "imx27-phytec-phycore-som.dtsi"
 
 / {
        model = "Phytec pcm970";
 
 &cspi1 {
        fsl,spi-num-chipselects = <2>;
-       cs-gpios = <&gpio4 28 0>, <&gpio4 27 0>;
+       cs-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>,
+                  <&gpio4 27 GPIO_ACTIVE_LOW>;
+};
+
+&i2c1 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       camgpio: pca9536@41 {
+               compatible = "nxp,pca9536";
+               reg = <0x41>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+};
+
+&iomuxc {
+       imx27_phycore_rdk {
+               pinctrl_i2c1: i2c1grp {
+                       /* Add pullup to DATA line */
+                       fsl,pins = <
+                               MX27_PAD_I2C_DATA__I2C_DATA     0x1
+                               MX27_PAD_I2C_CLK__I2C_CLK       0x0
+                       >;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <
+                               MX27_UART1_PINGRP1
+                               MX27_UART1_RTSCTS_PINGRP1
+                       >;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <
+                               MX27_UART2_PINGRP1
+                               MX27_UART2_RTSCTS_PINGRP1
+                       >;
+               };
+       };
 };
 
 &sdhci2 {
        bus-width = <4>;
-       cd-gpios = <&gpio3 29 0>;
-       wp-gpios = <&gpio3 28 0>;
+       cd-gpios = <&gpio3 29 GPIO_ACTIVE_HIGH>;
+       wp-gpios = <&gpio3 28 GPIO_ACTIVE_HIGH>;
        vmmc-supply = <&vmmc1_reg>;
        status = "okay";
 };
 
 &uart1 {
        fsl,uart-has-rtscts;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
 };
 
 &uart2 {
        fsl,uart-has-rtscts;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
        status = "okay";
 };
 
@@ -41,7 +87,7 @@
                compatible = "nxp,sja1000";
                reg = <4 0x00000000 0x00000100>;
                interrupt-parent = <&gpio5>;
-               interrupts = <19 0x2>;
+               interrupts = <19 IRQ_TYPE_EDGE_FALLING>;
                nxp,external-clock-frequency = <16000000>;
                nxp,tx-output-config = <0x16>;
                nxp,no-comparator-bypass;
similarity index 77%
rename from arch/arm/boot/dts/imx27-phytec-phycore-som.dts
rename to arch/arm/boot/dts/imx27-phytec-phycore-som.dtsi
index 4ec402c389457f6e5416dc573459127fd4128de7..7087a4f920ef1d32905782da3d00977b450f1385 100644 (file)
        memory {
                reg = <0xa0000000 0x08000000>;
        };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_3v3: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "3V3";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+               };
+       };
 };
 
 &audmux {
 };
 
 &cspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_cspi1>;
        fsl,spi-num-chipselects = <1>;
-       cs-gpios = <&gpio4 28 0>;
+       cs-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>;
        status = "okay";
 
        pmic: mc13783@0 {
@@ -48,7 +64,7 @@
                spi-max-frequency = <20000000>;
                reg = <0>;
                interrupt-parent = <&gpio2>;
-               interrupts = <23 0x4>;
+               interrupts = <23 IRQ_TYPE_LEVEL_HIGH>;
                fsl,mc13xxx-uses-adc;
                fsl,mc13xxx-uses-rtc;
 
 };
 
 &fec {
-       phy-reset-gpios = <&gpio3 30 0>;
+       phy-mode = "mii";
+       phy-reset-gpios = <&gpio3 30 GPIO_ACTIVE_HIGH>;
+       phy-supply = <&reg_3v3>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec1>;
        status = "okay";
 };
 
 &i2c2 {
        clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
        status = "okay";
 
        at24@52 {
        };
 };
 
+&iomuxc {
+       imx27_phycore_som {
+               pinctrl_cspi1: cspi1grp {
+                       fsl,pins = <
+                               MX27_CSPI1_PINGRP1
+                               MX27_PAD_CSPI1_SS0__GPIO4_28    0x0 /* SPI1 CS0 */
+                               MX27_PAD_USB_PWR__GPIO2_23      0x0 /* PMIC IRQ */
+                       >;
+               };
+
+               pinctrl_fec1: fec1grp {
+                       fsl,pins = <
+                               MX27_FEC1_PINGRP1
+                               MX27_PAD_SSI3_TXDAT__GPIO3_30   0x0 /* FEC RST */
+                       >;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX27_I2C2_PINGRP1>;
+               };
+       };
+};
+
 &nfc {
        nand-bus-width = <8>;
        nand-ecc-mode = "hw";
-       status = "okay";
-};
-
-&uart1 {
+       nand-on-flash-bbt;
        status = "okay";
 };
 
diff --git a/arch/arm/boot/dts/imx27-pinfunc.h b/arch/arm/boot/dts/imx27-pinfunc.h
new file mode 100644 (file)
index 0000000..f5387b4
--- /dev/null
@@ -0,0 +1,526 @@
+/*
+ * Copyright 2013 Markus Pargmann <mpa@pengutronix.de>, Pengutronix
+ *
+ * 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
+ */
+
+#ifndef __DTS_IMX27_PINFUNC_H
+#define __DTS_IMX27_PINFUNC_H
+
+/*
+ * The pin function ID is a tuple of
+ * <pin mux_id>
+ * mux_id consists of
+ * function + (direction << 2) + (gpio_oconf << 4) + (gpio_iconfa << 8) + (gpio_iconfb << 10)
+ *
+ * function:      0 - Primary function
+ *                1 - Alternate function
+ *                2 - GPIO
+ * direction:     0 - Input
+ *                1 - Output
+ * gpio_oconf:    0 - A_IN
+ *                1 - B_IN
+ *                2 - C_IN
+ *                3 - Data Register
+ * gpio_iconfa/b: 0 - GPIO_IN
+ *                1 - Interrupt Status Register
+ *                2 - 0
+ *                3 - 1
+ *
+ * 'pin' is an integer between 0 and 0xbf. imx27 has 6 ports with 32 configurable
+ * configurable pins each. 'pin' is PORT * 32 + PORT_PIN, PORT_PIN is the pin
+ * number on the specific port (between 0 and 31).
+ */
+
+#define MX27_PAD_USBH2_CLK__USBH2_CLK                      0x00 0x000
+#define MX27_PAD_USBH2_CLK__GPIO1_0                        0x00 0x032
+#define MX27_PAD_USBH2_DIR__USBH2_DIR                      0x01 0x000
+#define MX27_PAD_USBH2_DIR__GPIO1_1                        0x01 0x032
+#define MX27_PAD_USBH2_DATA7__USBH2_DATA7                  0x02 0x004
+#define MX27_PAD_USBH2_DATA7__GPIO1_2                      0x02 0x032
+#define MX27_PAD_USBH2_NXT__USBH2_NXT                      0x03 0x000
+#define MX27_PAD_USBH2_NXT__GPIO1_3                        0x03 0x032
+#define MX27_PAD_USBH2_STP__USBH2_STP                      0x04 0x004
+#define MX27_PAD_USBH2_STP__GPIO1_4                        0x04 0x032
+#define MX27_PAD_LSCLK__LSCLK                              0x05 0x004
+#define MX27_PAD_LSCLK__GPIO1_5                            0x05 0x032
+#define MX27_PAD_LD0__LD0                                  0x06 0x004
+#define MX27_PAD_LD0__GPIO1_6                              0x06 0x032
+#define MX27_PAD_LD1__LD1                                  0x07 0x004
+#define MX27_PAD_LD1__GPIO1_7                              0x07 0x032
+#define MX27_PAD_LD2__LD2                                  0x08 0x004
+#define MX27_PAD_LD2__GPIO1_8                              0x08 0x032
+#define MX27_PAD_LD3__LD3                                  0x09 0x004
+#define MX27_PAD_LD3__GPIO1_9                              0x09 0x032
+#define MX27_PAD_LD4__LD4                                  0x0a 0x004
+#define MX27_PAD_LD4__GPIO1_10                             0x0a 0x032
+#define MX27_PAD_LD5__LD5                                  0x0b 0x004
+#define MX27_PAD_LD5__GPIO1_11                             0x0b 0x032
+#define MX27_PAD_LD6__LD6                                  0x0c 0x004
+#define MX27_PAD_LD6__GPIO1_12                             0x0c 0x032
+#define MX27_PAD_LD7__LD7                                  0x0d 0x004
+#define MX27_PAD_LD7__GPIO1_13                             0x0d 0x032
+#define MX27_PAD_LD8__LD8                                  0x0e 0x004
+#define MX27_PAD_LD8__GPIO1_14                             0x0e 0x032
+#define MX27_PAD_LD9__LD9                                  0x0f 0x004
+#define MX27_PAD_LD9__GPIO1_15                             0x0f 0x032
+#define MX27_PAD_LD10__LD10                                0x10 0x004
+#define MX27_PAD_LD10__GPIO1_16                            0x10 0x032
+#define MX27_PAD_LD11__LD11                                0x11 0x004
+#define MX27_PAD_LD11__GPIO1_17                            0x11 0x032
+#define MX27_PAD_LD12__LD12                                0x12 0x004
+#define MX27_PAD_LD12__GPIO1_18                            0x12 0x032
+#define MX27_PAD_LD13__LD13                                0x13 0x004
+#define MX27_PAD_LD13__GPIO1_19                            0x13 0x032
+#define MX27_PAD_LD14__LD14                                0x14 0x004
+#define MX27_PAD_LD14__GPIO1_20                            0x14 0x032
+#define MX27_PAD_LD15__LD15                                0x15 0x004
+#define MX27_PAD_LD15__GPIO1_21                            0x15 0x032
+#define MX27_PAD_LD16__LD16                                0x16 0x004
+#define MX27_PAD_LD16__GPIO1_22                            0x16 0x032
+#define MX27_PAD_LD17__LD17                                0x17 0x004
+#define MX27_PAD_LD17__GPIO1_23                            0x17 0x032
+#define MX27_PAD_REV__REV                                  0x18 0x004
+#define MX27_PAD_REV__GPIO1_24                             0x18 0x032
+#define MX27_PAD_CLS__CLS                                  0x19 0x004
+#define MX27_PAD_CLS__GPIO1_25                             0x19 0x032
+#define MX27_PAD_PS__PS                                    0x1a 0x004
+#define MX27_PAD_PS__GPIO1_26                              0x1a 0x032
+#define MX27_PAD_SPL_SPR__SPL_SPR                          0x1b 0x004
+#define MX27_PAD_SPL_SPR__GPIO1_27                         0x1b 0x032
+#define MX27_PAD_HSYNC__HSYNC                              0x1c 0x004
+#define MX27_PAD_HSYNC__GPIO1_28                           0x1c 0x032
+#define MX27_PAD_VSYNC__VSYNC                              0x1d 0x004
+#define MX27_PAD_VSYNC__GPIO1_29                           0x1d 0x032
+#define MX27_PAD_CONTRAST__CONTRAST                        0x1e 0x004
+#define MX27_PAD_CONTRAST__GPIO1_30                        0x1e 0x032
+#define MX27_PAD_OE_ACD__OE_ACD                            0x1f 0x004
+#define MX27_PAD_OE_ACD__GPIO1_31                          0x1f 0x032
+#define MX27_PAD_UNUSED0__UNUSED0                          0x20 0x004
+#define MX27_PAD_UNUSED0__GPIO2_0                          0x20 0x032
+#define MX27_PAD_UNUSED1__UNUSED1                          0x21 0x004
+#define MX27_PAD_UNUSED1__GPIO2_1                          0x21 0x032
+#define MX27_PAD_UNUSED2__UNUSED2                          0x22 0x004
+#define MX27_PAD_UNUSED2__GPIO2_2                          0x22 0x032
+#define MX27_PAD_UNUSED3__UNUSED3                          0x23 0x004
+#define MX27_PAD_UNUSED3__GPIO2_3                          0x23 0x032
+#define MX27_PAD_SD2_D0__SD2_D0                            0x24 0x004
+#define MX27_PAD_SD2_D0__MSHC_DATA0                        0x24 0x005
+#define MX27_PAD_SD2_D0__GPIO2_4                           0x24 0x032
+#define MX27_PAD_SD2_D1__SD2_D1                            0x25 0x004
+#define MX27_PAD_SD2_D1__MSHC_DATA1                        0x25 0x005
+#define MX27_PAD_SD2_D1__GPIO2_5                           0x25 0x032
+#define MX27_PAD_SD2_D2__SD2_D2                            0x26 0x004
+#define MX27_PAD_SD2_D2__MSHC_DATA2                        0x26 0x005
+#define MX27_PAD_SD2_D2__GPIO2_6                           0x26 0x032
+#define MX27_PAD_SD2_D3__SD2_D3                            0x27 0x004
+#define MX27_PAD_SD2_D3__MSHC_DATA3                        0x27 0x005
+#define MX27_PAD_SD2_D3__GPIO2_7                           0x27 0x032
+#define MX27_PAD_SD2_CMD__SD2_CMD                          0x28 0x004
+#define MX27_PAD_SD2_CMD__MSHC_BS                          0x28 0x005
+#define MX27_PAD_SD2_CMD__GPIO2_8                          0x28 0x032
+#define MX27_PAD_SD2_CLK__SD2_CLK                          0x29 0x004
+#define MX27_PAD_SD2_CLK__MSHC_SCLK                        0x29 0x005
+#define MX27_PAD_SD2_CLK__GPIO2_9                          0x29 0x032
+#define MX27_PAD_CSI_D0__CSI_D0                            0x2a 0x000
+#define MX27_PAD_CSI_D0__UART6_TXD                         0x2a 0x005
+#define MX27_PAD_CSI_D0__GPIO2_10                          0x2a 0x032
+#define MX27_PAD_CSI_D1__CSI_D1                            0x2b 0x000
+#define MX27_PAD_CSI_D1__UART6_RXD                         0x2b 0x001
+#define MX27_PAD_CSI_D1__GPIO2_11                          0x2b 0x032
+#define MX27_PAD_CSI_D2__CSI_D2                            0x2c 0x000
+#define MX27_PAD_CSI_D2__UART6_CTS                         0x2c 0x005
+#define MX27_PAD_CSI_D2__GPIO2_12                          0x2c 0x032
+#define MX27_PAD_CSI_D3__CSI_D3                            0x2d 0x000
+#define MX27_PAD_CSI_D3__UART6_RTS                         0x2d 0x001
+#define MX27_PAD_CSI_D3__GPIO2_13                          0x2d 0x032
+#define MX27_PAD_CSI_D4__CSI_D4                            0x2e 0x000
+#define MX27_PAD_CSI_D4__GPIO2_14                          0x2e 0x032
+#define MX27_PAD_CSI_MCLK__CSI_MCLK                        0x2f 0x004
+#define MX27_PAD_CSI_MCLK__GPIO2_15                        0x2f 0x032
+#define MX27_PAD_CSI_PIXCLK__CSI_PIXCLK                    0x30 0x000
+#define MX27_PAD_CSI_PIXCLK__GPIO2_16                      0x30 0x032
+#define MX27_PAD_CSI_D5__CSI_D5                            0x31 0x000
+#define MX27_PAD_CSI_D5__GPIO2_17                          0x31 0x032
+#define MX27_PAD_CSI_D6__CSI_D6                            0x32 0x000
+#define MX27_PAD_CSI_D6__UART5_TXD                         0x32 0x005
+#define MX27_PAD_CSI_D6__GPIO2_18                          0x32 0x032
+#define MX27_PAD_CSI_D7__CSI_D7                            0x33 0x000
+#define MX27_PAD_CSI_D7__UART5_RXD                         0x33 0x001
+#define MX27_PAD_CSI_D7__GPIO2_19                          0x33 0x032
+#define MX27_PAD_CSI_VSYNC__CSI_VSYNC                      0x34 0x000
+#define MX27_PAD_CSI_VSYNC__UART5_CTS                      0x34 0x005
+#define MX27_PAD_CSI_VSYNC__GPIO2_20                       0x34 0x032
+#define MX27_PAD_CSI_HSYNC__CSI_HSYNC                      0x35 0x000
+#define MX27_PAD_CSI_HSYNC__UART5_RTS                      0x35 0x001
+#define MX27_PAD_CSI_HSYNC__GPIO2_21                       0x35 0x032
+#define MX27_PAD_USBH1_SUSP__USBH1_SUSP                    0x36 0x004
+#define MX27_PAD_USBH1_SUSP__GPIO2_22                      0x36 0x032
+#define MX27_PAD_USB_PWR__USB_PWR                          0x37 0x004
+#define MX27_PAD_USB_PWR__GPIO2_23                         0x37 0x032
+#define MX27_PAD_USB_OC_B__USB_OC_B                        0x38 0x000
+#define MX27_PAD_USB_OC_B__GPIO2_24                        0x38 0x032
+#define MX27_PAD_USBH1_RCV__USBH1_RCV                      0x39 0x004
+#define MX27_PAD_USBH1_RCV__GPIO2_25                       0x39 0x032
+#define MX27_PAD_USBH1_FS__USBH1_FS                        0x3a 0x004
+#define MX27_PAD_USBH1_FS__UART4_RTS                       0x3a 0x001
+#define MX27_PAD_USBH1_FS__GPIO2_26                        0x3a 0x032
+#define MX27_PAD_USBH1_OE_B__USBH1_OE_B                    0x3b 0x004
+#define MX27_PAD_USBH1_OE_B__GPIO2_27                      0x3b 0x032
+#define MX27_PAD_USBH1_TXDM__USBH1_TXDM                    0x3c 0x004
+#define MX27_PAD_USBH1_TXDM__UART4_TXD                     0x3c 0x005
+#define MX27_PAD_USBH1_TXDM__GPIO2_28                      0x3c 0x032
+#define MX27_PAD_USBH1_TXDP__USBH1_TXDP                    0x3d 0x004
+#define MX27_PAD_USBH1_TXDP__UART4_CTS                     0x3d 0x005
+#define MX27_PAD_USBH1_TXDP__GPIO2_29                      0x3d 0x032
+#define MX27_PAD_USBH1_RXDM__USBH1_RXDM                    0x3e 0x004
+#define MX27_PAD_USBH1_RXDM__GPIO2_30                      0x3e 0x032
+#define MX27_PAD_USBH1_RXDP__USBH1_RXDP                    0x3f 0x004
+#define MX27_PAD_USBH1_RXDP__UART4_RXD                     0x3f 0x001
+#define MX27_PAD_USBH1_RXDP__GPIO2_31                      0x3f 0x032
+#define MX27_PAD_UNUSED4__UNUSED4                          0x40 0x004
+#define MX27_PAD_UNUSED4__GPIO3_0                          0x40 0x032
+#define MX27_PAD_UNUSED5__UNUSED5                          0x41 0x004
+#define MX27_PAD_UNUSED5__GPIO3_1                          0x41 0x032
+#define MX27_PAD_UNUSED6__UNUSED6                          0x42 0x004
+#define MX27_PAD_UNUSED6__GPIO3_2                          0x42 0x032
+#define MX27_PAD_UNUSED7__UNUSED7                          0x43 0x004
+#define MX27_PAD_UNUSED7__GPIO3_3                          0x43 0x032
+#define MX27_PAD_UNUSED8__UNUSED8                          0x44 0x004
+#define MX27_PAD_UNUSED8__GPIO3_4                          0x44 0x032
+#define MX27_PAD_I2C2_SDA__I2C2_SDA                        0x45 0x004
+#define MX27_PAD_I2C2_SDA__GPIO3_5                         0x45 0x032
+#define MX27_PAD_I2C2_SCL__I2C2_SCL                        0x46 0x004
+#define MX27_PAD_I2C2_SCL__GPIO3_6                         0x46 0x032
+#define MX27_PAD_USBOTG_DATA5__USBOTG_DATA5                0x47 0x004
+#define MX27_PAD_USBOTG_DATA5__GPIO3_7                     0x47 0x032
+#define MX27_PAD_USBOTG_DATA6__USBOTG_DATA6                0x48 0x004
+#define MX27_PAD_USBOTG_DATA6__GPIO3_8                     0x48 0x032
+#define MX27_PAD_USBOTG_DATA0__USBOTG_DATA0                0x49 0x004
+#define MX27_PAD_USBOTG_DATA0__GPIO3_9                     0x49 0x032
+#define MX27_PAD_USBOTG_DATA2__USBOTG_DATA2                0x4a 0x004
+#define MX27_PAD_USBOTG_DATA2__GPIO3_10                    0x4a 0x032
+#define MX27_PAD_USBOTG_DATA1__USBOTG_DATA1                0x4b 0x004
+#define MX27_PAD_USBOTG_DATA1__GPIO3_11                    0x4b 0x032
+#define MX27_PAD_USBOTG_DATA4__USBOTG_DATA4                0x4c 0x004
+#define MX27_PAD_USBOTG_DATA4__GPIO3_12                    0x4c 0x032
+#define MX27_PAD_USBOTG_DATA3__USBOTG_DATA3                0x4d 0x004
+#define MX27_PAD_USBOTG_DATA3__GPIO3_13                    0x4d 0x032
+#define MX27_PAD_TOUT__TOUT                                0x4e 0x004
+#define MX27_PAD_TOUT__GPIO3_14                            0x4e 0x032
+#define MX27_PAD_TIN__TIN                                  0x4f 0x000
+#define MX27_PAD_TIN__GPIO3_15                             0x4f 0x032
+#define MX27_PAD_SSI4_FS__SSI4_FS                          0x50 0x004
+#define MX27_PAD_SSI4_FS__GPIO3_16                         0x50 0x032
+#define MX27_PAD_SSI4_RXDAT__SSI4_RXDAT                    0x51 0x004
+#define MX27_PAD_SSI4_RXDAT__GPIO3_17                      0x51 0x032
+#define MX27_PAD_SSI4_TXDAT__SSI4_TXDAT                    0x52 0x004
+#define MX27_PAD_SSI4_TXDAT__GPIO3_18                      0x52 0x032
+#define MX27_PAD_SSI4_CLK__SSI4_CLK                        0x53 0x004
+#define MX27_PAD_SSI4_CLK__GPIO3_19                        0x53 0x032
+#define MX27_PAD_SSI1_FS__SSI1_FS                          0x54 0x004
+#define MX27_PAD_SSI1_FS__GPIO3_20                         0x54 0x032
+#define MX27_PAD_SSI1_RXDAT__SSI1_RXDAT                    0x55 0x004
+#define MX27_PAD_SSI1_RXDAT__GPIO3_21                      0x55 0x032
+#define MX27_PAD_SSI1_TXDAT__SSI1_TXDAT                    0x56 0x004
+#define MX27_PAD_SSI1_TXDAT__GPIO3_22                      0x56 0x032
+#define MX27_PAD_SSI1_CLK__SSI1_CLK                        0x57 0x004
+#define MX27_PAD_SSI1_CLK__GPIO3_23                        0x57 0x032
+#define MX27_PAD_SSI2_FS__SSI2_FS                          0x58 0x004
+#define MX27_PAD_SSI2_FS__GPT5_TOUT                        0x58 0x005
+#define MX27_PAD_SSI2_FS__GPIO3_24                         0x58 0x032
+#define MX27_PAD_SSI2_RXDAT__SSI2_RXDAT                    0x59 0x004
+#define MX27_PAD_SSI2_RXDAT__GPTS_TIN                      0x59 0x001
+#define MX27_PAD_SSI2_RXDAT__GPIO3_25                      0x59 0x032
+#define MX27_PAD_SSI2_TXDAT__SSI2_TXDAT                    0x5a 0x004
+#define MX27_PAD_SSI2_TXDAT__GPT4_TOUT                     0x5a 0x005
+#define MX27_PAD_SSI2_TXDAT__GPIO3_26                      0x5a 0x032
+#define MX27_PAD_SSI2_CLK__SSI2_CLK                        0x5b 0x004
+#define MX27_PAD_SSI2_CLK__GPT4_TIN                        0x5b 0x001
+#define MX27_PAD_SSI2_CLK__GPIO3_27                        0x5b 0x032
+#define MX27_PAD_SSI3_FS__SSI3_FS                          0x5c 0x004
+#define MX27_PAD_SSI3_FS__SLCDC2_D0                        0x5c 0x001
+#define MX27_PAD_SSI3_FS__GPIO3_28                         0x5c 0x032
+#define MX27_PAD_SSI3_RXDAT__SSI3_RXDAT                    0x5d 0x004
+#define MX27_PAD_SSI3_RXDAT__SLCDC2_RS                     0x5d 0x001
+#define MX27_PAD_SSI3_RXDAT__GPIO3_29                      0x5d 0x032
+#define MX27_PAD_SSI3_TXDAT__SSI3_TXDAT                    0x5e 0x004
+#define MX27_PAD_SSI3_TXDAT__SLCDC2_CS                     0x5e 0x001
+#define MX27_PAD_SSI3_TXDAT__GPIO3_30                      0x5e 0x032
+#define MX27_PAD_SSI3_CLK__SSI3_CLK                        0x5f 0x004
+#define MX27_PAD_SSI3_CLK__SLCDC2_CLK                      0x5f 0x001
+#define MX27_PAD_SSI3_CLK__GPIO3_31                        0x5f 0x032
+#define MX27_PAD_SD3_CMD__SD3_CMD                          0x60 0x004
+#define MX27_PAD_SD3_CMD__FEC_TXD0                         0x60 0x006
+#define MX27_PAD_SD3_CMD__GPIO4_0                          0x60 0x032
+#define MX27_PAD_SD3_CLK__SD3_CLK                          0x61 0x004
+#define MX27_PAD_SD3_CLK__ETMTRACEPKT15                    0x61 0x005
+#define MX27_PAD_SD3_CLK__FEC_TXD1                         0x61 0x006
+#define MX27_PAD_SD3_CLK__GPIO4_1                          0x61 0x032
+#define MX27_PAD_ATA_DATA0__ATA_DATA0                      0x62 0x004
+#define MX27_PAD_ATA_DATA0__SD3_D0                         0x62 0x005
+#define MX27_PAD_ATA_DATA0__FEC_TXD2                       0x62 0x006
+#define MX27_PAD_ATA_DATA0__GPIO4_2                        0x62 0x032
+#define MX27_PAD_ATA_DATA1__ATA_DATA1                      0x63 0x004
+#define MX27_PAD_ATA_DATA1__SD3_D1                         0x63 0x005
+#define MX27_PAD_ATA_DATA1__FEC_TXD3                       0x63 0x006
+#define MX27_PAD_ATA_DATA1__GPIO4_3                        0x63 0x032
+#define MX27_PAD_ATA_DATA2__ATA_DATA2                      0x64 0x004
+#define MX27_PAD_ATA_DATA2__SD3_D2                         0x64 0x005
+#define MX27_PAD_ATA_DATA2__FEC_RX_ER                      0x64 0x002
+#define MX27_PAD_ATA_DATA2__GPIO4_4                        0x64 0x032
+#define MX27_PAD_ATA_DATA3__ATA_DATA3                      0x65 0x004
+#define MX27_PAD_ATA_DATA3__SD3_D3                         0x65 0x005
+#define MX27_PAD_ATA_DATA3__FEC_RXD1                       0x65 0x002
+#define MX27_PAD_ATA_DATA3__GPIO4_5                        0x65 0x032
+#define MX27_PAD_ATA_DATA4__ATA_DATA4                      0x66 0x004
+#define MX27_PAD_ATA_DATA4__ETMTRACEPKT14                  0x66 0x005
+#define MX27_PAD_ATA_DATA4__FEC_RXD2                       0x66 0x002
+#define MX27_PAD_ATA_DATA4__GPIO4_6                        0x66 0x032
+#define MX27_PAD_ATA_DATA5__ATA_DATA5                      0x67 0x004
+#define MX27_PAD_ATA_DATA5__ETMTRACEPKT13                  0x67 0x005
+#define MX27_PAD_ATA_DATA5__FEC_RXD3                       0x67 0x002
+#define MX27_PAD_ATA_DATA5__GPIO4_7                        0x67 0x032
+#define MX27_PAD_ATA_DATA6__ATA_DATA6                      0x68 0x004
+#define MX27_PAD_ATA_DATA6__FEC_MDIO                       0x68 0x005
+#define MX27_PAD_ATA_DATA6__GPIO4_8                        0x68 0x032
+#define MX27_PAD_ATA_DATA7__ATA_DATA7                      0x69 0x004
+#define MX27_PAD_ATA_DATA7__ETMTRACEPKT12                  0x69 0x005
+#define MX27_PAD_ATA_DATA7__FEC_MDC                        0x69 0x006
+#define MX27_PAD_ATA_DATA7__GPIO4_9                        0x69 0x032
+#define MX27_PAD_ATA_DATA8__ATA_DATA8                      0x6a 0x004
+#define MX27_PAD_ATA_DATA8__ETMTRACEPKT11                  0x6a 0x005
+#define MX27_PAD_ATA_DATA8__FEC_CRS                        0x6a 0x002
+#define MX27_PAD_ATA_DATA8__GPIO4_10                       0x6a 0x032
+#define MX27_PAD_ATA_DATA9__ATA_DATA9                      0x6b 0x004
+#define MX27_PAD_ATA_DATA9__ETMTRACEPKT10                  0x6b 0x005
+#define MX27_PAD_ATA_DATA9__FEC_TX_CLK                     0x6b 0x002
+#define MX27_PAD_ATA_DATA9__GPIO4_11                       0x6b 0x032
+#define MX27_PAD_ATA_DATA10__ATA_DATA10                    0x6c 0x004
+#define MX27_PAD_ATA_DATA10__ETMTRACEPKT9                  0x6c 0x005
+#define MX27_PAD_ATA_DATA10__FEC_RXD0                      0x6c 0x002
+#define MX27_PAD_ATA_DATA10__GPIO4_12                      0x6c 0x032
+#define MX27_PAD_ATA_DATA11__ATA_DATA11                    0x6d 0x004
+#define MX27_PAD_ATA_DATA11__ETMTRACEPKT8                  0x6d 0x005
+#define MX27_PAD_ATA_DATA11__FEC_RX_DV                     0x6d 0x002
+#define MX27_PAD_ATA_DATA11__GPIO4_13                      0x6d 0x032
+#define MX27_PAD_ATA_DATA12__ATA_DATA12                    0x6e 0x004
+#define MX27_PAD_ATA_DATA12__ETMTRACEPKT7                  0x6e 0x005
+#define MX27_PAD_ATA_DATA12__FEC_RX_CLK                    0x6e 0x002
+#define MX27_PAD_ATA_DATA12__GPIO4_14                      0x6e 0x032
+#define MX27_PAD_ATA_DATA13__ATA_DATA13                    0x6f 0x004
+#define MX27_PAD_ATA_DATA13__ETMTRACEPKT6                  0x6f 0x005
+#define MX27_PAD_ATA_DATA13__FEC_COL                       0x6f 0x002
+#define MX27_PAD_ATA_DATA13__GPIO4_15                      0x6f 0x032
+#define MX27_PAD_ATA_DATA14__ATA_DATA14                    0x70 0x004
+#define MX27_PAD_ATA_DATA14__ETMTRACEPKT5                  0x70 0x005
+#define MX27_PAD_ATA_DATA14__FEC_TX_ER                     0x70 0x006
+#define MX27_PAD_ATA_DATA14__GPIO4_16                      0x70 0x032
+#define MX27_PAD_I2C_DATA__I2C_DATA                        0x71 0x004
+#define MX27_PAD_I2C_DATA__GPIO4_17                        0x71 0x032
+#define MX27_PAD_I2C_CLK__I2C_CLK                          0x72 0x004
+#define MX27_PAD_I2C_CLK__GPIO4_18                         0x72 0x032
+#define MX27_PAD_CSPI2_SS2__CSPI2_SS2                      0x73 0x004
+#define MX27_PAD_CSPI2_SS2__USBH2_DATA4                    0x73 0x005
+#define MX27_PAD_CSPI2_SS2__GPIO4_19                       0x73 0x032
+#define MX27_PAD_CSPI2_SS1__CSPI2_SS1                      0x74 0x004
+#define MX27_PAD_CSPI2_SS1__USBH2_DATA3                    0x74 0x005
+#define MX27_PAD_CSPI2_SS1__GPIO4_20                       0x74 0x032
+#define MX27_PAD_CSPI2_SS0__CSPI2_SS0                      0x75 0x004
+#define MX27_PAD_CSPI2_SS0__USBH2_DATA6                    0x75 0x005
+#define MX27_PAD_CSPI2_SS0__GPIO4_21                       0x75 0x032
+#define MX27_PAD_CSPI2_SCLK__CSPI2_SCLK                    0x76 0x004
+#define MX27_PAD_CSPI2_SCLK__USBH2_DATA0                   0x76 0x005
+#define MX27_PAD_CSPI2_SCLK__GPIO4_22                      0x76 0x032
+#define MX27_PAD_CSPI2_MISO__CSPI2_MISO                    0x77 0x004
+#define MX27_PAD_CSPI2_MISO__USBH2_DATA2                   0x77 0x005
+#define MX27_PAD_CSPI2_MISO__GPIO4_23                      0x77 0x032
+#define MX27_PAD_CSPI2_MOSI__CSPI2_MOSI                    0x78 0x004
+#define MX27_PAD_CSPI2_MOSI__USBH2_DATA1                   0x78 0x005
+#define MX27_PAD_CSPI2_MOSI__GPIO4_24                      0x78 0x032
+#define MX27_PAD_CSPI1_RDY__CSPI1_RDY                      0x79 0x000
+#define MX27_PAD_CSPI1_RDY__GPIO4_25                       0x79 0x032
+#define MX27_PAD_CSPI1_SS2__CSPI1_SS2                      0x7a 0x004
+#define MX27_PAD_CSPI1_SS2__USBH2_DATA5                    0x7a 0x005
+#define MX27_PAD_CSPI1_SS2__GPIO4_26                       0x7a 0x032
+#define MX27_PAD_CSPI1_SS1__CSPI1_SS1                      0x7b 0x004
+#define MX27_PAD_CSPI1_SS1__GPIO4_27                       0x7b 0x032
+#define MX27_PAD_CSPI1_SS0__CSPI1_SS0                      0x7c 0x004
+#define MX27_PAD_CSPI1_SS0__GPIO4_28                       0x7c 0x032
+#define MX27_PAD_CSPI1_SCLK__CSPI1_SCLK                    0x7d 0x004
+#define MX27_PAD_CSPI1_SCLK__GPIO4_29                      0x7d 0x032
+#define MX27_PAD_CSPI1_MISO__CSPI1_MISO                    0x7e 0x004
+#define MX27_PAD_CSPI1_MISO__GPIO4_30                      0x7e 0x032
+#define MX27_PAD_CSPI1_MOSI__CSPI1_MOSI                    0x7f 0x004
+#define MX27_PAD_CSPI1_MOSI__GPIO4_31                      0x7f 0x032
+#define MX27_PAD_USBOTG_NXT__USBOTG_NXT                    0x80 0x000
+#define MX27_PAD_USBOTG_NXT__KP_COL6A                      0x80 0x005
+#define MX27_PAD_USBOTG_NXT__GPIO5_0                       0x80 0x032
+#define MX27_PAD_USBOTG_STP__USBOTG_STP                    0x81 0x004
+#define MX27_PAD_USBOTG_STP__KP_ROW6A                      0x81 0x005
+#define MX27_PAD_USBOTG_STP__GPIO5_1                       0x81 0x032
+#define MX27_PAD_USBOTG_DIR__USBOTG_DIR                    0x82 0x000
+#define MX27_PAD_USBOTG_DIR__KP_ROW7A                      0x82 0x005
+#define MX27_PAD_USBOTG_DIR__GPIO5_2                       0x82 0x032
+#define MX27_PAD_UART2_CTS__UART2_CTS                      0x83 0x004
+#define MX27_PAD_UART2_CTS__KP_COL7                        0x83 0x005
+#define MX27_PAD_UART2_CTS__GPIO5_3                        0x83 0x032
+#define MX27_PAD_UART2_RTS__UART2_RTS                      0x84 0x000
+#define MX27_PAD_UART2_RTS__KP_ROW7                        0x84 0x005
+#define MX27_PAD_UART2_RTS__GPIO5_4                        0x84 0x032
+#define MX27_PAD_PWMO__PWMO                                0x85 0x004
+#define MX27_PAD_PWMO__GPIO5_5                             0x85 0x032
+#define MX27_PAD_UART2_TXD__UART2_TXD                      0x86 0x004
+#define MX27_PAD_UART2_TXD__KP_COL6                        0x86 0x005
+#define MX27_PAD_UART2_TXD__GPIO5_6                        0x86 0x032
+#define MX27_PAD_UART2_RXD__UART2_RXD                      0x87 0x000
+#define MX27_PAD_UART2_RXD__KP_ROW6                        0x87 0x005
+#define MX27_PAD_UART2_RXD__GPIO5_7                        0x87 0x032
+#define MX27_PAD_UART3_TXD__UART3_TXD                      0x88 0x004
+#define MX27_PAD_UART3_TXD__GPIO5_8                        0x88 0x032
+#define MX27_PAD_UART3_RXD__UART3_RXD                      0x89 0x000
+#define MX27_PAD_UART3_RXD__GPIO5_9                        0x89 0x032
+#define MX27_PAD_UART3_CTS__UART3_CTS                      0x8a 0x004
+#define MX27_PAD_UART3_CTS__GPIO5_10                       0x8a 0x032
+#define MX27_PAD_UART3_RTS__UART3_RTS                      0x8b 0x000
+#define MX27_PAD_UART3_RTS__GPIO5_11                       0x8b 0x032
+#define MX27_PAD_UART1_TXD__UART1_TXD                      0x8c 0x004
+#define MX27_PAD_UART1_TXD__GPIO5_12                       0x8c 0x032
+#define MX27_PAD_UART1_RXD__UART1_RXD                      0x8d 0x000
+#define MX27_PAD_UART1_RXD__GPIO5_13                       0x8d 0x032
+#define MX27_PAD_UART1_CTS__UART1_CTS                      0x8e 0x004
+#define MX27_PAD_UART1_CTS__GPIO5_14                       0x8e 0x032
+#define MX27_PAD_UART1_RTS__UART1_RTS                      0x8f 0x000
+#define MX27_PAD_UART1_RTS__GPIO5_15                       0x8f 0x032
+#define MX27_PAD_RTCK__RTCK                                0x90 0x004
+#define MX27_PAD_RTCK__OWIRE                               0x90 0x005
+#define MX27_PAD_RTCK__GPIO5_16                            0x90 0x032
+#define MX27_PAD_RESET_OUT_B__RESET_OUT_B                  0x91 0x004
+#define MX27_PAD_RESET_OUT_B__GPIO5_17                     0x91 0x032
+#define MX27_PAD_SD1_D0__SD1_D0                            0x92 0x004
+#define MX27_PAD_SD1_D0__CSPI3_MISO                        0x92 0x001
+#define MX27_PAD_SD1_D0__GPIO5_18                          0x92 0x032
+#define MX27_PAD_SD1_D1__SD1_D1                            0x93 0x004
+#define MX27_PAD_SD1_D1__GPIO5_19                          0x93 0x032
+#define MX27_PAD_SD1_D2__SD1_D2                            0x94 0x004
+#define MX27_PAD_SD1_D2__GPIO5_20                          0x94 0x032
+#define MX27_PAD_SD1_D3__SD1_D3                            0x95 0x004
+#define MX27_PAD_SD1_D3__CSPI3_SS                          0x95 0x005
+#define MX27_PAD_SD1_D3__GPIO5_21                          0x95 0x032
+#define MX27_PAD_SD1_CMD__SD1_CMD                          0x96 0x004
+#define MX27_PAD_SD1_CMD__CSPI3_MOSI                       0x96 0x005
+#define MX27_PAD_SD1_CMD__GPIO5_22                         0x96 0x032
+#define MX27_PAD_SD1_CLK__SD1_CLK                          0x97 0x004
+#define MX27_PAD_SD1_CLK__CSPI3_SCLK                       0x97 0x005
+#define MX27_PAD_SD1_CLK__GPIO5_23                         0x97 0x032
+#define MX27_PAD_USBOTG_CLK__USBOTG_CLK                    0x98 0x000
+#define MX27_PAD_USBOTG_CLK__GPIO5_24                      0x98 0x032
+#define MX27_PAD_USBOTG_DATA7__USBOTG_DATA7                0x99 0x004
+#define MX27_PAD_USBOTG_DATA7__GPIO5_25                    0x99 0x032
+#define MX27_PAD_UNUSED9__UNUSED9                          0x9a 0x004
+#define MX27_PAD_UNUSED9__GPIO5_26                         0x9a 0x032
+#define MX27_PAD_UNUSED10__UNUSED10                        0x9b 0x004
+#define MX27_PAD_UNUSED10__GPIO5_27                        0x9b 0x032
+#define MX27_PAD_UNUSED11__UNUSED11                        0x9c 0x004
+#define MX27_PAD_UNUSED11__GPIO5_28                        0x9c 0x032
+#define MX27_PAD_UNUSED12__UNUSED12                        0x9d 0x004
+#define MX27_PAD_UNUSED12__GPIO5_29                        0x9d 0x032
+#define MX27_PAD_UNUSED13__UNUSED13                        0x9e 0x004
+#define MX27_PAD_UNUSED13__GPIO5_30                        0x9e 0x032
+#define MX27_PAD_UNUSED14__UNUSED14                        0x9f 0x004
+#define MX27_PAD_UNUSED14__GPIO5_31                        0x9f 0x032
+#define MX27_PAD_NFRB__NFRB                                0xa0 0x000
+#define MX27_PAD_NFRB__ETMTRACEPKT3                        0xa0 0x005
+#define MX27_PAD_NFRB__GPIO6_0                             0xa0 0x032
+#define MX27_PAD_NFCLE__NFCLE                              0xa1 0x004
+#define MX27_PAD_NFCLE__ETMTRACEPKT0                       0xa1 0x005
+#define MX27_PAD_NFCLE__GPIO6_1                            0xa1 0x032
+#define MX27_PAD_NFWP_B__NFWP_B                            0xa2 0x004
+#define MX27_PAD_NFWP_B__ETMTRACEPKT1                      0xa2 0x005
+#define MX27_PAD_NFWP_B__GPIO6_2                           0xa2 0x032
+#define MX27_PAD_NFCE_B__NFCE_B                            0xa3 0x004
+#define MX27_PAD_NFCE_B__ETMTRACEPKT2                      0xa3 0x005
+#define MX27_PAD_NFCE_B__GPIO6_3                           0xa3 0x032
+#define MX27_PAD_NFALE__NFALE                              0xa4 0x004
+#define MX27_PAD_NFALE__ETMPIPESTAT0                       0xa4 0x005
+#define MX27_PAD_NFALE__GPIO6_4                            0xa4 0x032
+#define MX27_PAD_NFRE_B__NFRE_B                            0xa5 0x004
+#define MX27_PAD_NFRE_B__ETMPIPESTAT1                      0xa5 0x005
+#define MX27_PAD_NFRE_B__GPIO6_5                           0xa5 0x032
+#define MX27_PAD_NFWE_B__NFWE_B                            0xa6 0x004
+#define MX27_PAD_NFWE_B__ETMPIPESTAT2                      0xa6 0x005
+#define MX27_PAD_NFWE_B__GPIO6_6                           0xa6 0x032
+#define MX27_PAD_PC_POE__PC_POE                            0xa7 0x004
+#define MX27_PAD_PC_POE__ATA_BUFFER_EN                     0xa7 0x005
+#define MX27_PAD_PC_POE__GPIO6_7                           0xa7 0x032
+#define MX27_PAD_PC_RW_B__PC_RW_B                          0xa8 0x004
+#define MX27_PAD_PC_RW_B__ATA_IORDY                        0xa8 0x001
+#define MX27_PAD_PC_RW_B__GPIO6_8                          0xa8 0x032
+#define MX27_PAD_IOIS16__IOIS16                            0xa9 0x000
+#define MX27_PAD_IOIS16__ATA_INTRQ                         0xa9 0x001
+#define MX27_PAD_IOIS16__GPIO6_9                           0xa9 0x032
+#define MX27_PAD_PC_RST__PC_RST                            0xaa 0x004
+#define MX27_PAD_PC_RST__ATA_RESET_B                       0xaa 0x005
+#define MX27_PAD_PC_RST__GPIO6_10                          0xaa 0x032
+#define MX27_PAD_PC_BVD2__PC_BVD2                          0xab 0x000
+#define MX27_PAD_PC_BVD2__ATA_DMACK                        0xab 0x005
+#define MX27_PAD_PC_BVD2__GPIO6_11                         0xab 0x032
+#define MX27_PAD_PC_BVD1__PC_BVD1                          0xac 0x000
+#define MX27_PAD_PC_BVD1__ATA_DMARQ                        0xac 0x001
+#define MX27_PAD_PC_BVD1__GPIO6_12                         0xac 0x032
+#define MX27_PAD_PC_VS2__PC_VS2                            0xad 0x000
+#define MX27_PAD_PC_VS2__ATA_DA0                           0xad 0x005
+#define MX27_PAD_PC_VS2__GPIO6_13                          0xad 0x032
+#define MX27_PAD_PC_VS1__PC_VS1                            0xae 0x000
+#define MX27_PAD_PC_VS1__ATA_DA1                           0xae 0x005
+#define MX27_PAD_PC_VS1__GPIO6_14                          0xae 0x032
+#define MX27_PAD_CLKO__CLKO                                0xaf 0x004
+#define MX27_PAD_CLKO__GPIO6_15                            0xaf 0x032
+#define MX27_PAD_PC_PWRON__PC_PWRON                        0xb0 0x000
+#define MX27_PAD_PC_PWRON__ATA_DA2                         0xb0 0x005
+#define MX27_PAD_PC_PWRON__GPIO6_16                        0xb0 0x032
+#define MX27_PAD_PC_READY__PC_READY                        0xb1 0x000
+#define MX27_PAD_PC_READY__ATA_CS0                         0xb1 0x005
+#define MX27_PAD_PC_READY__GPIO6_17                        0xb1 0x032
+#define MX27_PAD_PC_WAIT_B__PC_WAIT_B                      0xb2 0x000
+#define MX27_PAD_PC_WAIT_B__ATA_CS1                        0xb2 0x005
+#define MX27_PAD_PC_WAIT_B__GPIO6_18                       0xb2 0x032
+#define MX27_PAD_PC_CD2_B__PC_CD2_B                        0xb3 0x000
+#define MX27_PAD_PC_CD2_B__ATA_DIOW                        0xb3 0x005
+#define MX27_PAD_PC_CD2_B__GPIO6_19                        0xb3 0x032
+#define MX27_PAD_PC_CD1_B__PC_CD1_B                        0xb4 0x000
+#define MX27_PAD_PC_CD1_B__ATA_DIOR                        0xb4 0x005
+#define MX27_PAD_PC_CD1_B__GPIO6_20                        0xb4 0x032
+#define MX27_PAD_CS4_B__CS4_B                              0xb5 0x004
+#define MX27_PAD_CS4_B__ETMTRACESYNC                       0xb5 0x005
+#define MX27_PAD_CS4_B__GPIO6_21                           0xb5 0x032
+#define MX27_PAD_CS5_B__CS5_B                              0xb6 0x004
+#define MX27_PAD_CS5_B__ETMTRACECLK                        0xb6 0x005
+#define MX27_PAD_CS5_B__GPIO6_22                           0xb6 0x032
+#define MX27_PAD_ATA_DATA15__ATA_DATA15                    0xb7 0x004
+#define MX27_PAD_ATA_DATA15__ETMTRACEPKT4                  0xb7 0x005
+#define MX27_PAD_ATA_DATA15__FEC_TX_EN                     0xb7 0x006
+#define MX27_PAD_ATA_DATA15__GPIO6_23                      0xb7 0x032
+#define MX27_PAD_UNUSED15__UNUSED15                        0xb8 0x004
+#define MX27_PAD_UNUSED15__GPIO6_24                        0xb8 0x032
+#define MX27_PAD_UNUSED16__UNUSED16                        0xb9 0x004
+#define MX27_PAD_UNUSED16__GPIO6_25                        0xb9 0x032
+#define MX27_PAD_UNUSED17__UNUSED17                        0xba 0x004
+#define MX27_PAD_UNUSED17__GPIO6_26                        0xba 0x032
+#define MX27_PAD_UNUSED18__UNUSED18                        0xbb 0x004
+#define MX27_PAD_UNUSED18__GPIO6_27                        0xbb 0x032
+#define MX27_PAD_UNUSED19__UNUSED19                        0xbc 0x004
+#define MX27_PAD_UNUSED19__GPIO6_28                        0xbc 0x032
+#define MX27_PAD_UNUSED20__UNUSED20                        0xbd 0x004
+#define MX27_PAD_UNUSED20__GPIO6_29                        0xbd 0x032
+#define MX27_PAD_UNUSED21__UNUSED21                        0xbe 0x004
+#define MX27_PAD_UNUSED21__GPIO6_30                        0xbe 0x032
+#define MX27_PAD_UNUSED22__UNUSED22                        0xbf 0x004
+#define MX27_PAD_UNUSED22__GPIO6_31                        0xbf 0x032
+
+#endif /* __DTS_IMX27_PINFUNC_H */
diff --git a/arch/arm/boot/dts/imx27-pingrp.h b/arch/arm/boot/dts/imx27-pingrp.h
new file mode 100644 (file)
index 0000000..edc1e90
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2013 Markus Pargmann <mpa@pengutronix.de>, Pengutronix
+ *
+ * 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
+ */
+#ifndef __DTS_IMX27_PINGRP_H
+#define __DTS_IMX27_PINGRP_H
+
+#include "imx27-pinfunc.h"
+
+#define MX27_CSPI1_PINGRP1 \
+       MX27_PAD_CSPI1_MISO__CSPI1_MISO 0x0 \
+       MX27_PAD_CSPI1_MOSI__CSPI1_MOSI 0x0 \
+       MX27_PAD_CSPI1_SCLK__CSPI1_SCLK 0x0
+
+#define MX27_CSPI2_PINGRP1 \
+       MX27_PAD_CSPI2_MISO__CSPI2_MISO 0x0 \
+       MX27_PAD_CSPI2_MOSI__CSPI2_MOSI 0x0 \
+       MX27_PAD_CSPI2_SCLK__CSPI2_SCLK 0x0
+
+#define MX27_CSPI3_PINGRP1 \
+       MX27_PAD_SD1_CLK__CSPI3_SCLK 0x0 \
+       MX27_PAD_SD1_D0__CSPI3_MISO 0x0 \
+       MX27_PAD_SD1_CMD__CSPI3_MOSI 0x0
+
+#define MX27_FB_PINGRP1 \
+       MX27_PAD_CLS__CLS 0x0 \
+       MX27_PAD_CONTRAST__CONTRAST 0x0 \
+       MX27_PAD_LD0__LD0 0x0 \
+       MX27_PAD_LD1__LD1 0x0 \
+       MX27_PAD_LD2__LD2 0x0 \
+       MX27_PAD_LD3__LD3 0x0 \
+       MX27_PAD_LD4__LD4 0x0 \
+       MX27_PAD_LD5__LD5 0x0 \
+       MX27_PAD_LD6__LD6 0x0 \
+       MX27_PAD_LD7__LD7 0x0 \
+       MX27_PAD_LD8__LD8 0x0 \
+       MX27_PAD_LD9__LD9 0x0 \
+       MX27_PAD_LD10__LD10 0x0 \
+       MX27_PAD_LD11__LD11 0x0 \
+       MX27_PAD_LD12__LD12 0x0 \
+       MX27_PAD_LD13__LD13 0x0 \
+       MX27_PAD_LD14__LD14 0x0 \
+       MX27_PAD_LD15__LD15 0x0 \
+       MX27_PAD_LD16__LD16 0x0 \
+       MX27_PAD_LD17__LD17 0x0 \
+       MX27_PAD_LSCLK__LSCLK 0x0 \
+       MX27_PAD_OE_ACD__OE_ACD 0x0 \
+       MX27_PAD_PS__PS 0x0 \
+       MX27_PAD_REV__REV 0x0 \
+       MX27_PAD_SPL_SPR__SPL_SPR 0x0 \
+       MX27_PAD_HSYNC__HSYNC 0x0 \
+       MX27_PAD_VSYNC__VSYNC 0x0
+
+#define MX27_FEC1_PINGRP1 \
+       MX27_PAD_SD3_CMD__FEC_TXD0 0x0 \
+       MX27_PAD_SD3_CLK__FEC_TXD1 0x0 \
+       MX27_PAD_ATA_DATA0__FEC_TXD2 0x0 \
+       MX27_PAD_ATA_DATA1__FEC_TXD3 0x0 \
+       MX27_PAD_ATA_DATA2__FEC_RX_ER 0x0 \
+       MX27_PAD_ATA_DATA3__FEC_RXD1 0x0 \
+       MX27_PAD_ATA_DATA4__FEC_RXD2 0x0 \
+       MX27_PAD_ATA_DATA5__FEC_RXD3 0x0 \
+       MX27_PAD_ATA_DATA6__FEC_MDIO 0x0 \
+       MX27_PAD_ATA_DATA7__FEC_MDC 0x0 \
+       MX27_PAD_ATA_DATA8__FEC_CRS 0x0 \
+       MX27_PAD_ATA_DATA9__FEC_TX_CLK 0x0 \
+       MX27_PAD_ATA_DATA10__FEC_RXD0 0x0 \
+       MX27_PAD_ATA_DATA11__FEC_RX_DV 0x0 \
+       MX27_PAD_ATA_DATA12__FEC_RX_CLK 0x0 \
+       MX27_PAD_ATA_DATA13__FEC_COL 0x0 \
+       MX27_PAD_ATA_DATA14__FEC_TX_ER 0x0 \
+       MX27_PAD_ATA_DATA15__FEC_TX_EN 0x0
+
+#define MX27_I2C1_PINGRP1 \
+       MX27_PAD_I2C_DATA__I2C_DATA 0x0 \
+       MX27_PAD_I2C_CLK__I2C_CLK 0x0
+
+#define MX27_I2C2_PINGRP1 \
+       MX27_PAD_I2C2_SDA__I2C2_SDA 0x0 \
+       MX27_PAD_I2C2_SCL__I2C2_SCL 0x0
+
+#define MX27_OWIRE1_PINGRP1 \
+       MX27_PAD_RTCK__OWIRE 0x0
+
+#define MX27_PWM_PINGRP1 \
+       MX27_PAD_PWMO__PWMO 0x0
+
+#define MX27_SDHC1_PINGRP1 \
+       MX27_PAD_SD1_CLK__SD1_CLK \
+       MX27_PAD_SD1_CMD__SD1_CMD \
+       MX27_PAD_SD1_D0__SD1_D0 \
+       MX27_PAD_SD1_D1__SD1_D1 \
+       MX27_PAD_SD1_D2__SD1_D2 \
+       MX27_PAD_SD1_D3__SD1_D3
+
+#define MX27_SDHC2_PINGRP1 \
+       MX27_PAD_SD2_CLK__SD2_CLK \
+       MX27_PAD_SD2_CMD__SD2_CMD \
+       MX27_PAD_SD2_D0__SD2_D0 \
+       MX27_PAD_SD2_D1__SD2_D1 \
+       MX27_PAD_SD2_D2__SD2_D2 \
+       MX27_PAD_SD2_D3__SD2_D3
+
+#define MX27_SDHC3_PINGRP1 \
+       MX27_PAD_SD3_CLK__SD3_CLK \
+       MX27_PAD_SD3_CMD__SD3_CMD \
+       MX27_PAD_SD3_D0__SD3_D0 \
+       MX27_PAD_SD3_D1__SD3_D1 \
+       MX27_PAD_SD3_D2__SD3_D2 \
+       MX27_PAD_SD3_D3__SD3_D3
+
+#define MX27_UART1_PINGRP1 \
+       MX27_PAD_UART1_TXD__UART1_TXD 0x0 \
+       MX27_PAD_UART1_RXD__UART1_RXD 0x0
+
+#define MX27_UART1_RTSCTS_PINGRP1 \
+       MX27_PAD_UART1_CTS__UART1_CTS 0x0 \
+       MX27_PAD_UART1_RTS__UART1_RTS 0x0
+
+#define MX27_UART2_PINGRP1 \
+       MX27_PAD_UART2_TXD__UART2_TXD 0x0 \
+       MX27_PAD_UART2_RXD__UART2_RXD 0x0
+
+#define MX27_UART2_RTSCTS_PINGRP1 \
+       MX27_PAD_UART2_CTS__UART2_CTS 0x0 \
+       MX27_PAD_UART2_RTS__UART2_RTS 0x0
+
+#define MX27_UART3_PINGRP1 \
+       MX27_PAD_UART3_TXD__UART3_TXD 0x0 \
+       MX27_PAD_UART3_RXD__UART3_RXD 0x0
+
+#define MX27_UART3_RTSCTS_PINGRP1 \
+       MX27_PAD_UART3_CTS__UART3_CTS 0x0 \
+       MX27_PAD_UART3_RTS__UART3_RTS 0x0
+
+#endif /* __DTS_IMX27_PINGRP_H */
index 826231eb44466f9187a564b3a587c7b18d686b28..63b1b3291c1db121b97a193baeb20d21bb0832db 100644 (file)
@@ -10,6 +10,9 @@
  */
 
 #include "skeleton.dtsi"
+#include "imx27-pingrp.h"
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/gpio/gpio.h>
 
 / {
        aliases {
                                status = "disabled";
                        };
 
-                       gpio1: gpio@10015000 {
-                               compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
-                               reg = <0x10015000 0x100>;
-                               interrupts = <8>;
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               interrupt-controller;
-                               #interrupt-cells = <2>;
-                       };
-
-                       gpio2: gpio@10015100 {
-                               compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
-                               reg = <0x10015100 0x100>;
-                               interrupts = <8>;
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               interrupt-controller;
-                               #interrupt-cells = <2>;
-                       };
-
-                       gpio3: gpio@10015200 {
-                               compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
-                               reg = <0x10015200 0x100>;
-                               interrupts = <8>;
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               interrupt-controller;
-                               #interrupt-cells = <2>;
-                       };
-
-                       gpio4: gpio@10015300 {
-                               compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
-                               reg = <0x10015300 0x100>;
-                               interrupts = <8>;
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               interrupt-controller;
-                               #interrupt-cells = <2>;
-                       };
-
-                       gpio5: gpio@10015400 {
-                               compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
-                               reg = <0x10015400 0x100>;
-                               interrupts = <8>;
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               interrupt-controller;
-                               #interrupt-cells = <2>;
-                       };
-
-                       gpio6: gpio@10015500 {
-                               compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
-                               reg = <0x10015500 0x100>;
-                               interrupts = <8>;
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               interrupt-controller;
-                               #interrupt-cells = <2>;
+                       iomuxc: iomuxc@10015000 {
+                               compatible = "fsl,imx27-iomuxc";
+                               reg = <0x10015000 0x600>;
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               ranges;
+
+                               gpio1: gpio@10015000 {
+                                       compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
+                                       reg = <0x10015000 0x100>;
+                                       interrupts = <8>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                               };
+
+                               gpio2: gpio@10015100 {
+                                       compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
+                                       reg = <0x10015100 0x100>;
+                                       interrupts = <8>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                               };
+
+                               gpio3: gpio@10015200 {
+                                       compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
+                                       reg = <0x10015200 0x100>;
+                                       interrupts = <8>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                               };
+
+                               gpio4: gpio@10015300 {
+                                       compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
+                                       reg = <0x10015300 0x100>;
+                                       interrupts = <8>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                               };
+
+                               gpio5: gpio@10015400 {
+                                       compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
+                                       reg = <0x10015400 0x100>;
+                                       interrupts = <8>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                               };
+
+                               gpio6: gpio@10015500 {
+                                       compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
+                                       reg = <0x10015500 0x100>;
+                                       interrupts = <8>;
+                                       gpio-controller;
+                                       #gpio-cells = <2>;
+                                       interrupt-controller;
+                                       #interrupt-cells = <2>;
+                               };
                        };
 
                        audmux: audmux@10016000 {
index e2efd8d89c4fb82bca3602274380c7a81a515518..334dea58e17ecf2466ee954f9aa17197d91298ed 100644 (file)
                                        fsl,voltage = <MXS_VOLTAGE_HIGH>;
                                        fsl,pull-up = <MXS_PULL_DISABLE>;
                                };
+
+                               usb0_otg_apf28dev: otg-apf28dev@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               MX28_PAD_LCD_D23__GPIO_1_23
+                                       >;
+                                       fsl,drive-strength = <MXS_DRIVE_4mA>;
+                                       fsl,voltage = <MXS_VOLTAGE_HIGH>;
+                                       fsl,pull-up = <MXS_PULL_DISABLE>;
+                               };
                        };
 
                        lcdif@80030000 {
 
        ahb@80080000 {
                usb0: usb@80080000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&usb0_otg_apf28dev>;
                        vbus-supply = <&reg_usb0_vbus>;
                        status = "okay";
                };
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_usb0_vbus: usb0_vbus {
+               reg_usb0_vbus: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "usb0_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
                        gpio = <&gpio1 23 1>;
+                       enable-active-high;
                };
        };
 
index 6f254ca816cbd42b3ff80d61c3bfdb86c6f8438d..e1ce9179db63b612839a85d35b5122fd3fd4dd59 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_3p3v: 3p3v {
+               reg_3p3v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "3P3V";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
index cabb6171a19d925c214442daa47473a6a2be31a5..ae7c3390e65a5ddc6210c4d256b406719e624d14 100644 (file)
                usb0: usb@80080000 {
                        pinctrl-names = "default";
                        pinctrl-0 = <&usb0_otg_cfa10036>;
+                       dr_mode = "peripheral";
+                       phy_type = "utmi";
                        status = "okay";
                };
        };
index f93e9a700e52b39287ff6761cf9c2ffdc21ea617..e5beaa58bb40262fcd42297615f476a9881eff17 100644 (file)
@@ -54,7 +54,7 @@
        ahb@80080000 {
                usb1: usb@80090000 {
                        vbus-supply = <&reg_usb1_vbus>;
-                       pinctrl-0 = <&usbphy1_pins_a>;
+                       pinctrl-0 = <&usb1_pins_a>;
                        pinctrl-names = "default";
                        status = "okay";
                };
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_usb1_vbus: usb1_vbus {
+               reg_usb1_vbus: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <&usb_pins_cfa10037>;
                        regulator-name = "usb1_vbus";
index 7087b4bf6a8f88e5748a70747af337de3524a5c0..7d51459de5e82038d391ce03c115410787815482 100644 (file)
                                i2c-parent = <&i2c1>;
 
                                i2c@0 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
                                        reg = <0>;
+
+                                       adc0: nau7802@2a {
+                                               compatible = "nuvoton,nau7802";
+                                               reg = <0x2a>;
+                                               nuvoton,vldo = <3000>;
+                                       };
                                };
 
                                i2c@1 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
                                        reg = <1>;
+
+                                       adc1: nau7802@2a {
+                                               compatible = "nuvoton,nau7802";
+                                               reg = <0x2a>;
+                                               nuvoton,vldo = <3000>;
+                                       };
                                };
 
                                i2c@2 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
                                        reg = <2>;
+
+                                       adc2: nau7802@2a {
+                                               compatible = "nuvoton,nau7802";
+                                               reg = <0x2a>;
+                                               nuvoton,vldo = <3000>;
+                                       };
                                };
 
                                i2c@3 {
        ahb@80080000 {
                usb1: usb@80090000 {
                        vbus-supply = <&reg_usb1_vbus>;
-                       pinctrl-0 = <&usbphy1_pins_a>;
+                       pinctrl-0 = <&usb1_pins_a>;
                        pinctrl-names = "default";
                        status = "okay";
                };
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_usb1_vbus: usb1_vbus {
+               reg_usb1_vbus: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <&usb_pins_cfa10049>;
                        regulator-name = "usb1_vbus";
index 3c1312885ae0dafc1642e30d27a58cc3cf49d12b..c4e00ce4b6daf19b2cdb0ead0c299899b154a1dd 100644 (file)
        ahb@80080000 {
                usb1: usb@80090000 {
                        vbus-supply = <&reg_usb1_vbus>;
-                       pinctrl-0 = <&usbphy1_pins_a>;
+                       pinctrl-0 = <&usb1_pins_a>;
                        pinctrl-names = "default";
                        status = "okay";
                };
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_usb1_vbus: usb1_vbus {
+               reg_usb1_vbus: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        pinctrl-names = "default";
                        pinctrl-0 = <&usb_pins_cfa10057>;
                        regulator-name = "usb1_vbus";
index 2469d34df0ae1499de3236f13e180969dd78eed7..7c9cc783f0d1a4c93d4385aabaab508c786dc465 100644 (file)
        ahb@80080000 {
                usb1: usb@80090000 {
                        vbus-supply = <&reg_usb1_vbus>;
-                       pinctrl-0 = <&usbphy1_pins_a>;
+                       pinctrl-0 = <&usb1_pins_a>;
                        pinctrl-names = "default";
                        status = "okay";
                };
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_usb1_vbus: usb1_vbus {
+               reg_usb1_vbus: regulator@0 {
                        pinctrl-names = "default";
                        pinctrl-0 = <&usb_pins_cfa10058>;
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "usb1_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
diff --git a/arch/arm/boot/dts/imx28-duckbill.dts b/arch/arm/boot/dts/imx28-duckbill.dts
new file mode 100644 (file)
index 0000000..5f326c1
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2013 Michael Heimpold <mhei@heimpold.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
+ */
+
+/dts-v1/;
+#include "imx28.dtsi"
+
+/ {
+       model = "I2SE Duckbill";
+       compatible = "i2se,duckbill", "fsl,imx28";
+
+       memory {
+               reg = <0x40000000 0x08000000>;
+       };
+
+       apb@80000000 {
+               apbh@80000000 {
+                       ssp0: ssp@80010000 {
+                               compatible = "fsl,imx28-mmc";
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&mmc0_8bit_pins_a
+                                       &mmc0_cd_cfg &mmc0_sck_cfg>;
+                               bus-width = <8>;
+                               vmmc-supply = <&reg_3p3v>;
+                               status = "okay";
+                       };
+
+                       pinctrl@80018000 {
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&hog_pins_a>;
+
+                               hog_pins_a: hog@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               MX28_PAD_ENET0_RX_CLK__GPIO_4_13 /* PHY Reset */
+                                       >;
+                                       fsl,drive-strength = <MXS_DRIVE_4mA>;
+                                       fsl,voltage = <MXS_VOLTAGE_HIGH>;
+                                       fsl,pull-up = <MXS_PULL_DISABLE>;
+                               };
+
+                               led_pins_a: led_gpio@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               MX28_PAD_AUART1_RX__GPIO_3_4
+                                               MX28_PAD_AUART1_TX__GPIO_3_5
+                                       >;
+                                       fsl,drive-strength = <MXS_DRIVE_4mA>;
+                                       fsl,voltage = <MXS_VOLTAGE_HIGH>;
+                                       fsl,pull-up = <MXS_PULL_DISABLE>;
+                               };
+                       };
+               };
+
+               apbx@80040000 {
+                       duart: serial@80074000 {
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&duart_pins_a>;
+                               status = "okay";
+                       };
+
+                       usbphy0: usbphy@8007c000 {
+                               status = "okay";
+                       };
+               };
+       };
+
+       ahb@80080000 {
+               usb0: usb@80080000 {
+                       status = "okay";
+               };
+
+               mac0: ethernet@800f0000 {
+                       phy-mode = "rmii";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&mac0_pins_a>;
+                       phy-supply = <&reg_3p3v>;
+                       phy-reset-gpios = <&gpio4 13 0>;
+                       phy-reset-duration = <100>;
+                       status = "okay";
+               };
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_3p3v: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&led_pins_a>;
+
+               status {
+                       label = "duckbill:green:status";
+                       gpios = <&gpio3 5 0>;
+               };
+
+               failure {
+                       label = "duckbill:red:status";
+                       gpios = <&gpio3 4 0>;
+               };
+       };
+};
diff --git a/arch/arm/boot/dts/imx28-eukrea-mbmx283lc.dts b/arch/arm/boot/dts/imx28-eukrea-mbmx283lc.dts
new file mode 100644 (file)
index 0000000..7c1572c
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <eric@eukrea.com>
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.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.
+ */
+
+/*
+ * Module contains : i.MX282 + 64MB DDR2 + NAND + Ethernet PHY + RTC
+ */
+
+/dts-v1/;
+#include "imx28-eukrea-mbmx28lc.dtsi"
+
+/ {
+       model = "Eukrea Electromatique MBMX283LC";
+       compatible = "eukrea,mbmx283lc", "eukrea,mbmx28lc", "fsl,imx28";
+
+       memory {
+               reg = <0x40000000 0x04000000>;
+       };
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&gpmi_pins_a>;
+       status = "okay";
+};
+
+&i2c0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c0_pins_a>;
+       status = "okay";
+
+       pcf8563: rtc@51 {
+               compatible = "nxp,pcf8563";
+               reg = <0x51>;
+       };
+};
+
+
+&mac0 {
+       phy-mode = "rmii";
+       pinctrl-names = "default";
+       pinctrl-0 = <&mac0_pins_a>;
+       phy-reset-gpios = <&gpio4 13 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pinctrl{
+       pinctrl-names = "default";
+       pinctrl-0 = <&hog_pins_cpuimx283>;
+
+       hog_pins_cpuimx283: hog-cpuimx283@0 {
+               reg = <0>;
+               fsl,pinmux-ids = <
+                       MX28_PAD_ENET0_RX_CLK__GPIO_4_13
+                       MX28_PAD_ENET0_TX_CLK__GPIO_4_5
+               >;
+               fsl,drive-strength = <MXS_DRIVE_4mA>;
+               fsl,voltage = <MXS_VOLTAGE_HIGH>;
+               fsl,pull-up = <MXS_PULL_ENABLE>;
+       };
+};
diff --git a/arch/arm/boot/dts/imx28-eukrea-mbmx287lc.dts b/arch/arm/boot/dts/imx28-eukrea-mbmx287lc.dts
new file mode 100644 (file)
index 0000000..e773144
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <eric@eukrea.com>
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.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.
+ */
+
+/*
+ * Module contains : i.MX287 + 128MB DDR2 + NAND + 2 x Ethernet PHY + RTC
+ */
+
+#include "imx28-eukrea-mbmx283lc.dts"
+
+/ {
+       model = "Eukrea Electromatique MBMX287LC";
+       compatible = "eukrea,mbmx287lc", "eukrea,mbmx283lc", "eukrea,mbmx28lc", "fsl,imx28";
+
+       memory {
+               reg = <0x40000000 0x08000000>;
+       };
+};
+
+&mac1 {
+       phy-mode = "rmii";
+       pinctrl-names = "default";
+       pinctrl-0 = <&mac1_pins_a>;
+       phy-reset-gpios = <&gpio3 27 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&pinctrl {
+       pinctrl-names = "default";
+       pinctrl-0 = <&hog_pins_cpuimx283 &hog_pins_cpuimx287>;
+       hog_pins_cpuimx287: hog-cpuimx287@0 {
+               reg = <0>;
+               fsl,pinmux-ids = <
+                       MX28_PAD_SPDIF__GPIO_3_27
+               >;
+               fsl,drive-strength = <MXS_DRIVE_4mA>;
+               fsl,voltage = <MXS_VOLTAGE_HIGH>;
+               fsl,pull-up = <MXS_PULL_ENABLE>;
+       };
+};
diff --git a/arch/arm/boot/dts/imx28-eukrea-mbmx28lc.dtsi b/arch/arm/boot/dts/imx28-eukrea-mbmx28lc.dtsi
new file mode 100644 (file)
index 0000000..927b391
--- /dev/null
@@ -0,0 +1,326 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <eric@eukrea.com>
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.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 <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+#include "imx28.dtsi"
+
+/ {
+       model = "Eukrea Electromatique MBMX28LC";
+       compatible = "eukrea,mbmx28lc", "fsl,imx28";
+
+       backlight {
+               compatible = "pwm-backlight";
+               pwms = <&pwm 4 1000000>;
+               brightness-levels = <0 25 50 75 100 125 150 175 200 225 255>;
+               default-brightness-level = <10>;
+       };
+
+       button-sw3 {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&gpio_button_sw3_pins_mbmx28lc>;
+
+               sw3 {
+                       label = "SW3";
+                       gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_MISC>;
+                       gpio-key,wakeup;
+               };
+       };
+
+       button-sw4 {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&gpio_button_sw4_pins_mbmx28lc>;
+
+               sw4 {
+                       label = "SW4";
+                       gpios = <&gpio1 20 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_MISC>;
+                       gpio-key,wakeup;
+               };
+       };
+
+       led-d6 {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&led_d6_pins_mbmx28lc>;
+
+               led1 {
+                       label = "d6";
+                       gpios = <&gpio1 23 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       led-d7 {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&led_d7_pins_mbmx28lc>;
+
+               led1 {
+                       label = "d7";
+                       gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "default-on";
+               };
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_3p3v: regulator@0 {
+                       compatible = "regulator-fixed";
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_lcd_3v3: regulator@1 {
+                       compatible = "regulator-fixed";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&reg_lcd_3v3_pins_mbmx28lc>;
+                       regulator-name = "lcd-3v3";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       gpio = <&gpio3 30 GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+               };
+
+               reg_usb0_vbus: regulator@2 {
+                       compatible = "regulator-fixed";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&reg_usb0_vbus_pins_mbmx28lc>;
+                       regulator-name = "usb0_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio1 18 GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+               };
+
+               reg_usb1_vbus: regulator@3 {
+                       compatible = "regulator-fixed";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&reg_usb1_vbus_pins_mbmx28lc>;
+                       regulator-name = "usb1_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio1 19 GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+               };
+       };
+
+       sound {
+               compatible = "fsl,imx28-mbmx28lc-sgtl5000",
+                            "fsl,mxs-audio-sgtl5000";
+               model = "imx28-mbmx28lc-sgtl5000";
+               saif-controllers = <&saif0 &saif1>;
+               audio-codec = <&sgtl5000>;
+       };
+};
+
+&duart {
+       pinctrl-names = "default";
+       pinctrl-0 = <&duart_4pins_a>;
+       status = "okay";
+};
+
+&i2c0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&i2c0_pins_a>;
+       status = "okay";
+
+       sgtl5000: codec@0a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
+               VDDA-supply = <&reg_3p3v>;
+               VDDIO-supply = <&reg_3p3v>;
+               clocks = <&saif0>;
+       };
+};
+
+&lcdif {
+       pinctrl-names = "default";
+       pinctrl-0 = <&lcdif_18bit_pins_a &lcdif_pins_mbmx28lc>;
+       lcd-supply = <&reg_lcd_3v3>;
+       display = <&display0>;
+       status = "okay";
+
+       display0: display0 {
+               model = "43WVF1G-0";
+               bits-per-pixel = <16>;
+               bus-width = <18>;
+
+               display-timings {
+                       native-mode = <&timing0>;
+                       timing0: timing0 {
+                               clock-frequency = <9072000>;
+                               hactive = <480>;
+                               vactive = <272>;
+                               hback-porch = <10>;
+                               hfront-porch = <5>;
+                               vback-porch = <8>;
+                               vfront-porch = <8>;
+                               hsync-len = <40>;
+                               vsync-len = <10>;
+                               hsync-active = <0>;
+                               vsync-active = <0>;
+                               de-active = <1>;
+                               pixelclk-active = <1>;
+                       };
+               };
+       };
+};
+
+&lradc {
+       fsl,lradc-touchscreen-wires = <4>;
+       status = "okay";
+};
+
+&pinctrl {
+       gpio_button_sw3_pins_mbmx28lc: gpio-button-sw3-mbmx28lc@0 {
+               reg = <0>;
+               fsl,pinmux-ids = <
+                       MX28_PAD_LCD_D21__GPIO_1_21
+               >;
+               fsl,drive-strength = <MXS_DRIVE_4mA>;
+               fsl,voltage = <MXS_VOLTAGE_HIGH>;
+               fsl,pull-up = <MXS_PULL_DISABLE>;
+       };
+
+       gpio_button_sw4_pins_mbmx28lc: gpio-button-sw4-mbmx28lc@0 {
+               reg = <0>;
+               fsl,pinmux-ids = <
+                       MX28_PAD_LCD_D20__GPIO_1_20
+               >;
+               fsl,drive-strength = <MXS_DRIVE_4mA>;
+               fsl,voltage = <MXS_VOLTAGE_HIGH>;
+               fsl,pull-up = <MXS_PULL_DISABLE>;
+       };
+
+       lcdif_pins_mbmx28lc: lcdif-mbmx28lc@0 {
+               reg = <0>;
+               fsl,pinmux-ids = <
+                       MX28_PAD_LCD_VSYNC__LCD_VSYNC
+                       MX28_PAD_LCD_HSYNC__LCD_HSYNC
+                       MX28_PAD_LCD_DOTCLK__LCD_DOTCLK
+                       MX28_PAD_LCD_ENABLE__LCD_ENABLE
+               >;
+               fsl,drive-strength = <MXS_DRIVE_4mA>;
+               fsl,voltage = <MXS_VOLTAGE_HIGH>;
+               fsl,pull-up = <MXS_PULL_DISABLE>;
+       };
+
+       led_d6_pins_mbmx28lc: led-d6-mbmx28lc@0 {
+               reg = <0>;
+               fsl,pinmux-ids = <
+                       MX28_PAD_LCD_D23__GPIO_1_23
+               >;
+               fsl,drive-strength = <MXS_DRIVE_4mA>;
+               fsl,voltage = <MXS_VOLTAGE_HIGH>;
+               fsl,pull-up = <MXS_PULL_DISABLE>;
+       };
+
+       led_d7_pins_mbmx28lc: led-d7-mbmx28lc@0 {
+               reg = <0>;
+               fsl,pinmux-ids = <
+                       MX28_PAD_LCD_D22__GPIO_1_22
+               >;
+               fsl,drive-strength = <MXS_DRIVE_4mA>;
+               fsl,voltage = <MXS_VOLTAGE_HIGH>;
+               fsl,pull-up = <MXS_PULL_DISABLE>;
+       };
+
+       reg_lcd_3v3_pins_mbmx28lc: lcd-3v3-mbmx28lc@0 {
+               reg = <0>;
+               fsl,pinmux-ids = <
+                       MX28_PAD_LCD_RESET__GPIO_3_30
+               >;
+               fsl,drive-strength = <MXS_DRIVE_4mA>;
+               fsl,voltage = <MXS_VOLTAGE_HIGH>;
+               fsl,pull-up = <MXS_PULL_DISABLE>;
+       };
+
+       reg_usb0_vbus_pins_mbmx28lc: reg-usb0-vbus-mbmx28lc@0 {
+               reg = <0>;
+               fsl,pinmux-ids = <
+                       MX28_PAD_LCD_D18__GPIO_1_18
+               >;
+               fsl,drive-strength = <MXS_DRIVE_4mA>;
+               fsl,voltage = <MXS_VOLTAGE_HIGH>;
+               fsl,pull-up = <MXS_PULL_DISABLE>;
+       };
+
+       reg_usb1_vbus_pins_mbmx28lc: reg-usb1-vbus-mbmx28lc@0 {
+               reg = <0>;
+               fsl,pinmux-ids = <
+                       MX28_PAD_LCD_D19__GPIO_1_19
+               >;
+               fsl,drive-strength = <MXS_DRIVE_4mA>;
+               fsl,voltage = <MXS_VOLTAGE_HIGH>;
+               fsl,pull-up = <MXS_PULL_DISABLE>;
+       };
+};
+
+&pwm {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pwm4_pins_a>;
+       status = "okay";
+};
+
+&saif0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&saif0_pins_a>;
+       status = "okay";
+};
+
+&saif1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&saif1_pins_a>;
+       fsl,saif-master = <&saif0>;
+       status = "okay";
+};
+
+&ssp0 {
+       compatible = "fsl,imx28-mmc";
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_4bit_pins_a &mmc0_cd_cfg &mmc0_sck_cfg>;
+       bus-width = <4>;
+       cd-inverted;
+       status = "okay";
+};
+
+&usb0 {
+       disable-over-current;
+       vbus-supply = <&reg_usb0_vbus>;
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&usb0_id_pins_b>;
+};
+
+&usb1 {
+       vbus-supply = <&reg_usb1_vbus>;
+       status = "okay";
+};
+
+&usbphy0 {
+       status = "okay";
+};
+
+&usbphy1 {
+       status = "okay";
+};
index 4267c2b05d600ac8bfb9cf2612a3b72977d7dc0e..e4cc44c98585f415744e30a41fd4d066797043a3 100644 (file)
                        i2c0: i2c@80058000 {
                                pinctrl-names = "default";
                                pinctrl-0 = <&i2c0_pins_a>;
+                               clock-frequency = <400000>;
                                status = "okay";
 
                                sgtl5000: codec@0a {
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_3p3v: 3p3v {
+               reg_3p3v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "3P3V";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        regulator-always-on;
                };
 
-               reg_vddio_sd0: vddio-sd0 {
+               reg_vddio_sd0: regulator@1 {
                        compatible = "regulator-fixed";
+                       reg = <1>;
                        regulator-name = "vddio-sd0";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        gpio = <&gpio3 28 0>;
                };
 
-               reg_fec_3v3: fec-3v3 {
+               reg_fec_3v3: regulator@2 {
                        compatible = "regulator-fixed";
+                       reg = <2>;
                        regulator-name = "fec-3v3";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        gpio = <&gpio2 15 0>;
                };
 
-               reg_usb0_vbus: usb0_vbus {
+               reg_usb0_vbus: regulator@3 {
                        compatible = "regulator-fixed";
+                       reg = <3>;
                        regulator-name = "usb0_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
                        enable-active-high;
                };
 
-               reg_usb1_vbus: usb1_vbus {
+               reg_usb1_vbus: regulator@4 {
                        compatible = "regulator-fixed";
+                       reg = <4>;
                        regulator-name = "usb1_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
                        enable-active-high;
                };
 
-               reg_lcd_3v3: lcd-3v3 {
+               reg_lcd_3v3: regulator@5 {
                        compatible = "regulator-fixed";
+                       reg = <5>;
                        regulator-name = "lcd-3v3";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        enable-active-high;
                };
 
-               reg_can_3v3: can-3v3 {
+               reg_can_3v3: regulator@6 {
                        compatible = "regulator-fixed";
+                       reg = <6>;
                        regulator-name = "can-3v3";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
index d3958da60bd72e95052ff08af73a46b83b461c58..15f3b39716e8602b1fe5d0184ccdf26bf6161b39 100644 (file)
                usb1: usb@80090000 {
                        vbus-supply = <&reg_usb1_vbus>;
                        pinctrl-names = "default";
-                       pinctrl-0 = <&usbphy1_pins_a>;
+                       pinctrl-0 = <&usb1_pins_a>;
                        disable-over-current;
                        status = "okay";
                };
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_3p3v: 3p3v {
+               reg_3p3v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "3P3V";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        regulator-always-on;
                };
 
-               reg_vddio_sd0: vddio-sd0 {
+               reg_vddio_sd0: regulator@1 {
                        compatible = "regulator-fixed";
+                       reg = <1>;
                        regulator-name = "vddio-sd0";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        gpio = <&gpio3 29 0>;
                };
 
-               reg_vddio_sd1: vddio-sd1 {
+               reg_vddio_sd1: regulator@2 {
                        compatible = "regulator-fixed";
+                       reg = <2>;
                        regulator-name = "vddio-sd1";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        gpio = <&gpio2 19 0>;
                };
 
-               reg_usb1_vbus: usb1_vbus {
+               reg_usb1_vbus: regulator@3 {
                        compatible = "regulator-fixed";
+                       reg = <3>;
                        regulator-name = "usb1_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
index 8e2477fbe1d70963d583973ed4c46a6554c99104..8536b0db9018e8b580d502f8e7a52e9770743590 100644 (file)
                usb0: usb@80080000 {
                        vbus-supply = <&reg_usb0_vbus>;
                        pinctrl-names = "default";
-                       pinctrl-0 = <&usbphy0_pins_a>;
+                       pinctrl-0 = <&usb0_pins_a>;
                        status = "okay";
                };
 
                usb1: usb@80090000 {
                        vbus-supply = <&reg_usb1_vbus>;
                        pinctrl-names = "default";
-                       pinctrl-0 = <&usbphy1_pins_a>;
+                       pinctrl-0 = <&usb1_pins_a>;
                        status = "okay";
                };
 
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_3p3v: 3p3v {
+               reg_3p3v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "3P3V";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        regulator-always-on;
                };
 
-               reg_vddio_sd0: vddio-sd0 {
+               reg_vddio_sd0: regulator@1 {
                        compatible = "regulator-fixed";
+                       reg = <1>;
                        regulator-name = "vddio-sd0";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        gpio = <&gpio3 28 0>;
                };
 
-               reg_usb0_vbus: usb0_vbus {
+               reg_usb0_vbus: regulator@2 {
                        compatible = "regulator-fixed";
+                       reg = <2>;
                        regulator-name = "usb0_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
                        gpio = <&gpio3 12 0>;
                };
 
-               reg_usb1_vbus: usb1_vbus {
+               reg_usb1_vbus: regulator@3 {
                        compatible = "regulator-fixed";
+                       reg = <3>;
                        regulator-name = "usb1_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
index 4870f07bf56a86423c6a910a5c86ce6fce1624a4..0ce3cb8e7914ecebdaccd0b576bdd2f3420329e8 100644 (file)
                usb0: usb@80080000 {
                        vbus-supply = <&reg_usb0_vbus>;
                        pinctrl-names = "default";
-                       pinctrl-0 = <&usbphy0_pins_b>;
+                       pinctrl-0 = <&usb0_pins_b>;
                        status = "okay";
                };
 
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_usb0_vbus: usb0_vbus {
+               reg_usb0_vbus: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "usb0_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
index be5a0550d58c3312d37f36e04c937d5739c7f181..3c54e8d152e6dccabeaf61b79506c8ae5e6534fc 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_usb0_vbus: usb0_vbus {
+               reg_usb0_vbus: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "usb0_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
@@ -53,8 +56,9 @@
                        enable-active-high;
                };
 
-               reg_usb1_vbus: usb1_vbus {
+               reg_usb1_vbus: regulator@1 {
                        compatible = "regulator-fixed";
+                       reg = <1>;
                        regulator-name = "usb1_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
                        enable-active-high;
                };
 
-               reg_2p5v: 2p5v {
+               reg_2p5v: regulator@2 {
                        compatible = "regulator-fixed";
+                       reg = <2>;
                        regulator-name = "2P5V";
                        regulator-min-microvolt = <2500000>;
                        regulator-max-microvolt = <2500000>;
                        regulator-always-on;
                };
 
-               reg_3p3v: 3p3v {
+               reg_3p3v: regulator@3 {
                        compatible = "regulator-fixed";
+                       reg = <3>;
                        regulator-name = "3P3V";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        regulator-always-on;
                };
 
-               reg_can_xcvr: can-xcvr {
+               reg_can_xcvr: regulator@4 {
                        compatible = "regulator-fixed";
+                       reg = <4>;
                        regulator-name = "CAN XCVR";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
@@ -89,8 +96,9 @@
                        pinctrl-0 = <&tx28_flexcan_xcvr_pins>;
                };
 
-               reg_lcd: lcd-power {
+               reg_lcd: regulator@5 {
                        compatible = "regulator-fixed";
+                       reg = <5>;
                        regulator-name = "LCD POWER";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        enable-active-high;
                };
 
-               reg_lcd_reset: lcd-reset {
+               reg_lcd_reset: regulator@6 {
                        compatible = "regulator-fixed";
+                       reg = <6>;
                        regulator-name = "LCD RESET";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
index cda19c8b0a470ecb6900255c8a9eb17b85bdf9dc..8a2a70d24d148ad6eade597920fc91983cee5120 100644 (file)
                                        fsl,pull-up = <MXS_PULL_DISABLE>;
                                };
 
+                               auart2_pins_a: auart2-pins@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               MX28_PAD_AUART2_RX__AUART2_RX
+                                               MX28_PAD_AUART2_TX__AUART2_TX
+                                               MX28_PAD_AUART2_CTS__AUART2_CTS
+                                               MX28_PAD_AUART2_RTS__AUART2_RTS
+                                       >;
+                                       fsl,drive-strength = <MXS_DRIVE_4mA>;
+                                       fsl,voltage = <MXS_VOLTAGE_HIGH>;
+                                       fsl,pull-up = <MXS_PULL_DISABLE>;
+                               };
+
                                auart3_pins_a: auart3@0 {
                                        reg = <0>;
                                        fsl,pinmux-ids = <
                                        fsl,pull-up = <MXS_PULL_DISABLE>;
                                };
 
+                               lcdif_18bit_pins_a: lcdif-18bit@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               MX28_PAD_LCD_D00__LCD_D0
+                                               MX28_PAD_LCD_D01__LCD_D1
+                                               MX28_PAD_LCD_D02__LCD_D2
+                                               MX28_PAD_LCD_D03__LCD_D3
+                                               MX28_PAD_LCD_D04__LCD_D4
+                                               MX28_PAD_LCD_D05__LCD_D5
+                                               MX28_PAD_LCD_D06__LCD_D6
+                                               MX28_PAD_LCD_D07__LCD_D7
+                                               MX28_PAD_LCD_D08__LCD_D8
+                                               MX28_PAD_LCD_D09__LCD_D9
+                                               MX28_PAD_LCD_D10__LCD_D10
+                                               MX28_PAD_LCD_D11__LCD_D11
+                                               MX28_PAD_LCD_D12__LCD_D12
+                                               MX28_PAD_LCD_D13__LCD_D13
+                                               MX28_PAD_LCD_D14__LCD_D14
+                                               MX28_PAD_LCD_D15__LCD_D15
+                                               MX28_PAD_LCD_D16__LCD_D16
+                                               MX28_PAD_LCD_D17__LCD_D17
+                                       >;
+                                       fsl,drive-strength = <MXS_DRIVE_4mA>;
+                                       fsl,voltage = <MXS_VOLTAGE_HIGH>;
+                                       fsl,pull-up = <MXS_PULL_DISABLE>;
+                               };
+
                                lcdif_16bit_pins_a: lcdif-16bit@0 {
                                        reg = <0>;
                                        fsl,pinmux-ids = <
                                        fsl,pull-up = <MXS_PULL_DISABLE>;
                                };
 
-                               usbphy0_pins_a: usbphy0@0 {
+                               usb0_pins_a: usb0@0 {
                                        reg = <0>;
                                        fsl,pinmux-ids = <
                                                MX28_PAD_SSP2_SS2__USB0_OVERCURRENT
                                        fsl,pull-up = <MXS_PULL_DISABLE>;
                                };
 
-                               usbphy0_pins_b: usbphy0@1 {
+                               usb0_pins_b: usb0@1 {
                                        reg = <1>;
                                        fsl,pinmux-ids = <
                                                MX28_PAD_AUART1_CTS__USB0_OVERCURRENT
                                        fsl,pull-up = <MXS_PULL_DISABLE>;
                                };
 
-                               usbphy1_pins_a: usbphy1@0 {
+                               usb1_pins_a: usb1@0 {
                                        reg = <0>;
                                        fsl,pinmux-ids = <
                                                MX28_PAD_SSP2_SS1__USB1_OVERCURRENT
                                        fsl,voltage = <MXS_VOLTAGE_HIGH>;
                                        fsl,pull-up = <MXS_PULL_ENABLE>;
                                };
+
+                               usb0_id_pins_b: usb0id1@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               MX28_PAD_PWM2__USB0_ID
+                                       >;
+                                       fsl,drive-strength = <MXS_DRIVE_12mA>;
+                                       fsl,voltage = <MXS_VOLTAGE_HIGH>;
+                                       fsl,pull-up = <MXS_PULL_ENABLE>;
+                               };
+
                        };
 
                        digctl: digctl@8001c000 {
                                                20 21 22 23 24 25>;
                                status = "disabled";
                                clocks = <&clks 41>;
+                               #io-channel-cells = <1>;
                        };
 
                        spdif: spdif@80054000 {
diff --git a/arch/arm/boot/dts/imx50-evk.dts b/arch/arm/boot/dts/imx50-evk.dts
new file mode 100644 (file)
index 0000000..a859264
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2013 Greg Ungerer <gerg@uclinux.org>
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * 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
+ */
+
+/dts-v1/;
+#include "imx50.dtsi"
+
+/ {
+       model = "Freescale i.MX50 Evaluation Kit";
+       compatible = "fsl,imx50-evk", "fsl,imx50";
+
+       memory {
+               reg = <0x70000000 0x80000000>;
+       };
+};
+
+&cspi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_cspi>;
+       fsl,spi-num-chipselects = <2>;
+       cs-gpios = <&gpio4 11 0>, <&gpio4 13 0>;
+       status = "okay";
+
+       flash: m25p32@1 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "m25p32", "m25p80";
+               spi-max-frequency = <25000000>;
+               reg = <1>;
+
+               partition@0 {
+                       label = "bootloader";
+                       reg = <0x0 0x100000>;
+                       read-only;
+               };
+
+               partition@100000 {
+                       label = "kernel";
+                       reg = <0x100000 0x300000>;
+               };
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec>;
+       phy-mode = "rmii";
+       phy-reset-gpios = <&gpio4 12 0>;
+       status = "okay";
+};
+
+&iomuxc {
+       imx50-evk {
+               pinctrl_cspi: cspigrp {
+                       fsl,pins = <MX50_CSPI_PINGRP1>;
+               };
+
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <MX50_FEC_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX50_UART1_PINGRP1>;
+               };
+       };
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&usbh1 {
+       status = "okay";
+};
+
+&usbh2 {
+       status = "okay";
+};
+
+&usbh3 {
+       status = "okay";
+};
+
+&usbotg {
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx50-pinfunc.h b/arch/arm/boot/dts/imx50-pinfunc.h
new file mode 100644 (file)
index 0000000..97e6e7f
--- /dev/null
@@ -0,0 +1,923 @@
+/*
+ * Copyright 2013 Greg Ungerer <gerg@uclinux.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.
+ *
+ */
+
+#ifndef __DTS_IMX50_PINFUNC_H
+#define __DTS_IMX50_PINFUNC_H
+
+/*
+ * The pin function ID is a tuple of
+ * <mux_reg conf_reg input_reg mux_mode input_val>
+ */
+#define MX50_PAD_KEY_COL0__KPP_COL_0                           0x020 0x2cc 0x000 0x0 0x0
+#define MX50_PAD_KEY_COL0__GPIO4_0                             0x020 0x2cc 0x000 0x1 0x0
+#define MX50_PAD_KEY_COL0__EIM_NANDF_CLE                       0x020 0x2cc 0x000 0x2 0x0
+#define MX50_PAD_KEY_COL0__CTI_TRIGIN7                         0x020 0x2cc 0x000 0x6 0x0
+#define MX50_PAD_KEY_COL0__USBPHY1_TXREADY                     0x020 0x2cc 0x000 0x7 0x0
+#define MX50_PAD_KEY_ROW0__KPP_ROW_0                           0x024 0x2d0 0x000 0x0 0x0
+#define MX50_PAD_KEY_ROW0__GPIO4_1                             0x024 0x2d0 0x000 0x1 0x0
+#define MX50_PAD_KEY_ROW0__EIM_NANDF_ALE                       0x024 0x2d0 0x000 0x2 0x0
+#define MX50_PAD_KEY_ROW0__CTI_TRIGIN_ACK7                     0x024 0x2d0 0x000 0x6 0x0
+#define MX50_PAD_KEY_ROW0__USBPHY1_RXVALID                     0x024 0x2d0 0x000 0x7 0x0
+#define MX50_PAD_KEY_COL1__KPP_COL_1                           0x028 0x2d4 0x000 0x0 0x0
+#define MX50_PAD_KEY_COL1__GPIO4_2                             0x028 0x2d4 0x000 0x1 0x0
+#define MX50_PAD_KEY_COL1__EIM_NANDF_CEN_0                     0x028 0x2d4 0x000 0x2 0x0
+#define MX50_PAD_KEY_COL1__CTI_TRIGOUT_ACK6                    0x028 0x2d4 0x000 0x6 0x0
+#define MX50_PAD_KEY_COL1__USBPHY1_RXACTIVE                    0x028 0x2d4 0x000 0x7 0x0
+#define MX50_PAD_KEY_ROW1__KPP_ROW_1                           0x02c 0x2d8 0x000 0x0 0x0
+#define MX50_PAD_KEY_ROW1__GPIO4_3                             0x02c 0x2d8 0x000 0x1 0x0
+#define MX50_PAD_KEY_ROW1__EIM_NANDF_CEN_1                     0x02c 0x2d8 0x000 0x2 0x0
+#define MX50_PAD_KEY_ROW1__CTI_TRIGOUT_ACK7                    0x02c 0x2d8 0x000 0x6 0x0
+#define MX50_PAD_KEY_ROW1__USBPHY1_RXERROR                     0x02c 0x2d8 0x000 0x7 0x0
+#define MX50_PAD_KEY_COL2__KPP_COL_1                           0x030 0x2dc 0x000 0x0 0x0
+#define MX50_PAD_KEY_COL2__GPIO4_4                             0x030 0x2dc 0x000 0x1 0x0
+#define MX50_PAD_KEY_COL2__EIM_NANDF_CEN_2                     0x030 0x2dc 0x000 0x2 0x0
+#define MX50_PAD_KEY_COL2__CTI_TRIGOUT6                                0x030 0x2dc 0x000 0x6 0x0
+#define MX50_PAD_KEY_COL2__USBPHY1_SIECLOCK                    0x030 0x2dc 0x000 0x7 0x0
+#define MX50_PAD_KEY_ROW2__KPP_ROW_2                           0x034 0x2e0 0x000 0x0 0x0
+#define MX50_PAD_KEY_ROW2__GPIO4_5                             0x034 0x2e0 0x000 0x1 0x0
+#define MX50_PAD_KEY_ROW2__EIM_NANDF_CEN_3                     0x034 0x2e0 0x000 0x2 0x0
+#define MX50_PAD_KEY_ROW2__CTI_TRIGOUT7                                0x034 0x2e0 0x000 0x6 0x0
+#define MX50_PAD_KEY_ROW2__USBPHY1_LINESTATE_0                 0x034 0x2e0 0x000 0x7 0x0
+#define MX50_PAD_KEY_COL3__KPP_COL_2                           0x038 0x2e4 0x000 0x0 0x0
+#define MX50_PAD_KEY_COL3__GPIO4_6                             0x038 0x2e4 0x000 0x1 0x0
+#define MX50_PAD_KEY_COL3__EIM_NANDF_READY0                    0x038 0x2e4 0x7b4 0x2 0x0
+#define MX50_PAD_KEY_COL3__SDMA_EXT_EVENT_0                    0x038 0x2e4 0x7b8 0x6 0x0
+#define MX50_PAD_KEY_COL3__USBPHY1_LINESTATE_1                 0x038 0x2e4 0x000 0x7 0x0
+#define MX50_PAD_KEY_ROW3__KPP_ROW_3                           0x03c 0x2e8 0x000 0x0 0x0
+#define MX50_PAD_KEY_ROW3__GPIO4_7                             0x03c 0x2e8 0x000 0x1 0x0
+#define MX50_PAD_KEY_ROW3__EIM_NANDF_DQS                       0x03c 0x2e8 0x7b0 0x2 0x0
+#define MX50_PAD_KEY_ROW3__SDMA_EXT_EVENT_1                    0x03c 0x2e8 0x7bc 0x6 0x0
+#define MX50_PAD_KEY_ROW3__USBPHY1_VBUSVALID                   0x03c 0x2e8 0x000 0x7 0x0
+#define MX50_PAD_I2C1_SCL__I2C1_SCL                            0x040 0x2ec 0x000 0x0 0x0
+#define MX50_PAD_I2C1_SCL__GPIO6_18                            0x040 0x2ec 0x000 0x1 0x0
+#define MX50_PAD_I2C1_SCL__UART2_TXD_MUX                       0x040 0x2ec 0x7cc 0x2 0x0
+#define MX50_PAD_I2C1_SDA__I2C1_SDA                            0x044 0x2f0 0x000 0x0 0x0
+#define MX50_PAD_I2C1_SDA__GPIO6_19                            0x044 0x2f0 0x000 0x1 0x0
+#define MX50_PAD_I2C1_SDA__UART2_RXD_MUX                       0x044 0x2f0 0x7cc 0x2 0x1
+#define MX50_PAD_I2C2_SCL__I2C2_SCL                            0x048 0x2f4 0x000 0x0 0x0
+#define MX50_PAD_I2C2_SCL__GPIO6_20                            0x048 0x2f4 0x000 0x1 0x0
+#define MX50_PAD_I2C2_SCL__UART2_CTS                           0x048 0x2f4 0x000 0x2 0x0
+#define MX50_PAD_I2C2_SDA__I2C2_SDA                            0x04c 0x2f8 0x000 0x0 0x0
+#define MX50_PAD_I2C2_SDA__GPIO6_21                            0x04c 0x2f8 0x000 0x1 0x0
+#define MX50_PAD_I2C2_SDA__UART2_RTS                           0x04c 0x2f8 0x7c8 0x2 0x1
+#define MX50_PAD_I2C3_SCL__I2C3_SCL                            0x050 0x2fc 0x000 0x0 0x0
+#define MX50_PAD_I2C3_SCL__GPIO6_22                            0x050 0x2fc 0x000 0x1 0x0
+#define MX50_PAD_I2C3_SCL__FEC_MDC                             0x050 0x2fc 0x000 0x2 0x0
+#define MX50_PAD_I2C3_SCL__GPC_PMIC_RDY                                0x050 0x2fc 0x000 0x3 0x0
+#define MX50_PAD_I2C3_SCL__GPT_CAPIN1                          0x050 0x2fc 0x000 0x5 0x0
+#define MX50_PAD_I2C3_SCL__OBSERVE_MUX_OBSRV_INT_OUT0          0x050 0x2fc 0x000 0x6 0x0
+#define MX50_PAD_I2C3_SCL__USBOH1_USBOTG_OC                    0x050 0x2fc 0x7e8 0x7 0x0
+#define MX50_PAD_I2C3_SDA__I2C3_SDA                            0x054 0x300 0x000 0x0 0x0
+#define MX50_PAD_I2C3_SDA__GPIO6_23                            0x054 0x300 0x000 0x1 0x0
+#define MX50_PAD_I2C3_SDA__FEC_MDIO                            0x054 0x300 0x774 0x2 0x0
+#define MX50_PAD_I2C3_SDA__TZIC_PWRFAIL_INT                    0x054 0x300 0x000 0x3 0x0
+#define MX50_PAD_I2C3_SDA__SRTC_ALARM_DEB                      0x054 0x300 0x000 0x4 0x0
+#define MX50_PAD_I2C3_SDA__GPT_CAPIN2                          0x054 0x300 0x000 0x5 0x0
+#define MX50_PAD_I2C3_SDA__OBSERVE_MUX_OBSRV_INT_OUT1          0x054 0x300 0x000 0x6 0x0
+#define MX50_PAD_I2C3_SDA__USBOH1_USBOTG_PWR                   0x054 0x300 0x000 0x7 0x0
+#define MX50_PAD_PWM1__PWM1_PWMO                               0x058 0x304 0x000 0x0 0x0
+#define MX50_PAD_PWM1__GPIO6_24                                        0x058 0x304 0x000 0x1 0x0
+#define MX50_PAD_PWM1__USBOH1_USBOTG_OC                                0x058 0x304 0x7e8 0x2 0x1
+#define MX50_PAD_PWM1__GPT_CMPOUT1                             0x058 0x304 0x000 0x5 0x0
+#define MX50_PAD_PWM1__OBSERVE_MUX_OBSRV_INT_OUT2              0x058 0x304 0x000 0x6 0x0
+#define MX50_PAD_PWM1__SJC_FAIL                                        0x058 0x304 0x000 0x7 0x0
+#define MX50_PAD_PWM2__PWM2_PWMO                               0x05c 0x308 0x000 0x0 0x0
+#define MX50_PAD_PWM2__GPIO6_25                                        0x05c 0x308 0x000 0x1 0x0
+#define MX50_PAD_PWM2__USBOH1_USBOTG_PWR                       0x05c 0x308 0x000 0x2 0x0
+#define MX50_PAD_PWM2__GPT_CMPOUT2                             0x05c 0x308 0x000 0x5 0x0
+#define MX50_PAD_PWM2__OBSERVE_MUX_OBSRV_INT_OUT3              0x05c 0x308 0x000 0x6 0x0
+#define MX50_PAD_PWM2__SRC_ANY_PU_RST                          0x05c 0x308 0x000 0x7 0x0
+#define MX50_PAD_OWIRE__OWIRE_LINE                             0x060 0x30c 0x000 0x0 0x0
+#define MX50_PAD_OWIRE__GPIO6_26                               0x060 0x30c 0x000 0x1 0x0
+#define MX50_PAD_OWIRE__USBOH1_USBH1_OC                                0x060 0x30c 0x000 0x2 0x0
+#define MX50_PAD_OWIRE__CCM_SSI_EXT1_CLK                       0x060 0x30c 0x000 0x3 0x0
+#define MX50_PAD_OWIRE__EPDC_PWRIRQ                            0x060 0x30c 0x000 0x4 0x0
+#define MX50_PAD_OWIRE__GPT_CMPOUT3                            0x060 0x30c 0x000 0x5 0x0
+#define MX50_PAD_OWIRE__OBSERVE_MUX_OBSRV_INT_OUT4             0x060 0x30c 0x000 0x6 0x0
+#define MX50_PAD_OWIRE__SJC_JTAG_ACT                           0x060 0x30c 0x000 0x7 0x0
+#define MX50_PAD_EPITO__EPIT1_EPITO                            0x064 0x310 0x000 0x0 0x0
+#define MX50_PAD_EPITO__GPIO6_27                               0x064 0x310 0x000 0x1 0x0
+#define MX50_PAD_EPITO__USBOH1_USBH1_PWR                       0x064 0x310 0x000 0x2 0x0
+#define MX50_PAD_EPITO__CCM_SSI_EXT2_CLK                       0x064 0x310 0x000 0x3 0x0
+#define MX50_PAD_EPITO__DPLLIP1_TOG_EN                         0x064 0x310 0x000 0x4 0x0
+#define MX50_PAD_EPITO__GPT_CLK_IN                             0x064 0x310 0x000 0x5 0x0
+#define MX50_PAD_EPITO__PMU_IRQ_B                              0x064 0x310 0x000 0x6 0x0
+#define MX50_PAD_EPITO__SJC_DE_B                               0x064 0x310 0x000 0x7 0x0
+#define MX50_PAD_WDOG__WDOG1_WDOG_B                            0x068 0x314 0x000 0x0 0x0
+#define MX50_PAD_WDOG__GPIO6_28                                        0x068 0x314 0x000 0x1 0x0
+#define MX50_PAD_WDOG__WDOG1_WDOG_RST_B_DEB                    0x068 0x314 0x000 0x2 0x0
+#define MX50_PAD_WDOG__CCM_XTAL32K                             0x068 0x314 0x000 0x6 0x0
+#define MX50_PAD_WDOG__SJC_DONE                                        0x068 0x314 0x000 0x7 0x0
+#define MX50_PAD_SSI_TXFS__AUDMUX_AUD3_TXFS                    0x06c 0x318 0x000 0x0 0x0
+#define MX50_PAD_SSI_TXFS__GPIO6_0                             0x06c 0x318 0x000 0x1 0x0
+#define MX50_PAD_SSI_TXFS__SRC_BT_FUSE_RSV_1                   0x06c 0x318 0x000 0x6 0x0
+#define MX50_PAD_SSI_TXFS__USBPHY1_DATAOUT_8                   0x06c 0x318 0x000 0x7 0x0
+#define MX50_PAD_SSI_TXC__AUDMUX_AUD3_TXC                      0x070 0x31c 0x000 0x0 0x0
+#define MX50_PAD_SSI_TXC__GPIO6_1                              0x070 0x31c 0x000 0x1 0x0
+#define MX50_PAD_SSI_TXC__SRC_BT_FUSE_RSV_0                    0x070 0x31c 0x000 0x6 0x0
+#define MX50_PAD_SSI_TXC__USBPHY1_DATAOUT_9                    0x070 0x31c 0x000 0x7 0x0
+#define MX50_PAD_SSI_TXD__AUDMUX_AUD3_TXD                      0x074 0x320 0x000 0x0 0x0
+#define MX50_PAD_SSI_TXD__GPIO6_2                              0x074 0x320 0x000 0x1 0x0
+#define MX50_PAD_SSI_TXD__CSPI_RDY                             0x074 0x320 0x6e8 0x4 0x0
+#define MX50_PAD_SSI_TXD__USBPHY1_DATAOUT_10                   0x074 0x320 0x000 0x7 0x0
+#define MX50_PAD_SSI_RXD__AUDMUX_AUD3_RXD                      0x078 0x324 0x000 0x0 0x0
+#define MX50_PAD_SSI_RXD__GPIO6_3                              0x078 0x324 0x000 0x1 0x0
+#define MX50_PAD_SSI_RXD__CSPI_SS3                             0x078 0x324 0x6f4 0x4 0x0
+#define MX50_PAD_SSI_RXD__USBPHY1_DATAOUT_11                   0x078 0x324 0x000 0x7 0x0
+#define MX50_PAD_SSI_RXFS__AUDMUX_AUD3_RXFS                    0x07c 0x328 0x000 0x0 0x0
+#define MX50_PAD_SSI_RXFS__GPIO6_4                             0x07c 0x328 0x000 0x1 0x0
+#define MX50_PAD_SSI_RXFS__UART5_TXD_MUX                       0x07c 0x328 0x7e4 0x2 0x0
+#define MX50_PAD_SSI_RXFS__EIM_WEIM_D_6                                0x07c 0x328 0x804 0x3 0x0
+#define MX50_PAD_SSI_RXFS__CSPI_SS2                            0x07c 0x328 0x6f0 0x4 0x0
+#define MX50_PAD_SSI_RXFS__FEC_COL                             0x07c 0x328 0x770 0x5 0x0
+#define MX50_PAD_SSI_RXFS__FEC_MDC                             0x07c 0x328 0x000 0x6 0x0
+#define MX50_PAD_SSI_RXFS__USBPHY1_DATAOUT_12                  0x07c 0x328 0x000 0x7 0x0
+#define MX50_PAD_SSI_RXC__AUDMUX_AUD3_RXC                      0x080 0x32c 0x000 0x0 0x0
+#define MX50_PAD_SSI_RXC__GPIO6_5                              0x080 0x32c 0x000 0x1 0x0
+#define MX50_PAD_SSI_RXC__UART5_RXD_MUX                                0x080 0x32c 0x7e4 0x2 0x1
+#define MX50_PAD_SSI_RXC__EIM_WEIM_D_7                         0x080 0x32c 0x808 0x3 0x0
+#define MX50_PAD_SSI_RXC__CSPI_SS1                             0x080 0x32c 0x6ec 0x4 0x0
+#define MX50_PAD_SSI_RXC__FEC_RX_CLK                           0x080 0x32c 0x780 0x5 0x0
+#define MX50_PAD_SSI_RXC__FEC_MDIO                             0x080 0x32c 0x774 0x6 0x1
+#define MX50_PAD_SSI_RXC__USBPHY1_DATAOUT_13                   0x080 0x32c 0x000 0x7 0x0
+#define MX50_PAD_UART1_TXD__UART1_TXD_MUX                      0x084 0x330 0x7c4 0x0 0x0
+#define MX50_PAD_UART1_TXD__GPIO6_6                            0x084 0x330 0x000 0x1 0x0
+#define MX50_PAD_UART1_TXD__USBPHY1_DATAOUT_14                 0x084 0x330 0x000 0x7 0x0
+#define MX50_PAD_UART1_RXD__UART1_RXD_MUX                      0x088 0x334 0x7c4 0x0 0x1
+#define MX50_PAD_UART1_RXD__GPIO6_7                            0x088 0x334 0x000 0x1 0x0
+#define MX50_PAD_UART1_RXD__USBPHY1_DATAOUT_15                 0x088 0x334 0x000 0x7 0x0
+#define MX50_PAD_UART1_CTS__UART1_CTS                          0x08c 0x338 0x000 0x0 0x0
+#define MX50_PAD_UART1_CTS__GPIO6_8                            0x08c 0x338 0x000 0x1 0x0
+#define MX50_PAD_UART1_CTS__UART5_TXD_MUX                      0x08c 0x338 0x7e4 0x2 0x2
+#define MX50_PAD_UART1_CTS__ESDHC4_DAT4                                0x08c 0x338 0x760 0x4 0x0
+#define MX50_PAD_UART1_CTS__ESDHC4_CMD                         0x08c 0x338 0x74c 0x5 0x0
+#define MX50_PAD_UART1_CTS__USBPHY2_DATAOUT_8                  0x08c 0x338 0x000 0x7 0x0
+#define MX50_PAD_UART1_RTS__UART1_RTS                          0x090 0x33c 0x7c0 0x0 0x3
+#define MX50_PAD_UART1_RTS__GPIO6_9                            0x090 0x33c 0x000 0x1 0x0
+#define MX50_PAD_UART1_RTS__UART5_RXD_MUX                      0x090 0x33c 0x7e4 0x2 0x3
+#define MX50_PAD_UART1_RTS__ESDHC4_DAT5                                0x090 0x33c 0x764 0x4 0x0
+#define MX50_PAD_UART1_RTS__ESDHC4_CLK                         0x090 0x33c 0x748 0x5 0x0
+#define MX50_PAD_UART1_RTS__USBPHY2_DATAOUT_9                  0x090 0x33c 0x000 0x7 0x0
+#define MX50_PAD_UART2_TXD__UART2_TXD_MUX                      0x094 0x340 0x7cc 0x0 0x2
+#define MX50_PAD_UART2_TXD__GPIO6_10                           0x094 0x340 0x000 0x1 0x0
+#define MX50_PAD_UART2_TXD__ESDHC4_DAT6                                0x094 0x340 0x768 0x4 0x0
+#define MX50_PAD_UART2_TXD__ESDHC4_DAT4                                0x094 0x340 0x760 0x5 0x1
+#define MX50_PAD_UART2_TXD__USBPHY2_DATAOUT_10                 0x094 0x340 0x000 0x7 0x0
+#define MX50_PAD_UART2_RXD__UART2_RXD_MUX                      0x098 0x344 0x7cc 0x0 0x3
+#define MX50_PAD_UART2_RXD__GPIO6_11                           0x098 0x344 0x000 0x1 0x0
+#define MX50_PAD_UART2_RXD__ESDHC4_DAT7                                0x098 0x344 0x76c 0x4 0x0
+#define MX50_PAD_UART2_RXD__ESDHC4_DAT5                                0x098 0x344 0x764 0x5 0x1
+#define MX50_PAD_UART2_RXD__USBPHY2_DATAOUT_11                 0x098 0x344 0x000 0x7 0x0
+#define MX50_PAD_UART2_CTS__UART2_CTS                          0x09c 0x348 0x000 0x0 0x0
+#define MX50_PAD_UART2_CTS__GPIO6_12                           0x09c 0x348 0x000 0x1 0x0
+#define MX50_PAD_UART2_CTS__ESDHC4_CMD                         0x09c 0x348 0x74c 0x4 0x1
+#define MX50_PAD_UART2_CTS__ESDHC4_DAT6                                0x09c 0x348 0x768 0x5 0x1
+#define MX50_PAD_UART2_CTS__USBPHY2_DATAOUT_12                 0x09c 0x348 0x000 0x7 0x0
+#define MX50_PAD_UART2_RTS__UART2_RTS                          0x0a0 0x34c 0x7c8 0x0 0x2
+#define MX50_PAD_UART2_RTS__GPIO6_13                           0x0a0 0x34c 0x000 0x1 0x0
+#define MX50_PAD_UART2_RTS__ESDHC4_CLK                         0x0a0 0x34c 0x748 0x4 0x1
+#define MX50_PAD_UART2_RTS__ESDHC4_DAT7                                0x0a0 0x34c 0x76c 0x5 0x1
+#define MX50_PAD_UART2_RTS__USBPHY2_DATAOUT_13                 0x0a0 0x34c 0x000 0x7 0x0
+#define MX50_PAD_UART3_TXD__UART3_TXD_MUX                      0x0a4 0x350 0x7d4 0x0 0x0
+#define MX50_PAD_UART3_TXD__GPIO6_14                           0x0a4 0x350 0x000 0x1 0x0
+#define MX50_PAD_UART3_TXD__ESDHC1_DAT4                                0x0a4 0x350 0x000 0x3 0x0
+#define MX50_PAD_UART3_TXD__ESDHC4_DAT0                                0x0a4 0x350 0x000 0x4 0x0
+#define MX50_PAD_UART3_TXD__ESDHC2_WP                          0x0a4 0x350 0x744 0x5 0x0
+#define MX50_PAD_UART3_TXD__EIM_WEIM_D_12                      0x0a4 0x350 0x81c 0x6 0x0
+#define MX50_PAD_UART3_TXD__USBPHY2_DATAOUT_14                 0x0a4 0x350 0x000 0x7 0x0
+#define MX50_PAD_UART3_RXD__UART3_RXD_MUX                      0x0a8 0x354 0x7d4 0x0 0x1
+#define MX50_PAD_UART3_RXD__GPIO6_15                           0x0a8 0x354 0x000 0x1 0x0
+#define MX50_PAD_UART3_RXD__ESDHC1_DAT5                                0x0a8 0x354 0x000 0x3 0x0
+#define MX50_PAD_UART3_RXD__ESDHC4_DAT1                                0x0a8 0x354 0x754 0x4 0x0
+#define MX50_PAD_UART3_RXD__ESDHC2_CD                          0x0a8 0x354 0x740 0x5 0x0
+#define MX50_PAD_UART3_RXD__EIM_WEIM_D_13                      0x0a8 0x354 0x820 0x6 0x0
+#define MX50_PAD_UART3_RXD__USBPHY2_DATAOUT_15                 0x0a8 0x354 0x000 0x7 0x0
+#define MX50_PAD_UART4_TXD__UART4_TXD_MUX                      0x0ac 0x358 0x7dc 0x0 0x0
+#define MX50_PAD_UART4_TXD__GPIO6_16                           0x0ac 0x358 0x000 0x1 0x0
+#define MX50_PAD_UART4_TXD__UART3_CTS                          0x0ac 0x358 0x7d0 0x2 0x0
+#define MX50_PAD_UART4_TXD__ESDHC1_DAT6                                0x0ac 0x358 0x000 0x3 0x0
+#define MX50_PAD_UART4_TXD__ESDHC4_DAT2                                0x0ac 0x358 0x758 0x4 0x0
+#define MX50_PAD_UART4_TXD__ESDHC2_LCTL                                0x0ac 0x358 0x000 0x5 0x0
+#define MX50_PAD_UART4_TXD__EIM_WEIM_D_14                      0x0ac 0x358 0x824 0x6 0x0
+#define MX50_PAD_UART4_RXD__UART4_RXD_MUX                      0x0b0 0x35c 0x7dc 0x0 0x1
+#define MX50_PAD_UART4_RXD__GPIO6_17                           0x0b0 0x35c 0x000 0x1 0x0
+#define MX50_PAD_UART4_RXD__UART3_RTS                          0x0b0 0x35c 0x7d0 0x2 0x1
+#define MX50_PAD_UART4_RXD__ESDHC1_DAT7                                0x0b0 0x35c 0x000 0x3 0x0
+#define MX50_PAD_UART4_RXD__ESDHC4_DAT3                                0x0b0 0x35c 0x75c 0x4 0x0
+#define MX50_PAD_UART4_RXD__ESDHC1_LCTL                                0x0b0 0x35c 0x000 0x5 0x0
+#define MX50_PAD_UART4_RXD__EIM_WEIM_D_15                      0x0b0 0x35c 0x828 0x6 0x0
+#define MX50_PAD_CSPI_SCLK__CSPI_SCLK                          0x0b4 0x360 0x000 0x0 0x0
+#define MX50_PAD_CSPI_SCLK__GPIO4_8                            0x0b4 0x360 0x000 0x1 0x0
+#define MX50_PAD_CSPI_MOSI__CSPI_MOSI                          0x0b8 0x364 0x000 0x0 0x0
+#define MX50_PAD_CSPI_MOSI__GPIO4_9                            0x0b8 0x364 0x000 0x1 0x0
+#define MX50_PAD_CSPI_MISO__CSPI_MISO                          0x0bc 0x368 0x000 0x0 0x0
+#define MX50_PAD_CSPI_MISO__GPIO4_10                           0x0bc 0x368 0x000 0x1 0x0
+#define MX50_PAD_CSPI_SS0__CSPI_SS0                            0x0c0 0x36c 0x000 0x0 0x0
+#define MX50_PAD_CSPI_SS0__GPIO4_11                            0x0c0 0x36c 0x000 0x1 0x0
+#define MX50_PAD_ECSPI1_SCLK__ECSPI1_SCLK                      0x0c4 0x370 0x000 0x0 0x0
+#define MX50_PAD_ECSPI1_SCLK__GPIO4_12                         0x0c4 0x370 0x000 0x1 0x0
+#define MX50_PAD_ECSPI1_SCLK__CSPI_RDY                         0x0c4 0x370 0x6e8 0x2 0x1
+#define MX50_PAD_ECSPI1_SCLK__ECSPI2_RDY                       0x0c4 0x370 0x000 0x3 0x0
+#define MX50_PAD_ECSPI1_SCLK__UART3_RTS                                0x0c4 0x370 0x7d0 0x4 0x2
+#define MX50_PAD_ECSPI1_SCLK__EPDC_SDCE_6                      0x0c4 0x370 0x000 0x5 0x0
+#define MX50_PAD_ECSPI1_SCLK__EIM_WEIM_D_8                     0x0c4 0x370 0x80c 0x7 0x0
+#define MX50_PAD_ECSPI1_MOSI__ECSPI1_MOSI                      0x0c8 0x374 0x000 0x0 0x0
+#define MX50_PAD_ECSPI1_MOSI__GPIO4_13                         0x0c8 0x374 0x000 0x1 0x0
+#define MX50_PAD_ECSPI1_MOSI__CSPI_SS1                         0x0c8 0x374 0x6ec 0x2 0x1
+#define MX50_PAD_ECSPI1_MOSI__ECSPI2_SS1                       0x0c8 0x374 0x000 0x3 0x0
+#define MX50_PAD_ECSPI1_MOSI__UART3_CTS                                0x0c8 0x374 0x000 0x4 0x0
+#define MX50_PAD_ECSPI1_MOSI__EPDC_SDCE_7                      0x0c8 0x374 0x000 0x5 0x0
+#define MX50_PAD_ECSPI1_MOSI__EIM_WEIM_D_9                     0x0c8 0x374 0x810 0x7 0x0
+#define MX50_PAD_ECSPI1_MISO__ECSPI1_MISO                      0x0cc 0x378 0x000 0x0 0x0
+#define MX50_PAD_ECSPI1_MISO__GPIO4_14                         0x0cc 0x378 0x000 0x1 0x0
+#define MX50_PAD_ECSPI1_MISO__CSPI_SS2                         0x0cc 0x378 0x6f0 0x2 0x1
+#define MX50_PAD_ECSPI1_MISO__ECSPI2_SS2                       0x0cc 0x378 0x000 0x3 0x0
+#define MX50_PAD_ECSPI1_MISO__UART4_RTS                                0x0cc 0x378 0x7d8 0x4 0x0
+#define MX50_PAD_ECSPI1_MISO__EPDC_SDCE_8                      0x0cc 0x378 0x000 0x5 0x0
+#define MX50_PAD_ECSPI1_MISO__EIM_WEIM_D_10                    0x0cc 0x378 0x814 0x7 0x0
+#define MX50_PAD_ECSPI1_SS0__ECSPI1_SS0                                0x0d0 0x37c 0x000 0x0 0x0
+#define MX50_PAD_ECSPI1_SS0__GPIO4_15                          0x0d0 0x37c 0x000 0x1 0x0
+#define MX50_PAD_ECSPI1_SS0__CSPI_SS3                          0x0d0 0x37c 0x6f4 0x2 0x1
+#define MX50_PAD_ECSPI1_SS0__ECSPI2_SS3                                0x0d0 0x37c 0x000 0x3 0x0
+#define MX50_PAD_ECSPI1_SS0__UART4_CTS                         0x0d0 0x37c 0x000 0x4 0x0
+#define MX50_PAD_ECSPI1_SS0__EPDC_SDCE_9                       0x0d0 0x37c 0x000 0x5 0x0
+#define MX50_PAD_ECSPI1_SS0__EIM_WEIM_D_11                     0x0d0 0x37c 0x818 0x7 0x0
+#define MX50_PAD_ECSPI2_SCLK__ECSPI2_SCLK                      0x0d4 0x380 0x000 0x0 0x0
+#define MX50_PAD_ECSPI2_SCLK__GPIO4_16                         0x0d4 0x380 0x000 0x1 0x0
+#define MX50_PAD_ECSPI2_SCLK__ELCDIF_WR_RWN                    0x0d4 0x380 0x000 0x2 0x0
+#define MX50_PAD_ECSPI2_SCLK__ECSPI1_RDY                       0x0d4 0x380 0x000 0x3 0x0
+#define MX50_PAD_ECSPI2_SCLK__UART5_RTS                                0x0d4 0x380 0x7e0 0x4 0x0
+#define MX50_PAD_ECSPI2_SCLK__ELCDIF_DOTCLK                    0x0d4 0x380 0x000 0x5 0x0
+#define MX50_PAD_ECSPI2_SCLK__EIM_NANDF_CEN_4                  0x0d4 0x380 0x000 0x6 0x0
+#define MX50_PAD_ECSPI2_SCLK__EIM_WEIM_D_8                     0x0d4 0x380 0x80c 0x7 0x1
+#define MX50_PAD_ECSPI2_MOSI__ECSPI2_MOSI                      0x0d8 0x384 0x000 0x0 0x0
+#define MX50_PAD_ECSPI2_MOSI__GPIO4_17                         0x0d8 0x384 0x000 0x1 0x0
+#define MX50_PAD_ECSPI2_MOSI__ELCDIF_RE_E                      0x0d8 0x384 0x000 0x2 0x0
+#define MX50_PAD_ECSPI2_MOSI__ECSPI1_SS1                       0x0d8 0x384 0x000 0x3 0x0
+#define MX50_PAD_ECSPI2_MOSI__UART5_CTS                                0x0d8 0x384 0x7e0 0x4 0x1
+#define MX50_PAD_ECSPI2_MOSI__ELCDIF_ENABLE                    0x0d8 0x384 0x000 0x5 0x0
+#define MX50_PAD_ECSPI2_MOSI__EIM_NANDF_CEN_5                  0x0d8 0x384 0x000 0x6 0x0
+#define MX50_PAD_ECSPI2_MOSI__EIM_WEIM_D_9                     0x0d8 0x384 0x810 0x7 0x1
+#define MX50_PAD_ECSPI2_MISO__ECSPI2_MISO                      0x0dc 0x388 0x000 0x0 0x0
+#define MX50_PAD_ECSPI2_MISO__GPIO4_18                         0x0dc 0x388 0x000 0x1 0x0
+#define MX50_PAD_ECSPI2_MISO__ELCDIF_RS                                0x0dc 0x388 0x000 0x2 0x0
+#define MX50_PAD_ECSPI2_MISO__ECSPI1_SS2                       0x0dc 0x388 0x000 0x3 0x0
+#define MX50_PAD_ECSPI2_MISO__UART5_TXD_MUX                    0x0dc 0x388 0x7e4 0x4 0x4
+#define MX50_PAD_ECSPI2_MISO__ELCDIF_VSYNC                     0x0dc 0x388 0x73c 0x5 0x0
+#define MX50_PAD_ECSPI2_MISO__EIM_NANDF_CEN_6                  0x0dc 0x388 0x000 0x6 0x0
+#define MX50_PAD_ECSPI2_MISO__EIM_WEIM_D_10                    0x0dc 0x388 0x814 0x7 0x1
+#define MX50_PAD_ECSPI2_SS0__ECSPI2_SS0                                0x0e0 0x38c 0x000 0x0 0x0
+#define MX50_PAD_ECSPI2_SS0__GPIO4_19                          0x0e0 0x38c 0x000 0x1 0x0
+#define MX50_PAD_ECSPI2_SS0__ELCDIF_CS                         0x0e0 0x38c 0x000 0x2 0x0
+#define MX50_PAD_ECSPI2_SS0__ECSPI2_SS3                                0x0e0 0x38c 0x000 0x3 0x0
+#define MX50_PAD_ECSPI2_SS0__UART5_RXD_MUX                     0x0e0 0x38c 0x7e4 0x4 0x5
+#define MX50_PAD_ECSPI2_SS0__ELCDIF_HSYNC                      0x0e0 0x38c 0x6f8 0x5 0x0
+#define MX50_PAD_ECSPI2_SS0__EIM_NANDF_CEN_7                   0x0e0 0x38c 0x000 0x6 0x0
+#define MX50_PAD_ECSPI2_SS0__EIM_WEIM_D_11                     0x0e0 0x38c 0x818 0x7 0x1
+#define MX50_PAD_SD1_CLK__ESDHC1_CLK                           0x0e4 0x390 0x000 0x0 0x0
+#define MX50_PAD_SD1_CLK__GPIO5_0                              0x0e4 0x390 0x000 0x1 0x0
+#define MX50_PAD_SD1_CLK__CCM_CLKO                             0x0e4 0x390 0x000 0x7 0x0
+#define MX50_PAD_SD1_CMD__ESDHC1_CMD                           0x0e8 0x394 0x000 0x0 0x0
+#define MX50_PAD_SD1_CMD__GPIO5_1                              0x0e8 0x394 0x000 0x1 0x0
+#define MX50_PAD_SD1_CMD__CCM_CLKO2                            0x0e8 0x394 0x000 0x7 0x0
+#define MX50_PAD_SD1_D0__ESDHC1_DAT0                           0x0ec 0x398 0x000 0x0 0x0
+#define MX50_PAD_SD1_D0__GPIO5_2                               0x0ec 0x398 0x000 0x1 0x0
+#define MX50_PAD_SD1_D0__CCM_PLL1_BYP                          0x0ec 0x398 0x6dc 0x7 0x0
+#define MX50_PAD_SD1_D1__ESDHC1_DAT1                           0x0f0 0x39c 0x000 0x0 0x0
+#define MX50_PAD_SD1_D1__GPIO5_3                               0x0f0 0x39c 0x000 0x1 0x0
+#define MX50_PAD_SD1_D1__CCM_PLL2_BYP                          0x0f0 0x39c 0x000 0x7 0x0
+#define MX50_PAD_SD1_D2__ESDHC1_DAT2                           0x0f4 0x3a0 0x000 0x0 0x0
+#define MX50_PAD_SD1_D2__GPIO5_4                               0x0f4 0x3a0 0x000 0x1 0x0
+#define MX50_PAD_SD1_D2__CCM_PLL3_BYP                          0x0f4 0x3a0 0x6e4 0x7 0x0
+#define MX50_PAD_SD1_D3__ESDHC1_DAT3                           0x0f8 0x3a4 0x000 0x0 0x0
+#define MX50_PAD_SD1_D3__GPIO5_5                               0x0f8 0x3a4 0x000 0x1 0x0
+#define MX50_PAD_SD2_CLK__ESDHC2_CLK                           0x0fc 0x3a8 0x000 0x0 0x0
+#define MX50_PAD_SD2_CLK__GPIO5_6                              0x0fc 0x3a8 0x000 0x1 0x0
+#define MX50_PAD_SD2_CLK__MSHC_SCLK                            0x0fc 0x3a8 0x000 0x2 0x0
+#define MX50_PAD_SD2_CMD__ESDHC2_CMD                           0x100 0x3ac 0x000 0x0 0x0
+#define MX50_PAD_SD2_CMD__GPIO5_7                              0x100 0x3ac 0x000 0x1 0x0
+#define MX50_PAD_SD2_CMD__MSHC_BS                              0x100 0x3ac 0x000 0x2 0x0
+#define MX50_PAD_SD2_D0__ESDHC2_DAT0                           0x104 0x3b0 0x000 0x0 0x0
+#define MX50_PAD_SD2_D0__GPIO5_8                               0x104 0x3b0 0x000 0x1 0x0
+#define MX50_PAD_SD2_D0__MSHC_DATA_0                           0x104 0x3b0 0x000 0x2 0x0
+#define MX50_PAD_SD2_D0__KPP_COL_4                             0x104 0x3b0 0x790 0x3 0x0
+#define MX50_PAD_SD2_D1__ESDHC2_DAT1                           0x108 0x3b4 0x000 0x0 0x0
+#define MX50_PAD_SD2_D1__GPIO5_9                               0x108 0x3b4 0x000 0x1 0x0
+#define MX50_PAD_SD2_D1__MSHC_DATA_1                           0x108 0x3b4 0x000 0x2 0x0
+#define MX50_PAD_SD2_D1__KPP_ROW_4                             0x108 0x3b4 0x7a0 0x3 0x0
+#define MX50_PAD_SD2_D2__ESDHC2_DAT2                           0x10c 0x3b8 0x000 0x0 0x0
+#define MX50_PAD_SD2_D2__GPIO5_10                              0x10c 0x3b8 0x000 0x1 0x0
+#define MX50_PAD_SD2_D2__MSHC_DATA_2                           0x10c 0x3b8 0x000 0x2 0x0
+#define MX50_PAD_SD2_D2__KPP_COL_5                             0x10c 0x3b8 0x794 0x3 0x0
+#define MX50_PAD_SD2_D3__ESDHC2_DAT3                           0x110 0x3bc 0x000 0x0 0x0
+#define MX50_PAD_SD2_D3__GPIO5_11                              0x110 0x3bc 0x000 0x1 0x0
+#define MX50_PAD_SD2_D3__MSHC_DATA_3                           0x110 0x3bc 0x000 0x2 0x0
+#define MX50_PAD_SD2_D3__KPP_ROW_5                             0x110 0x3bc 0x7a4 0x3 0x0
+#define MX50_PAD_SD2_D4__ESDHC2_DAT4                           0x114 0x3c0 0x000 0x0 0x0
+#define MX50_PAD_SD2_D4__GPIO5_12                              0x114 0x3c0 0x000 0x1 0x0
+#define MX50_PAD_SD2_D4__AUDMUX_AUD4_RXFS                      0x114 0x3c0 0x6d0 0x2 0x0
+#define MX50_PAD_SD2_D4__KPP_COL_6                             0x114 0x3c0 0x798 0x3 0x0
+#define MX50_PAD_SD2_D4__EIM_WEIM_D_0                          0x114 0x3c0 0x7ec 0x4 0x0
+#define MX50_PAD_SD2_D4__CCM_CCM_OUT_0                         0x114 0x3c0 0x000 0x7 0x0
+#define MX50_PAD_SD2_D5__ESDHC2_DAT5                           0x118 0x3c4 0x000 0x0 0x0
+#define MX50_PAD_SD2_D5__GPIO5_13                              0x118 0x3c4 0x000 0x1 0x0
+#define MX50_PAD_SD2_D5__AUDMUX_AUD4_RXC                       0x118 0x3c4 0x6cc 0x2 0x0
+#define MX50_PAD_SD2_D5__KPP_ROW_6                             0x118 0x3c4 0x7a8 0x3 0x0
+#define MX50_PAD_SD2_D5__EIM_WEIM_D_1                          0x118 0x3c4 0x7f0 0x4 0x0
+#define MX50_PAD_SD2_D5__CCM_CCM_OUT_1                         0x118 0x3c4 0x000 0x7 0x0
+#define MX50_PAD_SD2_D6__ESDHC2_DAT6                           0x11c 0x3c8 0x000 0x0 0x0
+#define MX50_PAD_SD2_D6__GPIO5_14                              0x11c 0x3c8 0x000 0x1 0x0
+#define MX50_PAD_SD2_D6__AUDMUX_AUD4_RXD                       0x11c 0x3c8 0x6c4 0x2 0x0
+#define MX50_PAD_SD2_D6__KPP_COL_7                             0x11c 0x3c8 0x79c 0x3 0x0
+#define MX50_PAD_SD2_D6__EIM_WEIM_D_2                          0x11c 0x3c8 0x7f4 0x4 0x0
+#define MX50_PAD_SD2_D6__CCM_CCM_OUT_2                         0x11c 0x3c8 0x000 0x7 0x0
+#define MX50_PAD_SD2_D7__ESDHC2_DAT7                           0x120 0x3cc 0x000 0x0 0x0
+#define MX50_PAD_SD2_D7__GPIO5_15                              0x120 0x3cc 0x000 0x1 0x0
+#define MX50_PAD_SD2_D7__AUDMUX_AUD4_TXFS                      0x120 0x3cc 0x6d8 0x2 0x0
+#define MX50_PAD_SD2_D7__KPP_ROW_7                             0x120 0x3cc 0x7ac 0x3 0x0
+#define MX50_PAD_SD2_D7__EIM_WEIM_D_3                          0x120 0x3cc 0x7f8 0x4 0x0
+#define MX50_PAD_SD2_D7__CCM_STOP                              0x120 0x3cc 0x000 0x7 0x0
+#define MX50_PAD_SD2_WP__ESDHC2_WP                             0x124 0x3d0 0x744 0x0 0x1
+#define MX50_PAD_SD2_WP__GPIO5_16                              0x124 0x3d0 0x000 0x1 0x0
+#define MX50_PAD_SD2_WP__AUDMUX_AUD4_TXD                       0x124 0x3d0 0x6c8 0x2 0x0
+#define MX50_PAD_SD2_WP__EIM_WEIM_D_4                          0x124 0x3d0 0x7fc 0x4 0x0
+#define MX50_PAD_SD2_WP__CCM_WAIT                              0x124 0x3d0 0x000 0x7 0x0
+#define MX50_PAD_SD2_CD__ESDHC2_CD                             0x128 0x3d4 0x740 0x0 0x1
+#define MX50_PAD_SD2_CD__GPIO5_17                              0x128 0x3d4 0x000 0x1 0x0
+#define MX50_PAD_SD2_CD__AUDMUX_AUD4_TXC                       0x128 0x3d4 0x6d4 0x2 0x0
+#define MX50_PAD_SD2_CD__EIM_WEIM_D_5                          0x128 0x3d4 0x800 0x4 0x0
+#define MX50_PAD_SD2_CD__CCM_REF_EN_B                          0x128 0x3d4 0x000 0x7 0x0
+#define MX50_PAD_DISP_D0__ELCDIF_DAT_0                         0x12c 0x40c 0x6fc 0x0 0x0
+#define MX50_PAD_DISP_D0__GPIO2_0                              0x12c 0x40c 0x000 0x1 0x0
+#define MX50_PAD_DISP_D0__FEC_TX_CLK                           0x12c 0x40c 0x78c 0x2 0x0
+#define MX50_PAD_DISP_D0__EIM_WEIM_A_16                                0x12c 0x40c 0x000 0x3 0x0
+#define MX50_PAD_DISP_D0__SDMA_DEBUG_PC_0                      0x12c 0x40c 0x000 0x6 0x0
+#define MX50_PAD_DISP_D0__USBPHY1_VSTATUS_0                    0x12c 0x40c 0x000 0x7 0x0
+#define MX50_PAD_DISP_D1__ELCDIF_DAT_1                         0x130 0x410 0x700 0x0 0x0
+#define MX50_PAD_DISP_D1__GPIO2_1                              0x130 0x410 0x000 0x1 0x0
+#define MX50_PAD_DISP_D1__FEC_RX_ERR                           0x130 0x410 0x788 0x2 0x0
+#define MX50_PAD_DISP_D1__EIM_WEIM_A_17                                0x130 0x410 0x000 0x3 0x0
+#define MX50_PAD_DISP_D1__SDMA_DEBUG_PC_1                      0x130 0x410 0x000 0x6 0x0
+#define MX50_PAD_DISP_D1__USBPHY1_VSTATUS_1                    0x130 0x410 0x000 0x7 0x0
+#define MX50_PAD_DISP_D2__ELCDIF_DAT_2                         0x134 0x414 0x704 0x0 0x0
+#define MX50_PAD_DISP_D2__GPIO2_2                              0x134 0x414 0x000 0x1 0x0
+#define MX50_PAD_DISP_D2__FEC_RX_DV                            0x134 0x414 0x784 0x2 0x0
+#define MX50_PAD_DISP_D2__EIM_WEIM_A_18                                0x134 0x414 0x000 0x3 0x0
+#define MX50_PAD_DISP_D2__SDMA_DEBUG_PC_2                      0x134 0x414 0x000 0x6 0x0
+#define MX50_PAD_DISP_D2__USBPHY1_VSTATUS_2                    0x134 0x414 0x000 0x7 0x0
+#define MX50_PAD_DISP_D3__ELCDIF_DAT_3                         0x138 0x418 0x708 0x0 0x0
+#define MX50_PAD_DISP_D3__GPIO2_3                              0x138 0x418 0x000 0x1 0x0
+#define MX50_PAD_DISP_D3__FEC_RDATA_1                          0x138 0x418 0x77c 0x2 0x0
+#define MX50_PAD_DISP_D3__EIM_WEIM_A_19                                0x138 0x418 0x000 0x3 0x0
+#define MX50_PAD_DISP_D3__FEC_COL                              0x138 0x418 0x770 0x4 0x1
+#define MX50_PAD_DISP_D3__SDMA_DEBUG_PC_3                      0x138 0x418 0x000 0x6 0x0
+#define MX50_PAD_DISP_D3__USBPHY1_VSTATUS_3                    0x138 0x418 0x000 0x7 0x0
+#define MX50_PAD_DISP_D4__ELCDIF_DAT_4                         0x13c 0x41c 0x70c 0x0 0x0
+#define MX50_PAD_DISP_D4__GPIO2_4                              0x13c 0x41c 0x000 0x1 0x0
+#define MX50_PAD_DISP_D4__FEC_RDATA_0                          0x13c 0x41c 0x778 0x2 0x0
+#define MX50_PAD_DISP_D4__EIM_WEIM_A_20                                0x13c 0x41c 0x000 0x3 0x0
+#define MX50_PAD_DISP_D4__SDMA_DEBUG_PC_4                      0x13c 0x41c 0x000 0x6 0x0
+#define MX50_PAD_DISP_D4__USBPHY1_VSTATUS_4                    0x13c 0x41c 0x000 0x7 0x0
+#define MX50_PAD_DISP_D5__ELCDIF_DAT_5                         0x140 0x420 0x710 0x0 0x0
+#define MX50_PAD_DISP_D5__GPIO2_5                              0x140 0x420 0x000 0x1 0x0
+#define MX50_PAD_DISP_D5__FEC_TX_EN                            0x140 0x420 0x000 0x2 0x0
+#define MX50_PAD_DISP_D5__EIM_WEIM_A_21                                0x140 0x420 0x000 0x3 0x0
+#define MX50_PAD_DISP_D5__SDMA_DEBUG_PC_5                      0x140 0x420 0x000 0x6 0x0
+#define MX50_PAD_DISP_D5__USBPHY1_VSTATUS_5                    0x140 0x420 0x000 0x7 0x0
+#define MX50_PAD_DISP_D6__ELCDIF_DAT_6                         0x144 0x424 0x714 0x0 0x0
+#define MX50_PAD_DISP_D6__GPIO2_6                              0x144 0x424 0x000 0x1 0x0
+#define MX50_PAD_DISP_D6__FEC_TDATA_1                          0x144 0x424 0x000 0x2 0x0
+#define MX50_PAD_DISP_D6__EIM_WEIM_A_22                                0x144 0x424 0x000 0x3 0x0
+#define MX50_PAD_DISP_D6__FEC_RX_CLK                           0x144 0x424 0x780 0x4 0x1
+#define MX50_PAD_DISP_D6__SDMA_DEBUG_PC_6                      0x144 0x424 0x000 0x6 0x0
+#define MX50_PAD_DISP_D6__USBPHY1_VSTATUS_6                    0x144 0x424 0x000 0x7 0x0
+#define MX50_PAD_DISP_D7__ELCDIF_DAT_7                         0x148 0x428 0x718 0x0 0x0
+#define MX50_PAD_DISP_D7__GPIO2_7                              0x148 0x428 0x000 0x1 0x0
+#define MX50_PAD_DISP_D7__FEC_TDATA_0                          0x148 0x428 0x000 0x2 0x0
+#define MX50_PAD_DISP_D7__EIM_WEIM_A_23                                0x148 0x428 0x000 0x3 0x0
+#define MX50_PAD_DISP_D7__SDMA_DEBUG_PC_7                      0x148 0x428 0x000 0x6 0x0
+#define MX50_PAD_DISP_D7__USBPHY1_VSTATUS_7                    0x148 0x428 0x000 0x7 0x0
+#define MX50_PAD_DISP_WR__ELCDIF_WR_RWN                                0x14c 0x42c 0x000 0x0 0x0
+#define MX50_PAD_DISP_WR__GPIO2_16                             0x14c 0x42c 0x000 0x1 0x0
+#define MX50_PAD_DISP_WR__ELCDIF_DOTCLK                                0x14c 0x42c 0x000 0x2 0x0
+#define MX50_PAD_DISP_WR__EIM_WEIM_A_24                                0x14c 0x42c 0x000 0x3 0x0
+#define MX50_PAD_DISP_WR__SDMA_DEBUG_PC_8                      0x14c 0x42c 0x000 0x6 0x0
+#define MX50_PAD_DISP_WR__USBPHY1_AVALID                       0x14c 0x42c 0x000 0x7 0x0
+#define MX50_PAD_DISP_RD__ELCDIF_RD_E                          0x150 0x430 0x000 0x0 0x0
+#define MX50_PAD_DISP_RD__GPIO2_19                             0x150 0x430 0x000 0x1 0x0
+#define MX50_PAD_DISP_RD__ELCDIF_ENABLE                                0x150 0x430 0x000 0x2 0x0
+#define MX50_PAD_DISP_RD__EIM_WEIM_A_25                                0x150 0x430 0x000 0x3 0x0
+#define MX50_PAD_DISP_RD__SDMA_DEBUG_PC_9                      0x150 0x430 0x000 0x6 0x0
+#define MX50_PAD_DISP_RD__USBPHY1_BVALID                       0x150 0x430 0x000 0x7 0x0
+#define MX50_PAD_DISP_RS__ELCDIF_RS                            0x154 0x434 0x000 0x0 0x0
+#define MX50_PAD_DISP_RS__GPIO2_17                             0x154 0x434 0x000 0x1 0x0
+#define MX50_PAD_DISP_RS__ELCDIF_VSYNC                         0x154 0x434 0x73c 0x2 0x1
+#define MX50_PAD_DISP_RS__EIM_WEIM_A_26                                0x154 0x434 0x000 0x3 0x0
+#define MX50_PAD_DISP_RS__SDMA_DEBUG_PC_10                     0x154 0x434 0x000 0x6 0x0
+#define MX50_PAD_DISP_RS__USBPHY1_ENDSESSION                   0x154 0x434 0x000 0x7 0x0
+#define MX50_PAD_DISP_CS__ELCDIF_CS                            0x158 0x438 0x000 0x0 0x0
+#define MX50_PAD_DISP_CS__GPIO2_21                             0x158 0x438 0x000 0x1 0x0
+#define MX50_PAD_DISP_CS__ELCDIF_HSYNC                         0x158 0x438 0x6f8 0x2 0x1
+#define MX50_PAD_DISP_CS__EIM_WEIM_A_27                                0x158 0x438 0x000 0x3 0x0
+#define MX50_PAD_DISP_CS__EIM_WEIM_CS_3                                0x158 0x438 0x000 0x4 0x0
+#define MX50_PAD_DISP_CS__SDMA_DEBUG_PC_11                     0x158 0x438 0x000 0x6 0x0
+#define MX50_PAD_DISP_CS__USBPHY1_IDDIG                                0x158 0x438 0x000 0x7 0x0
+#define MX50_PAD_DISP_BUSY__ELCDIF_BUSY                                0x15c 0x43c 0x6f8 0x0 0x2
+#define MX50_PAD_DISP_BUSY__GPIO2_18                           0x15c 0x43c 0x000 0x1 0x0
+#define MX50_PAD_DISP_BUSY__EIM_WEIM_CS_3                      0x15c 0x43c 0x000 0x4 0x0
+#define MX50_PAD_DISP_BUSY__SDMA_DEBUG_PC_12                   0x15c 0x43c 0x000 0x6 0x0
+#define MX50_PAD_DISP_BUSY__USBPHY2_HOSTDISCONNECT             0x15c 0x43c 0x000 0x7 0x0
+#define MX50_PAD_DISP_RESET__ELCDIF_RESET                      0x160 0x440 0x000 0x0 0x0
+#define MX50_PAD_DISP_RESET__GPIO2_20                          0x160 0x440 0x000 0x1 0x0
+#define MX50_PAD_DISP_RESET__EIM_WEIM_CS_3                     0x160 0x440 0x000 0x4 0x0
+#define MX50_PAD_DISP_RESET__SDMA_DEBUG_PC_13                  0x160 0x440 0x000 0x6 0x0
+#define MX50_PAD_DISP_RESET__USBPHY2_BISTOK                    0x160 0x440 0x000 0x7 0x0
+#define MX50_PAD_SD3_CMD__ESDHC3_CMD                           0x164 0x444 0x000 0x0 0x0
+#define MX50_PAD_SD3_CMD__GPIO5_18                             0x164 0x444 0x000 0x1 0x0
+#define MX50_PAD_SD3_CMD__EIM_NANDF_WRN                                0x164 0x444 0x000 0x2 0x0
+#define MX50_PAD_SD3_CMD__SSP_CMD                              0x164 0x444 0x000 0x3 0x0
+#define MX50_PAD_SD3_CLK__ESDHC3_CLK                           0x168 0x448 0x000 0x0 0x0
+#define MX50_PAD_SD3_CLK__GPIO5_19                             0x168 0x448 0x000 0x1 0x0
+#define MX50_PAD_SD3_CLK__EIM_NANDF_RDN                                0x168 0x448 0x000 0x2 0x0
+#define MX50_PAD_SD3_CLK__SSP_CLK                              0x168 0x448 0x000 0x3 0x0
+#define MX50_PAD_SD3_D0__ESDHC3_DAT0                           0x16c 0x44c 0x000 0x0 0x0
+#define MX50_PAD_SD3_D0__GPIO5_20                              0x16c 0x44c 0x000 0x1 0x0
+#define MX50_PAD_SD3_D0__EIM_NANDF_D_4                         0x16c 0x44c 0x000 0x2 0x0
+#define MX50_PAD_SD3_D0__SSP_D0                                        0x16c 0x44c 0x000 0x3 0x0
+#define MX50_PAD_SD3_D0__CCM_PLL1_BYP                          0x16c 0x44c 0x6dc 0x7 0x1
+#define MX50_PAD_SD3_D1__ESDHC3_DAT1                           0x170 0x450 0x000 0x0 0x0
+#define MX50_PAD_SD3_D1__GPIO5_21                              0x170 0x450 0x000 0x1 0x0
+#define MX50_PAD_SD3_D1__EIM_NANDF_D_5                         0x170 0x450 0x000 0x2 0x0
+#define MX50_PAD_SD3_D1__SSP_D1                                        0x170 0x450 0x000 0x3 0x0
+#define MX50_PAD_SD3_D1__CCM_PLL2_BYP                          0x170 0x450 0x000 0x7 0x0
+#define MX50_PAD_SD3_D2__ESDHC3_DAT2                           0x174 0x454 0x000 0x0 0x0
+#define MX50_PAD_SD3_D2__GPIO5_22                              0x174 0x454 0x000 0x1 0x0
+#define MX50_PAD_SD3_D2__EIM_NANDF_D_6                         0x174 0x454 0x000 0x2 0x0
+#define MX50_PAD_SD3_D2__SSP_D2                                        0x174 0x454 0x000 0x3 0x0
+#define MX50_PAD_SD3_D2__CCM_PLL3_BYP                          0x174 0x454 0x6e4 0x7 0x1
+#define MX50_PAD_SD3_D3__ESDHC3_DAT3                           0x178 0x458 0x000 0x0 0x0
+#define MX50_PAD_SD3_D3__GPIO5_23                              0x178 0x458 0x000 0x1 0x0
+#define MX50_PAD_SD3_D3__EIM_NANDF_D_7                         0x178 0x458 0x000 0x2 0x0
+#define MX50_PAD_SD3_D3__SSP_D3                                        0x178 0x458 0x000 0x3 0x0
+#define MX50_PAD_SD3_D4__ESDHC3_DAT4                           0x17c 0x45c 0x000 0x0 0x0
+#define MX50_PAD_SD3_D4__GPIO5_24                              0x17c 0x45c 0x000 0x1 0x0
+#define MX50_PAD_SD3_D4__EIM_NANDF_D_0                         0x17c 0x45c 0x000 0x2 0x0
+#define MX50_PAD_SD3_D4__SSP_D4                                        0x17c 0x45c 0x000 0x3 0x0
+#define MX50_PAD_SD3_D5__ESDHC3_DAT5                           0x180 0x460 0x000 0x0 0x0
+#define MX50_PAD_SD3_D5__GPIO5_25                              0x180 0x460 0x000 0x1 0x0
+#define MX50_PAD_SD3_D5__EIM_NANDF_D_1                         0x180 0x460 0x000 0x2 0x0
+#define MX50_PAD_SD3_D5__SSP_D5                                        0x180 0x460 0x000 0x3 0x0
+#define MX50_PAD_SD3_D6__ESDHC3_DAT6                           0x184 0x464 0x000 0x0 0x0
+#define MX50_PAD_SD3_D6__GPIO5_26                              0x184 0x464 0x000 0x1 0x0
+#define MX50_PAD_SD3_D6__EIM_NANDF_D_2                         0x184 0x464 0x000 0x2 0x0
+#define MX50_PAD_SD3_D6__SSP_D6                                        0x184 0x464 0x000 0x3 0x0
+#define MX50_PAD_SD3_D7__ESDHC3_DAT7                           0x188 0x468 0x000 0x0 0x0
+#define MX50_PAD_SD3_D7__GPIO5_27                              0x188 0x468 0x000 0x1 0x0
+#define MX50_PAD_SD3_D7__EIM_NANDF_D_3                         0x188 0x468 0x000 0x2 0x0
+#define MX50_PAD_SD3_D7__SSP_D7                                        0x188 0x468 0x000 0x3 0x0
+#define MX50_PAD_SD3_WP__ESDHC3_WP                             0x18c 0x46C 0x000 0x0 0x0
+#define MX50_PAD_SD3_WP__GPIO5_28                              0x18c 0x46C 0x000 0x1 0x0
+#define MX50_PAD_SD3_WP__EIM_NANDF_RESETN                      0x18c 0x46C 0x000 0x2 0x0
+#define MX50_PAD_SD3_WP__SSP_CD                                        0x18c 0x46C 0x000 0x3 0x0
+#define MX50_PAD_SD3_WP__ESDHC4_LCTL                           0x18c 0x46C 0x000 0x4 0x0
+#define MX50_PAD_SD3_WP__EIM_WEIM_CS_3                         0x18c 0x46C 0x000 0x5 0x0
+#define MX50_PAD_DISP_D8__ELCDIF_DAT_8                         0x190 0x470 0x71c 0x0 0x0
+#define MX50_PAD_DISP_D8__GPIO2_8                              0x190 0x470 0x000 0x1 0x0
+#define MX50_PAD_DISP_D8__EIM_NANDF_CLE                                0x190 0x470 0x000 0x2 0x0
+#define MX50_PAD_DISP_D8__ESDHC1_LCTL                          0x190 0x470 0x000 0x3 0x0
+#define MX50_PAD_DISP_D8__ESDHC4_CMD                           0x190 0x470 0x74c 0x4 0x2
+#define MX50_PAD_DISP_D8__KPP_COL_4                            0x190 0x470 0x790 0x5 0x1
+#define MX50_PAD_DISP_D8__FEC_TX_CLK                           0x190 0x470 0x78c 0x6 0x1
+#define MX50_PAD_DISP_D8__USBPHY1_DATAOUT_0                    0x190 0x470 0x000 0x7 0x0
+#define MX50_PAD_DISP_D9__ELCDIF_DAT_9                         0x194 0x474 0x720 0x0 0x0
+#define MX50_PAD_DISP_D9__GPIO2_9                              0x194 0x474 0x000 0x1 0x0
+#define MX50_PAD_DISP_D9__EIM_NANDF_ALE                                0x194 0x474 0x000 0x2 0x0
+#define MX50_PAD_DISP_D9__ESDHC2_LCTL                          0x194 0x474 0x000 0x3 0x0
+#define MX50_PAD_DISP_D9__ESDHC4_CLK                           0x194 0x474 0x748 0x4 0x2
+#define MX50_PAD_DISP_D9__KPP_ROW_4                            0x194 0x474 0x7a0 0x5 0x1
+#define MX50_PAD_DISP_D9__FEC_RX_ER                            0x194 0x474 0x788 0x6 0x1
+#define MX50_PAD_DISP_D9__USBPHY1_DATAOUT_1                    0x194 0x474 0x000 0x7 0x0
+#define MX50_PAD_DISP_D10__ELCDIF_DAT_10                       0x198 0x478 0x724 0x0 0x0
+#define MX50_PAD_DISP_D10__GPIO2_10                            0x198 0x478 0x000 0x1 0x0
+#define MX50_PAD_DISP_D10__EIM_NANDF_CEN_0                     0x198 0x478 0x000 0x2 0x0
+#define MX50_PAD_DISP_D10__ESDHC3_LCTL                         0x198 0x478 0x000 0x3 0x0
+#define MX50_PAD_DISP_D10__ESDHC4_DAT0                         0x198 0x478 0x000 0x4 0x0
+#define MX50_PAD_DISP_D10__KPP_COL_5                           0x198 0x478 0x794 0x5 0x1
+#define MX50_PAD_DISP_D10__FEC_RX_DV                           0x198 0x478 0x784 0x6 0x1
+#define MX50_PAD_DISP_D10__USBPHY1_DATAOUT_2                   0x198 0x478 0x000 0x7 0x0
+#define MX50_PAD_DISP_D11__ELCDIF_DAT_11                       0x19c 0x47c 0x728 0x0 0x0
+#define MX50_PAD_DISP_D11__GPIO2_11                            0x19c 0x47c 0x000 0x1 0x0
+#define MX50_PAD_DISP_D11__EIM_NANDF_CEN_1                     0x19c 0x47c 0x000 0x2 0x0
+#define MX50_PAD_DISP_D11__ESDHC4_DAT1                         0x19c 0x47c 0x754 0x4 0x1
+#define MX50_PAD_DISP_D11__KPP_ROW_5                           0x19c 0x47c 0x7a4 0x5 0x1
+#define MX50_PAD_DISP_D11__FEC_RDATA_1                         0x19c 0x47c 0x77c 0x6 0x1
+#define MX50_PAD_DISP_D11__USBPHY1_DATAOUT_3                   0x19c 0x47c 0x000 0x7 0x0
+#define MX50_PAD_DISP_D12__ELCDIF_DAT_12                       0x1a0 0x480 0x72c 0x0 0x0
+#define MX50_PAD_DISP_D12__GPIO2_12                            0x1a0 0x480 0x000 0x1 0x0
+#define MX50_PAD_DISP_D12__EIM_NANDF_CEN_2                     0x1a0 0x480 0x000 0x2 0x0
+#define MX50_PAD_DISP_D12__ESDHC1_CD                           0x1a0 0x480 0x000 0x3 0x0
+#define MX50_PAD_DISP_D12__ESDHC4_DAT2                         0x1a0 0x480 0x758 0x4 0x1
+#define MX50_PAD_DISP_D12__KPP_COL_6                           0x1a0 0x480 0x798 0x5 0x1
+#define MX50_PAD_DISP_D12__FEC_RDATA_0                         0x1a0 0x480 0x778 0x6 0x1
+#define MX50_PAD_DISP_D12__USBPHY1_DATAOUT_4                   0x1a0 0x480 0x000 0x7 0x0
+#define MX50_PAD_DISP_D13__ELCDIF_DAT_13                       0x1a4 0x484 0x730 0x0 0x0
+#define MX50_PAD_DISP_D13__GPIO2_13                            0x1a4 0x484 0x000 0x1 0x0
+#define MX50_PAD_DISP_D13__EIM_NANDF_CEN_3                     0x1a4 0x484 0x000 0x2 0x0
+#define MX50_PAD_DISP_D13__ESDHC3_CD                           0x1a4 0x484 0x000 0x3 0x0
+#define MX50_PAD_DISP_D13__ESDHC4_DAT3                         0x1a4 0x484 0x75c 0x4 0x1
+#define MX50_PAD_DISP_D13__KPP_ROW_6                           0x1a4 0x484 0x7a8 0x5 0x1
+#define MX50_PAD_DISP_D13__FEC_TX_EN                           0x1a4 0x484 0x000 0x6 0x0
+#define MX50_PAD_DISP_D13__USBPHY1_DATAOUT_5                   0x1a4 0x484 0x000 0x7 0x0
+#define MX50_PAD_DISP_D14__ELCDIF_DAT_14                       0x1a8 0x488 0x734 0x0 0x0
+#define MX50_PAD_DISP_D14__GPIO2_14                            0x1a8 0x488 0x000 0x1 0x0
+#define MX50_PAD_DISP_D14__EIM_NANDF_READY0                    0x1a8 0x488 0x7b4 0x2 0x1
+#define MX50_PAD_DISP_D14__ESDHC1_WP                           0x1a8 0x488 0x000 0x3 0x0
+#define MX50_PAD_DISP_D14__ESDHC4_WP                           0x1a8 0x488 0x000 0x4 0x0
+#define MX50_PAD_DISP_D14__KPP_COL_7                           0x1a8 0x488 0x79c 0x5 0x1
+#define MX50_PAD_DISP_D14__FEC_TDATA_1                         0x1a8 0x488 0x000 0x6 0x0
+#define MX50_PAD_DISP_D14__USBPHY1_DATAOUT_6                   0x1a8 0x488 0x000 0x7 0x0
+#define MX50_PAD_DISP_D15__ELCDIF_DAT_15                       0x1ac 0x48c 0x738 0x0 0x0
+#define MX50_PAD_DISP_D15__GPIO2_15                            0x1ac 0x48c 0x000 0x1 0x0
+#define MX50_PAD_DISP_D15__EIM_NANDF_DQS                       0x1ac 0x48c 0x7b0 0x2 0x1
+#define MX50_PAD_DISP_D15__ESDHC3_RST                          0x1ac 0x48c 0x000 0x3 0x0
+#define MX50_PAD_DISP_D15__ESDHC4_CD                           0x1ac 0x48c 0x000 0x4 0x0
+#define MX50_PAD_DISP_D15__KPP_ROW_7                           0x1ac 0x48c 0x7ac 0x5 0x1
+#define MX50_PAD_DISP_D15__FEC_TDATA_0                         0x1ac 0x48c 0x000 0x6 0x0
+#define MX50_PAD_DISP_D15__USBPHY1_DATAOUT_7                   0x1ac 0x48c 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D0__EPDC_SDDO_0                          0x1b0 0x54c 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D0__GPIO3_0                              0x1b0 0x54c 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D0__EIM_WEIM_D_0                         0x1b0 0x54c 0x7ec 0x2 0x1
+#define MX50_PAD_EPDC_D0__ELCDIF_RS                            0x1b0 0x54c 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D0__ELCDIF_DOTCLK                                0x1b0 0x54c 0x000 0x4 0x0
+#define MX50_PAD_EPDC_D0__SDMA_DEBUG_EVT_CHN_LINES_0           0x1b0 0x54c 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D0__USBPHY2_DATAOUT_0                    0x1b0 0x54c 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D1__EPDC_SDDO_1                          0x1b4 0x550 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D1__GPIO3_1                              0x1b4 0x550 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D1__EIM_WEIM_D_1                         0x1b4 0x550 0x7f0 0x2 0x1
+#define MX50_PAD_EPDC_D1__ELCDIF_CS                            0x1b4 0x550 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D1__ELCDIF_ENABLE                                0x1b4 0x550 0x000 0x4 0x0
+#define MX50_PAD_EPDC_D1__SDMA_DEBUG_EVT_CHN_LINES_1           0x1b4 0x550 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D1__USBPHY2_DATAOUT_1                    0x1b4 0x550 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D2__EPDC_SDDO_2                          0x1b8 0x554 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D2__GPIO3_2                              0x1b8 0x554 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D2__EIM_WEIM_D_2                         0x1b8 0x554 0x7f4 0x2 0x1
+#define MX50_PAD_EPDC_D2__ELCDIF_WR_RWN                                0x1b8 0x554 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D2__ELCDIF_VSYNC                         0x1b8 0x554 0x73c 0x4 0x2
+#define MX50_PAD_EPDC_D2__SDMA_DEBUG_EVT_CHN_LINES_2           0x1b8 0x554 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D2__USBPHY2_DATAOUT_2                    0x1b8 0x554 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D3__EPDC_SDDO_3                          0x1bc 0x558 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D3__GPIO3_3                              0x1bc 0x558 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D3__EIM_WEIM_D_3                         0x1bc 0x558 0x7f8 0x2 0x1
+#define MX50_PAD_EPDC_D3__ELCDIF_RD_E                          0x1bc 0x558 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D3__ELCDIF_HSYNC                         0x1bc 0x558 0x6f8 0x4 0x3
+#define MX50_PAD_EPDC_D3__SDMA_DEBUG_EVT_CHN_LINES_3           0x1bc 0x558 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D3__USBPHY2_DATAOUT_3                    0x1bc 0x558 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D4__EPDC_SDDO_4                          0x1c0 0x55c 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D4__GPIO3_4                              0x1c0 0x55c 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D4__EIM_WEIM_D_4                         0x1c0 0x55c 0x7fc 0x2 0x1
+#define MX50_PAD_EPDC_D4__SDMA_DEBUG_EVT_CHN_LINES_4           0x1c0 0x55c 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D4__USBPHY2_DATAOUT_4                    0x1c0 0x55c 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D5__EPDC_SDDO_5                          0x1c4 0x560 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D5__GPIO3_5                              0x1c4 0x560 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D5__EIM_WEIM_D_5                         0x1c4 0x560 0x800 0x2 0x1
+#define MX50_PAD_EPDC_D5__SDMA_DEBUG_EVT_CHN_LINES_5           0x1c4 0x560 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D5__USBPHY2_DATAOUT_5                    0x1c4 0x560 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D6__EPDC_SDDO_6                          0x1c8 0x564 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D6__GPIO3_6                              0x1c8 0x564 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D6__EIM_WEIM_D_6                         0x1c8 0x564 0x804 0x2 0x1
+#define MX50_PAD_EPDC_D6__SDMA_DEBUG_EVT_CHN_LINES_6           0x1c8 0x564 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D6__USBPHY2_DATAOUT_6                    0x1c8 0x564 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D7__EPDC_SDDO_7                          0x1cc 0x568 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D7__GPIO3_7                              0x1cc 0x568 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D7__EIM_WEIM_D_7                         0x1cc 0x568 0x808 0x2 0x1
+#define MX50_PAD_EPDC_D7__SDMA_DEBUG_EVT_CHN_LINES_7           0x1cc 0x568 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D7__USBPHY2_DATAOUT_7                    0x1cc 0x568 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D8__EPDC_SDDO_8                          0x1d0 0x56c 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D8__GPIO3_8                              0x1d0 0x56c 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D8__EIM_WEIM_D_8                         0x1d0 0x56c 0x80c 0x2 0x2
+#define MX50_PAD_EPDC_D8__ELCDIF_DAT_24                                0x1d0 0x56c 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D8__SDMA_DEBUG_MATCHED_DMBUS             0x1d0 0x56c 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D8__USBPHY2_VSTATUS_0                    0x1d0 0x56c 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D9__EPDC_SDDO_9                          0x1d4 0x570 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D9__GPIO3_9                              0x1d4 0x570 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D9__EIM_WEIM_D_9                         0x1d4 0x570 0x810 0x2 0x2
+#define MX50_PAD_EPDC_D9__ELCDIF_DAT_25                                0x1d4 0x570 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D9__SDMA_DEBUG_EVENT_CHANNEL_SEL         0x1d4 0x570 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D9__USBPHY2_VSTATUS_1                    0x1d4 0x570 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D10__EPDC_SDDO_10                                0x1d8 0x574 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D10__GPIO3_10                            0x1d8 0x574 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D10__EIM_WEIM_D_10                       0x1d8 0x574 0x814 0x2 0x2
+#define MX50_PAD_EPDC_D10__ELCDIF_DAT_26                       0x1d8 0x574 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D10__SDMA_DEBUG_EVENT_CHANNEL_0          0x1d8 0x574 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D10__USBPHY2_VSTATUS_2                   0x1d8 0x574 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D11__EPDC_SDDO_11                                0x1dc 0x578 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D11__GPIO3_11                            0x1dc 0x578 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D11__EIM_WEIM_D_11                       0x1dc 0x578 0x818 0x2 0x2
+#define MX50_PAD_EPDC_D11__ELCDIF_DAT_27                       0x1dc 0x578 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D11__SDMA_DEBUG_EVENT_CHANNEL_1          0x1dc 0x578 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D11__USBPHY2_VSTATUS_3                   0x1dc 0x578 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D12__EPDC_SDDO_12                                0x1e0 0x57c 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D12__GPIO3_12                            0x1e0 0x57c 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D12__EIM_WEIM_D_12                       0x1e0 0x57c 0x81c 0x2 0x1
+#define MX50_PAD_EPDC_D12__ELCDIF_DAT_28                       0x1e0 0x57c 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D12__SDMA_DEBUG_EVENT_CHANNEL_2          0x1e0 0x57c 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D12__USBPHY2_VSTATUS_4                   0x1e0 0x57c 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D13__EPDC_SDDO_13                                0x1e4 0x580 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D13__GPIO3_13                            0x1e4 0x580 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D13__EIM_WEIM_D_13                       0x1e4 0x580 0x820 0x2 0x1
+#define MX50_PAD_EPDC_D13__ELCDIF_DAT_29                       0x1e4 0x580 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D13__SDMA_DEBUG_EVENT_CHANNEL_3          0x1e4 0x580 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D13__USBPHY2_VSTATUS_5                   0x1e4 0x580 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D14__EPDC_SDDO_14                                0x1e8 0x584 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D14__GPIO3_14                            0x1e8 0x584 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D14__EIM_WEIM_D_14                       0x1e8 0x584 0x824 0x2 0x1
+#define MX50_PAD_EPDC_D14__ELCDIF_DAT_30                       0x1e8 0x584 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D14__AUDMUX_AUD6_TXD                     0x1e8 0x584 0x000 0x4 0x0
+#define MX50_PAD_EPDC_D14__SDMA_DEBUG_EVENT_CHANNEL_4          0x1e8 0x584 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D14__USBPHY2_VSTATUS_6                   0x1e8 0x584 0x000 0x7 0x0
+#define MX50_PAD_EPDC_D15__EPDC_SDDO_15                                0x1ec 0x588 0x000 0x0 0x0
+#define MX50_PAD_EPDC_D15__GPIO3_15                            0x1ec 0x588 0x000 0x1 0x0
+#define MX50_PAD_EPDC_D15__EIM_WEIM_D_15                       0x1ec 0x588 0x828 0x2 0x1
+#define MX50_PAD_EPDC_D15__ELCDIF_DAT_31                       0x1ec 0x588 0x000 0x3 0x0
+#define MX50_PAD_EPDC_D15__AUDMUX_AUD6_TXC                     0x1ec 0x588 0x000 0x4 0x0
+#define MX50_PAD_EPDC_D15__SDMA_DEBUG_EVENT_CHANNEL_5          0x1ec 0x588 0x000 0x6 0x0
+#define MX50_PAD_EPDC_D15__USBPHY2_VSTATUS_7                   0x1ec 0x588 0x000 0x7 0x0
+#define MX50_PAD_EPDC_GDCLK__EPDC_GDCLK                                0x1f0 0x58c 0x000 0x0 0x0
+#define MX50_PAD_EPDC_GDCLK__GPIO3_16                          0x1f0 0x58c 0x000 0x1 0x0
+#define MX50_PAD_EPDC_GDCLK__EIM_WEIM_D_16                     0x1f0 0x58c 0x000 0x2 0x0
+#define MX50_PAD_EPDC_GDCLK__ELCDIF_DAT_16                     0x1f0 0x58c 0x000 0x3 0x0
+#define MX50_PAD_EPDC_GDCLK__AUDMUX_AUD6_TXFS                  0x1f0 0x58c 0x000 0x4 0x0
+#define MX50_PAD_EPDC_GDCLK__SDMA_DEBUG_CORE_STATE_0           0x1f0 0x58c 0x000 0x6 0x0
+#define MX50_PAD_EPDC_GDCLK__USBPHY2_BISTOK                    0x1f0 0x58c 0x000 0x7 0x0
+#define MX50_PAD_EPDC_GDSP__EPCD_GDSP                          0x1f4 0x590 0x000 0x0 0x0
+#define MX50_PAD_EPDC_GDSP__GPIO3_17                           0x1f4 0x590 0x000 0x1 0x0
+#define MX50_PAD_EPDC_GDSP__EIM_WEIM_D_17                      0x1f4 0x590 0x000 0x2 0x0
+#define MX50_PAD_EPDC_GDSP__ELCDIF_DAT_17                      0x1f4 0x590 0x000 0x3 0x0
+#define MX50_PAD_EPDC_GDSP__AUDMUX_AUD6_RXD                    0x1f4 0x590 0x000 0x4 0x0
+#define MX50_PAD_EPDC_GDSP__SDMA_DEBUG_CORE_STATE_1            0x1f4 0x590 0x000 0x6 0x0
+#define MX50_PAD_EPDC_GDSP__USBPHY2_BVALID                     0x1f4 0x590 0x000 0x7 0x0
+#define MX50_PAD_EPDC_GDOE__EPCD_GDOE                          0x1f8 0x594 0x000 0x0 0x0
+#define MX50_PAD_EPDC_GDOE__GPIO3_18                           0x1f8 0x594 0x000 0x1 0x0
+#define MX50_PAD_EPDC_GDOE__EIM_WEIM_D_18                      0x1f8 0x594 0x000 0x2 0x0
+#define MX50_PAD_EPDC_GDOE__ELCDIF_DAT_18                      0x1f8 0x594 0x000 0x3 0x0
+#define MX50_PAD_EPDC_GDOE__AUDMUX_AUD6_RXC                    0x1f8 0x594 0x000 0x4 0x0
+#define MX50_PAD_EPDC_GDOE__SDMA_DEBUG_CORE_STATE_2            0x1f8 0x594 0x000 0x6 0x0
+#define MX50_PAD_EPDC_GDOE__USBPHY2_ENDSESSION                 0x1f8 0x594 0x000 0x7 0x0
+#define MX50_PAD_EPDC_GDRL__EPCD_GDRL                          0x1fc 0x598 0x000 0x0 0x0
+#define MX50_PAD_EPDC_GDRL__GPIO3_19                           0x1fc 0x598 0x000 0x1 0x0
+#define MX50_PAD_EPDC_GDRL__EIM_WEIM_D_19                      0x1f8 0x598 0x000 0x2 0x0
+#define MX50_PAD_EPDC_GDRL__ELCDIF_DAT_19                      0x1fc 0x598 0x000 0x3 0x0
+#define MX50_PAD_EPDC_GDRL__AUDMUX_AUD6_RXFS                   0x1fc 0x598 0x000 0x4 0x0
+#define MX50_PAD_EPDC_GDRL__SDMA_DEBUG_CORE_STATE_3            0x1fc 0x598 0x000 0x6 0x0
+#define MX50_PAD_EPDC_GDRL__USBPHY2_IDDIG                      0x1fc 0x598 0x000 0x7 0x0
+#define MX50_PAD_EPDC_SDCLK__EPCD_SDCLK                                0x200 0x59c 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDCLK__GPIO3_20                          0x200 0x59c 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDCLK__EIM_WEIM_D_20                     0x200 0x59c 0x000 0x2 0x0
+#define MX50_PAD_EPDC_SDCLK__ELCDIF_DAT_20                     0x200 0x59c 0x000 0x3 0x0
+#define MX50_PAD_EPDC_SDCLK__AUDMUX_AUD5_TXD                   0x200 0x59c 0x000 0x4 0x0
+#define MX50_PAD_EPDC_SDCLK__SDMA_DEBUG_BUS_DEVICE_0           0x200 0x59c 0x000 0x6 0x0
+#define MX50_PAD_EPDC_SDCLK__USBPHY2_HOSTDISCONNECT            0x200 0x59c 0x000 0x7 0x0
+#define MX50_PAD_EPDC_SDOEZ__EPCD_SDOEZ                                0x204 0x5a0 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDOEZ__GPIO3_21                          0x204 0x5a0 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDOEZ__EIM_WEIM_D_21                     0x204 0x5a0 0x000 0x2 0x0
+#define MX50_PAD_EPDC_SDOEZ__ELCDIF_DAT_21                     0x204 0x5a0 0x000 0x3 0x0
+#define MX50_PAD_EPDC_SDOEZ__AUDMUX_AUD5_TXC                   0x204 0x5a0 0x000 0x4 0x0
+#define MX50_PAD_EPDC_SDOEZ__SDMA_DEBUG_BUS_DEVICE_1           0x204 0x5a0 0x000 0x6 0x0
+#define MX50_PAD_EPDC_SDOEZ__USBPHY2_TXREADY                   0x204 0x5a0 0x000 0x7 0x0
+#define MX50_PAD_EPDC_SDOED__EPCD_SDOED                                0x208 0x5a4 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDOED__GPIO3_22                          0x208 0x5a4 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDOED__EIM_WEIM_D_22                     0x208 0x5a4 0x000 0x2 0x0
+#define MX50_PAD_EPDC_SDOED__ELCDIF_DAT_22                     0x208 0x5a4 0x000 0x3 0x0
+#define MX50_PAD_EPDC_SDOED__AUDMUX_AUD5_TXFS                  0x208 0x5a4 0x000 0x4 0x0
+#define MX50_PAD_EPDC_SDOED__SDMA_DEBUG_BUS_DEVICE_2           0x208 0x5a4 0x000 0x6 0x0
+#define MX50_PAD_EPDC_SDOED__USBPHY2_RXVALID                   0x208 0x5a4 0x000 0x7 0x0
+#define MX50_PAD_EPDC_SDOE__EPCD_SDOE                          0x20c 0x5a8 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDOE__GPIO3_23                           0x20c 0x5a8 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDOE__EIM_WEIM_D_23                      0x20c 0x5a8 0x000 0x2 0x0
+#define MX50_PAD_EPDC_SDOE__ELCDIF_DAT_23                      0x20c 0x5a8 0x000 0x3 0x0
+#define MX50_PAD_EPDC_SDOE__AUDMUX_AUD5_RXD                    0x20c 0x5a8 0x000 0x4 0x0
+#define MX50_PAD_EPDC_SDOE__SDMA_DEBUG_BUS_DEVICE_3            0x20c 0x5a8 0x000 0x6 0x0
+#define MX50_PAD_EPDC_SDOE__USBPHY2_RXACTIVE                   0x20c 0x5a8 0x000 0x7 0x0
+#define MX50_PAD_EPDC_SDLE__EPCD_SDLE                          0x210 0x5ac 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDLE__GPIO3_24                           0x210 0x5ac 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDLE__EIM_WEIM_D_24                      0x210 0x5ac 0x000 0x2 0x0
+#define MX50_PAD_EPDC_SDLE__ELCDIF_DAT_8                       0x210 0x5ac 0x71c 0x3 0x1
+#define MX50_PAD_EPDC_SDLE__AUDMUX_AUD5_RXC                    0x210 0x5ac 0x000 0x4 0x0
+#define MX50_PAD_EPDC_SDLE__SDMA_DEBUG_BUS_DEVICE_4            0x210 0x5ac 0x000 0x6 0x0
+#define MX50_PAD_EPDC_SDLE__USBPHY2_RXERROR                    0x210 0x5ac 0x000 0x7 0x0
+#define MX50_PAD_EPDC_SDCLKN__EPCD_SDCLKN                      0x214 0x5b0 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDCLKN__GPIO3_25                         0x214 0x5b0 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDCLKN__EIM_WEIM_D_25                    0x214 0x5b0 0x000 0x2 0x0
+#define MX50_PAD_EPDC_SDCLKN__ELCDIF_DAT_9                     0x214 0x5b0 0x720 0x3 0x1
+#define MX50_PAD_EPDC_SDCLKN__AUDMUX_AUD5_RXFS                 0x214 0x5b0 0x000 0x4 0x0
+#define MX50_PAD_EPDC_SDCLKN__SDMA_DEBUG_BUS_ERROR             0x214 0x5b0 0x000 0x6 0x0
+#define MX50_PAD_EPDC_SDCLKN__USBPHY2_SIECLOCK                 0x214 0x5b0 0x000 0x7 0x0
+#define MX50_PAD_EPDC_SDSHR__EPCD_SDSHR                                0x218 0x5b4 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDSHR__GPIO3_26                          0x218 0x5b4 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDSHR__EIM_WEIM_D_26                     0x218 0x5b4 0x000 0x2 0x0
+#define MX50_PAD_EPDC_SDSHR__ELCDIF_DAT_10                     0x218 0x5b4 0x724 0x3 0x1
+#define MX50_PAD_EPDC_SDSHR__AUDMUX_AUD4_TXD                   0x218 0x5b4 0x6c8 0x4 0x1
+#define MX50_PAD_EPDC_SDSHR__SDMA_DEBUG_BUS_RWB                        0x218 0x5b4 0x000 0x6 0x0
+#define MX50_PAD_EPDC_SDSHR__USBPHY2_LINESTATE_0               0x218 0x5b4 0x000 0x7 0x0
+#define MX50_PAD_EPDC_PWRCOM__EPCD_PWRCOM                      0x21c 0x5b8 0x000 0x0 0x0
+#define MX50_PAD_EPDC_PWRCOM__GPIO3_27                         0x21c 0x5b8 0x000 0x1 0x0
+#define MX50_PAD_EPDC_PWRCOM__EIM_WEIM_D_27                    0x21c 0x5b8 0x000 0x2 0x0
+#define MX50_PAD_EPDC_PWRCOM__ELCDIF_DAT_11                    0x21c 0x5b8 0x728 0x3 0x1
+#define MX50_PAD_EPDC_PWRCOM__AUDMUX_AUD4_TXC                  0x21c 0x5b8 0x6d4 0x4 0x1
+#define MX50_PAD_EPDC_PWRCOM__SDMA_DEBUG_CORE_RUN              0x21c 0x5b8 0x000 0x6 0x0
+#define MX50_PAD_EPDC_PWRCOM__USBPHY2_LINESTATE_1              0x21c 0x5b8 0x000 0x7 0x0
+#define MX50_PAD_EPDC_PWRSTAT__EPCD_PWRSTAT                    0x220 0x5bc 0x000 0x0 0x0
+#define MX50_PAD_EPDC_PWRSTAT__GPIO3_28                                0x220 0x5bc 0x000 0x1 0x0
+#define MX50_PAD_EPDC_PWRSTAT__EIM_WEIM_D_28                   0x220 0x5bc 0x000 0x2 0x0
+#define MX50_PAD_EPDC_PWRSTAT__ELCDIF_DAT_12                   0x220 0x5bc 0x72c 0x3 0x1
+#define MX50_PAD_EPDC_PWRSTAT__AUDMUX_AUD4_TXFS                        0x220 0x5bc 0x6d8 0x4 0x1
+#define MX50_PAD_EPDC_PWRSTAT__SDMA_DEBUG_MODE                 0x220 0x5bc 0x000 0x6 0x0
+#define MX50_PAD_EPDC_PWRSTAT__USBPHY2_VBUSVALID               0x220 0x5bc 0x000 0x7 0x0
+#define MX50_PAD_EPDC_PWRCTRL0__EPCD_PWRCTRL0                  0x224 0x5c0 0x000 0x0 0x0
+#define MX50_PAD_EPDC_PWRCTRL0__GPIO3_29                       0x224 0x5c0 0x000 0x1 0x0
+#define MX50_PAD_EPDC_PWRCTRL0__EIM_WEIM_D_29                  0x224 0x5c0 0x000 0x2 0x0
+#define MX50_PAD_EPDC_PWRCTRL0__ELCDIF_DAT_13                  0x224 0x5c0 0x730 0x3 0x1
+#define MX50_PAD_EPDC_PWRCTRL0__AUDMUX_AUD4_RXD                        0x224 0x5c0 0x6c4 0x4 0x1
+#define MX50_PAD_EPDC_PWRCTRL0__SDMA_DEBUG_RTBUFFER_WRITE      0x224 0x5c0 0x000 0x6 0x0
+#define MX50_PAD_EPDC_PWRCTRL0__USBPHY2_AVALID                 0x224 0x5c0 0x000 0x7 0x0
+#define MX50_PAD_EPDC_PWRCTRL1__EPCD_PWRCTRL1                  0x228 0x5c4 0x000 0x0 0x0
+#define MX50_PAD_EPDC_PWRCTRL1__GPIO3_30                       0x228 0x5c4 0x000 0x1 0x0
+#define MX50_PAD_EPDC_PWRCTRL1__EIM_WEIM_D_30                  0x228 0x5c4 0x000 0x2 0x0
+#define MX50_PAD_EPDC_PWRCTRL1__ELCDIF_DAT_14                  0x228 0x5c4 0x734 0x3 0x1
+#define MX50_PAD_EPDC_PWRCTRL1__AUDMUX_AUD4_RXC                        0x228 0x5c4 0x6cc 0x4 0x1
+#define MX50_PAD_EPDC_PWRCTRL1__SDMA_DEBUG_YIELD               0x228 0x5c4 0x000 0x6 0x0
+#define MX50_PAD_EPDC_PWRCTRL1__USBPHY1_ONBIST                 0x228 0x5c4 0x000 0x7 0x0
+#define MX50_PAD_EPDC_PWRCTRL2__EPCD_PWRCTRL2                  0x22c 0x5c8 0x000 0x0 0x0
+#define MX50_PAD_EPDC_PWRCTRL2__GPIO3_31                       0x22c 0x5c8 0x000 0x1 0x0
+#define MX50_PAD_EPDC_PWRCTRL2__EIM_WEIM_D_31                  0x22c 0x5c8 0x000 0x2 0x0
+#define MX50_PAD_EPDC_PWRCTRL2__ELCDIF_DAT_15                  0x22c 0x5c8 0x738 0x3 0x1
+#define MX50_PAD_EPDC_PWRCTRL2__AUDMUX_AUD4_RXFS               0x22c 0x5c8 0x6d0 0x4 0x1
+#define MX50_PAD_EPDC_PWRCTRL2__SDMA_EXT_EVENT_0               0x22c 0x5c8 0x7b8 0x6 0x1
+#define MX50_PAD_EPDC_PWRCTRL2__USBPHY2_ONBIST                 0x22c 0x5c8 0x000 0x7 0x0
+#define MX50_PAD_EPDC_PWRCTRL3__EPCD_PWRCTRL3                  0x230 0x5cc 0x000 0x0 0x0
+#define MX50_PAD_EPDC_PWRCTRL3__GPIO4_20                       0x230 0x5cc 0x000 0x1 0x0
+#define MX50_PAD_EPDC_PWRCTRL3__EIM_WEIM_EB_2                  0x230 0x5cc 0x000 0x2 0x0
+#define MX50_PAD_EPDC_PWRCTRL3__SDMA_EXT_EVENT_1               0x230 0x5cc 0x7bc 0x6 0x1
+#define MX50_PAD_EPDC_PWRCTRL3__USBPHY1_BISTOK                 0x230 0x5cc 0x000 0x7 0x0
+#define MX50_PAD_EPDC_VCOM0__EPCD_VCOM_0                       0x234 0x5d0 0x000 0x0 0x0
+#define MX50_PAD_EPDC_VCOM0__GPIO4_21                          0x234 0x5d0 0x000 0x1 0x0
+#define MX50_PAD_EPDC_VCOM0__EIM_WEIM_EB_3                     0x234 0x5d0 0x000 0x2 0x0
+#define MX50_PAD_EPDC_VCOM0__USBPHY2_BISTOK                    0x234 0x5d0 0x000 0x7 0x0
+#define MX50_PAD_EPDC_VCOM1__EPCD_VCOM_1                       0x238 0x5d4 0x000 0x0 0x0
+#define MX50_PAD_EPDC_VCOM1__GPIO4_22                          0x238 0x5d4 0x000 0x1 0x0
+#define MX50_PAD_EPDC_VCOM1__EIM_WEIM_CS_3                     0x238 0x5d4 0x000 0x2 0x0
+#define MX50_PAD_EPDC_BDR0__EPCD_BDR_0                         0x23c 0x5d8 0x000 0x0 0x0
+#define MX50_PAD_EPDC_BDR0__GPIO4_23                           0x23c 0x5d8 0x000 0x1 0x0
+#define MX50_PAD_EPDC_BDR0__ELCDIF_DAT_7                       0x23c 0x5d8 0x718 0x3 0x1
+#define MX50_PAD_EPDC_BDR1__EPCD_BDR_1                         0x240 0x5dc 0x000 0x0 0x0
+#define MX50_PAD_EPDC_BDR1__GPIO4_24                           0x240 0x5dc 0x000 0x1 0x0
+#define MX50_PAD_EPDC_BDR1__ELCDIF_DAT_6                       0x240 0x5dc 0x714 0x3 0x1
+#define MX50_PAD_EPDC_SDCE0__EPCD_SDCE_0                       0x244 0x5e0 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDCE0__GPIO4_25                          0x244 0x5e0 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDCE0__ELCDIF_DAT_5                      0x244 0x5e0 0x710 0x3 0x1
+#define MX50_PAD_EPDC_SDCE1__EPCD_SDCE_1                       0x248 0x5e4 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDCE1__GPIO4_26                          0x248 0x5e4 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDCE1__ELCDIF_DAT_4                      0x248 0x5e4 0x70c 0x3 0x0
+#define MX50_PAD_EPDC_SDCE2__EPCD_SDCE_2                       0x24c 0x5e8 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDCE2__GPIO4_27                          0x24c 0x5e8 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDCE2__ELCDIF_DAT_3                      0x24c 0x5e8 0x708 0x3 0x1
+#define MX50_PAD_EPDC_SDCE3__EPCD_SDCE_3                       0x250 0x5ec 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDCE3__GPIO4_28                          0x250 0x5ec 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDCE3__ELCDIF_DAT_2                      0x250 0x5ec 0x704 0x3 0x1
+#define MX50_PAD_EPDC_SDCE4__EPCD_SDCE_4                       0x254 0x5f0 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDCE4__GPIO4_29                          0x254 0x5f0 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDCE4__ELCDIF_DAT_1                      0x254 0x5f0 0x700 0x3 0x1
+#define MX50_PAD_EPDC_SDCE5__EPCD_SDCE_5                       0x258 0x5f4 0x000 0x0 0x0
+#define MX50_PAD_EPDC_SDCE5__GPIO4_30                          0x258 0x5f4 0x000 0x1 0x0
+#define MX50_PAD_EPDC_SDCE5__ELCDIF_DAT_0                      0x258 0x5f4 0x6fc 0x3 0x1
+#define MX50_PAD_EIM_DA0__EIM_WEIM_A_0                         0x25c 0x5f8 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA0__GPIO1_0                              0x25c 0x5f8 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA0__KPP_COL_4                            0x25c 0x5f8 0x790 0x3 0x2
+#define MX50_PAD_EIM_DA0__TPIU_TRACE_0                         0x25c 0x5f8 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA0__SRC_BT_CFG1_0                                0x25c 0x5f8 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA1__EIM_WEIM_A_1                         0x260 0x5fc 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA1__GPIO1_1                              0x260 0x5fc 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA1__KPP_ROW_4                            0x260 0x5fc 0x7a0 0x3 0x2
+#define MX50_PAD_EIM_DA1__TPIU_TRACE_1                         0x260 0x5fc 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA1__SRC_BT_CFG1_1                                0x260 0x5fc 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA2__EIM_WEIM_A_2                         0x264 0x600 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA2__GPIO1_2                              0x264 0x600 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA2__KPP_COL_5                            0x264 0x600 0x794 0x3 0x2
+#define MX50_PAD_EIM_DA2__TPIU_TRACE_2                         0x264 0x600 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA2__SRC_BT_CFG1_2                                0x264 0x600 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA3__EIM_WEIM_A_3                         0x268 0x604 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA3__GPIO1_3                              0x268 0x604 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA3__KPP_ROW_5                            0x268 0x604 0x7a4 0x3 0x2
+#define MX50_PAD_EIM_DA3__TPIU_TRACE_3                         0x268 0x604 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA3__SRC_BT_CFG1_3                                0x268 0x604 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA4__EIM_WEIM_A_4                         0x26c 0x608 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA4__GPIO1_4                              0x26c 0x608 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA4__KPP_COL_6                            0x26c 0x608 0x798 0x3 0x2
+#define MX50_PAD_EIM_DA4__TPIU_TRACE_4                         0x26c 0x608 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA4__SRC_BT_CFG1_4                                0x26c 0x608 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA5__EIM_WEIM_A_5                         0x270 0x60c 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA5__GPIO1_5                              0x270 0x60c 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA5__KPP_ROW_6                            0x270 0x60c 0x7a8 0x3 0x2
+#define MX50_PAD_EIM_DA5__TPIU_TRACE_5                         0x270 0x60c 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA5__SRC_BT_CFG1_5                                0x270 0x60c 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA6__EIM_WEIM_A_6                         0x274 0x610 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA6__GPIO1_6                              0x274 0x610 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA6__KPP_COL_7                            0x274 0x610 0x79c 0x3 0x2
+#define MX50_PAD_EIM_DA6__TPIU_TRACE_6                         0x274 0x610 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA6__SRC_BT_CFG1_6                                0x274 0x610 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA7__EIM_WEIM_A_7                         0x278 0x614 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA7__GPIO1_7                              0x278 0x614 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA7__KPP_ROW_7                            0x278 0x614 0x7ac 0x3 0x2
+#define MX50_PAD_EIM_DA7__TPIU_TRACE_7                         0x278 0x614 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA7__SRC_BT_CFG1_7                                0x278 0x614 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA8__EIM_WEIM_A_8                         0x27c 0x618 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA8__GPIO1_8                              0x27c 0x618 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA8__EIM_NANDF_CLE                                0x27c 0x618 0x000 0x2 0x0
+#define MX50_PAD_EIM_DA8__TPIU_TRACE_8                         0x27c 0x618 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA8__SRC_BT_CFG2_0                                0x27c 0x618 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA9__EIM_WEIM_A_9                         0x280 0x61c 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA9__GPIO1_9                              0x280 0x61c 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA9__EIM_NANDF_ALE                                0x280 0x61c 0x000 0x2 0x0
+#define MX50_PAD_EIM_DA9__TPIU_TRACE_9                         0x280 0x61c 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA9__SRC_BT_CFG2_1                                0x280 0x61c 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA10__EIM_WEIM_A_10                       0x284 0x620 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA10__GPIO1_10                            0x284 0x620 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA10__EIM_NANDF_CEN_0                     0x284 0x620 0x000 0x2 0x0
+#define MX50_PAD_EIM_DA10__TPIU_TRACE_10                       0x284 0x620 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA10__SRC_BT_CFG2_2                       0x284 0x620 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA11__EIM_WEIM_A_11                       0x288 0x624 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA11__GPIO1_11                            0x288 0x624 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA11__EIM_NANDF_CEN_1                     0x288 0x624 0x000 0x2 0x0
+#define MX50_PAD_EIM_DA11__TPIU_TRACE_11                       0x288 0x624 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA11__SRC_BT_CFG2_3                       0x288 0x624 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA12__EIM_WEIM_A_12                       0x28c 0x628 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA12__GPIO1_12                            0x28c 0x628 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA12__EIM_NANDF_CEN_2                     0x28c 0x628 0x000 0x2 0x0
+#define MX50_PAD_EIM_DA12__EPDC_SDCE_6                         0x28c 0x628 0x000 0x3 0x0
+#define MX50_PAD_EIM_DA12__TPIU_TRACE_12                       0x28c 0x628 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA12__SRC_BT_CFG2_4                       0x28c 0x628 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA13__EIM_WEIM_A_13                       0x290 0x62c 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA13__GPIO1_13                            0x290 0x62c 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA13__EIM_NANDF_CEN_3                     0x290 0x62c 0x000 0x2 0x0
+#define MX50_PAD_EIM_DA13__EPDC_SDCE_7                         0x290 0x62c 0x000 0x3 0x0
+#define MX50_PAD_EIM_DA13__TPIU_TRACE_13                       0x290 0x62c 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA13__SRC_BT_CFG2_5                       0x290 0x62c 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA14__EIM_WEIM_A_14                       0x294 0x630 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA14__GPIO1_14                            0x294 0x630 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA14__EIM_NANDF_READY0                    0x294 0x630 0x7b4 0x2 0x2
+#define MX50_PAD_EIM_DA14__EPDC_SDCE_8                         0x294 0x630 0x000 0x3 0x0
+#define MX50_PAD_EIM_DA14__TPIU_TRACE_14                       0x294 0x630 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA14__SRC_BT_CFG2_6                       0x294 0x630 0x000 0x7 0x0
+#define MX50_PAD_EIM_DA15__EIM_WEIM_A_15                       0x298 0x634 0x000 0x0 0x0
+#define MX50_PAD_EIM_DA15__GPIO1_15                            0x298 0x634 0x000 0x1 0x0
+#define MX50_PAD_EIM_DA15__EIM_NANDF_DQS                       0x298 0x634 0x7b0 0x2 0x2
+#define MX50_PAD_EIM_DA15__EPDC_SDCE_9                         0x298 0x634 0x000 0x3 0x0
+#define MX50_PAD_EIM_DA15__TPIU_TRACE_15                       0x298 0x634 0x000 0x6 0x0
+#define MX50_PAD_EIM_DA15__SRC_BT_CFG2_7                       0x298 0x634 0x000 0x7 0x0
+#define MX50_PAD_EIM_CS2__EIM_WEIM_CS_2                                0x29c 0x638 0x000 0x0 0x0
+#define MX50_PAD_EIM_CS2__GPIO1_16                             0x29c 0x638 0x000 0x1 0x0
+#define MX50_PAD_EIM_CS2__EIM_WEIM_A_27                                0x29c 0x638 0x000 0x2 0x0
+#define MX50_PAD_EIM_CS2__TPIU_TRCLK                           0x29c 0x638 0x000 0x6 0x0
+#define MX50_PAD_EIM_CS2__SRC_BT_CFG3_0                                0x29c 0x638 0x000 0x7 0x0
+#define MX50_PAD_EIM_CS1__EIM_WEIM_CS_1                                0x2a0 0x63c 0x000 0x0 0x0
+#define MX50_PAD_EIM_CS1__GPIO1_17                             0x2a0 0x63c 0x000 0x1 0x0
+#define MX50_PAD_EIM_CS1__TPIU_TRCTL                           0x2a0 0x63c 0x000 0x6 0x0
+#define MX50_PAD_EIM_CS1__SRC_BT_CFG3_1                                0x2a0 0x63c 0x000 0x7 0x0
+#define MX50_PAD_EIM_CS0__EIM_WEIM_CS_0                                0x2a4 0x640 0x000 0x0 0x0
+#define MX50_PAD_EIM_CS0__GPIO1_18                             0x2a4 0x640 0x000 0x1 0x0
+#define MX50_PAD_EIM_CS0__SRC_BT_CFG3_2                                0x2a4 0x640 0x000 0x7 0x0
+#define MX50_PAD_EIM_EB0__EIM_WEIM_EB_0                                0x2a8 0x644 0x000 0x0 0x0
+#define MX50_PAD_EIM_EB0__GPIO1_19                             0x2a8 0x644 0x000 0x1 0x0
+#define MX50_PAD_EIM_EB0__SRC_BT_CFG3_3                                0x2a8 0x644 0x000 0x7 0x0
+#define MX50_PAD_EIM_EB1__EIM_WEIM_EB_1                                0x2ac 0x648 0x000 0x0 0x0
+#define MX50_PAD_EIM_EB1__GPIO1_20                             0x2ac 0x648 0x000 0x1 0x0
+#define MX50_PAD_EIM_EB1__SRC_BT_CFG3_4                                0x2ac 0x648 0x000 0x7 0x0
+#define MX50_PAD_EIM_WAIT__EIM_WEIM_WAIT                       0x2b0 0x64c 0x000 0x0 0x0
+#define MX50_PAD_EIM_WAIT__GPIO1_21                            0x2b0 0x64c 0x000 0x1 0x0
+#define MX50_PAD_EIM_WAIT__EIM_WEIM_DTACK_B                    0x2b0 0x64c 0x000 0x2 0x0
+#define MX50_PAD_EIM_WAIT__SRC_BT_CFG3_5                       0x2b0 0x64c 0x000 0x7 0x0
+#define MX50_PAD_EIM_BCLK__EIM_WEIM_BCLK                       0x2b4 0x650 0x000 0x0 0x0
+#define MX50_PAD_EIM_BCLK__GPIO1_22                            0x2b4 0x650 0x000 0x1 0x0
+#define MX50_PAD_EIM_BCLK__SRC_BT_CFG3_6                       0x2b4 0x650 0x000 0x7 0x0
+#define MX50_PAD_EIM_RDY__EIM_WEIM_RDY                         0x2b8 0x654 0x000 0x0 0x0
+#define MX50_PAD_EIM_RDY__GPIO1_23                             0x2b8 0x654 0x000 0x1 0x0
+#define MX50_PAD_EIM_RDY__SRC_BT_CFG3_7                                0x2b8 0x654 0x000 0x7 0x0
+#define MX50_PAD_EIM_OE__EIM_WEIM_OE                           0x2bc 0x658 0x000 0x0 0x0
+#define MX50_PAD_EIM_OE__GPIO1_24                              0x2bc 0x658 0x000 0x1 0x0
+#define MX50_PAD_EIM_OE__INT_BOOT                              0x2bc 0x658 0x000 0x7 0x0
+#define MX50_PAD_EIM_RW__EIM_WEIM_RW                           0x2c0 0x65c 0x000 0x0 0x0
+#define MX50_PAD_EIM_RW__GPIO1_25                              0x2c0 0x65c 0x000 0x1 0x0
+#define MX50_PAD_EIM_RW__SYSTEM_RST                            0x2c0 0x65c 0x000 0x7 0x0
+#define MX50_PAD_EIM_LBA__EIM_WEIM_LBA                         0x2c4 0x660 0x000 0x0 0x0
+#define MX50_PAD_EIM_LBA__GPIO1_26                             0x2c4 0x660 0x000 0x1 0x0
+#define MX50_PAD_EIM_LBA__TESTER_ACK                           0x2c4 0x660 0x000 0x7 0x0
+#define MX50_PAD_EIM_CRE__EIM_WEIM_CRE                         0x2c8 0x664 0x000 0x0 0x0
+#define MX50_PAD_EIM_CRE__GPIO1_27                             0x2c8 0x664 0x000 0x1 0x0
+
+#endif /* __DTS_IMX50_PINFUNC_H */
diff --git a/arch/arm/boot/dts/imx50-pingrp.h b/arch/arm/boot/dts/imx50-pingrp.h
new file mode 100644 (file)
index 0000000..0f4ce8c
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2013 Freescale Semiconductor, 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.
+ *
+ */
+
+#ifndef __DTS_IMX50_PINGRP_H
+#define __DTS_IMX50_PINGRP_H
+
+#include "imx50-pinfunc.h"
+
+#define MX50_CSPI_PINGRP1 \
+       MX50_PAD_CSPI_SCLK__CSPI_SCLK                   0x00 \
+       MX50_PAD_CSPI_MISO__CSPI_MISO                   0x00 \
+       MX50_PAD_CSPI_MOSI__CSPI_MOSI                   0x00 \
+       MX50_PAD_CSPI_SS0__GPIO4_11                     0xc4 \
+       MX50_PAD_ECSPI1_MOSI__CSPI_SS1                  0xf4
+
+#define MX50_ECSPI1_PINGRP1 \
+       MX50_PAD_ECSPI1_SCLK__ECSPI1_SCLK               0x00 \
+       MX50_PAD_ECSPI1_SS0__ECSPI1_SS0                 0x00 \
+       MX50_PAD_ECSPI1_MISO__ECSPI1_MISO               0x00 \
+       MX50_PAD_ECSPI1_MOSI__ECSPI1_MOSI               0x00
+
+#define MX50_ESDHC1_PINGRP1 \
+       MX50_PAD_SD1_D0__ESDHC1_DAT0                    0x1d4 \
+       MX50_PAD_SD1_D1__ESDHC1_DAT1                    0x1d4 \
+       MX50_PAD_SD1_D2__ESDHC1_DAT2                    0x1d4 \
+       MX50_PAD_SD1_D3__ESDHC1_DAT3                    0x1d4 \
+       MX50_PAD_SD1_CMD__ESDHC1_CMD                    0x1e4 \
+       MX50_PAD_SD1_CLK__ESDHC1_CLK                    0xd4
+
+#define MX50_ESDHC1_PINGRP2 \
+       MX50_PAD_SD1_D0__ESDHC1_DAT0                    0x1d4 \
+       MX50_PAD_SD1_D1__ESDHC1_DAT1                    0x1d4 \
+       MX50_PAD_SD1_D2__ESDHC1_DAT2                    0x1d4 \
+       MX50_PAD_SD1_D3__ESDHC1_DAT3                    0x1d4 \
+       MX50_PAD_UART3_TXD__ESDHC1_DAT4                 0x1d4 \
+       MX50_PAD_UART3_RXD__ESDHC1_DAT5                 0x1d4 \
+       MX50_PAD_UART4_TXD__ESDHC1_DAT6                 0x1d4 \
+       MX50_PAD_UART4_RXD__ESDHC1_DAT7                 0x1d4 \
+       MX50_PAD_SD1_CMD__ESDHC1_CMD                    0x14 \
+       MX50_PAD_SD1_CLK__ESDHC1_CLK                    0xd4
+
+#define MX50_ESDHC2_PINGRP1 \
+       MX50_PAD_SD2_CMD__ESDHC2_CMD                    0x1e4 \
+       MX50_PAD_SD2_CLK__ESDHC2_CLK                    0xd4 \
+       MX50_PAD_SD2_D0__ESDHC2_DAT0                    0x1d4 \
+       MX50_PAD_SD2_D1__ESDHC2_DAT1                    0x1d4 \
+       MX50_PAD_SD2_D2__ESDHC2_DAT2                    0x1d4 \
+       MX50_PAD_SD2_D3__ESDHC2_DAT3                    0x1d4 \
+       MX50_PAD_SD2_D4__ESDHC2_DAT4                    0x1d4 \
+       MX50_PAD_SD2_D5__ESDHC2_DAT5                    0x1d4 \
+       MX50_PAD_SD2_D6__ESDHC2_DAT6                    0x1d4 \
+       MX50_PAD_SD2_D7__ESDHC2_DAT7                    0x1d4
+
+#define MX50_ESDHC3_PINGRP1 \
+       MX50_PAD_SD3_D0__ESDHC3_DAT0                    0x1d4 \
+       MX50_PAD_SD3_D1__ESDHC3_DAT1                    0x1d4 \
+       MX50_PAD_SD3_D2__ESDHC3_DAT2                    0x1d4 \
+       MX50_PAD_SD3_D3__ESDHC3_DAT3                    0x1d4 \
+       MX50_PAD_SD3_D4__ESDHC3_DAT4                    0x1d4 \
+       MX50_PAD_SD3_D5__ESDHC3_DAT5                    0x1d4 \
+       MX50_PAD_SD3_D6__ESDHC3_DAT6                    0x1d4 \
+       MX50_PAD_SD3_D7__ESDHC3_DAT7                    0x1d4 \
+       MX50_PAD_SD3_CMD__ESDHC3_CMD                    0x1e4 \
+       MX50_PAD_SD3_CLK__ESDHC3_CLK                    0xd4
+
+#define MX50_FEC_PINGRP1 \
+       MX50_PAD_SSI_RXFS__FEC_MDC                      0x80 \
+       MX50_PAD_SSI_RXC__FEC_MDIO                      0x80 \
+       MX50_PAD_DISP_D0__FEC_TX_CLK                    0x80 \
+       MX50_PAD_DISP_D1__FEC_RX_ERR                    0x80 \
+       MX50_PAD_DISP_D2__FEC_RX_DV                     0x80 \
+       MX50_PAD_DISP_D3__FEC_RDATA_1                   0x80 \
+       MX50_PAD_DISP_D4__FEC_RDATA_0                   0x80 \
+       MX50_PAD_DISP_D5__FEC_TX_EN                     0x80 \
+       MX50_PAD_DISP_D6__FEC_TDATA_1                   0x80 \
+       MX50_PAD_DISP_D7__FEC_TDATA_0                   0x80
+
+#define MX50_FEC_PINGRP2 \
+       MX50_PAD_I2C3_SCL__FEC_MDC                      0x80 \
+       MX50_PAD_I2C3_SDA__FEC_MDIO                     0x80 \
+       MX50_PAD_DISP_D0__FEC_TX_CLK                    0x80 \
+       MX50_PAD_DISP_D10__FEC_RX_DV                    0x80 \
+       MX50_PAD_DISP_D11__FEC_RDATA_1                  0x80 \
+       MX50_PAD_DISP_D12__FEC_RDATA_0                  0x80 \
+       MX50_PAD_DISP_D13__FEC_TX_EN                    0x80 \
+       MX50_PAD_DISP_D14__FEC_TDATA_1                  0x80 \
+       MX50_PAD_DISP_D15__FEC_TDATA_0                  0x80
+
+#define MX50_I2C1_PINGRP1 \
+       MX50_PAD_I2C1_SDA__I2C1_SDA                     0x12c \
+       MX50_PAD_I2C1_SCL__I2C1_SCL                     0x12c
+
+#define MX50_I2C2_PINGRP1 \
+       MX50_PAD_I2C2_SDA__I2C2_SDA                     0x12c \
+       MX50_PAD_I2C2_SCL__I2C2_SCL                     0x12c
+
+#define MX50_I2C3_PINGRP1 \
+       MX50_PAD_I2C3_SDA__I2C3_SDA                     0x12c \
+       MX50_PAD_I2C3_SCL__I2C3_SCL                     0x12c
+
+#define MX50_OWIRE_PINGRP1 \
+       MX50_PAD_OWIRE__OWIRE_LINE                      0x84
+
+#define MX50_UART1_PINGRP1 \
+       MX50_PAD_UART1_TXD__UART1_TXD_MUX               0x1e4 \
+       MX50_PAD_UART1_RXD__UART1_RXD_MUX               0x1e4 \
+       MX50_PAD_UART1_RTS__UART1_RTS                   0x1e4 \
+       MX50_PAD_UART1_CTS__UART1_CTS                   0x1e4
+
+#define MX50_UART2_PINGRP1 \
+       MX50_PAD_UART2_TXD__UART2_TXD_MUX               0x1e4 \
+       MX50_PAD_UART2_RXD__UART2_RXD_MUX               0x1e4 \
+       MX50_PAD_UART2_RTS__UART2_RTS                   0x1e4 \
+       MX50_PAD_UART2_CTS__UART2_CTS                   0x1e4
+
+#define MX50_UART2_PINGRP2 \
+       MX50_PAD_I2C1_SCL__UART2_TXD_MUX                0x1e4 \
+       MX50_PAD_I2C1_SDA__UART2_RXD_MUX                0x1e4 \
+       MX50_PAD_I2C2_SDA__UART2_RTS                    0x1e4 \
+       MX50_PAD_I2C2_SCL__UART2_CTS                    0x1e4
+
+#define MX50_UART3_PINGRP1 \
+       MX50_PAD_UART3_TXD__UART3_TXD_MUX               0x1e4 \
+       MX50_PAD_UART3_RXD__UART3_RXD_MUX               0x1e4 \
+       MX50_PAD_ECSPI1_SCLK__UART3_RTS                 0x1e4 \
+       MX50_PAD_ECSPI1_MOSI__UART3_CTS                 0x1e4
+
+#define MX50_UART4_PINGRP1 \
+       MX50_PAD_UART4_TXD__UART4_TXD_MUX               0x1e4 \
+       MX50_PAD_UART4_RXD__UART4_RXD_MUX               0x1e4 \
+       MX50_PAD_ECSPI1_MISO__UART4_RTS                 0x1e4 \
+       MX50_PAD_ECSPI1_SS0__UART4_CTS                  0x1e4
+
+#define MX50_UART5_PINGRP1 \
+       MX50_PAD_ECSPI2_MISO__UART5_TXD_MUX             0x1e4 \
+       MX50_PAD_ECSPI2_SS0__UART5_RXD_MUX              0x1e4 \
+       MX50_PAD_ECSPI2_SCLK__UART5_RTS                 0x1e4 \
+       MX50_PAD_ECSPI2_MOSI__UART5_CTS                 0x1e4
+
+#endif /* __DTS_IMX50_PINGRP_H */
diff --git a/arch/arm/boot/dts/imx50.dtsi b/arch/arm/boot/dts/imx50.dtsi
new file mode 100644 (file)
index 0000000..01c0499
--- /dev/null
@@ -0,0 +1,475 @@
+/*
+ * Copyright 2013 Greg Ungerer <gerg@uclinux.org>
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * 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 "skeleton.dtsi"
+#include "imx50-pingrp.h"
+#include <dt-bindings/clock/imx5-clock.h>
+
+/ {
+       aliases {
+               gpio0 = &gpio1;
+               gpio1 = &gpio2;
+               gpio2 = &gpio3;
+               gpio3 = &gpio4;
+               gpio4 = &gpio5;
+               gpio5 = &gpio6;
+               serial0 = &uart1;
+               serial1 = &uart2;
+               serial2 = &uart3;
+               serial3 = &uart4;
+               serial4 = &uart5;
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,cortex-a8";
+                       reg = <0x0>;
+               };
+       };
+
+       tzic: tz-interrupt-controller@0fffc000 {
+               compatible = "fsl,imx50-tzic", "fsl,imx53-tzic", "fsl,tzic";
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               reg = <0x0fffc000 0x4000>;
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ckil {
+                       compatible = "fsl,imx-ckil", "fixed-clock";
+                       clock-frequency = <32768>;
+               };
+
+               ckih1 {
+                       compatible = "fsl,imx-ckih1", "fixed-clock";
+                       clock-frequency = <22579200>;
+               };
+
+               ckih2 {
+                       compatible = "fsl,imx-ckih2", "fixed-clock";
+                       clock-frequency = <0>;
+               };
+
+               osc {
+                       compatible = "fsl,imx-osc", "fixed-clock";
+                       clock-frequency = <24000000>;
+               };
+       };
+
+       soc {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "simple-bus";
+               interrupt-parent = <&tzic>;
+               ranges;
+
+               aips@50000000 { /* AIPS1 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x50000000 0x10000000>;
+                       ranges;
+
+                       spba@50000000 {
+                               compatible = "fsl,spba-bus", "simple-bus";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+                               reg = <0x50000000 0x40000>;
+                               ranges;
+
+                               esdhc1: esdhc@50004000 {
+                                       compatible = "fsl,imx50-esdhc";
+                                       reg = <0x50004000 0x4000>;
+                                       interrupts = <1>;
+                                       clocks = <&clks IMX5_CLK_ESDHC1_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC1_PER_GATE>;
+                                       clock-names = "ipg", "ahb", "per";
+                                       bus-width = <4>;
+                                       status = "disabled";
+                               };
+
+                               esdhc2: esdhc@50008000 {
+                                       compatible = "fsl,imx50-esdhc";
+                                       reg = <0x50008000 0x4000>;
+                                       interrupts = <2>;
+                                       clocks = <&clks IMX5_CLK_ESDHC2_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC2_PER_GATE>;
+                                       clock-names = "ipg", "ahb", "per";
+                                       bus-width = <4>;
+                                       status = "disabled";
+                               };
+
+                               uart3: serial@5000c000 {
+                                       compatible = "fsl,imx50-uart", "fsl,imx21-uart";
+                                       reg = <0x5000c000 0x4000>;
+                                       interrupts = <33>;
+                                       clocks = <&clks IMX5_CLK_UART3_IPG_GATE>,
+                                                <&clks IMX5_CLK_UART3_PER_GATE>;
+                                       clock-names = "ipg", "per";
+                                       status = "disabled";
+                               };
+
+                               ecspi1: ecspi@50010000 {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+                                       compatible = "fsl,imx50-ecspi", "fsl,imx51-ecspi";
+                                       reg = <0x50010000 0x4000>;
+                                       interrupts = <36>;
+                                       clocks = <&clks IMX5_CLK_ECSPI1_IPG_GATE>,
+                                                <&clks IMX5_CLK_ECSPI1_PER_GATE>;
+                                       clock-names = "ipg", "per";
+                                       status = "disabled";
+                               };
+
+                               ssi2: ssi@50014000 {
+                                       compatible = "fsl,imx50-ssi", "fsl,imx21-ssi";
+                                       reg = <0x50014000 0x4000>;
+                                       interrupts = <30>;
+                                       clocks = <&clks IMX5_CLK_SSI2_IPG_GATE>;
+                                       fsl,fifo-depth = <15>;
+                                       fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
+                                       status = "disabled";
+                               };
+
+                               esdhc3: esdhc@50020000 {
+                                       compatible = "fsl,imx50-esdhc";
+                                       reg = <0x50020000 0x4000>;
+                                       interrupts = <3>;
+                                       clocks = <&clks IMX5_CLK_ESDHC3_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC3_PER_GATE>;
+                                       clock-names = "ipg", "ahb", "per";
+                                       bus-width = <4>;
+                                       status = "disabled";
+                               };
+
+                               esdhc4: esdhc@50024000 {
+                                       compatible = "fsl,imx50-esdhc";
+                                       reg = <0x50024000 0x4000>;
+                                       interrupts = <4>;
+                                       clocks = <&clks IMX5_CLK_ESDHC4_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC4_PER_GATE>;
+                                       clock-names = "ipg", "ahb", "per";
+                                       bus-width = <4>;
+                                       status = "disabled";
+                               };
+                       };
+
+                       usbotg: usb@53f80000 {
+                               compatible = "fsl,imx50-usb", "fsl,imx27-usb";
+                               reg = <0x53f80000 0x0200>;
+                               interrupts = <18>;
+                               clocks = <&clks IMX5_CLK_USB_PHY1_GATE>;
+                               status = "disabled";
+                       };
+
+                       usbh1: usb@53f80200 {
+                               compatible = "fsl,imx50-usb", "fsl,imx27-usb";
+                               reg = <0x53f80200 0x0200>;
+                               interrupts = <14>;
+                               clocks = <&clks IMX5_CLK_USB_PHY2_GATE>;
+                               status = "disabled";
+                       };
+
+                       usbh2: usb@53f80400 {
+                               compatible = "fsl,imx50-usb", "fsl,imx27-usb";
+                               reg = <0x53f80400 0x0200>;
+                               interrupts = <16>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
+                               status = "disabled";
+                       };
+
+                       usbh3: usb@53f80600 {
+                               compatible = "fsl,imx50-usb", "fsl,imx27-usb";
+                               reg = <0x53f80600 0x0200>;
+                               interrupts = <17>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
+                               status = "disabled";
+                       };
+
+                       gpio1: gpio@53f84000 {
+                               compatible = "fsl,imx50-gpio", "fsl,imx35-gpio";
+                               reg = <0x53f84000 0x4000>;
+                               interrupts = <50 51>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio2: gpio@53f88000 {
+                               compatible = "fsl,imx50-gpio", "fsl,imx35-gpio";
+                               reg = <0x53f88000 0x4000>;
+                               interrupts = <52 53>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio3: gpio@53f8c000 {
+                               compatible = "fsl,imx50-gpio", "fsl,imx35-gpio";
+                               reg = <0x53f8c000 0x4000>;
+                               interrupts = <54 55>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio4: gpio@53f90000 {
+                               compatible = "fsl,imx50-gpio", "fsl,imx35-gpio";
+                               reg = <0x53f90000 0x4000>;
+                               interrupts = <56 57>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       wdog1: wdog@53f98000 {
+                               compatible = "fsl,imx50-wdt", "fsl,imx21-wdt";
+                               reg = <0x53f98000 0x4000>;
+                               interrupts = <58>;
+                               clocks = <&clks IMX5_CLK_DUMMY>;
+                       };
+
+                       gpt: timer@53fa0000 {
+                               compatible = "fsl,imx50-gpt", "fsl,imx31-gpt";
+                               reg = <0x53fa0000 0x4000>;
+                               interrupts = <39>;
+                               clocks = <&clks IMX5_CLK_GPT_IPG_GATE>,
+                                        <&clks IMX5_CLK_GPT_HF_GATE>;
+                               clock-names = "ipg", "per";
+                       };
+
+                       iomuxc: iomuxc@53fa8000 {
+                               compatible = "fsl,imx50-iomuxc", "fsl,imx53-iomuxc";
+                               reg = <0x53fa8000 0x4000>;
+                       };
+
+                       gpr: iomuxc-gpr@53fa8000 {
+                               compatible = "fsl,imx50-iomuxc-gpr", "syscon";
+                               reg = <0x53fa8000 0xc>;
+                       };
+
+                       pwm1: pwm@53fb4000 {
+                               #pwm-cells = <2>;
+                               compatible = "fsl,imx50-pwm", "fsl,imx27-pwm";
+                               reg = <0x53fb4000 0x4000>;
+                               clocks = <&clks IMX5_CLK_PWM1_IPG_GATE>,
+                                        <&clks IMX5_CLK_PWM1_HF_GATE>;
+                               clock-names = "ipg", "per";
+                               interrupts = <61>;
+                       };
+
+                       pwm2: pwm@53fb8000 {
+                               #pwm-cells = <2>;
+                               compatible = "fsl,imx50-pwm", "fsl,imx27-pwm";
+                               reg = <0x53fb8000 0x4000>;
+                               clocks = <&clks IMX5_CLK_PWM2_IPG_GATE>,
+                                        <&clks IMX5_CLK_PWM2_HF_GATE>;
+                               clock-names = "ipg", "per";
+                               interrupts = <94>;
+                       };
+
+                       uart1: serial@53fbc000 {
+                               compatible = "fsl,imx50-uart", "fsl,imx21-uart";
+                               reg = <0x53fbc000 0x4000>;
+                               interrupts = <31>;
+                               clocks = <&clks IMX5_CLK_UART1_IPG_GATE>,
+                                        <&clks IMX5_CLK_UART1_PER_GATE>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       uart2: serial@53fc0000 {
+                               compatible = "fsl,imx50-uart", "fsl,imx21-uart";
+                               reg = <0x53fc0000 0x4000>;
+                               interrupts = <32>;
+                               clocks = <&clks IMX5_CLK_UART2_IPG_GATE>,
+                                        <&clks IMX5_CLK_UART2_PER_GATE>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       src: src@53fd0000 {
+                               compatible = "fsl,imx50-src", "fsl,imx51-src";
+                               reg = <0x53fd0000 0x4000>;
+                               #reset-cells = <1>;
+                       };
+
+                       clks: ccm@53fd4000{
+                               compatible = "fsl,imx50-ccm";
+                               reg = <0x53fd4000 0x4000>;
+                               interrupts = <0 71 0x04 0 72 0x04>;
+                               #clock-cells = <1>;
+                       };
+
+                       gpio5: gpio@53fdc000 {
+                               compatible = "fsl,imx50-gpio", "fsl,imx35-gpio";
+                               reg = <0x53fdc000 0x4000>;
+                               interrupts = <103 104>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       gpio6: gpio@53fe0000 {
+                               compatible = "fsl,imx50-gpio", "fsl,imx35-gpio";
+                               reg = <0x53fe0000 0x4000>;
+                               interrupts = <105 106>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
+                               interrupt-controller;
+                               #interrupt-cells = <2>;
+                       };
+
+                       i2c3: i2c@53fec000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx50-i2c", "fsl,imx21-i2c";
+                               reg = <0x53fec000 0x4000>;
+                               interrupts = <64>;
+                               clocks = <&clks IMX5_CLK_I2C3_GATE>;
+                               status = "disabled";
+                       };
+
+                       uart4: serial@53ff0000 {
+                               compatible = "fsl,imx50-uart", "fsl,imx21-uart";
+                               reg = <0x53ff0000 0x4000>;
+                               interrupts = <13>;
+                               clocks = <&clks IMX5_CLK_UART4_IPG_GATE>,
+                                        <&clks IMX5_CLK_UART4_PER_GATE>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+               };
+
+               aips@60000000 { /* AIPS2 */
+                       compatible = "fsl,aips-bus", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+                       reg = <0x60000000 0x10000000>;
+                       ranges;
+
+                       uart5: serial@63f90000 {
+                               compatible = "fsl,imx50-uart", "fsl,imx21-uart";
+                               reg = <0x63f90000 0x4000>;
+                               interrupts = <86>;
+                               clocks = <&clks IMX5_CLK_UART5_IPG_GATE>,
+                                        <&clks IMX5_CLK_UART5_PER_GATE>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       owire: owire@63fa4000 {
+                               compatible = "fsl,imx50-owire", "fsl,imx21-owire";
+                               reg = <0x63fa4000 0x4000>;
+                               clocks = <&clks IMX5_CLK_OWIRE_GATE>;
+                               status = "disabled";
+                       };
+
+                       ecspi2: ecspi@63fac000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx50-ecspi", "fsl,imx51-ecspi";
+                               reg = <0x63fac000 0x4000>;
+                               interrupts = <37>;
+                               clocks = <&clks IMX5_CLK_ECSPI2_IPG_GATE>,
+                                        <&clks IMX5_CLK_ECSPI2_PER_GATE>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       sdma: sdma@63fb0000 {
+                               compatible = "fsl,imx50-sdma", "fsl,imx35-sdma";
+                               reg = <0x63fb0000 0x4000>;
+                               interrupts = <6>;
+                               clocks = <&clks IMX5_CLK_SDMA_GATE>,
+                                        <&clks IMX5_CLK_SDMA_GATE>;
+                               clock-names = "ipg", "ahb";
+                               fsl,sdma-ram-script-name = "imx/sdma/sdma-imx50.bin";
+                       };
+
+                       cspi: cspi@63fc0000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx50-cspi", "fsl,imx35-cspi";
+                               reg = <0x63fc0000 0x4000>;
+                               interrupts = <38>;
+                               clocks = <&clks IMX5_CLK_CSPI_IPG_GATE>,
+                                        <&clks IMX5_CLK_CSPI_IPG_GATE>;
+                               clock-names = "ipg", "per";
+                               status = "disabled";
+                       };
+
+                       i2c2: i2c@63fc4000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx50-i2c", "fsl,imx21-i2c";
+                               reg = <0x63fc4000 0x4000>;
+                               interrupts = <63>;
+                               clocks = <&clks IMX5_CLK_I2C2_GATE>;
+                               status = "disabled";
+                       };
+
+                       i2c1: i2c@63fc8000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx50-i2c", "fsl,imx21-i2c";
+                               reg = <0x63fc8000 0x4000>;
+                               interrupts = <62>;
+                               clocks = <&clks IMX5_CLK_I2C1_GATE>;
+                               status = "disabled";
+                       };
+
+                       ssi1: ssi@63fcc000 {
+                               compatible = "fsl,imx50-ssi", "fsl,imx21-ssi";
+                               reg = <0x63fcc000 0x4000>;
+                               interrupts = <29>;
+                               clocks = <&clks IMX5_CLK_SSI1_IPG_GATE>;
+                               fsl,fifo-depth = <15>;
+                               fsl,ssi-dma-events = <29 28 27 26>; /* TX0 RX0 TX1 RX1 */
+                               status = "disabled";
+                       };
+
+                       audmux: audmux@63fd0000 {
+                               compatible = "fsl,imx50-audmux", "fsl,imx31-audmux";
+                               reg = <0x63fd0000 0x4000>;
+                               status = "disabled";
+                       };
+
+                       fec: ethernet@63fec000 {
+                               compatible = "fsl,imx53-fec", "fsl,imx25-fec";
+                               reg = <0x63fec000 0x4000>;
+                               interrupts = <87>;
+                               clocks = <&clks IMX5_CLK_FEC_GATE>,
+                                        <&clks IMX5_CLK_FEC_GATE>,
+                                        <&clks IMX5_CLK_FEC_GATE>;
+                               clock-names = "ipg", "ahb", "ptp";
+                               status = "disabled";
+                       };
+               };
+       };
+};
index b3606993f2e8db4e4327305f52fddec70249e9f3..80840daf83c6b714043a8e20f992b68355887993 100644 (file)
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_fec_2>;
+       pinctrl-0 = <&pinctrl_fec>;
        phy-mode = "mii";
-       phy-reset-gpios = <&gpio3 0 0>;
+       phy-reset-gpios = <&gpio3 0 GPIO_ACTIVE_HIGH>;
        phy-reset-duration = <1>;
        status = "okay";
 };
 
+&iomuxc {
+       imx51-apf51 {
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <MX51_FEC_PINGRP2>;
+               };
+
+               pinctrl_uart3: uart3grp {
+                       fsl,pins = <MX51_UART3_PINGRP2>;
+               };
+       };
+};
+
 &nfc {
        nand-bus-width = <8>;
        nand-ecc-mode = "hw";
@@ -50,6 +62,6 @@
 
 &uart3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart3_2>;
+       pinctrl-0 = <&pinctrl_uart3>;
        status = "okay";
 };
index 5a7f552786a112dadff76c0d664fc6fb682f7ccf..f36a3aa115f87410a61803c7f86ad5e1d0336623 100644 (file)
@@ -21,7 +21,7 @@
                crtcs = <&ipu 0>;
                interface-pix-fmt = "bgr666";
                pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_ipu_disp1_1>;
+               pinctrl-0 = <&pinctrl_ipu_disp1>;
 
                display-timings {
                        lw700 {
@@ -48,7 +48,7 @@
 
                user-key {
                        label = "user";
-                       gpios = <&gpio1 3 0>;
+                       gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
                        linux,code = <256>; /* BTN_0 */
                };
        };
@@ -58,7 +58,7 @@
 
                user {
                        label = "Heartbeat";
-                       gpios = <&gpio1 2 0>;
+                       gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "heartbeat";
                };
        };
 
 &ecspi1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_ecspi1_1>;
+       pinctrl-0 = <&pinctrl_ecspi1>;
        fsl,spi-num-chipselects = <2>;
-       cs-gpios = <&gpio4 24 0>, <&gpio4 25 0>;
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>,
+                  <&gpio4 25 GPIO_ACTIVE_HIGH>;
        status = "okay";
 };
 
 &ecspi2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_ecspi2_1>;
+       pinctrl-0 = <&pinctrl_ecspi2>;
        fsl,spi-num-chipselects = <2>;
-       cs-gpios = <&gpio3 28 1>, <&gpio3 27 1>;
+       cs-gpios = <&gpio3 28 GPIO_ACTIVE_LOW>,
+                  <&gpio3 27 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
 
 &esdhc1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc1_1>;
-       cd-gpios = <&gpio2 29 0>;
+       pinctrl-0 = <&pinctrl_esdhc1>;
+       cd-gpios = <&gpio2 29 GPIO_ACTIVE_HIGH>;
        bus-width = <4>;
        status = "okay";
 };
 
 &esdhc2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc2_1>;
+       pinctrl-0 = <&pinctrl_esdhc2>;
        bus-width = <4>;
        non-removable;
        status = "okay";
 
 &i2c2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c2_2>;
+       pinctrl-0 = <&pinctrl_i2c2>;
        status = "okay";
 };
 
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx51-apf51dev {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX51_PAD_EIM_EB2__GPIO2_22   0x0C5
                                MX51_PAD_GPIO1_3__GPIO1_3    0x0C5
                        >;
                };
+
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <MX51_ECSPI1_PINGRP1>;
+               };
+
+               pinctrl_ecspi2: ecspi2grp {
+                       fsl,pins = <MX51_ECSPI2_PINGRP1>;
+               };
+
+               pinctrl_esdhc1: esdhc1grp {
+                       fsl,pins = <MX51_ESDHC1_PINGRP1>;
+               };
+
+               pinctrl_esdhc2: esdhc2grp {
+                       fsl,pins = <MX51_ESDHC2_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX51_I2C2_PINGRP2>;
+               };
+
+               pinctrl_ipu_disp1: ipudisp1grp {
+                       fsl,pins = <MX51_IPU_DISP1_PINGRP1>;
+               };
        };
 };
index be1407cf5abd1b1479e55fbfeac48be44dc90d4c..483178a4401795d235e2ed893a4977fc9a1dcb9a 100644 (file)
@@ -26,7 +26,7 @@
                crtcs = <&ipu 0>;
                interface-pix-fmt = "rgb24";
                pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_ipu_disp1_1>;
+               pinctrl-0 = <&pinctrl_ipu_disp1>;
                display-timings {
                        native-mode = <&timing0>;
                        timing0: dvi {
@@ -48,7 +48,7 @@
                crtcs = <&ipu 1>;
                interface-pix-fmt = "rgb565";
                pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_ipu_disp2_1>;
+               pinctrl-0 = <&pinctrl_ipu_disp2>;
                status = "disabled";
                display-timings {
                        native-mode = <&timing1>;
@@ -75,7 +75,7 @@
 
                power {
                        label = "Power Button";
-                       gpios = <&gpio2 21 0>;
+                       gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
                        linux,code = <116>; /* KEY_POWER */
                        gpio-key,wakeup;
                };
                        reg=<0>;
                        #clock-cells = <0>;
                        clock-frequency = <26000000>;
-                       gpios = <&gpio4 26 1>;
+                       gpios = <&gpio4 26 GPIO_ACTIVE_LOW>;
                };
        };
 };
 
 &esdhc1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc1_1>;
+       pinctrl-0 = <&pinctrl_esdhc1>;
        fsl,cd-controller;
        fsl,wp-controller;
        status = "okay";
 
 &esdhc2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc2_1>;
-       cd-gpios = <&gpio1 6 0>;
-       wp-gpios = <&gpio1 5 0>;
+       pinctrl-0 = <&pinctrl_esdhc2>;
+       cd-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
+       wp-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
        status = "okay";
 };
 
 &uart3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart3_1 &pinctrl_uart3_rtscts_1>;
+       pinctrl-0 = <&pinctrl_uart3 &pinctrl_uart3_rtscts>;
        fsl,uart-has-rtscts;
        status = "okay";
 };
 
 &ecspi1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_ecspi1_1>;
+       pinctrl-0 = <&pinctrl_ecspi1>;
        fsl,spi-num-chipselects = <2>;
-       cs-gpios = <&gpio4 24 0>, <&gpio4 25 0>;
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>,
+                  <&gpio4 25 GPIO_ACTIVE_LOW>;
        status = "okay";
 
        pmic: mc13892@0 {
                spi-cs-high;
                reg = <0>;
                interrupt-parent = <&gpio1>;
-               interrupts = <8 0x4>;
+               interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
 
                regulators {
                        sw1_reg: sw1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx51-babbage {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX51_PAD_GPIO1_0__SD1_CD     0x20d5
                                MX51_PAD_CSPI1_RDY__GPIO4_26 0x80000000
                        >;
                };
+
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX51_AUDMUX_PINGRP1>;
+               };
+
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <MX51_ECSPI1_PINGRP1>;
+               };
+
+               pinctrl_esdhc1: esdhc1grp {
+                       fsl,pins = <MX51_ESDHC1_PINGRP1>;
+               };
+
+               pinctrl_esdhc2: esdhc2grp {
+                       fsl,pins = <MX51_ESDHC2_PINGRP1>;
+               };
+
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <
+                               MX51_FEC_PINGRP1
+                               MX51_PAD_EIM_A20__GPIO2_14 0x85 /* Reset */
+                       >;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX51_I2C2_PINGRP1>;
+               };
+
+               pinctrl_ipu_disp1: ipudisp1grp {
+                       fsl,pins = <MX51_IPU_DISP1_PINGRP1>;
+               };
+
+               pinctrl_ipu_disp2: ipudisp2grp {
+                       fsl,pins = <MX51_IPU_DISP2_PINGRP1>;
+               };
+
+               pinctrl_kpp: kppgrp {
+                       fsl,pins = <MX51_KPP_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX51_UART1_PINGRP1>;
+               };
+
+               pinctrl_uart1_rtscts: uart1rtsctsgrp {
+                       fsl,pins = <MX51_UART1_RTSCTS_PINGRP1>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX51_UART2_PINGRP1>;
+               };
+
+               pinctrl_uart3: uart3grp {
+                       fsl,pins = <MX51_UART3_PINGRP1>;
+               };
+
+               pinctrl_uart3_rtscts: uart3rtsctsgrp {
+                       fsl,pins = <MX51_UART3_RTSCTS_PINGRP1>;
+               };
        };
 };
 
 &uart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart1_1 &pinctrl_uart1_rtscts_1>;
+       pinctrl-0 = <&pinctrl_uart1 &pinctrl_uart1_rtscts>;
        fsl,uart-has-rtscts;
        status = "okay";
 };
 
 &uart2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart2_1>;
+       pinctrl-0 = <&pinctrl_uart2>;
        status = "okay";
 };
 
 &i2c2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c2_1>;
+       pinctrl-0 = <&pinctrl_i2c2>;
        status = "okay";
 
        sgtl5000: codec@0a {
 
 &audmux {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_audmux_1>;
+       pinctrl-0 = <&pinctrl_audmux>;
        status = "okay";
 };
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_fec_1>;
+       pinctrl-0 = <&pinctrl_fec>;
        phy-mode = "mii";
+       phy-reset-gpios = <&gpio2 14 GPIO_ACTIVE_LOW>;
+       phy-reset-duration = <1>;
        status = "okay";
 };
 
 &kpp {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_kpp_1>;
+       pinctrl-0 = <&pinctrl_kpp>;
        linux,keymap = <0x00000067      /* KEY_UP */
                        0x0001006c      /* KEY_DOWN */
                        0x00020072      /* KEY_VOLUMEDOWN */
diff --git a/arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi b/arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi
new file mode 100644 (file)
index 0000000..b22841a
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.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 "imx51.dtsi"
+
+/ {
+       model = "Eukrea CPUIMX51";
+       compatible = "eukrea,cpuimx51", "fsl,imx51";
+
+       memory {
+               reg = <0x90000000 0x10000000>; /* 256M */
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec>;
+       status = "okay";
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       pcf8563@51 {
+               compatible = "nxp,pcf8563";
+               reg = <0x51>;
+       };
+};
+
+&iomuxc {
+       imx51-eukrea {
+               pinctrl_tsc2007_1: tsc2007grp-1 {
+                       fsl,pins = <
+                               MX51_PAD_GPIO_NAND__GPIO_NAND 0x1f5
+                               MX51_PAD_NANDF_D8__GPIO4_0 0x1f5
+                       >;
+               };
+
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <MX51_FEC_PINGRP2>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX51_I2C1_PINGRP1>;
+               };
+       };
+};
+
+&nfc {
+       nand-bus-width = <8>;
+       nand-ecc-mode = "hw";
+       nand-on-flash-bbt;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts b/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts
new file mode 100644 (file)
index 0000000..cf2e0d8
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2013 Eukréa Electromatique <denis@eukrea.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.
+ */
+
+/dts-v1/;
+#include "imx51-eukrea-cpuimx51.dtsi"
+
+/ {
+       model = "Eukrea CPUIMX51";
+       compatible = "eukrea,mbimxsd51","eukrea,cpuimx51", "fsl,imx51";
+
+       gpio_keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpiokeys_1>;
+
+               button-1 {
+                       label = "BP1";
+                       gpios = <&gpio3 31 GPIO_ACTIVE_LOW>;
+                       linux,code = <256>;
+                       gpio-key,wakeup;
+                       linux,input-type = <1>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpioled>;
+
+               led1 {
+                       label = "led1";
+                       gpios = <&gpio3 30 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
+};
+
+&esdhc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_esdhc1 &pinctrl_esdhc1_cd>;
+       fsl,cd-controller;
+       status = "okay";
+};
+
+&i2c1 {
+       tlv320aic23: codec@1a {
+               compatible = "ti,tlv320aic23";
+               reg = <0x1a>;
+       };
+};
+
+&iomuxc {
+       imx51-eukrea {
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX51_AUDMUX_PINGRP1>;
+               };
+
+               pinctrl_esdhc1: esdhc1grp {
+                       fsl,pins = <MX51_ESDHC1_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX51_UART1_PINGRP1>;
+               };
+
+               pinctrl_uart3: uart3grp {
+                       fsl,pins = <MX51_UART3_PINGRP2>;
+               };
+
+               pinctrl_uart3_rtscts: uart3rtsctsgrp {
+                       fsl,pins = <MX51_UART3_RTSCTS_PINGRP2>;
+               };
+
+               pinctrl_backlight_1: backlightgrp-1 {
+                       fsl,pins = <
+                               MX51_PAD_DI1_D1_CS__GPIO3_4 0x1f5
+                       >;
+               };
+
+               pinctrl_esdhc1_cd: esdhc1_cd {
+                       fsl,pins = <
+                               MX51_PAD_GPIO1_0__SD1_CD 0x20d5
+                       >;
+               };
+
+               pinctrl_gpiokeys_1: gpiokeysgrp-1 {
+                       fsl,pins = <
+                               MX51_PAD_NANDF_D9__GPIO3_31 0x1f5
+                       >;
+               };
+
+               pinctrl_gpioled: gpioledgrp-1 {
+                       fsl,pins = <
+                               MX51_PAD_NANDF_D10__GPIO3_30 0x80000000
+                       >;
+               };
+
+               pinctrl_reg_lcd_3v3: reg_lcd_3v3 {
+                       fsl,pins = <
+                               MX51_PAD_CSI1_D9__GPIO3_13 0x1f5
+                       >;
+               };
+       };
+};
+
+&ssi2 {
+       fsl,mode = "i2s-slave";
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       fsl,uart-has-rtscts;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3 &pinctrl_uart3_rtscts>;
+       fsl,uart-has-rtscts;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx51-pingrp.h b/arch/arm/boot/dts/imx51-pingrp.h
new file mode 100644 (file)
index 0000000..f63267b
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+ * Copyright (C) 2013 Freescale Semiconductor, 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.
+ *
+ */
+
+#ifndef __DTS_IMX51_PINGRP_H
+#define __DTS_IMX51_PINGRP_H
+
+#include "imx51-pinfunc.h"
+
+#define MX51_AUDMUX_PINGRP1 \
+       MX51_PAD_AUD3_BB_TXD__AUD3_TXD                  0x80000000 \
+       MX51_PAD_AUD3_BB_RXD__AUD3_RXD                  0x80000000 \
+       MX51_PAD_AUD3_BB_CK__AUD3_TXC                   0x80000000 \
+       MX51_PAD_AUD3_BB_FS__AUD3_TXFS                  0x80000000
+
+#define MX51_FEC_PINGRP1 \
+       MX51_PAD_EIM_EB2__FEC_MDIO                      0x80000000 \
+       MX51_PAD_EIM_EB3__FEC_RDATA1                    0x80000000 \
+       MX51_PAD_EIM_CS2__FEC_RDATA2                    0x80000000 \
+       MX51_PAD_EIM_CS3__FEC_RDATA3                    0x80000000 \
+       MX51_PAD_EIM_CS4__FEC_RX_ER                     0x80000000 \
+       MX51_PAD_EIM_CS5__FEC_CRS                       0x80000000 \
+       MX51_PAD_NANDF_RB2__FEC_COL                     0x80000000 \
+       MX51_PAD_NANDF_RB3__FEC_RX_CLK                  0x80000000 \
+       MX51_PAD_NANDF_D9__FEC_RDATA0                   0x80000000 \
+       MX51_PAD_NANDF_D8__FEC_TDATA0                   0x80000000 \
+       MX51_PAD_NANDF_CS2__FEC_TX_ER                   0x80000000 \
+       MX51_PAD_NANDF_CS3__FEC_MDC                     0x80000000 \
+       MX51_PAD_NANDF_CS4__FEC_TDATA1                  0x80000000 \
+       MX51_PAD_NANDF_CS5__FEC_TDATA2                  0x80000000 \
+       MX51_PAD_NANDF_CS6__FEC_TDATA3                  0x80000000 \
+       MX51_PAD_NANDF_CS7__FEC_TX_EN                   0x80000000 \
+       MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK              0x80000000
+
+#define MX51_FEC_PINGRP2 \
+       MX51_PAD_DI_GP3__FEC_TX_ER                      0x80000000 \
+       MX51_PAD_DI2_PIN4__FEC_CRS                      0x80000000 \
+       MX51_PAD_DI2_PIN2__FEC_MDC                      0x80000000 \
+       MX51_PAD_DI2_PIN3__FEC_MDIO                     0x80000000 \
+       MX51_PAD_DI2_DISP_CLK__FEC_RDATA1               0x80000000 \
+       MX51_PAD_DI_GP4__FEC_RDATA2                     0x80000000 \
+       MX51_PAD_DISP2_DAT0__FEC_RDATA3                 0x80000000 \
+       MX51_PAD_DISP2_DAT1__FEC_RX_ER                  0x80000000 \
+       MX51_PAD_DISP2_DAT6__FEC_TDATA1                 0x80000000 \
+       MX51_PAD_DISP2_DAT7__FEC_TDATA2                 0x80000000 \
+       MX51_PAD_DISP2_DAT8__FEC_TDATA3                 0x80000000 \
+       MX51_PAD_DISP2_DAT9__FEC_TX_EN                  0x80000000 \
+       MX51_PAD_DISP2_DAT10__FEC_COL                   0x80000000 \
+       MX51_PAD_DISP2_DAT11__FEC_RX_CLK                0x80000000 \
+       MX51_PAD_DISP2_DAT12__FEC_RX_DV                 0x80000000 \
+       MX51_PAD_DISP2_DAT13__FEC_TX_CLK                0x80000000 \
+       MX51_PAD_DISP2_DAT14__FEC_RDATA0                0x80000000 \
+       MX51_PAD_DISP2_DAT15__FEC_TDATA0                0x80000000
+
+#define MX51_ECSPI1_PINGRP1 \
+       MX51_PAD_CSPI1_MISO__ECSPI1_MISO                0x185 \
+       MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI                0x185 \
+       MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK                0x185
+
+#define MX51_ECSPI2_PINGRP1 \
+       MX51_PAD_NANDF_RB3__ECSPI2_MISO                 0x185 \
+       MX51_PAD_NANDF_D15__ECSPI2_MOSI                 0x185 \
+       MX51_PAD_NANDF_RB2__ECSPI2_SCLK                 0x185
+
+#define MX51_ESDHC1_PINGRP1 \
+       MX51_PAD_SD1_CMD__SD1_CMD                       0x400020d5 \
+       MX51_PAD_SD1_CLK__SD1_CLK                       0x20d5 \
+       MX51_PAD_SD1_DATA0__SD1_DATA0                   0x20d5 \
+       MX51_PAD_SD1_DATA1__SD1_DATA1                   0x20d5 \
+       MX51_PAD_SD1_DATA2__SD1_DATA2                   0x20d5 \
+       MX51_PAD_SD1_DATA3__SD1_DATA3                   0x20d5
+
+#define MX51_ESDHC2_PINGRP1 \
+       MX51_PAD_SD2_CMD__SD2_CMD                       0x400020d5 \
+       MX51_PAD_SD2_CLK__SD2_CLK                       0x20d5 \
+       MX51_PAD_SD2_DATA0__SD2_DATA0                   0x20d5 \
+       MX51_PAD_SD2_DATA1__SD2_DATA1                   0x20d5 \
+       MX51_PAD_SD2_DATA2__SD2_DATA2                   0x20d5 \
+       MX51_PAD_SD2_DATA3__SD2_DATA3                   0x20d5
+
+#define MX51_I2C1_PINGRP1 \
+       MX51_PAD_SD2_CMD__I2C1_SCL                      0x400001ed \
+       MX51_PAD_SD2_CLK__I2C1_SDA                      0x400001ed
+
+#define MX51_I2C2_PINGRP1 \
+       MX51_PAD_KEY_COL4__I2C2_SCL                     0x400001ed \
+       MX51_PAD_KEY_COL5__I2C2_SDA                     0x400001ed
+
+#define MX51_I2C2_PINGRP2 \
+       MX51_PAD_EIM_D27__I2C2_SCL                      0x400001ed \
+       MX51_PAD_EIM_D24__I2C2_SDA                      0x400001ed
+
+#define MX51_I2C2_PINGRP3 \
+       MX51_PAD_GPIO1_2__I2C2_SCL                      0x400001ed \
+       MX51_PAD_GPIO1_3__I2C2_SDA                      0x400001ed
+
+#define MX51_IPU_DISP1_PINGRP1 \
+       MX51_PAD_DISP1_DAT0__DISP1_DAT0                 0x5 \
+       MX51_PAD_DISP1_DAT1__DISP1_DAT1                 0x5 \
+       MX51_PAD_DISP1_DAT2__DISP1_DAT2                 0x5 \
+       MX51_PAD_DISP1_DAT3__DISP1_DAT3                 0x5 \
+       MX51_PAD_DISP1_DAT4__DISP1_DAT4                 0x5 \
+       MX51_PAD_DISP1_DAT5__DISP1_DAT5                 0x5 \
+       MX51_PAD_DISP1_DAT6__DISP1_DAT6                 0x5 \
+       MX51_PAD_DISP1_DAT7__DISP1_DAT7                 0x5 \
+       MX51_PAD_DISP1_DAT8__DISP1_DAT8                 0x5 \
+       MX51_PAD_DISP1_DAT9__DISP1_DAT9                 0x5 \
+       MX51_PAD_DISP1_DAT10__DISP1_DAT10               0x5 \
+       MX51_PAD_DISP1_DAT11__DISP1_DAT11               0x5 \
+       MX51_PAD_DISP1_DAT12__DISP1_DAT12               0x5 \
+       MX51_PAD_DISP1_DAT13__DISP1_DAT13               0x5 \
+       MX51_PAD_DISP1_DAT14__DISP1_DAT14               0x5 \
+       MX51_PAD_DISP1_DAT15__DISP1_DAT15               0x5 \
+       MX51_PAD_DISP1_DAT16__DISP1_DAT16               0x5 \
+       MX51_PAD_DISP1_DAT17__DISP1_DAT17               0x5 \
+       MX51_PAD_DISP1_DAT18__DISP1_DAT18               0x5 \
+       MX51_PAD_DISP1_DAT19__DISP1_DAT19               0x5 \
+       MX51_PAD_DISP1_DAT20__DISP1_DAT20               0x5 \
+       MX51_PAD_DISP1_DAT21__DISP1_DAT21               0x5 \
+       MX51_PAD_DISP1_DAT22__DISP1_DAT22               0x5 \
+       MX51_PAD_DISP1_DAT23__DISP1_DAT23               0x5 \
+       MX51_PAD_DI1_PIN2__DI1_PIN2                     0x5 \
+       MX51_PAD_DI1_PIN3__DI1_PIN3                     0x5
+
+#define MX51_IPU_DISP2_PINGRP1 \
+       MX51_PAD_DISP2_DAT0__DISP2_DAT0                 0x5 \
+       MX51_PAD_DISP2_DAT1__DISP2_DAT1                 0x5 \
+       MX51_PAD_DISP2_DAT2__DISP2_DAT2                 0x5 \
+       MX51_PAD_DISP2_DAT3__DISP2_DAT3                 0x5 \
+       MX51_PAD_DISP2_DAT4__DISP2_DAT4                 0x5 \
+       MX51_PAD_DISP2_DAT5__DISP2_DAT5                 0x5 \
+       MX51_PAD_DISP2_DAT6__DISP2_DAT6                 0x5 \
+       MX51_PAD_DISP2_DAT7__DISP2_DAT7                 0x5 \
+       MX51_PAD_DISP2_DAT8__DISP2_DAT8                 0x5 \
+       MX51_PAD_DISP2_DAT9__DISP2_DAT9                 0x5 \
+       MX51_PAD_DISP2_DAT10__DISP2_DAT10               0x5 \
+       MX51_PAD_DISP2_DAT11__DISP2_DAT11               0x5 \
+       MX51_PAD_DISP2_DAT12__DISP2_DAT12               0x5 \
+       MX51_PAD_DISP2_DAT13__DISP2_DAT13               0x5 \
+       MX51_PAD_DISP2_DAT14__DISP2_DAT14               0x5 \
+       MX51_PAD_DISP2_DAT15__DISP2_DAT15               0x5 \
+       MX51_PAD_DI2_PIN2__DI2_PIN2                     0x5 \
+       MX51_PAD_DI2_PIN3__DI2_PIN3                     0x5 \
+       MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK             0x5 \
+       MX51_PAD_DI_GP4__DI2_PIN15                      0x5
+
+#define MX51_KPP_PINGRP1 \
+       MX51_PAD_KEY_ROW0__KEY_ROW0                     0xe0 \
+       MX51_PAD_KEY_ROW1__KEY_ROW1                     0xe0 \
+       MX51_PAD_KEY_ROW2__KEY_ROW2                     0xe0 \
+       MX51_PAD_KEY_ROW3__KEY_ROW3                     0xe0 \
+       MX51_PAD_KEY_COL0__KEY_COL0                     0xe8 \
+       MX51_PAD_KEY_COL1__KEY_COL1                     0xe8 \
+       MX51_PAD_KEY_COL2__KEY_COL2                     0xe8 \
+       MX51_PAD_KEY_COL3__KEY_COL3                     0xe8
+
+#define MX51_PATA_PINGRP1 \
+       MX51_PAD_NANDF_WE_B__PATA_DIOW                  0x2004 \
+       MX51_PAD_NANDF_RE_B__PATA_DIOR                  0x2004 \
+       MX51_PAD_NANDF_ALE__PATA_BUFFER_EN              0x2004 \
+       MX51_PAD_NANDF_CLE__PATA_RESET_B                0x2004 \
+       MX51_PAD_NANDF_WP_B__PATA_DMACK                 0x2004 \
+       MX51_PAD_NANDF_RB0__PATA_DMARQ                  0x2004 \
+       MX51_PAD_NANDF_RB1__PATA_IORDY                  0x2004 \
+       MX51_PAD_GPIO_NAND__PATA_INTRQ                  0x2004 \
+       MX51_PAD_NANDF_CS2__PATA_CS_0                   0x2004 \
+       MX51_PAD_NANDF_CS3__PATA_CS_1                   0x2004 \
+       MX51_PAD_NANDF_CS4__PATA_DA_0                   0x2004 \
+       MX51_PAD_NANDF_CS5__PATA_DA_1                   0x2004 \
+       MX51_PAD_NANDF_CS6__PATA_DA_2                   0x2004 \
+       MX51_PAD_NANDF_D15__PATA_DATA15                 0x2004 \
+       MX51_PAD_NANDF_D14__PATA_DATA14                 0x2004 \
+       MX51_PAD_NANDF_D13__PATA_DATA13                 0x2004 \
+       MX51_PAD_NANDF_D12__PATA_DATA12                 0x2004 \
+       MX51_PAD_NANDF_D11__PATA_DATA11                 0x2004 \
+       MX51_PAD_NANDF_D10__PATA_DATA10                 0x2004 \
+       MX51_PAD_NANDF_D9__PATA_DATA9                   0x2004 \
+       MX51_PAD_NANDF_D8__PATA_DATA8                   0x2004 \
+       MX51_PAD_NANDF_D7__PATA_DATA7                   0x2004 \
+       MX51_PAD_NANDF_D6__PATA_DATA6                   0x2004 \
+       MX51_PAD_NANDF_D5__PATA_DATA5                   0x2004 \
+       MX51_PAD_NANDF_D4__PATA_DATA4                   0x2004 \
+       MX51_PAD_NANDF_D3__PATA_DATA3                   0x2004 \
+       MX51_PAD_NANDF_D2__PATA_DATA2                   0x2004 \
+       MX51_PAD_NANDF_D1__PATA_DATA1                   0x2004 \
+       MX51_PAD_NANDF_D0__PATA_DATA0                   0x2004
+
+#define MX51_UART1_PINGRP1 \
+       MX51_PAD_UART1_RXD__UART1_RXD                   0x1c5 \
+       MX51_PAD_UART1_TXD__UART1_TXD                   0x1c5
+
+#define MX51_UART1_RTSCTS_PINGRP1 \
+       MX51_PAD_UART1_RTS__UART1_RTS                   0x1c5 \
+       MX51_PAD_UART1_CTS__UART1_CTS                   0x1c5
+
+#define MX51_UART2_PINGRP1 \
+       MX51_PAD_UART2_RXD__UART2_RXD                   0x1c5 \
+       MX51_PAD_UART2_TXD__UART2_TXD                   0x1c5
+
+#define MX51_UART3_PINGRP1 \
+       MX51_PAD_EIM_D25__UART3_RXD                     0x1c5 \
+       MX51_PAD_EIM_D26__UART3_TXD                     0x1c5
+
+#define MX51_UART3_RTSCTS_PINGRP1 \
+       MX51_PAD_EIM_D27__UART3_RTS                     0x1c5 \
+       MX51_PAD_EIM_D24__UART3_CTS                     0x1c5
+
+#define MX51_UART3_PINGRP2 \
+       MX51_PAD_UART3_RXD__UART3_RXD                   0x1c5 \
+       MX51_PAD_UART3_TXD__UART3_TXD                   0x1c5
+
+#define MX51_UART3_RTSCTS_PINGRP2 \
+       MX51_PAD_KEY_COL4__UART3_RTS                    0x1c5 \
+       MX51_PAD_KEY_COL5__UART3_CTS                    0x1c5
+
+#define MX51_USBH1_PINGRP1 \
+       MX51_PAD_USBH1_DATA0__USBH1_DATA0               0x1e5 \
+       MX51_PAD_USBH1_DATA1__USBH1_DATA1               0x1e5 \
+       MX51_PAD_USBH1_DATA2__USBH1_DATA2               0x1e5 \
+       MX51_PAD_USBH1_DATA3__USBH1_DATA3               0x1e5 \
+       MX51_PAD_USBH1_DATA4__USBH1_DATA4               0x1e5 \
+       MX51_PAD_USBH1_DATA5__USBH1_DATA5               0x1e5 \
+       MX51_PAD_USBH1_DATA6__USBH1_DATA6               0x1e5 \
+       MX51_PAD_USBH1_DATA7__USBH1_DATA7               0x1e5 \
+       MX51_PAD_USBH1_CLK__USBH1_CLK                   0x1e5 \
+       MX51_PAD_USBH1_DIR__USBH1_DIR                   0x1e5 \
+       MX51_PAD_USBH1_NXT__USBH1_NXT                   0x1e5 \
+       MX51_PAD_USBH1_STP__USBH1_STP                   0x1e5
+
+#define MX51_USBH2_PINGRP1 \
+       MX51_PAD_EIM_D16__USBH2_DATA0                   0x1e5 \
+       MX51_PAD_EIM_D17__USBH2_DATA1                   0x1e5 \
+       MX51_PAD_EIM_D18__USBH2_DATA2                   0x1e5 \
+       MX51_PAD_EIM_D19__USBH2_DATA3                   0x1e5 \
+       MX51_PAD_EIM_D20__USBH2_DATA4                   0x1e5 \
+       MX51_PAD_EIM_D21__USBH2_DATA5                   0x1e5 \
+       MX51_PAD_EIM_D22__USBH2_DATA6                   0x1e5 \
+       MX51_PAD_EIM_D23__USBH2_DATA7                   0x1e5 \
+       MX51_PAD_EIM_A24__USBH2_CLK                     0x1e5 \
+       MX51_PAD_EIM_A25__USBH2_DIR                     0x1e5 \
+       MX51_PAD_EIM_A27__USBH2_NXT                     0x1e5 \
+       MX51_PAD_EIM_A26__USBH2_STP                     0x1e5
+
+#endif /* __DTS_IMX51_PINGRP_H */
index 4bcdd3ad15e524d95cb553b47fc6f61e5eef9a3a..61a2552747a322508caff97fa2d261f24b25b014 100644 (file)
  */
 
 #include "skeleton.dtsi"
-#include "imx51-pinfunc.h"
+#include "imx51-pingrp.h"
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/clock/imx5-clock.h>
+#include <dt-bindings/gpio/gpio.h>
 
 / {
        aliases {
        cpus {
                #address-cells = <1>;
                #size-cells = <0>;
-               cpu@0 {
+               cpu: cpu@0 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a8";
                        reg = <0>;
-                       clock-latency = <61036>; /* two CLK32 periods */
-                       clocks = <&clks 24>;
+                       clock-latency = <62500>;
+                       clocks = <&clks IMX5_CLK_CPU_PODF>;
                        clock-names = "cpu";
                        operating-points = <
-                               /* kHz  uV (No regulator support) */
-                               160000  0
-                               800000  0
+                               166000  1000000
+                               600000  1050000
+                               800000  1100000
                        >;
+                       voltage-tolerance = <5>;
+               };
+       };
+
+       usbphy {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "simple-bus";
+
+               usbphy0: usbphy@0 {
+                       compatible = "usb-nop-xceiv";
+                       reg = <0>;
+                       clocks = <&clks IMX5_CLK_USB_PHY_GATE>;
+                       clock-names = "main_clk";
                };
        };
 
                        compatible = "fsl,imx51-ipu";
                        reg = <0x40000000 0x20000000>;
                        interrupts = <11 10>;
-                       clocks = <&clks 59>, <&clks 110>, <&clks 61>;
+                       clocks = <&clks IMX5_CLK_IPU_GATE>,
+                                <&clks IMX5_CLK_IPU_DI0_GATE>,
+                                <&clks IMX5_CLK_IPU_DI1_GATE>;
                        clock-names = "bus", "di0", "di1";
                        resets = <&src 2>;
                };
                                        compatible = "fsl,imx51-esdhc";
                                        reg = <0x70004000 0x4000>;
                                        interrupts = <1>;
-                                       clocks = <&clks 44>, <&clks 0>, <&clks 71>;
+                                       clocks = <&clks IMX5_CLK_ESDHC1_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC1_PER_GATE>;
                                        clock-names = "ipg", "ahb", "per";
                                        status = "disabled";
                                };
                                        compatible = "fsl,imx51-esdhc";
                                        reg = <0x70008000 0x4000>;
                                        interrupts = <2>;
-                                       clocks = <&clks 45>, <&clks 0>, <&clks 72>;
+                                       clocks = <&clks IMX5_CLK_ESDHC2_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC2_PER_GATE>;
                                        clock-names = "ipg", "ahb", "per";
                                        bus-width = <4>;
                                        status = "disabled";
                                        compatible = "fsl,imx51-uart", "fsl,imx21-uart";
                                        reg = <0x7000c000 0x4000>;
                                        interrupts = <33>;
-                                       clocks = <&clks 32>, <&clks 33>;
+                                       clocks = <&clks IMX5_CLK_UART3_IPG_GATE>,
+                                                <&clks IMX5_CLK_UART3_PER_GATE>;
                                        clock-names = "ipg", "per";
                                        status = "disabled";
                                };
                                        compatible = "fsl,imx51-ecspi";
                                        reg = <0x70010000 0x4000>;
                                        interrupts = <36>;
-                                       clocks = <&clks 51>, <&clks 52>;
+                                       clocks = <&clks IMX5_CLK_ECSPI1_IPG_GATE>,
+                                                <&clks IMX5_CLK_ECSPI1_PER_GATE>;
                                        clock-names = "ipg", "per";
                                        status = "disabled";
                                };
                                        compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
                                        reg = <0x70014000 0x4000>;
                                        interrupts = <30>;
-                                       clocks = <&clks 49>;
-                                       dmas = <&sdma 24 1 0>,
-                                              <&sdma 25 1 0>;
+                                       clocks = <&clks IMX5_CLK_SSI2_IPG_GATE>;
+                                       dmas = <&sdma 24 22 0>,
+                                              <&sdma 25 22 0>;
                                        dma-names = "rx", "tx";
                                        fsl,fifo-depth = <15>;
                                        fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
                                        compatible = "fsl,imx51-esdhc";
                                        reg = <0x70020000 0x4000>;
                                        interrupts = <3>;
-                                       clocks = <&clks 46>, <&clks 0>, <&clks 73>;
+                                       clocks = <&clks IMX5_CLK_ESDHC3_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC3_PER_GATE>;
                                        clock-names = "ipg", "ahb", "per";
                                        bus-width = <4>;
                                        status = "disabled";
                                        compatible = "fsl,imx51-esdhc";
                                        reg = <0x70024000 0x4000>;
                                        interrupts = <4>;
-                                       clocks = <&clks 47>, <&clks 0>, <&clks 74>;
+                                       clocks = <&clks IMX5_CLK_ESDHC4_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC4_PER_GATE>;
                                        clock-names = "ipg", "ahb", "per";
                                        bus-width = <4>;
                                        status = "disabled";
                                };
                        };
 
-                       usbphy0: usbphy@0 {
-                               compatible = "usb-nop-xceiv";
-                               clocks = <&clks 75>;
-                               clock-names = "main_clk";
-                               status = "okay";
-                       };
-
                        usbotg: usb@73f80000 {
                                compatible = "fsl,imx51-usb", "fsl,imx27-usb";
                                reg = <0x73f80000 0x0200>;
                                interrupts = <18>;
-                               clocks = <&clks 108>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
                                fsl,usbmisc = <&usbmisc 0>;
                                fsl,usbphy = <&usbphy0>;
                                status = "disabled";
                                compatible = "fsl,imx51-usb", "fsl,imx27-usb";
                                reg = <0x73f80200 0x0200>;
                                interrupts = <14>;
-                               clocks = <&clks 108>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
                                fsl,usbmisc = <&usbmisc 1>;
                                status = "disabled";
                        };
                                compatible = "fsl,imx51-usb", "fsl,imx27-usb";
                                reg = <0x73f80400 0x0200>;
                                interrupts = <16>;
-                               clocks = <&clks 108>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
                                fsl,usbmisc = <&usbmisc 2>;
                                status = "disabled";
                        };
                                compatible = "fsl,imx51-usb", "fsl,imx27-usb";
                                reg = <0x73f80600 0x0200>;
                                interrupts = <17>;
-                               clocks = <&clks 108>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
                                fsl,usbmisc = <&usbmisc 3>;
                                status = "disabled";
                        };
                                #index-cells = <1>;
                                compatible = "fsl,imx51-usbmisc";
                                reg = <0x73f80800 0x200>;
-                               clocks = <&clks 108>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
                        };
 
                        gpio1: gpio@73f84000 {
                                compatible = "fsl,imx51-kpp", "fsl,imx21-kpp";
                                reg = <0x73f94000 0x4000>;
                                interrupts = <60>;
-                               clocks = <&clks 0>;
+                               clocks = <&clks IMX5_CLK_DUMMY>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx51-wdt", "fsl,imx21-wdt";
                                reg = <0x73f98000 0x4000>;
                                interrupts = <58>;
-                               clocks = <&clks 0>;
+                               clocks = <&clks IMX5_CLK_DUMMY>;
                        };
 
                        wdog2: wdog@73f9c000 {
                                compatible = "fsl,imx51-wdt", "fsl,imx21-wdt";
                                reg = <0x73f9c000 0x4000>;
                                interrupts = <59>;
-                               clocks = <&clks 0>;
+                               clocks = <&clks IMX5_CLK_DUMMY>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx51-gpt", "fsl,imx31-gpt";
                                reg = <0x73fa0000 0x4000>;
                                interrupts = <39>;
-                               clocks = <&clks 36>, <&clks 41>;
+                               clocks = <&clks IMX5_CLK_GPT_IPG_GATE>,
+                                        <&clks IMX5_CLK_GPT_HF_GATE>;
                                clock-names = "ipg", "per";
                        };
 
                                #pwm-cells = <2>;
                                compatible = "fsl,imx51-pwm", "fsl,imx27-pwm";
                                reg = <0x73fb4000 0x4000>;
-                               clocks = <&clks 37>, <&clks 38>;
+                               clocks = <&clks IMX5_CLK_PWM1_IPG_GATE>,
+                                        <&clks IMX5_CLK_PWM1_HF_GATE>;
                                clock-names = "ipg", "per";
                                interrupts = <61>;
                        };
                                #pwm-cells = <2>;
                                compatible = "fsl,imx51-pwm", "fsl,imx27-pwm";
                                reg = <0x73fb8000 0x4000>;
-                               clocks = <&clks 39>, <&clks 40>;
+                               clocks = <&clks IMX5_CLK_PWM2_IPG_GATE>,
+                                        <&clks IMX5_CLK_PWM2_HF_GATE>;
                                clock-names = "ipg", "per";
                                interrupts = <94>;
                        };
                                compatible = "fsl,imx51-uart", "fsl,imx21-uart";
                                reg = <0x73fbc000 0x4000>;
                                interrupts = <31>;
-                               clocks = <&clks 28>, <&clks 29>;
+                               clocks = <&clks IMX5_CLK_UART1_IPG_GATE>,
+                                        <&clks IMX5_CLK_UART1_PER_GATE>;
                                clock-names = "ipg", "per";
                                status = "disabled";
                        };
                                compatible = "fsl,imx51-uart", "fsl,imx21-uart";
                                reg = <0x73fc0000 0x4000>;
                                interrupts = <32>;
-                               clocks = <&clks 30>, <&clks 31>;
+                               clocks = <&clks IMX5_CLK_UART2_IPG_GATE>,
+                                        <&clks IMX5_CLK_UART2_PER_GATE>;
                                clock-names = "ipg", "per";
                                status = "disabled";
                        };
                                compatible = "fsl,imx51-iim", "fsl,imx27-iim";
                                reg = <0x83f98000 0x4000>;
                                interrupts = <69>;
-                               clocks = <&clks 107>;
+                               clocks = <&clks IMX5_CLK_IIM_GATE>;
                        };
 
                        owire: owire@83fa4000 {
                                compatible = "fsl,imx51-owire", "fsl,imx21-owire";
                                reg = <0x83fa4000 0x4000>;
                                interrupts = <88>;
-                               clocks = <&clks 159>;
+                               clocks = <&clks IMX5_CLK_OWIRE_GATE>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx51-ecspi";
                                reg = <0x83fac000 0x4000>;
                                interrupts = <37>;
-                               clocks = <&clks 53>, <&clks 54>;
+                               clocks = <&clks IMX5_CLK_ECSPI2_IPG_GATE>,
+                                        <&clks IMX5_CLK_ECSPI2_PER_GATE>;
                                clock-names = "ipg", "per";
                                status = "disabled";
                        };
                                compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
                                reg = <0x83fb0000 0x4000>;
                                interrupts = <6>;
-                               clocks = <&clks 56>, <&clks 56>;
+                               clocks = <&clks IMX5_CLK_SDMA_GATE>,
+                                        <&clks IMX5_CLK_SDMA_GATE>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                fsl,sdma-ram-script-name = "imx/sdma/sdma-imx51.bin";
                                compatible = "fsl,imx51-cspi", "fsl,imx35-cspi";
                                reg = <0x83fc0000 0x4000>;
                                interrupts = <38>;
-                               clocks = <&clks 55>, <&clks 55>;
+                               clocks = <&clks IMX5_CLK_CSPI_IPG_GATE>,
+                                        <&clks IMX5_CLK_CSPI_IPG_GATE>;
                                clock-names = "ipg", "per";
                                status = "disabled";
                        };
                                compatible = "fsl,imx51-i2c", "fsl,imx21-i2c";
                                reg = <0x83fc4000 0x4000>;
                                interrupts = <63>;
-                               clocks = <&clks 35>;
+                               clocks = <&clks IMX5_CLK_I2C2_GATE>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx51-i2c", "fsl,imx21-i2c";
                                reg = <0x83fc8000 0x4000>;
                                interrupts = <62>;
-                               clocks = <&clks 34>;
+                               clocks = <&clks IMX5_CLK_I2C1_GATE>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
                                reg = <0x83fcc000 0x4000>;
                                interrupts = <29>;
-                               clocks = <&clks 48>;
+                               clocks = <&clks IMX5_CLK_SSI1_IPG_GATE>;
                                dmas = <&sdma 28 0 0>,
                                       <&sdma 29 0 0>;
                                dma-names = "rx", "tx";
                        audmux: audmux@83fd0000 {
                                compatible = "fsl,imx51-audmux", "fsl,imx31-audmux";
                                reg = <0x83fd0000 0x4000>;
+                               clocks = <&clks IMX5_CLK_DUMMY>;
+                               clock-names = "audmux";
                                status = "disabled";
                        };
 
                                #size-cells = <1>;
                                compatible = "fsl,imx51-weim";
                                reg = <0x83fda000 0x1000>;
-                               clocks = <&clks 57>;
+                               clocks = <&clks IMX5_CLK_EMI_SLOW_GATE>;
                                ranges = <
                                        0 0 0xb0000000 0x08000000
                                        1 0 0xb8000000 0x08000000
                                compatible = "fsl,imx51-nand";
                                reg = <0x83fdb000 0x1000 0xcfff0000 0x10000>;
                                interrupts = <8>;
-                               clocks = <&clks 60>;
+                               clocks = <&clks IMX5_CLK_NFC_GATE>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx51-pata", "fsl,imx27-pata";
                                reg = <0x83fe0000 0x4000>;
                                interrupts = <70>;
-                               clocks = <&clks 172>;
+                               clocks = <&clks IMX5_CLK_PATA_GATE>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
                                reg = <0x83fe8000 0x4000>;
                                interrupts = <96>;
-                               clocks = <&clks 50>;
+                               clocks = <&clks IMX5_CLK_SSI3_IPG_GATE>;
                                dmas = <&sdma 46 0 0>,
                                       <&sdma 47 0 0>;
                                dma-names = "rx", "tx";
                                compatible = "fsl,imx51-fec", "fsl,imx27-fec";
                                reg = <0x83fec000 0x4000>;
                                interrupts = <87>;
-                               clocks = <&clks 42>, <&clks 42>, <&clks 42>;
+                               clocks = <&clks IMX5_CLK_FEC_GATE>,
+                                        <&clks IMX5_CLK_FEC_GATE>,
+                                        <&clks IMX5_CLK_FEC_GATE>;
                                clock-names = "ipg", "ahb", "ptp";
                                status = "disabled";
                        };
                };
        };
 };
-
-&iomuxc {
-       audmux {
-               pinctrl_audmux_1: audmuxgrp-1 {
-                       fsl,pins = <
-                               MX51_PAD_AUD3_BB_TXD__AUD3_TXD 0x80000000
-                               MX51_PAD_AUD3_BB_RXD__AUD3_RXD 0x80000000
-                               MX51_PAD_AUD3_BB_CK__AUD3_TXC  0x80000000
-                               MX51_PAD_AUD3_BB_FS__AUD3_TXFS 0x80000000
-                       >;
-               };
-       };
-
-       fec {
-               pinctrl_fec_1: fecgrp-1 {
-                       fsl,pins = <
-                               MX51_PAD_EIM_EB2__FEC_MDIO         0x80000000
-                               MX51_PAD_EIM_EB3__FEC_RDATA1       0x80000000
-                               MX51_PAD_EIM_CS2__FEC_RDATA2       0x80000000
-                               MX51_PAD_EIM_CS3__FEC_RDATA3       0x80000000
-                               MX51_PAD_EIM_CS4__FEC_RX_ER        0x80000000
-                               MX51_PAD_EIM_CS5__FEC_CRS          0x80000000
-                               MX51_PAD_NANDF_RB2__FEC_COL        0x80000000
-                               MX51_PAD_NANDF_RB3__FEC_RX_CLK     0x80000000
-                               MX51_PAD_NANDF_D9__FEC_RDATA0      0x80000000
-                               MX51_PAD_NANDF_D8__FEC_TDATA0      0x80000000
-                               MX51_PAD_NANDF_CS2__FEC_TX_ER      0x80000000
-                               MX51_PAD_NANDF_CS3__FEC_MDC        0x80000000
-                               MX51_PAD_NANDF_CS4__FEC_TDATA1     0x80000000
-                               MX51_PAD_NANDF_CS5__FEC_TDATA2     0x80000000
-                               MX51_PAD_NANDF_CS6__FEC_TDATA3     0x80000000
-                               MX51_PAD_NANDF_CS7__FEC_TX_EN      0x80000000
-                               MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK 0x80000000
-                       >;
-               };
-
-               pinctrl_fec_2: fecgrp-2 {
-                       fsl,pins = <
-                               MX51_PAD_DI_GP3__FEC_TX_ER        0x80000000
-                               MX51_PAD_DI2_PIN4__FEC_CRS        0x80000000
-                               MX51_PAD_DI2_PIN2__FEC_MDC        0x80000000
-                               MX51_PAD_DI2_PIN3__FEC_MDIO       0x80000000
-                               MX51_PAD_DI2_DISP_CLK__FEC_RDATA1 0x80000000
-                               MX51_PAD_DI_GP4__FEC_RDATA2       0x80000000
-                               MX51_PAD_DISP2_DAT0__FEC_RDATA3   0x80000000
-                               MX51_PAD_DISP2_DAT1__FEC_RX_ER    0x80000000
-                               MX51_PAD_DISP2_DAT6__FEC_TDATA1   0x80000000
-                               MX51_PAD_DISP2_DAT7__FEC_TDATA2   0x80000000
-                               MX51_PAD_DISP2_DAT8__FEC_TDATA3   0x80000000
-                               MX51_PAD_DISP2_DAT9__FEC_TX_EN    0x80000000
-                               MX51_PAD_DISP2_DAT10__FEC_COL     0x80000000
-                               MX51_PAD_DISP2_DAT11__FEC_RX_CLK  0x80000000
-                               MX51_PAD_DISP2_DAT12__FEC_RX_DV   0x80000000
-                               MX51_PAD_DISP2_DAT13__FEC_TX_CLK  0x80000000
-                               MX51_PAD_DISP2_DAT14__FEC_RDATA0  0x80000000
-                               MX51_PAD_DISP2_DAT15__FEC_TDATA0  0x80000000
-                       >;
-               };
-       };
-
-       ecspi1 {
-               pinctrl_ecspi1_1: ecspi1grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_CSPI1_MISO__ECSPI1_MISO 0x185
-                               MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI 0x185
-                               MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK 0x185
-                       >;
-               };
-       };
-
-       ecspi2 {
-               pinctrl_ecspi2_1: ecspi2grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_NANDF_RB3__ECSPI2_MISO 0x185
-                               MX51_PAD_NANDF_D15__ECSPI2_MOSI 0x185
-                               MX51_PAD_NANDF_RB2__ECSPI2_SCLK 0x185
-                       >;
-               };
-       };
-
-       esdhc1 {
-               pinctrl_esdhc1_1: esdhc1grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_SD1_CMD__SD1_CMD     0x400020d5
-                               MX51_PAD_SD1_CLK__SD1_CLK     0x20d5
-                               MX51_PAD_SD1_DATA0__SD1_DATA0 0x20d5
-                               MX51_PAD_SD1_DATA1__SD1_DATA1 0x20d5
-                               MX51_PAD_SD1_DATA2__SD1_DATA2 0x20d5
-                               MX51_PAD_SD1_DATA3__SD1_DATA3 0x20d5
-                       >;
-               };
-       };
-
-       esdhc2 {
-               pinctrl_esdhc2_1: esdhc2grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_SD2_CMD__SD2_CMD     0x400020d5
-                               MX51_PAD_SD2_CLK__SD2_CLK     0x20d5
-                               MX51_PAD_SD2_DATA0__SD2_DATA0 0x20d5
-                               MX51_PAD_SD2_DATA1__SD2_DATA1 0x20d5
-                               MX51_PAD_SD2_DATA2__SD2_DATA2 0x20d5
-                               MX51_PAD_SD2_DATA3__SD2_DATA3 0x20d5
-                       >;
-               };
-       };
-
-       i2c2 {
-               pinctrl_i2c2_1: i2c2grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_KEY_COL4__I2C2_SCL 0x400001ed
-                               MX51_PAD_KEY_COL5__I2C2_SDA 0x400001ed
-                       >;
-               };
-
-               pinctrl_i2c2_2: i2c2grp-2 {
-                       fsl,pins = <
-                               MX51_PAD_EIM_D27__I2C2_SCL 0x400001ed
-                               MX51_PAD_EIM_D24__I2C2_SDA 0x400001ed
-                       >;
-               };
-
-               pinctrl_i2c2_3: i2c2grp-3 {
-                       fsl,pins = <
-                               MX51_PAD_GPIO1_2__I2C2_SCL 0x400001ed
-                               MX51_PAD_GPIO1_3__I2C2_SDA 0x400001ed
-                       >;
-               };
-       };
-
-       ipu_disp1 {
-               pinctrl_ipu_disp1_1: ipudisp1grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_DISP1_DAT0__DISP1_DAT0   0x5
-                               MX51_PAD_DISP1_DAT1__DISP1_DAT1   0x5
-                               MX51_PAD_DISP1_DAT2__DISP1_DAT2   0x5
-                               MX51_PAD_DISP1_DAT3__DISP1_DAT3   0x5
-                               MX51_PAD_DISP1_DAT4__DISP1_DAT4   0x5
-                               MX51_PAD_DISP1_DAT5__DISP1_DAT5   0x5
-                               MX51_PAD_DISP1_DAT6__DISP1_DAT6   0x5
-                               MX51_PAD_DISP1_DAT7__DISP1_DAT7   0x5
-                               MX51_PAD_DISP1_DAT8__DISP1_DAT8   0x5
-                               MX51_PAD_DISP1_DAT9__DISP1_DAT9   0x5
-                               MX51_PAD_DISP1_DAT10__DISP1_DAT10 0x5
-                               MX51_PAD_DISP1_DAT11__DISP1_DAT11 0x5
-                               MX51_PAD_DISP1_DAT12__DISP1_DAT12 0x5
-                               MX51_PAD_DISP1_DAT13__DISP1_DAT13 0x5
-                               MX51_PAD_DISP1_DAT14__DISP1_DAT14 0x5
-                               MX51_PAD_DISP1_DAT15__DISP1_DAT15 0x5
-                               MX51_PAD_DISP1_DAT16__DISP1_DAT16 0x5
-                               MX51_PAD_DISP1_DAT17__DISP1_DAT17 0x5
-                               MX51_PAD_DISP1_DAT18__DISP1_DAT18 0x5
-                               MX51_PAD_DISP1_DAT19__DISP1_DAT19 0x5
-                               MX51_PAD_DISP1_DAT20__DISP1_DAT20 0x5
-                               MX51_PAD_DISP1_DAT21__DISP1_DAT21 0x5
-                               MX51_PAD_DISP1_DAT22__DISP1_DAT22 0x5
-                               MX51_PAD_DISP1_DAT23__DISP1_DAT23 0x5
-                               MX51_PAD_DI1_PIN2__DI1_PIN2       0x5 /* hsync */
-                               MX51_PAD_DI1_PIN3__DI1_PIN3       0x5 /* vsync */
-                       >;
-               };
-       };
-
-       ipu_disp2 {
-               pinctrl_ipu_disp2_1: ipudisp2grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_DISP2_DAT0__DISP2_DAT0     0x5
-                               MX51_PAD_DISP2_DAT1__DISP2_DAT1     0x5
-                               MX51_PAD_DISP2_DAT2__DISP2_DAT2     0x5
-                               MX51_PAD_DISP2_DAT3__DISP2_DAT3     0x5
-                               MX51_PAD_DISP2_DAT4__DISP2_DAT4     0x5
-                               MX51_PAD_DISP2_DAT5__DISP2_DAT5     0x5
-                               MX51_PAD_DISP2_DAT6__DISP2_DAT6     0x5
-                               MX51_PAD_DISP2_DAT7__DISP2_DAT7     0x5
-                               MX51_PAD_DISP2_DAT8__DISP2_DAT8     0x5
-                               MX51_PAD_DISP2_DAT9__DISP2_DAT9     0x5
-                               MX51_PAD_DISP2_DAT10__DISP2_DAT10   0x5
-                               MX51_PAD_DISP2_DAT11__DISP2_DAT11   0x5
-                               MX51_PAD_DISP2_DAT12__DISP2_DAT12   0x5
-                               MX51_PAD_DISP2_DAT13__DISP2_DAT13   0x5
-                               MX51_PAD_DISP2_DAT14__DISP2_DAT14   0x5
-                               MX51_PAD_DISP2_DAT15__DISP2_DAT15   0x5
-                               MX51_PAD_DI2_PIN2__DI2_PIN2         0x5 /* hsync */
-                               MX51_PAD_DI2_PIN3__DI2_PIN3         0x5 /* vsync */
-                               MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK 0x5 /* CLK */
-                               MX51_PAD_DI_GP4__DI2_PIN15          0x5 /* DE */
-                       >;
-               };
-       };
-
-       kpp {
-               pinctrl_kpp_1: kppgrp-1 {
-                       fsl,pins = <
-                               MX51_PAD_KEY_ROW0__KEY_ROW0 0xe0
-                               MX51_PAD_KEY_ROW1__KEY_ROW1 0xe0
-                               MX51_PAD_KEY_ROW2__KEY_ROW2 0xe0
-                               MX51_PAD_KEY_ROW3__KEY_ROW3 0xe0
-                               MX51_PAD_KEY_COL0__KEY_COL0 0xe8
-                               MX51_PAD_KEY_COL1__KEY_COL1 0xe8
-                               MX51_PAD_KEY_COL2__KEY_COL2 0xe8
-                               MX51_PAD_KEY_COL3__KEY_COL3 0xe8
-                       >;
-               };
-       };
-
-       pata {
-               pinctrl_pata_1: patagrp-1 {
-                       fsl,pins = <
-                               MX51_PAD_NANDF_WE_B__PATA_DIOW     0x2004
-                               MX51_PAD_NANDF_RE_B__PATA_DIOR     0x2004
-                               MX51_PAD_NANDF_ALE__PATA_BUFFER_EN 0x2004
-                               MX51_PAD_NANDF_CLE__PATA_RESET_B   0x2004
-                               MX51_PAD_NANDF_WP_B__PATA_DMACK    0x2004
-                               MX51_PAD_NANDF_RB0__PATA_DMARQ     0x2004
-                               MX51_PAD_NANDF_RB1__PATA_IORDY     0x2004
-                               MX51_PAD_GPIO_NAND__PATA_INTRQ     0x2004
-                               MX51_PAD_NANDF_CS2__PATA_CS_0      0x2004
-                               MX51_PAD_NANDF_CS3__PATA_CS_1      0x2004
-                               MX51_PAD_NANDF_CS4__PATA_DA_0      0x2004
-                               MX51_PAD_NANDF_CS5__PATA_DA_1      0x2004
-                               MX51_PAD_NANDF_CS6__PATA_DA_2      0x2004
-                               MX51_PAD_NANDF_D15__PATA_DATA15    0x2004
-                               MX51_PAD_NANDF_D14__PATA_DATA14    0x2004
-                               MX51_PAD_NANDF_D13__PATA_DATA13    0x2004
-                               MX51_PAD_NANDF_D12__PATA_DATA12    0x2004
-                               MX51_PAD_NANDF_D11__PATA_DATA11    0x2004
-                               MX51_PAD_NANDF_D10__PATA_DATA10    0x2004
-                               MX51_PAD_NANDF_D9__PATA_DATA9      0x2004
-                               MX51_PAD_NANDF_D8__PATA_DATA8      0x2004
-                               MX51_PAD_NANDF_D7__PATA_DATA7      0x2004
-                               MX51_PAD_NANDF_D6__PATA_DATA6     0x2004
-                               MX51_PAD_NANDF_D5__PATA_DATA5     0x2004
-                               MX51_PAD_NANDF_D4__PATA_DATA4     0x2004
-                               MX51_PAD_NANDF_D3__PATA_DATA3     0x2004
-                               MX51_PAD_NANDF_D2__PATA_DATA2     0x2004
-                               MX51_PAD_NANDF_D1__PATA_DATA1     0x2004
-                               MX51_PAD_NANDF_D0__PATA_DATA0     0x2004
-                       >;
-               };
-       };
-
-       uart1 {
-               pinctrl_uart1_1: uart1grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_UART1_RXD__UART1_RXD 0x1c5
-                               MX51_PAD_UART1_TXD__UART1_TXD 0x1c5
-                       >;
-               };
-
-               pinctrl_uart1_rtscts_1: uart1rtscts-1 {
-                       fsl,pins = <
-                               MX51_PAD_UART1_RTS__UART1_RTS 0x1c5
-                               MX51_PAD_UART1_CTS__UART1_CTS 0x1c5
-                       >;
-               };
-       };
-
-       uart2 {
-               pinctrl_uart2_1: uart2grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_UART2_RXD__UART2_RXD 0x1c5
-                               MX51_PAD_UART2_TXD__UART2_TXD 0x1c5
-                       >;
-               };
-       };
-
-       uart3 {
-               pinctrl_uart3_1: uart3grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_EIM_D25__UART3_RXD 0x1c5
-                               MX51_PAD_EIM_D26__UART3_TXD 0x1c5
-                       >;
-               };
-
-               pinctrl_uart3_rtscts_1: uart3rtscts-1 {
-                       fsl,pins = <
-                               MX51_PAD_EIM_D27__UART3_RTS 0x1c5
-                               MX51_PAD_EIM_D24__UART3_CTS 0x1c5
-                       >;
-               };
-
-               pinctrl_uart3_2: uart3grp-2 {
-                       fsl,pins = <
-                               MX51_PAD_UART3_RXD__UART3_RXD 0x1c5
-                               MX51_PAD_UART3_TXD__UART3_TXD 0x1c5
-                       >;
-               };
-       };
-
-       usbh1 {
-               pinctrl_usbh1_1: usbh1grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_USBH1_DATA0__USBH1_DATA0 0x1e5
-                               MX51_PAD_USBH1_DATA1__USBH1_DATA1 0x1e5
-                               MX51_PAD_USBH1_DATA2__USBH1_DATA2 0x1e5
-                               MX51_PAD_USBH1_DATA3__USBH1_DATA3 0x1e5
-                               MX51_PAD_USBH1_DATA4__USBH1_DATA4 0x1e5
-                               MX51_PAD_USBH1_DATA5__USBH1_DATA5 0x1e5
-                               MX51_PAD_USBH1_DATA6__USBH1_DATA6 0x1e5
-                               MX51_PAD_USBH1_DATA7__USBH1_DATA7 0x1e5
-                               MX51_PAD_USBH1_CLK__USBH1_CLK     0x1e5
-                               MX51_PAD_USBH1_DIR__USBH1_DIR     0x1e5
-                               MX51_PAD_USBH1_NXT__USBH1_NXT     0x1e5
-                               MX51_PAD_USBH1_STP__USBH1_STP     0x1e5
-                       >;
-               };
-       };
-
-       usbh2 {
-               pinctrl_usbh2_1: usbh2grp-1 {
-                       fsl,pins = <
-                               MX51_PAD_EIM_D16__USBH2_DATA0 0x1e5
-                               MX51_PAD_EIM_D17__USBH2_DATA1 0x1e5
-                               MX51_PAD_EIM_D18__USBH2_DATA2 0x1e5
-                               MX51_PAD_EIM_D19__USBH2_DATA3 0x1e5
-                               MX51_PAD_EIM_D20__USBH2_DATA4 0x1e5
-                               MX51_PAD_EIM_D21__USBH2_DATA5 0x1e5
-                               MX51_PAD_EIM_D22__USBH2_DATA6 0x1e5
-                               MX51_PAD_EIM_D23__USBH2_DATA7 0x1e5
-                               MX51_PAD_EIM_A24__USBH2_CLK   0x1e5
-                               MX51_PAD_EIM_A25__USBH2_DIR   0x1e5
-                               MX51_PAD_EIM_A27__USBH2_NXT   0x1e5
-                               MX51_PAD_EIM_A26__USBH2_STP   0x1e5
-                       >;
-               };
-       };
-};
index 174f86938c89c6917b0eccfa13b799cb9c8917ec..2bd97c3783a9f2ec36d96232ce02eaa7895a80ee 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_3p3v: 3p3v {
+               reg_3p3v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "3P3V";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
 
 &esdhc1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc1_2>;
+       pinctrl-0 = <&pinctrl_esdhc1>;
        cd-gpios = <&gpio1 1 0>;
        wp-gpios = <&gpio1 9 0>;
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx53-ard {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX53_PAD_GPIO_1__GPIO1_1             0x80000000
                                MX53_PAD_EIM_CS1__EMI_WEIM_CS_1      0x80000000
                        >;
                };
+
+               pinctrl_esdhc1: esdhc1grp {
+                       fsl,pins = <MX53_ESDHC1_PINGRP2>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX53_UART1_PINGRP2>;
+               };
        };
 };
 
 &uart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart1_2>;
+       pinctrl-0 = <&pinctrl_uart1>;
        status = "okay";
 };
index 801fda728ed68528049d08a5f860e5d428121db1..214ac2e1802a779373607aabd04ac765fce4d610 100644 (file)
@@ -34,7 +34,7 @@
 
 &esdhc1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc1_1>;
+       pinctrl-0 = <&pinctrl_esdhc1>;
        cd-gpios = <&gpio3 13 0>;
        wp-gpios = <&gpio3 14 0>;
        status = "okay";
@@ -42,7 +42,7 @@
 
 &ecspi1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_ecspi1_1>;
+       pinctrl-0 = <&pinctrl_ecspi1>;
        fsl,spi-num-chipselects = <2>;
        cs-gpios = <&gpio2 30 0>, <&gpio3 19 0>;
        status = "okay";
@@ -69,7 +69,7 @@
 
 &esdhc3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc3_1>;
+       pinctrl-0 = <&pinctrl_esdhc3>;
        cd-gpios = <&gpio3 11 0>;
        wp-gpios = <&gpio3 12 0>;
        status = "okay";
@@ -79,7 +79,7 @@
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx53-evk {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX53_PAD_EIM_EB2__GPIO2_30  0x80000000
                                MX53_PAD_PATA_DA_1__GPIO7_7 0x80000000
                        >;
                };
+
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <MX53_ECSPI1_PINGRP1>;
+               };
+
+               pinctrl_esdhc1: esdhc1grp {
+                       fsl,pins = <MX53_ESDHC1_PINGRP1>;
+               };
+
+               pinctrl_esdhc3: esdhc3grp {
+                       fsl,pins = <MX53_ESDHC3_PINGRP1>;
+               };
+
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <MX53_FEC_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX53_I2C2_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX53_UART1_PINGRP1>;
+               };
        };
 };
 
 &uart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart1_1>;
+       pinctrl-0 = <&pinctrl_uart1>;
        status = "okay";
 };
 
 &i2c2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c2_1>;
+       pinctrl-0 = <&pinctrl_i2c2>;
        status = "okay";
 
        pmic: mc13892@08 {
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_fec_1>;
+       pinctrl-0 = <&pinctrl_fec>;
        phy-mode = "rmii";
        phy-reset-gpios = <&gpio7 6 0>;
        status = "okay";
index 7d304d02ed384e744c4789e3329ccdd80e103ac6..c623774ba3864fd3558c2f67bc2657784c33d144 100644 (file)
@@ -26,7 +26,7 @@
                        crtcs = <&ipu 1>;
                        interface-pix-fmt = "bgr666";
                        pinctrl-names = "default";
-                       pinctrl-0 = <&pinctrl_ipu_disp2_1>;
+                       pinctrl-0 = <&pinctrl_ipu_disp1>;
 
                        display-timings {
                                800x480p60 {
@@ -51,6 +51,7 @@
                pwms = <&pwm1 0 3000>;
                brightness-levels = <0 4 8 16 32 64 128 255>;
                default-brightness-level = <6>;
+               power-supply = <&reg_backlight>;
        };
 
        leds {
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_3p2v: 3p2v {
+               reg_3p2v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "3P2V";
                        regulator-min-microvolt = <3200000>;
                        regulator-max-microvolt = <3200000>;
                        regulator-always-on;
                };
+
+
+               reg_backlight: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "lcd-supply";
+                       regulator-min-microvolt = <3200000>;
+                       regulator-max-microvolt = <3200000>;
+                       regulator-always-on;
+               };
+
+               reg_usbh1_vbus: regulator@3 {
+                       compatible = "regulator-fixed";
+                       reg = <3>;
+                       regulator-name = "vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio1 2 0>;
+                       enable-active-low;
+               };
        };
 
        sound {
 
 &audmux {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_audmux_2>;
+       pinctrl-0 = <&pinctrl_audmux>;
        status = "okay";
 };
 
 &can1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_can1_3>;
+       pinctrl-0 = <&pinctrl_can1>;
        status = "okay";
 };
 
 &can2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_can2_1>;
+       pinctrl-0 = <&pinctrl_can2>;
        status = "okay";
 };
 
 &esdhc1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc1_1>;
+       pinctrl-0 = <&pinctrl_esdhc1>;
        cd-gpios = <&gpio1 1 0>;
        wp-gpios = <&gpio1 9 0>;
        status = "okay";
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_fec_1>;
+       pinctrl-0 = <&pinctrl_fec>;
        phy-mode = "rmii";
        status = "okay";
 };
 
 &i2c1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c1_2>;
+       pinctrl-0 = <&pinctrl_i2c1>;
        status = "okay";
 
        sgtl5000: codec@0a {
                reg = <0x0a>;
                VDDA-supply = <&reg_3p2v>;
                VDDIO-supply = <&reg_3p2v>;
-               clocks = <&clks 150>;
+               clocks = <&clks IMX5_CLK_SSI_EXT1_GATE>;
        };
 };
 
 &i2c2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c2_2>;
+       pinctrl-0 = <&pinctrl_i2c2>;
        clock-frequency = <400000>;
        status = "okay";
 
 
 &i2c3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c3_1>;
+       pinctrl-0 = <&pinctrl_i2c3>;
        status = "okay";
 };
 
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx53-m53evk {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK       0x80000000
                                MX53_PAD_EIM_EB3__GPIO2_31              0x80000000
                                MX53_PAD_PATA_DA_0__GPIO7_6             0x80000000
-                               MX53_PAD_DISP0_DAT8__PWM1_PWMO          0x5
-
+                               MX53_PAD_GPIO_2__GPIO1_2                0x80000000
+                               MX53_PAD_GPIO_3__USBOH3_USBH1_OC        0x80000000
                        >;
                };
 
                                MX53_PAD_PATA_DATA9__GPIO2_9            0x80000000
                        >;
                };
+
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX53_AUDMUX_PINGRP2>;
+               };
+
+               pinctrl_can1: can1grp {
+                       fsl,pins = <MX53_CAN1_PINGRP3>;
+               };
+
+               pinctrl_can2: can2grp {
+                       fsl,pins = <MX53_CAN2_PINGRP1>;
+               };
+
+               pinctrl_esdhc1: esdhc1grp {
+                       fsl,pins = <MX53_ESDHC1_PINGRP1>;
+               };
+
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <MX53_FEC_PINGRP1>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX53_I2C1_PINGRP2>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX53_I2C2_PINGRP2>;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <MX53_I2C3_PINGRP1>;
+               };
+
+               pinctrl_ipu_disp1: ipudisp1grp {
+                       fsl,pins = <MX53_IPU_DISP1_PINGRP1>;
+               };
+
+               pinctrl_nand: nandgrp {
+                       fsl,pins = <MX53_NAND_PINGRP1>;
+               };
+
+               pinctrl_pwm1: pwm1grp {
+                       fsl,pins = <MX53_PWM1_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX53_UART1_PINGRP2>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX53_UART2_PINGRP1>;
+               };
+
+               pinctrl_uart3: uart3grp {
+                       fsl,pins = <MX53_UART3_PINGRP1>;
+               };
        };
 };
 
 &nfc {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_nand_1>;
+       pinctrl-0 = <&pinctrl_nand>;
        nand-bus-width = <8>;
        nand-ecc-mode = "hw";
        status = "okay";
 
 &pwm1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_pwm1_1>;
+       pinctrl-0 = <&pinctrl_pwm1>;
+       status = "okay";
+};
+
+&sata {
        status = "okay";
 };
 
 
 &uart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart1_2>;
+       pinctrl-0 = <&pinctrl_uart1>;
        status = "okay";
 };
 
 &uart2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart2_1>;
+       pinctrl-0 = <&pinctrl_uart2>;
        status = "okay";
 };
 
 &uart3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart3_1>;
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usbh1_vbus>;
+       phy_type = "utmi";
+       status = "okay";
+};
+
+&usbotg {
+       dr_mode = "peripheral";
        status = "okay";
 };
index a630902679410f9a4f356ab430a3199bf3ac852b..0358366c5a175ec4d9a955d29820c88bebe6c8d5 100644 (file)
        model = "TQ MBa53 starter kit";
        compatible = "tq,mba53", "tq,tqma53", "fsl,imx53";
 
-       reg_backlight: fixed@0 {
-               compatible = "regulator-fixed";
-               regulator-name = "lcd-supply";
-               gpio = <&gpio2 5 0>;
-               startup-delay-us = <5000>;
-               enable-active-low;
-       };
-
        backlight {
                compatible = "pwm-backlight";
                pwms = <&pwm2 0 50000>;
                status = "disabled";
        };
 
-       reg_3p2v: 3p2v {
-               compatible = "regulator-fixed";
-               regulator-name = "3P2V";
-               regulator-min-microvolt = <3200000>;
-               regulator-max-microvolt = <3200000>;
-               regulator-always-on;
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_backlight: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "lcd-supply";
+                       gpio = <&gpio2 5 0>;
+                       startup-delay-us = <5000>;
+                       enable-active-low;
+               };
+
+               reg_3p2v: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "3P2V";
+                       regulator-min-microvolt = <3200000>;
+                       regulator-max-microvolt = <3200000>;
+                       regulator-always-on;
+               };
        };
 
        sound {
 &audmux {
        status = "okay";
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_audmux_1>;
+       pinctrl-0 = <&pinctrl_audmux>;
 };
 
 &i2c2 {
        codec: sgtl5000@a {
                compatible = "fsl,sgtl5000";
                reg = <0x0a>;
-               clocks = <&clks 150>;
+               clocks = <&clks IMX5_CLK_SSI_EXT1_GATE>;
                VDDA-supply = <&reg_3p2v>;
                VDDIO-supply = <&reg_3p2v>;
        };
diff --git a/arch/arm/boot/dts/imx53-pingrp.h b/arch/arm/boot/dts/imx53-pingrp.h
new file mode 100644 (file)
index 0000000..ac8e73d
--- /dev/null
@@ -0,0 +1,352 @@
+/*
+ * Copyright (C) 2013 Freescale Semiconductor, 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.
+ *
+ */
+
+#ifndef __DTS_IMX53_PINGRP_H
+#define __DTS_IMX53_PINGRP_H
+
+#include "imx53-pinfunc.h"
+
+#define MX53_AUDMUX_PINGRP1 \
+       MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC              0x80000000 \
+       MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD              0x80000000 \
+       MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS             0x80000000 \
+       MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD              0x80000000
+
+#define MX53_AUDMUX_PINGRP2 \
+       MX53_PAD_SD2_DATA3__AUDMUX_AUD4_TXC             0x80000000 \
+       MX53_PAD_SD2_DATA2__AUDMUX_AUD4_TXD             0x80000000 \
+       MX53_PAD_SD2_DATA1__AUDMUX_AUD4_TXFS            0x80000000 \
+       MX53_PAD_SD2_DATA0__AUDMUX_AUD4_RXD             0x80000000
+
+#define MX53_AUDMUX_PINGRP3 \
+       MX53_PAD_CSI0_DAT4__AUDMUX_AUD3_TXC             0x80000000 \
+       MX53_PAD_CSI0_DAT5__AUDMUX_AUD3_TXD             0x80000000 \
+       MX53_PAD_CSI0_DAT6__AUDMUX_AUD3_TXFS            0x80000000 \
+       MX53_PAD_CSI0_DAT7__AUDMUX_AUD3_RXD             0x80000000
+
+#define MX53_CAN1_PINGRP1 \
+       MX53_PAD_PATA_INTRQ__CAN1_TXCAN                 0x80000000 \
+       MX53_PAD_PATA_DIOR__CAN1_RXCAN                  0x80000000
+
+#define MX53_CAN1_PINGRP2 \
+       MX53_PAD_KEY_COL2__CAN1_TXCAN                   0x80000000 \
+       MX53_PAD_KEY_ROW2__CAN1_RXCAN                   0x80000000
+
+#define MX53_CAN1_PINGRP3 \
+       MX53_PAD_GPIO_7__CAN1_TXCAN                     0x80000000 \
+       MX53_PAD_GPIO_8__CAN1_RXCAN                     0x80000000
+
+#define MX53_CAN2_PINGRP1 \
+       MX53_PAD_KEY_COL4__CAN2_TXCAN                   0x80000000 \
+       MX53_PAD_KEY_ROW4__CAN2_RXCAN                   0x80000000
+
+
+#define MX53_CSI_PINGRP1 \
+       MX53_PAD_CSI0_DATA_EN__IPU_CSI0_DATA_EN         0x1d5 \
+       MX53_PAD_CSI0_VSYNC__IPU_CSI0_VSYNC             0x1d5 \
+       MX53_PAD_CSI0_MCLK__IPU_CSI0_HSYNC              0x1d5 \
+       MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK           0x1d5 \
+       MX53_PAD_CSI0_DAT19__IPU_CSI0_D_19              0x1d5 \
+       MX53_PAD_CSI0_DAT18__IPU_CSI0_D_18              0x1d5 \
+       MX53_PAD_CSI0_DAT17__IPU_CSI0_D_17              0x1d5 \
+       MX53_PAD_CSI0_DAT16__IPU_CSI0_D_16              0x1d5 \
+       MX53_PAD_CSI0_DAT15__IPU_CSI0_D_15              0x1d5 \
+       MX53_PAD_CSI0_DAT14__IPU_CSI0_D_14              0x1d5 \
+       MX53_PAD_CSI0_DAT13__IPU_CSI0_D_13              0x1d5 \
+       MX53_PAD_CSI0_DAT12__IPU_CSI0_D_12              0x1d5 \
+       MX53_PAD_CSI0_DAT11__IPU_CSI0_D_11              0x1d5 \
+       MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10              0x1d5 \
+       MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9                0x1d5 \
+       MX53_PAD_CSI0_DAT8__IPU_CSI0_D_8                0x1d5 \
+       MX53_PAD_CSI0_DAT7__IPU_CSI0_D_7                0x1d5 \
+       MX53_PAD_CSI0_DAT6__IPU_CSI0_D_6                0x1d5 \
+       MX53_PAD_CSI0_DAT5__IPU_CSI0_D_5                0x1d5 \
+       MX53_PAD_CSI0_DAT4__IPU_CSI0_D_4                0x1d5 \
+       MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK           0x1d5
+
+#define MX53_CSI_PINGRP2 \
+       MX53_PAD_CSI0_VSYNC__IPU_CSI0_VSYNC             0x1d5 \
+       MX53_PAD_CSI0_MCLK__IPU_CSI0_HSYNC              0x1d5 \
+       MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK           0x1d5 \
+       MX53_PAD_CSI0_DAT19__IPU_CSI0_D_19              0x1d5 \
+       MX53_PAD_CSI0_DAT18__IPU_CSI0_D_18              0x1d5 \
+       MX53_PAD_CSI0_DAT17__IPU_CSI0_D_17              0x1d5 \
+       MX53_PAD_CSI0_DAT16__IPU_CSI0_D_16              0x1d5 \
+       MX53_PAD_CSI0_DAT15__IPU_CSI0_D_15              0x1d5 \
+       MX53_PAD_CSI0_DAT14__IPU_CSI0_D_14              0x1d5 \
+       MX53_PAD_CSI0_DAT13__IPU_CSI0_D_13              0x1d5 \
+       MX53_PAD_CSI0_DAT12__IPU_CSI0_D_12              0x1d5
+
+#define MX53_CSPI_PINGRP1 \
+       MX53_PAD_SD1_DATA0__CSPI_MISO                   0x1d5 \
+       MX53_PAD_SD1_CMD__CSPI_MOSI                     0x1d5 \
+       MX53_PAD_SD1_CLK__CSPI_SCLK                     0x1d5
+
+#define MX53_CSPI_PINGRP2 \
+       MX53_PAD_EIM_D22__CSPI_MISO                     0x1d5 \
+       MX53_PAD_EIM_D28__CSPI_MOSI                     0x1d5 \
+       MX53_PAD_EIM_D21__CSPI_SCLK                     0x1d5
+
+#define MX53_ECSPI1_PINGRP1 \
+       MX53_PAD_EIM_D16__ECSPI1_SCLK                   0x80000000 \
+       MX53_PAD_EIM_D17__ECSPI1_MISO                   0x80000000 \
+       MX53_PAD_EIM_D18__ECSPI1_MOSI                   0x80000000
+
+#define MX53_ECSPI1_PINGRP2 \
+       MX53_PAD_GPIO_19__ECSPI1_RDY                    0x80000000 \
+       MX53_PAD_EIM_EB2__ECSPI1_SS0                    0x80000000 \
+       MX53_PAD_EIM_D16__ECSPI1_SCLK                   0x80000000 \
+       MX53_PAD_EIM_D17__ECSPI1_MISO                   0x80000000 \
+       MX53_PAD_EIM_D18__ECSPI1_MOSI                   0x80000000 \
+       MX53_PAD_EIM_D19__ECSPI1_SS1                    0x80000000
+
+#define MX53_ECSPI2_PINGRP1 \
+       MX53_PAD_EIM_OE__ECSPI2_MISO                    0x80000000 \
+       MX53_PAD_EIM_CS1__ECSPI2_MOSI                   0x80000000 \
+       MX53_PAD_EIM_CS0__ECSPI2_SCLK                   0x80000000
+
+#define MX53_ESDHC1_PINGRP1 \
+       MX53_PAD_SD1_DATA0__ESDHC1_DAT0                 0x1d5 \
+       MX53_PAD_SD1_DATA1__ESDHC1_DAT1                 0x1d5 \
+       MX53_PAD_SD1_DATA2__ESDHC1_DAT2                 0x1d5 \
+       MX53_PAD_SD1_DATA3__ESDHC1_DAT3                 0x1d5 \
+       MX53_PAD_SD1_CMD__ESDHC1_CMD                    0x1d5 \
+       MX53_PAD_SD1_CLK__ESDHC1_CLK                    0x1d5
+
+#define MX53_ESDHC1_PINGRP2 \
+       MX53_PAD_SD1_DATA0__ESDHC1_DAT0                 0x1d5 \
+       MX53_PAD_SD1_DATA1__ESDHC1_DAT1                 0x1d5 \
+       MX53_PAD_SD1_DATA2__ESDHC1_DAT2                 0x1d5 \
+       MX53_PAD_SD1_DATA3__ESDHC1_DAT3                 0x1d5 \
+       MX53_PAD_PATA_DATA8__ESDHC1_DAT4                0x1d5 \
+       MX53_PAD_PATA_DATA9__ESDHC1_DAT5                0x1d5 \
+       MX53_PAD_PATA_DATA10__ESDHC1_DAT6               0x1d5 \
+       MX53_PAD_PATA_DATA11__ESDHC1_DAT7               0x1d5 \
+       MX53_PAD_SD1_CMD__ESDHC1_CMD                    0x1d5 \
+       MX53_PAD_SD1_CLK__ESDHC1_CLK                    0x1d5
+
+#define MX53_ESDHC2_PINGRP1 \
+       MX53_PAD_SD2_CMD__ESDHC2_CMD                    0x1d5 \
+       MX53_PAD_SD2_CLK__ESDHC2_CLK                    0x1d5 \
+       MX53_PAD_SD2_DATA0__ESDHC2_DAT0                 0x1d5 \
+       MX53_PAD_SD2_DATA1__ESDHC2_DAT1                 0x1d5 \
+       MX53_PAD_SD2_DATA2__ESDHC2_DAT2                 0x1d5 \
+       MX53_PAD_SD2_DATA3__ESDHC2_DAT3                 0x1d5
+
+#define MX53_ESDHC3_PINGRP1 \
+       MX53_PAD_PATA_DATA8__ESDHC3_DAT0                0x1d5 \
+       MX53_PAD_PATA_DATA9__ESDHC3_DAT1                0x1d5 \
+       MX53_PAD_PATA_DATA10__ESDHC3_DAT2               0x1d5 \
+       MX53_PAD_PATA_DATA11__ESDHC3_DAT3               0x1d5 \
+       MX53_PAD_PATA_DATA0__ESDHC3_DAT4                0x1d5 \
+       MX53_PAD_PATA_DATA1__ESDHC3_DAT5                0x1d5 \
+       MX53_PAD_PATA_DATA2__ESDHC3_DAT6                0x1d5 \
+       MX53_PAD_PATA_DATA3__ESDHC3_DAT7                0x1d5 \
+       MX53_PAD_PATA_RESET_B__ESDHC3_CMD               0x1d5 \
+       MX53_PAD_PATA_IORDY__ESDHC3_CLK                 0x1d5
+
+#define MX53_FEC_PINGRP1 \
+       MX53_PAD_FEC_MDC__FEC_MDC                       0x80000000 \
+       MX53_PAD_FEC_MDIO__FEC_MDIO                     0x80000000 \
+       MX53_PAD_FEC_REF_CLK__FEC_TX_CLK                0x80000000 \
+       MX53_PAD_FEC_RX_ER__FEC_RX_ER                   0x80000000 \
+       MX53_PAD_FEC_CRS_DV__FEC_RX_DV                  0x80000000 \
+       MX53_PAD_FEC_RXD1__FEC_RDATA_1                  0x80000000 \
+       MX53_PAD_FEC_RXD0__FEC_RDATA_0                  0x80000000 \
+       MX53_PAD_FEC_TX_EN__FEC_TX_EN                   0x80000000 \
+       MX53_PAD_FEC_TXD1__FEC_TDATA_1                  0x80000000 \
+       MX53_PAD_FEC_TXD0__FEC_TDATA_0                  0x80000000
+
+#define MX53_FEC_PINGRP2 \
+       MX53_PAD_FEC_MDC__FEC_MDC                       0x80000000 \
+       MX53_PAD_FEC_MDIO__FEC_MDIO                     0x80000000 \
+       MX53_PAD_FEC_REF_CLK__FEC_TX_CLK                0x80000000 \
+       MX53_PAD_FEC_RX_ER__FEC_RX_ER                   0x80000000 \
+       MX53_PAD_FEC_CRS_DV__FEC_RX_DV                  0x80000000 \
+       MX53_PAD_FEC_RXD1__FEC_RDATA_1                  0x80000000 \
+       MX53_PAD_FEC_RXD0__FEC_RDATA_0                  0x80000000 \
+       MX53_PAD_FEC_TX_EN__FEC_TX_EN                   0x80000000 \
+       MX53_PAD_FEC_TXD1__FEC_TDATA_1                  0x80000000 \
+       MX53_PAD_FEC_TXD0__FEC_TDATA_0                  0x80000000 \
+       MX53_PAD_KEY_ROW1__FEC_COL                      0x80000000 \
+       MX53_PAD_KEY_COL3__FEC_CRS                      0x80000000 \
+       MX53_PAD_KEY_COL2__FEC_RDATA_2                  0x80000000 \
+       MX53_PAD_KEY_COL0__FEC_RDATA_3                  0x80000000 \
+       MX53_PAD_KEY_COL1__FEC_RX_CLK                   0x80000000 \
+       MX53_PAD_KEY_ROW2__FEC_TDATA_2                  0x80000000 \
+       MX53_PAD_GPIO_19__FEC_TDATA_3                   0x80000000 \
+       MX53_PAD_KEY_ROW0__FEC_TX_ER                    0x80000000
+
+#define MX53_I2C1_PINGRP1 \
+       MX53_PAD_CSI0_DAT8__I2C1_SDA                    0xc0000000 \
+       MX53_PAD_CSI0_DAT9__I2C1_SCL                    0xc0000000
+
+#define MX53_I2C1_PINGRP2 \
+       MX53_PAD_EIM_D21__I2C1_SCL                      0xc0000000 \
+       MX53_PAD_EIM_D28__I2C1_SDA                      0xc0000000
+
+#define MX53_I2C2_PINGRP1 \
+       MX53_PAD_KEY_ROW3__I2C2_SDA                     0xc0000000 \
+       MX53_PAD_KEY_COL3__I2C2_SCL                     0xc0000000
+
+#define MX53_I2C2_PINGRP2 \
+       MX53_PAD_EIM_D16__I2C2_SDA                      0xc0000000 \
+       MX53_PAD_EIM_EB2__I2C2_SCL                      0xc0000000
+
+#define MX53_I2C3_PINGRP1 \
+       MX53_PAD_GPIO_6__I2C3_SDA                       0xc0000000 \
+       MX53_PAD_GPIO_5__I2C3_SCL                       0xc0000000
+
+#define MX53_I2C3_PINGRP2 \
+       MX53_PAD_GPIO_3__I2C3_SCL                       0xc0000000 \
+       MX53_PAD_GPIO_6__I2C3_SDA                       0xc0000000
+
+#define MX53_IPU_DISP0_PINGRP1 \
+       MX53_PAD_DI0_DISP_CLK__IPU_DI0_DISP_CLK         0x5 \
+       MX53_PAD_DI0_PIN15__IPU_DI0_PIN15               0x5 \
+       MX53_PAD_DI0_PIN2__IPU_DI0_PIN2                 0x5 \
+       MX53_PAD_DI0_PIN3__IPU_DI0_PIN3                 0x5 \
+       MX53_PAD_DISP0_DAT0__IPU_DISP0_DAT_0            0x5 \
+       MX53_PAD_DISP0_DAT1__IPU_DISP0_DAT_1            0x5 \
+       MX53_PAD_DISP0_DAT2__IPU_DISP0_DAT_2            0x5 \
+       MX53_PAD_DISP0_DAT3__IPU_DISP0_DAT_3            0x5 \
+       MX53_PAD_DISP0_DAT4__IPU_DISP0_DAT_4            0x5 \
+       MX53_PAD_DISP0_DAT5__IPU_DISP0_DAT_5            0x5 \
+       MX53_PAD_DISP0_DAT6__IPU_DISP0_DAT_6            0x5 \
+       MX53_PAD_DISP0_DAT7__IPU_DISP0_DAT_7            0x5 \
+       MX53_PAD_DISP0_DAT8__IPU_DISP0_DAT_8            0x5 \
+       MX53_PAD_DISP0_DAT9__IPU_DISP0_DAT_9            0x5 \
+       MX53_PAD_DISP0_DAT10__IPU_DISP0_DAT_10          0x5 \
+       MX53_PAD_DISP0_DAT11__IPU_DISP0_DAT_11          0x5 \
+       MX53_PAD_DISP0_DAT12__IPU_DISP0_DAT_12          0x5 \
+       MX53_PAD_DISP0_DAT13__IPU_DISP0_DAT_13          0x5 \
+       MX53_PAD_DISP0_DAT14__IPU_DISP0_DAT_14          0x5 \
+       MX53_PAD_DISP0_DAT15__IPU_DISP0_DAT_15          0x5 \
+       MX53_PAD_DISP0_DAT16__IPU_DISP0_DAT_16          0x5 \
+       MX53_PAD_DISP0_DAT17__IPU_DISP0_DAT_17          0x5 \
+       MX53_PAD_DISP0_DAT18__IPU_DISP0_DAT_18          0x5 \
+       MX53_PAD_DISP0_DAT19__IPU_DISP0_DAT_19          0x5 \
+       MX53_PAD_DISP0_DAT20__IPU_DISP0_DAT_20          0x5 \
+       MX53_PAD_DISP0_DAT21__IPU_DISP0_DAT_21          0x5 \
+       MX53_PAD_DISP0_DAT22__IPU_DISP0_DAT_22          0x5 \
+       MX53_PAD_DISP0_DAT23__IPU_DISP0_DAT_23          0x5
+
+#define MX53_IPU_DISP1_PINGRP1 \
+       MX53_PAD_EIM_DA9__IPU_DISP1_DAT_0               0x5 \
+       MX53_PAD_EIM_DA8__IPU_DISP1_DAT_1               0x5 \
+       MX53_PAD_EIM_DA7__IPU_DISP1_DAT_2               0x5 \
+       MX53_PAD_EIM_DA6__IPU_DISP1_DAT_3               0x5 \
+       MX53_PAD_EIM_DA5__IPU_DISP1_DAT_4               0x5 \
+       MX53_PAD_EIM_DA4__IPU_DISP1_DAT_5               0x5 \
+       MX53_PAD_EIM_DA3__IPU_DISP1_DAT_6               0x5 \
+       MX53_PAD_EIM_DA2__IPU_DISP1_DAT_7               0x5 \
+       MX53_PAD_EIM_DA1__IPU_DISP1_DAT_8               0x5 \
+       MX53_PAD_EIM_DA0__IPU_DISP1_DAT_9               0x5 \
+       MX53_PAD_EIM_EB1__IPU_DISP1_DAT_10              0x5 \
+       MX53_PAD_EIM_EB0__IPU_DISP1_DAT_11              0x5 \
+       MX53_PAD_EIM_A17__IPU_DISP1_DAT_12              0x5 \
+       MX53_PAD_EIM_A18__IPU_DISP1_DAT_13              0x5 \
+       MX53_PAD_EIM_A19__IPU_DISP1_DAT_14              0x5 \
+       MX53_PAD_EIM_A20__IPU_DISP1_DAT_15              0x5 \
+       MX53_PAD_EIM_A21__IPU_DISP1_DAT_16              0x5 \
+       MX53_PAD_EIM_A22__IPU_DISP1_DAT_17              0x5 \
+       MX53_PAD_EIM_A23__IPU_DISP1_DAT_18              0x5 \
+       MX53_PAD_EIM_A24__IPU_DISP1_DAT_19              0x5 \
+       MX53_PAD_EIM_D31__IPU_DISP1_DAT_20              0x5 \
+       MX53_PAD_EIM_D30__IPU_DISP1_DAT_21              0x5 \
+       MX53_PAD_EIM_D26__IPU_DISP1_DAT_22              0x5 \
+       MX53_PAD_EIM_D27__IPU_DISP1_DAT_23              0x5 \
+       MX53_PAD_EIM_A16__IPU_DI1_DISP_CLK              0x5 \
+       MX53_PAD_EIM_DA13__IPU_DI1_D0_CS                0x5 \
+       MX53_PAD_EIM_DA14__IPU_DI1_D1_CS                0x5 \
+       MX53_PAD_EIM_DA15__IPU_DI1_PIN1                 0x5 \
+       MX53_PAD_EIM_DA11__IPU_DI1_PIN2                 0x5 \
+       MX53_PAD_EIM_DA12__IPU_DI1_PIN3                 0x5 \
+       MX53_PAD_EIM_A25__IPU_DI1_PIN12                 0x5 \
+       MX53_PAD_EIM_DA10__IPU_DI1_PIN15                0x5
+
+#define MX53_IPU_DISP2_PINGRP1 \
+       MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0             0x80000000 \
+       MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1             0x80000000 \
+       MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2             0x80000000 \
+       MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3             0x80000000 \
+       MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK             0x80000000 \
+       MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0             0x80000000 \
+       MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1             0x80000000 \
+       MX53_PAD_LVDS1_TX2_P__LDB_LVDS1_TX2             0x80000000 \
+       MX53_PAD_LVDS1_TX3_P__LDB_LVDS1_TX3             0x80000000 \
+       MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK             0x80000000
+
+#define MX53_NAND_PINGRP1 \
+       MX53_PAD_NANDF_WE_B__EMI_NANDF_WE_B             0x4 \
+       MX53_PAD_NANDF_RE_B__EMI_NANDF_RE_B             0x4 \
+       MX53_PAD_NANDF_CLE__EMI_NANDF_CLE               0x4 \
+       MX53_PAD_NANDF_ALE__EMI_NANDF_ALE               0x4 \
+       MX53_PAD_NANDF_WP_B__EMI_NANDF_WP_B             0xe0 \
+       MX53_PAD_NANDF_RB0__EMI_NANDF_RB_0              0xe0 \
+       MX53_PAD_NANDF_CS0__EMI_NANDF_CS_0              0x4 \
+       MX53_PAD_PATA_DATA0__EMI_NANDF_D_0              0xa4 \
+       MX53_PAD_PATA_DATA1__EMI_NANDF_D_1              0xa4 \
+       MX53_PAD_PATA_DATA2__EMI_NANDF_D_2              0xa4 \
+       MX53_PAD_PATA_DATA3__EMI_NANDF_D_3              0xa4 \
+       MX53_PAD_PATA_DATA4__EMI_NANDF_D_4              0xa4 \
+       MX53_PAD_PATA_DATA5__EMI_NANDF_D_5              0xa4 \
+       MX53_PAD_PATA_DATA6__EMI_NANDF_D_6              0xa4 \
+       MX53_PAD_PATA_DATA7__EMI_NANDF_D_7              0xa4
+
+#define MX53_OWIRE_PINGRP1 \
+       MX53_PAD_GPIO_18__OWIRE_LINE                    0x80000000
+
+#define MX53_PWM1_PINGRP1 \
+       MX53_PAD_DISP0_DAT8__PWM1_PWMO                  0x5
+
+#define MX53_PWM2_PINGRP1 \
+       MX53_PAD_GPIO_1__PWM2_PWMO                      0x80000000
+
+#define MX53_UART1_PINGRP1 \
+       MX53_PAD_CSI0_DAT10__UART1_TXD_MUX              0x1e4 \
+       MX53_PAD_CSI0_DAT11__UART1_RXD_MUX              0x1e4
+
+#define MX53_UART1_PINGRP2 \
+       MX53_PAD_PATA_DIOW__UART1_TXD_MUX               0x1e4 \
+       MX53_PAD_PATA_DMACK__UART1_RXD_MUX              0x1e4
+
+#define MX53_UART1_PINGRP3 \
+       MX53_PAD_PATA_RESET_B__UART1_CTS                0x1c5 \
+       MX53_PAD_PATA_IORDY__UART1_RTS                  0x1c5
+
+#define MX53_UART2_PINGRP1 \
+       MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX          0x1e4 \
+       MX53_PAD_PATA_DMARQ__UART2_TXD_MUX              0x1e4
+
+#define MX53_UART2_PINGRP2 \
+       MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX          0x1c5 \
+       MX53_PAD_PATA_DMARQ__UART2_TXD_MUX              0x1c5 \
+       MX53_PAD_PATA_DIOR__UART2_RTS                   0x1c5 \
+       MX53_PAD_PATA_INTRQ__UART2_CTS                  0x1c5
+
+#define MX53_UART3_PINGRP1 \
+       MX53_PAD_PATA_CS_0__UART3_TXD_MUX               0x1e4 \
+       MX53_PAD_PATA_CS_1__UART3_RXD_MUX               0x1e4 \
+       MX53_PAD_PATA_DA_1__UART3_CTS                   0x1e4 \
+       MX53_PAD_PATA_DA_2__UART3_RTS                   0x1e4
+
+#define MX53_UART3_PINGRP2 \
+       MX53_PAD_PATA_CS_0__UART3_TXD_MUX               0x1e4 \
+       MX53_PAD_PATA_CS_1__UART3_RXD_MUX               0x1e4
+
+#define MX53_UART4_PINGRP1 \
+       MX53_PAD_KEY_COL0__UART4_TXD_MUX                0x1e4 \
+       MX53_PAD_KEY_ROW0__UART4_RXD_MUX                0x1e4
+
+#define MX53_UART5_PINGRP1 \
+       MX53_PAD_KEY_COL1__UART5_TXD_MUX                0x1e4 \
+       MX53_PAD_KEY_ROW1__UART5_RXD_MUX                0x1e4
+
+#endif /* __DTS_IMX53_PINGRP_H */
index 91a5935a4aacd63879f2f2104f546d6f41bb7e60..4c04459c45251c8e5c9f4fa1783f933d29456028 100644 (file)
@@ -26,7 +26,7 @@
                crtcs = <&ipu 0>;
                interface-pix-fmt = "rgb565";
                pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_ipu_disp0_1>;
+               pinctrl-0 = <&pinctrl_ipu_disp0>;
                status = "disabled";
                display-timings {
                        claawvga {
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_3p2v: 3p2v {
+               reg_3p2v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "3P2V";
                        regulator-min-microvolt = <3200000>;
                        regulator-max-microvolt = <3200000>;
                        regulator-always-on;
                };
 
-               reg_usb_vbus: usb_vbus {
+               reg_usb_vbus: regulator@1 {
                        compatible = "regulator-fixed";
+                       reg = <1>;
                        regulator-name = "usb_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
 
 &esdhc1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc1_1>;
+       pinctrl-0 = <&pinctrl_esdhc1>;
        status = "okay";
 };
 
 
 &esdhc3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc3_1>;
+       pinctrl-0 = <&pinctrl_esdhc3>;
        cd-gpios = <&gpio3 11 0>;
        wp-gpios = <&gpio3 12 0>;
        bus-width = <8>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx53-qsb {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK 0x80000000
                                MX53_PAD_PATA_DA_1__GPIO7_7 0x80000000
                        >;
                };
-       };
 
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX53_AUDMUX_PINGRP1>;
+               };
+
+               pinctrl_esdhc1: esdhc1grp {
+                       fsl,pins = <MX53_ESDHC1_PINGRP1>;
+               };
+
+               pinctrl_esdhc3: esdhc3grp {
+                       fsl,pins = <MX53_ESDHC3_PINGRP1>;
+               };
+
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <MX53_FEC_PINGRP1>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX53_I2C1_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX53_I2C2_PINGRP1>;
+               };
+
+               pinctrl_ipu_disp0: ipudisp0grp {
+                       fsl,pins = <MX53_IPU_DISP0_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX53_UART1_PINGRP1>;
+               };
+       };
 };
 
 &uart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart1_1>;
+       pinctrl-0 = <&pinctrl_uart1>;
        status = "okay";
 };
 
 &i2c2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c2_1>;
+       pinctrl-0 = <&pinctrl_i2c2>;
        status = "okay";
 
        sgtl5000: codec@0a {
                reg = <0x0a>;
                VDDA-supply = <&reg_3p2v>;
                VDDIO-supply = <&reg_3p2v>;
-               clocks = <&clks 150>;
+               clocks = <&clks IMX5_CLK_SSI_EXT1_GATE>;
        };
 };
 
 &i2c1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c1_1>;
+       pinctrl-0 = <&pinctrl_i2c1>;
        status = "okay";
 
        accelerometer: mma8450@1c {
 
 &audmux {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_audmux_1>;
+       pinctrl-0 = <&pinctrl_audmux>;
        status = "okay";
 };
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_fec_1>;
+       pinctrl-0 = <&pinctrl_fec>;
        phy-mode = "rmii";
        phy-reset-gpios = <&gpio7 6 0>;
        status = "okay";
 };
 
+&sata {
+       status = "okay";
+};
+
 &vpu {
        status = "okay";
 };
index a9b6e10de0a5f52ebadb707e1f99179e6e19ae88..e84decfb05d0b9e64ed1374a0fd3ffdd390421fc 100644 (file)
@@ -40,7 +40,7 @@
 
 &esdhc1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc1_1>;
+       pinctrl-0 = <&pinctrl_esdhc1>;
        cd-gpios = <&gpio3 13 0>;
        wp-gpios = <&gpio4 11 0>;
        status = "okay";
 
 &esdhc2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc2_1>;
+       pinctrl-0 = <&pinctrl_esdhc2>;
        non-removable;
        status = "okay";
 };
 
 &uart3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart3_1>;
+       pinctrl-0 = <&pinctrl_uart3>;
        fsl,uart-has-rtscts;
        status = "okay";
 };
 
 &ecspi1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_ecspi1_1>;
+       pinctrl-0 = <&pinctrl_ecspi1>;
        fsl,spi-num-chipselects = <2>;
        cs-gpios = <&gpio2 30 0>, <&gpio3 19 0>;
        status = "okay";
@@ -95,7 +95,7 @@
 
 &esdhc3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc3_1>;
+       pinctrl-0 = <&pinctrl_esdhc3>;
        non-removable;
        status = "okay";
 };
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx53-smd {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX53_PAD_PATA_DATA14__GPIO2_14 0x80000000
                                MX53_PAD_PATA_DA_0__GPIO7_6    0x80000000
                        >;
                };
+
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <MX53_ECSPI1_PINGRP1>;
+               };
+
+               pinctrl_esdhc1: esdhc1grp {
+                       fsl,pins = <MX53_ESDHC1_PINGRP1>;
+               };
+
+               pinctrl_esdhc2: esdhc2grp {
+                       fsl,pins = <MX53_ESDHC2_PINGRP1>;
+               };
+
+               pinctrl_esdhc3: esdhc3grp {
+                       fsl,pins = <MX53_ESDHC3_PINGRP1>;
+               };
+
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <MX53_FEC_PINGRP1>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX53_I2C1_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX53_I2C2_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX53_UART1_PINGRP1>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX53_UART2_PINGRP1>;
+               };
+
+               pinctrl_uart3: uart3grp {
+                       fsl,pins = <MX53_UART3_PINGRP1>;
+               };
        };
 };
 
 &uart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart1_1>;
+       pinctrl-0 = <&pinctrl_uart1>;
        status = "okay";
 };
 
 &uart2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart2_1>;
+       pinctrl-0 = <&pinctrl_uart2>;
        status = "okay";
 };
 
 &i2c2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c2_1>;
+       pinctrl-0 = <&pinctrl_i2c2>;
        status = "okay";
 
        codec: sgtl5000@0a {
 
 &i2c1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c1_1>;
+       pinctrl-0 = <&pinctrl_i2c1>;
        status = "okay";
 
        accelerometer: mma8450@1c {
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_fec_1>;
+       pinctrl-0 = <&pinctrl_fec>;
        phy-mode = "rmii";
        phy-reset-gpios = <&gpio7 6 0>;
        status = "okay";
index abd72af545bf0409ce9556afdb47dcffbf8fcea0..b6483c9a0b9994147ebd78798322ab804d41e13e 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_3p3v: 3p3v {
+               reg_3p3v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "3P3V";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
@@ -35,8 +38,8 @@
 
 &esdhc2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc2_1>,
-                   <&pinctrl_tqma53_esdhc2_2>;
+       pinctrl-0 = <&pinctrl_esdhc2>,
+                   <&pinctrl_esdhc2_cdwp>;
        vmmc-supply = <&reg_3p3v>;
        wp-gpios = <&gpio1 2 0>;
        cd-gpios = <&gpio1 4 0>;
 
 &uart3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart3_2>;
+       pinctrl-0 = <&pinctrl_uart3>;
        status = "disabled";
 };
 
 &ecspi1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_ecspi1_1>;
+       pinctrl-0 = <&pinctrl_ecspi1>;
        fsl,spi-num-chipselects = <4>;
        cs-gpios = <&gpio2 30 0>, <&gpio3 19 0>,
                   <&gpio3 24 0>, <&gpio3 25 0>;
@@ -60,7 +63,7 @@
 
 &esdhc3 { /* EMMC */
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_esdhc3_1>;
+       pinctrl-0 = <&pinctrl_esdhc3>;
        vmmc-supply = <&reg_3p3v>;
        non-removable;
        bus-width = <8>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       esdhc2_2 {
-               pinctrl_tqma53_esdhc2_2: esdhc2-tqma53-grp2 {
-                       fsl,pins = <
-                               MX53_PAD_GPIO_4__GPIO1_4        0x80000000 /* SD2_CD */
-                               MX53_PAD_GPIO_2__GPIO1_2        0x80000000 /* SD2_WP */
-                       >;
-               };
-       };
-
-       i2s {
-               pinctrl_i2s_1: i2s-grp1 {
-                       fsl,pins = <
-                                MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC  0x80000000 /* I2S_SCLK */
-                                MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD  0x80000000 /* I2S_DOUT */
-                                MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS 0x80000000 /* I2S_LRCLK */
-                                MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD  0x80000000 /* I2S_DIN */
-                       >;
-               };
-       };
-
-       hog {
+       imx53-tqma53 {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                 MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK 0x80000000 /* SSI_MCLK */
                                 MX53_PAD_GPIO_1__PWM2_PWMO      0x80000000 /* LCD_CONTRAST */
                        >;
                };
+
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX53_AUDMUX_PINGRP1>;
+               };
+
+               pinctrl_can1: can1grp {
+                       fsl,pins = <MX53_CAN1_PINGRP2>;
+               };
+
+               pinctrl_can2: can2grp {
+                       fsl,pins = <MX53_CAN2_PINGRP1>;
+               };
+
+               pinctrl_cspi: cspigrp {
+                       fsl,pins = <MX53_CSPI_PINGRP1>;
+               };
+
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <MX53_ECSPI1_PINGRP1>;
+               };
+
+               pinctrl_esdhc2: esdhc2grp {
+                       fsl,pins = <MX53_ESDHC2_PINGRP1>;
+               };
+
+               pinctrl_esdhc2_cdwp: esdhc2cdwp {
+                       fsl,pins = <
+                               MX53_PAD_GPIO_4__GPIO1_4        0x80000000 /* SD2_CD */
+                               MX53_PAD_GPIO_2__GPIO1_2        0x80000000 /* SD2_WP */
+                       >;
+               };
+
+               pinctrl_esdhc3: esdhc3grp {
+                       fsl,pins = <MX53_ESDHC3_PINGRP1>;
+               };
+
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <MX53_FEC_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX53_I2C2_PINGRP1>;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <MX53_I2C3_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX53_UART1_PINGRP2>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX53_UART2_PINGRP1>;
+               };
+
+               pinctrl_uart3: uart3grp {
+                       fsl,ps = <MX53_UART3_PINGRP2>;
+               };
        };
 };
 
 &uart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart1_2>;
+       pinctrl-0 = <&pinctrl_uart1>;
        fsl,uart-has-rtscts;
        status = "disabled";
 };
 
 &uart2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart2_1>;
+       pinctrl-0 = <&pinctrl_uart2>;
        status = "disabled";
 };
 
 &can1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_can1_2>;
+       pinctrl-0 = <&pinctrl_can1>;
        status = "disabled";
 };
 
 &can2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_can2_1>;
+       pinctrl-0 = <&pinctrl_can2>;
        status = "disabled";
 };
 
 &i2c3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c3_1>;
+       pinctrl-0 = <&pinctrl_i2c3>;
        status = "disabled";
 };
 
 &cspi {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_cspi_1>;
+       pinctrl-0 = <&pinctrl_cspi>;
        fsl,spi-num-chipselects = <3>;
        cs-gpios = <&gpio1 18 0>, <&gpio1 19 0>,
                   <&gpio1 21 0>;
 
 &i2c2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c2_1>;
+       pinctrl-0 = <&pinctrl_i2c2>;
        status = "okay";
 
        pmic: mc34708@8 {
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_fec_1>;
+       pinctrl-0 = <&pinctrl_fec>;
        phy-mode = "rmii";
        status = "disabled";
 };
index f494766700a3d7b48e735ce1dc79fa550036c7a2..db4255c8e7e8a8dc42643da5ec2fa97599ef6bde 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_3p3v: 3p3v {
+               reg_3p3v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "3P3V";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
diff --git a/arch/arm/boot/dts/imx53-voipac-bsb.dts b/arch/arm/boot/dts/imx53-voipac-bsb.dts
new file mode 100644 (file)
index 0000000..61244cf
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2013 Rostislav Lisovy <lisovy@gmail.com>, PiKRON s.r.o.
+ *
+ * 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 "imx53-voipac-dmm-668.dtsi"
+
+/ {
+       sound {
+               compatible = "fsl,imx53-voipac-sgtl5000",
+                            "fsl,imx-audio-sgtl5000";
+               model = "imx53-voipac-sgtl5000";
+               ssi-controller = <&ssi2>;
+               audio-codec = <&sgtl5000>;
+               audio-routing =
+                       "Headphone Jack", "HP_OUT";
+               mux-int-port = <2>;
+               mux-ext-port = <5>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&led_pin_gpio>;
+
+               led1 {
+                       label = "led-red";
+                       gpios = <&gpio3 29 0>;
+                       default-state = "off";
+               };
+
+               led2 {
+                       label = "led-orange";
+                       gpios = <&gpio2 31 0>;
+                       default-state = "off";
+               };
+       };
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog>;
+
+       imx53-voipac {
+               pinctrl_hog: hoggrp {
+                       fsl,pins = <
+                               /* SD2_CD */
+                               MX53_PAD_EIM_D25__GPIO3_25      0x80000000
+                               /* SD2_WP */
+                               MX53_PAD_EIM_A19__GPIO2_19      0x80000000
+                       >;
+               };
+
+               led_pin_gpio: led_gpio {
+                       fsl,pins = <
+                               MX53_PAD_EIM_D29__GPIO3_29      0x80000000
+                               MX53_PAD_EIM_EB3__GPIO2_31      0x80000000
+                       >;
+               };
+
+               /* Keyboard controller */
+               pinctrl_kpp_1: kppgrp-1 {
+                       fsl,pins = <
+                               MX53_PAD_GPIO_9__KPP_COL_6      0xe8
+                               MX53_PAD_GPIO_4__KPP_COL_7      0xe8
+                               MX53_PAD_KEY_COL2__KPP_COL_2    0xe8
+                               MX53_PAD_KEY_COL3__KPP_COL_3    0xe8
+                               MX53_PAD_KEY_COL4__KPP_COL_4    0xe8
+                               MX53_PAD_GPIO_2__KPP_ROW_6      0xe0
+                               MX53_PAD_GPIO_5__KPP_ROW_7      0xe0
+                               MX53_PAD_KEY_ROW2__KPP_ROW_2    0xe0
+                               MX53_PAD_KEY_ROW3__KPP_ROW_3    0xe0
+                               MX53_PAD_KEY_ROW4__KPP_ROW_4    0xe0
+                       >;
+               };
+
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX53_AUDMUX_PINGRP1>;
+               };
+
+               pinctrl_esdhc2: esdhc2grp {
+                       fsl,pins = <MX53_ESDHC2_PINGRP1>;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <MX53_I2C3_PINGRP2>;
+               };
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>; /* SSI1 */
+       status = "okay";
+};
+
+&esdhc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_esdhc2>;
+       cd-gpios = <&gpio3 25 0>;
+       wp-gpios = <&gpio2 19 0>;
+       vmmc-supply = <&reg_3p3v>;
+       status = "okay";
+};
+
+&i2c3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       sgtl5000: codec@0a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
+               VDDA-supply = <&reg_3p3v>;
+               VDDIO-supply = <&reg_3p3v>;
+               clocks = <&clks 150>;
+       };
+};
+
+&kpp {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_kpp_1>;
+       linux,keymap = <
+                       0x0203003b      /* KEY_F1 */
+                       0x0603003c      /* KEY_F2 */
+                       0x0207003d      /* KEY_F3 */
+                       0x0607003e      /* KEY_F4 */
+                       >;
+       keypad,num-rows = <8>;
+       keypad,num-columns = <1>;
+       status = "okay";
+};
+
+&ssi2 {
+       fsl,mode = "i2s-slave";
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx53-voipac-dmm-668.dtsi b/arch/arm/boot/dts/imx53-voipac-dmm-668.dtsi
new file mode 100644 (file)
index 0000000..04a2895
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+ * Copyright 2013 Rostislav Lisovy <lisovy@gmail.com>, PiKRON s.r.o.
+ *
+ * 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 "imx53.dtsi"
+
+/ {
+       model = "Voipac i.MX53 X53-DMM-668";
+       compatible = "voipac,imx53-dmm-668", "fsl,imx53";
+
+       memory@70000000 {
+               device_type = "memory";
+               reg = <0x70000000 0x20000000>;
+       };
+
+       memory@b0000000 {
+               device_type = "memory";
+               reg = <0xb0000000 0x20000000>;
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_3p3v: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_vbus: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "usb_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio3 31 0>; /* PEN */
+                       enable-active-high;
+               };
+       };
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog>;
+
+       imx53-voipac {
+               pinctrl_hog: hoggrp {
+                       fsl,pins = <
+                               /* Make DA9053 regulator functional */
+                               MX53_PAD_GPIO_16__GPIO7_11      0x80000000
+                               /* FEC Power enable */
+                               MX53_PAD_GPIO_11__GPIO4_1       0x80000000
+                               /* FEC RST */
+                               MX53_PAD_GPIO_12__GPIO4_2       0x80000000
+                       >;
+               };
+
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <MX53_ECSPI1_PINGRP1>;
+               };
+
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <MX53_FEC_PINGRP1>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX53_I2C1_PINGRP2>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX53_UART1_PINGRP2>;
+               };
+
+               pinctrl_nand: nandgrp {
+                       fsl,pins = <MX53_NAND_PINGRP1>;
+               };
+       };
+};
+
+&ecspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi1>;
+       fsl,spi-num-chipselects = <4>;
+       cs-gpios = <&gpio2 30 0>, <&gpio3 19 0>, <&gpio2 16 0>, <&gpio2 17 0>;
+       status = "okay";
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec>;
+       phy-mode = "rmii";
+       phy-reset-gpios = <&gpio4 2 0>;
+       status = "okay";
+};
+
+&i2c1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       pmic: dialog@48 {
+               compatible = "dlg,da9053-aa", "dlg,da9052";
+               reg = <0x48>;
+               interrupt-parent = <&gpio7>;
+               interrupts = <11 0x8>; /* low-level active IRQ at GPIO7_11 */
+
+               regulators {
+                       buck1_reg: buck1 {
+                               regulator-name = "BUCKCORE";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1400000>;
+                               regulator-always-on;
+                       };
+
+                       buck2_reg: buck2 {
+                               regulator-name = "BUCKPRO";
+                               regulator-min-microvolt = <900000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-always-on;
+                       };
+
+                       buck3_reg: buck3 {
+                               regulator-name = "BUCKMEM";
+                               regulator-min-microvolt = <1420000>;
+                               regulator-max-microvolt = <1580000>;
+                               regulator-always-on;
+                       };
+
+                       buck4_reg: buck4 {
+                               regulator-name = "BUCKPERI";
+                               regulator-min-microvolt = <2370000>;
+                               regulator-max-microvolt = <2630000>;
+                               regulator-always-on;
+                       };
+
+                       ldo1_reg: ldo1 {
+                               regulator-name = "ldo1_1v3";
+                               regulator-min-microvolt = <1250000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo2_reg: ldo2 {
+                               regulator-name = "ldo2_1v3";
+                               regulator-min-microvolt = <1250000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-always-on;
+                       };
+
+                       ldo3_reg: ldo3 {
+                               regulator-name = "ldo3_3v3";
+                               regulator-min-microvolt = <3250000>;
+                               regulator-max-microvolt = <3350000>;
+                               regulator-always-on;
+                       };
+
+                       ldo4_reg: ldo4 {
+                               regulator-name = "ldo4_2v775";
+                               regulator-min-microvolt = <2770000>;
+                               regulator-max-microvolt = <2780000>;
+                               regulator-always-on;
+                       };
+
+                       ldo5_reg: ldo5 {
+                               regulator-name = "ldo5_3v3";
+                               regulator-min-microvolt = <3250000>;
+                               regulator-max-microvolt = <3350000>;
+                               regulator-always-on;
+                       };
+
+                       ldo6_reg: ldo6 {
+                               regulator-name = "ldo6_1v3";
+                               regulator-min-microvolt = <1250000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-always-on;
+                       };
+
+                       ldo7_reg: ldo7 {
+                               regulator-name = "ldo7_2v75";
+                               regulator-min-microvolt = <2700000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-always-on;
+                       };
+
+                       ldo8_reg: ldo8 {
+                               regulator-name = "ldo8_1v8";
+                               regulator-min-microvolt = <1750000>;
+                               regulator-max-microvolt = <1850000>;
+                               regulator-always-on;
+                       };
+
+                       ldo9_reg: ldo9 {
+                               regulator-name = "ldo9_1v5";
+                               regulator-min-microvolt = <1450000>;
+                               regulator-max-microvolt = <1550000>;
+                               regulator-always-on;
+                       };
+
+                       ldo10_reg: ldo10 {
+                               regulator-name = "ldo10_1v3";
+                               regulator-min-microvolt = <1250000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&nfc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_nand>;
+       nand-bus-width = <8>;
+       nand-ecc-mode = "hw";
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_vbus>;
+       phy_type = "utmi";
+       status = "okay";
+};
index 4307e80b2d2e386e53d48ee2080ca66df625565f..175a94cff749e2077969b3878902fcd26f783225 100644 (file)
@@ -11,7 +11,8 @@
  */
 
 #include "skeleton.dtsi"
-#include "imx53-pinfunc.h"
+#include "imx53-pingrp.h"
+#include <dt-bindings/clock/imx5-clock.h>
 
 / {
        aliases {
                interrupt-parent = <&tzic>;
                ranges;
 
+               sata: sata@10000000 {
+                       compatible = "fsl,imx53-ahci";
+                       reg = <0x10000000 0x1000>;
+                       interrupts = <28>;
+                       clocks = <&clks IMX5_CLK_SATA_GATE>,
+                                <&clks IMX5_CLK_SATA_REF>,
+                                <&clks IMX5_CLK_AHB>;
+                       clock-names = "sata_gate", "sata_ref", "ahb";
+                       status = "disabled";
+               };
+
                ipu: ipu@18000000 {
                        #crtc-cells = <1>;
                        compatible = "fsl,imx53-ipu";
                        reg = <0x18000000 0x080000000>;
                        interrupts = <11 10>;
-                       clocks = <&clks 59>, <&clks 110>, <&clks 61>;
+                       clocks = <&clks IMX5_CLK_IPU_GATE>,
+                                <&clks IMX5_CLK_IPU_DI0_GATE>,
+                                <&clks IMX5_CLK_IPU_DI1_GATE>;
                        clock-names = "bus", "di0", "di1";
                        resets = <&src 2>;
                };
                                        compatible = "fsl,imx53-esdhc";
                                        reg = <0x50004000 0x4000>;
                                        interrupts = <1>;
-                                       clocks = <&clks 44>, <&clks 0>, <&clks 71>;
+                                       clocks = <&clks IMX5_CLK_ESDHC1_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC1_PER_GATE>;
                                        clock-names = "ipg", "ahb", "per";
                                        bus-width = <4>;
                                        status = "disabled";
                                        compatible = "fsl,imx53-esdhc";
                                        reg = <0x50008000 0x4000>;
                                        interrupts = <2>;
-                                       clocks = <&clks 45>, <&clks 0>, <&clks 72>;
+                                       clocks = <&clks IMX5_CLK_ESDHC2_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC2_PER_GATE>;
                                        clock-names = "ipg", "ahb", "per";
                                        bus-width = <4>;
                                        status = "disabled";
                                        compatible = "fsl,imx53-uart", "fsl,imx21-uart";
                                        reg = <0x5000c000 0x4000>;
                                        interrupts = <33>;
-                                       clocks = <&clks 32>, <&clks 33>;
+                                       clocks = <&clks IMX5_CLK_UART3_IPG_GATE>,
+                                                <&clks IMX5_CLK_UART3_PER_GATE>;
                                        clock-names = "ipg", "per";
                                        status = "disabled";
                                };
                                        compatible = "fsl,imx53-ecspi", "fsl,imx51-ecspi";
                                        reg = <0x50010000 0x4000>;
                                        interrupts = <36>;
-                                       clocks = <&clks 51>, <&clks 52>;
+                                       clocks = <&clks IMX5_CLK_ECSPI1_IPG_GATE>,
+                                                <&clks IMX5_CLK_ECSPI1_PER_GATE>;
                                        clock-names = "ipg", "per";
                                        status = "disabled";
                                };
                                        compatible = "fsl,imx53-ssi", "fsl,imx21-ssi";
                                        reg = <0x50014000 0x4000>;
                                        interrupts = <30>;
-                                       clocks = <&clks 49>;
-                                       dmas = <&sdma 24 1 0>,
-                                              <&sdma 25 1 0>;
+                                       clocks = <&clks IMX5_CLK_SSI2_IPG_GATE>;
+                                       dmas = <&sdma 24 22 0>,
+                                              <&sdma 25 22 0>;
                                        dma-names = "rx", "tx";
                                        fsl,fifo-depth = <15>;
                                        fsl,ssi-dma-events = <25 24 23 22>; /* TX0 RX0 TX1 RX1 */
                                        compatible = "fsl,imx53-esdhc";
                                        reg = <0x50020000 0x4000>;
                                        interrupts = <3>;
-                                       clocks = <&clks 46>, <&clks 0>, <&clks 73>;
+                                       clocks = <&clks IMX5_CLK_ESDHC3_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC3_PER_GATE>;
                                        clock-names = "ipg", "ahb", "per";
                                        bus-width = <4>;
                                        status = "disabled";
                                        compatible = "fsl,imx53-esdhc";
                                        reg = <0x50024000 0x4000>;
                                        interrupts = <4>;
-                                       clocks = <&clks 47>, <&clks 0>, <&clks 74>;
+                                       clocks = <&clks IMX5_CLK_ESDHC4_IPG_GATE>,
+                                                <&clks IMX5_CLK_DUMMY>,
+                                                <&clks IMX5_CLK_ESDHC4_PER_GATE>;
                                        clock-names = "ipg", "ahb", "per";
                                        bus-width = <4>;
                                        status = "disabled";
 
                        usbphy0: usbphy@0 {
                                compatible = "usb-nop-xceiv";
-                               clocks = <&clks 124>;
+                               clocks = <&clks IMX5_CLK_USB_PHY1_GATE>;
                                clock-names = "main_clk";
                                status = "okay";
                        };
 
                        usbphy1: usbphy@1 {
                                compatible = "usb-nop-xceiv";
-                               clocks = <&clks 125>;
+                               clocks = <&clks IMX5_CLK_USB_PHY2_GATE>;
                                clock-names = "main_clk";
                                status = "okay";
                        };
                                compatible = "fsl,imx53-usb", "fsl,imx27-usb";
                                reg = <0x53f80000 0x0200>;
                                interrupts = <18>;
-                               clocks = <&clks 108>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
                                fsl,usbmisc = <&usbmisc 0>;
                                fsl,usbphy = <&usbphy0>;
                                status = "disabled";
                                compatible = "fsl,imx53-usb", "fsl,imx27-usb";
                                reg = <0x53f80200 0x0200>;
                                interrupts = <14>;
-                               clocks = <&clks 108>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
                                fsl,usbmisc = <&usbmisc 1>;
                                fsl,usbphy = <&usbphy1>;
                                status = "disabled";
                                compatible = "fsl,imx53-usb", "fsl,imx27-usb";
                                reg = <0x53f80400 0x0200>;
                                interrupts = <16>;
-                               clocks = <&clks 108>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
                                fsl,usbmisc = <&usbmisc 2>;
                                status = "disabled";
                        };
                                compatible = "fsl,imx53-usb", "fsl,imx27-usb";
                                reg = <0x53f80600 0x0200>;
                                interrupts = <17>;
-                               clocks = <&clks 108>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
                                fsl,usbmisc = <&usbmisc 3>;
                                status = "disabled";
                        };
                                #index-cells = <1>;
                                compatible = "fsl,imx53-usbmisc";
                                reg = <0x53f80800 0x200>;
-                               clocks = <&clks 108>;
+                               clocks = <&clks IMX5_CLK_USBOH3_GATE>;
                        };
 
                        gpio1: gpio@53f84000 {
                                #interrupt-cells = <2>;
                        };
 
+                       kpp: kpp@53f94000 {
+                               compatible = "fsl,imx53-kpp", "fsl,imx21-kpp";
+                               reg = <0x53f94000 0x4000>;
+                               interrupts = <60>;
+                               clocks = <&clks IMX5_CLK_DUMMY>;
+                               status = "disabled";
+                       };
+
                        wdog1: wdog@53f98000 {
                                compatible = "fsl,imx53-wdt", "fsl,imx21-wdt";
                                reg = <0x53f98000 0x4000>;
                                interrupts = <58>;
-                               clocks = <&clks 0>;
+                               clocks = <&clks IMX5_CLK_DUMMY>;
                        };
 
                        wdog2: wdog@53f9c000 {
                                compatible = "fsl,imx53-wdt", "fsl,imx21-wdt";
                                reg = <0x53f9c000 0x4000>;
                                interrupts = <59>;
-                               clocks = <&clks 0>;
+                               clocks = <&clks IMX5_CLK_DUMMY>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx53-gpt", "fsl,imx31-gpt";
                                reg = <0x53fa0000 0x4000>;
                                interrupts = <39>;
-                               clocks = <&clks 36>, <&clks 41>;
+                               clocks = <&clks IMX5_CLK_GPT_IPG_GATE>,
+                                        <&clks IMX5_CLK_GPT_HF_GATE>;
                                clock-names = "ipg", "per";
                        };
 
                        iomuxc: iomuxc@53fa8000 {
                                compatible = "fsl,imx53-iomuxc";
                                reg = <0x53fa8000 0x4000>;
-
-                               audmux {
-                                       pinctrl_audmux_1: audmuxgrp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC  0x80000000
-                                                       MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD  0x80000000
-                                                       MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS 0x80000000
-                                                       MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD  0x80000000
-                                               >;
-                                       };
-
-                                       pinctrl_audmux_2: audmuxgrp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_SD2_DATA3__AUDMUX_AUD4_TXC     0x80000000
-                                                       MX53_PAD_SD2_DATA2__AUDMUX_AUD4_TXD     0x80000000
-                                                       MX53_PAD_SD2_DATA1__AUDMUX_AUD4_TXFS    0x80000000
-                                                       MX53_PAD_SD2_DATA0__AUDMUX_AUD4_RXD     0x80000000
-                                               >;
-                                       };
-
-                                       pinctrl_audmux_3: audmuxgrp-3 {
-                                               fsl,pins = <
-                                                       MX53_PAD_CSI0_DAT4__AUDMUX_AUD3_TXC     0x80000000
-                                                       MX53_PAD_CSI0_DAT5__AUDMUX_AUD3_TXD     0x80000000
-                                                       MX53_PAD_CSI0_DAT6__AUDMUX_AUD3_TXFS    0x80000000
-                                                       MX53_PAD_CSI0_DAT7__AUDMUX_AUD3_RXD     0x80000000
-                                               >;
-                                       };
-                               };
-
-                               fec {
-                                       pinctrl_fec_1: fecgrp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_FEC_MDC__FEC_MDC        0x80000000
-                                                       MX53_PAD_FEC_MDIO__FEC_MDIO      0x80000000
-                                                       MX53_PAD_FEC_REF_CLK__FEC_TX_CLK 0x80000000
-                                                       MX53_PAD_FEC_RX_ER__FEC_RX_ER    0x80000000
-                                                       MX53_PAD_FEC_CRS_DV__FEC_RX_DV   0x80000000
-                                                       MX53_PAD_FEC_RXD1__FEC_RDATA_1   0x80000000
-                                                       MX53_PAD_FEC_RXD0__FEC_RDATA_0   0x80000000
-                                                       MX53_PAD_FEC_TX_EN__FEC_TX_EN    0x80000000
-                                                       MX53_PAD_FEC_TXD1__FEC_TDATA_1   0x80000000
-                                                       MX53_PAD_FEC_TXD0__FEC_TDATA_0   0x80000000
-                                               >;
-                                       };
-
-                                       pinctrl_fec_2: fecgrp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_FEC_MDC__FEC_MDC        0x80000000
-                                                       MX53_PAD_FEC_MDIO__FEC_MDIO      0x80000000
-                                                       MX53_PAD_FEC_REF_CLK__FEC_TX_CLK 0x80000000
-                                                       MX53_PAD_FEC_RX_ER__FEC_RX_ER    0x80000000
-                                                       MX53_PAD_FEC_CRS_DV__FEC_RX_DV   0x80000000
-                                                       MX53_PAD_FEC_RXD1__FEC_RDATA_1   0x80000000
-                                                       MX53_PAD_FEC_RXD0__FEC_RDATA_0   0x80000000
-                                                       MX53_PAD_FEC_TX_EN__FEC_TX_EN    0x80000000
-                                                       MX53_PAD_FEC_TXD1__FEC_TDATA_1   0x80000000
-                                                       MX53_PAD_FEC_TXD0__FEC_TDATA_0   0x80000000
-                                                       MX53_PAD_KEY_ROW1__FEC_COL       0x80000000
-                                                       MX53_PAD_KEY_COL3__FEC_CRS       0x80000000
-                                                       MX53_PAD_KEY_COL2__FEC_RDATA_2   0x80000000
-                                                       MX53_PAD_KEY_COL0__FEC_RDATA_3   0x80000000
-                                                       MX53_PAD_KEY_COL1__FEC_RX_CLK    0x80000000
-                                                       MX53_PAD_KEY_ROW2__FEC_TDATA_2   0x80000000
-                                                       MX53_PAD_GPIO_19__FEC_TDATA_3    0x80000000
-                                                       MX53_PAD_KEY_ROW0__FEC_TX_ER     0x80000000
-                                               >;
-                                       };
-                               };
-
-                               csi {
-                                       pinctrl_csi_1: csigrp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_CSI0_DATA_EN__IPU_CSI0_DATA_EN 0x1d5
-                                                       MX53_PAD_CSI0_VSYNC__IPU_CSI0_VSYNC     0x1d5
-                                                       MX53_PAD_CSI0_MCLK__IPU_CSI0_HSYNC      0x1d5
-                                                       MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK   0x1d5
-                                                       MX53_PAD_CSI0_DAT19__IPU_CSI0_D_19      0x1d5
-                                                       MX53_PAD_CSI0_DAT18__IPU_CSI0_D_18      0x1d5
-                                                       MX53_PAD_CSI0_DAT17__IPU_CSI0_D_17      0x1d5
-                                                       MX53_PAD_CSI0_DAT16__IPU_CSI0_D_16      0x1d5
-                                                       MX53_PAD_CSI0_DAT15__IPU_CSI0_D_15      0x1d5
-                                                       MX53_PAD_CSI0_DAT14__IPU_CSI0_D_14      0x1d5
-                                                       MX53_PAD_CSI0_DAT13__IPU_CSI0_D_13      0x1d5
-                                                       MX53_PAD_CSI0_DAT12__IPU_CSI0_D_12      0x1d5
-                                                       MX53_PAD_CSI0_DAT11__IPU_CSI0_D_11      0x1d5
-                                                       MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10      0x1d5
-                                                       MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9        0x1d5
-                                                       MX53_PAD_CSI0_DAT8__IPU_CSI0_D_8        0x1d5
-                                                       MX53_PAD_CSI0_DAT7__IPU_CSI0_D_7        0x1d5
-                                                       MX53_PAD_CSI0_DAT6__IPU_CSI0_D_6        0x1d5
-                                                       MX53_PAD_CSI0_DAT5__IPU_CSI0_D_5        0x1d5
-                                                       MX53_PAD_CSI0_DAT4__IPU_CSI0_D_4        0x1d5
-                                                       MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK   0x1d5
-                                               >;
-                                       };
-
-                                       pinctrl_csi_2: csigrp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_CSI0_VSYNC__IPU_CSI0_VSYNC     0x1d5
-                                                       MX53_PAD_CSI0_MCLK__IPU_CSI0_HSYNC      0x1d5
-                                                       MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK   0x1d5
-                                                       MX53_PAD_CSI0_DAT19__IPU_CSI0_D_19      0x1d5
-                                                       MX53_PAD_CSI0_DAT18__IPU_CSI0_D_18      0x1d5
-                                                       MX53_PAD_CSI0_DAT17__IPU_CSI0_D_17      0x1d5
-                                                       MX53_PAD_CSI0_DAT16__IPU_CSI0_D_16      0x1d5
-                                                       MX53_PAD_CSI0_DAT15__IPU_CSI0_D_15      0x1d5
-                                                       MX53_PAD_CSI0_DAT14__IPU_CSI0_D_14      0x1d5
-                                                       MX53_PAD_CSI0_DAT13__IPU_CSI0_D_13      0x1d5
-                                                       MX53_PAD_CSI0_DAT12__IPU_CSI0_D_12      0x1d5
-                                               >;
-                                       };
-                               };
-
-                               cspi {
-                                       pinctrl_cspi_1: cspigrp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_SD1_DATA0__CSPI_MISO 0x1d5
-                                                       MX53_PAD_SD1_CMD__CSPI_MOSI   0x1d5
-                                                       MX53_PAD_SD1_CLK__CSPI_SCLK   0x1d5
-                                               >;
-                                       };
-
-                                       pinctrl_cspi_2: cspigrp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_EIM_D22__CSPI_MISO 0x1d5
-                                                       MX53_PAD_EIM_D28__CSPI_MOSI 0x1d5
-                                                       MX53_PAD_EIM_D21__CSPI_SCLK 0x1d5
-                                               >;
-                                       };
-                               };
-
-                               ecspi1 {
-                                       pinctrl_ecspi1_1: ecspi1grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_EIM_D16__ECSPI1_SCLK 0x80000000
-                                                       MX53_PAD_EIM_D17__ECSPI1_MISO 0x80000000
-                                                       MX53_PAD_EIM_D18__ECSPI1_MOSI 0x80000000
-                                               >;
-                                       };
-
-                                       pinctrl_ecspi1_2: ecspi1grp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_GPIO_19__ECSPI1_RDY    0x80000000
-                                                       MX53_PAD_EIM_EB2__ECSPI1_SS0    0x80000000
-                                                       MX53_PAD_EIM_D16__ECSPI1_SCLK   0x80000000
-                                                       MX53_PAD_EIM_D17__ECSPI1_MISO   0x80000000
-                                                       MX53_PAD_EIM_D18__ECSPI1_MOSI   0x80000000
-                                                       MX53_PAD_EIM_D19__ECSPI1_SS1    0x80000000
-                                               >;
-                                       };
-                               };
-
-                               ecspi2 {
-                                       pinctrl_ecspi2_1: ecspi2grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_EIM_OE__ECSPI2_MISO  0x80000000
-                                                       MX53_PAD_EIM_CS1__ECSPI2_MOSI 0x80000000
-                                                       MX53_PAD_EIM_CS0__ECSPI2_SCLK 0x80000000
-                                               >;
-                                       };
-                               };
-
-                               esdhc1 {
-                                       pinctrl_esdhc1_1: esdhc1grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_SD1_DATA0__ESDHC1_DAT0 0x1d5
-                                                       MX53_PAD_SD1_DATA1__ESDHC1_DAT1 0x1d5
-                                                       MX53_PAD_SD1_DATA2__ESDHC1_DAT2 0x1d5
-                                                       MX53_PAD_SD1_DATA3__ESDHC1_DAT3 0x1d5
-                                                       MX53_PAD_SD1_CMD__ESDHC1_CMD    0x1d5
-                                                       MX53_PAD_SD1_CLK__ESDHC1_CLK    0x1d5
-                                               >;
-                                       };
-
-                                       pinctrl_esdhc1_2: esdhc1grp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_SD1_DATA0__ESDHC1_DAT0   0x1d5
-                                                       MX53_PAD_SD1_DATA1__ESDHC1_DAT1   0x1d5
-                                                       MX53_PAD_SD1_DATA2__ESDHC1_DAT2   0x1d5
-                                                       MX53_PAD_SD1_DATA3__ESDHC1_DAT3   0x1d5
-                                                       MX53_PAD_PATA_DATA8__ESDHC1_DAT4  0x1d5
-                                                       MX53_PAD_PATA_DATA9__ESDHC1_DAT5  0x1d5
-                                                       MX53_PAD_PATA_DATA10__ESDHC1_DAT6 0x1d5
-                                                       MX53_PAD_PATA_DATA11__ESDHC1_DAT7 0x1d5
-                                                       MX53_PAD_SD1_CMD__ESDHC1_CMD      0x1d5
-                                                       MX53_PAD_SD1_CLK__ESDHC1_CLK      0x1d5
-                                               >;
-                                       };
-                               };
-
-                               esdhc2 {
-                                       pinctrl_esdhc2_1: esdhc2grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_SD2_CMD__ESDHC2_CMD    0x1d5
-                                                       MX53_PAD_SD2_CLK__ESDHC2_CLK    0x1d5
-                                                       MX53_PAD_SD2_DATA0__ESDHC2_DAT0 0x1d5
-                                                       MX53_PAD_SD2_DATA1__ESDHC2_DAT1 0x1d5
-                                                       MX53_PAD_SD2_DATA2__ESDHC2_DAT2 0x1d5
-                                                       MX53_PAD_SD2_DATA3__ESDHC2_DAT3 0x1d5
-                                               >;
-                                       };
-                               };
-
-                               esdhc3 {
-                                       pinctrl_esdhc3_1: esdhc3grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_PATA_DATA8__ESDHC3_DAT0  0x1d5
-                                                       MX53_PAD_PATA_DATA9__ESDHC3_DAT1  0x1d5
-                                                       MX53_PAD_PATA_DATA10__ESDHC3_DAT2 0x1d5
-                                                       MX53_PAD_PATA_DATA11__ESDHC3_DAT3 0x1d5
-                                                       MX53_PAD_PATA_DATA0__ESDHC3_DAT4  0x1d5
-                                                       MX53_PAD_PATA_DATA1__ESDHC3_DAT5  0x1d5
-                                                       MX53_PAD_PATA_DATA2__ESDHC3_DAT6  0x1d5
-                                                       MX53_PAD_PATA_DATA3__ESDHC3_DAT7  0x1d5
-                                                       MX53_PAD_PATA_RESET_B__ESDHC3_CMD 0x1d5
-                                                       MX53_PAD_PATA_IORDY__ESDHC3_CLK   0x1d5
-                                               >;
-                                       };
-                               };
-
-                               can1 {
-                                       pinctrl_can1_1: can1grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_PATA_INTRQ__CAN1_TXCAN 0x80000000
-                                                       MX53_PAD_PATA_DIOR__CAN1_RXCAN  0x80000000
-                                               >;
-                                       };
-
-                                       pinctrl_can1_2: can1grp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_KEY_COL2__CAN1_TXCAN 0x80000000
-                                                       MX53_PAD_KEY_ROW2__CAN1_RXCAN 0x80000000
-                                               >;
-                                       };
-
-                                       pinctrl_can1_3: can1grp-3 {
-                                               fsl,pins = <
-                                                       MX53_PAD_GPIO_7__CAN1_TXCAN     0x80000000
-                                                       MX53_PAD_GPIO_8__CAN1_RXCAN     0x80000000
-                                               >;
-                                       };
-                               };
-
-                               can2 {
-                                       pinctrl_can2_1: can2grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_KEY_COL4__CAN2_TXCAN 0x80000000
-                                                       MX53_PAD_KEY_ROW4__CAN2_RXCAN 0x80000000
-                                               >;
-                                       };
-                               };
-
-                               i2c1 {
-                                       pinctrl_i2c1_1: i2c1grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_CSI0_DAT8__I2C1_SDA 0xc0000000
-                                                       MX53_PAD_CSI0_DAT9__I2C1_SCL 0xc0000000
-                                               >;
-                                       };
-
-                                       pinctrl_i2c1_2: i2c1grp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_EIM_D21__I2C1_SCL      0xc0000000
-                                                       MX53_PAD_EIM_D28__I2C1_SDA      0xc0000000
-                                               >;
-                                       };
-                               };
-
-                               i2c2 {
-                                       pinctrl_i2c2_1: i2c2grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_KEY_ROW3__I2C2_SDA 0xc0000000
-                                                       MX53_PAD_KEY_COL3__I2C2_SCL 0xc0000000
-                                               >;
-                                       };
-
-                                       pinctrl_i2c2_2: i2c2grp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_EIM_D16__I2C2_SDA      0xc0000000
-                                                       MX53_PAD_EIM_EB2__I2C2_SCL      0xc0000000
-                                               >;
-                                       };
-                               };
-
-                               i2c3 {
-                                       pinctrl_i2c3_1: i2c3grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_GPIO_6__I2C3_SDA 0xc0000000
-                                                       MX53_PAD_GPIO_5__I2C3_SCL 0xc0000000
-                                               >;
-                                       };
-                               };
-
-                               ipu_disp0 {
-                                       pinctrl_ipu_disp0_1: ipudisp0grp-1 {
-                                               fsl,pins = <
-                                               MX53_PAD_DI0_DISP_CLK__IPU_DI0_DISP_CLK 0x5
-                                               MX53_PAD_DI0_PIN15__IPU_DI0_PIN15               0x5
-                                               MX53_PAD_DI0_PIN2__IPU_DI0_PIN2         0x5
-                                               MX53_PAD_DI0_PIN3__IPU_DI0_PIN3                 0x5
-                                               MX53_PAD_DISP0_DAT0__IPU_DISP0_DAT_0            0x5
-                                               MX53_PAD_DISP0_DAT1__IPU_DISP0_DAT_1            0x5
-                                               MX53_PAD_DISP0_DAT2__IPU_DISP0_DAT_2            0x5
-                                               MX53_PAD_DISP0_DAT3__IPU_DISP0_DAT_3            0x5
-                                               MX53_PAD_DISP0_DAT4__IPU_DISP0_DAT_4            0x5
-                                               MX53_PAD_DISP0_DAT5__IPU_DISP0_DAT_5            0x5
-                                               MX53_PAD_DISP0_DAT6__IPU_DISP0_DAT_6            0x5
-                                               MX53_PAD_DISP0_DAT7__IPU_DISP0_DAT_7            0x5
-                                               MX53_PAD_DISP0_DAT8__IPU_DISP0_DAT_8            0x5
-                                               MX53_PAD_DISP0_DAT9__IPU_DISP0_DAT_9            0x5
-                                               MX53_PAD_DISP0_DAT10__IPU_DISP0_DAT_10          0x5
-                                               MX53_PAD_DISP0_DAT11__IPU_DISP0_DAT_11          0x5
-                                               MX53_PAD_DISP0_DAT12__IPU_DISP0_DAT_12          0x5
-                                               MX53_PAD_DISP0_DAT13__IPU_DISP0_DAT_13          0x5
-                                               MX53_PAD_DISP0_DAT14__IPU_DISP0_DAT_14          0x5
-                                               MX53_PAD_DISP0_DAT15__IPU_DISP0_DAT_15          0x5
-                                               MX53_PAD_DISP0_DAT16__IPU_DISP0_DAT_16          0x5
-                                               MX53_PAD_DISP0_DAT17__IPU_DISP0_DAT_17          0x5
-                                               MX53_PAD_DISP0_DAT18__IPU_DISP0_DAT_18          0x5
-                                               MX53_PAD_DISP0_DAT19__IPU_DISP0_DAT_19          0x5
-                                               MX53_PAD_DISP0_DAT20__IPU_DISP0_DAT_20          0x5
-                                               MX53_PAD_DISP0_DAT21__IPU_DISP0_DAT_21          0x5
-                                               MX53_PAD_DISP0_DAT22__IPU_DISP0_DAT_22          0x5
-                                               MX53_PAD_DISP0_DAT23__IPU_DISP0_DAT_23          0x5
-                                               >;
-                                       };
-                               };
-
-                               ipu_disp1 {
-                                       pinctrl_ipu_disp1_1: ipudisp1grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_EIM_DA9__IPU_DISP1_DAT_0       0x5
-                                                       MX53_PAD_EIM_DA8__IPU_DISP1_DAT_1       0x5
-                                                       MX53_PAD_EIM_DA7__IPU_DISP1_DAT_2       0x5
-                                                       MX53_PAD_EIM_DA6__IPU_DISP1_DAT_3       0x5
-                                                       MX53_PAD_EIM_DA5__IPU_DISP1_DAT_4       0x5
-                                                       MX53_PAD_EIM_DA4__IPU_DISP1_DAT_5       0x5
-                                                       MX53_PAD_EIM_DA3__IPU_DISP1_DAT_6       0x5
-                                                       MX53_PAD_EIM_DA2__IPU_DISP1_DAT_7       0x5
-                                                       MX53_PAD_EIM_DA1__IPU_DISP1_DAT_8       0x5
-                                                       MX53_PAD_EIM_DA0__IPU_DISP1_DAT_9       0x5
-                                                       MX53_PAD_EIM_EB1__IPU_DISP1_DAT_10      0x5
-                                                       MX53_PAD_EIM_EB0__IPU_DISP1_DAT_11      0x5
-                                                       MX53_PAD_EIM_A17__IPU_DISP1_DAT_12      0x5
-                                                       MX53_PAD_EIM_A18__IPU_DISP1_DAT_13      0x5
-                                                       MX53_PAD_EIM_A19__IPU_DISP1_DAT_14      0x5
-                                                       MX53_PAD_EIM_A20__IPU_DISP1_DAT_15      0x5
-                                                       MX53_PAD_EIM_A21__IPU_DISP1_DAT_16      0x5
-                                                       MX53_PAD_EIM_A22__IPU_DISP1_DAT_17      0x5
-                                                       MX53_PAD_EIM_A23__IPU_DISP1_DAT_18      0x5
-                                                       MX53_PAD_EIM_A24__IPU_DISP1_DAT_19      0x5
-                                                       MX53_PAD_EIM_D31__IPU_DISP1_DAT_20      0x5
-                                                       MX53_PAD_EIM_D30__IPU_DISP1_DAT_21      0x5
-                                                       MX53_PAD_EIM_D26__IPU_DISP1_DAT_22      0x5
-                                                       MX53_PAD_EIM_D27__IPU_DISP1_DAT_23      0x5
-                                                       MX53_PAD_EIM_A16__IPU_DI1_DISP_CLK      0x5
-                                                       MX53_PAD_EIM_DA13__IPU_DI1_D0_CS        0x5
-                                                       MX53_PAD_EIM_DA14__IPU_DI1_D1_CS        0x5
-                                                       MX53_PAD_EIM_DA15__IPU_DI1_PIN1         0x5
-                                                       MX53_PAD_EIM_DA11__IPU_DI1_PIN2         0x5
-                                                       MX53_PAD_EIM_DA12__IPU_DI1_PIN3         0x5
-                                                       MX53_PAD_EIM_A25__IPU_DI1_PIN12         0x5
-                                                       MX53_PAD_EIM_DA10__IPU_DI1_PIN15        0x5
-                                               >;
-                                       };
-                               };
-
-                               ipu_disp2 {
-                                       pinctrl_ipu_disp2_1: ipudisp2grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0     0x80000000
-                                                       MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1     0x80000000
-                                                       MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2     0x80000000
-                                                       MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3     0x80000000
-                                                       MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK     0x80000000
-                                                       MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0     0x80000000
-                                                       MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1     0x80000000
-                                                       MX53_PAD_LVDS1_TX2_P__LDB_LVDS1_TX2     0x80000000
-                                                       MX53_PAD_LVDS1_TX3_P__LDB_LVDS1_TX3     0x80000000
-                                                       MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK     0x80000000
-                                               >;
-                                       };
-                               };
-
-                               nand {
-                                       pinctrl_nand_1: nandgrp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_NANDF_WE_B__EMI_NANDF_WE_B     0x4
-                                                       MX53_PAD_NANDF_RE_B__EMI_NANDF_RE_B     0x4
-                                                       MX53_PAD_NANDF_CLE__EMI_NANDF_CLE       0x4
-                                                       MX53_PAD_NANDF_ALE__EMI_NANDF_ALE       0x4
-                                                       MX53_PAD_NANDF_WP_B__EMI_NANDF_WP_B     0xe0
-                                                       MX53_PAD_NANDF_RB0__EMI_NANDF_RB_0      0xe0
-                                                       MX53_PAD_NANDF_CS0__EMI_NANDF_CS_0      0x4
-                                                       MX53_PAD_PATA_DATA0__EMI_NANDF_D_0      0xa4
-                                                       MX53_PAD_PATA_DATA1__EMI_NANDF_D_1      0xa4
-                                                       MX53_PAD_PATA_DATA2__EMI_NANDF_D_2      0xa4
-                                                       MX53_PAD_PATA_DATA3__EMI_NANDF_D_3      0xa4
-                                                       MX53_PAD_PATA_DATA4__EMI_NANDF_D_4      0xa4
-                                                       MX53_PAD_PATA_DATA5__EMI_NANDF_D_5      0xa4
-                                                       MX53_PAD_PATA_DATA6__EMI_NANDF_D_6      0xa4
-                                                       MX53_PAD_PATA_DATA7__EMI_NANDF_D_7      0xa4
-                                               >;
-                                       };
-                               };
-
-                               owire {
-                                       pinctrl_owire_1: owiregrp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_GPIO_18__OWIRE_LINE 0x80000000
-                                               >;
-                                       };
-                               };
-
-                               pwm1 {
-                                       pinctrl_pwm1_1: pwm1grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_DISP0_DAT8__PWM1_PWMO  0x5
-                                               >;
-                                       };
-                               };
-
-                               pwm2 {
-                                       pinctrl_pwm2_1: pwm2grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_GPIO_1__PWM2_PWMO      0x80000000
-                                               >;
-                                       };
-                               };
-
-                               uart1 {
-                                       pinctrl_uart1_1: uart1grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_CSI0_DAT10__UART1_TXD_MUX 0x1e4
-                                                       MX53_PAD_CSI0_DAT11__UART1_RXD_MUX 0x1e4
-                                               >;
-                                       };
-
-                                       pinctrl_uart1_2: uart1grp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_PATA_DIOW__UART1_TXD_MUX  0x1e4
-                                                       MX53_PAD_PATA_DMACK__UART1_RXD_MUX 0x1e4
-                                               >;
-                                       };
-
-                                       pinctrl_uart1_3: uart1grp-3 {
-                                               fsl,pins = <
-                                                       MX53_PAD_PATA_RESET_B__UART1_CTS 0x1c5
-                                                       MX53_PAD_PATA_IORDY__UART1_RTS   0x1c5
-                                               >;
-                                       };
-                               };
-
-                               uart2 {
-                                       pinctrl_uart2_1: uart2grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX 0x1e4
-                                                       MX53_PAD_PATA_DMARQ__UART2_TXD_MUX     0x1e4
-                                               >;
-                                       };
-
-                                       pinctrl_uart2_2: uart2grp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX  0x1c5
-                                                       MX53_PAD_PATA_DMARQ__UART2_TXD_MUX      0x1c5
-                                                       MX53_PAD_PATA_DIOR__UART2_RTS           0x1c5
-                                                       MX53_PAD_PATA_INTRQ__UART2_CTS          0x1c5
-                                               >;
-                                       };
-                               };
-
-                               uart3 {
-                                       pinctrl_uart3_1: uart3grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_PATA_CS_0__UART3_TXD_MUX 0x1e4
-                                                       MX53_PAD_PATA_CS_1__UART3_RXD_MUX 0x1e4
-                                                       MX53_PAD_PATA_DA_1__UART3_CTS     0x1e4
-                                                       MX53_PAD_PATA_DA_2__UART3_RTS     0x1e4
-                                               >;
-                                       };
-
-                                       pinctrl_uart3_2: uart3grp-2 {
-                                               fsl,pins = <
-                                                       MX53_PAD_PATA_CS_0__UART3_TXD_MUX 0x1e4
-                                                       MX53_PAD_PATA_CS_1__UART3_RXD_MUX 0x1e4
-                                               >;
-                                       };
-
-                               };
-
-                               uart4 {
-                                       pinctrl_uart4_1: uart4grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_KEY_COL0__UART4_TXD_MUX 0x1e4
-                                                       MX53_PAD_KEY_ROW0__UART4_RXD_MUX 0x1e4
-                                               >;
-                                       };
-                               };
-
-                               uart5 {
-                                       pinctrl_uart5_1: uart5grp-1 {
-                                               fsl,pins = <
-                                                       MX53_PAD_KEY_COL1__UART5_TXD_MUX 0x1e4
-                                                       MX53_PAD_KEY_ROW1__UART5_RXD_MUX 0x1e4
-                                               >;
-                                       };
-                               };
                        };
 
                        gpr: iomuxc-gpr@53fa8000 {
                                compatible = "fsl,imx53-ldb";
                                reg = <0x53fa8008 0x4>;
                                gpr = <&gpr>;
-                               clocks = <&clks 122>, <&clks 120>,
-                                        <&clks 115>, <&clks 116>,
-                                        <&clks 123>, <&clks 85>;
+                               clocks = <&clks IMX5_CLK_LDB_DI0_SEL>,
+                                        <&clks IMX5_CLK_LDB_DI1_SEL>,
+                                        <&clks IMX5_CLK_IPU_DI0_SEL>,
+                                        <&clks IMX5_CLK_IPU_DI1_SEL>,
+                                        <&clks IMX5_CLK_LDB_DI0_GATE>,
+                                        <&clks IMX5_CLK_LDB_DI1_GATE>;
                                clock-names = "di0_pll", "di1_pll",
                                              "di0_sel", "di1_sel",
                                              "di0", "di1";
                                #pwm-cells = <2>;
                                compatible = "fsl,imx53-pwm", "fsl,imx27-pwm";
                                reg = <0x53fb4000 0x4000>;
-                               clocks = <&clks 37>, <&clks 38>;
+                               clocks = <&clks IMX5_CLK_PWM1_IPG_GATE>,
+                                        <&clks IMX5_CLK_PWM1_HF_GATE>;
                                clock-names = "ipg", "per";
                                interrupts = <61>;
                        };
                                #pwm-cells = <2>;
                                compatible = "fsl,imx53-pwm", "fsl,imx27-pwm";
                                reg = <0x53fb8000 0x4000>;
-                               clocks = <&clks 39>, <&clks 40>;
+                               clocks = <&clks IMX5_CLK_PWM2_IPG_GATE>,
+                                        <&clks IMX5_CLK_PWM2_HF_GATE>;
                                clock-names = "ipg", "per";
                                interrupts = <94>;
                        };
                                compatible = "fsl,imx53-uart", "fsl,imx21-uart";
                                reg = <0x53fbc000 0x4000>;
                                interrupts = <31>;
-                               clocks = <&clks 28>, <&clks 29>;
+                               clocks = <&clks IMX5_CLK_UART1_IPG_GATE>,
+                                        <&clks IMX5_CLK_UART1_PER_GATE>;
                                clock-names = "ipg", "per";
                                status = "disabled";
                        };
                                compatible = "fsl,imx53-uart", "fsl,imx21-uart";
                                reg = <0x53fc0000 0x4000>;
                                interrupts = <32>;
-                               clocks = <&clks 30>, <&clks 31>;
+                               clocks = <&clks IMX5_CLK_UART2_IPG_GATE>,
+                                        <&clks IMX5_CLK_UART2_PER_GATE>;
                                clock-names = "ipg", "per";
                                status = "disabled";
                        };
                                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";
                        };
                                compatible = "fsl,imx53-flexcan", "fsl,p1010-flexcan";
                                reg = <0x53fcc000 0x4000>;
                                interrupts = <83>;
-                               clocks = <&clks 87>, <&clks 86>;
+                               clocks = <&clks IMX5_CLK_CAN2_IPG_GATE>,
+                                        <&clks IMX5_CLK_CAN2_SERIAL_GATE>;
                                clock-names = "ipg", "per";
                                status = "disabled";
                        };
                                compatible = "fsl,imx53-i2c", "fsl,imx21-i2c";
                                reg = <0x53fec000 0x4000>;
                                interrupts = <64>;
-                               clocks = <&clks 88>;
+                               clocks = <&clks IMX5_CLK_I2C3_GATE>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx53-uart", "fsl,imx21-uart";
                                reg = <0x53ff0000 0x4000>;
                                interrupts = <13>;
-                               clocks = <&clks 65>, <&clks 66>;
+                               clocks = <&clks IMX5_CLK_UART4_IPG_GATE>,
+                                        <&clks IMX5_CLK_UART4_PER_GATE>;
                                clock-names = "ipg", "per";
                                status = "disabled";
                        };
                                compatible = "fsl,imx53-iim", "fsl,imx27-iim";
                                reg = <0x63f98000 0x4000>;
                                interrupts = <69>;
-                               clocks = <&clks 107>;
+                               clocks = <&clks IMX5_CLK_IIM_GATE>;
                        };
 
                        uart5: serial@63f90000 {
                                compatible = "fsl,imx53-uart", "fsl,imx21-uart";
                                reg = <0x63f90000 0x4000>;
                                interrupts = <86>;
-                               clocks = <&clks 67>, <&clks 68>;
+                               clocks = <&clks IMX5_CLK_UART5_IPG_GATE>,
+                                        <&clks IMX5_CLK_UART5_PER_GATE>;
                                clock-names = "ipg", "per";
                                status = "disabled";
                        };
                        owire: owire@63fa4000 {
                                compatible = "fsl,imx53-owire", "fsl,imx21-owire";
                                reg = <0x63fa4000 0x4000>;
-                               clocks = <&clks 159>;
+                               clocks = <&clks IMX5_CLK_OWIRE_GATE>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx53-ecspi", "fsl,imx51-ecspi";
                                reg = <0x63fac000 0x4000>;
                                interrupts = <37>;
-                               clocks = <&clks 53>, <&clks 54>;
+                               clocks = <&clks IMX5_CLK_ECSPI2_IPG_GATE>,
+                                        <&clks IMX5_CLK_ECSPI2_PER_GATE>;
                                clock-names = "ipg", "per";
                                status = "disabled";
                        };
                                compatible = "fsl,imx53-sdma", "fsl,imx35-sdma";
                                reg = <0x63fb0000 0x4000>;
                                interrupts = <6>;
-                               clocks = <&clks 56>, <&clks 56>;
+                               clocks = <&clks IMX5_CLK_SDMA_GATE>,
+                                        <&clks IMX5_CLK_SDMA_GATE>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
                                fsl,sdma-ram-script-name = "imx/sdma/sdma-imx53.bin";
                                compatible = "fsl,imx53-cspi", "fsl,imx35-cspi";
                                reg = <0x63fc0000 0x4000>;
                                interrupts = <38>;
-                               clocks = <&clks 55>, <&clks 55>;
+                               clocks = <&clks IMX5_CLK_CSPI_IPG_GATE>,
+                                        <&clks IMX5_CLK_CSPI_IPG_GATE>;
                                clock-names = "ipg", "per";
                                status = "disabled";
                        };
                                compatible = "fsl,imx53-i2c", "fsl,imx21-i2c";
                                reg = <0x63fc4000 0x4000>;
                                interrupts = <63>;
-                               clocks = <&clks 35>;
+                               clocks = <&clks IMX5_CLK_I2C2_GATE>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx53-i2c", "fsl,imx21-i2c";
                                reg = <0x63fc8000 0x4000>;
                                interrupts = <62>;
-                               clocks = <&clks 34>;
+                               clocks = <&clks IMX5_CLK_I2C1_GATE>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx53-ssi", "fsl,imx21-ssi";
                                reg = <0x63fcc000 0x4000>;
                                interrupts = <29>;
-                               clocks = <&clks 48>;
+                               clocks = <&clks IMX5_CLK_SSI1_IPG_GATE>;
                                dmas = <&sdma 28 0 0>,
                                       <&sdma 29 0 0>;
                                dma-names = "rx", "tx";
                                compatible = "fsl,imx53-nand";
                                reg = <0x63fdb000 0x1000 0xf7ff0000 0x10000>;
                                interrupts = <8>;
-                               clocks = <&clks 60>;
+                               clocks = <&clks IMX5_CLK_NFC_GATE>;
                                status = "disabled";
                        };
 
                                compatible = "fsl,imx53-ssi", "fsl,imx21-ssi";
                                reg = <0x63fe8000 0x4000>;
                                interrupts = <96>;
-                               clocks = <&clks 50>;
+                               clocks = <&clks IMX5_CLK_SSI3_IPG_GATE>;
                                dmas = <&sdma 46 0 0>,
                                       <&sdma 47 0 0>;
                                dma-names = "rx", "tx";
                                compatible = "fsl,imx53-fec", "fsl,imx25-fec";
                                reg = <0x63fec000 0x4000>;
                                interrupts = <87>;
-                               clocks = <&clks 42>, <&clks 42>, <&clks 42>;
+                               clocks = <&clks IMX5_CLK_FEC_GATE>,
+                                        <&clks IMX5_CLK_FEC_GATE>,
+                                        <&clks IMX5_CLK_FEC_GATE>;
                                clock-names = "ipg", "ahb", "ptp";
                                status = "disabled";
                        };
                                compatible = "fsl,imx53-tve";
                                reg = <0x63ff0000 0x1000>;
                                interrupts = <92>;
-                               clocks = <&clks 69>, <&clks 116>;
+                               clocks = <&clks IMX5_CLK_TVE_GATE>,
+                                        <&clks IMX5_CLK_IPU_DI1_SEL>;
                                clock-names = "tve", "di_sel";
                                crtcs = <&ipu 1>;
                                status = "disabled";
                                compatible = "fsl,imx53-vpu";
                                reg = <0x63ff4000 0x1000>;
                                interrupts = <9>;
-                               clocks = <&clks 63>, <&clks 63>;
+                               clocks = <&clks IMX5_CLK_VPU_GATE>,
+                                        <&clks IMX5_CLK_VPU_GATE>;
                                clock-names = "per", "ahb";
                                iram = <&ocram>;
                                status = "disabled";
                ocram: sram@f8000000 {
                        compatible = "mmio-sram";
                        reg = <0xf8000000 0x20000>;
-                       clocks = <&clks 186>;
+                       clocks = <&clks IMX5_CLK_OCRAM>;
                };
        };
 };
diff --git a/arch/arm/boot/dts/imx6dl-gw51xx.dts b/arch/arm/boot/dts/imx6dl-gw51xx.dts
new file mode 100644 (file)
index 0000000..4bd055f
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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 "imx6dl.dtsi"
+#include "imx6qdl-gw51xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite GW51XX";
+       compatible = "gw,imx6dl-gw51xx", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/boot/dts/imx6dl-gw52xx.dts b/arch/arm/boot/dts/imx6dl-gw52xx.dts
new file mode 100644 (file)
index 0000000..c913605
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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 "imx6dl.dtsi"
+#include "imx6qdl-gw52xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite GW52XX";
+       compatible = "gw,imx6dl-gw52xx", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/boot/dts/imx6dl-gw53xx.dts b/arch/arm/boot/dts/imx6dl-gw53xx.dts
new file mode 100644 (file)
index 0000000..61818a1
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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 "imx6dl.dtsi"
+#include "imx6qdl-gw53xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite GW53XX";
+       compatible = "gw,imx6dl-gw53xx", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/boot/dts/imx6dl-gw54xx.dts b/arch/arm/boot/dts/imx6dl-gw54xx.dts
new file mode 100644 (file)
index 0000000..ab38b67
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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 "imx6dl.dtsi"
+#include "imx6qdl-gw54xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite GW54XX";
+       compatible = "gw,imx6dl-gw54xx", "gw,ventana", "fsl,imx6dl";
+};
index b81a7a4ebab6758926143ebd51d59b033a51df23..7499eee1dc923f3d28698bb173ae458711a9b62d 100644 (file)
 #define MX6QDL_PAD_RGMII_TXC__GPIO6_IO19            0x2d8 0x6c0 0x000 0x5 0x0
 #define MX6QDL_PAD_RGMII_TXC__XTALOSC_REF_CLK_24M   0x2d8 0x6c0 0x000 0x7 0x0
 #define MX6QDL_PAD_SD1_CLK__SD1_CLK                 0x2dc 0x6c4 0x928 0x0 0x1
+#define MX6QDL_PAD_SD1_CLK__OSC32K_32K_OUT          0x2dc 0x6c4 0x000 0x2 0x0
 #define MX6QDL_PAD_SD1_CLK__GPT_CLKIN               0x2dc 0x6c4 0x000 0x3 0x0
 #define MX6QDL_PAD_SD1_CLK__GPIO1_IO20              0x2dc 0x6c4 0x000 0x5 0x0
 #define MX6QDL_PAD_SD1_CMD__SD1_CMD                 0x2e0 0x6c8 0x000 0x0 0x0
index 9e8ae118fdd4e6c6c1df48a0b4a66c20e0504ae6..b2f2699e6dcaa0cfa3dd7bbaad1e678ee3993b5d 100644 (file)
@@ -8,7 +8,9 @@
  *
  */
 
+#include <dt-bindings/interrupt-controller/irq.h>
 #include "imx6dl-pinfunc.h"
+#include "imx6qdl-pingrp.h"
 #include "imx6qdl.dtsi"
 
 / {
 
                        pxp: pxp@020f0000 {
                                reg = <0x020f0000 0x4000>;
-                               interrupts = <0 98 0x04>;
+                               interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        epdc: epdc@020f4000 {
                                reg = <0x020f4000 0x4000>;
-                               interrupts = <0 97 0x04>;
+                               interrupts = <0 97 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        lcdif: lcdif@020f8000 {
                                reg = <0x020f8000 0x4000>;
-                               interrupts = <0 39 0x04>;
+                               interrupts = <0 39 IRQ_TYPE_LEVEL_HIGH>;
                        };
                };
 
@@ -65,7 +67,7 @@
                                #size-cells = <0>;
                                compatible = "fsl,imx1-i2c";
                                reg = <0x021f8000 0x4000>;
-                               interrupts = <0 35 0x04>;
+                               interrupts = <0 35 IRQ_TYPE_LEVEL_HIGH>;
                                status = "disabled";
                        };
                };
index edf1bd9671642e9230b61d71c55a18a7b7c2a554..9c00b739dc3024371263c0195909647eff1369ae 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_3p3v: 3p3v {
+               reg_3p3v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "3P3V";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        regulator-always-on;
                };
+
+               reg_usb_otg_vbus: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "usb_otg_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio3 22 0>;
+                       enable-active-high;
+               };
        };
 
        leds {
@@ -46,7 +59,7 @@
 
 &gpmi {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_gpmi_nand_1>;
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
        status = "disabled"; /* gpmi nand conflicts with SD */
 };
 
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx6q-arm2 {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX6QDL_PAD_EIM_D25__GPIO3_IO25 0x80000000
                        >;
                };
-       };
 
-       arm2 {
-               pinctrl_usdhc3_arm2: usdhc3grp-arm2 {
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP2>;
+               };
+
+               pinctrl_gpmi_nand: gpminandgrp {
+                       fsl,pins = <MX6QDL_GPMI_NAND_PINGRP1>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX6QDL_UART2_PINGRP2>;
+               };
+
+               pinctrl_uart4: uart4grp {
+                       fsl,pins = <MX6QDL_UART4_PINGRP1>;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <MX6QDL_USBOTG_PINGRP1>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D8>;
+               };
+
+               pinctrl_usdhc3_cdwp: usdhc3cdwp {
                        fsl,pins = <
                                MX6QDL_PAD_NANDF_CS0__GPIO6_IO11 0x80000000
                                MX6QDL_PAD_NANDF_CS1__GPIO6_IO14 0x80000000
                        >;
                };
+
+               pinctrl_usdhc4: usdhc4grp {
+                       fsl,pins = <MX6QDL_USDHC4_PINGRP_D8>;
+               };
        };
 };
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_enet_2>;
+       pinctrl-0 = <&pinctrl_enet>;
        phy-mode = "rgmii";
        status = "okay";
 };
 
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       status = "okay";
+};
+
 &usdhc3 {
        cd-gpios = <&gpio6 11 0>;
        wp-gpios = <&gpio6 14 0>;
        vmmc-supply = <&reg_3p3v>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc3_1
-                    &pinctrl_usdhc3_arm2>;
+       pinctrl-0 = <&pinctrl_usdhc3
+                    &pinctrl_usdhc3_cdwp>;
        status = "okay";
 };
 
        non-removable;
        vmmc-supply = <&reg_3p3v>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc4_1>;
+       pinctrl-0 = <&pinctrl_usdhc4>;
        status = "okay";
 };
 
 &uart2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart2_2>;
+       pinctrl-0 = <&pinctrl_uart2>;
        fsl,dte-mode;
        fsl,uart-has-rtscts;
        status = "okay";
 
 &uart4 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart4_1>;
+       pinctrl-0 = <&pinctrl_uart4>;
        status = "okay";
 };
diff --git a/arch/arm/boot/dts/imx6q-cm-fx6.dts b/arch/arm/boot/dts/imx6q-cm-fx6.dts
new file mode 100644 (file)
index 0000000..1a8ee79
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2013 CompuLab Ltd.
+ *
+ * Author: Valentin Raevsky <valentin@compulab.co.il>
+ *
+ * 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 "imx6q.dtsi"
+
+/ {
+       model = "CompuLab CM-FX6";
+       compatible = "compulab,cm-fx6", "fsl,imx6q";
+
+       memory {
+               reg = <0x10000000 0x80000000>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               heartbeat-led {
+                       label = "Heartbeat";
+                       gpios = <&gpio2 31 0>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii";
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&iomuxc {
+       imx6q-cm-fx6 {
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_gpmi_nand: gpminandgrp {
+                       fsl,pins = <MX6QDL_GPMI_NAND_PINGRP1>;
+               };
+
+               pinctrl_uart4: uart4grp {
+                       fsl,pins = <MX6QDL_UART4_PINGRP1>;
+               };
+       };
+};
+
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts b/arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
new file mode 100644 (file)
index 0000000..84f5143
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Copyright 2013 Data Modul AG
+ *
+ * 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 "imx6q.dtsi"
+
+/ {
+       model = "Data Modul eDM-QMX6 Board";
+       compatible = "dmo,imx6q-edmqmx6", "fsl,imx6q";
+
+       aliases {
+               gpio7 = &stmpe_gpio;
+       };
+
+       memory {
+               reg = <0x10000000 0x80000000>;
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_3p3v: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_otg_vbus: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "usb_otg_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio7 12 0>;
+               };
+
+               reg_usb_host1: regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "usb_host1_en";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       gpio = <&gpio3 31 0>;
+                       enable-active-high;
+               };
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii";
+       phy-reset-gpios = <&gpio3 23 0>;
+       status = "okay";
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2
+                    &pinctrl_stmpe>;
+       status = "okay";
+
+       stmpe: stmpe1601@40 {
+               compatible = "st,stmpe1601";
+               reg = <0x40>;
+               interrupts = <30 0>;
+               interrupt-parent = <&gpio3>;
+
+               stmpe_gpio: stmpe_gpio {
+                       compatible = "st,stmpe-gpio";
+               };
+       };
+
+       temp1: ad7414@4c {
+               compatible = "ad,ad7414";
+               reg = <0x4c>;
+       };
+
+       temp2: ad7414@4d {
+               compatible = "ad,ad7414";
+               reg = <0x4d>;
+       };
+
+       rtc: m41t62@68 {
+               compatible = "stm,m41t62";
+               reg = <0x68>;
+       };
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog>;
+
+       imx6q-dmo-edmqmx6 {
+               pinctrl_hog: hoggrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_EIM_A16__GPIO2_IO22 0x80000000
+                               MX6QDL_PAD_EIM_A17__GPIO2_IO21 0x80000000
+                       >;
+               };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX6QDL_I2C2_PINGRP3>;
+               };
+
+               pinctrl_stmpe: stmpegrp {
+                       fsl,pins = <MX6QDL_PAD_EIM_D30__GPIO3_IO30 0x80000000>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX6QDL_UART1_PINGRP2>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX6QDL_UART2_PINGRP1>;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <MX6QDL_USBOTG_PINGRP1>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D4>;
+               };
+       };
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_host1>;
+       disable-over-current;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       vmmc-supply = <&reg_3p3v>;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx6q-gw51xx.dts b/arch/arm/boot/dts/imx6q-gw51xx.dts
new file mode 100644 (file)
index 0000000..af4929a
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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 "imx6q.dtsi"
+#include "imx6qdl-gw54xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Quad GW51XX";
+       compatible = "gw,imx6q-gw51xx", "gw,ventana", "fsl,imx6q";
+};
diff --git a/arch/arm/boot/dts/imx6q-gw52xx.dts b/arch/arm/boot/dts/imx6q-gw52xx.dts
new file mode 100644 (file)
index 0000000..5f71ddb
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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 "imx6q.dtsi"
+#include "imx6qdl-gw52xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Quad GW52XX";
+       compatible = "gw,imx6q-gw52xx", "gw,ventana", "fsl,imx6q";
+};
+
+&sata {
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx6q-gw53xx.dts b/arch/arm/boot/dts/imx6q-gw53xx.dts
new file mode 100644 (file)
index 0000000..360c316
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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 "imx6q.dtsi"
+#include "imx6qdl-gw53xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Quad GW53XX";
+       compatible = "gw,imx6q-gw53xx", "gw,ventana", "fsl,imx6q";
+};
+
+&sata {
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx6q-gw5400-a.dts b/arch/arm/boot/dts/imx6q-gw5400-a.dts
new file mode 100644 (file)
index 0000000..5f76342
--- /dev/null
@@ -0,0 +1,493 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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 "imx6q.dtsi"
+
+/ {
+       model = "Gateworks Ventana GW5400-A";
+       compatible = "gw,imx6q-gw5400-a", "gw,ventana", "fsl,imx6q";
+
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               ethernet0 = &fec;
+               ethernet1 = &eth1;
+               i2c0 = &i2c1;
+               i2c1 = &i2c2;
+               i2c2 = &i2c3;
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               sky2 = &eth1;
+               ssi0 = &ssi1;
+               spi0 = &ecspi1;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+               usdhc2 = &usdhc3;
+       };
+
+       chosen {
+               bootargs = "console=ttymxc1,115200";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 0>; /* 102 -> MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 10 0>; /* 106 -> MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 1>; /* 111 -> MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory {
+               reg = <0x10000000 0x40000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               gpios = <&gpio1 5 0>;
+               status = "okay";
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_1p0v: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "1P0V";
+                       regulator-min-microvolt = <1000000>;
+                       regulator-max-microvolt = <1000000>;
+                       regulator-always-on;
+               };
+
+               reg_3p3v: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_h1_vbus: regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "usb_h1_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_otg_vbus: regulator@3 {
+                       compatible = "regulator-fixed";
+                       reg = <3>;
+                       regulator-name = "usb_otg_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio3 22 0>;
+                       enable-active-high;
+               };
+       };
+
+       sound {
+               compatible = "fsl,imx6q-sabrelite-sgtl5000",
+                            "fsl,imx-audio-sgtl5000";
+               model = "imx6q-sabrelite-sgtl5000";
+               ssi-controller = <&ssi1>;
+               audio-codec = <&codec>;
+               audio-routing =
+                       "MIC_IN", "Mic Jack",
+                       "Mic Jack", "Mic Bias",
+                       "Headphone Jack", "HP_OUT";
+               mux-int-port = <1>;
+               mux-ext-port = <4>;
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
+};
+
+&ecspi1 {
+       fsl,spi-num-chipselects = <1>;
+       cs-gpios = <&gpio3 19 0>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi1>;
+       status = "okay";
+
+       flash: m25p80@0 {
+               compatible = "sst,w25q256";
+               spi-max-frequency = <30000000>;
+               reg = <0>;
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii";
+       phy-reset-gpios = <&gpio1 30 0>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       gpio: pca9555@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+
+       hwmon: gsc@29 {
+               compatible = "gw,gsp";
+               reg = <0x29>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       pmic: pfuze100@08 {
+               compatible = "fsl,pfuze100";
+               reg = <0x08>;
+
+               regulators {
+                       sw1a_reg: sw1ab {
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw1c_reg: sw1c {
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw2_reg: sw2 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3950000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3a_reg: sw3a {
+                               regulator-min-microvolt = <400000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3b_reg: sw3b {
+                               regulator-min-microvolt = <400000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw4_reg: sw4 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3300000>;
+                       };
+
+                       swbst_reg: swbst {
+                               regulator-min-microvolt = <5000000>;
+                               regulator-max-microvolt = <5150000>;
+                       };
+
+                       snvs_reg: vsnvs {
+                               regulator-min-microvolt = <1000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vref_reg: vrefddr {
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vgen1_reg: vgen1 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                       };
+
+                       vgen2_reg: vgen2 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                       };
+
+                       vgen3_reg: vgen3 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                       };
+
+                       vgen4_reg: vgen4 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen5_reg: vgen5 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen6_reg: vgen6 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+               };
+       };
+
+       pciswitch: pex8609@3f {
+               compatible = "plx,pex8609";
+               reg = <0x3f>;
+       };
+
+       pciclkgen: si52147@6b {
+               compatible = "sil,si52147";
+               reg = <0x6b>;
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       accelerometer: mma8450@1c {
+               compatible = "fsl,mma8450";
+               reg = <0x1c>;
+       };
+
+       codec: sgtl5000@0a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
+               clocks = <&clks 201>;
+               VDDA-supply = <&sw4_reg>;
+               VDDIO-supply = <&reg_3p3v>;
+       };
+
+       hdmiin: adv7611@4c {
+               compatible = "adi,adv7611";
+               reg = <0x4c>;
+       };
+
+       touchscreen: egalax_ts@04 {
+               compatible = "eeti,egalax_ts";
+               reg = <0x04>;
+               interrupt-parent = <&gpio7>;
+               interrupts = <12 2>; /* gpio7_12 active low */
+               wakeup-gpios = <&gpio7 12 0>;
+       };
+
+       videoout: adv7393@2a {
+               compatible = "adi,adv7393";
+               reg = <0x2a>;
+       };
+
+       videoin: adv7180@20 {
+               compatible = "adi,adv7180";
+               reg = <0x20>;
+       };
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog>;
+
+       imx6q-gw5400-a {
+               pinctrl_hog: hoggrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_EIM_D22__GPIO3_IO22    0x80000000 /* OTG_PWR_EN */
+                               MX6QDL_PAD_EIM_D19__GPIO3_IO19    0x80000000 /* SPINOR_CS0# */
+                               MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x80000000 /* PCIE IRQ */
+                               MX6QDL_PAD_ENET_TXD1__GPIO1_IO29  0x80000000 /* PCIE RST */
+                               MX6QDL_PAD_GPIO_0__CCM_CLKO1      0x000130b0 /* AUD4_MCK */
+                               MX6QDL_PAD_GPIO_5__GPIO1_IO05     0x80000000 /* GPS_PPS */
+                               MX6QDL_PAD_GPIO_17__GPIO7_IO12    0x80000000 /* TOUCH_IRQ# */
+                               MX6QDL_PAD_KEY_COL0__GPIO4_IO06   0x80000000 /* user1 led */
+                               MX6QDL_PAD_KEY_COL2__GPIO4_IO10   0x80000000 /* user2 led */
+                               MX6QDL_PAD_KEY_ROW4__GPIO4_IO15   0x80000000 /* user3 led */
+                               MX6QDL_PAD_SD1_DAT0__GPIO1_IO16   0x80000000 /* USBHUB_RST# */
+                               MX6QDL_PAD_SD1_DAT3__GPIO1_IO21   0x80000000 /* MIPI_DIO */
+                        >;
+               };
+
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX6QDL_AUDMUX_PINGRP1>;
+               };
+
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <MX6QDL_ECSPI1_PINGRP1>;
+               };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX6QDL_I2C1_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX6QDL_I2C2_PINGRP2>;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <MX6QDL_I2C3_PINGRP2>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX6QDL_UART1_PINGRP2>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX6QDL_UART2_PINGRP3>;
+               };
+
+               pinctrl_uart5: uart5grp {
+                       fsl,pins = <MX6QDL_UART5_PINGRP1>;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <MX6QDL_USBOTG_PINGRP1>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D4>;
+               };
+       };
+};
+
+&ldb {
+       status = "okay";
+       lvds-channel@0 {
+               crtcs = <&ipu1 0>, <&ipu1 1>, <&ipu2 0>, <&ipu2 1>;
+       };
+};
+
+&pcie {
+       reset-gpio = <&gpio1 29 0>;
+       status = "okay";
+
+       eth1: sky2@8 { /* MAC/PHY on bus 8 */
+               compatible = "marvell,sky2";
+       };
+};
+
+&ssi1 {
+       fsl,mode = "i2s-slave";
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       cd-gpios = <&gpio7 0 0>;
+       vmmc-supply = <&reg_3p3v>;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx6q-gw54xx.dts b/arch/arm/boot/dts/imx6q-gw54xx.dts
new file mode 100644 (file)
index 0000000..ab518d6
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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 "imx6q.dtsi"
+#include "imx6qdl-gw54xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Quad GW54XX";
+       compatible = "gw,imx6q-gw54xx", "gw,ventana", "fsl,imx6q";
+};
+
+&sata {
+       status = "okay";
+};
index 1a3b50d4d8fa4632afb7e8bc28a215b389f50e26..05b4796b1318d9b865cb60ca16114b7a92f05682 100644 (file)
@@ -22,7 +22,7 @@
 
 &ecspi3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_ecspi3_1>;
+       pinctrl-0 = <&pinctrl_ecspi3>;
        status = "okay";
        fsl,spi-num-chipselects = <1>;
        cs-gpios = <&gpio4 24 0>;
@@ -36,7 +36,7 @@
 
 &i2c1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c1_1>;
+       pinctrl-0 = <&pinctrl_i2c1>;
        status = "okay";
 
        eeprom@50 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx6q-phytec-pfla02 {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX6QDL_PAD_EIM_D23__GPIO3_IO23 0x80000000
                                MX6QDL_PAD_DI0_PIN15__GPIO4_IO17  0x80000000 /* PMIC interrupt */
                        >;
                };
-       };
 
-       pfla02 {
-               pinctrl_usdhc3_pfla02: usdhc3grp-pfla02 {
+               pinctrl_ecspi3: ecspi3grp {
+                       fsl,pins = <MX6QDL_ECSPI3_PINGRP1>;
+               };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP3>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX6QDL_I2C1_PINGRP1>;
+               };
+
+               pinctrl_uart4: uart4grp {
+                       fsl,pins = <MX6QDL_UART4_PINGRP1>;
+               };
+
+               pinctrl_usdhc2: usdhc2grp {
+                       fsl,pins = <MX6QDL_USDHC2_PINGRP_D4>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D4>;
+               };
+
+               pinctrl_usdhc3_cdwp: usdhc3cdwp {
                        fsl,pins = <
                                MX6QDL_PAD_ENET_RXD0__GPIO1_IO27 0x80000000
                                MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_enet_3>;
+       pinctrl-0 = <&pinctrl_enet>;
        phy-mode = "rgmii";
        phy-reset-gpios = <&gpio3 23 0>;
        status = "disabled";
 
 &uart4 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart4_1>;
+       pinctrl-0 = <&pinctrl_uart4>;
        status = "disabled";
 };
 
 &usdhc2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc2_2>;
+       pinctrl-0 = <&pinctrl_usdhc2>;
        cd-gpios = <&gpio1 4 0>;
        wp-gpios = <&gpio1 2 0>;
        status = "disabled";
 
 &usdhc3 {
         pinctrl-names = "default";
-        pinctrl-0 = <&pinctrl_usdhc3_2
-                    &pinctrl_usdhc3_pfla02>;
+        pinctrl-0 = <&pinctrl_usdhc3
+                    &pinctrl_usdhc3_cdwp>;
         cd-gpios = <&gpio1 27 0>;
         wp-gpios = <&gpio1 29 0>;
         status = "disabled";
index 97ed0816a6e0c749b5bccd2562b2cbe8655ff326..e5834b2110cf40dc0e2830c23512732a65602573 100644 (file)
 #define MX6QDL_PAD_SD1_DAT2__WDOG1_RESET_B_DEB      0x34c 0x734 0x000 0x6 0x0
 #define MX6QDL_PAD_SD1_CLK__SD1_CLK                 0x350 0x738 0x000 0x0 0x0
 #define MX6QDL_PAD_SD1_CLK__ECSPI5_SCLK             0x350 0x738 0x828 0x1 0x0
+#define MX6QDL_PAD_SD1_CLK__OSC32K_32K_OUT          0x350 0x738 0x000 0x2 0x0
 #define MX6QDL_PAD_SD1_CLK__GPT_CLKIN               0x350 0x738 0x000 0x3 0x0
 #define MX6QDL_PAD_SD1_CLK__GPIO1_IO20              0x350 0x738 0x000 0x5 0x0
 #define MX6QDL_PAD_SD2_CLK__SD2_CLK                 0x354 0x73c 0x000 0x0 0x0
index f004913f7d80a1f2c0df7b229f7a011b17399818..fca8f22091466d204f2670081af858b04d3a477e 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_2p5v: 2p5v {
+               reg_2p5v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "2P5V";
                        regulator-min-microvolt = <2500000>;
                        regulator-max-microvolt = <2500000>;
                        regulator-always-on;
                };
 
-               reg_3p3v: 3p3v {
+               reg_3p3v: regulator@1 {
                        compatible = "regulator-fixed";
+                       reg = <1>;
                        regulator-name = "3P3V";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
                        regulator-always-on;
                };
 
-               reg_usb_otg_vbus: usb_otg_vbus {
+               reg_usb_otg_vbus: regulator@2 {
                        compatible = "regulator-fixed";
+                       reg = <2>;
                        regulator-name = "usb_otg_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
 };
 
 &audmux {
-       status = "okay";
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_audmux_1>;
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
 };
 
 &ecspi1 {
        fsl,spi-num-chipselects = <1>;
        cs-gpios = <&gpio3 19 0>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_ecspi1_1>;
+       pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
 
        flash: m25p80@0 {
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_enet_1>;
+       pinctrl-0 = <&pinctrl_enet>;
        phy-mode = "rgmii";
        phy-reset-gpios = <&gpio3 23 0>;
        status = "okay";
 };
 
 &i2c1 {
-       status = "okay";
        clock-frequency = <100000>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c1_1>;
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
 
        codec: sgtl5000@0a {
                compatible = "fsl,sgtl5000";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx6q-sabrelite {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX6QDL_PAD_NANDF_D6__GPIO2_IO06 0x80000000
                                MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x80000000
                                MX6QDL_PAD_SD3_DAT4__GPIO7_IO01 0x1f0b0
                                MX6QDL_PAD_GPIO_0__CCM_CLKO1    0x80000000
-                               MX6QDL_PAD_EIM_D23__GPIO3_IO23  0x80000000
                        >;
                };
+
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX6QDL_AUDMUX_PINGRP1>;
+               };
+
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <MX6QDL_ECSPI1_PINGRP1>;
+               };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX6QDL_I2C1_PINGRP1>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX6QDL_UART2_PINGRP1>;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <MX6QDL_USBOTG_PINGRP1>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D4>;
+               };
+
+               pinctrl_usdhc4: usdhc4grp {
+                       fsl,pins = <MX6QDL_USDHC4_PINGRP_D4>;
+               };
        };
 };
 
 };
 
 &uart2 {
-       status = "okay";
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart2_1>;
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
 };
 
 &usbh1 {
 &usbotg {
        vbus-supply = <&reg_usb_otg_vbus>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usbotg_1>;
+       pinctrl-0 = <&pinctrl_usbotg>;
        disable-over-current;
        status = "okay";
 };
 
 &usdhc3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc3_2>;
+       pinctrl-0 = <&pinctrl_usdhc3>;
        cd-gpios = <&gpio7 0 0>;
        wp-gpios = <&gpio7 1 0>;
        vmmc-supply = <&reg_3p3v>;
 
 &usdhc4 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc4_2>;
+       pinctrl-0 = <&pinctrl_usdhc4>;
        cd-gpios = <&gpio2 6 0>;
        wp-gpios = <&gpio2 7 0>;
        vmmc-supply = <&reg_3p3v>;
index ee6addf149af988aa560ee3fdc54a3dc27817c36..852675a489ac7899dafbc8b26b3fb9b19acc4a3f 100644 (file)
        };
 };
 
+
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_enet_1>;
+       pinctrl-0 = <&pinctrl_enet>;
        phy-mode = "rgmii";
        status = "okay";
 };
 
+&iomuxc {
+       imx6q-sbc6x {
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX6QDL_UART1_PINGRP1>;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <MX6QDL_USBOTG_PINGRP1>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D4>;
+               };
+       };
+};
+
 &uart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart1_1>;
+       pinctrl-0 = <&pinctrl_uart1>;
        status = "okay";
 };
 
 &usbotg {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usbotg_1>;
+       pinctrl-0 = <&pinctrl_usbotg>;
        disable-over-current;
        status = "okay";
 };
 
 &usdhc3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc3_2>;
+       pinctrl-0 = <&pinctrl_usdhc3>;
        status = "okay";
 };
index 6e1ccdc019a74c1c5416ac06fbc01c4c17b5f489..47a5eda0770717c25eb7e742c787b49c34999cf2 100644 (file)
        };
 };
 
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii";
+       status = "okay";
+};
+
+&iomuxc {
+       imx6q-udoo {
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX6QDL_UART2_PINGRP1>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D4>;
+               };
+       };
+};
+
 &sata {
        status = "okay";
 };
 
 &uart2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart2_1>;
+       pinctrl-0 = <&pinctrl_uart2>;
        status = "okay";
 };
 
 &usdhc3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc3_2>;
+       pinctrl-0 = <&pinctrl_usdhc3>;
        non-removable;
        status = "okay";
 };
index f024ef28b34b9373895dbbb913c475eebb33298a..101c434660d28b93dc62236a0661b79ced0d9dff 100644 (file)
@@ -8,7 +8,9 @@
  *
  */
 
+#include <dt-bindings/interrupt-controller/irq.h>
 #include "imx6q-pinfunc.h"
+#include "imx6qdl-pingrp.h"
 #include "imx6qdl.dtsi"
 
 / {
@@ -74,7 +76,7 @@
                                        #size-cells = <0>;
                                        compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
                                        reg = <0x02018000 0x4000>;
-                                       interrupts = <0 35 0x04>;
+                                       interrupts = <0 35 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks 116>, <&clks 116>;
                                        clock-names = "ipg", "per";
                                        status = "disabled";
                sata: sata@02200000 {
                        compatible = "fsl,imx6q-ahci";
                        reg = <0x02200000 0x4000>;
-                       interrupts = <0 39 0x04>;
+                       interrupts = <0 39 IRQ_TYPE_LEVEL_HIGH>;
                        clocks =  <&clks 154>, <&clks 187>, <&clks 105>;
                        clock-names = "sata", "sata_ref", "ahb";
                        status = "disabled";
                        #crtc-cells = <1>;
                        compatible = "fsl,imx6q-ipu";
                        reg = <0x02800000 0x400000>;
-                       interrupts = <0 8 0x4 0 7 0x4>;
+                       interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>,
+                                    <0 7 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&clks 133>, <&clks 134>, <&clks 137>;
                        clock-names = "bus", "di0", "di1";
                        resets = <&src 4>;
diff --git a/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
new file mode 100644 (file)
index 0000000..fb29da0
--- /dev/null
@@ -0,0 +1,317 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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
+ */
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               can0 = &can1;
+               ethernet0 = &fec;
+               led0 = &led0;
+               led1 = &led1;
+               nand = &gpmi;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               bootargs = "console=ttymxc1,115200";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 0>; /* 102 -> MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 0>; /* 103 -> MX6_PANLEDR */
+                       default-state = "off";
+               };
+       };
+
+       memory {
+               reg = <0x10000000 0x20000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               gpios = <&gpio1 26 0>;
+               status = "okay";
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_3p3v: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_5p0v: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "5P0V";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_otg_vbus: regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "usb_otg_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio3 22 0>;
+                       enable-active-high;
+               };
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii";
+       phy-reset-gpios = <&gpio1 30 0>;
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       gpio: pca9555@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+
+       hwmon: gsc@29 {
+               compatible = "gw,gsp";
+               reg = <0x29>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       pmic: ltc3676@3c {
+               compatible = "ltc,ltc3676";
+               reg = <0x3c>;
+
+               regulators {
+                       sw1_reg: ltc3676__sw1 {
+                               regulator-min-microvolt = <1175000>;
+                               regulator-max-microvolt = <1175000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw2_reg: ltc3676__sw2 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3_reg: ltc3676__sw3 {
+                               regulator-min-microvolt = <1175000>;
+                               regulator-max-microvolt = <1175000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw4_reg: ltc3676__sw4 {
+                               regulator-min-microvolt = <1500000>;
+                               regulator-max-microvolt = <1500000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo2_reg: ltc3676__ldo2 {
+                               regulator-min-microvolt = <2500000>;
+                               regulator-max-microvolt = <2500000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo4_reg: ltc3676__ldo4 {
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3000000>;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       videoin: adv7180@20 {
+               compatible = "adi,adv7180";
+               reg = <0x20>;
+       };
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog>;
+
+       imx6qdl-gw51xx {
+               pinctrl_hog: hoggrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_EIM_A19__GPIO2_IO19   0x80000000 /* MEZZ_DIO0 */
+                               MX6QDL_PAD_EIM_A20__GPIO2_IO18   0x80000000 /* MEZZ_DIO1 */
+                               MX6QDL_PAD_EIM_D22__GPIO3_IO22   0x80000000 /* OTG_PWR_EN */
+                               MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x80000000 /* GPS_PPS */
+                               MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x80000000 /* PHY Reset */
+                               MX6QDL_PAD_GPIO_0__GPIO1_IO00    0x80000000 /* PCIE_RST# */
+                               MX6QDL_PAD_KEY_COL0__GPIO4_IO06  0x80000000 /* user1 led */
+                               MX6QDL_PAD_KEY_ROW0__GPIO4_IO07  0x80000000 /* user2 led */
+                        >;
+               };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_gpmi_nand: gpminandgrp {
+                       fsl,pins = <MX6QDL_GPMI_NAND_PINGRP1_NODQS>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX6QDL_I2C1_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX6QDL_I2C2_PINGRP2>;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <MX6QDL_I2C3_PINGRP2>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX6QDL_UART1_PINGRP2>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX6QDL_UART2_PINGRP3>;
+               };
+
+               pinctrl_uart3: uart3grp {
+                       fsl,pins = <MX6QDL_UART3_PINGRP3>;
+               };
+
+               pinctrl_uart5: uart5grp {
+                       fsl,pins = <MX6QDL_UART5_PINGRP1>;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <MX6QDL_USBOTG_PINGRP1>;
+               };
+       };
+};
+
+&pcie {
+       reset-gpio = <&gpio1 0 0>;
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       status = "okay";
+};
+
+&usbh1 {
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi
new file mode 100644 (file)
index 0000000..a6c77b5
--- /dev/null
@@ -0,0 +1,424 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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
+ */
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               ethernet0 = &fec;
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               nand = &gpmi;
+               ssi0 = &ssi1;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+               usdhc2 = &usdhc3;
+       };
+
+       chosen {
+               bootargs = "console=ttymxc1,115200";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 0>; /* 102 -> MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 0>; /* 103 -> MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 1>; /* 111 - MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory {
+               reg = <0x10000000 0x20000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               gpios = <&gpio1 26 0>;
+               status = "okay";
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_1p0v: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "1P0V";
+                       regulator-min-microvolt = <1000000>;
+                       regulator-max-microvolt = <1000000>;
+                       regulator-always-on;
+               };
+
+               /* remove this fixed regulator once ltc3676__sw2 driver available */
+               reg_1p8v: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "1P8V";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-always-on;
+               };
+
+               reg_3p3v: regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_5p0v: regulator@3 {
+                       compatible = "regulator-fixed";
+                       reg = <3>;
+                       regulator-name = "5P0V";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_otg_vbus: regulator@4 {
+                       compatible = "regulator-fixed";
+                       reg = <4>;
+                       regulator-name = "usb_otg_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio3 22 0>;
+                       enable-active-high;
+               };
+       };
+
+       sound {
+               compatible = "fsl,imx6q-sabrelite-sgtl5000",
+                            "fsl,imx-audio-sgtl5000";
+               model = "imx6q-sabrelite-sgtl5000";
+               ssi-controller = <&ssi1>;
+               audio-codec = <&codec>;
+               audio-routing =
+                       "MIC_IN", "Mic Jack",
+                       "Mic Jack", "Mic Bias",
+                       "Headphone Jack", "HP_OUT";
+               mux-int-port = <1>;
+               mux-ext-port = <4>;
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii";
+       phy-reset-gpios = <&gpio1 30 0>;
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       gpio: pca9555@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+
+       hwmon: gsc@29 {
+               compatible = "gw,gsp";
+               reg = <0x29>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       pciswitch: pex8609@3f {
+               compatible = "plx,pex8609";
+               reg = <0x3f>;
+       };
+
+       pmic: ltc3676@3c {
+               compatible = "ltc,ltc3676";
+               reg = <0x3c>;
+
+               regulators {
+                       sw1_reg: ltc3676__sw1 {
+                               regulator-min-microvolt = <1175000>;
+                               regulator-max-microvolt = <1175000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw2_reg: ltc3676__sw2 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3_reg: ltc3676__sw3 {
+                               regulator-min-microvolt = <1175000>;
+                               regulator-max-microvolt = <1175000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw4_reg: ltc3676__sw4 {
+                               regulator-min-microvolt = <1500000>;
+                               regulator-max-microvolt = <1500000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo2_reg: ltc3676__ldo2 {
+                               regulator-min-microvolt = <2500000>;
+                               regulator-max-microvolt = <2500000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo3_reg: ltc3676__ldo3 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo4_reg: ltc3676__ldo4 {
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3000000>;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       accelerometer: fxos8700@1e {
+               compatible = "fsl,fxos8700";
+               reg = <0x13>;
+       };
+
+       codec: sgtl5000@0a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
+               clocks = <&clks 169>;
+               VDDA-supply = <&reg_1p8v>;
+               VDDIO-supply = <&reg_3p3v>;
+       };
+
+       touchscreen: egalax_ts@04 {
+               compatible = "eeti,egalax_ts";
+               reg = <0x04>;
+               interrupt-parent = <&gpio7>;
+               interrupts = <12 2>; /* gpio7_12 active low */
+               wakeup-gpios = <&gpio7 12 0>;
+       };
+
+       videoin: adv7180@20 {
+               compatible = "adi,adv7180";
+               reg = <0x20>;
+       };
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog>;
+
+       imx6qdl-gw52xx {
+               pinctrl_hog: hoggrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_EIM_A19__GPIO2_IO19   0x80000000 /* MEZZ_DIO0 */
+                               MX6QDL_PAD_EIM_A20__GPIO2_IO18   0x80000000 /* MEZZ_DIO1 */
+                               MX6QDL_PAD_EIM_D22__GPIO3_IO22   0x80000000 /* OTG_PWR_EN */
+                               MX6QDL_PAD_EIM_D31__GPIO3_IO31   0x80000000 /* VIDDEC_PDN# */
+                               MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x80000000 /* PHY Reset */
+                               MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x80000000 /* PCIE_RST# */
+                               MX6QDL_PAD_ENET_RXD0__GPIO1_IO27 0x80000000 /* GPS_PWDN */
+                               MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x80000000 /* GPS_PPS */
+                               MX6QDL_PAD_GPIO_0__CCM_CLKO1     0x000130b0 /* AUD4_MCK */
+                               MX6QDL_PAD_GPIO_2__GPIO1_IO02    0x80000000 /* USB_SEL_PCI */
+                               MX6QDL_PAD_GPIO_17__GPIO7_IO12   0x80000000 /* TOUCH_IRQ# */
+                               MX6QDL_PAD_KEY_COL0__GPIO4_IO06  0x80000000 /* user1 led */
+                               MX6QDL_PAD_KEY_ROW0__GPIO4_IO07  0x80000000 /* user2 led */
+                               MX6QDL_PAD_KEY_ROW4__GPIO4_IO15  0x80000000 /* user3 led */
+                               MX6QDL_PAD_SD2_CMD__GPIO1_IO11   0x80000000 /* LVDS_TCH# */
+                               MX6QDL_PAD_SD3_DAT5__GPIO7_IO00  0x80000000 /* SD3_CD# */
+                               MX6QDL_PAD_SD4_DAT3__GPIO2_IO11  0x80000000 /* UART2_EN# */
+                        >;
+               };
+
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX6QDL_AUDMUX_PINGRP1>;
+               };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_gpmi_nand: gpminandgrp {
+                       fsl,pins = <MX6QDL_GPMI_NAND_PINGRP1_NODQS>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX6QDL_I2C1_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX6QDL_I2C2_PINGRP2>;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <MX6QDL_I2C3_PINGRP2>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX6QDL_UART1_PINGRP2>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX6QDL_UART2_PINGRP3>;
+               };
+
+               pinctrl_uart5: uart5grp {
+                       fsl,pins = <MX6QDL_UART5_PINGRP1>;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <MX6QDL_USBOTG_PINGRP1>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D4>;
+               };
+       };
+};
+
+&ldb {
+       status = "okay";
+       lvds-channel@0 {
+               crtcs = <&ipu1 0>, <&ipu1 1>;
+       };
+};
+
+&pcie {
+       reset-gpio = <&gpio1 29 0>;
+       status = "okay";
+};
+
+&ssi1 {
+       fsl,mode = "i2s-slave";
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       status = "okay";
+};
+
+&usbh1 {
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       cd-gpios = <&gpio7 0 0>;
+       vmmc-supply = <&reg_3p3v>;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
new file mode 100644 (file)
index 0000000..35028a5
--- /dev/null
@@ -0,0 +1,484 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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
+ */
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               can0 = &can1;
+               ethernet0 = &fec;
+               ethernet1 = &eth1;
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               nand = &gpmi;
+               sky2 = &eth1;
+               ssi0 = &ssi1;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+               usdhc2 = &usdhc3;
+       };
+
+       chosen {
+               bootargs = "console=ttymxc1,115200";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 0>; /* 102 -> MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 0>; /* 103 -> MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 1>; /* 111 -> MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory {
+               reg = <0x10000000 0x40000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               gpios = <&gpio1 26 0>;
+               status = "okay";
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_1p0v: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "1P0V";
+                       regulator-min-microvolt = <1000000>;
+                       regulator-max-microvolt = <1000000>;
+                       regulator-always-on;
+               };
+
+               /* remove when pmic 1p8 regulator available */
+               reg_1p8v: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "1P8V";
+                       regulator-min-microvolt = <1800000>;
+                       regulator-max-microvolt = <1800000>;
+                       regulator-always-on;
+               };
+
+               reg_3p3v: regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_h1_vbus: regulator@3 {
+                       compatible = "regulator-fixed";
+                       reg = <3>;
+                       regulator-name = "usb_h1_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_otg_vbus: regulator@4 {
+                       compatible = "regulator-fixed";
+                       reg = <4>;
+                       regulator-name = "usb_otg_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio3 22 0>;
+                       enable-active-high;
+               };
+       };
+
+       sound {
+               compatible = "fsl,imx6q-sabrelite-sgtl5000",
+                            "fsl,imx-audio-sgtl5000";
+               model = "imx6q-sabrelite-sgtl5000";
+               ssi-controller = <&ssi1>;
+               audio-codec = <&codec>;
+               audio-routing =
+                       "MIC_IN", "Mic Jack",
+                       "Mic Jack", "Mic Bias",
+                       "Headphone Jack", "HP_OUT";
+               mux-int-port = <1>;
+               mux-ext-port = <4>;
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
+};
+
+&can1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan1>;
+       status = "okay";
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii";
+       phy-reset-gpios = <&gpio1 30 0>;
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       gpio: pca9555@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+
+       hwmon: gsc@29 {
+               compatible = "gw,gsp";
+               reg = <0x29>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       pciclkgen: si53156@6b {
+               compatible = "sil,si53156";
+               reg = <0x6b>;
+       };
+
+       pciswitch: pex8606@3f {
+               compatible = "plx,pex8606";
+               reg = <0x3f>;
+       };
+
+       pmic: ltc3676@3c {
+               compatible = "ltc,ltc3676";
+               reg = <0x3c>;
+
+               regulators {
+                       /* VDD_SOC */
+                       sw1_reg: ltc3676__sw1 {
+                               regulator-min-microvolt = <1175000>;
+                               regulator-max-microvolt = <1175000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P8 */
+                       sw2_reg: ltc3676__sw2 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_ARM */
+                       sw3_reg: ltc3676__sw3 {
+                               regulator-min-microvolt = <1175000>;
+                               regulator-max-microvolt = <1175000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_DDR */
+                       sw4_reg: ltc3676__sw4 {
+                               regulator-min-microvolt = <1500000>;
+                               regulator-max-microvolt = <1500000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_2P5 */
+                       ldo2_reg: ltc3676__ldo2 {
+                               regulator-min-microvolt = <2500000>;
+                               regulator-max-microvolt = <2500000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P8 */
+                       ldo3_reg: ltc3676__ldo3 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_HIGH */
+                       ldo4_reg: ltc3676__ldo4 {
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3000000>;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       accelerometer: fxos8700@1e {
+               compatible = "fsl,fxos8700";
+               reg = <0x1e>;
+       };
+
+       codec: sgtl5000@0a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
+               clocks = <&clks 201>;
+               VDDA-supply = <&reg_1p8v>;
+               VDDIO-supply = <&reg_3p3v>;
+       };
+
+       hdmiin: adv7611@4c {
+               compatible = "adi,adv7611";
+               reg = <0x4c>;
+       };
+
+       touchscreen: egalax_ts@04 {
+               compatible = "eeti,egalax_ts";
+               reg = <0x04>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <11 2>; /* gpio1_11 active low */
+               wakeup-gpios = <&gpio1 11 0>;
+       };
+
+       videoout: adv7393@2a {
+               compatible = "adi,adv7393";
+               reg = <0x2a>;
+       };
+
+       videoin: adv7180@20 {
+               compatible = "adi,adv7180";
+               reg = <0x20>;
+       };
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog>;
+
+       imx6qdl-gw53xx {
+               pinctrl_hog: hoggrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_EIM_A19__GPIO2_IO19    0x80000000 /* PCIE6EXP_DIO0 */
+                               MX6QDL_PAD_EIM_A20__GPIO2_IO18    0x80000000 /* PCIE6EXP_DIO1 */
+                               MX6QDL_PAD_EIM_D22__GPIO3_IO22    0x80000000 /* OTG_PWR_EN */
+                               MX6QDL_PAD_ENET_RXD0__GPIO1_IO27  0x80000000 /* GPS_SHDN */
+                               MX6QDL_PAD_ENET_RXD1__GPIO1_IO26  0x80000000 /* GPS_PPS */
+                               MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x80000000 /* PCIE IRQ */
+                               MX6QDL_PAD_ENET_TXD1__GPIO1_IO29  0x80000000 /* PCIE RST */
+                               MX6QDL_PAD_GPIO_0__CCM_CLKO1      0x000130b0 /* AUD4_MCK */
+                               MX6QDL_PAD_GPIO_2__GPIO1_IO02     0x80000000 /* CAN_STBY */
+                               MX6QDL_PAD_GPIO_8__GPIO1_IO08     0x80000000 /* PMIC_IRQ# */
+                               MX6QDL_PAD_GPIO_9__GPIO1_IO09     0x80000000 /* HUB_RST# */
+                               MX6QDL_PAD_GPIO_17__GPIO7_IO12    0x80000000 /* PCIE_WDIS# */
+                               MX6QDL_PAD_GPIO_19__GPIO4_IO05    0x80000000 /* ACCEL_IRQ# */
+                               MX6QDL_PAD_KEY_COL0__GPIO4_IO06   0x80000000 /* user1 led */
+                               MX6QDL_PAD_KEY_COL4__GPIO4_IO14   0x80000000 /* USBOTG_OC# */
+                               MX6QDL_PAD_KEY_ROW0__GPIO4_IO07   0x80000000 /* user2 led */
+                               MX6QDL_PAD_KEY_ROW4__GPIO4_IO15   0x80000000 /* user3 led */
+                               MX6QDL_PAD_SD2_CMD__GPIO1_IO11    0x80000000 /* TOUCH_IRQ# */
+                               MX6QDL_PAD_SD3_DAT5__GPIO7_IO00   0x80000000 /* SD3_DET# */
+                        >;
+               };
+
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX6QDL_AUDMUX_PINGRP1>;
+               };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_flexcan1: flexcan1grp {
+                       fsl,pins = <MX6QDL_FLEXCAN1_PINGRP1>;
+               };
+
+               pinctrl_gpmi_nand: gpminandgrp {
+                       fsl,pins = <MX6QDL_GPMI_NAND_PINGRP1_NODQS>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX6QDL_I2C1_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX6QDL_I2C2_PINGRP2>;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <MX6QDL_I2C3_PINGRP2>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX6QDL_UART1_PINGRP2>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX6QDL_UART2_PINGRP3>;
+               };
+
+               pinctrl_uart5: uart5grp {
+                       fsl,pins = <MX6QDL_UART5_PINGRP1>;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <MX6QDL_USBOTG_PINGRP1>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D4>;
+               };
+       };
+};
+
+&ldb {
+       status = "okay";
+
+       lvds-channel@1 {
+               fsl,data-mapping = "spwg";
+               fsl,data-width = <18>;
+               status = "okay";
+
+               display-timings {
+                       native-mode = <&timing0>;
+                       timing0: hsd100pxn1 {
+                               clock-frequency = <65000000>;
+                               hactive = <1024>;
+                               vactive = <768>;
+                               hback-porch = <220>;
+                               hfront-porch = <40>;
+                               vback-porch = <21>;
+                               vfront-porch = <7>;
+                               hsync-len = <60>;
+                               vsync-len = <10>;
+                       };
+               };
+       };
+};
+
+&pcie {
+       reset-gpio = <&gpio1 29 0>;
+       status = "okay";
+
+       eth1: sky2@8 { /* MAC/PHY on bus 8 */
+               compatible = "marvell,sky2";
+       };
+};
+
+&ssi1 {
+       fsl,mode = "i2s-slave";
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       cd-gpios = <&gpio7 0 0>;
+       vmmc-supply = <&reg_3p3v>;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
new file mode 100644 (file)
index 0000000..34b26b9
--- /dev/null
@@ -0,0 +1,511 @@
+/*
+ * Copyright 2013 Gateworks Corporation
+ *
+ * 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
+ */
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               can0 = &can1;
+               ethernet0 = &fec;
+               ethernet1 = &eth1;
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               nand = &gpmi;
+               sky2 = &eth1;
+               ssi0 = &ssi1;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+               usdhc2 = &usdhc3;
+       };
+
+       chosen {
+               bootargs = "console=ttymxc1,115200";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 0>; /* 102 -> MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 0>; /* 103 -> MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 1>; /* 111 -> MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory {
+               reg = <0x10000000 0x40000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               gpios = <&gpio1 26 0>;
+               status = "okay";
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_1p0v: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "1P0V";
+                       regulator-min-microvolt = <1000000>;
+                       regulator-max-microvolt = <1000000>;
+                       regulator-always-on;
+               };
+
+               reg_3p3v: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_h1_vbus: regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "usb_h1_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_otg_vbus: regulator@3 {
+                       compatible = "regulator-fixed";
+                       reg = <3>;
+                       regulator-name = "usb_otg_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio3 22 0>;
+                       enable-active-high;
+               };
+       };
+
+       sound {
+               compatible = "fsl,imx6q-sabrelite-sgtl5000",
+                            "fsl,imx-audio-sgtl5000";
+               model = "imx6q-sabrelite-sgtl5000";
+               ssi-controller = <&ssi1>;
+               audio-codec = <&codec>;
+               audio-routing =
+                       "MIC_IN", "Mic Jack",
+                       "Mic Jack", "Mic Bias",
+                       "Headphone Jack", "HP_OUT";
+               mux-int-port = <1>;
+               mux-ext-port = <4>;
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>; /* AUD4<->sgtl5000 */
+       status = "okay";
+};
+
+&can1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan1>;
+       status = "okay";
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii";
+       phy-reset-gpios = <&gpio1 30 0>;
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       gpio: pca9555@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+
+       hwmon: gsc@29 {
+               compatible = "gw,gsp";
+               reg = <0x29>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       pmic: pfuze100@08 {
+               compatible = "fsl,pfuze100";
+               reg = <0x08>;
+
+               regulators {
+                       sw1a_reg: sw1ab {
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw1c_reg: sw1c {
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw2_reg: sw2 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3950000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3a_reg: sw3a {
+                               regulator-min-microvolt = <400000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3b_reg: sw3b {
+                               regulator-min-microvolt = <400000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw4_reg: sw4 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3300000>;
+                       };
+
+                       swbst_reg: swbst {
+                               regulator-min-microvolt = <5000000>;
+                               regulator-max-microvolt = <5150000>;
+                       };
+
+                       snvs_reg: vsnvs {
+                               regulator-min-microvolt = <1000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vref_reg: vrefddr {
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vgen1_reg: vgen1 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                       };
+
+                       vgen2_reg: vgen2 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                       };
+
+                       vgen3_reg: vgen3 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                       };
+
+                       vgen4_reg: vgen4 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen5_reg: vgen5 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen6_reg: vgen6 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+               };
+       };
+
+       pciswitch: pex8609@3f {
+               compatible = "plx,pex8609";
+               reg = <0x3f>;
+       };
+
+       pciclkgen: si52147@6b {
+               compatible = "sil,si52147";
+               reg = <0x6b>;
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       accelerometer: fxos8700@1e {
+               compatible = "fsl,fxos8700";
+               reg = <0x1e>;
+       };
+
+       codec: sgtl5000@0a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
+               clocks = <&clks 201>;
+               VDDA-supply = <&sw4_reg>;
+               VDDIO-supply = <&reg_3p3v>;
+       };
+
+       hdmiin: adv7611@4c {
+               compatible = "adi,adv7611";
+               reg = <0x4c>;
+       };
+
+       touchscreen: egalax_ts@04 {
+               compatible = "eeti,egalax_ts";
+               reg = <0x04>;
+               interrupt-parent = <&gpio7>;
+               interrupts = <12 2>; /* gpio7_12 active low */
+               wakeup-gpios = <&gpio7 12 0>;
+       };
+
+       videoout: adv7393@2a {
+               compatible = "adi,adv7393";
+               reg = <0x2a>;
+       };
+
+       videoin: adv7180@20 {
+               compatible = "adi,adv7180";
+               reg = <0x20>;
+       };
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hog>;
+
+       imx6qdl-gw54xx {
+               pinctrl_hog: hoggrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_EIM_D22__GPIO3_IO22    0x80000000 /* OTG_PWR_EN */
+                               MX6QDL_PAD_EIM_D19__GPIO3_IO19    0x80000000 /* SPINOR_CS0# */
+                               MX6QDL_PAD_ENET_RXD1__GPIO1_IO26  0x80000000 /* GPS_PPS */
+                               MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x80000000 /* PCIE IRQ */
+                               MX6QDL_PAD_ENET_TXD1__GPIO1_IO29  0x80000000 /* PCIE RST */
+                               MX6QDL_PAD_GPIO_0__CCM_CLKO1      0x000130b0 /* AUD4_MCK */
+                               MX6QDL_PAD_GPIO_2__GPIO1_IO02     0x80000000 /* CAN_STBY */
+                               MX6QDL_PAD_GPIO_17__GPIO7_IO12    0x80000000 /* TOUCH_IRQ# */
+                               MX6QDL_PAD_KEY_COL0__GPIO4_IO06   0x80000000 /* user1 led */
+                               MX6QDL_PAD_KEY_ROW0__GPIO4_IO07   0x80000000 /* user2 led */
+                               MX6QDL_PAD_KEY_ROW4__GPIO4_IO15   0x80000000 /* user3 led */
+                               MX6QDL_PAD_SD1_DAT0__GPIO1_IO16   0x80000000 /* USBHUB_RST# */
+                               MX6QDL_PAD_SD1_DAT3__GPIO1_IO21   0x80000000 /* MIPI_DIO */
+                        >;
+               };
+
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX6QDL_AUDMUX_PINGRP1>;
+               };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_flexcan1: flexcan1grp {
+                       fsl,pins = <MX6QDL_FLEXCAN1_PINGRP1>;
+               };
+
+               pinctrl_gpmi_nand: gpminandgrp {
+                       fsl,pins = <MX6QDL_GPMI_NAND_PINGRP1_NODQS>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX6QDL_I2C1_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX6QDL_I2C2_PINGRP2>;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <MX6QDL_I2C3_PINGRP2>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX6QDL_UART1_PINGRP2>;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <MX6QDL_UART2_PINGRP3>;
+               };
+
+               pinctrl_uart5: uart5grp {
+                       fsl,pins = <MX6QDL_UART5_PINGRP1>;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <MX6QDL_USBOTG_PINGRP1>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D4>;
+               };
+       };
+};
+
+&ldb {
+       status = "okay";
+
+       lvds-channel@1 {
+               fsl,data-mapping = "spwg";
+               fsl,data-width = <18>;
+               status = "okay";
+
+               display-timings {
+                       native-mode = <&timing0>;
+                       timing0: hsd100pxn1 {
+                               clock-frequency = <65000000>;
+                               hactive = <1024>;
+                               vactive = <768>;
+                               hback-porch = <220>;
+                               hfront-porch = <40>;
+                               vback-porch = <21>;
+                               vfront-porch = <7>;
+                               hsync-len = <60>;
+                               vsync-len = <10>;
+                       };
+               };
+       };
+};
+
+&pcie {
+       reset-gpio = <&gpio1 29 0>;
+       status = "okay";
+
+       eth1: sky2@8 { /* MAC/PHY on bus 8 */
+               compatible = "marvell,sky2";
+       };
+};
+
+&ssi1 {
+       fsl,mode = "i2s-slave";
+       status = "okay";
+};
+
+&ssi2 {
+       fsl,mode = "i2s-slave";
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       cd-gpios = <&gpio7 0 0>;
+       vmmc-supply = <&reg_3p3v>;
+       status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx6qdl-pingrp.h b/arch/arm/boot/dts/imx6qdl-pingrp.h
new file mode 100644 (file)
index 0000000..8d71b13
--- /dev/null
@@ -0,0 +1,526 @@
+/*
+ * Copyright (C) 2013 Freescale Semiconductor, 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.
+ *
+ */
+
+#ifndef __DTS_IMX6QDL_PINGRP_H
+#define __DTS_IMX6QDL_PINGRP_H
+
+#define MX6QDL_AUDMUX_PINGRP1 \
+       MX6QDL_PAD_SD2_DAT0__AUD4_RXD                   0x130b0 \
+       MX6QDL_PAD_SD2_DAT3__AUD4_TXC                   0x130b0 \
+       MX6QDL_PAD_SD2_DAT2__AUD4_TXD                   0x110b0 \
+       MX6QDL_PAD_SD2_DAT1__AUD4_TXFS                  0x130b0
+
+#define MX6QDL_AUDMUX_PINGRP2 \
+       MX6QDL_PAD_CSI0_DAT7__AUD3_RXD                  0x130b0 \
+       MX6QDL_PAD_CSI0_DAT4__AUD3_TXC                  0x130b0 \
+       MX6QDL_PAD_CSI0_DAT5__AUD3_TXD                  0x110b0 \
+       MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS                 0x130b0
+
+#define MX6QDL_AUDMUX_PINGRP3 \
+       MX6QDL_PAD_DISP0_DAT16__AUD5_TXC                0x130b0 \
+       MX6QDL_PAD_DISP0_DAT18__AUD5_TXFS               0x130b0 \
+       MX6QDL_PAD_DISP0_DAT19__AUD5_RXD                0x130b0 \
+
+#define MX6QDL_AUDMUX_PINGRP4 \
+       MX6QDL_PAD_EIM_D24__AUD5_RXFS                   0x130b0 \
+       MX6QDL_PAD_EIM_D25__AUD5_RXC                    0x130b0 \
+       MX6QDL_PAD_DISP0_DAT19__AUD5_RXD                0x130b0
+
+#define MX6QDL_ECSPI1_PINGRP1 \
+       MX6QDL_PAD_EIM_D17__ECSPI1_MISO                 0x100b1 \
+       MX6QDL_PAD_EIM_D18__ECSPI1_MOSI                 0x100b1 \
+       MX6QDL_PAD_EIM_D16__ECSPI1_SCLK                 0x100b1
+
+#define MX6QDL_ECSPI1_PINGRP2 \
+       MX6QDL_PAD_KEY_COL1__ECSPI1_MISO                0x100b1 \
+       MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI                0x100b1 \
+       MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK                0x100b1
+
+#define MX6QDL_ECSPI3_PINGRP1 \
+       MX6QDL_PAD_DISP0_DAT2__ECSPI3_MISO              0x100b1 \
+       MX6QDL_PAD_DISP0_DAT1__ECSPI3_MOSI              0x100b1 \
+       MX6QDL_PAD_DISP0_DAT0__ECSPI3_SCLK              0x100b1
+
+#define MX6QDL_ENET_PINGRP1 \
+       MX6QDL_PAD_ENET_MDIO__ENET_MDIO                 0x1b0b0 \
+       MX6QDL_PAD_ENET_MDC__ENET_MDC                   0x1b0b0 \
+       MX6QDL_PAD_RGMII_TXC__RGMII_TXC                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD0__RGMII_TD0                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD1__RGMII_TD1                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD2__RGMII_TD2                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD3__RGMII_TD3                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL           0x1b0b0 \
+       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK            0x1b0b0 \
+       MX6QDL_PAD_RGMII_RXC__RGMII_RXC                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD0__RGMII_RD0                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD1__RGMII_RD1                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD2__RGMII_RD2                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD3__RGMII_RD3                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL           0x1b0b0 \
+       MX6QDL_PAD_GPIO_16__ENET_REF_CLK                0x4001b0a8
+
+#define MX6QDL_ENET_PINGRP2 \
+       MX6QDL_PAD_KEY_COL1__ENET_MDIO                  0x1b0b0 \
+       MX6QDL_PAD_KEY_COL2__ENET_MDC                   0x1b0b0 \
+       MX6QDL_PAD_RGMII_TXC__RGMII_TXC                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD0__RGMII_TD0                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD1__RGMII_TD1                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD2__RGMII_TD2                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD3__RGMII_TD3                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL           0x1b0b0 \
+       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK            0x1b0b0 \
+       MX6QDL_PAD_RGMII_RXC__RGMII_RXC                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD0__RGMII_RD0                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD1__RGMII_RD1                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD2__RGMII_RD2                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD3__RGMII_RD3                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL           0x1b0b0
+
+#define MX6QDL_ENET_PINGRP3 \
+       MX6QDL_PAD_ENET_MDIO__ENET_MDIO                 0x1b0b0 \
+       MX6QDL_PAD_ENET_MDC__ENET_MDC                   0x1b0b0 \
+       MX6QDL_PAD_RGMII_TXC__RGMII_TXC                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD0__RGMII_TD0                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD1__RGMII_TD1                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD2__RGMII_TD2                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TD3__RGMII_TD3                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL           0x1b0b0 \
+       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK            0x1b0b0 \
+       MX6QDL_PAD_RGMII_RXC__RGMII_RXC                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD0__RGMII_RD0                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD1__RGMII_RD1                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD2__RGMII_RD2                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RD3__RGMII_RD3                 0x1b0b0 \
+       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL           0x1b0b0 \
+       MX6QDL_PAD_ENET_TX_EN__ENET_TX_EN               0x1b0b0
+
+#define MX6QDL_ESAI_PINGRP1 \
+       MX6QDL_PAD_ENET_RXD0__ESAI_TX_HF_CLK            0x1b030 \
+       MX6QDL_PAD_ENET_CRS_DV__ESAI_TX_CLK             0x1b030 \
+       MX6QDL_PAD_ENET_RXD1__ESAI_TX_FS                0x1b030 \
+       MX6QDL_PAD_ENET_TX_EN__ESAI_TX3_RX2             0x1b030 \
+       MX6QDL_PAD_ENET_TXD1__ESAI_TX2_RX3              0x1b030 \
+       MX6QDL_PAD_ENET_TXD0__ESAI_TX4_RX1              0x1b030 \
+       MX6QDL_PAD_ENET_MDC__ESAI_TX5_RX0               0x1b030 \
+       MX6QDL_PAD_NANDF_CS2__ESAI_TX0                  0x1b030 \
+       MX6QDL_PAD_NANDF_CS3__ESAI_TX1                  0x1b030
+
+#define MX6QDL_ESAI_PINGRP2 \
+       MX6QDL_PAD_ENET_CRS_DV__ESAI_TX_CLK             0x1b030 \
+       MX6QDL_PAD_ENET_RXD1__ESAI_TX_FS                0x1b030 \
+       MX6QDL_PAD_ENET_TX_EN__ESAI_TX3_RX2             0x1b030 \
+       MX6QDL_PAD_GPIO_5__ESAI_TX2_RX3                 0x1b030 \
+       MX6QDL_PAD_ENET_TXD0__ESAI_TX4_RX1              0x1b030 \
+       MX6QDL_PAD_ENET_MDC__ESAI_TX5_RX0               0x1b030 \
+       MX6QDL_PAD_GPIO_17__ESAI_TX0                    0x1b030 \
+       MX6QDL_PAD_NANDF_CS3__ESAI_TX1                  0x1b030 \
+       MX6QDL_PAD_ENET_MDIO__ESAI_RX_CLK               0x1b030 \
+       MX6QDL_PAD_GPIO_9__ESAI_RX_FS                   0x1b030
+
+#define MX6QDL_FLEXCAN1_PINGRP1 \
+       MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX                0x80000000 \
+       MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX                0x80000000
+
+#define MX6QDL_FLEXCAN1_PINGRP2 \
+       MX6QDL_PAD_GPIO_7__FLEXCAN1_TX                  0x80000000 \
+       MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX                0x80000000
+
+#define MX6QDL_FLEXCAN2_PINGRP1 \
+       MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX                0x80000000 \
+       MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX                0x80000000
+
+#define MX6QDL_GPMI_NAND_PINGRP1 \
+       MX6QDL_PAD_NANDF_CLE__NAND_CLE                  0xb0b1 \
+       MX6QDL_PAD_NANDF_ALE__NAND_ALE                  0xb0b1 \
+       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B                0xb0b1 \
+       MX6QDL_PAD_NANDF_RB0__NAND_READY_B              0xb000 \
+       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B                0xb0b1 \
+       MX6QDL_PAD_NANDF_CS1__NAND_CE1_B                0xb0b1 \
+       MX6QDL_PAD_SD4_CMD__NAND_RE_B                   0xb0b1 \
+       MX6QDL_PAD_SD4_CLK__NAND_WE_B                   0xb0b1 \
+       MX6QDL_PAD_NANDF_D0__NAND_DATA00                0xb0b1 \
+       MX6QDL_PAD_NANDF_D1__NAND_DATA01                0xb0b1 \
+       MX6QDL_PAD_NANDF_D2__NAND_DATA02                0xb0b1 \
+       MX6QDL_PAD_NANDF_D3__NAND_DATA03                0xb0b1 \
+       MX6QDL_PAD_NANDF_D4__NAND_DATA04                0xb0b1 \
+       MX6QDL_PAD_NANDF_D5__NAND_DATA05                0xb0b1 \
+       MX6QDL_PAD_NANDF_D6__NAND_DATA06                0xb0b1 \
+       MX6QDL_PAD_NANDF_D7__NAND_DATA07                0xb0b1 \
+       MX6QDL_PAD_SD4_DAT0__NAND_DQS                   0x00b1
+
+#define MX6QDL_GPMI_NAND_PINGRP1_NODQS \
+       MX6QDL_PAD_NANDF_CLE__NAND_CLE                  0xb0b1 \
+       MX6QDL_PAD_NANDF_ALE__NAND_ALE                  0xb0b1 \
+       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B                0xb0b1 \
+       MX6QDL_PAD_NANDF_RB0__NAND_READY_B              0xb000 \
+       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B                0xb0b1 \
+       MX6QDL_PAD_NANDF_CS1__NAND_CE1_B                0xb0b1 \
+       MX6QDL_PAD_SD4_CMD__NAND_RE_B                   0xb0b1 \
+       MX6QDL_PAD_SD4_CLK__NAND_WE_B                   0xb0b1 \
+       MX6QDL_PAD_NANDF_D0__NAND_DATA00                0xb0b1 \
+       MX6QDL_PAD_NANDF_D1__NAND_DATA01                0xb0b1 \
+       MX6QDL_PAD_NANDF_D2__NAND_DATA02                0xb0b1 \
+       MX6QDL_PAD_NANDF_D3__NAND_DATA03                0xb0b1 \
+       MX6QDL_PAD_NANDF_D4__NAND_DATA04                0xb0b1 \
+       MX6QDL_PAD_NANDF_D5__NAND_DATA05                0xb0b1 \
+       MX6QDL_PAD_NANDF_D6__NAND_DATA06                0xb0b1 \
+       MX6QDL_PAD_NANDF_D7__NAND_DATA07                0xb0b1
+
+#define MX6QDL_HDMI_HDCP_PINGRP1 \
+       MX6QDL_PAD_KEY_COL3__HDMI_TX_DDC_SCL            0x4001b8b1 \
+       MX6QDL_PAD_KEY_ROW3__HDMI_TX_DDC_SDA            0x4001b8b1
+
+#define MX6QDL_HDMI_HDCP_PINGRP2 \
+       MX6QDL_PAD_EIM_EB2__HDMI_TX_DDC_SCL             0x4001b8b1 \
+       MX6QDL_PAD_EIM_D16__HDMI_TX_DDC_SDA             0x4001b8b1
+
+#define MX6QDL_HDMI_HDCP_PINGRP3 \
+       MX6QDL_PAD_EIM_EB2__HDMI_TX_DDC_SCL             0x4001b8b1 \
+       MX6QDL_PAD_KEY_ROW3__HDMI_TX_DDC_SDA            0x4001b8b1
+
+#define MX6QDL_HDMI_CEC_PINGRP1 \
+       MX6QDL_PAD_EIM_A25__HDMI_TX_CEC_LINE            0x1f8b0
+
+#define MX6QDL_HDMI_CEC_PINGRP2 \
+       MX6QDL_PAD_KEY_ROW2__HDMI_TX_CEC_LINE           0x1f8b0
+
+#define MX6QDL_I2C1_PINGRP1 \
+       MX6QDL_PAD_EIM_D21__I2C1_SCL                    0x4001b8b1 \
+       MX6QDL_PAD_EIM_D28__I2C1_SDA                    0x4001b8b1
+
+#define MX6QDL_I2C1_PINGRP2 \
+       MX6QDL_PAD_CSI0_DAT8__I2C1_SDA                  0x4001b8b1 \
+       MX6QDL_PAD_CSI0_DAT9__I2C1_SCL                  0x4001b8b1
+
+#define MX6QDL_I2C2_PINGRP1 \
+       MX6QDL_PAD_EIM_EB2__I2C2_SCL                    0x4001b8b1 \
+       MX6QDL_PAD_EIM_D16__I2C2_SDA                    0x4001b8b1
+
+#define MX6QDL_I2C2_PINGRP2 \
+       MX6QDL_PAD_KEY_COL3__I2C2_SCL                   0x4001b8b1 \
+       MX6QDL_PAD_KEY_ROW3__I2C2_SDA                   0x4001b8b1
+
+#define MX6QDL_I2C2_PINGRP3 \
+       MX6QDL_PAD_EIM_EB2__I2C2_SCL                    0x4001b8b1 \
+       MX6QDL_PAD_KEY_ROW3__I2C2_SDA                   0x4001b8b1
+
+#define MX6QDL_I2C3_PINGRP1 \
+       MX6QDL_PAD_EIM_D17__I2C3_SCL                    0x4001b8b1 \
+       MX6QDL_PAD_EIM_D18__I2C3_SDA                    0x4001b8b1
+
+#define MX6QDL_I2C3_PINGRP2 \
+       MX6QDL_PAD_GPIO_3__I2C3_SCL                     0x4001b8b1 \
+       MX6QDL_PAD_GPIO_6__I2C3_SDA                     0x4001b8b1
+
+#define MX6QDL_I2C3_PINGRP3 \
+       MX6QDL_PAD_GPIO_5__I2C3_SCL                     0x4001b8b1 \
+       MX6QDL_PAD_GPIO_16__I2C3_SDA                    0x4001b8b1
+
+#define MX6QDL_I2C3_PINGRP4 \
+       MX6QDL_PAD_GPIO_3__I2C3_SCL                     0x4001b8b1 \
+       MX6QDL_PAD_EIM_D18__I2C3_SDA                    0x4001b8b1
+
+#define MX6QDL_IPU1_PINGRP1 \
+       MX6QDL_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK      0x10 \
+       MX6QDL_PAD_DI0_PIN15__IPU1_DI0_PIN15            0x10 \
+       MX6QDL_PAD_DI0_PIN2__IPU1_DI0_PIN02             0x10 \
+       MX6QDL_PAD_DI0_PIN3__IPU1_DI0_PIN03             0x10 \
+       MX6QDL_PAD_DI0_PIN4__IPU1_DI0_PIN04             0x80000000 \
+       MX6QDL_PAD_DISP0_DAT0__IPU1_DISP0_DATA00        0x10 \
+       MX6QDL_PAD_DISP0_DAT1__IPU1_DISP0_DATA01        0x10 \
+       MX6QDL_PAD_DISP0_DAT2__IPU1_DISP0_DATA02        0x10 \
+       MX6QDL_PAD_DISP0_DAT3__IPU1_DISP0_DATA03        0x10 \
+       MX6QDL_PAD_DISP0_DAT4__IPU1_DISP0_DATA04        0x10 \
+       MX6QDL_PAD_DISP0_DAT5__IPU1_DISP0_DATA05        0x10 \
+       MX6QDL_PAD_DISP0_DAT6__IPU1_DISP0_DATA06        0x10 \
+       MX6QDL_PAD_DISP0_DAT7__IPU1_DISP0_DATA07        0x10 \
+       MX6QDL_PAD_DISP0_DAT8__IPU1_DISP0_DATA08        0x10 \
+       MX6QDL_PAD_DISP0_DAT9__IPU1_DISP0_DATA09        0x10 \
+       MX6QDL_PAD_DISP0_DAT10__IPU1_DISP0_DATA10       0x10 \
+       MX6QDL_PAD_DISP0_DAT11__IPU1_DISP0_DATA11       0x10 \
+       MX6QDL_PAD_DISP0_DAT12__IPU1_DISP0_DATA12       0x10 \
+       MX6QDL_PAD_DISP0_DAT13__IPU1_DISP0_DATA13       0x10 \
+       MX6QDL_PAD_DISP0_DAT14__IPU1_DISP0_DATA14       0x10 \
+       MX6QDL_PAD_DISP0_DAT15__IPU1_DISP0_DATA15       0x10 \
+       MX6QDL_PAD_DISP0_DAT16__IPU1_DISP0_DATA16       0x10 \
+       MX6QDL_PAD_DISP0_DAT17__IPU1_DISP0_DATA17       0x10 \
+       MX6QDL_PAD_DISP0_DAT18__IPU1_DISP0_DATA18       0x10 \
+       MX6QDL_PAD_DISP0_DAT19__IPU1_DISP0_DATA19       0x10 \
+       MX6QDL_PAD_DISP0_DAT20__IPU1_DISP0_DATA20       0x10 \
+       MX6QDL_PAD_DISP0_DAT21__IPU1_DISP0_DATA21       0x10 \
+       MX6QDL_PAD_DISP0_DAT22__IPU1_DISP0_DATA22       0x10 \
+       MX6QDL_PAD_DISP0_DAT23__IPU1_DISP0_DATA23       0x10
+
+/* parallel camera */
+#define MX6QDL_IPU1_PINGRP2 \
+       MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19         0x80000000 \
+       MX6QDL_PAD_CSI0_DATA_EN__IPU1_CSI0_DATA_EN      0x80000000 \
+       MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK        0x80000000 \
+       MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC           0x80000000 \
+       MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC          0x80000000
+
+/* parallel port 16-bit */
+#define MX6QDL_IPU1_PINGRP3 \
+       MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04          0x80000000 \
+       MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05          0x80000000 \
+       MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06          0x80000000 \
+       MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07          0x80000000 \
+       MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08          0x80000000 \
+       MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09          0x80000000 \
+       MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18         0x80000000 \
+       MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19         0x80000000 \
+       MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK        0x80000000 \
+       MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC           0x80000000 \
+       MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC          0x80000000
+
+#define MX6QDL_MLB_PINGRP1 \
+       MX6QDL_PAD_GPIO_3__MLB_CLK                      0x71 \
+       MX6QDL_PAD_GPIO_6__MLB_SIG                      0x71 \
+       MX6QDL_PAD_GPIO_2__MLB_DATA                     0x71
+
+#define MX6QDL_MLB_PINGRP2 \
+       MX6QDL_PAD_ENET_TXD1__MLB_CLK                   0x71 \
+       MX6QDL_PAD_GPIO_6__MLB_SIG                      0x71 \
+       MX6QDL_PAD_GPIO_2__MLB_DATA                     0x71
+
+#define MX6QDL_PWM1_PINGRP1 \
+       MX6QDL_PAD_SD1_DAT3__PWM1_OUT                   0x1b0b1
+
+#define MX6QDL_PWM3_PINGRP1 \
+       MX6QDL_PAD_SD4_DAT1__PWM3_OUT                   0x1b0b1
+
+#define MX6QDL_SPDIF_PINGRP1 \
+       MX6QDL_PAD_KEY_COL3__SPDIF_IN                   0x1b0b0
+
+#define MX6QDL_SPDIF_PINGRP2 \
+       MX6QDL_PAD_GPIO_16__SPDIF_IN                    0x1b0b0 \
+       MX6QDL_PAD_GPIO_17__SPDIF_OUT                   0x1b0b0
+
+#define MX6QDL_SPDIF_PINGRP3 \
+       MX6QDL_PAD_ENET_RXD0__SPDIF_OUT                 0x1b0b0
+
+#define MX6QDL_UART1_PINGRP1 \
+       MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA            0x1b0b1 \
+       MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA            0x1b0b1
+
+#define MX6QDL_UART1_PINGRP2 \
+       MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA              0x1b0b1 \
+       MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA              0x1b0b1
+
+#define MX6QDL_UART2_PINGRP1 \
+       MX6QDL_PAD_EIM_D26__UART2_TX_DATA               0x1b0b1 \
+       MX6QDL_PAD_EIM_D27__UART2_RX_DATA               0x1b0b1
+
+/* DTE mode */
+#define MX6QDL_UART2_PINGRP2 \
+       MX6QDL_PAD_EIM_D26__UART2_RX_DATA               0x1b0b1 \
+       MX6QDL_PAD_EIM_D27__UART2_TX_DATA               0x1b0b1 \
+       MX6QDL_PAD_EIM_D28__UART2_DTE_CTS_B             0x1b0b1 \
+       MX6QDL_PAD_EIM_D29__UART2_DTE_RTS_B             0x1b0b1
+
+#define MX6QDL_UART2_PINGRP3 \
+       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA              0x1b0b1 \
+       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA              0x1b0b1
+
+#define MX6QDL_UART3_PINGRP1 \
+       MX6QDL_PAD_SD4_CLK__UART3_RX_DATA               0x1b0b1 \
+       MX6QDL_PAD_SD4_CMD__UART3_TX_DATA               0x1b0b1 \
+       MX6QDL_PAD_EIM_D30__UART3_CTS_B                 0x1b0b1 \
+       MX6QDL_PAD_EIM_EB3__UART3_RTS_B                 0x1b0b1
+
+#define MX6QDL_UART3_PINGRP2 \
+       MX6QDL_PAD_EIM_D24__UART3_TX_DATA               0x1b0b1 \
+       MX6QDL_PAD_EIM_D25__UART3_RX_DATA               0x1b0b1 \
+       MX6QDL_PAD_EIM_D23__UART3_CTS_B                 0x1b0b1 \
+       MX6QDL_PAD_EIM_EB3__UART3_RTS_B                 0x1b0b1
+
+#define MX6QDL_UART3_PINGRP3 \
+       MX6QDL_PAD_EIM_D24__UART3_TX_DATA               0x1b0b1 \
+       MX6QDL_PAD_EIM_D25__UART3_RX_DATA               0x1b0b1
+
+#define MX6QDL_UART4_PINGRP1 \
+       MX6QDL_PAD_KEY_COL0__UART4_TX_DATA              0x1b0b1 \
+       MX6QDL_PAD_KEY_ROW0__UART4_RX_DATA              0x1b0b1
+
+#define MX6QDL_UART5_PINGRP1 \
+       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA              0x1b0b1 \
+       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA              0x1b0b1
+
+#define MX6QDL_USBOTG_PINGRP1 \
+       MX6QDL_PAD_GPIO_1__USB_OTG_ID                   0x17059
+
+#define MX6QDL_USBOTG_PINGRP2 \
+       MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID               0x17059
+
+#define MX6QDL_USBH2_PINGRP1 \
+       MX6QDL_PAD_RGMII_TXC__USB_H2_DATA               0x40013030 \
+       MX6QDL_PAD_RGMII_TX_CTL__USB_H2_STROBE          0x40013030
+
+#define MX6QDL_USBH2_PINGRP2 \
+       MX6QDL_PAD_RGMII_TX_CTL__USB_H2_STROBE          0x40017030
+
+#define MX6QDL_USBH3_PINGRP1 \
+       MX6QDL_PAD_RGMII_RX_CTL__USB_H3_DATA            0x40013030 \
+       MX6QDL_PAD_RGMII_RXC__USB_H3_STROBE             0x40013030
+
+#define MX6QDL_USBH3_PINGRP2 \
+       MX6QDL_PAD_RGMII_RXC__USB_H3_STROBE             0x40017030
+
+#define MX6QDL_USDHC1_D4(pad, pad_data3, pad_clk)      \
+       MX6QDL_PAD_SD1_CMD__SD1_CMD                     pad \
+       MX6QDL_PAD_SD1_CLK__SD1_CLK                     pad_clk \
+       MX6QDL_PAD_SD1_DAT0__SD1_DATA0                  pad \
+       MX6QDL_PAD_SD1_DAT1__SD1_DATA1                  pad \
+       MX6QDL_PAD_SD1_DAT2__SD1_DATA2                  pad \
+       MX6QDL_PAD_SD1_DAT3__SD1_DATA3                  pad_data3
+
+#define MX6QDL_USDHC1_D8(pad, pad_data3, pad_clk)      \
+       MX6QDL_USDHC1_D4(pad, pad_data3, pad_clk)       \
+       MX6QDL_PAD_NANDF_D0__SD1_DATA4                  pad \
+       MX6QDL_PAD_NANDF_D1__SD1_DATA5                  pad \
+       MX6QDL_PAD_NANDF_D2__SD1_DATA6                  pad \
+       MX6QDL_PAD_NANDF_D3__SD1_DATA7                  pad
+
+#define MX6QDL_USDHC2_D4(pad, pad_data3, pad_clk)      \
+       MX6QDL_PAD_SD2_CMD__SD2_CMD                     pad \
+       MX6QDL_PAD_SD2_CLK__SD2_CLK                     pad_clk \
+       MX6QDL_PAD_SD2_DAT0__SD2_DATA0                  pad \
+       MX6QDL_PAD_SD2_DAT1__SD2_DATA1                  pad \
+       MX6QDL_PAD_SD2_DAT2__SD2_DATA2                  pad \
+       MX6QDL_PAD_SD2_DAT3__SD2_DATA3                  pad_data3
+
+#define MX6QDL_USDHC2_D8(pad, pad_data3, pad_clk)      \
+       MX6QDL_USDHC2_D4(pad, pad_data3, pad_clk)       \
+       MX6QDL_PAD_NANDF_D4__SD2_DATA4                  pad \
+       MX6QDL_PAD_NANDF_D5__SD2_DATA5                  pad \
+       MX6QDL_PAD_NANDF_D6__SD2_DATA6                  pad \
+       MX6QDL_PAD_NANDF_D7__SD2_DATA7                  pad
+
+#define MX6QDL_USDHC3_D4(pad, pad_data3, pad_clk)      \
+       MX6QDL_PAD_SD3_CMD__SD3_CMD                     pad \
+       MX6QDL_PAD_SD3_CLK__SD3_CLK                     pad_clk \
+       MX6QDL_PAD_SD3_DAT0__SD3_DATA0                  pad \
+       MX6QDL_PAD_SD3_DAT1__SD3_DATA1                  pad \
+       MX6QDL_PAD_SD3_DAT2__SD3_DATA2                  pad \
+       MX6QDL_PAD_SD3_DAT3__SD3_DATA3                  pad_data3
+
+#define MX6QDL_USDHC3_D8(pad, pad_data3, pad_clk)      \
+       MX6QDL_USDHC3_D4(pad, pad_data3, pad_clk)       \
+       MX6QDL_PAD_SD3_DAT4__SD3_DATA4                  pad \
+       MX6QDL_PAD_SD3_DAT5__SD3_DATA5                  pad \
+       MX6QDL_PAD_SD3_DAT6__SD3_DATA6                  pad \
+       MX6QDL_PAD_SD3_DAT7__SD3_DATA7                  pad
+
+#define MX6QDL_USDHC4_D4(pad, pad_data3, pad_clk)      \
+       MX6QDL_PAD_SD4_CMD__SD4_CMD                     pad \
+       MX6QDL_PAD_SD4_CLK__SD4_CLK                     pad_clk \
+       MX6QDL_PAD_SD4_DAT0__SD4_DATA0                  pad \
+       MX6QDL_PAD_SD4_DAT1__SD4_DATA1                  pad \
+       MX6QDL_PAD_SD4_DAT2__SD4_DATA2                  pad \
+       MX6QDL_PAD_SD4_DAT3__SD4_DATA3                  pad_data3
+
+#define MX6QDL_USDHC4_D8(pad, pad_data3, pad_clk)      \
+       MX6QDL_USDHC4_D4(pad, pad_data3, pad_clk)       \
+       MX6QDL_PAD_SD4_DAT4__SD4_DATA4                  pad \
+       MX6QDL_PAD_SD4_DAT5__SD4_DATA5                  pad \
+       MX6QDL_PAD_SD4_DAT6__SD4_DATA6                  pad \
+       MX6QDL_PAD_SD4_DAT7__SD4_DATA7                  pad
+
+#define MX6QDL_USDHC1_PINGRP_D4               MX6QDL_USDHC1_D4(0x17059,0x17059,0x10059)
+#define MX6QDL_USDHC1_PINGRP_D4_100MHZ MX6QDL_USDHC1_D4(0x170b9,0x170b9,0x100b9)
+#define MX6QDL_USDHC1_PINGRP_D4_200MHZ MX6QDL_USDHC1_D4(0x170f9,0x170f9,0x100f9)
+#define MX6QDL_USDHC1_PINGRP_D8               MX6QDL_USDHC1_D8(0x17059,0x17059,0x10059)
+#define MX6QDL_USDHC1_PINGRP_D8_100MHZ MX6QDL_USDHC1_D8(0x170b9,0x170b9,0x100b9)
+#define MX6QDL_USDHC1_PINGRP_D8_200MHZ MX6QDL_USDHC1_D8(0x170f9,0x170f9,0x100f9)
+
+#define MX6QDL_USDHC2_PINGRP_D4               MX6QDL_USDHC2_D4(0x17059,0x17059,0x10059)
+#define MX6QDL_USDHC2_PINGRP_D4_100MHZ MX6QDL_USDHC2_D4(0x170b9,0x170b9,0x100b9)
+#define MX6QDL_USDHC2_PINGRP_D4_200MHZ MX6QDL_USDHC2_D4(0x170f9,0x170f9,0x100f9)
+#define MX6QDL_USDHC2_PINGRP_D8               MX6QDL_USDHC2_D8(0x17059,0x17059,0x10059)
+#define MX6QDL_USDHC2_PINGRP_D8_100MHZ MX6QDL_USDHC2_D8(0x170b9,0x170b9,0x100b9)
+#define MX6QDL_USDHC2_PINGRP_D8_200MHZ MX6QDL_USDHC2_D8(0x170f9,0x170f9,0x100f9)
+
+#define MX6QDL_USDHC3_PINGRP_D4               MX6QDL_USDHC3_D4(0x17059,0x17059,0x10059)
+#define MX6QDL_USDHC3_PINGRP_D4_100MHZ MX6QDL_USDHC3_D4(0x170b9,0x170b9,0x100b9)
+#define MX6QDL_USDHC3_PINGRP_D4_200MHZ MX6QDL_USDHC3_D4(0x170f9,0x170f9,0x100f9)
+#define MX6QDL_USDHC3_PINGRP_D8               MX6QDL_USDHC3_D8(0x17059,0x17059,0x10059)
+#define MX6QDL_USDHC3_PINGRP_D8_100MHZ MX6QDL_USDHC3_D8(0x170b9,0x170b9,0x100b9)
+#define MX6QDL_USDHC3_PINGRP_D8_200MHZ MX6QDL_USDHC3_D8(0x170f9,0x170f9,0x100f9)
+
+#define MX6QDL_USDHC4_PINGRP_D4               MX6QDL_USDHC4_D4(0x17059,0x17059,0x10059)
+#define MX6QDL_USDHC4_PINGRP_D4_100MHZ MX6QDL_USDHC4_D4(0x170b9,0x170b9,0x100b9)
+#define MX6QDL_USDHC4_PINGRP_D4_200MHZ MX6QDL_USDHC4_D4(0x170f9,0x170f9,0x100f9)
+#define MX6QDL_USDHC4_PINGRP_D8               MX6QDL_USDHC4_D8(0x17059,0x17059,0x10059)
+#define MX6QDL_USDHC4_PINGRP_D8_100MHZ MX6QDL_USDHC4_D8(0x170b9,0x170b9,0x100b9)
+#define MX6QDL_USDHC4_PINGRP_D8_200MHZ MX6QDL_USDHC4_D8(0x170f9,0x170f9,0x100f9)
+
+#define MX6QDL_WEIM_CS0_PINGRP1 \
+       MX6QDL_PAD_EIM_CS0__EIM_CS0_B                   0xb0b1
+
+#define MX6QDL_WEIM_NOR_PINGRP1 \
+       MX6QDL_PAD_EIM_OE__EIM_OE_B                     0xb0b1 \
+       MX6QDL_PAD_EIM_RW__EIM_RW                       0xb0b1 \
+       MX6QDL_PAD_EIM_WAIT__EIM_WAIT_B                 0xb060 \
+       MX6QDL_PAD_EIM_D16__EIM_DATA16                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D17__EIM_DATA17                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D18__EIM_DATA18                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D19__EIM_DATA19                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D20__EIM_DATA20                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D21__EIM_DATA21                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D22__EIM_DATA22                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D23__EIM_DATA23                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D24__EIM_DATA24                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D25__EIM_DATA25                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D26__EIM_DATA26                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D27__EIM_DATA27                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D28__EIM_DATA28                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D29__EIM_DATA29                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D30__EIM_DATA30                  0x1b0b0 \
+       MX6QDL_PAD_EIM_D31__EIM_DATA31                  0x1b0b0 \
+       MX6QDL_PAD_EIM_A23__EIM_ADDR23                  0xb0b1 \
+       MX6QDL_PAD_EIM_A22__EIM_ADDR22                  0xb0b1 \
+       MX6QDL_PAD_EIM_A21__EIM_ADDR21                  0xb0b1 \
+       MX6QDL_PAD_EIM_A20__EIM_ADDR20                  0xb0b1 \
+       MX6QDL_PAD_EIM_A19__EIM_ADDR19                  0xb0b1 \
+       MX6QDL_PAD_EIM_A18__EIM_ADDR18                  0xb0b1 \
+       MX6QDL_PAD_EIM_A17__EIM_ADDR17                  0xb0b1 \
+       MX6QDL_PAD_EIM_A16__EIM_ADDR16                  0xb0b1 \
+       MX6QDL_PAD_EIM_DA15__EIM_AD15                   0xb0b1 \
+       MX6QDL_PAD_EIM_DA14__EIM_AD14                   0xb0b1 \
+       MX6QDL_PAD_EIM_DA13__EIM_AD13                   0xb0b1 \
+       MX6QDL_PAD_EIM_DA12__EIM_AD12                   0xb0b1 \
+       MX6QDL_PAD_EIM_DA11__EIM_AD11                   0xb0b1 \
+       MX6QDL_PAD_EIM_DA10__EIM_AD10                   0xb0b1 \
+       MX6QDL_PAD_EIM_DA9__EIM_AD09                    0xb0b1 \
+       MX6QDL_PAD_EIM_DA8__EIM_AD08                    0xb0b1 \
+       MX6QDL_PAD_EIM_DA7__EIM_AD07                    0xb0b1 \
+       MX6QDL_PAD_EIM_DA6__EIM_AD06                    0xb0b1 \
+       MX6QDL_PAD_EIM_DA5__EIM_AD05                    0xb0b1 \
+       MX6QDL_PAD_EIM_DA4__EIM_AD04                    0xb0b1 \
+       MX6QDL_PAD_EIM_DA3__EIM_AD03                    0xb0b1 \
+       MX6QDL_PAD_EIM_DA2__EIM_AD02                    0xb0b1 \
+       MX6QDL_PAD_EIM_DA1__EIM_AD01                    0xb0b1 \
+       MX6QDL_PAD_EIM_DA0__EIM_AD00                    0xb0b1
+
+#endif /* __DTS_IMX6QDL_PINGRP_H */
index ff6f1e8f2dd9bfa54a6387998421f1ac8877c841..a526796fdaacc6ecf6ebfe03342cf9f81a00acbe 100644 (file)
@@ -20,7 +20,7 @@
        fsl,spi-num-chipselects = <1>;
        cs-gpios = <&gpio3 19 0>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_ecspi1_1 &pinctrl_ecspi1_sabreauto>;
+       pinctrl-0 = <&pinctrl_ecspi1 &pinctrl_ecspi1_cs>;
        status = "disabled"; /* pin conflict with WEIM NOR */
 
        flash: m25p80@0 {
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_enet_2>;
+       pinctrl-0 = <&pinctrl_enet>;
        phy-mode = "rgmii";
        status = "okay";
 };
 
 &gpmi {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_gpmi_nand_1>;
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
        status = "okay";
 };
 
@@ -49,7 +49,7 @@
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx6qdl-sabreauto {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 0x80000000
                                MX6QDL_PAD_GPIO_18__SD3_VSELECT 0x17059
                        >;
                };
-       };
 
-       ecspi1 {
-               pinctrl_ecspi1_sabreauto: ecspi1-sabreauto {
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <MX6QDL_ECSPI1_PINGRP1>;
+               };
+
+               pinctrl_ecspi1_cs: ecspi1cs {
                        fsl,pins = <
                                MX6QDL_PAD_EIM_D19__GPIO3_IO19 0x80000000
                        >;
                };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP2>;
+               };
+
+               pinctrl_gpmi_nand: gpminandgrp {
+                       fsl,pins = <MX6QDL_GPMI_NAND_PINGRP1>;
+               };
+
+               pinctrl_uart4: uart4grp {
+                       fsl,pins = <MX6QDL_UART4_PINGRP1>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D8>;
+               };
+
+               pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D8_100MHZ>;
+               };
+
+               pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D8_200MHZ>;
+               };
+
+               pinctrl_weim_cs0: weimcs0grp {
+                       fsl,pins = <MX6QDL_WEIM_CS0_PINGRP1>;
+               };
+
+               pinctrl_weim_nor: weimnorgrp {
+                       fsl,pins = <MX6QDL_WEIM_NOR_PINGRP1>;
+               };
        };
 };
 
 &uart4 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart4_1>;
+       pinctrl-0 = <&pinctrl_uart4>;
        status = "okay";
 };
 
 &usdhc3 {
        pinctrl-names = "default", "state_100mhz", "state_200mhz";
-       pinctrl-0 = <&pinctrl_usdhc3_1>;
-       pinctrl-1 = <&pinctrl_usdhc3_1_100mhz>;
-       pinctrl-2 = <&pinctrl_usdhc3_1_200mhz>;
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
        cd-gpios = <&gpio6 15 0>;
        wp-gpios = <&gpio1 13 0>;
        status = "okay";
 
 &weim {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_weim_nor_1 &pinctrl_weim_cs0_1>;
+       pinctrl-0 = <&pinctrl_weim_nor &pinctrl_weim_cs0>;
        #address-cells = <2>;
        #size-cells = <1>;
        ranges = <0 0 0x08000000 0x08000000>;
index e75e11b36dffec5ea9e695c01d8f66ac35b83dee..570767f8c8313c74ce4a163848c1988e1d2e65aa 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_usb_otg_vbus: usb_otg_vbus {
+               reg_usb_otg_vbus: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "usb_otg_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
@@ -27,8 +30,9 @@
                        enable-active-high;
                };
 
-               reg_usb_h1_vbus: usb_h1_vbus {
+               reg_usb_h1_vbus: regulator@1 {
                        compatible = "regulator-fixed";
+                       reg = <1>;
                        regulator-name = "usb_h1_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
@@ -36,8 +40,9 @@
                        enable-active-high;
                };
 
-               reg_audio: wm8962_supply {
+               reg_audio: regulator@2 {
                        compatible = "regulator-fixed";
+                       reg = <2>;
                        regulator-name = "wm8962-supply";
                        gpio = <&gpio4 10 0>;
                        enable-active-high;
@@ -92,7 +97,7 @@
 
 &audmux {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_audmux_2>;
+       pinctrl-0 = <&pinctrl_audmux>;
        status = "okay";
 };
 
        fsl,spi-num-chipselects = <1>;
        cs-gpios = <&gpio4 9 0>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_ecspi1_2>;
+       pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
 
        flash: m25p80@0 {
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_enet_1>;
+       pinctrl-0 = <&pinctrl_enet>;
        phy-mode = "rgmii";
        phy-reset-gpios = <&gpio1 25 0>;
        status = "okay";
 &i2c1 {
        clock-frequency = <100000>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c1_2>;
+       pinctrl-0 = <&pinctrl_i2c1>;
        status = "okay";
 
        codec: wm8962@1a {
 &i2c3 {
        clock-frequency = <100000>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c3_2>;
+       pinctrl-0 = <&pinctrl_i2c3>;
        status = "okay";
 
        egalax_ts@04 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx6qdl-sabresd {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX6QDL_PAD_GPIO_4__GPIO1_IO04   0x80000000
                                MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x80000000
                        >;
                };
+
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX6QDL_AUDMUX_PINGRP2>;
+               };
+
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <MX6QDL_ECSPI1_PINGRP2>;
+               };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <MX6QDL_I2C1_PINGRP2>;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <MX6QDL_I2C3_PINGRP2>;
+               };
+
+               pinctrl_pwm1: pwm1grp {
+                       fsl,pins = <MX6QDL_PWM1_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX6QDL_UART1_PINGRP1>;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <MX6QDL_USBOTG_PINGRP2>;
+               };
+
+               pinctrl_usdhc2: usdhc2grp {
+                       fsl,pins = <MX6QDL_USDHC2_PINGRP_D8>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D8>;
+               };
        };
 };
 
 
 &pwm1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_pwm0_1>;
+       pinctrl-0 = <&pinctrl_pwm1>;
        status = "okay";
 };
 
 
 &uart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart1_1>;
+       pinctrl-0 = <&pinctrl_uart1>;
        status = "okay";
 };
 
 &usbotg {
        vbus-supply = <&reg_usb_otg_vbus>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usbotg_2>;
+       pinctrl-0 = <&pinctrl_usbotg>;
        disable-over-current;
        status = "okay";
 };
 
 &usdhc2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc2_1>;
+       pinctrl-0 = <&pinctrl_usdhc2>;
        bus-width = <8>;
        cd-gpios = <&gpio2 2 0>;
        wp-gpios = <&gpio2 3 0>;
 
 &usdhc3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc3_1>;
+       pinctrl-0 = <&pinctrl_usdhc3>;
        bus-width = <8>;
        cd-gpios = <&gpio2 0 0>;
        wp-gpios = <&gpio2 1 0>;
index 35f54792916795dd85d77624289d94ee3ab97811..88894b13ccd23e96702b27501c012a8f3aa1921a 100644 (file)
 / {
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_2p5v: 2p5v {
+               reg_2p5v: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "2P5V";
                        regulator-min-microvolt = <2500000>;
                        regulator-max-microvolt = <2500000>;
                        regulator-always-on;
                };
 
-               reg_3p3v: 3p3v {
+               reg_3p3v: regulator@1 {
                        compatible = "regulator-fixed";
+                       reg = <1>;
                        regulator-name = "3P3V";
                        regulator-min-microvolt = <3300000>;
                        regulator-max-microvolt = <3300000>;
 
 &audmux {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_audmux_2>;
+       pinctrl-0 = <&pinctrl_audmux>;
        status = "okay";
 };
 
 &i2c2 {
        clock-frequency = <100000>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_i2c2_2>;
+       pinctrl-0 = <&pinctrl_i2c2>;
        status = "okay";
 
        codec: sgtl5000@0a {
@@ -77,7 +81,7 @@
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx6qdl-wandboard {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX6QDL_PAD_GPIO_0__CCM_CLKO1     0x130b0
                                MX6QDL_PAD_EIM_D29__GPIO3_IO29   0x80000000
                        >;
                };
+
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <MX6QDL_AUDMUX_PINGRP2>;
+               };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <MX6QDL_ENET_PINGRP1>;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <MX6QDL_I2C2_PINGRP2>;
+               };
+
+               pinctrl_spdif: spdifgrp {
+                       fsl,pins = <MX6QDL_SPDIF_PINGRP3>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX6QDL_UART1_PINGRP1>;
+               };
+
+               pinctrl_uart3: uart3grp {
+                       fsl,pins = <MX6QDL_UART3_PINGRP2>;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <MX6QDL_USBOTG_PINGRP1>;
+               };
+
+               pinctrl_usdhc1: usdhc1grp {
+                       fsl,pins = <MX6QDL_USDHC1_PINGRP_D4>;
+               };
+
+               pinctrl_usdhc2: usdhc2grp {
+                       fsl,pins = <MX6QDL_USDHC2_PINGRP_D4>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6QDL_USDHC3_PINGRP_D4>;
+               };
        };
 };
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_enet_1>;
+       pinctrl-0 = <&pinctrl_enet>;
        phy-mode = "rgmii";
        phy-reset-gpios = <&gpio3 29 0>;
        status = "okay";
 
 &spdif {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_spdif_3>;
+       pinctrl-0 = <&pinctrl_spdif>;
        status = "okay";
 };
 
 
 &uart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart1_1>;
+       pinctrl-0 = <&pinctrl_uart1>;
        status = "okay";
 };
 
 &uart3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart3_2>;
+       pinctrl-0 = <&pinctrl_uart3>;
        fsl,uart-has-rtscts;
        status = "okay";
 };
 
 &usbotg {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usbotg_1>;
+       pinctrl-0 = <&pinctrl_usbotg>;
        disable-over-current;
        dr_mode = "peripheral";
        status = "okay";
 
 &usdhc1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc1_2>;
+       pinctrl-0 = <&pinctrl_usdhc1>;
        cd-gpios = <&gpio1 2 0>;
        status = "okay";
 };
 
 &usdhc2 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc2_2>;
+       pinctrl-0 = <&pinctrl_usdhc2>;
        non-removable;
        status = "okay";
 };
 
 &usdhc3 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usdhc3_2>;
+       pinctrl-0 = <&pinctrl_usdhc3>;
        cd-gpios = <&gpio3 9 0>;
        status = "okay";
 };
index fb28b2ecb1db37a28a9effbd7bea591ace78554a..16f69741177e78bec158f064fa963f7c3b7cfe6b 100644 (file)
                dma_apbh: dma-apbh@00110000 {
                        compatible = "fsl,imx6q-dma-apbh", "fsl,imx28-dma-apbh";
                        reg = <0x00110000 0x2000>;
-                       interrupts = <0 13 0x04>, <0 13 0x04>, <0 13 0x04>, <0 13 0x04>;
+                       interrupts = <0 13 IRQ_TYPE_LEVEL_HIGH>,
+                                    <0 13 IRQ_TYPE_LEVEL_HIGH>,
+                                    <0 13 IRQ_TYPE_LEVEL_HIGH>,
+                                    <0 13 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-names = "gpmi0", "gpmi1", "gpmi2", "gpmi3";
                        #dma-cells = <1>;
                        dma-channels = <4>;
@@ -88,7 +91,7 @@
                        #size-cells = <1>;
                        reg = <0x00112000 0x2000>, <0x00114000 0x2000>;
                        reg-names = "gpmi-nand", "bch";
-                       interrupts = <0 15 0x04>;
+                       interrupts = <0 15 IRQ_TYPE_LEVEL_HIGH>;
                        interrupt-names = "bch";
                        clocks = <&clks 152>, <&clks 153>, <&clks 151>,
                                 <&clks 150>, <&clks 149>;
                L2: l2-cache@00a02000 {
                        compatible = "arm,pl310-cache";
                        reg = <0x00a02000 0x1000>;
-                       interrupts = <0 92 0x04>;
+                       interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>;
                        cache-unified;
                        cache-level = <2>;
                        arm,tag-latency = <4 2 3>;
                                  0x81000000 0 0          0x01f80000 0 0x00010000 /* downstream I/O */
                                  0x82000000 0 0x01000000 0x01000000 0 0x00f00000>; /* non-prefetchable memory */
                        num-lanes = <1>;
-                       interrupts = <0 123 0x04>;
+                       interrupts = <0 123 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&clks 189>, <&clks 187>, <&clks 206>, <&clks 144>;
                        clock-names = "pcie_ref_125m", "sata_ref_100m", "lvds_gate", "pcie_axi";
                        status = "disabled";
 
                pmu {
                        compatible = "arm,cortex-a9-pmu";
-                       interrupts = <0 94 0x04>;
+                       interrupts = <0 94 IRQ_TYPE_LEVEL_HIGH>;
                };
 
                aips-bus@02000000 { /* AIPS1 */
                                spdif: spdif@02004000 {
                                        compatible = "fsl,imx35-spdif";
                                        reg = <0x02004000 0x4000>;
-                                       interrupts = <0 52 0x04>;
+                                       interrupts = <0 52 IRQ_TYPE_LEVEL_HIGH>;
                                        dmas = <&sdma 14 18 0>,
                                               <&sdma 15 18 0>;
                                        dma-names = "rx", "tx";
                                        #size-cells = <0>;
                                        compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
                                        reg = <0x02008000 0x4000>;
-                                       interrupts = <0 31 0x04>;
+                                       interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks 112>, <&clks 112>;
                                        clock-names = "ipg", "per";
                                        status = "disabled";
                                        #size-cells = <0>;
                                        compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
                                        reg = <0x0200c000 0x4000>;
-                                       interrupts = <0 32 0x04>;
+                                       interrupts = <0 32 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks 113>, <&clks 113>;
                                        clock-names = "ipg", "per";
                                        status = "disabled";
                                        #size-cells = <0>;
                                        compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
                                        reg = <0x02010000 0x4000>;
-                                       interrupts = <0 33 0x04>;
+                                       interrupts = <0 33 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks 114>, <&clks 114>;
                                        clock-names = "ipg", "per";
                                        status = "disabled";
                                        #size-cells = <0>;
                                        compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
                                        reg = <0x02014000 0x4000>;
-                                       interrupts = <0 34 0x04>;
+                                       interrupts = <0 34 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks 115>, <&clks 115>;
                                        clock-names = "ipg", "per";
                                        status = "disabled";
                                uart1: serial@02020000 {
                                        compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
                                        reg = <0x02020000 0x4000>;
-                                       interrupts = <0 26 0x04>;
+                                       interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks 160>, <&clks 161>;
                                        clock-names = "ipg", "per";
                                        dmas = <&sdma 25 4 0>, <&sdma 26 4 0>;
 
                                esai: esai@02024000 {
                                        reg = <0x02024000 0x4000>;
-                                       interrupts = <0 51 0x04>;
+                                       interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH>;
                                };
 
                                ssi1: ssi@02028000 {
                                        compatible = "fsl,imx6q-ssi","fsl,imx21-ssi";
                                        reg = <0x02028000 0x4000>;
-                                       interrupts = <0 46 0x04>;
+                                       interrupts = <0 46 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks 178>;
-                                       dmas = <&sdma 37 1 0>,
-                                              <&sdma 38 1 0>;
+                                       dmas = <&sdma 37 22 0>,
+                                              <&sdma 38 22 0>;
                                        dma-names = "rx", "tx";
                                        fsl,fifo-depth = <15>;
                                        fsl,ssi-dma-events = <38 37>;
                                ssi2: ssi@0202c000 {
                                        compatible = "fsl,imx6q-ssi","fsl,imx21-ssi";
                                        reg = <0x0202c000 0x4000>;
-                                       interrupts = <0 47 0x04>;
+                                       interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks 179>;
-                                       dmas = <&sdma 41 1 0>,
-                                              <&sdma 42 1 0>;
+                                       dmas = <&sdma 41 22 0>,
+                                              <&sdma 42 22 0>;
                                        dma-names = "rx", "tx";
                                        fsl,fifo-depth = <15>;
                                        fsl,ssi-dma-events = <42 41>;
                                ssi3: ssi@02030000 {
                                        compatible = "fsl,imx6q-ssi","fsl,imx21-ssi";
                                        reg = <0x02030000 0x4000>;
-                                       interrupts = <0 48 0x04>;
+                                       interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks 180>;
-                                       dmas = <&sdma 45 1 0>,
-                                              <&sdma 46 1 0>;
+                                       dmas = <&sdma 45 22 0>,
+                                              <&sdma 46 22 0>;
                                        dma-names = "rx", "tx";
                                        fsl,fifo-depth = <15>;
                                        fsl,ssi-dma-events = <46 45>;
 
                                asrc: asrc@02034000 {
                                        reg = <0x02034000 0x4000>;
-                                       interrupts = <0 50 0x04>;
+                                       interrupts = <0 50 IRQ_TYPE_LEVEL_HIGH>;
                                };
 
                                spba@0203c000 {
 
                        vpu: vpu@02040000 {
                                reg = <0x02040000 0x3c000>;
-                               interrupts = <0 3 0x04 0 12 0x04>;
+                               interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 12 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        aipstz@0207c000 { /* AIPSTZ1 */
                                #pwm-cells = <2>;
                                compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
                                reg = <0x02080000 0x4000>;
-                               interrupts = <0 83 0x04>;
+                               interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 62>, <&clks 145>;
                                clock-names = "ipg", "per";
                        };
                                #pwm-cells = <2>;
                                compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
                                reg = <0x02084000 0x4000>;
-                               interrupts = <0 84 0x04>;
+                               interrupts = <0 84 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 62>, <&clks 146>;
                                clock-names = "ipg", "per";
                        };
                                #pwm-cells = <2>;
                                compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
                                reg = <0x02088000 0x4000>;
-                               interrupts = <0 85 0x04>;
+                               interrupts = <0 85 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 62>, <&clks 147>;
                                clock-names = "ipg", "per";
                        };
                                #pwm-cells = <2>;
                                compatible = "fsl,imx6q-pwm", "fsl,imx27-pwm";
                                reg = <0x0208c000 0x4000>;
-                               interrupts = <0 86 0x04>;
+                               interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 62>, <&clks 148>;
                                clock-names = "ipg", "per";
                        };
                        can1: flexcan@02090000 {
                                compatible = "fsl,imx6q-flexcan";
                                reg = <0x02090000 0x4000>;
-                               interrupts = <0 110 0x04>;
+                               interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 108>, <&clks 109>;
                                clock-names = "ipg", "per";
+                               status = "disabled";
                        };
 
                        can2: flexcan@02094000 {
                                compatible = "fsl,imx6q-flexcan";
                                reg = <0x02094000 0x4000>;
-                               interrupts = <0 111 0x04>;
+                               interrupts = <0 111 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 110>, <&clks 111>;
                                clock-names = "ipg", "per";
+                               status = "disabled";
                        };
 
                        gpt: gpt@02098000 {
                                compatible = "fsl,imx6q-gpt", "fsl,imx31-gpt";
                                reg = <0x02098000 0x4000>;
-                               interrupts = <0 55 0x04>;
+                               interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 119>, <&clks 120>;
                                clock-names = "ipg", "per";
                        };
                        gpio1: gpio@0209c000 {
                                compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio";
                                reg = <0x0209c000 0x4000>;
-                               interrupts = <0 66 0x04 0 67 0x04>;
+                               interrupts = <0 66 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 67 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                        gpio2: gpio@020a0000 {
                                compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio";
                                reg = <0x020a0000 0x4000>;
-                               interrupts = <0 68 0x04 0 69 0x04>;
+                               interrupts = <0 68 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 69 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                        gpio3: gpio@020a4000 {
                                compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio";
                                reg = <0x020a4000 0x4000>;
-                               interrupts = <0 70 0x04 0 71 0x04>;
+                               interrupts = <0 70 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 71 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                        gpio4: gpio@020a8000 {
                                compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio";
                                reg = <0x020a8000 0x4000>;
-                               interrupts = <0 72 0x04 0 73 0x04>;
+                               interrupts = <0 72 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 73 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                        gpio5: gpio@020ac000 {
                                compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio";
                                reg = <0x020ac000 0x4000>;
-                               interrupts = <0 74 0x04 0 75 0x04>;
+                               interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 75 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                        gpio6: gpio@020b0000 {
                                compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio";
                                reg = <0x020b0000 0x4000>;
-                               interrupts = <0 76 0x04 0 77 0x04>;
+                               interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 77 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                        gpio7: gpio@020b4000 {
                                compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio";
                                reg = <0x020b4000 0x4000>;
-                               interrupts = <0 78 0x04 0 79 0x04>;
+                               interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 79 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
 
                        kpp: kpp@020b8000 {
                                reg = <0x020b8000 0x4000>;
-                               interrupts = <0 82 0x04>;
+                               interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        wdog1: wdog@020bc000 {
                                compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt";
                                reg = <0x020bc000 0x4000>;
-                               interrupts = <0 80 0x04>;
+                               interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 0>;
                        };
 
                        wdog2: wdog@020c0000 {
                                compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt";
                                reg = <0x020c0000 0x4000>;
-                               interrupts = <0 81 0x04>;
+                               interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 0>;
                                status = "disabled";
                        };
                        clks: ccm@020c4000 {
                                compatible = "fsl,imx6q-ccm";
                                reg = <0x020c4000 0x4000>;
-                               interrupts = <0 87 0x04 0 88 0x04>;
+                               interrupts = <0 87 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 88 IRQ_TYPE_LEVEL_HIGH>;
                                #clock-cells = <1>;
                        };
 
                        anatop: anatop@020c8000 {
                                compatible = "fsl,imx6q-anatop", "syscon", "simple-bus";
                                reg = <0x020c8000 0x1000>;
-                               interrupts = <0 49 0x04 0 54 0x04 0 127 0x04>;
+                               interrupts = <0 49 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 54 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 127 IRQ_TYPE_LEVEL_HIGH>;
 
                                regulator-1p1@110 {
                                        compatible = "fsl,anatop-regulator";
 
                        tempmon: tempmon {
                                compatible = "fsl,imx6q-tempmon";
-                               interrupts = <0 49 0x04>;
+                               interrupts = <0 49 IRQ_TYPE_LEVEL_HIGH>;
                                fsl,tempmon = <&anatop>;
                                fsl,tempmon-data = <&ocotp>;
                        };
                        usbphy1: usbphy@020c9000 {
                                compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy";
                                reg = <0x020c9000 0x1000>;
-                               interrupts = <0 44 0x04>;
+                               interrupts = <0 44 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 182>;
                        };
 
                        usbphy2: usbphy@020ca000 {
                                compatible = "fsl,imx6q-usbphy", "fsl,imx23-usbphy";
                                reg = <0x020ca000 0x1000>;
-                               interrupts = <0 45 0x04>;
+                               interrupts = <0 45 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 183>;
                        };
 
                                snvs-rtc-lp@34 {
                                        compatible = "fsl,sec-v4.0-mon-rtc-lp";
                                        reg = <0x34 0x58>;
-                                       interrupts = <0 19 0x04 0 20 0x04>;
+                                       interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
+                                                    <0 20 IRQ_TYPE_LEVEL_HIGH>;
                                };
                        };
 
                        epit1: epit@020d0000 { /* EPIT1 */
                                reg = <0x020d0000 0x4000>;
-                               interrupts = <0 56 0x04>;
+                               interrupts = <0 56 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        epit2: epit@020d4000 { /* EPIT2 */
                                reg = <0x020d4000 0x4000>;
-                               interrupts = <0 57 0x04>;
+                               interrupts = <0 57 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        src: src@020d8000 {
                                compatible = "fsl,imx6q-src", "fsl,imx51-src";
                                reg = <0x020d8000 0x4000>;
-                               interrupts = <0 91 0x04 0 96 0x04>;
+                               interrupts = <0 91 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 96 IRQ_TYPE_LEVEL_HIGH>;
                                #reset-cells = <1>;
                        };
 
                        gpc: gpc@020dc000 {
                                compatible = "fsl,imx6q-gpc";
                                reg = <0x020dc000 0x4000>;
-                               interrupts = <0 89 0x04 0 90 0x04>;
+                               interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 90 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        gpr: iomuxc-gpr@020e0000 {
                        iomuxc: iomuxc@020e0000 {
                                compatible = "fsl,imx6dl-iomuxc", "fsl,imx6q-iomuxc";
                                reg = <0x020e0000 0x4000>;
-
-                               audmux {
-                                       pinctrl_audmux_1: audmux-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD2_DAT0__AUD4_RXD  0x80000000
-                                                       MX6QDL_PAD_SD2_DAT3__AUD4_TXC  0x80000000
-                                                       MX6QDL_PAD_SD2_DAT2__AUD4_TXD  0x80000000
-                                                       MX6QDL_PAD_SD2_DAT1__AUD4_TXFS 0x80000000
-                                               >;
-                                       };
-
-                                       pinctrl_audmux_2: audmux-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_CSI0_DAT7__AUD3_RXD  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT4__AUD3_TXC  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT5__AUD3_TXD  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x80000000
-                                               >;
-                                       };
-
-                                       pinctrl_audmux_3: audmux-3 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_DISP0_DAT16__AUD5_TXC  0x80000000
-                                                       MX6QDL_PAD_DISP0_DAT18__AUD5_TXFS 0x80000000
-                                                       MX6QDL_PAD_DISP0_DAT19__AUD5_RXD  0x80000000
-                                               >;
-                                       };
-                               };
-
-                               ecspi1 {
-                                       pinctrl_ecspi1_1: ecspi1grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_D17__ECSPI1_MISO 0x100b1
-                                                       MX6QDL_PAD_EIM_D18__ECSPI1_MOSI 0x100b1
-                                                       MX6QDL_PAD_EIM_D16__ECSPI1_SCLK 0x100b1
-                                               >;
-                                       };
-
-                                       pinctrl_ecspi1_2: ecspi1grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_KEY_COL1__ECSPI1_MISO 0x100b1
-                                                       MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI 0x100b1
-                                                       MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK 0x100b1
-                                               >;
-                                       };
-                               };
-
-                               ecspi3 {
-                                       pinctrl_ecspi3_1: ecspi3grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_DISP0_DAT2__ECSPI3_MISO 0x100b1
-                                                       MX6QDL_PAD_DISP0_DAT1__ECSPI3_MOSI 0x100b1
-                                                       MX6QDL_PAD_DISP0_DAT0__ECSPI3_SCLK 0x100b1
-                                               >;
-                                       };
-                               };
-
-                               enet {
-                                       pinctrl_enet_1: enetgrp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO       0x1b0b0
-                                                       MX6QDL_PAD_ENET_MDC__ENET_MDC         0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
-                                                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK  0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
-                                                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK      0x4001b0a8
-                                               >;
-                                       };
-
-                                       pinctrl_enet_2: enetgrp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_KEY_COL1__ENET_MDIO        0x1b0b0
-                                                       MX6QDL_PAD_KEY_COL2__ENET_MDC         0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
-                                                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK  0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
-                                               >;
-                                       };
-
-                                       pinctrl_enet_3: enetgrp-3 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO       0x1b0b0
-                                                       MX6QDL_PAD_ENET_MDC__ENET_MDC         0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
-                                                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK  0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3       0x1b0b0
-                                                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
-                                                       MX6QDL_PAD_ENET_TX_EN__ENET_TX_EN     0x1b0b0
-                                               >;
-                                       };
-                               };
-
-                               esai {
-                                       pinctrl_esai_1: esaigrp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_ENET_RXD0__ESAI_TX_HF_CLK 0x1b030
-                                                       MX6QDL_PAD_ENET_CRS_DV__ESAI_TX_CLK  0x1b030
-                                                       MX6QDL_PAD_ENET_RXD1__ESAI_TX_FS     0x1b030
-                                                       MX6QDL_PAD_ENET_TX_EN__ESAI_TX3_RX2  0x1b030
-                                                       MX6QDL_PAD_ENET_TXD1__ESAI_TX2_RX3   0x1b030
-                                                       MX6QDL_PAD_ENET_TXD0__ESAI_TX4_RX1   0x1b030
-                                                       MX6QDL_PAD_ENET_MDC__ESAI_TX5_RX0    0x1b030
-                                                       MX6QDL_PAD_NANDF_CS2__ESAI_TX0       0x1b030
-                                                       MX6QDL_PAD_NANDF_CS3__ESAI_TX1       0x1b030
-                                               >;
-                                       };
-
-                                       pinctrl_esai_2: esaigrp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_ENET_CRS_DV__ESAI_TX_CLK 0x1b030
-                                                       MX6QDL_PAD_ENET_RXD1__ESAI_TX_FS    0x1b030
-                                                       MX6QDL_PAD_ENET_TX_EN__ESAI_TX3_RX2 0x1b030
-                                                       MX6QDL_PAD_GPIO_5__ESAI_TX2_RX3     0x1b030
-                                                       MX6QDL_PAD_ENET_TXD0__ESAI_TX4_RX1  0x1b030
-                                                       MX6QDL_PAD_ENET_MDC__ESAI_TX5_RX0   0x1b030
-                                                       MX6QDL_PAD_GPIO_17__ESAI_TX0        0x1b030
-                                                       MX6QDL_PAD_NANDF_CS3__ESAI_TX1      0x1b030
-                                                       MX6QDL_PAD_ENET_MDIO__ESAI_RX_CLK   0x1b030
-                                                       MX6QDL_PAD_GPIO_9__ESAI_RX_FS       0x1b030
-                                               >;
-                                       };
-                               };
-
-                               flexcan1 {
-                                       pinctrl_flexcan1_1: flexcan1grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x80000000
-                                                       MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX 0x80000000
-                                               >;
-                                       };
-
-                                       pinctrl_flexcan1_2: flexcan1grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_GPIO_7__FLEXCAN1_TX   0x80000000
-                                                       MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX 0x80000000
-                                               >;
-                                       };
-                               };
-
-                               flexcan2 {
-                                       pinctrl_flexcan2_1: flexcan2grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_KEY_COL4__FLEXCAN2_TX 0x80000000
-                                                       MX6QDL_PAD_KEY_ROW4__FLEXCAN2_RX 0x80000000
-                                               >;
-                                       };
-                               };
-
-                               gpmi-nand {
-                                       pinctrl_gpmi_nand_1: gpmi-nand-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_NANDF_CLE__NAND_CLE     0xb0b1
-                                                       MX6QDL_PAD_NANDF_ALE__NAND_ALE     0xb0b1
-                                                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B   0xb0b1
-                                                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B 0xb000
-                                                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B   0xb0b1
-                                                       MX6QDL_PAD_NANDF_CS1__NAND_CE1_B   0xb0b1
-                                                       MX6QDL_PAD_SD4_CMD__NAND_RE_B      0xb0b1
-                                                       MX6QDL_PAD_SD4_CLK__NAND_WE_B      0xb0b1
-                                                       MX6QDL_PAD_NANDF_D0__NAND_DATA00   0xb0b1
-                                                       MX6QDL_PAD_NANDF_D1__NAND_DATA01   0xb0b1
-                                                       MX6QDL_PAD_NANDF_D2__NAND_DATA02   0xb0b1
-                                                       MX6QDL_PAD_NANDF_D3__NAND_DATA03   0xb0b1
-                                                       MX6QDL_PAD_NANDF_D4__NAND_DATA04   0xb0b1
-                                                       MX6QDL_PAD_NANDF_D5__NAND_DATA05   0xb0b1
-                                                       MX6QDL_PAD_NANDF_D6__NAND_DATA06   0xb0b1
-                                                       MX6QDL_PAD_NANDF_D7__NAND_DATA07   0xb0b1
-                                                       MX6QDL_PAD_SD4_DAT0__NAND_DQS      0x00b1
-                                               >;
-                                       };
-                               };
-
-                               hdmi_hdcp {
-                                       pinctrl_hdmi_hdcp_1: hdmihdcpgrp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_KEY_COL3__HDMI_TX_DDC_SCL 0x4001b8b1
-                                                       MX6QDL_PAD_KEY_ROW3__HDMI_TX_DDC_SDA 0x4001b8b1
-                                               >;
-                                       };
-
-                                       pinctrl_hdmi_hdcp_2: hdmihdcpgrp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_EB2__HDMI_TX_DDC_SCL 0x4001b8b1
-                                                       MX6QDL_PAD_EIM_D16__HDMI_TX_DDC_SDA 0x4001b8b1
-                                               >;
-                                       };
-
-                                       pinctrl_hdmi_hdcp_3: hdmihdcpgrp-3 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_EB2__HDMI_TX_DDC_SCL  0x4001b8b1
-                                                       MX6QDL_PAD_KEY_ROW3__HDMI_TX_DDC_SDA 0x4001b8b1
-                                               >;
-                                       };
-                               };
-
-                               hdmi_cec {
-                                       pinctrl_hdmi_cec_1: hdmicecgrp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_A25__HDMI_TX_CEC_LINE 0x1f8b0
-                                               >;
-                                       };
-
-                                       pinctrl_hdmi_cec_2: hdmicecgrp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_KEY_ROW2__HDMI_TX_CEC_LINE 0x1f8b0
-                                               >;
-                                       };
-                               };
-
-                               i2c1 {
-                                       pinctrl_i2c1_1: i2c1grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_D21__I2C1_SCL 0x4001b8b1
-                                                       MX6QDL_PAD_EIM_D28__I2C1_SDA 0x4001b8b1
-                                               >;
-                                       };
-
-                                       pinctrl_i2c1_2: i2c1grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_CSI0_DAT8__I2C1_SDA 0x4001b8b1
-                                                       MX6QDL_PAD_CSI0_DAT9__I2C1_SCL 0x4001b8b1
-                                               >;
-                                       };
-                               };
-
-                               i2c2 {
-                                       pinctrl_i2c2_1: i2c2grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_EB2__I2C2_SCL 0x4001b8b1
-                                                       MX6QDL_PAD_EIM_D16__I2C2_SDA 0x4001b8b1
-                                               >;
-                                       };
-
-                                       pinctrl_i2c2_2: i2c2grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1
-                                                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1
-                                               >;
-                                       };
-
-                                       pinctrl_i2c2_3: i2c2grp-3 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_EB2__I2C2_SCL  0x4001b8b1
-                                                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1
-                                               >;
-                                       };
-                               };
-
-                               i2c3 {
-                                       pinctrl_i2c3_1: i2c3grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_D17__I2C3_SCL 0x4001b8b1
-                                                       MX6QDL_PAD_EIM_D18__I2C3_SDA 0x4001b8b1
-                                               >;
-                                       };
-
-                                       pinctrl_i2c3_2: i2c3grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_GPIO_3__I2C3_SCL 0x4001b8b1
-                                                       MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1
-                                               >;
-                                       };
-
-                                       pinctrl_i2c3_3: i2c3grp-3 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_GPIO_5__I2C3_SCL  0x4001b8b1
-                                                       MX6QDL_PAD_GPIO_16__I2C3_SDA 0x4001b8b1
-                                               >;
-                                       };
-
-                                       pinctrl_i2c3_4: i2c3grp-4 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_GPIO_3__I2C3_SCL  0x4001b8b1
-                                                       MX6QDL_PAD_EIM_D18__I2C3_SDA 0x4001b8b1
-                                               >;
-                                       };
-                               };
-
-                               ipu1 {
-                                       pinctrl_ipu1_1: ipu1grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK 0x10
-                                                       MX6QDL_PAD_DI0_PIN15__IPU1_DI0_PIN15       0x10
-                                                       MX6QDL_PAD_DI0_PIN2__IPU1_DI0_PIN02        0x10
-                                                       MX6QDL_PAD_DI0_PIN3__IPU1_DI0_PIN03        0x10
-                                                       MX6QDL_PAD_DI0_PIN4__IPU1_DI0_PIN04        0x80000000
-                                                       MX6QDL_PAD_DISP0_DAT0__IPU1_DISP0_DATA00   0x10
-                                                       MX6QDL_PAD_DISP0_DAT1__IPU1_DISP0_DATA01   0x10
-                                                       MX6QDL_PAD_DISP0_DAT2__IPU1_DISP0_DATA02   0x10
-                                                       MX6QDL_PAD_DISP0_DAT3__IPU1_DISP0_DATA03   0x10
-                                                       MX6QDL_PAD_DISP0_DAT4__IPU1_DISP0_DATA04   0x10
-                                                       MX6QDL_PAD_DISP0_DAT5__IPU1_DISP0_DATA05   0x10
-                                                       MX6QDL_PAD_DISP0_DAT6__IPU1_DISP0_DATA06   0x10
-                                                       MX6QDL_PAD_DISP0_DAT7__IPU1_DISP0_DATA07   0x10
-                                                       MX6QDL_PAD_DISP0_DAT8__IPU1_DISP0_DATA08   0x10
-                                                       MX6QDL_PAD_DISP0_DAT9__IPU1_DISP0_DATA09   0x10
-                                                       MX6QDL_PAD_DISP0_DAT10__IPU1_DISP0_DATA10  0x10
-                                                       MX6QDL_PAD_DISP0_DAT11__IPU1_DISP0_DATA11  0x10
-                                                       MX6QDL_PAD_DISP0_DAT12__IPU1_DISP0_DATA12  0x10
-                                                       MX6QDL_PAD_DISP0_DAT13__IPU1_DISP0_DATA13  0x10
-                                                       MX6QDL_PAD_DISP0_DAT14__IPU1_DISP0_DATA14  0x10
-                                                       MX6QDL_PAD_DISP0_DAT15__IPU1_DISP0_DATA15  0x10
-                                                       MX6QDL_PAD_DISP0_DAT16__IPU1_DISP0_DATA16  0x10
-                                                       MX6QDL_PAD_DISP0_DAT17__IPU1_DISP0_DATA17  0x10
-                                                       MX6QDL_PAD_DISP0_DAT18__IPU1_DISP0_DATA18  0x10
-                                                       MX6QDL_PAD_DISP0_DAT19__IPU1_DISP0_DATA19  0x10
-                                                       MX6QDL_PAD_DISP0_DAT20__IPU1_DISP0_DATA20  0x10
-                                                       MX6QDL_PAD_DISP0_DAT21__IPU1_DISP0_DATA21  0x10
-                                                       MX6QDL_PAD_DISP0_DAT22__IPU1_DISP0_DATA22  0x10
-                                                       MX6QDL_PAD_DISP0_DAT23__IPU1_DISP0_DATA23  0x10
-                                               >;
-                                       };
-
-                                       pinctrl_ipu1_2: ipu1grp-2 { /* parallel camera */
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12    0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13    0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14    0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15    0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16    0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17    0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18    0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19    0x80000000
-                                                       MX6QDL_PAD_CSI0_DATA_EN__IPU1_CSI0_DATA_EN 0x80000000
-                                                       MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK   0x80000000
-                                                       MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC      0x80000000
-                                                       MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC     0x80000000
-                                               >;
-                                       };
-
-                                       pinctrl_ipu1_3: ipu1grp-3 { /* parallel port 16-bit */
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04   0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05   0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06   0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07   0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08   0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09   0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18  0x80000000
-                                                       MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19  0x80000000
-                                                       MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x80000000
-                                                       MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC    0x80000000
-                                                       MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC   0x80000000
-                                               >;
-                                       };
-                               };
-
-                               mlb {
-                                       pinctrl_mlb_1: mlbgrp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_GPIO_3__MLB_CLK  0x71
-                                                       MX6QDL_PAD_GPIO_6__MLB_SIG  0x71
-                                                       MX6QDL_PAD_GPIO_2__MLB_DATA 0x71
-                                               >;
-                                       };
-
-                                       pinctrl_mlb_2: mlbgrp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_ENET_TXD1__MLB_CLK 0x71
-                                                       MX6QDL_PAD_GPIO_6__MLB_SIG    0x71
-                                                       MX6QDL_PAD_GPIO_2__MLB_DATA   0x71
-                                               >;
-                                       };
-                               };
-
-                               pwm0 {
-                                       pinctrl_pwm0_1: pwm0grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD1_DAT3__PWM1_OUT 0x1b0b1
-                                               >;
-                                       };
-                               };
-
-                               pwm3 {
-                                       pinctrl_pwm3_1: pwm3grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b1
-                                               >;
-                                       };
-                               };
-
-                               spdif {
-                                       pinctrl_spdif_1: spdifgrp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_KEY_COL3__SPDIF_IN 0x1b0b0
-                                               >;
-                                       };
-
-                                       pinctrl_spdif_2: spdifgrp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_GPIO_16__SPDIF_IN  0x1b0b0
-                                                       MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x1b0b0
-                                               >;
-                                       };
-
-                                       pinctrl_spdif_3: spdifgrp-3 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_ENET_RXD0__SPDIF_OUT 0x1b0b0
-                                               >;
-                                       };
-                               };
-
-                               uart1 {
-                                       pinctrl_uart1_1: uart1grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA 0x1b0b1
-                                                       MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1
-                                               >;
-                                       };
-                               };
-
-                               uart2 {
-                                       pinctrl_uart2_1: uart2grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1
-                                                       MX6QDL_PAD_EIM_D27__UART2_RX_DATA 0x1b0b1
-                                               >;
-                                       };
-
-                                       pinctrl_uart2_2: uart2grp-2 { /* DTE mode */
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_D26__UART2_RX_DATA   0x1b0b1
-                                                       MX6QDL_PAD_EIM_D27__UART2_TX_DATA   0x1b0b1
-                                                       MX6QDL_PAD_EIM_D28__UART2_DTE_CTS_B 0x1b0b1
-                                                       MX6QDL_PAD_EIM_D29__UART2_DTE_RTS_B 0x1b0b1
-                                               >;
-                                       };
-                               };
-
-                               uart3 {
-                                       pinctrl_uart3_1: uart3grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD4_CLK__UART3_RX_DATA 0x1b0b1
-                                                       MX6QDL_PAD_SD4_CMD__UART3_TX_DATA 0x1b0b1
-                                                       MX6QDL_PAD_EIM_D30__UART3_CTS_B   0x1b0b1
-                                                       MX6QDL_PAD_EIM_EB3__UART3_RTS_B   0x1b0b1
-                                               >;
-                                       };
-
-                                       pinctrl_uart3_2: uart3grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA 0x1b0b1
-                                                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA 0x1b0b1
-                                                       MX6QDL_PAD_EIM_D23__UART3_CTS_B   0x1b0b1
-                                                       MX6QDL_PAD_EIM_EB3__UART3_RTS_B   0x1b0b1
-                                               >;
-                                       };
-                               };
-
-                               uart4 {
-                                       pinctrl_uart4_1: uart4grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_KEY_COL0__UART4_TX_DATA 0x1b0b1
-                                                       MX6QDL_PAD_KEY_ROW0__UART4_RX_DATA 0x1b0b1
-                                               >;
-                                       };
-                               };
-
-                               usbotg {
-                                       pinctrl_usbotg_1: usbotggrp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usbotg_2: usbotggrp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID 0x17059
-                                               >;
-                                       };
-                               };
-
-                               usbh2 {
-                                       pinctrl_usbh2_1: usbh2grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_RGMII_TXC__USB_H2_DATA      0x40013030
-                                                       MX6QDL_PAD_RGMII_TX_CTL__USB_H2_STROBE 0x40013030
-                                               >;
-                                       };
-
-                                       pinctrl_usbh2_2: usbh2grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_RGMII_TX_CTL__USB_H2_STROBE 0x40017030
-                                               >;
-                                       };
-                               };
-
-                               usbh3 {
-                                       pinctrl_usbh3_1: usbh3grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_RGMII_RX_CTL__USB_H3_DATA 0x40013030
-                                                       MX6QDL_PAD_RGMII_RXC__USB_H3_STROBE  0x40013030
-                                               >;
-                                       };
-
-                                       pinctrl_usbh3_2: usbh3grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_RGMII_RXC__USB_H3_STROBE 0x40017030
-                                               >;
-                                       };
-                               };
-
-                               usdhc1 {
-                                       pinctrl_usdhc1_1: usdhc1grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD1_CMD__SD1_CMD    0x17059
-                                                       MX6QDL_PAD_SD1_CLK__SD1_CLK    0x10059
-                                                       MX6QDL_PAD_SD1_DAT0__SD1_DATA0 0x17059
-                                                       MX6QDL_PAD_SD1_DAT1__SD1_DATA1 0x17059
-                                                       MX6QDL_PAD_SD1_DAT2__SD1_DATA2 0x17059
-                                                       MX6QDL_PAD_SD1_DAT3__SD1_DATA3 0x17059
-                                                       MX6QDL_PAD_NANDF_D0__SD1_DATA4 0x17059
-                                                       MX6QDL_PAD_NANDF_D1__SD1_DATA5 0x17059
-                                                       MX6QDL_PAD_NANDF_D2__SD1_DATA6 0x17059
-                                                       MX6QDL_PAD_NANDF_D3__SD1_DATA7 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc1_2: usdhc1grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD1_CMD__SD1_CMD    0x17059
-                                                       MX6QDL_PAD_SD1_CLK__SD1_CLK    0x10059
-                                                       MX6QDL_PAD_SD1_DAT0__SD1_DATA0 0x17059
-                                                       MX6QDL_PAD_SD1_DAT1__SD1_DATA1 0x17059
-                                                       MX6QDL_PAD_SD1_DAT2__SD1_DATA2 0x17059
-                                                       MX6QDL_PAD_SD1_DAT3__SD1_DATA3 0x17059
-                                               >;
-                                       };
-                               };
-
-                               usdhc2 {
-                                       pinctrl_usdhc2_1: usdhc2grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD2_CMD__SD2_CMD    0x17059
-                                                       MX6QDL_PAD_SD2_CLK__SD2_CLK    0x10059
-                                                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
-                                                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
-                                                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
-                                                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059
-                                                       MX6QDL_PAD_NANDF_D4__SD2_DATA4 0x17059
-                                                       MX6QDL_PAD_NANDF_D5__SD2_DATA5 0x17059
-                                                       MX6QDL_PAD_NANDF_D6__SD2_DATA6 0x17059
-                                                       MX6QDL_PAD_NANDF_D7__SD2_DATA7 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc2_2: usdhc2grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD2_CMD__SD2_CMD    0x17059
-                                                       MX6QDL_PAD_SD2_CLK__SD2_CLK    0x10059
-                                                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17059
-                                                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17059
-                                                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17059
-                                                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17059
-                                               >;
-                                       };
-                               };
-
-                               usdhc3 {
-                                       pinctrl_usdhc3_1: usdhc3grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD3_CMD__SD3_CMD    0x17059
-                                                       MX6QDL_PAD_SD3_CLK__SD3_CLK    0x10059
-                                                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059
-                                                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059
-                                                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059
-                                                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059
-                                                       MX6QDL_PAD_SD3_DAT4__SD3_DATA4 0x17059
-                                                       MX6QDL_PAD_SD3_DAT5__SD3_DATA5 0x17059
-                                                       MX6QDL_PAD_SD3_DAT6__SD3_DATA6 0x17059
-                                                       MX6QDL_PAD_SD3_DAT7__SD3_DATA7 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc3_1_100mhz: usdhc3grp-1-100mhz { /* 100Mhz */
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD3_CMD__SD3_CMD 0x170b9
-                                                       MX6QDL_PAD_SD3_CLK__SD3_CLK 0x100b9
-                                                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x170b9
-                                                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x170b9
-                                                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x170b9
-                                                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x170b9
-                                                       MX6QDL_PAD_SD3_DAT4__SD3_DATA4 0x170b9
-                                                       MX6QDL_PAD_SD3_DAT5__SD3_DATA5 0x170b9
-                                                       MX6QDL_PAD_SD3_DAT6__SD3_DATA6 0x170b9
-                                                       MX6QDL_PAD_SD3_DAT7__SD3_DATA7 0x170b9
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc3_1_200mhz: usdhc3grp-1-200mhz { /* 200Mhz */
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD3_CMD__SD3_CMD 0x170f9
-                                                       MX6QDL_PAD_SD3_CLK__SD3_CLK 0x100f9
-                                                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x170f9
-                                                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x170f9
-                                                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x170f9
-                                                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x170f9
-                                                       MX6QDL_PAD_SD3_DAT4__SD3_DATA4 0x170f9
-                                                       MX6QDL_PAD_SD3_DAT5__SD3_DATA5 0x170f9
-                                                       MX6QDL_PAD_SD3_DAT6__SD3_DATA6 0x170f9
-                                                       MX6QDL_PAD_SD3_DAT7__SD3_DATA7 0x170f9
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc3_2: usdhc3grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD3_CMD__SD3_CMD    0x17059
-                                                       MX6QDL_PAD_SD3_CLK__SD3_CLK    0x10059
-                                                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059
-                                                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059
-                                                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059
-                                                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059
-                                               >;
-                                       };
-                               };
-
-                               usdhc4 {
-                                       pinctrl_usdhc4_1: usdhc4grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD4_CMD__SD4_CMD    0x17059
-                                                       MX6QDL_PAD_SD4_CLK__SD4_CLK    0x10059
-                                                       MX6QDL_PAD_SD4_DAT0__SD4_DATA0 0x17059
-                                                       MX6QDL_PAD_SD4_DAT1__SD4_DATA1 0x17059
-                                                       MX6QDL_PAD_SD4_DAT2__SD4_DATA2 0x17059
-                                                       MX6QDL_PAD_SD4_DAT3__SD4_DATA3 0x17059
-                                                       MX6QDL_PAD_SD4_DAT4__SD4_DATA4 0x17059
-                                                       MX6QDL_PAD_SD4_DAT5__SD4_DATA5 0x17059
-                                                       MX6QDL_PAD_SD4_DAT6__SD4_DATA6 0x17059
-                                                       MX6QDL_PAD_SD4_DAT7__SD4_DATA7 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc4_2: usdhc4grp-2 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_SD4_CMD__SD4_CMD    0x17059
-                                                       MX6QDL_PAD_SD4_CLK__SD4_CLK    0x10059
-                                                       MX6QDL_PAD_SD4_DAT0__SD4_DATA0 0x17059
-                                                       MX6QDL_PAD_SD4_DAT1__SD4_DATA1 0x17059
-                                                       MX6QDL_PAD_SD4_DAT2__SD4_DATA2 0x17059
-                                                       MX6QDL_PAD_SD4_DAT3__SD4_DATA3 0x17059
-                                               >;
-                                       };
-                               };
-
-                               weim {
-                                       pinctrl_weim_cs0_1: weim_cs0grp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_CS0__EIM_CS0_B   0xb0b1
-                                               >;
-                                       };
-
-                                       pinctrl_weim_nor_1: weim_norgrp-1 {
-                                               fsl,pins = <
-                                                       MX6QDL_PAD_EIM_OE__EIM_OE_B     0xb0b1
-                                                       MX6QDL_PAD_EIM_RW__EIM_RW       0xb0b1
-                                                       MX6QDL_PAD_EIM_WAIT__EIM_WAIT_B 0xb060
-                                                       /* data */
-                                                       MX6QDL_PAD_EIM_D16__EIM_DATA16 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D17__EIM_DATA17 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D18__EIM_DATA18 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D19__EIM_DATA19 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D20__EIM_DATA20 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D21__EIM_DATA21 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D22__EIM_DATA22 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D23__EIM_DATA23 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D24__EIM_DATA24 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D25__EIM_DATA25 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D26__EIM_DATA26 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D27__EIM_DATA27 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D28__EIM_DATA28 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D29__EIM_DATA29 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D30__EIM_DATA30 0x1b0b0
-                                                       MX6QDL_PAD_EIM_D31__EIM_DATA31 0x1b0b0
-                                                       /* address */
-                                                       MX6QDL_PAD_EIM_A23__EIM_ADDR23 0xb0b1
-                                                       MX6QDL_PAD_EIM_A22__EIM_ADDR22 0xb0b1
-                                                       MX6QDL_PAD_EIM_A21__EIM_ADDR21 0xb0b1
-                                                       MX6QDL_PAD_EIM_A20__EIM_ADDR20 0xb0b1
-                                                       MX6QDL_PAD_EIM_A19__EIM_ADDR19 0xb0b1
-                                                       MX6QDL_PAD_EIM_A18__EIM_ADDR18 0xb0b1
-                                                       MX6QDL_PAD_EIM_A17__EIM_ADDR17 0xb0b1
-                                                       MX6QDL_PAD_EIM_A16__EIM_ADDR16 0xb0b1
-                                                       MX6QDL_PAD_EIM_DA15__EIM_AD15  0xb0b1
-                                                       MX6QDL_PAD_EIM_DA14__EIM_AD14  0xb0b1
-                                                       MX6QDL_PAD_EIM_DA13__EIM_AD13  0xb0b1
-                                                       MX6QDL_PAD_EIM_DA12__EIM_AD12  0xb0b1
-                                                       MX6QDL_PAD_EIM_DA11__EIM_AD11  0xb0b1
-                                                       MX6QDL_PAD_EIM_DA10__EIM_AD10  0xb0b1
-                                                       MX6QDL_PAD_EIM_DA9__EIM_AD09   0xb0b1
-                                                       MX6QDL_PAD_EIM_DA8__EIM_AD08   0xb0b1
-                                                       MX6QDL_PAD_EIM_DA7__EIM_AD07   0xb0b1
-                                                       MX6QDL_PAD_EIM_DA6__EIM_AD06   0xb0b1
-                                                       MX6QDL_PAD_EIM_DA5__EIM_AD05   0xb0b1
-                                                       MX6QDL_PAD_EIM_DA4__EIM_AD04   0xb0b1
-                                                       MX6QDL_PAD_EIM_DA3__EIM_AD03   0xb0b1
-                                                       MX6QDL_PAD_EIM_DA2__EIM_AD02   0xb0b1
-                                                       MX6QDL_PAD_EIM_DA1__EIM_AD01   0xb0b1
-                                                       MX6QDL_PAD_EIM_DA0__EIM_AD00   0xb0b1
-                                               >;
-                                       };
-                               };
                        };
 
                        ldb: ldb@020e0008 {
 
                        dcic1: dcic@020e4000 {
                                reg = <0x020e4000 0x4000>;
-                               interrupts = <0 124 0x04>;
+                               interrupts = <0 124 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        dcic2: dcic@020e8000 {
                                reg = <0x020e8000 0x4000>;
-                               interrupts = <0 125 0x04>;
+                               interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        sdma: sdma@020ec000 {
                                compatible = "fsl,imx6q-sdma", "fsl,imx35-sdma";
                                reg = <0x020ec000 0x4000>;
-                               interrupts = <0 2 0x04>;
+                               interrupts = <0 2 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 155>, <&clks 155>;
                                clock-names = "ipg", "ahb";
                                #dma-cells = <3>;
 
                        caam@02100000 {
                                reg = <0x02100000 0x40000>;
-                               interrupts = <0 105 0x04 0 106 0x04>;
+                               interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 106 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        aipstz@0217c000 { /* AIPSTZ2 */
                        usbotg: usb@02184000 {
                                compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
                                reg = <0x02184000 0x200>;
-                               interrupts = <0 43 0x04>;
+                               interrupts = <0 43 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 162>;
                                fsl,usbphy = <&usbphy1>;
                                fsl,usbmisc = <&usbmisc 0>;
                        usbh1: usb@02184200 {
                                compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
                                reg = <0x02184200 0x200>;
-                               interrupts = <0 40 0x04>;
+                               interrupts = <0 40 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 162>;
                                fsl,usbphy = <&usbphy2>;
                                fsl,usbmisc = <&usbmisc 1>;
                        usbh2: usb@02184400 {
                                compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
                                reg = <0x02184400 0x200>;
-                               interrupts = <0 41 0x04>;
+                               interrupts = <0 41 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 162>;
                                fsl,usbmisc = <&usbmisc 2>;
                                status = "disabled";
                        usbh3: usb@02184600 {
                                compatible = "fsl,imx6q-usb", "fsl,imx27-usb";
                                reg = <0x02184600 0x200>;
-                               interrupts = <0 42 0x04>;
+                               interrupts = <0 42 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 162>;
                                fsl,usbmisc = <&usbmisc 3>;
                                status = "disabled";
                        fec: ethernet@02188000 {
                                compatible = "fsl,imx6q-fec";
                                reg = <0x02188000 0x4000>;
-                               interrupts = <0 118 0x04 0 119 0x04>;
+                               interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 119 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 117>, <&clks 117>, <&clks 190>;
                                clock-names = "ipg", "ahb", "ptp";
                                status = "disabled";
 
                        mlb@0218c000 {
                                reg = <0x0218c000 0x4000>;
-                               interrupts = <0 53 0x04 0 117 0x04 0 126 0x04>;
+                               interrupts = <0 53 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 117 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 126 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        usdhc1: usdhc@02190000 {
                                compatible = "fsl,imx6q-usdhc";
                                reg = <0x02190000 0x4000>;
-                               interrupts = <0 22 0x04>;
+                               interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 163>, <&clks 163>, <&clks 163>;
                                clock-names = "ipg", "ahb", "per";
                                bus-width = <4>;
                        usdhc2: usdhc@02194000 {
                                compatible = "fsl,imx6q-usdhc";
                                reg = <0x02194000 0x4000>;
-                               interrupts = <0 23 0x04>;
+                               interrupts = <0 23 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 164>, <&clks 164>, <&clks 164>;
                                clock-names = "ipg", "ahb", "per";
                                bus-width = <4>;
                        usdhc3: usdhc@02198000 {
                                compatible = "fsl,imx6q-usdhc";
                                reg = <0x02198000 0x4000>;
-                               interrupts = <0 24 0x04>;
+                               interrupts = <0 24 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 165>, <&clks 165>, <&clks 165>;
                                clock-names = "ipg", "ahb", "per";
                                bus-width = <4>;
                        usdhc4: usdhc@0219c000 {
                                compatible = "fsl,imx6q-usdhc";
                                reg = <0x0219c000 0x4000>;
-                               interrupts = <0 25 0x04>;
+                               interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 166>, <&clks 166>, <&clks 166>;
                                clock-names = "ipg", "ahb", "per";
                                bus-width = <4>;
                                #size-cells = <0>;
                                compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
                                reg = <0x021a0000 0x4000>;
-                               interrupts = <0 36 0x04>;
+                               interrupts = <0 36 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 125>;
                                status = "disabled";
                        };
                                #size-cells = <0>;
                                compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
                                reg = <0x021a4000 0x4000>;
-                               interrupts = <0 37 0x04>;
+                               interrupts = <0 37 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 126>;
                                status = "disabled";
                        };
                                #size-cells = <0>;
                                compatible = "fsl,imx6q-i2c", "fsl,imx21-i2c";
                                reg = <0x021a8000 0x4000>;
-                               interrupts = <0 38 0x04>;
+                               interrupts = <0 38 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 127>;
                                status = "disabled";
                        };
                        weim: weim@021b8000 {
                                compatible = "fsl,imx6q-weim";
                                reg = <0x021b8000 0x4000>;
-                               interrupts = <0 14 0x04>;
+                               interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 196>;
                        };
 
 
                        tzasc@021d0000 { /* TZASC1 */
                                reg = <0x021d0000 0x4000>;
-                               interrupts = <0 108 0x04>;
+                               interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        tzasc@021d4000 { /* TZASC2 */
                                reg = <0x021d4000 0x4000>;
-                               interrupts = <0 109 0x04>;
+                               interrupts = <0 109 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        audmux: audmux@021d8000 {
                                status = "disabled";
                        };
 
-                       mipi@021dc000 { /* MIPI-CSI */
+                       mipi_csi: mipi@021dc000 {
                                reg = <0x021dc000 0x4000>;
                        };
 
 
                        vdoa@021e4000 {
                                reg = <0x021e4000 0x4000>;
-                               interrupts = <0 18 0x04>;
+                               interrupts = <0 18 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        uart2: serial@021e8000 {
                                compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
                                reg = <0x021e8000 0x4000>;
-                               interrupts = <0 27 0x04>;
+                               interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 160>, <&clks 161>;
                                clock-names = "ipg", "per";
                                dmas = <&sdma 27 4 0>, <&sdma 28 4 0>;
                        uart3: serial@021ec000 {
                                compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
                                reg = <0x021ec000 0x4000>;
-                               interrupts = <0 28 0x04>;
+                               interrupts = <0 28 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 160>, <&clks 161>;
                                clock-names = "ipg", "per";
                                dmas = <&sdma 29 4 0>, <&sdma 30 4 0>;
                        uart4: serial@021f0000 {
                                compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
                                reg = <0x021f0000 0x4000>;
-                               interrupts = <0 29 0x04>;
+                               interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 160>, <&clks 161>;
                                clock-names = "ipg", "per";
                                dmas = <&sdma 31 4 0>, <&sdma 32 4 0>;
                        uart5: serial@021f4000 {
                                compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
                                reg = <0x021f4000 0x4000>;
-                               interrupts = <0 30 0x04>;
+                               interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks 160>, <&clks 161>;
                                clock-names = "ipg", "per";
                                dmas = <&sdma 33 4 0>, <&sdma 34 4 0>;
                        #crtc-cells = <1>;
                        compatible = "fsl,imx6q-ipu";
                        reg = <0x02400000 0x400000>;
-                       interrupts = <0 6 0x4 0 5 0x4>;
+                       interrupts = <0 6 IRQ_TYPE_LEVEL_HIGH>,
+                                    <0 5 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&clks 130>, <&clks 131>, <&clks 132>;
                        clock-names = "bus", "di0", "di1";
                        resets = <&src 2>;
index cc68e19c51631666e8241fbc1d4965a18605ca28..f5e4513ebfc3be074263d633cba08b04fba428af 100644 (file)
 
        regulators {
                compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
 
-               reg_usb_otg1_vbus: usb_otg1_vbus {
+               reg_usb_otg1_vbus: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "usb_otg1_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
@@ -30,8 +33,9 @@
                        enable-active-high;
                };
 
-               reg_usb_otg2_vbus: usb_otg2_vbus {
+               reg_usb_otg2_vbus: regulator@1 {
                        compatible = "regulator-fixed";
+                       reg = <1>;
                        regulator-name = "usb_otg2_vbus";
                        regulator-min-microvolt = <5000000>;
                        regulator-max-microvolt = <5000000>;
@@ -45,7 +49,7 @@
        fsl,spi-num-chipselects = <1>;
        cs-gpios = <&gpio4 11 0>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_ecspi1_1>;
+       pinctrl-0 = <&pinctrl_ecspi1>;
        status = "okay";
 
        flash: m25p80@0 {
@@ -59,7 +63,7 @@
 
 &fec {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_fec_1>;
+       pinctrl-0 = <&pinctrl_fec>;
        phy-mode = "rmii";
        status = "okay";
 };
@@ -68,7 +72,7 @@
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog>;
 
-       hog {
+       imx6sl-evk {
                pinctrl_hog: hoggrp {
                        fsl,pins = <
                                MX6SL_PAD_KEY_ROW7__GPIO4_IO07    0x17059
                                MX6SL_PAD_KEY_COL5__GPIO4_IO02  0x80000000
                        >;
                };
+
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <MX6SL_ECSPI1_PINGRP1>;
+               };
+
+               pinctrl_fec: fecgrp {
+                       fsl,pins = <MX6SL_FEC_PINGRP1>;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <MX6SL_UART1_PINGRP1>;
+               };
+
+               pinctrl_usbotg1: usbotg1grp {
+                       fsl,pins = <MX6SL_USBOTG1_PINGRP1>;
+               };
+
+               pinctrl_usdhc1: usdhc1grp {
+                       fsl,pins = <MX6SL_USDHC1_PINGRP_D8>;
+               };
+
+               pinctrl_usdhc1_100mhz: usdhc1grp100mhz {
+                       fsl,pins = <MX6SL_USDHC1_PINGRP_D8_100MHZ>;
+               };
+
+               pinctrl_usdhc1_200mhz: usdhc1grp200mhz {
+                       fsl,pins = <MX6SL_USDHC1_PINGRP_D8_200MHZ>;
+               };
+
+               pinctrl_usdhc2: usdhc2grp {
+                       fsl,pins = <MX6SL_USDHC2_PINGRP_D4>;
+               };
+
+               pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
+                       fsl,pins = <MX6SL_USDHC2_PINGRP_D4_100MHZ>;
+               };
+
+               pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
+                       fsl,pins = <MX6SL_USDHC2_PINGRP_D4_200MHZ>;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <MX6SL_USDHC3_PINGRP_D4>;
+               };
+
+               pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+                       fsl,pins = <MX6SL_USDHC3_PINGRP_D4_100MHZ>;
+               };
+
+               pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+                       fsl,pins = <MX6SL_USDHC3_PINGRP_D4_200MHZ>;
+               };
        };
 };
 
 &uart1 {
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_uart1_1>;
+       pinctrl-0 = <&pinctrl_uart1>;
        status = "okay";
 };
 
 &usbotg1 {
        vbus-supply = <&reg_usb_otg1_vbus>;
        pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_usbotg1_1>;
+       pinctrl-0 = <&pinctrl_usbotg1>;
        disable-over-current;
        status = "okay";
 };
 
 &usdhc1 {
        pinctrl-names = "default", "state_100mhz", "state_200mhz";
-       pinctrl-0 = <&pinctrl_usdhc1_1>;
-       pinctrl-1 = <&pinctrl_usdhc1_1_100mhz>;
-       pinctrl-2 = <&pinctrl_usdhc1_1_200mhz>;
+       pinctrl-0 = <&pinctrl_usdhc1>;
+       pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
        bus-width = <8>;
        cd-gpios = <&gpio4 7 0>;
        wp-gpios = <&gpio4 6 0>;
 
 &usdhc2 {
        pinctrl-names = "default", "state_100mhz", "state_200mhz";
-       pinctrl-0 = <&pinctrl_usdhc2_1>;
-       pinctrl-1 = <&pinctrl_usdhc2_1_100mhz>;
-       pinctrl-2 = <&pinctrl_usdhc2_1_200mhz>;
+       pinctrl-0 = <&pinctrl_usdhc2>;
+       pinctrl-1 = <&pinctrl_usdhc2_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc2_200mhz>;
        cd-gpios = <&gpio5 0 0>;
        wp-gpios = <&gpio4 29 0>;
        status = "okay";
 
 &usdhc3 {
        pinctrl-names = "default", "state_100mhz", "state_200mhz";
-       pinctrl-0 = <&pinctrl_usdhc3_1>;
-       pinctrl-1 = <&pinctrl_usdhc3_1_100mhz>;
-       pinctrl-2 = <&pinctrl_usdhc3_1_200mhz>;
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
        cd-gpios = <&gpio3 22 0>;
        status = "okay";
 };
diff --git a/arch/arm/boot/dts/imx6sl-pingrp.h b/arch/arm/boot/dts/imx6sl-pingrp.h
new file mode 100644 (file)
index 0000000..ead26d4
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2013 Freescale Semiconductor, 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.
+ *
+ */
+
+#ifndef __DTS_IMX6SL_PINGRP_H
+#define __DTS_IMX6SL_PINGRP_H
+
+#define MX6SL_ECSPI1_PINGRP1 \
+       MX6SL_PAD_ECSPI1_MISO__ECSPI1_MISO              0x100b1 \
+       MX6SL_PAD_ECSPI1_MOSI__ECSPI1_MOSI              0x100b1 \
+       MX6SL_PAD_ECSPI1_SCLK__ECSPI1_SCLK              0x100b1
+
+#define MX6SL_FEC_PINGRP1 \
+       MX6SL_PAD_FEC_MDC__FEC_MDC                      0x1b0b0 \
+       MX6SL_PAD_FEC_MDIO__FEC_MDIO                    0x1b0b0 \
+       MX6SL_PAD_FEC_CRS_DV__FEC_RX_DV                 0x1b0b0 \
+       MX6SL_PAD_FEC_RXD0__FEC_RX_DATA0                0x1b0b0 \
+       MX6SL_PAD_FEC_RXD1__FEC_RX_DATA1                0x1b0b0 \
+       MX6SL_PAD_FEC_TX_EN__FEC_TX_EN                  0x1b0b0 \
+       MX6SL_PAD_FEC_TXD0__FEC_TX_DATA0                0x1b0b0 \
+       MX6SL_PAD_FEC_TXD1__FEC_TX_DATA1                0x1b0b0 \
+       MX6SL_PAD_FEC_REF_CLK__FEC_REF_OUT              0x4001b0a8
+
+#define MX6SL_UART1_PINGRP1 \
+       MX6SL_PAD_UART1_RXD__UART1_RX_DATA              0x1b0b1 \
+       MX6SL_PAD_UART1_TXD__UART1_TX_DATA              0x1b0b1
+
+#define MX6SL_USBOTG1_PINGRP1 \
+       MX6SL_PAD_EPDC_PWRCOM__USB_OTG1_ID              0x17059
+
+#define MX6SL_USBOTG1_PINGRP2 \
+       MX6SL_PAD_FEC_RXD0__USB_OTG1_ID                 0x17059
+
+#define MX6SL_USBOTG1_PINGRP3 \
+       MX6SL_PAD_LCD_DAT1__USB_OTG1_ID                 0x17059
+
+#define MX6SL_USBOTG1_PINGRP4 \
+       MX6SL_PAD_REF_CLK_32K__USB_OTG1_ID              0x17059
+
+#define MX6SL_USBOTG1_PINGRP5 \
+       MX6SL_PAD_SD3_DAT0__USB_OTG1_ID                 0x17059
+
+#define MX6SL_USBOTG2_PINGRP1 \
+       MX6SL_PAD_ECSPI1_SCLK__USB_OTG2_OC              0x17059
+
+#define MX6SL_USBOTG2_PINGRP2 \
+       MX6SL_PAD_ECSPI2_SCLK__USB_OTG2_OC              0x17059
+
+#define MX6SL_USBOTG2_PINGRP3 \
+       MX6SL_PAD_KEY_ROW5__USB_OTG2_OC                 0x17059
+
+#define MX6SL_USBOTG2_PINGRP4 \
+       MX6SL_PAD_SD3_DAT2__USB_OTG2_OC                 0x17059
+
+#define MX6SL_USDHC1_D4(pad, pad_data3, pad_clk)       \
+       MX6SL_PAD_SD1_CMD__SD1_CMD                      pad \
+       MX6SL_PAD_SD1_CLK__SD1_CLK                      pad_clk \
+       MX6SL_PAD_SD1_DAT0__SD1_DATA0                   pad \
+       MX6SL_PAD_SD1_DAT1__SD1_DATA1                   pad \
+       MX6SL_PAD_SD1_DAT2__SD1_DATA2                   pad \
+       MX6SL_PAD_SD1_DAT3__SD1_DATA3                   pad_data3
+
+#define MX6SL_USDHC1_D8(pad, pad_data3, pad_clk)       \
+       MX6SL_USDHC1_D4(pad, pad_data3, pad_clk)        \
+       MX6SL_PAD_SD1_DAT4__SD1_DATA4                   pad \
+       MX6SL_PAD_SD1_DAT5__SD1_DATA5                   pad \
+       MX6SL_PAD_SD1_DAT6__SD1_DATA6                   pad \
+       MX6SL_PAD_SD1_DAT7__SD1_DATA7                   pad
+
+#define MX6SL_USDHC2_D4(pad, pad_data3, pad_clk)       \
+       MX6SL_PAD_SD2_CMD__SD2_CMD                      pad \
+       MX6SL_PAD_SD2_CLK__SD2_CLK                      pad_clk \
+       MX6SL_PAD_SD2_DAT0__SD2_DATA0                   pad \
+       MX6SL_PAD_SD2_DAT1__SD2_DATA1                   pad \
+       MX6SL_PAD_SD2_DAT2__SD2_DATA2                   pad \
+       MX6SL_PAD_SD2_DAT3__SD2_DATA3                   pad_data3
+
+#define MX6SL_USDHC2_D8(pad, pad_data3, pad_clk)       \
+       MX6SL_USDHC2_D4(pad, pad_data3, pad_clk)        \
+       MX6SL_PAD_SD2_DAT4__SD2_DATA4                   pad \
+       MX6SL_PAD_SD2_DAT5__SD2_DATA5                   pad \
+       MX6SL_PAD_SD2_DAT6__SD2_DATA6                   pad \
+       MX6SL_PAD_SD2_DAT7__SD2_DATA7                   pad
+
+#define MX6SL_USDHC3_D4(pad, pad_data3, pad_clk)       \
+       MX6SL_PAD_SD3_CMD__SD3_CMD                      pad \
+       MX6SL_PAD_SD3_CLK__SD3_CLK                      pad_clk \
+       MX6SL_PAD_SD3_DAT0__SD3_DATA0                   pad \
+       MX6SL_PAD_SD3_DAT1__SD3_DATA1                   pad \
+       MX6SL_PAD_SD3_DAT2__SD3_DATA2                   pad \
+       MX6SL_PAD_SD3_DAT3__SD3_DATA3                   pad_data3
+
+#define MX6SL_USDHC3_D8(pad, pad_data3, pad_clk)       \
+       MX6SL_USDHC3_D4(pad, pad_data3, pad_clk)        \
+       MX6SL_PAD_SD2_DAT4__SD3_DATA4                   pad \
+       MX6SL_PAD_SD2_DAT5__SD3_DATA5                   pad \
+       MX6SL_PAD_SD2_DAT6__SD3_DATA6                   pad \
+       MX6SL_PAD_SD2_DAT7__SD3_DATA7                   pad
+
+#define MX6SL_USDHC4_D4(pad, pad_data3, pad_clk)       \
+       MX6SL_PAD_EPDC_BDR1__SD4_CMD                    pad \
+       MX6SL_PAD_EPDC_BDR0__SD4_CLK                    pad_clk \
+       MX6SL_PAD_EPDC_PWRCOM__SD4_DATA0                pad \
+       MX6SL_PAD_EPDC_PWRINT__SD4_DATA1                pad \
+       MX6SL_PAD_EPDC_PWRSTAT__SD4_DATA2               pad \
+       MX6SL_PAD_EPDC_PWRWAKEUP__SD4_DATA3             pad_data3
+
+#define MX6SL_USDHC4_D8(pad, pad_data3, pad_clk)       \
+       MX6SL_USDHC4_D4(pad, pad_data3, pad_clk)        \
+       MX6SL_PAD_KEY_COL7__SD4_DATA4                   pad \
+       MX6SL_PAD_KEY_ROW7__SD4_DATA5                   pad \
+       MX6SL_PAD_KEY_COL3__SD4_DATA6                   pad \
+       MX6SL_PAD_KEY_ROW3__SD4_DATA7                   pad
+
+#define MX6SL_USDHC1_PINGRP_D4       MX6SL_USDHC1_D4(0x17059, 0x17059, 0x10059)
+#define MX6SL_USDHC1_PINGRP_D4_100MHZ MX6SL_USDHC1_D4(0x170b9, 0x170b9, 0x100b9)
+#define MX6SL_USDHC1_PINGRP_D4_200MHZ MX6SL_USDHC1_D4(0x170f9, 0x170f9, 0x100f9)
+#define MX6SL_USDHC1_PINGRP_D8       MX6SL_USDHC1_D8(0x17059, 0x17059, 0x10059)
+#define MX6SL_USDHC1_PINGRP_D8_100MHZ MX6SL_USDHC1_D8(0x170b9, 0x170b9, 0x100b9)
+#define MX6SL_USDHC1_PINGRP_D8_200MHZ MX6SL_USDHC1_D8(0x170f9, 0x170f9, 0x100f9)
+
+#define MX6SL_USDHC2_PINGRP_D4       MX6SL_USDHC2_D4(0x17059, 0x17059, 0x10059)
+#define MX6SL_USDHC2_PINGRP_D4_100MHZ MX6SL_USDHC2_D4(0x170b9, 0x170b9, 0x100b9)
+#define MX6SL_USDHC2_PINGRP_D4_200MHZ MX6SL_USDHC2_D4(0x170f9, 0x170f9, 0x100f9)
+#define MX6SL_USDHC2_PINGRP_D8       MX6SL_USDHC2_D8(0x17059, 0x17059, 0x10059)
+#define MX6SL_USDHC2_PINGRP_D8_100MHZ MX6SL_USDHC2_D8(0x170b9, 0x170b9, 0x100b9)
+#define MX6SL_USDHC2_PINGRP_D8_200MHZ MX6SL_USDHC2_D8(0x170f9, 0x170f9, 0x100f9)
+
+#define MX6SL_USDHC3_PINGRP_D4       MX6SL_USDHC3_D4(0x17059, 0x17059, 0x10059)
+#define MX6SL_USDHC3_PINGRP_D4_100MHZ MX6SL_USDHC3_D4(0x170b9, 0x170b9, 0x100b9)
+#define MX6SL_USDHC3_PINGRP_D4_200MHZ MX6SL_USDHC3_D4(0x170f9, 0x170f9, 0x100f9)
+#define MX6SL_USDHC3_PINGRP_D8       MX6SL_USDHC3_D8(0x17059, 0x17059, 0x10059)
+#define MX6SL_USDHC3_PINGRP_D8_100MHZ MX6SL_USDHC3_D8(0x170b9, 0x170b9, 0x100b9)
+#define MX6SL_USDHC3_PINGRP_D8_200MHZ MX6SL_USDHC3_D8(0x170f9, 0x170f9, 0x100f9)
+
+#define MX6SL_USDHC4_PINGRP_D4       MX6SL_USDHC4_D4(0x17059, 0x17059, 0x10059)
+#define MX6SL_USDHC4_PINGRP_D4_100MHZ MX6SL_USDHC4_D4(0x170b9, 0x170b9, 0x100b9)
+#define MX6SL_USDHC4_PINGRP_D4_200MHZ MX6SL_USDHC4_D4(0x170f9, 0x170f9, 0x100f9)
+#define MX6SL_USDHC4_PINGRP_D8       MX6SL_USDHC4_D8(0x17059, 0x17059, 0x10059)
+#define MX6SL_USDHC4_PINGRP_D8_100MHZ MX6SL_USDHC4_D8(0x170b9, 0x170b9, 0x100b9)
+#define MX6SL_USDHC4_PINGRP_D8_200MHZ MX6SL_USDHC4_D8(0x170f9, 0x170f9, 0x100f9)
+
+#endif /* __DTS_IMX6SL_PINGRP_H */
index 28558f1aaf2da8e67cb6b191f2d11e7964518b59..b526118b6fe92da9f69344ed80481d8c77d6ffb1 100644 (file)
@@ -7,8 +7,10 @@
  *
  */
 
+#include <dt-bindings/interrupt-controller/irq.h>
 #include "skeleton.dtsi"
 #include "imx6sl-pinfunc.h"
+#include "imx6sl-pingrp.h"
 #include <dt-bindings/clock/imx6sl-clock.h>
 
 / {
@@ -76,7 +78,7 @@
                L2: l2-cache@00a02000 {
                        compatible = "arm,pl310-cache";
                        reg = <0x00a02000 0x1000>;
-                       interrupts = <0 92 0x04>;
+                       interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>;
                        cache-unified;
                        cache-level = <2>;
                        arm,tag-latency = <4 2 3>;
@@ -85,7 +87,7 @@
 
                pmu {
                        compatible = "arm,cortex-a9-pmu";
-                       interrupts = <0 94 0x04>;
+                       interrupts = <0 94 IRQ_TYPE_LEVEL_HIGH>;
                };
 
                aips1: aips-bus@02000000 {
 
                                spdif: spdif@02004000 {
                                        reg = <0x02004000 0x4000>;
-                                       interrupts = <0 52 0x04>;
+                                       interrupts = <0 52 IRQ_TYPE_LEVEL_HIGH>;
                                };
 
                                ecspi1: ecspi@02008000 {
                                        #size-cells = <0>;
                                        compatible = "fsl,imx6sl-ecspi", "fsl,imx51-ecspi";
                                        reg = <0x02008000 0x4000>;
-                                       interrupts = <0 31 0x04>;
+                                       interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_ECSPI1>,
                                                 <&clks IMX6SL_CLK_ECSPI1>;
                                        clock-names = "ipg", "per";
                                        #size-cells = <0>;
                                        compatible = "fsl,imx6sl-ecspi", "fsl,imx51-ecspi";
                                        reg = <0x0200c000 0x4000>;
-                                       interrupts = <0 32 0x04>;
+                                       interrupts = <0 32 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_ECSPI2>,
                                                 <&clks IMX6SL_CLK_ECSPI2>;
                                        clock-names = "ipg", "per";
                                        #size-cells = <0>;
                                        compatible = "fsl,imx6sl-ecspi", "fsl,imx51-ecspi";
                                        reg = <0x02010000 0x4000>;
-                                       interrupts = <0 33 0x04>;
+                                       interrupts = <0 33 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_ECSPI3>,
                                                 <&clks IMX6SL_CLK_ECSPI3>;
                                        clock-names = "ipg", "per";
                                        #size-cells = <0>;
                                        compatible = "fsl,imx6sl-ecspi", "fsl,imx51-ecspi";
                                        reg = <0x02014000 0x4000>;
-                                       interrupts = <0 34 0x04>;
+                                       interrupts = <0 34 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_ECSPI4>,
                                                 <&clks IMX6SL_CLK_ECSPI4>;
                                        clock-names = "ipg", "per";
                                        compatible = "fsl,imx6sl-uart",
                                                   "fsl,imx6q-uart", "fsl,imx21-uart";
                                        reg = <0x02018000 0x4000>;
-                                       interrupts = <0 30 0x04>;
+                                       interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_UART>,
                                                 <&clks IMX6SL_CLK_UART_SERIAL>;
                                        clock-names = "ipg", "per";
                                        compatible = "fsl,imx6sl-uart",
                                                   "fsl,imx6q-uart", "fsl,imx21-uart";
                                        reg = <0x02020000 0x4000>;
-                                       interrupts = <0 26 0x04>;
+                                       interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_UART>,
                                                 <&clks IMX6SL_CLK_UART_SERIAL>;
                                        clock-names = "ipg", "per";
                                        compatible = "fsl,imx6sl-uart",
                                                   "fsl,imx6q-uart", "fsl,imx21-uart";
                                        reg = <0x02024000 0x4000>;
-                                       interrupts = <0 27 0x04>;
+                                       interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_UART>,
                                                 <&clks IMX6SL_CLK_UART_SERIAL>;
                                        clock-names = "ipg", "per";
                                ssi1: ssi@02028000 {
                                        compatible = "fsl,imx6sl-ssi","fsl,imx21-ssi";
                                        reg = <0x02028000 0x4000>;
-                                       interrupts = <0 46 0x04>;
+                                       interrupts = <0 46 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_SSI1>;
-                                       dmas = <&sdma 37 1 0>,
-                                              <&sdma 38 1 0>;
+                                       dmas = <&sdma 37 22 0>,
+                                              <&sdma 38 22 0>;
                                        dma-names = "rx", "tx";
                                        fsl,fifo-depth = <15>;
                                        status = "disabled";
                                ssi2: ssi@0202c000 {
                                        compatible = "fsl,imx6sl-ssi","fsl,imx21-ssi";
                                        reg = <0x0202c000 0x4000>;
-                                       interrupts = <0 47 0x04>;
+                                       interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_SSI2>;
-                                       dmas = <&sdma 41 1 0>,
-                                              <&sdma 42 1 0>;
+                                       dmas = <&sdma 41 22 0>,
+                                              <&sdma 42 22 0>;
                                        dma-names = "rx", "tx";
                                        fsl,fifo-depth = <15>;
                                        status = "disabled";
                                ssi3: ssi@02030000 {
                                        compatible = "fsl,imx6sl-ssi","fsl,imx21-ssi";
                                        reg = <0x02030000 0x4000>;
-                                       interrupts = <0 48 0x04>;
+                                       interrupts = <0 48 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_SSI3>;
-                                       dmas = <&sdma 45 1 0>,
-                                              <&sdma 46 1 0>;
+                                       dmas = <&sdma 45 22 0>,
+                                              <&sdma 46 22 0>;
                                        dma-names = "rx", "tx";
                                        fsl,fifo-depth = <15>;
                                        status = "disabled";
                                        compatible = "fsl,imx6sl-uart",
                                                   "fsl,imx6q-uart", "fsl,imx21-uart";
                                        reg = <0x02034000 0x4000>;
-                                       interrupts = <0 28 0x04>;
+                                       interrupts = <0 28 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_UART>,
                                                 <&clks IMX6SL_CLK_UART_SERIAL>;
                                        clock-names = "ipg", "per";
                                        compatible = "fsl,imx6sl-uart",
                                                   "fsl,imx6q-uart", "fsl,imx21-uart";
                                        reg = <0x02038000 0x4000>;
-                                       interrupts = <0 29 0x04>;
+                                       interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>;
                                        clocks = <&clks IMX6SL_CLK_UART>,
                                                 <&clks IMX6SL_CLK_UART_SERIAL>;
                                        clock-names = "ipg", "per";
                                #pwm-cells = <2>;
                                compatible = "fsl,imx6sl-pwm", "fsl,imx27-pwm";
                                reg = <0x02080000 0x4000>;
-                               interrupts = <0 83 0x04>;
+                               interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_PWM1>,
                                         <&clks IMX6SL_CLK_PWM1>;
                                clock-names = "ipg", "per";
                                #pwm-cells = <2>;
                                compatible = "fsl,imx6sl-pwm", "fsl,imx27-pwm";
                                reg = <0x02084000 0x4000>;
-                               interrupts = <0 84 0x04>;
+                               interrupts = <0 84 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_PWM2>,
                                         <&clks IMX6SL_CLK_PWM2>;
                                clock-names = "ipg", "per";
                                #pwm-cells = <2>;
                                compatible = "fsl,imx6sl-pwm", "fsl,imx27-pwm";
                                reg = <0x02088000 0x4000>;
-                               interrupts = <0 85 0x04>;
+                               interrupts = <0 85 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_PWM3>,
                                         <&clks IMX6SL_CLK_PWM3>;
                                clock-names = "ipg", "per";
                                #pwm-cells = <2>;
                                compatible = "fsl,imx6sl-pwm", "fsl,imx27-pwm";
                                reg = <0x0208c000 0x4000>;
-                               interrupts = <0 86 0x04>;
+                               interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_PWM4>,
                                         <&clks IMX6SL_CLK_PWM4>;
                                clock-names = "ipg", "per";
                        gpt: gpt@02098000 {
                                compatible = "fsl,imx6sl-gpt";
                                reg = <0x02098000 0x4000>;
-                               interrupts = <0 55 0x04>;
+                               interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_GPT>,
                                         <&clks IMX6SL_CLK_GPT_SERIAL>;
                                clock-names = "ipg", "per";
                        gpio1: gpio@0209c000 {
                                compatible = "fsl,imx6sl-gpio", "fsl,imx35-gpio";
                                reg = <0x0209c000 0x4000>;
-                               interrupts = <0 66 0x04 0 67 0x04>;
+                               interrupts = <0 66 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 67 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                        gpio2: gpio@020a0000 {
                                compatible = "fsl,imx6sl-gpio", "fsl,imx35-gpio";
                                reg = <0x020a0000 0x4000>;
-                               interrupts = <0 68 0x04 0 69 0x04>;
+                               interrupts = <0 68 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 69 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                        gpio3: gpio@020a4000 {
                                compatible = "fsl,imx6sl-gpio", "fsl,imx35-gpio";
                                reg = <0x020a4000 0x4000>;
-                               interrupts = <0 70 0x04 0 71 0x04>;
+                               interrupts = <0 70 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 71 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                        gpio4: gpio@020a8000 {
                                compatible = "fsl,imx6sl-gpio", "fsl,imx35-gpio";
                                reg = <0x020a8000 0x4000>;
-                               interrupts = <0 72 0x04 0 73 0x04>;
+                               interrupts = <0 72 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 73 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
                        gpio5: gpio@020ac000 {
                                compatible = "fsl,imx6sl-gpio", "fsl,imx35-gpio";
                                reg = <0x020ac000 0x4000>;
-                               interrupts = <0 74 0x04 0 75 0x04>;
+                               interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 75 IRQ_TYPE_LEVEL_HIGH>;
                                gpio-controller;
                                #gpio-cells = <2>;
                                interrupt-controller;
 
                        kpp: kpp@020b8000 {
                                reg = <0x020b8000 0x4000>;
-                               interrupts = <0 82 0x04>;
+                               interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        wdog1: wdog@020bc000 {
                                compatible = "fsl,imx6sl-wdt", "fsl,imx21-wdt";
                                reg = <0x020bc000 0x4000>;
-                               interrupts = <0 80 0x04>;
+                               interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_DUMMY>;
                        };
 
                        wdog2: wdog@020c0000 {
                                compatible = "fsl,imx6sl-wdt", "fsl,imx21-wdt";
                                reg = <0x020c0000 0x4000>;
-                               interrupts = <0 81 0x04>;
+                               interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_DUMMY>;
                                status = "disabled";
                        };
                        clks: ccm@020c4000 {
                                compatible = "fsl,imx6sl-ccm";
                                reg = <0x020c4000 0x4000>;
-                               interrupts = <0 87 0x04 0 88 0x04>;
+                               interrupts = <0 87 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 88 IRQ_TYPE_LEVEL_HIGH>;
                                #clock-cells = <1>;
                        };
 
                                             "fsl,imx6q-anatop",
                                             "syscon", "simple-bus";
                                reg = <0x020c8000 0x1000>;
-                               interrupts = <0 49 0x04 0 54 0x04 0 127 0x04>;
+                               interrupts = <0 49 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 54 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 127 IRQ_TYPE_LEVEL_HIGH>;
 
                                regulator-1p1@110 {
                                        compatible = "fsl,anatop-regulator";
                        usbphy1: usbphy@020c9000 {
                                compatible = "fsl,imx6sl-usbphy", "fsl,imx23-usbphy";
                                reg = <0x020c9000 0x1000>;
-                               interrupts = <0 44 0x04>;
+                               interrupts = <0 44 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_USBPHY1>;
                        };
 
                        usbphy2: usbphy@020ca000 {
                                compatible = "fsl,imx6sl-usbphy", "fsl,imx23-usbphy";
                                reg = <0x020ca000 0x1000>;
-                               interrupts = <0 45 0x04>;
+                               interrupts = <0 45 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_USBPHY2>;
                        };
 
                                snvs-rtc-lp@34 {
                                        compatible = "fsl,sec-v4.0-mon-rtc-lp";
                                        reg = <0x34 0x58>;
-                                       interrupts = <0 19 0x04 0 20 0x04>;
+                                       interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>,
+                                                    <0 20 IRQ_TYPE_LEVEL_HIGH>;
                                };
                        };
 
                        epit1: epit@020d0000 {
                                reg = <0x020d0000 0x4000>;
-                               interrupts = <0 56 0x04>;
+                               interrupts = <0 56 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        epit2: epit@020d4000 {
                                reg = <0x020d4000 0x4000>;
-                               interrupts = <0 57 0x04>;
+                               interrupts = <0 57 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        src: src@020d8000 {
                                compatible = "fsl,imx6sl-src", "fsl,imx51-src";
                                reg = <0x020d8000 0x4000>;
-                               interrupts = <0 91 0x04 0 96 0x04>;
+                               interrupts = <0 91 IRQ_TYPE_LEVEL_HIGH>,
+                                            <0 96 IRQ_TYPE_LEVEL_HIGH>;
                                #reset-cells = <1>;
                        };
 
                        gpc: gpc@020dc000 {
                                compatible = "fsl,imx6sl-gpc", "fsl,imx6q-gpc";
                                reg = <0x020dc000 0x4000>;
-                               interrupts = <0 89 0x04>;
+                               interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        gpr: iomuxc-gpr@020e0000 {
                        iomuxc: iomuxc@020e0000 {
                                compatible = "fsl,imx6sl-iomuxc";
                                reg = <0x020e0000 0x4000>;
-
-                               ecspi1 {
-                                       pinctrl_ecspi1_1: ecspi1grp-1 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_ECSPI1_MISO__ECSPI1_MISO 0x100b1
-                                                       MX6SL_PAD_ECSPI1_MOSI__ECSPI1_MOSI 0x100b1
-                                                       MX6SL_PAD_ECSPI1_SCLK__ECSPI1_SCLK 0x100b1
-                                               >;
-                                       };
-                               };
-
-                               fec {
-                                       pinctrl_fec_1: fecgrp-1 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_FEC_MDC__FEC_MDC         0x1b0b0
-                                                       MX6SL_PAD_FEC_MDIO__FEC_MDIO       0x1b0b0
-                                                       MX6SL_PAD_FEC_CRS_DV__FEC_RX_DV    0x1b0b0
-                                                       MX6SL_PAD_FEC_RXD0__FEC_RX_DATA0   0x1b0b0
-                                                       MX6SL_PAD_FEC_RXD1__FEC_RX_DATA1   0x1b0b0
-                                                       MX6SL_PAD_FEC_TX_EN__FEC_TX_EN     0x1b0b0
-                                                       MX6SL_PAD_FEC_TXD0__FEC_TX_DATA0   0x1b0b0
-                                                       MX6SL_PAD_FEC_TXD1__FEC_TX_DATA1   0x1b0b0
-                                                       MX6SL_PAD_FEC_REF_CLK__FEC_REF_OUT 0x4001b0a8
-                                               >;
-                                       };
-                               };
-
-                               uart1 {
-                                       pinctrl_uart1_1: uart1grp-1 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_UART1_RXD__UART1_RX_DATA 0x1b0b1
-                                                       MX6SL_PAD_UART1_TXD__UART1_TX_DATA 0x1b0b1
-                                               >;
-                                       };
-                               };
-
-                               usbotg1 {
-                                       pinctrl_usbotg1_1: usbotg1grp-1 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_EPDC_PWRCOM__USB_OTG1_ID 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usbotg1_2: usbotg1grp-2 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_FEC_RXD0__USB_OTG1_ID 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usbotg1_3: usbotg1grp-3 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_LCD_DAT1__USB_OTG1_ID 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usbotg1_4: usbotg1grp-4 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_REF_CLK_32K__USB_OTG1_ID 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usbotg1_5: usbotg1grp-5 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_SD3_DAT0__USB_OTG1_ID 0x17059
-                                               >;
-                                       };
-                               };
-
-                               usbotg2 {
-                                       pinctrl_usbotg2_1: usbotg2grp-1 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_ECSPI1_SCLK__USB_OTG2_OC 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usbotg2_2: usbotg2grp-2 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_ECSPI2_SCLK__USB_OTG2_OC 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usbotg2_3: usbotg2grp-3 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_KEY_ROW5__USB_OTG2_OC 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usbotg2_4: usbotg2grp-4 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_SD3_DAT2__USB_OTG2_OC 0x17059
-                                               >;
-                                       };
-                               };
-
-                               usdhc1 {
-                                       pinctrl_usdhc1_1: usdhc1grp-1 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_SD1_CMD__SD1_CMD    0x17059
-                                                       MX6SL_PAD_SD1_CLK__SD1_CLK    0x10059
-                                                       MX6SL_PAD_SD1_DAT0__SD1_DATA0 0x17059
-                                                       MX6SL_PAD_SD1_DAT1__SD1_DATA1 0x17059
-                                                       MX6SL_PAD_SD1_DAT2__SD1_DATA2 0x17059
-                                                       MX6SL_PAD_SD1_DAT3__SD1_DATA3 0x17059
-                                                       MX6SL_PAD_SD1_DAT4__SD1_DATA4 0x17059
-                                                       MX6SL_PAD_SD1_DAT5__SD1_DATA5 0x17059
-                                                       MX6SL_PAD_SD1_DAT6__SD1_DATA6 0x17059
-                                                       MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc1_1_100mhz: usdhc1grp-1-100mhz {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_SD1_CMD__SD1_CMD 0x170b9
-                                                       MX6SL_PAD_SD1_CLK__SD1_CLK 0x100b9
-                                                       MX6SL_PAD_SD1_DAT0__SD1_DATA0 0x170b9
-                                                       MX6SL_PAD_SD1_DAT1__SD1_DATA1 0x170b9
-                                                       MX6SL_PAD_SD1_DAT2__SD1_DATA2 0x170b9
-                                                       MX6SL_PAD_SD1_DAT3__SD1_DATA3 0x170b9
-                                                       MX6SL_PAD_SD1_DAT4__SD1_DATA4 0x170b9
-                                                       MX6SL_PAD_SD1_DAT5__SD1_DATA5 0x170b9
-                                                       MX6SL_PAD_SD1_DAT6__SD1_DATA6 0x170b9
-                                                       MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x170b9
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc1_1_200mhz: usdhc1grp-1-200mhz {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_SD1_CMD__SD1_CMD 0x170f9
-                                                       MX6SL_PAD_SD1_CLK__SD1_CLK 0x100f9
-                                                       MX6SL_PAD_SD1_DAT0__SD1_DATA0 0x170f9
-                                                       MX6SL_PAD_SD1_DAT1__SD1_DATA1 0x170f9
-                                                       MX6SL_PAD_SD1_DAT2__SD1_DATA2 0x170f9
-                                                       MX6SL_PAD_SD1_DAT3__SD1_DATA3 0x170f9
-                                                       MX6SL_PAD_SD1_DAT4__SD1_DATA4 0x170f9
-                                                       MX6SL_PAD_SD1_DAT5__SD1_DATA5 0x170f9
-                                                       MX6SL_PAD_SD1_DAT6__SD1_DATA6 0x170f9
-                                                       MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x170f9
-                                               >;
-                                       };
-
-
-                               };
-
-                               usdhc2 {
-                                       pinctrl_usdhc2_1: usdhc2grp-1 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_SD2_CMD__SD2_CMD    0x17059
-                                                       MX6SL_PAD_SD2_CLK__SD2_CLK    0x10059
-                                                       MX6SL_PAD_SD2_DAT0__SD2_DATA0 0x17059
-                                                       MX6SL_PAD_SD2_DAT1__SD2_DATA1 0x17059
-                                                       MX6SL_PAD_SD2_DAT2__SD2_DATA2 0x17059
-                                                       MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc2_1_100mhz: usdhc2grp-1-100mhz {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_SD2_CMD__SD2_CMD    0x170b9
-                                                       MX6SL_PAD_SD2_CLK__SD2_CLK    0x100b9
-                                                       MX6SL_PAD_SD2_DAT0__SD2_DATA0 0x170b9
-                                                       MX6SL_PAD_SD2_DAT1__SD2_DATA1 0x170b9
-                                                       MX6SL_PAD_SD2_DAT2__SD2_DATA2 0x170b9
-                                                       MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x170b9
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc2_1_200mhz: usdhc2grp-1-200mhz {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_SD2_CMD__SD2_CMD    0x170f9
-                                                       MX6SL_PAD_SD2_CLK__SD2_CLK    0x100f9
-                                                       MX6SL_PAD_SD2_DAT0__SD2_DATA0 0x170f9
-                                                       MX6SL_PAD_SD2_DAT1__SD2_DATA1 0x170f9
-                                                       MX6SL_PAD_SD2_DAT2__SD2_DATA2 0x170f9
-                                                       MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x170f9
-                                               >;
-                                       };
-
-                               };
-
-                               usdhc3 {
-                                       pinctrl_usdhc3_1: usdhc3grp-1 {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_SD3_CMD__SD3_CMD    0x17059
-                                                       MX6SL_PAD_SD3_CLK__SD3_CLK    0x10059
-                                                       MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x17059
-                                                       MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x17059
-                                                       MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x17059
-                                                       MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x17059
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc3_1_100mhz: usdhc3grp-1-100mhz {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_SD3_CMD__SD3_CMD    0x170b9
-                                                       MX6SL_PAD_SD3_CLK__SD3_CLK    0x100b9
-                                                       MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x170b9
-                                                       MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x170b9
-                                                       MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x170b9
-                                                       MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x170b9
-                                               >;
-                                       };
-
-                                       pinctrl_usdhc3_1_200mhz: usdhc3grp-1-200mhz {
-                                               fsl,pins = <
-                                                       MX6SL_PAD_SD3_CMD__SD3_CMD    0x170f9
-                                                       MX6SL_PAD_SD3_CLK__SD3_CLK    0x100f9
-                                                       MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x170f9
-                                                       MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x170f9
-                                                       MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x170f9
-                                                       MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x170f9
-                                               >;
-                                       };
-                               };
                        };
 
                        csi: csi@020e4000 {
                                reg = <0x020e4000 0x4000>;
-                               interrupts = <0 7 0x04>;
+                               interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        spdc: spdc@020e8000 {
                                reg = <0x020e8000 0x4000>;
-                               interrupts = <0 6 0x04>;
+                               interrupts = <0 6 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        sdma: sdma@020ec000 {
                                compatible = "fsl,imx6sl-sdma", "fsl,imx35-sdma";
                                reg = <0x020ec000 0x4000>;
-                               interrupts = <0 2 0x04>;
+                               interrupts = <0 2 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_SDMA>,
                                         <&clks IMX6SL_CLK_SDMA>;
                                clock-names = "ipg", "ahb";
 
                        pxp: pxp@020f0000 {
                                reg = <0x020f0000 0x4000>;
-                               interrupts = <0 98 0x04>;
+                               interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        epdc: epdc@020f4000 {
                                reg = <0x020f4000 0x4000>;
-                               interrupts = <0 97 0x04>;
+                               interrupts = <0 97 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        lcdif: lcdif@020f8000 {
                                reg = <0x020f8000 0x4000>;
-                               interrupts = <0 39 0x04>;
+                               interrupts = <0 39 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        dcp: dcp@020fc000 {
                                reg = <0x020fc000 0x4000>;
-                               interrupts = <0 99 0x04>;
+                               interrupts = <0 99 IRQ_TYPE_LEVEL_HIGH>;
                        };
                };
 
                        usbotg1: usb@02184000 {
                                compatible = "fsl,imx6sl-usb", "fsl,imx27-usb";
                                reg = <0x02184000 0x200>;
-                               interrupts = <0 43 0x04>;
+                               interrupts = <0 43 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_USBOH3>;
                                fsl,usbphy = <&usbphy1>;
                                fsl,usbmisc = <&usbmisc 0>;
                        usbotg2: usb@02184200 {
                                compatible = "fsl,imx6sl-usb", "fsl,imx27-usb";
                                reg = <0x02184200 0x200>;
-                               interrupts = <0 42 0x04>;
+                               interrupts = <0 42 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_USBOH3>;
                                fsl,usbphy = <&usbphy2>;
                                fsl,usbmisc = <&usbmisc 1>;
                        usbh: usb@02184400 {
                                compatible = "fsl,imx6sl-usb", "fsl,imx27-usb";
                                reg = <0x02184400 0x200>;
-                               interrupts = <0 40 0x04>;
+                               interrupts = <0 40 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_USBOH3>;
                                fsl,usbmisc = <&usbmisc 2>;
                                status = "disabled";
                        fec: ethernet@02188000 {
                                compatible = "fsl,imx6sl-fec", "fsl,imx25-fec";
                                reg = <0x02188000 0x4000>;
-                               interrupts = <0 114 0x04>;
+                               interrupts = <0 114 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_ENET_REF>,
                                         <&clks IMX6SL_CLK_ENET_REF>;
                                clock-names = "ipg", "ahb";
                        usdhc1: usdhc@02190000 {
                                compatible = "fsl,imx6sl-usdhc", "fsl,imx6q-usdhc";
                                reg = <0x02190000 0x4000>;
-                               interrupts = <0 22 0x04>;
+                               interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_USDHC1>,
                                         <&clks IMX6SL_CLK_USDHC1>,
                                         <&clks IMX6SL_CLK_USDHC1>;
                        usdhc2: usdhc@02194000 {
                                compatible = "fsl,imx6sl-usdhc", "fsl,imx6q-usdhc";
                                reg = <0x02194000 0x4000>;
-                               interrupts = <0 23 0x04>;
+                               interrupts = <0 23 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_USDHC2>,
                                         <&clks IMX6SL_CLK_USDHC2>,
                                         <&clks IMX6SL_CLK_USDHC2>;
                        usdhc3: usdhc@02198000 {
                                compatible = "fsl,imx6sl-usdhc", "fsl,imx6q-usdhc";
                                reg = <0x02198000 0x4000>;
-                               interrupts = <0 24 0x04>;
+                               interrupts = <0 24 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_USDHC3>,
                                         <&clks IMX6SL_CLK_USDHC3>,
                                         <&clks IMX6SL_CLK_USDHC3>;
                        usdhc4: usdhc@0219c000 {
                                compatible = "fsl,imx6sl-usdhc", "fsl,imx6q-usdhc";
                                reg = <0x0219c000 0x4000>;
-                               interrupts = <0 25 0x04>;
+                               interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_USDHC4>,
                                         <&clks IMX6SL_CLK_USDHC4>,
                                         <&clks IMX6SL_CLK_USDHC4>;
                                #size-cells = <0>;
                                compatible = "fsl,imx6sl-i2c", "fsl,imx21-i2c";
                                reg = <0x021a0000 0x4000>;
-                               interrupts = <0 36 0x04>;
+                               interrupts = <0 36 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_I2C1>;
                                status = "disabled";
                        };
                                #size-cells = <0>;
                                compatible = "fsl,imx6sl-i2c", "fsl,imx21-i2c";
                                reg = <0x021a4000 0x4000>;
-                               interrupts = <0 37 0x04>;
+                               interrupts = <0 37 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_I2C2>;
                                status = "disabled";
                        };
                                #size-cells = <0>;
                                compatible = "fsl,imx6sl-i2c", "fsl,imx21-i2c";
                                reg = <0x021a8000 0x4000>;
-                               interrupts = <0 38 0x04>;
+                               interrupts = <0 38 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clks IMX6SL_CLK_I2C3>;
                                status = "disabled";
                        };
 
                        rngb: rngb@021b4000 {
                                reg = <0x021b4000 0x4000>;
-                               interrupts = <0 5 0x04>;
+                               interrupts = <0 5 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        weim: weim@021b8000 {
                                reg = <0x021b8000 0x4000>;
-                               interrupts = <0 14 0x04>;
+                               interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>;
                        };
 
                        ocotp: ocotp@021bc000 {
index 650ef30e1856f9591f32a445f279489c82b22b68..e4e1968dfca8abe05defd5ebe6ced71cbe88df95 100644 (file)
@@ -97,6 +97,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..f010c21220bf8dd485cb1dd3cdee0f881223b23f 100644 (file)
                        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 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 */
        };
 };
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..dd58a25a4166e4fd774cdc6276dbafcee81c7d64 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))
 
index aed83deaa991c9b8856218ef0792f1c3f51cc2b4..fcc5bb63f03a949cd80ed090a66f8a901614899f 100644 (file)
@@ -58,7 +58,7 @@
        status = "okay";
 
        ethphy: ethernet-phy {
-               device-type = "ethernet-phy";
+               device_type = "ethernet-phy";
                reg = <8>;
        };
 };
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..b4a6c3b43ee933403b854b509600edf3bcaf46ac 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 {
                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 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";
        };
                #gpio-cells = <2>;
        };
 
-       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..7b80f19129e3f4301a9760dc5f1fabb83ec6291c 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>
 
 / {
 
 &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>;
        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";
        };
index 426cd9c3e1c430fc214651809be12c489b2765b9..a06a11e1a84026efaf0cc39914e7629c1fde72a1 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "r8a7740.dtsi"
+#include "r8a7740.dtsi"
 
 / {
        model = "armadillo 800 eva";
index ae1e230f711ddf243168abc55cfc6cd3e3095cf8..b1c2ed961eedc7f3728d2c8557870a160ae14d0d 100644 (file)
@@ -10,6 +10,8 @@
 
 /include/ "skeleton.dtsi"
 
+#include <dt-bindings/interrupt-controller/irq.h>
+
 / {
        compatible = "renesas,r8a7740";
 
@@ -34,7 +36,7 @@
 
        pmu {
                compatible = "arm,cortex-a9-pmu";
-               interrupts = <0 83 4>;
+               interrupts = <0 83 IRQ_TYPE_LEVEL_HIGH>;
        };
 
        /* irqpin0: IRQ0 - IRQ7 */
                        <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 */
                        <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 */
                        <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 */
                        <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";
        };
 
                #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";
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..3314e0aeccf509c4844104c6d1f32e2a9ab09521 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>;
                        <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 4>;
+               status = "disabled";
+       };
+
+       hspi1: spi@fffc8000 {
+               compatible = "renesas,hspi";
+               reg = <0xfffc8000 0x18>;
+               interrupt-controller = <&gic>;
+               interrupts = <0 84 4>;
+               status = "disabled";
+       };
+
+       hspi2: spi@fffc6000 {
+               compatible = "renesas,hspi";
+               reg = <0xfffc6000 0x18>;
+               interrupt-controller = <&gic>;
+               interrupts = <0 85 4>;
+               status = "disabled";
        };
 };
index ab4110aa3c3b5a4ad31f1600959195099f8ace9c..918085c375d9af586cd0d069b45e6d5a56768c89 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";
        };
 };
+
+&sdhi0 {
+       pinctrl-0 = <&sdhi0_pins>;
+       pinctrl-names = "default";
+
+       vmmc-supply = <&fixedregulator3v3>;
+       bus-width = <4>;
+       status = "okay";
+};
index f3f7f79997360d65c7a8d5bfeeba9d23e76168d3..a7af2c2371f2581b6e9f8e1e43a064eef46bc60e 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 /dts-v1/;
-/include/ "r8a7779.dtsi"
+#include "r8a7779.dtsi"
 
 / {
        model = "marzen";
index 19faeac3fd2e1b74f5d289948dd486f473f931de..b2b418a8ab2ddb3cb47e136829ec1802bda77d2b 100644 (file)
@@ -11,6 +11,8 @@
 
 /include/ "skeleton.dtsi"
 
+#include <dt-bindings/interrupt-controller/irq.h>
+
 / {
        compatible = "renesas,r8a7779";
 
@@ -52,7 +54,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 +66,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 +78,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 +90,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>;
                        <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";
        };
 };
index c462ef138922b260666434bc65a9f1d9f1fb31fe..dfedc0ea82e1c89e6ea6b1fea5a7c8d5a45a8ea0 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "r8a7790.dtsi"
+#include "r8a7790.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 
 / {
                reg = <0 0x40000000 0 0x80000000>;
        };
 
+       memory@180000000 {
+               device_type = "memory";
+               reg = <1 0x80000000 0 0x80000000>;
+       };
+
        lbsc {
                #address-cells = <1>;
                #size-cells = <1>;
                        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;
+       };
+};
+
+&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 203bd089af29d83355ed9b2ebdc029045012320f..10e6a08164e58998602da8d62f4487c75ee39673 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "r8a7790.dtsi"
+#include "r8a7790.dtsi"
 
 / {
        model = "Lager";
                reg = <0 0x40000000 0 0x80000000>;
        };
 
+       memory@180000000 {
+               device_type = "memory";
+               reg = <1 0x80000000 0 0x80000000>;
+       };
+
        lbsc {
                #address-cells = <1>;
                #size-cells = <1>;
index ee845fad939b895a1bfb907c6597f9f916d926f8..68b7b87e535f6343bd20ff6d1156ed60877f9cf5 100644 (file)
@@ -8,6 +8,9 @@
  * kind, whether express or implied.
  */
 
+#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@ffc40000 {
+       gpio0: gpio@e6050000 {
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
-               reg = <0 0xffc40000 0 0x2c>;
+               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>;
                interrupt-controller;
        };
 
-       gpio1: gpio@ffc41000 {
+       gpio1: gpio@e6051000 {
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
-               reg = <0 0xffc41000 0 0x2c>;
+               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>;
                interrupt-controller;
        };
 
-       gpio2: gpio@ffc42000 {
+       gpio2: gpio@e6052000 {
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
-               reg = <0 0xffc42000 0 0x2c>;
+               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>;
                interrupt-controller;
        };
 
-       gpio3: gpio@ffc43000 {
+       gpio3: gpio@e6053000 {
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
-               reg = <0 0xffc43000 0 0x2c>;
+               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>;
                interrupt-controller;
        };
 
-       gpio4: gpio@ffc44000 {
+       gpio4: gpio@e6054000 {
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
-               reg = <0 0xffc44000 0 0x2c>;
+               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>;
                interrupt-controller;
        };
 
-       gpio5: gpio@ffc45000 {
+       gpio5: gpio@e6055000 {
                compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
-               reg = <0 0xffc45000 0 0x2c>;
+               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>;
                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>;
                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>;
                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>;
                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>;
                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>;
                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 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-r8a7790";
                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-r8a7790";
                reg = <0 0xee140000 0 0x100>;
                interrupt-parent = <&gic>;
-               interrupts = <0 167 4>;
+               interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH>;
                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>;
                cap-sd-highspeed;
                status = "disabled";
        };
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..1919273
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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>;
+       };
+
+       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..c4e8b3a0cd13af0ff201f3df89a8d9821c2452dc 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 /dts-v1/;
-/include/ "r8a7791.dtsi"
+#include "r8a7791.dtsi"
 
 / {
        model = "Koelsch";
index fea5cfef4691c3656b7b34560eedccaee38ef0b1..a349aff54c76c333139962d16c4ba6bbc566b8ef 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,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>;
        };
 };
index 5cdaba4cea8653d8db51616f443a4d8ee2d79ef4..de9feced9935e8150e96e8f6aaaeb52509520e82 100644 (file)
@@ -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";
                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 +88,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";
                        };
 
                                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>;
                                dma-names = "tx", "rx";
                                #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";
                        };
 
                                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";
                        };
 
                                        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";
                };
 
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..49d4d76ca6f45b7d06f19423505fa2faf652fbf6 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 {
+                                       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 +65,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 8acf51e0cdae8b10bdda5d875a61f4c9e543e19c..a759a276c9a972d4174e519240e4f9ed7d720fd0 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "sh7372.dtsi"
+#include "sh7372.dtsi"
 
 / {
        model = "Mackerel (AP4 EVM 2nd)";
index 8ee06dd81799da98cbe14ed6c43973e4d4bd513f..5bb593daab529301cf64d1ef9b0c9c9ffc2fbec4 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";
+               };
+       };
 };
 
 &i2c0 {
        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";
        };
index 0f1ca7792c46acebbbce831371e04200aa89846d..27c5f426d172f03d53801875ec5a5293c4f45b88 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "sh73a0.dtsi"
+#include "sh73a0.dtsi"
 
 / {
        model = "KZM-A9-GT";
index fcf26889a8a0aacb380d980fb6cccdd36ee36dff..29d2ee6e36c6f41d1d2daab0cfedff994ee89105 100644 (file)
@@ -10,6 +10,8 @@
 
 /include/ "skeleton.dtsi"
 
+#include <dt-bindings/interrupt-controller/irq.h>
+
 / {
        compatible = "renesas,sh73a0";
 
@@ -40,8 +42,8 @@
 
        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 {
                        <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 {
                        <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;
        };
 
                        <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 {
                        <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";
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..e28242173d18fae01ace4ddad502306d540a405b 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>;
+                       pinctrl-names = "default", "sleep";
+                       pinctrl-0 = <&sdi0_default_mode>;
+                       pinctrl-1 = <&sdi0_sleep_mode>;
 
                        cd-gpios  = <&tc3589x_gpio 3 0x4>;
 
                        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..b0f5def8e2a8fcb843805368ad94352f9e3d2854 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>;
+               };
+
                vmmci: regulator-gpio {
                        gpios = <&tc3589x_gpio 18 0x4>;
                        enable-gpio = <&tc3589x_gpio 17 0x4>;
 
                        status = "okay";
                };
+
+               pinctrl {
+                       /* Set this up using hogs */
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&ipgpio_hrefprev60_mode>;
+
+                       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..941bf9ad6f013971ae6843ec283429d18f499149 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 {
 
                        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 = <&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>;
+
+                       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 f0b39f835914beda02952a3cd9eb8860e38599ba..9070c3701c89172f28fb71740473c0345fa48e70 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>;
                        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 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 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..5abf1a2e31603e9570207d43fa1a4bbdaf7a0f2a 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
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 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
index ad7dfbbafa453422fc5c986e2f749d3eaf609a0c..aec8a3ea14365d1ead3c9d189426c616fc07ab7d 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
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
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..f338fd6370ad0f045fb74baf63de3cad783249cb 100644 (file)
@@ -42,6 +42,7 @@ 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
@@ -129,6 +130,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,6 +159,7 @@ 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
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..7fd65a01ec7ee2636a179d955cebd5ab90bd30c4 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
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..35dc8b2be47f64ed73f43128dfe61c9aacd24a0a 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
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
index c1df4e9db140831e45e5b91b2c280b1a1d813fef..cdb85cb6b3b0e2813fa93a1dae00b105ce2c6e79 100644 (file)
@@ -68,6 +68,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 +92,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..6fcb5c88a6435f2ccb57174db713fbe5382f0a62 100644 (file)
@@ -69,6 +69,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 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 3c597c222ef278a8eb170a4169b5e54dcc158ac0..fbeb39c869e9fdcedace1d61688247c14141cab3 100644 (file)
@@ -329,7 +329,7 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
  */
 #define ioremap(cookie,size)           __arm_ioremap((cookie), (size), MT_DEVICE)
 #define ioremap_nocache(cookie,size)   __arm_ioremap((cookie), (size), MT_DEVICE)
-#define ioremap_cached(cookie,size)    __arm_ioremap((cookie), (size), MT_DEVICE_CACHED)
+#define ioremap_cache(cookie,size)     __arm_ioremap((cookie), (size), MT_DEVICE_CACHED)
 #define ioremap_wc(cookie,size)                __arm_ioremap((cookie), (size), MT_DEVICE_WC)
 #define iounmap                                __arm_iounmap
 
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 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; }
 
index 75579a9d6f76cba3cc84ad61d01ed103269378bd..3759cacdd7f8601322b98ffed6598d97ee8bd016 100644 (file)
@@ -117,6 +117,6 @@ static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
        return __set_phys_to_machine(pfn, mfn);
 }
 
-#define xen_remap(cookie, size) ioremap_cached((cookie), (size));
+#define xen_remap(cookie, size) ioremap_cache((cookie), (size));
 
 #endif /* _ASM_ARM_XEN_PAGE_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 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 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 dbf0923e8d76bda9392b902e0c8e500025d70402..1861240d12f39e951666904c783fdaa74254eedf 100644 (file)
@@ -56,7 +56,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 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
index 699b71e7f7ecffb0e978a8387af33699c19233ca..b4f7d6ffa30b4661c7fd68d1c648f8958e2d85ee 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
@@ -65,6 +86,9 @@ config SOC_SAMA5D3
        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.
@@ -78,11 +102,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 +120,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 +130,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 +158,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 +174,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.
 
index ca900be144ce9466db4a1cfb6fb577eef669e81e..b736b571e882a59f815026ebf3764f32ef9c7b3b 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"
index 90aab2d5a07f3aed6acc2ed8788105b877756fe6..705b38a179ec5b6a06d51d69bcd2b9280d288cf2 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
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,
index 6b2630a92f71723644ff7c7242cf6579aa7f4802..72b2579447337a8c650d998ea35eee6205d02721 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>
@@ -884,6 +884,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;
 
index 9986542e8060119fcad4eee37564fdf3d8d164a6..d43b79f56e942e554d65d0d723f28315f3cf5bd1 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"
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 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..9dc8894c56233db9e9567002d75365c144290ab3 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);
@@ -491,7 +491,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 +507,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.
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 c46eccbbd51226f5ae6ab5a16e1c89668c35fa1d..78829c513fdc354bce631d67f45922efff84368d 100644 (file)
@@ -487,7 +487,7 @@ int __init da8xx_register_emac(void)
 
 static struct resource da830_mcasp1_resources[] = {
        {
-               .name   = "mcasp1",
+               .name   = "mpu",
                .start  = DAVINCI_DA830_MCASP1_REG_BASE,
                .end    = DAVINCI_DA830_MCASP1_REG_BASE + (SZ_1K * 12) - 1,
                .flags  = IORESOURCE_MEM,
@@ -515,7 +515,7 @@ static struct platform_device da830_mcasp1_device = {
 
 static struct resource da850_mcasp_resources[] = {
        {
-               .name   = "mcasp",
+               .name   = "mpu",
                .start  = DAVINCI_DA8XX_MCASP0_REG_BASE,
                .end    = DAVINCI_DA8XX_MCASP0_REG_BASE + (SZ_1K * 12) - 1,
                .flags  = IORESOURCE_MEM,
index ef9ff1fb6f52a2533378ba37563c06e877b32ea3..6117fc644188d9aa81c2397dbb60538db190beea 100644 (file)
@@ -641,6 +641,7 @@ static struct platform_device dm355_edma_device = {
 
 static struct resource dm355_asp1_resources[] = {
        {
+               .name   = "mpu",
                .start  = DAVINCI_ASP1_BASE,
                .end    = DAVINCI_ASP1_BASE + SZ_8K - 1,
                .flags  = IORESOURCE_MEM,
@@ -906,7 +907,7 @@ static struct davinci_gpio_platform_data dm355_gpio_platform_data = {
 int __init dm355_gpio_register(void)
 {
        return davinci_gpio_register(dm355_gpio_resources,
-                                    sizeof(dm355_gpio_resources),
+                                    ARRAY_SIZE(dm355_gpio_resources),
                                     &dm355_gpio_platform_data);
 }
 /*----------------------------------------------------------------------*/
index 1511a0680f9a1d399cf3094b538c3c52caa06547..d7c6f85d3fc9d5c4347ec214ae8e71a310f89b62 100644 (file)
@@ -720,7 +720,7 @@ static struct davinci_gpio_platform_data dm365_gpio_platform_data = {
 int __init dm365_gpio_register(void)
 {
        return davinci_gpio_register(dm365_gpio_resources,
-                                    sizeof(dm365_gpio_resources),
+                                    ARRAY_SIZE(dm365_gpio_resources),
                                     &dm365_gpio_platform_data);
 }
 
@@ -942,6 +942,7 @@ static struct platform_device dm365_edma_device = {
 
 static struct resource dm365_asp_resources[] = {
        {
+               .name   = "mpu",
                .start  = DAVINCI_DM365_ASP0_BASE,
                .end    = DAVINCI_DM365_ASP0_BASE + SZ_8K - 1,
                .flags  = IORESOURCE_MEM,
index 143a3217e8efb8fde1aa417700c45840d242aac0..3ce47997bb46150e82f40e718474feeae52b6d5e 100644 (file)
@@ -572,6 +572,7 @@ static struct platform_device dm644x_edma_device = {
 /* DM6446 EVM uses ASP0; line-out is a pair of RCA jacks */
 static struct resource dm644x_asp_resources[] = {
        {
+               .name   = "mpu",
                .start  = DAVINCI_ASP0_BASE,
                .end    = DAVINCI_ASP0_BASE + SZ_8K - 1,
                .flags  = IORESOURCE_MEM,
@@ -792,7 +793,7 @@ static struct davinci_gpio_platform_data dm644_gpio_platform_data = {
 int __init dm644x_gpio_register(void)
 {
        return davinci_gpio_register(dm644_gpio_resources,
-                                    sizeof(dm644_gpio_resources),
+                                    ARRAY_SIZE(dm644_gpio_resources),
                                     &dm644_gpio_platform_data);
 }
 /*----------------------------------------------------------------------*/
index 2a73f299c1d094615236359d6ac27959cdd16295..0e81fea65e7fb484cda893f0a4cd91d0b74fc0ad 100644 (file)
@@ -621,7 +621,7 @@ static struct platform_device dm646x_edma_device = {
 
 static struct resource dm646x_mcasp0_resources[] = {
        {
-               .name   = "mcasp0",
+               .name   = "mpu",
                .start  = DAVINCI_DM646X_MCASP0_REG_BASE,
                .end    = DAVINCI_DM646X_MCASP0_REG_BASE + (SZ_1K << 1) - 1,
                .flags  = IORESOURCE_MEM,
@@ -641,7 +641,7 @@ static struct resource dm646x_mcasp0_resources[] = {
 
 static struct resource dm646x_mcasp1_resources[] = {
        {
-               .name   = "mcasp1",
+               .name   = "mpu",
                .start  = DAVINCI_DM646X_MCASP1_REG_BASE,
                .end    = DAVINCI_DM646X_MCASP1_REG_BASE + (SZ_1K << 1) - 1,
                .flags  = IORESOURCE_MEM,
@@ -769,7 +769,7 @@ static struct davinci_gpio_platform_data dm646x_gpio_platform_data = {
 int __init dm646x_gpio_register(void)
 {
        return davinci_gpio_register(dm646x_gpio_resources,
-                                    sizeof(dm646x_gpio_resources),
+                                    ARRAY_SIZE(dm646x_gpio_resources),
                                     &dm646x_gpio_platform_data);
 }
 /*----------------------------------------------------------------------*/
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);
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 b3d7e5634b83cb02ce568040099027007820a45b..bd3bf66ce3449a31c9c7c9f56be6b4225ee9cbf9 100644 (file)
 #include <linux/clkdev.h>
 #include <linux/clocksource.h>
 #include <linux/dma-mapping.h>
+#include <linux/input.h>
 #include <linux/io.h>
 #include <linux/irqchip.h>
+#include <linux/mailbox.h>
 #include <linux/of.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
+#include <linux/reboot.h>
 #include <linux/amba/bus.h>
 #include <linux/platform_device.h>
 
@@ -130,6 +133,24 @@ static struct platform_device highbank_cpuidle_device = {
        .name = "cpuidle-calxeda",
 };
 
+static int hb_keys_notifier(struct notifier_block *nb, unsigned long event, void *data)
+{
+       u32 key = *(u32 *)data;
+
+       if (event != 0x1000)
+               return 0;
+
+       if (key == KEY_POWER)
+               orderly_poweroff(false);
+       else if (key == 0xffff)
+               ctrl_alt_del();
+
+       return 0;
+}
+static struct notifier_block hb_keys_nb = {
+       .notifier_call = hb_keys_notifier,
+};
+
 static void __init highbank_init(void)
 {
        struct device_node *np;
@@ -145,6 +166,8 @@ static void __init highbank_init(void)
        bus_register_notifier(&platform_bus_type, &highbank_platform_nb);
        bus_register_notifier(&amba_bustype, &highbank_amba_nb);
 
+       pl320_ipc_register_notifier(&hb_keys_nb);
+
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
        if (psci_ops.cpu_suspend)
index 7a6e6f71006893a9c2a54d4a17166762c4647977..d511e05465466b3d11dff8f21f4b2175b36cf3fd 100644 (file)
@@ -11,6 +11,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 +21,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 +100,7 @@ config SOC_IMX25
        select ARCH_MXC_IOMUX_V3
        select CPU_ARM926T
        select MXC_AVIC
+       select PINCTRL_IMX25
 
 config SOC_IMX27
        bool
@@ -118,6 +110,7 @@ config SOC_IMX27
        select IMX_HAVE_IOMUX_V1
        select MACH_MX27
        select MXC_AVIC
+       select PINCTRL_IMX27
 
 config SOC_IMX31
        bool
@@ -145,7 +138,6 @@ config SOC_IMX5
 config SOC_IMX51
        bool
        select HAVE_IMX_SRC
-       select PINCTRL
        select PINCTRL_IMX51
        select SOC_IMX5
 
@@ -766,11 +758,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 +796,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 +816,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 +829,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..0db16972839630f8c47fa7987f547bc66f1a9091 100644 (file)
@@ -112,6 +112,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 ce37af26ff8c6931b62e9459d7ffb7df1daf81ab..dff5ca921d001f128df9c27621a626c1e4b02aa0 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_DI1_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..74ecceb4b5f46ba83d8a01972f985fff2b5c7581 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[] = {
index c0c4ef55e35bd7e522b4f83d038d50f752265db4..a747a7df175f08d3884c72d2138743befb4f3160 100644 (file)
@@ -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)
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 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..2f74fad
--- /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[] __initdata = {
+       "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 d0cfb225ec9aa5e9e9599b6e3ee5c6c32870e0f7..7e5ec34894e2b66096fcbd7f18d9f211c2614a47 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;
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 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..473e21b8736441e94c54778116d8dcd225259707 100644 (file)
@@ -277,7 +277,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 +298,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;
index 9edaf4734fa84956d27539b2411e581aa1ef76a5..bc9d8ec2918efded94977dfeda9993c644421486 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 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 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);
 
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 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..0e6016fadcc58a3ae249eba501d31c11b7e1062e 100644 (file)
@@ -26,7 +26,6 @@ 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
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 1dc5acd4fc99bb7f0001217214d53199dd89174d..2e7cec86e50e94bdb95b2905216614525fe39ff0 100644 (file)
@@ -157,6 +157,8 @@ enum mac_oui {
        OUI_FSL,
        OUI_DENX,
        OUI_CRYSTALFONTZ,
+       OUI_I2SE,
+       OUI_ARMADEUS,
 };
 
 static void __init update_fec_mac_prop(enum mac_oui oui)
@@ -211,6 +213,16 @@ static void __init update_fec_mac_prop(enum mac_oui oui)
                        macaddr[1] = 0xb9;
                        macaddr[2] = 0xe1;
                        break;
+               case OUI_I2SE:
+                       macaddr[0] = 0x00;
+                       macaddr[1] = 0x01;
+                       macaddr[2] = 0x87;
+                       break;
+               case OUI_ARMADEUS:
+                       macaddr[0] = 0x00;
+                       macaddr[1] = 0x1e;
+                       macaddr[2] = 0xac;
+                       break;
                }
                val = ocotp[i];
                macaddr[3] = (val >> 16) & 0xff;
@@ -236,6 +248,11 @@ static void __init imx28_evk_init(void)
        mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
 }
 
+static void __init imx28_apf28_init(void)
+{
+       update_fec_mac_prop(OUI_ARMADEUS);
+}
+
 static int apx4devkit_phy_fixup(struct phy_device *phy)
 {
        phy->dev_flags |= MICREL_PHY_50MHZ_CLK;
@@ -330,6 +347,11 @@ static void __init crystalfontz_init(void)
        update_fec_mac_prop(OUI_CRYSTALFONTZ);
 }
 
+static void __init duckbill_init(void)
+{
+       update_fec_mac_prop(OUI_I2SE);
+}
+
 static void __init m28cu3_init(void)
 {
        update_fec_mac_prop(OUI_DENX);
@@ -426,6 +448,11 @@ static int __init mxs_restart_init(void)
        return 0;
 }
 
+static void __init eukrea_mbmx283lc_init(void)
+{
+       mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
+}
+
 static void __init mxs_machine_init(void)
 {
        struct device_node *root;
@@ -458,10 +485,16 @@ static void __init mxs_machine_init(void)
 
        if (of_machine_is_compatible("fsl,imx28-evk"))
                imx28_evk_init();
+       if (of_machine_is_compatible("armadeus,imx28-apf28"))
+               imx28_apf28_init();
        else if (of_machine_is_compatible("bluegiga,apx4devkit"))
                apx4devkit_init();
        else if (of_machine_is_compatible("crystalfontz,cfa10036"))
                crystalfontz_init();
+       else if (of_machine_is_compatible("eukrea,mbmx283lc"))
+               eukrea_mbmx283lc_init();
+       else if (of_machine_is_compatible("i2se,duckbill"))
+               duckbill_init();
        else if (of_machine_is_compatible("msr,m28cu3"))
                m28cu3_init();
 
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 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 b39efd46abf991827169a6c17a6aa91f3dfeb39f..b5110f19abc7b256484289336c7f28cb4bec913d 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 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 9aa852a8fab9f2c7784003764086cd9d1af8dc2e..d1bfaa73b1c9bb53adbfb359c7a149aacd8cda24 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);
 }
@@ -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 2cb8dc55b50ecbc4aa612ab805b52f03efec3eb9..7094bccbae913ae953594a51e900ce13f8e4137d 100644 (file)
@@ -17,9 +17,10 @@ config CPU_S3C6410
        help
          Enable S3C6410 CPU support
 
-config S3C64XX_DMA
-       bool "S3C64XX DMA"
-       select S3C_DMA
+config S3C64XX_PL080
+       bool "S3C64XX DMA using generic PL08x driver"
+       select AMBA_PL08X
+       select SAMSUNG_DMADEV
 
 config S3C64XX_SETUP_SDHCI
        bool
index 6faedcffce040d0cfc041c9d3b559ff1be94a207..58069a702a435046ae627bff9ab4e8c689b1aa3c 100644 (file)
@@ -26,7 +26,7 @@ obj-$(CONFIG_CPU_IDLE)                += cpuidle.o
 
 # DMA support
 
-obj-$(CONFIG_S3C64XX_DMA)      += dma.o
+obj-$(CONFIG_S3C64XX_PL080)    += pl080.o
 
 # Device support
 
index bd3bd562011e1515198e924627fd7165f57cb3dd..7043e7a3a67ed868f9e4465d7afae197619dcdc9 100644 (file)
@@ -58,4 +58,9 @@ int __init s3c64xx_pm_late_initcall(void);
 static inline int s3c64xx_pm_late_initcall(void) { return 0; }
 #endif
 
+#ifdef CONFIG_S3C64XX_PL080
+extern struct pl08x_platform_data s3c64xx_dma0_plat_data;
+extern struct pl08x_platform_data s3c64xx_dma1_plat_data;
+#endif
+
 #endif /* __ARCH_ARM_MACH_S3C64XX_COMMON_H */
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
deleted file mode 100644 (file)
index 7e22c21..0000000
+++ /dev/null
@@ -1,762 +0,0 @@
-/* linux/arch/arm/plat-s3c64xx/dma.c
- *
- * Copyright 2009 Openmoko, Inc.
- * Copyright 2009 Simtec Electronics
- *     Ben Dooks <ben@simtec.co.uk>
- *     http://armlinux.simtec.co.uk/
- *
- * S3C64XX DMA core
- *
- * 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.
-*/
-
-/*
- * NOTE: Code in this file is not used when booting with Device Tree support.
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/dmapool.h>
-#include <linux/device.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/io.h>
-#include <linux/amba/pl080.h>
-#include <linux/of.h>
-
-#include <mach/dma.h>
-#include <mach/map.h>
-#include <mach/irqs.h>
-
-#include "regs-sys.h"
-
-/* dma channel state information */
-
-struct s3c64xx_dmac {
-       struct device           dev;
-       struct clk              *clk;
-       void __iomem            *regs;
-       struct s3c2410_dma_chan *channels;
-       enum dma_ch              chanbase;
-};
-
-/* pool to provide LLI buffers */
-static struct dma_pool *dma_pool;
-
-/* Debug configuration and code */
-
-static unsigned char debug_show_buffs = 0;
-
-static void dbg_showchan(struct s3c2410_dma_chan *chan)
-{
-       pr_debug("DMA%d: %08x->%08x L %08x C %08x,%08x S %08x\n",
-                chan->number,
-                readl(chan->regs + PL080_CH_SRC_ADDR),
-                readl(chan->regs + PL080_CH_DST_ADDR),
-                readl(chan->regs + PL080_CH_LLI),
-                readl(chan->regs + PL080_CH_CONTROL),
-                readl(chan->regs + PL080S_CH_CONTROL2),
-                readl(chan->regs + PL080S_CH_CONFIG));
-}
-
-static void show_lli(struct pl080s_lli *lli)
-{
-       pr_debug("LLI[%p] %08x->%08x, NL %08x C %08x,%08x\n",
-                lli, lli->src_addr, lli->dst_addr, lli->next_lli,
-                lli->control0, lli->control1);
-}
-
-static void dbg_showbuffs(struct s3c2410_dma_chan *chan)
-{
-       struct s3c64xx_dma_buff *ptr;
-       struct s3c64xx_dma_buff *end;
-
-       pr_debug("DMA%d: buffs next %p, curr %p, end %p\n",
-                chan->number, chan->next, chan->curr, chan->end);
-
-       ptr = chan->next;
-       end = chan->end;
-
-       if (debug_show_buffs) {
-               for (; ptr != NULL; ptr = ptr->next) {
-                       pr_debug("DMA%d: %08x ",
-                                chan->number, ptr->lli_dma);
-                       show_lli(ptr->lli);
-               }
-       }
-}
-
-/* End of Debug */
-
-static struct s3c2410_dma_chan *s3c64xx_dma_map_channel(unsigned int channel)
-{
-       struct s3c2410_dma_chan *chan;
-       unsigned int start, offs;
-
-       start = 0;
-
-       if (channel >= DMACH_PCM1_TX)
-               start = 8;
-
-       for (offs = 0; offs < 8; offs++) {
-               chan = &s3c2410_chans[start + offs];
-               if (!chan->in_use)
-                       goto found;
-       }
-
-       return NULL;
-
-found:
-       s3c_dma_chan_map[channel] = chan;
-       return chan;
-}
-
-int s3c2410_dma_config(enum dma_ch channel, int xferunit)
-{
-       struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
-
-       if (chan == NULL)
-               return -EINVAL;
-
-       switch (xferunit) {
-       case 1:
-               chan->hw_width = 0;
-               break;
-       case 2:
-               chan->hw_width = 1;
-               break;
-       case 4:
-               chan->hw_width = 2;
-               break;
-       default:
-               printk(KERN_ERR "%s: illegal width %d\n", __func__, xferunit);
-               return -EINVAL;
-       }
-
-       return 0;
-}
-EXPORT_SYMBOL(s3c2410_dma_config);
-
-static void s3c64xx_dma_fill_lli(struct s3c2410_dma_chan *chan,
-                                struct pl080s_lli *lli,
-                                dma_addr_t data, int size)
-{
-       dma_addr_t src, dst;
-       u32 control0, control1;
-
-       switch (chan->source) {
-       case DMA_FROM_DEVICE:
-               src = chan->dev_addr;
-               dst = data;
-               control0 = PL080_CONTROL_SRC_AHB2;
-               control0 |= PL080_CONTROL_DST_INCR;
-               break;
-
-       case DMA_TO_DEVICE:
-               src = data;
-               dst = chan->dev_addr;
-               control0 = PL080_CONTROL_DST_AHB2;
-               control0 |= PL080_CONTROL_SRC_INCR;
-               break;
-       default:
-               BUG();
-       }
-
-       /* note, we do not currently setup any of the burst controls */
-
-       control1 = size >> chan->hw_width;      /* size in no of xfers */
-       control0 |= PL080_CONTROL_PROT_SYS;     /* always in priv. mode */
-       control0 |= PL080_CONTROL_TC_IRQ_EN;    /* always fire IRQ */
-       control0 |= (u32)chan->hw_width << PL080_CONTROL_DWIDTH_SHIFT;
-       control0 |= (u32)chan->hw_width << PL080_CONTROL_SWIDTH_SHIFT;
-
-       lli->src_addr = src;
-       lli->dst_addr = dst;
-       lli->next_lli = 0;
-       lli->control0 = control0;
-       lli->control1 = control1;
-}
-
-static void s3c64xx_lli_to_regs(struct s3c2410_dma_chan *chan,
-                               struct pl080s_lli *lli)
-{
-       void __iomem *regs = chan->regs;
-
-       pr_debug("%s: LLI %p => regs\n", __func__, lli);
-       show_lli(lli);
-
-       writel(lli->src_addr, regs + PL080_CH_SRC_ADDR);
-       writel(lli->dst_addr, regs + PL080_CH_DST_ADDR);
-       writel(lli->next_lli, regs + PL080_CH_LLI);
-       writel(lli->control0, regs + PL080_CH_CONTROL);
-       writel(lli->control1, regs + PL080S_CH_CONTROL2);
-}
-
-static int s3c64xx_dma_start(struct s3c2410_dma_chan *chan)
-{
-       struct s3c64xx_dmac *dmac = chan->dmac;
-       u32 config;
-       u32 bit = chan->bit;
-
-       dbg_showchan(chan);
-
-       pr_debug("%s: clearing interrupts\n", __func__);
-
-       /* clear interrupts */
-       writel(bit, dmac->regs + PL080_TC_CLEAR);
-       writel(bit, dmac->regs + PL080_ERR_CLEAR);
-
-       pr_debug("%s: starting channel\n", __func__);
-
-       config = readl(chan->regs + PL080S_CH_CONFIG);
-       config |= PL080_CONFIG_ENABLE;
-       config &= ~PL080_CONFIG_HALT;
-
-       pr_debug("%s: writing config %08x\n", __func__, config);
-       writel(config, chan->regs + PL080S_CH_CONFIG);
-
-       return 0;
-}
-
-static int s3c64xx_dma_stop(struct s3c2410_dma_chan *chan)
-{
-       u32 config;
-       int timeout;
-
-       pr_debug("%s: stopping channel\n", __func__);
-
-       dbg_showchan(chan);
-
-       config = readl(chan->regs + PL080S_CH_CONFIG);
-       config |= PL080_CONFIG_HALT;
-       writel(config, chan->regs + PL080S_CH_CONFIG);
-
-       timeout = 1000;
-       do {
-               config = readl(chan->regs + PL080S_CH_CONFIG);
-               pr_debug("%s: %d - config %08x\n", __func__, timeout, config);
-               if (config & PL080_CONFIG_ACTIVE)
-                       udelay(10);
-               else
-                       break;
-               } while (--timeout > 0);
-
-       if (config & PL080_CONFIG_ACTIVE) {
-               printk(KERN_ERR "%s: channel still active\n", __func__);
-               return -EFAULT;
-       }
-
-       config = readl(chan->regs + PL080S_CH_CONFIG);
-       config &= ~PL080_CONFIG_ENABLE;
-       writel(config, chan->regs + PL080S_CH_CONFIG);
-
-       return 0;
-}
-
-static inline void s3c64xx_dma_bufffdone(struct s3c2410_dma_chan *chan,
-                                        struct s3c64xx_dma_buff *buf,
-                                        enum s3c2410_dma_buffresult result)
-{
-       if (chan->callback_fn != NULL)
-               (chan->callback_fn)(chan, buf->pw, 0, result);
-}
-
-static void s3c64xx_dma_freebuff(struct s3c64xx_dma_buff *buff)
-{
-       dma_pool_free(dma_pool, buff->lli, buff->lli_dma);
-       kfree(buff);
-}
-
-static int s3c64xx_dma_flush(struct s3c2410_dma_chan *chan)
-{
-       struct s3c64xx_dma_buff *buff, *next;
-       u32 config;
-
-       dbg_showchan(chan);
-
-       pr_debug("%s: flushing channel\n", __func__);
-
-       config = readl(chan->regs + PL080S_CH_CONFIG);
-       config &= ~PL080_CONFIG_ENABLE;
-       writel(config, chan->regs + PL080S_CH_CONFIG);
-
-       /* dump all the buffers associated with this channel */
-
-       for (buff = chan->curr; buff != NULL; buff = next) {
-               next = buff->next;
-               pr_debug("%s: buff %p (next %p)\n", __func__, buff, buff->next);
-
-               s3c64xx_dma_bufffdone(chan, buff, S3C2410_RES_ABORT);
-               s3c64xx_dma_freebuff(buff);
-       }
-
-       chan->curr = chan->next = chan->end = NULL;
-
-       return 0;
-}
-
-int s3c2410_dma_ctrl(enum dma_ch channel, enum s3c2410_chan_op op)
-{
-       struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
-
-       WARN_ON(!chan);
-       if (!chan)
-               return -EINVAL;
-
-       switch (op) {
-       case S3C2410_DMAOP_START:
-               return s3c64xx_dma_start(chan);
-
-       case S3C2410_DMAOP_STOP:
-               return s3c64xx_dma_stop(chan);
-
-       case S3C2410_DMAOP_FLUSH:
-               return s3c64xx_dma_flush(chan);
-
-       /* believe PAUSE/RESUME are no-ops */
-       case S3C2410_DMAOP_PAUSE:
-       case S3C2410_DMAOP_RESUME:
-       case S3C2410_DMAOP_STARTED:
-       case S3C2410_DMAOP_TIMEOUT:
-               return 0;
-       }
-
-       return -ENOENT;
-}
-EXPORT_SYMBOL(s3c2410_dma_ctrl);
-
-/* s3c2410_dma_enque
- *
- */
-
-int s3c2410_dma_enqueue(enum dma_ch channel, void *id,
-                       dma_addr_t data, int size)
-{
-       struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
-       struct s3c64xx_dma_buff *next;
-       struct s3c64xx_dma_buff *buff;
-       struct pl080s_lli *lli;
-       unsigned long flags;
-       int ret;
-
-       WARN_ON(!chan);
-       if (!chan)
-               return -EINVAL;
-
-       buff = kzalloc(sizeof(struct s3c64xx_dma_buff), GFP_ATOMIC);
-       if (!buff) {
-               printk(KERN_ERR "%s: no memory for buffer\n", __func__);
-               return -ENOMEM;
-       }
-
-       lli = dma_pool_alloc(dma_pool, GFP_ATOMIC, &buff->lli_dma);
-       if (!lli) {
-               printk(KERN_ERR "%s: no memory for lli\n", __func__);
-               ret = -ENOMEM;
-               goto err_buff;
-       }
-
-       pr_debug("%s: buff %p, dp %08x lli (%p, %08x) %d\n",
-                __func__, buff, data, lli, (u32)buff->lli_dma, size);
-
-       buff->lli = lli;
-       buff->pw = id;
-
-       s3c64xx_dma_fill_lli(chan, lli, data, size);
-
-       local_irq_save(flags);
-
-       if ((next = chan->next) != NULL) {
-               struct s3c64xx_dma_buff *end = chan->end;
-               struct pl080s_lli *endlli = end->lli;
-
-               pr_debug("enquing onto channel\n");
-
-               end->next = buff;
-               endlli->next_lli = buff->lli_dma;
-
-               if (chan->flags & S3C2410_DMAF_CIRCULAR) {
-                       struct s3c64xx_dma_buff *curr = chan->curr;
-                       lli->next_lli = curr->lli_dma;
-               }
-
-               if (next == chan->curr) {
-                       writel(buff->lli_dma, chan->regs + PL080_CH_LLI);
-                       chan->next = buff;
-               }
-
-               show_lli(endlli);
-               chan->end = buff;
-       } else {
-               pr_debug("enquing onto empty channel\n");
-
-               chan->curr = buff;
-               chan->next = buff;
-               chan->end = buff;
-
-               s3c64xx_lli_to_regs(chan, lli);
-       }
-
-       local_irq_restore(flags);
-
-       show_lli(lli);
-
-       dbg_showchan(chan);
-       dbg_showbuffs(chan);
-       return 0;
-
-err_buff:
-       kfree(buff);
-       return ret;
-}
-
-EXPORT_SYMBOL(s3c2410_dma_enqueue);
-
-
-int s3c2410_dma_devconfig(enum dma_ch channel,
-                         enum dma_data_direction source,
-                         unsigned long devaddr)
-{
-       struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
-       u32 peripheral;
-       u32 config = 0;
-
-       pr_debug("%s: channel %d, source %d, dev %08lx, chan %p\n",
-                __func__, channel, source, devaddr, chan);
-
-       WARN_ON(!chan);
-       if (!chan)
-               return -EINVAL;
-
-       peripheral = (chan->peripheral & 0xf);
-       chan->source = source;
-       chan->dev_addr = devaddr;
-
-       pr_debug("%s: peripheral %d\n", __func__, peripheral);
-
-       switch (source) {
-       case DMA_FROM_DEVICE:
-               config = 2 << PL080_CONFIG_FLOW_CONTROL_SHIFT;
-               config |= peripheral << PL080_CONFIG_SRC_SEL_SHIFT;
-               break;
-       case DMA_TO_DEVICE:
-               config = 1 << PL080_CONFIG_FLOW_CONTROL_SHIFT;
-               config |= peripheral << PL080_CONFIG_DST_SEL_SHIFT;
-               break;
-       default:
-               printk(KERN_ERR "%s: bad source\n", __func__);
-               return -EINVAL;
-       }
-
-       /* allow TC and ERR interrupts */
-       config |= PL080_CONFIG_TC_IRQ_MASK;
-       config |= PL080_CONFIG_ERR_IRQ_MASK;
-
-       pr_debug("%s: config %08x\n", __func__, config);
-
-       writel(config, chan->regs + PL080S_CH_CONFIG);
-
-       return 0;
-}
-EXPORT_SYMBOL(s3c2410_dma_devconfig);
-
-
-int s3c2410_dma_getposition(enum dma_ch channel,
-                           dma_addr_t *src, dma_addr_t *dst)
-{
-       struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
-
-       WARN_ON(!chan);
-       if (!chan)
-               return -EINVAL;
-
-       if (src != NULL)
-               *src = readl(chan->regs + PL080_CH_SRC_ADDR);
-
-       if (dst != NULL)
-               *dst = readl(chan->regs + PL080_CH_DST_ADDR);
-
-       return 0;
-}
-EXPORT_SYMBOL(s3c2410_dma_getposition);
-
-/* s3c2410_request_dma
- *
- * get control of an dma channel
-*/
-
-int s3c2410_dma_request(enum dma_ch channel,
-                       struct s3c2410_dma_client *client,
-                       void *dev)
-{
-       struct s3c2410_dma_chan *chan;
-       unsigned long flags;
-
-       pr_debug("dma%d: s3c2410_request_dma: client=%s, dev=%p\n",
-                channel, client->name, dev);
-
-       local_irq_save(flags);
-
-       chan = s3c64xx_dma_map_channel(channel);
-       if (chan == NULL) {
-               local_irq_restore(flags);
-               return -EBUSY;
-       }
-
-       dbg_showchan(chan);
-
-       chan->client = client;
-       chan->in_use = 1;
-       chan->peripheral = channel;
-       chan->flags = 0;
-
-       local_irq_restore(flags);
-
-       /* need to setup */
-
-       pr_debug("%s: channel initialised, %p\n", __func__, chan);
-
-       return chan->number | DMACH_LOW_LEVEL;
-}
-
-EXPORT_SYMBOL(s3c2410_dma_request);
-
-/* s3c2410_dma_free
- *
- * release the given channel back to the system, will stop and flush
- * any outstanding transfers, and ensure the channel is ready for the
- * next claimant.
- *
- * Note, although a warning is currently printed if the freeing client
- * info is not the same as the registrant's client info, the free is still
- * allowed to go through.
-*/
-
-int s3c2410_dma_free(enum dma_ch channel, struct s3c2410_dma_client *client)
-{
-       struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
-       unsigned long flags;
-
-       if (chan == NULL)
-               return -EINVAL;
-
-       local_irq_save(flags);
-
-       if (chan->client != client) {
-               printk(KERN_WARNING "dma%d: possible free from different client (channel %p, passed %p)\n",
-                      channel, chan->client, client);
-       }
-
-       /* sort out stopping and freeing the channel */
-
-
-       chan->client = NULL;
-       chan->in_use = 0;
-
-       if (!(channel & DMACH_LOW_LEVEL))
-               s3c_dma_chan_map[channel] = NULL;
-
-       local_irq_restore(flags);
-
-       return 0;
-}
-
-EXPORT_SYMBOL(s3c2410_dma_free);
-
-static irqreturn_t s3c64xx_dma_irq(int irq, void *pw)
-{
-       struct s3c64xx_dmac *dmac = pw;
-       struct s3c2410_dma_chan *chan;
-       enum s3c2410_dma_buffresult res;
-       u32 tcstat, errstat;
-       u32 bit;
-       int offs;
-
-       tcstat = readl(dmac->regs + PL080_TC_STATUS);
-       errstat = readl(dmac->regs + PL080_ERR_STATUS);
-
-       for (offs = 0, bit = 1; offs < 8; offs++, bit <<= 1) {
-               struct s3c64xx_dma_buff *buff;
-
-               if (!(errstat & bit) && !(tcstat & bit))
-                       continue;
-
-               chan = dmac->channels + offs;
-               res = S3C2410_RES_ERR;
-
-               if (tcstat & bit) {
-                       writel(bit, dmac->regs + PL080_TC_CLEAR);
-                       res = S3C2410_RES_OK;
-               }
-
-               if (errstat & bit)
-                       writel(bit, dmac->regs + PL080_ERR_CLEAR);
-
-               /* 'next' points to the buffer that is next to the
-                * currently active buffer.
-                * For CIRCULAR queues, 'next' will be same as 'curr'
-                * when 'end' is the active buffer.
-                */
-               buff = chan->curr;
-               while (buff && buff != chan->next
-                               && buff->next != chan->next)
-                       buff = buff->next;
-
-               if (!buff)
-                       BUG();
-
-               if (buff == chan->next)
-                       buff = chan->end;
-
-               s3c64xx_dma_bufffdone(chan, buff, res);
-
-               /* Free the node and update curr, if non-circular queue */
-               if (!(chan->flags & S3C2410_DMAF_CIRCULAR)) {
-                       chan->curr = buff->next;
-                       s3c64xx_dma_freebuff(buff);
-               }
-
-               /* Update 'next' */
-               buff = chan->next;
-               if (chan->next == chan->end) {
-                       chan->next = chan->curr;
-                       if (!(chan->flags & S3C2410_DMAF_CIRCULAR))
-                               chan->end = NULL;
-               } else {
-                       chan->next = buff->next;
-               }
-       }
-
-       return IRQ_HANDLED;
-}
-
-static struct bus_type dma_subsys = {
-       .name           = "s3c64xx-dma",
-       .dev_name       = "s3c64xx-dma",
-};
-
-static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
-                            int irq, unsigned int base)
-{
-       struct s3c2410_dma_chan *chptr = &s3c2410_chans[chno];
-       struct s3c64xx_dmac *dmac;
-       char clkname[16];
-       void __iomem *regs;
-       void __iomem *regptr;
-       int err, ch;
-
-       dmac = kzalloc(sizeof(struct s3c64xx_dmac), GFP_KERNEL);
-       if (!dmac) {
-               printk(KERN_ERR "%s: failed to alloc mem\n", __func__);
-               return -ENOMEM;
-       }
-
-       dmac->dev.id = chno / 8;
-       dmac->dev.bus = &dma_subsys;
-
-       err = device_register(&dmac->dev);
-       if (err) {
-               printk(KERN_ERR "%s: failed to register device\n", __func__);
-               goto err_alloc;
-       }
-
-       regs = ioremap(base, 0x200);
-       if (!regs) {
-               printk(KERN_ERR "%s: failed to ioremap()\n", __func__);
-               err = -ENXIO;
-               goto err_dev;
-       }
-
-       snprintf(clkname, sizeof(clkname), "dma%d", dmac->dev.id);
-
-       dmac->clk = clk_get(NULL, clkname);
-       if (IS_ERR(dmac->clk)) {
-               printk(KERN_ERR "%s: failed to get clock %s\n", __func__, clkname);
-               err = PTR_ERR(dmac->clk);
-               goto err_map;
-       }
-
-       clk_prepare_enable(dmac->clk);
-
-       dmac->regs = regs;
-       dmac->chanbase = chbase;
-       dmac->channels = chptr;
-
-       err = request_irq(irq, s3c64xx_dma_irq, 0, "DMA", dmac);
-       if (err < 0) {
-               printk(KERN_ERR "%s: failed to get irq\n", __func__);
-               goto err_clk;
-       }
-
-       regptr = regs + PL080_Cx_BASE(0);
-
-       for (ch = 0; ch < 8; ch++, chptr++) {
-               pr_debug("%s: registering DMA %d (%p)\n",
-                        __func__, chno + ch, regptr);
-
-               chptr->bit = 1 << ch;
-               chptr->number = chno + ch;
-               chptr->dmac = dmac;
-               chptr->regs = regptr;
-               regptr += PL080_Cx_STRIDE;
-       }
-
-       /* for the moment, permanently enable the controller */
-       writel(PL080_CONFIG_ENABLE, regs + PL080_CONFIG);
-
-       printk(KERN_INFO "PL080: IRQ %d, at %p, channels %d..%d\n",
-              irq, regs, chno, chno+8);
-
-       return 0;
-
-err_clk:
-       clk_disable_unprepare(dmac->clk);
-       clk_put(dmac->clk);
-err_map:
-       iounmap(regs);
-err_dev:
-       device_unregister(&dmac->dev);
-err_alloc:
-       kfree(dmac);
-       return err;
-}
-
-static int __init s3c64xx_dma_init(void)
-{
-       int ret;
-
-       /* This driver is not supported when booting with device tree. */
-       if (of_have_populated_dt())
-               return -ENODEV;
-
-       printk(KERN_INFO "%s: Registering DMA channels\n", __func__);
-
-       dma_pool = dma_pool_create("DMA-LLI", NULL, sizeof(struct pl080s_lli), 16, 0);
-       if (!dma_pool) {
-               printk(KERN_ERR "%s: failed to create pool\n", __func__);
-               return -ENOMEM;
-       }
-
-       ret = subsys_system_register(&dma_subsys, NULL);
-       if (ret) {
-               printk(KERN_ERR "%s: failed to create subsys\n", __func__);
-               return -ENOMEM;
-       }
-
-       /* Set all DMA configuration to be DMA, not SDMA */
-       writel(0xffffff, S3C64XX_SDMA_SEL);
-
-       /* Register standard DMA controllers */
-       s3c64xx_dma_init1(0, DMACH_UART0, IRQ_DMA0, 0x75000000);
-       s3c64xx_dma_init1(8, DMACH_PCM1_TX, IRQ_DMA1, 0x75100000);
-
-       return 0;
-}
-
-arch_initcall(s3c64xx_dma_init);
index fe1a98cf0e4c7cb3a63311efec61f507e9ebf8e2..059b1fc8503727d7c84139ce7c2311cbc1a7ab8a 100644 (file)
 #ifndef __ASM_ARCH_DMA_H
 #define __ASM_ARCH_DMA_H __FILE__
 
-#define S3C_DMA_CHANNELS       (16)
+#define S3C64XX_DMA_CHAN(name)         ((unsigned long)(name))
+
+/* DMA0/SDMA0 */
+#define DMACH_UART0            S3C64XX_DMA_CHAN("uart0_tx")
+#define DMACH_UART0_SRC2       S3C64XX_DMA_CHAN("uart0_rx")
+#define DMACH_UART1            S3C64XX_DMA_CHAN("uart1_tx")
+#define DMACH_UART1_SRC2       S3C64XX_DMA_CHAN("uart1_rx")
+#define DMACH_UART2            S3C64XX_DMA_CHAN("uart2_tx")
+#define DMACH_UART2_SRC2       S3C64XX_DMA_CHAN("uart2_rx")
+#define DMACH_UART3            S3C64XX_DMA_CHAN("uart3_tx")
+#define DMACH_UART3_SRC2       S3C64XX_DMA_CHAN("uart3_rx")
+#define DMACH_PCM0_TX          S3C64XX_DMA_CHAN("pcm0_tx")
+#define DMACH_PCM0_RX          S3C64XX_DMA_CHAN("pcm0_rx")
+#define DMACH_I2S0_OUT         S3C64XX_DMA_CHAN("i2s0_tx")
+#define DMACH_I2S0_IN          S3C64XX_DMA_CHAN("i2s0_rx")
+#define DMACH_SPI0_TX          S3C64XX_DMA_CHAN("spi0_tx")
+#define DMACH_SPI0_RX          S3C64XX_DMA_CHAN("spi0_rx")
+#define DMACH_HSI_I2SV40_TX    S3C64XX_DMA_CHAN("i2s2_tx")
+#define DMACH_HSI_I2SV40_RX    S3C64XX_DMA_CHAN("i2s2_rx")
+
+/* DMA1/SDMA1 */
+#define DMACH_PCM1_TX          S3C64XX_DMA_CHAN("pcm1_tx")
+#define DMACH_PCM1_RX          S3C64XX_DMA_CHAN("pcm1_rx")
+#define DMACH_I2S1_OUT         S3C64XX_DMA_CHAN("i2s1_tx")
+#define DMACH_I2S1_IN          S3C64XX_DMA_CHAN("i2s1_rx")
+#define DMACH_SPI1_TX          S3C64XX_DMA_CHAN("spi1_tx")
+#define DMACH_SPI1_RX          S3C64XX_DMA_CHAN("spi1_rx")
+#define DMACH_AC97_PCMOUT      S3C64XX_DMA_CHAN("ac97_out")
+#define DMACH_AC97_PCMIN       S3C64XX_DMA_CHAN("ac97_in")
+#define DMACH_AC97_MICIN       S3C64XX_DMA_CHAN("ac97_mic")
+#define DMACH_PWM              S3C64XX_DMA_CHAN("pwm")
+#define DMACH_IRDA             S3C64XX_DMA_CHAN("irda")
+#define DMACH_EXTERNAL         S3C64XX_DMA_CHAN("external")
+#define DMACH_SECURITY_RX      S3C64XX_DMA_CHAN("sec_rx")
+#define DMACH_SECURITY_TX      S3C64XX_DMA_CHAN("sec_tx")
 
-/* see mach-s3c2410/dma.h for notes on dma channel numbers */
-
-/* Note, for the S3C64XX architecture we keep the DMACH_
- * defines in the order they are allocated to [S]DMA0/[S]DMA1
- * so that is easy to do DHACH_ -> DMA controller conversion
- */
 enum dma_ch {
-       /* DMA0/SDMA0 */
-       DMACH_UART0 = 0,
-       DMACH_UART0_SRC2,
-       DMACH_UART1,
-       DMACH_UART1_SRC2,
-       DMACH_UART2,
-       DMACH_UART2_SRC2,
-       DMACH_UART3,
-       DMACH_UART3_SRC2,
-       DMACH_PCM0_TX,
-       DMACH_PCM0_RX,
-       DMACH_I2S0_OUT,
-       DMACH_I2S0_IN,
-       DMACH_SPI0_TX,
-       DMACH_SPI0_RX,
-       DMACH_HSI_I2SV40_TX,
-       DMACH_HSI_I2SV40_RX,
+       DMACH_MAX = 32
+};
 
-       /* DMA1/SDMA1 */
-       DMACH_PCM1_TX = 16,
-       DMACH_PCM1_RX,
-       DMACH_I2S1_OUT,
-       DMACH_I2S1_IN,
-       DMACH_SPI1_TX,
-       DMACH_SPI1_RX,
-       DMACH_AC97_PCMOUT,
-       DMACH_AC97_PCMIN,
-       DMACH_AC97_MICIN,
-       DMACH_PWM,
-       DMACH_IRDA,
-       DMACH_EXTERNAL,
-       DMACH_RES1,
-       DMACH_RES2,
-       DMACH_SECURITY_RX,      /* SDMA1 only */
-       DMACH_SECURITY_TX,      /* SDMA1 only */
-       DMACH_MAX               /* the end */
+struct s3c2410_dma_client {
+       char    *name;
 };
 
 static inline bool samsung_dma_has_circular(void)
@@ -65,67 +62,10 @@ static inline bool samsung_dma_has_circular(void)
 
 static inline bool samsung_dma_is_dmadev(void)
 {
-       return false;
+       return true;
 }
-#define S3C2410_DMAF_CIRCULAR          (1 << 0)
-
-#include <plat/dma.h>
-
-#define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */
-
-struct s3c64xx_dma_buff;
-
-/** s3c64xx_dma_buff - S3C64XX DMA buffer descriptor
- * @next: Pointer to next buffer in queue or ring.
- * @pw: Client provided identifier
- * @lli: Pointer to hardware descriptor this buffer is associated with.
- * @lli_dma: Hardare address of the descriptor.
- */
-struct s3c64xx_dma_buff {
-       struct s3c64xx_dma_buff *next;
-
-       void                    *pw;
-       struct pl080s_lli       *lli;
-       dma_addr_t               lli_dma;
-};
-
-struct s3c64xx_dmac;
-
-struct s3c2410_dma_chan {
-       unsigned char            number;      /* number of this dma channel */
-       unsigned char            in_use;      /* channel allocated */
-       unsigned char            bit;         /* bit for enable/disable/etc */
-       unsigned char            hw_width;
-       unsigned char            peripheral;
-
-       unsigned int             flags;
-       enum dma_data_direction  source;
-
-
-       dma_addr_t              dev_addr;
-
-       struct s3c2410_dma_client *client;
-       struct s3c64xx_dmac     *dmac;          /* pointer to controller */
-
-       void __iomem            *regs;
-
-       /* cdriver callbacks */
-       s3c2410_dma_cbfn_t       callback_fn;   /* buffer done callback */
-       s3c2410_dma_opfn_t       op_fn;         /* channel op callback */
-
-       /* buffer list and information */
-       struct s3c64xx_dma_buff *curr;          /* current dma buffer */
-       struct s3c64xx_dma_buff *next;          /* next buffer to load */
-       struct s3c64xx_dma_buff *end;           /* end of queue */
-
-       /* note, when channel is running in circular mode, curr is the
-        * first buffer enqueued, end is the last and curr is where the
-        * last buffer-done event is set-at. The buffers are not freed
-        * and the last buffer hardware descriptor points back to the
-        * first.
-        */
-};
 
-#include <plat/dma-core.h>
+#include <linux/amba/pl08x.h>
+#include <plat/dma-ops.h>
 
 #endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c64xx/pl080.c b/arch/arm/mach-s3c64xx/pl080.c
new file mode 100644 (file)
index 0000000..901a984
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ * Samsung's S3C64XX generic DMA support using amba-pl08x driver.
+ *
+ * Copyright (c) 2013 Tomasz Figa <tomasz.figa@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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/amba/bus.h>
+#include <linux/amba/pl080.h>
+#include <linux/amba/pl08x.h>
+#include <linux/of.h>
+
+#include <mach/irqs.h>
+#include <mach/map.h>
+
+#include "regs-sys.h"
+
+static int pl08x_get_xfer_signal(const struct pl08x_channel_data *cd)
+{
+       return cd->min_signal;
+}
+
+static void pl08x_put_xfer_signal(const struct pl08x_channel_data *cd, int ch)
+{
+}
+
+/*
+ * DMA0
+ */
+
+static struct pl08x_channel_data s3c64xx_dma0_info[] = {
+       {
+               .bus_id = "uart0_tx",
+               .min_signal = 0,
+               .max_signal = 0,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart0_rx",
+               .min_signal = 1,
+               .max_signal = 1,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart1_tx",
+               .min_signal = 2,
+               .max_signal = 2,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart1_rx",
+               .min_signal = 3,
+               .max_signal = 3,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart2_tx",
+               .min_signal = 4,
+               .max_signal = 4,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart2_rx",
+               .min_signal = 5,
+               .max_signal = 5,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart3_tx",
+               .min_signal = 6,
+               .max_signal = 6,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "uart3_rx",
+               .min_signal = 7,
+               .max_signal = 7,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "pcm0_tx",
+               .min_signal = 8,
+               .max_signal = 8,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "pcm0_rx",
+               .min_signal = 9,
+               .max_signal = 9,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s0_tx",
+               .min_signal = 10,
+               .max_signal = 10,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s0_rx",
+               .min_signal = 11,
+               .max_signal = 11,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "spi0_tx",
+               .min_signal = 12,
+               .max_signal = 12,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "spi0_rx",
+               .min_signal = 13,
+               .max_signal = 13,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s2_tx",
+               .min_signal = 14,
+               .max_signal = 14,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s2_rx",
+               .min_signal = 15,
+               .max_signal = 15,
+               .periph_buses = PL08X_AHB2,
+       }
+};
+
+struct pl08x_platform_data s3c64xx_dma0_plat_data = {
+       .memcpy_channel = {
+               .bus_id = "memcpy",
+               .cctl_memcpy =
+                       (PL080_BSIZE_4 << PL080_CONTROL_SB_SIZE_SHIFT |
+                       PL080_BSIZE_4 << PL080_CONTROL_DB_SIZE_SHIFT |
+                       PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT |
+                       PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT |
+                       PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE |
+                       PL080_CONTROL_PROT_SYS),
+       },
+       .lli_buses = PL08X_AHB1,
+       .mem_buses = PL08X_AHB1,
+       .get_xfer_signal = pl08x_get_xfer_signal,
+       .put_xfer_signal = pl08x_put_xfer_signal,
+       .slave_channels = s3c64xx_dma0_info,
+       .num_slave_channels = ARRAY_SIZE(s3c64xx_dma0_info),
+};
+
+static AMBA_AHB_DEVICE(s3c64xx_dma0, "dma-pl080s.0", 0,
+                       0x75000000, {IRQ_DMA0}, &s3c64xx_dma0_plat_data);
+
+/*
+ * DMA1
+ */
+
+static struct pl08x_channel_data s3c64xx_dma1_info[] = {
+       {
+               .bus_id = "pcm1_tx",
+               .min_signal = 0,
+               .max_signal = 0,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "pcm1_rx",
+               .min_signal = 1,
+               .max_signal = 1,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s1_tx",
+               .min_signal = 2,
+               .max_signal = 2,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "i2s1_rx",
+               .min_signal = 3,
+               .max_signal = 3,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "spi1_tx",
+               .min_signal = 4,
+               .max_signal = 4,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "spi1_rx",
+               .min_signal = 5,
+               .max_signal = 5,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "ac97_out",
+               .min_signal = 6,
+               .max_signal = 6,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "ac97_in",
+               .min_signal = 7,
+               .max_signal = 7,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "ac97_mic",
+               .min_signal = 8,
+               .max_signal = 8,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "pwm",
+               .min_signal = 9,
+               .max_signal = 9,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "irda",
+               .min_signal = 10,
+               .max_signal = 10,
+               .periph_buses = PL08X_AHB2,
+       }, {
+               .bus_id = "external",
+               .min_signal = 11,
+               .max_signal = 11,
+               .periph_buses = PL08X_AHB2,
+       },
+};
+
+struct pl08x_platform_data s3c64xx_dma1_plat_data = {
+       .memcpy_channel = {
+               .bus_id = "memcpy",
+               .cctl_memcpy =
+                       (PL080_BSIZE_4 << PL080_CONTROL_SB_SIZE_SHIFT |
+                       PL080_BSIZE_4 << PL080_CONTROL_DB_SIZE_SHIFT |
+                       PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT |
+                       PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT |
+                       PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE |
+                       PL080_CONTROL_PROT_SYS),
+       },
+       .lli_buses = PL08X_AHB1,
+       .mem_buses = PL08X_AHB1,
+       .get_xfer_signal = pl08x_get_xfer_signal,
+       .put_xfer_signal = pl08x_put_xfer_signal,
+       .slave_channels = s3c64xx_dma1_info,
+       .num_slave_channels = ARRAY_SIZE(s3c64xx_dma1_info),
+};
+
+static AMBA_AHB_DEVICE(s3c64xx_dma1, "dma-pl080s.1", 0,
+                       0x75100000, {IRQ_DMA1}, &s3c64xx_dma1_plat_data);
+
+static int __init s3c64xx_pl080_init(void)
+{
+       /* Set all DMA configuration to be DMA, not SDMA */
+       writel(0xffffff, S3C64XX_SDMA_SEL);
+
+       if (of_have_populated_dt())
+               return 0;
+
+       amba_device_register(&s3c64xx_dma0_device, &iomem_resource);
+       amba_device_register(&s3c64xx_dma1_device, &iomem_resource);
+
+       return 0;
+}
+arch_initcall(s3c64xx_pl080_init);
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..bc8108bf4c1789a2516c5d63cfae39478efcafaf 100644 (file)
@@ -1,6 +1,10 @@
+config ARCH_SHMOBILE
+       bool
+
 config ARCH_SHMOBILE_MULTI
        bool "SH-Mobile Series" if ARCH_MULTI_V7
        depends on MMU
+       select ARCH_SHMOBILE
        select CPU_V7
        select GENERIC_CLOCKEVENTS
        select HAVE_ARM_SCU if SMP
@@ -20,8 +24,23 @@ comment "SH-Mobile System Type"
 config ARCH_EMEV2
        bool "Emma Mobile EV2"
 
+config ARCH_R7S72100
+       bool "RZ/A1H (R7S72100)"
+
+config ARCH_R8A7791
+       bool "R-Car M2 (R8A77910)"
+       select RENESAS_IRQC
+
 comment "SH-Mobile 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
@@ -30,7 +49,7 @@ config MACH_KZM9D
 comment "SH-Mobile System Configuration"
 endif
 
-if ARCH_SHMOBILE
+if ARCH_SHMOBILE_LEGACY
 
 comment "SH-Mobile System Type"
 
@@ -97,18 +116,22 @@ config ARCH_R8A7790
 
 config ARCH_R8A7791
        bool "R-Car M2 (R8A77910)"
+       select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
        select CPU_V7
        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 USE_OF
 
 config ARCH_R7S72100
        bool "RZ/A1H (R7S72100)"
+       select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_GIC
        select CPU_V7
        select SH_CLK_CPG
@@ -190,6 +213,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
@@ -231,11 +265,16 @@ config MACH_KOELSCH
        depends on ARCH_R8A7791
        select USE_OF
 
-config MACH_KZM9D
-       bool "KZM9D board"
-       depends on ARCH_EMEV2
-       select REGULATOR_FIXED_VOLTAGE if REGULATOR
+config MACH_KOELSCH_REFERENCE
+       bool "Koelsch board - Reference Device Tree Implementation"
+       depends on ARCH_R8A7791
        select USE_OF
+       ---help---
+          Use reference implementation of Koelsch 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_KZM9G
        bool "KZM-A9-GT board"
@@ -274,7 +313,7 @@ source "drivers/sh/Kconfig"
 
 endif
 
-if ARCH_SHMOBILE || ARCH_SHMOBILE_MULTI
+if ARCH_SHMOBILE
 
 menu "Timer and clock configuration"
 
index 51db2bcafabf028f97cb4ffc5e32def8ef1aad77..1c131046dec634ca92b0f61a99def17cdc7362ca 100644 (file)
@@ -56,6 +56,8 @@ 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
 else
 obj-$(CONFIG_MACH_APE6EVM)     += board-ape6evm.o
@@ -64,6 +66,7 @@ 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
@@ -71,7 +74,7 @@ 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_KOELSCH_REFERENCE)   += board-koelsch-reference.o
 obj-$(CONFIG_MACH_KZM9G)       += board-kzm9g.o
 obj-$(CONFIG_MACH_KZM9G_REFERENCE)     += board-kzm9g-reference.o
 endif
index 391d72a5536ceb473acee7eaf2f0312ef268b6ce..759e4f8fcd37b9b793fb4d8024223ce76d0d77a8 100644 (file)
@@ -6,9 +6,10 @@ 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_KOELSCH_REFERENCE) += 0x40008000
 loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
 loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
 loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
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 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 38611526fe9a55953372afcd2662aa668b34e080..540f0dc2431ad876adec30ebf0189558bb4bfd36 100644 (file)
@@ -116,6 +116,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 +276,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,
@@ -614,6 +618,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 +637,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..a804a17
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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-provider.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
+       of_clk_init(NULL);
+#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-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..6e12914d6d587ade5543e90bdfb7c05459684f77 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/input.h>
 #include <linux/kernel.h>
+#include <linux/leds.h>
+#include <linux/pinctrl/machine.h>
+#include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_device.h>
 #include <mach/common.h>
 #include <mach/r8a7791.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/* 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[] = {
+       /* 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_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));
 }
 
 static const char * const koelsch_boards_compat_dt[] __initconst = {
@@ -41,7 +111,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_add_standard_devices,
+       .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..51a3bcc704e5257db674b39aa8de845d8d9fd853 100644 (file)
 
 #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 */
        r8a7790_clock_init();
-
        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 = {
@@ -42,5 +42,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 a8d3ce646fb900514fa983964bf8d70d0e88c278..ce0ba7df07954704f0ed9b93193ded22e8146eab 100644 (file)
 #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 +125,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"),
@@ -148,7 +154,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 +171,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",
@@ -222,6 +281,12 @@ 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));
 }
 
 /*
@@ -245,7 +310,9 @@ static void __init lager_init(void)
 {
        lager_add_standard_devices();
 
-       phy_register_fixup_for_id("r8a7790-ether-ff:01", lager_ksz8041_fixup);
+       if (IS_ENABLED(CONFIG_PHYLIB))
+               phy_register_fixup_for_id("r8a7790-ether-ff:01",
+                                         lager_ksz8041_fixup);
 }
 
 static const char * const lager_boards_compat_dt[] __initconst = {
@@ -258,5 +325,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 af06753eb8092500de41707ac68216bd3ed244a0..d90d2f11071b9bb13aab3b2a611a545d16e38578 100644 (file)
@@ -548,9 +548,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;
        }
 
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..7b457aed8253c96ce208de8d6575bca12af3012a 100644 (file)
@@ -170,6 +170,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]),
@@ -178,6 +181,7 @@ static struct clk_lookup lookups[] = {
        CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP42]),
        CLKDEV_ICK_ID("sci_fck", "sh-sci.6", &mstp_clks[MSTP41]),
        CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]),
+       CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]),
 };
 
 void __init r7s72100_clock_init(void)
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..6bfc8799708ec454eacd3193542f9f84c75baf2c 100644 (file)
@@ -589,18 +589,18 @@ static struct clk_lookup lookups[] = {
        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..4b601bf4ede4de3d8395bc1515321f0e733c23fb 100644 (file)
@@ -173,9 +173,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 +187,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 +203,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]),
index 1f7080fab0a53556a4ce5efb3cbf3368dce71465..b7ce0e7d7d14acdeb310dd5bc834919c70e1c405 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 */
@@ -197,9 +201,13 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
        CLKDEV_DEV_ID("sh-hspi.2", &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..7960dc020e6a17c32863e0416c8b9a84dc4aac7a 100644 (file)
@@ -77,7 +77,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,
 };
 
@@ -183,9 +183,11 @@ static struct clk div6_clks[DIV6_NR] = {
 /* MSTP */
 enum {
        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 +196,11 @@ 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 */
+       [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 +211,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 +266,6 @@ 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("sh-sci.0", &mstp_clks[MSTP204]),
        CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
        CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]),
@@ -282,20 +281,32 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP929]),
        CLKDEV_DEV_ID("e6540000.i2c", &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]),
+
 };
 
 #define R8A7790_CLOCK_ROOT(e, m, p0, p1, p30, p31)             \
@@ -321,10 +332,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..ff2d60d55bd5310ed6e6e286a396392d176058f0 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,14 @@ static struct clk *main_clks[] = {
        &rclk_clk,
        &mp_clk,
        &cp_clk,
+       &zx_clk,
 };
 
 /* MSTP */
 enum {
-       MSTP721, MSTP720,
+       MSTP726, MSTP724, MSTP723, MSTP721, MSTP720,
        MSTP719, MSTP718, MSTP715, MSTP714,
+       MSTP522,
        MSTP216, MSTP207, MSTP206,
        MSTP204, MSTP203, MSTP202, MSTP1105, MSTP1106, MSTP1107,
        MSTP124,
@@ -129,12 +132,16 @@ enum {
 };
 
 static struct clk mstp_clks[MSTP_NR] = {
+       [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 +171,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 +190,8 @@ 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]),
 };
 
 #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..30d88689a9601af8eed53add75583db590c7342f 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 */
@@ -663,13 +657,13 @@ static struct clk_lookup lookups[] = {
        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 +674,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 17af34ed89c801553b248f12f0d3c39336553854..5014145f272e22a1247c34f54b1039369ee4bc50 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 {
@@ -40,9 +38,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..55f0b9c7c482c04c7b1631b6b3c482e0ffcb957d 100644 (file)
@@ -22,6 +22,7 @@
 #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>
@@ -58,6 +59,26 @@ static inline void r7s72100_register_scif(int idx)
                                      sizeof(struct plat_sci_port));
 }
 
+
+static struct sh_timer_config mtu2_0_platform_data __initdata = {
+       .name = "MTU2_0",
+       .timer_bit = 0,
+       .channel_offset = -0x80,
+       .clockevent_rating = 200,
+};
+
+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);
@@ -68,6 +89,7 @@ void __init r7s72100_add_dt_devices(void)
        r7s72100_register_scif(SCIF5);
        r7s72100_register_scif(SCIF6);
        r7s72100_register_scif(SCIF7);
+       r7s72100_register_mtu2(0);
 }
 
 void __init r7s72100_init_early(void)
index b0f2749071bec3feee42e44a82c52449a8494e81..cc94b64c2ef50a0795ab7bb2a6435599d4320ea7 100644 (file)
@@ -275,7 +275,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 13049e9d691ca17d7be5d5d3dc9b8b565b42a3e3..8f9453152fb91f9760185466cf666c23c8eb1052 100644 (file)
@@ -598,45 +598,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 +786,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..3543c3bacb75d828cd9681f9e5b93740822a9467 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),              \
@@ -65,8 +69,7 @@ R8A7790_GPIO(5);
 
 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);
index d9393d61ee27028fb59efe284cc7d9d69db132d6..cddca99b434f051ebdbf9e2ffe27d9a6482a2cc1 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>
 
+static const struct resource pfc_resources[] __initconst = {
+       DEFINE_RES_MEM(0xe6060000, 0x250),
+};
+
+#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 SCIF_COMMON(scif_type, baseaddr, irq)                  \
        .type           = scif_type,                            \
        .mapbase        = baseaddr,                             \
@@ -136,6 +189,17 @@ 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);
@@ -160,6 +224,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 22de17417fd7c83a4ae4c9b66162cd3c16f1cb04..65151c48cbd4fdc1ee431abf4ce264358d4ad69b 100644 (file)
@@ -273,7 +273,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 +298,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 +316,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 +325,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 +334,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 +343,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 +352,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 +722,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 9a4e910c3796154c8fa6c167851a8f6b112265f3..2adc2ab081e2436b06a5c5d4389b0daf42ec4fc9 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 73368176c6e8592ecc5f2f0155d5598885692fd3..ea14d380fc0cd51beb66d8ef049999d7bb563420 100644 (file)
  * 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)
index 9a5f9fb352ce1c7ca97baa3e4269ef54770e2faa..9724e4e7cc93ffa6232833bbb0c1f6ebdc1fbdf2 100644 (file)
@@ -341,7 +341,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 +379,7 @@ 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);
+       sched_clock_register(u300_read_sched_clock, 32, rate);
 
        u300_delay_timer.read_current_timer = &u300_read_current_timer;
        u300_delay_timer.freq = rate;
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 154e15f59702c1010af74cce8fed51077c78e111..dc7f9015776641abde6e91adc8c9c93fe0c042a2 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 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..d8f5ce430fa723db4b528274dc0010fb20c903ce 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,9 +170,6 @@ 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),
        {},
 };
 
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 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 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 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 f6b6bfa88ecff21ddde5646dfaafa0190792f247..6492154934f9be988dd39ebdad08743da1f42cda 100644 (file)
@@ -185,7 +185,7 @@ static u64 get_coherent_dma_mask(struct device *dev)
                 */
                if (sizeof(mask) != sizeof(dma_addr_t) &&
                    mask > (dma_addr_t)~0 &&
-                   dma_to_pfn(dev, ~0) > max_dma_pfn) {
+                   dma_to_pfn(dev, ~0) < max_dma_pfn) {
                        dev_warn(dev, "Coherent DMA mask %#llx is larger than dma_addr_t allows\n",
                                 mask);
                        dev_warn(dev, "Driver did not use or check the return value from dma_set_coherent_mask()?\n");
@@ -366,7 +366,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;
@@ -614,7 +614,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);
 }
 
@@ -1041,7 +1041,7 @@ int dma_supported(struct device *dev, u64 mask)
         */
        if (sizeof(mask) != sizeof(dma_addr_t) &&
            mask > (dma_addr_t)~0 &&
-           dma_to_pfn(dev, ~0) > arm_dma_pfn_limit)
+           dma_to_pfn(dev, ~0) < min(max_pfn, arm_dma_pfn_limit))
                return 0;
 
        /*
@@ -1362,7 +1362,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..4e76d9b
--- /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_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_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_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 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 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 99a3590f034949cc45bc99df724857e096888e51..ac07e871f6a781594ffae471516527e7ea090941 100644 (file)
@@ -1468,6 +1468,8 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
        pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
 #if defined(CONFIG_PL330_DMA)
        pd.filter = pl330_filter;
+#elif defined(CONFIG_S3C64XX_PL080)
+       pd.filter = pl08x_filter_id;
 #elif defined(CONFIG_S3C24XX_DMAC)
        pd.filter = s3c24xx_dma_filter;
 #endif
@@ -1509,8 +1511,10 @@ void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
        pd.num_cs = num_cs;
        pd.src_clk_nr = src_clk_nr;
        pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio;
-#ifdef CONFIG_PL330_DMA
+#if defined(CONFIG_PL330_DMA)
        pd.filter = pl330_filter;
+#elif defined(CONFIG_S3C64XX_PL080)
+       pd.filter = pl08x_filter_id;
 #endif
 
        s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1);
@@ -1550,8 +1554,10 @@ void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
        pd.num_cs = num_cs;
        pd.src_clk_nr = src_clk_nr;
        pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio;
-#ifdef CONFIG_PL330_DMA
+#if defined(CONFIG_PL330_DMA)
        pd.filter = pl330_filter;
+#elif defined(CONFIG_S3C64XX_PL080)
+       pd.filter = pl08x_filter_id;
 #endif
 
        s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2);
index ec0d731b0e7b88ed8bc7b2937528545c15f60f6e..886326ee6f6c373c36d16fddef48b9ce58d5f7c9 100644 (file)
 
 #include <mach/dma.h>
 
+#if defined(CONFIG_PL330_DMA)
+#define dma_filter pl330_filter
+#elif defined(CONFIG_S3C64XX_PL080)
+#define dma_filter pl08x_filter_id
+#endif
+
 static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
                                struct samsung_dma_req *param,
                                struct device *dev, char *ch_name)
@@ -30,7 +36,7 @@ static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
        if (dev->of_node)
                return (unsigned)dma_request_slave_channel(dev, ch_name);
        else
-               return (unsigned)dma_request_channel(mask, pl330_filter,
+               return (unsigned)dma_request_channel(mask, dma_filter,
                                                        (void *)dma_ch);
 }
 
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 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 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 88c8b6c1341a445bdc425955383a8563033edd90..6d4dd22ee4b7bc70622f3fe95538bcba0ff6b99e 100644 (file)
@@ -159,8 +159,7 @@ config NR_CPUS
        range 2 32
        depends on SMP
        # These have to remain sorted largest to smallest
-       default "8" if ARCH_XGENE
-       default "4"
+       default "8"
 
 config HOTPLUG_CPU
        bool "Support for hot-pluggable CPUs"
index 4cc813eddacbebee4c84f864f103bb6492d7c193..57276972722768b86f5c21d0cdd50481e1a48683 100644 (file)
@@ -229,7 +229,7 @@ extern void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot
 extern void __iounmap(volatile void __iomem *addr);
 extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
 
-#define PROT_DEFAULT           (PTE_TYPE_PAGE | PTE_AF | PTE_DIRTY)
+#define PROT_DEFAULT           (pgprot_default | PTE_DIRTY)
 #define PROT_DEVICE_nGnRE      (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRE))
 #define PROT_NORMAL_NC         (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL_NC))
 #define PROT_NORMAL            (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
index 755f86143320167038e24e9be093e61b8b307e65..b1d2e26c3c883e7259f0ab679efe33ffe2935429 100644 (file)
@@ -43,7 +43,7 @@
  * Section
  */
 #define PMD_SECT_VALID         (_AT(pmdval_t, 1) << 0)
-#define PMD_SECT_PROT_NONE     (_AT(pmdval_t, 1) << 2)
+#define PMD_SECT_PROT_NONE     (_AT(pmdval_t, 1) << 58)
 #define PMD_SECT_USER          (_AT(pmdval_t, 1) << 6)         /* AP[1] */
 #define PMD_SECT_RDONLY                (_AT(pmdval_t, 1) << 7)         /* AP[2] */
 #define PMD_SECT_S             (_AT(pmdval_t, 3) << 8)
index 7009387348b7c416f9dc8732a18c7563eac4af4e..c68cca5c3523221421e93460805a3c4d9cbac5a4 100644 (file)
@@ -282,8 +282,9 @@ ENDPROC(secondary_holding_pen)
         * be used where CPUs are brought online dynamically by the kernel.
         */
 ENTRY(secondary_entry)
-       bl      __calc_phys_offset              // x2=phys offset
        bl      el2_setup                       // Drop to EL1
+       bl      __calc_phys_offset              // x24=PHYS_OFFSET, x28=PHYS_OFFSET-PAGE_OFFSET
+       bl      set_cpu_boot_mode_flag
        b       secondary_startup
 ENDPROC(secondary_entry)
 
index 421b99fd635dfae60c36d4c45837d73ca71a7187..0f7fec52c7f84030afb9958cdd4627bb2ceb9546 100644 (file)
@@ -111,12 +111,12 @@ ENTRY(__cpu_setup)
        bl      __flush_dcache_all
        mov     lr, x28
        ic      iallu                           // I+BTB cache invalidate
+       tlbi    vmalle1is                       // invalidate I + D TLBs
        dsb     sy
 
        mov     x0, #3 << 20
        msr     cpacr_el1, x0                   // Enable FP/ASIMD
        msr     mdscr_el1, xzr                  // Reset mdscr_el1
-       tlbi    vmalle1is                       // invalidate I + D TLBs
        /*
         * Memory region attributes for LPAE:
         *
index 09c5a0f5f4d1778156a5ee83715e6a2aec7f0441..86648c083bb4b1297275dc2bc4ceb3ecd949aa5b 100644 (file)
@@ -12,6 +12,7 @@
 #define _ASM_C6X_CACHE_H
 
 #include <linux/irqflags.h>
+#include <linux/init.h>
 
 /*
  * Cache line size
index 916ffe770bcf5691c0e2b6744a40f0d45c81d487..84715fcbba0875ed7e689ec761c2e4a2184477bd 100644 (file)
@@ -23,8 +23,7 @@
  */
 
 #include <linux/module.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <asm/sal.h>
 
 MODULE_AUTHOR("Bjorn Helgaas <bjorn.helgaas@hp.com>");
index 75f25a8e300170ce85130da8fd2f739faa983059..dbdd2231c75ddc9fab61fd1b2dca7c1cc60a3e3e 100644 (file)
@@ -87,6 +87,30 @@ config MMU_SUN3
        bool
        depends on MMU && !MMU_MOTOROLA && !MMU_COLDFIRE
 
+config KEXEC
+       bool "kexec system call"
+       depends on M68KCLASSIC
+       help
+         kexec is a system call that implements the ability to shutdown your
+         current kernel, and to start another kernel.  It is like a reboot
+         but it is independent of the system firmware.   And like a reboot
+         you can start any kernel with it, not just Linux.
+
+         The name comes from the similarity to the exec system call.
+
+         It is an ongoing process to be certain the hardware in a machine
+         is properly shutdown, so do not be surprised if this code does not
+         initially work for you.  As of this writing the exact hardware
+         interface is strongly in flux, so no good recommendation can be
+         made.
+
+config BOOTINFO_PROC
+       bool "Export bootinfo in procfs"
+       depends on KEXEC && M68KCLASSIC
+       help
+         Say Y to export the bootinfo used to boot the kernel in a
+         "bootinfo" file in procfs.  This is useful with kexec.
+
 menu "Platform setup"
 
 source arch/m68k/Kconfig.cpu
index 99449fbf9a726834ec2b2c268956a13f0ab0b99d..ba03cec3f711e024422fe916a407b4cf56556f76 100644 (file)
@@ -87,7 +87,7 @@ void *amiga_chip_alloc_res(unsigned long size, struct resource *res)
 
        atomic_sub(size, &chipavail);
        pr_debug("amiga_chip_alloc_res: returning %pR\n", res);
-       return (void *)ZTWO_VADDR(res->start);
+       return ZTWO_VADDR(res->start);
 }
 
 void amiga_chip_free(void *ptr)
index b819390e29cdb7e901e926a9190b30ebadb8916c..9625b71322275ea942da3bc1b3a6616e205bdc7a 100644 (file)
@@ -28,6 +28,8 @@
 #include <linux/keyboard.h>
 
 #include <asm/bootinfo.h>
+#include <asm/bootinfo-amiga.h>
+#include <asm/byteorder.h>
 #include <asm/setup.h>
 #include <asm/pgtable.h>
 #include <asm/amigahw.h>
@@ -140,46 +142,46 @@ static struct resource ram_resource[NUM_MEMINFO];
      *  Parse an Amiga-specific record in the bootinfo
      */
 
-int amiga_parse_bootinfo(const struct bi_record *record)
+int __init amiga_parse_bootinfo(const struct bi_record *record)
 {
        int unknown = 0;
-       const unsigned long *data = record->data;
+       const void *data = record->data;
 
-       switch (record->tag) {
+       switch (be16_to_cpu(record->tag)) {
        case BI_AMIGA_MODEL:
-               amiga_model = *data;
+               amiga_model = be32_to_cpup(data);
                break;
 
        case BI_AMIGA_ECLOCK:
-               amiga_eclock = *data;
+               amiga_eclock = be32_to_cpup(data);
                break;
 
        case BI_AMIGA_CHIPSET:
-               amiga_chipset = *data;
+               amiga_chipset = be32_to_cpup(data);
                break;
 
        case BI_AMIGA_CHIP_SIZE:
-               amiga_chip_size = *(const int *)data;
+               amiga_chip_size = be32_to_cpup(data);
                break;
 
        case BI_AMIGA_VBLANK:
-               amiga_vblank = *(const unsigned char *)data;
+               amiga_vblank = *(const __u8 *)data;
                break;
 
        case BI_AMIGA_PSFREQ:
-               amiga_psfreq = *(const unsigned char *)data;
+               amiga_psfreq = *(const __u8 *)data;
                break;
 
        case BI_AMIGA_AUTOCON:
 #ifdef CONFIG_ZORRO
                if (zorro_num_autocon < ZORRO_NUM_AUTO) {
-                       const struct ConfigDev *cd = (struct ConfigDev *)data;
-                       struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
+                       const struct ConfigDev *cd = data;
+                       struct zorro_dev_init *dev = &zorro_autocon_init[zorro_num_autocon++];
                        dev->rom = cd->cd_Rom;
-                       dev->slotaddr = cd->cd_SlotAddr;
-                       dev->slotsize = cd->cd_SlotSize;
-                       dev->resource.start = (unsigned long)cd->cd_BoardAddr;
-                       dev->resource.end = dev->resource.start + cd->cd_BoardSize - 1;
+                       dev->slotaddr = be16_to_cpu(cd->cd_SlotAddr);
+                       dev->slotsize = be16_to_cpu(cd->cd_SlotSize);
+                       dev->boardaddr = be32_to_cpu(cd->cd_BoardAddr);
+                       dev->boardsize = be32_to_cpu(cd->cd_BoardSize);
                } else
                        printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
 #endif /* CONFIG_ZORRO */
@@ -358,6 +360,14 @@ static void __init amiga_identify(void)
 #undef AMIGAHW_ANNOUNCE
 }
 
+
+static unsigned long amiga_random_get_entropy(void)
+{
+       /* VPOSR/VHPOSR provide at least 17 bits of data changing at 1.79 MHz */
+       return *(unsigned long *)&amiga_custom.vposr;
+}
+
+
     /*
      *  Setup the Amiga configuration info
      */
@@ -395,6 +405,8 @@ void __init config_amiga(void)
        mach_heartbeat = amiga_heartbeat;
 #endif
 
+       mach_random_get_entropy = amiga_random_get_entropy;
+
        /* Fill in the clock value (based on the 700 kHz E-Clock) */
        amiga_colorclock = 5*amiga_eclock;      /* 3.5 MHz */
 
@@ -608,6 +620,8 @@ static void amiga_mem_console_write(struct console *co, const char *s,
 
 static int __init amiga_savekmsg_setup(char *arg)
 {
+       bool registered;
+
        if (!MACH_IS_AMIGA || strcmp(arg, "mem"))
                return 0;
 
@@ -618,14 +632,16 @@ static int __init amiga_savekmsg_setup(char *arg)
 
        /* Just steal the block, the chipram allocator isn't functional yet */
        amiga_chip_size -= SAVEKMSG_MAXMEM;
-       savekmsg = (void *)ZTWO_VADDR(CHIP_PHYSADDR + amiga_chip_size);
+       savekmsg = ZTWO_VADDR(CHIP_PHYSADDR + amiga_chip_size);
        savekmsg->magic1 = SAVEKMSG_MAGIC1;
        savekmsg->magic2 = SAVEKMSG_MAGIC2;
        savekmsg->magicptr = ZTWO_PADDR(savekmsg);
        savekmsg->size = 0;
 
+       registered = !!amiga_console_driver.write;
        amiga_console_driver.write = amiga_mem_console_write;
-       register_console(&amiga_console_driver);
+       if (!registered)
+               register_console(&amiga_console_driver);
        return 0;
 }
 
@@ -707,11 +723,16 @@ void amiga_serial_gets(struct console *co, char *s, int len)
 
 static int __init amiga_debug_setup(char *arg)
 {
-       if (MACH_IS_AMIGA && !strcmp(arg, "ser")) {
-               /* no initialization required (?) */
-               amiga_console_driver.write = amiga_serial_console_write;
+       bool registered;
+
+       if (!MACH_IS_AMIGA || strcmp(arg, "ser"))
+               return 0;
+
+       /* no initialization required (?) */
+       registered = !!amiga_console_driver.write;
+       amiga_console_driver.write = amiga_serial_console_write;
+       if (!registered)
                register_console(&amiga_console_driver);
-       }
        return 0;
 }
 
index dacd9f911f7171f847fc0087faf20a34092f0e1c..d34029d7b05892a5c0d2e646129a89407402b368 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <asm/amigahw.h>
 #include <asm/amigayle.h>
+#include <asm/byteorder.h>
 
 
 #ifdef CONFIG_ZORRO
@@ -66,10 +67,12 @@ static int __init z_dev_present(zorro_id id)
 {
        unsigned int i;
 
-       for (i = 0; i < zorro_num_autocon; i++)
-               if (zorro_autocon[i].rom.er_Manufacturer == ZORRO_MANUF(id) &&
-                   zorro_autocon[i].rom.er_Product == ZORRO_PROD(id))
+       for (i = 0; i < zorro_num_autocon; i++) {
+               const struct ExpansionRom *rom = &zorro_autocon_init[i].rom;
+               if (be16_to_cpu(rom->er_Manufacturer) == ZORRO_MANUF(id) &&
+                   rom->er_Product == ZORRO_PROD(id))
                        return 1;
+       }
 
        return 0;
 }
index 3ea56b90e7188df2c758bce798fc46c2d96df461..9268c0f96376b30eee39caba6d023d3fd0488cab 100644 (file)
@@ -1,3 +1,4 @@
+#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
@@ -9,6 +10,8 @@
 
 #include <asm/setup.h>
 #include <asm/bootinfo.h>
+#include <asm/bootinfo-apollo.h>
+#include <asm/byteorder.h>
 #include <asm/pgtable.h>
 #include <asm/apollohw.h>
 #include <asm/irq.h>
@@ -43,26 +46,25 @@ static const char *apollo_models[] = {
        [APOLLO_DN4500-APOLLO_DN3000] = "DN4500 (Roadrunner)"
 };
 
-int apollo_parse_bootinfo(const struct bi_record *record) {
-
+int __init apollo_parse_bootinfo(const struct bi_record *record)
+{
        int unknown = 0;
-       const unsigned long *data = record->data;
+       const void *data = record->data;
 
-       switch(record->tag) {
-               case BI_APOLLO_MODEL:
-                       apollo_model=*data;
-                       break;
+       switch (be16_to_cpu(record->tag)) {
+       case BI_APOLLO_MODEL:
+               apollo_model = be32_to_cpup(data);
+               break;
 
-               default:
-                        unknown=1;
+       default:
+                unknown=1;
        }
 
        return unknown;
 }
 
-void dn_setup_model(void) {
-
-
+static void __init dn_setup_model(void)
+{
        printk("Apollo hardware found: ");
        printk("[%s]\n", apollo_models[apollo_model - APOLLO_DN3000]);
 
index fb2d0bd9b3adab5304dc160a3bcf192aa0568a53..01a62161b08a1a69a74635de7004e4e65c73bf20 100644 (file)
@@ -37,6 +37,8 @@
 #include <linux/module.h>
 
 #include <asm/bootinfo.h>
+#include <asm/bootinfo-atari.h>
+#include <asm/byteorder.h>
 #include <asm/setup.h>
 #include <asm/atarihw.h>
 #include <asm/atariints.h>
@@ -129,14 +131,14 @@ static int __init scc_test(volatile char *ctla)
 int __init atari_parse_bootinfo(const struct bi_record *record)
 {
        int unknown = 0;
-       const u_long *data = record->data;
+       const void *data = record->data;
 
-       switch (record->tag) {
+       switch (be16_to_cpu(record->tag)) {
        case BI_ATARI_MCH_COOKIE:
-               atari_mch_cookie = *data;
+               atari_mch_cookie = be32_to_cpup(data);
                break;
        case BI_ATARI_MCH_TYPE:
-               atari_mch_type = *data;
+               atari_mch_type = be32_to_cpup(data);
                break;
        default:
                unknown = 1;
index a547ba9683d14a551c9d4a18632d3c3a5d7a1bed..03cb5e08d7cf9f4995a8e24c613e48c03c11b6f1 100644 (file)
@@ -287,6 +287,8 @@ static void __init atari_init_midi_port(int cflag)
 
 static int __init atari_debug_setup(char *arg)
 {
+       bool registered;
+
        if (!MACH_IS_ATARI)
                return 0;
 
@@ -294,6 +296,7 @@ static int __init atari_debug_setup(char *arg)
                /* defaults to ser2 for a Falcon and ser1 otherwise */
                arg = MACH_IS_FALCON ? "ser2" : "ser1";
 
+       registered = !!atari_console_driver.write;
        if (!strcmp(arg, "ser1")) {
                /* ST-MFP Modem1 serial port */
                atari_init_mfp_port(B9600|CS8);
@@ -317,7 +320,7 @@ static int __init atari_debug_setup(char *arg)
                sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */
                atari_console_driver.write = atari_par_console_write;
        }
-       if (atari_console_driver.write)
+       if (atari_console_driver.write && !registered)
                register_console(&atari_console_driver);
 
        return 0;
index 8943aa4c18e63cd3b0719b3a8d9f50e6bec40671..478623dbb2092b357a1f355d382ad3cc272f8e95 100644 (file)
@@ -28,6 +28,8 @@
 #include <linux/bcd.h>
 
 #include <asm/bootinfo.h>
+#include <asm/bootinfo-vme.h>
+#include <asm/byteorder.h>
 #include <asm/pgtable.h>
 #include <asm/setup.h>
 #include <asm/irq.h>
@@ -50,9 +52,9 @@ void bvme6000_set_vectors (void);
 static irq_handler_t tick_handler;
 
 
-int bvme6000_parse_bootinfo(const struct bi_record *bi)
+int __init bvme6000_parse_bootinfo(const struct bi_record *bi)
 {
-       if (bi->tag == BI_VME_TYPE)
+       if (be16_to_cpu(bi->tag) == BI_VME_TYPE)
                return 0;
        else
                return 1;
index 19325e117eeaaec7b844e1e50d328719077e3261..1f87c0789b12c23fed962c6b0b69bf903884f229 100644 (file)
@@ -345,10 +345,6 @@ CONFIG_HEARTBEAT=y
 CONFIG_PROC_HARDWARE=y
 CONFIG_AMIGA_BUILTIN_SERIAL=y
 CONFIG_SERIAL_CONSOLE=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -385,7 +381,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index 14dc6ccda7f45349c82c0dd1f0d113831b3ac07b..ea5b647943641c8ae80094888c4af5b925596cec 100644 (file)
@@ -302,10 +302,6 @@ CONFIG_RTC_DRV_GENERIC=m
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_HEARTBEAT=y
 CONFIG_PROC_HARDWARE=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -342,7 +338,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index 6d5370c914b265123b6963df409ca3b82d17f8cf..0c3d280187f2ce5fd5ef3e7a8c95ec723a2fb32b 100644 (file)
@@ -320,10 +320,6 @@ CONFIG_NFBLOCK=y
 CONFIG_NFCON=y
 CONFIG_NFETH=y
 CONFIG_ATARI_DSP56K=m
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -360,7 +356,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index c015ddb6fd80635c81affec06369ced3f62185f8..9b6b515c5a23312e5344ffe2277616324db12725 100644 (file)
@@ -294,10 +294,6 @@ CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_GENERIC=m
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_PROC_HARDWARE=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -334,7 +330,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index ec7382d8afff5390a4210a45ba348637605c4f59..efffa687135f47341fcb795166c2eb1050a605f9 100644 (file)
@@ -304,10 +304,6 @@ CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_GENERIC=m
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_PROC_HARDWARE=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -344,7 +340,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index c1616824e201f0e8e53605226dae70cf4feb692a..e7292f460af45665ac7cdbef46c02a56f4b07921 100644 (file)
@@ -40,7 +40,6 @@ CONFIG_INET=y
 # CONFIG_IPV6 is not set
 # CONFIG_FW_LOADER is not set
 CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
 CONFIG_MTD_CHAR=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_RAM=y
index a6599e42facfb8cefb1062f7be679366a4ef5210..0cd4b39f325b6c609a385f31de4cf4c76db2a957 100644 (file)
@@ -38,7 +38,6 @@ CONFIG_INET=y
 # CONFIG_IPV6 is not set
 # CONFIG_FW_LOADER is not set
 CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
 CONFIG_MTD_CHAR=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_RAM=y
index 3fa60a57a0f9a19eab0872db442251c87f65f606..a60cb35091352d20399c39fbfe1cd863b072a5b8 100644 (file)
@@ -36,7 +36,6 @@ CONFIG_INET=y
 # CONFIG_IPV6 is not set
 # CONFIG_FW_LOADER is not set
 CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
 CONFIG_MTD_CHAR=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_RAM=y
index a1230e82bb1e5226c3d61968b1c625bbf40c6a17..e6502ab7cb2fee0ac7b2bd7a1089e41450f05780 100644 (file)
@@ -39,7 +39,6 @@ CONFIG_INET=y
 # CONFIG_IPV6 is not set
 # CONFIG_FW_LOADER is not set
 CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
 CONFIG_MTD_CHAR=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_RAM=y
index 43795f41f7c7b1da1267c8c5bef183cde4e97257..023812abd2e6c6d701015dd99f70693dd1eb7251 100644 (file)
@@ -38,7 +38,6 @@ CONFIG_INET=y
 # CONFIG_IPV6 is not set
 # CONFIG_FW_LOADER is not set
 CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
 CONFIG_MTD_CHAR=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_RAM=y
index 72746c57a571312b47b4b2989bd05d08ffa9180c..557b39f3be9094e223fb8715cae927c0c5ba1cd3 100644 (file)
@@ -38,7 +38,6 @@ CONFIG_INET=y
 # CONFIG_IPV6 is not set
 # CONFIG_FW_LOADER is not set
 CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
 CONFIG_MTD_CHAR=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_RAM=y
index 7d46fbec70424dc84fbe07a9ab1e77c7d1f2bec2..73a8565746dcd490abe13619ea87d66b28661b99 100644 (file)
@@ -327,10 +327,6 @@ CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_GENERIC=m
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_PROC_HARDWARE=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -367,7 +363,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index b17a8837f0e1016b273e5f74c6f75803a1e372b8..19c7939f700fa7b7cccc8e2547dbacefa7dbb315 100644 (file)
@@ -405,10 +405,6 @@ CONFIG_NFETH=y
 CONFIG_ATARI_DSP56K=m
 CONFIG_AMIGA_BUILTIN_SERIAL=y
 CONFIG_SERIAL_CONSOLE=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -445,7 +441,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index 5586c6529fce367fb22061b87c708b9ba10a1f61..81fab00de63a6c4912f24fabcff1eb49ba0e6903 100644 (file)
@@ -294,10 +294,6 @@ CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_GENERIC=m
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_PROC_HARDWARE=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -334,7 +330,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index e5e8262bbacdd0a94c4f0b1e0e89c06166ddd8ec..df0783770611d83e85022775a25bb84c62881143 100644 (file)
@@ -294,10 +294,6 @@ CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_GENERIC=m
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_PROC_HARDWARE=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -334,7 +330,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index be1496ed9b66028655205c48a36b69a365ed203b..f64c8963fa5dd0d8e939b3fa58467b5fba6116e6 100644 (file)
@@ -318,10 +318,6 @@ CONFIG_RTC_DRV_GENERIC=m
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_HEARTBEAT=y
 CONFIG_PROC_HARDWARE=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -358,7 +354,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index 54674d61e00141069e1fb5113e22e19784fc5c01..99bcc60f82a30c30a7431aeed7fb536318006cca 100644 (file)
@@ -296,10 +296,6 @@ CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_GENERIC=m
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_PROC_HARDWARE=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -336,7 +332,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index 832d9539f44194faff9d4e6940223f1d938850fc..2023a91500f380e45a63d1cc00d303330381dce3 100644 (file)
@@ -296,10 +296,6 @@ CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_GENERIC=m
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_PROC_HARDWARE=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS_XATTR is not set
 CONFIG_EXT4_FS=y
 CONFIG_REISERFS_FS=m
 CONFIG_JFS_FS=m
@@ -336,7 +332,7 @@ CONFIG_QNX6FS_FS=m
 CONFIG_SYSV_FS=m
 CONFIG_UFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
+CONFIG_NFS_V4=m
 CONFIG_NFS_SWAP=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
index 121a6660ad4e5c40db157c25385507f4f51a674f..71b78ecee75c64773921bb9aed81aefbf24dae73 100644 (file)
@@ -9,6 +9,7 @@
  * the GNU General Public License (GPL), incorporated herein by reference.
  */
 
+#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/console.h>
 #include <linux/string.h>
@@ -70,7 +71,7 @@ static void nf_poweroff(void)
                nf_call(id);
 }
 
-void nf_init(void)
+void __init nf_init(void)
 {
        unsigned long id, version;
        char buf[256];
index b7609f791522a45f12170799cdae4f89bc8ab80f..2e5a787ea11b8f987ef3994292c7d57832bfc266 100644 (file)
@@ -14,6 +14,8 @@
 #include <linux/console.h>
 
 #include <asm/bootinfo.h>
+#include <asm/bootinfo-hp300.h>
+#include <asm/byteorder.h>
 #include <asm/machdep.h>
 #include <asm/blinken.h>
 #include <asm/io.h>                               /* readb() and writeb() */
@@ -70,15 +72,15 @@ extern int hp300_setup_serial_console(void) __init;
 int __init hp300_parse_bootinfo(const struct bi_record *record)
 {
        int unknown = 0;
-       const unsigned long *data = record->data;
+       const void *data = record->data;
 
-       switch (record->tag) {
+       switch (be16_to_cpu(record->tag)) {
        case BI_HP300_MODEL:
-               hp300_model = *data;
+               hp300_model = be32_to_cpup(data);
                break;
 
        case BI_HP300_UART_SCODE:
-               hp300_uart_scode = *data;
+               hp300_uart_scode = be32_to_cpup(data);
                break;
 
        case BI_HP300_UART_ADDR:
index 7a19b5686a4a69255f94c96aab86c382d461e482..5ad568110f1728701bab85c80c783910740cb069 100644 (file)
 
 #include <linux/ioport.h>
 
-    /*
-     *  Different Amiga models
-     */
-
-#define AMI_UNKNOWN    (0)
-#define AMI_500                (1)
-#define AMI_500PLUS    (2)
-#define AMI_600                (3)
-#define AMI_1000       (4)
-#define AMI_1200       (5)
-#define AMI_2000       (6)
-#define AMI_2500       (7)
-#define AMI_3000       (8)
-#define AMI_3000T      (9)
-#define AMI_3000PLUS   (10)
-#define AMI_4000       (11)
-#define AMI_4000T      (12)
-#define AMI_CDTV       (13)
-#define AMI_CD32       (14)
-#define AMI_DRACO      (15)
+#include <asm/bootinfo-amiga.h>
 
 
     /*
 
 extern unsigned long amiga_chipset;
 
-#define CS_STONEAGE    (0)
-#define CS_OCS         (1)
-#define CS_ECS         (2)
-#define CS_AGA         (3)
-
 
     /*
      *  Miscellaneous
@@ -266,7 +242,7 @@ struct CIA {
 
 #define zTwoBase (0x80000000)
 #define ZTWO_PADDR(x) (((unsigned long)(x))-zTwoBase)
-#define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase)
+#define ZTWO_VADDR(x) ((void __iomem *)(((unsigned long)(x))+zTwoBase))
 
 #define CUSTOM_PHYSADDR     (0xdff000)
 #define amiga_custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR)))
index 6c19e0c22411a2bd4f7b76c2daf228e462f1eb27..87fc899d32eeba4fa057d52ce172e25fa8bb0664 100644 (file)
@@ -5,18 +5,11 @@
 
 #include <linux/types.h>
 
-/*
-   apollo models
-*/
+#include <asm/bootinfo-apollo.h>
+
 
 extern u_long apollo_model;
 
-#define APOLLO_UNKNOWN (0)
-#define APOLLO_DN3000 (1)
-#define APOLLO_DN3010 (2)
-#define APOLLO_DN3500 (3)
-#define APOLLO_DN4000 (4)
-#define APOLLO_DN4500 (5)
 
 /*
    see scn2681 data sheet for more info.
index d887050e6da6438516f0884c78ed9eb9889e2eda..972c8f33f05532c5bb6576471ca0ff4466f8b81d 100644 (file)
@@ -21,7 +21,7 @@
 #define _LINUX_ATARIHW_H_
 
 #include <linux/types.h>
-#include <asm/bootinfo.h>
+#include <asm/bootinfo-atari.h>
 #include <asm/raw_io.h>
 
 extern u_long atari_mch_cookie;
index 67e7a78ad96be0c0a6c069fc2dbb399729f20eba..8e213267f8e7165054c35f9d81dab22481467fa4 100644 (file)
 ** This file is subject to the terms and conditions of the GNU General Public
 ** License.  See the file COPYING in the main directory of this archive
 ** for more details.
-**
-** Created 09/29/92 by Greg Harp
-**
-** 5/2/94 Roman Hodek:
-**   Added bi_atari part of the machine dependent union bi_un; for now it
-**   contains just a model field to distinguish between TT and Falcon.
-** 26/7/96 Roman Zippel:
-**   Renamed to setup.h; added some useful macros to allow gcc some
-**   optimizations if possible.
-** 5/10/96 Geert Uytterhoeven:
-**   Redesign of the boot information structure; renamed to bootinfo.h again
-** 27/11/96 Geert Uytterhoeven:
-**   Backwards compatibility with bootinfo interface version 1.0
 */
 
 #ifndef _M68K_BOOTINFO_H
 #define _M68K_BOOTINFO_H
 
+#include <uapi/asm/bootinfo.h>
 
-    /*
-     *  Bootinfo definitions
-     *
-     *  This is an easily parsable and extendable structure containing all
-     *  information to be passed from the bootstrap to the kernel.
-     *
-     *  This way I hope to keep all future changes back/forewards compatible.
-     *  Thus, keep your fingers crossed...
-     *
-     *  This structure is copied right after the kernel bss by the bootstrap
-     *  routine.
-     */
 
 #ifndef __ASSEMBLY__
 
-struct bi_record {
-    unsigned short tag;                        /* tag ID */
-    unsigned short size;               /* size of record (in bytes) */
-    unsigned long data[0];             /* data */
-};
-
-#endif /* __ASSEMBLY__ */
-
-
-    /*
-     *  Tag Definitions
-     *
-     *  Machine independent tags start counting from 0x0000
-     *  Machine dependent tags start counting from 0x8000
-     */
-
-#define BI_LAST                        0x0000  /* last record (sentinel) */
-#define BI_MACHTYPE            0x0001  /* machine type (u_long) */
-#define BI_CPUTYPE             0x0002  /* cpu type (u_long) */
-#define BI_FPUTYPE             0x0003  /* fpu type (u_long) */
-#define BI_MMUTYPE             0x0004  /* mmu type (u_long) */
-#define BI_MEMCHUNK            0x0005  /* memory chunk address and size */
-                                       /* (struct mem_info) */
-#define BI_RAMDISK             0x0006  /* ramdisk address and size */
-                                       /* (struct mem_info) */
-#define BI_COMMAND_LINE                0x0007  /* kernel command line parameters */
-                                       /* (string) */
-
-    /*
-     *  Amiga-specific tags
-     */
-
-#define BI_AMIGA_MODEL         0x8000  /* model (u_long) */
-#define BI_AMIGA_AUTOCON       0x8001  /* AutoConfig device */
-                                       /* (struct ConfigDev) */
-#define BI_AMIGA_CHIP_SIZE     0x8002  /* size of Chip RAM (u_long) */
-#define BI_AMIGA_VBLANK                0x8003  /* VBLANK frequency (u_char) */
-#define BI_AMIGA_PSFREQ                0x8004  /* power supply frequency (u_char) */
-#define BI_AMIGA_ECLOCK                0x8005  /* EClock frequency (u_long) */
-#define BI_AMIGA_CHIPSET       0x8006  /* native chipset present (u_long) */
-#define BI_AMIGA_SERPER                0x8007  /* serial port period (u_short) */
-
-    /*
-     *  Atari-specific tags
-     */
-
-#define BI_ATARI_MCH_COOKIE    0x8000  /* _MCH cookie from TOS (u_long) */
-#define BI_ATARI_MCH_TYPE      0x8001  /* special machine type (u_long) */
-                                       /* (values are ATARI_MACH_* defines */
-
-/* mch_cookie values (upper word) */
-#define ATARI_MCH_ST           0
-#define ATARI_MCH_STE          1
-#define ATARI_MCH_TT           2
-#define ATARI_MCH_FALCON       3
-
-/* mch_type values */
-#define ATARI_MACH_NORMAL      0       /* no special machine type */
-#define ATARI_MACH_MEDUSA      1       /* Medusa 040 */
-#define ATARI_MACH_HADES       2       /* Hades 040 or 060 */
-#define ATARI_MACH_AB40                3       /* Afterburner040 on Falcon */
-
-    /*
-     *  VME-specific tags
-     */
-
-#define BI_VME_TYPE            0x8000  /* VME sub-architecture (u_long) */
-#define BI_VME_BRDINFO         0x8001  /* VME board information (struct) */
-
-/* BI_VME_TYPE codes */
-#define        VME_TYPE_TP34V          0x0034  /* Tadpole TP34V */
-#define VME_TYPE_MVME147       0x0147  /* Motorola MVME147 */
-#define VME_TYPE_MVME162       0x0162  /* Motorola MVME162 */
-#define VME_TYPE_MVME166       0x0166  /* Motorola MVME166 */
-#define VME_TYPE_MVME167       0x0167  /* Motorola MVME167 */
-#define VME_TYPE_MVME172       0x0172  /* Motorola MVME172 */
-#define VME_TYPE_MVME177       0x0177  /* Motorola MVME177 */
-#define VME_TYPE_BVME4000      0x4000  /* BVM Ltd. BVME4000 */
-#define VME_TYPE_BVME6000      0x6000  /* BVM Ltd. BVME6000 */
-
-/* BI_VME_BRDINFO is a 32 byte struct as returned by the Bug code on
- * Motorola VME boards.  Contains board number, Bug version, board
- * configuration options, etc.  See include/asm/mvme16xhw.h for details.
- */
-
-
-    /*
-     *  Macintosh-specific tags (all u_long)
-     */
-
-#define BI_MAC_MODEL           0x8000  /* Mac Gestalt ID (model type) */
-#define BI_MAC_VADDR           0x8001  /* Mac video base address */
-#define BI_MAC_VDEPTH          0x8002  /* Mac video depth */
-#define BI_MAC_VROW            0x8003  /* Mac video rowbytes */
-#define BI_MAC_VDIM            0x8004  /* Mac video dimensions */
-#define BI_MAC_VLOGICAL                0x8005  /* Mac video logical base */
-#define BI_MAC_SCCBASE         0x8006  /* Mac SCC base address */
-#define BI_MAC_BTIME           0x8007  /* Mac boot time */
-#define BI_MAC_GMTBIAS         0x8008  /* Mac GMT timezone offset */
-#define BI_MAC_MEMSIZE         0x8009  /* Mac RAM size (sanity check) */
-#define BI_MAC_CPUID           0x800a  /* Mac CPU type (sanity check) */
-#define BI_MAC_ROMBASE         0x800b  /* Mac system ROM base address */
-
-    /*
-     *  Macintosh hardware profile data - unused, see macintosh.h for
-     *  reasonable type values
-     */
-
-#define BI_MAC_VIA1BASE                0x8010  /* Mac VIA1 base address (always present) */
-#define BI_MAC_VIA2BASE                0x8011  /* Mac VIA2 base address (type varies) */
-#define BI_MAC_VIA2TYPE                0x8012  /* Mac VIA2 type (VIA, RBV, OSS) */
-#define BI_MAC_ADBTYPE         0x8013  /* Mac ADB interface type */
-#define BI_MAC_ASCBASE         0x8014  /* Mac Apple Sound Chip base address */
-#define BI_MAC_SCSI5380                0x8015  /* Mac NCR 5380 SCSI (base address, multi) */
-#define BI_MAC_SCSIDMA         0x8016  /* Mac SCSI DMA (base address) */
-#define BI_MAC_SCSI5396                0x8017  /* Mac NCR 53C96 SCSI (base address, multi) */
-#define BI_MAC_IDETYPE         0x8018  /* Mac IDE interface type */
-#define BI_MAC_IDEBASE         0x8019  /* Mac IDE interface base address */
-#define BI_MAC_NUBUS           0x801a  /* Mac Nubus type (none, regular, pseudo) */
-#define BI_MAC_SLOTMASK                0x801b  /* Mac Nubus slots present */
-#define BI_MAC_SCCTYPE         0x801c  /* Mac SCC serial type (normal, IOP) */
-#define BI_MAC_ETHTYPE         0x801d  /* Mac builtin ethernet type (Sonic, MACE */
-#define BI_MAC_ETHBASE         0x801e  /* Mac builtin ethernet base address */
-#define BI_MAC_PMU             0x801f  /* Mac power management / poweroff hardware */
-#define BI_MAC_IOP_SWIM                0x8020  /* Mac SWIM floppy IOP */
-#define BI_MAC_IOP_ADB         0x8021  /* Mac ADB IOP */
-
-    /*
-     * Mac: compatibility with old booter data format (temporarily)
-     * Fields unused with the new bootinfo can be deleted now; instead of
-     * adding new fields the struct might be splitted into a hardware address
-     * part and a hardware type part
-     */
-
-#ifndef __ASSEMBLY__
-
-struct mac_booter_data
-{
-       unsigned long videoaddr;
-       unsigned long videorow;
-       unsigned long videodepth;
-       unsigned long dimensions;
-       unsigned long args;
-       unsigned long boottime;
-       unsigned long gmtbias;
-       unsigned long bootver;
-       unsigned long videological;
-       unsigned long sccbase;
-       unsigned long id;
-       unsigned long memsize;
-       unsigned long serialmf;
-       unsigned long serialhsk;
-       unsigned long serialgpi;
-       unsigned long printmf;
-       unsigned long printhsk;
-       unsigned long printgpi;
-       unsigned long cpuid;
-       unsigned long rombase;
-       unsigned long adbdelay;
-       unsigned long timedbra;
-};
-
-extern struct mac_booter_data
-       mac_bi_data;
-
+#ifdef CONFIG_BOOTINFO_PROC
+extern void save_bootinfo(const struct bi_record *bi);
+#else
+static inline void save_bootinfo(const struct bi_record *bi) {}
 #endif
 
-    /*
-     *  Apollo-specific tags
-     */
-
-#define BI_APOLLO_MODEL         0x8000  /* model (u_long) */
-
-    /*
-     *  HP300-specific tags
-     */
-
-#define BI_HP300_MODEL         0x8000  /* model (u_long) */
-#define BI_HP300_UART_SCODE    0x8001  /* UART select code (u_long) */
-#define BI_HP300_UART_ADDR     0x8002  /* phys. addr of UART (u_long) */
-
-    /*
-     * Stuff for bootinfo interface versioning
-     *
-     * At the start of kernel code, a 'struct bootversion' is located.
-     * bootstrap checks for a matching version of the interface before booting
-     * a kernel, to avoid user confusion if kernel and bootstrap don't work
-     * together :-)
-     *
-     * If incompatible changes are made to the bootinfo interface, the major
-     * number below should be stepped (and the minor reset to 0) for the
-     * appropriate machine. If a change is backward-compatible, the minor
-     * should be stepped. "Backwards-compatible" means that booting will work,
-     * but certain features may not.
-     */
-
-#define BOOTINFOV_MAGIC                        0x4249561A      /* 'BIV^Z' */
-#define MK_BI_VERSION(major,minor)     (((major)<<16)+(minor))
-#define BI_VERSION_MAJOR(v)            (((v) >> 16) & 0xffff)
-#define BI_VERSION_MINOR(v)            ((v) & 0xffff)
-
-#ifndef __ASSEMBLY__
-
-struct bootversion {
-    unsigned short branch;
-    unsigned long magic;
-    struct {
-       unsigned long machtype;
-       unsigned long version;
-    } machversions[0];
-};
-
 #endif /* __ASSEMBLY__ */
 
-#define AMIGA_BOOTI_VERSION    MK_BI_VERSION( 2, 0 )
-#define ATARI_BOOTI_VERSION    MK_BI_VERSION( 2, 1 )
-#define MAC_BOOTI_VERSION      MK_BI_VERSION( 2, 0 )
-#define MVME147_BOOTI_VERSION  MK_BI_VERSION( 2, 0 )
-#define MVME16x_BOOTI_VERSION  MK_BI_VERSION( 2, 0 )
-#define BVME6000_BOOTI_VERSION MK_BI_VERSION( 2, 0 )
-#define Q40_BOOTI_VERSION      MK_BI_VERSION( 2, 0 )
-#define HP300_BOOTI_VERSION    MK_BI_VERSION( 2, 0 )
-
-#ifdef BOOTINFO_COMPAT_1_0
-
-    /*
-     *  Backwards compatibility with bootinfo interface version 1.0
-     */
-
-#define COMPAT_AMIGA_BOOTI_VERSION    MK_BI_VERSION( 1, 0 )
-#define COMPAT_ATARI_BOOTI_VERSION    MK_BI_VERSION( 1, 0 )
-#define COMPAT_MAC_BOOTI_VERSION      MK_BI_VERSION( 1, 0 )
-
-#include <linux/zorro.h>
-
-#define COMPAT_NUM_AUTO    16
-
-struct compat_bi_Amiga {
-    int model;
-    int num_autocon;
-    struct ConfigDev autocon[COMPAT_NUM_AUTO];
-    unsigned long chip_size;
-    unsigned char vblank;
-    unsigned char psfreq;
-    unsigned long eclock;
-    unsigned long chipset;
-    unsigned long hw_present;
-};
-
-struct compat_bi_Atari {
-    unsigned long hw_present;
-    unsigned long mch_cookie;
-};
-
-#ifndef __ASSEMBLY__
-
-struct compat_bi_Macintosh
-{
-       unsigned long videoaddr;
-       unsigned long videorow;
-       unsigned long videodepth;
-       unsigned long dimensions;
-       unsigned long args;
-       unsigned long boottime;
-       unsigned long gmtbias;
-       unsigned long bootver;
-       unsigned long videological;
-       unsigned long sccbase;
-       unsigned long id;
-       unsigned long memsize;
-       unsigned long serialmf;
-       unsigned long serialhsk;
-       unsigned long serialgpi;
-       unsigned long printmf;
-       unsigned long printhsk;
-       unsigned long printgpi;
-       unsigned long cpuid;
-       unsigned long rombase;
-       unsigned long adbdelay;
-       unsigned long timedbra;
-};
-
-#endif
-
-struct compat_mem_info {
-    unsigned long addr;
-    unsigned long size;
-};
-
-#define COMPAT_NUM_MEMINFO  4
-
-#define COMPAT_CPUB_68020 0
-#define COMPAT_CPUB_68030 1
-#define COMPAT_CPUB_68040 2
-#define COMPAT_CPUB_68060 3
-#define COMPAT_FPUB_68881 5
-#define COMPAT_FPUB_68882 6
-#define COMPAT_FPUB_68040 7
-#define COMPAT_FPUB_68060 8
-
-#define COMPAT_CPU_68020    (1<<COMPAT_CPUB_68020)
-#define COMPAT_CPU_68030    (1<<COMPAT_CPUB_68030)
-#define COMPAT_CPU_68040    (1<<COMPAT_CPUB_68040)
-#define COMPAT_CPU_68060    (1<<COMPAT_CPUB_68060)
-#define COMPAT_CPU_MASK     (31)
-#define COMPAT_FPU_68881    (1<<COMPAT_FPUB_68881)
-#define COMPAT_FPU_68882    (1<<COMPAT_FPUB_68882)
-#define COMPAT_FPU_68040    (1<<COMPAT_FPUB_68040)
-#define COMPAT_FPU_68060    (1<<COMPAT_FPUB_68060)
-#define COMPAT_FPU_MASK     (0xfe0)
-
-#define COMPAT_CL_SIZE      (256)
-
-struct compat_bootinfo {
-    unsigned long machtype;
-    unsigned long cputype;
-    struct compat_mem_info memory[COMPAT_NUM_MEMINFO];
-    int num_memory;
-    unsigned long ramdisk_size;
-    unsigned long ramdisk_addr;
-    char command_line[COMPAT_CL_SIZE];
-    union {
-       struct compat_bi_Amiga     bi_ami;
-       struct compat_bi_Atari     bi_ata;
-       struct compat_bi_Macintosh bi_mac;
-    } bi_un;
-};
-
-#define bi_amiga       bi_un.bi_ami
-#define bi_atari       bi_un.bi_ata
-#define bi_mac         bi_un.bi_mac
-
-#endif /* BOOTINFO_COMPAT_1_0 */
-
 
 #endif /* _M68K_BOOTINFO_H */
index d998ea67c19c34d8fd1c005629bffecb9771d7cb..64f5271dd7be2ec70f4503af410a7af48362dfad 100644 (file)
@@ -1,25 +1,9 @@
 #ifndef _M68K_HP300HW_H
 #define _M68K_HP300HW_H
 
-extern unsigned long hp300_model;
+#include <asm/bootinfo-hp300.h>
 
-/* This information was taken from NetBSD */
-#define        HP_320          (0)     /* 16MHz 68020+HP MMU+16K external cache */
-#define        HP_330          (1)     /* 16MHz 68020+68851 MMU */
-#define        HP_340          (2)     /* 16MHz 68030 */
-#define        HP_345          (3)     /* 50MHz 68030+32K external cache */
-#define        HP_350          (4)     /* 25MHz 68020+HP MMU+32K external cache */
-#define        HP_360          (5)     /* 25MHz 68030 */
-#define        HP_370          (6)     /* 33MHz 68030+64K external cache */
-#define        HP_375          (7)     /* 50MHz 68030+32K external cache */
-#define        HP_380          (8)     /* 25MHz 68040 */
-#define        HP_385          (9)     /* 33MHz 68040 */
 
-#define        HP_400          (10)    /* 50MHz 68030+32K external cache */
-#define        HP_425T         (11)    /* 25MHz 68040 - model 425t */
-#define        HP_425S         (12)    /* 25MHz 68040 - model 425s */
-#define HP_425E                (13)    /* 25MHz 68040 - model 425e */
-#define HP_433T                (14)    /* 33MHz 68040 - model 433t */
-#define HP_433S                (15)    /* 33MHz 68040 - model 433s */
+extern unsigned long hp300_model;
 
 #endif /* _M68K_HP300HW_H */
diff --git a/arch/m68k/include/asm/kexec.h b/arch/m68k/include/asm/kexec.h
new file mode 100644 (file)
index 0000000..3df97ab
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef _ASM_M68K_KEXEC_H
+#define _ASM_M68K_KEXEC_H
+
+#ifdef CONFIG_KEXEC
+
+/* Maximum physical address we can use pages from */
+#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
+/* Maximum address we can reach in physical address mode */
+#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
+/* Maximum address we can use for the control code buffer */
+#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
+
+#define KEXEC_CONTROL_PAGE_SIZE        4096
+
+#define KEXEC_ARCH KEXEC_ARCH_68K
+
+#ifndef __ASSEMBLY__
+
+static inline void crash_setup_regs(struct pt_regs *newregs,
+                                   struct pt_regs *oldregs)
+{
+       /* Dummy implementation for now */
+}
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* CONFIG_KEXEC */
+
+#endif /* _ASM_M68K_KEXEC_H */
index 682a1a2ff55f931ceeeac2f812d5254a75d1810b..d323b2c2d07d4e9a574da7e7f97d7a21bca08b6f 100644 (file)
@@ -4,6 +4,9 @@
 #include <linux/seq_file.h>
 #include <linux/interrupt.h>
 
+#include <asm/bootinfo-mac.h>
+
+
 /*
  *     Apple Macintoshisms
  */
@@ -74,65 +77,29 @@ struct mac_model
 #define MAC_FLOPPY_SWIM_IOP    3
 #define MAC_FLOPPY_AV          4
 
-/*
- *     Gestalt numbers
- */
+extern struct mac_model *macintosh_config;
 
-#define MAC_MODEL_II           6
-#define MAC_MODEL_IIX          7
-#define MAC_MODEL_IICX         8
-#define MAC_MODEL_SE30         9
-#define MAC_MODEL_IICI         11
-#define MAC_MODEL_IIFX         13      /* And well numbered it is too */
-#define MAC_MODEL_IISI         18
-#define MAC_MODEL_LC           19
-#define MAC_MODEL_Q900         20
-#define MAC_MODEL_PB170                21
-#define MAC_MODEL_Q700         22
-#define MAC_MODEL_CLII         23      /* aka: P200 */
-#define MAC_MODEL_PB140                25
-#define MAC_MODEL_Q950         26      /* aka: WGS95 */
-#define MAC_MODEL_LCIII                27      /* aka: P450 */
-#define MAC_MODEL_PB210                29
-#define MAC_MODEL_C650         30
-#define MAC_MODEL_PB230                32
-#define MAC_MODEL_PB180                33
-#define MAC_MODEL_PB160                34
-#define MAC_MODEL_Q800         35      /* aka: WGS80 */
-#define MAC_MODEL_Q650         36
-#define MAC_MODEL_LCII         37      /* aka: P400/405/410/430 */
-#define MAC_MODEL_PB250                38
-#define MAC_MODEL_IIVI         44
-#define MAC_MODEL_P600         45      /* aka: P600CD */
-#define MAC_MODEL_IIVX         48
-#define MAC_MODEL_CCL          49      /* aka: P250 */
-#define MAC_MODEL_PB165C       50
-#define MAC_MODEL_C610         52      /* aka: WGS60 */
-#define MAC_MODEL_Q610         53
-#define MAC_MODEL_PB145                54      /* aka: PB145B */
-#define MAC_MODEL_P520         56      /* aka: LC520 */
-#define MAC_MODEL_C660         60
-#define MAC_MODEL_P460         62      /* aka: LCIII+, P466/P467 */
-#define MAC_MODEL_PB180C       71
-#define MAC_MODEL_PB520                72      /* aka: PB520C, PB540, PB540C, PB550C */
-#define MAC_MODEL_PB270C       77
-#define MAC_MODEL_Q840         78
-#define MAC_MODEL_P550         80      /* aka: LC550, P560 */
-#define MAC_MODEL_CCLII                83      /* aka: P275 */
-#define MAC_MODEL_PB165                84
-#define MAC_MODEL_PB190                85      /* aka: PB190CS */
-#define MAC_MODEL_TV           88
-#define MAC_MODEL_P475         89      /* aka: LC475, P476 */
-#define MAC_MODEL_P475F                90      /* aka: P475 w/ FPU (no LC040) */
-#define MAC_MODEL_P575         92      /* aka: LC575, P577/P578 */
-#define MAC_MODEL_Q605         94
-#define MAC_MODEL_Q605_ACC     95      /* Q605 accelerated to 33 MHz */
-#define MAC_MODEL_Q630         98      /* aka: LC630, P630/631/635/636/637/638/640 */
-#define MAC_MODEL_P588         99      /* aka: LC580, P580 */
-#define MAC_MODEL_PB280                102
-#define MAC_MODEL_PB280C       103
-#define MAC_MODEL_PB150                115
 
-extern struct mac_model *macintosh_config;
+    /*
+     * Internal representation of the Mac hardware, filled in from bootinfo
+     */
+
+struct mac_booter_data
+{
+       unsigned long videoaddr;
+       unsigned long videorow;
+       unsigned long videodepth;
+       unsigned long dimensions;
+       unsigned long boottime;
+       unsigned long gmtbias;
+       unsigned long videological;
+       unsigned long sccbase;
+       unsigned long id;
+       unsigned long memsize;
+       unsigned long cpuid;
+       unsigned long rombase;
+};
+
+extern struct mac_booter_data mac_bi_data;
 
 #endif
index 9f70a01f73dc9960e00817963aceb75b5e89db24..05b43bf5cdf3909f7ea23b2da4ed4dbb6d9dd9bb 100644 (file)
 
 #include <asm/atarihw.h>
 
-#define RTC_PORT(x)    (TT_RTC_BAS + 2*(x))
+#define ATARI_RTC_PORT(x)      (TT_RTC_BAS + 2*(x))
 #define RTC_ALWAYS_BCD 0
 
 #define CMOS_READ(addr) ({ \
-atari_outb_p((addr),RTC_PORT(0)); \
-atari_inb_p(RTC_PORT(1)); \
+atari_outb_p((addr), ATARI_RTC_PORT(0)); \
+atari_inb_p(ATARI_RTC_PORT(1)); \
 })
 #define CMOS_WRITE(val, addr) ({ \
-atari_outb_p((addr),RTC_PORT(0)); \
-atari_outb_p((val),RTC_PORT(1)); \
+atari_outb_p((addr), ATARI_RTC_PORT(0)); \
+atari_outb_p((val), ATARI_RTC_PORT(1)); \
 })
 #endif /* CONFIG_ATARI */
 
index 6117f56653d28d3c14bcbee597a552b18cf6cecd..1eb89de631e5c09d1be76d0c043d2e467906b9a6 100644 (file)
@@ -3,23 +3,6 @@
 
 #include <asm/irq.h>
 
-/* Board ID data structure - pointer to this retrieved from Bug by head.S */
-
-/* Note, bytes 12 and 13 are board no in BCD (0162,0166,0167,0177,etc) */
-
-extern long mvme_bdid_ptr;
-
-typedef struct {
-       char    bdid[4];
-       u_char  rev, mth, day, yr;
-       u_short size, reserved;
-       u_short brdno;
-       char brdsuffix[2];
-       u_long  options;
-       u_short clun, dlun, ctype, dnum;
-       u_long  option2;
-} t_bdid, *p_bdid;
-
 
 typedef struct {
        u_char  ack_icr,
index 65e78a2dad64a9840fdb96bdc898e8b848f52331..8f2023f8c1c45727a6904d0567fb070e9f8b7364 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _M68K_SETUP_H
 #define _M68K_SETUP_H
 
+#include <uapi/asm/bootinfo.h>
 #include <uapi/asm/setup.h>
 
 
@@ -297,14 +298,14 @@ extern int m68k_is040or060;
 #define NUM_MEMINFO    4
 
 #ifndef __ASSEMBLY__
-struct mem_info {
+struct m68k_mem_info {
        unsigned long addr;             /* physical address of memory chunk */
        unsigned long size;             /* length of memory chunk (in bytes) */
 };
 
 extern int m68k_num_memory;            /* # of memory blocks found (and used) */
 extern int m68k_realnum_memory;                /* real # of memory blocks found */
-extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
+extern struct m68k_mem_info m68k_memory[NUM_MEMINFO];/* memory description */
 #endif
 
 #endif /* _M68K_SETUP_H */
index 6759dad954f61d9a3d40800f63cf95179c8129aa..efc1f48923573d4731806326b1e72395775fde3d 100644 (file)
@@ -28,4 +28,14 @@ static inline cycles_t get_cycles(void)
        return 0;
 }
 
+extern unsigned long (*mach_random_get_entropy)(void);
+
+static inline unsigned long random_get_entropy(void)
+{
+       if (mach_random_get_entropy)
+               return mach_random_get_entropy();
+       return 0;
+}
+#define random_get_entropy     random_get_entropy
+
 #endif
index 1fef45ada0973c7d83494f42c0c780ebc18f5ca3..6a2d257bdfb2224492f8f901575d17cc9b4f82d7 100644 (file)
@@ -11,6 +11,14 @@ generic-y += termbits.h
 generic-y += termios.h
 
 header-y += a.out.h
+header-y += bootinfo.h
+header-y += bootinfo-amiga.h
+header-y += bootinfo-apollo.h
+header-y += bootinfo-atari.h
+header-y += bootinfo-hp300.h
+header-y += bootinfo-mac.h
+header-y += bootinfo-q40.h
+header-y += bootinfo-vme.h
 header-y += byteorder.h
 header-y += cachectl.h
 header-y += fcntl.h
diff --git a/arch/m68k/include/uapi/asm/bootinfo-amiga.h b/arch/m68k/include/uapi/asm/bootinfo-amiga.h
new file mode 100644 (file)
index 0000000..daad3c5
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+** asm/bootinfo-amiga.h -- Amiga-specific boot information definitions
+*/
+
+#ifndef _UAPI_ASM_M68K_BOOTINFO_AMIGA_H
+#define _UAPI_ASM_M68K_BOOTINFO_AMIGA_H
+
+
+    /*
+     *  Amiga-specific tags
+     */
+
+#define BI_AMIGA_MODEL         0x8000  /* model (__be32) */
+#define BI_AMIGA_AUTOCON       0x8001  /* AutoConfig device */
+                                       /* (AmigaOS struct ConfigDev) */
+#define BI_AMIGA_CHIP_SIZE     0x8002  /* size of Chip RAM (__be32) */
+#define BI_AMIGA_VBLANK                0x8003  /* VBLANK frequency (__u8) */
+#define BI_AMIGA_PSFREQ                0x8004  /* power supply frequency (__u8) */
+#define BI_AMIGA_ECLOCK                0x8005  /* EClock frequency (__be32) */
+#define BI_AMIGA_CHIPSET       0x8006  /* native chipset present (__be32) */
+#define BI_AMIGA_SERPER                0x8007  /* serial port period (__be16) */
+
+
+    /*
+     *  Amiga models (BI_AMIGA_MODEL)
+     */
+
+#define AMI_UNKNOWN            0
+#define AMI_500                        1
+#define AMI_500PLUS            2
+#define AMI_600                        3
+#define AMI_1000               4
+#define AMI_1200               5
+#define AMI_2000               6
+#define AMI_2500               7
+#define AMI_3000               8
+#define AMI_3000T              9
+#define AMI_3000PLUS           10
+#define AMI_4000               11
+#define AMI_4000T              12
+#define AMI_CDTV               13
+#define AMI_CD32               14
+#define AMI_DRACO              15
+
+
+    /*
+     *  Amiga chipsets (BI_AMIGA_CHIPSET)
+     */
+
+#define CS_STONEAGE            0
+#define CS_OCS                 1
+#define CS_ECS                 2
+#define CS_AGA                 3
+
+
+    /*
+     *  Latest Amiga bootinfo version
+     */
+
+#define AMIGA_BOOTI_VERSION    MK_BI_VERSION(2, 0)
+
+
+#endif /* _UAPI_ASM_M68K_BOOTINFO_AMIGA_H */
diff --git a/arch/m68k/include/uapi/asm/bootinfo-apollo.h b/arch/m68k/include/uapi/asm/bootinfo-apollo.h
new file mode 100644 (file)
index 0000000..a93e0af
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+** asm/bootinfo-apollo.h -- Apollo-specific boot information definitions
+*/
+
+#ifndef _UAPI_ASM_M68K_BOOTINFO_APOLLO_H
+#define _UAPI_ASM_M68K_BOOTINFO_APOLLO_H
+
+
+    /*
+     *  Apollo-specific tags
+     */
+
+#define BI_APOLLO_MODEL                0x8000  /* model (__be32) */
+
+
+    /*
+     *  Apollo models (BI_APOLLO_MODEL)
+     */
+
+#define APOLLO_UNKNOWN         0
+#define APOLLO_DN3000          1
+#define APOLLO_DN3010          2
+#define APOLLO_DN3500          3
+#define APOLLO_DN4000          4
+#define APOLLO_DN4500          5
+
+
+#endif /* _UAPI_ASM_M68K_BOOTINFO_APOLLO_H */
diff --git a/arch/m68k/include/uapi/asm/bootinfo-atari.h b/arch/m68k/include/uapi/asm/bootinfo-atari.h
new file mode 100644 (file)
index 0000000..a817854
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+** asm/bootinfo-atari.h -- Atari-specific boot information definitions
+*/
+
+#ifndef _UAPI_ASM_M68K_BOOTINFO_ATARI_H
+#define _UAPI_ASM_M68K_BOOTINFO_ATARI_H
+
+
+    /*
+     *  Atari-specific tags
+     */
+
+#define BI_ATARI_MCH_COOKIE    0x8000  /* _MCH cookie from TOS (__be32) */
+#define BI_ATARI_MCH_TYPE      0x8001  /* special machine type (__be32) */
+
+
+    /*
+     *  mch_cookie values (upper word of BI_ATARI_MCH_COOKIE)
+     */
+
+#define ATARI_MCH_ST           0
+#define ATARI_MCH_STE          1
+#define ATARI_MCH_TT           2
+#define ATARI_MCH_FALCON       3
+
+
+    /*
+     *  Atari machine types (BI_ATARI_MCH_TYPE)
+     */
+
+#define ATARI_MACH_NORMAL      0       /* no special machine type */
+#define ATARI_MACH_MEDUSA      1       /* Medusa 040 */
+#define ATARI_MACH_HADES       2       /* Hades 040 or 060 */
+#define ATARI_MACH_AB40                3       /* Afterburner040 on Falcon */
+
+
+    /*
+     *  Latest Atari bootinfo version
+     */
+
+#define ATARI_BOOTI_VERSION    MK_BI_VERSION(2, 1)
+
+
+#endif /* _UAPI_ASM_M68K_BOOTINFO_ATARI_H */
diff --git a/arch/m68k/include/uapi/asm/bootinfo-hp300.h b/arch/m68k/include/uapi/asm/bootinfo-hp300.h
new file mode 100644 (file)
index 0000000..c90cb71
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+** asm/bootinfo-hp300.h -- HP9000/300-specific boot information definitions
+*/
+
+#ifndef _UAPI_ASM_M68K_BOOTINFO_HP300_H
+#define _UAPI_ASM_M68K_BOOTINFO_HP300_H
+
+
+    /*
+     *  HP9000/300-specific tags
+     */
+
+#define BI_HP300_MODEL         0x8000  /* model (__be32) */
+#define BI_HP300_UART_SCODE    0x8001  /* UART select code (__be32) */
+#define BI_HP300_UART_ADDR     0x8002  /* phys. addr of UART (__be32) */
+
+
+    /*
+     *  HP9000/300 and /400 models (BI_HP300_MODEL)
+     *
+     * This information was taken from NetBSD
+     */
+
+#define HP_320         0       /* 16MHz 68020+HP MMU+16K external cache */
+#define HP_330         1       /* 16MHz 68020+68851 MMU */
+#define HP_340         2       /* 16MHz 68030 */
+#define HP_345         3       /* 50MHz 68030+32K external cache */
+#define HP_350         4       /* 25MHz 68020+HP MMU+32K external cache */
+#define HP_360         5       /* 25MHz 68030 */
+#define HP_370         6       /* 33MHz 68030+64K external cache */
+#define HP_375         7       /* 50MHz 68030+32K external cache */
+#define HP_380         8       /* 25MHz 68040 */
+#define HP_385         9       /* 33MHz 68040 */
+
+#define HP_400         10      /* 50MHz 68030+32K external cache */
+#define HP_425T                11      /* 25MHz 68040 - model 425t */
+#define HP_425S                12      /* 25MHz 68040 - model 425s */
+#define HP_425E                13      /* 25MHz 68040 - model 425e */
+#define HP_433T                14      /* 33MHz 68040 - model 433t */
+#define HP_433S                15      /* 33MHz 68040 - model 433s */
+
+
+    /*
+     *  Latest HP9000/300 bootinfo version
+     */
+
+#define HP300_BOOTI_VERSION    MK_BI_VERSION(2, 0)
+
+
+#endif /* _UAPI_ASM_M68K_BOOTINFO_HP300_H */
diff --git a/arch/m68k/include/uapi/asm/bootinfo-mac.h b/arch/m68k/include/uapi/asm/bootinfo-mac.h
new file mode 100644 (file)
index 0000000..b44ff73
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+** asm/bootinfo-mac.h -- Macintosh-specific boot information definitions
+*/
+
+#ifndef _UAPI_ASM_M68K_BOOTINFO_MAC_H
+#define _UAPI_ASM_M68K_BOOTINFO_MAC_H
+
+
+    /*
+     *  Macintosh-specific tags (all __be32)
+     */
+
+#define BI_MAC_MODEL           0x8000  /* Mac Gestalt ID (model type) */
+#define BI_MAC_VADDR           0x8001  /* Mac video base address */
+#define BI_MAC_VDEPTH          0x8002  /* Mac video depth */
+#define BI_MAC_VROW            0x8003  /* Mac video rowbytes */
+#define BI_MAC_VDIM            0x8004  /* Mac video dimensions */
+#define BI_MAC_VLOGICAL                0x8005  /* Mac video logical base */
+#define BI_MAC_SCCBASE         0x8006  /* Mac SCC base address */
+#define BI_MAC_BTIME           0x8007  /* Mac boot time */
+#define BI_MAC_GMTBIAS         0x8008  /* Mac GMT timezone offset */
+#define BI_MAC_MEMSIZE         0x8009  /* Mac RAM size (sanity check) */
+#define BI_MAC_CPUID           0x800a  /* Mac CPU type (sanity check) */
+#define BI_MAC_ROMBASE         0x800b  /* Mac system ROM base address */
+
+
+    /*
+     *  Macintosh hardware profile data - unused, see macintosh.h for
+     *  reasonable type values
+     */
+
+#define BI_MAC_VIA1BASE                0x8010  /* Mac VIA1 base address (always present) */
+#define BI_MAC_VIA2BASE                0x8011  /* Mac VIA2 base address (type varies) */
+#define BI_MAC_VIA2TYPE                0x8012  /* Mac VIA2 type (VIA, RBV, OSS) */
+#define BI_MAC_ADBTYPE         0x8013  /* Mac ADB interface type */
+#define BI_MAC_ASCBASE         0x8014  /* Mac Apple Sound Chip base address */
+#define BI_MAC_SCSI5380                0x8015  /* Mac NCR 5380 SCSI (base address, multi) */
+#define BI_MAC_SCSIDMA         0x8016  /* Mac SCSI DMA (base address) */
+#define BI_MAC_SCSI5396                0x8017  /* Mac NCR 53C96 SCSI (base address, multi) */
+#define BI_MAC_IDETYPE         0x8018  /* Mac IDE interface type */
+#define BI_MAC_IDEBASE         0x8019  /* Mac IDE interface base address */
+#define BI_MAC_NUBUS           0x801a  /* Mac Nubus type (none, regular, pseudo) */
+#define BI_MAC_SLOTMASK                0x801b  /* Mac Nubus slots present */
+#define BI_MAC_SCCTYPE         0x801c  /* Mac SCC serial type (normal, IOP) */
+#define BI_MAC_ETHTYPE         0x801d  /* Mac builtin ethernet type (Sonic, MACE */
+#define BI_MAC_ETHBASE         0x801e  /* Mac builtin ethernet base address */
+#define BI_MAC_PMU             0x801f  /* Mac power management / poweroff hardware */
+#define BI_MAC_IOP_SWIM                0x8020  /* Mac SWIM floppy IOP */
+#define BI_MAC_IOP_ADB         0x8021  /* Mac ADB IOP */
+
+
+    /*
+     * Macintosh Gestalt numbers (BI_MAC_MODEL)
+     */
+
+#define MAC_MODEL_II           6
+#define MAC_MODEL_IIX          7
+#define MAC_MODEL_IICX         8
+#define MAC_MODEL_SE30         9
+#define MAC_MODEL_IICI         11
+#define MAC_MODEL_IIFX         13      /* And well numbered it is too */
+#define MAC_MODEL_IISI         18
+#define MAC_MODEL_LC           19
+#define MAC_MODEL_Q900         20
+#define MAC_MODEL_PB170                21
+#define MAC_MODEL_Q700         22
+#define MAC_MODEL_CLII         23      /* aka: P200 */
+#define MAC_MODEL_PB140                25
+#define MAC_MODEL_Q950         26      /* aka: WGS95 */
+#define MAC_MODEL_LCIII                27      /* aka: P450 */
+#define MAC_MODEL_PB210                29
+#define MAC_MODEL_C650         30
+#define MAC_MODEL_PB230                32
+#define MAC_MODEL_PB180                33
+#define MAC_MODEL_PB160                34
+#define MAC_MODEL_Q800         35      /* aka: WGS80 */
+#define MAC_MODEL_Q650         36
+#define MAC_MODEL_LCII         37      /* aka: P400/405/410/430 */
+#define MAC_MODEL_PB250                38
+#define MAC_MODEL_IIVI         44
+#define MAC_MODEL_P600         45      /* aka: P600CD */
+#define MAC_MODEL_IIVX         48
+#define MAC_MODEL_CCL          49      /* aka: P250 */
+#define MAC_MODEL_PB165C       50
+#define MAC_MODEL_C610         52      /* aka: WGS60 */
+#define MAC_MODEL_Q610         53
+#define MAC_MODEL_PB145                54      /* aka: PB145B */
+#define MAC_MODEL_P520         56      /* aka: LC520 */
+#define MAC_MODEL_C660         60
+#define MAC_MODEL_P460         62      /* aka: LCIII+, P466/P467 */
+#define MAC_MODEL_PB180C       71
+#define MAC_MODEL_PB520                72      /* aka: PB520C, PB540, PB540C, PB550C */
+#define MAC_MODEL_PB270C       77
+#define MAC_MODEL_Q840         78
+#define MAC_MODEL_P550         80      /* aka: LC550, P560 */
+#define MAC_MODEL_CCLII                83      /* aka: P275 */
+#define MAC_MODEL_PB165                84
+#define MAC_MODEL_PB190                85      /* aka: PB190CS */
+#define MAC_MODEL_TV           88
+#define MAC_MODEL_P475         89      /* aka: LC475, P476 */
+#define MAC_MODEL_P475F                90      /* aka: P475 w/ FPU (no LC040) */
+#define MAC_MODEL_P575         92      /* aka: LC575, P577/P578 */
+#define MAC_MODEL_Q605         94
+#define MAC_MODEL_Q605_ACC     95      /* Q605 accelerated to 33 MHz */
+#define MAC_MODEL_Q630         98      /* aka: LC630, P630/631/635/636/637/638/640 */
+#define MAC_MODEL_P588         99      /* aka: LC580, P580 */
+#define MAC_MODEL_PB280                102
+#define MAC_MODEL_PB280C       103
+#define MAC_MODEL_PB150                115
+
+
+    /*
+     *  Latest Macintosh bootinfo version
+     */
+
+#define MAC_BOOTI_VERSION      MK_BI_VERSION(2, 0)
+
+
+#endif /* _UAPI_ASM_M68K_BOOTINFO_MAC_H */
diff --git a/arch/m68k/include/uapi/asm/bootinfo-q40.h b/arch/m68k/include/uapi/asm/bootinfo-q40.h
new file mode 100644 (file)
index 0000000..c79fea7
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+** asm/bootinfo-q40.h -- Q40-specific boot information definitions
+*/
+
+#ifndef _UAPI_ASM_M68K_BOOTINFO_Q40_H
+#define _UAPI_ASM_M68K_BOOTINFO_Q40_H
+
+
+    /*
+     *  Latest Q40 bootinfo version
+     */
+
+#define Q40_BOOTI_VERSION      MK_BI_VERSION(2, 0)
+
+
+#endif /* _UAPI_ASM_M68K_BOOTINFO_Q40_H */
diff --git a/arch/m68k/include/uapi/asm/bootinfo-vme.h b/arch/m68k/include/uapi/asm/bootinfo-vme.h
new file mode 100644 (file)
index 0000000..a135eb4
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+** asm/bootinfo-vme.h -- VME-specific boot information definitions
+*/
+
+#ifndef _UAPI_ASM_M68K_BOOTINFO_VME_H
+#define _UAPI_ASM_M68K_BOOTINFO_VME_H
+
+
+#include <linux/types.h>
+
+
+    /*
+     *  VME-specific tags
+     */
+
+#define BI_VME_TYPE            0x8000  /* VME sub-architecture (__be32) */
+#define BI_VME_BRDINFO         0x8001  /* VME board information (struct) */
+
+
+    /*
+     *  VME models (BI_VME_TYPE)
+     */
+
+#define VME_TYPE_TP34V         0x0034  /* Tadpole TP34V */
+#define VME_TYPE_MVME147       0x0147  /* Motorola MVME147 */
+#define VME_TYPE_MVME162       0x0162  /* Motorola MVME162 */
+#define VME_TYPE_MVME166       0x0166  /* Motorola MVME166 */
+#define VME_TYPE_MVME167       0x0167  /* Motorola MVME167 */
+#define VME_TYPE_MVME172       0x0172  /* Motorola MVME172 */
+#define VME_TYPE_MVME177       0x0177  /* Motorola MVME177 */
+#define VME_TYPE_BVME4000      0x4000  /* BVM Ltd. BVME4000 */
+#define VME_TYPE_BVME6000      0x6000  /* BVM Ltd. BVME6000 */
+
+
+#ifndef __ASSEMBLY__
+
+/*
+ * Board ID data structure - pointer to this retrieved from Bug by head.S
+ *
+ * BI_VME_BRDINFO is a 32 byte struct as returned by the Bug code on
+ * Motorola VME boards.  Contains board number, Bug version, board
+ * configuration options, etc.
+ *
+ * Note, bytes 12 and 13 are board no in BCD (0162,0166,0167,0177,etc)
+ */
+
+typedef struct {
+       char    bdid[4];
+       __u8    rev, mth, day, yr;
+       __be16  size, reserved;
+       __be16  brdno;
+       char    brdsuffix[2];
+       __be32  options;
+       __be16  clun, dlun, ctype, dnum;
+       __be32  option2;
+} t_bdid, *p_bdid;
+
+#endif /* __ASSEMBLY__ */
+
+
+    /*
+     *  Latest VME bootinfo versions
+     */
+
+#define MVME147_BOOTI_VERSION  MK_BI_VERSION(2, 0)
+#define MVME16x_BOOTI_VERSION  MK_BI_VERSION(2, 0)
+#define BVME6000_BOOTI_VERSION MK_BI_VERSION(2, 0)
+
+
+#endif /* _UAPI_ASM_M68K_BOOTINFO_VME_H */
diff --git a/arch/m68k/include/uapi/asm/bootinfo.h b/arch/m68k/include/uapi/asm/bootinfo.h
new file mode 100644 (file)
index 0000000..cdeb26a
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * asm/bootinfo.h -- Definition of the Linux/m68k boot information structure
+ *
+ * Copyright 1992 by Greg Harp
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#ifndef _UAPI_ASM_M68K_BOOTINFO_H
+#define _UAPI_ASM_M68K_BOOTINFO_H
+
+
+#include <linux/types.h>
+
+
+#ifndef __ASSEMBLY__
+
+    /*
+     *  Bootinfo definitions
+     *
+     *  This is an easily parsable and extendable structure containing all
+     *  information to be passed from the bootstrap to the kernel.
+     *
+     *  This way I hope to keep all future changes back/forewards compatible.
+     *  Thus, keep your fingers crossed...
+     *
+     *  This structure is copied right after the kernel by the bootstrap
+     *  routine.
+     */
+
+struct bi_record {
+       __be16 tag;                     /* tag ID */
+       __be16 size;                    /* size of record (in bytes) */
+       __be32 data[0];                 /* data */
+};
+
+
+struct mem_info {
+       __be32 addr;                    /* physical address of memory chunk */
+       __be32 size;                    /* length of memory chunk (in bytes) */
+};
+
+#endif /* __ASSEMBLY__ */
+
+
+    /*
+     *  Tag Definitions
+     *
+     *  Machine independent tags start counting from 0x0000
+     *  Machine dependent tags start counting from 0x8000
+     */
+
+#define BI_LAST                        0x0000  /* last record (sentinel) */
+#define BI_MACHTYPE            0x0001  /* machine type (__be32) */
+#define BI_CPUTYPE             0x0002  /* cpu type (__be32) */
+#define BI_FPUTYPE             0x0003  /* fpu type (__be32) */
+#define BI_MMUTYPE             0x0004  /* mmu type (__be32) */
+#define BI_MEMCHUNK            0x0005  /* memory chunk address and size */
+                                       /* (struct mem_info) */
+#define BI_RAMDISK             0x0006  /* ramdisk address and size */
+                                       /* (struct mem_info) */
+#define BI_COMMAND_LINE                0x0007  /* kernel command line parameters */
+                                       /* (string) */
+
+
+    /*
+     *  Linux/m68k Architectures (BI_MACHTYPE)
+     */
+
+#define MACH_AMIGA             1
+#define MACH_ATARI             2
+#define MACH_MAC               3
+#define MACH_APOLLO            4
+#define MACH_SUN3              5
+#define MACH_MVME147           6
+#define MACH_MVME16x           7
+#define MACH_BVME6000          8
+#define MACH_HP300             9
+#define MACH_Q40               10
+#define MACH_SUN3X             11
+#define MACH_M54XX             12
+
+
+    /*
+     *  CPU, FPU and MMU types (BI_CPUTYPE, BI_FPUTYPE, BI_MMUTYPE)
+     *
+     *  Note: we may rely on the following equalities:
+     *
+     *      CPU_68020 == MMU_68851
+     *      CPU_68030 == MMU_68030
+     *      CPU_68040 == FPU_68040 == MMU_68040
+     *      CPU_68060 == FPU_68060 == MMU_68060
+     */
+
+#define CPUB_68020             0
+#define CPUB_68030             1
+#define CPUB_68040             2
+#define CPUB_68060             3
+#define CPUB_COLDFIRE          4
+
+#define CPU_68020              (1 << CPUB_68020)
+#define CPU_68030              (1 << CPUB_68030)
+#define CPU_68040              (1 << CPUB_68040)
+#define CPU_68060              (1 << CPUB_68060)
+#define CPU_COLDFIRE           (1 << CPUB_COLDFIRE)
+
+#define FPUB_68881             0
+#define FPUB_68882             1
+#define FPUB_68040             2       /* Internal FPU */
+#define FPUB_68060             3       /* Internal FPU */
+#define FPUB_SUNFPA            4       /* Sun-3 FPA */
+#define FPUB_COLDFIRE          5       /* ColdFire FPU */
+
+#define FPU_68881              (1 << FPUB_68881)
+#define FPU_68882              (1 << FPUB_68882)
+#define FPU_68040              (1 << FPUB_68040)
+#define FPU_68060              (1 << FPUB_68060)
+#define FPU_SUNFPA             (1 << FPUB_SUNFPA)
+#define FPU_COLDFIRE           (1 << FPUB_COLDFIRE)
+
+#define MMUB_68851             0
+#define MMUB_68030             1       /* Internal MMU */
+#define MMUB_68040             2       /* Internal MMU */
+#define MMUB_68060             3       /* Internal MMU */
+#define MMUB_APOLLO            4       /* Custom Apollo */
+#define MMUB_SUN3              5       /* Custom Sun-3 */
+#define MMUB_COLDFIRE          6       /* Internal MMU */
+
+#define MMU_68851              (1 << MMUB_68851)
+#define MMU_68030              (1 << MMUB_68030)
+#define MMU_68040              (1 << MMUB_68040)
+#define MMU_68060              (1 << MMUB_68060)
+#define MMU_SUN3               (1 << MMUB_SUN3)
+#define MMU_APOLLO             (1 << MMUB_APOLLO)
+#define MMU_COLDFIRE           (1 << MMUB_COLDFIRE)
+
+
+    /*
+     * Stuff for bootinfo interface versioning
+     *
+     * At the start of kernel code, a 'struct bootversion' is located.
+     * bootstrap checks for a matching version of the interface before booting
+     * a kernel, to avoid user confusion if kernel and bootstrap don't work
+     * together :-)
+     *
+     * If incompatible changes are made to the bootinfo interface, the major
+     * number below should be stepped (and the minor reset to 0) for the
+     * appropriate machine. If a change is backward-compatible, the minor
+     * should be stepped. "Backwards-compatible" means that booting will work,
+     * but certain features may not.
+     */
+
+#define BOOTINFOV_MAGIC                        0x4249561A      /* 'BIV^Z' */
+#define MK_BI_VERSION(major, minor)    (((major) << 16) + (minor))
+#define BI_VERSION_MAJOR(v)            (((v) >> 16) & 0xffff)
+#define BI_VERSION_MINOR(v)            ((v) & 0xffff)
+
+#ifndef __ASSEMBLY__
+
+struct bootversion {
+       __be16 branch;
+       __be32 magic;
+       struct {
+               __be32 machtype;
+               __be32 version;
+       } machversions[0];
+} __packed;
+
+#endif /* __ASSEMBLY__ */
+
+
+#endif /* _UAPI_ASM_M68K_BOOTINFO_H */
index 85579bff455ccb32fc7f9e805d0f78383c053245..6a6dc636761eaa210844f10614ad1633cff41bc3 100644 (file)
@@ -6,98 +6,11 @@
 ** This file is subject to the terms and conditions of the GNU General Public
 ** License.  See the file COPYING in the main directory of this archive
 ** for more details.
-**
-** Created 09/29/92 by Greg Harp
-**
-** 5/2/94 Roman Hodek:
-**   Added bi_atari part of the machine dependent union bi_un; for now it
-**   contains just a model field to distinguish between TT and Falcon.
-** 26/7/96 Roman Zippel:
-**   Renamed to setup.h; added some useful macros to allow gcc some
-**   optimizations if possible.
-** 5/10/96 Geert Uytterhoeven:
-**   Redesign of the boot information structure; moved boot information
-**   structure to bootinfo.h
 */
 
 #ifndef _UAPI_M68K_SETUP_H
 #define _UAPI_M68K_SETUP_H
 
-
-
-    /*
-     *  Linux/m68k Architectures
-     */
-
-#define MACH_AMIGA    1
-#define MACH_ATARI    2
-#define MACH_MAC      3
-#define MACH_APOLLO   4
-#define MACH_SUN3     5
-#define MACH_MVME147  6
-#define MACH_MVME16x  7
-#define MACH_BVME6000 8
-#define MACH_HP300    9
-#define MACH_Q40     10
-#define MACH_SUN3X   11
-#define MACH_M54XX   12
-
 #define COMMAND_LINE_SIZE 256
 
-
-
-    /*
-     *  CPU, FPU and MMU types
-     *
-     *  Note: we may rely on the following equalities:
-     *
-     *      CPU_68020 == MMU_68851
-     *      CPU_68030 == MMU_68030
-     *      CPU_68040 == FPU_68040 == MMU_68040
-     *      CPU_68060 == FPU_68060 == MMU_68060
-     */
-
-#define CPUB_68020     0
-#define CPUB_68030     1
-#define CPUB_68040     2
-#define CPUB_68060     3
-#define CPUB_COLDFIRE  4
-
-#define CPU_68020      (1<<CPUB_68020)
-#define CPU_68030      (1<<CPUB_68030)
-#define CPU_68040      (1<<CPUB_68040)
-#define CPU_68060      (1<<CPUB_68060)
-#define CPU_COLDFIRE   (1<<CPUB_COLDFIRE)
-
-#define FPUB_68881     0
-#define FPUB_68882     1
-#define FPUB_68040     2                       /* Internal FPU */
-#define FPUB_68060     3                       /* Internal FPU */
-#define FPUB_SUNFPA    4                       /* Sun-3 FPA */
-#define FPUB_COLDFIRE  5                       /* ColdFire FPU */
-
-#define FPU_68881      (1<<FPUB_68881)
-#define FPU_68882      (1<<FPUB_68882)
-#define FPU_68040      (1<<FPUB_68040)
-#define FPU_68060      (1<<FPUB_68060)
-#define FPU_SUNFPA     (1<<FPUB_SUNFPA)
-#define FPU_COLDFIRE   (1<<FPUB_COLDFIRE)
-
-#define MMUB_68851     0
-#define MMUB_68030     1                       /* Internal MMU */
-#define MMUB_68040     2                       /* Internal MMU */
-#define MMUB_68060     3                       /* Internal MMU */
-#define MMUB_APOLLO    4                       /* Custom Apollo */
-#define MMUB_SUN3      5                       /* Custom Sun-3 */
-#define MMUB_COLDFIRE  6                       /* Internal MMU */
-
-#define MMU_68851      (1<<MMUB_68851)
-#define MMU_68030      (1<<MMUB_68030)
-#define MMU_68040      (1<<MMUB_68040)
-#define MMU_68060      (1<<MMUB_68060)
-#define MMU_SUN3       (1<<MMUB_SUN3)
-#define MMU_APOLLO     (1<<MMUB_APOLLO)
-#define MMU_COLDFIRE   (1<<MMUB_COLDFIRE)
-
-
 #endif /* _UAPI_M68K_SETUP_H */
index 655347d807801e3543412c5aaedc550f3ebdef80..2d5d9be162732dae6ae603622e3572e1d0349523 100644 (file)
@@ -22,3 +22,6 @@ obj-$(CONFIG_PCI) += pcibios.o
 
 obj-$(CONFIG_HAS_DMA)  += dma.o
 
+obj-$(CONFIG_KEXEC)            += machine_kexec.o relocate_kernel.o
+obj-$(CONFIG_BOOTINFO_PROC)    += bootinfo_proc.o
+
index 8b7b228463667da0145f9d7e821172553822d20d..3a386341aa6e282336a5ceea41b248fc45943191 100644 (file)
@@ -98,6 +98,9 @@ int main(void)
        DEFINE(CIABBASE, &ciab);
        DEFINE(C_PRA, offsetof(struct CIA, pra));
        DEFINE(ZTWOBASE, zTwoBase);
+
+       /* enum m68k_fixup_type */
+       DEFINE(M68K_FIXUP_MEMOFFSET, m68k_fixup_memoffset);
 #endif
 
        return 0;
diff --git a/arch/m68k/kernel/bootinfo_proc.c b/arch/m68k/kernel/bootinfo_proc.c
new file mode 100644 (file)
index 0000000..7ee853e
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Based on arch/arm/kernel/atags_proc.c
+ */
+
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/printk.h>
+#include <linux/proc_fs.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+
+#include <asm/bootinfo.h>
+#include <asm/byteorder.h>
+
+
+static char bootinfo_tmp[1536] __initdata;
+
+static void *bootinfo_copy;
+static size_t bootinfo_size;
+
+static ssize_t bootinfo_read(struct file *file, char __user *buf,
+                         size_t count, loff_t *ppos)
+{
+       return simple_read_from_buffer(buf, count, ppos, bootinfo_copy,
+                                      bootinfo_size);
+}
+
+static const struct file_operations bootinfo_fops = {
+       .read = bootinfo_read,
+       .llseek = default_llseek,
+};
+
+void __init save_bootinfo(const struct bi_record *bi)
+{
+       const void *start = bi;
+       size_t size = sizeof(bi->tag);
+
+       while (be16_to_cpu(bi->tag) != BI_LAST) {
+               uint16_t n = be16_to_cpu(bi->size);
+               size += n;
+               bi = (struct bi_record *)((unsigned long)bi + n);
+       }
+
+       if (size > sizeof(bootinfo_tmp)) {
+               pr_err("Cannot save %zu bytes of bootinfo\n", size);
+               return;
+       }
+
+       pr_info("Saving %zu bytes of bootinfo\n", size);
+       memcpy(bootinfo_tmp, start, size);
+       bootinfo_size = size;
+}
+
+static int __init init_bootinfo_procfs(void)
+{
+       /*
+        * This cannot go into save_bootinfo() because kmalloc and proc don't
+        * work yet when it is called.
+        */
+       struct proc_dir_entry *pde;
+
+       if (!bootinfo_size)
+               return -EINVAL;
+
+       bootinfo_copy = kmalloc(bootinfo_size, GFP_KERNEL);
+       if (!bootinfo_copy)
+               return -ENOMEM;
+
+       memcpy(bootinfo_copy, bootinfo_tmp, bootinfo_size);
+
+       pde = proc_create_data("bootinfo", 0400, NULL, &bootinfo_fops, NULL);
+       if (!pde) {
+               kfree(bootinfo_copy);
+               return -ENOMEM;
+       }
+
+       return 0;
+}
+
+arch_initcall(init_bootinfo_procfs);
index ac85f16534af929c33d0f1daf1f3a565488b6af4..7d7913f5dce3beabd14ecac0afdc66109ee30e55 100644 (file)
@@ -23,7 +23,7 @@
 ** 98/04/25 Phil Blundell: added HP300 support
 ** 1998/08/30 David Kilzer: Added support for font_desc structures
 **            for linux-2.1.115
-** 9/02/11  Richard Zidlicky: added Q40 support (initial vesion 99/01/01)
+** 1999/02/11  Richard Zidlicky: added Q40 support (initial version 99/01/01)
 ** 2004/05/13 Kars de Jong: Finalised HP300 support
 **
 ** This file is subject to the terms and conditions of the GNU General Public
 #include <linux/linkage.h>
 #include <linux/init.h>
 #include <asm/bootinfo.h>
+#include <asm/bootinfo-amiga.h>
+#include <asm/bootinfo-atari.h>
+#include <asm/bootinfo-hp300.h>
+#include <asm/bootinfo-mac.h>
+#include <asm/bootinfo-q40.h>
+#include <asm/bootinfo-vme.h>
 #include <asm/setup.h>
 #include <asm/entry.h>
 #include <asm/pgtable.h>
@@ -1532,7 +1538,7 @@ L(cache_done):
 
 /*
  * Find a tag record in the bootinfo structure
- * The bootinfo structure is located right after the kernel bss
+ * The bootinfo structure is located right after the kernel
  * Returns: d0: size (-1 if not found)
  *          a0: data pointer (end-of-records if not found)
  */
@@ -3896,8 +3902,6 @@ BVME_SCC_DATA_A   = 0xffb0000f
 #endif
 
 #if defined(CONFIG_MAC)
-L(mac_booter_data):
-       .long   0
 L(mac_videobase):
        .long   0
 L(mac_videodepth):
diff --git a/arch/m68k/kernel/machine_kexec.c b/arch/m68k/kernel/machine_kexec.c
new file mode 100644 (file)
index 0000000..d4affc9
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * machine_kexec.c - handle transition of Linux booting another kernel
+ */
+#include <linux/compiler.h>
+#include <linux/kexec.h>
+#include <linux/mm.h>
+#include <linux/delay.h>
+
+#include <asm/cacheflush.h>
+#include <asm/page.h>
+#include <asm/setup.h>
+
+extern const unsigned char relocate_new_kernel[];
+extern const size_t relocate_new_kernel_size;
+
+int machine_kexec_prepare(struct kimage *kimage)
+{
+       return 0;
+}
+
+void machine_kexec_cleanup(struct kimage *kimage)
+{
+}
+
+void machine_shutdown(void)
+{
+}
+
+void machine_crash_shutdown(struct pt_regs *regs)
+{
+}
+
+typedef void (*relocate_kernel_t)(unsigned long ptr,
+                                 unsigned long start,
+                                 unsigned long cpu_mmu_flags) __noreturn;
+
+void machine_kexec(struct kimage *image)
+{
+       void *reboot_code_buffer;
+       unsigned long cpu_mmu_flags;
+
+       reboot_code_buffer = page_address(image->control_code_page);
+
+       memcpy(reboot_code_buffer, relocate_new_kernel,
+              relocate_new_kernel_size);
+
+       /*
+        * we do not want to be bothered.
+        */
+       local_irq_disable();
+
+       pr_info("Will call new kernel at 0x%08lx. Bye...\n", image->start);
+       __flush_cache_all();
+       cpu_mmu_flags = m68k_cputype | m68k_mmutype << 8;
+       ((relocate_kernel_t) reboot_code_buffer)(image->head & PAGE_MASK,
+                                                image->start,
+                                                cpu_mmu_flags);
+}
diff --git a/arch/m68k/kernel/relocate_kernel.S b/arch/m68k/kernel/relocate_kernel.S
new file mode 100644 (file)
index 0000000..3e09a89
--- /dev/null
@@ -0,0 +1,159 @@
+#include <linux/linkage.h>
+
+#include <asm/asm-offsets.h>
+#include <asm/page.h>
+#include <asm/setup.h>
+
+
+#define MMU_BASE       8               /* MMU flags base in cpu_mmu_flags */
+
+.text
+
+ENTRY(relocate_new_kernel)
+       movel %sp@(4),%a0               /* a0 = ptr */
+       movel %sp@(8),%a1               /* a1 = start */
+       movel %sp@(12),%d1              /* d1 = cpu_mmu_flags */
+       movew #PAGE_MASK,%d2            /* d2 = PAGE_MASK */
+
+       /* Disable MMU */
+
+       btst #MMU_BASE + MMUB_68851,%d1
+       jeq 3f
+
+1:     /* 68851 or 68030 */
+
+       lea %pc@(.Lcopy),%a4
+2:     addl #0x00000000,%a4            /* virt_to_phys() */
+
+       .section ".m68k_fixup","aw"
+       .long M68K_FIXUP_MEMOFFSET, 2b+2
+       .previous
+
+       .chip 68030
+       pmove %tc,%d0                   /* Disable MMU */
+       bclr #7,%d0
+       pmove %d0,%tc
+       jmp %a4@                        /* Jump to physical .Lcopy */
+       .chip 68k
+
+3:
+       btst #MMU_BASE + MMUB_68030,%d1
+       jne 1b
+
+       btst #MMU_BASE + MMUB_68040,%d1
+       jeq 6f
+
+4:     /* 68040 or 68060 */
+
+       lea %pc@(.Lcont040),%a4
+5:     addl #0x00000000,%a4            /* virt_to_phys() */
+
+       .section ".m68k_fixup","aw"
+       .long M68K_FIXUP_MEMOFFSET, 5b+2
+       .previous
+
+       movel %a4,%d0
+       andl #0xff000000,%d0
+       orw #0xe020,%d0                 /* Map 16 MiB, enable, cacheable */
+       .chip 68040
+       movec %d0,%itt0
+       movec %d0,%dtt0
+       .chip 68k
+       jmp %a4@                        /* Jump to physical .Lcont040 */
+
+.Lcont040:
+       moveq #0,%d0
+       .chip 68040
+       movec %d0,%tc                   /* Disable MMU */
+       movec %d0,%itt0
+       movec %d0,%itt1
+       movec %d0,%dtt0
+       movec %d0,%dtt1
+       .chip 68k
+       jra .Lcopy
+
+6:
+       btst #MMU_BASE + MMUB_68060,%d1
+       jne 4b
+
+.Lcopy:
+       movel %a0@+,%d0                 /* d0 = entry = *ptr */
+       jeq .Lflush
+
+       btst #2,%d0                     /* entry & IND_DONE? */
+       jne .Lflush
+
+       btst #1,%d0                     /* entry & IND_INDIRECTION? */
+       jeq 1f
+       andw %d2,%d0
+       movel %d0,%a0                   /* ptr = entry & PAGE_MASK */
+       jra .Lcopy
+
+1:
+       btst #0,%d0                     /* entry & IND_DESTINATION? */
+       jeq 2f
+       andw %d2,%d0
+       movel %d0,%a2                   /* a2 = dst = entry & PAGE_MASK */
+       jra .Lcopy
+
+2:
+       btst #3,%d0                     /* entry & IND_SOURCE? */
+       jeq .Lcopy
+
+       andw %d2,%d0
+       movel %d0,%a3                   /* a3 = src = entry & PAGE_MASK */
+       movew #PAGE_SIZE/32 - 1,%d0     /* d0 = PAGE_SIZE/32 - 1 */
+3:
+       movel %a3@+,%a2@+               /* *dst++ = *src++ */
+       movel %a3@+,%a2@+               /* *dst++ = *src++ */
+       movel %a3@+,%a2@+               /* *dst++ = *src++ */
+       movel %a3@+,%a2@+               /* *dst++ = *src++ */
+       movel %a3@+,%a2@+               /* *dst++ = *src++ */
+       movel %a3@+,%a2@+               /* *dst++ = *src++ */
+       movel %a3@+,%a2@+               /* *dst++ = *src++ */
+       movel %a3@+,%a2@+               /* *dst++ = *src++ */
+       dbf %d0, 3b
+       jra .Lcopy
+
+.Lflush:
+       /* Flush all caches */
+
+       btst #CPUB_68020,%d1
+       jeq 2f
+
+1:     /* 68020 or 68030 */
+       .chip 68030
+       movec %cacr,%d0
+       orw #0x808,%d0
+       movec %d0,%cacr
+       .chip 68k
+       jra .Lreincarnate
+
+2:
+       btst #CPUB_68030,%d1
+       jne 1b
+
+       btst #CPUB_68040,%d1
+       jeq 4f
+
+3:     /* 68040 or 68060 */
+       .chip 68040
+       nop
+       cpusha %bc
+       nop
+       cinva %bc
+       nop
+       .chip 68k
+       jra .Lreincarnate
+
+4:
+       btst #CPUB_68060,%d1
+       jne 3b
+
+.Lreincarnate:
+       jmp %a1@
+
+relocate_new_kernel_end:
+
+ENTRY(relocate_new_kernel_size)
+       .long relocate_new_kernel_end - relocate_new_kernel
index e67e53159573a81d0db7da0d93464766e47ab264..5b8ec4d5f8e8d79d1becaa48d489d0117374daa8 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/initrd.h>
 
 #include <asm/bootinfo.h>
+#include <asm/byteorder.h>
 #include <asm/sections.h>
 #include <asm/setup.h>
 #include <asm/fpu.h>
@@ -71,12 +72,12 @@ EXPORT_SYMBOL(m68k_num_memory);
 int m68k_realnum_memory;
 EXPORT_SYMBOL(m68k_realnum_memory);
 unsigned long m68k_memoffset;
-struct mem_info m68k_memory[NUM_MEMINFO];
+struct m68k_mem_info m68k_memory[NUM_MEMINFO];
 EXPORT_SYMBOL(m68k_memory);
 
-struct mem_info m68k_ramdisk;
+static struct m68k_mem_info m68k_ramdisk __initdata;
 
-static char m68k_command_line[CL_SIZE];
+static char m68k_command_line[CL_SIZE] __initdata;
 
 void (*mach_sched_init) (irq_handler_t handler) __initdata = NULL;
 /* machine dependent irq functions */
@@ -143,11 +144,16 @@ extern void paging_init(void);
 
 static void __init m68k_parse_bootinfo(const struct bi_record *record)
 {
-       while (record->tag != BI_LAST) {
+       uint16_t tag;
+
+       save_bootinfo(record);
+
+       while ((tag = be16_to_cpu(record->tag)) != BI_LAST) {
                int unknown = 0;
-               const unsigned long *data = record->data;
+               const void *data = record->data;
+               uint16_t size = be16_to_cpu(record->size);
 
-               switch (record->tag) {
+               switch (tag) {
                case BI_MACHTYPE:
                case BI_CPUTYPE:
                case BI_FPUTYPE:
@@ -157,20 +163,27 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
 
                case BI_MEMCHUNK:
                        if (m68k_num_memory < NUM_MEMINFO) {
-                               m68k_memory[m68k_num_memory].addr = data[0];
-                               m68k_memory[m68k_num_memory].size = data[1];
+                               const struct mem_info *m = data;
+                               m68k_memory[m68k_num_memory].addr =
+                                       be32_to_cpu(m->addr);
+                               m68k_memory[m68k_num_memory].size =
+                                       be32_to_cpu(m->size);
                                m68k_num_memory++;
                        } else
-                               printk("m68k_parse_bootinfo: too many memory chunks\n");
+                               pr_warn("%s: too many memory chunks\n",
+                                       __func__);
                        break;
 
                case BI_RAMDISK:
-                       m68k_ramdisk.addr = data[0];
-                       m68k_ramdisk.size = data[1];
+                       {
+                               const struct mem_info *m = data;
+                               m68k_ramdisk.addr = be32_to_cpu(m->addr);
+                               m68k_ramdisk.size = be32_to_cpu(m->size);
+                       }
                        break;
 
                case BI_COMMAND_LINE:
-                       strlcpy(m68k_command_line, (const char *)data,
+                       strlcpy(m68k_command_line, data,
                                sizeof(m68k_command_line));
                        break;
 
@@ -197,17 +210,16 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
                                unknown = 1;
                }
                if (unknown)
-                       printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
-                              record->tag);
-               record = (struct bi_record *)((unsigned long)record +
-                                             record->size);
+                       pr_warn("%s: unknown tag 0x%04x ignored\n", __func__,
+                               tag);
+               record = (struct bi_record *)((unsigned long)record + size);
        }
 
        m68k_realnum_memory = m68k_num_memory;
 #ifdef CONFIG_SINGLE_MEMORY_CHUNK
        if (m68k_num_memory > 1) {
-               printk("Ignoring last %i chunks of physical memory\n",
-                      (m68k_num_memory - 1));
+               pr_warn("%s: ignoring last %i chunks of physical memory\n",
+                       __func__, (m68k_num_memory - 1));
                m68k_num_memory = 1;
        }
 #endif
@@ -219,7 +231,7 @@ void __init setup_arch(char **cmdline_p)
        int i;
 #endif
 
-       /* The bootinfo is located right after the kernel bss */
+       /* The bootinfo is located right after the kernel */
        if (!CPU_IS_COLDFIRE)
                m68k_parse_bootinfo((const struct bi_record *)_end);
 
@@ -247,7 +259,7 @@ void __init setup_arch(char **cmdline_p)
                asm (".chip 68060; movec %%pcr,%0; .chip 68k"
                     : "=d" (pcr));
                if (((pcr >> 8) & 0xff) <= 5) {
-                       printk("Enabling workaround for errata I14\n");
+                       pr_warn("Enabling workaround for errata I14\n");
                        asm (".chip 68060; movec %0,%%pcr; .chip 68k"
                             : : "d" (pcr | 0x20));
                }
@@ -336,12 +348,12 @@ void __init setup_arch(char **cmdline_p)
                panic("No configuration setup");
        }
 
+       paging_init();
+
 #ifdef CONFIG_NATFEAT
        nf_init();
 #endif
 
-       paging_init();
-
 #ifndef CONFIG_SUN3
        for (i = 1; i < m68k_num_memory; i++)
                free_bootmem_node(NODE_DATA(i), m68k_memory[i].addr,
@@ -353,7 +365,7 @@ void __init setup_arch(char **cmdline_p)
                                     BOOTMEM_DEFAULT);
                initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
                initrd_end = initrd_start + m68k_ramdisk.size;
-               printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
+               pr_info("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
        }
 #endif
 
@@ -538,9 +550,9 @@ void check_bugs(void)
 {
 #ifndef CONFIG_M68KFPU_EMU
        if (m68k_fputype == 0) {
-               printk(KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
+               pr_emerg("*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
                        "WHICH IS REQUIRED BY LINUX/M68K ***\n");
-               printk(KERN_EMERG "Upgrade your hardware or join the FPU "
+               pr_emerg("Upgrade your hardware or join the FPU "
                        "emulation project\n");
                panic("no FPU");
        }
index 7eb9792009f8994d4bddd0566b6da18649318cb1..958f1adb9d0c421eeec89d1cdbdf62361a866326 100644 (file)
 #include <linux/timex.h>
 #include <linux/profile.h>
 
+
+unsigned long (*mach_random_get_entropy)(void);
+
+
 /*
  * timer_interrupt() needs to keep up the real-time clock,
  * as well as call the "xtime_update()" routine every clocktick
index afb95d5fb26b3b29b172d730d8b5bacc4c3c664a..982c3fe73c4a45b45eeeff08e8d8446a47151c16 100644 (file)
 #include <linux/adb.h>
 #include <linux/cuda.h>
 
-#define BOOTINFO_COMPAT_1_0
 #include <asm/setup.h>
 #include <asm/bootinfo.h>
+#include <asm/bootinfo-mac.h>
+#include <asm/byteorder.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -107,45 +108,46 @@ static void __init mac_sched_init(irq_handler_t vector)
 int __init mac_parse_bootinfo(const struct bi_record *record)
 {
        int unknown = 0;
-       const u_long *data = record->data;
+       const void *data = record->data;
 
-       switch (record->tag) {
+       switch (be16_to_cpu(record->tag)) {
        case BI_MAC_MODEL:
-               mac_bi_data.id = *data;
+               mac_bi_data.id = be32_to_cpup(data);
                break;
        case BI_MAC_VADDR:
-               mac_bi_data.videoaddr = *data;
+               mac_bi_data.videoaddr = be32_to_cpup(data);
                break;
        case BI_MAC_VDEPTH:
-               mac_bi_data.videodepth = *data;
+               mac_bi_data.videodepth = be32_to_cpup(data);
                break;
        case BI_MAC_VROW:
-               mac_bi_data.videorow = *data;
+               mac_bi_data.videorow = be32_to_cpup(data);
                break;
        case BI_MAC_VDIM:
-               mac_bi_data.dimensions = *data;
+               mac_bi_data.dimensions = be32_to_cpup(data);
                break;
        case BI_MAC_VLOGICAL:
-               mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
-               mac_orig_videoaddr = *data;
+               mac_orig_videoaddr = be32_to_cpup(data);
+               mac_bi_data.videological =
+                       VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
                break;
        case BI_MAC_SCCBASE:
-               mac_bi_data.sccbase = *data;
+               mac_bi_data.sccbase = be32_to_cpup(data);
                break;
        case BI_MAC_BTIME:
-               mac_bi_data.boottime = *data;
+               mac_bi_data.boottime = be32_to_cpup(data);
                break;
        case BI_MAC_GMTBIAS:
-               mac_bi_data.gmtbias = *data;
+               mac_bi_data.gmtbias = be32_to_cpup(data);
                break;
        case BI_MAC_MEMSIZE:
-               mac_bi_data.memsize = *data;
+               mac_bi_data.memsize = be32_to_cpup(data);
                break;
        case BI_MAC_CPUID:
-               mac_bi_data.cpuid = *data;
+               mac_bi_data.cpuid = be32_to_cpup(data);
                break;
        case BI_MAC_ROMBASE:
-               mac_bi_data.rombase = *data;
+               mac_bi_data.rombase = be32_to_cpup(data);
                break;
        default:
                unknown = 1;
index 7d8d46127ad9fc91717dcb660ac9647d0b9708e4..4d2adfb32a2ab4f61951357114a8d053bf74de82 100644 (file)
 #include <linux/init.h>
 #include <linux/interrupt.h>
 
-#include <asm/bootinfo.h>
 #include <asm/macintosh.h>
 #include <asm/macints.h>
 #include <asm/mac_iop.h>
 
 /*#define DEBUG_IOP*/
 
-/* Set to non-zero if the IOPs are present. Set by iop_init() */
+/* Non-zero if the IOPs are present */
 
-int iop_scc_present,iop_ism_present;
+int iop_scc_present, iop_ism_present;
 
 /* structure for tracking channel listeners */
 
index 5e085554ac7f2bb9f0c3a964a30f001049804f8a..707b61aea2030c8f7de9058a2546a8eb85ce1639 100644 (file)
@@ -25,8 +25,6 @@
 #include <asm/mac_via.h>
 #include <asm/mac_oss.h>
 
-#define BOOTINFO_COMPAT_1_0
-#include <asm/bootinfo.h>
 #include <asm/machdep.h>
 
 /* Offset between Unix time (1970-based) and Mac time (1904-based) */
index 6c4c882c126e826e2d1b114f39acaf3e8b9ddc15..54037125ebf8c0e05c82cb937cb2560a7575244d 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/init.h>
 #include <linux/irq.h>
 
-#include <asm/bootinfo.h>
 #include <asm/macintosh.h>
 #include <asm/macints.h>
 #include <asm/mac_via.h>
index 6f026fc302fab3ca70f6e05386a732ac52e1d985..835fa04511c85ad0d6e71ba8ee1f3a2dc26fcc1b 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/irq.h>
 
 #include <asm/traps.h>
-#include <asm/bootinfo.h>
 #include <asm/macintosh.h>
 #include <asm/macints.h>
 #include <asm/mac_psc.h>
@@ -54,7 +53,7 @@ static void psc_debug_dump(void)
  * expanded to cover what I think are the other 7 channels.
  */
 
-static void psc_dma_die_die_die(void)
+static __init void psc_dma_die_die_die(void)
 {
        int i;
 
index 5d1458bb871b8bd5e55eb25c5501067adef4810b..e198dec868e472e802768c5a9459e498e7623b00 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/module.h>
 #include <linux/irq.h>
 
-#include <asm/bootinfo.h>
 #include <asm/macintosh.h>
 #include <asm/macints.h>
 #include <asm/mac_via.h>
index 6b4baa6e4d31d8f24e09950d581f6ae9ab1cc6dd..acaff6a49e357e89154651f6ec57db9ab53f0459 100644 (file)
@@ -59,7 +59,7 @@ EXPORT_SYMBOL(pg_data_table);
 void __init m68k_setup_node(int node)
 {
 #ifndef CONFIG_SINGLE_MEMORY_CHUNK
-       struct mem_info *info = m68k_memory + node;
+       struct m68k_mem_info *info = m68k_memory + node;
        int i, end;
 
        i = (unsigned long)phys_to_virt(info->addr) >> __virt_to_node_shift();
index 251c5437787be6054086b4d5586adfc0887e0472..7d4024432163ffa534665582fcf522ed4e9ea51f 100644 (file)
@@ -233,7 +233,7 @@ void __init paging_init(void)
                        printk("Fix your bootloader or use a memfile to make use of this area!\n");
                        m68k_num_memory--;
                        memmove(m68k_memory + i, m68k_memory + i + 1,
-                               (m68k_num_memory - i) * sizeof(struct mem_info));
+                               (m68k_num_memory - i) * sizeof(struct m68k_mem_info));
                        continue;
                }
                addr = m68k_memory[i].addr + m68k_memory[i].size;
index 1c6262803b9455d46fbde9b05587fc910b1687f5..1bb3ce6634d36630d4ad82e34e91cc45de83da97 100644 (file)
@@ -26,6 +26,8 @@
 #include <linux/interrupt.h>
 
 #include <asm/bootinfo.h>
+#include <asm/bootinfo-vme.h>
+#include <asm/byteorder.h>
 #include <asm/pgtable.h>
 #include <asm/setup.h>
 #include <asm/irq.h>
@@ -51,9 +53,10 @@ static int bcd2int (unsigned char b);
 irq_handler_t tick_handler;
 
 
-int mvme147_parse_bootinfo(const struct bi_record *bi)
+int __init mvme147_parse_bootinfo(const struct bi_record *bi)
 {
-       if (bi->tag == BI_VME_TYPE || bi->tag == BI_VME_BRDINFO)
+       uint16_t tag = be16_to_cpu(bi->tag);
+       if (tag == BI_VME_TYPE || tag == BI_VME_BRDINFO)
                return 0;
        else
                return 1;
index 080a342458a1934162aa61f44d72d59dfc1afbd9..eab7d342757ef6abdf01e13ff1a199209381c81d 100644 (file)
@@ -29,6 +29,8 @@
 #include <linux/module.h>
 
 #include <asm/bootinfo.h>
+#include <asm/bootinfo-vme.h>
+#include <asm/byteorder.h>
 #include <asm/pgtable.h>
 #include <asm/setup.h>
 #include <asm/irq.h>
@@ -60,9 +62,10 @@ unsigned short mvme16x_config;
 EXPORT_SYMBOL(mvme16x_config);
 
 
-int mvme16x_parse_bootinfo(const struct bi_record *bi)
+int __init mvme16x_parse_bootinfo(const struct bi_record *bi)
 {
-       if (bi->tag == BI_VME_TYPE || bi->tag == BI_VME_BRDINFO)
+       uint16_t tag = be16_to_cpu(bi->tag);
+       if (tag == BI_VME_TYPE || tag == BI_VME_BRDINFO)
                return 0;
        else
                return 1;
@@ -87,15 +90,15 @@ static void mvme16x_get_model(char *model)
     suf[3] = '\0';
     suf[0] = suf[1] ? '-' : '\0';
 
-    sprintf(model, "Motorola MVME%x%s", p->brdno, suf);
+    sprintf(model, "Motorola MVME%x%s", be16_to_cpu(p->brdno), suf);
 }
 
 
 static void mvme16x_get_hardware_list(struct seq_file *m)
 {
-    p_bdid p = &mvme_bdid;
+    uint16_t brdno = be16_to_cpu(mvme_bdid.brdno);
 
-    if (p->brdno == 0x0162 || p->brdno == 0x0172)
+    if (brdno == 0x0162 || brdno == 0x0172)
     {
        unsigned char rev = *(unsigned char *)MVME162_VERSION_REG;
 
@@ -285,6 +288,7 @@ void __init config_mvme16x(void)
 {
     p_bdid p = &mvme_bdid;
     char id[40];
+    uint16_t brdno = be16_to_cpu(p->brdno);
 
     mach_max_dma_address = 0xffffffff;
     mach_sched_init      = mvme16x_sched_init;
@@ -306,18 +310,18 @@ void __init config_mvme16x(void)
     }
     /* Board type is only set by newer versions of vmelilo/tftplilo */
     if (vme_brdtype == 0)
-       vme_brdtype = p->brdno;
+       vme_brdtype = brdno;
 
     mvme16x_get_model(id);
     printk ("\nBRD_ID: %s   BUG %x.%x %02x/%02x/%02x\n", id, p->rev>>4,
                                        p->rev&0xf, p->yr, p->mth, p->day);
-    if (p->brdno == 0x0162 || p->brdno == 0x172)
+    if (brdno == 0x0162 || brdno == 0x172)
     {
        unsigned char rev = *(unsigned char *)MVME162_VERSION_REG;
 
        mvme16x_config = rev | MVME16x_CONFIG_GOT_SCCA;
 
-       printk ("MVME%x Hardware status:\n", p->brdno);
+       printk ("MVME%x Hardware status:\n", brdno);
        printk ("    CPU Type           68%s040\n",
                        rev & MVME16x_CONFIG_GOT_FPU ? "" : "LC");
        printk ("    CPU clock          %dMHz\n",
@@ -347,12 +351,12 @@ void __init config_mvme16x(void)
 
 static irqreturn_t mvme16x_abort_int (int irq, void *dev_id)
 {
-       p_bdid p = &mvme_bdid;
        unsigned long *new = (unsigned long *)vectors;
        unsigned long *old = (unsigned long *)0xffe00000;
        volatile unsigned char uc, *ucp;
+       uint16_t brdno = be16_to_cpu(mvme_bdid.brdno);
 
-       if (p->brdno == 0x0162 || p->brdno == 0x172)
+       if (brdno == 0x0162 || brdno == 0x172)
        {
                ucp = (volatile unsigned char *)0xfff42043;
                uc = *ucp | 8;
@@ -366,7 +370,7 @@ static irqreturn_t mvme16x_abort_int (int irq, void *dev_id)
        *(new+9) = *(old+9);            /* Trace */
        *(new+47) = *(old+47);          /* Trap #15 */
 
-       if (p->brdno == 0x0162 || p->brdno == 0x172)
+       if (brdno == 0x0162 || brdno == 0x172)
                *(new+0x5e) = *(old+0x5e);      /* ABORT switch */
        else
                *(new+0x6e) = *(old+0x6e);      /* ABORT switch */
@@ -381,7 +385,7 @@ static irqreturn_t mvme16x_timer_int (int irq, void *dev_id)
 
 void mvme16x_sched_init (irq_handler_t timer_routine)
 {
-    p_bdid p = &mvme_bdid;
+    uint16_t brdno = be16_to_cpu(mvme_bdid.brdno);
     int irq;
 
     tick_handler = timer_routine;
@@ -394,7 +398,7 @@ void mvme16x_sched_init (irq_handler_t timer_routine)
                                "timer", mvme16x_timer_int))
        panic ("Couldn't register timer int");
 
-    if (p->brdno == 0x0162 || p->brdno == 0x172)
+    if (brdno == 0x0162 || brdno == 0x172)
        irq = MVME162_IRQ_ABORT;
     else
         irq = MVME167_IRQ_ABORT;
index 078bb744b5fe1193232a96999eb85c92b798c04a..e90fe903613ead8ad480797d138f7d566f738f48 100644 (file)
@@ -154,7 +154,7 @@ static unsigned int serports[] =
        0x3f8,0x2f8,0x3e8,0x2e8,0
 };
 
-static void q40_disable_irqs(void)
+static void __init q40_disable_irqs(void)
 {
        unsigned i, j;
 
@@ -198,7 +198,7 @@ void __init config_q40(void)
 }
 
 
-int q40_parse_bootinfo(const struct bi_record *rec)
+int __init q40_parse_bootinfo(const struct bi_record *rec)
 {
        return 1;
 }
index d522eaab45510aacd13b7cdf6e11ff14f88659a0..d95506e06c2ac42b67f9ce634413da8efc50082f 100644 (file)
@@ -7,6 +7,7 @@
  *
  */
 
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/bootmem.h>
@@ -62,10 +63,7 @@ int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
 
 }
 
-void sun3_dvma_init(void)
+void __init sun3_dvma_init(void)
 {
-
        memset(ptelist, 0, sizeof(ptelist));
-
-
 }
index 8edc510a21be663122fc285df8f624cf818d6b7b..3f258e230ba5d0c95806848ef96c64ce1160d479 100644 (file)
@@ -6,6 +6,7 @@
 ** Started 1/16/98 @ 2:22 am
 */
 
+#include <linux/init.h>
 #include <linux/mman.h>
 #include <linux/mm.h>
 #include <linux/kernel.h>
@@ -122,7 +123,7 @@ void print_pte_vaddr (unsigned long vaddr)
 /*
  * Initialise the MMU emulator.
  */
-void mmu_emu_init(unsigned long bootmem_end)
+void __init mmu_emu_init(unsigned long bootmem_end)
 {
        unsigned long seg, num;
        int i,j;
index cab54482ca34b97fa4412eaaaa4a0ee31d173833..b37521a5259ddb7a040d6606fdd24f324f657e8f 100644 (file)
@@ -6,6 +6,8 @@
  * Contains common routines for sun3/sun3x DVMA management.
  */
 
+#include <linux/bootmem.h>
+#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/gfp.h>
@@ -30,7 +32,7 @@ static inline void dvma_unmap_iommu(unsigned long a, int b)
 extern void sun3_dvma_init(void);
 #endif
 
-static unsigned long iommu_use[IOMMU_TOTAL_ENTRIES];
+static unsigned long *iommu_use;
 
 #define dvma_index(baddr) ((baddr - DVMA_START) >> DVMA_PAGE_SHIFT)
 
@@ -245,7 +247,7 @@ static inline int free_baddr(unsigned long baddr)
 
 }
 
-void dvma_init(void)
+void __init dvma_init(void)
 {
 
        struct hole *hole;
@@ -265,7 +267,7 @@ void dvma_init(void)
 
        list_add(&(hole->list), &hole_list);
 
-       memset(iommu_use, 0, sizeof(iommu_use));
+       iommu_use = alloc_bootmem(IOMMU_TOTAL_ENTRIES * sizeof(unsigned long));
 
        dvma_unmap_iommu(DVMA_START, DVMA_SIZE);
 
index a7b7e818d6279450119f4a8da5e76cf1c6746466..0898c3f8150851a34e8c4f54fe8c3d7760497cd4 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
-#include <asm/bootinfo.h>
 #include <asm/setup.h>
 #include <asm/traps.h>
 #include <asm/sun3xprom.h>
index e0373f81a1172fdabc23afc174302a89b2f8814a..1d7e770f7a54bfca3c9382b5fe5b657885037612 100644 (file)
@@ -7,13 +7,11 @@
 
 enum ipi_msg_type {
        IPI_CALL_FUNC,
-       IPI_CALL_FUNC_SINGLE,
        IPI_RESCHEDULE,
 };
 
 extern void arch_send_call_function_single_ipi(int cpu);
 extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
-#define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask
 
 asmlinkage void secondary_start_kernel(void);
 
index db589ad5dbc41e5bb1cb0bc52dfc4faefc9c1820..c700d625067a96cb725064e0c19ceadad078cd6a 100644 (file)
@@ -399,11 +399,6 @@ static int __init dma_alloc_init(void)
                pgd = pgd_offset(&init_mm, CONSISTENT_START);
                pud = pud_alloc(&init_mm, pgd, CONSISTENT_START);
                pmd = pmd_alloc(&init_mm, pud, CONSISTENT_START);
-               if (!pmd) {
-                       pr_err("%s: no pmd tables\n", __func__);
-                       ret = -ENOMEM;
-                       break;
-               }
                WARN_ON(!pmd_none(*pmd));
 
                pte = pte_alloc_kernel(pmd, CONSISTENT_START);
index 7c01131429817ab58ce63490cc97e5dba4f4b4c9..f74008b6da070827893f656857f20e6b8104f045 100644 (file)
@@ -491,7 +491,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
 
 void arch_send_call_function_single_ipi(int cpu)
 {
-       send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
+       send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC);
 }
 
 void show_ipi_list(struct seq_file *p)
@@ -517,11 +517,10 @@ static DEFINE_SPINLOCK(stop_lock);
  *
  *  Bit 0 - Inter-processor function call
  */
-static int do_IPI(struct pt_regs *regs)
+static int do_IPI(void)
 {
        unsigned int cpu = smp_processor_id();
        struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
-       struct pt_regs *old_regs = set_irq_regs(regs);
        unsigned long msgs, nextmsg;
        int handled = 0;
 
@@ -546,10 +545,6 @@ static int do_IPI(struct pt_regs *regs)
                        generic_smp_call_function_interrupt();
                        break;
 
-               case IPI_CALL_FUNC_SINGLE:
-                       generic_smp_call_function_single_interrupt();
-                       break;
-
                default:
                        pr_crit("CPU%u: Unknown IPI message 0x%lx\n",
                                cpu, nextmsg);
@@ -557,8 +552,6 @@ static int do_IPI(struct pt_regs *regs)
                }
        }
 
-       set_irq_regs(old_regs);
-
        return handled;
 }
 
@@ -624,7 +617,7 @@ static void kick_raise_softirq(cpumask_t callmap, unsigned int irq)
 static TBIRES ipi_handler(TBIRES State, int SigNum, int Triggers,
                   int Inst, PTBI pTBI, int *handled)
 {
-       *handled = do_IPI((struct pt_regs *)State.Sig.pCtx);
+       *handled = do_IPI();
 
        return State;
 }
index 40350a3c24e907f01f3c193018abb6a34ee35541..a69eaf2ab1301466c662e27f37837c86d8193d61 100644 (file)
@@ -1,3 +1,5 @@
+KBUILD_DEFCONFIG := mmu_defconfig
+
 ifeq ($(CONFIG_MMU),y)
 UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
 else
index c07ed5d2a82034f11cbadc6e836d4e31761d380f..1b281d3ea734418a0f39d12625e8ac1a749a6b1c 100644 (file)
@@ -16,7 +16,6 @@
 # ifndef __ASSEMBLY__
 extern char _ssbss[], _esbss[];
 extern unsigned long __ivt_start[], __ivt_end[];
-extern char _etext[], _stext[];
 
 extern u32 _fdt_start[], _fdt_end[];
 
index 8de8ebc309f15b0ca080cdf6f7c93e54fd168d74..603e22fec6d5b888d3f164cd08afa0d17ed3b037 100644 (file)
@@ -136,7 +136,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
        lockdep_init();
 
 /* initialize device tree for usage in early_printk */
-       early_init_devtree((void *)_fdt_start);
+       early_init_devtree(_fdt_start);
 
 #ifdef CONFIG_EARLY_PRINTK
        setup_early_printk(NULL);
@@ -152,8 +152,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
        if (fdt)
                pr_info("FDT at 0x%08x\n", fdt);
        else
-               pr_info("Compiled-in FDT at 0x%08x\n",
-                                       (unsigned int)_fdt_start);
+               pr_info("Compiled-in FDT at %p\n", _fdt_start);
 
 #ifdef CONFIG_MTD_UCLINUX
        pr_info("Found romfs @ 0x%08x (0x%08x)\n",
index 638c5db122c924dca997725d58ee0fd34b36fe1b..8c55de42693d2bcd73420654f45bb050c3e2c696 100644 (file)
@@ -44,7 +44,7 @@ static int pvc_line_proc_show(struct seq_file *m, void *v)
 {
        int lineno = *(int *)m->private;
 
-       if (lineno < 0 || lineno > PVC_NLINES) {
+       if (lineno < 0 || lineno >= PVC_NLINES) {
                printk(KERN_WARNING "proc_read_line: invalid lineno %d\n", lineno);
                return 0;
        }
@@ -68,7 +68,7 @@ static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf,
        char kbuf[PVC_LINELEN];
        size_t len;
 
-       BUG_ON(lineno < 0 || lineno > PVC_NLINES);
+       BUG_ON(lineno < 0 || lineno >= PVC_NLINES);
 
        len = min(count, sizeof(kbuf) - 1);
        if (copy_from_user(kbuf, buf, len))
index d8a455ede5a751c8dc31604526e425fb50167ee0..fec8bf97d806422ce76a578c83576733633a9bf6 100644 (file)
@@ -853,37 +853,44 @@ UNHANDLED_EXCEPTION(_vector_0x1f00,0x1f00)
 
 /* ========================================================[ return ] === */
 
+_resume_userspace:
+       DISABLE_INTERRUPTS(r3,r4)
+       l.lwz   r4,TI_FLAGS(r10)
+       l.andi  r13,r4,_TIF_WORK_MASK
+       l.sfeqi r13,0
+       l.bf    _restore_all
+        l.nop
+
 _work_pending:
-       /*
-        * if (current_thread_info->flags & _TIF_NEED_RESCHED)
-        *     schedule();
-        */
-       l.lwz   r5,TI_FLAGS(r10)
-       l.andi  r3,r5,_TIF_NEED_RESCHED
-       l.sfnei r3,0
-       l.bnf   _work_notifysig
+       l.lwz   r5,PT_ORIG_GPR11(r1)
+       l.sfltsi r5,0
+       l.bnf   1f
         l.nop
-       l.jal   schedule
+       l.andi  r5,r5,0
+1:
+       l.jal   do_work_pending
+        l.ori  r3,r1,0                 /* pt_regs */
+
+       l.sfeqi r11,0
+       l.bf    _restore_all
         l.nop
-       l.j     _resume_userspace
+       l.sfltsi r11,0
+       l.bnf   1f
         l.nop
-
-/* Handle pending signals and notify-resume requests.
- * do_notify_resume must be passed the latest pushed pt_regs, not
- * necessarily the "userspace" ones.  Also, pt_regs->syscallno
- * must be set so that the syscall restart functionality works.
- */
-_work_notifysig:
-       l.jal   do_notify_resume
-        l.ori  r3,r1,0           /* pt_regs */
-
-_resume_userspace:
-       DISABLE_INTERRUPTS(r3,r4)
-       l.lwz   r3,TI_FLAGS(r10)
-       l.andi  r3,r3,_TIF_WORK_MASK
-       l.sfnei r3,0
-       l.bf    _work_pending
+       l.and   r11,r11,r0
+       l.ori   r11,r11,__NR_restart_syscall
+       l.j     _syscall_check_trace_enter
         l.nop
+1:
+       l.lwz   r11,PT_ORIG_GPR11(r1)
+       /* Restore arg registers */
+       l.lwz   r3,PT_GPR3(r1)
+       l.lwz   r4,PT_GPR4(r1)
+       l.lwz   r5,PT_GPR5(r1)
+       l.lwz   r6,PT_GPR6(r1)
+       l.lwz   r7,PT_GPR7(r1)
+       l.j     _syscall_check_trace_enter
+        l.lwz  r8,PT_GPR8(r1)
 
 _restore_all:
        RESTORE_ALL
index ae167f7e081aa0368cb571093df8f16a9dcf71d9..66775bc07a8eeb780e65a290247b3156f0a44ccd 100644 (file)
 #include <linux/tracehook.h>
 
 #include <asm/processor.h>
+#include <asm/syscall.h>
 #include <asm/ucontext.h>
 #include <asm/uaccess.h>
 
 #define DEBUG_SIG 0
 
 struct rt_sigframe {
-       struct siginfo *pinfo;
-       void *puc;
        struct siginfo info;
        struct ucontext uc;
        unsigned char retcode[16];      /* trampoline code */
 };
 
-static int restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
+static int restore_sigcontext(struct pt_regs *regs,
+                             struct sigcontext __user *sc)
 {
-       unsigned int err = 0;
+       int err = 0;
 
-       /* Alwys make any pending restarted system call return -EINTR */
+       /* Always make any pending restarted system calls return -EINTR */
        current_thread_info()->restart_block.fn = do_no_restart_syscall;
 
        /*
@@ -53,25 +53,21 @@ static int restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
         * (sc is already checked for VERIFY_READ since the sigframe was
         *  checked in sys_sigreturn previously)
         */
-       if (__copy_from_user(regs, sc->regs.gpr, 32 * sizeof(unsigned long)))
-               goto badframe;
-       if (__copy_from_user(&regs->pc, &sc->regs.pc, sizeof(unsigned long)))
-               goto badframe;
-       if (__copy_from_user(&regs->sr, &sc->regs.sr, sizeof(unsigned long)))
-               goto badframe;
+       err |= __copy_from_user(regs, sc->regs.gpr, 32 * sizeof(unsigned long));
+       err |= __copy_from_user(&regs->pc, &sc->regs.pc, sizeof(unsigned long));
+       err |= __copy_from_user(&regs->sr, &sc->regs.sr, sizeof(unsigned long));
 
        /* make sure the SM-bit is cleared so user-mode cannot fool us */
        regs->sr &= ~SPR_SR_SM;
 
+       regs->orig_gpr11 = -1;  /* Avoid syscall restart checks */
+
        /* TODO: the other ports use regs->orig_XX to disable syscall checks
         * after this completes, but we don't use that mechanism. maybe we can
         * use it now ?
         */
 
        return err;
-
-badframe:
-       return 1;
 }
 
 asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs)
@@ -111,21 +107,18 @@ badframe:
  * Set up a signal frame.
  */
 
-static int setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
-                           unsigned long mask)
+static int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
 {
        int err = 0;
 
        /* copy the regs */
-
+       /* There should be no need to save callee-saved registers here...
+        * ...but we save them anyway.  Revisit this
+        */
        err |= __copy_to_user(sc->regs.gpr, regs, 32 * sizeof(unsigned long));
        err |= __copy_to_user(&sc->regs.pc, &regs->pc, sizeof(unsigned long));
        err |= __copy_to_user(&sc->regs.sr, &regs->sr, sizeof(unsigned long));
 
-       /* then some other stuff */
-
-       err |= __put_user(mask, &sc->oldmask);
-
        return err;
 }
 
@@ -173,55 +166,53 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
  * trampoline which performs the syscall sigreturn, or a provided
  * user-mode trampoline.
  */
-static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
-                         sigset_t *set, struct pt_regs *regs)
+static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
+                         struct pt_regs *regs)
 {
        struct rt_sigframe *frame;
        unsigned long return_ip;
        int err = 0;
 
-       frame = get_sigframe(ka, regs, sizeof(*frame));
+       frame = get_sigframe(&ksig->ka, regs, sizeof(*frame));
 
        if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
-               goto give_sigsegv;
+               return -EFAULT;
 
-       err |= __put_user(&frame->info, &frame->pinfo);
-       err |= __put_user(&frame->uc, &frame->puc);
+       /* Create siginfo.  */
+       if (ksig->ka.sa.sa_flags & SA_SIGINFO)
+               err |= copy_siginfo_to_user(&frame->info, &ksig->info);
 
-       if (ka->sa.sa_flags & SA_SIGINFO)
-               err |= copy_siginfo_to_user(&frame->info, info);
-       if (err)
-               goto give_sigsegv;
-
-       /* Clear all the bits of the ucontext we don't use.  */
-       err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
+       /* Create the ucontext.  */
        err |= __put_user(0, &frame->uc.uc_flags);
        err |= __put_user(NULL, &frame->uc.uc_link);
        err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
-       err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
+       err |= setup_sigcontext(regs, &frame->uc.uc_mcontext);
 
        err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
 
        if (err)
-               goto give_sigsegv;
+               return -EFAULT;
 
        /* trampoline - the desired return ip is the retcode itself */
        return_ip = (unsigned long)&frame->retcode;
-       /* This is l.ori r11,r0,__NR_sigreturn, l.sys 1 */
-       err |= __put_user(0xa960, (short *)(frame->retcode + 0));
-       err |= __put_user(__NR_rt_sigreturn, (short *)(frame->retcode + 2));
+       /* This is:
+               l.ori r11,r0,__NR_sigreturn
+               l.sys 1
+        */
+       err |= __put_user(0xa960,             (short *)(frame->retcode + 0));
+       err |= __put_user(__NR_rt_sigreturn,  (short *)(frame->retcode + 2));
        err |= __put_user(0x20000001, (unsigned long *)(frame->retcode + 4));
        err |= __put_user(0x15000000, (unsigned long *)(frame->retcode + 8));
 
        if (err)
-               goto give_sigsegv;
+               return -EFAULT;
 
        /* TODO what is the current->exec_domain stuff and invmap ? */
 
        /* Set up registers for signal handler */
-       regs->pc = (unsigned long)ka->sa.sa_handler; /* what we enter NOW */
+       regs->pc = (unsigned long)ksig->ka.sa.sa_handler; /* what we enter NOW */
        regs->gpr[9] = (unsigned long)return_ip;     /* what we enter LATER */
-       regs->gpr[3] = (unsigned long)sig;           /* arg 1: signo */
+       regs->gpr[3] = (unsigned long)ksig->sig;           /* arg 1: signo */
        regs->gpr[4] = (unsigned long)&frame->info;  /* arg 2: (siginfo_t*) */
        regs->gpr[5] = (unsigned long)&frame->uc;    /* arg 3: ucontext */
 
@@ -229,25 +220,16 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
        regs->sp = (unsigned long)frame;
 
        return 0;
-
-give_sigsegv:
-       force_sigsegv(sig, current);
-       return -EFAULT;
 }
 
 static inline void
-handle_signal(unsigned long sig,
-             siginfo_t *info, struct k_sigaction *ka,
-             struct pt_regs *regs)
+handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 {
        int ret;
 
-       ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs);
-       if (ret)
-               return;
+       ret = setup_rt_frame(ksig, sigmask_to_save(), regs);
 
-       signal_delivered(sig, info, ka, regs,
-                                test_thread_flag(TIF_SINGLESTEP));
+       signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP));
 }
 
 /*
@@ -262,82 +244,99 @@ handle_signal(unsigned long sig,
  * mode below.
  */
 
-void do_signal(struct pt_regs *regs)
+int do_signal(struct pt_regs *regs, int syscall)
 {
-       siginfo_t info;
-       int signr;
-       struct k_sigaction ka;
-
-       /*
-        * We want the common case to go fast, which
-        * is why we may in certain cases get here from
-        * kernel mode. Just return without doing anything
-        * if so.
-        */
-       if (!user_mode(regs))
-               return;
-
-       signr = get_signal_to_deliver(&info, &ka, regs, NULL);
-
-       /* If we are coming out of a syscall then we need
-        * to check if the syscall was interrupted and wants to be
-        * restarted after handling the signal.  If so, the original
-        * syscall number is put back into r11 and the PC rewound to
-        * point at the l.sys instruction that resulted in the
-        * original syscall.  Syscall results other than the four
-        * below mean that the syscall executed to completion and no
-        * restart is necessary.
-        */
-       if (regs->orig_gpr11) {
-               int restart = 0;
-
-               switch (regs->gpr[11]) {
+       struct ksignal ksig;
+       unsigned long continue_addr = 0;
+       unsigned long restart_addr = 0;
+       unsigned long retval = 0;
+       int restart = 0;
+
+       if (syscall) {
+               continue_addr = regs->pc;
+               restart_addr = continue_addr - 4;
+               retval = regs->gpr[11];
+
+               /*
+                * Setup syscall restart here so that a debugger will
+                * see the already changed PC.
+                */
+               switch (retval) {
                case -ERESTART_RESTARTBLOCK:
+                       restart = -2;
+                       /* Fall through */
                case -ERESTARTNOHAND:
-                       /* Restart if there is no signal handler */
-                       restart = (signr <= 0);
-                       break;
                case -ERESTARTSYS:
-                       /* Restart if there no signal handler or
-                        * SA_RESTART flag is set */
-                       restart = (signr <= 0 || (ka.sa.sa_flags & SA_RESTART));
-                       break;
                case -ERESTARTNOINTR:
-                       /* Always restart */
-                       restart = 1;
+                       restart++;
+                       regs->gpr[11] = regs->orig_gpr11;
+                       regs->pc = restart_addr;
                        break;
                }
-
-               if (restart) {
-                       if (regs->gpr[11] == -ERESTART_RESTARTBLOCK)
-                               regs->gpr[11] = __NR_restart_syscall;
-                       else
-                               regs->gpr[11] = regs->orig_gpr11;
-                       regs->pc -= 4;
-               } else {
-                       regs->gpr[11] = -EINTR;
-               }
        }
 
-       if (signr <= 0) {
-               /* no signal to deliver so we just put the saved sigmask
-                * back */
+       /*
+        * Get the signal to deliver.  During the call to get_signal the
+        * debugger may change all our registers so we may need to revert
+        * the decision to restart the syscall; specifically, if the PC is
+        * changed, don't restart the syscall.
+        */
+       if (get_signal(&ksig)) {
+               if (unlikely(restart) && regs->pc == restart_addr) {
+                       if (retval == -ERESTARTNOHAND ||
+                           retval == -ERESTART_RESTARTBLOCK
+                           || (retval == -ERESTARTSYS
+                               && !(ksig.ka.sa.sa_flags & SA_RESTART))) {
+                               /* No automatic restart */
+                               regs->gpr[11] = -EINTR;
+                               regs->pc = continue_addr;
+                       }
+               }
+               handle_signal(&ksig, regs);
+       } else {
+               /* no handler */
                restore_saved_sigmask();
-       } else {                /* signr > 0 */
-               /* Whee!  Actually deliver the signal.  */
-               handle_signal(signr, &info, &ka, regs);
+               /*
+                * Restore pt_regs PC as syscall restart will be handled by
+                * kernel without return to userspace
+                */
+               if (unlikely(restart) && regs->pc == restart_addr) {
+                       regs->pc = continue_addr;
+                       return restart;
+               }
        }
 
-       return;
+       return 0;
 }
 
-asmlinkage void do_notify_resume(struct pt_regs *regs)
+asmlinkage int
+do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
 {
-       if (current_thread_info()->flags & _TIF_SIGPENDING)
-               do_signal(regs);
-
-       if (current_thread_info()->flags & _TIF_NOTIFY_RESUME) {
-               clear_thread_flag(TIF_NOTIFY_RESUME);
-               tracehook_notify_resume(regs);
-       }
+       do {
+               if (likely(thread_flags & _TIF_NEED_RESCHED)) {
+                       schedule();
+               } else {
+                       if (unlikely(!user_mode(regs)))
+                               return 0;
+                       local_irq_enable();
+                       if (thread_flags & _TIF_SIGPENDING) {
+                               int restart = do_signal(regs, syscall);
+                               if (unlikely(restart)) {
+                                       /*
+                                        * Restart without handlers.
+                                        * Deal with it without leaving
+                                        * the kernel space.
+                                        */
+                                       return restart;
+                               }
+                               syscall = 0;
+                       } else {
+                               clear_thread_flag(TIF_NOTIFY_RESUME);
+                               tracehook_notify_resume(regs);
+                       }
+               }
+               local_irq_disable();
+               thread_flags = current_thread_info()->flags;
+       } while (thread_flags & _TIF_WORK_MASK);
+       return 0;
 }
index b44b52c0a8f07d2854d5a21ca6fb2ecf409409c1..d054b29410cf6b3ca9a1a32e3f831b6b24ca67f3 100644 (file)
@@ -379,6 +379,12 @@ config ARCH_HAS_WALK_MEMORY
 config ARCH_ENABLE_MEMORY_HOTREMOVE
        def_bool y
 
+config PPC64_SUPPORTS_MEMORY_FAILURE
+       bool "Add support for memory hwpoison"
+       depends on PPC_BOOK3S_64
+       default "y" if PPC_POWERNV
+       select ARCH_SUPPORTS_MEMORY_FAILURE
+
 config KEXEC
        bool "kexec system call"
        depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP))
@@ -1037,11 +1043,6 @@ config KEYS_COMPAT
 
 source "crypto/Kconfig"
 
-config PPC_CLOCK
-       bool
-       default n
-       select HAVE_CLK
-
 config PPC_LIB_RHEAP
        bool
 
index 554734ff302e89234c0d3ae51d1f11a840119c57..d61c03525777ce3cdaeab8a294fb6083e64cfe81 100644 (file)
@@ -16,6 +16,7 @@ mktree
 uImage
 cuImage.*
 dtbImage.*
+*.dtb
 treeImage.*
 zImage
 zImage.initrd
index a543c4088cba1ea026062a45df2c4ca0c95648ab..a1b883730b3169d8171c06c4fdc2d50cfe874b41 100644 (file)
                };
        };
 
+       clocks {
+               osc {
+                       clock-frequency = <25000000>;
+               };
+       };
+
        soc@80000000 {
+               bus-frequency = <80000000>;     /* 80 MHz ips bus */
 
                clock@f00 {
                        compatible = "fsl,mpc5121rev2-clock", "fsl,mpc5121-clock";
index 1613d6e4049eb2ba22aeceef97e8e57110620713..5ba7f01e2a297878251001d427bf498bdd94397c 100644 (file)
 
                MSI: ppc4xx-msi@C10000000 {
                        compatible = "amcc,ppc4xx-msi", "ppc4xx-msi";
-                       reg = < 0x0 0xEF620000 0x100>;
+                       reg = <0xEF620000 0x100>;
                        sdr-base = <0x4B0>;
                        msi-data = <0x00000000>;
                        msi-mask = <0x44440000>;
index bd14c00e5146b31a90c8913e2b605c06d40184f1..2c0e1552d20bb9a410ab6c27762d676e6e7f5b9e 100644 (file)
@@ -9,6 +9,8 @@
  * option) any later version.
  */
 
+#include <dt-bindings/clock/mpc512x-clock.h>
+
 /dts-v1/;
 
 / {
                compatible = "fsl,mpc5121-mbx";
                reg = <0x20000000 0x4000>;
                interrupts = <66 0x8>;
+               clocks = <&clks MPC512x_CLK_MBX_BUS>,
+                        <&clks MPC512x_CLK_MBX_3D>,
+                        <&clks MPC512x_CLK_MBX>;
+               clock-names = "mbx-bus", "mbx-3d", "mbx";
        };
 
        sram@30000000 {
@@ -62,6 +68,8 @@
                interrupts = <6 8>;
                #address-cells = <1>;
                #size-cells = <1>;
+               clocks = <&clks MPC512x_CLK_NFC>;
+               clock-names = "ipg";
        };
 
        localbus@80000020 {
                ranges = <0x0 0x0 0xfc000000 0x04000000>;
        };
 
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               osc: osc {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <33000000>;
+               };
+       };
+
        soc@80000000 {
                compatible = "fsl,mpc5121-immr";
                #address-cells = <1>;
                #size-cells = <1>;
-               #interrupt-cells = <2>;
                ranges = <0x0 0x80000000 0x400000>;
                reg = <0x80000000 0x400000>;
                bus-frequency = <66000000>;     /* 66 MHz ips bus */
                };
 
                /* Clock control */
-               clock@f00 {
+               clks: clock@f00 {
                        compatible = "fsl,mpc5121-clock";
                        reg = <0xf00 0x100>;
+                       #clock-cells = <1>;
+                       clocks = <&osc>;
+                       clock-names = "osc";
                };
 
                /* Power Management Controller */
                        compatible = "fsl,mpc5121-mscan";
                        reg = <0x1300 0x80>;
                        interrupts = <12 0x8>;
+                       clocks = <&clks MPC512x_CLK_BDLC>,
+                                <&clks MPC512x_CLK_IPS>,
+                                <&clks MPC512x_CLK_SYS>,
+                                <&clks MPC512x_CLK_REF>,
+                                <&clks MPC512x_CLK_MSCAN0_MCLK>;
+                       clock-names = "ipg", "ips", "sys", "ref", "mclk";
                };
 
                can@1380 {
                        compatible = "fsl,mpc5121-mscan";
                        reg = <0x1380 0x80>;
                        interrupts = <13 0x8>;
+                       clocks = <&clks MPC512x_CLK_BDLC>,
+                                <&clks MPC512x_CLK_IPS>,
+                                <&clks MPC512x_CLK_SYS>,
+                                <&clks MPC512x_CLK_REF>,
+                                <&clks MPC512x_CLK_MSCAN1_MCLK>;
+                       clock-names = "ipg", "ips", "sys", "ref", "mclk";
                };
 
                sdhc@1500 {
                        interrupts = <8 0x8>;
                        dmas = <&dma0 30>;
                        dma-names = "rx-tx";
+                       clocks = <&clks MPC512x_CLK_IPS>,
+                                <&clks MPC512x_CLK_SDHC>;
+                       clock-names = "ipg", "per";
                };
 
                i2c@1700 {
                        compatible = "fsl,mpc5121-i2c", "fsl-i2c";
                        reg = <0x1700 0x20>;
                        interrupts = <9 0x8>;
+                       clocks = <&clks MPC512x_CLK_I2C>;
+                       clock-names = "ipg";
                };
 
                i2c@1720 {
                        compatible = "fsl,mpc5121-i2c", "fsl-i2c";
                        reg = <0x1720 0x20>;
                        interrupts = <10 0x8>;
+                       clocks = <&clks MPC512x_CLK_I2C>;
+                       clock-names = "ipg";
                };
 
                i2c@1740 {
                        compatible = "fsl,mpc5121-i2c", "fsl-i2c";
                        reg = <0x1740 0x20>;
                        interrupts = <11 0x8>;
+                       clocks = <&clks MPC512x_CLK_I2C>;
+                       clock-names = "ipg";
                };
 
                i2ccontrol@1760 {
                        compatible = "fsl,mpc5121-axe";
                        reg = <0x2000 0x100>;
                        interrupts = <42 0x8>;
+                       clocks = <&clks MPC512x_CLK_AXE>;
+                       clock-names = "ipg";
                };
 
                display@2100 {
                        compatible = "fsl,mpc5121-diu";
                        reg = <0x2100 0x100>;
                        interrupts = <64 0x8>;
+                       clocks = <&clks MPC512x_CLK_DIU>;
+                       clock-names = "ipg";
                };
 
                can@2300 {
                        compatible = "fsl,mpc5121-mscan";
                        reg = <0x2300 0x80>;
                        interrupts = <90 0x8>;
+                       clocks = <&clks MPC512x_CLK_BDLC>,
+                                <&clks MPC512x_CLK_IPS>,
+                                <&clks MPC512x_CLK_SYS>,
+                                <&clks MPC512x_CLK_REF>,
+                                <&clks MPC512x_CLK_MSCAN2_MCLK>;
+                       clock-names = "ipg", "ips", "sys", "ref", "mclk";
                };
 
                can@2380 {
                        compatible = "fsl,mpc5121-mscan";
                        reg = <0x2380 0x80>;
                        interrupts = <91 0x8>;
+                       clocks = <&clks MPC512x_CLK_BDLC>,
+                                <&clks MPC512x_CLK_IPS>,
+                                <&clks MPC512x_CLK_SYS>,
+                                <&clks MPC512x_CLK_REF>,
+                                <&clks MPC512x_CLK_MSCAN3_MCLK>;
+                       clock-names = "ipg", "ips", "sys", "ref", "mclk";
                };
 
                viu@2400 {
                        compatible = "fsl,mpc5121-viu";
                        reg = <0x2400 0x400>;
                        interrupts = <67 0x8>;
+                       clocks = <&clks MPC512x_CLK_VIU>;
+                       clock-names = "ipg";
                };
 
                mdio@2800 {
                        reg = <0x2800 0x800>;
                        #address-cells = <1>;
                        #size-cells = <0>;
+                       clocks = <&clks MPC512x_CLK_FEC>;
+                       clock-names = "per";
                };
 
                eth0: ethernet@2800 {
                        reg = <0x2800 0x800>;
                        local-mac-address = [ 00 00 00 00 00 00 ];
                        interrupts = <4 0x8>;
+                       clocks = <&clks MPC512x_CLK_FEC>;
+                       clock-names = "per";
                };
 
                /* USB1 using external ULPI PHY */
                        interrupts = <43 0x8>;
                        dr_mode = "otg";
                        phy_type = "ulpi";
+                       clocks = <&clks MPC512x_CLK_USB1>;
+                       clock-names = "ipg";
                };
 
                /* USB0 using internal UTMI PHY */
                        interrupts = <44 0x8>;
                        dr_mode = "otg";
                        phy_type = "utmi_wide";
+                       clocks = <&clks MPC512x_CLK_USB2>;
+                       clock-names = "ipg";
                };
 
                /* IO control */
                        compatible = "fsl,mpc5121-pata";
                        reg = <0x10200 0x100>;
                        interrupts = <5 0x8>;
+                       clocks = <&clks MPC512x_CLK_PATA>;
+                       clock-names = "ipg";
                };
 
                /* 512x PSCs are not 52xx PSC compatible */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC0>,
+                                <&clks MPC512x_CLK_PSC0_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                /* PSC1 */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC1>,
+                                <&clks MPC512x_CLK_PSC1_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                /* PSC2 */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC2>,
+                                <&clks MPC512x_CLK_PSC2_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                /* PSC3 */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC3>,
+                                <&clks MPC512x_CLK_PSC3_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                /* PSC4 */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC4>,
+                                <&clks MPC512x_CLK_PSC4_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                /* PSC5 */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC5>,
+                                <&clks MPC512x_CLK_PSC5_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                /* PSC6 */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC6>,
+                                <&clks MPC512x_CLK_PSC6_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                /* PSC7 */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC7>,
+                                <&clks MPC512x_CLK_PSC7_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                /* PSC8 */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC8>,
+                                <&clks MPC512x_CLK_PSC8_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                /* PSC9 */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC9>,
+                                <&clks MPC512x_CLK_PSC9_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                /* PSC10 */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC10>,
+                                <&clks MPC512x_CLK_PSC10_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                /* PSC11 */
                        interrupts = <40 0x8>;
                        fsl,rx-fifo-size = <16>;
                        fsl,tx-fifo-size = <16>;
+                       clocks = <&clks MPC512x_CLK_PSC11>,
+                                <&clks MPC512x_CLK_PSC11_MCLK>;
+                       clock-names = "ipg", "mclk";
                };
 
                pscfifo@11f00 {
                        compatible = "fsl,mpc5121-psc-fifo";
                        reg = <0x11f00 0x100>;
                        interrupts = <40 0x8>;
+                       clocks = <&clks MPC512x_CLK_PSC_FIFO>;
+                       clock-names = "ipg";
                };
 
                dma0: dma@14000 {
                #address-cells = <3>;
                #size-cells = <2>;
                #interrupt-cells = <1>;
+               clocks = <&clks MPC512x_CLK_PCI>;
+               clock-names = "ipg";
 
                reg = <0x80008500 0x100 /* internal registers */
                       0x80008300 0x8>; /* config space access registers */
index fc7073bc547efaa4e196a80d08be24155fea9695..391a4e299783d84830002c95535bd9a5c6d9c848 100644 (file)
                        #size-cells = <1>;
                        compatible = "xlnx,compound";
                        ethernet@81c00000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
                                compatible = "xlnx,xps-ll-temac-1.01.b";
                                device_type = "network";
                                interrupt-parent = <&xps_intc_0>;
index 910194e9a1e2a2eab5f64d05be6cf9a522cb33a0..a5e9a7d494d8bd685104397bff26d0265dc15e54 100644 (file)
 #include <asm/asm-compat.h>
 #include <asm/synch.h>
 
+/* PPC bit number conversion */
+#define PPC_BITLSHIFT(be)      (BITS_PER_LONG - 1 - (be))
+#define PPC_BIT(bit)           (1UL << PPC_BITLSHIFT(bit))
+#define PPC_BITMASK(bs, be)    ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs))
+
 /*
  * clear_bit doesn't imply a memory barrier
  */
index 9e495c9a6a889d68bca11e1575ee82c3422b7348..ed0afc1e44a43324a31fb59994b42a768ecb8e33 100644 (file)
@@ -41,8 +41,20 @@ struct ppc64_caches {
 extern struct ppc64_caches ppc64_caches;
 #endif /* __powerpc64__ && ! __ASSEMBLY__ */
 
-#if !defined(__ASSEMBLY__)
+#if defined(__ASSEMBLY__)
+/*
+ * For a snooping icache, we still need a dummy icbi to purge all the
+ * prefetched instructions from the ifetch buffers. We also need a sync
+ * before the icbi to order the the actual stores to memory that might
+ * have modified instructions with the icbi.
+ */
+#define PURGE_PREFETCHED_INS   \
+       sync;                   \
+       icbi    0,r3;           \
+       sync;                   \
+       isync
 
+#else
 #define __read_mostly __attribute__((__section__(".data..read_mostly")))
 
 #ifdef CONFIG_6xx
diff --git a/arch/powerpc/include/asm/clk_interface.h b/arch/powerpc/include/asm/clk_interface.h
deleted file mode 100644 (file)
index ab1882c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __ASM_POWERPC_CLK_INTERFACE_H
-#define __ASM_POWERPC_CLK_INTERFACE_H
-
-#include <linux/clk.h>
-
-struct clk_interface {
-       struct clk*     (*clk_get)      (struct device *dev, const char *id);
-       int             (*clk_enable)   (struct clk *clk);
-       void            (*clk_disable)  (struct clk *clk);
-       unsigned long   (*clk_get_rate) (struct clk *clk);
-       void            (*clk_put)      (struct clk *clk);
-       long            (*clk_round_rate) (struct clk *clk, unsigned long rate);
-       int             (*clk_set_rate) (struct clk *clk, unsigned long rate);
-       int             (*clk_set_parent) (struct clk *clk, struct clk *parent);
-       struct clk*     (*clk_get_parent) (struct clk *clk);
-};
-
-extern struct clk_interface clk_functions;
-
-#endif /* __ASM_POWERPC_CLK_INTERFACE_H */
index a6f8c7a5cbb74f61925243a1ca42bc183d80361a..97e02f985df8e47946438ecc1b0ba2f040ee7bf5 100644 (file)
@@ -34,6 +34,13 @@ int instr_is_branch_to_addr(const unsigned int *instr, unsigned long addr);
 unsigned long branch_target(const unsigned int *instr);
 unsigned int translate_branch(const unsigned int *dest,
                              const unsigned int *src);
+#ifdef CONFIG_PPC_BOOK3E_64
+void __patch_exception(int exc, unsigned long addr);
+#define patch_exception(exc, name) do { \
+       extern unsigned int name; \
+       __patch_exception((exc), (unsigned long)&name); \
+} while (0)
+#endif
 
 static inline unsigned long ppc_function_entry(void *func)
 {
index 0d4939ba48e72167a9a496f4f10a805d0badd3eb..617cc767c07681b109c5acd54f667cc3274956b5 100644 (file)
@@ -90,6 +90,18 @@ struct cpu_spec {
         * if the error is fatal, 1 if it was fully recovered and 0 to
         * pass up (not CPU originated) */
        int             (*machine_check)(struct pt_regs *regs);
+
+       /*
+        * Processor specific early machine check handler which is
+        * called in real mode to handle SLB and TLB errors.
+        */
+       long            (*machine_check_early)(struct pt_regs *regs);
+
+       /*
+        * Processor specific routine to flush tlbs.
+        */
+       void            (*flush_tlb)(unsigned long inval_selector);
+
 };
 
 extern struct cpu_spec         *cur_cpu_spec;
index 894662a5d4d5c5aa25f43e30653609d80d901774..ff4e2e80856debaaeda9e72ca35a6a4595dc405e 100644 (file)
@@ -301,9 +301,12 @@ do_kvm_##n:                                                                \
        beq     4f;                     /* if from kernel mode          */ \
        ACCOUNT_CPU_USER_ENTRY(r9, r10);                                   \
        SAVE_PPR(area, r9, r10);                                           \
-4:     std     r2,GPR2(r1);            /* save r2 in stackframe        */ \
-       SAVE_4GPRS(3, r1);              /* save r3 - r6 in stackframe   */ \
-       SAVE_2GPRS(7, r1);              /* save r7, r8 in stackframe    */ \
+4:     EXCEPTION_PROLOG_COMMON_2(area)                                    \
+       EXCEPTION_PROLOG_COMMON_3(n)                                       \
+       ACCOUNT_STOLEN_TIME
+
+/* Save original regs values from save area to stack frame. */
+#define EXCEPTION_PROLOG_COMMON_2(area)                                           \
        ld      r9,area+EX_R9(r13);     /* move r9, r10 to stackframe   */ \
        ld      r10,area+EX_R10(r13);                                      \
        std     r9,GPR9(r1);                                               \
@@ -318,11 +321,16 @@ do_kvm_##n:                                                               \
        ld      r10,area+EX_CFAR(r13);                                     \
        std     r10,ORIG_GPR3(r1);                                         \
        END_FTR_SECTION_NESTED(CPU_FTR_CFAR, CPU_FTR_CFAR, 66);            \
+       GET_CTR(r10, area);                                                \
+       std     r10,_CTR(r1);
+
+#define EXCEPTION_PROLOG_COMMON_3(n)                                      \
+       std     r2,GPR2(r1);            /* save r2 in stackframe        */ \
+       SAVE_4GPRS(3, r1);              /* save r3 - r6 in stackframe   */ \
+       SAVE_2GPRS(7, r1);              /* save r7, r8 in stackframe    */ \
        mflr    r9;                     /* Get LR, later save to stack  */ \
        ld      r2,PACATOC(r13);        /* get kernel TOC into r2       */ \
        std     r9,_LINK(r1);                                              \
-       GET_CTR(r10, area);                                                \
-       std     r10,_CTR(r1);                                              \
        lbz     r10,PACASOFTIRQEN(r13);                            \
        mfspr   r11,SPRN_XER;           /* save XER in stackframe       */ \
        std     r10,SOFTE(r1);                                             \
@@ -332,8 +340,7 @@ do_kvm_##n:                                                         \
        li      r10,0;                                                     \
        ld      r11,exception_marker@toc(r2);                              \
        std     r10,RESULT(r1);         /* clear regs->result           */ \
-       std     r11,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame      */ \
-       ACCOUNT_STOLEN_TIME
+       std     r11,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame      */
 
 /*
  * Exception vectors.
index 3bdcfce2c42a926bebc7c2f580ee720f96350818..418fb654370d09c70837943fe399dba75a10cfd2 100644 (file)
@@ -6,7 +6,8 @@
 
 typedef struct {
        unsigned int __softirq_pending;
-       unsigned int timer_irqs;
+       unsigned int timer_irqs_event;
+       unsigned int timer_irqs_others;
        unsigned int pmu_irqs;
        unsigned int mce_exceptions;
        unsigned int spurious_irqs;
index 575fbf81fad02dcd8e946cecfa9c5d5c35e11810..97d3869991ca691ebf0342b496ebe767aee7492a 100644 (file)
@@ -191,8 +191,24 @@ DEF_MMIO_OUT_D(out_le32, 32, stw);
 
 #endif /* __BIG_ENDIAN */
 
+/*
+ * Cache inhibitied accessors for use in real mode, you don't want to use these
+ * unless you know what you're doing.
+ *
+ * NB. These use the cpu byte ordering.
+ */
+DEF_MMIO_OUT_X(out_rm8,   8, stbcix);
+DEF_MMIO_OUT_X(out_rm16, 16, sthcix);
+DEF_MMIO_OUT_X(out_rm32, 32, stwcix);
+DEF_MMIO_IN_X(in_rm8,   8, lbzcix);
+DEF_MMIO_IN_X(in_rm16, 16, lhzcix);
+DEF_MMIO_IN_X(in_rm32, 32, lwzcix);
+
 #ifdef __powerpc64__
 
+DEF_MMIO_OUT_X(out_rm64, 64, stdcix);
+DEF_MMIO_IN_X(in_rm64, 64, ldcix);
+
 #ifdef __BIG_ENDIAN__
 DEF_MMIO_OUT_D(out_be64, 64, std);
 DEF_MMIO_IN_D(in_be64, 64, ld);
index c34656a8925e2f8c3d64d42f7f4efd79dbe36872..774fa2776907ffc570777dc1207fb24c65aa1270 100644 (file)
@@ -101,8 +101,34 @@ extern void iommu_free_table(struct iommu_table *tbl, const char *node_name);
  */
 extern struct iommu_table *iommu_init_table(struct iommu_table * tbl,
                                            int nid);
+#ifdef CONFIG_IOMMU_API
 extern void iommu_register_group(struct iommu_table *tbl,
                                 int pci_domain_number, unsigned long pe_num);
+extern int iommu_add_device(struct device *dev);
+extern void iommu_del_device(struct device *dev);
+#else
+static inline void iommu_register_group(struct iommu_table *tbl,
+                                       int pci_domain_number,
+                                       unsigned long pe_num)
+{
+}
+
+static inline int iommu_add_device(struct device *dev)
+{
+       return 0;
+}
+
+static inline void iommu_del_device(struct device *dev)
+{
+}
+#endif /* !CONFIG_IOMMU_API */
+
+static inline void set_iommu_table_base_and_group(struct device *dev,
+                                                 void *base)
+{
+       set_iommu_table_base(dev, base);
+       iommu_add_device(dev);
+}
 
 extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
                        struct scatterlist *sglist, int nelems,
index 844c28de7ec05e96f4578701a9d46c6dda6d2ecb..d0a2a2f9956471362e13093272955f42c0e4121b 100644 (file)
@@ -132,8 +132,6 @@ struct slb_shadow {
        } save_area[SLB_NUM_BOLTED];
 } ____cacheline_aligned;
 
-extern struct slb_shadow slb_shadow[];
-
 /*
  * Layout of entries in the hypervisor's dispatch trace log buffer.
  */
diff --git a/arch/powerpc/include/asm/mce.h b/arch/powerpc/include/asm/mce.h
new file mode 100644 (file)
index 0000000..a2b8c7b
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ * Machine check exception header file.
+ *
+ * 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.
+ *
+ * Copyright 2013 IBM Corporation
+ * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
+ */
+
+#ifndef __ASM_PPC64_MCE_H__
+#define __ASM_PPC64_MCE_H__
+
+#include <linux/bitops.h>
+
+/*
+ * Machine Check bits on power7 and power8
+ */
+#define P7_SRR1_MC_LOADSTORE(srr1)     ((srr1) & PPC_BIT(42)) /* P8 too */
+
+/* SRR1 bits for machine check (On Power7 and Power8) */
+#define P7_SRR1_MC_IFETCH(srr1)        ((srr1) & PPC_BITMASK(43, 45)) /* P8 too */
+
+#define P7_SRR1_MC_IFETCH_UE           (0x1 << PPC_BITLSHIFT(45)) /* P8 too */
+#define P7_SRR1_MC_IFETCH_SLB_PARITY   (0x2 << PPC_BITLSHIFT(45)) /* P8 too */
+#define P7_SRR1_MC_IFETCH_SLB_MULTIHIT (0x3 << PPC_BITLSHIFT(45)) /* P8 too */
+#define P7_SRR1_MC_IFETCH_SLB_BOTH     (0x4 << PPC_BITLSHIFT(45))
+#define P7_SRR1_MC_IFETCH_TLB_MULTIHIT (0x5 << PPC_BITLSHIFT(45)) /* P8 too */
+#define P7_SRR1_MC_IFETCH_UE_TLB_RELOAD        (0x6 << PPC_BITLSHIFT(45)) /* P8 too */
+#define P7_SRR1_MC_IFETCH_UE_IFU_INTERNAL      (0x7 << PPC_BITLSHIFT(45))
+
+/* SRR1 bits for machine check (On Power8) */
+#define P8_SRR1_MC_IFETCH_ERAT_MULTIHIT        (0x4 << PPC_BITLSHIFT(45))
+
+/* DSISR bits for machine check (On Power7 and Power8) */
+#define P7_DSISR_MC_UE                 (PPC_BIT(48))   /* P8 too */
+#define P7_DSISR_MC_UE_TABLEWALK       (PPC_BIT(49))   /* P8 too */
+#define P7_DSISR_MC_ERAT_MULTIHIT      (PPC_BIT(52))   /* P8 too */
+#define P7_DSISR_MC_TLB_MULTIHIT_MFTLB (PPC_BIT(53))   /* P8 too */
+#define P7_DSISR_MC_SLB_PARITY_MFSLB   (PPC_BIT(55))   /* P8 too */
+#define P7_DSISR_MC_SLB_MULTIHIT       (PPC_BIT(56))   /* P8 too */
+#define P7_DSISR_MC_SLB_MULTIHIT_PARITY        (PPC_BIT(57))   /* P8 too */
+
+/*
+ * DSISR bits for machine check (Power8) in addition to above.
+ * Secondary DERAT Multihit
+ */
+#define P8_DSISR_MC_ERAT_MULTIHIT_SEC  (PPC_BIT(54))
+
+/* SLB error bits */
+#define P7_DSISR_MC_SLB_ERRORS         (P7_DSISR_MC_ERAT_MULTIHIT | \
+                                        P7_DSISR_MC_SLB_PARITY_MFSLB | \
+                                        P7_DSISR_MC_SLB_MULTIHIT | \
+                                        P7_DSISR_MC_SLB_MULTIHIT_PARITY)
+
+#define P8_DSISR_MC_SLB_ERRORS         (P7_DSISR_MC_SLB_ERRORS | \
+                                        P8_DSISR_MC_ERAT_MULTIHIT_SEC)
+enum MCE_Version {
+       MCE_V1 = 1,
+};
+
+enum MCE_Severity {
+       MCE_SEV_NO_ERROR = 0,
+       MCE_SEV_WARNING = 1,
+       MCE_SEV_ERROR_SYNC = 2,
+       MCE_SEV_FATAL = 3,
+};
+
+enum MCE_Disposition {
+       MCE_DISPOSITION_RECOVERED = 0,
+       MCE_DISPOSITION_NOT_RECOVERED = 1,
+};
+
+enum MCE_Initiator {
+       MCE_INITIATOR_UNKNOWN = 0,
+       MCE_INITIATOR_CPU = 1,
+};
+
+enum MCE_ErrorType {
+       MCE_ERROR_TYPE_UNKNOWN = 0,
+       MCE_ERROR_TYPE_UE = 1,
+       MCE_ERROR_TYPE_SLB = 2,
+       MCE_ERROR_TYPE_ERAT = 3,
+       MCE_ERROR_TYPE_TLB = 4,
+};
+
+enum MCE_UeErrorType {
+       MCE_UE_ERROR_INDETERMINATE = 0,
+       MCE_UE_ERROR_IFETCH = 1,
+       MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH = 2,
+       MCE_UE_ERROR_LOAD_STORE = 3,
+       MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 4,
+};
+
+enum MCE_SlbErrorType {
+       MCE_SLB_ERROR_INDETERMINATE = 0,
+       MCE_SLB_ERROR_PARITY = 1,
+       MCE_SLB_ERROR_MULTIHIT = 2,
+};
+
+enum MCE_EratErrorType {
+       MCE_ERAT_ERROR_INDETERMINATE = 0,
+       MCE_ERAT_ERROR_PARITY = 1,
+       MCE_ERAT_ERROR_MULTIHIT = 2,
+};
+
+enum MCE_TlbErrorType {
+       MCE_TLB_ERROR_INDETERMINATE = 0,
+       MCE_TLB_ERROR_PARITY = 1,
+       MCE_TLB_ERROR_MULTIHIT = 2,
+};
+
+struct machine_check_event {
+       enum MCE_Version        version:8;      /* 0x00 */
+       uint8_t                 in_use;         /* 0x01 */
+       enum MCE_Severity       severity:8;     /* 0x02 */
+       enum MCE_Initiator      initiator:8;    /* 0x03 */
+       enum MCE_ErrorType      error_type:8;   /* 0x04 */
+       enum MCE_Disposition    disposition:8;  /* 0x05 */
+       uint8_t                 reserved_1[2];  /* 0x06 */
+       uint64_t                gpr3;           /* 0x08 */
+       uint64_t                srr0;           /* 0x10 */
+       uint64_t                srr1;           /* 0x18 */
+       union {                                 /* 0x20 */
+               struct {
+                       enum MCE_UeErrorType ue_error_type:8;
+                       uint8_t         effective_address_provided;
+                       uint8_t         physical_address_provided;
+                       uint8_t         reserved_1[5];
+                       uint64_t        effective_address;
+                       uint64_t        physical_address;
+                       uint8_t         reserved_2[8];
+               } ue_error;
+
+               struct {
+                       enum MCE_SlbErrorType slb_error_type:8;
+                       uint8_t         effective_address_provided;
+                       uint8_t         reserved_1[6];
+                       uint64_t        effective_address;
+                       uint8_t         reserved_2[16];
+               } slb_error;
+
+               struct {
+                       enum MCE_EratErrorType erat_error_type:8;
+                       uint8_t         effective_address_provided;
+                       uint8_t         reserved_1[6];
+                       uint64_t        effective_address;
+                       uint8_t         reserved_2[16];
+               } erat_error;
+
+               struct {
+                       enum MCE_TlbErrorType tlb_error_type:8;
+                       uint8_t         effective_address_provided;
+                       uint8_t         reserved_1[6];
+                       uint64_t        effective_address;
+                       uint8_t         reserved_2[16];
+               } tlb_error;
+       } u;
+};
+
+struct mce_error_info {
+       enum MCE_ErrorType error_type:8;
+       union {
+               enum MCE_UeErrorType ue_error_type:8;
+               enum MCE_SlbErrorType slb_error_type:8;
+               enum MCE_EratErrorType erat_error_type:8;
+               enum MCE_TlbErrorType tlb_error_type:8;
+       } u;
+       uint8_t         reserved[2];
+};
+
+#define MAX_MC_EVT     100
+
+/* Release flags for get_mce_event() */
+#define MCE_EVENT_RELEASE      true
+#define MCE_EVENT_DONTRELEASE  false
+
+extern void save_mce_event(struct pt_regs *regs, long handled,
+                          struct mce_error_info *mce_err, uint64_t addr);
+extern int get_mce_event(struct machine_check_event *mce, bool release);
+extern void release_mce_event(void);
+extern void machine_check_queue_event(void);
+extern void machine_check_process_queued_event(void);
+extern void machine_check_print_event_info(struct machine_check_event *evt);
+extern uint64_t get_mce_fault_addr(struct machine_check_event *evt);
+
+#endif /* __ASM_PPC64_MCE_H__ */
index 033c06be1d840da02423d596121940d0aa11adb5..aded1b81bfd6c989506c96edf8b61441009732a0 100644 (file)
@@ -33,6 +33,28 @@ struct opal_takeover_args {
        u64     rd_loc;                 /* r11 */
 };
 
+/*
+ * SG entry
+ *
+ * WARNING: The current implementation requires each entry
+ * to represent a block that is 4k aligned *and* each block
+ * size except the last one in the list to be as well.
+ */
+struct opal_sg_entry {
+       void    *data;
+       long    length;
+};
+
+/* sg list */
+struct opal_sg_list {
+       unsigned long num_entries;
+       struct opal_sg_list *next;
+       struct opal_sg_entry entry[];
+};
+
+/* We calculate number of sg entries based on PAGE_SIZE */
+#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
+
 extern long opal_query_takeover(u64 *hal_size, u64 *hal_align);
 
 extern long opal_do_takeover(struct opal_takeover_args *args);
@@ -132,6 +154,8 @@ extern int opal_enter_rtas(struct rtas_args *args,
 #define OPAL_FLASH_VALIDATE                    76
 #define OPAL_FLASH_MANAGE                      77
 #define OPAL_FLASH_UPDATE                      78
+#define OPAL_GET_MSG                           85
+#define OPAL_CHECK_ASYNC_COMPLETION            86
 
 #ifndef __ASSEMBLY__
 
@@ -211,7 +235,16 @@ enum OpalPendingState {
        OPAL_EVENT_ERROR_LOG            = 0x40,
        OPAL_EVENT_EPOW                 = 0x80,
        OPAL_EVENT_LED_STATUS           = 0x100,
-       OPAL_EVENT_PCI_ERROR            = 0x200
+       OPAL_EVENT_PCI_ERROR            = 0x200,
+       OPAL_EVENT_MSG_PENDING          = 0x800,
+};
+
+enum OpalMessageType {
+       OPAL_MSG_ASYNC_COMP             = 0,
+       OPAL_MSG_MEM_ERR,
+       OPAL_MSG_EPOW,
+       OPAL_MSG_SHUTDOWN,
+       OPAL_MSG_TYPE_MAX,
 };
 
 /* Machine check related definitions */
@@ -356,6 +389,12 @@ enum OpalLPCAddressType {
        OPAL_LPC_FW     = 2,
 };
 
+struct opal_msg {
+       uint32_t msg_type;
+       uint32_t reserved;
+       uint64_t params[8];
+};
+
 struct opal_machine_check_event {
        enum OpalMCE_Version    version:8;      /* 0x00 */
        uint8_t                 in_use;         /* 0x01 */
@@ -404,6 +443,58 @@ struct opal_machine_check_event {
        } u;
 };
 
+/* FSP memory errors handling */
+enum OpalMemErr_Version {
+       OpalMemErr_V1 = 1,
+};
+
+enum OpalMemErrType {
+       OPAL_MEM_ERR_TYPE_RESILIENCE    = 0,
+       OPAL_MEM_ERR_TYPE_DYN_DALLOC,
+       OPAL_MEM_ERR_TYPE_SCRUB,
+};
+
+/* Memory Reilience error type */
+enum OpalMemErr_ResilErrType {
+       OPAL_MEM_RESILIENCE_CE          = 0,
+       OPAL_MEM_RESILIENCE_UE,
+       OPAL_MEM_RESILIENCE_UE_SCRUB,
+};
+
+/* Dynamic Memory Deallocation type */
+enum OpalMemErr_DynErrType {
+       OPAL_MEM_DYNAMIC_DEALLOC        = 0,
+};
+
+/* OpalMemoryErrorData->flags */
+#define OPAL_MEM_CORRECTED_ERROR       0x0001
+#define OPAL_MEM_THRESHOLD_EXCEEDED    0x0002
+#define OPAL_MEM_ACK_REQUIRED          0x8000
+
+struct OpalMemoryErrorData {
+       enum OpalMemErr_Version version:8;      /* 0x00 */
+       enum OpalMemErrType     type:8;         /* 0x01 */
+       uint16_t                flags;          /* 0x02 */
+       uint8_t                 reserved_1[4];  /* 0x04 */
+
+       union {
+               /* Memory Resilience corrected/uncorrected error info */
+               struct {
+                       enum OpalMemErr_ResilErrType resil_err_type:8;
+                       uint8_t         reserved_1[7];
+                       uint64_t        physical_address_start;
+                       uint64_t        physical_address_end;
+               } resilience;
+               /* Dynamic memory deallocation error info */
+               struct {
+                       enum OpalMemErr_DynErrType dyn_err_type:8;
+                       uint8_t         reserved_1[7];
+                       uint64_t        physical_address_start;
+                       uint64_t        physical_address_end;
+               } dyn_dealloc;
+       } u;
+};
+
 enum {
        OPAL_P7IOC_DIAG_TYPE_NONE       = 0,
        OPAL_P7IOC_DIAG_TYPE_RGC        = 1,
@@ -731,6 +822,9 @@ int64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result);
 int64_t opal_manage_flash(uint8_t op);
 int64_t opal_update_flash(uint64_t blk_list);
 
+int64_t opal_get_msg(uint64_t buffer, size_t size);
+int64_t opal_check_completion(uint64_t buffer, size_t size, uint64_t token);
+
 /* Internal functions */
 extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data);
 
@@ -744,6 +838,8 @@ extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
                                   int depth, void *data);
 
 extern int opal_notifier_register(struct notifier_block *nb);
+extern int opal_message_notifier_register(enum OpalMessageType msg_type,
+                                               struct notifier_block *nb);
 extern void opal_notifier_enable(void);
 extern void opal_notifier_disable(void);
 extern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val);
index b6ea9e068c13dd483033a9f8aea2251d45084cac..c3523d1dda585a6a6678bed340d4c28dc2c5a798 100644 (file)
@@ -152,6 +152,15 @@ struct paca_struct {
         */
        struct opal_machine_check_event *opal_mc_evt;
 #endif
+#ifdef CONFIG_PPC_BOOK3S_64
+       /* Exclusive emergency stack pointer for machine check exception. */
+       void *mc_emergency_sp;
+       /*
+        * Flag to check whether we are in machine check early handler
+        * and already using emergency stack.
+        */
+       u16 in_mce;
+#endif
 
        /* Stuff for accurate time accounting */
        u64 user_time;                  /* accumulated usermode TB ticks */
index 7d6eacf249cf420a3e6d0a6f5ef108c76e663e80..b999ca3189858e05b75c855de000003f3cafcbe6 100644 (file)
@@ -3,6 +3,7 @@
 #ifdef __KERNEL__
 
 #ifndef __ASSEMBLY__
+#include <linux/mmdebug.h>
 #include <asm/processor.h>             /* For TASK_SIZE */
 #include <asm/mmu.h>
 #include <asm/page.h>
@@ -33,10 +34,73 @@ static inline int pte_dirty(pte_t pte)              { return pte_val(pte) & _PAGE_DIRTY; }
 static inline int pte_young(pte_t pte)         { return pte_val(pte) & _PAGE_ACCESSED; }
 static inline int pte_file(pte_t pte)          { return pte_val(pte) & _PAGE_FILE; }
 static inline int pte_special(pte_t pte)       { return pte_val(pte) & _PAGE_SPECIAL; }
-static inline int pte_present(pte_t pte)       { return pte_val(pte) & _PAGE_PRESENT; }
 static inline int pte_none(pte_t pte)          { return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; }
 static inline pgprot_t pte_pgprot(pte_t pte)   { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); }
 
+#ifdef CONFIG_NUMA_BALANCING
+
+static inline int pte_present(pte_t pte)
+{
+       return pte_val(pte) & (_PAGE_PRESENT | _PAGE_NUMA);
+}
+
+#define pte_numa pte_numa
+static inline int pte_numa(pte_t pte)
+{
+       return (pte_val(pte) &
+               (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA;
+}
+
+#define pte_mknonnuma pte_mknonnuma
+static inline pte_t pte_mknonnuma(pte_t pte)
+{
+       pte_val(pte) &= ~_PAGE_NUMA;
+       pte_val(pte) |=  _PAGE_PRESENT | _PAGE_ACCESSED;
+       return pte;
+}
+
+#define pte_mknuma pte_mknuma
+static inline pte_t pte_mknuma(pte_t pte)
+{
+       /*
+        * We should not set _PAGE_NUMA on non present ptes. Also clear the
+        * present bit so that hash_page will return 1 and we collect this
+        * as numa fault.
+        */
+       if (pte_present(pte)) {
+               pte_val(pte) |= _PAGE_NUMA;
+               pte_val(pte) &= ~_PAGE_PRESENT;
+       } else
+               VM_BUG_ON(1);
+       return pte;
+}
+
+#define pmd_numa pmd_numa
+static inline int pmd_numa(pmd_t pmd)
+{
+       return pte_numa(pmd_pte(pmd));
+}
+
+#define pmd_mknonnuma pmd_mknonnuma
+static inline pmd_t pmd_mknonnuma(pmd_t pmd)
+{
+       return pte_pmd(pte_mknonnuma(pmd_pte(pmd)));
+}
+
+#define pmd_mknuma pmd_mknuma
+static inline pmd_t pmd_mknuma(pmd_t pmd)
+{
+       return pte_pmd(pte_mknuma(pmd_pte(pmd)));
+}
+
+# else
+
+static inline int pte_present(pte_t pte)
+{
+       return pte_val(pte) & _PAGE_PRESENT;
+}
+#endif /* CONFIG_NUMA_BALANCING */
+
 /* Conversion functions: convert a page and protection to a page entry,
  * and a page entry and page directory to the page they refer to.
  *
index 0419eeb53274c64891c87f1c573e712e6167d62b..2505d8eab15cb94da40aea90b9986aa853c0aecb 100644 (file)
@@ -19,7 +19,7 @@
 #define _PAGE_FILE             0x0002 /* (!present only) software: pte holds file offset */
 #define _PAGE_EXEC             0x0004 /* No execute on POWER4 and newer (we invert) */
 #define _PAGE_GUARDED          0x0008
-#define _PAGE_COHERENT         0x0010 /* M: enforce memory coherence (SMP systems) */
+/* We can derive Memory coherence from _PAGE_NO_CACHE */
 #define _PAGE_NO_CACHE         0x0020 /* I: cache inhibit */
 #define _PAGE_WRITETHRU                0x0040 /* W: cache write-through */
 #define _PAGE_DIRTY            0x0080 /* C: page changed */
 #define _PAGE_RW               0x0200 /* software: user write access allowed */
 #define _PAGE_BUSY             0x0800 /* software: PTE & hash are busy */
 
+/*
+ * Used for tracking numa faults
+ */
+#define _PAGE_NUMA     0x00000010 /* Gather numa placement stats */
+
+
 /* No separate kernel read-only */
 #define _PAGE_KERNEL_RW                (_PAGE_RW | _PAGE_DIRTY) /* user access blocked by key */
 #define _PAGE_KERNEL_RO                 _PAGE_KERNEL_RW
index 445cb6e39d5b0bb3058caaefe6af61f3f5ba2618..fcc9a89a46950867c81aaec671f9ac6d782c0a77 100644 (file)
@@ -39,6 +39,7 @@ obj-$(CONFIG_PPC64)           += setup_64.o sys_ppc32.o \
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)       += hw_breakpoint.o
 obj-$(CONFIG_PPC_BOOK3S_64)    += cpu_setup_ppc970.o cpu_setup_pa6t.o
 obj-$(CONFIG_PPC_BOOK3S_64)    += cpu_setup_power.o
+obj-$(CONFIG_PPC_BOOK3S_64)    += mce.o mce_power.o
 obj64-$(CONFIG_RELOCATABLE)    += reloc_64.o
 obj-$(CONFIG_PPC_BOOK3E_64)    += exceptions-64e.o idle_book3e.o
 obj-$(CONFIG_PPC_A2)           += cpu_setup_a2.o
@@ -47,7 +48,6 @@ obj-$(CONFIG_ALTIVEC)         += vecemu.o
 obj-$(CONFIG_PPC_970_NAP)      += idle_power4.o
 obj-$(CONFIG_PPC_P7_NAP)       += idle_power7.o
 obj-$(CONFIG_PPC_OF)           += of_platform.o prom_parse.o
-obj-$(CONFIG_PPC_CLOCK)                += clock.o
 procfs-y                       := proc_powerpc.o
 obj-$(CONFIG_PROC_FS)          += $(procfs-y)
 rtaspci-$(CONFIG_PPC64)-$(CONFIG_PCI)  := rtas_pci.o
index 2ea5cc033ec8b633febb50071c43cfd31958f4f3..41a283956a29453779056af0cd0c2f436841cc25 100644 (file)
@@ -232,6 +232,10 @@ int main(void)
        DEFINE(PACA_DTL_RIDX, offsetof(struct paca_struct, dtl_ridx));
 #endif /* CONFIG_PPC_STD_MMU_64 */
        DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp));
+#ifdef CONFIG_PPC_BOOK3S_64
+       DEFINE(PACAMCEMERGSP, offsetof(struct paca_struct, mc_emergency_sp));
+       DEFINE(PACA_IN_MCE, offsetof(struct paca_struct, in_mce));
+#endif
        DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
        DEFINE(PACAKEXECSTATE, offsetof(struct paca_struct, kexec_state));
        DEFINE(PACA_STARTTIME, offsetof(struct paca_struct, starttime));
diff --git a/arch/powerpc/kernel/clock.c b/arch/powerpc/kernel/clock.c
deleted file mode 100644 (file)
index a764b47..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Dummy clk implementations for powerpc.
- * These need to be overridden in platform code.
- */
-
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/errno.h>
-#include <linux/export.h>
-#include <asm/clk_interface.h>
-
-struct clk_interface clk_functions;
-
-struct clk *clk_get(struct device *dev, const char *id)
-{
-       if (clk_functions.clk_get)
-               return clk_functions.clk_get(dev, id);
-       return ERR_PTR(-ENOSYS);
-}
-EXPORT_SYMBOL(clk_get);
-
-void clk_put(struct clk *clk)
-{
-       if (clk_functions.clk_put)
-               clk_functions.clk_put(clk);
-}
-EXPORT_SYMBOL(clk_put);
-
-int clk_enable(struct clk *clk)
-{
-       if (clk_functions.clk_enable)
-               return clk_functions.clk_enable(clk);
-       return -ENOSYS;
-}
-EXPORT_SYMBOL(clk_enable);
-
-void clk_disable(struct clk *clk)
-{
-       if (clk_functions.clk_disable)
-               clk_functions.clk_disable(clk);
-}
-EXPORT_SYMBOL(clk_disable);
-
-unsigned long clk_get_rate(struct clk *clk)
-{
-       if (clk_functions.clk_get_rate)
-               return clk_functions.clk_get_rate(clk);
-       return 0;
-}
-EXPORT_SYMBOL(clk_get_rate);
-
-long clk_round_rate(struct clk *clk, unsigned long rate)
-{
-       if (clk_functions.clk_round_rate)
-               return clk_functions.clk_round_rate(clk, rate);
-       return -ENOSYS;
-}
-EXPORT_SYMBOL(clk_round_rate);
-
-int clk_set_rate(struct clk *clk, unsigned long rate)
-{
-       if (clk_functions.clk_set_rate)
-               return clk_functions.clk_set_rate(clk, rate);
-       return -ENOSYS;
-}
-EXPORT_SYMBOL(clk_set_rate);
-
-struct clk *clk_get_parent(struct clk *clk)
-{
-       if (clk_functions.clk_get_parent)
-               return clk_functions.clk_get_parent(clk);
-       return ERR_PTR(-ENOSYS);
-}
-EXPORT_SYMBOL(clk_get_parent);
-
-int clk_set_parent(struct clk *clk, struct clk *parent)
-{
-       if (clk_functions.clk_set_parent)
-               return clk_functions.clk_set_parent(clk, parent);
-       return -ENOSYS;
-}
-EXPORT_SYMBOL(clk_set_parent);
index 18b5b9cf8e3730f4608ca6ff997810d5cc47df9a..37d1bb002aa97bbd3ea52b19304f746521e30bff 100644 (file)
@@ -29,7 +29,7 @@ _GLOBAL(__setup_cpu_power7)
        mtspr   SPRN_LPID,r0
        mfspr   r3,SPRN_LPCR
        bl      __init_LPCR
-       bl      __init_TLB
+       bl      __init_tlb_power7
        mtlr    r11
        blr
 
@@ -42,7 +42,7 @@ _GLOBAL(__restore_cpu_power7)
        mtspr   SPRN_LPID,r0
        mfspr   r3,SPRN_LPCR
        bl      __init_LPCR
-       bl      __init_TLB
+       bl      __init_tlb_power7
        mtlr    r11
        blr
 
@@ -59,7 +59,7 @@ _GLOBAL(__setup_cpu_power8)
        oris    r3, r3, LPCR_AIL_3@h
        bl      __init_LPCR
        bl      __init_HFSCR
-       bl      __init_TLB
+       bl      __init_tlb_power8
        bl      __init_PMU_HV
        mtlr    r11
        blr
@@ -78,7 +78,7 @@ _GLOBAL(__restore_cpu_power8)
        oris    r3, r3, LPCR_AIL_3@h
        bl      __init_LPCR
        bl      __init_HFSCR
-       bl      __init_TLB
+       bl      __init_tlb_power8
        bl      __init_PMU_HV
        mtlr    r11
        blr
@@ -134,15 +134,31 @@ __init_HFSCR:
        mtspr   SPRN_HFSCR,r3
        blr
 
-__init_TLB:
-       /*
-        * Clear the TLB using the "IS 3" form of tlbiel instruction
-        * (invalidate by congruence class). P7 has 128 CCs, P8 has 512
-        * so we just always do 512
-        */
+/*
+ * Clear the TLB using the specified IS form of tlbiel instruction
+ * (invalidate by congruence class). P7 has 128 CCs., P8 has 512.
+ *
+ * r3 = IS field
+ */
+__init_tlb_power7:
+       li      r3,0xc00        /* IS field = 0b11 */
+_GLOBAL(__flush_tlb_power7)
+       li      r6,128
+       mtctr   r6
+       mr      r7,r3           /* IS field */
+       ptesync
+2:     tlbiel  r7
+       addi    r7,r7,0x1000
+       bdnz    2b
+       ptesync
+1:     blr
+
+__init_tlb_power8:
+       li      r3,0xc00        /* IS field = 0b11 */
+_GLOBAL(__flush_tlb_power8)
        li      r6,512
        mtctr   r6
-       li      r7,0xc00        /* IS field = 0b11 */
+       mr      r7,r3           /* IS field */
        ptesync
 2:     tlbiel  r7
        addi    r7,r7,0x1000
index 597d954e58601b36f376953898faf9178b818239..6c8dd5da4de5ea0b8b88196b773d2e39fca1c732 100644 (file)
@@ -71,6 +71,10 @@ extern void __restore_cpu_power7(void);
 extern void __setup_cpu_power8(unsigned long offset, struct cpu_spec* spec);
 extern void __restore_cpu_power8(void);
 extern void __restore_cpu_a2(void);
+extern void __flush_tlb_power7(unsigned long inval_selector);
+extern void __flush_tlb_power8(unsigned long inval_selector);
+extern long __machine_check_early_realmode_p7(struct pt_regs *regs);
+extern long __machine_check_early_realmode_p8(struct pt_regs *regs);
 #endif /* CONFIG_PPC64 */
 #if defined(CONFIG_E500)
 extern void __setup_cpu_e5500(unsigned long offset, struct cpu_spec* spec);
@@ -440,6 +444,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .oprofile_cpu_type      = "ppc64/ibm-compat-v1",
                .cpu_setup              = __setup_cpu_power7,
                .cpu_restore            = __restore_cpu_power7,
+               .flush_tlb              = __flush_tlb_power7,
+               .machine_check_early    = __machine_check_early_realmode_p7,
                .platform               = "power7",
        },
        {       /* 2.07-compliant processor, i.e. Power8 "architected" mode */
@@ -456,6 +462,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .oprofile_cpu_type      = "ppc64/ibm-compat-v1",
                .cpu_setup              = __setup_cpu_power8,
                .cpu_restore            = __restore_cpu_power8,
+               .flush_tlb              = __flush_tlb_power8,
+               .machine_check_early    = __machine_check_early_realmode_p8,
                .platform               = "power8",
        },
        {       /* Power7 */
@@ -474,6 +482,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .oprofile_type          = PPC_OPROFILE_POWER4,
                .cpu_setup              = __setup_cpu_power7,
                .cpu_restore            = __restore_cpu_power7,
+               .flush_tlb              = __flush_tlb_power7,
+               .machine_check_early    = __machine_check_early_realmode_p7,
                .platform               = "power7",
        },
        {       /* Power7+ */
@@ -492,6 +502,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .oprofile_type          = PPC_OPROFILE_POWER4,
                .cpu_setup              = __setup_cpu_power7,
                .cpu_restore            = __restore_cpu_power7,
+               .flush_tlb              = __flush_tlb_power7,
+               .machine_check_early    = __machine_check_early_realmode_p7,
                .platform               = "power7+",
        },
        {       /* Power8E */
@@ -510,6 +522,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .oprofile_type          = PPC_OPROFILE_INVALID,
                .cpu_setup              = __setup_cpu_power8,
                .cpu_restore            = __restore_cpu_power8,
+               .flush_tlb              = __flush_tlb_power8,
+               .machine_check_early    = __machine_check_early_realmode_p8,
                .platform               = "power8",
        },
        {       /* Power8 */
@@ -528,6 +542,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
                .oprofile_type          = PPC_OPROFILE_INVALID,
                .cpu_setup              = __setup_cpu_power8,
                .cpu_restore            = __restore_cpu_power8,
+               .flush_tlb              = __flush_tlb_power8,
+               .machine_check_early    = __machine_check_early_realmode_p8,
                .platform               = "power8",
        },
        {       /* Cell Broadband Engine */
index 4bd687d5e7aa3f80e1b33912b5451bd34a3187b1..f4b7a227f18350f3f46c078e8101019e388dbfb6 100644 (file)
@@ -84,7 +84,7 @@
 #define EEH_MAX_FAILS  2100000
 
 /* Time to wait for a PCI slot to report status, in milliseconds */
-#define PCI_BUS_RESET_WAIT_MSEC (60*1000)
+#define PCI_BUS_RESET_WAIT_MSEC (5*60*1000)
 
 /* Platform dependent EEH operations */
 struct eeh_ops *eeh_ops = NULL;
index 36bed5a12750b639e2c305153585869be536ddef..4ef59c33777f0a4bd6bc0115e102db031b8f5094 100644 (file)
@@ -468,7 +468,7 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
 /* The longest amount of time to wait for a pci device
  * to come back on line, in seconds.
  */
-#define MAX_WAIT_FOR_RECOVERY 150
+#define MAX_WAIT_FOR_RECOVERY 300
 
 static void eeh_handle_normal_event(struct eeh_pe *pe)
 {
index bbfb0294b3544072ac22b2fcfee486620ae1479e..770d6d65c47b62b1d101021ec0e4b063226606dc 100644 (file)
@@ -183,6 +183,11 @@ syscall_exit:
 #ifdef SHOW_SYSCALLS
        bl      .do_show_syscall_exit
        ld      r3,RESULT(r1)
+#endif
+#ifdef CONFIG_PPC_BOOK3S_64
+BEGIN_FTR_SECTION
+       bl      .machine_check_process_queued_event
+END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
 #endif
        CURRENT_THREAD_INFO(r12, r1)
 
index 9f905e40922e41de4eb6f43421290944c5d08567..b5c3313567da8e5e606c94f7a1cf4a2c04a47e95 100644 (file)
@@ -155,8 +155,30 @@ machine_check_pSeries_1:
         */
        HMT_MEDIUM_PPR_DISCARD
        SET_SCRATCH0(r13)               /* save r13 */
+#ifdef CONFIG_PPC_P7_NAP
+BEGIN_FTR_SECTION
+       /* Running native on arch 2.06 or later, check if we are
+        * waking up from nap. We only handle no state loss and
+        * supervisor state loss. We do -not- handle hypervisor
+        * state loss at this time.
+        */
+       mfspr   r13,SPRN_SRR1
+       rlwinm. r13,r13,47-31,30,31
+       beq     9f
+
+       /* waking up from powersave (nap) state */
+       cmpwi   cr1,r13,2
+       /* Total loss of HV state is fatal. let's just stay stuck here */
+       bgt     cr1,.
+9:
+END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
+#endif /* CONFIG_PPC_P7_NAP */
        EXCEPTION_PROLOG_0(PACA_EXMC)
+BEGIN_FTR_SECTION
+       b       machine_check_pSeries_early
+FTR_SECTION_ELSE
        b       machine_check_pSeries_0
+ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
 
        . = 0x300
        .globl data_access_pSeries
@@ -405,6 +427,64 @@ denorm_exception_hv:
 
        .align  7
        /* moved from 0x200 */
+machine_check_pSeries_early:
+BEGIN_FTR_SECTION
+       EXCEPTION_PROLOG_1(PACA_EXMC, NOTEST, 0x200)
+       /*
+        * Register contents:
+        * R13          = PACA
+        * R9           = CR
+        * Original R9 to R13 is saved on PACA_EXMC
+        *
+        * Switch to mc_emergency stack and handle re-entrancy (though we
+        * currently don't test for overflow). Save MCE registers srr1,
+        * srr0, dar and dsisr and then set ME=1
+        *
+        * We use paca->in_mce to check whether this is the first entry or
+        * nested machine check. We increment paca->in_mce to track nested
+        * machine checks.
+        *
+        * If this is the first entry then set stack pointer to
+        * paca->mc_emergency_sp, otherwise r1 is already pointing to
+        * stack frame on mc_emergency stack.
+        *
+        * NOTE: We are here with MSR_ME=0 (off), which means we risk a
+        * checkstop if we get another machine check exception before we do
+        * rfid with MSR_ME=1.
+        */
+       mr      r11,r1                  /* Save r1 */
+       lhz     r10,PACA_IN_MCE(r13)
+       cmpwi   r10,0                   /* Are we in nested machine check */
+       bne     0f                      /* Yes, we are. */
+       /* First machine check entry */
+       ld      r1,PACAMCEMERGSP(r13)   /* Use MC emergency stack */
+0:     subi    r1,r1,INT_FRAME_SIZE    /* alloc stack frame */
+       addi    r10,r10,1               /* increment paca->in_mce */
+       sth     r10,PACA_IN_MCE(r13)
+       std     r11,GPR1(r1)            /* Save r1 on the stack. */
+       std     r11,0(r1)               /* make stack chain pointer */
+       mfspr   r11,SPRN_SRR0           /* Save SRR0 */
+       std     r11,_NIP(r1)
+       mfspr   r11,SPRN_SRR1           /* Save SRR1 */
+       std     r11,_MSR(r1)
+       mfspr   r11,SPRN_DAR            /* Save DAR */
+       std     r11,_DAR(r1)
+       mfspr   r11,SPRN_DSISR          /* Save DSISR */
+       std     r11,_DSISR(r1)
+       std     r9,_CCR(r1)             /* Save CR in stackframe */
+       /* Save r9 through r13 from EXMC save area to stack frame. */
+       EXCEPTION_PROLOG_COMMON_2(PACA_EXMC)
+       mfmsr   r11                     /* get MSR value */
+       ori     r11,r11,MSR_ME          /* turn on ME bit */
+       ori     r11,r11,MSR_RI          /* turn on RI bit */
+       ld      r12,PACAKBASE(r13)      /* get high part of &label */
+       LOAD_HANDLER(r12, machine_check_handle_early)
+       mtspr   SPRN_SRR0,r12
+       mtspr   SPRN_SRR1,r11
+       rfid
+       b       .       /* prevent speculative execution */
+END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
+
 machine_check_pSeries:
        .globl machine_check_fwnmi
 machine_check_fwnmi:
@@ -688,30 +768,6 @@ kvmppc_skip_Hinterrupt:
 
        STD_EXCEPTION_COMMON(0x100, system_reset, .system_reset_exception)
 
-       /*
-        * Machine check is different because we use a different
-        * save area: PACA_EXMC instead of PACA_EXGEN.
-        */
-       .align  7
-       .globl machine_check_common
-machine_check_common:
-
-       mfspr   r10,SPRN_DAR
-       std     r10,PACA_EXGEN+EX_DAR(r13)
-       mfspr   r10,SPRN_DSISR
-       stw     r10,PACA_EXGEN+EX_DSISR(r13)
-       EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
-       FINISH_NAP
-       DISABLE_INTS
-       ld      r3,PACA_EXGEN+EX_DAR(r13)
-       lwz     r4,PACA_EXGEN+EX_DSISR(r13)
-       std     r3,_DAR(r1)
-       std     r4,_DSISR(r1)
-       bl      .save_nvgprs
-       addi    r3,r1,STACK_FRAME_OVERHEAD
-       bl      .machine_check_exception
-       b       .ret_from_except
-
        STD_EXCEPTION_COMMON_ASYNC(0x500, hardware_interrupt, do_IRQ)
        STD_EXCEPTION_COMMON_ASYNC(0x900, decrementer, .timer_interrupt)
        STD_EXCEPTION_COMMON(0x980, hdecrementer, .hdec_interrupt)
@@ -1262,6 +1318,146 @@ _GLOBAL(opal_mc_secondary_handler)
        b       machine_check_pSeries
 #endif /* CONFIG_PPC_POWERNV */
 
+       /*
+        * Machine check is different because we use a different
+        * save area: PACA_EXMC instead of PACA_EXGEN.
+        */
+       .align  7
+       .globl machine_check_common
+machine_check_common:
+
+       mfspr   r10,SPRN_DAR
+       std     r10,PACA_EXGEN+EX_DAR(r13)
+       mfspr   r10,SPRN_DSISR
+       stw     r10,PACA_EXGEN+EX_DSISR(r13)
+       EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
+       FINISH_NAP
+       DISABLE_INTS
+       ld      r3,PACA_EXGEN+EX_DAR(r13)
+       lwz     r4,PACA_EXGEN+EX_DSISR(r13)
+       std     r3,_DAR(r1)
+       std     r4,_DSISR(r1)
+       bl      .save_nvgprs
+       addi    r3,r1,STACK_FRAME_OVERHEAD
+       bl      .machine_check_exception
+       b       .ret_from_except
+
+#define MACHINE_CHECK_HANDLER_WINDUP                   \
+       /* Clear MSR_RI before setting SRR0 and SRR1. */\
+       li      r0,MSR_RI;                              \
+       mfmsr   r9;             /* get MSR value */     \
+       andc    r9,r9,r0;                               \
+       mtmsrd  r9,1;           /* Clear MSR_RI */      \
+       /* Move original SRR0 and SRR1 into the respective regs */      \
+       ld      r9,_MSR(r1);                            \
+       mtspr   SPRN_SRR1,r9;                           \
+       ld      r3,_NIP(r1);                            \
+       mtspr   SPRN_SRR0,r3;                           \
+       ld      r9,_CTR(r1);                            \
+       mtctr   r9;                                     \
+       ld      r9,_XER(r1);                            \
+       mtxer   r9;                                     \
+       ld      r9,_LINK(r1);                           \
+       mtlr    r9;                                     \
+       REST_GPR(0, r1);                                \
+       REST_8GPRS(2, r1);                              \
+       REST_GPR(10, r1);                               \
+       ld      r11,_CCR(r1);                           \
+       mtcr    r11;                                    \
+       /* Decrement paca->in_mce. */                   \
+       lhz     r12,PACA_IN_MCE(r13);                   \
+       subi    r12,r12,1;                              \
+       sth     r12,PACA_IN_MCE(r13);                   \
+       REST_GPR(11, r1);                               \
+       REST_2GPRS(12, r1);                             \
+       /* restore original r1. */                      \
+       ld      r1,GPR1(r1)
+
+       /*
+        * Handle machine check early in real mode. We come here with
+        * ME=1, MMU (IR=0 and DR=0) off and using MC emergency stack.
+        */
+       .align  7
+       .globl machine_check_handle_early
+machine_check_handle_early:
+BEGIN_FTR_SECTION
+       std     r0,GPR0(r1)     /* Save r0 */
+       EXCEPTION_PROLOG_COMMON_3(0x200)
+       bl      .save_nvgprs
+       addi    r3,r1,STACK_FRAME_OVERHEAD
+       bl      .machine_check_early
+       ld      r12,_MSR(r1)
+#ifdef CONFIG_PPC_P7_NAP
+       /*
+        * Check if thread was in power saving mode. We come here when any
+        * of the following is true:
+        * a. thread wasn't in power saving mode
+        * b. thread was in power saving mode with no state loss or
+        *    supervisor state loss
+        *
+        * Go back to nap again if (b) is true.
+        */
+       rlwinm. r11,r12,47-31,30,31     /* Was it in power saving mode? */
+       beq     4f                      /* No, it wasn;t */
+       /* Thread was in power saving mode. Go back to nap again. */
+       cmpwi   r11,2
+       bne     3f
+       /* Supervisor state loss */
+       li      r0,1
+       stb     r0,PACA_NAPSTATELOST(r13)
+3:     bl      .machine_check_queue_event
+       MACHINE_CHECK_HANDLER_WINDUP
+       GET_PACA(r13)
+       ld      r1,PACAR1(r13)
+       b       .power7_enter_nap_mode
+4:
+#endif
+       /*
+        * Check if we are coming from hypervisor userspace. If yes then we
+        * continue in host kernel in V mode to deliver the MC event.
+        */
+       rldicl. r11,r12,4,63            /* See if MC hit while in HV mode. */
+       beq     5f
+       andi.   r11,r12,MSR_PR          /* See if coming from user. */
+       bne     9f                      /* continue in V mode if we are. */
+
+5:
+#ifdef CONFIG_KVM_BOOK3S_64_HV
+       /*
+        * We are coming from kernel context. Check if we are coming from
+        * guest. if yes, then we can continue. We will fall through
+        * do_kvm_200->kvmppc_interrupt to deliver the MC event to guest.
+        */
+       lbz     r11,HSTATE_IN_GUEST(r13)
+       cmpwi   r11,0                   /* Check if coming from guest */
+       bne     9f                      /* continue if we are. */
+#endif
+       /*
+        * At this point we are not sure about what context we come from.
+        * Queue up the MCE event and return from the interrupt.
+        * But before that, check if this is an un-recoverable exception.
+        * If yes, then stay on emergency stack and panic.
+        */
+       andi.   r11,r12,MSR_RI
+       bne     2f
+1:     addi    r3,r1,STACK_FRAME_OVERHEAD
+       bl      .unrecoverable_exception
+       b       1b
+2:
+       /*
+        * Return from MC interrupt.
+        * Queue up the MCE event so that we can log it later, while
+        * returning from kernel or opal call.
+        */
+       bl      .machine_check_queue_event
+       MACHINE_CHECK_HANDLER_WINDUP
+       rfid
+9:
+       /* Deliver the machine check to host kernel in V mode. */
+       MACHINE_CHECK_HANDLER_WINDUP
+       b       machine_check_pSeries
+END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
+
 
 /*
  * r13 points to the PACA, r9 contains the saved CR,
index 847e40e62fcee8420046e153e5da9354bc80a40e..3fdef0f0c67fa959e631a4ccee2d3a330001fa44 100644 (file)
@@ -84,6 +84,7 @@ _GLOBAL(power7_nap)
        std     r9,_MSR(r1)
        std     r1,PACAR1(r13)
 
+_GLOBAL(power7_enter_nap_mode)
 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
        /* Tell KVM we're napping */
        li      r4,KVM_HWTHREAD_IN_NAP
index 572bb5b95f35d815f6f24fe7b59a67bf420fbe2b..d22abe0b08e3c221a709210181db09647ec1687e 100644 (file)
@@ -1105,7 +1105,7 @@ void iommu_release_ownership(struct iommu_table *tbl)
 }
 EXPORT_SYMBOL_GPL(iommu_release_ownership);
 
-static int iommu_add_device(struct device *dev)
+int iommu_add_device(struct device *dev)
 {
        struct iommu_table *tbl;
        int ret = 0;
@@ -1134,52 +1134,12 @@ static int iommu_add_device(struct device *dev)
 
        return ret;
 }
+EXPORT_SYMBOL_GPL(iommu_add_device);
 
-static void iommu_del_device(struct device *dev)
+void iommu_del_device(struct device *dev)
 {
        iommu_group_remove_device(dev);
 }
-
-static int iommu_bus_notifier(struct notifier_block *nb,
-                             unsigned long action, void *data)
-{
-       struct device *dev = data;
-
-       switch (action) {
-       case BUS_NOTIFY_ADD_DEVICE:
-               return iommu_add_device(dev);
-       case BUS_NOTIFY_DEL_DEVICE:
-               iommu_del_device(dev);
-               return 0;
-       default:
-               return 0;
-       }
-}
-
-static struct notifier_block tce_iommu_bus_nb = {
-       .notifier_call = iommu_bus_notifier,
-};
-
-static int __init tce_iommu_init(void)
-{
-       struct pci_dev *pdev = NULL;
-
-       BUILD_BUG_ON(PAGE_SIZE < IOMMU_PAGE_SIZE);
-
-       for_each_pci_dev(pdev)
-               iommu_add_device(&pdev->dev);
-
-       bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
-       return 0;
-}
-
-subsys_initcall_sync(tce_iommu_init);
-
-#else
-
-void iommu_register_group(struct iommu_table *tbl,
-               int pci_domain_number, unsigned long pe_num)
-{
-}
+EXPORT_SYMBOL_GPL(iommu_del_device);
 
 #endif /* CONFIG_IOMMU_API */
index ba0165615215577be84a8a576283a5fd6df12e51..9729b23bfb0a2deebf0e5157accb2d68541b6bf0 100644 (file)
@@ -354,8 +354,13 @@ int arch_show_interrupts(struct seq_file *p, int prec)
 
        seq_printf(p, "%*s: ", prec, "LOC");
        for_each_online_cpu(j)
-               seq_printf(p, "%10u ", per_cpu(irq_stat, j).timer_irqs);
-        seq_printf(p, "  Local timer interrupts\n");
+               seq_printf(p, "%10u ", per_cpu(irq_stat, j).timer_irqs_event);
+        seq_printf(p, "  Local timer interrupts for timer event device\n");
+
+       seq_printf(p, "%*s: ", prec, "LOC");
+       for_each_online_cpu(j)
+               seq_printf(p, "%10u ", per_cpu(irq_stat, j).timer_irqs_others);
+        seq_printf(p, "  Local timer interrupts for others\n");
 
        seq_printf(p, "%*s: ", prec, "SPU");
        for_each_online_cpu(j)
@@ -389,11 +394,12 @@ int arch_show_interrupts(struct seq_file *p, int prec)
  */
 u64 arch_irq_stat_cpu(unsigned int cpu)
 {
-       u64 sum = per_cpu(irq_stat, cpu).timer_irqs;
+       u64 sum = per_cpu(irq_stat, cpu).timer_irqs_event;
 
        sum += per_cpu(irq_stat, cpu).pmu_irqs;
        sum += per_cpu(irq_stat, cpu).mce_exceptions;
        sum += per_cpu(irq_stat, cpu).spurious_irqs;
+       sum += per_cpu(irq_stat, cpu).timer_irqs_others;
 #ifdef CONFIG_PPC_DOORBELL
        sum += per_cpu(irq_stat, cpu).doorbell_irqs;
 #endif
diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c
new file mode 100644 (file)
index 0000000..c0c52ec
--- /dev/null
@@ -0,0 +1,345 @@
+/*
+ * Machine check exception handling.
+ *
+ * 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.
+ *
+ * Copyright 2013 IBM Corporation
+ * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
+ */
+
+#undef DEBUG
+#define pr_fmt(fmt) "mce: " fmt
+
+#include <linux/types.h>
+#include <linux/ptrace.h>
+#include <linux/percpu.h>
+#include <linux/export.h>
+#include <asm/mce.h>
+
+static DEFINE_PER_CPU(int, mce_nest_count);
+static DEFINE_PER_CPU(struct machine_check_event[MAX_MC_EVT], mce_event);
+
+/* Queue for delayed MCE events. */
+static DEFINE_PER_CPU(int, mce_queue_count);
+static DEFINE_PER_CPU(struct machine_check_event[MAX_MC_EVT], mce_event_queue);
+
+static void mce_set_error_info(struct machine_check_event *mce,
+                              struct mce_error_info *mce_err)
+{
+       mce->error_type = mce_err->error_type;
+       switch (mce_err->error_type) {
+       case MCE_ERROR_TYPE_UE:
+               mce->u.ue_error.ue_error_type = mce_err->u.ue_error_type;
+               break;
+       case MCE_ERROR_TYPE_SLB:
+               mce->u.slb_error.slb_error_type = mce_err->u.slb_error_type;
+               break;
+       case MCE_ERROR_TYPE_ERAT:
+               mce->u.erat_error.erat_error_type = mce_err->u.erat_error_type;
+               break;
+       case MCE_ERROR_TYPE_TLB:
+               mce->u.tlb_error.tlb_error_type = mce_err->u.tlb_error_type;
+               break;
+       case MCE_ERROR_TYPE_UNKNOWN:
+       default:
+               break;
+       }
+}
+
+/*
+ * Decode and save high level MCE information into per cpu buffer which
+ * is an array of machine_check_event structure.
+ */
+void save_mce_event(struct pt_regs *regs, long handled,
+                   struct mce_error_info *mce_err,
+                   uint64_t addr)
+{
+       uint64_t srr1;
+       int index = __get_cpu_var(mce_nest_count)++;
+       struct machine_check_event *mce = &__get_cpu_var(mce_event[index]);
+
+       /*
+        * Return if we don't have enough space to log mce event.
+        * mce_nest_count may go beyond MAX_MC_EVT but that's ok,
+        * the check below will stop buffer overrun.
+        */
+       if (index >= MAX_MC_EVT)
+               return;
+
+       /* Populate generic machine check info */
+       mce->version = MCE_V1;
+       mce->srr0 = regs->nip;
+       mce->srr1 = regs->msr;
+       mce->gpr3 = regs->gpr[3];
+       mce->in_use = 1;
+
+       mce->initiator = MCE_INITIATOR_CPU;
+       if (handled)
+               mce->disposition = MCE_DISPOSITION_RECOVERED;
+       else
+               mce->disposition = MCE_DISPOSITION_NOT_RECOVERED;
+       mce->severity = MCE_SEV_ERROR_SYNC;
+
+       srr1 = regs->msr;
+
+       /*
+        * Populate the mce error_type and type-specific error_type.
+        */
+       mce_set_error_info(mce, mce_err);
+
+       if (!addr)
+               return;
+
+       if (mce->error_type == MCE_ERROR_TYPE_TLB) {
+               mce->u.tlb_error.effective_address_provided = true;
+               mce->u.tlb_error.effective_address = addr;
+       } else if (mce->error_type == MCE_ERROR_TYPE_SLB) {
+               mce->u.slb_error.effective_address_provided = true;
+               mce->u.slb_error.effective_address = addr;
+       } else if (mce->error_type == MCE_ERROR_TYPE_ERAT) {
+               mce->u.erat_error.effective_address_provided = true;
+               mce->u.erat_error.effective_address = addr;
+       } else if (mce->error_type == MCE_ERROR_TYPE_UE) {
+               mce->u.ue_error.effective_address_provided = true;
+               mce->u.ue_error.effective_address = addr;
+       }
+       return;
+}
+
+/*
+ * get_mce_event:
+ *     mce     Pointer to machine_check_event structure to be filled.
+ *     release Flag to indicate whether to free the event slot or not.
+ *             0 <= do not release the mce event. Caller will invoke
+ *                  release_mce_event() once event has been consumed.
+ *             1 <= release the slot.
+ *
+ *     return  1 = success
+ *             0 = failure
+ *
+ * get_mce_event() will be called by platform specific machine check
+ * handle routine and in KVM.
+ * When we call get_mce_event(), we are still in interrupt context and
+ * preemption will not be scheduled until ret_from_expect() routine
+ * is called.
+ */
+int get_mce_event(struct machine_check_event *mce, bool release)
+{
+       int index = __get_cpu_var(mce_nest_count) - 1;
+       struct machine_check_event *mc_evt;
+       int ret = 0;
+
+       /* Sanity check */
+       if (index < 0)
+               return ret;
+
+       /* Check if we have MCE info to process. */
+       if (index < MAX_MC_EVT) {
+               mc_evt = &__get_cpu_var(mce_event[index]);
+               /* Copy the event structure and release the original */
+               if (mce)
+                       *mce = *mc_evt;
+               if (release)
+                       mc_evt->in_use = 0;
+               ret = 1;
+       }
+       /* Decrement the count to free the slot. */
+       if (release)
+               __get_cpu_var(mce_nest_count)--;
+
+       return ret;
+}
+
+void release_mce_event(void)
+{
+       get_mce_event(NULL, true);
+}
+
+/*
+ * Queue up the MCE event which then can be handled later.
+ */
+void machine_check_queue_event(void)
+{
+       int index;
+       struct machine_check_event evt;
+
+       if (!get_mce_event(&evt, MCE_EVENT_RELEASE))
+               return;
+
+       index = __get_cpu_var(mce_queue_count)++;
+       /* If queue is full, just return for now. */
+       if (index >= MAX_MC_EVT) {
+               __get_cpu_var(mce_queue_count)--;
+               return;
+       }
+       __get_cpu_var(mce_event_queue[index]) = evt;
+}
+
+/*
+ * process pending MCE event from the mce event queue. This function will be
+ * called during syscall exit.
+ */
+void machine_check_process_queued_event(void)
+{
+       int index;
+
+       preempt_disable();
+       /*
+        * For now just print it to console.
+        * TODO: log this error event to FSP or nvram.
+        */
+       while (__get_cpu_var(mce_queue_count) > 0) {
+               index = __get_cpu_var(mce_queue_count) - 1;
+               machine_check_print_event_info(
+                               &__get_cpu_var(mce_event_queue[index]));
+               __get_cpu_var(mce_queue_count)--;
+       }
+       preempt_enable();
+}
+
+void machine_check_print_event_info(struct machine_check_event *evt)
+{
+       const char *level, *sevstr, *subtype;
+       static const char *mc_ue_types[] = {
+               "Indeterminate",
+               "Instruction fetch",
+               "Page table walk ifetch",
+               "Load/Store",
+               "Page table walk Load/Store",
+       };
+       static const char *mc_slb_types[] = {
+               "Indeterminate",
+               "Parity",
+               "Multihit",
+       };
+       static const char *mc_erat_types[] = {
+               "Indeterminate",
+               "Parity",
+               "Multihit",
+       };
+       static const char *mc_tlb_types[] = {
+               "Indeterminate",
+               "Parity",
+               "Multihit",
+       };
+
+       /* Print things out */
+       if (evt->version != MCE_V1) {
+               pr_err("Machine Check Exception, Unknown event version %d !\n",
+                      evt->version);
+               return;
+       }
+       switch (evt->severity) {
+       case MCE_SEV_NO_ERROR:
+               level = KERN_INFO;
+               sevstr = "Harmless";
+               break;
+       case MCE_SEV_WARNING:
+               level = KERN_WARNING;
+               sevstr = "";
+               break;
+       case MCE_SEV_ERROR_SYNC:
+               level = KERN_ERR;
+               sevstr = "Severe";
+               break;
+       case MCE_SEV_FATAL:
+       default:
+               level = KERN_ERR;
+               sevstr = "Fatal";
+               break;
+       }
+
+       printk("%s%s Machine check interrupt [%s]\n", level, sevstr,
+              evt->disposition == MCE_DISPOSITION_RECOVERED ?
+              "Recovered" : "[Not recovered");
+       printk("%s  Initiator: %s\n", level,
+              evt->initiator == MCE_INITIATOR_CPU ? "CPU" : "Unknown");
+       switch (evt->error_type) {
+       case MCE_ERROR_TYPE_UE:
+               subtype = evt->u.ue_error.ue_error_type <
+                       ARRAY_SIZE(mc_ue_types) ?
+                       mc_ue_types[evt->u.ue_error.ue_error_type]
+                       : "Unknown";
+               printk("%s  Error type: UE [%s]\n", level, subtype);
+               if (evt->u.ue_error.effective_address_provided)
+                       printk("%s    Effective address: %016llx\n",
+                              level, evt->u.ue_error.effective_address);
+               if (evt->u.ue_error.physical_address_provided)
+                       printk("%s      Physial address: %016llx\n",
+                              level, evt->u.ue_error.physical_address);
+               break;
+       case MCE_ERROR_TYPE_SLB:
+               subtype = evt->u.slb_error.slb_error_type <
+                       ARRAY_SIZE(mc_slb_types) ?
+                       mc_slb_types[evt->u.slb_error.slb_error_type]
+                       : "Unknown";
+               printk("%s  Error type: SLB [%s]\n", level, subtype);
+               if (evt->u.slb_error.effective_address_provided)
+                       printk("%s    Effective address: %016llx\n",
+                              level, evt->u.slb_error.effective_address);
+               break;
+       case MCE_ERROR_TYPE_ERAT:
+               subtype = evt->u.erat_error.erat_error_type <
+                       ARRAY_SIZE(mc_erat_types) ?
+                       mc_erat_types[evt->u.erat_error.erat_error_type]
+                       : "Unknown";
+               printk("%s  Error type: ERAT [%s]\n", level, subtype);
+               if (evt->u.erat_error.effective_address_provided)
+                       printk("%s    Effective address: %016llx\n",
+                              level, evt->u.erat_error.effective_address);
+               break;
+       case MCE_ERROR_TYPE_TLB:
+               subtype = evt->u.tlb_error.tlb_error_type <
+                       ARRAY_SIZE(mc_tlb_types) ?
+                       mc_tlb_types[evt->u.tlb_error.tlb_error_type]
+                       : "Unknown";
+               printk("%s  Error type: TLB [%s]\n", level, subtype);
+               if (evt->u.tlb_error.effective_address_provided)
+                       printk("%s    Effective address: %016llx\n",
+                              level, evt->u.tlb_error.effective_address);
+               break;
+       default:
+       case MCE_ERROR_TYPE_UNKNOWN:
+               printk("%s  Error type: Unknown\n", level);
+               break;
+       }
+}
+
+uint64_t get_mce_fault_addr(struct machine_check_event *evt)
+{
+       switch (evt->error_type) {
+       case MCE_ERROR_TYPE_UE:
+               if (evt->u.ue_error.effective_address_provided)
+                       return evt->u.ue_error.effective_address;
+               break;
+       case MCE_ERROR_TYPE_SLB:
+               if (evt->u.slb_error.effective_address_provided)
+                       return evt->u.slb_error.effective_address;
+               break;
+       case MCE_ERROR_TYPE_ERAT:
+               if (evt->u.erat_error.effective_address_provided)
+                       return evt->u.erat_error.effective_address;
+               break;
+       case MCE_ERROR_TYPE_TLB:
+               if (evt->u.tlb_error.effective_address_provided)
+                       return evt->u.tlb_error.effective_address;
+               break;
+       default:
+       case MCE_ERROR_TYPE_UNKNOWN:
+               break;
+       }
+       return 0;
+}
+EXPORT_SYMBOL(get_mce_fault_addr);
diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c
new file mode 100644 (file)
index 0000000..b36e777
--- /dev/null
@@ -0,0 +1,284 @@
+/*
+ * Machine check exception handling CPU-side for power7 and power8
+ *
+ * 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.
+ *
+ * Copyright 2013 IBM Corporation
+ * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
+ */
+
+#undef DEBUG
+#define pr_fmt(fmt) "mce_power: " fmt
+
+#include <linux/types.h>
+#include <linux/ptrace.h>
+#include <asm/mmu.h>
+#include <asm/mce.h>
+
+/* flush SLBs and reload */
+static void flush_and_reload_slb(void)
+{
+       struct slb_shadow *slb;
+       unsigned long i, n;
+
+       /* Invalidate all SLBs */
+       asm volatile("slbmte %0,%0; slbia" : : "r" (0));
+
+#ifdef CONFIG_KVM_BOOK3S_HANDLER
+       /*
+        * If machine check is hit when in guest or in transition, we will
+        * only flush the SLBs and continue.
+        */
+       if (get_paca()->kvm_hstate.in_guest)
+               return;
+#endif
+
+       /* For host kernel, reload the SLBs from shadow SLB buffer. */
+       slb = get_slb_shadow();
+       if (!slb)
+               return;
+
+       n = min_t(u32, slb->persistent, SLB_MIN_SIZE);
+
+       /* Load up the SLB entries from shadow SLB */
+       for (i = 0; i < n; i++) {
+               unsigned long rb = slb->save_area[i].esid;
+               unsigned long rs = slb->save_area[i].vsid;
+
+               rb = (rb & ~0xFFFul) | i;
+               asm volatile("slbmte %0,%1" : : "r" (rs), "r" (rb));
+       }
+}
+
+static long mce_handle_derror(uint64_t dsisr, uint64_t slb_error_bits)
+{
+       long handled = 1;
+
+       /*
+        * flush and reload SLBs for SLB errors and flush TLBs for TLB errors.
+        * reset the error bits whenever we handle them so that at the end
+        * we can check whether we handled all of them or not.
+        * */
+       if (dsisr & slb_error_bits) {
+               flush_and_reload_slb();
+               /* reset error bits */
+               dsisr &= ~(slb_error_bits);
+       }
+       if (dsisr & P7_DSISR_MC_TLB_MULTIHIT_MFTLB) {
+               if (cur_cpu_spec && cur_cpu_spec->flush_tlb)
+                       cur_cpu_spec->flush_tlb(TLBIEL_INVAL_PAGE);
+               /* reset error bits */
+               dsisr &= ~P7_DSISR_MC_TLB_MULTIHIT_MFTLB;
+       }
+       /* Any other errors we don't understand? */
+       if (dsisr & 0xffffffffUL)
+               handled = 0;
+
+       return handled;
+}
+
+static long mce_handle_derror_p7(uint64_t dsisr)
+{
+       return mce_handle_derror(dsisr, P7_DSISR_MC_SLB_ERRORS);
+}
+
+static long mce_handle_common_ierror(uint64_t srr1)
+{
+       long handled = 0;
+
+       switch (P7_SRR1_MC_IFETCH(srr1)) {
+       case 0:
+               break;
+       case P7_SRR1_MC_IFETCH_SLB_PARITY:
+       case P7_SRR1_MC_IFETCH_SLB_MULTIHIT:
+               /* flush and reload SLBs for SLB errors. */
+               flush_and_reload_slb();
+               handled = 1;
+               break;
+       case P7_SRR1_MC_IFETCH_TLB_MULTIHIT:
+               if (cur_cpu_spec && cur_cpu_spec->flush_tlb) {
+                       cur_cpu_spec->flush_tlb(TLBIEL_INVAL_PAGE);
+                       handled = 1;
+               }
+               break;
+       default:
+               break;
+       }
+
+       return handled;
+}
+
+static long mce_handle_ierror_p7(uint64_t srr1)
+{
+       long handled = 0;
+
+       handled = mce_handle_common_ierror(srr1);
+
+       if (P7_SRR1_MC_IFETCH(srr1) == P7_SRR1_MC_IFETCH_SLB_BOTH) {
+               flush_and_reload_slb();
+               handled = 1;
+       }
+       return handled;
+}
+
+static void mce_get_common_ierror(struct mce_error_info *mce_err, uint64_t srr1)
+{
+       switch (P7_SRR1_MC_IFETCH(srr1)) {
+       case P7_SRR1_MC_IFETCH_SLB_PARITY:
+               mce_err->error_type = MCE_ERROR_TYPE_SLB;
+               mce_err->u.slb_error_type = MCE_SLB_ERROR_PARITY;
+               break;
+       case P7_SRR1_MC_IFETCH_SLB_MULTIHIT:
+               mce_err->error_type = MCE_ERROR_TYPE_SLB;
+               mce_err->u.slb_error_type = MCE_SLB_ERROR_MULTIHIT;
+               break;
+       case P7_SRR1_MC_IFETCH_TLB_MULTIHIT:
+               mce_err->error_type = MCE_ERROR_TYPE_TLB;
+               mce_err->u.tlb_error_type = MCE_TLB_ERROR_MULTIHIT;
+               break;
+       case P7_SRR1_MC_IFETCH_UE:
+       case P7_SRR1_MC_IFETCH_UE_IFU_INTERNAL:
+               mce_err->error_type = MCE_ERROR_TYPE_UE;
+               mce_err->u.ue_error_type = MCE_UE_ERROR_IFETCH;
+               break;
+       case P7_SRR1_MC_IFETCH_UE_TLB_RELOAD:
+               mce_err->error_type = MCE_ERROR_TYPE_UE;
+               mce_err->u.ue_error_type =
+                               MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH;
+               break;
+       }
+}
+
+static void mce_get_ierror_p7(struct mce_error_info *mce_err, uint64_t srr1)
+{
+       mce_get_common_ierror(mce_err, srr1);
+       if (P7_SRR1_MC_IFETCH(srr1) == P7_SRR1_MC_IFETCH_SLB_BOTH) {
+               mce_err->error_type = MCE_ERROR_TYPE_SLB;
+               mce_err->u.slb_error_type = MCE_SLB_ERROR_INDETERMINATE;
+       }
+}
+
+static void mce_get_derror_p7(struct mce_error_info *mce_err, uint64_t dsisr)
+{
+       if (dsisr & P7_DSISR_MC_UE) {
+               mce_err->error_type = MCE_ERROR_TYPE_UE;
+               mce_err->u.ue_error_type = MCE_UE_ERROR_LOAD_STORE;
+       } else if (dsisr & P7_DSISR_MC_UE_TABLEWALK) {
+               mce_err->error_type = MCE_ERROR_TYPE_UE;
+               mce_err->u.ue_error_type =
+                               MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE;
+       } else if (dsisr & P7_DSISR_MC_ERAT_MULTIHIT) {
+               mce_err->error_type = MCE_ERROR_TYPE_ERAT;
+               mce_err->u.erat_error_type = MCE_ERAT_ERROR_MULTIHIT;
+       } else if (dsisr & P7_DSISR_MC_SLB_MULTIHIT) {
+               mce_err->error_type = MCE_ERROR_TYPE_SLB;
+               mce_err->u.slb_error_type = MCE_SLB_ERROR_MULTIHIT;
+       } else if (dsisr & P7_DSISR_MC_SLB_PARITY_MFSLB) {
+               mce_err->error_type = MCE_ERROR_TYPE_SLB;
+               mce_err->u.slb_error_type = MCE_SLB_ERROR_PARITY;
+       } else if (dsisr & P7_DSISR_MC_TLB_MULTIHIT_MFTLB) {
+               mce_err->error_type = MCE_ERROR_TYPE_TLB;
+               mce_err->u.tlb_error_type = MCE_TLB_ERROR_MULTIHIT;
+       } else if (dsisr & P7_DSISR_MC_SLB_MULTIHIT_PARITY) {
+               mce_err->error_type = MCE_ERROR_TYPE_SLB;
+               mce_err->u.slb_error_type = MCE_SLB_ERROR_INDETERMINATE;
+       }
+}
+
+long __machine_check_early_realmode_p7(struct pt_regs *regs)
+{
+       uint64_t srr1, addr;
+       long handled = 1;
+       struct mce_error_info mce_error_info = { 0 };
+
+       srr1 = regs->msr;
+
+       /*
+        * Handle memory errors depending whether this was a load/store or
+        * ifetch exception. Also, populate the mce error_type and
+        * type-specific error_type from either SRR1 or DSISR, depending
+        * whether this was a load/store or ifetch exception
+        */
+       if (P7_SRR1_MC_LOADSTORE(srr1)) {
+               handled = mce_handle_derror_p7(regs->dsisr);
+               mce_get_derror_p7(&mce_error_info, regs->dsisr);
+               addr = regs->dar;
+       } else {
+               handled = mce_handle_ierror_p7(srr1);
+               mce_get_ierror_p7(&mce_error_info, srr1);
+               addr = regs->nip;
+       }
+
+       save_mce_event(regs, handled, &mce_error_info, addr);
+       return handled;
+}
+
+static void mce_get_ierror_p8(struct mce_error_info *mce_err, uint64_t srr1)
+{
+       mce_get_common_ierror(mce_err, srr1);
+       if (P7_SRR1_MC_IFETCH(srr1) == P8_SRR1_MC_IFETCH_ERAT_MULTIHIT) {
+               mce_err->error_type = MCE_ERROR_TYPE_ERAT;
+               mce_err->u.erat_error_type = MCE_ERAT_ERROR_MULTIHIT;
+       }
+}
+
+static void mce_get_derror_p8(struct mce_error_info *mce_err, uint64_t dsisr)
+{
+       mce_get_derror_p7(mce_err, dsisr);
+       if (dsisr & P8_DSISR_MC_ERAT_MULTIHIT_SEC) {
+               mce_err->error_type = MCE_ERROR_TYPE_ERAT;
+               mce_err->u.erat_error_type = MCE_ERAT_ERROR_MULTIHIT;
+       }
+}
+
+static long mce_handle_ierror_p8(uint64_t srr1)
+{
+       long handled = 0;
+
+       handled = mce_handle_common_ierror(srr1);
+
+       if (P7_SRR1_MC_IFETCH(srr1) == P8_SRR1_MC_IFETCH_ERAT_MULTIHIT) {
+               flush_and_reload_slb();
+               handled = 1;
+       }
+       return handled;
+}
+
+static long mce_handle_derror_p8(uint64_t dsisr)
+{
+       return mce_handle_derror(dsisr, P8_DSISR_MC_SLB_ERRORS);
+}
+
+long __machine_check_early_realmode_p8(struct pt_regs *regs)
+{
+       uint64_t srr1, addr;
+       long handled = 1;
+       struct mce_error_info mce_error_info = { 0 };
+
+       srr1 = regs->msr;
+
+       if (P7_SRR1_MC_LOADSTORE(srr1)) {
+               handled = mce_handle_derror_p8(regs->dsisr);
+               mce_get_derror_p8(&mce_error_info, regs->dsisr);
+               addr = regs->dar;
+       } else {
+               handled = mce_handle_ierror_p8(srr1);
+               mce_get_ierror_p8(&mce_error_info, srr1);
+               addr = regs->nip;
+       }
+
+       save_mce_event(regs, handled, &mce_error_info, addr);
+       return handled;
+}
index e47d268727a4a8ed87948a4d3ab5f87ad00793b1..879f09620f8341e27dbfd1ed6be47fe242eab812 100644 (file)
@@ -344,7 +344,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_UNIFIED_ID_CACHE)
  */
 _KPROBE(flush_icache_range)
 BEGIN_FTR_SECTION
-       isync
+       PURGE_PREFETCHED_INS
        blr                             /* for 601, do nothing */
 END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
        li      r5,L1_CACHE_BYTES-1
@@ -448,6 +448,7 @@ _GLOBAL(invalidate_dcache_range)
  */
 _GLOBAL(__flush_dcache_icache)
 BEGIN_FTR_SECTION
+       PURGE_PREFETCHED_INS
        blr
 END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
        rlwinm  r3,r3,0,0,31-PAGE_SHIFT         /* Get page base address */
@@ -489,6 +490,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_44x)
  */
 _GLOBAL(__flush_dcache_icache_phys)
 BEGIN_FTR_SECTION
+       PURGE_PREFETCHED_INS
        blr                                     /* for 601, do nothing */
 END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
        mfmsr   r10
index e59caf874d05ed60e500579b06bfcdf38bd85125..a9f7a79a3a405b5cc7836adf060269bdfd45c219 100644 (file)
@@ -67,6 +67,7 @@ PPC64_CACHES:
 
 _KPROBE(flush_icache_range)
 BEGIN_FTR_SECTION
+       PURGE_PREFETCHED_INS
        blr
 END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
 /*
@@ -211,6 +212,11 @@ _GLOBAL(__flush_dcache_icache)
  * Different systems have different cache line sizes
  */
 
+BEGIN_FTR_SECTION
+       PURGE_PREFETCHED_INS
+       blr
+END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
+
 /* Flush the dcache */
        ld      r7,PPC64_CACHES@toc(r2)
        clrrdi  r3,r3,PAGE_SHIFT                    /* Page align */
index 0620eaaaad45b419c70475485a9d052c0ddbe246..623c356fe34f794f9fdeabb4d7a8edeccda081a3 100644 (file)
@@ -99,12 +99,28 @@ static inline void free_lppacas(void) { }
  * 3 persistent SLBs are registered here.  The buffer will be zero
  * initially, hence will all be invaild until we actually write them.
  */
-struct slb_shadow slb_shadow[] __cacheline_aligned = {
-       [0 ... (NR_CPUS-1)] = {
-               .persistent = cpu_to_be32(SLB_NUM_BOLTED),
-               .buffer_length = cpu_to_be32(sizeof(struct slb_shadow)),
-       },
-};
+static struct slb_shadow *slb_shadow;
+
+static void __init allocate_slb_shadows(int nr_cpus, int limit)
+{
+       int size = PAGE_ALIGN(sizeof(struct slb_shadow) * nr_cpus);
+       slb_shadow = __va(memblock_alloc_base(size, PAGE_SIZE, limit));
+       memset(slb_shadow, 0, size);
+}
+
+static struct slb_shadow * __init init_slb_shadow(int cpu)
+{
+       struct slb_shadow *s = &slb_shadow[cpu];
+
+       s->persistent = cpu_to_be32(SLB_NUM_BOLTED);
+       s->buffer_length = cpu_to_be32(sizeof(*s));
+
+       return s;
+}
+
+#else /* CONFIG_PPC_STD_MMU_64 */
+
+static void __init allocate_slb_shadows(int nr_cpus, int limit) { }
 
 #endif /* CONFIG_PPC_STD_MMU_64 */
 
@@ -142,7 +158,7 @@ void __init initialise_paca(struct paca_struct *new_paca, int cpu)
        new_paca->__current = &init_task;
        new_paca->data_offset = 0xfeeeeeeeeeeeeeeeULL;
 #ifdef CONFIG_PPC_STD_MMU_64
-       new_paca->slb_shadow_ptr = &slb_shadow[cpu];
+       new_paca->slb_shadow_ptr = init_slb_shadow(cpu);
 #endif /* CONFIG_PPC_STD_MMU_64 */
 }
 
@@ -190,6 +206,8 @@ void __init allocate_pacas(void)
 
        allocate_lppacas(nr_cpu_ids, limit);
 
+       allocate_slb_shadows(nr_cpu_ids, limit);
+
        /* Can't use for_each_*_cpu, as they aren't functional yet */
        for (cpu = 0; cpu < nr_cpu_ids; cpu++)
                initialise_paca(&paca[cpu], cpu);
index 4085aaa9478fd90eff1f1ce149d661bc7488284f..2232aff660599ef1294668f5b97e1c234c63f466 100644 (file)
@@ -520,9 +520,6 @@ static void __init irqstack_early_init(void)
 #ifdef CONFIG_PPC_BOOK3E
 static void __init exc_lvl_early_init(void)
 {
-       extern unsigned int interrupt_base_book3e;
-       extern unsigned int exc_debug_debug_book3e;
-
        unsigned int i;
 
        for_each_possible_cpu(i) {
@@ -535,8 +532,7 @@ static void __init exc_lvl_early_init(void)
        }
 
        if (cpu_has_feature(CPU_FTR_DEBUG_LVL_EXC))
-               patch_branch(&interrupt_base_book3e + (0x040 / 4) + 1,
-                            (unsigned long)&exc_debug_debug_book3e, 0);
+               patch_exception(0x040, exc_debug_debug_book3e);
 }
 #else
 #define exc_lvl_early_init()
@@ -544,7 +540,8 @@ static void __init exc_lvl_early_init(void)
 
 /*
  * Stack space used when we detect a bad kernel stack pointer, and
- * early in SMP boots before relocation is enabled.
+ * early in SMP boots before relocation is enabled. Exclusive emergency
+ * stack for machine checks.
  */
 static void __init emergency_stack_init(void)
 {
@@ -567,6 +564,13 @@ static void __init emergency_stack_init(void)
                sp  = memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit);
                sp += THREAD_SIZE;
                paca[i].emergency_sp = __va(sp);
+
+#ifdef CONFIG_PPC_BOOK3S_64
+               /* emergency stack for machine check exception handling. */
+               sp  = memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit);
+               sp += THREAD_SIZE;
+               paca[i].mc_emergency_sp = __va(sp);
+#endif
        }
 }
 
index a3b64f3bf9a298b057cfdc57b008ea01eebecf63..19d654b0150a487f8cbd2168f1d3b0136065db7d 100644 (file)
@@ -369,13 +369,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
        cpumask_set_cpu(boot_cpuid, cpu_sibling_mask(boot_cpuid));
        cpumask_set_cpu(boot_cpuid, cpu_core_mask(boot_cpuid));
 
-       if (smp_ops)
-               if (smp_ops->probe)
-                       max_cpus = smp_ops->probe();
-               else
-                       max_cpus = NR_CPUS;
-       else
-               max_cpus = 1;
+       if (smp_ops && smp_ops->probe)
+               smp_ops->probe();
 }
 
 void smp_prepare_boot_cpu(void)
index b4e667663d9bfc2e9954435790b0ebc5b6fc94ca..cad777eb613af11ef6f1b736610a326605c9b12d 100644 (file)
@@ -108,14 +108,14 @@ void ppc_enable_pmcs(void)
 }
 EXPORT_SYMBOL(ppc_enable_pmcs);
 
-#define SYSFS_PMCSETUP(NAME, ADDRESS) \
+#define __SYSFS_SPRSETUP(NAME, ADDRESS, EXTRA) \
 static void read_##NAME(void *val) \
 { \
        *(unsigned long *)val = mfspr(ADDRESS); \
 } \
 static void write_##NAME(void *val) \
 { \
-       ppc_enable_pmcs(); \
+       EXTRA; \
        mtspr(ADDRESS, *(unsigned long *)val);  \
 } \
 static ssize_t show_##NAME(struct device *dev, \
@@ -140,6 +140,10 @@ static ssize_t __used \
        return count; \
 }
 
+#define SYSFS_PMCSETUP(NAME, ADDRESS)  \
+       __SYSFS_SPRSETUP(NAME, ADDRESS, ppc_enable_pmcs())
+#define SYSFS_SPRSETUP(NAME, ADDRESS)  \
+       __SYSFS_SPRSETUP(NAME, ADDRESS, )
 
 /* Let's define all possible registers, we'll only hook up the ones
  * that are implemented on the current processor
@@ -175,10 +179,10 @@ SYSFS_PMCSETUP(pmc7, SPRN_PMC7);
 SYSFS_PMCSETUP(pmc8, SPRN_PMC8);
 
 SYSFS_PMCSETUP(mmcra, SPRN_MMCRA);
-SYSFS_PMCSETUP(purr, SPRN_PURR);
-SYSFS_PMCSETUP(spurr, SPRN_SPURR);
-SYSFS_PMCSETUP(dscr, SPRN_DSCR);
-SYSFS_PMCSETUP(pir, SPRN_PIR);
+SYSFS_SPRSETUP(purr, SPRN_PURR);
+SYSFS_SPRSETUP(spurr, SPRN_SPURR);
+SYSFS_SPRSETUP(dscr, SPRN_DSCR);
+SYSFS_SPRSETUP(pir, SPRN_PIR);
 
 /*
   Lets only enable read for phyp resources and
@@ -249,34 +253,34 @@ SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3);
 SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4);
 SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5);
 #ifdef CONFIG_DEBUG_KERNEL
-SYSFS_PMCSETUP(hid0, SPRN_HID0);
-SYSFS_PMCSETUP(hid1, SPRN_HID1);
-SYSFS_PMCSETUP(hid4, SPRN_HID4);
-SYSFS_PMCSETUP(hid5, SPRN_HID5);
-SYSFS_PMCSETUP(ima0, SPRN_PA6T_IMA0);
-SYSFS_PMCSETUP(ima1, SPRN_PA6T_IMA1);
-SYSFS_PMCSETUP(ima2, SPRN_PA6T_IMA2);
-SYSFS_PMCSETUP(ima3, SPRN_PA6T_IMA3);
-SYSFS_PMCSETUP(ima4, SPRN_PA6T_IMA4);
-SYSFS_PMCSETUP(ima5, SPRN_PA6T_IMA5);
-SYSFS_PMCSETUP(ima6, SPRN_PA6T_IMA6);
-SYSFS_PMCSETUP(ima7, SPRN_PA6T_IMA7);
-SYSFS_PMCSETUP(ima8, SPRN_PA6T_IMA8);
-SYSFS_PMCSETUP(ima9, SPRN_PA6T_IMA9);
-SYSFS_PMCSETUP(imaat, SPRN_PA6T_IMAAT);
-SYSFS_PMCSETUP(btcr, SPRN_PA6T_BTCR);
-SYSFS_PMCSETUP(pccr, SPRN_PA6T_PCCR);
-SYSFS_PMCSETUP(rpccr, SPRN_PA6T_RPCCR);
-SYSFS_PMCSETUP(der, SPRN_PA6T_DER);
-SYSFS_PMCSETUP(mer, SPRN_PA6T_MER);
-SYSFS_PMCSETUP(ber, SPRN_PA6T_BER);
-SYSFS_PMCSETUP(ier, SPRN_PA6T_IER);
-SYSFS_PMCSETUP(sier, SPRN_PA6T_SIER);
-SYSFS_PMCSETUP(siar, SPRN_PA6T_SIAR);
-SYSFS_PMCSETUP(tsr0, SPRN_PA6T_TSR0);
-SYSFS_PMCSETUP(tsr1, SPRN_PA6T_TSR1);
-SYSFS_PMCSETUP(tsr2, SPRN_PA6T_TSR2);
-SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3);
+SYSFS_SPRSETUP(hid0, SPRN_HID0);
+SYSFS_SPRSETUP(hid1, SPRN_HID1);
+SYSFS_SPRSETUP(hid4, SPRN_HID4);
+SYSFS_SPRSETUP(hid5, SPRN_HID5);
+SYSFS_SPRSETUP(ima0, SPRN_PA6T_IMA0);
+SYSFS_SPRSETUP(ima1, SPRN_PA6T_IMA1);
+SYSFS_SPRSETUP(ima2, SPRN_PA6T_IMA2);
+SYSFS_SPRSETUP(ima3, SPRN_PA6T_IMA3);
+SYSFS_SPRSETUP(ima4, SPRN_PA6T_IMA4);
+SYSFS_SPRSETUP(ima5, SPRN_PA6T_IMA5);
+SYSFS_SPRSETUP(ima6, SPRN_PA6T_IMA6);
+SYSFS_SPRSETUP(ima7, SPRN_PA6T_IMA7);
+SYSFS_SPRSETUP(ima8, SPRN_PA6T_IMA8);
+SYSFS_SPRSETUP(ima9, SPRN_PA6T_IMA9);
+SYSFS_SPRSETUP(imaat, SPRN_PA6T_IMAAT);
+SYSFS_SPRSETUP(btcr, SPRN_PA6T_BTCR);
+SYSFS_SPRSETUP(pccr, SPRN_PA6T_PCCR);
+SYSFS_SPRSETUP(rpccr, SPRN_PA6T_RPCCR);
+SYSFS_SPRSETUP(der, SPRN_PA6T_DER);
+SYSFS_SPRSETUP(mer, SPRN_PA6T_MER);
+SYSFS_SPRSETUP(ber, SPRN_PA6T_BER);
+SYSFS_SPRSETUP(ier, SPRN_PA6T_IER);
+SYSFS_SPRSETUP(sier, SPRN_PA6T_SIER);
+SYSFS_SPRSETUP(siar, SPRN_PA6T_SIAR);
+SYSFS_SPRSETUP(tsr0, SPRN_PA6T_TSR0);
+SYSFS_SPRSETUP(tsr1, SPRN_PA6T_TSR1);
+SYSFS_SPRSETUP(tsr2, SPRN_PA6T_TSR2);
+SYSFS_SPRSETUP(tsr3, SPRN_PA6T_TSR3);
 #endif /* CONFIG_DEBUG_KERNEL */
 #endif /* HAS_PPC_PMC_PA6T */
 
index b3b144121cc99d64df0c409b0773259770ddf0af..afb1b56ef4fa6481f940e85130e17b4efc585023 100644 (file)
@@ -510,7 +510,6 @@ void timer_interrupt(struct pt_regs * regs)
         */
        may_hard_irq_enable();
 
-       __get_cpu_var(irq_stat).timer_irqs++;
 
 #if defined(CONFIG_PPC32) && defined(CONFIG_PMAC)
        if (atomic_read(&ppc_n_lost_interrupts) != 0)
@@ -532,10 +531,12 @@ void timer_interrupt(struct pt_regs * regs)
                *next_tb = ~(u64)0;
                if (evt->event_handler)
                        evt->event_handler(evt);
+               __get_cpu_var(irq_stat).timer_irqs_event++;
        } else {
                now = *next_tb - now;
                if (now <= DECREMENTER_MAX)
                        set_dec((int)now);
+               __get_cpu_var(irq_stat).timer_irqs_others++;
        }
 
 #ifdef CONFIG_PPC64
index 907a472f9a9e4c1db3747a8d4ff22cc1bb133ee8..330841766b09ef852fa96b5874b8619d8a7d950c 100644 (file)
@@ -285,6 +285,21 @@ void system_reset_exception(struct pt_regs *regs)
 
        /* What should we do here? We could issue a shutdown or hard reset. */
 }
+
+/*
+ * This function is called in real mode. Strictly no printk's please.
+ *
+ * regs->nip and regs->msr contains srr0 and ssr1.
+ */
+long machine_check_early(struct pt_regs *regs)
+{
+       long handled = 0;
+
+       if (cur_cpu_spec && cur_cpu_spec->machine_check_early)
+               handled = cur_cpu_spec->machine_check_early(regs);
+       return handled;
+}
+
 #endif
 
 /*
index a353c485808c6ea203eac428106b5fdf41943b36..768a9f977c001ee73e6d5aa2f0b8ee44ea3b35f5 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/kvm_host.h>
 #include <linux/kernel.h>
 #include <asm/opal.h>
+#include <asm/mce.h>
 
 /* SRR1 bits for machine check on POWER7 */
 #define SRR1_MC_LDSTERR                (1ul << (63-42))
@@ -58,18 +59,6 @@ static void reload_slb(struct kvm_vcpu *vcpu)
        }
 }
 
-/* POWER7 TLB flush */
-static void flush_tlb_power7(struct kvm_vcpu *vcpu)
-{
-       unsigned long i, rb;
-
-       rb = TLBIEL_INVAL_SET_LPID;
-       for (i = 0; i < POWER7_TLB_SETS; ++i) {
-               asm volatile("tlbiel %0" : : "r" (rb));
-               rb += 1 << TLBIEL_INVAL_SET_SHIFT;
-       }
-}
-
 /*
  * On POWER7, see if we can handle a machine check that occurred inside
  * the guest in real mode, without switching to the host partition.
@@ -79,9 +68,7 @@ static void flush_tlb_power7(struct kvm_vcpu *vcpu)
 static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu)
 {
        unsigned long srr1 = vcpu->arch.shregs.msr;
-#ifdef CONFIG_PPC_POWERNV
-       struct opal_machine_check_event *opal_evt;
-#endif
+       struct machine_check_event mce_evt;
        long handled = 1;
 
        if (srr1 & SRR1_MC_LDSTERR) {
@@ -96,7 +83,8 @@ static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu)
                                   DSISR_MC_SLB_PARITY | DSISR_MC_DERAT_MULTI);
                }
                if (dsisr & DSISR_MC_TLB_MULTI) {
-                       flush_tlb_power7(vcpu);
+                       if (cur_cpu_spec && cur_cpu_spec->flush_tlb)
+                               cur_cpu_spec->flush_tlb(TLBIEL_INVAL_SET_LPID);
                        dsisr &= ~DSISR_MC_TLB_MULTI;
                }
                /* Any other errors we don't understand? */
@@ -113,28 +101,38 @@ static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu)
                reload_slb(vcpu);
                break;
        case SRR1_MC_IFETCH_TLBMULTI:
-               flush_tlb_power7(vcpu);
+               if (cur_cpu_spec && cur_cpu_spec->flush_tlb)
+                       cur_cpu_spec->flush_tlb(TLBIEL_INVAL_SET_LPID);
                break;
        default:
                handled = 0;
        }
 
-#ifdef CONFIG_PPC_POWERNV
        /*
-        * See if OPAL has already handled the condition.
-        * We assume that if the condition is recovered then OPAL
+        * See if we have already handled the condition in the linux host.
+        * We assume that if the condition is recovered then linux host
         * will have generated an error log event that we will pick
         * up and log later.
+        * Don't release mce event now. In case if condition is not
+        * recovered we do guest exit and go back to linux host machine
+        * check handler. Hence we need make sure that current mce event
+        * is available for linux host to consume.
         */
-       opal_evt = local_paca->opal_mc_evt;
-       if (opal_evt->version == OpalMCE_V1 &&
-           (opal_evt->severity == OpalMCE_SEV_NO_ERROR ||
-            opal_evt->disposition == OpalMCE_DISPOSITION_RECOVERED))
+       if (!get_mce_event(&mce_evt, MCE_EVENT_DONTRELEASE))
+               goto out;
+
+       if (mce_evt.version == MCE_V1 &&
+           (mce_evt.severity == MCE_SEV_NO_ERROR ||
+            mce_evt.disposition == MCE_DISPOSITION_RECOVERED))
                handled = 1;
 
+out:
+       /*
+        * If we have handled the error, then release the mce event because
+        * we will be delivering machine check to guest.
+        */
        if (handled)
-               opal_evt->in_use = 0;
-#endif
+               release_mce_event();
 
        return handled;
 }
index 17e5b23643124347febe56a05f5deb7e1a2e361e..d5edbeb8eb8209e61a9d6524acfa565e3f30782f 100644 (file)
@@ -159,6 +159,21 @@ unsigned int translate_branch(const unsigned int *dest, const unsigned int *src)
        return 0;
 }
 
+#ifdef CONFIG_PPC_BOOK3E_64
+void __patch_exception(int exc, unsigned long addr)
+{
+       extern unsigned int interrupt_base_book3e;
+       unsigned int *ibase = &interrupt_base_book3e;
+
+       /* Our exceptions vectors start with a NOP and -then- a branch
+        * to deal with single stepping from userspace which stops on
+        * the second instruction. Thus we need to patch the second
+        * instruction of the exception, not the first one
+        */
+
+       patch_branch(ibase + (exc / 4) + 1, addr, 0);
+}
+#endif
 
 #ifdef CONFIG_CODE_PATCHING_SELFTEST
 
index d3cbda62857b92ffb0867c4fe0ab1deeb0979313..1136d26a95ae02ac075914e13f54720864b71fea 100644 (file)
@@ -148,7 +148,10 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
        and     r0,r0,r4                /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
        andc    r0,r30,r0               /* r0 = pte & ~r0 */
        rlwimi  r3,r0,32-1,31,31        /* Insert result into PP lsb */
-       ori     r3,r3,HPTE_R_C          /* Always add "C" bit for perf. */
+       /*
+        * Always add "C" bit for perf. Memory coherence is always enabled
+        */
+       ori     r3,r3,HPTE_R_C | HPTE_R_M
 
        /* We eventually do the icache sync here (maybe inline that
         * code rather than call a C function...) 
@@ -457,7 +460,10 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
        and     r0,r0,r4                /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
        andc    r0,r3,r0                /* r0 = pte & ~r0 */
        rlwimi  r3,r0,32-1,31,31        /* Insert result into PP lsb */
-       ori     r3,r3,HPTE_R_C          /* Always add "C" bit for perf. */
+       /*
+        * Always add "C" bit for perf. Memory coherence is always enabled
+        */
+       ori     r3,r3,HPTE_R_C | HPTE_R_M
 
        /* We eventually do the icache sync here (maybe inline that
         * code rather than call a C function...)
@@ -795,7 +801,10 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
        and     r0,r0,r4                /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
        andc    r0,r30,r0               /* r0 = pte & ~r0 */
        rlwimi  r3,r0,32-1,31,31        /* Insert result into PP lsb */
-       ori     r3,r3,HPTE_R_C          /* Always add "C" bit for perf. */
+       /*
+        * Always add "C" bit for perf. Memory coherence is always enabled
+        */
+       ori     r3,r3,HPTE_R_C | HPTE_R_M
 
        /* We eventually do the icache sync here (maybe inline that
         * code rather than call a C function...)
index 6176b3cdf57991590df2b26f42f27eed593096bb..de6881259aef3bd552c53ea77751093336e2e5be 100644 (file)
@@ -169,9 +169,10 @@ static unsigned long htab_convert_pte_flags(unsigned long pteflags)
        if ((pteflags & _PAGE_USER) && !((pteflags & _PAGE_RW) &&
                                         (pteflags & _PAGE_DIRTY)))
                rflags |= 1;
-
-       /* Always add C */
-       return rflags | HPTE_R_C;
+       /*
+        * Always add "C" bit for perf. Memory coherence is always enabled
+        */
+       return rflags | HPTE_R_C | HPTE_R_M;
 }
 
 int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
index 34de9e0cdc3466313eea62bbdd7079df409547c8..826893fcb3a78b0198d5fa4b0b047428d8852802 100644 (file)
@@ -127,7 +127,11 @@ repeat:
 
                /* Add in WIMG bits */
                rflags |= (new_pmd & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
-                                     _PAGE_COHERENT | _PAGE_GUARDED));
+                                     _PAGE_GUARDED));
+               /*
+                * enable the memory coherence always
+                */
+               rflags |= HPTE_R_M;
 
                /* Insert into the hash table, primary slot */
                slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0,
index 0b7fb6761015526a38be8dac7ee51d0ca4d9f161..a5bcf930119691ad01c4116faaece823292669aa 100644 (file)
@@ -99,6 +99,10 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
                /* Add in WIMG bits */
                rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
                                      _PAGE_COHERENT | _PAGE_GUARDED));
+               /*
+                * enable the memory coherence always
+                */
+               rflags |= HPTE_R_M;
 
                slot = hpte_insert_repeating(hash, vpn, pa, rflags, 0,
                                             mmu_psize, ssize);
index 841e0d00863c94d99cac5c139b887dc97c21cfe1..ad90429bbd8b4b25883738bd867719588ac32b92 100644 (file)
@@ -174,7 +174,7 @@ void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
                pte_t pte)
 {
 #ifdef CONFIG_DEBUG_VM
-       WARN_ON(pte_present(*ptep));
+       WARN_ON(pte_val(*ptep) & _PAGE_PRESENT);
 #endif
        /* Note: mm->context.id might not yet have been assigned as
         * this context might not have been activated yet when this
index 9d95786aa80ffbdcb8601379d774fc1f158006d0..02e8681fb8655a724b6e75746301d8a0cbb6befb 100644 (file)
@@ -687,7 +687,7 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
                pmd_t *pmdp, pmd_t pmd)
 {
 #ifdef CONFIG_DEBUG_VM
-       WARN_ON(!pmd_none(*pmdp));
+       WARN_ON(pmd_val(*pmdp) & _PAGE_PRESENT);
        assert_spin_locked(&mm->page_table_lock);
        WARN_ON(!pmd_trans_huge(pmd));
 #endif
index 358d743031385ae7a269ba65200483227126d372..8805b7b87dc60e1f47e511116301d8865a86241f 100644 (file)
@@ -518,25 +518,6 @@ static void setup_page_sizes(void)
        }
 }
 
-static void __patch_exception(int exc, unsigned long addr)
-{
-       extern unsigned int interrupt_base_book3e;
-       unsigned int *ibase = &interrupt_base_book3e;
-       /* Our exceptions vectors start with a NOP and -then- a branch
-        * to deal with single stepping from userspace which stops on
-        * the second instruction. Thus we need to patch the second
-        * instruction of the exception, not the first one
-        */
-
-       patch_branch(ibase + (exc / 4) + 1, addr, 0);
-}
-
-#define patch_exception(exc, name) do { \
-       extern unsigned int name; \
-       __patch_exception((exc), (unsigned long)&name); \
-} while (0)
-
 static void setup_mmu_htw(void)
 {
        /* Check if HW tablewalk is present, and if yes, enable it by:
index fc9c1cbfcb1d5ff7719d75f7db46d36a8e93d1b9..5aa3f4b5332c575b6de4963e5d0ade67f6f63855 100644 (file)
@@ -1,9 +1,9 @@
 config PPC_MPC512x
        bool "512x-based boards"
        depends on 6xx
+       select COMMON_CLK
        select FSL_SOC
        select IPIC
-       select PPC_CLOCK
        select PPC_PCI_CHOICE
        select FSL_PCI if PCI
        select ARCH_WANT_OPTIONAL_GPIOLIB
index 72fb9340e09fa7bd2c8e4921a4e57bfdda3d760b..01693121a2b1a54feedcaac3489a4ea96f0ad64b 100644 (file)
@@ -1,7 +1,8 @@
 #
 # Makefile for the Freescale PowerPC 512x linux kernel.
 #
-obj-y                          += clock.o mpc512x_shared.o
+obj-$(CONFIG_COMMON_CLK)       += clock-commonclk.o
+obj-y                          += mpc512x_shared.o
 obj-$(CONFIG_MPC5121_ADS)      += mpc5121_ads.o mpc5121_ads_cpld.o
 obj-$(CONFIG_MPC512x_GENERIC)  += mpc512x_generic.o
 obj-$(CONFIG_PDM360NG)         += pdm360ng.o
diff --git a/arch/powerpc/platforms/512x/clock-commonclk.c b/arch/powerpc/platforms/512x/clock-commonclk.c
new file mode 100644 (file)
index 0000000..29b5fa6
--- /dev/null
@@ -0,0 +1,950 @@
+/*
+ * Copyright (C) 2013 DENX Software Engineering
+ *
+ * Gerhard Sittig, <gsi@denx.de>
+ *
+ * common clock driver support for the MPC512x platform
+ *
+ * This 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/bitops.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+
+#include <asm/mpc5121.h>
+#include <dt-bindings/clock/mpc512x-clock.h>
+
+#include "mpc512x.h"           /* our public mpc5121_clk_init() API */
+
+/* helpers to keep the MCLK intermediates "somewhere" in our table */
+enum {
+       MCLK_IDX_MUX0,
+       MCLK_IDX_EN0,
+       MCLK_IDX_DIV0,
+       MCLK_MAX_IDX,
+};
+
+#define NR_PSCS                        12
+#define NR_MSCANS              4
+#define NR_SPDIFS              1
+#define NR_MCLKS               (NR_PSCS + NR_MSCANS + NR_SPDIFS)
+
+/* extend the public set of clocks by adding internal slots for management */
+enum {
+       /* arrange for adjacent numbers after the public set */
+       MPC512x_CLK_START_PRIVATE = MPC512x_CLK_LAST_PUBLIC,
+       /* clocks which aren't announced to the public */
+       MPC512x_CLK_DDR,
+       MPC512x_CLK_MEM,
+       MPC512x_CLK_IIM,
+       MPC512x_CLK_SDHC_2,
+       /* intermediates in div+gate combos or fractional dividers */
+       MPC512x_CLK_DDR_UG,
+       MPC512x_CLK_SDHC_x4,
+       MPC512x_CLK_SDHC_UG,
+       MPC512x_CLK_DIU_x4,
+       MPC512x_CLK_DIU_UG,
+       MPC512x_CLK_MBX_BUS_UG,
+       MPC512x_CLK_MBX_UG,
+       MPC512x_CLK_MBX_3D_UG,
+       MPC512x_CLK_PCI_UG,
+       MPC512x_CLK_NFC_UG,
+       MPC512x_CLK_LPC_UG,
+       MPC512x_CLK_SPDIF_TX_IN,
+       /* intermediates for the mux+gate+div+mux MCLK generation */
+       MPC512x_CLK_MCLKS_FIRST,
+       MPC512x_CLK_MCLKS_LAST = MPC512x_CLK_MCLKS_FIRST
+                               + NR_MCLKS * MCLK_MAX_IDX,
+       /* internal, symbolic spec for the number of slots */
+       MPC512x_CLK_LAST_PRIVATE,
+};
+
+/* data required for the OF clock provider registration */
+static struct clk *clks[MPC512x_CLK_LAST_PRIVATE];
+static struct clk_onecell_data clk_data;
+
+/* CCM register access */
+static struct mpc512x_ccm __iomem *clkregs;
+static DEFINE_SPINLOCK(clklock);
+
+/* convenience wrappers around the common clk API */
+static inline struct clk *mpc512x_clk_fixed(const char *name, int rate)
+{
+       return clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate);
+}
+
+static inline struct clk *mpc512x_clk_factor(
+       const char *name, const char *parent_name,
+       int mul, int div)
+{
+       int clkflags;
+
+       clkflags = CLK_SET_RATE_PARENT;
+       return clk_register_fixed_factor(NULL, name, parent_name, clkflags,
+                                        mul, div);
+}
+
+static inline struct clk *mpc512x_clk_divider(
+       const char *name, const char *parent_name, u8 clkflags,
+       u32 __iomem *reg, u8 pos, u8 len, int divflags)
+{
+       return clk_register_divider(NULL, name, parent_name, clkflags,
+                                   reg, pos, len, divflags, &clklock);
+}
+
+static inline struct clk *mpc512x_clk_divtable(
+       const char *name, const char *parent_name,
+       u32 __iomem *reg, u8 pos, u8 len,
+       const struct clk_div_table *divtab)
+{
+       u8 divflags;
+
+       divflags = 0;
+       return clk_register_divider_table(NULL, name, parent_name, 0,
+                                         reg, pos, len, divflags,
+                                         divtab, &clklock);
+}
+
+static inline struct clk *mpc512x_clk_gated(
+       const char *name, const char *parent_name,
+       u32 __iomem *reg, u8 pos)
+{
+       int clkflags;
+
+       clkflags = CLK_SET_RATE_PARENT;
+       return clk_register_gate(NULL, name, parent_name, clkflags,
+                                reg, pos, 0, &clklock);
+}
+
+static inline struct clk *mpc512x_clk_muxed(const char *name,
+       const char **parent_names, int parent_count,
+       u32 __iomem *reg, u8 pos, u8 len)
+{
+       int clkflags;
+       u8 muxflags;
+
+       clkflags = CLK_SET_RATE_PARENT;
+       muxflags = 0;
+       return clk_register_mux(NULL, name,
+                               parent_names, parent_count, clkflags,
+                               reg, pos, len, muxflags, &clklock);
+}
+
+/* helper to isolate a bit field from a register */
+static inline int get_bit_field(uint32_t __iomem *reg, uint8_t pos, uint8_t len)
+{
+       uint32_t val;
+
+       val = in_be32(reg);
+       val >>= pos;
+       val &= (1 << len) - 1;
+       return val;
+}
+
+/* get the SPMF and translate it into the "sys pll" multiplier */
+static int get_spmf_mult(void)
+{
+       static int spmf_to_mult[] = {
+               68, 1, 12, 16, 20, 24, 28, 32,
+               36, 40, 44, 48, 52, 56, 60, 64,
+       };
+       int spmf;
+
+       spmf = get_bit_field(&clkregs->spmr, 24, 4);
+       return spmf_to_mult[spmf];
+}
+
+/*
+ * get the SYS_DIV value and translate it into a divide factor
+ *
+ * values returned from here are a multiple of the real factor since the
+ * divide ratio is fractional
+ */
+static int get_sys_div_x2(void)
+{
+       static int sysdiv_code_to_x2[] = {
+               4, 5, 6, 7, 8, 9, 10, 14,
+               12, 16, 18, 22, 20, 24, 26, 30,
+               28, 32, 34, 38, 36, 40, 42, 46,
+               44, 48, 50, 54, 52, 56, 58, 62,
+               60, 64, 66,
+       };
+       int divcode;
+
+       divcode = get_bit_field(&clkregs->scfr2, 26, 6);
+       return sysdiv_code_to_x2[divcode];
+}
+
+/*
+ * get the CPMF value and translate it into a multiplier factor
+ *
+ * values returned from here are a multiple of the real factor since the
+ * multiplier ratio is fractional
+ */
+static int get_cpmf_mult_x2(void)
+{
+       static int cpmf_to_mult[] = {
+               72, 2, 2, 3, 4, 5, 6, 7,
+       };
+       int cpmf;
+
+       cpmf = get_bit_field(&clkregs->spmr, 16, 4);
+       return cpmf_to_mult[cpmf];
+}
+
+/*
+ * some of the clock dividers do scale in a linear way, yet not all of
+ * their bit combinations are legal; use a divider table to get a
+ * resulting set of applicable divider values
+ */
+
+/* applies to the IPS_DIV, and PCI_DIV values */
+static struct clk_div_table divtab_2346[] = {
+       { .val = 2, .div = 2, },
+       { .val = 3, .div = 3, },
+       { .val = 4, .div = 4, },
+       { .val = 6, .div = 6, },
+       { .div = 0, },
+};
+
+/* applies to the MBX_DIV, LPC_DIV, and NFC_DIV values */
+static struct clk_div_table divtab_1234[] = {
+       { .val = 1, .div = 1, },
+       { .val = 2, .div = 2, },
+       { .val = 3, .div = 3, },
+       { .val = 4, .div = 4, },
+       { .div = 0, },
+};
+
+static int get_freq_from_dt(char *propname)
+{
+       struct device_node *np;
+       const unsigned int *prop;
+       int val;
+
+       val = 0;
+       np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-immr");
+       if (np) {
+               prop = of_get_property(np, propname, NULL);
+               if (prop)
+                       val = *prop;
+           of_node_put(np);
+       }
+       return val;
+}
+
+static void mpc512x_clk_preset_data(void)
+{
+       size_t i;
+
+       for (i = 0; i < ARRAY_SIZE(clks); i++)
+               clks[i] = ERR_PTR(-ENODEV);
+}
+
+/*
+ * - receives the "bus frequency" from the caller (that's the IPS clock
+ *   rate, the historical source of clock information)
+ * - fetches the system PLL multiplier and divider values as well as the
+ *   IPS divider value from hardware
+ * - determines the REF clock rate either from the XTAL/OSC spec (if
+ *   there is a device tree node describing the oscillator) or from the
+ *   IPS bus clock (supported for backwards compatibility, such that
+ *   setups without XTAL/OSC specs keep working)
+ * - creates the "ref" clock item in the clock tree, such that
+ *   subsequent code can create the remainder of the hierarchy (REF ->
+ *   SYS -> CSB -> IPS) from the REF clock rate and the returned mul/div
+ *   values
+ */
+static void mpc512x_clk_setup_ref_clock(struct device_node *np, int bus_freq,
+                                       int *sys_mul, int *sys_div,
+                                       int *ips_div)
+{
+       struct clk *osc_clk;
+       int calc_freq;
+
+       /* fetch mul/div factors from the hardware */
+       *sys_mul = get_spmf_mult();
+       *sys_mul *= 2;          /* compensate for the fractional divider */
+       *sys_div = get_sys_div_x2();
+       *ips_div = get_bit_field(&clkregs->scfr1, 23, 3);
+
+       /* lookup the oscillator clock for its rate */
+       osc_clk = of_clk_get_by_name(np, "osc");
+
+       /*
+        * either descend from OSC to REF (and in bypassing verify the
+        * IPS rate), or backtrack from IPS and multiplier values that
+        * were fetched from hardware to REF and thus to the OSC value
+        *
+        * in either case the REF clock gets created here and the
+        * remainder of the clock tree can get spanned from there
+        */
+       if (!IS_ERR(osc_clk)) {
+               clks[MPC512x_CLK_REF] = mpc512x_clk_factor("ref", "osc", 1, 1);
+               calc_freq = clk_get_rate(clks[MPC512x_CLK_REF]);
+               calc_freq *= *sys_mul;
+               calc_freq /= *sys_div;
+               calc_freq /= 2;
+               calc_freq /= *ips_div;
+               if (bus_freq && calc_freq != bus_freq)
+                       pr_warn("calc rate %d != OF spec %d\n",
+                               calc_freq, bus_freq);
+       } else {
+               calc_freq = bus_freq;   /* start with IPS */
+               calc_freq *= *ips_div;  /* IPS -> CSB */
+               calc_freq *= 2;         /* CSB -> SYS */
+               calc_freq *= *sys_div;  /* SYS -> PLL out */
+               calc_freq /= *sys_mul;  /* PLL out -> REF == OSC */
+               clks[MPC512x_CLK_REF] = mpc512x_clk_fixed("ref", calc_freq);
+       }
+}
+
+/*
+ * helper code for the MCLK subtree setup
+ *
+ * the overview in section 5.2.4 of the MPC5121e Reference Manual rev4
+ * suggests that all instances of the "PSC clock generation" are equal,
+ * and that one might re-use the PSC setup for MSCAN clock generation
+ * (section 5.2.5) as well, at least the logic if not the data for
+ * description
+ *
+ * the details (starting at page 5-20) show differences in the specific
+ * inputs of the first mux stage ("can clk in", "spdif tx"), and the
+ * factual non-availability of the second mux stage (it's present yet
+ * only one input is valid)
+ *
+ * the MSCAN clock related registers (starting at page 5-35) all
+ * reference "spdif clk" at the first mux stage and don't mention any
+ * "can clk" at all, which somehow is unexpected
+ *
+ * TODO re-check the document, and clarify whether the RM is correct in
+ * the overview or in the details, and whether the difference is a
+ * clipboard induced error or results from chip revisions
+ *
+ * it turns out that the RM rev4 as of 2012-06 talks about "can" for the
+ * PSCs while RM rev3 as of 2008-10 talks about "spdif", so I guess that
+ * first a doc update is required which better reflects reality in the
+ * SoC before the implementation should follow while no questions remain
+ */
+
+/*
+ * note that this declaration raises a checkpatch warning, but
+ * it's the very data type which <linux/clk-provider.h> expects,
+ * making this declaration pass checkpatch will break compilation
+ */
+static const char *parent_names_mux0[] = {
+       "sys", "ref", "psc-mclk-in", "spdif-tx",
+};
+
+enum mclk_type {
+       MCLK_TYPE_PSC,
+       MCLK_TYPE_MSCAN,
+       MCLK_TYPE_SPDIF,
+};
+
+struct mclk_setup_data {
+       enum mclk_type type;
+       bool has_mclk1;
+       const char *name_mux0;
+       const char *name_en0;
+       const char *name_div0;
+       const char *parent_names_mux1[2];
+       const char *name_mclk;
+};
+
+#define MCLK_SETUP_DATA_PSC(id) { \
+       MCLK_TYPE_PSC, 0, \
+       "psc" #id "-mux0", \
+       "psc" #id "-en0", \
+       "psc" #id "_mclk_div", \
+       { "psc" #id "_mclk_div", "dummy", }, \
+       "psc" #id "_mclk", \
+}
+
+#define MCLK_SETUP_DATA_MSCAN(id) { \
+       MCLK_TYPE_MSCAN, 0, \
+       "mscan" #id "-mux0", \
+       "mscan" #id "-en0", \
+       "mscan" #id "_mclk_div", \
+       { "mscan" #id "_mclk_div", "dummy", }, \
+       "mscan" #id "_mclk", \
+}
+
+#define MCLK_SETUP_DATA_SPDIF { \
+       MCLK_TYPE_SPDIF, 1, \
+       "spdif-mux0", \
+       "spdif-en0", \
+       "spdif_mclk_div", \
+       { "spdif_mclk_div", "spdif-rx", }, \
+       "spdif_mclk", \
+}
+
+static struct mclk_setup_data mclk_psc_data[] = {
+       MCLK_SETUP_DATA_PSC(0),
+       MCLK_SETUP_DATA_PSC(1),
+       MCLK_SETUP_DATA_PSC(2),
+       MCLK_SETUP_DATA_PSC(3),
+       MCLK_SETUP_DATA_PSC(4),
+       MCLK_SETUP_DATA_PSC(5),
+       MCLK_SETUP_DATA_PSC(6),
+       MCLK_SETUP_DATA_PSC(7),
+       MCLK_SETUP_DATA_PSC(8),
+       MCLK_SETUP_DATA_PSC(9),
+       MCLK_SETUP_DATA_PSC(10),
+       MCLK_SETUP_DATA_PSC(11),
+};
+
+static struct mclk_setup_data mclk_mscan_data[] = {
+       MCLK_SETUP_DATA_MSCAN(0),
+       MCLK_SETUP_DATA_MSCAN(1),
+       MCLK_SETUP_DATA_MSCAN(2),
+       MCLK_SETUP_DATA_MSCAN(3),
+};
+
+static struct mclk_setup_data mclk_spdif_data[] = {
+       MCLK_SETUP_DATA_SPDIF,
+};
+
+/* setup the MCLK clock subtree of an individual PSC/MSCAN/SPDIF */
+static void mpc512x_clk_setup_mclk(struct mclk_setup_data *entry, size_t idx)
+{
+       size_t clks_idx_pub, clks_idx_int;
+       u32 __iomem *mccr_reg;  /* MCLK control register (mux, en, div) */
+       int div;
+
+       /* derive a few parameters from the component type and index */
+       switch (entry->type) {
+       case MCLK_TYPE_PSC:
+               clks_idx_pub = MPC512x_CLK_PSC0_MCLK + idx;
+               clks_idx_int = MPC512x_CLK_MCLKS_FIRST
+                            + (idx) * MCLK_MAX_IDX;
+               mccr_reg = &clkregs->psc_ccr[idx];
+               break;
+       case MCLK_TYPE_MSCAN:
+               clks_idx_pub = MPC512x_CLK_MSCAN0_MCLK + idx;
+               clks_idx_int = MPC512x_CLK_MCLKS_FIRST
+                            + (NR_PSCS + idx) * MCLK_MAX_IDX;
+               mccr_reg = &clkregs->mscan_ccr[idx];
+               break;
+       case MCLK_TYPE_SPDIF:
+               clks_idx_pub = MPC512x_CLK_SPDIF_MCLK;
+               clks_idx_int = MPC512x_CLK_MCLKS_FIRST
+                            + (NR_PSCS + NR_MSCANS) * MCLK_MAX_IDX;
+               mccr_reg = &clkregs->spccr;
+               break;
+       default:
+               return;
+       }
+
+       /*
+        * this was grabbed from the PPC_CLOCK implementation, which
+        * enforced a specific MCLK divider while the clock was gated
+        * during setup (that's a documented hardware requirement)
+        *
+        * the PPC_CLOCK implementation might even have violated the
+        * "MCLK <= IPS" constraint, the fixed divider value of 1
+        * results in a divider of 2 and thus MCLK = SYS/2 which equals
+        * CSB which is greater than IPS; the serial port setup may have
+        * adjusted the divider which the clock setup might have left in
+        * an undesirable state
+        *
+        * initial setup is:
+        * - MCLK 0 from SYS
+        * - MCLK DIV such to not exceed the IPS clock
+        * - MCLK 0 enabled
+        * - MCLK 1 from MCLK DIV
+        */
+       div = clk_get_rate(clks[MPC512x_CLK_SYS]);
+       div /= clk_get_rate(clks[MPC512x_CLK_IPS]);
+       out_be32(mccr_reg, (0 << 16));
+       out_be32(mccr_reg, (0 << 16) | ((div - 1) << 17));
+       out_be32(mccr_reg, (1 << 16) | ((div - 1) << 17));
+
+       /*
+        * create the 'struct clk' items of the MCLK's clock subtree
+        *
+        * note that by design we always create all nodes and won't take
+        * shortcuts here, because
+        * - the "internal" MCLK_DIV and MCLK_OUT signal in turn are
+        *   selectable inputs to the CFM while those who "actually use"
+        *   the PSC/MSCAN/SPDIF (serial drivers et al) need the MCLK
+        *   for their bitrate
+        * - in the absence of "aliases" for clocks we need to create
+        *   individial 'struct clk' items for whatever might get
+        *   referenced or looked up, even if several of those items are
+        *   identical from the logical POV (their rate value)
+        * - for easier future maintenance and for better reflection of
+        *   the SoC's documentation, it appears appropriate to generate
+        *   clock items even for those muxers which actually are NOPs
+        *   (those with two inputs of which one is reserved)
+        */
+       clks[clks_idx_int + MCLK_IDX_MUX0] = mpc512x_clk_muxed(
+                       entry->name_mux0,
+                       &parent_names_mux0[0], ARRAY_SIZE(parent_names_mux0),
+                       mccr_reg, 14, 2);
+       clks[clks_idx_int + MCLK_IDX_EN0] = mpc512x_clk_gated(
+                       entry->name_en0, entry->name_mux0,
+                       mccr_reg, 16);
+       clks[clks_idx_int + MCLK_IDX_DIV0] = mpc512x_clk_divider(
+                       entry->name_div0,
+                       entry->name_en0, CLK_SET_RATE_GATE,
+                       mccr_reg, 17, 15, 0);
+       if (entry->has_mclk1) {
+               clks[clks_idx_pub] = mpc512x_clk_muxed(
+                               entry->name_mclk,
+                               &entry->parent_names_mux1[0],
+                               ARRAY_SIZE(entry->parent_names_mux1),
+                               mccr_reg, 7, 1);
+       } else {
+               clks[clks_idx_pub] = mpc512x_clk_factor(
+                               entry->name_mclk,
+                               entry->parent_names_mux1[0],
+                               1, 1);
+       }
+}
+
+static void mpc512x_clk_setup_clock_tree(struct device_node *np, int busfreq)
+{
+       int sys_mul, sys_div, ips_div;
+       int mul, div;
+       size_t mclk_idx;
+       int freq;
+
+       /*
+        * developer's notes:
+        * - consider whether to handle clocks which have both gates and
+        *   dividers via intermediates or by means of composites
+        * - fractional dividers appear to not map well to composites
+        *   since they can be seen as a fixed multiplier and an
+        *   adjustable divider, while composites can only combine at
+        *   most one of a mux, div, and gate each into one 'struct clk'
+        *   item
+        * - PSC/MSCAN/SPDIF clock generation OTOH already is very
+        *   specific and cannot get mapped to componsites (at least not
+        *   a single one, maybe two of them, but then some of these
+        *   intermediate clock signals get referenced elsewhere (e.g.
+        *   in the clock frequency measurement, CFM) and thus need
+        *   publicly available names
+        * - the current source layout appropriately reflects the
+        *   hardware setup, and it works, so it's questionable whether
+        *   further changes will result in big enough a benefit
+        */
+
+       /* regardless of whether XTAL/OSC exists, have REF created */
+       mpc512x_clk_setup_ref_clock(np, busfreq, &sys_mul, &sys_div, &ips_div);
+
+       /* now setup the REF -> SYS -> CSB -> IPS hierarchy */
+       clks[MPC512x_CLK_SYS] = mpc512x_clk_factor("sys", "ref",
+                                                  sys_mul, sys_div);
+       clks[MPC512x_CLK_CSB] = mpc512x_clk_factor("csb", "sys", 1, 2);
+       clks[MPC512x_CLK_IPS] = mpc512x_clk_divtable("ips", "csb",
+                                                    &clkregs->scfr1, 23, 3,
+                                                    divtab_2346);
+
+       /* now setup anything below SYS and CSB and IPS */
+       clks[MPC512x_CLK_DDR_UG] = mpc512x_clk_factor("ddr-ug", "sys", 1, 2);
+       clks[MPC512x_CLK_SDHC_x4] = mpc512x_clk_factor("sdhc-x4", "csb", 4, 1);
+       clks[MPC512x_CLK_SDHC_UG] = mpc512x_clk_divider("sdhc-ug", "sdhc-x4", 0,
+                                                       &clkregs->scfr2, 0, 8,
+                                                       CLK_DIVIDER_ONE_BASED);
+       clks[MPC512x_CLK_DIU_x4] = mpc512x_clk_factor("diu-x4", "csb", 4, 1);
+       clks[MPC512x_CLK_DIU_UG] = mpc512x_clk_divider("diu-ug", "diu-x4", 0,
+                                                      &clkregs->scfr1, 0, 8,
+                                                      CLK_DIVIDER_ONE_BASED);
+
+       /*
+        * the "power architecture PLL" was setup from data which was
+        * sampled from the reset config word, at this point in time the
+        * configuration can be considered fixed and read only (i.e. no
+        * longer adjustable, or no longer in need of adjustment), which
+        * is why we don't register a PLL here but assume fixed factors
+        */
+       mul = get_cpmf_mult_x2();
+       div = 2;        /* compensate for the fractional factor */
+       clks[MPC512x_CLK_E300] = mpc512x_clk_factor("e300", "csb", mul, div);
+
+       clks[MPC512x_CLK_MBX_BUS_UG] = mpc512x_clk_factor("mbx-bus-ug", "csb",
+                                                         1, 2);
+       clks[MPC512x_CLK_MBX_UG] = mpc512x_clk_divtable("mbx-ug", "mbx-bus-ug",
+                                                       &clkregs->scfr1, 14, 3,
+                                                       divtab_1234);
+       clks[MPC512x_CLK_MBX_3D_UG] = mpc512x_clk_factor("mbx-3d-ug", "mbx-ug",
+                                                        1, 1);
+       clks[MPC512x_CLK_PCI_UG] = mpc512x_clk_divtable("pci-ug", "csb",
+                                                       &clkregs->scfr1, 20, 3,
+                                                       divtab_2346);
+       clks[MPC512x_CLK_NFC_UG] = mpc512x_clk_divtable("nfc-ug", "ips",
+                                                       &clkregs->scfr1, 8, 3,
+                                                       divtab_1234);
+       clks[MPC512x_CLK_LPC_UG] = mpc512x_clk_divtable("lpc-ug", "ips",
+                                                       &clkregs->scfr1, 11, 3,
+                                                       divtab_1234);
+
+       clks[MPC512x_CLK_LPC] = mpc512x_clk_gated("lpc", "lpc-ug",
+                                                 &clkregs->sccr1, 30);
+       clks[MPC512x_CLK_NFC] = mpc512x_clk_gated("nfc", "nfc-ug",
+                                                 &clkregs->sccr1, 29);
+       clks[MPC512x_CLK_PATA] = mpc512x_clk_gated("pata", "ips",
+                                                  &clkregs->sccr1, 28);
+       /* for PSCs there is a "registers" gate and a bitrate MCLK subtree */
+       for (mclk_idx = 0; mclk_idx < ARRAY_SIZE(mclk_psc_data); mclk_idx++) {
+               char name[12];
+               snprintf(name, sizeof(name), "psc%d", mclk_idx);
+               clks[MPC512x_CLK_PSC0 + mclk_idx] = mpc512x_clk_gated(
+                               name, "ips", &clkregs->sccr1, 27 - mclk_idx);
+               mpc512x_clk_setup_mclk(&mclk_psc_data[mclk_idx], mclk_idx);
+       }
+       clks[MPC512x_CLK_PSC_FIFO] = mpc512x_clk_gated("psc-fifo", "ips",
+                                                      &clkregs->sccr1, 15);
+       clks[MPC512x_CLK_SATA] = mpc512x_clk_gated("sata", "ips",
+                                                  &clkregs->sccr1, 14);
+       clks[MPC512x_CLK_FEC] = mpc512x_clk_gated("fec", "ips",
+                                                 &clkregs->sccr1, 13);
+       clks[MPC512x_CLK_PCI] = mpc512x_clk_gated("pci", "pci-ug",
+                                                 &clkregs->sccr1, 11);
+       clks[MPC512x_CLK_DDR] = mpc512x_clk_gated("ddr", "ddr-ug",
+                                                 &clkregs->sccr1, 10);
+
+       clks[MPC512x_CLK_DIU] = mpc512x_clk_gated("diu", "diu-ug",
+                                                 &clkregs->sccr2, 31);
+       clks[MPC512x_CLK_AXE] = mpc512x_clk_gated("axe", "csb",
+                                                 &clkregs->sccr2, 30);
+       clks[MPC512x_CLK_MEM] = mpc512x_clk_gated("mem", "ips",
+                                                 &clkregs->sccr2, 29);
+       clks[MPC512x_CLK_USB1] = mpc512x_clk_gated("usb1", "csb",
+                                                  &clkregs->sccr2, 28);
+       clks[MPC512x_CLK_USB2] = mpc512x_clk_gated("usb2", "csb",
+                                                  &clkregs->sccr2, 27);
+       clks[MPC512x_CLK_I2C] = mpc512x_clk_gated("i2c", "ips",
+                                                 &clkregs->sccr2, 26);
+       /* MSCAN differs from PSC with just one gate for multiple components */
+       clks[MPC512x_CLK_BDLC] = mpc512x_clk_gated("bdlc", "ips",
+                                                  &clkregs->sccr2, 25);
+       for (mclk_idx = 0; mclk_idx < ARRAY_SIZE(mclk_mscan_data); mclk_idx++)
+               mpc512x_clk_setup_mclk(&mclk_mscan_data[mclk_idx], mclk_idx);
+       clks[MPC512x_CLK_SDHC] = mpc512x_clk_gated("sdhc", "sdhc-ug",
+                                                  &clkregs->sccr2, 24);
+       /* there is only one SPDIF component, which shares MCLK support code */
+       clks[MPC512x_CLK_SPDIF] = mpc512x_clk_gated("spdif", "ips",
+                                                   &clkregs->sccr2, 23);
+       mpc512x_clk_setup_mclk(&mclk_spdif_data[0], 0);
+       clks[MPC512x_CLK_MBX_BUS] = mpc512x_clk_gated("mbx-bus", "mbx-bus-ug",
+                                                     &clkregs->sccr2, 22);
+       clks[MPC512x_CLK_MBX] = mpc512x_clk_gated("mbx", "mbx-ug",
+                                                 &clkregs->sccr2, 21);
+       clks[MPC512x_CLK_MBX_3D] = mpc512x_clk_gated("mbx-3d", "mbx-3d-ug",
+                                                    &clkregs->sccr2, 20);
+       clks[MPC512x_CLK_IIM] = mpc512x_clk_gated("iim", "csb",
+                                                 &clkregs->sccr2, 19);
+       clks[MPC512x_CLK_VIU] = mpc512x_clk_gated("viu", "csb",
+                                                 &clkregs->sccr2, 18);
+       clks[MPC512x_CLK_SDHC_2] = mpc512x_clk_gated("sdhc-2", "sdhc-ug",
+                                                    &clkregs->sccr2, 17);
+
+       /*
+        * externally provided clocks (when implemented in hardware,
+        * device tree may specify values which otherwise were unknown)
+        */
+       freq = get_freq_from_dt("psc_mclk_in");
+       if (!freq)
+               freq = 25000000;
+       clks[MPC512x_CLK_PSC_MCLK_IN] = mpc512x_clk_fixed("psc_mclk_in", freq);
+       freq = get_freq_from_dt("spdif_tx_in");
+       clks[MPC512x_CLK_SPDIF_TX_IN] = mpc512x_clk_fixed("spdif_tx_in", freq);
+       freq = get_freq_from_dt("spdif_rx_in");
+       clks[MPC512x_CLK_SPDIF_TX_IN] = mpc512x_clk_fixed("spdif_rx_in", freq);
+
+       /* fixed frequency for AC97, always 24.567MHz */
+       clks[MPC512x_CLK_AC97] = mpc512x_clk_fixed("ac97", 24567000);
+
+       /*
+        * pre-enable those "internal" clock items which never get
+        * claimed by any peripheral driver, to not have the clock
+        * subsystem disable them late at startup
+        */
+       clk_prepare_enable(clks[MPC512x_CLK_DUMMY]);
+       clk_prepare_enable(clks[MPC512x_CLK_E300]);     /* PowerPC CPU */
+       clk_prepare_enable(clks[MPC512x_CLK_DDR]);      /* DRAM */
+       clk_prepare_enable(clks[MPC512x_CLK_MEM]);      /* SRAM */
+       clk_prepare_enable(clks[MPC512x_CLK_IPS]);      /* SoC periph */
+       clk_prepare_enable(clks[MPC512x_CLK_LPC]);      /* boot media */
+}
+
+/*
+ * registers the set of public clocks (those listed in the dt-bindings/
+ * header file) for OF lookups, keeps the intermediates private to us
+ */
+static void mpc5121_clk_register_of_provider(struct device_node *np)
+{
+       clk_data.clks = clks;
+       clk_data.clk_num = MPC512x_CLK_LAST_PUBLIC + 1; /* _not_ ARRAY_SIZE() */
+       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+}
+
+/*
+ * temporary support for the period of time between introduction of CCF
+ * support and the adjustment of peripheral drivers to OF based lookups
+ */
+static void mpc5121_clk_provide_migration_support(void)
+{
+
+       /*
+        * pre-enable those clock items which are not yet appropriately
+        * acquired by their peripheral driver
+        *
+        * the PCI clock cannot get acquired by its peripheral driver,
+        * because for this platform the driver won't probe(), instead
+        * initialization is done from within the .setup_arch() routine
+        * at a point in time where the clock provider has not been
+        * setup yet and thus isn't available yet
+        *
+        * so we "pre-enable" the clock here, to not have the clock
+        * subsystem automatically disable this item in a late init call
+        *
+        * this PCI clock pre-enable workaround only applies when there
+        * are device tree nodes for PCI and thus the peripheral driver
+        * has attached to bridges, otherwise the PCI clock remains
+        * unused and so it gets disabled
+        */
+       clk_prepare_enable(clks[MPC512x_CLK_PSC3_MCLK]);/* serial console */
+       if (of_find_compatible_node(NULL, "pci", "fsl,mpc5121-pci"))
+               clk_prepare_enable(clks[MPC512x_CLK_PCI]);
+}
+
+/*
+ * those macros are not exactly pretty, but they encapsulate a lot
+ * of copy'n'paste heavy code which is even more ugly, and reduce
+ * the potential for inconsistencies in those many code copies
+ */
+#define FOR_NODES(compatname) \
+       for_each_compatible_node(np, NULL, compatname)
+
+#define NODE_PREP do { \
+       of_address_to_resource(np, 0, &res); \
+       snprintf(devname, sizeof(devname), "%08x.%s", res.start, np->name); \
+} while (0)
+
+#define NODE_CHK(clkname, clkitem, regnode, regflag) do { \
+       struct clk *clk; \
+       clk = of_clk_get_by_name(np, clkname); \
+       if (IS_ERR(clk)) { \
+               clk = clkitem; \
+               clk_register_clkdev(clk, clkname, devname); \
+               if (regnode) \
+                       clk_register_clkdev(clk, clkname, np->name); \
+               did_register |= DID_REG_ ## regflag; \
+               pr_debug("clock alias name '%s' for dev '%s' pointer %p\n", \
+                        clkname, devname, clk); \
+       } else { \
+               clk_put(clk); \
+       } \
+} while (0)
+
+/*
+ * register source code provided fallback results for clock lookups,
+ * these get consulted when OF based clock lookup fails (that is in the
+ * case of not yet adjusted device tree data, where clock related specs
+ * are missing)
+ */
+static void mpc5121_clk_provide_backwards_compat(void)
+{
+       enum did_reg_flags {
+               DID_REG_PSC     = BIT(0),
+               DID_REG_PSCFIFO = BIT(1),
+               DID_REG_NFC     = BIT(2),
+               DID_REG_CAN     = BIT(3),
+               DID_REG_I2C     = BIT(4),
+               DID_REG_DIU     = BIT(5),
+               DID_REG_VIU     = BIT(6),
+               DID_REG_FEC     = BIT(7),
+               DID_REG_USB     = BIT(8),
+               DID_REG_PATA    = BIT(9),
+       };
+
+       int did_register;
+       struct device_node *np;
+       struct resource res;
+       int idx;
+       char devname[32];
+
+       did_register = 0;
+
+       FOR_NODES(mpc512x_select_psc_compat()) {
+               NODE_PREP;
+               idx = (res.start >> 8) & 0xf;
+               NODE_CHK("ipg", clks[MPC512x_CLK_PSC0 + idx], 0, PSC);
+               NODE_CHK("mclk", clks[MPC512x_CLK_PSC0_MCLK + idx], 0, PSC);
+       }
+
+       FOR_NODES("fsl,mpc5121-psc-fifo") {
+               NODE_PREP;
+               NODE_CHK("ipg", clks[MPC512x_CLK_PSC_FIFO], 1, PSCFIFO);
+       }
+
+       FOR_NODES("fsl,mpc5121-nfc") {
+               NODE_PREP;
+               NODE_CHK("ipg", clks[MPC512x_CLK_NFC], 0, NFC);
+       }
+
+       FOR_NODES("fsl,mpc5121-mscan") {
+               NODE_PREP;
+               idx = 0;
+               idx += (res.start & 0x2000) ? 2 : 0;
+               idx += (res.start & 0x0080) ? 1 : 0;
+               NODE_CHK("ipg", clks[MPC512x_CLK_BDLC], 0, CAN);
+               NODE_CHK("mclk", clks[MPC512x_CLK_MSCAN0_MCLK + idx], 0, CAN);
+       }
+
+       /*
+        * do register the 'ips', 'sys', and 'ref' names globally
+        * instead of inside each individual CAN node, as there is no
+        * potential for a name conflict (in contrast to 'ipg' and 'mclk')
+        */
+       if (did_register & DID_REG_CAN) {
+               clk_register_clkdev(clks[MPC512x_CLK_IPS], "ips", NULL);
+               clk_register_clkdev(clks[MPC512x_CLK_SYS], "sys", NULL);
+               clk_register_clkdev(clks[MPC512x_CLK_REF], "ref", NULL);
+       }
+
+       FOR_NODES("fsl,mpc5121-i2c") {
+               NODE_PREP;
+               NODE_CHK("ipg", clks[MPC512x_CLK_I2C], 0, I2C);
+       }
+
+       /*
+        * workaround for the fact that the I2C driver does an "anonymous"
+        * lookup (NULL name spec, which yields the first clock spec) for
+        * which we cannot register an alias -- a _global_ 'ipg' alias that
+        * is not bound to any device name and returns the I2C clock item
+        * is not a good idea
+        *
+        * so we have the lookup in the peripheral driver fail, which is
+        * silent and non-fatal, and pre-enable the clock item here such
+        * that register access is possible
+        *
+        * see commit b3bfce2b "i2c: mpc: cleanup clock API use" for
+        * details, adjusting s/NULL/"ipg"/ in i2c-mpc.c would make this
+        * workaround obsolete
+        */
+       if (did_register & DID_REG_I2C)
+               clk_prepare_enable(clks[MPC512x_CLK_I2C]);
+
+       FOR_NODES("fsl,mpc5121-diu") {
+               NODE_PREP;
+               NODE_CHK("ipg", clks[MPC512x_CLK_DIU], 1, DIU);
+       }
+
+       FOR_NODES("fsl,mpc5121-viu") {
+               NODE_PREP;
+               NODE_CHK("ipg", clks[MPC512x_CLK_VIU], 0, VIU);
+       }
+
+       /*
+        * note that 2771399a "fs_enet: cleanup clock API use" did use the
+        * "per" string for the clock lookup in contrast to the "ipg" name
+        * which most other nodes are using -- this is not a fatal thing
+        * but just something to keep in mind when doing compatibility
+        * registration, it's a non-issue with up-to-date device tree data
+        */
+       FOR_NODES("fsl,mpc5121-fec") {
+               NODE_PREP;
+               NODE_CHK("per", clks[MPC512x_CLK_FEC], 0, FEC);
+       }
+       FOR_NODES("fsl,mpc5121-fec-mdio") {
+               NODE_PREP;
+               NODE_CHK("per", clks[MPC512x_CLK_FEC], 0, FEC);
+       }
+
+       FOR_NODES("fsl,mpc5121-usb2-dr") {
+               NODE_PREP;
+               idx = (res.start & 0x4000) ? 1 : 0;
+               NODE_CHK("ipg", clks[MPC512x_CLK_USB1 + idx], 0, USB);
+       }
+
+       FOR_NODES("fsl,mpc5121-pata") {
+               NODE_PREP;
+               NODE_CHK("ipg", clks[MPC512x_CLK_PATA], 0, PATA);
+       }
+
+       /*
+        * try to collapse diagnostics into a single line of output yet
+        * provide a full list of what is missing, to avoid noise in the
+        * absence of up-to-date device tree data -- backwards
+        * compatibility to old DTBs is a requirement, updates may be
+        * desirable or preferrable but are not at all mandatory
+        */
+       if (did_register) {
+               pr_notice("device tree lacks clock specs, adding fallbacks (0x%x,%s%s%s%s%s%s%s%s%s%s)\n",
+                         did_register,
+                         (did_register & DID_REG_PSC) ? " PSC" : "",
+                         (did_register & DID_REG_PSCFIFO) ? " PSCFIFO" : "",
+                         (did_register & DID_REG_NFC) ? " NFC" : "",
+                         (did_register & DID_REG_CAN) ? " CAN" : "",
+                         (did_register & DID_REG_I2C) ? " I2C" : "",
+                         (did_register & DID_REG_DIU) ? " DIU" : "",
+                         (did_register & DID_REG_VIU) ? " VIU" : "",
+                         (did_register & DID_REG_FEC) ? " FEC" : "",
+                         (did_register & DID_REG_USB) ? " USB" : "",
+                         (did_register & DID_REG_PATA) ? " PATA" : "");
+       } else {
+               pr_debug("device tree has clock specs, no fallbacks added\n");
+       }
+}
+
+int __init mpc5121_clk_init(void)
+{
+       struct device_node *clk_np;
+       int busfreq;
+
+       /* map the clock control registers */
+       clk_np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-clock");
+       if (!clk_np)
+               return -ENODEV;
+       clkregs = of_iomap(clk_np, 0);
+       WARN_ON(!clkregs);
+
+       /* invalidate all not yet registered clock slots */
+       mpc512x_clk_preset_data();
+
+       /*
+        * have the device tree scanned for "fixed-clock" nodes (which
+        * includes the oscillator node if the board's DT provides one)
+        */
+       of_clk_init(NULL);
+
+       /*
+        * add a dummy clock for those situations where a clock spec is
+        * required yet no real clock is involved
+        */
+       clks[MPC512x_CLK_DUMMY] = mpc512x_clk_fixed("dummy", 0);
+
+       /*
+        * have all the real nodes in the clock tree populated from REF
+        * down to all leaves, either starting from the OSC node or from
+        * a REF root that was created from the IPS bus clock input
+        */
+       busfreq = get_freq_from_dt("bus-frequency");
+       mpc512x_clk_setup_clock_tree(clk_np, busfreq);
+
+       /* register as an OF clock provider */
+       mpc5121_clk_register_of_provider(clk_np);
+
+       /*
+        * unbreak not yet adjusted peripheral drivers during migration
+        * towards fully operational common clock support, and allow
+        * operation in the absence of clock related device tree specs
+        */
+       mpc5121_clk_provide_migration_support();
+       mpc5121_clk_provide_backwards_compat();
+
+       return 0;
+}
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
deleted file mode 100644 (file)
index fd8a376..0000000
+++ /dev/null
@@ -1,754 +0,0 @@
-/*
- * Copyright (C) 2007,2008 Freescale Semiconductor, Inc. All rights reserved.
- *
- * Author: John Rigby <jrigby@freescale.com>
- *
- * Implements the clk api defined in include/linux/clk.h
- *
- *    Original based on linux/arch/arm/mach-integrator/clock.c
- *
- *    Copyright (C) 2004 ARM Limited.
- *    Written by Deep Blue Solutions Limited.
- *
- * 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/list.h>
-#include <linux/errno.h>
-#include <linux/err.h>
-#include <linux/module.h>
-#include <linux/string.h>
-#include <linux/clk.h>
-#include <linux/mutex.h>
-#include <linux/io.h>
-
-#include <linux/of_address.h>
-#include <linux/of_platform.h>
-#include <asm/mpc5xxx.h>
-#include <asm/mpc5121.h>
-#include <asm/clk_interface.h>
-
-#include "mpc512x.h"
-
-#undef CLK_DEBUG
-
-static int clocks_initialized;
-
-#define CLK_HAS_RATE   0x1     /* has rate in MHz */
-#define CLK_HAS_CTRL   0x2     /* has control reg and bit */
-
-struct clk {
-       struct list_head node;
-       char name[32];
-       int flags;
-       struct device *dev;
-       unsigned long rate;
-       struct module *owner;
-       void (*calc) (struct clk *);
-       struct clk *parent;
-       int reg, bit;           /* CLK_HAS_CTRL */
-       int div_shift;          /* only used by generic_div_clk_calc */
-};
-
-static LIST_HEAD(clocks);
-static DEFINE_MUTEX(clocks_mutex);
-
-static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
-{
-       struct clk *p, *clk = ERR_PTR(-ENOENT);
-       int dev_match;
-       int id_match;
-
-       if (dev == NULL || id == NULL)
-               return clk;
-
-       mutex_lock(&clocks_mutex);
-       list_for_each_entry(p, &clocks, node) {
-               dev_match = id_match = 0;
-
-               if (dev == p->dev)
-                       dev_match++;
-               if (strcmp(id, p->name) == 0)
-                       id_match++;
-               if ((dev_match || id_match) && try_module_get(p->owner)) {
-                       clk = p;
-                       break;
-               }
-       }
-       mutex_unlock(&clocks_mutex);
-
-       return clk;
-}
-
-#ifdef CLK_DEBUG
-static void dump_clocks(void)
-{
-       struct clk *p;
-
-       mutex_lock(&clocks_mutex);
-       printk(KERN_INFO "CLOCKS:\n");
-       list_for_each_entry(p, &clocks, node) {
-               pr_info("  %s=%ld", p->name, p->rate);
-               if (p->parent)
-                       pr_cont(" %s=%ld", p->parent->name,
-                              p->parent->rate);
-               if (p->flags & CLK_HAS_CTRL)
-                       pr_cont(" reg/bit=%d/%d", p->reg, p->bit);
-               pr_cont("\n");
-       }
-       mutex_unlock(&clocks_mutex);
-}
-#define        DEBUG_CLK_DUMP() dump_clocks()
-#else
-#define        DEBUG_CLK_DUMP()
-#endif
-
-
-static void mpc5121_clk_put(struct clk *clk)
-{
-       module_put(clk->owner);
-}
-
-#define NRPSC 12
-
-struct mpc512x_clockctl {
-       u32 spmr;               /* System PLL Mode Reg */
-       u32 sccr[2];            /* System Clk Ctrl Reg 1 & 2 */
-       u32 scfr1;              /* System Clk Freq Reg 1 */
-       u32 scfr2;              /* System Clk Freq Reg 2 */
-       u32 reserved;
-       u32 bcr;                /* Bread Crumb Reg */
-       u32 pccr[NRPSC];        /* PSC Clk Ctrl Reg 0-11 */
-       u32 spccr;              /* SPDIF Clk Ctrl Reg */
-       u32 cccr;               /* CFM Clk Ctrl Reg */
-       u32 dccr;               /* DIU Clk Cnfg Reg */
-};
-
-static struct mpc512x_clockctl __iomem *clockctl;
-
-static int mpc5121_clk_enable(struct clk *clk)
-{
-       unsigned int mask;
-
-       if (clk->flags & CLK_HAS_CTRL) {
-               mask = in_be32(&clockctl->sccr[clk->reg]);
-               mask |= 1 << clk->bit;
-               out_be32(&clockctl->sccr[clk->reg], mask);
-       }
-       return 0;
-}
-
-static void mpc5121_clk_disable(struct clk *clk)
-{
-       unsigned int mask;
-
-       if (clk->flags & CLK_HAS_CTRL) {
-               mask = in_be32(&clockctl->sccr[clk->reg]);
-               mask &= ~(1 << clk->bit);
-               out_be32(&clockctl->sccr[clk->reg], mask);
-       }
-}
-
-static unsigned long mpc5121_clk_get_rate(struct clk *clk)
-{
-       if (clk->flags & CLK_HAS_RATE)
-               return clk->rate;
-       else
-               return 0;
-}
-
-static long mpc5121_clk_round_rate(struct clk *clk, unsigned long rate)
-{
-       return rate;
-}
-
-static int mpc5121_clk_set_rate(struct clk *clk, unsigned long rate)
-{
-       return 0;
-}
-
-static int clk_register(struct clk *clk)
-{
-       mutex_lock(&clocks_mutex);
-       list_add(&clk->node, &clocks);
-       mutex_unlock(&clocks_mutex);
-       return 0;
-}
-
-static unsigned long spmf_mult(void)
-{
-       /*
-        * Convert spmf to multiplier
-        */
-       static int spmf_to_mult[] = {
-               68, 1, 12, 16,
-               20, 24, 28, 32,
-               36, 40, 44, 48,
-               52, 56, 60, 64
-       };
-       int spmf = (in_be32(&clockctl->spmr) >> 24) & 0xf;
-       return spmf_to_mult[spmf];
-}
-
-static unsigned long sysdiv_div_x_2(void)
-{
-       /*
-        * Convert sysdiv to divisor x 2
-        * Some divisors have fractional parts so
-        * multiply by 2 then divide by this value
-        */
-       static int sysdiv_to_div_x_2[] = {
-               4, 5, 6, 7,
-               8, 9, 10, 14,
-               12, 16, 18, 22,
-               20, 24, 26, 30,
-               28, 32, 34, 38,
-               36, 40, 42, 46,
-               44, 48, 50, 54,
-               52, 56, 58, 62,
-               60, 64, 66,
-       };
-       int sysdiv = (in_be32(&clockctl->scfr2) >> 26) & 0x3f;
-       return sysdiv_to_div_x_2[sysdiv];
-}
-
-static unsigned long ref_to_sys(unsigned long rate)
-{
-       rate *= spmf_mult();
-       rate *= 2;
-       rate /= sysdiv_div_x_2();
-
-       return rate;
-}
-
-static unsigned long sys_to_ref(unsigned long rate)
-{
-       rate *= sysdiv_div_x_2();
-       rate /= 2;
-       rate /= spmf_mult();
-
-       return rate;
-}
-
-static long ips_to_ref(unsigned long rate)
-{
-       int ips_div = (in_be32(&clockctl->scfr1) >> 23) & 0x7;
-
-       rate *= ips_div;        /* csb_clk = ips_clk * ips_div */
-       rate *= 2;              /* sys_clk = csb_clk * 2 */
-       return sys_to_ref(rate);
-}
-
-static unsigned long devtree_getfreq(char *clockname)
-{
-       struct device_node *np;
-       const unsigned int *prop;
-       unsigned int val = 0;
-
-       np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-immr");
-       if (np) {
-               prop = of_get_property(np, clockname, NULL);
-               if (prop)
-                       val = *prop;
-           of_node_put(np);
-       }
-       return val;
-}
-
-static void ref_clk_calc(struct clk *clk)
-{
-       unsigned long rate;
-
-       rate = devtree_getfreq("bus-frequency");
-       if (rate == 0) {
-               printk(KERN_ERR "No bus-frequency in dev tree\n");
-               clk->rate = 0;
-               return;
-       }
-       clk->rate = ips_to_ref(rate);
-}
-
-static struct clk ref_clk = {
-       .name = "ref_clk",
-       .calc = ref_clk_calc,
-};
-
-
-static void sys_clk_calc(struct clk *clk)
-{
-       clk->rate = ref_to_sys(ref_clk.rate);
-}
-
-static struct clk sys_clk = {
-       .name = "sys_clk",
-       .calc = sys_clk_calc,
-};
-
-static void diu_clk_calc(struct clk *clk)
-{
-       int diudiv_x_2 = in_be32(&clockctl->scfr1) & 0xff;
-       unsigned long rate;
-
-       rate = sys_clk.rate;
-
-       rate *= 2;
-       rate /= diudiv_x_2;
-
-       clk->rate = rate;
-}
-
-static void viu_clk_calc(struct clk *clk)
-{
-       unsigned long rate;
-
-       rate = sys_clk.rate;
-       rate /= 2;
-       clk->rate = rate;
-}
-
-static void half_clk_calc(struct clk *clk)
-{
-       clk->rate = clk->parent->rate / 2;
-}
-
-static void generic_div_clk_calc(struct clk *clk)
-{
-       int div = (in_be32(&clockctl->scfr1) >> clk->div_shift) & 0x7;
-
-       clk->rate = clk->parent->rate / div;
-}
-
-static void unity_clk_calc(struct clk *clk)
-{
-       clk->rate = clk->parent->rate;
-}
-
-static struct clk csb_clk = {
-       .name = "csb_clk",
-       .calc = half_clk_calc,
-       .parent = &sys_clk,
-};
-
-static void e300_clk_calc(struct clk *clk)
-{
-       int spmf = (in_be32(&clockctl->spmr) >> 16) & 0xf;
-       int ratex2 = clk->parent->rate * spmf;
-
-       clk->rate = ratex2 / 2;
-}
-
-static struct clk e300_clk = {
-       .name = "e300_clk",
-       .calc = e300_clk_calc,
-       .parent = &csb_clk,
-};
-
-static struct clk ips_clk = {
-       .name = "ips_clk",
-       .calc = generic_div_clk_calc,
-       .parent = &csb_clk,
-       .div_shift = 23,
-};
-
-/*
- * Clocks controlled by SCCR1 (.reg = 0)
- */
-static struct clk lpc_clk = {
-       .name = "lpc_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 0,
-       .bit = 30,
-       .calc = generic_div_clk_calc,
-       .parent = &ips_clk,
-       .div_shift = 11,
-};
-
-static struct clk nfc_clk = {
-       .name = "nfc_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 0,
-       .bit = 29,
-       .calc = generic_div_clk_calc,
-       .parent = &ips_clk,
-       .div_shift = 8,
-};
-
-static struct clk pata_clk = {
-       .name = "pata_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 0,
-       .bit = 28,
-       .calc = unity_clk_calc,
-       .parent = &ips_clk,
-};
-
-/*
- * PSC clocks (bits 27 - 16)
- * are setup elsewhere
- */
-
-static struct clk sata_clk = {
-       .name = "sata_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 0,
-       .bit = 14,
-       .calc = unity_clk_calc,
-       .parent = &ips_clk,
-};
-
-static struct clk fec_clk = {
-       .name = "fec_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 0,
-       .bit = 13,
-       .calc = unity_clk_calc,
-       .parent = &ips_clk,
-};
-
-static struct clk pci_clk = {
-       .name = "pci_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 0,
-       .bit = 11,
-       .calc = generic_div_clk_calc,
-       .parent = &csb_clk,
-       .div_shift = 20,
-};
-
-/*
- * Clocks controlled by SCCR2 (.reg = 1)
- */
-static struct clk diu_clk = {
-       .name = "diu_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 31,
-       .calc = diu_clk_calc,
-};
-
-static struct clk viu_clk = {
-       .name = "viu_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 18,
-       .calc = viu_clk_calc,
-};
-
-static struct clk axe_clk = {
-       .name = "axe_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 30,
-       .calc = unity_clk_calc,
-       .parent = &csb_clk,
-};
-
-static struct clk usb1_clk = {
-       .name = "usb1_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 28,
-       .calc = unity_clk_calc,
-       .parent = &csb_clk,
-};
-
-static struct clk usb2_clk = {
-       .name = "usb2_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 27,
-       .calc = unity_clk_calc,
-       .parent = &csb_clk,
-};
-
-static struct clk i2c_clk = {
-       .name = "i2c_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 26,
-       .calc = unity_clk_calc,
-       .parent = &ips_clk,
-};
-
-static struct clk mscan_clk = {
-       .name = "mscan_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 25,
-       .calc = unity_clk_calc,
-       .parent = &ips_clk,
-};
-
-static struct clk sdhc_clk = {
-       .name = "sdhc_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 24,
-       .calc = unity_clk_calc,
-       .parent = &ips_clk,
-};
-
-static struct clk mbx_bus_clk = {
-       .name = "mbx_bus_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 22,
-       .calc = half_clk_calc,
-       .parent = &csb_clk,
-};
-
-static struct clk mbx_clk = {
-       .name = "mbx_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 21,
-       .calc = unity_clk_calc,
-       .parent = &csb_clk,
-};
-
-static struct clk mbx_3d_clk = {
-       .name = "mbx_3d_clk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 20,
-       .calc = generic_div_clk_calc,
-       .parent = &mbx_bus_clk,
-       .div_shift = 14,
-};
-
-static void psc_mclk_in_calc(struct clk *clk)
-{
-       clk->rate = devtree_getfreq("psc_mclk_in");
-       if (!clk->rate)
-               clk->rate = 25000000;
-}
-
-static struct clk psc_mclk_in = {
-       .name = "psc_mclk_in",
-       .calc = psc_mclk_in_calc,
-};
-
-static struct clk spdif_txclk = {
-       .name = "spdif_txclk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 23,
-};
-
-static struct clk spdif_rxclk = {
-       .name = "spdif_rxclk",
-       .flags = CLK_HAS_CTRL,
-       .reg = 1,
-       .bit = 23,
-};
-
-static void ac97_clk_calc(struct clk *clk)
-{
-       /* ac97 bit clock is always 24.567 MHz */
-       clk->rate = 24567000;
-}
-
-static struct clk ac97_clk = {
-       .name = "ac97_clk_in",
-       .calc = ac97_clk_calc,
-};
-
-static struct clk *rate_clks[] = {
-       &ref_clk,
-       &sys_clk,
-       &diu_clk,
-       &viu_clk,
-       &csb_clk,
-       &e300_clk,
-       &ips_clk,
-       &fec_clk,
-       &sata_clk,
-       &pata_clk,
-       &nfc_clk,
-       &lpc_clk,
-       &mbx_bus_clk,
-       &mbx_clk,
-       &mbx_3d_clk,
-       &axe_clk,
-       &usb1_clk,
-       &usb2_clk,
-       &i2c_clk,
-       &mscan_clk,
-       &sdhc_clk,
-       &pci_clk,
-       &psc_mclk_in,
-       &spdif_txclk,
-       &spdif_rxclk,
-       &ac97_clk,
-       NULL
-};
-
-static void rate_clk_init(struct clk *clk)
-{
-       if (clk->calc) {
-               clk->calc(clk);
-               clk->flags |= CLK_HAS_RATE;
-               clk_register(clk);
-       } else {
-               printk(KERN_WARNING
-                      "Could not initialize clk %s without a calc routine\n",
-                      clk->name);
-       }
-}
-
-static void rate_clks_init(void)
-{
-       struct clk **cpp, *clk;
-
-       cpp = rate_clks;
-       while ((clk = *cpp++))
-               rate_clk_init(clk);
-}
-
-/*
- * There are two clk enable registers with 32 enable bits each
- * psc clocks and device clocks are all stored in dev_clks
- */
-static struct clk dev_clks[2][32];
-
-/*
- * Given a psc number return the dev_clk
- * associated with it
- */
-static struct clk *psc_dev_clk(int pscnum)
-{
-       int reg, bit;
-       struct clk *clk;
-
-       reg = 0;
-       bit = 27 - pscnum;
-
-       clk = &dev_clks[reg][bit];
-       clk->reg = 0;
-       clk->bit = bit;
-       return clk;
-}
-
-/*
- * PSC clock rate calculation
- */
-static void psc_calc_rate(struct clk *clk, int pscnum, struct device_node *np)
-{
-       unsigned long mclk_src = sys_clk.rate;
-       unsigned long mclk_div;
-
-       /*
-        * Can only change value of mclk divider
-        * when the divider is disabled.
-        *
-        * Zero is not a valid divider so minimum
-        * divider is 1
-        *
-        * disable/set divider/enable
-        */
-       out_be32(&clockctl->pccr[pscnum], 0);
-       out_be32(&clockctl->pccr[pscnum], 0x00020000);
-       out_be32(&clockctl->pccr[pscnum], 0x00030000);
-
-       if (in_be32(&clockctl->pccr[pscnum]) & 0x80) {
-               clk->rate = spdif_rxclk.rate;
-               return;
-       }
-
-       switch ((in_be32(&clockctl->pccr[pscnum]) >> 14) & 0x3) {
-       case 0:
-               mclk_src = sys_clk.rate;
-               break;
-       case 1:
-               mclk_src = ref_clk.rate;
-               break;
-       case 2:
-               mclk_src = psc_mclk_in.rate;
-               break;
-       case 3:
-               mclk_src = spdif_txclk.rate;
-               break;
-       }
-
-       mclk_div = ((in_be32(&clockctl->pccr[pscnum]) >> 17) & 0x7fff) + 1;
-       clk->rate = mclk_src / mclk_div;
-}
-
-/*
- * Find all psc nodes in device tree and assign a clock
- * with name "psc%d_mclk" and dev pointing at the device
- * returned from of_find_device_by_node
- */
-static void psc_clks_init(void)
-{
-       struct device_node *np;
-       struct platform_device *ofdev;
-       u32 reg;
-       const char *psc_compat;
-
-       psc_compat = mpc512x_select_psc_compat();
-       if (!psc_compat)
-               return;
-
-       for_each_compatible_node(np, NULL, psc_compat) {
-               if (!of_property_read_u32(np, "reg", &reg)) {
-                       int pscnum = (reg & 0xf00) >> 8;
-                       struct clk *clk = psc_dev_clk(pscnum);
-
-                       clk->flags = CLK_HAS_RATE | CLK_HAS_CTRL;
-                       ofdev = of_find_device_by_node(np);
-                       clk->dev = &ofdev->dev;
-                       /*
-                        * AC97 is special rate clock does
-                        * not go through normal path
-                        */
-                       if (of_device_is_compatible(np, "fsl,mpc5121-psc-ac97"))
-                               clk->rate = ac97_clk.rate;
-                       else
-                               psc_calc_rate(clk, pscnum, np);
-                       sprintf(clk->name, "psc%d_mclk", pscnum);
-                       clk_register(clk);
-                       clk_enable(clk);
-               }
-       }
-}
-
-static struct clk_interface mpc5121_clk_functions = {
-       .clk_get                = mpc5121_clk_get,
-       .clk_enable             = mpc5121_clk_enable,
-       .clk_disable            = mpc5121_clk_disable,
-       .clk_get_rate           = mpc5121_clk_get_rate,
-       .clk_put                = mpc5121_clk_put,
-       .clk_round_rate         = mpc5121_clk_round_rate,
-       .clk_set_rate           = mpc5121_clk_set_rate,
-       .clk_set_parent         = NULL,
-       .clk_get_parent         = NULL,
-};
-
-int __init mpc5121_clk_init(void)
-{
-       struct device_node *np;
-
-       np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-clock");
-       if (np) {
-               clockctl = of_iomap(np, 0);
-               of_node_put(np);
-       }
-
-       if (!clockctl) {
-               printk(KERN_ERR "Could not map clock control registers\n");
-               return 0;
-       }
-
-       rate_clks_init();
-       psc_clks_init();
-
-       /* leave clockctl mapped forever */
-       /*iounmap(clockctl); */
-       DEBUG_CLK_DUMP();
-       clocks_initialized++;
-       clk_functions = mpc5121_clk_functions;
-       return 0;
-}
index 36b5652aada200cc05fe7e12a99e84b989a9d434..adb95f03d4d4b20002992977120bd8a27073dc88 100644 (file)
@@ -12,6 +12,7 @@
  * (at your option) any later version.
  */
 
+#include <linux/clk.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <linux/irq.h>
@@ -68,98 +69,112 @@ struct fsl_diu_shared_fb {
        bool            in_use;
 };
 
-#define DIU_DIV_MASK   0x000000ff
+/* receives a pixel clock spec in pico seconds, adjusts the DIU clock rate */
 static void mpc512x_set_pixel_clock(unsigned int pixclock)
 {
-       unsigned long bestval, bestfreq, speed, busfreq;
-       unsigned long minpixclock, maxpixclock, pixval;
-       struct mpc512x_ccm __iomem *ccm;
        struct device_node *np;
-       u32 temp;
-       long err;
-       int i;
+       struct clk *clk_diu;
+       unsigned long epsilon, minpixclock, maxpixclock;
+       unsigned long offset, want, got, delta;
 
-       np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-clock");
+       /* lookup and enable the DIU clock */
+       np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-diu");
        if (!np) {
-               pr_err("Can't find clock control module.\n");
+               pr_err("Could not find DIU device tree node.\n");
                return;
        }
-
-       ccm = of_iomap(np, 0);
+       clk_diu = of_clk_get(np, 0);
+       if (IS_ERR(clk_diu)) {
+               /* backwards compat with device trees that lack clock specs */
+               clk_diu = clk_get_sys(np->name, "ipg");
+       }
        of_node_put(np);
-       if (!ccm) {
-               pr_err("Can't map clock control module reg.\n");
+       if (IS_ERR(clk_diu)) {
+               pr_err("Could not lookup DIU clock.\n");
                return;
        }
-
-       np = of_find_node_by_type(NULL, "cpu");
-       if (np) {
-               const unsigned int *prop =
-                       of_get_property(np, "bus-frequency", NULL);
-
-               of_node_put(np);
-               if (prop) {
-                       busfreq = *prop;
-               } else {
-                       pr_err("Can't get bus-frequency property\n");
-                       return;
-               }
-       } else {
-               pr_err("Can't find 'cpu' node.\n");
+       if (clk_prepare_enable(clk_diu)) {
+               pr_err("Could not enable DIU clock.\n");
                return;
        }
 
-       /* Pixel Clock configuration */
-       pr_debug("DIU: Bus Frequency = %lu\n", busfreq);
-       speed = busfreq * 4; /* DIU_DIV ratio is 4 * CSB_CLK / DIU_CLK */
-
-       /* Calculate the pixel clock with the smallest error */
-       /* calculate the following in steps to avoid overflow */
-       pr_debug("DIU pixclock in ps - %d\n", pixclock);
-       temp = (1000000000 / pixclock) * 1000;
-       pixclock = temp;
-       pr_debug("DIU pixclock freq - %u\n", pixclock);
-
-       temp = temp / 20; /* pixclock * 0.05 */
-       pr_debug("deviation = %d\n", temp);
-       minpixclock = pixclock - temp;
-       maxpixclock = pixclock + temp;
-       pr_debug("DIU minpixclock - %lu\n", minpixclock);
-       pr_debug("DIU maxpixclock - %lu\n", maxpixclock);
-       pixval = speed/pixclock;
-       pr_debug("DIU pixval = %lu\n", pixval);
-
-       err = LONG_MAX;
-       bestval = pixval;
-       pr_debug("DIU bestval = %lu\n", bestval);
-
-       bestfreq = 0;
-       for (i = -1; i <= 1; i++) {
-               temp = speed / (pixval+i);
-               pr_debug("DIU test pixval i=%d, pixval=%lu, temp freq. = %u\n",
-                       i, pixval, temp);
-               if ((temp < minpixclock) || (temp > maxpixclock))
-                       pr_debug("DIU exceeds monitor range (%lu to %lu)\n",
-                               minpixclock, maxpixclock);
-               else if (abs(temp - pixclock) < err) {
-                       pr_debug("Entered the else if block %d\n", i);
-                       err = abs(temp - pixclock);
-                       bestval = pixval + i;
-                       bestfreq = temp;
-               }
+       /*
+        * convert the picoseconds spec into the desired clock rate,
+        * determine the acceptable clock range for the monitor (+/- 5%),
+        * do the calculation in steps to avoid integer overflow
+        */
+       pr_debug("DIU pixclock in ps - %u\n", pixclock);
+       pixclock = (1000000000 / pixclock) * 1000;
+       pr_debug("DIU pixclock freq  - %u\n", pixclock);
+       epsilon = pixclock / 20; /* pixclock * 0.05 */
+       pr_debug("DIU deviation      - %lu\n", epsilon);
+       minpixclock = pixclock - epsilon;
+       maxpixclock = pixclock + epsilon;
+       pr_debug("DIU minpixclock    - %lu\n", minpixclock);
+       pr_debug("DIU maxpixclock    - %lu\n", maxpixclock);
+
+       /*
+        * check whether the DIU supports the desired pixel clock
+        *
+        * - simply request the desired clock and see what the
+        *   platform's clock driver will make of it, assuming that it
+        *   will setup the best approximation of the requested value
+        * - try other candidate frequencies in the order of decreasing
+        *   preference (i.e. with increasing distance from the desired
+        *   pixel clock, and checking the lower frequency before the
+        *   higher frequency to not overload the hardware) until the
+        *   first match is found -- any potential subsequent match
+        *   would only be as good as the former match or typically
+        *   would be less preferrable
+        *
+        * the offset increment of pixelclock divided by 64 is an
+        * arbitrary choice -- it's simple to calculate, in the typical
+        * case we expect the first check to succeed already, in the
+        * worst case seven frequencies get tested (the exact center and
+        * three more values each to the left and to the right) before
+        * the 5% tolerance window is exceeded, resulting in fast enough
+        * execution yet high enough probability of finding a suitable
+        * value, while the error rate will be in the order of single
+        * percents
+        */
+       for (offset = 0; offset <= epsilon; offset += pixclock / 64) {
+               want = pixclock - offset;
+               pr_debug("DIU checking clock - %lu\n", want);
+               clk_set_rate(clk_diu, want);
+               got = clk_get_rate(clk_diu);
+               delta = abs(pixclock - got);
+               if (delta < epsilon)
+                       break;
+               if (!offset)
+                       continue;
+               want = pixclock + offset;
+               pr_debug("DIU checking clock - %lu\n", want);
+               clk_set_rate(clk_diu, want);
+               got = clk_get_rate(clk_diu);
+               delta = abs(pixclock - got);
+               if (delta < epsilon)
+                       break;
        }
+       if (offset <= epsilon) {
+               pr_debug("DIU clock accepted - %lu\n", want);
+               pr_debug("DIU pixclock want %u, got %lu, delta %lu, eps %lu\n",
+                        pixclock, got, delta, epsilon);
+               return;
+       }
+       pr_warn("DIU pixclock auto search unsuccessful\n");
 
-       pr_debug("DIU chose = %lx\n", bestval);
-       pr_debug("DIU error = %ld\n NomPixClk ", err);
-       pr_debug("DIU: Best Freq = %lx\n", bestfreq);
-       /* Modify DIU_DIV in CCM SCFR1 */
-       temp = in_be32(&ccm->scfr1);
-       pr_debug("DIU: Current value of SCFR1: 0x%08x\n", temp);
-       temp &= ~DIU_DIV_MASK;
-       temp |= (bestval & DIU_DIV_MASK);
-       out_be32(&ccm->scfr1, temp);
-       pr_debug("DIU: Modified value of SCFR1: 0x%08x\n", temp);
-       iounmap(ccm);
+       /*
+        * what is the most appropriate action to take when the search
+        * for an available pixel clock which is acceptable to the
+        * monitor has failed?  disable the DIU (clock) or just provide
+        * a "best effort"?  we go with the latter
+        */
+       pr_warn("DIU pixclock best effort fallback (backend's choice)\n");
+       clk_set_rate(clk_diu, pixclock);
+       got = clk_get_rate(clk_diu);
+       delta = abs(pixclock - got);
+       pr_debug("DIU pixclock want %u, got %lu, delta %lu, eps %lu\n",
+                pixclock, got, delta, epsilon);
 }
 
 static enum fsl_diu_monitor_port
index af54174801f7aa9042f12487e5fe94530f8d089a..b625a2c6f4f27b5ba77dfd9e9c8ccf1a9cf66c23 100644 (file)
@@ -1,7 +1,7 @@
 config PPC_MPC52xx
        bool "52xx-based boards"
        depends on 6xx
-       select PPC_CLOCK
+       select COMMON_CLK
        select PPC_PCI_CHOICE
 
 config PPC_MPC5200_SIMPLE
index bca2465a9c347ad65f3617a7a51f2e4f2a73034a..434fda39bf8b51f219098f207ce9cf35760fd484 100644 (file)
@@ -72,6 +72,7 @@ config PPC_BOOK3S_64
        select PPC_HAVE_PMU_SUPPORT
        select SYS_SUPPORTS_HUGETLBFS
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE if PPC_64K_PAGES
+       select ARCH_SUPPORTS_NUMA_BALANCING
 
 config PPC_BOOK3E_64
        bool "Embedded processors"
index c34ee4e608734f387a0e43ed87abc1ba27e6dd27..d4d245c0d78799a6f48e65aae52560b75daac6e7 100644 (file)
@@ -111,7 +111,7 @@ static long beat_lpar_hpte_insert(unsigned long hpte_group,
                DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
 
        if (rflags & _PAGE_NO_CACHE)
-               hpte_r &= ~_PAGE_COHERENT;
+               hpte_r &= ~HPTE_R_M;
 
        raw_spin_lock(&beat_htab_lock);
        lpar_rc = beat_read_mask(hpte_group);
@@ -337,7 +337,7 @@ static long beat_lpar_hpte_insert_v3(unsigned long hpte_group,
                DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
 
        if (rflags & _PAGE_NO_CACHE)
-               hpte_r &= ~_PAGE_COHERENT;
+               hpte_r &= ~HPTE_R_M;
 
        /* insert into not-volted entry */
        lpar_rc = beat_insert_htab_entry3(0, hpte_group, hpte_v, hpte_r,
index 9fced3f6d2dcfadbf0f26c71d57693d79b1c78ba..895e8a20a3fc064069d49d4b4cc1280b05df4e87 100644 (file)
@@ -13,11 +13,6 @@ config PPC_POWERNV
        select ARCH_RANDOM
        default y
 
-config POWERNV_MSI
-       bool "Support PCI MSI on PowerNV platform"
-       depends on PCI_MSI
-       default y
-
 config PPC_POWERNV_RTAS
        depends on PPC_POWERNV
        bool "Support for RTAS based PowerNV platforms such as BML"
index 873fa1370dc44c1b0b3994e7555c4fac450adcbd..8d767fde5a6ac32484bf106698d8c43e1292cd73 100644 (file)
@@ -6,3 +6,4 @@ obj-$(CONFIG_SMP)       += smp.o
 obj-$(CONFIG_PCI)      += pci.o pci-p5ioc2.o pci-ioda.o
 obj-$(CONFIG_EEH)      += eeh-ioda.o eeh-powernv.o
 obj-$(CONFIG_PPC_SCOM) += opal-xscom.o
+obj-$(CONFIG_MEMORY_FAILURE)   += opal-memory-errors.o
index 02245cee78183852d52f3a907023dcd9a63529bf..31320c641c92ca139c33815cd99e3c8b48bd54e1 100644 (file)
@@ -588,11 +588,8 @@ static int ioda_eeh_get_log(struct eeh_pe *pe, int severity,
                return -EIO;
        }
 
-       /*
-        * FIXME: We probably need log the error in somewhere.
-        * Lets make it up in future.
-        */
-       /* pr_info("%s", phb->diag.blob); */
+       /* The PHB diag-data is always indicative */
+       pnv_pci_dump_phb_diag_data(hose, phb->diag.blob);
 
        spin_unlock_irqrestore(&phb->lock, flags);
 
@@ -681,164 +678,20 @@ static void ioda_eeh_hub_diag(struct pci_controller *hose)
        }
 }
 
-static void ioda_eeh_p7ioc_phb_diag(struct pci_controller *hose,
-                                   struct OpalIoPhbErrorCommon *common)
-{
-       struct OpalIoP7IOCPhbErrorData *data;
-       int i;
-
-       data = (struct OpalIoP7IOCPhbErrorData *)common;
-
-       pr_info("P7IOC PHB#%x Diag-data (Version: %d)\n\n",
-               hose->global_number, common->version);
-
-       pr_info("  brdgCtl:              %08x\n", data->brdgCtl);
-
-       pr_info("  portStatusReg:        %08x\n", data->portStatusReg);
-       pr_info("  rootCmplxStatus:      %08x\n", data->rootCmplxStatus);
-       pr_info("  busAgentStatus:       %08x\n", data->busAgentStatus);
-
-       pr_info("  deviceStatus:         %08x\n", data->deviceStatus);
-       pr_info("  slotStatus:           %08x\n", data->slotStatus);
-       pr_info("  linkStatus:           %08x\n", data->linkStatus);
-       pr_info("  devCmdStatus:         %08x\n", data->devCmdStatus);
-       pr_info("  devSecStatus:         %08x\n", data->devSecStatus);
-
-       pr_info("  rootErrorStatus:      %08x\n", data->rootErrorStatus);
-       pr_info("  uncorrErrorStatus:    %08x\n", data->uncorrErrorStatus);
-       pr_info("  corrErrorStatus:      %08x\n", data->corrErrorStatus);
-       pr_info("  tlpHdr1:              %08x\n", data->tlpHdr1);
-       pr_info("  tlpHdr2:              %08x\n", data->tlpHdr2);
-       pr_info("  tlpHdr3:              %08x\n", data->tlpHdr3);
-       pr_info("  tlpHdr4:              %08x\n", data->tlpHdr4);
-       pr_info("  sourceId:             %08x\n", data->sourceId);
-
-       pr_info("  errorClass:           %016llx\n", data->errorClass);
-       pr_info("  correlator:           %016llx\n", data->correlator);
-       pr_info("  p7iocPlssr:           %016llx\n", data->p7iocPlssr);
-       pr_info("  p7iocCsr:             %016llx\n", data->p7iocCsr);
-       pr_info("  lemFir:               %016llx\n", data->lemFir);
-       pr_info("  lemErrorMask:         %016llx\n", data->lemErrorMask);
-       pr_info("  lemWOF:               %016llx\n", data->lemWOF);
-       pr_info("  phbErrorStatus:       %016llx\n", data->phbErrorStatus);
-       pr_info("  phbFirstErrorStatus:  %016llx\n", data->phbFirstErrorStatus);
-       pr_info("  phbErrorLog0:         %016llx\n", data->phbErrorLog0);
-       pr_info("  phbErrorLog1:         %016llx\n", data->phbErrorLog1);
-       pr_info("  mmioErrorStatus:      %016llx\n", data->mmioErrorStatus);
-       pr_info("  mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus);
-       pr_info("  mmioErrorLog0:        %016llx\n", data->mmioErrorLog0);
-       pr_info("  mmioErrorLog1:        %016llx\n", data->mmioErrorLog1);
-       pr_info("  dma0ErrorStatus:      %016llx\n", data->dma0ErrorStatus);
-       pr_info("  dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus);
-       pr_info("  dma0ErrorLog0:        %016llx\n", data->dma0ErrorLog0);
-       pr_info("  dma0ErrorLog1:        %016llx\n", data->dma0ErrorLog1);
-       pr_info("  dma1ErrorStatus:      %016llx\n", data->dma1ErrorStatus);
-       pr_info("  dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus);
-       pr_info("  dma1ErrorLog0:        %016llx\n", data->dma1ErrorLog0);
-       pr_info("  dma1ErrorLog1:        %016llx\n", data->dma1ErrorLog1);
-
-       for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) {
-               if ((data->pestA[i] >> 63) == 0 &&
-                   (data->pestB[i] >> 63) == 0)
-                       continue;
-
-               pr_info("  PE[%3d] PESTA:        %016llx\n", i, data->pestA[i]);
-               pr_info("          PESTB:        %016llx\n", data->pestB[i]);
-       }
-}
-
-static void ioda_eeh_phb3_phb_diag(struct pci_controller *hose,
-                                   struct OpalIoPhbErrorCommon *common)
-{
-       struct OpalIoPhb3ErrorData *data;
-       int i;
-
-       data = (struct OpalIoPhb3ErrorData*)common;
-       pr_info("PHB3 PHB#%x Diag-data (Version: %d)\n\n",
-               hose->global_number, common->version);
-
-       pr_info("  brdgCtl:              %08x\n", data->brdgCtl);
-
-       pr_info("  portStatusReg:        %08x\n", data->portStatusReg);
-       pr_info("  rootCmplxStatus:      %08x\n", data->rootCmplxStatus);
-       pr_info("  busAgentStatus:       %08x\n", data->busAgentStatus);
-
-       pr_info("  deviceStatus:         %08x\n", data->deviceStatus);
-       pr_info("  slotStatus:           %08x\n", data->slotStatus);
-       pr_info("  linkStatus:           %08x\n", data->linkStatus);
-       pr_info("  devCmdStatus:         %08x\n", data->devCmdStatus);
-       pr_info("  devSecStatus:         %08x\n", data->devSecStatus);
-
-       pr_info("  rootErrorStatus:      %08x\n", data->rootErrorStatus);
-       pr_info("  uncorrErrorStatus:    %08x\n", data->uncorrErrorStatus);
-       pr_info("  corrErrorStatus:      %08x\n", data->corrErrorStatus);
-       pr_info("  tlpHdr1:              %08x\n", data->tlpHdr1);
-       pr_info("  tlpHdr2:              %08x\n", data->tlpHdr2);
-       pr_info("  tlpHdr3:              %08x\n", data->tlpHdr3);
-       pr_info("  tlpHdr4:              %08x\n", data->tlpHdr4);
-       pr_info("  sourceId:             %08x\n", data->sourceId);
-       pr_info("  errorClass:           %016llx\n", data->errorClass);
-       pr_info("  correlator:           %016llx\n", data->correlator);
-       pr_info("  nFir:                 %016llx\n", data->nFir);
-       pr_info("  nFirMask:             %016llx\n", data->nFirMask);
-       pr_info("  nFirWOF:              %016llx\n", data->nFirWOF);
-       pr_info("  PhbPlssr:             %016llx\n", data->phbPlssr);
-       pr_info("  PhbCsr:               %016llx\n", data->phbCsr);
-       pr_info("  lemFir:               %016llx\n", data->lemFir);
-       pr_info("  lemErrorMask:         %016llx\n", data->lemErrorMask);
-       pr_info("  lemWOF:               %016llx\n", data->lemWOF);
-       pr_info("  phbErrorStatus:       %016llx\n", data->phbErrorStatus);
-       pr_info("  phbFirstErrorStatus:  %016llx\n", data->phbFirstErrorStatus);
-       pr_info("  phbErrorLog0:         %016llx\n", data->phbErrorLog0);
-       pr_info("  phbErrorLog1:         %016llx\n", data->phbErrorLog1);
-       pr_info("  mmioErrorStatus:      %016llx\n", data->mmioErrorStatus);
-       pr_info("  mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus);
-       pr_info("  mmioErrorLog0:        %016llx\n", data->mmioErrorLog0);
-       pr_info("  mmioErrorLog1:        %016llx\n", data->mmioErrorLog1);
-       pr_info("  dma0ErrorStatus:      %016llx\n", data->dma0ErrorStatus);
-       pr_info("  dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus);
-       pr_info("  dma0ErrorLog0:        %016llx\n", data->dma0ErrorLog0);
-       pr_info("  dma0ErrorLog1:        %016llx\n", data->dma0ErrorLog1);
-       pr_info("  dma1ErrorStatus:      %016llx\n", data->dma1ErrorStatus);
-       pr_info("  dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus);
-       pr_info("  dma1ErrorLog0:        %016llx\n", data->dma1ErrorLog0);
-       pr_info("  dma1ErrorLog1:        %016llx\n", data->dma1ErrorLog1);
-
-       for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) {
-               if ((data->pestA[i] >> 63) == 0 &&
-                   (data->pestB[i] >> 63) == 0)
-                       continue;
-
-               pr_info("  PE[%3d] PESTA:        %016llx\n", i, data->pestA[i]);
-               pr_info("          PESTB:        %016llx\n", data->pestB[i]);
-       }
-}
-
 static void ioda_eeh_phb_diag(struct pci_controller *hose)
 {
        struct pnv_phb *phb = hose->private_data;
-       struct OpalIoPhbErrorCommon *common;
        long rc;
 
-       common = (struct OpalIoPhbErrorCommon *)phb->diag.blob;
-       rc = opal_pci_get_phb_diag_data2(phb->opal_id, common, PAGE_SIZE);
+       rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,
+                                        PNV_PCI_DIAG_BUF_SIZE);
        if (rc != OPAL_SUCCESS) {
                pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n",
                            __func__, hose->global_number, rc);
                return;
        }
 
-       switch (common->ioType) {
-       case OPAL_PHB_ERROR_DATA_TYPE_P7IOC:
-               ioda_eeh_p7ioc_phb_diag(hose, common);
-               break;
-       case OPAL_PHB_ERROR_DATA_TYPE_PHB3:
-               ioda_eeh_phb3_phb_diag(hose, common);
-               break;
-       default:
-               pr_warning("%s: Unrecognized I/O chip %d\n",
-                          __func__, common->ioType);
-       }
+       pnv_pci_dump_phb_diag_data(hose, phb->diag.blob);
 }
 
 static int ioda_eeh_get_phb_pe(struct pci_controller *hose,
index 6ffa6b1ec5b784e2dcfbb3ee555acbd22b5c8526..4aeae4f36e1d718f865a0722194fc7991acec778 100644 (file)
@@ -103,27 +103,6 @@ struct image_header_t {
        uint32_t        size;
 };
 
-/* Scatter/gather entry */
-struct opal_sg_entry {
-       void    *data;
-       long    length;
-};
-
-/* We calculate number of entries based on PAGE_SIZE */
-#define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
-
-/*
- * This struct is very similar but not identical to that
- * needed by the opal flash update. All we need to do for
- * opal is rewrite num_entries into a version/length and
- * translate the pointers to absolute.
- */
-struct opal_sg_list {
-       unsigned long num_entries;
-       struct opal_sg_list *next;
-       struct opal_sg_entry entry[SG_ENTRIES_PER_NODE];
-};
-
 struct validate_flash_t {
        int             status;         /* Return status */
        void            *buf;           /* Candiate image buffer */
@@ -333,7 +312,7 @@ static struct opal_sg_list *image_data_to_sglist(void)
        addr = image_data.data;
        size = image_data.size;
 
-       sg1 = kzalloc((sizeof(struct opal_sg_list)), GFP_KERNEL);
+       sg1 = kzalloc(PAGE_SIZE, GFP_KERNEL);
        if (!sg1)
                return NULL;
 
@@ -351,8 +330,7 @@ static struct opal_sg_list *image_data_to_sglist(void)
 
                sg1->num_entries++;
                if (sg1->num_entries >= SG_ENTRIES_PER_NODE) {
-                       sg1->next = kzalloc((sizeof(struct opal_sg_list)),
-                                           GFP_KERNEL);
+                       sg1->next = kzalloc(PAGE_SIZE, GFP_KERNEL);
                        if (!sg1->next) {
                                pr_err("%s : Failed to allocate memory\n",
                                       __func__);
@@ -402,7 +380,10 @@ static int opal_flash_update(int op)
                else
                        sg->next = NULL;
 
-               /* Make num_entries into the version/length field */
+               /*
+                * Convert num_entries to version/length format
+                * to satisfy OPAL.
+                */
                sg->num_entries = (SG_LIST_VERSION << 56) |
                        (sg->num_entries * sizeof(struct opal_sg_entry) + 16);
        }
diff --git a/arch/powerpc/platforms/powernv/opal-memory-errors.c b/arch/powerpc/platforms/powernv/opal-memory-errors.c
new file mode 100644 (file)
index 0000000..ec41322
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * OPAL asynchronus Memory error handling support in PowreNV.
+ *
+ * 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.
+ *
+ * Copyright 2013 IBM Corporation
+ * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
+ */
+
+#undef DEBUG
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/of.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
+
+#include <asm/opal.h>
+#include <asm/cputable.h>
+
+static int opal_mem_err_nb_init;
+static LIST_HEAD(opal_memory_err_list);
+static DEFINE_SPINLOCK(opal_mem_err_lock);
+
+struct OpalMsgNode {
+       struct list_head list;
+       struct opal_msg msg;
+};
+
+static void handle_memory_error_event(struct OpalMemoryErrorData *merr_evt)
+{
+       uint64_t paddr_start, paddr_end;
+
+       pr_debug("%s: Retrived memory error event, type: 0x%x\n",
+                 __func__, merr_evt->type);
+       switch (merr_evt->type) {
+       case OPAL_MEM_ERR_TYPE_RESILIENCE:
+               paddr_start = merr_evt->u.resilience.physical_address_start;
+               paddr_end = merr_evt->u.resilience.physical_address_end;
+               break;
+       case OPAL_MEM_ERR_TYPE_DYN_DALLOC:
+               paddr_start = merr_evt->u.dyn_dealloc.physical_address_start;
+               paddr_end = merr_evt->u.dyn_dealloc.physical_address_end;
+               break;
+       default:
+               return;
+       }
+
+       for (; paddr_start < paddr_end; paddr_start += PAGE_SIZE) {
+               memory_failure(paddr_start >> PAGE_SHIFT, 0, 0);
+       }
+}
+
+static void handle_memory_error(void)
+{
+       unsigned long flags;
+       struct OpalMemoryErrorData *merr_evt;
+       struct OpalMsgNode *msg_node;
+
+       spin_lock_irqsave(&opal_mem_err_lock, flags);
+       while (!list_empty(&opal_memory_err_list)) {
+                msg_node = list_entry(opal_memory_err_list.next,
+                                          struct OpalMsgNode, list);
+               list_del(&msg_node->list);
+               spin_unlock_irqrestore(&opal_mem_err_lock, flags);
+
+               merr_evt = (struct OpalMemoryErrorData *)
+                                       &msg_node->msg.params[0];
+               handle_memory_error_event(merr_evt);
+               kfree(msg_node);
+               spin_lock_irqsave(&opal_mem_err_lock, flags);
+       }
+       spin_unlock_irqrestore(&opal_mem_err_lock, flags);
+}
+
+static void mem_error_handler(struct work_struct *work)
+{
+       handle_memory_error();
+}
+
+static DECLARE_WORK(mem_error_work, mem_error_handler);
+
+/*
+ * opal_memory_err_event - notifier handler that queues up the opal message
+ * to be preocessed later.
+ */
+static int opal_memory_err_event(struct notifier_block *nb,
+                         unsigned long msg_type, void *msg)
+{
+       unsigned long flags;
+       struct OpalMsgNode *msg_node;
+
+       if (msg_type != OPAL_MSG_MEM_ERR)
+               return 0;
+
+       msg_node = kzalloc(sizeof(*msg_node), GFP_ATOMIC);
+       if (!msg_node) {
+               pr_err("MEMORY_ERROR: out of memory, Opal message event not"
+                      "handled\n");
+               return -ENOMEM;
+       }
+       memcpy(&msg_node->msg, msg, sizeof(struct opal_msg));
+
+       spin_lock_irqsave(&opal_mem_err_lock, flags);
+       list_add(&msg_node->list, &opal_memory_err_list);
+       spin_unlock_irqrestore(&opal_mem_err_lock, flags);
+
+       schedule_work(&mem_error_work);
+       return 0;
+}
+
+static struct notifier_block opal_mem_err_nb = {
+       .notifier_call  = opal_memory_err_event,
+       .next           = NULL,
+       .priority       = 0,
+};
+
+static int __init opal_mem_err_init(void)
+{
+       int ret;
+
+       if (!opal_mem_err_nb_init) {
+               ret = opal_message_notifier_register(
+                                       OPAL_MSG_MEM_ERR, &opal_mem_err_nb);
+               if (ret) {
+                       pr_err("%s: Can't register OPAL event notifier (%d)\n",
+                              __func__, ret);
+                       return ret;
+               }
+               opal_mem_err_nb_init = 1;
+       }
+       return 0;
+}
+subsys_initcall(opal_mem_err_init);
index 7d07c7e80ec09e9232b3cafd9c41a104992b5331..b1885db8fdf34bfe068f1712d486f6884dc50d0e 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <asm/opal.h>
 #include <asm/firmware.h>
+#include <asm/machdep.h>
 
 static void opal_to_tm(u32 y_m_d, u64 h_m_s_ms, struct rtc_time *tm)
 {
@@ -48,8 +49,11 @@ unsigned long __init opal_get_boot_time(void)
                else
                        mdelay(10);
        }
-       if (rc != OPAL_SUCCESS)
+       if (rc != OPAL_SUCCESS) {
+               ppc_md.get_rtc_time = NULL;
+               ppc_md.set_rtc_time = NULL;
                return 0;
+       }
        y_m_d = be32_to_cpu(__y_m_d);
        h_m_s_ms = be64_to_cpu(__h_m_s_ms);
        opal_to_tm(y_m_d, h_m_s_ms, &tm);
index e7806504e9769162f921e704cf55d0b3e210cf6c..719aa5c325c65121c9a826a3cefc3e59ec014f47 100644 (file)
@@ -126,3 +126,5 @@ OPAL_CALL(opal_return_cpu,                  OPAL_RETURN_CPU);
 OPAL_CALL(opal_validate_flash,                 OPAL_FLASH_VALIDATE);
 OPAL_CALL(opal_manage_flash,                   OPAL_FLASH_MANAGE);
 OPAL_CALL(opal_update_flash,                   OPAL_FLASH_UPDATE);
+OPAL_CALL(opal_get_msg,                                OPAL_GET_MSG);
+OPAL_CALL(opal_check_completion,               OPAL_CHECK_ASYNC_COMPLETION);
index 1c798cd553722f6f043a066c299100be89c10f96..7a184a0ff18371c717ed705d2a2f021b65eec8f3 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/notifier.h>
 #include <linux/slab.h>
+#include <linux/sched.h>
 #include <linux/kobject.h>
 #include <asm/opal.h>
 #include <asm/firmware.h>
+#include <asm/mce.h>
 
 #include "powernv.h"
 
@@ -38,6 +40,7 @@ extern u64 opal_mc_secondary_handler[];
 static unsigned int *opal_irqs;
 static unsigned int opal_irq_count;
 static ATOMIC_NOTIFIER_HEAD(opal_notifier_head);
+static struct atomic_notifier_head opal_msg_notifier_head[OPAL_MSG_TYPE_MAX];
 static DEFINE_SPINLOCK(opal_notifier_lock);
 static uint64_t last_notified_mask = 0x0ul;
 static atomic_t opal_notifier_hold = ATOMIC_INIT(0);
@@ -88,14 +91,10 @@ static int __init opal_register_exception_handlers(void)
        if (!(powerpc_firmware_features & FW_FEATURE_OPAL))
                return -ENODEV;
 
-       /* Hookup some exception handlers. We use the fwnmi area at 0x7000
-        * to provide the glue space to OPAL
+       /* Hookup some exception handlers except machine check. We use the
+        * fwnmi area at 0x7000 to provide the glue space to OPAL
         */
        glue = 0x7000;
-       opal_register_exception_handler(OPAL_MACHINE_CHECK_HANDLER,
-                                       __pa(opal_mc_secondary_handler[0]),
-                                       glue);
-       glue += 128;
        opal_register_exception_handler(OPAL_HYPERVISOR_MAINTENANCE_HANDLER,
                                        0, glue);
        glue += 128;
@@ -169,6 +168,95 @@ void opal_notifier_disable(void)
        atomic_set(&opal_notifier_hold, 1);
 }
 
+/*
+ * Opal message notifier based on message type. Allow subscribers to get
+ * notified for specific messgae type.
+ */
+int opal_message_notifier_register(enum OpalMessageType msg_type,
+                                       struct notifier_block *nb)
+{
+       if (!nb) {
+               pr_warning("%s: Invalid argument (%p)\n",
+                          __func__, nb);
+               return -EINVAL;
+       }
+       if (msg_type > OPAL_MSG_TYPE_MAX) {
+               pr_warning("%s: Invalid message type argument (%d)\n",
+                          __func__, msg_type);
+               return -EINVAL;
+       }
+       return atomic_notifier_chain_register(
+                               &opal_msg_notifier_head[msg_type], nb);
+}
+
+static void opal_message_do_notify(uint32_t msg_type, void *msg)
+{
+       /* notify subscribers */
+       atomic_notifier_call_chain(&opal_msg_notifier_head[msg_type],
+                                       msg_type, msg);
+}
+
+static void opal_handle_message(void)
+{
+       s64 ret;
+       /*
+        * TODO: pre-allocate a message buffer depending on opal-msg-size
+        * value in /proc/device-tree.
+        */
+       static struct opal_msg msg;
+
+       ret = opal_get_msg(__pa(&msg), sizeof(msg));
+       /* No opal message pending. */
+       if (ret == OPAL_RESOURCE)
+               return;
+
+       /* check for errors. */
+       if (ret) {
+               pr_warning("%s: Failed to retrive opal message, err=%lld\n",
+                               __func__, ret);
+               return;
+       }
+
+       /* Sanity check */
+       if (msg.msg_type > OPAL_MSG_TYPE_MAX) {
+               pr_warning("%s: Unknown message type: %u\n",
+                               __func__, msg.msg_type);
+               return;
+       }
+       opal_message_do_notify(msg.msg_type, (void *)&msg);
+}
+
+static int opal_message_notify(struct notifier_block *nb,
+                         unsigned long events, void *change)
+{
+       if (events & OPAL_EVENT_MSG_PENDING)
+               opal_handle_message();
+       return 0;
+}
+
+static struct notifier_block opal_message_nb = {
+       .notifier_call  = opal_message_notify,
+       .next           = NULL,
+       .priority       = 0,
+};
+
+static int __init opal_message_init(void)
+{
+       int ret, i;
+
+       for (i = 0; i < OPAL_MSG_TYPE_MAX; i++)
+               ATOMIC_INIT_NOTIFIER_HEAD(&opal_msg_notifier_head[i]);
+
+       ret = opal_notifier_register(&opal_message_nb);
+       if (ret) {
+               pr_err("%s: Can't register OPAL event notifier (%d)\n",
+                      __func__, ret);
+               return ret;
+       }
+       return 0;
+}
+early_initcall(opal_message_init);
+
 int opal_get_chars(uint32_t vtermno, char *buf, int count)
 {
        s64 rc;
@@ -254,119 +342,62 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
        return written;
 }
 
+static int opal_recover_mce(struct pt_regs *regs,
+                                       struct machine_check_event *evt)
+{
+       int recovered = 0;
+       uint64_t ea = get_mce_fault_addr(evt);
+
+       if (!(regs->msr & MSR_RI)) {
+               /* If MSR_RI isn't set, we cannot recover */
+               recovered = 0;
+       } else if (evt->disposition == MCE_DISPOSITION_RECOVERED) {
+               /* Platform corrected itself */
+               recovered = 1;
+       } else if (ea && !is_kernel_addr(ea)) {
+               /*
+                * Faulting address is not in kernel text. We should be fine.
+                * We need to find which process uses this address.
+                * For now, kill the task if we have received exception when
+                * in userspace.
+                *
+                * TODO: Queue up this address for hwpoisioning later.
+                */
+               if (user_mode(regs) && !is_global_init(current)) {
+                       _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip);
+                       recovered = 1;
+               } else
+                       recovered = 0;
+       } else if (user_mode(regs) && !is_global_init(current) &&
+               evt->severity == MCE_SEV_ERROR_SYNC) {
+               /*
+                * If we have received a synchronous error when in userspace
+                * kill the task.
+                */
+               _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip);
+               recovered = 1;
+       }
+       return recovered;
+}
+
 int opal_machine_check(struct pt_regs *regs)
 {
-       struct opal_machine_check_event *opal_evt = get_paca()->opal_mc_evt;
-       struct opal_machine_check_event evt;
-       const char *level, *sevstr, *subtype;
-       static const char *opal_mc_ue_types[] = {
-               "Indeterminate",
-               "Instruction fetch",
-               "Page table walk ifetch",
-               "Load/Store",
-               "Page table walk Load/Store",
-       };
-       static const char *opal_mc_slb_types[] = {
-               "Indeterminate",
-               "Parity",
-               "Multihit",
-       };
-       static const char *opal_mc_erat_types[] = {
-               "Indeterminate",
-               "Parity",
-               "Multihit",
-       };
-       static const char *opal_mc_tlb_types[] = {
-               "Indeterminate",
-               "Parity",
-               "Multihit",
-       };
-
-       /* Copy the event structure and release the original */
-       evt = *opal_evt;
-       opal_evt->in_use = 0;
+       struct machine_check_event evt;
+
+       if (!get_mce_event(&evt, MCE_EVENT_RELEASE))
+               return 0;
 
        /* Print things out */
-       if (evt.version != OpalMCE_V1) {
+       if (evt.version != MCE_V1) {
                pr_err("Machine Check Exception, Unknown event version %d !\n",
                       evt.version);
                return 0;
        }
-       switch(evt.severity) {
-       case OpalMCE_SEV_NO_ERROR:
-               level = KERN_INFO;
-               sevstr = "Harmless";
-               break;
-       case OpalMCE_SEV_WARNING:
-               level = KERN_WARNING;
-               sevstr = "";
-               break;
-       case OpalMCE_SEV_ERROR_SYNC:
-               level = KERN_ERR;
-               sevstr = "Severe";
-               break;
-       case OpalMCE_SEV_FATAL:
-       default:
-               level = KERN_ERR;
-               sevstr = "Fatal";
-               break;
-       }
+       machine_check_print_event_info(&evt);
 
-       printk("%s%s Machine check interrupt [%s]\n", level, sevstr,
-              evt.disposition == OpalMCE_DISPOSITION_RECOVERED ?
-              "Recovered" : "[Not recovered");
-       printk("%s  Initiator: %s\n", level,
-              evt.initiator == OpalMCE_INITIATOR_CPU ? "CPU" : "Unknown");
-       switch(evt.error_type) {
-       case OpalMCE_ERROR_TYPE_UE:
-               subtype = evt.u.ue_error.ue_error_type <
-                       ARRAY_SIZE(opal_mc_ue_types) ?
-                       opal_mc_ue_types[evt.u.ue_error.ue_error_type]
-                       : "Unknown";
-               printk("%s  Error type: UE [%s]\n", level, subtype);
-               if (evt.u.ue_error.effective_address_provided)
-                       printk("%s    Effective address: %016llx\n",
-                              level, evt.u.ue_error.effective_address);
-               if (evt.u.ue_error.physical_address_provided)
-                       printk("%s      Physial address: %016llx\n",
-                              level, evt.u.ue_error.physical_address);
-               break;
-       case OpalMCE_ERROR_TYPE_SLB:
-               subtype = evt.u.slb_error.slb_error_type <
-                       ARRAY_SIZE(opal_mc_slb_types) ?
-                       opal_mc_slb_types[evt.u.slb_error.slb_error_type]
-                       : "Unknown";
-               printk("%s  Error type: SLB [%s]\n", level, subtype);
-               if (evt.u.slb_error.effective_address_provided)
-                       printk("%s    Effective address: %016llx\n",
-                              level, evt.u.slb_error.effective_address);
-               break;
-       case OpalMCE_ERROR_TYPE_ERAT:
-               subtype = evt.u.erat_error.erat_error_type <
-                       ARRAY_SIZE(opal_mc_erat_types) ?
-                       opal_mc_erat_types[evt.u.erat_error.erat_error_type]
-                       : "Unknown";
-               printk("%s  Error type: ERAT [%s]\n", level, subtype);
-               if (evt.u.erat_error.effective_address_provided)
-                       printk("%s    Effective address: %016llx\n",
-                              level, evt.u.erat_error.effective_address);
-               break;
-       case OpalMCE_ERROR_TYPE_TLB:
-               subtype = evt.u.tlb_error.tlb_error_type <
-                       ARRAY_SIZE(opal_mc_tlb_types) ?
-                       opal_mc_tlb_types[evt.u.tlb_error.tlb_error_type]
-                       : "Unknown";
-               printk("%s  Error type: TLB [%s]\n", level, subtype);
-               if (evt.u.tlb_error.effective_address_provided)
-                       printk("%s    Effective address: %016llx\n",
-                              level, evt.u.tlb_error.effective_address);
-               break;
-       default:
-       case OpalMCE_ERROR_TYPE_UNKNOWN:
-               printk("%s  Error type: Unknown\n", level);
-               break;
-       }
-       return evt.severity == OpalMCE_SEV_FATAL ? 0 : 1;
+       if (opal_recover_mce(regs, &evt))
+               return 1;
+       return 0;
 }
 
 static irqreturn_t opal_interrupt(int irq, void *data)
index 084cdfa40682b2be9f35fde51eb2e4e201accfe9..614356cac4665699f5be02ce7ceb603417b7a6a8 100644 (file)
@@ -460,7 +460,7 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev
                return;
 
        pe = &phb->ioda.pe_array[pdn->pe_number];
-       set_iommu_table_base(&pdev->dev, &pe->tce32_table);
+       set_iommu_table_base_and_group(&pdev->dev, &pe->tce32_table);
 }
 
 static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
@@ -468,7 +468,7 @@ static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
        struct pci_dev *dev;
 
        list_for_each_entry(dev, &bus->devices, bus_list) {
-               set_iommu_table_base(&dev->dev, &pe->tce32_table);
+               set_iommu_table_base_and_group(&dev->dev, &pe->tce32_table);
                if (dev->subordinate)
                        pnv_ioda_setup_bus_dma(pe, dev->subordinate);
        }
@@ -644,7 +644,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
        iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number);
 
        if (pe->pdev)
-               set_iommu_table_base(&pe->pdev->dev, tbl);
+               set_iommu_table_base_and_group(&pe->pdev->dev, tbl);
        else
                pnv_ioda_setup_bus_dma(pe, pe->pbus);
 
@@ -722,7 +722,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
        iommu_init_table(tbl, phb->hose->node);
 
        if (pe->pdev)
-               set_iommu_table_base(&pe->pdev->dev, tbl);
+               set_iommu_table_base_and_group(&pe->pdev->dev, tbl);
        else
                pnv_ioda_setup_bus_dma(pe, pe->pbus);
 
index f8b4bd8afb2e5da39cd8632c7a6a8eae54448aeb..e3807d69393e02c753e1777cffb03c5d6ae0db74 100644 (file)
@@ -92,7 +92,7 @@ static void pnv_pci_p5ioc2_dma_dev_setup(struct pnv_phb *phb,
                                pci_domain_nr(phb->hose->bus), phb->opal_id);
        }
 
-       set_iommu_table_base(&pdev->dev, &phb->p5ioc2.iommu_table);
+       set_iommu_table_base_and_group(&pdev->dev, &phb->p5ioc2.iommu_table);
 }
 
 static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id,
index 4eb33a9ed5325a3e84b2a7f1d4d58d5dc7fa7b22..bac289aac7ccb36da9be53aba4904ba2f0b91d13 100644 (file)
@@ -124,77 +124,157 @@ static void pnv_teardown_msi_irqs(struct pci_dev *pdev)
 }
 #endif /* CONFIG_PCI_MSI */
 
-static void pnv_pci_dump_p7ioc_diag_data(struct pnv_phb *phb)
+static void pnv_pci_dump_p7ioc_diag_data(struct pci_controller *hose,
+                                        struct OpalIoPhbErrorCommon *common)
 {
-       struct OpalIoP7IOCPhbErrorData *data = &phb->diag.p7ioc;
+       struct OpalIoP7IOCPhbErrorData *data;
        int i;
 
-       pr_info("PHB %d diagnostic data:\n", phb->hose->global_number);
-
-       pr_info("  brdgCtl              = 0x%08x\n", data->brdgCtl);
-
-       pr_info("  portStatusReg        = 0x%08x\n", data->portStatusReg);
-       pr_info("  rootCmplxStatus      = 0x%08x\n", data->rootCmplxStatus);
-       pr_info("  busAgentStatus       = 0x%08x\n", data->busAgentStatus);
-
-       pr_info("  deviceStatus         = 0x%08x\n", data->deviceStatus);
-       pr_info("  slotStatus           = 0x%08x\n", data->slotStatus);
-       pr_info("  linkStatus           = 0x%08x\n", data->linkStatus);
-       pr_info("  devCmdStatus         = 0x%08x\n", data->devCmdStatus);
-       pr_info("  devSecStatus         = 0x%08x\n", data->devSecStatus);
-
-       pr_info("  rootErrorStatus      = 0x%08x\n", data->rootErrorStatus);
-       pr_info("  uncorrErrorStatus    = 0x%08x\n", data->uncorrErrorStatus);
-       pr_info("  corrErrorStatus      = 0x%08x\n", data->corrErrorStatus);
-       pr_info("  tlpHdr1              = 0x%08x\n", data->tlpHdr1);
-       pr_info("  tlpHdr2              = 0x%08x\n", data->tlpHdr2);
-       pr_info("  tlpHdr3              = 0x%08x\n", data->tlpHdr3);
-       pr_info("  tlpHdr4              = 0x%08x\n", data->tlpHdr4);
-       pr_info("  sourceId             = 0x%08x\n", data->sourceId);
-
-       pr_info("  errorClass           = 0x%016llx\n", data->errorClass);
-       pr_info("  correlator           = 0x%016llx\n", data->correlator);
-
-       pr_info("  p7iocPlssr           = 0x%016llx\n", data->p7iocPlssr);
-       pr_info("  p7iocCsr             = 0x%016llx\n", data->p7iocCsr);
-       pr_info("  lemFir               = 0x%016llx\n", data->lemFir);
-       pr_info("  lemErrorMask         = 0x%016llx\n", data->lemErrorMask);
-       pr_info("  lemWOF               = 0x%016llx\n", data->lemWOF);
-       pr_info("  phbErrorStatus       = 0x%016llx\n", data->phbErrorStatus);
-       pr_info("  phbFirstErrorStatus  = 0x%016llx\n", data->phbFirstErrorStatus);
-       pr_info("  phbErrorLog0         = 0x%016llx\n", data->phbErrorLog0);
-       pr_info("  phbErrorLog1         = 0x%016llx\n", data->phbErrorLog1);
-       pr_info("  mmioErrorStatus      = 0x%016llx\n", data->mmioErrorStatus);
-       pr_info("  mmioFirstErrorStatus = 0x%016llx\n", data->mmioFirstErrorStatus);
-       pr_info("  mmioErrorLog0        = 0x%016llx\n", data->mmioErrorLog0);
-       pr_info("  mmioErrorLog1        = 0x%016llx\n", data->mmioErrorLog1);
-       pr_info("  dma0ErrorStatus      = 0x%016llx\n", data->dma0ErrorStatus);
-       pr_info("  dma0FirstErrorStatus = 0x%016llx\n", data->dma0FirstErrorStatus);
-       pr_info("  dma0ErrorLog0        = 0x%016llx\n", data->dma0ErrorLog0);
-       pr_info("  dma0ErrorLog1        = 0x%016llx\n", data->dma0ErrorLog1);
-       pr_info("  dma1ErrorStatus      = 0x%016llx\n", data->dma1ErrorStatus);
-       pr_info("  dma1FirstErrorStatus = 0x%016llx\n", data->dma1FirstErrorStatus);
-       pr_info("  dma1ErrorLog0        = 0x%016llx\n", data->dma1ErrorLog0);
-       pr_info("  dma1ErrorLog1        = 0x%016llx\n", data->dma1ErrorLog1);
+       data = (struct OpalIoP7IOCPhbErrorData *)common;
+       pr_info("P7IOC PHB#%d Diag-data (Version: %d)\n\n",
+               hose->global_number, common->version);
+
+       pr_info("  brdgCtl:              %08x\n", data->brdgCtl);
+
+       pr_info("  portStatusReg:        %08x\n", data->portStatusReg);
+       pr_info("  rootCmplxStatus:      %08x\n", data->rootCmplxStatus);
+       pr_info("  busAgentStatus:       %08x\n", data->busAgentStatus);
+
+       pr_info("  deviceStatus:         %08x\n", data->deviceStatus);
+       pr_info("  slotStatus:           %08x\n", data->slotStatus);
+       pr_info("  linkStatus:           %08x\n", data->linkStatus);
+       pr_info("  devCmdStatus:         %08x\n", data->devCmdStatus);
+       pr_info("  devSecStatus:         %08x\n", data->devSecStatus);
+
+       pr_info("  rootErrorStatus:      %08x\n", data->rootErrorStatus);
+       pr_info("  uncorrErrorStatus:    %08x\n", data->uncorrErrorStatus);
+       pr_info("  corrErrorStatus:      %08x\n", data->corrErrorStatus);
+       pr_info("  tlpHdr1:              %08x\n", data->tlpHdr1);
+       pr_info("  tlpHdr2:              %08x\n", data->tlpHdr2);
+       pr_info("  tlpHdr3:              %08x\n", data->tlpHdr3);
+       pr_info("  tlpHdr4:              %08x\n", data->tlpHdr4);
+       pr_info("  sourceId:             %08x\n", data->sourceId);
+       pr_info("  errorClass:           %016llx\n", data->errorClass);
+       pr_info("  correlator:           %016llx\n", data->correlator);
+       pr_info("  p7iocPlssr:           %016llx\n", data->p7iocPlssr);
+       pr_info("  p7iocCsr:             %016llx\n", data->p7iocCsr);
+       pr_info("  lemFir:               %016llx\n", data->lemFir);
+       pr_info("  lemErrorMask:         %016llx\n", data->lemErrorMask);
+       pr_info("  lemWOF:               %016llx\n", data->lemWOF);
+       pr_info("  phbErrorStatus:       %016llx\n", data->phbErrorStatus);
+       pr_info("  phbFirstErrorStatus:  %016llx\n", data->phbFirstErrorStatus);
+       pr_info("  phbErrorLog0:         %016llx\n", data->phbErrorLog0);
+       pr_info("  phbErrorLog1:         %016llx\n", data->phbErrorLog1);
+       pr_info("  mmioErrorStatus:      %016llx\n", data->mmioErrorStatus);
+       pr_info("  mmioFirstErrorStatus%016llx\n", data->mmioFirstErrorStatus);
+       pr_info("  mmioErrorLog0:        %016llx\n", data->mmioErrorLog0);
+       pr_info("  mmioErrorLog1:        %016llx\n", data->mmioErrorLog1);
+       pr_info("  dma0ErrorStatus:      %016llx\n", data->dma0ErrorStatus);
+       pr_info("  dma0FirstErrorStatus%016llx\n", data->dma0FirstErrorStatus);
+       pr_info("  dma0ErrorLog0:        %016llx\n", data->dma0ErrorLog0);
+       pr_info("  dma0ErrorLog1:        %016llx\n", data->dma0ErrorLog1);
+       pr_info("  dma1ErrorStatus:      %016llx\n", data->dma1ErrorStatus);
+       pr_info("  dma1FirstErrorStatus%016llx\n", data->dma1FirstErrorStatus);
+       pr_info("  dma1ErrorLog0:        %016llx\n", data->dma1ErrorLog0);
+       pr_info("  dma1ErrorLog1:        %016llx\n", data->dma1ErrorLog1);
 
        for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) {
                if ((data->pestA[i] >> 63) == 0 &&
                    (data->pestB[i] >> 63) == 0)
                        continue;
-               pr_info("  PE[%3d] PESTA        = 0x%016llx\n", i, data->pestA[i]);
-               pr_info("          PESTB        = 0x%016llx\n", data->pestB[i]);
+
+               pr_info("  PE[%3d] PESTA:        %016llx\n", i, data->pestA[i]);
+               pr_info("          PESTB:        %016llx\n", data->pestB[i]);
+       }
+}
+
+static void pnv_pci_dump_phb3_diag_data(struct pci_controller *hose,
+                                       struct OpalIoPhbErrorCommon *common)
+{
+       struct OpalIoPhb3ErrorData *data;
+       int i;
+
+       data = (struct OpalIoPhb3ErrorData*)common;
+       pr_info("PHB3 PHB#%d Diag-data (Version: %d)\n\n",
+               hose->global_number, common->version);
+
+       pr_info("  brdgCtl:              %08x\n", data->brdgCtl);
+
+       pr_info("  portStatusReg:        %08x\n", data->portStatusReg);
+       pr_info("  rootCmplxStatus:      %08x\n", data->rootCmplxStatus);
+       pr_info("  busAgentStatus:       %08x\n", data->busAgentStatus);
+
+       pr_info("  deviceStatus:         %08x\n", data->deviceStatus);
+       pr_info("  slotStatus:           %08x\n", data->slotStatus);
+       pr_info("  linkStatus:           %08x\n", data->linkStatus);
+       pr_info("  devCmdStatus:         %08x\n", data->devCmdStatus);
+       pr_info("  devSecStatus:         %08x\n", data->devSecStatus);
+
+       pr_info("  rootErrorStatus:      %08x\n", data->rootErrorStatus);
+       pr_info("  uncorrErrorStatus:    %08x\n", data->uncorrErrorStatus);
+       pr_info("  corrErrorStatus:      %08x\n", data->corrErrorStatus);
+       pr_info("  tlpHdr1:              %08x\n", data->tlpHdr1);
+       pr_info("  tlpHdr2:              %08x\n", data->tlpHdr2);
+       pr_info("  tlpHdr3:              %08x\n", data->tlpHdr3);
+       pr_info("  tlpHdr4:              %08x\n", data->tlpHdr4);
+       pr_info("  sourceId:             %08x\n", data->sourceId);
+       pr_info("  errorClass:           %016llx\n", data->errorClass);
+       pr_info("  correlator:           %016llx\n", data->correlator);
+
+       pr_info("  nFir:                 %016llx\n", data->nFir);
+       pr_info("  nFirMask:             %016llx\n", data->nFirMask);
+       pr_info("  nFirWOF:              %016llx\n", data->nFirWOF);
+       pr_info("  PhbPlssr:             %016llx\n", data->phbPlssr);
+       pr_info("  PhbCsr:               %016llx\n", data->phbCsr);
+       pr_info("  lemFir:               %016llx\n", data->lemFir);
+       pr_info("  lemErrorMask:         %016llx\n", data->lemErrorMask);
+       pr_info("  lemWOF:               %016llx\n", data->lemWOF);
+       pr_info("  phbErrorStatus:       %016llx\n", data->phbErrorStatus);
+       pr_info("  phbFirstErrorStatus:  %016llx\n", data->phbFirstErrorStatus);
+       pr_info("  phbErrorLog0:         %016llx\n", data->phbErrorLog0);
+       pr_info("  phbErrorLog1:         %016llx\n", data->phbErrorLog1);
+       pr_info("  mmioErrorStatus:      %016llx\n", data->mmioErrorStatus);
+       pr_info("  mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus);
+       pr_info("  mmioErrorLog0:        %016llx\n", data->mmioErrorLog0);
+       pr_info("  mmioErrorLog1:        %016llx\n", data->mmioErrorLog1);
+       pr_info("  dma0ErrorStatus:      %016llx\n", data->dma0ErrorStatus);
+       pr_info("  dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus);
+       pr_info("  dma0ErrorLog0:        %016llx\n", data->dma0ErrorLog0);
+       pr_info("  dma0ErrorLog1:        %016llx\n", data->dma0ErrorLog1);
+       pr_info("  dma1ErrorStatus:      %016llx\n", data->dma1ErrorStatus);
+       pr_info("  dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus);
+       pr_info("  dma1ErrorLog0:        %016llx\n", data->dma1ErrorLog0);
+       pr_info("  dma1ErrorLog1:        %016llx\n", data->dma1ErrorLog1);
+
+       for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) {
+               if ((data->pestA[i] >> 63) == 0 &&
+                   (data->pestB[i] >> 63) == 0)
+                       continue;
+
+               pr_info("  PE[%3d] PESTA:        %016llx\n", i, data->pestA[i]);
+               pr_info("          PESTB:        %016llx\n", data->pestB[i]);
        }
 }
 
-static void pnv_pci_dump_phb_diag_data(struct pnv_phb *phb)
+void pnv_pci_dump_phb_diag_data(struct pci_controller *hose,
+                               unsigned char *log_buff)
 {
-       switch(phb->model) {
-       case PNV_PHB_MODEL_P7IOC:
-               pnv_pci_dump_p7ioc_diag_data(phb);
+       struct OpalIoPhbErrorCommon *common;
+
+       if (!hose || !log_buff)
+               return;
+
+       common = (struct OpalIoPhbErrorCommon *)log_buff;
+       switch (common->ioType) {
+       case OPAL_PHB_ERROR_DATA_TYPE_P7IOC:
+               pnv_pci_dump_p7ioc_diag_data(hose, common);
+               break;
+       case OPAL_PHB_ERROR_DATA_TYPE_PHB3:
+               pnv_pci_dump_phb3_diag_data(hose, common);
                break;
        default:
-               pr_warning("PCI %d: Can't decode this PHB diag data\n",
-                          phb->hose->global_number);
+               pr_warn("%s: Unrecognized ioType %d\n",
+                       __func__, common->ioType);
        }
 }
 
@@ -222,7 +302,7 @@ static void pnv_pci_handle_eeh_config(struct pnv_phb *phb, u32 pe_no)
                 * with the normal errors generated when probing empty slots
                 */
                if (has_diag)
-                       pnv_pci_dump_phb_diag_data(phb);
+                       pnv_pci_dump_phb_diag_data(phb->hose, phb->diag.blob);
                else
                        pr_warning("PCI %d: No diag data available\n",
                                   phb->hose->global_number);
@@ -536,7 +616,7 @@ static void pnv_pci_dma_fallback_setup(struct pci_controller *hose,
                pdn->iommu_table = pnv_pci_setup_bml_iommu(hose);
        if (!pdn->iommu_table)
                return;
-       set_iommu_table_base(&pdev->dev, pdn->iommu_table);
+       set_iommu_table_base_and_group(&pdev->dev, pdn->iommu_table);
 }
 
 static void pnv_pci_dma_dev_setup(struct pci_dev *pdev)
@@ -657,3 +737,34 @@ void __init pnv_pci_init(void)
        ppc_md.teardown_msi_irqs = pnv_teardown_msi_irqs;
 #endif
 }
+
+static int tce_iommu_bus_notifier(struct notifier_block *nb,
+               unsigned long action, void *data)
+{
+       struct device *dev = data;
+
+       switch (action) {
+       case BUS_NOTIFY_ADD_DEVICE:
+               return iommu_add_device(dev);
+       case BUS_NOTIFY_DEL_DEVICE:
+               if (dev->iommu_group)
+                       iommu_del_device(dev);
+               return 0;
+       default:
+               return 0;
+       }
+}
+
+static struct notifier_block tce_iommu_bus_nb = {
+       .notifier_call = tce_iommu_bus_notifier,
+};
+
+static int __init tce_iommu_bus_notifier_init(void)
+{
+       BUILD_BUG_ON(PAGE_SIZE < IOMMU_PAGE_SIZE);
+
+       bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
+       return 0;
+}
+
+subsys_initcall_sync(tce_iommu_bus_notifier_init);
index 911c24ef033e0ae207036e5d5cab8bceaf07e14a..9a11ff0c5c0b4b65d461f0120cc88f6cf7a75589 100644 (file)
@@ -176,6 +176,7 @@ struct pnv_phb {
        union {
                unsigned char                   blob[PNV_PCI_DIAG_BUF_SIZE];
                struct OpalIoP7IOCPhbErrorData  p7ioc;
+               struct OpalIoPhb3ErrorData      phb3;
        } diag;
 };
 
@@ -184,6 +185,8 @@ extern struct pci_ops pnv_pci_ops;
 extern struct pnv_eeh_ops ioda_eeh_ops;
 #endif
 
+void pnv_pci_dump_phb_diag_data(struct pci_controller *hose,
+                               unsigned char *log_buff);
 int pnv_pci_cfg_read(struct device_node *dn,
                     int where, int size, u32 *val);
 int pnv_pci_cfg_write(struct device_node *dn,
index e17fa1432d80706ad9b5fa2682ea88751027c38a..a0bca05e26b0c7478c7483c43b2437fa0f6a61d7 100644 (file)
@@ -143,7 +143,7 @@ static void _dump_areas(unsigned int spe_id, unsigned long priv2,
        pr_debug("%s:%d: shadow:  %lxh\n", func, line, shadow);
 }
 
-inline u64 ps3_get_spe_id(void *arg)
+u64 ps3_get_spe_id(void *arg)
 {
        return spu_pdata(arg)->spe_id;
 }
index 62b4f8025de005ad77bdbfcd42024d25614eb79c..e66643250fee3eea1c2de2d832f9b3cbb0fc7632 100644 (file)
@@ -34,7 +34,7 @@ config PPC_SPLPAR
 
 config PSERIES_MSI
        bool
-       depends on PCI_MSI && EEH
+       depends on PCI_MSI && PPC_PSERIES && EEH
        default y
 
 config PSERIES_ENERGY
index f253361552aee3fbc3c98f077790f89551b4ea74..a80af6c20cba0899bcbdf5ff98587d3dfc724dc0 100644 (file)
@@ -687,7 +687,8 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
                iommu_table_setparms(phb, dn, tbl);
                PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node);
                iommu_register_group(tbl, pci_domain_nr(phb->bus), 0);
-               set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table);
+               set_iommu_table_base_and_group(&dev->dev,
+                                              PCI_DN(dn)->iommu_table);
                return;
        }
 
@@ -699,7 +700,8 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
                dn = dn->parent;
 
        if (dn && PCI_DN(dn))
-               set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table);
+               set_iommu_table_base_and_group(&dev->dev,
+                                              PCI_DN(dn)->iommu_table);
        else
                printk(KERN_WARNING "iommu: Device %s has no iommu table\n",
                       pci_name(dev));
@@ -1193,7 +1195,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
                pr_debug("  found DMA window, table: %p\n", pci->iommu_table);
        }
 
-       set_iommu_table_base(&dev->dev, pci->iommu_table);
+       set_iommu_table_base_and_group(&dev->dev, pci->iommu_table);
 }
 
 static int dma_set_mask_pSeriesLP(struct device *dev, u64 dma_mask)
index 4fca3def9db951896864d0b716d7dea8a2364ba2..b02af9ef3ff61ab45fb2ae86f2b49cdc6b5cc7ff 100644 (file)
@@ -92,7 +92,7 @@ void vpa_init(int cpu)
         * PAPR says this feature is SLB-Buffer but firmware never
         * reports that.  All SPLPAR support SLB shadow buffer.
         */
-       addr = __pa(&slb_shadow[cpu]);
+       addr = __pa(paca[cpu].slb_shadow_ptr);
        if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
                ret = register_slb_shadow(hwcpu, addr);
                if (ret)
@@ -153,7 +153,8 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
 
        /* Make pHyp happy */
        if ((rflags & _PAGE_NO_CACHE) && !(rflags & _PAGE_WRITETHRU))
-               hpte_r &= ~_PAGE_COHERENT;
+               hpte_r &= ~HPTE_R_M;
+
        if (firmware_has_feature(FW_FEATURE_XCMO) && !(hpte_r & HPTE_R_N))
                flags |= H_COALESCE_CAND;
 
index 13ec968be4c7a25ca79fc480a7aab26e514b3bb8..7baa70d6dc016c85b8e4874f7618dbf9145d30ac 100644 (file)
@@ -19,7 +19,7 @@ config PPC_MSI_BITMAP
        default y if MPIC
        default y if FSL_PCI
        default y if PPC4xx_MSI
-       default y if POWERNV_MSI
+       default y if PPC_POWERNV
 
 source "arch/powerpc/sysdev/xics/Kconfig"
 
index 4dfd61df8aba99a01fb0d3d141d1544aeea3b341..7066e52624686a2b1d472eaebefcc8fd3da55b16 100644 (file)
@@ -122,7 +122,7 @@ static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask)
         * address width of the SoC such that we can address any internal
         * SoC address from across PCI if needed
         */
-       if ((dev->bus == &pci_bus_type) &&
+       if ((dev_is_pci(dev)) &&
            dma_mask >= DMA_BIT_MASK(MAX_PHYS_ADDR_BITS)) {
                set_dma_ops(dev, &dma_direct_ops);
                set_dma_offset(dev, pci64_dma_offset);
index af9d3469fb9933e4f3d424f01e3230ddeb580c67..a90731b3d44a3ea41052690975aefcd8b3ce2db7 100644 (file)
@@ -2051,6 +2051,10 @@ static void dump_one_paca(int cpu)
        DUMP(p, stab_addr, "lx");
 #endif
        DUMP(p, emergency_sp, "p");
+#ifdef CONFIG_PPC_BOOK3S_64
+       DUMP(p, mc_emergency_sp, "p");
+       DUMP(p, in_mce, "x");
+#endif
        DUMP(p, data_offset, "lx");
        DUMP(p, hw_cpu_id, "x");
        DUMP(p, cpu_start, "x");
index 5877e71901b345ef191a911f9ad0ba537abd9c8c..1e1a03d2d19fbbb35804d4fc28d8d9eac355a9c4 100644 (file)
@@ -347,14 +347,14 @@ config SMP
          Even if you don't know what to do here, say Y.
 
 config NR_CPUS
-       int "Maximum number of CPUs (2-64)"
-       range 2 64
+       int "Maximum number of CPUs (2-256)"
+       range 2 256
        depends on SMP
        default "32" if !64BIT
        default "64" if 64BIT
        help
          This allows you to specify the maximum number of CPUs which this
-         kernel will support.  The maximum supported value is 64 and the
+         kernel will support. The maximum supported value is 256 and the
          minimum value which makes sense is 2.
 
          This is purely to save memory - each supported CPU adds
index 30ef748bc161eb3a7f52084ea763d54fe6ed09fc..2f390956c7c1c930722320956a54d1e65ada5673 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/types.h>
 #include <asm/chpid.h>
+#include <asm/cpu.h>
 
 #define SCLP_CHP_INFO_MASK_SIZE                32
 
@@ -37,7 +38,7 @@ struct sclp_cpu_info {
        unsigned int standby;
        unsigned int combined;
        int has_cpu_type;
-       struct sclp_cpu_entry cpu[255];
+       struct sclp_cpu_entry cpu[MAX_CPU_ADDRESS + 1];
 };
 
 int sclp_get_cpu_info(struct sclp_cpu_info *info);
index e83fc116f5bf2c24ceb4f4b9aa663d7d1c291b8f..fe94ea7c9fa0b554ac757fed5272de835ec158b1 100644 (file)
@@ -154,6 +154,46 @@ struct ica_xcRB {
        unsigned short  priority_window;
        unsigned int    status;
 } __attribute__((packed));
+
+/**
+ * EP11 CPRB
+ */
+struct ep11_cprb {
+       unsigned short  cprb_len;       /* CPRB header length     0x0020    */
+       unsigned char   cprb_ver_id;    /* CPRB version id.       0x04      */
+       unsigned char   pad_000[2];     /* Alignment pad bytes              */
+       unsigned char   flags;          /* Admin cmd 0x80 / func. cmd 0x00  */
+       unsigned char   func_id[2];     /* Function id / subtype  0x5434    */
+       unsigned int    source_id;      /* Source id [originator id]        */
+       unsigned int    target_id;      /* Target id [usage/ctrl domain id] */
+       unsigned int    ret_code;       /* Return code                      */
+       unsigned int    reserved1;      /* Reserved                         */
+       unsigned int    reserved2;      /* Reserved                         */
+       unsigned int    payload_len;    /* Payload length                   */
+} __attribute__((packed));
+
+/**
+ * EP11 target device
+ */
+struct ep11_target_dev {
+       short ap_id;    /* AP device id    */
+       short dom_id;   /* Usage domain id */
+};
+
+/**
+ * EP11 user request block
+ */
+struct ep11_urb {
+       short                   targets_num;    /* Number of target adapters */
+       struct target_list      *targets;       /* Target adapter list       */
+       unsigned long           weight;         /* Level of request priority */
+       unsigned long           req_no;         /* Request id/number         */
+       unsigned long           req_len;        /* Request length            */
+       char __user             *req;           /* Pointer to request block  */
+       unsigned long           resp_len;       /* Response length           */
+       char  __user            *resp;          /* Pointer to response block */
+} __attribute__((packed));
+
 #define AUTOSELECT ((unsigned int)0xFFFFFFFF)
 
 #define ZCRYPT_IOCTL_MAGIC 'z'
@@ -183,6 +223,9 @@ struct ica_xcRB {
  *   ZSECSENDCPRB
  *     Send an arbitrary CPRB to a crypto card.
  *
+ *   ZSENDEP11CPRB
+ *     Send an arbitrary EP11 CPRB to an EP11 coprocessor crypto card.
+ *
  *   Z90STAT_STATUS_MASK
  *     Return an 64 element array of unsigned chars for the status of
  *     all devices.
@@ -256,6 +299,7 @@ struct ica_xcRB {
 #define ICARSAMODEXPO  _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x05, 0)
 #define ICARSACRT      _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0)
 #define ZSECSENDCPRB   _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x81, 0)
+#define ZSENDEP11CPRB  _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x04, 0)
 
 /* New status calls */
 #define Z90STAT_TOTALCOUNT     _IOR(ZCRYPT_IOCTL_MAGIC, 0x40, int)
index 496116cd65ec8ef3a1b566ac8c1c0641dfcad5f4..e4c99a1836511b16b90de5b4591bea5dc9fc8e69 100644 (file)
@@ -72,6 +72,7 @@ int main(void)
        /* constants used by the vdso */
        DEFINE(__CLOCK_REALTIME, CLOCK_REALTIME);
        DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC);
+       DEFINE(__CLOCK_THREAD_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID);
        DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
        BLANK();
        /* idle data offsets */
index a84476f2a9bb3ae488eb7a936021a744a822dd31..613649096783401e0cf9acf73069dff48a35e438 100644 (file)
@@ -125,7 +125,7 @@ int vdso_alloc_per_cpu(struct _lowcore *lowcore)
                psal[i] = 0x80000000;
 
        lowcore->paste[4] = (u32)(addr_t) psal;
-       psal[0] = 0x20000000;
+       psal[0] = 0x02000000;
        psal[2] = (u32)(addr_t) aste;
        *(unsigned long *) (aste + 2) = segment_table +
                _ASCE_TABLE_LENGTH + _ASCE_USER_BITS + _ASCE_TYPE_SEGMENT;
index 5be8e472f57d1d0debe31c849b4177492380d957..65fc3979c2f11bb037fd7f646c18a1188b4c4553 100644 (file)
@@ -46,18 +46,13 @@ __kernel_clock_gettime:
        jnm     3f
        a       %r0,__VDSO_TK_MULT(%r5)
 3:     alr     %r0,%r2
-       al      %r0,__VDSO_XTIME_NSEC(%r5)      /*  + tk->xtime_nsec */
-       al      %r1,__VDSO_XTIME_NSEC+4(%r5)
-       brc     12,4f
-       ahi     %r0,1
-4:     al      %r0,__VDSO_WTOM_NSEC(%r5)       /*  + wall_to_monotonic.nsec */
+       al      %r0,__VDSO_WTOM_NSEC(%r5)
        al      %r1,__VDSO_WTOM_NSEC+4(%r5)
        brc     12,5f
        ahi     %r0,1
 5:     l       %r2,__VDSO_TK_SHIFT(%r5)        /* Timekeeper shift */
        srdl    %r0,0(%r2)                      /*  >> tk->shift */
-       l       %r2,__VDSO_XTIME_SEC+4(%r5)
-       al      %r2,__VDSO_WTOM_SEC+4(%r5)
+       l       %r2,__VDSO_WTOM_SEC+4(%r5)
        cl      %r4,__VDSO_UPD_COUNT+4(%r5)     /* check update counter */
        jne     1b
        basr    %r5,0
index 176e1f75f9aa6c1554dbf0818b7d4cd6661c0846..34deba7c7ed1d8b18036b0b07f9b7cd9d41e9259 100644 (file)
@@ -23,7 +23,9 @@ __kernel_clock_getres:
        je      0f
        cghi    %r2,__CLOCK_MONOTONIC
        je      0f
-       cghi    %r2,-2          /* CLOCK_THREAD_CPUTIME_ID for this thread */
+       cghi    %r2,__CLOCK_THREAD_CPUTIME_ID
+       je      0f
+       cghi    %r2,-2          /* Per-thread CPUCLOCK with PID=0, VIRT=1 */
        jne     2f
        larl    %r5,_vdso_data
        icm     %r0,15,__LC_ECTG_OK(%r5)
index 0add1072ba306623665148816155f951f0baeeda..91940ed33a4ab21686f890481545cbfdd9404468 100644 (file)
@@ -22,7 +22,9 @@ __kernel_clock_gettime:
        larl    %r5,_vdso_data
        cghi    %r2,__CLOCK_REALTIME
        je      4f
-       cghi    %r2,-2          /* CLOCK_THREAD_CPUTIME_ID for this thread */
+       cghi    %r2,__CLOCK_THREAD_CPUTIME_ID
+       je      9f
+       cghi    %r2,-2          /* Per-thread CPUCLOCK with PID=0, VIRT=1 */
        je      9f
        cghi    %r2,__CLOCK_MONOTONIC
        jne     12f
@@ -35,13 +37,11 @@ __kernel_clock_gettime:
        jnz     0b
        stck    48(%r15)                        /* Store TOD clock */
        lgf     %r2,__VDSO_TK_SHIFT(%r5)        /* Timekeeper shift */
-       lg      %r0,__VDSO_XTIME_SEC(%r5)       /* tk->xtime_sec */
-       alg     %r0,__VDSO_WTOM_SEC(%r5)        /*  + wall_to_monotonic.sec */
+       lg      %r0,__VDSO_WTOM_SEC(%r5)
        lg      %r1,48(%r15)
        sg      %r1,__VDSO_XTIME_STAMP(%r5)     /* TOD - cycle_last */
        msgf    %r1,__VDSO_TK_MULT(%r5)         /*  * tk->mult */
-       alg     %r1,__VDSO_XTIME_NSEC(%r5)      /*  + tk->xtime_nsec */
-       alg     %r1,__VDSO_WTOM_NSEC(%r5)       /*  + wall_to_monotonic.nsec */
+       alg     %r1,__VDSO_WTOM_NSEC(%r5)
        srlg    %r1,%r1,0(%r2)                  /*  >> tk->shift */
        clg     %r4,__VDSO_UPD_COUNT(%r5)       /* check update counter */
        jne     0b
index ec9ad593c3da743bacbd5875a577709a94e3333b..01a38696137e9952c9e07f91669685b3b349b50d 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/kdebug.h>
 #include <linux/types.h>
+#include <cpu/ubc.h>
 
 struct arch_hw_breakpoint {
        char            *name; /* Contains name of the symbol to set bkpt */
@@ -15,17 +16,6 @@ struct arch_hw_breakpoint {
        u16             type;
 };
 
-enum {
-       SH_BREAKPOINT_READ      = (1 << 1),
-       SH_BREAKPOINT_WRITE     = (1 << 2),
-       SH_BREAKPOINT_RW        = SH_BREAKPOINT_READ | SH_BREAKPOINT_WRITE,
-
-       SH_BREAKPOINT_LEN_1     = (1 << 12),
-       SH_BREAKPOINT_LEN_2     = (1 << 13),
-       SH_BREAKPOINT_LEN_4     = SH_BREAKPOINT_LEN_1 | SH_BREAKPOINT_LEN_2,
-       SH_BREAKPOINT_LEN_8     = (1 << 14),
-};
-
 struct sh_ubc {
        const char      *name;
        unsigned int    num_events;
diff --git a/arch/sh/include/cpu-common/cpu/ubc.h b/arch/sh/include/cpu-common/cpu/ubc.h
new file mode 100644 (file)
index 0000000..b604619
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef __ARCH_SH_CPU_UBC_H__
+#define __ARCH_SH_CPU_UBC_H__
+
+enum {
+       SH_BREAKPOINT_READ      = (1 << 1),
+       SH_BREAKPOINT_WRITE     = (1 << 2),
+       SH_BREAKPOINT_RW        = SH_BREAKPOINT_READ | SH_BREAKPOINT_WRITE,
+
+       SH_BREAKPOINT_LEN_1     = (1 << 12),
+       SH_BREAKPOINT_LEN_2     = (1 << 13),
+       SH_BREAKPOINT_LEN_4     = SH_BREAKPOINT_LEN_1 | SH_BREAKPOINT_LEN_2,
+       SH_BREAKPOINT_LEN_8     = (1 << 14),
+};
+
+#define UBC_64BIT      1
+
+#endif /* __ARCH_SH_CPU_UBC_H__ */
diff --git a/arch/sh/include/cpu-sh2a/cpu/ubc.h b/arch/sh/include/cpu-sh2a/cpu/ubc.h
new file mode 100644 (file)
index 0000000..3371f90
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef __ARCH_SH_CPU_UBC_H__
+#define __ARCH_SH_CPU_UBC_H__
+
+enum {
+       SH_BREAKPOINT_READ      = (1 << 2),
+       SH_BREAKPOINT_WRITE     = (1 << 3),
+       SH_BREAKPOINT_RW        = SH_BREAKPOINT_READ | SH_BREAKPOINT_WRITE,
+
+       SH_BREAKPOINT_LEN_1     = (1 << 0),
+       SH_BREAKPOINT_LEN_2     = (1 << 1),
+       SH_BREAKPOINT_LEN_4     = SH_BREAKPOINT_LEN_1 | SH_BREAKPOINT_LEN_2,
+};
+
+#endif /* __ARCH_SH_CPU_UBC_H__ */
index 990195d9845607bfcca4a8b3cfcd05c41df582bc..92f0da4c86a7533e18269e6f5d439130e1a71815 100644 (file)
@@ -22,3 +22,4 @@ pinmux-$(CONFIG_CPU_SUBTYPE_SH7264)   := pinmux-sh7264.o
 pinmux-$(CONFIG_CPU_SUBTYPE_SH7269)    := pinmux-sh7269.o
 
 obj-$(CONFIG_GPIOLIB)                  += $(pinmux-y)
+obj-$(CONFIG_HAVE_HW_BREAKPOINT)       += ubc.o
diff --git a/arch/sh/kernel/cpu/sh2a/ubc.c b/arch/sh/kernel/cpu/sh2a/ubc.c
new file mode 100644 (file)
index 0000000..ef95a9b
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * arch/sh/kernel/cpu/sh2a/ubc.c
+ *
+ * On-chip UBC support for SH-2A CPUs.
+ *
+ * Copyright (C) 2009 - 2010  Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/init.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <asm/hw_breakpoint.h>
+
+#define UBC_BAR(idx)   (0xfffc0400 + (0x10 * idx))
+#define UBC_BAMR(idx)  (0xfffc0404 + (0x10 * idx))
+#define UBC_BBR(idx)   (0xfffc04A0 + (0x10 * idx))
+#define UBC_BDR(idx)   (0xfffc0408 + (0x10 * idx))
+#define UBC_BDMR(idx)  (0xfffc040C + (0x10 * idx))
+
+#define UBC_BRCR       0xfffc04C0
+
+/* BBR */
+#define UBC_BBR_UBID   (1 << 13)     /* User Break Interrupt Disable */
+#define UBC_BBR_DBE    (1 << 12)     /* Data Break Enable */
+#define UBC_BBR_CD_C   (1 << 6)      /* C Bus Cycle */
+#define UBC_BBR_CD_I   (2 << 6)      /* I Bus Cycle */
+#define UBC_BBR_ID_I   (1 << 4)      /* Break Condition is instruction fetch cycle */
+#define UBC_BBR_ID_D   (2 << 4)      /* Break Condition is data access cycle */
+#define UBC_BBR_ID_ID  (3 << 4)      /* Break Condition is instruction fetch or data access cycle */
+
+#define UBC_CRR_BIE    (1 << 0)
+
+/* CBR */
+#define UBC_CBR_CE     (1 << 0)
+
+static struct sh_ubc sh2a_ubc;
+
+static void sh2a_ubc_enable(struct arch_hw_breakpoint *info, int idx)
+{
+       __raw_writel(UBC_BBR_DBE | UBC_BBR_CD_C | UBC_BBR_ID_ID |
+                    info->len | info->type, UBC_BBR(idx));
+       __raw_writel(info->address, UBC_BAR(idx));
+}
+
+static void sh2a_ubc_disable(struct arch_hw_breakpoint *info, int idx)
+{
+       __raw_writel(UBC_BBR_UBID, UBC_BBR(idx));
+       __raw_writel(0, UBC_BAR(idx));
+}
+
+static void sh2a_ubc_enable_all(unsigned long mask)
+{
+       int i;
+
+       for (i = 0; i < sh2a_ubc.num_events; i++)
+               if (mask & (1 << i))
+                       __raw_writel(__raw_readl(UBC_BBR(i)) & ~UBC_BBR_UBID,
+                                    UBC_BBR(i));
+}
+
+static void sh2a_ubc_disable_all(void)
+{
+       int i;
+       
+       for (i = 0; i < sh2a_ubc.num_events; i++)
+               __raw_writel(__raw_readl(UBC_BBR(i)) | UBC_BBR_UBID,
+                            UBC_BBR(i));
+}
+
+static unsigned long sh2a_ubc_active_mask(void)
+{
+       unsigned long active = 0;
+       int i;
+
+       for (i = 0; i < sh2a_ubc.num_events; i++)
+               if (!(__raw_readl(UBC_BBR(i)) & UBC_BBR_UBID))
+                       active |= (1 << i);
+
+       return active;
+}
+
+static unsigned long sh2a_ubc_triggered_mask(void)
+{
+       unsigned int ret, mask;
+       
+       mask = 0;
+       ret = __raw_readl(UBC_BRCR);
+       if ((ret & (1 << 15)) || (ret & (1 << 13))) {
+               mask |= (1 << 0); /* Match condition for channel 0 */
+       } else 
+               mask &= ~(1 << 0);
+       
+       if ((ret & (1 << 14)) || (ret & (1 << 12))) {
+               mask |= (1 << 1); /* Match condition for channel 1 */
+       } else 
+               mask &= ~(1 << 1);
+
+       return mask;
+}
+
+static void sh2a_ubc_clear_triggered_mask(unsigned long mask)
+{
+       if (mask & (1 << 0)) /* Channel 0 statisfied break condition */
+               __raw_writel(__raw_readl(UBC_BRCR) &
+                            ~((1 << 15) | (1 << 13)), UBC_BRCR);
+       
+       if (mask & (1 << 1)) /* Channel 1 statisfied break condition */
+               __raw_writel(__raw_readl(UBC_BRCR) &
+                            ~((1 << 14) | (1 << 12)), UBC_BRCR);
+}
+
+static struct sh_ubc sh2a_ubc = {
+       .name                   = "SH-2A",
+       .num_events             = 2,
+       .trap_nr                = 0x1e0,
+       .enable                 = sh2a_ubc_enable,
+       .disable                = sh2a_ubc_disable,
+       .enable_all             = sh2a_ubc_enable_all,
+       .disable_all            = sh2a_ubc_disable_all,
+       .active_mask            = sh2a_ubc_active_mask,
+       .triggered_mask         = sh2a_ubc_triggered_mask,
+       .clear_triggered_mask   = sh2a_ubc_clear_triggered_mask,
+};
+
+static int __init sh2a_ubc_init(void)
+{
+       struct clk *ubc_iclk = clk_get(NULL, "ubc0");
+       int i;
+
+       /*
+        * The UBC MSTP bit is optional, as not all platforms will have
+        * it. Just ignore it if we can't find it.
+        */
+       if (IS_ERR(ubc_iclk))
+               ubc_iclk = NULL;
+
+       clk_enable(ubc_iclk);
+
+       for (i = 0; i < sh2a_ubc.num_events; i++) {
+               __raw_writel(0, UBC_BAMR(i));
+               __raw_writel(0, UBC_BBR(i));
+       }
+
+       clk_disable(ubc_iclk);
+
+       sh2a_ubc.clk = ubc_iclk;
+
+       return register_sh_ubc(&sh2a_ubc);
+}
+arch_initcall(sh2a_ubc_init);
index f9173766ec4be2393e4207efe7092741f35fc271..ac4922ad3c148d3fc0883afe9ccb8a50d078fc76 100644 (file)
@@ -113,9 +113,11 @@ static int get_hbp_len(u16 hbp_len)
        case SH_BREAKPOINT_LEN_4:
                len_in_bytes = 4;
                break;
+#ifdef UBC_64BIT
        case SH_BREAKPOINT_LEN_8:
                len_in_bytes = 8;
                break;
+#endif
        }
        return len_in_bytes;
 }
@@ -149,9 +151,11 @@ int arch_bp_generic_fields(int sh_len, int sh_type,
        case SH_BREAKPOINT_LEN_4:
                *gen_len = HW_BREAKPOINT_LEN_4;
                break;
+#ifdef UBC_64BIT
        case SH_BREAKPOINT_LEN_8:
                *gen_len = HW_BREAKPOINT_LEN_8;
                break;
+#endif
        default:
                return -EINVAL;
        }
@@ -190,9 +194,11 @@ static int arch_build_bp_info(struct perf_event *bp)
        case HW_BREAKPOINT_LEN_4:
                info->len = SH_BREAKPOINT_LEN_4;
                break;
+#ifdef UBC_64BIT
        case HW_BREAKPOINT_LEN_8:
                info->len = SH_BREAKPOINT_LEN_8;
                break;
+#endif
        default:
                return -EINVAL;
        }
@@ -240,9 +246,11 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
        case SH_BREAKPOINT_LEN_4:
                align = 3;
                break;
+#ifdef UBC_64BIT
        case SH_BREAKPOINT_LEN_8:
                align = 7;
                break;
+#endif
        default:
                return ret;
        }
index 60b19f50c80a8f9d7f31b4b4105ed4fcded6a5ca..b45fe3fb4d2cfbc7999d34a1b25baf9bc0278c2e 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/kgdb.h>
 #include <linux/kdebug.h>
 #include <linux/ftrace.h>
+#include <linux/context_tracking.h>
 
 #include <asm/cacheflush.h>
 #include <asm/kdebug.h>
index 00c77cf78e9e1839973923076053fdf92d75a54e..ccbf857d1d558461eb59139784faa2d0f43cabc9 100644 (file)
@@ -21,9 +21,7 @@
 #include <asm/apic.h>
 #include <asm/ipi.h>
 
-#ifdef CONFIG_ACPI
-#include <acpi/acpi_bus.h>
-#endif
+#include <linux/acpi.h>
 
 static struct apic apic_physflat;
 static struct apic apic_flat;
index e63a5bd2a78f55de2c356b665751558a73bc18da..4d67a7531d4558c6016c9a6e1f16dc07b97205c2 100644 (file)
@@ -37,9 +37,6 @@
 #include <linux/kthread.h>
 #include <linux/jiffies.h>     /* time_after() */
 #include <linux/slab.h>
-#ifdef CONFIG_ACPI
-#include <acpi/acpi_bus.h>
-#endif
 #include <linux/bootmem.h>
 #include <linux/dmar.h>
 #include <linux/hpet.h>
index 5c90975cdf0f8242db167fa9c471c1ea2bf3e512..43984bc1665a917303ae574b27345138cc9560b6 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/rcupdate.h>
 #include <asm/e820.h>
 #include <asm/pci_x86.h>
-#include <acpi/acpi.h>
 
 /* Assume systems with more busses have correct MCFG */
 #define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG))
index 649a12befba92f399895b947cc779e0269ac750d..08e350e757dcd189c29e06d4d0b199a2cd920b9f 100644 (file)
@@ -15,8 +15,7 @@
 #include <linux/power_supply.h>
 #include <linux/olpc-ec.h>
 
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <asm/olpc.h>
 
 #define DRV_NAME                       "olpc-xo15-sci"
index 8d24dcb7cdac6df122e6779080b5e31b234a6ee5..70a160be3464aa0858e87d5c29816085308d1ef7 100644 (file)
@@ -9,7 +9,6 @@ config XTENSA
        select GENERIC_CLOCKEVENTS
        select VIRT_TO_BUS
        select GENERIC_IRQ_SHOW
-       select GENERIC_CPU_DEVICES
        select GENERIC_SCHED_CLOCK
        select MODULES_USE_ELF_RELA
        select GENERIC_PCI_IOMAP
@@ -19,6 +18,7 @@ config XTENSA
        select IRQ_DOMAIN
        select HAVE_OPROFILE
        select HAVE_FUNCTION_TRACER
+       select HAVE_IRQ_TIME_ACCOUNTING
        help
          Xtensa processors are 32-bit RISC machines designed by Tensilica
          primarily for embedded systems.  These processors are both
@@ -64,6 +64,9 @@ config MMU
 config VARIANT_IRQ_SWITCH
        def_bool n
 
+config MAY_HAVE_SMP
+       def_bool n
+
 menu "Processor type and features"
 
 choice
@@ -104,6 +107,48 @@ config XTENSA_UNALIGNED_USER
 
 source "kernel/Kconfig.preempt"
 
+config HAVE_SMP
+       bool "System Supports SMP (MX)"
+       depends on MAY_HAVE_SMP
+       select XTENSA_MX
+       help
+         This option is use to indicate that the system-on-a-chip (SOC)
+         supports Multiprocessing. Multiprocessor support implemented above
+         the CPU core definition and currently needs to be selected manually.
+
+         Multiprocessor support in implemented with external cache and
+         interrupt controlers.
+
+         The MX interrupt distributer adds Interprocessor Interrupts
+         and causes the IRQ numbers to be increased by 4 for devices
+         like the open cores ethernet driver and the serial interface.
+
+         You still have to select "Enable SMP" to enable SMP on this SOC.
+
+config SMP
+       bool "Enable Symmetric multi-processing support"
+       depends on HAVE_SMP
+       select USE_GENERIC_SMP_HELPERS
+       select GENERIC_SMP_IDLE_THREAD
+       help
+         Enabled SMP Software; allows more than one CPU/CORE
+         to be activated during startup.
+
+config NR_CPUS
+       depends on SMP
+       int "Maximum number of CPUs (2-32)"
+       range 2 32
+       default "4"
+
+config HOTPLUG_CPU
+       bool "Enable CPU hotplug support"
+       depends on SMP
+       help
+         Say Y here to allow turning CPUs off and on. CPUs can be
+         controlled through /sys/devices/system/cpu.
+
+         Say N if you want to disable CPU hotplug.
+
 config MATH_EMULATION
        bool "Math emulation"
        help
index 7eda6ecf7eef3652cbc096b7f4859b03a66996bd..b042c3f508e66908df6a6972f0fe8e1e955ba3cd 100644 (file)
@@ -26,7 +26,7 @@
        };
 
        pic: pic {
-               compatible = "xtensa,pic";
+               compatible = "cdns,xtensa-pic";
                /* one cell: internal irq number,
                 * two cells: second cell == 0: internal irq number
                 *            second cell == 1: external irq number
index 228d6aee3a16528f0e5972371e5a1fd6feac9a79..5851db291583face7d032c2929dd5c91b58204d6 100644 (file)
@@ -8,7 +8,6 @@ generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
 generic-y += fcntl.h
-generic-y += futex.h
 generic-y += hardirq.h
 generic-y += ioctl.h
 generic-y += irq_regs.h
index ef021677d536538c817021c89f0841ada0ed0c30..8e5e5c980a7a4b1b01708c8160e0559f5ad63963 100644 (file)
@@ -17,7 +17,9 @@
 #define wmb() mb()
 
 #ifdef CONFIG_SMP
-#error smp_* not defined
+#define smp_mb()       mb()
+#define smp_rmb()      rmb()
+#define smp_wmb()      wmb()
 #else
 #define smp_mb()       barrier()
 #define smp_rmb()      barrier()
index 84afe58d5d374bc7cc19f8d02dbcc279b3b0014a..7b6873ae84c295740d8183b52610ba0ce91aad91 100644 (file)
 #include <asm/processor.h>
 #include <asm/byteorder.h>
 
-#ifdef CONFIG_SMP
-# error SMP not supported on this architecture
-#endif
-
-#define smp_mb__before_clear_bit()     barrier()
-#define smp_mb__after_clear_bit()      barrier()
+#define smp_mb__before_clear_bit()     smp_mb()
+#define smp_mb__after_clear_bit()      smp_mb()
 
 #include <asm-generic/bitops/non-atomic.h>
 
index 127cd48883c4274526c63631b181bea6dc366941..555a98a1845363588ced5fd3ec26a2269846e3d8 100644 (file)
@@ -1,18 +1,14 @@
 /*
- * include/asm-xtensa/cacheflush.h
- *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * (C) 2001 - 2007 Tensilica Inc.
+ * (C) 2001 - 2013 Tensilica Inc.
  */
 
 #ifndef _XTENSA_CACHEFLUSH_H
 #define _XTENSA_CACHEFLUSH_H
 
-#ifdef __KERNEL__
-
 #include <linux/mm.h>
 #include <asm/processor.h>
 #include <asm/page.h>
@@ -51,7 +47,6 @@ extern void __invalidate_icache_page(unsigned long);
 extern void __invalidate_icache_range(unsigned long, unsigned long);
 extern void __invalidate_dcache_range(unsigned long, unsigned long);
 
-
 #if XCHAL_DCACHE_IS_WRITEBACK
 extern void __flush_invalidate_dcache_all(void);
 extern void __flush_dcache_page(unsigned long);
@@ -87,9 +82,22 @@ static inline void __invalidate_icache_page_alias(unsigned long virt,
  * (see also Documentation/cachetlb.txt)
  */
 
-#if (DCACHE_WAY_SIZE > PAGE_SIZE)
+#if (DCACHE_WAY_SIZE > PAGE_SIZE) || defined(CONFIG_SMP)
+
+#ifdef CONFIG_SMP
+void flush_cache_all(void);
+void flush_cache_range(struct vm_area_struct*, ulong, ulong);
+void flush_icache_range(unsigned long start, unsigned long end);
+void flush_cache_page(struct vm_area_struct*,
+                            unsigned long, unsigned long);
+#else
+#define flush_cache_all local_flush_cache_all
+#define flush_cache_range local_flush_cache_range
+#define flush_icache_range local_flush_icache_range
+#define flush_cache_page  local_flush_cache_page
+#endif
 
-#define flush_cache_all()                                              \
+#define local_flush_cache_all()                                                \
        do {                                                            \
                __flush_invalidate_dcache_all();                        \
                __invalidate_icache_all();                              \
@@ -103,9 +111,11 @@ static inline void __invalidate_icache_page_alias(unsigned long virt,
 
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
 extern void flush_dcache_page(struct page*);
-extern void flush_cache_range(struct vm_area_struct*, ulong, ulong);
-extern void flush_cache_page(struct vm_area_struct*,
-                            unsigned long, unsigned long);
+
+void local_flush_cache_range(struct vm_area_struct *vma,
+               unsigned long start, unsigned long end);
+void local_flush_cache_page(struct vm_area_struct *vma,
+               unsigned long address, unsigned long pfn);
 
 #else
 
@@ -119,13 +129,14 @@ extern void flush_cache_page(struct vm_area_struct*,
 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
 #define flush_dcache_page(page)                                do { } while (0)
 
-#define flush_cache_page(vma,addr,pfn)                 do { } while (0)
-#define flush_cache_range(vma,start,end)               do { } while (0)
+#define flush_icache_range local_flush_icache_range
+#define flush_cache_page(vma, addr, pfn)               do { } while (0)
+#define flush_cache_range(vma, start, end)             do { } while (0)
 
 #endif
 
 /* Ensure consistency between data and instruction cache. */
-#define flush_icache_range(start,end)                                  \
+#define local_flush_icache_range(start, end)                           \
        do {                                                            \
                __flush_dcache_range(start, (end) - (start));           \
                __invalidate_icache_range(start,(end) - (start));       \
@@ -253,5 +264,4 @@ static inline void flush_invalidate_dcache_unaligned(u32 addr, u32 size)
        }
 }
 
-#endif /* __KERNEL__ */
 #endif /* _XTENSA_CACHEFLUSH_H */
index 3899610c1dfff71a53e0144969fd990e59e75f62..742b89f3ca2cf22d535b21441383b97256bf5903 100644 (file)
@@ -19,9 +19,12 @@ extern unsigned long loops_per_jiffy;
 
 static inline void __delay(unsigned long loops)
 {
-       /* 2 cycles per loop. */
-       __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 2, 1b"
-                             : "=r" (loops) : "0" (loops));
+       if (__builtin_constant_p(loops) && loops < 2)
+               __asm__ __volatile__ ("nop");
+       else if (loops >= 2)
+               /* 2 cycles per loop. */
+               __asm__ __volatile__ ("1: addi %0, %0, -2; bgeui %0, 2, 1b"
+                               : "+r" (loops));
 }
 
 /* For SMP/NUMA systems, change boot_cpu_data to something like
index 73cc3f482304e35f9144d451e3fefab59fe8c6c0..736b9d214d8016012393c7914d03d89fb5eacfa6 100644 (file)
@@ -18,7 +18,7 @@
                __asm__ __volatile__ ( \
                        "mov %0, a0\n" \
                        "mov %1, a1\n" \
-                       : "=r"(a0), "=r"(a1) : : ); \
+                       : "=r"(a0), "=r"(a1)); \
                MAKE_PC_FROM_RA(a0, a1); })
 #ifdef CONFIG_FRAME_POINTER
 extern unsigned long return_address(unsigned level);
diff --git a/arch/xtensa/include/asm/futex.h b/arch/xtensa/include/asm/futex.h
new file mode 100644 (file)
index 0000000..b39531b
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * Atomic futex routines
+ *
+ * Based on the PowerPC implementataion
+ *
+ * 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.
+ *
+ * Copyright (C) 2013 TangoTec Ltd.
+ *
+ * Baruch Siach <baruch@tkos.co.il>
+ */
+
+#ifndef _ASM_XTENSA_FUTEX_H
+#define _ASM_XTENSA_FUTEX_H
+
+#ifdef __KERNEL__
+
+#include <linux/futex.h>
+#include <linux/uaccess.h>
+#include <linux/errno.h>
+
+#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
+       __asm__ __volatile(                             \
+       "1:     l32i    %0, %2, 0\n"                    \
+               insn "\n"                               \
+       "       wsr     %0, scompare1\n"                \
+       "2:     s32c1i  %1, %2, 0\n"                    \
+       "       bne     %1, %0, 1b\n"                   \
+       "       movi    %1, 0\n"                        \
+       "3:\n"                                          \
+       "       .section .fixup,\"ax\"\n"               \
+       "       .align 4\n"                             \
+       "4:     .long   3b\n"                           \
+       "5:     l32r    %0, 4b\n"                       \
+       "       movi    %1, %3\n"                       \
+       "       jx      %0\n"                           \
+       "       .previous\n"                            \
+       "       .section __ex_table,\"a\"\n"            \
+       "       .long 1b,5b,2b,5b\n"                    \
+       "       .previous\n"                            \
+       : "=&r" (oldval), "=&r" (ret)                   \
+       : "r" (uaddr), "I" (-EFAULT), "r" (oparg)       \
+       : "memory")
+
+static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
+{
+       int op = (encoded_op >> 28) & 7;
+       int cmp = (encoded_op >> 24) & 15;
+       int oparg = (encoded_op << 8) >> 20;
+       int cmparg = (encoded_op << 20) >> 20;
+       int oldval = 0, ret;
+       if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
+               oparg = 1 << oparg;
+
+       if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
+               return -EFAULT;
+
+#if !XCHAL_HAVE_S32C1I
+       return -ENOSYS;
+#endif
+
+       pagefault_disable();
+
+       switch (op) {
+       case FUTEX_OP_SET:
+               __futex_atomic_op("mov %1, %4", ret, oldval, uaddr, oparg);
+               break;
+       case FUTEX_OP_ADD:
+               __futex_atomic_op("add %1, %0, %4", ret, oldval, uaddr,
+                               oparg);
+               break;
+       case FUTEX_OP_OR:
+               __futex_atomic_op("or %1, %0, %4", ret, oldval, uaddr,
+                               oparg);
+               break;
+       case FUTEX_OP_ANDN:
+               __futex_atomic_op("and %1, %0, %4", ret, oldval, uaddr,
+                               ~oparg);
+               break;
+       case FUTEX_OP_XOR:
+               __futex_atomic_op("xor %1, %0, %4", ret, oldval, uaddr,
+                               oparg);
+               break;
+       default:
+               ret = -ENOSYS;
+       }
+
+       pagefault_enable();
+
+       if (ret)
+               return ret;
+
+       switch (cmp) {
+       case FUTEX_OP_CMP_EQ: return (oldval == cmparg);
+       case FUTEX_OP_CMP_NE: return (oldval != cmparg);
+       case FUTEX_OP_CMP_LT: return (oldval < cmparg);
+       case FUTEX_OP_CMP_GE: return (oldval >= cmparg);
+       case FUTEX_OP_CMP_LE: return (oldval <= cmparg);
+       case FUTEX_OP_CMP_GT: return (oldval > cmparg);
+       }
+
+       return -ENOSYS;
+}
+
+static inline int
+futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
+                             u32 oldval, u32 newval)
+{
+       int ret = 0;
+       u32 prev;
+
+       if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
+               return -EFAULT;
+
+#if !XCHAL_HAVE_S32C1I
+       return -ENOSYS;
+#endif
+
+       __asm__ __volatile__ (
+       "       # futex_atomic_cmpxchg_inatomic\n"
+       "1:     l32i    %1, %3, 0\n"
+       "       mov     %0, %5\n"
+       "       wsr     %1, scompare1\n"
+       "2:     s32c1i  %0, %3, 0\n"
+       "3:\n"
+       "       .section .fixup,\"ax\"\n"
+       "       .align 4\n"
+       "4:     .long   3b\n"
+       "5:     l32r    %1, 4b\n"
+       "       movi    %0, %6\n"
+       "       jx      %1\n"
+       "       .previous\n"
+       "       .section __ex_table,\"a\"\n"
+       "       .long 1b,5b,2b,5b\n"
+       "       .previous\n"
+       : "+r" (ret), "=&r" (prev), "+m" (*uaddr)
+       : "r" (uaddr), "r" (oldval), "r" (newval), "I" (-EFAULT)
+       : "memory");
+
+       *uval = prev;
+       return ret;
+}
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_XTENSA_FUTEX_H */
index 4c0ccc9c4f4c0adf0a8ac6212818567749147fed..f71f88ea7646dcc798067e984dddefa8a659037d 100644 (file)
@@ -43,5 +43,14 @@ static __inline__ int irq_canonicalize(int irq)
 }
 
 struct irqaction;
+struct irq_domain;
+
+void migrate_irqs(void);
+int xtensa_irq_domain_xlate(const u32 *intspec, unsigned int intsize,
+               unsigned long int_irq, unsigned long ext_irq,
+               unsigned long *out_hwirq, unsigned int *out_type);
+int xtensa_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw);
+unsigned xtensa_map_ext_irq(unsigned ext_irq);
+unsigned xtensa_get_ext_irq_no(unsigned irq);
 
 #endif /* _XTENSA_IRQ_H */
index 8554b2c8b17a0128bc873f2d67b194462f89c2bf..71afe418d0e53e2d9239b261cd34a2efc8d4f9ac 100644 (file)
@@ -1,11 +1,9 @@
 /*
- * include/asm-xtensa/mmu.h
- *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
+ * Copyright (C) 2001 - 2013 Tensilica Inc.
  */
 
 #ifndef _XTENSA_MMU_H
 #include <asm-generic/mmu.h>
 #else
 
-/* Default "unsigned long" context */
-typedef unsigned long mm_context_t;
+typedef struct {
+       unsigned long asid[NR_CPUS];
+       unsigned int cpu;
+} mm_context_t;
 
 #endif /* CONFIG_MMU */
 #endif /* _XTENSA_MMU_H */
index d43525a286bbf248b43e36fb878f6ee7fb31fa1e..d33c71a8c9ec69285fc508e653a0acfee3a691fa 100644 (file)
@@ -1,13 +1,11 @@
 /*
- * include/asm-xtensa/mmu_context.h
- *
  * Switch an MMU context.
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
+ * Copyright (C) 2001 - 2013 Tensilica Inc.
  */
 
 #ifndef _XTENSA_MMU_CONTEXT_H
 #include <linux/stringify.h>
 #include <linux/sched.h>
 
-#include <variant/core.h>
+#include <asm/vectors.h>
 
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 #include <asm-generic/mm_hooks.h>
+#include <asm-generic/percpu.h>
 
 #if (XCHAL_HAVE_TLBS != 1)
 # error "Linux must have an MMU!"
 #endif
 
-extern unsigned long asid_cache;
+DECLARE_PER_CPU(unsigned long, asid_cache);
+#define cpu_asid_cache(cpu) per_cpu(asid_cache, cpu)
 
 /*
  * NO_CONTEXT is the invalid ASID value that we don't ever assign to
- * any user or kernel context.
+ * any user or kernel context.  We use the reserved values in the
+ * ASID_INSERT macro below.
  *
  * 0 invalid
  * 1 kernel
@@ -49,6 +50,12 @@ extern unsigned long asid_cache;
 #define ASID_MASK      ((1 << XCHAL_MMU_ASID_BITS) - 1)
 #define ASID_INSERT(x) (0x03020001 | (((x) & ASID_MASK) << 8))
 
+#ifdef CONFIG_MMU
+void init_mmu(void);
+#else
+static inline void init_mmu(void) { }
+#endif
+
 static inline void set_rasid_register (unsigned long val)
 {
        __asm__ __volatile__ (" wsr %0, rasid\n\t"
@@ -62,64 +69,77 @@ static inline unsigned long get_rasid_register (void)
        return tmp;
 }
 
-static inline void
-__get_new_mmu_context(struct mm_struct *mm)
+static inline void get_new_mmu_context(struct mm_struct *mm, unsigned int cpu)
 {
-       extern void flush_tlb_all(void);
-       if (! (++asid_cache & ASID_MASK) ) {
-               flush_tlb_all(); /* start new asid cycle */
-               asid_cache += ASID_USER_FIRST;
+       unsigned long asid = cpu_asid_cache(cpu);
+       if ((++asid & ASID_MASK) == 0) {
+               /*
+                * Start new asid cycle; continue counting with next
+                * incarnation bits; skipping over 0, 1, 2, 3.
+                */
+               local_flush_tlb_all();
+               asid += ASID_USER_FIRST;
        }
-       mm->context = asid_cache;
+       cpu_asid_cache(cpu) = asid;
+       mm->context.asid[cpu] = asid;
+       mm->context.cpu = cpu;
 }
 
-static inline void
-__load_mmu_context(struct mm_struct *mm)
+static inline void get_mmu_context(struct mm_struct *mm, unsigned int cpu)
 {
-       set_rasid_register(ASID_INSERT(mm->context));
+       /*
+        * Check if our ASID is of an older version and thus invalid.
+        */
+
+       if (mm) {
+               unsigned long asid = mm->context.asid[cpu];
+
+               if (asid == NO_CONTEXT ||
+                               ((asid ^ cpu_asid_cache(cpu)) & ~ASID_MASK))
+                       get_new_mmu_context(mm, cpu);
+       }
+}
+
+static inline void activate_context(struct mm_struct *mm, unsigned int cpu)
+{
+       get_mmu_context(mm, cpu);
+       set_rasid_register(ASID_INSERT(mm->context.asid[cpu]));
        invalidate_page_directory();
 }
 
 /*
  * Initialize the context related info for a new mm_struct
- * instance.
+ * instance.  Valid cpu values are 0..(NR_CPUS-1), so initializing
+ * to -1 says the process has never run on any core.
  */
 
-static inline int
-init_new_context(struct task_struct *tsk, struct mm_struct *mm)
+static inline int init_new_context(struct task_struct *tsk,
+               struct mm_struct *mm)
 {
-       mm->context = NO_CONTEXT;
+       int cpu;
+       for_each_possible_cpu(cpu) {
+               mm->context.asid[cpu] = NO_CONTEXT;
+       }
+       mm->context.cpu = -1;
        return 0;
 }
 
-/*
- * After we have set current->mm to a new value, this activates
- * the context for the new mm so we see the new mappings.
- */
-static inline void
-activate_mm(struct mm_struct *prev, struct mm_struct *next)
-{
-       /* Unconditionally get a new ASID.  */
-
-       __get_new_mmu_context(next);
-       __load_mmu_context(next);
-}
-
-
 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
                             struct task_struct *tsk)
 {
-       unsigned long asid = asid_cache;
-
-       /* Check if our ASID is of an older version and thus invalid */
-
-       if (next->context == NO_CONTEXT || ((next->context^asid) & ~ASID_MASK))
-               __get_new_mmu_context(next);
-
-       __load_mmu_context(next);
+       unsigned int cpu = smp_processor_id();
+       int migrated = next->context.cpu != cpu;
+       /* Flush the icache if we migrated to a new core. */
+       if (migrated) {
+               __invalidate_icache_all();
+               next->context.cpu = cpu;
+       }
+       if (migrated || prev != next)
+               activate_context(next, cpu);
 }
 
-#define deactivate_mm(tsk, mm) do { } while(0)
+#define activate_mm(prev, next)        switch_mm((prev), (next), NULL)
+#define deactivate_mm(tsk, mm) do { } while (0)
 
 /*
  * Destroy context related info for an mm_struct that is about
diff --git a/arch/xtensa/include/asm/mxregs.h b/arch/xtensa/include/asm/mxregs.h
new file mode 100644 (file)
index 0000000..73dcc54
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Xtensa MX interrupt distributor
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 - 2013 Tensilica Inc.
+ */
+
+#ifndef _XTENSA_MXREGS_H
+#define _XTENSA_MXREGS_H
+
+/*
+ * RER/WER at, as      Read/write external register
+ *     at: value
+ *     as: address
+ *
+ * Address     Value
+ * 00nn                0...0p..p       Interrupt Routing, route IRQ n to processor p
+ * 01pp                0...0d..d       16 bits (d) 'ored' as single IPI to processor p
+ * 0180                0...0m..m       Clear enable specified by mask (m)
+ * 0184                0...0m..m       Set enable specified by mask (m)
+ * 0190                0...0x..x       8-bit IPI partition register
+ *                             VVVVVVVVPPPPUUUUUUUUUUUUUUUUU
+ *                             V (10-bit) Release/Version
+ *                             P ( 4-bit) Number of cores - 1
+ *                             U (18-bit) ID
+ * 01a0                i.......i       32-bit ConfigID
+ * 0200                0...0m..m       RunStall core 'n'
+ * 0220                c               Cache coherency enabled
+ */
+
+#define MIROUT(irq)    (0x000 + (irq))
+#define MIPICAUSE(cpu) (0x100 + (cpu))
+#define MIPISET(cause) (0x140 + (cause))
+#define MIENG          0x180
+#define MIENGSET       0x184
+#define MIASG          0x188   /* Read Global Assert Register */
+#define MIASGSET       0x18c   /* Set Global Addert Regiter */
+#define MIPIPART       0x190
+#define SYSCFGID       0x1a0
+#define MPSCORE                0x200
+#define CCON           0x220
+
+#endif /* _XTENSA_MXREGS_H */
index 7e409a5b0ec50d8bf38848ff54b9ec4d058141dc..abb59708a3b75bf6ac8398be37e4fc90c349dff0 100644 (file)
@@ -191,5 +191,25 @@ extern unsigned long get_wchan(struct task_struct *p);
 #define set_sr(x,sr) ({unsigned int v=(unsigned int)x; WSR(v,sr);})
 #define get_sr(sr) ({unsigned int v; RSR(v,sr); v; })
 
+#ifndef XCHAL_HAVE_EXTERN_REGS
+#define XCHAL_HAVE_EXTERN_REGS 0
+#endif
+
+#if XCHAL_HAVE_EXTERN_REGS
+
+static inline void set_er(unsigned long value, unsigned long addr)
+{
+       asm volatile ("wer %0, %1" : : "a" (value), "a" (addr) : "memory");
+}
+
+static inline unsigned long get_er(unsigned long addr)
+{
+       register unsigned long value;
+       asm volatile ("rer %0, %1" : "=a" (value) : "a" (addr) : "memory");
+       return value;
+}
+
+#endif /* XCHAL_HAVE_EXTERN_REGS */
+
 #endif /* __ASSEMBLY__ */
 #endif /* _XTENSA_PROCESSOR_H */
index 81f31bc9dde0a857a95e9f794e09e84fa6f6c1d7..598e752dcbcd009392230869af2851afd14e4085 100644 (file)
@@ -59,9 +59,17 @@ struct pt_regs {
        (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
 # define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
 # define instruction_pointer(regs) ((regs)->pc)
+# define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
+                                              (regs)->areg[1]))
 
 # ifndef CONFIG_SMP
 #  define profile_pc(regs) instruction_pointer(regs)
+# else
+#  define profile_pc(regs)                                             \
+       ({                                                              \
+               in_lock_functions(instruction_pointer(regs)) ?          \
+               return_pointer(regs) : instruction_pointer(regs);       \
+       })
 # endif
 
 #define user_stack_pointer(regs) ((regs)->areg[1])
index 83c569e3bdbd23245dccf2e3ea7e92010589eafe..4e43f564389161687441c59168acb0e2f638b45b 100644 (file)
@@ -1,27 +1,43 @@
 /*
- * include/asm-xtensa/smp.h
- *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
+ * Copyright (C) 2001 - 2013 Tensilica Inc.
  */
 
 #ifndef _XTENSA_SMP_H
 #define _XTENSA_SMP_H
 
-extern struct xtensa_cpuinfo boot_cpu_data;
+#ifdef CONFIG_SMP
 
-#define cpu_data (&boot_cpu_data)
-#define current_cpu_data boot_cpu_data
+#define raw_smp_processor_id() (current_thread_info()->cpu)
+#define cpu_logical_map(cpu)   (cpu)
 
-struct xtensa_cpuinfo {
-       unsigned long   *pgd_cache;
-       unsigned long   *pte_cache;
-       unsigned long   pgtable_cache_sz;
+struct start_info {
+       unsigned long stack;
 };
+extern struct start_info start_info;
 
-#define cpu_logical_map(cpu)   (cpu)
+struct cpumask;
+void arch_send_call_function_ipi_mask(const struct cpumask *mask);
+void arch_send_call_function_single_ipi(int cpu);
+
+void smp_init_cpus(void);
+void secondary_init_irq(void);
+void ipi_init(void);
+struct seq_file;
+void show_ipi_list(struct seq_file *p, int prec);
+
+#ifdef CONFIG_HOTPLUG_CPU
+
+void __cpu_die(unsigned int cpu);
+int __cpu_disable(void);
+void cpu_die(void);
+void cpu_restart(void);
+
+#endif /* CONFIG_HOTPLUG_CPU */
+
+#endif /* CONFIG_SMP */
 
 #endif /* _XTENSA_SMP_H */
index 03975906b36fc34dc6a47abbe979c899ddc4f3e0..1d95fa5dcd10f0121f394e22fb108682c17741aa 100644 (file)
  *    1         somebody owns the spinlock
  */
 
-#define __raw_spin_is_locked(x) ((x)->slock != 0)
-#define __raw_spin_unlock_wait(lock) \
-       do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
+#define arch_spin_is_locked(x) ((x)->slock != 0)
+#define arch_spin_unlock_wait(lock) \
+       do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
 
-#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
+#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
 
-static inline void __raw_spin_lock(raw_spinlock_t *lock)
+static inline void arch_spin_lock(arch_spinlock_t *lock)
 {
        unsigned long tmp;
 
@@ -51,7 +51,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
 
 /* Returns 1 if the lock is obtained, 0 otherwise. */
 
-static inline int __raw_spin_trylock(raw_spinlock_t *lock)
+static inline int arch_spin_trylock(arch_spinlock_t *lock)
 {
        unsigned long tmp;
 
@@ -67,7 +67,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
        return tmp == 0 ? 1 : 0;
 }
 
-static inline void __raw_spin_unlock(raw_spinlock_t *lock)
+static inline void arch_spin_unlock(arch_spinlock_t *lock)
 {
        unsigned long tmp;
 
@@ -96,9 +96,9 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
  *  0x80000000  one writer owns the rwlock, no other writers, no readers
  */
 
-#define __raw_write_can_lock(x)  ((x)->lock == 0)
+#define arch_write_can_lock(x)  ((x)->lock == 0)
 
-static inline void __raw_write_lock(raw_rwlock_t *rw)
+static inline void arch_write_lock(arch_rwlock_t *rw)
 {
        unsigned long tmp;
 
@@ -116,7 +116,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
 
 /* Returns 1 if the lock is obtained, 0 otherwise. */
 
-static inline int __raw_write_trylock(raw_rwlock_t *rw)
+static inline int arch_write_trylock(arch_rwlock_t *rw)
 {
        unsigned long tmp;
 
@@ -133,7 +133,7 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
        return tmp == 0 ? 1 : 0;
 }
 
-static inline void __raw_write_unlock(raw_rwlock_t *rw)
+static inline void arch_write_unlock(arch_rwlock_t *rw)
 {
        unsigned long tmp;
 
@@ -145,7 +145,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
                        : "memory");
 }
 
-static inline void __raw_read_lock(raw_rwlock_t *rw)
+static inline void arch_read_lock(arch_rwlock_t *rw)
 {
        unsigned long tmp;
        unsigned long result;
@@ -164,7 +164,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
 
 /* Returns 1 if the lock is obtained, 0 otherwise. */
 
-static inline int __raw_read_trylock(raw_rwlock_t *rw)
+static inline int arch_read_trylock(arch_rwlock_t *rw)
 {
        unsigned long result;
        unsigned long tmp;
@@ -184,7 +184,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
        return result == 0;
 }
 
-static inline void __raw_read_unlock(raw_rwlock_t *rw)
+static inline void arch_read_unlock(arch_rwlock_t *rw)
 {
        unsigned long tmp1, tmp2;
 
@@ -199,4 +199,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
                        : "memory");
 }
 
+#define arch_read_lock_flags(lock, flags)      arch_read_lock(lock)
+#define arch_write_lock_flags(lock, flags)     arch_write_lock(lock)
+
 #endif /* _XTENSA_SPINLOCK_H */
diff --git a/arch/xtensa/include/asm/spinlock_types.h b/arch/xtensa/include/asm/spinlock_types.h
new file mode 100644 (file)
index 0000000..7ec5ce1
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef __ASM_SPINLOCK_TYPES_H
+#define __ASM_SPINLOCK_TYPES_H
+
+#ifndef __LINUX_SPINLOCK_TYPES_H
+# error "please don't include this file directly"
+#endif
+
+typedef struct {
+       volatile unsigned int slock;
+} arch_spinlock_t;
+
+#define __ARCH_SPIN_LOCK_UNLOCKED      { 0 }
+
+typedef struct {
+       volatile unsigned int lock;
+} arch_rwlock_t;
+
+#define __ARCH_RW_LOCK_UNLOCKED                { 0 }
+
+#endif
index 27fa3c1706623805168f6914f952d777993edbf2..ca929e6a38b5f70a5e1e2d1492b1cdde5e5f0e2a 100644 (file)
@@ -1,18 +1,14 @@
 /*
- * include/asm-xtensa/timex.h
- *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001 - 2008 Tensilica Inc.
+ * Copyright (C) 2001 - 2013 Tensilica Inc.
  */
 
 #ifndef _XTENSA_TIMEX_H
 #define _XTENSA_TIMEX_H
 
-#ifdef __KERNEL__
-
 #include <asm/processor.h>
 #include <linux/stringify.h>
 
@@ -39,14 +35,9 @@ extern unsigned long ccount_freq;
 
 typedef unsigned long long cycles_t;
 
-/*
- * Only used for SMP.
- */
-
-extern cycles_t cacheflush_time;
-
 #define get_cycles()   (0)
 
+void local_timer_setup(unsigned cpu);
 
 /*
  * Register access.
@@ -81,5 +72,4 @@ static inline void set_linux_timer (unsigned long ccompare)
        WSR_CCOMPARE(LINUX_TIMER, ccompare);
 }
 
-#endif /* __KERNEL__ */
 #endif /* _XTENSA_TIMEX_H */
index 43dd348a5a478d27daa70f2e8b019b8cfa0fcd22..fc34274ce41bc81b3ddaa167fe887179f04c8ad7 100644 (file)
@@ -1,18 +1,14 @@
 /*
- * include/asm-xtensa/tlbflush.h
- *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
+ * Copyright (C) 2001 - 2013 Tensilica Inc.
  */
 
 #ifndef _XTENSA_TLBFLUSH_H
 #define _XTENSA_TLBFLUSH_H
 
-#ifdef __KERNEL__
-
 #include <linux/stringify.h>
 #include <asm/processor.h>
 
  *  - flush_tlb_range(mm, start, end) flushes a range of pages
  */
 
-extern void flush_tlb_all(void);
-extern void flush_tlb_mm(struct mm_struct*);
-extern void flush_tlb_page(struct vm_area_struct*,unsigned long);
-extern void flush_tlb_range(struct vm_area_struct*,unsigned long,unsigned long);
+void local_flush_tlb_all(void);
+void local_flush_tlb_mm(struct mm_struct *mm);
+void local_flush_tlb_page(struct vm_area_struct *vma,
+               unsigned long page);
+void local_flush_tlb_range(struct vm_area_struct *vma,
+               unsigned long start, unsigned long end);
+
+#ifdef CONFIG_SMP
+
+void flush_tlb_all(void);
+void flush_tlb_mm(struct mm_struct *);
+void flush_tlb_page(struct vm_area_struct *, unsigned long);
+void flush_tlb_range(struct vm_area_struct *, unsigned long,
+               unsigned long);
+
+static inline void flush_tlb_kernel_range(unsigned long start,
+               unsigned long end)
+{
+       flush_tlb_all();
+}
+
+#else /* !CONFIG_SMP */
+
+#define flush_tlb_all()                           local_flush_tlb_all()
+#define flush_tlb_mm(mm)                  local_flush_tlb_mm(mm)
+#define flush_tlb_page(vma, page)         local_flush_tlb_page(vma, page)
+#define flush_tlb_range(vma, vmaddr, end)  local_flush_tlb_range(vma, vmaddr, \
+                                                                end)
+#define flush_tlb_kernel_range(start, end) local_flush_tlb_all()
 
-#define flush_tlb_kernel_range(start,end) flush_tlb_all()
+#endif /* CONFIG_SMP */
 
 /* TLB operations. */
 
@@ -187,5 +208,4 @@ static inline unsigned long read_itlb_translation (int way)
 }
 
 #endif /* __ASSEMBLY__ */
-#endif /* __KERNEL__ */
 #endif /* _XTENSA_TLBFLUSH_H */
index 917488a0ab00f12b9c49ac7e13b72ea5ea28eecb..8c194f6af45e09932976b3f71d8d70a8f556488f 100644 (file)
@@ -19,6 +19,7 @@
  */
 extern void * __init trap_set_handler(int cause, void *handler);
 extern void do_unhandled(struct pt_regs *regs, unsigned long exccause);
+void secondary_trap_init(void);
 
 static inline void spill_registers(void)
 {
index c52b656d0310cb994085844a9b90e32543b36d5b..37e073b21a50e7d0d713ca002fa745ebe3305349 100644 (file)
 
 #if defined(XCHAL_HAVE_PTP_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
   /* MMU v3  - XCHAL_HAVE_PTP_MMU  == 1 */
-  #define PHYSICAL_MEMORY_ADDRESS      0x00000000
   #define LOAD_MEMORY_ADDRESS          0x00003000
 #else
   /* MMU V2 -  XCHAL_HAVE_PTP_MMU  == 0 */
-  #define PHYSICAL_MEMORY_ADDRESS      0xD0000000
   #define LOAD_MEMORY_ADDRESS          0xD0003000
 #endif
 
@@ -46,7 +44,6 @@
 
   /* Location of the start of the kernel text, _start */
   #define KERNELOFFSET                 0x00003000
-  #define PHYSICAL_MEMORY_ADDRESS      0x00000000
 
   /* Loaded just above possibly live vectors */
   #define LOAD_MEMORY_ADDRESS          0x00003000
@@ -54,7 +51,6 @@
 #endif /* CONFIG_MMU */
 
 #define XC_VADDR(offset)               (VIRTUAL_MEMORY_ADDRESS  + offset)
-#define XC_PADDR(offset)               (PHYSICAL_MEMORY_ADDRESS + offset)
 
 /* Used to set VECBASE register */
 #define VECBASE_RESET_VADDR            VIRTUAL_MEMORY_ADDRESS
@@ -67,7 +63,7 @@
                                                VECBASE_RESET_VADDR)
 #define RESET_VECTOR1_VADDR            XC_VADDR(RESET_VECTOR1_VECOFS)
 
-#if XCHAL_HAVE_VECBASE
+#if defined(XCHAL_HAVE_VECBASE) && XCHAL_HAVE_VECBASE
 
 #define USER_VECTOR_VADDR              XC_VADDR(XCHAL_USER_VECOFS)
 #define KERNEL_VECTOR_VADDR            XC_VADDR(XCHAL_KERNEL_VECOFS)
 
 #define DEBUG_VECTOR_VADDR             XC_VADDR(XCHAL_DEBUG_VECOFS)
 
-#undef  XCHAL_NMI_VECTOR_VADDR
-#define XCHAL_NMI_VECTOR_VADDR         XC_VADDR(XCHAL_NMI_VECOFS)
+#define NMI_VECTOR_VADDR               XC_VADDR(XCHAL_NMI_VECOFS)
 
-#undef  XCHAL_INTLEVEL7_VECTOR_VADDR
-#define XCHAL_INTLEVEL7_VECTOR_VADDR   XC_VADDR(XCHAL_INTLEVEL7_VECOFS)
+#define INTLEVEL7_VECTOR_VADDR         XC_VADDR(XCHAL_INTLEVEL7_VECOFS)
 
 /*
  * These XCHAL_* #defines from varian/core.h
index f90265ec1ccca1bd5fed0849ffb708d6f7d965e8..18d962a8c0c2d1fccc5411fadbdc087bb5b05573 100644 (file)
@@ -12,6 +12,7 @@ obj-$(CONFIG_KGDB) += xtensa-stub.o
 obj-$(CONFIG_PCI) += pci.o
 obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o
 obj-$(CONFIG_FUNCTION_TRACER) += mcount.o
+obj-$(CONFIG_SMP) += smp.o mxhead.o
 
 AFLAGS_head.o += -mtext-section-literals
 
index 7d740ebbe198ec77a8011601f4172ebc809b9be8..aeeb3cc8a4109e59bc6ce5f23fd88c21c0450f3f 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/page.h>
 #include <asm/cacheasm.h>
 #include <asm/initialize_mmu.h>
+#include <asm/mxregs.h>
 
 #include <linux/init.h>
 #include <linux/linkage.h>
@@ -54,7 +55,7 @@ ENTRY(_start)
 
        /* Preserve the pointer to the boot parameter list in EXCSAVE_1 */
        wsr     a2, excsave1
-       _j      _SetupMMU
+       _j      _SetupOCD
 
        .align  4
        .literal_position
@@ -62,6 +63,23 @@ ENTRY(_start)
        .word   _startup
 
        .align  4
+_SetupOCD:
+       /*
+        * Initialize WB, WS, and clear PS.EXCM (to allow loop instructions).
+        * Set Interrupt Level just below XCHAL_DEBUGLEVEL to allow
+        * xt-gdb to single step via DEBUG exceptions received directly
+        * by ocd.
+        */
+       movi    a1, 1
+       movi    a0, 0
+       wsr     a1, windowstart
+       wsr     a0, windowbase
+       rsync
+
+       movi    a1, LOCKLEVEL
+       wsr     a1, ps
+       rsync
+
        .global _SetupMMU
 _SetupMMU:
        Offset = _SetupMMU - _start
@@ -85,24 +103,11 @@ _SetupMMU:
 
 ENDPROC(_start)
 
-       __INIT
+       __REF
        .literal_position
 
 ENTRY(_startup)
 
-       /* Disable interrupts and exceptions. */
-
-       movi    a0, LOCKLEVEL
-       wsr     a0, ps
-
-       /* Start with a fresh windowbase and windowstart.  */
-
-       movi    a1, 1
-       movi    a0, 0
-       wsr     a1, windowstart
-       wsr     a0, windowbase
-       rsync
-
        /* Set a0 to 0 for the remaining initialization. */
 
        movi    a0, 0
@@ -154,17 +159,6 @@ ENTRY(_startup)
        wsr     a0, cpenable
 #endif
 
-       /* Set PS.INTLEVEL=LOCKLEVEL, PS.WOE=0, kernel stack, PS.EXCM=0
-        *
-        * Note: PS.EXCM must be cleared before using any loop
-        *       instructions; otherwise, they are silently disabled, and
-        *       at most one iteration of the loop is executed.
-        */
-
-       movi    a1, LOCKLEVEL
-       wsr     a1, ps
-       rsync
-
        /*  Initialize the caches.
         *  a2, a3 are just working registers (clobbered).
         */
@@ -182,6 +176,37 @@ ENTRY(_startup)
 
        isync
 
+#ifdef CONFIG_HAVE_SMP
+       movi    a2, CCON        # MX External Register to Configure Cache
+       movi    a3, 1
+       wer     a3, a2
+#endif
+
+       /* Setup stack and enable window exceptions (keep irqs disabled) */
+
+       movi    a1, start_info
+       l32i    a1, a1, 0
+
+       movi    a2, (1 << PS_WOE_BIT) | LOCKLEVEL
+                                       # WOE=1, INTLEVEL=LOCKLEVEL, UM=0
+       wsr     a2, ps                  # (enable reg-windows; progmode stack)
+       rsync
+
+       /* Set up EXCSAVE[DEBUGLEVEL] to point to the Debug Exception Handler.*/
+
+       movi    a2, debug_exception
+       wsr     a2, SREG_EXCSAVE + XCHAL_DEBUGLEVEL
+
+#ifdef CONFIG_SMP
+       /*
+        * Notice that we assume with SMP that cores have PRID
+        * supported by the cores.
+        */
+       rsr     a2, prid
+       bnez    a2, .Lboot_secondary
+
+#endif  /* CONFIG_SMP */
+
        /* Unpack data sections
         *
         * The linker script used to build the Linux kernel image
@@ -234,24 +259,7 @@ ENTRY(_startup)
        ___invalidate_icache_all a2 a3
        isync
 
-       /* Setup stack and enable window exceptions (keep irqs disabled) */
-
-       movi    a1, init_thread_union
-       addi    a1, a1, KERNEL_STACK_SIZE
-
-       movi    a2, (1 << PS_WOE_BIT) | LOCKLEVEL
-                                       # WOE=1, INTLEVEL=LOCKLEVEL, UM=0
-       wsr     a2, ps                  # (enable reg-windows; progmode stack)
-       rsync
-
-       /* Set up EXCSAVE[DEBUGLEVEL] to point to the Debug Exception Handler.*/
-
-       movi    a2, debug_exception
-       wsr     a2, SREG_EXCSAVE + XCHAL_DEBUGLEVEL
-
-       /* Set up EXCSAVE[1] to point to the exc_table. */
-
-       movi    a6, exc_table
+       movi    a6, 0
        xsr     a6, excsave1
 
        /* init_arch kick-starts the linux kernel */
@@ -265,8 +273,93 @@ ENTRY(_startup)
 should_never_return:
        j       should_never_return
 
+#ifdef CONFIG_SMP
+.Lboot_secondary:
+
+       movi    a2, cpu_start_ccount
+1:
+       l32i    a3, a2, 0
+       beqi    a3, 0, 1b
+       movi    a3, 0
+       s32i    a3, a2, 0
+       memw
+1:
+       l32i    a3, a2, 0
+       beqi    a3, 0, 1b
+       wsr     a3, ccount
+       movi    a3, 0
+       s32i    a3, a2, 0
+       memw
+
+       movi    a6, 0
+       wsr     a6, excsave1
+
+       movi    a4, secondary_start_kernel
+       callx4  a4
+       j       should_never_return
+
+#endif  /* CONFIG_SMP */
+
 ENDPROC(_startup)
 
+#ifdef CONFIG_HOTPLUG_CPU
+
+ENTRY(cpu_restart)
+
+#if XCHAL_DCACHE_IS_WRITEBACK
+       ___flush_invalidate_dcache_all a2 a3
+#else
+       ___invalidate_dcache_all a2 a3
+#endif
+       memw
+       movi    a2, CCON        # MX External Register to Configure Cache
+       movi    a3, 0
+       wer     a3, a2
+       extw
+
+       rsr     a0, prid
+       neg     a2, a0
+       movi    a3, cpu_start_id
+       s32i    a2, a3, 0
+#if XCHAL_DCACHE_IS_WRITEBACK
+       dhwbi   a3, 0
+#endif
+1:
+       l32i    a2, a3, 0
+       dhi     a3, 0
+       bne     a2, a0, 1b
+
+       /*
+        * Initialize WB, WS, and clear PS.EXCM (to allow loop instructions).
+        * Set Interrupt Level just below XCHAL_DEBUGLEVEL to allow
+        * xt-gdb to single step via DEBUG exceptions received directly
+        * by ocd.
+        */
+       movi    a1, 1
+       movi    a0, 0
+       wsr     a1, windowstart
+       wsr     a0, windowbase
+       rsync
+
+       movi    a1, LOCKLEVEL
+       wsr     a1, ps
+       rsync
+
+       j       _startup
+
+ENDPROC(cpu_restart)
+
+#endif  /* CONFIG_HOTPLUG_CPU */
+
+/*
+ * DATA section
+ */
+
+        .section ".data.init.refok"
+        .align  4
+ENTRY(start_info)
+        .long   init_thread_union + KERNEL_STACK_SIZE
+
 /*
  * BSS section
  */
index 6f4f9749cff773f229a76a35bf50373ec18731ab..482868a2de6ebde7995002509445859bf7a002b0 100644 (file)
@@ -4,7 +4,7 @@
  * Xtensa built-in interrupt controller and some generic functions copied
  * from i386.
  *
- * Copyright (C) 2002 - 2006 Tensilica, Inc.
+ * Copyright (C) 2002 - 2013 Tensilica, Inc.
  * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
  *
  *
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/kernel_stat.h>
+#include <linux/irqchip.h>
+#include <linux/irqchip/xtensa-mx.h>
+#include <linux/irqchip/xtensa-pic.h>
 #include <linux/irqdomain.h>
 #include <linux/of.h>
 
+#include <asm/mxregs.h>
 #include <asm/uaccess.h>
 #include <asm/platform.h>
 
-static unsigned int cached_irq_mask;
-
 atomic_t irq_err_count;
 
-static struct irq_domain *root_domain;
-
-/*
- * do_IRQ handles all normal device IRQ's (the special
- * SMP cross-CPU interrupts have their own specific
- * handlers).
- */
-
 asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs)
 {
-       struct pt_regs *old_regs = set_irq_regs(regs);
-       int irq = irq_find_mapping(root_domain, hwirq);
+       int irq = irq_find_mapping(NULL, hwirq);
 
        if (hwirq >= NR_IRQS) {
                printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
                                __func__, hwirq);
        }
 
-       irq_enter();
-
 #ifdef CONFIG_DEBUG_STACKOVERFLOW
        /* Debugging check for stack overflow: is there less than 1KB free? */
        {
@@ -62,95 +53,69 @@ asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs)
        }
 #endif
        generic_handle_irq(irq);
-
-       irq_exit();
-       set_irq_regs(old_regs);
 }
 
 int arch_show_interrupts(struct seq_file *p, int prec)
 {
+#ifdef CONFIG_SMP
+       show_ipi_list(p, prec);
+#endif
        seq_printf(p, "%*s: ", prec, "ERR");
        seq_printf(p, "%10u\n", atomic_read(&irq_err_count));
        return 0;
 }
 
-static void xtensa_irq_mask(struct irq_data *d)
-{
-       cached_irq_mask &= ~(1 << d->hwirq);
-       set_sr (cached_irq_mask, intenable);
-}
-
-static void xtensa_irq_unmask(struct irq_data *d)
-{
-       cached_irq_mask |= 1 << d->hwirq;
-       set_sr (cached_irq_mask, intenable);
-}
-
-static void xtensa_irq_enable(struct irq_data *d)
-{
-       variant_irq_enable(d->hwirq);
-       xtensa_irq_unmask(d);
-}
-
-static void xtensa_irq_disable(struct irq_data *d)
-{
-       xtensa_irq_mask(d);
-       variant_irq_disable(d->hwirq);
-}
-
-static void xtensa_irq_ack(struct irq_data *d)
-{
-       set_sr(1 << d->hwirq, intclear);
-}
-
-static int xtensa_irq_retrigger(struct irq_data *d)
+int xtensa_irq_domain_xlate(const u32 *intspec, unsigned int intsize,
+               unsigned long int_irq, unsigned long ext_irq,
+               unsigned long *out_hwirq, unsigned int *out_type)
 {
-       set_sr(1 << d->hwirq, intset);
-       return 1;
+       if (WARN_ON(intsize < 1 || intsize > 2))
+               return -EINVAL;
+       if (intsize == 2 && intspec[1] == 1) {
+               int_irq = xtensa_map_ext_irq(ext_irq);
+               if (int_irq < XCHAL_NUM_INTERRUPTS)
+                       *out_hwirq = int_irq;
+               else
+                       return -EINVAL;
+       } else {
+               *out_hwirq = int_irq;
+       }
+       *out_type = IRQ_TYPE_NONE;
+       return 0;
 }
 
-static struct irq_chip xtensa_irq_chip = {
-       .name           = "xtensa",
-       .irq_enable     = xtensa_irq_enable,
-       .irq_disable    = xtensa_irq_disable,
-       .irq_mask       = xtensa_irq_mask,
-       .irq_unmask     = xtensa_irq_unmask,
-       .irq_ack        = xtensa_irq_ack,
-       .irq_retrigger  = xtensa_irq_retrigger,
-};
-
-static int xtensa_irq_map(struct irq_domain *d, unsigned int irq,
+int xtensa_irq_map(struct irq_domain *d, unsigned int irq,
                irq_hw_number_t hw)
 {
+       struct irq_chip *irq_chip = d->host_data;
        u32 mask = 1 << hw;
 
        if (mask & XCHAL_INTTYPE_MASK_SOFTWARE) {
-               irq_set_chip_and_handler_name(irq, &xtensa_irq_chip,
+               irq_set_chip_and_handler_name(irq, irq_chip,
                                handle_simple_irq, "level");
                irq_set_status_flags(irq, IRQ_LEVEL);
        } else if (mask & XCHAL_INTTYPE_MASK_EXTERN_EDGE) {
-               irq_set_chip_and_handler_name(irq, &xtensa_irq_chip,
+               irq_set_chip_and_handler_name(irq, irq_chip,
                                handle_edge_irq, "edge");
                irq_clear_status_flags(irq, IRQ_LEVEL);
        } else if (mask & XCHAL_INTTYPE_MASK_EXTERN_LEVEL) {
-               irq_set_chip_and_handler_name(irq, &xtensa_irq_chip,
+               irq_set_chip_and_handler_name(irq, irq_chip,
                                handle_level_irq, "level");
                irq_set_status_flags(irq, IRQ_LEVEL);
        } else if (mask & XCHAL_INTTYPE_MASK_TIMER) {
-               irq_set_chip_and_handler_name(irq, &xtensa_irq_chip,
-                               handle_edge_irq, "edge");
+               irq_set_chip_and_handler_name(irq, irq_chip,
+                               handle_percpu_irq, "timer");
                irq_clear_status_flags(irq, IRQ_LEVEL);
        } else {/* XCHAL_INTTYPE_MASK_WRITE_ERROR */
                /* XCHAL_INTTYPE_MASK_NMI */
-
-               irq_set_chip_and_handler_name(irq, &xtensa_irq_chip,
+               irq_set_chip_and_handler_name(irq, irq_chip,
                                handle_level_irq, "level");
                irq_set_status_flags(irq, IRQ_LEVEL);
        }
        return 0;
 }
 
-static unsigned map_ext_irq(unsigned ext_irq)
+unsigned xtensa_map_ext_irq(unsigned ext_irq)
 {
        unsigned mask = XCHAL_INTTYPE_MASK_EXTERN_EDGE |
                XCHAL_INTTYPE_MASK_EXTERN_LEVEL;
@@ -163,55 +128,77 @@ static unsigned map_ext_irq(unsigned ext_irq)
        return XCHAL_NUM_INTERRUPTS;
 }
 
-/*
- * Device Tree IRQ specifier translation function which works with one or
- * two cell bindings. First cell value maps directly to the hwirq number.
- * Second cell if present specifies whether hwirq number is external (1) or
- * internal (0).
- */
-int xtensa_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr,
-               const u32 *intspec, unsigned int intsize,
-               unsigned long *out_hwirq, unsigned int *out_type)
+unsigned xtensa_get_ext_irq_no(unsigned irq)
 {
-       if (WARN_ON(intsize < 1 || intsize > 2))
-               return -EINVAL;
-       if (intsize == 2 && intspec[1] == 1) {
-               unsigned int_irq = map_ext_irq(intspec[0]);
-               if (int_irq < XCHAL_NUM_INTERRUPTS)
-                       *out_hwirq = int_irq;
-               else
-                       return -EINVAL;
-       } else {
-               *out_hwirq = intspec[0];
-       }
-       *out_type = IRQ_TYPE_NONE;
-       return 0;
+       unsigned mask = (XCHAL_INTTYPE_MASK_EXTERN_EDGE |
+               XCHAL_INTTYPE_MASK_EXTERN_LEVEL) &
+               ((1u << irq) - 1);
+       return hweight32(mask);
 }
 
-static const struct irq_domain_ops xtensa_irq_domain_ops = {
-       .xlate = xtensa_irq_domain_xlate,
-       .map = xtensa_irq_map,
-};
-
 void __init init_IRQ(void)
 {
-       struct device_node *intc = NULL;
-
-       cached_irq_mask = 0;
-       set_sr(~0, intclear);
-
 #ifdef CONFIG_OF
-       /* The interrupt controller device node is mandatory */
-       intc = of_find_compatible_node(NULL, NULL, "xtensa,pic");
-       BUG_ON(!intc);
-
-       root_domain = irq_domain_add_linear(intc, NR_IRQS,
-                       &xtensa_irq_domain_ops, NULL);
+       irqchip_init();
+#else
+#ifdef CONFIG_HAVE_SMP
+       xtensa_mx_init_legacy(NULL);
 #else
-       root_domain = irq_domain_add_legacy(intc, NR_IRQS, 0, 0,
-                       &xtensa_irq_domain_ops, NULL);
+       xtensa_pic_init_legacy(NULL);
+#endif
 #endif
-       irq_set_default_host(root_domain);
 
+#ifdef CONFIG_SMP
+       ipi_init();
+#endif
        variant_init_irq();
 }
+
+#ifdef CONFIG_HOTPLUG_CPU
+static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
+{
+       struct irq_desc *desc = irq_to_desc(irq);
+       struct irq_chip *chip = irq_data_get_irq_chip(data);
+       unsigned long flags;
+
+       raw_spin_lock_irqsave(&desc->lock, flags);
+       if (chip->irq_set_affinity)
+               chip->irq_set_affinity(data, cpumask_of(cpu), false);
+       raw_spin_unlock_irqrestore(&desc->lock, flags);
+}
+
+/*
+ * The CPU has been marked offline.  Migrate IRQs off this CPU.  If
+ * the affinity settings do not allow other CPUs, force them onto any
+ * available CPU.
+ */
+void migrate_irqs(void)
+{
+       unsigned int i, cpu = smp_processor_id();
+       struct irq_desc *desc;
+
+       for_each_irq_desc(i, desc) {
+               struct irq_data *data = irq_desc_get_irq_data(desc);
+               unsigned int newcpu;
+
+               if (irqd_is_per_cpu(data))
+                       continue;
+
+               if (!cpumask_test_cpu(cpu, data->affinity))
+                       continue;
+
+               newcpu = cpumask_any_and(data->affinity, cpu_online_mask);
+
+               if (newcpu >= nr_cpu_ids) {
+                       pr_info_ratelimited("IRQ%u no longer affine to CPU%u\n",
+                                           i, cpu);
+
+                       cpumask_setall(data->affinity);
+                       newcpu = cpumask_any_and(data->affinity,
+                                                cpu_online_mask);
+               }
+
+               route_irq(data, i, newcpu);
+       }
+}
+#endif /* CONFIG_HOTPLUG_CPU */
diff --git a/arch/xtensa/kernel/mxhead.S b/arch/xtensa/kernel/mxhead.S
new file mode 100644 (file)
index 0000000..77a161a
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Xtensa Secondary Processors startup code.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2001 - 2013 Tensilica Inc.
+ *
+ * Joe Taylor <joe@tensilica.com>
+ * Chris Zankel <chris@zankel.net>
+ * Marc Gauthier <marc@tensilica.com, marc@alumni.uwaterloo.ca>
+ * Pete Delaney <piet@tensilica.com>
+ */
+
+#include <linux/linkage.h>
+
+#include <asm/cacheasm.h>
+#include <asm/initialize_mmu.h>
+#include <asm/mxregs.h>
+#include <asm/regs.h>
+
+
+       .section .SecondaryResetVector.text, "ax"
+
+
+ENTRY(_SecondaryResetVector)
+       _j _SetupOCD
+
+       .begin  no-absolute-literals
+       .literal_position
+
+_SetupOCD:
+       /*
+        * Initialize WB, WS, and clear PS.EXCM (to allow loop instructions).
+        * Set Interrupt Level just below XCHAL_DEBUGLEVEL to allow
+        * xt-gdb to single step via DEBUG exceptions received directly
+        * by ocd.
+        */
+       movi    a1, 1
+       movi    a0, 0
+       wsr     a1, windowstart
+       wsr     a0, windowbase
+       rsync
+
+       movi    a1, LOCKLEVEL
+       wsr     a1, ps
+       rsync
+
+_SetupMMU:
+       Offset = _SetupMMU - _SecondaryResetVector
+
+#ifdef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
+       initialize_mmu
+#endif
+
+       /*
+        * Start Secondary Processors with NULL pointer to boot params.
+        */
+       movi    a2, 0                           #  a2 == NULL
+       movi    a3, _startup
+       jx      a3
+
+       .end    no-absolute-literals
+
+
+       .section        .SecondaryResetVector.remapped_text, "ax"
+       .global         _RemappedSecondaryResetVector
+
+       .org 0                                  # Need to do org before literals
+
+_RemappedSecondaryResetVector:
+       .begin  no-absolute-literals
+       .literal_position
+
+       _j      _RemappedSetupMMU
+       . = _RemappedSecondaryResetVector + Offset
+
+_RemappedSetupMMU:
+
+#ifdef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
+       initialize_mmu
+#endif
+
+       .end    no-absolute-literals
index 6e2b6638122de71374c99ac0be7df584b0cf7fd9..d21bfa7a28e0f026b7e28b170279d2aa4dac64bb 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/screen_info.h>
 #include <linux/bootmem.h>
 #include <linux/kernel.h>
+#include <linux/percpu.h>
+#include <linux/cpu.h>
 #include <linux/of_fdt.h>
 #include <linux/of_platform.h>
 
@@ -37,6 +39,7 @@
 #endif
 
 #include <asm/bootparam.h>
+#include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/timex.h>
@@ -45,6 +48,7 @@
 #include <asm/setup.h>
 #include <asm/param.h>
 #include <asm/traps.h>
+#include <asm/smp.h>
 
 #include <platform/hardware.h>
 
@@ -85,12 +89,6 @@ static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
 
 sysmem_info_t __initdata sysmem;
 
-#ifdef CONFIG_MMU
-extern void init_mmu(void);
-#else
-static inline void init_mmu(void) { }
-#endif
-
 extern int mem_reserve(unsigned long, unsigned long, int);
 extern void bootmem_init(void);
 extern void zones_init(void);
@@ -354,7 +352,8 @@ static inline int probed_compare_swap(int *v, int cmp, int set)
 
 /* Handle probed exception */
 
-void __init do_probed_exception(struct pt_regs *regs, unsigned long exccause)
+static void __init do_probed_exception(struct pt_regs *regs,
+               unsigned long exccause)
 {
        if (regs->pc == rcw_probe_pc) { /* exception on s32c1i ? */
                regs->pc += 3;          /* skip the s32c1i instruction */
@@ -366,7 +365,7 @@ void __init do_probed_exception(struct pt_regs *regs, unsigned long exccause)
 
 /* Simple test of S32C1I (soc bringup assist) */
 
-void __init check_s32c1i(void)
+static int __init check_s32c1i(void)
 {
        int n, cause1, cause2;
        void *handbus, *handdata, *handaddr; /* temporarily saved handlers */
@@ -421,24 +420,21 @@ void __init check_s32c1i(void)
        trap_set_handler(EXCCAUSE_LOAD_STORE_ERROR, handbus);
        trap_set_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR, handdata);
        trap_set_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR, handaddr);
+       return 0;
 }
 
 #else /* XCHAL_HAVE_S32C1I */
 
 /* This condition should not occur with a commercially deployed processor.
    Display reminder for early engr test or demo chips / FPGA bitstreams */
-void __init check_s32c1i(void)
+static int __init check_s32c1i(void)
 {
        pr_warn("Processor configuration lacks atomic compare-and-swap support!\n");
+       return 0;
 }
 
 #endif /* XCHAL_HAVE_S32C1I */
-#else /* CONFIG_S32C1I_SELFTEST */
-
-void __init check_s32c1i(void)
-{
-}
-
+early_initcall(check_s32c1i);
 #endif /* CONFIG_S32C1I_SELFTEST */
 
 
@@ -447,8 +443,6 @@ void __init setup_arch(char **cmdline_p)
        strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
        *cmdline_p = command_line;
 
-       check_s32c1i();
-
        /* Reserve some memory regions */
 
 #ifdef CONFIG_BLK_DEV_INITRD
@@ -505,6 +499,10 @@ void __init setup_arch(char **cmdline_p)
 
        platform_setup(cmdline_p);
 
+#ifdef CONFIG_SMP
+       smp_init_cpus();
+#endif
+
        paging_init();
        zones_init();
 
@@ -521,6 +519,22 @@ void __init setup_arch(char **cmdline_p)
 #endif
 }
 
+static DEFINE_PER_CPU(struct cpu, cpu_data);
+
+static int __init topology_init(void)
+{
+       int i;
+
+       for_each_possible_cpu(i) {
+               struct cpu *cpu = &per_cpu(cpu_data, i);
+               cpu->hotpluggable = !!i;
+               register_cpu(cpu, i);
+       }
+
+       return 0;
+}
+subsys_initcall(topology_init);
+
 void machine_restart(char * cmd)
 {
        platform_restart();
@@ -546,21 +560,27 @@ void machine_power_off(void)
 static int
 c_show(struct seq_file *f, void *slot)
 {
+       char buf[NR_CPUS * 5];
+
+       cpulist_scnprintf(buf, sizeof(buf), cpu_online_mask);
        /* high-level stuff */
-       seq_printf(f,"processor\t: 0\n"
-                    "vendor_id\t: Tensilica\n"
-                    "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n"
-                    "core ID\t\t: " XCHAL_CORE_ID "\n"
-                    "build ID\t: 0x%x\n"
-                    "byte order\t: %s\n"
-                    "cpu MHz\t\t: %lu.%02lu\n"
-                    "bogomips\t: %lu.%02lu\n",
-                    XCHAL_BUILD_UNIQUE_ID,
-                    XCHAL_HAVE_BE ?  "big" : "little",
-                    ccount_freq/1000000,
-                    (ccount_freq/10000) % 100,
-                    loops_per_jiffy/(500000/HZ),
-                    (loops_per_jiffy/(5000/HZ)) % 100);
+       seq_printf(f, "CPU count\t: %u\n"
+                     "CPU list\t: %s\n"
+                     "vendor_id\t: Tensilica\n"
+                     "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n"
+                     "core ID\t\t: " XCHAL_CORE_ID "\n"
+                     "build ID\t: 0x%x\n"
+                     "byte order\t: %s\n"
+                     "cpu MHz\t\t: %lu.%02lu\n"
+                     "bogomips\t: %lu.%02lu\n",
+                     num_online_cpus(),
+                     buf,
+                     XCHAL_BUILD_UNIQUE_ID,
+                     XCHAL_HAVE_BE ?  "big" : "little",
+                     ccount_freq/1000000,
+                     (ccount_freq/10000) % 100,
+                     loops_per_jiffy/(500000/HZ),
+                     (loops_per_jiffy/(5000/HZ)) % 100);
 
        seq_printf(f,"flags\t\t: "
 #if XCHAL_HAVE_NMI
@@ -672,7 +692,7 @@ c_show(struct seq_file *f, void *slot)
 static void *
 c_start(struct seq_file *f, loff_t *pos)
 {
-       return (void *) ((*pos == 0) ? (void *)1 : NULL);
+       return (*pos == 0) ? (void *)1 : NULL;
 }
 
 static void *
@@ -688,10 +708,10 @@ c_stop(struct seq_file *f, void *v)
 
 const struct seq_operations cpuinfo_op =
 {
-       start:  c_start,
-       next:   c_next,
-       stop:   c_stop,
-       show:   c_show
+       .start  = c_start,
+       .next   = c_next,
+       .stop   = c_stop,
+       .show   = c_show,
 };
 
 #endif /* CONFIG_PROC_FS */
diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c
new file mode 100644 (file)
index 0000000..1c7a209
--- /dev/null
@@ -0,0 +1,591 @@
+/*
+ * Xtensa SMP support functions.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 - 2013 Tensilica Inc.
+ *
+ * Chris Zankel <chris@zankel.net>
+ * Joe Taylor <joe@tensilica.com>
+ * Pete Delaney <piet@tensilica.com
+ */
+
+#include <linux/cpu.h>
+#include <linux/cpumask.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/irqdomain.h>
+#include <linux/irq.h>
+#include <linux/kdebug.h>
+#include <linux/module.h>
+#include <linux/reboot.h>
+#include <linux/seq_file.h>
+#include <linux/smp.h>
+#include <linux/thread_info.h>
+
+#include <asm/cacheflush.h>
+#include <asm/kdebug.h>
+#include <asm/mmu_context.h>
+#include <asm/mxregs.h>
+#include <asm/platform.h>
+#include <asm/tlbflush.h>
+#include <asm/traps.h>
+
+#ifdef CONFIG_SMP
+# if XCHAL_HAVE_S32C1I == 0
+#  error "The S32C1I option is required for SMP."
+# endif
+#endif
+
+static void system_invalidate_dcache_range(unsigned long start,
+               unsigned long size);
+static void system_flush_invalidate_dcache_range(unsigned long start,
+               unsigned long size);
+
+/* IPI (Inter Process Interrupt) */
+
+#define IPI_IRQ        0
+
+static irqreturn_t ipi_interrupt(int irq, void *dev_id);
+static struct irqaction ipi_irqaction = {
+       .handler =      ipi_interrupt,
+       .flags =        IRQF_PERCPU,
+       .name =         "ipi",
+};
+
+void ipi_init(void)
+{
+       unsigned irq = irq_create_mapping(NULL, IPI_IRQ);
+       setup_irq(irq, &ipi_irqaction);
+}
+
+static inline unsigned int get_core_count(void)
+{
+       /* Bits 18..21 of SYSCFGID contain the core count minus 1. */
+       unsigned int syscfgid = get_er(SYSCFGID);
+       return ((syscfgid >> 18) & 0xf) + 1;
+}
+
+static inline int get_core_id(void)
+{
+       /* Bits 0...18 of SYSCFGID contain the core id  */
+       unsigned int core_id = get_er(SYSCFGID);
+       return core_id & 0x3fff;
+}
+
+void __init smp_prepare_cpus(unsigned int max_cpus)
+{
+       unsigned i;
+
+       for (i = 0; i < max_cpus; ++i)
+               set_cpu_present(i, true);
+}
+
+void __init smp_init_cpus(void)
+{
+       unsigned i;
+       unsigned int ncpus = get_core_count();
+       unsigned int core_id = get_core_id();
+
+       pr_info("%s: Core Count = %d\n", __func__, ncpus);
+       pr_info("%s: Core Id = %d\n", __func__, core_id);
+
+       for (i = 0; i < ncpus; ++i)
+               set_cpu_possible(i, true);
+}
+
+void __init smp_prepare_boot_cpu(void)
+{
+       unsigned int cpu = smp_processor_id();
+       BUG_ON(cpu != 0);
+       cpu_asid_cache(cpu) = ASID_USER_FIRST;
+}
+
+void __init smp_cpus_done(unsigned int max_cpus)
+{
+}
+
+static int boot_secondary_processors = 1; /* Set with xt-gdb via .xt-gdb */
+static DECLARE_COMPLETION(cpu_running);
+
+void secondary_start_kernel(void)
+{
+       struct mm_struct *mm = &init_mm;
+       unsigned int cpu = smp_processor_id();
+
+       init_mmu();
+
+#ifdef CONFIG_DEBUG_KERNEL
+       if (boot_secondary_processors == 0) {
+               pr_debug("%s: boot_secondary_processors:%d; Hanging cpu:%d\n",
+                       __func__, boot_secondary_processors, cpu);
+               for (;;)
+                       __asm__ __volatile__ ("waiti " __stringify(LOCKLEVEL));
+       }
+
+       pr_debug("%s: boot_secondary_processors:%d; Booting cpu:%d\n",
+               __func__, boot_secondary_processors, cpu);
+#endif
+       /* Init EXCSAVE1 */
+
+       secondary_trap_init();
+
+       /* All kernel threads share the same mm context. */
+
+       atomic_inc(&mm->mm_users);
+       atomic_inc(&mm->mm_count);
+       current->active_mm = mm;
+       cpumask_set_cpu(cpu, mm_cpumask(mm));
+       enter_lazy_tlb(mm, current);
+
+       preempt_disable();
+       trace_hardirqs_off();
+
+       calibrate_delay();
+
+       notify_cpu_starting(cpu);
+
+       secondary_init_irq();
+       local_timer_setup(cpu);
+
+       local_irq_enable();
+
+       set_cpu_online(cpu, true);
+       complete(&cpu_running);
+
+       cpu_startup_entry(CPUHP_ONLINE);
+}
+
+static void mx_cpu_start(void *p)
+{
+       unsigned cpu = (unsigned)p;
+       unsigned long run_stall_mask = get_er(MPSCORE);
+
+       set_er(run_stall_mask & ~(1u << cpu), MPSCORE);
+       pr_debug("%s: cpu: %d, run_stall_mask: %lx ---> %lx\n",
+                       __func__, cpu, run_stall_mask, get_er(MPSCORE));
+}
+
+static void mx_cpu_stop(void *p)
+{
+       unsigned cpu = (unsigned)p;
+       unsigned long run_stall_mask = get_er(MPSCORE);
+
+       set_er(run_stall_mask | (1u << cpu), MPSCORE);
+       pr_debug("%s: cpu: %d, run_stall_mask: %lx ---> %lx\n",
+                       __func__, cpu, run_stall_mask, get_er(MPSCORE));
+}
+
+#ifdef CONFIG_HOTPLUG_CPU
+unsigned long cpu_start_id __cacheline_aligned;
+#endif
+unsigned long cpu_start_ccount;
+
+static int boot_secondary(unsigned int cpu, struct task_struct *ts)
+{
+       unsigned long timeout = jiffies + msecs_to_jiffies(1000);
+       unsigned long ccount;
+       int i;
+
+#ifdef CONFIG_HOTPLUG_CPU
+       cpu_start_id = cpu;
+       system_flush_invalidate_dcache_range(
+                       (unsigned long)&cpu_start_id, sizeof(cpu_start_id));
+#endif
+       smp_call_function_single(0, mx_cpu_start, (void *)cpu, 1);
+
+       for (i = 0; i < 2; ++i) {
+               do
+                       ccount = get_ccount();
+               while (!ccount);
+
+               cpu_start_ccount = ccount;
+
+               while (time_before(jiffies, timeout)) {
+                       mb();
+                       if (!cpu_start_ccount)
+                               break;
+               }
+
+               if (cpu_start_ccount) {
+                       smp_call_function_single(0, mx_cpu_stop,
+                                       (void *)cpu, 1);
+                       cpu_start_ccount = 0;
+                       return -EIO;
+               }
+       }
+       return 0;
+}
+
+int __cpu_up(unsigned int cpu, struct task_struct *idle)
+{
+       int ret = 0;
+
+       if (cpu_asid_cache(cpu) == 0)
+               cpu_asid_cache(cpu) = ASID_USER_FIRST;
+
+       start_info.stack = (unsigned long)task_pt_regs(idle);
+       wmb();
+
+       pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n",
+                       __func__, cpu, idle, start_info.stack);
+
+       ret = boot_secondary(cpu, idle);
+       if (ret == 0) {
+               wait_for_completion_timeout(&cpu_running,
+                               msecs_to_jiffies(1000));
+               if (!cpu_online(cpu))
+                       ret = -EIO;
+       }
+
+       if (ret)
+               pr_err("CPU %u failed to boot\n", cpu);
+
+       return ret;
+}
+
+#ifdef CONFIG_HOTPLUG_CPU
+
+/*
+ * __cpu_disable runs on the processor to be shutdown.
+ */
+int __cpu_disable(void)
+{
+       unsigned int cpu = smp_processor_id();
+
+       /*
+        * Take this CPU offline.  Once we clear this, we can't return,
+        * and we must not schedule until we're ready to give up the cpu.
+        */
+       set_cpu_online(cpu, false);
+
+       /*
+        * OK - migrate IRQs away from this CPU
+        */
+       migrate_irqs();
+
+       /*
+        * Flush user cache and TLB mappings, and then remove this CPU
+        * from the vm mask set of all processes.
+        */
+       local_flush_cache_all();
+       local_flush_tlb_all();
+       invalidate_page_directory();
+
+       clear_tasks_mm_cpumask(cpu);
+
+       return 0;
+}
+
+static void platform_cpu_kill(unsigned int cpu)
+{
+       smp_call_function_single(0, mx_cpu_stop, (void *)cpu, true);
+}
+
+/*
+ * called on the thread which is asking for a CPU to be shutdown -
+ * waits until shutdown has completed, or it is timed out.
+ */
+void __cpu_die(unsigned int cpu)
+{
+       unsigned long timeout = jiffies + msecs_to_jiffies(1000);
+       while (time_before(jiffies, timeout)) {
+               system_invalidate_dcache_range((unsigned long)&cpu_start_id,
+                               sizeof(cpu_start_id));
+               if (cpu_start_id == -cpu) {
+                       platform_cpu_kill(cpu);
+                       return;
+               }
+       }
+       pr_err("CPU%u: unable to kill\n", cpu);
+}
+
+void arch_cpu_idle_dead(void)
+{
+       cpu_die();
+}
+/*
+ * Called from the idle thread for the CPU which has been shutdown.
+ *
+ * Note that we disable IRQs here, but do not re-enable them
+ * before returning to the caller. This is also the behaviour
+ * of the other hotplug-cpu capable cores, so presumably coming
+ * out of idle fixes this.
+ */
+void __ref cpu_die(void)
+{
+       idle_task_exit();
+       local_irq_disable();
+       __asm__ __volatile__(
+                       "       movi    a2, cpu_restart\n"
+                       "       jx      a2\n");
+}
+
+#endif /* CONFIG_HOTPLUG_CPU */
+
+enum ipi_msg_type {
+       IPI_RESCHEDULE = 0,
+       IPI_CALL_FUNC,
+       IPI_CPU_STOP,
+       IPI_MAX
+};
+
+static const struct {
+       const char *short_text;
+       const char *long_text;
+} ipi_text[] = {
+       { .short_text = "RES", .long_text = "Rescheduling interrupts" },
+       { .short_text = "CAL", .long_text = "Function call interrupts" },
+       { .short_text = "DIE", .long_text = "CPU shutdown interrupts" },
+};
+
+struct ipi_data {
+       unsigned long ipi_count[IPI_MAX];
+};
+
+static DEFINE_PER_CPU(struct ipi_data, ipi_data);
+
+static void send_ipi_message(const struct cpumask *callmask,
+               enum ipi_msg_type msg_id)
+{
+       int index;
+       unsigned long mask = 0;
+
+       for_each_cpu(index, callmask)
+               if (index != smp_processor_id())
+                       mask |= 1 << index;
+
+       set_er(mask, MIPISET(msg_id));
+}
+
+void arch_send_call_function_ipi_mask(const struct cpumask *mask)
+{
+       send_ipi_message(mask, IPI_CALL_FUNC);
+}
+
+void arch_send_call_function_single_ipi(int cpu)
+{
+       send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC);
+}
+
+void smp_send_reschedule(int cpu)
+{
+       send_ipi_message(cpumask_of(cpu), IPI_RESCHEDULE);
+}
+
+void smp_send_stop(void)
+{
+       struct cpumask targets;
+
+       cpumask_copy(&targets, cpu_online_mask);
+       cpumask_clear_cpu(smp_processor_id(), &targets);
+       send_ipi_message(&targets, IPI_CPU_STOP);
+}
+
+static void ipi_cpu_stop(unsigned int cpu)
+{
+       set_cpu_online(cpu, false);
+       machine_halt();
+}
+
+irqreturn_t ipi_interrupt(int irq, void *dev_id)
+{
+       unsigned int cpu = smp_processor_id();
+       struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
+       unsigned int msg;
+       unsigned i;
+
+       msg = get_er(MIPICAUSE(cpu));
+       for (i = 0; i < IPI_MAX; i++)
+               if (msg & (1 << i)) {
+                       set_er(1 << i, MIPICAUSE(cpu));
+                       ++ipi->ipi_count[i];
+               }
+
+       if (msg & (1 << IPI_RESCHEDULE))
+               scheduler_ipi();
+       if (msg & (1 << IPI_CALL_FUNC))
+               generic_smp_call_function_interrupt();
+       if (msg & (1 << IPI_CPU_STOP))
+               ipi_cpu_stop(cpu);
+
+       return IRQ_HANDLED;
+}
+
+void show_ipi_list(struct seq_file *p, int prec)
+{
+       unsigned int cpu;
+       unsigned i;
+
+       for (i = 0; i < IPI_MAX; ++i) {
+               seq_printf(p, "%*s:", prec, ipi_text[i].short_text);
+               for_each_online_cpu(cpu)
+                       seq_printf(p, " %10lu",
+                                       per_cpu(ipi_data, cpu).ipi_count[i]);
+               seq_printf(p, "   %s\n", ipi_text[i].long_text);
+       }
+}
+
+int setup_profiling_timer(unsigned int multiplier)
+{
+       pr_debug("setup_profiling_timer %d\n", multiplier);
+       return 0;
+}
+
+/* TLB flush functions */
+
+struct flush_data {
+       struct vm_area_struct *vma;
+       unsigned long addr1;
+       unsigned long addr2;
+};
+
+static void ipi_flush_tlb_all(void *arg)
+{
+       local_flush_tlb_all();
+}
+
+void flush_tlb_all(void)
+{
+       on_each_cpu(ipi_flush_tlb_all, NULL, 1);
+}
+
+static void ipi_flush_tlb_mm(void *arg)
+{
+       local_flush_tlb_mm(arg);
+}
+
+void flush_tlb_mm(struct mm_struct *mm)
+{
+       on_each_cpu(ipi_flush_tlb_mm, mm, 1);
+}
+
+static void ipi_flush_tlb_page(void *arg)
+{
+       struct flush_data *fd = arg;
+       local_flush_tlb_page(fd->vma, fd->addr1);
+}
+
+void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
+{
+       struct flush_data fd = {
+               .vma = vma,
+               .addr1 = addr,
+       };
+       on_each_cpu(ipi_flush_tlb_page, &fd, 1);
+}
+
+static void ipi_flush_tlb_range(void *arg)
+{
+       struct flush_data *fd = arg;
+       local_flush_tlb_range(fd->vma, fd->addr1, fd->addr2);
+}
+
+void flush_tlb_range(struct vm_area_struct *vma,
+                    unsigned long start, unsigned long end)
+{
+       struct flush_data fd = {
+               .vma = vma,
+               .addr1 = start,
+               .addr2 = end,
+       };
+       on_each_cpu(ipi_flush_tlb_range, &fd, 1);
+}
+
+/* Cache flush functions */
+
+static void ipi_flush_cache_all(void *arg)
+{
+       local_flush_cache_all();
+}
+
+void flush_cache_all(void)
+{
+       on_each_cpu(ipi_flush_cache_all, NULL, 1);
+}
+
+static void ipi_flush_cache_page(void *arg)
+{
+       struct flush_data *fd = arg;
+       local_flush_cache_page(fd->vma, fd->addr1, fd->addr2);
+}
+
+void flush_cache_page(struct vm_area_struct *vma,
+                    unsigned long address, unsigned long pfn)
+{
+       struct flush_data fd = {
+               .vma = vma,
+               .addr1 = address,
+               .addr2 = pfn,
+       };
+       on_each_cpu(ipi_flush_cache_page, &fd, 1);
+}
+
+static void ipi_flush_cache_range(void *arg)
+{
+       struct flush_data *fd = arg;
+       local_flush_cache_range(fd->vma, fd->addr1, fd->addr2);
+}
+
+void flush_cache_range(struct vm_area_struct *vma,
+                    unsigned long start, unsigned long end)
+{
+       struct flush_data fd = {
+               .vma = vma,
+               .addr1 = start,
+               .addr2 = end,
+       };
+       on_each_cpu(ipi_flush_cache_range, &fd, 1);
+}
+
+static void ipi_flush_icache_range(void *arg)
+{
+       struct flush_data *fd = arg;
+       local_flush_icache_range(fd->addr1, fd->addr2);
+}
+
+void flush_icache_range(unsigned long start, unsigned long end)
+{
+       struct flush_data fd = {
+               .addr1 = start,
+               .addr2 = end,
+       };
+       on_each_cpu(ipi_flush_icache_range, &fd, 1);
+}
+
+/* ------------------------------------------------------------------------- */
+
+static void ipi_invalidate_dcache_range(void *arg)
+{
+       struct flush_data *fd = arg;
+       __invalidate_dcache_range(fd->addr1, fd->addr2);
+}
+
+static void system_invalidate_dcache_range(unsigned long start,
+               unsigned long size)
+{
+       struct flush_data fd = {
+               .addr1 = start,
+               .addr2 = size,
+       };
+       on_each_cpu(ipi_invalidate_dcache_range, &fd, 1);
+}
+
+static void ipi_flush_invalidate_dcache_range(void *arg)
+{
+       struct flush_data *fd = arg;
+       __flush_invalidate_dcache_range(fd->addr1, fd->addr2);
+}
+
+static void system_flush_invalidate_dcache_range(unsigned long start,
+               unsigned long size)
+{
+       struct flush_data fd = {
+               .addr1 = start,
+               .addr2 = size,
+       };
+       on_each_cpu(ipi_flush_invalidate_dcache_range, &fd, 1);
+}
index 9af3dd88ad7eac172e4fb835e94c70e369547438..60dcb3fcaeae8ad978f8eeec4d073a88abb9f064 100644 (file)
@@ -46,24 +46,19 @@ static struct clocksource ccount_clocksource = {
        .rating = 200,
        .read = ccount_read,
        .mask = CLOCKSOURCE_MASK(32),
+       .flags = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 static int ccount_timer_set_next_event(unsigned long delta,
                struct clock_event_device *dev);
 static void ccount_timer_set_mode(enum clock_event_mode mode,
                struct clock_event_device *evt);
-static struct ccount_timer_t {
+struct ccount_timer {
        struct clock_event_device evt;
        int irq_enabled;
-} ccount_timer = {
-       .evt = {
-               .name           = "ccount_clockevent",
-               .features       = CLOCK_EVT_FEAT_ONESHOT,
-               .rating         = 300,
-               .set_next_event = ccount_timer_set_next_event,
-               .set_mode       = ccount_timer_set_mode,
-       },
+       char name[24];
 };
+static DEFINE_PER_CPU(struct ccount_timer, ccount_timer);
 
 static int ccount_timer_set_next_event(unsigned long delta,
                struct clock_event_device *dev)
@@ -84,8 +79,8 @@ static int ccount_timer_set_next_event(unsigned long delta,
 static void ccount_timer_set_mode(enum clock_event_mode mode,
                struct clock_event_device *evt)
 {
-       struct ccount_timer_t *timer =
-               container_of(evt, struct ccount_timer_t, evt);
+       struct ccount_timer *timer =
+               container_of(evt, struct ccount_timer, evt);
 
        /*
         * There is no way to disable the timer interrupt at the device level,
@@ -117,9 +112,28 @@ static struct irqaction timer_irqaction = {
        .handler =      timer_interrupt,
        .flags =        IRQF_TIMER,
        .name =         "timer",
-       .dev_id =       &ccount_timer,
 };
 
+void local_timer_setup(unsigned cpu)
+{
+       struct ccount_timer *timer = &per_cpu(ccount_timer, cpu);
+       struct clock_event_device *clockevent = &timer->evt;
+
+       timer->irq_enabled = 1;
+       clockevent->name = timer->name;
+       snprintf(timer->name, sizeof(timer->name), "ccount_clockevent_%u", cpu);
+       clockevent->features = CLOCK_EVT_FEAT_ONESHOT;
+       clockevent->rating = 300;
+       clockevent->set_next_event = ccount_timer_set_next_event;
+       clockevent->set_mode = ccount_timer_set_mode;
+       clockevent->cpumask = cpumask_of(cpu);
+       clockevent->irq = irq_create_mapping(NULL, LINUX_TIMER_INT);
+       if (WARN(!clockevent->irq, "error: can't map timer irq"))
+               return;
+       clockevents_config_and_register(clockevent, ccount_freq,
+                                       0xf, 0xffffffff);
+}
+
 void __init time_init(void)
 {
 #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
@@ -131,16 +145,8 @@ void __init time_init(void)
        ccount_freq = CONFIG_XTENSA_CPU_CLOCK*1000000UL;
 #endif
        clocksource_register_hz(&ccount_clocksource, ccount_freq);
-
-       ccount_timer.evt.cpumask = cpumask_of(0);
-       ccount_timer.evt.irq = irq_create_mapping(NULL, LINUX_TIMER_INT);
-       if (WARN(!ccount_timer.evt.irq, "error: can't map timer irq"))
-               return;
-       clockevents_config_and_register(&ccount_timer.evt, ccount_freq, 0xf,
-                       0xffffffff);
-       setup_irq(ccount_timer.evt.irq, &timer_irqaction);
-       ccount_timer.irq_enabled = 1;
-
+       local_timer_setup(0);
+       setup_irq(this_cpu_ptr(&ccount_timer)->evt.irq, &timer_irqaction);
        setup_sched_clock(ccount_sched_clock_read, 32, ccount_freq);
 }
 
@@ -148,11 +154,11 @@ void __init time_init(void)
  * The timer interrupt is called HZ times per second.
  */
 
-irqreturn_t timer_interrupt (int irq, void *dev_id)
+irqreturn_t timer_interrupt(int irq, void *dev_id)
 {
-       struct ccount_timer_t *timer = dev_id;
-       struct clock_event_device *evt = &timer->evt;
+       struct clock_event_device *evt = &this_cpu_ptr(&ccount_timer)->evt;
 
+       set_linux_timer(get_linux_timer());
        evt->event_handler(evt);
 
        /* Allow platform to do something useful (Wdog). */
index 3e8a05c874cd2719951929ff348b4d24f34c773e..eebbfd8c26fc25121bced6cb18c074a55c6cb5f5 100644 (file)
@@ -157,7 +157,7 @@ COPROCESSOR(7),
  * 2. it is a temporary memory buffer for the exception handlers.
  */
 
-unsigned long exc_table[EXC_TABLE_SIZE/4];
+DEFINE_PER_CPU(unsigned long, exc_table[EXC_TABLE_SIZE/4]);
 
 void die(const char*, struct pt_regs*, long);
 
@@ -212,6 +212,9 @@ void do_interrupt(struct pt_regs *regs)
                XCHAL_INTLEVEL6_MASK,
                XCHAL_INTLEVEL7_MASK,
        };
+       struct pt_regs *old_regs = set_irq_regs(regs);
+
+       irq_enter();
 
        for (;;) {
                unsigned intread = get_sr(interrupt);
@@ -227,21 +230,13 @@ void do_interrupt(struct pt_regs *regs)
                }
 
                if (level == 0)
-                       return;
-
-               /*
-                * Clear the interrupt before processing, in case it's
-                *  edge-triggered or software-generated
-                */
-               while (int_at_level) {
-                       unsigned i = __ffs(int_at_level);
-                       unsigned mask = 1 << i;
-
-                       int_at_level ^= mask;
-                       set_sr(mask, intclear);
-                       do_IRQ(i, regs);
-               }
+                       break;
+
+               do_IRQ(__ffs(int_at_level), regs);
        }
+
+       irq_exit();
+       set_irq_regs(old_regs);
 }
 
 /*
@@ -318,17 +313,31 @@ do_debug(struct pt_regs *regs)
 }
 
 
+static void set_handler(int idx, void *handler)
+{
+       unsigned int cpu;
+
+       for_each_possible_cpu(cpu)
+               per_cpu(exc_table, cpu)[idx] = (unsigned long)handler;
+}
+
 /* Set exception C handler - for temporary use when probing exceptions */
 
 void * __init trap_set_handler(int cause, void *handler)
 {
-       unsigned long *entry = &exc_table[EXC_TABLE_DEFAULT / 4 + cause];
-       void *previous = (void *)*entry;
-       *entry = (unsigned long)handler;
+       void *previous = (void *)per_cpu(exc_table, 0)[
+               EXC_TABLE_DEFAULT / 4 + cause];
+       set_handler(EXC_TABLE_DEFAULT / 4 + cause, handler);
        return previous;
 }
 
 
+static void trap_init_excsave(void)
+{
+       unsigned long excsave1 = (unsigned long)this_cpu_ptr(exc_table);
+       __asm__ __volatile__("wsr  %0, excsave1\n" : : "a" (excsave1));
+}
+
 /*
  * Initialize dispatch tables.
  *
@@ -342,8 +351,6 @@ void * __init trap_set_handler(int cause, void *handler)
  * See vectors.S for more details.
  */
 
-#define set_handler(idx,handler) (exc_table[idx] = (unsigned long) (handler))
-
 void __init trap_init(void)
 {
        int i;
@@ -373,10 +380,15 @@ void __init trap_init(void)
        }
 
        /* Initialize EXCSAVE_1 to hold the address of the exception table. */
+       trap_init_excsave();
+}
 
-       i = (unsigned long)exc_table;
-       __asm__ __volatile__("wsr  %0, excsave1\n" : : "a" (i));
+#ifdef CONFIG_SMP
+void secondary_trap_init(void)
+{
+       trap_init_excsave();
 }
+#endif
 
 /*
  * This function dumps the current valid window frame and other base registers.
index 21acd11b5df2f689f0079f47a3910aaaa4ffbf41..ee32c0085dff4296fb9290e3706733db9402460d 100644 (file)
@@ -165,6 +165,13 @@ SECTIONS
                   .DoubleExceptionVector.text);
     RELOCATE_ENTRY(_DebugInterruptVector_text,
                   .DebugInterruptVector.text);
+#if defined(CONFIG_SMP)
+    RELOCATE_ENTRY(_SecondaryResetVector_literal,
+                  .SecondaryResetVector.literal);
+    RELOCATE_ENTRY(_SecondaryResetVector_text,
+                  .SecondaryResetVector.text);
+#endif
+
   
     __boot_reloc_table_end = ABSOLUTE(.) ;
 
@@ -272,6 +279,25 @@ SECTIONS
                  .DoubleExceptionVector.literal)
 
   . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
+
+#if defined(CONFIG_SMP)
+
+  SECTION_VECTOR (_SecondaryResetVector_literal,
+                 .SecondaryResetVector.literal,
+                 RESET_VECTOR1_VADDR - 4,
+                 SIZEOF(.DoubleExceptionVector.text),
+                 .DoubleExceptionVector.text)
+
+  SECTION_VECTOR (_SecondaryResetVector_text,
+                 .SecondaryResetVector.text,
+                 RESET_VECTOR1_VADDR,
+                 4,
+                 .SecondaryResetVector.literal)
+
+  . = LOADADDR(.SecondaryResetVector.text)+SIZEOF(.SecondaryResetVector.text);
+
+#endif
+
   . = ALIGN(PAGE_SIZE);
 
   __init_end = .;
index 81edeab82d174eb478ad303001da881d6758f2bb..ba4c47f291b17843047a410549b09cb59ba52967 100644 (file)
@@ -118,7 +118,7 @@ void flush_dcache_page(struct page *page)
  * For now, flush the whole cache. FIXME??
  */
 
-void flush_cache_range(struct vm_area_struct* vma,
+void local_flush_cache_range(struct vm_area_struct *vma,
                       unsigned long start, unsigned long end)
 {
        __flush_invalidate_dcache_all();
@@ -132,7 +132,7 @@ void flush_cache_range(struct vm_area_struct* vma,
  * alias versions of the cache flush functions.
  */
 
-void flush_cache_page(struct vm_area_struct* vma, unsigned long address,
+void local_flush_cache_page(struct vm_area_struct *vma, unsigned long address,
                      unsigned long pfn)
 {
        /* Note that we have to use the 'alias' address to avoid multi-hit */
@@ -159,8 +159,7 @@ update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t *ptep)
 
        /* Invalidate old entry in TLBs */
 
-       invalidate_itlb_mapping(addr);
-       invalidate_dtlb_mapping(addr);
+       flush_tlb_page(vma, addr);
 
 #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK
 
index 70fa7bc42b4a0853012af6f6daaeb254f9c5a086..b57c4f91f487efdc6b2f3f44fe43cfb12e9a7e0c 100644 (file)
@@ -21,7 +21,7 @@
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
 
-unsigned long asid_cache = ASID_USER_FIRST;
+DEFINE_PER_CPU(unsigned long, asid_cache) = ASID_USER_FIRST;
 void bad_page_fault(struct pt_regs*, unsigned long, int);
 
 #undef DEBUG_PAGE_FAULT
index d97ed1ba7b0addd36d81782469ead96889535fc0..1f68558dbcc2264f99f917fcb18659d90f46a8cb 100644 (file)
@@ -140,7 +140,7 @@ ENTRY(clear_user_page)
 
        /* Setup a temporary DTLB with the color of the VPN */
 
-       movi    a4, -PAGE_OFFSET + (PAGE_KERNEL | _PAGE_HW_WRITE)
+       movi    a4, ((PAGE_KERNEL | _PAGE_HW_WRITE) - PAGE_OFFSET) & 0xffffffff
        movi    a5, TLBTEMP_BASE_1                      # virt
        add     a6, a2, a4                              # ppn
        add     a2, a5, a3                              # add 'color'
@@ -194,7 +194,7 @@ ENTRY(copy_user_page)
        or      a9, a9, a8
        slli    a4, a4, PAGE_SHIFT
        s32i    a9, a5, PAGE_FLAGS
-       movi    a5, -PAGE_OFFSET + (PAGE_KERNEL | _PAGE_HW_WRITE)
+       movi    a5, ((PAGE_KERNEL | _PAGE_HW_WRITE) - PAGE_OFFSET) & 0xffffffff
 
        beqz    a6, 1f
 
index c43771c974be94ceea2152bf77cec9777b3c4b1a..5bb8e3c61d850ca05cde23dbdf9872ffe7b262af 100644 (file)
@@ -22,7 +22,7 @@ void __init paging_init(void)
 /*
  * Flush the mmu and reset associated register to default values.
  */
-void __init init_mmu(void)
+void init_mmu(void)
 {
 #if !(XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY)
        /*
@@ -37,7 +37,7 @@ void __init init_mmu(void)
        set_itlbcfg_register(0);
        set_dtlbcfg_register(0);
 #endif
-       flush_tlb_all();
+       local_flush_tlb_all();
 
        /* Set rasid register to a known value. */
 
index ca9d2366bf12b5b85dad9c4fd1295ed14a02d2a5..ade623826788b387f150cfae5a90821f07f6b028 100644 (file)
@@ -48,7 +48,7 @@ static inline void __flush_dtlb_all (void)
 }
 
 
-void flush_tlb_all (void)
+void local_flush_tlb_all(void)
 {
        __flush_itlb_all();
        __flush_dtlb_all();
@@ -60,19 +60,23 @@ void flush_tlb_all (void)
  * a new context will be assigned to it.
  */
 
-void flush_tlb_mm(struct mm_struct *mm)
+void local_flush_tlb_mm(struct mm_struct *mm)
 {
+       int cpu = smp_processor_id();
+
        if (mm == current->active_mm) {
                unsigned long flags;
                local_irq_save(flags);
-               __get_new_mmu_context(mm);
-               __load_mmu_context(mm);
+               mm->context.asid[cpu] = NO_CONTEXT;
+               activate_context(mm, cpu);
                local_irq_restore(flags);
+       } else {
+               mm->context.asid[cpu] = NO_CONTEXT;
+               mm->context.cpu = -1;
        }
-       else
-               mm->context = 0;
 }
 
+
 #define _ITLB_ENTRIES (ITLB_ARF_WAYS << XCHAL_ITLB_ARF_ENTRIES_LOG2)
 #define _DTLB_ENTRIES (DTLB_ARF_WAYS << XCHAL_DTLB_ARF_ENTRIES_LOG2)
 #if _ITLB_ENTRIES > _DTLB_ENTRIES
@@ -81,24 +85,26 @@ void flush_tlb_mm(struct mm_struct *mm)
 # define _TLB_ENTRIES _DTLB_ENTRIES
 #endif
 
-void flush_tlb_range (struct vm_area_struct *vma,
-                     unsigned long start, unsigned long end)
+void local_flush_tlb_range(struct vm_area_struct *vma,
+               unsigned long start, unsigned long end)
 {
+       int cpu = smp_processor_id();
        struct mm_struct *mm = vma->vm_mm;
        unsigned long flags;
 
-       if (mm->context == NO_CONTEXT)
+       if (mm->context.asid[cpu] == NO_CONTEXT)
                return;
 
 #if 0
        printk("[tlbrange<%02lx,%08lx,%08lx>]\n",
-                       (unsigned long)mm->context, start, end);
+                       (unsigned long)mm->context.asid[cpu], start, end);
 #endif
        local_irq_save(flags);
 
        if (end-start + (PAGE_SIZE-1) <= _TLB_ENTRIES << PAGE_SHIFT) {
                int oldpid = get_rasid_register();
-               set_rasid_register (ASID_INSERT(mm->context));
+
+               set_rasid_register(ASID_INSERT(mm->context.asid[cpu]));
                start &= PAGE_MASK;
                if (vma->vm_flags & VM_EXEC)
                        while(start < end) {
@@ -114,24 +120,25 @@ void flush_tlb_range (struct vm_area_struct *vma,
 
                set_rasid_register(oldpid);
        } else {
-               flush_tlb_mm(mm);
+               local_flush_tlb_mm(mm);
        }
        local_irq_restore(flags);
 }
 
-void flush_tlb_page (struct vm_area_struct *vma, unsigned long page)
+void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
 {
+       int cpu = smp_processor_id();
        struct mm_struct* mm = vma->vm_mm;
        unsigned long flags;
        int oldpid;
 
-       if(mm->context == NO_CONTEXT)
+       if (mm->context.asid[cpu] == NO_CONTEXT)
                return;
 
        local_irq_save(flags);
 
        oldpid = get_rasid_register();
-       set_rasid_register(ASID_INSERT(mm->context));
+       set_rasid_register(ASID_INSERT(mm->context.asid[cpu]));
 
        if (vma->vm_flags & VM_EXEC)
                invalidate_itlb_mapping(page);
index e9e1aad8c271048d4fde5bdac7ebef7e1cc79a96..5ae928275db67c6044f348e8922a2a4454050c7b 100644 (file)
@@ -38,7 +38,7 @@
 #define DRIVER_NAME "iss-netdev"
 #define ETH_MAX_PACKET 1500
 #define ETH_HEADER_OTHER 14
-#define ISS_NET_TIMER_VALUE (2 * HZ)
+#define ISS_NET_TIMER_VALUE (HZ / 10)
 
 
 static DEFINE_SPINLOCK(opened_lock);
@@ -56,8 +56,6 @@ static LIST_HEAD(devices);
 
 struct tuntap_info {
        char dev_name[IFNAMSIZ];
-       int fixed_config;
-       unsigned char gw[ETH_ALEN];
        int fd;
 };
 
@@ -67,7 +65,6 @@ struct tuntap_info {
 /* This structure contains out private information for the driver. */
 
 struct iss_net_private {
-
        struct list_head device_list;
        struct list_head opened_list;
 
@@ -83,9 +80,6 @@ struct iss_net_private {
        int index;
        int mtu;
 
-       unsigned char mac[ETH_ALEN];
-       int have_mac;
-
        struct {
                union {
                        struct tuntap_info tuntap;
@@ -118,68 +112,55 @@ static char *split_if_spec(char *str, ...)
                        *arg = str;
                if (end == NULL)
                        return NULL;
-               *end ++ = '\0';
+               *end++ = '\0';
                str = end;
        }
        va_end(ap);
        return str;
 }
 
+/* Set Ethernet address of the specified device. */
 
-#if 0
-/* Adjust SKB. */
-
-struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra)
+static void setup_etheraddr(struct net_device *dev, char *str)
 {
-       if ((skb != NULL) && (skb_tailroom(skb) < extra)) {
-               struct sk_buff *skb2;
-
-               skb2 = skb_copy_expand(skb, 0, extra, GFP_ATOMIC);
-               dev_kfree_skb(skb);
-               skb = skb2;
+       unsigned char *addr = dev->dev_addr;
+       char *end;
+       int i;
+
+       if (str == NULL)
+               goto random;
+
+       for (i = 0; i < ETH_ALEN; i++) {
+               addr[i] = kstrtoul(str, 16, &end);
+               if ((end == str) ||
+                   ((*end != ':') && (*end != ',') && (*end != '\0'))) {
+                       pr_err("%s: failed to parse '%s' as an ethernet address\n",
+                              dev->name, str);
+                       goto random;
+               }
+               str = end + 1;
        }
-       if (skb != NULL)
-               skb_put(skb, extra);
-
-       return skb;
-}
-#endif
-
-/* Return the IP address as a string for a given device. */
-
-static void dev_ip_addr(void *d, char *buf, char *bin_buf)
-{
-       struct net_device *dev = d;
-       struct in_device *ip = dev->ip_ptr;
-       struct in_ifaddr *in;
-       __be32 addr;
-
-       if ((ip == NULL) || ((in = ip->ifa_list) == NULL)) {
-               printk(KERN_WARNING "Device not assigned an IP address!\n");
-               return;
+       if (is_multicast_ether_addr(addr)) {
+               pr_err("%s: attempt to assign a multicast ethernet address\n",
+                      dev->name);
+               goto random;
        }
-
-       addr = in->ifa_address;
-       sprintf(buf, "%d.%d.%d.%d", addr & 0xff, (addr >> 8) & 0xff,
-               (addr >> 16) & 0xff, addr >> 24);
-
-       if (bin_buf) {
-               bin_buf[0] = addr & 0xff;
-               bin_buf[1] = (addr >> 8) & 0xff;
-               bin_buf[2] = (addr >> 16) & 0xff;
-               bin_buf[3] = addr >> 24;
+       if (!is_valid_ether_addr(addr)) {
+               pr_err("%s: attempt to assign an invalid ethernet address\n",
+                      dev->name);
+               goto random;
        }
+       if (!is_local_ether_addr(addr))
+               pr_warn("%s: assigning a globally valid ethernet address\n",
+                       dev->name);
+       return;
+
+random:
+       pr_info("%s: choosing a random ethernet address\n",
+               dev->name);
+       eth_hw_addr_random(dev);
 }
 
-/* Set Ethernet address of the specified device. */
-
-static void inline set_ether_mac(void *d, unsigned char *addr)
-{
-       struct net_device *dev = d;
-       memcpy(dev->dev_addr, addr, ETH_ALEN);
-}
-
-
 /* ======================= TUNTAP TRANSPORT INTERFACE ====================== */
 
 static int tuntap_open(struct iss_net_private *lp)
@@ -189,24 +170,21 @@ static int tuntap_open(struct iss_net_private *lp)
        int err = -EINVAL;
        int fd;
 
-       /* We currently only support a fixed configuration. */
-
-       if (!lp->tp.info.tuntap.fixed_config)
-               return -EINVAL;
-
-       if ((fd = simc_open("/dev/net/tun", 02, 0)) < 0) {      /* O_RDWR */
-               printk("Failed to open /dev/net/tun, returned %d "
-                      "(errno = %d)\n", fd, errno);
+       fd = simc_open("/dev/net/tun", 02, 0); /* O_RDWR */
+       if (fd < 0) {
+               pr_err("%s: failed to open /dev/net/tun, returned %d (errno = %d)\n",
+                      lp->dev->name, fd, errno);
                return fd;
        }
 
-       memset(&ifr, 0, sizeof ifr);
+       memset(&ifr, 0, sizeof(ifr));
        ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
-       strlcpy(ifr.ifr_name, dev_name, sizeof ifr.ifr_name);
+       strlcpy(ifr.ifr_name, dev_name, sizeof(ifr.ifr_name));
 
-       if ((err = simc_ioctl(fd, TUNSETIFF, (void*) &ifr)) < 0) {
-               printk("Failed to set interface, returned %d "
-                      "(errno = %d)\n", err, errno);
+       err = simc_ioctl(fd, TUNSETIFF, &ifr);
+       if (err < 0) {
+               pr_err("%s: failed to set interface %s, returned %d (errno = %d)\n",
+                      lp->dev->name, dev_name, err, errno);
                simc_close(fd);
                return err;
        }
@@ -217,27 +195,17 @@ static int tuntap_open(struct iss_net_private *lp)
 
 static void tuntap_close(struct iss_net_private *lp)
 {
-#if 0
-       if (lp->tp.info.tuntap.fixed_config)
-               iter_addresses(lp->tp.info.tuntap.dev, close_addr, lp->host.dev_name);
-#endif
        simc_close(lp->tp.info.tuntap.fd);
        lp->tp.info.tuntap.fd = -1;
 }
 
-static int tuntap_read (struct iss_net_private *lp, struct sk_buff **skb)
+static int tuntap_read(struct iss_net_private *lp, struct sk_buff **skb)
 {
-#if 0
-       *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER);
-       if (*skb == NULL)
-               return -ENOMEM;
-#endif
-
        return simc_read(lp->tp.info.tuntap.fd,
                        (*skb)->data, (*skb)->dev->mtu + ETH_HEADER_OTHER);
 }
 
-static int tuntap_write (struct iss_net_private *lp, struct sk_buff **skb)
+static int tuntap_write(struct iss_net_private *lp, struct sk_buff **skb)
 {
        return simc_write(lp->tp.info.tuntap.fd, (*skb)->data, (*skb)->len);
 }
@@ -253,45 +221,45 @@ static int tuntap_poll(struct iss_net_private *lp)
 }
 
 /*
- * Currently only a device name is supported.
- * ethX=tuntap[,[mac address][,[device name]]]
+ * ethX=tuntap,[mac address],device name
  */
 
 static int tuntap_probe(struct iss_net_private *lp, int index, char *init)
 {
-       const int len = strlen(TRANSPORT_TUNTAP_NAME);
+       struct net_device *dev = lp->dev;
        char *dev_name = NULL, *mac_str = NULL, *rem = NULL;
 
        /* Transport should be 'tuntap': ethX=tuntap,mac,dev_name */
 
-       if (strncmp(init, TRANSPORT_TUNTAP_NAME, len))
+       if (strncmp(init, TRANSPORT_TUNTAP_NAME,
+                   sizeof(TRANSPORT_TUNTAP_NAME) - 1))
                return 0;
 
-       if (*(init += strlen(TRANSPORT_TUNTAP_NAME)) == ',') {
-               if ((rem=split_if_spec(init+1, &mac_str, &dev_name)) != NULL) {
-                       printk("Extra garbage on specification : '%s'\n", rem);
+       init += sizeof(TRANSPORT_TUNTAP_NAME) - 1;
+       if (*init == ',') {
+               rem = split_if_spec(init + 1, &mac_str, &dev_name);
+               if (rem != NULL) {
+                       pr_err("%s: extra garbage on specification : '%s'\n",
+                              dev->name, rem);
                        return 0;
                }
        } else if (*init != '\0') {
-               printk("Invalid argument: %s. Skipping device!\n", init);
+               pr_err("%s: invalid argument: %s. Skipping device!\n",
+                      dev->name, init);
                return 0;
        }
 
-       if (dev_name) {
-               strncpy(lp->tp.info.tuntap.dev_name, dev_name,
-                        sizeof lp->tp.info.tuntap.dev_name);
-               lp->tp.info.tuntap.fixed_config = 1;
-       } else
-               strcpy(lp->tp.info.tuntap.dev_name, TRANSPORT_TUNTAP_NAME);
+       if (!dev_name) {
+               pr_err("%s: missing tuntap device name\n", dev->name);
+               return 0;
+       }
 
+       strlcpy(lp->tp.info.tuntap.dev_name, dev_name,
+               sizeof(lp->tp.info.tuntap.dev_name));
 
-#if 0
-       if (setup_etheraddr(mac_str, lp->mac))
-               lp->have_mac = 1;
-#endif
-       lp->mtu = TRANSPORT_TUNTAP_MTU;
+       setup_etheraddr(dev, mac_str);
 
-       //lp->info.tuntap.gate_addr = gate_addr;
+       lp->mtu = TRANSPORT_TUNTAP_MTU;
 
        lp->tp.info.tuntap.fd = -1;
 
@@ -302,13 +270,6 @@ static int tuntap_probe(struct iss_net_private *lp, int index, char *init)
        lp->tp.protocol = tuntap_protocol;
        lp->tp.poll = tuntap_poll;
 
-       printk("TUN/TAP backend - ");
-#if 0
-       if (lp->host.gate_addr != NULL)
-               printk("IP = %s", lp->host.gate_addr);
-#endif
-       printk("\n");
-
        return 1;
 }
 
@@ -327,7 +288,8 @@ static int iss_net_rx(struct net_device *dev)
 
        /* Try to allocate memory, if it fails, try again next round. */
 
-       if ((skb = dev_alloc_skb(dev->mtu + 2 + ETH_HEADER_OTHER)) == NULL) {
+       skb = dev_alloc_skb(dev->mtu + 2 + ETH_HEADER_OTHER);
+       if (skb == NULL) {
                lp->stats.rx_dropped++;
                return 0;
        }
@@ -347,7 +309,6 @@ static int iss_net_rx(struct net_device *dev)
 
                lp->stats.rx_bytes += skb->len;
                lp->stats.rx_packets++;
-       //      netif_rx(skb);
                netif_rx_ni(skb);
                return pkt_len;
        }
@@ -378,11 +339,11 @@ static int iss_net_poll(void)
                spin_unlock(&lp->lock);
 
                if (err < 0) {
-                       printk(KERN_ERR "Device '%s' read returned %d, "
-                              "shutting it down\n", lp->dev->name, err);
+                       pr_err("Device '%s' read returned %d, shutting it down\n",
+                              lp->dev->name, err);
                        dev_close(lp->dev);
                } else {
-                       // FIXME reactivate_fd(lp->fd, ISS_ETH_IRQ);
+                       /* FIXME reactivate_fd(lp->fd, ISS_ETH_IRQ); */
                }
        }
 
@@ -393,14 +354,11 @@ static int iss_net_poll(void)
 
 static void iss_net_timer(unsigned long priv)
 {
-       struct iss_net_private* lp = (struct iss_net_private*) priv;
+       struct iss_net_private *lp = (struct iss_net_private *)priv;
 
        spin_lock(&lp->lock);
-
        iss_net_poll();
-
        mod_timer(&lp->timer, jiffies + lp->timer_val);
-
        spin_unlock(&lp->lock);
 }
 
@@ -408,19 +366,14 @@ static void iss_net_timer(unsigned long priv)
 static int iss_net_open(struct net_device *dev)
 {
        struct iss_net_private *lp = netdev_priv(dev);
-       char addr[sizeof "255.255.255.255\0"];
        int err;
 
        spin_lock(&lp->lock);
 
-       if ((err = lp->tp.open(lp)) < 0)
+       err = lp->tp.open(lp);
+       if (err < 0)
                goto out;
 
-       if (!lp->have_mac) {
-               dev_ip_addr(dev, addr, &lp->mac[2]);
-               set_ether_mac(dev, lp->mac);
-       }
-
        netif_start_queue(dev);
 
        /* clear buffer - it can happen that the host side of the interface
@@ -448,7 +401,6 @@ out:
 static int iss_net_close(struct net_device *dev)
 {
        struct iss_net_private *lp = netdev_priv(dev);
-printk("iss_net_close!\n");
        netif_stop_queue(dev);
        spin_lock(&lp->lock);
 
@@ -490,7 +442,7 @@ static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        } else {
                netif_start_queue(dev);
-               printk(KERN_ERR "iss_net_start_xmit: failed(%d)\n", len);
+               pr_err("%s: %s failed(%d)\n", dev->name, __func__, len);
        }
 
        spin_unlock_irqrestore(&lp->lock, flags);
@@ -508,56 +460,27 @@ static struct net_device_stats *iss_net_get_stats(struct net_device *dev)
 
 static void iss_net_set_multicast_list(struct net_device *dev)
 {
-#if 0
-       if (dev->flags & IFF_PROMISC)
-               return;
-       else if (!netdev_mc_empty(dev))
-               dev->flags |= IFF_ALLMULTI;
-       else
-               dev->flags &= ~IFF_ALLMULTI;
-#endif
 }
 
 static void iss_net_tx_timeout(struct net_device *dev)
 {
-#if 0
-       dev->trans_start = jiffies;
-       netif_wake_queue(dev);
-#endif
 }
 
 static int iss_net_set_mac(struct net_device *dev, void *addr)
 {
-#if 0
        struct iss_net_private *lp = netdev_priv(dev);
        struct sockaddr *hwaddr = addr;
 
+       if (!is_valid_ether_addr(hwaddr->sa_data))
+               return -EADDRNOTAVAIL;
        spin_lock(&lp->lock);
        memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
        spin_unlock(&lp->lock);
-#endif
-
        return 0;
 }
 
 static int iss_net_change_mtu(struct net_device *dev, int new_mtu)
 {
-#if 0
-       struct iss_net_private *lp = netdev_priv(dev);
-       int err = 0;
-
-       spin_lock(&lp->lock);
-
-       // FIXME not needed new_mtu = transport_set_mtu(new_mtu, &lp->user);
-
-       if (new_mtu < 0)
-               err = new_mtu;
-       else
-               dev->mtu = new_mtu;
-
-       spin_unlock(&lp->lock);
-       return err;
-#endif
        return -EINVAL;
 }
 
@@ -582,7 +505,6 @@ static const struct net_device_ops iss_netdev_ops = {
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_change_mtu         = iss_net_change_mtu,
        .ndo_set_mac_address    = iss_net_set_mac,
-       //.ndo_do_ioctl         = iss_net_ioctl,
        .ndo_tx_timeout         = iss_net_tx_timeout,
        .ndo_set_rx_mode        = iss_net_set_multicast_list,
 };
@@ -593,24 +515,29 @@ static int iss_net_configure(int index, char *init)
        struct iss_net_private *lp;
        int err;
 
-       if ((dev = alloc_etherdev(sizeof *lp)) == NULL) {
-               printk(KERN_ERR "eth_configure: failed to allocate device\n");
+       dev = alloc_etherdev(sizeof(*lp));
+       if (dev == NULL) {
+               pr_err("eth_configure: failed to allocate device\n");
                return 1;
        }
 
        /* Initialize private element. */
 
        lp = netdev_priv(dev);
-       *lp = ((struct iss_net_private) {
+       *lp = (struct iss_net_private) {
                .device_list            = LIST_HEAD_INIT(lp->device_list),
                .opened_list            = LIST_HEAD_INIT(lp->opened_list),
                .lock                   = __SPIN_LOCK_UNLOCKED(lp.lock),
                .dev                    = dev,
                .index                  = index,
-               //.fd                   = -1,
-               .mac                    = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0 },
-               .have_mac               = 0,
-               });
+               };
+
+       /*
+        * If this name ends up conflicting with an existing registered
+        * netdevice, that is OK, register_netdev{,ice}() will notice this
+        * and fail.
+        */
+       snprintf(dev->name, sizeof(dev->name), "eth%d", index);
 
        /*
         * Try all transport protocols.
@@ -618,14 +545,12 @@ static int iss_net_configure(int index, char *init)
         */
 
        if (!tuntap_probe(lp, index, init)) {
-               printk("Invalid arguments. Skipping device!\n");
+               pr_err("%s: invalid arguments. Skipping device!\n",
+                      dev->name);
                goto errout;
        }
 
-       printk(KERN_INFO "Netdevice %d ", index);
-       if (lp->have_mac)
-               printk("(%pM) ", lp->mac);
-       printk(": ");
+       pr_info("Netdevice %d (%pM)\n", index, dev->dev_addr);
 
        /* sysfs register */
 
@@ -641,14 +566,7 @@ static int iss_net_configure(int index, char *init)
        lp->pdev.id = index;
        lp->pdev.name = DRIVER_NAME;
        platform_device_register(&lp->pdev);
-       SET_NETDEV_DEV(dev,&lp->pdev.dev);
-
-       /*
-        * If this name ends up conflicting with an existing registered
-        * netdevice, that is OK, register_netdev{,ice}() will notice this
-        * and fail.
-        */
-       snprintf(dev->name, sizeof dev->name, "eth%d", index);
+       SET_NETDEV_DEV(dev, &lp->pdev.dev);
 
        dev->netdev_ops = &iss_netdev_ops;
        dev->mtu = lp->mtu;
@@ -660,7 +578,7 @@ static int iss_net_configure(int index, char *init)
        rtnl_unlock();
 
        if (err) {
-               printk("Error registering net device!\n");
+               pr_err("%s: error registering net device!\n", dev->name);
                /* XXX: should we call ->remove() here? */
                free_netdev(dev);
                return 1;
@@ -669,16 +587,11 @@ static int iss_net_configure(int index, char *init)
        init_timer(&lp->tl);
        lp->tl.function = iss_net_user_timer_expire;
 
-#if 0
-       if (lp->have_mac)
-               set_ether_mac(dev, lp->mac);
-#endif
        return 0;
 
 errout:
-       // FIXME: unregister; free, etc..
+       /* FIXME: unregister; free, etc.. */
        return -EIO;
-
 }
 
 /* ------------------------------------------------------------------------- */
@@ -717,7 +630,8 @@ static int __init iss_net_setup(char *str)
                printk(ERR "Device %d is negative\n", n);
                return 1;
        }
-       if (*(str = end) != '=') {
+       str = end;
+       if (*str != '=') {
                printk(ERR "Expected '=' after device number\n");
                return 1;
        }
@@ -739,7 +653,7 @@ static int __init iss_net_setup(char *str)
 
        new = alloc_bootmem(sizeof(*new));
        if (new == NULL) {
-               printk("Alloc_bootmem failed\n");
+               printk(ERR "Alloc_bootmem failed\n");
                return 1;
        }
 
@@ -753,7 +667,7 @@ static int __init iss_net_setup(char *str)
 
 #undef ERR
 
-__setup("eth=", iss_net_setup);
+__setup("eth", iss_net_setup);
 
 /*
  * Initialize all ISS Ethernet devices previously registered in iss_net_setup.
index 4416773cbde5c1755c17abf3d5028babaf80ef6c..aeb316b7ff8838f9bcff5d8f29202bac7043823c 100644 (file)
 #ifndef __XTENSA_XTAVNET_HARDWARE_H
 #define __XTENSA_XTAVNET_HARDWARE_H
 
-/* By default NO_IRQ is defined to 0 in Linux, but we use the
-   interrupt 0 for UART... */
-#define NO_IRQ                 -1
-
 /* Memory configuration. */
 
 #define PLATFORM_DEFAULT_MEM_START 0x00000000
@@ -30,7 +26,7 @@
 
 /* Default assignment of LX60 devices to external interrupts. */
 
-#ifdef CONFIG_ARCH_HAS_SMP
+#ifdef CONFIG_XTENSA_MX
 #define DUART16552_INTNUM      XCHAL_EXTINT3_NUM
 #define OETH_IRQ               XCHAL_EXTINT4_NUM
 #else
index 97d6fc48deff036b1ea5a1bd940b3d998411deec..39ca751a62551c72cc2d0582a08b0ba8667ca43a 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _XTENSA_S6000_IRQ_H
 #define _XTENSA_S6000_IRQ_H
 
-#define NO_IRQ         (-1)
 #define VARIANT_NR_IRQS 8 /* GPIO interrupts */
 
 extern void variant_irq_enable(unsigned int irq);
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 8711e3797165fa73fd0c401cedbb54c61eb68e4a..8095943e6e112da4b0dd3e77b92e331270624020 100644 (file)
@@ -32,8 +32,7 @@
 #include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/power_supply.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 #define PREFIX "ACPI: "
 
index a6869e110ce5650a86b6f666bc28347031c16275..2635a01c5b3edc077eb80a704db6e316b2395857 100644 (file)
@@ -9,7 +9,6 @@
 
 #include <linux/module.h>
 #include <linux/acpi.h>
-#include <acpi/acpi_bus.h>
 #include <linux/cper.h>
 #include <linux/ratelimit.h>
 #include <asm/cpu.h>
index 6745fe137b9ea541ae729429035eaeca8fc8fc07..e603905973721c415a912c04e2c7f3926fcd5634 100644 (file)
@@ -162,6 +162,7 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
        { "80860F14", (unsigned long)&byt_sdio_dev_desc },
        { "80860F41", (unsigned long)&byt_i2c_dev_desc },
        { "INT33B2", },
+       { "INT33FC", },
 
        { "INT3430", (unsigned long)&lpt_dev_desc },
        { "INT3431", (unsigned long)&lpt_dev_desc },
index 551dad712ffec451364a08c01487a1987c10d7db..9aeacdfca4106ac8376d74d049293bd26d4e3075 100644 (file)
@@ -180,14 +180,14 @@ static unsigned long acpi_meminfo_end_pfn(struct acpi_memory_info *info)
 
 static int acpi_bind_memblk(struct memory_block *mem, void *arg)
 {
-       return acpi_bind_one(&mem->dev, (acpi_handle)arg);
+       return acpi_bind_one(&mem->dev, arg);
 }
 
 static int acpi_bind_memory_blocks(struct acpi_memory_info *info,
-                                  acpi_handle handle)
+                                  struct acpi_device *adev)
 {
        return walk_memory_range(acpi_meminfo_start_pfn(info),
-                                acpi_meminfo_end_pfn(info), (void *)handle,
+                                acpi_meminfo_end_pfn(info), adev,
                                 acpi_bind_memblk);
 }
 
@@ -197,8 +197,7 @@ static int acpi_unbind_memblk(struct memory_block *mem, void *arg)
        return 0;
 }
 
-static void acpi_unbind_memory_blocks(struct acpi_memory_info *info,
-                                     acpi_handle handle)
+static void acpi_unbind_memory_blocks(struct acpi_memory_info *info)
 {
        walk_memory_range(acpi_meminfo_start_pfn(info),
                          acpi_meminfo_end_pfn(info), NULL, acpi_unbind_memblk);
@@ -242,9 +241,9 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
                if (result && result != -EEXIST)
                        continue;
 
-               result = acpi_bind_memory_blocks(info, handle);
+               result = acpi_bind_memory_blocks(info, mem_device->device);
                if (result) {
-                       acpi_unbind_memory_blocks(info, handle);
+                       acpi_unbind_memory_blocks(info);
                        return -ENODEV;
                }
 
@@ -285,7 +284,7 @@ static void acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
                if (nid == NUMA_NO_NODE)
                        nid = memory_add_physaddr_to_nid(info->start_addr);
 
-               acpi_unbind_memory_blocks(info, handle);
+               acpi_unbind_memory_blocks(info);
                remove_memory(nid, info->start_addr, info->length);
                list_del(&info->list);
                kfree(info);
index fc6008fbce35bd99f390d15af6e7471b1ca0438a..65610c0e7243d3d9cd4f8e5d757ca9d602b94816 100644 (file)
@@ -28,8 +28,7 @@
 #include <linux/cpu.h>
 #include <linux/clockchips.h>
 #include <linux/slab.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <asm/mwait.h>
 
 #define ACPI_PROCESSOR_AGGREGATOR_CLASS        "acpi_pad"
index 3c1d6b0c09a4b7d1eeeb9347a7c743d1c7487988..d58a2aba09308a31fd6f80355bba51fb6df6724f 100644 (file)
@@ -395,7 +395,7 @@ static int acpi_processor_add(struct acpi_device *device,
                goto err;
        }
 
-       result = acpi_bind_one(dev, pr->handle);
+       result = acpi_bind_one(dev, device);
        if (result)
                goto err;
 
index fb57d03e698bd3b7ae2d4194d69dc3478ca09025..ca0c6d7ec0d4181cfdd3fa9b91547a84cd545e2f 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/nmi.h>
 #include <linux/delay.h>
 #include <linux/mm.h>
-#include <acpi/acpi.h>
 
 #include "apei-internal.h"
 
index fbf1aceda8b8ab915a7d2476d78db2b6e2b94e68..e90ef8b96f266086ade6178162d3f87e2b3f6aa1 100644 (file)
@@ -36,8 +36,7 @@
 #include <linux/suspend.h>
 #include <asm/unaligned.h>
 
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <linux/power_supply.h>
 
 #define PREFIX "ACPI: "
index 078c4f7fe2dd97c42d3e13ea11ebde804e3ae4f0..05ee8f61bfb59d8a53d75347d468eb9d56bc463c 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/acpi.h>
-#include <acpi/acpi_bus.h>
 #include <linux/dmi.h>
 
 #include "internal.h"
index bba9b72e25f8235e6d12593bdd16bb378c7af25a..2c38ae22c17f1dad8283f4c6aa03b365a0232a69 100644 (file)
@@ -37,8 +37,6 @@
 #include <asm/mpspec.h>
 #endif
 #include <linux/pci.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
 #include <acpi/apei.h>
 #include <linux/dmi.h>
 #include <linux/suspend.h>
@@ -52,9 +50,6 @@ struct acpi_device *acpi_root;
 struct proc_dir_entry *acpi_root_dir;
 EXPORT_SYMBOL(acpi_root_dir);
 
-#define STRUCT_TO_INT(s)       (*((int*)&s))
-
-
 #ifdef CONFIG_X86
 static int set_copy_dsdt(const struct dmi_system_id *id)
 {
@@ -115,18 +110,16 @@ int acpi_bus_get_status(struct acpi_device *device)
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
-       STRUCT_TO_INT(device->status) = (int) sta;
+       acpi_set_device_status(device, sta);
 
        if (device->status.functional && !device->status.present) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]: "
                       "functional but not present;\n",
-                       device->pnp.bus_id,
-                       (u32) STRUCT_TO_INT(device->status)));
+                       device->pnp.bus_id, (u32)sta));
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
-                         device->pnp.bus_id,
-                         (u32) STRUCT_TO_INT(device->status)));
+                         device->pnp.bus_id, (u32)sta));
        return 0;
 }
 EXPORT_SYMBOL(acpi_bus_get_status);
@@ -329,58 +322,6 @@ static void acpi_bus_osc_support(void)
                              Notification Handling
    -------------------------------------------------------------------------- */
 
-static void acpi_bus_check_device(acpi_handle handle)
-{
-       struct acpi_device *device;
-       acpi_status status;
-       struct acpi_device_status old_status;
-
-       if (acpi_bus_get_device(handle, &device))
-               return;
-       if (!device)
-               return;
-
-       old_status = device->status;
-
-       /*
-        * Make sure this device's parent is present before we go about
-        * messing with the device.
-        */
-       if (device->parent && !device->parent->status.present) {
-               device->status = device->parent->status;
-               return;
-       }
-
-       status = acpi_bus_get_status(device);
-       if (ACPI_FAILURE(status))
-               return;
-
-       if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status))
-               return;
-
-       /*
-        * Device Insertion/Removal
-        */
-       if ((device->status.present) && !(old_status.present)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));
-               /* TBD: Handle device insertion */
-       } else if (!(device->status.present) && (old_status.present)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
-               /* TBD: Handle device removal */
-       }
-}
-
-static void acpi_bus_check_scope(acpi_handle handle)
-{
-       /* Status Change? */
-       acpi_bus_check_device(handle);
-
-       /*
-        * TBD: Enumerate child devices within this device's scope and
-        *       run acpi_bus_check_device()'s on them.
-        */
-}
-
 /**
  * acpi_bus_notify
  * ---------------
@@ -397,19 +338,11 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
        switch (type) {
 
        case ACPI_NOTIFY_BUS_CHECK:
-               acpi_bus_check_scope(handle);
-               /*
-                * TBD: We'll need to outsource certain events to non-ACPI
-                *      drivers via the device manager (device.c).
-                */
+               /* TBD */
                break;
 
        case ACPI_NOTIFY_DEVICE_CHECK:
-               acpi_bus_check_device(handle);
-               /*
-                * TBD: We'll need to outsource certain events to non-ACPI
-                *      drivers via the device manager (device.c).
-                */
+               /* TBD */
                break;
 
        case ACPI_NOTIFY_DEVICE_WAKE:
index c971929d75c20090b69afda2ab65b073bc95b140..9e3a6cb99f90eb7de2e4c0f078ef316fc0cb895a 100644 (file)
@@ -31,8 +31,7 @@
 #include <linux/seq_file.h>
 #include <linux/input.h>
 #include <linux/slab.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <acpi/button.h>
 
 #define PREFIX "ACPI: "
index e2315166765501b479259269ea5888d44042868b..83d232c10f139d697513be3e718cbff8b2342bb9 100644 (file)
@@ -44,19 +44,24 @@ static const struct acpi_device_id container_device_ids[] = {
        {"", 0},
 };
 
-static int container_device_attach(struct acpi_device *device,
+static int container_device_attach(struct acpi_device *adev,
                                   const struct acpi_device_id *not_used)
 {
-       /* This is necessary for container hotplug to work. */
+       kobject_uevent(&adev->dev.kobj, KOBJ_ONLINE);
        return 1;
 }
 
+static void container_device_detach(struct acpi_device *adev)
+{
+       kobject_uevent(&adev->dev.kobj, KOBJ_OFFLINE);
+}
+
 static struct acpi_scan_handler container_handler = {
        .ids = container_device_ids,
        .attach = container_device_attach,
+       .detach = container_device_detach,
        .hotplug = {
                .enabled = true,
-               .mode = AHM_CONTAINER,
        },
 };
 
index 12b62f2cdb3f0ad507748e9280a961eb1d7667b3..c68e72414a67a9b00231b095335945d5cdd2f31e 100644 (file)
@@ -7,7 +7,7 @@
 #include <linux/kernel.h>
 #include <linux/uaccess.h>
 #include <linux/debugfs.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 #include "internal.h"
 
index b55d6a20dc0eda9a78419f29bb8eb229cc157930..6b1919f6bd8212248f8a7399c21f73b1303a254e 100644 (file)
@@ -5,7 +5,7 @@
 #include <linux/export.h>
 #include <linux/init.h>
 #include <linux/debugfs.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
 ACPI_MODULE_NAME("debugfs");
index b3480cf7db1a1d1eba0e8d884cb456f92b76b660..d49f1e46470370908d72b6efb7677d70f80ded98 100644 (file)
@@ -256,6 +256,8 @@ int acpi_bus_init_power(struct acpi_device *device)
                return -EINVAL;
 
        device->power.state = ACPI_STATE_UNKNOWN;
+       if (!acpi_device_is_present(device))
+               return 0;
 
        result = acpi_device_get_power(device, &state);
        if (result)
@@ -302,15 +304,18 @@ int acpi_device_fix_up_power(struct acpi_device *device)
        return ret;
 }
 
-int acpi_bus_update_power(acpi_handle handle, int *state_p)
+int acpi_device_update_power(struct acpi_device *device, int *state_p)
 {
-       struct acpi_device *device;
        int state;
        int result;
 
-       result = acpi_bus_get_device(handle, &device);
-       if (result)
+       if (device->power.state == ACPI_STATE_UNKNOWN) {
+               result = acpi_bus_init_power(device);
+               if (!result && state_p)
+                       *state_p = device->power.state;
+
                return result;
+       }
 
        result = acpi_device_get_power(device, &state);
        if (result)
@@ -338,6 +343,15 @@ int acpi_bus_update_power(acpi_handle handle, int *state_p)
 
        return 0;
 }
+
+int acpi_bus_update_power(acpi_handle handle, int *state_p)
+{
+       struct acpi_device *device;
+       int result;
+
+       result = acpi_bus_get_device(handle, &device);
+       return result ? result : acpi_device_update_power(device, state_p);
+}
 EXPORT_SYMBOL_GPL(acpi_bus_update_power);
 
 bool acpi_bus_power_manageable(acpi_handle handle)
index dcd73ccb514c601df4efdee7043f2a7cffeb718e..8da6be99ba4206b8ebc82eb669be2f447e53b3ab 100644 (file)
@@ -32,8 +32,6 @@
 #include <linux/jiffies.h>
 #include <linux/stddef.h>
 #include <linux/acpi.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
 
 #define PREFIX "ACPI: "
 
@@ -323,14 +321,11 @@ static int dock_present(struct dock_station *ds)
  */
 static void dock_create_acpi_device(acpi_handle handle)
 {
-       struct acpi_device *device;
+       struct acpi_device *device = NULL;
        int ret;
 
-       if (acpi_bus_get_device(handle, &device)) {
-               /*
-                * no device created for this object,
-                * so we should create one.
-                */
+       acpi_bus_get_device(handle, &device);
+       if (!acpi_device_enumerated(device)) {
                ret = acpi_bus_scan(handle);
                if (ret)
                        pr_debug("error adding bus, %x\n", -ret);
index ba5b56db9d27c7fafa3b19c6d1f5d2549308aea6..ff40120e930e5ae3c3506db53481f4fe6809a680 100644 (file)
 #include <linux/list.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
-#include <asm/io.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <linux/dmi.h>
+#include <asm/io.h>
 
 #include "internal.h"
 
index cae3b387b867a99ab7013cfc2b731b2125abc961..ef2d730734dcca90a9690e48021d1d9a1d925791 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/gfp.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <net/netlink.h>
 #include <net/genetlink.h>
 
index ba3da88cee45a20479df62023ee560aa422dff22..1fb62900f32a9c57d329fd3e5480bc0dc7c305b8 100644 (file)
@@ -29,8 +29,7 @@
 #include <linux/types.h>
 #include <asm/uaccess.h>
 #include <linux/thermal.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 #define PREFIX "ACPI: "
 
index a22a295edb692347f16066bff26d145973ab2523..0c789224d40d4da34aa3c7f1a9314bb12ba7b459 100644 (file)
@@ -37,7 +37,7 @@ int register_acpi_bus_type(struct acpi_bus_type *type)
 {
        if (acpi_disabled)
                return -ENODEV;
-       if (type && type->match && type->find_device) {
+       if (type && type->match && type->find_companion) {
                down_write(&bus_type_sem);
                list_add_tail(&type->list, &bus_type_list);
                up_write(&bus_type_sem);
@@ -82,109 +82,74 @@ static struct acpi_bus_type *acpi_get_bus_type(struct device *dev)
 #define FIND_CHILD_MIN_SCORE   1
 #define FIND_CHILD_MAX_SCORE   2
 
-static acpi_status acpi_dev_present(acpi_handle handle, u32 lvl_not_used,
-                                 void *not_used, void **ret_p)
-{
-       struct acpi_device *adev = NULL;
-
-       acpi_bus_get_device(handle, &adev);
-       if (adev) {
-               *ret_p = handle;
-               return AE_CTRL_TERMINATE;
-       }
-       return AE_OK;
-}
-
-static int do_find_child_checks(acpi_handle handle, bool is_bridge)
+static int find_child_checks(struct acpi_device *adev, bool check_children)
 {
        bool sta_present = true;
        unsigned long long sta;
        acpi_status status;
 
-       status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+       status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
        if (status == AE_NOT_FOUND)
                sta_present = false;
        else if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
                return -ENODEV;
 
-       if (is_bridge) {
-               void *test = NULL;
+       if (check_children && list_empty(&adev->children))
+               return -ENODEV;
 
-               /* Check if this object has at least one child device. */
-               acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
-                                   acpi_dev_present, NULL, NULL, &test);
-               if (!test)
-                       return -ENODEV;
-       }
        return sta_present ? FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE;
 }
 
-struct find_child_context {
-       u64 addr;
-       bool is_bridge;
-       acpi_handle ret;
-       int ret_score;
-};
-
-static acpi_status do_find_child(acpi_handle handle, u32 lvl_not_used,
-                                void *data, void **not_used)
-{
-       struct find_child_context *context = data;
-       unsigned long long addr;
-       acpi_status status;
-       int score;
-
-       status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr);
-       if (ACPI_FAILURE(status) || addr != context->addr)
-               return AE_OK;
-
-       if (!context->ret) {
-               /* This is the first matching object.  Save its handle. */
-               context->ret = handle;
-               return AE_OK;
-       }
-       /*
-        * There is more than one matching object with the same _ADR value.
-        * That really is unexpected, so we are kind of beyond the scope of the
-        * spec here.  We have to choose which one to return, though.
-        *
-        * First, check if the previously found object is good enough and return
-        * its handle if so.  Second, check the same for the object that we've
-        * just found.
-        */
-       if (!context->ret_score) {
-               score = do_find_child_checks(context->ret, context->is_bridge);
-               if (score == FIND_CHILD_MAX_SCORE)
-                       return AE_CTRL_TERMINATE;
-               else
-                       context->ret_score = score;
-       }
-       score = do_find_child_checks(handle, context->is_bridge);
-       if (score == FIND_CHILD_MAX_SCORE) {
-               context->ret = handle;
-               return AE_CTRL_TERMINATE;
-       } else if (score > context->ret_score) {
-               context->ret = handle;
-               context->ret_score = score;
-       }
-       return AE_OK;
-}
-
-acpi_handle acpi_find_child(acpi_handle parent, u64 addr, bool is_bridge)
+struct acpi_device *acpi_find_child_device(struct acpi_device *parent,
+                                          u64 address, bool check_children)
 {
-       if (parent) {
-               struct find_child_context context = {
-                       .addr = addr,
-                       .is_bridge = is_bridge,
-               };
-
-               acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, do_find_child,
-                                   NULL, &context, NULL);
-               return context.ret;
+       struct acpi_device *adev, *ret = NULL;
+       int ret_score = 0;
+
+       if (!parent)
+               return NULL;
+
+       list_for_each_entry(adev, &parent->children, node) {
+               unsigned long long addr;
+               acpi_status status;
+               int score;
+
+               status = acpi_evaluate_integer(adev->handle, METHOD_NAME__ADR,
+                                              NULL, &addr);
+               if (ACPI_FAILURE(status) || addr != address)
+                       continue;
+
+               if (!ret) {
+                       /* This is the first matching object.  Save it. */
+                       ret = adev;
+                       continue;
+               }
+               /*
+                * There is more than one matching device object with the same
+                * _ADR value.  That really is unexpected, so we are kind of
+                * beyond the scope of the spec here.  We have to choose which
+                * one to return, though.
+                *
+                * First, check if the previously found object is good enough
+                * and return it if so.  Second, do the same for the object that
+                * we've just found.
+                */
+               if (!ret_score) {
+                       ret_score = find_child_checks(ret, check_children);
+                       if (ret_score == FIND_CHILD_MAX_SCORE)
+                               return ret;
+               }
+               score = find_child_checks(adev, check_children);
+               if (score == FIND_CHILD_MAX_SCORE) {
+                       return adev;
+               } else if (score > ret_score) {
+                       ret = adev;
+                       ret_score = score;
+               }
        }
-       return NULL;
+       return ret;
 }
-EXPORT_SYMBOL_GPL(acpi_find_child);
+EXPORT_SYMBOL_GPL(acpi_find_child_device);
 
 static void acpi_physnode_link_name(char *buf, unsigned int node_id)
 {
@@ -195,9 +160,8 @@ static void acpi_physnode_link_name(char *buf, unsigned int node_id)
                strcpy(buf, PHYSICAL_NODE_STRING);
 }
 
-int acpi_bind_one(struct device *dev, acpi_handle handle)
+int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
 {
-       struct acpi_device *acpi_dev = NULL;
        struct acpi_device_physical_node *physical_node, *pn;
        char physical_node_name[PHYSICAL_NODE_NAME_SIZE];
        struct list_head *physnode_list;
@@ -205,14 +169,12 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
        int retval = -EINVAL;
 
        if (ACPI_COMPANION(dev)) {
-               if (handle) {
+               if (acpi_dev) {
                        dev_warn(dev, "ACPI companion already set\n");
                        return -EINVAL;
                } else {
                        acpi_dev = ACPI_COMPANION(dev);
                }
-       } else {
-               acpi_bus_get_device(handle, &acpi_dev);
        }
        if (!acpi_dev)
                return -EINVAL;
@@ -322,29 +284,22 @@ int acpi_unbind_one(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(acpi_unbind_one);
 
-void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr)
-{
-       struct acpi_device *adev;
-
-       if (!acpi_bus_get_device(acpi_get_child(parent, addr), &adev))
-               ACPI_COMPANION_SET(dev, adev);
-}
-EXPORT_SYMBOL_GPL(acpi_preset_companion);
-
 static int acpi_platform_notify(struct device *dev)
 {
        struct acpi_bus_type *type = acpi_get_bus_type(dev);
-       acpi_handle handle;
        int ret;
 
        ret = acpi_bind_one(dev, NULL);
        if (ret && type) {
-               ret = type->find_device(dev, &handle);
-               if (ret) {
+               struct acpi_device *adev;
+
+               adev = type->find_companion(dev);
+               if (!adev) {
                        DBG("Unable to get handle for %s\n", dev_name(dev));
+                       ret = -ENODEV;
                        goto out;
                }
-               ret = acpi_bind_one(dev, handle);
+               ret = acpi_bind_one(dev, adev);
                if (ret)
                        goto out;
        }
index 13b1d39d7cdf57c463534c3a29cfd797e22abfe0..aafe3ca829c28b4a22a8f2a708df6d69093349e9 100644 (file)
@@ -25,8 +25,6 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/acpi.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
 #include <acpi/hed.h>
 
 static struct acpi_device_id acpi_hed_ids[] = {
index a29739c0ba790af9c967efc29ef6907bf06b63d6..b125fdb0b30cc4affcdf50c9c131a9ad7a9e842e 100644 (file)
@@ -28,7 +28,6 @@ int init_acpi_device_notify(void);
 int acpi_scan_init(void);
 void acpi_pci_root_init(void);
 void acpi_pci_link_init(void);
-void acpi_pci_root_hp_init(void);
 void acpi_processor_init(void);
 void acpi_platform_init(void);
 int acpi_sysfs_init(void);
@@ -73,6 +72,8 @@ void acpi_lpss_init(void);
 static inline void acpi_lpss_init(void) {}
 #endif
 
+bool acpi_queue_hotplug_work(struct work_struct *work);
+
 /* --------------------------------------------------------------------------
                      Device Node Initialization / Removal
    -------------------------------------------------------------------------- */
@@ -85,9 +86,9 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
                             int type, unsigned long long sta);
 void acpi_device_add_finalize(struct acpi_device *device);
 void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
-int acpi_bind_one(struct device *dev, acpi_handle handle);
+int acpi_bind_one(struct device *dev, struct acpi_device *adev);
 int acpi_unbind_one(struct device *dev);
-void acpi_bus_device_eject(void *data, u32 ost_src);
+bool acpi_device_is_present(struct acpi_device *adev);
 
 /* --------------------------------------------------------------------------
                                   Power Resource
@@ -105,6 +106,8 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
 int acpi_power_on_resources(struct acpi_device *device, int state);
 int acpi_power_transition(struct acpi_device *device, int state);
 
+int acpi_device_update_power(struct acpi_device *device, int *state_p);
+
 int acpi_wakeup_device_init(void);
 void acpi_early_processor_set_pdc(void);
 
index a2343a1d9e0b1a0e77f3b7a7caf6676499c5f989..9e6816ef280ab7a5def6586cfabd3f60b7cd0ccb 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/errno.h>
 #include <linux/acpi.h>
 #include <linux/numa.h>
-#include <acpi/acpi_bus.h>
 
 #define PREFIX "ACPI: "
 
index 54a20ff4b864d90881cf41be6fbebd33de1c32a9..7e2d8140c33464336cd1eff96bb4a132fceeef5a 100644 (file)
@@ -49,9 +49,6 @@
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
-#include <acpi/acpi.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/processor.h>
 #include "internal.h"
 
 #define _COMPONENT             ACPI_OS_SERVICES
@@ -1215,6 +1212,10 @@ acpi_status acpi_hotplug_execute(acpi_hp_callback func, void *data, u32 src)
        return AE_OK;
 }
 
+bool acpi_queue_hotplug_work(struct work_struct *work)
+{
+       return queue_work(kacpi_hotplug_wq, work);
+}
 
 acpi_status
 acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
@@ -1794,7 +1795,7 @@ acpi_status __init acpi_os_initialize1(void)
 {
        kacpid_wq = alloc_workqueue("kacpid", 0, 1);
        kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1);
-       kacpi_hotplug_wq = alloc_workqueue("kacpi_hotplug", 0, 1);
+       kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0);
        BUG_ON(!kacpid_wq);
        BUG_ON(!kacpi_notify_wq);
        BUG_ON(!kacpi_hotplug_wq);
index 41c5e1b799ef938ff1eed92e4cf48a7c7677f8bd..52d45ea2bc4f63efcfb7e8912b087b1a568d49cc 100644 (file)
@@ -37,8 +37,6 @@
 #include <linux/pci.h>
 #include <linux/acpi.h>
 #include <linux/slab.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
 
 #define PREFIX "ACPI: "
 
index 2652a614deebe8062c71bb4e3c7f26fe8d315a45..ea6b8d16dcc82efb90a8f61f8181d90608461774 100644 (file)
@@ -39,9 +39,7 @@
 #include <linux/pci.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
-
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 #define PREFIX "ACPI: "
 
index 20360e480bd8d81c0070cc25b5cd2cddd05d0447..afafee56cf8be2b7d1dfe5d2de91180ba30a370c 100644 (file)
@@ -35,9 +35,7 @@
 #include <linux/pci-aspm.h>
 #include <linux/acpi.h>
 #include <linux/slab.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-#include <acpi/apei.h>
+#include <acpi/apei.h> /* for acpi_hest_init() */
 
 #include "internal.h"
 
@@ -51,6 +49,12 @@ static int acpi_pci_root_add(struct acpi_device *device,
                             const struct acpi_device_id *not_used);
 static void acpi_pci_root_remove(struct acpi_device *device);
 
+static int acpi_pci_root_scan_dependent(struct acpi_device *adev)
+{
+       acpiphp_check_host_bridge(adev->handle);
+       return 0;
+}
+
 #define ACPI_PCIE_REQ_SUPPORT (OSC_PCI_EXT_CONFIG_SUPPORT \
                                | OSC_PCI_ASPM_SUPPORT \
                                | OSC_PCI_CLOCK_PM_SUPPORT \
@@ -66,7 +70,8 @@ static struct acpi_scan_handler pci_root_handler = {
        .attach = acpi_pci_root_add,
        .detach = acpi_pci_root_remove,
        .hotplug = {
-               .ignore = true,
+               .enabled = true,
+               .scan_dependent = acpi_pci_root_scan_dependent,
        },
 };
 
@@ -624,116 +629,9 @@ static void acpi_pci_root_remove(struct acpi_device *device)
 void __init acpi_pci_root_init(void)
 {
        acpi_hest_init();
-
-       if (!acpi_pci_disabled) {
-               pci_acpi_crs_quirks();
-               acpi_scan_add_handler(&pci_root_handler);
-       }
-}
-/* Support root bridge hotplug */
-
-static void handle_root_bridge_insertion(acpi_handle handle)
-{
-       struct acpi_device *device;
-
-       if (!acpi_bus_get_device(handle, &device)) {
-               dev_printk(KERN_DEBUG, &device->dev,
-                          "acpi device already exists; ignoring notify\n");
+       if (acpi_pci_disabled)
                return;
-       }
-
-       if (acpi_bus_scan(handle))
-               acpi_handle_err(handle, "cannot add bridge to acpi list\n");
-}
-
-static void hotplug_event_root(void *data, u32 type)
-{
-       acpi_handle handle = data;
-       struct acpi_pci_root *root;
-
-       acpi_scan_lock_acquire();
-
-       root = acpi_pci_find_root(handle);
-
-       switch (type) {
-       case ACPI_NOTIFY_BUS_CHECK:
-               /* bus enumerate */
-               acpi_handle_printk(KERN_DEBUG, handle,
-                                  "Bus check notify on %s\n", __func__);
-               if (root)
-                       acpiphp_check_host_bridge(handle);
-               else
-                       handle_root_bridge_insertion(handle);
-
-               break;
-
-       case ACPI_NOTIFY_DEVICE_CHECK:
-               /* device check */
-               acpi_handle_printk(KERN_DEBUG, handle,
-                                  "Device check notify on %s\n", __func__);
-               if (!root)
-                       handle_root_bridge_insertion(handle);
-               break;
-
-       case ACPI_NOTIFY_EJECT_REQUEST:
-               /* request device eject */
-               acpi_handle_printk(KERN_DEBUG, handle,
-                                  "Device eject notify on %s\n", __func__);
-               if (!root)
-                       break;
-
-               get_device(&root->device->dev);
-
-               acpi_scan_lock_release();
-
-               acpi_bus_device_eject(root->device, ACPI_NOTIFY_EJECT_REQUEST);
-               return;
-       default:
-               acpi_handle_warn(handle,
-                                "notify_handler: unknown event type 0x%x\n",
-                                type);
-               break;
-       }
-
-       acpi_scan_lock_release();
-}
-
-static void handle_hotplug_event_root(acpi_handle handle, u32 type,
-                                       void *context)
-{
-       acpi_hotplug_execute(hotplug_event_root, handle, type);
-}
-
-static acpi_status __init
-find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
-{
-       acpi_status status;
-       int *count = (int *)context;
-
-       if (!acpi_is_root_bridge(handle))
-               return AE_OK;
-
-       (*count)++;
-
-       status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
-                                       handle_hotplug_event_root, NULL);
-       if (ACPI_FAILURE(status))
-               acpi_handle_printk(KERN_DEBUG, handle,
-                       "notify handler is not installed, exit status: %u\n",
-                        (unsigned int)status);
-       else
-               acpi_handle_printk(KERN_DEBUG, handle,
-                                  "notify handler is installed\n");
-
-       return AE_OK;
-}
-
-void __init acpi_pci_root_hp_init(void)
-{
-       int num = 0;
-
-       acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-               ACPI_UINT32_MAX, find_root_bridges, NULL, &num, NULL);
 
-       printk(KERN_DEBUG "Found %d acpi root devices\n", num);
+       pci_acpi_crs_quirks();
+       acpi_scan_add_handler_with_hotplug(&pci_root_handler, "pci_root");
 }
index c2ad391d8041ecb6a354e2df07b9d813d817a744..ad7da686e6e6f8d9745a4edf866e174b99b08538 100644 (file)
@@ -42,8 +42,7 @@
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
 #include <linux/sysfs.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include "sleep.h"
 #include "internal.h"
 
index 6a5b152ad4d070511d08d74439155fa17a83ed8a..db061bfd95a8de20aea42e95ae0bda75c6b68a9f 100644 (file)
@@ -3,11 +3,9 @@
 #include <linux/export.h>
 #include <linux/suspend.h>
 #include <linux/bcd.h>
+#include <linux/acpi.h>
 #include <asm/uaccess.h>
 
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-
 #include "sleep.h"
 
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
index b3171f30b319c1244007e686a0b516833443191d..34e7b3c6a08de157c6c962bd0643ddb67176bd5e 100644 (file)
@@ -10,8 +10,7 @@
 #include <linux/export.h>
 #include <linux/dmi.h>
 #include <linux/slab.h>
-
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <acpi/processor.h>
 
 #include "internal.h"
index 644516d9bde6cf18a824d29c3ae1730de30fd1a6..d2d44e0190a31ba64970d3281698179767d08541 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/clockchips.h>
 #include <linux/cpuidle.h>
 #include <linux/syscore_ops.h>
+#include <acpi/processor.h>
 
 /*
  * Include the apic definitions for x86 to have the APIC timer related defines
@@ -46,9 +47,6 @@
 #include <asm/apic.h>
 #endif
 
-#include <acpi/acpi_bus.h>
-#include <acpi/processor.h>
-
 #define PREFIX "ACPI: "
 
 #define ACPI_PROCESSOR_CLASS            "processor"
index 60a7c28fc1674cc21bc38802fed869dc7daf0608..ff90054f04fdb88e15e1279b23b43d78884596f9 100644 (file)
 #include <linux/init.h>
 #include <linux/cpufreq.h>
 #include <linux/slab.h>
-
+#include <linux/acpi.h>
+#include <acpi/processor.h>
 #ifdef CONFIG_X86
 #include <asm/cpufeature.h>
 #endif
 
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-#include <acpi/processor.h>
-
 #define PREFIX "ACPI: "
 
 #define ACPI_PROCESSOR_CLASS           "processor"
index d1d2e7fb5b30778f26d46ce6e72eecb03350ddfc..f95e7584d6e680bfe2b8cc49bc16f7c3a492a517 100644 (file)
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/cpufreq.h>
-
-#include <asm/uaccess.h>
-
-#include <acpi/acpi_bus.h>
+#include <linux/acpi.h>
 #include <acpi/processor.h>
-#include <acpi/acpi_drivers.h>
+#include <asm/uaccess.h>
 
 #define PREFIX "ACPI: "
 
index e7dd2c1fee79b4a097f9b3249a9b0bdaeaa2592a..28baa05b8018dd6c6e6e1db93c1a5ceed74d4d74 100644 (file)
 #include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/cpufreq.h>
-
+#include <linux/acpi.h>
+#include <acpi/processor.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-#include <acpi/processor.h>
-
 #define PREFIX "ACPI: "
 
 #define ACPI_PROCESSOR_CLASS            "processor"
index b78bc605837e19a8f7461f48a59cdc90d64f5128..26e5b50605230e2e34a46d8118486fb1ba2eb939 100644 (file)
@@ -8,8 +8,7 @@
  * the Free Software Foundation version 2.
  */
 
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <linux/wait.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
index fd39459926b1564c2faa3d367a4dbbf05aa60031..5383c81a8a1bdb4b2fe6b6d7d6547efa3b328cc5 100644 (file)
 #include <linux/dmi.h>
 #include <linux/nls.h>
 
-#include <acpi/acpi_drivers.h>
+#include <asm/pgtable.h>
 
 #include "internal.h"
 
 #define _COMPONENT             ACPI_BUS_COMPONENT
 ACPI_MODULE_NAME("scan");
-#define STRUCT_TO_INT(s)       (*((int*)&s))
 extern struct acpi_device *acpi_root;
 
 #define ACPI_BUS_CLASS                 "system_bus"
@@ -27,6 +26,8 @@ extern struct acpi_device *acpi_root;
 
 #define ACPI_IS_ROOT_DEVICE(device)    (!(device)->parent)
 
+#define INVALID_ACPI_HANDLE    ((acpi_handle)empty_zero_page)
+
 /*
  * If set, devices will be hot-removed even if they cannot be put offline
  * gracefully (from the kernel's standpoint).
@@ -202,13 +203,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
        acpi_status status;
        unsigned long long sta;
 
-       /* If there is no handle, the device node has been unregistered. */
-       if (!handle) {
-               dev_dbg(&device->dev, "ACPI handle missing\n");
-               put_device(&device->dev);
-               return -EINVAL;
-       }
-
        /*
         * Carry out two passes here and ignore errors in the first pass,
         * because if the devices in question are memory blocks and
@@ -226,7 +220,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
                dev_warn(errdev, "Offline disabled.\n");
                acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
                                    acpi_bus_online, NULL, NULL, NULL);
-               put_device(&device->dev);
                return -EPERM;
        }
        acpi_bus_offline(handle, 0, (void *)false, (void **)&errdev);
@@ -245,7 +238,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
                        acpi_walk_namespace(ACPI_TYPE_ANY, handle,
                                            ACPI_UINT32_MAX, acpi_bus_online,
                                            NULL, NULL, NULL);
-                       put_device(&device->dev);
                        return -EBUSY;
                }
        }
@@ -255,10 +247,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
 
        acpi_bus_trim(device);
 
-       /* Device node has been unregistered. */
-       put_device(&device->dev);
-       device = NULL;
-
        acpi_evaluate_lck(handle, 0);
        /*
         * TBD: _EJD support.
@@ -285,115 +273,127 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
        return 0;
 }
 
-void acpi_bus_device_eject(void *data, u32 ost_src)
+static int acpi_scan_device_not_present(struct acpi_device *adev)
 {
-       struct acpi_device *device = data;
-       acpi_handle handle = device->handle;
-       u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
-       int error;
+       if (!acpi_device_enumerated(adev)) {
+               dev_warn(&adev->dev, "Still not present\n");
+               return -EALREADY;
+       }
+       acpi_bus_trim(adev);
+       return 0;
+}
 
-       lock_device_hotplug();
-       mutex_lock(&acpi_scan_lock);
+static int acpi_scan_device_check(struct acpi_device *adev)
+{
+       int error;
 
-       if (ost_src == ACPI_NOTIFY_EJECT_REQUEST)
-               acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST,
-                                         ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
+       acpi_bus_get_status(adev);
+       if (adev->status.present || adev->status.functional) {
+               /*
+                * This function is only called for device objects for which
+                * matching scan handlers exist.  The only situation in which
+                * the scan handler is not attached to this device object yet
+                * is when the device has just appeared (either it wasn't
+                * present at all before or it was removed and then added
+                * again).
+                */
+               if (adev->handler) {
+                       dev_warn(&adev->dev, "Already enumerated\n");
+                       return -EALREADY;
+               }
+               error = acpi_bus_scan(adev->handle);
+               if (error) {
+                       dev_warn(&adev->dev, "Namespace scan failure\n");
+                       return error;
+               }
+               if (!adev->handler) {
+                       dev_warn(&adev->dev, "Enumeration failure\n");
+                       error = -ENODEV;
+               }
+       } else {
+               error = acpi_scan_device_not_present(adev);
+       }
+       return error;
+}
 
-       if (device->handler && device->handler->hotplug.mode == AHM_CONTAINER)
-               kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
+static int acpi_scan_bus_check(struct acpi_device *adev)
+{
+       struct acpi_scan_handler *handler = adev->handler;
+       struct acpi_device *child;
+       int error;
 
-       error = acpi_scan_hot_remove(device);
-       if (error == -EPERM) {
-               goto err_support;
-       } else if (error) {
-               goto err_out;
+       acpi_bus_get_status(adev);
+       if (!(adev->status.present || adev->status.functional)) {
+               acpi_scan_device_not_present(adev);
+               return 0;
        }
+       if (handler && handler->hotplug.scan_dependent)
+               return handler->hotplug.scan_dependent(adev);
 
- out:
-       mutex_unlock(&acpi_scan_lock);
-       unlock_device_hotplug();
-       return;
-
- err_support:
-       ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
- err_out:
-       acpi_evaluate_hotplug_ost(handle, ost_src, ost_code, NULL);
-       goto out;
+       error = acpi_bus_scan(adev->handle);
+       if (error) {
+               dev_warn(&adev->dev, "Namespace scan failure\n");
+               return error;
+       }
+       list_for_each_entry(child, &adev->children, node) {
+               error = acpi_scan_bus_check(child);
+               if (error)
+                       return error;
+       }
+       return 0;
 }
 
-static void acpi_scan_bus_device_check(void *data, u32 ost_source)
+static void acpi_device_hotplug(void *data, u32 src)
 {
-       acpi_handle handle = data;
-       struct acpi_device *device = NULL;
        u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
+       struct acpi_device *adev = data;
        int error;
 
        lock_device_hotplug();
        mutex_lock(&acpi_scan_lock);
 
-       if (ost_source != ACPI_NOTIFY_BUS_CHECK) {
-               acpi_bus_get_device(handle, &device);
-               if (device) {
-                       dev_warn(&device->dev, "Attempt to re-insert\n");
-                       goto out;
-               }
-       }
-       error = acpi_bus_scan(handle);
-       if (error) {
-               acpi_handle_warn(handle, "Namespace scan failure\n");
-               goto out;
-       }
-       error = acpi_bus_get_device(handle, &device);
-       if (error) {
-               acpi_handle_warn(handle, "Missing device node object\n");
+       /*
+        * The device object's ACPI handle cannot become invalid as long as we
+        * are holding acpi_scan_lock, but it may have become invalid before
+        * that lock was acquired.
+        */
+       if (adev->handle == INVALID_ACPI_HANDLE)
                goto out;
-       }
-       ost_code = ACPI_OST_SC_SUCCESS;
-       if (device->handler && device->handler->hotplug.mode == AHM_CONTAINER)
-               kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
-
- out:
-       acpi_evaluate_hotplug_ost(handle, ost_source, ost_code, NULL);
-       mutex_unlock(&acpi_scan_lock);
-       unlock_device_hotplug();
-}
 
-static void acpi_hotplug_unsupported(acpi_handle handle, u32 type)
-{
-       u32 ost_status;
-
-       switch (type) {
+       switch (src) {
        case ACPI_NOTIFY_BUS_CHECK:
-               acpi_handle_debug(handle,
-                       "ACPI_NOTIFY_BUS_CHECK event: unsupported\n");
-               ost_status = ACPI_OST_SC_INSERT_NOT_SUPPORTED;
+               error = acpi_scan_bus_check(adev);
                break;
        case ACPI_NOTIFY_DEVICE_CHECK:
-               acpi_handle_debug(handle,
-                       "ACPI_NOTIFY_DEVICE_CHECK event: unsupported\n");
-               ost_status = ACPI_OST_SC_INSERT_NOT_SUPPORTED;
+               error = acpi_scan_device_check(adev);
                break;
        case ACPI_NOTIFY_EJECT_REQUEST:
-               acpi_handle_debug(handle,
-                       "ACPI_NOTIFY_EJECT_REQUEST event: unsupported\n");
-               ost_status = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
+       case ACPI_OST_EC_OSPM_EJECT:
+               error = acpi_scan_hot_remove(adev);
                break;
        default:
-               /* non-hotplug event; possibly handled by other handler */
-               return;
+               error = -EINVAL;
+               break;
        }
+       if (!error)
+               ost_code = ACPI_OST_SC_SUCCESS;
 
-       acpi_evaluate_hotplug_ost(handle, type, ost_status, NULL);
+ out:
+       acpi_evaluate_hotplug_ost(adev->handle, src, ost_code, NULL);
+       put_device(&adev->dev);
+       mutex_unlock(&acpi_scan_lock);
+       unlock_device_hotplug();
 }
 
 static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data)
 {
+       u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
        struct acpi_scan_handler *handler = data;
        struct acpi_device *adev;
        acpi_status status;
 
-       if (!handler->hotplug.enabled)
-               return acpi_hotplug_unsupported(handle, type);
+       if (acpi_bus_get_device(handle, &adev))
+               goto err_out;
 
        switch (type) {
        case ACPI_NOTIFY_BUS_CHECK:
@@ -404,27 +404,27 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data)
                break;
        case ACPI_NOTIFY_EJECT_REQUEST:
                acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n");
-               if (acpi_bus_get_device(handle, &adev))
+               if (!handler->hotplug.enabled) {
+                       acpi_handle_err(handle, "Eject disabled\n");
+                       ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
                        goto err_out;
-
-               get_device(&adev->dev);
-               status = acpi_hotplug_execute(acpi_bus_device_eject, adev, type);
-               if (ACPI_SUCCESS(status))
-                       return;
-
-               put_device(&adev->dev);
-               goto err_out;
+               }
+               acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST,
+                                         ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
+               break;
        default:
                /* non-hotplug event; possibly handled by other handler */
                return;
        }
-       status = acpi_hotplug_execute(acpi_scan_bus_device_check, handle, type);
+       get_device(&adev->dev);
+       status = acpi_hotplug_execute(acpi_device_hotplug, adev, type);
        if (ACPI_SUCCESS(status))
                return;
 
+       put_device(&adev->dev);
+
  err_out:
-       acpi_evaluate_hotplug_ost(handle, type,
-                                 ACPI_OST_SC_NON_SPECIFIC_FAILURE, NULL);
+       acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL);
 }
 
 static ssize_t real_power_state_show(struct device *dev,
@@ -475,7 +475,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
        acpi_evaluate_hotplug_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT,
                                  ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
        get_device(&acpi_device->dev);
-       status = acpi_hotplug_execute(acpi_bus_device_eject, acpi_device,
+       status = acpi_hotplug_execute(acpi_device_hotplug, acpi_device,
                                      ACPI_OST_EC_OSPM_EJECT);
        if (ACPI_SUCCESS(status))
                return count;
@@ -907,9 +907,91 @@ struct bus_type acpi_bus_type = {
        .uevent         = acpi_device_uevent,
 };
 
-static void acpi_bus_data_handler(acpi_handle handle, void *context)
+static void acpi_device_del(struct acpi_device *device)
 {
-       /* Intentionally empty. */
+       mutex_lock(&acpi_device_lock);
+       if (device->parent)
+               list_del(&device->node);
+
+       list_del(&device->wakeup_list);
+       mutex_unlock(&acpi_device_lock);
+
+       acpi_power_add_remove_device(device, false);
+       acpi_device_remove_files(device);
+       if (device->remove)
+               device->remove(device);
+
+       device_del(&device->dev);
+}
+
+static LIST_HEAD(acpi_device_del_list);
+static DEFINE_MUTEX(acpi_device_del_lock);
+
+static void acpi_device_del_work_fn(struct work_struct *work_not_used)
+{
+       for (;;) {
+               struct acpi_device *adev;
+
+               mutex_lock(&acpi_device_del_lock);
+
+               if (list_empty(&acpi_device_del_list)) {
+                       mutex_unlock(&acpi_device_del_lock);
+                       break;
+               }
+               adev = list_first_entry(&acpi_device_del_list,
+                                       struct acpi_device, del_list);
+               list_del(&adev->del_list);
+
+               mutex_unlock(&acpi_device_del_lock);
+
+               acpi_device_del(adev);
+               /*
+                * Drop references to all power resources that might have been
+                * used by the device.
+                */
+               acpi_power_transition(adev, ACPI_STATE_D3_COLD);
+               put_device(&adev->dev);
+       }
+}
+
+/**
+ * acpi_scan_drop_device - Drop an ACPI device object.
+ * @handle: Handle of an ACPI namespace node, not used.
+ * @context: Address of the ACPI device object to drop.
+ *
+ * This is invoked by acpi_ns_delete_node() during the removal of the ACPI
+ * namespace node the device object pointed to by @context is attached to.
+ *
+ * The unregistration is carried out asynchronously to avoid running
+ * acpi_device_del() under the ACPICA's namespace mutex and the list is used to
+ * ensure the correct ordering (the device objects must be unregistered in the
+ * same order in which the corresponding namespace nodes are deleted).
+ */
+static void acpi_scan_drop_device(acpi_handle handle, void *context)
+{
+       static DECLARE_WORK(work, acpi_device_del_work_fn);
+       struct acpi_device *adev = context;
+
+       mutex_lock(&acpi_device_del_lock);
+
+       /*
+        * Use the ACPI hotplug workqueue which is ordered, so this work item
+        * won't run after any hotplug work items submitted subsequently.  That
+        * prevents attempts to register device objects identical to those being
+        * deleted from happening concurrently (such attempts result from
+        * hotplug events handled via the ACPI hotplug workqueue).  It also will
+        * run after all of the work items submitted previosuly, which helps
+        * those work items to ensure that they are not accessing stale device
+        * objects.
+        */
+       if (list_empty(&acpi_device_del_list))
+               acpi_queue_hotplug_work(&work);
+
+       list_add_tail(&adev->del_list, &acpi_device_del_list);
+       /* Make acpi_ns_validate_handle() return NULL for this handle. */
+       adev->handle = INVALID_ACPI_HANDLE;
+
+       mutex_unlock(&acpi_device_del_lock);
 }
 
 int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
@@ -919,7 +1001,7 @@ int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
        if (!device)
                return -EINVAL;
 
-       status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device);
+       status = acpi_get_data(handle, acpi_scan_drop_device, (void **)device);
        if (ACPI_FAILURE(status) || !*device) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n",
                                  handle));
@@ -939,7 +1021,7 @@ int acpi_device_add(struct acpi_device *device,
        if (device->handle) {
                acpi_status status;
 
-               status = acpi_attach_data(device->handle, acpi_bus_data_handler,
+               status = acpi_attach_data(device->handle, acpi_scan_drop_device,
                                          device);
                if (ACPI_FAILURE(status)) {
                        acpi_handle_err(device->handle,
@@ -957,6 +1039,7 @@ int acpi_device_add(struct acpi_device *device,
        INIT_LIST_HEAD(&device->node);
        INIT_LIST_HEAD(&device->wakeup_list);
        INIT_LIST_HEAD(&device->physical_node_list);
+       INIT_LIST_HEAD(&device->del_list);
        mutex_init(&device->physical_node_lock);
 
        new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL);
@@ -1020,37 +1103,10 @@ int acpi_device_add(struct acpi_device *device,
        mutex_unlock(&acpi_device_lock);
 
  err_detach:
-       acpi_detach_data(device->handle, acpi_bus_data_handler);
+       acpi_detach_data(device->handle, acpi_scan_drop_device);
        return result;
 }
 
-static void acpi_device_unregister(struct acpi_device *device)
-{
-       mutex_lock(&acpi_device_lock);
-       if (device->parent)
-               list_del(&device->node);
-
-       list_del(&device->wakeup_list);
-       mutex_unlock(&acpi_device_lock);
-
-       acpi_detach_data(device->handle, acpi_bus_data_handler);
-
-       acpi_power_add_remove_device(device, false);
-       acpi_device_remove_files(device);
-       if (device->remove)
-               device->remove(device);
-
-       device_del(&device->dev);
-       /*
-        * Transition the device to D3cold to drop the reference counts of all
-        * power resources the device depends on and turn off the ones that have
-        * no more references.
-        */
-       acpi_device_set_power(device, ACPI_STATE_D3_COLD);
-       device->handle = NULL;
-       put_device(&device->dev);
-}
-
 /* --------------------------------------------------------------------------
                                  Driver Management
    -------------------------------------------------------------------------- */
@@ -1624,11 +1680,13 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
        device->device_type = type;
        device->handle = handle;
        device->parent = acpi_bus_get_parent(handle);
-       STRUCT_TO_INT(device->status) = sta;
+       acpi_set_device_status(device, sta);
        acpi_device_get_busid(device);
        acpi_set_pnp_ids(handle, &device->pnp, type);
        acpi_bus_get_flags(device);
        device->flags.match_driver = false;
+       device->flags.initialized = true;
+       device->flags.visited = false;
        device_initialize(&device->dev);
        dev_set_uevent_suppress(&device->dev, true);
 }
@@ -1713,6 +1771,15 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type,
        return 0;
 }
 
+bool acpi_device_is_present(struct acpi_device *adev)
+{
+       if (adev->status.present || adev->status.functional)
+               return true;
+
+       adev->flags.initialized = false;
+       return false;
+}
+
 static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler,
                                       char *idstr,
                                       const struct acpi_device_id **matchid)
@@ -1772,7 +1839,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type)
         */
        list_for_each_entry(hwid, &pnp.ids, list) {
                handler = acpi_scan_match_handler(hwid->id, NULL);
-               if (handler && !handler->hotplug.ignore) {
+               if (handler) {
                        acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
                                        acpi_hotplug_notify_cb, handler);
                        break;
@@ -1806,18 +1873,6 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
 
        acpi_scan_init_hotplug(handle, type);
 
-       if (!(sta & ACPI_STA_DEVICE_PRESENT) &&
-           !(sta & ACPI_STA_DEVICE_FUNCTIONING)) {
-               struct acpi_device_wakeup wakeup;
-
-               if (acpi_has_method(handle, "_PRW")) {
-                       acpi_bus_extract_wakeup_device_power_package(handle,
-                                                                    &wakeup);
-                       acpi_power_resources_list_free(&wakeup.resources);
-               }
-               return AE_CTRL_DEPTH;
-       }
-
        acpi_add_single_object(&device, handle, type, sta);
        if (!device)
                return AE_CTRL_DEPTH;
@@ -1852,36 +1907,40 @@ static int acpi_scan_attach_handler(struct acpi_device *device)
        return ret;
 }
 
-static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used,
-                                         void *not_used, void **ret_not_used)
+static void acpi_bus_attach(struct acpi_device *device)
 {
-       struct acpi_device *device;
-       unsigned long long sta_not_used;
+       struct acpi_device *child;
        int ret;
 
-       /*
-        * Ignore errors ignored by acpi_bus_check_add() to avoid terminating
-        * namespace walks prematurely.
-        */
-       if (acpi_bus_type_and_status(handle, &ret, &sta_not_used))
-               return AE_OK;
-
-       if (acpi_bus_get_device(handle, &device))
-               return AE_CTRL_DEPTH;
-
+       acpi_bus_get_status(device);
+       /* Skip devices that are not present. */
+       if (!acpi_device_is_present(device)) {
+               device->flags.visited = false;
+               return;
+       }
        if (device->handler)
-               return AE_OK;
+               goto ok;
 
+       if (!device->flags.initialized) {
+               acpi_bus_update_power(device, NULL);
+               device->flags.initialized = true;
+       }
+       device->flags.visited = false;
        ret = acpi_scan_attach_handler(device);
        if (ret < 0)
-               return AE_CTRL_DEPTH;
+               return;
 
        device->flags.match_driver = true;
-       if (ret > 0)
-               return AE_OK;
+       if (!ret) {
+               ret = device_attach(&device->dev);
+               if (ret < 0)
+                       return;
+       }
+       device->flags.visited = true;
 
-       ret = device_attach(&device->dev);
-       return ret >= 0 ? AE_OK : AE_CTRL_DEPTH;
+ ok:
+       list_for_each_entry(child, &device->children, node)
+               acpi_bus_attach(child);
 }
 
 /**
@@ -1901,75 +1960,48 @@ static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used,
 int acpi_bus_scan(acpi_handle handle)
 {
        void *device = NULL;
-       int error = 0;
 
        if (ACPI_SUCCESS(acpi_bus_check_add(handle, 0, NULL, &device)))
                acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
                                    acpi_bus_check_add, NULL, NULL, &device);
 
-       if (!device)
-               error = -ENODEV;
-       else if (ACPI_SUCCESS(acpi_bus_device_attach(handle, 0, NULL, NULL)))
-               acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
-                                   acpi_bus_device_attach, NULL, NULL, NULL);
-
-       return error;
-}
-EXPORT_SYMBOL(acpi_bus_scan);
-
-static acpi_status acpi_bus_device_detach(acpi_handle handle, u32 lvl_not_used,
-                                         void *not_used, void **ret_not_used)
-{
-       struct acpi_device *device = NULL;
-
-       if (!acpi_bus_get_device(handle, &device)) {
-               struct acpi_scan_handler *dev_handler = device->handler;
-
-               if (dev_handler) {
-                       if (dev_handler->detach)
-                               dev_handler->detach(device);
-
-                       device->handler = NULL;
-               } else {
-                       device_release_driver(&device->dev);
-               }
+       if (device) {
+               acpi_bus_attach(device);
+               return 0;
        }
-       return AE_OK;
-}
-
-static acpi_status acpi_bus_remove(acpi_handle handle, u32 lvl_not_used,
-                                  void *not_used, void **ret_not_used)
-{
-       struct acpi_device *device = NULL;
-
-       if (!acpi_bus_get_device(handle, &device))
-               acpi_device_unregister(device);
-
-       return AE_OK;
+       return -ENODEV;
 }
+EXPORT_SYMBOL(acpi_bus_scan);
 
 /**
- * acpi_bus_trim - Remove ACPI device node and all of its descendants
- * @start: Root of the ACPI device nodes subtree to remove.
+ * acpi_bus_trim - Detach scan handlers and drivers from ACPI device objects.
+ * @adev: Root of the ACPI namespace scope to walk.
  *
  * Must be called under acpi_scan_lock.
  */
-void acpi_bus_trim(struct acpi_device *start)
+void acpi_bus_trim(struct acpi_device *adev)
 {
+       struct acpi_scan_handler *handler = adev->handler;
+       struct acpi_device *child;
+
+       list_for_each_entry_reverse(child, &adev->children, node)
+               acpi_bus_trim(child);
+
+       if (handler) {
+               if (handler->detach)
+                       handler->detach(adev);
+
+               adev->handler = NULL;
+       } else {
+               device_release_driver(&adev->dev);
+       }
        /*
-        * Execute acpi_bus_device_detach() as a post-order callback to detach
-        * all ACPI drivers from the device nodes being removed.
-        */
-       acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL,
-                           acpi_bus_device_detach, NULL, NULL);
-       acpi_bus_device_detach(start->handle, 0, NULL, NULL);
-       /*
-        * Execute acpi_bus_remove() as a post-order callback to remove device
-        * nodes in the given namespace scope.
+        * Most likely, the device is going away, so put it into D3cold before
+        * that.
         */
-       acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL,
-                           acpi_bus_remove, NULL, NULL);
-       acpi_bus_remove(start->handle, 0, NULL, NULL);
+       acpi_device_set_power(adev, ACPI_STATE_D3_COLD);
+       adev->flags.initialized = false;
+       adev->flags.visited = false;
 }
 EXPORT_SYMBOL_GPL(acpi_bus_trim);
 
@@ -2047,14 +2079,14 @@ int __init acpi_scan_init(void)
 
        result = acpi_bus_scan_fixed();
        if (result) {
-               acpi_device_unregister(acpi_root);
+               acpi_detach_data(acpi_root->handle, acpi_scan_drop_device);
+               acpi_device_del(acpi_root);
+               put_device(&acpi_root->dev);
                goto out;
        }
 
        acpi_update_all_gpes();
 
-       acpi_pci_root_hp_init();
-
  out:
        mutex_unlock(&acpi_scan_lock);
        return result;
index 721e949e606edff0e2b62dc1e4d12e201bbbad4d..208ac8c8503a7c6e702b99ca033da56b3aef935f 100644 (file)
 #include <linux/reboot.h>
 #include <linux/acpi.h>
 #include <linux/module.h>
-
 #include <asm/io.h>
 
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-
 #include "internal.h"
 #include "sleep.h"
 
index 6dbc3ca45223a1ba30f995f016ecd965dd4861f7..443dc9366052f623b14b6ce278a2bafff81e15ac 100644 (file)
@@ -5,7 +5,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/moduleparam.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 #include "internal.h"
 
index 0d9f46b5ae6d100a64ca3c3410ab23ac2af361fe..1fd21ad69c98f5613743922d6a61224359c18e94 100644 (file)
 #include <linux/kmod.h>
 #include <linux/reboot.h>
 #include <linux/device.h>
-#include <asm/uaccess.h>
 #include <linux/thermal.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
+#include <asm/uaccess.h>
 
 #define PREFIX "ACPI: "
 
index 6d408bfbbb1d0c66dbef28d02137dbda0777d9f4..1336b9151479dd1cab2fa7972c2ba04996d7762c 100644 (file)
@@ -30,8 +30,6 @@
 #include <linux/types.h>
 #include <linux/hardirq.h>
 #include <linux/acpi.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
 
 #include "internal.h"
 
index 995e91bcb97b7b4d5f21d585de1f5a7e46bd9ebd..b727d105046d234ae8ef2a5669e53e61b82e7123 100644 (file)
 #include <linux/pci.h>
 #include <linux/pci_ids.h>
 #include <linux/slab.h>
-#include <asm/uaccess.h>
 #include <linux/dmi.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
 #include <linux/suspend.h>
+#include <linux/acpi.h>
 #include <acpi/video.h>
+#include <asm/uaccess.h>
 
 #include "internal.h"
 
index 7bfbe40bc43bcb5e736c4c77788d4b7d577de160..1638401ab282ef2dc554fff498ebaba8babf8daf 100644 (file)
@@ -5,7 +5,6 @@
 
 #include <linux/init.h>
 #include <linux/acpi.h>
-#include <acpi/acpi_drivers.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 
index 14f1e95063380a5e2a315428fc8a4d5e8bcc39d3..ef8642e12a7627e364b92ff4002a7ed632d209db 100644 (file)
@@ -83,6 +83,8 @@ enum board_ids {
 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
 static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
                                 unsigned long deadline);
+static void ahci_mcp89_apple_enable(struct pci_dev *pdev);
+static bool is_mcp89_apple(struct pci_dev *pdev);
 static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
                                unsigned long deadline);
 #ifdef CONFIG_PM
@@ -661,6 +663,10 @@ static int ahci_pci_device_resume(struct pci_dev *pdev)
        if (rc)
                return rc;
 
+       /* Apple BIOS helpfully mangles the registers on resume */
+       if (is_mcp89_apple(pdev))
+               ahci_mcp89_apple_enable(pdev);
+
        if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
                rc = ahci_pci_reset_controller(host);
                if (rc)
@@ -777,6 +783,48 @@ static void ahci_p5wdh_workaround(struct ata_host *host)
        }
 }
 
+/*
+ * Macbook7,1 firmware forcibly disables MCP89 AHCI and changes PCI ID when
+ * booting in BIOS compatibility mode.  We restore the registers but not ID.
+ */
+static void ahci_mcp89_apple_enable(struct pci_dev *pdev)
+{
+       u32 val;
+
+       printk(KERN_INFO "ahci: enabling MCP89 AHCI mode\n");
+
+       pci_read_config_dword(pdev, 0xf8, &val);
+       val |= 1 << 0x1b;
+       /* the following changes the device ID, but appears not to affect function */
+       /* val = (val & ~0xf0000000) | 0x80000000; */
+       pci_write_config_dword(pdev, 0xf8, val);
+
+       pci_read_config_dword(pdev, 0x54c, &val);
+       val |= 1 << 0xc;
+       pci_write_config_dword(pdev, 0x54c, val);
+
+       pci_read_config_dword(pdev, 0x4a4, &val);
+       val &= 0xff;
+       val |= 0x01060100;
+       pci_write_config_dword(pdev, 0x4a4, val);
+
+       pci_read_config_dword(pdev, 0x54c, &val);
+       val &= ~(1 << 0xc);
+       pci_write_config_dword(pdev, 0x54c, val);
+
+       pci_read_config_dword(pdev, 0xf8, &val);
+       val &= ~(1 << 0x1b);
+       pci_write_config_dword(pdev, 0xf8, val);
+}
+
+static bool is_mcp89_apple(struct pci_dev *pdev)
+{
+       return pdev->vendor == PCI_VENDOR_ID_NVIDIA &&
+               pdev->device == PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA &&
+               pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE &&
+               pdev->subsystem_device == 0xcb89;
+}
+
 /* only some SB600 ahci controllers can do 64bit DMA */
 static bool ahci_sb600_enable_64bit(struct pci_dev *pdev)
 {
@@ -1209,15 +1257,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (pdev->vendor == PCI_VENDOR_ID_MARVELL && !marvell_enable)
                return -ENODEV;
 
-       /*
-        * For some reason, MCP89 on MacBook 7,1 doesn't work with
-        * ahci, use ata_generic instead.
-        */
-       if (pdev->vendor == PCI_VENDOR_ID_NVIDIA &&
-           pdev->device == PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA &&
-           pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE &&
-           pdev->subsystem_device == 0xcb89)
-               return -ENODEV;
+       /* Apple BIOS on MCP89 prevents us using AHCI */
+       if (is_mcp89_apple(pdev))
+               ahci_mcp89_apple_enable(pdev);
 
        /* Promise's PDC42819 is a SAS/SATA controller that has an AHCI mode.
         * At the moment, we can only use the AHCI mode. Let the users know
index ae2d73fe321e2f2c62d8e5709a788905edfd5a89..2daa28891b7f466864ae8874a83f764d9e29675c 100644 (file)
@@ -34,10 +34,21 @@ enum {
        HOST_TIMER1MS = 0xe0,                   /* Timer 1-ms */
 };
 
+enum ahci_imx_type {
+       AHCI_IMX53,
+       AHCI_IMX6Q,
+};
+
 struct imx_ahci_priv {
        struct platform_device *ahci_pdev;
+       enum ahci_imx_type type;
+
+       /* i.MX53 clock */
+       struct clk *sata_gate_clk;
+       /* Common clock */
        struct clk *sata_ref_clk;
        struct clk *ahb_clk;
+
        struct regmap *gpr;
        bool no_device;
        bool first_time;
@@ -47,6 +58,59 @@ static int ahci_imx_hotplug;
 module_param_named(hotplug, ahci_imx_hotplug, int, 0644);
 MODULE_PARM_DESC(hotplug, "AHCI IMX hot-plug support (0=Don't support, 1=support)");
 
+static int imx_sata_clock_enable(struct device *dev)
+{
+       struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent);
+       int ret;
+
+       if (imxpriv->type == AHCI_IMX53) {
+               ret = clk_prepare_enable(imxpriv->sata_gate_clk);
+               if (ret < 0) {
+                       dev_err(dev, "prepare-enable sata_gate clock err:%d\n",
+                               ret);
+                       return ret;
+               }
+       }
+
+       ret = clk_prepare_enable(imxpriv->sata_ref_clk);
+       if (ret < 0) {
+               dev_err(dev, "prepare-enable sata_ref clock err:%d\n",
+                       ret);
+               goto clk_err;
+       }
+
+       if (imxpriv->type == AHCI_IMX6Q) {
+               regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
+                                  IMX6Q_GPR13_SATA_MPLL_CLK_EN,
+                                  IMX6Q_GPR13_SATA_MPLL_CLK_EN);
+       }
+
+       usleep_range(1000, 2000);
+
+       return 0;
+
+clk_err:
+       if (imxpriv->type == AHCI_IMX53)
+               clk_disable_unprepare(imxpriv->sata_gate_clk);
+       return ret;
+}
+
+static void imx_sata_clock_disable(struct device *dev)
+{
+       struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent);
+
+       if (imxpriv->type == AHCI_IMX6Q) {
+               regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
+                                  IMX6Q_GPR13_SATA_MPLL_CLK_EN,
+                                  !IMX6Q_GPR13_SATA_MPLL_CLK_EN);
+       }
+
+       clk_disable_unprepare(imxpriv->sata_ref_clk);
+
+       if (imxpriv->type == AHCI_IMX53)
+               clk_disable_unprepare(imxpriv->sata_gate_clk);
+}
+
 static void ahci_imx_error_handler(struct ata_port *ap)
 {
        u32 reg_val;
@@ -72,16 +136,29 @@ static void ahci_imx_error_handler(struct ata_port *ap)
         */
        reg_val = readl(mmio + PORT_PHY_CTL);
        writel(reg_val | PORT_PHY_CTL_PDDQ_LOC, mmio + PORT_PHY_CTL);
-       regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
-                       IMX6Q_GPR13_SATA_MPLL_CLK_EN,
-                       !IMX6Q_GPR13_SATA_MPLL_CLK_EN);
-       clk_disable_unprepare(imxpriv->sata_ref_clk);
+       imx_sata_clock_disable(ap->dev);
        imxpriv->no_device = true;
 }
 
+static int ahci_imx_softreset(struct ata_link *link, unsigned int *class,
+                      unsigned long deadline)
+{
+       struct ata_port *ap = link->ap;
+       struct imx_ahci_priv *imxpriv = dev_get_drvdata(ap->dev->parent);
+       int ret = -EIO;
+
+       if (imxpriv->type == AHCI_IMX53)
+               ret = ahci_pmp_retry_srst_ops.softreset(link, class, deadline);
+       else if (imxpriv->type == AHCI_IMX6Q)
+               ret = ahci_ops.softreset(link, class, deadline);
+
+       return ret;
+}
+
 static struct ata_port_operations ahci_imx_ops = {
        .inherits       = &ahci_platform_ops,
        .error_handler  = ahci_imx_error_handler,
+       .softreset      = ahci_imx_softreset,
 };
 
 static const struct ata_port_info ahci_imx_port_info = {
@@ -91,51 +168,15 @@ static const struct ata_port_info ahci_imx_port_info = {
        .port_ops       = &ahci_imx_ops,
 };
 
-static int imx6q_sata_init(struct device *dev, void __iomem *mmio)
+static int imx_sata_init(struct device *dev, void __iomem *mmio)
 {
        int ret = 0;
        unsigned int reg_val;
        struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent);
 
-       imxpriv->gpr =
-               syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr");
-       if (IS_ERR(imxpriv->gpr)) {
-               dev_err(dev, "failed to find fsl,imx6q-iomux-gpr regmap\n");
-               return PTR_ERR(imxpriv->gpr);
-       }
-
-       ret = clk_prepare_enable(imxpriv->sata_ref_clk);
-       if (ret < 0) {
-               dev_err(dev, "prepare-enable sata_ref clock err:%d\n", ret);
+       ret = imx_sata_clock_enable(dev);
+       if (ret < 0)
                return ret;
-       }
-
-       /*
-        * set PHY Paremeters, two steps to configure the GPR13,
-        * one write for rest of parameters, mask of first write
-        * is 0x07fffffd, and the other one write for setting
-        * the mpll_clk_en.
-        */
-       regmap_update_bits(imxpriv->gpr, 0x34, IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK
-                       | IMX6Q_GPR13_SATA_RX_LOS_LVL_MASK
-                       | IMX6Q_GPR13_SATA_RX_DPLL_MODE_MASK
-                       | IMX6Q_GPR13_SATA_SPD_MODE_MASK
-                       | IMX6Q_GPR13_SATA_MPLL_SS_EN
-                       | IMX6Q_GPR13_SATA_TX_ATTEN_MASK
-                       | IMX6Q_GPR13_SATA_TX_BOOST_MASK
-                       | IMX6Q_GPR13_SATA_TX_LVL_MASK
-                       | IMX6Q_GPR13_SATA_TX_EDGE_RATE
-                       , IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB
-                       | IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M
-                       | IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_4F
-                       | IMX6Q_GPR13_SATA_SPD_MODE_3P0G
-                       | IMX6Q_GPR13_SATA_MPLL_SS_EN
-                       | IMX6Q_GPR13_SATA_TX_ATTEN_9_16
-                       | IMX6Q_GPR13_SATA_TX_BOOST_3_33_DB
-                       | IMX6Q_GPR13_SATA_TX_LVL_1_025_V);
-       regmap_update_bits(imxpriv->gpr, 0x34, IMX6Q_GPR13_SATA_MPLL_CLK_EN,
-                       IMX6Q_GPR13_SATA_MPLL_CLK_EN);
-       usleep_range(100, 200);
 
        /*
         * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL,
@@ -161,13 +202,9 @@ static int imx6q_sata_init(struct device *dev, void __iomem *mmio)
        return 0;
 }
 
-static void imx6q_sata_exit(struct device *dev)
+static void imx_sata_exit(struct device *dev)
 {
-       struct imx_ahci_priv *imxpriv =  dev_get_drvdata(dev->parent);
-
-       regmap_update_bits(imxpriv->gpr, 0x34, IMX6Q_GPR13_SATA_MPLL_CLK_EN,
-                       !IMX6Q_GPR13_SATA_MPLL_CLK_EN);
-       clk_disable_unprepare(imxpriv->sata_ref_clk);
+       imx_sata_clock_disable(dev);
 }
 
 static int imx_ahci_suspend(struct device *dev)
@@ -178,12 +215,8 @@ static int imx_ahci_suspend(struct device *dev)
         * If no_device is set, The CLKs had been gated off in the
         * initialization so don't do it again here.
         */
-       if (!imxpriv->no_device) {
-               regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
-                               IMX6Q_GPR13_SATA_MPLL_CLK_EN,
-                               !IMX6Q_GPR13_SATA_MPLL_CLK_EN);
-               clk_disable_unprepare(imxpriv->sata_ref_clk);
-       }
+       if (!imxpriv->no_device)
+               imx_sata_clock_disable(dev);
 
        return 0;
 }
@@ -191,34 +224,26 @@ static int imx_ahci_suspend(struct device *dev)
 static int imx_ahci_resume(struct device *dev)
 {
        struct imx_ahci_priv *imxpriv =  dev_get_drvdata(dev->parent);
-       int ret;
-
-       if (!imxpriv->no_device) {
-               ret = clk_prepare_enable(imxpriv->sata_ref_clk);
-               if (ret < 0) {
-                       dev_err(dev, "pre-enable sata_ref clock err:%d\n", ret);
-                       return ret;
-               }
+       int ret = 0;
 
-               regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
-                               IMX6Q_GPR13_SATA_MPLL_CLK_EN,
-                               IMX6Q_GPR13_SATA_MPLL_CLK_EN);
-               usleep_range(1000, 2000);
-       }
+       if (!imxpriv->no_device)
+               ret = imx_sata_clock_enable(dev);
 
-       return 0;
+       return ret;
 }
 
-static struct ahci_platform_data imx6q_sata_pdata = {
-       .init = imx6q_sata_init,
-       .exit = imx6q_sata_exit,
-       .ata_port_info = &ahci_imx_port_info,
-       .suspend = imx_ahci_suspend,
-       .resume = imx_ahci_resume,
+static struct ahci_platform_data imx_sata_pdata = {
+       .init           = imx_sata_init,
+       .exit           = imx_sata_exit,
+       .ata_port_info  = &ahci_imx_port_info,
+       .suspend        = imx_ahci_suspend,
+       .resume         = imx_ahci_resume,
+
 };
 
 static const struct of_device_id imx_ahci_of_match[] = {
-       { .compatible = "fsl,imx6q-ahci", .data = &imx6q_sata_pdata},
+       { .compatible = "fsl,imx53-ahci", .data = (void *)AHCI_IMX53 },
+       { .compatible = "fsl,imx6q-ahci", .data = (void *)AHCI_IMX6Q },
        {},
 };
 MODULE_DEVICE_TABLE(of, imx_ahci_of_match);
@@ -228,12 +253,20 @@ static int imx_ahci_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        struct resource *mem, *irq, res[2];
        const struct of_device_id *of_id;
+       enum ahci_imx_type type;
        const struct ahci_platform_data *pdata = NULL;
        struct imx_ahci_priv *imxpriv;
        struct device *ahci_dev;
        struct platform_device *ahci_pdev;
        int ret;
 
+       of_id = of_match_device(imx_ahci_of_match, dev);
+       if (!of_id)
+               return -EINVAL;
+
+       type = (enum ahci_imx_type)of_id->data;
+       pdata = &imx_sata_pdata;
+
        imxpriv = devm_kzalloc(dev, sizeof(*imxpriv), GFP_KERNEL);
        if (!imxpriv) {
                dev_err(dev, "can't alloc ahci_host_priv\n");
@@ -249,6 +282,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
 
        imxpriv->no_device = false;
        imxpriv->first_time = true;
+       imxpriv->type = type;
+
        imxpriv->ahb_clk = devm_clk_get(dev, "ahb");
        if (IS_ERR(imxpriv->ahb_clk)) {
                dev_err(dev, "can't get ahb clock.\n");
@@ -256,6 +291,15 @@ static int imx_ahci_probe(struct platform_device *pdev)
                goto err_out;
        }
 
+       if (type == AHCI_IMX53) {
+               imxpriv->sata_gate_clk = devm_clk_get(dev, "sata_gate");
+               if (IS_ERR(imxpriv->sata_gate_clk)) {
+                       dev_err(dev, "can't get sata_gate clock.\n");
+                       ret = PTR_ERR(imxpriv->sata_gate_clk);
+                       goto err_out;
+               }
+       }
+
        imxpriv->sata_ref_clk = devm_clk_get(dev, "sata_ref");
        if (IS_ERR(imxpriv->sata_ref_clk)) {
                dev_err(dev, "can't get sata_ref clock.\n");
@@ -266,14 +310,6 @@ static int imx_ahci_probe(struct platform_device *pdev)
        imxpriv->ahci_pdev = ahci_pdev;
        platform_set_drvdata(pdev, imxpriv);
 
-       of_id = of_match_device(imx_ahci_of_match, dev);
-       if (of_id) {
-               pdata = of_id->data;
-       } else {
-               ret = -EINVAL;
-               goto err_out;
-       }
-
        mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
        if (!mem || !irq) {
@@ -289,6 +325,42 @@ static int imx_ahci_probe(struct platform_device *pdev)
        ahci_dev->dma_mask = &ahci_dev->coherent_dma_mask;
        ahci_dev->of_node = dev->of_node;
 
+       if (type == AHCI_IMX6Q) {
+               imxpriv->gpr = syscon_regmap_lookup_by_compatible(
+                                                       "fsl,imx6q-iomuxc-gpr");
+               if (IS_ERR(imxpriv->gpr)) {
+                       dev_err(dev,
+                               "failed to find fsl,imx6q-iomux-gpr regmap\n");
+                       return PTR_ERR(imxpriv->gpr);
+               }
+
+               /*
+                * Set PHY Paremeters, two steps to configure the GPR13,
+                * one write for rest of parameters, mask of first write
+                * is 0x07fffffe, and the other one write for setting
+                * the mpll_clk_en happens in imx_sata_clock_enable().
+                */
+               regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
+                                  IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK |
+                                  IMX6Q_GPR13_SATA_RX_LOS_LVL_MASK |
+                                  IMX6Q_GPR13_SATA_RX_DPLL_MODE_MASK |
+                                  IMX6Q_GPR13_SATA_SPD_MODE_MASK |
+                                  IMX6Q_GPR13_SATA_MPLL_SS_EN |
+                                  IMX6Q_GPR13_SATA_TX_ATTEN_MASK |
+                                  IMX6Q_GPR13_SATA_TX_BOOST_MASK |
+                                  IMX6Q_GPR13_SATA_TX_LVL_MASK |
+                                  IMX6Q_GPR13_SATA_MPLL_CLK_EN |
+                                  IMX6Q_GPR13_SATA_TX_EDGE_RATE,
+                                  IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB |
+                                  IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M |
+                                  IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_4F |
+                                  IMX6Q_GPR13_SATA_SPD_MODE_3P0G |
+                                  IMX6Q_GPR13_SATA_MPLL_SS_EN |
+                                  IMX6Q_GPR13_SATA_TX_ATTEN_9_16 |
+                                  IMX6Q_GPR13_SATA_TX_BOOST_3_33_DB |
+                                  IMX6Q_GPR13_SATA_TX_LVL_1_025_V);
+       }
+
        ret = platform_device_add_resources(ahci_pdev, res, 2);
        if (ret)
                goto err_out;
index f8f38a08abc570e271b487f3ab761d26ceef0f27..7d196656adb5581533517a6ed0ec49d8c2966b58 100644 (file)
@@ -221,13 +221,6 @@ static struct pci_device_id ata_generic[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_OPTI,   PCI_DEVICE_ID_OPTI_82C558), },
        { PCI_DEVICE(PCI_VENDOR_ID_CENATEK,PCI_DEVICE_ID_CENATEK_IDE),
          .driver_data = ATA_GEN_FORCE_DMA },
-       /*
-        * For some reason, MCP89 on MacBook 7,1 doesn't work with
-        * ahci, use ata_generic instead.
-        */
-       { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA,
-         PCI_VENDOR_ID_APPLE, 0xcb89,
-         .driver_data = ATA_GEN_FORCE_DMA },
 #if !defined(CONFIG_PATA_TOSHIBA) && !defined(CONFIG_PATA_TOSHIBA_MODULE)
        { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), },
        { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2),  },
index 4372cfa883c9c36cf2624f88186ef3e0e7b27d31..9e69a5308693de59abd5c596244033af43f7b3a8 100644 (file)
@@ -20,8 +20,6 @@
 #include <scsi/scsi_device.h>
 #include "libata.h"
 
-#include <acpi/acpi_bus.h>
-
 unsigned int ata_acpi_gtf_filter = ATA_ACPI_FILTER_DEFAULT;
 module_param_named(acpi_gtf_filter, ata_acpi_gtf_filter, int, 0644);
 MODULE_PARM_DESC(acpi_gtf_filter, "filter mask for ACPI _GTF commands, set to filter out (0x1=set xfermode, 0x2=lock/freeze lock, 0x4=DIPM, 0x8=FPDMA non-zero offset, 0x10=FPDMA DMA Setup FIS auto-activate)");
@@ -180,12 +178,12 @@ static const struct acpi_dock_ops ata_acpi_ap_dock_ops = {
 /* bind acpi handle to pata port */
 void ata_acpi_bind_port(struct ata_port *ap)
 {
-       acpi_handle host_handle = ACPI_HANDLE(ap->host->dev);
+       struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev);
 
-       if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_handle)
+       if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_companion)
                return;
 
-       acpi_preset_companion(&ap->tdev, host_handle, ap->port_no);
+       acpi_preset_companion(&ap->tdev, host_companion, ap->port_no);
 
        if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0)
                ap->pflags |= ATA_PFLAG_INIT_GTM_VALID;
@@ -198,17 +196,17 @@ void ata_acpi_bind_port(struct ata_port *ap)
 void ata_acpi_bind_dev(struct ata_device *dev)
 {
        struct ata_port *ap = dev->link->ap;
-       acpi_handle port_handle = ACPI_HANDLE(&ap->tdev);
-       acpi_handle host_handle = ACPI_HANDLE(ap->host->dev);
-       acpi_handle parent_handle;
+       struct acpi_device *port_companion = ACPI_COMPANION(&ap->tdev);
+       struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev);
+       struct acpi_device *parent;
        u64 adr;
 
        /*
-        * For both sata/pata devices, host handle is required.
-        * For pata device, port handle is also required.
+        * For both sata/pata devices, host companion device is required.
+        * For pata device, port companion device is also required.
         */
-       if (libata_noacpi || !host_handle ||
-                       (!(ap->flags & ATA_FLAG_ACPI_SATA) && !port_handle))
+       if (libata_noacpi || !host_companion ||
+                       (!(ap->flags & ATA_FLAG_ACPI_SATA) && !port_companion))
                return;
 
        if (ap->flags & ATA_FLAG_ACPI_SATA) {
@@ -216,13 +214,13 @@ void ata_acpi_bind_dev(struct ata_device *dev)
                        adr = SATA_ADR(ap->port_no, NO_PORT_MULT);
                else
                        adr = SATA_ADR(ap->port_no, dev->link->pmp);
-               parent_handle = host_handle;
+               parent = host_companion;
        } else {
                adr = dev->devno;
-               parent_handle = port_handle;
+               parent = port_companion;
        }
 
-       acpi_preset_companion(&dev->tdev, parent_handle, adr);
+       acpi_preset_companion(&dev->tdev, parent, adr);
 
        register_hotplug_dock_device(ata_dev_acpi_handle(dev),
                                     &ata_acpi_dev_dock_ops, dev, NULL, NULL);
index 75b93678bbcd7f4231e0c2028995795487db671c..dae73efe5dbf7efc4ea40cd0ee5c27958b12c5f3 100644 (file)
@@ -4156,6 +4156,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { "ST3320[68]13AS",     "SD1[5-9]",     ATA_HORKAGE_NONCQ |
                                                ATA_HORKAGE_FIRMWARE_WARN },
 
+       /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */
+       { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA },
+
        /* Blacklist entries taken from Silicon Image 3124/3132
           Windows driver .inf file - also several Linux problem reports */
        { "HTS541060G9SA00",    "MB3OC60D",     ATA_HORKAGE_NONCQ, },
index 92d7797223be12c41fb8cbcef92035781a779111..6d87570083187bbbe749fe566195f854707a641c 100644 (file)
@@ -2402,7 +2402,7 @@ static void ata_eh_link_report(struct ata_link *link)
        struct ata_port *ap = link->ap;
        struct ata_eh_context *ehc = &link->eh_context;
        const char *frozen, *desc;
-       char tries_buf[6];
+       char tries_buf[6] = "";
        int tag, nr_failed = 0;
 
        if (ehc->i.flags & ATA_EHI_QUIET)
@@ -2433,9 +2433,8 @@ static void ata_eh_link_report(struct ata_link *link)
        if (ap->pflags & ATA_PFLAG_FROZEN)
                frozen = " frozen";
 
-       memset(tries_buf, 0, sizeof(tries_buf));
        if (ap->eh_tries < ATA_EH_MAX_TRIES)
-               snprintf(tries_buf, sizeof(tries_buf) - 1, " t%d",
+               snprintf(tries_buf, sizeof(tries_buf), " t%d",
                         ap->eh_tries);
 
        if (ehc->i.dev) {
index 73212c9c6d5bfb90b1193dddb2f30135b9edd9a9..62c9ac80c6e96ed1f0a4421fb22b7ee3629ae2e9 100644 (file)
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/gfp.h>
-#include <scsi/scsi_host.h>
-#include <acpi/acpi_bus.h>
-
+#include <linux/acpi.h>
 #include <linux/libata.h>
 #include <linux/ata.h>
+#include <scsi/scsi_host.h>
 
 #define DRV_NAME       "pata_acpi"
 #define DRV_VERSION    "0.2.3"
index 1dae9a9009f785d9e442bfac7e6552657161dd48..2b25bd83fc9d46a2682a0affb409ccf7488abe3d 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/ata.h>
 #include <linux/libata.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
 
 #define SATA_RCAR_DMA_BOUNDARY         0x1FFFFFFEUL
 
+/* Gen2 Physical Layer Control Registers */
+#define RCAR_GEN2_PHY_CTL1_REG         0x1704
+#define RCAR_GEN2_PHY_CTL1             0x34180002
+#define RCAR_GEN2_PHY_CTL1_SS          0xC180  /* Spread Spectrum */
+
+#define RCAR_GEN2_PHY_CTL2_REG         0x170C
+#define RCAR_GEN2_PHY_CTL2             0x00002303
+
+#define RCAR_GEN2_PHY_CTL3_REG         0x171C
+#define RCAR_GEN2_PHY_CTL3             0x000B0194
+
+#define RCAR_GEN2_PHY_CTL4_REG         0x1724
+#define RCAR_GEN2_PHY_CTL4             0x00030994
+
+#define RCAR_GEN2_PHY_CTL5_REG         0x1740
+#define RCAR_GEN2_PHY_CTL5             0x03004001
+#define RCAR_GEN2_PHY_CTL5_DC          BIT(1)  /* DC connection */
+#define RCAR_GEN2_PHY_CTL5_TR          BIT(2)  /* Termination Resistor */
+
+enum sata_rcar_type {
+       RCAR_GEN1_SATA,
+       RCAR_GEN2_SATA,
+};
+
 struct sata_rcar_priv {
        void __iomem *base;
        struct clk *clk;
+       enum sata_rcar_type type;
 };
 
-static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
+static void sata_rcar_gen1_phy_preinit(struct sata_rcar_priv *priv)
 {
        void __iomem *base = priv->base;
 
@@ -141,8 +167,8 @@ static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
        iowrite32(0, base + SATAPHYRESET_REG);
 }
 
-static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
-                               int group)
+static void sata_rcar_gen1_phy_write(struct sata_rcar_priv *priv, u16 reg,
+                                    u32 val, int group)
 {
        void __iomem *base = priv->base;
        int timeout;
@@ -170,6 +196,29 @@ static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
        iowrite32(0, base + SATAPHYADDR_REG);
 }
 
+static void sata_rcar_gen1_phy_init(struct sata_rcar_priv *priv)
+{
+       sata_rcar_gen1_phy_preinit(priv);
+       sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
+       sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
+       sata_rcar_gen1_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
+       sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
+       sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
+       sata_rcar_gen1_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+}
+
+static void sata_rcar_gen2_phy_init(struct sata_rcar_priv *priv)
+{
+       void __iomem *base = priv->base;
+
+       iowrite32(RCAR_GEN2_PHY_CTL1, base + RCAR_GEN2_PHY_CTL1_REG);
+       iowrite32(RCAR_GEN2_PHY_CTL2, base + RCAR_GEN2_PHY_CTL2_REG);
+       iowrite32(RCAR_GEN2_PHY_CTL3, base + RCAR_GEN2_PHY_CTL3_REG);
+       iowrite32(RCAR_GEN2_PHY_CTL4, base + RCAR_GEN2_PHY_CTL4_REG);
+       iowrite32(RCAR_GEN2_PHY_CTL5 | RCAR_GEN2_PHY_CTL5_DC |
+                 RCAR_GEN2_PHY_CTL5_TR, base + RCAR_GEN2_PHY_CTL5_REG);
+}
+
 static void sata_rcar_freeze(struct ata_port *ap)
 {
        struct sata_rcar_priv *priv = ap->host->private_data;
@@ -738,13 +787,17 @@ static void sata_rcar_init_controller(struct ata_host *host)
        u32 val;
 
        /* reset and setup phy */
-       sata_rcar_phy_initialize(priv);
-       sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
-       sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
-       sata_rcar_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
-       sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
-       sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
-       sata_rcar_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+       switch (priv->type) {
+       case RCAR_GEN1_SATA:
+               sata_rcar_gen1_phy_init(priv);
+               break;
+       case RCAR_GEN2_SATA:
+               sata_rcar_gen2_phy_init(priv);
+               break;
+       default:
+               dev_warn(host->dev, "SATA phy is not initialized\n");
+               break;
+       }
 
        /* SATA-IP reset state */
        val = ioread32(base + ATAPI_CONTROL1_REG);
@@ -770,8 +823,40 @@ static void sata_rcar_init_controller(struct ata_host *host)
        iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
 }
 
+static struct of_device_id sata_rcar_match[] = {
+       {
+               /* Deprecated by "renesas,sata-r8a7779" */
+               .compatible = "renesas,rcar-sata",
+               .data = (void *)RCAR_GEN1_SATA,
+       },
+       {
+               .compatible = "renesas,sata-r8a7779",
+               .data = (void *)RCAR_GEN1_SATA,
+       },
+       {
+               .compatible = "renesas,sata-r8a7790",
+               .data = (void *)RCAR_GEN2_SATA
+       },
+       {
+               .compatible = "renesas,sata-r8a7791",
+               .data = (void *)RCAR_GEN2_SATA
+       },
+       { },
+};
+MODULE_DEVICE_TABLE(of, sata_rcar_match);
+
+static const struct platform_device_id sata_rcar_id_table[] = {
+       { "sata_rcar", RCAR_GEN1_SATA }, /* Deprecated by "sata-r8a7779" */
+       { "sata-r8a7779", RCAR_GEN1_SATA },
+       { "sata-r8a7790", RCAR_GEN2_SATA },
+       { "sata-r8a7791", RCAR_GEN2_SATA },
+       { },
+};
+MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
+
 static int sata_rcar_probe(struct platform_device *pdev)
 {
+       const struct of_device_id *of_id;
        struct ata_host *host;
        struct sata_rcar_priv *priv;
        struct resource *mem;
@@ -787,6 +872,12 @@ static int sata_rcar_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
+       of_id = of_match_device(sata_rcar_match, &pdev->dev);
+       if (of_id)
+               priv->type = (enum sata_rcar_type)of_id->data;
+       else
+               priv->type = platform_get_device_id(pdev)->driver_data;
+
        priv->clk = devm_clk_get(&pdev->dev, NULL);
        if (IS_ERR(priv->clk)) {
                dev_err(&pdev->dev, "failed to get access to sata clock\n");
@@ -892,15 +983,10 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 };
 #endif
 
-static struct of_device_id sata_rcar_match[] = {
-       { .compatible = "renesas,rcar-sata", },
-       {},
-};
-MODULE_DEVICE_TABLE(of, sata_rcar_match);
-
 static struct platform_driver sata_rcar_driver = {
        .probe          = sata_rcar_probe,
        .remove         = sata_rcar_remove,
+       .id_table       = sata_rcar_id_table,
        .driver = {
                .name           = DRV_NAME,
                .owner          = THIS_MODULE,
index e3219dfd736c64fbf13976ce3fa7f66b89e6484e..1b41fca3d65a54545c6c124e0df696998c29a1af 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/async.h>
 #include <linux/suspend.h>
 #include <trace/events/power.h>
-#include <linux/cpufreq.h>
 #include <linux/cpuidle.h>
 #include <linux/timer.h>
 
@@ -541,7 +540,6 @@ static void dpm_resume_noirq(pm_message_t state)
        dpm_show_time(starttime, state, "noirq");
        resume_device_irqs();
        cpuidle_resume();
-       cpufreq_resume();
 }
 
 /**
@@ -957,7 +955,6 @@ static int dpm_suspend_noirq(pm_message_t state)
        ktime_t starttime = ktime_get();
        int error = 0;
 
-       cpufreq_suspend();
        cpuidle_pause();
        suspend_device_irqs();
        mutex_lock(&dpm_list_mtx);
index 5a95baf4b104e4c2dc559534867effa53e6327a2..27de5046708a233cbc99e42a4349387f9f5157cb 100644 (file)
@@ -43,9 +43,6 @@
 #include <linux/zorro.h>
 
 
-extern int m68k_realnum_memory;
-extern struct mem_info m68k_memory[NUM_MEMINFO];
-
 #define Z2MINOR_COMBINED      (0)
 #define Z2MINOR_Z2ONLY        (1)
 #define Z2MINOR_CHIPONLY      (2)
@@ -116,8 +113,8 @@ get_z2ram( void )
        if ( test_bit( i, zorro_unused_z2ram ) )
        {
            z2_count++;
-           z2ram_map[ z2ram_size++ ] = 
-               ZTWO_VADDR( Z2RAM_START ) + ( i << Z2RAM_CHUNKSHIFT );
+           z2ram_map[z2ram_size++] = (unsigned long)ZTWO_VADDR(Z2RAM_START) +
+                                     (i << Z2RAM_CHUNKSHIFT);
            clear_bit( i, zorro_unused_z2ram );
        }
     }
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 5d9c31dfc905eac973f167d4f77d1c8b628de0b0..d5d4cd82b9f7dac435af267806ff541777f3ebdb 100644 (file)
 #include <linux/uaccess.h>
 #include <linux/slab.h>
 #include <linux/io.h>
-
+#include <linux/acpi.h>
+#include <linux/hpet.h>
 #include <asm/current.h>
 #include <asm/irq.h>
 #include <asm/div64.h>
 
-#include <linux/acpi.h>
-#include <acpi/acpi_bus.h>
-#include <linux/hpet.h>
-
 /*
  * The High Precision Event Timer driver.
  * This driver is closely modelled after the rtc.c driver.
index 40cc0cf2ded639f6b4e3f28cfb1b093660c19ae1..e6939e13e3388e0b05132f72320d8eec0c757a57 100644 (file)
@@ -664,6 +664,13 @@ static struct dmi_system_id __initdata i8k_dmi_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "Vostro"),
                },
        },
+       {
+               .ident = "Dell XPS421",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "XPS L421X"),
+               },
+       },
         { }
 };
 
index 64420b3396a294ccd56c2b6e727b1aaa0459a34b..b9a57fa4b710301d3844cf9ea9b659830b871d0f 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/security.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <acpi/acpi.h>
+#include <linux/acpi.h>
 
 #include "tpm.h"
 #include "tpm_eventlog.h"
index 8e562dc656016cd9c4dbeaaa3dac0a96a02d0f26..dd60ef336f8d8bf4fba5c6bb9ab473724d578a61 100644 (file)
@@ -1,5 +1,4 @@
 #include <linux/acpi.h>
-#include <acpi/acpi_drivers.h>
 #include "tpm.h"
 
 static const u8 tpm_ppi_uuid[] = {
index 7a10bc9a23e7b3f11403a1e500504b80715c3557..ace7309c43699f0afc6df7b406416dbce45f8ab3 100644 (file)
@@ -35,6 +35,7 @@ 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_X86)              += x86/
 
diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
new file mode 100644 (file)
index 0000000..0e92b71
--- /dev/null
@@ -0,0 +1,12 @@
+#
+# 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
+
+obj-$(CONFIG_AT91_PROGRAMMABLE_CLOCKS) += 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..7b9db60
--- /dev/null
@@ -0,0 +1,397 @@
+/*
+ *  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[] __initdata = {
+       /* 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 */
+#if defined(CONFIG_AT91_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,
+       },
+#endif
+       /* 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..ba8d142
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * 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);
+
+#if defined(CONFIG_AT91_PROGRAMMABLE_CLOCKS)
+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);
+#endif
+
+#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 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);
index 7d2c84265947a1b2e85ebf92c8c6e9cb8d9303f8..8e27aee6887eed36c2ebaf7c82bd705672ab5784 100644 (file)
@@ -331,8 +331,8 @@ static struct samsung_clock_alias s3c64xx_clock_aliases[] = {
        ALIAS(HCLK_HSMMC1, "s3c-sdhci.1", "mmc_busclk.0"),
        ALIAS(HCLK_HSMMC0, "s3c-sdhci.0", "hsmmc"),
        ALIAS(HCLK_HSMMC0, "s3c-sdhci.0", "mmc_busclk.0"),
-       ALIAS(HCLK_DMA1, NULL, "dma1"),
-       ALIAS(HCLK_DMA0, NULL, "dma0"),
+       ALIAS(HCLK_DMA1, "dma-pl080s.1", "apb_pclk"),
+       ALIAS(HCLK_DMA0, "dma-pl080s.0", "apb_pclk"),
        ALIAS(HCLK_CAMIF, "s3c-camif", "camif"),
        ALIAS(HCLK_LCD, "s3c-fb", "lcd"),
        ALIAS(PCLK_SPI1, "s3c6410-spi.1", "spi"),
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 ed7b73b508e096bb06a3e87a1843aa813f835430..f00b5c9ce8b6dbc9599dc921eeea07e5db4d6423 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 d4585ce2346cf187a0c5511fafdd7ac08204f1bb..0faf756f6197d216fbb8ddf6d276fdf7f86d3b7f 100644 (file)
@@ -44,7 +44,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index)
        int ret;
 
        freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000);
-       if (freq_Hz < 0)
+       if (freq_Hz <= 0)
                freq_Hz = freq_table[index].frequency * 1000;
 
        freq_exact = freq_Hz;
index 81e9d4412db8584b6e97086cf9a257edb2c7056f..02d534da22dda0bb22277c4f80f7c1d27f24cd65 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
-#include <linux/suspend.h>
 #include <linux/syscore_ops.h>
 #include <linux/tick.h>
 #include <trace/events/power.h>
@@ -48,9 +47,6 @@ static LIST_HEAD(cpufreq_policy_list);
 static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);
 #endif
 
-/* Flag to suspend/resume CPUFreq governors */
-static bool cpufreq_suspended;
-
 static inline bool has_target(void)
 {
        return cpufreq_driver->target_index || cpufreq_driver->target;
@@ -1466,41 +1462,6 @@ static struct subsys_interface cpufreq_interface = {
        .remove_dev     = cpufreq_remove_dev,
 };
 
-void cpufreq_suspend(void)
-{
-       struct cpufreq_policy *policy;
-
-       if (!has_target())
-               return;
-
-       pr_debug("%s: Suspending Governors\n", __func__);
-
-       list_for_each_entry(policy, &cpufreq_policy_list, policy_list)
-               if (__cpufreq_governor(policy, CPUFREQ_GOV_STOP))
-                       pr_err("%s: Failed to stop governor for policy: %p\n",
-                               __func__, policy);
-
-       cpufreq_suspended = true;
-}
-
-void cpufreq_resume(void)
-{
-       struct cpufreq_policy *policy;
-
-       if (!has_target())
-               return;
-
-       pr_debug("%s: Resuming Governors\n", __func__);
-
-       cpufreq_suspended = false;
-
-       list_for_each_entry(policy, &cpufreq_policy_list, policy_list)
-               if (__cpufreq_governor(policy, CPUFREQ_GOV_START)
-                   || __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS))
-                       pr_err("%s: Failed to start governor for policy: %p\n",
-                               __func__, policy);
-}
-
 /**
  * cpufreq_bp_suspend - Prepare the boot CPU for system suspend.
  *
@@ -1803,10 +1764,6 @@ static int __cpufreq_governor(struct cpufreq_policy *policy,
        struct cpufreq_governor *gov = NULL;
 #endif
 
-       /* Don't start any governor operations if we are entering suspend */
-       if (cpufreq_suspended)
-               return 0;
-
        if (policy->governor->max_transition_latency &&
            policy->cpuinfo.transition_latency >
            policy->governor->max_transition_latency) {
@@ -2119,6 +2076,9 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb,
        dev = get_cpu_device(cpu);
        if (dev) {
 
+               if (action & CPU_TASKS_FROZEN)
+                       frozen = true;
+
                switch (action & ~CPU_TASKS_FROZEN) {
                case CPU_ONLINE:
                        __cpufreq_add_dev(dev, NULL, frozen);
index d02ccd19c9c4f20e4b5a3cfdcf1035b0c15c97fd..45ea4c094542d677bf2edd83f642b0173ed90541 100644 (file)
@@ -138,7 +138,7 @@ static int spear_cpufreq_target(struct cpufreq_policy *policy,
        }
 
        newfreq = clk_round_rate(srcclk, newfreq * mult);
-       if (newfreq < 0) {
+       if (newfreq <= 0) {
                pr_err("clk_round_rate failed for cpu src clock\n");
                return newfreq;
        }
index 16a2aa28f85672689f66c37039a8e72230e71b02..ec4ee5c1fe9dc2115e029d0c472bd32f48cb281c 100644 (file)
@@ -1169,7 +1169,7 @@ static void pl08x_desc_free(struct virt_dma_desc *vd)
        struct pl08x_txd *txd = to_pl08x_txd(&vd->tx);
        struct pl08x_dma_chan *plchan = to_pl08x_chan(vd->tx.chan);
 
-       dma_descriptor_unmap(txd);
+       dma_descriptor_unmap(&vd->tx);
        if (!txd->done)
                pl08x_release_mux(plchan);
 
index c75679d420286c522679cdb9c344549c97e7a0c4..152247675febf42c805b57592c222fc716c8d516 100644 (file)
@@ -323,6 +323,7 @@ struct sdma_engine {
        struct clk                      *clk_ipg;
        struct clk                      *clk_ahb;
        spinlock_t                      channel_0_lock;
+       u32                             script_number;
        struct sdma_script_start_addrs  *script_addrs;
        const struct sdma_driver_data   *drvdata;
 };
@@ -724,6 +725,10 @@ static void sdma_get_pc(struct sdma_channel *sdmac,
                per_2_emi = sdma->script_addrs->app_2_mcu_addr;
                emi_2_per = sdma->script_addrs->mcu_2_app_addr;
                break;
+       case IMX_DMATYPE_SSI_DUAL:
+               per_2_emi = sdma->script_addrs->ssish_2_mcu_addr;
+               emi_2_per = sdma->script_addrs->mcu_2_ssish_addr;
+               break;
        case IMX_DMATYPE_SSI_SP:
        case IMX_DMATYPE_MMC:
        case IMX_DMATYPE_SDHC:
@@ -1238,6 +1243,7 @@ static void sdma_issue_pending(struct dma_chan *chan)
 }
 
 #define SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1        34
+#define SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V2        38
 
 static void sdma_add_scripts(struct sdma_engine *sdma,
                const struct sdma_script_start_addrs *addr)
@@ -1246,7 +1252,7 @@ static void sdma_add_scripts(struct sdma_engine *sdma,
        s32 *saddr_arr = (u32 *)sdma->script_addrs;
        int i;
 
-       for (i = 0; i < SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1; i++)
+       for (i = 0; i < sdma->script_number; i++)
                if (addr_arr[i] > 0)
                        saddr_arr[i] = addr_arr[i];
 }
@@ -1272,6 +1278,17 @@ static void sdma_load_firmware(const struct firmware *fw, void *context)
                goto err_firmware;
        if (header->ram_code_start + header->ram_code_size > fw->size)
                goto err_firmware;
+       switch (header->version_major) {
+               case 1:
+                       sdma->script_number = SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1;
+                       break;
+               case 2:
+                       sdma->script_number = SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V2;
+                       break;
+               default:
+                       dev_err(sdma->dev, "unknown firmware version\n");
+                       goto err_firmware;
+       }
 
        addr = (void *)header + header->script_addrs_start;
        ram_code = (void *)header + header->ram_code_start;
index dcb1e05149a7664c6e65a214d783080d540aaafd..3f7712c4d3fa782bd8ae985d182ed8d6ebb48d78 100644 (file)
@@ -5,6 +5,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+
 #include <linux/err.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #define DTADR          0x0208
 #define DCMD           0x020c
 
-#define DCSR_RUN       (1 << 31)       /* Run Bit (read / write) */
-#define DCSR_NODESC    (1 << 30)       /* No-Descriptor Fetch (read / write) */
-#define DCSR_STOPIRQEN (1 << 29)       /* Stop Interrupt Enable (read / write) */
-#define DCSR_REQPEND   (1 << 8)        /* Request Pending (read-only) */
-#define DCSR_STOPSTATE (1 << 3)        /* Stop State (read-only) */
-#define DCSR_ENDINTR   (1 << 2)        /* End Interrupt (read / write) */
-#define DCSR_STARTINTR (1 << 1)        /* Start Interrupt (read / write) */
-#define DCSR_BUSERR    (1 << 0)        /* Bus Error Interrupt (read / write) */
-
-#define DCSR_EORIRQEN  (1 << 28)       /* End of Receive Interrupt Enable (R/W) */
-#define DCSR_EORJMPEN  (1 << 27)       /* Jump to next descriptor on EOR */
-#define DCSR_EORSTOPEN (1 << 26)       /* STOP on an EOR */
-#define DCSR_SETCMPST  (1 << 25)       /* Set Descriptor Compare Status */
-#define DCSR_CLRCMPST  (1 << 24)       /* Clear Descriptor Compare Status */
-#define DCSR_CMPST     (1 << 10)       /* The Descriptor Compare Status */
-#define DCSR_EORINTR   (1 << 9)        /* The end of Receive */
-
-#define DRCMR(n)       ((((n) < 64) ? 0x0100 : 0x1100) + \
-                                (((n) & 0x3f) << 2))
-#define DRCMR_MAPVLD   (1 << 7)        /* Map Valid (read / write) */
-#define DRCMR_CHLNUM   0x1f            /* mask for Channel Number (read / write) */
+#define DCSR_RUN       BIT(31) /* Run Bit (read / write) */
+#define DCSR_NODESC    BIT(30) /* No-Descriptor Fetch (read / write) */
+#define DCSR_STOPIRQEN BIT(29) /* Stop Interrupt Enable (read / write) */
+#define DCSR_REQPEND   BIT(8)  /* Request Pending (read-only) */
+#define DCSR_STOPSTATE BIT(3)  /* Stop State (read-only) */
+#define DCSR_ENDINTR   BIT(2)  /* End Interrupt (read / write) */
+#define DCSR_STARTINTR BIT(1)  /* Start Interrupt (read / write) */
+#define DCSR_BUSERR    BIT(0)  /* Bus Error Interrupt (read / write) */
+
+#define DCSR_EORIRQEN  BIT(28) /* End of Receive Interrupt Enable (R/W) */
+#define DCSR_EORJMPEN  BIT(27) /* Jump to next descriptor on EOR */
+#define DCSR_EORSTOPEN BIT(26) /* STOP on an EOR */
+#define DCSR_SETCMPST  BIT(25) /* Set Descriptor Compare Status */
+#define DCSR_CLRCMPST  BIT(24) /* Clear Descriptor Compare Status */
+#define DCSR_CMPST     BIT(10) /* The Descriptor Compare Status */
+#define DCSR_EORINTR   BIT(9)  /* The end of Receive */
+
+#define DRCMR(n)       ((((n) < 64) ? 0x0100 : 0x1100) + (((n) & 0x3f) << 2))
+#define DRCMR_MAPVLD   BIT(7)  /* Map Valid (read / write) */
+#define DRCMR_CHLNUM   0x1f    /* mask for Channel Number (read / write) */
 
 #define DDADR_DESCADDR 0xfffffff0      /* Address of next descriptor (mask) */
-#define DDADR_STOP     (1 << 0)        /* Stop (read / write) */
-
-#define DCMD_INCSRCADDR        (1 << 31)       /* Source Address Increment Setting. */
-#define DCMD_INCTRGADDR        (1 << 30)       /* Target Address Increment Setting. */
-#define DCMD_FLOWSRC   (1 << 29)       /* Flow Control by the source. */
-#define DCMD_FLOWTRG   (1 << 28)       /* Flow Control by the target. */
-#define DCMD_STARTIRQEN        (1 << 22)       /* Start Interrupt Enable */
-#define DCMD_ENDIRQEN  (1 << 21)       /* End Interrupt Enable */
-#define DCMD_ENDIAN    (1 << 18)       /* Device Endian-ness. */
+#define DDADR_STOP     BIT(0)  /* Stop (read / write) */
+
+#define DCMD_INCSRCADDR        BIT(31) /* Source Address Increment Setting. */
+#define DCMD_INCTRGADDR        BIT(30) /* Target Address Increment Setting. */
+#define DCMD_FLOWSRC   BIT(29) /* Flow Control by the source. */
+#define DCMD_FLOWTRG   BIT(28) /* Flow Control by the target. */
+#define DCMD_STARTIRQEN        BIT(22) /* Start Interrupt Enable */
+#define DCMD_ENDIRQEN  BIT(21) /* End Interrupt Enable */
+#define DCMD_ENDIAN    BIT(18) /* Device Endian-ness. */
 #define DCMD_BURST8    (1 << 16)       /* 8 byte burst */
 #define DCMD_BURST16   (2 << 16)       /* 16 byte burst */
 #define DCMD_BURST32   (3 << 16)       /* 32 byte burst */
@@ -132,10 +132,14 @@ struct mmp_pdma_device {
        spinlock_t phy_lock; /* protect alloc/free phy channels */
 };
 
-#define tx_to_mmp_pdma_desc(tx) container_of(tx, struct mmp_pdma_desc_sw, async_tx)
-#define to_mmp_pdma_desc(lh) container_of(lh, struct mmp_pdma_desc_sw, node)
-#define to_mmp_pdma_chan(dchan) container_of(dchan, struct mmp_pdma_chan, chan)
-#define to_mmp_pdma_dev(dmadev) container_of(dmadev, struct mmp_pdma_device, device)
+#define tx_to_mmp_pdma_desc(tx)                                        \
+       container_of(tx, struct mmp_pdma_desc_sw, async_tx)
+#define to_mmp_pdma_desc(lh)                                   \
+       container_of(lh, struct mmp_pdma_desc_sw, node)
+#define to_mmp_pdma_chan(dchan)                                        \
+       container_of(dchan, struct mmp_pdma_chan, chan)
+#define to_mmp_pdma_dev(dmadev)                                        \
+       container_of(dmadev, struct mmp_pdma_device, device)
 
 static void set_desc(struct mmp_pdma_phy *phy, dma_addr_t addr)
 {
@@ -162,19 +166,18 @@ static void enable_chan(struct mmp_pdma_phy *phy)
        writel(dalgn, phy->base + DALGN);
 
        reg = (phy->idx << 2) + DCSR;
-       writel(readl(phy->base + reg) | DCSR_RUN,
-                                       phy->base + reg);
+       writel(readl(phy->base + reg) | DCSR_RUN, phy->base + reg);
 }
 
 static void disable_chan(struct mmp_pdma_phy *phy)
 {
        u32 reg;
 
-       if (phy) {
-               reg = (phy->idx << 2) + DCSR;
-               writel(readl(phy->base + reg) & ~DCSR_RUN,
-                                               phy->base + reg);
-       }
+       if (!phy)
+               return;
+
+       reg = (phy->idx << 2) + DCSR;
+       writel(readl(phy->base + reg) & ~DCSR_RUN, phy->base + reg);
 }
 
 static int clear_chan_irq(struct mmp_pdma_phy *phy)
@@ -183,26 +186,27 @@ static int clear_chan_irq(struct mmp_pdma_phy *phy)
        u32 dint = readl(phy->base + DINT);
        u32 reg = (phy->idx << 2) + DCSR;
 
-       if (dint & BIT(phy->idx)) {
-               /* clear irq */
-               dcsr = readl(phy->base + reg);
-               writel(dcsr, phy->base + reg);
-               if ((dcsr & DCSR_BUSERR) && (phy->vchan))
-                       dev_warn(phy->vchan->dev, "DCSR_BUSERR\n");
-               return 0;
-       }
-       return -EAGAIN;
+       if (!(dint & BIT(phy->idx)))
+               return -EAGAIN;
+
+       /* clear irq */
+       dcsr = readl(phy->base + reg);
+       writel(dcsr, phy->base + reg);
+       if ((dcsr & DCSR_BUSERR) && (phy->vchan))
+               dev_warn(phy->vchan->dev, "DCSR_BUSERR\n");
+
+       return 0;
 }
 
 static irqreturn_t mmp_pdma_chan_handler(int irq, void *dev_id)
 {
        struct mmp_pdma_phy *phy = dev_id;
 
-       if (clear_chan_irq(phy) == 0) {
-               tasklet_schedule(&phy->vchan->tasklet);
-               return IRQ_HANDLED;
-       } else
+       if (clear_chan_irq(phy) != 0)
                return IRQ_NONE;
+
+       tasklet_schedule(&phy->vchan->tasklet);
+       return IRQ_HANDLED;
 }
 
 static irqreturn_t mmp_pdma_int_handler(int irq, void *dev_id)
@@ -224,8 +228,8 @@ static irqreturn_t mmp_pdma_int_handler(int irq, void *dev_id)
 
        if (irq_num)
                return IRQ_HANDLED;
-       else
-               return IRQ_NONE;
+
+       return IRQ_NONE;
 }
 
 /* lookup free phy channel as descending priority */
@@ -245,9 +249,9 @@ static struct mmp_pdma_phy *lookup_phy(struct mmp_pdma_chan *pchan)
         */
 
        spin_lock_irqsave(&pdev->phy_lock, flags);
-       for (prio = 0; prio <= (((pdev->dma_channels - 1) & 0xf) >> 2); prio++) {
+       for (prio = 0; prio <= ((pdev->dma_channels - 1) & 0xf) >> 2; prio++) {
                for (i = 0; i < pdev->dma_channels; i++) {
-                       if (prio != ((i & 0xf) >> 2))
+                       if (prio != (i & 0xf) >> 2)
                                continue;
                        phy = &pdev->phy[i];
                        if (!phy->vchan) {
@@ -389,14 +393,16 @@ static int mmp_pdma_alloc_chan_resources(struct dma_chan *dchan)
        if (chan->desc_pool)
                return 1;
 
-       chan->desc_pool =
-               dma_pool_create(dev_name(&dchan->dev->device), chan->dev,
-                                 sizeof(struct mmp_pdma_desc_sw),
-                                 __alignof__(struct mmp_pdma_desc_sw), 0);
+       chan->desc_pool = dma_pool_create(dev_name(&dchan->dev->device),
+                                         chan->dev,
+                                         sizeof(struct mmp_pdma_desc_sw),
+                                         __alignof__(struct mmp_pdma_desc_sw),
+                                         0);
        if (!chan->desc_pool) {
                dev_err(chan->dev, "unable to allocate descriptor pool\n");
                return -ENOMEM;
        }
+
        mmp_pdma_free_phy(chan);
        chan->idle = true;
        chan->dev_addr = 0;
@@ -404,7 +410,7 @@ static int mmp_pdma_alloc_chan_resources(struct dma_chan *dchan)
 }
 
 static void mmp_pdma_free_desc_list(struct mmp_pdma_chan *chan,
-                                 struct list_head *list)
+                                   struct list_head *list)
 {
        struct mmp_pdma_desc_sw *desc, *_desc;
 
@@ -434,8 +440,8 @@ static void mmp_pdma_free_chan_resources(struct dma_chan *dchan)
 
 static struct dma_async_tx_descriptor *
 mmp_pdma_prep_memcpy(struct dma_chan *dchan,
-       dma_addr_t dma_dst, dma_addr_t dma_src,
-       size_t len, unsigned long flags)
+                    dma_addr_t dma_dst, dma_addr_t dma_src,
+                    size_t len, unsigned long flags)
 {
        struct mmp_pdma_chan *chan;
        struct mmp_pdma_desc_sw *first = NULL, *prev = NULL, *new;
@@ -515,8 +521,8 @@ fail:
 
 static struct dma_async_tx_descriptor *
 mmp_pdma_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
-                        unsigned int sg_len, enum dma_transfer_direction dir,
-                        unsigned long flags, void *context)
+                      unsigned int sg_len, enum dma_transfer_direction dir,
+                      unsigned long flags, void *context)
 {
        struct mmp_pdma_chan *chan = to_mmp_pdma_chan(dchan);
        struct mmp_pdma_desc_sw *first = NULL, *prev = NULL, *new = NULL;
@@ -591,10 +597,11 @@ fail:
        return NULL;
 }
 
-static struct dma_async_tx_descriptor *mmp_pdma_prep_dma_cyclic(
-       struct dma_chan *dchan, dma_addr_t buf_addr, size_t len,
-       size_t period_len, enum dma_transfer_direction direction,
-       unsigned long flags, void *context)
+static struct dma_async_tx_descriptor *
+mmp_pdma_prep_dma_cyclic(struct dma_chan *dchan,
+                        dma_addr_t buf_addr, size_t len, size_t period_len,
+                        enum dma_transfer_direction direction,
+                        unsigned long flags, void *context)
 {
        struct mmp_pdma_chan *chan;
        struct mmp_pdma_desc_sw *first = NULL, *prev = NULL, *new;
@@ -636,8 +643,8 @@ static struct dma_async_tx_descriptor *mmp_pdma_prep_dma_cyclic(
                        goto fail;
                }
 
-               new->desc.dcmd = chan->dcmd | DCMD_ENDIRQEN |
-                                       (DCMD_LENGTH & period_len);
+               new->desc.dcmd = (chan->dcmd | DCMD_ENDIRQEN |
+                                 (DCMD_LENGTH & period_len));
                new->desc.dsadr = dma_src;
                new->desc.dtadr = dma_dst;
 
@@ -677,12 +684,11 @@ fail:
 }
 
 static int mmp_pdma_control(struct dma_chan *dchan, enum dma_ctrl_cmd cmd,
-               unsigned long arg)
+                           unsigned long arg)
 {
        struct mmp_pdma_chan *chan = to_mmp_pdma_chan(dchan);
        struct dma_slave_config *cfg = (void *)arg;
        unsigned long flags;
-       int ret = 0;
        u32 maxburst = 0, addr = 0;
        enum dma_slave_buswidth width = DMA_SLAVE_BUSWIDTH_UNDEFINED;
 
@@ -739,11 +745,12 @@ static int mmp_pdma_control(struct dma_chan *dchan, enum dma_ctrl_cmd cmd,
                return -ENOSYS;
        }
 
-       return ret;
+       return 0;
 }
 
 static enum dma_status mmp_pdma_tx_status(struct dma_chan *dchan,
-                       dma_cookie_t cookie, struct dma_tx_state *txstate)
+                                         dma_cookie_t cookie,
+                                         struct dma_tx_state *txstate)
 {
        return dma_cookie_status(dchan, cookie, txstate);
 }
@@ -845,15 +852,14 @@ static int mmp_pdma_remove(struct platform_device *op)
        return 0;
 }
 
-static int mmp_pdma_chan_init(struct mmp_pdma_device *pdev,
-                                                       int idx, int irq)
+static int mmp_pdma_chan_init(struct mmp_pdma_device *pdev, int idx, int irq)
 {
        struct mmp_pdma_phy *phy  = &pdev->phy[idx];
        struct mmp_pdma_chan *chan;
        int ret;
 
-       chan = devm_kzalloc(pdev->dev,
-                       sizeof(struct mmp_pdma_chan), GFP_KERNEL);
+       chan = devm_kzalloc(pdev->dev, sizeof(struct mmp_pdma_chan),
+                           GFP_KERNEL);
        if (chan == NULL)
                return -ENOMEM;
 
@@ -861,8 +867,8 @@ static int mmp_pdma_chan_init(struct mmp_pdma_device *pdev,
        phy->base = pdev->base;
 
        if (irq) {
-               ret = devm_request_irq(pdev->dev, irq,
-                       mmp_pdma_chan_handler, 0, "pdma", phy);
+               ret = devm_request_irq(pdev->dev, irq, mmp_pdma_chan_handler, 0,
+                                      "pdma", phy);
                if (ret) {
                        dev_err(pdev->dev, "channel request irq fail!\n");
                        return ret;
@@ -877,8 +883,7 @@ static int mmp_pdma_chan_init(struct mmp_pdma_device *pdev,
        INIT_LIST_HEAD(&chan->chain_running);
 
        /* register virt channel to dma engine */
-       list_add_tail(&chan->chan.device_node,
-                       &pdev->device.channels);
+       list_add_tail(&chan->chan.device_node, &pdev->device.channels);
 
        return 0;
 }
@@ -913,13 +918,12 @@ retry:
         * 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;
-       }
+       if (!chan)
+               goto retry;
 
-       goto retry;
+       to_mmp_pdma_chan(chan)->drcmr = dma_spec->args[0];
+
+       return chan;
 }
 
 static int mmp_pdma_probe(struct platform_device *op)
@@ -934,6 +938,7 @@ static int mmp_pdma_probe(struct platform_device *op)
        pdev = devm_kzalloc(&op->dev, sizeof(*pdev), GFP_KERNEL);
        if (!pdev)
                return -ENOMEM;
+
        pdev->dev = &op->dev;
 
        spin_lock_init(&pdev->phy_lock);
@@ -945,8 +950,8 @@ static int mmp_pdma_probe(struct platform_device *op)
 
        of_id = of_match_device(mmp_pdma_dt_ids, pdev->dev);
        if (of_id)
-               of_property_read_u32(pdev->dev->of_node,
-                               "#dma-channels", &dma_channels);
+               of_property_read_u32(pdev->dev->of_node, "#dma-channels",
+                                    &dma_channels);
        else if (pdata && pdata->dma_channels)
                dma_channels = pdata->dma_channels;
        else
@@ -958,8 +963,9 @@ static int mmp_pdma_probe(struct platform_device *op)
                        irq_num++;
        }
 
-       pdev->phy = devm_kzalloc(pdev->dev,
-               dma_channels * sizeof(struct mmp_pdma_chan), GFP_KERNEL);
+       pdev->phy = devm_kcalloc(pdev->dev,
+                                dma_channels, sizeof(struct mmp_pdma_chan),
+                                GFP_KERNEL);
        if (pdev->phy == NULL)
                return -ENOMEM;
 
@@ -968,8 +974,8 @@ static int mmp_pdma_probe(struct platform_device *op)
        if (irq_num != dma_channels) {
                /* all chan share one irq, demux inside */
                irq = platform_get_irq(op, 0);
-               ret = devm_request_irq(pdev->dev, irq,
-                       mmp_pdma_int_handler, 0, "pdma", pdev);
+               ret = devm_request_irq(pdev->dev, irq, mmp_pdma_int_handler, 0,
+                                      "pdma", pdev);
                if (ret)
                        return ret;
        }
@@ -1017,6 +1023,7 @@ static int mmp_pdma_probe(struct platform_device *op)
                }
        }
 
+       platform_set_drvdata(op, pdev);
        dev_info(pdev->device.dev, "initialized %d channels\n", dma_channels);
        return 0;
 }
@@ -1044,7 +1051,7 @@ bool mmp_pdma_filter_fn(struct dma_chan *chan, void *param)
        if (chan->device->dev->driver != &mmp_pdma_driver.driver)
                return false;
 
-       c->drcmr = *(unsigned int *) param;
+       c->drcmr = *(unsigned int *)param;
 
        return true;
 }
@@ -1052,6 +1059,6 @@ EXPORT_SYMBOL_GPL(mmp_pdma_filter_fn);
 
 module_platform_driver(mmp_pdma_driver);
 
-MODULE_DESCRIPTION("MARVELL MMP Periphera DMA Driver");
+MODULE_DESCRIPTION("MARVELL MMP Peripheral DMA Driver");
 MODULE_AUTHOR("Marvell International Ltd.");
 MODULE_LICENSE("GPL v2");
index 3ddacc14a7366611ffb089d21c70fb4ba3c896c5..d4b730ce03691abb6a90dc1bc7cf952f0e23a5fe 100644 (file)
@@ -121,7 +121,7 @@ struct mmp_tdma_chan {
        int                             idx;
        enum mmp_tdma_type              type;
        int                             irq;
-       unsigned long                   reg_base;
+       void __iomem                    *reg_base;
 
        size_t                          buf_len;
        size_t                          period_len;
@@ -182,7 +182,7 @@ static void mmp_tdma_pause_chan(struct mmp_tdma_chan *tdmac)
 
 static int mmp_tdma_config_chan(struct mmp_tdma_chan *tdmac)
 {
-       unsigned int tdcr;
+       unsigned int tdcr = 0;
 
        mmp_tdma_disable_chan(tdmac);
 
@@ -526,7 +526,7 @@ static int mmp_tdma_chan_init(struct mmp_tdma_device *tdev,
        tdmac->chan.device = &tdev->device;
        tdmac->idx         = idx;
        tdmac->type        = type;
-       tdmac->reg_base    = (unsigned long)tdev->base + idx * 4;
+       tdmac->reg_base    = tdev->base + idx * 4;
        tdmac->status = DMA_COMPLETE;
        tdev->tdmac[tdmac->idx] = tdmac;
        tasklet_init(&tdmac->tasklet, dma_do_tasklet, (unsigned long)tdmac);
index cdf0483b8f2dfb8f746b786fd6bf84b0d5f6657b..7adaf3abffba91d4f72656513c6ad5b235508c40 100644 (file)
@@ -578,6 +578,9 @@ struct dma_pl330_dmac {
        /* DMA-Engine Device */
        struct dma_device ddma;
 
+       /* Holds info about sg limitations */
+       struct device_dma_parameters dma_parms;
+
        /* Pool of descriptors available for the DMAC's channels */
        struct list_head desc_pool;
        /* To protect desc_pool manipulation */
@@ -3023,6 +3026,9 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
                        "unable to register DMA to the generic DT DMA helpers\n");
                }
        }
+
+       adev->dev.dma_parms = &pdmac->dma_parms;
+
        /*
         * This is the limit for transfers with a buswidth of 1, larger
         * buswidths will have larger limits.
index 4cb12797863678be86af66017ec2cffb54f5dd16..4eddedb6eb7dd3deb68550c1b8065e8b9d882278 100644 (file)
@@ -628,42 +628,13 @@ retry:
        s3cchan->state = S3C24XX_DMA_CHAN_IDLE;
 }
 
-static void s3c24xx_dma_unmap_buffers(struct s3c24xx_txd *txd)
-{
-       struct device *dev = txd->vd.tx.chan->device->dev;
-       struct s3c24xx_sg *dsg;
-
-       if (!(txd->vd.tx.flags & DMA_COMPL_SKIP_SRC_UNMAP)) {
-               if (txd->vd.tx.flags & DMA_COMPL_SRC_UNMAP_SINGLE)
-                       list_for_each_entry(dsg, &txd->dsg_list, node)
-                               dma_unmap_single(dev, dsg->src_addr, dsg->len,
-                                               DMA_TO_DEVICE);
-               else {
-                       list_for_each_entry(dsg, &txd->dsg_list, node)
-                               dma_unmap_page(dev, dsg->src_addr, dsg->len,
-                                               DMA_TO_DEVICE);
-               }
-       }
-
-       if (!(txd->vd.tx.flags & DMA_COMPL_SKIP_DEST_UNMAP)) {
-               if (txd->vd.tx.flags & DMA_COMPL_DEST_UNMAP_SINGLE)
-                       list_for_each_entry(dsg, &txd->dsg_list, node)
-                               dma_unmap_single(dev, dsg->dst_addr, dsg->len,
-                                               DMA_FROM_DEVICE);
-               else
-                       list_for_each_entry(dsg, &txd->dsg_list, node)
-                               dma_unmap_page(dev, dsg->dst_addr, dsg->len,
-                                               DMA_FROM_DEVICE);
-       }
-}
-
 static void s3c24xx_dma_desc_free(struct virt_dma_desc *vd)
 {
        struct s3c24xx_txd *txd = to_s3c24xx_txd(&vd->tx);
        struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(vd->tx.chan);
 
        if (!s3cchan->slave)
-               s3c24xx_dma_unmap_buffers(txd);
+               dma_descriptor_unmap(&vd->tx);
 
        s3c24xx_dma_free_txd(txd);
 }
@@ -795,7 +766,7 @@ static enum dma_status s3c24xx_dma_tx_status(struct dma_chan *chan,
 
        spin_lock_irqsave(&s3cchan->vc.lock, flags);
        ret = dma_cookie_status(chan, cookie, txstate);
-       if (ret == DMA_SUCCESS) {
+       if (ret == DMA_COMPLETE) {
                spin_unlock_irqrestore(&s3cchan->vc.lock, flags);
                return ret;
        }
index ebad84591a6e22bd1f28866c3f0b1946eba3dff0..3083d901a414f000a54e0337e02973a4586399bf 100644 (file)
@@ -60,6 +60,7 @@
 #define HPB_DMAE_DSTPR_DMSTP   BIT(0)
 
 /* DMA status register (DSTSR) bits */
+#define HPB_DMAE_DSTSR_DQSTS   BIT(2)
 #define HPB_DMAE_DSTSR_DMSTS   BIT(0)
 
 /* DMA common registers */
@@ -286,6 +287,9 @@ static void hpb_dmae_halt(struct shdma_chan *schan)
 
        ch_reg_write(chan, HPB_DMAE_DCMDR_DQEND, HPB_DMAE_DCMDR);
        ch_reg_write(chan, HPB_DMAE_DSTPR_DMSTP, HPB_DMAE_DSTPR);
+
+       chan->plane_idx = 0;
+       chan->first_desc = true;
 }
 
 static const struct hpb_dmae_slave_config *
@@ -385,7 +389,10 @@ static bool hpb_dmae_channel_busy(struct shdma_chan *schan)
        struct hpb_dmae_chan *chan = to_chan(schan);
        u32 dstsr = ch_reg_read(chan, HPB_DMAE_DSTSR);
 
-       return (dstsr & HPB_DMAE_DSTSR_DMSTS) == HPB_DMAE_DSTSR_DMSTS;
+       if (chan->xfer_mode == XFER_DOUBLE)
+               return dstsr & HPB_DMAE_DSTSR_DQSTS;
+       else
+               return dstsr & HPB_DMAE_DSTSR_DMSTS;
 }
 
 static int
@@ -510,6 +517,8 @@ static int hpb_dmae_chan_probe(struct hpb_dmae_device *hpbdev, int id)
        }
 
        schan = &new_hpb_chan->shdma_chan;
+       schan->max_xfer_len = HPB_DMA_TCR_MAX;
+
        shdma_chan_probe(sdev, schan, id);
 
        if (pdev->id >= 0)
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 3c55ec856e39c714e7b474f081c01180b9aa9e2d..a287cece0593c327c53e8961b70a0dde8b1af2ce 100644 (file)
@@ -1082,7 +1082,7 @@ static void arizona_micd_set_level(struct arizona *arizona, int index,
 static int arizona_extcon_probe(struct platform_device *pdev)
 {
        struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
-       struct arizona_pdata *pdata;
+       struct arizona_pdata *pdata = &arizona->pdata;
        struct arizona_extcon_info *info;
        unsigned int val;
        int jack_irq_fall, jack_irq_rise;
@@ -1091,8 +1091,6 @@ static int arizona_extcon_probe(struct platform_device *pdev)
        if (!arizona->dapm || !arizona->dapm->card)
                return -EPROBE_DEFER;
 
-       pdata = dev_get_platdata(arizona->dev);
-
        info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
        if (!info) {
                dev_err(&pdev->dev, "Failed to allocate memory\n");
index 15443d3b6be18049ddddbb7ec035eb05ce7dc409..76322330cbd7a10b427ff5d011b83abbd0abb0e8 100644 (file)
@@ -792,6 +792,8 @@ void extcon_dev_unregister(struct extcon_dev *edev)
                return;
        }
 
+       device_unregister(&edev->dev);
+
        if (edev->mutually_exclusive && edev->max_supported) {
                for (index = 0; edev->mutually_exclusive[index];
                                index++)
@@ -812,7 +814,6 @@ void extcon_dev_unregister(struct extcon_dev *edev)
        if (switch_class)
                class_compat_remove_link(switch_class, &edev->dev, NULL);
 #endif
-       device_unregister(&edev->dev);
        put_device(&edev->dev);
 }
 EXPORT_SYMBOL_GPL(extcon_dev_unregister);
index 8847adf392b7ecf823f9f603314c76001367203f..84be70157ad6b6e9809bd007c422e223c359d429 100644 (file)
@@ -327,7 +327,7 @@ static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
         * NOTE:  we assume for now that only irqs in the first gpio_chip
         * can provide direct-mapped IRQs to AINTC (up to 32 GPIOs).
         */
-       if (offset < d->irq_base)
+       if (offset < d->gpio_unbanked)
                return d->gpio_irq + offset;
        else
                return -ENODEV;
@@ -419,6 +419,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
 
                /* pass "bank 0" GPIO IRQs to AINTC */
                chips[0].chip.to_irq = gpio_to_irq_unbanked;
+               chips[0].gpio_irq = bank_irq;
+               chips[0].gpio_unbanked = pdata->gpio_unbanked;
                binten = BIT(0);
 
                /* AINTC handles mask/unmask; GPIO handles triggering */
index fb7cf0e796f668328e7a923dbcada92ba8c2f1c7..0a1e4a5f4234dce320788330e97e8888016338ba 100644 (file)
@@ -2674,7 +2674,7 @@ static int add_3d_struct_modes(struct drm_connector *connector, u16 structure,
        int modes = 0;
        u8 cea_mode;
 
-       if (video_db == NULL || video_index > video_len)
+       if (video_db == NULL || video_index >= video_len)
                return 0;
 
        /* CEA modes are numbered 1..127 */
@@ -2701,7 +2701,7 @@ static int add_3d_struct_modes(struct drm_connector *connector, u16 structure,
        if (structure & (1 << 8)) {
                newmode = drm_mode_duplicate(dev, &edid_cea_modes[cea_mode]);
                if (newmode) {
-                       newmode->flags = DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF;
+                       newmode->flags |= DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF;
                        drm_mode_probed_add(connector, newmode);
                        modes++;
                }
index b676006a95a0118951f8e12d04f8a6fff0c49fb0..22b8f5eced80f3407b0fa9fc365c1d9e349d7e54 100644 (file)
@@ -172,29 +172,38 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
 
 static void exynos_drm_preclose(struct drm_device *dev,
                                        struct drm_file *file)
+{
+       exynos_drm_subdrv_close(dev, file);
+}
+
+static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
 {
        struct exynos_drm_private *private = dev->dev_private;
-       struct drm_pending_vblank_event *e, *t;
+       struct drm_pending_vblank_event *v, *vt;
+       struct drm_pending_event *e, *et;
        unsigned long flags;
 
-       /* release events of current file */
+       if (!file->driver_priv)
+               return;
+
+       /* Release all events not unhandled by page flip handler. */
        spin_lock_irqsave(&dev->event_lock, flags);
-       list_for_each_entry_safe(e, t, &private->pageflip_event_list,
+       list_for_each_entry_safe(v, vt, &private->pageflip_event_list,
                        base.link) {
-               if (e->base.file_priv == file) {
-                       list_del(&e->base.link);
-                       e->base.destroy(&e->base);
+               if (v->base.file_priv == file) {
+                       list_del(&v->base.link);
+                       drm_vblank_put(dev, v->pipe);
+                       v->base.destroy(&v->base);
                }
        }
-       spin_unlock_irqrestore(&dev->event_lock, flags);
 
-       exynos_drm_subdrv_close(dev, file);
-}
+       /* Release all events handled by page flip handler but not freed. */
+       list_for_each_entry_safe(e, et, &file->event_list, link) {
+               list_del(&e->link);
+               e->destroy(e);
+       }
+       spin_unlock_irqrestore(&dev->event_lock, flags);
 
-static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
-{
-       if (!file->driver_priv)
-               return;
 
        kfree(file->driver_priv);
        file->driver_priv = NULL;
index 23da72b5eae98b0bae1e400ea28d74ed5ee7e472..a61878bf5dcd091cf31ed64a8374d230b580dc1e 100644 (file)
@@ -31,7 +31,7 @@
 #include "exynos_drm_iommu.h"
 
 /*
- * FIMD is stand for Fully Interactive Mobile Display and
+ * FIMD stands for Fully Interactive Mobile Display and
  * as a display controller, it transfers contents drawn on memory
  * to a LCD Panel through Display Interfaces such as RGB or
  * CPU Interface.
index 0cab2d045135b66d0462c88d390e43eff3df7b20..197db0993a24340b3a5ee3302721faf4b9992f63 100644 (file)
@@ -1490,16 +1490,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
        spin_lock_init(&dev_priv->uncore.lock);
        spin_lock_init(&dev_priv->mm.object_stat_lock);
        mutex_init(&dev_priv->dpio_lock);
-       mutex_init(&dev_priv->rps.hw_lock);
        mutex_init(&dev_priv->modeset_restore_lock);
 
-       mutex_init(&dev_priv->pc8.lock);
-       dev_priv->pc8.requirements_met = false;
-       dev_priv->pc8.gpu_idle = false;
-       dev_priv->pc8.irqs_disabled = false;
-       dev_priv->pc8.enabled = false;
-       dev_priv->pc8.disable_count = 2; /* requirements_met + gpu_idle */
-       INIT_DELAYED_WORK(&dev_priv->pc8.enable_work, hsw_enable_pc8_work);
+       intel_pm_setup(dev);
 
        intel_display_crc_init(dev);
 
@@ -1603,7 +1596,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
        }
 
        intel_irq_init(dev);
-       intel_pm_init(dev);
        intel_uncore_sanitize(dev);
 
        /* Try to make sure MCHBAR is enabled before poking at it */
@@ -1848,8 +1840,10 @@ void i915_driver_lastclose(struct drm_device * dev)
 
 void i915_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
 {
+       mutex_lock(&dev->struct_mutex);
        i915_gem_context_close(dev, file_priv);
        i915_gem_release(dev, file_priv);
+       mutex_unlock(&dev->struct_mutex);
 }
 
 void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
index 989be12cdd6e962e625b8376734f101ace947d1c..5b7b7e06cb3a09caec1cd7d5ab90401389df7a40 100644 (file)
@@ -534,8 +534,10 @@ static int i915_drm_freeze(struct drm_device *dev)
                 * Disable CRTCs directly since we want to preserve sw state
                 * for _thaw.
                 */
+               mutex_lock(&dev->mode_config.mutex);
                list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
                        dev_priv->display.crtc_disable(crtc);
+               mutex_unlock(&dev->mode_config.mutex);
 
                intel_modeset_suspend_hw(dev);
        }
@@ -649,6 +651,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
                intel_modeset_init_hw(dev);
 
                drm_modeset_lock_all(dev);
+               drm_mode_config_reset(dev);
                intel_modeset_setup_hw_state(dev, true);
                drm_modeset_unlock_all(dev);
 
index ccdbecca070d2340919d5499f80824ddb84db4ac..6f04fa4b31fdccabad7c03e167c3fd75fe58a9bd 100644 (file)
@@ -1901,9 +1901,7 @@ void i915_queue_hangcheck(struct drm_device *dev);
 void i915_handle_error(struct drm_device *dev, bool wedged);
 
 extern void intel_irq_init(struct drm_device *dev);
-extern void intel_pm_init(struct drm_device *dev);
 extern void intel_hpd_init(struct drm_device *dev);
-extern void intel_pm_init(struct drm_device *dev);
 
 extern void intel_uncore_sanitize(struct drm_device *dev);
 extern void intel_uncore_early_sanitize(struct drm_device *dev);
index 12bbd5eac70db7a22a291dfc5c2e01624803c816..621c7c67a6439b2e785fc4b0f9898784aad47b01 100644 (file)
@@ -4442,10 +4442,9 @@ i915_gem_init_hw(struct drm_device *dev)
        if (dev_priv->ellc_size)
                I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf));
 
-       if (IS_HSW_GT3(dev))
-               I915_WRITE(MI_PREDICATE_RESULT_2, LOWER_SLICE_ENABLED);
-       else
-               I915_WRITE(MI_PREDICATE_RESULT_2, LOWER_SLICE_DISABLED);
+       if (IS_HASWELL(dev))
+               I915_WRITE(MI_PREDICATE_RESULT_2, IS_HSW_GT3(dev) ?
+                          LOWER_SLICE_ENABLED : LOWER_SLICE_DISABLED);
 
        if (HAS_PCH_NOP(dev)) {
                u32 temp = I915_READ(GEN7_MSG_CTL);
index 72a3df32292f79d88d1ba17dc8d620a24ad435ca..b0f42b9ca037ed472e1a0dd4cd663df6ffd70f06 100644 (file)
@@ -347,10 +347,8 @@ void i915_gem_context_close(struct drm_device *dev, struct drm_file *file)
 {
        struct drm_i915_file_private *file_priv = file->driver_priv;
 
-       mutex_lock(&dev->struct_mutex);
        idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL);
        idr_destroy(&file_priv->context_idr);
-       mutex_unlock(&dev->struct_mutex);
 }
 
 static struct i915_hw_context *
@@ -423,11 +421,21 @@ static int do_switch(struct i915_hw_context *to)
        if (ret)
                return ret;
 
-       /* Clear this page out of any CPU caches for coherent swap-in/out. Note
+       /*
+        * Pin can switch back to the default context if we end up calling into
+        * evict_everything - as a last ditch gtt defrag effort that also
+        * switches to the default context. Hence we need to reload from here.
+        */
+       from = ring->last_context;
+
+       /*
+        * Clear this page out of any CPU caches for coherent swap-in/out. Note
         * that thanks to write = false in this call and us not setting any gpu
         * write domains when putting a context object onto the active list
         * (when switching away from it), this won't block.
-        * XXX: We need a real interface to do this instead of trickery. */
+        *
+        * XXX: We need a real interface to do this instead of trickery.
+        */
        ret = i915_gem_object_set_to_gtt_domain(to->obj, false);
        if (ret) {
                i915_gem_object_unpin(to->obj);
index 7d5752fda5f18b7850beeed588a6f1b3a85cd79a..9bb533e0d76234cdc14ec6d9da31a310114080a5 100644 (file)
@@ -125,13 +125,15 @@ static void *i915_gem_dmabuf_vmap(struct dma_buf *dma_buf)
 
        ret = i915_gem_object_get_pages(obj);
        if (ret)
-               goto error;
+               goto err;
+
+       i915_gem_object_pin_pages(obj);
 
        ret = -ENOMEM;
 
        pages = drm_malloc_ab(obj->base.size >> PAGE_SHIFT, sizeof(*pages));
        if (pages == NULL)
-               goto error;
+               goto err_unpin;
 
        i = 0;
        for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, 0)
@@ -141,15 +143,16 @@ static void *i915_gem_dmabuf_vmap(struct dma_buf *dma_buf)
        drm_free_large(pages);
 
        if (!obj->dma_buf_vmapping)
-               goto error;
+               goto err_unpin;
 
        obj->vmapping_count = 1;
-       i915_gem_object_pin_pages(obj);
 out_unlock:
        mutex_unlock(&dev->struct_mutex);
        return obj->dma_buf_vmapping;
 
-error:
+err_unpin:
+       i915_gem_object_unpin_pages(obj);
+err:
        mutex_unlock(&dev->struct_mutex);
        return ERR_PTR(ret);
 }
index 885d595e0e02255e30fbff181247b70df1af5363..b7e787fb4649321cd67d7456aef11af861757aac 100644 (file)
@@ -33,6 +33,9 @@
 #include "intel_drv.h"
 #include <linux/dma_remapping.h>
 
+#define  __EXEC_OBJECT_HAS_PIN (1<<31)
+#define  __EXEC_OBJECT_HAS_FENCE (1<<30)
+
 struct eb_vmas {
        struct list_head vmas;
        int and;
@@ -187,7 +190,28 @@ static struct i915_vma *eb_get_vma(struct eb_vmas *eb, unsigned long handle)
        }
 }
 
-static void eb_destroy(struct eb_vmas *eb) {
+static void
+i915_gem_execbuffer_unreserve_vma(struct i915_vma *vma)
+{
+       struct drm_i915_gem_exec_object2 *entry;
+       struct drm_i915_gem_object *obj = vma->obj;
+
+       if (!drm_mm_node_allocated(&vma->node))
+               return;
+
+       entry = vma->exec_entry;
+
+       if (entry->flags & __EXEC_OBJECT_HAS_FENCE)
+               i915_gem_object_unpin_fence(obj);
+
+       if (entry->flags & __EXEC_OBJECT_HAS_PIN)
+               i915_gem_object_unpin(obj);
+
+       entry->flags &= ~(__EXEC_OBJECT_HAS_FENCE | __EXEC_OBJECT_HAS_PIN);
+}
+
+static void eb_destroy(struct eb_vmas *eb)
+{
        while (!list_empty(&eb->vmas)) {
                struct i915_vma *vma;
 
@@ -195,6 +219,7 @@ static void eb_destroy(struct eb_vmas *eb) {
                                       struct i915_vma,
                                       exec_list);
                list_del_init(&vma->exec_list);
+               i915_gem_execbuffer_unreserve_vma(vma);
                drm_gem_object_unreference(&vma->obj->base);
        }
        kfree(eb);
@@ -478,9 +503,6 @@ i915_gem_execbuffer_relocate(struct eb_vmas *eb,
        return ret;
 }
 
-#define  __EXEC_OBJECT_HAS_PIN (1<<31)
-#define  __EXEC_OBJECT_HAS_FENCE (1<<30)
-
 static int
 need_reloc_mappable(struct i915_vma *vma)
 {
@@ -552,26 +574,6 @@ i915_gem_execbuffer_reserve_vma(struct i915_vma *vma,
        return 0;
 }
 
-static void
-i915_gem_execbuffer_unreserve_vma(struct i915_vma *vma)
-{
-       struct drm_i915_gem_exec_object2 *entry;
-       struct drm_i915_gem_object *obj = vma->obj;
-
-       if (!drm_mm_node_allocated(&vma->node))
-               return;
-
-       entry = vma->exec_entry;
-
-       if (entry->flags & __EXEC_OBJECT_HAS_FENCE)
-               i915_gem_object_unpin_fence(obj);
-
-       if (entry->flags & __EXEC_OBJECT_HAS_PIN)
-               i915_gem_object_unpin(obj);
-
-       entry->flags &= ~(__EXEC_OBJECT_HAS_FENCE | __EXEC_OBJECT_HAS_PIN);
-}
-
 static int
 i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring,
                            struct list_head *vmas,
@@ -670,13 +672,14 @@ i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring,
                                goto err;
                }
 
-err:           /* Decrement pin count for bound objects */
-               list_for_each_entry(vma, vmas, exec_list)
-                       i915_gem_execbuffer_unreserve_vma(vma);
-
+err:
                if (ret != -ENOSPC || retry++)
                        return ret;
 
+               /* Decrement pin count for bound objects */
+               list_for_each_entry(vma, vmas, exec_list)
+                       i915_gem_execbuffer_unreserve_vma(vma);
+
                ret = i915_gem_evict_vm(vm, true);
                if (ret)
                        return ret;
@@ -708,6 +711,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
        while (!list_empty(&eb->vmas)) {
                vma = list_first_entry(&eb->vmas, struct i915_vma, exec_list);
                list_del_init(&vma->exec_list);
+               i915_gem_execbuffer_unreserve_vma(vma);
                drm_gem_object_unreference(&vma->obj->base);
        }
 
index 3620a1b0a73cbcea019cbd5503250410e51f2807..38cb8d44a0133a6c096524a553d45fcb33cd72a1 100644 (file)
@@ -57,7 +57,9 @@ typedef gen8_gtt_pte_t gen8_ppgtt_pde_t;
 #define HSW_WB_LLC_AGE3                        HSW_CACHEABILITY_CONTROL(0x2)
 #define HSW_WB_LLC_AGE0                        HSW_CACHEABILITY_CONTROL(0x3)
 #define HSW_WB_ELLC_LLC_AGE0           HSW_CACHEABILITY_CONTROL(0xb)
+#define HSW_WB_ELLC_LLC_AGE3           HSW_CACHEABILITY_CONTROL(0x8)
 #define HSW_WT_ELLC_LLC_AGE0           HSW_CACHEABILITY_CONTROL(0x6)
+#define HSW_WT_ELLC_LLC_AGE3           HSW_CACHEABILITY_CONTROL(0x7)
 
 #define GEN8_PTES_PER_PAGE             (PAGE_SIZE / sizeof(gen8_gtt_pte_t))
 #define GEN8_PDES_PER_PAGE             (PAGE_SIZE / sizeof(gen8_ppgtt_pde_t))
@@ -185,10 +187,10 @@ static gen6_gtt_pte_t iris_pte_encode(dma_addr_t addr,
        case I915_CACHE_NONE:
                break;
        case I915_CACHE_WT:
-               pte |= HSW_WT_ELLC_LLC_AGE0;
+               pte |= HSW_WT_ELLC_LLC_AGE3;
                break;
        default:
-               pte |= HSW_WB_ELLC_LLC_AGE0;
+               pte |= HSW_WB_ELLC_LLC_AGE3;
                break;
        }
 
index f9eafb6ed523a2d0f8fbd2ff981705c644733790..ee2742122a02561f910b6d9d5383418794234eff 100644 (file)
  */
 #define MI_LOAD_REGISTER_IMM(x)        MI_INSTR(0x22, 2*x-1)
 #define MI_STORE_REGISTER_MEM(x) MI_INSTR(0x24, 2*x-1)
+#define  MI_SRM_LRM_GLOBAL_GTT         (1<<22)
 #define MI_FLUSH_DW            MI_INSTR(0x26, 1) /* for GEN6 */
 #define   MI_FLUSH_DW_STORE_INDEX      (1<<21)
 #define   MI_INVALIDATE_TLB            (1<<18)
index dfff0907f70e53643093c3f6aa8d9258ab8dc5d5..5325b25ccbb4b1b72af10f627f5c7fa82e092d89 100644 (file)
@@ -6,8 +6,6 @@
 #include <linux/pci.h>
 #include <linux/acpi.h>
 #include <linux/vga_switcheroo.h>
-#include <acpi/acpi_drivers.h>
-
 #include <drm/drmP.h>
 #include "i915_drv.h"
 
index 330077bcd0bddb22ecf056766dd88cd7ed70bfaf..526c8ded16b03bc334846609a47e2d0bfc07c58c 100644 (file)
@@ -173,7 +173,7 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
                ddi_translations = ddi_translations_dp;
                break;
        case PORT_D:
-               if (intel_dpd_is_edp(dev))
+               if (intel_dp_is_edp(dev, PORT_D))
                        ddi_translations = ddi_translations_edp;
                else
                        ddi_translations = ddi_translations_dp;
@@ -1158,9 +1158,10 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
        if (wait)
                intel_wait_ddi_buf_idle(dev_priv, port);
 
-       if (type == INTEL_OUTPUT_EDP) {
+       if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
                struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
                ironlake_edp_panel_vdd_on(intel_dp);
+               intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
                ironlake_edp_panel_off(intel_dp);
        }
 
index 7ec8b488bb1d30b6b950a23eecc833b574ab4db0..8b8bde7dce53abce2fea3c655e06ef765433d50f 100644 (file)
@@ -5815,7 +5815,7 @@ static void intel_set_pipe_csc(struct drm_crtc *crtc)
                uint16_t postoff = 0;
 
                if (intel_crtc->config.limited_color_range)
-                       postoff = (16 * (1 << 13) / 255) & 0x1fff;
+                       postoff = (16 * (1 << 12) / 255) & 0x1fff;
 
                I915_WRITE(PIPE_CSC_POSTOFF_HI(pipe), postoff);
                I915_WRITE(PIPE_CSC_POSTOFF_ME(pipe), postoff);
@@ -6402,7 +6402,7 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv)
 
        /* Make sure we're not on PC8 state before disabling PC8, otherwise
         * we'll hang the machine! */
-       dev_priv->uncore.funcs.force_wake_get(dev_priv);
+       gen6_gt_force_wake_get(dev_priv);
 
        if (val & LCPLL_POWER_DOWN_ALLOW) {
                val &= ~LCPLL_POWER_DOWN_ALLOW;
@@ -6436,7 +6436,7 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv)
                        DRM_ERROR("Switching back to LCPLL failed\n");
        }
 
-       dev_priv->uncore.funcs.force_wake_put(dev_priv);
+       gen6_gt_force_wake_put(dev_priv);
 }
 
 void hsw_enable_pc8_work(struct work_struct *__work)
@@ -8354,7 +8354,8 @@ static int intel_gen7_queue_flip(struct drm_device *dev,
                intel_ring_emit(ring, ~(DERRMR_PIPEA_PRI_FLIP_DONE |
                                        DERRMR_PIPEB_PRI_FLIP_DONE |
                                        DERRMR_PIPEC_PRI_FLIP_DONE));
-               intel_ring_emit(ring, MI_STORE_REGISTER_MEM(1));
+               intel_ring_emit(ring, MI_STORE_REGISTER_MEM(1) |
+                               MI_SRM_LRM_GLOBAL_GTT);
                intel_ring_emit(ring, DERRMR);
                intel_ring_emit(ring, ring->scratch.gtt_offset + 256);
        }
@@ -9134,7 +9135,7 @@ intel_pipe_config_compare(struct drm_device *dev,
        if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5)
                PIPE_CONF_CHECK_I(pipe_bpp);
 
-       if (!IS_HASWELL(dev)) {
+       if (!HAS_DDI(dev)) {
                PIPE_CONF_CHECK_CLOCK_FUZZY(adjusted_mode.crtc_clock);
                PIPE_CONF_CHECK_CLOCK_FUZZY(port_clock);
        }
@@ -10049,7 +10050,7 @@ static void intel_setup_outputs(struct drm_device *dev)
                        intel_ddi_init(dev, PORT_D);
        } else if (HAS_PCH_SPLIT(dev)) {
                int found;
-               dpd_is_edp = intel_dpd_is_edp(dev);
+               dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
 
                if (has_edp_a(dev))
                        intel_dp_init(dev, DP_A, PORT_A);
@@ -10086,8 +10087,7 @@ static void intel_setup_outputs(struct drm_device *dev)
                        intel_hdmi_init(dev, VLV_DISPLAY_BASE + GEN4_HDMIC,
                                        PORT_C);
                        if (I915_READ(VLV_DISPLAY_BASE + DP_C) & DP_DETECTED)
-                               intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C,
-                                             PORT_C);
+                               intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C, PORT_C);
                }
 
                intel_dsi_init(dev);
@@ -11036,8 +11036,6 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
        }
 
        intel_modeset_check_state(dev);
-
-       drm_mode_config_reset(dev);
 }
 
 void intel_modeset_gem_init(struct drm_device *dev)
@@ -11046,7 +11044,10 @@ void intel_modeset_gem_init(struct drm_device *dev)
 
        intel_setup_overlay(dev);
 
+       drm_modeset_lock_all(dev);
+       drm_mode_config_reset(dev);
        intel_modeset_setup_hw_state(dev, false);
+       drm_modeset_unlock_all(dev);
 }
 
 void intel_modeset_cleanup(struct drm_device *dev)
index 0b2e842fef0151070b09af535d54fdcee2215602..30c627c7b7ba18a0dbd546859b047a769cad1d64 100644 (file)
@@ -3326,11 +3326,19 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc)
 }
 
 /* check the VBT to see whether the eDP is on DP-D port */
-bool intel_dpd_is_edp(struct drm_device *dev)
+bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
        union child_device_config *p_child;
        int i;
+       static const short port_mapping[] = {
+               [PORT_B] = PORT_IDPB,
+               [PORT_C] = PORT_IDPC,
+               [PORT_D] = PORT_IDPD,
+       };
+
+       if (port == PORT_A)
+               return true;
 
        if (!dev_priv->vbt.child_dev_num)
                return false;
@@ -3338,7 +3346,7 @@ bool intel_dpd_is_edp(struct drm_device *dev)
        for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
                p_child = dev_priv->vbt.child_dev + i;
 
-               if (p_child->common.dvo_port == PORT_IDPD &&
+               if (p_child->common.dvo_port == port_mapping[port] &&
                    (p_child->common.device_type & DEVICE_TYPE_eDP_BITS) ==
                    (DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS))
                        return true;
@@ -3616,26 +3624,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
        intel_dp->DP = I915_READ(intel_dp->output_reg);
        intel_dp->attached_connector = intel_connector;
 
-       type = DRM_MODE_CONNECTOR_DisplayPort;
-       /*
-        * FIXME : We need to initialize built-in panels before external panels.
-        * For X0, DP_C is fixed as eDP. Revisit this as part of VLV eDP cleanup
-        */
-       switch (port) {
-       case PORT_A:
+       if (intel_dp_is_edp(dev, port))
                type = DRM_MODE_CONNECTOR_eDP;
-               break;
-       case PORT_C:
-               if (IS_VALLEYVIEW(dev))
-                       type = DRM_MODE_CONNECTOR_eDP;
-               break;
-       case PORT_D:
-               if (HAS_PCH_SPLIT(dev) && intel_dpd_is_edp(dev))
-                       type = DRM_MODE_CONNECTOR_eDP;
-               break;
-       default:        /* silence GCC warning */
-               break;
-       }
+       else
+               type = DRM_MODE_CONNECTOR_DisplayPort;
 
        /*
         * For eDP we always set the encoder type to INTEL_OUTPUT_EDP, but
index 1e49aa8f5377395c8803d5a55765199bd38af037..79f91f26e288d4bf2ae7815cb82cfc3271745bd5 100644 (file)
@@ -708,7 +708,7 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder);
 void intel_dp_check_link_status(struct intel_dp *intel_dp);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
                             struct intel_crtc_config *pipe_config);
-bool intel_dpd_is_edp(struct drm_device *dev);
+bool intel_dp_is_edp(struct drm_device *dev, enum port port);
 void ironlake_edp_backlight_on(struct intel_dp *intel_dp);
 void ironlake_edp_backlight_off(struct intel_dp *intel_dp);
 void ironlake_edp_panel_on(struct intel_dp *intel_dp);
@@ -821,6 +821,7 @@ void intel_update_sprite_watermarks(struct drm_plane *plane,
                                    uint32_t sprite_width, int pixel_size,
                                    bool enabled, bool scaled);
 void intel_init_pm(struct drm_device *dev);
+void intel_pm_setup(struct drm_device *dev);
 bool intel_fbc_enabled(struct drm_device *dev);
 void intel_update_fbc(struct drm_device *dev);
 void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
index caf2ee4e5441426527234453dbb43ed4c4c7273f..e0dec95c764ec2826c9b43f85d33f6da85fc278f 100644 (file)
@@ -1180,7 +1180,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,
 
        adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
        clock = adjusted_mode->crtc_clock;
-       htotal = adjusted_mode->htotal;
+       htotal = adjusted_mode->crtc_htotal;
        hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
        pixel_size = crtc->fb->bits_per_pixel / 8;
 
@@ -1267,7 +1267,7 @@ static bool g4x_compute_srwm(struct drm_device *dev,
        crtc = intel_get_crtc_for_plane(dev, plane);
        adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
        clock = adjusted_mode->crtc_clock;
-       htotal = adjusted_mode->htotal;
+       htotal = adjusted_mode->crtc_htotal;
        hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
        pixel_size = crtc->fb->bits_per_pixel / 8;
 
@@ -1498,7 +1498,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)
                const struct drm_display_mode *adjusted_mode =
                        &to_intel_crtc(crtc)->config.adjusted_mode;
                int clock = adjusted_mode->crtc_clock;
-               int htotal = adjusted_mode->htotal;
+               int htotal = adjusted_mode->crtc_htotal;
                int hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
                int pixel_size = crtc->fb->bits_per_pixel / 8;
                unsigned long line_time_us;
@@ -1624,7 +1624,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc)
                const struct drm_display_mode *adjusted_mode =
                        &to_intel_crtc(enabled)->config.adjusted_mode;
                int clock = adjusted_mode->crtc_clock;
-               int htotal = adjusted_mode->htotal;
+               int htotal = adjusted_mode->crtc_htotal;
                int hdisplay = to_intel_crtc(enabled)->config.pipe_src_w;
                int pixel_size = enabled->fb->bits_per_pixel / 8;
                unsigned long line_time_us;
@@ -1776,7 +1776,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane,
        crtc = intel_get_crtc_for_plane(dev, plane);
        adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
        clock = adjusted_mode->crtc_clock;
-       htotal = adjusted_mode->htotal;
+       htotal = adjusted_mode->crtc_htotal;
        hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
        pixel_size = crtc->fb->bits_per_pixel / 8;
 
@@ -2469,8 +2469,9 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
        /* The WM are computed with base on how long it takes to fill a single
         * row at the given clock rate, multiplied by 8.
         * */
-       linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, mode->clock);
-       ips_linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8,
+       linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8,
+                                    mode->crtc_clock);
+       ips_linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8,
                                         intel_ddi_get_cdclk_freq(dev_priv));
 
        return PIPE_WM_LINETIME_IPS_LINETIME(ips_linetime) |
@@ -6129,10 +6130,19 @@ int vlv_freq_opcode(int ddr_freq, int val)
        return val;
 }
 
-void intel_pm_init(struct drm_device *dev)
+void intel_pm_setup(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
 
+       mutex_init(&dev_priv->rps.hw_lock);
+
+       mutex_init(&dev_priv->pc8.lock);
+       dev_priv->pc8.requirements_met = false;
+       dev_priv->pc8.gpu_idle = false;
+       dev_priv->pc8.irqs_disabled = false;
+       dev_priv->pc8.enabled = false;
+       dev_priv->pc8.disable_count = 2; /* requirements_met + gpu_idle */
+       INIT_DELAYED_WORK(&dev_priv->pc8.enable_work, hsw_enable_pc8_work);
        INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work,
                          intel_gen6_powersave_work);
 }
index edcf801613e66ea5c34665eafe1147d39cda62db..b3fa1ba191b7115be412894936c3633bf9221188 100644 (file)
@@ -59,6 +59,7 @@ nouveau-y += core/subdev/clock/nv40.o
 nouveau-y += core/subdev/clock/nv50.o
 nouveau-y += core/subdev/clock/nv84.o
 nouveau-y += core/subdev/clock/nva3.o
+nouveau-y += core/subdev/clock/nvaa.o
 nouveau-y += core/subdev/clock/nvc0.o
 nouveau-y += core/subdev/clock/nve0.o
 nouveau-y += core/subdev/clock/pllnv04.o
index db139827047cf4a6b103a2d98cc7fe5c208721db..db3fc7be856a733d07f8431a182326e3f20b4182 100644 (file)
@@ -283,7 +283,7 @@ nv50_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_VBIOS  ] = &nouveau_bios_oclass;
                device->oclass[NVDEV_SUBDEV_GPIO   ] = &nv50_gpio_oclass;
                device->oclass[NVDEV_SUBDEV_I2C    ] = &nv94_i2c_oclass;
-               device->oclass[NVDEV_SUBDEV_CLOCK  ] =  nv84_clock_oclass;
+               device->oclass[NVDEV_SUBDEV_CLOCK  ] =  nvaa_clock_oclass;
                device->oclass[NVDEV_SUBDEV_THERM  ] = &nv84_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass;
@@ -311,7 +311,7 @@ nv50_identify(struct nouveau_device *device)
                device->oclass[NVDEV_SUBDEV_VBIOS  ] = &nouveau_bios_oclass;
                device->oclass[NVDEV_SUBDEV_GPIO   ] = &nv50_gpio_oclass;
                device->oclass[NVDEV_SUBDEV_I2C    ] = &nv94_i2c_oclass;
-               device->oclass[NVDEV_SUBDEV_CLOCK  ] =  nv84_clock_oclass;
+               device->oclass[NVDEV_SUBDEV_CLOCK  ] =  nvaa_clock_oclass;
                device->oclass[NVDEV_SUBDEV_THERM  ] = &nv84_therm_oclass;
                device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass;
                device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass;
index 5f555788121c9ff8c63a7e66da794011b67f237e..e6352bd5b4ff53c066b587bf51595b8ca54ac3af 100644 (file)
@@ -33,6 +33,7 @@
 #include <engine/dmaobj.h>
 #include <engine/fifo.h>
 
+#include "nv04.h"
 #include "nv50.h"
 
 /*******************************************************************************
@@ -460,6 +461,8 @@ nv50_fifo_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        nv_subdev(priv)->intr = nv04_fifo_intr;
        nv_engine(priv)->cclass = &nv50_fifo_cclass;
        nv_engine(priv)->sclass = nv50_fifo_sclass;
+       priv->base.pause = nv04_fifo_pause;
+       priv->base.start = nv04_fifo_start;
        return 0;
 }
 
index 0908dc834c84c48ac34f91afde1984ed593531bd..fe0f41e65d9b9c6ab6abfa5b1d5f7b3031fe5557 100644 (file)
@@ -35,6 +35,7 @@
 #include <engine/dmaobj.h>
 #include <engine/fifo.h>
 
+#include "nv04.h"
 #include "nv50.h"
 
 /*******************************************************************************
@@ -432,6 +433,8 @@ nv84_fifo_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        nv_subdev(priv)->intr = nv04_fifo_intr;
        nv_engine(priv)->cclass = &nv84_fifo_cclass;
        nv_engine(priv)->sclass = nv84_fifo_sclass;
+       priv->base.pause = nv04_fifo_pause;
+       priv->base.start = nv04_fifo_start;
        return 0;
 }
 
index b574dd4bb8285e65ccdbcf23db7b6f139e1cb73c..5ce686ee729ea5d937164d55892a9aebd2312b77 100644 (file)
@@ -176,7 +176,7 @@ nv50_software_context_ctor(struct nouveau_object *parent,
        if (ret)
                return ret;
 
-       chan->vblank.nr_event = pdisp->vblank->index_nr;
+       chan->vblank.nr_event = pdisp ? pdisp->vblank->index_nr : 0;
        chan->vblank.event = kzalloc(chan->vblank.nr_event *
                                     sizeof(*chan->vblank.event), GFP_KERNEL);
        if (!chan->vblank.event)
index e2675bc0edba5f9baefc5d514750d151a2ce23a7..8f4ced75444a95478887b4be5791fc99dd3499dc 100644 (file)
@@ -14,6 +14,9 @@ enum nv_clk_src {
        nv_clk_src_hclk,
        nv_clk_src_hclkm3,
        nv_clk_src_hclkm3d2,
+       nv_clk_src_hclkm2d3, /* NVAA */
+       nv_clk_src_hclkm4, /* NVAA */
+       nv_clk_src_cclk, /* NVAA */
 
        nv_clk_src_host,
 
@@ -127,6 +130,7 @@ extern struct nouveau_oclass nv04_clock_oclass;
 extern struct nouveau_oclass nv40_clock_oclass;
 extern struct nouveau_oclass *nv50_clock_oclass;
 extern struct nouveau_oclass *nv84_clock_oclass;
+extern struct nouveau_oclass *nvaa_clock_oclass;
 extern struct nouveau_oclass nva3_clock_oclass;
 extern struct nouveau_oclass nvc0_clock_oclass;
 extern struct nouveau_oclass nve0_clock_oclass;
index da50c1b129283923f841eef8c4192df09131f935..30c1f3a4158e3de87fd2bfb24592b9ea685b2d88 100644 (file)
@@ -69,6 +69,11 @@ nv04_clock_pll_prog(struct nouveau_clock *clk, u32 reg1,
        return 0;
 }
 
+static struct nouveau_clocks
+nv04_domain[] = {
+       { nv_clk_src_max }
+};
+
 static int
 nv04_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
                struct nouveau_oclass *oclass, void *data, u32 size,
@@ -77,7 +82,7 @@ nv04_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
        struct nv04_clock_priv *priv;
        int ret;
 
-       ret = nouveau_clock_create(parent, engine, oclass, NULL, &priv);
+       ret = nouveau_clock_create(parent, engine, oclass, nv04_domain, &priv);
        *pobject = nv_object(priv);
        if (ret)
                return ret;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c
new file mode 100644 (file)
index 0000000..7a723b4
--- /dev/null
@@ -0,0 +1,445 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Ben Skeggs
+ */
+
+#include <engine/fifo.h>
+#include <subdev/bios.h>
+#include <subdev/bios/pll.h>
+#include <subdev/timer.h>
+#include <subdev/clock.h>
+
+#include "pll.h"
+
+struct nvaa_clock_priv {
+       struct nouveau_clock base;
+       enum nv_clk_src csrc, ssrc, vsrc;
+       u32 cctrl, sctrl;
+       u32 ccoef, scoef;
+       u32 cpost, spost;
+       u32 vdiv;
+};
+
+static u32
+read_div(struct nouveau_clock *clk)
+{
+       return nv_rd32(clk, 0x004600);
+}
+
+static u32
+read_pll(struct nouveau_clock *clk, u32 base)
+{
+       u32 ctrl = nv_rd32(clk, base + 0);
+       u32 coef = nv_rd32(clk, base + 4);
+       u32 ref = clk->read(clk, nv_clk_src_href);
+       u32 post_div = 0;
+       u32 clock = 0;
+       int N1, M1;
+
+       switch (base){
+       case 0x4020:
+               post_div = 1 << ((nv_rd32(clk, 0x4070) & 0x000f0000) >> 16);
+               break;
+       case 0x4028:
+               post_div = (nv_rd32(clk, 0x4040) & 0x000f0000) >> 16;
+               break;
+       default:
+               break;
+       }
+
+       N1 = (coef & 0x0000ff00) >> 8;
+       M1 = (coef & 0x000000ff);
+       if ((ctrl & 0x80000000) && M1) {
+               clock = ref * N1 / M1;
+               clock = clock / post_div;
+       }
+
+       return clock;
+}
+
+static int
+nvaa_clock_read(struct nouveau_clock *clk, enum nv_clk_src src)
+{
+       struct nvaa_clock_priv *priv = (void *)clk;
+       u32 mast = nv_rd32(clk, 0x00c054);
+       u32 P = 0;
+
+       switch (src) {
+       case nv_clk_src_crystal:
+               return nv_device(priv)->crystal;
+       case nv_clk_src_href:
+               return 100000; /* PCIE reference clock */
+       case nv_clk_src_hclkm4:
+               return clk->read(clk, nv_clk_src_href) * 4;
+       case nv_clk_src_hclkm2d3:
+               return clk->read(clk, nv_clk_src_href) * 2 / 3;
+       case nv_clk_src_host:
+               switch (mast & 0x000c0000) {
+               case 0x00000000: return clk->read(clk, nv_clk_src_hclkm2d3);
+               case 0x00040000: break;
+               case 0x00080000: return clk->read(clk, nv_clk_src_hclkm4);
+               case 0x000c0000: return clk->read(clk, nv_clk_src_cclk);
+               }
+               break;
+       case nv_clk_src_core:
+               P = (nv_rd32(clk, 0x004028) & 0x00070000) >> 16;
+
+               switch (mast & 0x00000003) {
+               case 0x00000000: return clk->read(clk, nv_clk_src_crystal) >> P;
+               case 0x00000001: return 0;
+               case 0x00000002: return clk->read(clk, nv_clk_src_hclkm4) >> P;
+               case 0x00000003: return read_pll(clk, 0x004028) >> P;
+               }
+               break;
+       case nv_clk_src_cclk:
+               if ((mast & 0x03000000) != 0x03000000)
+                       return clk->read(clk, nv_clk_src_core);
+
+               if ((mast & 0x00000200) == 0x00000000)
+                       return clk->read(clk, nv_clk_src_core);
+
+               switch (mast & 0x00000c00) {
+               case 0x00000000: return clk->read(clk, nv_clk_src_href);
+               case 0x00000400: return clk->read(clk, nv_clk_src_hclkm4);
+               case 0x00000800: return clk->read(clk, nv_clk_src_hclkm2d3);
+               default: return 0;
+               }
+       case nv_clk_src_shader:
+               P = (nv_rd32(clk, 0x004020) & 0x00070000) >> 16;
+               switch (mast & 0x00000030) {
+               case 0x00000000:
+                       if (mast & 0x00000040)
+                               return clk->read(clk, nv_clk_src_href) >> P;
+                       return clk->read(clk, nv_clk_src_crystal) >> P;
+               case 0x00000010: break;
+               case 0x00000020: return read_pll(clk, 0x004028) >> P;
+               case 0x00000030: return read_pll(clk, 0x004020) >> P;
+               }
+               break;
+       case nv_clk_src_mem:
+               return 0;
+               break;
+       case nv_clk_src_vdec:
+               P = (read_div(clk) & 0x00000700) >> 8;
+
+               switch (mast & 0x00400000) {
+               case 0x00400000:
+                       return clk->read(clk, nv_clk_src_core) >> P;
+                       break;
+               default:
+                       return 500000 >> P;
+                       break;
+               }
+               break;
+       default:
+               break;
+       }
+
+       nv_debug(priv, "unknown clock source %d 0x%08x\n", src, mast);
+       return 0;
+}
+
+static u32
+calc_pll(struct nvaa_clock_priv *priv, u32 reg,
+        u32 clock, int *N, int *M, int *P)
+{
+       struct nouveau_bios *bios = nouveau_bios(priv);
+       struct nvbios_pll pll;
+       struct nouveau_clock *clk = &priv->base;
+       int ret;
+
+       ret = nvbios_pll_parse(bios, reg, &pll);
+       if (ret)
+               return 0;
+
+       pll.vco2.max_freq = 0;
+       pll.refclk = clk->read(clk, nv_clk_src_href);
+       if (!pll.refclk)
+               return 0;
+
+       return nv04_pll_calc(nv_subdev(priv), &pll, clock, N, M, NULL, NULL, P);
+}
+
+static inline u32
+calc_P(u32 src, u32 target, int *div)
+{
+       u32 clk0 = src, clk1 = src;
+       for (*div = 0; *div <= 7; (*div)++) {
+               if (clk0 <= target) {
+                       clk1 = clk0 << (*div ? 1 : 0);
+                       break;
+               }
+               clk0 >>= 1;
+       }
+
+       if (target - clk0 <= clk1 - target)
+               return clk0;
+       (*div)--;
+       return clk1;
+}
+
+static int
+nvaa_clock_calc(struct nouveau_clock *clk, struct nouveau_cstate *cstate)
+{
+       struct nvaa_clock_priv *priv = (void *)clk;
+       const int shader = cstate->domain[nv_clk_src_shader];
+       const int core = cstate->domain[nv_clk_src_core];
+       const int vdec = cstate->domain[nv_clk_src_vdec];
+       u32 out = 0, clock = 0;
+       int N, M, P1, P2 = 0;
+       int divs = 0;
+
+       /* cclk: find suitable source, disable PLL if we can */
+       if (core < clk->read(clk, nv_clk_src_hclkm4))
+               out = calc_P(clk->read(clk, nv_clk_src_hclkm4), core, &divs);
+
+       /* Calculate clock * 2, so shader clock can use it too */
+       clock = calc_pll(priv, 0x4028, (core << 1), &N, &M, &P1);
+
+       if (abs(core - out) <=
+           abs(core - (clock >> 1))) {
+               priv->csrc = nv_clk_src_hclkm4;
+               priv->cctrl = divs << 16;
+       } else {
+               /* NVCTRL is actually used _after_ NVPOST, and after what we
+                * call NVPLL. To make matters worse, NVPOST is an integer
+                * divider instead of a right-shift number. */
+               if(P1 > 2) {
+                       P2 = P1 - 2;
+                       P1 = 2;
+               }
+
+               priv->csrc = nv_clk_src_core;
+               priv->ccoef = (N << 8) | M;
+
+               priv->cctrl = (P2 + 1) << 16;
+               priv->cpost = (1 << P1) << 16;
+       }
+
+       /* sclk: nvpll + divisor, href or spll */
+       out = 0;
+       if (shader == clk->read(clk, nv_clk_src_href)) {
+               priv->ssrc = nv_clk_src_href;
+       } else {
+               clock = calc_pll(priv, 0x4020, shader, &N, &M, &P1);
+               if (priv->csrc == nv_clk_src_core) {
+                       out = calc_P((core << 1), shader, &divs);
+               }
+
+               if (abs(shader - out) <=
+                   abs(shader - clock) &&
+                  (divs + P2) <= 7) {
+                       priv->ssrc = nv_clk_src_core;
+                       priv->sctrl = (divs + P2) << 16;
+               } else {
+                       priv->ssrc = nv_clk_src_shader;
+                       priv->scoef = (N << 8) | M;
+                       priv->sctrl = P1 << 16;
+               }
+       }
+
+       /* vclk */
+       out = calc_P(core, vdec, &divs);
+       clock = calc_P(500000, vdec, &P1);
+       if(abs(vdec - out) <=
+          abs(vdec - clock)) {
+               priv->vsrc = nv_clk_src_cclk;
+               priv->vdiv = divs << 16;
+       } else {
+               priv->vsrc = nv_clk_src_vdec;
+               priv->vdiv = P1 << 16;
+       }
+
+       /* Print strategy! */
+       nv_debug(priv, "nvpll: %08x %08x %08x\n",
+                       priv->ccoef, priv->cpost, priv->cctrl);
+       nv_debug(priv, " spll: %08x %08x %08x\n",
+                       priv->scoef, priv->spost, priv->sctrl);
+       nv_debug(priv, " vdiv: %08x\n", priv->vdiv);
+       if (priv->csrc == nv_clk_src_hclkm4)
+               nv_debug(priv, "core: hrefm4\n");
+       else
+               nv_debug(priv, "core: nvpll\n");
+
+       if (priv->ssrc == nv_clk_src_hclkm4)
+               nv_debug(priv, "shader: hrefm4\n");
+       else if (priv->ssrc == nv_clk_src_core)
+               nv_debug(priv, "shader: nvpll\n");
+       else
+               nv_debug(priv, "shader: spll\n");
+
+       if (priv->vsrc == nv_clk_src_hclkm4)
+               nv_debug(priv, "vdec: 500MHz\n");
+       else
+               nv_debug(priv, "vdec: core\n");
+
+       return 0;
+}
+
+static int
+nvaa_clock_prog(struct nouveau_clock *clk)
+{
+       struct nvaa_clock_priv *priv = (void *)clk;
+       struct nouveau_fifo *pfifo = nouveau_fifo(clk);
+       unsigned long flags;
+       u32 pllmask = 0, mast, ptherm_gate;
+       int ret = -EBUSY;
+
+       /* halt and idle execution engines */
+       ptherm_gate = nv_mask(clk, 0x020060, 0x00070000, 0x00000000);
+       nv_mask(clk, 0x002504, 0x00000001, 0x00000001);
+       /* Wait until the interrupt handler is finished */
+       if (!nv_wait(clk, 0x000100, 0xffffffff, 0x00000000))
+               goto resume;
+
+       if (pfifo)
+               pfifo->pause(pfifo, &flags);
+
+       if (!nv_wait(clk, 0x002504, 0x00000010, 0x00000010))
+               goto resume;
+       if (!nv_wait(clk, 0x00251c, 0x0000003f, 0x0000003f))
+               goto resume;
+
+       /* First switch to safe clocks: href */
+       mast = nv_mask(clk, 0xc054, 0x03400e70, 0x03400640);
+       mast &= ~0x00400e73;
+       mast |= 0x03000000;
+
+       switch (priv->csrc) {
+       case nv_clk_src_hclkm4:
+               nv_mask(clk, 0x4028, 0x00070000, priv->cctrl);
+               mast |= 0x00000002;
+               break;
+       case nv_clk_src_core:
+               nv_wr32(clk, 0x402c, priv->ccoef);
+               nv_wr32(clk, 0x4028, 0x80000000 | priv->cctrl);
+               nv_wr32(clk, 0x4040, priv->cpost);
+               pllmask |= (0x3 << 8);
+               mast |= 0x00000003;
+               break;
+       default:
+               nv_warn(priv,"Reclocking failed: unknown core clock\n");
+               goto resume;
+       }
+
+       switch (priv->ssrc) {
+       case nv_clk_src_href:
+               nv_mask(clk, 0x4020, 0x00070000, 0x00000000);
+               /* mast |= 0x00000000; */
+               break;
+       case nv_clk_src_core:
+               nv_mask(clk, 0x4020, 0x00070000, priv->sctrl);
+               mast |= 0x00000020;
+               break;
+       case nv_clk_src_shader:
+               nv_wr32(clk, 0x4024, priv->scoef);
+               nv_wr32(clk, 0x4020, 0x80000000 | priv->sctrl);
+               nv_wr32(clk, 0x4070, priv->spost);
+               pllmask |= (0x3 << 12);
+               mast |= 0x00000030;
+               break;
+       default:
+               nv_warn(priv,"Reclocking failed: unknown sclk clock\n");
+               goto resume;
+       }
+
+       if (!nv_wait(clk, 0x004080, pllmask, pllmask)) {
+               nv_warn(priv,"Reclocking failed: unstable PLLs\n");
+               goto resume;
+       }
+
+       switch (priv->vsrc) {
+       case nv_clk_src_cclk:
+               mast |= 0x00400000;
+       default:
+               nv_wr32(clk, 0x4600, priv->vdiv);
+       }
+
+       nv_wr32(clk, 0xc054, mast);
+       ret = 0;
+
+resume:
+       if (pfifo)
+               pfifo->start(pfifo, &flags);
+
+       nv_mask(clk, 0x002504, 0x00000001, 0x00000000);
+       nv_wr32(clk, 0x020060, ptherm_gate);
+
+       /* Disable some PLLs and dividers when unused */
+       if (priv->csrc != nv_clk_src_core) {
+               nv_wr32(clk, 0x4040, 0x00000000);
+               nv_mask(clk, 0x4028, 0x80000000, 0x00000000);
+       }
+
+       if (priv->ssrc != nv_clk_src_shader) {
+               nv_wr32(clk, 0x4070, 0x00000000);
+               nv_mask(clk, 0x4020, 0x80000000, 0x00000000);
+       }
+
+       return ret;
+}
+
+static void
+nvaa_clock_tidy(struct nouveau_clock *clk)
+{
+}
+
+static struct nouveau_clocks
+nvaa_domains[] = {
+       { nv_clk_src_crystal, 0xff },
+       { nv_clk_src_href   , 0xff },
+       { nv_clk_src_core   , 0xff, 0, "core", 1000 },
+       { nv_clk_src_shader , 0xff, 0, "shader", 1000 },
+       { nv_clk_src_vdec   , 0xff, 0, "vdec", 1000 },
+       { nv_clk_src_max }
+};
+
+static int
+nvaa_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
+               struct nouveau_oclass *oclass, void *data, u32 size,
+               struct nouveau_object **pobject)
+{
+       struct nvaa_clock_priv *priv;
+       int ret;
+
+       ret = nouveau_clock_create(parent, engine, oclass, nvaa_domains, &priv);
+       *pobject = nv_object(priv);
+       if (ret)
+               return ret;
+
+       priv->base.read = nvaa_clock_read;
+       priv->base.calc = nvaa_clock_calc;
+       priv->base.prog = nvaa_clock_prog;
+       priv->base.tidy = nvaa_clock_tidy;
+       return 0;
+}
+
+struct nouveau_oclass *
+nvaa_clock_oclass = &(struct nouveau_oclass) {
+       .handle = NV_SUBDEV(CLOCK, 0xaa),
+       .ofuncs = &(struct nouveau_ofuncs) {
+               .ctor = nvaa_clock_ctor,
+               .dtor = _nouveau_clock_dtor,
+               .init = _nouveau_clock_init,
+               .fini = _nouveau_clock_fini,
+       },
+};
index 3618ac6b6316416797a36e474bf613a12cf032ab..32e7064b819b6df4f9e5847beba7a826eaaed726 100644 (file)
@@ -58,8 +58,8 @@ struct nouveau_plane {
 };
 
 static uint32_t formats[] = {
-       DRM_FORMAT_NV12,
        DRM_FORMAT_UYVY,
+       DRM_FORMAT_NV12,
 };
 
 /* Sine can be approximated with
@@ -99,13 +99,28 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
        struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
        struct nouveau_bo *cur = nv_plane->cur;
        bool flip = nv_plane->flip;
-       int format = ALIGN(src_w * 4, 0x100);
        int soff = NV_PCRTC0_SIZE * nv_crtc->index;
        int soff2 = NV_PCRTC0_SIZE * !nv_crtc->index;
-       int ret;
+       int format, ret;
+
+       /* Source parameters given in 16.16 fixed point, ignore fractional. */
+       src_x >>= 16;
+       src_y >>= 16;
+       src_w >>= 16;
+       src_h >>= 16;
+
+       format = ALIGN(src_w * 4, 0x100);
 
        if (format > 0xffff)
-               return -EINVAL;
+               return -ERANGE;
+
+       if (dev->chipset >= 0x30) {
+               if (crtc_w < (src_w >> 1) || crtc_h < (src_h >> 1))
+                       return -ERANGE;
+       } else {
+               if (crtc_w < (src_w >> 3) || crtc_h < (src_h >> 3))
+                       return -ERANGE;
+       }
 
        ret = nouveau_bo_pin(nv_fb->nvbo, TTM_PL_FLAG_VRAM);
        if (ret)
@@ -113,12 +128,6 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 
        nv_plane->cur = nv_fb->nvbo;
 
-       /* Source parameters given in 16.16 fixed point, ignore fractional. */
-       src_x = src_x >> 16;
-       src_y = src_y >> 16;
-       src_w = src_w >> 16;
-       src_h = src_h >> 16;
-
        nv_mask(dev, NV_PCRTC_ENGINE_CTRL + soff, NV_CRTC_FSEL_OVERLAY, NV_CRTC_FSEL_OVERLAY);
        nv_mask(dev, NV_PCRTC_ENGINE_CTRL + soff2, NV_CRTC_FSEL_OVERLAY, 0);
 
@@ -245,14 +254,25 @@ nv10_overlay_init(struct drm_device *device)
 {
        struct nouveau_device *dev = nouveau_dev(device);
        struct nouveau_plane *plane = kzalloc(sizeof(struct nouveau_plane), GFP_KERNEL);
+       int num_formats = ARRAY_SIZE(formats);
        int ret;
 
        if (!plane)
                return;
 
+       switch (dev->chipset) {
+       case 0x10:
+       case 0x11:
+       case 0x15:
+       case 0x1a:
+       case 0x20:
+               num_formats = 1;
+               break;
+       }
+
        ret = drm_plane_init(device, &plane->base, 3 /* both crtc's */,
                             &nv10_plane_funcs,
-                            formats, ARRAY_SIZE(formats), false);
+                            formats, num_formats, false);
        if (ret)
                goto err;
 
index 95c740454049ad1b4a4cf23c2bc63d7038c7a362..1f0b6d238cfaa01a4527e4b02ee0caf8229aa269 100644 (file)
@@ -1,15 +1,10 @@
 #include <linux/pci.h>
 #include <linux/acpi.h>
 #include <linux/slab.h>
-#include <acpi/acpi_drivers.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/video.h>
-#include <acpi/acpi.h>
 #include <linux/mxm-wmi.h>
-
 #include <linux/vga_switcheroo.h>
-
 #include <drm/drm_edid.h>
+#include <acpi/video.h>
 
 #include "nouveau_drm.h"
 #include "nouveau_acpi.h"
index 7809d92183c4236c9f1f937ea6cde6a39e780063..29c3efdfc7dd714e00ae03525d0b9528fce841cd 100644 (file)
@@ -608,6 +608,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
        fence = nouveau_fence_ref(new_bo->bo.sync_obj);
        spin_unlock(&new_bo->bo.bdev->fence_lock);
        ret = nouveau_fence_sync(fence, chan);
+       nouveau_fence_unref(&fence);
        if (ret)
                return ret;
 
@@ -701,7 +702,7 @@ nouveau_finish_page_flip(struct nouveau_channel *chan,
 
        s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head);
        if (s->event)
-               drm_send_vblank_event(dev, -1, s->event);
+               drm_send_vblank_event(dev, s->crtc, s->event);
 
        list_del(&s->head);
        if (ps)
index f8e66c08b11a292545a29e327966d3d4256e5f09..4e384a2f99c3627ea0fc6e31f5f0e34ac95e71e8 100644 (file)
@@ -1265,7 +1265,7 @@ nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
                    uint32_t start, uint32_t size)
 {
        struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
-       u32 end = max(start + size, (u32)256);
+       u32 end = min_t(u32, start + size, 256);
        u32 i;
 
        for (i = start; i < end; i++) {
index 0652ee0a20989db0b69f816d45e17f9354e5ca8a..f685035dbe39a7d7ad48e63a9b4ca2ea717701fe 100644 (file)
@@ -44,7 +44,7 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
        PROCESS_I2C_CHANNEL_TRANSACTION_PS_ALLOCATION args;
        int index = GetIndexIntoMasterTable(COMMAND, ProcessI2cChannelTransaction);
        unsigned char *base;
-       u16 out;
+       u16 out = cpu_to_le16(0);
 
        memset(&args, 0, sizeof(args));
 
@@ -55,11 +55,14 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
                        DRM_ERROR("hw i2c: tried to write too many bytes (%d vs 3)\n", num);
                        return -EINVAL;
                }
-               args.ucRegIndex = buf[0];
-               if (num > 1) {
+               if (buf == NULL)
+                       args.ucRegIndex = 0;
+               else
+                       args.ucRegIndex = buf[0];
+               if (num)
                        num--;
+               if (num)
                        memcpy(&out, &buf[1], num);
-               }
                args.lpI2CDataOut = cpu_to_le16(out);
        } else {
                if (num > ATOM_MAX_HW_I2C_READ) {
@@ -96,14 +99,14 @@ int radeon_atom_hw_i2c_xfer(struct i2c_adapter *i2c_adap,
        struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap);
        struct i2c_msg *p;
        int i, remaining, current_count, buffer_offset, max_bytes, ret;
-       u8 buf = 0, flags;
+       u8 flags;
 
        /* check for bus probe */
        p = &msgs[0];
        if ((num == 1) && (p->len == 0)) {
                ret = radeon_process_i2c_ch(i2c,
                                            p->addr, HW_I2C_WRITE,
-                                           &buf, 1);
+                                           NULL, 0);
                if (ret)
                        return ret;
                else
index 009f46e0ce72db47534d2b7667bcd0119607d91b..de86493cbc44af60a8079028e8e509f8cee81c7e 100644 (file)
@@ -93,11 +93,13 @@ void dce6_afmt_select_pin(struct drm_encoder *encoder)
        struct radeon_device *rdev = encoder->dev->dev_private;
        struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
        struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
-       u32 offset = dig->afmt->offset;
+       u32 offset;
 
-       if (!dig->afmt->pin)
+       if (!dig || !dig->afmt || !dig->afmt->pin)
                return;
 
+       offset = dig->afmt->offset;
+
        WREG32(AFMT_AUDIO_SRC_CONTROL + offset,
               AFMT_AUDIO_SRC_SELECT(dig->afmt->pin->id));
 }
@@ -112,7 +114,7 @@ void dce6_afmt_write_latency_fields(struct drm_encoder *encoder,
        struct radeon_connector *radeon_connector = NULL;
        u32 tmp = 0, offset;
 
-       if (!dig->afmt->pin)
+       if (!dig || !dig->afmt || !dig->afmt->pin)
                return;
 
        offset = dig->afmt->pin->offset;
@@ -156,7 +158,7 @@ void dce6_afmt_write_speaker_allocation(struct drm_encoder *encoder)
        u8 *sadb;
        int sad_count;
 
-       if (!dig->afmt->pin)
+       if (!dig || !dig->afmt || !dig->afmt->pin)
                return;
 
        offset = dig->afmt->pin->offset;
@@ -217,7 +219,7 @@ void dce6_afmt_write_sad_regs(struct drm_encoder *encoder)
                { AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR13, HDMI_AUDIO_CODING_TYPE_WMA_PRO },
        };
 
-       if (!dig->afmt->pin)
+       if (!dig || !dig->afmt || !dig->afmt->pin)
                return;
 
        offset = dig->afmt->pin->offset;
index cdc003085a76b802eddba1d1ba1a9df5e739dc26..49c4d48f54d616b49b7af261d8fa2d71586ab8fd 100644 (file)
@@ -785,8 +785,8 @@ static void ni_apply_state_adjust_rules(struct radeon_device *rdev,
        struct ni_ps *ps = ni_get_ps(rps);
        struct radeon_clock_and_voltage_limits *max_limits;
        bool disable_mclk_switching;
-       u32 mclk, sclk;
-       u16 vddc, vddci;
+       u32 mclk;
+       u16 vddci;
        u32 max_sclk_vddc, max_mclk_vddci, max_mclk_vddc;
        int i;
 
@@ -839,24 +839,14 @@ static void ni_apply_state_adjust_rules(struct radeon_device *rdev,
 
        /* XXX validate the min clocks required for display */
 
+       /* adjust low state */
        if (disable_mclk_switching) {
-               mclk  = ps->performance_levels[ps->performance_level_count - 1].mclk;
-               sclk = ps->performance_levels[0].sclk;
-               vddc = ps->performance_levels[0].vddc;
-               vddci = ps->performance_levels[ps->performance_level_count - 1].vddci;
-       } else {
-               sclk = ps->performance_levels[0].sclk;
-               mclk = ps->performance_levels[0].mclk;
-               vddc = ps->performance_levels[0].vddc;
-               vddci = ps->performance_levels[0].vddci;
+               ps->performance_levels[0].mclk =
+                       ps->performance_levels[ps->performance_level_count - 1].mclk;
+               ps->performance_levels[0].vddci =
+                       ps->performance_levels[ps->performance_level_count - 1].vddci;
        }
 
-       /* adjusted low state */
-       ps->performance_levels[0].sclk = sclk;
-       ps->performance_levels[0].mclk = mclk;
-       ps->performance_levels[0].vddc = vddc;
-       ps->performance_levels[0].vddci = vddci;
-
        btc_skip_blacklist_clocks(rdev, max_limits->sclk, max_limits->mclk,
                                  &ps->performance_levels[0].sclk,
                                  &ps->performance_levels[0].mclk);
@@ -868,11 +858,15 @@ static void ni_apply_state_adjust_rules(struct radeon_device *rdev,
                        ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc;
        }
 
+       /* adjust remaining states */
        if (disable_mclk_switching) {
                mclk = ps->performance_levels[0].mclk;
+               vddci = ps->performance_levels[0].vddci;
                for (i = 1; i < ps->performance_level_count; i++) {
                        if (mclk < ps->performance_levels[i].mclk)
                                mclk = ps->performance_levels[i].mclk;
+                       if (vddci < ps->performance_levels[i].vddci)
+                               vddci = ps->performance_levels[i].vddci;
                }
                for (i = 0; i < ps->performance_level_count; i++) {
                        ps->performance_levels[i].mclk = mclk;
index 4b89262f3f0e37242de23b7b6ea2fc555d141da3..b7d3ecba43e34d3b559ee072800101532150c631 100644 (file)
@@ -304,9 +304,9 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock)
                        WREG32(DCCG_AUDIO_DTO1_MODULE, dto_modulo);
                        WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */
                }
-       } else if (ASIC_IS_DCE3(rdev)) {
+       } else {
                /* according to the reg specs, this should DCE3.2 only, but in
-                * practice it seems to cover DCE3.0/3.1 as well.
+                * practice it seems to cover DCE2.0/3.0/3.1 as well.
                 */
                if (dig->dig_encoder == 0) {
                        WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100);
@@ -317,10 +317,6 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock)
                        WREG32(DCCG_AUDIO_DTO1_MODULE, clock * 100);
                        WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */
                }
-       } else {
-               /* according to the reg specs, this should be DCE2.0 and DCE3.0/3.1 */
-               WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) |
-                      AUDIO_DTO_MODULE(clock / 10));
        }
 }
 
index ecf2a3960c0786ca02fc3aef84afab61e0e6303f..b1f990d0eaa101d1bce56fabfc4b286ff01de7e9 100644 (file)
@@ -2710,10 +2710,10 @@ void radeon_vm_fence(struct radeon_device *rdev,
                     struct radeon_vm *vm,
                     struct radeon_fence *fence);
 uint64_t radeon_vm_map_gart(struct radeon_device *rdev, uint64_t addr);
-int radeon_vm_bo_update_pte(struct radeon_device *rdev,
-                           struct radeon_vm *vm,
-                           struct radeon_bo *bo,
-                           struct ttm_mem_reg *mem);
+int radeon_vm_bo_update(struct radeon_device *rdev,
+                       struct radeon_vm *vm,
+                       struct radeon_bo *bo,
+                       struct ttm_mem_reg *mem);
 void radeon_vm_bo_invalidate(struct radeon_device *rdev,
                             struct radeon_bo *bo);
 struct radeon_bo_va *radeon_vm_bo_find(struct radeon_vm *vm,
index 98a9074b306b640644f576e928d4e28701495bb4..77e9d07c55b6701cbdb0a55bcbc9b68954e5c0d7 100644 (file)
 #include <linux/acpi.h>
 #include <linux/slab.h>
 #include <linux/power_supply.h>
-#include <acpi/acpi_drivers.h>
-#include <acpi/acpi_bus.h>
+#include <linux/vga_switcheroo.h>
 #include <acpi/video.h>
-
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
 #include "radeon.h"
 #include "radeon_acpi.h"
 #include "atom.h"
 
-#include <linux/vga_switcheroo.h>
-
 #define ACPI_AC_CLASS           "ac_adapter"
 
 extern void radeon_pm_acpi_event_handler(struct radeon_device *rdev);
index f79ee184ffd5849f4d0e0ec1b87b0d94d0f1f131..5c39bf7c3d88668bad65ef9667de82a0a145f196 100644 (file)
@@ -2918,7 +2918,7 @@ int radeon_atom_get_memory_pll_dividers(struct radeon_device *rdev,
                        mpll_param->dll_speed = args.ucDllSpeed;
                        mpll_param->bwcntl = args.ucBWCntl;
                        mpll_param->vco_mode =
-                               (args.ucPllCntlFlag & MPLL_CNTL_FLAG_VCO_MODE_MASK) ? 1 : 0;
+                               (args.ucPllCntlFlag & MPLL_CNTL_FLAG_VCO_MODE_MASK);
                        mpll_param->yclk_sel =
                                (args.ucPllCntlFlag & MPLL_CNTL_FLAG_BYPASS_DQ_PLL) ? 1 : 0;
                        mpll_param->qdr =
index f41594b2eeac775794f3d2b2d050a06e387d9025..0b366169d64de55c52e4c2d9c26d1c3b9db19b2d 100644 (file)
@@ -360,13 +360,13 @@ static int radeon_bo_vm_update_pte(struct radeon_cs_parser *parser,
        struct radeon_bo *bo;
        int r;
 
-       r = radeon_vm_bo_update_pte(rdev, vm, rdev->ring_tmp_bo.bo, &rdev->ring_tmp_bo.bo->tbo.mem);
+       r = radeon_vm_bo_update(rdev, vm, rdev->ring_tmp_bo.bo, &rdev->ring_tmp_bo.bo->tbo.mem);
        if (r) {
                return r;
        }
        list_for_each_entry(lobj, &parser->validated, tv.head) {
                bo = lobj->bo;
-               r = radeon_vm_bo_update_pte(parser->rdev, vm, bo, &bo->tbo.mem);
+               r = radeon_vm_bo_update(parser->rdev, vm, bo, &bo->tbo.mem);
                if (r) {
                        return r;
                }
index 543dcfae7e6f5f9a01797a9bb90455be5fef88c5..00e0d449021c343015540ea3baf1028b85a10090 100644 (file)
  * 1.31- Add support for num Z pipes from GET_PARAM
  * 1.32- fixes for rv740 setup
  * 1.33- Add r6xx/r7xx const buffer support
+ * 1.34- fix evergreen/cayman GS register
  */
 #define DRIVER_MAJOR           1
-#define DRIVER_MINOR           33
+#define DRIVER_MINOR           34
 #define DRIVER_PATCHLEVEL      0
 
 long radeon_drm_ioctl(struct file *filp,
index 3044e504f4ec9a8a4cbf6ef18bbd009fe7672c01..96e440061bdbf5b65a6213047f62bbeb89aea77f 100644 (file)
@@ -29,6 +29,7 @@
 #include <drm/radeon_drm.h>
 #include "radeon.h"
 #include "radeon_reg.h"
+#include "radeon_trace.h"
 
 /*
  * GART
@@ -737,6 +738,7 @@ struct radeon_fence *radeon_vm_grab_id(struct radeon_device *rdev,
        for (i = 0; i < 2; ++i) {
                if (choices[i]) {
                        vm->id = choices[i];
+                       trace_radeon_vm_grab_id(vm->id, ring);
                        return rdev->vm_manager.active[choices[i]];
                }
        }
@@ -1116,7 +1118,7 @@ static void radeon_vm_update_ptes(struct radeon_device *rdev,
 }
 
 /**
- * radeon_vm_bo_update_pte - map a bo into the vm page table
+ * radeon_vm_bo_update - map a bo into the vm page table
  *
  * @rdev: radeon_device pointer
  * @vm: requested vm
@@ -1128,10 +1130,10 @@ static void radeon_vm_update_ptes(struct radeon_device *rdev,
  *
  * Object have to be reserved & global and local mutex must be locked!
  */
-int radeon_vm_bo_update_pte(struct radeon_device *rdev,
-                           struct radeon_vm *vm,
-                           struct radeon_bo *bo,
-                           struct ttm_mem_reg *mem)
+int radeon_vm_bo_update(struct radeon_device *rdev,
+                       struct radeon_vm *vm,
+                       struct radeon_bo *bo,
+                       struct ttm_mem_reg *mem)
 {
        struct radeon_ib ib;
        struct radeon_bo_va *bo_va;
@@ -1176,6 +1178,8 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev,
                bo_va->valid = false;
        }
 
+       trace_radeon_vm_bo_update(bo_va);
+
        nptes = radeon_bo_ngpu_pages(bo);
 
        /* assume two extra pdes in case the mapping overlaps the borders */
@@ -1257,7 +1261,7 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev,
        mutex_lock(&rdev->vm_manager.lock);
        mutex_lock(&bo_va->vm->mutex);
        if (bo_va->soffset) {
-               r = radeon_vm_bo_update_pte(rdev, bo_va->vm, bo_va->bo, NULL);
+               r = radeon_vm_bo_update(rdev, bo_va->vm, bo_va->bo, NULL);
        }
        mutex_unlock(&rdev->vm_manager.lock);
        list_del(&bo_va->vm_list);
index d1385ccc672c4976aff90d9150fb221f98c29441..dc75bb603ea5f1921795c01be6d78438d5b8d98d 100644 (file)
@@ -537,8 +537,7 @@ static ssize_t radeon_hwmon_show_temp(struct device *dev,
                                      struct device_attribute *attr,
                                      char *buf)
 {
-       struct drm_device *ddev = dev_get_drvdata(dev);
-       struct radeon_device *rdev = ddev->dev_private;
+       struct radeon_device *rdev = dev_get_drvdata(dev);
        int temp;
 
        if (rdev->asic->pm.get_temperature)
@@ -566,23 +565,14 @@ static ssize_t radeon_hwmon_show_temp_thresh(struct device *dev,
        return snprintf(buf, PAGE_SIZE, "%d\n", temp);
 }
 
-static ssize_t radeon_hwmon_show_name(struct device *dev,
-                                     struct device_attribute *attr,
-                                     char *buf)
-{
-       return sprintf(buf, "radeon\n");
-}
-
 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, radeon_hwmon_show_temp, NULL, 0);
 static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, radeon_hwmon_show_temp_thresh, NULL, 0);
 static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, radeon_hwmon_show_temp_thresh, NULL, 1);
-static SENSOR_DEVICE_ATTR(name, S_IRUGO, radeon_hwmon_show_name, NULL, 0);
 
 static struct attribute *hwmon_attributes[] = {
        &sensor_dev_attr_temp1_input.dev_attr.attr,
        &sensor_dev_attr_temp1_crit.dev_attr.attr,
        &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr,
-       &sensor_dev_attr_name.dev_attr.attr,
        NULL
 };
 
@@ -607,11 +597,15 @@ static const struct attribute_group hwmon_attrgroup = {
        .is_visible = hwmon_attributes_visible,
 };
 
+static const struct attribute_group *hwmon_groups[] = {
+       &hwmon_attrgroup,
+       NULL
+};
+
 static int radeon_hwmon_init(struct radeon_device *rdev)
 {
        int err = 0;
-
-       rdev->pm.int_hwmon_dev = NULL;
+       struct device *hwmon_dev;
 
        switch (rdev->pm.int_thermal_type) {
        case THERMAL_TYPE_RV6XX:
@@ -624,20 +618,13 @@ static int radeon_hwmon_init(struct radeon_device *rdev)
        case THERMAL_TYPE_KV:
                if (rdev->asic->pm.get_temperature == NULL)
                        return err;
-               rdev->pm.int_hwmon_dev = hwmon_device_register(rdev->dev);
-               if (IS_ERR(rdev->pm.int_hwmon_dev)) {
-                       err = PTR_ERR(rdev->pm.int_hwmon_dev);
+               hwmon_dev = hwmon_device_register_with_groups(rdev->dev,
+                                                             "radeon", rdev,
+                                                             hwmon_groups);
+               if (IS_ERR(hwmon_dev)) {
+                       err = PTR_ERR(hwmon_dev);
                        dev_err(rdev->dev,
                                "Unable to register hwmon device: %d\n", err);
-                       break;
-               }
-               dev_set_drvdata(rdev->pm.int_hwmon_dev, rdev->ddev);
-               err = sysfs_create_group(&rdev->pm.int_hwmon_dev->kobj,
-                                        &hwmon_attrgroup);
-               if (err) {
-                       dev_err(rdev->dev,
-                               "Unable to create hwmon sysfs file: %d\n", err);
-                       hwmon_device_unregister(rdev->dev);
                }
                break;
        default:
@@ -647,14 +634,6 @@ static int radeon_hwmon_init(struct radeon_device *rdev)
        return err;
 }
 
-static void radeon_hwmon_fini(struct radeon_device *rdev)
-{
-       if (rdev->pm.int_hwmon_dev) {
-               sysfs_remove_group(&rdev->pm.int_hwmon_dev->kobj, &hwmon_attrgroup);
-               hwmon_device_unregister(rdev->pm.int_hwmon_dev);
-       }
-}
-
 static void radeon_dpm_thermal_work_handler(struct work_struct *work)
 {
        struct radeon_device *rdev =
@@ -1337,8 +1316,6 @@ static void radeon_pm_fini_old(struct radeon_device *rdev)
 
        if (rdev->pm.power_state)
                kfree(rdev->pm.power_state);
-
-       radeon_hwmon_fini(rdev);
 }
 
 static void radeon_pm_fini_dpm(struct radeon_device *rdev)
@@ -1358,8 +1335,6 @@ static void radeon_pm_fini_dpm(struct radeon_device *rdev)
 
        if (rdev->pm.power_state)
                kfree(rdev->pm.power_state);
-
-       radeon_hwmon_fini(rdev);
 }
 
 void radeon_pm_fini(struct radeon_device *rdev)
index 9f0e18172b6e8074bf865e93902d67f1584141bd..0473257d407886e175f77347078b2de54c61cfc3 100644 (file)
@@ -47,6 +47,39 @@ TRACE_EVENT(radeon_cs,
                      __entry->fences)
 );
 
+TRACE_EVENT(radeon_vm_grab_id,
+           TP_PROTO(unsigned vmid, int ring),
+           TP_ARGS(vmid, ring),
+           TP_STRUCT__entry(
+                            __field(u32, vmid)
+                            __field(u32, ring)
+                            ),
+
+           TP_fast_assign(
+                          __entry->vmid = vmid;
+                          __entry->ring = ring;
+                          ),
+           TP_printk("vmid=%u, ring=%u", __entry->vmid, __entry->ring)
+);
+
+TRACE_EVENT(radeon_vm_bo_update,
+           TP_PROTO(struct radeon_bo_va *bo_va),
+           TP_ARGS(bo_va),
+           TP_STRUCT__entry(
+                            __field(u64, soffset)
+                            __field(u64, eoffset)
+                            __field(u32, flags)
+                            ),
+
+           TP_fast_assign(
+                          __entry->soffset = bo_va->soffset;
+                          __entry->eoffset = bo_va->eoffset;
+                          __entry->flags = bo_va->flags;
+                          ),
+           TP_printk("soffs=%010llx, eoffs=%010llx, flags=%08x",
+                     __entry->soffset, __entry->eoffset, __entry->flags)
+);
+
 TRACE_EVENT(radeon_vm_set_page,
            TP_PROTO(uint64_t pe, uint64_t addr, unsigned count,
                     uint32_t incr, uint32_t flags),
index a072fa8c46b04a00a9c78886b20a29615f7ad86c..d46b58d078aad94eaca7050eb3deb9c1375583a7 100644 (file)
@@ -21,7 +21,7 @@ cayman 0x9400
 0x000089AC VGT_COMPUTE_THREAD_GOURP_SIZE
 0x000089B0 VGT_HS_OFFCHIP_PARAM
 0x00008A14 PA_CL_ENHANCE
-0x00008A60 PA_SC_LINE_STIPPLE_VALUE
+0x00008A60 PA_SU_LINE_STIPPLE_VALUE
 0x00008B10 PA_SC_LINE_STIPPLE_STATE
 0x00008BF0 PA_SC_ENHANCE
 0x00008D8C SQ_DYN_GPR_CNTL_PS_FLUSH_REQ
@@ -532,7 +532,7 @@ cayman 0x9400
 0x00028B84 PA_SU_POLY_OFFSET_FRONT_OFFSET
 0x00028B88 PA_SU_POLY_OFFSET_BACK_SCALE
 0x00028B8C PA_SU_POLY_OFFSET_BACK_OFFSET
-0x00028B74 VGT_GS_INSTANCE_CNT
+0x00028B90 VGT_GS_INSTANCE_CNT
 0x00028BD4 PA_SC_CENTROID_PRIORITY_0
 0x00028BD8 PA_SC_CENTROID_PRIORITY_1
 0x00028BDC PA_SC_LINE_CNTL
index b912a37689bf818a0fccd576f6436f71e4e936ff..57745c8761c863714abe07ba2ff73324980ea18e 100644 (file)
@@ -22,7 +22,7 @@ evergreen 0x9400
 0x000089A4 VGT_COMPUTE_START_Z
 0x000089AC VGT_COMPUTE_THREAD_GOURP_SIZE
 0x00008A14 PA_CL_ENHANCE
-0x00008A60 PA_SC_LINE_STIPPLE_VALUE
+0x00008A60 PA_SU_LINE_STIPPLE_VALUE
 0x00008B10 PA_SC_LINE_STIPPLE_STATE
 0x00008BF0 PA_SC_ENHANCE
 0x00008D8C SQ_DYN_GPR_CNTL_PS_FLUSH_REQ
@@ -545,7 +545,7 @@ evergreen 0x9400
 0x00028B84 PA_SU_POLY_OFFSET_FRONT_OFFSET
 0x00028B88 PA_SU_POLY_OFFSET_BACK_SCALE
 0x00028B8C PA_SU_POLY_OFFSET_BACK_OFFSET
-0x00028B74 VGT_GS_INSTANCE_CNT
+0x00028B90 VGT_GS_INSTANCE_CNT
 0x00028C00 PA_SC_LINE_CNTL
 0x00028C08 PA_SU_VTX_CNTL
 0x00028C0C PA_CL_GB_VERT_CLIP_ADJ
index 6a64ccaa0695643add9ee7e6b3f383202d35a988..a36736dab5e0694cd5a7b78d6dbb013b484cb8f6 100644 (file)
@@ -3882,8 +3882,15 @@ static int si_mc_init(struct radeon_device *rdev)
        rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0);
        rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0);
        /* size in MB on si */
-       rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
-       rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
+       tmp = RREG32(CONFIG_MEMSIZE);
+       /* some boards may have garbage in the upper 16 bits */
+       if (tmp & 0xffff0000) {
+               DRM_INFO("Probable bad vram size: 0x%08x\n", tmp);
+               if (tmp & 0xffff)
+                       tmp &= 0xffff;
+       }
+       rdev->mc.mc_vram_size = tmp * 1024ULL * 1024ULL;
+       rdev->mc.real_vram_size = rdev->mc.mc_vram_size;
        rdev->mc.visible_vram_size = rdev->mc.aper_size;
        si_vram_gtt_location(rdev, &rdev->mc);
        radeon_update_bandwidth_info(rdev);
index 28e178137718090f317c8884da071458900cce65..07eba596d458d22b63bc9f0a731d6ca3befae036 100644 (file)
@@ -135,11 +135,11 @@ int tegra_drm_submit(struct tegra_drm_context *context,
        unsigned int num_relocs = args->num_relocs;
        unsigned int num_waitchks = args->num_waitchks;
        struct drm_tegra_cmdbuf __user *cmdbufs =
-               (void * __user)(uintptr_t)args->cmdbufs;
+               (void __user *)(uintptr_t)args->cmdbufs;
        struct drm_tegra_reloc __user *relocs =
-               (void * __user)(uintptr_t)args->relocs;
+               (void __user *)(uintptr_t)args->relocs;
        struct drm_tegra_waitchk __user *waitchks =
-               (void * __user)(uintptr_t)args->waitchks;
+               (void __user *)(uintptr_t)args->waitchks;
        struct drm_tegra_syncpt syncpt;
        struct host1x_job *job;
        int err;
@@ -163,9 +163,10 @@ int tegra_drm_submit(struct tegra_drm_context *context,
                struct drm_tegra_cmdbuf cmdbuf;
                struct host1x_bo *bo;
 
-               err = copy_from_user(&cmdbuf, cmdbufs, sizeof(cmdbuf));
-               if (err)
+               if (copy_from_user(&cmdbuf, cmdbufs, sizeof(cmdbuf))) {
+                       err = -EFAULT;
                        goto fail;
+               }
 
                bo = host1x_bo_lookup(drm, file, cmdbuf.handle);
                if (!bo) {
@@ -178,10 +179,11 @@ int tegra_drm_submit(struct tegra_drm_context *context,
                cmdbufs++;
        }
 
-       err = copy_from_user(job->relocarray, relocs,
-                            sizeof(*relocs) * num_relocs);
-       if (err)
+       if (copy_from_user(job->relocarray, relocs,
+                          sizeof(*relocs) * num_relocs)) {
+               err = -EFAULT;
                goto fail;
+       }
 
        while (num_relocs--) {
                struct host1x_reloc *reloc = &job->relocarray[num_relocs];
@@ -199,15 +201,17 @@ int tegra_drm_submit(struct tegra_drm_context *context,
                }
        }
 
-       err = copy_from_user(job->waitchk, waitchks,
-                            sizeof(*waitchks) * num_waitchks);
-       if (err)
+       if (copy_from_user(job->waitchk, waitchks,
+                          sizeof(*waitchks) * num_waitchks)) {
+               err = -EFAULT;
                goto fail;
+       }
 
-       err = copy_from_user(&syncpt, (void * __user)(uintptr_t)args->syncpts,
-                            sizeof(syncpt));
-       if (err)
+       if (copy_from_user(&syncpt, (void __user *)(uintptr_t)args->syncpts,
+                          sizeof(syncpt))) {
+               err = -EFAULT;
                goto fail;
+       }
 
        job->is_addr_reg = context->client->ops->is_addr_reg;
        job->syncpt_incrs = syncpt.incrs;
@@ -573,7 +577,7 @@ static void tegra_debugfs_cleanup(struct drm_minor *minor)
 }
 #endif
 
-struct drm_driver tegra_drm_driver = {
+static struct drm_driver tegra_drm_driver = {
        .driver_features = DRIVER_MODESET | DRIVER_GEM,
        .load = tegra_drm_load,
        .unload = tegra_drm_unload,
index fdfe259ed7f8e5e403f984d533b54a3257128aef..7da0b923131f05ca5f67fb8113f2fd9754023a15 100644 (file)
@@ -116,7 +116,7 @@ host1x_client_to_dc(struct host1x_client *client)
 
 static inline struct tegra_dc *to_tegra_dc(struct drm_crtc *crtc)
 {
-       return container_of(crtc, struct tegra_dc, base);
+       return crtc ? container_of(crtc, struct tegra_dc, base) : NULL;
 }
 
 static inline void tegra_dc_writel(struct tegra_dc *dc, unsigned long value,
index 490f7719e317ed80319f4961a69d3e349d1ad333..a3835e7de1842b84145e52c40ef15ed21e183323 100644 (file)
@@ -247,7 +247,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
                 info->var.yoffset * fb->pitches[0];
 
        drm->mode_config.fb_base = (resource_size_t)bo->paddr;
-       info->screen_base = bo->vaddr + offset;
+       info->screen_base = (void __iomem *)bo->vaddr + offset;
        info->screen_size = size;
        info->fix.smem_start = (unsigned long)(bo->paddr + offset);
        info->fix.smem_len = size;
index ba47ca4fb880cc239a9b5c454b3b6c5b5adcddc8..3b29018913a5f2bb9da1a2ae2f57ddc89280bbe8 100644 (file)
@@ -14,6 +14,8 @@
 
 struct tegra_rgb {
        struct tegra_output output;
+       struct tegra_dc *dc;
+
        struct clk *clk_parent;
        struct clk *clk;
 };
@@ -84,18 +86,18 @@ static void tegra_dc_write_regs(struct tegra_dc *dc,
 
 static int tegra_output_rgb_enable(struct tegra_output *output)
 {
-       struct tegra_dc *dc = to_tegra_dc(output->encoder.crtc);
+       struct tegra_rgb *rgb = to_rgb(output);
 
-       tegra_dc_write_regs(dc, rgb_enable, ARRAY_SIZE(rgb_enable));
+       tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable));
 
        return 0;
 }
 
 static int tegra_output_rgb_disable(struct tegra_output *output)
 {
-       struct tegra_dc *dc = to_tegra_dc(output->encoder.crtc);
+       struct tegra_rgb *rgb = to_rgb(output);
 
-       tegra_dc_write_regs(dc, rgb_disable, ARRAY_SIZE(rgb_disable));
+       tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable));
 
        return 0;
 }
@@ -146,6 +148,7 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc)
 
        rgb->output.dev = dc->dev;
        rgb->output.of_node = np;
+       rgb->dc = dc;
 
        err = tegra_output_probe(&rgb->output);
        if (err < 0)
index 24ffbe990736e3e0751609e78d113d08c952b69f..8d67b943ac05ce2d1dd44597d00a1e5a07fd9bdb 100644 (file)
@@ -125,6 +125,12 @@ static int udl_gem_get_pages(struct udl_gem_object *obj, gfp_t gfpmask)
 
 static void udl_gem_put_pages(struct udl_gem_object *obj)
 {
+       if (obj->base.import_attach) {
+               drm_free_large(obj->pages);
+               obj->pages = NULL;
+               return;
+       }
+
        drm_gem_put_pages(&obj->base, obj->pages, false, false);
        obj->pages = NULL;
 }
index 7776e6f0aef650d475e39640b3d781b42f8d7036..0489c61524826f2e2b673628783393639f0c591e 100644 (file)
@@ -150,6 +150,8 @@ struct vmw_ttm_tt {
        bool mapped;
 };
 
+const size_t vmw_tt_size = sizeof(struct vmw_ttm_tt);
+
 /**
  * Helper functions to advance a struct vmw_piter iterator.
  *
index db85985c7086f04648b6a4bb89b83f352c393ec2..20890ad8408bb5ef377c4ff54c80397c3105efaf 100644 (file)
@@ -615,6 +615,7 @@ extern int vmw_mmap(struct file *filp, struct vm_area_struct *vma);
  * TTM buffer object driver - vmwgfx_buffer.c
  */
 
+extern const size_t vmw_tt_size;
 extern struct ttm_placement vmw_vram_placement;
 extern struct ttm_placement vmw_vram_ne_placement;
 extern struct ttm_placement vmw_vram_sys_placement;
index ecb3d867b4260d9c9ada27438fb252dac1fc77e9..03f1c203863193621d9941af3051169ea2f79afb 100644 (file)
@@ -75,6 +75,7 @@ void vmw_display_unit_cleanup(struct vmw_display_unit *du)
                vmw_surface_unreference(&du->cursor_surface);
        if (du->cursor_dmabuf)
                vmw_dmabuf_unreference(&du->cursor_dmabuf);
+       drm_sysfs_connector_remove(&du->connector);
        drm_crtc_cleanup(&du->crtc);
        drm_encoder_cleanup(&du->encoder);
        drm_connector_cleanup(&du->connector);
index 79f7e8e605296902bb4355b78e2e78d1792f89fa..a055a26819c2b6b7963d6d245576e17b8d9a7500 100644 (file)
@@ -260,6 +260,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
                connector->encoder = NULL;
                encoder->crtc = NULL;
                crtc->fb = NULL;
+               crtc->enabled = false;
 
                vmw_ldu_del_active(dev_priv, ldu);
 
@@ -285,6 +286,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
        crtc->x = set->x;
        crtc->y = set->y;
        crtc->mode = *mode;
+       crtc->enabled = true;
 
        vmw_ldu_add_active(dev_priv, ldu, vfb);
 
@@ -369,6 +371,8 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
        encoder->possible_crtcs = (1 << unit);
        encoder->possible_clones = 0;
 
+       (void) drm_sysfs_connector_add(connector);
+
        drm_crtc_init(dev, crtc, &vmw_legacy_crtc_funcs);
 
        drm_mode_crtc_set_gamma_size(crtc, 256);
index efe2b74c5eb17f1f86b12048be5884c9aabf50b2..9b5ea2ac7ddff21562aa7ef52a2f96872c623116 100644 (file)
@@ -352,6 +352,38 @@ int vmw_user_lookup_handle(struct vmw_private *dev_priv,
 /**
  * Buffer management.
  */
+
+/**
+ * vmw_dmabuf_acc_size - Calculate the pinned memory usage of buffers
+ *
+ * @dev_priv: Pointer to a struct vmw_private identifying the device.
+ * @size: The requested buffer size.
+ * @user: Whether this is an ordinary dma buffer or a user dma buffer.
+ */
+static size_t vmw_dmabuf_acc_size(struct vmw_private *dev_priv, size_t size,
+                                 bool user)
+{
+       static size_t struct_size, user_struct_size;
+       size_t num_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
+       size_t page_array_size = ttm_round_pot(num_pages * sizeof(void *));
+
+       if (unlikely(struct_size == 0)) {
+               size_t backend_size = ttm_round_pot(vmw_tt_size);
+
+               struct_size = backend_size +
+                       ttm_round_pot(sizeof(struct vmw_dma_buffer));
+               user_struct_size = backend_size +
+                       ttm_round_pot(sizeof(struct vmw_user_dma_buffer));
+       }
+
+       if (dev_priv->map_mode == vmw_dma_alloc_coherent)
+               page_array_size +=
+                       ttm_round_pot(num_pages * sizeof(dma_addr_t));
+
+       return ((user) ? user_struct_size : struct_size) +
+               page_array_size;
+}
+
 void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo)
 {
        struct vmw_dma_buffer *vmw_bo = vmw_dma_buffer(bo);
@@ -359,6 +391,13 @@ void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo)
        kfree(vmw_bo);
 }
 
+static void vmw_user_dmabuf_destroy(struct ttm_buffer_object *bo)
+{
+       struct vmw_user_dma_buffer *vmw_user_bo = vmw_user_dma_buffer(bo);
+
+       ttm_prime_object_kfree(vmw_user_bo, prime);
+}
+
 int vmw_dmabuf_init(struct vmw_private *dev_priv,
                    struct vmw_dma_buffer *vmw_bo,
                    size_t size, struct ttm_placement *placement,
@@ -368,28 +407,23 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv,
        struct ttm_bo_device *bdev = &dev_priv->bdev;
        size_t acc_size;
        int ret;
+       bool user = (bo_free == &vmw_user_dmabuf_destroy);
 
-       BUG_ON(!bo_free);
+       BUG_ON(!bo_free && (!user && (bo_free != vmw_dmabuf_bo_free)));
 
-       acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct vmw_dma_buffer));
+       acc_size = vmw_dmabuf_acc_size(dev_priv, size, user);
        memset(vmw_bo, 0, sizeof(*vmw_bo));
 
        INIT_LIST_HEAD(&vmw_bo->res_list);
 
        ret = ttm_bo_init(bdev, &vmw_bo->base, size,
-                         ttm_bo_type_device, placement,
+                         (user) ? ttm_bo_type_device :
+                         ttm_bo_type_kernel, placement,
                          0, interruptible,
                          NULL, acc_size, NULL, bo_free);
        return ret;
 }
 
-static void vmw_user_dmabuf_destroy(struct ttm_buffer_object *bo)
-{
-       struct vmw_user_dma_buffer *vmw_user_bo = vmw_user_dma_buffer(bo);
-
-       ttm_prime_object_kfree(vmw_user_bo, prime);
-}
-
 static void vmw_user_dmabuf_release(struct ttm_base_object **p_base)
 {
        struct vmw_user_dma_buffer *vmw_user_bo;
@@ -781,54 +815,55 @@ err_ref:
 }
 
 
+/**
+ * vmw_dumb_create - Create a dumb kms buffer
+ *
+ * @file_priv: Pointer to a struct drm_file identifying the caller.
+ * @dev: Pointer to the drm device.
+ * @args: Pointer to a struct drm_mode_create_dumb structure
+ *
+ * This is a driver callback for the core drm create_dumb functionality.
+ * Note that this is very similar to the vmw_dmabuf_alloc ioctl, except
+ * that the arguments have a different format.
+ */
 int vmw_dumb_create(struct drm_file *file_priv,
                    struct drm_device *dev,
                    struct drm_mode_create_dumb *args)
 {
        struct vmw_private *dev_priv = vmw_priv(dev);
        struct vmw_master *vmaster = vmw_master(file_priv->master);
-       struct vmw_user_dma_buffer *vmw_user_bo;
-       struct ttm_buffer_object *tmp;
+       struct vmw_dma_buffer *dma_buf;
        int ret;
 
        args->pitch = args->width * ((args->bpp + 7) / 8);
        args->size = args->pitch * args->height;
 
-       vmw_user_bo = kzalloc(sizeof(*vmw_user_bo), GFP_KERNEL);
-       if (vmw_user_bo == NULL)
-               return -ENOMEM;
-
        ret = ttm_read_lock(&vmaster->lock, true);
-       if (ret != 0) {
-               kfree(vmw_user_bo);
+       if (unlikely(ret != 0))
                return ret;
-       }
 
-       ret = vmw_dmabuf_init(dev_priv, &vmw_user_bo->dma, args->size,
-                             &vmw_vram_sys_placement, true,
-                             &vmw_user_dmabuf_destroy);
-       if (ret != 0)
-               goto out_no_dmabuf;
-
-       tmp = ttm_bo_reference(&vmw_user_bo->dma.base);
-       ret = ttm_prime_object_init(vmw_fpriv(file_priv)->tfile,
-                                   args->size,
-                                   &vmw_user_bo->prime,
-                                   false,
-                                   ttm_buffer_type,
-                                   &vmw_user_dmabuf_release, NULL);
+       ret = vmw_user_dmabuf_alloc(dev_priv, vmw_fpriv(file_priv)->tfile,
+                                   args->size, false, &args->handle,
+                                   &dma_buf);
        if (unlikely(ret != 0))
-               goto out_no_base_object;
-
-       args->handle = vmw_user_bo->prime.base.hash.key;
+               goto out_no_dmabuf;
 
-out_no_base_object:
-       ttm_bo_unref(&tmp);
+       vmw_dmabuf_unreference(&dma_buf);
 out_no_dmabuf:
        ttm_read_unlock(&vmaster->lock);
        return ret;
 }
 
+/**
+ * vmw_dumb_map_offset - Return the address space offset of a dumb buffer
+ *
+ * @file_priv: Pointer to a struct drm_file identifying the caller.
+ * @dev: Pointer to the drm device.
+ * @handle: Handle identifying the dumb buffer.
+ * @offset: The address space offset returned.
+ *
+ * This is a driver callback for the core drm dumb_map_offset functionality.
+ */
 int vmw_dumb_map_offset(struct drm_file *file_priv,
                        struct drm_device *dev, uint32_t handle,
                        uint64_t *offset)
@@ -846,6 +881,15 @@ int vmw_dumb_map_offset(struct drm_file *file_priv,
        return 0;
 }
 
+/**
+ * vmw_dumb_destroy - Destroy a dumb boffer
+ *
+ * @file_priv: Pointer to a struct drm_file identifying the caller.
+ * @dev: Pointer to the drm device.
+ * @handle: Handle identifying the dumb buffer.
+ *
+ * This is a driver callback for the core drm dumb_destroy functionality.
+ */
 int vmw_dumb_destroy(struct drm_file *file_priv,
                     struct drm_device *dev,
                     uint32_t handle)
index 26387c3d5a21f01c51d844c228f26a6232b84453..22406c8651ead6caa629ce6ae2de963bdd0a35d7 100644 (file)
@@ -310,6 +310,7 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set)
                crtc->fb = NULL;
                crtc->x = 0;
                crtc->y = 0;
+               crtc->enabled = false;
 
                vmw_sou_del_active(dev_priv, sou);
 
@@ -370,6 +371,7 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set)
                crtc->fb = NULL;
                crtc->x = 0;
                crtc->y = 0;
+               crtc->enabled = false;
 
                return ret;
        }
@@ -382,6 +384,7 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set)
        crtc->fb = fb;
        crtc->x = set->x;
        crtc->y = set->y;
+       crtc->enabled = true;
 
        return 0;
 }
@@ -464,6 +467,8 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)
        encoder->possible_crtcs = (1 << unit);
        encoder->possible_clones = 0;
 
+       (void) drm_sysfs_connector_add(connector);
+
        drm_crtc_init(dev, crtc, &vmw_screen_object_crtc_funcs);
 
        drm_mode_crtc_set_gamma_size(crtc, 256);
index 509383f8be034ec3512c95b1c2100818bad5d71e..6a929591aa73801df1126433bc514980e80d1465 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/of.h>
 #include <linux/slab.h>
 
+#include "bus.h"
 #include "dev.h"
 
 static DEFINE_MUTEX(clients_lock);
@@ -257,7 +258,7 @@ static int host1x_unregister_client(struct host1x *host1x,
        return -ENODEV;
 }
 
-struct bus_type host1x_bus_type = {
+static struct bus_type host1x_bus_type = {
        .name = "host1x",
 };
 
@@ -301,7 +302,7 @@ static int host1x_device_add(struct host1x *host1x,
        device->dev.coherent_dma_mask = host1x->dev->coherent_dma_mask;
        device->dev.dma_mask = &device->dev.coherent_dma_mask;
        device->dev.release = host1x_device_release;
-       dev_set_name(&device->dev, driver->name);
+       dev_set_name(&device->dev, "%s", driver->name);
        device->dev.bus = &host1x_bus_type;
        device->dev.parent = host1x->dev;
 
index 37e2a63241a9d6150b1554896fde15ac0294c157..6b09b71940c2d5df0251ec2b3cd417ec2eb93e2d 100644 (file)
@@ -54,8 +54,8 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
                u32 *p = (u32 *)((u32)pb->mapped + getptr);
                *(p++) = HOST1X_OPCODE_NOP;
                *(p++) = HOST1X_OPCODE_NOP;
-               dev_dbg(host1x->dev, "%s: NOP at 0x%x\n", __func__,
-                       pb->phys + getptr);
+               dev_dbg(host1x->dev, "%s: NOP at %#llx\n", __func__,
+                       (u64)pb->phys + getptr);
                getptr = (getptr + 8) & (pb->size_bytes - 1);
        }
        wmb();
index 640c75ca5a8bbc465dcc9f1350d4f5efdd928d5d..f72c873eff819f831202a742cf02ec70e94753f2 100644 (file)
@@ -163,8 +163,8 @@ static void show_channel_gathers(struct output *o, struct host1x_cdma *cdma)
                                continue;
                        }
 
-                       host1x_debug_output(o, "    GATHER at %08x+%04x, %d words\n",
-                                           g->base, g->offset, g->words);
+                       host1x_debug_output(o, "    GATHER at %#llx+%04x, %d words\n",
+                                           (u64)g->base, g->offset, g->words);
 
                        show_gather(o, g->base + g->offset, g->words, cdma,
                                    g->base, mapped);
index 34e2d39d4ce814cb312de6eee14dae43179cb5c3..f7220011a00b7cde8c16754743517ca17301366a 100644 (file)
@@ -344,6 +344,7 @@ config HID_LOGITECH
 
 config HID_LOGITECH_DJ
        tristate "Logitech Unifying receivers full support"
+       depends on HIDRAW
        depends on HID_LOGITECH
        ---help---
        Say Y if you want support for Logitech Unifying receivers and devices.
index 253fe23ef7fe5332ea03f96449f312a69a6b80c0..4c251e1c332a453b22a62af20e6c3f2054962397 100644 (file)
@@ -1823,8 +1823,8 @@ static const struct hid_device_id hid_have_special_driver[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS817_TOUCH) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS817_TOUCH) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) },
index f9304cb37154982da4de6774894c213bf412163f..f9ca7abe460196ff2dfb5636edd91e2ca0ce9f11 100644 (file)
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD  0xc20a
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD       0xc211
 #define USB_DEVICE_ID_LOGITECH_EXTREME_3D      0xc215
+#define USB_DEVICE_ID_LOGITECH_DUAL_ACTION     0xc216
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2      0xc218
 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2    0xc219
 #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D     0xc283
 #define USB_VENDOR_ID_SIGMATEL         0x066F
 #define USB_DEVICE_ID_SIGMATEL_STMP3780        0x3780
 
-#define USB_VENDOR_ID_SIS2_TOUCH       0x0457
+#define USB_VENDOR_ID_SIS_TOUCH                0x0457
 #define USB_DEVICE_ID_SIS9200_TOUCH    0x9200
 #define USB_DEVICE_ID_SIS817_TOUCH     0x0817
+#define USB_DEVICE_ID_SIS_TS           0x1013
 
 #define USB_VENDOR_ID_SKYCABLE                 0x1223
 #define        USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER       0x3F07
 #define USB_DEVICE_ID_SYNAPTICS_DPAD   0x0013
 #define USB_DEVICE_ID_SYNAPTICS_LTS1   0x0af8
 #define USB_DEVICE_ID_SYNAPTICS_LTS2   0x1d10
+#define USB_DEVICE_ID_SYNAPTICS_HD     0x0ac3
+#define USB_DEVICE_ID_SYNAPTICS_QUAD_HD        0x1ac3
 
 #define USB_VENDOR_ID_THINGM           0x27b8
 #define USB_DEVICE_ID_BLINK1           0x01ed
 #define USB_VENDOR_ID_PRIMAX   0x0461
 #define USB_DEVICE_ID_PRIMAX_KEYBOARD  0x4e05
 
-#define USB_VENDOR_ID_SIS      0x0457
-#define USB_DEVICE_ID_SIS_TS   0x1013
 
 #endif
index 06eb45fa6331fee64152754a5ab9bb2275e3a61c..9fe9d4ac3114bb224f942678de76191fbe846edc 100644 (file)
@@ -758,6 +758,8 @@ static const struct hid_device_id lg_devices[] = {
 
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D),
                .driver_data = LG_NOGET },
+       { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DUAL_ACTION),
+               .driver_data = LG_NOGET },
        { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL),
                .driver_data = LG_NOGET | LG_FF4 },
 
index d83b1e8b505b512769d8c5955eb8a0b8ca4e5b23..a2d8adf39d7af73ad6416966cecf8ef523715b5d 100644 (file)
@@ -1301,10 +1301,10 @@ static const struct hid_device_id mt_devices[] = {
 
        /* SiS panels */
        { .driver_data = MT_CLS_DEFAULT,
-               HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH,
+               HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH,
                USB_DEVICE_ID_SIS9200_TOUCH) },
        { .driver_data = MT_CLS_DEFAULT,
-               HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH,
+               HID_USB_DEVICE(USB_VENDOR_ID_SIS_TOUCH,
                USB_DEVICE_ID_SIS817_TOUCH) },
 
        /* Stantum panels */
index a184e1921c11190ffce1033e5b7d4f512d55f798..d87f7cb4bee5af2b6c9d08dc02630c08f0f69cfb 100644 (file)
@@ -112,13 +112,15 @@ static int sensor_hub_get_physical_device_count(
 
 static void sensor_hub_fill_attr_info(
                struct hid_sensor_hub_attribute_info *info,
-               s32 index, s32 report_id, s32 units, s32 unit_expo, s32 size)
+               s32 index, s32 report_id, struct hid_field *field)
 {
        info->index = index;
        info->report_id = report_id;
-       info->units = units;
-       info->unit_expo = unit_expo;
-       info->size = size/8;
+       info->units = field->unit;
+       info->unit_expo = field->unit_exponent;
+       info->size = (field->report_size * field->report_count)/8;
+       info->logical_minimum = field->logical_minimum;
+       info->logical_maximum = field->logical_maximum;
 }
 
 static struct hid_sensor_hub_callbacks *sensor_hub_get_callback(
@@ -325,9 +327,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
                        if (field->physical == usage_id &&
                                field->logical == attr_usage_id) {
                                sensor_hub_fill_attr_info(info, i, report->id,
-                                       field->unit, field->unit_exponent,
-                                       field->report_size *
-                                                       field->report_count);
+                                                         field);
                                ret = 0;
                        } else {
                                for (j = 0; j < field->maxusage; ++j) {
@@ -336,11 +336,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
                                        field->usage[j].collection_index ==
                                        collection_index) {
                                                sensor_hub_fill_attr_info(info,
-                                                       i, report->id,
-                                                       field->unit,
-                                                       field->unit_exponent,
-                                                       field->report_size *
-                                                       field->report_count);
+                                                         i, report->id, field);
                                                ret = 0;
                                                break;
                                        }
index 098af2f84b8c653dca9542d78de33c5c5777fe8b..b60bc38903db39f885c4a1d7a680790540edef47 100644 (file)
 
 #include "hid-ids.h"
 
-#define VAIO_RDESC_CONSTANT     (1 << 0)
-#define SIXAXIS_CONTROLLER_USB  (1 << 1)
-#define SIXAXIS_CONTROLLER_BT   (1 << 2)
-#define BUZZ_CONTROLLER         (1 << 3)
-#define PS3REMOTE              (1 << 4)
+#define VAIO_RDESC_CONSTANT     BIT(0)
+#define SIXAXIS_CONTROLLER_USB  BIT(1)
+#define SIXAXIS_CONTROLLER_BT   BIT(2)
+#define BUZZ_CONTROLLER         BIT(3)
+#define PS3REMOTE              BIT(4)
+
+#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER_USB | BUZZ_CONTROLLER)
 
 static const u8 sixaxis_rdesc_fixup[] = {
        0x95, 0x13, 0x09, 0x01, 0x81, 0x02, 0x95, 0x0C,
@@ -223,21 +225,17 @@ static const unsigned int buzz_keymap[] = {
 };
 
 struct sony_sc {
+       struct hid_device *hdev;
+       struct led_classdev *leds[4];
        unsigned long quirks;
+       struct work_struct state_worker;
 
 #ifdef CONFIG_SONY_FF
-       struct work_struct rumble_worker;
-       struct hid_device *hdev;
        __u8 left;
        __u8 right;
 #endif
 
-       void *extra;
-};
-
-struct buzz_extra {
-       int led_state;
-       struct led_classdev *leds[4];
+       __u8 led_state;
 };
 
 static __u8 *ps3remote_fixup(struct hid_device *hdev, __u8 *rdesc,
@@ -466,58 +464,66 @@ static void buzz_set_leds(struct hid_device *hdev, int leds)
        hid_hw_request(hdev, report, HID_REQ_SET_REPORT);
 }
 
-static void buzz_led_set_brightness(struct led_classdev *led,
+static void sony_set_leds(struct hid_device *hdev, __u8 leds)
+{
+       struct sony_sc *drv_data = hid_get_drvdata(hdev);
+
+       if (drv_data->quirks & BUZZ_CONTROLLER) {
+               buzz_set_leds(hdev, leds);
+       } else if (drv_data->quirks & SIXAXIS_CONTROLLER_USB) {
+               drv_data->led_state = leds;
+               schedule_work(&drv_data->state_worker);
+       }
+}
+
+static void sony_led_set_brightness(struct led_classdev *led,
                                    enum led_brightness value)
 {
        struct device *dev = led->dev->parent;
        struct hid_device *hdev = container_of(dev, struct hid_device, dev);
        struct sony_sc *drv_data;
-       struct buzz_extra *buzz;
 
        int n;
 
        drv_data = hid_get_drvdata(hdev);
-       if (!drv_data || !drv_data->extra) {
+       if (!drv_data) {
                hid_err(hdev, "No device data\n");
                return;
        }
-       buzz = drv_data->extra;
 
        for (n = 0; n < 4; n++) {
-               if (led == buzz->leds[n]) {
-                       int on = !! (buzz->led_state & (1 << n));
+               if (led == drv_data->leds[n]) {
+                       int on = !!(drv_data->led_state & (1 << n));
                        if (value == LED_OFF && on) {
-                               buzz->led_state &= ~(1 << n);
-                               buzz_set_leds(hdev, buzz->led_state);
+                               drv_data->led_state &= ~(1 << n);
+                               sony_set_leds(hdev, drv_data->led_state);
                        } else if (value != LED_OFF && !on) {
-                               buzz->led_state |= (1 << n);
-                               buzz_set_leds(hdev, buzz->led_state);
+                               drv_data->led_state |= (1 << n);
+                               sony_set_leds(hdev, drv_data->led_state);
                        }
                        break;
                }
        }
 }
 
-static enum led_brightness buzz_led_get_brightness(struct led_classdev *led)
+static enum led_brightness sony_led_get_brightness(struct led_classdev *led)
 {
        struct device *dev = led->dev->parent;
        struct hid_device *hdev = container_of(dev, struct hid_device, dev);
        struct sony_sc *drv_data;
-       struct buzz_extra *buzz;
 
        int n;
        int on = 0;
 
        drv_data = hid_get_drvdata(hdev);
-       if (!drv_data || !drv_data->extra) {
+       if (!drv_data) {
                hid_err(hdev, "No device data\n");
                return LED_OFF;
        }
-       buzz = drv_data->extra;
 
        for (n = 0; n < 4; n++) {
-               if (led == buzz->leds[n]) {
-                       on = !! (buzz->led_state & (1 << n));
+               if (led == drv_data->leds[n]) {
+                       on = !!(drv_data->led_state & (1 << n));
                        break;
                }
        }
@@ -525,35 +531,55 @@ static enum led_brightness buzz_led_get_brightness(struct led_classdev *led)
        return on ? LED_FULL : LED_OFF;
 }
 
-static int buzz_init(struct hid_device *hdev)
+static void sony_leds_remove(struct hid_device *hdev)
+{
+       struct sony_sc *drv_data;
+       struct led_classdev *led;
+       int n;
+
+       drv_data = hid_get_drvdata(hdev);
+       BUG_ON(!(drv_data->quirks & SONY_LED_SUPPORT));
+
+       for (n = 0; n < 4; n++) {
+               led = drv_data->leds[n];
+               drv_data->leds[n] = NULL;
+               if (!led)
+                       continue;
+               led_classdev_unregister(led);
+               kfree(led);
+       }
+}
+
+static int sony_leds_init(struct hid_device *hdev)
 {
        struct sony_sc *drv_data;
-       struct buzz_extra *buzz;
        int n, ret = 0;
        struct led_classdev *led;
        size_t name_sz;
        char *name;
+       size_t name_len;
+       const char *name_fmt;
 
        drv_data = hid_get_drvdata(hdev);
-       BUG_ON(!(drv_data->quirks & BUZZ_CONTROLLER));
-
-       /* Validate expected report characteristics. */
-       if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 0, 0, 7))
-               return -ENODEV;
-
-       buzz = kzalloc(sizeof(*buzz), GFP_KERNEL);
-       if (!buzz) {
-               hid_err(hdev, "Insufficient memory, cannot allocate driver data\n");
-               return -ENOMEM;
+       BUG_ON(!(drv_data->quirks & SONY_LED_SUPPORT));
+
+       if (drv_data->quirks & BUZZ_CONTROLLER) {
+               name_len = strlen("::buzz#");
+               name_fmt = "%s::buzz%d";
+               /* Validate expected report characteristics. */
+               if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 0, 0, 7))
+                       return -ENODEV;
+       } else {
+               name_len = strlen("::sony#");
+               name_fmt = "%s::sony%d";
        }
-       drv_data->extra = buzz;
 
        /* Clear LEDs as we have no way of reading their initial state. This is
         * only relevant if the driver is loaded after somebody actively set the
         * LEDs to on */
-       buzz_set_leds(hdev, 0x00);
+       sony_set_leds(hdev, 0x00);
 
-       name_sz = strlen(dev_name(&hdev->dev)) + strlen("::buzz#") + 1;
+       name_sz = strlen(dev_name(&hdev->dev)) + name_len + 1;
 
        for (n = 0; n < 4; n++) {
                led = kzalloc(sizeof(struct led_classdev) + name_sz, GFP_KERNEL);
@@ -563,12 +589,12 @@ static int buzz_init(struct hid_device *hdev)
                }
 
                name = (void *)(&led[1]);
-               snprintf(name, name_sz, "%s::buzz%d", dev_name(&hdev->dev), n + 1);
+               snprintf(name, name_sz, name_fmt, dev_name(&hdev->dev), n + 1);
                led->name = name;
                led->brightness = 0;
                led->max_brightness = 1;
-               led->brightness_get = buzz_led_get_brightness;
-               led->brightness_set = buzz_led_set_brightness;
+               led->brightness_get = sony_led_get_brightness;
+               led->brightness_set = sony_led_set_brightness;
 
                if (led_classdev_register(&hdev->dev, led)) {
                        hid_err(hdev, "Failed to register LED %d\n", n);
@@ -576,59 +602,24 @@ static int buzz_init(struct hid_device *hdev)
                        goto error_leds;
                }
 
-               buzz->leds[n] = led;
+               drv_data->leds[n] = led;
        }
 
        return ret;
 
 error_leds:
-       for (n = 0; n < 4; n++) {
-               led = buzz->leds[n];
-               buzz->leds[n] = NULL;
-               if (!led)
-                       continue;
-               led_classdev_unregister(led);
-               kfree(led);
-       }
+       sony_leds_remove(hdev);
 
-       kfree(drv_data->extra);
-       drv_data->extra = NULL;
        return ret;
 }
 
-static void buzz_remove(struct hid_device *hdev)
-{
-       struct sony_sc *drv_data;
-       struct buzz_extra *buzz;
-       struct led_classdev *led;
-       int n;
-
-       drv_data = hid_get_drvdata(hdev);
-       BUG_ON(!(drv_data->quirks & BUZZ_CONTROLLER));
-
-       buzz = drv_data->extra;
-
-       for (n = 0; n < 4; n++) {
-               led = buzz->leds[n];
-               buzz->leds[n] = NULL;
-               if (!led)
-                       continue;
-               led_classdev_unregister(led);
-               kfree(led);
-       }
-
-       kfree(drv_data->extra);
-       drv_data->extra = NULL;
-}
-
-#ifdef CONFIG_SONY_FF
-static void sony_rumble_worker(struct work_struct *work)
+static void sony_state_worker(struct work_struct *work)
 {
-       struct sony_sc *sc = container_of(work, struct sony_sc, rumble_worker);
+       struct sony_sc *sc = container_of(work, struct sony_sc, state_worker);
        unsigned char buf[] = {
                0x01,
                0x00, 0xff, 0x00, 0xff, 0x00,
-               0x00, 0x00, 0x00, 0x00, 0x03,
+               0x00, 0x00, 0x00, 0x00, 0x00,
                0xff, 0x27, 0x10, 0x00, 0x32,
                0xff, 0x27, 0x10, 0x00, 0x32,
                0xff, 0x27, 0x10, 0x00, 0x32,
@@ -636,13 +627,18 @@ static void sony_rumble_worker(struct work_struct *work)
                0x00, 0x00, 0x00, 0x00, 0x00
        };
 
+#ifdef CONFIG_SONY_FF
        buf[3] = sc->right;
        buf[5] = sc->left;
+#endif
+
+       buf[10] |= (sc->led_state & 0xf) << 1;
 
        sc->hdev->hid_output_raw_report(sc->hdev, buf, sizeof(buf),
                                        HID_OUTPUT_REPORT);
 }
 
+#ifdef CONFIG_SONY_FF
 static int sony_play_effect(struct input_dev *dev, void *data,
                            struct ff_effect *effect)
 {
@@ -655,7 +651,7 @@ static int sony_play_effect(struct input_dev *dev, void *data,
        sc->left = effect->u.rumble.strong_magnitude / 256;
        sc->right = effect->u.rumble.weak_magnitude ? 1 : 0;
 
-       schedule_work(&sc->rumble_worker);
+       schedule_work(&sc->state_worker);
        return 0;
 }
 
@@ -664,10 +660,6 @@ static int sony_init_ff(struct hid_device *hdev)
        struct hid_input *hidinput = list_entry(hdev->inputs.next,
                                                struct hid_input, list);
        struct input_dev *input_dev = hidinput->input;
-       struct sony_sc *sc = hid_get_drvdata(hdev);
-
-       sc->hdev = hdev;
-       INIT_WORK(&sc->rumble_worker, sony_rumble_worker);
 
        input_set_capability(input_dev, EV_FF, FF_RUMBLE);
        return input_ff_create_memless(input_dev, NULL, sony_play_effect);
@@ -677,7 +669,7 @@ static void sony_destroy_ff(struct hid_device *hdev)
 {
        struct sony_sc *sc = hid_get_drvdata(hdev);
 
-       cancel_work_sync(&sc->rumble_worker);
+       cancel_work_sync(&sc->state_worker);
 }
 
 #else
@@ -706,6 +698,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
 
        sc->quirks = quirks;
        hid_set_drvdata(hdev, sc);
+       sc->hdev = hdev;
 
        ret = hid_parse(hdev);
        if (ret) {
@@ -729,23 +722,30 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
        if (sc->quirks & SIXAXIS_CONTROLLER_USB) {
                hdev->hid_output_raw_report = sixaxis_usb_output_raw_report;
                ret = sixaxis_set_operational_usb(hdev);
+               INIT_WORK(&sc->state_worker, sony_state_worker);
        }
        else if (sc->quirks & SIXAXIS_CONTROLLER_BT)
                ret = sixaxis_set_operational_bt(hdev);
-       else if (sc->quirks & BUZZ_CONTROLLER)
-               ret = buzz_init(hdev);
        else
                ret = 0;
 
        if (ret < 0)
                goto err_stop;
 
+       if (sc->quirks & SONY_LED_SUPPORT) {
+               ret = sony_leds_init(hdev);
+               if (ret < 0)
+                       goto err_stop;
+       }
+
        ret = sony_init_ff(hdev);
        if (ret < 0)
                goto err_stop;
 
        return 0;
 err_stop:
+       if (sc->quirks & SONY_LED_SUPPORT)
+               sony_leds_remove(hdev);
        hid_hw_stop(hdev);
        return ret;
 }
@@ -754,8 +754,8 @@ static void sony_remove(struct hid_device *hdev)
 {
        struct sony_sc *sc = hid_get_drvdata(hdev);
 
-       if (sc->quirks & BUZZ_CONTROLLER)
-               buzz_remove(hdev);
+       if (sc->quirks & SONY_LED_SUPPORT)
+               sony_leds_remove(hdev);
 
        sony_destroy_ff(hdev);
 
index 5f7e55f4b7f052e29f754f78cabe8dd6a4593fb4..e914f27554913ab08c903be673a5c641731058b6 100644 (file)
@@ -1061,6 +1061,7 @@ static int i2c_hid_suspend(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
 
+       disable_irq(client->irq);
        if (device_may_wakeup(&client->dev))
                enable_irq_wake(client->irq);
 
@@ -1075,6 +1076,7 @@ static int i2c_hid_resume(struct device *dev)
        int ret;
        struct i2c_client *client = to_i2c_client(dev);
 
+       enable_irq(client->irq);
        ret = i2c_hid_hwreset(client);
        if (ret)
                return ret;
index 0db9a67278ba21d3d574b3f209311d5f54fecbac..b3c7684e87062b162d30bd4f021a42904102c821 100644 (file)
@@ -84,8 +84,9 @@ static const struct hid_blacklist {
        { USB_VENDOR_ID_REALTEK, USB_DEVICE_ID_REALTEK_READER, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET },
-       { USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH, HID_QUIRK_NOGET },
-       { USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS817_TOUCH, HID_QUIRK_NOGET },
+       { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH, HID_QUIRK_NOGET },
+       { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS817_TOUCH, HID_QUIRK_NOGET },
+       { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS_TS, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET },
@@ -114,7 +115,8 @@ static const struct hid_blacklist {
        { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS1, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2, HID_QUIRK_NO_INIT_REPORTS },
-       { USB_VENDOR_ID_SIS, USB_DEVICE_ID_SIS_TS, HID_QUIRK_NO_INIT_REPORTS },
+       { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_HD, HID_QUIRK_NO_INIT_REPORTS },
+       { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD, HID_QUIRK_NO_INIT_REPORTS },
 
        { 0, 0 }
 };
index 796086980f4a622dfe2857eec1d00ff33cdff787..9a332e683db77d170f2f1b281e813db02896df4a 100644 (file)
@@ -146,7 +146,7 @@ static void usb_kbd_irq(struct urb *urb)
                                input_report_key(kbd->dev, usb_kbd_keycode[kbd->new[i]], 1);
                        else
                                hid_info(urb->dev,
-                                        "Unknown key (scancode %#x) released.\n",
+                                        "Unknown key (scancode %#x) pressed.\n",
                                         kbd->new[i]);
                }
        }
index 48aad4faea068e88cbe61976aa3444d9c8a80a58..077bb1bdac34ef4ed87c65c7bf0d204fd42001b4 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/sysctl.h>
 #include <linux/slab.h>
 #include <linux/acpi.h>
-#include <acpi/acpi_bus.h>
 #include <linux/completion.h>
 #include <linux/hyperv.h>
 #include <linux/kernel_stat.h>
@@ -39,7 +38,6 @@
 #include <asm/mshyperv.h>
 #include "hyperv_vmbus.h"
 
-
 static struct acpi_device  *hv_acpi_dev;
 
 static struct tasklet_struct msg_dpc;
index 52d548f1dc1ddbccceedab0c7f2bf9e1d53766f2..f6ca3b21aebd989bcdadeb749e4250134dfbe16e 100644 (file)
@@ -573,8 +573,8 @@ config SENSORS_IT87
        help
          If you say yes here you get support for ITE IT8705F, IT8712F,
          IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E,
-         IT8771E, IT8772E, IT8782F, and IT8783E/F sensor chips, and the
-         SiS950 clone.
+         IT8771E, IT8772E, IT8782F, IT8783E/F and IT8603E sensor chips,
+         and the SiS950 clone.
 
          This driver can also be built as a module.  If so, the module
          will be called it87.
index 6a34f7f48eb9172272a25d4467bf1a190f7dc1e3..579bdf93be433b54a23fa8827badd7ace8dbb762 100644 (file)
@@ -30,8 +30,7 @@
 #include <linux/sched.h>
 #include <linux/time.h>
 #include <linux/err.h>
-#include <acpi/acpi_drivers.h>
-#include <acpi/acpi_bus.h>
+#include <linux/acpi.h>
 
 #define ACPI_POWER_METER_NAME          "power_meter"
 ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
index dafc63c6932dfa47001a0269fc283984c16c321e..ae208f61219804cbac02bc850582c1ad7cfc5f84 100644 (file)
 #include <linux/dmi.h>
 #include <linux/jiffies.h>
 #include <linux/err.h>
-
-#include <acpi/acpi.h>
-#include <acpi/acpi_drivers.h>
-#include <acpi/acpi_bus.h>
-
+#include <linux/acpi.h>
 
 #define ATK_HID "ATK0110"
 
index dff841085bafc9bb170c81309c3f75c8a0d92f4b..6040121a405a2c124cf1e9ef5fbbd357f60f6075 100644 (file)
@@ -249,7 +249,7 @@ static void fam15h_power_remove(struct pci_dev *pdev)
        sysfs_remove_group(&dev->kobj, &fam15h_power_attr_group);
 }
 
-static DEFINE_PCI_DEVICE_TABLE(fam15h_power_id_table) = {
+static const struct pci_device_id fam15h_power_id_table[] = {
        { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
        { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) },
        {}
index 29ffa27c60b89b60bf84db948cf56a890772599e..d50dc3a763a53effdd01563f1b567b213d41b8c3 100644 (file)
@@ -10,7 +10,8 @@
  *  This driver supports only the Environment Controller in the IT8705F and
  *  similar parts.  The other devices are supported by different drivers.
  *
- *  Supports: IT8705F  Super I/O chip w/LPC interface
+ *  Supports: IT8603E  Super I/O chip w/LPC interface
+ *            IT8705F  Super I/O chip w/LPC interface
  *            IT8712F  Super I/O chip w/LPC interface
  *            IT8716F  Super I/O chip w/LPC interface
  *            IT8718F  Super I/O chip w/LPC interface
@@ -64,7 +65,7 @@
 #define DRVNAME "it87"
 
 enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8771,
-            it8772, it8782, it8783 };
+            it8772, it8782, it8783, it8603 };
 
 static unsigned short force_id;
 module_param(force_id, ushort, 0);
@@ -146,6 +147,7 @@ static inline void superio_exit(void)
 #define IT8772E_DEVID 0x8772
 #define IT8782F_DEVID 0x8782
 #define IT8783E_DEVID 0x8783
+#define IT8306E_DEVID 0x8603
 #define IT87_ACT_REG  0x30
 #define IT87_BASE_REG 0x60
 
@@ -315,6 +317,12 @@ static const struct it87_devices it87_devices[] = {
                  | FEAT_TEMP_OLD_PECI,
                .old_peci_mask = 0x4,
        },
+       [it8603] = {
+               .name = "it8603",
+               .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
+                 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI,
+               .peci_mask = 0x07,
+       },
 };
 
 #define has_16bit_fans(data)   ((data)->features & FEAT_16BIT_FANS)
@@ -361,7 +369,7 @@ struct it87_data {
        unsigned long last_updated;     /* In jiffies */
 
        u16 in_scaled;          /* Internal voltage sensors are scaled */
-       u8 in[9][3];            /* [nr][0]=in, [1]=min, [2]=max */
+       u8 in[10][3];           /* [nr][0]=in, [1]=min, [2]=max */
        u8 has_fan;             /* Bitfield, fans enabled */
        u16 fan[5][2];          /* Register values, [nr][0]=fan, [1]=min */
        u8 has_temp;            /* Bitfield, temp sensors enabled */
@@ -578,6 +586,7 @@ static SENSOR_DEVICE_ATTR_2(in7_max, S_IRUGO | S_IWUSR, show_in, set_in,
                            7, 2);
 
 static SENSOR_DEVICE_ATTR_2(in8_input, S_IRUGO, show_in, NULL, 8, 0);
+static SENSOR_DEVICE_ATTR_2(in9_input, S_IRUGO, show_in, NULL, 9, 0);
 
 /* 3 temperatures */
 static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
@@ -734,7 +743,7 @@ static int pwm_mode(const struct it87_data *data, int nr)
 {
        int ctrl = data->fan_main_ctrl & (1 << nr);
 
-       if (ctrl == 0)                                  /* Full speed */
+       if (ctrl == 0 && data->type != it8603)          /* Full speed */
                return 0;
        if (data->pwm_ctrl[nr] & 0x80)                  /* Automatic mode */
                return 2;
@@ -929,6 +938,10 @@ static ssize_t set_pwm_enable(struct device *dev,
                        return -EINVAL;
        }
 
+       /* IT8603E does not have on/off mode */
+       if (val == 0 && data->type == it8603)
+               return -EINVAL;
+
        mutex_lock(&data->update_lock);
 
        if (val == 0) {
@@ -948,10 +961,13 @@ static ssize_t set_pwm_enable(struct device *dev,
                else                                    /* Automatic mode */
                        data->pwm_ctrl[nr] = 0x80 | data->pwm_temp_map[nr];
                it87_write_value(data, IT87_REG_PWM(nr), data->pwm_ctrl[nr]);
-               /* set SmartGuardian mode */
-               data->fan_main_ctrl |= (1 << nr);
-               it87_write_value(data, IT87_REG_FAN_MAIN_CTRL,
-                                data->fan_main_ctrl);
+
+               if (data->type != it8603) {
+                       /* set SmartGuardian mode */
+                       data->fan_main_ctrl |= (1 << nr);
+                       it87_write_value(data, IT87_REG_FAN_MAIN_CTRL,
+                                        data->fan_main_ctrl);
+               }
        }
 
        mutex_unlock(&data->update_lock);
@@ -1415,6 +1431,8 @@ static ssize_t show_label(struct device *dev, struct device_attribute *attr,
 static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 0);
 static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1);
 static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 2);
+/* special AVCC3 IT8306E in9 */
+static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 0);
 
 static ssize_t show_name(struct device *dev, struct device_attribute
                         *devattr, char *buf)
@@ -1424,7 +1442,7 @@ static ssize_t show_name(struct device *dev, struct device_attribute
 }
 static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
 
-static struct attribute *it87_attributes_in[9][5] = {
+static struct attribute *it87_attributes_in[10][5] = {
 {
        &sensor_dev_attr_in0_input.dev_attr.attr,
        &sensor_dev_attr_in0_min.dev_attr.attr,
@@ -1476,9 +1494,12 @@ static struct attribute *it87_attributes_in[9][5] = {
 }, {
        &sensor_dev_attr_in8_input.dev_attr.attr,
        NULL
+}, {
+       &sensor_dev_attr_in9_input.dev_attr.attr,
+       NULL
 } };
 
-static const struct attribute_group it87_group_in[9] = {
+static const struct attribute_group it87_group_in[10] = {
        { .attrs = it87_attributes_in[0] },
        { .attrs = it87_attributes_in[1] },
        { .attrs = it87_attributes_in[2] },
@@ -1488,6 +1509,7 @@ static const struct attribute_group it87_group_in[9] = {
        { .attrs = it87_attributes_in[6] },
        { .attrs = it87_attributes_in[7] },
        { .attrs = it87_attributes_in[8] },
+       { .attrs = it87_attributes_in[9] },
 };
 
 static struct attribute *it87_attributes_temp[3][6] = {
@@ -1546,7 +1568,8 @@ static struct attribute *it87_attributes_in_beep[] = {
        &sensor_dev_attr_in5_beep.dev_attr.attr,
        &sensor_dev_attr_in6_beep.dev_attr.attr,
        &sensor_dev_attr_in7_beep.dev_attr.attr,
-       NULL
+       NULL,
+       NULL,
 };
 
 static struct attribute *it87_attributes_temp_beep[] = {
@@ -1685,6 +1708,7 @@ static struct attribute *it87_attributes_label[] = {
        &sensor_dev_attr_in3_label.dev_attr.attr,
        &sensor_dev_attr_in7_label.dev_attr.attr,
        &sensor_dev_attr_in8_label.dev_attr.attr,
+       &sensor_dev_attr_in9_label.dev_attr.attr,
        NULL
 };
 
@@ -1742,6 +1766,9 @@ static int __init it87_find(unsigned short *address,
        case IT8783E_DEVID:
                sio_data->type = it8783;
                break;
+       case IT8306E_DEVID:
+               sio_data->type = it8603;
+               break;
        case 0xffff:    /* No device at all */
                goto exit;
        default:
@@ -1763,11 +1790,16 @@ static int __init it87_find(unsigned short *address,
 
        err = 0;
        sio_data->revision = superio_inb(DEVREV) & 0x0f;
-       pr_info("Found IT%04xF chip at 0x%x, revision %d\n",
-               chip_type, *address, sio_data->revision);
+       pr_info("Found IT%04x%c chip at 0x%x, revision %d\n", chip_type,
+               chip_type == 0x8771 || chip_type == 0x8772 ||
+               chip_type == 0x8603 ? 'E' : 'F', *address,
+               sio_data->revision);
 
        /* in8 (Vbat) is always internal */
        sio_data->internal = (1 << 2);
+       /* Only the IT8603E has in9 */
+       if (sio_data->type != it8603)
+               sio_data->skip_in |= (1 << 9);
 
        /* Read GPIO config and VID value from LDN 7 (GPIO) */
        if (sio_data->type == it87) {
@@ -1844,7 +1876,38 @@ static int __init it87_find(unsigned short *address,
                        sio_data->internal |= (1 << 1);
 
                sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
+       } else if (sio_data->type == it8603) {
+               int reg27, reg29;
+
+               sio_data->skip_vid = 1; /* No VID */
+               superio_select(GPIO);
 
+               reg27 = superio_inb(IT87_SIO_GPIO3_REG);
+
+               /* Check if fan3 is there or not */
+               if (reg27 & (1 << 6))
+                       sio_data->skip_pwm |= (1 << 2);
+               if (reg27 & (1 << 7))
+                       sio_data->skip_fan |= (1 << 2);
+
+               /* Check if fan2 is there or not */
+               reg29 = superio_inb(IT87_SIO_GPIO5_REG);
+               if (reg29 & (1 << 1))
+                       sio_data->skip_pwm |= (1 << 1);
+               if (reg29 & (1 << 2))
+                       sio_data->skip_fan |= (1 << 1);
+
+               sio_data->skip_in |= (1 << 5); /* No VIN5 */
+               sio_data->skip_in |= (1 << 6); /* No VIN6 */
+
+               /* no fan4 */
+               sio_data->skip_pwm |= (1 << 3);
+               sio_data->skip_fan |= (1 << 3);
+
+               sio_data->internal |= (1 << 1); /* in7 is VSB */
+               sio_data->internal |= (1 << 3); /* in9 is AVCC */
+
+               sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
        } else {
                int reg;
                bool uart6;
@@ -1966,7 +2029,7 @@ static void it87_remove_files(struct device *dev)
        int i;
 
        sysfs_remove_group(&dev->kobj, &it87_group);
-       for (i = 0; i < 9; i++) {
+       for (i = 0; i < 10; i++) {
                if (sio_data->skip_in & (1 << i))
                        continue;
                sysfs_remove_group(&dev->kobj, &it87_group_in[i]);
@@ -2080,6 +2143,8 @@ static int it87_probe(struct platform_device *pdev)
                        data->in_scaled |= (1 << 7);    /* in7 is VSB */
                if (sio_data->internal & (1 << 2))
                        data->in_scaled |= (1 << 8);    /* in8 is Vbat */
+               if (sio_data->internal & (1 << 3))
+                       data->in_scaled |= (1 << 9);    /* in9 is AVCC */
        } else if (sio_data->type == it8782 || sio_data->type == it8783) {
                if (sio_data->internal & (1 << 0))
                        data->in_scaled |= (1 << 3);    /* in3 is VCC5V */
@@ -2102,7 +2167,7 @@ static int it87_probe(struct platform_device *pdev)
        if (err)
                return err;
 
-       for (i = 0; i < 9; i++) {
+       for (i = 0; i < 10; i++) {
                if (sio_data->skip_in & (1 << i))
                        continue;
                err = sysfs_create_group(&dev->kobj, &it87_group_in[i]);
@@ -2202,7 +2267,7 @@ static int it87_probe(struct platform_device *pdev)
        }
 
        /* Export labels for internal sensors */
-       for (i = 0; i < 3; i++) {
+       for (i = 0; i < 4; i++) {
                if (!(sio_data->internal & (1 << i)))
                        continue;
                err = sysfs_create_file(&dev->kobj,
@@ -2383,8 +2448,9 @@ static void it87_init_device(struct platform_device *pdev)
        }
        data->has_fan = (data->fan_main_ctrl >> 4) & 0x07;
 
-       /* Set tachometers to 16-bit mode if needed */
-       if (has_16bit_fans(data)) {
+       /* Set tachometers to 16-bit mode if needed, IT8603E (and IT8728F?)
+        * has it by default */
+       if (has_16bit_fans(data) && data->type != it8603) {
                tmp = it87_read_value(data, IT87_REG_FAN_16BIT);
                if (~tmp & 0x07 & data->has_fan) {
                        dev_dbg(&pdev->dev,
@@ -2464,6 +2530,8 @@ static struct it87_data *it87_update_device(struct device *dev)
                }
                /* in8 (battery) has no limit registers */
                data->in[8][0] = it87_read_value(data, IT87_REG_VIN(8));
+               if (data->type == it8603)
+                       data->in[9][0] = it87_read_value(data, 0x2f);
 
                for (i = 0; i < 5; i++) {
                        /* Skip disabled fans */
index d65f3fd895ddda22d23164f1a0c94c870b77e2ce..e375e9fabba9fa164ea5d4bc6c2c3ea2a7e12d35 100644 (file)
@@ -204,7 +204,7 @@ static void k10temp_remove(struct pci_dev *pdev)
                           &sensor_dev_attr_temp1_crit_hyst.dev_attr);
 }
 
-static DEFINE_PCI_DEVICE_TABLE(k10temp_id_table) = {
+static const struct pci_device_id k10temp_id_table[] = {
        { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) },
        { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) },
        { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) },
index 5b50e9e4f96bb2ebf7e6630c846d591afca36248..734d55d48cc88fcf1cb3ededba02cb6cb80961ae 100644 (file)
@@ -135,7 +135,7 @@ static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 1, 0);
 static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 1, 1);
 static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
 
-static DEFINE_PCI_DEVICE_TABLE(k8temp_ids) = {
+static const struct pci_device_id k8temp_ids[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) },
        { 0 },
 };
index 6cf6bff790033756a70d1d57ebe9f8f1096899f8..a2f3b4a365e4bbafa17385df4fdca298a7ece0e5 100644 (file)
@@ -94,6 +94,8 @@ static inline u8 FAN_TO_REG(long rpm, int div)
 {
        if (rpm <= 0)
                return 255;
+       if (rpm > 1350000)
+               return 1;
        return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254);
 }
 
index 4c4c1421bf28f66462d8d0bf5f2ee70947005ac0..8b8f3aa49726873b89267ebe45f4e145eab2c7bb 100644 (file)
@@ -1610,12 +1610,14 @@ static int lm90_probe(struct i2c_client *client,
                                                "lm90", client);
                if (err < 0) {
                        dev_err(dev, "cannot request IRQ %d\n", client->irq);
-                       goto exit_remove_files;
+                       goto exit_unregister;
                }
        }
 
        return 0;
 
+exit_unregister:
+       hwmon_device_unregister(data->hwmon_dev);
 exit_remove_files:
        lm90_remove_files(client, data);
 exit_restore:
index 1404e6319deb3cf918c1874f1be8b09b85902d65..e74bd7e620e8140a44a3917ef701ff22223b8a62 100644 (file)
@@ -141,6 +141,8 @@ static inline u8 FAN_TO_REG(long rpm, int div)
 {
        if (rpm <= 0)
                return 255;
+       if (rpm > 1350000)
+               return 1;
        return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254);
 }
 
@@ -752,7 +754,7 @@ static struct sis5595_data *sis5595_update_device(struct device *dev)
        return data;
 }
 
-static DEFINE_PCI_DEVICE_TABLE(sis5595_pci_ids) = {
+static const struct pci_device_id sis5595_pci_ids[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) },
        { 0, }
 };
index c9dcce8c3dc34fa7ec8e7eeb0c8ee6812dc159ce..babd732b4e184303d071149e98ae4651b71403e4 100644 (file)
@@ -824,7 +824,7 @@ static struct via686a_data *via686a_update_device(struct device *dev)
        return data;
 }
 
-static DEFINE_PCI_DEVICE_TABLE(via686a_pci_ids) = {
+static const struct pci_device_id via686a_pci_ids[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4) },
        { }
 };
index 0e7017841f7dacb9b1341e4313f4acaf009349a6..b3babe3326fb2d41b68ce3712f8dd00871c33508 100644 (file)
@@ -145,7 +145,7 @@ static const u8 regtempmin[] = { 0x3a, 0x3e, 0x2c, 0x2e, 0x30, 0x32 };
  */
 static inline u8 FAN_TO_REG(long rpm, int div)
 {
-       if (rpm == 0)
+       if (rpm <= 0 || rpm > 1310720)
                return 0;
        return clamp_val(1310720 / (rpm * div), 1, 255);
 }
@@ -766,7 +766,7 @@ static struct platform_driver vt8231_driver = {
        .remove = vt8231_remove,
 };
 
-static DEFINE_PCI_DEVICE_TABLE(vt8231_pci_ids) = {
+static const struct pci_device_id vt8231_pci_ids[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) },
        { 0, }
 };
index edb06cda5a689a4be87046b138051f5b4b42e3ca..0393ecf16600963118d8b65106cafb2dd717843e 100644 (file)
@@ -481,6 +481,7 @@ store_pwm(struct device *dev, struct device_attribute *attr,
        if (err)
                return err;
        val = clamp_val(val, 0, 255);
+       val = DIV_ROUND_CLOSEST(val, 0x11);
 
        mutex_lock(&data->update_lock);
        data->pwm[nr] = val;
@@ -510,7 +511,7 @@ store_pwm_enable(struct device *dev, struct device_attribute *attr,
        mutex_lock(&data->update_lock);
        reg = w83l786ng_read_value(client, W83L786NG_REG_FAN_CFG);
        data->pwm_enable[nr] = val;
-       reg &= ~(0x02 << W83L786NG_PWM_ENABLE_SHIFT[nr]);
+       reg &= ~(0x03 << W83L786NG_PWM_ENABLE_SHIFT[nr]);
        reg |= (val - 1) << W83L786NG_PWM_ENABLE_SHIFT[nr];
        w83l786ng_write_value(client, W83L786NG_REG_FAN_CFG, reg);
        mutex_unlock(&data->update_lock);
@@ -776,9 +777,10 @@ static struct w83l786ng_data *w83l786ng_update_device(struct device *dev)
                            ((pwmcfg >> W83L786NG_PWM_MODE_SHIFT[i]) & 1)
                            ? 0 : 1;
                        data->pwm_enable[i] =
-                           ((pwmcfg >> W83L786NG_PWM_ENABLE_SHIFT[i]) & 2) + 1;
-                       data->pwm[i] = w83l786ng_read_value(client,
-                           W83L786NG_REG_PWM[i]);
+                           ((pwmcfg >> W83L786NG_PWM_ENABLE_SHIFT[i]) & 3) + 1;
+                       data->pwm[i] =
+                           (w83l786ng_read_value(client, W83L786NG_REG_PWM[i])
+                            & 0x0f) * 0x11;
                }
 
 
index b1d38590ac0196f1da49d4d67e411b3741175b9f..46eaf58d881b4e31032327e7c248979d693d9c11 100644 (file)
@@ -198,7 +198,7 @@ fail_base2:
                                continue;
                        }
                }         
-               buddha_board = ZTWO_VADDR(board);
+               buddha_board = (unsigned long)ZTWO_VADDR(board);
                
                /* write to BUDDHA_IRQ_MR to enable the board IRQ */
                /* X-Surf doesn't have this.  IRQs are always on */
index d9e1f7ccfe6f086df549160a88ca191e52fca32f..b6940992a6ff95c699eddb8c7e2fb484a2f16ed3 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
-#include <acpi/acpi.h>
 #include <linux/ide.h>
 #include <linux/pci.h>
 #include <linux/dmi.h>
@@ -98,6 +97,17 @@ bool ide_port_acpi(ide_hwif_t *hwif)
        return ide_noacpi == 0 && hwif->acpidata;
 }
 
+static acpi_handle acpi_get_child(acpi_handle handle, u64 addr)
+{
+       struct acpi_device *adev;
+
+       if (!handle || acpi_bus_get_device(handle, &adev))
+               return NULL;
+
+       adev = acpi_find_child_device(adev, addr, false);
+       return adev ? adev->handle : NULL;
+}
+
 /**
  * ide_get_dev_handle - finds acpi_handle and PCI device.function
  * @dev: device to locate
index 1178121b55b032989257e3167c6724815458ec26..39188b72cd3b2865a763e5a0b3c4715ad3d93570 100644 (file)
@@ -25,13 +25,4 @@ config HID_SENSOR_IIO_TRIGGER
          If this driver is compiled as a module, it will be named
          hid-sensor-trigger.
 
-config HID_SENSOR_ENUM_BASE_QUIRKS
-       bool "ENUM base quirks for HID Sensor IIO drivers"
-       depends on HID_SENSOR_IIO_COMMON
-       help
-         Say yes here to build support for sensor hub FW using
-         enumeration, which is using 1 as base instead of 0.
-         Since logical minimum is still set 0 instead of 1,
-         there is no easy way to differentiate.
-
 endmenu
index bbd6426c9726d8f4e0bf36f1e138901c19ff99e8..7dcf83998e6f7fc58de8c5c3a894207abcd06bab 100644 (file)
@@ -33,24 +33,34 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
 {
        struct hid_sensor_common *st = iio_trigger_get_drvdata(trig);
        int state_val;
+       int report_val;
 
        if (state) {
                if (sensor_hub_device_open(st->hsdev))
                        return -EIO;
-       } else
+               state_val =
+               HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM;
+               report_val =
+               HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM;
+
+       } else {
                sensor_hub_device_close(st->hsdev);
+               state_val =
+               HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM;
+               report_val =
+               HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM;
+       }
 
-       state_val = state ? 1 : 0;
-       if (IS_ENABLED(CONFIG_HID_SENSOR_ENUM_BASE_QUIRKS))
-               ++state_val;
        st->data_ready = state;
+       state_val += st->power_state.logical_minimum;
+       report_val += st->report_state.logical_minimum;
        sensor_hub_set_feature(st->hsdev, st->power_state.report_id,
                                        st->power_state.index,
                                        (s32)state_val);
 
        sensor_hub_set_feature(st->hsdev, st->report_state.report_id,
                                        st->report_state.index,
-                                       (s32)state_val);
+                                       (s32)report_val);
 
        return 0;
 }
index b0d65df3ede2050d4c9944e819b45917ef945c87..a022f27c6690d56ba9c70caaa3953919b15c492e 100644 (file)
@@ -43,6 +43,7 @@ config GP2AP020A00F
        depends on I2C
        select IIO_BUFFER
        select IIO_TRIGGERED_BUFFER
+       select IRQ_WORK
        help
          Say Y here if you have a Sharp GP2AP020A00F proximity/ALS combo-chip
          hooked to an I2C bus.
index dbd2047f1641f0751340eade88c408f31201f318..3ed23513d881301fa06c1bde1ed14f56546d0147 100644 (file)
@@ -536,7 +536,8 @@ static int adp5588_probe(struct i2c_client *client,
                __set_bit(EV_REP, input->evbit);
 
        for (i = 0; i < input->keycodemax; i++)
-               __set_bit(kpad->keycode[i] & KEY_MAX, input->keybit);
+               if (kpad->keycode[i] <= KEY_MAX)
+                       __set_bit(kpad->keycode[i], input->keybit);
        __clear_bit(KEY_RESERVED, input->keybit);
 
        if (kpad->gpimapsize)
index 67d12b3427c9ee9bcb5da69d276a6bc814467586..60dafd4fa692e1d41457c471d5a79ef0bcdf21f0 100644 (file)
@@ -992,7 +992,8 @@ static int adp5589_probe(struct i2c_client *client,
                __set_bit(EV_REP, input->evbit);
 
        for (i = 0; i < input->keycodemax; i++)
-               __set_bit(kpad->keycode[i] & KEY_MAX, input->keybit);
+               if (kpad->keycode[i] <= KEY_MAX)
+                       __set_bit(kpad->keycode[i], input->keybit);
        __clear_bit(KEY_RESERVED, input->keybit);
 
        if (kpad->gpimapsize)
index fc88fb48d70d6740ef96f8fdbe9afc32760218c5..09b91d09308780ceebc25d9f860f88eb56b68183 100644 (file)
@@ -289,7 +289,8 @@ static int bfin_kpad_probe(struct platform_device *pdev)
                __set_bit(EV_REP, input->evbit);
 
        for (i = 0; i < input->keycodemax; i++)
-               __set_bit(bf54x_kpad->keycode[i] & KEY_MAX, input->keybit);
+               if (bf54x_kpad->keycode[i] <= KEY_MAX)
+                       __set_bit(bf54x_kpad->keycode[i], input->keybit);
        __clear_bit(KEY_RESERVED, input->keybit);
 
        error = input_register_device(input);
index 5d4402365a5207258dbd9b4b7d68f18489fa1598..d781b5e520655f074071fb6fc6f9a6e9390086bd 100644 (file)
@@ -28,8 +28,8 @@
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/types.h>
+#include <linux/acpi.h>
 #include <asm/uaccess.h>
-#include <acpi/acpi_drivers.h>
 
 #define ACPI_ATLAS_NAME                "Atlas ACPI"
 #define ACPI_ATLAS_CLASS       "Atlas"
index e37392976fdd5f3f252ca5f2af2a2477fc8265b7..0deca5a3c87fe1adacdce8259a052738486749cb 100644 (file)
@@ -113,9 +113,12 @@ static int pcf8574_kp_probe(struct i2c_client *client, const struct i2c_device_i
        idev->keycodemax = ARRAY_SIZE(lp->btncode);
 
        for (i = 0; i < ARRAY_SIZE(pcf8574_kp_btncode); i++) {
-               lp->btncode[i] = pcf8574_kp_btncode[i];
-               __set_bit(lp->btncode[i] & KEY_MAX, idev->keybit);
+               if (lp->btncode[i] <= KEY_MAX) {
+                       lp->btncode[i] = pcf8574_kp_btncode[i];
+                       __set_bit(lp->btncode[i], idev->keybit);
+               }
        }
+       __clear_bit(KEY_RESERVED, idev->keybit);
 
        sprintf(lp->name, DRV_NAME);
        sprintf(lp->phys, "kp_data/input0");
index ca7a26f1dce81c37c6cd8524f8c4698effbfd739..5cf62e315218386817972a74aafcca22dc572113 100644 (file)
@@ -70,6 +70,25 @@ static const struct alps_nibble_commands alps_v4_nibble_commands[] = {
        { PSMOUSE_CMD_SETSCALE11,       0x00 }, /* f */
 };
 
+static const struct alps_nibble_commands alps_v6_nibble_commands[] = {
+       { PSMOUSE_CMD_ENABLE,           0x00 }, /* 0 */
+       { PSMOUSE_CMD_SETRATE,          0x0a }, /* 1 */
+       { PSMOUSE_CMD_SETRATE,          0x14 }, /* 2 */
+       { PSMOUSE_CMD_SETRATE,          0x28 }, /* 3 */
+       { PSMOUSE_CMD_SETRATE,          0x3c }, /* 4 */
+       { PSMOUSE_CMD_SETRATE,          0x50 }, /* 5 */
+       { PSMOUSE_CMD_SETRATE,          0x64 }, /* 6 */
+       { PSMOUSE_CMD_SETRATE,          0xc8 }, /* 7 */
+       { PSMOUSE_CMD_GETID,            0x00 }, /* 8 */
+       { PSMOUSE_CMD_GETINFO,          0x00 }, /* 9 */
+       { PSMOUSE_CMD_SETRES,           0x00 }, /* a */
+       { PSMOUSE_CMD_SETRES,           0x01 }, /* b */
+       { PSMOUSE_CMD_SETRES,           0x02 }, /* c */
+       { PSMOUSE_CMD_SETRES,           0x03 }, /* d */
+       { PSMOUSE_CMD_SETSCALE21,       0x00 }, /* e */
+       { PSMOUSE_CMD_SETSCALE11,       0x00 }, /* f */
+};
+
 
 #define ALPS_DUALPOINT         0x02    /* touchpad has trackstick */
 #define ALPS_PASS              0x04    /* device has a pass-through port */
@@ -103,6 +122,7 @@ static const struct alps_model_info alps_model_data[] = {
        /* Dell Latitude E5500, E6400, E6500, Precision M4400 */
        { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf,
                ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
+       { { 0x73, 0x00, 0x14 }, 0x00, ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT },              /* Dell XT2 */
        { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS },           /* Dell Vostro 1400 */
        { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff,
                ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },                            /* Toshiba Tecra A11-11L */
@@ -645,6 +665,76 @@ static void alps_process_packet_v3(struct psmouse *psmouse)
        alps_process_touchpad_packet_v3(psmouse);
 }
 
+static void alps_process_packet_v6(struct psmouse *psmouse)
+{
+       struct alps_data *priv = psmouse->private;
+       unsigned char *packet = psmouse->packet;
+       struct input_dev *dev = psmouse->dev;
+       struct input_dev *dev2 = priv->dev2;
+       int x, y, z, left, right, middle;
+
+       /*
+        * We can use Byte5 to distinguish if the packet is from Touchpad
+        * or Trackpoint.
+        * Touchpad:    0 - 0x7E
+        * Trackpoint:  0x7F
+        */
+       if (packet[5] == 0x7F) {
+               /* It should be a DualPoint when received Trackpoint packet */
+               if (!(priv->flags & ALPS_DUALPOINT))
+                       return;
+
+               /* Trackpoint packet */
+               x = packet[1] | ((packet[3] & 0x20) << 2);
+               y = packet[2] | ((packet[3] & 0x40) << 1);
+               z = packet[4];
+               left = packet[3] & 0x01;
+               right = packet[3] & 0x02;
+               middle = packet[3] & 0x04;
+
+               /* To prevent the cursor jump when finger lifted */
+               if (x == 0x7F && y == 0x7F && z == 0x7F)
+                       x = y = z = 0;
+
+               /* Divide 4 since trackpoint's speed is too fast */
+               input_report_rel(dev2, REL_X, (char)x / 4);
+               input_report_rel(dev2, REL_Y, -((char)y / 4));
+
+               input_report_key(dev2, BTN_LEFT, left);
+               input_report_key(dev2, BTN_RIGHT, right);
+               input_report_key(dev2, BTN_MIDDLE, middle);
+
+               input_sync(dev2);
+               return;
+       }
+
+       /* Touchpad packet */
+       x = packet[1] | ((packet[3] & 0x78) << 4);
+       y = packet[2] | ((packet[4] & 0x78) << 4);
+       z = packet[5];
+       left = packet[3] & 0x01;
+       right = packet[3] & 0x02;
+
+       if (z > 30)
+               input_report_key(dev, BTN_TOUCH, 1);
+       if (z < 25)
+               input_report_key(dev, BTN_TOUCH, 0);
+
+       if (z > 0) {
+               input_report_abs(dev, ABS_X, x);
+               input_report_abs(dev, ABS_Y, y);
+       }
+
+       input_report_abs(dev, ABS_PRESSURE, z);
+       input_report_key(dev, BTN_TOOL_FINGER, z > 0);
+
+       /* v6 touchpad does not have middle button */
+       input_report_key(dev, BTN_LEFT, left);
+       input_report_key(dev, BTN_RIGHT, right);
+
+       input_sync(dev);
+}
+
 static void alps_process_packet_v4(struct psmouse *psmouse)
 {
        struct alps_data *priv = psmouse->private;
@@ -897,7 +987,7 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
        }
 
        /* Bytes 2 - pktsize should have 0 in the highest bit */
-       if (priv->proto_version != ALPS_PROTO_V5 &&
+       if ((priv->proto_version < ALPS_PROTO_V5) &&
            psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize &&
            (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) {
                psmouse_dbg(psmouse, "refusing packet[%i] = %x\n",
@@ -1085,6 +1175,80 @@ static int alps_absolute_mode_v1_v2(struct psmouse *psmouse)
        return ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETPOLL);
 }
 
+static int alps_monitor_mode_send_word(struct psmouse *psmouse, u16 word)
+{
+       int i, nibble;
+
+       /*
+        * b0-b11 are valid bits, send sequence is inverse.
+        * e.g. when word = 0x0123, nibble send sequence is 3, 2, 1
+        */
+       for (i = 0; i <= 8; i += 4) {
+               nibble = (word >> i) & 0xf;
+               if (alps_command_mode_send_nibble(psmouse, nibble))
+                       return -1;
+       }
+
+       return 0;
+}
+
+static int alps_monitor_mode_write_reg(struct psmouse *psmouse,
+                                      u16 addr, u16 value)
+{
+       struct ps2dev *ps2dev = &psmouse->ps2dev;
+
+       /* 0x0A0 is the command to write the word */
+       if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE) ||
+           alps_monitor_mode_send_word(psmouse, 0x0A0) ||
+           alps_monitor_mode_send_word(psmouse, addr) ||
+           alps_monitor_mode_send_word(psmouse, value) ||
+           ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE))
+               return -1;
+
+       return 0;
+}
+
+static int alps_monitor_mode(struct psmouse *psmouse, bool enable)
+{
+       struct ps2dev *ps2dev = &psmouse->ps2dev;
+
+       if (enable) {
+               /* EC E9 F5 F5 E7 E6 E7 E9 to enter monitor mode */
+               if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP) ||
+                   ps2_command(ps2dev, NULL, PSMOUSE_CMD_GETINFO) ||
+                   ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) ||
+                   ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) ||
+                   ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) ||
+                   ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
+                   ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) ||
+                   ps2_command(ps2dev, NULL, PSMOUSE_CMD_GETINFO))
+                       return -1;
+       } else {
+               /* EC to exit monitor mode */
+               if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP))
+                       return -1;
+       }
+
+       return 0;
+}
+
+static int alps_absolute_mode_v6(struct psmouse *psmouse)
+{
+       u16 reg_val = 0x181;
+       int ret = -1;
+
+       /* enter monitor mode, to write the register */
+       if (alps_monitor_mode(psmouse, true))
+               return -1;
+
+       ret = alps_monitor_mode_write_reg(psmouse, 0x000, reg_val);
+
+       if (alps_monitor_mode(psmouse, false))
+               ret = -1;
+
+       return ret;
+}
+
 static int alps_get_status(struct psmouse *psmouse, char *param)
 {
        /* Get status: 0xF5 0xF5 0xF5 0xE9 */
@@ -1189,6 +1353,32 @@ static int alps_hw_init_v1_v2(struct psmouse *psmouse)
        return 0;
 }
 
+static int alps_hw_init_v6(struct psmouse *psmouse)
+{
+       unsigned char param[2] = {0xC8, 0x14};
+
+       /* Enter passthrough mode to let trackpoint enter 6byte raw mode */
+       if (alps_passthrough_mode_v2(psmouse, true))
+               return -1;
+
+       if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
+           ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
+           ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
+           ps2_command(&psmouse->ps2dev, &param[0], PSMOUSE_CMD_SETRATE) ||
+           ps2_command(&psmouse->ps2dev, &param[1], PSMOUSE_CMD_SETRATE))
+               return -1;
+
+       if (alps_passthrough_mode_v2(psmouse, false))
+               return -1;
+
+       if (alps_absolute_mode_v6(psmouse)) {
+               psmouse_err(psmouse, "Failed to enable absolute mode\n");
+               return -1;
+       }
+
+       return 0;
+}
+
 /*
  * Enable or disable passthrough mode to the trackstick.
  */
@@ -1553,6 +1743,8 @@ static void alps_set_defaults(struct alps_data *priv)
                priv->hw_init = alps_hw_init_v1_v2;
                priv->process_packet = alps_process_packet_v1_v2;
                priv->set_abs_params = alps_set_abs_params_st;
+               priv->x_max = 1023;
+               priv->y_max = 767;
                break;
        case ALPS_PROTO_V3:
                priv->hw_init = alps_hw_init_v3;
@@ -1584,6 +1776,14 @@ static void alps_set_defaults(struct alps_data *priv)
                priv->x_bits = 23;
                priv->y_bits = 12;
                break;
+       case ALPS_PROTO_V6:
+               priv->hw_init = alps_hw_init_v6;
+               priv->process_packet = alps_process_packet_v6;
+               priv->set_abs_params = alps_set_abs_params_st;
+               priv->nibble_commands = alps_v6_nibble_commands;
+               priv->x_max = 2047;
+               priv->y_max = 1535;
+               break;
        }
 }
 
@@ -1705,8 +1905,8 @@ static void alps_disconnect(struct psmouse *psmouse)
 static void alps_set_abs_params_st(struct alps_data *priv,
                                   struct input_dev *dev1)
 {
-       input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0);
-       input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0);
+       input_set_abs_params(dev1, ABS_X, 0, priv->x_max, 0, 0);
+       input_set_abs_params(dev1, ABS_Y, 0, priv->y_max, 0, 0);
 }
 
 static void alps_set_abs_params_mt(struct alps_data *priv,
index eee59853b9ce0c21bc755c206430911e15789964..704f0f9243076190213b1c1876ef833348e61c99 100644 (file)
@@ -17,6 +17,7 @@
 #define ALPS_PROTO_V3  3
 #define ALPS_PROTO_V4  4
 #define ALPS_PROTO_V5  5
+#define ALPS_PROTO_V6  6
 
 /**
  * struct alps_model_info - touchpad ID table
index 8551dcaf24dbadc854a7f6a6664128598c99a067..597e9b8fc18db99c5bf1f33b3a274c632b2ba24b 100644 (file)
@@ -1313,6 +1313,7 @@ static int elantech_set_properties(struct elantech_data *etd)
                        break;
                case 6:
                case 7:
+               case 8:
                        etd->hw_version = 4;
                        break;
                default:
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 cfd1b7e8c0014306f09d021756e158ffc67ec728..f1cb05148b46826c7075e238f24e530a6a32720c 100644 (file)
@@ -251,7 +251,7 @@ static void sur40_poll(struct input_polled_dev *polldev)
        struct sur40_state *sur40 = polldev->private;
        struct input_dev *input = polldev->input;
        int result, bulk_read, need_blobs, packet_blobs, i;
-       u32 packet_id;
+       u32 uninitialized_var(packet_id);
 
        struct sur40_header *header = &sur40->bulk_in_buffer->header;
        struct sur40_blob *inblob = &sur40->bulk_in_buffer->blobs[0];
@@ -286,7 +286,7 @@ static void sur40_poll(struct input_polled_dev *polldev)
                if (need_blobs == -1) {
                        need_blobs = le16_to_cpu(header->count);
                        dev_dbg(sur40->dev, "need %d blobs\n", need_blobs);
-                       packet_id = header->packet_id;
+                       packet_id = le32_to_cpu(header->packet_id);
                }
 
                /*
index ae4b6b9036292c23387fafb1124247fc377c3f72..5f87bed054674b487e724d3588806235b5b5f738 100644 (file)
@@ -106,6 +106,7 @@ struct usbtouch_device_info {
 struct usbtouch_usb {
        unsigned char *data;
        dma_addr_t data_dma;
+       int data_size;
        unsigned char *buffer;
        int buf_len;
        struct urb *irq;
@@ -1521,7 +1522,7 @@ static int usbtouch_reset_resume(struct usb_interface *intf)
 static void usbtouch_free_buffers(struct usb_device *udev,
                                  struct usbtouch_usb *usbtouch)
 {
-       usb_free_coherent(udev, usbtouch->type->rept_size,
+       usb_free_coherent(udev, usbtouch->data_size,
                          usbtouch->data, usbtouch->data_dma);
        kfree(usbtouch->buffer);
 }
@@ -1566,7 +1567,20 @@ static int usbtouch_probe(struct usb_interface *intf,
        if (!type->process_pkt)
                type->process_pkt = usbtouch_process_pkt;
 
-       usbtouch->data = usb_alloc_coherent(udev, type->rept_size,
+       usbtouch->data_size = type->rept_size;
+       if (type->get_pkt_len) {
+               /*
+                * When dealing with variable-length packets we should
+                * not request more than wMaxPacketSize bytes at once
+                * as we do not know if there is more data coming or
+                * we filled exactly wMaxPacketSize bytes and there is
+                * nothing else.
+                */
+               usbtouch->data_size = min(usbtouch->data_size,
+                                         usb_endpoint_maxp(endpoint));
+       }
+
+       usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size,
                                            GFP_KERNEL, &usbtouch->data_dma);
        if (!usbtouch->data)
                goto out_free;
@@ -1626,12 +1640,12 @@ static int usbtouch_probe(struct usb_interface *intf,
        if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT)
                usb_fill_int_urb(usbtouch->irq, udev,
                         usb_rcvintpipe(udev, endpoint->bEndpointAddress),
-                        usbtouch->data, type->rept_size,
+                        usbtouch->data, usbtouch->data_size,
                         usbtouch_irq, usbtouch, endpoint->bInterval);
        else
                usb_fill_bulk_urb(usbtouch->irq, udev,
                         usb_rcvbulkpipe(udev, endpoint->bEndpointAddress),
-                        usbtouch->data, type->rept_size,
+                        usbtouch->data, usbtouch->data_size,
                         usbtouch_irq, usbtouch);
 
        usbtouch->irq->dev = udev;
index 8f798be6e398d98ccacc5ba85f3f5b76c4096683..28b4bea7c1094d79a483ee5256c21a91d3829396 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/msi.h>
 #include <linux/amd-iommu.h>
 #include <linux/export.h>
-#include <acpi/acpi.h>
 #include <asm/pci-direct.h>
 #include <asm/iommu.h>
 #include <asm/gart.h>
index 1abfb5684ab7ebcb7c735e10c71625439490ca09..e46a88700b6824c735967118281c9f7feb6e41b0 100644 (file)
@@ -392,7 +392,7 @@ struct arm_smmu_domain {
        struct arm_smmu_cfg             root_cfg;
        phys_addr_t                     output_mask;
 
-       spinlock_t                      lock;
+       struct mutex                    lock;
 };
 
 static DEFINE_SPINLOCK(arm_smmu_devices_lock);
@@ -900,7 +900,7 @@ static int arm_smmu_domain_init(struct iommu_domain *domain)
                goto out_free_domain;
        smmu_domain->root_cfg.pgd = pgd;
 
-       spin_lock_init(&smmu_domain->lock);
+       mutex_init(&smmu_domain->lock);
        domain->priv = smmu_domain;
        return 0;
 
@@ -1137,7 +1137,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
         * Sanity check the domain. We don't currently support domains
         * that cross between different SMMU chains.
         */
-       spin_lock(&smmu_domain->lock);
+       mutex_lock(&smmu_domain->lock);
        if (!smmu_domain->leaf_smmu) {
                /* Now that we have a master, we can finalise the domain */
                ret = arm_smmu_init_domain_context(domain, dev);
@@ -1152,7 +1152,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
                        dev_name(device_smmu->dev));
                goto err_unlock;
        }
-       spin_unlock(&smmu_domain->lock);
+       mutex_unlock(&smmu_domain->lock);
 
        /* Looks ok, so add the device to the domain */
        master = find_smmu_master(smmu_domain->leaf_smmu, dev->of_node);
@@ -1162,7 +1162,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
        return arm_smmu_domain_add_master(smmu_domain, master);
 
 err_unlock:
-       spin_unlock(&smmu_domain->lock);
+       mutex_unlock(&smmu_domain->lock);
        return ret;
 }
 
@@ -1394,7 +1394,7 @@ static int arm_smmu_handle_mapping(struct arm_smmu_domain *smmu_domain,
        if (paddr & ~output_mask)
                return -ERANGE;
 
-       spin_lock(&smmu_domain->lock);
+       mutex_lock(&smmu_domain->lock);
        pgd += pgd_index(iova);
        end = iova + size;
        do {
@@ -1410,7 +1410,7 @@ static int arm_smmu_handle_mapping(struct arm_smmu_domain *smmu_domain,
        } while (pgd++, iova != end);
 
 out_unlock:
-       spin_unlock(&smmu_domain->lock);
+       mutex_unlock(&smmu_domain->lock);
 
        /* Ensure new page tables are visible to the hardware walker */
        if (smmu->features & ARM_SMMU_FEAT_COHERENT_WALK)
@@ -1423,9 +1423,8 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova,
                        phys_addr_t paddr, size_t size, int flags)
 {
        struct arm_smmu_domain *smmu_domain = domain->priv;
-       struct arm_smmu_device *smmu = smmu_domain->leaf_smmu;
 
-       if (!smmu_domain || !smmu)
+       if (!smmu_domain)
                return -ENODEV;
 
        /* Check for silent address truncation up the SMMU chain. */
@@ -1449,44 +1448,34 @@ static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova,
 static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain,
                                         dma_addr_t iova)
 {
-       pgd_t *pgd;
-       pud_t *pud;
-       pmd_t *pmd;
-       pte_t *pte;
+       pgd_t *pgdp, pgd;
+       pud_t pud;
+       pmd_t pmd;
+       pte_t pte;
        struct arm_smmu_domain *smmu_domain = domain->priv;
        struct arm_smmu_cfg *root_cfg = &smmu_domain->root_cfg;
-       struct arm_smmu_device *smmu = root_cfg->smmu;
 
-       spin_lock(&smmu_domain->lock);
-       pgd = root_cfg->pgd;
-       if (!pgd)
-               goto err_unlock;
+       pgdp = root_cfg->pgd;
+       if (!pgdp)
+               return 0;
 
-       pgd += pgd_index(iova);
-       if (pgd_none_or_clear_bad(pgd))
-               goto err_unlock;
+       pgd = *(pgdp + pgd_index(iova));
+       if (pgd_none(pgd))
+               return 0;
 
-       pud = pud_offset(pgd, iova);
-       if (pud_none_or_clear_bad(pud))
-               goto err_unlock;
+       pud = *pud_offset(&pgd, iova);
+       if (pud_none(pud))
+               return 0;
 
-       pmd = pmd_offset(pud, iova);
-       if (pmd_none_or_clear_bad(pmd))
-               goto err_unlock;
+       pmd = *pmd_offset(&pud, iova);
+       if (pmd_none(pmd))
+               return 0;
 
-       pte = pmd_page_vaddr(*pmd) + pte_index(iova);
+       pte = *(pmd_page_vaddr(pmd) + pte_index(iova));
        if (pte_none(pte))
-               goto err_unlock;
-
-       spin_unlock(&smmu_domain->lock);
-       return __pfn_to_phys(pte_pfn(*pte)) | (iova & ~PAGE_MASK);
+               return 0;
 
-err_unlock:
-       spin_unlock(&smmu_domain->lock);
-       dev_warn(smmu->dev,
-                "invalid (corrupt?) page tables detected for iova 0x%llx\n",
-                (unsigned long long)iova);
-       return -EINVAL;
+       return __pfn_to_phys(pte_pfn(pte)) | (iova & ~PAGE_MASK);
 }
 
 static int arm_smmu_domain_has_cap(struct iommu_domain *domain,
@@ -1863,6 +1852,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
                dev_err(dev,
                        "found only %d context interrupt(s) but %d required\n",
                        smmu->num_context_irqs, smmu->num_context_banks);
+               err = -ENODEV;
                goto out_put_parent;
        }
 
index bab10b1002fbf04bae1fe8e2b36cbb6f280dea51..0cb7528b30a134416b4343b08a458f80dcb6aecf 100644 (file)
@@ -6,11 +6,11 @@
 #include <linux/hpet.h>
 #include <linux/pci.h>
 #include <linux/irq.h>
+#include <linux/intel-iommu.h>
+#include <linux/acpi.h>
 #include <asm/io_apic.h>
 #include <asm/smp.h>
 #include <asm/cpu.h>
-#include <linux/intel-iommu.h>
-#include <acpi/acpi.h>
 #include <asm/irq_remapping.h>
 #include <asm/pci-direct.h>
 #include <asm/msidef.h>
index 3792a1aa52b88d3439cdc66195230cc1b20f0f2a..07bc79c340125be220f7b667b9cb8e16db36d4ab 100644 (file)
@@ -61,3 +61,7 @@ config VERSATILE_FPGA_IRQ_NR
        int
        default 4
        depends on VERSATILE_FPGA_IRQ
+
+config XTENSA_MX
+       bool
+       select IRQ_DOMAIN
index c60b9010b152cf4980336eac485daa8bceec9412..679e2d102a296e84a60acdc9d24a3cbcffe7d5d5 100644 (file)
@@ -1,6 +1,7 @@
 obj-$(CONFIG_IRQCHIP)                  += irqchip.o
 
 obj-$(CONFIG_ARCH_BCM2835)             += irq-bcm2835.o
+obj-$(CONFIG_ARCH_DOVE)                        += irq-dove.o
 obj-$(CONFIG_ARCH_EXYNOS)              += exynos-combiner.o
 obj-$(CONFIG_ARCH_MMP)                 += irq-mmp.o
 obj-$(CONFIG_ARCH_MVEBU)               += irq-armada-370-xp.o
@@ -22,3 +23,5 @@ obj-$(CONFIG_RENESAS_IRQC)            += irq-renesas-irqc.o
 obj-$(CONFIG_VERSATILE_FPGA_IRQ)       += irq-versatile-fpga.o
 obj-$(CONFIG_ARCH_VT8500)              += irq-vt8500.o
 obj-$(CONFIG_TB10X_IRQC)               += irq-tb10x.o
+obj-$(CONFIG_XTENSA)                   += irq-xtensa-pic.o
+obj-$(CONFIG_XTENSA_MX)                        += irq-xtensa-mx.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-dove.c b/drivers/irqchip/irq-dove.c
new file mode 100644 (file)
index 0000000..788acd8
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Marvell Dove SoCs PMU IRQ chip driver.
+ *
+ * Andrew Lunn <andrew@lunn.ch>
+ *
+ * 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/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <asm/exception.h>
+#include <asm/mach/irq.h>
+
+#include "irqchip.h"
+
+#define DOVE_PMU_IRQ_CAUSE     0x00
+#define DOVE_PMU_IRQ_MASK      0x04
+
+static void dove_pmu_irq_handler(unsigned int irq, struct irq_desc *desc)
+{
+       struct irq_domain *d = irq_get_handler_data(irq);
+       struct irq_chip_generic *gc = irq_get_domain_generic_chip(d, 0);
+       u32 stat = readl_relaxed(gc->reg_base + DOVE_PMU_IRQ_CAUSE) &
+                  gc->mask_cache;
+
+       while (stat) {
+               u32 hwirq = ffs(stat) - 1;
+
+               generic_handle_irq(irq_find_mapping(d, gc->irq_base + hwirq));
+               stat &= ~(1 << hwirq);
+       }
+}
+
+static void pmu_irq_ack(struct irq_data *d)
+{
+       struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+       struct irq_chip_type *ct = irq_data_get_chip_type(d);
+       u32 mask = ~d->mask;
+
+       /*
+        * The PMU mask register is not RW0C: it is RW.  This means that
+        * the bits take whatever value is written to them; if you write
+        * a '1', you will set the interrupt.
+        *
+        * Unfortunately this means there is NO race free way to clear
+        * these interrupts.
+        *
+        * So, let's structure the code so that the window is as small as
+        * possible.
+        */
+       irq_gc_lock(gc);
+       mask &= irq_reg_readl(gc->reg_base +  ct->regs.ack);
+       irq_reg_writel(mask, gc->reg_base +  ct->regs.ack);
+       irq_gc_unlock(gc);
+}
+
+static int __init dove_pmu_irq_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;
+       int ret, irq, nrirqs = 7;
+
+       domain = irq_domain_add_linear(np, nrirqs,
+                                      &irq_generic_chip_ops, NULL);
+       if (!domain) {
+               pr_err("%s: unable to add irq domain\n", np->name);
+               return -ENOMEM;
+       }
+
+       ret = irq_alloc_domain_generic_chips(domain, nrirqs, 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->name);
+               return ret;
+       }
+
+       ret = of_address_to_resource(np, 0, &r);
+       if (ret) {
+               pr_err("%s: unable to get resource\n", np->name);
+               return ret;
+       }
+
+       if (!request_mem_region(r.start, resource_size(&r), np->name)) {
+               pr_err("%s: unable to request mem region\n", np->name);
+               return -ENOMEM;
+       }
+
+       /* 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->name);
+               return -EINVAL;
+       }
+
+       gc = irq_get_domain_generic_chip(domain, 0);
+       gc->reg_base = ioremap(r.start, resource_size(&r));
+       if (!gc->reg_base) {
+               pr_err("%s: unable to map resource\n", np->name);
+               return -ENOMEM;
+       }
+
+       gc->chip_types[0].regs.ack = DOVE_PMU_IRQ_CAUSE;
+       gc->chip_types[0].regs.mask = DOVE_PMU_IRQ_MASK;
+       gc->chip_types[0].chip.irq_ack = pmu_irq_ack;
+       gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;
+       gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;
+
+       /* mask and clear all interrupts */
+       writel(0, gc->reg_base + DOVE_PMU_IRQ_MASK);
+       writel(0, gc->reg_base + DOVE_PMU_IRQ_CAUSE);
+
+       irq_set_handler_data(irq, domain);
+       irq_set_chained_handler(irq, dove_pmu_irq_handler);
+
+       return 0;
+}
+IRQCHIP_DECLARE(dove_pmu_intc,
+               "marvell,dove-pmu-intc", dove_pmu_irq_init);
index 82cec63a90112e184c96a2e21e612df977adf7b7..3ee78f02e5d7d940d531aa6ab03c8dc681c9cb3c 100644 (file)
@@ -149,8 +149,9 @@ static void intc_irqpin_read_modify_write(struct intc_irqpin_priv *p,
 static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p,
                                         int irq, int do_mask)
 {
-       int bitfield_width = 4; /* PRIO assumed to have fixed bitfield width */
-       int shift = (7 - irq) * bitfield_width; /* PRIO assumed to be 32-bit */
+       /* The PRIO register is assumed to be 32-bit with fixed 4-bit fields. */
+       int bitfield_width = 4;
+       int shift = 32 - (irq + 1) * bitfield_width;
 
        intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_PRIO,
                                      shift, bitfield_width,
@@ -159,8 +160,9 @@ static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p,
 
 static int intc_irqpin_set_sense(struct intc_irqpin_priv *p, int irq, int value)
 {
+       /* The SENSE register is assumed to be 32-bit. */
        int bitfield_width = p->config.sense_bitfield_width;
-       int shift = (7 - irq) * bitfield_width; /* SENSE assumed to be 32-bit */
+       int shift = 32 - (irq + 1) * bitfield_width;
 
        dev_dbg(&p->pdev->dev, "sense irq = %d, mode = %d\n", irq, value);
 
diff --git a/drivers/irqchip/irq-xtensa-mx.c b/drivers/irqchip/irq-xtensa-mx.c
new file mode 100644 (file)
index 0000000..f693f1b
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * Xtensa MX interrupt distributor
+ *
+ * Copyright (C) 2002 - 2013 Tensilica, Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/interrupt.h>
+#include <linux/irqdomain.h>
+#include <linux/irq.h>
+#include <linux/of.h>
+
+#include <asm/mxregs.h>
+
+#include "irqchip.h"
+
+#define HW_IRQ_IPI_COUNT 2
+#define HW_IRQ_MX_BASE 2
+#define HW_IRQ_EXTERN_BASE 3
+
+static DEFINE_PER_CPU(unsigned int, cached_irq_mask);
+
+static int xtensa_mx_irq_map(struct irq_domain *d, unsigned int irq,
+               irq_hw_number_t hw)
+{
+       if (hw < HW_IRQ_IPI_COUNT) {
+               struct irq_chip *irq_chip = d->host_data;
+               irq_set_chip_and_handler_name(irq, irq_chip,
+                               handle_percpu_irq, "ipi");
+               irq_set_status_flags(irq, IRQ_LEVEL);
+               return 0;
+       }
+       return xtensa_irq_map(d, irq, hw);
+}
+
+/*
+ * Device Tree IRQ specifier translation function which works with one or
+ * two cell bindings. First cell value maps directly to the hwirq number.
+ * Second cell if present specifies whether hwirq number is external (1) or
+ * internal (0).
+ */
+static int xtensa_mx_irq_domain_xlate(struct irq_domain *d,
+               struct device_node *ctrlr,
+               const u32 *intspec, unsigned int intsize,
+               unsigned long *out_hwirq, unsigned int *out_type)
+{
+       return xtensa_irq_domain_xlate(intspec, intsize,
+                       intspec[0], intspec[0] + HW_IRQ_EXTERN_BASE,
+                       out_hwirq, out_type);
+}
+
+static const struct irq_domain_ops xtensa_mx_irq_domain_ops = {
+       .xlate = xtensa_mx_irq_domain_xlate,
+       .map = xtensa_mx_irq_map,
+};
+
+void secondary_init_irq(void)
+{
+       __this_cpu_write(cached_irq_mask,
+                       XCHAL_INTTYPE_MASK_EXTERN_EDGE |
+                       XCHAL_INTTYPE_MASK_EXTERN_LEVEL);
+       set_sr(XCHAL_INTTYPE_MASK_EXTERN_EDGE |
+                       XCHAL_INTTYPE_MASK_EXTERN_LEVEL, intenable);
+}
+
+static void xtensa_mx_irq_mask(struct irq_data *d)
+{
+       unsigned int mask = 1u << d->hwirq;
+
+       if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE |
+                               XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) {
+               set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) -
+                                       HW_IRQ_MX_BASE), MIENG);
+       } else {
+               mask = __this_cpu_read(cached_irq_mask) & ~mask;
+               __this_cpu_write(cached_irq_mask, mask);
+               set_sr(mask, intenable);
+       }
+}
+
+static void xtensa_mx_irq_unmask(struct irq_data *d)
+{
+       unsigned int mask = 1u << d->hwirq;
+
+       if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE |
+                               XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) {
+               set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) -
+                                       HW_IRQ_MX_BASE), MIENGSET);
+       } else {
+               mask |= __this_cpu_read(cached_irq_mask);
+               __this_cpu_write(cached_irq_mask, mask);
+               set_sr(mask, intenable);
+       }
+}
+
+static void xtensa_mx_irq_enable(struct irq_data *d)
+{
+       variant_irq_enable(d->hwirq);
+       xtensa_mx_irq_unmask(d);
+}
+
+static void xtensa_mx_irq_disable(struct irq_data *d)
+{
+       xtensa_mx_irq_mask(d);
+       variant_irq_disable(d->hwirq);
+}
+
+static void xtensa_mx_irq_ack(struct irq_data *d)
+{
+       set_sr(1 << d->hwirq, intclear);
+}
+
+static int xtensa_mx_irq_retrigger(struct irq_data *d)
+{
+       set_sr(1 << d->hwirq, intset);
+       return 1;
+}
+
+static int xtensa_mx_irq_set_affinity(struct irq_data *d,
+               const struct cpumask *dest, bool force)
+{
+       unsigned mask = 1u << cpumask_any(dest);
+
+       set_er(mask, MIROUT(d->hwirq - HW_IRQ_MX_BASE));
+       return 0;
+
+}
+
+static struct irq_chip xtensa_mx_irq_chip = {
+       .name           = "xtensa-mx",
+       .irq_enable     = xtensa_mx_irq_enable,
+       .irq_disable    = xtensa_mx_irq_disable,
+       .irq_mask       = xtensa_mx_irq_mask,
+       .irq_unmask     = xtensa_mx_irq_unmask,
+       .irq_ack        = xtensa_mx_irq_ack,
+       .irq_retrigger  = xtensa_mx_irq_retrigger,
+       .irq_set_affinity = xtensa_mx_irq_set_affinity,
+};
+
+int __init xtensa_mx_init_legacy(struct device_node *interrupt_parent)
+{
+       struct irq_domain *root_domain =
+               irq_domain_add_legacy(NULL, NR_IRQS, 0, 0,
+                               &xtensa_mx_irq_domain_ops,
+                               &xtensa_mx_irq_chip);
+       irq_set_default_host(root_domain);
+       secondary_init_irq();
+       return 0;
+}
+
+static int __init xtensa_mx_init(struct device_node *np,
+               struct device_node *interrupt_parent)
+{
+       struct irq_domain *root_domain =
+               irq_domain_add_linear(np, NR_IRQS, &xtensa_mx_irq_domain_ops,
+                               &xtensa_mx_irq_chip);
+       irq_set_default_host(root_domain);
+       secondary_init_irq();
+       return 0;
+}
+IRQCHIP_DECLARE(xtensa_mx_irq_chip, "cdns,xtensa-mx", xtensa_mx_init);
diff --git a/drivers/irqchip/irq-xtensa-pic.c b/drivers/irqchip/irq-xtensa-pic.c
new file mode 100644 (file)
index 0000000..7d71126
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Xtensa built-in interrupt controller
+ *
+ * Copyright (C) 2002 - 2013 Tensilica, Inc.
+ * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Chris Zankel <chris@zankel.net>
+ * Kevin Chea
+ */
+
+#include <linux/interrupt.h>
+#include <linux/irqdomain.h>
+#include <linux/irq.h>
+#include <linux/of.h>
+
+#include "irqchip.h"
+
+unsigned int cached_irq_mask;
+
+/*
+ * Device Tree IRQ specifier translation function which works with one or
+ * two cell bindings. First cell value maps directly to the hwirq number.
+ * Second cell if present specifies whether hwirq number is external (1) or
+ * internal (0).
+ */
+static int xtensa_pic_irq_domain_xlate(struct irq_domain *d,
+               struct device_node *ctrlr,
+               const u32 *intspec, unsigned int intsize,
+               unsigned long *out_hwirq, unsigned int *out_type)
+{
+       return xtensa_irq_domain_xlate(intspec, intsize,
+                       intspec[0], intspec[0],
+                       out_hwirq, out_type);
+}
+
+static const struct irq_domain_ops xtensa_irq_domain_ops = {
+       .xlate = xtensa_pic_irq_domain_xlate,
+       .map = xtensa_irq_map,
+};
+
+static void xtensa_irq_mask(struct irq_data *d)
+{
+       cached_irq_mask &= ~(1 << d->hwirq);
+       set_sr(cached_irq_mask, intenable);
+}
+
+static void xtensa_irq_unmask(struct irq_data *d)
+{
+       cached_irq_mask |= 1 << d->hwirq;
+       set_sr(cached_irq_mask, intenable);
+}
+
+static void xtensa_irq_enable(struct irq_data *d)
+{
+       variant_irq_enable(d->hwirq);
+       xtensa_irq_unmask(d);
+}
+
+static void xtensa_irq_disable(struct irq_data *d)
+{
+       xtensa_irq_mask(d);
+       variant_irq_disable(d->hwirq);
+}
+
+static void xtensa_irq_ack(struct irq_data *d)
+{
+       set_sr(1 << d->hwirq, intclear);
+}
+
+static int xtensa_irq_retrigger(struct irq_data *d)
+{
+       set_sr(1 << d->hwirq, intset);
+       return 1;
+}
+
+static struct irq_chip xtensa_irq_chip = {
+       .name           = "xtensa",
+       .irq_enable     = xtensa_irq_enable,
+       .irq_disable    = xtensa_irq_disable,
+       .irq_mask       = xtensa_irq_mask,
+       .irq_unmask     = xtensa_irq_unmask,
+       .irq_ack        = xtensa_irq_ack,
+       .irq_retrigger  = xtensa_irq_retrigger,
+};
+
+int __init xtensa_pic_init_legacy(struct device_node *interrupt_parent)
+{
+       struct irq_domain *root_domain =
+               irq_domain_add_legacy(NULL, NR_IRQS, 0, 0,
+                               &xtensa_irq_domain_ops, &xtensa_irq_chip);
+       irq_set_default_host(root_domain);
+       return 0;
+}
+
+static int __init xtensa_pic_init(struct device_node *np,
+               struct device_node *interrupt_parent)
+{
+       struct irq_domain *root_domain =
+               irq_domain_add_linear(np, NR_IRQS, &xtensa_irq_domain_ops,
+                               &xtensa_irq_chip);
+       irq_set_default_host(root_domain);
+       return 0;
+}
+IRQCHIP_DECLARE(xtensa_irq_chip, "cdns,xtensa-pic", xtensa_pic_init);
index d26a312f117aefbfa41dc8bbff377c5b53db345c..3067d56b11a6b6af70ac980ec42d1e8846dd87ca 100644 (file)
@@ -32,7 +32,7 @@ config ADB_MACII
 
 config ADB_MACIISI
        bool "Include Mac IIsi ADB driver"
-       depends on ADB && MAC
+       depends on ADB && MAC && BROKEN
        help
          Say Y here if want your kernel to support Macintosh systems that use
          the Mac IIsi style ADB.  This includes the IIsi, IIvi, IIvx, Classic
index 9ef32b3df91f060b0b85d399d207faad7c072384..590214ba736c1778181f3a75cccd1aed0d2f71f9 100644 (file)
@@ -133,7 +133,7 @@ static int wf_lm75_probe(struct i2c_client *client,
        lm->inited = 0;
        lm->ds1775 = ds1775;
        lm->i2c = client;
-       lm->sens.name = (char *)name; /* XXX fix constness in structure */
+       lm->sens.name = name;
        lm->sens.ops = &wf_lm75_ops;
        i2c_set_clientdata(client, lm);
 
index 945a25b2f31ea78b82a746d6beff6407341e5db4..87e439b10318de19bcafe544350c0268d444702a 100644 (file)
@@ -95,7 +95,7 @@ static int wf_max6690_probe(struct i2c_client *client,
        }
 
        max->i2c = client;
-       max->sens.name = (char *)name; /* XXX fix constness in structure */
+       max->sens.name = name;
        max->sens.ops = &wf_max6690_ops;
        i2c_set_clientdata(client, max);
 
index d0799e32336450d967114938fc610b66d4134070..9c9063cd3208909d5840a7c2cc745d1bf124f542 100644 (file)
@@ -955,7 +955,7 @@ struct sms_rx_stats {
        u32 modem_state;                /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */
        s32 SNR;                /* dB */
        u32 ber;                /* Post Viterbi ber [1E-5] */
-       u32 ber_error_count;    /* Number of erronous SYNC bits. */
+       u32 ber_error_count;    /* Number of erroneous SYNC bits. */
        u32 ber_bit_count;      /* Total number of SYNC bits. */
        u32 ts_per;             /* Transport stream PER,
        0xFFFFFFFF indicate N/A */
@@ -981,7 +981,7 @@ struct sms_rx_stats_ex {
        u32 modem_state;                /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */
        s32 SNR;                /* dB */
        u32 ber;                /* Post Viterbi ber [1E-5] */
-       u32 ber_error_count;    /* Number of erronous SYNC bits. */
+       u32 ber_error_count;    /* Number of erroneous SYNC bits. */
        u32 ber_bit_count;      /* Total number of SYNC bits. */
        u32 ts_per;             /* Transport stream PER,
        0xFFFFFFFF indicate N/A */
index 92c413ba0c7971386f052e2f4c4c00876062a31d..ae36d0ae0fb1991ae0ee2e16e392796ca12d271f 100644 (file)
@@ -95,7 +95,7 @@ struct RECEPTION_STATISTICS_PER_SLICES_S {
        u32 is_demod_locked;    /* 0 - not locked, 1 - locked */
 
        u32 ber_bit_count;      /* Total number of SYNC bits. */
-       u32 ber_error_count;    /* Number of erronous SYNC bits. */
+       u32 ber_error_count;    /* Number of erroneous SYNC bits. */
 
        s32 MRC_SNR;            /* dB */
        s32 mrc_in_band_pwr;    /* In band power in dBM */
index 58de4410c5258a7d6009ae47b5becd7e20fa6208..6c7ff0cdcd32ddd44cae9dcf85e98054a7601052 100644 (file)
@@ -435,7 +435,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
                dprintk_tscheck("TEI detected. "
                                "PID=0x%x data1=0x%x\n",
                                pid, buf[1]);
-               /* data in this packet cant be trusted - drop it unless
+               /* data in this packet can't be trusted - drop it unless
                 * module option dvb_demux_feed_err_pkts is set */
                if (!dvb_demux_feed_err_pkts)
                        return;
@@ -1032,8 +1032,13 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed,
                return -EINVAL;
        }
 
-       if (feed->is_filtering)
+       if (feed->is_filtering) {
+               /* release dvbdmx->mutex as far as it is
+                  acquired by stop_filtering() itself */
+               mutex_unlock(&dvbdmx->mutex);
                feed->stop_filtering(feed);
+               mutex_lock(&dvbdmx->mutex);
+       }
 
        spin_lock_irq(&dvbdmx->lock);
        f = dvbdmxfeed->filter;
index 30ee59052157815edd50669afe2293ed4e2e8867..65728c25ea05adcd50bd658c96a6c54dd6fb569b 100644 (file)
@@ -170,18 +170,18 @@ static int af9033_rd_reg_mask(struct af9033_state *state, u32 reg, u8 *val,
 static int af9033_wr_reg_val_tab(struct af9033_state *state,
                const struct reg_val *tab, int tab_len)
 {
+#define MAX_TAB_LEN 212
        int ret, i, j;
-       u8 buf[MAX_XFER_SIZE];
+       u8 buf[1 + MAX_TAB_LEN];
+
+       dev_dbg(&state->i2c->dev, "%s: tab_len=%d\n", __func__, tab_len);
 
        if (tab_len > sizeof(buf)) {
-               dev_warn(&state->i2c->dev,
-                        "%s: i2c wr len=%d is too big!\n",
-                        KBUILD_MODNAME, tab_len);
+               dev_warn(&state->i2c->dev, "%s: tab len %d is too big\n",
+                               KBUILD_MODNAME, tab_len);
                return -EINVAL;
        }
 
-       dev_dbg(&state->i2c->dev, "%s: tab_len=%d\n", __func__, tab_len);
-
        for (i = 0, j = 0; i < tab_len; i++) {
                buf[j] = tab[i].val;
 
index 125a44041011ca0ed17f99999a2bffaa5c1999a1..5c6ab4921bf11d2004ed77e9240b2452fbbb3974 100644 (file)
@@ -78,7 +78,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)
 
        num = if_freq / 1000; /* Hz => kHz */
        num *= 0x4000;
-       if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
+       if_ctl = 0x4000 - cxd2820r_div_u64_round_closest(num, 41000);
        buf[0] = (if_ctl >> 8) & 0x3f;
        buf[1] = (if_ctl >> 0) & 0xff;
 
index 90536147bf0458c444a59e176b79ddff09471f4f..6dbbee453ee15adb0c4d6b97196beefe6e7d9523 100644 (file)
@@ -3048,7 +3048,7 @@ static int dib8000_tune(struct dvb_frontend *fe)
                        dib8000_set_diversity_in(state->fe[0], state->diversity_onoff);
 
                        locks = (dib8000_read_word(state, 180) >> 6) & 0x3f; /* P_coff_winlen ? */
-                       /* coff should lock over P_coff_winlen ofdm symbols : give 3 times this lenght to lock */
+                       /* coff should lock over P_coff_winlen ofdm symbols : give 3 times this length to lock */
                        *timeout = dib8000_get_timeout(state, 2 * locks, SYMBOL_DEPENDENT_ON);
                        *tune_state = CT_DEMOD_STEP_5;
                        break;
@@ -3115,7 +3115,7 @@ static int dib8000_tune(struct dvb_frontend *fe)
 
        case CT_DEMOD_STEP_9: /* 39 */
                        if ((state->revision == 0x8090) || ((dib8000_read_word(state, 1291) >> 9) & 0x1)) { /* fe capable of deinterleaving : esram */
-                               /* defines timeout for mpeg lock depending on interleaver lenght of longest layer */
+                               /* defines timeout for mpeg lock depending on interleaver length of longest layer */
                                for (i = 0; i < 3; i++) {
                                        if (c->layer[i].interleaving >= deeper_interleaver) {
                                                dprintk("layer%i: time interleaver = %d ", i, c->layer[i].interleaving);
index d416c15691dadd69b49eda6f26c70892c3a02652..bf29a3f0e6f0ca440990f7b8b61e71e9bd02674a 100644 (file)
@@ -1191,7 +1191,7 @@ static int mpegts_configure_pins(struct drxk_state *state, bool mpeg_enable)
                        goto error;
 
                if (state->m_enable_parallel == true) {
-                       /* paralel -> enable MD1 to MD7 */
+                       /* parallel -> enable MD1 to MD7 */
                        status = write16(state, SIO_PDR_MD1_CFG__A,
                                         sio_pdr_mdx_cfg);
                        if (status < 0)
@@ -1428,7 +1428,7 @@ static int mpegts_stop(struct drxk_state *state)
 
        dprintk(1, "\n");
 
-       /* Gracefull shutdown (byte boundaries) */
+       /* Graceful shutdown (byte boundaries) */
        status = read16(state, FEC_OC_SNC_MODE__A, &fec_oc_snc_mode);
        if (status < 0)
                goto error;
@@ -2021,7 +2021,7 @@ static int mpegts_dto_setup(struct drxk_state *state,
                fec_oc_dto_burst_len = 204;
        }
 
-       /* Check serial or parrallel output */
+       /* Check serial or parallel output */
        fec_oc_reg_ipr_mode &= (~(FEC_OC_IPR_MODE_SERIAL__M));
        if (state->m_enable_parallel == false) {
                /* MPEG data output is serial -> set ipr_mode[0] */
@@ -2908,7 +2908,7 @@ static int adc_synchronization(struct drxk_state *state)
                goto error;
 
        if (count == 1) {
-               /* Try sampling on a diffrent edge */
+               /* Try sampling on a different edge */
                u16 clk_neg = 0;
 
                status = read16(state, IQM_AF_CLKNEG__A, &clk_neg);
@@ -3306,7 +3306,7 @@ static int dvbt_sc_command(struct drxk_state *state,
        if (status < 0)
                goto error;
 
-       /* Retreive results parameters from SC */
+       /* Retrieve results parameters from SC */
        switch (cmd) {
                /* All commands yielding 5 results */
                /* All commands yielding 4 results */
@@ -3849,7 +3849,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz,
                break;
        }
 #if 0
-       /* No hierachical channels support in BDA */
+       /* No hierarchical channels support in BDA */
        /* Priority (only for hierarchical channels) */
        switch (channel->priority) {
        case DRX_PRIORITY_LOW:
@@ -4081,7 +4081,7 @@ error:
 /*============================================================================*/
 
 /**
-* \brief Retreive lock status .
+* \brief Retrieve lock status .
 * \param demod    Pointer to demodulator instance.
 * \param lockStat Pointer to lock status structure.
 * \return DRXStatus_t.
@@ -6174,7 +6174,7 @@ static int init_drxk(struct drxk_state *state)
                        goto error;
 
                /* Stamp driver version number in SCU data RAM in BCD code
-                       Done to enable field application engineers to retreive drxdriver version
+                       Done to enable field application engineers to retrieve drxdriver version
                        via I2C from SCU RAM.
                        Not using SCU command interface for SCU register access since no
                        microcode may be present.
@@ -6399,7 +6399,7 @@ static int drxk_set_parameters(struct dvb_frontend *fe)
        fe->ops.tuner_ops.get_if_frequency(fe, &IF);
        start(state, 0, IF);
 
-       /* After set_frontend, stats aren't avaliable */
+       /* After set_frontend, stats aren't available */
        p->strength.stat[0].scale = FE_SCALE_RELATIVE;
        p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
        p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
index 7efb796c472c475bed62f1a0bb783f5b991a5b1e..50e8b63e5169bad938b1fc8b79e0871a619364d3 100644 (file)
@@ -710,6 +710,7 @@ struct dvb_frontend *rtl2830_attach(const struct rtl2830_config *cfg,
                sizeof(priv->tuner_i2c_adapter.name));
        priv->tuner_i2c_adapter.algo = &rtl2830_tuner_i2c_algo;
        priv->tuner_i2c_adapter.algo_data = NULL;
+       priv->tuner_i2c_adapter.dev.parent = &i2c->dev;
        i2c_set_adapdata(&priv->tuner_i2c_adapter, priv);
        if (i2c_add_adapter(&priv->tuner_i2c_adapter) < 0) {
                dev_err(&i2c->dev,
index 4a5b7d211d2f14e3810111a7f6399405e5000935..b253d400e8176a8baa3d1ba6928a1911d74bdb9d 100644 (file)
@@ -52,9 +52,9 @@
 #define ADV7183_VS_FIELD_CTRL_1    0x31 /* Vsync field control 1 */
 #define ADV7183_VS_FIELD_CTRL_2    0x32 /* Vsync field control 2 */
 #define ADV7183_VS_FIELD_CTRL_3    0x33 /* Vsync field control 3 */
-#define ADV7183_HS_POS_CTRL_1      0x34 /* Hsync positon control 1 */
-#define ADV7183_HS_POS_CTRL_2      0x35 /* Hsync positon control 2 */
-#define ADV7183_HS_POS_CTRL_3      0x36 /* Hsync positon control 3 */
+#define ADV7183_HS_POS_CTRL_1      0x34 /* Hsync position control 1 */
+#define ADV7183_HS_POS_CTRL_2      0x35 /* Hsync position control 2 */
+#define ADV7183_HS_POS_CTRL_3      0x36 /* Hsync position control 3 */
 #define ADV7183_POLARITY           0x37 /* Polarity */
 #define ADV7183_NTSC_COMB_CTRL     0x38 /* NTSC comb control */
 #define ADV7183_PAL_COMB_CTRL      0x39 /* PAL comb control */
index fbfdd2fc2a367f5b48c67fc41785395508fc473d..a324106b9f11e985c0637c16578cd3922ee6f58b 100644 (file)
@@ -877,7 +877,7 @@ static void configure_custom_video_timings(struct v4l2_subdev *sd,
                break;
        case ADV7604_MODE_HDMI:
                /* set default prim_mode/vid_std for HDMI
-                  accoring to [REF_03, c. 4.2] */
+                  according to [REF_03, c. 4.2] */
                io_write(sd, 0x00, 0x02); /* video std */
                io_write(sd, 0x01, 0x06); /* prim mode */
                break;
index 22f729d66a9696522e18d42932ae383594cbca5f..b154f36740b49151e2b1e0daeaf307c53032f3e7 100644 (file)
@@ -1013,7 +1013,7 @@ static void configure_custom_video_timings(struct v4l2_subdev *sd,
                break;
        case ADV7842_MODE_HDMI:
                /* set default prim_mode/vid_std for HDMI
-                  accoring to [REF_03, c. 4.2] */
+                  according to [REF_03, c. 4.2] */
                io_write(sd, 0x00, 0x02); /* video std */
                io_write(sd, 0x01, 0x06); /* prim mode */
                break;
index 82bf5679da3064d5a8ffd9da91c3d9e085d8d8bb..99ee456700f4972ef53888d692aa5f4b19930bce 100644 (file)
@@ -394,7 +394,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
 
        if (!rc) {
                /*
-                * If platform_data doesn't specify rc_dev, initilize it
+                * If platform_data doesn't specify rc_dev, initialize it
                 * internally
                 */
                rc = rc_allocate_device();
index f34429e452abf4e01dfd71d38ceb690d3c5ab021..a60931e66312e1ff3818ff363c0edd920c0d6c04 100644 (file)
@@ -544,7 +544,7 @@ int m5mols_init_controls(struct v4l2_subdev *sd)
        u16 zoom_step;
        int ret;
 
-       /* Determine the firmware dependant control range and step values */
+       /* Determine the firmware dependent control range and step values */
        ret = m5mols_read_u16(sd, AE_MAX_GAIN_MON, &exposure_max);
        if (ret < 0)
                return ret;
index 4734836fe5a410c8cf4249d9c455f5ceaf4b627c..1c2303d18bf49db242c00ac0cab8a474843c6db1 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/i2c.h>
 #include <linux/log2.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/of_gpio.h>
 #include <linux/pm.h>
 #include <linux/regulator/consumer.h>
index 6fec9384d86e4877d5b750a9f9a9ceec53e06bde..e7f555cc827abb4ddc1eba44bb1526e1d32576e4 100644 (file)
@@ -1460,7 +1460,7 @@ static int s5c73m3_oif_registered(struct v4l2_subdev *sd)
        mutex_unlock(&state->lock);
 
        v4l2_dbg(1, s5c73m3_dbg, sd, "%s: Booting %s (%d)\n",
-                __func__, ret ? "failed" : "succeded", ret);
+                __func__, ret ? "failed" : "succeeded", ret);
 
        return ret;
 }
index 9d2c0865224609504ab1a9b9302cb99d53086e85..9dfa516f694471660f9de431c948ae279ed07bb9 100644 (file)
@@ -393,7 +393,7 @@ struct s5c73m3 {
 
        /* External master clock frequency */
        u32 mclk_frequency;
-       /* Video bus type - MIPI-CSI2/paralell */
+       /* Video bus type - MIPI-CSI2/parallel */
        enum v4l2_mbus_type bus_type;
 
        const struct s5c73m3_frame_size *sensor_pix_size[2];
index 637d026345271c154f4af2da7a53bde6adbcae94..afdbcb045ceece64685db171dac9699d8a7dfc49 100644 (file)
@@ -1699,7 +1699,7 @@ static void saa711x_write_platform_data(struct saa711x_state *state,
  * the analog demod.
  * If the tuner is not found, it returns -ENODEV.
  * If auto-detection is disabled and the tuner doesn't match what it was
- *     requred, it returns -EINVAL and fills 'name'.
+ *     required, it returns -EINVAL and fills 'name'.
  * If the chip is found, it returns the chip ID and fills 'name'.
  */
 static int saa711x_detect_chip(struct i2c_client *client,
index 0a5c5d4fedd6e375b34a1848f3b646a6577bd97d..d2daa6a8f27245b88f69d832b2f2537ab716b0f9 100644 (file)
@@ -642,7 +642,7 @@ static const struct ov5642_datafmt
 static int reg_read(struct i2c_client *client, u16 reg, u8 *val)
 {
        int ret;
-       /* We have 16-bit i2c addresses - care for endianess */
+       /* We have 16-bit i2c addresses - care for endianness */
        unsigned char data[2] = { reg >> 8, reg & 0xff };
 
        ret = i2c_master_send(client, data, 2);
index 42276d93624cada191b30eb7e3ca7ad40fb923fa..ed9ae8875348b6abdd226e3026e4b1d6f117c12f 100644 (file)
@@ -83,7 +83,8 @@ static int ths7303_write(struct v4l2_subdev *sd, u8 reg, u8 val)
 }
 
 /* following function is used to set ths7303 */
-int ths7303_setval(struct v4l2_subdev *sd, enum ths7303_filter_mode mode)
+static int ths7303_setval(struct v4l2_subdev *sd,
+                         enum ths7303_filter_mode mode)
 {
        struct i2c_client *client = v4l2_get_subdevdata(sd);
        struct ths7303_state *state = to_state(sd);
index 3f584a7d0781b9860aad6b6bb9f6ddef4ad2b449..bee7946faa7cc2ba28a690e219cd0c5dcf89ff3b 100644 (file)
@@ -130,12 +130,10 @@ static int wm8775_s_routing(struct v4l2_subdev *sd,
                return -EINVAL;
        }
        state->input = input;
-       if (!v4l2_ctrl_g_ctrl(state->mute))
+       if (v4l2_ctrl_g_ctrl(state->mute))
                return 0;
        if (!v4l2_ctrl_g_ctrl(state->vol))
                return 0;
-       if (!v4l2_ctrl_g_ctrl(state->bal))
-               return 0;
        wm8775_set_audio(sd, 1);
        return 0;
 }
index 2c286c307145b6828a7ac8c3b4bfc4f05ae18735..37c334edc7e8c10d3a6430f64a29b1f16088d929 100644 (file)
@@ -235,6 +235,8 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity,
        media_entity_graph_walk_start(&graph, entity);
 
        while ((entity = media_entity_graph_walk_next(&graph))) {
+               DECLARE_BITMAP(active, entity->num_pads);
+               DECLARE_BITMAP(has_no_links, entity->num_pads);
                unsigned int i;
 
                entity->stream_count++;
@@ -248,21 +250,46 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity,
                if (!entity->ops || !entity->ops->link_validate)
                        continue;
 
+               bitmap_zero(active, entity->num_pads);
+               bitmap_fill(has_no_links, entity->num_pads);
+
                for (i = 0; i < entity->num_links; i++) {
                        struct media_link *link = &entity->links[i];
-
-                       /* Is this pad part of an enabled link? */
-                       if (!(link->flags & MEDIA_LNK_FL_ENABLED))
-                               continue;
-
-                       /* Are we the sink or not? */
-                       if (link->sink->entity != entity)
+                       struct media_pad *pad = link->sink->entity == entity
+                                               ? link->sink : link->source;
+
+                       /* Mark that a pad is connected by a link. */
+                       bitmap_clear(has_no_links, pad->index, 1);
+
+                       /*
+                        * Pads that either do not need to connect or
+                        * are connected through an enabled link are
+                        * fine.
+                        */
+                       if (!(pad->flags & MEDIA_PAD_FL_MUST_CONNECT) ||
+                           link->flags & MEDIA_LNK_FL_ENABLED)
+                               bitmap_set(active, pad->index, 1);
+
+                       /*
+                        * Link validation will only take place for
+                        * sink ends of the link that are enabled.
+                        */
+                       if (link->sink != pad ||
+                           !(link->flags & MEDIA_LNK_FL_ENABLED))
                                continue;
 
                        ret = entity->ops->link_validate(link);
                        if (ret < 0 && ret != -ENOIOCTLCMD)
                                goto error;
                }
+
+               /* Either no links or validated links are fine. */
+               bitmap_or(active, active, has_no_links, entity->num_pads);
+
+               if (!bitmap_full(active, entity->num_pads)) {
+                       ret = -EPIPE;
+                       goto error;
+               }
        }
 
        mutex_unlock(&mdev->graph_mutex);
index a3b1ee9c00d7152405e9ea0e71549f350194692e..92a06fd858652acddff2dd65ce07dee560445df1 100644 (file)
@@ -4182,7 +4182,8 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
        }
        btv->std = V4L2_STD_PAL;
        init_irqreg(btv);
-       v4l2_ctrl_handler_setup(hdl);
+       if (!bttv_tvcards[btv->c.type].no_video)
+               v4l2_ctrl_handler_setup(hdl);
        if (hdl->error) {
                result = hdl->error;
                goto fail2;
index 2767c64df0c87f9c044aca755a63fbfd0c75adf3..57f4688ea55bdf2488eb14dc523d4a4c542a2609 100644 (file)
@@ -262,7 +262,7 @@ struct cx18_options {
 };
 
 /* per-mdl bit flags */
-#define CX18_F_M_NEED_SWAP  0  /* mdl buffer data must be endianess swapped */
+#define CX18_F_M_NEED_SWAP  0  /* mdl buffer data must be endianness swapped */
 
 /* per-stream, s_flags */
 #define CX18_F_S_CLAIMED       3       /* this stream is claimed */
index e3fc2c71808abbd0746cc7d9faabdfc14b9c583f..95666eee7b277026f3c1154a78361212653130b9 100644 (file)
@@ -427,7 +427,7 @@ int mc417_register_read(struct cx23885_dev *dev, u16 address, u32 *value)
        cx_write(MC417_RWD, regval);
 
        /* Transition RD to effect read transaction across bus.
-        * Transtion 0x5000 -> 0x9000 correct (RD/RDY -> WR/RDY)?
+        * Transition 0x5000 -> 0x9000 correct (RD/RDY -> WR/RDY)?
         * Should it be 0x9000 -> 0xF000 (also why is RDY being set, its
         * input only...)
         */
index 8164d74b46a4590af0db79f56bd8c41bacead624..655d6854a8d7fa165502c711bf6c83a017cc16be 100644 (file)
@@ -401,7 +401,7 @@ static int pluto_hw_init(struct pluto *pluto)
        /* set automatic LED control by FPGA */
        pluto_rw(pluto, REG_MISC, MISC_ALED, MISC_ALED);
 
-       /* set data endianess */
+       /* set data endianness */
 #ifdef __LITTLE_ENDIAN
        pluto_rw(pluto, REG_PIDn(0), PID0_END, PID0_END);
 #else
index 57ef5456f1e87e9cc042ec8dc05cdb07192bc15d..1bf06970ca3e8e180cb6a2f20d732c983af820b2 100644 (file)
@@ -1354,9 +1354,11 @@ static int saa7164_initdev(struct pci_dev *pci_dev,
                if (fw_debug) {
                        dev->kthread = kthread_run(saa7164_thread_function, dev,
                                "saa7164 debug");
-                       if (!dev->kthread)
+                       if (IS_ERR(dev->kthread)) {
+                               dev->kthread = NULL;
                                printk(KERN_ERR "%s() Failed to create "
                                        "debug kernel thread\n", __func__);
+                       }
                }
 
        } /* != BOARD_UNKNOWN */
index bd72fb97fea5ab05924c4eeb4f5452534f3c3f46..61f3dbcc259f40f8a0f6f2b4bfa9b52ed6bf24ee 100644 (file)
@@ -1434,7 +1434,7 @@ static void coda_buf_queue(struct vb2_buffer *vb)
        if (q_data->fourcc == V4L2_PIX_FMT_H264 &&
            vb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
                /*
-                * For backwards compatiblity, queuing an empty buffer marks
+                * For backwards compatibility, queuing an empty buffer marks
                 * the stream end
                 */
                if (vb2_get_plane_payload(vb, 0) == 0)
index 3d66d88ea3a191911ce72a22a8198602d7640e35..f7915695c9073d37ca10da947c29891b8d0e45d5 100644 (file)
@@ -1039,7 +1039,7 @@ static int fimc_runtime_resume(struct device *dev)
 
        dbg("fimc%d: state: 0x%lx", fimc->id, fimc->state);
 
-       /* Enable clocks and perform basic initalization */
+       /* Enable clocks and perform basic initialization */
        clk_enable(fimc->clock[CLK_GATE]);
        fimc_hw_reset(fimc);
 
index 3d376faec777d1781434cdbf5526301f50b98271..1790fb4e32eabfc8af8084d452e6483827a3852f 100644 (file)
@@ -481,7 +481,6 @@ struct fimc_ctrls {
  * @flags:             additional flags for image conversion
  * @state:             flags to keep track of user configuration
  * @fimc_dev:          the FIMC device this context applies to
- * @m2m_ctx:           memory-to-memory device context
  * @fh:                        v4l2 file handle
  * @ctrls:             v4l2 controls structure
  */
@@ -502,7 +501,6 @@ struct fimc_ctx {
        u32                     flags;
        u32                     state;
        struct fimc_dev         *fimc_dev;
-       struct v4l2_m2m_ctx     *m2m_ctx;
        struct v4l2_fh          fh;
        struct fimc_ctrls       ctrls;
 };
index f758e2694fa3f1eede8b7155fb10094e72e08a04..2628733c4e104f6e7790a74b40f1add7416a2760 100644 (file)
@@ -33,47 +33,23 @@ void fimc_is_hw_set_intgr0_gd0(struct fimc_is *is)
        mcuctl_write(INTGR0_INTGD(0), is, MCUCTL_REG_INTGR0);
 }
 
-int fimc_is_hw_wait_intsr0_intsd0(struct fimc_is *is)
-{
-       unsigned int timeout = 2000;
-       u32 cfg, status;
-
-       cfg = mcuctl_read(is, MCUCTL_REG_INTSR0);
-       status = INTSR0_GET_INTSD(0, cfg);
-
-       while (status) {
-               cfg = mcuctl_read(is, MCUCTL_REG_INTSR0);
-               status = INTSR0_GET_INTSD(0, cfg);
-               if (timeout == 0) {
-                       dev_warn(&is->pdev->dev, "%s timeout\n",
-                                __func__);
-                       return -ETIME;
-               }
-               timeout--;
-               udelay(1);
-       }
-       return 0;
-}
-
 int fimc_is_hw_wait_intmsr0_intmsd0(struct fimc_is *is)
 {
        unsigned int timeout = 2000;
        u32 cfg, status;
 
-       cfg = mcuctl_read(is, MCUCTL_REG_INTMSR0);
-       status = INTMSR0_GET_INTMSD(0, cfg);
-
-       while (status) {
+       do {
                cfg = mcuctl_read(is, MCUCTL_REG_INTMSR0);
                status = INTMSR0_GET_INTMSD(0, cfg);
-               if (timeout == 0) {
+
+               if (--timeout == 0) {
                        dev_warn(&is->pdev->dev, "%s timeout\n",
                                 __func__);
-                       return -ETIME;
+                       return -ETIMEDOUT;
                }
-               timeout--;
                udelay(1);
-       }
+       } while (status != 0);
+
        return 0;
 }
 
index 5fa2fda46742687e97e7aad2f14a508e6889ecfe..1d9d4ffc6ad59ca8d24fbd0bef0005ece14d1354 100644 (file)
@@ -145,7 +145,6 @@ void fimc_is_fw_clear_irq2(struct fimc_is *is);
 int fimc_is_hw_get_params(struct fimc_is *is, unsigned int num);
 
 void fimc_is_hw_set_intgr0_gd0(struct fimc_is *is);
-int fimc_is_hw_wait_intsr0_intsd0(struct fimc_is *is);
 int fimc_is_hw_wait_intmsr0_intmsd0(struct fimc_is *is);
 void fimc_is_hw_set_sensor_num(struct fimc_is *is);
 void fimc_is_hw_stream_on(struct fimc_is *is);
index 72a343e3b5e85e62393f8950c3d0e096d09b8909..d0dc7ee0445272eb9d3111b88a33460626f49a6a 100644 (file)
@@ -133,7 +133,7 @@ void flite_hw_set_source_format(struct fimc_lite *dev, struct flite_frame *f)
        int i = ARRAY_SIZE(src_pixfmt_map);
        u32 cfg;
 
-       while (--i >= 0) {
+       while (--i) {
                if (src_pixfmt_map[i][0] == pixelcode)
                        break;
        }
@@ -240,7 +240,7 @@ static void flite_hw_set_out_order(struct fimc_lite *dev, struct flite_frame *f)
        u32 cfg = readl(dev->regs + FLITE_REG_CIODMAFMT);
        int i = ARRAY_SIZE(pixcode);
 
-       while (--i >= 0)
+       while (--i)
                if (pixcode[i][0] == f->fmt->mbus_code)
                        break;
        cfg &= ~FLITE_REG_CIODMAFMT_YCBCR_ORDER_MASK;
index 8d33b68c76bac7d9e278785a8c914dddce602197..9da95bd148200d5a4406aa6f80a09bf1364d7c65 100644 (file)
@@ -44,17 +44,17 @@ void fimc_m2m_job_finish(struct fimc_ctx *ctx, int vb_state)
 {
        struct vb2_buffer *src_vb, *dst_vb;
 
-       if (!ctx || !ctx->m2m_ctx)
+       if (!ctx || !ctx->fh.m2m_ctx)
                return;
 
-       src_vb = v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
-       dst_vb = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx);
+       src_vb = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
+       dst_vb = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
 
        if (src_vb && dst_vb) {
                v4l2_m2m_buf_done(src_vb, vb_state);
                v4l2_m2m_buf_done(dst_vb, vb_state);
                v4l2_m2m_job_finish(ctx->fimc_dev->m2m.m2m_dev,
-                                   ctx->m2m_ctx);
+                                   ctx->fh.m2m_ctx);
        }
 }
 
@@ -123,12 +123,12 @@ static void fimc_device_run(void *priv)
                fimc_prepare_dma_offset(ctx, df);
        }
 
-       src_vb = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
+       src_vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
        ret = fimc_prepare_addr(ctx, src_vb, sf, &sf->paddr);
        if (ret)
                goto dma_unlock;
 
-       dst_vb = v4l2_m2m_next_dst_buf(ctx->m2m_ctx);
+       dst_vb = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
        ret = fimc_prepare_addr(ctx, dst_vb, df, &df->paddr);
        if (ret)
                goto dma_unlock;
@@ -219,31 +219,15 @@ static int fimc_buf_prepare(struct vb2_buffer *vb)
 static void fimc_buf_queue(struct vb2_buffer *vb)
 {
        struct fimc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
-
-       dbg("ctx: %p, ctx->state: 0x%x", ctx, ctx->state);
-
-       if (ctx->m2m_ctx)
-               v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
-}
-
-static void fimc_lock(struct vb2_queue *vq)
-{
-       struct fimc_ctx *ctx = vb2_get_drv_priv(vq);
-       mutex_lock(&ctx->fimc_dev->lock);
-}
-
-static void fimc_unlock(struct vb2_queue *vq)
-{
-       struct fimc_ctx *ctx = vb2_get_drv_priv(vq);
-       mutex_unlock(&ctx->fimc_dev->lock);
+       v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
 }
 
 static struct vb2_ops fimc_qops = {
        .queue_setup     = fimc_queue_setup,
        .buf_prepare     = fimc_buf_prepare,
        .buf_queue       = fimc_buf_queue,
-       .wait_prepare    = fimc_unlock,
-       .wait_finish     = fimc_lock,
+       .wait_prepare    = vb2_ops_wait_prepare,
+       .wait_finish     = vb2_ops_wait_finish,
        .stop_streaming  = stop_streaming,
        .start_streaming = start_streaming,
 };
@@ -385,7 +369,7 @@ static int fimc_m2m_s_fmt_mplane(struct file *file, void *fh,
        if (ret)
                return ret;
 
-       vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
+       vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type);
 
        if (vb2_is_busy(vq)) {
                v4l2_err(&fimc->m2m.vfd, "queue (%d) busy\n", f->type);
@@ -410,56 +394,6 @@ static int fimc_m2m_s_fmt_mplane(struct file *file, void *fh,
        return 0;
 }
 
-static int fimc_m2m_reqbufs(struct file *file, void *fh,
-                           struct v4l2_requestbuffers *reqbufs)
-{
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
-       return v4l2_m2m_reqbufs(file, ctx->m2m_ctx, reqbufs);
-}
-
-static int fimc_m2m_querybuf(struct file *file, void *fh,
-                            struct v4l2_buffer *buf)
-{
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
-       return v4l2_m2m_querybuf(file, ctx->m2m_ctx, buf);
-}
-
-static int fimc_m2m_qbuf(struct file *file, void *fh,
-                        struct v4l2_buffer *buf)
-{
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
-       return v4l2_m2m_qbuf(file, ctx->m2m_ctx, buf);
-}
-
-static int fimc_m2m_dqbuf(struct file *file, void *fh,
-                         struct v4l2_buffer *buf)
-{
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
-       return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf);
-}
-
-static int fimc_m2m_expbuf(struct file *file, void *fh,
-                           struct v4l2_exportbuffer *eb)
-{
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
-       return v4l2_m2m_expbuf(file, ctx->m2m_ctx, eb);
-}
-
-
-static int fimc_m2m_streamon(struct file *file, void *fh,
-                            enum v4l2_buf_type type)
-{
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
-       return v4l2_m2m_streamon(file, ctx->m2m_ctx, type);
-}
-
-static int fimc_m2m_streamoff(struct file *file, void *fh,
-                           enum v4l2_buf_type type)
-{
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
-       return v4l2_m2m_streamoff(file, ctx->m2m_ctx, type);
-}
-
 static int fimc_m2m_cropcap(struct file *file, void *fh,
                            struct v4l2_cropcap *cr)
 {
@@ -598,13 +532,13 @@ static const struct v4l2_ioctl_ops fimc_m2m_ioctl_ops = {
        .vidioc_try_fmt_vid_out_mplane  = fimc_m2m_try_fmt_mplane,
        .vidioc_s_fmt_vid_cap_mplane    = fimc_m2m_s_fmt_mplane,
        .vidioc_s_fmt_vid_out_mplane    = fimc_m2m_s_fmt_mplane,
-       .vidioc_reqbufs                 = fimc_m2m_reqbufs,
-       .vidioc_querybuf                = fimc_m2m_querybuf,
-       .vidioc_qbuf                    = fimc_m2m_qbuf,
-       .vidioc_dqbuf                   = fimc_m2m_dqbuf,
-       .vidioc_expbuf                  = fimc_m2m_expbuf,
-       .vidioc_streamon                = fimc_m2m_streamon,
-       .vidioc_streamoff               = fimc_m2m_streamoff,
+       .vidioc_reqbufs                 = v4l2_m2m_ioctl_reqbufs,
+       .vidioc_querybuf                = v4l2_m2m_ioctl_querybuf,
+       .vidioc_qbuf                    = v4l2_m2m_ioctl_qbuf,
+       .vidioc_dqbuf                   = v4l2_m2m_ioctl_dqbuf,
+       .vidioc_expbuf                  = v4l2_m2m_ioctl_expbuf,
+       .vidioc_streamon                = v4l2_m2m_ioctl_streamon,
+       .vidioc_streamoff               = v4l2_m2m_ioctl_streamoff,
        .vidioc_g_crop                  = fimc_m2m_g_crop,
        .vidioc_s_crop                  = fimc_m2m_s_crop,
        .vidioc_cropcap                 = fimc_m2m_cropcap
@@ -624,6 +558,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
        src_vq->mem_ops = &vb2_dma_contig_memops;
        src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
        src_vq->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+       src_vq->lock = &ctx->fimc_dev->lock;
 
        ret = vb2_queue_init(src_vq);
        if (ret)
@@ -636,6 +571,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
        dst_vq->mem_ops = &vb2_dma_contig_memops;
        dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
        dst_vq->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+       dst_vq->lock = &ctx->fimc_dev->lock;
 
        return vb2_queue_init(dst_vq);
 }
@@ -708,9 +644,9 @@ static int fimc_m2m_open(struct file *file)
        ctx->out_path = FIMC_IO_DMA;
        ctx->scaler.enabled = 1;
 
-       ctx->m2m_ctx = v4l2_m2m_ctx_init(fimc->m2m.m2m_dev, ctx, queue_init);
-       if (IS_ERR(ctx->m2m_ctx)) {
-               ret = PTR_ERR(ctx->m2m_ctx);
+       ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(fimc->m2m.m2m_dev, ctx, queue_init);
+       if (IS_ERR(ctx->fh.m2m_ctx)) {
+               ret = PTR_ERR(ctx->fh.m2m_ctx);
                goto error_c;
        }
 
@@ -725,7 +661,7 @@ static int fimc_m2m_open(struct file *file)
        return 0;
 
 error_m2m_ctx:
-       v4l2_m2m_ctx_release(ctx->m2m_ctx);
+       v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
 error_c:
        fimc_ctrls_delete(ctx);
 error_fh:
@@ -747,7 +683,7 @@ static int fimc_m2m_release(struct file *file)
 
        mutex_lock(&fimc->lock);
 
-       v4l2_m2m_ctx_release(ctx->m2m_ctx);
+       v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
        fimc_ctrls_delete(ctx);
        v4l2_fh_del(&ctx->fh);
        v4l2_fh_exit(&ctx->fh);
@@ -760,45 +696,13 @@ static int fimc_m2m_release(struct file *file)
        return 0;
 }
 
-static unsigned int fimc_m2m_poll(struct file *file,
-                                 struct poll_table_struct *wait)
-{
-       struct fimc_ctx *ctx = fh_to_ctx(file->private_data);
-       struct fimc_dev *fimc = ctx->fimc_dev;
-       int ret;
-
-       if (mutex_lock_interruptible(&fimc->lock))
-               return -ERESTARTSYS;
-
-       ret = v4l2_m2m_poll(file, ctx->m2m_ctx, wait);
-       mutex_unlock(&fimc->lock);
-
-       return ret;
-}
-
-
-static int fimc_m2m_mmap(struct file *file, struct vm_area_struct *vma)
-{
-       struct fimc_ctx *ctx = fh_to_ctx(file->private_data);
-       struct fimc_dev *fimc = ctx->fimc_dev;
-       int ret;
-
-       if (mutex_lock_interruptible(&fimc->lock))
-               return -ERESTARTSYS;
-
-       ret = v4l2_m2m_mmap(file, ctx->m2m_ctx, vma);
-       mutex_unlock(&fimc->lock);
-
-       return ret;
-}
-
 static const struct v4l2_file_operations fimc_m2m_fops = {
        .owner          = THIS_MODULE,
        .open           = fimc_m2m_open,
        .release        = fimc_m2m_release,
-       .poll           = fimc_m2m_poll,
+       .poll           = v4l2_m2m_fop_poll,
        .unlocked_ioctl = video_ioctl2,
-       .mmap           = fimc_m2m_mmap,
+       .mmap           = v4l2_m2m_fop_mmap,
 };
 
 static struct v4l2_m2m_ops m2m_ops = {
index 7a4ee4c0449deea95dc86e82a85af8412a1d5aad..c1bce170df6fbce44d519a498bf6d19694389306 100644 (file)
@@ -759,7 +759,7 @@ static int fimc_md_register_platform_entity(struct fimc_md *fmd,
                goto dev_unlock;
 
        drvdata = dev_get_drvdata(dev);
-       /* Some subdev didn't probe succesfully id drvdata is NULL */
+       /* Some subdev didn't probe successfully id drvdata is NULL */
        if (drvdata) {
                switch (plat_entity) {
                case IDX_FIMC:
index 9fc2af6a04466b402c6f931097e28dbdec2ad29c..31dfc501524797b943cb8d750a7fcd05b39d5d5c 100644 (file)
@@ -91,7 +91,7 @@ MODULE_PARM_DESC(debug, "Debug level (0-2)");
 #define S5PCSIS_INTSRC_ODD_BEFORE      (1 << 29)
 #define S5PCSIS_INTSRC_ODD_AFTER       (1 << 28)
 #define S5PCSIS_INTSRC_ODD             (0x3 << 28)
-#define S5PCSIS_INTSRC_NON_IMAGE_DATA  (0xff << 28)
+#define S5PCSIS_INTSRC_NON_IMAGE_DATA  (0xf << 28)
 #define S5PCSIS_INTSRC_FRAME_START     (1 << 27)
 #define S5PCSIS_INTSRC_FRAME_END       (1 << 26)
 #define S5PCSIS_INTSRC_ERR_SOT_HS      (0xf << 12)
index 6a232239ee8c71f8c04d3c42c002af2c789fd9a8..dbf0ce38a8e7db1566d5ddde361f51d570fca03d 100644 (file)
@@ -1580,7 +1580,7 @@ static int viu_of_probe(struct platform_device *op)
        }
 
        /* enable VIU clock */
-       clk = devm_clk_get(&op->dev, "viu_clk");
+       clk = devm_clk_get(&op->dev, "ipg");
        if (IS_ERR(clk)) {
                dev_err(&op->dev, "failed to lookup the clock!\n");
                ret = PTR_ERR(clk);
index 3458fa0e2fd537916270fd9fbb0908d2b1610821..60589c2b1c66e11cc11c1c0f5d873c01bcf9c079 100644 (file)
@@ -142,12 +142,6 @@ static int mmpcam_power_up(struct mcam_camera *mcam)
        struct mmp_camera *cam = mcam_to_cam(mcam);
        struct mmp_camera_platform_data *pdata;
 
-       if (mcam->bus_type == V4L2_MBUS_CSI2) {
-               cam->mipi_clk = devm_clk_get(mcam->dev, "mipi");
-               if ((IS_ERR(cam->mipi_clk) && mcam->dphy[2] == 0))
-                       return PTR_ERR(cam->mipi_clk);
-       }
-
 /*
  * Turn on power and clocks to the controller.
  */
@@ -186,12 +180,6 @@ static void mmpcam_power_down(struct mcam_camera *mcam)
        gpio_set_value(pdata->sensor_power_gpio, 0);
        gpio_set_value(pdata->sensor_reset_gpio, 0);
 
-       if (mcam->bus_type == V4L2_MBUS_CSI2 && !IS_ERR(cam->mipi_clk)) {
-               if (cam->mipi_clk)
-                       devm_clk_put(mcam->dev, cam->mipi_clk);
-               cam->mipi_clk = NULL;
-       }
-
        mcam_clk_disable(mcam);
 }
 
@@ -292,8 +280,9 @@ void mmpcam_calc_dphy(struct mcam_camera *mcam)
                return;
 
        /* get the escape clk, this is hard coded */
+       clk_prepare_enable(cam->mipi_clk);
        tx_clk_esc = (clk_get_rate(cam->mipi_clk) / 1000000) / 12;
-
+       clk_disable_unprepare(cam->mipi_clk);
        /*
         * dphy[2] - CSI2_DPHY6:
         * bit 0 ~ bit 7: CK Term Enable
@@ -325,19 +314,6 @@ static irqreturn_t mmpcam_irq(int irq, void *data)
        return IRQ_RETVAL(handled);
 }
 
-static void mcam_deinit_clk(struct mcam_camera *mcam)
-{
-       unsigned int i;
-
-       for (i = 0; i < NR_MCAM_CLK; i++) {
-               if (!IS_ERR(mcam->clk[i])) {
-                       if (mcam->clk[i])
-                               devm_clk_put(mcam->dev, mcam->clk[i]);
-               }
-               mcam->clk[i] = NULL;
-       }
-}
-
 static void mcam_init_clk(struct mcam_camera *mcam)
 {
        unsigned int i;
@@ -371,7 +347,6 @@ static int mmpcam_probe(struct platform_device *pdev)
        if (cam == NULL)
                return -ENOMEM;
        cam->pdev = pdev;
-       cam->mipi_clk = NULL;
        INIT_LIST_HEAD(&cam->devlist);
 
        mcam = &cam->mcam;
@@ -387,6 +362,11 @@ static int mmpcam_probe(struct platform_device *pdev)
        mcam->mclk_div = pdata->mclk_div;
        mcam->bus_type = pdata->bus_type;
        mcam->dphy = pdata->dphy;
+       if (mcam->bus_type == V4L2_MBUS_CSI2) {
+               cam->mipi_clk = devm_clk_get(mcam->dev, "mipi");
+               if ((IS_ERR(cam->mipi_clk) && mcam->dphy[2] == 0))
+                       return PTR_ERR(cam->mipi_clk);
+       }
        mcam->mipi_enabled = false;
        mcam->lane = pdata->lane;
        mcam->chip_id = MCAM_ARMADA610;
@@ -444,7 +424,7 @@ static int mmpcam_probe(struct platform_device *pdev)
         */
        ret = mmpcam_power_up(mcam);
        if (ret)
-               goto out_deinit_clk;
+               return ret;
        ret = mccic_register(mcam);
        if (ret)
                goto out_power_down;
@@ -469,8 +449,6 @@ out_unregister:
        mccic_shutdown(mcam);
 out_power_down:
        mmpcam_power_down(mcam);
-out_deinit_clk:
-       mcam_deinit_clk(mcam);
        return ret;
 }
 
@@ -478,18 +456,11 @@ out_deinit_clk:
 static int mmpcam_remove(struct mmp_camera *cam)
 {
        struct mcam_camera *mcam = &cam->mcam;
-       struct mmp_camera_platform_data *pdata;
 
        mmpcam_remove_device(cam);
        mccic_shutdown(mcam);
        mmpcam_power_down(mcam);
-       pdata = cam->pdev->dev.platform_data;
-       gpio_free(pdata->sensor_reset_gpio);
-       gpio_free(pdata->sensor_power_gpio);
        mcam_deinit_clk(mcam);
-       iounmap(cam->power_regs);
-       iounmap(mcam->regs);
-       kfree(cam);
        return 0;
 }
 
index 8df5975b700a01c8f433fb902e1d10e2983de5aa..08e24379b7949af3a71f67123dd8749ce831c7aa 100644 (file)
@@ -177,8 +177,6 @@ struct m2mtest_ctx {
 
        enum v4l2_colorspace    colorspace;
 
-       struct v4l2_m2m_ctx     *m2m_ctx;
-
        /* Source and destination queue data */
        struct m2mtest_q_data   q_data[2];
 };
@@ -342,8 +340,8 @@ static int job_ready(void *priv)
 {
        struct m2mtest_ctx *ctx = priv;
 
-       if (v4l2_m2m_num_src_bufs_ready(ctx->m2m_ctx) < ctx->translen
-           || v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx) < ctx->translen) {
+       if (v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx) < ctx->translen
+           || v4l2_m2m_num_dst_bufs_ready(ctx->fh.m2m_ctx) < ctx->translen) {
                dprintk(ctx->dev, "Not enough buffers available\n");
                return 0;
        }
@@ -359,21 +357,6 @@ static void job_abort(void *priv)
        ctx->aborting = 1;
 }
 
-static void m2mtest_lock(void *priv)
-{
-       struct m2mtest_ctx *ctx = priv;
-       struct m2mtest_dev *dev = ctx->dev;
-       mutex_lock(&dev->dev_mutex);
-}
-
-static void m2mtest_unlock(void *priv)
-{
-       struct m2mtest_ctx *ctx = priv;
-       struct m2mtest_dev *dev = ctx->dev;
-       mutex_unlock(&dev->dev_mutex);
-}
-
-
 /* device_run() - prepares and starts the device
  *
  * This simulates all the immediate preparations required before starting
@@ -386,8 +369,8 @@ static void device_run(void *priv)
        struct m2mtest_dev *dev = ctx->dev;
        struct vb2_buffer *src_buf, *dst_buf;
 
-       src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
-       dst_buf = v4l2_m2m_next_dst_buf(ctx->m2m_ctx);
+       src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
+       dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
 
        device_process(ctx, src_buf, dst_buf);
 
@@ -409,8 +392,8 @@ static void device_isr(unsigned long priv)
                return;
        }
 
-       src_vb = v4l2_m2m_src_buf_remove(curr_ctx->m2m_ctx);
-       dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->m2m_ctx);
+       src_vb = v4l2_m2m_src_buf_remove(curr_ctx->fh.m2m_ctx);
+       dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->fh.m2m_ctx);
 
        curr_ctx->num_processed++;
 
@@ -423,7 +406,7 @@ static void device_isr(unsigned long priv)
            || curr_ctx->aborting) {
                dprintk(curr_ctx->dev, "Finishing transaction\n");
                curr_ctx->num_processed = 0;
-               v4l2_m2m_job_finish(m2mtest_dev->m2m_dev, curr_ctx->m2m_ctx);
+               v4l2_m2m_job_finish(m2mtest_dev->m2m_dev, curr_ctx->fh.m2m_ctx);
        } else {
                device_run(curr_ctx);
        }
@@ -491,7 +474,7 @@ static int vidioc_g_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f)
        struct vb2_queue *vq;
        struct m2mtest_q_data *q_data;
 
-       vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
+       vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type);
        if (!vq)
                return -EINVAL;
 
@@ -594,7 +577,7 @@ static int vidioc_s_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f)
        struct m2mtest_q_data *q_data;
        struct vb2_queue *vq;
 
-       vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
+       vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type);
        if (!vq)
                return -EINVAL;
 
@@ -648,52 +631,6 @@ static int vidioc_s_fmt_vid_out(struct file *file, void *priv,
        return ret;
 }
 
-static int vidioc_reqbufs(struct file *file, void *priv,
-                         struct v4l2_requestbuffers *reqbufs)
-{
-       struct m2mtest_ctx *ctx = file2ctx(file);
-
-       return v4l2_m2m_reqbufs(file, ctx->m2m_ctx, reqbufs);
-}
-
-static int vidioc_querybuf(struct file *file, void *priv,
-                          struct v4l2_buffer *buf)
-{
-       struct m2mtest_ctx *ctx = file2ctx(file);
-
-       return v4l2_m2m_querybuf(file, ctx->m2m_ctx, buf);
-}
-
-static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-       struct m2mtest_ctx *ctx = file2ctx(file);
-
-       return v4l2_m2m_qbuf(file, ctx->m2m_ctx, buf);
-}
-
-static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-       struct m2mtest_ctx *ctx = file2ctx(file);
-
-       return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf);
-}
-
-static int vidioc_streamon(struct file *file, void *priv,
-                          enum v4l2_buf_type type)
-{
-       struct m2mtest_ctx *ctx = file2ctx(file);
-
-       return v4l2_m2m_streamon(file, ctx->m2m_ctx, type);
-}
-
-static int vidioc_streamoff(struct file *file, void *priv,
-                           enum v4l2_buf_type type)
-{
-       struct m2mtest_ctx *ctx = file2ctx(file);
-
-       return v4l2_m2m_streamoff(file, ctx->m2m_ctx, type);
-}
-
 static int m2mtest_s_ctrl(struct v4l2_ctrl *ctrl)
 {
        struct m2mtest_ctx *ctx =
@@ -748,14 +685,14 @@ static const struct v4l2_ioctl_ops m2mtest_ioctl_ops = {
        .vidioc_try_fmt_vid_out = vidioc_try_fmt_vid_out,
        .vidioc_s_fmt_vid_out   = vidioc_s_fmt_vid_out,
 
-       .vidioc_reqbufs         = vidioc_reqbufs,
-       .vidioc_querybuf        = vidioc_querybuf,
+       .vidioc_reqbufs         = v4l2_m2m_ioctl_reqbufs,
+       .vidioc_querybuf        = v4l2_m2m_ioctl_querybuf,
+       .vidioc_qbuf            = v4l2_m2m_ioctl_qbuf,
+       .vidioc_dqbuf           = v4l2_m2m_ioctl_dqbuf,
 
-       .vidioc_qbuf            = vidioc_qbuf,
-       .vidioc_dqbuf           = vidioc_dqbuf,
+       .vidioc_streamon        = v4l2_m2m_ioctl_streamon,
+       .vidioc_streamoff       = v4l2_m2m_ioctl_streamoff,
 
-       .vidioc_streamon        = vidioc_streamon,
-       .vidioc_streamoff       = vidioc_streamoff,
        .vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
        .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
 };
@@ -818,27 +755,15 @@ static int m2mtest_buf_prepare(struct vb2_buffer *vb)
 static void m2mtest_buf_queue(struct vb2_buffer *vb)
 {
        struct m2mtest_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
-       v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
-}
-
-static void m2mtest_wait_prepare(struct vb2_queue *q)
-{
-       struct m2mtest_ctx *ctx = vb2_get_drv_priv(q);
-       m2mtest_unlock(ctx);
-}
-
-static void m2mtest_wait_finish(struct vb2_queue *q)
-{
-       struct m2mtest_ctx *ctx = vb2_get_drv_priv(q);
-       m2mtest_lock(ctx);
+       v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
 }
 
 static struct vb2_ops m2mtest_qops = {
        .queue_setup     = m2mtest_queue_setup,
        .buf_prepare     = m2mtest_buf_prepare,
        .buf_queue       = m2mtest_buf_queue,
-       .wait_prepare    = m2mtest_wait_prepare,
-       .wait_finish     = m2mtest_wait_finish,
+       .wait_prepare    = vb2_ops_wait_prepare,
+       .wait_finish     = vb2_ops_wait_finish,
 };
 
 static int queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)
@@ -853,6 +778,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *ds
        src_vq->ops = &m2mtest_qops;
        src_vq->mem_ops = &vb2_vmalloc_memops;
        src_vq->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+       src_vq->lock = &ctx->dev->dev_mutex;
 
        ret = vb2_queue_init(src_vq);
        if (ret)
@@ -865,6 +791,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *ds
        dst_vq->ops = &m2mtest_qops;
        dst_vq->mem_ops = &vb2_vmalloc_memops;
        dst_vq->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+       dst_vq->lock = &ctx->dev->dev_mutex;
 
        return vb2_queue_init(dst_vq);
 }
@@ -936,10 +863,10 @@ static int m2mtest_open(struct file *file)
        ctx->q_data[V4L2_M2M_DST] = ctx->q_data[V4L2_M2M_SRC];
        ctx->colorspace = V4L2_COLORSPACE_REC709;
 
-       ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &queue_init);
+       ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &queue_init);
 
-       if (IS_ERR(ctx->m2m_ctx)) {
-               rc = PTR_ERR(ctx->m2m_ctx);
+       if (IS_ERR(ctx->fh.m2m_ctx)) {
+               rc = PTR_ERR(ctx->fh.m2m_ctx);
 
                v4l2_ctrl_handler_free(hdl);
                kfree(ctx);
@@ -949,7 +876,8 @@ static int m2mtest_open(struct file *file)
        v4l2_fh_add(&ctx->fh);
        atomic_inc(&dev->num_inst);
 
-       dprintk(dev, "Created instance %p, m2m_ctx: %p\n", ctx, ctx->m2m_ctx);
+       dprintk(dev, "Created instance: %p, m2m_ctx: %p\n",
+               ctx, ctx->fh.m2m_ctx);
 
 open_unlock:
        mutex_unlock(&dev->dev_mutex);
@@ -967,7 +895,7 @@ static int m2mtest_release(struct file *file)
        v4l2_fh_exit(&ctx->fh);
        v4l2_ctrl_handler_free(&ctx->hdl);
        mutex_lock(&dev->dev_mutex);
-       v4l2_m2m_ctx_release(ctx->m2m_ctx);
+       v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
        mutex_unlock(&dev->dev_mutex);
        kfree(ctx);
 
@@ -976,34 +904,13 @@ static int m2mtest_release(struct file *file)
        return 0;
 }
 
-static unsigned int m2mtest_poll(struct file *file,
-                                struct poll_table_struct *wait)
-{
-       struct m2mtest_ctx *ctx = file2ctx(file);
-
-       return v4l2_m2m_poll(file, ctx->m2m_ctx, wait);
-}
-
-static int m2mtest_mmap(struct file *file, struct vm_area_struct *vma)
-{
-       struct m2mtest_dev *dev = video_drvdata(file);
-       struct m2mtest_ctx *ctx = file2ctx(file);
-       int res;
-
-       if (mutex_lock_interruptible(&dev->dev_mutex))
-               return -ERESTARTSYS;
-       res = v4l2_m2m_mmap(file, ctx->m2m_ctx, vma);
-       mutex_unlock(&dev->dev_mutex);
-       return res;
-}
-
 static const struct v4l2_file_operations m2mtest_fops = {
        .owner          = THIS_MODULE,
        .open           = m2mtest_open,
        .release        = m2mtest_release,
-       .poll           = m2mtest_poll,
+       .poll           = v4l2_m2m_fop_poll,
        .unlocked_ioctl = video_ioctl2,
-       .mmap           = m2mtest_mmap,
+       .mmap           = v4l2_m2m_fop_mmap,
 };
 
 static struct video_device m2mtest_videodev = {
@@ -1019,8 +926,6 @@ static struct v4l2_m2m_ops m2m_ops = {
        .device_run     = device_run,
        .job_ready      = job_ready,
        .job_abort      = job_abort,
-       .lock           = m2mtest_lock,
-       .unlock         = m2mtest_unlock,
 };
 
 static int m2mtest_probe(struct platform_device *pdev)
@@ -1133,4 +1038,3 @@ static int __init m2mtest_init(void)
 
 module_init(m2mtest_init);
 module_exit(m2mtest_exit);
-
index 1c3608039663e281d23541f17aedcbce044c87fb..561bce8ffb1b57c87dd1b45bbae6cbf7c2b479c1 100644 (file)
@@ -1673,7 +1673,7 @@ void omap3isp_print_status(struct isp_device *isp)
  * ISP clocks get disabled in suspend(). Similarly, the clocks are reenabled in
  * resume(), and the the pipelines are restarted in complete().
  *
- * TODO: PM dependencies between the ISP and sensors are not modeled explicitly
+ * TODO: PM dependencies between the ISP and sensors are not modelled explicitly
  * yet.
  */
 static int isp_pm_prepare(struct device *dev)
index 907a205da5a55d977fe39e40c7b612315578e996..561c991529e6f723510baf9744bfc34d94822e52 100644 (file)
@@ -2484,7 +2484,8 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc)
        v4l2_set_subdevdata(sd, ccdc);
        sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE;
 
-       pads[CCDC_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
+       pads[CCDC_PAD_SINK].flags = MEDIA_PAD_FL_SINK
+                                   | MEDIA_PAD_FL_MUST_CONNECT;
        pads[CCDC_PAD_SOURCE_VP].flags = MEDIA_PAD_FL_SOURCE;
        pads[CCDC_PAD_SOURCE_OF].flags = MEDIA_PAD_FL_SOURCE;
 
index e71651429ddad36523943d4f61c0ca89caaa5bb9..e84fe0543e4719424c3224895ed7b5a218ea8904 100644 (file)
@@ -1076,7 +1076,8 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2)
        v4l2_set_subdevdata(sd, ccp2);
        sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
-       pads[CCP2_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
+       pads[CCP2_PAD_SINK].flags = MEDIA_PAD_FL_SINK
+                                   | MEDIA_PAD_FL_MUST_CONNECT;
        pads[CCP2_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
 
        me->ops = &ccp2_media_ops;
index 6db245d84bbbe5f8e27bc9fb1555e2bdf0f20d0d..620560828a48cc9d395bfba0ddbb2c7f017ed84b 100644 (file)
@@ -1245,7 +1245,8 @@ static int csi2_init_entities(struct isp_csi2_device *csi2)
        sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
        pads[CSI2_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
-       pads[CSI2_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
+       pads[CSI2_PAD_SINK].flags = MEDIA_PAD_FL_SINK
+                                   | MEDIA_PAD_FL_MUST_CONNECT;
 
        me->ops = &csi2_media_ops;
        ret = media_entity_init(me, CSI2_PADS_NUM, pads, 0);
index cd8831aebdebdfe80d74bf599dcef02f3db7bbaa..1c776c1186f1b9ff4a4ddbb79b6cb48c88e196f4 100644 (file)
@@ -2283,7 +2283,8 @@ static int preview_init_entities(struct isp_prev_device *prev)
        v4l2_ctrl_handler_setup(&prev->ctrls);
        sd->ctrl_handler = &prev->ctrls;
 
-       pads[PREV_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
+       pads[PREV_PAD_SINK].flags = MEDIA_PAD_FL_SINK
+                                   | MEDIA_PAD_FL_MUST_CONNECT;
        pads[PREV_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
 
        me->ops = &preview_media_ops;
index d11fb261d53070a131b4a3fbbd6cd2195bb3f574..0d36b8bc9f9806b1360d0a7482f2fe446fc70e4e 100644 (file)
@@ -1532,6 +1532,20 @@ static int resizer_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
        return 0;
 }
 
+static int resizer_link_validate(struct v4l2_subdev *sd,
+                                struct media_link *link,
+                                struct v4l2_subdev_format *source_fmt,
+                                struct v4l2_subdev_format *sink_fmt)
+{
+       struct isp_res_device *res = v4l2_get_subdevdata(sd);
+       struct isp_pipeline *pipe = to_isp_pipeline(&sd->entity);
+
+       omap3isp_resizer_max_rate(res, &pipe->max_rate);
+
+       return v4l2_subdev_link_validate_default(sd, link,
+                                                source_fmt, sink_fmt);
+}
+
 /*
  * resizer_init_formats - Initialize formats on all pads
  * @sd: ISP resizer V4L2 subdevice
@@ -1570,6 +1584,7 @@ static const struct v4l2_subdev_pad_ops resizer_v4l2_pad_ops = {
        .set_fmt = resizer_set_format,
        .get_selection = resizer_get_selection,
        .set_selection = resizer_set_selection,
+       .link_validate = resizer_link_validate,
 };
 
 /* subdev operations */
@@ -1701,7 +1716,8 @@ static int resizer_init_entities(struct isp_res_device *res)
        v4l2_set_subdevdata(sd, res);
        sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
-       pads[RESZ_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
+       pads[RESZ_PAD_SINK].flags = MEDIA_PAD_FL_SINK
+                                   | MEDIA_PAD_FL_MUST_CONNECT;
        pads[RESZ_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
 
        me->ops = &resizer_media_ops;
index 61e17f9bd8b92148457a45e973aefdb0487dbcec..a75407c3a726217981d40193b89919332a7919bf 100644 (file)
@@ -1067,7 +1067,7 @@ static int isp_stat_init_entities(struct ispstat *stat, const char *name,
        subdev->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE;
        v4l2_set_subdevdata(subdev, stat);
 
-       stat->pad.flags = MEDIA_PAD_FL_SINK;
+       stat->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT;
        me->ops = NULL;
 
        return media_entity_init(me, 1, &stat->pad, 0);
index a908d006f5277c2abe9adebcbb757ea699495fbf..3953aec7c5c5954efbf6a3aedddc110bd6105a13 100644 (file)
@@ -278,55 +278,6 @@ static int isp_video_get_graph_data(struct isp_video *video,
        return 0;
 }
 
-/*
- * Validate a pipeline by checking both ends of all links for format
- * discrepancies.
- *
- * Compute the minimum time per frame value as the maximum of time per frame
- * limits reported by every block in the pipeline.
- *
- * Return 0 if all formats match, or -EPIPE if at least one link is found with
- * different formats on its two ends or if the pipeline doesn't start with a
- * video source (either a subdev with no input pad, or a non-subdev entity).
- */
-static int isp_video_validate_pipeline(struct isp_pipeline *pipe)
-{
-       struct isp_device *isp = pipe->output->isp;
-       struct media_pad *pad;
-       struct v4l2_subdev *subdev;
-
-       subdev = isp_video_remote_subdev(pipe->output, NULL);
-       if (subdev == NULL)
-               return -EPIPE;
-
-       while (1) {
-               /* Retrieve the sink format */
-               pad = &subdev->entity.pads[0];
-               if (!(pad->flags & MEDIA_PAD_FL_SINK))
-                       break;
-
-               /* Update the maximum frame rate */
-               if (subdev == &isp->isp_res.subdev)
-                       omap3isp_resizer_max_rate(&isp->isp_res,
-                                                 &pipe->max_rate);
-
-               /* Retrieve the source format. Return an error if no source
-                * entity can be found, and stop checking the pipeline if the
-                * source entity isn't a subdev.
-                */
-               pad = media_entity_remote_pad(pad);
-               if (pad == NULL)
-                       return -EPIPE;
-
-               if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
-                       break;
-
-               subdev = media_entity_to_v4l2_subdev(pad->entity);
-       }
-
-       return 0;
-}
-
 static int
 __isp_video_get_format(struct isp_video *video, struct v4l2_format *format)
 {
@@ -339,14 +290,11 @@ __isp_video_get_format(struct isp_video *video, struct v4l2_format *format)
        if (subdev == NULL)
                return -EINVAL;
 
-       mutex_lock(&video->mutex);
-
        fmt.pad = pad;
        fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
-       ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
-       if (ret == -ENOIOCTLCMD)
-               ret = -EINVAL;
 
+       mutex_lock(&video->mutex);
+       ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
        mutex_unlock(&video->mutex);
 
        if (ret)
@@ -1054,11 +1002,6 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
        if (ret < 0)
                goto err_check_format;
 
-       /* Validate the pipeline and update its state. */
-       ret = isp_video_validate_pipeline(pipe);
-       if (ret < 0)
-               goto err_check_format;
-
        pipe->error = false;
 
        spin_lock_irqsave(&pipe->lock, flags);
@@ -1335,11 +1278,13 @@ int omap3isp_video_init(struct isp_video *video, const char *name)
        switch (video->type) {
        case V4L2_BUF_TYPE_VIDEO_CAPTURE:
                direction = "output";
-               video->pad.flags = MEDIA_PAD_FL_SINK;
+               video->pad.flags = MEDIA_PAD_FL_SINK
+                                  | MEDIA_PAD_FL_MUST_CONNECT;
                break;
        case V4L2_BUF_TYPE_VIDEO_OUTPUT:
                direction = "input";
-               video->pad.flags = MEDIA_PAD_FL_SOURCE;
+               video->pad.flags = MEDIA_PAD_FL_SOURCE
+                                  | MEDIA_PAD_FL_MUST_CONNECT;
                video->video.vfl_dir = VFL_DIR_TX;
                break;
 
index 0b2948376aee9d3715c67d97346d6e775d48ab48..0fcf7d75e841b550d24df8faa9d247ce846d2044 100644 (file)
@@ -136,10 +136,9 @@ static int g2d_buf_prepare(struct vb2_buffer *vb)
 static void g2d_buf_queue(struct vb2_buffer *vb)
 {
        struct g2d_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
-       v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
+       v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
 }
 
-
 static struct vb2_ops g2d_qops = {
        .queue_setup    = g2d_queue_setup,
        .buf_prepare    = g2d_buf_prepare,
@@ -159,6 +158,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
        src_vq->mem_ops = &vb2_dma_contig_memops;
        src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
        src_vq->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+       src_vq->lock = &ctx->dev->mutex;
 
        ret = vb2_queue_init(src_vq);
        if (ret)
@@ -171,6 +171,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
        dst_vq->mem_ops = &vb2_dma_contig_memops;
        dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
        dst_vq->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+       dst_vq->lock = &ctx->dev->mutex;
 
        return vb2_queue_init(dst_vq);
 }
@@ -253,9 +254,9 @@ static int g2d_open(struct file *file)
                kfree(ctx);
                return -ERESTARTSYS;
        }
-       ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &queue_init);
-       if (IS_ERR(ctx->m2m_ctx)) {
-               ret = PTR_ERR(ctx->m2m_ctx);
+       ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &queue_init);
+       if (IS_ERR(ctx->fh.m2m_ctx)) {
+               ret = PTR_ERR(ctx->fh.m2m_ctx);
                mutex_unlock(&dev->mutex);
                kfree(ctx);
                return ret;
@@ -324,7 +325,7 @@ static int vidioc_g_fmt(struct file *file, void *prv, struct v4l2_format *f)
        struct vb2_queue *vq;
        struct g2d_frame *frm;
 
-       vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
+       vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type);
        if (!vq)
                return -EINVAL;
        frm = get_frame(ctx, f->type);
@@ -384,7 +385,7 @@ static int vidioc_s_fmt(struct file *file, void *prv, struct v4l2_format *f)
        ret = vidioc_try_fmt(file, prv, f);
        if (ret)
                return ret;
-       vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
+       vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type);
        if (vb2_is_busy(vq)) {
                v4l2_err(&dev->v4l2_dev, "queue (%d) bust\n", f->type);
                return -EBUSY;
@@ -410,72 +411,6 @@ static int vidioc_s_fmt(struct file *file, void *prv, struct v4l2_format *f)
        return 0;
 }
 
-static unsigned int g2d_poll(struct file *file, struct poll_table_struct *wait)
-{
-       struct g2d_ctx *ctx = fh2ctx(file->private_data);
-       struct g2d_dev *dev = ctx->dev;
-       unsigned int res;
-
-       mutex_lock(&dev->mutex);
-       res = v4l2_m2m_poll(file, ctx->m2m_ctx, wait);
-       mutex_unlock(&dev->mutex);
-       return res;
-}
-
-static int g2d_mmap(struct file *file, struct vm_area_struct *vma)
-{
-       struct g2d_ctx *ctx = fh2ctx(file->private_data);
-       struct g2d_dev *dev = ctx->dev;
-       int ret;
-
-       if (mutex_lock_interruptible(&dev->mutex))
-               return -ERESTARTSYS;
-       ret = v4l2_m2m_mmap(file, ctx->m2m_ctx, vma);
-       mutex_unlock(&dev->mutex);
-       return ret;
-}
-
-static int vidioc_reqbufs(struct file *file, void *priv,
-                       struct v4l2_requestbuffers *reqbufs)
-{
-       struct g2d_ctx *ctx = priv;
-       return v4l2_m2m_reqbufs(file, ctx->m2m_ctx, reqbufs);
-}
-
-static int vidioc_querybuf(struct file *file, void *priv,
-                       struct v4l2_buffer *buf)
-{
-       struct g2d_ctx *ctx = priv;
-       return v4l2_m2m_querybuf(file, ctx->m2m_ctx, buf);
-}
-
-static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-       struct g2d_ctx *ctx = priv;
-       return v4l2_m2m_qbuf(file, ctx->m2m_ctx, buf);
-}
-
-static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-       struct g2d_ctx *ctx = priv;
-       return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf);
-}
-
-
-static int vidioc_streamon(struct file *file, void *priv,
-                                       enum v4l2_buf_type type)
-{
-       struct g2d_ctx *ctx = priv;
-       return v4l2_m2m_streamon(file, ctx->m2m_ctx, type);
-}
-
-static int vidioc_streamoff(struct file *file, void *priv,
-                                       enum v4l2_buf_type type)
-{
-       struct g2d_ctx *ctx = priv;
-       return v4l2_m2m_streamoff(file, ctx->m2m_ctx, type);
-}
-
 static int vidioc_cropcap(struct file *file, void *priv,
                                        struct v4l2_cropcap *cr)
 {
@@ -551,20 +486,6 @@ static int vidioc_s_crop(struct file *file, void *prv, const struct v4l2_crop *c
        return 0;
 }
 
-static void g2d_lock(void *prv)
-{
-       struct g2d_ctx *ctx = prv;
-       struct g2d_dev *dev = ctx->dev;
-       mutex_lock(&dev->mutex);
-}
-
-static void g2d_unlock(void *prv)
-{
-       struct g2d_ctx *ctx = prv;
-       struct g2d_dev *dev = ctx->dev;
-       mutex_unlock(&dev->mutex);
-}
-
 static void job_abort(void *prv)
 {
        struct g2d_ctx *ctx = prv;
@@ -589,8 +510,8 @@ static void device_run(void *prv)
 
        dev->curr = ctx;
 
-       src = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
-       dst = v4l2_m2m_next_dst_buf(ctx->m2m_ctx);
+       src = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
+       dst = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
 
        clk_enable(dev->gate);
        g2d_reset(dev);
@@ -631,8 +552,8 @@ static irqreturn_t g2d_isr(int irq, void *prv)
 
        BUG_ON(ctx == NULL);
 
-       src = v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
-       dst = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx);
+       src = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
+       dst = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
 
        BUG_ON(src == NULL);
        BUG_ON(dst == NULL);
@@ -642,7 +563,7 @@ static irqreturn_t g2d_isr(int irq, void *prv)
 
        v4l2_m2m_buf_done(src, VB2_BUF_STATE_DONE);
        v4l2_m2m_buf_done(dst, VB2_BUF_STATE_DONE);
-       v4l2_m2m_job_finish(dev->m2m_dev, ctx->m2m_ctx);
+       v4l2_m2m_job_finish(dev->m2m_dev, ctx->fh.m2m_ctx);
 
        dev->curr = NULL;
        wake_up(&dev->irq_queue);
@@ -653,9 +574,9 @@ static const struct v4l2_file_operations g2d_fops = {
        .owner          = THIS_MODULE,
        .open           = g2d_open,
        .release        = g2d_release,
-       .poll           = g2d_poll,
+       .poll           = v4l2_m2m_fop_poll,
        .unlocked_ioctl = video_ioctl2,
-       .mmap           = g2d_mmap,
+       .mmap           = v4l2_m2m_fop_mmap,
 };
 
 static const struct v4l2_ioctl_ops g2d_ioctl_ops = {
@@ -671,14 +592,13 @@ static const struct v4l2_ioctl_ops g2d_ioctl_ops = {
        .vidioc_try_fmt_vid_out         = vidioc_try_fmt,
        .vidioc_s_fmt_vid_out           = vidioc_s_fmt,
 
-       .vidioc_reqbufs                 = vidioc_reqbufs,
-       .vidioc_querybuf                = vidioc_querybuf,
-
-       .vidioc_qbuf                    = vidioc_qbuf,
-       .vidioc_dqbuf                   = vidioc_dqbuf,
+       .vidioc_reqbufs                 = v4l2_m2m_ioctl_reqbufs,
+       .vidioc_querybuf                = v4l2_m2m_ioctl_querybuf,
+       .vidioc_qbuf                    = v4l2_m2m_ioctl_qbuf,
+       .vidioc_dqbuf                   = v4l2_m2m_ioctl_dqbuf,
 
-       .vidioc_streamon                = vidioc_streamon,
-       .vidioc_streamoff               = vidioc_streamoff,
+       .vidioc_streamon                = v4l2_m2m_ioctl_streamon,
+       .vidioc_streamoff               = v4l2_m2m_ioctl_streamoff,
 
        .vidioc_g_crop                  = vidioc_g_crop,
        .vidioc_s_crop                  = vidioc_s_crop,
@@ -697,8 +617,6 @@ static struct video_device g2d_videodev = {
 static struct v4l2_m2m_ops g2d_m2m_ops = {
        .device_run     = device_run,
        .job_abort      = job_abort,
-       .lock           = g2d_lock,
-       .unlock         = g2d_unlock,
 };
 
 static const struct of_device_id exynos_g2d_match[];
index 300ca05ba40438f944f2651d2feccd58279eb1c1..b0e52ab7ecdb806b102a51497c2f29303fd5772e 100644 (file)
@@ -57,7 +57,6 @@ struct g2d_frame {
 struct g2d_ctx {
        struct v4l2_fh fh;
        struct g2d_dev          *dev;
-       struct v4l2_m2m_ctx     *m2m_ctx;
        struct g2d_frame        in;
        struct g2d_frame        out;
        struct v4l2_ctrl        *ctrl_hflip;
index 9b88a46010072fbe3b4aeefa46bbc8ee0f04ea7e..c818cbe6dd5d8f0ff688e866caf4603d87f70c0d 100644 (file)
@@ -316,9 +316,9 @@ static int s5p_jpeg_open(struct file *file)
        if (ret < 0)
                goto error;
 
-       ctx->m2m_ctx = v4l2_m2m_ctx_init(jpeg->m2m_dev, ctx, queue_init);
-       if (IS_ERR(ctx->m2m_ctx)) {
-               ret = PTR_ERR(ctx->m2m_ctx);
+       ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(jpeg->m2m_dev, ctx, queue_init);
+       if (IS_ERR(ctx->fh.m2m_ctx)) {
+               ret = PTR_ERR(ctx->fh.m2m_ctx);
                goto error;
        }
 
@@ -342,7 +342,7 @@ static int s5p_jpeg_release(struct file *file)
        struct s5p_jpeg_ctx *ctx = fh_to_ctx(file->private_data);
 
        mutex_lock(&jpeg->lock);
-       v4l2_m2m_ctx_release(ctx->m2m_ctx);
+       v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
        mutex_unlock(&jpeg->lock);
        v4l2_ctrl_handler_free(&ctx->ctrl_handler);
        v4l2_fh_del(&ctx->fh);
@@ -352,39 +352,13 @@ static int s5p_jpeg_release(struct file *file)
        return 0;
 }
 
-static unsigned int s5p_jpeg_poll(struct file *file,
-                                struct poll_table_struct *wait)
-{
-       struct s5p_jpeg *jpeg = video_drvdata(file);
-       struct s5p_jpeg_ctx *ctx = fh_to_ctx(file->private_data);
-       unsigned int res;
-
-       mutex_lock(&jpeg->lock);
-       res = v4l2_m2m_poll(file, ctx->m2m_ctx, wait);
-       mutex_unlock(&jpeg->lock);
-       return res;
-}
-
-static int s5p_jpeg_mmap(struct file *file, struct vm_area_struct *vma)
-{
-       struct s5p_jpeg *jpeg = video_drvdata(file);
-       struct s5p_jpeg_ctx *ctx = fh_to_ctx(file->private_data);
-       int ret;
-
-       if (mutex_lock_interruptible(&jpeg->lock))
-               return -ERESTARTSYS;
-       ret = v4l2_m2m_mmap(file, ctx->m2m_ctx, vma);
-       mutex_unlock(&jpeg->lock);
-       return ret;
-}
-
 static const struct v4l2_file_operations s5p_jpeg_fops = {
        .owner          = THIS_MODULE,
        .open           = s5p_jpeg_open,
        .release        = s5p_jpeg_release,
-       .poll           = s5p_jpeg_poll,
+       .poll           = v4l2_m2m_fop_poll,
        .unlocked_ioctl = video_ioctl2,
-       .mmap           = s5p_jpeg_mmap,
+       .mmap           = v4l2_m2m_fop_mmap,
 };
 
 /*
@@ -589,7 +563,7 @@ static int s5p_jpeg_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
        struct v4l2_pix_format *pix = &f->fmt.pix;
        struct s5p_jpeg_ctx *ct = fh_to_ctx(priv);
 
-       vq = v4l2_m2m_get_vq(ct->m2m_ctx, f->type);
+       vq = v4l2_m2m_get_vq(ct->fh.m2m_ctx, f->type);
        if (!vq)
                return -EINVAL;
 
@@ -745,7 +719,7 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, struct v4l2_format *f)
        struct s5p_jpeg_q_data *q_data = NULL;
        struct v4l2_pix_format *pix = &f->fmt.pix;
 
-       vq = v4l2_m2m_get_vq(ct->m2m_ctx, f->type);
+       vq = v4l2_m2m_get_vq(ct->fh.m2m_ctx, f->type);
        if (!vq)
                return -EINVAL;
 
@@ -792,53 +766,6 @@ static int s5p_jpeg_s_fmt_vid_out(struct file *file, void *priv,
        return s5p_jpeg_s_fmt(fh_to_ctx(priv), f);
 }
 
-static int s5p_jpeg_reqbufs(struct file *file, void *priv,
-                         struct v4l2_requestbuffers *reqbufs)
-{
-       struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
-
-       return v4l2_m2m_reqbufs(file, ctx->m2m_ctx, reqbufs);
-}
-
-static int s5p_jpeg_querybuf(struct file *file, void *priv,
-                          struct v4l2_buffer *buf)
-{
-       struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
-
-       return v4l2_m2m_querybuf(file, ctx->m2m_ctx, buf);
-}
-
-static int s5p_jpeg_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
-       struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
-
-       return v4l2_m2m_qbuf(file, ctx->m2m_ctx, buf);
-}
-
-static int s5p_jpeg_dqbuf(struct file *file, void *priv,
-                         struct v4l2_buffer *buf)
-{
-       struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
-
-       return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf);
-}
-
-static int s5p_jpeg_streamon(struct file *file, void *priv,
-                          enum v4l2_buf_type type)
-{
-       struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
-
-       return v4l2_m2m_streamon(file, ctx->m2m_ctx, type);
-}
-
-static int s5p_jpeg_streamoff(struct file *file, void *priv,
-                           enum v4l2_buf_type type)
-{
-       struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
-
-       return v4l2_m2m_streamoff(file, ctx->m2m_ctx, type);
-}
-
 static int s5p_jpeg_g_selection(struct file *file, void *priv,
                         struct v4l2_selection *s)
 {
@@ -972,14 +899,13 @@ static const struct v4l2_ioctl_ops s5p_jpeg_ioctl_ops = {
        .vidioc_s_fmt_vid_cap           = s5p_jpeg_s_fmt_vid_cap,
        .vidioc_s_fmt_vid_out           = s5p_jpeg_s_fmt_vid_out,
 
-       .vidioc_reqbufs                 = s5p_jpeg_reqbufs,
-       .vidioc_querybuf                = s5p_jpeg_querybuf,
+       .vidioc_reqbufs                 = v4l2_m2m_ioctl_reqbufs,
+       .vidioc_querybuf                = v4l2_m2m_ioctl_querybuf,
+       .vidioc_qbuf                    = v4l2_m2m_ioctl_qbuf,
+       .vidioc_dqbuf                   = v4l2_m2m_ioctl_dqbuf,
 
-       .vidioc_qbuf                    = s5p_jpeg_qbuf,
-       .vidioc_dqbuf                   = s5p_jpeg_dqbuf,
-
-       .vidioc_streamon                = s5p_jpeg_streamon,
-       .vidioc_streamoff               = s5p_jpeg_streamoff,
+       .vidioc_streamon                = v4l2_m2m_ioctl_streamon,
+       .vidioc_streamoff               = v4l2_m2m_ioctl_streamoff,
 
        .vidioc_g_selection             = s5p_jpeg_g_selection,
 };
@@ -997,8 +923,8 @@ static void s5p_jpeg_device_run(void *priv)
        struct vb2_buffer *src_buf, *dst_buf;
        unsigned long src_addr, dst_addr;
 
-       src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
-       dst_buf = v4l2_m2m_next_dst_buf(ctx->m2m_ctx);
+       src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
+       dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
        src_addr = vb2_dma_contig_plane_dma_addr(src_buf, 0);
        dst_addr = vb2_dma_contig_plane_dma_addr(dst_buf, 0);
 
@@ -1170,22 +1096,8 @@ static void s5p_jpeg_buf_queue(struct vb2_buffer *vb)
                                      );
                q_data->size = q_data->w * q_data->h * q_data->fmt->depth >> 3;
        }
-       if (ctx->m2m_ctx)
-               v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
-}
-
-static void s5p_jpeg_wait_prepare(struct vb2_queue *vq)
-{
-       struct s5p_jpeg_ctx *ctx = vb2_get_drv_priv(vq);
-
-       mutex_unlock(&ctx->jpeg->lock);
-}
-
-static void s5p_jpeg_wait_finish(struct vb2_queue *vq)
-{
-       struct s5p_jpeg_ctx *ctx = vb2_get_drv_priv(vq);
 
-       mutex_lock(&ctx->jpeg->lock);
+       v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
 }
 
 static int s5p_jpeg_start_streaming(struct vb2_queue *q, unsigned int count)
@@ -1211,8 +1123,8 @@ static struct vb2_ops s5p_jpeg_qops = {
        .queue_setup            = s5p_jpeg_queue_setup,
        .buf_prepare            = s5p_jpeg_buf_prepare,
        .buf_queue              = s5p_jpeg_buf_queue,
-       .wait_prepare           = s5p_jpeg_wait_prepare,
-       .wait_finish            = s5p_jpeg_wait_finish,
+       .wait_prepare           = vb2_ops_wait_prepare,
+       .wait_finish            = vb2_ops_wait_finish,
        .start_streaming        = s5p_jpeg_start_streaming,
        .stop_streaming         = s5p_jpeg_stop_streaming,
 };
@@ -1230,6 +1142,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
        src_vq->ops = &s5p_jpeg_qops;
        src_vq->mem_ops = &vb2_dma_contig_memops;
        src_vq->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+       src_vq->lock = &ctx->jpeg->lock;
 
        ret = vb2_queue_init(src_vq);
        if (ret)
@@ -1242,6 +1155,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
        dst_vq->ops = &s5p_jpeg_qops;
        dst_vq->mem_ops = &vb2_dma_contig_memops;
        dst_vq->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+       dst_vq->lock = &ctx->jpeg->lock;
 
        return vb2_queue_init(dst_vq);
 }
@@ -1267,8 +1181,8 @@ static irqreturn_t s5p_jpeg_irq(int irq, void *dev_id)
 
        curr_ctx = v4l2_m2m_get_curr_priv(jpeg->m2m_dev);
 
-       src_buf = v4l2_m2m_src_buf_remove(curr_ctx->m2m_ctx);
-       dst_buf = v4l2_m2m_dst_buf_remove(curr_ctx->m2m_ctx);
+       src_buf = v4l2_m2m_src_buf_remove(curr_ctx->fh.m2m_ctx);
+       dst_buf = v4l2_m2m_dst_buf_remove(curr_ctx->fh.m2m_ctx);
 
        if (curr_ctx->mode == S5P_JPEG_ENCODE)
                enc_jpeg_too_large = jpeg_enc_stream_stat(jpeg->regs);
@@ -1296,7 +1210,7 @@ static irqreturn_t s5p_jpeg_irq(int irq, void *dev_id)
        if (curr_ctx->mode == S5P_JPEG_ENCODE)
                vb2_set_plane_payload(dst_buf, 0, payload_size);
        v4l2_m2m_buf_done(dst_buf, state);
-       v4l2_m2m_job_finish(jpeg->m2m_dev, curr_ctx->m2m_ctx);
+       v4l2_m2m_job_finish(jpeg->m2m_dev, curr_ctx->fh.m2m_ctx);
 
        curr_ctx->subsampling = jpeg_get_subsampling_mode(jpeg->regs);
        spin_unlock(&jpeg->slock);
index 8a4013e3aee7717afb9275f36c92f83fde479b30..4a4776b7e1d42e3404b793245248d4f3cd9a1ace 100644 (file)
@@ -115,7 +115,6 @@ struct s5p_jpeg_q_data {
  * @jpeg:              JPEG IP device for this context
  * @mode:              compression (encode) operation or decompression (decode)
  * @compr_quality:     destination image quality in compression (encode) mode
- * @m2m_ctx:           mem2mem device context
  * @out_q:             source (output) queue information
  * @cap_fmt:           destination (capture) queue queue information
  * @hdr_parsed:                set if header has been parsed during decompression
@@ -127,7 +126,6 @@ struct s5p_jpeg_ctx {
        unsigned short          compr_quality;
        unsigned short          restart_interval;
        unsigned short          subsampling;
-       struct v4l2_m2m_ctx     *m2m_ctx;
        struct s5p_jpeg_q_data  out_q;
        struct s5p_jpeg_q_data  cap_q;
        struct v4l2_fh          fh;
index 9319e93599ae5731241b58535583bc1a04b77e73..6ccc3f8c122add705d7338d0656ac744331823fb 100644 (file)
 #define S5P_FIMV_R2H_CMD_EDFU_INIT_RET         16
 #define S5P_FIMV_R2H_CMD_ERR_RET               32
 
-/* Dummy definition for MFCv6 compatibilty */
+/* Dummy definition for MFCv6 compatibility */
 #define S5P_FIMV_CODEC_H264_MVC_DEC            -1
 #define S5P_FIMV_R2H_CMD_FIELD_DONE_RET                -1
 #define S5P_FIMV_MFC_RESET                     -1
index 5f2c4ad6c2cb3427835ed2f40ec9ba5432ae3221..e46067a5785307ac7a1381bd8a8babd8e4ec4fc2 100644 (file)
@@ -239,7 +239,7 @@ static void s5p_mfc_handle_frame_copy_time(struct s5p_mfc_ctx *ctx)
        frame_type = s5p_mfc_hw_call(dev->mfc_ops, get_dec_frame_type, dev);
 
        /* Copy timestamp / timecode from decoded src to dst and set
-          appropraite flags */
+          appropriate flags */
        src_buf = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
        list_for_each_entry(dst_buf, &ctx->dst_queue, list) {
                if (vb2_dma_contig_plane_dma_addr(dst_buf->b, 0) == dec_y_addr) {
@@ -428,7 +428,7 @@ static void s5p_mfc_handle_error(struct s5p_mfc_dev *dev,
                case MFCINST_FINISHING:
                case MFCINST_FINISHED:
                case MFCINST_RUNNING:
-                       /* It is higly probable that an error occured
+                       /* It is highly probable that an error occurred
                         * while decoding a frame */
                        clear_work_bit(ctx);
                        ctx->state = MFCINST_ERROR;
@@ -611,7 +611,7 @@ static irqreturn_t s5p_mfc_irq(int irq, void *priv)
        mfc_debug(1, "Int reason: %d (err: %08x)\n", reason, err);
        switch (reason) {
        case S5P_MFC_R2H_CMD_ERR_RET:
-               /* An error has occured */
+               /* An error has occurred */
                if (ctx->state == MFCINST_RUNNING &&
                        s5p_mfc_hw_call(dev->mfc_ops, err_dec, err) >=
                                dev->warn_start)
@@ -840,7 +840,7 @@ static int s5p_mfc_open(struct file *file)
        mutex_unlock(&dev->mfc_mutex);
        mfc_debug_leave();
        return ret;
-       /* Deinit when failure occured */
+       /* Deinit when failure occurred */
 err_queue_init:
        if (dev->num_inst == 1)
                s5p_mfc_deinit_hw(dev);
@@ -881,14 +881,14 @@ static int s5p_mfc_release(struct file *file)
        /* Mark context as idle */
        clear_work_bit_irqsave(ctx);
        /* If instance was initialised then
-        * return instance and free reosurces */
+        * return instance and free resources */
        if (ctx->inst_no != MFC_NO_INSTANCE_SET) {
                mfc_debug(2, "Has to free instance\n");
                ctx->state = MFCINST_RETURN_INST;
                set_work_bit_irqsave(ctx);
                s5p_mfc_clean_ctx_int_flags(ctx);
                s5p_mfc_hw_call(dev->mfc_ops, try_run, dev);
-               /* Wait until instance is returned or timeout occured */
+               /* Wait until instance is returned or timeout occurred */
                if (s5p_mfc_wait_for_done_ctx
                    (ctx, S5P_MFC_R2H_CMD_CLOSE_INSTANCE_RET, 0)) {
                        s5p_mfc_clock_off();
index 7cab6849fb5b73d9463c591b4b24eaffcae48bae..2475a3c9a0a62ab27330a347865530466d209e0d 100644 (file)
@@ -69,7 +69,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev)
 
        } else {
                /* In this case bank2 can point to the same address as bank1.
-                * Firmware will always occupy the beggining of this area so it is
+                * Firmware will always occupy the beginning of this area so it is
                 * impossible having a video frame buffer with zero address. */
                dev->bank2 = dev->bank1;
        }
index 04e6490a45befbae453d55ef0a86be0bb32497d2..fb2acc53112a47201be7ec785057cdb491eabffc 100644 (file)
@@ -65,7 +65,7 @@ struct mxr_format {
        int num_subframes;
        /** specifies to which subframe belong given plane */
        int plane2subframe[MXR_MAX_PLANES];
-       /** internal code, driver dependant */
+       /** internal code, driver dependent */
        unsigned long cookie;
 };
 
index 51805a5e2beb742d1f3372090085c3a3f0097d86..bc08b5f28e447795b4c7d61526666ca551194e26 100644 (file)
@@ -347,19 +347,41 @@ static int mxr_runtime_resume(struct device *dev)
 {
        struct mxr_device *mdev = to_mdev(dev);
        struct mxr_resources *res = &mdev->res;
+       int ret;
 
        mxr_dbg(mdev, "resume - start\n");
        mutex_lock(&mdev->mutex);
        /* turn clocks on */
-       clk_enable(res->mixer);
-       clk_enable(res->vp);
-       clk_enable(res->sclk_mixer);
+       ret = clk_prepare_enable(res->mixer);
+       if (ret < 0) {
+               dev_err(mdev->dev, "clk_prepare_enable(mixer) failed\n");
+               goto fail;
+       }
+       ret = clk_prepare_enable(res->vp);
+       if (ret < 0) {
+               dev_err(mdev->dev, "clk_prepare_enable(vp) failed\n");
+               goto fail_mixer;
+       }
+       ret = clk_prepare_enable(res->sclk_mixer);
+       if (ret < 0) {
+               dev_err(mdev->dev, "clk_prepare_enable(sclk_mixer) failed\n");
+               goto fail_vp;
+       }
        /* apply default configuration */
        mxr_reg_reset(mdev);
        mxr_dbg(mdev, "resume - finished\n");
 
        mutex_unlock(&mdev->mutex);
        return 0;
+
+fail_vp:
+       clk_disable_unprepare(res->vp);
+fail_mixer:
+       clk_disable_unprepare(res->mixer);
+fail:
+       mutex_unlock(&mdev->mutex);
+       dev_err(mdev->dev, "resume failed\n");
+       return ret;
 }
 
 static int mxr_runtime_suspend(struct device *dev)
@@ -369,9 +391,9 @@ static int mxr_runtime_suspend(struct device *dev)
        mxr_dbg(mdev, "suspend - start\n");
        mutex_lock(&mdev->mutex);
        /* turn clocks off */
-       clk_disable(res->sclk_mixer);
-       clk_disable(res->vp);
-       clk_disable(res->mixer);
+       clk_disable_unprepare(res->sclk_mixer);
+       clk_disable_unprepare(res->vp);
+       clk_disable_unprepare(res->mixer);
        mutex_unlock(&mdev->mutex);
        mxr_dbg(mdev, "suspend - finished\n");
        return 0;
index 641b1f071e06a2b74796f030ddfdcdc80644179b..81b97db111d8506a1c28df84a86ce4181f6ddccb 100644 (file)
@@ -528,7 +528,7 @@ static int mxr_s_dv_timings(struct file *file, void *fh,
        mutex_lock(&mdev->mutex);
 
        /* timings change cannot be done while there is an entity
-        * dependant on output configuration
+        * dependent on output configuration
         */
        if (mdev->n_output > 0) {
                mutex_unlock(&mdev->mutex);
@@ -585,7 +585,7 @@ static int mxr_s_std(struct file *file, void *fh, v4l2_std_id norm)
        mutex_lock(&mdev->mutex);
 
        /* standard change cannot be done while there is an entity
-        * dependant on output configuration
+        * dependent on output configuration
         */
        if (mdev->n_output > 0) {
                mutex_unlock(&mdev->mutex);
index 0afa90f0f6abfdfd8aee75981c147608b9c1262e..5a7c3796f22e349de4edf608bd5eb8ffee62d0dd 100644 (file)
@@ -55,6 +55,8 @@ struct sdo_device {
        struct clk *dacphy;
        /** clock for control of VPLL */
        struct clk *fout_vpll;
+       /** vpll rate before sdo stream was on */
+       unsigned long vpll_rate;
        /** regulator for SDO IP power */
        struct regulator *vdac;
        /** regulator for SDO plug detection */
@@ -193,17 +195,33 @@ static int sdo_s_power(struct v4l2_subdev *sd, int on)
 
 static int sdo_streamon(struct sdo_device *sdev)
 {
+       int ret;
+
        /* set proper clock for Timing Generator */
-       clk_set_rate(sdev->fout_vpll, 54000000);
+       sdev->vpll_rate = clk_get_rate(sdev->fout_vpll);
+       ret = clk_set_rate(sdev->fout_vpll, 54000000);
+       if (ret < 0) {
+               dev_err(sdev->dev, "Failed to set vpll rate\n");
+               return ret;
+       }
        dev_info(sdev->dev, "fout_vpll.rate = %lu\n",
        clk_get_rate(sdev->fout_vpll));
        /* enable clock in SDO */
        sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
-       clk_enable(sdev->dacphy);
+       ret = clk_prepare_enable(sdev->dacphy);
+       if (ret < 0) {
+               dev_err(sdev->dev, "clk_prepare_enable(dacphy) failed\n");
+               goto fail;
+       }
        /* enable DAC */
        sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC);
        sdo_reg_debug(sdev);
        return 0;
+
+fail:
+       sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
+       clk_set_rate(sdev->fout_vpll, sdev->vpll_rate);
+       return ret;
 }
 
 static int sdo_streamoff(struct sdo_device *sdev)
@@ -211,7 +229,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
        int tries;
 
        sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC);
-       clk_disable(sdev->dacphy);
+       clk_disable_unprepare(sdev->dacphy);
        sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
        for (tries = 100; tries; --tries) {
                if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY)
@@ -220,6 +238,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
        }
        if (tries == 0)
                dev_err(sdev->dev, "failed to stop streaming\n");
+       clk_set_rate(sdev->fout_vpll, sdev->vpll_rate);
        return tries ? 0 : -EIO;
 }
 
@@ -254,7 +273,7 @@ static int sdo_runtime_suspend(struct device *dev)
        dev_info(dev, "suspend\n");
        regulator_disable(sdev->vdet);
        regulator_disable(sdev->vdac);
-       clk_disable(sdev->sclk_dac);
+       clk_disable_unprepare(sdev->sclk_dac);
        return 0;
 }
 
@@ -266,7 +285,7 @@ static int sdo_runtime_resume(struct device *dev)
 
        dev_info(dev, "resume\n");
 
-       ret = clk_enable(sdev->sclk_dac);
+       ret = clk_prepare_enable(sdev->sclk_dac);
        if (ret < 0)
                return ret;
 
@@ -299,7 +318,7 @@ static int sdo_runtime_resume(struct device *dev)
 vdac_r_dis:
        regulator_disable(sdev->vdac);
 dac_clk_dis:
-       clk_disable(sdev->sclk_dac);
+       clk_disable_unprepare(sdev->sclk_dac);
        return ret;
 }
 
@@ -405,7 +424,11 @@ static int sdo_probe(struct platform_device *pdev)
        }
 
        /* enable gate for dac clock, because mixer uses it */
-       clk_enable(sdev->dac);
+       ret = clk_prepare_enable(sdev->dac);
+       if (ret < 0) {
+               dev_err(dev, "clk_prepare_enable(dac) failed\n");
+               goto fail_fout_vpll;
+       }
 
        /* configure power management */
        pm_runtime_enable(dev);
@@ -444,7 +467,7 @@ static int sdo_remove(struct platform_device *pdev)
        struct sdo_device *sdev = sd_to_sdev(sd);
 
        pm_runtime_disable(&pdev->dev);
-       clk_disable(sdev->dac);
+       clk_disable_unprepare(sdev->dac);
        clk_put(sdev->fout_vpll);
        clk_put(sdev->dacphy);
        clk_put(sdev->dac);
index 6769193c7c7bbeef27f723e98760f73ece8d0219..74ce8b6b79fa91c80644e0646996397befd325cc 100644 (file)
@@ -1495,7 +1495,7 @@ static int omap1_cam_set_bus_param(struct soc_camera_device *icd)
        if (ctrlclock & LCLK_EN)
                CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock);
 
-       /* select bus endianess */
+       /* select bus endianness */
        xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
        fmt = xlate->host_fmt;
 
index 1d3f1196519669cca0509c1972bdb320d2d35ad1..2d4e73b45c5e3b05d7e4615f6f6fd0d46bd56656 100644 (file)
@@ -1108,7 +1108,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
        return 0;
 }
 
-/* timeperframe is arbitrary and continous */
+/* timeperframe is arbitrary and continuous */
 static int vidioc_enum_frameintervals(struct file *file, void *priv,
                                             struct v4l2_frmivalenum *fival)
 {
@@ -1125,7 +1125,7 @@ static int vidioc_enum_frameintervals(struct file *file, void *priv,
 
        fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS;
 
-       /* fill in stepwise (step=1.0 is requred by V4L2 spec) */
+       /* fill in stepwise (step=1.0 is required by V4L2 spec) */
        fival->stepwise.min  = tpf_min;
        fival->stepwise.max  = tpf_max;
        fival->stepwise.step = (struct v4l2_fract) {1, 1};
index 1c9e771aa15c7bb40b5a8a1de25d66b2b108c528..d16bf0f41e247bd69e3af1ebdc31e0309861e0fd 100644 (file)
@@ -323,7 +323,7 @@ static void vsp1_clocks_disable(struct vsp1_device *vsp1)
  * Increment the VSP1 reference count and initialize the device if the first
  * reference is taken.
  *
- * Return a pointer to the VSP1 device or NULL if an error occured.
+ * Return a pointer to the VSP1 device or NULL if an error occurred.
  */
 struct vsp1_device *vsp1_device_get(struct vsp1_device *vsp1)
 {
index 714c53ef6c11b19d48304405f363f750b26547d2..4b0ac07af662c2bca05c6534ecb52bfc15730c74 100644 (file)
@@ -1026,8 +1026,10 @@ int vsp1_video_init(struct vsp1_video *video, struct vsp1_entity *rwpf)
 
        /* ... and the buffers queue... */
        video->alloc_ctx = vb2_dma_contig_init_ctx(video->vsp1->dev);
-       if (IS_ERR(video->alloc_ctx))
+       if (IS_ERR(video->alloc_ctx)) {
+               ret = PTR_ERR(video->alloc_ctx);
                goto error;
+       }
 
        video->queue.type = video->type;
        video->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
index 3db8a8cfe1a87f4eb80e9c22950bbcac93b7daed..050b3bb96fecc13a15f05d3f294147200954e8dd 100644 (file)
@@ -271,8 +271,7 @@ static void shark_unregister_leds(struct shark_device *shark)
        cancel_work_sync(&shark->led_work);
 }
 
-#ifdef CONFIG_PM
-static void shark_resume_leds(struct shark_device *shark)
+static inline void shark_resume_leds(struct shark_device *shark)
 {
        if (test_bit(BLUE_IS_PULSE, &shark->brightness_new))
                set_bit(BLUE_PULSE_LED, &shark->brightness_new);
@@ -281,7 +280,6 @@ static void shark_resume_leds(struct shark_device *shark)
        set_bit(RED_LED, &shark->brightness_new);
        schedule_work(&shark->led_work);
 }
-#endif
 #else
 static int shark_register_leds(struct shark_device *shark, struct device *dev)
 {
index d86d90dab8bf880666a05ca0463aa83fc62f77de..8654e0dc5c95376aa7140498e10af342b955d15a 100644 (file)
@@ -237,8 +237,7 @@ static void shark_unregister_leds(struct shark_device *shark)
        cancel_work_sync(&shark->led_work);
 }
 
-#ifdef CONFIG_PM
-static void shark_resume_leds(struct shark_device *shark)
+static inline void shark_resume_leds(struct shark_device *shark)
 {
        int i;
 
@@ -247,7 +246,6 @@ static void shark_resume_leds(struct shark_device *shark)
 
        schedule_work(&shark->led_work);
 }
-#endif
 #else
 static int shark_register_leds(struct shark_device *shark, struct device *dev)
 {
index 9c9084cb99f7dd1fde0800f0325c58584edd9e19..2fd9009f86633e74b4752472f5db2829daf6d9ce 100644 (file)
@@ -268,8 +268,8 @@ struct si476x_radio;
  *
  * @tune_freq: Tune chip to a specific frequency
  * @seek_start: Star station seeking
- * @rsq_status: Get Recieved Signal Quality(RSQ) status
- * @rds_blckcnt: Get recived RDS blocks count
+ * @rsq_status: Get Received Signal Quality(RSQ) status
+ * @rds_blckcnt: Get received RDS blocks count
  * @phase_diversity: Change phase diversity mode of the tuner
  * @phase_div_status: Get phase diversity mode status
  * @acf_status: Get the status of Automatically Controlled
index 036e2f54f4db4b1bc5c6f574e19ccde1960da9b5..3ed1f5669f791b9d3015bb91efd80ba2fa82d0c0 100644 (file)
@@ -356,7 +356,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
                   So we keep it as-is. */
                return -EINVAL;
        }
-       clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL);
+       freq = clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL);
        tea5764_power_up(radio);
        tea5764_tune(radio, (freq * 125) / 2);
        return 0;
index 69e3245a58a0cbfcc1d333d390a30aa45e4c70d8..a9319a24c7efe1290efbc5b309bb719584cf7b5f 100644 (file)
@@ -112,7 +112,7 @@ static int tef6862_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequen
        if (f->tuner != 0)
                return -EINVAL;
 
-       clamp(freq, TEF6862_LO_FREQ, TEF6862_HI_FREQ);
+       freq = clamp(freq, TEF6862_LO_FREQ, TEF6862_HI_FREQ);
        pll = 1964 + ((freq - TEF6862_LO_FREQ) * 20) / FREQ_MUL;
        i2cmsg[0] = (MSA_MODE_PRESET << MSA_MODE_SHIFT) | WM_SUB_PLLM;
        i2cmsg[1] = (pll >> 8) & 0xff;
index 72e3fa652481671cff04e2c06a1478d21fb0ffb6..f329485c6629b038ff2aee825edff86c82189328 100644 (file)
@@ -1370,7 +1370,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
         * 0x68nnnnB7 to 0x6AnnnnB7, the left mouse button generates
         * 0x688301b7 and the right one 0x688481b7. All other keys generate
         * 0x2nnnnnnn. Position coordinate is encoded in buf[1] and buf[2] with
-        * reversed endianess. Extract direction from buffer, rotate endianess,
+        * reversed endianness. Extract direction from buffer, rotate endianness,
         * adjust sign and feed the values into stabilize(). The resulting codes
         * will be 0x01008000, 0x01007F00, which match the newer devices.
         */
index 094484fac94cdbe52f7832f140f87895e922e631..a5d4f883d053a7b0ebca0543ac82d29d216ec26a 100644 (file)
@@ -118,7 +118,7 @@ static int debug;
 #define RR3_IR_IO_LENGTH_FUZZ  0x04
 /* Timeout for end of signal detection */
 #define RR3_IR_IO_SIG_TIMEOUT  0x05
-/* Minumum value for pause recognition. */
+/* Minimum value for pause recognition. */
 #define RR3_IR_IO_MIN_PAUSE    0x06
 
 /* Clock freq. of EZ-USB chip */
index 2e1a02e360ff0cd7279fed8ca20b80a3ee0b8ad8..20cca405bf452c46195ebbbadb37c8a535e85d0b 100644 (file)
@@ -1195,7 +1195,7 @@ static u32 mt2063_set_dnc_output_enable(struct mt2063_state *state,
  *   DNC Output is selected, the other is always off)
  *
  * @state:     ptr to mt2063_state structure
- * @Mode:      desired reciever delivery system
+ * @Mode:      desired receiver delivery system
  *
  * Note: Register cache must be valid for it to work
  */
@@ -2119,7 +2119,7 @@ static int mt2063_set_analog_params(struct dvb_frontend *fe,
 
 /*
  * As defined on EN 300 429, the DVB-C roll-off factor is 0.15.
- * So, the amount of the needed bandwith is given by:
+ * So, the amount of the needed bandwidth is given by:
  *     Bw = Symbol_rate * (1 + 0.15)
  * As such, the maximum symbol rate supported by 6 MHz is given by:
  *     max_symbol_rate = 6 MHz / 1.15 = 5217391 Bauds
index 74dc46a71f64555c07bb67be9ee09facf822ad41..7e4798783db733cc139e557444f12d4bddb820b5 100644 (file)
 #define V4L2_STD_A2            (V4L2_STD_A2_A    | V4L2_STD_A2_B)
 #define V4L2_STD_NICAM         (V4L2_STD_NICAM_A | V4L2_STD_NICAM_B)
 
-/* To preserve backward compatibilty,
+/* To preserve backward compatibility,
    (std & V4L2_STD_AUDIO) = 0 means that ALL audio stds are supported
  */
 
index e9d017bea377069da087751404e75f86b081c7cd..528cce958a82c4a67c91ea0c52841364db36f7d4 100644 (file)
@@ -1412,8 +1412,8 @@ err_v4l2:
        usb_set_intfdata(interface, NULL);
 err_if:
        usb_put_dev(udev);
-       kfree(dev);
        clear_bit(dev->devno, &cx231xx_devused);
+       kfree(dev);
        return retval;
 }
 
index c8fcd78425bd228ca4374daf94fdbf4ed1c0c17a..8f9b2cea88f009ec316fb1b97cbbfa67984fcda0 100644 (file)
@@ -131,7 +131,7 @@ static int af9035_wr_regs(struct dvb_usb_device *d, u32 reg, u8 *val, int len)
 {
        u8 wbuf[MAX_XFER_SIZE];
        u8 mbox = (reg >> 16) & 0xff;
-       struct usb_req req = { CMD_MEM_WR, mbox, sizeof(wbuf), wbuf, 0, NULL };
+       struct usb_req req = { CMD_MEM_WR, mbox, 6 + len, wbuf, 0, NULL };
 
        if (6 + len > sizeof(wbuf)) {
                dev_warn(&d->udev->dev, "%s: i2c wr: len=%d is too big!\n",
@@ -238,14 +238,15 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
                } else {
                        /* I2C */
                        u8 buf[MAX_XFER_SIZE];
-                       struct usb_req req = { CMD_I2C_RD, 0, sizeof(buf),
+                       struct usb_req req = { CMD_I2C_RD, 0, 5 + msg[0].len,
                                        buf, msg[1].len, msg[1].buf };
 
                        if (5 + msg[0].len > sizeof(buf)) {
                                dev_warn(&d->udev->dev,
                                         "%s: i2c xfer: len=%d is too big!\n",
                                         KBUILD_MODNAME, msg[0].len);
-                               return -EOPNOTSUPP;
+                               ret = -EOPNOTSUPP;
+                               goto unlock;
                        }
                        req.mbox |= ((msg[0].addr & 0x80)  >>  3);
                        buf[0] = msg[1].len;
@@ -274,14 +275,15 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
                } else {
                        /* I2C */
                        u8 buf[MAX_XFER_SIZE];
-                       struct usb_req req = { CMD_I2C_WR, 0, sizeof(buf), buf,
-                                       0, NULL };
+                       struct usb_req req = { CMD_I2C_WR, 0, 5 + msg[0].len,
+                                       buf, 0, NULL };
 
                        if (5 + msg[0].len > sizeof(buf)) {
                                dev_warn(&d->udev->dev,
                                         "%s: i2c xfer: len=%d is too big!\n",
                                         KBUILD_MODNAME, msg[0].len);
-                               return -EOPNOTSUPP;
+                               ret = -EOPNOTSUPP;
+                               goto unlock;
                        }
                        req.mbox |= ((msg[0].addr & 0x80)  >>  3);
                        buf[0] = msg[0].len;
@@ -319,6 +321,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
                ret = -EOPNOTSUPP;
        }
 
+unlock:
        mutex_unlock(&d->i2c_mutex);
 
        if (ret < 0)
@@ -1534,6 +1537,8 @@ static const struct usb_device_id af9035_id_table[] = {
        /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */
        { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099,
                &af9035_props, "TerraTec Cinergy T Stick Dual RC (rev. 2)", NULL) },
+       { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a05,
+               &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) },
        { }
 };
 MODULE_DEVICE_TABLE(usb, af9035_id_table);
index 2627553f7de1f90c262f2d234d1d1faa9288f45f..08240e498451a55810e4bd00a75df73d0c1a607e 100644 (file)
@@ -266,7 +266,7 @@ static int mxl111sf_adap_fe_init(struct dvb_frontend *fe)
        struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id];
        int err;
 
-       /* exit if we didnt initialize the driver yet */
+       /* exit if we didn't initialize the driver yet */
        if (!state->chip_id) {
                mxl_debug("driver not yet initialized, exit.");
                goto fail;
@@ -322,7 +322,7 @@ static int mxl111sf_adap_fe_sleep(struct dvb_frontend *fe)
        struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id];
        int err;
 
-       /* exit if we didnt initialize the driver yet */
+       /* exit if we didn't initialize the driver yet */
        if (!state->chip_id) {
                mxl_debug("driver not yet initialized, exit.");
                goto fail;
index 40832a1aef6c71c0df2eaf51ffdea327bafe18da..98d24aefb640f80e12d6dd720f872273c71e6276 100644 (file)
@@ -102,7 +102,7 @@ static int technisat_usb2_i2c_access(struct usb_device *udev,
        if (rxlen > 62) {
                err("i2c RX buffer can't exceed 62 bytes (dev 0x%02x)",
                                device_addr);
-               txlen = 62;
+               rxlen = 62;
        }
 
        b[0] = I2C_SPEED_100KHZ_BIT;
index fc5d60efd4abe99f19acbafff7b83879da5ff3ac..dd19c9ff76e0f9a159c6630320814c89e9e83d5a 100644 (file)
@@ -1664,8 +1664,8 @@ static int em28xx_v4l2_close(struct file *filp)
 
        em28xx_videodbg("users=%d\n", dev->users);
 
-       mutex_lock(&dev->lock);
        vb2_fop_release(filp);
+       mutex_lock(&dev->lock);
 
        if (dev->users == 1) {
                /* the device is already disconnect,
index cb1e64ca59c9259b59ca1aaaaea036b6bd2c5fa0..cea8d7f51c3cc9430af956066d87b045b453c062 100644 (file)
@@ -438,7 +438,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
        s32 nToSkip =
                sd->swapRB * (gspca_dev->cam.cam_mode[mode].bytesperline + 1);
 
-       /* Test only against 0202h, so endianess does not matter */
+       /* Test only against 0202h, so endianness does not matter */
        switch (*(s16 *) data) {
        case 0x0202:            /* End of frame, start a new one */
                gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
index cd79c180f67b87e84689a8a162b4962bf5691cde..07529e5a0c5605186b3aa619b6b89d06cf98bc45 100644 (file)
@@ -416,7 +416,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
 #if IS_ENABLED(CONFIG_INPUT)
 static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
                        u8 *data,               /* interrupt packet data */
-                       int len)                /* interrput packet length */
+                       int len)                /* interrupt packet length */
 {
        int ret = -EINVAL;
 
index a9150964356329d93ea136e151c0d7f0aebf8590..2fd1c5e31a0f2692a1d59dd88c72cbee74e61054 100644 (file)
@@ -874,7 +874,7 @@ static int sd_dbg_s_register(struct gspca_dev *gspca_dev,
 #if IS_ENABLED(CONFIG_INPUT)
 static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
                        u8 *data,               /* interrupt packet data */
-                       int len)                /* interrput packet length */
+                       int len)                /* interrupt packet length */
 {
        int ret = -EINVAL;
        u8 data0, data1;
index 1fc80af2a18907e57d54eac3f58481ada0f3cda7..48234c9a8b6c3e4b4b927eb654ddb0009aa3d8ba 100644 (file)
@@ -361,6 +361,9 @@ static void stk1135_configure_clock(struct gspca_dev *gspca_dev)
 
        /* set serial interface clock divider (30MHz/0x1f*16+2) = 60240 kHz) */
        reg_w(gspca_dev, STK1135_REG_SICTL + 2, 0x1f);
+
+       /* wait a while for sensor to catch up */
+       udelay(1000);
 }
 
 static void stk1135_camera_disable(struct gspca_dev *gspca_dev)
index 9c0827631b9c105658575ed52e754fd1efa0c740..7f94ec74282e3ea42b0c423130419b038a5e3edd 100644 (file)
@@ -139,7 +139,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct sd *sd = (struct sd *) gspca_dev;
        struct cam *cam = &gspca_dev->cam;
 
-       /* Give the camera some time to settle, otherwise initalization will
+       /* Give the camera some time to settle, otherwise initialization will
           fail on hotplug, and yes it really needs a full second. */
        msleep(1000);
 
index a517d185febed4590bbb5f58306aa4e4a2c4f0f1..46c9f2229a18675c6a1ca39528dab2196937c0c5 100644 (file)
@@ -1027,6 +1027,7 @@ static const struct usb_device_id device_table[] = {
        {USB_DEVICE(0x055f, 0xc650), BS(SPCA533, 0)},
        {USB_DEVICE(0x05da, 0x1018), BS(SPCA504B, 0)},
        {USB_DEVICE(0x06d6, 0x0031), BS(SPCA533, 0)},
+       {USB_DEVICE(0x06d6, 0x0041), BS(SPCA504B, 0)},
        {USB_DEVICE(0x0733, 0x1311), BS(SPCA533, 0)},
        {USB_DEVICE(0x0733, 0x1314), BS(SPCA533, 0)},
        {USB_DEVICE(0x0733, 0x2211), BS(SPCA533, 0)},
index 7b95d8e88a20240305a8817b72c3459d80a5adc6..d3e1b6d8bf494f79d449c38c96be5d022ab61043 100644 (file)
@@ -6905,7 +6905,7 @@ static int sd_get_jcomp(struct gspca_dev *gspca_dev,
 #if IS_ENABLED(CONFIG_INPUT)
 static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
                        u8 *data,               /* interrupt packet data */
-                       int len)                /* interrput packet length */
+                       int len)                /* interrupt packet length */
 {
        if (len == 8 && data[4] == 1) {
                input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
index 77bbf788965953bbc67f8fa8b3ab18ccbe5806d8..78c9bc8e7f561744364a6de94f4aeaae382dd077 100644 (file)
@@ -1039,7 +1039,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
        /* Set the leds off */
        pwc_set_leds(pdev, 0, 0);
 
-       /* Setup intial videomode */
+       /* Setup initial videomode */
        rc = pwc_set_video_mode(pdev, MAX_WIDTH, MAX_HEIGHT,
                                V4L2_PIX_FMT_YUV420, 30, &compression, 1);
        if (rc)
index 8a505a90d3189a59876a916507ae50b6e11a0ed9..6222a4ab1e00bfff2d58d7816145bdae58fe4059 100644 (file)
 #define USBTV_ISOC_TRANSFERS   16
 #define USBTV_ISOC_PACKETS     8
 
-#define USBTV_WIDTH            720
-#define USBTV_HEIGHT           480
-
 #define USBTV_CHUNK_SIZE       256
 #define USBTV_CHUNK            240
-#define USBTV_CHUNKS           (USBTV_WIDTH * USBTV_HEIGHT \
-                                       / 4 / USBTV_CHUNK)
 
 /* Chunk header. */
 #define USBTV_MAGIC_OK(chunk)  ((be32_to_cpu(chunk[0]) & 0xff000000) \
 #define USBTV_ODD(chunk)       ((be32_to_cpu(chunk[0]) & 0x0000f000) >> 15)
 #define USBTV_CHUNK_NO(chunk)  (be32_to_cpu(chunk[0]) & 0x00000fff)
 
+#define USBTV_TV_STD  (V4L2_STD_525_60 | V4L2_STD_PAL)
+
+/* parameters for supported TV norms */
+struct usbtv_norm_params {
+       v4l2_std_id norm;
+       int cap_width, cap_height;
+};
+
+static struct usbtv_norm_params norm_params[] = {
+       {
+               .norm = V4L2_STD_525_60,
+               .cap_width = 720,
+               .cap_height = 480,
+       },
+       {
+               .norm = V4L2_STD_PAL,
+               .cap_width = 720,
+               .cap_height = 576,
+       }
+};
+
 /* A single videobuf2 frame buffer. */
 struct usbtv_buf {
        struct vb2_buffer vb;
@@ -94,11 +110,38 @@ struct usbtv {
                USBTV_COMPOSITE_INPUT,
                USBTV_SVIDEO_INPUT,
        } input;
+       v4l2_std_id norm;
+       int width, height;
+       int n_chunks;
        int iso_size;
        unsigned int sequence;
        struct urb *isoc_urbs[USBTV_ISOC_TRANSFERS];
 };
 
+static int usbtv_configure_for_norm(struct usbtv *usbtv, v4l2_std_id norm)
+{
+       int i, ret = 0;
+       struct usbtv_norm_params *params = NULL;
+
+       for (i = 0; i < ARRAY_SIZE(norm_params); i++) {
+               if (norm_params[i].norm & norm) {
+                       params = &norm_params[i];
+                       break;
+               }
+       }
+
+       if (params) {
+               usbtv->width = params->cap_width;
+               usbtv->height = params->cap_height;
+               usbtv->n_chunks = usbtv->width * usbtv->height
+                                               / 4 / USBTV_CHUNK;
+               usbtv->norm = params->norm;
+       } else
+               ret = -EINVAL;
+
+       return ret;
+}
+
 static int usbtv_set_regs(struct usbtv *usbtv, const u16 regs[][2], int size)
 {
        int ret;
@@ -158,6 +201,57 @@ static int usbtv_select_input(struct usbtv *usbtv, int input)
        return ret;
 }
 
+static int usbtv_select_norm(struct usbtv *usbtv, v4l2_std_id norm)
+{
+       int ret;
+       static const u16 pal[][2] = {
+               { USBTV_BASE + 0x001a, 0x0068 },
+               { USBTV_BASE + 0x010e, 0x0072 },
+               { USBTV_BASE + 0x010f, 0x00a2 },
+               { USBTV_BASE + 0x0112, 0x00b0 },
+               { USBTV_BASE + 0x0117, 0x0001 },
+               { USBTV_BASE + 0x0118, 0x002c },
+               { USBTV_BASE + 0x012d, 0x0010 },
+               { USBTV_BASE + 0x012f, 0x0020 },
+               { USBTV_BASE + 0x024f, 0x0002 },
+               { USBTV_BASE + 0x0254, 0x0059 },
+               { USBTV_BASE + 0x025a, 0x0016 },
+               { USBTV_BASE + 0x025b, 0x0035 },
+               { USBTV_BASE + 0x0263, 0x0017 },
+               { USBTV_BASE + 0x0266, 0x0016 },
+               { USBTV_BASE + 0x0267, 0x0036 }
+       };
+
+       static const u16 ntsc[][2] = {
+               { USBTV_BASE + 0x001a, 0x0079 },
+               { USBTV_BASE + 0x010e, 0x0068 },
+               { USBTV_BASE + 0x010f, 0x009c },
+               { USBTV_BASE + 0x0112, 0x00f0 },
+               { USBTV_BASE + 0x0117, 0x0000 },
+               { USBTV_BASE + 0x0118, 0x00fc },
+               { USBTV_BASE + 0x012d, 0x0004 },
+               { USBTV_BASE + 0x012f, 0x0008 },
+               { USBTV_BASE + 0x024f, 0x0001 },
+               { USBTV_BASE + 0x0254, 0x005f },
+               { USBTV_BASE + 0x025a, 0x0012 },
+               { USBTV_BASE + 0x025b, 0x0001 },
+               { USBTV_BASE + 0x0263, 0x001c },
+               { USBTV_BASE + 0x0266, 0x0011 },
+               { USBTV_BASE + 0x0267, 0x0005 }
+       };
+
+       ret = usbtv_configure_for_norm(usbtv, norm);
+
+       if (!ret) {
+               if (norm & V4L2_STD_525_60)
+                       ret = usbtv_set_regs(usbtv, ntsc, ARRAY_SIZE(ntsc));
+               else if (norm & V4L2_STD_PAL)
+                       ret = usbtv_set_regs(usbtv, pal, ARRAY_SIZE(pal));
+       }
+
+       return ret;
+}
+
 static int usbtv_setup_capture(struct usbtv *usbtv)
 {
        int ret;
@@ -225,26 +319,11 @@ static int usbtv_setup_capture(struct usbtv *usbtv)
 
                { USBTV_BASE + 0x0284, 0x0088 },
                { USBTV_BASE + 0x0003, 0x0004 },
-               { USBTV_BASE + 0x001a, 0x0079 },
                { USBTV_BASE + 0x0100, 0x00d3 },
-               { USBTV_BASE + 0x010e, 0x0068 },
-               { USBTV_BASE + 0x010f, 0x009c },
-               { USBTV_BASE + 0x0112, 0x00f0 },
                { USBTV_BASE + 0x0115, 0x0015 },
-               { USBTV_BASE + 0x0117, 0x0000 },
-               { USBTV_BASE + 0x0118, 0x00fc },
-               { USBTV_BASE + 0x012d, 0x0004 },
-               { USBTV_BASE + 0x012f, 0x0008 },
                { USBTV_BASE + 0x0220, 0x002e },
                { USBTV_BASE + 0x0225, 0x0008 },
                { USBTV_BASE + 0x024e, 0x0002 },
-               { USBTV_BASE + 0x024f, 0x0001 },
-               { USBTV_BASE + 0x0254, 0x005f },
-               { USBTV_BASE + 0x025a, 0x0012 },
-               { USBTV_BASE + 0x025b, 0x0001 },
-               { USBTV_BASE + 0x0263, 0x001c },
-               { USBTV_BASE + 0x0266, 0x0011 },
-               { USBTV_BASE + 0x0267, 0x0005 },
                { USBTV_BASE + 0x024e, 0x0002 },
                { USBTV_BASE + 0x024f, 0x0002 },
        };
@@ -253,6 +332,10 @@ static int usbtv_setup_capture(struct usbtv *usbtv)
        if (ret)
                return ret;
 
+       ret = usbtv_select_norm(usbtv, usbtv->norm);
+       if (ret)
+               return ret;
+
        ret = usbtv_select_input(usbtv, usbtv->input);
        if (ret)
                return ret;
@@ -296,7 +379,7 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk)
        frame_id = USBTV_FRAME_ID(chunk);
        odd = USBTV_ODD(chunk);
        chunk_no = USBTV_CHUNK_NO(chunk);
-       if (chunk_no >= USBTV_CHUNKS)
+       if (chunk_no >= usbtv->n_chunks)
                return;
 
        /* Beginning of a frame. */
@@ -324,10 +407,10 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk)
        usbtv->chunks_done++;
 
        /* Last chunk in a frame, signalling an end */
-       if (odd && chunk_no == USBTV_CHUNKS-1) {
+       if (odd && chunk_no == usbtv->n_chunks-1) {
                int size = vb2_plane_size(&buf->vb, 0);
                enum vb2_buffer_state state = usbtv->chunks_done ==
-                                               USBTV_CHUNKS ?
+                                               usbtv->n_chunks ?
                                                VB2_BUF_STATE_DONE :
                                                VB2_BUF_STATE_ERROR;
 
@@ -500,6 +583,8 @@ static int usbtv_querycap(struct file *file, void *priv,
 static int usbtv_enum_input(struct file *file, void *priv,
                                        struct v4l2_input *i)
 {
+       struct usbtv *dev = video_drvdata(file);
+
        switch (i->index) {
        case USBTV_COMPOSITE_INPUT:
                strlcpy(i->name, "Composite", sizeof(i->name));
@@ -512,7 +597,7 @@ static int usbtv_enum_input(struct file *file, void *priv,
        }
 
        i->type = V4L2_INPUT_TYPE_CAMERA;
-       i->std = V4L2_STD_525_60;
+       i->std = dev->vdev.tvnorms;
        return 0;
 }
 
@@ -531,23 +616,37 @@ static int usbtv_enum_fmt_vid_cap(struct file *file, void  *priv,
 static int usbtv_fmt_vid_cap(struct file *file, void *priv,
                                        struct v4l2_format *f)
 {
-       f->fmt.pix.width = USBTV_WIDTH;
-       f->fmt.pix.height = USBTV_HEIGHT;
+       struct usbtv *usbtv = video_drvdata(file);
+
+       f->fmt.pix.width = usbtv->width;
+       f->fmt.pix.height = usbtv->height;
        f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
        f->fmt.pix.field = V4L2_FIELD_INTERLACED;
-       f->fmt.pix.bytesperline = USBTV_WIDTH * 2;
+       f->fmt.pix.bytesperline = usbtv->width * 2;
        f->fmt.pix.sizeimage = (f->fmt.pix.bytesperline * f->fmt.pix.height);
        f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
-       f->fmt.pix.priv = 0;
+
        return 0;
 }
 
 static int usbtv_g_std(struct file *file, void *priv, v4l2_std_id *norm)
 {
-       *norm = V4L2_STD_525_60;
+       struct usbtv *usbtv = video_drvdata(file);
+       *norm = usbtv->norm;
        return 0;
 }
 
+static int usbtv_s_std(struct file *file, void *priv, v4l2_std_id norm)
+{
+       int ret = -EINVAL;
+       struct usbtv *usbtv = video_drvdata(file);
+
+       if ((norm & V4L2_STD_525_60) || (norm & V4L2_STD_PAL))
+               ret = usbtv_select_norm(usbtv, norm);
+
+       return ret;
+}
+
 static int usbtv_g_input(struct file *file, void *priv, unsigned int *i)
 {
        struct usbtv *usbtv = video_drvdata(file);
@@ -561,13 +660,6 @@ static int usbtv_s_input(struct file *file, void *priv, unsigned int i)
        return usbtv_select_input(usbtv, i);
 }
 
-static int usbtv_s_std(struct file *file, void *priv, v4l2_std_id norm)
-{
-       if (norm & V4L2_STD_525_60)
-               return 0;
-       return -EINVAL;
-}
-
 struct v4l2_ioctl_ops usbtv_ioctl_ops = {
        .vidioc_querycap = usbtv_querycap,
        .vidioc_enum_input = usbtv_enum_input,
@@ -604,10 +696,12 @@ static int usbtv_queue_setup(struct vb2_queue *vq,
        const struct v4l2_format *v4l_fmt, unsigned int *nbuffers,
        unsigned int *nplanes, unsigned int sizes[], void *alloc_ctxs[])
 {
+       struct usbtv *usbtv = vb2_get_drv_priv(vq);
+
        if (*nbuffers < 2)
                *nbuffers = 2;
        *nplanes = 1;
-       sizes[0] = USBTV_WIDTH * USBTV_HEIGHT / 2 * sizeof(u32);
+       sizes[0] = USBTV_CHUNK * usbtv->n_chunks * 2 * sizeof(u32);
 
        return 0;
 }
@@ -690,7 +784,11 @@ static int usbtv_probe(struct usb_interface *intf,
                return -ENOMEM;
        usbtv->dev = dev;
        usbtv->udev = usb_get_dev(interface_to_usbdev(intf));
+
        usbtv->iso_size = size;
+
+       (void)usbtv_configure_for_norm(usbtv, V4L2_STD_525_60);
+
        spin_lock_init(&usbtv->buflock);
        mutex_init(&usbtv->v4l2_lock);
        mutex_init(&usbtv->vb2q_lock);
@@ -727,7 +825,7 @@ static int usbtv_probe(struct usb_interface *intf,
        usbtv->vdev.release = video_device_release_empty;
        usbtv->vdev.fops = &usbtv_fops;
        usbtv->vdev.ioctl_ops = &usbtv_ioctl_ops;
-       usbtv->vdev.tvnorms = V4L2_STD_525_60;
+       usbtv->vdev.tvnorms = USBTV_TV_STD;
        usbtv->vdev.queue = &usbtv->vb2q;
        usbtv->vdev.lock = &usbtv->v4l2_lock;
        set_bit(V4L2_FL_USE_FH_PRIO, &usbtv->vdev.flags);
index 899cb6d1c4a4a74a68cae01dbea51de5befc821e..898c208889cd2d55dd5a22522a2d06340eb0891d 100644 (file)
@@ -556,7 +556,7 @@ static u16 uvc_video_clock_host_sof(const struct uvc_clock_sample *sample)
  *
  * SOF = ((SOF2 - SOF1) * PTS + SOF1 * STC2 - SOF2 * STC1) / (STC2 - STC1)   (1)
  *
- * to avoid loosing precision in the division. Similarly, the host timestamp is
+ * to avoid losing precision in the division. Similarly, the host timestamp is
  * computed with
  *
  * TS = ((TS2 - TS1) * PTS + TS1 * SOF2 - TS2 * SOF1) / (SOF2 - SOF1)       (2)
index 60dcc0f3b32e7b445352b455d377f5b2b794b4fb..fb46790d0eca795d5e411c54bf7129d96e61d3e9 100644 (file)
@@ -420,7 +420,7 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
                "Advanced Simple",
                "Core",
                "Simple Scalable",
-               "Advanced Coding Efficency",
+               "Advanced Coding Efficiency",
                NULL,
        };
 
index 73035ee0f4def8c7425872dba6c1687419b1303f..178ce96556c6424432a9220295219ccd0dadf4e7 100644 (file)
@@ -558,6 +558,8 @@ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
 
        if (m2m_ctx->m2m_dev->m2m_ops->unlock)
                m2m_ctx->m2m_dev->m2m_ops->unlock(m2m_ctx->priv);
+       else if (m2m_ctx->q_lock)
+               mutex_unlock(m2m_ctx->q_lock);
 
        if (list_empty(&src_q->done_list))
                poll_wait(file, &src_q->done_wq, wait);
@@ -566,6 +568,8 @@ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
 
        if (m2m_ctx->m2m_dev->m2m_ops->lock)
                m2m_ctx->m2m_dev->m2m_ops->lock(m2m_ctx->priv);
+       else if (m2m_ctx->q_lock)
+               mutex_lock(m2m_ctx->q_lock);
 
        spin_lock_irqsave(&src_q->done_lock, flags);
        if (!list_empty(&src_q->done_list))
@@ -693,6 +697,13 @@ struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev,
 
        if (ret)
                goto err;
+       /*
+        * If both queues use same mutex assign it as the common buffer
+        * queues lock to the m2m context. This lock is used in the
+        * v4l2_m2m_ioctl_* helpers.
+        */
+       if (out_q_ctx->q.lock == cap_q_ctx->q.lock)
+               m2m_ctx->q_lock = out_q_ctx->q.lock;
 
        return m2m_ctx;
 err:
@@ -740,3 +751,118 @@ void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_buffer *vb)
 }
 EXPORT_SYMBOL_GPL(v4l2_m2m_buf_queue);
 
+/* Videobuf2 ioctl helpers */
+
+int v4l2_m2m_ioctl_reqbufs(struct file *file, void *priv,
+                               struct v4l2_requestbuffers *rb)
+{
+       struct v4l2_fh *fh = file->private_data;
+
+       return v4l2_m2m_reqbufs(file, fh->m2m_ctx, rb);
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_reqbufs);
+
+int v4l2_m2m_ioctl_create_bufs(struct file *file, void *priv,
+                               struct v4l2_create_buffers *create)
+{
+       struct v4l2_fh *fh = file->private_data;
+
+       return v4l2_m2m_create_bufs(file, fh->m2m_ctx, create);
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_create_bufs);
+
+int v4l2_m2m_ioctl_querybuf(struct file *file, void *priv,
+                               struct v4l2_buffer *buf)
+{
+       struct v4l2_fh *fh = file->private_data;
+
+       return v4l2_m2m_querybuf(file, fh->m2m_ctx, buf);
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_querybuf);
+
+int v4l2_m2m_ioctl_qbuf(struct file *file, void *priv,
+                               struct v4l2_buffer *buf)
+{
+       struct v4l2_fh *fh = file->private_data;
+
+       return v4l2_m2m_qbuf(file, fh->m2m_ctx, buf);
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_qbuf);
+
+int v4l2_m2m_ioctl_dqbuf(struct file *file, void *priv,
+                               struct v4l2_buffer *buf)
+{
+       struct v4l2_fh *fh = file->private_data;
+
+       return v4l2_m2m_dqbuf(file, fh->m2m_ctx, buf);
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_dqbuf);
+
+int v4l2_m2m_ioctl_expbuf(struct file *file, void *priv,
+                               struct v4l2_exportbuffer *eb)
+{
+       struct v4l2_fh *fh = file->private_data;
+
+       return v4l2_m2m_expbuf(file, fh->m2m_ctx, eb);
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_expbuf);
+
+int v4l2_m2m_ioctl_streamon(struct file *file, void *priv,
+                               enum v4l2_buf_type type)
+{
+       struct v4l2_fh *fh = file->private_data;
+
+       return v4l2_m2m_streamon(file, fh->m2m_ctx, type);
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_streamon);
+
+int v4l2_m2m_ioctl_streamoff(struct file *file, void *priv,
+                               enum v4l2_buf_type type)
+{
+       struct v4l2_fh *fh = file->private_data;
+
+       return v4l2_m2m_streamoff(file, fh->m2m_ctx, type);
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_streamoff);
+
+/*
+ * v4l2_file_operations helpers. It is assumed here same lock is used
+ * for the output and the capture buffer queue.
+ */
+
+int v4l2_m2m_fop_mmap(struct file *file, struct vm_area_struct *vma)
+{
+       struct v4l2_fh *fh = file->private_data;
+       struct v4l2_m2m_ctx *m2m_ctx = fh->m2m_ctx;
+       int ret;
+
+       if (m2m_ctx->q_lock && mutex_lock_interruptible(m2m_ctx->q_lock))
+               return -ERESTARTSYS;
+
+       ret = v4l2_m2m_mmap(file, m2m_ctx, vma);
+
+       if (m2m_ctx->q_lock)
+               mutex_unlock(m2m_ctx->q_lock);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_fop_mmap);
+
+unsigned int v4l2_m2m_fop_poll(struct file *file, poll_table *wait)
+{
+       struct v4l2_fh *fh = file->private_data;
+       struct v4l2_m2m_ctx *m2m_ctx = fh->m2m_ctx;
+       unsigned int ret;
+
+       if (m2m_ctx->q_lock)
+               mutex_lock(m2m_ctx->q_lock);
+
+       ret = v4l2_m2m_poll(file, m2m_ctx, wait);
+
+       if (m2m_ctx->q_lock)
+               mutex_unlock(m2m_ctx->q_lock);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_fop_poll);
+
index b19b306c8f7f533d3112db441f692e57bd76638d..57ba131f08ad9f19d899870f8d7ecf8998170f8a 100644 (file)
@@ -1824,8 +1824,8 @@ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb)
                return -EINVAL;
        }
 
-       if (eb->flags & ~O_CLOEXEC) {
-               dprintk(1, "Queue does support only O_CLOEXEC flag\n");
+       if (eb->flags & ~(O_CLOEXEC | O_ACCMODE)) {
+               dprintk(1, "Queue does support only O_CLOEXEC and access mode flags\n");
                return -EINVAL;
        }
 
@@ -1848,14 +1848,14 @@ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb)
 
        vb_plane = &vb->planes[eb->plane];
 
-       dbuf = call_memop(q, get_dmabuf, vb_plane->mem_priv);
+       dbuf = call_memop(q, get_dmabuf, vb_plane->mem_priv, eb->flags & O_ACCMODE);
        if (IS_ERR_OR_NULL(dbuf)) {
                dprintk(1, "Failed to export buffer %d, plane %d\n",
                        eb->index, eb->plane);
                return -EINVAL;
        }
 
-       ret = dma_buf_fd(dbuf, eb->flags);
+       ret = dma_buf_fd(dbuf, eb->flags & ~O_ACCMODE);
        if (ret < 0) {
                dprintk(3, "buffer %d, plane %d failed to export (%d)\n",
                        eb->index, eb->plane, ret);
index 646f08f4f504c05ae37dd95cbc1fe8333705e658..33d3871d1e131dce9a2f1d8392020dce5b8ff799 100644 (file)
@@ -393,7 +393,7 @@ static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf)
        return sgt;
 }
 
-static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv)
+static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv, unsigned long flags)
 {
        struct vb2_dc_buf *buf = buf_priv;
        struct dma_buf *dbuf;
@@ -404,7 +404,7 @@ static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv)
        if (WARN_ON(!buf->sgt_base))
                return NULL;
 
-       dbuf = dma_buf_export(buf, &vb2_dc_dmabuf_ops, buf->size, 0);
+       dbuf = dma_buf_export(buf, &vb2_dc_dmabuf_ops, buf->size, flags);
        if (IS_ERR(dbuf))
                return NULL;
 
index 62a60caa5d1fe7eb583cb208fef9b96a5b0dd8f0..dd671582c9a1b2dcf8286b2a798a65e6621752ba 100644 (file)
@@ -32,7 +32,7 @@ config MFD_AS3722
        select MFD_CORE
        select REGMAP_I2C
        select REGMAP_IRQ
-       depends on I2C && OF
+       depends on I2C=y && OF
        help
          The ams AS3722 is a compact system PMU suitable for mobile phones,
          tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down
index da1c6566d93d2f755878d358a018835bd7cd1454..37edf9e989b066cbb1a8a667001ce4e655ac7c1c 100644 (file)
@@ -506,7 +506,7 @@ static struct lpc_ich_info lpc_chipset_info[] = {
                .iTCO_version = 2,
        },
        [LPC_WPT_LP] = {
-               .name = "Lynx Point_LP",
+               .name = "Wildcat Point_LP",
                .iTCO_version = 2,
        },
 };
index 71e3e0c5bf730c7e8f3423619d9a2e2acc6fa27d..a5424579679cfcd7e0b835964557ea1188c58eaa 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/sched.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/ti_ssp.h>
 
@@ -409,7 +410,6 @@ static int ti_ssp_probe(struct platform_device *pdev)
                cells[id].id            = id;
                cells[id].name          = data->dev_name;
                cells[id].platform_data = data->pdata;
-               cells[id].data_size     = data->pdata_size;
        }
 
        error = mfd_add_devices(dev, 0, cells, 2, NULL, 0, NULL);
index 6c0fde55270d3681c6048c1516b6915c291e4c45..66f411a6e8ea502251ede2b92bca60c59e8843fe 100644 (file)
 #define MEI_DEV_ID_PPT_2      0x1CBA  /* Panther Point */
 #define MEI_DEV_ID_PPT_3      0x1DBA  /* Panther Point */
 
-#define MEI_DEV_ID_LPT        0x8C3A  /* Lynx Point */
+#define MEI_DEV_ID_LPT_H      0x8C3A  /* Lynx Point H */
 #define MEI_DEV_ID_LPT_W      0x8D3A  /* Lynx Point - Wellsburg */
 #define MEI_DEV_ID_LPT_LP     0x9C3A  /* Lynx Point LP */
+#define MEI_DEV_ID_LPT_HR     0x8CBA  /* Lynx Point H Refresh */
+
+#define MEI_DEV_ID_WPT_LP     0x9CBA  /* Wildcat Point LP */
 /*
  * MEI HW Section
  */
index b96205aece0c781d267ef9c2ac198cc154145080..2cab3c0a6805364393e69a5410905874c4103e87 100644 (file)
@@ -76,9 +76,11 @@ static DEFINE_PCI_DEVICE_TABLE(mei_me_pci_tbl) = {
        {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_1)},
        {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_2)},
        {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_3)},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT)},
+       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT_H)},
        {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT_W)},
        {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT_LP)},
+       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT_HR)},
+       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_WPT_LP)},
 
        /* required last entry */
        {0, }
index 8aa42e738acc6dde99a716535f8b27efcd9d0988..653799b96bfae0dd709367fa20a3a74bc296033d 100644 (file)
@@ -154,14 +154,14 @@ static void mic_reset_inform_host(struct virtio_device *vdev)
 {
        struct mic_vdev *mvdev = to_micvdev(vdev);
        struct mic_device_ctrl __iomem *dc = mvdev->dc;
-       int retry = 100, i;
+       int retry;
 
        iowrite8(0, &dc->host_ack);
        iowrite8(1, &dc->vdev_reset);
        mic_send_intr(mvdev->mdev, mvdev->c2h_vdev_db);
 
        /* Wait till host completes all card accesses and acks the reset */
-       for (i = retry; i--;) {
+       for (retry = 100; retry--;) {
                if (ioread8(&dc->host_ack))
                        break;
                msleep(100);
@@ -187,11 +187,12 @@ static void mic_reset(struct virtio_device *vdev)
 /*
  * The virtio_ring code calls this API when it wants to notify the Host.
  */
-static void mic_notify(struct virtqueue *vq)
+static bool mic_notify(struct virtqueue *vq)
 {
        struct mic_vdev *mvdev = vq->priv;
 
        mic_send_intr(mvdev->mdev, mvdev->c2h_vdev_db);
+       return true;
 }
 
 static void mic_del_vq(struct virtqueue *vq, int n)
@@ -247,17 +248,17 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev,
        /* First assign the vring's allocated in host memory */
        vqconfig = mic_vq_config(mvdev->desc) + index;
        memcpy_fromio(&config, vqconfig, sizeof(config));
-       _vr_size = vring_size(config.num, MIC_VIRTIO_RING_ALIGN);
+       _vr_size = vring_size(le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN);
        vr_size = PAGE_ALIGN(_vr_size + sizeof(struct _mic_vring_info));
-       va = mic_card_map(mvdev->mdev, config.address, vr_size);
+       va = mic_card_map(mvdev->mdev, le64_to_cpu(config.address), vr_size);
        if (!va)
                return ERR_PTR(-ENOMEM);
        mvdev->vr[index] = va;
        memset_io(va, 0x0, _vr_size);
-       vq = vring_new_virtqueue(index,
-                               config.num, MIC_VIRTIO_RING_ALIGN, vdev,
-                               false,
-                               va, mic_notify, callback, name);
+       vq = vring_new_virtqueue(index, le16_to_cpu(config.num),
+                                MIC_VIRTIO_RING_ALIGN, vdev, false,
+                                (void __force *)va, mic_notify, callback,
+                                name);
        if (!vq) {
                err = -ENOMEM;
                goto unmap;
@@ -272,7 +273,8 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev,
 
        /* Allocate and reassign used ring now */
        mvdev->used_size[index] = PAGE_ALIGN(sizeof(__u16) * 3 +
-                       sizeof(struct vring_used_elem) * config.num);
+                                            sizeof(struct vring_used_elem) *
+                                            le16_to_cpu(config.num));
        used = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
                                        get_order(mvdev->used_size[index]));
        if (!used) {
@@ -309,7 +311,7 @@ static int mic_find_vqs(struct virtio_device *vdev, unsigned nvqs,
 {
        struct mic_vdev *mvdev = to_micvdev(vdev);
        struct mic_device_ctrl __iomem *dc = mvdev->dc;
-       int i, err, retry = 100;
+       int i, err, retry;
 
        /* We must have this many virtqueues. */
        if (nvqs > ioread8(&mvdev->desc->num_vq))
@@ -331,7 +333,7 @@ static int mic_find_vqs(struct virtio_device *vdev, unsigned nvqs,
         * rings have been re-assigned.
         */
        mic_send_intr(mvdev->mdev, mvdev->c2h_vdev_db);
-       for (i = retry; i--;) {
+       for (retry = 100; retry--;) {
                if (!ioread8(&dc->used_address_updated))
                        break;
                msleep(100);
@@ -519,8 +521,8 @@ static void mic_scan_devices(struct mic_driver *mdrv, bool remove)
        struct device *dev;
        int ret;
 
-       for (i = mic_aligned_size(struct mic_bootparam);
-               i < MIC_DP_SIZE; i += mic_total_desc_size(d)) {
+       for (i = sizeof(struct mic_bootparam); i < MIC_DP_SIZE;
+               i += mic_total_desc_size(d)) {
                d = mdrv->dp + i;
                dc = (void __iomem *)d + mic_aligned_desc_size(d);
                /*
@@ -539,7 +541,8 @@ static void mic_scan_devices(struct mic_driver *mdrv, bool remove)
                        continue;
 
                /* device already exists */
-               dev = device_find_child(mdrv->dev, d, mic_match_desc);
+               dev = device_find_child(mdrv->dev, (void __force *)d,
+                                       mic_match_desc);
                if (dev) {
                        if (remove)
                                iowrite8(MIC_VIRTIO_PARAM_DEV_REMOVE,
index 2c5c22c93ba8e787a1666e74d1b2256c4f894a27..d0407ba53bb7e81b45ecc2b6cfeb6af60ef747b8 100644 (file)
@@ -42,8 +42,8 @@
 
 static inline unsigned mic_desc_size(struct mic_device_desc __iomem *desc)
 {
-       return mic_aligned_size(*desc)
-               + ioread8(&desc->num_vq) * mic_aligned_size(struct mic_vqconfig)
+       return sizeof(*desc)
+               + ioread8(&desc->num_vq) * sizeof(struct mic_vqconfig)
                + ioread8(&desc->feature_len) * 2
                + ioread8(&desc->config_len);
 }
@@ -67,8 +67,7 @@ mic_vq_configspace(struct mic_device_desc __iomem *desc)
 }
 static inline unsigned mic_total_desc_size(struct mic_device_desc __iomem *desc)
 {
-       return mic_aligned_desc_size(desc) +
-               mic_aligned_size(struct mic_device_ctrl);
+       return mic_aligned_desc_size(desc) + sizeof(struct mic_device_ctrl);
 }
 
 int mic_devices_init(struct mic_driver *mdrv);
index 7558d91864380ae849d90a24deee4e31985850eb..b75c6b5cc20fc7a908944291add52a5cada071ff 100644 (file)
@@ -62,7 +62,7 @@ void mic_bootparam_init(struct mic_device *mdev)
 {
        struct mic_bootparam *bootparam = mdev->dp;
 
-       bootparam->magic = MIC_MAGIC;
+       bootparam->magic = cpu_to_le32(MIC_MAGIC);
        bootparam->c2h_shutdown_db = mdev->shutdown_db;
        bootparam->h2c_shutdown_db = -1;
        bootparam->h2c_config_db = -1;
index 5b8494bd1e003ff9cb53d49fa7ffd22798893912..e04bb4fe68235a7de2ac7e5c09c7c027776cb39c 100644 (file)
@@ -41,7 +41,7 @@ static int mic_virtio_copy_to_user(struct mic_vdev *mvdev,
         * We are copying from IO below an should ideally use something
         * like copy_to_user_fromio(..) if it existed.
         */
-       if (copy_to_user(ubuf, dbuf, len)) {
+       if (copy_to_user(ubuf, (void __force *)dbuf, len)) {
                err = -EFAULT;
                dev_err(mic_dev(mvdev), "%s %d err %d\n",
                        __func__, __LINE__, err);
@@ -66,7 +66,7 @@ static int mic_virtio_copy_from_user(struct mic_vdev *mvdev,
         * We are copying to IO below and should ideally use something
         * like copy_from_user_toio(..) if it existed.
         */
-       if (copy_from_user(dbuf, ubuf, len)) {
+       if (copy_from_user((void __force *)dbuf, ubuf, len)) {
                err = -EFAULT;
                dev_err(mic_dev(mvdev), "%s %d err %d\n",
                        __func__, __LINE__, err);
@@ -293,7 +293,7 @@ static void mic_virtio_init_post(struct mic_vdev *mvdev)
                        continue;
                }
                mvdev->mvr[i].vrh.vring.used =
-                       mvdev->mdev->aper.va +
+                       (void __force *)mvdev->mdev->aper.va +
                        le64_to_cpu(vqconfig[i].used_address);
        }
 
@@ -378,7 +378,7 @@ int mic_virtio_config_change(struct mic_vdev *mvdev,
                        void __user *argp)
 {
        DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake);
-       int ret = 0, retry = 100, i;
+       int ret = 0, retry, i;
        struct mic_bootparam *bootparam = mvdev->mdev->dp;
        s8 db = bootparam->h2c_config_db;
 
@@ -401,7 +401,7 @@ int mic_virtio_config_change(struct mic_vdev *mvdev,
        mvdev->dc->config_change = MIC_VIRTIO_PARAM_CONFIG_CHANGED;
        mvdev->mdev->ops->send_intr(mvdev->mdev, db);
 
-       for (i = retry; i--;) {
+       for (retry = 100; retry--;) {
                ret = wait_event_timeout(wake,
                        mvdev->dc->guest_ack, msecs_to_jiffies(100));
                if (ret)
@@ -467,7 +467,7 @@ static int mic_copy_dp_entry(struct mic_vdev *mvdev,
        }
 
        /* Find the first free device page entry */
-       for (i = mic_aligned_size(struct mic_bootparam);
+       for (i = sizeof(struct mic_bootparam);
                i < MIC_DP_SIZE - mic_total_desc_size(dd_config);
                i += mic_total_desc_size(devp)) {
                devp = mdev->dp + i;
@@ -525,6 +525,7 @@ int mic_virtio_add_device(struct mic_vdev *mvdev,
        char irqname[10];
        struct mic_bootparam *bootparam = mdev->dp;
        u16 num;
+       dma_addr_t vr_addr;
 
        mutex_lock(&mdev->mic_mutex);
 
@@ -559,17 +560,16 @@ int mic_virtio_add_device(struct mic_vdev *mvdev,
                }
                vr->len = vr_size;
                vr->info = vr->va + vring_size(num, MIC_VIRTIO_RING_ALIGN);
-               vr->info->magic = MIC_MAGIC + mvdev->virtio_id + i;
-               vqconfig[i].address = mic_map_single(mdev,
-                       vr->va, vr_size);
-               if (mic_map_error(vqconfig[i].address)) {
+               vr->info->magic = cpu_to_le32(MIC_MAGIC + mvdev->virtio_id + i);
+               vr_addr = mic_map_single(mdev, vr->va, vr_size);
+               if (mic_map_error(vr_addr)) {
                        free_pages((unsigned long)vr->va, get_order(vr_size));
                        ret = -ENOMEM;
                        dev_err(mic_dev(mvdev), "%s %d err %d\n",
                                __func__, __LINE__, ret);
                        goto err;
                }
-               vqconfig[i].address = cpu_to_le64(vqconfig[i].address);
+               vqconfig[i].address = cpu_to_le64(vr_addr);
 
                vring_init(&vr->vr, num, vr->va, MIC_VIRTIO_RING_ALIGN);
                ret = vringh_init_kern(&mvr->vrh,
@@ -639,7 +639,7 @@ void mic_virtio_del_device(struct mic_vdev *mvdev)
        struct mic_vdev *tmp_mvdev;
        struct mic_device *mdev = mvdev->mdev;
        DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake);
-       int i, ret, retry = 100;
+       int i, ret, retry;
        struct mic_vqconfig *vqconfig;
        struct mic_bootparam *bootparam = mdev->dp;
        s8 db;
@@ -652,16 +652,16 @@ void mic_virtio_del_device(struct mic_vdev *mvdev)
                "Requesting hot remove id %d\n", mvdev->virtio_id);
        mvdev->dc->config_change = MIC_VIRTIO_PARAM_DEV_REMOVE;
        mdev->ops->send_intr(mdev, db);
-       for (i = retry; i--;) {
+       for (retry = 100; retry--;) {
                ret = wait_event_timeout(wake,
                        mvdev->dc->guest_ack, msecs_to_jiffies(100));
                if (ret)
                        break;
        }
        dev_dbg(mdev->sdev->parent,
-               "Device id %d config_change %d guest_ack %d\n",
+               "Device id %d config_change %d guest_ack %d retry %d\n",
                mvdev->virtio_id, mvdev->dc->config_change,
-               mvdev->dc->guest_ack);
+               mvdev->dc->guest_ack, retry);
        mvdev->dc->config_change = 0;
        mvdev->dc->guest_ack = 0;
 skip_hot_remove:
index 81e9541b784c3a4d46bbd352c2aa26faf70c2877..0dfa8a81436e80ebd325d1722caa791d5193936e 100644 (file)
@@ -397,8 +397,8 @@ mic_x100_load_ramdisk(struct mic_device *mdev)
         * so copy over the ramdisk @ 128M.
         */
        memcpy_toio(mdev->aper.va + (mdev->bootaddr << 1), fw->data, fw->size);
-       iowrite32(cpu_to_le32(mdev->bootaddr << 1), &bp->hdr.ramdisk_image);
-       iowrite32(cpu_to_le32(fw->size), &bp->hdr.ramdisk_size);
+       iowrite32(mdev->bootaddr << 1, &bp->hdr.ramdisk_image);
+       iowrite32(fw->size, &bp->hdr.ramdisk_size);
        release_firmware(fw);
 error:
        return rc;
index 157b570ba343e4648b796e7330e7b75bc052d00a..92d1ba8e8153ab9849ab51037804747cd37df7f1 100644 (file)
@@ -308,7 +308,7 @@ static void sdio_acpi_set_handle(struct sdio_func *func)
        struct mmc_host *host = func->card->host;
        u64 addr = (host->slotno << 16) | func->num;
 
-       acpi_preset_companion(&func->dev, ACPI_HANDLE(host->parent), addr);
+       acpi_preset_companion(&func->dev, ACPI_COMPANION(host->parent), addr);
 }
 #else
 static inline void sdio_acpi_set_handle(struct sdio_func *func) {}
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 d210d131fef255da97e7d277574ac80f01a66341..0f55589a56b815af4c00bc521c504db468774fa5 100644 (file)
@@ -73,7 +73,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
        info->map.cached =
-               ioremap_cached(info->map.phys, info->map.size);
+               ioremap_cache(info->map.phys, info->map.size);
        if (!info->map.cached)
                printk(KERN_WARNING "Failed to ioremap cached %s\n",
                       info->map.name);
index 439bc389641841dc05f79ab638f7010e4a9cd053..779e60d12f896f67196bbdd5f7b3338ccccd6742 100644 (file)
@@ -731,7 +731,7 @@ static int mpc5121_nfc_probe(struct platform_device *op)
        of_node_put(rootnode);
 
        /* Enable NFC clock */
-       clk = devm_clk_get(dev, "nfc_clk");
+       clk = devm_clk_get(dev, "ipg");
        if (IS_ERR(clk)) {
                dev_err(dev, "Unable to acquire NFC clock!\n");
                retval = PTR_ERR(clk);
index 36eab0c4fb337b502c986d6c9ade7f1801d2a5f8..398e299ee1bded33a57d7eb91318b00b24513658 100644 (file)
@@ -4199,9 +4199,9 @@ static int bond_check_params(struct bond_params *params)
             (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) {
                /* not complete check, but should be good enough to
                   catch mistakes */
-               __be32 ip = in_aton(arp_ip_target[i]);
-               if (!isdigit(arp_ip_target[i][0]) || ip == 0 ||
-                   ip == htonl(INADDR_BROADCAST)) {
+               __be32 ip;
+               if (!in4_pton(arp_ip_target[i], -1, (u8 *)&ip, -1, NULL) ||
+                   IS_IP_TARGET_UNUSABLE_ADDRESS(ip)) {
                        pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n",
                                   arp_ip_target[i]);
                        arp_interval = 0;
index abf5e106edc549c053e4d3ffdecce72c4470742e..0ae580bbc5db02ec4dbb3c5855ada7164f32c89a 100644 (file)
@@ -1635,12 +1635,12 @@ static ssize_t bonding_show_packets_per_slave(struct device *d,
                                              char *buf)
 {
        struct bonding *bond = to_bond(d);
-       int packets_per_slave = bond->params.packets_per_slave;
+       unsigned int packets_per_slave = bond->params.packets_per_slave;
 
        if (packets_per_slave > 1)
                packets_per_slave = reciprocal_value(packets_per_slave);
 
-       return sprintf(buf, "%d\n", packets_per_slave);
+       return sprintf(buf, "%u\n", packets_per_slave);
 }
 
 static ssize_t bonding_store_packets_per_slave(struct device *d,
index e59b3a392af62d8cfcb0e9f40ad3b974027c3299..6b0c9958d824b729d74cfbbdb83713a71dd978f3 100644 (file)
@@ -109,135 +109,170 @@ static u32 mpc52xx_can_get_clock(struct platform_device *ofdev,
 #endif /* CONFIG_PPC_MPC52xx */
 
 #ifdef CONFIG_PPC_MPC512x
-struct mpc512x_clockctl {
-       u32 spmr;               /* System PLL Mode Reg */
-       u32 sccr[2];            /* System Clk Ctrl Reg 1 & 2 */
-       u32 scfr1;              /* System Clk Freq Reg 1 */
-       u32 scfr2;              /* System Clk Freq Reg 2 */
-       u32 reserved;
-       u32 bcr;                /* Bread Crumb Reg */
-       u32 pccr[12];           /* PSC Clk Ctrl Reg 0-11 */
-       u32 spccr;              /* SPDIF Clk Ctrl Reg */
-       u32 cccr;               /* CFM Clk Ctrl Reg */
-       u32 dccr;               /* DIU Clk Cnfg Reg */
-       u32 mccr[4];            /* MSCAN Clk Ctrl Reg 1-3 */
-};
-
-static struct of_device_id mpc512x_clock_ids[] = {
-       { .compatible = "fsl,mpc5121-clock", },
-       {}
-};
-
 static u32 mpc512x_can_get_clock(struct platform_device *ofdev,
-                                const char *clock_name, int *mscan_clksrc)
+                                const char *clock_source, int *mscan_clksrc)
 {
-       struct mpc512x_clockctl __iomem *clockctl;
-       struct device_node *np_clock;
-       struct clk *sys_clk, *ref_clk;
-       int plen, clockidx, clocksrc = -1;
-       u32 sys_freq, val, clockdiv = 1, freq = 0;
-       const u32 *pval;
-
-       np_clock = of_find_matching_node(NULL, mpc512x_clock_ids);
-       if (!np_clock) {
-               dev_err(&ofdev->dev, "couldn't find clock node\n");
-               return 0;
-       }
-       clockctl = of_iomap(np_clock, 0);
-       if (!clockctl) {
-               dev_err(&ofdev->dev, "couldn't map clock registers\n");
-               goto exit_put;
-       }
+       struct device_node *np;
+       u32 clockdiv;
+       enum {
+               CLK_FROM_AUTO,
+               CLK_FROM_IPS,
+               CLK_FROM_SYS,
+               CLK_FROM_REF,
+       } clk_from;
+       struct clk *clk_in, *clk_can;
+       unsigned long freq_calc;
+       struct mscan_priv *priv;
+       struct clk *clk_ipg;
 
-       /* Determine the MSCAN device index from the peripheral's
-        * physical address. Register address offsets against the
-        * IMMR base are:  0x1300, 0x1380, 0x2300, 0x2380
+       /* the caller passed in the clock source spec that was read from
+        * the device tree, get the optional clock divider as well
         */
-       pval = of_get_property(ofdev->dev.of_node, "reg", &plen);
-       BUG_ON(!pval || plen < sizeof(*pval));
-       clockidx = (*pval & 0x80) ? 1 : 0;
-       if (*pval & 0x2000)
-               clockidx += 2;
+       np = ofdev->dev.of_node;
+       clockdiv = 1;
+       of_property_read_u32(np, "fsl,mscan-clock-divider", &clockdiv);
+       dev_dbg(&ofdev->dev, "device tree specs: clk src[%s] div[%d]\n",
+               clock_source ? clock_source : "<NULL>", clockdiv);
+
+       /* when clock-source is 'ip', the CANCTL1[CLKSRC] bit needs to
+        * get set, and the 'ips' clock is the input to the MSCAN
+        * component
+        *
+        * for clock-source values of 'ref' or 'sys' the CANCTL1[CLKSRC]
+        * bit needs to get cleared, an optional clock-divider may have
+        * been specified (the default value is 1), the appropriate
+        * MSCAN related MCLK is the input to the MSCAN component
+        *
+        * in the absence of a clock-source spec, first an optimal clock
+        * gets determined based on the 'sys' clock, if that fails the
+        * 'ref' clock is used
+        */
+       clk_from = CLK_FROM_AUTO;
+       if (clock_source) {
+               /* interpret the device tree's spec for the clock source */
+               if (!strcmp(clock_source, "ip"))
+                       clk_from = CLK_FROM_IPS;
+               else if (!strcmp(clock_source, "sys"))
+                       clk_from = CLK_FROM_SYS;
+               else if (!strcmp(clock_source, "ref"))
+                       clk_from = CLK_FROM_REF;
+               else
+                       goto err_invalid;
+               dev_dbg(&ofdev->dev, "got a clk source spec[%d]\n", clk_from);
+       }
+       if (clk_from == CLK_FROM_AUTO) {
+               /* no spec so far, try the 'sys' clock; round to the
+                * next MHz and see if we can get a multiple of 16MHz
+                */
+               dev_dbg(&ofdev->dev, "no clk source spec, trying SYS\n");
+               clk_in = devm_clk_get(&ofdev->dev, "sys");
+               if (IS_ERR(clk_in))
+                       goto err_notavail;
+               freq_calc = clk_get_rate(clk_in);
+               freq_calc +=  499999;
+               freq_calc /= 1000000;
+               freq_calc *= 1000000;
+               if ((freq_calc % 16000000) == 0) {
+                       clk_from = CLK_FROM_SYS;
+                       clockdiv = freq_calc / 16000000;
+                       dev_dbg(&ofdev->dev,
+                               "clk fit, sys[%lu] div[%d] freq[%lu]\n",
+                               freq_calc, clockdiv, freq_calc / clockdiv);
+               }
+       }
+       if (clk_from == CLK_FROM_AUTO) {
+               /* no spec so far, use the 'ref' clock */
+               dev_dbg(&ofdev->dev, "no clk source spec, trying REF\n");
+               clk_in = devm_clk_get(&ofdev->dev, "ref");
+               if (IS_ERR(clk_in))
+                       goto err_notavail;
+               clk_from = CLK_FROM_REF;
+               freq_calc = clk_get_rate(clk_in);
+               dev_dbg(&ofdev->dev,
+                       "clk fit, ref[%lu] (no div) freq[%lu]\n",
+                       freq_calc, freq_calc);
+       }
 
-       /*
-        * Clock source and divider selection: 3 different clock sources
-        * can be selected: "ip", "ref" or "sys". For the latter two, a
-        * clock divider can be defined as well. If the clock source is
-        * not specified by the device tree, we first try to find an
-        * optimal CAN source clock based on the system clock. If that
-        * is not posslible, the reference clock will be used.
+       /* select IPS or MCLK as the MSCAN input (returned to the caller),
+        * setup the MCLK mux source and rate if applicable, apply the
+        * optionally specified or derived above divider, and determine
+        * the actual resulting clock rate to return to the caller
         */
-       if (clock_name && !strcmp(clock_name, "ip")) {
+       switch (clk_from) {
+       case CLK_FROM_IPS:
+               clk_can = devm_clk_get(&ofdev->dev, "ips");
+               if (IS_ERR(clk_can))
+                       goto err_notavail;
+               priv = netdev_priv(dev_get_drvdata(&ofdev->dev));
+               priv->clk_can = clk_can;
+               freq_calc = clk_get_rate(clk_can);
                *mscan_clksrc = MSCAN_CLKSRC_IPS;
-               freq = mpc5xxx_get_bus_frequency(ofdev->dev.of_node);
-       } else {
+               dev_dbg(&ofdev->dev, "clk from IPS, clksrc[%d] freq[%lu]\n",
+                       *mscan_clksrc, freq_calc);
+               break;
+       case CLK_FROM_SYS:
+       case CLK_FROM_REF:
+               clk_can = devm_clk_get(&ofdev->dev, "mclk");
+               if (IS_ERR(clk_can))
+                       goto err_notavail;
+               priv = netdev_priv(dev_get_drvdata(&ofdev->dev));
+               priv->clk_can = clk_can;
+               if (clk_from == CLK_FROM_SYS)
+                       clk_in = devm_clk_get(&ofdev->dev, "sys");
+               if (clk_from == CLK_FROM_REF)
+                       clk_in = devm_clk_get(&ofdev->dev, "ref");
+               if (IS_ERR(clk_in))
+                       goto err_notavail;
+               clk_set_parent(clk_can, clk_in);
+               freq_calc = clk_get_rate(clk_in);
+               freq_calc /= clockdiv;
+               clk_set_rate(clk_can, freq_calc);
+               freq_calc = clk_get_rate(clk_can);
                *mscan_clksrc = MSCAN_CLKSRC_BUS;
-
-               pval = of_get_property(ofdev->dev.of_node,
-                                      "fsl,mscan-clock-divider", &plen);
-               if (pval && plen == sizeof(*pval))
-                       clockdiv = *pval;
-               if (!clockdiv)
-                       clockdiv = 1;
-
-               if (!clock_name || !strcmp(clock_name, "sys")) {
-                       sys_clk = devm_clk_get(&ofdev->dev, "sys_clk");
-                       if (IS_ERR(sys_clk)) {
-                               dev_err(&ofdev->dev, "couldn't get sys_clk\n");
-                               goto exit_unmap;
-                       }
-                       /* Get and round up/down sys clock rate */
-                       sys_freq = 1000000 *
-                               ((clk_get_rate(sys_clk) + 499999) / 1000000);
-
-                       if (!clock_name) {
-                               /* A multiple of 16 MHz would be optimal */
-                               if ((sys_freq % 16000000) == 0) {
-                                       clocksrc = 0;
-                                       clockdiv = sys_freq / 16000000;
-                                       freq = sys_freq / clockdiv;
-                               }
-                       } else {
-                               clocksrc = 0;
-                               freq = sys_freq / clockdiv;
-                       }
-               }
-
-               if (clocksrc < 0) {
-                       ref_clk = devm_clk_get(&ofdev->dev, "ref_clk");
-                       if (IS_ERR(ref_clk)) {
-                               dev_err(&ofdev->dev, "couldn't get ref_clk\n");
-                               goto exit_unmap;
-                       }
-                       clocksrc = 1;
-                       freq = clk_get_rate(ref_clk) / clockdiv;
-               }
+               dev_dbg(&ofdev->dev, "clk from MCLK, clksrc[%d] freq[%lu]\n",
+                       *mscan_clksrc, freq_calc);
+               break;
+       default:
+               goto err_invalid;
        }
 
-       /* Disable clock */
-       out_be32(&clockctl->mccr[clockidx], 0x0);
-       if (clocksrc >= 0) {
-               /* Set source and divider */
-               val = (clocksrc << 14) | ((clockdiv - 1) << 17);
-               out_be32(&clockctl->mccr[clockidx], val);
-               /* Enable clock */
-               out_be32(&clockctl->mccr[clockidx], val | 0x10000);
-       }
+       /* the above clk_can item is used for the bitrate, access to
+        * the peripheral's register set needs the clk_ipg item
+        */
+       clk_ipg = devm_clk_get(&ofdev->dev, "ipg");
+       if (IS_ERR(clk_ipg))
+               goto err_notavail_ipg;
+       if (clk_prepare_enable(clk_ipg))
+               goto err_notavail_ipg;
+       priv = netdev_priv(dev_get_drvdata(&ofdev->dev));
+       priv->clk_ipg = clk_ipg;
+
+       /* return the determined clock source rate */
+       return freq_calc;
+
+err_invalid:
+       dev_err(&ofdev->dev, "invalid clock source specification\n");
+       /* clock source rate could not get determined */
+       return 0;
 
-       /* Enable MSCAN clock domain */
-       val = in_be32(&clockctl->sccr[1]);
-       if (!(val & (1 << 25)))
-               out_be32(&clockctl->sccr[1], val | (1 << 25));
+err_notavail:
+       dev_err(&ofdev->dev, "cannot acquire or setup bitrate clock source\n");
+       /* clock source rate could not get determined */
+       return 0;
 
-       dev_dbg(&ofdev->dev, "using '%s' with frequency divider %d\n",
-               *mscan_clksrc == MSCAN_CLKSRC_IPS ? "ips_clk" :
-               clocksrc == 1 ? "ref_clk" : "sys_clk", clockdiv);
+err_notavail_ipg:
+       dev_err(&ofdev->dev, "cannot acquire or setup register clock\n");
+       /* clock source rate could not get determined */
+       return 0;
+}
 
-exit_unmap:
-       iounmap(clockctl);
-exit_put:
-       of_node_put(np_clock);
-       return freq;
+static void mpc512x_can_put_clock(struct platform_device *ofdev)
+{
+       struct mscan_priv *priv;
+
+       priv = netdev_priv(dev_get_drvdata(&ofdev->dev));
+       if (priv->clk_ipg)
+               clk_disable_unprepare(priv->clk_ipg);
 }
 #else /* !CONFIG_PPC_MPC512x */
 static u32 mpc512x_can_get_clock(struct platform_device *ofdev,
@@ -245,6 +280,7 @@ static u32 mpc512x_can_get_clock(struct platform_device *ofdev,
 {
        return 0;
 }
+#define mpc512x_can_put_clock NULL
 #endif /* CONFIG_PPC_MPC512x */
 
 static const struct of_device_id mpc5xxx_can_table[];
@@ -386,11 +422,13 @@ static int mpc5xxx_can_resume(struct platform_device *ofdev)
 static const struct mpc5xxx_can_data mpc5200_can_data = {
        .type = MSCAN_TYPE_MPC5200,
        .get_clock = mpc52xx_can_get_clock,
+       /* .put_clock not applicable */
 };
 
 static const struct mpc5xxx_can_data mpc5121_can_data = {
        .type = MSCAN_TYPE_MPC5121,
        .get_clock = mpc512x_can_get_clock,
+       .put_clock = mpc512x_can_put_clock,
 };
 
 static const struct of_device_id mpc5xxx_can_table[] = {
index fb3dd4399cf36e24cd4a1fe809333d140c8419f2..f615fdec0f1b2fb800189d97395554ecd392fa60 100644 (file)
@@ -113,7 +113,7 @@ static const struct net_device_ops hydra_netdev_ops = {
 static int hydra_init(struct zorro_dev *z)
 {
     struct net_device *dev;
-    unsigned long board = ZTWO_VADDR(z->resource.start);
+    unsigned long board = (unsigned long)ZTWO_VADDR(z->resource.start);
     unsigned long ioaddr = board+HYDRA_NIC_BASE;
     const char name[] = "NE2000";
     int start_page, stop_page;
index 85ec4c2d2645582339eb7ecfa796e9b37fee91ad..ae2a12b7db62db6fcc748019af9abca0e2abf051 100644 (file)
@@ -287,7 +287,7 @@ static const struct net_device_ops zorro8390_netdev_ops = {
 };
 
 static int zorro8390_init(struct net_device *dev, unsigned long board,
-                         const char *name, unsigned long ioaddr)
+                         const char *name, void __iomem *ioaddr)
 {
        int i;
        int err;
@@ -354,7 +354,7 @@ static int zorro8390_init(struct net_device *dev, unsigned long board,
        start_page = NESM_START_PG;
        stop_page = NESM_STOP_PG;
 
-       dev->base_addr = ioaddr;
+       dev->base_addr = (unsigned long)ioaddr;
        dev->irq = IRQ_AMIGA_PORTS;
 
        /* Install the Interrupt handler */
index 0866e7627433c1148037b9ade8064351c2819722..56139184b8019c132428654a5af6a4bd4018de14 100644 (file)
@@ -57,6 +57,7 @@
 #include <linux/zorro.h>
 #include <linux/bitops.h>
 
+#include <asm/byteorder.h>
 #include <asm/irq.h>
 #include <asm/amigaints.h>
 #include <asm/amigahw.h>
@@ -678,6 +679,7 @@ static int a2065_init_one(struct zorro_dev *z,
        unsigned long base_addr = board + A2065_LANCE;
        unsigned long mem_start = board + A2065_RAM;
        struct resource *r1, *r2;
+       u32 serial;
        int err;
 
        r1 = request_mem_region(base_addr, sizeof(struct lance_regs),
@@ -702,6 +704,7 @@ static int a2065_init_one(struct zorro_dev *z,
        r1->name = dev->name;
        r2->name = dev->name;
 
+       serial = be32_to_cpu(z->rom.er_SerialNumber);
        dev->dev_addr[0] = 0x00;
        if (z->id != ZORRO_PROD_AMERISTAR_A2065) {      /* Commodore */
                dev->dev_addr[1] = 0x80;
@@ -710,11 +713,11 @@ static int a2065_init_one(struct zorro_dev *z,
                dev->dev_addr[1] = 0x00;
                dev->dev_addr[2] = 0x9f;
        }
-       dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
-       dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
-       dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
-       dev->base_addr = ZTWO_VADDR(base_addr);
-       dev->mem_start = ZTWO_VADDR(mem_start);
+       dev->dev_addr[3] = (serial >> 16) & 0xff;
+       dev->dev_addr[4] = (serial >> 8) & 0xff;
+       dev->dev_addr[5] = serial & 0xff;
+       dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
+       dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
        dev->mem_end = dev->mem_start + A2065_RAM_SIZE;
 
        priv->ll = (volatile struct lance_regs *)dev->base_addr;
index c178eb4c81668ad3a1b033f11c9070b9e63c934d..b08101b31b8bc547ffbfb486f87abc7a18f92686 100644 (file)
@@ -51,6 +51,7 @@
 #include <linux/zorro.h>
 #include <linux/bitops.h>
 
+#include <asm/byteorder.h>
 #include <asm/amigaints.h>
 #include <asm/amigahw.h>
 #include <asm/irq.h>
@@ -718,6 +719,7 @@ static int ariadne_init_one(struct zorro_dev *z,
        struct resource *r1, *r2;
        struct net_device *dev;
        struct ariadne_private *priv;
+       u32 serial;
        int err;
 
        r1 = request_mem_region(base_addr, sizeof(struct Am79C960), "Am79C960");
@@ -741,14 +743,15 @@ static int ariadne_init_one(struct zorro_dev *z,
        r1->name = dev->name;
        r2->name = dev->name;
 
+       serial = be32_to_cpu(z->rom.er_SerialNumber);
        dev->dev_addr[0] = 0x00;
        dev->dev_addr[1] = 0x60;
        dev->dev_addr[2] = 0x30;
-       dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
-       dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
-       dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
-       dev->base_addr = ZTWO_VADDR(base_addr);
-       dev->mem_start = ZTWO_VADDR(mem_start);
+       dev->dev_addr[3] = (serial >> 16) & 0xff;
+       dev->dev_addr[4] = (serial >> 8) & 0xff;
+       dev->dev_addr[5] = serial & 0xff;
+       dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
+       dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
        dev->mem_end = dev->mem_start + ARIADNE_RAM_SIZE;
 
        dev->netdev_ops = &ariadne_netdev_ops;
index 0216d592d0cee4b080a9d33d7776f632bf639453..2e46c28fc6019a892f7792c6017effe3f7db7063 100644 (file)
@@ -3114,6 +3114,11 @@ int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs_param)
 {
        struct bnx2x *bp = netdev_priv(pci_get_drvdata(dev));
 
+       if (!IS_SRIOV(bp)) {
+               BNX2X_ERR("failed to configure SR-IOV since vfdb was not allocated. Check dmesg for errors in probe stage\n");
+               return -EINVAL;
+       }
+
        DP(BNX2X_MSG_IOV, "bnx2x_sriov_configure called with %d, BNX2X_NR_VIRTFN(bp) was %d\n",
           num_vfs_param, BNX2X_NR_VIRTFN(bp));
 
index 369b736dde0533740a01718fd2d271fa7f10ad60..472305cdff4f576520357e2210cc462e1dac7896 100644 (file)
@@ -8932,6 +8932,9 @@ static int tg3_chip_reset(struct tg3 *tp)
        void (*write_op)(struct tg3 *, u32, u32);
        int i, err;
 
+       if (!pci_device_is_present(tp->pdev))
+               return -ENODEV;
+
        tg3_nvram_lock(tp);
 
        tg3_ape_lock(tp, TG3_APE_LOCK_GRC);
@@ -11581,10 +11584,11 @@ static int tg3_close(struct net_device *dev)
        memset(&tp->net_stats_prev, 0, sizeof(tp->net_stats_prev));
        memset(&tp->estats_prev, 0, sizeof(tp->estats_prev));
 
-       tg3_power_down_prepare(tp);
-
-       tg3_carrier_off(tp);
+       if (pci_device_is_present(tp->pdev)) {
+               tg3_power_down_prepare(tp);
 
+               tg3_carrier_off(tp);
+       }
        return 0;
 }
 
@@ -17726,10 +17730,12 @@ static int tg3_suspend(struct device *device)
        struct pci_dev *pdev = to_pci_dev(device);
        struct net_device *dev = pci_get_drvdata(pdev);
        struct tg3 *tp = netdev_priv(dev);
-       int err;
+       int err = 0;
+
+       rtnl_lock();
 
        if (!netif_running(dev))
-               return 0;
+               goto unlock;
 
        tg3_reset_task_cancel(tp);
        tg3_phy_stop(tp);
@@ -17771,6 +17777,8 @@ out:
                        tg3_phy_start(tp);
        }
 
+unlock:
+       rtnl_unlock();
        return err;
 }
 
@@ -17779,10 +17787,12 @@ static int tg3_resume(struct device *device)
        struct pci_dev *pdev = to_pci_dev(device);
        struct net_device *dev = pci_get_drvdata(pdev);
        struct tg3 *tp = netdev_priv(dev);
-       int err;
+       int err = 0;
+
+       rtnl_lock();
 
        if (!netif_running(dev))
-               return 0;
+               goto unlock;
 
        netif_device_attach(dev);
 
@@ -17806,6 +17816,8 @@ out:
        if (!err)
                tg3_phy_start(tp);
 
+unlock:
+       rtnl_unlock();
        return err;
 }
 #endif /* CONFIG_PM_SLEEP */
index ecd2fb3ef69596146a7cf155323e624e397b6834..6c9308850453bf1ecd21173afa1d1cf11681c8c7 100644 (file)
 #include <asm/io.h>
 #include "cxgb4_uld.h"
 
-#define FW_VERSION_MAJOR 1
-#define FW_VERSION_MINOR 4
-#define FW_VERSION_MICRO 0
+#define T4FW_VERSION_MAJOR 0x01
+#define T4FW_VERSION_MINOR 0x06
+#define T4FW_VERSION_MICRO 0x18
+#define T4FW_VERSION_BUILD 0x00
 
-#define FW_VERSION_MAJOR_T5 0
-#define FW_VERSION_MINOR_T5 0
-#define FW_VERSION_MICRO_T5 0
+#define T5FW_VERSION_MAJOR 0x01
+#define T5FW_VERSION_MINOR 0x08
+#define T5FW_VERSION_MICRO 0x1C
+#define T5FW_VERSION_BUILD 0x00
 
 #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)
 
@@ -240,6 +242,26 @@ struct pci_params {
        unsigned char width;
 };
 
+#define CHELSIO_CHIP_CODE(version, revision) (((version) << 4) | (revision))
+#define CHELSIO_CHIP_FPGA          0x100
+#define CHELSIO_CHIP_VERSION(code) (((code) >> 4) & 0xf)
+#define CHELSIO_CHIP_RELEASE(code) ((code) & 0xf)
+
+#define CHELSIO_T4             0x4
+#define CHELSIO_T5             0x5
+
+enum chip_type {
+       T4_A1 = CHELSIO_CHIP_CODE(CHELSIO_T4, 1),
+       T4_A2 = CHELSIO_CHIP_CODE(CHELSIO_T4, 2),
+       T4_FIRST_REV    = T4_A1,
+       T4_LAST_REV     = T4_A2,
+
+       T5_A0 = CHELSIO_CHIP_CODE(CHELSIO_T5, 0),
+       T5_A1 = CHELSIO_CHIP_CODE(CHELSIO_T5, 1),
+       T5_FIRST_REV    = T5_A0,
+       T5_LAST_REV     = T5_A1,
+};
+
 struct adapter_params {
        struct tp_params  tp;
        struct vpd_params vpd;
@@ -259,7 +281,7 @@ struct adapter_params {
 
        unsigned char nports;             /* # of ethernet ports */
        unsigned char portvec;
-       unsigned char rev;                /* chip revision */
+       enum chip_type chip;               /* chip code */
        unsigned char offload;
 
        unsigned char bypass;
@@ -267,6 +289,23 @@ struct adapter_params {
        unsigned int ofldq_wr_cred;
 };
 
+#include "t4fw_api.h"
+
+#define FW_VERSION(chip) ( \
+               FW_HDR_FW_VER_MAJOR_GET(chip##FW_VERSION_MAJOR) | \
+               FW_HDR_FW_VER_MINOR_GET(chip##FW_VERSION_MINOR) | \
+               FW_HDR_FW_VER_MICRO_GET(chip##FW_VERSION_MICRO) | \
+               FW_HDR_FW_VER_BUILD_GET(chip##FW_VERSION_BUILD))
+#define FW_INTFVER(chip, intf) (FW_HDR_INTFVER_##intf)
+
+struct fw_info {
+       u8 chip;
+       char *fs_name;
+       char *fw_mod_name;
+       struct fw_hdr fw_hdr;
+};
+
+
 struct trace_params {
        u32 data[TRACE_LEN / 4];
        u32 mask[TRACE_LEN / 4];
@@ -512,25 +551,6 @@ struct sge {
 
 struct l2t_data;
 
-#define CHELSIO_CHIP_CODE(version, revision) (((version) << 4) | (revision))
-#define CHELSIO_CHIP_VERSION(code) ((code) >> 4)
-#define CHELSIO_CHIP_RELEASE(code) ((code) & 0xf)
-
-#define CHELSIO_T4             0x4
-#define CHELSIO_T5             0x5
-
-enum chip_type {
-       T4_A1 = CHELSIO_CHIP_CODE(CHELSIO_T4, 0),
-       T4_A2 = CHELSIO_CHIP_CODE(CHELSIO_T4, 1),
-       T4_A3 = CHELSIO_CHIP_CODE(CHELSIO_T4, 2),
-       T4_FIRST_REV    = T4_A1,
-       T4_LAST_REV     = T4_A3,
-
-       T5_A1 = CHELSIO_CHIP_CODE(CHELSIO_T5, 0),
-       T5_FIRST_REV    = T5_A1,
-       T5_LAST_REV     = T5_A1,
-};
-
 #ifdef CONFIG_PCI_IOV
 
 /* T4 supports SRIOV on PF0-3 and T5 on PF0-7.  However, the Serial
@@ -715,12 +735,12 @@ enum {
 
 static inline int is_t5(enum chip_type chip)
 {
-       return (chip >= T5_FIRST_REV && chip <= T5_LAST_REV);
+       return CHELSIO_CHIP_VERSION(chip) == CHELSIO_T5;
 }
 
 static inline int is_t4(enum chip_type chip)
 {
-       return (chip >= T4_FIRST_REV && chip <= T4_LAST_REV);
+       return CHELSIO_CHIP_VERSION(chip) == CHELSIO_T4;
 }
 
 static inline u32 t4_read_reg(struct adapter *adap, u32 reg_addr)
@@ -900,7 +920,11 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p);
 int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size);
 unsigned int t4_flash_cfg_addr(struct adapter *adapter);
 int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size);
-int t4_check_fw_version(struct adapter *adapter);
+int t4_get_fw_version(struct adapter *adapter, u32 *vers);
+int t4_get_tp_version(struct adapter *adapter, u32 *vers);
+int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info,
+              const u8 *fw_data, unsigned int fw_size,
+              struct fw_hdr *card_fw, enum dev_state state, int *reset);
 int t4_prep_adapter(struct adapter *adapter);
 int t4_port_init(struct adapter *adap, int mbox, int pf, int vf);
 void t4_fatal_err(struct adapter *adapter);
index 8b929eeecd2d37cd3b41e32d57bd1fa50402a230..d6b12e035a7d9f27d84d397dc2921713c7fed46f 100644 (file)
@@ -276,9 +276,9 @@ static DEFINE_PCI_DEVICE_TABLE(cxgb4_pci_tbl) = {
        { 0, }
 };
 
-#define FW_FNAME "cxgb4/t4fw.bin"
+#define FW4_FNAME "cxgb4/t4fw.bin"
 #define FW5_FNAME "cxgb4/t5fw.bin"
-#define FW_CFNAME "cxgb4/t4-config.txt"
+#define FW4_CFNAME "cxgb4/t4-config.txt"
 #define FW5_CFNAME "cxgb4/t5-config.txt"
 
 MODULE_DESCRIPTION(DRV_DESC);
@@ -286,7 +286,7 @@ MODULE_AUTHOR("Chelsio Communications");
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_VERSION(DRV_VERSION);
 MODULE_DEVICE_TABLE(pci, cxgb4_pci_tbl);
-MODULE_FIRMWARE(FW_FNAME);
+MODULE_FIRMWARE(FW4_FNAME);
 MODULE_FIRMWARE(FW5_FNAME);
 
 /*
@@ -1070,72 +1070,6 @@ freeout: t4_free_sge_resources(adap);
        return 0;
 }
 
-/*
- * Returns 0 if new FW was successfully loaded, a positive errno if a load was
- * started but failed, and a negative errno if flash load couldn't start.
- */
-static int upgrade_fw(struct adapter *adap)
-{
-       int ret;
-       u32 vers, exp_major;
-       const struct fw_hdr *hdr;
-       const struct firmware *fw;
-       struct device *dev = adap->pdev_dev;
-       char *fw_file_name;
-
-       switch (CHELSIO_CHIP_VERSION(adap->chip)) {
-       case CHELSIO_T4:
-               fw_file_name = FW_FNAME;
-               exp_major = FW_VERSION_MAJOR;
-               break;
-       case CHELSIO_T5:
-               fw_file_name = FW5_FNAME;
-               exp_major = FW_VERSION_MAJOR_T5;
-               break;
-       default:
-               dev_err(dev, "Unsupported chip type, %x\n", adap->chip);
-               return -EINVAL;
-       }
-
-       ret = request_firmware(&fw, fw_file_name, dev);
-       if (ret < 0) {
-               dev_err(dev, "unable to load firmware image %s, error %d\n",
-                       fw_file_name, ret);
-               return ret;
-       }
-
-       hdr = (const struct fw_hdr *)fw->data;
-       vers = ntohl(hdr->fw_ver);
-       if (FW_HDR_FW_VER_MAJOR_GET(vers) != exp_major) {
-               ret = -EINVAL;              /* wrong major version, won't do */
-               goto out;
-       }
-
-       /*
-        * If the flash FW is unusable or we found something newer, load it.
-        */
-       if (FW_HDR_FW_VER_MAJOR_GET(adap->params.fw_vers) != exp_major ||
-           vers > adap->params.fw_vers) {
-               dev_info(dev, "upgrading firmware ...\n");
-               ret = t4_fw_upgrade(adap, adap->mbox, fw->data, fw->size,
-                                   /*force=*/false);
-               if (!ret)
-                       dev_info(dev,
-                                "firmware upgraded to version %pI4 from %s\n",
-                                &hdr->fw_ver, fw_file_name);
-               else
-                       dev_err(dev, "firmware upgrade failed! err=%d\n", -ret);
-       } else {
-               /*
-                * Tell our caller that we didn't upgrade the firmware.
-                */
-               ret = -EINVAL;
-       }
-
-out:   release_firmware(fw);
-       return ret;
-}
-
 /*
  * Allocate a chunk of memory using kmalloc or, if that fails, vmalloc.
  * The allocated memory is cleared.
@@ -1415,7 +1349,7 @@ static int get_sset_count(struct net_device *dev, int sset)
 static int get_regs_len(struct net_device *dev)
 {
        struct adapter *adap = netdev2adap(dev);
-       if (is_t4(adap->chip))
+       if (is_t4(adap->params.chip))
                return T4_REGMAP_SIZE;
        else
                return T5_REGMAP_SIZE;
@@ -1499,7 +1433,7 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
        data += sizeof(struct port_stats) / sizeof(u64);
        collect_sge_port_stats(adapter, pi, (struct queue_port_stats *)data);
        data += sizeof(struct queue_port_stats) / sizeof(u64);
-       if (!is_t4(adapter->chip)) {
+       if (!is_t4(adapter->params.chip)) {
                t4_write_reg(adapter, SGE_STAT_CFG, STATSOURCE_T5(7));
                val1 = t4_read_reg(adapter, SGE_STAT_TOTAL);
                val2 = t4_read_reg(adapter, SGE_STAT_MATCH);
@@ -1521,8 +1455,8 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
  */
 static inline unsigned int mk_adap_vers(const struct adapter *ap)
 {
-       return CHELSIO_CHIP_VERSION(ap->chip) |
-               (CHELSIO_CHIP_RELEASE(ap->chip) << 10) | (1 << 16);
+       return CHELSIO_CHIP_VERSION(ap->params.chip) |
+               (CHELSIO_CHIP_RELEASE(ap->params.chip) << 10) | (1 << 16);
 }
 
 static void reg_block_dump(struct adapter *ap, void *buf, unsigned int start,
@@ -2189,7 +2123,7 @@ static void get_regs(struct net_device *dev, struct ethtool_regs *regs,
        static const unsigned int *reg_ranges;
        int arr_size = 0, buf_size = 0;
 
-       if (is_t4(ap->chip)) {
+       if (is_t4(ap->params.chip)) {
                reg_ranges = &t4_reg_ranges[0];
                arr_size = ARRAY_SIZE(t4_reg_ranges);
                buf_size = T4_REGMAP_SIZE;
@@ -2967,7 +2901,7 @@ static int setup_debugfs(struct adapter *adap)
                size = t4_read_reg(adap, MA_EDRAM1_BAR);
                add_debugfs_mem(adap, "edc1", MEM_EDC1, EDRAM_SIZE_GET(size));
        }
-       if (is_t4(adap->chip)) {
+       if (is_t4(adap->params.chip)) {
                size = t4_read_reg(adap, MA_EXT_MEMORY_BAR);
                if (i & EXT_MEM_ENABLE)
                        add_debugfs_mem(adap, "mc", MEM_MC,
@@ -3419,7 +3353,7 @@ unsigned int cxgb4_dbfifo_count(const struct net_device *dev, int lpfifo)
 
        v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS);
        v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2);
-       if (is_t4(adap->chip)) {
+       if (is_t4(adap->params.chip)) {
                lp_count = G_LP_COUNT(v1);
                hp_count = G_HP_COUNT(v1);
        } else {
@@ -3588,7 +3522,7 @@ static void drain_db_fifo(struct adapter *adap, int usecs)
        do {
                v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS);
                v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2);
-               if (is_t4(adap->chip)) {
+               if (is_t4(adap->params.chip)) {
                        lp_count = G_LP_COUNT(v1);
                        hp_count = G_HP_COUNT(v1);
                } else {
@@ -3708,7 +3642,7 @@ static void process_db_drop(struct work_struct *work)
 
        adap = container_of(work, struct adapter, db_drop_task);
 
-       if (is_t4(adap->chip)) {
+       if (is_t4(adap->params.chip)) {
                disable_dbs(adap);
                notify_rdma_uld(adap, CXGB4_CONTROL_DB_DROP);
                drain_db_fifo(adap, 1);
@@ -3753,7 +3687,7 @@ static void process_db_drop(struct work_struct *work)
 
 void t4_db_full(struct adapter *adap)
 {
-       if (is_t4(adap->chip)) {
+       if (is_t4(adap->params.chip)) {
                t4_set_reg_field(adap, SGE_INT_ENABLE3,
                                 DBFIFO_HP_INT | DBFIFO_LP_INT, 0);
                queue_work(workq, &adap->db_full_task);
@@ -3762,7 +3696,7 @@ void t4_db_full(struct adapter *adap)
 
 void t4_db_dropped(struct adapter *adap)
 {
-       if (is_t4(adap->chip))
+       if (is_t4(adap->params.chip))
                queue_work(workq, &adap->db_drop_task);
 }
 
@@ -3789,7 +3723,7 @@ static void uld_attach(struct adapter *adap, unsigned int uld)
        lli.nchan = adap->params.nports;
        lli.nports = adap->params.nports;
        lli.wr_cred = adap->params.ofldq_wr_cred;
-       lli.adapter_type = adap->params.rev;
+       lli.adapter_type = adap->params.chip;
        lli.iscsi_iolen = MAXRXDATA_GET(t4_read_reg(adap, TP_PARA_REG2));
        lli.udb_density = 1 << QUEUESPERPAGEPF0_GET(
                        t4_read_reg(adap, SGE_EGRESS_QUEUES_PER_PAGE_PF) >>
@@ -4483,7 +4417,7 @@ static void setup_memwin(struct adapter *adap)
        u32 bar0, mem_win0_base, mem_win1_base, mem_win2_base;
 
        bar0 = pci_resource_start(adap->pdev, 0);  /* truncation intentional */
-       if (is_t4(adap->chip)) {
+       if (is_t4(adap->params.chip)) {
                mem_win0_base = bar0 + MEMWIN0_BASE;
                mem_win1_base = bar0 + MEMWIN1_BASE;
                mem_win2_base = bar0 + MEMWIN2_BASE;
@@ -4668,8 +4602,10 @@ static int adap_init0_config(struct adapter *adapter, int reset)
        const struct firmware *cf;
        unsigned long mtype = 0, maddr = 0;
        u32 finiver, finicsum, cfcsum;
-       int ret, using_flash;
+       int ret;
+       int config_issued = 0;
        char *fw_config_file, fw_config_file_path[256];
+       char *config_name = NULL;
 
        /*
         * Reset device if necessary.
@@ -4686,9 +4622,9 @@ static int adap_init0_config(struct adapter *adapter, int reset)
         * then use that.  Otherwise, use the configuration file stored
         * in the adapter flash ...
         */
-       switch (CHELSIO_CHIP_VERSION(adapter->chip)) {
+       switch (CHELSIO_CHIP_VERSION(adapter->params.chip)) {
        case CHELSIO_T4:
-               fw_config_file = FW_CFNAME;
+               fw_config_file = FW4_CFNAME;
                break;
        case CHELSIO_T5:
                fw_config_file = FW5_CFNAME;
@@ -4702,13 +4638,16 @@ static int adap_init0_config(struct adapter *adapter, int reset)
 
        ret = request_firmware(&cf, fw_config_file, adapter->pdev_dev);
        if (ret < 0) {
-               using_flash = 1;
+               config_name = "On FLASH";
                mtype = FW_MEMTYPE_CF_FLASH;
                maddr = t4_flash_cfg_addr(adapter);
        } else {
                u32 params[7], val[7];
 
-               using_flash = 0;
+               sprintf(fw_config_file_path,
+                       "/lib/firmware/%s", fw_config_file);
+               config_name = fw_config_file_path;
+
                if (cf->size >= FLASH_CFG_MAX_SIZE)
                        ret = -ENOMEM;
                else {
@@ -4776,6 +4715,26 @@ static int adap_init0_config(struct adapter *adapter, int reset)
                      FW_LEN16(caps_cmd));
        ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd),
                         &caps_cmd);
+
+       /* If the CAPS_CONFIG failed with an ENOENT (for a Firmware
+        * Configuration File in FLASH), our last gasp effort is to use the
+        * Firmware Configuration File which is embedded in the firmware.  A
+        * very few early versions of the firmware didn't have one embedded
+        * but we can ignore those.
+        */
+       if (ret == -ENOENT) {
+               memset(&caps_cmd, 0, sizeof(caps_cmd));
+               caps_cmd.op_to_write =
+                       htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
+                                       FW_CMD_REQUEST |
+                                       FW_CMD_READ);
+               caps_cmd.cfvalid_to_len16 = htonl(FW_LEN16(caps_cmd));
+               ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd,
+                               sizeof(caps_cmd), &caps_cmd);
+               config_name = "Firmware Default";
+       }
+
+       config_issued = 1;
        if (ret < 0)
                goto bye;
 
@@ -4816,7 +4775,6 @@ static int adap_init0_config(struct adapter *adapter, int reset)
        if (ret < 0)
                goto bye;
 
-       sprintf(fw_config_file_path, "/lib/firmware/%s", fw_config_file);
        /*
         * Return successfully and note that we're operating with parameters
         * not supplied by the driver, rather than from hard-wired
@@ -4824,11 +4782,8 @@ static int adap_init0_config(struct adapter *adapter, int reset)
         */
        adapter->flags |= USING_SOFT_PARAMS;
        dev_info(adapter->pdev_dev, "Successfully configured using Firmware "\
-                "Configuration File %s, version %#x, computed checksum %#x\n",
-                (using_flash
-                 ? "in device FLASH"
-                 : fw_config_file_path),
-                finiver, cfcsum);
+                "Configuration File \"%s\", version %#x, computed checksum %#x\n",
+                config_name, finiver, cfcsum);
        return 0;
 
        /*
@@ -4837,9 +4792,9 @@ static int adap_init0_config(struct adapter *adapter, int reset)
         * want to issue a warning since this is fairly common.)
         */
 bye:
-       if (ret != -ENOENT)
-               dev_warn(adapter->pdev_dev, "Configuration file error %d\n",
-                        -ret);
+       if (config_issued && ret != -ENOENT)
+               dev_warn(adapter->pdev_dev, "\"%s\" configuration file error %d\n",
+                        config_name, -ret);
        return ret;
 }
 
@@ -5086,6 +5041,47 @@ bye:
        return ret;
 }
 
+static struct fw_info fw_info_array[] = {
+       {
+               .chip = CHELSIO_T4,
+               .fs_name = FW4_CFNAME,
+               .fw_mod_name = FW4_FNAME,
+               .fw_hdr = {
+                       .chip = FW_HDR_CHIP_T4,
+                       .fw_ver = __cpu_to_be32(FW_VERSION(T4)),
+                       .intfver_nic = FW_INTFVER(T4, NIC),
+                       .intfver_vnic = FW_INTFVER(T4, VNIC),
+                       .intfver_ri = FW_INTFVER(T4, RI),
+                       .intfver_iscsi = FW_INTFVER(T4, ISCSI),
+                       .intfver_fcoe = FW_INTFVER(T4, FCOE),
+               },
+       }, {
+               .chip = CHELSIO_T5,
+               .fs_name = FW5_CFNAME,
+               .fw_mod_name = FW5_FNAME,
+               .fw_hdr = {
+                       .chip = FW_HDR_CHIP_T5,
+                       .fw_ver = __cpu_to_be32(FW_VERSION(T5)),
+                       .intfver_nic = FW_INTFVER(T5, NIC),
+                       .intfver_vnic = FW_INTFVER(T5, VNIC),
+                       .intfver_ri = FW_INTFVER(T5, RI),
+                       .intfver_iscsi = FW_INTFVER(T5, ISCSI),
+                       .intfver_fcoe = FW_INTFVER(T5, FCOE),
+               },
+       }
+};
+
+static struct fw_info *find_fw_info(int chip)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(fw_info_array); i++) {
+               if (fw_info_array[i].chip == chip)
+                       return &fw_info_array[i];
+       }
+       return NULL;
+}
+
 /*
  * Phase 0 of initialization: contact FW, obtain config, perform basic init.
  */
@@ -5123,44 +5119,54 @@ static int adap_init0(struct adapter *adap)
         * later reporting and B. to warn if the currently loaded firmware
         * is excessively mismatched relative to the driver.)
         */
-       ret = t4_check_fw_version(adap);
-
-       /* The error code -EFAULT is returned by t4_check_fw_version() if
-        * firmware on adapter < supported firmware. If firmware on adapter
-        * is too old (not supported by driver) and we're the MASTER_PF set
-        * adapter state to DEV_STATE_UNINIT to force firmware upgrade
-        * and reinitialization.
-        */
-       if ((adap->flags & MASTER_PF) && ret == -EFAULT)
-               state = DEV_STATE_UNINIT;
+       t4_get_fw_version(adap, &adap->params.fw_vers);
+       t4_get_tp_version(adap, &adap->params.tp_vers);
        if ((adap->flags & MASTER_PF) && state != DEV_STATE_INIT) {
-               if (ret == -EINVAL || ret == -EFAULT || ret > 0) {
-                       if (upgrade_fw(adap) >= 0) {
-                               /*
-                                * Note that the chip was reset as part of the
-                                * firmware upgrade so we don't reset it again
-                                * below and grab the new firmware version.
-                                */
-                               reset = 0;
-                               ret = t4_check_fw_version(adap);
-                       } else
-                               if (ret == -EFAULT) {
-                                       /*
-                                        * Firmware is old but still might
-                                        * work if we force reinitialization
-                                        * of the adapter. Ignoring FW upgrade
-                                        * failure.
-                                        */
-                                       dev_warn(adap->pdev_dev,
-                                                "Ignoring firmware upgrade "
-                                                "failure, and forcing driver "
-                                                "to reinitialize the "
-                                                "adapter.\n");
-                                       ret = 0;
-                               }
+               struct fw_info *fw_info;
+               struct fw_hdr *card_fw;
+               const struct firmware *fw;
+               const u8 *fw_data = NULL;
+               unsigned int fw_size = 0;
+
+               /* This is the firmware whose headers the driver was compiled
+                * against
+                */
+               fw_info = find_fw_info(CHELSIO_CHIP_VERSION(adap->params.chip));
+               if (fw_info == NULL) {
+                       dev_err(adap->pdev_dev,
+                               "unable to get firmware info for chip %d.\n",
+                               CHELSIO_CHIP_VERSION(adap->params.chip));
+                       return -EINVAL;
                }
+
+               /* allocate memory to read the header of the firmware on the
+                * card
+                */
+               card_fw = t4_alloc_mem(sizeof(*card_fw));
+
+               /* Get FW from from /lib/firmware/ */
+               ret = request_firmware(&fw, fw_info->fw_mod_name,
+                                      adap->pdev_dev);
+               if (ret < 0) {
+                       dev_err(adap->pdev_dev,
+                               "unable to load firmware image %s, error %d\n",
+                               fw_info->fw_mod_name, ret);
+               } else {
+                       fw_data = fw->data;
+                       fw_size = fw->size;
+               }
+
+               /* upgrade FW logic */
+               ret = t4_prep_fw(adap, fw_info, fw_data, fw_size, card_fw,
+                                state, &reset);
+
+               /* Cleaning up */
+               if (fw != NULL)
+                       release_firmware(fw);
+               t4_free_mem(card_fw);
+
                if (ret < 0)
-                       return ret;
+                       goto bye;
        }
 
        /*
@@ -5245,7 +5251,7 @@ static int adap_init0(struct adapter *adap)
                                if (ret == -ENOENT) {
                                        dev_info(adap->pdev_dev,
                                            "No Configuration File present "
-                                           "on adapter.  Using hard-wired "
+                                           "on adapter. Using hard-wired "
                                            "configuration parameters.\n");
                                        ret = adap_init0_no_config(adap, reset);
                                }
@@ -5787,7 +5793,7 @@ static void print_port_info(const struct net_device *dev)
 
        netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n",
                    adap->params.vpd.id,
-                   CHELSIO_CHIP_RELEASE(adap->params.rev), buf,
+                   CHELSIO_CHIP_RELEASE(adap->params.chip), buf,
                    is_offload(adap) ? "R" : "", adap->params.pci.width, spd,
                    (adap->flags & USING_MSIX) ? " MSI-X" :
                    (adap->flags & USING_MSI) ? " MSI" : "");
@@ -5910,7 +5916,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (err)
                goto out_unmap_bar0;
 
-       if (!is_t4(adapter->chip)) {
+       if (!is_t4(adapter->params.chip)) {
                s_qpp = QUEUESPERPAGEPF1 * adapter->fn;
                qpp = 1 << QUEUESPERPAGEPF0_GET(t4_read_reg(adapter,
                      SGE_EGRESS_QUEUES_PER_PAGE_PF) >> s_qpp);
@@ -6064,7 +6070,7 @@ sriov:
  out_free_dev:
        free_some_resources(adapter);
  out_unmap_bar:
-       if (!is_t4(adapter->chip))
+       if (!is_t4(adapter->params.chip))
                iounmap(adapter->bar2);
  out_unmap_bar0:
        iounmap(adapter->regs);
@@ -6116,7 +6122,7 @@ static void remove_one(struct pci_dev *pdev)
 
                free_some_resources(adapter);
                iounmap(adapter->regs);
-               if (!is_t4(adapter->chip))
+               if (!is_t4(adapter->params.chip))
                        iounmap(adapter->bar2);
                kfree(adapter);
                pci_disable_pcie_error_reporting(pdev);
index ac311f5f3eb9590d1d9b5fb3bb0a9c3f0fac5ce7..cc380c36e1a8687cd1c7f3b4c3dbf2d0b8c1bf47 100644 (file)
@@ -509,7 +509,7 @@ static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q)
        u32 val;
        if (q->pend_cred >= 8) {
                val = PIDX(q->pend_cred / 8);
-               if (!is_t4(adap->chip))
+               if (!is_t4(adap->params.chip))
                        val |= DBTYPE(1);
                wmb();
                t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL), DBPRIO(1) |
@@ -847,7 +847,7 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n)
        wmb();            /* write descriptors before telling HW */
        spin_lock(&q->db_lock);
        if (!q->db_disabled) {
-               if (is_t4(adap->chip)) {
+               if (is_t4(adap->params.chip)) {
                        t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
                                     QID(q->cntxt_id) | PIDX(n));
                } else {
@@ -1596,7 +1596,7 @@ static noinline int handle_trace_pkt(struct adapter *adap,
                return 0;
        }
 
-       if (is_t4(adap->chip))
+       if (is_t4(adap->params.chip))
                __skb_pull(skb, sizeof(struct cpl_trace_pkt));
        else
                __skb_pull(skb, sizeof(struct cpl_t5_trace_pkt));
@@ -1661,7 +1661,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
        const struct cpl_rx_pkt *pkt;
        struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq);
        struct sge *s = &q->adap->sge;
-       int cpl_trace_pkt = is_t4(q->adap->chip) ?
+       int cpl_trace_pkt = is_t4(q->adap->params.chip) ?
                            CPL_TRACE_PKT : CPL_TRACE_PKT_T5;
 
        if (unlikely(*(u8 *)rsp == cpl_trace_pkt))
@@ -2182,7 +2182,7 @@ err:
 static void init_txq(struct adapter *adap, struct sge_txq *q, unsigned int id)
 {
        q->cntxt_id = id;
-       if (!is_t4(adap->chip)) {
+       if (!is_t4(adap->params.chip)) {
                unsigned int s_qpp;
                unsigned short udb_density;
                unsigned long qpshift;
@@ -2641,7 +2641,7 @@ static int t4_sge_init_hard(struct adapter *adap)
         * Set up to drop DOORBELL writes when the DOORBELL FIFO overflows
         * and generate an interrupt when this occurs so we can recover.
         */
-       if (is_t4(adap->chip)) {
+       if (is_t4(adap->params.chip)) {
                t4_set_reg_field(adap, A_SGE_DBFIFO_STATUS,
                                 V_HP_INT_THRESH(M_HP_INT_THRESH) |
                                 V_LP_INT_THRESH(M_LP_INT_THRESH),
index 4cbb2f9850be554c9ec48afd7479b4fcd9e5ebc2..74a6fce5a15a6914faf74bbf903dcc76ec717775 100644 (file)
@@ -296,7 +296,7 @@ int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc)
        u32 mc_bist_cmd, mc_bist_cmd_addr, mc_bist_cmd_len;
        u32 mc_bist_status_rdata, mc_bist_data_pattern;
 
-       if (is_t4(adap->chip)) {
+       if (is_t4(adap->params.chip)) {
                mc_bist_cmd = MC_BIST_CMD;
                mc_bist_cmd_addr = MC_BIST_CMD_ADDR;
                mc_bist_cmd_len = MC_BIST_CMD_LEN;
@@ -349,7 +349,7 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc)
        u32 edc_bist_cmd, edc_bist_cmd_addr, edc_bist_cmd_len;
        u32 edc_bist_cmd_data_pattern, edc_bist_status_rdata;
 
-       if (is_t4(adap->chip)) {
+       if (is_t4(adap->params.chip)) {
                edc_bist_cmd = EDC_REG(EDC_BIST_CMD, idx);
                edc_bist_cmd_addr = EDC_REG(EDC_BIST_CMD_ADDR, idx);
                edc_bist_cmd_len = EDC_REG(EDC_BIST_CMD_LEN, idx);
@@ -402,7 +402,7 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc)
 static int t4_mem_win_rw(struct adapter *adap, u32 addr, __be32 *data, int dir)
 {
        int i;
-       u32 win_pf = is_t4(adap->chip) ? 0 : V_PFNUM(adap->fn);
+       u32 win_pf = is_t4(adap->params.chip) ? 0 : V_PFNUM(adap->fn);
 
        /*
         * Setup offset into PCIE memory window.  Address must be a
@@ -863,104 +863,169 @@ unlock:
 }
 
 /**
- *     get_fw_version - read the firmware version
+ *     t4_get_fw_version - read the firmware version
  *     @adapter: the adapter
  *     @vers: where to place the version
  *
  *     Reads the FW version from flash.
  */
-static int get_fw_version(struct adapter *adapter, u32 *vers)
+int t4_get_fw_version(struct adapter *adapter, u32 *vers)
 {
-       return t4_read_flash(adapter, adapter->params.sf_fw_start +
-                            offsetof(struct fw_hdr, fw_ver), 1, vers, 0);
+       return t4_read_flash(adapter, FLASH_FW_START +
+                            offsetof(struct fw_hdr, fw_ver), 1,
+                            vers, 0);
 }
 
 /**
- *     get_tp_version - read the TP microcode version
+ *     t4_get_tp_version - read the TP microcode version
  *     @adapter: the adapter
  *     @vers: where to place the version
  *
  *     Reads the TP microcode version from flash.
  */
-static int get_tp_version(struct adapter *adapter, u32 *vers)
+int t4_get_tp_version(struct adapter *adapter, u32 *vers)
 {
-       return t4_read_flash(adapter, adapter->params.sf_fw_start +
+       return t4_read_flash(adapter, FLASH_FW_START +
                             offsetof(struct fw_hdr, tp_microcode_ver),
                             1, vers, 0);
 }
 
-/**
- *     t4_check_fw_version - check if the FW is compatible with this driver
- *     @adapter: the adapter
- *
- *     Checks if an adapter's FW is compatible with the driver.  Returns 0
- *     if there's exact match, a negative error if the version could not be
- *     read or there's a major version mismatch, and a positive value if the
- *     expected major version is found but there's a minor version mismatch.
+/* Is the given firmware API compatible with the one the driver was compiled
+ * with?
  */
-int t4_check_fw_version(struct adapter *adapter)
+static int fw_compatible(const struct fw_hdr *hdr1, const struct fw_hdr *hdr2)
 {
-       u32 api_vers[2];
-       int ret, major, minor, micro;
-       int exp_major, exp_minor, exp_micro;
 
-       ret = get_fw_version(adapter, &adapter->params.fw_vers);
-       if (!ret)
-               ret = get_tp_version(adapter, &adapter->params.tp_vers);
-       if (!ret)
-               ret = t4_read_flash(adapter, adapter->params.sf_fw_start +
-                                   offsetof(struct fw_hdr, intfver_nic),
-                                   2, api_vers, 1);
-       if (ret)
-               return ret;
+       /* short circuit if it's the exact same firmware version */
+       if (hdr1->chip == hdr2->chip && hdr1->fw_ver == hdr2->fw_ver)
+               return 1;
 
-       major = FW_HDR_FW_VER_MAJOR_GET(adapter->params.fw_vers);
-       minor = FW_HDR_FW_VER_MINOR_GET(adapter->params.fw_vers);
-       micro = FW_HDR_FW_VER_MICRO_GET(adapter->params.fw_vers);
+#define SAME_INTF(x) (hdr1->intfver_##x == hdr2->intfver_##x)
+       if (hdr1->chip == hdr2->chip && SAME_INTF(nic) && SAME_INTF(vnic) &&
+           SAME_INTF(ri) && SAME_INTF(iscsi) && SAME_INTF(fcoe))
+               return 1;
+#undef SAME_INTF
 
-       switch (CHELSIO_CHIP_VERSION(adapter->chip)) {
-       case CHELSIO_T4:
-               exp_major = FW_VERSION_MAJOR;
-               exp_minor = FW_VERSION_MINOR;
-               exp_micro = FW_VERSION_MICRO;
-               break;
-       case CHELSIO_T5:
-               exp_major = FW_VERSION_MAJOR_T5;
-               exp_minor = FW_VERSION_MINOR_T5;
-               exp_micro = FW_VERSION_MICRO_T5;
-               break;
-       default:
-               dev_err(adapter->pdev_dev, "Unsupported chip type, %x\n",
-                       adapter->chip);
-               return -EINVAL;
-       }
+       return 0;
+}
 
-       memcpy(adapter->params.api_vers, api_vers,
-              sizeof(adapter->params.api_vers));
+/* The firmware in the filesystem is usable, but should it be installed?
+ * This routine explains itself in detail if it indicates the filesystem
+ * firmware should be installed.
+ */
+static int should_install_fs_fw(struct adapter *adap, int card_fw_usable,
+                               int k, int c)
+{
+       const char *reason;
 
-       if (major < exp_major || (major == exp_major && minor < exp_minor) ||
-           (major == exp_major && minor == exp_minor && micro < exp_micro)) {
-               dev_err(adapter->pdev_dev,
-                       "Card has firmware version %u.%u.%u, minimum "
-                       "supported firmware is %u.%u.%u.\n", major, minor,
-                       micro, exp_major, exp_minor, exp_micro);
-               return -EFAULT;
+       if (!card_fw_usable) {
+               reason = "incompatible or unusable";
+               goto install;
        }
 
-       if (major != exp_major) {            /* major mismatch - fail */
-               dev_err(adapter->pdev_dev,
-                       "card FW has major version %u, driver wants %u\n",
-                       major, exp_major);
-               return -EINVAL;
+       if (k > c) {
+               reason = "older than the version supported with this driver";
+               goto install;
        }
 
-       if (minor == exp_minor && micro == exp_micro)
-               return 0;                                   /* perfect match */
+       return 0;
+
+install:
+       dev_err(adap->pdev_dev, "firmware on card (%u.%u.%u.%u) is %s, "
+               "installing firmware %u.%u.%u.%u on card.\n",
+               FW_HDR_FW_VER_MAJOR_GET(c), FW_HDR_FW_VER_MINOR_GET(c),
+               FW_HDR_FW_VER_MICRO_GET(c), FW_HDR_FW_VER_BUILD_GET(c), reason,
+               FW_HDR_FW_VER_MAJOR_GET(k), FW_HDR_FW_VER_MINOR_GET(k),
+               FW_HDR_FW_VER_MICRO_GET(k), FW_HDR_FW_VER_BUILD_GET(k));
 
-       /* Minor/micro version mismatch.  Report it but often it's OK. */
        return 1;
 }
 
+int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info,
+              const u8 *fw_data, unsigned int fw_size,
+              struct fw_hdr *card_fw, enum dev_state state,
+              int *reset)
+{
+       int ret, card_fw_usable, fs_fw_usable;
+       const struct fw_hdr *fs_fw;
+       const struct fw_hdr *drv_fw;
+
+       drv_fw = &fw_info->fw_hdr;
+
+       /* Read the header of the firmware on the card */
+       ret = -t4_read_flash(adap, FLASH_FW_START,
+                           sizeof(*card_fw) / sizeof(uint32_t),
+                           (uint32_t *)card_fw, 1);
+       if (ret == 0) {
+               card_fw_usable = fw_compatible(drv_fw, (const void *)card_fw);
+       } else {
+               dev_err(adap->pdev_dev,
+                       "Unable to read card's firmware header: %d\n", ret);
+               card_fw_usable = 0;
+       }
+
+       if (fw_data != NULL) {
+               fs_fw = (const void *)fw_data;
+               fs_fw_usable = fw_compatible(drv_fw, fs_fw);
+       } else {
+               fs_fw = NULL;
+               fs_fw_usable = 0;
+       }
+
+       if (card_fw_usable && card_fw->fw_ver == drv_fw->fw_ver &&
+           (!fs_fw_usable || fs_fw->fw_ver == drv_fw->fw_ver)) {
+               /* Common case: the firmware on the card is an exact match and
+                * the filesystem one is an exact match too, or the filesystem
+                * one is absent/incompatible.
+                */
+       } else if (fs_fw_usable && state == DEV_STATE_UNINIT &&
+                  should_install_fs_fw(adap, card_fw_usable,
+                                       be32_to_cpu(fs_fw->fw_ver),
+                                       be32_to_cpu(card_fw->fw_ver))) {
+               ret = -t4_fw_upgrade(adap, adap->mbox, fw_data,
+                                    fw_size, 0);
+               if (ret != 0) {
+                       dev_err(adap->pdev_dev,
+                               "failed to install firmware: %d\n", ret);
+                       goto bye;
+               }
+
+               /* Installed successfully, update the cached header too. */
+               memcpy(card_fw, fs_fw, sizeof(*card_fw));
+               card_fw_usable = 1;
+               *reset = 0;     /* already reset as part of load_fw */
+       }
+
+       if (!card_fw_usable) {
+               uint32_t d, c, k;
+
+               d = be32_to_cpu(drv_fw->fw_ver);
+               c = be32_to_cpu(card_fw->fw_ver);
+               k = fs_fw ? be32_to_cpu(fs_fw->fw_ver) : 0;
+
+               dev_err(adap->pdev_dev, "Cannot find a usable firmware: "
+                       "chip state %d, "
+                       "driver compiled with %d.%d.%d.%d, "
+                       "card has %d.%d.%d.%d, filesystem has %d.%d.%d.%d\n",
+                       state,
+                       FW_HDR_FW_VER_MAJOR_GET(d), FW_HDR_FW_VER_MINOR_GET(d),
+                       FW_HDR_FW_VER_MICRO_GET(d), FW_HDR_FW_VER_BUILD_GET(d),
+                       FW_HDR_FW_VER_MAJOR_GET(c), FW_HDR_FW_VER_MINOR_GET(c),
+                       FW_HDR_FW_VER_MICRO_GET(c), FW_HDR_FW_VER_BUILD_GET(c),
+                       FW_HDR_FW_VER_MAJOR_GET(k), FW_HDR_FW_VER_MINOR_GET(k),
+                       FW_HDR_FW_VER_MICRO_GET(k), FW_HDR_FW_VER_BUILD_GET(k));
+               ret = EINVAL;
+               goto bye;
+       }
+
+       /* We're using whatever's on the card and it's known to be good. */
+       adap->params.fw_vers = be32_to_cpu(card_fw->fw_ver);
+       adap->params.tp_vers = be32_to_cpu(card_fw->tp_microcode_ver);
+
+bye:
+       return ret;
+}
+
 /**
  *     t4_flash_erase_sectors - erase a range of flash sectors
  *     @adapter: the adapter
@@ -1368,7 +1433,7 @@ static void pcie_intr_handler(struct adapter *adapter)
                                    PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS,
                                    pcie_port_intr_info) +
              t4_handle_intr_status(adapter, PCIE_INT_CAUSE,
-                                   is_t4(adapter->chip) ?
+                                   is_t4(adapter->params.chip) ?
                                    pcie_intr_info : t5_pcie_intr_info);
 
        if (fat)
@@ -1782,7 +1847,7 @@ static void xgmac_intr_handler(struct adapter *adap, int port)
 {
        u32 v, int_cause_reg;
 
-       if (is_t4(adap->chip))
+       if (is_t4(adap->params.chip))
                int_cause_reg = PORT_REG(port, XGMAC_PORT_INT_CAUSE);
        else
                int_cause_reg = T5_PORT_REG(port, MAC_PORT_INT_CAUSE);
@@ -2250,7 +2315,7 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p)
 
 #define GET_STAT(name) \
        t4_read_reg64(adap, \
-       (is_t4(adap->chip) ? PORT_REG(idx, MPS_PORT_STAT_##name##_L) : \
+       (is_t4(adap->params.chip) ? PORT_REG(idx, MPS_PORT_STAT_##name##_L) : \
        T5_PORT_REG(idx, MPS_PORT_STAT_##name##_L)))
 #define GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L)
 
@@ -2332,7 +2397,7 @@ void t4_wol_magic_enable(struct adapter *adap, unsigned int port,
 {
        u32 mag_id_reg_l, mag_id_reg_h, port_cfg_reg;
 
-       if (is_t4(adap->chip)) {
+       if (is_t4(adap->params.chip)) {
                mag_id_reg_l = PORT_REG(port, XGMAC_PORT_MAGIC_MACID_LO);
                mag_id_reg_h = PORT_REG(port, XGMAC_PORT_MAGIC_MACID_HI);
                port_cfg_reg = PORT_REG(port, XGMAC_PORT_CFG2);
@@ -2374,7 +2439,7 @@ int t4_wol_pat_enable(struct adapter *adap, unsigned int port, unsigned int map,
        int i;
        u32 port_cfg_reg;
 
-       if (is_t4(adap->chip))
+       if (is_t4(adap->params.chip))
                port_cfg_reg = PORT_REG(port, XGMAC_PORT_CFG2);
        else
                port_cfg_reg = T5_PORT_REG(port, MAC_PORT_CFG2);
@@ -2387,7 +2452,7 @@ int t4_wol_pat_enable(struct adapter *adap, unsigned int port, unsigned int map,
                return -EINVAL;
 
 #define EPIO_REG(name) \
-       (is_t4(adap->chip) ? PORT_REG(port, XGMAC_PORT_EPIO_##name) : \
+       (is_t4(adap->params.chip) ? PORT_REG(port, XGMAC_PORT_EPIO_##name) : \
        T5_PORT_REG(port, MAC_PORT_EPIO_##name))
 
        t4_write_reg(adap, EPIO_REG(DATA1), mask0 >> 32);
@@ -2474,7 +2539,7 @@ int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox,
 int t4_mem_win_read_len(struct adapter *adap, u32 addr, __be32 *data, int len)
 {
        int i, off;
-       u32 win_pf = is_t4(adap->chip) ? 0 : V_PFNUM(adap->fn);
+       u32 win_pf = is_t4(adap->params.chip) ? 0 : V_PFNUM(adap->fn);
 
        /* Align on a 2KB boundary.
         */
@@ -3306,7 +3371,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox,
        int i, ret;
        struct fw_vi_mac_cmd c;
        struct fw_vi_mac_exact *p;
-       unsigned int max_naddr = is_t4(adap->chip) ?
+       unsigned int max_naddr = is_t4(adap->params.chip) ?
                                       NUM_MPS_CLS_SRAM_L_INSTANCES :
                                       NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
 
@@ -3368,7 +3433,7 @@ int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid,
        int ret, mode;
        struct fw_vi_mac_cmd c;
        struct fw_vi_mac_exact *p = c.u.exact;
-       unsigned int max_mac_addr = is_t4(adap->chip) ?
+       unsigned int max_mac_addr = is_t4(adap->params.chip) ?
                                    NUM_MPS_CLS_SRAM_L_INSTANCES :
                                    NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
 
@@ -3699,13 +3764,14 @@ int t4_prep_adapter(struct adapter *adapter)
 {
        int ret, ver;
        uint16_t device_id;
+       u32 pl_rev;
 
        ret = t4_wait_dev_ready(adapter);
        if (ret < 0)
                return ret;
 
        get_pci_mode(adapter, &adapter->params.pci);
-       adapter->params.rev = t4_read_reg(adapter, PL_REV);
+       pl_rev = G_REV(t4_read_reg(adapter, PL_REV));
 
        ret = get_flash_params(adapter);
        if (ret < 0) {
@@ -3717,14 +3783,13 @@ int t4_prep_adapter(struct adapter *adapter)
         */
        pci_read_config_word(adapter->pdev, PCI_DEVICE_ID, &device_id);
        ver = device_id >> 12;
+       adapter->params.chip = 0;
        switch (ver) {
        case CHELSIO_T4:
-               adapter->chip = CHELSIO_CHIP_CODE(CHELSIO_T4,
-                                                 adapter->params.rev);
+               adapter->params.chip |= CHELSIO_CHIP_CODE(CHELSIO_T4, pl_rev);
                break;
        case CHELSIO_T5:
-               adapter->chip = CHELSIO_CHIP_CODE(CHELSIO_T5,
-                                                 adapter->params.rev);
+               adapter->params.chip |= CHELSIO_CHIP_CODE(CHELSIO_T5, pl_rev);
                break;
        default:
                dev_err(adapter->pdev_dev, "Device %d is not supported\n",
@@ -3732,9 +3797,6 @@ int t4_prep_adapter(struct adapter *adapter)
                return -EINVAL;
        }
 
-       /* Reassign the updated revision field */
-       adapter->params.rev = adapter->chip;
-
        init_cong_ctrl(adapter->params.a_wnd, adapter->params.b_wnd);
 
        /*
index ef146c0ba4814ef5abff64794075b9d5e806c62b..0a8205d69d2c290aae4dbec30245c9dc3e18bd39 100644 (file)
 
 #define PL_REV 0x1943c
 
+#define S_REV    0
+#define M_REV    0xfU
+#define V_REV(x) ((x) << S_REV)
+#define G_REV(x) (((x) >> S_REV) & M_REV)
+
 #define LE_DB_CONFIG 0x19c04
 #define  HASHEN 0x00100000U
 
 #define EDC_STRIDE_T5 (EDC_T51_BASE_ADDR - EDC_T50_BASE_ADDR)
 #define EDC_REG_T5(reg, idx) (reg + EDC_STRIDE_T5 * idx)
 
+#define A_PL_VF_REV 0x4
+#define A_PL_VF_WHOAMI 0x0
+#define A_PL_VF_REVISION 0x8
+
+#define S_CHIPID    4
+#define M_CHIPID    0xfU
+#define V_CHIPID(x) ((x) << S_CHIPID)
+#define G_CHIPID(x) (((x) >> S_CHIPID) & M_CHIPID)
+
 #endif /* __T4_REGS_H */
index 6f77ac487743edfbe899f470805f58cc38d9c61b..74fea74ce0aa25a676045868fa0b48c4a3800860 100644 (file)
@@ -2157,7 +2157,7 @@ struct fw_debug_cmd {
 
 struct fw_hdr {
        u8 ver;
-       u8 reserved1;
+       u8 chip;                        /* terminator chip type */
        __be16  len512;                 /* bin length in units of 512-bytes */
        __be32  fw_ver;                 /* firmware version */
        __be32  tp_microcode_ver;
@@ -2176,6 +2176,11 @@ struct fw_hdr {
        __be32  reserved6[23];
 };
 
+enum fw_hdr_chip {
+       FW_HDR_CHIP_T4,
+       FW_HDR_CHIP_T5
+};
+
 #define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff)
 #define FW_HDR_FW_VER_MINOR_GET(x) (((x) >> 16) & 0xff)
 #define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff)
index be5c7ef6ca939654365b6aec6dc108e03e0f74d9..68eaa9c88c7d8a77646bd217e00877a281254a59 100644 (file)
@@ -344,7 +344,6 @@ struct adapter {
        unsigned long registered_device_map;
        unsigned long open_device_map;
        unsigned long flags;
-       enum chip_type chip;
        struct adapter_params params;
 
        /* queue and interrupt resources */
index 5f90ec5f7519a4ac6e7916396cff31446f5c614b..0899c098359446346f7abe1939ac214705fd0acb 100644 (file)
@@ -1064,7 +1064,7 @@ static inline unsigned int mk_adap_vers(const struct adapter *adapter)
        /*
         * Chip version 4, revision 0x3f (cxgb4vf).
         */
-       return CHELSIO_CHIP_VERSION(adapter->chip) | (0x3f << 10);
+       return CHELSIO_CHIP_VERSION(adapter->params.chip) | (0x3f << 10);
 }
 
 /*
@@ -1551,9 +1551,13 @@ static void cxgb4vf_get_regs(struct net_device *dev,
        reg_block_dump(adapter, regbuf,
                       T4VF_MPS_BASE_ADDR + T4VF_MOD_MAP_MPS_FIRST,
                       T4VF_MPS_BASE_ADDR + T4VF_MOD_MAP_MPS_LAST);
+
+       /* T5 adds new registers in the PL Register map.
+        */
        reg_block_dump(adapter, regbuf,
                       T4VF_PL_BASE_ADDR + T4VF_MOD_MAP_PL_FIRST,
-                      T4VF_PL_BASE_ADDR + T4VF_MOD_MAP_PL_LAST);
+                      T4VF_PL_BASE_ADDR + (is_t4(adapter->params.chip)
+                      ? A_PL_VF_WHOAMI : A_PL_VF_REVISION));
        reg_block_dump(adapter, regbuf,
                       T4VF_CIM_BASE_ADDR + T4VF_MOD_MAP_CIM_FIRST,
                       T4VF_CIM_BASE_ADDR + T4VF_MOD_MAP_CIM_LAST);
@@ -2087,6 +2091,7 @@ static int adap_init0(struct adapter *adapter)
        unsigned int ethqsets;
        int err;
        u32 param, val = 0;
+       unsigned int chipid;
 
        /*
         * Wait for the device to become ready before proceeding ...
@@ -2114,12 +2119,14 @@ static int adap_init0(struct adapter *adapter)
                return err;
        }
 
+       adapter->params.chip = 0;
        switch (adapter->pdev->device >> 12) {
        case CHELSIO_T4:
-               adapter->chip = CHELSIO_CHIP_CODE(CHELSIO_T4, 0);
+               adapter->params.chip = CHELSIO_CHIP_CODE(CHELSIO_T4, 0);
                break;
        case CHELSIO_T5:
-               adapter->chip = CHELSIO_CHIP_CODE(CHELSIO_T5, 0);
+               chipid = G_REV(t4_read_reg(adapter, A_PL_VF_REV));
+               adapter->params.chip |= CHELSIO_CHIP_CODE(CHELSIO_T5, chipid);
                break;
        }
 
index 8475c4cda9e4ca72ef8a2b309788620e82fb67d3..0a89963c48ce78148d1abe6cd86151e850c24062 100644 (file)
@@ -537,7 +537,7 @@ static inline void ring_fl_db(struct adapter *adapter, struct sge_fl *fl)
         */
        if (fl->pend_cred >= FL_PER_EQ_UNIT) {
                val = PIDX(fl->pend_cred / FL_PER_EQ_UNIT);
-               if (!is_t4(adapter->chip))
+               if (!is_t4(adapter->params.chip))
                        val |= DBTYPE(1);
                wmb();
                t4_write_reg(adapter, T4VF_SGE_BASE_ADDR + SGE_VF_KDOORBELL,
index 53cbfed21d0b9871fe257ee75836dc2dadbdc185..61362450d05b4f83daeacf9a0c54ebed35e2da4c 100644 (file)
 #include "../cxgb4/t4fw_api.h"
 
 #define CHELSIO_CHIP_CODE(version, revision) (((version) << 4) | (revision))
-#define CHELSIO_CHIP_VERSION(code) ((code) >> 4)
+#define CHELSIO_CHIP_VERSION(code) (((code) >> 4) & 0xf)
 #define CHELSIO_CHIP_RELEASE(code) ((code) & 0xf)
 
+/* All T4 and later chips have their PCI-E Device IDs encoded as 0xVFPP where:
+ *
+ *   V  = "4" for T4; "5" for T5, etc. or
+ *      = "a" for T4 FPGA; "b" for T4 FPGA, etc.
+ *   F  = "0" for PF 0..3; "4".."7" for PF4..7; and "8" for VFs
+ *   PP = adapter product designation
+ */
 #define CHELSIO_T4             0x4
 #define CHELSIO_T5             0x5
 
 enum chip_type {
-       T4_A1 = CHELSIO_CHIP_CODE(CHELSIO_T4, 0),
-       T4_A2 = CHELSIO_CHIP_CODE(CHELSIO_T4, 1),
-       T4_A3 = CHELSIO_CHIP_CODE(CHELSIO_T4, 2),
+       T4_A1 = CHELSIO_CHIP_CODE(CHELSIO_T4, 1),
+       T4_A2 = CHELSIO_CHIP_CODE(CHELSIO_T4, 2),
        T4_FIRST_REV    = T4_A1,
-       T4_LAST_REV     = T4_A3,
+       T4_LAST_REV     = T4_A2,
 
-       T5_A1 = CHELSIO_CHIP_CODE(CHELSIO_T5, 0),
-       T5_FIRST_REV    = T5_A1,
+       T5_A0 = CHELSIO_CHIP_CODE(CHELSIO_T5, 0),
+       T5_A1 = CHELSIO_CHIP_CODE(CHELSIO_T5, 1),
+       T5_FIRST_REV    = T5_A0,
        T5_LAST_REV     = T5_A1,
 };
 
@@ -203,6 +210,7 @@ struct adapter_params {
        struct vpd_params vpd;          /* Vital Product Data */
        struct rss_params rss;          /* Receive Side Scaling */
        struct vf_resources vfres;      /* Virtual Function Resource limits */
+       enum chip_type chip;            /* chip code */
        u8 nports;                      /* # of Ethernet "ports" */
 };
 
@@ -253,7 +261,7 @@ static inline int t4vf_wr_mbox_ns(struct adapter *adapter, const void *cmd,
 
 static inline int is_t4(enum chip_type chip)
 {
-       return (chip >= T4_FIRST_REV && chip <= T4_LAST_REV);
+       return CHELSIO_CHIP_VERSION(chip) == CHELSIO_T4;
 }
 
 int t4vf_wait_dev_ready(struct adapter *);
index 9f96dc3bb11203e0781faa785d12ec31df4f76f3..d958c44341b5cb299d704600494de5be9d15bb72 100644 (file)
@@ -1027,7 +1027,7 @@ int t4vf_alloc_mac_filt(struct adapter *adapter, unsigned int viid, bool free,
        unsigned nfilters = 0;
        unsigned int rem = naddr;
        struct fw_vi_mac_cmd cmd, rpl;
-       unsigned int max_naddr = is_t4(adapter->chip) ?
+       unsigned int max_naddr = is_t4(adapter->params.chip) ?
                                 NUM_MPS_CLS_SRAM_L_INSTANCES :
                                 NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
 
@@ -1121,7 +1121,7 @@ int t4vf_change_mac(struct adapter *adapter, unsigned int viid,
        struct fw_vi_mac_exact *p = &cmd.u.exact[0];
        size_t len16 = DIV_ROUND_UP(offsetof(struct fw_vi_mac_cmd,
                                             u.exact[1]), 16);
-       unsigned int max_naddr = is_t4(adapter->chip) ?
+       unsigned int max_naddr = is_t4(adapter->params.chip) ?
                                 NUM_MPS_CLS_SRAM_L_INSTANCES :
                                 NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
 
index 3e2162121601e79481428c4d7ca02c3523dc0e33..dc88782185f26f000e4e58cd793f90f6064bbfb6 100644 (file)
@@ -64,6 +64,9 @@
 #define SLIPORT_ERROR_NO_RESOURCE1     0x2
 #define SLIPORT_ERROR_NO_RESOURCE2     0x9
 
+#define SLIPORT_ERROR_FW_RESET1                0x2
+#define SLIPORT_ERROR_FW_RESET2                0x0
+
 /********* Memory BAR register ************/
 #define PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET     0xfc
 /* Host Interrupt Enable, if set interrupts are enabled although "PCI Interrupt
index fee64bf10446092fa718caa12819e1be65ba0d6a..0fde69d5cb6afd610db5f2a57325e5d2e9f5ed94 100644 (file)
@@ -2464,8 +2464,16 @@ void be_detect_error(struct be_adapter *adapter)
         */
        if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
                adapter->hw_error = true;
-               dev_err(&adapter->pdev->dev,
-                       "Error detected in the card\n");
+               /* Do not log error messages if its a FW reset */
+               if (sliport_err1 == SLIPORT_ERROR_FW_RESET1 &&
+                   sliport_err2 == SLIPORT_ERROR_FW_RESET2) {
+                       dev_info(&adapter->pdev->dev,
+                                "Firmware update in progress\n");
+                       return;
+               } else {
+                       dev_err(&adapter->pdev->dev,
+                               "Error detected in the card\n");
+               }
        }
 
        if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
@@ -2932,28 +2940,35 @@ static void be_cancel_worker(struct be_adapter *adapter)
        }
 }
 
-static int be_clear(struct be_adapter *adapter)
+static void be_mac_clear(struct be_adapter *adapter)
 {
        int i;
 
+       if (adapter->pmac_id) {
+               for (i = 0; i < (adapter->uc_macs + 1); i++)
+                       be_cmd_pmac_del(adapter, adapter->if_handle,
+                                       adapter->pmac_id[i], 0);
+               adapter->uc_macs = 0;
+
+               kfree(adapter->pmac_id);
+               adapter->pmac_id = NULL;
+       }
+}
+
+static int be_clear(struct be_adapter *adapter)
+{
        be_cancel_worker(adapter);
 
        if (sriov_enabled(adapter))
                be_vf_clear(adapter);
 
        /* delete the primary mac along with the uc-mac list */
-       for (i = 0; i < (adapter->uc_macs + 1); i++)
-               be_cmd_pmac_del(adapter, adapter->if_handle,
-                               adapter->pmac_id[i], 0);
-       adapter->uc_macs = 0;
+       be_mac_clear(adapter);
 
        be_cmd_if_destroy(adapter, adapter->if_handle,  0);
 
        be_clear_queues(adapter);
 
-       kfree(adapter->pmac_id);
-       adapter->pmac_id = NULL;
-
        be_msix_disable(adapter);
        return 0;
 }
@@ -3812,6 +3827,8 @@ static int lancer_fw_download(struct be_adapter *adapter,
        }
 
        if (change_status == LANCER_FW_RESET_NEEDED) {
+               dev_info(&adapter->pdev->dev,
+                        "Resetting adapter to activate new FW\n");
                status = lancer_physdev_ctrl(adapter,
                                             PHYSDEV_CONTROL_FW_RESET_MASK);
                if (status) {
@@ -4363,13 +4380,13 @@ static int lancer_recover_func(struct be_adapter *adapter)
                        goto err;
        }
 
-       dev_err(dev, "Error recovery successful\n");
+       dev_err(dev, "Adapter recovery successful\n");
        return 0;
 err:
        if (status == -EAGAIN)
                dev_err(dev, "Waiting for resource provisioning\n");
        else
-               dev_err(dev, "Error recovery failed\n");
+               dev_err(dev, "Adapter recovery failed\n");
 
        return status;
 }
index 4cbebf3d80eb1492d847f1ad8a9888e2a6c17b97..73b000df8a08c7f3706b097a678fbf32d268f54c 100644 (file)
@@ -385,7 +385,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
         * data.
         */
        bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, bufaddr,
-                       FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE);
+                       skb->len, DMA_TO_DEVICE);
        if (dma_mapping_error(&fep->pdev->dev, bdp->cbd_bufaddr)) {
                bdp->cbd_bufaddr = 0;
                fep->tx_skbuff[index] = NULL;
@@ -779,11 +779,10 @@ fec_enet_tx(struct net_device *ndev)
                else
                        index = bdp - fep->tx_bd_base;
 
-               dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr,
-                               FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE);
-               bdp->cbd_bufaddr = 0;
-
                skb = fep->tx_skbuff[index];
+               dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, skb->len,
+                               DMA_TO_DEVICE);
+               bdp->cbd_bufaddr = 0;
 
                /* Check for errors. */
                if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC |
index 2d1c6bdd36189f9f595ada15599301ce992330a9..7628e0fd84554fd56eca5f4181f2ff31c85eca0d 100644 (file)
@@ -3033,7 +3033,7 @@ static struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
 
        dev->hw_features = NETIF_F_SG | NETIF_F_TSO |
                      NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX;
-       dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO |
+       dev->features = NETIF_F_SG | NETIF_F_TSO |
                      NETIF_F_HIGHDMA | NETIF_F_IP_CSUM |
                      NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
                      NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM;
index b8e232b4ea2da88aca164039f81f1852ba9f779e..d5f0d72e5e331792bb8a0078078627df66a83fb5 100644 (file)
@@ -1378,7 +1378,7 @@ static void mvneta_rxq_drop_pkts(struct mvneta_port *pp,
 
                dev_kfree_skb_any(skb);
                dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,
-                                rx_desc->data_size, DMA_FROM_DEVICE);
+                                MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
        }
 
        if (rx_done)
@@ -1424,7 +1424,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo,
                }
 
                dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,
-                                rx_desc->data_size, DMA_FROM_DEVICE);
+                                MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
 
                rx_bytes = rx_desc->data_size -
                        (ETH_FCS_LEN + MVNETA_MH_SIZE);
index 5789ea2c934d4aaa15218bdaea2d565f42a82b41..01fc6515384db04fe03d548db8c16f8952f211e4 100644 (file)
@@ -2635,6 +2635,8 @@ static int __init mlx4_init(void)
                return -ENOMEM;
 
        ret = pci_register_driver(&mlx4_driver);
+       if (ret < 0)
+               destroy_workqueue(mlx4_wq);
        return ret < 0 ? ret : 0;
 }
 
index 346a4e025c34100315b1ca2785d631d3bc5d3408..04b3ec1352f1eb9f532f7a6ab770615441f023fd 100644 (file)
@@ -52,7 +52,6 @@
 #include <linux/bitrev.h>
 #include <linux/slab.h>
 
-#include <asm/bootinfo.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
 #include <asm/hwtest.h>
index 2d045be4b5cf64a5921a6687b127609093df376e..1e8b9514718b8620859bc38025dbb878878dd0c0 100644 (file)
@@ -5150,8 +5150,10 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64
 {
        struct fe_priv *np = netdev_priv(dev);
        u8 __iomem *base = get_hwbase(dev);
-       int result;
-       memset(buffer, 0, nv_get_sset_count(dev, ETH_SS_TEST)*sizeof(u64));
+       int result, count;
+
+       count = nv_get_sset_count(dev, ETH_SS_TEST);
+       memset(buffer, 0, count * sizeof(u64));
 
        if (!nv_link_test(dev)) {
                test->flags |= ETH_TEST_FL_FAILED;
@@ -5195,7 +5197,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64
                        return;
                }
 
-               if (!nv_loopback_test(dev)) {
+               if (count > NV_TEST_COUNT_BASE && !nv_loopback_test(dev)) {
                        test->flags |= ETH_TEST_FL_FAILED;
                        buffer[3] = 1;
                }
index 0c9c4e89559524d78aa789dfb65e5e32211b8bc1..03517478e589495dd763a13eaab31101a9ea0a08 100644 (file)
@@ -18,7 +18,7 @@
  */
 #define DRV_NAME       "qlge"
 #define DRV_STRING     "QLogic 10 Gigabit PCI-E Ethernet Driver "
-#define DRV_VERSION    "1.00.00.33"
+#define DRV_VERSION    "1.00.00.34"
 
 #define WQ_ADDR_ALIGN  0x3     /* 4 byte alignment */
 
index 0780e039b2718d902805414daeb6844b7d2086e7..8dee1beb9854813c94c1de36264a241703f9d0be 100644 (file)
@@ -181,6 +181,7 @@ static const char ql_gstrings_test[][ETH_GSTRING_LEN] = {
 };
 #define QLGE_TEST_LEN (sizeof(ql_gstrings_test) / ETH_GSTRING_LEN)
 #define QLGE_STATS_LEN ARRAY_SIZE(ql_gstrings_stats)
+#define QLGE_RCV_MAC_ERR_STATS 7
 
 static int ql_update_ring_coalescing(struct ql_adapter *qdev)
 {
@@ -280,6 +281,9 @@ static void ql_update_stats(struct ql_adapter *qdev)
                iter++;
        }
 
+       /* Update receive mac error statistics */
+       iter += QLGE_RCV_MAC_ERR_STATS;
+
        /*
         * Get Per-priority TX pause frame counter statistics.
         */
index a245dc18d769241bcf23d607458e33538c7ee99c..449f506d2e8ff3e71abc22bba6ce8e67bcf45305 100644 (file)
@@ -2376,14 +2376,6 @@ static netdev_features_t qlge_fix_features(struct net_device *ndev,
        netdev_features_t features)
 {
        int err;
-       /*
-        * Since there is no support for separate rx/tx vlan accel
-        * enable/disable make sure tx flag is always in same state as rx.
-        */
-       if (features & NETIF_F_HW_VLAN_CTAG_RX)
-               features |= NETIF_F_HW_VLAN_CTAG_TX;
-       else
-               features &= ~NETIF_F_HW_VLAN_CTAG_TX;
 
        /* Update the behavior of vlan accel in the adapter */
        err = qlge_update_hw_vlan_features(ndev, features);
index dd0dd6279b4eec8168c006457643568032ee358f..4f1d2549130e3396909f5287776663fa5bfb4e9e 100644 (file)
@@ -2019,7 +2019,6 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                ndev->features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO
                    | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
                    NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM
-                   /*| NETIF_F_FRAGLIST */
                    ;
                ndev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
                        NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX;
index 7536a4c01293a9b3e97bf1171941b6724213ad6c..a91f0c9d4511e23a9189f84916d4be158157813d 100644 (file)
@@ -1816,6 +1816,8 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
                }
 
                i++;
+               if (i == data->slaves)
+                       break;
        }
 
        return 0;
index 41ba974bf37cb9175c74ab40bba1817e890749e7..cd9b164a0434acb3a51066b5d0e17262a4bdc0dd 100644 (file)
@@ -61,6 +61,7 @@
 #include <linux/davinci_emac.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/of_net.h>
 
@@ -1752,10 +1753,14 @@ static const struct net_device_ops emac_netdev_ops = {
 #endif
 };
 
+static const struct of_device_id davinci_emac_of_match[];
+
 static struct emac_platform_data *
 davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv)
 {
        struct device_node *np;
+       const struct of_device_id *match;
+       const struct emac_platform_data *auxdata;
        struct emac_platform_data *pdata = NULL;
        const u8 *mac_addr;
 
@@ -1793,7 +1798,20 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv)
 
        priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
        if (!priv->phy_node)
-               pdata->phy_id = "";
+               pdata->phy_id = NULL;
+
+       auxdata = pdev->dev.platform_data;
+       if (auxdata) {
+               pdata->interrupt_enable = auxdata->interrupt_enable;
+               pdata->interrupt_disable = auxdata->interrupt_disable;
+       }
+
+       match = of_match_device(davinci_emac_of_match, &pdev->dev);
+       if (match && match->data) {
+               auxdata = match->data;
+               pdata->version = auxdata->version;
+               pdata->hw_ram_addr = auxdata->hw_ram_addr;
+       }
 
        pdev->dev.platform_data = pdata;
 
@@ -2020,8 +2038,14 @@ static const struct dev_pm_ops davinci_emac_pm_ops = {
 };
 
 #if IS_ENABLED(CONFIG_OF)
+static const struct emac_platform_data am3517_emac_data = {
+       .version                = EMAC_VERSION_2,
+       .hw_ram_addr            = 0x01e20000,
+};
+
 static const struct of_device_id davinci_emac_of_match[] = {
        {.compatible = "ti,davinci-dm6467-emac", },
+       {.compatible = "ti,am3517-emac", .data = &am3517_emac_data, },
        {},
 };
 MODULE_DEVICE_TABLE(of, davinci_emac_of_match);
index 1f23641263232fce0255d237976cbf5470e22a6c..2166e879a0961544af056802b1dbcff5a011d2aa 100644 (file)
@@ -1017,7 +1017,7 @@ static int temac_of_probe(struct platform_device *op)
        platform_set_drvdata(op, ndev);
        SET_NETDEV_DEV(ndev, &op->dev);
        ndev->flags &= ~IFF_MULTICAST;  /* clear multicast */
-       ndev->features = NETIF_F_SG | NETIF_F_FRAGLIST;
+       ndev->features = NETIF_F_SG;
        ndev->netdev_ops = &temac_netdev_ops;
        ndev->ethtool_ops = &temac_ethtool_ops;
 #if 0
index b2ff038d6d200abc5dbcd9315806e6791cec3335..f9293da19e260caa8e06829242150ccc72c0ded0 100644 (file)
@@ -1486,7 +1486,7 @@ static int axienet_of_probe(struct platform_device *op)
 
        SET_NETDEV_DEV(ndev, &op->dev);
        ndev->flags &= ~IFF_MULTICAST;  /* clear multicast */
-       ndev->features = NETIF_F_SG | NETIF_F_FRAGLIST;
+       ndev->features = NETIF_F_SG;
        ndev->netdev_ops = &axienet_netdev_ops;
        ndev->ethtool_ops = &axienet_ethtool_ops;
 
index 9093004f9b63004922a0202180d7341343287553..957cc5c3653dfe53215b4b1e61dabed082dce6b2 100644 (file)
@@ -876,6 +876,8 @@ static ssize_t macvtap_aio_read(struct kiocb *iocb, const struct iovec *iv,
 
        ret = macvtap_do_read(q, iocb, iv, len, file->f_flags & O_NONBLOCK);
        ret = min_t(ssize_t, ret, len); /* XXX copied from tun.c. Why? */
+       if (ret > 0)
+               iocb->ki_pos = ret;
 out:
        return ret;
 }
index 782e38bfc1eeea38215492aee5aaa587cc534525..e26cbea1ce68dde18805a67be9e5ed861558036d 100644 (file)
@@ -1356,6 +1356,8 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
        ret = tun_do_read(tun, tfile, iocb, iv, len,
                          file->f_flags & O_NONBLOCK);
        ret = min_t(ssize_t, ret, len);
+       if (ret > 0)
+               iocb->ki_pos = ret;
 out:
        tun_put(tun);
        return ret;
index 916241d16c6764c117f80fa7109bdbff7dfdb714..d208f860498106013913211183baa39a37f33982 100644 (file)
@@ -426,10 +426,10 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len)
        if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) {
                pr_debug("%s: short packet %i\n", dev->name, len);
                dev->stats.rx_length_errors++;
-               if (vi->big_packets)
-                       give_pages(rq, buf);
-               else if (vi->mergeable_rx_bufs)
+               if (vi->mergeable_rx_bufs)
                        put_page(virt_to_head_page(buf));
+               else if (vi->big_packets)
+                       give_pages(rq, buf);
                else
                        dev_kfree_skb(buf);
                return;
@@ -1367,6 +1367,11 @@ static void virtnet_config_changed(struct virtio_device *vdev)
 
 static void virtnet_free_queues(struct virtnet_info *vi)
 {
+       int i;
+
+       for (i = 0; i < vi->max_queue_pairs; i++)
+               netif_napi_del(&vi->rq[i].napi);
+
        kfree(vi->rq);
        kfree(vi->sq);
 }
@@ -1396,10 +1401,10 @@ static void free_unused_bufs(struct virtnet_info *vi)
                struct virtqueue *vq = vi->rq[i].vq;
 
                while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) {
-                       if (vi->big_packets)
-                               give_pages(&vi->rq[i], buf);
-                       else if (vi->mergeable_rx_bufs)
+                       if (vi->mergeable_rx_bufs)
                                put_page(virt_to_head_page(buf));
+                       else if (vi->big_packets)
+                               give_pages(&vi->rq[i], buf);
                        else
                                dev_kfree_skb(buf);
                        --vi->rq[i].num;
index 1ec52356b5a16956dda70a2f7365103497b43c68..130657db5c4314321159b8d3fb7ec69c1ee01d21 100644 (file)
@@ -3984,18 +3984,20 @@ static void ar9003_hw_quick_drop_apply(struct ath_hw *ah, u16 freq)
        int quick_drop;
        s32 t[3], f[3] = {5180, 5500, 5785};
 
-       if (!(pBase->miscConfiguration & BIT(1)))
+       if (!(pBase->miscConfiguration & BIT(4)))
                return;
 
-       if (freq < 4000)
-               quick_drop = eep->modalHeader2G.quick_drop;
-       else {
-               t[0] = eep->base_ext1.quick_drop_low;
-               t[1] = eep->modalHeader5G.quick_drop;
-               t[2] = eep->base_ext1.quick_drop_high;
-               quick_drop = ar9003_hw_power_interpolate(freq, f, t, 3);
+       if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9340(ah)) {
+               if (freq < 4000) {
+                       quick_drop = eep->modalHeader2G.quick_drop;
+               } else {
+                       t[0] = eep->base_ext1.quick_drop_low;
+                       t[1] = eep->modalHeader5G.quick_drop;
+                       t[2] = eep->base_ext1.quick_drop_high;
+                       quick_drop = ar9003_hw_power_interpolate(freq, f, t, 3);
+               }
+               REG_RMW_FIELD(ah, AR_PHY_AGC, AR_PHY_AGC_QUICK_DROP, quick_drop);
        }
-       REG_RMW_FIELD(ah, AR_PHY_AGC, AR_PHY_AGC_QUICK_DROP, quick_drop);
 }
 
 static void ar9003_hw_txend_to_xpa_off_apply(struct ath_hw *ah, bool is2ghz)
@@ -4035,7 +4037,7 @@ static void ar9003_hw_xlna_bias_strength_apply(struct ath_hw *ah, bool is2ghz)
        struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
        u8 bias;
 
-       if (!(eep->baseEepHeader.featureEnable & 0x40))
+       if (!(eep->baseEepHeader.miscConfiguration & 0x40))
                return;
 
        if (!AR_SREV_9300(ah))
index 54b04155e43b1058575aa44df3e6ece1ab18e55e..8918035da3a3510c04ad45e106cebd3d267ad6e8 100644 (file)
@@ -146,10 +146,9 @@ static void ath9k_hw_set_clockrate(struct ath_hw *ah)
        else
                clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM;
 
-       if (IS_CHAN_HT40(chan))
-               clockrate *= 2;
-
-       if (ah->curchan) {
+       if (chan) {
+               if (IS_CHAN_HT40(chan))
+                       clockrate *= 2;
                if (IS_CHAN_HALF_RATE(chan))
                        clockrate /= 2;
                if (IS_CHAN_QUARTER_RATE(chan))
index 09cdbcd097394a3a2c324230c2743f5d181b0900..b5a19e098f2d72f49dde181184bce20dc47bcebf 100644 (file)
@@ -1276,6 +1276,10 @@ static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf,
                                if (!rts_thresh || (len > rts_thresh))
                                        rts = true;
                        }
+
+                       if (!aggr)
+                               len = fi->framelen;
+
                        ath_buf_set_rate(sc, bf, &info, len, rts);
                }
 
index de9eb2cfbf4b5784c36a97da2748acd357250c37..366339421d4f1c924e4e1e69c34ce88bce9ab028 100644 (file)
@@ -2041,13 +2041,20 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len)
        case WCN36XX_HAL_DELETE_STA_CONTEXT_IND:
                mutex_lock(&wcn->hal_ind_mutex);
                msg_ind = kmalloc(sizeof(*msg_ind), GFP_KERNEL);
-               msg_ind->msg_len = len;
-               msg_ind->msg = kmalloc(len, GFP_KERNEL);
-               memcpy(msg_ind->msg, buf, len);
-               list_add_tail(&msg_ind->list, &wcn->hal_ind_queue);
-               queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work);
-               wcn36xx_dbg(WCN36XX_DBG_HAL, "indication arrived\n");
+               if (msg_ind) {
+                       msg_ind->msg_len = len;
+                       msg_ind->msg = kmalloc(len, GFP_KERNEL);
+                       memcpy(msg_ind->msg, buf, len);
+                       list_add_tail(&msg_ind->list, &wcn->hal_ind_queue);
+                       queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work);
+                       wcn36xx_dbg(WCN36XX_DBG_HAL, "indication arrived\n");
+               }
                mutex_unlock(&wcn->hal_ind_mutex);
+               if (msg_ind)
+                       break;
+               /* FIXME: Do something smarter then just printing an error. */
+               wcn36xx_err("Run out of memory while handling SMD_EVENT (%d)\n",
+                           msg_header->msg_type);
                break;
        default:
                wcn36xx_err("SMD_EVENT (%d) not supported\n",
index b00a7e92225f7b928f5a3cf7395f860af27299bd..54e36fcb39542e8361dfdc019134f3ba1538de8f 100644 (file)
@@ -5,6 +5,8 @@ config BRCMSMAC
        tristate "Broadcom IEEE802.11n PCIe SoftMAC WLAN driver"
        depends on MAC80211
        depends on BCMA
+       select NEW_LEDS if BCMA_DRIVER_GPIO
+       select LEDS_CLASS if BCMA_DRIVER_GPIO
        select BRCMUTIL
        select FW_LOADER
        select CRC_CCITT
index 905704e335d7164b90a4ecb6fd51c2324911c154..abc9ceca70f3630251ad077fe307f05a8a979adc 100644 (file)
@@ -109,6 +109,8 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev,
                                        brcmf_err("Disable F2 failed:%d\n",
                                                  err_ret);
                        }
+               } else {
+                       err_ret = -ENOENT;
                }
        } else if ((regaddr == SDIO_CCCR_ABORT) ||
                   (regaddr == SDIO_CCCR_IENx)) {
index 85879dbaa402cdaa88d93247b678aaac9a3ff000..3c34a72a5d64769b8bbf156f9a74d4748fcb0228 100644 (file)
@@ -67,8 +67,8 @@
 #include "iwl-agn-hw.h"
 
 /* Highest firmware API version supported */
-#define IWL7260_UCODE_API_MAX  7
-#define IWL3160_UCODE_API_MAX  7
+#define IWL7260_UCODE_API_MAX  8
+#define IWL3160_UCODE_API_MAX  8
 
 /* Oldest version we won't warn about */
 #define IWL7260_UCODE_API_OK   7
@@ -130,6 +130,7 @@ const struct iwl_cfg iwl7260_2ac_cfg = {
        .ht_params = &iwl7000_ht_params,
        .nvm_ver = IWL7260_NVM_VERSION,
        .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
+       .host_interrupt_operation_mode = true,
 };
 
 const struct iwl_cfg iwl7260_2ac_cfg_high_temp = {
@@ -140,6 +141,7 @@ const struct iwl_cfg iwl7260_2ac_cfg_high_temp = {
        .nvm_ver = IWL7260_NVM_VERSION,
        .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
        .high_temp = true,
+       .host_interrupt_operation_mode = true,
 };
 
 const struct iwl_cfg iwl7260_2n_cfg = {
@@ -149,6 +151,7 @@ const struct iwl_cfg iwl7260_2n_cfg = {
        .ht_params = &iwl7000_ht_params,
        .nvm_ver = IWL7260_NVM_VERSION,
        .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
+       .host_interrupt_operation_mode = true,
 };
 
 const struct iwl_cfg iwl7260_n_cfg = {
@@ -158,6 +161,7 @@ const struct iwl_cfg iwl7260_n_cfg = {
        .ht_params = &iwl7000_ht_params,
        .nvm_ver = IWL7260_NVM_VERSION,
        .nvm_calib_ver = IWL7260_TX_POWER_VERSION,
+       .host_interrupt_operation_mode = true,
 };
 
 const struct iwl_cfg iwl3160_2ac_cfg = {
@@ -167,6 +171,7 @@ const struct iwl_cfg iwl3160_2ac_cfg = {
        .ht_params = &iwl7000_ht_params,
        .nvm_ver = IWL3160_NVM_VERSION,
        .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
+       .host_interrupt_operation_mode = true,
 };
 
 const struct iwl_cfg iwl3160_2n_cfg = {
@@ -176,6 +181,7 @@ const struct iwl_cfg iwl3160_2n_cfg = {
        .ht_params = &iwl7000_ht_params,
        .nvm_ver = IWL3160_NVM_VERSION,
        .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
+       .host_interrupt_operation_mode = true,
 };
 
 const struct iwl_cfg iwl3160_n_cfg = {
@@ -185,6 +191,7 @@ const struct iwl_cfg iwl3160_n_cfg = {
        .ht_params = &iwl7000_ht_params,
        .nvm_ver = IWL3160_NVM_VERSION,
        .nvm_calib_ver = IWL3160_TX_POWER_VERSION,
+       .host_interrupt_operation_mode = true,
 };
 
 const struct iwl_cfg iwl7265_2ac_cfg = {
@@ -196,5 +203,23 @@ const struct iwl_cfg iwl7265_2ac_cfg = {
        .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
 };
 
+const struct iwl_cfg iwl7265_2n_cfg = {
+       .name = "Intel(R) Dual Band Wireless N 7265",
+       .fw_name_pre = IWL7265_FW_PRE,
+       IWL_DEVICE_7000,
+       .ht_params = &iwl7000_ht_params,
+       .nvm_ver = IWL7265_NVM_VERSION,
+       .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
+};
+
+const struct iwl_cfg iwl7265_n_cfg = {
+       .name = "Intel(R) Wireless N 7265",
+       .fw_name_pre = IWL7265_FW_PRE,
+       IWL_DEVICE_7000,
+       .ht_params = &iwl7000_ht_params,
+       .nvm_ver = IWL7265_NVM_VERSION,
+       .nvm_calib_ver = IWL7265_TX_POWER_VERSION,
+};
+
 MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
 MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK));
index 18f232e8e81253b31d730755f242b7a51552157c..03fd9aa8bfda93b67122b1fea0688c60aad1f95c 100644 (file)
@@ -207,6 +207,8 @@ struct iwl_eeprom_params {
  * @rx_with_siso_diversity: 1x1 device with rx antenna diversity
  * @internal_wimax_coex: internal wifi/wimax combo device
  * @high_temp: Is this NIC is designated to be in high temperature.
+ * @host_interrupt_operation_mode: device needs host interrupt operation
+ *     mode set
  *
  * We enable the driver to be backward compatible wrt. hardware features.
  * API differences in uCode shouldn't be handled here but through TLVs
@@ -235,6 +237,7 @@ struct iwl_cfg {
        enum iwl_led_mode led_mode;
        const bool rx_with_siso_diversity;
        const bool internal_wimax_coex;
+       const bool host_interrupt_operation_mode;
        bool high_temp;
 };
 
@@ -294,6 +297,8 @@ extern const struct iwl_cfg iwl3160_2ac_cfg;
 extern const struct iwl_cfg iwl3160_2n_cfg;
 extern const struct iwl_cfg iwl3160_n_cfg;
 extern const struct iwl_cfg iwl7265_2ac_cfg;
+extern const struct iwl_cfg iwl7265_2n_cfg;
+extern const struct iwl_cfg iwl7265_n_cfg;
 #endif /* CONFIG_IWLMVM */
 
 #endif /* __IWL_CONFIG_H__ */
index 54a4fdc631b73c987f12e459e8245d38b18f0c0b..da4eca8b3007feabb267a1710c95a70306224455 100644 (file)
@@ -495,14 +495,11 @@ enum secure_load_status_reg {
  * the CSR_INT_COALESCING is an 8 bit register in 32-usec unit
  *
  * default interrupt coalescing timer is 64 x 32 = 2048 usecs
- * default interrupt coalescing calibration timer is 16 x 32 = 512 usecs
  */
 #define IWL_HOST_INT_TIMEOUT_MAX       (0xFF)
 #define IWL_HOST_INT_TIMEOUT_DEF       (0x40)
 #define IWL_HOST_INT_TIMEOUT_MIN       (0x0)
-#define IWL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF)
-#define IWL_HOST_INT_CALIB_TIMEOUT_DEF (0x10)
-#define IWL_HOST_INT_CALIB_TIMEOUT_MIN (0x0)
+#define IWL_HOST_INT_OPER_MODE         BIT(31)
 
 /*****************************************************************************
  *                        7000/3000 series SHR DTS addresses                 *
index 5d066cbc5ac7eda17914e85c2510c53fe4a5be2a..75b72a956552759685613c249f51a31926059a8f 100644 (file)
@@ -391,7 +391,6 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
                                            BT_VALID_LUT |
                                            BT_VALID_WIFI_RX_SW_PRIO_BOOST |
                                            BT_VALID_WIFI_TX_SW_PRIO_BOOST |
-                                           BT_VALID_MULTI_PRIO_LUT |
                                            BT_VALID_CORUN_LUT_20 |
                                            BT_VALID_CORUN_LUT_40 |
                                            BT_VALID_ANT_ISOLATION |
@@ -842,6 +841,11 @@ static void iwl_mvm_bt_rssi_iterator(void *_data, u8 *mac,
 
        sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id],
                                        lockdep_is_held(&mvm->mutex));
+
+       /* This can happen if the station has been removed right now */
+       if (IS_ERR_OR_NULL(sta))
+               return;
+
        mvmsta = (void *)sta->drv_priv;
 
        data->num_bss_ifaces++;
index 6f45966817bb4c1d34cd3a10c4db74536f4a13bf..b9b81e881dd011e5ca06747f2bcceea4ece64ac9 100644 (file)
@@ -895,7 +895,7 @@ static int iwl_mvm_get_last_nonqos_seq(struct iwl_mvm *mvm,
                /* new API returns next, not last-used seqno */
                if (mvm->fw->ucode_capa.flags &
                                IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API)
-                       err -= 0x10;
+                       err = (u16) (err - 0x10);
        }
 
        iwl_free_resp(&cmd);
@@ -1549,7 +1549,7 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm,
        if (gtkdata.unhandled_cipher)
                return false;
        if (!gtkdata.num_keys)
-               return true;
+               goto out;
        if (!gtkdata.last_gtk)
                return false;
 
@@ -1600,6 +1600,7 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm,
                                           (void *)&replay_ctr, GFP_KERNEL);
        }
 
+out:
        mvmvif->seqno_valid = true;
        /* +0x10 because the set API expects next-to-use, not last-used */
        mvmvif->seqno = le16_to_cpu(status->non_qos_seq_ctr) + 0x10;
index 9864d713eb2cb54920053fb971a65866f5ec0bf4..a8fe6b41f9a34b417a12e5295c7b86c75361bb1b 100644 (file)
@@ -119,6 +119,10 @@ static ssize_t iwl_dbgfs_sta_drain_write(struct file *file,
 
        if (sscanf(buf, "%d %d", &sta_id, &drain) != 2)
                return -EINVAL;
+       if (sta_id < 0 || sta_id >= IWL_MVM_STATION_COUNT)
+               return -EINVAL;
+       if (drain < 0 || drain > 1)
+               return -EINVAL;
 
        mutex_lock(&mvm->mutex);
 
index 33cf56fdfc41f86b8bb517a8824740bdbb71a896..95ce4b601fef3050085518e59a4e32036c57fbfc 100644 (file)
@@ -176,8 +176,11 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm,
         * P2P Device discoveribility, while there are other higher priority
         * events in the system).
         */
-       if (WARN_ONCE(!le32_to_cpu(notif->status),
-                     "Failed to schedule time event\n")) {
+       if (!le32_to_cpu(notif->status)) {
+               bool start = le32_to_cpu(notif->action) &
+                               TE_V2_NOTIF_HOST_EVENT_START;
+               IWL_WARN(mvm, "Time Event %s notification failure\n",
+                        start ? "start" : "end");
                if (iwl_mvm_te_check_disconnect(mvm, te_data->vif, NULL)) {
                        iwl_mvm_te_clear_data(mvm, te_data);
                        return;
index 941c0c88f982639b28436a60e52a0fdc6fba8c4b..86605027c41d6b4187c15ba874ef8fe25056676e 100644 (file)
@@ -353,6 +353,27 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
 
 /* 7265 Series */
        {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095B, 0x5012, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095B, 0x500A, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)},
+       {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)},
+       {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x5020, iwl7265_2n_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x502A, iwl7265_2n_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x5420, iwl7265_2n_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x5090, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095B, 0x5290, iwl7265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x095A, 0x5490, iwl7265_2ac_cfg)},
 #endif /* CONFIG_IWLMVM */
 
        {0}
index fa22639b63c947d68247698cf109070a823b792b..051268c037b1d4f7d03715cdbf13b68311f883ff 100644 (file)
@@ -477,4 +477,12 @@ static inline bool iwl_is_rfkill_set(struct iwl_trans *trans)
                CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
 }
 
+static inline void iwl_nic_error(struct iwl_trans *trans)
+{
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+
+       set_bit(STATUS_FW_ERROR, &trans_pcie->status);
+       iwl_op_mode_nic_error(trans->op_mode);
+}
+
 #endif /* __iwl_trans_int_pcie_h__ */
index 3f237b42eb36d3c94cc84f94d0ba86b6a7861e41..be3995afa9d0acee4ce7f6e0d60907f896594c53 100644 (file)
@@ -489,6 +489,10 @@ static void iwl_pcie_rx_hw_init(struct iwl_trans *trans, struct iwl_rxq *rxq)
 
        /* Set interrupt coalescing timer to default (2048 usecs) */
        iwl_write8(trans, CSR_INT_COALESCING, IWL_HOST_INT_TIMEOUT_DEF);
+
+       /* W/A for interrupt coalescing bug in 7260 and 3160 */
+       if (trans->cfg->host_interrupt_operation_mode)
+               iwl_set_bit(trans, CSR_INT_COALESCING, IWL_HOST_INT_OPER_MODE);
 }
 
 static void iwl_pcie_rx_init_rxb_lists(struct iwl_rxq *rxq)
@@ -796,12 +800,13 @@ static void iwl_pcie_irq_handle_error(struct iwl_trans *trans)
        iwl_pcie_dump_csr(trans);
        iwl_dump_fh(trans, NULL);
 
+       /* set the ERROR bit before we wake up the caller */
        set_bit(STATUS_FW_ERROR, &trans_pcie->status);
        clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status);
        wake_up(&trans_pcie->wait_command_queue);
 
        local_bh_disable();
-       iwl_op_mode_nic_error(trans->op_mode);
+       iwl_nic_error(trans);
        local_bh_enable();
 }
 
index 5d9337bec67a87c59f3ccef73e5f5b26644930d5..cde9c16f6e4febb26c66c2206068bdba973c708a 100644 (file)
@@ -279,9 +279,6 @@ static int iwl_pcie_nic_init(struct iwl_trans *trans)
        spin_lock_irqsave(&trans_pcie->irq_lock, flags);
        iwl_pcie_apm_init(trans);
 
-       /* Set interrupt coalescing calibration timer to default (512 usecs) */
-       iwl_write8(trans, CSR_INT_COALESCING, IWL_HOST_INT_CALIB_TIMEOUT_DEF);
-
        spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
 
        iwl_pcie_set_pwr(trans, false);
index 059c5acad3a0d2e7b9eb73bf6466ef088e54e5c2..0adde919a258a65f9585651e8efb89add27f2add 100644 (file)
@@ -207,7 +207,7 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data)
                IWL_ERR(trans, "scratch %d = 0x%08x\n", i,
                        le32_to_cpu(txq->scratchbufs[i].scratch));
 
-       iwl_op_mode_nic_error(trans->op_mode);
+       iwl_nic_error(trans);
 }
 
 /*
@@ -1023,7 +1023,7 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx)
                if (nfreed++ > 0) {
                        IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n",
                                idx, q->write_ptr, q->read_ptr);
-                       iwl_op_mode_nic_error(trans->op_mode);
+                       iwl_nic_error(trans);
                }
        }
 
@@ -1562,7 +1562,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
                                       get_cmd_string(trans_pcie, cmd->id));
                        ret = -ETIMEDOUT;
 
-                       iwl_op_mode_nic_error(trans->op_mode);
+                       iwl_nic_error(trans);
 
                        goto cancel;
                }
index 9df7bc91a26f54c9812718e481c538895aa5b4f8..c72438bb2fafd24b8e59f416d4e4311752dce941 100644 (file)
@@ -383,6 +383,14 @@ struct hwsim_radiotap_hdr {
        __le16 rt_chbitmask;
 } __packed;
 
+struct hwsim_radiotap_ack_hdr {
+       struct ieee80211_radiotap_header hdr;
+       u8 rt_flags;
+       u8 pad;
+       __le16 rt_channel;
+       __le16 rt_chbitmask;
+} __packed;
+
 /* MAC80211_HWSIM netlinf family */
 static struct genl_family hwsim_genl_family = {
        .id = GENL_ID_GENERATE,
@@ -500,7 +508,7 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan,
                                       const u8 *addr)
 {
        struct sk_buff *skb;
-       struct hwsim_radiotap_hdr *hdr;
+       struct hwsim_radiotap_ack_hdr *hdr;
        u16 flags;
        struct ieee80211_hdr *hdr11;
 
@@ -511,14 +519,14 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan,
        if (skb == NULL)
                return;
 
-       hdr = (struct hwsim_radiotap_hdr *) skb_put(skb, sizeof(*hdr));
+       hdr = (struct hwsim_radiotap_ack_hdr *) skb_put(skb, sizeof(*hdr));
        hdr->hdr.it_version = PKTHDR_RADIOTAP_VERSION;
        hdr->hdr.it_pad = 0;
        hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr));
        hdr->hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) |
                                          (1 << IEEE80211_RADIOTAP_CHANNEL));
        hdr->rt_flags = 0;
-       hdr->rt_rate = 0;
+       hdr->pad = 0;
        hdr->rt_channel = cpu_to_le16(chan->center_freq);
        flags = IEEE80211_CHAN_2GHZ;
        hdr->rt_chbitmask = cpu_to_le16(flags);
@@ -1230,7 +1238,7 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw,
                                              HRTIMER_MODE_REL);
                } else if (!info->enable_beacon) {
                        unsigned int count = 0;
-                       ieee80211_iterate_active_interfaces(
+                       ieee80211_iterate_active_interfaces_atomic(
                                data->hw, IEEE80211_IFACE_ITER_NORMAL,
                                mac80211_hwsim_bcn_en_iter, &count);
                        wiphy_debug(hw->wiphy, "  beaconing vifs remaining: %u",
index c8e029df770e38cac9a52dccb660666bd8cc9f74..a09398fe9e2a67218f50530af8a0b4616443cbbb 100644 (file)
@@ -319,8 +319,8 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
                if (bss_desc && bss_desc->ssid.ssid_len &&
                    (!mwifiex_ssid_cmp(&priv->curr_bss_params.bss_descriptor.
                                       ssid, &bss_desc->ssid))) {
-                       kfree(bss_desc);
-                       return 0;
+                       ret = 0;
+                       goto done;
                }
 
                /* Exit Adhoc mode first */
index 2329cccf1fa6dd15f65c4dc30c54c62cce0551a7..870f1fa583702ee4bc61d9acab3e4925a4d984e0 100644 (file)
@@ -368,11 +368,11 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref,
                   unsigned long rx_ring_ref, unsigned int tx_evtchn,
                   unsigned int rx_evtchn)
 {
+       struct task_struct *task;
        int err = -ENOMEM;
 
-       /* Already connected through? */
-       if (vif->tx_irq)
-               return 0;
+       BUG_ON(vif->tx_irq);
+       BUG_ON(vif->task);
 
        err = xenvif_map_frontend_rings(vif, tx_ring_ref, rx_ring_ref);
        if (err < 0)
@@ -411,14 +411,16 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref,
        }
 
        init_waitqueue_head(&vif->wq);
-       vif->task = kthread_create(xenvif_kthread,
-                                  (void *)vif, "%s", vif->dev->name);
-       if (IS_ERR(vif->task)) {
+       task = kthread_create(xenvif_kthread,
+                             (void *)vif, "%s", vif->dev->name);
+       if (IS_ERR(task)) {
                pr_warn("Could not allocate kthread for %s\n", vif->dev->name);
-               err = PTR_ERR(vif->task);
+               err = PTR_ERR(task);
                goto err_rx_unbind;
        }
 
+       vif->task = task;
+
        rtnl_lock();
        if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN)
                dev_set_mtu(vif->dev, ETH_DATA_LEN);
@@ -461,8 +463,10 @@ void xenvif_disconnect(struct xenvif *vif)
        if (netif_carrier_ok(vif->dev))
                xenvif_carrier_off(vif);
 
-       if (vif->task)
+       if (vif->task) {
                kthread_stop(vif->task);
+               vif->task = NULL;
+       }
 
        if (vif->tx_irq) {
                if (vif->tx_irq == vif->rx_irq)
index 64f0e0d18b8188c1729f525e26a2ca8b88724d8f..acf13920e6d1804c94c672560f45154545ec9c54 100644 (file)
@@ -1149,49 +1149,72 @@ static int xenvif_set_skb_gso(struct xenvif *vif,
        return 0;
 }
 
-static inline void maybe_pull_tail(struct sk_buff *skb, unsigned int len)
+static inline int maybe_pull_tail(struct sk_buff *skb, unsigned int len,
+                                 unsigned int max)
 {
-       if (skb_is_nonlinear(skb) && skb_headlen(skb) < len) {
-               /* If we need to pullup then pullup to the max, so we
-                * won't need to do it again.
-                */
-               int target = min_t(int, skb->len, MAX_TCP_HEADER);
-               __pskb_pull_tail(skb, target - skb_headlen(skb));
-       }
+       if (skb_headlen(skb) >= len)
+               return 0;
+
+       /* If we need to pullup then pullup to the max, so we
+        * won't need to do it again.
+        */
+       if (max > skb->len)
+               max = skb->len;
+
+       if (__pskb_pull_tail(skb, max - skb_headlen(skb)) == NULL)
+               return -ENOMEM;
+
+       if (skb_headlen(skb) < len)
+               return -EPROTO;
+
+       return 0;
 }
 
+/* This value should be large enough to cover a tagged ethernet header plus
+ * maximally sized IP and TCP or UDP headers.
+ */
+#define MAX_IP_HDR_LEN 128
+
 static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb,
                             int recalculate_partial_csum)
 {
-       struct iphdr *iph = (void *)skb->data;
-       unsigned int header_size;
        unsigned int off;
-       int err = -EPROTO;
+       bool fragment;
+       int err;
+
+       fragment = false;
+
+       err = maybe_pull_tail(skb,
+                             sizeof(struct iphdr),
+                             MAX_IP_HDR_LEN);
+       if (err < 0)
+               goto out;
 
-       off = sizeof(struct iphdr);
+       if (ip_hdr(skb)->frag_off & htons(IP_OFFSET | IP_MF))
+               fragment = true;
 
-       header_size = skb->network_header + off + MAX_IPOPTLEN;
-       maybe_pull_tail(skb, header_size);
+       off = ip_hdrlen(skb);
 
-       off = iph->ihl * 4;
+       err = -EPROTO;
 
-       switch (iph->protocol) {
+       switch (ip_hdr(skb)->protocol) {
        case IPPROTO_TCP:
                if (!skb_partial_csum_set(skb, off,
                                          offsetof(struct tcphdr, check)))
                        goto out;
 
                if (recalculate_partial_csum) {
-                       struct tcphdr *tcph = tcp_hdr(skb);
-
-                       header_size = skb->network_header +
-                               off +
-                               sizeof(struct tcphdr);
-                       maybe_pull_tail(skb, header_size);
-
-                       tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
-                                                        skb->len - off,
-                                                        IPPROTO_TCP, 0);
+                       err = maybe_pull_tail(skb,
+                                             off + sizeof(struct tcphdr),
+                                             MAX_IP_HDR_LEN);
+                       if (err < 0)
+                               goto out;
+
+                       tcp_hdr(skb)->check =
+                               ~csum_tcpudp_magic(ip_hdr(skb)->saddr,
+                                                  ip_hdr(skb)->daddr,
+                                                  skb->len - off,
+                                                  IPPROTO_TCP, 0);
                }
                break;
        case IPPROTO_UDP:
@@ -1200,24 +1223,20 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb,
                        goto out;
 
                if (recalculate_partial_csum) {
-                       struct udphdr *udph = udp_hdr(skb);
-
-                       header_size = skb->network_header +
-                               off +
-                               sizeof(struct udphdr);
-                       maybe_pull_tail(skb, header_size);
-
-                       udph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
-                                                        skb->len - off,
-                                                        IPPROTO_UDP, 0);
+                       err = maybe_pull_tail(skb,
+                                             off + sizeof(struct udphdr),
+                                             MAX_IP_HDR_LEN);
+                       if (err < 0)
+                               goto out;
+
+                       udp_hdr(skb)->check =
+                               ~csum_tcpudp_magic(ip_hdr(skb)->saddr,
+                                                  ip_hdr(skb)->daddr,
+                                                  skb->len - off,
+                                                  IPPROTO_UDP, 0);
                }
                break;
        default:
-               if (net_ratelimit())
-                       netdev_err(vif->dev,
-                                  "Attempting to checksum a non-TCP/UDP packet, "
-                                  "dropping a protocol %d packet\n",
-                                  iph->protocol);
                goto out;
        }
 
@@ -1227,75 +1246,99 @@ out:
        return err;
 }
 
+/* This value should be large enough to cover a tagged ethernet header plus
+ * an IPv6 header, all options, and a maximal TCP or UDP header.
+ */
+#define MAX_IPV6_HDR_LEN 256
+
+#define OPT_HDR(type, skb, off) \
+       (type *)(skb_network_header(skb) + (off))
+
 static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb,
                               int recalculate_partial_csum)
 {
-       int err = -EPROTO;
-       struct ipv6hdr *ipv6h = (void *)skb->data;
+       int err;
        u8 nexthdr;
-       unsigned int header_size;
        unsigned int off;
+       unsigned int len;
        bool fragment;
        bool done;
 
+       fragment = false;
        done = false;
 
        off = sizeof(struct ipv6hdr);
 
-       header_size = skb->network_header + off;
-       maybe_pull_tail(skb, header_size);
+       err = maybe_pull_tail(skb, off, MAX_IPV6_HDR_LEN);
+       if (err < 0)
+               goto out;
 
-       nexthdr = ipv6h->nexthdr;
+       nexthdr = ipv6_hdr(skb)->nexthdr;
 
-       while ((off <= sizeof(struct ipv6hdr) + ntohs(ipv6h->payload_len)) &&
-              !done) {
+       len = sizeof(struct ipv6hdr) + ntohs(ipv6_hdr(skb)->payload_len);
+       while (off <= len && !done) {
                switch (nexthdr) {
                case IPPROTO_DSTOPTS:
                case IPPROTO_HOPOPTS:
                case IPPROTO_ROUTING: {
-                       struct ipv6_opt_hdr *hp = (void *)(skb->data + off);
+                       struct ipv6_opt_hdr *hp;
 
-                       header_size = skb->network_header +
-                               off +
-                               sizeof(struct ipv6_opt_hdr);
-                       maybe_pull_tail(skb, header_size);
+                       err = maybe_pull_tail(skb,
+                                             off +
+                                             sizeof(struct ipv6_opt_hdr),
+                                             MAX_IPV6_HDR_LEN);
+                       if (err < 0)
+                               goto out;
 
+                       hp = OPT_HDR(struct ipv6_opt_hdr, skb, off);
                        nexthdr = hp->nexthdr;
                        off += ipv6_optlen(hp);
                        break;
                }
                case IPPROTO_AH: {
-                       struct ip_auth_hdr *hp = (void *)(skb->data + off);
+                       struct ip_auth_hdr *hp;
+
+                       err = maybe_pull_tail(skb,
+                                             off +
+                                             sizeof(struct ip_auth_hdr),
+                                             MAX_IPV6_HDR_LEN);
+                       if (err < 0)
+                               goto out;
+
+                       hp = OPT_HDR(struct ip_auth_hdr, skb, off);
+                       nexthdr = hp->nexthdr;
+                       off += ipv6_authlen(hp);
+                       break;
+               }
+               case IPPROTO_FRAGMENT: {
+                       struct frag_hdr *hp;
 
-                       header_size = skb->network_header +
-                               off +
-                               sizeof(struct ip_auth_hdr);
-                       maybe_pull_tail(skb, header_size);
+                       err = maybe_pull_tail(skb,
+                                             off +
+                                             sizeof(struct frag_hdr),
+                                             MAX_IPV6_HDR_LEN);
+                       if (err < 0)
+                               goto out;
+
+                       hp = OPT_HDR(struct frag_hdr, skb, off);
+
+                       if (hp->frag_off & htons(IP6_OFFSET | IP6_MF))
+                               fragment = true;
 
                        nexthdr = hp->nexthdr;
-                       off += (hp->hdrlen+2)<<2;
+                       off += sizeof(struct frag_hdr);
                        break;
                }
-               case IPPROTO_FRAGMENT:
-                       fragment = true;
-                       /* fall through */
                default:
                        done = true;
                        break;
                }
        }
 
-       if (!done) {
-               if (net_ratelimit())
-                       netdev_err(vif->dev, "Failed to parse packet header\n");
-               goto out;
-       }
+       err = -EPROTO;
 
-       if (fragment) {
-               if (net_ratelimit())
-                       netdev_err(vif->dev, "Packet is a fragment!\n");
+       if (!done || fragment)
                goto out;
-       }
 
        switch (nexthdr) {
        case IPPROTO_TCP:
@@ -1304,17 +1347,17 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb,
                        goto out;
 
                if (recalculate_partial_csum) {
-                       struct tcphdr *tcph = tcp_hdr(skb);
-
-                       header_size = skb->network_header +
-                               off +
-                               sizeof(struct tcphdr);
-                       maybe_pull_tail(skb, header_size);
-
-                       tcph->check = ~csum_ipv6_magic(&ipv6h->saddr,
-                                                      &ipv6h->daddr,
-                                                      skb->len - off,
-                                                      IPPROTO_TCP, 0);
+                       err = maybe_pull_tail(skb,
+                                             off + sizeof(struct tcphdr),
+                                             MAX_IPV6_HDR_LEN);
+                       if (err < 0)
+                               goto out;
+
+                       tcp_hdr(skb)->check =
+                               ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
+                                                &ipv6_hdr(skb)->daddr,
+                                                skb->len - off,
+                                                IPPROTO_TCP, 0);
                }
                break;
        case IPPROTO_UDP:
@@ -1323,25 +1366,20 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb,
                        goto out;
 
                if (recalculate_partial_csum) {
-                       struct udphdr *udph = udp_hdr(skb);
-
-                       header_size = skb->network_header +
-                               off +
-                               sizeof(struct udphdr);
-                       maybe_pull_tail(skb, header_size);
-
-                       udph->check = ~csum_ipv6_magic(&ipv6h->saddr,
-                                                      &ipv6h->daddr,
-                                                      skb->len - off,
-                                                      IPPROTO_UDP, 0);
+                       err = maybe_pull_tail(skb,
+                                             off + sizeof(struct udphdr),
+                                             MAX_IPV6_HDR_LEN);
+                       if (err < 0)
+                               goto out;
+
+                       udp_hdr(skb)->check =
+                               ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
+                                                &ipv6_hdr(skb)->daddr,
+                                                skb->len - off,
+                                                IPPROTO_UDP, 0);
                }
                break;
        default:
-               if (net_ratelimit())
-                       netdev_err(vif->dev,
-                                  "Attempting to checksum a non-TCP/UDP packet, "
-                                  "dropping a protocol %d packet\n",
-                                  nexthdr);
                goto out;
        }
 
index 7578d79b368831085dc5ee70850fd6578ee13357..2f650f68af14e4ec9e37e2c837db3fd55408b9ff 100644 (file)
@@ -300,7 +300,7 @@ static int __init parport_mfc3_init(void)
                if (!request_mem_region(piabase, sizeof(struct pia), "PIA"))
                        continue;
 
-               pp = (struct pia *)ZTWO_VADDR(piabase);
+               pp = ZTWO_VADDR(piabase);
                pp->crb = 0;
                pp->pddrb = 255; /* all data pins output */
                pp->crb = PIA_DDR|32|8;
index c269e430c760a9bc80ad982db9cb4aa211f16f45..2aa7b77c7c88bab6c2b70b79666205c061afec7d 100644 (file)
@@ -447,6 +447,11 @@ static int mvebu_sw_pci_bridge_read(struct mvebu_pcie_port *port,
                *value = 0;
                break;
 
+       case PCI_INTERRUPT_LINE:
+               /* LINE PIN MIN_GNT MAX_LAT */
+               *value = 0;
+               break;
+
        default:
                *value = 0xffffffff;
                return PCIBIOS_BAD_REGISTER_NUMBER;
index 1cf605f6767357947e9a097981caa7d7869ca2f0..ec4ddae1fb54a68641bf4e4b90e6cbec2def6814 100644 (file)
@@ -279,7 +279,9 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data,
 
        status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
        if (ACPI_FAILURE(status)) {
-               acpi_handle_warn(handle, "can't evaluate _ADR (%#x)\n", status);
+               if (status != AE_NOT_FOUND)
+                       acpi_handle_warn(handle,
+                               "can't evaluate _ADR (%#x)\n", status);
                return AE_OK;
        }
 
@@ -489,7 +491,7 @@ static void acpiphp_bus_add(acpi_handle handle)
 
        acpi_bus_scan(handle);
        acpi_bus_get_device(handle, &adev);
-       if (adev)
+       if (acpi_device_enumerated(adev))
                acpi_device_set_power(adev, ACPI_STATE_D0);
 }
 
index ecfac7e72d91ae29a3ec8a5b6e8d159d0f7b7178..8dcccffd6e216b8529da5530019fe557e0f61ff1 100644 (file)
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <acpi/acpi_bus.h>
 #include <linux/sysfs.h>
 #include <linux/kobject.h>
-#include <asm/uaccess.h>
 #include <linux/moduleparam.h>
 #include <linux/pci.h>
+#include <asm/uaccess.h>
 
 #include "acpiphp.h"
 #include "../pci.h"
index 21e865ded1dce01fde77bb29312e2a653be6b4fa..24e147cae667e33dd46346dddeb994e96e868f4e 100644 (file)
@@ -163,8 +163,6 @@ static inline const char *slot_name(struct slot *slot)
 }
 
 #ifdef CONFIG_ACPI
-#include <acpi/acpi.h>
-#include <acpi/acpi_bus.h>
 #include <linux/pci-acpi.h>
 
 void __init pciehp_acpi_slot_detection_init(void);
index 50ce6809829836c38d4aedfa58aeb642b126d9df..2122b2bf006f37576d5bb2e3a22190c5ccacba00 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/module.h>
 #include <linux/acpi.h>
 #include <linux/slab.h>
-#include <acpi/acpi_bus.h>
 
 struct ioapic {
        acpi_handle     handle;
index 577074efbe62f93f39ac00c6f5c4963d53bd2b0d..ce31eb0cdca7396ad64a9891d5cee74056887f9e 100644 (file)
@@ -12,9 +12,6 @@
 #include <linux/pci.h>
 #include <linux/module.h>
 #include <linux/pci-aspm.h>
-#include <acpi/acpi.h>
-#include <acpi/acpi_bus.h>
-
 #include <linux/pci-acpi.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm_qos.h>
@@ -306,10 +303,10 @@ void acpi_pci_remove_bus(struct pci_bus *bus)
 }
 
 /* ACPI bus type */
-static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
+static struct acpi_device *acpi_pci_find_companion(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       bool is_bridge;
+       bool check_children;
        u64 addr;
 
        /*
@@ -317,14 +314,12 @@ static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
         * is set only after acpi_pci_find_device() has been called for the
         * given device.
         */
-       is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
+       check_children = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
                        || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
        /* Please ref to ACPI spec for the syntax of _ADR */
        addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
-       *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge);
-       if (!*handle)
-               return -ENODEV;
-       return 0;
+       return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr,
+                                     check_children);
 }
 
 static void pci_acpi_setup(struct device *dev)
@@ -364,7 +359,7 @@ static bool pci_acpi_bus_match(struct device *dev)
 static struct acpi_bus_type acpi_pci_bus = {
        .name = "PCI",
        .match = pci_acpi_bus_match,
-       .find_device = acpi_pci_find_device,
+       .find_companion = acpi_pci_find_companion,
        .setup = pci_acpi_setup,
        .cleanup = pci_acpi_cleanup,
 };
index 9042fdbd724405bc96808ed699a1d543fcf17c17..25f0bc6591645707bb3b452bbaa4c28bee0efc59 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/cpu.h>
 #include <linux/pm_runtime.h>
 #include <linux/suspend.h>
+#include <linux/kexec.h>
 #include "pci.h"
 
 struct pci_dynid {
@@ -288,12 +289,27 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
        int error, node;
        struct drv_dev_and_id ddi = { drv, dev, id };
 
-       /* Execute driver initialization on node where the device's
-          bus is attached to.  This way the driver likely allocates
-          its local memory on the right node without any need to
-          change it. */
+       /*
+        * Execute driver initialization on node where the device is
+        * attached.  This way the driver likely allocates its local memory
+        * on the right node.
+        */
        node = dev_to_node(&dev->dev);
-       if (node >= 0) {
+
+       /*
+        * On NUMA systems, we are likely to call a PF probe function using
+        * work_on_cpu().  If that probe calls pci_enable_sriov() (which
+        * adds the VF devices via pci_bus_add_device()), we may re-enter
+        * this function to call the VF probe function.  Calling
+        * work_on_cpu() again will cause a lockdep warning.  Since VFs are
+        * always on the same node as the PF, we can work around this by
+        * avoiding work_on_cpu() when we're already on the correct node.
+        *
+        * Preemption is enabled, so it's theoretically unsafe to use
+        * numa_node_id(), but even if we run the probe function on the
+        * wrong node, it should be functionally correct.
+        */
+       if (node >= 0 && node != numa_node_id()) {
                int cpu;
 
                get_online_cpus();
@@ -305,6 +321,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
                put_online_cpus();
        } else
                error = local_pci_probe(&ddi);
+
        return error;
 }
 
@@ -399,12 +416,17 @@ static void pci_device_shutdown(struct device *dev)
        pci_msi_shutdown(pci_dev);
        pci_msix_shutdown(pci_dev);
 
+#ifdef CONFIG_KEXEC
        /*
-        * Turn off Bus Master bit on the device to tell it to not
-        * continue to do DMA. Don't touch devices in D3cold or unknown states.
+        * If this is a kexec reboot, turn off Bus Master bit on the
+        * device to tell it to not continue to do DMA. Don't touch
+        * devices in D3cold or unknown states.
+        * If it is not a kexec reboot, firmware will hit the PCI
+        * devices with big hammer and stop their DMA any way.
         */
-       if (pci_dev->current_state <= PCI_D3hot)
+       if (kexec_in_progress && (pci_dev->current_state <= PCI_D3hot))
                pci_clear_master(pci_dev);
+#endif
 }
 
 #ifdef CONFIG_PM
index d51f45aa669e5ff9184daab1df72776e8165aa84..dbafcc8ef67396da56ce21568d1fb89fe5c8778d 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/nls.h>
 #include <linux/acpi.h>
 #include <linux/pci-acpi.h>
-#include <acpi/acpi_bus.h>
 #include "pci.h"
 
 #define        DEVICE_LABEL_DSM        0x07
index 33120d15666895a2b48aec1c83f7b41f7b93c3be..07369f32e8bbdd79b1294ad844baeb7dc80ef7ea 100644 (file)
@@ -4165,6 +4165,14 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
        return 0;
 }
 
+bool pci_device_is_present(struct pci_dev *pdev)
+{
+       u32 v;
+
+       return pci_bus_read_dev_vendor_id(pdev->bus, pdev->devfn, &v, 0);
+}
+EXPORT_SYMBOL_GPL(pci_device_is_present);
+
 #define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZE
 static char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE] = {0};
 static DEFINE_SPINLOCK(resource_alignment_lock);
index 1576851028db700be2413b01e815cc8387b3cd47..cc9337a71529180eaebc7beb991dfb7c9e186ea8 100644 (file)
@@ -24,7 +24,7 @@ static void pci_stop_dev(struct pci_dev *dev)
        if (dev->is_added) {
                pci_proc_detach_device(dev);
                pci_remove_sysfs_dev_files(dev);
-               device_del(&dev->dev);
+               device_release_driver(&dev->dev);
                dev->is_added = 0;
        }
 
@@ -34,6 +34,8 @@ static void pci_stop_dev(struct pci_dev *dev)
 
 static void pci_destroy_dev(struct pci_dev *dev)
 {
+       device_del(&dev->dev);
+
        down_write(&pci_bus_sem);
        list_del(&dev->bus_list);
        up_write(&pci_bus_sem);
index 33f9dc1f14fdd3e64db47325550b9f5ba93360b5..e216a46f41948f919cefce779de11d88aafc2768 100644 (file)
@@ -116,7 +116,6 @@ config PINCTRL_IMX1_CORE
 
 config PINCTRL_IMX27
        bool "IMX27 pinctrl driver"
-       depends on OF
        depends on SOC_IMX27
        select PINCTRL_IMX1_CORE
        help
@@ -124,7 +123,6 @@ config PINCTRL_IMX27
 
 config PINCTRL_IMX35
        bool "IMX35 pinctrl driver"
-       depends on OF
        depends on SOC_IMX35
        select PINCTRL_IMX
        help
@@ -132,7 +130,6 @@ config PINCTRL_IMX35
 
 config PINCTRL_IMX50
        bool "IMX50 pinctrl driver"
-       depends on OF
        depends on SOC_IMX50
        select PINCTRL_IMX
        help
@@ -140,7 +137,6 @@ config PINCTRL_IMX50
 
 config PINCTRL_IMX51
        bool "IMX51 pinctrl driver"
-       depends on OF
        depends on SOC_IMX51
        select PINCTRL_IMX
        help
@@ -148,7 +144,6 @@ config PINCTRL_IMX51
 
 config PINCTRL_IMX53
        bool "IMX53 pinctrl driver"
-       depends on OF
        depends on SOC_IMX53
        select PINCTRL_IMX
        help
@@ -156,7 +151,6 @@ config PINCTRL_IMX53
 
 config PINCTRL_IMX6Q
        bool "IMX6Q/DL pinctrl driver"
-       depends on OF
        depends on SOC_IMX6Q
        select PINCTRL_IMX
        help
@@ -164,7 +158,6 @@ config PINCTRL_IMX6Q
 
 config PINCTRL_IMX6SL
        bool "IMX6SL pinctrl driver"
-       depends on OF
        depends on SOC_IMX6SL
        select PINCTRL_IMX
        help
@@ -172,7 +165,6 @@ config PINCTRL_IMX6SL
 
 config PINCTRL_VF610
        bool "Freescale Vybrid VF610 pinctrl driver"
-       depends on OF
        depends on SOC_VF610
        select PINCTRL_IMX
        help
index 2832576d8b12ee7c99e24896c3fe333dd8cffadc..114f5ef4b73abdbcd02e524a1a34f84aeeb5b7cb 100644 (file)
@@ -512,6 +512,7 @@ static const struct dev_pm_ops byt_gpio_pm_ops = {
 
 static const struct acpi_device_id byt_gpio_acpi_match[] = {
        { "INT33B2", 0 },
+       { "INT33FC", 0 },
        { }
 };
 MODULE_DEVICE_TABLE(acpi, byt_gpio_acpi_match);
index f77914ac081a237684035a42be4e2252a945cdc8..17aecde1b51d912584765556188121fa82413795 100644 (file)
@@ -638,6 +638,13 @@ int imx1_pinctrl_core_probe(struct platform_device *pdev,
                return -EINVAL;
        }
 
+       ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
+       if (ret) {
+               pinctrl_unregister(ipctl->pctl);
+               dev_err(&pdev->dev, "Failed to populate subdevices\n");
+               return ret;
+       }
+
        dev_info(&pdev->dev, "initialized IMX pinctrl driver\n");
 
        return 0;
index 7111c3b591303cec2f3daa36d22329989c0847b9..6559e143676870d4fc63d589310a822257784e7d 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;
@@ -846,14 +1060,14 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s,
                   (mode < 0) ? "unknown" : modes[mode],
                   pull ? "pull" : "none");
 
-       if (label && !is_out) {
-               int             irq = gpio_to_irq(gpio);
+       if (!is_out) {
+               int irq = gpio_to_irq(gpio);
                struct irq_desc *desc = irq_to_desc(irq);
 
                /* This races with request_irq(), set_irq_type(),
                 * and set_irq_wake() ... but those are "rare".
                 */
-               if (irq >= 0 && desc->action) {
+               if (irq > 0 && desc && desc->action) {
                        char *trigger;
                        u32 bitmask = nmk_gpio_get_bitmask(gpio);
 
@@ -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 bf76a654c02f4d9d4f64b26e52c2e0acfadaa605..d26c16360161ae683026001d3d9ca93f4b425718 100644 (file)
@@ -1730,11 +1730,11 @@ static const unsigned int du_clk_out_1_pins[] = {
 static const unsigned int du_clk_out_1_mux[] = {
        DU1_DOTCLKOUT1_MARK
 };
-static const unsigned int du_sync_1_pins[] = {
+static const unsigned int du_sync_pins[] = {
        /* EXVSYNC/VSYNC, EXHSYNC/HSYNC, EXDISP/EXODDF/EXCDE */
        RCAR_GP_PIN(3, 29), RCAR_GP_PIN(3, 28), RCAR_GP_PIN(3, 27),
 };
-static const unsigned int du_sync_1_mux[] = {
+static const unsigned int du_sync_mux[] = {
        DU1_EXODDF_DU1_ODDF_DISP_CDE_MARK,
        DU1_EXVSYNC_DU1_VSYNC_MARK, DU1_EXHSYNC_DU1_HSYNC_MARK
 };
@@ -1742,6 +1742,9 @@ static const unsigned int du_cde_disp_pins[] = {
        /* CDE DISP */
        RCAR_GP_PIN(3, 31), RCAR_GP_PIN(3, 30),
 };
+static const unsigned int du_cde_disp_mux[] = {
+       DU1_CDE_MARK, DU1_DISP_MARK
+};
 static const unsigned int du0_clk_in_pins[] = {
        /* CLKIN */
        RCAR_GP_PIN(6, 31),
@@ -1749,15 +1752,26 @@ static const unsigned int du0_clk_in_pins[] = {
 static const unsigned int du0_clk_in_mux[] = {
        DU0_DOTCLKIN_MARK
 };
-static const unsigned int du_cde_disp_mux[] = {
-       DU1_CDE_MARK, DU1_DISP_MARK
-};
 static const unsigned int du1_clk_in_pins[] = {
        /* CLKIN */
-       RCAR_GP_PIN(7, 20), RCAR_GP_PIN(7, 19), RCAR_GP_PIN(3, 24),
+       RCAR_GP_PIN(3, 24),
 };
 static const unsigned int du1_clk_in_mux[] = {
-       DU1_DOTCLKIN_C_MARK, DU1_DOTCLKIN_B_MARK, DU1_DOTCLKIN_MARK
+       DU1_DOTCLKIN_MARK
+};
+static const unsigned int du1_clk_in_b_pins[] = {
+       /* CLKIN */
+       RCAR_GP_PIN(7, 19),
+};
+static const unsigned int du1_clk_in_b_mux[] = {
+       DU1_DOTCLKIN_B_MARK,
+};
+static const unsigned int du1_clk_in_c_pins[] = {
+       /* CLKIN */
+       RCAR_GP_PIN(7, 20),
+};
+static const unsigned int du1_clk_in_c_mux[] = {
+       DU1_DOTCLKIN_C_MARK,
 };
 /* - ETH -------------------------------------------------------------------- */
 static const unsigned int eth_link_pins[] = {
@@ -2670,10 +2684,12 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(du_rgb888),
        SH_PFC_PIN_GROUP(du_clk_out_0),
        SH_PFC_PIN_GROUP(du_clk_out_1),
-       SH_PFC_PIN_GROUP(du_sync_1),
+       SH_PFC_PIN_GROUP(du_sync),
        SH_PFC_PIN_GROUP(du_cde_disp),
        SH_PFC_PIN_GROUP(du0_clk_in),
        SH_PFC_PIN_GROUP(du1_clk_in),
+       SH_PFC_PIN_GROUP(du1_clk_in_b),
+       SH_PFC_PIN_GROUP(du1_clk_in_c),
        SH_PFC_PIN_GROUP(eth_link),
        SH_PFC_PIN_GROUP(eth_magic),
        SH_PFC_PIN_GROUP(eth_mdio),
@@ -2805,7 +2821,7 @@ static const char * const du_groups[] = {
        "du_rgb888",
        "du_clk_out_0",
        "du_clk_out_1",
-       "du_sync_1",
+       "du_sync",
        "du_cde_disp",
 };
 
@@ -2815,6 +2831,8 @@ static const char * const du0_groups[] = {
 
 static const char * const du1_groups[] = {
        "du1_clk_in",
+       "du1_clk_in_b",
+       "du1_clk_in_c",
 };
 
 static const char * const eth_groups[] = {
index c9076bdaf2c18fc9a34c3d3f906cd333971f57e5..c91f69b39db4b8c637d5182eb5f8f85aed1bf79b 100644 (file)
@@ -41,8 +41,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
-
-#include <acpi/acpi_drivers.h>
 #include <acpi/video.h>
 
 MODULE_AUTHOR("Carlos Corbacho");
index 594323a926cf0b8c62c4accfd88d297fe0caa567..7f4dc6f51f8afdf9df7984818585e10bf2047280 100644 (file)
@@ -53,8 +53,7 @@
 #include <linux/rfkill.h>
 #include <linux/slab.h>
 #include <linux/dmi.h>
-#include <acpi/acpi_drivers.h>
-#include <acpi/acpi_bus.h>
+#include <linux/acpi.h>
 
 #define ASUS_LAPTOP_VERSION    "0.42"
 
index 19c313b056c334c771e678b05146ee7676e7edac..df7ecb9ecd9d7c95b66cdbc79f4f17bfaf4bf49c 100644 (file)
@@ -45,8 +45,7 @@
 #include <linux/seq_file.h>
 #include <linux/platform_device.h>
 #include <linux/thermal.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <acpi/video.h>
 
 #include "asus-wmi.h"
index 6dfa8d3b4eec22dfd826e6d7de7cc811d565340b..70d355a9ae2cc2f7cdc2efb04941a2c76688139f 100644 (file)
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <linux/backlight.h>
 #include <linux/input.h>
 #include <linux/rfkill.h>
 
 MODULE_LICENSE("GPL");
 
-
 struct cmpc_accel {
        int sensitivity;
        int g_select;
index bcf8cc6b5537cca1a1c3ad016d700ca3f30104a4..dbc97a33bbc8ea2cbd61590590f533c13680a3a4 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/types.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
-#include <acpi/acpi_drivers.h>
 #include <linux/acpi.h>
 #include <linux/string.h>
 
index 60e0900bc117995e6373bfb5bedfcc1c8aac2aed..390e8e33d5e31b77d67c7d7a1a8c659ead20e791 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/types.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
-#include <acpi/acpi_drivers.h>
 #include <linux/acpi.h>
 #include <linux/string.h>
 #include <linux/dmi.h>
index dec68e7a99c79482f5f7cf4eb78b98bd0e2cd58d..bcde1ea02dd36ecb7024292cf03187edeab1fdd6 100644 (file)
@@ -28,8 +28,7 @@
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 #include <linux/slab.h>
-#include <acpi/acpi_drivers.h>
-#include <acpi/acpi_bus.h>
+#include <linux/acpi.h>
 #include <linux/uaccess.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
index af67e6e56ebbf3165d6c315daf6e88b155328d8f..6112933f627834cc1c4561feb68a3edc28492e5e 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/input/sparse-keymap.h>
 #include <linux/dmi.h>
 #include <linux/fb.h>
-#include <acpi/acpi_bus.h>
+#include <linux/acpi.h>
 
 #include "asus-wmi.h"
 
index a8e43cf70fac96309d7b689265b7c2b6ba2a19db..aff4d0670edfec733e131c0137fd82f70e0d2206 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/uaccess.h>
 #include <linux/leds.h>
 #include <linux/atomic.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include "../../misc/lis3lv02d/lis3lv02d.h"
 
 #define DRIVER_NAME     "hp_accel"
index 19ec95147f6925d1de52e99886f7efc6a10dff7a..6dd060a0bb65293d47a2d02669a62785403b8ae0 100644 (file)
@@ -26,8 +26,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/types.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <linux/rfkill.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
index a2083a9e5662d660fd95cbb297815aa0570c8268..d45bca34bf1b3bc935f5dc9b729fd87219cf4825 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 MODULE_LICENSE("GPL");
 
index 1838400dc0360615f799fac64a82b51f7efb9c17..04cf5dffdfd9152436719e69955df00afe30e144 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <linux/init.h>
 #include <linux/module.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 MODULE_LICENSE("GPL");
 
index 11244f8703c402c876fb34b0e107383781661416..e8b46d2c468c963b37f338534b40aad814ac8792 100644 (file)
 #include <linux/types.h>
 #include <linux/pci.h>
 #include <linux/pm.h>
-
 #include <linux/thermal.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 MODULE_AUTHOR("Thomas Sujith");
 MODULE_AUTHOR("Zhang Rui");
index f6f18cde0f11c70f035e88c1da80f96506e0b3ab..4bc96041678573ec89eed8cf8c0e185f7e53d864 100644 (file)
@@ -50,9 +50,6 @@
 #include <linux/platform_device.h>
 #include <linux/dmi.h>
 #include <linux/rfkill.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-
 
 #define DRIVER_NAME    "intel_oaktrail"
 #define DRIVER_VERSION "0.4ac1"
index 0aea63b3729a4481ece3bc5d1c8dfb041fe0f2bc..3c59c0a3ee0f0f2d57a895f853d6915c37d39822 100644 (file)
@@ -20,8 +20,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 MODULE_AUTHOR("Dave Airlie");
 MODULE_DESCRIPTION("MXM WMI Driver");
index 3008fd20572e96a2d93823c4d15db27592fed2e2..609d38779b2680175660557b1093fa1026c91aad 100644 (file)
 #include <linux/seq_file.h>
 #include <linux/uaccess.h>
 #include <linux/slab.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
 
-
 #ifndef ACPI_HOTKEY_COMPONENT
 #define ACPI_HOTKEY_COMPONENT  0x10000000
 #endif
index 47ae0c47d4b5ccf67749cc110f86788e7c74753f..c9f6e511daa639f9656f6e96de7603be944e934b 100644 (file)
@@ -24,8 +24,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/types.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 MODULE_AUTHOR("Hu Tao <hutao@cn.fujitsu.com>");
 MODULE_DESCRIPTION("pvpanic device driver");
index cae7098e9b0d70adf271eb9c31a1e833919a54b1..5413f62d2e6136b62327abdd0d32c8f000b3c531 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/platform_device.h>
 #include <linux/backlight.h>
 #include <linux/dmi.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 #define SAMSUNGQ10_BL_MAX_INTENSITY 7
 
index fb233ae7bb0e3e8374691818cfe61125e66371a5..563e4f595f836c1d1ad966688d61c33e4a8d33d5 100644 (file)
@@ -61,9 +61,6 @@
 #include <linux/workqueue.h>
 #include <linux/acpi.h>
 #include <linux/slab.h>
-#include <acpi/acpi_drivers.h>
-#include <acpi/acpi_bus.h>
-#include <asm/uaccess.h>
 #include <linux/sonypi.h>
 #include <linux/sony-laptop.h>
 #include <linux/rfkill.h>
@@ -71,6 +68,7 @@
 #include <linux/poll.h>
 #include <linux/miscdevice.h>
 #endif
+#include <asm/uaccess.h>
 
 #define dprintk(fmt, ...)                      \
 do {                                           \
index 9b93fdb61ed7c03733ead31aaa7f0ef632a6bd00..6a6ea28a7e51df054ff2f514fde39d7d9f10b264 100644 (file)
@@ -32,9 +32,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/types.h>
-#include <acpi/acpi.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <linux/platform_device.h>
 
 #define GUID "C364AC71-36DB-495A-8494-B439D472A505"
index 58b0274d24cc2968e35e6a9cdad75b1533c35e2d..defb6afc1409cc7fff0863d6829c5c26478b6a4a 100644 (file)
@@ -61,7 +61,6 @@
 #include <linux/freezer.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-
 #include <linux/nvram.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/input.h>
 #include <linux/leds.h>
 #include <linux/rfkill.h>
-#include <asm/uaccess.h>
-
 #include <linux/dmi.h>
 #include <linux/jiffies.h>
 #include <linux/workqueue.h>
-
+#include <linux/acpi.h>
+#include <linux/pci_ids.h>
+#include <linux/thinkpad_acpi.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/initval.h>
-
-#include <acpi/acpi_drivers.h>
-
-#include <linux/pci_ids.h>
-
-#include <linux/thinkpad_acpi.h>
+#include <asm/uaccess.h>
 
 /* ThinkPad CMOS commands */
 #define TP_CMOS_VOLUME_DOWN    0
index 7fce391818d30a183962b7888a8bfd275b10423c..7ad1ed091f9225fc572a1b70fde9ecf622d06ad1 100644 (file)
 #include <linux/slab.h>
 #include <linux/workqueue.h>
 #include <linux/i8042.h>
-
+#include <linux/acpi.h>
 #include <asm/uaccess.h>
 
-#include <acpi/acpi_drivers.h>
-
 MODULE_AUTHOR("John Belmonte");
 MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver");
 MODULE_LICENSE("GPL");
index 74dd01ae343b01f5f5a9827c5ec02f11ceee61b5..2cb1ea62b4a7f9ac7b268adadb251105be279923 100644 (file)
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/types.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 MODULE_AUTHOR("Jes Sorensen <Jes.Sorensen@gmail.com>");
 MODULE_DESCRIPTION("Toshiba Laptop ACPI Bluetooth Enable Driver");
 MODULE_LICENSE("GPL");
 
-
 static int toshiba_bt_rfkill_add(struct acpi_device *device);
 static int toshiba_bt_rfkill_remove(struct acpi_device *device);
 static void toshiba_bt_rfkill_notify(struct acpi_device *device, u32 event);
index c2e7b2657aeb31bf5ab50a4f8a8821e2ad53f696..43d13295e63d53a50b62dae995d3a63b7e112a3a 100644 (file)
@@ -37,8 +37,6 @@
 #include <linux/acpi.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
 
 ACPI_MODULE_NAME("wmi");
 MODULE_AUTHOR("Carlos Corbacho");
index 4b1377bd59446a50405e00414418adf9ac8f8381..49cbccec6e2de1ecffa260348c3582e609ba1507 100644 (file)
@@ -18,8 +18,7 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/input.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 
 #define MODULE_NAME "xo15-ebook"
 
index 14655a0f0431b35bd9a0988b669c510a162155e3..156d14e2587e1ede2cfb0e6c93266a9d1735be73 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/pnp.h>
 #include <linux/slab.h>
 #include <linux/mod_devicetable.h>
-#include <acpi/acpi_bus.h>
 
 #include "../base.h"
 #include "pnpacpi.h"
@@ -329,20 +328,15 @@ static int __init acpi_pnp_match(struct device *dev, void *_pnp)
            && compare_pnp_id(pnp->id, acpi_device_hid(acpi));
 }
 
-static int __init acpi_pnp_find_device(struct device *dev, acpi_handle * handle)
+static struct acpi_device * __init acpi_pnp_find_companion(struct device *dev)
 {
-       struct device *adev;
-       struct acpi_device *acpi;
-
-       adev = bus_find_device(&acpi_bus_type, NULL,
-                              to_pnp_dev(dev), acpi_pnp_match);
-       if (!adev)
-               return -ENODEV;
+       dev = bus_find_device(&acpi_bus_type, NULL, to_pnp_dev(dev),
+                             acpi_pnp_match);
+       if (!dev)
+               return NULL;
 
-       acpi = to_acpi_device(adev);
-       *handle = acpi->handle;
-       put_device(adev);
-       return 0;
+       put_device(dev);
+       return to_acpi_device(dev);
 }
 
 /* complete initialization of a PNPACPI device includes having
@@ -356,7 +350,7 @@ static bool acpi_pnp_bus_match(struct device *dev)
 static struct acpi_bus_type __initdata acpi_pnp_bus = {
        .name        = "PNP",
        .match       = acpi_pnp_bus_match,
-       .find_device = acpi_pnp_find_device,
+       .find_companion = acpi_pnp_find_companion,
 };
 
 int pnpacpi_disabled __initdata;
index 3e60225b0227b2d6ff8f0c2ad863f195256c4b2e..051ef9699777519951c2c87b2e39c6dc5b69d27c 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef ACPI_PNP_H
 #define ACPI_PNP_H
 
-#include <acpi/acpi_bus.h>
 #include <linux/acpi.h>
 #include <linux/pnp.h>
 
index f64921756ad610375134b3b59f13bbdb5d9906af..f224d59c4b6be35b8a5d827dde6cdc173953f3f5 100644 (file)
@@ -87,7 +87,6 @@ void dasd_gendisk_free(struct dasd_block *block)
 {
        if (block->gdp) {
                del_gendisk(block->gdp);
-               block->gdp->queue = NULL;
                block->gdp->private_data = NULL;
                put_disk(block->gdp);
                block->gdp = NULL;
index f7aa080e9b28db1d5b962de7b5380f60ae97cc10..1465e9563101f0a2cbc697a8f26edb2200368d5f 100644 (file)
@@ -35,7 +35,6 @@ struct read_info_sccb {
        u8      _reserved5[4096 - 112]; /* 112-4095 */
 } __packed __aligned(PAGE_SIZE);
 
-static __initdata struct init_sccb early_event_mask_sccb __aligned(PAGE_SIZE);
 static __initdata struct read_info_sccb early_read_info_sccb;
 static __initdata char sccb_early[PAGE_SIZE] __aligned(PAGE_SIZE);
 static unsigned long sclp_hsa_size;
@@ -113,7 +112,7 @@ static void __init sclp_facilities_detect(void)
 
 bool __init sclp_has_linemode(void)
 {
-       struct init_sccb *sccb = &early_event_mask_sccb;
+       struct init_sccb *sccb = (void *) &sccb_early;
 
        if (sccb->header.response_code != 0x20)
                return 0;
@@ -126,7 +125,7 @@ bool __init sclp_has_linemode(void)
 
 bool __init sclp_has_vt220(void)
 {
-       struct init_sccb *sccb = &early_event_mask_sccb;
+       struct init_sccb *sccb = (void *) &sccb_early;
 
        if (sccb->header.response_code != 0x20)
                return 0;
index a9fe3de2dec17fcce1717d99389468dfc46f4f98..b3f791b2c1f8994de2287052275fc8853b3b946a 100644 (file)
@@ -260,16 +260,16 @@ static int blacklist_parse_proc_parameters(char *buf)
 
        parm = strsep(&buf, " ");
 
-       if (strcmp("free", parm) == 0)
+       if (strcmp("free", parm) == 0) {
                rc = blacklist_parse_parameters(buf, free, 0);
-       else if (strcmp("add", parm) == 0)
+               css_schedule_eval_all_unreg(0);
+       } else if (strcmp("add", parm) == 0)
                rc = blacklist_parse_parameters(buf, add, 0);
        else if (strcmp("purge", parm) == 0)
                return ccw_purge_blacklisted();
        else
                return -EINVAL;
 
-       css_schedule_reprobe();
 
        return rc;
 }
index 13299f902676e647d43dce13d95f864c81300f53..eee70cb8730bf381fe4da4373a7fc65b98361fba 100644 (file)
@@ -237,26 +237,6 @@ void chsc_chp_offline(struct chp_id chpid)
        for_each_subchannel_staged(s390_subchannel_remove_chpid, NULL, &link);
 }
 
-static int s390_process_res_acc_new_sch(struct subchannel_id schid, void *data)
-{
-       struct schib schib;
-       /*
-        * We don't know the device yet, but since a path
-        * may be available now to the device we'll have
-        * to do recognition again.
-        * Since we don't have any idea about which chpid
-        * that beast may be on we'll have to do a stsch
-        * on all devices, grr...
-        */
-       if (stsch_err(schid, &schib))
-               /* We're through */
-               return -ENXIO;
-
-       /* Put it on the slow path. */
-       css_schedule_eval(schid);
-       return 0;
-}
-
 static int __s390_process_res_acc(struct subchannel *sch, void *data)
 {
        spin_lock_irq(sch->lock);
@@ -287,8 +267,8 @@ static void s390_process_res_acc(struct chp_link *link)
         * The more information we have (info), the less scanning
         * will we have to do.
         */
-       for_each_subchannel_staged(__s390_process_res_acc,
-                                  s390_process_res_acc_new_sch, link);
+       for_each_subchannel_staged(__s390_process_res_acc, NULL, link);
+       css_schedule_reprobe();
 }
 
 static int
@@ -663,19 +643,6 @@ static int s390_subchannel_vary_chpid_on(struct subchannel *sch, void *data)
        return 0;
 }
 
-static int
-__s390_vary_chpid_on(struct subchannel_id schid, void *data)
-{
-       struct schib schib;
-
-       if (stsch_err(schid, &schib))
-               /* We're through */
-               return -ENXIO;
-       /* Put it on the slow path. */
-       css_schedule_eval(schid);
-       return 0;
-}
-
 /**
  * chsc_chp_vary - propagate channel-path vary operation to subchannels
  * @chpid: channl-path ID
@@ -694,7 +661,8 @@ int chsc_chp_vary(struct chp_id chpid, int on)
                /* Try to update the channel path description. */
                chp_update_desc(chp);
                for_each_subchannel_staged(s390_subchannel_vary_chpid_on,
-                                          __s390_vary_chpid_on, &chpid);
+                                          NULL, &chpid);
+               css_schedule_reprobe();
        } else
                for_each_subchannel_staged(s390_subchannel_vary_chpid_off,
                                           NULL, &chpid);
index 8c2cb87bccc5d8b1a195ff1dc43181309aa75d82..0268e5fd59b5522fe1d61dbf90ddf17ed4e2df1f 100644 (file)
@@ -69,7 +69,8 @@ static int call_fn_known_sch(struct device *dev, void *data)
        struct cb_data *cb = data;
        int rc = 0;
 
-       idset_sch_del(cb->set, sch->schid);
+       if (cb->set)
+               idset_sch_del(cb->set, sch->schid);
        if (cb->fn_known_sch)
                rc = cb->fn_known_sch(sch, cb->data);
        return rc;
@@ -115,6 +116,13 @@ int for_each_subchannel_staged(int (*fn_known)(struct subchannel *, void *),
        cb.fn_known_sch = fn_known;
        cb.fn_unknown_sch = fn_unknown;
 
+       if (fn_known && !fn_unknown) {
+               /* Skip idset allocation in case of known-only loop. */
+               cb.set = NULL;
+               return bus_for_each_dev(&css_bus_type, NULL, &cb,
+                                       call_fn_known_sch);
+       }
+
        cb.set = idset_sch_new();
        if (!cb.set)
                /* fall back to brute force scanning in case of oom */
@@ -553,6 +561,9 @@ static int slow_eval_unknown_fn(struct subchannel_id schid, void *data)
                default:
                        rc = 0;
                }
+               /* Allow scheduling here since the containing loop might
+                * take a while.  */
+               cond_resched();
        }
        return rc;
 }
@@ -572,7 +583,7 @@ static void css_slow_path_func(struct work_struct *unused)
        spin_unlock_irqrestore(&slow_subchannel_lock, flags);
 }
 
-static DECLARE_WORK(slow_path_work, css_slow_path_func);
+static DECLARE_DELAYED_WORK(slow_path_work, css_slow_path_func);
 struct workqueue_struct *cio_work_q;
 
 void css_schedule_eval(struct subchannel_id schid)
@@ -582,7 +593,7 @@ void css_schedule_eval(struct subchannel_id schid)
        spin_lock_irqsave(&slow_subchannel_lock, flags);
        idset_sch_add(slow_subchannel_set, schid);
        atomic_set(&css_eval_scheduled, 1);
-       queue_work(cio_work_q, &slow_path_work);
+       queue_delayed_work(cio_work_q, &slow_path_work, 0);
        spin_unlock_irqrestore(&slow_subchannel_lock, flags);
 }
 
@@ -593,7 +604,7 @@ void css_schedule_eval_all(void)
        spin_lock_irqsave(&slow_subchannel_lock, flags);
        idset_fill(slow_subchannel_set);
        atomic_set(&css_eval_scheduled, 1);
-       queue_work(cio_work_q, &slow_path_work);
+       queue_delayed_work(cio_work_q, &slow_path_work, 0);
        spin_unlock_irqrestore(&slow_subchannel_lock, flags);
 }
 
@@ -606,7 +617,7 @@ static int __unset_registered(struct device *dev, void *data)
        return 0;
 }
 
-static void css_schedule_eval_all_unreg(void)
+void css_schedule_eval_all_unreg(unsigned long delay)
 {
        unsigned long flags;
        struct idset *unreg_set;
@@ -624,7 +635,7 @@ static void css_schedule_eval_all_unreg(void)
        spin_lock_irqsave(&slow_subchannel_lock, flags);
        idset_add_set(slow_subchannel_set, unreg_set);
        atomic_set(&css_eval_scheduled, 1);
-       queue_work(cio_work_q, &slow_path_work);
+       queue_delayed_work(cio_work_q, &slow_path_work, delay);
        spin_unlock_irqrestore(&slow_subchannel_lock, flags);
        idset_free(unreg_set);
 }
@@ -637,7 +648,8 @@ void css_wait_for_slow_path(void)
 /* Schedule reprobing of all unregistered subchannels. */
 void css_schedule_reprobe(void)
 {
-       css_schedule_eval_all_unreg();
+       /* Schedule with a delay to allow merging of subsequent calls. */
+       css_schedule_eval_all_unreg(1 * HZ);
 }
 EXPORT_SYMBOL_GPL(css_schedule_reprobe);
 
index 29351321bad6c73b97cdfc490c1d5d71ae12e6ce..2c9107e2025143b34fc5da2be3118b0fe013e7c9 100644 (file)
@@ -133,6 +133,7 @@ extern struct channel_subsystem *channel_subsystems[];
 /* Helper functions to build lists for the slow path. */
 void css_schedule_eval(struct subchannel_id schid);
 void css_schedule_eval_all(void);
+void css_schedule_eval_all_unreg(unsigned long delay);
 int css_complete_work(void);
 
 int sch_is_pseudo_sch(struct subchannel *);
index 02300dcfac91f87397c030f11eab825d1361f393..ab3baa7f95082e0cabf03906354c69ae9ed8880b 100644 (file)
@@ -591,7 +591,13 @@ static int ap_init_queue(ap_qid_t qid)
                if (rc != -ENODEV && rc != -EBUSY)
                        break;
                if (i < AP_MAX_RESET - 1) {
-                       udelay(5);
+                       /* Time we are waiting until we give up (0.7sec * 90).
+                        * Since the actual request (in progress) will not
+                        * interrupted immediately for the reset command,
+                        * we have to be patient. In worst case we have to
+                        * wait 60sec + reset time (some msec).
+                        */
+                       schedule_timeout(AP_RESET_TIMEOUT);
                        status = ap_test_queue(qid, &dummy, &dummy);
                }
        }
@@ -992,6 +998,28 @@ static ssize_t ap_domain_show(struct bus_type *bus, char *buf)
 
 static BUS_ATTR(ap_domain, 0444, ap_domain_show, NULL);
 
+static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf)
+{
+       if (ap_configuration != NULL) { /* QCI not supported */
+               if (test_facility(76)) { /* format 1 - 256 bit domain field */
+                       return snprintf(buf, PAGE_SIZE,
+                               "0x%08x%08x%08x%08x%08x%08x%08x%08x\n",
+                       ap_configuration->adm[0], ap_configuration->adm[1],
+                       ap_configuration->adm[2], ap_configuration->adm[3],
+                       ap_configuration->adm[4], ap_configuration->adm[5],
+                       ap_configuration->adm[6], ap_configuration->adm[7]);
+               } else { /* format 0 - 16 bit domain field */
+                       return snprintf(buf, PAGE_SIZE, "%08x%08x\n",
+                       ap_configuration->adm[0], ap_configuration->adm[1]);
+                 }
+       } else {
+               return snprintf(buf, PAGE_SIZE, "not supported\n");
+         }
+}
+
+static BUS_ATTR(ap_control_domain_mask, 0444,
+               ap_control_domain_mask_show, NULL);
+
 static ssize_t ap_config_time_show(struct bus_type *bus, char *buf)
 {
        return snprintf(buf, PAGE_SIZE, "%d\n", ap_config_time);
@@ -1077,6 +1105,7 @@ static BUS_ATTR(poll_timeout, 0644, poll_timeout_show, poll_timeout_store);
 
 static struct bus_attribute *const ap_bus_attrs[] = {
        &bus_attr_ap_domain,
+       &bus_attr_ap_control_domain_mask,
        &bus_attr_config_time,
        &bus_attr_poll_thread,
        &bus_attr_ap_interrupts,
index 685f6cc022f92e929e60d865d817caca13269afb..6405ae24a7a69674ddc602d5bbef2a9ccd29d7bf 100644 (file)
@@ -33,7 +33,7 @@
 #define AP_DEVICES 64          /* Number of AP devices. */
 #define AP_DOMAINS 16          /* Number of AP domains. */
 #define AP_MAX_RESET 90                /* Maximum number of resets. */
-#define AP_RESET_TIMEOUT (HZ/2)        /* Time in ticks for reset timeouts. */
+#define AP_RESET_TIMEOUT (HZ*0.7)      /* Time in ticks for reset timeouts. */
 #define AP_CONFIG_TIME 30      /* Time in seconds between AP bus rescans. */
 #define AP_POLL_TIME 1         /* Time in ticks between receive polls. */
 
@@ -125,6 +125,8 @@ static inline int ap_test_bit(unsigned int *ptr, unsigned int nr)
 #define AP_FUNC_CRT4K 2
 #define AP_FUNC_COPRO 3
 #define AP_FUNC_ACCEL 4
+#define AP_FUNC_EP11  5
+#define AP_FUNC_APXA  6
 
 /*
  * AP reset flag states
index 31cfaa556072c0154373d0d3a7fbccb0b54a30e9..3d4bc904d149706cfb8c5c65f9f0b933614e31b6 100644 (file)
@@ -44,6 +44,8 @@
 #include "zcrypt_debug.h"
 #include "zcrypt_api.h"
 
+#include "zcrypt_msgtype6.h"
+
 /*
  * Module description.
  */
@@ -554,9 +556,9 @@ static long zcrypt_send_cprb(struct ica_xcRB *xcRB)
        spin_lock_bh(&zcrypt_device_lock);
        list_for_each_entry(zdev, &zcrypt_device_list, list) {
                if (!zdev->online || !zdev->ops->send_cprb ||
-                   (xcRB->user_defined != AUTOSELECT &&
-                       AP_QID_DEVICE(zdev->ap_dev->qid) != xcRB->user_defined)
-                   )
+                  (zdev->ops->variant == MSGTYPE06_VARIANT_EP11) ||
+                  (xcRB->user_defined != AUTOSELECT &&
+                   AP_QID_DEVICE(zdev->ap_dev->qid) != xcRB->user_defined))
                        continue;
                zcrypt_device_get(zdev);
                get_device(&zdev->ap_dev->device);
@@ -581,6 +583,82 @@ static long zcrypt_send_cprb(struct ica_xcRB *xcRB)
        return -ENODEV;
 }
 
+struct ep11_target_dev_list {
+       short                   targets_num;
+       struct ep11_target_dev  *targets;
+};
+
+static bool is_desired_ep11dev(unsigned int dev_qid,
+                              struct ep11_target_dev_list dev_list)
+{
+       int n;
+
+       for (n = 0; n < dev_list.targets_num; n++, dev_list.targets++) {
+               if ((AP_QID_DEVICE(dev_qid) == dev_list.targets->ap_id) &&
+                   (AP_QID_QUEUE(dev_qid) == dev_list.targets->dom_id)) {
+                       return true;
+               }
+       }
+       return false;
+}
+
+static long zcrypt_send_ep11_cprb(struct ep11_urb *xcrb)
+{
+       struct zcrypt_device *zdev;
+       bool autoselect = false;
+       struct ep11_target_dev_list ep11_dev_list;
+       int rc;
+
+       ep11_dev_list.targets_num = (short) xcrb->targets_num,
+       ep11_dev_list.targets = kmalloc((short)xcrb->targets_num *
+                                        sizeof(struct ep11_target_dev),
+                                        GFP_KERNEL);
+       if (!ep11_dev_list.targets)
+               return -ENOMEM;
+
+       if (copy_from_user(ep11_dev_list.targets, xcrb->targets,
+                          xcrb->targets_num * sizeof(struct ep11_target_dev)))
+               return -EFAULT;
+
+       /* empty list indicates autoselect (all available targets) */
+       if (ep11_dev_list.targets_num == 0)
+               autoselect = true;
+
+       spin_lock_bh(&zcrypt_device_lock);
+       list_for_each_entry(zdev, &zcrypt_device_list, list) {
+               /* check if device is eligible */
+               if (!zdev->online ||
+                   zdev->ops->variant != MSGTYPE06_VARIANT_EP11)
+                       continue;
+
+               /* check if device is selected as valid target */
+               if (!is_desired_ep11dev(zdev->ap_dev->qid, ep11_dev_list) &&
+                   !autoselect)
+                       continue;
+
+               zcrypt_device_get(zdev);
+               get_device(&zdev->ap_dev->device);
+               zdev->request_count++;
+               __zcrypt_decrease_preference(zdev);
+               if (try_module_get(zdev->ap_dev->drv->driver.owner)) {
+                       spin_unlock_bh(&zcrypt_device_lock);
+                       rc = zdev->ops->send_ep11_cprb(zdev, xcrb);
+                       spin_lock_bh(&zcrypt_device_lock);
+                       module_put(zdev->ap_dev->drv->driver.owner);
+               } else {
+                       rc = -EAGAIN;
+                 }
+               zdev->request_count--;
+               __zcrypt_increase_preference(zdev);
+               put_device(&zdev->ap_dev->device);
+               zcrypt_device_put(zdev);
+               spin_unlock_bh(&zcrypt_device_lock);
+               return rc;
+       }
+       spin_unlock_bh(&zcrypt_device_lock);
+       return -ENODEV;
+}
+
 static long zcrypt_rng(char *buffer)
 {
        struct zcrypt_device *zdev;
@@ -784,6 +862,23 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
                        return -EFAULT;
                return rc;
        }
+       case ZSENDEP11CPRB: {
+               struct ep11_urb __user *uxcrb = (void __user *)arg;
+               struct ep11_urb xcrb;
+               if (copy_from_user(&xcrb, uxcrb, sizeof(xcrb)))
+                       return -EFAULT;
+               do {
+                       rc = zcrypt_send_ep11_cprb(&xcrb);
+               } while (rc == -EAGAIN);
+               /* on failure: retry once again after a requested rescan */
+               if ((rc == -ENODEV) && (zcrypt_process_rescan()))
+                       do {
+                               rc = zcrypt_send_ep11_cprb(&xcrb);
+                       } while (rc == -EAGAIN);
+               if (copy_to_user(uxcrb, &xcrb, sizeof(xcrb)))
+                       return -EFAULT;
+               return rc;
+       }
        case Z90STAT_STATUS_MASK: {
                char status[AP_DEVICES];
                zcrypt_status_mask(status);
index 89632919c993ab4ea436c8bf38ade793820de824..b3d496bfaa7eadd08aa27e15a26c0e177a507685 100644 (file)
@@ -74,6 +74,7 @@ struct ica_z90_status {
 #define ZCRYPT_CEX2A           6
 #define ZCRYPT_CEX3C           7
 #define ZCRYPT_CEX3A           8
+#define ZCRYPT_CEX4           10
 
 /**
  * Large random numbers are pulled in 4096 byte chunks from the crypto cards
@@ -89,6 +90,7 @@ struct zcrypt_ops {
        long (*rsa_modexpo_crt)(struct zcrypt_device *,
                                struct ica_rsa_modexpo_crt *);
        long (*send_cprb)(struct zcrypt_device *, struct ica_xcRB *);
+       long (*send_ep11_cprb)(struct zcrypt_device *, struct ep11_urb *);
        long (*rng)(struct zcrypt_device *, char *);
        struct list_head list;          /* zcrypt ops list. */
        struct module *owner;
index ce1226398ac996a13b0546ba11df3ccfee6fa272..569f8b1d86c05305501530b33d2fdfba84e114a9 100644 (file)
 #define CEX4A_MAX_MESSAGE_SIZE MSGTYPE50_CRB3_MAX_MSG_SIZE
 #define CEX4C_MAX_MESSAGE_SIZE MSGTYPE06_MAX_MSG_SIZE
 
-#define CEX4_CLEANUP_TIME      (15*HZ)
+/* Waiting time for requests to be processed.
+ * Currently there are some types of request which are not deterministic.
+ * But the maximum time limit managed by the stomper code is set to 60sec.
+ * Hence we have to wait at least that time period.
+ */
+#define CEX4_CLEANUP_TIME      (61*HZ)
 
 static struct ap_device_id zcrypt_cex4_ids[] = {
        { AP_DEVICE(AP_DEVICE_TYPE_CEX4)  },
@@ -101,6 +106,19 @@ static int zcrypt_cex4_probe(struct ap_device *ap_dev)
                        zdev->speed_rating = CEX4C_SPEED_RATING;
                        zdev->ops = zcrypt_msgtype_request(MSGTYPE06_NAME,
                                                           MSGTYPE06_VARIANT_DEFAULT);
+               } else if (ap_test_bit(&ap_dev->functions, AP_FUNC_EP11)) {
+                       zdev = zcrypt_device_alloc(CEX4C_MAX_MESSAGE_SIZE);
+                       if (!zdev)
+                               return -ENOMEM;
+                       zdev->type_string = "CEX4P";
+                       zdev->user_space_type = ZCRYPT_CEX4;
+                       zdev->min_mod_size = CEX4C_MIN_MOD_SIZE;
+                       zdev->max_mod_size = CEX4C_MAX_MOD_SIZE;
+                       zdev->max_exp_bit_length = CEX4C_MAX_MOD_SIZE;
+                       zdev->short_crt = 0;
+                       zdev->speed_rating = CEX4C_SPEED_RATING;
+                       zdev->ops = zcrypt_msgtype_request(MSGTYPE06_NAME,
+                                                       MSGTYPE06_VARIANT_EP11);
                }
                break;
        }
index 0079b661721139e4f8ec7f58ef39bb99d08b045f..7b23f43c7b080cc81b4de94ed9016cc0d8a91546 100644 (file)
@@ -106,15 +106,15 @@ static inline int convert_error(struct zcrypt_device *zdev,
        //   REP88_ERROR_MESSAGE_TYPE           // '20' CEX2A
                /*
                 * To sent a message of the wrong type is a bug in the
-                * device driver. Warn about it, disable the device
+                * device driver. Send error msg, disable the device
                 * and then repeat the request.
                 */
-               WARN_ON(1);
                atomic_set(&zcrypt_rescan_req, 1);
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
                ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%drc%d",
-                              zdev->ap_dev->qid,
-                              zdev->online, ehdr->reply_code);
+                       zdev->ap_dev->qid, zdev->online, ehdr->reply_code);
                return -EAGAIN;
        case REP82_ERROR_TRANSPORT_FAIL:
        case REP82_ERROR_MACHINE_FAILURE:
@@ -122,15 +122,17 @@ static inline int convert_error(struct zcrypt_device *zdev,
                /* If a card fails disable it and repeat the request. */
                atomic_set(&zcrypt_rescan_req, 1);
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
                ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%drc%d",
-                              zdev->ap_dev->qid,
-                              zdev->online, ehdr->reply_code);
+                       zdev->ap_dev->qid, zdev->online, ehdr->reply_code);
                return -EAGAIN;
        default:
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
                ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%drc%d",
-                              zdev->ap_dev->qid,
-                              zdev->online, ehdr->reply_code);
+                       zdev->ap_dev->qid, zdev->online, ehdr->reply_code);
                return -EAGAIN; /* repeat the request on a different device. */
        }
 }
index 7c522f338bda16a50f11cf04aa845a8f6f937637..334e282f255b7d9b0a6288bad94d6702a729a556 100644 (file)
@@ -25,6 +25,9 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define KMSG_COMPONENT "zcrypt"
+#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
+
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/init.h>
@@ -332,6 +335,11 @@ static int convert_type80(struct zcrypt_device *zdev,
        if (t80h->len < sizeof(*t80h) + outputdatalength) {
                /* The result is too short, the CEX2A card may not do that.. */
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
+               ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%drc%d",
+                              zdev->ap_dev->qid, zdev->online, t80h->code);
+
                return -EAGAIN; /* repeat the request on a different device. */
        }
        if (zdev->user_space_type == ZCRYPT_CEX2A)
@@ -359,6 +367,10 @@ static int convert_response(struct zcrypt_device *zdev,
                                      outputdata, outputdatalength);
        default: /* Unknown response type, this should NEVER EVER happen */
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
+               ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%dfail",
+                              zdev->ap_dev->qid, zdev->online);
                return -EAGAIN; /* repeat the request on a different device. */
        }
 }
index 7d97fa5a26d0cca4e6f318e5d57d392728f3c5f9..3210e8db42d30578aae8da78715b307fef91dd7a 100644 (file)
@@ -25,6 +25,9 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define KMSG_COMPONENT "zcrypt"
+#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/err.h>
@@ -50,6 +53,7 @@ struct response_type {
 };
 #define PCIXCC_RESPONSE_TYPE_ICA  0
 #define PCIXCC_RESPONSE_TYPE_XCRB 1
+#define PCIXCC_RESPONSE_TYPE_EP11 2
 
 MODULE_AUTHOR("IBM Corporation");
 MODULE_DESCRIPTION("Cryptographic Coprocessor (message type 6), " \
@@ -358,6 +362,90 @@ static int XCRB_msg_to_type6CPRB_msgX(struct zcrypt_device *zdev,
        return 0;
 }
 
+static int xcrb_msg_to_type6_ep11cprb_msgx(struct zcrypt_device *zdev,
+                                      struct ap_message *ap_msg,
+                                      struct ep11_urb *xcRB)
+{
+       unsigned int lfmt;
+
+       static struct type6_hdr static_type6_ep11_hdr = {
+               .type           =  0x06,
+               .rqid           = {0x00, 0x01},
+               .function_code  = {0x00, 0x00},
+               .agent_id[0]    =  0x58,        /* {'X'} */
+               .agent_id[1]    =  0x43,        /* {'C'} */
+               .offset1        =  0x00000058,
+       };
+
+       struct {
+               struct type6_hdr hdr;
+               struct ep11_cprb cprbx;
+               unsigned char   pld_tag;        /* fixed value 0x30 */
+               unsigned char   pld_lenfmt;     /* payload length format */
+       } __packed * msg = ap_msg->message;
+
+       struct pld_hdr {
+               unsigned char   func_tag;       /* fixed value 0x4 */
+               unsigned char   func_len;       /* fixed value 0x4 */
+               unsigned int    func_val;       /* function ID     */
+               unsigned char   dom_tag;        /* fixed value 0x4 */
+               unsigned char   dom_len;        /* fixed value 0x4 */
+               unsigned int    dom_val;        /* domain id       */
+       } __packed * payload_hdr;
+
+       /* length checks */
+       ap_msg->length = sizeof(struct type6_hdr) + xcRB->req_len;
+       if (ap_msg->length > MSGTYPE06_MAX_MSG_SIZE)
+               return -EINVAL;
+
+       if ((sizeof(struct type86_fmt2_msg) + CEIL4(xcRB->resp_len))
+                                        > MSGTYPE06_MAX_MSG_SIZE)
+               return -EINVAL;
+
+       /* prepare type6 header */
+       msg->hdr = static_type6_ep11_hdr;
+       msg->hdr.ToCardLen1   = xcRB->req_len;
+       msg->hdr.FromCardLen1 = xcRB->resp_len;
+
+       /* Import CPRB data from the ioctl input parameter */
+       if (copy_from_user(&(msg->cprbx.cprb_len),
+                          xcRB->req, xcRB->req_len)) {
+               return -EFAULT;
+       }
+
+       /*
+        The target domain field within the cprb body/payload block will be
+        replaced by the usage domain for non-management commands only.
+        Therefore we check the first bit of the 'flags' parameter for
+        management command indication.
+          0 - non managment command
+          1 - management command
+       */
+       if (!((msg->cprbx.flags & 0x80) == 0x80)) {
+               msg->cprbx.target_id = (unsigned int)
+                                       AP_QID_QUEUE(zdev->ap_dev->qid);
+
+               if ((msg->pld_lenfmt & 0x80) == 0x80) { /*ext.len.fmt 2 or 3*/
+                       switch (msg->pld_lenfmt & 0x03) {
+                       case 1:
+                               lfmt = 2;
+                               break;
+                       case 2:
+                               lfmt = 3;
+                               break;
+                       default:
+                               return -EINVAL;
+                       }
+               } else {
+                       lfmt = 1; /* length format #1 */
+                 }
+               payload_hdr = (struct pld_hdr *)((&(msg->pld_lenfmt))+lfmt);
+               payload_hdr->dom_val = (unsigned int)
+                                       AP_QID_QUEUE(zdev->ap_dev->qid);
+       }
+       return 0;
+}
+
 /**
  * Copy results from a type 86 ICA reply message back to user space.
  *
@@ -377,6 +465,12 @@ struct type86x_reply {
        char text[0];
 } __packed;
 
+struct type86_ep11_reply {
+       struct type86_hdr hdr;
+       struct type86_fmt2_ext fmt2;
+       struct ep11_cprb cprbx;
+} __packed;
+
 static int convert_type86_ica(struct zcrypt_device *zdev,
                          struct ap_message *reply,
                          char __user *outputdata,
@@ -440,6 +534,11 @@ static int convert_type86_ica(struct zcrypt_device *zdev,
                if (service_rc == 8 && service_rs == 72)
                        return -EINVAL;
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
+               ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%drc%d",
+                              zdev->ap_dev->qid, zdev->online,
+                              msg->hdr.reply_code);
                return -EAGAIN; /* repeat the request on a different device. */
        }
        data = msg->text;
@@ -503,6 +602,30 @@ static int convert_type86_xcrb(struct zcrypt_device *zdev,
        return 0;
 }
 
+/**
+ * Copy results from a type 86 EP11 XCRB reply message back to user space.
+ *
+ * @zdev: crypto device pointer
+ * @reply: reply AP message.
+ * @xcRB: pointer to EP11 user request block
+ *
+ * Returns 0 on success or -EINVAL, -EFAULT, -EAGAIN in case of an error.
+ */
+static int convert_type86_ep11_xcrb(struct zcrypt_device *zdev,
+                                   struct ap_message *reply,
+                                   struct ep11_urb *xcRB)
+{
+       struct type86_fmt2_msg *msg = reply->message;
+       char *data = reply->message;
+
+       /* Copy response CPRB to user */
+       if (copy_to_user(xcRB->resp,
+                        data + msg->fmt2.offset1, msg->fmt2.count1))
+               return -EFAULT;
+       xcRB->resp_len = msg->fmt2.count1;
+       return 0;
+}
+
 static int convert_type86_rng(struct zcrypt_device *zdev,
                          struct ap_message *reply,
                          char *buffer)
@@ -551,6 +674,10 @@ static int convert_response_ica(struct zcrypt_device *zdev,
                 * response */
        default: /* Unknown response type, this should NEVER EVER happen */
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
+               ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%dfail",
+                              zdev->ap_dev->qid, zdev->online);
                return -EAGAIN; /* repeat the request on a different device. */
        }
 }
@@ -579,10 +706,40 @@ static int convert_response_xcrb(struct zcrypt_device *zdev,
        default: /* Unknown response type, this should NEVER EVER happen */
                xcRB->status = 0x0008044DL; /* HDD_InvalidParm */
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
+               ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%dfail",
+                              zdev->ap_dev->qid, zdev->online);
                return -EAGAIN; /* repeat the request on a different device. */
        }
 }
 
+static int convert_response_ep11_xcrb(struct zcrypt_device *zdev,
+       struct ap_message *reply, struct ep11_urb *xcRB)
+{
+       struct type86_ep11_reply *msg = reply->message;
+
+       /* Response type byte is the second byte in the response. */
+       switch (((unsigned char *)reply->message)[1]) {
+       case TYPE82_RSP_CODE:
+       case TYPE87_RSP_CODE:
+               return convert_error(zdev, reply);
+       case TYPE86_RSP_CODE:
+               if (msg->hdr.reply_code)
+                       return convert_error(zdev, reply);
+               if (msg->cprbx.cprb_ver_id == 0x04)
+                       return convert_type86_ep11_xcrb(zdev, reply, xcRB);
+       /* Fall through, no break, incorrect cprb version is an unknown resp.*/
+       default: /* Unknown response type, this should NEVER EVER happen */
+               zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
+               ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%dfail",
+                              zdev->ap_dev->qid, zdev->online);
+               return -EAGAIN; /* repeat the request on a different device. */
+       }
+}
+
 static int convert_response_rng(struct zcrypt_device *zdev,
                                 struct ap_message *reply,
                                 char *data)
@@ -602,6 +759,10 @@ static int convert_response_rng(struct zcrypt_device *zdev,
                 * response */
        default: /* Unknown response type, this should NEVER EVER happen */
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
+               ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%dfail",
+                              zdev->ap_dev->qid, zdev->online);
                return -EAGAIN; /* repeat the request on a different device. */
        }
 }
@@ -657,6 +818,51 @@ out:
        complete(&(resp_type->work));
 }
 
+/**
+ * This function is called from the AP bus code after a crypto request
+ * "msg" has finished with the reply message "reply".
+ * It is called from tasklet context.
+ * @ap_dev: pointer to the AP device
+ * @msg: pointer to the AP message
+ * @reply: pointer to the AP reply message
+ */
+static void zcrypt_msgtype6_receive_ep11(struct ap_device *ap_dev,
+                                        struct ap_message *msg,
+                                        struct ap_message *reply)
+{
+       static struct error_hdr error_reply = {
+               .type = TYPE82_RSP_CODE,
+               .reply_code = REP82_ERROR_MACHINE_FAILURE,
+       };
+       struct response_type *resp_type =
+               (struct response_type *)msg->private;
+       struct type86_ep11_reply *t86r;
+       int length;
+
+       /* Copy the reply message to the request message buffer. */
+       if (IS_ERR(reply)) {
+               memcpy(msg->message, &error_reply, sizeof(error_reply));
+               goto out;
+       }
+       t86r = reply->message;
+       if (t86r->hdr.type == TYPE86_RSP_CODE &&
+           t86r->cprbx.cprb_ver_id == 0x04) {
+               switch (resp_type->type) {
+               case PCIXCC_RESPONSE_TYPE_EP11:
+                       length = t86r->fmt2.offset1 + t86r->fmt2.count1;
+                       length = min(MSGTYPE06_MAX_MSG_SIZE, length);
+                       memcpy(msg->message, reply->message, length);
+                       break;
+               default:
+                       memcpy(msg->message, &error_reply, sizeof(error_reply));
+               }
+       } else {
+               memcpy(msg->message, reply->message, sizeof(error_reply));
+         }
+out:
+       complete(&(resp_type->work));
+}
+
 static atomic_t zcrypt_step = ATOMIC_INIT(0);
 
 /**
@@ -781,6 +987,46 @@ out_free:
        return rc;
 }
 
+/**
+ * The request distributor calls this function if it picked the CEX4P
+ * device to handle a send_ep11_cprb request.
+ * @zdev: pointer to zcrypt_device structure that identifies the
+ *       CEX4P device to the request distributor
+ * @xcRB: pointer to the ep11 user request block
+ */
+static long zcrypt_msgtype6_send_ep11_cprb(struct zcrypt_device *zdev,
+                                               struct ep11_urb *xcrb)
+{
+       struct ap_message ap_msg;
+       struct response_type resp_type = {
+               .type = PCIXCC_RESPONSE_TYPE_EP11,
+       };
+       int rc;
+
+       ap_init_message(&ap_msg);
+       ap_msg.message = kmalloc(MSGTYPE06_MAX_MSG_SIZE, GFP_KERNEL);
+       if (!ap_msg.message)
+               return -ENOMEM;
+       ap_msg.receive = zcrypt_msgtype6_receive_ep11;
+       ap_msg.psmid = (((unsigned long long) current->pid) << 32) +
+                               atomic_inc_return(&zcrypt_step);
+       ap_msg.private = &resp_type;
+       rc = xcrb_msg_to_type6_ep11cprb_msgx(zdev, &ap_msg, xcrb);
+       if (rc)
+               goto out_free;
+       init_completion(&resp_type.work);
+       ap_queue_message(zdev->ap_dev, &ap_msg);
+       rc = wait_for_completion_interruptible(&resp_type.work);
+       if (rc == 0)
+               rc = convert_response_ep11_xcrb(zdev, &ap_msg, xcrb);
+       else /* Signal pending. */
+               ap_cancel_message(zdev->ap_dev, &ap_msg);
+
+out_free:
+       kzfree(ap_msg.message);
+       return rc;
+}
+
 /**
  * The request distributor calls this function if it picked the PCIXCC/CEX2C
  * device to generate random data.
@@ -839,10 +1085,19 @@ static struct zcrypt_ops zcrypt_msgtype6_ops = {
        .rng = zcrypt_msgtype6_rng,
 };
 
+static struct zcrypt_ops zcrypt_msgtype6_ep11_ops = {
+       .owner = THIS_MODULE,
+       .variant = MSGTYPE06_VARIANT_EP11,
+       .rsa_modexpo = NULL,
+       .rsa_modexpo_crt = NULL,
+       .send_ep11_cprb = zcrypt_msgtype6_send_ep11_cprb,
+};
+
 int __init zcrypt_msgtype6_init(void)
 {
        zcrypt_msgtype_register(&zcrypt_msgtype6_norng_ops);
        zcrypt_msgtype_register(&zcrypt_msgtype6_ops);
+       zcrypt_msgtype_register(&zcrypt_msgtype6_ep11_ops);
        return 0;
 }
 
@@ -850,6 +1105,7 @@ void __exit zcrypt_msgtype6_exit(void)
 {
        zcrypt_msgtype_unregister(&zcrypt_msgtype6_norng_ops);
        zcrypt_msgtype_unregister(&zcrypt_msgtype6_ops);
+       zcrypt_msgtype_unregister(&zcrypt_msgtype6_ep11_ops);
 }
 
 module_init(zcrypt_msgtype6_init);
index 1e500d3c073571fe764bd1111cd8a2a7b10e7751..207247570623709c946f3a7708d3e3bfc7a0313e 100644 (file)
@@ -32,6 +32,7 @@
 #define MSGTYPE06_NAME                 "zcrypt_msgtype6"
 #define MSGTYPE06_VARIANT_DEFAULT      0
 #define MSGTYPE06_VARIANT_NORNG                1
+#define MSGTYPE06_VARIANT_EP11         2
 
 #define MSGTYPE06_MAX_MSG_SIZE         (12*1024)
 
@@ -99,6 +100,7 @@ struct type86_hdr {
 } __packed;
 
 #define TYPE86_RSP_CODE 0x86
+#define TYPE87_RSP_CODE 0x87
 #define TYPE86_FMT2    0x02
 
 struct type86_fmt2_ext {
index f2b71d8df01f0c1e42e75bd7b0f9786bbf881cae..7a743f4c646c0e46dadcaed195acc9bccf1bf183 100644 (file)
@@ -24,6 +24,9 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define KMSG_COMPONENT "zcrypt"
+#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
+
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/init.h>
@@ -199,6 +202,10 @@ static int convert_type84(struct zcrypt_device *zdev,
        if (t84h->len < sizeof(*t84h) + outputdatalength) {
                /* The result is too short, the PCICA card may not do that.. */
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
+               ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%drc%d",
+                              zdev->ap_dev->qid, zdev->online, t84h->code);
                return -EAGAIN; /* repeat the request on a different device. */
        }
        BUG_ON(t84h->len > PCICA_MAX_RESPONSE_SIZE);
@@ -223,6 +230,10 @@ static int convert_response(struct zcrypt_device *zdev,
                                      outputdata, outputdatalength);
        default: /* Unknown response type, this should NEVER EVER happen */
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
+               ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%dfail",
+                              zdev->ap_dev->qid, zdev->online);
                return -EAGAIN; /* repeat the request on a different device. */
        }
 }
index 0d90a4334055efcc22ae73a290c53d83fcee8530..4d14c04b746e14ebe656ae08bc14843aee093a45 100644 (file)
@@ -24,6 +24,9 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define KMSG_COMPONENT "zcrypt"
+#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/gfp.h>
@@ -372,6 +375,11 @@ static int convert_type86(struct zcrypt_device *zdev,
                if (service_rc == 8 && service_rs == 72)
                        return -EINVAL;
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
+               ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%drc%d",
+                              zdev->ap_dev->qid, zdev->online,
+                              msg->hdr.reply_code);
                return -EAGAIN; /* repeat the request on a different device. */
        }
        data = msg->text;
@@ -425,6 +433,10 @@ static int convert_response(struct zcrypt_device *zdev,
                /* no break, incorrect cprb version is an unknown response */
        default: /* Unknown response type, this should NEVER EVER happen */
                zdev->online = 0;
+               pr_err("Cryptographic device %x failed and was set offline\n",
+                      zdev->ap_dev->qid);
+               ZCRYPT_DBF_DEV(DBF_ERR, zdev, "dev%04xo%dfail",
+                              zdev->ap_dev->qid, zdev->online);
                return -EAGAIN; /* repeat the request on a different device. */
        }
 }
index 30fa38a0ad39a33102f1cd4656b4d800c498ae07..9176bfbd574586ab04a62786253271b1a1636006 100644 (file)
@@ -201,7 +201,7 @@ static int a2091_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
        instance->irq = IRQ_AMIGA_PORTS;
        instance->unique_id = z->slotaddr;
 
-       regs = (struct a2091_scsiregs *)ZTWO_VADDR(z->resource.start);
+       regs = ZTWO_VADDR(z->resource.start);
        regs->DAWR = DAWR_A2091;
 
        wdregs.SASR = &regs->SASR;
index c0f4f4290dd60dbeb836f547b097ca8b7141eaaf..dd5b64726ddc3c5f9dcee231501630c66424b9ab 100644 (file)
@@ -220,7 +220,7 @@ static int __init amiga_a3000_scsi_probe(struct platform_device *pdev)
 
        instance->irq = IRQ_AMIGA_PORTS;
 
-       regs = (struct a3000_scsiregs *)ZTWO_VADDR(res->start);
+       regs = ZTWO_VADDR(res->start);
        regs->DAWR = DAWR_A3000;
 
        wdregs.SASR = &regs->SASR;
index 70c521f79f7c26fbc92b65645b780e927c7fcac3..f5a2ab41543bd0bd9006a3af5687085343a25220 100644 (file)
@@ -56,7 +56,7 @@ static int __init amiga_a4000t_scsi_probe(struct platform_device *pdev)
        scsi_addr = res->start + A4000T_SCSI_OFFSET;
 
        /* Fill in the required pieces of hostdata */
-       hostdata->base = (void __iomem *)ZTWO_VADDR(scsi_addr);
+       hostdata->base = ZTWO_VADDR(scsi_addr);
        hostdata->clock = 50;
        hostdata->chip710 = 1;
        hostdata->dmode_extra = DMODE_FC2;
index 2203ac281103b964917f47c1095d6c6a233ec7bf..3b6f83ffddc4e87c59057d0f7eb8a4ded51f11f4 100644 (file)
@@ -310,7 +310,7 @@ static int gvp11_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
        if (!request_mem_region(address, 256, "wd33c93"))
                return -EBUSY;
 
-       regs = (struct gvp11_scsiregs *)(ZTWO_VADDR(address));
+       regs = ZTWO_VADDR(address);
 
        error = check_wd33c93(regs);
        if (error)
index cbf3476c68cd3511e13592296198da53ddcc441d..aff31991aea9808f5f98180cb126be87be12db26 100644 (file)
@@ -104,7 +104,7 @@ static int zorro7xx_init_one(struct zorro_dev *z,
        if (ioaddr > 0x01000000)
                hostdata->base = ioremap(ioaddr, zorro_resource_len(z));
        else
-               hostdata->base = (void __iomem *)ZTWO_VADDR(ioaddr);
+               hostdata->base = ZTWO_VADDR(ioaddr);
 
        hostdata->clock = 50;
        hostdata->chip710 = 1;
index f5b4ca581541539f8336aaec73c286de1f0773fb..5e753d799f617d7e2feb997d3ce27658dd6d5dc0 100644 (file)
@@ -60,7 +60,7 @@
 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 
 #include <linux/kernel.h>
-#include <acpi/acpi.h>
+#include <acpi/acpi.h> /* FIXME: inclusion should be removed */
 
 #include <linux/sfi.h>
 #include "sfi_core.h"
index eb1f1ef5fa2eb69db729b6061b2d96c85aaf968b..e2dd2fbec5ee869f014db05a2fe8b3b616ac9d75 100644 (file)
@@ -395,7 +395,7 @@ config SPI_S3C24XX_FIQ
 config SPI_S3C64XX
        tristate "Samsung S3C64XX series type SPI"
        depends on PLAT_SAMSUNG
-       select S3C64XX_DMA if ARCH_S3C64XX
+       select S3C64XX_PL080 if ARCH_S3C64XX
        help
          SPI driver for Samsung S3C64XX and newer SoCs.
 
index 87676587d783551e120f5478f9b522c7add7df31..2babea28b310af7071b1ca091833cc27809c9139 100644 (file)
@@ -40,6 +40,7 @@ struct mpc512x_psc_spi {
        unsigned int irq;
        u8 bits_per_word;
        struct clk *clk_mclk;
+       struct clk *clk_ipg;
        u32 mclk_rate;
 
        struct completion txisrdone;
@@ -475,8 +476,6 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
        struct spi_master *master;
        int ret;
        void *tempp;
-       int psc_num;
-       char clk_name[16];
        struct clk *clk;
 
        master = spi_alloc_master(dev, sizeof *mps);
@@ -520,9 +519,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
                goto free_master;
        init_completion(&mps->txisrdone);
 
-       psc_num = master->bus_num;
-       snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num);
-       clk = devm_clk_get(dev, clk_name);
+       clk = devm_clk_get(dev, "mclk");
        if (IS_ERR(clk)) {
                ret = PTR_ERR(clk);
                goto free_irq;
@@ -533,17 +530,29 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
        mps->clk_mclk = clk;
        mps->mclk_rate = clk_get_rate(clk);
 
+       clk = devm_clk_get(dev, "ipg");
+       if (IS_ERR(clk)) {
+               ret = PTR_ERR(clk);
+               goto free_mclk_clock;
+       }
+       ret = clk_prepare_enable(clk);
+       if (ret)
+               goto free_mclk_clock;
+       mps->clk_ipg = clk;
+
        ret = mpc512x_psc_spi_port_config(master, mps);
        if (ret < 0)
-               goto free_clock;
+               goto free_ipg_clock;
 
        ret = devm_spi_register_master(dev, master);
        if (ret < 0)
-               goto free_clock;
+               goto free_ipg_clock;
 
        return ret;
 
-free_clock:
+free_ipg_clock:
+       clk_disable_unprepare(mps->clk_ipg);
+free_mclk_clock:
        clk_disable_unprepare(mps->clk_mclk);
 free_irq:
        free_irq(mps->irq, mps);
@@ -561,6 +570,7 @@ static int mpc512x_psc_spi_do_remove(struct device *dev)
        struct mpc512x_psc_spi *mps = spi_master_get_devdata(master);
 
        clk_disable_unprepare(mps->clk_mclk);
+       clk_disable_unprepare(mps->clk_ipg);
        free_irq(mps->irq, mps);
        if (mps->psc)
                iounmap(mps->psc);
index 46f1e619cbd838f29bd9891832db00b6610a44a7..bc4c7982360eb3a0796a47b7f536056c7585a168 100644 (file)
@@ -33,6 +33,8 @@ source "drivers/staging/media/msi3101/Kconfig"
 
 source "drivers/staging/media/solo6x10/Kconfig"
 
+source "drivers/staging/media/omap4iss/Kconfig"
+
 # Keep LIRC at the end, as it has sub-menus
 source "drivers/staging/media/lirc/Kconfig"
 
index eb7f30b1ccd8863ddf0399c30e38df56e0e89a4f..a528d3f40105af950651a2f0b5d55114aec81a2c 100644 (file)
@@ -6,3 +6,4 @@ obj-$(CONFIG_VIDEO_DT3155)      += dt3155v4l/
 obj-$(CONFIG_VIDEO_GO7007)     += go7007/
 obj-$(CONFIG_USB_MSI3101)      += msi3101/
 obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/
+obj-$(CONFIG_VIDEO_OMAP4)      += omap4iss/
diff --git a/drivers/staging/media/omap4iss/Kconfig b/drivers/staging/media/omap4iss/Kconfig
new file mode 100644 (file)
index 0000000..b9fe753
--- /dev/null
@@ -0,0 +1,12 @@
+config VIDEO_OMAP4
+       bool "OMAP 4 Camera support"
+       depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && I2C && ARCH_OMAP4
+       select VIDEOBUF2_DMA_CONTIG
+       ---help---
+         Driver for an OMAP 4 ISS controller.
+
+config VIDEO_OMAP4_DEBUG
+       bool "OMAP 4 Camera debug messages"
+       depends on VIDEO_OMAP4
+       ---help---
+         Enable debug messages on OMAP 4 ISS controller driver.
diff --git a/drivers/staging/media/omap4iss/Makefile b/drivers/staging/media/omap4iss/Makefile
new file mode 100644 (file)
index 0000000..a716ce9
--- /dev/null
@@ -0,0 +1,6 @@
+# Makefile for OMAP4 ISS driver
+
+omap4-iss-objs += \
+       iss.o iss_csi2.o iss_csiphy.o iss_ipipeif.o iss_ipipe.o iss_resizer.o iss_video.o
+
+obj-$(CONFIG_VIDEO_OMAP4) += omap4-iss.o
diff --git a/drivers/staging/media/omap4iss/TODO b/drivers/staging/media/omap4iss/TODO
new file mode 100644 (file)
index 0000000..fcde888
--- /dev/null
@@ -0,0 +1,4 @@
+* Make the driver compile as a module
+* Fix FIFO/buffer overflows and underflows
+* Replace dummy resizer code with a real implementation
+* Fix checkpatch errors and warnings
diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
new file mode 100644 (file)
index 0000000..b7c8a6b
--- /dev/null
@@ -0,0 +1,1462 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver
+ *
+ * Copyright (C) 2012, Texas Instruments
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/dma-mapping.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/sched.h>
+#include <linux/vmalloc.h>
+
+#include <media/v4l2-common.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-ctrls.h>
+
+#include "iss.h"
+#include "iss_regs.h"
+
+#define ISS_PRINT_REGISTER(iss, name)\
+       dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n", \
+               readl(iss->regs[OMAP4_ISS_MEM_TOP] + ISS_##name))
+
+static void iss_print_status(struct iss_device *iss)
+{
+       dev_dbg(iss->dev, "-------------ISS HL Register dump-------------\n");
+
+       ISS_PRINT_REGISTER(iss, HL_REVISION);
+       ISS_PRINT_REGISTER(iss, HL_SYSCONFIG);
+       ISS_PRINT_REGISTER(iss, HL_IRQSTATUS_5);
+       ISS_PRINT_REGISTER(iss, HL_IRQENABLE_5_SET);
+       ISS_PRINT_REGISTER(iss, HL_IRQENABLE_5_CLR);
+       ISS_PRINT_REGISTER(iss, CTRL);
+       ISS_PRINT_REGISTER(iss, CLKCTRL);
+       ISS_PRINT_REGISTER(iss, CLKSTAT);
+
+       dev_dbg(iss->dev, "-----------------------------------------------\n");
+}
+
+/*
+ * omap4iss_flush - Post pending L3 bus writes by doing a register readback
+ * @iss: OMAP4 ISS device
+ *
+ * In order to force posting of pending writes, we need to write and
+ * readback the same register, in this case the revision register.
+ *
+ * See this link for reference:
+ *   http://www.mail-archive.com/linux-omap@vger.kernel.org/msg08149.html
+ */
+void omap4iss_flush(struct iss_device *iss)
+{
+       writel(0, iss->regs[OMAP4_ISS_MEM_TOP] + ISS_HL_REVISION);
+       readl(iss->regs[OMAP4_ISS_MEM_TOP] + ISS_HL_REVISION);
+}
+
+/*
+ * iss_enable_interrupts - Enable ISS interrupts.
+ * @iss: OMAP4 ISS device
+ */
+static void iss_enable_interrupts(struct iss_device *iss)
+{
+       static const u32 hl_irq = ISS_HL_IRQ_CSIA | ISS_HL_IRQ_CSIB | ISS_HL_IRQ_ISP(0);
+
+       /* Enable HL interrupts */
+       writel(hl_irq, iss->regs[OMAP4_ISS_MEM_TOP] + ISS_HL_IRQSTATUS_5);
+       writel(hl_irq, iss->regs[OMAP4_ISS_MEM_TOP] + ISS_HL_IRQENABLE_5_SET);
+
+}
+
+/*
+ * iss_disable_interrupts - Disable ISS interrupts.
+ * @iss: OMAP4 ISS device
+ */
+static void iss_disable_interrupts(struct iss_device *iss)
+{
+       writel(-1, iss->regs[OMAP4_ISS_MEM_TOP] + ISS_HL_IRQENABLE_5_CLR);
+}
+
+/*
+ * iss_isp_enable_interrupts - Enable ISS ISP interrupts.
+ * @iss: OMAP4 ISS device
+ */
+void omap4iss_isp_enable_interrupts(struct iss_device *iss)
+{
+       static const u32 isp_irq = ISP5_IRQ_OCP_ERR |
+                                  ISP5_IRQ_RSZ_FIFO_IN_BLK |
+                                  ISP5_IRQ_RSZ_FIFO_OVF |
+                                  ISP5_IRQ_RSZ_INT_DMA |
+                                  ISP5_IRQ_ISIF0;
+
+       /* Enable ISP interrupts */
+       writel(isp_irq, iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_IRQSTATUS(0));
+       writel(isp_irq, iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_IRQENABLE_SET(0));
+}
+
+/*
+ * iss_isp_disable_interrupts - Disable ISS interrupts.
+ * @iss: OMAP4 ISS device
+ */
+void omap4iss_isp_disable_interrupts(struct iss_device *iss)
+{
+       writel(-1, iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_IRQENABLE_CLR(0));
+}
+
+int omap4iss_get_external_info(struct iss_pipeline *pipe,
+                              struct media_link *link)
+{
+       struct iss_device *iss =
+               container_of(pipe, struct iss_video, pipe)->iss;
+       struct v4l2_subdev_format fmt;
+       struct v4l2_ctrl *ctrl;
+       int ret;
+
+       if (!pipe->external)
+               return 0;
+
+       if (pipe->external_rate)
+               return 0;
+
+       memset(&fmt, 0, sizeof(fmt));
+
+       fmt.pad = link->source->index;
+       fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+       ret = v4l2_subdev_call(media_entity_to_v4l2_subdev(link->sink->entity),
+                              pad, get_fmt, NULL, &fmt);
+       if (ret < 0)
+               return -EPIPE;
+
+       pipe->external_bpp = omap4iss_video_format_info(fmt.format.code)->bpp;
+
+       ctrl = v4l2_ctrl_find(pipe->external->ctrl_handler,
+                             V4L2_CID_PIXEL_RATE);
+       if (ctrl == NULL) {
+               dev_warn(iss->dev, "no pixel rate control in subdev %s\n",
+                        pipe->external->name);
+               return -EPIPE;
+       }
+
+       pipe->external_rate = v4l2_ctrl_g_ctrl_int64(ctrl);
+
+       return 0;
+}
+
+/*
+ * Configure the bridge. Valid inputs are
+ *
+ * IPIPEIF_INPUT_CSI2A: CSI2a receiver
+ * IPIPEIF_INPUT_CSI2B: CSI2b receiver
+ *
+ * The bridge and lane shifter are configured according to the selected input
+ * and the ISP platform data.
+ */
+void omap4iss_configure_bridge(struct iss_device *iss,
+                              enum ipipeif_input_entity input)
+{
+       u32 issctrl_val;
+       u32 isp5ctrl_val;
+
+       issctrl_val  = readl(iss->regs[OMAP4_ISS_MEM_TOP] + ISS_CTRL);
+       issctrl_val &= ~ISS_CTRL_INPUT_SEL_MASK;
+       issctrl_val &= ~ISS_CTRL_CLK_DIV_MASK;
+
+       isp5ctrl_val  = readl(iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_CTRL);
+
+       switch (input) {
+       case IPIPEIF_INPUT_CSI2A:
+               issctrl_val |= ISS_CTRL_INPUT_SEL_CSI2A;
+               break;
+
+       case IPIPEIF_INPUT_CSI2B:
+               issctrl_val |= ISS_CTRL_INPUT_SEL_CSI2B;
+               break;
+
+       default:
+               return;
+       }
+
+       issctrl_val |= ISS_CTRL_SYNC_DETECT_VS_RAISING;
+
+       isp5ctrl_val |= ISP5_CTRL_VD_PULSE_EXT | ISP5_CTRL_PSYNC_CLK_SEL |
+                       ISP5_CTRL_SYNC_ENABLE;
+
+       writel(issctrl_val, iss->regs[OMAP4_ISS_MEM_TOP] + ISS_CTRL);
+       writel(isp5ctrl_val, iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_CTRL);
+}
+
+static inline void iss_isr_dbg(struct iss_device *iss, u32 irqstatus)
+{
+       static const char *name[] = {
+               "ISP_IRQ0",
+               "ISP_IRQ1",
+               "ISP_IRQ2",
+               "ISP_IRQ3",
+               "CSIA_IRQ",
+               "CSIB_IRQ",
+               "CCP2_IRQ0",
+               "CCP2_IRQ1",
+               "CCP2_IRQ2",
+               "CCP2_IRQ3",
+               "CBUFF_IRQ",
+               "BTE_IRQ",
+               "SIMCOP_IRQ0",
+               "SIMCOP_IRQ1",
+               "SIMCOP_IRQ2",
+               "SIMCOP_IRQ3",
+               "CCP2_IRQ8",
+               "HS_VS_IRQ",
+               "res18",
+               "res19",
+               "res20",
+               "res21",
+               "res22",
+               "res23",
+               "res24",
+               "res25",
+               "res26",
+               "res27",
+               "res28",
+               "res29",
+               "res30",
+               "res31",
+       };
+       int i;
+
+       dev_dbg(iss->dev, "ISS IRQ: ");
+
+       for (i = 0; i < ARRAY_SIZE(name); i++) {
+               if ((1 << i) & irqstatus)
+                       pr_cont("%s ", name[i]);
+       }
+       pr_cont("\n");
+}
+
+/*
+ * iss_isr - Interrupt Service Routine for ISS module.
+ * @irq: Not used currently.
+ * @_iss: Pointer to the OMAP4 ISS device
+ *
+ * Handles the corresponding callback if plugged in.
+ *
+ * Returns IRQ_HANDLED when IRQ was correctly handled, or IRQ_NONE when the
+ * IRQ wasn't handled.
+ */
+static irqreturn_t iss_isr(int irq, void *_iss)
+{
+       static const u32 ipipeif_events = ISP5_IRQ_IPIPEIF |
+                                         ISP5_IRQ_ISIF0;
+       static const u32 resizer_events = ISP5_IRQ_RSZ_FIFO_IN_BLK |
+                                         ISP5_IRQ_RSZ_FIFO_OVF |
+                                         ISP5_IRQ_RSZ_INT_DMA;
+       struct iss_device *iss = _iss;
+       u32 irqstatus;
+
+       irqstatus = readl(iss->regs[OMAP4_ISS_MEM_TOP] + ISS_HL_IRQSTATUS_5);
+       writel(irqstatus, iss->regs[OMAP4_ISS_MEM_TOP] + ISS_HL_IRQSTATUS_5);
+
+       if (irqstatus & ISS_HL_IRQ_CSIA)
+               omap4iss_csi2_isr(&iss->csi2a);
+
+       if (irqstatus & ISS_HL_IRQ_CSIB)
+               omap4iss_csi2_isr(&iss->csi2b);
+
+       if (irqstatus & ISS_HL_IRQ_ISP(0)) {
+               u32 isp_irqstatus = readl(iss->regs[OMAP4_ISS_MEM_ISP_SYS1] +
+                                         ISP5_IRQSTATUS(0));
+               writel(isp_irqstatus, iss->regs[OMAP4_ISS_MEM_ISP_SYS1] +
+                       ISP5_IRQSTATUS(0));
+
+               if (isp_irqstatus & ISP5_IRQ_OCP_ERR)
+                       dev_dbg(iss->dev, "ISP5 OCP Error!\n");
+
+               if (isp_irqstatus & ipipeif_events) {
+                       omap4iss_ipipeif_isr(&iss->ipipeif,
+                                            isp_irqstatus & ipipeif_events);
+               }
+
+               if (isp_irqstatus & resizer_events)
+                       omap4iss_resizer_isr(&iss->resizer,
+                                            isp_irqstatus & resizer_events);
+       }
+
+       omap4iss_flush(iss);
+
+#if defined(DEBUG) && defined(ISS_ISR_DEBUG)
+       iss_isr_dbg(iss, irqstatus);
+#endif
+
+       return IRQ_HANDLED;
+}
+
+/* -----------------------------------------------------------------------------
+ * Pipeline power management
+ *
+ * Entities must be powered up when part of a pipeline that contains at least
+ * one open video device node.
+ *
+ * To achieve this use the entity use_count field to track the number of users.
+ * For entities corresponding to video device nodes the use_count field stores
+ * the users count of the node. For entities corresponding to subdevs the
+ * use_count field stores the total number of users of all video device nodes
+ * in the pipeline.
+ *
+ * The omap4iss_pipeline_pm_use() function must be called in the open() and
+ * close() handlers of video device nodes. It increments or decrements the use
+ * count of all subdev entities in the pipeline.
+ *
+ * To react to link management on powered pipelines, the link setup notification
+ * callback updates the use count of all entities in the source and sink sides
+ * of the link.
+ */
+
+/*
+ * iss_pipeline_pm_use_count - Count the number of users of a pipeline
+ * @entity: The entity
+ *
+ * Return the total number of users of all video device nodes in the pipeline.
+ */
+static int iss_pipeline_pm_use_count(struct media_entity *entity)
+{
+       struct media_entity_graph graph;
+       int use = 0;
+
+       media_entity_graph_walk_start(&graph, entity);
+
+       while ((entity = media_entity_graph_walk_next(&graph))) {
+               if (media_entity_type(entity) == MEDIA_ENT_T_DEVNODE)
+                       use += entity->use_count;
+       }
+
+       return use;
+}
+
+/*
+ * iss_pipeline_pm_power_one - Apply power change to an entity
+ * @entity: The entity
+ * @change: Use count change
+ *
+ * Change the entity use count by @change. If the entity is a subdev update its
+ * power state by calling the core::s_power operation when the use count goes
+ * from 0 to != 0 or from != 0 to 0.
+ *
+ * Return 0 on success or a negative error code on failure.
+ */
+static int iss_pipeline_pm_power_one(struct media_entity *entity, int change)
+{
+       struct v4l2_subdev *subdev;
+
+       subdev = media_entity_type(entity) == MEDIA_ENT_T_V4L2_SUBDEV
+              ? media_entity_to_v4l2_subdev(entity) : NULL;
+
+       if (entity->use_count == 0 && change > 0 && subdev != NULL) {
+               int ret;
+
+               ret = v4l2_subdev_call(subdev, core, s_power, 1);
+               if (ret < 0 && ret != -ENOIOCTLCMD)
+                       return ret;
+       }
+
+       entity->use_count += change;
+       WARN_ON(entity->use_count < 0);
+
+       if (entity->use_count == 0 && change < 0 && subdev != NULL)
+               v4l2_subdev_call(subdev, core, s_power, 0);
+
+       return 0;
+}
+
+/*
+ * iss_pipeline_pm_power - Apply power change to all entities in a pipeline
+ * @entity: The entity
+ * @change: Use count change
+ *
+ * Walk the pipeline to update the use count and the power state of all non-node
+ * entities.
+ *
+ * Return 0 on success or a negative error code on failure.
+ */
+static int iss_pipeline_pm_power(struct media_entity *entity, int change)
+{
+       struct media_entity_graph graph;
+       struct media_entity *first = entity;
+       int ret = 0;
+
+       if (!change)
+               return 0;
+
+       media_entity_graph_walk_start(&graph, entity);
+
+       while (!ret && (entity = media_entity_graph_walk_next(&graph)))
+               if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
+                       ret = iss_pipeline_pm_power_one(entity, change);
+
+       if (!ret)
+               return 0;
+
+       media_entity_graph_walk_start(&graph, first);
+
+       while ((first = media_entity_graph_walk_next(&graph))
+              && first != entity)
+               if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
+                       iss_pipeline_pm_power_one(first, -change);
+
+       return ret;
+}
+
+/*
+ * omap4iss_pipeline_pm_use - Update the use count of an entity
+ * @entity: The entity
+ * @use: Use (1) or stop using (0) the entity
+ *
+ * Update the use count of all entities in the pipeline and power entities on or
+ * off accordingly.
+ *
+ * Return 0 on success or a negative error code on failure. Powering entities
+ * off is assumed to never fail. No failure can occur when the use parameter is
+ * set to 0.
+ */
+int omap4iss_pipeline_pm_use(struct media_entity *entity, int use)
+{
+       int change = use ? 1 : -1;
+       int ret;
+
+       mutex_lock(&entity->parent->graph_mutex);
+
+       /* Apply use count to node. */
+       entity->use_count += change;
+       WARN_ON(entity->use_count < 0);
+
+       /* Apply power change to connected non-nodes. */
+       ret = iss_pipeline_pm_power(entity, change);
+       if (ret < 0)
+               entity->use_count -= change;
+
+       mutex_unlock(&entity->parent->graph_mutex);
+
+       return ret;
+}
+
+/*
+ * iss_pipeline_link_notify - Link management notification callback
+ * @link: The link
+ * @flags: New link flags that will be applied
+ *
+ * React to link management on powered pipelines by updating the use count of
+ * all entities in the source and sink sides of the link. Entities are powered
+ * on or off accordingly.
+ *
+ * Return 0 on success or a negative error code on failure. Powering entities
+ * off is assumed to never fail. This function will not fail for disconnection
+ * events.
+ */
+static int iss_pipeline_link_notify(struct media_link *link, u32 flags,
+                                   unsigned int notification)
+{
+       struct media_entity *source = link->source->entity;
+       struct media_entity *sink = link->sink->entity;
+       int source_use = iss_pipeline_pm_use_count(source);
+       int sink_use = iss_pipeline_pm_use_count(sink);
+       int ret;
+
+       if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH &&
+           !(link->flags & MEDIA_LNK_FL_ENABLED)) {
+               /* Powering off entities is assumed to never fail. */
+               iss_pipeline_pm_power(source, -sink_use);
+               iss_pipeline_pm_power(sink, -source_use);
+               return 0;
+       }
+
+       if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH &&
+               (flags & MEDIA_LNK_FL_ENABLED)) {
+               ret = iss_pipeline_pm_power(source, sink_use);
+               if (ret < 0)
+                       return ret;
+
+               ret = iss_pipeline_pm_power(sink, source_use);
+               if (ret < 0)
+                       iss_pipeline_pm_power(source, -sink_use);
+
+               return ret;
+       }
+
+       return 0;
+}
+
+/* -----------------------------------------------------------------------------
+ * Pipeline stream management
+ */
+
+/*
+ * iss_pipeline_enable - Enable streaming on a pipeline
+ * @pipe: ISS pipeline
+ * @mode: Stream mode (single shot or continuous)
+ *
+ * Walk the entities chain starting at the pipeline output video node and start
+ * all modules in the chain in the given mode.
+ *
+ * Return 0 if successful, or the return value of the failed video::s_stream
+ * operation otherwise.
+ */
+static int iss_pipeline_enable(struct iss_pipeline *pipe,
+                              enum iss_pipeline_stream_state mode)
+{
+       struct media_entity *entity;
+       struct media_pad *pad;
+       struct v4l2_subdev *subdev;
+       unsigned long flags;
+       int ret;
+
+       spin_lock_irqsave(&pipe->lock, flags);
+       pipe->state &= ~(ISS_PIPELINE_IDLE_INPUT | ISS_PIPELINE_IDLE_OUTPUT);
+       spin_unlock_irqrestore(&pipe->lock, flags);
+
+       pipe->do_propagation = false;
+
+       entity = &pipe->output->video.entity;
+       while (1) {
+               pad = &entity->pads[0];
+               if (!(pad->flags & MEDIA_PAD_FL_SINK))
+                       break;
+
+               pad = media_entity_remote_pad(pad);
+               if (pad == NULL ||
+                   media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+                       break;
+
+               entity = pad->entity;
+               subdev = media_entity_to_v4l2_subdev(entity);
+
+               ret = v4l2_subdev_call(subdev, video, s_stream, mode);
+               if (ret < 0 && ret != -ENOIOCTLCMD)
+                       return ret;
+       }
+       iss_print_status(pipe->output->iss);
+       return 0;
+}
+
+/*
+ * iss_pipeline_disable - Disable streaming on a pipeline
+ * @pipe: ISS pipeline
+ *
+ * Walk the entities chain starting at the pipeline output video node and stop
+ * all modules in the chain. Wait synchronously for the modules to be stopped if
+ * necessary.
+ */
+static int iss_pipeline_disable(struct iss_pipeline *pipe)
+{
+       struct media_entity *entity;
+       struct media_pad *pad;
+       struct v4l2_subdev *subdev;
+
+       entity = &pipe->output->video.entity;
+       while (1) {
+               pad = &entity->pads[0];
+               if (!(pad->flags & MEDIA_PAD_FL_SINK))
+                       break;
+
+               pad = media_entity_remote_pad(pad);
+               if (pad == NULL ||
+                   media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+                       break;
+
+               entity = pad->entity;
+               subdev = media_entity_to_v4l2_subdev(entity);
+
+               v4l2_subdev_call(subdev, video, s_stream, 0);
+       }
+
+       return 0;
+}
+
+/*
+ * omap4iss_pipeline_set_stream - Enable/disable streaming on a pipeline
+ * @pipe: ISS pipeline
+ * @state: Stream state (stopped, single shot or continuous)
+ *
+ * Set the pipeline to the given stream state. Pipelines can be started in
+ * single-shot or continuous mode.
+ *
+ * Return 0 if successful, or the return value of the failed video::s_stream
+ * operation otherwise. The pipeline state is not updated when the operation
+ * fails, except when stopping the pipeline.
+ */
+int omap4iss_pipeline_set_stream(struct iss_pipeline *pipe,
+                                enum iss_pipeline_stream_state state)
+{
+       int ret;
+
+       if (state == ISS_PIPELINE_STREAM_STOPPED)
+               ret = iss_pipeline_disable(pipe);
+       else
+               ret = iss_pipeline_enable(pipe, state);
+
+       if (ret == 0 || state == ISS_PIPELINE_STREAM_STOPPED)
+               pipe->stream_state = state;
+
+       return ret;
+}
+
+/*
+ * iss_pipeline_is_last - Verify if entity has an enabled link to the output
+ *                       video node
+ * @me: ISS module's media entity
+ *
+ * Returns 1 if the entity has an enabled link to the output video node or 0
+ * otherwise. It's true only while pipeline can have no more than one output
+ * node.
+ */
+static int iss_pipeline_is_last(struct media_entity *me)
+{
+       struct iss_pipeline *pipe;
+       struct media_pad *pad;
+
+       if (!me->pipe)
+               return 0;
+       pipe = to_iss_pipeline(me);
+       if (pipe->stream_state == ISS_PIPELINE_STREAM_STOPPED)
+               return 0;
+       pad = media_entity_remote_pad(&pipe->output->pad);
+       return pad->entity == me;
+}
+
+static int iss_reset(struct iss_device *iss)
+{
+       unsigned long timeout = 0;
+
+       writel(readl(iss->regs[OMAP4_ISS_MEM_TOP] + ISS_HL_SYSCONFIG) |
+               ISS_HL_SYSCONFIG_SOFTRESET,
+               iss->regs[OMAP4_ISS_MEM_TOP] + ISS_HL_SYSCONFIG);
+
+       while (readl(iss->regs[OMAP4_ISS_MEM_TOP] + ISS_HL_SYSCONFIG) &
+                       ISS_HL_SYSCONFIG_SOFTRESET) {
+               if (timeout++ > 100) {
+                       dev_alert(iss->dev, "cannot reset ISS\n");
+                       return -ETIMEDOUT;
+               }
+               usleep_range(10, 10);
+       }
+
+       return 0;
+}
+
+static int iss_isp_reset(struct iss_device *iss)
+{
+       unsigned long timeout = 0;
+
+       /* Fist, ensure that the ISP is IDLE (no transactions happening) */
+       writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_SYSCONFIG) &
+               ~ISP5_SYSCONFIG_STANDBYMODE_MASK) |
+               ISP5_SYSCONFIG_STANDBYMODE_SMART,
+               iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_SYSCONFIG);
+
+       writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_CTRL) |
+               ISP5_CTRL_MSTANDBY,
+               iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_CTRL);
+
+       for (;;) {
+               if (readl(iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_CTRL) &
+                               ISP5_CTRL_MSTANDBY_WAIT)
+                       break;
+               if (timeout++ > 1000) {
+                       dev_alert(iss->dev, "cannot set ISP5 to standby\n");
+                       return -ETIMEDOUT;
+               }
+               usleep_range(1000, 1500);
+       }
+
+       /* Now finally, do the reset */
+       writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_SYSCONFIG) |
+               ISP5_SYSCONFIG_SOFTRESET,
+               iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_SYSCONFIG);
+
+       timeout = 0;
+       while (readl(iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_SYSCONFIG) &
+                       ISP5_SYSCONFIG_SOFTRESET) {
+               if (timeout++ > 1000) {
+                       dev_alert(iss->dev, "cannot reset ISP5\n");
+                       return -ETIMEDOUT;
+               }
+               usleep_range(1000, 1500);
+       }
+
+       return 0;
+}
+
+/*
+ * iss_module_sync_idle - Helper to sync module with its idle state
+ * @me: ISS submodule's media entity
+ * @wait: ISS submodule's wait queue for streamoff/interrupt synchronization
+ * @stopping: flag which tells module wants to stop
+ *
+ * This function checks if ISS submodule needs to wait for next interrupt. If
+ * yes, makes the caller to sleep while waiting for such event.
+ */
+int omap4iss_module_sync_idle(struct media_entity *me, wait_queue_head_t *wait,
+                             atomic_t *stopping)
+{
+       struct iss_pipeline *pipe = to_iss_pipeline(me);
+       struct iss_video *video = pipe->output;
+       unsigned long flags;
+
+       if (pipe->stream_state == ISS_PIPELINE_STREAM_STOPPED ||
+           (pipe->stream_state == ISS_PIPELINE_STREAM_SINGLESHOT &&
+            !iss_pipeline_ready(pipe)))
+               return 0;
+
+       /*
+        * atomic_set() doesn't include memory barrier on ARM platform for SMP
+        * scenario. We'll call it here to avoid race conditions.
+        */
+       atomic_set(stopping, 1);
+       smp_wmb();
+
+       /*
+        * If module is the last one, it's writing to memory. In this case,
+        * it's necessary to check if the module is already paused due to
+        * DMA queue underrun or if it has to wait for next interrupt to be
+        * idle.
+        * If it isn't the last one, the function won't sleep but *stopping
+        * will still be set to warn next submodule caller's interrupt the
+        * module wants to be idle.
+        */
+       if (!iss_pipeline_is_last(me))
+               return 0;
+
+       spin_lock_irqsave(&video->qlock, flags);
+       if (video->dmaqueue_flags & ISS_VIDEO_DMAQUEUE_UNDERRUN) {
+               spin_unlock_irqrestore(&video->qlock, flags);
+               atomic_set(stopping, 0);
+               smp_wmb();
+               return 0;
+       }
+       spin_unlock_irqrestore(&video->qlock, flags);
+       if (!wait_event_timeout(*wait, !atomic_read(stopping),
+                               msecs_to_jiffies(1000))) {
+               atomic_set(stopping, 0);
+               smp_wmb();
+               return -ETIMEDOUT;
+       }
+
+       return 0;
+}
+
+/*
+ * omap4iss_module_sync_is_stopped - Helper to verify if module was stopping
+ * @wait: ISS submodule's wait queue for streamoff/interrupt synchronization
+ * @stopping: flag which tells module wants to stop
+ *
+ * This function checks if ISS submodule was stopping. In case of yes, it
+ * notices the caller by setting stopping to 0 and waking up the wait queue.
+ * Returns 1 if it was stopping or 0 otherwise.
+ */
+int omap4iss_module_sync_is_stopping(wait_queue_head_t *wait,
+                                    atomic_t *stopping)
+{
+       if (atomic_cmpxchg(stopping, 1, 0)) {
+               wake_up(wait);
+               return 1;
+       }
+
+       return 0;
+}
+
+/* --------------------------------------------------------------------------
+ * Clock management
+ */
+
+#define ISS_CLKCTRL_MASK       (ISS_CLKCTRL_CSI2_A |\
+                                ISS_CLKCTRL_CSI2_B |\
+                                ISS_CLKCTRL_ISP)
+
+static int __iss_subclk_update(struct iss_device *iss)
+{
+       u32 clk = 0;
+       int ret = 0, timeout = 1000;
+
+       if (iss->subclk_resources & OMAP4_ISS_SUBCLK_CSI2_A)
+               clk |= ISS_CLKCTRL_CSI2_A;
+
+       if (iss->subclk_resources & OMAP4_ISS_SUBCLK_CSI2_B)
+               clk |= ISS_CLKCTRL_CSI2_B;
+
+       if (iss->subclk_resources & OMAP4_ISS_SUBCLK_ISP)
+               clk |= ISS_CLKCTRL_ISP;
+
+       writel((readl(iss->regs[OMAP4_ISS_MEM_TOP] + ISS_CLKCTRL) &
+               ~ISS_CLKCTRL_MASK) | clk,
+               iss->regs[OMAP4_ISS_MEM_TOP] + ISS_CLKCTRL);
+
+       /* Wait for HW assertion */
+       while (--timeout > 0) {
+               udelay(1);
+               if ((readl(iss->regs[OMAP4_ISS_MEM_TOP] + ISS_CLKSTAT) &
+                    ISS_CLKCTRL_MASK) == clk)
+                       break;
+       }
+
+       if (!timeout)
+               ret = -EBUSY;
+
+       return ret;
+}
+
+int omap4iss_subclk_enable(struct iss_device *iss,
+                           enum iss_subclk_resource res)
+{
+       iss->subclk_resources |= res;
+
+       return __iss_subclk_update(iss);
+}
+
+int omap4iss_subclk_disable(struct iss_device *iss,
+                            enum iss_subclk_resource res)
+{
+       iss->subclk_resources &= ~res;
+
+       return __iss_subclk_update(iss);
+}
+
+#define ISS_ISP5_CLKCTRL_MASK  (ISP5_CTRL_BL_CLK_ENABLE |\
+                                ISP5_CTRL_ISIF_CLK_ENABLE |\
+                                ISP5_CTRL_H3A_CLK_ENABLE |\
+                                ISP5_CTRL_RSZ_CLK_ENABLE |\
+                                ISP5_CTRL_IPIPE_CLK_ENABLE |\
+                                ISP5_CTRL_IPIPEIF_CLK_ENABLE)
+
+static void __iss_isp_subclk_update(struct iss_device *iss)
+{
+       u32 clk = 0;
+
+       if (iss->isp_subclk_resources & OMAP4_ISS_ISP_SUBCLK_ISIF)
+               clk |= ISP5_CTRL_ISIF_CLK_ENABLE;
+
+       if (iss->isp_subclk_resources & OMAP4_ISS_ISP_SUBCLK_H3A)
+               clk |= ISP5_CTRL_H3A_CLK_ENABLE;
+
+       if (iss->isp_subclk_resources & OMAP4_ISS_ISP_SUBCLK_RSZ)
+               clk |= ISP5_CTRL_RSZ_CLK_ENABLE;
+
+       if (iss->isp_subclk_resources & OMAP4_ISS_ISP_SUBCLK_IPIPE)
+               clk |= ISP5_CTRL_IPIPE_CLK_ENABLE;
+
+       if (iss->isp_subclk_resources & OMAP4_ISS_ISP_SUBCLK_IPIPEIF)
+               clk |= ISP5_CTRL_IPIPEIF_CLK_ENABLE;
+
+       if (clk)
+               clk |= ISP5_CTRL_BL_CLK_ENABLE;
+
+       writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_CTRL) &
+               ~ISS_ISP5_CLKCTRL_MASK) | clk,
+               iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_CTRL);
+}
+
+void omap4iss_isp_subclk_enable(struct iss_device *iss,
+                               enum iss_isp_subclk_resource res)
+{
+       iss->isp_subclk_resources |= res;
+
+       __iss_isp_subclk_update(iss);
+}
+
+void omap4iss_isp_subclk_disable(struct iss_device *iss,
+                                enum iss_isp_subclk_resource res)
+{
+       iss->isp_subclk_resources &= ~res;
+
+       __iss_isp_subclk_update(iss);
+}
+
+/*
+ * iss_enable_clocks - Enable ISS clocks
+ * @iss: OMAP4 ISS device
+ *
+ * Return 0 if successful, or clk_enable return value if any of tthem fails.
+ */
+static int iss_enable_clocks(struct iss_device *iss)
+{
+       int ret;
+
+       ret = clk_enable(iss->iss_fck);
+       if (ret) {
+               dev_err(iss->dev, "clk_enable iss_fck failed\n");
+               return ret;
+       }
+
+       ret = clk_enable(iss->iss_ctrlclk);
+       if (ret) {
+               dev_err(iss->dev, "clk_enable iss_ctrlclk failed\n");
+               clk_disable(iss->iss_fck);
+               return ret;
+       }
+
+       return 0;
+}
+
+/*
+ * iss_disable_clocks - Disable ISS clocks
+ * @iss: OMAP4 ISS device
+ */
+static void iss_disable_clocks(struct iss_device *iss)
+{
+       clk_disable(iss->iss_ctrlclk);
+       clk_disable(iss->iss_fck);
+}
+
+static void iss_put_clocks(struct iss_device *iss)
+{
+       if (iss->iss_fck) {
+               clk_put(iss->iss_fck);
+               iss->iss_fck = NULL;
+       }
+
+       if (iss->iss_ctrlclk) {
+               clk_put(iss->iss_ctrlclk);
+               iss->iss_ctrlclk = NULL;
+       }
+}
+
+static int iss_get_clocks(struct iss_device *iss)
+{
+       iss->iss_fck = clk_get(iss->dev, "iss_fck");
+       if (IS_ERR(iss->iss_fck)) {
+               dev_err(iss->dev, "Unable to get iss_fck clock info\n");
+               iss_put_clocks(iss);
+               return PTR_ERR(iss->iss_fck);
+       }
+
+       iss->iss_ctrlclk = clk_get(iss->dev, "iss_ctrlclk");
+       if (IS_ERR(iss->iss_ctrlclk)) {
+               dev_err(iss->dev, "Unable to get iss_ctrlclk clock info\n");
+               iss_put_clocks(iss);
+               return PTR_ERR(iss->iss_fck);
+       }
+
+       return 0;
+}
+
+/*
+ * omap4iss_get - Acquire the ISS resource.
+ *
+ * Initializes the clocks for the first acquire.
+ *
+ * Increment the reference count on the ISS. If the first reference is taken,
+ * enable clocks and power-up all submodules.
+ *
+ * Return a pointer to the ISS device structure, or NULL if an error occurred.
+ */
+struct iss_device *omap4iss_get(struct iss_device *iss)
+{
+       struct iss_device *__iss = iss;
+
+       if (iss == NULL)
+               return NULL;
+
+       mutex_lock(&iss->iss_mutex);
+       if (iss->ref_count > 0)
+               goto out;
+
+       if (iss_enable_clocks(iss) < 0) {
+               __iss = NULL;
+               goto out;
+       }
+
+       iss_enable_interrupts(iss);
+
+out:
+       if (__iss != NULL)
+               iss->ref_count++;
+       mutex_unlock(&iss->iss_mutex);
+
+       return __iss;
+}
+
+/*
+ * omap4iss_put - Release the ISS
+ *
+ * Decrement the reference count on the ISS. If the last reference is released,
+ * power-down all submodules, disable clocks and free temporary buffers.
+ */
+void omap4iss_put(struct iss_device *iss)
+{
+       if (iss == NULL)
+               return;
+
+       mutex_lock(&iss->iss_mutex);
+       BUG_ON(iss->ref_count == 0);
+       if (--iss->ref_count == 0) {
+               iss_disable_interrupts(iss);
+               iss_disable_clocks(iss);
+       }
+       mutex_unlock(&iss->iss_mutex);
+}
+
+static int iss_map_mem_resource(struct platform_device *pdev,
+                               struct iss_device *iss,
+                               enum iss_mem_resources res)
+{
+       struct resource *mem;
+
+       /* request the mem region for the camera registers */
+
+       mem = platform_get_resource(pdev, IORESOURCE_MEM, res);
+       if (!mem) {
+               dev_err(iss->dev, "no mem resource?\n");
+               return -ENODEV;
+       }
+
+       if (!request_mem_region(mem->start, resource_size(mem), pdev->name)) {
+               dev_err(iss->dev,
+                       "cannot reserve camera register I/O region\n");
+               return -ENODEV;
+       }
+       iss->res[res] = mem;
+
+       /* map the region */
+       iss->regs[res] = ioremap_nocache(mem->start, resource_size(mem));
+       if (!iss->regs[res]) {
+               dev_err(iss->dev, "cannot map camera register I/O region\n");
+               return -ENODEV;
+       }
+
+       return 0;
+}
+
+static void iss_unregister_entities(struct iss_device *iss)
+{
+       omap4iss_resizer_unregister_entities(&iss->resizer);
+       omap4iss_ipipe_unregister_entities(&iss->ipipe);
+       omap4iss_ipipeif_unregister_entities(&iss->ipipeif);
+       omap4iss_csi2_unregister_entities(&iss->csi2a);
+       omap4iss_csi2_unregister_entities(&iss->csi2b);
+
+       v4l2_device_unregister(&iss->v4l2_dev);
+       media_device_unregister(&iss->media_dev);
+}
+
+/*
+ * iss_register_subdev_group - Register a group of subdevices
+ * @iss: OMAP4 ISS device
+ * @board_info: I2C subdevs board information array
+ *
+ * Register all I2C subdevices in the board_info array. The array must be
+ * terminated by a NULL entry, and the first entry must be the sensor.
+ *
+ * Return a pointer to the sensor media entity if it has been successfully
+ * registered, or NULL otherwise.
+ */
+static struct v4l2_subdev *
+iss_register_subdev_group(struct iss_device *iss,
+                    struct iss_subdev_i2c_board_info *board_info)
+{
+       struct v4l2_subdev *sensor = NULL;
+       unsigned int first;
+
+       if (board_info->board_info == NULL)
+               return NULL;
+
+       for (first = 1; board_info->board_info; ++board_info, first = 0) {
+               struct v4l2_subdev *subdev;
+               struct i2c_adapter *adapter;
+
+               adapter = i2c_get_adapter(board_info->i2c_adapter_id);
+               if (adapter == NULL) {
+                       dev_err(iss->dev, "%s: Unable to get I2C adapter %d for "
+                               "device %s\n", __func__,
+                               board_info->i2c_adapter_id,
+                               board_info->board_info->type);
+                       continue;
+               }
+
+               subdev = v4l2_i2c_new_subdev_board(&iss->v4l2_dev, adapter,
+                               board_info->board_info, NULL);
+               if (subdev == NULL) {
+                       dev_err(iss->dev, "%s: Unable to register subdev %s\n",
+                               __func__, board_info->board_info->type);
+                       continue;
+               }
+
+               if (first)
+                       sensor = subdev;
+       }
+
+       return sensor;
+}
+
+static int iss_register_entities(struct iss_device *iss)
+{
+       struct iss_platform_data *pdata = iss->pdata;
+       struct iss_v4l2_subdevs_group *subdevs;
+       int ret;
+
+       iss->media_dev.dev = iss->dev;
+       strlcpy(iss->media_dev.model, "TI OMAP4 ISS",
+               sizeof(iss->media_dev.model));
+       iss->media_dev.hw_revision = iss->revision;
+       iss->media_dev.link_notify = iss_pipeline_link_notify;
+       ret = media_device_register(&iss->media_dev);
+       if (ret < 0) {
+               printk(KERN_ERR "%s: Media device registration failed (%d)\n",
+                       __func__, ret);
+               return ret;
+       }
+
+       iss->v4l2_dev.mdev = &iss->media_dev;
+       ret = v4l2_device_register(iss->dev, &iss->v4l2_dev);
+       if (ret < 0) {
+               printk(KERN_ERR "%s: V4L2 device registration failed (%d)\n",
+                       __func__, ret);
+               goto done;
+       }
+
+       /* Register internal entities */
+       ret = omap4iss_csi2_register_entities(&iss->csi2a, &iss->v4l2_dev);
+       if (ret < 0)
+               goto done;
+
+       ret = omap4iss_csi2_register_entities(&iss->csi2b, &iss->v4l2_dev);
+       if (ret < 0)
+               goto done;
+
+       ret = omap4iss_ipipeif_register_entities(&iss->ipipeif, &iss->v4l2_dev);
+       if (ret < 0)
+               goto done;
+
+       ret = omap4iss_ipipe_register_entities(&iss->ipipe, &iss->v4l2_dev);
+       if (ret < 0)
+               goto done;
+
+       ret = omap4iss_resizer_register_entities(&iss->resizer, &iss->v4l2_dev);
+       if (ret < 0)
+               goto done;
+
+       /* Register external entities */
+       for (subdevs = pdata->subdevs; subdevs && subdevs->subdevs; ++subdevs) {
+               struct v4l2_subdev *sensor;
+               struct media_entity *input;
+               unsigned int flags;
+               unsigned int pad;
+
+               sensor = iss_register_subdev_group(iss, subdevs->subdevs);
+               if (sensor == NULL)
+                       continue;
+
+               sensor->host_priv = subdevs;
+
+               /* Connect the sensor to the correct interface module.
+                * CSI2a receiver through CSIPHY1, or
+                * CSI2b receiver through CSIPHY2
+                */
+               switch (subdevs->interface) {
+               case ISS_INTERFACE_CSI2A_PHY1:
+                       input = &iss->csi2a.subdev.entity;
+                       pad = CSI2_PAD_SINK;
+                       flags = MEDIA_LNK_FL_IMMUTABLE
+                             | MEDIA_LNK_FL_ENABLED;
+                       break;
+
+               case ISS_INTERFACE_CSI2B_PHY2:
+                       input = &iss->csi2b.subdev.entity;
+                       pad = CSI2_PAD_SINK;
+                       flags = MEDIA_LNK_FL_IMMUTABLE
+                             | MEDIA_LNK_FL_ENABLED;
+                       break;
+
+               default:
+                       printk(KERN_ERR "%s: invalid interface type %u\n",
+                              __func__, subdevs->interface);
+                       ret = -EINVAL;
+                       goto done;
+               }
+
+               ret = media_entity_create_link(&sensor->entity, 0, input, pad,
+                                              flags);
+               if (ret < 0)
+                       goto done;
+       }
+
+       ret = v4l2_device_register_subdev_nodes(&iss->v4l2_dev);
+
+done:
+       if (ret < 0)
+               iss_unregister_entities(iss);
+
+       return ret;
+}
+
+static void iss_cleanup_modules(struct iss_device *iss)
+{
+       omap4iss_csi2_cleanup(iss);
+       omap4iss_ipipeif_cleanup(iss);
+       omap4iss_ipipe_cleanup(iss);
+       omap4iss_resizer_cleanup(iss);
+}
+
+static int iss_initialize_modules(struct iss_device *iss)
+{
+       int ret;
+
+       ret = omap4iss_csiphy_init(iss);
+       if (ret < 0) {
+               dev_err(iss->dev, "CSI PHY initialization failed\n");
+               goto error_csiphy;
+       }
+
+       ret = omap4iss_csi2_init(iss);
+       if (ret < 0) {
+               dev_err(iss->dev, "CSI2 initialization failed\n");
+               goto error_csi2;
+       }
+
+       ret = omap4iss_ipipeif_init(iss);
+       if (ret < 0) {
+               dev_err(iss->dev, "ISP IPIPEIF initialization failed\n");
+               goto error_ipipeif;
+       }
+
+       ret = omap4iss_ipipe_init(iss);
+       if (ret < 0) {
+               dev_err(iss->dev, "ISP IPIPE initialization failed\n");
+               goto error_ipipe;
+       }
+
+       ret = omap4iss_resizer_init(iss);
+       if (ret < 0) {
+               dev_err(iss->dev, "ISP RESIZER initialization failed\n");
+               goto error_resizer;
+       }
+
+       /* Connect the submodules. */
+       ret = media_entity_create_link(
+                       &iss->csi2a.subdev.entity, CSI2_PAD_SOURCE,
+                       &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
+       if (ret < 0)
+               goto error_link;
+
+       ret = media_entity_create_link(
+                       &iss->csi2b.subdev.entity, CSI2_PAD_SOURCE,
+                       &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
+       if (ret < 0)
+               goto error_link;
+
+       ret = media_entity_create_link(
+                       &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
+                       &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
+       if (ret < 0)
+               goto error_link;
+
+       ret = media_entity_create_link(
+                       &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
+                       &iss->ipipe.subdev.entity, IPIPE_PAD_SINK, 0);
+       if (ret < 0)
+               goto error_link;
+
+       ret = media_entity_create_link(
+                       &iss->ipipe.subdev.entity, IPIPE_PAD_SOURCE_VP,
+                       &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
+       if (ret < 0)
+               goto error_link;
+
+       return 0;
+
+error_link:
+       omap4iss_resizer_cleanup(iss);
+error_resizer:
+       omap4iss_ipipe_cleanup(iss);
+error_ipipe:
+       omap4iss_ipipeif_cleanup(iss);
+error_ipipeif:
+       omap4iss_csi2_cleanup(iss);
+error_csi2:
+error_csiphy:
+       return ret;
+}
+
+static int iss_probe(struct platform_device *pdev)
+{
+       struct iss_platform_data *pdata = pdev->dev.platform_data;
+       struct iss_device *iss;
+       unsigned int i;
+       int ret;
+
+       if (pdata == NULL)
+               return -EINVAL;
+
+       iss = kzalloc(sizeof(*iss), GFP_KERNEL);
+       if (!iss) {
+               dev_err(&pdev->dev, "Could not allocate memory\n");
+               return -ENOMEM;
+       }
+
+       mutex_init(&iss->iss_mutex);
+
+       iss->dev = &pdev->dev;
+       iss->pdata = pdata;
+
+       iss->raw_dmamask = DMA_BIT_MASK(32);
+       iss->dev->dma_mask = &iss->raw_dmamask;
+       iss->dev->coherent_dma_mask = DMA_BIT_MASK(32);
+
+       platform_set_drvdata(pdev, iss);
+
+       /* Clocks */
+       ret = iss_map_mem_resource(pdev, iss, OMAP4_ISS_MEM_TOP);
+       if (ret < 0)
+               goto error;
+
+       ret = iss_get_clocks(iss);
+       if (ret < 0)
+               goto error;
+
+       if (omap4iss_get(iss) == NULL)
+               goto error;
+
+       ret = iss_reset(iss);
+       if (ret < 0)
+               goto error_iss;
+
+       iss->revision = readl(iss->regs[OMAP4_ISS_MEM_TOP] + ISS_HL_REVISION);
+       dev_info(iss->dev, "Revision %08x found\n", iss->revision);
+
+       for (i = 1; i < OMAP4_ISS_MEM_LAST; i++) {
+               ret = iss_map_mem_resource(pdev, iss, i);
+               if (ret)
+                       goto error_iss;
+       }
+
+       /* Configure BTE BW_LIMITER field to max recommended value (1 GB) */
+       writel((readl(iss->regs[OMAP4_ISS_MEM_BTE] + BTE_CTRL) & ~BTE_CTRL_BW_LIMITER_MASK) |
+               (18 << BTE_CTRL_BW_LIMITER_SHIFT),
+               iss->regs[OMAP4_ISS_MEM_BTE] + BTE_CTRL);
+
+       /* Perform ISP reset */
+       ret = omap4iss_subclk_enable(iss, OMAP4_ISS_SUBCLK_ISP);
+       if (ret < 0)
+               goto error_iss;
+
+       ret = iss_isp_reset(iss);
+       if (ret < 0)
+               goto error_iss;
+
+       dev_info(iss->dev, "ISP Revision %08x found\n",
+                readl(iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_REVISION));
+
+       /* Interrupt */
+       iss->irq_num = platform_get_irq(pdev, 0);
+       if (iss->irq_num <= 0) {
+               dev_err(iss->dev, "No IRQ resource\n");
+               ret = -ENODEV;
+               goto error_iss;
+       }
+
+       if (request_irq(iss->irq_num, iss_isr, IRQF_SHARED, "OMAP4 ISS", iss)) {
+               dev_err(iss->dev, "Unable to request IRQ\n");
+               ret = -EINVAL;
+               goto error_iss;
+       }
+
+       /* Entities */
+       ret = iss_initialize_modules(iss);
+       if (ret < 0)
+               goto error_irq;
+
+       ret = iss_register_entities(iss);
+       if (ret < 0)
+               goto error_modules;
+
+       omap4iss_put(iss);
+
+       return 0;
+
+error_modules:
+       iss_cleanup_modules(iss);
+error_irq:
+       free_irq(iss->irq_num, iss);
+error_iss:
+       omap4iss_put(iss);
+error:
+       iss_put_clocks(iss);
+
+       for (i = 0; i < OMAP4_ISS_MEM_LAST; i++) {
+               if (iss->regs[i]) {
+                       iounmap(iss->regs[i]);
+                       iss->regs[i] = NULL;
+               }
+
+               if (iss->res[i]) {
+                       release_mem_region(iss->res[i]->start,
+                                          resource_size(iss->res[i]));
+                       iss->res[i] = NULL;
+               }
+       }
+       platform_set_drvdata(pdev, NULL);
+
+       mutex_destroy(&iss->iss_mutex);
+       kfree(iss);
+
+       return ret;
+}
+
+static int iss_remove(struct platform_device *pdev)
+{
+       struct iss_device *iss = platform_get_drvdata(pdev);
+       unsigned int i;
+
+       iss_unregister_entities(iss);
+       iss_cleanup_modules(iss);
+
+       free_irq(iss->irq_num, iss);
+       iss_put_clocks(iss);
+
+       for (i = 0; i < OMAP4_ISS_MEM_LAST; i++) {
+               if (iss->regs[i]) {
+                       iounmap(iss->regs[i]);
+                       iss->regs[i] = NULL;
+               }
+
+               if (iss->res[i]) {
+                       release_mem_region(iss->res[i]->start,
+                                          resource_size(iss->res[i]));
+                       iss->res[i] = NULL;
+               }
+       }
+
+       kfree(iss);
+
+       return 0;
+}
+
+static struct platform_device_id omap4iss_id_table[] = {
+       { "omap4iss", 0 },
+       { },
+};
+MODULE_DEVICE_TABLE(platform, omap4iss_id_table);
+
+static struct platform_driver iss_driver = {
+       .probe          = iss_probe,
+       .remove         = iss_remove,
+       .id_table       = omap4iss_id_table,
+       .driver = {
+               .owner  = THIS_MODULE,
+               .name   = "omap4iss",
+       },
+};
+
+module_platform_driver(iss_driver);
+
+MODULE_DESCRIPTION("TI OMAP4 ISS driver");
+MODULE_AUTHOR("Sergio Aguirre <sergio.a.aguirre@gmail.com>");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(ISS_VIDEO_DRIVER_VERSION);
diff --git a/drivers/staging/media/omap4iss/iss.h b/drivers/staging/media/omap4iss/iss.h
new file mode 100644 (file)
index 0000000..f33664d
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver
+ *
+ * Copyright (C) 2012 Texas Instruments.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#ifndef _OMAP4_ISS_H_
+#define _OMAP4_ISS_H_
+
+#include <media/v4l2-device.h>
+#include <linux/device.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <linux/wait.h>
+
+#include <media/omap4iss.h>
+
+#include "iss_regs.h"
+#include "iss_csiphy.h"
+#include "iss_csi2.h"
+#include "iss_ipipeif.h"
+#include "iss_ipipe.h"
+#include "iss_resizer.h"
+
+#define to_iss_device(ptr_module)                              \
+       container_of(ptr_module, struct iss_device, ptr_module)
+#define to_device(ptr_module)                                          \
+       (to_iss_device(ptr_module)->dev)
+
+enum iss_mem_resources {
+       OMAP4_ISS_MEM_TOP,
+       OMAP4_ISS_MEM_CSI2_A_REGS1,
+       OMAP4_ISS_MEM_CAMERARX_CORE1,
+       OMAP4_ISS_MEM_CSI2_B_REGS1,
+       OMAP4_ISS_MEM_CAMERARX_CORE2,
+       OMAP4_ISS_MEM_BTE,
+       OMAP4_ISS_MEM_ISP_SYS1,
+       OMAP4_ISS_MEM_ISP_RESIZER,
+       OMAP4_ISS_MEM_ISP_IPIPE,
+       OMAP4_ISS_MEM_ISP_ISIF,
+       OMAP4_ISS_MEM_ISP_IPIPEIF,
+       OMAP4_ISS_MEM_LAST,
+};
+
+enum iss_subclk_resource {
+       OMAP4_ISS_SUBCLK_SIMCOP         = (1 << 0),
+       OMAP4_ISS_SUBCLK_ISP            = (1 << 1),
+       OMAP4_ISS_SUBCLK_CSI2_A         = (1 << 2),
+       OMAP4_ISS_SUBCLK_CSI2_B         = (1 << 3),
+       OMAP4_ISS_SUBCLK_CCP2           = (1 << 4),
+};
+
+enum iss_isp_subclk_resource {
+       OMAP4_ISS_ISP_SUBCLK_BL         = (1 << 0),
+       OMAP4_ISS_ISP_SUBCLK_ISIF       = (1 << 1),
+       OMAP4_ISS_ISP_SUBCLK_H3A        = (1 << 2),
+       OMAP4_ISS_ISP_SUBCLK_RSZ        = (1 << 3),
+       OMAP4_ISS_ISP_SUBCLK_IPIPE      = (1 << 4),
+       OMAP4_ISS_ISP_SUBCLK_IPIPEIF    = (1 << 5),
+};
+
+/*
+ * struct iss_reg - Structure for ISS register values.
+ * @reg: 32-bit Register address.
+ * @val: 32-bit Register value.
+ */
+struct iss_reg {
+       enum iss_mem_resources mmio_range;
+       u32 reg;
+       u32 val;
+};
+
+struct iss_device {
+       struct v4l2_device v4l2_dev;
+       struct media_device media_dev;
+       struct device *dev;
+       u32 revision;
+
+       /* platform HW resources */
+       struct iss_platform_data *pdata;
+       unsigned int irq_num;
+
+       struct resource *res[OMAP4_ISS_MEM_LAST];
+       void __iomem *regs[OMAP4_ISS_MEM_LAST];
+
+       u64 raw_dmamask;
+
+       struct mutex iss_mutex; /* For handling ref_count field */
+       int has_context;
+       int ref_count;
+
+       struct clk *iss_fck;
+       struct clk *iss_ctrlclk;
+
+       /* ISS modules */
+       struct iss_csi2_device csi2a;
+       struct iss_csi2_device csi2b;
+       struct iss_csiphy csiphy1;
+       struct iss_csiphy csiphy2;
+       struct iss_ipipeif_device ipipeif;
+       struct iss_ipipe_device ipipe;
+       struct iss_resizer_device resizer;
+
+       unsigned int subclk_resources;
+       unsigned int isp_subclk_resources;
+};
+
+#define v4l2_dev_to_iss_device(dev) \
+       container_of(dev, struct iss_device, v4l2_dev)
+
+int omap4iss_get_external_info(struct iss_pipeline *pipe,
+                              struct media_link *link);
+
+int omap4iss_module_sync_idle(struct media_entity *me, wait_queue_head_t *wait,
+                             atomic_t *stopping);
+
+int omap4iss_module_sync_is_stopping(wait_queue_head_t *wait,
+                                    atomic_t *stopping);
+
+int omap4iss_pipeline_set_stream(struct iss_pipeline *pipe,
+                                enum iss_pipeline_stream_state state);
+
+void omap4iss_configure_bridge(struct iss_device *iss,
+                              enum ipipeif_input_entity input);
+
+struct iss_device *omap4iss_get(struct iss_device *iss);
+void omap4iss_put(struct iss_device *iss);
+int omap4iss_subclk_enable(struct iss_device *iss,
+                          enum iss_subclk_resource res);
+int omap4iss_subclk_disable(struct iss_device *iss,
+                           enum iss_subclk_resource res);
+void omap4iss_isp_subclk_enable(struct iss_device *iss,
+                               enum iss_isp_subclk_resource res);
+void omap4iss_isp_subclk_disable(struct iss_device *iss,
+                                enum iss_isp_subclk_resource res);
+
+void omap4iss_isp_enable_interrupts(struct iss_device *iss);
+void omap4iss_isp_disable_interrupts(struct iss_device *iss);
+
+int omap4iss_pipeline_pm_use(struct media_entity *entity, int use);
+
+int omap4iss_register_entities(struct platform_device *pdev,
+                              struct v4l2_device *v4l2_dev);
+void omap4iss_unregister_entities(struct platform_device *pdev);
+
+#endif /* _OMAP4_ISS_H_ */
diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c
new file mode 100644 (file)
index 0000000..0ee8381
--- /dev/null
@@ -0,0 +1,1368 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - CSI PHY module
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#include <linux/delay.h>
+#include <media/v4l2-common.h>
+#include <linux/v4l2-mediabus.h>
+#include <linux/mm.h>
+
+#include "iss.h"
+#include "iss_regs.h"
+#include "iss_csi2.h"
+
+/*
+ * csi2_if_enable - Enable CSI2 Receiver interface.
+ * @enable: enable flag
+ *
+ */
+static void csi2_if_enable(struct iss_csi2_device *csi2, u8 enable)
+{
+       struct iss_csi2_ctrl_cfg *currctrl = &csi2->ctrl;
+
+       writel((readl(csi2->regs1 + CSI2_CTRL) & ~CSI2_CTRL_IF_EN) |
+               (enable ? CSI2_CTRL_IF_EN : 0),
+               csi2->regs1 + CSI2_CTRL);
+
+       currctrl->if_enable = enable;
+}
+
+/*
+ * csi2_recv_config - CSI2 receiver module configuration.
+ * @currctrl: iss_csi2_ctrl_cfg structure
+ *
+ */
+static void csi2_recv_config(struct iss_csi2_device *csi2,
+                            struct iss_csi2_ctrl_cfg *currctrl)
+{
+       u32 reg = 0;
+
+       if (currctrl->frame_mode)
+               reg |= CSI2_CTRL_FRAME;
+       else
+               reg &= ~CSI2_CTRL_FRAME;
+
+       if (currctrl->vp_clk_enable)
+               reg |= CSI2_CTRL_VP_CLK_EN;
+       else
+               reg &= ~CSI2_CTRL_VP_CLK_EN;
+
+       if (currctrl->vp_only_enable)
+               reg |= CSI2_CTRL_VP_ONLY_EN;
+       else
+               reg &= ~CSI2_CTRL_VP_ONLY_EN;
+
+       reg &= ~CSI2_CTRL_VP_OUT_CTRL_MASK;
+       reg |= currctrl->vp_out_ctrl << CSI2_CTRL_VP_OUT_CTRL_SHIFT;
+
+       if (currctrl->ecc_enable)
+               reg |= CSI2_CTRL_ECC_EN;
+       else
+               reg &= ~CSI2_CTRL_ECC_EN;
+
+       /*
+        * Set MFlag assertion boundaries to:
+        * Low: 4/8 of FIFO size
+        * High: 6/8 of FIFO size
+        */
+       reg &= ~(CSI2_CTRL_MFLAG_LEVH_MASK | CSI2_CTRL_MFLAG_LEVL_MASK);
+       reg |= (2 << CSI2_CTRL_MFLAG_LEVH_SHIFT) |
+              (4 << CSI2_CTRL_MFLAG_LEVL_SHIFT);
+
+       /* Generation of 16x64-bit bursts (Recommended) */
+       reg |= CSI2_CTRL_BURST_SIZE_EXPAND;
+
+       /* Do Non-Posted writes (Recommended) */
+       reg |= CSI2_CTRL_NON_POSTED_WRITE;
+
+       /*
+        * Enforce Little endian for all formats, including:
+        * YUV4:2:2 8-bit and YUV4:2:0 Legacy
+        */
+       reg |= CSI2_CTRL_ENDIANNESS;
+
+       writel(reg, csi2->regs1 + CSI2_CTRL);
+}
+
+static const unsigned int csi2_input_fmts[] = {
+       V4L2_MBUS_FMT_SGRBG10_1X10,
+       V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8,
+       V4L2_MBUS_FMT_SRGGB10_1X10,
+       V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8,
+       V4L2_MBUS_FMT_SBGGR10_1X10,
+       V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8,
+       V4L2_MBUS_FMT_SGBRG10_1X10,
+       V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8,
+       V4L2_MBUS_FMT_SBGGR8_1X8,
+       V4L2_MBUS_FMT_SGBRG8_1X8,
+       V4L2_MBUS_FMT_SGRBG8_1X8,
+       V4L2_MBUS_FMT_SRGGB8_1X8,
+       V4L2_MBUS_FMT_UYVY8_1X16,
+       V4L2_MBUS_FMT_YUYV8_1X16,
+};
+
+/* To set the format on the CSI2 requires a mapping function that takes
+ * the following inputs:
+ * - 3 different formats (at this time)
+ * - 2 destinations (mem, vp+mem) (vp only handled separately)
+ * - 2 decompression options (on, off)
+ * Output should be CSI2 frame format code
+ * Array indices as follows: [format][dest][decompr]
+ * Not all combinations are valid. 0 means invalid.
+ */
+static const u16 __csi2_fmt_map[][2][2] = {
+       /* RAW10 formats */
+       {
+               /* Output to memory */
+               {
+                       /* No DPCM decompression */
+                       CSI2_PIX_FMT_RAW10_EXP16,
+                       /* DPCM decompression */
+                       0,
+               },
+               /* Output to both */
+               {
+                       /* No DPCM decompression */
+                       CSI2_PIX_FMT_RAW10_EXP16_VP,
+                       /* DPCM decompression */
+                       0,
+               },
+       },
+       /* RAW10 DPCM8 formats */
+       {
+               /* Output to memory */
+               {
+                       /* No DPCM decompression */
+                       CSI2_USERDEF_8BIT_DATA1,
+                       /* DPCM decompression */
+                       CSI2_USERDEF_8BIT_DATA1_DPCM10,
+               },
+               /* Output to both */
+               {
+                       /* No DPCM decompression */
+                       CSI2_PIX_FMT_RAW8_VP,
+                       /* DPCM decompression */
+                       CSI2_USERDEF_8BIT_DATA1_DPCM10_VP,
+               },
+       },
+       /* RAW8 formats */
+       {
+               /* Output to memory */
+               {
+                       /* No DPCM decompression */
+                       CSI2_PIX_FMT_RAW8,
+                       /* DPCM decompression */
+                       0,
+               },
+               /* Output to both */
+               {
+                       /* No DPCM decompression */
+                       CSI2_PIX_FMT_RAW8_VP,
+                       /* DPCM decompression */
+                       0,
+               },
+       },
+       /* YUV422 formats */
+       {
+               /* Output to memory */
+               {
+                       /* No DPCM decompression */
+                       CSI2_PIX_FMT_YUV422_8BIT,
+                       /* DPCM decompression */
+                       0,
+               },
+               /* Output to both */
+               {
+                       /* No DPCM decompression */
+                       CSI2_PIX_FMT_YUV422_8BIT_VP16,
+                       /* DPCM decompression */
+                       0,
+               },
+       },
+};
+
+/*
+ * csi2_ctx_map_format - Map CSI2 sink media bus format to CSI2 format ID
+ * @csi2: ISS CSI2 device
+ *
+ * Returns CSI2 physical format id
+ */
+static u16 csi2_ctx_map_format(struct iss_csi2_device *csi2)
+{
+       const struct v4l2_mbus_framefmt *fmt = &csi2->formats[CSI2_PAD_SINK];
+       int fmtidx, destidx;
+
+       switch (fmt->code) {
+       case V4L2_MBUS_FMT_SGRBG10_1X10:
+       case V4L2_MBUS_FMT_SRGGB10_1X10:
+       case V4L2_MBUS_FMT_SBGGR10_1X10:
+       case V4L2_MBUS_FMT_SGBRG10_1X10:
+               fmtidx = 0;
+               break;
+       case V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8:
+       case V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8:
+       case V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8:
+       case V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8:
+               fmtidx = 1;
+               break;
+       case V4L2_MBUS_FMT_SBGGR8_1X8:
+       case V4L2_MBUS_FMT_SGBRG8_1X8:
+       case V4L2_MBUS_FMT_SGRBG8_1X8:
+       case V4L2_MBUS_FMT_SRGGB8_1X8:
+               fmtidx = 2;
+               break;
+       case V4L2_MBUS_FMT_UYVY8_1X16:
+       case V4L2_MBUS_FMT_YUYV8_1X16:
+               fmtidx = 3;
+               break;
+       default:
+               WARN(1, KERN_ERR "CSI2: pixel format %08x unsupported!\n",
+                    fmt->code);
+               return 0;
+       }
+
+       if (!(csi2->output & CSI2_OUTPUT_IPIPEIF) &&
+           !(csi2->output & CSI2_OUTPUT_MEMORY)) {
+               /* Neither output enabled is a valid combination */
+               return CSI2_PIX_FMT_OTHERS;
+       }
+
+       /* If we need to skip frames at the beginning of the stream disable the
+        * video port to avoid sending the skipped frames to the IPIPEIF.
+        */
+       destidx = csi2->frame_skip ? 0 : !!(csi2->output & CSI2_OUTPUT_IPIPEIF);
+
+       return __csi2_fmt_map[fmtidx][destidx][csi2->dpcm_decompress];
+}
+
+/*
+ * csi2_set_outaddr - Set memory address to save output image
+ * @csi2: Pointer to ISS CSI2a device.
+ * @addr: 32-bit memory address aligned on 32 byte boundary.
+ *
+ * Sets the memory address where the output will be saved.
+ *
+ * Returns 0 if successful, or -EINVAL if the address is not in the 32 byte
+ * boundary.
+ */
+static void csi2_set_outaddr(struct iss_csi2_device *csi2, u32 addr)
+{
+       struct iss_csi2_ctx_cfg *ctx = &csi2->contexts[0];
+
+       ctx->ping_addr = addr;
+       ctx->pong_addr = addr;
+       writel(ctx->ping_addr,
+              csi2->regs1 + CSI2_CTX_PING_ADDR(ctx->ctxnum));
+       writel(ctx->pong_addr,
+              csi2->regs1 + CSI2_CTX_PONG_ADDR(ctx->ctxnum));
+}
+
+/*
+ * is_usr_def_mapping - Checks whether USER_DEF_MAPPING should
+ *                     be enabled by CSI2.
+ * @format_id: mapped format id
+ *
+ */
+static inline int is_usr_def_mapping(u32 format_id)
+{
+       return ((format_id & 0xF0) == 0x40) ? 1 : 0;
+}
+
+/*
+ * csi2_ctx_enable - Enable specified CSI2 context
+ * @ctxnum: Context number, valid between 0 and 7 values.
+ * @enable: enable
+ *
+ */
+static void csi2_ctx_enable(struct iss_csi2_device *csi2, u8 ctxnum, u8 enable)
+{
+       struct iss_csi2_ctx_cfg *ctx = &csi2->contexts[ctxnum];
+       u32 reg;
+
+       reg = readl(csi2->regs1 + CSI2_CTX_CTRL1(ctxnum));
+
+       if (enable) {
+               unsigned int skip = 0;
+
+               if (csi2->frame_skip)
+                       skip = csi2->frame_skip;
+               else if (csi2->output & CSI2_OUTPUT_MEMORY)
+                       skip = 1;
+
+               reg &= ~CSI2_CTX_CTRL1_COUNT_MASK;
+               reg |= CSI2_CTX_CTRL1_COUNT_UNLOCK
+                   |  (skip << CSI2_CTX_CTRL1_COUNT_SHIFT)
+                   |  CSI2_CTX_CTRL1_CTX_EN;
+       } else {
+               reg &= ~CSI2_CTX_CTRL1_CTX_EN;
+       }
+
+       writel(reg, csi2->regs1 + CSI2_CTX_CTRL1(ctxnum));
+       ctx->enabled = enable;
+}
+
+/*
+ * csi2_ctx_config - CSI2 context configuration.
+ * @ctx: context configuration
+ *
+ */
+static void csi2_ctx_config(struct iss_csi2_device *csi2,
+                           struct iss_csi2_ctx_cfg *ctx)
+{
+       u32 reg;
+
+       /* Set up CSI2_CTx_CTRL1 */
+       if (ctx->eof_enabled)
+               reg = CSI2_CTX_CTRL1_EOF_EN;
+
+       if (ctx->eol_enabled)
+               reg |= CSI2_CTX_CTRL1_EOL_EN;
+
+       if (ctx->checksum_enabled)
+               reg |= CSI2_CTX_CTRL1_CS_EN;
+
+       writel(reg, csi2->regs1 + CSI2_CTX_CTRL1(ctx->ctxnum));
+
+       /* Set up CSI2_CTx_CTRL2 */
+       reg = ctx->virtual_id << CSI2_CTX_CTRL2_VIRTUAL_ID_SHIFT;
+       reg |= ctx->format_id << CSI2_CTX_CTRL2_FORMAT_SHIFT;
+
+       if (ctx->dpcm_decompress && ctx->dpcm_predictor)
+               reg |= CSI2_CTX_CTRL2_DPCM_PRED;
+
+       if (is_usr_def_mapping(ctx->format_id))
+               reg |= 2 << CSI2_CTX_CTRL2_USER_DEF_MAP_SHIFT;
+
+       writel(reg, csi2->regs1 + CSI2_CTX_CTRL2(ctx->ctxnum));
+
+       /* Set up CSI2_CTx_CTRL3 */
+       writel(ctx->alpha << CSI2_CTX_CTRL3_ALPHA_SHIFT,
+               csi2->regs1 + CSI2_CTX_CTRL3(ctx->ctxnum));
+
+       /* Set up CSI2_CTx_DAT_OFST */
+       reg = readl(csi2->regs1 + CSI2_CTX_DAT_OFST(ctx->ctxnum));
+       reg &= ~CSI2_CTX_DAT_OFST_MASK;
+       reg |= ctx->data_offset;
+       writel(reg, csi2->regs1 + CSI2_CTX_DAT_OFST(ctx->ctxnum));
+
+       writel(ctx->ping_addr,
+                      csi2->regs1 + CSI2_CTX_PING_ADDR(ctx->ctxnum));
+
+       writel(ctx->pong_addr,
+                      csi2->regs1 + CSI2_CTX_PONG_ADDR(ctx->ctxnum));
+}
+
+/*
+ * csi2_timing_config - CSI2 timing configuration.
+ * @timing: csi2_timing_cfg structure
+ */
+static void csi2_timing_config(struct iss_csi2_device *csi2,
+                              struct iss_csi2_timing_cfg *timing)
+{
+       u32 reg;
+
+       reg = readl(csi2->regs1 + CSI2_TIMING);
+
+       if (timing->force_rx_mode)
+               reg |= CSI2_TIMING_FORCE_RX_MODE_IO1;
+       else
+               reg &= ~CSI2_TIMING_FORCE_RX_MODE_IO1;
+
+       if (timing->stop_state_16x)
+               reg |= CSI2_TIMING_STOP_STATE_X16_IO1;
+       else
+               reg &= ~CSI2_TIMING_STOP_STATE_X16_IO1;
+
+       if (timing->stop_state_4x)
+               reg |= CSI2_TIMING_STOP_STATE_X4_IO1;
+       else
+               reg &= ~CSI2_TIMING_STOP_STATE_X4_IO1;
+
+       reg &= ~CSI2_TIMING_STOP_STATE_COUNTER_IO1_MASK;
+       reg |= timing->stop_state_counter <<
+              CSI2_TIMING_STOP_STATE_COUNTER_IO1_SHIFT;
+
+       writel(reg, csi2->regs1 + CSI2_TIMING);
+}
+
+/*
+ * csi2_irq_ctx_set - Enables CSI2 Context IRQs.
+ * @enable: Enable/disable CSI2 Context interrupts
+ */
+static void csi2_irq_ctx_set(struct iss_csi2_device *csi2, int enable)
+{
+       u32 reg = CSI2_CTX_IRQ_FE;
+       int i;
+
+       if (csi2->use_fs_irq)
+               reg |= CSI2_CTX_IRQ_FS;
+
+       for (i = 0; i < 8; i++) {
+               writel(reg, csi2->regs1 + CSI2_CTX_IRQSTATUS(i));
+               if (enable)
+                       writel(readl(csi2->regs1 + CSI2_CTX_IRQENABLE(i)) | reg,
+                               csi2->regs1 + CSI2_CTX_IRQENABLE(i));
+               else
+                       writel(readl(csi2->regs1 + CSI2_CTX_IRQENABLE(i)) &
+                               ~reg,
+                               csi2->regs1 + CSI2_CTX_IRQENABLE(i));
+       }
+}
+
+/*
+ * csi2_irq_complexio1_set - Enables CSI2 ComplexIO IRQs.
+ * @enable: Enable/disable CSI2 ComplexIO #1 interrupts
+ */
+static void csi2_irq_complexio1_set(struct iss_csi2_device *csi2, int enable)
+{
+       u32 reg;
+       reg = CSI2_COMPLEXIO_IRQ_STATEALLULPMEXIT |
+               CSI2_COMPLEXIO_IRQ_STATEALLULPMENTER |
+               CSI2_COMPLEXIO_IRQ_STATEULPM5 |
+               CSI2_COMPLEXIO_IRQ_ERRCONTROL5 |
+               CSI2_COMPLEXIO_IRQ_ERRESC5 |
+               CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS5 |
+               CSI2_COMPLEXIO_IRQ_ERRSOTHS5 |
+               CSI2_COMPLEXIO_IRQ_STATEULPM4 |
+               CSI2_COMPLEXIO_IRQ_ERRCONTROL4 |
+               CSI2_COMPLEXIO_IRQ_ERRESC4 |
+               CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS4 |
+               CSI2_COMPLEXIO_IRQ_ERRSOTHS4 |
+               CSI2_COMPLEXIO_IRQ_STATEULPM3 |
+               CSI2_COMPLEXIO_IRQ_ERRCONTROL3 |
+               CSI2_COMPLEXIO_IRQ_ERRESC3 |
+               CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS3 |
+               CSI2_COMPLEXIO_IRQ_ERRSOTHS3 |
+               CSI2_COMPLEXIO_IRQ_STATEULPM2 |
+               CSI2_COMPLEXIO_IRQ_ERRCONTROL2 |
+               CSI2_COMPLEXIO_IRQ_ERRESC2 |
+               CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS2 |
+               CSI2_COMPLEXIO_IRQ_ERRSOTHS2 |
+               CSI2_COMPLEXIO_IRQ_STATEULPM1 |
+               CSI2_COMPLEXIO_IRQ_ERRCONTROL1 |
+               CSI2_COMPLEXIO_IRQ_ERRESC1 |
+               CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS1 |
+               CSI2_COMPLEXIO_IRQ_ERRSOTHS1;
+       writel(reg, csi2->regs1 + CSI2_COMPLEXIO_IRQSTATUS);
+       if (enable)
+               reg |= readl(csi2->regs1 + CSI2_COMPLEXIO_IRQENABLE);
+       else
+               reg = 0;
+       writel(reg, csi2->regs1 + CSI2_COMPLEXIO_IRQENABLE);
+}
+
+/*
+ * csi2_irq_status_set - Enables CSI2 Status IRQs.
+ * @enable: Enable/disable CSI2 Status interrupts
+ */
+static void csi2_irq_status_set(struct iss_csi2_device *csi2, int enable)
+{
+       u32 reg;
+       reg = CSI2_IRQ_OCP_ERR |
+               CSI2_IRQ_SHORT_PACKET |
+               CSI2_IRQ_ECC_CORRECTION |
+               CSI2_IRQ_ECC_NO_CORRECTION |
+               CSI2_IRQ_COMPLEXIO_ERR |
+               CSI2_IRQ_FIFO_OVF |
+               CSI2_IRQ_CONTEXT0;
+       writel(reg, csi2->regs1 + CSI2_IRQSTATUS);
+       if (enable)
+               reg |= readl(csi2->regs1 + CSI2_IRQENABLE);
+       else
+               reg = 0;
+
+       writel(reg, csi2->regs1 + CSI2_IRQENABLE);
+}
+
+/*
+ * omap4iss_csi2_reset - Resets the CSI2 module.
+ *
+ * Must be called with the phy lock held.
+ *
+ * Returns 0 if successful, or -EBUSY if power command didn't respond.
+ */
+int omap4iss_csi2_reset(struct iss_csi2_device *csi2)
+{
+       u8 soft_reset_retries = 0;
+       u32 reg;
+       int i;
+
+       if (!csi2->available)
+               return -ENODEV;
+
+       if (csi2->phy->phy_in_use)
+               return -EBUSY;
+
+       writel(readl(csi2->regs1 + CSI2_SYSCONFIG) |
+               CSI2_SYSCONFIG_SOFT_RESET,
+               csi2->regs1 + CSI2_SYSCONFIG);
+
+       do {
+               reg = readl(csi2->regs1 + CSI2_SYSSTATUS) &
+                                   CSI2_SYSSTATUS_RESET_DONE;
+               if (reg == CSI2_SYSSTATUS_RESET_DONE)
+                       break;
+               soft_reset_retries++;
+               if (soft_reset_retries < 5)
+                       usleep_range(100, 100);
+       } while (soft_reset_retries < 5);
+
+       if (soft_reset_retries == 5) {
+               printk(KERN_ERR "CSI2: Soft reset try count exceeded!\n");
+               return -EBUSY;
+       }
+
+       writel(readl(csi2->regs1 + CSI2_COMPLEXIO_CFG) |
+               CSI2_COMPLEXIO_CFG_RESET_CTRL,
+               csi2->regs1 + CSI2_COMPLEXIO_CFG);
+
+       i = 100;
+       do {
+               reg = readl(csi2->phy->phy_regs + REGISTER1)
+                   & REGISTER1_RESET_DONE_CTRLCLK;
+               if (reg == REGISTER1_RESET_DONE_CTRLCLK)
+                       break;
+               usleep_range(100, 100);
+       } while (--i > 0);
+
+       if (i == 0) {
+               printk(KERN_ERR
+                      "CSI2: Reset for CSI2_96M_FCLK domain Failed!\n");
+               return -EBUSY;
+       }
+
+       writel((readl(csi2->regs1 + CSI2_SYSCONFIG) &
+               ~(CSI2_SYSCONFIG_MSTANDBY_MODE_MASK |
+                 CSI2_SYSCONFIG_AUTO_IDLE)) |
+               CSI2_SYSCONFIG_MSTANDBY_MODE_NO,
+               csi2->regs1 + CSI2_SYSCONFIG);
+
+       return 0;
+}
+
+static int csi2_configure(struct iss_csi2_device *csi2)
+{
+       const struct iss_v4l2_subdevs_group *pdata;
+       struct iss_csi2_timing_cfg *timing = &csi2->timing[0];
+       struct v4l2_subdev *sensor;
+       struct media_pad *pad;
+
+       /*
+        * CSI2 fields that can be updated while the context has
+        * been enabled or the interface has been enabled are not
+        * updated dynamically currently. So we do not allow to
+        * reconfigure if either has been enabled
+        */
+       if (csi2->contexts[0].enabled || csi2->ctrl.if_enable)
+               return -EBUSY;
+
+       pad = media_entity_remote_pad(&csi2->pads[CSI2_PAD_SINK]);
+       sensor = media_entity_to_v4l2_subdev(pad->entity);
+       pdata = sensor->host_priv;
+
+       csi2->frame_skip = 0;
+       v4l2_subdev_call(sensor, sensor, g_skip_frames, &csi2->frame_skip);
+
+       csi2->ctrl.vp_out_ctrl = pdata->bus.csi2.vpclk_div;
+       csi2->ctrl.frame_mode = ISS_CSI2_FRAME_IMMEDIATE;
+       csi2->ctrl.ecc_enable = pdata->bus.csi2.crc;
+
+       timing->force_rx_mode = 1;
+       timing->stop_state_16x = 1;
+       timing->stop_state_4x = 1;
+       timing->stop_state_counter = 0x1FF;
+
+       /*
+        * The CSI2 receiver can't do any format conversion except DPCM
+        * decompression, so every set_format call configures both pads
+        * and enables DPCM decompression as a special case:
+        */
+       if (csi2->formats[CSI2_PAD_SINK].code !=
+           csi2->formats[CSI2_PAD_SOURCE].code)
+               csi2->dpcm_decompress = true;
+       else
+               csi2->dpcm_decompress = false;
+
+       csi2->contexts[0].format_id = csi2_ctx_map_format(csi2);
+
+       if (csi2->video_out.bpl_padding == 0)
+               csi2->contexts[0].data_offset = 0;
+       else
+               csi2->contexts[0].data_offset = csi2->video_out.bpl_value;
+
+       /*
+        * Enable end of frame and end of line signals generation for
+        * context 0. These signals are generated from CSI2 receiver to
+        * qualify the last pixel of a frame and the last pixel of a line.
+        * Without enabling the signals CSI2 receiver writes data to memory
+        * beyond buffer size and/or data line offset is not handled correctly.
+        */
+       csi2->contexts[0].eof_enabled = 1;
+       csi2->contexts[0].eol_enabled = 1;
+
+       csi2_irq_complexio1_set(csi2, 1);
+       csi2_irq_ctx_set(csi2, 1);
+       csi2_irq_status_set(csi2, 1);
+
+       /* Set configuration (timings, format and links) */
+       csi2_timing_config(csi2, timing);
+       csi2_recv_config(csi2, &csi2->ctrl);
+       csi2_ctx_config(csi2, &csi2->contexts[0]);
+
+       return 0;
+}
+
+/*
+ * csi2_print_status - Prints CSI2 debug information.
+ */
+#define CSI2_PRINT_REGISTER(iss, regs, name)\
+       dev_dbg(iss->dev, "###CSI2 " #name "=0x%08x\n", \
+               readl(regs + CSI2_##name))
+
+static void csi2_print_status(struct iss_csi2_device *csi2)
+{
+       struct iss_device *iss = csi2->iss;
+
+       if (!csi2->available)
+               return;
+
+       dev_dbg(iss->dev, "-------------CSI2 Register dump-------------\n");
+
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, SYSCONFIG);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, SYSSTATUS);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, IRQENABLE);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, IRQSTATUS);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, CTRL);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, DBG_H);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, COMPLEXIO_CFG);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, COMPLEXIO_IRQSTATUS);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, SHORT_PACKET);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, COMPLEXIO_IRQENABLE);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, DBG_P);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, TIMING);
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, CTX_CTRL1(0));
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, CTX_CTRL2(0));
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, CTX_DAT_OFST(0));
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, CTX_PING_ADDR(0));
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, CTX_PONG_ADDR(0));
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, CTX_IRQENABLE(0));
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, CTX_IRQSTATUS(0));
+       CSI2_PRINT_REGISTER(iss, csi2->regs1, CTX_CTRL3(0));
+
+       dev_dbg(iss->dev, "--------------------------------------------\n");
+}
+
+/* -----------------------------------------------------------------------------
+ * Interrupt handling
+ */
+
+/*
+ * csi2_isr_buffer - Does buffer handling at end-of-frame
+ * when writing to memory.
+ */
+static void csi2_isr_buffer(struct iss_csi2_device *csi2)
+{
+       struct iss_buffer *buffer;
+
+       csi2_ctx_enable(csi2, 0, 0);
+
+       buffer = omap4iss_video_buffer_next(&csi2->video_out);
+
+       /*
+        * Let video queue operation restart engine if there is an underrun
+        * condition.
+        */
+       if (buffer == NULL)
+               return;
+
+       csi2_set_outaddr(csi2, buffer->iss_addr);
+       csi2_ctx_enable(csi2, 0, 1);
+}
+
+static void csi2_isr_ctx(struct iss_csi2_device *csi2,
+                        struct iss_csi2_ctx_cfg *ctx)
+{
+       unsigned int n = ctx->ctxnum;
+       u32 status;
+
+       status = readl(csi2->regs1 + CSI2_CTX_IRQSTATUS(n));
+       writel(status, csi2->regs1 + CSI2_CTX_IRQSTATUS(n));
+
+       /* Propagate frame number */
+       if (status & CSI2_CTX_IRQ_FS) {
+               struct iss_pipeline *pipe =
+                                    to_iss_pipeline(&csi2->subdev.entity);
+               if (pipe->do_propagation)
+                       atomic_inc(&pipe->frame_number);
+       }
+
+       if (!(status & CSI2_CTX_IRQ_FE))
+               return;
+
+       /* Skip interrupts until we reach the frame skip count. The CSI2 will be
+        * automatically disabled, as the frame skip count has been programmed
+        * in the CSI2_CTx_CTRL1::COUNT field, so reenable it.
+        *
+        * It would have been nice to rely on the FRAME_NUMBER interrupt instead
+        * but it turned out that the interrupt is only generated when the CSI2
+        * writes to memory (the CSI2_CTx_CTRL1::COUNT field is decreased
+        * correctly and reaches 0 when data is forwarded to the video port only
+        * but no interrupt arrives). Maybe a CSI2 hardware bug.
+        */
+       if (csi2->frame_skip) {
+               csi2->frame_skip--;
+               if (csi2->frame_skip == 0) {
+                       ctx->format_id = csi2_ctx_map_format(csi2);
+                       csi2_ctx_config(csi2, ctx);
+                       csi2_ctx_enable(csi2, n, 1);
+               }
+               return;
+       }
+
+       if (csi2->output & CSI2_OUTPUT_MEMORY)
+               csi2_isr_buffer(csi2);
+}
+
+/*
+ * omap4iss_csi2_isr - CSI2 interrupt handling.
+ */
+void omap4iss_csi2_isr(struct iss_csi2_device *csi2)
+{
+       struct iss_pipeline *pipe = to_iss_pipeline(&csi2->subdev.entity);
+       u32 csi2_irqstatus, cpxio1_irqstatus;
+       struct iss_device *iss = csi2->iss;
+
+       if (!csi2->available)
+               return;
+
+       csi2_irqstatus = readl(csi2->regs1 + CSI2_IRQSTATUS);
+       writel(csi2_irqstatus, csi2->regs1 + CSI2_IRQSTATUS);
+
+       /* Failure Cases */
+       if (csi2_irqstatus & CSI2_IRQ_COMPLEXIO_ERR) {
+               cpxio1_irqstatus = readl(csi2->regs1 +
+                                        CSI2_COMPLEXIO_IRQSTATUS);
+               writel(cpxio1_irqstatus,
+                       csi2->regs1 + CSI2_COMPLEXIO_IRQSTATUS);
+               dev_dbg(iss->dev, "CSI2: ComplexIO Error IRQ "
+                       "%x\n", cpxio1_irqstatus);
+               pipe->error = true;
+       }
+
+       if (csi2_irqstatus & (CSI2_IRQ_OCP_ERR |
+                             CSI2_IRQ_SHORT_PACKET |
+                             CSI2_IRQ_ECC_NO_CORRECTION |
+                             CSI2_IRQ_COMPLEXIO_ERR |
+                             CSI2_IRQ_FIFO_OVF)) {
+               dev_dbg(iss->dev, "CSI2 Err:"
+                       " OCP:%d,"
+                       " Short_pack:%d,"
+                       " ECC:%d,"
+                       " CPXIO:%d,"
+                       " FIFO_OVF:%d,"
+                       "\n",
+                       (csi2_irqstatus &
+                        CSI2_IRQ_OCP_ERR) ? 1 : 0,
+                       (csi2_irqstatus &
+                        CSI2_IRQ_SHORT_PACKET) ? 1 : 0,
+                       (csi2_irqstatus &
+                        CSI2_IRQ_ECC_NO_CORRECTION) ? 1 : 0,
+                       (csi2_irqstatus &
+                        CSI2_IRQ_COMPLEXIO_ERR) ? 1 : 0,
+                       (csi2_irqstatus &
+                        CSI2_IRQ_FIFO_OVF) ? 1 : 0);
+               pipe->error = true;
+       }
+
+       if (omap4iss_module_sync_is_stopping(&csi2->wait, &csi2->stopping))
+               return;
+
+       /* Successful cases */
+       if (csi2_irqstatus & CSI2_IRQ_CONTEXT0)
+               csi2_isr_ctx(csi2, &csi2->contexts[0]);
+
+       if (csi2_irqstatus & CSI2_IRQ_ECC_CORRECTION)
+               dev_dbg(iss->dev, "CSI2: ECC correction done\n");
+}
+
+/* -----------------------------------------------------------------------------
+ * ISS video operations
+ */
+
+/*
+ * csi2_queue - Queues the first buffer when using memory output
+ * @video: The video node
+ * @buffer: buffer to queue
+ */
+static int csi2_queue(struct iss_video *video, struct iss_buffer *buffer)
+{
+       struct iss_csi2_device *csi2 = container_of(video,
+                               struct iss_csi2_device, video_out);
+
+       csi2_set_outaddr(csi2, buffer->iss_addr);
+
+       /*
+        * If streaming was enabled before there was a buffer queued
+        * or underrun happened in the ISR, the hardware was not enabled
+        * and DMA queue flag ISS_VIDEO_DMAQUEUE_UNDERRUN is still set.
+        * Enable it now.
+        */
+       if (csi2->video_out.dmaqueue_flags & ISS_VIDEO_DMAQUEUE_UNDERRUN) {
+               /* Enable / disable context 0 and IRQs */
+               csi2_if_enable(csi2, 1);
+               csi2_ctx_enable(csi2, 0, 1);
+               iss_video_dmaqueue_flags_clr(&csi2->video_out);
+       }
+
+       return 0;
+}
+
+static const struct iss_video_operations csi2_issvideo_ops = {
+       .queue = csi2_queue,
+};
+
+/* -----------------------------------------------------------------------------
+ * V4L2 subdev operations
+ */
+
+static struct v4l2_mbus_framefmt *
+__csi2_get_format(struct iss_csi2_device *csi2, struct v4l2_subdev_fh *fh,
+                 unsigned int pad, enum v4l2_subdev_format_whence which)
+{
+       if (which == V4L2_SUBDEV_FORMAT_TRY)
+               return v4l2_subdev_get_try_format(fh, pad);
+       else
+               return &csi2->formats[pad];
+}
+
+static void
+csi2_try_format(struct iss_csi2_device *csi2, struct v4l2_subdev_fh *fh,
+               unsigned int pad, struct v4l2_mbus_framefmt *fmt,
+               enum v4l2_subdev_format_whence which)
+{
+       enum v4l2_mbus_pixelcode pixelcode;
+       struct v4l2_mbus_framefmt *format;
+       const struct iss_format_info *info;
+       unsigned int i;
+
+       switch (pad) {
+       case CSI2_PAD_SINK:
+               /* Clamp the width and height to valid range (1-8191). */
+               for (i = 0; i < ARRAY_SIZE(csi2_input_fmts); i++) {
+                       if (fmt->code == csi2_input_fmts[i])
+                               break;
+               }
+
+               /* If not found, use SGRBG10 as default */
+               if (i >= ARRAY_SIZE(csi2_input_fmts))
+                       fmt->code = V4L2_MBUS_FMT_SGRBG10_1X10;
+
+               fmt->width = clamp_t(u32, fmt->width, 1, 8191);
+               fmt->height = clamp_t(u32, fmt->height, 1, 8191);
+               break;
+
+       case CSI2_PAD_SOURCE:
+               /* Source format same as sink format, except for DPCM
+                * compression.
+                */
+               pixelcode = fmt->code;
+               format = __csi2_get_format(csi2, fh, CSI2_PAD_SINK, which);
+               memcpy(fmt, format, sizeof(*fmt));
+
+               /*
+                * Only Allow DPCM decompression, and check that the
+                * pattern is preserved
+                */
+               info = omap4iss_video_format_info(fmt->code);
+               if (info->uncompressed == pixelcode)
+                       fmt->code = pixelcode;
+               break;
+       }
+
+       /* RGB, non-interlaced */
+       fmt->colorspace = V4L2_COLORSPACE_SRGB;
+       fmt->field = V4L2_FIELD_NONE;
+}
+
+/*
+ * csi2_enum_mbus_code - Handle pixel format enumeration
+ * @sd     : pointer to v4l2 subdev structure
+ * @fh     : V4L2 subdev file handle
+ * @code   : pointer to v4l2_subdev_mbus_code_enum structure
+ * return -EINVAL or zero on success
+ */
+static int csi2_enum_mbus_code(struct v4l2_subdev *sd,
+                              struct v4l2_subdev_fh *fh,
+                              struct v4l2_subdev_mbus_code_enum *code)
+{
+       struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt *format;
+       const struct iss_format_info *info;
+
+       if (code->pad == CSI2_PAD_SINK) {
+               if (code->index >= ARRAY_SIZE(csi2_input_fmts))
+                       return -EINVAL;
+
+               code->code = csi2_input_fmts[code->index];
+       } else {
+               format = __csi2_get_format(csi2, fh, CSI2_PAD_SINK,
+                                          V4L2_SUBDEV_FORMAT_TRY);
+               switch (code->index) {
+               case 0:
+                       /* Passthrough sink pad code */
+                       code->code = format->code;
+                       break;
+               case 1:
+                       /* Uncompressed code */
+                       info = omap4iss_video_format_info(format->code);
+                       if (info->uncompressed == format->code)
+                               return -EINVAL;
+
+                       code->code = info->uncompressed;
+                       break;
+               default:
+                       return -EINVAL;
+               }
+       }
+
+       return 0;
+}
+
+static int csi2_enum_frame_size(struct v4l2_subdev *sd,
+                               struct v4l2_subdev_fh *fh,
+                               struct v4l2_subdev_frame_size_enum *fse)
+{
+       struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt format;
+
+       if (fse->index != 0)
+               return -EINVAL;
+
+       format.code = fse->code;
+       format.width = 1;
+       format.height = 1;
+       csi2_try_format(csi2, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
+       fse->min_width = format.width;
+       fse->min_height = format.height;
+
+       if (format.code != fse->code)
+               return -EINVAL;
+
+       format.code = fse->code;
+       format.width = -1;
+       format.height = -1;
+       csi2_try_format(csi2, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
+       fse->max_width = format.width;
+       fse->max_height = format.height;
+
+       return 0;
+}
+
+/*
+ * csi2_get_format - Handle get format by pads subdev method
+ * @sd : pointer to v4l2 subdev structure
+ * @fh : V4L2 subdev file handle
+ * @fmt: pointer to v4l2 subdev format structure
+ * return -EINVAL or zero on success
+ */
+static int csi2_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
+                          struct v4l2_subdev_format *fmt)
+{
+       struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt *format;
+
+       format = __csi2_get_format(csi2, fh, fmt->pad, fmt->which);
+       if (format == NULL)
+               return -EINVAL;
+
+       fmt->format = *format;
+       return 0;
+}
+
+/*
+ * csi2_set_format - Handle set format by pads subdev method
+ * @sd : pointer to v4l2 subdev structure
+ * @fh : V4L2 subdev file handle
+ * @fmt: pointer to v4l2 subdev format structure
+ * return -EINVAL or zero on success
+ */
+static int csi2_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
+                          struct v4l2_subdev_format *fmt)
+{
+       struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt *format;
+
+       format = __csi2_get_format(csi2, fh, fmt->pad, fmt->which);
+       if (format == NULL)
+               return -EINVAL;
+
+       csi2_try_format(csi2, fh, fmt->pad, &fmt->format, fmt->which);
+       *format = fmt->format;
+
+       /* Propagate the format from sink to source */
+       if (fmt->pad == CSI2_PAD_SINK) {
+               format = __csi2_get_format(csi2, fh, CSI2_PAD_SOURCE,
+                                          fmt->which);
+               *format = fmt->format;
+               csi2_try_format(csi2, fh, CSI2_PAD_SOURCE, format, fmt->which);
+       }
+
+       return 0;
+}
+
+static int csi2_link_validate(struct v4l2_subdev *sd, struct media_link *link,
+                             struct v4l2_subdev_format *source_fmt,
+                             struct v4l2_subdev_format *sink_fmt)
+{
+       struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd);
+       struct iss_pipeline *pipe = to_iss_pipeline(&csi2->subdev.entity);
+       int rval;
+
+       pipe->external = media_entity_to_v4l2_subdev(link->source->entity);
+       rval = omap4iss_get_external_info(pipe, link);
+       if (rval < 0)
+               return rval;
+
+       return v4l2_subdev_link_validate_default(sd, link, source_fmt,
+                                                sink_fmt);
+}
+
+/*
+ * csi2_init_formats - Initialize formats on all pads
+ * @sd: ISS CSI2 V4L2 subdevice
+ * @fh: V4L2 subdev file handle
+ *
+ * Initialize all pad formats with default values. If fh is not NULL, try
+ * formats are initialized on the file handle. Otherwise active formats are
+ * initialized on the device.
+ */
+static int csi2_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+       struct v4l2_subdev_format format;
+
+       memset(&format, 0, sizeof(format));
+       format.pad = CSI2_PAD_SINK;
+       format.which = fh ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE;
+       format.format.code = V4L2_MBUS_FMT_SGRBG10_1X10;
+       format.format.width = 4096;
+       format.format.height = 4096;
+       csi2_set_format(sd, fh, &format);
+
+       return 0;
+}
+
+/*
+ * csi2_set_stream - Enable/Disable streaming on the CSI2 module
+ * @sd: ISS CSI2 V4L2 subdevice
+ * @enable: ISS pipeline stream state
+ *
+ * Return 0 on success or a negative error code otherwise.
+ */
+static int csi2_set_stream(struct v4l2_subdev *sd, int enable)
+{
+       struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd);
+       struct iss_device *iss = csi2->iss;
+       struct iss_pipeline *pipe = to_iss_pipeline(&csi2->subdev.entity);
+       struct iss_video *video_out = &csi2->video_out;
+
+       if (csi2->state == ISS_PIPELINE_STREAM_STOPPED) {
+               if (enable == ISS_PIPELINE_STREAM_STOPPED)
+                       return 0;
+
+               if (csi2 == &iss->csi2a)
+                       omap4iss_subclk_enable(iss, OMAP4_ISS_SUBCLK_CSI2_A);
+               else if (csi2 == &iss->csi2b)
+                       omap4iss_subclk_enable(iss, OMAP4_ISS_SUBCLK_CSI2_B);
+       }
+
+       switch (enable) {
+       case ISS_PIPELINE_STREAM_CONTINUOUS: {
+               int ret;
+
+               ret = omap4iss_csiphy_config(iss, sd);
+               if (ret < 0)
+                       return ret;
+
+               if (omap4iss_csiphy_acquire(csi2->phy) < 0)
+                       return -ENODEV;
+               csi2->use_fs_irq = pipe->do_propagation;
+               csi2_configure(csi2);
+               csi2_print_status(csi2);
+
+               /*
+                * When outputting to memory with no buffer available, let the
+                * buffer queue handler start the hardware. A DMA queue flag
+                * ISS_VIDEO_DMAQUEUE_QUEUED will be set as soon as there is
+                * a buffer available.
+                */
+               if (csi2->output & CSI2_OUTPUT_MEMORY &&
+                   !(video_out->dmaqueue_flags & ISS_VIDEO_DMAQUEUE_QUEUED))
+                       break;
+               /* Enable context 0 and IRQs */
+               atomic_set(&csi2->stopping, 0);
+               csi2_ctx_enable(csi2, 0, 1);
+               csi2_if_enable(csi2, 1);
+               iss_video_dmaqueue_flags_clr(video_out);
+               break;
+       }
+       case ISS_PIPELINE_STREAM_STOPPED:
+               if (csi2->state == ISS_PIPELINE_STREAM_STOPPED)
+                       return 0;
+               if (omap4iss_module_sync_idle(&sd->entity, &csi2->wait,
+                                             &csi2->stopping))
+                       dev_dbg(iss->dev, "%s: module stop timeout.\n",
+                               sd->name);
+               csi2_ctx_enable(csi2, 0, 0);
+               csi2_if_enable(csi2, 0);
+               csi2_irq_ctx_set(csi2, 0);
+               omap4iss_csiphy_release(csi2->phy);
+               if (csi2 == &iss->csi2a)
+                       omap4iss_subclk_disable(iss, OMAP4_ISS_SUBCLK_CSI2_A);
+               else if (csi2 == &iss->csi2b)
+                       omap4iss_subclk_disable(iss, OMAP4_ISS_SUBCLK_CSI2_B);
+               iss_video_dmaqueue_flags_clr(video_out);
+               break;
+       }
+
+       csi2->state = enable;
+       return 0;
+}
+
+/* subdev video operations */
+static const struct v4l2_subdev_video_ops csi2_video_ops = {
+       .s_stream = csi2_set_stream,
+};
+
+/* subdev pad operations */
+static const struct v4l2_subdev_pad_ops csi2_pad_ops = {
+       .enum_mbus_code = csi2_enum_mbus_code,
+       .enum_frame_size = csi2_enum_frame_size,
+       .get_fmt = csi2_get_format,
+       .set_fmt = csi2_set_format,
+       .link_validate = csi2_link_validate,
+};
+
+/* subdev operations */
+static const struct v4l2_subdev_ops csi2_ops = {
+       .video = &csi2_video_ops,
+       .pad = &csi2_pad_ops,
+};
+
+/* subdev internal operations */
+static const struct v4l2_subdev_internal_ops csi2_internal_ops = {
+       .open = csi2_init_formats,
+};
+
+/* -----------------------------------------------------------------------------
+ * Media entity operations
+ */
+
+/*
+ * csi2_link_setup - Setup CSI2 connections.
+ * @entity : Pointer to media entity structure
+ * @local  : Pointer to local pad array
+ * @remote : Pointer to remote pad array
+ * @flags  : Link flags
+ * return -EINVAL or zero on success
+ */
+static int csi2_link_setup(struct media_entity *entity,
+                          const struct media_pad *local,
+                          const struct media_pad *remote, u32 flags)
+{
+       struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
+       struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd);
+       struct iss_csi2_ctrl_cfg *ctrl = &csi2->ctrl;
+
+       /*
+        * The ISS core doesn't support pipelines with multiple video outputs.
+        * Revisit this when it will be implemented, and return -EBUSY for now.
+        */
+
+       switch (local->index | media_entity_type(remote->entity)) {
+       case CSI2_PAD_SOURCE | MEDIA_ENT_T_DEVNODE:
+               if (flags & MEDIA_LNK_FL_ENABLED) {
+                       if (csi2->output & ~CSI2_OUTPUT_MEMORY)
+                               return -EBUSY;
+                       csi2->output |= CSI2_OUTPUT_MEMORY;
+               } else {
+                       csi2->output &= ~CSI2_OUTPUT_MEMORY;
+               }
+               break;
+
+       case CSI2_PAD_SOURCE | MEDIA_ENT_T_V4L2_SUBDEV:
+               if (flags & MEDIA_LNK_FL_ENABLED) {
+                       if (csi2->output & ~CSI2_OUTPUT_IPIPEIF)
+                               return -EBUSY;
+                       csi2->output |= CSI2_OUTPUT_IPIPEIF;
+               } else {
+                       csi2->output &= ~CSI2_OUTPUT_IPIPEIF;
+               }
+               break;
+
+       default:
+               /* Link from camera to CSI2 is fixed... */
+               return -EINVAL;
+       }
+
+       ctrl->vp_only_enable =
+               (csi2->output & CSI2_OUTPUT_MEMORY) ? false : true;
+       ctrl->vp_clk_enable = !!(csi2->output & CSI2_OUTPUT_IPIPEIF);
+
+       return 0;
+}
+
+/* media operations */
+static const struct media_entity_operations csi2_media_ops = {
+       .link_setup = csi2_link_setup,
+       .link_validate = v4l2_subdev_link_validate,
+};
+
+void omap4iss_csi2_unregister_entities(struct iss_csi2_device *csi2)
+{
+       v4l2_device_unregister_subdev(&csi2->subdev);
+       omap4iss_video_unregister(&csi2->video_out);
+}
+
+int omap4iss_csi2_register_entities(struct iss_csi2_device *csi2,
+                                   struct v4l2_device *vdev)
+{
+       int ret;
+
+       /* Register the subdev and video nodes. */
+       ret = v4l2_device_register_subdev(vdev, &csi2->subdev);
+       if (ret < 0)
+               goto error;
+
+       ret = omap4iss_video_register(&csi2->video_out, vdev);
+       if (ret < 0)
+               goto error;
+
+       return 0;
+
+error:
+       omap4iss_csi2_unregister_entities(csi2);
+       return ret;
+}
+
+/* -----------------------------------------------------------------------------
+ * ISS CSI2 initialisation and cleanup
+ */
+
+/*
+ * csi2_init_entities - Initialize subdev and media entity.
+ * @csi2: Pointer to csi2 structure.
+ * return -ENOMEM or zero on success
+ */
+static int csi2_init_entities(struct iss_csi2_device *csi2, const char *subname)
+{
+       struct v4l2_subdev *sd = &csi2->subdev;
+       struct media_pad *pads = csi2->pads;
+       struct media_entity *me = &sd->entity;
+       int ret;
+       char name[V4L2_SUBDEV_NAME_SIZE];
+
+       v4l2_subdev_init(sd, &csi2_ops);
+       sd->internal_ops = &csi2_internal_ops;
+       sprintf(name, "CSI2%s", subname);
+       strlcpy(sd->name, "", sizeof(sd->name));
+       sprintf(sd->name, "OMAP4 ISS %s", name);
+
+       sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
+       v4l2_set_subdevdata(sd, csi2);
+       sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+
+       pads[CSI2_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
+       pads[CSI2_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
+
+       me->ops = &csi2_media_ops;
+       ret = media_entity_init(me, CSI2_PADS_NUM, pads, 0);
+       if (ret < 0)
+               return ret;
+
+       csi2_init_formats(sd, NULL);
+
+       /* Video device node */
+       csi2->video_out.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+       csi2->video_out.ops = &csi2_issvideo_ops;
+       csi2->video_out.bpl_alignment = 32;
+       csi2->video_out.bpl_zero_padding = 1;
+       csi2->video_out.bpl_max = 0x1ffe0;
+       csi2->video_out.iss = csi2->iss;
+       csi2->video_out.capture_mem = PAGE_ALIGN(4096 * 4096) * 3;
+
+       ret = omap4iss_video_init(&csi2->video_out, name);
+       if (ret < 0)
+               goto error_video;
+
+       /* Connect the CSI2 subdev to the video node. */
+       ret = media_entity_create_link(&csi2->subdev.entity, CSI2_PAD_SOURCE,
+                                      &csi2->video_out.video.entity, 0, 0);
+       if (ret < 0)
+               goto error_link;
+
+       return 0;
+
+error_link:
+       omap4iss_video_cleanup(&csi2->video_out);
+error_video:
+       media_entity_cleanup(&csi2->subdev.entity);
+       return ret;
+}
+
+/*
+ * omap4iss_csi2_init - Routine for module driver init
+ */
+int omap4iss_csi2_init(struct iss_device *iss)
+{
+       struct iss_csi2_device *csi2a = &iss->csi2a;
+       struct iss_csi2_device *csi2b = &iss->csi2b;
+       int ret;
+
+       csi2a->iss = iss;
+       csi2a->available = 1;
+       csi2a->regs1 = iss->regs[OMAP4_ISS_MEM_CSI2_A_REGS1];
+       csi2a->phy = &iss->csiphy1;
+       csi2a->state = ISS_PIPELINE_STREAM_STOPPED;
+       init_waitqueue_head(&csi2a->wait);
+
+       ret = csi2_init_entities(csi2a, "a");
+       if (ret < 0)
+               return ret;
+
+       csi2b->iss = iss;
+       csi2b->available = 1;
+       csi2b->regs1 = iss->regs[OMAP4_ISS_MEM_CSI2_B_REGS1];
+       csi2b->phy = &iss->csiphy2;
+       csi2b->state = ISS_PIPELINE_STREAM_STOPPED;
+       init_waitqueue_head(&csi2b->wait);
+
+       ret = csi2_init_entities(csi2b, "b");
+       if (ret < 0)
+               return ret;
+
+       return 0;
+}
+
+/*
+ * omap4iss_csi2_cleanup - Routine for module driver cleanup
+ */
+void omap4iss_csi2_cleanup(struct iss_device *iss)
+{
+       struct iss_csi2_device *csi2a = &iss->csi2a;
+       struct iss_csi2_device *csi2b = &iss->csi2b;
+
+       omap4iss_video_cleanup(&csi2a->video_out);
+       media_entity_cleanup(&csi2a->subdev.entity);
+
+       omap4iss_video_cleanup(&csi2b->video_out);
+       media_entity_cleanup(&csi2b->subdev.entity);
+}
diff --git a/drivers/staging/media/omap4iss/iss_csi2.h b/drivers/staging/media/omap4iss/iss_csi2.h
new file mode 100644 (file)
index 0000000..d1d077b
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - CSI2 module
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#ifndef OMAP4_ISS_CSI2_H
+#define OMAP4_ISS_CSI2_H
+
+#include <linux/types.h>
+#include <linux/videodev2.h>
+
+#include "iss_video.h"
+
+struct iss_csiphy;
+
+/* This is not an exhaustive list */
+enum iss_csi2_pix_formats {
+       CSI2_PIX_FMT_OTHERS = 0,
+       CSI2_PIX_FMT_YUV422_8BIT = 0x1e,
+       CSI2_PIX_FMT_YUV422_8BIT_VP = 0x9e,
+       CSI2_PIX_FMT_YUV422_8BIT_VP16 = 0xde,
+       CSI2_PIX_FMT_RAW10_EXP16 = 0xab,
+       CSI2_PIX_FMT_RAW10_EXP16_VP = 0x12f,
+       CSI2_PIX_FMT_RAW8 = 0x2a,
+       CSI2_PIX_FMT_RAW8_DPCM10_EXP16 = 0x2aa,
+       CSI2_PIX_FMT_RAW8_DPCM10_VP = 0x32a,
+       CSI2_PIX_FMT_RAW8_VP = 0x12a,
+       CSI2_USERDEF_8BIT_DATA1_DPCM10_VP = 0x340,
+       CSI2_USERDEF_8BIT_DATA1_DPCM10 = 0x2c0,
+       CSI2_USERDEF_8BIT_DATA1 = 0x40,
+};
+
+enum iss_csi2_irqevents {
+       OCP_ERR_IRQ = 0x4000,
+       SHORT_PACKET_IRQ = 0x2000,
+       ECC_CORRECTION_IRQ = 0x1000,
+       ECC_NO_CORRECTION_IRQ = 0x800,
+       COMPLEXIO2_ERR_IRQ = 0x400,
+       COMPLEXIO1_ERR_IRQ = 0x200,
+       FIFO_OVF_IRQ = 0x100,
+       CONTEXT7 = 0x80,
+       CONTEXT6 = 0x40,
+       CONTEXT5 = 0x20,
+       CONTEXT4 = 0x10,
+       CONTEXT3 = 0x8,
+       CONTEXT2 = 0x4,
+       CONTEXT1 = 0x2,
+       CONTEXT0 = 0x1,
+};
+
+enum iss_csi2_ctx_irqevents {
+       CTX_ECC_CORRECTION = 0x100,
+       CTX_LINE_NUMBER = 0x80,
+       CTX_FRAME_NUMBER = 0x40,
+       CTX_CS = 0x20,
+       CTX_LE = 0x8,
+       CTX_LS = 0x4,
+       CTX_FE = 0x2,
+       CTX_FS = 0x1,
+};
+
+enum iss_csi2_frame_mode {
+       ISS_CSI2_FRAME_IMMEDIATE,
+       ISS_CSI2_FRAME_AFTERFEC,
+};
+
+#define ISS_CSI2_MAX_CTX_NUM   7
+
+struct iss_csi2_ctx_cfg {
+       u8 ctxnum;              /* context number 0 - 7 */
+       u8 dpcm_decompress;
+
+       /* Fields in CSI2_CTx_CTRL2 - locked by CSI2_CTx_CTRL1.CTX_EN */
+       u8 virtual_id;
+       u16 format_id;          /* as in CSI2_CTx_CTRL2[9:0] */
+       u8 dpcm_predictor;      /* 1: simple, 0: advanced */
+
+       /* Fields in CSI2_CTx_CTRL1/3 - Shadowed */
+       u16 alpha;
+       u16 data_offset;
+       u32 ping_addr;
+       u32 pong_addr;
+       u8 eof_enabled;
+       u8 eol_enabled;
+       u8 checksum_enabled;
+       u8 enabled;
+};
+
+struct iss_csi2_timing_cfg {
+       u8 ionum;                       /* IO1 or IO2 as in CSI2_TIMING */
+       unsigned force_rx_mode:1;
+       unsigned stop_state_16x:1;
+       unsigned stop_state_4x:1;
+       u16 stop_state_counter;
+};
+
+struct iss_csi2_ctrl_cfg {
+       bool vp_clk_enable;
+       bool vp_only_enable;
+       u8 vp_out_ctrl;
+       enum iss_csi2_frame_mode frame_mode;
+       bool ecc_enable;
+       bool if_enable;
+};
+
+#define CSI2_PAD_SINK          0
+#define CSI2_PAD_SOURCE                1
+#define CSI2_PADS_NUM          2
+
+#define CSI2_OUTPUT_IPIPEIF    (1 << 0)
+#define CSI2_OUTPUT_MEMORY     (1 << 1)
+
+struct iss_csi2_device {
+       struct v4l2_subdev subdev;
+       struct media_pad pads[CSI2_PADS_NUM];
+       struct v4l2_mbus_framefmt formats[CSI2_PADS_NUM];
+
+       struct iss_video video_out;
+       struct iss_device *iss;
+
+       u8 available;           /* Is the IP present on the silicon? */
+
+       /* Pointer to register remaps into kernel space */
+       void __iomem *regs1;
+       void __iomem *regs2;
+
+       u32 output; /* output to IPIPEIF, memory or both? */
+       bool dpcm_decompress;
+       unsigned int frame_skip;
+       bool use_fs_irq;
+
+       struct iss_csiphy *phy;
+       struct iss_csi2_ctx_cfg contexts[ISS_CSI2_MAX_CTX_NUM + 1];
+       struct iss_csi2_timing_cfg timing[2];
+       struct iss_csi2_ctrl_cfg ctrl;
+       enum iss_pipeline_stream_state state;
+       wait_queue_head_t wait;
+       atomic_t stopping;
+};
+
+void omap4iss_csi2_isr(struct iss_csi2_device *csi2);
+int omap4iss_csi2_reset(struct iss_csi2_device *csi2);
+int omap4iss_csi2_init(struct iss_device *iss);
+void omap4iss_csi2_cleanup(struct iss_device *iss);
+void omap4iss_csi2_unregister_entities(struct iss_csi2_device *csi2);
+int omap4iss_csi2_register_entities(struct iss_csi2_device *csi2,
+                                   struct v4l2_device *vdev);
+#endif /* OMAP4_ISS_CSI2_H */
diff --git a/drivers/staging/media/omap4iss/iss_csiphy.c b/drivers/staging/media/omap4iss/iss_csiphy.c
new file mode 100644 (file)
index 0000000..2afea98
--- /dev/null
@@ -0,0 +1,278 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - CSI PHY module
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#include <linux/delay.h>
+#include <linux/device.h>
+
+#include "../../../../arch/arm/mach-omap2/control.h"
+
+#include "iss.h"
+#include "iss_regs.h"
+#include "iss_csiphy.h"
+
+/*
+ * csiphy_lanes_config - Configuration of CSIPHY lanes.
+ *
+ * Updates HW configuration.
+ * Called with phy->mutex taken.
+ */
+static void csiphy_lanes_config(struct iss_csiphy *phy)
+{
+       unsigned int i;
+       u32 reg;
+
+       reg = readl(phy->cfg_regs + CSI2_COMPLEXIO_CFG);
+
+       for (i = 0; i < phy->max_data_lanes; i++) {
+               reg &= ~(CSI2_COMPLEXIO_CFG_DATA_POL(i + 1) |
+                        CSI2_COMPLEXIO_CFG_DATA_POSITION_MASK(i + 1));
+               reg |= (phy->lanes.data[i].pol ?
+                       CSI2_COMPLEXIO_CFG_DATA_POL(i + 1) : 0);
+               reg |= (phy->lanes.data[i].pos <<
+                       CSI2_COMPLEXIO_CFG_DATA_POSITION_SHIFT(i + 1));
+       }
+
+       reg &= ~(CSI2_COMPLEXIO_CFG_CLOCK_POL |
+                CSI2_COMPLEXIO_CFG_CLOCK_POSITION_MASK);
+       reg |= phy->lanes.clk.pol ? CSI2_COMPLEXIO_CFG_CLOCK_POL : 0;
+       reg |= phy->lanes.clk.pos << CSI2_COMPLEXIO_CFG_CLOCK_POSITION_SHIFT;
+
+       writel(reg, phy->cfg_regs + CSI2_COMPLEXIO_CFG);
+}
+
+/*
+ * csiphy_set_power
+ * @power: Power state to be set.
+ *
+ * Returns 0 if successful, or -EBUSY if the retry count is exceeded.
+ */
+static int csiphy_set_power(struct iss_csiphy *phy, u32 power)
+{
+       u32 reg;
+       u8 retry_count;
+
+       writel((readl(phy->cfg_regs + CSI2_COMPLEXIO_CFG) &
+               ~CSI2_COMPLEXIO_CFG_PWD_CMD_MASK) |
+               power,
+               phy->cfg_regs + CSI2_COMPLEXIO_CFG);
+
+       retry_count = 0;
+       do {
+               udelay(1);
+               reg = readl(phy->cfg_regs + CSI2_COMPLEXIO_CFG) &
+                               CSI2_COMPLEXIO_CFG_PWD_STATUS_MASK;
+
+               if (reg != power >> 2)
+                       retry_count++;
+
+       } while ((reg != power >> 2) && (retry_count < 250));
+
+       if (retry_count == 250) {
+               printk(KERN_ERR "CSI2 CIO set power failed!\n");
+               return -EBUSY;
+       }
+
+       return 0;
+}
+
+/*
+ * csiphy_dphy_config - Configure CSI2 D-PHY parameters.
+ *
+ * Called with phy->mutex taken.
+ */
+static void csiphy_dphy_config(struct iss_csiphy *phy)
+{
+       u32 reg;
+
+       /* Set up REGISTER0 */
+       reg = phy->dphy.ths_term << REGISTER0_THS_TERM_SHIFT;
+       reg |= phy->dphy.ths_settle << REGISTER0_THS_SETTLE_SHIFT;
+
+       writel(reg, phy->phy_regs + REGISTER0);
+
+       /* Set up REGISTER1 */
+       reg = phy->dphy.tclk_term << REGISTER1_TCLK_TERM_SHIFT;
+       reg |= phy->dphy.tclk_miss << REGISTER1_CTRLCLK_DIV_FACTOR_SHIFT;
+       reg |= phy->dphy.tclk_settle << REGISTER1_TCLK_SETTLE_SHIFT;
+       reg |= 0xB8 << REGISTER1_DPHY_HS_SYNC_PATTERN_SHIFT;
+
+       writel(reg, phy->phy_regs + REGISTER1);
+}
+
+/*
+ * TCLK values are OK at their reset values
+ */
+#define TCLK_TERM      0
+#define TCLK_MISS      1
+#define TCLK_SETTLE    14
+
+int omap4iss_csiphy_config(struct iss_device *iss,
+                          struct v4l2_subdev *csi2_subdev)
+{
+       struct iss_csi2_device *csi2 = v4l2_get_subdevdata(csi2_subdev);
+       struct iss_pipeline *pipe = to_iss_pipeline(&csi2_subdev->entity);
+       struct iss_v4l2_subdevs_group *subdevs = pipe->external->host_priv;
+       struct iss_csiphy_dphy_cfg csi2phy;
+       int csi2_ddrclk_khz;
+       struct iss_csiphy_lanes_cfg *lanes;
+       unsigned int used_lanes = 0;
+       u32 cam_rx_ctrl;
+       unsigned int i;
+
+       lanes = &subdevs->bus.csi2.lanecfg;
+
+       /*
+        * SCM.CONTROL_CAMERA_RX
+        * - bit [31] : CSIPHY2 lane 2 enable (4460+ only)
+        * - bit [30:29] : CSIPHY2 per-lane enable (1 to 0)
+        * - bit [28:24] : CSIPHY1 per-lane enable (4 to 0)
+        * - bit [21] : CSIPHY2 CTRLCLK enable
+        * - bit [20:19] : CSIPHY2 config: 00 d-phy, 01/10 ccp2
+        * - bit [18] : CSIPHY1 CTRLCLK enable
+        * - bit [17:16] : CSIPHY1 config: 00 d-phy, 01/10 ccp2
+        */
+       cam_rx_ctrl = omap4_ctrl_pad_readl(
+                       OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_CAMERA_RX);
+
+
+       if (subdevs->interface == ISS_INTERFACE_CSI2A_PHY1) {
+               cam_rx_ctrl &= ~(OMAP4_CAMERARX_CSI21_LANEENABLE_MASK |
+                               OMAP4_CAMERARX_CSI21_CAMMODE_MASK);
+               /* NOTE: Leave CSIPHY1 config to 0x0: D-PHY mode */
+               /* Enable all lanes for now */
+               cam_rx_ctrl |=
+                       0x1F << OMAP4_CAMERARX_CSI21_LANEENABLE_SHIFT;
+               /* Enable CTRLCLK */
+               cam_rx_ctrl |= OMAP4_CAMERARX_CSI21_CTRLCLKEN_MASK;
+       }
+
+       if (subdevs->interface == ISS_INTERFACE_CSI2B_PHY2) {
+               cam_rx_ctrl &= ~(OMAP4_CAMERARX_CSI22_LANEENABLE_MASK |
+                               OMAP4_CAMERARX_CSI22_CAMMODE_MASK);
+               /* NOTE: Leave CSIPHY2 config to 0x0: D-PHY mode */
+               /* Enable all lanes for now */
+               cam_rx_ctrl |=
+                       0x3 << OMAP4_CAMERARX_CSI22_LANEENABLE_SHIFT;
+               /* Enable CTRLCLK */
+               cam_rx_ctrl |= OMAP4_CAMERARX_CSI22_CTRLCLKEN_MASK;
+       }
+
+       omap4_ctrl_pad_writel(cam_rx_ctrl,
+                OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_CAMERA_RX);
+
+       /* Reset used lane count */
+       csi2->phy->used_data_lanes = 0;
+
+       /* Clock and data lanes verification */
+       for (i = 0; i < csi2->phy->max_data_lanes; i++) {
+               if (lanes->data[i].pos == 0)
+                       continue;
+
+               if (lanes->data[i].pol > 1 || lanes->data[i].pos > (csi2->phy->max_data_lanes + 1))
+                       return -EINVAL;
+
+               if (used_lanes & (1 << lanes->data[i].pos))
+                       return -EINVAL;
+
+               used_lanes |= 1 << lanes->data[i].pos;
+               csi2->phy->used_data_lanes++;
+       }
+
+       if (lanes->clk.pol > 1 || lanes->clk.pos > (csi2->phy->max_data_lanes + 1))
+               return -EINVAL;
+
+       if (lanes->clk.pos == 0 || used_lanes & (1 << lanes->clk.pos))
+               return -EINVAL;
+
+       csi2_ddrclk_khz = pipe->external_rate / 1000
+               / (2 * csi2->phy->used_data_lanes)
+               * pipe->external_bpp;
+
+       /*
+        * THS_TERM: Programmed value = ceil(12.5 ns/DDRClk period) - 1.
+        * THS_SETTLE: Programmed value = ceil(90 ns/DDRClk period) + 3.
+        */
+       csi2phy.ths_term = DIV_ROUND_UP(25 * csi2_ddrclk_khz, 2000000) - 1;
+       csi2phy.ths_settle = DIV_ROUND_UP(90 * csi2_ddrclk_khz, 1000000) + 3;
+       csi2phy.tclk_term = TCLK_TERM;
+       csi2phy.tclk_miss = TCLK_MISS;
+       csi2phy.tclk_settle = TCLK_SETTLE;
+
+       mutex_lock(&csi2->phy->mutex);
+       csi2->phy->dphy = csi2phy;
+       csi2->phy->lanes = *lanes;
+       mutex_unlock(&csi2->phy->mutex);
+
+       return 0;
+}
+
+int omap4iss_csiphy_acquire(struct iss_csiphy *phy)
+{
+       int rval;
+
+       mutex_lock(&phy->mutex);
+
+       rval = omap4iss_csi2_reset(phy->csi2);
+       if (rval)
+               goto done;
+
+       csiphy_dphy_config(phy);
+       csiphy_lanes_config(phy);
+
+       rval = csiphy_set_power(phy, CSI2_COMPLEXIO_CFG_PWD_CMD_ON);
+       if (rval)
+               goto done;
+
+       phy->phy_in_use = 1;
+
+done:
+       mutex_unlock(&phy->mutex);
+       return rval;
+}
+
+void omap4iss_csiphy_release(struct iss_csiphy *phy)
+{
+       mutex_lock(&phy->mutex);
+       if (phy->phy_in_use) {
+               csiphy_set_power(phy, CSI2_COMPLEXIO_CFG_PWD_CMD_OFF);
+               phy->phy_in_use = 0;
+       }
+       mutex_unlock(&phy->mutex);
+}
+
+/*
+ * omap4iss_csiphy_init - Initialize the CSI PHY frontends
+ */
+int omap4iss_csiphy_init(struct iss_device *iss)
+{
+       struct iss_csiphy *phy1 = &iss->csiphy1;
+       struct iss_csiphy *phy2 = &iss->csiphy2;
+
+       phy1->iss = iss;
+       phy1->csi2 = &iss->csi2a;
+       phy1->max_data_lanes = ISS_CSIPHY1_NUM_DATA_LANES;
+       phy1->used_data_lanes = 0;
+       phy1->cfg_regs = iss->regs[OMAP4_ISS_MEM_CSI2_A_REGS1];
+       phy1->phy_regs = iss->regs[OMAP4_ISS_MEM_CAMERARX_CORE1];
+       mutex_init(&phy1->mutex);
+
+       phy2->iss = iss;
+       phy2->csi2 = &iss->csi2b;
+       phy2->max_data_lanes = ISS_CSIPHY2_NUM_DATA_LANES;
+       phy2->used_data_lanes = 0;
+       phy2->cfg_regs = iss->regs[OMAP4_ISS_MEM_CSI2_B_REGS1];
+       phy2->phy_regs = iss->regs[OMAP4_ISS_MEM_CAMERARX_CORE2];
+       mutex_init(&phy2->mutex);
+
+       return 0;
+}
diff --git a/drivers/staging/media/omap4iss/iss_csiphy.h b/drivers/staging/media/omap4iss/iss_csiphy.h
new file mode 100644 (file)
index 0000000..df63eda
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - CSI PHY module
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#ifndef OMAP4_ISS_CSI_PHY_H
+#define OMAP4_ISS_CSI_PHY_H
+
+#include <media/omap4iss.h>
+
+struct iss_csi2_device;
+
+struct iss_csiphy_dphy_cfg {
+       u8 ths_term;
+       u8 ths_settle;
+       u8 tclk_term;
+       unsigned tclk_miss:1;
+       u8 tclk_settle;
+};
+
+struct iss_csiphy {
+       struct iss_device *iss;
+       struct mutex mutex;     /* serialize csiphy configuration */
+       u8 phy_in_use;
+       struct iss_csi2_device *csi2;
+
+       /* Pointer to register remaps into kernel space */
+       void __iomem *cfg_regs;
+       void __iomem *phy_regs;
+
+       u8 max_data_lanes;      /* number of CSI2 Data Lanes supported */
+       u8 used_data_lanes;     /* number of CSI2 Data Lanes used */
+       struct iss_csiphy_lanes_cfg lanes;
+       struct iss_csiphy_dphy_cfg dphy;
+};
+
+int omap4iss_csiphy_config(struct iss_device *iss,
+                          struct v4l2_subdev *csi2_subdev);
+int omap4iss_csiphy_acquire(struct iss_csiphy *phy);
+void omap4iss_csiphy_release(struct iss_csiphy *phy);
+int omap4iss_csiphy_init(struct iss_device *iss);
+
+#endif /* OMAP4_ISS_CSI_PHY_H */
diff --git a/drivers/staging/media/omap4iss/iss_ipipe.c b/drivers/staging/media/omap4iss/iss_ipipe.c
new file mode 100644 (file)
index 0000000..fc38a5c
--- /dev/null
@@ -0,0 +1,581 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - ISP IPIPE module
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#include <linux/module.h>
+#include <linux/uaccess.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/dma-mapping.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+
+#include "iss.h"
+#include "iss_regs.h"
+#include "iss_ipipe.h"
+
+static struct v4l2_mbus_framefmt *
+__ipipe_get_format(struct iss_ipipe_device *ipipe, struct v4l2_subdev_fh *fh,
+                 unsigned int pad, enum v4l2_subdev_format_whence which);
+
+static const unsigned int ipipe_fmts[] = {
+       V4L2_MBUS_FMT_SGRBG10_1X10,
+       V4L2_MBUS_FMT_SRGGB10_1X10,
+       V4L2_MBUS_FMT_SBGGR10_1X10,
+       V4L2_MBUS_FMT_SGBRG10_1X10,
+};
+
+/*
+ * ipipe_print_status - Print current IPIPE Module register values.
+ * @ipipe: Pointer to ISS ISP IPIPE device.
+ *
+ * Also prints other debug information stored in the IPIPE module.
+ */
+#define IPIPE_PRINT_REGISTER(iss, name)\
+       dev_dbg(iss->dev, "###IPIPE " #name "=0x%08x\n", \
+               readl(iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_##name))
+
+static void ipipe_print_status(struct iss_ipipe_device *ipipe)
+{
+       struct iss_device *iss = to_iss_device(ipipe);
+
+       dev_dbg(iss->dev, "-------------IPIPE Register dump-------------\n");
+
+       IPIPE_PRINT_REGISTER(iss, SRC_EN);
+       IPIPE_PRINT_REGISTER(iss, SRC_MODE);
+       IPIPE_PRINT_REGISTER(iss, SRC_FMT);
+       IPIPE_PRINT_REGISTER(iss, SRC_COL);
+       IPIPE_PRINT_REGISTER(iss, SRC_VPS);
+       IPIPE_PRINT_REGISTER(iss, SRC_VSZ);
+       IPIPE_PRINT_REGISTER(iss, SRC_HPS);
+       IPIPE_PRINT_REGISTER(iss, SRC_HSZ);
+       IPIPE_PRINT_REGISTER(iss, GCK_MMR);
+       IPIPE_PRINT_REGISTER(iss, YUV_PHS);
+
+       dev_dbg(iss->dev, "-----------------------------------------------\n");
+}
+
+/*
+ * ipipe_enable - Enable/Disable IPIPE.
+ * @enable: enable flag
+ *
+ */
+static void ipipe_enable(struct iss_ipipe_device *ipipe, u8 enable)
+{
+       struct iss_device *iss = to_iss_device(ipipe);
+
+       writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_SRC_EN) &
+               ~IPIPE_SRC_EN_EN) |
+               enable ? IPIPE_SRC_EN_EN : 0,
+               iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_SRC_EN);
+}
+
+/* -----------------------------------------------------------------------------
+ * Format- and pipeline-related configuration helpers
+ */
+
+static void ipipe_configure(struct iss_ipipe_device *ipipe)
+{
+       struct iss_device *iss = to_iss_device(ipipe);
+       struct v4l2_mbus_framefmt *format;
+
+       /* IPIPE_PAD_SINK */
+       format = &ipipe->formats[IPIPE_PAD_SINK];
+
+       /* NOTE: Currently just supporting pipeline IN: RGB, OUT: YUV422 */
+       writel(IPIPE_SRC_FMT_RAW2YUV,
+               iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_SRC_FMT);
+
+       /* Enable YUV444 -> YUV422 conversion */
+       writel(IPIPE_YUV_PHS_LPF,
+               iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_YUV_PHS);
+
+       writel(0, iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_SRC_VPS);
+       writel(0, iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_SRC_HPS);
+       writel((format->height - 2) & IPIPE_SRC_VSZ_MASK,
+               iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_SRC_VSZ);
+       writel((format->width - 1) & IPIPE_SRC_HSZ_MASK,
+               iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_SRC_HSZ);
+
+       /* Ignore ipipeif_wrt signal, and operate on-the-fly.  */
+       writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_SRC_MODE) &
+               ~(IPIPE_SRC_MODE_WRT | IPIPE_SRC_MODE_OST),
+               iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_SRC_MODE);
+
+       /* HACK: Values tuned for Ducati SW (OV) */
+       writel(IPIPE_SRC_COL_EE_B |
+               IPIPE_SRC_COL_EO_GB |
+               IPIPE_SRC_COL_OE_GR |
+               IPIPE_SRC_COL_OO_R,
+               iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_SRC_COL);
+
+       /* IPIPE_PAD_SOURCE_VP */
+       format = &ipipe->formats[IPIPE_PAD_SOURCE_VP];
+       /* Do nothing? */
+
+       omap4iss_isp_enable_interrupts(iss);
+}
+
+/* -----------------------------------------------------------------------------
+ * V4L2 subdev operations
+ */
+
+/*
+ * ipipe_set_stream - Enable/Disable streaming on the IPIPE module
+ * @sd: ISP IPIPE V4L2 subdevice
+ * @enable: Enable/disable stream
+ */
+static int ipipe_set_stream(struct v4l2_subdev *sd, int enable)
+{
+       struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd);
+       struct iss_device *iss = to_iss_device(ipipe);
+       int ret = 0;
+
+       if (ipipe->state == ISS_PIPELINE_STREAM_STOPPED) {
+               if (enable == ISS_PIPELINE_STREAM_STOPPED)
+                       return 0;
+
+               omap4iss_isp_subclk_enable(iss, OMAP4_ISS_ISP_SUBCLK_IPIPE);
+
+               /* Enable clk_arm_g0 */
+               writel(IPIPE_GCK_MMR_REG,
+                       iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_GCK_MMR);
+
+               /* Enable clk_pix_g[3:0] */
+               writel(IPIPE_GCK_PIX_G3 |
+                       IPIPE_GCK_PIX_G2 |
+                       IPIPE_GCK_PIX_G1 |
+                       IPIPE_GCK_PIX_G0,
+                       iss->regs[OMAP4_ISS_MEM_ISP_IPIPE] + IPIPE_GCK_PIX);
+       }
+
+       switch (enable) {
+       case ISS_PIPELINE_STREAM_CONTINUOUS:
+
+               ipipe_configure(ipipe);
+               ipipe_print_status(ipipe);
+
+               atomic_set(&ipipe->stopping, 0);
+               ipipe_enable(ipipe, 1);
+               break;
+
+       case ISS_PIPELINE_STREAM_STOPPED:
+               if (ipipe->state == ISS_PIPELINE_STREAM_STOPPED)
+                       return 0;
+               if (omap4iss_module_sync_idle(&sd->entity, &ipipe->wait,
+                                             &ipipe->stopping))
+                       dev_dbg(iss->dev, "%s: module stop timeout.\n",
+                               sd->name);
+
+               ipipe_enable(ipipe, 0);
+               omap4iss_isp_disable_interrupts(iss);
+               omap4iss_isp_subclk_disable(iss, OMAP4_ISS_ISP_SUBCLK_IPIPE);
+               break;
+       }
+
+       ipipe->state = enable;
+       return ret;
+}
+
+static struct v4l2_mbus_framefmt *
+__ipipe_get_format(struct iss_ipipe_device *ipipe, struct v4l2_subdev_fh *fh,
+                 unsigned int pad, enum v4l2_subdev_format_whence which)
+{
+       if (which == V4L2_SUBDEV_FORMAT_TRY)
+               return v4l2_subdev_get_try_format(fh, pad);
+       else
+               return &ipipe->formats[pad];
+}
+
+/*
+ * ipipe_try_format - Try video format on a pad
+ * @ipipe: ISS IPIPE device
+ * @fh : V4L2 subdev file handle
+ * @pad: Pad number
+ * @fmt: Format
+ */
+static void
+ipipe_try_format(struct iss_ipipe_device *ipipe, struct v4l2_subdev_fh *fh,
+               unsigned int pad, struct v4l2_mbus_framefmt *fmt,
+               enum v4l2_subdev_format_whence which)
+{
+       struct v4l2_mbus_framefmt *format;
+       unsigned int width = fmt->width;
+       unsigned int height = fmt->height;
+       unsigned int i;
+
+       switch (pad) {
+       case IPIPE_PAD_SINK:
+               for (i = 0; i < ARRAY_SIZE(ipipe_fmts); i++) {
+                       if (fmt->code == ipipe_fmts[i])
+                               break;
+               }
+
+               /* If not found, use SGRBG10 as default */
+               if (i >= ARRAY_SIZE(ipipe_fmts))
+                       fmt->code = V4L2_MBUS_FMT_SGRBG10_1X10;
+
+               /* Clamp the input size. */
+               fmt->width = clamp_t(u32, width, 1, 8192);
+               fmt->height = clamp_t(u32, height, 1, 8192);
+               fmt->colorspace = V4L2_COLORSPACE_SRGB;
+               break;
+
+       case IPIPE_PAD_SOURCE_VP:
+               format = __ipipe_get_format(ipipe, fh, IPIPE_PAD_SINK, which);
+               memcpy(fmt, format, sizeof(*fmt));
+
+               fmt->code = V4L2_MBUS_FMT_UYVY8_1X16;
+               fmt->width = clamp_t(u32, width, 32, fmt->width);
+               fmt->height = clamp_t(u32, height, 32, fmt->height);
+               fmt->colorspace = V4L2_COLORSPACE_JPEG;
+               break;
+       }
+
+       fmt->field = V4L2_FIELD_NONE;
+}
+
+/*
+ * ipipe_enum_mbus_code - Handle pixel format enumeration
+ * @sd     : pointer to v4l2 subdev structure
+ * @fh : V4L2 subdev file handle
+ * @code   : pointer to v4l2_subdev_mbus_code_enum structure
+ * return -EINVAL or zero on success
+ */
+static int ipipe_enum_mbus_code(struct v4l2_subdev *sd,
+                              struct v4l2_subdev_fh *fh,
+                              struct v4l2_subdev_mbus_code_enum *code)
+{
+       switch (code->pad) {
+       case IPIPE_PAD_SINK:
+               if (code->index >= ARRAY_SIZE(ipipe_fmts))
+                       return -EINVAL;
+
+               code->code = ipipe_fmts[code->index];
+               break;
+
+       case IPIPE_PAD_SOURCE_VP:
+               /* FIXME: Forced format conversion inside IPIPE ? */
+               if (code->index != 0)
+                       return -EINVAL;
+
+               code->code = V4L2_MBUS_FMT_UYVY8_1X16;
+               break;
+
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int ipipe_enum_frame_size(struct v4l2_subdev *sd,
+                               struct v4l2_subdev_fh *fh,
+                               struct v4l2_subdev_frame_size_enum *fse)
+{
+       struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt format;
+
+       if (fse->index != 0)
+               return -EINVAL;
+
+       format.code = fse->code;
+       format.width = 1;
+       format.height = 1;
+       ipipe_try_format(ipipe, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
+       fse->min_width = format.width;
+       fse->min_height = format.height;
+
+       if (format.code != fse->code)
+               return -EINVAL;
+
+       format.code = fse->code;
+       format.width = -1;
+       format.height = -1;
+       ipipe_try_format(ipipe, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
+       fse->max_width = format.width;
+       fse->max_height = format.height;
+
+       return 0;
+}
+
+/*
+ * ipipe_get_format - Retrieve the video format on a pad
+ * @sd : ISP IPIPE V4L2 subdevice
+ * @fh : V4L2 subdev file handle
+ * @fmt: Format
+ *
+ * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond
+ * to the format type.
+ */
+static int ipipe_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
+                          struct v4l2_subdev_format *fmt)
+{
+       struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt *format;
+
+       format = __ipipe_get_format(ipipe, fh, fmt->pad, fmt->which);
+       if (format == NULL)
+               return -EINVAL;
+
+       fmt->format = *format;
+       return 0;
+}
+
+/*
+ * ipipe_set_format - Set the video format on a pad
+ * @sd : ISP IPIPE V4L2 subdevice
+ * @fh : V4L2 subdev file handle
+ * @fmt: Format
+ *
+ * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond
+ * to the format type.
+ */
+static int ipipe_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
+                          struct v4l2_subdev_format *fmt)
+{
+       struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt *format;
+
+       format = __ipipe_get_format(ipipe, fh, fmt->pad, fmt->which);
+       if (format == NULL)
+               return -EINVAL;
+
+       ipipe_try_format(ipipe, fh, fmt->pad, &fmt->format, fmt->which);
+       *format = fmt->format;
+
+       /* Propagate the format from sink to source */
+       if (fmt->pad == IPIPE_PAD_SINK) {
+               format = __ipipe_get_format(ipipe, fh, IPIPE_PAD_SOURCE_VP,
+                                          fmt->which);
+               *format = fmt->format;
+               ipipe_try_format(ipipe, fh, IPIPE_PAD_SOURCE_VP, format,
+                               fmt->which);
+       }
+
+       return 0;
+}
+
+static int ipipe_link_validate(struct v4l2_subdev *sd, struct media_link *link,
+                                struct v4l2_subdev_format *source_fmt,
+                                struct v4l2_subdev_format *sink_fmt)
+{
+       /* Check if the two ends match */
+       if (source_fmt->format.width != sink_fmt->format.width ||
+           source_fmt->format.height != sink_fmt->format.height)
+               return -EPIPE;
+
+       if (source_fmt->format.code != sink_fmt->format.code)
+               return -EPIPE;
+
+       return 0;
+}
+
+/*
+ * ipipe_init_formats - Initialize formats on all pads
+ * @sd: ISP IPIPE V4L2 subdevice
+ * @fh: V4L2 subdev file handle
+ *
+ * Initialize all pad formats with default values. If fh is not NULL, try
+ * formats are initialized on the file handle. Otherwise active formats are
+ * initialized on the device.
+ */
+static int ipipe_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+       struct v4l2_subdev_format format;
+
+       memset(&format, 0, sizeof(format));
+       format.pad = IPIPE_PAD_SINK;
+       format.which = fh ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE;
+       format.format.code = V4L2_MBUS_FMT_SGRBG10_1X10;
+       format.format.width = 4096;
+       format.format.height = 4096;
+       ipipe_set_format(sd, fh, &format);
+
+       return 0;
+}
+
+/* V4L2 subdev video operations */
+static const struct v4l2_subdev_video_ops ipipe_v4l2_video_ops = {
+       .s_stream = ipipe_set_stream,
+};
+
+/* V4L2 subdev pad operations */
+static const struct v4l2_subdev_pad_ops ipipe_v4l2_pad_ops = {
+       .enum_mbus_code = ipipe_enum_mbus_code,
+       .enum_frame_size = ipipe_enum_frame_size,
+       .get_fmt = ipipe_get_format,
+       .set_fmt = ipipe_set_format,
+       .link_validate = ipipe_link_validate,
+};
+
+/* V4L2 subdev operations */
+static const struct v4l2_subdev_ops ipipe_v4l2_ops = {
+       .video = &ipipe_v4l2_video_ops,
+       .pad = &ipipe_v4l2_pad_ops,
+};
+
+/* V4L2 subdev internal operations */
+static const struct v4l2_subdev_internal_ops ipipe_v4l2_internal_ops = {
+       .open = ipipe_init_formats,
+};
+
+/* -----------------------------------------------------------------------------
+ * Media entity operations
+ */
+
+/*
+ * ipipe_link_setup - Setup IPIPE connections
+ * @entity: IPIPE media entity
+ * @local: Pad at the local end of the link
+ * @remote: Pad at the remote end of the link
+ * @flags: Link flags
+ *
+ * return -EINVAL or zero on success
+ */
+static int ipipe_link_setup(struct media_entity *entity,
+                          const struct media_pad *local,
+                          const struct media_pad *remote, u32 flags)
+{
+       struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
+       struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd);
+       struct iss_device *iss = to_iss_device(ipipe);
+
+       switch (local->index | media_entity_type(remote->entity)) {
+       case IPIPE_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+               /* Read from IPIPEIF. */
+               if (!(flags & MEDIA_LNK_FL_ENABLED)) {
+                       ipipe->input = IPIPE_INPUT_NONE;
+                       break;
+               }
+
+               if (ipipe->input != IPIPE_INPUT_NONE)
+                       return -EBUSY;
+
+               if (remote->entity == &iss->ipipeif.subdev.entity)
+                       ipipe->input = IPIPE_INPUT_IPIPEIF;
+
+               break;
+
+       case IPIPE_PAD_SOURCE_VP | MEDIA_ENT_T_V4L2_SUBDEV:
+               /* Send to RESIZER */
+               if (flags & MEDIA_LNK_FL_ENABLED) {
+                       if (ipipe->output & ~IPIPE_OUTPUT_VP)
+                               return -EBUSY;
+                       ipipe->output |= IPIPE_OUTPUT_VP;
+               } else {
+                       ipipe->output &= ~IPIPE_OUTPUT_VP;
+               }
+               break;
+
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+/* media operations */
+static const struct media_entity_operations ipipe_media_ops = {
+       .link_setup = ipipe_link_setup,
+       .link_validate = v4l2_subdev_link_validate,
+};
+
+/*
+ * ipipe_init_entities - Initialize V4L2 subdev and media entity
+ * @ipipe: ISS ISP IPIPE module
+ *
+ * Return 0 on success and a negative error code on failure.
+ */
+static int ipipe_init_entities(struct iss_ipipe_device *ipipe)
+{
+       struct v4l2_subdev *sd = &ipipe->subdev;
+       struct media_pad *pads = ipipe->pads;
+       struct media_entity *me = &sd->entity;
+       int ret;
+
+       ipipe->input = IPIPE_INPUT_NONE;
+
+       v4l2_subdev_init(sd, &ipipe_v4l2_ops);
+       sd->internal_ops = &ipipe_v4l2_internal_ops;
+       strlcpy(sd->name, "OMAP4 ISS ISP IPIPE", sizeof(sd->name));
+       sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
+       v4l2_set_subdevdata(sd, ipipe);
+       sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+
+       pads[IPIPE_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
+       pads[IPIPE_PAD_SOURCE_VP].flags = MEDIA_PAD_FL_SOURCE;
+
+       me->ops = &ipipe_media_ops;
+       ret = media_entity_init(me, IPIPE_PADS_NUM, pads, 0);
+       if (ret < 0)
+               return ret;
+
+       ipipe_init_formats(sd, NULL);
+
+       return 0;
+}
+
+void omap4iss_ipipe_unregister_entities(struct iss_ipipe_device *ipipe)
+{
+       media_entity_cleanup(&ipipe->subdev.entity);
+
+       v4l2_device_unregister_subdev(&ipipe->subdev);
+}
+
+int omap4iss_ipipe_register_entities(struct iss_ipipe_device *ipipe,
+       struct v4l2_device *vdev)
+{
+       int ret;
+
+       /* Register the subdev and video node. */
+       ret = v4l2_device_register_subdev(vdev, &ipipe->subdev);
+       if (ret < 0)
+               goto error;
+
+       return 0;
+
+error:
+       omap4iss_ipipe_unregister_entities(ipipe);
+       return ret;
+}
+
+/* -----------------------------------------------------------------------------
+ * ISP IPIPE initialisation and cleanup
+ */
+
+/*
+ * omap4iss_ipipe_init - IPIPE module initialization.
+ * @iss: Device pointer specific to the OMAP4 ISS.
+ *
+ * TODO: Get the initialisation values from platform data.
+ *
+ * Return 0 on success or a negative error code otherwise.
+ */
+int omap4iss_ipipe_init(struct iss_device *iss)
+{
+       struct iss_ipipe_device *ipipe = &iss->ipipe;
+
+       ipipe->state = ISS_PIPELINE_STREAM_STOPPED;
+       init_waitqueue_head(&ipipe->wait);
+
+       return ipipe_init_entities(ipipe);
+}
+
+/*
+ * omap4iss_ipipe_cleanup - IPIPE module cleanup.
+ * @iss: Device pointer specific to the OMAP4 ISS.
+ */
+void omap4iss_ipipe_cleanup(struct iss_device *iss)
+{
+       /* FIXME: are you sure there's nothing to do? */
+}
diff --git a/drivers/staging/media/omap4iss/iss_ipipe.h b/drivers/staging/media/omap4iss/iss_ipipe.h
new file mode 100644 (file)
index 0000000..c22d904
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - ISP IPIPE module
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#ifndef OMAP4_ISS_IPIPE_H
+#define OMAP4_ISS_IPIPE_H
+
+#include "iss_video.h"
+
+enum ipipe_input_entity {
+       IPIPE_INPUT_NONE,
+       IPIPE_INPUT_IPIPEIF,
+};
+
+#define IPIPE_OUTPUT_VP                (1 << 0)
+
+/* Sink and source IPIPE pads */
+#define IPIPE_PAD_SINK                         0
+#define IPIPE_PAD_SOURCE_VP                    1
+#define IPIPE_PADS_NUM                         2
+
+/*
+ * struct iss_ipipe_device - Structure for the IPIPE module to store its own
+ *                         information
+ * @subdev: V4L2 subdevice
+ * @pads: Sink and source media entity pads
+ * @formats: Active video formats
+ * @input: Active input
+ * @output: Active outputs
+ * @error: A hardware error occurred during capture
+ * @state: Streaming state
+ * @wait: Wait queue used to stop the module
+ * @stopping: Stopping state
+ */
+struct iss_ipipe_device {
+       struct v4l2_subdev subdev;
+       struct media_pad pads[IPIPE_PADS_NUM];
+       struct v4l2_mbus_framefmt formats[IPIPE_PADS_NUM];
+
+       enum ipipe_input_entity input;
+       unsigned int output;
+       unsigned int error;
+
+       enum iss_pipeline_stream_state state;
+       wait_queue_head_t wait;
+       atomic_t stopping;
+};
+
+struct iss_device;
+
+int omap4iss_ipipe_register_entities(struct iss_ipipe_device *ipipe,
+       struct v4l2_device *vdev);
+void omap4iss_ipipe_unregister_entities(struct iss_ipipe_device *ipipe);
+
+int omap4iss_ipipe_init(struct iss_device *iss);
+void omap4iss_ipipe_cleanup(struct iss_device *iss);
+
+#endif /* OMAP4_ISS_IPIPE_H */
diff --git a/drivers/staging/media/omap4iss/iss_ipipeif.c b/drivers/staging/media/omap4iss/iss_ipipeif.c
new file mode 100644 (file)
index 0000000..acc6005
--- /dev/null
@@ -0,0 +1,847 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - ISP IPIPEIF module
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#include <linux/module.h>
+#include <linux/uaccess.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/dma-mapping.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+
+#include "iss.h"
+#include "iss_regs.h"
+#include "iss_ipipeif.h"
+
+static struct v4l2_mbus_framefmt *
+__ipipeif_get_format(struct iss_ipipeif_device *ipipeif, struct v4l2_subdev_fh *fh,
+                 unsigned int pad, enum v4l2_subdev_format_whence which);
+
+static const unsigned int ipipeif_fmts[] = {
+       V4L2_MBUS_FMT_SGRBG10_1X10,
+       V4L2_MBUS_FMT_SRGGB10_1X10,
+       V4L2_MBUS_FMT_SBGGR10_1X10,
+       V4L2_MBUS_FMT_SGBRG10_1X10,
+       V4L2_MBUS_FMT_UYVY8_1X16,
+       V4L2_MBUS_FMT_YUYV8_1X16,
+};
+
+/*
+ * ipipeif_print_status - Print current IPIPEIF Module register values.
+ * @ipipeif: Pointer to ISS ISP IPIPEIF device.
+ *
+ * Also prints other debug information stored in the IPIPEIF module.
+ */
+#define IPIPEIF_PRINT_REGISTER(iss, name)\
+       dev_dbg(iss->dev, "###IPIPEIF " #name "=0x%08x\n", \
+               readl(iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_##name))
+
+#define ISIF_PRINT_REGISTER(iss, name)\
+       dev_dbg(iss->dev, "###ISIF " #name "=0x%08x\n", \
+               readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_##name))
+
+#define ISP5_PRINT_REGISTER(iss, name)\
+       dev_dbg(iss->dev, "###ISP5 " #name "=0x%08x\n", \
+               readl(iss->regs[OMAP4_ISS_MEM_ISP_SYS1] + ISP5_##name))
+
+static void ipipeif_print_status(struct iss_ipipeif_device *ipipeif)
+{
+       struct iss_device *iss = to_iss_device(ipipeif);
+
+       dev_dbg(iss->dev, "-------------IPIPEIF Register dump-------------\n");
+
+       IPIPEIF_PRINT_REGISTER(iss, CFG1);
+       IPIPEIF_PRINT_REGISTER(iss, CFG2);
+
+       ISIF_PRINT_REGISTER(iss, SYNCEN);
+       ISIF_PRINT_REGISTER(iss, CADU);
+       ISIF_PRINT_REGISTER(iss, CADL);
+       ISIF_PRINT_REGISTER(iss, MODESET);
+       ISIF_PRINT_REGISTER(iss, CCOLP);
+       ISIF_PRINT_REGISTER(iss, SPH);
+       ISIF_PRINT_REGISTER(iss, LNH);
+       ISIF_PRINT_REGISTER(iss, LNV);
+       ISIF_PRINT_REGISTER(iss, VDINT0);
+       ISIF_PRINT_REGISTER(iss, HSIZE);
+
+       ISP5_PRINT_REGISTER(iss, SYSCONFIG);
+       ISP5_PRINT_REGISTER(iss, CTRL);
+       ISP5_PRINT_REGISTER(iss, IRQSTATUS(0));
+       ISP5_PRINT_REGISTER(iss, IRQENABLE_SET(0));
+       ISP5_PRINT_REGISTER(iss, IRQENABLE_CLR(0));
+
+       dev_dbg(iss->dev, "-----------------------------------------------\n");
+}
+
+static void ipipeif_write_enable(struct iss_ipipeif_device *ipipeif, u8 enable)
+{
+       struct iss_device *iss = to_iss_device(ipipeif);
+
+       writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_SYNCEN) &
+               ~ISIF_SYNCEN_DWEN) |
+               enable ? ISIF_SYNCEN_DWEN : 0,
+               iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_SYNCEN);
+}
+
+/*
+ * ipipeif_enable - Enable/Disable IPIPEIF.
+ * @enable: enable flag
+ *
+ */
+static void ipipeif_enable(struct iss_ipipeif_device *ipipeif, u8 enable)
+{
+       struct iss_device *iss = to_iss_device(ipipeif);
+
+       writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_SYNCEN) &
+               ~ISIF_SYNCEN_SYEN) |
+               enable ? ISIF_SYNCEN_SYEN : 0,
+               iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_SYNCEN);
+}
+
+/* -----------------------------------------------------------------------------
+ * Format- and pipeline-related configuration helpers
+ */
+
+/*
+ * ipipeif_set_outaddr - Set memory address to save output image
+ * @ipipeif: Pointer to ISP IPIPEIF device.
+ * @addr: 32-bit memory address aligned on 32 byte boundary.
+ *
+ * Sets the memory address where the output will be saved.
+ */
+static void ipipeif_set_outaddr(struct iss_ipipeif_device *ipipeif, u32 addr)
+{
+       struct iss_device *iss = to_iss_device(ipipeif);
+
+       /* Save address splitted in Base Address H & L */
+       writel((addr >> (16 + 5)) & ISIF_CADU_MASK,
+               iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_CADU);
+       writel((addr >> 5) & ISIF_CADL_MASK,
+               iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_CADL);
+}
+
+static void ipipeif_configure(struct iss_ipipeif_device *ipipeif)
+{
+       struct iss_device *iss = to_iss_device(ipipeif);
+       struct v4l2_mbus_framefmt *format;
+       u32 isif_ccolp = 0;
+
+       omap4iss_configure_bridge(iss, ipipeif->input);
+
+       /* IPIPEIF_PAD_SINK */
+       format = &ipipeif->formats[IPIPEIF_PAD_SINK];
+
+       /* IPIPEIF with YUV422 input from ISIF */
+       writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG1) &
+               ~(IPIPEIF_CFG1_INPSRC1_MASK | IPIPEIF_CFG1_INPSRC2_MASK),
+               iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG1);
+
+       /* Select ISIF/IPIPEIF input format */
+       switch (format->code) {
+       case V4L2_MBUS_FMT_UYVY8_1X16:
+       case V4L2_MBUS_FMT_YUYV8_1X16:
+               writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_MODESET) &
+                       ~(ISIF_MODESET_CCDMD |
+                         ISIF_MODESET_INPMOD_MASK |
+                         ISIF_MODESET_CCDW_MASK)) |
+                       ISIF_MODESET_INPMOD_YCBCR16,
+                       iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_MODESET);
+
+               writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG2) &
+                       ~IPIPEIF_CFG2_YUV8) |
+                       IPIPEIF_CFG2_YUV16,
+                       iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG2);
+
+               break;
+       case V4L2_MBUS_FMT_SGRBG10_1X10:
+               isif_ccolp = ISIF_CCOLP_CP0_F0_GR |
+                       ISIF_CCOLP_CP1_F0_R |
+                       ISIF_CCOLP_CP2_F0_B |
+                       ISIF_CCOLP_CP3_F0_GB;
+               goto cont_raw;
+       case V4L2_MBUS_FMT_SRGGB10_1X10:
+               isif_ccolp = ISIF_CCOLP_CP0_F0_R |
+                       ISIF_CCOLP_CP1_F0_GR |
+                       ISIF_CCOLP_CP2_F0_GB |
+                       ISIF_CCOLP_CP3_F0_B;
+               goto cont_raw;
+       case V4L2_MBUS_FMT_SBGGR10_1X10:
+               isif_ccolp = ISIF_CCOLP_CP0_F0_B |
+                       ISIF_CCOLP_CP1_F0_GB |
+                       ISIF_CCOLP_CP2_F0_GR |
+                       ISIF_CCOLP_CP3_F0_R;
+               goto cont_raw;
+       case V4L2_MBUS_FMT_SGBRG10_1X10:
+               isif_ccolp = ISIF_CCOLP_CP0_F0_GB |
+                       ISIF_CCOLP_CP1_F0_B |
+                       ISIF_CCOLP_CP2_F0_R |
+                       ISIF_CCOLP_CP3_F0_GR;
+cont_raw:
+               writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG2) &
+                       ~IPIPEIF_CFG2_YUV16),
+                       iss->regs[OMAP4_ISS_MEM_ISP_IPIPEIF] + IPIPEIF_CFG2);
+
+               writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_MODESET) &
+                       ~(ISIF_MODESET_CCDMD |
+                         ISIF_MODESET_INPMOD_MASK |
+                         ISIF_MODESET_CCDW_MASK)) |
+                       ISIF_MODESET_INPMOD_RAW | ISIF_MODESET_CCDW_2BIT,
+                       iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_MODESET);
+
+               writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_CGAMMAWD) &
+                       ~ISIF_CGAMMAWD_GWDI_MASK) |
+                       ISIF_CGAMMAWD_GWDI_BIT11,
+                       iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_CGAMMAWD);
+
+               /* Set RAW Bayer pattern */
+               writel(isif_ccolp,
+                       iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_CCOLP);
+               break;
+       }
+
+       writel(0 & ISIF_SPH_MASK, iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_SPH);
+       writel((format->width - 1) & ISIF_LNH_MASK,
+               iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_LNH);
+       writel((format->height - 1) & ISIF_LNV_MASK,
+               iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_LNV);
+
+       /* Generate ISIF0 on the last line of the image */
+       writel(format->height - 1,
+               iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_VDINT0);
+
+       /* IPIPEIF_PAD_SOURCE_ISIF_SF */
+       format = &ipipeif->formats[IPIPEIF_PAD_SOURCE_ISIF_SF];
+
+       writel((ipipeif->video_out.bpl_value >> 5) & ISIF_HSIZE_HSIZE_MASK,
+               iss->regs[OMAP4_ISS_MEM_ISP_ISIF] + ISIF_HSIZE);
+
+       /* IPIPEIF_PAD_SOURCE_VP */
+       /* Do nothing? */
+
+       omap4iss_isp_enable_interrupts(iss);
+}
+
+/* -----------------------------------------------------------------------------
+ * Interrupt handling
+ */
+
+static void ipipeif_isr_buffer(struct iss_ipipeif_device *ipipeif)
+{
+       struct iss_buffer *buffer;
+
+       ipipeif_write_enable(ipipeif, 0);
+
+       buffer = omap4iss_video_buffer_next(&ipipeif->video_out);
+       if (buffer == NULL)
+               return;
+
+       ipipeif_set_outaddr(ipipeif, buffer->iss_addr);
+
+       ipipeif_write_enable(ipipeif, 1);
+}
+
+/*
+ * ipipeif_isif0_isr - Handle ISIF0 event
+ * @ipipeif: Pointer to ISP IPIPEIF device.
+ *
+ * Executes LSC deferred enablement before next frame starts.
+ */
+static void ipipeif_isif0_isr(struct iss_ipipeif_device *ipipeif)
+{
+       struct iss_pipeline *pipe =
+                            to_iss_pipeline(&ipipeif->subdev.entity);
+       if (pipe->do_propagation)
+               atomic_inc(&pipe->frame_number);
+
+       if (ipipeif->output & IPIPEIF_OUTPUT_MEMORY)
+               ipipeif_isr_buffer(ipipeif);
+}
+
+/*
+ * omap4iss_ipipeif_isr - Configure ipipeif during interframe time.
+ * @ipipeif: Pointer to ISP IPIPEIF device.
+ * @events: IPIPEIF events
+ */
+void omap4iss_ipipeif_isr(struct iss_ipipeif_device *ipipeif, u32 events)
+{
+       if (omap4iss_module_sync_is_stopping(&ipipeif->wait, &ipipeif->stopping))
+               return;
+
+       if (events & ISP5_IRQ_ISIF0)
+               ipipeif_isif0_isr(ipipeif);
+}
+
+/* -----------------------------------------------------------------------------
+ * ISP video operations
+ */
+
+static int ipipeif_video_queue(struct iss_video *video, struct iss_buffer *buffer)
+{
+       struct iss_ipipeif_device *ipipeif = container_of(video,
+                               struct iss_ipipeif_device, video_out);
+
+       if (!(ipipeif->output & IPIPEIF_OUTPUT_MEMORY))
+               return -ENODEV;
+
+       ipipeif_set_outaddr(ipipeif, buffer->iss_addr);
+
+       /*
+        * If streaming was enabled before there was a buffer queued
+        * or underrun happened in the ISR, the hardware was not enabled
+        * and DMA queue flag ISS_VIDEO_DMAQUEUE_UNDERRUN is still set.
+        * Enable it now.
+        */
+       if (video->dmaqueue_flags & ISS_VIDEO_DMAQUEUE_UNDERRUN) {
+               if (ipipeif->output & IPIPEIF_OUTPUT_MEMORY)
+                       ipipeif_write_enable(ipipeif, 1);
+               ipipeif_enable(ipipeif, 1);
+               iss_video_dmaqueue_flags_clr(video);
+       }
+
+       return 0;
+}
+
+static const struct iss_video_operations ipipeif_video_ops = {
+       .queue = ipipeif_video_queue,
+};
+
+/* -----------------------------------------------------------------------------
+ * V4L2 subdev operations
+ */
+
+#define IPIPEIF_DRV_SUBCLK_MASK        (OMAP4_ISS_ISP_SUBCLK_IPIPEIF |\
+                                OMAP4_ISS_ISP_SUBCLK_ISIF)
+/*
+ * ipipeif_set_stream - Enable/Disable streaming on the IPIPEIF module
+ * @sd: ISP IPIPEIF V4L2 subdevice
+ * @enable: Enable/disable stream
+ */
+static int ipipeif_set_stream(struct v4l2_subdev *sd, int enable)
+{
+       struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
+       struct iss_device *iss = to_iss_device(ipipeif);
+       struct iss_video *video_out = &ipipeif->video_out;
+       int ret = 0;
+
+       if (ipipeif->state == ISS_PIPELINE_STREAM_STOPPED) {
+               if (enable == ISS_PIPELINE_STREAM_STOPPED)
+                       return 0;
+
+               omap4iss_isp_subclk_enable(iss, IPIPEIF_DRV_SUBCLK_MASK);
+       }
+
+       switch (enable) {
+       case ISS_PIPELINE_STREAM_CONTINUOUS:
+
+               ipipeif_configure(ipipeif);
+               ipipeif_print_status(ipipeif);
+
+               /*
+                * When outputting to memory with no buffer available, let the
+                * buffer queue handler start the hardware. A DMA queue flag
+                * ISS_VIDEO_DMAQUEUE_QUEUED will be set as soon as there is
+                * a buffer available.
+                */
+               if (ipipeif->output & IPIPEIF_OUTPUT_MEMORY &&
+                   !(video_out->dmaqueue_flags & ISS_VIDEO_DMAQUEUE_QUEUED))
+                       break;
+
+               atomic_set(&ipipeif->stopping, 0);
+               if (ipipeif->output & IPIPEIF_OUTPUT_MEMORY)
+                       ipipeif_write_enable(ipipeif, 1);
+               ipipeif_enable(ipipeif, 1);
+               iss_video_dmaqueue_flags_clr(video_out);
+               break;
+
+       case ISS_PIPELINE_STREAM_STOPPED:
+               if (ipipeif->state == ISS_PIPELINE_STREAM_STOPPED)
+                       return 0;
+               if (omap4iss_module_sync_idle(&sd->entity, &ipipeif->wait,
+                                             &ipipeif->stopping))
+                       dev_dbg(iss->dev, "%s: module stop timeout.\n",
+                               sd->name);
+
+               if (ipipeif->output & IPIPEIF_OUTPUT_MEMORY)
+                       ipipeif_write_enable(ipipeif, 0);
+               ipipeif_enable(ipipeif, 0);
+               omap4iss_isp_disable_interrupts(iss);
+               omap4iss_isp_subclk_disable(iss, IPIPEIF_DRV_SUBCLK_MASK);
+               iss_video_dmaqueue_flags_clr(video_out);
+               break;
+       }
+
+       ipipeif->state = enable;
+       return ret;
+}
+
+static struct v4l2_mbus_framefmt *
+__ipipeif_get_format(struct iss_ipipeif_device *ipipeif, struct v4l2_subdev_fh *fh,
+                 unsigned int pad, enum v4l2_subdev_format_whence which)
+{
+       if (which == V4L2_SUBDEV_FORMAT_TRY)
+               return v4l2_subdev_get_try_format(fh, pad);
+       else
+               return &ipipeif->formats[pad];
+}
+
+/*
+ * ipipeif_try_format - Try video format on a pad
+ * @ipipeif: ISS IPIPEIF device
+ * @fh : V4L2 subdev file handle
+ * @pad: Pad number
+ * @fmt: Format
+ */
+static void
+ipipeif_try_format(struct iss_ipipeif_device *ipipeif, struct v4l2_subdev_fh *fh,
+               unsigned int pad, struct v4l2_mbus_framefmt *fmt,
+               enum v4l2_subdev_format_whence which)
+{
+       struct v4l2_mbus_framefmt *format;
+       unsigned int width = fmt->width;
+       unsigned int height = fmt->height;
+       unsigned int i;
+
+       switch (pad) {
+       case IPIPEIF_PAD_SINK:
+               /* TODO: If the IPIPEIF output formatter pad is connected directly
+                * to the resizer, only YUV formats can be used.
+                */
+               for (i = 0; i < ARRAY_SIZE(ipipeif_fmts); i++) {
+                       if (fmt->code == ipipeif_fmts[i])
+                               break;
+               }
+
+               /* If not found, use SGRBG10 as default */
+               if (i >= ARRAY_SIZE(ipipeif_fmts))
+                       fmt->code = V4L2_MBUS_FMT_SGRBG10_1X10;
+
+               /* Clamp the input size. */
+               fmt->width = clamp_t(u32, width, 1, 8192);
+               fmt->height = clamp_t(u32, height, 1, 8192);
+               break;
+
+       case IPIPEIF_PAD_SOURCE_ISIF_SF:
+               format = __ipipeif_get_format(ipipeif, fh, IPIPEIF_PAD_SINK, which);
+               memcpy(fmt, format, sizeof(*fmt));
+
+               /* The data formatter truncates the number of horizontal output
+                * pixels to a multiple of 16. To avoid clipping data, allow
+                * callers to request an output size bigger than the input size
+                * up to the nearest multiple of 16.
+                */
+               fmt->width = clamp_t(u32, width, 32, (fmt->width + 15) & ~15);
+               fmt->width &= ~15;
+               fmt->height = clamp_t(u32, height, 32, fmt->height);
+               break;
+
+       case IPIPEIF_PAD_SOURCE_VP:
+               format = __ipipeif_get_format(ipipeif, fh, IPIPEIF_PAD_SINK, which);
+               memcpy(fmt, format, sizeof(*fmt));
+
+               fmt->width = clamp_t(u32, width, 32, fmt->width);
+               fmt->height = clamp_t(u32, height, 32, fmt->height);
+               break;
+       }
+
+       /* Data is written to memory unpacked, each 10-bit or 12-bit pixel is
+        * stored on 2 bytes.
+        */
+       fmt->colorspace = V4L2_COLORSPACE_SRGB;
+       fmt->field = V4L2_FIELD_NONE;
+}
+
+/*
+ * ipipeif_enum_mbus_code - Handle pixel format enumeration
+ * @sd     : pointer to v4l2 subdev structure
+ * @fh : V4L2 subdev file handle
+ * @code   : pointer to v4l2_subdev_mbus_code_enum structure
+ * return -EINVAL or zero on success
+ */
+static int ipipeif_enum_mbus_code(struct v4l2_subdev *sd,
+                              struct v4l2_subdev_fh *fh,
+                              struct v4l2_subdev_mbus_code_enum *code)
+{
+       struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt *format;
+
+       switch (code->pad) {
+       case IPIPEIF_PAD_SINK:
+               if (code->index >= ARRAY_SIZE(ipipeif_fmts))
+                       return -EINVAL;
+
+               code->code = ipipeif_fmts[code->index];
+               break;
+
+       case IPIPEIF_PAD_SOURCE_ISIF_SF:
+       case IPIPEIF_PAD_SOURCE_VP:
+               /* No format conversion inside IPIPEIF */
+               if (code->index != 0)
+                       return -EINVAL;
+
+               format = __ipipeif_get_format(ipipeif, fh, IPIPEIF_PAD_SINK,
+                                             V4L2_SUBDEV_FORMAT_TRY);
+
+               code->code = format->code;
+               break;
+
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int ipipeif_enum_frame_size(struct v4l2_subdev *sd,
+                               struct v4l2_subdev_fh *fh,
+                               struct v4l2_subdev_frame_size_enum *fse)
+{
+       struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt format;
+
+       if (fse->index != 0)
+               return -EINVAL;
+
+       format.code = fse->code;
+       format.width = 1;
+       format.height = 1;
+       ipipeif_try_format(ipipeif, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
+       fse->min_width = format.width;
+       fse->min_height = format.height;
+
+       if (format.code != fse->code)
+               return -EINVAL;
+
+       format.code = fse->code;
+       format.width = -1;
+       format.height = -1;
+       ipipeif_try_format(ipipeif, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
+       fse->max_width = format.width;
+       fse->max_height = format.height;
+
+       return 0;
+}
+
+/*
+ * ipipeif_get_format - Retrieve the video format on a pad
+ * @sd : ISP IPIPEIF V4L2 subdevice
+ * @fh : V4L2 subdev file handle
+ * @fmt: Format
+ *
+ * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond
+ * to the format type.
+ */
+static int ipipeif_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
+                          struct v4l2_subdev_format *fmt)
+{
+       struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt *format;
+
+       format = __ipipeif_get_format(ipipeif, fh, fmt->pad, fmt->which);
+       if (format == NULL)
+               return -EINVAL;
+
+       fmt->format = *format;
+       return 0;
+}
+
+/*
+ * ipipeif_set_format - Set the video format on a pad
+ * @sd : ISP IPIPEIF V4L2 subdevice
+ * @fh : V4L2 subdev file handle
+ * @fmt: Format
+ *
+ * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond
+ * to the format type.
+ */
+static int ipipeif_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
+                          struct v4l2_subdev_format *fmt)
+{
+       struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt *format;
+
+       format = __ipipeif_get_format(ipipeif, fh, fmt->pad, fmt->which);
+       if (format == NULL)
+               return -EINVAL;
+
+       ipipeif_try_format(ipipeif, fh, fmt->pad, &fmt->format, fmt->which);
+       *format = fmt->format;
+
+       /* Propagate the format from sink to source */
+       if (fmt->pad == IPIPEIF_PAD_SINK) {
+               format = __ipipeif_get_format(ipipeif, fh, IPIPEIF_PAD_SOURCE_ISIF_SF,
+                                          fmt->which);
+               *format = fmt->format;
+               ipipeif_try_format(ipipeif, fh, IPIPEIF_PAD_SOURCE_ISIF_SF, format,
+                               fmt->which);
+
+               format = __ipipeif_get_format(ipipeif, fh, IPIPEIF_PAD_SOURCE_VP,
+                                          fmt->which);
+               *format = fmt->format;
+               ipipeif_try_format(ipipeif, fh, IPIPEIF_PAD_SOURCE_VP, format,
+                               fmt->which);
+       }
+
+       return 0;
+}
+
+static int ipipeif_link_validate(struct v4l2_subdev *sd, struct media_link *link,
+                                struct v4l2_subdev_format *source_fmt,
+                                struct v4l2_subdev_format *sink_fmt)
+{
+       /* Check if the two ends match */
+       if (source_fmt->format.width != sink_fmt->format.width ||
+           source_fmt->format.height != sink_fmt->format.height)
+               return -EPIPE;
+
+       if (source_fmt->format.code != sink_fmt->format.code)
+               return -EPIPE;
+
+       return 0;
+}
+
+/*
+ * ipipeif_init_formats - Initialize formats on all pads
+ * @sd: ISP IPIPEIF V4L2 subdevice
+ * @fh: V4L2 subdev file handle
+ *
+ * Initialize all pad formats with default values. If fh is not NULL, try
+ * formats are initialized on the file handle. Otherwise active formats are
+ * initialized on the device.
+ */
+static int ipipeif_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+       struct v4l2_subdev_format format;
+
+       memset(&format, 0, sizeof(format));
+       format.pad = IPIPEIF_PAD_SINK;
+       format.which = fh ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE;
+       format.format.code = V4L2_MBUS_FMT_SGRBG10_1X10;
+       format.format.width = 4096;
+       format.format.height = 4096;
+       ipipeif_set_format(sd, fh, &format);
+
+       return 0;
+}
+
+/* V4L2 subdev video operations */
+static const struct v4l2_subdev_video_ops ipipeif_v4l2_video_ops = {
+       .s_stream = ipipeif_set_stream,
+};
+
+/* V4L2 subdev pad operations */
+static const struct v4l2_subdev_pad_ops ipipeif_v4l2_pad_ops = {
+       .enum_mbus_code = ipipeif_enum_mbus_code,
+       .enum_frame_size = ipipeif_enum_frame_size,
+       .get_fmt = ipipeif_get_format,
+       .set_fmt = ipipeif_set_format,
+       .link_validate = ipipeif_link_validate,
+};
+
+/* V4L2 subdev operations */
+static const struct v4l2_subdev_ops ipipeif_v4l2_ops = {
+       .video = &ipipeif_v4l2_video_ops,
+       .pad = &ipipeif_v4l2_pad_ops,
+};
+
+/* V4L2 subdev internal operations */
+static const struct v4l2_subdev_internal_ops ipipeif_v4l2_internal_ops = {
+       .open = ipipeif_init_formats,
+};
+
+/* -----------------------------------------------------------------------------
+ * Media entity operations
+ */
+
+/*
+ * ipipeif_link_setup - Setup IPIPEIF connections
+ * @entity: IPIPEIF media entity
+ * @local: Pad at the local end of the link
+ * @remote: Pad at the remote end of the link
+ * @flags: Link flags
+ *
+ * return -EINVAL or zero on success
+ */
+static int ipipeif_link_setup(struct media_entity *entity,
+                          const struct media_pad *local,
+                          const struct media_pad *remote, u32 flags)
+{
+       struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
+       struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
+       struct iss_device *iss = to_iss_device(ipipeif);
+
+       switch (local->index | media_entity_type(remote->entity)) {
+       case IPIPEIF_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+               /* Read from the sensor CSI2a or CSI2b. */
+               if (!(flags & MEDIA_LNK_FL_ENABLED)) {
+                       ipipeif->input = IPIPEIF_INPUT_NONE;
+                       break;
+               }
+
+               if (ipipeif->input != IPIPEIF_INPUT_NONE)
+                       return -EBUSY;
+
+               if (remote->entity == &iss->csi2a.subdev.entity)
+                       ipipeif->input = IPIPEIF_INPUT_CSI2A;
+               else if (remote->entity == &iss->csi2b.subdev.entity)
+                       ipipeif->input = IPIPEIF_INPUT_CSI2B;
+
+               break;
+
+       case IPIPEIF_PAD_SOURCE_ISIF_SF | MEDIA_ENT_T_DEVNODE:
+               /* Write to memory */
+               if (flags & MEDIA_LNK_FL_ENABLED) {
+                       if (ipipeif->output & ~IPIPEIF_OUTPUT_MEMORY)
+                               return -EBUSY;
+                       ipipeif->output |= IPIPEIF_OUTPUT_MEMORY;
+               } else {
+                       ipipeif->output &= ~IPIPEIF_OUTPUT_MEMORY;
+               }
+               break;
+
+       case IPIPEIF_PAD_SOURCE_VP | MEDIA_ENT_T_V4L2_SUBDEV:
+               /* Send to IPIPE/RESIZER */
+               if (flags & MEDIA_LNK_FL_ENABLED) {
+                       if (ipipeif->output & ~IPIPEIF_OUTPUT_VP)
+                               return -EBUSY;
+                       ipipeif->output |= IPIPEIF_OUTPUT_VP;
+               } else {
+                       ipipeif->output &= ~IPIPEIF_OUTPUT_VP;
+               }
+               break;
+
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+/* media operations */
+static const struct media_entity_operations ipipeif_media_ops = {
+       .link_setup = ipipeif_link_setup,
+       .link_validate = v4l2_subdev_link_validate,
+};
+
+/*
+ * ipipeif_init_entities - Initialize V4L2 subdev and media entity
+ * @ipipeif: ISS ISP IPIPEIF module
+ *
+ * Return 0 on success and a negative error code on failure.
+ */
+static int ipipeif_init_entities(struct iss_ipipeif_device *ipipeif)
+{
+       struct v4l2_subdev *sd = &ipipeif->subdev;
+       struct media_pad *pads = ipipeif->pads;
+       struct media_entity *me = &sd->entity;
+       int ret;
+
+       ipipeif->input = IPIPEIF_INPUT_NONE;
+
+       v4l2_subdev_init(sd, &ipipeif_v4l2_ops);
+       sd->internal_ops = &ipipeif_v4l2_internal_ops;
+       strlcpy(sd->name, "OMAP4 ISS ISP IPIPEIF", sizeof(sd->name));
+       sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
+       v4l2_set_subdevdata(sd, ipipeif);
+       sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+
+       pads[IPIPEIF_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
+       pads[IPIPEIF_PAD_SOURCE_ISIF_SF].flags = MEDIA_PAD_FL_SOURCE;
+       pads[IPIPEIF_PAD_SOURCE_VP].flags = MEDIA_PAD_FL_SOURCE;
+
+       me->ops = &ipipeif_media_ops;
+       ret = media_entity_init(me, IPIPEIF_PADS_NUM, pads, 0);
+       if (ret < 0)
+               return ret;
+
+       ipipeif_init_formats(sd, NULL);
+
+       ipipeif->video_out.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+       ipipeif->video_out.ops = &ipipeif_video_ops;
+       ipipeif->video_out.iss = to_iss_device(ipipeif);
+       ipipeif->video_out.capture_mem = PAGE_ALIGN(4096 * 4096) * 3;
+       ipipeif->video_out.bpl_alignment = 32;
+       ipipeif->video_out.bpl_zero_padding = 1;
+       ipipeif->video_out.bpl_max = 0x1ffe0;
+
+       ret = omap4iss_video_init(&ipipeif->video_out, "ISP IPIPEIF");
+       if (ret < 0)
+               return ret;
+
+       /* Connect the IPIPEIF subdev to the video node. */
+       ret = media_entity_create_link(&ipipeif->subdev.entity, IPIPEIF_PAD_SOURCE_ISIF_SF,
+                       &ipipeif->video_out.video.entity, 0, 0);
+       if (ret < 0)
+               return ret;
+
+       return 0;
+}
+
+void omap4iss_ipipeif_unregister_entities(struct iss_ipipeif_device *ipipeif)
+{
+       media_entity_cleanup(&ipipeif->subdev.entity);
+
+       v4l2_device_unregister_subdev(&ipipeif->subdev);
+       omap4iss_video_unregister(&ipipeif->video_out);
+}
+
+int omap4iss_ipipeif_register_entities(struct iss_ipipeif_device *ipipeif,
+       struct v4l2_device *vdev)
+{
+       int ret;
+
+       /* Register the subdev and video node. */
+       ret = v4l2_device_register_subdev(vdev, &ipipeif->subdev);
+       if (ret < 0)
+               goto error;
+
+       ret = omap4iss_video_register(&ipipeif->video_out, vdev);
+       if (ret < 0)
+               goto error;
+
+       return 0;
+
+error:
+       omap4iss_ipipeif_unregister_entities(ipipeif);
+       return ret;
+}
+
+/* -----------------------------------------------------------------------------
+ * ISP IPIPEIF initialisation and cleanup
+ */
+
+/*
+ * omap4iss_ipipeif_init - IPIPEIF module initialization.
+ * @iss: Device pointer specific to the OMAP4 ISS.
+ *
+ * TODO: Get the initialisation values from platform data.
+ *
+ * Return 0 on success or a negative error code otherwise.
+ */
+int omap4iss_ipipeif_init(struct iss_device *iss)
+{
+       struct iss_ipipeif_device *ipipeif = &iss->ipipeif;
+
+       ipipeif->state = ISS_PIPELINE_STREAM_STOPPED;
+       init_waitqueue_head(&ipipeif->wait);
+
+       return ipipeif_init_entities(ipipeif);
+}
+
+/*
+ * omap4iss_ipipeif_cleanup - IPIPEIF module cleanup.
+ * @iss: Device pointer specific to the OMAP4 ISS.
+ */
+void omap4iss_ipipeif_cleanup(struct iss_device *iss)
+{
+       /* FIXME: are you sure there's nothing to do? */
+}
diff --git a/drivers/staging/media/omap4iss/iss_ipipeif.h b/drivers/staging/media/omap4iss/iss_ipipeif.h
new file mode 100644 (file)
index 0000000..cbdccb9
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - ISP IPIPEIF module
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#ifndef OMAP4_ISS_IPIPEIF_H
+#define OMAP4_ISS_IPIPEIF_H
+
+#include "iss_video.h"
+
+enum ipipeif_input_entity {
+       IPIPEIF_INPUT_NONE,
+       IPIPEIF_INPUT_CSI2A,
+       IPIPEIF_INPUT_CSI2B
+};
+
+#define IPIPEIF_OUTPUT_MEMORY          (1 << 0)
+#define IPIPEIF_OUTPUT_VP              (1 << 1)
+
+/* Sink and source IPIPEIF pads */
+#define IPIPEIF_PAD_SINK                       0
+#define IPIPEIF_PAD_SOURCE_ISIF_SF             1
+#define IPIPEIF_PAD_SOURCE_VP                  2
+#define IPIPEIF_PADS_NUM                       3
+
+/*
+ * struct iss_ipipeif_device - Structure for the IPIPEIF module to store its own
+ *                         information
+ * @subdev: V4L2 subdevice
+ * @pads: Sink and source media entity pads
+ * @formats: Active video formats
+ * @input: Active input
+ * @output: Active outputs
+ * @video_out: Output video node
+ * @error: A hardware error occurred during capture
+ * @alaw: A-law compression enabled (1) or disabled (0)
+ * @lpf: Low pass filter enabled (1) or disabled (0)
+ * @obclamp: Optical-black clamp enabled (1) or disabled (0)
+ * @fpc_en: Faulty pixels correction enabled (1) or disabled (0)
+ * @blcomp: Black level compensation configuration
+ * @clamp: Optical-black or digital clamp configuration
+ * @fpc: Faulty pixels correction configuration
+ * @lsc: Lens shading compensation configuration
+ * @update: Bitmask of controls to update during the next interrupt
+ * @shadow_update: Controls update in progress by userspace
+ * @syncif: Interface synchronization configuration
+ * @vpcfg: Video port configuration
+ * @underrun: A buffer underrun occurred and a new buffer has been queued
+ * @state: Streaming state
+ * @lock: Serializes shadow_update with interrupt handler
+ * @wait: Wait queue used to stop the module
+ * @stopping: Stopping state
+ * @ioctl_lock: Serializes ioctl calls and LSC requests freeing
+ */
+struct iss_ipipeif_device {
+       struct v4l2_subdev subdev;
+       struct media_pad pads[IPIPEIF_PADS_NUM];
+       struct v4l2_mbus_framefmt formats[IPIPEIF_PADS_NUM];
+
+       enum ipipeif_input_entity input;
+       unsigned int output;
+       struct iss_video video_out;
+       unsigned int error;
+
+       enum iss_pipeline_stream_state state;
+       wait_queue_head_t wait;
+       atomic_t stopping;
+};
+
+struct iss_device;
+
+int omap4iss_ipipeif_init(struct iss_device *iss);
+void omap4iss_ipipeif_cleanup(struct iss_device *iss);
+int omap4iss_ipipeif_register_entities(struct iss_ipipeif_device *ipipeif,
+       struct v4l2_device *vdev);
+void omap4iss_ipipeif_unregister_entities(struct iss_ipipeif_device *ipipeif);
+
+int omap4iss_ipipeif_busy(struct iss_ipipeif_device *ipipeif);
+void omap4iss_ipipeif_isr(struct iss_ipipeif_device *ipipeif, u32 events);
+void omap4iss_ipipeif_restore_context(struct iss_device *iss);
+void omap4iss_ipipeif_max_rate(struct iss_ipipeif_device *ipipeif,
+       unsigned int *max_rate);
+
+#endif /* OMAP4_ISS_IPIPEIF_H */
diff --git a/drivers/staging/media/omap4iss/iss_regs.h b/drivers/staging/media/omap4iss/iss_regs.h
new file mode 100644 (file)
index 0000000..7327d0c
--- /dev/null
@@ -0,0 +1,883 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - Register defines
+ *
+ * Copyright (C) 2012 Texas Instruments.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#ifndef _OMAP4_ISS_REGS_H_
+#define _OMAP4_ISS_REGS_H_
+
+/* ISS */
+#define ISS_HL_REVISION                                        0x0
+
+#define ISS_HL_SYSCONFIG                               0x10
+#define ISS_HL_SYSCONFIG_IDLEMODE_SHIFT                        2
+#define ISS_HL_SYSCONFIG_IDLEMODE_FORCEIDLE            0x0
+#define ISS_HL_SYSCONFIG_IDLEMODE_NOIDLE               0x1
+#define ISS_HL_SYSCONFIG_IDLEMODE_SMARTIDLE            0x2
+#define ISS_HL_SYSCONFIG_SOFTRESET                     (1 << 0)
+
+#define ISS_HL_IRQSTATUS_5                             (0x24 + (0x10 * 5))
+#define ISS_HL_IRQENABLE_5_SET                         (0x28 + (0x10 * 5))
+#define ISS_HL_IRQENABLE_5_CLR                         (0x2C + (0x10 * 5))
+
+#define ISS_HL_IRQ_BTE                                 (1 << 11)
+#define ISS_HL_IRQ_CBUFF                               (1 << 10)
+#define ISS_HL_IRQ_CSIB                                        (1 << 5)
+#define ISS_HL_IRQ_CSIA                                        (1 << 4)
+#define ISS_HL_IRQ_ISP(i)                              (1 << (i))
+
+#define ISS_CTRL                                       0x80
+#define ISS_CTRL_CLK_DIV_MASK                          (3 << 4)
+#define ISS_CTRL_INPUT_SEL_MASK                                (3 << 2)
+#define ISS_CTRL_INPUT_SEL_CSI2A                       (0 << 2)
+#define ISS_CTRL_INPUT_SEL_CSI2B                       (1 << 2)
+#define ISS_CTRL_SYNC_DETECT_VS_RAISING                        (3 << 0)
+
+#define ISS_CLKCTRL                                    0x84
+#define ISS_CLKCTRL_VPORT2_CLK                         (1 << 30)
+#define ISS_CLKCTRL_VPORT1_CLK                         (1 << 29)
+#define ISS_CLKCTRL_VPORT0_CLK                         (1 << 28)
+#define ISS_CLKCTRL_CCP2                               (1 << 4)
+#define ISS_CLKCTRL_CSI2_B                             (1 << 3)
+#define ISS_CLKCTRL_CSI2_A                             (1 << 2)
+#define ISS_CLKCTRL_ISP                                        (1 << 1)
+#define ISS_CLKCTRL_SIMCOP                             (1 << 0)
+
+#define ISS_CLKSTAT                                    0x88
+#define ISS_CLKSTAT_VPORT2_CLK                         (1 << 30)
+#define ISS_CLKSTAT_VPORT1_CLK                         (1 << 29)
+#define ISS_CLKSTAT_VPORT0_CLK                         (1 << 28)
+#define ISS_CLKSTAT_CCP2                               (1 << 4)
+#define ISS_CLKSTAT_CSI2_B                             (1 << 3)
+#define ISS_CLKSTAT_CSI2_A                             (1 << 2)
+#define ISS_CLKSTAT_ISP                                        (1 << 1)
+#define ISS_CLKSTAT_SIMCOP                             (1 << 0)
+
+#define ISS_PM_STATUS                                  0x8C
+#define ISS_PM_STATUS_CBUFF_PM_MASK                    (3 << 12)
+#define ISS_PM_STATUS_BTE_PM_MASK                      (3 << 10)
+#define ISS_PM_STATUS_SIMCOP_PM_MASK                   (3 << 8)
+#define ISS_PM_STATUS_ISP_PM_MASK                      (3 << 6)
+#define ISS_PM_STATUS_CCP2_PM_MASK                     (3 << 4)
+#define ISS_PM_STATUS_CSI2_B_PM_MASK                   (3 << 2)
+#define ISS_PM_STATUS_CSI2_A_PM_MASK                   (3 << 0)
+
+#define REGISTER0                                      0x0
+#define REGISTER0_HSCLOCKCONFIG                                (1 << 24)
+#define REGISTER0_THS_TERM_MASK                                (0xFF << 8)
+#define REGISTER0_THS_TERM_SHIFT                       8
+#define REGISTER0_THS_SETTLE_MASK                      (0xFF << 0)
+#define REGISTER0_THS_SETTLE_SHIFT                     0
+
+#define REGISTER1                                      0x4
+#define REGISTER1_RESET_DONE_CTRLCLK                   (1 << 29)
+#define REGISTER1_CLOCK_MISS_DETECTOR_STATUS           (1 << 25)
+#define REGISTER1_TCLK_TERM_MASK                       (0x3F << 18)
+#define REGISTER1_TCLK_TERM_SHIFT                      18
+#define REGISTER1_DPHY_HS_SYNC_PATTERN_SHIFT           10
+#define REGISTER1_CTRLCLK_DIV_FACTOR_MASK              (0x3 << 8)
+#define REGISTER1_CTRLCLK_DIV_FACTOR_SHIFT             8
+#define REGISTER1_TCLK_SETTLE_MASK                     (0xFF << 0)
+#define REGISTER1_TCLK_SETTLE_SHIFT                    0
+
+#define REGISTER2                                      0x8
+
+#define CSI2_SYSCONFIG                                 0x10
+#define CSI2_SYSCONFIG_MSTANDBY_MODE_MASK              (3 << 12)
+#define CSI2_SYSCONFIG_MSTANDBY_MODE_FORCE             (0 << 12)
+#define CSI2_SYSCONFIG_MSTANDBY_MODE_NO                        (1 << 12)
+#define CSI2_SYSCONFIG_MSTANDBY_MODE_SMART             (2 << 12)
+#define CSI2_SYSCONFIG_SOFT_RESET                      (1 << 1)
+#define CSI2_SYSCONFIG_AUTO_IDLE                       (1 << 0)
+
+#define CSI2_SYSSTATUS                                 0x14
+#define CSI2_SYSSTATUS_RESET_DONE                      (1 << 0)
+
+#define CSI2_IRQSTATUS                                 0x18
+#define CSI2_IRQENABLE                                 0x1C
+
+/* Shared bits across CSI2_IRQENABLE and IRQSTATUS */
+
+#define CSI2_IRQ_OCP_ERR                               (1 << 14)
+#define CSI2_IRQ_SHORT_PACKET                          (1 << 13)
+#define CSI2_IRQ_ECC_CORRECTION                                (1 << 12)
+#define CSI2_IRQ_ECC_NO_CORRECTION                     (1 << 11)
+#define CSI2_IRQ_COMPLEXIO_ERR                         (1 << 9)
+#define CSI2_IRQ_FIFO_OVF                              (1 << 8)
+#define CSI2_IRQ_CONTEXT0                              (1 << 0)
+
+#define CSI2_CTRL                                      0x40
+#define CSI2_CTRL_MFLAG_LEVH_MASK                      (7 << 20)
+#define CSI2_CTRL_MFLAG_LEVH_SHIFT                     20
+#define CSI2_CTRL_MFLAG_LEVL_MASK                      (7 << 17)
+#define CSI2_CTRL_MFLAG_LEVL_SHIFT                     17
+#define CSI2_CTRL_BURST_SIZE_EXPAND                    (1 << 16)
+#define CSI2_CTRL_VP_CLK_EN                            (1 << 15)
+#define CSI2_CTRL_NON_POSTED_WRITE                     (1 << 13)
+#define CSI2_CTRL_VP_ONLY_EN                           (1 << 11)
+#define CSI2_CTRL_VP_OUT_CTRL_MASK                     (3 << 8)
+#define CSI2_CTRL_VP_OUT_CTRL_SHIFT                    8
+#define CSI2_CTRL_DBG_EN                               (1 << 7)
+#define CSI2_CTRL_BURST_SIZE_MASK                      (3 << 5)
+#define CSI2_CTRL_ENDIANNESS                           (1 << 4)
+#define CSI2_CTRL_FRAME                                        (1 << 3)
+#define CSI2_CTRL_ECC_EN                               (1 << 2)
+#define CSI2_CTRL_IF_EN                                        (1 << 0)
+
+#define CSI2_DBG_H                                     0x44
+
+#define CSI2_COMPLEXIO_CFG                             0x50
+#define CSI2_COMPLEXIO_CFG_RESET_CTRL                  (1 << 30)
+#define CSI2_COMPLEXIO_CFG_RESET_DONE                  (1 << 29)
+#define CSI2_COMPLEXIO_CFG_PWD_CMD_MASK                        (3 << 27)
+#define CSI2_COMPLEXIO_CFG_PWD_CMD_OFF                 (0 << 27)
+#define CSI2_COMPLEXIO_CFG_PWD_CMD_ON                  (1 << 27)
+#define CSI2_COMPLEXIO_CFG_PWD_CMD_ULP                 (2 << 27)
+#define CSI2_COMPLEXIO_CFG_PWD_STATUS_MASK             (3 << 25)
+#define CSI2_COMPLEXIO_CFG_PWD_STATUS_OFF              (0 << 25)
+#define CSI2_COMPLEXIO_CFG_PWD_STATUS_ON               (1 << 25)
+#define CSI2_COMPLEXIO_CFG_PWD_STATUS_ULP              (2 << 25)
+#define CSI2_COMPLEXIO_CFG_PWR_AUTO                    (1 << 24)
+#define CSI2_COMPLEXIO_CFG_DATA_POL(i)                 (1 << (((i) * 4) + 3))
+#define CSI2_COMPLEXIO_CFG_DATA_POSITION_MASK(i)       (7 << ((i) * 4))
+#define CSI2_COMPLEXIO_CFG_DATA_POSITION_SHIFT(i)      ((i) * 4)
+#define CSI2_COMPLEXIO_CFG_CLOCK_POL                   (1 << 3)
+#define CSI2_COMPLEXIO_CFG_CLOCK_POSITION_MASK         (7 << 0)
+#define CSI2_COMPLEXIO_CFG_CLOCK_POSITION_SHIFT                0
+
+#define CSI2_COMPLEXIO_IRQSTATUS                       0x54
+
+#define CSI2_SHORT_PACKET                              0x5C
+
+#define CSI2_COMPLEXIO_IRQENABLE                       0x60
+
+/* Shared bits across CSI2_COMPLEXIO_IRQENABLE and IRQSTATUS */
+#define CSI2_COMPLEXIO_IRQ_STATEALLULPMEXIT            (1 << 26)
+#define CSI2_COMPLEXIO_IRQ_STATEALLULPMENTER           (1 << 25)
+#define CSI2_COMPLEXIO_IRQ_STATEULPM5                  (1 << 24)
+#define CSI2_COMPLEXIO_IRQ_STATEULPM4                  (1 << 23)
+#define CSI2_COMPLEXIO_IRQ_STATEULPM3                  (1 << 22)
+#define CSI2_COMPLEXIO_IRQ_STATEULPM2                  (1 << 21)
+#define CSI2_COMPLEXIO_IRQ_STATEULPM1                  (1 << 20)
+#define CSI2_COMPLEXIO_IRQ_ERRCONTROL5                 (1 << 19)
+#define CSI2_COMPLEXIO_IRQ_ERRCONTROL4                 (1 << 18)
+#define CSI2_COMPLEXIO_IRQ_ERRCONTROL3                 (1 << 17)
+#define CSI2_COMPLEXIO_IRQ_ERRCONTROL2                 (1 << 16)
+#define CSI2_COMPLEXIO_IRQ_ERRCONTROL1                 (1 << 15)
+#define CSI2_COMPLEXIO_IRQ_ERRESC5                     (1 << 14)
+#define CSI2_COMPLEXIO_IRQ_ERRESC4                     (1 << 13)
+#define CSI2_COMPLEXIO_IRQ_ERRESC3                     (1 << 12)
+#define CSI2_COMPLEXIO_IRQ_ERRESC2                     (1 << 11)
+#define CSI2_COMPLEXIO_IRQ_ERRESC1                     (1 << 10)
+#define CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS5               (1 << 9)
+#define CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS4               (1 << 8)
+#define CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS3               (1 << 7)
+#define CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS2               (1 << 6)
+#define CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS1               (1 << 5)
+#define CSI2_COMPLEXIO_IRQ_ERRSOTHS5                   (1 << 4)
+#define CSI2_COMPLEXIO_IRQ_ERRSOTHS4                   (1 << 3)
+#define CSI2_COMPLEXIO_IRQ_ERRSOTHS3                   (1 << 2)
+#define CSI2_COMPLEXIO_IRQ_ERRSOTHS2                   (1 << 1)
+#define CSI2_COMPLEXIO_IRQ_ERRSOTHS1                   (1 << 0)
+
+#define CSI2_DBG_P                                     0x68
+
+#define CSI2_TIMING                                    0x6C
+#define CSI2_TIMING_FORCE_RX_MODE_IO1                  (1 << 15)
+#define CSI2_TIMING_STOP_STATE_X16_IO1                 (1 << 14)
+#define CSI2_TIMING_STOP_STATE_X4_IO1                  (1 << 13)
+#define CSI2_TIMING_STOP_STATE_COUNTER_IO1_MASK                (0x1FFF << 0)
+#define CSI2_TIMING_STOP_STATE_COUNTER_IO1_SHIFT       0
+
+#define CSI2_CTX_CTRL1(i)                              (0x70 + (0x20 * i))
+#define CSI2_CTX_CTRL1_GENERIC                         (1 << 30)
+#define CSI2_CTX_CTRL1_TRANSCODE                       (0xF << 24)
+#define CSI2_CTX_CTRL1_FEC_NUMBER_MASK                 (0xFF << 16)
+#define CSI2_CTX_CTRL1_COUNT_MASK                      (0xFF << 8)
+#define CSI2_CTX_CTRL1_COUNT_SHIFT                     8
+#define CSI2_CTX_CTRL1_EOF_EN                          (1 << 7)
+#define CSI2_CTX_CTRL1_EOL_EN                          (1 << 6)
+#define CSI2_CTX_CTRL1_CS_EN                           (1 << 5)
+#define CSI2_CTX_CTRL1_COUNT_UNLOCK                    (1 << 4)
+#define CSI2_CTX_CTRL1_PING_PONG                       (1 << 3)
+#define CSI2_CTX_CTRL1_CTX_EN                          (1 << 0)
+
+#define CSI2_CTX_CTRL2(i)                              (0x74 + (0x20 * i))
+#define CSI2_CTX_CTRL2_USER_DEF_MAP_SHIFT              13
+#define CSI2_CTX_CTRL2_USER_DEF_MAP_MASK               \
+               (0x3 << CSI2_CTX_CTRL2_USER_DEF_MAP_SHIFT)
+#define CSI2_CTX_CTRL2_VIRTUAL_ID_MASK                 (3 << 11)
+#define CSI2_CTX_CTRL2_VIRTUAL_ID_SHIFT                        11
+#define CSI2_CTX_CTRL2_DPCM_PRED                       (1 << 10)
+#define CSI2_CTX_CTRL2_FORMAT_MASK                     (0x3FF << 0)
+#define CSI2_CTX_CTRL2_FORMAT_SHIFT                    0
+
+#define CSI2_CTX_DAT_OFST(i)                           (0x78 + (0x20 * i))
+#define CSI2_CTX_DAT_OFST_MASK                         (0xFFF << 5)
+
+#define CSI2_CTX_PING_ADDR(i)                          (0x7C + (0x20 * i))
+#define CSI2_CTX_PING_ADDR_MASK                                0xFFFFFFE0
+
+#define CSI2_CTX_PONG_ADDR(i)                          (0x80 + (0x20 * i))
+#define CSI2_CTX_PONG_ADDR_MASK                                CSI2_CTX_PING_ADDR_MASK
+
+#define CSI2_CTX_IRQENABLE(i)                          (0x84 + (0x20 * i))
+#define CSI2_CTX_IRQSTATUS(i)                          (0x88 + (0x20 * i))
+
+#define CSI2_CTX_CTRL3(i)                              (0x8C + (0x20 * i))
+#define CSI2_CTX_CTRL3_ALPHA_SHIFT                     5
+#define CSI2_CTX_CTRL3_ALPHA_MASK                      \
+               (0x3fff << CSI2_CTX_CTRL3_ALPHA_SHIFT)
+
+/* Shared bits across CSI2_CTX_IRQENABLE and IRQSTATUS */
+#define CSI2_CTX_IRQ_ECC_CORRECTION                    (1 << 8)
+#define CSI2_CTX_IRQ_LINE_NUMBER                       (1 << 7)
+#define CSI2_CTX_IRQ_FRAME_NUMBER                      (1 << 6)
+#define CSI2_CTX_IRQ_CS                                        (1 << 5)
+#define CSI2_CTX_IRQ_LE                                        (1 << 3)
+#define CSI2_CTX_IRQ_LS                                        (1 << 2)
+#define CSI2_CTX_IRQ_FE                                        (1 << 1)
+#define CSI2_CTX_IRQ_FS                                        (1 << 0)
+
+/* ISS BTE */
+#define BTE_CTRL                                       (0x0030)
+#define BTE_CTRL_BW_LIMITER_MASK                       (0x3FF << 22)
+#define BTE_CTRL_BW_LIMITER_SHIFT                      22
+
+/* ISS ISP_SYS1 */
+#define ISP5_REVISION                                  (0x0000)
+#define ISP5_SYSCONFIG                                 (0x0010)
+#define ISP5_SYSCONFIG_STANDBYMODE_MASK                        (3 << 4)
+#define ISP5_SYSCONFIG_STANDBYMODE_FORCE               (0 << 4)
+#define ISP5_SYSCONFIG_STANDBYMODE_NO                  (1 << 4)
+#define ISP5_SYSCONFIG_STANDBYMODE_SMART               (2 << 4)
+#define ISP5_SYSCONFIG_SOFTRESET                       (1 << 1)
+
+#define ISP5_IRQSTATUS(i)                              (0x0028 + (0x10 * (i)))
+#define ISP5_IRQENABLE_SET(i)                          (0x002C + (0x10 * (i)))
+#define ISP5_IRQENABLE_CLR(i)                          (0x0030 + (0x10 * (i)))
+
+/* Bits shared for ISP5_IRQ* registers */
+#define ISP5_IRQ_OCP_ERR                               (1 << 31)
+#define ISP5_IRQ_RSZ_INT_EOF0                          (1 << 22)
+#define ISP5_IRQ_RSZ_FIFO_IN_BLK                       (1 << 19)
+#define ISP5_IRQ_RSZ_FIFO_OVF                          (1 << 18)
+#define ISP5_IRQ_RSZ_INT_CYC_RSZA                      (1 << 16)
+#define ISP5_IRQ_RSZ_INT_DMA                           (1 << 15)
+#define ISP5_IRQ_IPIPEIF                               (1 << 9)
+#define ISP5_IRQ_ISIF3                                 (1 << 3)
+#define ISP5_IRQ_ISIF2                                 (1 << 2)
+#define ISP5_IRQ_ISIF1                                 (1 << 1)
+#define ISP5_IRQ_ISIF0                                 (1 << 0)
+
+#define ISP5_CTRL                                      (0x006C)
+#define ISP5_CTRL_MSTANDBY                             (1 << 24)
+#define ISP5_CTRL_VD_PULSE_EXT                         (1 << 23)
+#define ISP5_CTRL_MSTANDBY_WAIT                                (1 << 20)
+#define ISP5_CTRL_BL_CLK_ENABLE                                (1 << 15)
+#define ISP5_CTRL_ISIF_CLK_ENABLE                      (1 << 14)
+#define ISP5_CTRL_H3A_CLK_ENABLE                       (1 << 13)
+#define ISP5_CTRL_RSZ_CLK_ENABLE                       (1 << 12)
+#define ISP5_CTRL_IPIPE_CLK_ENABLE                     (1 << 11)
+#define ISP5_CTRL_IPIPEIF_CLK_ENABLE                   (1 << 10)
+#define ISP5_CTRL_SYNC_ENABLE                          (1 << 9)
+#define ISP5_CTRL_PSYNC_CLK_SEL                                (1 << 8)
+
+/* ISS ISP ISIF register offsets */
+#define ISIF_SYNCEN                                    (0x0000)
+#define ISIF_SYNCEN_DWEN                               (1 << 1)
+#define ISIF_SYNCEN_SYEN                               (1 << 0)
+
+#define ISIF_MODESET                                   (0x0004)
+#define ISIF_MODESET_INPMOD_MASK                       (3 << 12)
+#define ISIF_MODESET_INPMOD_RAW                                (0 << 12)
+#define ISIF_MODESET_INPMOD_YCBCR16                    (1 << 12)
+#define ISIF_MODESET_INPMOD_YCBCR8                     (2 << 12)
+#define ISIF_MODESET_CCDW_MASK                         (7 << 8)
+#define ISIF_MODESET_CCDW_2BIT                         (2 << 8)
+#define ISIF_MODESET_CCDMD                             (1 << 7)
+#define ISIF_MODESET_SWEN                              (1 << 5)
+#define ISIF_MODESET_HDPOL                             (1 << 3)
+#define ISIF_MODESET_VDPOL                             (1 << 2)
+
+#define ISIF_SPH                                       (0x0018)
+#define ISIF_SPH_MASK                                  (0x7FFF)
+
+#define ISIF_LNH                                       (0x001C)
+#define ISIF_LNH_MASK                                  (0x7FFF)
+
+#define ISIF_LNV                                       (0x0028)
+#define ISIF_LNV_MASK                                  (0x7FFF)
+
+#define ISIF_HSIZE                                     (0x0034)
+#define ISIF_HSIZE_ADCR                                        (1 << 12)
+#define ISIF_HSIZE_HSIZE_MASK                          (0xFFF)
+
+#define ISIF_CADU                                      (0x003C)
+#define ISIF_CADU_MASK                                 (0x7FF)
+
+#define ISIF_CADL                                      (0x0040)
+#define ISIF_CADL_MASK                                 (0xFFFF)
+
+#define ISIF_CCOLP                                     (0x004C)
+#define ISIF_CCOLP_CP0_F0_R                            (0 << 6)
+#define ISIF_CCOLP_CP0_F0_GR                           (1 << 6)
+#define ISIF_CCOLP_CP0_F0_B                            (3 << 6)
+#define ISIF_CCOLP_CP0_F0_GB                           (2 << 6)
+#define ISIF_CCOLP_CP1_F0_R                            (0 << 4)
+#define ISIF_CCOLP_CP1_F0_GR                           (1 << 4)
+#define ISIF_CCOLP_CP1_F0_B                            (3 << 4)
+#define ISIF_CCOLP_CP1_F0_GB                           (2 << 4)
+#define ISIF_CCOLP_CP2_F0_R                            (0 << 2)
+#define ISIF_CCOLP_CP2_F0_GR                           (1 << 2)
+#define ISIF_CCOLP_CP2_F0_B                            (3 << 2)
+#define ISIF_CCOLP_CP2_F0_GB                           (2 << 2)
+#define ISIF_CCOLP_CP3_F0_R                            (0 << 0)
+#define ISIF_CCOLP_CP3_F0_GR                           (1 << 0)
+#define ISIF_CCOLP_CP3_F0_B                            (3 << 0)
+#define ISIF_CCOLP_CP3_F0_GB                           (2 << 0)
+
+#define ISIF_VDINT0                                    (0x0070)
+#define ISIF_VDINT0_MASK                               (0x7FFF)
+
+#define ISIF_CGAMMAWD                                  (0x0080)
+#define ISIF_CGAMMAWD_GWDI_MASK                                (0xF << 1)
+#define ISIF_CGAMMAWD_GWDI_BIT11                       (0x4 << 1)
+
+#define ISIF_CCDCFG                                    (0x0088)
+#define ISIF_CCDCFG_Y8POS                              (1 << 11)
+
+/* ISS ISP IPIPEIF register offsets */
+#define IPIPEIF_ENABLE                                 (0x0000)
+
+#define IPIPEIF_CFG1                                   (0x0004)
+#define IPIPEIF_CFG1_INPSRC1_MASK                      (3 << 14)
+#define IPIPEIF_CFG1_INPSRC1_VPORT_RAW                 (0 << 14)
+#define IPIPEIF_CFG1_INPSRC1_SDRAM_RAW                 (1 << 14)
+#define IPIPEIF_CFG1_INPSRC1_ISIF_DARKFM               (2 << 14)
+#define IPIPEIF_CFG1_INPSRC1_SDRAM_YUV                 (3 << 14)
+#define IPIPEIF_CFG1_INPSRC2_MASK                      (3 << 2)
+#define IPIPEIF_CFG1_INPSRC2_ISIF                      (0 << 2)
+#define IPIPEIF_CFG1_INPSRC2_SDRAM_RAW                 (1 << 2)
+#define IPIPEIF_CFG1_INPSRC2_ISIF_DARKFM               (2 << 2)
+#define IPIPEIF_CFG1_INPSRC2_SDRAM_YUV                 (3 << 2)
+
+#define IPIPEIF_CFG2                                   (0x0030)
+#define IPIPEIF_CFG2_YUV8P                             (1 << 7)
+#define IPIPEIF_CFG2_YUV8                              (1 << 6)
+#define IPIPEIF_CFG2_YUV16                             (1 << 3)
+#define IPIPEIF_CFG2_VDPOL                             (1 << 2)
+#define IPIPEIF_CFG2_HDPOL                             (1 << 1)
+#define IPIPEIF_CFG2_INTSW                             (1 << 0)
+
+#define IPIPEIF_CLKDIV                                 (0x0040)
+
+/* ISS ISP IPIPE register offsets */
+#define IPIPE_SRC_EN                                   (0x0000)
+#define IPIPE_SRC_EN_EN                                        (1 << 0)
+
+#define IPIPE_SRC_MODE                                 (0x0004)
+#define IPIPE_SRC_MODE_WRT                             (1 << 1)
+#define IPIPE_SRC_MODE_OST                             (1 << 0)
+
+#define IPIPE_SRC_FMT                                  (0x0008)
+#define IPIPE_SRC_FMT_RAW2YUV                          (0 << 0)
+#define IPIPE_SRC_FMT_RAW2RAW                          (1 << 0)
+#define IPIPE_SRC_FMT_RAW2STATS                                (2 << 0)
+#define IPIPE_SRC_FMT_YUV2YUV                          (3 << 0)
+
+#define IPIPE_SRC_COL                                  (0x000C)
+#define IPIPE_SRC_COL_OO_R                             (0 << 6)
+#define IPIPE_SRC_COL_OO_GR                            (1 << 6)
+#define IPIPE_SRC_COL_OO_B                             (3 << 6)
+#define IPIPE_SRC_COL_OO_GB                            (2 << 6)
+#define IPIPE_SRC_COL_OE_R                             (0 << 4)
+#define IPIPE_SRC_COL_OE_GR                            (1 << 4)
+#define IPIPE_SRC_COL_OE_B                             (3 << 4)
+#define IPIPE_SRC_COL_OE_GB                            (2 << 4)
+#define IPIPE_SRC_COL_EO_R                             (0 << 2)
+#define IPIPE_SRC_COL_EO_GR                            (1 << 2)
+#define IPIPE_SRC_COL_EO_B                             (3 << 2)
+#define IPIPE_SRC_COL_EO_GB                            (2 << 2)
+#define IPIPE_SRC_COL_EE_R                             (0 << 0)
+#define IPIPE_SRC_COL_EE_GR                            (1 << 0)
+#define IPIPE_SRC_COL_EE_B                             (3 << 0)
+#define IPIPE_SRC_COL_EE_GB                            (2 << 0)
+
+#define IPIPE_SRC_VPS                                  (0x0010)
+#define IPIPE_SRC_VPS_MASK                             (0xFFFF)
+
+#define IPIPE_SRC_VSZ                                  (0x0014)
+#define IPIPE_SRC_VSZ_MASK                             (0x1FFF)
+
+#define IPIPE_SRC_HPS                                  (0x0018)
+#define IPIPE_SRC_HPS_MASK                             (0xFFFF)
+
+#define IPIPE_SRC_HSZ                                  (0x001C)
+#define IPIPE_SRC_HSZ_MASK                             (0x1FFE)
+
+#define IPIPE_SEL_SBU                                  (0x0020)
+
+#define IPIPE_SRC_STA                                  (0x0024)
+
+#define IPIPE_GCK_MMR                                  (0x0028)
+#define IPIPE_GCK_MMR_REG                              (1 << 0)
+
+#define IPIPE_GCK_PIX                                  (0x002C)
+#define IPIPE_GCK_PIX_G3                               (1 << 3)
+#define IPIPE_GCK_PIX_G2                               (1 << 2)
+#define IPIPE_GCK_PIX_G1                               (1 << 1)
+#define IPIPE_GCK_PIX_G0                               (1 << 0)
+
+#define IPIPE_DPC_LUT_EN                               (0x0034)
+#define IPIPE_DPC_LUT_SEL                              (0x0038)
+#define IPIPE_DPC_LUT_ADR                              (0x003C)
+#define IPIPE_DPC_LUT_SIZ                              (0x0040)
+
+#define IPIPE_DPC_OTF_EN                               (0x0044)
+#define IPIPE_DPC_OTF_TYP                              (0x0048)
+#define IPIPE_DPC_OTF_2_D_THR_R                                (0x004C)
+#define IPIPE_DPC_OTF_2_D_THR_GR                       (0x0050)
+#define IPIPE_DPC_OTF_2_D_THR_GB                       (0x0054)
+#define IPIPE_DPC_OTF_2_D_THR_B                                (0x0058)
+#define IPIPE_DPC_OTF_2_C_THR_R                                (0x005C)
+#define IPIPE_DPC_OTF_2_C_THR_GR                       (0x0060)
+#define IPIPE_DPC_OTF_2_C_THR_GB                       (0x0064)
+#define IPIPE_DPC_OTF_2_C_THR_B                                (0x0068)
+#define IPIPE_DPC_OTF_3_SHF                            (0x006C)
+#define IPIPE_DPC_OTF_3_D_THR                          (0x0070)
+#define IPIPE_DPC_OTF_3_D_SPL                          (0x0074)
+#define IPIPE_DPC_OTF_3_D_MIN                          (0x0078)
+#define IPIPE_DPC_OTF_3_D_MAX                          (0x007C)
+#define IPIPE_DPC_OTF_3_C_THR                          (0x0080)
+#define IPIPE_DPC_OTF_3_C_SLP                          (0x0084)
+#define IPIPE_DPC_OTF_3_C_MIN                          (0x0088)
+#define IPIPE_DPC_OTF_3_C_MAX                          (0x008C)
+
+#define IPIPE_LSC_VOFT                                 (0x0090)
+#define IPIPE_LSC_VA2                                  (0x0094)
+#define IPIPE_LSC_VA1                                  (0x0098)
+#define IPIPE_LSC_VS                                   (0x009C)
+#define IPIPE_LSC_HOFT                                 (0x00A0)
+#define IPIPE_LSC_HA2                                  (0x00A4)
+#define IPIPE_LSC_HA1                                  (0x00A8)
+#define IPIPE_LSC_HS                                   (0x00AC)
+#define IPIPE_LSC_GAN_R                                        (0x00B0)
+#define IPIPE_LSC_GAN_GR                               (0x00B4)
+#define IPIPE_LSC_GAN_GB                               (0x00B8)
+#define IPIPE_LSC_GAN_B                                        (0x00BC)
+#define IPIPE_LSC_OFT_R                                        (0x00C0)
+#define IPIPE_LSC_OFT_GR                               (0x00C4)
+#define IPIPE_LSC_OFT_GB                               (0x00C8)
+#define IPIPE_LSC_OFT_B                                        (0x00CC)
+#define IPIPE_LSC_SHF                                  (0x00D0)
+#define IPIPE_LSC_MAX                                  (0x00D4)
+
+#define IPIPE_D2F_1ST_EN                               (0x00D8)
+#define IPIPE_D2F_1ST_TYP                              (0x00DC)
+#define IPIPE_D2F_1ST_THR_00                           (0x00E0)
+#define IPIPE_D2F_1ST_THR_01                           (0x00E4)
+#define IPIPE_D2F_1ST_THR_02                           (0x00E8)
+#define IPIPE_D2F_1ST_THR_03                           (0x00EC)
+#define IPIPE_D2F_1ST_THR_04                           (0x00F0)
+#define IPIPE_D2F_1ST_THR_05                           (0x00F4)
+#define IPIPE_D2F_1ST_THR_06                           (0x00F8)
+#define IPIPE_D2F_1ST_THR_07                           (0x00FC)
+#define IPIPE_D2F_1ST_STR_00                           (0x0100)
+#define IPIPE_D2F_1ST_STR_01                           (0x0104)
+#define IPIPE_D2F_1ST_STR_02                           (0x0108)
+#define IPIPE_D2F_1ST_STR_03                           (0x010C)
+#define IPIPE_D2F_1ST_STR_04                           (0x0110)
+#define IPIPE_D2F_1ST_STR_05                           (0x0114)
+#define IPIPE_D2F_1ST_STR_06                           (0x0118)
+#define IPIPE_D2F_1ST_STR_07                           (0x011C)
+#define IPIPE_D2F_1ST_SPR_00                           (0x0120)
+#define IPIPE_D2F_1ST_SPR_01                           (0x0124)
+#define IPIPE_D2F_1ST_SPR_02                           (0x0128)
+#define IPIPE_D2F_1ST_SPR_03                           (0x012C)
+#define IPIPE_D2F_1ST_SPR_04                           (0x0130)
+#define IPIPE_D2F_1ST_SPR_05                           (0x0134)
+#define IPIPE_D2F_1ST_SPR_06                           (0x0138)
+#define IPIPE_D2F_1ST_SPR_07                           (0x013C)
+#define IPIPE_D2F_1ST_EDG_MIN                          (0x0140)
+#define IPIPE_D2F_1ST_EDG_MAX                          (0x0144)
+#define IPIPE_D2F_2ND_EN                               (0x0148)
+#define IPIPE_D2F_2ND_TYP                              (0x014C)
+#define IPIPE_D2F_2ND_THR00                            (0x0150)
+#define IPIPE_D2F_2ND_THR01                            (0x0154)
+#define IPIPE_D2F_2ND_THR02                            (0x0158)
+#define IPIPE_D2F_2ND_THR03                            (0x015C)
+#define IPIPE_D2F_2ND_THR04                            (0x0160)
+#define IPIPE_D2F_2ND_THR05                            (0x0164)
+#define IPIPE_D2F_2ND_THR06                            (0x0168)
+#define IPIPE_D2F_2ND_THR07                            (0x016C)
+#define IPIPE_D2F_2ND_STR_00                           (0x0170)
+#define IPIPE_D2F_2ND_STR_01                           (0x0174)
+#define IPIPE_D2F_2ND_STR_02                           (0x0178)
+#define IPIPE_D2F_2ND_STR_03                           (0x017C)
+#define IPIPE_D2F_2ND_STR_04                           (0x0180)
+#define IPIPE_D2F_2ND_STR_05                           (0x0184)
+#define IPIPE_D2F_2ND_STR_06                           (0x0188)
+#define IPIPE_D2F_2ND_STR_07                           (0x018C)
+#define IPIPE_D2F_2ND_SPR_00                           (0x0190)
+#define IPIPE_D2F_2ND_SPR_01                           (0x0194)
+#define IPIPE_D2F_2ND_SPR_02                           (0x0198)
+#define IPIPE_D2F_2ND_SPR_03                           (0x019C)
+#define IPIPE_D2F_2ND_SPR_04                           (0x01A0)
+#define IPIPE_D2F_2ND_SPR_05                           (0x01A4)
+#define IPIPE_D2F_2ND_SPR_06                           (0x01A8)
+#define IPIPE_D2F_2ND_SPR_07                           (0x01AC)
+#define IPIPE_D2F_2ND_EDG_MIN                          (0x01B0)
+#define IPIPE_D2F_2ND_EDG_MAX                          (0x01B4)
+
+#define IPIPE_GIC_EN                                   (0x01B8)
+#define IPIPE_GIC_TYP                                  (0x01BC)
+#define IPIPE_GIC_GAN                                  (0x01C0)
+#define IPIPE_GIC_NFGAIN                               (0x01C4)
+#define IPIPE_GIC_THR                                  (0x01C8)
+#define IPIPE_GIC_SLP                                  (0x01CC)
+
+#define IPIPE_WB2_OFT_R                                        (0x01D0)
+#define IPIPE_WB2_OFT_GR                               (0x01D4)
+#define IPIPE_WB2_OFT_GB                               (0x01D8)
+#define IPIPE_WB2_OFT_B                                        (0x01DC)
+
+#define IPIPE_WB2_WGN_R                                        (0x01E0)
+#define IPIPE_WB2_WGN_GR                               (0x01E4)
+#define IPIPE_WB2_WGN_GB                               (0x01E8)
+#define IPIPE_WB2_WGN_B                                        (0x01EC)
+
+#define IPIPE_CFA_MODE                                 (0x01F0)
+#define IPIPE_CFA_2DIR_HPF_THR                         (0x01F4)
+#define IPIPE_CFA_2DIR_HPF_SLP                         (0x01F8)
+#define IPIPE_CFA_2DIR_MIX_THR                         (0x01FC)
+#define IPIPE_CFA_2DIR_MIX_SLP                         (0x0200)
+#define IPIPE_CFA_2DIR_DIR_TRH                         (0x0204)
+#define IPIPE_CFA_2DIR_DIR_SLP                         (0x0208)
+#define IPIPE_CFA_2DIR_NDWT                            (0x020C)
+#define IPIPE_CFA_MONO_HUE_FRA                         (0x0210)
+#define IPIPE_CFA_MONO_EDG_THR                         (0x0214)
+#define IPIPE_CFA_MONO_THR_MIN                         (0x0218)
+
+#define IPIPE_CFA_MONO_THR_SLP                         (0x021C)
+#define IPIPE_CFA_MONO_SLP_MIN                         (0x0220)
+#define IPIPE_CFA_MONO_SLP_SLP                         (0x0224)
+#define IPIPE_CFA_MONO_LPWT                            (0x0228)
+
+#define IPIPE_RGB1_MUL_RR                              (0x022C)
+#define IPIPE_RGB1_MUL_GR                              (0x0230)
+#define IPIPE_RGB1_MUL_BR                              (0x0234)
+#define IPIPE_RGB1_MUL_RG                              (0x0238)
+#define IPIPE_RGB1_MUL_GG                              (0x023C)
+#define IPIPE_RGB1_MUL_BG                              (0x0240)
+#define IPIPE_RGB1_MUL_RB                              (0x0244)
+#define IPIPE_RGB1_MUL_GB                              (0x0248)
+#define IPIPE_RGB1_MUL_BB                              (0x024C)
+#define IPIPE_RGB1_OFT_OR                              (0x0250)
+#define IPIPE_RGB1_OFT_OG                              (0x0254)
+#define IPIPE_RGB1_OFT_OB                              (0x0258)
+#define IPIPE_GMM_CFG                                  (0x025C)
+#define IPIPE_RGB2_MUL_RR                              (0x0260)
+#define IPIPE_RGB2_MUL_GR                              (0x0264)
+#define IPIPE_RGB2_MUL_BR                              (0x0268)
+#define IPIPE_RGB2_MUL_RG                              (0x026C)
+#define IPIPE_RGB2_MUL_GG                              (0x0270)
+#define IPIPE_RGB2_MUL_BG                              (0x0274)
+#define IPIPE_RGB2_MUL_RB                              (0x0278)
+#define IPIPE_RGB2_MUL_GB                              (0x027C)
+#define IPIPE_RGB2_MUL_BB                              (0x0280)
+#define IPIPE_RGB2_OFT_OR                              (0x0284)
+#define IPIPE_RGB2_OFT_OG                              (0x0288)
+#define IPIPE_RGB2_OFT_OB                              (0x028C)
+
+#define IPIPE_YUV_ADJ                                  (0x0294)
+#define IPIPE_YUV_MUL_RY                               (0x0298)
+#define IPIPE_YUV_MUL_GY                               (0x029C)
+#define IPIPE_YUV_MUL_BY                               (0x02A0)
+#define IPIPE_YUV_MUL_RCB                              (0x02A4)
+#define IPIPE_YUV_MUL_GCB                              (0x02A8)
+#define IPIPE_YUV_MUL_BCB                              (0x02AC)
+#define IPIPE_YUV_MUL_RCR                              (0x02B0)
+#define IPIPE_YUV_MUL_GCR                              (0x02B4)
+#define IPIPE_YUV_MUL_BCR                              (0x02B8)
+#define IPIPE_YUV_OFT_Y                                        (0x02BC)
+#define IPIPE_YUV_OFT_CB                               (0x02C0)
+#define IPIPE_YUV_OFT_CR                               (0x02C4)
+
+#define IPIPE_YUV_PHS                                  (0x02C8)
+#define IPIPE_YUV_PHS_LPF                              (1 << 1)
+#define IPIPE_YUV_PHS_POS                              (1 << 0)
+
+#define IPIPE_YEE_EN                                   (0x02D4)
+#define IPIPE_YEE_TYP                                  (0x02D8)
+#define IPIPE_YEE_SHF                                  (0x02DC)
+#define IPIPE_YEE_MUL_00                               (0x02E0)
+#define IPIPE_YEE_MUL_01                               (0x02E4)
+#define IPIPE_YEE_MUL_02                               (0x02E8)
+#define IPIPE_YEE_MUL_10                               (0x02EC)
+#define IPIPE_YEE_MUL_11                               (0x02F0)
+#define IPIPE_YEE_MUL_12                               (0x02F4)
+#define IPIPE_YEE_MUL_20                               (0x02F8)
+#define IPIPE_YEE_MUL_21                               (0x02FC)
+#define IPIPE_YEE_MUL_22                               (0x0300)
+#define IPIPE_YEE_THR                                  (0x0304)
+#define IPIPE_YEE_E_GAN                                        (0x0308)
+#define IPIPE_YEE_E_THR_1                              (0x030C)
+#define IPIPE_YEE_E_THR_2                              (0x0310)
+#define IPIPE_YEE_G_GAN                                        (0x0314)
+#define IPIPE_YEE_G_OFT                                        (0x0318)
+
+#define IPIPE_CAR_EN                                   (0x031C)
+#define IPIPE_CAR_TYP                                  (0x0320)
+#define IPIPE_CAR_SW                                   (0x0324)
+#define IPIPE_CAR_HPF_TYP                              (0x0328)
+#define IPIPE_CAR_HPF_SHF                              (0x032C)
+#define IPIPE_CAR_HPF_THR                              (0x0330)
+#define IPIPE_CAR_GN1_GAN                              (0x0334)
+#define IPIPE_CAR_GN1_SHF                              (0x0338)
+#define IPIPE_CAR_GN1_MIN                              (0x033C)
+#define IPIPE_CAR_GN2_GAN                              (0x0340)
+#define IPIPE_CAR_GN2_SHF                              (0x0344)
+#define IPIPE_CAR_GN2_MIN                              (0x0348)
+#define IPIPE_CGS_EN                                   (0x034C)
+#define IPIPE_CGS_GN1_L_THR                            (0x0350)
+#define IPIPE_CGS_GN1_L_GAIN                           (0x0354)
+#define IPIPE_CGS_GN1_L_SHF                            (0x0358)
+#define IPIPE_CGS_GN1_L_MIN                            (0x035C)
+#define IPIPE_CGS_GN1_H_THR                            (0x0360)
+#define IPIPE_CGS_GN1_H_GAIN                           (0x0364)
+#define IPIPE_CGS_GN1_H_SHF                            (0x0368)
+#define IPIPE_CGS_GN1_H_MIN                            (0x036C)
+#define IPIPE_CGS_GN2_L_THR                            (0x0370)
+#define IPIPE_CGS_GN2_L_GAIN                           (0x0374)
+#define IPIPE_CGS_GN2_L_SHF                            (0x0378)
+#define IPIPE_CGS_GN2_L_MIN                            (0x037C)
+
+#define IPIPE_BOX_EN                                   (0x0380)
+#define IPIPE_BOX_MODE                                 (0x0384)
+#define IPIPE_BOX_TYP                                  (0x0388)
+#define IPIPE_BOX_SHF                                  (0x038C)
+#define IPIPE_BOX_SDR_SAD_H                            (0x0390)
+#define IPIPE_BOX_SDR_SAD_L                            (0x0394)
+
+#define IPIPE_HST_EN                                   (0x039C)
+#define IPIPE_HST_MODE                                 (0x03A0)
+#define IPIPE_HST_SEL                                  (0x03A4)
+#define IPIPE_HST_PARA                                 (0x03A8)
+#define IPIPE_HST_0_VPS                                        (0x03AC)
+#define IPIPE_HST_0_VSZ                                        (0x03B0)
+#define IPIPE_HST_0_HPS                                        (0x03B4)
+#define IPIPE_HST_0_HSZ                                        (0x03B8)
+#define IPIPE_HST_1_VPS                                        (0x03BC)
+#define IPIPE_HST_1_VSZ                                        (0x03C0)
+#define IPIPE_HST_1_HPS                                        (0x03C4)
+#define IPIPE_HST_1_HSZ                                        (0x03C8)
+#define IPIPE_HST_2_VPS                                        (0x03CC)
+#define IPIPE_HST_2_VSZ                                        (0x03D0)
+#define IPIPE_HST_2_HPS                                        (0x03D4)
+#define IPIPE_HST_2_HSZ                                        (0x03D8)
+#define IPIPE_HST_3_VPS                                        (0x03DC)
+#define IPIPE_HST_3_VSZ                                        (0x03E0)
+#define IPIPE_HST_3_HPS                                        (0x03E4)
+#define IPIPE_HST_3_HSZ                                        (0x03E8)
+#define IPIPE_HST_TBL                                  (0x03EC)
+#define IPIPE_HST_MUL_R                                        (0x03F0)
+#define IPIPE_HST_MUL_GR                               (0x03F4)
+#define IPIPE_HST_MUL_GB                               (0x03F8)
+#define IPIPE_HST_MUL_B                                        (0x03FC)
+
+#define IPIPE_BSC_EN                                   (0x0400)
+#define IPIPE_BSC_MODE                                 (0x0404)
+#define IPIPE_BSC_TYP                                  (0x0408)
+#define IPIPE_BSC_ROW_VCT                              (0x040C)
+#define IPIPE_BSC_ROW_SHF                              (0x0410)
+#define IPIPE_BSC_ROW_VPO                              (0x0414)
+#define IPIPE_BSC_ROW_VNU                              (0x0418)
+#define IPIPE_BSC_ROW_VSKIP                            (0x041C)
+#define IPIPE_BSC_ROW_HPO                              (0x0420)
+#define IPIPE_BSC_ROW_HNU                              (0x0424)
+#define IPIPE_BSC_ROW_HSKIP                            (0x0428)
+#define IPIPE_BSC_COL_VCT                              (0x042C)
+#define IPIPE_BSC_COL_SHF                              (0x0430)
+#define IPIPE_BSC_COL_VPO                              (0x0434)
+#define IPIPE_BSC_COL_VNU                              (0x0438)
+#define IPIPE_BSC_COL_VSKIP                            (0x043C)
+#define IPIPE_BSC_COL_HPO                              (0x0440)
+#define IPIPE_BSC_COL_HNU                              (0x0444)
+#define IPIPE_BSC_COL_HSKIP                            (0x0448)
+
+#define IPIPE_BSC_EN                                   (0x0400)
+
+/* ISS ISP Resizer register offsets */
+#define RSZ_REVISION                                   (0x0000)
+#define RSZ_SYSCONFIG                                  (0x0004)
+#define RSZ_SYSCONFIG_RSZB_CLK_EN                      (1 << 9)
+#define RSZ_SYSCONFIG_RSZA_CLK_EN                      (1 << 8)
+
+#define RSZ_IN_FIFO_CTRL                               (0x000C)
+#define RSZ_IN_FIFO_CTRL_THRLD_LOW_MASK                        (0x1FF << 16)
+#define RSZ_IN_FIFO_CTRL_THRLD_LOW_SHIFT               16
+#define RSZ_IN_FIFO_CTRL_THRLD_HIGH_MASK               (0x1FF << 0)
+#define RSZ_IN_FIFO_CTRL_THRLD_HIGH_SHIFT              0
+
+#define RSZ_FRACDIV                                    (0x0008)
+#define RSZ_FRACDIV_MASK                               (0xFFFF)
+
+#define RSZ_SRC_EN                                     (0x0020)
+#define RSZ_SRC_EN_SRC_EN                              (1 << 0)
+
+#define RSZ_SRC_MODE                                   (0x0024)
+#define RSZ_SRC_MODE_OST                               (1 << 0)
+#define RSZ_SRC_MODE_WRT                               (1 << 1)
+
+#define RSZ_SRC_FMT0                                   (0x0028)
+#define RSZ_SRC_FMT0_BYPASS                            (1 << 1)
+#define RSZ_SRC_FMT0_SEL                               (1 << 0)
+
+#define RSZ_SRC_FMT1                                   (0x002C)
+#define RSZ_SRC_FMT1_IN420                             (1 << 1)
+
+#define RSZ_SRC_VPS                                    (0x0030)
+#define RSZ_SRC_VSZ                                    (0x0034)
+#define RSZ_SRC_HPS                                    (0x0038)
+#define RSZ_SRC_HSZ                                    (0x003C)
+#define RSZ_DMA_RZA                                    (0x0040)
+#define RSZ_DMA_RZB                                    (0x0044)
+#define RSZ_DMA_STA                                    (0x0048)
+#define RSZ_GCK_MMR                                    (0x004C)
+#define RSZ_GCK_MMR_MMR                                        (1 << 0)
+
+#define RSZ_GCK_SDR                                    (0x0054)
+#define RSZ_GCK_SDR_CORE                               (1 << 0)
+
+#define RSZ_IRQ_RZA                                    (0x0058)
+#define RSZ_IRQ_RZA_MASK                               (0x1FFF)
+
+#define RSZ_IRQ_RZB                                    (0x005C)
+#define RSZ_IRQ_RZB_MASK                               (0x1FFF)
+
+#define RSZ_YUV_Y_MIN                                  (0x0060)
+#define RSZ_YUV_Y_MAX                                  (0x0064)
+#define RSZ_YUV_C_MIN                                  (0x0068)
+#define RSZ_YUV_C_MAX                                  (0x006C)
+
+#define RSZ_SEQ                                                (0x0074)
+#define RSZ_SEQ_HRVB                                   (1 << 2)
+#define RSZ_SEQ_HRVA                                   (1 << 0)
+
+#define RZA_EN                                         (0x0078)
+#define RZA_MODE                                       (0x007C)
+#define RZA_MODE_ONE_SHOT                              (1 << 0)
+
+#define RZA_420                                                (0x0080)
+#define RZA_I_VPS                                      (0x0084)
+#define RZA_I_HPS                                      (0x0088)
+#define RZA_O_VSZ                                      (0x008C)
+#define RZA_O_HSZ                                      (0x0090)
+#define RZA_V_PHS_Y                                    (0x0094)
+#define RZA_V_PHS_C                                    (0x0098)
+#define RZA_V_DIF                                      (0x009C)
+#define RZA_V_TYP                                      (0x00A0)
+#define RZA_V_LPF                                      (0x00A4)
+#define RZA_H_PHS                                      (0x00A8)
+#define RZA_H_DIF                                      (0x00B0)
+#define RZA_H_TYP                                      (0x00B4)
+#define RZA_H_LPF                                      (0x00B8)
+#define RZA_DWN_EN                                     (0x00BC)
+#define RZA_SDR_Y_BAD_H                                        (0x00D0)
+#define RZA_SDR_Y_BAD_L                                        (0x00D4)
+#define RZA_SDR_Y_SAD_H                                        (0x00D8)
+#define RZA_SDR_Y_SAD_L                                        (0x00DC)
+#define RZA_SDR_Y_OFT                                  (0x00E0)
+#define RZA_SDR_Y_PTR_S                                        (0x00E4)
+#define RZA_SDR_Y_PTR_E                                        (0x00E8)
+#define RZA_SDR_C_BAD_H                                        (0x00EC)
+#define RZA_SDR_C_BAD_L                                        (0x00F0)
+#define RZA_SDR_C_SAD_H                                        (0x00F4)
+#define RZA_SDR_C_SAD_L                                        (0x00F8)
+#define RZA_SDR_C_OFT                                  (0x00FC)
+#define RZA_SDR_C_PTR_S                                        (0x0100)
+#define RZA_SDR_C_PTR_E                                        (0x0104)
+
+#define RZB_EN                                         (0x0108)
+#define RZB_MODE                                       (0x010C)
+#define RZB_420                                                (0x0110)
+#define RZB_I_VPS                                      (0x0114)
+#define RZB_I_HPS                                      (0x0118)
+#define RZB_O_VSZ                                      (0x011C)
+#define RZB_O_HSZ                                      (0x0120)
+
+#define RZB_V_DIF                                      (0x012C)
+#define RZB_V_TYP                                      (0x0130)
+#define RZB_V_LPF                                      (0x0134)
+
+#define RZB_H_DIF                                      (0x0140)
+#define RZB_H_TYP                                      (0x0144)
+#define RZB_H_LPF                                      (0x0148)
+
+#define RZB_SDR_Y_BAD_H                                        (0x0160)
+#define RZB_SDR_Y_BAD_L                                        (0x0164)
+#define RZB_SDR_Y_SAD_H                                        (0x0168)
+#define RZB_SDR_Y_SAD_L                                        (0x016C)
+#define RZB_SDR_Y_OFT                                  (0x0170)
+#define RZB_SDR_Y_PTR_S                                        (0x0174)
+#define RZB_SDR_Y_PTR_E                                        (0x0178)
+#define RZB_SDR_C_BAD_H                                        (0x017C)
+#define RZB_SDR_C_BAD_L                                        (0x0180)
+#define RZB_SDR_C_SAD_H                                        (0x0184)
+#define RZB_SDR_C_SAD_L                                        (0x0188)
+
+#define RZB_SDR_C_PTR_S                                        (0x0190)
+#define RZB_SDR_C_PTR_E                                        (0x0194)
+
+/* Shared Bitmasks between RZA & RZB */
+#define RSZ_EN_EN                                      (1 << 0)
+
+#define RSZ_420_CEN                                    (1 << 1)
+#define RSZ_420_YEN                                    (1 << 0)
+
+#define RSZ_I_VPS_MASK                                 (0x1FFF)
+
+#define RSZ_I_HPS_MASK                                 (0x1FFF)
+
+#define RSZ_O_VSZ_MASK                                 (0x1FFF)
+
+#define RSZ_O_HSZ_MASK                                 (0x1FFE)
+
+#define RSZ_V_PHS_Y_MASK                               (0x3FFF)
+
+#define RSZ_V_PHS_C_MASK                               (0x3FFF)
+
+#define RSZ_V_DIF_MASK                                 (0x3FFF)
+
+#define RSZ_V_TYP_C                                    (1 << 1)
+#define RSZ_V_TYP_Y                                    (1 << 0)
+
+#define RSZ_V_LPF_C_MASK                               (0x3F << 6)
+#define RSZ_V_LPF_C_SHIFT                              6
+#define RSZ_V_LPF_Y_MASK                               (0x3F << 0)
+#define RSZ_V_LPF_Y_SHIFT                              0
+
+#define RSZ_H_PHS_MASK                                 (0x3FFF)
+
+#define RSZ_H_DIF_MASK                                 (0x3FFF)
+
+#define RSZ_H_TYP_C                                    (1 << 1)
+#define RSZ_H_TYP_Y                                    (1 << 0)
+
+#define RSZ_H_LPF_C_MASK                               (0x3F << 6)
+#define RSZ_H_LPF_C_SHIFT                              6
+#define RSZ_H_LPF_Y_MASK                               (0x3F << 0)
+#define RSZ_H_LPF_Y_SHIFT                              0
+
+#define RSZ_DWN_EN_DWN_EN                              (1 << 0)
+
+#endif /* _OMAP4_ISS_REGS_H_ */
diff --git a/drivers/staging/media/omap4iss/iss_resizer.c b/drivers/staging/media/omap4iss/iss_resizer.c
new file mode 100644 (file)
index 0000000..cb5df52
--- /dev/null
@@ -0,0 +1,905 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - ISP RESIZER module
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#include <linux/module.h>
+#include <linux/uaccess.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/dma-mapping.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+
+#include "iss.h"
+#include "iss_regs.h"
+#include "iss_resizer.h"
+
+static struct v4l2_mbus_framefmt *
+__resizer_get_format(struct iss_resizer_device *resizer, struct v4l2_subdev_fh *fh,
+                 unsigned int pad, enum v4l2_subdev_format_whence which);
+
+static const unsigned int resizer_fmts[] = {
+       V4L2_MBUS_FMT_UYVY8_1X16,
+       V4L2_MBUS_FMT_YUYV8_1X16,
+};
+
+/*
+ * resizer_print_status - Print current RESIZER Module register values.
+ * @resizer: Pointer to ISS ISP RESIZER device.
+ *
+ * Also prints other debug information stored in the RESIZER module.
+ */
+#define RSZ_PRINT_REGISTER(iss, name)\
+       dev_dbg(iss->dev, "###RSZ " #name "=0x%08x\n", \
+               readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_##name))
+
+#define RZA_PRINT_REGISTER(iss, name)\
+       dev_dbg(iss->dev, "###RZA " #name "=0x%08x\n", \
+               readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_##name))
+
+static void resizer_print_status(struct iss_resizer_device *resizer)
+{
+       struct iss_device *iss = to_iss_device(resizer);
+
+       dev_dbg(iss->dev, "-------------RESIZER Register dump-------------\n");
+
+       RSZ_PRINT_REGISTER(iss, SYSCONFIG);
+       RSZ_PRINT_REGISTER(iss, IN_FIFO_CTRL);
+       RSZ_PRINT_REGISTER(iss, FRACDIV);
+       RSZ_PRINT_REGISTER(iss, SRC_EN);
+       RSZ_PRINT_REGISTER(iss, SRC_MODE);
+       RSZ_PRINT_REGISTER(iss, SRC_FMT0);
+       RSZ_PRINT_REGISTER(iss, SRC_FMT1);
+       RSZ_PRINT_REGISTER(iss, SRC_VPS);
+       RSZ_PRINT_REGISTER(iss, SRC_VSZ);
+       RSZ_PRINT_REGISTER(iss, SRC_HPS);
+       RSZ_PRINT_REGISTER(iss, SRC_HSZ);
+       RSZ_PRINT_REGISTER(iss, DMA_RZA);
+       RSZ_PRINT_REGISTER(iss, DMA_RZB);
+       RSZ_PRINT_REGISTER(iss, DMA_STA);
+       RSZ_PRINT_REGISTER(iss, GCK_MMR);
+       RSZ_PRINT_REGISTER(iss, GCK_SDR);
+       RSZ_PRINT_REGISTER(iss, IRQ_RZA);
+       RSZ_PRINT_REGISTER(iss, IRQ_RZB);
+       RSZ_PRINT_REGISTER(iss, YUV_Y_MIN);
+       RSZ_PRINT_REGISTER(iss, YUV_Y_MAX);
+       RSZ_PRINT_REGISTER(iss, YUV_C_MIN);
+       RSZ_PRINT_REGISTER(iss, YUV_C_MAX);
+       RSZ_PRINT_REGISTER(iss, SEQ);
+
+       RZA_PRINT_REGISTER(iss, EN);
+       RZA_PRINT_REGISTER(iss, MODE);
+       RZA_PRINT_REGISTER(iss, 420);
+       RZA_PRINT_REGISTER(iss, I_VPS);
+       RZA_PRINT_REGISTER(iss, I_HPS);
+       RZA_PRINT_REGISTER(iss, O_VSZ);
+       RZA_PRINT_REGISTER(iss, O_HSZ);
+       RZA_PRINT_REGISTER(iss, V_PHS_Y);
+       RZA_PRINT_REGISTER(iss, V_PHS_C);
+       RZA_PRINT_REGISTER(iss, V_DIF);
+       RZA_PRINT_REGISTER(iss, V_TYP);
+       RZA_PRINT_REGISTER(iss, V_LPF);
+       RZA_PRINT_REGISTER(iss, H_PHS);
+       RZA_PRINT_REGISTER(iss, H_DIF);
+       RZA_PRINT_REGISTER(iss, H_TYP);
+       RZA_PRINT_REGISTER(iss, H_LPF);
+       RZA_PRINT_REGISTER(iss, DWN_EN);
+       RZA_PRINT_REGISTER(iss, SDR_Y_BAD_H);
+       RZA_PRINT_REGISTER(iss, SDR_Y_BAD_L);
+       RZA_PRINT_REGISTER(iss, SDR_Y_SAD_H);
+       RZA_PRINT_REGISTER(iss, SDR_Y_SAD_L);
+       RZA_PRINT_REGISTER(iss, SDR_Y_OFT);
+       RZA_PRINT_REGISTER(iss, SDR_Y_PTR_S);
+       RZA_PRINT_REGISTER(iss, SDR_Y_PTR_E);
+       RZA_PRINT_REGISTER(iss, SDR_C_BAD_H);
+       RZA_PRINT_REGISTER(iss, SDR_C_BAD_L);
+       RZA_PRINT_REGISTER(iss, SDR_C_SAD_H);
+       RZA_PRINT_REGISTER(iss, SDR_C_SAD_L);
+       RZA_PRINT_REGISTER(iss, SDR_C_OFT);
+       RZA_PRINT_REGISTER(iss, SDR_C_PTR_S);
+       RZA_PRINT_REGISTER(iss, SDR_C_PTR_E);
+
+       dev_dbg(iss->dev, "-----------------------------------------------\n");
+}
+
+/*
+ * resizer_enable - Enable/Disable RESIZER.
+ * @enable: enable flag
+ *
+ */
+static void resizer_enable(struct iss_resizer_device *resizer, u8 enable)
+{
+       struct iss_device *iss = to_iss_device(resizer);
+
+       writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_EN) &
+               ~RSZ_SRC_EN_SRC_EN) |
+               enable ? RSZ_SRC_EN_SRC_EN : 0,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_EN);
+
+       /* TODO: Enable RSZB */
+       writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_EN) &
+               ~RSZ_EN_EN) |
+               enable ? RSZ_EN_EN : 0,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_EN);
+}
+
+/* -----------------------------------------------------------------------------
+ * Format- and pipeline-related configuration helpers
+ */
+
+/*
+ * resizer_set_outaddr - Set memory address to save output image
+ * @resizer: Pointer to ISP RESIZER device.
+ * @addr: 32-bit memory address aligned on 32 byte boundary.
+ *
+ * Sets the memory address where the output will be saved.
+ */
+static void resizer_set_outaddr(struct iss_resizer_device *resizer, u32 addr)
+{
+       struct iss_device *iss = to_iss_device(resizer);
+       struct v4l2_mbus_framefmt *informat, *outformat;
+
+       informat = &resizer->formats[RESIZER_PAD_SINK];
+       outformat = &resizer->formats[RESIZER_PAD_SOURCE_MEM];
+
+       /* Save address splitted in Base Address H & L */
+       writel((addr >> 16) & 0xffff,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_Y_BAD_H);
+       writel(addr & 0xffff,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_Y_BAD_L);
+
+       /* SAD = BAD */
+       writel((addr >> 16) & 0xffff,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_Y_SAD_H);
+       writel(addr & 0xffff,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_Y_SAD_L);
+
+       /* Program UV buffer address... Hardcoded to be contiguous! */
+       if ((informat->code == V4L2_MBUS_FMT_UYVY8_1X16) &&
+           (outformat->code == V4L2_MBUS_FMT_YUYV8_1_5X8)) {
+               u32 c_addr = addr + (resizer->video_out.bpl_value *
+                                    (outformat->height - 1));
+
+               /* Ensure Y_BAD_L[6:0] = C_BAD_L[6:0]*/
+               if ((c_addr ^ addr) & 0x7f) {
+                       c_addr &= ~0x7f;
+                       c_addr += 0x80;
+                       c_addr |= addr & 0x7f;
+               }
+
+               /* Save address splitted in Base Address H & L */
+               writel((c_addr >> 16) & 0xffff,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_C_BAD_H);
+               writel(c_addr & 0xffff,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_C_BAD_L);
+
+               /* SAD = BAD */
+               writel((c_addr >> 16) & 0xffff,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_C_SAD_H);
+               writel(c_addr & 0xffff,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_C_SAD_L);
+       }
+}
+
+static void resizer_configure(struct iss_resizer_device *resizer)
+{
+       struct iss_device *iss = to_iss_device(resizer);
+       struct v4l2_mbus_framefmt *informat, *outformat;
+
+       informat = &resizer->formats[RESIZER_PAD_SINK];
+       outformat = &resizer->formats[RESIZER_PAD_SOURCE_MEM];
+
+       /* Make sure we don't bypass the resizer */
+       writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_FMT0) &
+               ~RSZ_SRC_FMT0_BYPASS,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_FMT0);
+
+       /* Select RSZ input */
+       writel((readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_FMT0) &
+               ~RSZ_SRC_FMT0_SEL) |
+               (resizer->input == RESIZER_INPUT_IPIPEIF) ? RSZ_SRC_FMT0_SEL : 0,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_FMT0);
+
+       /* RSZ ignores WEN signal from IPIPE/IPIPEIF */
+       writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_MODE) &
+               ~RSZ_SRC_MODE_WRT,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_MODE);
+
+       /* Set Resizer in free-running mode */
+       writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_MODE) &
+               ~RSZ_SRC_MODE_OST,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_MODE);
+
+       /* Init Resizer A */
+       writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_MODE) &
+               ~RZA_MODE_ONE_SHOT,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_MODE);
+
+       /* Set size related things now */
+       writel(0, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_VPS);
+       writel(0, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_HPS);
+       writel(informat->height - 2, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_VSZ);
+       writel(informat->width - 1, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SRC_HSZ);
+
+       writel(0, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_I_VPS);
+       writel(0, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_I_HPS);
+
+       writel(outformat->height - 2, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_O_VSZ);
+       writel(outformat->width - 1, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_O_HSZ);
+
+       writel(0x100, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_V_DIF);
+       writel(0x100, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_H_DIF);
+
+       /* Buffer output settings */
+       writel(0, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_Y_PTR_S);
+       writel(outformat->height - 1,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_Y_PTR_E);
+
+       writel(resizer->video_out.bpl_value,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_Y_OFT);
+
+       /* UYVY -> NV12 conversion */
+       if ((informat->code == V4L2_MBUS_FMT_UYVY8_1X16) &&
+           (outformat->code == V4L2_MBUS_FMT_YUYV8_1_5X8)) {
+               writel(RSZ_420_CEN | RSZ_420_YEN,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_420);
+
+               /* UV Buffer output settings */
+               writel(0, iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_C_PTR_S);
+               writel(outformat->height - 1,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_C_PTR_E);
+
+               writel(resizer->video_out.bpl_value,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_SDR_C_OFT);
+       } else {
+               writel(0,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_420);
+       }
+
+       omap4iss_isp_enable_interrupts(iss);
+}
+
+/* -----------------------------------------------------------------------------
+ * Interrupt handling
+ */
+
+static void resizer_isr_buffer(struct iss_resizer_device *resizer)
+{
+       struct iss_device *iss = to_iss_device(resizer);
+       struct iss_buffer *buffer;
+
+       writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_EN) &
+               ~RSZ_EN_EN,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_EN);
+
+       buffer = omap4iss_video_buffer_next(&resizer->video_out);
+       if (buffer == NULL)
+               return;
+
+       resizer_set_outaddr(resizer, buffer->iss_addr);
+
+       writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_EN) |
+               RSZ_EN_EN,
+               iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RZA_EN);
+}
+
+/*
+ * resizer_isif0_isr - Handle ISIF0 event
+ * @resizer: Pointer to ISP RESIZER device.
+ *
+ * Executes LSC deferred enablement before next frame starts.
+ */
+static void resizer_int_dma_isr(struct iss_resizer_device *resizer)
+{
+       struct iss_pipeline *pipe =
+                            to_iss_pipeline(&resizer->subdev.entity);
+       if (pipe->do_propagation)
+               atomic_inc(&pipe->frame_number);
+
+       resizer_isr_buffer(resizer);
+}
+
+/*
+ * omap4iss_resizer_isr - Configure resizer during interframe time.
+ * @resizer: Pointer to ISP RESIZER device.
+ * @events: RESIZER events
+ */
+void omap4iss_resizer_isr(struct iss_resizer_device *resizer, u32 events)
+{
+       struct iss_device *iss = to_iss_device(resizer);
+       struct iss_pipeline *pipe =
+                            to_iss_pipeline(&resizer->subdev.entity);
+
+       if (events & (ISP5_IRQ_RSZ_FIFO_IN_BLK |
+                     ISP5_IRQ_RSZ_FIFO_OVF)) {
+               dev_dbg(iss->dev, "RSZ Err:"
+                       " FIFO_IN_BLK:%d,"
+                       " FIFO_OVF:%d,"
+                       "\n",
+                       (events &
+                        ISP5_IRQ_RSZ_FIFO_IN_BLK) ? 1 : 0,
+                       (events &
+                        ISP5_IRQ_RSZ_FIFO_OVF) ? 1 : 0);
+               pipe->error = true;
+       }
+
+       if (omap4iss_module_sync_is_stopping(&resizer->wait, &resizer->stopping))
+               return;
+
+       if (events & ISP5_IRQ_RSZ_INT_DMA)
+               resizer_int_dma_isr(resizer);
+}
+
+/* -----------------------------------------------------------------------------
+ * ISS video operations
+ */
+
+static int resizer_video_queue(struct iss_video *video, struct iss_buffer *buffer)
+{
+       struct iss_resizer_device *resizer = container_of(video,
+                               struct iss_resizer_device, video_out);
+
+       if (!(resizer->output & RESIZER_OUTPUT_MEMORY))
+               return -ENODEV;
+
+       resizer_set_outaddr(resizer, buffer->iss_addr);
+
+       /*
+        * If streaming was enabled before there was a buffer queued
+        * or underrun happened in the ISR, the hardware was not enabled
+        * and DMA queue flag ISS_VIDEO_DMAQUEUE_UNDERRUN is still set.
+        * Enable it now.
+        */
+       if (video->dmaqueue_flags & ISS_VIDEO_DMAQUEUE_UNDERRUN) {
+               resizer_enable(resizer, 1);
+               iss_video_dmaqueue_flags_clr(video);
+       }
+
+       return 0;
+}
+
+static const struct iss_video_operations resizer_video_ops = {
+       .queue = resizer_video_queue,
+};
+
+/* -----------------------------------------------------------------------------
+ * V4L2 subdev operations
+ */
+
+/*
+ * resizer_set_stream - Enable/Disable streaming on the RESIZER module
+ * @sd: ISP RESIZER V4L2 subdevice
+ * @enable: Enable/disable stream
+ */
+static int resizer_set_stream(struct v4l2_subdev *sd, int enable)
+{
+       struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd);
+       struct iss_device *iss = to_iss_device(resizer);
+       struct iss_video *video_out = &resizer->video_out;
+       int ret = 0;
+
+       if (resizer->state == ISS_PIPELINE_STREAM_STOPPED) {
+               if (enable == ISS_PIPELINE_STREAM_STOPPED)
+                       return 0;
+
+               omap4iss_isp_subclk_enable(iss, OMAP4_ISS_ISP_SUBCLK_RSZ);
+
+               writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_GCK_MMR) |
+                       RSZ_GCK_MMR_MMR,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_GCK_MMR);
+               writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_GCK_SDR) |
+                       RSZ_GCK_SDR_CORE,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_GCK_SDR);
+
+               /* FIXME: Enable RSZB also */
+               writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SYSCONFIG) |
+                       RSZ_SYSCONFIG_RSZA_CLK_EN,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SYSCONFIG);
+       }
+
+       switch (enable) {
+       case ISS_PIPELINE_STREAM_CONTINUOUS:
+
+               resizer_configure(resizer);
+               resizer_print_status(resizer);
+
+               /*
+                * When outputting to memory with no buffer available, let the
+                * buffer queue handler start the hardware. A DMA queue flag
+                * ISS_VIDEO_DMAQUEUE_QUEUED will be set as soon as there is
+                * a buffer available.
+                */
+               if (resizer->output & RESIZER_OUTPUT_MEMORY &&
+                   !(video_out->dmaqueue_flags & ISS_VIDEO_DMAQUEUE_QUEUED))
+                       break;
+
+               atomic_set(&resizer->stopping, 0);
+               resizer_enable(resizer, 1);
+               iss_video_dmaqueue_flags_clr(video_out);
+               break;
+
+       case ISS_PIPELINE_STREAM_STOPPED:
+               if (resizer->state == ISS_PIPELINE_STREAM_STOPPED)
+                       return 0;
+               if (omap4iss_module_sync_idle(&sd->entity, &resizer->wait,
+                                             &resizer->stopping))
+                       dev_dbg(iss->dev, "%s: module stop timeout.\n",
+                               sd->name);
+
+               resizer_enable(resizer, 0);
+               omap4iss_isp_disable_interrupts(iss);
+               writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SYSCONFIG) &
+                       ~RSZ_SYSCONFIG_RSZA_CLK_EN,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_SYSCONFIG);
+               writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_GCK_SDR) &
+                       ~RSZ_GCK_SDR_CORE,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_GCK_SDR);
+               writel(readl(iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_GCK_MMR) &
+                       ~RSZ_GCK_MMR_MMR,
+                       iss->regs[OMAP4_ISS_MEM_ISP_RESIZER] + RSZ_GCK_MMR);
+               omap4iss_isp_subclk_disable(iss, OMAP4_ISS_ISP_SUBCLK_RSZ);
+               iss_video_dmaqueue_flags_clr(video_out);
+               break;
+       }
+
+       resizer->state = enable;
+       return ret;
+}
+
+static struct v4l2_mbus_framefmt *
+__resizer_get_format(struct iss_resizer_device *resizer, struct v4l2_subdev_fh *fh,
+                 unsigned int pad, enum v4l2_subdev_format_whence which)
+{
+       if (which == V4L2_SUBDEV_FORMAT_TRY)
+               return v4l2_subdev_get_try_format(fh, pad);
+       else
+               return &resizer->formats[pad];
+}
+
+/*
+ * resizer_try_format - Try video format on a pad
+ * @resizer: ISS RESIZER device
+ * @fh : V4L2 subdev file handle
+ * @pad: Pad number
+ * @fmt: Format
+ */
+static void
+resizer_try_format(struct iss_resizer_device *resizer, struct v4l2_subdev_fh *fh,
+               unsigned int pad, struct v4l2_mbus_framefmt *fmt,
+               enum v4l2_subdev_format_whence which)
+{
+       enum v4l2_mbus_pixelcode pixelcode;
+       struct v4l2_mbus_framefmt *format;
+       unsigned int width = fmt->width;
+       unsigned int height = fmt->height;
+       unsigned int i;
+
+       switch (pad) {
+       case RESIZER_PAD_SINK:
+               for (i = 0; i < ARRAY_SIZE(resizer_fmts); i++) {
+                       if (fmt->code == resizer_fmts[i])
+                               break;
+               }
+
+               /* If not found, use UYVY as default */
+               if (i >= ARRAY_SIZE(resizer_fmts))
+                       fmt->code = V4L2_MBUS_FMT_UYVY8_1X16;
+
+               /* Clamp the input size. */
+               fmt->width = clamp_t(u32, width, 1, 8192);
+               fmt->height = clamp_t(u32, height, 1, 8192);
+               break;
+
+       case RESIZER_PAD_SOURCE_MEM:
+               pixelcode = fmt->code;
+               format = __resizer_get_format(resizer, fh, RESIZER_PAD_SINK, which);
+               memcpy(fmt, format, sizeof(*fmt));
+
+               if ((pixelcode == V4L2_MBUS_FMT_YUYV8_1_5X8) &&
+                   (fmt->code == V4L2_MBUS_FMT_UYVY8_1X16))
+                       fmt->code = pixelcode;
+
+               /* The data formatter truncates the number of horizontal output
+                * pixels to a multiple of 16. To avoid clipping data, allow
+                * callers to request an output size bigger than the input size
+                * up to the nearest multiple of 16.
+                */
+               fmt->width = clamp_t(u32, width, 32, (fmt->width + 15) & ~15);
+               fmt->width &= ~15;
+               fmt->height = clamp_t(u32, height, 32, fmt->height);
+               break;
+
+       }
+
+       fmt->colorspace = V4L2_COLORSPACE_JPEG;
+       fmt->field = V4L2_FIELD_NONE;
+}
+
+/*
+ * resizer_enum_mbus_code - Handle pixel format enumeration
+ * @sd     : pointer to v4l2 subdev structure
+ * @fh : V4L2 subdev file handle
+ * @code   : pointer to v4l2_subdev_mbus_code_enum structure
+ * return -EINVAL or zero on success
+ */
+static int resizer_enum_mbus_code(struct v4l2_subdev *sd,
+                              struct v4l2_subdev_fh *fh,
+                              struct v4l2_subdev_mbus_code_enum *code)
+{
+       struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt *format;
+
+       switch (code->pad) {
+       case RESIZER_PAD_SINK:
+               if (code->index >= ARRAY_SIZE(resizer_fmts))
+                       return -EINVAL;
+
+               code->code = resizer_fmts[code->index];
+               break;
+
+       case RESIZER_PAD_SOURCE_MEM:
+               format = __resizer_get_format(resizer, fh, RESIZER_PAD_SINK,
+                                             V4L2_SUBDEV_FORMAT_TRY);
+
+               if (code->index == 0) {
+                       code->code = format->code;
+                       break;
+               }
+
+               switch (format->code) {
+               case V4L2_MBUS_FMT_UYVY8_1X16:
+                       if (code->index == 1)
+                               code->code = V4L2_MBUS_FMT_YUYV8_1_5X8;
+                       else
+                               return -EINVAL;
+                       break;
+               default:
+                       if (code->index != 0)
+                               return -EINVAL;
+               }
+
+               break;
+
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static int resizer_enum_frame_size(struct v4l2_subdev *sd,
+                               struct v4l2_subdev_fh *fh,
+                               struct v4l2_subdev_frame_size_enum *fse)
+{
+       struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt format;
+
+       if (fse->index != 0)
+               return -EINVAL;
+
+       format.code = fse->code;
+       format.width = 1;
+       format.height = 1;
+       resizer_try_format(resizer, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
+       fse->min_width = format.width;
+       fse->min_height = format.height;
+
+       if (format.code != fse->code)
+               return -EINVAL;
+
+       format.code = fse->code;
+       format.width = -1;
+       format.height = -1;
+       resizer_try_format(resizer, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
+       fse->max_width = format.width;
+       fse->max_height = format.height;
+
+       return 0;
+}
+
+/*
+ * resizer_get_format - Retrieve the video format on a pad
+ * @sd : ISP RESIZER V4L2 subdevice
+ * @fh : V4L2 subdev file handle
+ * @fmt: Format
+ *
+ * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond
+ * to the format type.
+ */
+static int resizer_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
+                          struct v4l2_subdev_format *fmt)
+{
+       struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt *format;
+
+       format = __resizer_get_format(resizer, fh, fmt->pad, fmt->which);
+       if (format == NULL)
+               return -EINVAL;
+
+       fmt->format = *format;
+       return 0;
+}
+
+/*
+ * resizer_set_format - Set the video format on a pad
+ * @sd : ISP RESIZER V4L2 subdevice
+ * @fh : V4L2 subdev file handle
+ * @fmt: Format
+ *
+ * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond
+ * to the format type.
+ */
+static int resizer_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
+                             struct v4l2_subdev_format *fmt)
+{
+       struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd);
+       struct v4l2_mbus_framefmt *format;
+
+       format = __resizer_get_format(resizer, fh, fmt->pad, fmt->which);
+       if (format == NULL)
+               return -EINVAL;
+
+       resizer_try_format(resizer, fh, fmt->pad, &fmt->format, fmt->which);
+       *format = fmt->format;
+
+       /* Propagate the format from sink to source */
+       if (fmt->pad == RESIZER_PAD_SINK) {
+               format = __resizer_get_format(resizer, fh, RESIZER_PAD_SOURCE_MEM,
+                                          fmt->which);
+               *format = fmt->format;
+               resizer_try_format(resizer, fh, RESIZER_PAD_SOURCE_MEM, format,
+                               fmt->which);
+       }
+
+       return 0;
+}
+
+static int resizer_link_validate(struct v4l2_subdev *sd, struct media_link *link,
+                                struct v4l2_subdev_format *source_fmt,
+                                struct v4l2_subdev_format *sink_fmt)
+{
+       /* Check if the two ends match */
+       if (source_fmt->format.width != sink_fmt->format.width ||
+           source_fmt->format.height != sink_fmt->format.height)
+               return -EPIPE;
+
+       if (source_fmt->format.code != sink_fmt->format.code)
+               return -EPIPE;
+
+       return 0;
+}
+
+/*
+ * resizer_init_formats - Initialize formats on all pads
+ * @sd: ISP RESIZER V4L2 subdevice
+ * @fh: V4L2 subdev file handle
+ *
+ * Initialize all pad formats with default values. If fh is not NULL, try
+ * formats are initialized on the file handle. Otherwise active formats are
+ * initialized on the device.
+ */
+static int resizer_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+       struct v4l2_subdev_format format;
+
+       memset(&format, 0, sizeof(format));
+       format.pad = RESIZER_PAD_SINK;
+       format.which = fh ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE;
+       format.format.code = V4L2_MBUS_FMT_UYVY8_1X16;
+       format.format.width = 4096;
+       format.format.height = 4096;
+       resizer_set_format(sd, fh, &format);
+
+       return 0;
+}
+
+/* V4L2 subdev video operations */
+static const struct v4l2_subdev_video_ops resizer_v4l2_video_ops = {
+       .s_stream = resizer_set_stream,
+};
+
+/* V4L2 subdev pad operations */
+static const struct v4l2_subdev_pad_ops resizer_v4l2_pad_ops = {
+       .enum_mbus_code = resizer_enum_mbus_code,
+       .enum_frame_size = resizer_enum_frame_size,
+       .get_fmt = resizer_get_format,
+       .set_fmt = resizer_set_format,
+       .link_validate = resizer_link_validate,
+};
+
+/* V4L2 subdev operations */
+static const struct v4l2_subdev_ops resizer_v4l2_ops = {
+       .video = &resizer_v4l2_video_ops,
+       .pad = &resizer_v4l2_pad_ops,
+};
+
+/* V4L2 subdev internal operations */
+static const struct v4l2_subdev_internal_ops resizer_v4l2_internal_ops = {
+       .open = resizer_init_formats,
+};
+
+/* -----------------------------------------------------------------------------
+ * Media entity operations
+ */
+
+/*
+ * resizer_link_setup - Setup RESIZER connections
+ * @entity: RESIZER media entity
+ * @local: Pad at the local end of the link
+ * @remote: Pad at the remote end of the link
+ * @flags: Link flags
+ *
+ * return -EINVAL or zero on success
+ */
+static int resizer_link_setup(struct media_entity *entity,
+                          const struct media_pad *local,
+                          const struct media_pad *remote, u32 flags)
+{
+       struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
+       struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd);
+       struct iss_device *iss = to_iss_device(resizer);
+
+       switch (local->index | media_entity_type(remote->entity)) {
+       case RESIZER_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+               /* Read from IPIPE or IPIPEIF. */
+               if (!(flags & MEDIA_LNK_FL_ENABLED)) {
+                       resizer->input = RESIZER_INPUT_NONE;
+                       break;
+               }
+
+               if (resizer->input != RESIZER_INPUT_NONE)
+                       return -EBUSY;
+
+               if (remote->entity == &iss->ipipeif.subdev.entity)
+                       resizer->input = RESIZER_INPUT_IPIPEIF;
+               else if (remote->entity == &iss->ipipe.subdev.entity)
+                       resizer->input = RESIZER_INPUT_IPIPE;
+
+
+               break;
+
+       case RESIZER_PAD_SOURCE_MEM | MEDIA_ENT_T_DEVNODE:
+               /* Write to memory */
+               if (flags & MEDIA_LNK_FL_ENABLED) {
+                       if (resizer->output & ~RESIZER_OUTPUT_MEMORY)
+                               return -EBUSY;
+                       resizer->output |= RESIZER_OUTPUT_MEMORY;
+               } else {
+                       resizer->output &= ~RESIZER_OUTPUT_MEMORY;
+               }
+               break;
+
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+/* media operations */
+static const struct media_entity_operations resizer_media_ops = {
+       .link_setup = resizer_link_setup,
+       .link_validate = v4l2_subdev_link_validate,
+};
+
+/*
+ * resizer_init_entities - Initialize V4L2 subdev and media entity
+ * @resizer: ISS ISP RESIZER module
+ *
+ * Return 0 on success and a negative error code on failure.
+ */
+static int resizer_init_entities(struct iss_resizer_device *resizer)
+{
+       struct v4l2_subdev *sd = &resizer->subdev;
+       struct media_pad *pads = resizer->pads;
+       struct media_entity *me = &sd->entity;
+       int ret;
+
+       resizer->input = RESIZER_INPUT_NONE;
+
+       v4l2_subdev_init(sd, &resizer_v4l2_ops);
+       sd->internal_ops = &resizer_v4l2_internal_ops;
+       strlcpy(sd->name, "OMAP4 ISS ISP resizer", sizeof(sd->name));
+       sd->grp_id = 1 << 16;   /* group ID for iss subdevs */
+       v4l2_set_subdevdata(sd, resizer);
+       sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+
+       pads[RESIZER_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
+       pads[RESIZER_PAD_SOURCE_MEM].flags = MEDIA_PAD_FL_SOURCE;
+
+       me->ops = &resizer_media_ops;
+       ret = media_entity_init(me, RESIZER_PADS_NUM, pads, 0);
+       if (ret < 0)
+               return ret;
+
+       resizer_init_formats(sd, NULL);
+
+       resizer->video_out.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+       resizer->video_out.ops = &resizer_video_ops;
+       resizer->video_out.iss = to_iss_device(resizer);
+       resizer->video_out.capture_mem = PAGE_ALIGN(4096 * 4096) * 3;
+       resizer->video_out.bpl_alignment = 32;
+       resizer->video_out.bpl_zero_padding = 1;
+       resizer->video_out.bpl_max = 0x1ffe0;
+
+       ret = omap4iss_video_init(&resizer->video_out, "ISP resizer a");
+       if (ret < 0)
+               return ret;
+
+       /* Connect the RESIZER subdev to the video node. */
+       ret = media_entity_create_link(&resizer->subdev.entity, RESIZER_PAD_SOURCE_MEM,
+                       &resizer->video_out.video.entity, 0, 0);
+       if (ret < 0)
+               return ret;
+
+       return 0;
+}
+
+void omap4iss_resizer_unregister_entities(struct iss_resizer_device *resizer)
+{
+       media_entity_cleanup(&resizer->subdev.entity);
+
+       v4l2_device_unregister_subdev(&resizer->subdev);
+       omap4iss_video_unregister(&resizer->video_out);
+}
+
+int omap4iss_resizer_register_entities(struct iss_resizer_device *resizer,
+       struct v4l2_device *vdev)
+{
+       int ret;
+
+       /* Register the subdev and video node. */
+       ret = v4l2_device_register_subdev(vdev, &resizer->subdev);
+       if (ret < 0)
+               goto error;
+
+       ret = omap4iss_video_register(&resizer->video_out, vdev);
+       if (ret < 0)
+               goto error;
+
+       return 0;
+
+error:
+       omap4iss_resizer_unregister_entities(resizer);
+       return ret;
+}
+
+/* -----------------------------------------------------------------------------
+ * ISP RESIZER initialisation and cleanup
+ */
+
+/*
+ * omap4iss_resizer_init - RESIZER module initialization.
+ * @iss: Device pointer specific to the OMAP4 ISS.
+ *
+ * TODO: Get the initialisation values from platform data.
+ *
+ * Return 0 on success or a negative error code otherwise.
+ */
+int omap4iss_resizer_init(struct iss_device *iss)
+{
+       struct iss_resizer_device *resizer = &iss->resizer;
+
+       resizer->state = ISS_PIPELINE_STREAM_STOPPED;
+       init_waitqueue_head(&resizer->wait);
+
+       return resizer_init_entities(resizer);
+}
+
+/*
+ * omap4iss_resizer_cleanup - RESIZER module cleanup.
+ * @iss: Device pointer specific to the OMAP4 ISS.
+ */
+void omap4iss_resizer_cleanup(struct iss_device *iss)
+{
+       /* FIXME: are you sure there's nothing to do? */
+}
diff --git a/drivers/staging/media/omap4iss/iss_resizer.h b/drivers/staging/media/omap4iss/iss_resizer.h
new file mode 100644 (file)
index 0000000..3727498
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - ISP RESIZER module
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#ifndef OMAP4_ISS_RESIZER_H
+#define OMAP4_ISS_RESIZER_H
+
+#include "iss_video.h"
+
+enum resizer_input_entity {
+       RESIZER_INPUT_NONE,
+       RESIZER_INPUT_IPIPE,
+       RESIZER_INPUT_IPIPEIF
+};
+
+#define RESIZER_OUTPUT_MEMORY          (1 << 0)
+
+/* Sink and source RESIZER pads */
+#define RESIZER_PAD_SINK                       0
+#define RESIZER_PAD_SOURCE_MEM                 1
+#define RESIZER_PADS_NUM                       2
+
+/*
+ * struct iss_resizer_device - Structure for the RESIZER module to store its own
+ *                         information
+ * @subdev: V4L2 subdevice
+ * @pads: Sink and source media entity pads
+ * @formats: Active video formats
+ * @input: Active input
+ * @output: Active outputs
+ * @video_out: Output video node
+ * @error: A hardware error occurred during capture
+ * @state: Streaming state
+ * @wait: Wait queue used to stop the module
+ * @stopping: Stopping state
+ */
+struct iss_resizer_device {
+       struct v4l2_subdev subdev;
+       struct media_pad pads[RESIZER_PADS_NUM];
+       struct v4l2_mbus_framefmt formats[RESIZER_PADS_NUM];
+
+       enum resizer_input_entity input;
+       unsigned int output;
+       struct iss_video video_out;
+       unsigned int error;
+
+       enum iss_pipeline_stream_state state;
+       wait_queue_head_t wait;
+       atomic_t stopping;
+};
+
+struct iss_device;
+
+int omap4iss_resizer_init(struct iss_device *iss);
+void omap4iss_resizer_cleanup(struct iss_device *iss);
+int omap4iss_resizer_register_entities(struct iss_resizer_device *resizer,
+       struct v4l2_device *vdev);
+void omap4iss_resizer_unregister_entities(struct iss_resizer_device *resizer);
+
+int omap4iss_resizer_busy(struct iss_resizer_device *resizer);
+void omap4iss_resizer_isr(struct iss_resizer_device *resizer, u32 events);
+void omap4iss_resizer_restore_context(struct iss_device *iss);
+void omap4iss_resizer_max_rate(struct iss_resizer_device *resizer,
+       unsigned int *max_rate);
+
+#endif /* OMAP4_ISS_RESIZER_H */
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
new file mode 100644 (file)
index 0000000..766491e
--- /dev/null
@@ -0,0 +1,1128 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - Generic video node
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#include <asm/cacheflush.h>
+#include <linux/clk.h>
+#include <linux/mm.h>
+#include <linux/pagemap.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+#include <linux/module.h>
+#include <media/v4l2-dev.h>
+#include <media/v4l2-ioctl.h>
+
+#include "iss_video.h"
+#include "iss.h"
+
+
+/* -----------------------------------------------------------------------------
+ * Helper functions
+ */
+
+static struct iss_format_info formats[] = {
+       { V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8,
+         V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8,
+         V4L2_PIX_FMT_GREY, 8, },
+       { V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y10_1X10,
+         V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y8_1X8,
+         V4L2_PIX_FMT_Y10, 10, },
+       { V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y10_1X10,
+         V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y8_1X8,
+         V4L2_PIX_FMT_Y12, 12, },
+       { V4L2_MBUS_FMT_SBGGR8_1X8, V4L2_MBUS_FMT_SBGGR8_1X8,
+         V4L2_MBUS_FMT_SBGGR8_1X8, V4L2_MBUS_FMT_SBGGR8_1X8,
+         V4L2_PIX_FMT_SBGGR8, 8, },
+       { V4L2_MBUS_FMT_SGBRG8_1X8, V4L2_MBUS_FMT_SGBRG8_1X8,
+         V4L2_MBUS_FMT_SGBRG8_1X8, V4L2_MBUS_FMT_SGBRG8_1X8,
+         V4L2_PIX_FMT_SGBRG8, 8, },
+       { V4L2_MBUS_FMT_SGRBG8_1X8, V4L2_MBUS_FMT_SGRBG8_1X8,
+         V4L2_MBUS_FMT_SGRBG8_1X8, V4L2_MBUS_FMT_SGRBG8_1X8,
+         V4L2_PIX_FMT_SGRBG8, 8, },
+       { V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_MBUS_FMT_SRGGB8_1X8,
+         V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_MBUS_FMT_SRGGB8_1X8,
+         V4L2_PIX_FMT_SRGGB8, 8, },
+       { V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8,
+         V4L2_MBUS_FMT_SGRBG10_1X10, 0,
+         V4L2_PIX_FMT_SGRBG10DPCM8, 8, },
+       { V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR10_1X10,
+         V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR8_1X8,
+         V4L2_PIX_FMT_SBGGR10, 10, },
+       { V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG10_1X10,
+         V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG8_1X8,
+         V4L2_PIX_FMT_SGBRG10, 10, },
+       { V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG10_1X10,
+         V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG8_1X8,
+         V4L2_PIX_FMT_SGRBG10, 10, },
+       { V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB10_1X10,
+         V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB8_1X8,
+         V4L2_PIX_FMT_SRGGB10, 10, },
+       { V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR10_1X10,
+         V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR8_1X8,
+         V4L2_PIX_FMT_SBGGR12, 12, },
+       { V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG10_1X10,
+         V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG8_1X8,
+         V4L2_PIX_FMT_SGBRG12, 12, },
+       { V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG10_1X10,
+         V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG8_1X8,
+         V4L2_PIX_FMT_SGRBG12, 12, },
+       { V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB10_1X10,
+         V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB8_1X8,
+         V4L2_PIX_FMT_SRGGB12, 12, },
+       { V4L2_MBUS_FMT_UYVY8_1X16, V4L2_MBUS_FMT_UYVY8_1X16,
+         V4L2_MBUS_FMT_UYVY8_1X16, 0,
+         V4L2_PIX_FMT_UYVY, 16, },
+       { V4L2_MBUS_FMT_YUYV8_1X16, V4L2_MBUS_FMT_YUYV8_1X16,
+         V4L2_MBUS_FMT_YUYV8_1X16, 0,
+         V4L2_PIX_FMT_YUYV, 16, },
+       { V4L2_MBUS_FMT_YUYV8_1_5X8, V4L2_MBUS_FMT_YUYV8_1_5X8,
+         V4L2_MBUS_FMT_YUYV8_1_5X8, 0,
+         V4L2_PIX_FMT_NV12, 8, },
+};
+
+const struct iss_format_info *
+omap4iss_video_format_info(enum v4l2_mbus_pixelcode code)
+{
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(formats); ++i) {
+               if (formats[i].code == code)
+                       return &formats[i];
+       }
+
+       return NULL;
+}
+
+/*
+ * iss_video_mbus_to_pix - Convert v4l2_mbus_framefmt to v4l2_pix_format
+ * @video: ISS video instance
+ * @mbus: v4l2_mbus_framefmt format (input)
+ * @pix: v4l2_pix_format format (output)
+ *
+ * Fill the output pix structure with information from the input mbus format.
+ * The bytesperline and sizeimage fields are computed from the requested bytes
+ * per line value in the pix format and information from the video instance.
+ *
+ * Return the number of padding bytes at end of line.
+ */
+static unsigned int iss_video_mbus_to_pix(const struct iss_video *video,
+                                         const struct v4l2_mbus_framefmt *mbus,
+                                         struct v4l2_pix_format *pix)
+{
+       unsigned int bpl = pix->bytesperline;
+       unsigned int min_bpl;
+       unsigned int i;
+
+       memset(pix, 0, sizeof(*pix));
+       pix->width = mbus->width;
+       pix->height = mbus->height;
+
+       /* Skip the last format in the loop so that it will be selected if no
+        * match is found.
+        */
+       for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) {
+               if (formats[i].code == mbus->code)
+                       break;
+       }
+
+       min_bpl = pix->width * ALIGN(formats[i].bpp, 8) / 8;
+
+       /* Clamp the requested bytes per line value. If the maximum bytes per
+        * line value is zero, the module doesn't support user configurable line
+        * sizes. Override the requested value with the minimum in that case.
+        */
+       if (video->bpl_max)
+               bpl = clamp(bpl, min_bpl, video->bpl_max);
+       else
+               bpl = min_bpl;
+
+       if (!video->bpl_zero_padding || bpl != min_bpl)
+               bpl = ALIGN(bpl, video->bpl_alignment);
+
+       pix->pixelformat = formats[i].pixelformat;
+       pix->bytesperline = bpl;
+       pix->sizeimage = pix->bytesperline * pix->height;
+       pix->colorspace = mbus->colorspace;
+       pix->field = mbus->field;
+
+       /* FIXME: Special case for NV12! We should make this nicer... */
+       if (pix->pixelformat == V4L2_PIX_FMT_NV12)
+               pix->sizeimage += (pix->bytesperline * pix->height) / 2;
+
+       return bpl - min_bpl;
+}
+
+static void iss_video_pix_to_mbus(const struct v4l2_pix_format *pix,
+                                 struct v4l2_mbus_framefmt *mbus)
+{
+       unsigned int i;
+
+       memset(mbus, 0, sizeof(*mbus));
+       mbus->width = pix->width;
+       mbus->height = pix->height;
+
+       for (i = 0; i < ARRAY_SIZE(formats); ++i) {
+               if (formats[i].pixelformat == pix->pixelformat)
+                       break;
+       }
+
+       if (WARN_ON(i == ARRAY_SIZE(formats)))
+               return;
+
+       mbus->code = formats[i].code;
+       mbus->colorspace = pix->colorspace;
+       mbus->field = pix->field;
+}
+
+static struct v4l2_subdev *
+iss_video_remote_subdev(struct iss_video *video, u32 *pad)
+{
+       struct media_pad *remote;
+
+       remote = media_entity_remote_pad(&video->pad);
+
+       if (remote == NULL ||
+           media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+               return NULL;
+
+       if (pad)
+               *pad = remote->index;
+
+       return media_entity_to_v4l2_subdev(remote->entity);
+}
+
+/* Return a pointer to the ISS video instance at the far end of the pipeline. */
+static struct iss_video *
+iss_video_far_end(struct iss_video *video)
+{
+       struct media_entity_graph graph;
+       struct media_entity *entity = &video->video.entity;
+       struct media_device *mdev = entity->parent;
+       struct iss_video *far_end = NULL;
+
+       mutex_lock(&mdev->graph_mutex);
+       media_entity_graph_walk_start(&graph, entity);
+
+       while ((entity = media_entity_graph_walk_next(&graph))) {
+               if (entity == &video->video.entity)
+                       continue;
+
+               if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
+                       continue;
+
+               far_end = to_iss_video(media_entity_to_video_device(entity));
+               if (far_end->type != video->type)
+                       break;
+
+               far_end = NULL;
+       }
+
+       mutex_unlock(&mdev->graph_mutex);
+       return far_end;
+}
+
+static int
+__iss_video_get_format(struct iss_video *video, struct v4l2_format *format)
+{
+       struct v4l2_subdev_format fmt;
+       struct v4l2_subdev *subdev;
+       u32 pad;
+       int ret;
+
+       subdev = iss_video_remote_subdev(video, &pad);
+       if (subdev == NULL)
+               return -EINVAL;
+
+       fmt.pad = pad;
+       fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+
+       mutex_lock(&video->mutex);
+       ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
+       mutex_unlock(&video->mutex);
+
+       if (ret)
+               return ret;
+
+       format->type = video->type;
+       return iss_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix);
+}
+
+static int
+iss_video_check_format(struct iss_video *video, struct iss_video_fh *vfh)
+{
+       struct v4l2_format format;
+       int ret;
+
+       memcpy(&format, &vfh->format, sizeof(format));
+       ret = __iss_video_get_format(video, &format);
+       if (ret < 0)
+               return ret;
+
+       if (vfh->format.fmt.pix.pixelformat != format.fmt.pix.pixelformat ||
+           vfh->format.fmt.pix.height != format.fmt.pix.height ||
+           vfh->format.fmt.pix.width != format.fmt.pix.width ||
+           vfh->format.fmt.pix.bytesperline != format.fmt.pix.bytesperline ||
+           vfh->format.fmt.pix.sizeimage != format.fmt.pix.sizeimage)
+               return -EINVAL;
+
+       return ret;
+}
+
+/* -----------------------------------------------------------------------------
+ * Video queue operations
+ */
+
+static int iss_video_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
+                                unsigned int *count, unsigned int *num_planes,
+                                unsigned int sizes[], void *alloc_ctxs[])
+{
+       struct iss_video_fh *vfh = vb2_get_drv_priv(vq);
+       struct iss_video *video = vfh->video;
+
+       /* Revisit multi-planar support for NV12 */
+       *num_planes = 1;
+
+       sizes[0] = vfh->format.fmt.pix.sizeimage;
+       if (sizes[0] == 0)
+               return -EINVAL;
+
+       alloc_ctxs[0] = video->alloc_ctx;
+
+       *count = min(*count, (unsigned int)(video->capture_mem / PAGE_ALIGN(sizes[0])));
+
+       return 0;
+}
+
+static void iss_video_buf_cleanup(struct vb2_buffer *vb)
+{
+       struct iss_buffer *buffer = container_of(vb, struct iss_buffer, vb);
+
+       if (buffer->iss_addr)
+               buffer->iss_addr = 0;
+}
+
+static int iss_video_buf_prepare(struct vb2_buffer *vb)
+{
+       struct iss_video_fh *vfh = vb2_get_drv_priv(vb->vb2_queue);
+       struct iss_buffer *buffer = container_of(vb, struct iss_buffer, vb);
+       struct iss_video *video = vfh->video;
+       unsigned long size = vfh->format.fmt.pix.sizeimage;
+       dma_addr_t addr;
+
+       if (vb2_plane_size(vb, 0) < size)
+               return -ENOBUFS;
+
+       addr = vb2_dma_contig_plane_dma_addr(vb, 0);
+       if (!IS_ALIGNED(addr, 32)) {
+               dev_dbg(video->iss->dev, "Buffer address must be "
+                       "aligned to 32 bytes boundary.\n");
+               return -EINVAL;
+       }
+
+       vb2_set_plane_payload(vb, 0, size);
+       buffer->iss_addr = addr;
+       return 0;
+}
+
+static void iss_video_buf_queue(struct vb2_buffer *vb)
+{
+       struct iss_video_fh *vfh = vb2_get_drv_priv(vb->vb2_queue);
+       struct iss_video *video = vfh->video;
+       struct iss_buffer *buffer = container_of(vb, struct iss_buffer, vb);
+       struct iss_pipeline *pipe = to_iss_pipeline(&video->video.entity);
+       unsigned int empty;
+       unsigned long flags;
+
+       spin_lock_irqsave(&video->qlock, flags);
+       empty = list_empty(&video->dmaqueue);
+       list_add_tail(&buffer->list, &video->dmaqueue);
+       spin_unlock_irqrestore(&video->qlock, flags);
+
+       if (empty) {
+               enum iss_pipeline_state state;
+               unsigned int start;
+
+               if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
+                       state = ISS_PIPELINE_QUEUE_OUTPUT;
+               else
+                       state = ISS_PIPELINE_QUEUE_INPUT;
+
+               spin_lock_irqsave(&pipe->lock, flags);
+               pipe->state |= state;
+               video->ops->queue(video, buffer);
+               video->dmaqueue_flags |= ISS_VIDEO_DMAQUEUE_QUEUED;
+
+               start = iss_pipeline_ready(pipe);
+               if (start)
+                       pipe->state |= ISS_PIPELINE_STREAM;
+               spin_unlock_irqrestore(&pipe->lock, flags);
+
+               if (start)
+                       omap4iss_pipeline_set_stream(pipe,
+                                               ISS_PIPELINE_STREAM_SINGLESHOT);
+       }
+}
+
+static struct vb2_ops iss_video_vb2ops = {
+       .queue_setup    = iss_video_queue_setup,
+       .buf_prepare    = iss_video_buf_prepare,
+       .buf_queue      = iss_video_buf_queue,
+       .buf_cleanup    = iss_video_buf_cleanup,
+};
+
+/*
+ * omap4iss_video_buffer_next - Complete the current buffer and return the next
+ * @video: ISS video object
+ *
+ * Remove the current video buffer from the DMA queue and fill its timestamp,
+ * field count and state fields before waking up its completion handler.
+ *
+ * For capture video nodes, the buffer state is set to VB2_BUF_STATE_DONE if no
+ * error has been flagged in the pipeline, or to VB2_BUF_STATE_ERROR otherwise.
+ *
+ * The DMA queue is expected to contain at least one buffer.
+ *
+ * Return a pointer to the next buffer in the DMA queue, or NULL if the queue is
+ * empty.
+ */
+struct iss_buffer *omap4iss_video_buffer_next(struct iss_video *video)
+{
+       struct iss_pipeline *pipe = to_iss_pipeline(&video->video.entity);
+       enum iss_pipeline_state state;
+       struct iss_buffer *buf;
+       unsigned long flags;
+       struct timespec ts;
+
+       spin_lock_irqsave(&video->qlock, flags);
+       if (WARN_ON(list_empty(&video->dmaqueue))) {
+               spin_unlock_irqrestore(&video->qlock, flags);
+               return NULL;
+       }
+
+       buf = list_first_entry(&video->dmaqueue, struct iss_buffer,
+                              list);
+       list_del(&buf->list);
+       spin_unlock_irqrestore(&video->qlock, flags);
+
+       ktime_get_ts(&ts);
+       buf->vb.v4l2_buf.timestamp.tv_sec = ts.tv_sec;
+       buf->vb.v4l2_buf.timestamp.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
+
+       /* Do frame number propagation only if this is the output video node.
+        * Frame number either comes from the CSI receivers or it gets
+        * incremented here if H3A is not active.
+        * Note: There is no guarantee that the output buffer will finish
+        * first, so the input number might lag behind by 1 in some cases.
+        */
+       if (video == pipe->output && !pipe->do_propagation)
+               buf->vb.v4l2_buf.sequence = atomic_inc_return(&pipe->frame_number);
+       else
+               buf->vb.v4l2_buf.sequence = atomic_read(&pipe->frame_number);
+
+       vb2_buffer_done(&buf->vb, pipe->error ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
+       pipe->error = false;
+
+       spin_lock_irqsave(&video->qlock, flags);
+       if (list_empty(&video->dmaqueue)) {
+               spin_unlock_irqrestore(&video->qlock, flags);
+               if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
+                       state = ISS_PIPELINE_QUEUE_OUTPUT
+                             | ISS_PIPELINE_STREAM;
+               else
+                       state = ISS_PIPELINE_QUEUE_INPUT
+                             | ISS_PIPELINE_STREAM;
+
+               spin_lock_irqsave(&pipe->lock, flags);
+               pipe->state &= ~state;
+               if (video->pipe.stream_state == ISS_PIPELINE_STREAM_CONTINUOUS)
+                       video->dmaqueue_flags |= ISS_VIDEO_DMAQUEUE_UNDERRUN;
+               spin_unlock_irqrestore(&pipe->lock, flags);
+               return NULL;
+       }
+
+       if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->input != NULL) {
+               spin_lock_irqsave(&pipe->lock, flags);
+               pipe->state &= ~ISS_PIPELINE_STREAM;
+               spin_unlock_irqrestore(&pipe->lock, flags);
+       }
+
+       buf = list_first_entry(&video->dmaqueue, struct iss_buffer,
+                              list);
+       spin_unlock_irqrestore(&video->qlock, flags);
+       buf->vb.state = VB2_BUF_STATE_ACTIVE;
+       return buf;
+}
+
+/* -----------------------------------------------------------------------------
+ * V4L2 ioctls
+ */
+
+static int
+iss_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
+{
+       struct iss_video *video = video_drvdata(file);
+
+       strlcpy(cap->driver, ISS_VIDEO_DRIVER_NAME, sizeof(cap->driver));
+       strlcpy(cap->card, video->video.name, sizeof(cap->card));
+       strlcpy(cap->bus_info, "media", sizeof(cap->bus_info));
+
+       if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
+               cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
+       else
+               cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
+
+       cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING
+                         | V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT;
+
+       return 0;
+}
+
+static int
+iss_video_get_format(struct file *file, void *fh, struct v4l2_format *format)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(fh);
+       struct iss_video *video = video_drvdata(file);
+
+       if (format->type != video->type)
+               return -EINVAL;
+
+       mutex_lock(&video->mutex);
+       *format = vfh->format;
+       mutex_unlock(&video->mutex);
+
+       return 0;
+}
+
+static int
+iss_video_set_format(struct file *file, void *fh, struct v4l2_format *format)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(fh);
+       struct iss_video *video = video_drvdata(file);
+       struct v4l2_mbus_framefmt fmt;
+
+       if (format->type != video->type)
+               return -EINVAL;
+
+       mutex_lock(&video->mutex);
+
+       /* Fill the bytesperline and sizeimage fields by converting to media bus
+        * format and back to pixel format.
+        */
+       iss_video_pix_to_mbus(&format->fmt.pix, &fmt);
+       iss_video_mbus_to_pix(video, &fmt, &format->fmt.pix);
+
+       vfh->format = *format;
+
+       mutex_unlock(&video->mutex);
+       return 0;
+}
+
+static int
+iss_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
+{
+       struct iss_video *video = video_drvdata(file);
+       struct v4l2_subdev_format fmt;
+       struct v4l2_subdev *subdev;
+       u32 pad;
+       int ret;
+
+       if (format->type != video->type)
+               return -EINVAL;
+
+       subdev = iss_video_remote_subdev(video, &pad);
+       if (subdev == NULL)
+               return -EINVAL;
+
+       iss_video_pix_to_mbus(&format->fmt.pix, &fmt.format);
+
+       fmt.pad = pad;
+       fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+       ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
+       if (ret)
+               return ret;
+
+       iss_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix);
+       return 0;
+}
+
+static int
+iss_video_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cropcap)
+{
+       struct iss_video *video = video_drvdata(file);
+       struct v4l2_subdev *subdev;
+       int ret;
+
+       subdev = iss_video_remote_subdev(video, NULL);
+       if (subdev == NULL)
+               return -EINVAL;
+
+       mutex_lock(&video->mutex);
+       ret = v4l2_subdev_call(subdev, video, cropcap, cropcap);
+       mutex_unlock(&video->mutex);
+
+       return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
+}
+
+static int
+iss_video_get_crop(struct file *file, void *fh, struct v4l2_crop *crop)
+{
+       struct iss_video *video = video_drvdata(file);
+       struct v4l2_subdev_format format;
+       struct v4l2_subdev *subdev;
+       u32 pad;
+       int ret;
+
+       subdev = iss_video_remote_subdev(video, &pad);
+       if (subdev == NULL)
+               return -EINVAL;
+
+       /* Try the get crop operation first and fallback to get format if not
+        * implemented.
+        */
+       ret = v4l2_subdev_call(subdev, video, g_crop, crop);
+       if (ret != -ENOIOCTLCMD)
+               return ret;
+
+       format.pad = pad;
+       format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+       ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &format);
+       if (ret < 0)
+               return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
+
+       crop->c.left = 0;
+       crop->c.top = 0;
+       crop->c.width = format.format.width;
+       crop->c.height = format.format.height;
+
+       return 0;
+}
+
+static int
+iss_video_set_crop(struct file *file, void *fh, const struct v4l2_crop *crop)
+{
+       struct iss_video *video = video_drvdata(file);
+       struct v4l2_subdev *subdev;
+       int ret;
+
+       subdev = iss_video_remote_subdev(video, NULL);
+       if (subdev == NULL)
+               return -EINVAL;
+
+       mutex_lock(&video->mutex);
+       ret = v4l2_subdev_call(subdev, video, s_crop, crop);
+       mutex_unlock(&video->mutex);
+
+       return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
+}
+
+static int
+iss_video_get_param(struct file *file, void *fh, struct v4l2_streamparm *a)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(fh);
+       struct iss_video *video = video_drvdata(file);
+
+       if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT ||
+           video->type != a->type)
+               return -EINVAL;
+
+       memset(a, 0, sizeof(*a));
+       a->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+       a->parm.output.capability = V4L2_CAP_TIMEPERFRAME;
+       a->parm.output.timeperframe = vfh->timeperframe;
+
+       return 0;
+}
+
+static int
+iss_video_set_param(struct file *file, void *fh, struct v4l2_streamparm *a)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(fh);
+       struct iss_video *video = video_drvdata(file);
+
+       if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT ||
+           video->type != a->type)
+               return -EINVAL;
+
+       if (a->parm.output.timeperframe.denominator == 0)
+               a->parm.output.timeperframe.denominator = 1;
+
+       vfh->timeperframe = a->parm.output.timeperframe;
+
+       return 0;
+}
+
+static int
+iss_video_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *rb)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(fh);
+
+       return vb2_reqbufs(&vfh->queue, rb);
+}
+
+static int
+iss_video_querybuf(struct file *file, void *fh, struct v4l2_buffer *b)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(fh);
+
+       return vb2_querybuf(&vfh->queue, b);
+}
+
+static int
+iss_video_qbuf(struct file *file, void *fh, struct v4l2_buffer *b)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(fh);
+
+       return vb2_qbuf(&vfh->queue, b);
+}
+
+static int
+iss_video_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(fh);
+
+       return vb2_dqbuf(&vfh->queue, b, file->f_flags & O_NONBLOCK);
+}
+
+/*
+ * Stream management
+ *
+ * Every ISS pipeline has a single input and a single output. The input can be
+ * either a sensor or a video node. The output is always a video node.
+ *
+ * As every pipeline has an output video node, the ISS video objects at the
+ * pipeline output stores the pipeline state. It tracks the streaming state of
+ * both the input and output, as well as the availability of buffers.
+ *
+ * In sensor-to-memory mode, frames are always available at the pipeline input.
+ * Starting the sensor usually requires I2C transfers and must be done in
+ * interruptible context. The pipeline is started and stopped synchronously
+ * to the stream on/off commands. All modules in the pipeline will get their
+ * subdev set stream handler called. The module at the end of the pipeline must
+ * delay starting the hardware until buffers are available at its output.
+ *
+ * In memory-to-memory mode, starting/stopping the stream requires
+ * synchronization between the input and output. ISS modules can't be stopped
+ * in the middle of a frame, and at least some of the modules seem to become
+ * busy as soon as they're started, even if they don't receive a frame start
+ * event. For that reason frames need to be processed in single-shot mode. The
+ * driver needs to wait until a frame is completely processed and written to
+ * memory before restarting the pipeline for the next frame. Pipelined
+ * processing might be possible but requires more testing.
+ *
+ * Stream start must be delayed until buffers are available at both the input
+ * and output. The pipeline must be started in the videobuf queue callback with
+ * the buffers queue spinlock held. The modules subdev set stream operation must
+ * not sleep.
+ */
+static int
+iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(fh);
+       struct iss_video *video = video_drvdata(file);
+       enum iss_pipeline_state state;
+       struct iss_pipeline *pipe;
+       struct iss_video *far_end;
+       unsigned long flags;
+       int ret;
+
+       if (type != video->type)
+               return -EINVAL;
+
+       mutex_lock(&video->stream_lock);
+
+       /* Start streaming on the pipeline. No link touching an entity in the
+        * pipeline can be activated or deactivated once streaming is started.
+        */
+       pipe = video->video.entity.pipe
+            ? to_iss_pipeline(&video->video.entity) : &video->pipe;
+       pipe->external = NULL;
+       pipe->external_rate = 0;
+       pipe->external_bpp = 0;
+
+       if (video->iss->pdata->set_constraints)
+               video->iss->pdata->set_constraints(video->iss, true);
+
+       ret = media_entity_pipeline_start(&video->video.entity, &pipe->pipe);
+       if (ret < 0)
+               goto err_media_entity_pipeline_start;
+
+       /* Verify that the currently configured format matches the output of
+        * the connected subdev.
+        */
+       ret = iss_video_check_format(video, vfh);
+       if (ret < 0)
+               goto err_iss_video_check_format;
+
+       video->bpl_padding = ret;
+       video->bpl_value = vfh->format.fmt.pix.bytesperline;
+
+       /* Find the ISS video node connected at the far end of the pipeline and
+        * update the pipeline.
+        */
+       far_end = iss_video_far_end(video);
+
+       if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
+               state = ISS_PIPELINE_STREAM_OUTPUT | ISS_PIPELINE_IDLE_OUTPUT;
+               pipe->input = far_end;
+               pipe->output = video;
+       } else {
+               if (far_end == NULL) {
+                       ret = -EPIPE;
+                       goto err_iss_video_check_format;
+               }
+
+               state = ISS_PIPELINE_STREAM_INPUT | ISS_PIPELINE_IDLE_INPUT;
+               pipe->input = video;
+               pipe->output = far_end;
+       }
+
+       spin_lock_irqsave(&pipe->lock, flags);
+       pipe->state &= ~ISS_PIPELINE_STREAM;
+       pipe->state |= state;
+       spin_unlock_irqrestore(&pipe->lock, flags);
+
+       /* Set the maximum time per frame as the value requested by userspace.
+        * This is a soft limit that can be overridden if the hardware doesn't
+        * support the request limit.
+        */
+       if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
+               pipe->max_timeperframe = vfh->timeperframe;
+
+       video->queue = &vfh->queue;
+       INIT_LIST_HEAD(&video->dmaqueue);
+       spin_lock_init(&video->qlock);
+       atomic_set(&pipe->frame_number, -1);
+
+       ret = vb2_streamon(&vfh->queue, type);
+       if (ret < 0)
+               goto err_iss_video_check_format;
+
+       /* In sensor-to-memory mode, the stream can be started synchronously
+        * to the stream on command. In memory-to-memory mode, it will be
+        * started when buffers are queued on both the input and output.
+        */
+       if (pipe->input == NULL) {
+               unsigned long flags;
+               ret = omap4iss_pipeline_set_stream(pipe,
+                                             ISS_PIPELINE_STREAM_CONTINUOUS);
+               if (ret < 0)
+                       goto err_omap4iss_set_stream;
+               spin_lock_irqsave(&video->qlock, flags);
+               if (list_empty(&video->dmaqueue))
+                       video->dmaqueue_flags |= ISS_VIDEO_DMAQUEUE_UNDERRUN;
+               spin_unlock_irqrestore(&video->qlock, flags);
+       }
+
+       mutex_unlock(&video->stream_lock);
+       return 0;
+
+err_omap4iss_set_stream:
+       vb2_streamoff(&vfh->queue, type);
+err_iss_video_check_format:
+       media_entity_pipeline_stop(&video->video.entity);
+err_media_entity_pipeline_start:
+       if (video->iss->pdata->set_constraints)
+               video->iss->pdata->set_constraints(video->iss, false);
+       video->queue = NULL;
+
+       mutex_unlock(&video->stream_lock);
+       return ret;
+}
+
+static int
+iss_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(fh);
+       struct iss_video *video = video_drvdata(file);
+       struct iss_pipeline *pipe = to_iss_pipeline(&video->video.entity);
+       enum iss_pipeline_state state;
+       unsigned long flags;
+
+       if (type != video->type)
+               return -EINVAL;
+
+       mutex_lock(&video->stream_lock);
+
+       if (!vb2_is_streaming(&vfh->queue))
+               goto done;
+
+       /* Update the pipeline state. */
+       if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
+               state = ISS_PIPELINE_STREAM_OUTPUT
+                     | ISS_PIPELINE_QUEUE_OUTPUT;
+       else
+               state = ISS_PIPELINE_STREAM_INPUT
+                     | ISS_PIPELINE_QUEUE_INPUT;
+
+       spin_lock_irqsave(&pipe->lock, flags);
+       pipe->state &= ~state;
+       spin_unlock_irqrestore(&pipe->lock, flags);
+
+       /* Stop the stream. */
+       omap4iss_pipeline_set_stream(pipe, ISS_PIPELINE_STREAM_STOPPED);
+       vb2_streamoff(&vfh->queue, type);
+       video->queue = NULL;
+
+       if (video->iss->pdata->set_constraints)
+               video->iss->pdata->set_constraints(video->iss, false);
+       media_entity_pipeline_stop(&video->video.entity);
+
+done:
+       mutex_unlock(&video->stream_lock);
+       return 0;
+}
+
+static int
+iss_video_enum_input(struct file *file, void *fh, struct v4l2_input *input)
+{
+       if (input->index > 0)
+               return -EINVAL;
+
+       strlcpy(input->name, "camera", sizeof(input->name));
+       input->type = V4L2_INPUT_TYPE_CAMERA;
+
+       return 0;
+}
+
+static int
+iss_video_g_input(struct file *file, void *fh, unsigned int *input)
+{
+       *input = 0;
+
+       return 0;
+}
+
+static int
+iss_video_s_input(struct file *file, void *fh, unsigned int input)
+{
+       return input == 0 ? 0 : -EINVAL;
+}
+
+static const struct v4l2_ioctl_ops iss_video_ioctl_ops = {
+       .vidioc_querycap                = iss_video_querycap,
+       .vidioc_g_fmt_vid_cap           = iss_video_get_format,
+       .vidioc_s_fmt_vid_cap           = iss_video_set_format,
+       .vidioc_try_fmt_vid_cap         = iss_video_try_format,
+       .vidioc_g_fmt_vid_out           = iss_video_get_format,
+       .vidioc_s_fmt_vid_out           = iss_video_set_format,
+       .vidioc_try_fmt_vid_out         = iss_video_try_format,
+       .vidioc_cropcap                 = iss_video_cropcap,
+       .vidioc_g_crop                  = iss_video_get_crop,
+       .vidioc_s_crop                  = iss_video_set_crop,
+       .vidioc_g_parm                  = iss_video_get_param,
+       .vidioc_s_parm                  = iss_video_set_param,
+       .vidioc_reqbufs                 = iss_video_reqbufs,
+       .vidioc_querybuf                = iss_video_querybuf,
+       .vidioc_qbuf                    = iss_video_qbuf,
+       .vidioc_dqbuf                   = iss_video_dqbuf,
+       .vidioc_streamon                = iss_video_streamon,
+       .vidioc_streamoff               = iss_video_streamoff,
+       .vidioc_enum_input              = iss_video_enum_input,
+       .vidioc_g_input                 = iss_video_g_input,
+       .vidioc_s_input                 = iss_video_s_input,
+};
+
+/* -----------------------------------------------------------------------------
+ * V4L2 file operations
+ */
+
+static int iss_video_open(struct file *file)
+{
+       struct iss_video *video = video_drvdata(file);
+       struct iss_video_fh *handle;
+       struct vb2_queue *q;
+       int ret = 0;
+
+       handle = kzalloc(sizeof(*handle), GFP_KERNEL);
+       if (handle == NULL)
+               return -ENOMEM;
+
+       v4l2_fh_init(&handle->vfh, &video->video);
+       v4l2_fh_add(&handle->vfh);
+
+       /* If this is the first user, initialise the pipeline. */
+       if (omap4iss_get(video->iss) == NULL) {
+               ret = -EBUSY;
+               goto done;
+       }
+
+       ret = omap4iss_pipeline_pm_use(&video->video.entity, 1);
+       if (ret < 0) {
+               omap4iss_put(video->iss);
+               goto done;
+       }
+
+       video->alloc_ctx = vb2_dma_contig_init_ctx(video->iss->dev);
+       if (IS_ERR(video->alloc_ctx)) {
+               ret = PTR_ERR(video->alloc_ctx);
+               omap4iss_put(video->iss);
+               goto done;
+       }
+
+       q = &handle->queue;
+
+       q->type = video->type;
+       q->io_modes = VB2_MMAP;
+       q->drv_priv = handle;
+       q->ops = &iss_video_vb2ops;
+       q->mem_ops = &vb2_dma_contig_memops;
+       q->buf_struct_size = sizeof(struct iss_buffer);
+       q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+
+       ret = vb2_queue_init(q);
+       if (ret) {
+               omap4iss_put(video->iss);
+               goto done;
+       }
+
+       memset(&handle->format, 0, sizeof(handle->format));
+       handle->format.type = video->type;
+       handle->timeperframe.denominator = 1;
+
+       handle->video = video;
+       file->private_data = &handle->vfh;
+
+done:
+       if (ret < 0) {
+               v4l2_fh_del(&handle->vfh);
+               kfree(handle);
+       }
+
+       return ret;
+}
+
+static int iss_video_release(struct file *file)
+{
+       struct iss_video *video = video_drvdata(file);
+       struct v4l2_fh *vfh = file->private_data;
+       struct iss_video_fh *handle = to_iss_video_fh(vfh);
+
+       /* Disable streaming and free the buffers queue resources. */
+       iss_video_streamoff(file, vfh, video->type);
+
+       omap4iss_pipeline_pm_use(&video->video.entity, 0);
+
+       /* Release the videobuf2 queue */
+       vb2_queue_release(&handle->queue);
+
+       /* Release the file handle. */
+       v4l2_fh_del(vfh);
+       kfree(handle);
+       file->private_data = NULL;
+
+       omap4iss_put(video->iss);
+
+       return 0;
+}
+
+static unsigned int iss_video_poll(struct file *file, poll_table *wait)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(file->private_data);
+
+       return vb2_poll(&vfh->queue, file, wait);
+}
+
+static int iss_video_mmap(struct file *file, struct vm_area_struct *vma)
+{
+       struct iss_video_fh *vfh = to_iss_video_fh(file->private_data);
+
+       return vb2_mmap(&vfh->queue, vma);;
+}
+
+static struct v4l2_file_operations iss_video_fops = {
+       .owner = THIS_MODULE,
+       .unlocked_ioctl = video_ioctl2,
+       .open = iss_video_open,
+       .release = iss_video_release,
+       .poll = iss_video_poll,
+       .mmap = iss_video_mmap,
+};
+
+/* -----------------------------------------------------------------------------
+ * ISS video core
+ */
+
+static const struct iss_video_operations iss_video_dummy_ops = {
+};
+
+int omap4iss_video_init(struct iss_video *video, const char *name)
+{
+       const char *direction;
+       int ret;
+
+       switch (video->type) {
+       case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+               direction = "output";
+               video->pad.flags = MEDIA_PAD_FL_SINK;
+               break;
+       case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+               direction = "input";
+               video->pad.flags = MEDIA_PAD_FL_SOURCE;
+               break;
+
+       default:
+               return -EINVAL;
+       }
+
+       ret = media_entity_init(&video->video.entity, 1, &video->pad, 0);
+       if (ret < 0)
+               return ret;
+
+       mutex_init(&video->mutex);
+       atomic_set(&video->active, 0);
+
+       spin_lock_init(&video->pipe.lock);
+       mutex_init(&video->stream_lock);
+
+       /* Initialize the video device. */
+       if (video->ops == NULL)
+               video->ops = &iss_video_dummy_ops;
+
+       video->video.fops = &iss_video_fops;
+       snprintf(video->video.name, sizeof(video->video.name),
+                "OMAP4 ISS %s %s", name, direction);
+       video->video.vfl_type = VFL_TYPE_GRABBER;
+       video->video.release = video_device_release_empty;
+       video->video.ioctl_ops = &iss_video_ioctl_ops;
+       video->pipe.stream_state = ISS_PIPELINE_STREAM_STOPPED;
+
+       video_set_drvdata(&video->video, video);
+
+       return 0;
+}
+
+void omap4iss_video_cleanup(struct iss_video *video)
+{
+       media_entity_cleanup(&video->video.entity);
+       mutex_destroy(&video->stream_lock);
+       mutex_destroy(&video->mutex);
+}
+
+int omap4iss_video_register(struct iss_video *video, struct v4l2_device *vdev)
+{
+       int ret;
+
+       video->video.v4l2_dev = vdev;
+
+       ret = video_register_device(&video->video, VFL_TYPE_GRABBER, -1);
+       if (ret < 0)
+               printk(KERN_ERR "%s: could not register video device (%d)\n",
+                       __func__, ret);
+
+       return ret;
+}
+
+void omap4iss_video_unregister(struct iss_video *video)
+{
+       video_unregister_device(&video->video);
+}
diff --git a/drivers/staging/media/omap4iss/iss_video.h b/drivers/staging/media/omap4iss/iss_video.h
new file mode 100644 (file)
index 0000000..35f14d8
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ * TI OMAP4 ISS V4L2 Driver - Generic video node
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ *
+ * Author: Sergio Aguirre <sergio.a.aguirre@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.
+ */
+
+#ifndef OMAP4_ISS_VIDEO_H
+#define OMAP4_ISS_VIDEO_H
+
+#include <linux/v4l2-mediabus.h>
+#include <media/media-entity.h>
+#include <media/v4l2-dev.h>
+#include <media/v4l2-fh.h>
+#include <media/videobuf2-core.h>
+#include <media/videobuf2-dma-contig.h>
+
+#define ISS_VIDEO_DRIVER_NAME          "issvideo"
+#define ISS_VIDEO_DRIVER_VERSION       "0.0.2"
+
+struct iss_device;
+struct iss_video;
+struct v4l2_mbus_framefmt;
+struct v4l2_pix_format;
+
+/*
+ * struct iss_format_info - ISS media bus format information
+ * @code: V4L2 media bus format code
+ * @truncated: V4L2 media bus format code for the same format truncated to 10
+ *     bits. Identical to @code if the format is 10 bits wide or less.
+ * @uncompressed: V4L2 media bus format code for the corresponding uncompressed
+ *     format. Identical to @code if the format is not DPCM compressed.
+ * @flavor: V4L2 media bus format code for the same pixel layout but
+ *     shifted to be 8 bits per pixel. =0 if format is not shiftable.
+ * @pixelformat: V4L2 pixel format FCC identifier
+ * @bpp: Bits per pixel
+ */
+struct iss_format_info {
+       enum v4l2_mbus_pixelcode code;
+       enum v4l2_mbus_pixelcode truncated;
+       enum v4l2_mbus_pixelcode uncompressed;
+       enum v4l2_mbus_pixelcode flavor;
+       u32 pixelformat;
+       unsigned int bpp;
+};
+
+enum iss_pipeline_stream_state {
+       ISS_PIPELINE_STREAM_STOPPED = 0,
+       ISS_PIPELINE_STREAM_CONTINUOUS = 1,
+       ISS_PIPELINE_STREAM_SINGLESHOT = 2,
+};
+
+enum iss_pipeline_state {
+       /* The stream has been started on the input video node. */
+       ISS_PIPELINE_STREAM_INPUT = 1,
+       /* The stream has been started on the output video node. */
+       ISS_PIPELINE_STREAM_OUTPUT = (1 << 1),
+       /* At least one buffer is queued on the input video node. */
+       ISS_PIPELINE_QUEUE_INPUT = (1 << 2),
+       /* At least one buffer is queued on the output video node. */
+       ISS_PIPELINE_QUEUE_OUTPUT = (1 << 3),
+       /* The input entity is idle, ready to be started. */
+       ISS_PIPELINE_IDLE_INPUT = (1 << 4),
+       /* The output entity is idle, ready to be started. */
+       ISS_PIPELINE_IDLE_OUTPUT = (1 << 5),
+       /* The pipeline is currently streaming. */
+       ISS_PIPELINE_STREAM = (1 << 6),
+};
+
+/*
+ * struct iss_pipeline - An OMAP4 ISS hardware pipeline
+ * @error: A hardware error occurred during capture
+ */
+struct iss_pipeline {
+       struct media_pipeline pipe;
+       spinlock_t lock;                /* Pipeline state and queue flags */
+       unsigned int state;
+       enum iss_pipeline_stream_state stream_state;
+       struct iss_video *input;
+       struct iss_video *output;
+       atomic_t frame_number;
+       bool do_propagation; /* of frame number */
+       bool error;
+       struct v4l2_fract max_timeperframe;
+       struct v4l2_subdev *external;
+       unsigned int external_rate;
+       int external_bpp;
+};
+
+#define to_iss_pipeline(__e) \
+       container_of((__e)->pipe, struct iss_pipeline, pipe)
+
+static inline int iss_pipeline_ready(struct iss_pipeline *pipe)
+{
+       return pipe->state == (ISS_PIPELINE_STREAM_INPUT |
+                              ISS_PIPELINE_STREAM_OUTPUT |
+                              ISS_PIPELINE_QUEUE_INPUT |
+                              ISS_PIPELINE_QUEUE_OUTPUT |
+                              ISS_PIPELINE_IDLE_INPUT |
+                              ISS_PIPELINE_IDLE_OUTPUT);
+}
+
+/*
+ * struct iss_buffer - ISS buffer
+ * @buffer: ISS video buffer
+ * @iss_addr: Physical address of the buffer.
+ */
+struct iss_buffer {
+       /* common v4l buffer stuff -- must be first */
+       struct vb2_buffer       vb;
+       struct list_head        list;
+       dma_addr_t iss_addr;
+};
+
+#define to_iss_buffer(buf)     container_of(buf, struct iss_buffer, buffer)
+
+enum iss_video_dmaqueue_flags {
+       /* Set if DMA queue becomes empty when ISS_PIPELINE_STREAM_CONTINUOUS */
+       ISS_VIDEO_DMAQUEUE_UNDERRUN = (1 << 0),
+       /* Set when queuing buffer to an empty DMA queue */
+       ISS_VIDEO_DMAQUEUE_QUEUED = (1 << 1),
+};
+
+#define iss_video_dmaqueue_flags_clr(video)    \
+                       ({ (video)->dmaqueue_flags = 0; })
+
+/*
+ * struct iss_video_operations - ISS video operations
+ * @queue:     Resume streaming when a buffer is queued. Called on VIDIOC_QBUF
+ *             if there was no buffer previously queued.
+ */
+struct iss_video_operations {
+       int(*queue)(struct iss_video *video, struct iss_buffer *buffer);
+};
+
+struct iss_video {
+       struct video_device video;
+       enum v4l2_buf_type type;
+       struct media_pad pad;
+
+       struct mutex mutex;             /* format and crop settings */
+       atomic_t active;
+
+       struct iss_device *iss;
+
+       unsigned int capture_mem;
+       unsigned int bpl_alignment;     /* alignment value */
+       unsigned int bpl_zero_padding;  /* whether the alignment is optional */
+       unsigned int bpl_max;           /* maximum bytes per line value */
+       unsigned int bpl_value;         /* bytes per line value */
+       unsigned int bpl_padding;       /* padding at end of line */
+
+       /* Pipeline state */
+       struct iss_pipeline pipe;
+       struct mutex stream_lock;       /* pipeline and stream states */
+
+       /* Video buffers queue */
+       struct vb2_queue *queue;
+       spinlock_t qlock;       /* Spinlock for dmaqueue */
+       struct list_head dmaqueue;
+       enum iss_video_dmaqueue_flags dmaqueue_flags;
+       struct vb2_alloc_ctx *alloc_ctx;
+
+       const struct iss_video_operations *ops;
+};
+
+#define to_iss_video(vdev)     container_of(vdev, struct iss_video, video)
+
+struct iss_video_fh {
+       struct v4l2_fh vfh;
+       struct iss_video *video;
+       struct vb2_queue queue;
+       struct v4l2_format format;
+       struct v4l2_fract timeperframe;
+};
+
+#define to_iss_video_fh(fh)    container_of(fh, struct iss_video_fh, vfh)
+#define iss_video_queue_to_iss_video_fh(q) \
+                               container_of(q, struct iss_video_fh, queue)
+
+int omap4iss_video_init(struct iss_video *video, const char *name);
+void omap4iss_video_cleanup(struct iss_video *video);
+int omap4iss_video_register(struct iss_video *video,
+                           struct v4l2_device *vdev);
+void omap4iss_video_unregister(struct iss_video *video);
+struct iss_buffer *omap4iss_video_buffer_next(struct iss_video *video);
+struct media_pad *omap4iss_video_remote_pad(struct iss_video *video);
+
+const struct iss_format_info *
+omap4iss_video_format_info(enum v4l2_mbus_pixelcode code);
+
+#endif /* OMAP4_ISS_VIDEO_H */
index 9f6ebdb23740596f530e9ab5d52194ca3c9c438e..a85c3d68c462b1a14b8a517445521a6df61bf64e 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/types.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
 
index 1aa4a3fd0f1ba3b023367974593897ba1077df18..56e355b3e7fa00b5dd6a8ca4929071cc5cdaca09 100644 (file)
@@ -258,7 +258,8 @@ err:
 /* This function maps kernel space memory to user space memory. */
 static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-       u32 status;
+       struct omap_dsp_platform_data *pdata =
+                                       omap_dspbridge_dev->dev.platform_data;
 
        /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
@@ -268,13 +269,9 @@ static int bridge_mmap(struct file *filp, struct vm_area_struct *vma)
                vma->vm_start, vma->vm_end, vma->vm_page_prot,
                vma->vm_flags);
 
-       status = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
-                                vma->vm_end - vma->vm_start,
-                                vma->vm_page_prot);
-       if (status != 0)
-               status = -EAGAIN;
-
-       return status;
+       return vm_iomap_memory(vma,
+                              pdata->phys_mempool_base,
+                              pdata->phys_mempool_size);
 }
 
 static const struct file_operations bridge_fops = {
index 0f74945af624962266803ce242ef10509906a6a4..268b62768f2b41eab5f7db4d4c5c8b9111f248b6 100644 (file)
@@ -810,7 +810,8 @@ static void process_echoes(struct tty_struct *tty)
        struct n_tty_data *ldata = tty->disc_data;
        size_t echoed;
 
-       if (!L_ECHO(tty) || ldata->echo_commit == ldata->echo_tail)
+       if ((!L_ECHO(tty) && !L_ECHONL(tty)) ||
+           ldata->echo_commit == ldata->echo_tail)
                return;
 
        mutex_lock(&ldata->output_lock);
@@ -825,7 +826,8 @@ static void flush_echoes(struct tty_struct *tty)
 {
        struct n_tty_data *ldata = tty->disc_data;
 
-       if (!L_ECHO(tty) || ldata->echo_commit == ldata->echo_head)
+       if ((!L_ECHO(tty) && !L_ECHONL(tty)) ||
+           ldata->echo_commit == ldata->echo_head)
                return;
 
        mutex_lock(&ldata->output_lock);
index ec06505e3ae63704d73f44ad23252b3de7bc6656..97888f4900eced03ab3a656faa6de016c16d3851 100644 (file)
@@ -421,6 +421,7 @@ struct psc_fifoc {
 
 static struct psc_fifoc __iomem *psc_fifoc;
 static unsigned int psc_fifoc_irq;
+static struct clk *psc_fifoc_clk;
 
 static void mpc512x_psc_fifo_init(struct uart_port *port)
 {
@@ -568,36 +569,73 @@ static unsigned int mpc512x_psc_set_baudrate(struct uart_port *port,
 /* Init PSC FIFO Controller */
 static int __init mpc512x_psc_fifoc_init(void)
 {
+       int err;
        struct device_node *np;
+       struct clk *clk;
+
+       /* default error code, potentially overwritten by clock calls */
+       err = -ENODEV;
 
        np = of_find_compatible_node(NULL, NULL,
                                     "fsl,mpc5121-psc-fifo");
        if (!np) {
                pr_err("%s: Can't find FIFOC node\n", __func__);
-               return -ENODEV;
+               goto out_err;
        }
 
+       clk = of_clk_get(np, 0);
+       if (IS_ERR(clk)) {
+               /* backwards compat with device trees that lack clock specs */
+               clk = clk_get_sys(np->name, "ipg");
+       }
+       if (IS_ERR(clk)) {
+               pr_err("%s: Can't lookup FIFO clock\n", __func__);
+               err = PTR_ERR(clk);
+               goto out_ofnode_put;
+       }
+       if (clk_prepare_enable(clk)) {
+               pr_err("%s: Can't enable FIFO clock\n", __func__);
+               clk_put(clk);
+               goto out_ofnode_put;
+       }
+       psc_fifoc_clk = clk;
+
        psc_fifoc = of_iomap(np, 0);
        if (!psc_fifoc) {
                pr_err("%s: Can't map FIFOC\n", __func__);
-               of_node_put(np);
-               return -ENODEV;
+               goto out_clk_disable;
        }
 
        psc_fifoc_irq = irq_of_parse_and_map(np, 0);
-       of_node_put(np);
        if (psc_fifoc_irq == 0) {
                pr_err("%s: Can't get FIFOC irq\n", __func__);
-               iounmap(psc_fifoc);
-               return -ENODEV;
+               goto out_unmap;
        }
 
+       of_node_put(np);
        return 0;
+
+out_unmap:
+       iounmap(psc_fifoc);
+out_clk_disable:
+       clk_disable_unprepare(psc_fifoc_clk);
+       clk_put(psc_fifoc_clk);
+out_ofnode_put:
+       of_node_put(np);
+out_err:
+       return err;
 }
 
 static void __exit mpc512x_psc_fifoc_uninit(void)
 {
        iounmap(psc_fifoc);
+
+       /* disable the clock, errors are not fatal */
+       if (psc_fifoc_clk) {
+               clk_disable_unprepare(psc_fifoc_clk);
+               clk_put(psc_fifoc_clk);
+               psc_fifoc_clk = NULL;
+       }
 }
 
 /* 512x specific interrupt handler. The caller holds the port lock */
@@ -619,29 +657,55 @@ static irqreturn_t mpc512x_psc_handle_irq(struct uart_port *port)
 }
 
 static struct clk *psc_mclk_clk[MPC52xx_PSC_MAXNUM];
+static struct clk *psc_ipg_clk[MPC52xx_PSC_MAXNUM];
 
 /* called from within the .request_port() callback (allocation) */
 static int mpc512x_psc_alloc_clock(struct uart_port *port)
 {
        int psc_num;
-       char clk_name[16];
        struct clk *clk;
        int err;
 
        psc_num = (port->mapbase & 0xf00) >> 8;
-       snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num);
-       clk = devm_clk_get(port->dev, clk_name);
+
+       clk = devm_clk_get(port->dev, "mclk");
        if (IS_ERR(clk)) {
                dev_err(port->dev, "Failed to get MCLK!\n");
-               return PTR_ERR(clk);
+               err = PTR_ERR(clk);
+               goto out_err;
        }
        err = clk_prepare_enable(clk);
        if (err) {
                dev_err(port->dev, "Failed to enable MCLK!\n");
-               return err;
+               goto out_err;
        }
        psc_mclk_clk[psc_num] = clk;
+
+       clk = devm_clk_get(port->dev, "ipg");
+       if (IS_ERR(clk)) {
+               dev_err(port->dev, "Failed to get IPG clock!\n");
+               err = PTR_ERR(clk);
+               goto out_err;
+       }
+       err = clk_prepare_enable(clk);
+       if (err) {
+               dev_err(port->dev, "Failed to enable IPG clock!\n");
+               goto out_err;
+       }
+       psc_ipg_clk[psc_num] = clk;
+
        return 0;
+
+out_err:
+       if (psc_mclk_clk[psc_num]) {
+               clk_disable_unprepare(psc_mclk_clk[psc_num]);
+               psc_mclk_clk[psc_num] = NULL;
+       }
+       if (psc_ipg_clk[psc_num]) {
+               clk_disable_unprepare(psc_ipg_clk[psc_num]);
+               psc_ipg_clk[psc_num] = NULL;
+       }
+       return err;
 }
 
 /* called from within the .release_port() callback (release) */
@@ -656,6 +720,10 @@ static void mpc512x_psc_relse_clock(struct uart_port *port)
                clk_disable_unprepare(clk);
                psc_mclk_clk[psc_num] = NULL;
        }
+       if (psc_ipg_clk[psc_num]) {
+               clk_disable_unprepare(psc_ipg_clk[psc_num]);
+               psc_ipg_clk[psc_num] = NULL;
+       }
 }
 
 /* implementation of the .clock() callback (enable/disable) */
index 7d8103cd3e2ec56eacbb5a5d3f3f332597e190ff..e7e9cabb21fd2a4a6613f075632e6f16f3432a33 100644 (file)
@@ -52,6 +52,7 @@
 #include <linux/scatterlist.h>
 #include <linux/slab.h>
 #include <linux/gpio.h>
+#include <linux/of.h>
 
 #ifdef CONFIG_SUPERH
 #include <asm/sh_bios.h>
@@ -2437,6 +2438,112 @@ static int sci_remove(struct platform_device *dev)
        return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id of_sci_match[] = {
+       { .compatible = "renesas,sci-SCI-uart",
+               .data = (void *)PORT_SCI },
+       { .compatible = "renesas,sci-SCIF-uart",
+               .data = (void *)PORT_SCIF },
+       { .compatible = "renesas,sci-IRDA-uart",
+               .data = (void *)PORT_IRDA },
+       { .compatible = "renesas,sci-SCIFA-uart",
+               .data = (void *)PORT_SCIFA },
+       { .compatible = "renesas,sci-SCIFB-uart",
+               .data = (void *)PORT_SCIFB },
+       {},
+};
+MODULE_DEVICE_TABLE(of, of_sci_match);
+
+static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev,
+                                                               int *dev_id)
+{
+       struct plat_sci_port *p;
+       struct device_node *np = pdev->dev.of_node;
+       const struct of_device_id *match;
+       struct resource *res;
+       const __be32 *prop;
+       int i, irq, val;
+
+       match = of_match_node(of_sci_match, pdev->dev.of_node);
+       if (!match || !match->data) {
+               dev_err(&pdev->dev, "OF match error\n");
+               return NULL;
+       }
+
+       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;
+       }
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res) {
+               dev_err(&pdev->dev, "failed to get I/O memory\n");
+               return NULL;
+       }
+       p->mapbase = res->start;
+
+       for (i = 0; i < SCIx_NR_IRQS; i++) {
+               irq = platform_get_irq(pdev, i);
+               if (irq < 0) {
+                       dev_err(&pdev->dev, "failed to get irq data %d\n", i);
+                       return NULL;
+               }
+               p->irqs[i] = irq;
+       }
+
+       prop = of_get_property(np, "cell-index", NULL);
+       if (!prop) {
+               dev_err(&pdev->dev, "required DT prop cell-index missing\n");
+               return NULL;
+       }
+       *dev_id = be32_to_cpup(prop);
+
+       prop = of_get_property(np, "renesas,scscr", NULL);
+       if (!prop) {
+               dev_err(&pdev->dev, "required DT prop scscr missing\n");
+               return NULL;
+       }
+       p->scscr = be32_to_cpup(prop);
+
+       prop = of_get_property(np, "renesas,scbrr-algo-id", NULL);
+       if (!prop) {
+               dev_err(&pdev->dev, "required DT prop scbrr-algo-id missing\n");
+               return NULL;
+       }
+       val = be32_to_cpup(prop);
+       if (val <= SCBRR_ALGO_INVALID || val >= SCBRR_NR_ALGOS) {
+               dev_err(&pdev->dev, "DT prop scbrr-algo-id out of range\n");
+               return NULL;
+       }
+       p->scbrr_algo_id = val;
+
+       p->flags = UPF_IOREMAP;
+       if (of_get_property(np, "renesas,autoconf", NULL))
+               p->flags |= UPF_BOOT_AUTOCONF;
+
+       prop = of_get_property(np, "renesas,regtype", NULL);
+       if (prop) {
+               val = be32_to_cpup(prop);
+               if (val < SCIx_PROBE_REGTYPE || val >= SCIx_NR_REGTYPES) {
+                       dev_err(&pdev->dev, "DT prop regtype out of range\n");
+                       return NULL;
+               }
+               p->regtype = val;
+       }
+
+       p->type = (unsigned int)match->data;
+
+       return p;
+}
+#else
+static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev,
+                                                               int *dev_id)
+{
+       return NULL;
+}
+#endif /* CONFIG_OF */
+
 static int sci_probe_single(struct platform_device *dev,
                                      unsigned int index,
                                      struct plat_sci_port *p,
@@ -2469,9 +2576,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];
-       int ret;
+       struct plat_sci_port *p;
+       struct sci_port *sp;
+       int ret, dev_id = dev->id;
 
        /*
         * If we've come here via earlyprintk initialization, head off to
@@ -2481,9 +2588,20 @@ 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);
+       else
+               p = dev_get_platdata(&dev->dev);
+
+       if (!p) {
+               dev_err(&dev->dev, "no setup data supplied\n");
+               return -EINVAL;
+       }
+
+       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 +2653,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 5d8981c5235e50e42776cfb9f672977c11a61ef0..6e73f8cd60e513ca44de8d6bd00fe69085e4453f 100644 (file)
@@ -642,6 +642,10 @@ static int ci_hdrc_probe(struct platform_device *pdev)
                        : CI_ROLE_GADGET;
        }
 
+       /* only update vbus status for peripheral */
+       if (ci->role == CI_ROLE_GADGET)
+               ci_handle_vbus_change(ci);
+
        ret = ci_role_start(ci, ci->role);
        if (ret) {
                dev_err(dev, "can't start %s role\n", ci_role(ci)->name);
index 59e6020ea7539e5e331364ac067c9a16f27855ba..526cd77563d8a89c29f5444901ee3ba366b1575a 100644 (file)
@@ -88,7 +88,8 @@ static int host_start(struct ci_hdrc *ci)
        return ret;
 
 disable_reg:
-       regulator_disable(ci->platdata->reg_vbus);
+       if (ci->platdata->reg_vbus)
+               regulator_disable(ci->platdata->reg_vbus);
 
 put_hcd:
        usb_put_hcd(hcd);
index b34c81969cba672a7e880f405f2445adf36b7e6f..69d20fbb38a26a32357cc9f5d7fc4f81efa08cca 100644 (file)
@@ -1795,9 +1795,6 @@ static int udc_start(struct ci_hdrc *ci)
        pm_runtime_no_callbacks(&ci->gadget.dev);
        pm_runtime_enable(&ci->gadget.dev);
 
-       /* Update ci->vbus_active */
-       ci_handle_vbus_change(ci);
-
        return retval;
 
 destroy_eps:
index 3e7560f004f86d7153ed3ea0eeabed09dabf6b47..e8404319ca68b93d7b1d05b881b4d1bed8d1ded8 100644 (file)
@@ -1515,6 +1515,8 @@ static int acm_reset_resume(struct usb_interface *intf)
 
 static const struct usb_device_id acm_ids[] = {
        /* quirky and broken devices */
+       { USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */
+       .driver_info = NO_UNION_NORMAL, },/* has no union descriptor */
        { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */
        .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
        },
index 4d387596f3f0a6e531caa1a9049a383d605091b4..0b23a8639311b182ee9e2afddcec1cb888269257 100644 (file)
@@ -854,13 +854,11 @@ static int wdm_manage_power(struct usb_interface *intf, int on)
 {
        /* need autopm_get/put here to ensure the usbcore sees the new value */
        int rv = usb_autopm_get_interface(intf);
-       if (rv < 0)
-               goto err;
 
        intf->needs_remote_wakeup = on;
-       usb_autopm_put_interface(intf);
-err:
-       return rv;
+       if (!rv)
+               usb_autopm_put_interface(intf);
+       return 0;
 }
 
 static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
index a7c04e24ca484deb233db5dcfd995b73427c4cc0..bd9dc3504b5149b2ff5091d67bb514a92cbc0a88 100644 (file)
@@ -4832,8 +4832,9 @@ static void hub_events(void)
                                        hub->ports[i - 1]->child;
 
                                dev_dbg(hub_dev, "warm reset port %d\n", i);
-                               if (!udev || !(portstatus &
-                                               USB_PORT_STAT_CONNECTION)) {
+                               if (!udev ||
+                                   !(portstatus & USB_PORT_STAT_CONNECTION) ||
+                                   udev->state == USB_STATE_NOTATTACHED) {
                                        status = hub_port_reset(hub, i,
                                                        NULL, HUB_BH_RESET_TIME,
                                                        true);
index 4e243c37f17f50ab197582a3ee5d4662e933d368..f0155a39aaa3b686f1b392c7d59781a8f76fda5d 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/acpi.h>
 #include <linux/pci.h>
 #include <linux/usb/hcd.h>
-#include <acpi/acpi_bus.h>
 
 #include "usb.h"
 
@@ -127,7 +126,7 @@ out:
        return ret;
 }
 
-static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
+static struct acpi_device *usb_acpi_find_companion(struct device *dev)
 {
        struct usb_device *udev;
        acpi_handle *parent_handle;
@@ -169,16 +168,15 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
                                break;
                        }
 
-                       return -ENODEV;
+                       return NULL;
                }
 
                /* root hub's parent is the usb hcd. */
-               parent_handle = ACPI_HANDLE(dev->parent);
-               *handle = acpi_get_child(parent_handle, udev->portnum);
-               if (!*handle)
-                       return -ENODEV;
-               return 0;
+               return acpi_find_child_device(ACPI_COMPANION(dev->parent),
+                                             udev->portnum, false);
        } else if (is_usb_port(dev)) {
+               struct acpi_device *adev = NULL;
+
                sscanf(dev_name(dev), "port%d", &port_num);
                /* Get the struct usb_device point of port's hub */
                udev = to_usb_device(dev->parent->parent);
@@ -194,26 +192,27 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
 
                        raw_port_num = usb_hcd_find_raw_port_number(hcd,
                                port_num);
-                       *handle = acpi_get_child(ACPI_HANDLE(&udev->dev),
-                               raw_port_num);
-                       if (!*handle)
-                               return -ENODEV;
+                       adev = acpi_find_child_device(ACPI_COMPANION(&udev->dev),
+                                                     raw_port_num, false);
+                       if (!adev)
+                               return NULL;
                } else {
                        parent_handle =
                                usb_get_hub_port_acpi_handle(udev->parent,
                                udev->portnum);
                        if (!parent_handle)
-                               return -ENODEV;
+                               return NULL;
 
-                       *handle = acpi_get_child(parent_handle, port_num);
-                       if (!*handle)
-                               return -ENODEV;
+                       acpi_bus_get_device(parent_handle, &adev);
+                       adev = acpi_find_child_device(adev, port_num, false);
+                       if (!adev)
+                               return NULL;
                }
-               usb_acpi_check_port_connect_type(udev, *handle, port_num);
-       } else
-               return -ENODEV;
+               usb_acpi_check_port_connect_type(udev, adev->handle, port_num);
+               return adev;
+       }
 
-       return 0;
+       return NULL;
 }
 
 static bool usb_acpi_bus_match(struct device *dev)
@@ -224,7 +223,7 @@ static bool usb_acpi_bus_match(struct device *dev)
 static struct acpi_bus_type usb_acpi_bus = {
        .name = "USB",
        .match = usb_acpi_bus_match,
-       .find_device = usb_acpi_find_device,
+       .find_companion = usb_acpi_find_companion,
 };
 
 int usb_acpi_register(void)
index 74f9cf02da070a6d1c23b643a56f76e3264fb8cd..a49217ae35333846bb76912666f0efa12bca6813 100644 (file)
@@ -455,9 +455,6 @@ static int dwc3_probe(struct platform_device *pdev)
        if (IS_ERR(regs))
                return PTR_ERR(regs);
 
-       usb_phy_set_suspend(dwc->usb2_phy, 0);
-       usb_phy_set_suspend(dwc->usb3_phy, 0);
-
        spin_lock_init(&dwc->lock);
        platform_set_drvdata(pdev, dwc);
 
@@ -488,6 +485,9 @@ static int dwc3_probe(struct platform_device *pdev)
                goto err0;
        }
 
+       usb_phy_set_suspend(dwc->usb2_phy, 0);
+       usb_phy_set_suspend(dwc->usb3_phy, 0);
+
        ret = dwc3_event_buffers_setup(dwc);
        if (ret) {
                dev_err(dwc->dev, "failed to setup event buffers\n");
@@ -569,6 +569,8 @@ err2:
        dwc3_event_buffers_cleanup(dwc);
 
 err1:
+       usb_phy_set_suspend(dwc->usb2_phy, 1);
+       usb_phy_set_suspend(dwc->usb3_phy, 1);
        dwc3_core_exit(dwc);
 
 err0:
index 95f7649c71a78745692a63bafd1527daacda52e3..21a352079bc25fdd0fe33ddba1a3191b29b812f0 100644 (file)
@@ -459,6 +459,8 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
                        dep = dwc3_wIndex_to_dep(dwc, wIndex);
                        if (!dep)
                                return -EINVAL;
+                       if (set == 0 && (dep->flags & DWC3_EP_WEDGE))
+                               break;
                        ret = __dwc3_gadget_ep_set_halt(dep, set);
                        if (ret)
                                return -EINVAL;
index 5452c0fce36074d4238e3553bb00d879d8df9ac3..02e44fcaf205e3eaf4a69e706c41d6e081c6c1e5 100644 (file)
@@ -1200,9 +1200,6 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value)
                else
                        dep->flags |= DWC3_EP_STALL;
        } else {
-               if (dep->flags & DWC3_EP_WEDGE)
-                       return 0;
-
                ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
                        DWC3_DEPCMD_CLEARSTALL, &params);
                if (ret)
@@ -1210,7 +1207,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value)
                                        value ? "set" : "clear",
                                        dep->name);
                else
-                       dep->flags &= ~DWC3_EP_STALL;
+                       dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE);
        }
 
        return ret;
index a91e6422f93021f912042298a99cdde36362b09b..f66d96ad1f51eb96d1806187dbb564675a02b8f0 100644 (file)
@@ -682,6 +682,7 @@ config USB_CONFIGFS_PHONET
 config USB_CONFIGFS_MASS_STORAGE
        boolean "Mass storage"
        depends on USB_CONFIGFS
+       depends on BLOCK
        select USB_F_MASS_STORAGE
        help
          The Mass Storage Gadget acts as a USB Mass Storage disk drive.
index 2cb52e0438df1b349a1feca20749e3290739a94a..9f71d9fdcc143206d8947b00e1c8d5cebb33297f 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 3e7ae707f691c4b0cf4b701024d8df0af4a5bb69..2018ba1a2172d4bb26faea20c34e44653070e91f 100644 (file)
@@ -593,6 +593,7 @@ static void reset_config(struct usb_composite_dev *cdev)
                bitmap_zero(f->endpoints, 32);
        }
        cdev->config = NULL;
+       cdev->delayed_status = 0;
 }
 
 static int set_config(struct usb_composite_dev *cdev,
index 774e8b89cdb593bf951b5c82e97c169f921a6130..241fc873ffa4569fcc98a3a93ff98e3f07339d72 100644 (file)
@@ -1304,7 +1304,7 @@ static struct ffs_data *ffs_data_new(void)
 {
        struct ffs_data *ffs = kzalloc(sizeof *ffs, GFP_KERNEL);
        if (unlikely(!ffs))
-               return 0;
+               return NULL;
 
        ENTER();
 
index a03ba2c83589ee15f9c1880d17f1aa133eb47f29..b963939088606e7e9252ec1f55d42ff9fdd1dcd3 100644 (file)
@@ -523,7 +523,7 @@ static int fsg_setup(struct usb_function *f,
                 */
                DBG(fsg, "bulk reset request\n");
                raise_exception(fsg->common, FSG_STATE_RESET);
-               return DELAYED_STATUS;
+               return USB_GADGET_DELAYED_STATUS;
 
        case US_BULK_GET_MAX_LUN:
                if (ctrl->bRequestType !=
@@ -602,13 +602,14 @@ static bool start_out_transfer(struct fsg_common *common, struct fsg_buffhd *bh)
        return true;
 }
 
-static int sleep_thread(struct fsg_common *common)
+static int sleep_thread(struct fsg_common *common, bool can_freeze)
 {
        int     rc = 0;
 
        /* Wait until a signal arrives or we are woken up */
        for (;;) {
-               try_to_freeze();
+               if (can_freeze)
+                       try_to_freeze();
                set_current_state(TASK_INTERRUPTIBLE);
                if (signal_pending(current)) {
                        rc = -EINTR;
@@ -682,7 +683,7 @@ static int do_read(struct fsg_common *common)
                /* Wait for the next buffer to become available */
                bh = common->next_buffhd_to_fill;
                while (bh->state != BUF_STATE_EMPTY) {
-                       rc = sleep_thread(common);
+                       rc = sleep_thread(common, false);
                        if (rc)
                                return rc;
                }
@@ -937,7 +938,7 @@ static int do_write(struct fsg_common *common)
                }
 
                /* Wait for something to happen */
-               rc = sleep_thread(common);
+               rc = sleep_thread(common, false);
                if (rc)
                        return rc;
        }
@@ -1504,7 +1505,7 @@ static int throw_away_data(struct fsg_common *common)
                }
 
                /* Otherwise wait for something to happen */
-               rc = sleep_thread(common);
+               rc = sleep_thread(common, true);
                if (rc)
                        return rc;
        }
@@ -1625,7 +1626,7 @@ static int send_status(struct fsg_common *common)
        /* Wait for the next buffer to become available */
        bh = common->next_buffhd_to_fill;
        while (bh->state != BUF_STATE_EMPTY) {
-               rc = sleep_thread(common);
+               rc = sleep_thread(common, true);
                if (rc)
                        return rc;
        }
@@ -1828,7 +1829,7 @@ static int do_scsi_command(struct fsg_common *common)
        bh = common->next_buffhd_to_fill;
        common->next_buffhd_to_drain = bh;
        while (bh->state != BUF_STATE_EMPTY) {
-               rc = sleep_thread(common);
+               rc = sleep_thread(common, true);
                if (rc)
                        return rc;
        }
@@ -2174,7 +2175,7 @@ static int get_next_command(struct fsg_common *common)
        /* Wait for the next buffer to become available */
        bh = common->next_buffhd_to_fill;
        while (bh->state != BUF_STATE_EMPTY) {
-               rc = sleep_thread(common);
+               rc = sleep_thread(common, true);
                if (rc)
                        return rc;
        }
@@ -2193,7 +2194,7 @@ static int get_next_command(struct fsg_common *common)
 
        /* Wait for the CBW to arrive */
        while (bh->state != BUF_STATE_FULL) {
-               rc = sleep_thread(common);
+               rc = sleep_thread(common, true);
                if (rc)
                        return rc;
        }
@@ -2379,7 +2380,7 @@ static void handle_exception(struct fsg_common *common)
                        }
                        if (num_active == 0)
                                break;
-                       if (sleep_thread(common))
+                       if (sleep_thread(common, true))
                                return;
                }
 
@@ -2516,7 +2517,7 @@ static int fsg_main_thread(void *common_)
                }
 
                if (!common->running) {
-                       sleep_thread(common);
+                       sleep_thread(common, true);
                        continue;
                }
 
@@ -3111,7 +3112,7 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
                                          fsg->common->can_stall);
                if (ret)
                        return ret;
-               fsg_common_set_inquiry_string(fsg->common, 0, 0);
+               fsg_common_set_inquiry_string(fsg->common, NULL, NULL);
                ret = fsg_common_run_thread(fsg->common);
                if (ret)
                        return ret;
index 0ac6064aa3b86b6cd2376324ac9996f8ece1c0a0..409a3c45a36af1ec596ad4d9bf2c117c9f493444 100644 (file)
@@ -54,6 +54,7 @@
  */
 #ifdef CONFIG_ARCH_PXA
 #include <mach/pxa25x-udc.h>
+#include <mach/hardware.h>
 #endif
 
 #ifdef CONFIG_ARCH_LUBBOCK
index 9875d9c0823f7c554744a40acb0a70897dde0bc6..e20bc109fdd70f43eec9e1572d3fa8f75e6ba423 100644 (file)
@@ -1180,6 +1180,7 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
 }
 
 static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg);
+static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg);
 
 /**
  * s3c_hsotg_process_control - process a control request
@@ -1221,6 +1222,7 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
        if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
                switch (ctrl->bRequest) {
                case USB_REQ_SET_ADDRESS:
+                       s3c_hsotg_disconnect(hsotg);
                        dcfg = readl(hsotg->regs + DCFG);
                        dcfg &= ~DCFG_DevAddr_MASK;
                        dcfg |= ctrl->wValue << DCFG_DevAddr_SHIFT;
@@ -1245,7 +1247,9 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg,
        /* as a fallback, try delivering it to the driver to deal with */
 
        if (ret == 0 && hsotg->driver) {
+               spin_unlock(&hsotg->lock);
                ret = hsotg->driver->setup(&hsotg->gadget, ctrl);
+               spin_lock(&hsotg->lock);
                if (ret < 0)
                        dev_dbg(hsotg->dev, "driver->setup() ret %d\n", ret);
        }
@@ -1308,10 +1312,12 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep,
                return;
        }
 
+       spin_lock(&hsotg->lock);
        if (req->actual == 0)
                s3c_hsotg_enqueue_setup(hsotg);
        else
                s3c_hsotg_process_control(hsotg, req->buf);
+       spin_unlock(&hsotg->lock);
 }
 
 /**
@@ -2533,7 +2539,6 @@ irq_retry:
                writel(GINTSTS_USBSusp, hsotg->regs + GINTSTS);
 
                call_gadget(hsotg, suspend);
-               s3c_hsotg_disconnect(hsotg);
        }
 
        if (gintsts & GINTSTS_WkUpInt) {
index c74c2fdbd56eda5683a13995a96b6221711c30ef..70c891469f574ebd1d7719fc05bcf838d1d6e3cb 100644 (file)
@@ -119,10 +119,6 @@ static inline bool fsg_lun_is_open(struct fsg_lun *curlun)
        return curlun->filp != NULL;
 }
 
-/* Big enough to hold our biggest descriptor */
-#define EP0_BUFSIZE    256
-#define DELAYED_STATUS (EP0_BUFSIZE + 999)     /* An impossibly large value */
-
 /* Default size of buffer length. */
 #define FSG_BUFLEN     ((u32)16384)
 
index 6c3d7950d2a9e56d5231938493127c0964f04221..0f8aad78b54f7095a26b6e413a22ff5ae1e016df 100644 (file)
@@ -370,7 +370,7 @@ err:
        return -ENOMEM;
 }
 
-void bot_cleanup_old_alt(struct f_uas *fu)
+static void bot_cleanup_old_alt(struct f_uas *fu)
 {
        if (!(fu->flags & USBG_ENABLED))
                return;
index 0dd07ae1555ddf066312e0ff4e8182a02f27a3d6..f49b0b61ecc8163941447e8ba5b719982951531e 100644 (file)
@@ -91,17 +91,17 @@ static struct usb_zero_options gzero_options = {
  * functional coverage for the "USBCV" test harness from USB-IF.
  * It's always set if OTG mode is enabled.
  */
-unsigned autoresume = DEFAULT_AUTORESUME;
+static unsigned autoresume = DEFAULT_AUTORESUME;
 module_param(autoresume, uint, S_IRUGO);
 MODULE_PARM_DESC(autoresume, "zero, or seconds before remote wakeup");
 
 /* Maximum Autoresume time */
-unsigned max_autoresume;
+static unsigned max_autoresume;
 module_param(max_autoresume, uint, S_IRUGO);
 MODULE_PARM_DESC(max_autoresume, "maximum seconds before remote wakeup");
 
 /* Interval between two remote wakeups */
-unsigned autoresume_interval_ms;
+static unsigned autoresume_interval_ms;
 module_param(autoresume_interval_ms, uint, S_IRUGO);
 MODULE_PARM_DESC(autoresume_interval_ms,
                "milliseconds to increase successive wakeup delays");
index abd5050a4899bdb4518294175477a418583c4e83..9162d1b6c0a348f9a6d028bf7c7eef9df0261240 100644 (file)
@@ -261,19 +261,8 @@ int fsl_usb2_mpc5121_init(struct platform_device *pdev)
        struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
        struct clk *clk;
        int err;
-       char clk_name[10];
-       int base, clk_num;
-
-       base = pdev->resource->start & 0xf000;
-       if (base == 0x3000)
-               clk_num = 1;
-       else if (base == 0x4000)
-               clk_num = 2;
-       else
-               return -ENODEV;
 
-       snprintf(clk_name, sizeof(clk_name), "usb%d_clk", clk_num);
-       clk = devm_clk_get(pdev->dev.parent, clk_name);
+       clk = devm_clk_get(pdev->dev.parent, "ipg");
        if (IS_ERR(clk)) {
                dev_err(&pdev->dev, "failed to get clk\n");
                return PTR_ERR(clk);
index e89ac4d4b87e5be4d4a134e389dbdfa20931eb9c..9b7435f0dcd6b432f0c7fa9fcc096817e7141712 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <linux/clk.h>
 #include <linux/device.h>
+#include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
index 2ad004ae747c53b20f34fbeda0f54179408ce432..a2fdd85e0c919dc7aaac1baa48b0504c0baa708d 100644 (file)
@@ -95,7 +95,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);
@@ -139,7 +139,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 1e2f3f4958436fb120b81d41632ad7e7c76fb5b5..53c2e296467fcabbb8139361f6b422829f97cae4 100644 (file)
@@ -2973,8 +2973,58 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
        }
 
        while (1) {
-               if (room_on_ring(xhci, ep_ring, num_trbs))
-                       break;
+               if (room_on_ring(xhci, ep_ring, num_trbs)) {
+                       union xhci_trb *trb = ep_ring->enqueue;
+                       unsigned int usable = ep_ring->enq_seg->trbs +
+                                       TRBS_PER_SEGMENT - 1 - trb;
+                       u32 nop_cmd;
+
+                       /*
+                        * Section 4.11.7.1 TD Fragments states that a link
+                        * TRB must only occur at the boundary between
+                        * data bursts (eg 512 bytes for 480M).
+                        * While it is possible to split a large fragment
+                        * we don't know the size yet.
+                        * Simplest solution is to fill the trb before the
+                        * LINK with nop commands.
+                        */
+                       if (num_trbs == 1 || num_trbs <= usable || usable == 0)
+                               break;
+
+                       if (ep_ring->type != TYPE_BULK)
+                               /*
+                                * While isoc transfers might have a buffer that
+                                * crosses a 64k boundary it is unlikely.
+                                * Since we can't add NOPs without generating
+                                * gaps in the traffic just hope it never
+                                * happens at the end of the ring.
+                                * This could be fixed by writing a LINK TRB
+                                * instead of the first NOP - however the
+                                * TRB_TYPE_LINK_LE32() calls would all need
+                                * changing to check the ring length.
+                                */
+                               break;
+
+                       if (num_trbs >= TRBS_PER_SEGMENT) {
+                               xhci_err(xhci, "Too many fragments %d, max %d\n",
+                                               num_trbs, TRBS_PER_SEGMENT - 1);
+                               return -ENOMEM;
+                       }
+
+                       nop_cmd = cpu_to_le32(TRB_TYPE(TRB_TR_NOOP) |
+                                       ep_ring->cycle_state);
+                       ep_ring->num_trbs_free -= usable;
+                       do {
+                               trb->generic.field[0] = 0;
+                               trb->generic.field[1] = 0;
+                               trb->generic.field[2] = 0;
+                               trb->generic.field[3] = nop_cmd;
+                               trb++;
+                       } while (--usable);
+                       ep_ring->enqueue = trb;
+                       if (room_on_ring(xhci, ep_ring, num_trbs))
+                               break;
+               }
 
                if (ep_ring == xhci->cmd_ring) {
                        xhci_err(xhci, "Do not support expand command ring\n");
index 0a43329569d178de72a5c8ee619e7206c360c51c..4d4499b8044971a8db410579f7965e9b6d862c38 100644 (file)
@@ -1809,7 +1809,6 @@ static void musb_free(struct musb *musb)
                        disable_irq_wake(musb->nIrq);
                free_irq(musb->nIrq, musb);
        }
-       cancel_work_sync(&musb->irq_work);
 
        musb_host_free(musb);
 }
@@ -1896,6 +1895,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
        musb_platform_disable(musb);
        musb_generic_disable(musb);
 
+       /* Init IRQ workqueue before request_irq */
+       INIT_WORK(&musb->irq_work, musb_irq_work);
+
        /* setup musb parts of the core (especially endpoints) */
        status = musb_core_init(plat->config->multipoint
                        ? MUSB_CONTROLLER_MHDRC
@@ -1905,9 +1907,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 
        setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb);
 
-       /* Init IRQ workqueue before request_irq */
-       INIT_WORK(&musb->irq_work, musb_irq_work);
-
        /* attach to the IRQ */
        if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) {
                dev_err(dev, "request_irq %d failed!\n", nIrq);
@@ -1981,6 +1980,7 @@ fail4:
        musb_host_cleanup(musb);
 
 fail3:
+       cancel_work_sync(&musb->irq_work);
        if (musb->dma_controller)
                dma_controller_destroy(musb->dma_controller);
 fail2_5:
@@ -2043,6 +2043,7 @@ static int musb_remove(struct platform_device *pdev)
        if (musb->dma_controller)
                dma_controller_destroy(musb->dma_controller);
 
+       cancel_work_sync(&musb->irq_work);
        musb_free(musb);
        device_init_wakeup(dev, 0);
        return 0;
index ff9d6de2b7465c949d54ae4801108a3800f4be3f..a12bd30401e076fe0e502789e300c05ecc770bb1 100644 (file)
@@ -38,6 +38,7 @@ struct cppi41_dma_channel {
        u32 prog_len;
        u32 transferred;
        u32 packet_sz;
+       struct list_head tx_check;
 };
 
 #define MUSB_DMA_NUM_CHANNELS 15
@@ -47,6 +48,8 @@ struct cppi41_dma_controller {
        struct cppi41_dma_channel rx_channel[MUSB_DMA_NUM_CHANNELS];
        struct cppi41_dma_channel tx_channel[MUSB_DMA_NUM_CHANNELS];
        struct musb *musb;
+       struct hrtimer early_tx;
+       struct list_head early_tx_list;
        u32 rx_mode;
        u32 tx_mode;
        u32 auto_req;
@@ -96,31 +99,27 @@ static void update_rx_toggle(struct cppi41_dma_channel *cppi41_channel)
        cppi41_channel->usb_toggle = toggle;
 }
 
-static void cppi41_dma_callback(void *private_data)
+static bool musb_is_tx_fifo_empty(struct musb_hw_ep *hw_ep)
 {
-       struct dma_channel *channel = private_data;
-       struct cppi41_dma_channel *cppi41_channel = channel->private_data;
-       struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep;
-       struct musb *musb = hw_ep->musb;
-       unsigned long flags;
-       struct dma_tx_state txstate;
-       u32 transferred;
+       u8              epnum = hw_ep->epnum;
+       struct musb     *musb = hw_ep->musb;
+       void __iomem    *epio = musb->endpoints[epnum].regs;
+       u16             csr;
 
-       spin_lock_irqsave(&musb->lock, flags);
+       csr = musb_readw(epio, MUSB_TXCSR);
+       if (csr & MUSB_TXCSR_TXPKTRDY)
+               return false;
+       return true;
+}
 
-       dmaengine_tx_status(cppi41_channel->dc, cppi41_channel->cookie,
-                       &txstate);
-       transferred = cppi41_channel->prog_len - txstate.residue;
-       cppi41_channel->transferred += transferred;
+static void cppi41_dma_callback(void *private_data);
 
-       dev_dbg(musb->controller, "DMA transfer done on hw_ep=%d bytes=%d/%d\n",
-               hw_ep->epnum, cppi41_channel->transferred,
-               cppi41_channel->total_len);
+static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel)
+{
+       struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep;
+       struct musb *musb = hw_ep->musb;
 
-       update_rx_toggle(cppi41_channel);
-
-       if (cppi41_channel->transferred == cppi41_channel->total_len ||
-                       transferred < cppi41_channel->packet_sz) {
+       if (!cppi41_channel->prog_len) {
 
                /* done, complete */
                cppi41_channel->channel.actual_len =
@@ -150,13 +149,11 @@ static void cppi41_dma_callback(void *private_data)
                                remain_bytes,
                                direction,
                                DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-               if (WARN_ON(!dma_desc)) {
-                       spin_unlock_irqrestore(&musb->lock, flags);
+               if (WARN_ON(!dma_desc))
                        return;
-               }
 
                dma_desc->callback = cppi41_dma_callback;
-               dma_desc->callback_param = channel;
+               dma_desc->callback_param = &cppi41_channel->channel;
                cppi41_channel->cookie = dma_desc->tx_submit(dma_desc);
                dma_async_issue_pending(dc);
 
@@ -166,6 +163,117 @@ static void cppi41_dma_callback(void *private_data)
                        musb_writew(epio, MUSB_RXCSR, csr);
                }
        }
+}
+
+static enum hrtimer_restart cppi41_recheck_tx_req(struct hrtimer *timer)
+{
+       struct cppi41_dma_controller *controller;
+       struct cppi41_dma_channel *cppi41_channel, *n;
+       struct musb *musb;
+       unsigned long flags;
+       enum hrtimer_restart ret = HRTIMER_NORESTART;
+
+       controller = container_of(timer, struct cppi41_dma_controller,
+                       early_tx);
+       musb = controller->musb;
+
+       spin_lock_irqsave(&musb->lock, flags);
+       list_for_each_entry_safe(cppi41_channel, n, &controller->early_tx_list,
+                       tx_check) {
+               bool empty;
+               struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep;
+
+               empty = musb_is_tx_fifo_empty(hw_ep);
+               if (empty) {
+                       list_del_init(&cppi41_channel->tx_check);
+                       cppi41_trans_done(cppi41_channel);
+               }
+       }
+
+       if (!list_empty(&controller->early_tx_list)) {
+               ret = HRTIMER_RESTART;
+               hrtimer_forward_now(&controller->early_tx,
+                               ktime_set(0, 150 * NSEC_PER_USEC));
+       }
+
+       spin_unlock_irqrestore(&musb->lock, flags);
+       return ret;
+}
+
+static void cppi41_dma_callback(void *private_data)
+{
+       struct dma_channel *channel = private_data;
+       struct cppi41_dma_channel *cppi41_channel = channel->private_data;
+       struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep;
+       struct musb *musb = hw_ep->musb;
+       unsigned long flags;
+       struct dma_tx_state txstate;
+       u32 transferred;
+       bool empty;
+
+       spin_lock_irqsave(&musb->lock, flags);
+
+       dmaengine_tx_status(cppi41_channel->dc, cppi41_channel->cookie,
+                       &txstate);
+       transferred = cppi41_channel->prog_len - txstate.residue;
+       cppi41_channel->transferred += transferred;
+
+       dev_dbg(musb->controller, "DMA transfer done on hw_ep=%d bytes=%d/%d\n",
+               hw_ep->epnum, cppi41_channel->transferred,
+               cppi41_channel->total_len);
+
+       update_rx_toggle(cppi41_channel);
+
+       if (cppi41_channel->transferred == cppi41_channel->total_len ||
+                       transferred < cppi41_channel->packet_sz)
+               cppi41_channel->prog_len = 0;
+
+       empty = musb_is_tx_fifo_empty(hw_ep);
+       if (empty) {
+               cppi41_trans_done(cppi41_channel);
+       } else {
+               struct cppi41_dma_controller *controller;
+               /*
+                * On AM335x it has been observed that the TX interrupt fires
+                * too early that means the TXFIFO is not yet empty but the DMA
+                * engine says that it is done with the transfer. We don't
+                * receive a FIFO empty interrupt so the only thing we can do is
+                * to poll for the bit. On HS it usually takes 2us, on FS around
+                * 110us - 150us depending on the transfer size.
+                * We spin on HS (no longer than than 25us and setup a timer on
+                * FS to check for the bit and complete the transfer.
+                */
+               controller = cppi41_channel->controller;
+
+               if (musb->g.speed == USB_SPEED_HIGH) {
+                       unsigned wait = 25;
+
+                       do {
+                               empty = musb_is_tx_fifo_empty(hw_ep);
+                               if (empty)
+                                       break;
+                               wait--;
+                               if (!wait)
+                                       break;
+                               udelay(1);
+                       } while (1);
+
+                       empty = musb_is_tx_fifo_empty(hw_ep);
+                       if (empty) {
+                               cppi41_trans_done(cppi41_channel);
+                               goto out;
+                       }
+               }
+               list_add_tail(&cppi41_channel->tx_check,
+                               &controller->early_tx_list);
+               if (!hrtimer_active(&controller->early_tx)) {
+                       hrtimer_start_range_ns(&controller->early_tx,
+                               ktime_set(0, 140 * NSEC_PER_USEC),
+                               40 * NSEC_PER_USEC,
+                               HRTIMER_MODE_REL);
+               }
+       }
+out:
        spin_unlock_irqrestore(&musb->lock, flags);
 }
 
@@ -364,6 +472,8 @@ static int cppi41_is_compatible(struct dma_channel *channel, u16 maxpacket,
                WARN_ON(1);
                return 1;
        }
+       if (cppi41_channel->hw_ep->ep_in.type != USB_ENDPOINT_XFER_BULK)
+               return 0;
        if (cppi41_channel->is_tx)
                return 1;
        /* AM335x Advisory 1.0.13. No workaround for device RX mode */
@@ -388,6 +498,7 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel)
        if (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE)
                return 0;
 
+       list_del_init(&cppi41_channel->tx_check);
        if (is_tx) {
                csr = musb_readw(epio, MUSB_TXCSR);
                csr &= ~MUSB_TXCSR_DMAENAB;
@@ -495,6 +606,7 @@ static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller)
                cppi41_channel->controller = controller;
                cppi41_channel->port_num = port;
                cppi41_channel->is_tx = is_tx;
+               INIT_LIST_HEAD(&cppi41_channel->tx_check);
 
                musb_dma = &cppi41_channel->channel;
                musb_dma->private_data = cppi41_channel;
@@ -520,6 +632,7 @@ void dma_controller_destroy(struct dma_controller *c)
        struct cppi41_dma_controller *controller = container_of(c,
                        struct cppi41_dma_controller, controller);
 
+       hrtimer_cancel(&controller->early_tx);
        cppi41_dma_controller_stop(controller);
        kfree(controller);
 }
@@ -539,6 +652,9 @@ struct dma_controller *dma_controller_create(struct musb *musb,
        if (!controller)
                goto kzalloc_fail;
 
+       hrtimer_init(&controller->early_tx, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+       controller->early_tx.function = cppi41_recheck_tx_req;
+       INIT_LIST_HEAD(&controller->early_tx_list);
        controller->musb = musb;
 
        controller->controller.channel_alloc = cppi41_dma_channel_allocate;
index d2d3a173b31503b54f9071e9af48f4878567856f..32fb057c03f58e25f401bdb49755e2cdc2637e86 100644 (file)
@@ -1796,7 +1796,11 @@ int musb_gadget_setup(struct musb *musb)
 
        /* this "gadget" abstracts/virtualizes the controller */
        musb->g.name = musb_driver_name;
+#if IS_ENABLED(CONFIG_USB_MUSB_DUAL_ROLE)
        musb->g.is_otg = 1;
+#elif IS_ENABLED(CONFIG_USB_MUSB_GADGET)
+       musb->g.is_otg = 0;
+#endif
 
        musb_g_init_endpoints(musb);
 
index 6370e50649d7f732c640fd65879c26d82ec5f994..0e3c60cb669a63c7a1d1bb7bd673f212f854c425 100644 (file)
@@ -52,8 +52,7 @@ static int am335x_phy_probe(struct platform_device *pdev)
                return am_phy->id;
        }
 
-       ret = usb_phy_gen_create_phy(dev, &am_phy->usb_phy_gen,
-                       USB_PHY_TYPE_USB2, 0, false);
+       ret = usb_phy_gen_create_phy(dev, &am_phy->usb_phy_gen, NULL);
        if (ret)
                return ret;
 
@@ -66,8 +65,6 @@ static int am335x_phy_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, am_phy);
 
        return 0;
-
-       return ret;
 }
 
 static int am335x_phy_remove(struct platform_device *pdev)
index fce3a9e9bb5d282ff6b1a64492ad6a55c90e654f..aa6d37b3378ad65ff26e336031173a9ae52d2287 100644 (file)
@@ -48,8 +48,9 @@ void usb_nop_xceiv_register(void)
        if (pd)
                return;
        pd = platform_device_register_simple("usb_phy_gen_xceiv", -1, NULL, 0);
-       if (!pd) {
+       if (IS_ERR(pd)) {
                pr_err("Unable to register generic usb transceiver\n");
+               pd = NULL;
                return;
        }
 }
@@ -150,10 +151,40 @@ static int nop_set_host(struct usb_otg *otg, struct usb_bus *host)
 }
 
 int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_gen_xceiv *nop,
-               enum usb_phy_type type, u32 clk_rate, bool needs_vcc)
+               struct usb_phy_gen_xceiv_platform_data *pdata)
 {
+       enum usb_phy_type type = USB_PHY_TYPE_USB2;
        int err;
 
+       u32 clk_rate = 0;
+       bool needs_vcc = false;
+
+       nop->reset_active_low = true;   /* default behaviour */
+
+       if (dev->of_node) {
+               struct device_node *node = dev->of_node;
+               enum of_gpio_flags flags = 0;
+
+               if (of_property_read_u32(node, "clock-frequency", &clk_rate))
+                       clk_rate = 0;
+
+               needs_vcc = of_property_read_bool(node, "vcc-supply");
+               nop->gpio_reset = of_get_named_gpio_flags(node, "reset-gpios",
+                                                               0, &flags);
+               if (nop->gpio_reset == -EPROBE_DEFER)
+                       return -EPROBE_DEFER;
+
+               nop->reset_active_low = flags & OF_GPIO_ACTIVE_LOW;
+
+       } else if (pdata) {
+               type = pdata->type;
+               clk_rate = pdata->clk_rate;
+               needs_vcc = pdata->needs_vcc;
+               nop->gpio_reset = pdata->gpio_reset;
+       } else {
+               nop->gpio_reset = -1;
+       }
+
        nop->phy.otg = devm_kzalloc(dev, sizeof(*nop->phy.otg),
                        GFP_KERNEL);
        if (!nop->phy.otg)
@@ -218,43 +249,14 @@ EXPORT_SYMBOL_GPL(usb_phy_gen_create_phy);
 static int usb_phy_gen_xceiv_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
-       struct usb_phy_gen_xceiv_platform_data *pdata =
-                       dev_get_platdata(&pdev->dev);
        struct usb_phy_gen_xceiv        *nop;
-       enum usb_phy_type       type = USB_PHY_TYPE_USB2;
        int err;
-       u32 clk_rate = 0;
-       bool needs_vcc = false;
 
        nop = devm_kzalloc(dev, sizeof(*nop), GFP_KERNEL);
        if (!nop)
                return -ENOMEM;
 
-       nop->reset_active_low = true;   /* default behaviour */
-
-       if (dev->of_node) {
-               struct device_node *node = dev->of_node;
-               enum of_gpio_flags flags;
-
-               if (of_property_read_u32(node, "clock-frequency", &clk_rate))
-                       clk_rate = 0;
-
-               needs_vcc = of_property_read_bool(node, "vcc-supply");
-               nop->gpio_reset = of_get_named_gpio_flags(node, "reset-gpios",
-                                                               0, &flags);
-               if (nop->gpio_reset == -EPROBE_DEFER)
-                       return -EPROBE_DEFER;
-
-               nop->reset_active_low = flags & OF_GPIO_ACTIVE_LOW;
-
-       } else if (pdata) {
-               type = pdata->type;
-               clk_rate = pdata->clk_rate;
-               needs_vcc = pdata->needs_vcc;
-               nop->gpio_reset = pdata->gpio_reset;
-       }
-
-       err = usb_phy_gen_create_phy(dev, nop, type, clk_rate, needs_vcc);
+       err = usb_phy_gen_create_phy(dev, nop, dev_get_platdata(&pdev->dev));
        if (err)
                return err;
 
@@ -271,8 +273,6 @@ static int usb_phy_gen_xceiv_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, nop);
 
        return 0;
-
-       return err;
 }
 
 static int usb_phy_gen_xceiv_remove(struct platform_device *pdev)
index d2a220d81734ad5be296f56c3b416aa321bfb63e..38a81f307b8220bc5dfc81487a9fb420e397ccd1 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _PHY_GENERIC_H_
 #define _PHY_GENERIC_H_
 
+#include <linux/usb/usb_phy_gen_xceiv.h>
+
 struct usb_phy_gen_xceiv {
        struct usb_phy phy;
        struct device *dev;
@@ -14,6 +16,6 @@ int usb_gen_phy_init(struct usb_phy *phy);
 void usb_gen_phy_shutdown(struct usb_phy *phy);
 
 int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_gen_xceiv *nop,
-               enum usb_phy_type type, u32 clk_rate, bool needs_vcc);
+               struct usb_phy_gen_xceiv_platform_data *pdata);
 
 #endif
index fdd33b44dbd31b929eb13a2c0bd138570ccebc37..545844b7e7962f809f33812d9167f039b5fbc8d1 100644 (file)
@@ -164,7 +164,7 @@ static int mxs_phy_probe(struct platform_device *pdev)
 
        mxs_phy->clk = clk;
 
-       platform_set_drvdata(pdev, &mxs_phy->phy);
+       platform_set_drvdata(pdev, mxs_phy);
 
        ret = usb_add_phy_dev(&mxs_phy->phy);
        if (ret)
index a99a6953f11cc1988272b9ae2d4e917073eb458f..db3ab34cddb4cbc6be6df4e66596b11186235477 100644 (file)
@@ -107,10 +107,10 @@ static void __rcar_gen2_usb_phy_init(struct rcar_gen2_usb_phy_priv *priv)
        clk_prepare_enable(priv->clk);
 
        /* Set USB channels in the USBHS UGCTRL2 register */
-       val = ioread32(priv->base);
+       val = ioread32(priv->base + USBHS_UGCTRL2_REG);
        val &= ~(USBHS_UGCTRL2_USB0_HS | USBHS_UGCTRL2_USB2_SS);
        val |= priv->ugctrl2;
-       iowrite32(val, priv->base);
+       iowrite32(val, priv->base + USBHS_UGCTRL2_REG);
 }
 
 /* Shutdown USB channels */
index 82232acf1ab61b17cfbe9d084c3ed2188d554b18..bbe4f8e6e8d7492be10cc54cfe2f37e8001f2db6 100644 (file)
@@ -876,7 +876,7 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
 
        tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start,
                resource_size(res));
-       if (!tegra_phy->regs) {
+       if (!tegra_phy->pad_regs) {
                dev_err(&pdev->dev, "Failed to remap UTMI Pad regs\n");
                return -ENOMEM;
        }
index 30e8a61552d4d0526d999c0b49651593f04a5530..bad57ce77ba508e0f6ff8c07fa516e9477606a3c 100644 (file)
@@ -127,7 +127,8 @@ static inline int twl6030_writeb(struct twl6030_usb *twl, u8 module,
 
 static inline u8 twl6030_readb(struct twl6030_usb *twl, u8 module, u8 address)
 {
-       u8 data, ret = 0;
+       u8 data;
+       int ret;
 
        ret = twl_i2c_read_u8(module, &data, address);
        if (ret >= 0)
index 9ced8937a8f3a699dad340e1e9ea62c9d706dc69..fb0d537435eb221019babe694aafefd25b9e90cc 100644 (file)
@@ -2123,6 +2123,20 @@ static void ftdi_set_termios(struct tty_struct *tty,
                termios->c_cflag |= CRTSCTS;
        }
 
+       /*
+        * All FTDI UART chips are limited to CS7/8. We won't pretend to
+        * support CS5/6 and revert the CSIZE setting instead.
+        */
+       if ((C_CSIZE(tty) != CS8) && (C_CSIZE(tty) != CS7)) {
+               dev_warn(ddev, "requested CSIZE setting not supported\n");
+
+               termios->c_cflag &= ~CSIZE;
+               if (old_termios)
+                       termios->c_cflag |= old_termios->c_cflag & CSIZE;
+               else
+                       termios->c_cflag |= CS8;
+       }
+
        cflag = termios->c_cflag;
 
        if (!old_termios)
@@ -2159,19 +2173,16 @@ no_skip:
        } else {
                urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE;
        }
-       if (cflag & CSIZE) {
-               switch (cflag & CSIZE) {
-               case CS7:
-                       urb_value |= 7;
-                       dev_dbg(ddev, "Setting CS7\n");
-                       break;
-               case CS8:
-                       urb_value |= 8;
-                       dev_dbg(ddev, "Setting CS8\n");
-                       break;
-               default:
-                       dev_err(ddev, "CSIZE was set but not CS7-CS8\n");
-               }
+       switch (cflag & CSIZE) {
+       case CS7:
+               urb_value |= 7;
+               dev_dbg(ddev, "Setting CS7\n");
+               break;
+       default:
+       case CS8:
+               urb_value |= 8;
+               dev_dbg(ddev, "Setting CS8\n");
+               break;
        }
 
        /* This is needed by the break command since it uses the same command
index 2b01ec8651c296e3f016bf2421040da6f1bbbc98..b63ce023f96f1ab7284e218ca68219da5f952440 100644 (file)
@@ -173,16 +173,8 @@ retry:
                clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags);
                return result;
        }
-       /*
-        * Try sending off another urb, unless called from completion handler
-        * (in which case there will be no free urb or no data).
-        */
-       if (mem_flags != GFP_ATOMIC)
-               goto retry;
 
-       clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags);
-
-       return 0;
+       goto retry;     /* try sending off another urb */
 }
 EXPORT_SYMBOL_GPL(usb_serial_generic_write_start);
 
@@ -208,7 +200,7 @@ int usb_serial_generic_write(struct tty_struct *tty,
                return 0;
 
        count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock);
-       result = usb_serial_generic_write_start(port, GFP_KERNEL);
+       result = usb_serial_generic_write_start(port, GFP_ATOMIC);
        if (result)
                return result;
 
index e5bdd987b9e8f7e260fc95c48b142742026999fa..a69da83604c03da3219c2340264cff08b456a404 100644 (file)
@@ -1813,25 +1813,25 @@ static void mos7840_change_port_settings(struct tty_struct *tty,
        iflag = tty->termios.c_iflag;
 
        /* Change the number of bits */
-       if (cflag & CSIZE) {
-               switch (cflag & CSIZE) {
-               case CS5:
-                       lData = LCR_BITS_5;
-                       break;
+       switch (cflag & CSIZE) {
+       case CS5:
+               lData = LCR_BITS_5;
+               break;
 
-               case CS6:
-                       lData = LCR_BITS_6;
-                       break;
+       case CS6:
+               lData = LCR_BITS_6;
+               break;
 
-               case CS7:
-                       lData = LCR_BITS_7;
-                       break;
-               default:
-               case CS8:
-                       lData = LCR_BITS_8;
-                       break;
-               }
+       case CS7:
+               lData = LCR_BITS_7;
+               break;
+
+       default:
+       case CS8:
+               lData = LCR_BITS_8;
+               break;
        }
+
        /* Change the Parity bit */
        if (cflag & PARENB) {
                if (cflag & PARODD) {
index c3d94853b4ab7a2dd13d8f6dea0009f55795ba56..cc7a24154490b29ebb39d4b9d3e72785c4320285 100644 (file)
@@ -85,6 +85,7 @@ static void option_instat_callback(struct urb *urb);
 #define HUAWEI_PRODUCT_K4505                   0x1464
 #define HUAWEI_PRODUCT_K3765                   0x1465
 #define HUAWEI_PRODUCT_K4605                   0x14C6
+#define HUAWEI_PRODUCT_E173S6                  0x1C07
 
 #define QUANTA_VENDOR_ID                       0x0408
 #define QUANTA_PRODUCT_Q101                    0xEA02
@@ -250,6 +251,7 @@ static void option_instat_callback(struct urb *urb);
 #define ZTE_PRODUCT_MF628                      0x0015
 #define ZTE_PRODUCT_MF626                      0x0031
 #define ZTE_PRODUCT_MC2718                     0xffe8
+#define ZTE_PRODUCT_AC2726                     0xfff1
 
 #define BENQ_VENDOR_ID                         0x04a5
 #define BENQ_PRODUCT_H10                       0x4068
@@ -572,6 +574,8 @@ static const struct usb_device_id option_ids[] = {
        { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) },
        { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff),
                .driver_info = (kernel_ulong_t) &net_intf1_blacklist },
+       { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S6, 0xff, 0xff, 0xff),
+               .driver_info = (kernel_ulong_t) &net_intf1_blacklist },
        { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1750, 0xff, 0xff, 0xff),
                .driver_info = (kernel_ulong_t) &net_intf2_blacklist },
        { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1441, USB_CLASS_COMM, 0x02, 0xff) },
@@ -634,6 +638,10 @@ static const struct usb_device_id option_ids[] = {
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6D) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6E) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6F) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x72) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x73) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x74) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x75) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x78) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x79) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7A) },
@@ -688,6 +696,10 @@ static const struct usb_device_id option_ids[] = {
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6D) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6E) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6F) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x72) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x73) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x74) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x75) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x78) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x79) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7A) },
@@ -742,6 +754,10 @@ static const struct usb_device_id option_ids[] = {
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6D) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6E) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6F) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x72) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x73) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x74) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x75) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x78) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x79) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x7A) },
@@ -796,6 +812,10 @@ static const struct usb_device_id option_ids[] = {
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6D) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6E) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6F) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x72) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x73) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x74) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x75) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x78) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x79) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x7A) },
@@ -850,6 +870,10 @@ static const struct usb_device_id option_ids[] = {
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6D) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6E) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6F) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x72) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x73) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x74) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x75) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x78) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x79) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x7A) },
@@ -904,6 +928,10 @@ static const struct usb_device_id option_ids[] = {
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6D) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6E) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6F) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x72) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x73) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x74) },
+       { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x75) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x78) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x79) },
        { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7A) },
@@ -1426,6 +1454,7 @@ static const struct usb_device_id option_ids[] = {
        { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) },
        { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) },
        { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) },
+       { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
 
        { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
        { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
index 1e6de4cd079d6a2c0e3b4b3c7679d6145bcf6f2c..1e3318dfa1cb569fcbd78ed2079ef026f33a8d16 100644 (file)
@@ -361,23 +361,21 @@ static void pl2303_set_termios(struct tty_struct *tty,
                            0, 0, buf, 7, 100);
        dev_dbg(&port->dev, "0xa1:0x21:0:0  %d - %7ph\n", i, buf);
 
-       if (C_CSIZE(tty)) {
-               switch (C_CSIZE(tty)) {
-               case CS5:
-                       buf[6] = 5;
-                       break;
-               case CS6:
-                       buf[6] = 6;
-                       break;
-               case CS7:
-                       buf[6] = 7;
-                       break;
-               default:
-               case CS8:
-                       buf[6] = 8;
-               }
-               dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
+       switch (C_CSIZE(tty)) {
+       case CS5:
+               buf[6] = 5;
+               break;
+       case CS6:
+               buf[6] = 6;
+               break;
+       case CS7:
+               buf[6] = 7;
+               break;
+       default:
+       case CS8:
+               buf[6] = 8;
        }
+       dev_dbg(&port->dev, "data bits = %d\n", buf[6]);
 
        /* For reference buf[0]:buf[3] baud rate value */
        pl2303_encode_baudrate(tty, port, &buf[0]);
index 4abac28b5992a1f128005f5f7df103118a39b081..5b793c352267751ecd43cce1c7fae9e5a7fac624 100644 (file)
@@ -348,22 +348,20 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
        }
 
        /* Set Data Length : 00:5bit, 01:6bit, 10:7bit, 11:8bit */
-       if (cflag & CSIZE) {
-               switch (cflag & CSIZE) {
-               case CS5:
-                       buf[1] |= SET_UART_FORMAT_SIZE_5;
-                       break;
-               case CS6:
-                       buf[1] |= SET_UART_FORMAT_SIZE_6;
-                       break;
-               case CS7:
-                       buf[1] |= SET_UART_FORMAT_SIZE_7;
-                       break;
-               default:
-               case CS8:
-                       buf[1] |= SET_UART_FORMAT_SIZE_8;
-                       break;
-               }
+       switch (cflag & CSIZE) {
+       case CS5:
+               buf[1] |= SET_UART_FORMAT_SIZE_5;
+               break;
+       case CS6:
+               buf[1] |= SET_UART_FORMAT_SIZE_6;
+               break;
+       case CS7:
+               buf[1] |= SET_UART_FORMAT_SIZE_7;
+               break;
+       default:
+       case CS8:
+               buf[1] |= SET_UART_FORMAT_SIZE_8;
+               break;
        }
 
        /* Set Stop bit2 : 0:1bit 1:2bit */
index fca4c752a4ed233199d82a787c0ebfbfff32e71c..eae2c873b39ff7dbb2ecd8d7624a1e2aec14e8ca 100644 (file)
@@ -281,8 +281,7 @@ static const struct usb_device_id id_table[] = {
        { USB_DEVICE(0x19d2, 0xfffd) },
        { USB_DEVICE(0x19d2, 0xfffc) },
        { USB_DEVICE(0x19d2, 0xfffb) },
-       /* AC2726, AC8710_V3 */
-       { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfff1, 0xff, 0xff, 0xff) },
+       /* AC8710_V3 */
        { USB_DEVICE(0x19d2, 0xfff6) },
        { USB_DEVICE(0x19d2, 0xfff7) },
        { USB_DEVICE(0x19d2, 0xfff8) },
index e538b72c4e3af2d09153614952e12101eac03520..f14e7929ba2278dae601788ab4f07ae657e2e2bb 100644 (file)
@@ -97,18 +97,12 @@ static void wusbhc_devconnect_acked_work(struct work_struct *work);
 
 static void wusb_dev_free(struct wusb_dev *wusb_dev)
 {
-       if (wusb_dev) {
-               kfree(wusb_dev->set_gtk_req);
-               usb_free_urb(wusb_dev->set_gtk_urb);
-               kfree(wusb_dev);
-       }
+       kfree(wusb_dev);
 }
 
 static struct wusb_dev *wusb_dev_alloc(struct wusbhc *wusbhc)
 {
        struct wusb_dev *wusb_dev;
-       struct urb *urb;
-       struct usb_ctrlrequest *req;
 
        wusb_dev = kzalloc(sizeof(*wusb_dev), GFP_KERNEL);
        if (wusb_dev == NULL)
@@ -118,22 +112,6 @@ static struct wusb_dev *wusb_dev_alloc(struct wusbhc *wusbhc)
 
        INIT_WORK(&wusb_dev->devconnect_acked_work, wusbhc_devconnect_acked_work);
 
-       urb = usb_alloc_urb(0, GFP_KERNEL);
-       if (urb == NULL)
-               goto err;
-       wusb_dev->set_gtk_urb = urb;
-
-       req = kmalloc(sizeof(*req), GFP_KERNEL);
-       if (req == NULL)
-               goto err;
-       wusb_dev->set_gtk_req = req;
-
-       req->bRequestType = USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE;
-       req->bRequest = USB_REQ_SET_DESCRIPTOR;
-       req->wValue = cpu_to_le16(USB_DT_KEY << 8 | wusbhc->gtk_index);
-       req->wIndex = 0;
-       req->wLength = cpu_to_le16(wusbhc->gtk.descr.bLength);
-
        return wusb_dev;
 err:
        wusb_dev_free(wusb_dev);
@@ -411,9 +389,6 @@ static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc,
 /*
  * Refresh the list of keep alives to emit in the MMC
  *
- * Some devices don't respond to keep alives unless they've been
- * authenticated, so skip unauthenticated devices.
- *
  * We only publish the first four devices that have a coming timeout
  * condition. Then when we are done processing those, we go for the
  * next ones. We ignore the ones that have timed out already (they'll
@@ -448,7 +423,7 @@ static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
 
                if (wusb_dev == NULL)
                        continue;
-               if (wusb_dev->usb_dev == NULL || !wusb_dev->usb_dev->authenticated)
+               if (wusb_dev->usb_dev == NULL)
                        continue;
 
                if (time_after(jiffies, wusb_dev->entry_ts + tt)) {
@@ -524,11 +499,19 @@ static struct wusb_dev *wusbhc_find_dev_by_addr(struct wusbhc *wusbhc, u8 addr)
  *
  * @wusbhc shall be referenced and unlocked
  */
-static void wusbhc_handle_dn_alive(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
+static void wusbhc_handle_dn_alive(struct wusbhc *wusbhc, u8 srcaddr)
 {
+       struct wusb_dev *wusb_dev;
+
        mutex_lock(&wusbhc->mutex);
-       wusb_dev->entry_ts = jiffies;
-       __wusbhc_keep_alive(wusbhc);
+       wusb_dev = wusbhc_find_dev_by_addr(wusbhc, srcaddr);
+       if (wusb_dev == NULL) {
+               dev_dbg(wusbhc->dev, "ignoring DN_Alive from unconnected device %02x\n",
+                       srcaddr);
+       } else {
+               wusb_dev->entry_ts = jiffies;
+               __wusbhc_keep_alive(wusbhc);
+       }
        mutex_unlock(&wusbhc->mutex);
 }
 
@@ -582,14 +565,22 @@ static void wusbhc_handle_dn_connect(struct wusbhc *wusbhc,
  *
  * @wusbhc shall be referenced and unlocked
  */
-static void wusbhc_handle_dn_disconnect(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
+static void wusbhc_handle_dn_disconnect(struct wusbhc *wusbhc, u8 srcaddr)
 {
        struct device *dev = wusbhc->dev;
-
-       dev_info(dev, "DN DISCONNECT: device 0x%02x going down\n", wusb_dev->addr);
+       struct wusb_dev *wusb_dev;
 
        mutex_lock(&wusbhc->mutex);
-       __wusbhc_dev_disconnect(wusbhc, wusb_port_by_idx(wusbhc, wusb_dev->port_idx));
+       wusb_dev = wusbhc_find_dev_by_addr(wusbhc, srcaddr);
+       if (wusb_dev == NULL) {
+               dev_dbg(dev, "ignoring DN DISCONNECT from unconnected device %02x\n",
+                       srcaddr);
+       } else {
+               dev_info(dev, "DN DISCONNECT: device 0x%02x going down\n",
+                       wusb_dev->addr);
+               __wusbhc_dev_disconnect(wusbhc, wusb_port_by_idx(wusbhc,
+                       wusb_dev->port_idx));
+       }
        mutex_unlock(&wusbhc->mutex);
 }
 
@@ -611,30 +602,21 @@ void wusbhc_handle_dn(struct wusbhc *wusbhc, u8 srcaddr,
                      struct wusb_dn_hdr *dn_hdr, size_t size)
 {
        struct device *dev = wusbhc->dev;
-       struct wusb_dev *wusb_dev;
 
        if (size < sizeof(struct wusb_dn_hdr)) {
                dev_err(dev, "DN data shorter than DN header (%d < %d)\n",
                        (int)size, (int)sizeof(struct wusb_dn_hdr));
                return;
        }
-
-       wusb_dev = wusbhc_find_dev_by_addr(wusbhc, srcaddr);
-       if (wusb_dev == NULL && dn_hdr->bType != WUSB_DN_CONNECT) {
-               dev_dbg(dev, "ignoring DN %d from unconnected device %02x\n",
-                       dn_hdr->bType, srcaddr);
-               return;
-       }
-
        switch (dn_hdr->bType) {
        case WUSB_DN_CONNECT:
                wusbhc_handle_dn_connect(wusbhc, dn_hdr, size);
                break;
        case WUSB_DN_ALIVE:
-               wusbhc_handle_dn_alive(wusbhc, wusb_dev);
+               wusbhc_handle_dn_alive(wusbhc, srcaddr);
                break;
        case WUSB_DN_DISCONNECT:
-               wusbhc_handle_dn_disconnect(wusbhc, wusb_dev);
+               wusbhc_handle_dn_disconnect(wusbhc, srcaddr);
                break;
        case WUSB_DN_MASAVAILCHANGED:
        case WUSB_DN_RWAKE:
index dd88441c8f7891e0d242e1107d6ff585a30999e4..4c40d0dbf53d45c35ae5b05798f1f09566ffc29e 100644 (file)
 #include <linux/export.h>
 #include "wusbhc.h"
 
-static void wusbhc_set_gtk_callback(struct urb *urb);
-static void wusbhc_gtk_rekey_done_work(struct work_struct *work);
+static void wusbhc_gtk_rekey_work(struct work_struct *work);
 
 int wusbhc_sec_create(struct wusbhc *wusbhc)
 {
        wusbhc->gtk.descr.bLength = sizeof(wusbhc->gtk.descr) + sizeof(wusbhc->gtk.data);
        wusbhc->gtk.descr.bDescriptorType = USB_DT_KEY;
        wusbhc->gtk.descr.bReserved = 0;
+       wusbhc->gtk_index = 0;
 
-       wusbhc->gtk_index = wusb_key_index(0, WUSB_KEY_INDEX_TYPE_GTK,
-                                          WUSB_KEY_INDEX_ORIGINATOR_HOST);
-
-       INIT_WORK(&wusbhc->gtk_rekey_done_work, wusbhc_gtk_rekey_done_work);
+       INIT_WORK(&wusbhc->gtk_rekey_work, wusbhc_gtk_rekey_work);
 
        return 0;
 }
@@ -113,7 +110,7 @@ int wusbhc_sec_start(struct wusbhc *wusbhc)
        wusbhc_generate_gtk(wusbhc);
 
        result = wusbhc->set_gtk(wusbhc, wusbhc->gtk_tkid,
-                                &wusbhc->gtk.descr.bKeyData, key_size);
+                               &wusbhc->gtk.descr.bKeyData, key_size);
        if (result < 0)
                dev_err(wusbhc->dev, "cannot set GTK for the host: %d\n",
                        result);
@@ -129,7 +126,7 @@ int wusbhc_sec_start(struct wusbhc *wusbhc)
  */
 void wusbhc_sec_stop(struct wusbhc *wusbhc)
 {
-       cancel_work_sync(&wusbhc->gtk_rekey_done_work);
+       cancel_work_sync(&wusbhc->gtk_rekey_work);
 }
 
 
@@ -185,12 +182,14 @@ static int wusb_dev_set_encryption(struct usb_device *usb_dev, int value)
 static int wusb_dev_set_gtk(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
 {
        struct usb_device *usb_dev = wusb_dev->usb_dev;
+       u8 key_index = wusb_key_index(wusbhc->gtk_index,
+               WUSB_KEY_INDEX_TYPE_GTK, WUSB_KEY_INDEX_ORIGINATOR_HOST);
 
        return usb_control_msg(
                usb_dev, usb_sndctrlpipe(usb_dev, 0),
                USB_REQ_SET_DESCRIPTOR,
                USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE,
-               USB_DT_KEY << 8 | wusbhc->gtk_index, 0,
+               USB_DT_KEY << 8 | key_index, 0,
                &wusbhc->gtk.descr, wusbhc->gtk.descr.bLength,
                1000);
 }
@@ -520,24 +519,55 @@ error_kzalloc:
  * Once all connected and authenticated devices have received the new
  * GTK, switch the host to using it.
  */
-static void wusbhc_gtk_rekey_done_work(struct work_struct *work)
+static void wusbhc_gtk_rekey_work(struct work_struct *work)
 {
-       struct wusbhc *wusbhc = container_of(work, struct wusbhc, gtk_rekey_done_work);
+       struct wusbhc *wusbhc = container_of(work,
+                                       struct wusbhc, gtk_rekey_work);
        size_t key_size = sizeof(wusbhc->gtk.data);
+       int port_idx;
+       struct wusb_dev *wusb_dev, *wusb_dev_next;
+       LIST_HEAD(rekey_list);
 
        mutex_lock(&wusbhc->mutex);
+       /* generate the new key */
+       wusbhc_generate_gtk(wusbhc);
+       /* roll the gtk index. */
+       wusbhc->gtk_index = (wusbhc->gtk_index + 1) % (WUSB_KEY_INDEX_MAX + 1);
+       /*
+        * Save all connected devices on a list while holding wusbhc->mutex and
+        * take a reference to each one.  Then submit the set key request to
+        * them after releasing the lock in order to avoid a deadlock.
+        */
+       for (port_idx = 0; port_idx < wusbhc->ports_max; port_idx++) {
+               wusb_dev = wusbhc->port[port_idx].wusb_dev;
+               if (!wusb_dev || !wusb_dev->usb_dev
+                       || !wusb_dev->usb_dev->authenticated)
+                       continue;
 
-       if (--wusbhc->pending_set_gtks == 0)
-               wusbhc->set_gtk(wusbhc, wusbhc->gtk_tkid, &wusbhc->gtk.descr.bKeyData, key_size);
-
+               wusb_dev_get(wusb_dev);
+               list_add_tail(&wusb_dev->rekey_node, &rekey_list);
+       }
        mutex_unlock(&wusbhc->mutex);
-}
 
-static void wusbhc_set_gtk_callback(struct urb *urb)
-{
-       struct wusbhc *wusbhc = urb->context;
+       /* Submit the rekey requests without holding wusbhc->mutex. */
+       list_for_each_entry_safe(wusb_dev, wusb_dev_next, &rekey_list,
+               rekey_node) {
+               list_del_init(&wusb_dev->rekey_node);
+               dev_dbg(&wusb_dev->usb_dev->dev, "%s: rekey device at port %d\n",
+                       __func__, wusb_dev->port_idx);
+
+               if (wusb_dev_set_gtk(wusbhc, wusb_dev) < 0) {
+                       dev_err(&wusb_dev->usb_dev->dev, "%s: rekey device at port %d failed\n",
+                               __func__, wusb_dev->port_idx);
+               }
+               wusb_dev_put(wusb_dev);
+       }
 
-       queue_work(wusbd, &wusbhc->gtk_rekey_done_work);
+       /* Switch the host controller to use the new GTK. */
+       mutex_lock(&wusbhc->mutex);
+       wusbhc->set_gtk(wusbhc, wusbhc->gtk_tkid,
+               &wusbhc->gtk.descr.bKeyData, key_size);
+       mutex_unlock(&wusbhc->mutex);
 }
 
 /**
@@ -553,26 +583,12 @@ static void wusbhc_set_gtk_callback(struct urb *urb)
  */
 void wusbhc_gtk_rekey(struct wusbhc *wusbhc)
 {
-       static const size_t key_size = sizeof(wusbhc->gtk.data);
-       int p;
-
-       wusbhc_generate_gtk(wusbhc);
-
-       for (p = 0; p < wusbhc->ports_max; p++) {
-               struct wusb_dev *wusb_dev;
-
-               wusb_dev = wusbhc->port[p].wusb_dev;
-               if (!wusb_dev || !wusb_dev->usb_dev || !wusb_dev->usb_dev->authenticated)
-                       continue;
-
-               usb_fill_control_urb(wusb_dev->set_gtk_urb, wusb_dev->usb_dev,
-                                    usb_sndctrlpipe(wusb_dev->usb_dev, 0),
-                                    (void *)wusb_dev->set_gtk_req,
-                                    &wusbhc->gtk.descr, wusbhc->gtk.descr.bLength,
-                                    wusbhc_set_gtk_callback, wusbhc);
-               if (usb_submit_urb(wusb_dev->set_gtk_urb, GFP_KERNEL) == 0)
-                       wusbhc->pending_set_gtks++;
-       }
-       if (wusbhc->pending_set_gtks == 0)
-               wusbhc->set_gtk(wusbhc, wusbhc->gtk_tkid, &wusbhc->gtk.descr.bKeyData, key_size);
+       /*
+        * We need to submit a URB to the downstream WUSB devices in order to
+        * change the group key.  This can't be done while holding the
+        * wusbhc->mutex since that is also taken in the urb_enqueue routine
+        * and will cause a deadlock.  Instead, queue a work item to do
+        * it when the lock is not held
+        */
+       queue_work(wusbd, &wusbhc->gtk_rekey_work);
 }
index 711b1952b114ab09322a2b11289cf7aa5fe0d433..6bd3b819a6b56b2c37f552ba5177f71df80cd626 100644 (file)
@@ -97,6 +97,7 @@ struct wusb_dev {
        struct kref refcnt;
        struct wusbhc *wusbhc;
        struct list_head cack_node;     /* Connect-Ack list */
+       struct list_head rekey_node;    /* GTK rekey list */
        u8 port_idx;
        u8 addr;
        u8 beacon_type:4;
@@ -107,8 +108,6 @@ struct wusb_dev {
        struct usb_wireless_cap_descriptor *wusb_cap_descr;
        struct uwb_mas_bm availability;
        struct work_struct devconnect_acked_work;
-       struct urb *set_gtk_urb;
-       struct usb_ctrlrequest *set_gtk_req;
        struct usb_device *usb_dev;
 };
 
@@ -296,8 +295,7 @@ struct wusbhc {
        } __attribute__((packed)) gtk;
        u8 gtk_index;
        u32 gtk_tkid;
-       struct work_struct gtk_rekey_done_work;
-       int pending_set_gtks;
+       struct work_struct gtk_rekey_work;
 
        struct usb_encryption_descriptor *ccm1_etd;
 };
index 0dac36ce09d6d74b7b33af1c15a70faffa72e792..518f790ef88a6d319e4d7fd806557c61741363dd 100644 (file)
@@ -3710,7 +3710,7 @@ default_chipset:
        if (!videomemory) {
                dev_warn(&pdev->dev,
                         "Unable to map videomem cached writethrough\n");
-               info->screen_base = (char *)ZTWO_VADDR(info->fix.smem_start);
+               info->screen_base = ZTWO_VADDR(info->fix.smem_start);
        } else
                info->screen_base = (char *)videomemory;
 
index 5aab9b9dc2109be565005d77cbfed962046434b3..d992aa5eb3f0dc6557b23b4ec3e4868301c5ede8 100644 (file)
@@ -2256,7 +2256,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z,
 
        info->fix.mmio_start = regbase;
        cinfo->regbase = regbase > 16 * MB_ ? ioremap(regbase, 64 * 1024)
-                                           : (caddr_t)ZTWO_VADDR(regbase);
+                                           : ZTWO_VADDR(regbase);
        if (!cinfo->regbase) {
                dev_err(info->device, "Cannot map registers\n");
                error = -EIO;
@@ -2266,7 +2266,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z,
        info->fix.smem_start = rambase;
        info->screen_size = ramsize;
        info->screen_base = rambase > 16 * MB_ ? ioremap(rambase, ramsize)
-                                              : (caddr_t)ZTWO_VADDR(rambase);
+                                              : ZTWO_VADDR(rambase);
        if (!info->screen_base) {
                dev_err(info->device, "Cannot map video RAM\n");
                error = -EIO;
index 5bd2eb8d4f394b2122bf42bb1a1c42a71f440efe..cda7587cbc86ec0e2a6fa8a2ca90038ff71e155b 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/fb.h>
 
 #include <asm/setup.h>
-#include <asm/bootinfo.h>
 #include <asm/macintosh.h>
 #include <asm/io.h>
 
index e287ebc47817da5e8dccd66ce40d028d92bb6c73..97cb9bd1d1ddb75f48abe8546c555f6160b7a0b1 100644 (file)
@@ -56,7 +56,6 @@
 #include <linux/cuda.h>
 #include <asm/io.h>
 #ifdef CONFIG_MAC
-#include <asm/bootinfo.h>
 #include <asm/macintosh.h>
 #else
 #include <asm/prom.h>
index c444654fc33fb6f7e858824eb8ed816186bf3bda..5c4a95b516cf9e576884c8f84e566f03b396facb 100644 (file)
@@ -285,7 +285,7 @@ static void update_balloon_size(struct virtio_balloon *vb)
 {
        __le32 actual = cpu_to_le32(vb->num_pages);
 
-       virtio_cwrite(vb->vdev, struct virtio_balloon_config, num_pages,
+       virtio_cwrite(vb->vdev, struct virtio_balloon_config, actual,
                      &actual);
 }
 
index 8dae6c13063af5df3846d0c3a700876fe23eefe0..80875fb770ed931681c75db5aa4209c15acfc7a7 100644 (file)
 #include <linux/cpu.h>
 #include <linux/acpi.h>
 #include <linux/uaccess.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
 #include <acpi/processor.h>
-
 #include <xen/acpi.h>
 #include <xen/interface/platform.h>
 #include <asm/xen/hypercall.h>
@@ -269,7 +266,8 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
                if (!is_processor_present(handle))
                        break;
 
-               if (!acpi_bus_get_device(handle, &device))
+               acpi_bus_get_device(handle, &device);
+               if (acpi_device_enumerated(device))
                        break;
 
                result = acpi_bus_scan(handle);
@@ -277,8 +275,9 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
                        pr_err(PREFIX "Unable to add the device\n");
                        break;
                }
-               result = acpi_bus_get_device(handle, &device);
-               if (result) {
+               device = NULL;
+               acpi_bus_get_device(handle, &device);
+               if (!acpi_device_enumerated(device)) {
                        pr_err(PREFIX "Missing device object\n");
                        break;
                }
index 9083f1e474f801c07c1531551fa971b5e0e21b38..f8d18626969a48819ae5810f1d424dc4eacf3f31 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/acpi.h>
-#include <acpi/acpi_drivers.h>
 #include <xen/acpi.h>
 #include <xen/interface/platform.h>
 #include <asm/xen/hypercall.h>
@@ -169,7 +168,7 @@ static int acpi_memory_get_device(acpi_handle handle,
        acpi_scan_lock_acquire();
 
        acpi_bus_get_device(handle, &device);
-       if (device)
+       if (acpi_device_enumerated(device))
                goto end;
 
        /*
@@ -182,8 +181,9 @@ static int acpi_memory_get_device(acpi_handle handle,
                result = -EINVAL;
                goto out;
        }
-       result = acpi_bus_get_device(handle, &device);
-       if (result) {
+       device = NULL;
+       acpi_bus_get_device(handle, &device);
+       if (!acpi_device_enumerated(device)) {
                pr_warn(PREFIX "Missing device object\n");
                result = -EINVAL;
                goto out;
index 59708fdd068bdfed83976dab53a823115efeda29..40c4bc06b5fa0929af0b9b8ffddd9d59e6bcbc36 100644 (file)
 
 #include <linux/kernel.h>
 #include <linux/types.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-#include <asm/xen/hypercall.h>
+#include <linux/acpi.h>
 #include <xen/interface/version.h>
 #include <xen/xen-ops.h>
+#include <asm/xen/hypercall.h>
 
 #define ACPI_PROCESSOR_AGGREGATOR_CLASS        "acpi_pad"
 #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"
index 13bc6c31c060bfc9821eb23eb467873b720c6f13..7231859119f1f126ac89e606ecc7c96c1a6a55c3 100644 (file)
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/syscore_ops.h>
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+#include <linux/acpi.h>
 #include <acpi/processor.h>
-
 #include <xen/xen.h>
 #include <xen/interface/platform.h>
 #include <asm/xen/hypercall.h>
index f62172603215ed433a32f7945603c95bf05783c2..7dc5332ff9842bfe1f119f4ff003056430959ec3 100644 (file)
@@ -2,8 +2,9 @@
 # Makefile for the Zorro bus specific drivers.
 #
 
-obj-$(CONFIG_ZORRO)    += zorro.o zorro-driver.o zorro-sysfs.o names.o
+obj-$(CONFIG_ZORRO)    += zorro.o zorro-driver.o zorro-sysfs.o
 obj-$(CONFIG_PROC_FS)  += proc.o
+obj-$(CONFIG_ZORRO_NAMES) +=  names.o
 
 hostprogs-y            := gen-devlist
 
index e8517c3d8e82df3d9b34f9049a29bdedd0a61b0e..6f3fd9903ac387f8d354c843ae88950b45bcfcfb 100644 (file)
@@ -15,8 +15,6 @@
 #include <linux/zorro.h>
 
 
-#ifdef CONFIG_ZORRO_NAMES
-
 struct zorro_prod_info {
        __u16 prod;
        unsigned short seen;
@@ -69,7 +67,6 @@ void __init zorro_name_device(struct zorro_dev *dev)
        } while (--i);
 
        /* Couldn't find either the manufacturer nor the product */
-       sprintf(name, "Zorro device %08x", dev->id);
        return;
 
        match_manuf: {
@@ -98,11 +95,3 @@ void __init zorro_name_device(struct zorro_dev *dev)
                }
        }
 }
-
-#else
-
-void __init zorro_name_device(struct zorro_dev *dev)
-{
-}
-
-#endif
index ea1ce822a8e0437120184a8e559bd0495860c7b7..6ac2579da0ebb1355450474204807701e47e2e08 100644 (file)
@@ -14,6 +14,8 @@
 #include <linux/seq_file.h>
 #include <linux/init.h>
 #include <linux/export.h>
+
+#include <asm/byteorder.h>
 #include <asm/uaccess.h>
 #include <asm/amigahw.h>
 #include <asm/setup.h>
@@ -41,10 +43,10 @@ proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *
        /* Construct a ConfigDev */
        memset(&cd, 0, sizeof(cd));
        cd.cd_Rom = z->rom;
-       cd.cd_SlotAddr = z->slotaddr;
-       cd.cd_SlotSize = z->slotsize;
-       cd.cd_BoardAddr = (void *)zorro_resource_start(z);
-       cd.cd_BoardSize = zorro_resource_len(z);
+       cd.cd_SlotAddr = cpu_to_be16(z->slotaddr);
+       cd.cd_SlotSize = cpu_to_be16(z->slotsize);
+       cd.cd_BoardAddr = cpu_to_be32(zorro_resource_start(z));
+       cd.cd_BoardSize = cpu_to_be32(zorro_resource_len(z));
 
        if (copy_to_user(buf, (void *)&cd + pos, nbytes))
                return -EFAULT;
index ac1db7f1bcab7731e9366cfc4bce832c4258cd35..eacae1434b73fd7472e2d81b5b86ebc214f3e6af 100644 (file)
@@ -161,11 +161,12 @@ static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
 }
 
 struct bus_type zorro_bus_type = {
-       .name   = "zorro",
-       .match  = zorro_bus_match,
-       .uevent = zorro_uevent,
-       .probe  = zorro_device_probe,
-       .remove = zorro_device_remove,
+       .name     = "zorro",
+       .dev_name = "zorro",
+       .match    = zorro_bus_match,
+       .uevent   = zorro_uevent,
+       .probe    = zorro_device_probe,
+       .remove   = zorro_device_remove,
 };
 EXPORT_SYMBOL(zorro_bus_type);
 
index 26f7184ef9e1a19cb47890bcbfaa124c6c34912b..36b210f9b6b29621fa9e410db063d3df53d7fb75 100644 (file)
@@ -16,6 +16,8 @@
 #include <linux/stat.h>
 #include <linux/string.h>
 
+#include <asm/byteorder.h>
+
 #include "zorro.h"
 
 
@@ -33,10 +35,20 @@ static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
 
 zorro_config_attr(id, id, "0x%08x\n");
 zorro_config_attr(type, rom.er_Type, "0x%02x\n");
-zorro_config_attr(serial, rom.er_SerialNumber, "0x%08x\n");
 zorro_config_attr(slotaddr, slotaddr, "0x%04x\n");
 zorro_config_attr(slotsize, slotsize, "0x%04x\n");
 
+static ssize_t
+show_serial(struct device *dev, struct device_attribute *attr, char *buf)
+{
+       struct zorro_dev *z;
+
+       z = to_zorro_dev(dev);
+       return sprintf(buf, "0x%08x\n", be32_to_cpu(z->rom.er_SerialNumber));
+}
+
+static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL);
+
 static ssize_t zorro_show_resource(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct zorro_dev *z = to_zorro_dev(dev);
@@ -60,10 +72,10 @@ static ssize_t zorro_read_config(struct file *filp, struct kobject *kobj,
        /* Construct a ConfigDev */
        memset(&cd, 0, sizeof(cd));
        cd.cd_Rom = z->rom;
-       cd.cd_SlotAddr = z->slotaddr;
-       cd.cd_SlotSize = z->slotsize;
-       cd.cd_BoardAddr = (void *)zorro_resource_start(z);
-       cd.cd_BoardSize = zorro_resource_len(z);
+       cd.cd_SlotAddr = cpu_to_be16(z->slotaddr);
+       cd.cd_SlotSize = cpu_to_be16(z->slotsize);
+       cd.cd_BoardAddr = cpu_to_be32(zorro_resource_start(z));
+       cd.cd_BoardSize = cpu_to_be32(zorro_resource_len(z));
 
        return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd));
 }
index 858c9714b2f390a26e1a1450f196d7abf6e14340..707c1a5a031703ba1b7e8de9f87e71103d217a18 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
+#include <asm/byteorder.h>
 #include <asm/setup.h>
 #include <asm/amigahw.h>
 
@@ -29,7 +30,8 @@
      */
 
 unsigned int zorro_num_autocon;
-struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
+struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata;
+struct zorro_dev *zorro_autocon;
 
 
     /*
@@ -38,6 +40,7 @@ struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
 
 struct zorro_bus {
        struct device dev;
+       struct zorro_dev devices[0];
 };
 
 
@@ -125,18 +128,22 @@ static struct resource __init *zorro_find_parent_resource(
 static int __init amiga_zorro_probe(struct platform_device *pdev)
 {
        struct zorro_bus *bus;
+       struct zorro_dev_init *zi;
        struct zorro_dev *z;
        struct resource *r;
        unsigned int i;
        int error;
 
        /* Initialize the Zorro bus */
-       bus = kzalloc(sizeof(*bus), GFP_KERNEL);
+       bus = kzalloc(sizeof(*bus) +
+                     zorro_num_autocon * sizeof(bus->devices[0]),
+                     GFP_KERNEL);
        if (!bus)
                return -ENOMEM;
 
+       zorro_autocon = bus->devices;
        bus->dev.parent = &pdev->dev;
-       dev_set_name(&bus->dev, "zorro");
+       dev_set_name(&bus->dev, zorro_bus_type.name);
        error = device_register(&bus->dev);
        if (error) {
                pr_err("Zorro: Error registering zorro_bus\n");
@@ -151,15 +158,23 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 
        /* First identify all devices ... */
        for (i = 0; i < zorro_num_autocon; i++) {
+               zi = &zorro_autocon_init[i];
                z = &zorro_autocon[i];
-               z->id = (z->rom.er_Manufacturer<<16) | (z->rom.er_Product<<8);
+
+               z->rom = zi->rom;
+               z->id = (be16_to_cpu(z->rom.er_Manufacturer) << 16) |
+                       (z->rom.er_Product << 8);
                if (z->id == ZORRO_PROD_GVP_EPC_BASE) {
                        /* GVP quirk */
-                       unsigned long magic = zorro_resource_start(z)+0x8000;
+                       unsigned long magic = zi->boardaddr + 0x8000;
                        z->id |= *(u16 *)ZTWO_VADDR(magic) & GVP_PRODMASK;
                }
+               z->slotaddr = zi->slotaddr;
+               z->slotsize = zi->slotsize;
                sprintf(z->name, "Zorro device %08x", z->id);
                zorro_name_device(z);
+               z->resource.start = zi->boardaddr;
+               z->resource.end = zi->boardaddr + zi->boardsize - 1;
                z->resource.name = z->name;
                r = zorro_find_parent_resource(pdev, z);
                error = request_resource(r, &z->resource);
@@ -167,9 +182,9 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
                        dev_err(&bus->dev,
                                "Address space collision on device %s %pR\n",
                                z->name, &z->resource);
-               dev_set_name(&z->dev, "%02x", i);
                z->dev.parent = &bus->dev;
                z->dev.bus = &zorro_bus_type;
+               z->dev.id = i;
        }
 
        /* ... then register them */
index b682d5ccd63f74b1be7aae6db188270318891f14..34119fb4e5601603edbd139563f539b3548963c9 100644 (file)
@@ -1,4 +1,9 @@
 
+#ifdef CONFIG_ZORRO_NAMES
 extern void zorro_name_device(struct zorro_dev *z);
+#else
+static inline void zorro_name_device(struct zorro_dev *dev) { }
+#endif
+
 extern int zorro_create_sysfs_dev_files(struct zorro_dev *z);
 
index 2b7a032c37bc7b087e0fdb3129436c0b735ba809..a69260f27555df85894618dc1647422971914dc4 100644 (file)
@@ -239,13 +239,12 @@ void v9fs_cache_inode_flush_cookie(struct inode *inode)
 void v9fs_cache_inode_set_cookie(struct inode *inode, struct file *filp)
 {
        struct v9fs_inode *v9inode = V9FS_I(inode);
-       struct p9_fid *fid;
 
        if (!v9inode->fscache)
                return;
 
        spin_lock(&v9inode->fscache_lock);
-       fid = filp->private_data;
+
        if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
                v9fs_cache_inode_flush_cookie(inode);
        else
index a0df3e73c2b128e01ede3519b1c2aae2d8b09f28..27782bb7f4f9090c7c6330a1c071356b9c4baaf1 100644 (file)
@@ -461,14 +461,12 @@ v9fs_file_write_internal(struct inode *inode, struct p9_fid *fid,
        int n;
        loff_t i_size;
        size_t total = 0;
-       struct p9_client *clnt;
        loff_t origin = *offset;
        unsigned long pg_start, pg_end;
 
        p9_debug(P9_DEBUG_VFS, "data %p count %d offset %x\n",
                 data, (int)count, (int)*offset);
 
-       clnt = fid->clnt;
        do {
                n = p9_client_write(fid, NULL, data+total, origin+total, count);
                if (n <= 0)
index 4e65aa903345da5a7e63f5e49fb53f1204ee579e..af7d531bdecdedcc4e7cef7a99dc36347b1c1163 100644 (file)
@@ -779,7 +779,6 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
                                      unsigned int flags)
 {
        struct dentry *res;
-       struct super_block *sb;
        struct v9fs_session_info *v9ses;
        struct p9_fid *dfid, *fid;
        struct inode *inode;
@@ -791,7 +790,6 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
        if (dentry->d_name.len > NAME_MAX)
                return ERR_PTR(-ENAMETOOLONG);
 
-       sb = dir->i_sb;
        v9ses = v9fs_inode2v9ses(dir);
        /* We can walk d_parent because we hold the dir->i_mutex */
        dfid = v9fs_fid_lookup(dentry->d_parent);
@@ -863,7 +861,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
                return finish_no_open(file, res);
 
        err = 0;
-       fid = NULL;
+
        v9ses = v9fs_inode2v9ses(dir);
        perm = unixmode2p9mode(v9ses, mode);
        fid = v9fs_create(v9ses, dir, dentry, NULL, perm,
index 4c10edec26a04a5796f417da7151f3b5ae2b77fb..98013068f35bffa2e347b0ddb1b7ce44b366deb7 100644 (file)
@@ -473,13 +473,11 @@ static int
 v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
                 struct kstat *stat)
 {
-       int err;
        struct v9fs_session_info *v9ses;
        struct p9_fid *fid;
        struct p9_stat_dotl *st;
 
        p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
-       err = -EPERM;
        v9ses = v9fs_dentry2v9ses(dentry);
        if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
                generic_fillattr(dentry->d_inode, stat);
@@ -556,7 +554,6 @@ static int v9fs_mapped_iattr_valid(int iattr_valid)
 int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
 {
        int retval;
-       struct v9fs_session_info *v9ses;
        struct p9_fid *fid;
        struct p9_iattr_dotl p9attr;
        struct inode *inode = dentry->d_inode;
@@ -577,8 +574,6 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
        p9attr.mtime_sec = iattr->ia_mtime.tv_sec;
        p9attr.mtime_nsec = iattr->ia_mtime.tv_nsec;
 
-       retval = -EPERM;
-       v9ses = v9fs_dentry2v9ses(dentry);
        fid = v9fs_fid_lookup(dentry);
        if (IS_ERR(fid))
                return PTR_ERR(fid);
@@ -768,7 +763,6 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
                struct dentry *dentry)
 {
        int err;
-       char *name;
        struct dentry *dir_dentry;
        struct p9_fid *dfid, *oldfid;
        struct v9fs_session_info *v9ses;
@@ -786,8 +780,6 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
        if (IS_ERR(oldfid))
                return PTR_ERR(oldfid);
 
-       name = (char *) dentry->d_name.name;
-
        err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name);
 
        if (err < 0) {
index 3c28cdfb8c477b65269c1a26957cb4942d10344f..04133a1fd9cbea42585f530b56bb73f93b1bd1dc 100644 (file)
@@ -138,8 +138,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
        if (retval < 0) {
                p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n",
                         retval);
-               p9_client_clunk(fid);
-               return retval;
+               goto err;
        }
        msize = fid->clnt->msize;
        while (value_len) {
@@ -152,12 +151,15 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
                if (write_count < 0) {
                        /* error in xattr write */
                        retval = write_count;
-                       break;
+                       goto err;
                }
                offset += write_count;
                value_len -= write_count;
        }
-       return p9_client_clunk(fid);
+       retval = offset;
+err:
+       p9_client_clunk(fid);
+       return retval;
 }
 
 ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
index 267968d946739a2f3c17a20b4ffb5776e21ece75..5d4e59d56e854a158614302531cd15d1e8d0b5b6 100644 (file)
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -202,11 +202,6 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de
                        return -EPERM;
        }
 
-       if ((ia_valid & ATTR_SIZE) && IS_I_VERSION(inode)) {
-               if (attr->ia_size != inode->i_size)
-                       inode_inc_iversion(inode);
-       }
-
        if ((ia_valid & ATTR_MODE)) {
                umode_t amode = attr->ia_mode;
                /* Flag setting protected by i_mutex */
index f1a77449d032b1fbd481eb16cd232653e5bfbefa..471a4f7f4044d4171f823e996ff89b68d237abb0 100644 (file)
@@ -4354,8 +4354,12 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
         * these flags set.  For all other operations the VFS set these flags
         * explicitly if it wants a timestamp update.
         */
-       if (newsize != oldsize && (!(mask & (ATTR_CTIME | ATTR_MTIME))))
-               inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
+       if (newsize != oldsize) {
+               inode_inc_iversion(inode);
+               if (!(mask & (ATTR_CTIME | ATTR_MTIME)))
+                       inode->i_ctime = inode->i_mtime =
+                               current_fs_time(inode->i_sb);
+       }
 
        if (newsize > oldsize) {
                truncate_pagecache(inode, newsize);
index 3de89829e2a162ab6bce2a58296b25aef9235c43..c4419e848a4f89eced64c8a156a560f62bc2cbdd 100644 (file)
@@ -408,51 +408,92 @@ more:
  *
  * If the read spans object boundary, just do multiple reads.
  */
-static ssize_t ceph_sync_read(struct file *file, char __user *data,
-                             unsigned len, loff_t *poff, int *checkeof)
+static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i,
+                               int *checkeof)
 {
+       struct file *file = iocb->ki_filp;
        struct inode *inode = file_inode(file);
        struct page **pages;
-       u64 off = *poff;
+       u64 off = iocb->ki_pos;
        int num_pages, ret;
+       size_t len = i->count;
 
-       dout("sync_read on file %p %llu~%u %s\n", file, off, len,
+       dout("sync_read on file %p %llu~%u %s\n", file, off,
+            (unsigned)len,
             (file->f_flags & O_DIRECT) ? "O_DIRECT" : "");
-
-       if (file->f_flags & O_DIRECT) {
-               num_pages = calc_pages_for((unsigned long)data, len);
-               pages = ceph_get_direct_page_vector(data, num_pages, true);
-       } else {
-               num_pages = calc_pages_for(off, len);
-               pages = ceph_alloc_page_vector(num_pages, GFP_NOFS);
-       }
-       if (IS_ERR(pages))
-               return PTR_ERR(pages);
-
        /*
         * flush any page cache pages in this range.  this
         * will make concurrent normal and sync io slow,
         * but it will at least behave sensibly when they are
         * in sequence.
         */
-       ret = filemap_write_and_wait(inode->i_mapping);
+       ret = filemap_write_and_wait_range(inode->i_mapping, off,
+                                               off + len);
        if (ret < 0)
-               goto done;
+               return ret;
 
-       ret = striped_read(inode, off, len, pages, num_pages, checkeof,
-                          file->f_flags & O_DIRECT,
-                          (unsigned long)data & ~PAGE_MASK);
+       if (file->f_flags & O_DIRECT) {
+               while (iov_iter_count(i)) {
+                       void __user *data = i->iov[0].iov_base + i->iov_offset;
+                       size_t len = i->iov[0].iov_len - i->iov_offset;
+
+                       num_pages = calc_pages_for((unsigned long)data, len);
+                       pages = ceph_get_direct_page_vector(data,
+                                                           num_pages, true);
+                       if (IS_ERR(pages))
+                               return PTR_ERR(pages);
+
+                       ret = striped_read(inode, off, len,
+                                          pages, num_pages, checkeof,
+                                          1, (unsigned long)data & ~PAGE_MASK);
+                       ceph_put_page_vector(pages, num_pages, true);
+
+                       if (ret <= 0)
+                               break;
+                       off += ret;
+                       iov_iter_advance(i, ret);
+                       if (ret < len)
+                               break;
+               }
+       } else {
+               num_pages = calc_pages_for(off, len);
+               pages = ceph_alloc_page_vector(num_pages, GFP_NOFS);
+               if (IS_ERR(pages))
+                       return PTR_ERR(pages);
+               ret = striped_read(inode, off, len, pages,
+                                       num_pages, checkeof, 0, 0);
+               if (ret > 0) {
+                       int l, k = 0;
+                       size_t left = len = ret;
+
+                       while (left) {
+                               void __user *data = i->iov[0].iov_base
+                                                       + i->iov_offset;
+                               l = min(i->iov[0].iov_len - i->iov_offset,
+                                       left);
+
+                               ret = ceph_copy_page_vector_to_user(&pages[k],
+                                                                   data, off,
+                                                                   l);
+                               if (ret > 0) {
+                                       iov_iter_advance(i, ret);
+                                       left -= ret;
+                                       off += ret;
+                                       k = calc_pages_for(iocb->ki_pos,
+                                                          len - left + 1) - 1;
+                                       BUG_ON(k >= num_pages && left);
+                               } else
+                                       break;
+                       }
+               }
+               ceph_release_page_vector(pages, num_pages);
+       }
 
-       if (ret >= 0 && (file->f_flags & O_DIRECT) == 0)
-               ret = ceph_copy_page_vector_to_user(pages, data, off, ret);
-       if (ret >= 0)
-               *poff = off + ret;
+       if (off > iocb->ki_pos) {
+               ret = off - iocb->ki_pos;
+               iocb->ki_pos = off;
+       }
 
-done:
-       if (file->f_flags & O_DIRECT)
-               ceph_put_page_vector(pages, num_pages, true);
-       else
-               ceph_release_page_vector(pages, num_pages);
        dout("sync_read result %d\n", ret);
        return ret;
 }
@@ -489,83 +530,79 @@ static void ceph_sync_write_unsafe(struct ceph_osd_request *req, bool unsafe)
        }
 }
 
+
 /*
- * Synchronous write, straight from __user pointer or user pages (if
- * O_DIRECT).
+ * Synchronous write, straight from __user pointer or user pages.
  *
  * If write spans object boundary, just do multiple writes.  (For a
  * correct atomic write, we should e.g. take write locks on all
  * objects, rollback on failure, etc.)
  */
-static ssize_t ceph_sync_write(struct file *file, const char __user *data,
-                              size_t left, loff_t pos, loff_t *ppos)
+static ssize_t
+ceph_sync_direct_write(struct kiocb *iocb, const struct iovec *iov,
+                      unsigned long nr_segs, size_t count)
 {
+       struct file *file = iocb->ki_filp;
        struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
        struct ceph_snap_context *snapc;
        struct ceph_vino vino;
        struct ceph_osd_request *req;
-       int num_ops = 1;
        struct page **pages;
        int num_pages;
-       u64 len;
        int written = 0;
        int flags;
        int check_caps = 0;
-       int page_align, io_align;
-       unsigned long buf_align;
+       int page_align;
        int ret;
        struct timespec mtime = CURRENT_TIME;
-       bool own_pages = false;
+       loff_t pos = iocb->ki_pos;
+       struct iov_iter i;
 
        if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
                return -EROFS;
 
-       dout("sync_write on file %p %lld~%u %s\n", file, pos,
-            (unsigned)left, (file->f_flags & O_DIRECT) ? "O_DIRECT" : "");
+       dout("sync_direct_write on file %p %lld~%u\n", file, pos,
+            (unsigned)count);
 
-       ret = filemap_write_and_wait_range(inode->i_mapping, pos, pos + left);
+       ret = filemap_write_and_wait_range(inode->i_mapping, pos, pos + count);
        if (ret < 0)
                return ret;
 
        ret = invalidate_inode_pages2_range(inode->i_mapping,
                                            pos >> PAGE_CACHE_SHIFT,
-                                           (pos + left) >> PAGE_CACHE_SHIFT);
+                                           (pos + count) >> PAGE_CACHE_SHIFT);
        if (ret < 0)
                dout("invalidate_inode_pages2_range returned %d\n", ret);
 
        flags = CEPH_OSD_FLAG_ORDERSNAP |
                CEPH_OSD_FLAG_ONDISK |
                CEPH_OSD_FLAG_WRITE;
-       if ((file->f_flags & (O_SYNC|O_DIRECT)) == 0)
-               flags |= CEPH_OSD_FLAG_ACK;
-       else
-               num_ops++;      /* Also include a 'startsync' command. */
 
-       /*
-        * we may need to do multiple writes here if we span an object
-        * boundary.  this isn't atomic, unfortunately.  :(
-        */
-more:
-       io_align = pos & ~PAGE_MASK;
-       buf_align = (unsigned long)data & ~PAGE_MASK;
-       len = left;
-
-       snapc = ci->i_snap_realm->cached_context;
-       vino = ceph_vino(inode);
-       req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout,
-                                   vino, pos, &len, num_ops,
-                                   CEPH_OSD_OP_WRITE, flags, snapc,
-                                   ci->i_truncate_seq, ci->i_truncate_size,
-                                   false);
-       if (IS_ERR(req))
-               return PTR_ERR(req);
+       iov_iter_init(&i, iov, nr_segs, count, 0);
+
+       while (iov_iter_count(&i) > 0) {
+               void __user *data = i.iov->iov_base + i.iov_offset;
+               u64 len = i.iov->iov_len - i.iov_offset;
+
+               page_align = (unsigned long)data & ~PAGE_MASK;
+
+               snapc = ci->i_snap_realm->cached_context;
+               vino = ceph_vino(inode);
+               req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout,
+                                           vino, pos, &len,
+                                           2,/*include a 'startsync' command*/
+                                           CEPH_OSD_OP_WRITE, flags, snapc,
+                                           ci->i_truncate_seq,
+                                           ci->i_truncate_size,
+                                           false);
+               if (IS_ERR(req)) {
+                       ret = PTR_ERR(req);
+                       goto out;
+               }
 
-       /* write from beginning of first page, regardless of io alignment */
-       page_align = file->f_flags & O_DIRECT ? buf_align : io_align;
-       num_pages = calc_pages_for(page_align, len);
-       if (file->f_flags & O_DIRECT) {
+               num_pages = calc_pages_for(page_align, len);
                pages = ceph_get_direct_page_vector(data, num_pages, false);
                if (IS_ERR(pages)) {
                        ret = PTR_ERR(pages);
@@ -577,60 +614,175 @@ more:
                 * may block.
                 */
                truncate_inode_pages_range(inode->i_mapping, pos,
-                                          (pos+len) | (PAGE_CACHE_SIZE-1));
-       } else {
+                                  (pos+len) | (PAGE_CACHE_SIZE-1));
+               osd_req_op_extent_osd_data_pages(req, 0, pages, len, page_align,
+                                               false, false);
+
+               /* BUG_ON(vino.snap != CEPH_NOSNAP); */
+               ceph_osdc_build_request(req, pos, snapc, vino.snap, &mtime);
+
+               ret = ceph_osdc_start_request(&fsc->client->osdc, req, false);
+               if (!ret)
+                       ret = ceph_osdc_wait_request(&fsc->client->osdc, req);
+
+               ceph_put_page_vector(pages, num_pages, false);
+
+out:
+               ceph_osdc_put_request(req);
+               if (ret == 0) {
+                       pos += len;
+                       written += len;
+                       iov_iter_advance(&i, (size_t)len);
+
+                       if (pos > i_size_read(inode)) {
+                               check_caps = ceph_inode_set_size(inode, pos);
+                               if (check_caps)
+                                       ceph_check_caps(ceph_inode(inode),
+                                                       CHECK_CAPS_AUTHONLY,
+                                                       NULL);
+                       }
+               } else
+                       break;
+       }
+
+       if (ret != -EOLDSNAPC && written > 0) {
+               iocb->ki_pos = pos;
+               ret = written;
+       }
+       return ret;
+}
+
+
+/*
+ * Synchronous write, straight from __user pointer or user pages.
+ *
+ * If write spans object boundary, just do multiple writes.  (For a
+ * correct atomic write, we should e.g. take write locks on all
+ * objects, rollback on failure, etc.)
+ */
+static ssize_t ceph_sync_write(struct kiocb *iocb, const struct iovec *iov,
+                              unsigned long nr_segs, size_t count)
+{
+       struct file *file = iocb->ki_filp;
+       struct inode *inode = file_inode(file);
+       struct ceph_inode_info *ci = ceph_inode(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_snap_context *snapc;
+       struct ceph_vino vino;
+       struct ceph_osd_request *req;
+       struct page **pages;
+       u64 len;
+       int num_pages;
+       int written = 0;
+       int flags;
+       int check_caps = 0;
+       int ret;
+       struct timespec mtime = CURRENT_TIME;
+       loff_t pos = iocb->ki_pos;
+       struct iov_iter i;
+
+       if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
+               return -EROFS;
+
+       dout("sync_write on file %p %lld~%u\n", file, pos, (unsigned)count);
+
+       ret = filemap_write_and_wait_range(inode->i_mapping, pos, pos + count);
+       if (ret < 0)
+               return ret;
+
+       ret = invalidate_inode_pages2_range(inode->i_mapping,
+                                           pos >> PAGE_CACHE_SHIFT,
+                                           (pos + count) >> PAGE_CACHE_SHIFT);
+       if (ret < 0)
+               dout("invalidate_inode_pages2_range returned %d\n", ret);
+
+       flags = CEPH_OSD_FLAG_ORDERSNAP |
+               CEPH_OSD_FLAG_ONDISK |
+               CEPH_OSD_FLAG_WRITE |
+               CEPH_OSD_FLAG_ACK;
+
+       iov_iter_init(&i, iov, nr_segs, count, 0);
+
+       while ((len = iov_iter_count(&i)) > 0) {
+               size_t left;
+               int n;
+
+               snapc = ci->i_snap_realm->cached_context;
+               vino = ceph_vino(inode);
+               req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout,
+                                           vino, pos, &len, 1,
+                                           CEPH_OSD_OP_WRITE, flags, snapc,
+                                           ci->i_truncate_seq,
+                                           ci->i_truncate_size,
+                                           false);
+               if (IS_ERR(req)) {
+                       ret = PTR_ERR(req);
+                       goto out;
+               }
+
+               /*
+                * write from beginning of first page,
+                * regardless of io alignment
+                */
+               num_pages = (len + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+
                pages = ceph_alloc_page_vector(num_pages, GFP_NOFS);
                if (IS_ERR(pages)) {
                        ret = PTR_ERR(pages);
                        goto out;
                }
-               ret = ceph_copy_user_to_page_vector(pages, data, pos, len);
+
+               left = len;
+               for (n = 0; n < num_pages; n++) {
+                       size_t plen = min(left, PAGE_SIZE);
+                       ret = iov_iter_copy_from_user(pages[n], &i, 0, plen);
+                       if (ret != plen) {
+                               ret = -EFAULT;
+                               break;
+                       }
+                       left -= ret;
+                       iov_iter_advance(&i, ret);
+               }
+
                if (ret < 0) {
                        ceph_release_page_vector(pages, num_pages);
                        goto out;
                }
 
-               if ((file->f_flags & O_SYNC) == 0) {
-                       /* get a second commit callback */
-                       req->r_unsafe_callback = ceph_sync_write_unsafe;
-                       req->r_inode = inode;
-                       own_pages = true;
-               }
-       }
-       osd_req_op_extent_osd_data_pages(req, 0, pages, len, page_align,
-                                       false, own_pages);
+               /* get a second commit callback */
+               req->r_unsafe_callback = ceph_sync_write_unsafe;
+               req->r_inode = inode;
 
-       /* BUG_ON(vino.snap != CEPH_NOSNAP); */
-       ceph_osdc_build_request(req, pos, snapc, vino.snap, &mtime);
+               osd_req_op_extent_osd_data_pages(req, 0, pages, len, 0,
+                                               false, true);
 
-       ret = ceph_osdc_start_request(&fsc->client->osdc, req, false);
-       if (!ret)
-               ret = ceph_osdc_wait_request(&fsc->client->osdc, req);
+               /* BUG_ON(vino.snap != CEPH_NOSNAP); */
+               ceph_osdc_build_request(req, pos, snapc, vino.snap, &mtime);
 
-       if (file->f_flags & O_DIRECT)
-               ceph_put_page_vector(pages, num_pages, false);
-       else if (file->f_flags & O_SYNC)
-               ceph_release_page_vector(pages, num_pages);
+               ret = ceph_osdc_start_request(&fsc->client->osdc, req, false);
+               if (!ret)
+                       ret = ceph_osdc_wait_request(&fsc->client->osdc, req);
 
 out:
-       ceph_osdc_put_request(req);
-       if (ret == 0) {
-               pos += len;
-               written += len;
-               left -= len;
-               data += len;
-               if (left)
-                       goto more;
+               ceph_osdc_put_request(req);
+               if (ret == 0) {
+                       pos += len;
+                       written += len;
+
+                       if (pos > i_size_read(inode)) {
+                               check_caps = ceph_inode_set_size(inode, pos);
+                               if (check_caps)
+                                       ceph_check_caps(ceph_inode(inode),
+                                                       CHECK_CAPS_AUTHONLY,
+                                                       NULL);
+                       }
+               } else
+                       break;
+       }
 
+       if (ret != -EOLDSNAPC && written > 0) {
                ret = written;
-               *ppos = pos;
-               if (pos > i_size_read(inode))
-                       check_caps = ceph_inode_set_size(inode, pos);
-               if (check_caps)
-                       ceph_check_caps(ceph_inode(inode), CHECK_CAPS_AUTHONLY,
-                                       NULL);
-       } else if (ret != -EOLDSNAPC && written > 0) {
-               ret = written;
+               iocb->ki_pos = pos;
        }
        return ret;
 }
@@ -647,55 +799,84 @@ static ssize_t ceph_aio_read(struct kiocb *iocb, const struct iovec *iov,
 {
        struct file *filp = iocb->ki_filp;
        struct ceph_file_info *fi = filp->private_data;
-       loff_t *ppos = &iocb->ki_pos;
-       size_t len = iov->iov_len;
+       size_t len = iocb->ki_nbytes;
        struct inode *inode = file_inode(filp);
        struct ceph_inode_info *ci = ceph_inode(inode);
-       void __user *base = iov->iov_base;
        ssize_t ret;
        int want, got = 0;
        int checkeof = 0, read = 0;
 
-       dout("aio_read %p %llx.%llx %llu~%u trying to get caps on %p\n",
-            inode, ceph_vinop(inode), pos, (unsigned)len, inode);
 again:
+       dout("aio_read %p %llx.%llx %llu~%u trying to get caps on %p\n",
+            inode, ceph_vinop(inode), iocb->ki_pos, (unsigned)len, inode);
+
        if (fi->fmode & CEPH_FILE_MODE_LAZY)
                want = CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_LAZYIO;
        else
                want = CEPH_CAP_FILE_CACHE;
        ret = ceph_get_caps(ci, CEPH_CAP_FILE_RD, want, &got, -1);
        if (ret < 0)
-               goto out;
-       dout("aio_read %p %llx.%llx %llu~%u got cap refs on %s\n",
-            inode, ceph_vinop(inode), pos, (unsigned)len,
-            ceph_cap_string(got));
+               return ret;
 
        if ((got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0 ||
            (iocb->ki_filp->f_flags & O_DIRECT) ||
-           (fi->flags & CEPH_F_SYNC))
+           (fi->flags & CEPH_F_SYNC)) {
+               struct iov_iter i;
+
+               dout("aio_sync_read %p %llx.%llx %llu~%u got cap refs on %s\n",
+                    inode, ceph_vinop(inode), iocb->ki_pos, (unsigned)len,
+                    ceph_cap_string(got));
+
+               if (!read) {
+                       ret = generic_segment_checks(iov, &nr_segs,
+                                                       &len, VERIFY_WRITE);
+                       if (ret)
+                               goto out;
+               }
+
+               iov_iter_init(&i, iov, nr_segs, len, read);
+
                /* hmm, this isn't really async... */
-               ret = ceph_sync_read(filp, base, len, ppos, &checkeof);
-       else
-               ret = generic_file_aio_read(iocb, iov, nr_segs, pos);
+               ret = ceph_sync_read(iocb, &i, &checkeof);
+       } else {
+               /*
+                * We can't modify the content of iov,
+                * so we only read from beginning.
+                */
+               if (read) {
+                       iocb->ki_pos = pos;
+                       len = iocb->ki_nbytes;
+                       read = 0;
+               }
+               dout("aio_read %p %llx.%llx %llu~%u got cap refs on %s\n",
+                    inode, ceph_vinop(inode), pos, (unsigned)len,
+                    ceph_cap_string(got));
 
+               ret = generic_file_aio_read(iocb, iov, nr_segs, pos);
+       }
 out:
        dout("aio_read %p %llx.%llx dropping cap refs on %s = %d\n",
             inode, ceph_vinop(inode), ceph_cap_string(got), (int)ret);
        ceph_put_cap_refs(ci, got);
 
        if (checkeof && ret >= 0) {
-               int statret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE);
+               int statret = ceph_do_getattr(inode,
+                                             CEPH_STAT_CAP_SIZE);
 
                /* hit EOF or hole? */
-               if (statret == 0 && *ppos < inode->i_size) {
-                       dout("aio_read sync_read hit hole, ppos %lld < size %lld, reading more\n", *ppos, inode->i_size);
+               if (statret == 0 && iocb->ki_pos < inode->i_size &&
+                       ret < len) {
+                       dout("sync_read hit hole, ppos %lld < size %lld"
+                            ", reading more\n", iocb->ki_pos,
+                            inode->i_size);
+
                        read += ret;
-                       base += ret;
                        len -= ret;
                        checkeof = 0;
                        goto again;
                }
        }
+
        if (ret >= 0)
                ret += read;
 
@@ -772,11 +953,13 @@ retry_snap:
             inode, ceph_vinop(inode), pos, count, ceph_cap_string(got));
 
        if ((got & (CEPH_CAP_FILE_BUFFER|CEPH_CAP_FILE_LAZYIO)) == 0 ||
-           (iocb->ki_filp->f_flags & O_DIRECT) ||
-           (fi->flags & CEPH_F_SYNC)) {
+           (file->f_flags & O_DIRECT) || (fi->flags & CEPH_F_SYNC)) {
                mutex_unlock(&inode->i_mutex);
-               written = ceph_sync_write(file, iov->iov_base, count,
-                                         pos, &iocb->ki_pos);
+               if (file->f_flags & O_DIRECT)
+                       written = ceph_sync_direct_write(iocb, iov,
+                                                        nr_segs, count);
+               else
+                       written = ceph_sync_write(iocb, iov, nr_segs, count);
                if (written == -EOLDSNAPC) {
                        dout("aio_write %p %llx.%llx %llu~%u"
                                "got EOLDSNAPC, retrying\n",
index 9a8e396aed89a43a0c824c3b682f96ac817ebc1c..2ae1381de64a102c89d3fbe9b92dee3893fbbe7a 100644 (file)
@@ -436,6 +436,16 @@ void ceph_destroy_inode(struct inode *inode)
        call_rcu(&inode->i_rcu, ceph_i_callback);
 }
 
+int ceph_drop_inode(struct inode *inode)
+{
+       /*
+        * Positve dentry and corresponding inode are always accompanied
+        * in MDS reply. So no need to keep inode in the cache after
+        * dropping all its aliases.
+        */
+       return 1;
+}
+
 /*
  * Helpers to fill in size, ctime, mtime, and atime.  We have to be
  * careful because either the client or MDS may have more up to date
index 6a0951e4304441a241ca8fe550aba36cc097c271..e58bd4a23bfb532bd2c119345bb4669be1d9336b 100644 (file)
@@ -686,6 +686,7 @@ static const struct super_operations ceph_super_ops = {
        .alloc_inode    = ceph_alloc_inode,
        .destroy_inode  = ceph_destroy_inode,
        .write_inode    = ceph_write_inode,
+       .drop_inode     = ceph_drop_inode,
        .sync_fs        = ceph_sync_fs,
        .put_super      = ceph_put_super,
        .show_options   = ceph_show_options,
index ef4ac38bb614a911680668fe52f6e7fa272d94ce..8de94b564d670d28a033d6ccfc309a37f799ab57 100644 (file)
@@ -691,6 +691,7 @@ extern const struct inode_operations ceph_file_iops;
 
 extern struct inode *ceph_alloc_inode(struct super_block *sb);
 extern void ceph_destroy_inode(struct inode *inode);
+extern int ceph_drop_inode(struct inode *inode);
 
 extern struct inode *ceph_get_inode(struct super_block *sb,
                                    struct ceph_vino vino);
index aa3397620342d20beba92abc732845273d3663ca..2c29db6a247e4788256461100bed11ac79648d26 100644 (file)
@@ -477,9 +477,10 @@ extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon,
                        const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
 extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
 extern bool CIFSCouldBeMFSymlink(const struct cifs_fattr *fattr);
-extern int CIFSCheckMFSymlink(struct cifs_fattr *fattr,
-               const unsigned char *path,
-               struct cifs_sb_info *cifs_sb, unsigned int xid);
+extern int CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon,
+                             struct cifs_sb_info *cifs_sb,
+                             struct cifs_fattr *fattr,
+                             const unsigned char *path);
 extern int mdfour(unsigned char *, unsigned char *, int);
 extern int E_md4hash(const unsigned char *passwd, unsigned char *p16,
                        const struct nls_table *codepage);
index 124aa0230c1b8738edb8d04ca5d764f0a6cc5b12..d707edb6b852695f0de3993c9ef9cd12a3f909f3 100644 (file)
@@ -4010,7 +4010,7 @@ QFileInfoRetry:
        rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
                         (struct smb_hdr *) pSMBr, &bytes_returned, 0);
        if (rc) {
-               cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc);
+               cifs_dbg(FYI, "Send error in QFileInfo = %d", rc);
        } else {                /* decode response */
                rc = validate_t2((struct smb_t2_rsp *)pSMBr);
 
@@ -4179,7 +4179,7 @@ UnixQFileInfoRetry:
        rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
                         (struct smb_hdr *) pSMBr, &bytes_returned, 0);
        if (rc) {
-               cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc);
+               cifs_dbg(FYI, "Send error in UnixQFileInfo = %d", rc);
        } else {                /* decode response */
                rc = validate_t2((struct smb_t2_rsp *)pSMBr);
 
@@ -4263,7 +4263,7 @@ UnixQPathInfoRetry:
        rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
                         (struct smb_hdr *) pSMBr, &bytes_returned, 0);
        if (rc) {
-               cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc);
+               cifs_dbg(FYI, "Send error in UnixQPathInfo = %d", rc);
        } else {                /* decode response */
                rc = validate_t2((struct smb_t2_rsp *)pSMBr);
 
index 36f9ebb93ceba676c363cdf7b973f3936a9dde8f..49719b8228e58bd44b373fd4b39d844be9e2043b 100644 (file)
@@ -383,7 +383,8 @@ int cifs_get_inode_info_unix(struct inode **pinode,
 
        /* check for Minshall+French symlinks */
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) {
-               int tmprc = CIFSCheckMFSymlink(&fattr, full_path, cifs_sb, xid);
+               int tmprc = CIFSCheckMFSymlink(xid, tcon, cifs_sb, &fattr,
+                                              full_path);
                if (tmprc)
                        cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc);
        }
@@ -799,7 +800,8 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
 
        /* check for Minshall+French symlinks */
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) {
-               tmprc = CIFSCheckMFSymlink(&fattr, full_path, cifs_sb, xid);
+               tmprc = CIFSCheckMFSymlink(xid, tcon, cifs_sb, &fattr,
+                                          full_path);
                if (tmprc)
                        cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc);
        }
index cc0234710ddbb780cae5037b717a93d8a7d3d54d..92aee08483a52e100011fb05e1fcfc5255b340ac 100644 (file)
@@ -354,34 +354,30 @@ open_query_close_cifs_symlink(const unsigned char *path, char *pbuf,
 
 
 int
-CIFSCheckMFSymlink(struct cifs_fattr *fattr,
-                  const unsigned char *path,
-                  struct cifs_sb_info *cifs_sb, unsigned int xid)
+CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon,
+                  struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
+                  const unsigned char *path)
 {
-       int rc = 0;
+       int rc;
        u8 *buf = NULL;
        unsigned int link_len = 0;
        unsigned int bytes_read = 0;
-       struct cifs_tcon *ptcon;
 
        if (!CIFSCouldBeMFSymlink(fattr))
                /* it's not a symlink */
                return 0;
 
        buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL);
-       if (!buf) {
-               rc = -ENOMEM;
-               goto out;
-       }
+       if (!buf)
+               return -ENOMEM;
 
-       ptcon = tlink_tcon(cifs_sb_tlink(cifs_sb));
-       if ((ptcon->ses) && (ptcon->ses->server->ops->query_mf_symlink))
-               rc = ptcon->ses->server->ops->query_mf_symlink(path, buf,
-                                                &bytes_read, cifs_sb, xid);
+       if (tcon->ses->server->ops->query_mf_symlink)
+               rc = tcon->ses->server->ops->query_mf_symlink(path, buf,
+                                               &bytes_read, cifs_sb, xid);
        else
-               goto out;
+               rc = -ENOSYS;
 
-       if (rc != 0)
+       if (rc)
                goto out;
 
        if (bytes_read == 0) /* not a symlink */
index 288534920fe5cc4960f99ae636777344c5d42db6..20d6697bd6386560a679dda5e8b8592a65d63798 100644 (file)
@@ -1493,6 +1493,7 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type,
                                sb->s_blocksize - offset : towrite;
 
                tmp_bh.b_state = 0;
+               tmp_bh.b_size = sb->s_blocksize;
                err = ext2_get_block(inode, blk, &tmp_bh, 1);
                if (err < 0)
                        goto out;
index 17ac112ab1012bd88ff32d145f27a29f025efdde..3fe29de832c825e390b8d59d818b5ec37a8eb61f 100644 (file)
@@ -259,6 +259,15 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
                if (WARN_ON_ONCE(err)) {
                        ext4_journal_abort_handle(where, line, __func__, bh,
                                                  handle, err);
+                       ext4_error_inode(inode, where, line,
+                                        bh->b_blocknr,
+                                        "journal_dirty_metadata failed: "
+                                        "handle type %u started at line %u, "
+                                        "credits %u/%u, errcode %d",
+                                        handle->h_type,
+                                        handle->h_line_no,
+                                        handle->h_requested_credits,
+                                        handle->h_buffer_credits, err);
                }
        } else {
                if (inode)
index 35f65cf4f318d72bce4e79995ddbc85d0e4bbfa3..267c9fb53bf9f0bdbf07d779c6880cb936c8c3fa 100644 (file)
@@ -360,8 +360,10 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)
 {
        ext4_fsblk_t block = ext4_ext_pblock(ext);
        int len = ext4_ext_get_actual_len(ext);
+       ext4_lblk_t lblock = le32_to_cpu(ext->ee_block);
+       ext4_lblk_t last = lblock + len - 1;
 
-       if (len == 0)
+       if (lblock > last)
                return 0;
        return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);
 }
@@ -387,11 +389,26 @@ static int ext4_valid_extent_entries(struct inode *inode,
        if (depth == 0) {
                /* leaf entries */
                struct ext4_extent *ext = EXT_FIRST_EXTENT(eh);
+               struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
+               ext4_fsblk_t pblock = 0;
+               ext4_lblk_t lblock = 0;
+               ext4_lblk_t prev = 0;
+               int len = 0;
                while (entries) {
                        if (!ext4_valid_extent(inode, ext))
                                return 0;
+
+                       /* Check for overlapping extents */
+                       lblock = le32_to_cpu(ext->ee_block);
+                       len = ext4_ext_get_actual_len(ext);
+                       if ((lblock <= prev) && prev) {
+                               pblock = ext4_ext_pblock(ext);
+                               es->s_last_error_block = cpu_to_le64(pblock);
+                               return 0;
+                       }
                        ext++;
                        entries--;
+                       prev = lblock + len - 1;
                }
        } else {
                struct ext4_extent_idx *ext_idx = EXT_FIRST_INDEX(eh);
index 0757634741187a568cc2255187bcd2cf250d852b..bd47404c4eae04e8c776bb67a451098da331b429 100644 (file)
@@ -3513,11 +3513,6 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
        if (!S_ISREG(inode->i_mode))
                return -EOPNOTSUPP;
 
-       if (EXT4_SB(sb)->s_cluster_ratio > 1) {
-               /* TODO: Add support for bigalloc file systems */
-               return -EOPNOTSUPP;
-       }
-
        trace_ext4_punch_hole(inode, offset, length);
 
        /*
@@ -4598,6 +4593,10 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
                        if (attr->ia_size > sbi->s_bitmap_maxbytes)
                                return -EFBIG;
                }
+
+               if (IS_I_VERSION(inode) && attr->ia_size != inode->i_size)
+                       inode_inc_iversion(inode);
+
                if (S_ISREG(inode->i_mode) &&
                    (attr->ia_size < inode->i_size)) {
                        if (ext4_should_order_data(inode)) {
index 4d113efa024c8439f4000a0fa59ed643f2489166..04766d9a29cd66dd74166a5c1243c2c29405382f 100644 (file)
@@ -3442,6 +3442,9 @@ static void ext4_mb_pa_callback(struct rcu_head *head)
 {
        struct ext4_prealloc_space *pa;
        pa = container_of(head, struct ext4_prealloc_space, u.pa_rcu);
+
+       BUG_ON(atomic_read(&pa->pa_count));
+       BUG_ON(pa->pa_deleted == 0);
        kmem_cache_free(ext4_pspace_cachep, pa);
 }
 
@@ -3455,11 +3458,13 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac,
        ext4_group_t grp;
        ext4_fsblk_t grp_blk;
 
-       if (!atomic_dec_and_test(&pa->pa_count) || pa->pa_free != 0)
-               return;
-
        /* in this short window concurrent discard can set pa_deleted */
        spin_lock(&pa->pa_lock);
+       if (!atomic_dec_and_test(&pa->pa_count) || pa->pa_free != 0) {
+               spin_unlock(&pa->pa_lock);
+               return;
+       }
+
        if (pa->pa_deleted == 1) {
                spin_unlock(&pa->pa_lock);
                return;
index c977f4e4e63be6c4cf3b477f628e4fc7d323d1f5..1f7784de05b6c6afad4d7437202ceb6efeec3399 100644 (file)
@@ -792,7 +792,7 @@ static void ext4_put_super(struct super_block *sb)
        }
 
        ext4_es_unregister_shrinker(sbi);
-       del_timer(&sbi->s_err_report);
+       del_timer_sync(&sbi->s_err_report);
        ext4_release_system_zone(sb);
        ext4_mb_release(sb);
        ext4_ext_release(sb);
@@ -3316,10 +3316,18 @@ int ext4_calculate_overhead(struct super_block *sb)
 }
 
 
-static ext4_fsblk_t ext4_calculate_resv_clusters(struct ext4_sb_info *sbi)
+static ext4_fsblk_t ext4_calculate_resv_clusters(struct super_block *sb)
 {
        ext4_fsblk_t resv_clusters;
 
+       /*
+        * There's no need to reserve anything when we aren't using extents.
+        * The space estimates are exact, there are no unwritten extents,
+        * hole punching doesn't need new metadata... This is needed especially
+        * to keep ext2/3 backward compatibility.
+        */
+       if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
+               return 0;
        /*
         * By default we reserve 2% or 4096 clusters, whichever is smaller.
         * This should cover the situations where we can not afford to run
@@ -3328,7 +3336,8 @@ static ext4_fsblk_t ext4_calculate_resv_clusters(struct ext4_sb_info *sbi)
         * allocation would require 1, or 2 blocks, higher numbers are
         * very rare.
         */
-       resv_clusters = ext4_blocks_count(sbi->s_es) >> sbi->s_cluster_bits;
+       resv_clusters = ext4_blocks_count(EXT4_SB(sb)->s_es) >>
+                       EXT4_SB(sb)->s_cluster_bits;
 
        do_div(resv_clusters, 50);
        resv_clusters = min_t(ext4_fsblk_t, resv_clusters, 4096);
@@ -4071,10 +4080,10 @@ no_journal:
                         "available");
        }
 
-       err = ext4_reserve_clusters(sbi, ext4_calculate_resv_clusters(sbi));
+       err = ext4_reserve_clusters(sbi, ext4_calculate_resv_clusters(sb));
        if (err) {
                ext4_msg(sb, KERN_ERR, "failed to reserve %llu clusters for "
-                        "reserved pool", ext4_calculate_resv_clusters(sbi));
+                        "reserved pool", ext4_calculate_resv_clusters(sb));
                goto failed_mount4a;
        }
 
@@ -4184,7 +4193,7 @@ failed_mount_wq:
        }
 failed_mount3:
        ext4_es_unregister_shrinker(sbi);
-       del_timer(&sbi->s_err_report);
+       del_timer_sync(&sbi->s_err_report);
        if (sbi->s_flex_groups)
                ext4_kvfree(sbi->s_flex_groups);
        percpu_counter_destroy(&sbi->s_freeclusters_counter);
index 5716e5eb4e8ec7ab2c63c69079259e2c5d772918..38f4a2245085ae5615918c240f39f0b8bd5e5acd 100644 (file)
@@ -61,7 +61,8 @@ repeat:
        if (PageUptodate(page))
                goto out;
 
-       if (f2fs_readpage(sbi, page, index, READ_SYNC))
+       if (f2fs_submit_page_bio(sbi, page, index,
+                               READ_SYNC | REQ_META | REQ_PRIO))
                goto repeat;
 
        lock_page(page);
@@ -157,7 +158,8 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
        }
 
        if (nwritten)
-               f2fs_submit_bio(sbi, type, nr_to_write == LONG_MAX);
+               f2fs_submit_merged_bio(sbi, type, nr_to_write == LONG_MAX,
+                                                               WRITE);
 
        return nwritten;
 }
@@ -190,12 +192,13 @@ int acquire_orphan_inode(struct f2fs_sb_info *sbi)
        int err = 0;
 
        /*
-        * considering 512 blocks in a segment 5 blocks are needed for cp
+        * considering 512 blocks in a segment 8 blocks are needed for cp
         * and log segment summaries. Remaining blocks are used to keep
         * orphan entries with the limitation one reserved segment
-        * for cp pack we can have max 1020*507 orphan entries
+        * for cp pack we can have max 1020*504 orphan entries
         */
-       max_orphans = (sbi->blocks_per_seg - 5) * F2FS_ORPHANS_PER_BLOCK;
+       max_orphans = (sbi->blocks_per_seg - 2 - NR_CURSEG_TYPE)
+                               * F2FS_ORPHANS_PER_BLOCK;
        mutex_lock(&sbi->orphan_inode_mutex);
        if (sbi->n_orphans >= max_orphans)
                err = -ENOSPC;
@@ -270,12 +273,12 @@ static void recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
        iput(inode);
 }
 
-int recover_orphan_inodes(struct f2fs_sb_info *sbi)
+void recover_orphan_inodes(struct f2fs_sb_info *sbi)
 {
        block_t start_blk, orphan_blkaddr, i, j;
 
        if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ORPHAN_PRESENT_FLAG))
-               return 0;
+               return;
 
        sbi->por_doing = true;
        start_blk = __start_cp_addr(sbi) + 1;
@@ -295,17 +298,18 @@ int recover_orphan_inodes(struct f2fs_sb_info *sbi)
        /* clear Orphan Flag */
        clear_ckpt_flags(F2FS_CKPT(sbi), CP_ORPHAN_PRESENT_FLAG);
        sbi->por_doing = false;
-       return 0;
+       return;
 }
 
 static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk)
 {
-       struct list_head *head, *this, *next;
+       struct list_head *head;
        struct f2fs_orphan_block *orphan_blk = NULL;
        struct page *page = NULL;
        unsigned int nentries = 0;
        unsigned short index = 1;
        unsigned short orphan_blocks;
+       struct orphan_inode_entry *orphan = NULL;
 
        orphan_blocks = (unsigned short)((sbi->n_orphans +
                (F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
@@ -314,10 +318,15 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk)
        head = &sbi->orphan_inode_list;
 
        /* loop for each orphan inode entry and write them in Jornal block */
-       list_for_each_safe(this, next, head) {
-               struct orphan_inode_entry *orphan;
+       list_for_each_entry(orphan, head, list) {
+               if (!page) {
+                       page = grab_meta_page(sbi, start_blk);
+                       orphan_blk =
+                               (struct f2fs_orphan_block *)page_address(page);
+                       memset(orphan_blk, 0, sizeof(*orphan_blk));
+               }
 
-               orphan = list_entry(this, struct orphan_inode_entry, list);
+               orphan_blk->ino[nentries++] = cpu_to_le32(orphan->ino);
 
                if (nentries == F2FS_ORPHANS_PER_BLOCK) {
                        /*
@@ -335,24 +344,16 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk)
                        nentries = 0;
                        page = NULL;
                }
-               if (page)
-                       goto page_exist;
+       }
 
-               page = grab_meta_page(sbi, start_blk);
-               orphan_blk = (struct f2fs_orphan_block *)page_address(page);
-               memset(orphan_blk, 0, sizeof(*orphan_blk));
-page_exist:
-               orphan_blk->ino[nentries++] = cpu_to_le32(orphan->ino);
+       if (page) {
+               orphan_blk->blk_addr = cpu_to_le16(index);
+               orphan_blk->blk_count = cpu_to_le16(orphan_blocks);
+               orphan_blk->entry_count = cpu_to_le32(nentries);
+               set_page_dirty(page);
+               f2fs_put_page(page, 1);
        }
-       if (!page)
-               goto end;
-
-       orphan_blk->blk_addr = cpu_to_le16(index);
-       orphan_blk->blk_count = cpu_to_le16(orphan_blocks);
-       orphan_blk->entry_count = cpu_to_le32(nentries);
-       set_page_dirty(page);
-       f2fs_put_page(page, 1);
-end:
+
        mutex_unlock(&sbi->orphan_inode_mutex);
 }
 
@@ -428,7 +429,8 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
        cp1 = validate_checkpoint(sbi, cp_start_blk_no, &cp1_version);
 
        /* The second checkpoint pack should start at the next segment */
-       cp_start_blk_no += 1 << le32_to_cpu(fsb->log_blocks_per_seg);
+       cp_start_blk_no += ((unsigned long long)1) <<
+                               le32_to_cpu(fsb->log_blocks_per_seg);
        cp2 = validate_checkpoint(sbi, cp_start_blk_no, &cp2_version);
 
        if (cp1 && cp2) {
@@ -513,8 +515,8 @@ void add_dirty_dir_inode(struct inode *inode)
 void remove_dirty_dir_inode(struct inode *inode)
 {
        struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
-       struct list_head *head = &sbi->dir_inode_list;
-       struct list_head *this;
+
+       struct list_head *this, *head;
 
        if (!S_ISDIR(inode->i_mode))
                return;
@@ -525,6 +527,7 @@ void remove_dirty_dir_inode(struct inode *inode)
                return;
        }
 
+       head = &sbi->dir_inode_list;
        list_for_each(this, head) {
                struct dir_inode_entry *entry;
                entry = list_entry(this, struct dir_inode_entry, list);
@@ -546,11 +549,13 @@ void remove_dirty_dir_inode(struct inode *inode)
 
 struct inode *check_dirty_dir_inode(struct f2fs_sb_info *sbi, nid_t ino)
 {
-       struct list_head *head = &sbi->dir_inode_list;
-       struct list_head *this;
+
+       struct list_head *this, *head;
        struct inode *inode = NULL;
 
        spin_lock(&sbi->dir_inode_lock);
+
+       head = &sbi->dir_inode_list;
        list_for_each(this, head) {
                struct dir_inode_entry *entry;
                entry = list_entry(this, struct dir_inode_entry, list);
@@ -565,11 +570,13 @@ struct inode *check_dirty_dir_inode(struct f2fs_sb_info *sbi, nid_t ino)
 
 void sync_dirty_dir_inodes(struct f2fs_sb_info *sbi)
 {
-       struct list_head *head = &sbi->dir_inode_list;
+       struct list_head *head;
        struct dir_inode_entry *entry;
        struct inode *inode;
 retry:
        spin_lock(&sbi->dir_inode_lock);
+
+       head = &sbi->dir_inode_list;
        if (list_empty(head)) {
                spin_unlock(&sbi->dir_inode_lock);
                return;
@@ -585,7 +592,7 @@ retry:
                 * We should submit bio, since it exists several
                 * wribacking dentry pages in the freeing inode.
                 */
-               f2fs_submit_bio(sbi, DATA, true);
+               f2fs_submit_merged_bio(sbi, DATA, true, WRITE);
        }
        goto retry;
 }
@@ -791,9 +798,9 @@ void write_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
 
        trace_f2fs_write_checkpoint(sbi->sb, is_umount, "finish block_ops");
 
-       f2fs_submit_bio(sbi, DATA, true);
-       f2fs_submit_bio(sbi, NODE, true);
-       f2fs_submit_bio(sbi, META, true);
+       f2fs_submit_merged_bio(sbi, DATA, true, WRITE);
+       f2fs_submit_merged_bio(sbi, NODE, true, WRITE);
+       f2fs_submit_merged_bio(sbi, META, true, WRITE);
 
        /*
         * update checkpoint pack index
index aa3438c571fa9a2dfaf3e1ab61bd4328f580b0d6..4e2fc09f0e4f3591b92f88a4b39c8265ec4659ac 100644 (file)
 #include "segment.h"
 #include <trace/events/f2fs.h>
 
+/*
+ * Low-level block read/write IO operations.
+ */
+static struct bio *__bio_alloc(struct block_device *bdev, int npages)
+{
+       struct bio *bio;
+
+       /* No failure on bio allocation */
+       bio = bio_alloc(GFP_NOIO, npages);
+       bio->bi_bdev = bdev;
+       bio->bi_private = NULL;
+       return bio;
+}
+
+static void f2fs_read_end_io(struct bio *bio, int err)
+{
+       const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+       struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
+
+       do {
+               struct page *page = bvec->bv_page;
+
+               if (--bvec >= bio->bi_io_vec)
+                       prefetchw(&bvec->bv_page->flags);
+
+               if (uptodate) {
+                       SetPageUptodate(page);
+               } else {
+                       ClearPageUptodate(page);
+                       SetPageError(page);
+               }
+               unlock_page(page);
+       } while (bvec >= bio->bi_io_vec);
+
+       bio_put(bio);
+}
+
+static void f2fs_write_end_io(struct bio *bio, int err)
+{
+       const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+       struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
+       struct f2fs_sb_info *sbi = F2FS_SB(bvec->bv_page->mapping->host->i_sb);
+
+       do {
+               struct page *page = bvec->bv_page;
+
+               if (--bvec >= bio->bi_io_vec)
+                       prefetchw(&bvec->bv_page->flags);
+
+               if (!uptodate) {
+                       SetPageError(page);
+                       set_bit(AS_EIO, &page->mapping->flags);
+                       set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG);
+                       sbi->sb->s_flags |= MS_RDONLY;
+               }
+               end_page_writeback(page);
+               dec_page_count(sbi, F2FS_WRITEBACK);
+       } while (bvec >= bio->bi_io_vec);
+
+       if (bio->bi_private)
+               complete(bio->bi_private);
+
+       if (!get_pages(sbi, F2FS_WRITEBACK) &&
+                       !list_empty(&sbi->cp_wait.task_list))
+               wake_up(&sbi->cp_wait);
+
+       bio_put(bio);
+}
+
+static void __submit_merged_bio(struct f2fs_sb_info *sbi,
+                               struct f2fs_bio_info *io,
+                               enum page_type type, bool sync, int rw)
+{
+       enum page_type btype = PAGE_TYPE_OF_BIO(type);
+
+       if (!io->bio)
+               return;
+
+       if (btype == META)
+               rw |= REQ_META;
+
+       if (is_read_io(rw)) {
+               if (sync)
+                       rw |= READ_SYNC;
+               submit_bio(rw, io->bio);
+               trace_f2fs_submit_read_bio(sbi->sb, rw, type, io->bio);
+               io->bio = NULL;
+               return;
+       }
+
+       if (sync)
+               rw |= WRITE_SYNC;
+       if (type >= META_FLUSH)
+               rw |= WRITE_FLUSH_FUA;
+
+       /*
+        * META_FLUSH is only from the checkpoint procedure, and we should wait
+        * this metadata bio for FS consistency.
+        */
+       if (type == META_FLUSH) {
+               DECLARE_COMPLETION_ONSTACK(wait);
+               io->bio->bi_private = &wait;
+               submit_bio(rw, io->bio);
+               wait_for_completion(&wait);
+       } else {
+               submit_bio(rw, io->bio);
+       }
+       trace_f2fs_submit_write_bio(sbi->sb, rw, btype, io->bio);
+       io->bio = NULL;
+}
+
+void f2fs_submit_merged_bio(struct f2fs_sb_info *sbi,
+                               enum page_type type, bool sync, int rw)
+{
+       enum page_type btype = PAGE_TYPE_OF_BIO(type);
+       struct f2fs_bio_info *io;
+
+       io = is_read_io(rw) ? &sbi->read_io : &sbi->write_io[btype];
+
+       mutex_lock(&io->io_mutex);
+       __submit_merged_bio(sbi, io, type, sync, rw);
+       mutex_unlock(&io->io_mutex);
+}
+
+/*
+ * Fill the locked page with data located in the block address.
+ * Return unlocked page.
+ */
+int f2fs_submit_page_bio(struct f2fs_sb_info *sbi, struct page *page,
+                                       block_t blk_addr, int rw)
+{
+       struct block_device *bdev = sbi->sb->s_bdev;
+       struct bio *bio;
+
+       trace_f2fs_submit_page_bio(page, blk_addr, rw);
+
+       /* Allocate a new bio */
+       bio = __bio_alloc(bdev, 1);
+
+       /* Initialize the bio */
+       bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
+       bio->bi_end_io = is_read_io(rw) ? f2fs_read_end_io : f2fs_write_end_io;
+
+       if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) {
+               bio_put(bio);
+               f2fs_put_page(page, 1);
+               return -EFAULT;
+       }
+
+       submit_bio(rw, bio);
+       return 0;
+}
+
+void f2fs_submit_page_mbio(struct f2fs_sb_info *sbi, struct page *page,
+                       block_t blk_addr, enum page_type type, int rw)
+{
+       enum page_type btype = PAGE_TYPE_OF_BIO(type);
+       struct block_device *bdev = sbi->sb->s_bdev;
+       struct f2fs_bio_info *io;
+       int bio_blocks;
+
+       io = is_read_io(rw) ? &sbi->read_io : &sbi->write_io[btype];
+
+       verify_block_addr(sbi, blk_addr);
+
+       mutex_lock(&io->io_mutex);
+
+       if (!is_read_io(rw))
+               inc_page_count(sbi, F2FS_WRITEBACK);
+
+       if (io->bio && io->last_block_in_bio != blk_addr - 1)
+               __submit_merged_bio(sbi, io, type, true, rw);
+alloc_new:
+       if (io->bio == NULL) {
+               bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
+               io->bio = __bio_alloc(bdev, bio_blocks);
+               io->bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
+               io->bio->bi_end_io = is_read_io(rw) ? f2fs_read_end_io :
+                                                       f2fs_write_end_io;
+               /*
+                * The end_io will be assigned at the sumbission phase.
+                * Until then, let bio_add_page() merge consecutive IOs as much
+                * as possible.
+                */
+       }
+
+       if (bio_add_page(io->bio, page, PAGE_CACHE_SIZE, 0) <
+                                                       PAGE_CACHE_SIZE) {
+               __submit_merged_bio(sbi, io, type, true, rw);
+               goto alloc_new;
+       }
+
+       io->last_block_in_bio = blk_addr;
+
+       mutex_unlock(&io->io_mutex);
+       trace_f2fs_submit_page_mbio(page, rw, type, blk_addr);
+}
+
 /*
  * Lock ordering for the change of data block address:
  * ->data_page
@@ -64,6 +262,22 @@ int reserve_new_block(struct dnode_of_data *dn)
        return 0;
 }
 
+int f2fs_reserve_block(struct dnode_of_data *dn, pgoff_t index)
+{
+       bool need_put = dn->inode_page ? false : true;
+       int err;
+
+       err = get_dnode_of_data(dn, index, ALLOC_NODE);
+       if (err)
+               return err;
+       if (dn->data_blkaddr == NULL_ADDR)
+               err = reserve_new_block(dn);
+
+       if (need_put)
+               f2fs_put_dnode(dn);
+       return err;
+}
+
 static int check_extent_cache(struct inode *inode, pgoff_t pgofs,
                                        struct buffer_head *bh_result)
 {
@@ -71,6 +285,9 @@ static int check_extent_cache(struct inode *inode, pgoff_t pgofs,
        pgoff_t start_fofs, end_fofs;
        block_t start_blkaddr;
 
+       if (is_inode_flag_set(fi, FI_NO_EXTENT))
+               return 0;
+
        read_lock(&fi->ext.ext_lock);
        if (fi->ext.len == 0) {
                read_unlock(&fi->ext.ext_lock);
@@ -109,6 +326,7 @@ void update_extent_cache(block_t blk_addr, struct dnode_of_data *dn)
        struct f2fs_inode_info *fi = F2FS_I(dn->inode);
        pgoff_t fofs, start_fofs, end_fofs;
        block_t start_blkaddr, end_blkaddr;
+       int need_update = true;
 
        f2fs_bug_on(blk_addr == NEW_ADDR);
        fofs = start_bidx_of_node(ofs_of_node(dn->node_page), fi) +
@@ -117,6 +335,9 @@ void update_extent_cache(block_t blk_addr, struct dnode_of_data *dn)
        /* Update the page address in the parent node */
        __set_data_blkaddr(dn, blk_addr);
 
+       if (is_inode_flag_set(fi, FI_NO_EXTENT))
+               return;
+
        write_lock(&fi->ext.ext_lock);
 
        start_fofs = fi->ext.fofs;
@@ -163,14 +384,21 @@ void update_extent_cache(block_t blk_addr, struct dnode_of_data *dn)
                                        fofs - start_fofs + 1;
                        fi->ext.len -= fofs - start_fofs + 1;
                }
-               goto end_update;
+       } else {
+               need_update = false;
        }
-       write_unlock(&fi->ext.ext_lock);
-       return;
 
+       /* Finally, if the extent is very fragmented, let's drop the cache. */
+       if (fi->ext.len < F2FS_MIN_EXTENT_LEN) {
+               fi->ext.len = 0;
+               set_inode_flag(fi, FI_NO_EXTENT);
+               need_update = true;
+       }
 end_update:
        write_unlock(&fi->ext.ext_lock);
-       sync_inode_page(dn);
+       if (need_update)
+               sync_inode_page(dn);
+       return;
 }
 
 struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
@@ -208,8 +436,11 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
                return page;
        }
 
-       err = f2fs_readpage(sbi, page, dn.data_blkaddr,
+       err = f2fs_submit_page_bio(sbi, page, dn.data_blkaddr,
                                        sync ? READ_SYNC : READA);
+       if (err)
+               return ERR_PTR(err);
+
        if (sync) {
                wait_on_page_locked(page);
                if (!PageUptodate(page)) {
@@ -266,7 +497,7 @@ repeat:
                return page;
        }
 
-       err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC);
+       err = f2fs_submit_page_bio(sbi, page, dn.data_blkaddr, READ_SYNC);
        if (err)
                return ERR_PTR(err);
 
@@ -300,19 +531,10 @@ struct page *get_new_data_page(struct inode *inode,
        int err;
 
        set_new_dnode(&dn, inode, npage, npage, 0);
-       err = get_dnode_of_data(&dn, index, ALLOC_NODE);
+       err = f2fs_reserve_block(&dn, index);
        if (err)
                return ERR_PTR(err);
 
-       if (dn.data_blkaddr == NULL_ADDR) {
-               if (reserve_new_block(&dn)) {
-                       if (!npage)
-                               f2fs_put_dnode(&dn);
-                       return ERR_PTR(-ENOSPC);
-               }
-       }
-       if (!npage)
-               f2fs_put_dnode(&dn);
 repeat:
        page = grab_cache_page(mapping, index);
        if (!page)
@@ -325,7 +547,8 @@ repeat:
                zero_user_segment(page, 0, PAGE_CACHE_SIZE);
                SetPageUptodate(page);
        } else {
-               err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC);
+               err = f2fs_submit_page_bio(sbi, page, dn.data_blkaddr,
+                                                               READ_SYNC);
                if (err)
                        return ERR_PTR(err);
                lock_page(page);
@@ -349,61 +572,6 @@ repeat:
        return page;
 }
 
-static void read_end_io(struct bio *bio, int err)
-{
-       const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
-       struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
-
-       do {
-               struct page *page = bvec->bv_page;
-
-               if (--bvec >= bio->bi_io_vec)
-                       prefetchw(&bvec->bv_page->flags);
-
-               if (uptodate) {
-                       SetPageUptodate(page);
-               } else {
-                       ClearPageUptodate(page);
-                       SetPageError(page);
-               }
-               unlock_page(page);
-       } while (bvec >= bio->bi_io_vec);
-       bio_put(bio);
-}
-
-/*
- * Fill the locked page with data located in the block address.
- * Return unlocked page.
- */
-int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page,
-                                       block_t blk_addr, int type)
-{
-       struct block_device *bdev = sbi->sb->s_bdev;
-       struct bio *bio;
-
-       trace_f2fs_readpage(page, blk_addr, type);
-
-       down_read(&sbi->bio_sem);
-
-       /* Allocate a new bio */
-       bio = f2fs_bio_alloc(bdev, 1);
-
-       /* Initialize the bio */
-       bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
-       bio->bi_end_io = read_end_io;
-
-       if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) {
-               bio_put(bio);
-               up_read(&sbi->bio_sem);
-               f2fs_put_page(page, 1);
-               return -EFAULT;
-       }
-
-       submit_bio(type, bio);
-       up_read(&sbi->bio_sem);
-       return 0;
-}
-
 /*
  * This function should be used by the data read flow only where it
  * does not check the "create" flag that indicates block allocation.
@@ -455,7 +623,7 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock,
                                != (dn.data_blkaddr + i)) || maxblocks == i)
                                break;
                map_bh(bh_result, inode->i_sb, dn.data_blkaddr);
-               bh_result->b_size = (i << blkbits);
+               bh_result->b_size = (((size_t)i) << blkbits);
        }
        f2fs_put_dnode(&dn);
        trace_f2fs_get_data_block(inode, iblock, bh_result, 0);
@@ -565,7 +733,7 @@ write:
                goto redirty_out;
 
        if (wbc->for_reclaim)
-               f2fs_submit_bio(sbi, DATA, true);
+               f2fs_submit_merged_bio(sbi, DATA, true, WRITE);
 
        clear_cold_data(page);
 out:
@@ -617,7 +785,7 @@ static int f2fs_write_data_pages(struct address_space *mapping,
        ret = write_cache_pages(mapping, wbc, __f2fs_writepage, mapping);
        if (locked)
                mutex_unlock(&sbi->writepages);
-       f2fs_submit_bio(sbi, DATA, (wbc->sync_mode == WB_SYNC_ALL));
+       f2fs_submit_merged_bio(sbi, DATA, wbc->sync_mode == WB_SYNC_ALL, WRITE);
 
        remove_dirty_dir_inode(inode);
 
@@ -644,21 +812,15 @@ repeat:
        *pagep = page;
 
        f2fs_lock_op(sbi);
-
        set_new_dnode(&dn, inode, NULL, NULL, 0);
-       err = get_dnode_of_data(&dn, index, ALLOC_NODE);
-       if (err)
-               goto err;
-
-       if (dn.data_blkaddr == NULL_ADDR)
-               err = reserve_new_block(&dn);
-
-       f2fs_put_dnode(&dn);
-       if (err)
-               goto err;
-
+       err = f2fs_reserve_block(&dn, index);
        f2fs_unlock_op(sbi);
 
+       if (err) {
+               f2fs_put_page(page, 1);
+               return err;
+       }
+
        if ((len == PAGE_CACHE_SIZE) || PageUptodate(page))
                return 0;
 
@@ -674,7 +836,8 @@ repeat:
        if (dn.data_blkaddr == NEW_ADDR) {
                zero_user_segment(page, 0, PAGE_CACHE_SIZE);
        } else {
-               err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC);
+               err = f2fs_submit_page_bio(sbi, page, dn.data_blkaddr,
+                                                       READ_SYNC);
                if (err)
                        return err;
                lock_page(page);
@@ -691,11 +854,6 @@ out:
        SetPageUptodate(page);
        clear_cold_data(page);
        return 0;
-
-err:
-       f2fs_unlock_op(sbi);
-       f2fs_put_page(page, 1);
-       return err;
 }
 
 static int f2fs_write_end(struct file *file,
@@ -714,8 +872,7 @@ static int f2fs_write_end(struct file *file,
                update_inode_page(inode);
        }
 
-       unlock_page(page);
-       page_cache_release(page);
+       f2fs_put_page(page, 1);
        return copied;
 }
 
index a84b0a8e6854cd6e2faba8a84124d350378343f1..61adbcbe9b87cda2b20c0e698dc509163ee8b226 100644 (file)
@@ -24,7 +24,7 @@
 #include "gc.h"
 
 static LIST_HEAD(f2fs_stat_list);
-static struct dentry *debugfs_root;
+static struct dentry *f2fs_debugfs_root;
 static DEFINE_MUTEX(f2fs_stat_mutex);
 
 static void update_general_status(struct f2fs_sb_info *sbi)
@@ -340,14 +340,32 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi)
 
 void __init f2fs_create_root_stats(void)
 {
-       debugfs_root = debugfs_create_dir("f2fs", NULL);
-       if (debugfs_root)
-               debugfs_create_file("status", S_IRUGO, debugfs_root,
-                                        NULL, &stat_fops);
+       struct dentry *file;
+
+       f2fs_debugfs_root = debugfs_create_dir("f2fs", NULL);
+       if (!f2fs_debugfs_root)
+               goto bail;
+
+       file = debugfs_create_file("status", S_IRUGO, f2fs_debugfs_root,
+                       NULL, &stat_fops);
+       if (!file)
+               goto free_debugfs_dir;
+
+       return;
+
+free_debugfs_dir:
+       debugfs_remove(f2fs_debugfs_root);
+
+bail:
+       f2fs_debugfs_root = NULL;
+       return;
 }
 
 void f2fs_destroy_root_stats(void)
 {
-       debugfs_remove_recursive(debugfs_root);
-       debugfs_root = NULL;
+       if (!f2fs_debugfs_root)
+               return;
+
+       debugfs_remove_recursive(f2fs_debugfs_root);
+       f2fs_debugfs_root = NULL;
 }
index 89dc7508faf2edf173441a9e25cad8a9ff4856aa..10eca022e1e129f8b71ca607d1059e065c34d07e 100644 (file)
 
 #ifdef CONFIG_F2FS_CHECK_FS
 #define f2fs_bug_on(condition) BUG_ON(condition)
+#define f2fs_down_write(x, y)  down_write_nest_lock(x, y)
 #else
 #define f2fs_bug_on(condition)
+#define f2fs_down_write(x, y)  down_write(x)
 #endif
 
 /*
@@ -37,6 +39,7 @@
 #define F2FS_MOUNT_POSIX_ACL           0x00000020
 #define F2FS_MOUNT_DISABLE_EXT_IDENTIFY        0x00000040
 #define F2FS_MOUNT_INLINE_XATTR                0x00000080
+#define F2FS_MOUNT_INLINE_DATA         0x00000100
 
 #define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
 #define set_opt(sbi, option)   (sbi->mount_opt.opt |= F2FS_MOUNT_##option)
@@ -97,6 +100,13 @@ struct dir_inode_entry {
        struct inode *inode;    /* vfs inode pointer */
 };
 
+/* for the list of blockaddresses to be discarded */
+struct discard_entry {
+       struct list_head list;  /* list head */
+       block_t blkaddr;        /* block address to be discarded */
+       int len;                /* # of consecutive blocks of the discard */
+};
+
 /* for the list of fsync inodes, used only during recovery */
 struct fsync_inode_entry {
        struct list_head list;  /* list head */
@@ -162,6 +172,8 @@ enum {
 #define F2FS_LINK_MAX          32000   /* maximum link count per file */
 
 /* for in-memory extent cache entry */
+#define F2FS_MIN_EXTENT_LEN    16      /* minimum extent length */
+
 struct extent_info {
        rwlock_t ext_lock;      /* rwlock for consistency */
        unsigned int fofs;      /* start offset in a file */
@@ -308,6 +320,11 @@ struct f2fs_sm_info {
 
        /* a threshold to reclaim prefree segments */
        unsigned int rec_prefree_segments;
+
+       /* for small discard management */
+       struct list_head discard_list;          /* 4KB discard list */
+       int nr_discards;                        /* # of discards in the list */
+       int max_discards;                       /* max. discards to be issued */
 };
 
 /*
@@ -338,6 +355,7 @@ enum count_type {
  *                     with waiting the bio's completion
  * ...                 Only can be used with META.
  */
+#define PAGE_TYPE_OF_BIO(type) ((type) > META ? META : (type))
 enum page_type {
        DATA,
        NODE,
@@ -346,6 +364,13 @@ enum page_type {
        META_FLUSH,
 };
 
+#define is_read_io(rw) (((rw) & 1) == READ)
+struct f2fs_bio_info {
+       struct bio *bio;                /* bios to merge */
+       sector_t last_block_in_bio;     /* last block number */
+       struct mutex io_mutex;          /* mutex for bio */
+};
+
 struct f2fs_sb_info {
        struct super_block *sb;                 /* pointer to VFS super block */
        struct proc_dir_entry *s_proc;          /* proc entry */
@@ -359,9 +384,10 @@ struct f2fs_sb_info {
 
        /* for segment-related operations */
        struct f2fs_sm_info *sm_info;           /* segment manager */
-       struct bio *bio[NR_PAGE_TYPE];          /* bios to merge */
-       sector_t last_block_in_bio[NR_PAGE_TYPE];       /* last block number */
-       struct rw_semaphore bio_sem;            /* IO semaphore */
+
+       /* for bio operations */
+       struct f2fs_bio_info read_io;                   /* for read bios */
+       struct f2fs_bio_info write_io[NR_PAGE_TYPE];    /* for write bios */
 
        /* for checkpoint */
        struct f2fs_checkpoint *ckpt;           /* raw checkpoint pointer */
@@ -534,7 +560,7 @@ static inline void f2fs_unlock_op(struct f2fs_sb_info *sbi)
 
 static inline void f2fs_lock_all(struct f2fs_sb_info *sbi)
 {
-       down_write_nest_lock(&sbi->cp_rwsem, &sbi->cp_mutex);
+       f2fs_down_write(&sbi->cp_rwsem, &sbi->cp_mutex);
 }
 
 static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi)
@@ -585,7 +611,7 @@ static inline bool inc_valid_block_count(struct f2fs_sb_info *sbi,
        return true;
 }
 
-static inline int dec_valid_block_count(struct f2fs_sb_info *sbi,
+static inline void dec_valid_block_count(struct f2fs_sb_info *sbi,
                                                struct inode *inode,
                                                blkcnt_t count)
 {
@@ -595,7 +621,6 @@ static inline int dec_valid_block_count(struct f2fs_sb_info *sbi,
        inode->i_blocks -= count;
        sbi->total_valid_block_count -= (block_t)count;
        spin_unlock(&sbi->stat_lock);
-       return 0;
 }
 
 static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type)
@@ -686,50 +711,48 @@ static inline block_t __start_sum_addr(struct f2fs_sb_info *sbi)
 }
 
 static inline bool inc_valid_node_count(struct f2fs_sb_info *sbi,
-                                               struct inode *inode,
-                                               unsigned int count)
+                                               struct inode *inode)
 {
        block_t valid_block_count;
        unsigned int valid_node_count;
 
        spin_lock(&sbi->stat_lock);
 
-       valid_block_count = sbi->total_valid_block_count + (block_t)count;
-       sbi->alloc_valid_block_count += (block_t)count;
-       valid_node_count = sbi->total_valid_node_count + count;
-
+       valid_block_count = sbi->total_valid_block_count + 1;
        if (valid_block_count > sbi->user_block_count) {
                spin_unlock(&sbi->stat_lock);
                return false;
        }
 
+       valid_node_count = sbi->total_valid_node_count + 1;
        if (valid_node_count > sbi->total_node_count) {
                spin_unlock(&sbi->stat_lock);
                return false;
        }
 
        if (inode)
-               inode->i_blocks += count;
-       sbi->total_valid_node_count = valid_node_count;
-       sbi->total_valid_block_count = valid_block_count;
+               inode->i_blocks++;
+
+       sbi->alloc_valid_block_count++;
+       sbi->total_valid_node_count++;
+       sbi->total_valid_block_count++;
        spin_unlock(&sbi->stat_lock);
 
        return true;
 }
 
 static inline void dec_valid_node_count(struct f2fs_sb_info *sbi,
-                                               struct inode *inode,
-                                               unsigned int count)
+                                               struct inode *inode)
 {
        spin_lock(&sbi->stat_lock);
 
-       f2fs_bug_on(sbi->total_valid_block_count < count);
-       f2fs_bug_on(sbi->total_valid_node_count < count);
-       f2fs_bug_on(inode->i_blocks < count);
+       f2fs_bug_on(!sbi->total_valid_block_count);
+       f2fs_bug_on(!sbi->total_valid_node_count);
+       f2fs_bug_on(!inode->i_blocks);
 
-       inode->i_blocks -= count;
-       sbi->total_valid_node_count -= count;
-       sbi->total_valid_block_count -= (block_t)count;
+       inode->i_blocks--;
+       sbi->total_valid_node_count--;
+       sbi->total_valid_block_count--;
 
        spin_unlock(&sbi->stat_lock);
 }
@@ -751,13 +774,12 @@ static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi)
        spin_unlock(&sbi->stat_lock);
 }
 
-static inline int dec_valid_inode_count(struct f2fs_sb_info *sbi)
+static inline void dec_valid_inode_count(struct f2fs_sb_info *sbi)
 {
        spin_lock(&sbi->stat_lock);
        f2fs_bug_on(!sbi->total_valid_inode_count);
        sbi->total_valid_inode_count--;
        spin_unlock(&sbi->stat_lock);
-       return 0;
 }
 
 static inline unsigned int valid_inode_count(struct f2fs_sb_info *sbi)
@@ -771,7 +793,7 @@ static inline unsigned int valid_inode_count(struct f2fs_sb_info *sbi)
 
 static inline void f2fs_put_page(struct page *page, int unlock)
 {
-       if (!page || IS_ERR(page))
+       if (!page)
                return;
 
        if (unlock) {
@@ -876,7 +898,9 @@ enum {
        FI_NO_ALLOC,            /* should not allocate any blocks */
        FI_UPDATE_DIR,          /* should update inode block for consistency */
        FI_DELAY_IPUT,          /* used for the recovery */
+       FI_NO_EXTENT,           /* not to use the extent cache */
        FI_INLINE_XATTR,        /* used for inline xattr */
+       FI_INLINE_DATA,         /* used for inline data*/
 };
 
 static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag)
@@ -914,6 +938,8 @@ static inline void get_inline_info(struct f2fs_inode_info *fi,
 {
        if (ri->i_inline & F2FS_INLINE_XATTR)
                set_inode_flag(fi, FI_INLINE_XATTR);
+       if (ri->i_inline & F2FS_INLINE_DATA)
+               set_inode_flag(fi, FI_INLINE_DATA);
 }
 
 static inline void set_raw_inline(struct f2fs_inode_info *fi,
@@ -923,6 +949,8 @@ static inline void set_raw_inline(struct f2fs_inode_info *fi,
 
        if (is_inode_flag_set(fi, FI_INLINE_XATTR))
                ri->i_inline |= F2FS_INLINE_XATTR;
+       if (is_inode_flag_set(fi, FI_INLINE_DATA))
+               ri->i_inline |= F2FS_INLINE_DATA;
 }
 
 static inline unsigned int addrs_per_inode(struct f2fs_inode_info *fi)
@@ -948,6 +976,13 @@ static inline int inline_xattr_size(struct inode *inode)
                return 0;
 }
 
+static inline void *inline_data_addr(struct page *page)
+{
+       struct f2fs_inode *ri;
+       ri = (struct f2fs_inode *)page_address(page);
+       return (void *)&(ri->i_addr[1]);
+}
+
 static inline int f2fs_readonly(struct super_block *sb)
 {
        return sb->s_flags & MS_RDONLY;
@@ -1027,7 +1062,7 @@ int get_dnode_of_data(struct dnode_of_data *, pgoff_t, int);
 int truncate_inode_blocks(struct inode *, pgoff_t);
 int truncate_xattr_node(struct inode *, struct page *);
 int wait_on_node_pages_writeback(struct f2fs_sb_info *, nid_t);
-int remove_inode_page(struct inode *);
+void remove_inode_page(struct inode *);
 struct page *new_inode_page(struct inode *, const struct qstr *);
 struct page *new_node_page(struct dnode_of_data *, unsigned int, struct page *);
 void ra_node_page(struct f2fs_sb_info *, nid_t);
@@ -1059,9 +1094,6 @@ void clear_prefree_segments(struct f2fs_sb_info *);
 int npages_for_summary_flush(struct f2fs_sb_info *);
 void allocate_new_segments(struct f2fs_sb_info *);
 struct page *get_sum_page(struct f2fs_sb_info *, unsigned int);
-struct bio *f2fs_bio_alloc(struct block_device *, int);
-void f2fs_submit_bio(struct f2fs_sb_info *, enum page_type, bool);
-void f2fs_wait_on_page_writeback(struct page *, enum page_type, bool);
 void write_meta_page(struct f2fs_sb_info *, struct page *);
 void write_node_page(struct f2fs_sb_info *, struct page *, unsigned int,
                                        block_t, block_t *);
@@ -1072,6 +1104,7 @@ void recover_data_page(struct f2fs_sb_info *, struct page *,
                                struct f2fs_summary *, block_t, block_t);
 void rewrite_node_page(struct f2fs_sb_info *, struct page *,
                                struct f2fs_summary *, block_t, block_t);
+void f2fs_wait_on_page_writeback(struct page *, enum page_type, bool);
 void write_data_summaries(struct f2fs_sb_info *, block_t);
 void write_node_summaries(struct f2fs_sb_info *, block_t);
 int lookup_journal_in_cursum(struct f2fs_summary_block *,
@@ -1079,6 +1112,8 @@ int lookup_journal_in_cursum(struct f2fs_summary_block *,
 void flush_sit_entries(struct f2fs_sb_info *);
 int build_segment_manager(struct f2fs_sb_info *);
 void destroy_segment_manager(struct f2fs_sb_info *);
+int __init create_segment_manager_caches(void);
+void destroy_segment_manager_caches(void);
 
 /*
  * checkpoint.c
@@ -1090,7 +1125,7 @@ int acquire_orphan_inode(struct f2fs_sb_info *);
 void release_orphan_inode(struct f2fs_sb_info *);
 void add_orphan_inode(struct f2fs_sb_info *, nid_t);
 void remove_orphan_inode(struct f2fs_sb_info *, nid_t);
-int recover_orphan_inodes(struct f2fs_sb_info *);
+void recover_orphan_inodes(struct f2fs_sb_info *);
 int get_valid_checkpoint(struct f2fs_sb_info *);
 void set_dirty_dir_page(struct inode *, struct page *);
 void add_dirty_dir_inode(struct inode *);
@@ -1105,12 +1140,16 @@ void destroy_checkpoint_caches(void);
 /*
  * data.c
  */
+void f2fs_submit_merged_bio(struct f2fs_sb_info *, enum page_type, bool, int);
+int f2fs_submit_page_bio(struct f2fs_sb_info *, struct page *, block_t, int);
+void f2fs_submit_page_mbio(struct f2fs_sb_info *, struct page *, block_t,
+                                                       enum page_type, int);
 int reserve_new_block(struct dnode_of_data *);
+int f2fs_reserve_block(struct dnode_of_data *, pgoff_t);
 void update_extent_cache(block_t, struct dnode_of_data *);
 struct page *find_data_page(struct inode *, pgoff_t, bool);
 struct page *get_lock_data_page(struct inode *, pgoff_t);
 struct page *get_new_data_page(struct inode *, struct page *, pgoff_t, bool);
-int f2fs_readpage(struct f2fs_sb_info *, struct page *, block_t, int);
 int do_write_data_page(struct page *);
 
 /*
@@ -1238,4 +1277,5 @@ extern const struct address_space_operations f2fs_meta_aops;
 extern const struct inode_operations f2fs_dir_inode_operations;
 extern const struct inode_operations f2fs_symlink_inode_operations;
 extern const struct inode_operations f2fs_special_inode_operations;
+
 #endif
index 7d714f4972d59505e04576306dfd99a363f3b7d4..2b47adcd852ac4914898350b36f8b1ce7022a534 100644 (file)
@@ -33,7 +33,6 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma,
        struct page *page = vmf->page;
        struct inode *inode = file_inode(vma->vm_file);
        struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
-       block_t old_blk_addr;
        struct dnode_of_data dn;
        int err;
 
@@ -44,24 +43,10 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma,
        /* block allocation */
        f2fs_lock_op(sbi);
        set_new_dnode(&dn, inode, NULL, NULL, 0);
-       err = get_dnode_of_data(&dn, page->index, ALLOC_NODE);
-       if (err) {
-               f2fs_unlock_op(sbi);
-               goto out;
-       }
-
-       old_blk_addr = dn.data_blkaddr;
-
-       if (old_blk_addr == NULL_ADDR) {
-               err = reserve_new_block(&dn);
-               if (err) {
-                       f2fs_put_dnode(&dn);
-                       f2fs_unlock_op(sbi);
-                       goto out;
-               }
-       }
-       f2fs_put_dnode(&dn);
+       err = f2fs_reserve_block(&dn, page->index);
        f2fs_unlock_op(sbi);
+       if (err)
+               goto out;
 
        file_update_time(vma->vm_file);
        lock_page(page);
@@ -459,7 +444,7 @@ int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end)
        return 0;
 }
 
-static int punch_hole(struct inode *inode, loff_t offset, loff_t len, int mode)
+static int punch_hole(struct inode *inode, loff_t offset, loff_t len)
 {
        pgoff_t pg_start, pg_end;
        loff_t off_start, off_end;
@@ -499,12 +484,6 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len, int mode)
                }
        }
 
-       if (!(mode & FALLOC_FL_KEEP_SIZE) &&
-               i_size_read(inode) <= (offset + len)) {
-               i_size_write(inode, offset);
-               mark_inode_dirty(inode);
-       }
-
        return ret;
 }
 
@@ -532,22 +511,11 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
 
                f2fs_lock_op(sbi);
                set_new_dnode(&dn, inode, NULL, NULL, 0);
-               ret = get_dnode_of_data(&dn, index, ALLOC_NODE);
-               if (ret) {
-                       f2fs_unlock_op(sbi);
+               ret = f2fs_reserve_block(&dn, index);
+               f2fs_unlock_op(sbi);
+               if (ret)
                        break;
-               }
 
-               if (dn.data_blkaddr == NULL_ADDR) {
-                       ret = reserve_new_block(&dn);
-                       if (ret) {
-                               f2fs_put_dnode(&dn);
-                               f2fs_unlock_op(sbi);
-                               break;
-                       }
-               }
-               f2fs_put_dnode(&dn);
-               f2fs_unlock_op(sbi);
 
                if (pg_start == pg_end)
                        new_size = offset + len;
@@ -578,7 +546,7 @@ static long f2fs_fallocate(struct file *file, int mode,
                return -EOPNOTSUPP;
 
        if (mode & FALLOC_FL_PUNCH_HOLE)
-               ret = punch_hole(inode, offset, len, mode);
+               ret = punch_hole(inode, offset, len);
        else
                ret = expand_inode_data(inode, offset, len, mode);
 
index b7ad1ec7e4ccb50227d1b48ce6d9ee7d26796f07..2886aef35d5984fb66673af3568cf8acd4bfbad1 100644 (file)
@@ -631,7 +631,7 @@ next_iput:
                goto next_step;
 
        if (gc_type == FG_GC) {
-               f2fs_submit_bio(sbi, DATA, true);
+               f2fs_submit_merged_bio(sbi, DATA, true, WRITE);
 
                /*
                 * In the case of FG_GC, it'd be better to reclaim this victim
@@ -664,8 +664,6 @@ static void do_garbage_collect(struct f2fs_sb_info *sbi, unsigned int segno,
 
        /* read segment summary of victim */
        sum_page = get_sum_page(sbi, segno);
-       if (IS_ERR(sum_page))
-               return;
 
        blk_start_plug(&plug);
 
index 4ac4150d421dc05e6c20812d5fd36dcc910a938a..0855168af7d7d9be23d93fa093deaf30ab7f80db 100644 (file)
@@ -89,13 +89,10 @@ static void ra_nat_pages(struct f2fs_sb_info *sbi, int nid)
 {
        struct address_space *mapping = sbi->meta_inode->i_mapping;
        struct f2fs_nm_info *nm_i = NM_I(sbi);
-       struct blk_plug plug;
        struct page *page;
        pgoff_t index;
        int i;
 
-       blk_start_plug(&plug);
-
        for (i = 0; i < FREE_NID_PAGES; i++, nid += NAT_ENTRY_PER_BLOCK) {
                if (nid >= nm_i->max_nid)
                        nid = 0;
@@ -105,15 +102,15 @@ static void ra_nat_pages(struct f2fs_sb_info *sbi, int nid)
                if (!page)
                        continue;
                if (PageUptodate(page)) {
+                       mark_page_accessed(page);
                        f2fs_put_page(page, 1);
                        continue;
                }
-               if (f2fs_readpage(sbi, page, index, READ))
-                       continue;
-
+               f2fs_submit_page_mbio(sbi, page, index, META, READ);
+               mark_page_accessed(page);
                f2fs_put_page(page, 0);
        }
-       blk_finish_plug(&plug);
+       f2fs_submit_merged_bio(sbi, META, true, READ);
 }
 
 static struct nat_entry *__lookup_nat_cache(struct f2fs_nm_info *nm_i, nid_t n)
@@ -502,7 +499,7 @@ static void truncate_node(struct dnode_of_data *dn)
 
        /* Deallocate node address */
        invalidate_blocks(sbi, ni.blk_addr);
-       dec_valid_node_count(sbi, dn->inode, 1);
+       dec_valid_node_count(sbi, dn->inode);
        set_node_addr(sbi, &ni, NULL_ADDR);
 
        if (dn->nid == dn->inode->i_ino) {
@@ -794,7 +791,7 @@ int truncate_xattr_node(struct inode *inode, struct page *page)
        set_new_dnode(&dn, inode, page, npage, nid);
 
        if (page)
-               dn.inode_page_locked = 1;
+               dn.inode_page_locked = true;
        truncate_node(&dn);
        return 0;
 }
@@ -803,29 +800,25 @@ int truncate_xattr_node(struct inode *inode, struct page *page)
  * Caller should grab and release a mutex by calling mutex_lock_op() and
  * mutex_unlock_op().
  */
-int remove_inode_page(struct inode *inode)
+void remove_inode_page(struct inode *inode)
 {
        struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
        struct page *page;
        nid_t ino = inode->i_ino;
        struct dnode_of_data dn;
-       int err;
 
        page = get_node_page(sbi, ino);
        if (IS_ERR(page))
-               return PTR_ERR(page);
+               return;
 
-       err = truncate_xattr_node(inode, page);
-       if (err) {
+       if (truncate_xattr_node(inode, page)) {
                f2fs_put_page(page, 1);
-               return err;
+               return;
        }
-
        /* 0 is possible, after f2fs_new_inode() is failed */
        f2fs_bug_on(inode->i_blocks != 0 && inode->i_blocks != 1);
        set_new_dnode(&dn, inode, page, page, ino);
        truncate_node(&dn);
-       return 0;
 }
 
 struct page *new_inode_page(struct inode *inode, const struct qstr *name)
@@ -855,7 +848,7 @@ struct page *new_node_page(struct dnode_of_data *dn,
        if (!page)
                return ERR_PTR(-ENOMEM);
 
-       if (!inc_valid_node_count(sbi, dn->inode, 1)) {
+       if (!inc_valid_node_count(sbi, dn->inode)) {
                err = -ENOSPC;
                goto fail;
        }
@@ -898,7 +891,7 @@ fail:
  * LOCKED_PAGE: f2fs_put_page(page, 1)
  * error: nothing
  */
-static int read_node_page(struct page *page, int type)
+static int read_node_page(struct page *page, int rw)
 {
        struct f2fs_sb_info *sbi = F2FS_SB(page->mapping->host->i_sb);
        struct node_info ni;
@@ -913,7 +906,7 @@ static int read_node_page(struct page *page, int type)
        if (PageUptodate(page))
                return LOCKED_PAGE;
 
-       return f2fs_readpage(sbi, page, ni.blk_addr, type);
+       return f2fs_submit_page_bio(sbi, page, ni.blk_addr, rw);
 }
 
 /*
@@ -1143,8 +1136,8 @@ continue_unlock:
        }
 
        if (wrote)
-               f2fs_submit_bio(sbi, NODE, wbc->sync_mode == WB_SYNC_ALL);
-
+               f2fs_submit_merged_bio(sbi, NODE, wbc->sync_mode == WB_SYNC_ALL,
+                                                                       WRITE);
        return nwritten;
 }
 
@@ -1564,7 +1557,7 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
        new_ni = old_ni;
        new_ni.ino = ino;
 
-       if (!inc_valid_node_count(sbi, NULL, 1))
+       if (!inc_valid_node_count(sbi, NULL))
                WARN_ON(1);
        set_node_addr(sbi, &new_ni, NEW_ADDR);
        inc_valid_inode_count(sbi);
@@ -1572,47 +1565,84 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page)
        return 0;
 }
 
+/*
+ * ra_sum_pages() merge contiguous pages into one bio and submit.
+ * these pre-readed pages are linked in pages list.
+ */
+static int ra_sum_pages(struct f2fs_sb_info *sbi, struct list_head *pages,
+                               int start, int nrpages)
+{
+       struct page *page;
+       int page_idx = start;
+
+       for (; page_idx < start + nrpages; page_idx++) {
+               /* alloc temporal page for read node summary info*/
+               page = alloc_page(GFP_NOFS | __GFP_ZERO);
+               if (!page) {
+                       struct page *tmp;
+                       list_for_each_entry_safe(page, tmp, pages, lru) {
+                               list_del(&page->lru);
+                               unlock_page(page);
+                               __free_pages(page, 0);
+                       }
+                       return -ENOMEM;
+               }
+
+               lock_page(page);
+               page->index = page_idx;
+               list_add_tail(&page->lru, pages);
+       }
+
+       list_for_each_entry(page, pages, lru)
+               f2fs_submit_page_mbio(sbi, page, page->index, META, READ);
+
+       f2fs_submit_merged_bio(sbi, META, true, READ);
+       return 0;
+}
+
 int restore_node_summary(struct f2fs_sb_info *sbi,
                        unsigned int segno, struct f2fs_summary_block *sum)
 {
        struct f2fs_node *rn;
        struct f2fs_summary *sum_entry;
-       struct page *page;
+       struct page *page, *tmp;
        block_t addr;
-       int i, last_offset;
-
-       /* alloc temporal page for read node */
-       page = alloc_page(GFP_NOFS | __GFP_ZERO);
-       if (!page)
-               return -ENOMEM;
-       lock_page(page);
+       int bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
+       int i, last_offset, nrpages, err = 0;
+       LIST_HEAD(page_list);
 
        /* scan the node segment */
        last_offset = sbi->blocks_per_seg;
        addr = START_BLOCK(sbi, segno);
        sum_entry = &sum->entries[0];
 
-       for (i = 0; i < last_offset; i++, sum_entry++) {
-               /*
-                * In order to read next node page,
-                * we must clear PageUptodate flag.
-                */
-               ClearPageUptodate(page);
+       for (i = 0; i < last_offset; i += nrpages, addr += nrpages) {
+               nrpages = min(last_offset - i, bio_blocks);
 
-               if (f2fs_readpage(sbi, page, addr, READ_SYNC))
-                       goto out;
+               /* read ahead node pages */
+               err = ra_sum_pages(sbi, &page_list, addr, nrpages);
+               if (err)
+                       return err;
 
-               lock_page(page);
-               rn = F2FS_NODE(page);
-               sum_entry->nid = rn->footer.nid;
-               sum_entry->version = 0;
-               sum_entry->ofs_in_node = 0;
-               addr++;
+               list_for_each_entry_safe(page, tmp, &page_list, lru) {
+
+                       lock_page(page);
+                       if(PageUptodate(page)) {
+                               rn = F2FS_NODE(page);
+                               sum_entry->nid = rn->footer.nid;
+                               sum_entry->version = 0;
+                               sum_entry->ofs_in_node = 0;
+                               sum_entry++;
+                       } else {
+                               err = -EIO;
+                       }
+
+                       list_del(&page->lru);
+                       unlock_page(page);
+                       __free_pages(page, 0);
+               }
        }
-       unlock_page(page);
-out:
-       __free_pages(page, 0);
-       return 0;
+       return err;
 }
 
 static bool flush_nats_in_journal(struct f2fs_sb_info *sbi)
index fdc81161f2543a4818e371946ba691515aa9f3c4..c209b8652927650262c47ac1804830c9a098f3d8 100644 (file)
@@ -143,7 +143,7 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head)
        while (1) {
                struct fsync_inode_entry *entry;
 
-               err = f2fs_readpage(sbi, page, blkaddr, READ_SYNC);
+               err = f2fs_submit_page_bio(sbi, page, blkaddr, READ_SYNC);
                if (err)
                        goto out;
 
@@ -386,7 +386,7 @@ static int recover_data(struct f2fs_sb_info *sbi,
        while (1) {
                struct fsync_inode_entry *entry;
 
-               err = f2fs_readpage(sbi, page, blkaddr, READ_SYNC);
+               err = f2fs_submit_page_bio(sbi, page, blkaddr, READ_SYNC);
                if (err)
                        goto out;
 
index fa284d397199faed53f1c8ffb4de611440ad2e73..ca9adf5914cc79d115bc5901226d39a622079d58 100644 (file)
 #include <linux/blkdev.h>
 #include <linux/prefetch.h>
 #include <linux/vmalloc.h>
+#include <linux/swap.h>
 
 #include "f2fs.h"
 #include "segment.h"
 #include "node.h"
 #include <trace/events/f2fs.h>
 
+#define __reverse_ffz(x) __reverse_ffs(~(x))
+
+static struct kmem_cache *discard_entry_slab;
+
+/*
+ * __reverse_ffs is copied from include/asm-generic/bitops/__ffs.h since
+ * MSB and LSB are reversed in a byte by f2fs_set_bit.
+ */
+static inline unsigned long __reverse_ffs(unsigned long word)
+{
+       int num = 0;
+
+#if BITS_PER_LONG == 64
+       if ((word & 0xffffffff) == 0) {
+               num += 32;
+               word >>= 32;
+       }
+#endif
+       if ((word & 0xffff) == 0) {
+               num += 16;
+               word >>= 16;
+       }
+       if ((word & 0xff) == 0) {
+               num += 8;
+               word >>= 8;
+       }
+       if ((word & 0xf0) == 0)
+               num += 4;
+       else
+               word >>= 4;
+       if ((word & 0xc) == 0)
+               num += 2;
+       else
+               word >>= 2;
+       if ((word & 0x2) == 0)
+               num += 1;
+       return num;
+}
+
+/*
+ * __find_rev_next(_zero)_bit is copied from lib/find_next_bit.c becasue
+ * f2fs_set_bit makes MSB and LSB reversed in a byte.
+ * Example:
+ *                             LSB <--> MSB
+ *   f2fs_set_bit(0, bitmap) => 0000 0001
+ *   f2fs_set_bit(7, bitmap) => 1000 0000
+ */
+static unsigned long __find_rev_next_bit(const unsigned long *addr,
+                       unsigned long size, unsigned long offset)
+{
+       const unsigned long *p = addr + BIT_WORD(offset);
+       unsigned long result = offset & ~(BITS_PER_LONG - 1);
+       unsigned long tmp;
+       unsigned long mask, submask;
+       unsigned long quot, rest;
+
+       if (offset >= size)
+               return size;
+
+       size -= result;
+       offset %= BITS_PER_LONG;
+       if (!offset)
+               goto aligned;
+
+       tmp = *(p++);
+       quot = (offset >> 3) << 3;
+       rest = offset & 0x7;
+       mask = ~0UL << quot;
+       submask = (unsigned char)(0xff << rest) >> rest;
+       submask <<= quot;
+       mask &= submask;
+       tmp &= mask;
+       if (size < BITS_PER_LONG)
+               goto found_first;
+       if (tmp)
+               goto found_middle;
+
+       size -= BITS_PER_LONG;
+       result += BITS_PER_LONG;
+aligned:
+       while (size & ~(BITS_PER_LONG-1)) {
+               tmp = *(p++);
+               if (tmp)
+                       goto found_middle;
+               result += BITS_PER_LONG;
+               size -= BITS_PER_LONG;
+       }
+       if (!size)
+               return result;
+       tmp = *p;
+found_first:
+       tmp &= (~0UL >> (BITS_PER_LONG - size));
+       if (tmp == 0UL)         /* Are any bits set? */
+               return result + size;   /* Nope. */
+found_middle:
+       return result + __reverse_ffs(tmp);
+}
+
+static unsigned long __find_rev_next_zero_bit(const unsigned long *addr,
+                       unsigned long size, unsigned long offset)
+{
+       const unsigned long *p = addr + BIT_WORD(offset);
+       unsigned long result = offset & ~(BITS_PER_LONG - 1);
+       unsigned long tmp;
+       unsigned long mask, submask;
+       unsigned long quot, rest;
+
+       if (offset >= size)
+               return size;
+
+       size -= result;
+       offset %= BITS_PER_LONG;
+       if (!offset)
+               goto aligned;
+
+       tmp = *(p++);
+       quot = (offset >> 3) << 3;
+       rest = offset & 0x7;
+       mask = ~(~0UL << quot);
+       submask = (unsigned char)~((unsigned char)(0xff << rest) >> rest);
+       submask <<= quot;
+       mask += submask;
+       tmp |= mask;
+       if (size < BITS_PER_LONG)
+               goto found_first;
+       if (~tmp)
+               goto found_middle;
+
+       size -= BITS_PER_LONG;
+       result += BITS_PER_LONG;
+aligned:
+       while (size & ~(BITS_PER_LONG - 1)) {
+               tmp = *(p++);
+               if (~tmp)
+                       goto found_middle;
+               result += BITS_PER_LONG;
+               size -= BITS_PER_LONG;
+       }
+       if (!size)
+               return result;
+       tmp = *p;
+
+found_first:
+       tmp |= ~0UL << size;
+       if (tmp == ~0UL)        /* Are any bits zero? */
+               return result + size;   /* Nope. */
+found_middle:
+       return result + __reverse_ffz(tmp);
+}
+
 /*
  * This function balances dirty node and dentry pages.
  * In addition, it controls garbage collection.
@@ -116,6 +267,56 @@ static void locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno)
        mutex_unlock(&dirty_i->seglist_lock);
 }
 
+static void f2fs_issue_discard(struct f2fs_sb_info *sbi,
+                               block_t blkstart, block_t blklen)
+{
+       sector_t start = SECTOR_FROM_BLOCK(sbi, blkstart);
+       sector_t len = SECTOR_FROM_BLOCK(sbi, blklen);
+       blkdev_issue_discard(sbi->sb->s_bdev, start, len, GFP_NOFS, 0);
+       trace_f2fs_issue_discard(sbi->sb, blkstart, blklen);
+}
+
+static void add_discard_addrs(struct f2fs_sb_info *sbi,
+                       unsigned int segno, struct seg_entry *se)
+{
+       struct list_head *head = &SM_I(sbi)->discard_list;
+       struct discard_entry *new;
+       int entries = SIT_VBLOCK_MAP_SIZE / sizeof(unsigned long);
+       int max_blocks = sbi->blocks_per_seg;
+       unsigned long *cur_map = (unsigned long *)se->cur_valid_map;
+       unsigned long *ckpt_map = (unsigned long *)se->ckpt_valid_map;
+       unsigned long dmap[entries];
+       unsigned int start = 0, end = -1;
+       int i;
+
+       if (!test_opt(sbi, DISCARD))
+               return;
+
+       /* zero block will be discarded through the prefree list */
+       if (!se->valid_blocks || se->valid_blocks == max_blocks)
+               return;
+
+       /* SIT_VBLOCK_MAP_SIZE should be multiple of sizeof(unsigned long) */
+       for (i = 0; i < entries; i++)
+               dmap[i] = (cur_map[i] ^ ckpt_map[i]) & ckpt_map[i];
+
+       while (SM_I(sbi)->nr_discards <= SM_I(sbi)->max_discards) {
+               start = __find_rev_next_bit(dmap, max_blocks, end + 1);
+               if (start >= max_blocks)
+                       break;
+
+               end = __find_rev_next_zero_bit(dmap, max_blocks, start + 1);
+
+               new = f2fs_kmem_cache_alloc(discard_entry_slab, GFP_NOFS);
+               INIT_LIST_HEAD(&new->list);
+               new->blkaddr = START_BLOCK(sbi, segno) + start;
+               new->len = end - start;
+
+               list_add_tail(&new->list, head);
+               SM_I(sbi)->nr_discards += end - start;
+       }
+}
+
 /*
  * Should call clear_prefree_segments after checkpoint is done.
  */
@@ -138,6 +339,9 @@ static void set_prefree_as_free_segments(struct f2fs_sb_info *sbi)
 
 void clear_prefree_segments(struct f2fs_sb_info *sbi)
 {
+       struct list_head *head = &(SM_I(sbi)->discard_list);
+       struct list_head *this, *next;
+       struct discard_entry *entry;
        struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
        unsigned long *prefree_map = dirty_i->dirty_segmap[PRE];
        unsigned int total_segs = TOTAL_SEGS(sbi);
@@ -160,14 +364,19 @@ void clear_prefree_segments(struct f2fs_sb_info *sbi)
                if (!test_opt(sbi, DISCARD))
                        continue;
 
-               blkdev_issue_discard(sbi->sb->s_bdev,
-                               START_BLOCK(sbi, start) <<
-                               sbi->log_sectors_per_block,
-                               (1 << (sbi->log_sectors_per_block +
-                               sbi->log_blocks_per_seg)) * (end - start),
-                               GFP_NOFS, 0);
+               f2fs_issue_discard(sbi, START_BLOCK(sbi, start),
+                               (end - start) << sbi->log_blocks_per_seg);
        }
        mutex_unlock(&dirty_i->seglist_lock);
+
+       /* send small discards */
+       list_for_each_safe(this, next, head) {
+               entry = list_entry(this, struct discard_entry, list);
+               f2fs_issue_discard(sbi, entry->blkaddr, entry->len);
+               list_del(&entry->list);
+               SM_I(sbi)->nr_discards -= entry->len;
+               kmem_cache_free(discard_entry_slab, entry);
+       }
 }
 
 static void __mark_sit_entry_dirty(struct f2fs_sb_info *sbi, unsigned int segno)
@@ -459,13 +668,18 @@ static void __next_free_blkoff(struct f2fs_sb_info *sbi,
                        struct curseg_info *seg, block_t start)
 {
        struct seg_entry *se = get_seg_entry(sbi, seg->segno);
-       block_t ofs;
-       for (ofs = start; ofs < sbi->blocks_per_seg; ofs++) {
-               if (!f2fs_test_bit(ofs, se->ckpt_valid_map)
-                       && !f2fs_test_bit(ofs, se->cur_valid_map))
-                       break;
-       }
-       seg->next_blkoff = ofs;
+       int entries = SIT_VBLOCK_MAP_SIZE / sizeof(unsigned long);
+       unsigned long target_map[entries];
+       unsigned long *ckpt_map = (unsigned long *)se->ckpt_valid_map;
+       unsigned long *cur_map = (unsigned long *)se->cur_valid_map;
+       int i, pos;
+
+       for (i = 0; i < entries; i++)
+               target_map[i] = ckpt_map[i] | cur_map[i];
+
+       pos = __find_rev_next_zero_bit(target_map, sbi->blocks_per_seg, start);
+
+       seg->next_blkoff = pos;
 }
 
 /*
@@ -573,148 +787,6 @@ static const struct segment_allocation default_salloc_ops = {
        .allocate_segment = allocate_segment_by_default,
 };
 
-static void f2fs_end_io_write(struct bio *bio, int err)
-{
-       const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
-       struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
-       struct bio_private *p = bio->bi_private;
-
-       do {
-               struct page *page = bvec->bv_page;
-
-               if (--bvec >= bio->bi_io_vec)
-                       prefetchw(&bvec->bv_page->flags);
-               if (!uptodate) {
-                       SetPageError(page);
-                       if (page->mapping)
-                               set_bit(AS_EIO, &page->mapping->flags);
-                       set_ckpt_flags(p->sbi->ckpt, CP_ERROR_FLAG);
-                       p->sbi->sb->s_flags |= MS_RDONLY;
-               }
-               end_page_writeback(page);
-               dec_page_count(p->sbi, F2FS_WRITEBACK);
-       } while (bvec >= bio->bi_io_vec);
-
-       if (p->is_sync)
-               complete(p->wait);
-
-       if (!get_pages(p->sbi, F2FS_WRITEBACK) &&
-                       !list_empty(&p->sbi->cp_wait.task_list))
-               wake_up(&p->sbi->cp_wait);
-
-       kfree(p);
-       bio_put(bio);
-}
-
-struct bio *f2fs_bio_alloc(struct block_device *bdev, int npages)
-{
-       struct bio *bio;
-
-       /* No failure on bio allocation */
-       bio = bio_alloc(GFP_NOIO, npages);
-       bio->bi_bdev = bdev;
-       bio->bi_private = NULL;
-
-       return bio;
-}
-
-static void do_submit_bio(struct f2fs_sb_info *sbi,
-                               enum page_type type, bool sync)
-{
-       int rw = sync ? WRITE_SYNC : WRITE;
-       enum page_type btype = type > META ? META : type;
-
-       if (type >= META_FLUSH)
-               rw = WRITE_FLUSH_FUA;
-
-       if (btype == META)
-               rw |= REQ_META;
-
-       if (sbi->bio[btype]) {
-               struct bio_private *p = sbi->bio[btype]->bi_private;
-               p->sbi = sbi;
-               sbi->bio[btype]->bi_end_io = f2fs_end_io_write;
-
-               trace_f2fs_do_submit_bio(sbi->sb, btype, sync, sbi->bio[btype]);
-
-               if (type == META_FLUSH) {
-                       DECLARE_COMPLETION_ONSTACK(wait);
-                       p->is_sync = true;
-                       p->wait = &wait;
-                       submit_bio(rw, sbi->bio[btype]);
-                       wait_for_completion(&wait);
-               } else {
-                       p->is_sync = false;
-                       submit_bio(rw, sbi->bio[btype]);
-               }
-               sbi->bio[btype] = NULL;
-       }
-}
-
-void f2fs_submit_bio(struct f2fs_sb_info *sbi, enum page_type type, bool sync)
-{
-       down_write(&sbi->bio_sem);
-       do_submit_bio(sbi, type, sync);
-       up_write(&sbi->bio_sem);
-}
-
-static void submit_write_page(struct f2fs_sb_info *sbi, struct page *page,
-                               block_t blk_addr, enum page_type type)
-{
-       struct block_device *bdev = sbi->sb->s_bdev;
-       int bio_blocks;
-
-       verify_block_addr(sbi, blk_addr);
-
-       down_write(&sbi->bio_sem);
-
-       inc_page_count(sbi, F2FS_WRITEBACK);
-
-       if (sbi->bio[type] && sbi->last_block_in_bio[type] != blk_addr - 1)
-               do_submit_bio(sbi, type, false);
-alloc_new:
-       if (sbi->bio[type] == NULL) {
-               struct bio_private *priv;
-retry:
-               priv = kmalloc(sizeof(struct bio_private), GFP_NOFS);
-               if (!priv) {
-                       cond_resched();
-                       goto retry;
-               }
-
-               bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
-               sbi->bio[type] = f2fs_bio_alloc(bdev, bio_blocks);
-               sbi->bio[type]->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
-               sbi->bio[type]->bi_private = priv;
-               /*
-                * The end_io will be assigned at the sumbission phase.
-                * Until then, let bio_add_page() merge consecutive IOs as much
-                * as possible.
-                */
-       }
-
-       if (bio_add_page(sbi->bio[type], page, PAGE_CACHE_SIZE, 0) <
-                                                       PAGE_CACHE_SIZE) {
-               do_submit_bio(sbi, type, false);
-               goto alloc_new;
-       }
-
-       sbi->last_block_in_bio[type] = blk_addr;
-
-       up_write(&sbi->bio_sem);
-       trace_f2fs_submit_write_page(page, blk_addr, type);
-}
-
-void f2fs_wait_on_page_writeback(struct page *page,
-                               enum page_type type, bool sync)
-{
-       struct f2fs_sb_info *sbi = F2FS_SB(page->mapping->host->i_sb);
-       if (PageWriteback(page)) {
-               f2fs_submit_bio(sbi, type, sync);
-               wait_on_page_writeback(page);
-       }
-}
-
 static bool __has_curseg_space(struct f2fs_sb_info *sbi, int type)
 {
        struct curseg_info *curseg = CURSEG_I(sbi, type);
@@ -828,7 +900,7 @@ static void do_write_page(struct f2fs_sb_info *sbi, struct page *page,
                fill_node_footer_blkaddr(page, NEXT_FREE_BLKADDR(sbi, curseg));
 
        /* writeout dirty page into bdev */
-       submit_write_page(sbi, page, *new_blkaddr, p_type);
+       f2fs_submit_page_mbio(sbi, page, *new_blkaddr, p_type, WRITE);
 
        mutex_unlock(&curseg->curseg_mutex);
 }
@@ -836,7 +908,7 @@ static void do_write_page(struct f2fs_sb_info *sbi, struct page *page,
 void write_meta_page(struct f2fs_sb_info *sbi, struct page *page)
 {
        set_page_writeback(page);
-       submit_write_page(sbi, page, page->index, META);
+       f2fs_submit_page_mbio(sbi, page, page->index, META, WRITE);
 }
 
 void write_node_page(struct f2fs_sb_info *sbi, struct page *page,
@@ -866,7 +938,7 @@ void write_data_page(struct inode *inode, struct page *page,
 void rewrite_data_page(struct f2fs_sb_info *sbi, struct page *page,
                                        block_t old_blk_addr)
 {
-       submit_write_page(sbi, page, old_blk_addr, DATA);
+       f2fs_submit_page_mbio(sbi, page, old_blk_addr, DATA, WRITE);
 }
 
 void recover_data_page(struct f2fs_sb_info *sbi,
@@ -953,8 +1025,8 @@ void rewrite_node_page(struct f2fs_sb_info *sbi,
 
        /* rewrite node page */
        set_page_writeback(page);
-       submit_write_page(sbi, page, new_blkaddr, NODE);
-       f2fs_submit_bio(sbi, NODE, true);
+       f2fs_submit_page_mbio(sbi, page, new_blkaddr, NODE, WRITE);
+       f2fs_submit_merged_bio(sbi, NODE, true, WRITE);
        refresh_sit_entry(sbi, old_blkaddr, new_blkaddr);
 
        locate_dirty_segment(sbi, old_cursegno);
@@ -964,6 +1036,16 @@ void rewrite_node_page(struct f2fs_sb_info *sbi,
        mutex_unlock(&curseg->curseg_mutex);
 }
 
+void f2fs_wait_on_page_writeback(struct page *page,
+                               enum page_type type, bool sync)
+{
+       struct f2fs_sb_info *sbi = F2FS_SB(page->mapping->host->i_sb);
+       if (PageWriteback(page)) {
+               f2fs_submit_merged_bio(sbi, type, sync, WRITE);
+               wait_on_page_writeback(page);
+       }
+}
+
 static int read_compacted_summaries(struct f2fs_sb_info *sbi)
 {
        struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
@@ -1314,6 +1396,10 @@ void flush_sit_entries(struct f2fs_sb_info *sbi)
 
                sit_offset = SIT_ENTRY_OFFSET(sit_i, segno);
 
+               /* add discard candidates */
+               if (SM_I(sbi)->nr_discards < SM_I(sbi)->max_discards)
+                       add_discard_addrs(sbi, segno, se);
+
                if (flushed)
                        goto to_sit_page;
 
@@ -1480,41 +1566,89 @@ static int build_curseg(struct f2fs_sb_info *sbi)
        return restore_curseg_summaries(sbi);
 }
 
+static int ra_sit_pages(struct f2fs_sb_info *sbi, int start, int nrpages)
+{
+       struct address_space *mapping = sbi->meta_inode->i_mapping;
+       struct page *page;
+       block_t blk_addr, prev_blk_addr = 0;
+       int sit_blk_cnt = SIT_BLK_CNT(sbi);
+       int blkno = start;
+
+       for (; blkno < start + nrpages && blkno < sit_blk_cnt; blkno++) {
+
+               blk_addr = current_sit_addr(sbi, blkno * SIT_ENTRY_PER_BLOCK);
+
+               if (blkno != start && prev_blk_addr + 1 != blk_addr)
+                       break;
+               prev_blk_addr = blk_addr;
+repeat:
+               page = grab_cache_page(mapping, blk_addr);
+               if (!page) {
+                       cond_resched();
+                       goto repeat;
+               }
+               if (PageUptodate(page)) {
+                       mark_page_accessed(page);
+                       f2fs_put_page(page, 1);
+                       continue;
+               }
+
+               f2fs_submit_page_mbio(sbi, page, blk_addr, META, READ);
+
+               mark_page_accessed(page);
+               f2fs_put_page(page, 0);
+       }
+
+       f2fs_submit_merged_bio(sbi, META, true, READ);
+       return blkno - start;
+}
+
 static void build_sit_entries(struct f2fs_sb_info *sbi)
 {
        struct sit_info *sit_i = SIT_I(sbi);
        struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_COLD_DATA);
        struct f2fs_summary_block *sum = curseg->sum_blk;
-       unsigned int start;
-
-       for (start = 0; start < TOTAL_SEGS(sbi); start++) {
-               struct seg_entry *se = &sit_i->sentries[start];
-               struct f2fs_sit_block *sit_blk;
-               struct f2fs_sit_entry sit;
-               struct page *page;
-               int i;
+       int sit_blk_cnt = SIT_BLK_CNT(sbi);
+       unsigned int i, start, end;
+       unsigned int readed, start_blk = 0;
+       int nrpages = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
 
-               mutex_lock(&curseg->curseg_mutex);
-               for (i = 0; i < sits_in_cursum(sum); i++) {
-                       if (le32_to_cpu(segno_in_journal(sum, i)) == start) {
-                               sit = sit_in_journal(sum, i);
-                               mutex_unlock(&curseg->curseg_mutex);
-                               goto got_it;
+       do {
+               readed = ra_sit_pages(sbi, start_blk, nrpages);
+
+               start = start_blk * sit_i->sents_per_block;
+               end = (start_blk + readed) * sit_i->sents_per_block;
+
+               for (; start < end && start < TOTAL_SEGS(sbi); start++) {
+                       struct seg_entry *se = &sit_i->sentries[start];
+                       struct f2fs_sit_block *sit_blk;
+                       struct f2fs_sit_entry sit;
+                       struct page *page;
+
+                       mutex_lock(&curseg->curseg_mutex);
+                       for (i = 0; i < sits_in_cursum(sum); i++) {
+                               if (le32_to_cpu(segno_in_journal(sum, i)) == start) {
+                                       sit = sit_in_journal(sum, i);
+                                       mutex_unlock(&curseg->curseg_mutex);
+                                       goto got_it;
+                               }
                        }
-               }
-               mutex_unlock(&curseg->curseg_mutex);
-               page = get_current_sit_page(sbi, start);
-               sit_blk = (struct f2fs_sit_block *)page_address(page);
-               sit = sit_blk->entries[SIT_ENTRY_OFFSET(sit_i, start)];
-               f2fs_put_page(page, 1);
+                       mutex_unlock(&curseg->curseg_mutex);
+
+                       page = get_current_sit_page(sbi, start);
+                       sit_blk = (struct f2fs_sit_block *)page_address(page);
+                       sit = sit_blk->entries[SIT_ENTRY_OFFSET(sit_i, start)];
+                       f2fs_put_page(page, 1);
 got_it:
-               check_block_count(sbi, start, &sit);
-               seg_info_from_raw_sit(se, &sit);
-               if (sbi->segs_per_sec > 1) {
-                       struct sec_entry *e = get_sec_entry(sbi, start);
-                       e->valid_blocks += se->valid_blocks;
+                       check_block_count(sbi, start, &sit);
+                       seg_info_from_raw_sit(se, &sit);
+                       if (sbi->segs_per_sec > 1) {
+                               struct sec_entry *e = get_sec_entry(sbi, start);
+                               e->valid_blocks += se->valid_blocks;
+                       }
                }
-       }
+               start_blk += readed;
+       } while (start_blk < sit_blk_cnt);
 }
 
 static void init_free_segmap(struct f2fs_sb_info *sbi)
@@ -1645,6 +1779,10 @@ int build_segment_manager(struct f2fs_sb_info *sbi)
        sm_info->ssa_blkaddr = le32_to_cpu(raw_super->ssa_blkaddr);
        sm_info->rec_prefree_segments = DEF_RECLAIM_PREFREE_SEGMENTS;
 
+       INIT_LIST_HEAD(&sm_info->discard_list);
+       sm_info->nr_discards = 0;
+       sm_info->max_discards = 0;
+
        err = build_sit_info(sbi);
        if (err)
                return err;
@@ -1760,3 +1898,17 @@ void destroy_segment_manager(struct f2fs_sb_info *sbi)
        sbi->sm_info = NULL;
        kfree(sm_info);
 }
+
+int __init create_segment_manager_caches(void)
+{
+       discard_entry_slab = f2fs_kmem_cache_create("discard_entry",
+                       sizeof(struct discard_entry), NULL);
+       if (!discard_entry_slab)
+               return -ENOMEM;
+       return 0;
+}
+
+void destroy_segment_manager_caches(void)
+{
+       kmem_cache_destroy(discard_entry_slab);
+}
index 269f690b4e2492c65bf1a59e9d10302d87725a4e..26812fc0fa12b7cf458fd32bb5bbbdd65777f8b2 100644 (file)
 #define GET_L2R_SEGNO(free_i, segno)   (segno - free_i->start_segno)
 #define GET_R2L_SEGNO(free_i, segno)   (segno + free_i->start_segno)
 
-#define IS_DATASEG(t)                                                  \
-       ((t == CURSEG_HOT_DATA) || (t == CURSEG_COLD_DATA) ||           \
-       (t == CURSEG_WARM_DATA))
-
-#define IS_NODESEG(t)                                                  \
-       ((t == CURSEG_HOT_NODE) || (t == CURSEG_COLD_NODE) ||           \
-       (t == CURSEG_WARM_NODE))
+#define IS_DATASEG(t)  (t <= CURSEG_COLD_DATA)
+#define IS_NODESEG(t)  (t >= CURSEG_HOT_NODE)
 
 #define IS_CURSEG(sbi, seg)                                            \
        ((seg == CURSEG_I(sbi, CURSEG_HOT_DATA)->segno) ||      \
        (segno / SIT_ENTRY_PER_BLOCK)
 #define        START_SEGNO(sit_i, segno)               \
        (SIT_BLOCK_OFFSET(sit_i, segno) * SIT_ENTRY_PER_BLOCK)
+#define SIT_BLK_CNT(sbi)                       \
+       ((TOTAL_SEGS(sbi) + SIT_ENTRY_PER_BLOCK - 1) / SIT_ENTRY_PER_BLOCK)
 #define f2fs_bitmap_size(nr)                   \
        (BITS_TO_LONGS(nr) * sizeof(unsigned long))
 #define TOTAL_SEGS(sbi)        (SM_I(sbi)->main_segments)
 #define TOTAL_SECS(sbi)        (sbi->total_sections)
 
 #define SECTOR_FROM_BLOCK(sbi, blk_addr)                               \
-       (blk_addr << ((sbi)->log_blocksize - F2FS_LOG_SECTOR_SIZE))
+       (((sector_t)blk_addr) << (sbi)->log_sectors_per_block)
 #define SECTOR_TO_BLOCK(sbi, sectors)                                  \
-       (sectors >> ((sbi)->log_blocksize - F2FS_LOG_SECTOR_SIZE))
+       (sectors >> (sbi)->log_sectors_per_block)
 #define MAX_BIO_BLOCKS(max_hw_blocks)                                  \
        (min((int)max_hw_blocks, BIO_MAX_PAGES))
 
-/* during checkpoint, bio_private is used to synchronize the last bio */
-struct bio_private {
-       struct f2fs_sb_info *sbi;
-       bool is_sync;
-       void *wait;
-};
-
 /*
  * indicate a block allocation direction: RIGHT and LEFT.
  * RIGHT means allocating new sections towards the end of volume.
index bafff72de8e841afba9d609a8001c71af67f42fc..dd55074a304fb412f34e13e6607b354466640dbb 100644 (file)
@@ -50,6 +50,7 @@ enum {
        Opt_active_logs,
        Opt_disable_ext_identify,
        Opt_inline_xattr,
+       Opt_inline_data,
        Opt_err,
 };
 
@@ -65,6 +66,7 @@ static match_table_t f2fs_tokens = {
        {Opt_active_logs, "active_logs=%u"},
        {Opt_disable_ext_identify, "disable_ext_identify"},
        {Opt_inline_xattr, "inline_xattr"},
+       {Opt_inline_data, "inline_data"},
        {Opt_err, NULL},
 };
 
@@ -175,6 +177,7 @@ F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_max_sleep_time, max_sleep_time);
 F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_no_gc_sleep_time, no_gc_sleep_time);
 F2FS_RW_ATTR(GC_THREAD, f2fs_gc_kthread, gc_idle, gc_idle);
 F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, reclaim_segments, rec_prefree_segments);
+F2FS_RW_ATTR(SM_INFO, f2fs_sm_info, max_small_discards, max_discards);
 
 #define ATTR_LIST(name) (&f2fs_attr_##name.attr)
 static struct attribute *f2fs_attrs[] = {
@@ -183,6 +186,7 @@ static struct attribute *f2fs_attrs[] = {
        ATTR_LIST(gc_no_gc_sleep_time),
        ATTR_LIST(gc_idle),
        ATTR_LIST(reclaim_segments),
+       ATTR_LIST(max_small_discards),
        NULL,
 };
 
@@ -311,6 +315,9 @@ static int parse_options(struct super_block *sb, char *options)
                case Opt_disable_ext_identify:
                        set_opt(sbi, DISABLE_EXT_IDENTIFY);
                        break;
+               case Opt_inline_data:
+                       set_opt(sbi, INLINE_DATA);
+                       break;
                default:
                        f2fs_msg(sb, KERN_ERR,
                                "Unrecognized mount option \"%s\" or missing value",
@@ -508,7 +515,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
 #endif
        if (test_opt(sbi, DISABLE_EXT_IDENTIFY))
                seq_puts(seq, ",disable_ext_identify");
-
+       if (test_opt(sbi, INLINE_DATA))
+               seq_puts(seq, ",inline_data");
        seq_printf(seq, ",active_logs=%u", sbi->active_logs);
 
        return 0;
@@ -818,6 +826,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
        struct buffer_head *raw_super_buf;
        struct inode *root;
        long err = -EINVAL;
+       int i;
 
        /* allocate memory for f2fs-specific super block info */
        sbi = kzalloc(sizeof(struct f2fs_sb_info), GFP_KERNEL);
@@ -874,7 +883,11 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
        mutex_init(&sbi->node_write);
        sbi->por_doing = false;
        spin_lock_init(&sbi->stat_lock);
-       init_rwsem(&sbi->bio_sem);
+
+       mutex_init(&sbi->read_io.io_mutex);
+       for (i = 0; i < NR_PAGE_TYPE; i++)
+               mutex_init(&sbi->write_io[i].io_mutex);
+
        init_rwsem(&sbi->cp_rwsem);
        init_waitqueue_head(&sbi->cp_wait);
        init_sb_info(sbi);
@@ -939,9 +952,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
        }
 
        /* if there are nt orphan nodes free them */
-       err = -EINVAL;
-       if (recover_orphan_inodes(sbi))
-               goto free_node_inode;
+       recover_orphan_inodes(sbi);
 
        /* read root inode and dentry */
        root = f2fs_iget(sb, F2FS_ROOT_INO(sbi));
@@ -950,8 +961,10 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
                err = PTR_ERR(root);
                goto free_node_inode;
        }
-       if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size)
+       if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
+               err = -EINVAL;
                goto free_root_inode;
+       }
 
        sb->s_root = d_make_root(root); /* allocate root dentry */
        if (!sb->s_root) {
@@ -1078,9 +1091,12 @@ static int __init init_f2fs_fs(void)
        err = create_node_manager_caches();
        if (err)
                goto free_inodecache;
-       err = create_gc_caches();
+       err = create_segment_manager_caches();
        if (err)
                goto free_node_manager_caches;
+       err = create_gc_caches();
+       if (err)
+               goto free_segment_manager_caches;
        err = create_checkpoint_caches();
        if (err)
                goto free_gc_caches;
@@ -1102,6 +1118,8 @@ free_checkpoint_caches:
        destroy_checkpoint_caches();
 free_gc_caches:
        destroy_gc_caches();
+free_segment_manager_caches:
+       destroy_segment_manager_caches();
 free_node_manager_caches:
        destroy_node_manager_caches();
 free_inodecache:
index 7f5c658af755f9b43296c1dacfab5def788c4a1c..b4730cf52aec9172727816820174fb53d7e001b8 100644 (file)
@@ -755,6 +755,7 @@ static void fscache_write_op(struct fscache_operation *_op)
        struct fscache_object *object = op->op.object;
        struct fscache_cookie *cookie;
        struct page *page;
+       pgoff_t index;
        unsigned n;
        void *results[1];
        int ret;
@@ -803,7 +804,7 @@ static void fscache_write_op(struct fscache_operation *_op)
        _debug("gang %d [%lx]", n, page->index);
        if (page->index > op->store_limit) {
                fscache_stat(&fscache_n_store_pages_over_limit);
-               goto superseded;
+               goto page_beyond_limit;
        }
 
        radix_tree_tag_set(&cookie->stores, page->index,
@@ -829,6 +830,40 @@ static void fscache_write_op(struct fscache_operation *_op)
        _leave("");
        return;
 
+page_beyond_limit:
+       spin_unlock(&object->lock);
+
+page_beyond_limit_unlocked:
+       /* pages that are now beyond the end of the storage object must have
+        * their pending storage records cleared.
+        */
+       index = page->index;
+       radix_tree_tag_clear(&cookie->stores, page->index,
+                            FSCACHE_COOKIE_PENDING_TAG);
+       if (!radix_tree_tag_get(&cookie->stores, page->index,
+                               FSCACHE_COOKIE_STORING_TAG)) {
+               fscache_stat(&fscache_n_store_radix_deletes);
+               radix_tree_delete(&cookie->stores, page->index);
+               page_cache_release(page);
+       }
+       if (!need_resched()) {
+               n = radix_tree_gang_lookup_tag(&cookie->stores, results,
+                                              index + 1, 1,
+                                              FSCACHE_COOKIE_PENDING_TAG);
+               if (n == 1) {
+                       page = results[0];
+                       goto page_beyond_limit_unlocked;
+               }
+               spin_unlock(&cookie->stores_lock);
+               wake_up_bit(&cookie->flags, 0);
+       } else {
+               spin_unlock(&cookie->stores_lock);
+       }
+
+       fscache_enqueue_operation(&op->op);
+       _leave("");
+       return;
+
 superseded:
        /* this writer is going away and there aren't any more things to
         * write */
index b7fc035a6943cc40f649f1cca7be5858fbcf1cbc..028281303beacc580992411ac11e2816d2ad76ad 100644 (file)
@@ -1050,30 +1050,22 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
                bh = bh->b_this_page;
        } while(bh != head);
        spin_unlock(&sdp->sd_ail_lock);
-       gfs2_log_unlock(sdp);
 
        head = bh = page_buffers(page);
        do {
-               gfs2_log_lock(sdp);
                bd = bh->b_private;
                if (bd) {
                        gfs2_assert_warn(sdp, bd->bd_bh == bh);
-                       if (!list_empty(&bd->bd_list)) {
-                               if (!buffer_pinned(bh))
-                                       list_del_init(&bd->bd_list);
-                               else
-                                       bd = NULL;
-                       }
-                       if (bd)
-                               bd->bd_bh = NULL;
+                       if (!list_empty(&bd->bd_list))
+                               list_del_init(&bd->bd_list);
+                       bd->bd_bh = NULL;
                        bh->b_private = NULL;
-               }
-               gfs2_log_unlock(sdp);
-               if (bd)
                        kmem_cache_free(gfs2_bufdata_cachep, bd);
+               }
 
                bh = bh->b_this_page;
        } while (bh != head);
+       gfs2_log_unlock(sdp);
 
        return try_to_free_buffers(page);
 
index db908f697139cfffbca462d3a7528e13139576b5..3a81f1e7de116ce64b1e6d23f0f0cffd7e69ec8b 100644 (file)
@@ -133,7 +133,8 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
 
 static void rgrp_go_sync(struct gfs2_glock *gl)
 {
-       struct address_space *metamapping = gfs2_glock2aspace(gl);
+       struct gfs2_sbd *sdp = gl->gl_sbd;
+       struct address_space *mapping = &sdp->sd_aspace;
        struct gfs2_rgrpd *rgd;
        int error;
 
@@ -141,10 +142,10 @@ static void rgrp_go_sync(struct gfs2_glock *gl)
                return;
        GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_EXCLUSIVE);
 
-       gfs2_log_flush(gl->gl_sbd, gl);
-       filemap_fdatawrite(metamapping);
-       error = filemap_fdatawait(metamapping);
-        mapping_set_error(metamapping, error);
+       gfs2_log_flush(sdp, gl);
+       filemap_fdatawrite_range(mapping, gl->gl_vm.start, gl->gl_vm.end);
+       error = filemap_fdatawait_range(mapping, gl->gl_vm.start, gl->gl_vm.end);
+       mapping_set_error(mapping, error);
        gfs2_ail_empty_gl(gl);
 
        spin_lock(&gl->gl_spin);
@@ -166,11 +167,12 @@ static void rgrp_go_sync(struct gfs2_glock *gl)
 
 static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
 {
-       struct address_space *mapping = gfs2_glock2aspace(gl);
+       struct gfs2_sbd *sdp = gl->gl_sbd;
+       struct address_space *mapping = &sdp->sd_aspace;
 
        WARN_ON_ONCE(!(flags & DIO_METADATA));
-       gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count));
-       truncate_inode_pages(mapping, 0);
+       gfs2_assert_withdraw(sdp, !atomic_read(&gl->gl_ail_count));
+       truncate_inode_pages_range(mapping, gl->gl_vm.start, gl->gl_vm.end);
 
        if (gl->gl_object) {
                struct gfs2_rgrpd *rgd = (struct gfs2_rgrpd *)gl->gl_object;
@@ -552,7 +554,7 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = {
        .go_unlock = gfs2_rgrp_go_unlock,
        .go_dump = gfs2_rgrp_dump,
        .go_type = LM_TYPE_RGRP,
-       .go_flags = GLOF_ASPACE | GLOF_LVB,
+       .go_flags = GLOF_LVB,
 };
 
 const struct gfs2_glock_operations gfs2_trans_glops = {
index ba1ea67f4eeb1c99e826f54be8b9b6d8d57909f8..a99f60c98845db04ccc733feb1a6c0a4e09d4d6e 100644 (file)
@@ -93,6 +93,7 @@ struct gfs2_rgrpd {
        struct gfs2_rgrp_lvb *rd_rgl;
        u32 rd_last_alloc;
        u32 rd_flags;
+       u32 rd_extfail_pt;              /* extent failure point */
 #define GFS2_RDF_CHECK         0x10000000 /* check for unlinked inodes */
 #define GFS2_RDF_UPTODATE      0x20000000 /* rg is up to date */
 #define GFS2_RDF_ERROR         0x40000000 /* error in rg */
@@ -350,7 +351,15 @@ struct gfs2_glock {
        atomic_t gl_ail_count;
        atomic_t gl_revokes;
        struct delayed_work gl_work;
-       struct work_struct gl_delete;
+       union {
+               /* For inode and iopen glocks only */
+               struct work_struct gl_delete;
+               /* For rgrp glocks only */
+               struct {
+                       loff_t start;
+                       loff_t end;
+               } gl_vm;
+       };
        struct rcu_head gl_rcu;
 };
 
@@ -727,6 +736,8 @@ struct gfs2_sbd {
 
        /* Log stuff */
 
+       struct address_space sd_aspace;
+
        spinlock_t sd_log_lock;
 
        struct gfs2_trans *sd_log_tr;
index 010b9fb9fec6e781cb80a6982d746896ba6cffdb..58f06400b7b8dcece9597b51b05ebf9ebc092396 100644 (file)
@@ -83,6 +83,7 @@ static void maybe_release_space(struct gfs2_bufdata *bd)
               bd->bd_bh->b_data + bi->bi_offset, bi->bi_len);
        clear_bit(GBF_FULL, &bi->bi_flags);
        rgd->rd_free_clone = rgd->rd_free;
+       rgd->rd_extfail_pt = rgd->rd_free;
 }
 
 /**
@@ -588,8 +589,12 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
 static void gfs2_meta_sync(struct gfs2_glock *gl)
 {
        struct address_space *mapping = gfs2_glock2aspace(gl);
+       struct gfs2_sbd *sdp = gl->gl_sbd;
        int error;
 
+       if (mapping == NULL)
+               mapping = &sdp->sd_aspace;
+
        filemap_fdatawrite(mapping);
        error = filemap_fdatawait(mapping);
 
index 932415050540e2a1bdefc6d957e68ef7a0d82d01..e57f6081e7e5cf8043148f4782d0a68459b802fd 100644 (file)
@@ -116,6 +116,9 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create)
        unsigned long index;
        unsigned int bufnum;
 
+       if (mapping == NULL)
+               mapping = &sdp->sd_aspace;
+
        shift = PAGE_CACHE_SHIFT - sdp->sd_sb.sb_bsize_shift;
        index = blkno >> shift;             /* convert block to page */
        bufnum = blkno - (index << shift);  /* block buf index within page */
index 82303b4749582cd3c00d402a9f42b9972b1de677..94aab31477b688f76ee32ca752c8931203a3161c 100644 (file)
@@ -36,6 +36,7 @@
 #include "log.h"
 #include "quota.h"
 #include "dir.h"
+#include "meta_io.h"
 #include "trace_gfs2.h"
 
 #define DO 0
@@ -62,6 +63,7 @@ static void gfs2_tune_init(struct gfs2_tune *gt)
 static struct gfs2_sbd *init_sbd(struct super_block *sb)
 {
        struct gfs2_sbd *sdp;
+       struct address_space *mapping;
 
        sdp = kzalloc(sizeof(struct gfs2_sbd), GFP_KERNEL);
        if (!sdp)
@@ -98,6 +100,16 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
        INIT_LIST_HEAD(&sdp->sd_trunc_list);
        spin_lock_init(&sdp->sd_trunc_lock);
 
+       mapping = &sdp->sd_aspace;
+
+       mapping->a_ops = &gfs2_meta_aops;
+       mapping->host = sb->s_bdev->bd_inode;
+       mapping->flags = 0;
+       mapping_set_gfp_mask(mapping, GFP_NOFS);
+       mapping->private_data = NULL;
+       mapping->backing_dev_info = sb->s_bdi;
+       mapping->writeback_index = 0;
+
        spin_lock_init(&sdp->sd_log_lock);
        atomic_set(&sdp->sd_log_pinned, 0);
        INIT_LIST_HEAD(&sdp->sd_log_le_buf);
@@ -1366,8 +1378,18 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
        if (IS_ERR(s))
                goto error_bdev;
 
-       if (s->s_root)
+       if (s->s_root) {
+               /*
+                * s_umount nests inside bd_mutex during
+                * __invalidate_device().  blkdev_put() acquires
+                * bd_mutex and can't be called under s_umount.  Drop
+                * s_umount temporarily.  This is safe as we're
+                * holding an active reference.
+                */
+               up_write(&s->s_umount);
                blkdev_put(bdev, mode);
+               down_write(&s->s_umount);
+       }
 
        memset(&args, 0, sizeof(args));
        args.ar_quota = GFS2_QUOTA_DEFAULT;
index 98236d0df3cae7ce7666a10dc7fc907590b873b0..1b6b3675ee1d546b15b78bdf5dc1ee9fb5823b0d 100644 (file)
 #include "inode.h"
 #include "util.h"
 
-struct gfs2_quota_change_host {
-       u64 qc_change;
-       u32 qc_flags; /* GFS2_QCF_... */
-       struct kqid qc_id;
-};
-
 /* Lock order: qd_lock -> qd->lockref.lock -> lru lock */
 static DEFINE_SPINLOCK(qd_lock);
 struct list_lru gfs2_qd_lru;
@@ -1214,17 +1208,6 @@ int gfs2_quota_refresh(struct gfs2_sbd *sdp, struct kqid qid)
        return error;
 }
 
-static void gfs2_quota_change_in(struct gfs2_quota_change_host *qc, const void *buf)
-{
-       const struct gfs2_quota_change *str = buf;
-
-       qc->qc_change = be64_to_cpu(str->qc_change);
-       qc->qc_flags = be32_to_cpu(str->qc_flags);
-       qc->qc_id = make_kqid(&init_user_ns,
-                             (qc->qc_flags & GFS2_QCF_USER)?USRQUOTA:GRPQUOTA,
-                             be32_to_cpu(str->qc_id));
-}
-
 int gfs2_quota_init(struct gfs2_sbd *sdp)
 {
        struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
@@ -1257,6 +1240,7 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
 
        for (x = 0; x < blocks; x++) {
                struct buffer_head *bh;
+               const struct gfs2_quota_change *qc;
                unsigned int y;
 
                if (!extlen) {
@@ -1274,25 +1258,28 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
                        goto fail;
                }
 
+               qc = (const struct gfs2_quota_change *)(bh->b_data + sizeof(struct gfs2_meta_header));
                for (y = 0; y < sdp->sd_qc_per_block && slot < sdp->sd_quota_slots;
                     y++, slot++) {
-                       struct gfs2_quota_change_host qc;
                        struct gfs2_quota_data *qd;
-
-                       gfs2_quota_change_in(&qc, bh->b_data +
-                                         sizeof(struct gfs2_meta_header) +
-                                         y * sizeof(struct gfs2_quota_change));
-                       if (!qc.qc_change)
+                       s64 qc_change = be64_to_cpu(qc->qc_change);
+                       u32 qc_flags = be32_to_cpu(qc->qc_flags);
+                       enum quota_type qtype = (qc_flags & GFS2_QCF_USER) ?
+                                               USRQUOTA : GRPQUOTA;
+                       struct kqid qc_id = make_kqid(&init_user_ns, qtype,
+                                                     be32_to_cpu(qc->qc_id));
+                       qc++;
+                       if (!qc_change)
                                continue;
 
-                       error = qd_alloc(sdp, qc.qc_id, &qd);
+                       error = qd_alloc(sdp, qc_id, &qd);
                        if (error) {
                                brelse(bh);
                                goto fail;
                        }
 
                        set_bit(QDF_CHANGE, &qd->qd_flags);
-                       qd->qd_change = qc.qc_change;
+                       qd->qd_change = qc_change;
                        qd->qd_slot = slot;
                        qd->qd_slot_count = 1;
 
index c8d6161bd682bd6cbd05247e2f0efc8274afe0b9..183cf0f0052d9c7fa78d8b369c7b4a7d8b0c452c 100644 (file)
  * 3 = Used (metadata)
  */
 
+struct gfs2_extent {
+       struct gfs2_rbm rbm;
+       u32 len;
+};
+
 static const char valid_change[16] = {
                /* current */
        /* n */ 0, 1, 1, 1,
@@ -65,8 +70,9 @@ static const char valid_change[16] = {
                1, 0, 0, 0
 };
 
-static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 minext,
-                         const struct gfs2_inode *ip, bool nowrap);
+static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
+                        const struct gfs2_inode *ip, bool nowrap,
+                        const struct gfs2_alloc_parms *ap);
 
 
 /**
@@ -635,9 +641,13 @@ static void __rs_deltree(struct gfs2_blkreserv *rs)
                /* return reserved blocks to the rgrp */
                BUG_ON(rs->rs_rbm.rgd->rd_reserved < rs->rs_free);
                rs->rs_rbm.rgd->rd_reserved -= rs->rs_free;
+               /* The rgrp extent failure point is likely not to increase;
+                  it will only do so if the freed blocks are somehow
+                  contiguous with a span of free blocks that follows. Still,
+                  it will force the number to be recalculated later. */
+               rgd->rd_extfail_pt += rs->rs_free;
                rs->rs_free = 0;
                clear_bit(GBF_FULL, &bi->bi_flags);
-               smp_mb__after_clear_bit();
        }
 }
 
@@ -876,6 +886,7 @@ static int rgd_insert(struct gfs2_rgrpd *rgd)
 static int read_rindex_entry(struct gfs2_inode *ip)
 {
        struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
+       const unsigned bsize = sdp->sd_sb.sb_bsize;
        loff_t pos = sdp->sd_rgrps * sizeof(struct gfs2_rindex);
        struct gfs2_rindex buf;
        int error;
@@ -913,6 +924,8 @@ static int read_rindex_entry(struct gfs2_inode *ip)
                goto fail;
 
        rgd->rd_gl->gl_object = rgd;
+       rgd->rd_gl->gl_vm.start = rgd->rd_addr * bsize;
+       rgd->rd_gl->gl_vm.end = rgd->rd_gl->gl_vm.start + (rgd->rd_length * bsize) - 1;
        rgd->rd_rgl = (struct gfs2_rgrp_lvb *)rgd->rd_gl->gl_lksb.sb_lvbptr;
        rgd->rd_flags &= ~GFS2_RDF_UPTODATE;
        if (rgd->rd_data > sdp->sd_max_rg_data)
@@ -1126,6 +1139,8 @@ int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd)
                gfs2_rgrp_in(rgd, (rgd->rd_bits[0].bi_bh)->b_data);
                rgd->rd_flags |= (GFS2_RDF_UPTODATE | GFS2_RDF_CHECK);
                rgd->rd_free_clone = rgd->rd_free;
+               /* max out the rgrp allocation failure point */
+               rgd->rd_extfail_pt = rgd->rd_free;
        }
        if (cpu_to_be32(GFS2_MAGIC) != rgd->rd_rgl->rl_magic) {
                rgd->rd_rgl->rl_unlinked = cpu_to_be32(count_unlinked(rgd));
@@ -1455,7 +1470,7 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip,
        if (WARN_ON(gfs2_rbm_from_block(&rbm, goal)))
                return;
 
-       ret = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, extlen, ip, true);
+       ret = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, &extlen, ip, true, ap);
        if (ret == 0) {
                rs->rs_rbm = rbm;
                rs->rs_free = extlen;
@@ -1520,6 +1535,7 @@ static u64 gfs2_next_unreserved_block(struct gfs2_rgrpd *rgd, u64 block,
  * @rbm: The current position in the resource group
  * @ip: The inode for which we are searching for blocks
  * @minext: The minimum extent length
+ * @maxext: A pointer to the maximum extent structure
  *
  * This checks the current position in the rgrp to see whether there is
  * a reservation covering this block. If not then this function is a
@@ -1532,7 +1548,8 @@ static u64 gfs2_next_unreserved_block(struct gfs2_rgrpd *rgd, u64 block,
 
 static int gfs2_reservation_check_and_update(struct gfs2_rbm *rbm,
                                             const struct gfs2_inode *ip,
-                                            u32 minext)
+                                            u32 minext,
+                                            struct gfs2_extent *maxext)
 {
        u64 block = gfs2_rbm_to_block(rbm);
        u32 extlen = 1;
@@ -1545,8 +1562,7 @@ static int gfs2_reservation_check_and_update(struct gfs2_rbm *rbm,
         */
        if (minext) {
                extlen = gfs2_free_extlen(rbm, minext);
-               nblock = block + extlen;
-               if (extlen < minext)
+               if (extlen <= maxext->len)
                        goto fail;
        }
 
@@ -1555,9 +1571,17 @@ static int gfs2_reservation_check_and_update(struct gfs2_rbm *rbm,
         * and skip if parts of it are already reserved
         */
        nblock = gfs2_next_unreserved_block(rbm->rgd, block, extlen, ip);
-       if (nblock == block)
-               return 0;
+       if (nblock == block) {
+               if (!minext || extlen >= minext)
+                       return 0;
+
+               if (extlen > maxext->len) {
+                       maxext->len = extlen;
+                       maxext->rbm = *rbm;
+               }
 fail:
+               nblock = block + extlen;
+       }
        ret = gfs2_rbm_from_block(rbm, nblock);
        if (ret < 0)
                return ret;
@@ -1568,30 +1592,38 @@ fail:
  * gfs2_rbm_find - Look for blocks of a particular state
  * @rbm: Value/result starting position and final position
  * @state: The state which we want to find
- * @minext: The requested extent length (0 for a single block)
+ * @minext: Pointer to the requested extent length (NULL for a single block)
+ *          This is updated to be the actual reservation size.
  * @ip: If set, check for reservations
  * @nowrap: Stop looking at the end of the rgrp, rather than wrapping
  *          around until we've reached the starting point.
+ * @ap: the allocation parameters
  *
  * Side effects:
  * - If looking for free blocks, we set GBF_FULL on each bitmap which
  *   has no free blocks in it.
+ * - If looking for free blocks, we set rd_extfail_pt on each rgrp which
+ *   has come up short on a free block search.
  *
  * Returns: 0 on success, -ENOSPC if there is no block of the requested state
  */
 
-static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 minext,
-                        const struct gfs2_inode *ip, bool nowrap)
+static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
+                        const struct gfs2_inode *ip, bool nowrap,
+                        const struct gfs2_alloc_parms *ap)
 {
        struct buffer_head *bh;
        int initial_bii;
        u32 initial_offset;
+       int first_bii = rbm->bii;
+       u32 first_offset = rbm->offset;
        u32 offset;
        u8 *buffer;
        int n = 0;
        int iters = rbm->rgd->rd_length;
        int ret;
        struct gfs2_bitmap *bi;
+       struct gfs2_extent maxext = { .rbm.rgd = rbm->rgd, };
 
        /* If we are not starting at the beginning of a bitmap, then we
         * need to add one to the bitmap count to ensure that we search
@@ -1620,7 +1652,9 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 minext,
                        return 0;
 
                initial_bii = rbm->bii;
-               ret = gfs2_reservation_check_and_update(rbm, ip, minext);
+               ret = gfs2_reservation_check_and_update(rbm, ip,
+                                                       minext ? *minext : 0,
+                                                       &maxext);
                if (ret == 0)
                        return 0;
                if (ret > 0) {
@@ -1655,6 +1689,24 @@ next_iter:
                        break;
        }
 
+       if (minext == NULL || state != GFS2_BLKST_FREE)
+               return -ENOSPC;
+
+       /* If the extent was too small, and it's smaller than the smallest
+          to have failed before, remember for future reference that it's
+          useless to search this rgrp again for this amount or more. */
+       if ((first_offset == 0) && (first_bii == 0) &&
+           (*minext < rbm->rgd->rd_extfail_pt))
+               rbm->rgd->rd_extfail_pt = *minext;
+
+       /* If the maximum extent we found is big enough to fulfill the
+          minimum requirements, use it anyway. */
+       if (maxext.len) {
+               *rbm = maxext.rbm;
+               *minext = maxext.len;
+               return 0;
+       }
+
        return -ENOSPC;
 }
 
@@ -1680,7 +1732,8 @@ static void try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, u64 skip
 
        while (1) {
                down_write(&sdp->sd_log_flush_lock);
-               error = gfs2_rbm_find(&rbm, GFS2_BLKST_UNLINKED, 0, NULL, true);
+               error = gfs2_rbm_find(&rbm, GFS2_BLKST_UNLINKED, NULL, NULL,
+                                     true, NULL);
                up_write(&sdp->sd_log_flush_lock);
                if (error == -ENOSPC)
                        break;
@@ -1891,7 +1944,9 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, const struct gfs2_alloc_parms *a
                }
 
                /* Skip unuseable resource groups */
-               if (rs->rs_rbm.rgd->rd_flags & (GFS2_RGF_NOALLOC | GFS2_RDF_ERROR))
+               if ((rs->rs_rbm.rgd->rd_flags & (GFS2_RGF_NOALLOC |
+                                                GFS2_RDF_ERROR)) ||
+                   (ap->target > rs->rs_rbm.rgd->rd_extfail_pt))
                        goto skip_rgrp;
 
                if (sdp->sd_args.ar_rgrplvb)
@@ -1911,15 +1966,16 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, const struct gfs2_alloc_parms *a
                        return 0;
                }
 
-               /* Drop reservation, if we couldn't use reserved rgrp */
-               if (gfs2_rs_active(rs))
-                       gfs2_rs_deltree(rs);
 check_rgrp:
                /* Check for unlinked inodes which can be reclaimed */
                if (rs->rs_rbm.rgd->rd_flags & GFS2_RDF_CHECK)
                        try_rgrp_unlink(rs->rs_rbm.rgd, &last_unlinked,
                                        ip->i_no_addr);
 skip_rgrp:
+               /* Drop reservation, if we couldn't use reserved rgrp */
+               if (gfs2_rs_active(rs))
+                       gfs2_rs_deltree(rs);
+
                /* Unlock rgrp if required */
                if (!rg_locked)
                        gfs2_glock_dq_uninit(&rs->rs_rgd_gh);
@@ -2072,10 +2128,10 @@ int gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl)
 
        if (rgd == NULL)
                return 0;
-       gfs2_print_dbg(seq, " R: n:%llu f:%02x b:%u/%u i:%u r:%u\n",
+       gfs2_print_dbg(seq, " R: n:%llu f:%02x b:%u/%u i:%u r:%u e:%u\n",
                       (unsigned long long)rgd->rd_addr, rgd->rd_flags,
                       rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes,
-                      rgd->rd_reserved);
+                      rgd->rd_reserved, rgd->rd_extfail_pt);
        spin_lock(&rgd->rd_rsspin);
        for (n = rb_first(&rgd->rd_rstree); n; n = rb_next(&trs->rs_node)) {
                trs = rb_entry(n, struct gfs2_blkreserv, rs_node);
@@ -2184,18 +2240,20 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
        int error;
 
        gfs2_set_alloc_start(&rbm, ip, dinode);
-       error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, 0, ip, false);
+       error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, NULL, ip, false, NULL);
 
        if (error == -ENOSPC) {
                gfs2_set_alloc_start(&rbm, ip, dinode);
-               error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, 0, NULL, false);
+               error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, NULL, NULL, false,
+                                     NULL);
        }
 
        /* Since all blocks are reserved in advance, this shouldn't happen */
        if (error) {
-               fs_warn(sdp, "inum=%llu error=%d, nblocks=%u, full=%d\n",
+               fs_warn(sdp, "inum=%llu error=%d, nblocks=%u, full=%d fail_pt=%d\n",
                        (unsigned long long)ip->i_no_addr, error, *nblocks,
-                       test_bit(GBF_FULL, &rbm.rgd->rd_bits->bi_flags));
+                       test_bit(GBF_FULL, &rbm.rgd->rd_bits->bi_flags),
+                       rbm.rgd->rd_extfail_pt);
                goto rgrp_error;
        }
 
index 52032647dd4a32f7c8efaea95227634071f8d7d3..5fa344afb49ae8642be889ce2b3f69d176af548e 100644 (file)
@@ -702,7 +702,7 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid)
        read_lock(&journal->j_state_lock);
 #ifdef CONFIG_JBD2_DEBUG
        if (!tid_geq(journal->j_commit_request, tid)) {
-               printk(KERN_EMERG
+               printk(KERN_ERR
                       "%s: error: j_commit_request=%d, tid=%d\n",
                       __func__, journal->j_commit_request, tid);
        }
@@ -718,10 +718,8 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid)
        }
        read_unlock(&journal->j_state_lock);
 
-       if (unlikely(is_journal_aborted(journal))) {
-               printk(KERN_EMERG "journal commit I/O error\n");
+       if (unlikely(is_journal_aborted(journal)))
                err = -EIO;
-       }
        return err;
 }
 
@@ -1527,13 +1525,13 @@ static int journal_get_superblock(journal_t *journal)
        if (JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM) &&
            JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) {
                /* Can't have checksum v1 and v2 on at the same time! */
-               printk(KERN_ERR "JBD: Can't enable checksumming v1 and v2 "
+               printk(KERN_ERR "JBD2: Can't enable checksumming v1 and v2 "
                       "at the same time!\n");
                goto out;
        }
 
        if (!jbd2_verify_csum_type(journal, sb)) {
-               printk(KERN_ERR "JBD: Unknown checksum type\n");
+               printk(KERN_ERR "JBD2: Unknown checksum type\n");
                goto out;
        }
 
@@ -1541,7 +1539,7 @@ static int journal_get_superblock(journal_t *journal)
        if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) {
                journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
                if (IS_ERR(journal->j_chksum_driver)) {
-                       printk(KERN_ERR "JBD: Cannot load crc32c driver.\n");
+                       printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n");
                        err = PTR_ERR(journal->j_chksum_driver);
                        journal->j_chksum_driver = NULL;
                        goto out;
@@ -1550,7 +1548,7 @@ static int journal_get_superblock(journal_t *journal)
 
        /* Check superblock checksum */
        if (!jbd2_superblock_csum_verify(journal, sb)) {
-               printk(KERN_ERR "JBD: journal checksum error\n");
+               printk(KERN_ERR "JBD2: journal checksum error\n");
                goto out;
        }
 
@@ -1836,7 +1834,7 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat,
                        journal->j_chksum_driver = crypto_alloc_shash("crc32c",
                                                                      0, 0);
                        if (IS_ERR(journal->j_chksum_driver)) {
-                               printk(KERN_ERR "JBD: Cannot load crc32c "
+                               printk(KERN_ERR "JBD2: Cannot load crc32c "
                                       "driver.\n");
                                journal->j_chksum_driver = NULL;
                                return 0;
@@ -2645,7 +2643,7 @@ static void __exit journal_exit(void)
 #ifdef CONFIG_JBD2_DEBUG
        int n = atomic_read(&nr_journal_heads);
        if (n)
-               printk(KERN_EMERG "JBD2: leaked %d journal_heads!\n", n);
+               printk(KERN_ERR "JBD2: leaked %d journal_heads!\n", n);
 #endif
        jbd2_remove_jbd_stats_proc_entry();
        jbd2_journal_destroy_caches();
index 3929c50428b1a289d4024fcbe673276f63ff97c0..3b6bb19d60b17abceadec4c38df5d3570c0fcba9 100644 (file)
@@ -594,7 +594,7 @@ static int do_one_pass(journal_t *journal,
                                                be32_to_cpu(tmp->h_sequence))) {
                                                brelse(obh);
                                                success = -EIO;
-                                               printk(KERN_ERR "JBD: Invalid "
+                                               printk(KERN_ERR "JBD2: Invalid "
                                                       "checksum recovering "
                                                       "block %llu in log\n",
                                                       blocknr);
index 7aa9a32573bba885d166e484c367bffc06bcd9e2..8360674c85bcb98af88d6aaff3ee4c46fe6f31bf 100644 (file)
@@ -932,7 +932,7 @@ repeat:
                                        jbd2_alloc(jh2bh(jh)->b_size,
                                                         GFP_NOFS);
                                if (!frozen_buffer) {
-                                       printk(KERN_EMERG
+                                       printk(KERN_ERR
                                               "%s: OOM for frozen_buffer\n",
                                               __func__);
                                        JBUFFER_TRACE(jh, "oom!");
@@ -1166,7 +1166,7 @@ repeat:
        if (!jh->b_committed_data) {
                committed_data = jbd2_alloc(jh2bh(jh)->b_size, GFP_NOFS);
                if (!committed_data) {
-                       printk(KERN_EMERG "%s: No memory for committed data\n",
+                       printk(KERN_ERR "%s: No memory for committed data\n",
                                __func__);
                        err = -ENOMEM;
                        goto out;
@@ -1290,7 +1290,10 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
                 * once a transaction -bzzz
                 */
                jh->b_modified = 1;
-               J_ASSERT_JH(jh, handle->h_buffer_credits > 0);
+               if (handle->h_buffer_credits <= 0) {
+                       ret = -ENOSPC;
+                       goto out_unlock_bh;
+               }
                handle->h_buffer_credits--;
        }
 
@@ -1305,7 +1308,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
                JBUFFER_TRACE(jh, "fastpath");
                if (unlikely(jh->b_transaction !=
                             journal->j_running_transaction)) {
-                       printk(KERN_EMERG "JBD: %s: "
+                       printk(KERN_ERR "JBD2: %s: "
                               "jh->b_transaction (%llu, %p, %u) != "
                               "journal->j_running_transaction (%p, %u)",
                               journal->j_devname,
@@ -1332,7 +1335,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
                JBUFFER_TRACE(jh, "already on other transaction");
                if (unlikely(jh->b_transaction !=
                             journal->j_committing_transaction)) {
-                       printk(KERN_EMERG "JBD: %s: "
+                       printk(KERN_ERR "JBD2: %s: "
                               "jh->b_transaction (%llu, %p, %u) != "
                               "journal->j_committing_transaction (%p, %u)",
                               journal->j_devname,
@@ -1345,7 +1348,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
                        ret = -EINVAL;
                }
                if (unlikely(jh->b_next_transaction != transaction)) {
-                       printk(KERN_EMERG "JBD: %s: "
+                       printk(KERN_ERR "JBD2: %s: "
                               "jh->b_next_transaction (%llu, %p, %u) != "
                               "transaction (%p, %u)",
                               journal->j_devname,
@@ -1373,7 +1376,6 @@ out_unlock_bh:
        jbd2_journal_put_journal_head(jh);
 out:
        JBUFFER_TRACE(jh, "exit");
-       WARN_ON(ret);   /* All errors are bugs, so dump the stack */
        return ret;
 }
 
index 9c501449450dc9be6891e5d9c1a035ca31b5687b..427bb73e298f197d4cfc73b17baeffdd1c848c5d 100644 (file)
@@ -245,8 +245,8 @@ static int logfs_mtd_can_write_buf(struct super_block *sb, u64 ofs)
                goto out;
        if (memchr_inv(buf, 0xff, super->s_writesize))
                err = -EIO;
-       kfree(buf);
 out:
+       kfree(buf);
        return err;
 }
 
index 54360293bcb5cd0680c3042e6f0b9b87e342c649..b256c0690e5b66f5b16a2b81be033cc3b345dec6 100644 (file)
@@ -287,14 +287,14 @@ static int logfs_make_writeable(struct super_block *sb)
        if (err)
                return err;
 
+       /* Do one GC pass before any data gets dirtied */
+       logfs_gc_pass(sb);
+
        /* Check areas for trailing unaccounted data */
        err = logfs_check_areas(sb);
        if (err)
                return err;
 
-       /* Do one GC pass before any data gets dirtied */
-       logfs_gc_pass(sb);
-
        /* after all initializations are done, replay the journal
         * for rw-mounts, if necessary */
        err = logfs_replay_journal(sb);
index b4a160a405ce2b60f64255433c1555a4284c61e9..c1b7a80b6704850bde97a9573d8dcde01c813366 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/sunrpc/auth.h>
 #include <linux/sunrpc/xprt.h>
 #include <linux/sunrpc/bc_xprt.h>
+#include <linux/sunrpc/rpc_pipe_fs.h>
 #include "internal.h"
 #include "callback.h"
 #include "delegation.h"
@@ -370,7 +371,11 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp,
                __set_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags);
        __set_bit(NFS_CS_DISCRTRY, &clp->cl_flags);
        __set_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags);
-       error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_GSS_KRB5I);
+
+       error = -EINVAL;
+       if (gssd_running(clp->cl_net))
+               error = nfs_create_rpc_client(clp, timeparms,
+                                             RPC_AUTH_GSS_KRB5I);
        if (error == -EINVAL)
                error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_UNIX);
        if (error < 0)
index 5be2868c02f15e63c33eaea848f077e1e7b3d889..8c21d69a9dc114c8781dc8ae3171f17f67fb4a8d 100644 (file)
@@ -3097,7 +3097,8 @@ out_overflow:
        return -EIO;
 }
 
-static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
+static bool __decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected,
+               int *nfs_retval)
 {
        __be32 *p;
        uint32_t opnum;
@@ -3107,19 +3108,32 @@ static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
        if (unlikely(!p))
                goto out_overflow;
        opnum = be32_to_cpup(p++);
-       if (opnum != expected) {
-               dprintk("nfs: Server returned operation"
-                       " %d but we issued a request for %d\n",
-                               opnum, expected);
-               return -EIO;
-       }
+       if (unlikely(opnum != expected))
+               goto out_bad_operation;
        nfserr = be32_to_cpup(p);
-       if (nfserr != NFS_OK)
-               return nfs4_stat_to_errno(nfserr);
-       return 0;
+       if (nfserr == NFS_OK)
+               *nfs_retval = 0;
+       else
+               *nfs_retval = nfs4_stat_to_errno(nfserr);
+       return true;
+out_bad_operation:
+       dprintk("nfs: Server returned operation"
+               " %d but we issued a request for %d\n",
+                       opnum, expected);
+       *nfs_retval = -EREMOTEIO;
+       return false;
 out_overflow:
        print_overflow_msg(__func__, xdr);
-       return -EIO;
+       *nfs_retval = -EIO;
+       return false;
+}
+
+static int decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
+{
+       int retval;
+
+       __decode_op_hdr(xdr, expected, &retval);
+       return retval;
 }
 
 /* Dummy routine */
@@ -5001,11 +5015,12 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
        uint32_t savewords, bmlen, i;
        int status;
 
-       status = decode_op_hdr(xdr, OP_OPEN);
-       if (status != -EIO)
-               nfs_increment_open_seqid(status, res->seqid);
-       if (!status)
-               status = decode_stateid(xdr, &res->stateid);
+       if (!__decode_op_hdr(xdr, OP_OPEN, &status))
+               return status;
+       nfs_increment_open_seqid(status, res->seqid);
+       if (status)
+               return status;
+       status = decode_stateid(xdr, &res->stateid);
        if (unlikely(status))
                return status;
 
index b94f93685093edb4f2d189238989d3024fffa246..35e7d08fe629dfcb79553bcdcdf39af03b5e4960 100644 (file)
@@ -609,7 +609,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
        struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
        struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
        struct sysfs_open_file *of;
-       bool has_read, has_write, has_mmap;
+       bool has_read, has_write;
        int error = -EACCES;
 
        /* need attr_sd for attr and ops, its parent for kobj */
@@ -621,7 +621,6 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
 
                has_read = battr->read || battr->mmap;
                has_write = battr->write || battr->mmap;
-               has_mmap = battr->mmap;
        } else {
                const struct sysfs_ops *ops = sysfs_file_ops(attr_sd);
 
@@ -633,7 +632,6 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
 
                has_read = ops->show;
                has_write = ops->store;
-               has_mmap = false;
        }
 
        /* check perms and supported operations */
@@ -661,9 +659,9 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
         * open file has a separate mutex, it's okay as long as those don't
         * happen on the same file.  At this point, we can't easily give
         * each file a separate locking class.  Let's differentiate on
-        * whether the file has mmap or not for now.
+        * whether the file is bin or not for now.
         */
-       if (has_mmap)
+       if (sysfs_is_bin(attr_sd))
                mutex_init(&of->mutex);
        else
                mutex_init(&of->mutex);
index c7f0b77dcb0090046b84eda27c68d870af25d45a..ce01c1a17cc14a85fac80ab924825cd256eaa0d6 100644 (file)
@@ -1602,12 +1602,11 @@ xfs_free_buftarg(
        kmem_free(btp);
 }
 
-STATIC int
-xfs_setsize_buftarg_flags(
+int
+xfs_setsize_buftarg(
        xfs_buftarg_t           *btp,
        unsigned int            blocksize,
-       unsigned int            sectorsize,
-       int                     verbose)
+       unsigned int            sectorsize)
 {
        btp->bt_bsize = blocksize;
        btp->bt_sshift = ffs(sectorsize) - 1;
@@ -1628,26 +1627,17 @@ xfs_setsize_buftarg_flags(
 }
 
 /*
- *     When allocating the initial buffer target we have not yet
- *     read in the superblock, so don't know what sized sectors
- *     are being used at this early stage.  Play safe.
+ * When allocating the initial buffer target we have not yet
+ * read in the superblock, so don't know what sized sectors
+ * are being used at this early stage.  Play safe.
  */
 STATIC int
 xfs_setsize_buftarg_early(
        xfs_buftarg_t           *btp,
        struct block_device     *bdev)
 {
-       return xfs_setsize_buftarg_flags(btp,
-                       PAGE_SIZE, bdev_logical_block_size(bdev), 0);
-}
-
-int
-xfs_setsize_buftarg(
-       xfs_buftarg_t           *btp,
-       unsigned int            blocksize,
-       unsigned int            sectorsize)
-{
-       return xfs_setsize_buftarg_flags(btp, blocksize, sectorsize, 1);
+       return xfs_setsize_buftarg(btp, PAGE_SIZE,
+                                  bdev_logical_block_size(bdev));
 }
 
 xfs_buftarg_t *
index 56369d4509d5603cff44adeb17902324a547f48b..48c7d18f68c3fb23a89a31a955fc9250fbd63108 100644 (file)
@@ -2067,12 +2067,12 @@ xfs_dir2_node_lookup(
  */
 int                                            /* error */
 xfs_dir2_node_removename(
-       xfs_da_args_t           *args)          /* operation arguments */
+       struct xfs_da_args      *args)          /* operation arguments */
 {
-       xfs_da_state_blk_t      *blk;           /* leaf block */
+       struct xfs_da_state_blk *blk;           /* leaf block */
        int                     error;          /* error return value */
        int                     rval;           /* operation return value */
-       xfs_da_state_t          *state;         /* btree cursor */
+       struct xfs_da_state     *state;         /* btree cursor */
 
        trace_xfs_dir2_node_removename(args);
 
@@ -2084,19 +2084,18 @@ xfs_dir2_node_removename(
        state->mp = args->dp->i_mount;
        state->blocksize = state->mp->m_dirblksize;
        state->node_ents = state->mp->m_dir_node_ents;
-       /*
-        * Look up the entry we're deleting, set up the cursor.
-        */
+
+       /* Look up the entry we're deleting, set up the cursor. */
        error = xfs_da3_node_lookup_int(state, &rval);
        if (error)
-               rval = error;
-       /*
-        * Didn't find it, upper layer screwed up.
-        */
+               goto out_free;
+
+       /* Didn't find it, upper layer screwed up. */
        if (rval != EEXIST) {
-               xfs_da_state_free(state);
-               return rval;
+               error = rval;
+               goto out_free;
        }
+
        blk = &state->path.blk[state->path.active - 1];
        ASSERT(blk->magic == XFS_DIR2_LEAFN_MAGIC);
        ASSERT(state->extravalid);
@@ -2107,7 +2106,7 @@ xfs_dir2_node_removename(
        error = xfs_dir2_leafn_remove(args, blk->bp, blk->index,
                &state->extrablk, &rval);
        if (error)
-               return error;
+               goto out_free;
        /*
         * Fix the hash values up the btree.
         */
@@ -2122,6 +2121,7 @@ xfs_dir2_node_removename(
         */
        if (!error)
                error = xfs_dir2_node_to_leaf(state);
+out_free:
        xfs_da_state_free(state);
        return error;
 }
index 8367d6dc18c9df7f51cd565e11395cba24929a53..4f11ef0111395bbb7775407e9039e92cad0a932d 100644 (file)
@@ -157,7 +157,7 @@ xfs_ioc_trim(
        struct xfs_mount                *mp,
        struct fstrim_range __user      *urange)
 {
-       struct request_queue    *q = mp->m_ddev_targp->bt_bdev->bd_disk->queue;
+       struct request_queue    *q = bdev_get_queue(mp->m_ddev_targp->bt_bdev);
        unsigned int            granularity = q->limits.discard_granularity;
        struct fstrim_range     range;
        xfs_daddr_t             start, end, minlen;
@@ -180,7 +180,8 @@ xfs_ioc_trim(
         * matter as trimming blocks is an advisory interface.
         */
        if (range.start >= XFS_FSB_TO_B(mp, mp->m_sb.sb_dblocks) ||
-           range.minlen > XFS_FSB_TO_B(mp, XFS_ALLOC_AG_MAX_USABLE(mp)))
+           range.minlen > XFS_FSB_TO_B(mp, XFS_ALLOC_AG_MAX_USABLE(mp)) ||
+           range.len < mp->m_sb.sb_blocksize)
                return -XFS_ERROR(EINVAL);
 
        start = BTOBB(range.start);
index a6e54b3319bd0f5deb573623f332486590fbe165..02fb943cbf22b36b4e6da8c66b03be8839dc03d4 100644 (file)
@@ -220,6 +220,8 @@ xfs_growfs_data_private(
         */
        nfree = 0;
        for (agno = nagcount - 1; agno >= oagcount; agno--, new -= agsize) {
+               __be32  *agfl_bno;
+
                /*
                 * AG freespace header block
                 */
@@ -279,8 +281,10 @@ xfs_growfs_data_private(
                        agfl->agfl_seqno = cpu_to_be32(agno);
                        uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_uuid);
                }
+
+               agfl_bno = XFS_BUF_TO_AGFL_BNO(mp, bp);
                for (bucket = 0; bucket < XFS_AGFL_SIZE(mp); bucket++)
-                       agfl->agfl_bno[bucket] = cpu_to_be32(NULLAGBLOCK);
+                       agfl_bno[bucket] = cpu_to_be32(NULLAGBLOCK);
 
                error = xfs_bwrite(bp);
                xfs_buf_relse(bp);
index 4d613401a5e056a08dd2f8b21b77833bfe14cbc6..33ad9a77791f7ebbf3f8762e0c9df1af637c5328 100644 (file)
@@ -442,7 +442,8 @@ xfs_attrlist_by_handle(
                return -XFS_ERROR(EPERM);
        if (copy_from_user(&al_hreq, arg, sizeof(xfs_fsop_attrlist_handlereq_t)))
                return -XFS_ERROR(EFAULT);
-       if (al_hreq.buflen > XATTR_LIST_MAX)
+       if (al_hreq.buflen < sizeof(struct attrlist) ||
+           al_hreq.buflen > XATTR_LIST_MAX)
                return -XFS_ERROR(EINVAL);
 
        /*
index e8fb1231db8124dc08b2ffbcc551d6bfa1bc21f5..a7992f8de9d3fa53a63ab2d3250f0c4933caded9 100644 (file)
@@ -356,7 +356,8 @@ xfs_compat_attrlist_by_handle(
        if (copy_from_user(&al_hreq, arg,
                           sizeof(compat_xfs_fsop_attrlist_handlereq_t)))
                return -XFS_ERROR(EFAULT);
-       if (al_hreq.buflen > XATTR_LIST_MAX)
+       if (al_hreq.buflen < sizeof(struct attrlist) ||
+           al_hreq.buflen > XATTR_LIST_MAX)
                return -XFS_ERROR(EINVAL);
 
        /*
index 27e0e544e9635ba47281279c68670f7e568a7a58..5762282895a52a3b247e5363d7a888863b982110 100644 (file)
@@ -459,14 +459,12 @@ xfs_vn_getattr(
 
 static void
 xfs_setattr_mode(
-       struct xfs_trans        *tp,
        struct xfs_inode        *ip,
        struct iattr            *iattr)
 {
-       struct inode    *inode = VFS_I(ip);
-       umode_t         mode = iattr->ia_mode;
+       struct inode            *inode = VFS_I(ip);
+       umode_t                 mode = iattr->ia_mode;
 
-       ASSERT(tp);
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 
        ip->i_d.di_mode &= S_IFMT;
@@ -476,6 +474,32 @@ xfs_setattr_mode(
        inode->i_mode |= mode & ~S_IFMT;
 }
 
+static void
+xfs_setattr_time(
+       struct xfs_inode        *ip,
+       struct iattr            *iattr)
+{
+       struct inode            *inode = VFS_I(ip);
+
+       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
+
+       if (iattr->ia_valid & ATTR_ATIME) {
+               inode->i_atime = iattr->ia_atime;
+               ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec;
+               ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec;
+       }
+       if (iattr->ia_valid & ATTR_CTIME) {
+               inode->i_ctime = iattr->ia_ctime;
+               ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
+               ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
+       }
+       if (iattr->ia_valid & ATTR_MTIME) {
+               inode->i_mtime = iattr->ia_mtime;
+               ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
+               ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
+       }
+}
+
 int
 xfs_setattr_nonsize(
        struct xfs_inode        *ip,
@@ -629,30 +653,10 @@ xfs_setattr_nonsize(
                }
        }
 
-       /*
-        * Change file access modes.
-        */
        if (mask & ATTR_MODE)
-               xfs_setattr_mode(tp, ip, iattr);
-
-       /*
-        * Change file access or modified times.
-        */
-       if (mask & ATTR_ATIME) {
-               inode->i_atime = iattr->ia_atime;
-               ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec;
-               ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec;
-       }
-       if (mask & ATTR_CTIME) {
-               inode->i_ctime = iattr->ia_ctime;
-               ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
-               ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
-       }
-       if (mask & ATTR_MTIME) {
-               inode->i_mtime = iattr->ia_mtime;
-               ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
-               ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
-       }
+               xfs_setattr_mode(ip, iattr);
+       if (mask & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME))
+               xfs_setattr_time(ip, iattr);
 
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
 
@@ -867,22 +871,10 @@ xfs_setattr_size(
                xfs_inode_clear_eofblocks_tag(ip);
        }
 
-       /*
-        * Change file access modes.
-        */
        if (mask & ATTR_MODE)
-               xfs_setattr_mode(tp, ip, iattr);
-
-       if (mask & ATTR_CTIME) {
-               inode->i_ctime = iattr->ia_ctime;
-               ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
-               ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
-       }
-       if (mask & ATTR_MTIME) {
-               inode->i_mtime = iattr->ia_mtime;
-               ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
-               ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
-       }
+               xfs_setattr_mode(ip, iattr);
+       if (mask & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME))
+               xfs_setattr_time(ip, iattr);
 
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
 
index b6b669df40f3ab335e75cd3a67903601be0128a4..07ab52ca8aba5786b9df50719be58457542d4db4 100644 (file)
@@ -1651,6 +1651,7 @@ xlog_recover_reorder_trans(
        int                     pass)
 {
        xlog_recover_item_t     *item, *n;
+       int                     error = 0;
        LIST_HEAD(sort_list);
        LIST_HEAD(cancel_list);
        LIST_HEAD(buffer_list);
@@ -1692,9 +1693,17 @@ xlog_recover_reorder_trans(
                                "%s: unrecognized type of log operation",
                                __func__);
                        ASSERT(0);
-                       return XFS_ERROR(EIO);
+                       /*
+                        * return the remaining items back to the transaction
+                        * item list so they can be freed in caller.
+                        */
+                       if (!list_empty(&sort_list))
+                               list_splice_init(&sort_list, &trans->r_itemq);
+                       error = XFS_ERROR(EIO);
+                       goto out;
                }
        }
+out:
        ASSERT(list_empty(&sort_list));
        if (!list_empty(&buffer_list))
                list_splice(&buffer_list, &trans->r_itemq);
@@ -1704,7 +1713,7 @@ xlog_recover_reorder_trans(
                list_splice_tail(&inode_buffer_list, &trans->r_itemq);
        if (!list_empty(&cancel_list))
                list_splice_tail(&cancel_list, &trans->r_itemq);
-       return 0;
+       return error;
 }
 
 /*
@@ -3608,8 +3617,10 @@ xlog_recover_process_data(
                                error = XFS_ERROR(EIO);
                                break;
                        }
-                       if (error)
+                       if (error) {
+                               xlog_recover_free_trans(trans);
                                return error;
+                       }
                }
                dp += be32_to_cpu(ohead->oh_len);
                num_logops--;
index 14a4996cfec6cb4fbeaa1d3f8432548ebb57d48b..588e4909c58966b2f901d038b1a1a909d983f41b 100644 (file)
@@ -2082,24 +2082,21 @@ xfs_qm_vop_create_dqattach(
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
        ASSERT(XFS_IS_QUOTA_RUNNING(mp));
 
-       if (udqp) {
+       if (udqp && XFS_IS_UQUOTA_ON(mp)) {
                ASSERT(ip->i_udquot == NULL);
-               ASSERT(XFS_IS_UQUOTA_ON(mp));
                ASSERT(ip->i_d.di_uid == be32_to_cpu(udqp->q_core.d_id));
 
                ip->i_udquot = xfs_qm_dqhold(udqp);
                xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1);
        }
-       if (gdqp) {
+       if (gdqp && XFS_IS_GQUOTA_ON(mp)) {
                ASSERT(ip->i_gdquot == NULL);
-               ASSERT(XFS_IS_GQUOTA_ON(mp));
                ASSERT(ip->i_d.di_gid == be32_to_cpu(gdqp->q_core.d_id));
                ip->i_gdquot = xfs_qm_dqhold(gdqp);
                xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1);
        }
-       if (pdqp) {
+       if (pdqp && XFS_IS_PQUOTA_ON(mp)) {
                ASSERT(ip->i_pdquot == NULL);
-               ASSERT(XFS_IS_PQUOTA_ON(mp));
                ASSERT(xfs_get_projid(ip) == be32_to_cpu(pdqp->q_core.d_id));
 
                ip->i_pdquot = xfs_qm_dqhold(pdqp);
index a788b66a5cb1c7e73898c877b0c3629eeb8e17a7..797fd4636273657992a1124bff8e5865fe36ba28 100644 (file)
 
 #include "xfs_dquot_item.h"
 #include "xfs_dquot.h"
-#include "xfs_quota_priv.h"
 
 struct xfs_inode;
 
 extern struct kmem_zone        *xfs_qm_dqtrxzone;
 
+/*
+ * Number of bmaps that we ask from bmapi when doing a quotacheck.
+ * We make this restriction to keep the memory usage to a minimum.
+ */
+#define XFS_DQITER_MAP_SIZE    10
+
+#define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \
+       !dqp->q_core.d_blk_hardlimit && \
+       !dqp->q_core.d_blk_softlimit && \
+       !dqp->q_core.d_rtb_hardlimit && \
+       !dqp->q_core.d_rtb_softlimit && \
+       !dqp->q_core.d_ino_hardlimit && \
+       !dqp->q_core.d_ino_softlimit && \
+       !dqp->q_core.d_bcount && \
+       !dqp->q_core.d_rtbcount && \
+       !dqp->q_core.d_icount)
+
 /*
  * This defines the unit of allocation of dquots.
  * Currently, it is just one file system block, and a 4K blk contains 30
index 437c9198031a49a940aecaa441dc305de0e9a145..3daf5ea1eb8d73989a4e199aaee4dd2364a98290 100644 (file)
@@ -278,7 +278,7 @@ xfs_qm_scall_trunc_qfiles(
        xfs_mount_t     *mp,
        uint            flags)
 {
-       int             error = 0, error2 = 0;
+       int             error;
 
        if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) {
                xfs_debug(mp, "%s: flags=%x m_qflags=%x",
@@ -286,14 +286,20 @@ xfs_qm_scall_trunc_qfiles(
                return XFS_ERROR(EINVAL);
        }
 
-       if (flags & XFS_DQ_USER)
+       if (flags & XFS_DQ_USER) {
                error = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_uquotino);
-       if (flags & XFS_DQ_GROUP)
-               error2 = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_gquotino);
+               if (error)
+                       return error;
+       }
+       if (flags & XFS_DQ_GROUP) {
+               error = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_gquotino);
+               if (error)
+                       return error;
+       }
        if (flags & XFS_DQ_PROJ)
-               error2 = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_pquotino);
+               error = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_pquotino);
 
-       return error ? error : error2;
+       return error;
 }
 
 /*
diff --git a/fs/xfs/xfs_quota_priv.h b/fs/xfs/xfs_quota_priv.h
deleted file mode 100644 (file)
index 6d86219..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * 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.
- *
- * This program is distributed in the hope that it would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#ifndef __XFS_QUOTA_PRIV_H__
-#define __XFS_QUOTA_PRIV_H__
-
-/*
- * Number of bmaps that we ask from bmapi when doing a quotacheck.
- * We make this restriction to keep the memory usage to a minimum.
- */
-#define XFS_DQITER_MAP_SIZE    10
-
-#define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \
-       !dqp->q_core.d_blk_hardlimit && \
-       !dqp->q_core.d_blk_softlimit && \
-       !dqp->q_core.d_rtb_hardlimit && \
-       !dqp->q_core.d_rtb_softlimit && \
-       !dqp->q_core.d_ino_hardlimit && \
-       !dqp->q_core.d_ino_softlimit && \
-       !dqp->q_core.d_bcount && \
-       !dqp->q_core.d_rtbcount && \
-       !dqp->q_core.d_icount)
-
-#define DQFLAGTO_TYPESTR(d)    (((d)->dq_flags & XFS_DQ_USER) ? "USR" : \
-                                (((d)->dq_flags & XFS_DQ_GROUP) ? "GRP" : \
-                                (((d)->dq_flags & XFS_DQ_PROJ) ? "PRJ":"???")))
-
-#endif /* __XFS_QUOTA_PRIV_H__ */
index cd2a10e15d3ac5520661ed2877f2e5c9cdac48d9..41172861e857bf8c487f7adf3037aad0214b1681 100644 (file)
@@ -295,8 +295,8 @@ xfs_trans_mod_dquot(
 /*
  * Given an array of dqtrx structures, lock all the dquots associated and join
  * them to the transaction, provided they have been modified.  We know that the
- * highest number of dquots of one type - usr, grp OR prj - involved in a
- * transaction is 2 so we don't need to make this very generic.
+ * highest number of dquots of one type - usr, grp and prj - involved in a
+ * transaction is 3 so we don't need to make this very generic.
  */
 STATIC void
 xfs_trans_dqlockedjoin(
index 3e8e797c6d110ce01b0964a2e3845d8a59defd0b..e8a77383c0d5af630f4c154fa48e4d9ee345d95c 100644 (file)
@@ -34,15 +34,6 @@ struct attrlist_cursor_kern;
        { IO_ISDIRECT,  "DIRECT" }, \
        { IO_INVIS,     "INVIS"}
 
-/*
- * Flush/Invalidate options for vop_toss/flush/flushinval_pages.
- */
-#define FI_NONE                        0       /* none */
-#define FI_REMAPF              1       /* Do a remapf prior to the operation */
-#define FI_REMAPF_LOCKED       2       /* Do a remapf prior to the operation.
-                                          Prevent VM access to the pages until
-                                          the operation completes. */
-
 /*
  * Some useful predicates.
  */
index c602c7718421ded2f2bbe50f1e76edc39ac2b6f2..7135fe3d6daa6ee76bca6238a63a1ba6be949d5b 100644 (file)
@@ -28,8 +28,6 @@
 
 #include <linux/device.h>
 
-#include <acpi/acpi.h>
-
 /* TBD: Make dynamic */
 #define ACPI_MAX_HANDLES       10
 struct acpi_handle_list {
@@ -91,17 +89,10 @@ struct acpi_device;
  * -----------------
  */
 
-enum acpi_hotplug_mode {
-       AHM_GENERIC = 0,
-       AHM_CONTAINER,
-       AHM_COUNT
-};
-
 struct acpi_hotplug_profile {
        struct kobject kobj;
        bool enabled:1;
-       bool ignore:1;
-       enum acpi_hotplug_mode mode;
+       int (*scan_dependent)(struct acpi_device *adev);
 };
 
 static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile(
@@ -169,7 +160,9 @@ struct acpi_device_flags {
        u32 ejectable:1;
        u32 power_manageable:1;
        u32 match_driver:1;
-       u32 reserved:27;
+       u32 initialized:1;
+       u32 visited:1;
+       u32 reserved:25;
 };
 
 /* File System */
@@ -299,6 +292,7 @@ struct acpi_device {
        struct list_head children;
        struct list_head node;
        struct list_head wakeup_list;
+       struct list_head del_list;
        struct acpi_device_status status;
        struct acpi_device_flags flags;
        struct acpi_device_pnp pnp;
@@ -324,6 +318,11 @@ static inline void *acpi_driver_data(struct acpi_device *d)
 #define to_acpi_device(d)      container_of(d, struct acpi_device, dev)
 #define to_acpi_driver(d)      container_of(d, struct acpi_driver, drv)
 
+static inline void acpi_set_device_status(struct acpi_device *adev, u32 sta)
+{
+       *((u32 *)&adev->status) = sta;
+}
+
 /* acpi_device.dev.bus == &acpi_bus_type */
 extern struct bus_type acpi_bus_type;
 
@@ -385,6 +384,11 @@ int acpi_match_device_ids(struct acpi_device *device,
 int acpi_create_dir(struct acpi_device *);
 void acpi_remove_dir(struct acpi_device *);
 
+static inline bool acpi_device_enumerated(struct acpi_device *adev)
+{
+       return adev && adev->flags.initialized && adev->flags.visited;
+}
+
 typedef void (*acpi_hp_callback)(void *data, u32 src);
 
 acpi_status acpi_hotplug_execute(acpi_hp_callback func, void *data, u32 src);
@@ -408,7 +412,7 @@ struct acpi_bus_type {
        struct list_head list;
        const char *name;
        bool (*match)(struct device *dev);
-       int (*find_device) (struct device *, acpi_handle *);
+       struct acpi_device * (*find_companion)(struct device *);
        void (*setup)(struct device *);
        void (*cleanup)(struct device *);
 };
@@ -427,12 +431,9 @@ struct acpi_pci_root {
 };
 
 /* helper */
-acpi_handle acpi_find_child(acpi_handle, u64, bool);
-static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr)
-{
-       return acpi_find_child(handle, addr, false);
-}
-void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr);
+
+struct acpi_device *acpi_find_child_device(struct acpi_device *parent,
+                                          u64 address, bool check_children);
 int acpi_is_root_bridge(acpi_handle);
 struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
 
index 1cedfcb1bd8878ff7466e4ab6d9285e3a811a90a..b124fdb260469bfa07dbc14fa511cb7dbd0240e2 100644 (file)
@@ -26,9 +26,6 @@
 #ifndef __ACPI_DRIVERS_H__
 #define __ACPI_DRIVERS_H__
 
-#include <linux/acpi.h>
-#include <acpi/acpi_bus.h>
-
 #define ACPI_MAX_STRING                        80
 
 /*
index 64ebede184f10d588ab251a11efe8df9f016d358..6a626a507b8ca2d9c1a167b0758c7d7d3604013e 100644 (file)
@@ -44,7 +44,7 @@ static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg)
        if (sg_is_last(sg))
                return NULL;
 
-       return (++sg)->length ? sg : (void *)sg_page(sg);
+       return (++sg)->length ? sg : sg_chain_ptr(sg);
 }
 
 static inline void scatterwalk_crypto_chain(struct scatterlist *head,
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
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..46f7495ae3870c12a511b558b7970b8b4151e538 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_END                 133
 
 #endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */
diff --git a/include/dt-bindings/clock/mpc512x-clock.h b/include/dt-bindings/clock/mpc512x-clock.h
new file mode 100644 (file)
index 0000000..9e81b3b
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * This header provides constants for MPC512x clock specs in DT bindings.
+ */
+
+#ifndef _DT_BINDINGS_CLOCK_MPC512x_CLOCK_H
+#define _DT_BINDINGS_CLOCK_MPC512x_CLOCK_H
+
+#define MPC512x_CLK_DUMMY              0
+#define MPC512x_CLK_REF                        1
+#define MPC512x_CLK_SYS                        2
+#define MPC512x_CLK_DIU                        3
+#define MPC512x_CLK_VIU                        4
+#define MPC512x_CLK_CSB                        5
+#define MPC512x_CLK_E300               6
+#define MPC512x_CLK_IPS                        7
+#define MPC512x_CLK_FEC                        8
+#define MPC512x_CLK_SATA               9
+#define MPC512x_CLK_PATA               10
+#define MPC512x_CLK_NFC                        11
+#define MPC512x_CLK_LPC                        12
+#define MPC512x_CLK_MBX_BUS            13
+#define MPC512x_CLK_MBX                        14
+#define MPC512x_CLK_MBX_3D             15
+#define MPC512x_CLK_AXE                        16
+#define MPC512x_CLK_USB1               17
+#define MPC512x_CLK_USB2               18
+#define MPC512x_CLK_I2C                        19
+#define MPC512x_CLK_MSCAN0_MCLK                20
+#define MPC512x_CLK_MSCAN1_MCLK                21
+#define MPC512x_CLK_MSCAN2_MCLK                22
+#define MPC512x_CLK_MSCAN3_MCLK                23
+#define MPC512x_CLK_BDLC               24
+#define MPC512x_CLK_SDHC               25
+#define MPC512x_CLK_PCI                        26
+#define MPC512x_CLK_PSC_MCLK_IN                27
+#define MPC512x_CLK_SPDIF_TX           28
+#define MPC512x_CLK_SPDIF_RX           29
+#define MPC512x_CLK_SPDIF_MCLK         30
+#define MPC512x_CLK_SPDIF              31
+#define MPC512x_CLK_AC97               32
+#define MPC512x_CLK_PSC0_MCLK          33
+#define MPC512x_CLK_PSC1_MCLK          34
+#define MPC512x_CLK_PSC2_MCLK          35
+#define MPC512x_CLK_PSC3_MCLK          36
+#define MPC512x_CLK_PSC4_MCLK          37
+#define MPC512x_CLK_PSC5_MCLK          38
+#define MPC512x_CLK_PSC6_MCLK          39
+#define MPC512x_CLK_PSC7_MCLK          40
+#define MPC512x_CLK_PSC8_MCLK          41
+#define MPC512x_CLK_PSC9_MCLK          42
+#define MPC512x_CLK_PSC10_MCLK         43
+#define MPC512x_CLK_PSC11_MCLK         44
+#define MPC512x_CLK_PSC_FIFO           45
+#define MPC512x_CLK_PSC0               46
+#define MPC512x_CLK_PSC1               47
+#define MPC512x_CLK_PSC2               48
+#define MPC512x_CLK_PSC3               49
+#define MPC512x_CLK_PSC4               50
+#define MPC512x_CLK_PSC5               51
+#define MPC512x_CLK_PSC6               52
+#define MPC512x_CLK_PSC7               53
+#define MPC512x_CLK_PSC8               54
+#define MPC512x_CLK_PSC9               55
+#define MPC512x_CLK_PSC10              56
+#define MPC512x_CLK_PSC11              57
+
+#define MPC512x_CLK_LAST_PUBLIC                57
+
+#endif
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 d9099b15b4726404343308a39e5e55d39a16aa05..115c610324d1ec6b9ecc8aa3a67d839636ca35bf 100644 (file)
@@ -53,6 +53,12 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
 #define ACPI_COMPANION_SET(dev, adev)  ACPI_COMPANION(dev) = (adev)
 #define ACPI_HANDLE(dev)               acpi_device_handle(ACPI_COMPANION(dev))
 
+static inline void acpi_preset_companion(struct device *dev,
+                                        struct acpi_device *parent, u64 addr)
+{
+       ACPI_COMPANION_SET(dev, acpi_find_child_device(parent, addr, NULL));
+}
+
 static inline const char *acpi_dev_name(struct acpi_device *adev)
 {
        return dev_name(&adev->dev);
index b0ffa219993ec2be82a01854718d5e1269ef05bb..2a5a1391ce727b17d165298a416608841d266d63 100644 (file)
@@ -2,7 +2,7 @@
 #define _ACPI_IO_H_
 
 #include <linux/io.h>
-#include <acpi/acpi.h>
+#include <acpi/acpi.h> /* FIXME: inclusion should be removed */
 
 static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
                                            acpi_size size)
index 7e59253b86036b5d897a7b8e741c0ea3f5e4fdf4..534dc618f2d73314ef5374aff6b0eb27c89225a1 100644 (file)
@@ -512,6 +512,20 @@ static inline const char *of_clk_get_parent_name(struct device_node *np,
  * for improved portability across platforms
  */
 
+#if IS_ENABLED(CONFIG_PPC)
+
+static inline u32 clk_readl(u32 __iomem *reg)
+{
+       return ioread32be(reg);
+}
+
+static inline void clk_writel(u32 val, u32 __iomem *reg)
+{
+       iowrite32be(val, reg);
+}
+
+#else  /* platform dependent I/O accessors */
+
 static inline u32 clk_readl(u32 __iomem *reg)
 {
        return readl(reg);
@@ -522,5 +536,7 @@ static inline void clk_writel(u32 val, u32 __iomem *reg)
        writel(val, reg);
 }
 
+#endif /* platform dependent I/O accessors */
+
 #endif /* CONFIG_COMMON_CLK */
 #endif /* CLK_PROVIDER_H */
similarity index 98%
rename from arch/arm/mach-at91/include/mach/at91_pmc.h
rename to include/linux/clk/at91_pmc.h
index c604cc69acb5d790d0c1b1970e6dd8cffc7ad7e7..a6911ebbd02a024f3dffd028dc3d67fc13c0ef58 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * arch/arm/mach-at91/include/mach/at91_pmc.h
+ * include/linux/clk/at91_pmc.h
  *
  * Copyright (C) 2005 Ivan Kokshaysky
  * Copyright (C) SAN People
@@ -164,6 +164,8 @@ extern void __iomem *at91_pmc_base;
 #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 */
index ee5fe9d77ae8ef400031978a3990430b7aa57f4a..dc196bbcf227288bce4d4d3e2db60dae5cde3dec 100644 (file)
@@ -280,14 +280,6 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
                        policy->cpuinfo.max_freq);
 }
 
-#ifdef CONFIG_CPU_FREQ
-void cpufreq_suspend(void);
-void cpufreq_resume(void);
-#else
-static inline void cpufreq_suspend(void) {}
-static inline void cpufreq_resume(void) {}
-#endif
-
 /*********************************************************************
  *                     CPUFREQ NOTIFIER INTERFACE                    *
  *********************************************************************/
index bb942f6d5702912218abfc43134660dc0b4ea21f..aea5eedbb1ca042314fc9c422b420324bacdf063 100644 (file)
@@ -153,6 +153,14 @@ struct f2fs_extent {
 #define        NODE_DIND_BLOCK         (DEF_ADDRS_PER_INODE + 5)
 
 #define F2FS_INLINE_XATTR      0x01    /* file inline xattr flag */
+#define F2FS_INLINE_DATA       0x02    /* file inline data flag */
+
+
+#define MAX_INLINE_DATA                (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \
+                                               F2FS_INLINE_XATTR_ADDRS - 1))
+
+#define INLINE_DATA_OFFSET     (PAGE_CACHE_SIZE - sizeof(struct node_footer) \
+                               - sizeof(__le32)*(DEF_ADDRS_PER_INODE + 5 - 1))
 
 struct f2fs_inode {
        __le16 i_mode;                  /* file mode */
index 206a2af6b62b176fbbb16e2cca923053edc5877a..b914ca3f57ba4469264034cd521bf2cdc43b0cfb 100644 (file)
@@ -42,6 +42,8 @@ struct hid_sensor_hub_attribute_info {
        s32 units;
        s32 unit_expo;
        s32 size;
+       s32 logical_minimum;
+       s32 logical_maximum;
 };
 
 /**
index 4f945d3ed49fc7a511affdc307ea84aff60565cb..8323775ac21d0a86d2bda5a9ee93d2cfad181f78 100644 (file)
 #define HID_USAGE_SENSOR_PROP_REPORT_STATE                     0x200316
 #define HID_USAGE_SENSOR_PROY_POWER_STATE                      0x200319
 
+/* Power state enumerations */
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM               0x00
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM           0x01
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM            0x02
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM    0x03
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM      0x04
+#define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM            0x05
+
+/* Report State enumerations */
+#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM           0x00
+#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM          0x01
+
 #endif
index 46a14229a162cf2bc5cc5e5b096c10c120766d8d..93b5ca754b5b4c4931aa2b3f66cf246312cedbd8 100644 (file)
 #include <linux/completion.h>
 #include <linux/pm.h>
 #include <linux/mutex.h>
-#ifdef CONFIG_BLK_DEV_IDEACPI
-#include <acpi/acpi.h>
-#endif
-#include <asm/byteorder.h>
-#include <asm/io.h>
-
 /* for request_sense */
 #include <linux/cdrom.h>
+#include <asm/byteorder.h>
+#include <asm/io.h>
 
 #if defined(CONFIG_CRIS) || defined(CONFIG_FRV) || defined(CONFIG_MN10300)
 # define SUPPORT_VLB_SYNC 0
index 5d89d1b808a6cc896f22332c477126c3d2f2b563..c56c350324e4b4670ef8d31397a1a777b9c08578 100644 (file)
@@ -4,6 +4,7 @@
 #include <uapi/linux/ipv6.h>
 
 #define ipv6_optlen(p)  (((p)->hdrlen+1) << 3)
+#define ipv6_authlen(p) (((p)->hdrlen+2) << 2)
 /*
  * This structure contains configuration options per IPv6 link.
  */
diff --git a/include/linux/irqchip/xtensa-mx.h b/include/linux/irqchip/xtensa-mx.h
new file mode 100644 (file)
index 0000000..9c3b6ec
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Xtensa MX interrupt distributor
+ *
+ * Copyright (C) 2002 - 2013 Tensilica, Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#ifndef __LINUX_IRQCHIP_XTENSA_MX_H
+#define __LINUX_IRQCHIP_XTENSA_MX_H
+
+struct device_node;
+int xtensa_mx_init_legacy(struct device_node *interrupt_parent);
+
+#endif /* __LINUX_IRQCHIP_XTENSA_MX_H */
diff --git a/include/linux/irqchip/xtensa-pic.h b/include/linux/irqchip/xtensa-pic.h
new file mode 100644 (file)
index 0000000..48718ae
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Xtensa built-in interrupt controller
+ *
+ * Copyright (C) 2002 - 2013 Tensilica, Inc.
+ * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#ifndef __LINUX_IRQCHIP_XTENSA_PIC_H
+#define __LINUX_IRQCHIP_XTENSA_PIC_H
+
+struct device_node;
+int xtensa_pic_init_legacy(struct device_node *interrupt_parent);
+
+#endif /* __LINUX_IRQCHIP_XTENSA_PIC_H */
index 8ba7e5b9d62cb466f60cced5c8340261acf9fc4f..82f9673c2527c842dbd28f12a0bc6b0f7af96ed0 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef ISCSI_IBFT_H
 #define ISCSI_IBFT_H
 
-#include <acpi/acpi.h>
+#include <acpi/acpi.h> /* FIXME: inclusion should be removed */
 
 /*
  * Logical location of iSCSI Boot Format Table.
index d78d28a733b15afdc25a620ca5925f6619f82a2c..5fd33dc1fe3ad265d352ed48f3a8cdeec0ca646e 100644 (file)
@@ -198,6 +198,9 @@ extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
 extern size_t vmcoreinfo_size;
 extern size_t vmcoreinfo_max_size;
 
+/* flag to track if kexec reboot is in progress */
+extern bool kexec_in_progress;
+
 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
                unsigned long long *crash_size, unsigned long long *crash_base);
 int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
index 1cedd000cf293f4486575b87086b01e2ee1b26e5..a7b4e310bf42524338ee2504d21843cdd0abeab9 100644 (file)
@@ -1842,7 +1842,7 @@ static inline pgprot_t vm_get_page_prot(unsigned long vm_flags)
 }
 #endif
 
-#ifdef CONFIG_ARCH_USES_NUMA_PROT_NONE
+#ifdef CONFIG_NUMA_BALANCING
 unsigned long change_prot_numa(struct vm_area_struct *vma,
                        unsigned long start, unsigned long end);
 #endif
index 1084a15175e04ff0bc715e3e429aab7027d279f8..a13d6825e586972835ba2b3d53ac4ab504ba5369 100644 (file)
@@ -960,6 +960,7 @@ void pci_update_resource(struct pci_dev *dev, int resno);
 int __must_check pci_assign_resource(struct pci_dev *dev, int i);
 int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
 int pci_select_bars(struct pci_dev *dev, unsigned long flags);
+bool pci_device_is_present(struct pci_dev *pdev);
 
 /* ROM control related routines */
 int pci_enable_rom(struct pci_dev *pdev);
@@ -1567,65 +1568,65 @@ enum pci_fixup_pass {
 /* Anonymous variables would be nice... */
 #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class,        \
                                  class_shift, hook)                    \
-       static const struct pci_fixup __pci_fixup_##name __used         \
+       static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used       \
        __attribute__((__section__(#section), aligned((sizeof(void *)))))    \
                = { vendor, device, class, class_shift, hook };
 
 #define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class,           \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early,                     \
-               vendor##device##hook, vendor, device, class, class_shift, hook)
+               hook, vendor, device, class, class_shift, hook)
 #define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class,          \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header,                    \
-               vendor##device##hook, vendor, device, class, class_shift, hook)
+               hook, vendor, device, class, class_shift, hook)
 #define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class,           \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final,                     \
-               vendor##device##hook, vendor, device, class, class_shift, hook)
+               hook, vendor, device, class, class_shift, hook)
 #define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class,          \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable,                    \
-               vendor##device##hook, vendor, device, class, class_shift, hook)
+               hook, vendor, device, class, class_shift, hook)
 #define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class,          \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume,                    \
-               resume##vendor##device##hook, vendor, device, class,    \
+               resume##hook, vendor, device, class,    \
                class_shift, hook)
 #define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class,    \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early,              \
-               resume_early##vendor##device##hook, vendor, device,     \
+               resume_early##hook, vendor, device,     \
                class, class_shift, hook)
 #define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class,         \
                                         class_shift, hook)             \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend,                   \
-               suspend##vendor##device##hook, vendor, device, class,   \
+               suspend##hook, vendor, device, class,   \
                class_shift, hook)
 
 #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook)                  \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early,                     \
-               vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
+               hook, vendor, device, PCI_ANY_ID, 0, hook)
 #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook)                 \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header,                    \
-               vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
+               hook, vendor, device, PCI_ANY_ID, 0, hook)
 #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook)                  \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final,                     \
-               vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
+               hook, vendor, device, PCI_ANY_ID, 0, hook)
 #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook)                 \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable,                    \
-               vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
+               hook, vendor, device, PCI_ANY_ID, 0, hook)
 #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook)                 \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume,                    \
-               resume##vendor##device##hook, vendor, device,           \
+               resume##hook, vendor, device,           \
                PCI_ANY_ID, 0, hook)
 #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook)           \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early,              \
-               resume_early##vendor##device##hook, vendor, device,     \
+               resume_early##hook, vendor, device,     \
                PCI_ANY_ID, 0, hook)
 #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook)                        \
        DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend,                   \
-               suspend##vendor##device##hook, vendor, device,          \
+               suspend##hook, vendor, device,          \
                PCI_ANY_ID, 0, hook)
 
 #ifdef CONFIG_PCI_QUIRKS
index a2e2f1d17e164c00b190d6515ec90950ef288e17..5f2e559af6b0a7a6ea07247ab405ea48407d4e72 100644 (file)
@@ -175,8 +175,7 @@ struct hotplug_params {
 };
 
 #ifdef CONFIG_ACPI
-#include <acpi/acpi.h>
-#include <acpi/acpi_bus.h>
+#include <linux/acpi.h>
 int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp);
 int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
 int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
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 3a3942823c209163501b1dcd49a550d1664c56da..eabac4e2fc993b114ae940b1be960f04015ade0f 100644 (file)
@@ -43,6 +43,11 @@ struct sdma_script_start_addrs {
        s32 dptc_dvfs_addr;
        s32 utra_addr;
        s32 ram_code_start_addr;
+       /* End of v1 array */
+       s32 mcu_2_ssish_addr;
+       s32 ssish_2_mcu_addr;
+       s32 hdmi_dma_addr;
+       /* End of v2 array */
 };
 
 /**
index beac6b8b6a7b3846cf3925cab343da187fc686e1..bcbc6c3c14c0da82547b861e7108ccee41351f71 100644 (file)
@@ -39,6 +39,7 @@ enum sdma_peripheral_type {
        IMX_DMATYPE_IPU_MEMORY, /* IPU Memory */
        IMX_DMATYPE_ASRC,       /* ASRC */
        IMX_DMATYPE_ESAI,       /* ESAI */
+       IMX_DMATYPE_SSI_DUAL,   /* SSI Dual FIFO */
 };
 
 enum imx_dma_prio {
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 50fe651da965933f416b3cc6a5a0080942ac107e..3dbdf7e53dcc0942153be0a59cdeebd73caa0973 100644 (file)
 #define SCIx_NOT_SUPPORTED     (-1)
 
 enum {
+       SCBRR_ALGO_INVALID,
+
        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 */
+
+       SCBRR_NR_ALGOS,
 };
 
 #define SCSCR_TIE      (1 << 7)
index 631af63af42ddbaaabf6f8debcda035821cc71dc..2cfcb7944a493432d7e44088e0b9ccd13b16aafa 100644 (file)
@@ -60,7 +60,7 @@
 #define _LINUX_SFI_ACPI_H
 
 #ifdef CONFIG_SFI
-#include <acpi/acpi.h>         /* struct acpi_table_header */
+#include <acpi/acpi.h> /* FIXME: inclusion should be removed */
 
 extern int sfi_acpi_table_parse(char *signature, char *oem_id,
                                char *oem_table_id,
index bec1cc7d5e3c41efbc4939ab742eeb955b64b7f0..215b5ea1cb302c43f0e8b9532fbe3ce59ff0f612 100644 (file)
@@ -2263,6 +2263,24 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb,
 
 unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
 
+/**
+ *     pskb_trim_rcsum - trim received skb and update checksum
+ *     @skb: buffer to trim
+ *     @len: new length
+ *
+ *     This is exactly the same as pskb_trim except that it ensures the
+ *     checksum of received packets are still valid after the operation.
+ */
+
+static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
+{
+       if (likely(len >= skb->len))
+               return 0;
+       if (skb->ip_summed == CHECKSUM_COMPLETE)
+               skb->ip_summed = CHECKSUM_NONE;
+       return __pskb_trim(skb, len);
+}
+
 #define skb_queue_walk(queue, skb) \
                for (skb = (queue)->next;                                       \
                     skb != (struct sk_buff *)(queue);                          \
@@ -2360,27 +2378,6 @@ __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
 __wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
                    __wsum csum);
 
-/**
- *     pskb_trim_rcsum - trim received skb and update checksum
- *     @skb: buffer to trim
- *     @len: new length
- *
- *     This is exactly the same as pskb_trim except that it ensures the
- *     checksum of received packets are still valid after the operation.
- */
-
-static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
-{
-       if (likely(len >= skb->len))
-               return 0;
-       if (skb->ip_summed == CHECKSUM_COMPLETE) {
-               __wsum adj = skb_checksum(skb, len, skb->len - len, 0);
-
-               skb->csum = csum_sub(skb->csum, adj);
-       }
-       return __pskb_trim(skb, len);
-}
-
 static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
                                       int len, void *buffer)
 {
index a353e0300b54b97a63cf4b87baf28cacf91428b8..7f490bef9e99f9838294bbb674e3014a7128185b 100644 (file)
@@ -84,7 +84,8 @@ enum {
 
 extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
                                      const unsigned char *dir_name);
-extern void rpc_pipefs_init_net(struct net *net);
+extern int rpc_pipefs_init_net(struct net *net);
+extern void rpc_pipefs_exit_net(struct net *net);
 extern struct super_block *rpc_get_sb_net(const struct net *net);
 extern void rpc_put_sb_net(const struct net *net);
 
@@ -130,5 +131,7 @@ extern int rpc_unlink(struct dentry *);
 extern int register_rpc_pipefs(void);
 extern void unregister_rpc_pipefs(void);
 
+extern bool gssd_running(struct net *net);
+
 #endif
 #endif
index c75128bed5fa39116952fd148ff01374993b8f44..9a54b331f938fcfc02d66a22873b8d735369d8ad 100644 (file)
@@ -34,7 +34,7 @@ enum {
 };
 
 #ifdef CONFIG_INTEL_TXT
-#include <acpi/acpi.h>
+#include <linux/acpi.h>
 /* used to communicate between tboot and the launched kernel */
 
 #define TB_KEY_SIZE             64   /* 512 bits */
index 7454865ad14834f50a05dc9baf7f6d78ea3de7b8..512ab162832ccc0bb4b30f6210d083d762573b78 100644 (file)
@@ -1264,6 +1264,8 @@ typedef void (*usb_complete_t)(struct urb *);
  * @sg: scatter gather buffer list, the buffer size of each element in
  *     the list (except the last) must be divisible by the endpoint's
  *     max packet size if no_sg_constraint isn't set in 'struct usb_bus'
+ *     (FIXME: scatter-gather under xHCI is broken for periodic transfers.
+ *     Do not use urb->sg for interrupt endpoints for now, only bulk.)
  * @num_mapped_sgs: (internal) number of mapped sg entries
  * @num_sgs: number of entries in the sg list
  * @transfer_buffer_length: How big is transfer_buffer.  The transfer may
index 0c4d4ca370ec9ba2e88c90b5d9a34b1efc9bc557..eeb28329fa3c9a17087834e2bb2f4d054757a005 100644 (file)
@@ -271,6 +271,8 @@ static inline u8 wusb_key_index(int index, int type, int originator)
 #define WUSB_KEY_INDEX_TYPE_GTK                        2
 #define WUSB_KEY_INDEX_ORIGINATOR_HOST         0
 #define WUSB_KEY_INDEX_ORIGINATOR_DEVICE       1
+/* bits 0-3 used for the key index. */
+#define WUSB_KEY_INDEX_MAX                     15
 
 /* A CCM Nonce, defined in WUSB1.0[6.4.1] */
 struct aes_ccm_nonce {
index dff42025649b32cb03f84d359c0c213ec5617569..63fbba0740c2c2bfb35b4a29f6c146b0137f695d 100644 (file)
 #ifndef _LINUX_ZORRO_H
 #define _LINUX_ZORRO_H
 
-#include <linux/device.h>
-
-
-    /*
-     *  Each Zorro board has a 32-bit ID of the form
-     *
-     *      mmmmmmmmmmmmmmmmppppppppeeeeeeee
-     *
-     *  with
-     *
-     *      mmmmmmmmmmmmmmmm   16-bit Manufacturer ID (assigned by CBM (sigh))
-     *      pppppppp           8-bit Product ID (assigned by manufacturer)
-     *      eeeeeeee           8-bit Extended Product ID (currently only used
-     *                         for some GVP boards)
-     */
-
-
-#define ZORRO_MANUF(id)                ((id) >> 16)
-#define ZORRO_PROD(id)         (((id) >> 8) & 0xff)
-#define ZORRO_EPC(id)          ((id) & 0xff)
-
-#define ZORRO_ID(manuf, prod, epc) \
-    ((ZORRO_MANUF_##manuf << 16) | ((prod) << 8) | (epc))
-
-typedef __u32 zorro_id;
-
-
-/* Include the ID list */
-#include <linux/zorro_ids.h>
-
 
-    /*
-     *  GVP identifies most of its products through the 'extended product code'
-     *  (epc). The epc has to be ANDed with the GVP_PRODMASK before the
-     *  identification.
-     */
-
-#define GVP_PRODMASK                   (0xf8)
-#define GVP_SCSICLKMASK                        (0x01)
-
-enum GVP_flags {
-    GVP_IO             = 0x01,
-    GVP_ACCEL          = 0x02,
-    GVP_SCSI           = 0x04,
-    GVP_24BITDMA       = 0x08,
-    GVP_25BITDMA       = 0x10,
-    GVP_NOBANK         = 0x20,
-    GVP_14MHZ          = 0x40,
-};
-
-
-struct Node {
-    struct  Node *ln_Succ;     /* Pointer to next (successor) */
-    struct  Node *ln_Pred;     /* Pointer to previous (predecessor) */
-    __u8    ln_Type;
-    __s8    ln_Pri;            /* Priority, for sorting */
-    __s8    *ln_Name;          /* ID string, null terminated */
-} __attribute__ ((packed));
-
-struct ExpansionRom {
-    /* -First 16 bytes of the expansion ROM */
-    __u8  er_Type;             /* Board type, size and flags */
-    __u8  er_Product;          /* Product number, assigned by manufacturer */
-    __u8  er_Flags;            /* Flags */
-    __u8  er_Reserved03;       /* Must be zero ($ff inverted) */
-    __u16 er_Manufacturer;     /* Unique ID, ASSIGNED BY COMMODORE-AMIGA! */
-    __u32 er_SerialNumber;     /* Available for use by manufacturer */
-    __u16 er_InitDiagVec;      /* Offset to optional "DiagArea" structure */
-    __u8  er_Reserved0c;
-    __u8  er_Reserved0d;
-    __u8  er_Reserved0e;
-    __u8  er_Reserved0f;
-} __attribute__ ((packed));
-
-/* er_Type board type bits */
-#define ERT_TYPEMASK   0xc0
-#define ERT_ZORROII    0xc0
-#define ERT_ZORROIII   0x80
-
-/* other bits defined in er_Type */
-#define ERTB_MEMLIST   5               /* Link RAM into free memory list */
-#define ERTF_MEMLIST   (1<<5)
-
-struct ConfigDev {
-    struct Node                cd_Node;
-    __u8               cd_Flags;       /* (read/write) */
-    __u8               cd_Pad;         /* reserved */
-    struct ExpansionRom cd_Rom;                /* copy of board's expansion ROM */
-    void               *cd_BoardAddr;  /* where in memory the board was placed */
-    __u32              cd_BoardSize;   /* size of board in bytes */
-    __u16              cd_SlotAddr;    /* which slot number (PRIVATE) */
-    __u16              cd_SlotSize;    /* number of slots (PRIVATE) */
-    void               *cd_Driver;     /* pointer to node of driver */
-    struct ConfigDev   *cd_NextCD;     /* linked list of drivers to config */
-    __u32              cd_Unused[4];   /* for whatever the driver wants */
-} __attribute__ ((packed));
-
-#define ZORRO_NUM_AUTO         16
-
-#ifdef __KERNEL__
+#include <uapi/linux/zorro.h>
 
+#include <linux/device.h>
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/mod_devicetable.h>
@@ -175,7 +78,23 @@ static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z)
 
 
 extern unsigned int zorro_num_autocon; /* # of autoconfig devices found */
-extern struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
+extern struct zorro_dev *zorro_autocon;
+
+
+    /*
+     * Minimal information about a Zorro device, passed from bootinfo
+     * Only available temporarily, i.e. until initmem has been freed!
+     */
+
+struct zorro_dev_init {
+       struct ExpansionRom rom;
+       u16 slotaddr;
+       u16 slotsize;
+       u32 boardaddr;
+       u32 boardsize;
+};
+
+extern struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata;
 
 
     /*
@@ -229,6 +148,4 @@ extern DECLARE_BITMAP(zorro_unused_z2ram, 128);
 #define Z2RAM_CHUNKSHIFT       (16)
 
 
-#endif /* __KERNEL__ */
-
 #endif /* _LINUX_ZORRO_H */
diff --git a/include/media/omap4iss.h b/include/media/omap4iss.h
new file mode 100644 (file)
index 0000000..0d7620d
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef ARCH_ARM_PLAT_OMAP4_ISS_H
+#define ARCH_ARM_PLAT_OMAP4_ISS_H
+
+#include <linux/i2c.h>
+
+struct iss_device;
+
+enum iss_interface_type {
+       ISS_INTERFACE_CSI2A_PHY1,
+       ISS_INTERFACE_CSI2B_PHY2,
+};
+
+/**
+ * struct iss_csiphy_lane: CSI2 lane position and polarity
+ * @pos: position of the lane
+ * @pol: polarity of the lane
+ */
+struct iss_csiphy_lane {
+       u8 pos;
+       u8 pol;
+};
+
+#define ISS_CSIPHY1_NUM_DATA_LANES     4
+#define ISS_CSIPHY2_NUM_DATA_LANES     1
+
+/**
+ * struct iss_csiphy_lanes_cfg - CSI2 lane configuration
+ * @data: Configuration of one or two data lanes
+ * @clk: Clock lane configuration
+ */
+struct iss_csiphy_lanes_cfg {
+       struct iss_csiphy_lane data[ISS_CSIPHY1_NUM_DATA_LANES];
+       struct iss_csiphy_lane clk;
+};
+
+/**
+ * struct iss_csi2_platform_data - CSI2 interface platform data
+ * @crc: Enable the cyclic redundancy check
+ * @vpclk_div: Video port output clock control
+ */
+struct iss_csi2_platform_data {
+       unsigned crc:1;
+       unsigned vpclk_div:2;
+       struct iss_csiphy_lanes_cfg lanecfg;
+};
+
+struct iss_subdev_i2c_board_info {
+       struct i2c_board_info *board_info;
+       int i2c_adapter_id;
+};
+
+struct iss_v4l2_subdevs_group {
+       struct iss_subdev_i2c_board_info *subdevs;
+       enum iss_interface_type interface;
+       union {
+               struct iss_csi2_platform_data csi2;
+       } bus; /* gcc < 4.6.0 chokes on anonymous union initializers */
+};
+
+struct iss_platform_data {
+       struct iss_v4l2_subdevs_group *subdevs;
+       void (*set_constraints)(struct iss_device *iss, bool enable);
+};
+
+#endif
index 528cdaf622e192aa572ade990b60acf949e74109..803516775162d184d4dbe8cf78e427ec3452e23c 100644 (file)
@@ -45,6 +45,10 @@ struct v4l2_fh {
        struct list_head        available; /* Dequeueable event */
        unsigned int            navailable;
        u32                     sequence;
+
+#if IS_ENABLED(CONFIG_V4L2_MEM2MEM_DEV)
+       struct v4l2_m2m_ctx     *m2m_ctx;
+#endif
 };
 
 /*
index 44542a20ab8126cdcd851a3d369f2b2b956c96ac..12ea5a6a4331c7036341f6bc0ff4cbe48d767a01 100644 (file)
@@ -64,6 +64,9 @@ struct v4l2_m2m_queue_ctx {
 };
 
 struct v4l2_m2m_ctx {
+       /* optional cap/out vb2 queues lock */
+       struct mutex                    *q_lock;
+
 /* private: internal use only */
        struct v4l2_m2m_dev             *m2m_dev;
 
@@ -229,5 +232,26 @@ static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
        return v4l2_m2m_buf_remove(&m2m_ctx->cap_q_ctx);
 }
 
+/* v4l2 ioctl helpers */
+
+int v4l2_m2m_ioctl_reqbufs(struct file *file, void *priv,
+                               struct v4l2_requestbuffers *rb);
+int v4l2_m2m_ioctl_create_bufs(struct file *file, void *fh,
+                               struct v4l2_create_buffers *create);
+int v4l2_m2m_ioctl_querybuf(struct file *file, void *fh,
+                               struct v4l2_buffer *buf);
+int v4l2_m2m_ioctl_expbuf(struct file *file, void *fh,
+                               struct v4l2_exportbuffer *eb);
+int v4l2_m2m_ioctl_qbuf(struct file *file, void *fh,
+                               struct v4l2_buffer *buf);
+int v4l2_m2m_ioctl_dqbuf(struct file *file, void *fh,
+                               struct v4l2_buffer *buf);
+int v4l2_m2m_ioctl_streamon(struct file *file, void *fh,
+                               enum v4l2_buf_type type);
+int v4l2_m2m_ioctl_streamoff(struct file *file, void *fh,
+                               enum v4l2_buf_type type);
+int v4l2_m2m_fop_mmap(struct file *file, struct vm_area_struct *vma);
+unsigned int v4l2_m2m_fop_poll(struct file *file, poll_table *wait);
+
 #endif /* _MEDIA_V4L2_MEM2MEM_H */
 
index bd8218b15009a810af8abd5df5a4bcad31dfdb20..941055e9d125af3bfe5a6915ff551e0bb1532445 100644 (file)
@@ -83,7 +83,7 @@ struct vb2_fileio_data;
 struct vb2_mem_ops {
        void            *(*alloc)(void *alloc_ctx, unsigned long size, gfp_t gfp_flags);
        void            (*put)(void *buf_priv);
-       struct dma_buf *(*get_dmabuf)(void *buf_priv);
+       struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags);
 
        void            *(*get_userptr)(void *alloc_ctx, unsigned long vaddr,
                                        unsigned long size, int write);
index eb198acaac1d5f42b53ac97838511563fe7e874b..488316e339a124fa55fdeac686a4fc6d28c0dd2c 100644 (file)
@@ -110,7 +110,8 @@ struct frag_hdr {
        __be32  identification;
 };
 
-#define        IP6_MF  0x0001
+#define        IP6_MF          0x0001
+#define        IP6_OFFSET      0xFFF8
 
 #include <net/sock.h>
 
index e3a18ff0c38b58aec20413489bf7237c54a14a77..2ef3c3eca47aacaa28ee25aecd236897d276845a 100644 (file)
@@ -1035,7 +1035,6 @@ enum cg_proto_flags {
 };
 
 struct cg_proto {
-       void                    (*enter_memory_pressure)(struct sock *sk);
        struct res_counter      memory_allocated;       /* Current allocated memory. */
        struct percpu_counter   sockets_allocated;      /* Current number of sockets. */
        int                     memory_pressure;
@@ -1155,8 +1154,7 @@ static inline void sk_leave_memory_pressure(struct sock *sk)
                struct proto *prot = sk->sk_prot;
 
                for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
-                       if (cg_proto->memory_pressure)
-                               cg_proto->memory_pressure = 0;
+                       cg_proto->memory_pressure = 0;
        }
 
 }
@@ -1171,7 +1169,7 @@ static inline void sk_enter_memory_pressure(struct sock *sk)
                struct proto *prot = sk->sk_prot;
 
                for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
-                       cg_proto->enter_memory_pressure(sk);
+                       cg_proto->memory_pressure = 1;
        }
 
        sk->sk_prot->enter_memory_pressure(sk);
index e0dc355fa3179658a2b99660fd6fca0ca0a80937..3b9f28dfc8492160940d28e58acf1dc9dc6e5081 100644 (file)
                { META,         "META" },                               \
                { META_FLUSH,   "META_FLUSH" })
 
-#define show_bio_type(type)                                            \
-       __print_symbolic(type,                                          \
-               { READ,         "READ" },                               \
-               { READA,        "READAHEAD" },                          \
-               { READ_SYNC,    "READ_SYNC" },                          \
-               { WRITE,        "WRITE" },                              \
-               { WRITE_SYNC,   "WRITE_SYNC" },                         \
-               { WRITE_FLUSH,  "WRITE_FLUSH" },                        \
-               { WRITE_FUA,    "WRITE_FUA" })
+#define F2FS_BIO_MASK(t)       (t & (READA | WRITE_FLUSH_FUA))
+#define F2FS_BIO_EXTRA_MASK(t) (t & (REQ_META | REQ_PRIO))
+
+#define show_bio_type(type)    show_bio_base(type), show_bio_extra(type)
+
+#define show_bio_base(type)                                            \
+       __print_symbolic(F2FS_BIO_MASK(type),                           \
+               { READ,                 "READ" },                       \
+               { READA,                "READAHEAD" },                  \
+               { READ_SYNC,            "READ_SYNC" },                  \
+               { WRITE,                "WRITE" },                      \
+               { WRITE_SYNC,           "WRITE_SYNC" },                 \
+               { WRITE_FLUSH,          "WRITE_FLUSH" },                \
+               { WRITE_FUA,            "WRITE_FUA" },                  \
+               { WRITE_FLUSH_FUA,      "WRITE_FLUSH_FUA" })
+
+#define show_bio_extra(type)                                           \
+       __print_symbolic(F2FS_BIO_EXTRA_MASK(type),                     \
+               { REQ_META,             "(M)" },                        \
+               { REQ_PRIO,             "(P)" },                        \
+               { REQ_META | REQ_PRIO,  "(MP)" },                       \
+               { 0, " \b" })
 
 #define show_data_type(type)                                           \
        __print_symbolic(type,                                          \
@@ -421,7 +434,7 @@ TRACE_EVENT(f2fs_truncate_partial_nodes,
                __entry->err)
 );
 
-TRACE_EVENT_CONDITION(f2fs_readpage,
+TRACE_EVENT_CONDITION(f2fs_submit_page_bio,
 
        TP_PROTO(struct page *page, sector_t blkaddr, int type),
 
@@ -446,7 +459,7 @@ TRACE_EVENT_CONDITION(f2fs_readpage,
        ),
 
        TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
-               "blkaddr = 0x%llx, bio_type = %s",
+               "blkaddr = 0x%llx, bio_type = %s%s",
                show_dev_ino(__entry),
                (unsigned long)__entry->index,
                (unsigned long long)__entry->blkaddr,
@@ -598,36 +611,54 @@ TRACE_EVENT(f2fs_reserve_new_block,
                __entry->ofs_in_node)
 );
 
-TRACE_EVENT(f2fs_do_submit_bio,
+DECLARE_EVENT_CLASS(f2fs__submit_bio,
 
-       TP_PROTO(struct super_block *sb, int btype, bool sync, struct bio *bio),
+       TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio),
 
-       TP_ARGS(sb, btype, sync, bio),
+       TP_ARGS(sb, rw, type, bio),
 
        TP_STRUCT__entry(
                __field(dev_t,  dev)
-               __field(int,    btype)
-               __field(bool,   sync)
+               __field(int,    rw)
+               __field(int,    type)
                __field(sector_t,       sector)
                __field(unsigned int,   size)
        ),
 
        TP_fast_assign(
                __entry->dev            = sb->s_dev;
-               __entry->btype          = btype;
-               __entry->sync           = sync;
+               __entry->rw             = rw;
+               __entry->type           = type;
                __entry->sector         = bio->bi_sector;
                __entry->size           = bio->bi_size;
        ),
 
-       TP_printk("dev = (%d,%d), type = %s, io = %s, sector = %lld, size = %u",
+       TP_printk("dev = (%d,%d), %s%s, %s, sector = %lld, size = %u",
                show_dev(__entry),
-               show_block_type(__entry->btype),
-               __entry->sync ? "sync" : "no sync",
+               show_bio_type(__entry->rw),
+               show_block_type(__entry->type),
                (unsigned long long)__entry->sector,
                __entry->size)
 );
 
+DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_write_bio,
+
+       TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio),
+
+       TP_ARGS(sb, rw, type, bio),
+
+       TP_CONDITION(bio)
+);
+
+DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_read_bio,
+
+       TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio),
+
+       TP_ARGS(sb, rw, type, bio),
+
+       TP_CONDITION(bio)
+);
+
 DECLARE_EVENT_CLASS(f2fs__page,
 
        TP_PROTO(struct page *page, int type),
@@ -674,15 +705,16 @@ DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
        TP_ARGS(page, type)
 );
 
-TRACE_EVENT(f2fs_submit_write_page,
+TRACE_EVENT(f2fs_submit_page_mbio,
 
-       TP_PROTO(struct page *page, block_t blk_addr, int type),
+       TP_PROTO(struct page *page, int rw, int type, block_t blk_addr),
 
-       TP_ARGS(page, blk_addr, type),
+       TP_ARGS(page, rw, type, blk_addr),
 
        TP_STRUCT__entry(
                __field(dev_t,  dev)
                __field(ino_t,  ino)
+               __field(int, rw)
                __field(int, type)
                __field(pgoff_t, index)
                __field(block_t, block)
@@ -691,13 +723,15 @@ TRACE_EVENT(f2fs_submit_write_page,
        TP_fast_assign(
                __entry->dev    = page->mapping->host->i_sb->s_dev;
                __entry->ino    = page->mapping->host->i_ino;
+               __entry->rw     = rw;
                __entry->type   = type;
                __entry->index  = page->index;
                __entry->block  = blk_addr;
        ),
 
-       TP_printk("dev = (%d,%d), ino = %lu, %s, index = %lu, blkaddr = 0x%llx",
+       TP_printk("dev = (%d,%d), ino = %lu, %s%s, %s, index = %lu, blkaddr = 0x%llx",
                show_dev_ino(__entry),
+               show_bio_type(__entry->rw),
                show_block_type(__entry->type),
                (unsigned long)__entry->index,
                (unsigned long long)__entry->block)
@@ -727,6 +761,29 @@ TRACE_EVENT(f2fs_write_checkpoint,
                __entry->msg)
 );
 
+TRACE_EVENT(f2fs_issue_discard,
+
+       TP_PROTO(struct super_block *sb, block_t blkstart, block_t blklen),
+
+       TP_ARGS(sb, blkstart, blklen),
+
+       TP_STRUCT__entry(
+               __field(dev_t,  dev)
+               __field(block_t, blkstart)
+               __field(block_t, blklen)
+       ),
+
+       TP_fast_assign(
+               __entry->dev    = sb->s_dev;
+               __entry->blkstart = blkstart;
+               __entry->blklen = blklen;
+       ),
+
+       TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx",
+               show_dev(__entry),
+               (unsigned long long)__entry->blkstart,
+               (unsigned long long)__entry->blklen)
+);
 #endif /* _TRACE_F2FS_H */
 
  /* This part must be outside protection */
index 33d2b8fe166dafcd8dd39c5b7a092b8b3d5befa6..3ce25b5d75a9facfd047a526d3c3af618169e488 100644 (file)
@@ -426,3 +426,5 @@ header-y += x25.h
 header-y += xattr.h
 header-y += xfrm.h
 header-y += hw_breakpoint.h
+header-y += zorro.h
+header-y += zorro_ids.h
index a3726275876dc509bfa99a01b8113385c1fb2d2f..ecc88592ecbe94acfbacd1eda9b5907a832470da 100644 (file)
@@ -719,6 +719,8 @@ struct input_keymap_entry {
 #define BTN_DPAD_LEFT          0x222
 #define BTN_DPAD_RIGHT         0x223
 
+#define KEY_ALS_TOGGLE         0x230   /* Ambient light sensor */
+
 #define BTN_TRIGGER_HAPPY              0x2c0
 #define BTN_TRIGGER_HAPPY1             0x2c0
 #define BTN_TRIGGER_HAPPY2             0x2c1
@@ -856,6 +858,7 @@ struct input_keymap_entry {
 #define SW_FRONT_PROXIMITY     0x0b  /* set = front proximity sensor active */
 #define SW_ROTATE_LOCK         0x0c  /* set = rotate locked/disabled */
 #define SW_LINEIN_INSERT       0x0d  /* set = inserted */
+#define SW_MUTE_DEVICE         0x0e  /* set = device disabled */
 #define SW_MAX                 0x0f
 #define SW_CNT                 (SW_MAX+1)
 
index 104838f65bc184cf46531e3335492668a822789e..d6629d49a2433745d205cb3685dadeaffaeab61a 100644 (file)
@@ -18,6 +18,7 @@
  */
 #define KEXEC_ARCH_DEFAULT ( 0 << 16)
 #define KEXEC_ARCH_386     ( 3 << 16)
+#define KEXEC_ARCH_68K     ( 4 << 16)
 #define KEXEC_ARCH_X86_64  (62 << 16)
 #define KEXEC_ARCH_PPC     (20 << 16)
 #define KEXEC_ARCH_PPC64   (21 << 16)
index ed49574ad7573cc446e9ee722554998d3b3c8c34..d847c760e8f09c49fec028cbe3a7b599cee2e60f 100644 (file)
@@ -98,6 +98,7 @@ struct media_entity_desc {
 
 #define MEDIA_PAD_FL_SINK              (1 << 0)
 #define MEDIA_PAD_FL_SOURCE            (1 << 1)
+#define MEDIA_PAD_FL_MUST_CONNECT      (1 << 2)
 
 struct media_pad_desc {
        __u32 entity;           /* entity ID */
index 17e7d95e4f536b883cf98ebe363ed3734e9db958..6eb40244e0194110ce6c7e3878f738227ddfb013 100644 (file)
 
 #include <linux/virtio_ring.h>
 
-#ifndef __KERNEL__
-#define ALIGN(a, x)    (((a) + (x) - 1) & ~((x) - 1))
-#define __aligned(x)   __attribute__ ((aligned(x)))
-#endif
-
-#define mic_aligned_size(x) ALIGN(sizeof(x), 8)
+#define __mic_align(a, x) (((a) + (x) - 1) & ~((x) - 1))
 
 /**
  * struct mic_device_desc: Virtio device information shared between the
@@ -48,8 +43,8 @@ struct mic_device_desc {
        __u8 feature_len;
        __u8 config_len;
        __u8 status;
-       __u64 config[0];
-} __aligned(8);
+       __le64 config[0];
+} __attribute__ ((aligned(8)));
 
 /**
  * struct mic_device_ctrl: Per virtio device information in the device page
@@ -66,7 +61,7 @@ struct mic_device_desc {
  * @h2c_vdev_db: The doorbell number to be used by host. Set by guest.
  */
 struct mic_device_ctrl {
-       __u64 vdev;
+       __le64 vdev;
        __u8 config_change;
        __u8 vdev_reset;
        __u8 guest_ack;
@@ -74,7 +69,7 @@ struct mic_device_ctrl {
        __u8 used_address_updated;
        __s8 c2h_vdev_db;
        __s8 h2c_vdev_db;
-} __aligned(8);
+} __attribute__ ((aligned(8)));
 
 /**
  * struct mic_bootparam: Virtio device independent information in device page
@@ -87,13 +82,13 @@ struct mic_device_ctrl {
  * @shutdown_card: Set to 1 by the host when a card shutdown is initiated
  */
 struct mic_bootparam {
-       __u32 magic;
+       __le32 magic;
        __s8 c2h_shutdown_db;
        __s8 h2c_shutdown_db;
        __s8 h2c_config_db;
        __u8 shutdown_status;
        __u8 shutdown_card;
-} __aligned(8);
+} __attribute__ ((aligned(8)));
 
 /**
  * struct mic_device_page: High level representation of the device page
@@ -116,10 +111,10 @@ struct mic_device_page {
  * @num: The number of entries in the virtio_ring
  */
 struct mic_vqconfig {
-       __u64 address;
-       __u64 used_address;
-       __u16 num;
-} __aligned(8);
+       __le64 address;
+       __le64 used_address;
+       __le16 num;
+} __attribute__ ((aligned(8)));
 
 /*
  * The alignment to use between consumer and producer parts of vring.
@@ -154,7 +149,7 @@ struct mic_vqconfig {
  */
 struct _mic_vring_info {
        __u16 avail_idx;
-       int magic;
+       __le32 magic;
 };
 
 /**
@@ -173,15 +168,13 @@ struct mic_vring {
        int len;
 };
 
-#define mic_aligned_desc_size(d) ALIGN(mic_desc_size(d), 8)
+#define mic_aligned_desc_size(d) __mic_align(mic_desc_size(d), 8)
 
 #ifndef INTEL_MIC_CARD
 static inline unsigned mic_desc_size(const struct mic_device_desc *desc)
 {
-       return mic_aligned_size(*desc)
-               + desc->num_vq * mic_aligned_size(struct mic_vqconfig)
-               + desc->feature_len * 2
-               + desc->config_len;
+       return sizeof(*desc) + desc->num_vq * sizeof(struct mic_vqconfig)
+               + desc->feature_len * 2 + desc->config_len;
 }
 
 static inline struct mic_vqconfig *
@@ -201,8 +194,7 @@ static inline __u8 *mic_vq_configspace(const struct mic_device_desc *desc)
 }
 static inline unsigned mic_total_desc_size(struct mic_device_desc *desc)
 {
-       return mic_aligned_desc_size(desc) +
-               mic_aligned_size(struct mic_device_ctrl);
+       return mic_aligned_desc_size(desc) + sizeof(struct mic_device_ctrl);
 }
 #endif
 
diff --git a/include/uapi/linux/zorro.h b/include/uapi/linux/zorro.h
new file mode 100644 (file)
index 0000000..59d021b
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ *  linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions
+ *
+ *  Copyright (C) 1995--2003 Geert Uytterhoeven
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License.  See the file COPYING in the main directory of this archive
+ *  for more details.
+ */
+
+#ifndef _UAPI_LINUX_ZORRO_H
+#define _UAPI_LINUX_ZORRO_H
+
+#include <linux/types.h>
+
+
+    /*
+     *  Each Zorro board has a 32-bit ID of the form
+     *
+     *      mmmmmmmmmmmmmmmmppppppppeeeeeeee
+     *
+     *  with
+     *
+     *      mmmmmmmmmmmmmmmm   16-bit Manufacturer ID (assigned by CBM (sigh))
+     *      pppppppp           8-bit Product ID (assigned by manufacturer)
+     *      eeeeeeee           8-bit Extended Product ID (currently only used
+     *                         for some GVP boards)
+     */
+
+
+#define ZORRO_MANUF(id)                ((id) >> 16)
+#define ZORRO_PROD(id)         (((id) >> 8) & 0xff)
+#define ZORRO_EPC(id)          ((id) & 0xff)
+
+#define ZORRO_ID(manuf, prod, epc) \
+       ((ZORRO_MANUF_##manuf << 16) | ((prod) << 8) | (epc))
+
+typedef __u32 zorro_id;
+
+
+/* Include the ID list */
+#include <linux/zorro_ids.h>
+
+
+    /*
+     *  GVP identifies most of its products through the 'extended product code'
+     *  (epc). The epc has to be ANDed with the GVP_PRODMASK before the
+     *  identification.
+     */
+
+#define GVP_PRODMASK           (0xf8)
+#define GVP_SCSICLKMASK                (0x01)
+
+enum GVP_flags {
+       GVP_IO                  = 0x01,
+       GVP_ACCEL               = 0x02,
+       GVP_SCSI                = 0x04,
+       GVP_24BITDMA            = 0x08,
+       GVP_25BITDMA            = 0x10,
+       GVP_NOBANK              = 0x20,
+       GVP_14MHZ               = 0x40,
+};
+
+
+struct Node {
+       __be32 ln_Succ;         /* Pointer to next (successor) */
+       __be32 ln_Pred;         /* Pointer to previous (predecessor) */
+       __u8   ln_Type;
+       __s8   ln_Pri;          /* Priority, for sorting */
+       __be32 ln_Name;         /* ID string, null terminated */
+} __packed;
+
+struct ExpansionRom {
+       /* -First 16 bytes of the expansion ROM */
+       __u8   er_Type;         /* Board type, size and flags */
+       __u8   er_Product;      /* Product number, assigned by manufacturer */
+       __u8   er_Flags;                /* Flags */
+       __u8   er_Reserved03;   /* Must be zero ($ff inverted) */
+       __be16 er_Manufacturer; /* Unique ID, ASSIGNED BY COMMODORE-AMIGA! */
+       __be32 er_SerialNumber; /* Available for use by manufacturer */
+       __be16 er_InitDiagVec;  /* Offset to optional "DiagArea" structure */
+       __u8   er_Reserved0c;
+       __u8   er_Reserved0d;
+       __u8   er_Reserved0e;
+       __u8   er_Reserved0f;
+} __packed;
+
+/* er_Type board type bits */
+#define ERT_TYPEMASK   0xc0
+#define ERT_ZORROII    0xc0
+#define ERT_ZORROIII   0x80
+
+/* other bits defined in er_Type */
+#define ERTB_MEMLIST   5               /* Link RAM into free memory list */
+#define ERTF_MEMLIST   (1<<5)
+
+struct ConfigDev {
+       struct Node     cd_Node;
+       __u8            cd_Flags;       /* (read/write) */
+       __u8            cd_Pad;         /* reserved */
+       struct ExpansionRom cd_Rom;     /* copy of board's expansion ROM */
+       __be32          cd_BoardAddr;   /* where in memory the board was placed */
+       __be32          cd_BoardSize;   /* size of board in bytes */
+       __be16          cd_SlotAddr;    /* which slot number (PRIVATE) */
+       __be16          cd_SlotSize;    /* number of slots (PRIVATE) */
+       __be32          cd_Driver;      /* pointer to node of driver */
+       __be32          cd_NextCD;      /* linked list of drivers to config */
+       __be32          cd_Unused[4];   /* for whatever the driver wants */
+} __packed;
+
+#define ZORRO_NUM_AUTO         16
+
+#endif /* _UAPI_LINUX_ZORRO_H */
index 490afc03627e52e34e51d69e0a15693b7716b17a..d0d8fca54065d72a248b0f8b76346bb72c6e2441 100644 (file)
@@ -47,6 +47,9 @@ u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
 size_t vmcoreinfo_size;
 size_t vmcoreinfo_max_size = sizeof(vmcoreinfo_data);
 
+/* Flag to indicate we are going to kexec a new kernel */
+bool kexec_in_progress = false;
+
 /* Location of the reserved area for the crash kernel */
 struct resource crashk_res = {
        .name  = "Crash kernel",
@@ -1675,6 +1678,7 @@ int kernel_kexec(void)
        } else
 #endif
        {
+               kexec_in_progress = true;
                kernel_restart_prepare(NULL);
                printk(KERN_EMERG "Starting new kernel\n");
                machine_shutdown();
index 0121dab83f43d82ddfb620f7423d6c9728f8b01b..bc13d087ea14e3a69074ba67f00d68cb9a8ba4d2 100644 (file)
@@ -82,6 +82,7 @@ void hibernation_set_ops(const struct platform_hibernation_ops *ops)
 
        unlock_system_sleep();
 }
+EXPORT_SYMBOL_GPL(hibernation_set_ops);
 
 static bool entering_platform_hibernation;
 
index c66912be990fbda0f61e7a58fdbc52cf304566c2..b010eac595d20eece261310cc4acb629ad70b92b 100644 (file)
@@ -2851,19 +2851,6 @@ already_gone:
        return false;
 }
 
-static bool __flush_work(struct work_struct *work)
-{
-       struct wq_barrier barr;
-
-       if (start_flush_work(work, &barr)) {
-               wait_for_completion(&barr.done);
-               destroy_work_on_stack(&barr.work);
-               return true;
-       } else {
-               return false;
-       }
-}
-
 /**
  * flush_work - wait for a work to finish executing the last queueing instance
  * @work: the work to flush
@@ -2877,10 +2864,18 @@ static bool __flush_work(struct work_struct *work)
  */
 bool flush_work(struct work_struct *work)
 {
+       struct wq_barrier barr;
+
        lock_map_acquire(&work->lockdep_map);
        lock_map_release(&work->lockdep_map);
 
-       return __flush_work(work);
+       if (start_flush_work(work, &barr)) {
+               wait_for_completion(&barr.done);
+               destroy_work_on_stack(&barr.work);
+               return true;
+       } else {
+               return false;
+       }
 }
 EXPORT_SYMBOL_GPL(flush_work);
 
@@ -4832,14 +4827,7 @@ long work_on_cpu(int cpu, long (*fn)(void *), void *arg)
 
        INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn);
        schedule_work_on(cpu, &wfc.work);
-
-       /*
-        * The work item is on-stack and can't lead to deadlock through
-        * flushing.  Use __flush_work() to avoid spurious lockdep warnings
-        * when work_on_cpu()s are nested.
-        */
-       __flush_work(&wfc.work);
-
+       flush_work(&wfc.work);
        return wfc.ret;
 }
 EXPORT_SYMBOL_GPL(work_on_cpu);
index eca4a3129129751208b41cfe808e9e31e5dc7b5f..9f73b29d304d3f0ced5da23358fecc92de7983b7 100644 (file)
@@ -613,7 +613,7 @@ static inline int queue_pages_pgd_range(struct vm_area_struct *vma,
        return 0;
 }
 
-#ifdef CONFIG_ARCH_USES_NUMA_PROT_NONE
+#ifdef CONFIG_NUMA_BALANCING
 /*
  * This is used to mark a range of virtual addresses to be inaccessible.
  * These are later cleared by a NUMA hinting fault. Depending on these
@@ -627,7 +627,6 @@ unsigned long change_prot_numa(struct vm_area_struct *vma,
                        unsigned long addr, unsigned long end)
 {
        int nr_updated;
-       BUILD_BUG_ON(_PAGE_NUMA != _PAGE_PROTNONE);
 
        nr_updated = change_protection(vma, addr, end, vma->vm_page_prot, 0, 1);
        if (nr_updated)
@@ -641,7 +640,7 @@ static unsigned long change_prot_numa(struct vm_area_struct *vma,
 {
        return 0;
 }
-#endif /* CONFIG_ARCH_USES_NUMA_PROT_NONE */
+#endif /* CONFIG_NUMA_BALANCING */
 
 /*
  * Walk through page tables and collect pages to be migrated.
index ee8fd6bd4035b28697db6dacaf3453a3d94a72a3..a5e4d2dcb03e8c98eae243e1dd1b82cea68bd227 100644 (file)
@@ -1011,9 +1011,6 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
        if (err < 0)
                goto destroy_tagpool;
 
-       if (!clnt->trans_mod)
-               clnt->trans_mod = v9fs_get_trans_by_name("virtio");
-
        if (!clnt->trans_mod)
                clnt->trans_mod = v9fs_get_default_trans();
 
index 9321a77630675dacbca66949e7e2e0f75d25deed..b7bd7f2961bf60f49258bd60a702eadd8d651773 100644 (file)
@@ -1048,7 +1048,7 @@ p9_fd_create(struct p9_client *client, const char *addr, char *args)
 static struct p9_trans_module p9_tcp_trans = {
        .name = "tcp",
        .maxsize = MAX_SOCK_BUF,
-       .def = 1,
+       .def = 0,
        .create = p9_fd_create_tcp,
        .close = p9_fd_close,
        .request = p9_fd_request,
index 9c5a1aa34d1253c725af29889d83759946af37c3..cd1e1ede73a45c2516091263c937f45024616c4e 100644 (file)
@@ -698,7 +698,7 @@ static struct p9_trans_module p9_virtio_trans = {
         * page in zero copy.
         */
        .maxsize = PAGE_SIZE * (VIRTQUEUE_NUM - 3),
-       .def = 0,
+       .def = 1,
        .owner = THIS_MODULE,
 };
 
index 229d820bdf0b06453cb43058020d54e33f210297..045d56eaeca2b777973bf1450d7b410a09d2d9f1 100644 (file)
@@ -426,6 +426,16 @@ netdev_features_t br_features_recompute(struct net_bridge *br,
 int br_handle_frame_finish(struct sk_buff *skb);
 rx_handler_result_t br_handle_frame(struct sk_buff **pskb);
 
+static inline bool br_rx_handler_check_rcu(const struct net_device *dev)
+{
+       return rcu_dereference(dev->rx_handler) == br_handle_frame;
+}
+
+static inline struct net_bridge_port *br_port_get_check_rcu(const struct net_device *dev)
+{
+       return br_rx_handler_check_rcu(dev) ? br_port_get_rcu(dev) : NULL;
+}
+
 /* br_ioctl.c */
 int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd,
index 8660ea3be7054571defa59bcfbfc0cd0dd7ab99e..bdb459d21ad8e2d5191023c5b096de39b6a78c90 100644 (file)
@@ -153,7 +153,7 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
        if (buf[0] != 0 || buf[1] != 0 || buf[2] != 0)
                goto err;
 
-       p = br_port_get_rcu(dev);
+       p = br_port_get_check_rcu(dev);
        if (!p)
                goto err;
 
index 2718fed53d8cf5b81a06c82f8cdf8ed96632185a..06e72d3cdf60dbd96a3ad4829cfcc2baec0a80e8 100644 (file)
@@ -3584,6 +3584,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet)
        skb->tstamp.tv64 = 0;
        skb->pkt_type = PACKET_HOST;
        skb->skb_iif = 0;
+       skb->local_df = 0;
        skb_dst_drop(skb);
        skb->mark = 0;
        secpath_reset(skb);
index 269a89ecd2f441857f76c23d80e4f4c1e3cc0fdd..f7e522c558ba2eb43165f85d46c2ba3a91ce42eb 100644 (file)
@@ -6,13 +6,6 @@
 #include <linux/memcontrol.h>
 #include <linux/module.h>
 
-static void memcg_tcp_enter_memory_pressure(struct sock *sk)
-{
-       if (sk->sk_cgrp->memory_pressure)
-               sk->sk_cgrp->memory_pressure = 1;
-}
-EXPORT_SYMBOL(memcg_tcp_enter_memory_pressure);
-
 int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss)
 {
        /*
index 12c97d8aa6bbb31ff1519459b89b7b9fb33817f5..d5fa5b8c443ecbbcb0ed09a10db19b06730b7d8b 100644 (file)
@@ -2613,7 +2613,7 @@ static void init_loopback(struct net_device *dev)
                        if (sp_ifa->rt)
                                continue;
 
-                       sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, 0);
+                       sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, false);
 
                        /* Failure cases are ignored */
                        if (!IS_ERR(sp_rt)) {
index 3512177deb4d0e7d12c6d145781802074f490615..3008651713947c76dac697d466f1301d05bba025 100644 (file)
@@ -1277,6 +1277,9 @@ skip_linkparms:
                            ri->prefix_len == 0)
                                continue;
 #endif
+                       if (ri->prefix_len == 0 &&
+                           !in6_dev->cnf.accept_ra_defrtr)
+                               continue;
                        if (ri->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen)
                                continue;
                        rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3,
index 7faa9d5e15033ae45715d63a33c21150e74f8665..ddb9d41c8eea34845413cc112a7ce832e160f4e2 100644 (file)
@@ -84,6 +84,8 @@ static int             ip6_dst_gc(struct dst_ops *ops);
 
 static int             ip6_pkt_discard(struct sk_buff *skb);
 static int             ip6_pkt_discard_out(struct sk_buff *skb);
+static int             ip6_pkt_prohibit(struct sk_buff *skb);
+static int             ip6_pkt_prohibit_out(struct sk_buff *skb);
 static void            ip6_link_failure(struct sk_buff *skb);
 static void            ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
                                           struct sk_buff *skb, u32 mtu);
@@ -234,9 +236,6 @@ static const struct rt6_info ip6_null_entry_template = {
 
 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
 
-static int ip6_pkt_prohibit(struct sk_buff *skb);
-static int ip6_pkt_prohibit_out(struct sk_buff *skb);
-
 static const struct rt6_info ip6_prohibit_entry_template = {
        .dst = {
                .__refcnt       = ATOMIC_INIT(1),
@@ -1565,21 +1564,24 @@ int ip6_route_add(struct fib6_config *cfg)
                                goto out;
                        }
                }
-               rt->dst.output = ip6_pkt_discard_out;
-               rt->dst.input = ip6_pkt_discard;
                rt->rt6i_flags = RTF_REJECT|RTF_NONEXTHOP;
                switch (cfg->fc_type) {
                case RTN_BLACKHOLE:
                        rt->dst.error = -EINVAL;
+                       rt->dst.output = dst_discard;
+                       rt->dst.input = dst_discard;
                        break;
                case RTN_PROHIBIT:
                        rt->dst.error = -EACCES;
+                       rt->dst.output = ip6_pkt_prohibit_out;
+                       rt->dst.input = ip6_pkt_prohibit;
                        break;
                case RTN_THROW:
-                       rt->dst.error = -EAGAIN;
-                       break;
                default:
-                       rt->dst.error = -ENETUNREACH;
+                       rt->dst.error = (cfg->fc_type == RTN_THROW) ? -EAGAIN
+                                       : -ENETUNREACH;
+                       rt->dst.output = ip6_pkt_discard_out;
+                       rt->dst.input = ip6_pkt_discard;
                        break;
                }
                goto install_route;
@@ -2144,8 +2146,6 @@ static int ip6_pkt_discard_out(struct sk_buff *skb)
        return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES);
 }
 
-#ifdef CONFIG_IPV6_MULTIPLE_TABLES
-
 static int ip6_pkt_prohibit(struct sk_buff *skb)
 {
        return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES);
@@ -2157,8 +2157,6 @@ static int ip6_pkt_prohibit_out(struct sk_buff *skb)
        return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
 }
 
-#endif
-
 /*
  *     Allocate a dst for local (unicast / anycast) address.
  */
index 95667b088c5b73cd0e95e8c1753ed76acec9dca0..364ce0c5962fd48c85ea23b71b2d1dd463082575 100644 (file)
@@ -1368,7 +1368,7 @@ static int sta_apply_parameters(struct ieee80211_local *local,
                        changed |=
                              ieee80211_mps_set_sta_local_pm(sta,
                                                             params->local_pm);
-               ieee80211_bss_info_change_notify(sdata, changed);
+               ieee80211_mbss_info_change_notify(sdata, changed);
 #endif
        }
 
@@ -2488,8 +2488,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
 
-       if (sdata->vif.type != NL80211_IFTYPE_STATION &&
-           sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
+       if (sdata->vif.type != NL80211_IFTYPE_STATION)
                return -EOPNOTSUPP;
 
        if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
@@ -3120,9 +3119,17 @@ static int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
                    params->chandef.chan->band)
                        return -EINVAL;
 
+               ifmsh->chsw_init = true;
+               if (!ifmsh->pre_value)
+                       ifmsh->pre_value = 1;
+               else
+                       ifmsh->pre_value++;
+
                err = ieee80211_mesh_csa_beacon(sdata, params, true);
-               if (err < 0)
+               if (err < 0) {
+                       ifmsh->chsw_init = false;
                        return err;
+               }
                break;
 #endif
        default:
index 531be040b9ae85972d61bf7df248ae28308d811b..27a39de89679b7d3710fea18a65b6d5df6d003d0 100644 (file)
@@ -823,6 +823,10 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata,
        if (err)
                return false;
 
+       /* channel switch is not supported, disconnect */
+       if (!(sdata->local->hw.wiphy->flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH))
+               goto disconnect;
+
        params.count = csa_ie.count;
        params.chandef = csa_ie.chandef;
 
index 29dc505be125c3c19737f8f6cee911492c52727c..4aea4e7911135133818e66a1439b111d14e6147e 100644 (file)
@@ -1228,6 +1228,7 @@ struct ieee80211_csa_ie {
        u8 mode;
        u8 count;
        u8 ttl;
+       u16 pre_value;
 };
 
 /* Parsed Information Elements */
index ff101ea1d9ae1e208deb5d6fe1d67c1677b398c2..36c3a4cbcabf66b2a0864414b3c23ea2896b7c4e 100644 (file)
@@ -1325,7 +1325,6 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
                sdata->vif.bss_conf.bssid = NULL;
                break;
        case NL80211_IFTYPE_AP_VLAN:
-               break;
        case NL80211_IFTYPE_P2P_DEVICE:
                sdata->vif.bss_conf.bssid = sdata->vif.addr;
                break;
index 21d5d44444d04c82fc73c9fd6dee3f58ab56e512..7d1c3ac48ed941866170afdf387def183690d612 100644 (file)
@@ -940,6 +940,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
                wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
                            result);
 
+       local->hw.conf.flags = IEEE80211_CONF_IDLE;
+
        ieee80211_led_init(local);
 
        rtnl_lock();
@@ -1047,6 +1049,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
 
        cancel_work_sync(&local->restart_work);
        cancel_work_sync(&local->reconfig_filter);
+       flush_work(&local->sched_scan_stopped_work);
 
        ieee80211_clear_tx_pending(local);
        rate_control_deinitialize(local);
index 896fe3bd599e9bedd5db13dbc8ed04ab76e5bd88..ba105257d03f1cffc4398f42c52e67b1e8d3eaaa 100644 (file)
@@ -943,14 +943,19 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
                 params.chandef.chan->center_freq);
 
        params.block_tx = csa_ie.mode & WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT;
-       if (beacon)
+       if (beacon) {
                ifmsh->chsw_ttl = csa_ie.ttl - 1;
-       else
-               ifmsh->chsw_ttl = 0;
+               if (ifmsh->pre_value >= csa_ie.pre_value)
+                       return false;
+               ifmsh->pre_value = csa_ie.pre_value;
+       }
 
-       if (ifmsh->chsw_ttl > 0)
+       if (ifmsh->chsw_ttl < ifmsh->mshcfg.dot11MeshTTL) {
                if (ieee80211_mesh_csa_beacon(sdata, &params, false) < 0)
                        return false;
+       } else {
+               return false;
+       }
 
        sdata->csa_radar_required = params.radar_required;
 
@@ -1163,7 +1168,6 @@ static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata,
        offset_ttl = (len < 42) ? 7 : 10;
        *(pos + offset_ttl) -= 1;
        *(pos + offset_ttl + 1) &= ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR;
-       sdata->u.mesh.chsw_ttl = *(pos + offset_ttl);
 
        memcpy(mgmt_fwd, mgmt, len);
        eth_broadcast_addr(mgmt_fwd->da);
@@ -1182,7 +1186,7 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata,
        u16 pre_value;
        bool fwd_csa = true;
        size_t baselen;
-       u8 *pos, ttl;
+       u8 *pos;
 
        if (mgmt->u.action.u.measurement.action_code !=
            WLAN_ACTION_SPCT_CHL_SWITCH)
@@ -1193,8 +1197,8 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata,
                           u.action.u.chan_switch.variable);
        ieee802_11_parse_elems(pos, len - baselen, false, &elems);
 
-       ttl = elems.mesh_chansw_params_ie->mesh_ttl;
-       if (!--ttl)
+       ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl;
+       if (!--ifmsh->chsw_ttl)
                fwd_csa = false;
 
        pre_value = le16_to_cpu(elems.mesh_chansw_params_ie->mesh_pre_value);
index d7504ab61a34c7ef6a51f8adce10e58c021408d0..b3a3ce316656ce8406859a3cdc325fa262e024a5 100644 (file)
@@ -1910,6 +1910,8 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
        if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL)
                already = true;
 
+       ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL;
+
        mutex_unlock(&sdata->local->mtx);
 
        if (already)
index 5d60779a0c1be89e987b2cd478af865ec806d4bb..4096ff6cc24fe8a5c3505411c5b232e0d800e050 100644 (file)
@@ -226,7 +226,7 @@ minstrel_ht_calc_tp(struct minstrel_ht_sta *mi, int group, int rate)
                nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len);
 
        nsecs += minstrel_mcs_groups[group].duration[rate];
-       tp = 1000000 * ((mr->probability * 1000) / nsecs);
+       tp = 1000000 * ((prob * 1000) / nsecs);
 
        mr->cur_tp = MINSTREL_TRUNC(tp);
 }
@@ -277,13 +277,15 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
                        if (!(mg->supported & BIT(i)))
                                continue;
 
+                       index = MCS_GROUP_RATES * group + i;
+
                        /* initialize rates selections starting indexes */
                        if (!mg_rates_valid) {
                                mg->max_tp_rate = mg->max_tp_rate2 =
                                        mg->max_prob_rate = i;
                                if (!mi_rates_valid) {
                                        mi->max_tp_rate = mi->max_tp_rate2 =
-                                               mi->max_prob_rate = i;
+                                               mi->max_prob_rate = index;
                                        mi_rates_valid = true;
                                }
                                mg_rates_valid = true;
@@ -291,7 +293,6 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
 
                        mr = &mg->rates[i];
                        mr->retry_updated = false;
-                       index = MCS_GROUP_RATES * group + i;
                        minstrel_calc_rate_ewma(mr);
                        minstrel_ht_calc_tp(mi, group, i);
 
index caecef870c0e44e3562cdc0a874bcfd233fc77a1..2b0debb0422b91d89a0a7982b94726f3b9ceae11 100644 (file)
@@ -911,7 +911,8 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx,
        u16 sc;
        u8 tid, ack_policy;
 
-       if (!ieee80211_is_data_qos(hdr->frame_control))
+       if (!ieee80211_is_data_qos(hdr->frame_control) ||
+           is_multicast_ether_addr(hdr->addr1))
                goto dont_reorder;
 
        /*
index 5ad66a83ef7f4d4525de163c2c2f1fe9d6931a04..bcc4833d7542b91e1b754ed490d1dedcaee559c1 100644 (file)
@@ -1088,6 +1088,6 @@ void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)
 
        trace_api_sched_scan_stopped(local);
 
-       ieee80211_queue_work(&local->hw, &local->sched_scan_stopped_work);
+       schedule_work(&local->sched_scan_stopped_work);
 }
 EXPORT_SYMBOL(ieee80211_sched_scan_stopped);
index a40da20b32e074a3923f844edf104eca33a6134c..6ab00907008461fb14d551b2633a8dbcd4fef623 100644 (file)
@@ -78,6 +78,8 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
        if (elems->mesh_chansw_params_ie) {
                csa_ie->ttl = elems->mesh_chansw_params_ie->mesh_ttl;
                csa_ie->mode = elems->mesh_chansw_params_ie->mesh_flags;
+               csa_ie->pre_value = le16_to_cpu(
+                               elems->mesh_chansw_params_ie->mesh_pre_value);
        }
 
        new_freq = ieee80211_channel_to_frequency(new_chan_no, new_band);
index 592a18171f95e9ec5273b03307235dff2bd1c946..9f9b9bd3fd44798e7030fb3a44c46da962cfd7ba 100644 (file)
@@ -2278,17 +2278,15 @@ void ieee80211_dfs_radar_detected_work(struct work_struct *work)
 {
        struct ieee80211_local *local =
                container_of(work, struct ieee80211_local, radar_detected_work);
-       struct cfg80211_chan_def chandef;
+       struct cfg80211_chan_def chandef = local->hw.conf.chandef;
 
        ieee80211_dfs_cac_cancel(local);
 
        if (local->use_chanctx)
                /* currently not handled */
                WARN_ON(1);
-       else {
-               chandef = local->hw.conf.chandef;
+       else
                cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL);
-       }
 }
 
 void ieee80211_radar_detected(struct ieee80211_hw *hw)
@@ -2459,14 +2457,9 @@ int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
                          WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT : 0x00;
                put_unaligned_le16(WLAN_REASON_MESH_CHAN, pos); /* Reason Cd */
                pos += 2;
-               if (!ifmsh->pre_value)
-                       ifmsh->pre_value = 1;
-               else
-                       ifmsh->pre_value++;
                pre_value = cpu_to_le16(ifmsh->pre_value);
                memcpy(pos, &pre_value, 2);             /* Precedence Value */
                pos += 2;
-               ifmsh->chsw_init = true;
        }
 
        ieee80211_tx_skb(sdata, skb);
index e59094981175cd6c390b5ed83a2dec15d8e2407e..37be6e226d1b46fefe8e0cf554580b1faf19cfb8 100644 (file)
@@ -552,9 +552,8 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
            && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
                rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
                scat = &rm->data.op_sg[sg];
-               ret = sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
-               ret = min_t(int, ret, scat->length - conn->c_xmit_data_off);
-               return ret;
+               ret = max_t(int, RDS_CONG_MAP_BYTES, scat->length);
+               return sizeof(struct rds_header) + ret;
        }
 
        /* FIXME we may overallocate here */
index fd7072827a40139c4ffba595aaa261282641e37f..69cb848e83455035a3e9ad85b2d7922434069d7e 100644 (file)
@@ -270,6 +270,16 @@ int tcf_register_action(struct tc_action_ops *act)
 {
        struct tc_action_ops *a, **ap;
 
+       /* Must supply act, dump, cleanup and init */
+       if (!act->act || !act->dump || !act->cleanup || !act->init)
+               return -EINVAL;
+
+       /* Supply defaults */
+       if (!act->lookup)
+               act->lookup = tcf_hash_search;
+       if (!act->walk)
+               act->walk = tcf_generic_walker;
+
        write_lock(&act_mod_lock);
        for (ap = &act_base; (a = *ap) != NULL; ap = &a->next) {
                if (act->type == a->type || (strcmp(act->kind, a->kind) == 0)) {
@@ -381,7 +391,7 @@ int tcf_action_exec(struct sk_buff *skb, const struct tc_action *act,
        }
        while ((a = act) != NULL) {
 repeat:
-               if (a->ops && a->ops->act) {
+               if (a->ops) {
                        ret = a->ops->act(skb, a, res);
                        if (TC_MUNGED & skb->tc_verd) {
                                /* copied already, allow trampling */
@@ -405,7 +415,7 @@ void tcf_action_destroy(struct tc_action *act, int bind)
        struct tc_action *a;
 
        for (a = act; a; a = act) {
-               if (a->ops && a->ops->cleanup) {
+               if (a->ops) {
                        if (a->ops->cleanup(a, bind) == ACT_P_DELETED)
                                module_put(a->ops->owner);
                        act = act->next;
@@ -424,7 +434,7 @@ tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
 {
        int err = -EINVAL;
 
-       if (a->ops == NULL || a->ops->dump == NULL)
+       if (a->ops == NULL)
                return err;
        return a->ops->dump(skb, a, bind, ref);
 }
@@ -436,7 +446,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
        unsigned char *b = skb_tail_pointer(skb);
        struct nlattr *nest;
 
-       if (a->ops == NULL || a->ops->dump == NULL)
+       if (a->ops == NULL)
                return err;
 
        if (nla_put_string(skb, TCA_KIND, a->ops->kind))
@@ -723,8 +733,6 @@ tcf_action_get_1(struct nlattr *nla, struct nlmsghdr *n, u32 portid)
        a->ops = tc_lookup_action(tb[TCA_ACT_KIND]);
        if (a->ops == NULL)
                goto err_free;
-       if (a->ops->lookup == NULL)
-               goto err_mod;
        err = -ENOENT;
        if (a->ops->lookup(a, index) == 0)
                goto err_mod;
@@ -1084,12 +1092,6 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
        memset(&a, 0, sizeof(struct tc_action));
        a.ops = a_o;
 
-       if (a_o->walk == NULL) {
-               WARN(1, "tc_dump_action: %s !capable of dumping table\n",
-                    a_o->kind);
-               goto out_module_put;
-       }
-
        nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
                        cb->nlh->nlmsg_type, sizeof(*t), 0);
        if (!nlh)
index 3a4c0caa1f7de0fdfdb618bac9308aa32330c7f7..5c5edf56adbd4fc9a4d64a509a9103511f995db4 100644 (file)
@@ -585,9 +585,7 @@ static struct tc_action_ops act_csum_ops = {
        .act            = tcf_csum,
        .dump           = tcf_csum_dump,
        .cleanup        = tcf_csum_cleanup,
-       .lookup         = tcf_hash_search,
        .init           = tcf_csum_init,
-       .walk           = tcf_generic_walker
 };
 
 MODULE_DESCRIPTION("Checksum updating actions");
index fd2b3cff5fa28cf4da25690da9e7bad410c60a78..5645a4d32abdd187f59d9f6301842e35d08762df 100644 (file)
@@ -206,9 +206,7 @@ static struct tc_action_ops act_gact_ops = {
        .act            =       tcf_gact,
        .dump           =       tcf_gact_dump,
        .cleanup        =       tcf_gact_cleanup,
-       .lookup         =       tcf_hash_search,
        .init           =       tcf_gact_init,
-       .walk           =       tcf_generic_walker
 };
 
 MODULE_AUTHOR("Jamal Hadi Salim(2002-4)");
index 60d88b6b9560bc0a7836fa0cba845ddd6a57cb3c..882a89762f77c2edb8b6d10d0c8ef69cf3e39aac 100644 (file)
@@ -298,9 +298,7 @@ static struct tc_action_ops act_ipt_ops = {
        .act            =       tcf_ipt,
        .dump           =       tcf_ipt_dump,
        .cleanup        =       tcf_ipt_cleanup,
-       .lookup         =       tcf_hash_search,
        .init           =       tcf_ipt_init,
-       .walk           =       tcf_generic_walker
 };
 
 static struct tc_action_ops act_xt_ops = {
@@ -312,9 +310,7 @@ static struct tc_action_ops act_xt_ops = {
        .act            =       tcf_ipt,
        .dump           =       tcf_ipt_dump,
        .cleanup        =       tcf_ipt_cleanup,
-       .lookup         =       tcf_hash_search,
        .init           =       tcf_ipt_init,
-       .walk           =       tcf_generic_walker
 };
 
 MODULE_AUTHOR("Jamal Hadi Salim(2002-13)");
index 977c10e0631b6dfe4ead45af617c0ad93c4a0759..252378121ce7cd1848beab20aa666389937bf610 100644 (file)
@@ -271,9 +271,7 @@ static struct tc_action_ops act_mirred_ops = {
        .act            =       tcf_mirred,
        .dump           =       tcf_mirred_dump,
        .cleanup        =       tcf_mirred_cleanup,
-       .lookup         =       tcf_hash_search,
        .init           =       tcf_mirred_init,
-       .walk           =       tcf_generic_walker
 };
 
 MODULE_AUTHOR("Jamal Hadi Salim(2002)");
index 876f0ef29694a3f28260a221d0862d4fe3756f8d..6a15ace002411a8c11efeed6156d72324b9eb2ff 100644 (file)
@@ -308,9 +308,7 @@ static struct tc_action_ops act_nat_ops = {
        .act            =       tcf_nat,
        .dump           =       tcf_nat_dump,
        .cleanup        =       tcf_nat_cleanup,
-       .lookup         =       tcf_hash_search,
        .init           =       tcf_nat_init,
-       .walk           =       tcf_generic_walker
 };
 
 MODULE_DESCRIPTION("Stateless NAT actions");
index 7ed78c9e505cf7e18bc5a0b066837d19d33d4b10..03b67674169c5db79eb546d93d0b4833324786d3 100644 (file)
@@ -243,9 +243,7 @@ static struct tc_action_ops act_pedit_ops = {
        .act            =       tcf_pedit,
        .dump           =       tcf_pedit_dump,
        .cleanup        =       tcf_pedit_cleanup,
-       .lookup         =       tcf_hash_search,
        .init           =       tcf_pedit_init,
-       .walk           =       tcf_generic_walker
 };
 
 MODULE_AUTHOR("Jamal Hadi Salim(2002-4)");
index 272d8e924cf6b2467e2772898aca2d7895131545..16a62c36928a78110923d36d5b87808936d8f90a 100644 (file)
@@ -407,7 +407,6 @@ static struct tc_action_ops act_police_ops = {
        .act            =       tcf_act_police,
        .dump           =       tcf_act_police_dump,
        .cleanup        =       tcf_act_police_cleanup,
-       .lookup         =       tcf_hash_search,
        .init           =       tcf_act_police_locate,
        .walk           =       tcf_act_police_walker
 };
index 7725eb4ab756caa841eca2e0f4778880c310e5c4..31157d3e729c8c29e8bb89ce03fa68c5ad8e7f39 100644 (file)
@@ -201,7 +201,6 @@ static struct tc_action_ops act_simp_ops = {
        .dump           =       tcf_simp_dump,
        .cleanup        =       tcf_simp_cleanup,
        .init           =       tcf_simp_init,
-       .walk           =       tcf_generic_walker,
 };
 
 MODULE_AUTHOR("Jamal Hadi Salim(2005)");
index cb4221171f93f0c5b8fbb98f41b11241aa17d02a..35ea643b4325562d74c4c05d9950a4f8a8a7ad32 100644 (file)
@@ -203,7 +203,6 @@ static struct tc_action_ops act_skbedit_ops = {
        .dump           =       tcf_skbedit_dump,
        .cleanup        =       tcf_skbedit_cleanup,
        .init           =       tcf_skbedit_init,
-       .walk           =       tcf_generic_walker,
 };
 
 MODULE_AUTHOR("Alexander Duyck, <alexander.h.duyck@intel.com>");
index e332efb124cc0c34f93786232353c37dd2e10ea1..efc46ffed1fd63a5fb510046bc6fd013dd99c252 100644 (file)
@@ -573,7 +573,7 @@ void sctp_transport_burst_limited(struct sctp_transport *t)
        u32 old_cwnd = t->cwnd;
        u32 max_burst_bytes;
 
-       if (t->burst_limited)
+       if (t->burst_limited || asoc->max_burst == 0)
                return;
 
        max_burst_bytes = t->flight_size + (asoc->max_burst * asoc->pathmtu);
index 42fdfc634e568a58bda35d2dbb1effbf44dd1bd4..0a2aee060f9f05241bdedd25149b081e32bd7896 100644 (file)
@@ -536,8 +536,7 @@ static void warn_gssd(void)
        unsigned long now = jiffies;
 
        if (time_after(now, ratelimit)) {
-               printk(KERN_WARNING "RPC: AUTH_GSS upcall timed out.\n"
-                               "Please check user daemon is running.\n");
+               pr_warn("RPC: AUTH_GSS upcall failed. Please check user daemon is running.\n");
                ratelimit = now + 15*HZ;
        }
 }
@@ -600,7 +599,6 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred)
        struct rpc_pipe *pipe;
        struct rpc_cred *cred = &gss_cred->gc_base;
        struct gss_upcall_msg *gss_msg;
-       unsigned long timeout;
        DEFINE_WAIT(wait);
        int err;
 
@@ -608,17 +606,16 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred)
                __func__, from_kuid(&init_user_ns, cred->cr_uid));
 retry:
        err = 0;
-       /* Default timeout is 15s unless we know that gssd is not running */
-       timeout = 15 * HZ;
-       if (!sn->gssd_running)
-               timeout = HZ >> 2;
+       /* if gssd is down, just skip upcalling altogether */
+       if (!gssd_running(net)) {
+               warn_gssd();
+               return -EACCES;
+       }
        gss_msg = gss_setup_upcall(gss_auth, cred);
        if (PTR_ERR(gss_msg) == -EAGAIN) {
                err = wait_event_interruptible_timeout(pipe_version_waitqueue,
-                               sn->pipe_version >= 0, timeout);
+                               sn->pipe_version >= 0, 15 * HZ);
                if (sn->pipe_version < 0) {
-                       if (err == 0)
-                               sn->gssd_running = 0;
                        warn_gssd();
                        err = -EACCES;
                }
index 779742cfc1ffe3178fc0c320b6d0832e0f420d64..94e506f9d72bb62440d923360753c98ecf5f6725 100644 (file)
@@ -14,6 +14,7 @@ struct sunrpc_net {
        struct cache_detail *rsi_cache;
 
        struct super_block *pipefs_sb;
+       struct rpc_pipe *gssd_dummy;
        struct mutex pipefs_sb_lock;
 
        struct list_head all_clients;
@@ -32,8 +33,6 @@ struct sunrpc_net {
        int pipe_version;
        atomic_t pipe_users;
        struct proc_dir_entry *use_gssp_proc;
-
-       unsigned int gssd_running;
 };
 
 extern int sunrpc_net_id;
index bf04b30a788a5425b28ba70c11a50b77bfc9c697..5d973b25b5b0543fc5abb9afa3652fe809cb5387 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/fsnotify.h>
 #include <linux/kernel.h>
 #include <linux/rcupdate.h>
+#include <linux/utsname.h>
 
 #include <asm/ioctls.h>
 #include <linux/poll.h>
@@ -38,7 +39,7 @@
 #define NET_NAME(net)  ((net == &init_net) ? " (init_net)" : "")
 
 static struct file_system_type rpc_pipe_fs_type;
-
+static const struct rpc_pipe_ops gssd_dummy_pipe_ops;
 
 static struct kmem_cache *rpc_inode_cachep __read_mostly;
 
@@ -216,14 +217,11 @@ rpc_destroy_inode(struct inode *inode)
 static int
 rpc_pipe_open(struct inode *inode, struct file *filp)
 {
-       struct net *net = inode->i_sb->s_fs_info;
-       struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
        struct rpc_pipe *pipe;
        int first_open;
        int res = -ENXIO;
 
        mutex_lock(&inode->i_mutex);
-       sn->gssd_running = 1;
        pipe = RPC_I(inode)->pipe;
        if (pipe == NULL)
                goto out;
@@ -1159,6 +1157,7 @@ enum {
        RPCAUTH_nfsd4_cb,
        RPCAUTH_cache,
        RPCAUTH_nfsd,
+       RPCAUTH_gssd,
        RPCAUTH_RootEOF
 };
 
@@ -1195,6 +1194,10 @@ static const struct rpc_filelist files[] = {
                .name = "nfsd",
                .mode = S_IFDIR | S_IRUGO | S_IXUGO,
        },
+       [RPCAUTH_gssd] = {
+               .name = "gssd",
+               .mode = S_IFDIR | S_IRUGO | S_IXUGO,
+       },
 };
 
 /*
@@ -1208,13 +1211,24 @@ struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
 }
 EXPORT_SYMBOL_GPL(rpc_d_lookup_sb);
 
-void rpc_pipefs_init_net(struct net *net)
+int rpc_pipefs_init_net(struct net *net)
 {
        struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
 
+       sn->gssd_dummy = rpc_mkpipe_data(&gssd_dummy_pipe_ops, 0);
+       if (IS_ERR(sn->gssd_dummy))
+               return PTR_ERR(sn->gssd_dummy);
+
        mutex_init(&sn->pipefs_sb_lock);
-       sn->gssd_running = 1;
        sn->pipe_version = -1;
+       return 0;
+}
+
+void rpc_pipefs_exit_net(struct net *net)
+{
+       struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+
+       rpc_destroy_pipe_data(sn->gssd_dummy);
 }
 
 /*
@@ -1244,11 +1258,122 @@ void rpc_put_sb_net(const struct net *net)
 }
 EXPORT_SYMBOL_GPL(rpc_put_sb_net);
 
+static const struct rpc_filelist gssd_dummy_clnt_dir[] = {
+       [0] = {
+               .name = "clntXX",
+               .mode = S_IFDIR | S_IRUGO | S_IXUGO,
+       },
+};
+
+static ssize_t
+dummy_downcall(struct file *filp, const char __user *src, size_t len)
+{
+       return -EINVAL;
+}
+
+static const struct rpc_pipe_ops gssd_dummy_pipe_ops = {
+       .upcall         = rpc_pipe_generic_upcall,
+       .downcall       = dummy_downcall,
+};
+
+/*
+ * Here we present a bogus "info" file to keep rpc.gssd happy. We don't expect
+ * that it will ever use this info to handle an upcall, but rpc.gssd expects
+ * that this file will be there and have a certain format.
+ */
+static int
+rpc_show_dummy_info(struct seq_file *m, void *v)
+{
+       seq_printf(m, "RPC server: %s\n", utsname()->nodename);
+       seq_printf(m, "service: foo (1) version 0\n");
+       seq_printf(m, "address: 127.0.0.1\n");
+       seq_printf(m, "protocol: tcp\n");
+       seq_printf(m, "port: 0\n");
+       return 0;
+}
+
+static int
+rpc_dummy_info_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, rpc_show_dummy_info, NULL);
+}
+
+static const struct file_operations rpc_dummy_info_operations = {
+       .owner          = THIS_MODULE,
+       .open           = rpc_dummy_info_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
+static const struct rpc_filelist gssd_dummy_info_file[] = {
+       [0] = {
+               .name = "info",
+               .i_fop = &rpc_dummy_info_operations,
+               .mode = S_IFREG | S_IRUSR,
+       },
+};
+
+/**
+ * rpc_gssd_dummy_populate - create a dummy gssd pipe
+ * @root:      root of the rpc_pipefs filesystem
+ * @pipe_data: pipe data created when netns is initialized
+ *
+ * Create a dummy set of directories and a pipe that gssd can hold open to
+ * indicate that it is up and running.
+ */
+static struct dentry *
+rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data)
+{
+       int ret = 0;
+       struct dentry *gssd_dentry;
+       struct dentry *clnt_dentry = NULL;
+       struct dentry *pipe_dentry = NULL;
+       struct qstr q = QSTR_INIT(files[RPCAUTH_gssd].name,
+                                 strlen(files[RPCAUTH_gssd].name));
+
+       /* We should never get this far if "gssd" doesn't exist */
+       gssd_dentry = d_hash_and_lookup(root, &q);
+       if (!gssd_dentry)
+               return ERR_PTR(-ENOENT);
+
+       ret = rpc_populate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1, NULL);
+       if (ret) {
+               pipe_dentry = ERR_PTR(ret);
+               goto out;
+       }
+
+       q.name = gssd_dummy_clnt_dir[0].name;
+       q.len = strlen(gssd_dummy_clnt_dir[0].name);
+       clnt_dentry = d_hash_and_lookup(gssd_dentry, &q);
+       if (!clnt_dentry) {
+               pipe_dentry = ERR_PTR(-ENOENT);
+               goto out;
+       }
+
+       ret = rpc_populate(clnt_dentry, gssd_dummy_info_file, 0, 1, NULL);
+       if (ret) {
+               __rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1);
+               pipe_dentry = ERR_PTR(ret);
+               goto out;
+       }
+
+       pipe_dentry = rpc_mkpipe_dentry(clnt_dentry, "gssd", NULL, pipe_data);
+       if (IS_ERR(pipe_dentry)) {
+               __rpc_depopulate(clnt_dentry, gssd_dummy_info_file, 0, 1);
+               __rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1);
+       }
+out:
+       dput(clnt_dentry);
+       dput(gssd_dentry);
+       return pipe_dentry;
+}
+
 static int
 rpc_fill_super(struct super_block *sb, void *data, int silent)
 {
        struct inode *inode;
-       struct dentry *root;
+       struct dentry *root, *gssd_dentry;
        struct net *net = data;
        struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
        int err;
@@ -1266,6 +1391,13 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
                return -ENOMEM;
        if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL))
                return -ENOMEM;
+
+       gssd_dentry = rpc_gssd_dummy_populate(root, sn->gssd_dummy);
+       if (IS_ERR(gssd_dentry)) {
+               __rpc_depopulate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF);
+               return PTR_ERR(gssd_dentry);
+       }
+
        dprintk("RPC:       sending pipefs MOUNT notification for net %p%s\n",
                net, NET_NAME(net));
        mutex_lock(&sn->pipefs_sb_lock);
@@ -1280,6 +1412,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
        return 0;
 
 err_depopulate:
+       dput(gssd_dentry);
        blocking_notifier_call_chain(&rpc_pipefs_notifier_list,
                                           RPC_PIPEFS_UMOUNT,
                                           sb);
@@ -1289,6 +1422,16 @@ err_depopulate:
        return err;
 }
 
+bool
+gssd_running(struct net *net)
+{
+       struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
+       struct rpc_pipe *pipe = sn->gssd_dummy;
+
+       return pipe->nreaders || pipe->nwriters;
+}
+EXPORT_SYMBOL_GPL(gssd_running);
+
 static struct dentry *
 rpc_mount(struct file_system_type *fs_type,
                int flags, const char *dev_name, void *data)
index 3d6498af9adc1a1035005c735ee932de6488bee3..cd30120de9e4eb7ba413135dd2eb690311d784cb 100644 (file)
@@ -44,12 +44,17 @@ static __net_init int sunrpc_init_net(struct net *net)
        if (err)
                goto err_unixgid;
 
-       rpc_pipefs_init_net(net);
+       err = rpc_pipefs_init_net(net);
+       if (err)
+               goto err_pipefs;
+
        INIT_LIST_HEAD(&sn->all_clients);
        spin_lock_init(&sn->rpc_client_lock);
        spin_lock_init(&sn->rpcb_clnt_lock);
        return 0;
 
+err_pipefs:
+       unix_gid_cache_destroy(net);
 err_unixgid:
        ip_map_cache_destroy(net);
 err_ipmap:
@@ -60,6 +65,7 @@ err_proc:
 
 static __net_exit void sunrpc_exit_net(struct net *net)
 {
+       rpc_pipefs_exit_net(net);
        unix_gid_cache_destroy(net);
        ip_map_cache_destroy(net);
        rpc_proc_exit(net);
index aff959e5a1b360e7cb467cade7f7d617544b3909..52b865fb7351ac3c221c120bc0cc236687a12513 100644 (file)
@@ -451,6 +451,15 @@ int wiphy_register(struct wiphy *wiphy)
        int i;
        u16 ifmodes = wiphy->interface_modes;
 
+       /* support for 5/10 MHz is broken due to nl80211 API mess - disable */
+       wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_5_10_MHZ;
+
+       /*
+        * There are major locking problems in nl80211/mac80211 for CSA,
+        * disable for all drivers until this has been reworked.
+        */
+       wiphy->flags &= ~WIPHY_FLAG_HAS_CHANNEL_SWITCH;
+
 #ifdef CONFIG_PM
        if (WARN_ON(wiphy->wowlan &&
                    (wiphy->wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) &&
index 9d797df56649c5a47fdf1f61e665ee31e4b77e7c..89737ee2669a8de9bc8f02aa1c392052369d210b 100644 (file)
@@ -262,7 +262,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
 
        /* try to find an IBSS channel if none requested ... */
        if (!wdev->wext.ibss.chandef.chan) {
-               wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
+               struct ieee80211_channel *new_chan = NULL;
 
                for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
                        struct ieee80211_supported_band *sband;
@@ -278,18 +278,19 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,
                                        continue;
                                if (chan->flags & IEEE80211_CHAN_DISABLED)
                                        continue;
-                               wdev->wext.ibss.chandef.chan = chan;
-                               wdev->wext.ibss.chandef.center_freq1 =
-                                       chan->center_freq;
+                               new_chan = chan;
                                break;
                        }
 
-                       if (wdev->wext.ibss.chandef.chan)
+                       if (new_chan)
                                break;
                }
 
-               if (!wdev->wext.ibss.chandef.chan)
+               if (!new_chan)
                        return -EINVAL;
+
+               cfg80211_chandef_create(&wdev->wext.ibss.chandef, new_chan,
+                                       NL80211_CHAN_NO_HT);
        }
 
        /* don't join -- SSID is not there */
@@ -363,9 +364,8 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
                return err;
 
        if (chan) {
-               wdev->wext.ibss.chandef.chan = chan;
-               wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
-               wdev->wext.ibss.chandef.center_freq1 = freq;
+               cfg80211_chandef_create(&wdev->wext.ibss.chandef, chan,
+                                       NL80211_CHAN_NO_HT);
                wdev->wext.ibss.channel_fixed = true;
        } else {
                /* cfg80211_ibss_wext_join will pick one if needed */
index a1eb21073176115a587f9eb1edf5d36dba582484..138dc3bb8b67d8c345531a95ce0c8342271ce79e 100644 (file)
@@ -2687,7 +2687,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
        hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
                             NL80211_CMD_NEW_KEY);
        if (!hdr)
-               return -ENOBUFS;
+               goto nla_put_failure;
 
        cookie.msg = msg;
        cookie.idx = key_idx;
@@ -5349,6 +5349,10 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
                                err = -EINVAL;
                                goto out_free;
                        }
+
+                       if (!wiphy->bands[band])
+                               continue;
+
                        err = ieee80211_get_ratemask(wiphy->bands[band],
                                                     nla_data(attr),
                                                     nla_len(attr),
@@ -9633,8 +9637,9 @@ static int nl80211_add_scan_req(struct sk_buff *msg,
            nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie))
                goto nla_put_failure;
 
-       if (req->flags)
-               nla_put_u32(msg, NL80211_ATTR_SCAN_FLAGS, req->flags);
+       if (req->flags &&
+           nla_put_u32(msg, NL80211_ATTR_SCAN_FLAGS, req->flags))
+               goto nla_put_failure;
 
        return 0;
  nla_put_failure:
@@ -11093,6 +11098,8 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
                struct nlattr *reasons;
 
                reasons = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS);
+               if (!reasons)
+                       goto free_msg;
 
                if (wakeup->disconnect &&
                    nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT))
@@ -11118,16 +11125,18 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
                                wakeup->pattern_idx))
                        goto free_msg;
 
-               if (wakeup->tcp_match)
-                       nla_put_flag(msg, NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH);
+               if (wakeup->tcp_match &&
+                   nla_put_flag(msg, NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH))
+                       goto free_msg;
 
-               if (wakeup->tcp_connlost)
-                       nla_put_flag(msg,
-                                    NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST);
+               if (wakeup->tcp_connlost &&
+                   nla_put_flag(msg, NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST))
+                       goto free_msg;
 
-               if (wakeup->tcp_nomoretokens)
-                       nla_put_flag(msg,
-                               NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS);
+               if (wakeup->tcp_nomoretokens &&
+                   nla_put_flag(msg,
+                                NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS))
+                       goto free_msg;
 
                if (wakeup->packet) {
                        u32 pkt_attr = NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211;
@@ -11263,24 +11272,29 @@ void cfg80211_ft_event(struct net_device *netdev,
                return;
 
        hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_FT_EVENT);
-       if (!hdr) {
-               nlmsg_free(msg);
-               return;
-       }
+       if (!hdr)
+               goto out;
 
-       nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
-       nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
-       nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, ft_event->target_ap);
-       if (ft_event->ies)
-               nla_put(msg, NL80211_ATTR_IE, ft_event->ies_len, ft_event->ies);
-       if (ft_event->ric_ies)
-               nla_put(msg, NL80211_ATTR_IE_RIC, ft_event->ric_ies_len,
-                       ft_event->ric_ies);
+       if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
+           nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
+           nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, ft_event->target_ap))
+               goto out;
+
+       if (ft_event->ies &&
+           nla_put(msg, NL80211_ATTR_IE, ft_event->ies_len, ft_event->ies))
+               goto out;
+       if (ft_event->ric_ies &&
+           nla_put(msg, NL80211_ATTR_IE_RIC, ft_event->ric_ies_len,
+                   ft_event->ric_ies))
+               goto out;
 
        genlmsg_end(msg, hdr);
 
        genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
                                NL80211_MCGRP_MLME, GFP_KERNEL);
+       return;
+ out:
+       nlmsg_free(msg);
 }
 EXPORT_SYMBOL(cfg80211_ft_event);
 
index 90e521fde35fa827cf5008838024ef1bf1d03a88..65014e1495bf1751beef070887d53ed3d2a0f4cb 100644 (file)
@@ -172,8 +172,15 @@ fi
 
 # Install the maintainer scripts
 # Note: hook scripts under /etc/kernel are also executed by official Debian
-# kernel packages, as well as kernel packages built using make-kpkg
+# kernel packages, as well as kernel packages built using make-kpkg.
+# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and
+# so do we; recent versions of dracut and initramfs-tools will obey this.
 debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
+if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then
+       want_initrd=Yes
+else
+       want_initrd=No
+fi
 for script in postinst postrm preinst prerm ; do
        mkdir -p "$tmpdir$debhookdir/$script.d"
        cat <<EOF > "$tmpdir/DEBIAN/$script"
@@ -184,6 +191,9 @@ set -e
 # Pass maintainer script parameters to hook scripts
 export DEB_MAINT_PARAMS="\$*"
 
+# Tell initramfs builder whether it's wanted
+export INITRD=$want_initrd
+
 test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
 exit 0
 EOF
index 5f7a8b663cb9c9eb59b32f4ce63076a6a86914cc..7941fbdfb050e573120f36b770ae8321130d8d01 100644 (file)
 #include <tools/be_byteshift.h>
 #include <tools/le_byteshift.h>
 
+#ifndef EM_ARCOMPACT
+#define EM_ARCOMPACT   93
+#endif
+
 #ifndef EM_AARCH64
 #define EM_AARCH64     183
 #endif
@@ -268,6 +272,7 @@ do_file(char const *const fname)
        case EM_S390:
                custom_sort = sort_relative_table;
                break;
+       case EM_ARCOMPACT:
        case EM_ARM:
        case EM_AARCH64:
        case EM_MIPS:
index 1f2717f817a0142f4ef17910ffd50dafe42e4c09..3fbf2883e06e855e7a79213b0414e3049b539f28 100644 (file)
@@ -2936,7 +2936,6 @@ static const struct snd_pci_quirk cxt5066_cfg_tbl[] = {
        SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO),
        SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD),
        SND_PCI_QUIRK(0x1028, 0x050f, "Dell Inspiron", CXT5066_IDEAPAD),
-       SND_PCI_QUIRK(0x1028, 0x0510, "Dell Vostro", CXT5066_IDEAPAD),
        SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP),
        SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS),
        SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS),
index c5ea483d755981cdbe6c24c24ba0c98478e4c709..f27272ac2b804df9c05403207bacead6d39a89cb 100644 (file)
@@ -3849,6 +3849,7 @@ enum {
        ALC269_FIXUP_ASUS_X101,
        ALC271_FIXUP_AMIC_MIC2,
        ALC271_FIXUP_HP_GATE_MIC_JACK,
+       ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
        ALC269_FIXUP_ACER_AC700,
        ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
        ALC269VB_FIXUP_ASUS_ZENBOOK,
@@ -4111,6 +4112,12 @@ static const struct hda_fixup alc269_fixups[] = {
                .chained = true,
                .chain_id = ALC271_FIXUP_AMIC_MIC2,
        },
+       [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc269_fixup_limit_int_mic_boost,
+               .chained = true,
+               .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
+       },
        [ALC269_FIXUP_ACER_AC700] = {
                .type = HDA_FIXUP_PINS,
                .v.pins = (const struct hda_pintbl[]) {
@@ -4208,6 +4215,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
        SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
        SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
+       SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
        SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
        SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
index 35e277379b86ce80d56737e3e0c05a5b3772fb2c..f43be6d4c549876b0d8c5f18307b46b4c86deb2a 100644 (file)
@@ -143,6 +143,7 @@ struct fsl_ssi_private {
        bool ssi_on_imx;
        bool imx_ac97;
        bool use_dma;
+       bool use_dual_fifo;
        struct clk *clk;
        struct snd_dmaengine_dai_dma_data dma_params_tx;
        struct snd_dmaengine_dai_dma_data dma_params_rx;
@@ -413,6 +414,12 @@ static int fsl_ssi_setup(struct fsl_ssi_private *ssi_private)
                write_ssi(CCSR_SSI_SOR_WAIT(3), &ssi->sor);
        }
 
+       if (ssi_private->use_dual_fifo) {
+               write_ssi_mask(&ssi->srcr, 0, CCSR_SSI_SRCR_RFEN1);
+               write_ssi_mask(&ssi->stcr, 0, CCSR_SSI_STCR_TFEN1);
+               write_ssi_mask(&ssi->scr, 0, CCSR_SSI_SCR_TCH_EN);
+       }
+
        return 0;
 }
 
@@ -480,6 +487,15 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
                ssi_private->second_stream = substream;
        }
 
+       /* When using dual fifo mode, it is safer to ensure an even period
+        * size. If appearing to an odd number while DMA always starts its
+        * task from fifo0, fifo1 would be neglected at the end of each
+        * period. But SSI would still access fifo1 with an invalid data.
+        */
+       if (ssi_private->use_dual_fifo)
+               snd_pcm_hw_constraint_step(substream->runtime, 0,
+                               SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2);
+
        return 0;
 }
 
@@ -947,7 +963,7 @@ static int fsl_ssi_probe(struct platform_device *pdev)
                ssi_private->fifo_depth = 8;
 
        if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx21-ssi")) {
-               u32 dma_events[2];
+               u32 dma_events[2], dmas[4];
                ssi_private->ssi_on_imx = true;
 
                ssi_private->clk = devm_clk_get(&pdev->dev, NULL);
@@ -1001,6 +1017,15 @@ static int fsl_ssi_probe(struct platform_device *pdev)
                        dma_events[0], shared ? IMX_DMATYPE_SSI_SP : IMX_DMATYPE_SSI);
                imx_pcm_dma_params_init_data(&ssi_private->filter_data_rx,
                        dma_events[1], shared ? IMX_DMATYPE_SSI_SP : IMX_DMATYPE_SSI);
+               if (!of_property_read_u32_array(pdev->dev.of_node, "dmas", dmas, 4)
+                               && dmas[2] == IMX_DMATYPE_SSI_DUAL) {
+                       ssi_private->use_dual_fifo = true;
+                       /* When using dual fifo mode, we need to keep watermark
+                        * as even numbers due to dma script limitation.
+                        */
+                       ssi_private->dma_params_tx.maxburst &= ~0x1;
+                       ssi_private->dma_params_rx.maxburst &= ~0x1;
+               }
        } else if (ssi_private->use_dma) {
                /* The 'name' should not have any slashes in it. */
                ret = devm_request_irq(&pdev->dev, ssi_private->irq,
index 3454262358b398913779954846ab12c11e7c5973..f4b12c216f1cd55c2db4396746a5abc9f20ed302 100644 (file)
@@ -1603,7 +1603,7 @@ static int snd_microii_controls_create(struct usb_mixer_interface *mixer)
                        return err;
        }
 
-       return err;
+       return 0;
 }
 
 int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
index 66cace601e5721cf920c89f3b365c75f6695ce67..0f10b81e3322694df614bf23a0b1824d415b34ce 100644 (file)
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/delay.h>
-
+#include <linux/acpi.h>
 #include <asm/io.h>
 
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
-
 static int pm_tmr_ioport = 0;
 
 /*helper function to safely read acpi pm timesource*/
index 9d77f13c2d2548934293662e314828a817d16144..72be53c334bd2e9cf237a1f17a5264f2ffd136a8 100644 (file)
@@ -77,14 +77,32 @@ unsigned int tcc_activation_temp_override;
 double rapl_power_units, rapl_energy_units, rapl_time_units;
 double rapl_joule_counter_range;
 
-#define RAPL_PKG       (1 << 0)
-#define RAPL_CORES     (1 << 1)
-#define RAPL_GFX       (1 << 2)
-#define RAPL_DRAM      (1 << 3)
-#define RAPL_PKG_PERF_STATUS   (1 << 4)
-#define RAPL_DRAM_PERF_STATUS  (1 << 5)
-#define RAPL_PKG_POWER_INFO    (1 << 6)
-#define RAPL_CORE_POLICY       (1 << 7)
+#define RAPL_PKG               (1 << 0)
+                                       /* 0x610 MSR_PKG_POWER_LIMIT */
+                                       /* 0x611 MSR_PKG_ENERGY_STATUS */
+#define RAPL_PKG_PERF_STATUS   (1 << 1)
+                                       /* 0x613 MSR_PKG_PERF_STATUS */
+#define RAPL_PKG_POWER_INFO    (1 << 2)
+                                       /* 0x614 MSR_PKG_POWER_INFO */
+
+#define RAPL_DRAM              (1 << 3)
+                                       /* 0x618 MSR_DRAM_POWER_LIMIT */
+                                       /* 0x619 MSR_DRAM_ENERGY_STATUS */
+                                       /* 0x61c MSR_DRAM_POWER_INFO */
+#define RAPL_DRAM_PERF_STATUS  (1 << 4)
+                                       /* 0x61b MSR_DRAM_PERF_STATUS */
+
+#define RAPL_CORES             (1 << 5)
+                                       /* 0x638 MSR_PP0_POWER_LIMIT */
+                                       /* 0x639 MSR_PP0_ENERGY_STATUS */
+#define RAPL_CORE_POLICY       (1 << 6)
+                                       /* 0x63a MSR_PP0_POLICY */
+
+
+#define RAPL_GFX               (1 << 7)
+                                       /* 0x640 MSR_PP1_POWER_LIMIT */
+                                       /* 0x641 MSR_PP1_ENERGY_STATUS */
+                                       /* 0x642 MSR_PP1_POLICY */
 #define        TJMAX_DEFAULT   100
 
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
@@ -1479,7 +1497,7 @@ int has_nehalem_turbo_ratio_limit(unsigned int family, unsigned int model)
        case 0x3A:      /* IVB */
        case 0x3E:      /* IVB Xeon */
        case 0x3C:      /* HSW */
-       case 0x3F:      /* HSW */
+       case 0x3F:      /* HSX */
        case 0x45:      /* HSW */
        case 0x46:      /* HSW */
        case 0x37:      /* BYT */
@@ -1595,11 +1613,13 @@ void rapl_probe(unsigned int family, unsigned int model)
        case 0x2A:
        case 0x3A:
        case 0x3C:      /* HSW */
-       case 0x3F:      /* HSW */
        case 0x45:      /* HSW */
        case 0x46:      /* HSW */
                do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_GFX | RAPL_PKG_POWER_INFO;
                break;
+       case 0x3F:      /* HSX */
+               do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO;
+               break;
        case 0x2D:
        case 0x3E:
                do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_PKG_PERF_STATUS | RAPL_DRAM_PERF_STATUS | RAPL_PKG_POWER_INFO;
@@ -2416,7 +2436,7 @@ int main(int argc, char **argv)
        cmdline(argc, argv);
 
        if (verbose)
-               fprintf(stderr, "turbostat v3.5 April 26, 2013"
+               fprintf(stderr, "turbostat v3.6 Dec 2, 2013"
                        " - Len Brown <lenb@kernel.org>\n");
 
        turbostat_init();
index 396d6c44e9d738d8cf85a0ce20317b001c573212..acf2165c04e64f8b15e844b787de9f59c324b199 100644 (file)
@@ -3,11 +3,12 @@
 CC = $(CROSS_COMPILE)gcc
 PTHREAD_LIBS = -lpthread
 WARNINGS = -Wall -Wextra
-CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) -I../include
+CFLAGS = $(WARNINGS) -g -I../include
+LDFLAGS = $(PTHREAD_LIBS)
 
 all: testusb ffs-test
 %: %.c
-       $(CC) $(CFLAGS) -o $@ $^
+       $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
 
 clean:
        $(RM) testusb ffs-test